1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace EventEspresso\core\domain\services\admin\ajax; |
4
|
|
|
|
5
|
|
|
use EventEspresso\core\exceptions\InvalidClassException; |
6
|
|
|
use EventEspresso\core\services\loaders\LoaderInterface; |
7
|
|
|
use EventEspresso\core\services\request\RequestInterface; |
8
|
|
|
|
9
|
|
|
/** |
10
|
|
|
* Class WordpressHeartbeat |
11
|
|
|
* Directs WordPress Heartbeat AJAX requests to the appropriate handler |
12
|
|
|
* |
13
|
|
|
* @package EventEspresso\core\domain\services\admin\ajax |
14
|
|
|
* @author Brent Christensen |
15
|
|
|
* @since $VID:$ |
16
|
|
|
*/ |
17
|
|
|
class WordpressHeartbeat |
18
|
|
|
{ |
19
|
|
|
|
20
|
|
|
/** |
21
|
|
|
* @var LoaderInterface $loader |
22
|
|
|
*/ |
23
|
|
|
protected $loader; |
24
|
|
|
|
25
|
|
|
/** |
26
|
|
|
* @var RequestInterface $request |
27
|
|
|
*/ |
28
|
|
|
protected $request; |
29
|
|
|
|
30
|
|
|
|
31
|
|
|
/** |
32
|
|
|
* WordpressHeartbeat constructor. |
33
|
|
|
* |
34
|
|
|
* @param LoaderInterface $loader |
35
|
|
|
* @param RequestInterface $request |
36
|
|
|
*/ |
37
|
|
|
public function __construct( |
38
|
|
|
LoaderInterface $loader, |
39
|
|
|
RequestInterface $request |
40
|
|
|
) { |
41
|
|
|
$this->loader = $loader; |
42
|
|
|
$this->request = $request; |
43
|
|
|
do_action('AHEE__EventEspresso_core_domain_services_admin_ajax_WordpressHeartbeat__constructor', $this); |
44
|
|
|
add_action('AHEE__EE_System__core_loaded_and_ready', array($this, 'resolveRoutes')); |
45
|
|
|
} |
46
|
|
|
|
47
|
|
|
|
48
|
|
|
/** |
49
|
|
|
* @since $VID:$ |
50
|
|
|
* @throws InvalidClassException |
51
|
|
|
*/ |
52
|
|
|
public function resolveRoutes() |
53
|
|
|
{ |
54
|
|
|
$screenID = $this->request->getRequestParam('screen_id'); |
55
|
|
|
$heartbeat_data = $this->request->getRequestParam('data', array()); |
56
|
|
|
if ($screenID === 'espresso_events') { |
57
|
|
|
$this->loader->getShared( |
58
|
|
|
'EventEspresso\core\domain\services\admin\ajax\EventEditorHeartbeat' |
59
|
|
|
); |
60
|
|
|
} else if ($screenID === 'front'&& ! empty($heartbeat_data['espresso_thank_you_page'])) { |
61
|
|
|
$this->loader->getShared( |
62
|
|
|
'EventEspresso\core\domain\services\admin\ajax\ThankYouPageIpnMonitor' |
63
|
|
|
); |
64
|
|
|
} |
65
|
|
|
} |
66
|
|
|
|
67
|
|
|
} |