Completed
Branch fix/remove-joyride (be4b28)
by
unknown
05:31 queued 02:38
created
admin_pages/about/templates/whats_new.template.php 2 patches
Indentation   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -17,47 +17,47 @@  discard block
 block discarded – undo
17 17
     </h3>
18 18
     <p>
19 19
         <?php
20
-        echo printf(
21
-            esc_html__('%3$sVersion %1$s%4$s is a %2$s bug fix/enhancement release.', 'event_espresso'),
22
-            EVENT_ESPRESSO_VERSION,
23
-            $type,
24
-            '<strong>',
25
-            '</strong>'
26
-        );
27
-        printf(
28
-            esc_html__('For more information, see %1$sthe release notes%2$s.', 'event_espresso'),
29
-            '<a href="https://eventespresso.com/wiki/ee4-changelog/#' . $version . '">',
30
-            '</a>'
31
-        );
32
-        ?>
20
+		echo printf(
21
+			esc_html__('%3$sVersion %1$s%4$s is a %2$s bug fix/enhancement release.', 'event_espresso'),
22
+			EVENT_ESPRESSO_VERSION,
23
+			$type,
24
+			'<strong>',
25
+			'</strong>'
26
+		);
27
+		printf(
28
+			esc_html__('For more information, see %1$sthe release notes%2$s.', 'event_espresso'),
29
+			'<a href="https://eventespresso.com/wiki/ee4-changelog/#' . $version . '">',
30
+			'</a>'
31
+		);
32
+		?>
33 33
     </p>
34 34
 </div>
35 35
 
36 36
 <div class="changelog">
37 37
     <?php
38
-    // maintenance mode on?
39
-    if (EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance) {
40
-        ?>
38
+	// maintenance mode on?
39
+	if (EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance) {
40
+		?>
41 41
         <div class="ee-attention">
42 42
             <h2 class="ee-maintenance-mode-callout">
43 43
                 <?php esc_html_e('Event Espresso is in full maintenance mode.', 'event_espresso'); ?>
44 44
             </h2>
45 45
             <p>
46 46
                 <?php
47
-                printf(
48
-                    esc_html__(
49
-                        'A previous version of Event Espresso has detected. But before anything else can happen, we need to know whether or not to migrate (copy over) your existing event data so that it can be utilized by EE4. For more instructions on what to do, please visit the %sEvent Espresso Maintenance%s page.',
50
-                        'event_espresso'
51
-                    ),
52
-                    '<a href="admin.php?page=espresso_maintenance_settings">',
53
-                    '</a>'
54
-                );
55
-                ?>
47
+				printf(
48
+					esc_html__(
49
+						'A previous version of Event Espresso has detected. But before anything else can happen, we need to know whether or not to migrate (copy over) your existing event data so that it can be utilized by EE4. For more instructions on what to do, please visit the %sEvent Espresso Maintenance%s page.',
50
+						'event_espresso'
51
+					),
52
+					'<a href="admin.php?page=espresso_maintenance_settings">',
53
+					'</a>'
54
+				);
55
+				?>
56 56
             </p>
57 57
         </div>
58 58
         <?php
59
-    }
60
-    ?>
59
+	}
60
+	?>
61 61
 
62 62
     <h2 class="about-headline-callout">Initial EE4 Decaf (free) Release</h2>
63 63
     <p>This is the initial release of EE4 Decaf. This is the free version of our very powerful event registration and
@@ -92,8 +92,8 @@  discard block
 block discarded – undo
92 92
 
93 93
     <p>
94 94
         <a href="<?php echo esc_url_raw(
95
-            EE_GLOBAL_ASSETS_URL . 'images/banners/ticket-bundles-533x562.png'
96
-        ); ?>">
95
+			EE_GLOBAL_ASSETS_URL . 'images/banners/ticket-bundles-533x562.png'
96
+		); ?>">
97 97
             <strong>Support for “Ticket Bundles” &amp; “Graduated Pricing”</strong>
98 98
         </a>
99 99
         <br>
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
         );
27 27
         printf(
28 28
             esc_html__('For more information, see %1$sthe release notes%2$s.', 'event_espresso'),
29
-            '<a href="https://eventespresso.com/wiki/ee4-changelog/#' . $version . '">',
29
+            '<a href="https://eventespresso.com/wiki/ee4-changelog/#'.$version.'">',
30 30
             '</a>'
31 31
         );
32 32
         ?>
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 
93 93
     <p>
94 94
         <a href="<?php echo esc_url_raw(
95
-            EE_GLOBAL_ASSETS_URL . 'images/banners/ticket-bundles-533x562.png'
95
+            EE_GLOBAL_ASSETS_URL.'images/banners/ticket-bundles-533x562.png'
96 96
         ); ?>">
97 97
             <strong>Support for “Ticket Bundles” &amp; “Graduated Pricing”</strong>
98 98
         </a>
Please login to merge, or discard this patch.
caffeinated/admin/extend/about/templates/whats_new.template.php 2 patches
Indentation   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -3,8 +3,8 @@  discard block
 block discarded – undo
3 3
 $is_major_release = true;
4 4
 $type             = $is_major_release ? 'major' : 'minor';
5 5
 $heading          = $is_major_release
6
-    ? _n('Major Release Information', 'Major Releases', 1, 'event_espresso')
7
-    : _n('Minor Release Information', 'Minor Releases', 1, 'event_espresso');
6
+	? _n('Major Release Information', 'Major Releases', 1, 'event_espresso')
7
+	: _n('Minor Release Information', 'Minor Releases', 1, 'event_espresso');
8 8
 
9 9
 $version = explode('.', EVENT_ESPRESSO_VERSION);
10 10
 array_pop($version);
@@ -14,48 +14,48 @@  discard block
 block discarded – undo
14 14
 <div class="changelog point-releases">
15 15
     <h3><?php echo esc_html($heading); ?></h3>
16 16
     <p><?php
17
-        printf(
18
-            esc_html__('%1$sVersion %2$s%3$s is a %4$s release.', 'event_espresso'),
19
-            '<strong>',
20
-            EVENT_ESPRESSO_VERSION,
21
-            '</strong>',
22
-            $type
23
-        ); ?>
17
+		printf(
18
+			esc_html__('%1$sVersion %2$s%3$s is a %4$s release.', 'event_espresso'),
19
+			'<strong>',
20
+			EVENT_ESPRESSO_VERSION,
21
+			'</strong>',
22
+			$type
23
+		); ?>
24 24
         <?php printf(
25
-            esc_html__('For more information, see %1$sthe release notes%2$s.', 'event_espresso'),
26
-            '<a href="https://eventespresso.com/wiki/ee4-changelog/#'
27
-            . $version
28
-            . '" target="_blank" rel="noopener noreferrer">',
29
-            '</a>'
30
-        ); ?>
25
+			esc_html__('For more information, see %1$sthe release notes%2$s.', 'event_espresso'),
26
+			'<a href="https://eventespresso.com/wiki/ee4-changelog/#'
27
+			. $version
28
+			. '" target="_blank" rel="noopener noreferrer">',
29
+			'</a>'
30
+		); ?>
31 31
     </p>
32 32
 </div><!-- end .changelog .point-releases -->
33 33
 
34 34
 <div class="changelog">
35 35
     <?php
36
-    // maintenance mode on?
37
-    if (EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance) {
38
-        ?>
36
+	// maintenance mode on?
37
+	if (EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance) {
38
+		?>
39 39
         <div class="ee-attention">
40 40
             <h2 class="ee-maintenance-mode-callout">
41 41
                 <?php esc_html_e('Event Espresso is in full maintenance mode.', 'event_espresso'); ?>
42 42
             </h2>
43 43
             <p>
44 44
                 <?php
45
-                printf(
46
-                    esc_html__(
47
-                        'A previous version of Event Espresso has detected. But before anything else can happen, we need to know whether or not to migrate (copy over) your existing event data so that it can be utilized by EE4. For more instructions on what to do, please visit the %1$sEvent Espresso Maintenance%2$s page.',
48
-                        'event_espresso'
49
-                    ),
50
-                    '<a href="admin.php?page=espresso_maintenance_settings">',
51
-                    '</a>'
52
-                );
53
-                ?>
45
+				printf(
46
+					esc_html__(
47
+						'A previous version of Event Espresso has detected. But before anything else can happen, we need to know whether or not to migrate (copy over) your existing event data so that it can be utilized by EE4. For more instructions on what to do, please visit the %1$sEvent Espresso Maintenance%2$s page.',
48
+						'event_espresso'
49
+					),
50
+					'<a href="admin.php?page=espresso_maintenance_settings">',
51
+					'</a>'
52
+				);
53
+				?>
54 54
             </p>
55 55
         </div>
56 56
         <?php
57
-    }
58
-    ?>
57
+	}
58
+	?>
59 59
 
60 60
     <h2 class="about-headline-callout">Updates &amp; Fixes in EE 4.10</h2>
61 61
     <p class="ee-highlight ee-highlight--info">This release brought many background updates and improvements to
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
     <div class='ee-new-features ee-card-grid ee-card-grid-3-cols'>
68 68
 
69 69
     <?php
70
-    /*
70
+	/*
71 71
         WANT TO ADD A FEW FEATURE?
72 72
         COPY THE FOLLOWING:
73 73
 
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
         ADD "ee-grid-row-span-3" TO THE "ee-card ee-new-feature-card" ex:
100 100
         <div class='ee-card ee-new-feature-card ee-grid-row-span-3'>
101 101
     */
102
-    ?>
102
+	?>
103 103
 
104 104
         <div class='ee-card ee-new-feature-card'>
105 105
             <h4>Attendee Block for WordPress 5 Gutenberg</h4>
@@ -225,8 +225,8 @@  discard block
 block discarded – undo
225 225
                      alt="Wait List Manager Add-on"
226 226
                      class="alignright"
227 227
                      src="<?php echo esc_url_raw(
228
-                         EE_GLOBAL_ASSETS_URL . 'images/banners/ee4-wait-list-manager-380x250.jpeg'
229
-                     ); ?>"
228
+						 EE_GLOBAL_ASSETS_URL . 'images/banners/ee4-wait-list-manager-380x250.jpeg'
229
+					 ); ?>"
230 230
                      width="380"
231 231
                      height="250"
232 232
                 />
@@ -279,8 +279,8 @@  discard block
 block discarded – undo
279 279
                  class="alignright "
280 280
                  alt="PayPal Express Checkout Smart Payment Buttons (with Venmo) Payment Gateway"
281 281
                  src="<?php echo esc_url_raw(
282
-                     EE_GLOBAL_ASSETS_URL . 'images/banners/event-registrations-with-paypal-express-checkout-smart-payment-buttons-380x250.jpeg'
283
-                 ); ?>"
282
+					 EE_GLOBAL_ASSETS_URL . 'images/banners/event-registrations-with-paypal-express-checkout-smart-payment-buttons-380x250.jpeg'
283
+				 ); ?>"
284 284
                  width="260"
285 285
                  height="202"
286 286
             />
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
                      alt="Wait List Manager Add-on"
226 226
                      class="alignright"
227 227
                      src="<?php echo esc_url_raw(
228
-                         EE_GLOBAL_ASSETS_URL . 'images/banners/ee4-wait-list-manager-380x250.jpeg'
228
+                         EE_GLOBAL_ASSETS_URL.'images/banners/ee4-wait-list-manager-380x250.jpeg'
229 229
                      ); ?>"
230 230
                      width="380"
231 231
                      height="250"
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
                  class="alignright "
280 280
                  alt="PayPal Express Checkout Smart Payment Buttons (with Venmo) Payment Gateway"
281 281
                  src="<?php echo esc_url_raw(
282
-                     EE_GLOBAL_ASSETS_URL . 'images/banners/event-registrations-with-paypal-express-checkout-smart-payment-buttons-380x250.jpeg'
282
+                     EE_GLOBAL_ASSETS_URL.'images/banners/event-registrations-with-paypal-express-checkout-smart-payment-buttons-380x250.jpeg'
283 283
                  ); ?>"
284 284
                  width="260"
285 285
                  height="202"
Please login to merge, or discard this patch.
espresso.php 1 patch
Indentation   +80 added lines, -80 removed lines patch added patch discarded remove patch
@@ -38,103 +38,103 @@
 block discarded – undo
38 38
  * @since           4.0
39 39
  */
