|
1
|
|
|
<?php |
|
2
|
|
|
namespace EventEspresso\core\domain\services\admin; |
|
3
|
|
|
|
|
4
|
|
|
use EventEspresso\core\services\assets\Registry; |
|
5
|
|
|
use function htmlspecialchars_decode; |
|
6
|
|
|
use InvalidArgumentException; |
|
7
|
|
|
|
|
8
|
|
|
/** |
|
9
|
|
|
* ExitModal |
|
10
|
|
|
* Sets up server side logic etc for the exit modal survey triggered when deactivating EE core. |
|
11
|
|
|
* |
|
12
|
|
|
* DEVELOPERS: this is a in progress api, do not use this class or rely on its api to remain consistent. |
|
13
|
|
|
* |
|
14
|
|
|
* @package EventEspresso\core\domain\services\admin |
|
15
|
|
|
* @author Darren Ethier |
|
16
|
|
|
* @since $VID:$ |
|
17
|
|
|
*/ |
|
18
|
|
|
class ExitModal |
|
19
|
|
|
{ |
|
20
|
|
|
|
|
21
|
|
|
/** |
|
22
|
|
|
* @var Registry |
|
23
|
|
|
*/ |
|
24
|
|
|
private $assets_registry; |
|
25
|
|
|
|
|
26
|
|
|
/** |
|
27
|
|
|
* ExitModal constructor. |
|
28
|
|
|
* |
|
29
|
|
|
* @param Registry $assets_registry |
|
30
|
|
|
*/ |
|
31
|
|
|
public function __construct(Registry $assets_registry) |
|
32
|
|
|
{ |
|
33
|
|
|
$this->assets_registry = $assets_registry; |
|
34
|
|
|
add_action('in_admin_footer', array($this, 'modalContainer')); |
|
35
|
|
|
add_action('admin_enqueue_scripts', array($this, 'enqueues')); |
|
36
|
|
|
} |
|
37
|
|
|
|
|
38
|
|
|
|
|
39
|
|
|
/** |
|
40
|
|
|
* Callback on in_admin_footer that is used to output the exit modal container. |
|
41
|
|
|
*/ |
|
42
|
|
|
public function modalContainer() |
|
43
|
|
|
{ |
|
44
|
|
|
echo '<div id="ee-exit-survey-modal"></div>'; |
|
45
|
|
|
} |
|
46
|
|
|
|
|
47
|
|
|
|
|
48
|
|
|
/** |
|
49
|
|
|
* Callback for `admin_enqueue_scripts` to take care of enqueueing scripts and styles specific to the modal. |
|
50
|
|
|
* |
|
51
|
|
|
* @throws InvalidArgumentException |
|
52
|
|
|
*/ |
|
53
|
|
|
public function enqueues() |
|
54
|
|
|
{ |
|
55
|
|
|
$this->assets_registry->addData( |
|
56
|
|
|
'exitModali18n', |
|
57
|
|
|
array( |
|
58
|
|
|
'introText' => htmlspecialchars( |
|
59
|
|
|
__( |
|
60
|
|
|
'Do you have a moment to share why you are deactivating Event Espresso?', |
|
61
|
|
|
'event_espresso' |
|
62
|
|
|
), |
|
63
|
|
|
ENT_NOQUOTES |
|
64
|
|
|
), |
|
65
|
|
|
'doSurveyButtonText' => htmlspecialchars( |
|
66
|
|
|
__( |
|
67
|
|
|
'Sure I\'ll help', |
|
68
|
|
|
'event_espresso' |
|
69
|
|
|
), |
|
70
|
|
|
ENT_NOQUOTES |
|
71
|
|
|
), |
|
72
|
|
|
'skipButtonText' => htmlspecialchars( |
|
73
|
|
|
__( |
|
74
|
|
|
'Skip', |
|
75
|
|
|
'event_espresso' |
|
76
|
|
|
), |
|
77
|
|
|
ENT_NOQUOTES |
|
78
|
|
|
) |
|
79
|
|
|
) |
|
80
|
|
|
); |
|
81
|
|
|
wp_enqueue_script('ee-exit-modal-survey'); |
|
82
|
|
|
wp_enqueue_style('ee-exit-modal-survey'); |
|
83
|
|
|
} |
|
84
|
|
|
} |