@@ -18,68 +18,68 @@ |
||
| 18 | 18 | class ExitModal |
| 19 | 19 | { |
| 20 | 20 | |
| 21 | - /** |
|
| 22 | - * @var Registry |
|
| 23 | - */ |
|
| 24 | - private $assets_registry; |
|
| 21 | + /** |
|
| 22 | + * @var Registry |
|
| 23 | + */ |
|
| 24 | + private $assets_registry; |
|
| 25 | 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 | - } |
|
| 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 | 37 | |
| 38 | 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 | - } |
|
| 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 | 46 | |
| 47 | 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 | - 'exitModalInfo', |
|
| 58 | - array( |
|
| 59 | - 'firstname' => htmlspecialchars($current_user->user_firstname), |
|
| 60 | - 'emailaddress' => htmlspecialchars($current_user->user_email), |
|
| 61 | - 'website' => htmlspecialchars(site_url()), |
|
| 62 | - 'isModalActive' => $this->isModalActive() |
|
| 63 | - ) |
|
| 64 | - ); |
|
| 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 | + 'exitModalInfo', |
|
| 58 | + array( |
|
| 59 | + 'firstname' => htmlspecialchars($current_user->user_firstname), |
|
| 60 | + 'emailaddress' => htmlspecialchars($current_user->user_email), |
|
| 61 | + 'website' => htmlspecialchars(site_url()), |
|
| 62 | + 'isModalActive' => $this->isModalActive() |
|
| 63 | + ) |
|
| 64 | + ); |
|
| 65 | 65 | |
| 66 | - wp_enqueue_script('ee-wp-plugins-page'); |
|
| 67 | - wp_enqueue_style('ee-wp-plugins-page'); |
|
| 68 | - } |
|
| 66 | + wp_enqueue_script('ee-wp-plugins-page'); |
|
| 67 | + wp_enqueue_style('ee-wp-plugins-page'); |
|
| 68 | + } |
|
| 69 | 69 | |
| 70 | 70 | |
| 71 | - /** |
|
| 72 | - * Exposes a filter switch for turning off the enqueueing of the modal script. |
|
| 73 | - * @return bool |
|
| 74 | - */ |
|
| 75 | - private function isModalActive() |
|
| 76 | - { |
|
| 77 | - return filter_var( |
|
| 78 | - apply_filters( |
|
| 79 | - 'FHEE__EventEspresso_core_domain_services_admin_ExitModal__isModalActive', |
|
| 80 | - true |
|
| 81 | - ), |
|
| 82 | - FILTER_VALIDATE_BOOLEAN |
|
| 83 | - ); |
|
| 84 | - } |
|
| 71 | + /** |
|
| 72 | + * Exposes a filter switch for turning off the enqueueing of the modal script. |
|
| 73 | + * @return bool |
|
| 74 | + */ |
|
| 75 | + private function isModalActive() |
|
| 76 | + { |
|
| 77 | + return filter_var( |
|
| 78 | + apply_filters( |
|
| 79 | + 'FHEE__EventEspresso_core_domain_services_admin_ExitModal__isModalActive', |
|
| 80 | + true |
|
| 81 | + ), |
|
| 82 | + FILTER_VALIDATE_BOOLEAN |
|
| 83 | + ); |
|
| 84 | + } |
|
| 85 | 85 | } |
| 86 | 86 | \ No newline at end of file |