40 40
 if (function_exists('espresso_version')) {
41
-    if (! function_exists('espresso_duplicate_plugin_error')) {
42
-        /**
43
-         *    espresso_duplicate_plugin_error
44
-         *    displays if more than one version of EE is activated at the same time
45
-         */
46
-        function espresso_duplicate_plugin_error()
47
-        {
48
-            ?>
41
+	if (! function_exists('espresso_duplicate_plugin_error')) {
42
+		/**
43
+		 *    espresso_duplicate_plugin_error
44
+		 *    displays if more than one version of EE is activated at the same time
45
+		 */
46
+		function espresso_duplicate_plugin_error()
47
+		{
48
+			?>
49 49
             <div class="error">
50 50
                 <p>
51 51
                     <?php
52
-                    echo esc_html__(
53
-                        'Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.',
54
-                        'event_espresso'
55
-                    ); ?>
52
+					echo esc_html__(
53
+						'Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.',
54
+						'event_espresso'
55
+					); ?>
56 56
                 </p>
57 57
             </div>
58 58
             <?php
59
-            espresso_deactivate_plugin(plugin_basename(__FILE__));
60
-        }
61
-    }
62
-    add_action('admin_notices', 'espresso_duplicate_plugin_error', 1);
59
+			espresso_deactivate_plugin(plugin_basename(__FILE__));
60
+		}
61
+	}
62
+	add_action('admin_notices', 'espresso_duplicate_plugin_error', 1);
63 63
 } else {
64
-    define('EE_MIN_PHP_VER_REQUIRED', '5.6.2');
65
-    if (! version_compare(PHP_VERSION, EE_MIN_PHP_VER_REQUIRED, '>=')) {
66
-        /**
67
-         * espresso_minimum_php_version_error
68
-         *
69
-         * @return void
70
-         */
71
-        function espresso_minimum_php_version_error()
72
-        {
73
-            ?>
64
+	define('EE_MIN_PHP_VER_REQUIRED', '5.6.2');
65
+	if (! version_compare(PHP_VERSION, EE_MIN_PHP_VER_REQUIRED, '>=')) {
66
+		/**
67
+		 * espresso_minimum_php_version_error
68
+		 *
69
+		 * @return void
70
+		 */
71
+		function espresso_minimum_php_version_error()
72
+		{
73
+			?>
74 74
             <div class="error">
75 75
                 <p>
76 76
                     <?php
77
-                    printf(
78
-                        esc_html__(
79
-                            'We\'re sorry, but Event Espresso requires PHP version %1$s or greater in order to operate. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.',
80
-                            'event_espresso'
81
-                        ),
82
-                        EE_MIN_PHP_VER_REQUIRED,
83
-                        PHP_VERSION,
84
-                        '<br/>',
85
-                        '<a href="http://php.net/downloads.php">http://php.net/downloads.php</a>'
86
-                    );
87
-                    ?>
77
+					printf(
78
+						esc_html__(
79
+							'We\'re sorry, but Event Espresso requires PHP version %1$s or greater in order to operate. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.',
80
+							'event_espresso'
81
+						),
82
+						EE_MIN_PHP_VER_REQUIRED,
83
+						PHP_VERSION,
84
+						'<br/>',
85
+						'<a href="http://php.net/downloads.php">http://php.net/downloads.php</a>'
86
+					);
87
+					?>
88 88
                 </p>
89 89
             </div>
90 90
             <?php
91
-            espresso_deactivate_plugin(plugin_basename(__FILE__));
92
-        }
91
+			espresso_deactivate_plugin(plugin_basename(__FILE__));
92
+		}
93 93
 
94
-        add_action('admin_notices', 'espresso_minimum_php_version_error', 1);
95
-    } else {
96
-        define('EVENT_ESPRESSO_MAIN_FILE', __FILE__);
97
-        /**
98
-         * espresso_version
99
-         * Returns the plugin version
100
-         *
101
-         * @return string
102
-         */
103
-        function espresso_version()
104
-        {
105
-            return apply_filters('FHEE__espresso__espresso_version', '4.10.39.rc.007');
106
-        }
94
+		add_action('admin_notices', 'espresso_minimum_php_version_error', 1);
95
+	} else {
96
+		define('EVENT_ESPRESSO_MAIN_FILE', __FILE__);
97
+		/**
98
+		 * espresso_version
99
+		 * Returns the plugin version
100
+		 *
101
+		 * @return string
102
+		 */
103
+		function espresso_version()
104
+		{
105
+			return apply_filters('FHEE__espresso__espresso_version', '4.10.39.rc.007');
106
+		}
107 107
 
108
-        /**
109
-         * espresso_plugin_activation
110
-         * adds a wp-option to indicate that EE has been activated via the WP admin plugins page
111
-         */
112
-        function espresso_plugin_activation()
113
-        {
114
-            update_option('ee_espresso_activation', true);
115
-        }
108
+		/**
109
+		 * espresso_plugin_activation
110
+		 * adds a wp-option to indicate that EE has been activated via the WP admin plugins page
111
+		 */
112
+		function espresso_plugin_activation()
113
+		{
114
+			update_option('ee_espresso_activation', true);
115
+		}
116 116
 
117
-        register_activation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation');
117
+		register_activation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation');
118 118
 
119
-        require_once __DIR__ . '/core/bootstrap_espresso.php';
120
-        bootstrap_espresso();
121
-    }
119
+		require_once __DIR__ . '/core/bootstrap_espresso.php';
120
+		bootstrap_espresso();
121
+	}
122 122
 }
123 123
 if (! function_exists('espresso_deactivate_plugin')) {
124
-    /**
125
-     *    deactivate_plugin
126
-     * usage:  espresso_deactivate_plugin( plugin_basename( __FILE__ ));
127
-     *
128
-     * @access public
129
-     * @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file
130
-     * @return    void
131
-     */
132
-    function espresso_deactivate_plugin($plugin_basename = '')
133
-    {
134
-        if (! function_exists('deactivate_plugins')) {
135
-            require_once ABSPATH . 'wp-admin/includes/plugin.php';
136
-        }
137
-        unset($_GET['activate'], $_REQUEST['activate']);
138
-        deactivate_plugins($plugin_basename);
139
-    }
124
+	/**
125
+	 *    deactivate_plugin
126
+	 * usage:  espresso_deactivate_plugin( plugin_basename( __FILE__ ));
127
+	 *
128
+	 * @access public
129
+	 * @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file
130
+	 * @return    void
131
+	 */
132
+	function espresso_deactivate_plugin($plugin_basename = '')
133
+	{
134
+		if (! function_exists('deactivate_plugins')) {
135
+			require_once ABSPATH . 'wp-admin/includes/plugin.php';
136
+		}
137
+		unset($_GET['activate'], $_REQUEST['activate']);
138
+		deactivate_plugins($plugin_basename);
139
+	}
140 140
 }
141 141
\ No newline at end of file
Please login to merge, or discard this patch.
core/admin/EE_Admin.core.php 2 patches
Indentation   +986 added lines, -986 removed lines patch added patch discarded remove patch
@@ -20,990 +20,990 @@
 block discarded – undo
20 20
  */
21 21
 final class EE_Admin implements InterminableInterface
