Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 7 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 1 |
SiteLaunched | |
0.00% |
0 / 7 |
|
0.00% |
0 / 2 |
6 | |
0.00% |
0 / 1 |
send | |
0.00% |
0 / 5 |
|
0.00% |
0 / 1 |
2 | |||
getInstallTime | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 |
1 | <?php |
2 | /** |
3 | * Site launched deactivation event. |
4 | * |
5 | * @package NewfoldLabs\WP\Module\Deactivation |
6 | */ |
7 | |
8 | namespace NewfoldLabs\WP\Module\Deactivation\Events; |
9 | |
10 | /** |
11 | * Site launched event class. |
12 | */ |
13 | class SiteLaunched extends Event { |
14 | /** |
15 | * send event. |
16 | * |
17 | * @return void |
18 | */ |
19 | public function send() { |
20 | $this->action = 'site_launched'; |
21 | $this->data = array( |
22 | 'ttl' => $this->getInstallTime(), |
23 | ); |
24 | |
25 | return $this->sendEvent(); |
26 | } |
27 | |
28 | /** |
29 | * Calculate install time. |
30 | * |
31 | * @return int |
32 | */ |
33 | private function getInstallTime() { |
34 | $mm_install_time = get_option( 'mm_install_date', gmdate( 'M d, Y' ) ); |
35 | |
36 | return time() - strtotime( $mm_install_time ); |
37 | } |
38 | } |