1 | <?php |
||
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) |
||
37 | |||
38 | |||
39 | /** |
||
40 | * Callback on in_admin_footer that is used to output the exit modal container. |
||
41 | */ |
||
42 | public function modalContainer() |
||
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 | $current_user = new WP_User(get_current_user_id()); |
||
56 | $this->assets_registry->addData( |
||
57 | 'exitModali18n', |
||
58 | array( |
||
59 | 'introText' => htmlspecialchars( |
||
60 | __( |
||
61 | 'Do you have a moment to share why you are deactivating Event Espresso?', |
||
62 | 'event_espresso' |
||
63 | ), |
||
64 | ENT_NOQUOTES |
||
65 | ), |
||
66 | 'doSurveyButtonText' => htmlspecialchars( |
||
67 | __( |
||
68 | 'Sure I\'ll help', |
||
69 | 'event_espresso' |
||
70 | ), |
||
71 | ENT_NOQUOTES |
||
72 | ), |
||
73 | 'skipButtonText' => htmlspecialchars( |
||
74 | __( |
||
75 | 'Skip', |
||
76 | 'event_espresso' |
||
77 | ), |
||
78 | ENT_NOQUOTES |
||
79 | ) |
||
80 | ) |
||
81 | ); |
||
82 | $this->assets_registry->addData( |
||
83 | 'exitModalInfo', |
||
84 | array( |
||
85 | 'firstname' => htmlspecialchars($current_user->user_firstname), |
||
86 | 'emailaddress' => htmlspecialchars($current_user->user_email), |
||
87 | 'website' => htmlspecialchars(site_url()), |
||
88 | 'isModalActive' => $this->isModalActive() |
||
89 | ) |
||
90 | ); |
||
91 | |||
92 | wp_enqueue_script('ee-wp-plugins-page'); |
||
93 | wp_enqueue_style('ee-wp-plugins-page'); |
||
94 | } |
||
95 | |||
96 | |||
97 | /** |
||
98 | * Exposes a filter switch for turning off the enqueueing of the modal script. |
||
99 | * @return bool |
||
100 | */ |
||
101 | private function isModalActive() |
||
111 | } |