22 22
 {
23
-    /**
24
-     * @var EE_Admin $_instance
25
-     */
26
-    private static $_instance;
27
-
28
-    /**
29
-     * @var PersistentAdminNoticeManager $persistent_admin_notice_manager
30
-     */
31
-    private $persistent_admin_notice_manager;
32
-
33
-    /**
34
-     * @var LoaderInterface
35
-     */
36
-    protected $loader;
37
-
38
-    /**
39
-     * @var RequestInterface
40
-     */
41
-    protected $request;
42
-
43
-
44
-    /**
45
-     * @param RequestInterface $request
46
-     * @singleton method used to instantiate class object
47
-     * @return EE_Admin
48
-     * @throws EE_Error
49
-     */
50
-    public static function instance(RequestInterface $request = null)
51
-    {
52
-        // check if class object is instantiated
53
-        if (! self::$_instance instanceof EE_Admin) {
54
-            self::$_instance = new self($request);
55
-        }
56
-        return self::$_instance;
57
-    }
58
-
59
-
60
-    /**
61
-     * @return EE_Admin
62
-     * @throws EE_Error
63
-     */
64
-    public static function reset()
65
-    {
66
-        self::$_instance = null;
67
-        $request         = LoaderFactory::getLoader()->getShared(RequestInterface::class);
68
-        return self::instance($request);
69
-    }
70
-
71
-
72
-    /**
73
-     * @param RequestInterface $request
74
-     * @throws EE_Error
75
-     * @throws InvalidDataTypeException
76
-     * @throws InvalidInterfaceException
77
-     * @throws InvalidArgumentException
78
-     */
79
-    protected function __construct(RequestInterface $request)
80
-    {
81
-        $this->request = $request;
82
-        $this->loader = LoaderFactory::getLoader();
83
-        // define global EE_Admin constants
84
-        $this->_define_all_constants();
85
-        // set autoloaders for our admin page classes based on included path information
86
-        EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder(EE_ADMIN);
87
-        // admin hooks
88
-        add_filter('plugin_action_links', [$this, 'filter_plugin_actions'], 10, 2);
89
-        add_action('AHEE__EE_System__initialize_last', [$this, 'init']);
90
-        add_action('AHEE__EE_Admin_Page__route_admin_request', [$this, 'route_admin_request'], 100, 2);
91
-        add_action('wp_loaded', [$this, 'wp_loaded'], 100);
92
-        add_action('admin_init', [$this, 'admin_init'], 100);
93
-        add_action('admin_enqueue_scripts', [$this, 'enqueue_admin_scripts'], 20);
94
-        add_action('admin_notices', [$this, 'display_admin_notices'], 10);
95
-        add_action('network_admin_notices', [$this, 'display_admin_notices'], 10);
96
-        add_filter('pre_update_option', [$this, 'check_for_invalid_datetime_formats'], 100, 2);
97
-        add_filter('admin_footer_text', [$this, 'espresso_admin_footer']);
98
-        add_action('load-plugins.php', [$this, 'hookIntoWpPluginsPage']);
99
-        add_action('display_post_states', [$this, 'displayStateForCriticalPages'], 10, 2);
100
-        add_filter('plugin_row_meta', [$this, 'addLinksToPluginRowMeta'], 10, 2);
101
-        // reset Environment config (we only do this on admin page loads);
102
-        EE_Registry::instance()->CFG->environment->recheck_values();
103
-        do_action('AHEE__EE_Admin__loaded');
104
-    }
105
-
106
-
107
-    /**
108
-     * _define_all_constants
109
-     * define constants that are set globally for all admin pages
110
-     *
111
-     * @return void
112
-     */
113
-    private function _define_all_constants()
114
-    {
115
-        if (! defined('EE_ADMIN_URL')) {
116
-            define('EE_ADMIN_URL', EE_PLUGIN_DIR_URL . 'core/admin/');
117
-            define('EE_ADMIN_PAGES_URL', EE_PLUGIN_DIR_URL . 'admin_pages/');
118
-            define('EE_ADMIN_TEMPLATE', EE_ADMIN . 'templates/');
119
-            define('WP_ADMIN_PATH', ABSPATH . 'wp-admin/');
120
-            define('WP_AJAX_URL', admin_url('admin-ajax.php'));
121
-        }
122
-    }
123
-
124
-
125
-    /**
126
-     * filter_plugin_actions - adds links to the Plugins page listing
127
-     *
128
-     * @param array  $links
129
-     * @param string $plugin
130
-     * @return    array
131
-     */
132
-    public function filter_plugin_actions($links, $plugin)
133
-    {
134
-        // set $main_file in stone
135
-        static $main_file;
136
-        // if $main_file is not set yet
137
-        if (! $main_file) {
138
-            $main_file = EE_PLUGIN_BASENAME;
139
-        }
140
-        if ($plugin === $main_file) {
141
-            // compare current plugin to this one
142
-            if (EE_Maintenance_Mode::instance()->level() === EE_Maintenance_Mode::level_2_complete_maintenance) {
143
-                $maintenance_link = '<a href="admin.php?page=espresso_maintenance_settings"'
144
-                                    . ' title="Event Espresso is in maintenance mode.  Click this link to learn why.">'
145
-                                    . esc_html__('Maintenance Mode Active', 'event_espresso')
146
-                                    . '</a>';
147
-                array_unshift($links, $maintenance_link);
148
-            } else {
149
-                $org_settings_link = '<a href="admin.php?page=espresso_general_settings">'
150
-                                     . esc_html__('Settings', 'event_espresso')
151
-                                     . '</a>';
152
-                $events_link       = '<a href="admin.php?page=espresso_events">'
153
-                                     . esc_html__('Events', 'event_espresso')
154
-                                     . '</a>';
155
-                // add before other links
156
-                array_unshift($links, $org_settings_link, $events_link);
157
-            }
158
-        }
159
-        return $links;
160
-    }
161
-
162
-
163
-    /**
164
-     * @deprecated 4.10.14.p
165
-     */
166
-    public function get_request()
167
-    {
168
-    }
169
-
170
-
171
-    /**
172
-     * hide_admin_pages_except_maintenance_mode
173
-     *
174
-     * @param array $admin_page_folder_names
175
-     * @return array
176
-     */
177
-    public function hide_admin_pages_except_maintenance_mode($admin_page_folder_names = [])
178
-    {
179
-        return [
180
-            'maintenance' => EE_ADMIN_PAGES . 'maintenance/',
181
-            'about'       => EE_ADMIN_PAGES . 'about/',
182
-            'support'     => EE_ADMIN_PAGES . 'support/',
183
-        ];
184
-    }
185
-
186
-
187
-    /**
188
-     * init- should fire after shortcode, module,  addon, other plugin (default priority), and even
189
-     * EE_Front_Controller's init phases have run
190
-     *
191
-     * @return void
192
-     * @throws EE_Error
193
-     * @throws InvalidArgumentException
194
-     * @throws InvalidDataTypeException
195
-     * @throws InvalidInterfaceException
196
-     * @throws ReflectionException
197
-     * @throws ServiceNotFoundException
198
-     */
199
-    public function init()
200
-    {
201
-        // only enable most of the EE_Admin IF we're not in full maintenance mode
202
-        if (EE_Maintenance_Mode::instance()->models_can_query()) {
203
-            $this->initModelsReady();
204
-        }
205
-        // run the admin page factory but ONLY if:
206
-        // - it is a regular non ajax admin request
207
-        // - we are doing an ee admin ajax request
208
-        if ($this->request->isAdmin() || $this->request->isAdminAjax()) {
209
-            // this loads the controller for the admin pages which will setup routing etc
210
-            $this->loader->getShared('EE_Admin_Page_Loader', [$this->loader]);
211
-        }
212
-        if ($this->request->isAdminAjax()) {
213
-            return;
214
-        }
215
-        add_filter('content_save_pre', [$this, 'its_eSpresso'], 10, 1);
216
-        // make sure our CPTs and custom taxonomy metaboxes get shown for first time users
217
-        add_action('admin_head', [$this, 'enable_hidden_ee_nav_menu_metaboxes'], 10);
218
-        add_action('admin_head', [$this, 'register_custom_nav_menu_boxes'], 10);
219
-        // exclude EE critical pages from all nav menus and wp_list_pages
220
-        add_filter('nav_menu_meta_box_object', [$this, 'remove_pages_from_nav_menu'], 10);
221
-    }
222
-
223
-
224
-    /**
225
-     * Gets the loader (and if it wasn't previously set, sets it)
226
-     *
227
-     * @return LoaderInterface
228
-     * @throws InvalidArgumentException
229
-     * @throws InvalidDataTypeException
230
-     * @throws InvalidInterfaceException
231
-     */
232
-    protected function getLoader()
233
-    {
234
-        return $this->loader;
235
-    }
236
-
237
-
238
-    /**
239
-     * Method that's fired on admin requests (including admin ajax) but only when the models are usable
240
-     * (ie, the site isn't in maintenance mode)
241
-     *
242
-     * @return void
243
-     * @throws EE_Error
244
-     * @since 4.9.63.p
245
-     */
246
-    protected function initModelsReady()
247
-    {
248
-        // ok so we want to enable the entire admin
249
-        $this->persistent_admin_notice_manager = $this->loader->getShared(
250
-            'EventEspresso\core\services\notifications\PersistentAdminNoticeManager'
251
-        );
252
-        $this->persistent_admin_notice_manager->setReturnUrl(
253
-            EE_Admin_Page::add_query_args_and_nonce(
254
-                [
255
-                    'page'   => $this->request->getRequestParam('page'),
256
-                    'action' => $this->request->getRequestParam('action'),
257
-                ],
258
-                EE_ADMIN_URL
259
-            )
260
-        );
261
-        $this->maybeSetDatetimeWarningNotice();
262
-        // at a glance dashboard widget
263
-        add_filter('dashboard_glance_items', [$this, 'dashboard_glance_items'], 10);
264
-        // filter for get_edit_post_link used on comments for custom post types
265
-        add_filter('get_edit_post_link', [$this, 'modify_edit_post_link'], 10, 2);
266
-    }
267
-
268
-
269
-    /**
270
-     *    get_persistent_admin_notices
271
-     *
272
-     * @access    public
273
-     * @return void
274
-     * @throws EE_Error
275
-     * @throws InvalidArgumentException
276
-     * @throws InvalidDataTypeException
277
-     * @throws InvalidInterfaceException
278
-     */
279
-    public function maybeSetDatetimeWarningNotice()
280
-    {
281
-        // add dismissible notice for datetime changes.  Only valid if site does not have a timezone_string set.
282
-        // @todo This needs to stay in core for a bit to catch anyone upgrading from a version without this to a version
283
-        // with this.  But after enough time (indeterminate at this point) we can just remove this notice.
284
-        // this was added with https://events.codebasehq.com/projects/event-espresso/tickets/10626
285
-        if (
286
-            apply_filters('FHEE__EE_Admin__maybeSetDatetimeWarningNotice', true)
287
-            && ! get_option('timezone_string')
288
-            && EEM_Event::instance()->count() > 0
289
-        ) {
290
-            new PersistentAdminNotice(
291
-                'datetime_fix_notice',
292
-                sprintf(
293
-                    esc_html__(
294
-                        '%1$sImportant announcement related to your install of Event Espresso%2$s: There are some changes made to your site that could affect how dates display for your events and other related items with dates and times.  Read more about it %3$shere%4$s. If your dates and times are displaying incorrectly (incorrect offset), you can fix it using the tool on %5$sthis page%4$s.',
295
-                        'event_espresso'
296
-                    ),
297
-                    '<strong>',
298
-                    '</strong>',
299
-                    '<a href="https://eventespresso.com/2017/08/important-upcoming-changes-dates-times">',
300
-                    '</a>',
301
-                    '<a href="' . EE_Admin_Page::add_query_args_and_nonce(
302
-                        [
303
-                            'page'   => 'espresso_maintenance_settings',
304
-                            'action' => 'datetime_tools',
305
-                        ],
306
-                        admin_url('admin.php')
307
-                    ) . '">'
308
-                ),
309
-                false,
310
-                'manage_options',
311
-                'datetime_fix_persistent_notice'
312
-            );
313
-        }
314
-    }
315
-
316
-
317
-    /**
318
-     * this simply hooks into the nav menu setup of pages metabox and makes sure that we remove EE critical pages from
319
-     * the list of options. the wp function "wp_nav_menu_item_post_type_meta_box" found in
320
-     * wp-admin/includes/nav-menu.php looks for the "_default_query" property on the post_type object and it uses that
321
-     * to override any queries found in the existing query for the given post type.  Note that _default_query is not a
322
-     * normal property on the post_type object.  It's found ONLY in this particular context.
323
-     *
324
-     * @param WP_Post $post_type WP post type object
325
-     * @return WP_Post
326
-     * @throws InvalidArgumentException
327
-     * @throws InvalidDataTypeException
328
-     * @throws InvalidInterfaceException
329
-     */
330
-    public function remove_pages_from_nav_menu($post_type)
331
-    {
332
-        // if this isn't the "pages" post type let's get out
333
-        if ($post_type->name !== 'page') {
334
-            return $post_type;
335
-        }
336
-        $critical_pages            = EE_Registry::instance()->CFG->core->get_critical_pages_array();
337
-        $post_type->_default_query = [
338
-            'post__not_in' => $critical_pages,
339
-        ];
340
-        return $post_type;
341
-    }
342
-
343
-
344
-    /**
345
-     * WP by default only shows three metaboxes in "nav-menus.php" for first times users.  We want to make sure our
346
-     * metaboxes get shown as well
347
-     *
348
-     * @return void
349
-     */
350
-    public function enable_hidden_ee_nav_menu_metaboxes()
351
-    {
352
-        global $wp_meta_boxes, $pagenow;
353
-        if (! is_array($wp_meta_boxes) || $pagenow !== 'nav-menus.php') {
354
-            return;
355
-        }
356
-        $user = wp_get_current_user();
357
-        // has this been done yet?
358
-        if (get_user_option('ee_nav_menu_initialized', $user->ID)) {
359
-            return;
360
-        }
361
-
362
-        $hidden_meta_boxes  = get_user_option('metaboxhidden_nav-menus', $user->ID);
363
-        $initial_meta_boxes = apply_filters(
364
-            'FHEE__EE_Admin__enable_hidden_ee_nav_menu_boxes__initial_meta_boxes',
365
-            [
366
-                'nav-menu-theme-locations',
367
-                'add-page',
368
-                'add-custom-links',
369
-                'add-category',
370
-                'add-espresso_events',
371
-                'add-espresso_venues',
372
-                'add-espresso_event_categories',
373
-                'add-espresso_venue_categories',
374
-                'add-post-type-post',
375
-                'add-post-type-page',
376
-            ]
377
-        );
378
-
379
-        if (is_array($hidden_meta_boxes)) {
380
-            foreach ($hidden_meta_boxes as $key => $meta_box_id) {
381
-                if (in_array($meta_box_id, $initial_meta_boxes, true)) {
382
-                    unset($hidden_meta_boxes[ $key ]);
383
-                }
384
-            }
385
-        }
386
-        update_user_option($user->ID, 'metaboxhidden_nav-menus', $hidden_meta_boxes, true);
387
-        update_user_option($user->ID, 'ee_nav_menu_initialized', 1, true);
388
-    }
389
-
390
-
391
-    /**
392
-     * This method simply registers custom nav menu boxes for "nav_menus.php route"
393
-     * Currently EE is using this to make sure there are menu options for our CPT archive page routes.
394
-     *
395
-     * @return void
396
-     * @todo   modify this so its more dynamic and automatic for all ee CPTs and setups and can also be hooked into by
397
-     *         addons etc.
398
-     */
399
-    public function register_custom_nav_menu_boxes()
400
-    {
401
-        add_meta_box(
402
-            'add-extra-nav-menu-pages',
403
-            esc_html__('Event Espresso Pages', 'event_espresso'),
404
-            [$this, 'ee_cpt_archive_pages'],
405
-            'nav-menus',
406
-            'side',
407
-            'core'
408
-        );
409
-    }
410
-
411
-
412
-    /**
413
-     * Use this to edit the post link for our cpts so that the edit link points to the correct page.
414
-     *
415
-     * @param string $link the original link generated by wp
416
-     * @param int    $id   post id
417
-     * @return string  the (maybe) modified link
418
-     * @since   4.3.0
419
-     */
420
-    public function modify_edit_post_link($link, $id)
421
-    {
422
-        if (! $post = get_post($id)) {
423
-            return $link;
424
-        }
425
-        if ($post->post_type === 'espresso_attendees') {
426
-            $query_args = [
427
-                'action' => 'edit_attendee',
428
-                'post'   => $id,
429
-            ];
430
-            return EEH_URL::add_query_args_and_nonce(
431
-                $query_args,
432
-                admin_url('admin.php?page=espresso_registrations')
433
-            );
434
-        }
435
-        return $link;
436
-    }
437
-
438
-
439
-    public function ee_cpt_archive_pages()
440
-    {
441
-        global $nav_menu_selected_id;
442
-        $removed_args = [
443
-            'action',
444
-            'customlink-tab',
445
-            'edit-menu-item',
446
-            'menu-item',
447
-            'page-tab',
448
-            '_wpnonce',
449
-        ];
450
-        $nav_tab_link = $nav_menu_selected_id
451
-            ? esc_url(
452
-                add_query_arg(
453
-                    'extra-nav-menu-pages-tab',
454
-                    'event-archives',
455
-                    remove_query_arg($removed_args)
456
-                )
457
-            )
458
-            : '';
459
-        $select_all_link = esc_url(
460
-            add_query_arg(
461
-                [
462
-                    'extra-nav-menu-pages-tab' => 'event-archives',
463
-                    'selectall'                => 1,
464
-                ],
465
-                remove_query_arg($removed_args)
466
-            )
467
-        );
468
-        $pages = $this->_get_extra_nav_menu_pages_items();
469
-        $args['walker'] = new Walker_Nav_Menu_Checklist(false);
470
-        ;
471
-        $nav_menu_pages_items = walk_nav_menu_tree(
472
-            array_map(
473
-                [$this, '_setup_extra_nav_menu_pages_items'],
474
-                $pages
475
-            ),
476
-            0,
477
-            (object) $args
478
-        );
479
-
480
-        EEH_Template::display_template(
481
-            EE_ADMIN_TEMPLATE . 'cpt_archive_page.template.php',
482
-            [
483
-                $nav_menu_pages_items,
484
-                $nav_tab_link,
485
-                $select_all_link,
486
-            ]
487
-        );
488
-    }
489
-
490
-
491
-    /**
492
-     * Returns an array of event archive nav items.
493
-     *
494
-     * @return array
495
-     * @todo  for now this method is just in place so when it gets abstracted further we can substitute in whatever
496
-     *        method we use for getting the extra nav menu items
497
-     */
498
-    private function _get_extra_nav_menu_pages_items()
499
-    {
500
-        $menuitems[] = [
501
-            'title'       => esc_html__('Event List', 'event_espresso'),
502
-            'url'         => get_post_type_archive_link('espresso_events'),
503
-            'description' => esc_html__('Archive page for all events.', 'event_espresso'),
504
-        ];
505
-        return apply_filters('FHEE__EE_Admin__get_extra_nav_menu_pages_items', $menuitems);
506
-    }
507
-
508
-
509
-    /**
510
-     * Setup nav menu walker item for usage in the event archive nav menu metabox.  It receives a menu_item array with
511
-     * the properties and converts it to the menu item object.
512
-     *
513
-     * @param $menu_item_values
514
-     * @return stdClass
515
-     * @see wp_setup_nav_menu_item() in wp-includes/nav-menu.php
516
-     */
517
-    private function _setup_extra_nav_menu_pages_items($menu_item_values)
518
-    {
519
-        $menu_item = new stdClass();
520
-        $keys      = [
521
-            'ID'               => 0,
522
-            'db_id'            => 0,
523
-            'menu_item_parent' => 0,
524
-            'object_id'        => -1,
525
-            'post_parent'      => 0,
526
-            'type'             => 'custom',
527
-            'object'           => '',
528
-            'type_label'       => esc_html__('Extra Nav Menu Item', 'event_espresso'),
529
-            'title'            => '',
530
-            'url'              => '',
531
-            'target'           => '',
532
-            'attr_title'       => '',
533
-            'description'      => '',
534
-            'classes'          => [],
535
-            'xfn'              => '',
536
-        ];
537
-
538
-        foreach ($keys as $key => $value) {
539
-            $menu_item->{$key} = isset($menu_item_values[ $key ]) ? $menu_item_values[ $key ] : $value;
540
-        }
541
-        return $menu_item;
542
-    }
543
-
544
-
545
-    /**
546
-     * This is the action hook for the AHEE__EE_Admin_Page__route_admin_request hook that fires off right before an
547
-     * EE_Admin_Page route is called.
548
-     *
549
-     * @return void
550
-     */
551
-    public function route_admin_request()
552
-    {
553
-    }
554
-
555
-
556
-    /**
557
-     * wp_loaded should fire on the WordPress wp_loaded hook.  This fires on a VERY late priority.
558
-     *
559
-     * @return void
560
-     */
561
-    public function wp_loaded()
562
-    {
563
-    }
564
-
565
-
566
-    /**
567
-     * admin_init
568
-     *
569
-     * @return void
570
-     * @throws InvalidArgumentException
571
-     * @throws InvalidDataTypeException
572
-     * @throws InvalidInterfaceException
573
-     */
574
-    public function admin_init()
575
-    {
576
-        /**
577
-         * our cpt models must be instantiated on WordPress post processing routes (wp-admin/post.php),
578
-         * so any hooking into core WP routes is taken care of.  So in this next few lines of code:
579
-         * - check if doing post processing.
580
-         * - check if doing post processing of one of EE CPTs
581
-         * - instantiate the corresponding EE CPT model for the post_type being processed.
582
-         */
583
-        $action    = $this->request->getRequestParam('action');
584
-        $post_type = $this->request->getRequestParam('post_type');
585
-        if ($post_type && $action === 'editpost') {
586
-            /** @var CustomPostTypeDefinitions $custom_post_types */
587
-            $custom_post_types = $this->loader->getShared(CustomPostTypeDefinitions::class);
588
-            $custom_post_types->getCustomPostTypeModels($post_type);
589
-        }
590
-
591
-
592
-        /**
593
-         * This code excludes EE critical pages anywhere `wp_dropdown_pages` is used to create a dropdown for selecting
594
-         * critical pages.  The only place critical pages need included in a generated dropdown is on the "Critical
595
-         * Pages" tab in the EE General Settings Admin page.
596
-         * This is for user-proofing.
597
-         */
598
-        add_filter('wp_dropdown_pages', [$this, 'modify_dropdown_pages']);
599
-        if (EE_Maintenance_Mode::instance()->models_can_query()) {
600
-            $this->adminInitModelsReady();
601
-        }
602
-    }
603
-
604
-
605
-    /**
606
-     * Runs on admin_init but only if models are usable (ie, we're not in maintenance mode)
607
-     */
608
-    protected function adminInitModelsReady()
609
-    {
610
-        if (function_exists('wp_add_privacy_policy_content')) {
611
-            $this->loader->getShared('EventEspresso\core\services\privacy\policy\PrivacyPolicyManager');
612
-        }
613
-    }
614
-
615
-
616
-    /**
617
-     * Callback for wp_dropdown_pages hook to remove ee critical pages from the dropdown selection.
618
-     *
619
-     * @param string $output Current output.
620
-     * @return string
621
-     * @throws InvalidArgumentException
622
-     * @throws InvalidDataTypeException
623
-     * @throws InvalidInterfaceException
624
-     */
625
-    public function modify_dropdown_pages($output)
626
-    {
627
-        // get critical pages
628
-        $critical_pages = EE_Registry::instance()->CFG->core->get_critical_pages_array();
629
-
630
-        // split current output by line break for easier parsing.
631
-        $split_output = explode("\n", $output);
632
-
633
-        // loop through to remove any critical pages from the array.
634
-        foreach ($critical_pages as $page_id) {
635
-            $needle = 'value="' . $page_id . '"';
636
-            foreach ($split_output as $key => $haystack) {
637
-                if (strpos($haystack, $needle) !== false) {
638
-                    unset($split_output[ $key ]);
639
-                }
640
-            }
641
-        }
642
-        // replace output with the new contents
643
-        return implode("\n", $split_output);
644
-    }
645
-
646
-
647
-    /**
648
-     * enqueue all admin scripts that need loaded for admin pages
649
-     *
650
-     * @return void
651
-     */
652
-    public function enqueue_admin_scripts()
653
-    {
654
-        // this javascript is loaded on every admin page to catch any injections ee needs to add to wp run js.
655
-        // Note: the intention of this script is to only do TARGETED injections.  I.E, only injecting on certain script
656
-        // calls.
657
-        wp_enqueue_script(
658
-            'ee-inject-wp',
659
-            EE_ADMIN_URL . 'assets/ee-cpt-wp-injects.js',
660
-            ['jquery'],
661
-            EVENT_ESPRESSO_VERSION,
662
-            true
663
-        );
664
-    }
665
-
666
-
667
-    /**
668
-     * display_admin_notices
669
-     *
670
-     * @return void
671
-     */
672
-    public function display_admin_notices()
673
-    {
674
-        echo EE_Error::get_notices(); // already escaped
675
-    }
676
-
677
-
678
-    /**
679
-     * @param array $elements
680
-     * @return array
681
-     * @throws EE_Error
682
-     * @throws InvalidArgumentException
683
-     * @throws InvalidDataTypeException
684
-     * @throws InvalidInterfaceException
685
-     */
686
-    public function dashboard_glance_items($elements)
687
-    {
688
-        $elements                        = is_array($elements) ? $elements : [$elements];
689
-        $events                          = EEM_Event::instance()->count();
690
-        $items['events']['url']          = EE_Admin_Page::add_query_args_and_nonce(
691
-            ['page' => 'espresso_events'],
692
-            admin_url('admin.php')
693
-        );
694
-        $items['events']['text']         = sprintf(
695
-            esc_html(
696
-                _n('%s Event', '%s Events', $events, 'event_espresso')
697
-            ),
698
-            number_format_i18n($events)
699
-        );
700
-        $items['events']['title']        = esc_html__('Click to view all Events', 'event_espresso');
701
-        $registrations                   = EEM_Registration::instance()->count(
702
-            [
703
-                [
704
-                    'STS_ID' => ['!=', EEM_Registration::status_id_incomplete],
705
-                ],
706
-            ]
707
-        );
708
-        $items['registrations']['url']   = EE_Admin_Page::add_query_args_and_nonce(
709
-            ['page' => 'espresso_registrations'],
710
-            admin_url('admin.php')
711
-        );
712
-        $items['registrations']['text']  = sprintf(
713
-            esc_html(
714
-                _n('%s Registration', '%s Registrations', $registrations, 'event_espresso')
715
-            ),
716
-            number_format_i18n($registrations)
717
-        );
718
-        $items['registrations']['title'] = esc_html__('Click to view all registrations', 'event_espresso');
719
-
720
-        $items = (array) apply_filters('FHEE__EE_Admin__dashboard_glance_items__items', $items);
721
-
722
-        foreach ($items as $type => $item_properties) {
723
-            $elements[] = sprintf(
724
-                '<a class="ee-dashboard-link-' . $type . '" href="%s" title="%s">%s</a>',
725
-                $item_properties['url'],
726
-                $item_properties['title'],
727
-                $item_properties['text']
728
-            );
729
-        }
730
-        return $elements;
731
-    }
732
-
733
-
734
-    /**
735
-     * check_for_invalid_datetime_formats
736
-     * if an admin changes their date or time format settings on the WP General Settings admin page, verify that
737
-     * their selected format can be parsed by PHP
738
-     *
739
-     * @param    $value
740
-     * @param    $option
741
-     * @return    string
742
-     */
743
-    public function check_for_invalid_datetime_formats($value, $option)
744
-    {
745
-        // check for date_format or time_format
746
-        switch ($option) {
747
-            case 'date_format':
748
-                $date_time_format = $value . ' ' . get_option('time_format');
749
-                break;
750
-            case 'time_format':
751
-                $date_time_format = get_option('date_format') . ' ' . $value;
752
-                break;
753
-            default:
754
-                $date_time_format = false;
755
-        }
756
-        // do we have a date_time format to check ?
757
-        if ($date_time_format) {
758
-            $error_msg = EEH_DTT_Helper::validate_format_string($date_time_format);
759
-
760
-            if (is_array($error_msg)) {
761
-                $msg = '<p>'
762
-                       . sprintf(
763
-                           esc_html__(
764
-                               'The following date time "%s" ( %s ) is difficult to be properly parsed by PHP for the following reasons:',
765
-                               'event_espresso'
766
-                           ),
767
-                           date($date_time_format),
768
-                           $date_time_format
769
-                       )
770
-                       . '</p><p><ul>';
771
-
772
-
773
-                foreach ($error_msg as $error) {
774
-                    $msg .= '<li>' . $error . '</li>';
775
-                }
776
-
777
-                $msg .= '</ul></p><p>'
778
-                        . sprintf(
779
-                            esc_html__(
780
-                                '%sPlease note that your date and time formats have been reset to "F j, Y" and "g:i a" respectively.%s',
781
-                                'event_espresso'
782
-                            ),
783
-                            '<span style="color:#D54E21;">',
784
-                            '</span>'
785
-                        )
786
-                        . '</p>';
787
-
788
-                // trigger WP settings error
789
-                add_settings_error(
790
-                    'date_format',
791
-                    'date_format',
792
-                    $msg
793
-                );
794
-
795
-                // set format to something valid
796
-                switch ($option) {
797
-                    case 'date_format':
798
-                        $value = 'F j, Y';
799
-                        break;
800
-                    case 'time_format':
801
-                        $value = 'g:i a';
802
-                        break;
803
-                }
804
-            }
805
-        }
806
-        return $value;
807
-    }
808
-
809
-
810
-    /**
811
-     * its_eSpresso - converts the less commonly used spelling of "Expresso" to "Espresso"
812
-     *
813
-     * @param $content
814
-     * @return    string
815
-     */
816
-    public function its_eSpresso($content)
817
-    {
818
-        return str_replace('[EXPRESSO_', '[ESPRESSO_', $content);
819
-    }
820
-
821
-
822
-    /**
823
-     * espresso_admin_footer
824
-     *
825
-     * @return    string
826
-     */
827
-    public function espresso_admin_footer()
828
-    {
829
-        return EEH_Template::powered_by_event_espresso('aln-cntr', '', ['utm_content' => 'admin_footer']);
830
-    }
831
-
832
-
833
-    /**
834
-     * static method for registering ee admin page.
835
-     * This method is deprecated in favor of the new location in EE_Register_Admin_Page::register.
836
-     *
837
-     * @param       $page_basename
838
-     * @param       $page_path
839
-     * @param array $config
840
-     * @return void
841
-     * @throws EE_Error
842
-     * @see        EE_Register_Admin_Page::register()
843
-     * @since      4.3.0
844
-     * @deprecated 4.3.0    Use EE_Register_Admin_Page::register() instead
845
-     */
846
-    public static function register_ee_admin_page($page_basename, $page_path, $config = [])
847
-    {
848
-        EE_Error::doing_it_wrong(
849
-            __METHOD__,
850
-            sprintf(
851
-                esc_html__(
852
-                    'Usage is deprecated.  Use EE_Register_Admin_Page::register() for registering the %s admin page.',
853
-                    'event_espresso'
854
-                ),
855
-                $page_basename
856
-            ),
857
-            '4.3'
858
-        );
859
-        if (class_exists('EE_Register_Admin_Page')) {
860
-            $config['page_path'] = $page_path;
861
-        }
862
-        EE_Register_Admin_Page::register($page_basename, $config);
863
-    }
864
-
865
-
866
-    /**
867
-     * @param int     $post_ID
868
-     * @param WP_Post $post
869
-     * @return void
870
-     * @deprecated 4.8.41
871
-     */
872
-    public static function parse_post_content_on_save($post_ID, $post)
873
-    {
874
-        EE_Error::doing_it_wrong(
875
-            __METHOD__,
876
-            esc_html__('Usage is deprecated', 'event_espresso'),
877
-            '4.8.41'
878
-        );
879
-    }
880
-
881
-
882
-    /**
883
-     * @param  $option
884
-     * @param  $old_value
885
-     * @param  $value
886
-     * @return void
887
-     * @deprecated 4.8.41
888
-     */
889
-    public function reset_page_for_posts_on_change($option, $old_value, $value)
890
-    {
891
-        EE_Error::doing_it_wrong(
892
-            __METHOD__,
893
-            esc_html__('Usage is deprecated', 'event_espresso'),
894
-            '4.8.41'
895
-        );
896
-    }
897
-
898
-
899
-    /**
900
-     * @return void
901
-     * @deprecated 4.9.27
902
-     */
903
-    public function get_persistent_admin_notices()
904
-    {
905
-        EE_Error::doing_it_wrong(
906
-            __METHOD__,
907
-            sprintf(
908
-                esc_html__('Usage is deprecated. Use "%1$s" instead.', 'event_espresso'),
909
-                '\EventEspresso\core\services\notifications\PersistentAdminNoticeManager'
910
-            ),
911
-            '4.9.27'
912
-        );
913
-    }
914
-
915
-
916
-    /**
917
-     * @throws InvalidInterfaceException
918
-     * @throws InvalidDataTypeException
919
-     * @throws DomainException
920
-     * @deprecated 4.9.27
921
-     */
922
-    public function dismiss_ee_nag_notice_callback()
923
-    {
924
-        EE_Error::doing_it_wrong(
925
-            __METHOD__,
926
-            sprintf(
927
-                esc_html__('Usage is deprecated. Use "%1$s" instead.', 'event_espresso'),
928
-                '\EventEspresso\core\services\notifications\PersistentAdminNoticeManager'
929
-            ),
930
-            '4.9.27'
931
-        );
932
-        $this->persistent_admin_notice_manager->dismissNotice();
933
-    }
934
-
935
-
936
-    /**
937
-     * Callback on load-plugins.php hook for setting up anything hooking into the wp plugins page.
938
-     *
939
-     * @throws InvalidArgumentException
940
-     * @throws InvalidDataTypeException
941
-     * @throws InvalidInterfaceException
942
-     */
943
-    public function hookIntoWpPluginsPage()
944
-    {
945
-        $this->loader->getShared('EventEspresso\core\domain\services\admin\ExitModal');
946
-        $this->loader
947
-             ->getShared('EventEspresso\core\domain\services\admin\PluginUpsells')
948
-             ->decafUpsells();
949
-    }
950
-
951
-
952
-    /**
953
-     * Hooks into the "post states" filter in a wp post type list table.
954
-     *
955
-     * @param array   $post_states
956
-     * @param WP_Post $post
957
-     * @return array
958
-     * @throws InvalidArgumentException
959
-     * @throws InvalidDataTypeException
960
-     * @throws InvalidInterfaceException
961
-     */
962
-    public function displayStateForCriticalPages($post_states, $post)
963
-    {
964
-        $post_states = (array) $post_states;
965
-        if (! $post instanceof WP_Post || $post->post_type !== 'page') {
966
-            return $post_states;
967
-        }
968
-        /** @var EE_Core_Config $config */
969
-        $config = $this->loader->getShared('EE_Config')->core;
970
-        if (in_array($post->ID, $config->get_critical_pages_array(), true)) {
971
-            $post_states[] = sprintf(
972
-            /* Translators: Using company name - Event Espresso Critical Page */
973
-                esc_html__('%s Critical Page', 'event_espresso'),
974
-                'Event Espresso'
975
-            );
976
-        }
977
-        return $post_states;
978
-    }
979
-
980
-
981
-    /**
982
-     * Show documentation links on the plugins page
983
-     *
984
-     * @param mixed $meta Plugin Row Meta
985
-     * @param mixed $file Plugin Base file
986
-     * @return array
987
-     */
988
-    public function addLinksToPluginRowMeta($meta, $file)
989
-    {
990
-        if (EE_PLUGIN_BASENAME === $file) {
991
-            $row_meta = [
992
-                'docs' => '<a href="https://eventespresso.com/support/documentation/versioned-docs/?doc_ver=ee4"'
993
-                          . ' aria-label="'
994
-                          . esc_attr__('View Event Espresso documentation', 'event_espresso')
995
-                          . '">'
996
-                          . esc_html__('Docs', 'event_espresso')
997
-                          . '</a>',
998
-                'api'  => '<a href="https://github.com/eventespresso/event-espresso-core/tree/master/docs/C--REST-API"'
999
-                          . ' aria-label="'
1000
-                          . esc_attr__('View Event Espresso API docs', 'event_espresso')
1001
-                          . '">'
1002
-                          . esc_html__('API docs', 'event_espresso')
1003
-                          . '</a>',
1004
-            ];
1005
-            return array_merge($meta, $row_meta);
1006
-        }
1007
-        return (array) $meta;
1008
-    }
23
+	/**
24
+	 * @var EE_Admin $_instance
25
+	 */
26
+	private static $_instance;
27
+
28
+	/**
29
+	 * @var PersistentAdminNoticeManager $persistent_admin_notice_manager
30
+	 */
31
+	private $persistent_admin_notice_manager;
32
+
33
+	/**
34
+	 * @var LoaderInterface
35
+	 */
36
+	protected $loader;
37
+
38
+	/**
39
+	 * @var RequestInterface
40
+	 */
41
+	protected $request;
42
+
43
+
44
+	/**
45
+	 * @param RequestInterface $request
46
+	 * @singleton method used to instantiate class object
47
+	 * @return EE_Admin
48
+	 * @throws EE_Error
49
+	 */
50
+	public static function instance(RequestInterface $request = null)
51
+	{
52
+		// check if class object is instantiated
53
+		if (! self::$_instance instanceof EE_Admin) {
54
+			self::$_instance = new self($request);
55
+		}
56
+		return self::$_instance;
57
+	}
58
+
59
+
60
+	/**
61
+	 * @return EE_Admin
62
+	 * @throws EE_Error
63
+	 */
64
+	public static function reset()
65
+	{
66
+		self::$_instance = null;
67
+		$request         = LoaderFactory::getLoader()->getShared(RequestInterface::class);
68
+		return self::instance($request);
69
+	}
70
+
71
+
72
+	/**
73
+	 * @param RequestInterface $request
74
+	 * @throws EE_Error
75
+	 * @throws InvalidDataTypeException
76
+	 * @throws InvalidInterfaceException
77
+	 * @throws InvalidArgumentException
78
+	 */
79
+	protected function __construct(RequestInterface $request)
80
+	{
81
+		$this->request = $request;
82
+		$this->loader = LoaderFactory::getLoader();
83
+		// define global EE_Admin constants
84
+		$this->_define_all_constants();
85
+		// set autoloaders for our admin page classes based on included path information
86
+		EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder(EE_ADMIN);
87
+		// admin hooks
88
+		add_filter('plugin_action_links', [$this, 'filter_plugin_actions'], 10, 2);
89
+		add_action('AHEE__EE_System__initialize_last', [$this, 'init']);
90
+		add_action('AHEE__EE_Admin_Page__route_admin_request', [$this, 'route_admin_request'], 100, 2);
91
+		add_action('wp_loaded', [$this, 'wp_loaded'], 100);
92
+		add_action('admin_init', [$this, 'admin_init'], 100);
93
+		add_action('admin_enqueue_scripts', [$this, 'enqueue_admin_scripts'], 20);
94
+		add_action('admin_notices', [$this, 'display_admin_notices'], 10);
95
+		add_action('network_admin_notices', [$this, 'display_admin_notices'], 10);
96
+		add_filter('pre_update_option', [$this, 'check_for_invalid_datetime_formats'], 100, 2);
97
+		add_filter('admin_footer_text', [$this, 'espresso_admin_footer']);
98
+		add_action('load-plugins.php', [$this, 'hookIntoWpPluginsPage']);
99
+		add_action('display_post_states', [$this, 'displayStateForCriticalPages'], 10, 2);
100
+		add_filter('plugin_row_meta', [$this, 'addLinksToPluginRowMeta'], 10, 2);
101
+		// reset Environment config (we only do this on admin page loads);
102
+		EE_Registry::instance()->CFG->environment->recheck_values();
103
+		do_action('AHEE__EE_Admin__loaded');
104
+	}
105
+
106
+
107
+	/**
108
+	 * _define_all_constants
109
+	 * define constants that are set globally for all admin pages
110
+	 *
111
+	 * @return void
112
+	 */
113
+	private function _define_all_constants()
114
+	{
115
+		if (! defined('EE_ADMIN_URL')) {
116
+			define('EE_ADMIN_URL', EE_PLUGIN_DIR_URL . 'core/admin/');
117
+			define('EE_ADMIN_PAGES_URL', EE_PLUGIN_DIR_URL . 'admin_pages/');
118
+			define('EE_ADMIN_TEMPLATE', EE_ADMIN . 'templates/');
119
+			define('WP_ADMIN_PATH', ABSPATH . 'wp-admin/');
120
+			define('WP_AJAX_URL', admin_url('admin-ajax.php'));
121
+		}
122
+	}
123
+
124
+
125
+	/**
126
+	 * filter_plugin_actions - adds links to the Plugins page listing
127
+	 *
128
+	 * @param array  $links
129
+	 * @param string $plugin
130
+	 * @return    array
131
+	 */
132
+	public function filter_plugin_actions($links, $plugin)
133
+	{
134
+		// set $main_file in stone
135
+		static $main_file;
136
+		// if $main_file is not set yet
137
+		if (! $main_file) {
138
+			$main_file = EE_PLUGIN_BASENAME;
139
+		}
140
+		if ($plugin === $main_file) {
141
+			// compare current plugin to this one
142
+			if (EE_Maintenance_Mode::instance()->level() === EE_Maintenance_Mode::level_2_complete_maintenance) {
143
+				$maintenance_link = '<a href="admin.php?page=espresso_maintenance_settings"'
144
+									. ' title="Event Espresso is in maintenance mode.  Click this link to learn why.">'
145
+									. esc_html__('Maintenance Mode Active', 'event_espresso')
146
+									. '</a>';
147
+				array_unshift($links, $maintenance_link);
148
+			} else {
149
+				$org_settings_link = '<a href="admin.php?page=espresso_general_settings">'
150
+									 . esc_html__('Settings', 'event_espresso')
151
+									 . '</a>';
152
+				$events_link       = '<a href="admin.php?page=espresso_events">'
153
+									 . esc_html__('Events', 'event_espresso')
154
+									 . '</a>';
155
+				// add before other links
156
+				array_unshift($links, $org_settings_link, $events_link);
157
+			}
158
+		}
159
+		return $links;
160
+	}
161
+
162
+
163
+	/**
164
+	 * @deprecated 4.10.14.p
165
+	 */
166
+	public function get_request()
167
+	{
168
+	}
169
+
170
+
171
+	/**
172
+	 * hide_admin_pages_except_maintenance_mode
173
+	 *
174
+	 * @param array $admin_page_folder_names
175
+	 * @return array
176
+	 */
177
+	public function hide_admin_pages_except_maintenance_mode($admin_page_folder_names = [])
178
+	{
179
+		return [
180
+			'maintenance' => EE_ADMIN_PAGES . 'maintenance/',
181
+			'about'       => EE_ADMIN_PAGES . 'about/',
182
+			'support'     => EE_ADMIN_PAGES . 'support/',
183
+		];
184
+	}
185
+
186
+
187
+	/**
188
+	 * init- should fire after shortcode, module,  addon, other plugin (default priority), and even
189
+	 * EE_Front_Controller's init phases have run
190
+	 *
191
+	 * @return void
192
+	 * @throws EE_Error
193
+	 * @throws InvalidArgumentException
194
+	 * @throws InvalidDataTypeException
195
+	 * @throws InvalidInterfaceException
196
+	 * @throws ReflectionException
197
+	 * @throws ServiceNotFoundException
198
+	 */
199
+	public function init()
200
+	{
201
+		// only enable most of the EE_Admin IF we're not in full maintenance mode
202
+		if (EE_Maintenance_Mode::instance()->models_can_query()) {
203
+			$this->initModelsReady();
204
+		}
205
+		// run the admin page factory but ONLY if:
206
+		// - it is a regular non ajax admin request
207
+		// - we are doing an ee admin ajax request
208
+		if ($this->request->isAdmin() || $this->request->isAdminAjax()) {
209
+			// this loads the controller for the admin pages which will setup routing etc
210
+			$this->loader->getShared('EE_Admin_Page_Loader', [$this->loader]);
211
+		}
212
+		if ($this->request->isAdminAjax()) {
213
+			return;
214
+		}
215
+		add_filter('content_save_pre', [$this, 'its_eSpresso'], 10, 1);
216
+		// make sure our CPTs and custom taxonomy metaboxes get shown for first time users
217
+		add_action('admin_head', [$this, 'enable_hidden_ee_nav_menu_metaboxes'], 10);
218
+		add_action('admin_head', [$this, 'register_custom_nav_menu_boxes'], 10);
219
+		// exclude EE critical pages from all nav menus and wp_list_pages
220
+		add_filter('nav_menu_meta_box_object', [$this, 'remove_pages_from_nav_menu'], 10);
221
+	}
222
+
223
+
224
+	/**
225
+	 * Gets the loader (and if it wasn't previously set, sets it)
226
+	 *
227
+	 * @return LoaderInterface
228
+	 * @throws InvalidArgumentException
229
+	 * @throws InvalidDataTypeException
230
+	 * @throws InvalidInterfaceException
231
+	 */
232
+	protected function getLoader()
233
+	{
234
+		return $this->loader;
235
+	}
236
+
237
+
238
+	/**
239
+	 * Method that's fired on admin requests (including admin ajax) but only when the models are usable
240
+	 * (ie, the site isn't in maintenance mode)
241
+	 *
242
+	 * @return void
243
+	 * @throws EE_Error
244
+	 * @since 4.9.63.p
245
+	 */
246
+	protected function initModelsReady()
247
+	{
248
+		// ok so we want to enable the entire admin
249
+		$this->persistent_admin_notice_manager = $this->loader->getShared(
250
+			'EventEspresso\core\services\notifications\PersistentAdminNoticeManager'
251
+		);
252
+		$this->persistent_admin_notice_manager->setReturnUrl(
253
+			EE_Admin_Page::add_query_args_and_nonce(
254
+				[
255
+					'page'   => $this->request->getRequestParam('page'),
256
+					'action' => $this->request->getRequestParam('action'),
257
+				],
258
+				EE_ADMIN_URL
259
+			)
260
+		);
261
+		$this->maybeSetDatetimeWarningNotice();
262
+		// at a glance dashboard widget
263
+		add_filter('dashboard_glance_items', [$this, 'dashboard_glance_items'], 10);
264
+		// filter for get_edit_post_link used on comments for custom post types
265
+		add_filter('get_edit_post_link', [$this, 'modify_edit_post_link'], 10, 2);
266
+	}
267
+
268
+
269
+	/**
270
+	 *    get_persistent_admin_notices
271
+	 *
272
+	 * @access    public
273
+	 * @return void
274
+	 * @throws EE_Error
275
+	 * @throws InvalidArgumentException
276
+	 * @throws InvalidDataTypeException
277
+	 * @throws InvalidInterfaceException
278
+	 */
279
+	public function maybeSetDatetimeWarningNotice()
280
+	{
281
+		// add dismissible notice for datetime changes.  Only valid if site does not have a timezone_string set.
282
+		// @todo This needs to stay in core for a bit to catch anyone upgrading from a version without this to a version
283
+		// with this.  But after enough time (indeterminate at this point) we can just remove this notice.
284
+		// this was added with https://events.codebasehq.com/projects/event-espresso/tickets/10626
285
+		if (
286
+			apply_filters('FHEE__EE_Admin__maybeSetDatetimeWarningNotice', true)
287
+			&& ! get_option('timezone_string')
288
+			&& EEM_Event::instance()->count() > 0
289
+		) {
290
+			new PersistentAdminNotice(
291
+				'datetime_fix_notice',
292
+				sprintf(
293
+					esc_html__(
294
+						'%1$sImportant announcement related to your install of Event Espresso%2$s: There are some changes made to your site that could affect how dates display for your events and other related items with dates and times.  Read more about it %3$shere%4$s. If your dates and times are displaying incorrectly (incorrect offset), you can fix it using the tool on %5$sthis page%4$s.',
295
+						'event_espresso'
296
+					),
297
+					'<strong>',
298
+					'</strong>',
299
+					'<a href="https://eventespresso.com/2017/08/important-upcoming-changes-dates-times">',
300
+					'</a>',
301
+					'<a href="' . EE_Admin_Page::add_query_args_and_nonce(
302
+						[
303
+							'page'   => 'espresso_maintenance_settings',
304
+							'action' => 'datetime_tools',
305
+						],
306
+						admin_url('admin.php')
307
+					) . '">'
308
+				),
309
+				false,
310
+				'manage_options',
311
+				'datetime_fix_persistent_notice'
312
+			);
313
+		}
314
+	}
315
+
316
+
317
+	/**
318
+	 * this simply hooks into the nav menu setup of pages metabox and makes sure that we remove EE critical pages from
319
+	 * the list of options. the wp function "wp_nav_menu_item_post_type_meta_box" found in
320
+	 * wp-admin/includes/nav-menu.php looks for the "_default_query" property on the post_type object and it uses that
321
+	 * to override any queries found in the existing query for the given post type.  Note that _default_query is not a
322
+	 * normal property on the post_type object.  It's found ONLY in this particular context.
323
+	 *
324
+	 * @param WP_Post $post_type WP post type object
325
+	 * @return WP_Post
326
+	 * @throws InvalidArgumentException
327
+	 * @throws InvalidDataTypeException
328
+	 * @throws InvalidInterfaceException
329
+	 */
330
+	public function remove_pages_from_nav_menu($post_type)
331
+	{
332
+		// if this isn't the "pages" post type let's get out
333
+		if ($post_type->name !== 'page') {
334
+			return $post_type;
335
+		}
336
+		$critical_pages            = EE_Registry::instance()->CFG->core->get_critical_pages_array();
337
+		$post_type->_default_query = [
338
+			'post__not_in' => $critical_pages,
339
+		];
340
+		return $post_type;
341
+	}
342
+
343
+
344
+	/**
345
+	 * WP by default only shows three metaboxes in "nav-menus.php" for first times users.  We want to make sure our
346
+	 * metaboxes get shown as well
347
+	 *
348
+	 * @return void
349
+	 */
350
+	public function enable_hidden_ee_nav_menu_metaboxes()
351
+	{
352
+		global $wp_meta_boxes, $pagenow;
353
+		if (! is_array($wp_meta_boxes) || $pagenow !== 'nav-menus.php') {
354
+			return;
355
+		}
356
+		$user = wp_get_current_user();
357
+		// has this been done yet?
358
+		if (get_user_option('ee_nav_menu_initialized', $user->ID)) {
359
+			return;
360
+		}
361
+
362
+		$hidden_meta_boxes  = get_user_option('metaboxhidden_nav-menus', $user->ID);
363
+		$initial_meta_boxes = apply_filters(
364
+			'FHEE__EE_Admin__enable_hidden_ee_nav_menu_boxes__initial_meta_boxes',
365
+			[
366
+				'nav-menu-theme-locations',
367
+				'add-page',
368
+				'add-custom-links',
369
+				'add-category',
370
+				'add-espresso_events',
371
+				'add-espresso_venues',
372
+				'add-espresso_event_categories',
373
+				'add-espresso_venue_categories',
374
+				'add-post-type-post',
375
+				'add-post-type-page',
376
+			]
377
+		);
378
+
379
+		if (is_array($hidden_meta_boxes)) {
380
+			foreach ($hidden_meta_boxes as $key => $meta_box_id) {
381
+				if (in_array($meta_box_id, $initial_meta_boxes, true)) {
382
+					unset($hidden_meta_boxes[ $key ]);
383
+				}
384
+			}
385
+		}
386
+		update_user_option($user->ID, 'metaboxhidden_nav-menus', $hidden_meta_boxes, true);
387
+		update_user_option($user->ID, 'ee_nav_menu_initialized', 1, true);
388
+	}
389
+
390
+
391
+	/**
392
+	 * This method simply registers custom nav menu boxes for "nav_menus.php route"
393
+	 * Currently EE is using this to make sure there are menu options for our CPT archive page routes.
394
+	 *
395
+	 * @return void
396
+	 * @todo   modify this so its more dynamic and automatic for all ee CPTs and setups and can also be hooked into by
397
+	 *         addons etc.
398
+	 */
399
+	public function register_custom_nav_menu_boxes()
400
+	{
401
+		add_meta_box(
402
+			'add-extra-nav-menu-pages',
403
+			esc_html__('Event Espresso Pages', 'event_espresso'),
404
+			[$this, 'ee_cpt_archive_pages'],
405
+			'nav-menus',
406
+			'side',
407
+			'core'
408
+		);
409
+	}
410
+
411
+
412
+	/**
413
+	 * Use this to edit the post link for our cpts so that the edit link points to the correct page.
414
+	 *
415
+	 * @param string $link the original link generated by wp
416
+	 * @param int    $id   post id
417
+	 * @return string  the (maybe) modified link
418
+	 * @since   4.3.0
419
+	 */
420
+	public function modify_edit_post_link($link, $id)
421
+	{
422
+		if (! $post = get_post($id)) {
423
+			return $link;
424
+		}
425
+		if ($post->post_type === 'espresso_attendees') {
426
+			$query_args = [
427
+				'action' => 'edit_attendee',
428
+				'post'   => $id,
429
+			];
430
+			return EEH_URL::add_query_args_and_nonce(
431
+				$query_args,
432
+				admin_url('admin.php?page=espresso_registrations')
433
+			);
434
+		}
435
+		return $link;
436
+	}
437
+
438
+
439
+	public function ee_cpt_archive_pages()
440
+	{
441
+		global $nav_menu_selected_id;
442
+		$removed_args = [
443
+			'action',
444
+			'customlink-tab',
445
+			'edit-menu-item',
446
+			'menu-item',
447
+			'page-tab',
448
+			'_wpnonce',
449
+		];
450
+		$nav_tab_link = $nav_menu_selected_id
451
+			? esc_url(
452
+				add_query_arg(
453
+					'extra-nav-menu-pages-tab',
454
+					'event-archives',
455
+					remove_query_arg($removed_args)
456
+				)
457
+			)
458
+			: '';
459
+		$select_all_link = esc_url(
460
+			add_query_arg(
461
+				[
462
+					'extra-nav-menu-pages-tab' => 'event-archives',
463
+					'selectall'                => 1,
464
+				],
465
+				remove_query_arg($removed_args)
466
+			)
467
+		);
468
+		$pages = $this->_get_extra_nav_menu_pages_items();
469
+		$args['walker'] = new Walker_Nav_Menu_Checklist(false);
470
+		;
471
+		$nav_menu_pages_items = walk_nav_menu_tree(
472
+			array_map(
473
+				[$this, '_setup_extra_nav_menu_pages_items'],
474
+				$pages
475
+			),
476
+			0,
477
+			(object) $args
478
+		);
479
+
480
+		EEH_Template::display_template(
481
+			EE_ADMIN_TEMPLATE . 'cpt_archive_page.template.php',
482
+			[
483
+				$nav_menu_pages_items,
484
+				$nav_tab_link,
485
+				$select_all_link,
486
+			]
487
+		);
488
+	}
489
+
490
+
491
+	/**
492
+	 * Returns an array of event archive nav items.
493
+	 *
494
+	 * @return array
495
+	 * @todo  for now this method is just in place so when it gets abstracted further we can substitute in whatever
496
+	 *        method we use for getting the extra nav menu items
497
+	 */
498
+	private function _get_extra_nav_menu_pages_items()
499
+	{
500
+		$menuitems[] = [
501
+			'title'       => esc_html__('Event List', 'event_espresso'),
502
+			'url'         => get_post_type_archive_link('espresso_events'),
503
+			'description' => esc_html__('Archive page for all events.', 'event_espresso'),
504
+		];
505
+		return apply_filters('FHEE__EE_Admin__get_extra_nav_menu_pages_items', $menuitems);
506
+	}
507
+
508
+
509
+	/**
510
+	 * Setup nav menu walker item for usage in the event archive nav menu metabox.  It receives a menu_item array with
511
+	 * the properties and converts it to the menu item object.
512
+	 *
513
+	 * @param $menu_item_values
514
+	 * @return stdClass
515
+	 * @see wp_setup_nav_menu_item() in wp-includes/nav-menu.php
516
+	 */
517
+	private function _setup_extra_nav_menu_pages_items($menu_item_values)
518
+	{
519
+		$menu_item = new stdClass();
520
+		$keys      = [
521
+			'ID'               => 0,
522
+			'db_id'            => 0,
523
+			'menu_item_parent' => 0,
524
+			'object_id'        => -1,
525
+			'post_parent'      => 0,
526
+			'type'             => 'custom',
527
+			'object'           => '',
528
+			'type_label'       => esc_html__('Extra Nav Menu Item', 'event_espresso'),
529
+			'title'            => '',
530
+			'url'              => '',
531
+			'target'           => '',
532
+			'attr_title'       => '',
533
+			'description'      => '',
534
+			'classes'          => [],
535
+			'xfn'              => '',
536
+		];
537
+
538
+		foreach ($keys as $key => $value) {
539
+			$menu_item->{$key} = isset($menu_item_values[ $key ]) ? $menu_item_values[ $key ] : $value;
540
+		}
541
+		return $menu_item;
542
+	}
543
+
544
+
545
+	/**
546
+	 * This is the action hook for the AHEE__EE_Admin_Page__route_admin_request hook that fires off right before an
547
+	 * EE_Admin_Page route is called.
548
+	 *
549
+	 * @return void
550
+	 */
551
+	public function route_admin_request()
552
+	{
553
+	}
554
+
555
+
556
+	/**
557
+	 * wp_loaded should fire on the WordPress wp_loaded hook.  This fires on a VERY late priority.
558
+	 *
559
+	 * @return void
560
+	 */
561
+	public function wp_loaded()
562
+	{
563
+	}
564
+
565
+
566
+	/**
567
+	 * admin_init
568
+	 *
569
+	 * @return void
570
+	 * @throws InvalidArgumentException
571
+	 * @throws InvalidDataTypeException
572
+	 * @throws InvalidInterfaceException
573
+	 */
574
+	public function admin_init()
575
+	{
576
+		/**
577
+		 * our cpt models must be instantiated on WordPress post processing routes (wp-admin/post.php),
578
+		 * so any hooking into core WP routes is taken care of.  So in this next few lines of code:
579
+		 * - check if doing post processing.
580
+		 * - check if doing post processing of one of EE CPTs
581
+		 * - instantiate the corresponding EE CPT model for the post_type being processed.
582
+		 */
583
+		$action    = $this->request->getRequestParam('action');
584
+		$post_type = $this->request->getRequestParam('post_type');
585
+		if ($post_type && $action === 'editpost') {
586
+			/** @var CustomPostTypeDefinitions $custom_post_types */
587
+			$custom_post_types = $this->loader->getShared(CustomPostTypeDefinitions::class);
588
+			$custom_post_types->getCustomPostTypeModels($post_type);
589
+		}
590
+
591
+
592
+		/**
593
+		 * This code excludes EE critical pages anywhere `wp_dropdown_pages` is used to create a dropdown for selecting
594
+		 * critical pages.  The only place critical pages need included in a generated dropdown is on the "Critical
595
+		 * Pages" tab in the EE General Settings Admin page.
596
+		 * This is for user-proofing.
597
+		 */
598
+		add_filter('wp_dropdown_pages', [$this, 'modify_dropdown_pages']);
599
+		if (EE_Maintenance_Mode::instance()->models_can_query()) {
600
+			$this->adminInitModelsReady();
601
+		}
602
+	}
603
+
604
+
605
+	/**
606
+	 * Runs on admin_init but only if models are usable (ie, we're not in maintenance mode)
607
+	 */
608
+	protected function adminInitModelsReady()
609
+	{
610
+		if (function_exists('wp_add_privacy_policy_content')) {
611
+			$this->loader->getShared('EventEspresso\core\services\privacy\policy\PrivacyPolicyManager');
612
+		}
613
+	}
614
+
615
+
616
+	/**
617
+	 * Callback for wp_dropdown_pages hook to remove ee critical pages from the dropdown selection.
618
+	 *
619
+	 * @param string $output Current output.
620
+	 * @return string
621
+	 * @throws InvalidArgumentException
622
+	 * @throws InvalidDataTypeException
623
+	 * @throws InvalidInterfaceException
624
+	 */
625
+	public function modify_dropdown_pages($output)
626
+	{
627
+		// get critical pages
628
+		$critical_pages = EE_Registry::instance()->CFG->core->get_critical_pages_array();
629
+
630
+		// split current output by line break for easier parsing.
631
+		$split_output = explode("\n", $output);
632
+
633
+		// loop through to remove any critical pages from the array.
634
+		foreach ($critical_pages as $page_id) {
635
+			$needle = 'value="' . $page_id . '"';
636
+			foreach ($split_output as $key => $haystack) {
637
+				if (strpos($haystack, $needle) !== false) {
638
+					unset($split_output[ $key ]);
639
+				}
640
+			}
641
+		}
642
+		// replace output with the new contents
643
+		return implode("\n", $split_output);
644
+	}
645
+
646
+
647
+	/**
648
+	 * enqueue all admin scripts that need loaded for admin pages
649
+	 *
650
+	 * @return void
651
+	 */
652
+	public function enqueue_admin_scripts()
653
+	{
654
+		// this javascript is loaded on every admin page to catch any injections ee needs to add to wp run js.
655
+		// Note: the intention of this script is to only do TARGETED injections.  I.E, only injecting on certain script
656
+		// calls.
657
+		wp_enqueue_script(
658
+			'ee-inject-wp',
659
+			EE_ADMIN_URL . 'assets/ee-cpt-wp-injects.js',
660
+			['jquery'],
661
+			EVENT_ESPRESSO_VERSION,
662
+			true
663
+		);
664
+	}
665
+
666
+
667
+	/**
668
+	 * display_admin_notices
669
+	 *
670
+	 * @return void
671
+	 */
672
+	public function display_admin_notices()
673
+	{
674
+		echo EE_Error::get_notices(); // already escaped
675
+	}
676
+
677
+
678
+	/**
679
+	 * @param array $elements
680
+	 * @return array
681
+	 * @throws EE_Error
682
+	 * @throws InvalidArgumentException
683
+	 * @throws InvalidDataTypeException
684
+	 * @throws InvalidInterfaceException
685
+	 */
686
+	public function dashboard_glance_items($elements)
687
+	{
688
+		$elements                        = is_array($elements) ? $elements : [$elements];
689
+		$events                          = EEM_Event::instance()->count();
690
+		$items['events']['url']          = EE_Admin_Page::add_query_args_and_nonce(
691
+			['page' => 'espresso_events'],
692
+			admin_url('admin.php')
693
+		);
694
+		$items['events']['text']         = sprintf(
695
+			esc_html(
696
+				_n('%s Event', '%s Events', $events, 'event_espresso')
697
+			),
698
+			number_format_i18n($events)
699
+		);
700
+		$items['events']['title']        = esc_html__('Click to view all Events', 'event_espresso');
701
+		$registrations                   = EEM_Registration::instance()->count(
702
+			[
703
+				[
704
+					'STS_ID' => ['!=', EEM_Registration::status_id_incomplete],
705
+				],
706
+			]
707
+		);
708
+		$items['registrations']['url']   = EE_Admin_Page::add_query_args_and_nonce(
709
+			['page' => 'espresso_registrations'],
710
+			admin_url('admin.php')
711
+		);
712
+		$items['registrations']['text']  = sprintf(
713
+			esc_html(
714
+				_n('%s Registration', '%s Registrations', $registrations, 'event_espresso')
715
+			),
716
+			number_format_i18n($registrations)
717
+		);
718
+		$items['registrations']['title'] = esc_html__('Click to view all registrations', 'event_espresso');
719
+
720
+		$items = (array) apply_filters('FHEE__EE_Admin__dashboard_glance_items__items', $items);
721
+
722
+		foreach ($items as $type => $item_properties) {
723
+			$elements[] = sprintf(
724
+				'<a class="ee-dashboard-link-' . $type . '" href="%s" title="%s">%s</a>',
725
+				$item_properties['url'],
726
+				$item_properties['title'],
727
+				$item_properties['text']
728
+			);
729
+		}
730
+		return $elements;
731
+	}
732
+
733
+
734
+	/**
735
+	 * check_for_invalid_datetime_formats
736
+	 * if an admin changes their date or time format settings on the WP General Settings admin page, verify that
737
+	 * their selected format can be parsed by PHP
738
+	 *
739
+	 * @param    $value
740
+	 * @param    $option
741
+	 * @return    string
742
+	 */
743
+	public function check_for_invalid_datetime_formats($value, $option)
744
+	{
745
+		// check for date_format or time_format
746
+		switch ($option) {
747
+			case 'date_format':
748
+				$date_time_format = $value . ' ' . get_option('time_format');
749
+				break;
750
+			case 'time_format':
751
+				$date_time_format = get_option('date_format') . ' ' . $value;
752
+				break;
753
+			default:
754
+				$date_time_format = false;
755
+		}
756
+		// do we have a date_time format to check ?
757
+		if ($date_time_format) {
758
+			$error_msg = EEH_DTT_Helper::validate_format_string($date_time_format);
759
+
760
+			if (is_array($error_msg)) {
761
+				$msg = '<p>'
762
+					   . sprintf(
763
+						   esc_html__(
764
+							   'The following date time "%s" ( %s ) is difficult to be properly parsed by PHP for the following reasons:',
765
+							   'event_espresso'
766
+						   ),
767
+						   date($date_time_format),
768
+						   $date_time_format
769
+					   )
770
+					   . '</p><p><ul>';
771
+
772
+
773
+				foreach ($error_msg as $error) {
774
+					$msg .= '<li>' . $error . '</li>';
775
+				}
776
+
777
+				$msg .= '</ul></p><p>'
778
+						. sprintf(
779
+							esc_html__(
780
+								'%sPlease note that your date and time formats have been reset to "F j, Y" and "g:i a" respectively.%s',
781
+								'event_espresso'
782
+							),
783
+							'<span style="color:#D54E21;">',
784
+							'</span>'
785
+						)
786
+						. '</p>';
787
+
788
+				// trigger WP settings error
789
+				add_settings_error(
790
+					'date_format',
791
+					'date_format',
792
+					$msg
793
+				);
794
+
795
+				// set format to something valid
796
+				switch ($option) {
797
+					case 'date_format':
798
+						$value = 'F j, Y';
799
+						break;
800
+					case 'time_format':
801
+						$value = 'g:i a';
802
+						break;
803
+				}
804
+			}
805
+		}
806
+		return $value;
807
+	}
808
+
809
+
810
+	/**
811
+	 * its_eSpresso - converts the less commonly used spelling of "Expresso" to "Espresso"
812
+	 *
813
+	 * @param $content
814
+	 * @return    string
815
+	 */
816
+	public function its_eSpresso($content)
817
+	{
818
+		return str_replace('[EXPRESSO_', '[ESPRESSO_', $content);
819
+	}
820
+
821
+
822
+	/**
823
+	 * espresso_admin_footer
824
+	 *
825
+	 * @return    string
826
+	 */
827
+	public function espresso_admin_footer()
828
+	{
829
+		return EEH_Template::powered_by_event_espresso('aln-cntr', '', ['utm_content' => 'admin_footer']);
830
+	}
831
+
832
+
833
+	/**
834
+	 * static method for registering ee admin page.
835
+	 * This method is deprecated in favor of the new location in EE_Register_Admin_Page::register.
836
+	 *
837
+	 * @param       $page_basename
838
+	 * @param       $page_path
839
+	 * @param array $config
840
+	 * @return void
841
+	 * @throws EE_Error
842
+	 * @see        EE_Register_Admin_Page::register()
843
+	 * @since      4.3.0
844
+	 * @deprecated 4.3.0    Use EE_Register_Admin_Page::register() instead
845
+	 */
846
+	public static function register_ee_admin_page($page_basename, $page_path, $config = [])
847
+	{
848
+		EE_Error::doing_it_wrong(
849
+			__METHOD__,
850
+			sprintf(
851
+				esc_html__(
852
+					'Usage is deprecated.  Use EE_Register_Admin_Page::register() for registering the %s admin page.',
853
+					'event_espresso'
854
+				),
855
+				$page_basename
856
+			),
857
+			'4.3'
858
+		);
859
+		if (class_exists('EE_Register_Admin_Page')) {
860
+			$config['page_path'] = $page_path;
861
+		}
862
+		EE_Register_Admin_Page::register($page_basename, $config);
863
+	}
864
+
865
+
866
+	/**
867
+	 * @param int     $post_ID
868
+	 * @param WP_Post $post
869
+	 * @return void
870
+	 * @deprecated 4.8.41
871
+	 */
872
+	public static function parse_post_content_on_save($post_ID, $post)
873
+	{
874
+		EE_Error::doing_it_wrong(
875
+			__METHOD__,
876
+			esc_html__('Usage is deprecated', 'event_espresso'),
877
+			'4.8.41'
878
+		);
879
+	}
880
+
881
+
882
+	/**
883
+	 * @param  $option
884
+	 * @param  $old_value
885
+	 * @param  $value
886
+	 * @return void
887
+	 * @deprecated 4.8.41
888
+	 */
889
+	public function reset_page_for_posts_on_change($option, $old_value, $value)
890
+	{
891
+		EE_Error::doing_it_wrong(
892
+			__METHOD__,
893
+			esc_html__('Usage is deprecated', 'event_espresso'),
894
+			'4.8.41'
895
+		);
896
+	}
897
+
898
+
899
+	/**
900
+	 * @return void
901
+	 * @deprecated 4.9.27
902
+	 */
903
+	public function get_persistent_admin_notices()
904
+	{
905
+		EE_Error::doing_it_wrong(
906
+			__METHOD__,
907
+			sprintf(
908
+				esc_html__('Usage is deprecated. Use "%1$s" instead.', 'event_espresso'),
909
+				'\EventEspresso\core\services\notifications\PersistentAdminNoticeManager'
910
+			),
911
+			'4.9.27'
912
+		);
913
+	}
914
+
915
+
916
+	/**
917
+	 * @throws InvalidInterfaceException
918
+	 * @throws InvalidDataTypeException
919
+	 * @throws DomainException
920
+	 * @deprecated 4.9.27
921
+	 */
922
+	public function dismiss_ee_nag_notice_callback()
923
+	{
924
+		EE_Error::doing_it_wrong(
925
+			__METHOD__,
926
+			sprintf(
927
+				esc_html__('Usage is deprecated. Use "%1$s" instead.', 'event_espresso'),
928
+				'\EventEspresso\core\services\notifications\PersistentAdminNoticeManager'
929
+			),
930
+			'4.9.27'
931
+		);
932
+		$this->persistent_admin_notice_manager->dismissNotice();
933
+	}
934
+
935
+
936
+	/**
937
+	 * Callback on load-plugins.php hook for setting up anything hooking into the wp plugins page.
938
+	 *
939
+	 * @throws InvalidArgumentException
940
+	 * @throws InvalidDataTypeException
941
+	 * @throws InvalidInterfaceException
942
+	 */
943
+	public function hookIntoWpPluginsPage()
944
+	{
945
+		$this->loader->getShared('EventEspresso\core\domain\services\admin\ExitModal');
946
+		$this->loader
947
+			 ->getShared('EventEspresso\core\domain\services\admin\PluginUpsells')
948
+			 ->decafUpsells();
949
+	}
950
+
951
+
952
+	/**
953
+	 * Hooks into the "post states" filter in a wp post type list table.
954
+	 *
955
+	 * @param array   $post_states
956
+	 * @param WP_Post $post
957
+	 * @return array
958
+	 * @throws InvalidArgumentException
959
+	 * @throws InvalidDataTypeException
960
+	 * @throws InvalidInterfaceException
961
+	 */
962
+	public function displayStateForCriticalPages($post_states, $post)
963
+	{
964
+		$post_states = (array) $post_states;
965
+		if (! $post instanceof WP_Post || $post->post_type !== 'page') {
966
+			return $post_states;
967
+		}
968
+		/** @var EE_Core_Config $config */
969
+		$config = $this->loader->getShared('EE_Config')->core;
970
+		if (in_array($post->ID, $config->get_critical_pages_array(), true)) {
971
+			$post_states[] = sprintf(
972
+			/* Translators: Using company name - Event Espresso Critical Page */
973
+				esc_html__('%s Critical Page', 'event_espresso'),
974
+				'Event Espresso'
975
+			);
976
+		}
977
+		return $post_states;
978
+	}
979
+
980
+
981
+	/**
982
+	 * Show documentation links on the plugins page
983
+	 *
984
+	 * @param mixed $meta Plugin Row Meta
985
+	 * @param mixed $file Plugin Base file
986
+	 * @return array
987
+	 */
988
+	public function addLinksToPluginRowMeta($meta, $file)
989
+	{
990
+		if (EE_PLUGIN_BASENAME === $file) {
991
+			$row_meta = [
992
+				'docs' => '<a href="https://eventespresso.com/support/documentation/versioned-docs/?doc_ver=ee4"'
993
+						  . ' aria-label="'
994
+						  . esc_attr__('View Event Espresso documentation', 'event_espresso')
995
+						  . '">'
996
+						  . esc_html__('Docs', 'event_espresso')
997
+						  . '</a>',
998
+				'api'  => '<a href="https://github.com/eventespresso/event-espresso-core/tree/master/docs/C--REST-API"'
999
+						  . ' aria-label="'
1000
+						  . esc_attr__('View Event Espresso API docs', 'event_espresso')
1001
+						  . '">'
1002
+						  . esc_html__('API docs', 'event_espresso')
1003
+						  . '</a>',
1004
+			];
1005
+			return array_merge($meta, $row_meta);
1006
+		}
1007
+		return (array) $meta;
1008
+	}
1009 1009
 }
Please login to merge, or discard this patch.
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
     public static function instance(RequestInterface $request = null)
51 51
     {
52 52
         // check if class object is instantiated
53
-        if (! self::$_instance instanceof EE_Admin) {
53
+        if ( ! self::$_instance instanceof EE_Admin) {
54 54
             self::$_instance = new self($request);
55 55
         }
56 56
         return self::$_instance;
@@ -112,11 +112,11 @@  discard block
 block discarded – undo
112 112
      */
113 113
     private function _define_all_constants()
114 114
     {
115
-        if (! defined('EE_ADMIN_URL')) {
116
-            define('EE_ADMIN_URL', EE_PLUGIN_DIR_URL . 'core/admin/');
117
-            define('EE_ADMIN_PAGES_URL', EE_PLUGIN_DIR_URL . 'admin_pages/');
118
-            define('EE_ADMIN_TEMPLATE', EE_ADMIN . 'templates/');
119
-            define('WP_ADMIN_PATH', ABSPATH . 'wp-admin/');
115
+        if ( ! defined('EE_ADMIN_URL')) {
116
+            define('EE_ADMIN_URL', EE_PLUGIN_DIR_URL.'core/admin/');
117
+            define('EE_ADMIN_PAGES_URL', EE_PLUGIN_DIR_URL.'admin_pages/');
118
+            define('EE_ADMIN_TEMPLATE', EE_ADMIN.'templates/');
119
+            define('WP_ADMIN_PATH', ABSPATH.'wp-admin/');
120 120
             define('WP_AJAX_URL', admin_url('admin-ajax.php'));
121 121
         }
122 122
     }
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
         // set $main_file in stone
135 135
         static $main_file;
136 136
         // if $main_file is not set yet
137
-        if (! $main_file) {
137
+        if ( ! $main_file) {
138 138
             $main_file = EE_PLUGIN_BASENAME;
139 139
         }
140 140
         if ($plugin === $main_file) {
@@ -177,9 +177,9 @@  discard block
 block discarded – undo
177 177
     public function hide_admin_pages_except_maintenance_mode($admin_page_folder_names = [])
178 178
     {
179 179
         return [
180
-            'maintenance' => EE_ADMIN_PAGES . 'maintenance/',
181
-            'about'       => EE_ADMIN_PAGES . 'about/',
182
-            'support'     => EE_ADMIN_PAGES . 'support/',
180
+            'maintenance' => EE_ADMIN_PAGES.'maintenance/',
181
+            'about'       => EE_ADMIN_PAGES.'about/',
182
+            'support'     => EE_ADMIN_PAGES.'support/',
183 183
         ];
184 184
     }
185 185
 
@@ -298,13 +298,13 @@  discard block
 block discarded – undo
298 298
                     '</strong>',
299 299
                     '<a href="https://eventespresso.com/2017/08/important-upcoming-changes-dates-times">',
300 300
                     '</a>',
301
-                    '<a href="' . EE_Admin_Page::add_query_args_and_nonce(
301
+                    '<a href="'.EE_Admin_Page::add_query_args_and_nonce(
302 302
                         [
303 303
                             'page'   => 'espresso_maintenance_settings',
304 304
                             'action' => 'datetime_tools',
305 305
                         ],
306 306
                         admin_url('admin.php')
307
-                    ) . '">'
307
+                    ).'">'
308 308
                 ),
309 309
                 false,
310 310
                 'manage_options',
@@ -350,7 +350,7 @@  discard block
 block discarded – undo
350 350
     public function enable_hidden_ee_nav_menu_metaboxes()
351 351
     {
352 352
         global $wp_meta_boxes, $pagenow;
353
-        if (! is_array($wp_meta_boxes) || $pagenow !== 'nav-menus.php') {
353
+        if ( ! is_array($wp_meta_boxes) || $pagenow !== 'nav-menus.php') {
354 354
             return;
355 355
         }
356 356
         $user = wp_get_current_user();
@@ -379,7 +379,7 @@  discard block
 block discarded – undo
379 379
         if (is_array($hidden_meta_boxes)) {
380 380
             foreach ($hidden_meta_boxes as $key => $meta_box_id) {
381 381
                 if (in_array($meta_box_id, $initial_meta_boxes, true)) {
382
-                    unset($hidden_meta_boxes[ $key ]);
382
+                    unset($hidden_meta_boxes[$key]);
383 383
                 }
384 384
             }
385 385
         }
@@ -419,7 +419,7 @@  discard block
 block discarded – undo
419 419
      */
420 420
     public function modify_edit_post_link($link, $id)
421 421
     {
422
-        if (! $post = get_post($id)) {
422
+        if ( ! $post = get_post($id)) {
423 423
             return $link;
424 424
         }
425 425
         if ($post->post_type === 'espresso_attendees') {
@@ -478,7 +478,7 @@  discard block
 block discarded – undo
478 478
         );
479 479
 
480 480
         EEH_Template::display_template(
481
-            EE_ADMIN_TEMPLATE . 'cpt_archive_page.template.php',
481
+            EE_ADMIN_TEMPLATE.'cpt_archive_page.template.php',
482 482
             [
483 483
                 $nav_menu_pages_items,
484 484
                 $nav_tab_link,
@@ -536,7 +536,7 @@  discard block
 block discarded – undo
536 536
         ];
537 537
 
538 538
         foreach ($keys as $key => $value) {
539
-            $menu_item->{$key} = isset($menu_item_values[ $key ]) ? $menu_item_values[ $key ] : $value;
539
+            $menu_item->{$key} = isset($menu_item_values[$key]) ? $menu_item_values[$key] : $value;
540 540
         }
541 541
         return $menu_item;
542 542
     }
@@ -632,10 +632,10 @@  discard block
 block discarded – undo
632 632
 
633 633
         // loop through to remove any critical pages from the array.
634 634
         foreach ($critical_pages as $page_id) {
635
-            $needle = 'value="' . $page_id . '"';
635
+            $needle = 'value="'.$page_id.'"';
636 636
             foreach ($split_output as $key => $haystack) {
637 637
                 if (strpos($haystack, $needle) !== false) {
638
-                    unset($split_output[ $key ]);
638
+                    unset($split_output[$key]);
639 639
                 }
640 640
             }
641 641
         }
@@ -656,7 +656,7 @@  discard block
 block discarded – undo
656 656
         // calls.
657 657
         wp_enqueue_script(
658 658
             'ee-inject-wp',
659
-            EE_ADMIN_URL . 'assets/ee-cpt-wp-injects.js',
659
+            EE_ADMIN_URL.'assets/ee-cpt-wp-injects.js',
660 660
             ['jquery'],
661 661
             EVENT_ESPRESSO_VERSION,
662 662
             true
@@ -691,7 +691,7 @@  discard block
 block discarded – undo
691 691
             ['page' => 'espresso_events'],
692 692
             admin_url('admin.php')
693 693
         );
694
-        $items['events']['text']         = sprintf(
694
+        $items['events']['text'] = sprintf(
695 695
             esc_html(
696 696
                 _n('%s Event', '%s Events', $events, 'event_espresso')
697 697
             ),
@@ -705,11 +705,11 @@  discard block
 block discarded – undo
705 705
                 ],
706 706
             ]
707 707
         );
708
-        $items['registrations']['url']   = EE_Admin_Page::add_query_args_and_nonce(
708
+        $items['registrations']['url'] = EE_Admin_Page::add_query_args_and_nonce(
709 709
             ['page' => 'espresso_registrations'],
710 710
             admin_url('admin.php')
711 711
         );
712
-        $items['registrations']['text']  = sprintf(
712
+        $items['registrations']['text'] = sprintf(
713 713
             esc_html(
714 714
                 _n('%s Registration', '%s Registrations', $registrations, 'event_espresso')
715 715
             ),
@@ -721,7 +721,7 @@  discard block
 block discarded – undo
721 721
 
722 722
         foreach ($items as $type => $item_properties) {
723 723
             $elements[] = sprintf(
724
-                '<a class="ee-dashboard-link-' . $type . '" href="%s" title="%s">%s</a>',
724
+                '<a class="ee-dashboard-link-'.$type.'" href="%s" title="%s">%s</a>',
725 725
                 $item_properties['url'],
726 726
                 $item_properties['title'],
727 727
                 $item_properties['text']
@@ -745,10 +745,10 @@  discard block
 block discarded – undo
745 745
         // check for date_format or time_format
746 746
         switch ($option) {
747 747
             case 'date_format':
748
-                $date_time_format = $value . ' ' . get_option('time_format');
748
+                $date_time_format = $value.' '.get_option('time_format');
749 749
                 break;
750 750
             case 'time_format':
751
-                $date_time_format = get_option('date_format') . ' ' . $value;
751
+                $date_time_format = get_option('date_format').' '.$value;
752 752
                 break;
753 753
             default:
754 754
                 $date_time_format = false;
@@ -771,7 +771,7 @@  discard block
 block discarded – undo
771 771
 
772 772
 
773 773
                 foreach ($error_msg as $error) {
774
-                    $msg .= '<li>' . $error . '</li>';
774
+                    $msg .= '<li>'.$error.'</li>';
775 775
                 }
776 776
 
777 777
                 $msg .= '</ul></p><p>'
@@ -962,7 +962,7 @@  discard block
 block discarded – undo
962 962
     public function displayStateForCriticalPages($post_states, $post)
963 963
     {
964 964
         $post_states = (array) $post_states;
965
-        if (! $post instanceof WP_Post || $post->post_type !== 'page') {
965
+        if ( ! $post instanceof WP_Post || $post->post_type !== 'page') {
966 966
             return $post_states;
967 967
         }
968 968
         /** @var EE_Core_Config $config */
Please login to merge, or discard this patch.