Completed
Branch FET/replace-legacy-request-for... (d46267)
by
unknown
09:47 queued 07:30
created
core/services/assets/Registry.php 2 patches
Indentation   +772 added lines, -772 removed lines patch added patch discarded remove patch
@@ -26,783 +26,783 @@
 block discarded – undo
26 26
 class Registry
27 27
 {
28 28
 
29
-    const FILE_NAME_BUILD_MANIFEST = 'build-manifest.json';
30
-
31
-    /**
32
-     * @var AssetCollection $assets
33
-     */
34
-    protected $assets;
35
-
36
-    /**
37
-     * @var I18nRegistry
38
-     */
39
-    private $i18n_registry;
40
-
41
-    /**
42
-     * This holds the js_data data object that will be exposed on pages that enqueue the `eejs-core` script.
43
-     *
44
-     * @var array
45
-     */
46
-    protected $js_data = [];
47
-
48
-    /**
49
-     * This keeps track of all scripts with registered data.  It is used to prevent duplicate data objects setup in the
50
-     * page source.
51
-     *
52
-     * @var array
53
-     */
54
-    private $script_handles_with_data = [];
55
-
56
-
57
-    /**
58
-     * Holds the manifest data obtained from registered manifest files.
59
-     * Manifests are maps of asset chunk name to actual built asset file names.
60
-     * Shape of this array is:
61
-     * array(
62
-     *  'some_namespace_slug' => array(
63
-     *      'some_chunk_name' => array(
64
-     *          'js' => 'filename.js'
65
-     *          'css' => 'filename.js'
66
-     *      ),
67
-     *      'url_base' => 'https://baseurl.com/to/assets
68
-     *  )
69
-     * )
70
-     *
71
-     * @var array
72
-     */
73
-    private $manifest_data = [];
74
-
75
-
76
-    /**
77
-     * Holds any dependency data obtained from registered dependency map json.
78
-     * Dependency map json is generated via the @wordpress/dependency-extraction-webpack-plugin via the webpack config.
79
-     *
80
-     * @see https://github.com/WordPress/gutenberg/tree/master/packages/dependency-extraction-webpack-plugin
81
-     *
82
-     * @var array
83
-     */
84
-    private $dependencies_data = [];
85
-
86
-
87
-    /**
88
-     * This is a known array of possible wp css handles that correspond to what may be exposed as dependencies in our
89
-     * build process.  Currently the dependency export process in webpack does not consider css imports, so we derive
90
-     * them via the js dependencies (WP uses the same handle for both js and css). This is a list of known handles that
91
-     * are used for both js and css.
92
-     *
93
-     * @var array
94
-     */
95
-    private $wp_css_handle_dependencies = [
96
-        'wp-components',
97
-        'wp-block-editor',
98
-        'wp-block-library',
99
-        'wp-edit-post',
100
-        'wp-edit-widgets',
101
-        'wp-editor',
102
-        'wp-format-library',
103
-        'wp-list-reusable-blocks',
104
-        'wp-nux',
105
-    ];
106
-
107
-
108
-    /**
109
-     * Registry constructor.
110
-     * Hooking into WP actions for script registry.
111
-     *
112
-     * @param AssetCollection $assets
113
-     * @param I18nRegistry    $i18n_registry
114
-     * @throws InvalidArgumentException
115
-     * @throws InvalidDataTypeException
116
-     * @throws InvalidInterfaceException
117
-     */
118
-    public function __construct(AssetCollection $assets, I18nRegistry $i18n_registry)
119
-    {
120
-        $this->assets        = $assets;
121
-        $this->i18n_registry = $i18n_registry;
122
-        add_action('wp_enqueue_scripts', [$this, 'registerManifestFiles'], 1);
123
-        add_action('admin_enqueue_scripts', [$this, 'registerManifestFiles'], 1);
124
-        add_action('wp_enqueue_scripts', [$this, 'registerScriptsAndStyles'], 3);
125
-        add_action('admin_enqueue_scripts', [$this, 'registerScriptsAndStyles'], 3);
126
-        add_action('wp_enqueue_scripts', [$this, 'enqueueData'], 4);
127
-        add_action('admin_enqueue_scripts', [$this, 'enqueueData'], 4);
128
-        add_action('wp_print_footer_scripts', [$this, 'enqueueData'], 1);
129
-        add_action('admin_print_footer_scripts', [$this, 'enqueueData'], 1);
130
-    }
131
-
132
-
133
-    /**
134
-     * For classes that have Registry as a dependency, this provides a handy way to register script handles for i18n
135
-     * translation handling.
136
-     *
137
-     * @return I18nRegistry
138
-     */
139
-    public function getI18nRegistry()
140
-    {
141
-        return $this->i18n_registry;
142
-    }
143
-
144
-
145
-    /**
146
-     * Callback for the wp_enqueue_scripts actions used to register assets.
147
-     *
148
-     * @throws Exception
149
-     * @since 4.9.62.p
150
-     */
151
-    public function registerScriptsAndStyles()
152
-    {
153
-        try {
154
-            $this->registerScripts($this->assets->getJavascriptAssets());
155
-            $this->registerStyles($this->assets->getStylesheetAssets());
156
-        } catch (Exception $exception) {
157
-            new ExceptionStackTraceDisplay($exception);
158
-        }
159
-    }
160
-
161
-
162
-    /**
163
-     * Registers JS assets with WP core
164
-     *
165
-     * @param JavascriptAsset[] $scripts
166
-     * @throws AssetRegistrationException
167
-     * @throws InvalidDataTypeException
168
-     * @throws DomainException
169
-     * @since 4.9.62.p
170
-     */
171
-    public function registerScripts(array $scripts)
172
-    {
173
-        foreach ($scripts as $script) {
174
-            // skip to next script if this has already been done
175
-            if ($script->isRegistered()) {
176
-                continue;
177
-            }
178
-            do_action(
179
-                'AHEE__EventEspresso_core_services_assets_Registry__registerScripts__before_script',
180
-                $script
181
-            );
182
-            $registered = wp_register_script(
183
-                $script->handle(),
184
-                $script->source(),
185
-                $script->dependencies(),
186
-                $script->version(),
187
-                $script->loadInFooter()
188
-            );
189
-            if (! $registered && $this->debug()) {
190
-                throw new AssetRegistrationException($script->handle());
191
-            }
192
-            $script->setRegistered($registered);
193
-            if ($script->requiresTranslation()) {
194
-                $this->registerTranslation($script->handle());
195
-            }
196
-            do_action(
197
-                'AHEE__EventEspresso_core_services_assets_Registry__registerScripts__after_script',
198
-                $script
199
-            );
200
-        }
201
-    }
202
-
203
-
204
-    /**
205
-     * Registers CSS assets with WP core
206
-     *
207
-     * @param StylesheetAsset[] $styles
208
-     * @throws InvalidDataTypeException
209
-     * @throws DomainException
210
-     * @since 4.9.62.p
211
-     */
212
-    public function registerStyles(array $styles)
213
-    {
214
-        foreach ($styles as $style) {
215
-            // skip to next style if this has already been done
216
-            if ($style->isRegistered()) {
217
-                continue;
218
-            }
219
-            do_action(
220
-                'AHEE__EventEspresso_core_services_assets_Registry__registerStyles__before_style',
221
-                $style
222
-            );
223
-            wp_register_style(
224
-                $style->handle(),
225
-                $style->source(),
226
-                $style->dependencies(),
227
-                $style->version(),
228
-                $style->media()
229
-            );
230
-            $style->setRegistered();
231
-            do_action(
232
-                'AHEE__EventEspresso_core_services_assets_Registry__registerStyles__after_style',
233
-                $style
234
-            );
235
-        }
236
-    }
237
-
238
-
239
-    /**
240
-     * Call back for the script print in frontend and backend.
241
-     * Used to call wp_localize_scripts so that data can be added throughout the runtime until this later hook point.
242
-     *
243
-     * @since 4.9.31.rc.015
244
-     */
245
-    public function enqueueData()
246
-    {
247
-        $this->removeAlreadyRegisteredDataForScriptHandles();
248
-        wp_add_inline_script(
249
-            CoreAssetManager::JS_HANDLE_JS_CORE,
250
-            'var eejsdata=' . wp_json_encode(['data' => $this->js_data]),
251
-            'before'
252
-        );
253
-        $scripts = $this->assets->getJavascriptAssetsWithData();
254
-        foreach ($scripts as $script) {
255
-            $this->addRegisteredScriptHandlesWithData($script->handle());
256
-            if ($script->hasInlineDataCallback()) {
257
-                $localize = $script->inlineDataCallback();
258
-                $localize();
259
-            }
260
-        }
261
-    }
262
-
263
-
264
-    /**
265
-     * Used to add data to eejs.data object.
266
-     * Note:  Overriding existing data is not allowed.
267
-     * Data will be accessible as a javascript object when you list `eejs-core` as a dependency for your javascript.
268
-     * If the data you add is something like this:
269
-     *  $this->addData( 'my_plugin_data', array( 'foo' => 'gar' ) );
270
-     * It will be exposed in the page source as:
271
-     *  eejs.data.my_plugin_data.foo == gar
272
-     *
273
-     * @param string       $key   Key used to access your data
274
-     * @param string|array $value Value to attach to key
275
-     * @throws InvalidArgumentException
276
-     */
277
-    public function addData($key, $value)
278
-    {
279
-        if ($this->verifyDataNotExisting($key)) {
280
-            $this->js_data[ $key ] = $value;
281
-        }
282
-    }
283
-
284
-
285
-    /**
286
-     * Similar to addData except this allows for users to push values to an existing key where the values on key are
287
-     * elements in an array.
288
-     *
289
-     * When you use this method, the value you include will be merged with the array on $key.
290
-     * So if the $key was 'test' and you added a value of ['my_data'] then it would be represented in the javascript
291
-     * object like this, eejs.data.test = [ my_data,
292
-     * ]
293
-     * If there has already been a scalar value attached to the data object given key (via addData for instance), then
294
-     * this will throw an exception.
295
-     *
296
-     * Caution: Only add data using this method if you are okay with the potential for additional data added on the same
297
-     * key potentially overriding the existing data on merge (specifically with associative arrays).
298
-     *
299
-     * @param string       $key   Key to attach data to.
300
-     * @param string|array $value Value being registered.
301
-     * @throws InvalidArgumentException
302
-     */
303
-    public function pushData($key, $value)
304
-    {
305
-        if (
306
-            isset($this->js_data[ $key ])
307
-            && ! is_array($this->js_data[ $key ])
308
-        ) {
309
-            if (! $this->debug()) {
310
-                return;
311
-            }
312
-            throw new InvalidArgumentException(
313
-                sprintf(
314
-                    esc_html__(
315
-                        'The value for %1$s is already set and it is not an array. The %2$s method can only be used to
29
+	const FILE_NAME_BUILD_MANIFEST = 'build-manifest.json';
30
+
31
+	/**
32
+	 * @var AssetCollection $assets
33
+	 */
34
+	protected $assets;
35
+
36
+	/**
37
+	 * @var I18nRegistry
38
+	 */
39
+	private $i18n_registry;
40
+
41
+	/**
42
+	 * This holds the js_data data object that will be exposed on pages that enqueue the `eejs-core` script.
43
+	 *
44
+	 * @var array
45
+	 */
46
+	protected $js_data = [];
47
+
48
+	/**
49
+	 * This keeps track of all scripts with registered data.  It is used to prevent duplicate data objects setup in the
50
+	 * page source.
51
+	 *
52
+	 * @var array
53
+	 */
54
+	private $script_handles_with_data = [];
55
+
56
+
57
+	/**
58
+	 * Holds the manifest data obtained from registered manifest files.
59
+	 * Manifests are maps of asset chunk name to actual built asset file names.
60
+	 * Shape of this array is:
61
+	 * array(
62
+	 *  'some_namespace_slug' => array(
63
+	 *      'some_chunk_name' => array(
64
+	 *          'js' => 'filename.js'
65
+	 *          'css' => 'filename.js'
66
+	 *      ),
67
+	 *      'url_base' => 'https://baseurl.com/to/assets
68
+	 *  )
69
+	 * )
70
+	 *
71
+	 * @var array
72
+	 */
73
+	private $manifest_data = [];
74
+
75
+
76
+	/**
77
+	 * Holds any dependency data obtained from registered dependency map json.
78
+	 * Dependency map json is generated via the @wordpress/dependency-extraction-webpack-plugin via the webpack config.
79
+	 *
80
+	 * @see https://github.com/WordPress/gutenberg/tree/master/packages/dependency-extraction-webpack-plugin
81
+	 *
82
+	 * @var array
83
+	 */
84
+	private $dependencies_data = [];
85
+
86
+
87
+	/**
88
+	 * This is a known array of possible wp css handles that correspond to what may be exposed as dependencies in our
89
+	 * build process.  Currently the dependency export process in webpack does not consider css imports, so we derive
90
+	 * them via the js dependencies (WP uses the same handle for both js and css). This is a list of known handles that
91
+	 * are used for both js and css.
92
+	 *
93
+	 * @var array
94
+	 */
95
+	private $wp_css_handle_dependencies = [
96
+		'wp-components',
97
+		'wp-block-editor',
98
+		'wp-block-library',
99
+		'wp-edit-post',
100
+		'wp-edit-widgets',
101
+		'wp-editor',
102
+		'wp-format-library',
103
+		'wp-list-reusable-blocks',
104
+		'wp-nux',
105
+	];
106
+
107
+
108
+	/**
109
+	 * Registry constructor.
110
+	 * Hooking into WP actions for script registry.
111
+	 *
112
+	 * @param AssetCollection $assets
113
+	 * @param I18nRegistry    $i18n_registry
114
+	 * @throws InvalidArgumentException
115
+	 * @throws InvalidDataTypeException
116
+	 * @throws InvalidInterfaceException
117
+	 */
118
+	public function __construct(AssetCollection $assets, I18nRegistry $i18n_registry)
119
+	{
120
+		$this->assets        = $assets;
121
+		$this->i18n_registry = $i18n_registry;
122
+		add_action('wp_enqueue_scripts', [$this, 'registerManifestFiles'], 1);
123
+		add_action('admin_enqueue_scripts', [$this, 'registerManifestFiles'], 1);
124
+		add_action('wp_enqueue_scripts', [$this, 'registerScriptsAndStyles'], 3);
125
+		add_action('admin_enqueue_scripts', [$this, 'registerScriptsAndStyles'], 3);
126
+		add_action('wp_enqueue_scripts', [$this, 'enqueueData'], 4);
127
+		add_action('admin_enqueue_scripts', [$this, 'enqueueData'], 4);
128
+		add_action('wp_print_footer_scripts', [$this, 'enqueueData'], 1);
129
+		add_action('admin_print_footer_scripts', [$this, 'enqueueData'], 1);
130
+	}
131
+
132
+
133
+	/**
134
+	 * For classes that have Registry as a dependency, this provides a handy way to register script handles for i18n
135
+	 * translation handling.
136
+	 *
137
+	 * @return I18nRegistry
138
+	 */
139
+	public function getI18nRegistry()
140
+	{
141
+		return $this->i18n_registry;
142
+	}
143
+
144
+
145
+	/**
146
+	 * Callback for the wp_enqueue_scripts actions used to register assets.
147
+	 *
148
+	 * @throws Exception
149
+	 * @since 4.9.62.p
150
+	 */
151
+	public function registerScriptsAndStyles()
152
+	{
153
+		try {
154
+			$this->registerScripts($this->assets->getJavascriptAssets());
155
+			$this->registerStyles($this->assets->getStylesheetAssets());
156
+		} catch (Exception $exception) {
157
+			new ExceptionStackTraceDisplay($exception);
158
+		}
159
+	}
160
+
161
+
162
+	/**
163
+	 * Registers JS assets with WP core
164
+	 *
165
+	 * @param JavascriptAsset[] $scripts
166
+	 * @throws AssetRegistrationException
167
+	 * @throws InvalidDataTypeException
168
+	 * @throws DomainException
169
+	 * @since 4.9.62.p
170
+	 */
171
+	public function registerScripts(array $scripts)
172
+	{
173
+		foreach ($scripts as $script) {
174
+			// skip to next script if this has already been done
175
+			if ($script->isRegistered()) {
176
+				continue;
177
+			}
178
+			do_action(
179
+				'AHEE__EventEspresso_core_services_assets_Registry__registerScripts__before_script',
180
+				$script
181
+			);
182
+			$registered = wp_register_script(
183
+				$script->handle(),
184
+				$script->source(),
185
+				$script->dependencies(),
186
+				$script->version(),
187
+				$script->loadInFooter()
188
+			);
189
+			if (! $registered && $this->debug()) {
190
+				throw new AssetRegistrationException($script->handle());
191
+			}
192
+			$script->setRegistered($registered);
193
+			if ($script->requiresTranslation()) {
194
+				$this->registerTranslation($script->handle());
195
+			}
196
+			do_action(
197
+				'AHEE__EventEspresso_core_services_assets_Registry__registerScripts__after_script',
198
+				$script
199
+			);
200
+		}
201
+	}
202
+
203
+
204
+	/**
205
+	 * Registers CSS assets with WP core
206
+	 *
207
+	 * @param StylesheetAsset[] $styles
208
+	 * @throws InvalidDataTypeException
209
+	 * @throws DomainException
210
+	 * @since 4.9.62.p
211
+	 */
212
+	public function registerStyles(array $styles)
213
+	{
214
+		foreach ($styles as $style) {
215
+			// skip to next style if this has already been done
216
+			if ($style->isRegistered()) {
217
+				continue;
218
+			}
219
+			do_action(
220
+				'AHEE__EventEspresso_core_services_assets_Registry__registerStyles__before_style',
221
+				$style
222
+			);
223
+			wp_register_style(
224
+				$style->handle(),
225
+				$style->source(),
226
+				$style->dependencies(),
227
+				$style->version(),
228
+				$style->media()
229
+			);
230
+			$style->setRegistered();
231
+			do_action(
232
+				'AHEE__EventEspresso_core_services_assets_Registry__registerStyles__after_style',
233
+				$style
234
+			);
235
+		}
236
+	}
237
+
238
+
239
+	/**
240
+	 * Call back for the script print in frontend and backend.
241
+	 * Used to call wp_localize_scripts so that data can be added throughout the runtime until this later hook point.
242
+	 *
243
+	 * @since 4.9.31.rc.015
244
+	 */
245
+	public function enqueueData()
246
+	{
247
+		$this->removeAlreadyRegisteredDataForScriptHandles();
248
+		wp_add_inline_script(
249
+			CoreAssetManager::JS_HANDLE_JS_CORE,
250
+			'var eejsdata=' . wp_json_encode(['data' => $this->js_data]),
251
+			'before'
252
+		);
253
+		$scripts = $this->assets->getJavascriptAssetsWithData();
254
+		foreach ($scripts as $script) {
255
+			$this->addRegisteredScriptHandlesWithData($script->handle());
256
+			if ($script->hasInlineDataCallback()) {
257
+				$localize = $script->inlineDataCallback();
258
+				$localize();
259
+			}
260
+		}
261
+	}
262
+
263
+
264
+	/**
265
+	 * Used to add data to eejs.data object.
266
+	 * Note:  Overriding existing data is not allowed.
267
+	 * Data will be accessible as a javascript object when you list `eejs-core` as a dependency for your javascript.
268
+	 * If the data you add is something like this:
269
+	 *  $this->addData( 'my_plugin_data', array( 'foo' => 'gar' ) );
270
+	 * It will be exposed in the page source as:
271
+	 *  eejs.data.my_plugin_data.foo == gar
272
+	 *
273
+	 * @param string       $key   Key used to access your data
274
+	 * @param string|array $value Value to attach to key
275
+	 * @throws InvalidArgumentException
276
+	 */
277
+	public function addData($key, $value)
278
+	{
279
+		if ($this->verifyDataNotExisting($key)) {
280
+			$this->js_data[ $key ] = $value;
281
+		}
282
+	}
283
+
284
+
285
+	/**
286
+	 * Similar to addData except this allows for users to push values to an existing key where the values on key are
287
+	 * elements in an array.
288
+	 *
289
+	 * When you use this method, the value you include will be merged with the array on $key.
290
+	 * So if the $key was 'test' and you added a value of ['my_data'] then it would be represented in the javascript
291
+	 * object like this, eejs.data.test = [ my_data,
292
+	 * ]
293
+	 * If there has already been a scalar value attached to the data object given key (via addData for instance), then
294
+	 * this will throw an exception.
295
+	 *
296
+	 * Caution: Only add data using this method if you are okay with the potential for additional data added on the same
297
+	 * key potentially overriding the existing data on merge (specifically with associative arrays).
298
+	 *
299
+	 * @param string       $key   Key to attach data to.
300
+	 * @param string|array $value Value being registered.
301
+	 * @throws InvalidArgumentException
302
+	 */
303
+	public function pushData($key, $value)
304
+	{
305
+		if (
306
+			isset($this->js_data[ $key ])
307
+			&& ! is_array($this->js_data[ $key ])
308
+		) {
309
+			if (! $this->debug()) {
310
+				return;
311
+			}
312
+			throw new InvalidArgumentException(
313
+				sprintf(
314
+					esc_html__(
315
+						'The value for %1$s is already set and it is not an array. The %2$s method can only be used to
316 316
                          push values to this data element when it is an array.',
317
-                        'event_espresso'
318
-                    ),
319
-                    $key,
320
-                    __METHOD__
321
-                )
322
-            );
323
-        }
324
-        if (! isset($this->js_data[ $key ])) {
325
-            $this->js_data[ $key ] = is_array($value) ? $value : [$value];
326
-        } else {
327
-            $this->js_data[ $key ] = array_merge($this->js_data[ $key ], (array) $value);
328
-        }
329
-    }
330
-
331
-
332
-    /**
333
-     * Used to set content used by javascript for a template.
334
-     * Note: Overrides of existing registered templates are not allowed.
335
-     *
336
-     * @param string $template_reference
337
-     * @param string $template_content
338
-     * @throws InvalidArgumentException
339
-     */
340
-    public function addTemplate($template_reference, $template_content)
341
-    {
342
-        if (! isset($this->js_data['templates'])) {
343
-            $this->js_data['templates'] = [];
344
-        }
345
-        //no overrides allowed.
346
-        if (isset($this->js_data['templates'][ $template_reference ])) {
347
-            if (! $this->debug()) {
348
-                return;
349
-            }
350
-            throw new InvalidArgumentException(
351
-                sprintf(
352
-                    esc_html__(
353
-                        'The %1$s key already exists for the templates array in the js data array.  No overrides are allowed.',
354
-                        'event_espresso'
355
-                    ),
356
-                    $template_reference
357
-                )
358
-            );
359
-        }
360
-        $this->js_data['templates'][ $template_reference ] = $template_content;
361
-    }
362
-
363
-
364
-    /**
365
-     * Retrieve the template content already registered for the given reference.
366
-     *
367
-     * @param string $template_reference
368
-     * @return string
369
-     */
370
-    public function getTemplate($template_reference)
371
-    {
372
-        return isset($this->js_data['templates'][ $template_reference ])
373
-            ? $this->js_data['templates'][ $template_reference ]
374
-            : '';
375
-    }
376
-
377
-
378
-    /**
379
-     * Retrieve registered data.
380
-     *
381
-     * @param string $key Name of key to attach data to.
382
-     * @return mixed                If there is no for the given key, then false is returned.
383
-     */
384
-    public function getData($key)
385
-    {
386
-        return array_key_exists($key, $this->js_data) ? $this->js_data[ $key ] : null;
387
-    }
388
-
389
-
390
-    /**
391
-     * Verifies whether the given data exists already on the js_data array.
392
-     * Overriding data is not allowed.
393
-     *
394
-     * @param string $key Index for data.
395
-     * @return bool        If valid then return true.
396
-     * @throws InvalidArgumentException if data already exists.
397
-     */
398
-    protected function verifyDataNotExisting($key)
399
-    {
400
-        if (isset($this->js_data[ $key ])) {
401
-            if (! $this->debug()) {
402
-                return false;
403
-            }
404
-            if (is_array($this->js_data[ $key ])) {
405
-                throw new InvalidArgumentException(
406
-                    sprintf(
407
-                        esc_html__(
408
-                            'The value for %1$s already exists in the Registry::eejs object.
317
+						'event_espresso'
318
+					),
319
+					$key,
320
+					__METHOD__
321
+				)
322
+			);
323
+		}
324
+		if (! isset($this->js_data[ $key ])) {
325
+			$this->js_data[ $key ] = is_array($value) ? $value : [$value];
326
+		} else {
327
+			$this->js_data[ $key ] = array_merge($this->js_data[ $key ], (array) $value);
328
+		}
329
+	}
330
+
331
+
332
+	/**
333
+	 * Used to set content used by javascript for a template.
334
+	 * Note: Overrides of existing registered templates are not allowed.
335
+	 *
336
+	 * @param string $template_reference
337
+	 * @param string $template_content
338
+	 * @throws InvalidArgumentException
339
+	 */
340
+	public function addTemplate($template_reference, $template_content)
341
+	{
342
+		if (! isset($this->js_data['templates'])) {
343
+			$this->js_data['templates'] = [];
344
+		}
345
+		//no overrides allowed.
346
+		if (isset($this->js_data['templates'][ $template_reference ])) {
347
+			if (! $this->debug()) {
348
+				return;
349
+			}
350
+			throw new InvalidArgumentException(
351
+				sprintf(
352
+					esc_html__(
353
+						'The %1$s key already exists for the templates array in the js data array.  No overrides are allowed.',
354
+						'event_espresso'
355
+					),
356
+					$template_reference
357
+				)
358
+			);
359
+		}
360
+		$this->js_data['templates'][ $template_reference ] = $template_content;
361
+	}
362
+
363
+
364
+	/**
365
+	 * Retrieve the template content already registered for the given reference.
366
+	 *
367
+	 * @param string $template_reference
368
+	 * @return string
369
+	 */
370
+	public function getTemplate($template_reference)
371
+	{
372
+		return isset($this->js_data['templates'][ $template_reference ])
373
+			? $this->js_data['templates'][ $template_reference ]
374
+			: '';
375
+	}
376
+
377
+
378
+	/**
379
+	 * Retrieve registered data.
380
+	 *
381
+	 * @param string $key Name of key to attach data to.
382
+	 * @return mixed                If there is no for the given key, then false is returned.
383
+	 */
384
+	public function getData($key)
385
+	{
386
+		return array_key_exists($key, $this->js_data) ? $this->js_data[ $key ] : null;
387
+	}
388
+
389
+
390
+	/**
391
+	 * Verifies whether the given data exists already on the js_data array.
392
+	 * Overriding data is not allowed.
393
+	 *
394
+	 * @param string $key Index for data.
395
+	 * @return bool        If valid then return true.
396
+	 * @throws InvalidArgumentException if data already exists.
397
+	 */
398
+	protected function verifyDataNotExisting($key)
399
+	{
400
+		if (isset($this->js_data[ $key ])) {
401
+			if (! $this->debug()) {
402
+				return false;
403
+			}
404
+			if (is_array($this->js_data[ $key ])) {
405
+				throw new InvalidArgumentException(
406
+					sprintf(
407
+						esc_html__(
408
+							'The value for %1$s already exists in the Registry::eejs object.
409 409
                             Overrides are not allowed. Since the value of this data is an array, you may want to use the
410 410
                             %2$s method to push your value to the array.',
411
-                            'event_espresso'
412
-                        ),
413
-                        $key,
414
-                        'pushData()'
415
-                    )
416
-                );
417
-            }
418
-            throw new InvalidArgumentException(
419
-                sprintf(
420
-                    esc_html__(
421
-                        'The value for %1$s already exists in the Registry::eejs object. Overrides are not
411
+							'event_espresso'
412
+						),
413
+						$key,
414
+						'pushData()'
415
+					)
416
+				);
417
+			}
418
+			throw new InvalidArgumentException(
419
+				sprintf(
420
+					esc_html__(
421
+						'The value for %1$s already exists in the Registry::eejs object. Overrides are not
422 422
                         allowed.  Consider attaching your value to a different key',
423
-                        'event_espresso'
424
-                    ),
425
-                    $key
426
-                )
427
-            );
428
-        }
429
-        return true;
430
-    }
431
-
432
-
433
-    /**
434
-     * Get the actual asset path for asset manifests.
435
-     * If there is no asset path found for the given $chunk_name, then the $chunk_name is returned.
436
-     *
437
-     * @param string $namespace  The namespace associated with the manifest file hosting the map of chunk_name to actual
438
-     *                           asset file location.
439
-     * @param string $chunk_name
440
-     * @param string $asset_type
441
-     * @return string
442
-     * @since 4.9.59.p
443
-     */
444
-    public function getAssetUrl($namespace, $chunk_name, $asset_type)
445
-    {
446
-        $url = isset(
447
-            $this->manifest_data[ $namespace ][ $chunk_name . '.' . $asset_type ],
448
-            $this->manifest_data[ $namespace ]['url_base']
449
-        )
450
-            ? $this->manifest_data[ $namespace ]['url_base']
451
-              . $this->manifest_data[ $namespace ][ $chunk_name . '.' . $asset_type ]
452
-            : $chunk_name;
453
-
454
-        return apply_filters(
455
-            'FHEE__EventEspresso_core_services_assets_Registry__getAssetUrl',
456
-            $url,
457
-            $namespace,
458
-            $chunk_name,
459
-            $asset_type
460
-        );
461
-    }
462
-
463
-
464
-    /**
465
-     * Return the url to a js file for the given namespace and chunk name.
466
-     *
467
-     * @param string $namespace
468
-     * @param string $chunk_name
469
-     * @return string
470
-     */
471
-    public function getJsUrl($namespace, $chunk_name)
472
-    {
473
-        return $this->getAssetUrl($namespace, $chunk_name, Asset::TYPE_JS);
474
-    }
475
-
476
-
477
-    /**
478
-     * Return the url to a css file for the given namespace and chunk name.
479
-     *
480
-     * @param string $namespace
481
-     * @param string $chunk_name
482
-     * @return string
483
-     */
484
-    public function getCssUrl($namespace, $chunk_name)
485
-    {
486
-        return $this->getAssetUrl($namespace, $chunk_name, Asset::TYPE_CSS);
487
-    }
488
-
489
-
490
-    /**
491
-     * Return the dependencies array and version string for a given asset $chunk_name
492
-     *
493
-     * @param string $namespace
494
-     * @param string $chunk_name
495
-     * @param string $asset_type
496
-     * @return array
497
-     * @since 4.9.82.p
498
-     */
499
-    private function getDetailsForAsset($namespace, $chunk_name, $asset_type)
500
-    {
501
-        $asset_index = $chunk_name . '.' . $asset_type;
502
-        if (! isset($this->dependencies_data[ $namespace ][ $asset_index ])) {
503
-            $path = isset($this->manifest_data[ $namespace ]['path'])
504
-                ? $this->manifest_data[ $namespace ]['path']
505
-                : '';
506
-            $dependencies_index = $chunk_name . Asset::EXT_PHP;
507
-            $file_path = isset($this->manifest_data[ $namespace ][ $dependencies_index ])
508
-                ? $path . $this->manifest_data[ $namespace ][ $dependencies_index ]
509
-                : '';
510
-            // if file path exists then get the asset details
511
-            $this->dependencies_data[ $namespace ][ $asset_index ] = $file_path !== '' && file_exists($file_path)
512
-                ? $this->getDetailsForAssetType($namespace, $asset_type, $file_path, $chunk_name)
513
-                : [];
514
-        }
515
-        return $this->dependencies_data[ $namespace ][ $asset_index ];
516
-    }
517
-
518
-
519
-    /**
520
-     * Return dependencies array and version string according to asset type.
521
-     * For css assets, this filters the auto generated dependencies by css type.
522
-     *
523
-     * @param string $namespace
524
-     * @param string $asset_type
525
-     * @param string $file_path
526
-     * @param string $chunk_name
527
-     * @return array
528
-     * @since 4.9.82.p
529
-     */
530
-    private function getDetailsForAssetType($namespace, $asset_type, $file_path, $chunk_name)
531
-    {
532
-        // $asset_dependencies = json_decode(file_get_contents($file_path), true);
533
-        $asset_details                 = require($file_path);
534
-        $asset_details['dependencies'] = isset($asset_details['dependencies'])
535
-            ? $asset_details['dependencies']
536
-            : [];
537
-        $asset_details['version']      = isset($asset_details['version'])
538
-            ? $asset_details['version']
539
-            : '';
540
-        if ($asset_type === Asset::TYPE_JS) {
541
-            $asset_details['dependencies'] = $chunk_name === CoreAssetManager::JS_HANDLE_JS_CORE
542
-                ? $asset_details['dependencies']
543
-                : $asset_details['dependencies'] + [CoreAssetManager::JS_HANDLE_JS_CORE];
544
-            return $asset_details;
545
-        }
546
-        // for css we need to make sure there is actually a css file related to this chunk.
547
-        if (isset($this->manifest_data[ $namespace ])) {
548
-            // array of css chunk files for ee.
549
-            $css_chunks = array_map(
550
-                static function ($value) {
551
-                    return str_replace(Asset::EXT_CSS, '', $value);
552
-                },
553
-                array_filter(
554
-                    array_keys($this->manifest_data[ $namespace ]),
555
-                    static function ($value) {
556
-                        return strpos($value, Asset::EXT_CSS) !== false;
557
-                    }
558
-                )
559
-            );
560
-            // add known wp chunks with css
561
-            $css_chunks = array_merge($css_chunks, $this->wp_css_handle_dependencies);
562
-            // flip for easier search
563
-            $css_chunks = array_flip($css_chunks);
564
-            // now let's filter the dependencies for the incoming chunk to actual chunks that have styles
565
-            $asset_details['dependencies'] = array_filter(
566
-                $asset_details['dependencies'],
567
-                static function ($chunk_name) use ($css_chunks) {
568
-                    return isset($css_chunks[ $chunk_name ]);
569
-                }
570
-            );
571
-            return $asset_details;
572
-        }
573
-        return ['dependencies' => [], 'version' => ''];
574
-    }
575
-
576
-
577
-    /**
578
-     * Get the dependencies array and version string for the given js asset chunk name
579
-     *
580
-     * @param string $namespace
581
-     * @param string $chunk_name
582
-     * @return array
583
-     * @since 4.10.2.p
584
-     */
585
-    public function getJsAssetDetails($namespace, $chunk_name)
586
-    {
587
-        return $this->getDetailsForAsset($namespace, $chunk_name, Asset::TYPE_JS);
588
-    }
589
-
590
-
591
-    /**
592
-     * Get the dependencies array and version string for the given css asset chunk name
593
-     *
594
-     * @param string $namespace
595
-     * @param string $chunk_name
596
-     * @return array
597
-     * @since 4.10.2.p
598
-     */
599
-    public function getCssAssetDetails($namespace, $chunk_name)
600
-    {
601
-        return $this->getDetailsForAsset($namespace, $chunk_name, Asset::TYPE_CSS);
602
-    }
603
-
604
-
605
-    /**
606
-     * @throws InvalidArgumentException
607
-     * @throws InvalidFilePathException
608
-     * @since 4.9.62.p
609
-     */
610
-    public function registerManifestFiles()
611
-    {
612
-        $manifest_files = $this->assets->getManifestFiles();
613
-        foreach ($manifest_files as $manifest_file) {
614
-            $this->registerManifestFile(
615
-                $manifest_file->assetNamespace(),
616
-                $manifest_file->urlBase(),
617
-                $manifest_file->filepath() . Registry::FILE_NAME_BUILD_MANIFEST,
618
-                $manifest_file->filepath()
619
-            );
620
-        }
621
-    }
622
-
623
-
624
-    /**
625
-     * Used to register a js/css manifest file with the registered_manifest_files property.
626
-     *
627
-     * @param string $namespace           Provided to associate the manifest file with a specific namespace.
628
-     * @param string $url_base            The url base for the manifest file location.
629
-     * @param string $manifest_file       The absolute path to the manifest file.
630
-     * @param string $manifest_file_path  The path to the folder containing the manifest file. If not provided will be
631
-     *                                    default to `plugin_root/assets/dist`.
632
-     * @throws InvalidArgumentException
633
-     * @throws InvalidFilePathException
634
-     * @since 4.9.59.p
635
-     */
636
-    public function registerManifestFile($namespace, $url_base, $manifest_file, $manifest_file_path = '')
637
-    {
638
-        if (isset($this->manifest_data[ $namespace ])) {
639
-            if (! $this->debug()) {
640
-                return;
641
-            }
642
-            throw new InvalidArgumentException(
643
-                sprintf(
644
-                    esc_html__(
645
-                        'The namespace for this manifest file has already been registered, choose a namespace other than %s',
646
-                        'event_espresso'
647
-                    ),
648
-                    $namespace
649
-                )
650
-            );
651
-        }
652
-        if (filter_var($url_base, FILTER_VALIDATE_URL) === false) {
653
-            if (is_admin()) {
654
-                EE_Error::add_error(
655
-                    sprintf(
656
-                        esc_html__(
657
-                            'The url given for %1$s assets is invalid.  The url provided was: "%2$s". This usually happens when another plugin or theme on a site is using the "%3$s" filter or has an invalid url set for the "%4$s" constant',
658
-                            'event_espresso'
659
-                        ),
660
-                        'Event Espresso',
661
-                        $url_base,
662
-                        'plugins_url',
663
-                        'WP_PLUGIN_URL'
664
-                    ),
665
-                    __FILE__,
666
-                    __FUNCTION__,
667
-                    __LINE__
668
-                );
669
-            }
670
-            return;
671
-        }
672
-        $this->manifest_data[ $namespace ] = $this->decodeManifestFile($manifest_file);
673
-        if (! isset($this->manifest_data[ $namespace ]['url_base'])) {
674
-            $this->manifest_data[ $namespace ]['url_base'] = trailingslashit($url_base);
675
-        }
676
-        if (! isset($this->manifest_data[ $namespace ]['path'])) {
677
-            $this->manifest_data[ $namespace ]['path'] = $manifest_file_path;
678
-        }
679
-    }
680
-
681
-
682
-    /**
683
-     * Decodes json from the provided manifest file.
684
-     *
685
-     * @param string $manifest_file Path to manifest file.
686
-     * @return array
687
-     * @throws InvalidFilePathException
688
-     * @since 4.9.59.p
689
-     */
690
-    private function decodeManifestFile($manifest_file)
691
-    {
692
-        if (! file_exists($manifest_file)) {
693
-            throw new InvalidFilePathException($manifest_file);
694
-        }
695
-        return json_decode(file_get_contents($manifest_file), true);
696
-    }
697
-
698
-
699
-    /**
700
-     * This is used to set registered script handles that have data.
701
-     *
702
-     * @param string $script_handle
703
-     */
704
-    private function addRegisteredScriptHandlesWithData($script_handle)
705
-    {
706
-        $this->script_handles_with_data[ $script_handle ] = $script_handle;
707
-    }
708
-
709
-
710
-    /**i
423
+						'event_espresso'
424
+					),
425
+					$key
426
+				)
427
+			);
428
+		}
429
+		return true;
430
+	}
431
+
432
+
433
+	/**
434
+	 * Get the actual asset path for asset manifests.
435
+	 * If there is no asset path found for the given $chunk_name, then the $chunk_name is returned.
436
+	 *
437
+	 * @param string $namespace  The namespace associated with the manifest file hosting the map of chunk_name to actual
438
+	 *                           asset file location.
439
+	 * @param string $chunk_name
440
+	 * @param string $asset_type
441
+	 * @return string
442
+	 * @since 4.9.59.p
443
+	 */
444
+	public function getAssetUrl($namespace, $chunk_name, $asset_type)
445
+	{
446
+		$url = isset(
447
+			$this->manifest_data[ $namespace ][ $chunk_name . '.' . $asset_type ],
448
+			$this->manifest_data[ $namespace ]['url_base']
449
+		)
450
+			? $this->manifest_data[ $namespace ]['url_base']
451
+			  . $this->manifest_data[ $namespace ][ $chunk_name . '.' . $asset_type ]
452
+			: $chunk_name;
453
+
454
+		return apply_filters(
455
+			'FHEE__EventEspresso_core_services_assets_Registry__getAssetUrl',
456
+			$url,
457
+			$namespace,
458
+			$chunk_name,
459
+			$asset_type
460
+		);
461
+	}
462
+
463
+
464
+	/**
465
+	 * Return the url to a js file for the given namespace and chunk name.
466
+	 *
467
+	 * @param string $namespace
468
+	 * @param string $chunk_name
469
+	 * @return string
470
+	 */
471
+	public function getJsUrl($namespace, $chunk_name)
472
+	{
473
+		return $this->getAssetUrl($namespace, $chunk_name, Asset::TYPE_JS);
474
+	}
475
+
476
+
477
+	/**
478
+	 * Return the url to a css file for the given namespace and chunk name.
479
+	 *
480
+	 * @param string $namespace
481
+	 * @param string $chunk_name
482
+	 * @return string
483
+	 */
484
+	public function getCssUrl($namespace, $chunk_name)
485
+	{
486
+		return $this->getAssetUrl($namespace, $chunk_name, Asset::TYPE_CSS);
487
+	}
488
+
489
+
490
+	/**
491
+	 * Return the dependencies array and version string for a given asset $chunk_name
492
+	 *
493
+	 * @param string $namespace
494
+	 * @param string $chunk_name
495
+	 * @param string $asset_type
496
+	 * @return array
497
+	 * @since 4.9.82.p
498
+	 */
499
+	private function getDetailsForAsset($namespace, $chunk_name, $asset_type)
500
+	{
501
+		$asset_index = $chunk_name . '.' . $asset_type;
502
+		if (! isset($this->dependencies_data[ $namespace ][ $asset_index ])) {
503
+			$path = isset($this->manifest_data[ $namespace ]['path'])
504
+				? $this->manifest_data[ $namespace ]['path']
505
+				: '';
506
+			$dependencies_index = $chunk_name . Asset::EXT_PHP;
507
+			$file_path = isset($this->manifest_data[ $namespace ][ $dependencies_index ])
508
+				? $path . $this->manifest_data[ $namespace ][ $dependencies_index ]
509
+				: '';
510
+			// if file path exists then get the asset details
511
+			$this->dependencies_data[ $namespace ][ $asset_index ] = $file_path !== '' && file_exists($file_path)
512
+				? $this->getDetailsForAssetType($namespace, $asset_type, $file_path, $chunk_name)
513
+				: [];
514
+		}
515
+		return $this->dependencies_data[ $namespace ][ $asset_index ];
516
+	}
517
+
518
+
519
+	/**
520
+	 * Return dependencies array and version string according to asset type.
521
+	 * For css assets, this filters the auto generated dependencies by css type.
522
+	 *
523
+	 * @param string $namespace
524
+	 * @param string $asset_type
525
+	 * @param string $file_path
526
+	 * @param string $chunk_name
527
+	 * @return array
528
+	 * @since 4.9.82.p
529
+	 */
530
+	private function getDetailsForAssetType($namespace, $asset_type, $file_path, $chunk_name)
531
+	{
532
+		// $asset_dependencies = json_decode(file_get_contents($file_path), true);
533
+		$asset_details                 = require($file_path);
534
+		$asset_details['dependencies'] = isset($asset_details['dependencies'])
535
+			? $asset_details['dependencies']
536
+			: [];
537
+		$asset_details['version']      = isset($asset_details['version'])
538
+			? $asset_details['version']
539
+			: '';
540
+		if ($asset_type === Asset::TYPE_JS) {
541
+			$asset_details['dependencies'] = $chunk_name === CoreAssetManager::JS_HANDLE_JS_CORE
542
+				? $asset_details['dependencies']
543
+				: $asset_details['dependencies'] + [CoreAssetManager::JS_HANDLE_JS_CORE];
544
+			return $asset_details;
545
+		}
546
+		// for css we need to make sure there is actually a css file related to this chunk.
547
+		if (isset($this->manifest_data[ $namespace ])) {
548
+			// array of css chunk files for ee.
549
+			$css_chunks = array_map(
550
+				static function ($value) {
551
+					return str_replace(Asset::EXT_CSS, '', $value);
552
+				},
553
+				array_filter(
554
+					array_keys($this->manifest_data[ $namespace ]),
555
+					static function ($value) {
556
+						return strpos($value, Asset::EXT_CSS) !== false;
557
+					}
558
+				)
559
+			);
560
+			// add known wp chunks with css
561
+			$css_chunks = array_merge($css_chunks, $this->wp_css_handle_dependencies);
562
+			// flip for easier search
563
+			$css_chunks = array_flip($css_chunks);
564
+			// now let's filter the dependencies for the incoming chunk to actual chunks that have styles
565
+			$asset_details['dependencies'] = array_filter(
566
+				$asset_details['dependencies'],
567
+				static function ($chunk_name) use ($css_chunks) {
568
+					return isset($css_chunks[ $chunk_name ]);
569
+				}
570
+			);
571
+			return $asset_details;
572
+		}
573
+		return ['dependencies' => [], 'version' => ''];
574
+	}
575
+
576
+
577
+	/**
578
+	 * Get the dependencies array and version string for the given js asset chunk name
579
+	 *
580
+	 * @param string $namespace
581
+	 * @param string $chunk_name
582
+	 * @return array
583
+	 * @since 4.10.2.p
584
+	 */
585
+	public function getJsAssetDetails($namespace, $chunk_name)
586
+	{
587
+		return $this->getDetailsForAsset($namespace, $chunk_name, Asset::TYPE_JS);
588
+	}
589
+
590
+
591
+	/**
592
+	 * Get the dependencies array and version string for the given css asset chunk name
593
+	 *
594
+	 * @param string $namespace
595
+	 * @param string $chunk_name
596
+	 * @return array
597
+	 * @since 4.10.2.p
598
+	 */
599
+	public function getCssAssetDetails($namespace, $chunk_name)
600
+	{
601
+		return $this->getDetailsForAsset($namespace, $chunk_name, Asset::TYPE_CSS);
602
+	}
603
+
604
+
605
+	/**
606
+	 * @throws InvalidArgumentException
607
+	 * @throws InvalidFilePathException
608
+	 * @since 4.9.62.p
609
+	 */
610
+	public function registerManifestFiles()
611
+	{
612
+		$manifest_files = $this->assets->getManifestFiles();
613
+		foreach ($manifest_files as $manifest_file) {
614
+			$this->registerManifestFile(
615
+				$manifest_file->assetNamespace(),
616
+				$manifest_file->urlBase(),
617
+				$manifest_file->filepath() . Registry::FILE_NAME_BUILD_MANIFEST,
618
+				$manifest_file->filepath()
619
+			);
620
+		}
621
+	}
622
+
623
+
624
+	/**
625
+	 * Used to register a js/css manifest file with the registered_manifest_files property.
626
+	 *
627
+	 * @param string $namespace           Provided to associate the manifest file with a specific namespace.
628
+	 * @param string $url_base            The url base for the manifest file location.
629
+	 * @param string $manifest_file       The absolute path to the manifest file.
630
+	 * @param string $manifest_file_path  The path to the folder containing the manifest file. If not provided will be
631
+	 *                                    default to `plugin_root/assets/dist`.
632
+	 * @throws InvalidArgumentException
633
+	 * @throws InvalidFilePathException
634
+	 * @since 4.9.59.p
635
+	 */
636
+	public function registerManifestFile($namespace, $url_base, $manifest_file, $manifest_file_path = '')
637
+	{
638
+		if (isset($this->manifest_data[ $namespace ])) {
639
+			if (! $this->debug()) {
640
+				return;
641
+			}
642
+			throw new InvalidArgumentException(
643
+				sprintf(
644
+					esc_html__(
645
+						'The namespace for this manifest file has already been registered, choose a namespace other than %s',
646
+						'event_espresso'
647
+					),
648
+					$namespace
649
+				)
650
+			);
651
+		}
652
+		if (filter_var($url_base, FILTER_VALIDATE_URL) === false) {
653
+			if (is_admin()) {
654
+				EE_Error::add_error(
655
+					sprintf(
656
+						esc_html__(
657
+							'The url given for %1$s assets is invalid.  The url provided was: "%2$s". This usually happens when another plugin or theme on a site is using the "%3$s" filter or has an invalid url set for the "%4$s" constant',
658
+							'event_espresso'
659
+						),
660
+						'Event Espresso',
661
+						$url_base,
662
+						'plugins_url',
663
+						'WP_PLUGIN_URL'
664
+					),
665
+					__FILE__,
666
+					__FUNCTION__,
667
+					__LINE__
668
+				);
669
+			}
670
+			return;
671
+		}
672
+		$this->manifest_data[ $namespace ] = $this->decodeManifestFile($manifest_file);
673
+		if (! isset($this->manifest_data[ $namespace ]['url_base'])) {
674
+			$this->manifest_data[ $namespace ]['url_base'] = trailingslashit($url_base);
675
+		}
676
+		if (! isset($this->manifest_data[ $namespace ]['path'])) {
677
+			$this->manifest_data[ $namespace ]['path'] = $manifest_file_path;
678
+		}
679
+	}
680
+
681
+
682
+	/**
683
+	 * Decodes json from the provided manifest file.
684
+	 *
685
+	 * @param string $manifest_file Path to manifest file.
686
+	 * @return array
687
+	 * @throws InvalidFilePathException
688
+	 * @since 4.9.59.p
689
+	 */
690
+	private function decodeManifestFile($manifest_file)
691
+	{
692
+		if (! file_exists($manifest_file)) {
693
+			throw new InvalidFilePathException($manifest_file);
694
+		}
695
+		return json_decode(file_get_contents($manifest_file), true);
696
+	}
697
+
698
+
699
+	/**
700
+	 * This is used to set registered script handles that have data.
701
+	 *
702
+	 * @param string $script_handle
703
+	 */
704
+	private function addRegisteredScriptHandlesWithData($script_handle)
705
+	{
706
+		$this->script_handles_with_data[ $script_handle ] = $script_handle;
707
+	}
708
+
709
+
710
+	/**i
711 711
      * Checks WP_Scripts for all of each script handle registered internally as having data and unsets from the
712 712
      * Dependency stored in WP_Scripts if its set.
713 713
      */
714
-    private function removeAlreadyRegisteredDataForScriptHandles()
715
-    {
716
-        if (empty($this->script_handles_with_data)) {
717
-            return;
718
-        }
719
-        foreach ($this->script_handles_with_data as $script_handle) {
720
-            $this->removeAlreadyRegisteredDataForScriptHandle($script_handle);
721
-        }
722
-    }
723
-
724
-
725
-    /**
726
-     * Removes any data dependency registered in WP_Scripts if its set.
727
-     *
728
-     * @param string $script_handle
729
-     */
730
-    private function removeAlreadyRegisteredDataForScriptHandle($script_handle)
731
-    {
732
-        if (isset($this->script_handles_with_data[ $script_handle ])) {
733
-            global $wp_scripts;
734
-            $unset_handle = false;
735
-            if ($wp_scripts->get_data($script_handle, 'data')) {
736
-                unset($wp_scripts->registered[ $script_handle ]->extra['data']);
737
-                $unset_handle = true;
738
-            }
739
-            //deal with inline_scripts
740
-            if ($wp_scripts->get_data($script_handle, 'before')) {
741
-                unset($wp_scripts->registered[ $script_handle ]->extra['before']);
742
-                $unset_handle = true;
743
-            }
744
-            if ($wp_scripts->get_data($script_handle, 'after')) {
745
-                unset($wp_scripts->registered[ $script_handle ]->extra['after']);
746
-            }
747
-            if ($unset_handle) {
748
-                unset($this->script_handles_with_data[ $script_handle ]);
749
-            }
750
-        }
751
-    }
752
-
753
-
754
-    /**
755
-     * register translations for a registered script
756
-     *
757
-     * @param string $handle
758
-     */
759
-    public function registerTranslation($handle)
760
-    {
761
-        $this->i18n_registry->registerScriptI18n($handle);
762
-    }
763
-
764
-
765
-    /**
766
-     * @return bool
767
-     * @since 4.9.63.p
768
-     */
769
-    private function debug()
770
-    {
771
-        return apply_filters(
772
-            'FHEE__EventEspresso_core_services_assets_Registry__debug',
773
-            defined('EE_DEBUG') && EE_DEBUG
774
-        );
775
-    }
776
-
777
-
778
-    /**
779
-     * Get the dependencies array for the given js asset chunk name
780
-     *
781
-     * @param string $namespace
782
-     * @param string $chunk_name
783
-     * @return array
784
-     * @deprecated 4.10.2.p
785
-     * @since      4.9.82.p
786
-     */
787
-    public function getJsDependencies($namespace, $chunk_name)
788
-    {
789
-        $details = $this->getJsAssetDetails($namespace, $chunk_name);
790
-        return isset($details['dependencies']) ? $details['dependencies'] : [];
791
-    }
792
-
793
-
794
-    /**
795
-     * Get the dependencies array for the given css asset chunk name
796
-     *
797
-     * @param string $namespace
798
-     * @param string $chunk_name
799
-     * @return array
800
-     * @deprecated 4.10.2.p
801
-     * @since      4.9.82.p
802
-     */
803
-    public function getCssDependencies($namespace, $chunk_name)
804
-    {
805
-        $details = $this->getCssAssetDetails($namespace, $chunk_name);
806
-        return isset($details['dependencies']) ? $details['dependencies'] : [];
807
-    }
714
+	private function removeAlreadyRegisteredDataForScriptHandles()
715
+	{
716
+		if (empty($this->script_handles_with_data)) {
717
+			return;
718
+		}
719
+		foreach ($this->script_handles_with_data as $script_handle) {
720
+			$this->removeAlreadyRegisteredDataForScriptHandle($script_handle);
721
+		}
722
+	}
723
+
724
+
725
+	/**
726
+	 * Removes any data dependency registered in WP_Scripts if its set.
727
+	 *
728
+	 * @param string $script_handle
729
+	 */
730
+	private function removeAlreadyRegisteredDataForScriptHandle($script_handle)
731
+	{
732
+		if (isset($this->script_handles_with_data[ $script_handle ])) {
733
+			global $wp_scripts;
734
+			$unset_handle = false;
735
+			if ($wp_scripts->get_data($script_handle, 'data')) {
736
+				unset($wp_scripts->registered[ $script_handle ]->extra['data']);
737
+				$unset_handle = true;
738
+			}
739
+			//deal with inline_scripts
740
+			if ($wp_scripts->get_data($script_handle, 'before')) {
741
+				unset($wp_scripts->registered[ $script_handle ]->extra['before']);
742
+				$unset_handle = true;
743
+			}
744
+			if ($wp_scripts->get_data($script_handle, 'after')) {
745
+				unset($wp_scripts->registered[ $script_handle ]->extra['after']);
746
+			}
747
+			if ($unset_handle) {
748
+				unset($this->script_handles_with_data[ $script_handle ]);
749
+			}
750
+		}
751
+	}
752
+
753
+
754
+	/**
755
+	 * register translations for a registered script
756
+	 *
757
+	 * @param string $handle
758
+	 */
759
+	public function registerTranslation($handle)
760
+	{
761
+		$this->i18n_registry->registerScriptI18n($handle);
762
+	}
763
+
764
+
765
+	/**
766
+	 * @return bool
767
+	 * @since 4.9.63.p
768
+	 */
769
+	private function debug()
770
+	{
771
+		return apply_filters(
772
+			'FHEE__EventEspresso_core_services_assets_Registry__debug',
773
+			defined('EE_DEBUG') && EE_DEBUG
774
+		);
775
+	}
776
+
777
+
778
+	/**
779
+	 * Get the dependencies array for the given js asset chunk name
780
+	 *
781
+	 * @param string $namespace
782
+	 * @param string $chunk_name
783
+	 * @return array
784
+	 * @deprecated 4.10.2.p
785
+	 * @since      4.9.82.p
786
+	 */
787
+	public function getJsDependencies($namespace, $chunk_name)
788
+	{
789
+		$details = $this->getJsAssetDetails($namespace, $chunk_name);
790
+		return isset($details['dependencies']) ? $details['dependencies'] : [];
791
+	}
792
+
793
+
794
+	/**
795
+	 * Get the dependencies array for the given css asset chunk name
796
+	 *
797
+	 * @param string $namespace
798
+	 * @param string $chunk_name
799
+	 * @return array
800
+	 * @deprecated 4.10.2.p
801
+	 * @since      4.9.82.p
802
+	 */
803
+	public function getCssDependencies($namespace, $chunk_name)
804
+	{
805
+		$details = $this->getCssAssetDetails($namespace, $chunk_name);
806
+		return isset($details['dependencies']) ? $details['dependencies'] : [];
807
+	}
808 808
 }
Please login to merge, or discard this patch.
Spacing   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
                 $script->version(),
187 187
                 $script->loadInFooter()
188 188
             );
189
-            if (! $registered && $this->debug()) {
189
+            if ( ! $registered && $this->debug()) {
190 190
                 throw new AssetRegistrationException($script->handle());
191 191
             }
192 192
             $script->setRegistered($registered);
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
         $this->removeAlreadyRegisteredDataForScriptHandles();
248 248
         wp_add_inline_script(
249 249
             CoreAssetManager::JS_HANDLE_JS_CORE,
250
-            'var eejsdata=' . wp_json_encode(['data' => $this->js_data]),
250
+            'var eejsdata='.wp_json_encode(['data' => $this->js_data]),
251 251
             'before'
252 252
         );
253 253
         $scripts = $this->assets->getJavascriptAssetsWithData();
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
     public function addData($key, $value)
278 278
     {
279 279
         if ($this->verifyDataNotExisting($key)) {
280
-            $this->js_data[ $key ] = $value;
280
+            $this->js_data[$key] = $value;
281 281
         }
282 282
     }
283 283
 
@@ -303,10 +303,10 @@  discard block
 block discarded – undo
303 303
     public function pushData($key, $value)
304 304
     {
305 305
         if (
306
-            isset($this->js_data[ $key ])
307
-            && ! is_array($this->js_data[ $key ])
306
+            isset($this->js_data[$key])
307
+            && ! is_array($this->js_data[$key])
308 308
         ) {
309
-            if (! $this->debug()) {
309
+            if ( ! $this->debug()) {
310 310
                 return;
311 311
             }
312 312
             throw new InvalidArgumentException(
@@ -321,10 +321,10 @@  discard block
 block discarded – undo
321 321
                 )
322 322
             );
323 323
         }
324
-        if (! isset($this->js_data[ $key ])) {
325
-            $this->js_data[ $key ] = is_array($value) ? $value : [$value];
324
+        if ( ! isset($this->js_data[$key])) {
325
+            $this->js_data[$key] = is_array($value) ? $value : [$value];
326 326
         } else {
327
-            $this->js_data[ $key ] = array_merge($this->js_data[ $key ], (array) $value);
327
+            $this->js_data[$key] = array_merge($this->js_data[$key], (array) $value);
328 328
         }
329 329
     }
330 330
 
@@ -339,12 +339,12 @@  discard block
 block discarded – undo
339 339
      */
340 340
     public function addTemplate($template_reference, $template_content)
341 341
     {
342
-        if (! isset($this->js_data['templates'])) {
342
+        if ( ! isset($this->js_data['templates'])) {
343 343
             $this->js_data['templates'] = [];
344 344
         }
345 345
         //no overrides allowed.
346
-        if (isset($this->js_data['templates'][ $template_reference ])) {
347
-            if (! $this->debug()) {
346
+        if (isset($this->js_data['templates'][$template_reference])) {
347
+            if ( ! $this->debug()) {
348 348
                 return;
349 349
             }
350 350
             throw new InvalidArgumentException(
@@ -357,7 +357,7 @@  discard block
 block discarded – undo
357 357
                 )
358 358
             );
359 359
         }
360
-        $this->js_data['templates'][ $template_reference ] = $template_content;
360
+        $this->js_data['templates'][$template_reference] = $template_content;
361 361
     }
362 362
 
363 363
 
@@ -369,8 +369,8 @@  discard block
 block discarded – undo
369 369
      */
370 370
     public function getTemplate($template_reference)
371 371
     {
372
-        return isset($this->js_data['templates'][ $template_reference ])
373
-            ? $this->js_data['templates'][ $template_reference ]
372
+        return isset($this->js_data['templates'][$template_reference])
373
+            ? $this->js_data['templates'][$template_reference]
374 374
             : '';
375 375
     }
376 376
 
@@ -383,7 +383,7 @@  discard block
 block discarded – undo
383 383
      */
384 384
     public function getData($key)
385 385
     {
386
-        return array_key_exists($key, $this->js_data) ? $this->js_data[ $key ] : null;
386
+        return array_key_exists($key, $this->js_data) ? $this->js_data[$key] : null;
387 387
     }
388 388
 
389 389
 
@@ -397,11 +397,11 @@  discard block
 block discarded – undo
397 397
      */
398 398
     protected function verifyDataNotExisting($key)
399 399
     {
400
-        if (isset($this->js_data[ $key ])) {
401
-            if (! $this->debug()) {
400
+        if (isset($this->js_data[$key])) {
401
+            if ( ! $this->debug()) {
402 402
                 return false;
403 403
             }
404
-            if (is_array($this->js_data[ $key ])) {
404
+            if (is_array($this->js_data[$key])) {
405 405
                 throw new InvalidArgumentException(
406 406
                     sprintf(
407 407
                         esc_html__(
@@ -444,11 +444,11 @@  discard block
 block discarded – undo
444 444
     public function getAssetUrl($namespace, $chunk_name, $asset_type)
445 445
     {
446 446
         $url = isset(
447
-            $this->manifest_data[ $namespace ][ $chunk_name . '.' . $asset_type ],
448
-            $this->manifest_data[ $namespace ]['url_base']
447
+            $this->manifest_data[$namespace][$chunk_name.'.'.$asset_type],
448
+            $this->manifest_data[$namespace]['url_base']
449 449
         )
450
-            ? $this->manifest_data[ $namespace ]['url_base']
451
-              . $this->manifest_data[ $namespace ][ $chunk_name . '.' . $asset_type ]
450
+            ? $this->manifest_data[$namespace]['url_base']
451
+              . $this->manifest_data[$namespace][$chunk_name.'.'.$asset_type]
452 452
             : $chunk_name;
453 453
 
454 454
         return apply_filters(
@@ -498,21 +498,21 @@  discard block
 block discarded – undo
498 498
      */
499 499
     private function getDetailsForAsset($namespace, $chunk_name, $asset_type)
500 500
     {
501
-        $asset_index = $chunk_name . '.' . $asset_type;
502
-        if (! isset($this->dependencies_data[ $namespace ][ $asset_index ])) {
503
-            $path = isset($this->manifest_data[ $namespace ]['path'])
504
-                ? $this->manifest_data[ $namespace ]['path']
501
+        $asset_index = $chunk_name.'.'.$asset_type;
502
+        if ( ! isset($this->dependencies_data[$namespace][$asset_index])) {
503
+            $path = isset($this->manifest_data[$namespace]['path'])
504
+                ? $this->manifest_data[$namespace]['path']
505 505
                 : '';
506
-            $dependencies_index = $chunk_name . Asset::EXT_PHP;
507
-            $file_path = isset($this->manifest_data[ $namespace ][ $dependencies_index ])
508
-                ? $path . $this->manifest_data[ $namespace ][ $dependencies_index ]
506
+            $dependencies_index = $chunk_name.Asset::EXT_PHP;
507
+            $file_path = isset($this->manifest_data[$namespace][$dependencies_index])
508
+                ? $path.$this->manifest_data[$namespace][$dependencies_index]
509 509
                 : '';
510 510
             // if file path exists then get the asset details
511
-            $this->dependencies_data[ $namespace ][ $asset_index ] = $file_path !== '' && file_exists($file_path)
511
+            $this->dependencies_data[$namespace][$asset_index] = $file_path !== '' && file_exists($file_path)
512 512
                 ? $this->getDetailsForAssetType($namespace, $asset_type, $file_path, $chunk_name)
513 513
                 : [];
514 514
         }
515
-        return $this->dependencies_data[ $namespace ][ $asset_index ];
515
+        return $this->dependencies_data[$namespace][$asset_index];
516 516
     }
517 517
 
518 518
 
@@ -544,15 +544,15 @@  discard block
 block discarded – undo
544 544
             return $asset_details;
545 545
         }
546 546
         // for css we need to make sure there is actually a css file related to this chunk.
547
-        if (isset($this->manifest_data[ $namespace ])) {
547
+        if (isset($this->manifest_data[$namespace])) {
548 548
             // array of css chunk files for ee.
549 549
             $css_chunks = array_map(
550
-                static function ($value) {
550
+                static function($value) {
551 551
                     return str_replace(Asset::EXT_CSS, '', $value);
552 552
                 },
553 553
                 array_filter(
554
-                    array_keys($this->manifest_data[ $namespace ]),
555
-                    static function ($value) {
554
+                    array_keys($this->manifest_data[$namespace]),
555
+                    static function($value) {
556 556
                         return strpos($value, Asset::EXT_CSS) !== false;
557 557
                     }
558 558
                 )
@@ -564,8 +564,8 @@  discard block
 block discarded – undo
564 564
             // now let's filter the dependencies for the incoming chunk to actual chunks that have styles
565 565
             $asset_details['dependencies'] = array_filter(
566 566
                 $asset_details['dependencies'],
567
-                static function ($chunk_name) use ($css_chunks) {
568
-                    return isset($css_chunks[ $chunk_name ]);
567
+                static function($chunk_name) use ($css_chunks) {
568
+                    return isset($css_chunks[$chunk_name]);
569 569
                 }
570 570
             );
571 571
             return $asset_details;
@@ -614,7 +614,7 @@  discard block
 block discarded – undo
614 614
             $this->registerManifestFile(
615 615
                 $manifest_file->assetNamespace(),
616 616
                 $manifest_file->urlBase(),
617
-                $manifest_file->filepath() . Registry::FILE_NAME_BUILD_MANIFEST,
617
+                $manifest_file->filepath().Registry::FILE_NAME_BUILD_MANIFEST,
618 618
                 $manifest_file->filepath()
619 619
             );
620 620
         }
@@ -635,8 +635,8 @@  discard block
 block discarded – undo
635 635
      */
636 636
     public function registerManifestFile($namespace, $url_base, $manifest_file, $manifest_file_path = '')
637 637
     {
638
-        if (isset($this->manifest_data[ $namespace ])) {
639
-            if (! $this->debug()) {
638
+        if (isset($this->manifest_data[$namespace])) {
639
+            if ( ! $this->debug()) {
640 640
                 return;
641 641
             }
642 642
             throw new InvalidArgumentException(
@@ -669,12 +669,12 @@  discard block
 block discarded – undo
669 669
             }
670 670
             return;
671 671
         }
672
-        $this->manifest_data[ $namespace ] = $this->decodeManifestFile($manifest_file);
673
-        if (! isset($this->manifest_data[ $namespace ]['url_base'])) {
674
-            $this->manifest_data[ $namespace ]['url_base'] = trailingslashit($url_base);
672
+        $this->manifest_data[$namespace] = $this->decodeManifestFile($manifest_file);
673
+        if ( ! isset($this->manifest_data[$namespace]['url_base'])) {
674
+            $this->manifest_data[$namespace]['url_base'] = trailingslashit($url_base);
675 675
         }
676
-        if (! isset($this->manifest_data[ $namespace ]['path'])) {
677
-            $this->manifest_data[ $namespace ]['path'] = $manifest_file_path;
676
+        if ( ! isset($this->manifest_data[$namespace]['path'])) {
677
+            $this->manifest_data[$namespace]['path'] = $manifest_file_path;
678 678
         }
679 679
     }
680 680
 
@@ -689,7 +689,7 @@  discard block
 block discarded – undo
689 689
      */
690 690
     private function decodeManifestFile($manifest_file)
691 691
     {
692
-        if (! file_exists($manifest_file)) {
692
+        if ( ! file_exists($manifest_file)) {
693 693
             throw new InvalidFilePathException($manifest_file);
694 694
         }
695 695
         return json_decode(file_get_contents($manifest_file), true);
@@ -703,7 +703,7 @@  discard block
 block discarded – undo
703 703
      */
704 704
     private function addRegisteredScriptHandlesWithData($script_handle)
705 705
     {
706
-        $this->script_handles_with_data[ $script_handle ] = $script_handle;
706
+        $this->script_handles_with_data[$script_handle] = $script_handle;
707 707
     }
708 708
 
709 709
 
@@ -729,23 +729,23 @@  discard block
 block discarded – undo
729 729
      */
730 730
     private function removeAlreadyRegisteredDataForScriptHandle($script_handle)
731 731
     {
732
-        if (isset($this->script_handles_with_data[ $script_handle ])) {
732
+        if (isset($this->script_handles_with_data[$script_handle])) {
733 733
             global $wp_scripts;
734 734
             $unset_handle = false;
735 735
             if ($wp_scripts->get_data($script_handle, 'data')) {
736
-                unset($wp_scripts->registered[ $script_handle ]->extra['data']);
736
+                unset($wp_scripts->registered[$script_handle]->extra['data']);
737 737
                 $unset_handle = true;
738 738
             }
739 739
             //deal with inline_scripts
740 740
             if ($wp_scripts->get_data($script_handle, 'before')) {
741
-                unset($wp_scripts->registered[ $script_handle ]->extra['before']);
741
+                unset($wp_scripts->registered[$script_handle]->extra['before']);
742 742
                 $unset_handle = true;
743 743
             }
744 744
             if ($wp_scripts->get_data($script_handle, 'after')) {
745
-                unset($wp_scripts->registered[ $script_handle ]->extra['after']);
745
+                unset($wp_scripts->registered[$script_handle]->extra['after']);
746 746
             }
747 747
             if ($unset_handle) {
748
-                unset($this->script_handles_with_data[ $script_handle ]);
748
+                unset($this->script_handles_with_data[$script_handle]);
749 749
             }
750 750
         }
751 751
     }
Please login to merge, or discard this patch.
core/services/assets/AssetManager.php 2 patches
Indentation   +255 added lines, -255 removed lines patch added patch discarded remove patch
@@ -23,284 +23,284 @@
 block discarded – undo
23 23
 abstract class AssetManager implements AssetManagerInterface
24 24
 {
25 25
 
26
-    /**
27
-     * @var AssetCollection $assets
28
-     */
29
-    protected $assets;
26
+	/**
27
+	 * @var AssetCollection $assets
28
+	 */
29
+	protected $assets;
30 30
 
31
-    /**
32
-     * @var DomainInterface
33
-     */
34
-    protected $domain;
31
+	/**
32
+	 * @var DomainInterface
33
+	 */
34
+	protected $domain;
35 35
 
36
-    /**
37
-     * @var Registry $registry
38
-     */
39
-    protected $registry;
36
+	/**
37
+	 * @var Registry $registry
38
+	 */
39
+	protected $registry;
40 40
 
41 41
 
42
-    /**
43
-     * AssetRegister constructor.
44
-     *
45
-     * @param DomainInterface $domain
46
-     * @param AssetCollection $assets
47
-     * @param Registry        $registry
48
-     */
49
-    public function __construct(DomainInterface $domain, AssetCollection $assets, Registry $registry)
50
-    {
51
-        $this->domain = $domain;
52
-        $this->assets = $assets;
53
-        $this->registry = $registry;
54
-        add_action('wp_enqueue_scripts', array($this, 'addManifestFile'), 0);
55
-        add_action('admin_enqueue_scripts', array($this, 'addManifestFile'), 0);
56
-        add_action('wp_enqueue_scripts', array($this, 'addAssets'), 2);
57
-        add_action('admin_enqueue_scripts', array($this, 'addAssets'), 2);
58
-    }
42
+	/**
43
+	 * AssetRegister constructor.
44
+	 *
45
+	 * @param DomainInterface $domain
46
+	 * @param AssetCollection $assets
47
+	 * @param Registry        $registry
48
+	 */
49
+	public function __construct(DomainInterface $domain, AssetCollection $assets, Registry $registry)
50
+	{
51
+		$this->domain = $domain;
52
+		$this->assets = $assets;
53
+		$this->registry = $registry;
54
+		add_action('wp_enqueue_scripts', array($this, 'addManifestFile'), 0);
55
+		add_action('admin_enqueue_scripts', array($this, 'addManifestFile'), 0);
56
+		add_action('wp_enqueue_scripts', array($this, 'addAssets'), 2);
57
+		add_action('admin_enqueue_scripts', array($this, 'addAssets'), 2);
58
+	}
59 59
 
60 60
 
61
-    /**
62
-     * @since 4.9.71.p
63
-     * @return string
64
-     */
65
-    public function assetNamespace()
66
-    {
67
-        return $this->domain->assetNamespace();
68
-    }
61
+	/**
62
+	 * @since 4.9.71.p
63
+	 * @return string
64
+	 */
65
+	public function assetNamespace()
66
+	{
67
+		return $this->domain->assetNamespace();
68
+	}
69 69
 
70 70
 
71
-    /**
72
-     * @return void
73
-     * @throws DuplicateCollectionIdentifierException
74
-     * @throws InvalidDataTypeException
75
-     * @throws InvalidEntityException
76
-     * @since 4.9.62.p
77
-     */
78
-    public function addManifestFile()
79
-    {
80
-        // if a manifest file has already been added for this domain, then just return
81
-        if ($this->assets->has($this->domain->assetNamespace())) {
82
-            return;
83
-        }
84
-        $asset = new ManifestFile($this->domain);
85
-        $this->assets->add($asset, $this->domain->assetNamespace());
86
-    }
71
+	/**
72
+	 * @return void
73
+	 * @throws DuplicateCollectionIdentifierException
74
+	 * @throws InvalidDataTypeException
75
+	 * @throws InvalidEntityException
76
+	 * @since 4.9.62.p
77
+	 */
78
+	public function addManifestFile()
79
+	{
80
+		// if a manifest file has already been added for this domain, then just return
81
+		if ($this->assets->has($this->domain->assetNamespace())) {
82
+			return;
83
+		}
84
+		$asset = new ManifestFile($this->domain);
85
+		$this->assets->add($asset, $this->domain->assetNamespace());
86
+	}
87 87
 
88 88
 
89
-    /**
90
-     * @return ManifestFile[]
91
-     * @since 4.9.62.p
92
-     */
93
-    public function getManifestFile()
94
-    {
95
-        return $this->assets->getManifestFiles();
96
-    }
89
+	/**
90
+	 * @return ManifestFile[]
91
+	 * @since 4.9.62.p
92
+	 */
93
+	public function getManifestFile()
94
+	{
95
+		return $this->assets->getManifestFiles();
96
+	}
97 97
 
98 98
 
99
-    /**
100
-     * @param string $handle
101
-     * @param string $source
102
-     * @param array  $dependencies
103
-     * @param bool   $load_in_footer
104
-     * @param string $version
105
-     * @return JavascriptAsset
106
-     * @throws DuplicateCollectionIdentifierException
107
-     * @throws InvalidDataTypeException
108
-     * @throws InvalidEntityException
109
-     * @throws DomainException
110
-     * @since 4.9.62.p
111
-     */
112
-    public function addJavascript(
113
-        $handle,
114
-        $source,
115
-        array $dependencies = array(),
116
-        $load_in_footer = true,
117
-        $version = ''
118
-    ) {
119
-        $asset = new JavascriptAsset(
120
-            $handle,
121
-            $source,
122
-            array_unique($dependencies),
123
-            $load_in_footer,
124
-            $this->domain,
125
-            $version
126
-        );
127
-        $this->assets->add($asset, $handle);
128
-        return $asset;
129
-    }
99
+	/**
100
+	 * @param string $handle
101
+	 * @param string $source
102
+	 * @param array  $dependencies
103
+	 * @param bool   $load_in_footer
104
+	 * @param string $version
105
+	 * @return JavascriptAsset
106
+	 * @throws DuplicateCollectionIdentifierException
107
+	 * @throws InvalidDataTypeException
108
+	 * @throws InvalidEntityException
109
+	 * @throws DomainException
110
+	 * @since 4.9.62.p
111
+	 */
112
+	public function addJavascript(
113
+		$handle,
114
+		$source,
115
+		array $dependencies = array(),
116
+		$load_in_footer = true,
117
+		$version = ''
118
+	) {
119
+		$asset = new JavascriptAsset(
120
+			$handle,
121
+			$source,
122
+			array_unique($dependencies),
123
+			$load_in_footer,
124
+			$this->domain,
125
+			$version
126
+		);
127
+		$this->assets->add($asset, $handle);
128
+		return $asset;
129
+	}
130 130
 
131 131
 
132
-    /**
133
-     * Used to register a javascript asset where everything is dynamically derived from the given handle.
134
-     *
135
-     * @param string       $handle
136
-     * @param string|array $extra_dependencies
137
-     * @return JavascriptAsset
138
-     * @throws DuplicateCollectionIdentifierException
139
-     * @throws InvalidDataTypeException
140
-     * @throws InvalidEntityException
141
-     * @throws DomainException
142
-     */
143
-    public function addJs($handle, $extra_dependencies = [])
144
-    {
145
-        $details = $this->getAssetDetails(
146
-            Asset::TYPE_JS,
147
-            $handle,
148
-            $extra_dependencies
149
-        );
150
-        return $this->addJavascript(
151
-            $handle,
152
-            $this->registry->getJsUrl($this->domain->assetNamespace(), $handle),
153
-            $details['dependencies'],
154
-            true,
155
-            $details['version']
156
-        );
157
-    }
132
+	/**
133
+	 * Used to register a javascript asset where everything is dynamically derived from the given handle.
134
+	 *
135
+	 * @param string       $handle
136
+	 * @param string|array $extra_dependencies
137
+	 * @return JavascriptAsset
138
+	 * @throws DuplicateCollectionIdentifierException
139
+	 * @throws InvalidDataTypeException
140
+	 * @throws InvalidEntityException
141
+	 * @throws DomainException
142
+	 */
143
+	public function addJs($handle, $extra_dependencies = [])
144
+	{
145
+		$details = $this->getAssetDetails(
146
+			Asset::TYPE_JS,
147
+			$handle,
148
+			$extra_dependencies
149
+		);
150
+		return $this->addJavascript(
151
+			$handle,
152
+			$this->registry->getJsUrl($this->domain->assetNamespace(), $handle),
153
+			$details['dependencies'],
154
+			true,
155
+			$details['version']
156
+		);
157
+	}
158 158
 
159 159
 
160
-    /**
161
-     * @param string $handle
162
-     * @param array  $dependencies
163
-     * @param bool   $load_in_footer
164
-     * @param string $version
165
-     * @return JavascriptAsset
166
-     * @throws DomainException
167
-     * @throws DuplicateCollectionIdentifierException
168
-     * @throws InvalidDataTypeException
169
-     * @throws InvalidEntityException
170
-     * @since 4.9.71.p
171
-     */
172
-    public function addVendorJavascript(
173
-        $handle,
174
-        array $dependencies = array(),
175
-        $load_in_footer = true,
176
-        $version = ''
177
-    ) {
178
-        $dev_suffix = wp_scripts_get_suffix('dev');
179
-        $vendor_path = $this->domain->pluginUrl() . 'assets/vendor/';
180
-        return $this->addJavascript(
181
-            $handle,
182
-            "{$vendor_path}{$handle}{$dev_suffix}". Asset::EXT_JS,
183
-            $dependencies,
184
-            $load_in_footer,
185
-            $version
186
-        );
187
-    }
160
+	/**
161
+	 * @param string $handle
162
+	 * @param array  $dependencies
163
+	 * @param bool   $load_in_footer
164
+	 * @param string $version
165
+	 * @return JavascriptAsset
166
+	 * @throws DomainException
167
+	 * @throws DuplicateCollectionIdentifierException
168
+	 * @throws InvalidDataTypeException
169
+	 * @throws InvalidEntityException
170
+	 * @since 4.9.71.p
171
+	 */
172
+	public function addVendorJavascript(
173
+		$handle,
174
+		array $dependencies = array(),
175
+		$load_in_footer = true,
176
+		$version = ''
177
+	) {
178
+		$dev_suffix = wp_scripts_get_suffix('dev');
179
+		$vendor_path = $this->domain->pluginUrl() . 'assets/vendor/';
180
+		return $this->addJavascript(
181
+			$handle,
182
+			"{$vendor_path}{$handle}{$dev_suffix}". Asset::EXT_JS,
183
+			$dependencies,
184
+			$load_in_footer,
185
+			$version
186
+		);
187
+	}
188 188
 
189 189
 
190
-    /**
191
-     * @param string $handle
192
-     * @param string $source
193
-     * @param array  $dependencies
194
-     * @param string $media
195
-     * @param string $version
196
-     * @return StylesheetAsset
197
-     * @throws DomainException
198
-     * @throws DuplicateCollectionIdentifierException
199
-     * @throws InvalidDataTypeException
200
-     * @throws InvalidEntityException
201
-     * @since 4.9.62.p
202
-     */
203
-    public function addStylesheet(
204
-        $handle,
205
-        $source,
206
-        array $dependencies = array(),
207
-        $media = 'all',
208
-        $version = ''
209
-    ) {
210
-        $asset = new StylesheetAsset(
211
-            $handle,
212
-            $source,
213
-            array_unique($dependencies),
214
-            $this->domain,
215
-            $media,
216
-            $version
217
-        );
218
-        $this->assets->add($asset, $handle);
219
-        return $asset;
220
-    }
190
+	/**
191
+	 * @param string $handle
192
+	 * @param string $source
193
+	 * @param array  $dependencies
194
+	 * @param string $media
195
+	 * @param string $version
196
+	 * @return StylesheetAsset
197
+	 * @throws DomainException
198
+	 * @throws DuplicateCollectionIdentifierException
199
+	 * @throws InvalidDataTypeException
200
+	 * @throws InvalidEntityException
201
+	 * @since 4.9.62.p
202
+	 */
203
+	public function addStylesheet(
204
+		$handle,
205
+		$source,
206
+		array $dependencies = array(),
207
+		$media = 'all',
208
+		$version = ''
209
+	) {
210
+		$asset = new StylesheetAsset(
211
+			$handle,
212
+			$source,
213
+			array_unique($dependencies),
214
+			$this->domain,
215
+			$media,
216
+			$version
217
+		);
218
+		$this->assets->add($asset, $handle);
219
+		return $asset;
220
+	}
221 221
 
222 222
 
223
-    /**
224
-     * Used to register a css asset where everything is dynamically derived from the given handle.
225
-     *
226
-     * @param string       $handle
227
-     * @param string|array $extra_dependencies
228
-     * @return StylesheetAsset
229
-     * @throws DuplicateCollectionIdentifierException
230
-     * @throws InvalidDataTypeException
231
-     * @throws InvalidEntityException
232
-     * @throws DomainException
233
-     */
234
-    public function addCss($handle, $extra_dependencies = [])
235
-    {
236
-        $details = $this->getAssetDetails(
237
-            Asset::TYPE_CSS,
238
-            $handle,
239
-            $extra_dependencies
240
-        );
241
-        return $this->addStylesheet(
242
-            $handle,
243
-            $this->registry->getCssUrl($this->domain->assetNamespace(), $handle),
244
-            $details['dependencies'],
245
-            'all',
246
-            $details['version']
247
-        );
248
-    }
223
+	/**
224
+	 * Used to register a css asset where everything is dynamically derived from the given handle.
225
+	 *
226
+	 * @param string       $handle
227
+	 * @param string|array $extra_dependencies
228
+	 * @return StylesheetAsset
229
+	 * @throws DuplicateCollectionIdentifierException
230
+	 * @throws InvalidDataTypeException
231
+	 * @throws InvalidEntityException
232
+	 * @throws DomainException
233
+	 */
234
+	public function addCss($handle, $extra_dependencies = [])
235
+	{
236
+		$details = $this->getAssetDetails(
237
+			Asset::TYPE_CSS,
238
+			$handle,
239
+			$extra_dependencies
240
+		);
241
+		return $this->addStylesheet(
242
+			$handle,
243
+			$this->registry->getCssUrl($this->domain->assetNamespace(), $handle),
244
+			$details['dependencies'],
245
+			'all',
246
+			$details['version']
247
+		);
248
+	}
249 249
 
250 250
 
251
-    /**
252
-     * @param string $handle
253
-     * @return bool
254
-     * @since 4.9.62.p
255
-     */
256
-    public function enqueueAsset($handle)
257
-    {
258
-        if ($this->assets->has($handle)) {
259
-            $asset = $this->assets->get($handle);
260
-            if ($asset->isRegistered()) {
261
-                $asset->enqueueAsset();
262
-                return true;
263
-            }
264
-        }
265
-        return false;
266
-    }
251
+	/**
252
+	 * @param string $handle
253
+	 * @return bool
254
+	 * @since 4.9.62.p
255
+	 */
256
+	public function enqueueAsset($handle)
257
+	{
258
+		if ($this->assets->has($handle)) {
259
+			$asset = $this->assets->get($handle);
260
+			if ($asset->isRegistered()) {
261
+				$asset->enqueueAsset();
262
+				return true;
263
+			}
264
+		}
265
+		return false;
266
+	}
267 267
 
268 268
 
269
-    /**
270
-     * @param string $asset_type
271
-     * @param string $handle
272
-     * @param array  $extra_dependencies
273
-     * @return array
274
-     * @since 4.10.2.p
275
-     */
276
-    private function getAssetDetails($asset_type, $handle, $extra_dependencies = [])
277
-    {
278
-        $getAssetDetails = '';
279
-        switch ($asset_type) {
280
-            case Asset::TYPE_JS :
281
-                $getAssetDetails = 'getJsAssetDetails';
282
-                break;
283
-            case Asset::TYPE_CSS :
284
-                $getAssetDetails = 'getCssAssetDetails';
285
-                break;
286
-        }
287
-        if ($getAssetDetails === '') {
288
-            return ['dependencies' => [], 'version' => ''];
289
-        }
290
-        $details = $this->registry->$getAssetDetails(
291
-            $this->domain->assetNamespace(),
292
-            $handle
293
-        );
294
-        $details['dependencies'] = isset($details['dependencies'])
295
-            ? $details['dependencies']
296
-            : [];
297
-        $details['version'] = isset($details['version'])
298
-            ? $details['version']
299
-            : '';
300
-        $details['dependencies'] = ! empty($extra_dependencies)
301
-            ? array_merge($details['dependencies'], (array) $extra_dependencies)
302
-            : $details['dependencies'];
303
-        return $details;
269
+	/**
270
+	 * @param string $asset_type
271
+	 * @param string $handle
272
+	 * @param array  $extra_dependencies
273
+	 * @return array
274
+	 * @since 4.10.2.p
275
+	 */
276
+	private function getAssetDetails($asset_type, $handle, $extra_dependencies = [])
277
+	{
278
+		$getAssetDetails = '';
279
+		switch ($asset_type) {
280
+			case Asset::TYPE_JS :
281
+				$getAssetDetails = 'getJsAssetDetails';
282
+				break;
283
+			case Asset::TYPE_CSS :
284
+				$getAssetDetails = 'getCssAssetDetails';
285
+				break;
286
+		}
287
+		if ($getAssetDetails === '') {
288
+			return ['dependencies' => [], 'version' => ''];
289
+		}
290
+		$details = $this->registry->$getAssetDetails(
291
+			$this->domain->assetNamespace(),
292
+			$handle
293
+		);
294
+		$details['dependencies'] = isset($details['dependencies'])
295
+			? $details['dependencies']
296
+			: [];
297
+		$details['version'] = isset($details['version'])
298
+			? $details['version']
299
+			: '';
300
+		$details['dependencies'] = ! empty($extra_dependencies)
301
+			? array_merge($details['dependencies'], (array) $extra_dependencies)
302
+			: $details['dependencies'];
303
+		return $details;
304 304
 
305
-    }
305
+	}
306 306
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -176,10 +176,10 @@
 block discarded – undo
176 176
         $version = ''
177 177
     ) {
178 178
         $dev_suffix = wp_scripts_get_suffix('dev');
179
-        $vendor_path = $this->domain->pluginUrl() . 'assets/vendor/';
179
+        $vendor_path = $this->domain->pluginUrl().'assets/vendor/';
180 180
         return $this->addJavascript(
181 181
             $handle,
182
-            "{$vendor_path}{$handle}{$dev_suffix}". Asset::EXT_JS,
182
+            "{$vendor_path}{$handle}{$dev_suffix}".Asset::EXT_JS,
183 183
             $dependencies,
184 184
             $load_in_footer,
185 185
             $version
Please login to merge, or discard this patch.
core/services/notifications/PersistentAdminNoticeManager.php 1 patch
Indentation   +388 added lines, -388 removed lines patch added patch discarded remove patch
@@ -31,392 +31,392 @@
 block discarded – undo
31 31
 class PersistentAdminNoticeManager
32 32
 {
33 33
 
34
-    const WP_OPTION_KEY = 'ee_pers_admin_notices';
35
-
36
-    /**
37
-     * @var Collection|PersistentAdminNotice[] $notice_collection
38
-     */
39
-    private $notice_collection;
40
-
41
-    /**
42
-     * if AJAX is not enabled, then the return URL will be used for redirecting back to the admin page where the
43
-     * persistent admin notice was displayed, and ultimately dismissed from.
44
-     *
45
-     * @var string $return_url
46
-     */
47
-    private $return_url;
48
-
49
-    /**
50
-     * @var CapabilitiesChecker $capabilities_checker
51
-     */
52
-    private $capabilities_checker;
53
-
54
-    /**
55
-     * @var RequestInterface $request
56
-     */
57
-    private $request;
58
-
59
-
60
-    /**
61
-     * PersistentAdminNoticeManager constructor
62
-     *
63
-     * @param CapabilitiesChecker $capabilities_checker
64
-     * @param RequestInterface    $request
65
-     * @param string              $return_url where to  redirect to after dismissing notices
66
-     * @throws InvalidDataTypeException
67
-     */
68
-    public function __construct(
69
-        CapabilitiesChecker $capabilities_checker,
70
-        RequestInterface $request,
71
-        $return_url = ''
72
-    ) {
73
-        $this->setReturnUrl($return_url);
74
-        $this->capabilities_checker = $capabilities_checker;
75
-        $this->request = $request;
76
-        // setup up notices at priority 9 because `EE_Admin::display_admin_notices()` runs at priority 10,
77
-        // and we want to retrieve and generate any nag notices at the last possible moment
78
-        add_action('admin_notices', array($this, 'displayNotices'), 9);
79
-        add_action('network_admin_notices', array($this, 'displayNotices'), 9);
80
-        add_action('wp_ajax_dismiss_ee_nag_notice', array($this, 'dismissNotice'));
81
-        add_action('shutdown', array($this, 'registerAndSaveNotices'), 998);
82
-    }
83
-
84
-
85
-    /**
86
-     * @param string $return_url
87
-     * @throws InvalidDataTypeException
88
-     */
89
-    public function setReturnUrl($return_url)
90
-    {
91
-        if (! is_string($return_url)) {
92
-            throw new InvalidDataTypeException('$return_url', $return_url, 'string');
93
-        }
94
-        $this->return_url = $return_url;
95
-    }
96
-
97
-
98
-    /**
99
-     * @return Collection
100
-     * @throws InvalidEntityException
101
-     * @throws InvalidInterfaceException
102
-     * @throws InvalidDataTypeException
103
-     * @throws DomainException
104
-     * @throws DuplicateCollectionIdentifierException
105
-     */
106
-    protected function getPersistentAdminNoticeCollection()
107
-    {
108
-        if (! $this->notice_collection instanceof Collection) {
109
-            $this->notice_collection = new Collection(
110
-                'EventEspresso\core\domain\entities\notifications\PersistentAdminNotice'
111
-            );
112
-            $this->retrieveStoredNotices();
113
-            $this->registerNotices();
114
-        }
115
-        return $this->notice_collection;
116
-    }
117
-
118
-
119
-    /**
120
-     * generates PersistentAdminNotice objects for all non-dismissed notices saved to the db
121
-     *
122
-     * @return void
123
-     * @throws InvalidEntityException
124
-     * @throws DomainException
125
-     * @throws InvalidDataTypeException
126
-     * @throws DuplicateCollectionIdentifierException
127
-     */
128
-    protected function retrieveStoredNotices()
129
-    {
130
-        $persistent_admin_notices = get_option(PersistentAdminNoticeManager::WP_OPTION_KEY, array());
131
-        if (! empty($persistent_admin_notices)) {
132
-            foreach ($persistent_admin_notices as $name => $details) {
133
-                if (is_array($details)) {
134
-                    if (
135
-                        ! isset(
136
-                            $details['message'],
137
-                            $details['capability'],
138
-                            $details['cap_context'],
139
-                            $details['dismissed']
140
-                        )
141
-                    ) {
142
-                        throw new DomainException(
143
-                            sprintf(
144
-                                esc_html__(
145
-                                    'The "%1$s" PersistentAdminNotice could not be retrieved from the database.',
146
-                                    'event_espresso'
147
-                                ),
148
-                                $name
149
-                            )
150
-                        );
151
-                    }
152
-                    // new format for nag notices
153
-                    $this->notice_collection->add(
154
-                        new PersistentAdminNotice(
155
-                            $name,
156
-                            $details['message'],
157
-                            false,
158
-                            $details['capability'],
159
-                            $details['cap_context'],
160
-                            $details['dismissed']
161
-                        ),
162
-                        sanitize_key($name)
163
-                    );
164
-                } else {
165
-                    try {
166
-                        // old nag notices, that we want to convert to the new format
167
-                        $this->notice_collection->add(
168
-                            new PersistentAdminNotice(
169
-                                $name,
170
-                                (string) $details,
171
-                                false,
172
-                                '',
173
-                                '',
174
-                                empty($details)
175
-                            ),
176
-                            sanitize_key($name)
177
-                        );
178
-                    } catch (Exception $e) {
179
-                        EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__);
180
-                    }
181
-                }
182
-                // each notice will self register when the action hook in registerNotices is triggered
183
-            }
184
-        }
185
-    }
186
-
187
-
188
-    /**
189
-     * exposes the Persistent Admin Notice Collection via an action
190
-     * so that PersistentAdminNotice objects can be added and/or removed
191
-     * without compromising the actual collection like a filter would
192
-     */
193
-    protected function registerNotices()
194
-    {
195
-        do_action(
196
-            'AHEE__EventEspresso_core_services_notifications_PersistentAdminNoticeManager__registerNotices',
197
-            $this->notice_collection
198
-        );
199
-    }
200
-
201
-
202
-    /**
203
-     * @throws DomainException
204
-     * @throws InvalidClassException
205
-     * @throws InvalidDataTypeException
206
-     * @throws InvalidInterfaceException
207
-     * @throws InvalidEntityException
208
-     * @throws DuplicateCollectionIdentifierException
209
-     */
210
-    public function displayNotices()
211
-    {
212
-        $this->notice_collection = $this->getPersistentAdminNoticeCollection();
213
-        if ($this->notice_collection->hasObjects()) {
214
-            $enqueue_assets = false;
215
-            // and display notices
216
-            foreach ($this->notice_collection as $persistent_admin_notice) {
217
-                /** @var PersistentAdminNotice $persistent_admin_notice */
218
-                // don't display notices that have already been dismissed
219
-                if ($persistent_admin_notice->getDismissed()) {
220
-                    continue;
221
-                }
222
-                try {
223
-                    $this->capabilities_checker->processCapCheck(
224
-                        $persistent_admin_notice->getCapCheck()
225
-                    );
226
-                } catch (InsufficientPermissionsException $e) {
227
-                    // user does not have required cap, so skip to next notice
228
-                    // and just eat the exception - nom nom nom nom
229
-                    continue;
230
-                }
231
-                if ($persistent_admin_notice->getMessage() === '') {
232
-                    continue;
233
-                }
234
-                $this->displayPersistentAdminNotice($persistent_admin_notice);
235
-                $enqueue_assets = true;
236
-            }
237
-            if ($enqueue_assets) {
238
-                $this->enqueueAssets();
239
-            }
240
-        }
241
-    }
242
-
243
-
244
-    /**
245
-     * does what it's named
246
-     *
247
-     * @return void
248
-     */
249
-    public function enqueueAssets()
250
-    {
251
-        wp_register_script(
252
-            'espresso_core',
253
-            EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js',
254
-            array('jquery'),
255
-            EVENT_ESPRESSO_VERSION,
256
-            true
257
-        );
258
-        wp_register_script(
259
-            'ee_error_js',
260
-            EE_GLOBAL_ASSETS_URL . 'scripts/EE_Error.js',
261
-            array('espresso_core'),
262
-            EVENT_ESPRESSO_VERSION,
263
-            true
264
-        );
265
-        wp_localize_script(
266
-            'ee_error_js',
267
-            'ee_dismiss',
268
-            array(
269
-                'return_url'    => urlencode($this->return_url),
270
-                'ajax_url'      => WP_AJAX_URL,
271
-                'unknown_error' => wp_strip_all_tags(
272
-                    __(
273
-                        'An unknown error has occurred on the server while attempting to dismiss this notice.',
274
-                        'event_espresso'
275
-                    )
276
-                ),
277
-            )
278
-        );
279
-        wp_enqueue_script('ee_error_js');
280
-    }
281
-
282
-
283
-    /**
284
-     * displayPersistentAdminNoticeHtml
285
-     *
286
-     * @param  PersistentAdminNotice $persistent_admin_notice
287
-     */
288
-    protected function displayPersistentAdminNotice(PersistentAdminNotice $persistent_admin_notice)
289
-    {
290
-        // used in template
291
-        $persistent_admin_notice_name = $persistent_admin_notice->getName();
292
-        $persistent_admin_notice_message = $persistent_admin_notice->getMessage();
293
-        require EE_TEMPLATES . '/notifications/persistent_admin_notice.template.php';
294
-    }
295
-
296
-
297
-    /**
298
-     * dismissNotice
299
-     *
300
-     * @param string $pan_name the name, or key of the Persistent Admin Notice to be dismissed
301
-     * @param bool   $purge    if true, then delete it from the db
302
-     * @param bool   $return   forget all of this AJAX or redirect nonsense, and just return
303
-     * @return void
304
-     * @throws InvalidEntityException
305
-     * @throws InvalidInterfaceException
306
-     * @throws InvalidDataTypeException
307
-     * @throws DomainException
308
-     * @throws InvalidArgumentException
309
-     * @throws InvalidArgumentException
310
-     * @throws InvalidArgumentException
311
-     * @throws InvalidArgumentException
312
-     * @throws DuplicateCollectionIdentifierException
313
-     */
314
-    public function dismissNotice($pan_name = '', $purge = false, $return = false)
315
-    {
316
-        $pan_name = $this->request->getRequestParam('ee_nag_notice', $pan_name);
317
-        $this->notice_collection = $this->getPersistentAdminNoticeCollection();
318
-        if (! empty($pan_name) && $this->notice_collection->has($pan_name)) {
319
-            /** @var PersistentAdminNotice $persistent_admin_notice */
320
-            $persistent_admin_notice = $this->notice_collection->get($pan_name);
321
-            $persistent_admin_notice->setDismissed(true);
322
-            $persistent_admin_notice->setPurge($purge);
323
-            $this->saveNotices();
324
-        }
325
-        if ($return) {
326
-            return;
327
-        }
328
-        if ($this->request->isAjax()) {
329
-            // grab any notices and concatenate into string
330
-            echo wp_json_encode(
331
-                array(
332
-                    'errors' => implode('<br />', EE_Error::get_notices(false)),
333
-                )
334
-            );
335
-            exit();
336
-        }
337
-        // save errors to a transient to be displayed on next request (after redirect)
338
-        EE_Error::get_notices(false, true);
339
-        wp_safe_redirect(
340
-            urldecode(
341
-                $this->request->getRequestParam('return_url', '')
342
-            )
343
-        );
344
-    }
345
-
346
-
347
-    /**
348
-     * saveNotices
349
-     *
350
-     * @throws DomainException
351
-     * @throws InvalidDataTypeException
352
-     * @throws InvalidInterfaceException
353
-     * @throws InvalidEntityException
354
-     * @throws DuplicateCollectionIdentifierException
355
-     */
356
-    public function saveNotices()
357
-    {
358
-        $this->notice_collection = $this->getPersistentAdminNoticeCollection();
359
-        if ($this->notice_collection->hasObjects()) {
360
-            $persistent_admin_notices = get_option(PersistentAdminNoticeManager::WP_OPTION_KEY, array());
361
-            // maybe initialize persistent_admin_notices
362
-            if (empty($persistent_admin_notices)) {
363
-                add_option(PersistentAdminNoticeManager::WP_OPTION_KEY, array(), '', 'no');
364
-            }
365
-            foreach ($this->notice_collection as $persistent_admin_notice) {
366
-                // are we deleting this notice ?
367
-                if ($persistent_admin_notice->getPurge()) {
368
-                    unset($persistent_admin_notices[ $persistent_admin_notice->getName() ]);
369
-                } else {
370
-                    /** @var PersistentAdminNotice $persistent_admin_notice */
371
-                    $persistent_admin_notices[ $persistent_admin_notice->getName() ] = array(
372
-                        'message'     => $persistent_admin_notice->getMessage(),
373
-                        'capability'  => $persistent_admin_notice->getCapability(),
374
-                        'cap_context' => $persistent_admin_notice->getCapContext(),
375
-                        'dismissed'   => $persistent_admin_notice->getDismissed(),
376
-                    );
377
-                }
378
-            }
379
-            update_option(PersistentAdminNoticeManager::WP_OPTION_KEY, $persistent_admin_notices);
380
-        }
381
-    }
382
-
383
-
384
-    /**
385
-     * @throws DomainException
386
-     * @throws InvalidDataTypeException
387
-     * @throws InvalidEntityException
388
-     * @throws InvalidInterfaceException
389
-     * @throws DuplicateCollectionIdentifierException
390
-     */
391
-    public function registerAndSaveNotices()
392
-    {
393
-        $this->getPersistentAdminNoticeCollection();
394
-        $this->registerNotices();
395
-        $this->saveNotices();
396
-        add_filter(
397
-            'PersistentAdminNoticeManager__registerAndSaveNotices__complete',
398
-            '__return_true'
399
-        );
400
-    }
401
-
402
-
403
-    /**
404
-     * @throws DomainException
405
-     * @throws InvalidDataTypeException
406
-     * @throws InvalidEntityException
407
-     * @throws InvalidInterfaceException
408
-     * @throws InvalidArgumentException
409
-     * @throws DuplicateCollectionIdentifierException
410
-     */
411
-    public static function loadRegisterAndSaveNotices()
412
-    {
413
-        /** @var PersistentAdminNoticeManager $persistent_admin_notice_manager */
414
-        $persistent_admin_notice_manager = LoaderFactory::getLoader()->getShared(
415
-            'EventEspresso\core\services\notifications\PersistentAdminNoticeManager'
416
-        );
417
-        // if shutdown has already run, then call registerAndSaveNotices() manually
418
-        if (did_action('shutdown')) {
419
-            $persistent_admin_notice_manager->registerAndSaveNotices();
420
-        }
421
-    }
34
+	const WP_OPTION_KEY = 'ee_pers_admin_notices';
35
+
36
+	/**
37
+	 * @var Collection|PersistentAdminNotice[] $notice_collection
38
+	 */
39
+	private $notice_collection;
40
+
41
+	/**
42
+	 * if AJAX is not enabled, then the return URL will be used for redirecting back to the admin page where the
43
+	 * persistent admin notice was displayed, and ultimately dismissed from.
44
+	 *
45
+	 * @var string $return_url
46
+	 */
47
+	private $return_url;
48
+
49
+	/**
50
+	 * @var CapabilitiesChecker $capabilities_checker
51
+	 */
52
+	private $capabilities_checker;
53
+
54
+	/**
55
+	 * @var RequestInterface $request
56
+	 */
57
+	private $request;
58
+
59
+
60
+	/**
61
+	 * PersistentAdminNoticeManager constructor
62
+	 *
63
+	 * @param CapabilitiesChecker $capabilities_checker
64
+	 * @param RequestInterface    $request
65
+	 * @param string              $return_url where to  redirect to after dismissing notices
66
+	 * @throws InvalidDataTypeException
67
+	 */
68
+	public function __construct(
69
+		CapabilitiesChecker $capabilities_checker,
70
+		RequestInterface $request,
71
+		$return_url = ''
72
+	) {
73
+		$this->setReturnUrl($return_url);
74
+		$this->capabilities_checker = $capabilities_checker;
75
+		$this->request = $request;
76
+		// setup up notices at priority 9 because `EE_Admin::display_admin_notices()` runs at priority 10,
77
+		// and we want to retrieve and generate any nag notices at the last possible moment
78
+		add_action('admin_notices', array($this, 'displayNotices'), 9);
79
+		add_action('network_admin_notices', array($this, 'displayNotices'), 9);
80
+		add_action('wp_ajax_dismiss_ee_nag_notice', array($this, 'dismissNotice'));
81
+		add_action('shutdown', array($this, 'registerAndSaveNotices'), 998);
82
+	}
83
+
84
+
85
+	/**
86
+	 * @param string $return_url
87
+	 * @throws InvalidDataTypeException
88
+	 */
89
+	public function setReturnUrl($return_url)
90
+	{
91
+		if (! is_string($return_url)) {
92
+			throw new InvalidDataTypeException('$return_url', $return_url, 'string');
93
+		}
94
+		$this->return_url = $return_url;
95
+	}
96
+
97
+
98
+	/**
99
+	 * @return Collection
100
+	 * @throws InvalidEntityException
101
+	 * @throws InvalidInterfaceException
102
+	 * @throws InvalidDataTypeException
103
+	 * @throws DomainException
104
+	 * @throws DuplicateCollectionIdentifierException
105
+	 */
106
+	protected function getPersistentAdminNoticeCollection()
107
+	{
108
+		if (! $this->notice_collection instanceof Collection) {
109
+			$this->notice_collection = new Collection(
110
+				'EventEspresso\core\domain\entities\notifications\PersistentAdminNotice'
111
+			);
112
+			$this->retrieveStoredNotices();
113
+			$this->registerNotices();
114
+		}
115
+		return $this->notice_collection;
116
+	}
117
+
118
+
119
+	/**
120
+	 * generates PersistentAdminNotice objects for all non-dismissed notices saved to the db
121
+	 *
122
+	 * @return void
123
+	 * @throws InvalidEntityException
124
+	 * @throws DomainException
125
+	 * @throws InvalidDataTypeException
126
+	 * @throws DuplicateCollectionIdentifierException
127
+	 */
128
+	protected function retrieveStoredNotices()
129
+	{
130
+		$persistent_admin_notices = get_option(PersistentAdminNoticeManager::WP_OPTION_KEY, array());
131
+		if (! empty($persistent_admin_notices)) {
132
+			foreach ($persistent_admin_notices as $name => $details) {
133
+				if (is_array($details)) {
134
+					if (
135
+						! isset(
136
+							$details['message'],
137
+							$details['capability'],
138
+							$details['cap_context'],
139
+							$details['dismissed']
140
+						)
141
+					) {
142
+						throw new DomainException(
143
+							sprintf(
144
+								esc_html__(
145
+									'The "%1$s" PersistentAdminNotice could not be retrieved from the database.',
146
+									'event_espresso'
147
+								),
148
+								$name
149
+							)
150
+						);
151
+					}
152
+					// new format for nag notices
153
+					$this->notice_collection->add(
154
+						new PersistentAdminNotice(
155
+							$name,
156
+							$details['message'],
157
+							false,
158
+							$details['capability'],
159
+							$details['cap_context'],
160
+							$details['dismissed']
161
+						),
162
+						sanitize_key($name)
163
+					);
164
+				} else {
165
+					try {
166
+						// old nag notices, that we want to convert to the new format
167
+						$this->notice_collection->add(
168
+							new PersistentAdminNotice(
169
+								$name,
170
+								(string) $details,
171
+								false,
172
+								'',
173
+								'',
174
+								empty($details)
175
+							),
176
+							sanitize_key($name)
177
+						);
178
+					} catch (Exception $e) {
179
+						EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__);
180
+					}
181
+				}
182
+				// each notice will self register when the action hook in registerNotices is triggered
183
+			}
184
+		}
185
+	}
186
+
187
+
188
+	/**
189
+	 * exposes the Persistent Admin Notice Collection via an action
190
+	 * so that PersistentAdminNotice objects can be added and/or removed
191
+	 * without compromising the actual collection like a filter would
192
+	 */
193
+	protected function registerNotices()
194
+	{
195
+		do_action(
196
+			'AHEE__EventEspresso_core_services_notifications_PersistentAdminNoticeManager__registerNotices',
197
+			$this->notice_collection
198
+		);
199
+	}
200
+
201
+
202
+	/**
203
+	 * @throws DomainException
204
+	 * @throws InvalidClassException
205
+	 * @throws InvalidDataTypeException
206
+	 * @throws InvalidInterfaceException
207
+	 * @throws InvalidEntityException
208
+	 * @throws DuplicateCollectionIdentifierException
209
+	 */
210
+	public function displayNotices()
211
+	{
212
+		$this->notice_collection = $this->getPersistentAdminNoticeCollection();
213
+		if ($this->notice_collection->hasObjects()) {
214
+			$enqueue_assets = false;
215
+			// and display notices
216
+			foreach ($this->notice_collection as $persistent_admin_notice) {
217
+				/** @var PersistentAdminNotice $persistent_admin_notice */
218
+				// don't display notices that have already been dismissed
219
+				if ($persistent_admin_notice->getDismissed()) {
220
+					continue;
221
+				}
222
+				try {
223
+					$this->capabilities_checker->processCapCheck(
224
+						$persistent_admin_notice->getCapCheck()
225
+					);
226
+				} catch (InsufficientPermissionsException $e) {
227
+					// user does not have required cap, so skip to next notice
228
+					// and just eat the exception - nom nom nom nom
229
+					continue;
230
+				}
231
+				if ($persistent_admin_notice->getMessage() === '') {
232
+					continue;
233
+				}
234
+				$this->displayPersistentAdminNotice($persistent_admin_notice);
235
+				$enqueue_assets = true;
236
+			}
237
+			if ($enqueue_assets) {
238
+				$this->enqueueAssets();
239
+			}
240
+		}
241
+	}
242
+
243
+
244
+	/**
245
+	 * does what it's named
246
+	 *
247
+	 * @return void
248
+	 */
249
+	public function enqueueAssets()
250
+	{
251
+		wp_register_script(
252
+			'espresso_core',
253
+			EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js',
254
+			array('jquery'),
255
+			EVENT_ESPRESSO_VERSION,
256
+			true
257
+		);
258
+		wp_register_script(
259
+			'ee_error_js',
260
+			EE_GLOBAL_ASSETS_URL . 'scripts/EE_Error.js',
261
+			array('espresso_core'),
262
+			EVENT_ESPRESSO_VERSION,
263
+			true
264
+		);
265
+		wp_localize_script(
266
+			'ee_error_js',
267
+			'ee_dismiss',
268
+			array(
269
+				'return_url'    => urlencode($this->return_url),
270
+				'ajax_url'      => WP_AJAX_URL,
271
+				'unknown_error' => wp_strip_all_tags(
272
+					__(
273
+						'An unknown error has occurred on the server while attempting to dismiss this notice.',
274
+						'event_espresso'
275
+					)
276
+				),
277
+			)
278
+		);
279
+		wp_enqueue_script('ee_error_js');
280
+	}
281
+
282
+
283
+	/**
284
+	 * displayPersistentAdminNoticeHtml
285
+	 *
286
+	 * @param  PersistentAdminNotice $persistent_admin_notice
287
+	 */
288
+	protected function displayPersistentAdminNotice(PersistentAdminNotice $persistent_admin_notice)
289
+	{
290
+		// used in template
291
+		$persistent_admin_notice_name = $persistent_admin_notice->getName();
292
+		$persistent_admin_notice_message = $persistent_admin_notice->getMessage();
293
+		require EE_TEMPLATES . '/notifications/persistent_admin_notice.template.php';
294
+	}
295
+
296
+
297
+	/**
298
+	 * dismissNotice
299
+	 *
300
+	 * @param string $pan_name the name, or key of the Persistent Admin Notice to be dismissed
301
+	 * @param bool   $purge    if true, then delete it from the db
302
+	 * @param bool   $return   forget all of this AJAX or redirect nonsense, and just return
303
+	 * @return void
304
+	 * @throws InvalidEntityException
305
+	 * @throws InvalidInterfaceException
306
+	 * @throws InvalidDataTypeException
307
+	 * @throws DomainException
308
+	 * @throws InvalidArgumentException
309
+	 * @throws InvalidArgumentException
310
+	 * @throws InvalidArgumentException
311
+	 * @throws InvalidArgumentException
312
+	 * @throws DuplicateCollectionIdentifierException
313
+	 */
314
+	public function dismissNotice($pan_name = '', $purge = false, $return = false)
315
+	{
316
+		$pan_name = $this->request->getRequestParam('ee_nag_notice', $pan_name);
317
+		$this->notice_collection = $this->getPersistentAdminNoticeCollection();
318
+		if (! empty($pan_name) && $this->notice_collection->has($pan_name)) {
319
+			/** @var PersistentAdminNotice $persistent_admin_notice */
320
+			$persistent_admin_notice = $this->notice_collection->get($pan_name);
321
+			$persistent_admin_notice->setDismissed(true);
322
+			$persistent_admin_notice->setPurge($purge);
323
+			$this->saveNotices();
324
+		}
325
+		if ($return) {
326
+			return;
327
+		}
328
+		if ($this->request->isAjax()) {
329
+			// grab any notices and concatenate into string
330
+			echo wp_json_encode(
331
+				array(
332
+					'errors' => implode('<br />', EE_Error::get_notices(false)),
333
+				)
334
+			);
335
+			exit();
336
+		}
337
+		// save errors to a transient to be displayed on next request (after redirect)
338
+		EE_Error::get_notices(false, true);
339
+		wp_safe_redirect(
340
+			urldecode(
341
+				$this->request->getRequestParam('return_url', '')
342
+			)
343
+		);
344
+	}
345
+
346
+
347
+	/**
348
+	 * saveNotices
349
+	 *
350
+	 * @throws DomainException
351
+	 * @throws InvalidDataTypeException
352
+	 * @throws InvalidInterfaceException
353
+	 * @throws InvalidEntityException
354
+	 * @throws DuplicateCollectionIdentifierException
355
+	 */
356
+	public function saveNotices()
357
+	{
358
+		$this->notice_collection = $this->getPersistentAdminNoticeCollection();
359
+		if ($this->notice_collection->hasObjects()) {
360
+			$persistent_admin_notices = get_option(PersistentAdminNoticeManager::WP_OPTION_KEY, array());
361
+			// maybe initialize persistent_admin_notices
362
+			if (empty($persistent_admin_notices)) {
363
+				add_option(PersistentAdminNoticeManager::WP_OPTION_KEY, array(), '', 'no');
364
+			}
365
+			foreach ($this->notice_collection as $persistent_admin_notice) {
366
+				// are we deleting this notice ?
367
+				if ($persistent_admin_notice->getPurge()) {
368
+					unset($persistent_admin_notices[ $persistent_admin_notice->getName() ]);
369
+				} else {
370
+					/** @var PersistentAdminNotice $persistent_admin_notice */
371
+					$persistent_admin_notices[ $persistent_admin_notice->getName() ] = array(
372
+						'message'     => $persistent_admin_notice->getMessage(),
373
+						'capability'  => $persistent_admin_notice->getCapability(),
374
+						'cap_context' => $persistent_admin_notice->getCapContext(),
375
+						'dismissed'   => $persistent_admin_notice->getDismissed(),
376
+					);
377
+				}
378
+			}
379
+			update_option(PersistentAdminNoticeManager::WP_OPTION_KEY, $persistent_admin_notices);
380
+		}
381
+	}
382
+
383
+
384
+	/**
385
+	 * @throws DomainException
386
+	 * @throws InvalidDataTypeException
387
+	 * @throws InvalidEntityException
388
+	 * @throws InvalidInterfaceException
389
+	 * @throws DuplicateCollectionIdentifierException
390
+	 */
391
+	public function registerAndSaveNotices()
392
+	{
393
+		$this->getPersistentAdminNoticeCollection();
394
+		$this->registerNotices();
395
+		$this->saveNotices();
396
+		add_filter(
397
+			'PersistentAdminNoticeManager__registerAndSaveNotices__complete',
398
+			'__return_true'
399
+		);
400
+	}
401
+
402
+
403
+	/**
404
+	 * @throws DomainException
405
+	 * @throws InvalidDataTypeException
406
+	 * @throws InvalidEntityException
407
+	 * @throws InvalidInterfaceException
408
+	 * @throws InvalidArgumentException
409
+	 * @throws DuplicateCollectionIdentifierException
410
+	 */
411
+	public static function loadRegisterAndSaveNotices()
412
+	{
413
+		/** @var PersistentAdminNoticeManager $persistent_admin_notice_manager */
414
+		$persistent_admin_notice_manager = LoaderFactory::getLoader()->getShared(
415
+			'EventEspresso\core\services\notifications\PersistentAdminNoticeManager'
416
+		);
417
+		// if shutdown has already run, then call registerAndSaveNotices() manually
418
+		if (did_action('shutdown')) {
419
+			$persistent_admin_notice_manager->registerAndSaveNotices();
420
+		}
421
+	}
422 422
 }
Please login to merge, or discard this patch.
core/domain/values/assets/Asset.php 1 patch
Indentation   +179 added lines, -179 removed lines patch added patch discarded remove patch
@@ -15,183 +15,183 @@
 block discarded – undo
15 15
  */
16 16
 abstract class Asset
17 17
 {
18
-    /**
19
-     * indicates the file extension for a CSS file
20
-     */
21
-    const EXT_CSS = '.css';
22
-
23
-    /**
24
-     * indicates the file extension for a JS file
25
-     */
26
-    const EXT_JS = '.js';
27
-
28
-    /**
29
-     * indicates the file extension for a JS file
30
-     */
31
-    const EXT_PHP = '.php';
32
-
33
-    /**
34
-     * indicates the file extension for a build distribution CSS file
35
-     */
36
-    const FILE_EXTENSION_DISTRIBUTION_CSS = '.dist.css';
37
-
38
-    /**
39
-     * indicates the file extension for a build distribution JS file
40
-     */
41
-    const FILE_EXTENSION_DISTRIBUTION_JS = '.dist.js';
42
-
43
-    /**
44
-     * Indicates the file extension for a build distribution dependencies json file.
45
-     */
46
-    const FILE_EXTENSION_DISTRIBUTION_DEPS = '.dist.deps.php';
47
-
48
-    /**
49
-     * indicates a Cascading Style Sheet asset
50
-     */
51
-    const TYPE_CSS = 'css';
52
-
53
-    /**
54
-     * indicates a Javascript asset
55
-     */
56
-    const TYPE_JS = 'js';
57
-
58
-    /**
59
-     * indicates a JSON asset
60
-     */
61
-    CONST TYPE_JSON = 'json';
62
-    /**
63
-     * indicates a PHP asset
64
-     */
65
-    CONST TYPE_PHP = 'php';
66
-
67
-    /**
68
-     * indicates a Javascript manifest file
69
-     */
70
-    const TYPE_MANIFEST = 'manifest';
71
-
72
-    /**
73
-     * @var DomainInterface $domain
74
-     */
75
-    protected $domain;
76
-
77
-    /**
78
-     * @var string $type
79
-     */
80
-    private $type;
81
-
82
-    /**
83
-     * @var string $handle
84
-     */
85
-    private $handle;
86
-
87
-    /**
88
-     * @var bool $registered
89
-     */
90
-    private $registered = false;
91
-
92
-
93
-    /**
94
-     * Asset constructor.
95
-     *
96
-     * @param                 $type
97
-     * @param string          $handle
98
-     * @param DomainInterface $domain
99
-     * @throws InvalidDataTypeException
100
-     */
101
-    public function __construct($type, $handle, DomainInterface $domain)
102
-    {
103
-        $this->domain = $domain;
104
-        $this->setType($type);
105
-        $this->setHandle($handle);
106
-    }
107
-
108
-
109
-    /**
110
-     * @return array
111
-     */
112
-    public function validAssetTypes()
113
-    {
114
-        return array(
115
-            Asset::TYPE_CSS,
116
-            Asset::TYPE_JS,
117
-            Asset::TYPE_MANIFEST,
118
-        );
119
-    }
120
-
121
-
122
-    /**
123
-     * @param string $type
124
-     * @throws InvalidDataTypeException
125
-     */
126
-    private function setType($type)
127
-    {
128
-        if (! in_array($type, $this->validAssetTypes(), true)) {
129
-            throw new InvalidDataTypeException(
130
-                'Asset::$type',
131
-                $type,
132
-                'one of the TYPE_* class constants on \EventEspresso\core\domain\values\Asset is required'
133
-            );
134
-        }
135
-        $this->type = $type;
136
-    }
137
-
138
-
139
-    /**
140
-     * @param string $handle
141
-     * @throws InvalidDataTypeException
142
-     */
143
-    private function setHandle($handle)
144
-    {
145
-        if (! is_string($handle)) {
146
-            throw new InvalidDataTypeException(
147
-                '$handle',
148
-                $handle,
149
-                'string'
150
-            );
151
-        }
152
-        $this->handle = $handle;
153
-    }
154
-
155
-
156
-    /**
157
-     * @return string
158
-     */
159
-    public function assetNamespace()
160
-    {
161
-        return $this->domain->assetNamespace();
162
-    }
163
-
164
-
165
-    /**
166
-     * @return string
167
-     */
168
-    public function type()
169
-    {
170
-        return $this->type;
171
-    }
172
-
173
-
174
-    /**
175
-     * @return string
176
-     */
177
-    public function handle()
178
-    {
179
-        return $this->handle;
180
-    }
181
-
182
-    /**
183
-     * @return bool
184
-     */
185
-    public function isRegistered()
186
-    {
187
-        return $this->registered;
188
-    }
189
-
190
-    /**
191
-     * @param bool $registered
192
-     */
193
-    public function setRegistered($registered = true)
194
-    {
195
-        $this->registered = filter_var($registered, FILTER_VALIDATE_BOOLEAN);
196
-    }
18
+	/**
19
+	 * indicates the file extension for a CSS file
20
+	 */
21
+	const EXT_CSS = '.css';
22
+
23
+	/**
24
+	 * indicates the file extension for a JS file
25
+	 */
26
+	const EXT_JS = '.js';
27
+
28
+	/**
29
+	 * indicates the file extension for a JS file
30
+	 */
31
+	const EXT_PHP = '.php';
32
+
33
+	/**
34
+	 * indicates the file extension for a build distribution CSS file
35
+	 */
36
+	const FILE_EXTENSION_DISTRIBUTION_CSS = '.dist.css';
37
+
38
+	/**
39
+	 * indicates the file extension for a build distribution JS file
40
+	 */
41
+	const FILE_EXTENSION_DISTRIBUTION_JS = '.dist.js';
42
+
43
+	/**
44
+	 * Indicates the file extension for a build distribution dependencies json file.
45
+	 */
46
+	const FILE_EXTENSION_DISTRIBUTION_DEPS = '.dist.deps.php';
47
+
48
+	/**
49
+	 * indicates a Cascading Style Sheet asset
50
+	 */
51
+	const TYPE_CSS = 'css';
52
+
53
+	/**
54
+	 * indicates a Javascript asset
55
+	 */
56
+	const TYPE_JS = 'js';
57
+
58
+	/**
59
+	 * indicates a JSON asset
60
+	 */
61
+	CONST TYPE_JSON = 'json';
62
+	/**
63
+	 * indicates a PHP asset
64
+	 */
65
+	CONST TYPE_PHP = 'php';
66
+
67
+	/**
68
+	 * indicates a Javascript manifest file
69
+	 */
70
+	const TYPE_MANIFEST = 'manifest';
71
+
72
+	/**
73
+	 * @var DomainInterface $domain
74
+	 */
75
+	protected $domain;
76
+
77
+	/**
78
+	 * @var string $type
79
+	 */
80
+	private $type;
81
+
82
+	/**
83
+	 * @var string $handle
84
+	 */
85
+	private $handle;
86
+
87
+	/**
88
+	 * @var bool $registered
89
+	 */
90
+	private $registered = false;
91
+
92
+
93
+	/**
94
+	 * Asset constructor.
95
+	 *
96
+	 * @param                 $type
97
+	 * @param string          $handle
98
+	 * @param DomainInterface $domain
99
+	 * @throws InvalidDataTypeException
100
+	 */
101
+	public function __construct($type, $handle, DomainInterface $domain)
102
+	{
103
+		$this->domain = $domain;
104
+		$this->setType($type);
105
+		$this->setHandle($handle);
106
+	}
107
+
108
+
109
+	/**
110
+	 * @return array
111
+	 */
112
+	public function validAssetTypes()
113
+	{
114
+		return array(
115
+			Asset::TYPE_CSS,
116
+			Asset::TYPE_JS,
117
+			Asset::TYPE_MANIFEST,
118
+		);
119
+	}
120
+
121
+
122
+	/**
123
+	 * @param string $type
124
+	 * @throws InvalidDataTypeException
125
+	 */
126
+	private function setType($type)
127
+	{
128
+		if (! in_array($type, $this->validAssetTypes(), true)) {
129
+			throw new InvalidDataTypeException(
130
+				'Asset::$type',
131
+				$type,
132
+				'one of the TYPE_* class constants on \EventEspresso\core\domain\values\Asset is required'
133
+			);
134
+		}
135
+		$this->type = $type;
136
+	}
137
+
138
+
139
+	/**
140
+	 * @param string $handle
141
+	 * @throws InvalidDataTypeException
142
+	 */
143
+	private function setHandle($handle)
144
+	{
145
+		if (! is_string($handle)) {
146
+			throw new InvalidDataTypeException(
147
+				'$handle',
148
+				$handle,
149
+				'string'
150
+			);
151
+		}
152
+		$this->handle = $handle;
153
+	}
154
+
155
+
156
+	/**
157
+	 * @return string
158
+	 */
159
+	public function assetNamespace()
160
+	{
161
+		return $this->domain->assetNamespace();
162
+	}
163
+
164
+
165
+	/**
166
+	 * @return string
167
+	 */
168
+	public function type()
169
+	{
170
+		return $this->type;
171
+	}
172
+
173
+
174
+	/**
175
+	 * @return string
176
+	 */
177
+	public function handle()
178
+	{
179
+		return $this->handle;
180
+	}
181
+
182
+	/**
183
+	 * @return bool
184
+	 */
185
+	public function isRegistered()
186
+	{
187
+		return $this->registered;
188
+	}
189
+
190
+	/**
191
+	 * @param bool $registered
192
+	 */
193
+	public function setRegistered($registered = true)
194
+	{
195
+		$this->registered = filter_var($registered, FILTER_VALIDATE_BOOLEAN);
196
+	}
197 197
 }
Please login to merge, or discard this patch.
core/EE_Dependency_Map.core.php 1 patch
Indentation   +1169 added lines, -1169 removed lines patch added patch discarded remove patch
@@ -20,1173 +20,1173 @@
 block discarded – undo
20 20
 class EE_Dependency_Map
21 21
 {
22 22
 
23
-    /**
24
-     * This means that the requested class dependency is not present in the dependency map
25
-     */
26
-    const not_registered = 0;
27
-
28
-    /**
29
-     * This instructs class loaders to ALWAYS return a newly instantiated object for the requested class.
30
-     */
31
-    const load_new_object = 1;
32
-
33
-    /**
34
-     * This instructs class loaders to return a previously instantiated and cached object for the requested class.
35
-     * IF a previously instantiated object does not exist, a new one will be created and added to the cache.
36
-     */
37
-    const load_from_cache = 2;
38
-
39
-    /**
40
-     * When registering a dependency,
41
-     * this indicates to keep any existing dependencies that already exist,
42
-     * and simply discard any new dependencies declared in the incoming data
43
-     */
44
-    const KEEP_EXISTING_DEPENDENCIES = 0;
45
-
46
-    /**
47
-     * When registering a dependency,
48
-     * this indicates to overwrite any existing dependencies that already exist using the incoming data
49
-     */
50
-    const OVERWRITE_DEPENDENCIES = 1;
51
-
52
-
53
-    /**
54
-     * @type EE_Dependency_Map $_instance
55
-     */
56
-    protected static $_instance;
57
-
58
-    /**
59
-     * @var ClassInterfaceCache $class_cache
60
-     */
61
-    private $class_cache;
62
-
63
-    /**
64
-     * @type RequestInterface $request
65
-     */
66
-    protected $request;
67
-
68
-    /**
69
-     * @type LegacyRequestInterface $legacy_request
70
-     */
71
-    protected $legacy_request;
72
-
73
-    /**
74
-     * @type ResponseInterface $response
75
-     */
76
-    protected $response;
77
-
78
-    /**
79
-     * @type LoaderInterface $loader
80
-     */
81
-    protected $loader;
82
-
83
-    /**
84
-     * @type array $_dependency_map
85
-     */
86
-    protected $_dependency_map = [];
87
-
88
-    /**
89
-     * @type array $_class_loaders
90
-     */
91
-    protected $_class_loaders = [];
92
-
93
-
94
-    /**
95
-     * EE_Dependency_Map constructor.
96
-     *
97
-     * @param ClassInterfaceCache $class_cache
98
-     */
99
-    protected function __construct(ClassInterfaceCache $class_cache)
100
-    {
101
-        $this->class_cache = $class_cache;
102
-        do_action('EE_Dependency_Map____construct', $this);
103
-    }
104
-
105
-
106
-    /**
107
-     * @return void
108
-     */
109
-    public function initialize()
110
-    {
111
-        $this->_register_core_dependencies();
112
-        $this->_register_core_class_loaders();
113
-        $this->_register_core_aliases();
114
-    }
115
-
116
-
117
-    /**
118
-     * @singleton method used to instantiate class object
119
-     * @param ClassInterfaceCache|null $class_cache
120
-     * @return EE_Dependency_Map
121
-     */
122
-    public static function instance(ClassInterfaceCache $class_cache = null)
123
-    {
124
-        // check if class object is instantiated, and instantiated properly
125
-        if (
126
-            ! self::$_instance instanceof EE_Dependency_Map
127
-            && $class_cache instanceof ClassInterfaceCache
128
-        ) {
129
-            self::$_instance = new EE_Dependency_Map($class_cache);
130
-        }
131
-        return self::$_instance;
132
-    }
133
-
134
-
135
-    /**
136
-     * @param RequestInterface $request
137
-     */
138
-    public function setRequest(RequestInterface $request)
139
-    {
140
-        $this->request = $request;
141
-    }
142
-
143
-
144
-    /**
145
-     * @param LegacyRequestInterface $legacy_request
146
-     */
147
-    public function setLegacyRequest(LegacyRequestInterface $legacy_request)
148
-    {
149
-        $this->legacy_request = $legacy_request;
150
-    }
151
-
152
-
153
-    /**
154
-     * @param ResponseInterface $response
155
-     */
156
-    public function setResponse(ResponseInterface $response)
157
-    {
158
-        $this->response = $response;
159
-    }
160
-
161
-
162
-    /**
163
-     * @param LoaderInterface $loader
164
-     */
165
-    public function setLoader(LoaderInterface $loader)
166
-    {
167
-        $this->loader = $loader;
168
-    }
169
-
170
-
171
-    /**
172
-     * @param string $class
173
-     * @param array  $dependencies
174
-     * @param int    $overwrite
175
-     * @return bool
176
-     */
177
-    public static function register_dependencies(
178
-        $class,
179
-        array $dependencies,
180
-        $overwrite = EE_Dependency_Map::KEEP_EXISTING_DEPENDENCIES
181
-    ) {
182
-        return self::$_instance->registerDependencies($class, $dependencies, $overwrite);
183
-    }
184
-
185
-
186
-    /**
187
-     * Assigns an array of class names and corresponding load sources (new or cached)
188
-     * to the class specified by the first parameter.
189
-     * IMPORTANT !!!
190
-     * The order of elements in the incoming $dependencies array MUST match
191
-     * the order of the constructor parameters for the class in question.
192
-     * This is especially important when overriding any existing dependencies that are registered.
193
-     * the third parameter controls whether any duplicate dependencies are overwritten or not.
194
-     *
195
-     * @param string $class
196
-     * @param array  $dependencies
197
-     * @param int    $overwrite
198
-     * @return bool
199
-     */
200
-    public function registerDependencies(
201
-        $class,
202
-        array $dependencies,
203
-        $overwrite = EE_Dependency_Map::KEEP_EXISTING_DEPENDENCIES
204
-    ) {
205
-        $class      = trim($class, '\\');
206
-        $registered = false;
207
-        if (empty(self::$_instance->_dependency_map[ $class ])) {
208
-            self::$_instance->_dependency_map[ $class ] = [];
209
-        }
210
-        // we need to make sure that any aliases used when registering a dependency
211
-        // get resolved to the correct class name
212
-        foreach ($dependencies as $dependency => $load_source) {
213
-            $alias = self::$_instance->getFqnForAlias($dependency);
214
-            if (
215
-                $overwrite === EE_Dependency_Map::OVERWRITE_DEPENDENCIES
216
-                || ! isset(self::$_instance->_dependency_map[ $class ][ $alias ])
217
-            ) {
218
-                unset($dependencies[ $dependency ]);
219
-                $dependencies[ $alias ] = $load_source;
220
-                $registered             = true;
221
-            }
222
-        }
223
-        // now add our two lists of dependencies together.
224
-        // using Union (+=) favours the arrays in precedence from left to right,
225
-        // so $dependencies is NOT overwritten because it is listed first
226
-        // ie: with A = B + C, entries in B take precedence over duplicate entries in C
227
-        // Union is way faster than array_merge() but should be used with caution...
228
-        // especially with numerically indexed arrays
229
-        $dependencies += self::$_instance->_dependency_map[ $class ];
230
-        // now we need to ensure that the resulting dependencies
231
-        // array only has the entries that are required for the class
232
-        // so first count how many dependencies were originally registered for the class
233
-        $dependency_count = count(self::$_instance->_dependency_map[ $class ]);
234
-        // if that count is non-zero (meaning dependencies were already registered)
235
-        self::$_instance->_dependency_map[ $class ] = $dependency_count
236
-            // then truncate the  final array to match that count
237
-            ? array_slice($dependencies, 0, $dependency_count)
238
-            // otherwise just take the incoming array because nothing previously existed
239
-            : $dependencies;
240
-        return $registered;
241
-    }
242
-
243
-
244
-    /**
245
-     * @param string $class_name
246
-     * @param string $loader
247
-     * @param bool   $overwrite
248
-     * @return bool
249
-     * @throws DomainException
250
-     */
251
-    public static function register_class_loader($class_name, $loader = 'load_core', $overwrite = false)
252
-    {
253
-        if (! $loader instanceof Closure && strpos($class_name, '\\') !== false) {
254
-            throw new DomainException(
255
-                esc_html__('Don\'t use class loaders for FQCNs.', 'event_espresso')
256
-            );
257
-        }
258
-        // check that loader is callable or method starts with "load_" and exists in EE_Registry
259
-        if (
260
-            ! is_callable($loader)
261
-            && (
262
-                strpos($loader, 'load_') !== 0
263
-                || ! method_exists('EE_Registry', $loader)
264
-            )
265
-        ) {
266
-            throw new DomainException(
267
-                sprintf(
268
-                    esc_html__(
269
-                        '"%1$s" is not a valid loader method on EE_Registry.',
270
-                        'event_espresso'
271
-                    ),
272
-                    $loader
273
-                )
274
-            );
275
-        }
276
-        $class_name = self::$_instance->getFqnForAlias($class_name);
277
-        if ($overwrite || ! isset(self::$_instance->_class_loaders[ $class_name ])) {
278
-            self::$_instance->_class_loaders[ $class_name ] = $loader;
279
-            return true;
280
-        }
281
-        return false;
282
-    }
283
-
284
-
285
-    /**
286
-     * @return array
287
-     */
288
-    public function dependency_map()
289
-    {
290
-        return $this->_dependency_map;
291
-    }
292
-
293
-
294
-    /**
295
-     * returns TRUE if dependency map contains a listing for the provided class name
296
-     *
297
-     * @param string $class_name
298
-     * @return boolean
299
-     */
300
-    public function has($class_name = '')
301
-    {
302
-        // all legacy models have the same dependencies
303
-        if (strpos($class_name, 'EEM_') === 0) {
304
-            $class_name = 'LEGACY_MODELS';
305
-        }
306
-        return isset($this->_dependency_map[ $class_name ]);
307
-    }
308
-
309
-
310
-    /**
311
-     * returns TRUE if dependency map contains a listing for the provided class name AND dependency
312
-     *
313
-     * @param string $class_name
314
-     * @param string $dependency
315
-     * @return bool
316
-     */
317
-    public function has_dependency_for_class($class_name = '', $dependency = '')
318
-    {
319
-        // all legacy models have the same dependencies
320
-        if (strpos($class_name, 'EEM_') === 0) {
321
-            $class_name = 'LEGACY_MODELS';
322
-        }
323
-        $dependency = $this->getFqnForAlias($dependency, $class_name);
324
-        return isset($this->_dependency_map[ $class_name ][ $dependency ]);
325
-    }
326
-
327
-
328
-    /**
329
-     * returns loading strategy for whether a previously cached dependency should be loaded or a new instance returned
330
-     *
331
-     * @param string $class_name
332
-     * @param string $dependency
333
-     * @return int
334
-     */
335
-    public function loading_strategy_for_class_dependency($class_name = '', $dependency = '')
336
-    {
337
-        // all legacy models have the same dependencies
338
-        if (strpos($class_name, 'EEM_') === 0) {
339
-            $class_name = 'LEGACY_MODELS';
340
-        }
341
-        $dependency = $this->getFqnForAlias($dependency);
342
-        return $this->has_dependency_for_class($class_name, $dependency)
343
-            ? $this->_dependency_map[ $class_name ][ $dependency ]
344
-            : EE_Dependency_Map::not_registered;
345
-    }
346
-
347
-
348
-    /**
349
-     * @param string $class_name
350
-     * @return string | Closure
351
-     */
352
-    public function class_loader($class_name)
353
-    {
354
-        // all legacy models use load_model()
355
-        if (strpos($class_name, 'EEM_') === 0) {
356
-            return 'load_model';
357
-        }
358
-        // EE_CPT_*_Strategy classes like EE_CPT_Event_Strategy, EE_CPT_Venue_Strategy, etc
359
-        // perform strpos() first to avoid loading regex every time we load a class
360
-        if (
361
-            strpos($class_name, 'EE_CPT_') === 0
362
-            && preg_match('/^EE_CPT_([a-zA-Z]+)_Strategy$/', $class_name)
363
-        ) {
364
-            return 'load_core';
365
-        }
366
-        $class_name = $this->getFqnForAlias($class_name);
367
-        return isset($this->_class_loaders[ $class_name ]) ? $this->_class_loaders[ $class_name ] : '';
368
-    }
369
-
370
-
371
-    /**
372
-     * @return array
373
-     */
374
-    public function class_loaders()
375
-    {
376
-        return $this->_class_loaders;
377
-    }
378
-
379
-
380
-    /**
381
-     * adds an alias for a classname
382
-     *
383
-     * @param string $fqcn      the class name that should be used (concrete class to replace interface)
384
-     * @param string $alias     the class name that would be type hinted for (abstract parent or interface)
385
-     * @param string $for_class the class that has the dependency (is type hinting for the interface)
386
-     */
387
-    public function add_alias($fqcn, $alias, $for_class = '')
388
-    {
389
-        $this->class_cache->addAlias($fqcn, $alias, $for_class);
390
-    }
391
-
392
-
393
-    /**
394
-     * Returns TRUE if the provided fully qualified name IS an alias
395
-     * WHY?
396
-     * Because if a class is type hinting for a concretion,
397
-     * then why would we need to find another class to supply it?
398
-     * ie: if a class asks for `Fully/Qualified/Namespace/SpecificClassName`,
399
-     * then give it an instance of `Fully/Qualified/Namespace/SpecificClassName`.
400
-     * Don't go looking for some substitute.
401
-     * Whereas if a class is type hinting for an interface...
402
-     * then we need to find an actual class to use.
403
-     * So the interface IS the alias for some other FQN,
404
-     * and we need to find out if `Fully/Qualified/Namespace/SomeInterface`
405
-     * represents some other class.
406
-     *
407
-     * @param string $fqn
408
-     * @param string $for_class
409
-     * @return bool
410
-     */
411
-    public function isAlias($fqn = '', $for_class = '')
412
-    {
413
-        return $this->class_cache->isAlias($fqn, $for_class);
414
-    }
415
-
416
-
417
-    /**
418
-     * Returns a FQN for provided alias if one exists, otherwise returns the original $alias
419
-     * functions recursively, so that multiple aliases can be used to drill down to a FQN
420
-     *  for example:
421
-     *      if the following two entries were added to the _aliases array:
422
-     *          array(
423
-     *              'interface_alias'           => 'some\namespace\interface'
424
-     *              'some\namespace\interface'  => 'some\namespace\classname'
425
-     *          )
426
-     *      then one could use EE_Registry::instance()->create( 'interface_alias' )
427
-     *      to load an instance of 'some\namespace\classname'
428
-     *
429
-     * @param string $alias
430
-     * @param string $for_class
431
-     * @return string
432
-     */
433
-    public function getFqnForAlias($alias = '', $for_class = '')
434
-    {
435
-        return $this->class_cache->getFqnForAlias($alias, $for_class);
436
-    }
437
-
438
-
439
-    /**
440
-     * Registers the core dependencies and whether a previously instantiated object should be loaded from the cache,
441
-     * if one exists, or whether a new object should be generated every time the requested class is loaded.
442
-     * This is done by using the following class constants:
443
-     *        EE_Dependency_Map::load_from_cache - loads previously instantiated object
444
-     *        EE_Dependency_Map::load_new_object - generates a new object every time
445
-     */
446
-    protected function _register_core_dependencies()
447
-    {
448
-        $this->_dependency_map = [
449
-            'EE_Admin'                                                                                          => [
450
-                'EventEspresso\core\services\request\Request'     => EE_Dependency_Map::load_from_cache,
451
-            ],
452
-            'EE_Request_Handler'                                                                                          => [
453
-                'EventEspresso\core\services\request\Request'     => EE_Dependency_Map::load_from_cache,
454
-                'EventEspresso\core\services\request\Response'    => EE_Dependency_Map::load_from_cache,
455
-            ],
456
-            'EE_System'                                                                                                   => [
457
-                'EE_Registry'                                 => EE_Dependency_Map::load_from_cache,
458
-                'EventEspresso\core\services\loaders\Loader'  => EE_Dependency_Map::load_from_cache,
459
-                'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
460
-                'EE_Maintenance_Mode'                         => EE_Dependency_Map::load_from_cache,
461
-            ],
462
-            'EE_Session'                                                                                                  => [
463
-                'EventEspresso\core\services\cache\TransientCacheStorage'  => EE_Dependency_Map::load_from_cache,
464
-                'EventEspresso\core\domain\values\session\SessionLifespan' => EE_Dependency_Map::load_from_cache,
465
-                'EventEspresso\core\services\request\Request'              => EE_Dependency_Map::load_from_cache,
466
-                'EventEspresso\core\services\session\SessionStartHandler'  => EE_Dependency_Map::load_from_cache,
467
-                'EE_Encryption'                                            => EE_Dependency_Map::load_from_cache,
468
-            ],
469
-            'EE_Cart'                                                                                                     => [
470
-                'EE_Session' => EE_Dependency_Map::load_from_cache,
471
-            ],
472
-            'EE_Front_Controller'                                                                                         => [
473
-                'EE_Registry'                                     => EE_Dependency_Map::load_from_cache,
474
-                'EventEspresso\core\services\request\CurrentPage' => EE_Dependency_Map::load_from_cache,
475
-                'EE_Module_Request_Router'                        => EE_Dependency_Map::load_from_cache,
476
-            ],
477
-            'EE_Messenger_Collection_Loader'                                                                              => [
478
-                'EE_Messenger_Collection' => EE_Dependency_Map::load_new_object,
479
-            ],
480
-            'EE_Message_Type_Collection_Loader'                                                                           => [
481
-                'EE_Message_Type_Collection' => EE_Dependency_Map::load_new_object,
482
-            ],
483
-            'EE_Message_Resource_Manager'                                                                                 => [
484
-                'EE_Messenger_Collection_Loader'    => EE_Dependency_Map::load_new_object,
485
-                'EE_Message_Type_Collection_Loader' => EE_Dependency_Map::load_new_object,
486
-                'EEM_Message_Template_Group'        => EE_Dependency_Map::load_from_cache,
487
-            ],
488
-            'EE_Message_Factory'                                                                                          => [
489
-                'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache,
490
-            ],
491
-            'EE_messages'                                                                                                 => [
492
-                'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache,
493
-            ],
494
-            'EE_Messages_Generator'                                                                                       => [
495
-                'EE_Messages_Queue'                    => EE_Dependency_Map::load_new_object,
496
-                'EE_Messages_Data_Handler_Collection'  => EE_Dependency_Map::load_new_object,
497
-                'EE_Message_Template_Group_Collection' => EE_Dependency_Map::load_new_object,
498
-                'EEH_Parse_Shortcodes'                 => EE_Dependency_Map::load_from_cache,
499
-            ],
500
-            'EE_Messages_Processor'                                                                                       => [
501
-                'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache,
502
-            ],
503
-            'EE_Messages_Queue'                                                                                           => [
504
-                'EE_Message_Repository' => EE_Dependency_Map::load_new_object,
505
-            ],
506
-            'EE_Messages_Template_Defaults'                                                                               => [
507
-                'EEM_Message_Template_Group' => EE_Dependency_Map::load_from_cache,
508
-                'EEM_Message_Template'       => EE_Dependency_Map::load_from_cache,
509
-            ],
510
-            'EE_Message_To_Generate_From_Request'                                                                         => [
511
-                'EE_Message_Resource_Manager'                 => EE_Dependency_Map::load_from_cache,
512
-                'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
513
-            ],
514
-            'EventEspresso\core\services\commands\CommandBus'                                                             => [
515
-                'EventEspresso\core\services\commands\CommandHandlerManager' => EE_Dependency_Map::load_from_cache,
516
-            ],
517
-            'EventEspresso\services\commands\CommandHandler'                                                              => [
518
-                'EE_Registry'         => EE_Dependency_Map::load_from_cache,
519
-                'CommandBusInterface' => EE_Dependency_Map::load_from_cache,
520
-            ],
521
-            'EventEspresso\core\services\commands\CommandHandlerManager'                                                  => [
522
-                'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,
523
-            ],
524
-            'EventEspresso\core\services\commands\CompositeCommandHandler'                                                => [
525
-                'EventEspresso\core\services\commands\CommandBus'     => EE_Dependency_Map::load_from_cache,
526
-                'EventEspresso\core\services\commands\CommandFactory' => EE_Dependency_Map::load_from_cache,
527
-            ],
528
-            'EventEspresso\core\services\commands\CommandFactory'                                                         => [
529
-                'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,
530
-            ],
531
-            'EventEspresso\core\services\commands\middleware\CapChecker'                                                  => [
532
-                'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker' => EE_Dependency_Map::load_from_cache,
533
-            ],
534
-            'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker'                                         => [
535
-                'EE_Capabilities' => EE_Dependency_Map::load_from_cache,
536
-            ],
537
-            'EventEspresso\core\domain\services\capabilities\RegistrationsCapChecker'                                     => [
538
-                'EE_Capabilities' => EE_Dependency_Map::load_from_cache,
539
-            ],
540
-            'EventEspresso\core\services\commands\registration\CreateRegistrationCommandHandler'                          => [
541
-                'EventEspresso\core\domain\services\registration\CreateRegistrationService' => EE_Dependency_Map::load_from_cache,
542
-            ],
543
-            'EventEspresso\core\services\commands\registration\CopyRegistrationDetailsCommandHandler'                     => [
544
-                'EventEspresso\core\domain\services\registration\CopyRegistrationService' => EE_Dependency_Map::load_from_cache,
545
-            ],
546
-            'EventEspresso\core\services\commands\registration\CopyRegistrationPaymentsCommandHandler'                    => [
547
-                'EventEspresso\core\domain\services\registration\CopyRegistrationService' => EE_Dependency_Map::load_from_cache,
548
-            ],
549
-            'EventEspresso\core\services\commands\registration\CancelRegistrationAndTicketLineItemCommandHandler'         => [
550
-                'EventEspresso\core\domain\services\registration\CancelTicketLineItemService' => EE_Dependency_Map::load_from_cache,
551
-            ],
552
-            'EventEspresso\core\services\commands\registration\UpdateRegistrationAndTransactionAfterChangeCommandHandler' => [
553
-                'EventEspresso\core\domain\services\registration\UpdateRegistrationService' => EE_Dependency_Map::load_from_cache,
554
-            ],
555
-            'EventEspresso\core\services\commands\ticket\CreateTicketLineItemCommandHandler'                              => [
556
-                'EventEspresso\core\domain\services\ticket\CreateTicketLineItemService' => EE_Dependency_Map::load_from_cache,
557
-            ],
558
-            'EventEspresso\core\services\commands\ticket\CancelTicketLineItemCommandHandler'                              => [
559
-                'EventEspresso\core\domain\services\ticket\CancelTicketLineItemService' => EE_Dependency_Map::load_from_cache,
560
-            ],
561
-            'EventEspresso\core\domain\services\registration\CancelRegistrationService'                                   => [
562
-                'EventEspresso\core\domain\services\ticket\CancelTicketLineItemService' => EE_Dependency_Map::load_from_cache,
563
-            ],
564
-            'EventEspresso\core\services\commands\attendee\CreateAttendeeCommandHandler'                                  => [
565
-                'EEM_Attendee' => EE_Dependency_Map::load_from_cache,
566
-            ],
567
-            'EventEspresso\core\services\database\TableManager'                                                           => [
568
-                'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
569
-            ],
570
-            'EE_Data_Migration_Class_Base'                                                                                => [
571
-                'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
572
-                'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
573
-            ],
574
-            'EE_DMS_Core_4_1_0'                                                                                           => [
575
-                'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
576
-                'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
577
-            ],
578
-            'EE_DMS_Core_4_2_0'                                                                                           => [
579
-                'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
580
-                'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
581
-            ],
582
-            'EE_DMS_Core_4_3_0'                                                                                           => [
583
-                'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
584
-                'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
585
-            ],
586
-            'EE_DMS_Core_4_4_0'                                                                                           => [
587
-                'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
588
-                'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
589
-            ],
590
-            'EE_DMS_Core_4_5_0'                                                                                           => [
591
-                'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
592
-                'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
593
-            ],
594
-            'EE_DMS_Core_4_6_0'                                                                                           => [
595
-                'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
596
-                'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
597
-            ],
598
-            'EE_DMS_Core_4_7_0'                                                                                           => [
599
-                'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
600
-                'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
601
-            ],
602
-            'EE_DMS_Core_4_8_0'                                                                                           => [
603
-                'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
604
-                'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
605
-            ],
606
-            'EE_DMS_Core_4_9_0'                                                                                           => [
607
-                'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
608
-                'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
609
-            ],
610
-            'EE_DMS_Core_4_10_0'                                                                                          => [
611
-                'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
612
-                'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
613
-                'EE_DMS_Core_4_9_0'                                  => EE_Dependency_Map::load_from_cache,
614
-            ],
615
-            'EventEspresso\core\services\assets\I18nRegistry'                                                             => [
616
-                'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache,
617
-            ],
618
-            'EventEspresso\core\services\assets\Registry'                                                                 => [
619
-                'EventEspresso\core\services\assets\AssetCollection' => EE_Dependency_Map::load_from_cache,
620
-                'EventEspresso\core\services\assets\I18nRegistry'    => EE_Dependency_Map::load_from_cache,
621
-            ],
622
-            'EventEspresso\core\domain\entities\shortcodes\EspressoCancelled'                                             => [
623
-                'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache,
624
-            ],
625
-            'EventEspresso\core\domain\entities\shortcodes\EspressoCheckout'                                              => [
626
-                'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache,
627
-            ],
628
-            'EventEspresso\core\domain\entities\shortcodes\EspressoEventAttendees'                                        => [
629
-                'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache,
630
-            ],
631
-            'EventEspresso\core\domain\entities\shortcodes\EspressoEvents'                                                => [
632
-                'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache,
633
-            ],
634
-            'EventEspresso\core\domain\entities\shortcodes\EspressoThankYou'                                              => [
635
-                'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache,
636
-            ],
637
-            'EventEspresso\core\domain\entities\shortcodes\EspressoTicketSelector'                                        => [
638
-                'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache,
639
-            ],
640
-            'EventEspresso\core\domain\entities\shortcodes\EspressoTxnPage'                                               => [
641
-                'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache,
642
-            ],
643
-            'EventEspresso\core\services\cache\BasicCacheManager'                                                         => [
644
-                'EventEspresso\core\services\cache\TransientCacheStorage' => EE_Dependency_Map::load_from_cache,
645
-            ],
646
-            'EventEspresso\core\services\cache\PostRelatedCacheManager'                                                   => [
647
-                'EventEspresso\core\services\cache\TransientCacheStorage' => EE_Dependency_Map::load_from_cache,
648
-            ],
649
-            'EventEspresso\core\domain\services\validation\email\EmailValidationService'                                  => [
650
-                'EE_Registration_Config'                     => EE_Dependency_Map::load_from_cache,
651
-                'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,
652
-            ],
653
-            'EventEspresso\core\domain\values\EmailAddress'                                                               => [
654
-                null,
655
-                'EventEspresso\core\domain\services\validation\email\EmailValidationService' => EE_Dependency_Map::load_from_cache,
656
-            ],
657
-            'EventEspresso\core\services\orm\ModelFieldFactory'                                                           => [
658
-                'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,
659
-            ],
660
-            'LEGACY_MODELS'                                                                                               => [
661
-                null,
662
-                'EventEspresso\core\services\database\ModelFieldFactory' => EE_Dependency_Map::load_from_cache,
663
-            ],
664
-            'EE_Module_Request_Router'                                                                                    => [
665
-                'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
666
-            ],
667
-            'EE_Registration_Processor'                                                                                   => [
668
-                'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
669
-            ],
670
-            'EventEspresso\core\services\notifications\PersistentAdminNoticeManager'                                      => [
671
-                'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker' => EE_Dependency_Map::load_from_cache,
672
-                'EventEspresso\core\services\request\Request'                         => EE_Dependency_Map::load_from_cache,
673
-            ],
674
-            'EventEspresso\core\services\licensing\LicenseService'                                                        => [
675
-                'EventEspresso\core\domain\services\pue\Stats'  => EE_Dependency_Map::load_from_cache,
676
-                'EventEspresso\core\domain\services\pue\Config' => EE_Dependency_Map::load_from_cache,
677
-            ],
678
-            'EE_Admin_Transactions_List_Table'                                                                            => [
679
-                null,
680
-                'EventEspresso\core\domain\values\session\SessionLifespan' => EE_Dependency_Map::load_from_cache,
681
-            ],
682
-            'EventEspresso\core\domain\services\pue\Stats'                                                                => [
683
-                'EventEspresso\core\domain\services\pue\Config'        => EE_Dependency_Map::load_from_cache,
684
-                'EE_Maintenance_Mode'                                  => EE_Dependency_Map::load_from_cache,
685
-                'EventEspresso\core\domain\services\pue\StatsGatherer' => EE_Dependency_Map::load_from_cache,
686
-            ],
687
-            'EventEspresso\core\domain\services\pue\Config'                                                               => [
688
-                'EE_Network_Config' => EE_Dependency_Map::load_from_cache,
689
-                'EE_Config'         => EE_Dependency_Map::load_from_cache,
690
-            ],
691
-            'EventEspresso\core\domain\services\pue\StatsGatherer'                                                        => [
692
-                'EEM_Payment_Method' => EE_Dependency_Map::load_from_cache,
693
-                'EEM_Event'          => EE_Dependency_Map::load_from_cache,
694
-                'EEM_Datetime'       => EE_Dependency_Map::load_from_cache,
695
-                'EEM_Ticket'         => EE_Dependency_Map::load_from_cache,
696
-                'EEM_Registration'   => EE_Dependency_Map::load_from_cache,
697
-                'EEM_Transaction'    => EE_Dependency_Map::load_from_cache,
698
-                'EE_Config'          => EE_Dependency_Map::load_from_cache,
699
-            ],
700
-            'EventEspresso\core\domain\services\admin\ExitModal'                                                          => [
701
-                'EventEspresso\core\services\assets\Registry' => EE_Dependency_Map::load_from_cache,
702
-            ],
703
-            'EventEspresso\core\domain\services\admin\PluginUpsells'                                                      => [
704
-                'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache,
705
-            ],
706
-            'EventEspresso\caffeinated\modules\recaptcha_invisible\InvisibleRecaptcha'                                    => [
707
-                'EE_Registration_Config' => EE_Dependency_Map::load_from_cache,
708
-                'EE_Session'             => EE_Dependency_Map::load_from_cache,
709
-            ],
710
-            'EventEspresso\caffeinated\modules\recaptcha_invisible\RecaptchaAdminSettings'                                => [
711
-                'EE_Registration_Config' => EE_Dependency_Map::load_from_cache,
712
-            ],
713
-            'EventEspresso\modules\ticket_selector\DisplayTicketSelector' => [
714
-                'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
715
-                'EE_Ticket_Selector_Config'                   => EE_Dependency_Map::load_from_cache,
716
-            ],
717
-            'EventEspresso\modules\ticket_selector\ProcessTicketSelector'                                                 => [
718
-                'EE_Core_Config'                                                          => EE_Dependency_Map::load_from_cache,
719
-                'EventEspresso\core\services\request\Request'                             => EE_Dependency_Map::load_from_cache,
720
-                'EE_Session'                                                              => EE_Dependency_Map::load_from_cache,
721
-                'EEM_Ticket'                                                              => EE_Dependency_Map::load_from_cache,
722
-                'EventEspresso\modules\ticket_selector\TicketDatetimeAvailabilityTracker' => EE_Dependency_Map::load_from_cache,
723
-            ],
724
-            'EventEspresso\modules\ticket_selector\TicketDatetimeAvailabilityTracker'                                     => [
725
-                'EEM_Datetime' => EE_Dependency_Map::load_from_cache,
726
-            ],
727
-            'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions'                              => [
728
-                'EE_Core_Config'                             => EE_Dependency_Map::load_from_cache,
729
-                'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,
730
-            ],
731
-            'EventEspresso\core\domain\services\custom_post_types\RegisterCustomPostTypes'                                => [
732
-                'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions' => EE_Dependency_Map::load_from_cache,
733
-            ],
734
-            'EventEspresso\core\domain\services\custom_post_types\RegisterCustomTaxonomies'                               => [
735
-                'EventEspresso\core\domain\entities\custom_post_types\CustomTaxonomyDefinitions' => EE_Dependency_Map::load_from_cache,
736
-            ],
737
-            'EE_CPT_Strategy'                                                                                             => [
738
-                'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions' => EE_Dependency_Map::load_from_cache,
739
-                'EventEspresso\core\domain\entities\custom_post_types\CustomTaxonomyDefinitions' => EE_Dependency_Map::load_from_cache,
740
-            ],
741
-            'EventEspresso\core\services\loaders\ObjectIdentifier'                                                        => [
742
-                'EventEspresso\core\services\loaders\ClassInterfaceCache' => EE_Dependency_Map::load_from_cache,
743
-            ],
744
-            'EventEspresso\core\domain\services\assets\CoreAssetManager'                                                  => [
745
-                'EventEspresso\core\services\assets\AssetCollection' => EE_Dependency_Map::load_from_cache,
746
-                'EE_Currency_Config'                                 => EE_Dependency_Map::load_from_cache,
747
-                'EE_Template_Config'                                 => EE_Dependency_Map::load_from_cache,
748
-                'EventEspresso\core\domain\Domain'                   => EE_Dependency_Map::load_from_cache,
749
-                'EventEspresso\core\services\assets\Registry'        => EE_Dependency_Map::load_from_cache,
750
-            ],
751
-            'EventEspresso\core\domain\services\admin\privacy\policy\PrivacyPolicy'                                       => [
752
-                'EEM_Payment_Method'                                       => EE_Dependency_Map::load_from_cache,
753
-                'EventEspresso\core\domain\values\session\SessionLifespan' => EE_Dependency_Map::load_from_cache,
754
-            ],
755
-            'EventEspresso\core\domain\services\admin\privacy\export\ExportAttendee'                                      => [
756
-                'EEM_Attendee' => EE_Dependency_Map::load_from_cache,
757
-            ],
758
-            'EventEspresso\core\domain\services\admin\privacy\export\ExportAttendeeBillingData'                           => [
759
-                'EEM_Attendee'       => EE_Dependency_Map::load_from_cache,
760
-                'EEM_Payment_Method' => EE_Dependency_Map::load_from_cache,
761
-            ],
762
-            'EventEspresso\core\domain\services\admin\privacy\export\ExportCheckins'                                      => [
763
-                'EEM_Checkin' => EE_Dependency_Map::load_from_cache,
764
-            ],
765
-            'EventEspresso\core\domain\services\admin\privacy\export\ExportRegistration'                                  => [
766
-                'EEM_Registration' => EE_Dependency_Map::load_from_cache,
767
-            ],
768
-            'EventEspresso\core\domain\services\admin\privacy\export\ExportTransaction'                                   => [
769
-                'EEM_Transaction' => EE_Dependency_Map::load_from_cache,
770
-            ],
771
-            'EventEspresso\core\domain\services\admin\privacy\erasure\EraseAttendeeData'                                  => [
772
-                'EEM_Attendee' => EE_Dependency_Map::load_from_cache,
773
-            ],
774
-            'EventEspresso\core\domain\services\admin\privacy\erasure\EraseAnswers'                                       => [
775
-                'EEM_Answer'   => EE_Dependency_Map::load_from_cache,
776
-                'EEM_Question' => EE_Dependency_Map::load_from_cache,
777
-            ],
778
-            'EventEspresso\core\CPTs\CptQueryModifier'                                                                    => [
779
-                null,
780
-                null,
781
-                null,
782
-                'EventEspresso\core\services\request\CurrentPage' => EE_Dependency_Map::load_from_cache,
783
-                'EventEspresso\core\services\request\Request'     => EE_Dependency_Map::load_from_cache,
784
-                'EventEspresso\core\services\loaders\Loader'      => EE_Dependency_Map::load_from_cache,
785
-            ],
786
-            'EventEspresso\core\domain\services\admin\privacy\forms\PrivacySettingsFormHandler'                           => [
787
-                'EE_Registry' => EE_Dependency_Map::load_from_cache,
788
-                'EE_Config'   => EE_Dependency_Map::load_from_cache,
789
-            ],
790
-            'EventEspresso\core\services\editor\BlockRegistrationManager'                                                 => [
791
-                'EventEspresso\core\services\assets\BlockAssetManagerCollection'         => EE_Dependency_Map::load_from_cache,
792
-                'EventEspresso\core\domain\entities\editor\BlockCollection'              => EE_Dependency_Map::load_from_cache,
793
-                'EventEspresso\core\services\route_match\RouteMatchSpecificationManager' => EE_Dependency_Map::load_from_cache,
794
-                'EventEspresso\core\services\request\Request'                            => EE_Dependency_Map::load_from_cache,
795
-            ],
796
-            'EventEspresso\core\domain\entities\editor\CoreBlocksAssetManager'                                            => [
797
-                'EventEspresso\core\domain\Domain'                   => EE_Dependency_Map::load_from_cache,
798
-                'EventEspresso\core\services\assets\AssetCollection' => EE_Dependency_Map::load_from_cache,
799
-                'EventEspresso\core\services\assets\Registry'        => EE_Dependency_Map::load_from_cache,
800
-            ],
801
-            'EventEspresso\core\domain\services\blocks\EventAttendeesBlockRenderer'                                       => [
802
-                'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache,
803
-                'EEM_Attendee'                     => EE_Dependency_Map::load_from_cache,
804
-            ],
805
-            'EventEspresso\core\domain\entities\editor\blocks\EventAttendees'                                             => [
806
-                'EventEspresso\core\domain\entities\editor\CoreBlocksAssetManager'      => self::load_from_cache,
807
-                'EventEspresso\core\services\request\Request'                           => EE_Dependency_Map::load_from_cache,
808
-                'EventEspresso\core\domain\services\blocks\EventAttendeesBlockRenderer' => self::load_from_cache,
809
-            ],
810
-            'EventEspresso\core\services\route_match\RouteMatchSpecificationDependencyResolver'                           => [
811
-                'EventEspresso\core\services\container\Mirror'            => EE_Dependency_Map::load_from_cache,
812
-                'EventEspresso\core\services\loaders\ClassInterfaceCache' => EE_Dependency_Map::load_from_cache,
813
-                'EE_Dependency_Map'                                       => EE_Dependency_Map::load_from_cache,
814
-            ],
815
-            'EventEspresso\core\services\route_match\RouteMatchSpecificationFactory'                                      => [
816
-                'EventEspresso\core\services\route_match\RouteMatchSpecificationDependencyResolver' => EE_Dependency_Map::load_from_cache,
817
-                'EventEspresso\core\services\loaders\Loader'                                        => EE_Dependency_Map::load_from_cache,
818
-            ],
819
-            'EventEspresso\core\services\route_match\RouteMatchSpecificationManager'                                      => [
820
-                'EventEspresso\core\services\route_match\RouteMatchSpecificationCollection' => EE_Dependency_Map::load_from_cache,
821
-                'EventEspresso\core\services\route_match\RouteMatchSpecificationFactory'    => EE_Dependency_Map::load_from_cache,
822
-            ],
823
-            'EventEspresso\core\libraries\rest_api\CalculatedModelFields'                                                 => [
824
-                'EventEspresso\core\libraries\rest_api\calculations\CalculatedModelFieldsFactory' => EE_Dependency_Map::load_from_cache,
825
-            ],
826
-            'EventEspresso\core\libraries\rest_api\calculations\CalculatedModelFieldsFactory'                             => [
827
-                'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,
828
-            ],
829
-            'EventEspresso\core\libraries\rest_api\controllers\model\Read'                                                => [
830
-                'EventEspresso\core\libraries\rest_api\CalculatedModelFields' => EE_Dependency_Map::load_from_cache,
831
-            ],
832
-            'EventEspresso\core\libraries\rest_api\calculations\Datetime'                                                 => [
833
-                'EEM_Datetime'     => EE_Dependency_Map::load_from_cache,
834
-                'EEM_Registration' => EE_Dependency_Map::load_from_cache,
835
-            ],
836
-            'EventEspresso\core\libraries\rest_api\calculations\Event'                                                    => [
837
-                'EEM_Event'        => EE_Dependency_Map::load_from_cache,
838
-                'EEM_Registration' => EE_Dependency_Map::load_from_cache,
839
-            ],
840
-            'EventEspresso\core\libraries\rest_api\calculations\Registration'                                             => [
841
-                'EEM_Registration' => EE_Dependency_Map::load_from_cache,
842
-            ],
843
-            'EventEspresso\core\services\session\SessionStartHandler'                                                     => [
844
-                'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
845
-            ],
846
-            'EE_URL_Validation_Strategy'                                                                                  => [
847
-                null,
848
-                null,
849
-                'EventEspresso\core\services\validators\URLValidator' => EE_Dependency_Map::load_from_cache,
850
-            ],
851
-            'EventEspresso\admin_pages\general_settings\OrganizationSettings'                                             => [
852
-                'EE_Registry'                                             => EE_Dependency_Map::load_from_cache,
853
-                'EE_Organization_Config'                                  => EE_Dependency_Map::load_from_cache,
854
-                'EE_Core_Config'                                          => EE_Dependency_Map::load_from_cache,
855
-                'EE_Network_Core_Config'                                  => EE_Dependency_Map::load_from_cache,
856
-                'EventEspresso\core\services\address\CountrySubRegionDao' => EE_Dependency_Map::load_from_cache,
857
-            ],
858
-            'EventEspresso\core\services\address\CountrySubRegionDao'                                                     => [
859
-                'EEM_State'                                            => EE_Dependency_Map::load_from_cache,
860
-                'EventEspresso\core\services\validators\JsonValidator' => EE_Dependency_Map::load_from_cache,
861
-            ],
862
-            'EventEspresso\core\domain\services\admin\ajax\WordpressHeartbeat'                                            => [
863
-                'EventEspresso\core\services\loaders\Loader'  => EE_Dependency_Map::load_from_cache,
864
-                'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
865
-            ],
866
-            'EventEspresso\core\domain\services\admin\ajax\EventEditorHeartbeat'                                          => [
867
-                'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache,
868
-                'EE_Environment_Config'            => EE_Dependency_Map::load_from_cache,
869
-            ],
870
-            'EventEspresso\core\services\request\files\FilesDataHandler'                                                  => [
871
-                'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
872
-            ],
873
-            'EventEspressoBatchRequest\BatchRequestProcessor'                                                             => [
874
-                'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,
875
-            ],
876
-            'EventEspresso\core\domain\services\admin\registrations\list_table\QueryBuilder'                              => [
877
-                'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
878
-                'EEM_Registration'                            => EE_Dependency_Map::load_from_cache,
879
-                null,
880
-            ],
881
-            'EventEspresso\core\domain\services\admin\registrations\list_table\page_header\AttendeeFilterHeader'          => [
882
-                'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
883
-                'EEM_Attendee'                                => EE_Dependency_Map::load_from_cache,
884
-            ],
885
-            'EventEspresso\core\domain\services\admin\registrations\list_table\page_header\DateFilterHeader'              => [
886
-                'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
887
-                'EEM_Datetime'                                => EE_Dependency_Map::load_from_cache,
888
-            ],
889
-            'EventEspresso\core\domain\services\admin\registrations\list_table\page_header\EventFilterHeader'             => [
890
-                'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
891
-                'EEM_Event'                                   => EE_Dependency_Map::load_from_cache,
892
-            ],
893
-            'EventEspresso\core\domain\services\admin\registrations\list_table\page_header\TicketFilterHeader'            => [
894
-                'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
895
-                'EEM_Ticket'                                  => EE_Dependency_Map::load_from_cache,
896
-            ],
897
-            'EventEspressoBatchRequest\JobHandlers\ExecuteBatchDeletion'                                                  => [
898
-                'EventEspresso\core\services\orm\tree_traversal\NodeGroupDao' => EE_Dependency_Map::load_from_cache,
899
-            ],
900
-            'EventEspressoBatchRequest\JobHandlers\PreviewEventDeletion'                                                  => [
901
-                'EventEspresso\core\services\orm\tree_traversal\NodeGroupDao' => EE_Dependency_Map::load_from_cache,
902
-            ],
903
-            'EventEspresso\core\domain\services\admin\events\data\PreviewDeletion'                                        => [
904
-                'EventEspresso\core\services\orm\tree_traversal\NodeGroupDao' => EE_Dependency_Map::load_from_cache,
905
-                'EEM_Event'                                                   => EE_Dependency_Map::load_from_cache,
906
-                'EEM_Datetime'                                                => EE_Dependency_Map::load_from_cache,
907
-                'EEM_Registration'                                            => EE_Dependency_Map::load_from_cache,
908
-            ],
909
-            'EventEspresso\core\domain\services\admin\events\data\ConfirmDeletion'                                        => [
910
-                'EventEspresso\core\services\orm\tree_traversal\NodeGroupDao' => EE_Dependency_Map::load_from_cache,
911
-            ],
912
-            'EventEspresso\core\services\request\CurrentPage'                                                             => [
913
-                'EE_CPT_Strategy'                             => EE_Dependency_Map::load_from_cache,
914
-                'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
915
-            ],
916
-            'EventEspresso\core\services\shortcodes\LegacyShortcodesManager'                                              => [
917
-                'EE_Registry'                                     => EE_Dependency_Map::load_from_cache,
918
-                'EventEspresso\core\services\request\CurrentPage' => EE_Dependency_Map::load_from_cache,
919
-            ],
920
-            'EventEspresso\core\services\shortcodes\ShortcodesManager'                                                    => [
921
-                'EventEspresso\core\services\shortcodes\LegacyShortcodesManager' => EE_Dependency_Map::load_from_cache,
922
-                'EventEspresso\core\services\request\CurrentPage'                => EE_Dependency_Map::load_from_cache,
923
-            ],
924
-        ];
925
-    }
926
-
927
-
928
-    /**
929
-     * Registers how core classes are loaded.
930
-     * This can either be done by simply providing the name of one of the EE_Registry loader methods such as:
931
-     *        'EE_Request_Handler' => 'load_core'
932
-     *        'EE_Messages_Queue'  => 'load_lib'
933
-     *        'EEH_Debug_Tools'    => 'load_helper'
934
-     * or, if greater control is required, by providing a custom closure. For example:
935
-     *        'Some_Class' => function () {
936
-     *            return new Some_Class();
937
-     *        },
938
-     * This is required for instantiating dependencies
939
-     * where an interface has been type hinted in a class constructor. For example:
940
-     *        'Required_Interface' => function () {
941
-     *            return new A_Class_That_Implements_Required_Interface();
942
-     *        },
943
-     */
944
-    protected function _register_core_class_loaders()
945
-    {
946
-        $this->_class_loaders = [
947
-            // load_core
948
-            'EE_Dependency_Map'                            => function () {
949
-                return $this;
950
-            },
951
-            'EE_Capabilities'                              => 'load_core',
952
-            'EE_Encryption'                                => 'load_core',
953
-            'EE_Front_Controller'                          => 'load_core',
954
-            'EE_Module_Request_Router'                     => 'load_core',
955
-            'EE_Registry'                                  => 'load_core',
956
-            'EE_Request'                                   => function () {
957
-                return $this->legacy_request;
958
-            },
959
-            'EventEspresso\core\services\request\Request'  => function () {
960
-                return $this->request;
961
-            },
962
-            'EventEspresso\core\services\request\Response' => function () {
963
-                return $this->response;
964
-            },
965
-            'EE_Base'                                      => 'load_core',
966
-            'EE_Request_Handler'                           => 'load_core',
967
-            'EE_Session'                                   => 'load_core',
968
-            'EE_Cron_Tasks'                                => 'load_core',
969
-            'EE_System'                                    => 'load_core',
970
-            'EE_Maintenance_Mode'                          => 'load_core',
971
-            'EE_Register_CPTs'                             => 'load_core',
972
-            'EE_Admin'                                     => 'load_core',
973
-            'EE_CPT_Strategy'                              => 'load_core',
974
-            // load_class
975
-            'EE_Registration_Processor'                    => 'load_class',
976
-            // load_lib
977
-            'EE_Message_Resource_Manager'                  => 'load_lib',
978
-            'EE_Message_Type_Collection'                   => 'load_lib',
979
-            'EE_Message_Type_Collection_Loader'            => 'load_lib',
980
-            'EE_Messenger_Collection'                      => 'load_lib',
981
-            'EE_Messenger_Collection_Loader'               => 'load_lib',
982
-            'EE_Messages_Processor'                        => 'load_lib',
983
-            'EE_Message_Repository'                        => 'load_lib',
984
-            'EE_Messages_Queue'                            => 'load_lib',
985
-            'EE_Messages_Data_Handler_Collection'          => 'load_lib',
986
-            'EE_Message_Template_Group_Collection'         => 'load_lib',
987
-            'EE_Payment_Method_Manager'                    => 'load_lib',
988
-            'EE_DMS_Core_4_1_0'                            => 'load_dms',
989
-            'EE_DMS_Core_4_2_0'                            => 'load_dms',
990
-            'EE_DMS_Core_4_3_0'                            => 'load_dms',
991
-            'EE_DMS_Core_4_5_0'                            => 'load_dms',
992
-            'EE_DMS_Core_4_6_0'                            => 'load_dms',
993
-            'EE_DMS_Core_4_7_0'                            => 'load_dms',
994
-            'EE_DMS_Core_4_8_0'                            => 'load_dms',
995
-            'EE_DMS_Core_4_9_0'                            => 'load_dms',
996
-            'EE_DMS_Core_4_10_0'                           => 'load_dms',
997
-            'EE_Messages_Generator'                        => function () {
998
-                return EE_Registry::instance()->load_lib(
999
-                    'Messages_Generator',
1000
-                    [],
1001
-                    false,
1002
-                    false
1003
-                );
1004
-            },
1005
-            'EE_Messages_Template_Defaults'                => function ($arguments = []) {
1006
-                return EE_Registry::instance()->load_lib(
1007
-                    'Messages_Template_Defaults',
1008
-                    $arguments,
1009
-                    false,
1010
-                    false
1011
-                );
1012
-            },
1013
-            // load_helper
1014
-            'EEH_Parse_Shortcodes'                         => function () {
1015
-                if (EE_Registry::instance()->load_helper('Parse_Shortcodes')) {
1016
-                    return new EEH_Parse_Shortcodes();
1017
-                }
1018
-                return null;
1019
-            },
1020
-            'EE_Template_Config'                           => function () {
1021
-                return EE_Config::instance()->template_settings;
1022
-            },
1023
-            'EE_Currency_Config'                           => function () {
1024
-                return EE_Config::instance()->currency;
1025
-            },
1026
-            'EE_Registration_Config'                       => function () {
1027
-                return EE_Config::instance()->registration;
1028
-            },
1029
-            'EE_Core_Config'                               => function () {
1030
-                return EE_Config::instance()->core;
1031
-            },
1032
-            'EventEspresso\core\services\loaders\Loader'   => function () {
1033
-                return LoaderFactory::getLoader();
1034
-            },
1035
-            'EE_Network_Config'                            => function () {
1036
-                return EE_Network_Config::instance();
1037
-            },
1038
-            'EE_Config'                                    => function () {
1039
-                return EE_Config::instance();
1040
-            },
1041
-            'EventEspresso\core\domain\Domain'             => function () {
1042
-                return DomainFactory::getEventEspressoCoreDomain();
1043
-            },
1044
-            'EE_Admin_Config'                              => function () {
1045
-                return EE_Config::instance()->admin;
1046
-            },
1047
-            'EE_Organization_Config'                       => function () {
1048
-                return EE_Config::instance()->organization;
1049
-            },
1050
-            'EE_Network_Core_Config'                       => function () {
1051
-                return EE_Network_Config::instance()->core;
1052
-            },
1053
-            'EE_Environment_Config'                        => function () {
1054
-                return EE_Config::instance()->environment;
1055
-            },
1056
-            'EE_Ticket_Selector_Config'                    => function () {
1057
-                return EE_Config::instance()->template_settings->EED_Ticket_Selector;
1058
-            },
1059
-        ];
1060
-    }
1061
-
1062
-
1063
-    /**
1064
-     * can be used for supplying alternate names for classes,
1065
-     * or for connecting interface names to instantiable classes
1066
-     */
1067
-    protected function _register_core_aliases()
1068
-    {
1069
-        $aliases = [
1070
-            'CommandBusInterface'                                                          => 'EventEspresso\core\services\commands\CommandBusInterface',
1071
-            'EventEspresso\core\services\commands\CommandBusInterface'                     => 'EventEspresso\core\services\commands\CommandBus',
1072
-            'CommandHandlerManagerInterface'                                               => 'EventEspresso\core\services\commands\CommandHandlerManagerInterface',
1073
-            'EventEspresso\core\services\commands\CommandHandlerManagerInterface'          => 'EventEspresso\core\services\commands\CommandHandlerManager',
1074
-            'CapChecker'                                                                   => 'EventEspresso\core\services\commands\middleware\CapChecker',
1075
-            'AddActionHook'                                                                => 'EventEspresso\core\services\commands\middleware\AddActionHook',
1076
-            'CapabilitiesChecker'                                                          => 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker',
1077
-            'CapabilitiesCheckerInterface'                                                 => 'EventEspresso\core\domain\services\capabilities\CapabilitiesCheckerInterface',
1078
-            'EventEspresso\core\domain\services\capabilities\CapabilitiesCheckerInterface' => 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker',
1079
-            'CreateRegistrationService'                                                    => 'EventEspresso\core\domain\services\registration\CreateRegistrationService',
1080
-            'CreateRegistrationCommandHandler'                                             => 'EventEspresso\core\services\commands\registration\CreateRegistrationCommand',
1081
-            'CopyRegistrationDetailsCommandHandler'                                        => 'EventEspresso\core\services\commands\registration\CopyRegistrationDetailsCommand',
1082
-            'CopyRegistrationPaymentsCommandHandler'                                       => 'EventEspresso\core\services\commands\registration\CopyRegistrationPaymentsCommand',
1083
-            'CancelRegistrationAndTicketLineItemCommandHandler'                            => 'EventEspresso\core\services\commands\registration\CancelRegistrationAndTicketLineItemCommandHandler',
1084
-            'UpdateRegistrationAndTransactionAfterChangeCommandHandler'                    => 'EventEspresso\core\services\commands\registration\UpdateRegistrationAndTransactionAfterChangeCommandHandler',
1085
-            'CreateTicketLineItemCommandHandler'                                           => 'EventEspresso\core\services\commands\ticket\CreateTicketLineItemCommand',
1086
-            'CreateTransactionCommandHandler'                                              => 'EventEspresso\core\services\commands\transaction\CreateTransactionCommandHandler',
1087
-            'CreateAttendeeCommandHandler'                                                 => 'EventEspresso\core\services\commands\attendee\CreateAttendeeCommandHandler',
1088
-            'TableManager'                                                                 => 'EventEspresso\core\services\database\TableManager',
1089
-            'TableAnalysis'                                                                => 'EventEspresso\core\services\database\TableAnalysis',
1090
-            'EspressoShortcode'                                                            => 'EventEspresso\core\services\shortcodes\EspressoShortcode',
1091
-            'ShortcodeInterface'                                                           => 'EventEspresso\core\services\shortcodes\ShortcodeInterface',
1092
-            'EventEspresso\core\services\shortcodes\ShortcodeInterface'                    => 'EventEspresso\core\services\shortcodes\EspressoShortcode',
1093
-            'EventEspresso\core\services\cache\CacheStorageInterface'                      => 'EventEspresso\core\services\cache\TransientCacheStorage',
1094
-            'LoaderInterface'                                                              => 'EventEspresso\core\services\loaders\LoaderInterface',
1095
-            'EventEspresso\core\services\loaders\LoaderInterface'                          => 'EventEspresso\core\services\loaders\Loader',
1096
-            'CommandFactoryInterface'                                                      => 'EventEspresso\core\services\commands\CommandFactoryInterface',
1097
-            'EventEspresso\core\services\commands\CommandFactoryInterface'                 => 'EventEspresso\core\services\commands\CommandFactory',
1098
-            'EmailValidatorInterface'                                                      => 'EventEspresso\core\domain\services\validation\email\EmailValidatorInterface',
1099
-            'EventEspresso\core\domain\services\validation\email\EmailValidatorInterface'  => 'EventEspresso\core\domain\services\validation\email\EmailValidationService',
1100
-            'NoticeConverterInterface'                                                     => 'EventEspresso\core\services\notices\NoticeConverterInterface',
1101
-            'EventEspresso\core\services\notices\NoticeConverterInterface'                 => 'EventEspresso\core\services\notices\ConvertNoticesToEeErrors',
1102
-            'NoticesContainerInterface'                                                    => 'EventEspresso\core\services\notices\NoticesContainerInterface',
1103
-            'EventEspresso\core\services\notices\NoticesContainerInterface'                => 'EventEspresso\core\services\notices\NoticesContainer',
1104
-            'EventEspresso\core\services\request\RequestInterface'                         => 'EventEspresso\core\services\request\Request',
1105
-            'EventEspresso\core\services\request\ResponseInterface'                        => 'EventEspresso\core\services\request\Response',
1106
-            'EventEspresso\core\domain\DomainInterface'                                    => 'EventEspresso\core\domain\Domain',
1107
-            'Registration_Processor'                                                       => 'EE_Registration_Processor',
1108
-        ];
1109
-        foreach ($aliases as $alias => $fqn) {
1110
-            if (is_array($fqn)) {
1111
-                foreach ($fqn as $class => $for_class) {
1112
-                    $this->class_cache->addAlias($class, $alias, $for_class);
1113
-                }
1114
-                continue;
1115
-            }
1116
-            $this->class_cache->addAlias($fqn, $alias);
1117
-        }
1118
-        if (! (defined('DOING_AJAX') && DOING_AJAX) && is_admin()) {
1119
-            $this->class_cache->addAlias(
1120
-                'EventEspresso\core\services\notices\ConvertNoticesToAdminNotices',
1121
-                'EventEspresso\core\services\notices\NoticeConverterInterface'
1122
-            );
1123
-        }
1124
-    }
1125
-
1126
-
1127
-    public function debug($for_class = '')
1128
-    {
1129
-        $this->class_cache->debug($for_class);
1130
-    }
1131
-
1132
-
1133
-    /**
1134
-     * This is used to reset the internal map and class_loaders to their original default state at the beginning of the
1135
-     * request Primarily used by unit tests.
1136
-     */
1137
-    public function reset()
1138
-    {
1139
-        $this->_register_core_class_loaders();
1140
-        $this->_register_core_dependencies();
1141
-    }
1142
-
1143
-
1144
-    /**
1145
-     * PLZ NOTE: a better name for this method would be is_alias()
1146
-     * because it returns TRUE if the provided fully qualified name IS an alias
1147
-     * WHY?
1148
-     * Because if a class is type hinting for a concretion,
1149
-     * then why would we need to find another class to supply it?
1150
-     * ie: if a class asks for `Fully/Qualified/Namespace/SpecificClassName`,
1151
-     * then give it an instance of `Fully/Qualified/Namespace/SpecificClassName`.
1152
-     * Don't go looking for some substitute.
1153
-     * Whereas if a class is type hinting for an interface...
1154
-     * then we need to find an actual class to use.
1155
-     * So the interface IS the alias for some other FQN,
1156
-     * and we need to find out if `Fully/Qualified/Namespace/SomeInterface`
1157
-     * represents some other class.
1158
-     *
1159
-     * @param string $fqn
1160
-     * @param string $for_class
1161
-     * @return bool
1162
-     * @deprecated 4.9.62.p
1163
-     */
1164
-    public function has_alias($fqn = '', $for_class = '')
1165
-    {
1166
-        return $this->isAlias($fqn, $for_class);
1167
-    }
1168
-
1169
-
1170
-    /**
1171
-     * PLZ NOTE: a better name for this method would be get_fqn_for_alias()
1172
-     * because it returns a FQN for provided alias if one exists, otherwise returns the original $alias
1173
-     * functions recursively, so that multiple aliases can be used to drill down to a FQN
1174
-     *  for example:
1175
-     *      if the following two entries were added to the _aliases array:
1176
-     *          array(
1177
-     *              'interface_alias'           => 'some\namespace\interface'
1178
-     *              'some\namespace\interface'  => 'some\namespace\classname'
1179
-     *          )
1180
-     *      then one could use EE_Registry::instance()->create( 'interface_alias' )
1181
-     *      to load an instance of 'some\namespace\classname'
1182
-     *
1183
-     * @param string $alias
1184
-     * @param string $for_class
1185
-     * @return string
1186
-     * @deprecated 4.9.62.p
1187
-     */
1188
-    public function get_alias($alias = '', $for_class = '')
1189
-    {
1190
-        return $this->getFqnForAlias($alias, $for_class);
1191
-    }
23
+	/**
24
+	 * This means that the requested class dependency is not present in the dependency map
25
+	 */
26
+	const not_registered = 0;
27
+
28
+	/**
29
+	 * This instructs class loaders to ALWAYS return a newly instantiated object for the requested class.
30
+	 */
31
+	const load_new_object = 1;
32
+
33
+	/**
34
+	 * This instructs class loaders to return a previously instantiated and cached object for the requested class.
35
+	 * IF a previously instantiated object does not exist, a new one will be created and added to the cache.
36
+	 */
37
+	const load_from_cache = 2;
38
+
39
+	/**
40
+	 * When registering a dependency,
41
+	 * this indicates to keep any existing dependencies that already exist,
42
+	 * and simply discard any new dependencies declared in the incoming data
43
+	 */
44
+	const KEEP_EXISTING_DEPENDENCIES = 0;
45
+
46
+	/**
47
+	 * When registering a dependency,
48
+	 * this indicates to overwrite any existing dependencies that already exist using the incoming data
49
+	 */
50
+	const OVERWRITE_DEPENDENCIES = 1;
51
+
52
+
53
+	/**
54
+	 * @type EE_Dependency_Map $_instance
55
+	 */
56
+	protected static $_instance;
57
+
58
+	/**
59
+	 * @var ClassInterfaceCache $class_cache
60
+	 */
61
+	private $class_cache;
62
+
63
+	/**
64
+	 * @type RequestInterface $request
65
+	 */
66
+	protected $request;
67
+
68
+	/**
69
+	 * @type LegacyRequestInterface $legacy_request
70
+	 */
71
+	protected $legacy_request;
72
+
73
+	/**
74
+	 * @type ResponseInterface $response
75
+	 */
76
+	protected $response;
77
+
78
+	/**
79
+	 * @type LoaderInterface $loader
80
+	 */
81
+	protected $loader;
82
+
83
+	/**
84
+	 * @type array $_dependency_map
85
+	 */
86
+	protected $_dependency_map = [];
87
+
88
+	/**
89
+	 * @type array $_class_loaders
90
+	 */
91
+	protected $_class_loaders = [];
92
+
93
+
94
+	/**
95
+	 * EE_Dependency_Map constructor.
96
+	 *
97
+	 * @param ClassInterfaceCache $class_cache
98
+	 */
99
+	protected function __construct(ClassInterfaceCache $class_cache)
100
+	{
101
+		$this->class_cache = $class_cache;
102
+		do_action('EE_Dependency_Map____construct', $this);
103
+	}
104
+
105
+
106
+	/**
107
+	 * @return void
108
+	 */
109
+	public function initialize()
110
+	{
111
+		$this->_register_core_dependencies();
112
+		$this->_register_core_class_loaders();
113
+		$this->_register_core_aliases();
114
+	}
115
+
116
+
117
+	/**
118
+	 * @singleton method used to instantiate class object
119
+	 * @param ClassInterfaceCache|null $class_cache
120
+	 * @return EE_Dependency_Map
121
+	 */
122
+	public static function instance(ClassInterfaceCache $class_cache = null)
123
+	{
124
+		// check if class object is instantiated, and instantiated properly
125
+		if (
126
+			! self::$_instance instanceof EE_Dependency_Map
127
+			&& $class_cache instanceof ClassInterfaceCache
128
+		) {
129
+			self::$_instance = new EE_Dependency_Map($class_cache);
130
+		}
131
+		return self::$_instance;
132
+	}
133
+
134
+
135
+	/**
136
+	 * @param RequestInterface $request
137
+	 */
138
+	public function setRequest(RequestInterface $request)
139
+	{
140
+		$this->request = $request;
141
+	}
142
+
143
+
144
+	/**
145
+	 * @param LegacyRequestInterface $legacy_request
146
+	 */
147
+	public function setLegacyRequest(LegacyRequestInterface $legacy_request)
148
+	{
149
+		$this->legacy_request = $legacy_request;
150
+	}
151
+
152
+
153
+	/**
154
+	 * @param ResponseInterface $response
155
+	 */
156
+	public function setResponse(ResponseInterface $response)
157
+	{
158
+		$this->response = $response;
159
+	}
160
+
161
+
162
+	/**
163
+	 * @param LoaderInterface $loader
164
+	 */
165
+	public function setLoader(LoaderInterface $loader)
166
+	{
167
+		$this->loader = $loader;
168
+	}
169
+
170
+
171
+	/**
172
+	 * @param string $class
173
+	 * @param array  $dependencies
174
+	 * @param int    $overwrite
175
+	 * @return bool
176
+	 */
177
+	public static function register_dependencies(
178
+		$class,
179
+		array $dependencies,
180
+		$overwrite = EE_Dependency_Map::KEEP_EXISTING_DEPENDENCIES
181
+	) {
182
+		return self::$_instance->registerDependencies($class, $dependencies, $overwrite);
183
+	}
184
+
185
+
186
+	/**
187
+	 * Assigns an array of class names and corresponding load sources (new or cached)
188
+	 * to the class specified by the first parameter.
189
+	 * IMPORTANT !!!
190
+	 * The order of elements in the incoming $dependencies array MUST match
191
+	 * the order of the constructor parameters for the class in question.
192
+	 * This is especially important when overriding any existing dependencies that are registered.
193
+	 * the third parameter controls whether any duplicate dependencies are overwritten or not.
194
+	 *
195
+	 * @param string $class
196
+	 * @param array  $dependencies
197
+	 * @param int    $overwrite
198
+	 * @return bool
199
+	 */
200
+	public function registerDependencies(
201
+		$class,
202
+		array $dependencies,
203
+		$overwrite = EE_Dependency_Map::KEEP_EXISTING_DEPENDENCIES
204
+	) {
205
+		$class      = trim($class, '\\');
206
+		$registered = false;
207
+		if (empty(self::$_instance->_dependency_map[ $class ])) {
208
+			self::$_instance->_dependency_map[ $class ] = [];
209
+		}
210
+		// we need to make sure that any aliases used when registering a dependency
211
+		// get resolved to the correct class name
212
+		foreach ($dependencies as $dependency => $load_source) {
213
+			$alias = self::$_instance->getFqnForAlias($dependency);
214
+			if (
215
+				$overwrite === EE_Dependency_Map::OVERWRITE_DEPENDENCIES
216
+				|| ! isset(self::$_instance->_dependency_map[ $class ][ $alias ])
217
+			) {
218
+				unset($dependencies[ $dependency ]);
219
+				$dependencies[ $alias ] = $load_source;
220
+				$registered             = true;
221
+			}
222
+		}
223
+		// now add our two lists of dependencies together.
224
+		// using Union (+=) favours the arrays in precedence from left to right,
225
+		// so $dependencies is NOT overwritten because it is listed first
226
+		// ie: with A = B + C, entries in B take precedence over duplicate entries in C
227
+		// Union is way faster than array_merge() but should be used with caution...
228
+		// especially with numerically indexed arrays
229
+		$dependencies += self::$_instance->_dependency_map[ $class ];
230
+		// now we need to ensure that the resulting dependencies
231
+		// array only has the entries that are required for the class
232
+		// so first count how many dependencies were originally registered for the class
233
+		$dependency_count = count(self::$_instance->_dependency_map[ $class ]);
234
+		// if that count is non-zero (meaning dependencies were already registered)
235
+		self::$_instance->_dependency_map[ $class ] = $dependency_count
236
+			// then truncate the  final array to match that count
237
+			? array_slice($dependencies, 0, $dependency_count)
238
+			// otherwise just take the incoming array because nothing previously existed
239
+			: $dependencies;
240
+		return $registered;
241
+	}
242
+
243
+
244
+	/**
245
+	 * @param string $class_name
246
+	 * @param string $loader
247
+	 * @param bool   $overwrite
248
+	 * @return bool
249
+	 * @throws DomainException
250
+	 */
251
+	public static function register_class_loader($class_name, $loader = 'load_core', $overwrite = false)
252
+	{
253
+		if (! $loader instanceof Closure && strpos($class_name, '\\') !== false) {
254
+			throw new DomainException(
255
+				esc_html__('Don\'t use class loaders for FQCNs.', 'event_espresso')
256
+			);
257
+		}
258
+		// check that loader is callable or method starts with "load_" and exists in EE_Registry
259
+		if (
260
+			! is_callable($loader)
261
+			&& (
262
+				strpos($loader, 'load_') !== 0
263
+				|| ! method_exists('EE_Registry', $loader)
264
+			)
265
+		) {
266
+			throw new DomainException(
267
+				sprintf(
268
+					esc_html__(
269
+						'"%1$s" is not a valid loader method on EE_Registry.',
270
+						'event_espresso'
271
+					),
272
+					$loader
273
+				)
274
+			);
275
+		}
276
+		$class_name = self::$_instance->getFqnForAlias($class_name);
277
+		if ($overwrite || ! isset(self::$_instance->_class_loaders[ $class_name ])) {
278
+			self::$_instance->_class_loaders[ $class_name ] = $loader;
279
+			return true;
280
+		}
281
+		return false;
282
+	}
283
+
284
+
285
+	/**
286
+	 * @return array
287
+	 */
288
+	public function dependency_map()
289
+	{
290
+		return $this->_dependency_map;
291
+	}
292
+
293
+
294
+	/**
295
+	 * returns TRUE if dependency map contains a listing for the provided class name
296
+	 *
297
+	 * @param string $class_name
298
+	 * @return boolean
299
+	 */
300
+	public function has($class_name = '')
301
+	{
302
+		// all legacy models have the same dependencies
303
+		if (strpos($class_name, 'EEM_') === 0) {
304
+			$class_name = 'LEGACY_MODELS';
305
+		}
306
+		return isset($this->_dependency_map[ $class_name ]);
307
+	}
308
+
309
+
310
+	/**
311
+	 * returns TRUE if dependency map contains a listing for the provided class name AND dependency
312
+	 *
313
+	 * @param string $class_name
314
+	 * @param string $dependency
315
+	 * @return bool
316
+	 */
317
+	public function has_dependency_for_class($class_name = '', $dependency = '')
318
+	{
319
+		// all legacy models have the same dependencies
320
+		if (strpos($class_name, 'EEM_') === 0) {
321
+			$class_name = 'LEGACY_MODELS';
322
+		}
323
+		$dependency = $this->getFqnForAlias($dependency, $class_name);
324
+		return isset($this->_dependency_map[ $class_name ][ $dependency ]);
325
+	}
326
+
327
+
328
+	/**
329
+	 * returns loading strategy for whether a previously cached dependency should be loaded or a new instance returned
330
+	 *
331
+	 * @param string $class_name
332
+	 * @param string $dependency
333
+	 * @return int
334
+	 */
335
+	public function loading_strategy_for_class_dependency($class_name = '', $dependency = '')
336
+	{
337
+		// all legacy models have the same dependencies
338
+		if (strpos($class_name, 'EEM_') === 0) {
339
+			$class_name = 'LEGACY_MODELS';
340
+		}
341
+		$dependency = $this->getFqnForAlias($dependency);
342
+		return $this->has_dependency_for_class($class_name, $dependency)
343
+			? $this->_dependency_map[ $class_name ][ $dependency ]
344
+			: EE_Dependency_Map::not_registered;
345
+	}
346
+
347
+
348
+	/**
349
+	 * @param string $class_name
350
+	 * @return string | Closure
351
+	 */
352
+	public function class_loader($class_name)
353
+	{
354
+		// all legacy models use load_model()
355
+		if (strpos($class_name, 'EEM_') === 0) {
356
+			return 'load_model';
357
+		}
358
+		// EE_CPT_*_Strategy classes like EE_CPT_Event_Strategy, EE_CPT_Venue_Strategy, etc
359
+		// perform strpos() first to avoid loading regex every time we load a class
360
+		if (
361
+			strpos($class_name, 'EE_CPT_') === 0
362
+			&& preg_match('/^EE_CPT_([a-zA-Z]+)_Strategy$/', $class_name)
363
+		) {
364
+			return 'load_core';
365
+		}
366
+		$class_name = $this->getFqnForAlias($class_name);
367
+		return isset($this->_class_loaders[ $class_name ]) ? $this->_class_loaders[ $class_name ] : '';
368
+	}
369
+
370
+
371
+	/**
372
+	 * @return array
373
+	 */
374
+	public function class_loaders()
375
+	{
376
+		return $this->_class_loaders;
377
+	}
378
+
379
+
380
+	/**
381
+	 * adds an alias for a classname
382
+	 *
383
+	 * @param string $fqcn      the class name that should be used (concrete class to replace interface)
384
+	 * @param string $alias     the class name that would be type hinted for (abstract parent or interface)
385
+	 * @param string $for_class the class that has the dependency (is type hinting for the interface)
386
+	 */
387
+	public function add_alias($fqcn, $alias, $for_class = '')
388
+	{
389
+		$this->class_cache->addAlias($fqcn, $alias, $for_class);
390
+	}
391
+
392
+
393
+	/**
394
+	 * Returns TRUE if the provided fully qualified name IS an alias
395
+	 * WHY?
396
+	 * Because if a class is type hinting for a concretion,
397
+	 * then why would we need to find another class to supply it?
398
+	 * ie: if a class asks for `Fully/Qualified/Namespace/SpecificClassName`,
399
+	 * then give it an instance of `Fully/Qualified/Namespace/SpecificClassName`.
400
+	 * Don't go looking for some substitute.
401
+	 * Whereas if a class is type hinting for an interface...
402
+	 * then we need to find an actual class to use.
403
+	 * So the interface IS the alias for some other FQN,
404
+	 * and we need to find out if `Fully/Qualified/Namespace/SomeInterface`
405
+	 * represents some other class.
406
+	 *
407
+	 * @param string $fqn
408
+	 * @param string $for_class
409
+	 * @return bool
410
+	 */
411
+	public function isAlias($fqn = '', $for_class = '')
412
+	{
413
+		return $this->class_cache->isAlias($fqn, $for_class);
414
+	}
415
+
416
+
417
+	/**
418
+	 * Returns a FQN for provided alias if one exists, otherwise returns the original $alias
419
+	 * functions recursively, so that multiple aliases can be used to drill down to a FQN
420
+	 *  for example:
421
+	 *      if the following two entries were added to the _aliases array:
422
+	 *          array(
423
+	 *              'interface_alias'           => 'some\namespace\interface'
424
+	 *              'some\namespace\interface'  => 'some\namespace\classname'
425
+	 *          )
426
+	 *      then one could use EE_Registry::instance()->create( 'interface_alias' )
427
+	 *      to load an instance of 'some\namespace\classname'
428
+	 *
429
+	 * @param string $alias
430
+	 * @param string $for_class
431
+	 * @return string
432
+	 */
433
+	public function getFqnForAlias($alias = '', $for_class = '')
434
+	{
435
+		return $this->class_cache->getFqnForAlias($alias, $for_class);
436
+	}
437
+
438
+
439
+	/**
440
+	 * Registers the core dependencies and whether a previously instantiated object should be loaded from the cache,
441
+	 * if one exists, or whether a new object should be generated every time the requested class is loaded.
442
+	 * This is done by using the following class constants:
443
+	 *        EE_Dependency_Map::load_from_cache - loads previously instantiated object
444
+	 *        EE_Dependency_Map::load_new_object - generates a new object every time
445
+	 */
446
+	protected function _register_core_dependencies()
447
+	{
448
+		$this->_dependency_map = [
449
+			'EE_Admin'                                                                                          => [
450
+				'EventEspresso\core\services\request\Request'     => EE_Dependency_Map::load_from_cache,
451
+			],
452
+			'EE_Request_Handler'                                                                                          => [
453
+				'EventEspresso\core\services\request\Request'     => EE_Dependency_Map::load_from_cache,
454
+				'EventEspresso\core\services\request\Response'    => EE_Dependency_Map::load_from_cache,
455
+			],
456
+			'EE_System'                                                                                                   => [
457
+				'EE_Registry'                                 => EE_Dependency_Map::load_from_cache,
458
+				'EventEspresso\core\services\loaders\Loader'  => EE_Dependency_Map::load_from_cache,
459
+				'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
460
+				'EE_Maintenance_Mode'                         => EE_Dependency_Map::load_from_cache,
461
+			],
462
+			'EE_Session'                                                                                                  => [
463
+				'EventEspresso\core\services\cache\TransientCacheStorage'  => EE_Dependency_Map::load_from_cache,
464
+				'EventEspresso\core\domain\values\session\SessionLifespan' => EE_Dependency_Map::load_from_cache,
465
+				'EventEspresso\core\services\request\Request'              => EE_Dependency_Map::load_from_cache,
466
+				'EventEspresso\core\services\session\SessionStartHandler'  => EE_Dependency_Map::load_from_cache,
467
+				'EE_Encryption'                                            => EE_Dependency_Map::load_from_cache,
468
+			],
469
+			'EE_Cart'                                                                                                     => [
470
+				'EE_Session' => EE_Dependency_Map::load_from_cache,
471
+			],
472
+			'EE_Front_Controller'                                                                                         => [
473
+				'EE_Registry'                                     => EE_Dependency_Map::load_from_cache,
474
+				'EventEspresso\core\services\request\CurrentPage' => EE_Dependency_Map::load_from_cache,
475
+				'EE_Module_Request_Router'                        => EE_Dependency_Map::load_from_cache,
476
+			],
477
+			'EE_Messenger_Collection_Loader'                                                                              => [
478
+				'EE_Messenger_Collection' => EE_Dependency_Map::load_new_object,
479
+			],
480
+			'EE_Message_Type_Collection_Loader'                                                                           => [
481
+				'EE_Message_Type_Collection' => EE_Dependency_Map::load_new_object,
482
+			],
483
+			'EE_Message_Resource_Manager'                                                                                 => [
484
+				'EE_Messenger_Collection_Loader'    => EE_Dependency_Map::load_new_object,
485
+				'EE_Message_Type_Collection_Loader' => EE_Dependency_Map::load_new_object,
486
+				'EEM_Message_Template_Group'        => EE_Dependency_Map::load_from_cache,
487
+			],
488
+			'EE_Message_Factory'                                                                                          => [
489
+				'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache,
490
+			],
491
+			'EE_messages'                                                                                                 => [
492
+				'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache,
493
+			],
494
+			'EE_Messages_Generator'                                                                                       => [
495
+				'EE_Messages_Queue'                    => EE_Dependency_Map::load_new_object,
496
+				'EE_Messages_Data_Handler_Collection'  => EE_Dependency_Map::load_new_object,
497
+				'EE_Message_Template_Group_Collection' => EE_Dependency_Map::load_new_object,
498
+				'EEH_Parse_Shortcodes'                 => EE_Dependency_Map::load_from_cache,
499
+			],
500
+			'EE_Messages_Processor'                                                                                       => [
501
+				'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache,
502
+			],
503
+			'EE_Messages_Queue'                                                                                           => [
504
+				'EE_Message_Repository' => EE_Dependency_Map::load_new_object,
505
+			],
506
+			'EE_Messages_Template_Defaults'                                                                               => [
507
+				'EEM_Message_Template_Group' => EE_Dependency_Map::load_from_cache,
508
+				'EEM_Message_Template'       => EE_Dependency_Map::load_from_cache,
509
+			],
510
+			'EE_Message_To_Generate_From_Request'                                                                         => [
511
+				'EE_Message_Resource_Manager'                 => EE_Dependency_Map::load_from_cache,
512
+				'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
513
+			],
514
+			'EventEspresso\core\services\commands\CommandBus'                                                             => [
515
+				'EventEspresso\core\services\commands\CommandHandlerManager' => EE_Dependency_Map::load_from_cache,
516
+			],
517
+			'EventEspresso\services\commands\CommandHandler'                                                              => [
518
+				'EE_Registry'         => EE_Dependency_Map::load_from_cache,
519
+				'CommandBusInterface' => EE_Dependency_Map::load_from_cache,
520
+			],
521
+			'EventEspresso\core\services\commands\CommandHandlerManager'                                                  => [
522
+				'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,
523
+			],
524
+			'EventEspresso\core\services\commands\CompositeCommandHandler'                                                => [
525
+				'EventEspresso\core\services\commands\CommandBus'     => EE_Dependency_Map::load_from_cache,
526
+				'EventEspresso\core\services\commands\CommandFactory' => EE_Dependency_Map::load_from_cache,
527
+			],
528
+			'EventEspresso\core\services\commands\CommandFactory'                                                         => [
529
+				'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,
530
+			],
531
+			'EventEspresso\core\services\commands\middleware\CapChecker'                                                  => [
532
+				'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker' => EE_Dependency_Map::load_from_cache,
533
+			],
534
+			'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker'                                         => [
535
+				'EE_Capabilities' => EE_Dependency_Map::load_from_cache,
536
+			],
537
+			'EventEspresso\core\domain\services\capabilities\RegistrationsCapChecker'                                     => [
538
+				'EE_Capabilities' => EE_Dependency_Map::load_from_cache,
539
+			],
540
+			'EventEspresso\core\services\commands\registration\CreateRegistrationCommandHandler'                          => [
541
+				'EventEspresso\core\domain\services\registration\CreateRegistrationService' => EE_Dependency_Map::load_from_cache,
542
+			],
543
+			'EventEspresso\core\services\commands\registration\CopyRegistrationDetailsCommandHandler'                     => [
544
+				'EventEspresso\core\domain\services\registration\CopyRegistrationService' => EE_Dependency_Map::load_from_cache,
545
+			],
546
+			'EventEspresso\core\services\commands\registration\CopyRegistrationPaymentsCommandHandler'                    => [
547
+				'EventEspresso\core\domain\services\registration\CopyRegistrationService' => EE_Dependency_Map::load_from_cache,
548
+			],
549
+			'EventEspresso\core\services\commands\registration\CancelRegistrationAndTicketLineItemCommandHandler'         => [
550
+				'EventEspresso\core\domain\services\registration\CancelTicketLineItemService' => EE_Dependency_Map::load_from_cache,
551
+			],
552
+			'EventEspresso\core\services\commands\registration\UpdateRegistrationAndTransactionAfterChangeCommandHandler' => [
553
+				'EventEspresso\core\domain\services\registration\UpdateRegistrationService' => EE_Dependency_Map::load_from_cache,
554
+			],
555
+			'EventEspresso\core\services\commands\ticket\CreateTicketLineItemCommandHandler'                              => [
556
+				'EventEspresso\core\domain\services\ticket\CreateTicketLineItemService' => EE_Dependency_Map::load_from_cache,
557
+			],
558
+			'EventEspresso\core\services\commands\ticket\CancelTicketLineItemCommandHandler'                              => [
559
+				'EventEspresso\core\domain\services\ticket\CancelTicketLineItemService' => EE_Dependency_Map::load_from_cache,
560
+			],
561
+			'EventEspresso\core\domain\services\registration\CancelRegistrationService'                                   => [
562
+				'EventEspresso\core\domain\services\ticket\CancelTicketLineItemService' => EE_Dependency_Map::load_from_cache,
563
+			],
564
+			'EventEspresso\core\services\commands\attendee\CreateAttendeeCommandHandler'                                  => [
565
+				'EEM_Attendee' => EE_Dependency_Map::load_from_cache,
566
+			],
567
+			'EventEspresso\core\services\database\TableManager'                                                           => [
568
+				'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
569
+			],
570
+			'EE_Data_Migration_Class_Base'                                                                                => [
571
+				'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
572
+				'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
573
+			],
574
+			'EE_DMS_Core_4_1_0'                                                                                           => [
575
+				'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
576
+				'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
577
+			],
578
+			'EE_DMS_Core_4_2_0'                                                                                           => [
579
+				'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
580
+				'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
581
+			],
582
+			'EE_DMS_Core_4_3_0'                                                                                           => [
583
+				'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
584
+				'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
585
+			],
586
+			'EE_DMS_Core_4_4_0'                                                                                           => [
587
+				'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
588
+				'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
589
+			],
590
+			'EE_DMS_Core_4_5_0'                                                                                           => [
591
+				'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
592
+				'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
593
+			],
594
+			'EE_DMS_Core_4_6_0'                                                                                           => [
595
+				'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
596
+				'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
597
+			],
598
+			'EE_DMS_Core_4_7_0'                                                                                           => [
599
+				'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
600
+				'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
601
+			],
602
+			'EE_DMS_Core_4_8_0'                                                                                           => [
603
+				'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
604
+				'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
605
+			],
606
+			'EE_DMS_Core_4_9_0'                                                                                           => [
607
+				'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
608
+				'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
609
+			],
610
+			'EE_DMS_Core_4_10_0'                                                                                          => [
611
+				'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
612
+				'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
613
+				'EE_DMS_Core_4_9_0'                                  => EE_Dependency_Map::load_from_cache,
614
+			],
615
+			'EventEspresso\core\services\assets\I18nRegistry'                                                             => [
616
+				'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache,
617
+			],
618
+			'EventEspresso\core\services\assets\Registry'                                                                 => [
619
+				'EventEspresso\core\services\assets\AssetCollection' => EE_Dependency_Map::load_from_cache,
620
+				'EventEspresso\core\services\assets\I18nRegistry'    => EE_Dependency_Map::load_from_cache,
621
+			],
622
+			'EventEspresso\core\domain\entities\shortcodes\EspressoCancelled'                                             => [
623
+				'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache,
624
+			],
625
+			'EventEspresso\core\domain\entities\shortcodes\EspressoCheckout'                                              => [
626
+				'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache,
627
+			],
628
+			'EventEspresso\core\domain\entities\shortcodes\EspressoEventAttendees'                                        => [
629
+				'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache,
630
+			],
631
+			'EventEspresso\core\domain\entities\shortcodes\EspressoEvents'                                                => [
632
+				'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache,
633
+			],
634
+			'EventEspresso\core\domain\entities\shortcodes\EspressoThankYou'                                              => [
635
+				'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache,
636
+			],
637
+			'EventEspresso\core\domain\entities\shortcodes\EspressoTicketSelector'                                        => [
638
+				'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache,
639
+			],
640
+			'EventEspresso\core\domain\entities\shortcodes\EspressoTxnPage'                                               => [
641
+				'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache,
642
+			],
643
+			'EventEspresso\core\services\cache\BasicCacheManager'                                                         => [
644
+				'EventEspresso\core\services\cache\TransientCacheStorage' => EE_Dependency_Map::load_from_cache,
645
+			],
646
+			'EventEspresso\core\services\cache\PostRelatedCacheManager'                                                   => [
647
+				'EventEspresso\core\services\cache\TransientCacheStorage' => EE_Dependency_Map::load_from_cache,
648
+			],
649
+			'EventEspresso\core\domain\services\validation\email\EmailValidationService'                                  => [
650
+				'EE_Registration_Config'                     => EE_Dependency_Map::load_from_cache,
651
+				'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,
652
+			],
653
+			'EventEspresso\core\domain\values\EmailAddress'                                                               => [
654
+				null,
655
+				'EventEspresso\core\domain\services\validation\email\EmailValidationService' => EE_Dependency_Map::load_from_cache,
656
+			],
657
+			'EventEspresso\core\services\orm\ModelFieldFactory'                                                           => [
658
+				'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,
659
+			],
660
+			'LEGACY_MODELS'                                                                                               => [
661
+				null,
662
+				'EventEspresso\core\services\database\ModelFieldFactory' => EE_Dependency_Map::load_from_cache,
663
+			],
664
+			'EE_Module_Request_Router'                                                                                    => [
665
+				'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
666
+			],
667
+			'EE_Registration_Processor'                                                                                   => [
668
+				'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
669
+			],
670
+			'EventEspresso\core\services\notifications\PersistentAdminNoticeManager'                                      => [
671
+				'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker' => EE_Dependency_Map::load_from_cache,
672
+				'EventEspresso\core\services\request\Request'                         => EE_Dependency_Map::load_from_cache,
673
+			],
674
+			'EventEspresso\core\services\licensing\LicenseService'                                                        => [
675
+				'EventEspresso\core\domain\services\pue\Stats'  => EE_Dependency_Map::load_from_cache,
676
+				'EventEspresso\core\domain\services\pue\Config' => EE_Dependency_Map::load_from_cache,
677
+			],
678
+			'EE_Admin_Transactions_List_Table'                                                                            => [
679
+				null,
680
+				'EventEspresso\core\domain\values\session\SessionLifespan' => EE_Dependency_Map::load_from_cache,
681
+			],
682
+			'EventEspresso\core\domain\services\pue\Stats'                                                                => [
683
+				'EventEspresso\core\domain\services\pue\Config'        => EE_Dependency_Map::load_from_cache,
684
+				'EE_Maintenance_Mode'                                  => EE_Dependency_Map::load_from_cache,
685
+				'EventEspresso\core\domain\services\pue\StatsGatherer' => EE_Dependency_Map::load_from_cache,
686
+			],
687
+			'EventEspresso\core\domain\services\pue\Config'                                                               => [
688
+				'EE_Network_Config' => EE_Dependency_Map::load_from_cache,
689
+				'EE_Config'         => EE_Dependency_Map::load_from_cache,
690
+			],
691
+			'EventEspresso\core\domain\services\pue\StatsGatherer'                                                        => [
692
+				'EEM_Payment_Method' => EE_Dependency_Map::load_from_cache,
693
+				'EEM_Event'          => EE_Dependency_Map::load_from_cache,
694
+				'EEM_Datetime'       => EE_Dependency_Map::load_from_cache,
695
+				'EEM_Ticket'         => EE_Dependency_Map::load_from_cache,
696
+				'EEM_Registration'   => EE_Dependency_Map::load_from_cache,
697
+				'EEM_Transaction'    => EE_Dependency_Map::load_from_cache,
698
+				'EE_Config'          => EE_Dependency_Map::load_from_cache,
699
+			],
700
+			'EventEspresso\core\domain\services\admin\ExitModal'                                                          => [
701
+				'EventEspresso\core\services\assets\Registry' => EE_Dependency_Map::load_from_cache,
702
+			],
703
+			'EventEspresso\core\domain\services\admin\PluginUpsells'                                                      => [
704
+				'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache,
705
+			],
706
+			'EventEspresso\caffeinated\modules\recaptcha_invisible\InvisibleRecaptcha'                                    => [
707
+				'EE_Registration_Config' => EE_Dependency_Map::load_from_cache,
708
+				'EE_Session'             => EE_Dependency_Map::load_from_cache,
709
+			],
710
+			'EventEspresso\caffeinated\modules\recaptcha_invisible\RecaptchaAdminSettings'                                => [
711
+				'EE_Registration_Config' => EE_Dependency_Map::load_from_cache,
712
+			],
713
+			'EventEspresso\modules\ticket_selector\DisplayTicketSelector' => [
714
+				'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
715
+				'EE_Ticket_Selector_Config'                   => EE_Dependency_Map::load_from_cache,
716
+			],
717
+			'EventEspresso\modules\ticket_selector\ProcessTicketSelector'                                                 => [
718
+				'EE_Core_Config'                                                          => EE_Dependency_Map::load_from_cache,
719
+				'EventEspresso\core\services\request\Request'                             => EE_Dependency_Map::load_from_cache,
720
+				'EE_Session'                                                              => EE_Dependency_Map::load_from_cache,
721
+				'EEM_Ticket'                                                              => EE_Dependency_Map::load_from_cache,
722
+				'EventEspresso\modules\ticket_selector\TicketDatetimeAvailabilityTracker' => EE_Dependency_Map::load_from_cache,
723
+			],
724
+			'EventEspresso\modules\ticket_selector\TicketDatetimeAvailabilityTracker'                                     => [
725
+				'EEM_Datetime' => EE_Dependency_Map::load_from_cache,
726
+			],
727
+			'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions'                              => [
728
+				'EE_Core_Config'                             => EE_Dependency_Map::load_from_cache,
729
+				'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,
730
+			],
731
+			'EventEspresso\core\domain\services\custom_post_types\RegisterCustomPostTypes'                                => [
732
+				'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions' => EE_Dependency_Map::load_from_cache,
733
+			],
734
+			'EventEspresso\core\domain\services\custom_post_types\RegisterCustomTaxonomies'                               => [
735
+				'EventEspresso\core\domain\entities\custom_post_types\CustomTaxonomyDefinitions' => EE_Dependency_Map::load_from_cache,
736
+			],
737
+			'EE_CPT_Strategy'                                                                                             => [
738
+				'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions' => EE_Dependency_Map::load_from_cache,
739
+				'EventEspresso\core\domain\entities\custom_post_types\CustomTaxonomyDefinitions' => EE_Dependency_Map::load_from_cache,
740
+			],
741
+			'EventEspresso\core\services\loaders\ObjectIdentifier'                                                        => [
742
+				'EventEspresso\core\services\loaders\ClassInterfaceCache' => EE_Dependency_Map::load_from_cache,
743
+			],
744
+			'EventEspresso\core\domain\services\assets\CoreAssetManager'                                                  => [
745
+				'EventEspresso\core\services\assets\AssetCollection' => EE_Dependency_Map::load_from_cache,
746
+				'EE_Currency_Config'                                 => EE_Dependency_Map::load_from_cache,
747
+				'EE_Template_Config'                                 => EE_Dependency_Map::load_from_cache,
748
+				'EventEspresso\core\domain\Domain'                   => EE_Dependency_Map::load_from_cache,
749
+				'EventEspresso\core\services\assets\Registry'        => EE_Dependency_Map::load_from_cache,
750
+			],
751
+			'EventEspresso\core\domain\services\admin\privacy\policy\PrivacyPolicy'                                       => [
752
+				'EEM_Payment_Method'                                       => EE_Dependency_Map::load_from_cache,
753
+				'EventEspresso\core\domain\values\session\SessionLifespan' => EE_Dependency_Map::load_from_cache,
754
+			],
755
+			'EventEspresso\core\domain\services\admin\privacy\export\ExportAttendee'                                      => [
756
+				'EEM_Attendee' => EE_Dependency_Map::load_from_cache,
757
+			],
758
+			'EventEspresso\core\domain\services\admin\privacy\export\ExportAttendeeBillingData'                           => [
759
+				'EEM_Attendee'       => EE_Dependency_Map::load_from_cache,
760
+				'EEM_Payment_Method' => EE_Dependency_Map::load_from_cache,
761
+			],
762
+			'EventEspresso\core\domain\services\admin\privacy\export\ExportCheckins'                                      => [
763
+				'EEM_Checkin' => EE_Dependency_Map::load_from_cache,
764
+			],
765
+			'EventEspresso\core\domain\services\admin\privacy\export\ExportRegistration'                                  => [
766
+				'EEM_Registration' => EE_Dependency_Map::load_from_cache,
767
+			],
768
+			'EventEspresso\core\domain\services\admin\privacy\export\ExportTransaction'                                   => [
769
+				'EEM_Transaction' => EE_Dependency_Map::load_from_cache,
770
+			],
771
+			'EventEspresso\core\domain\services\admin\privacy\erasure\EraseAttendeeData'                                  => [
772
+				'EEM_Attendee' => EE_Dependency_Map::load_from_cache,
773
+			],
774
+			'EventEspresso\core\domain\services\admin\privacy\erasure\EraseAnswers'                                       => [
775
+				'EEM_Answer'   => EE_Dependency_Map::load_from_cache,
776
+				'EEM_Question' => EE_Dependency_Map::load_from_cache,
777
+			],
778
+			'EventEspresso\core\CPTs\CptQueryModifier'                                                                    => [
779
+				null,
780
+				null,
781
+				null,
782
+				'EventEspresso\core\services\request\CurrentPage' => EE_Dependency_Map::load_from_cache,
783
+				'EventEspresso\core\services\request\Request'     => EE_Dependency_Map::load_from_cache,
784
+				'EventEspresso\core\services\loaders\Loader'      => EE_Dependency_Map::load_from_cache,
785
+			],
786
+			'EventEspresso\core\domain\services\admin\privacy\forms\PrivacySettingsFormHandler'                           => [
787
+				'EE_Registry' => EE_Dependency_Map::load_from_cache,
788
+				'EE_Config'   => EE_Dependency_Map::load_from_cache,
789
+			],
790
+			'EventEspresso\core\services\editor\BlockRegistrationManager'                                                 => [
791
+				'EventEspresso\core\services\assets\BlockAssetManagerCollection'         => EE_Dependency_Map::load_from_cache,
792
+				'EventEspresso\core\domain\entities\editor\BlockCollection'              => EE_Dependency_Map::load_from_cache,
793
+				'EventEspresso\core\services\route_match\RouteMatchSpecificationManager' => EE_Dependency_Map::load_from_cache,
794
+				'EventEspresso\core\services\request\Request'                            => EE_Dependency_Map::load_from_cache,
795
+			],
796
+			'EventEspresso\core\domain\entities\editor\CoreBlocksAssetManager'                                            => [
797
+				'EventEspresso\core\domain\Domain'                   => EE_Dependency_Map::load_from_cache,
798
+				'EventEspresso\core\services\assets\AssetCollection' => EE_Dependency_Map::load_from_cache,
799
+				'EventEspresso\core\services\assets\Registry'        => EE_Dependency_Map::load_from_cache,
800
+			],
801
+			'EventEspresso\core\domain\services\blocks\EventAttendeesBlockRenderer'                                       => [
802
+				'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache,
803
+				'EEM_Attendee'                     => EE_Dependency_Map::load_from_cache,
804
+			],
805
+			'EventEspresso\core\domain\entities\editor\blocks\EventAttendees'                                             => [
806
+				'EventEspresso\core\domain\entities\editor\CoreBlocksAssetManager'      => self::load_from_cache,
807
+				'EventEspresso\core\services\request\Request'                           => EE_Dependency_Map::load_from_cache,
808
+				'EventEspresso\core\domain\services\blocks\EventAttendeesBlockRenderer' => self::load_from_cache,
809
+			],
810
+			'EventEspresso\core\services\route_match\RouteMatchSpecificationDependencyResolver'                           => [
811
+				'EventEspresso\core\services\container\Mirror'            => EE_Dependency_Map::load_from_cache,
812
+				'EventEspresso\core\services\loaders\ClassInterfaceCache' => EE_Dependency_Map::load_from_cache,
813
+				'EE_Dependency_Map'                                       => EE_Dependency_Map::load_from_cache,
814
+			],
815
+			'EventEspresso\core\services\route_match\RouteMatchSpecificationFactory'                                      => [
816
+				'EventEspresso\core\services\route_match\RouteMatchSpecificationDependencyResolver' => EE_Dependency_Map::load_from_cache,
817
+				'EventEspresso\core\services\loaders\Loader'                                        => EE_Dependency_Map::load_from_cache,
818
+			],
819
+			'EventEspresso\core\services\route_match\RouteMatchSpecificationManager'                                      => [
820
+				'EventEspresso\core\services\route_match\RouteMatchSpecificationCollection' => EE_Dependency_Map::load_from_cache,
821
+				'EventEspresso\core\services\route_match\RouteMatchSpecificationFactory'    => EE_Dependency_Map::load_from_cache,
822
+			],
823
+			'EventEspresso\core\libraries\rest_api\CalculatedModelFields'                                                 => [
824
+				'EventEspresso\core\libraries\rest_api\calculations\CalculatedModelFieldsFactory' => EE_Dependency_Map::load_from_cache,
825
+			],
826
+			'EventEspresso\core\libraries\rest_api\calculations\CalculatedModelFieldsFactory'                             => [
827
+				'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,
828
+			],
829
+			'EventEspresso\core\libraries\rest_api\controllers\model\Read'                                                => [
830
+				'EventEspresso\core\libraries\rest_api\CalculatedModelFields' => EE_Dependency_Map::load_from_cache,
831
+			],
832
+			'EventEspresso\core\libraries\rest_api\calculations\Datetime'                                                 => [
833
+				'EEM_Datetime'     => EE_Dependency_Map::load_from_cache,
834
+				'EEM_Registration' => EE_Dependency_Map::load_from_cache,
835
+			],
836
+			'EventEspresso\core\libraries\rest_api\calculations\Event'                                                    => [
837
+				'EEM_Event'        => EE_Dependency_Map::load_from_cache,
838
+				'EEM_Registration' => EE_Dependency_Map::load_from_cache,
839
+			],
840
+			'EventEspresso\core\libraries\rest_api\calculations\Registration'                                             => [
841
+				'EEM_Registration' => EE_Dependency_Map::load_from_cache,
842
+			],
843
+			'EventEspresso\core\services\session\SessionStartHandler'                                                     => [
844
+				'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
845
+			],
846
+			'EE_URL_Validation_Strategy'                                                                                  => [
847
+				null,
848
+				null,
849
+				'EventEspresso\core\services\validators\URLValidator' => EE_Dependency_Map::load_from_cache,
850
+			],
851
+			'EventEspresso\admin_pages\general_settings\OrganizationSettings'                                             => [
852
+				'EE_Registry'                                             => EE_Dependency_Map::load_from_cache,
853
+				'EE_Organization_Config'                                  => EE_Dependency_Map::load_from_cache,
854
+				'EE_Core_Config'                                          => EE_Dependency_Map::load_from_cache,
855
+				'EE_Network_Core_Config'                                  => EE_Dependency_Map::load_from_cache,
856
+				'EventEspresso\core\services\address\CountrySubRegionDao' => EE_Dependency_Map::load_from_cache,
857
+			],
858
+			'EventEspresso\core\services\address\CountrySubRegionDao'                                                     => [
859
+				'EEM_State'                                            => EE_Dependency_Map::load_from_cache,
860
+				'EventEspresso\core\services\validators\JsonValidator' => EE_Dependency_Map::load_from_cache,
861
+			],
862
+			'EventEspresso\core\domain\services\admin\ajax\WordpressHeartbeat'                                            => [
863
+				'EventEspresso\core\services\loaders\Loader'  => EE_Dependency_Map::load_from_cache,
864
+				'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
865
+			],
866
+			'EventEspresso\core\domain\services\admin\ajax\EventEditorHeartbeat'                                          => [
867
+				'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache,
868
+				'EE_Environment_Config'            => EE_Dependency_Map::load_from_cache,
869
+			],
870
+			'EventEspresso\core\services\request\files\FilesDataHandler'                                                  => [
871
+				'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
872
+			],
873
+			'EventEspressoBatchRequest\BatchRequestProcessor'                                                             => [
874
+				'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,
875
+			],
876
+			'EventEspresso\core\domain\services\admin\registrations\list_table\QueryBuilder'                              => [
877
+				'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
878
+				'EEM_Registration'                            => EE_Dependency_Map::load_from_cache,
879
+				null,
880
+			],
881
+			'EventEspresso\core\domain\services\admin\registrations\list_table\page_header\AttendeeFilterHeader'          => [
882
+				'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
883
+				'EEM_Attendee'                                => EE_Dependency_Map::load_from_cache,
884
+			],
885
+			'EventEspresso\core\domain\services\admin\registrations\list_table\page_header\DateFilterHeader'              => [
886
+				'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
887
+				'EEM_Datetime'                                => EE_Dependency_Map::load_from_cache,
888
+			],
889
+			'EventEspresso\core\domain\services\admin\registrations\list_table\page_header\EventFilterHeader'             => [
890
+				'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
891
+				'EEM_Event'                                   => EE_Dependency_Map::load_from_cache,
892
+			],
893
+			'EventEspresso\core\domain\services\admin\registrations\list_table\page_header\TicketFilterHeader'            => [
894
+				'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
895
+				'EEM_Ticket'                                  => EE_Dependency_Map::load_from_cache,
896
+			],
897
+			'EventEspressoBatchRequest\JobHandlers\ExecuteBatchDeletion'                                                  => [
898
+				'EventEspresso\core\services\orm\tree_traversal\NodeGroupDao' => EE_Dependency_Map::load_from_cache,
899
+			],
900
+			'EventEspressoBatchRequest\JobHandlers\PreviewEventDeletion'                                                  => [
901
+				'EventEspresso\core\services\orm\tree_traversal\NodeGroupDao' => EE_Dependency_Map::load_from_cache,
902
+			],
903
+			'EventEspresso\core\domain\services\admin\events\data\PreviewDeletion'                                        => [
904
+				'EventEspresso\core\services\orm\tree_traversal\NodeGroupDao' => EE_Dependency_Map::load_from_cache,
905
+				'EEM_Event'                                                   => EE_Dependency_Map::load_from_cache,
906
+				'EEM_Datetime'                                                => EE_Dependency_Map::load_from_cache,
907
+				'EEM_Registration'                                            => EE_Dependency_Map::load_from_cache,
908
+			],
909
+			'EventEspresso\core\domain\services\admin\events\data\ConfirmDeletion'                                        => [
910
+				'EventEspresso\core\services\orm\tree_traversal\NodeGroupDao' => EE_Dependency_Map::load_from_cache,
911
+			],
912
+			'EventEspresso\core\services\request\CurrentPage'                                                             => [
913
+				'EE_CPT_Strategy'                             => EE_Dependency_Map::load_from_cache,
914
+				'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
915
+			],
916
+			'EventEspresso\core\services\shortcodes\LegacyShortcodesManager'                                              => [
917
+				'EE_Registry'                                     => EE_Dependency_Map::load_from_cache,
918
+				'EventEspresso\core\services\request\CurrentPage' => EE_Dependency_Map::load_from_cache,
919
+			],
920
+			'EventEspresso\core\services\shortcodes\ShortcodesManager'                                                    => [
921
+				'EventEspresso\core\services\shortcodes\LegacyShortcodesManager' => EE_Dependency_Map::load_from_cache,
922
+				'EventEspresso\core\services\request\CurrentPage'                => EE_Dependency_Map::load_from_cache,
923
+			],
924
+		];
925
+	}
926
+
927
+
928
+	/**
929
+	 * Registers how core classes are loaded.
930
+	 * This can either be done by simply providing the name of one of the EE_Registry loader methods such as:
931
+	 *        'EE_Request_Handler' => 'load_core'
932
+	 *        'EE_Messages_Queue'  => 'load_lib'
933
+	 *        'EEH_Debug_Tools'    => 'load_helper'
934
+	 * or, if greater control is required, by providing a custom closure. For example:
935
+	 *        'Some_Class' => function () {
936
+	 *            return new Some_Class();
937
+	 *        },
938
+	 * This is required for instantiating dependencies
939
+	 * where an interface has been type hinted in a class constructor. For example:
940
+	 *        'Required_Interface' => function () {
941
+	 *            return new A_Class_That_Implements_Required_Interface();
942
+	 *        },
943
+	 */
944
+	protected function _register_core_class_loaders()
945
+	{
946
+		$this->_class_loaders = [
947
+			// load_core
948
+			'EE_Dependency_Map'                            => function () {
949
+				return $this;
950
+			},
951
+			'EE_Capabilities'                              => 'load_core',
952
+			'EE_Encryption'                                => 'load_core',
953
+			'EE_Front_Controller'                          => 'load_core',
954
+			'EE_Module_Request_Router'                     => 'load_core',
955
+			'EE_Registry'                                  => 'load_core',
956
+			'EE_Request'                                   => function () {
957
+				return $this->legacy_request;
958
+			},
959
+			'EventEspresso\core\services\request\Request'  => function () {
960
+				return $this->request;
961
+			},
962
+			'EventEspresso\core\services\request\Response' => function () {
963
+				return $this->response;
964
+			},
965
+			'EE_Base'                                      => 'load_core',
966
+			'EE_Request_Handler'                           => 'load_core',
967
+			'EE_Session'                                   => 'load_core',
968
+			'EE_Cron_Tasks'                                => 'load_core',
969
+			'EE_System'                                    => 'load_core',
970
+			'EE_Maintenance_Mode'                          => 'load_core',
971
+			'EE_Register_CPTs'                             => 'load_core',
972
+			'EE_Admin'                                     => 'load_core',
973
+			'EE_CPT_Strategy'                              => 'load_core',
974
+			// load_class
975
+			'EE_Registration_Processor'                    => 'load_class',
976
+			// load_lib
977
+			'EE_Message_Resource_Manager'                  => 'load_lib',
978
+			'EE_Message_Type_Collection'                   => 'load_lib',
979
+			'EE_Message_Type_Collection_Loader'            => 'load_lib',
980
+			'EE_Messenger_Collection'                      => 'load_lib',
981
+			'EE_Messenger_Collection_Loader'               => 'load_lib',
982
+			'EE_Messages_Processor'                        => 'load_lib',
983
+			'EE_Message_Repository'                        => 'load_lib',
984
+			'EE_Messages_Queue'                            => 'load_lib',
985
+			'EE_Messages_Data_Handler_Collection'          => 'load_lib',
986
+			'EE_Message_Template_Group_Collection'         => 'load_lib',
987
+			'EE_Payment_Method_Manager'                    => 'load_lib',
988
+			'EE_DMS_Core_4_1_0'                            => 'load_dms',
989
+			'EE_DMS_Core_4_2_0'                            => 'load_dms',
990
+			'EE_DMS_Core_4_3_0'                            => 'load_dms',
991
+			'EE_DMS_Core_4_5_0'                            => 'load_dms',
992
+			'EE_DMS_Core_4_6_0'                            => 'load_dms',
993
+			'EE_DMS_Core_4_7_0'                            => 'load_dms',
994
+			'EE_DMS_Core_4_8_0'                            => 'load_dms',
995
+			'EE_DMS_Core_4_9_0'                            => 'load_dms',
996
+			'EE_DMS_Core_4_10_0'                           => 'load_dms',
997
+			'EE_Messages_Generator'                        => function () {
998
+				return EE_Registry::instance()->load_lib(
999
+					'Messages_Generator',
1000
+					[],
1001
+					false,
1002
+					false
1003
+				);
1004
+			},
1005
+			'EE_Messages_Template_Defaults'                => function ($arguments = []) {
1006
+				return EE_Registry::instance()->load_lib(
1007
+					'Messages_Template_Defaults',
1008
+					$arguments,
1009
+					false,
1010
+					false
1011
+				);
1012
+			},
1013
+			// load_helper
1014
+			'EEH_Parse_Shortcodes'                         => function () {
1015
+				if (EE_Registry::instance()->load_helper('Parse_Shortcodes')) {
1016
+					return new EEH_Parse_Shortcodes();
1017
+				}
1018
+				return null;
1019
+			},
1020
+			'EE_Template_Config'                           => function () {
1021
+				return EE_Config::instance()->template_settings;
1022
+			},
1023
+			'EE_Currency_Config'                           => function () {
1024
+				return EE_Config::instance()->currency;
1025
+			},
1026
+			'EE_Registration_Config'                       => function () {
1027
+				return EE_Config::instance()->registration;
1028
+			},
1029
+			'EE_Core_Config'                               => function () {
1030
+				return EE_Config::instance()->core;
1031
+			},
1032
+			'EventEspresso\core\services\loaders\Loader'   => function () {
1033
+				return LoaderFactory::getLoader();
1034
+			},
1035
+			'EE_Network_Config'                            => function () {
1036
+				return EE_Network_Config::instance();
1037
+			},
1038
+			'EE_Config'                                    => function () {
1039
+				return EE_Config::instance();
1040
+			},
1041
+			'EventEspresso\core\domain\Domain'             => function () {
1042
+				return DomainFactory::getEventEspressoCoreDomain();
1043
+			},
1044
+			'EE_Admin_Config'                              => function () {
1045
+				return EE_Config::instance()->admin;
1046
+			},
1047
+			'EE_Organization_Config'                       => function () {
1048
+				return EE_Config::instance()->organization;
1049
+			},
1050
+			'EE_Network_Core_Config'                       => function () {
1051
+				return EE_Network_Config::instance()->core;
1052
+			},
1053
+			'EE_Environment_Config'                        => function () {
1054
+				return EE_Config::instance()->environment;
1055
+			},
1056
+			'EE_Ticket_Selector_Config'                    => function () {
1057
+				return EE_Config::instance()->template_settings->EED_Ticket_Selector;
1058
+			},
1059
+		];
1060
+	}
1061
+
1062
+
1063
+	/**
1064
+	 * can be used for supplying alternate names for classes,
1065
+	 * or for connecting interface names to instantiable classes
1066
+	 */
1067
+	protected function _register_core_aliases()
1068
+	{
1069
+		$aliases = [
1070
+			'CommandBusInterface'                                                          => 'EventEspresso\core\services\commands\CommandBusInterface',
1071
+			'EventEspresso\core\services\commands\CommandBusInterface'                     => 'EventEspresso\core\services\commands\CommandBus',
1072
+			'CommandHandlerManagerInterface'                                               => 'EventEspresso\core\services\commands\CommandHandlerManagerInterface',
1073
+			'EventEspresso\core\services\commands\CommandHandlerManagerInterface'          => 'EventEspresso\core\services\commands\CommandHandlerManager',
1074
+			'CapChecker'                                                                   => 'EventEspresso\core\services\commands\middleware\CapChecker',
1075
+			'AddActionHook'                                                                => 'EventEspresso\core\services\commands\middleware\AddActionHook',
1076
+			'CapabilitiesChecker'                                                          => 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker',
1077
+			'CapabilitiesCheckerInterface'                                                 => 'EventEspresso\core\domain\services\capabilities\CapabilitiesCheckerInterface',
1078
+			'EventEspresso\core\domain\services\capabilities\CapabilitiesCheckerInterface' => 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker',
1079
+			'CreateRegistrationService'                                                    => 'EventEspresso\core\domain\services\registration\CreateRegistrationService',
1080
+			'CreateRegistrationCommandHandler'                                             => 'EventEspresso\core\services\commands\registration\CreateRegistrationCommand',
1081
+			'CopyRegistrationDetailsCommandHandler'                                        => 'EventEspresso\core\services\commands\registration\CopyRegistrationDetailsCommand',
1082
+			'CopyRegistrationPaymentsCommandHandler'                                       => 'EventEspresso\core\services\commands\registration\CopyRegistrationPaymentsCommand',
1083
+			'CancelRegistrationAndTicketLineItemCommandHandler'                            => 'EventEspresso\core\services\commands\registration\CancelRegistrationAndTicketLineItemCommandHandler',
1084
+			'UpdateRegistrationAndTransactionAfterChangeCommandHandler'                    => 'EventEspresso\core\services\commands\registration\UpdateRegistrationAndTransactionAfterChangeCommandHandler',
1085
+			'CreateTicketLineItemCommandHandler'                                           => 'EventEspresso\core\services\commands\ticket\CreateTicketLineItemCommand',
1086
+			'CreateTransactionCommandHandler'                                              => 'EventEspresso\core\services\commands\transaction\CreateTransactionCommandHandler',
1087
+			'CreateAttendeeCommandHandler'                                                 => 'EventEspresso\core\services\commands\attendee\CreateAttendeeCommandHandler',
1088
+			'TableManager'                                                                 => 'EventEspresso\core\services\database\TableManager',
1089
+			'TableAnalysis'                                                                => 'EventEspresso\core\services\database\TableAnalysis',
1090
+			'EspressoShortcode'                                                            => 'EventEspresso\core\services\shortcodes\EspressoShortcode',
1091
+			'ShortcodeInterface'                                                           => 'EventEspresso\core\services\shortcodes\ShortcodeInterface',
1092
+			'EventEspresso\core\services\shortcodes\ShortcodeInterface'                    => 'EventEspresso\core\services\shortcodes\EspressoShortcode',
1093
+			'EventEspresso\core\services\cache\CacheStorageInterface'                      => 'EventEspresso\core\services\cache\TransientCacheStorage',
1094
+			'LoaderInterface'                                                              => 'EventEspresso\core\services\loaders\LoaderInterface',
1095
+			'EventEspresso\core\services\loaders\LoaderInterface'                          => 'EventEspresso\core\services\loaders\Loader',
1096
+			'CommandFactoryInterface'                                                      => 'EventEspresso\core\services\commands\CommandFactoryInterface',
1097
+			'EventEspresso\core\services\commands\CommandFactoryInterface'                 => 'EventEspresso\core\services\commands\CommandFactory',
1098
+			'EmailValidatorInterface'                                                      => 'EventEspresso\core\domain\services\validation\email\EmailValidatorInterface',
1099
+			'EventEspresso\core\domain\services\validation\email\EmailValidatorInterface'  => 'EventEspresso\core\domain\services\validation\email\EmailValidationService',
1100
+			'NoticeConverterInterface'                                                     => 'EventEspresso\core\services\notices\NoticeConverterInterface',
1101
+			'EventEspresso\core\services\notices\NoticeConverterInterface'                 => 'EventEspresso\core\services\notices\ConvertNoticesToEeErrors',
1102
+			'NoticesContainerInterface'                                                    => 'EventEspresso\core\services\notices\NoticesContainerInterface',
1103
+			'EventEspresso\core\services\notices\NoticesContainerInterface'                => 'EventEspresso\core\services\notices\NoticesContainer',
1104
+			'EventEspresso\core\services\request\RequestInterface'                         => 'EventEspresso\core\services\request\Request',
1105
+			'EventEspresso\core\services\request\ResponseInterface'                        => 'EventEspresso\core\services\request\Response',
1106
+			'EventEspresso\core\domain\DomainInterface'                                    => 'EventEspresso\core\domain\Domain',
1107
+			'Registration_Processor'                                                       => 'EE_Registration_Processor',
1108
+		];
1109
+		foreach ($aliases as $alias => $fqn) {
1110
+			if (is_array($fqn)) {
1111
+				foreach ($fqn as $class => $for_class) {
1112
+					$this->class_cache->addAlias($class, $alias, $for_class);
1113
+				}
1114
+				continue;
1115
+			}
1116
+			$this->class_cache->addAlias($fqn, $alias);
1117
+		}
1118
+		if (! (defined('DOING_AJAX') && DOING_AJAX) && is_admin()) {
1119
+			$this->class_cache->addAlias(
1120
+				'EventEspresso\core\services\notices\ConvertNoticesToAdminNotices',
1121
+				'EventEspresso\core\services\notices\NoticeConverterInterface'
1122
+			);
1123
+		}
1124
+	}
1125
+
1126
+
1127
+	public function debug($for_class = '')
1128
+	{
1129
+		$this->class_cache->debug($for_class);
1130
+	}
1131
+
1132
+
1133
+	/**
1134
+	 * This is used to reset the internal map and class_loaders to their original default state at the beginning of the
1135
+	 * request Primarily used by unit tests.
1136
+	 */
1137
+	public function reset()
1138
+	{
1139
+		$this->_register_core_class_loaders();
1140
+		$this->_register_core_dependencies();
1141
+	}
1142
+
1143
+
1144
+	/**
1145
+	 * PLZ NOTE: a better name for this method would be is_alias()
1146
+	 * because it returns TRUE if the provided fully qualified name IS an alias
1147
+	 * WHY?
1148
+	 * Because if a class is type hinting for a concretion,
1149
+	 * then why would we need to find another class to supply it?
1150
+	 * ie: if a class asks for `Fully/Qualified/Namespace/SpecificClassName`,
1151
+	 * then give it an instance of `Fully/Qualified/Namespace/SpecificClassName`.
1152
+	 * Don't go looking for some substitute.
1153
+	 * Whereas if a class is type hinting for an interface...
1154
+	 * then we need to find an actual class to use.
1155
+	 * So the interface IS the alias for some other FQN,
1156
+	 * and we need to find out if `Fully/Qualified/Namespace/SomeInterface`
1157
+	 * represents some other class.
1158
+	 *
1159
+	 * @param string $fqn
1160
+	 * @param string $for_class
1161
+	 * @return bool
1162
+	 * @deprecated 4.9.62.p
1163
+	 */
1164
+	public function has_alias($fqn = '', $for_class = '')
1165
+	{
1166
+		return $this->isAlias($fqn, $for_class);
1167
+	}
1168
+
1169
+
1170
+	/**
1171
+	 * PLZ NOTE: a better name for this method would be get_fqn_for_alias()
1172
+	 * because it returns a FQN for provided alias if one exists, otherwise returns the original $alias
1173
+	 * functions recursively, so that multiple aliases can be used to drill down to a FQN
1174
+	 *  for example:
1175
+	 *      if the following two entries were added to the _aliases array:
1176
+	 *          array(
1177
+	 *              'interface_alias'           => 'some\namespace\interface'
1178
+	 *              'some\namespace\interface'  => 'some\namespace\classname'
1179
+	 *          )
1180
+	 *      then one could use EE_Registry::instance()->create( 'interface_alias' )
1181
+	 *      to load an instance of 'some\namespace\classname'
1182
+	 *
1183
+	 * @param string $alias
1184
+	 * @param string $for_class
1185
+	 * @return string
1186
+	 * @deprecated 4.9.62.p
1187
+	 */
1188
+	public function get_alias($alias = '', $for_class = '')
1189
+	{
1190
+		return $this->getFqnForAlias($alias, $for_class);
1191
+	}
1192 1192
 }
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.30.rc.026');
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.30.rc.026');
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_List_Table.core.php 1 patch
Indentation   +878 added lines, -878 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@  discard block
 block discarded – undo
3 3
 use EventEspresso\core\services\request\sanitizers\AllowedTags;
4 4
 
5 5
 if (! class_exists('WP_List_Table')) {
6
-    require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php';
6
+	require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php';
7 7
 }
8 8
 
9 9
 
@@ -21,891 +21,891 @@  discard block
 block discarded – undo
21 21
  */
22 22
 abstract class EE_Admin_List_Table extends WP_List_Table
23 23
 {
24
-    const ACTION_COPY    = 'duplicate';
25
-
26
-    const ACTION_DELETE  = 'delete';
27
-
28
-    const ACTION_EDIT    = 'edit';
29
-
30
-    const ACTION_RESTORE = 'restore';
31
-
32
-    const ACTION_TRASH   = 'trash';
33
-
34
-    protected static $actions = [
35
-        self::ACTION_COPY,
36
-        self::ACTION_DELETE,
37
-        self::ACTION_EDIT,
38
-        self::ACTION_RESTORE,
39
-        self::ACTION_TRASH,
40
-    ];
41
-
42
-    /**
43
-     * holds the data that will be processed for the table
44
-     *
45
-     * @var array $_data
46
-     */
47
-    protected $_data;
48
-
49
-
50
-    /**
51
-     * This holds the value of all the data available for the given view (for all pages).
52
-     *
53
-     * @var int $_all_data_count
54
-     */
55
-    protected $_all_data_count;
56
-
57
-
58
-    /**
59
-     * Will contain the count of trashed items for the view label.
60
-     *
61
-     * @var int $_trashed_count
62
-     */
63
-    protected $_trashed_count;
64
-
65
-
66
-    /**
67
-     * This is what will be referenced as the slug for the current screen
68
-     *
69
-     * @var string $_screen
70
-     */
71
-    protected $_screen;
72
-
73
-
74
-    /**
75
-     * this is the EE_Admin_Page object
76
-     *
77
-     * @var EE_Admin_Page $_admin_page
78
-     */
79
-    protected $_admin_page;
80
-
81
-
82
-    /**
83
-     * The current view
84
-     *
85
-     * @var string $_view
86
-     */
87
-    protected $_view;
88
-
89
-
90
-    /**
91
-     * array of possible views for this table
92
-     *
93
-     * @var array $_views
94
-     */
95
-    protected $_views;
96
-
97
-
98
-    /**
99
-     * An array of key => value pairs containing information about the current table
100
-     * array(
101
-     *        'plural' => 'plural label',
102
-     *        'singular' => 'singular label',
103
-     *        'ajax' => false, //whether to use ajax or not
104
-     *        'screen' => null, //string used to reference what screen this is
105
-     *        (WP_List_table converts to screen object)
106
-     * )
107
-     *
108
-     * @var array $_wp_list_args
109
-     */
110
-    protected $_wp_list_args;
111
-
112
-    /**
113
-     * an array of column names
114
-     * array(
115
-     *    'internal-name' => 'Title'
116
-     * )
117
-     *
118
-     * @var array $_columns
119
-     */
120
-    protected $_columns;
121
-
122
-    /**
123
-     * An array of sortable columns
124
-     * array(
125
-     *    'internal-name' => 'orderby' //or
126
-     *    'internal-name' => array( 'orderby', true )
127
-     * )
128
-     *
129
-     * @var array $_sortable_columns
130
-     */
131
-    protected $_sortable_columns;
132
-
133
-    /**
134
-     * callback method used to perform AJAX row reordering
135
-     *
136
-     * @var string $_ajax_sorting_callback
137
-     */
138
-    protected $_ajax_sorting_callback;
139
-
140
-    /**
141
-     * An array of hidden columns (if needed)
142
-     * array('internal-name', 'internal-name')
143
-     *
144
-     * @var array $_hidden_columns
145
-     */
146
-    protected $_hidden_columns;
147
-
148
-    /**
149
-     * holds the per_page value
150
-     *
151
-     * @var int $_per_page
152
-     */
153
-    protected $_per_page;
154
-
155
-    /**
156
-     * holds what page number is currently being viewed
157
-     *
158
-     * @var int $_current_page
159
-     */
160
-    protected $_current_page;
161
-
162
-    /**
163
-     * the reference string for the nonce_action
164
-     *
165
-     * @var string $_nonce_action_ref
166
-     */
167
-    protected $_nonce_action_ref;
168
-
169
-    /**
170
-     * property to hold incoming request data (as set by the admin_page_core)
171
-     *
172
-     * @var array $_req_data
173
-     */
174
-    protected $_req_data;
175
-
176
-
177
-    /**
178
-     * yes / no array for admin form fields
179
-     *
180
-     * @var array $_yes_no
181
-     */
182
-    protected $_yes_no = [];
183
-
184
-    /**
185
-     * Array describing buttons that should appear at the bottom of the page
186
-     * Keys are strings that represent the button's function (specifically a key in _labels['buttons']),
187
-     * and the values are another array with the following keys
188
-     * array(
189
-     *    'route' => 'page_route',
190
-     *    'extra_request' => array('evt_id' => 1 ); //extra request vars that need to be included in the button.
191
-     * )
192
-     *
193
-     * @var array $_bottom_buttons
194
-     */
195
-    protected $_bottom_buttons = [];
196
-
197
-
198
-    /**
199
-     * Used to indicate what should be the primary column for the list table.
200
-     * If not present then falls back to what WP calculates
201
-     * as the primary column.
202
-     *
203
-     * @type string $_primary_column
204
-     */
205
-    protected $_primary_column = '';
206
-
207
-
208
-    /**
209
-     * Used to indicate whether the table has a checkbox column or not.
210
-     *
211
-     * @type bool $_has_checkbox_column
212
-     */
213
-    protected $_has_checkbox_column = false;
214
-
215
-
216
-    /**
217
-     * @param EE_Admin_Page $admin_page we use this for obtaining everything we need in the list table
218
-     */
219
-    public function __construct(EE_Admin_Page $admin_page)
220
-    {
221
-        $this->_admin_page   = $admin_page;
222
-        $this->_req_data     = $this->_admin_page->get_request_data();
223
-        $this->_view         = $this->_admin_page->get_view();
224
-        $this->_views        = empty($this->_views) ? $this->_admin_page->get_list_table_view_RLs() : $this->_views;
225
-        $this->_current_page = $this->get_pagenum();
226
-        $this->_screen       = $this->_admin_page->get_current_page() . '_' . $this->_admin_page->get_current_view();
227
-        $this->_yes_no       = [
228
-            esc_html__('No', 'event_espresso'),
229
-            esc_html__('Yes', 'event_espresso')
230
-        ];
231
-
232
-        $this->_per_page = $this->get_items_per_page($this->_screen . '_per_page');
233
-
234
-        $this->_setup_data();
235
-        $this->_add_view_counts();
236
-
237
-        $this->_nonce_action_ref = $this->_view;
238
-
239
-        $this->_set_properties();
240
-
241
-        // set primary column
242
-        add_filter('list_table_primary_column', [$this, 'set_primary_column']);
243
-
244
-        // set parent defaults
245
-        parent::__construct($this->_wp_list_args);
246
-
247
-        $this->prepare_items();
248
-    }
249
-
250
-
251
-    /**
252
-     * _setup_data
253
-     * this method is used to setup the $_data, $_all_data_count, and _per_page properties
254
-     *
255
-     * @return void
256
-     * @uses $this->_admin_page
257
-     */
258
-    abstract protected function _setup_data();
259
-
260
-
261
-    /**
262
-     * set the properties that this class needs to be able to execute wp_list_table properly
263
-     * properties set:
264
-     * _wp_list_args = what the arguments required for the parent _wp_list_table.
265
-     * _columns = set the columns in an array.
266
-     * _sortable_columns = columns that are sortable (array).
267
-     * _hidden_columns = columns that are hidden (array)
268
-     * _default_orderby = the default orderby for sorting.
269
-     *
270
-     * @abstract
271
-     * @access protected
272
-     * @return void
273
-     */
274
-    abstract protected function _set_properties();
275
-
276
-
277
-    /**
278
-     * _get_table_filters
279
-     * We use this to assemble and return any filters that are associated with this table that help further refine what
280
-     * gets shown in the table.
281
-     *
282
-     * @abstract
283
-     * @access protected
284
-     * @return string
285
-     */
286
-    abstract protected function _get_table_filters();
287
-
288
-
289
-    /**
290
-     * this is a method that child class will do to add counts to the views array so when views are displayed the
291
-     * counts of the views is accurate.
292
-     *
293
-     * @abstract
294
-     * @access protected
295
-     * @return void
296
-     */
297
-    abstract protected function _add_view_counts();
298
-
299
-
300
-    /**
301
-     * _get_hidden_fields
302
-     * returns a html string of hidden fields so if any table filters are used the current view will be respected.
303
-     *
304
-     * @return string
305
-     */
306
-    protected function _get_hidden_fields()
307
-    {
308
-        $action = isset($this->_req_data['route']) ? $this->_req_data['route'] : '';
309
-        $action = empty($action) && isset($this->_req_data['action']) ? $this->_req_data['action'] : $action;
310
-        // if action is STILL empty, then we set it to default
311
-        $action = empty($action) ? 'default' : $action;
312
-        $field  = '<input type="hidden" name="page" value="' . esc_attr($this->_req_data['page']) . '" />' . "\n";
313
-        $field  .= '<input type="hidden" name="route" value="' . esc_attr($action) . '" />' . "\n";
314
-        $field  .= '<input type="hidden" name="perpage" value="' . esc_attr($this->_per_page) . '" />' . "\n";
315
-
316
-        $bulk_actions = $this->_get_bulk_actions();
317
-        foreach ($bulk_actions as $bulk_action => $label) {
318
-            $field .= '<input type="hidden" name="' . $bulk_action . '_nonce"'
319
-                      . ' value="' . wp_create_nonce($bulk_action . '_nonce') . '" />' . "\n";
320
-        }
321
-
322
-        return $field;
323
-    }
324
-
325
-
326
-    /**
327
-     * _set_column_info
328
-     * we're using this to set the column headers property.
329
-     *
330
-     * @access protected
331
-     * @return void
332
-     */
333
-    protected function _set_column_info()
334
-    {
335
-        $columns   = $this->get_columns();
336
-        $hidden    = $this->get_hidden_columns();
337
-        $_sortable = $this->get_sortable_columns();
338
-
339
-        /**
340
-         * Dynamic hook allowing for adding sortable columns in this list table.
341
-         * Note that $this->screen->id is in the format
342
-         * {sanitize_title($top_level_menu_label)}_page_{$espresso_admin_page_slug}.  So for the messages list
343
-         * table it is: event-espresso_page_espresso_messages.
344
-         * However, take note that if the top level menu label has been translated (i.e. "Event Espresso"). then the
345
-         * hook prefix ("event-espresso") will be different.
346
-         *
347
-         * @var array
348
-         */
349
-        $_sortable = apply_filters("FHEE_manage_{$this->screen->id}_sortable_columns", $_sortable, $this->_screen);
350
-
351
-        $sortable = [];
352
-        foreach ($_sortable as $id => $data) {
353
-            if (empty($data)) {
354
-                continue;
355
-            }
356
-            // fix for offset errors with WP_List_Table default get_columninfo()
357
-            if (is_array($data)) {
358
-                $_data[0] = key($data);
359
-                $_data[1] = isset($data[1]) ? $data[1] : false;
360
-            } else {
361
-                $_data[0] = $data;
362
-            }
363
-
364
-            $data = (array) $data;
365
-
366
-            if (! isset($data[1])) {
367
-                $_data[1] = false;
368
-            }
369
-
370
-            $sortable[ $id ] = $_data;
371
-        }
372
-        $primary               = $this->get_primary_column_name();
373
-        $this->_column_headers = [$columns, $hidden, $sortable, $primary];
374
-    }
375
-
376
-
377
-    /**
378
-     * Added for WP4.1 backward compat (@see https://events.codebasehq.com/projects/event-espresso/tickets/8814)
379
-     *
380
-     * @return string
381
-     */
382
-    protected function get_primary_column_name()
383
-    {
384
-        foreach (class_parents($this) as $parent) {
385
-            if ($parent === 'WP_List_Table' && method_exists($parent, 'get_primary_column_name')) {
386
-                return parent::get_primary_column_name();
387
-            }
388
-        }
389
-        return $this->_primary_column;
390
-    }
391
-
392
-
393
-    /**
394
-     * Added for WP4.1 backward compat (@see https://events.codebasehq.com/projects/event-espresso/tickets/8814)
395
-     *
396
-     * @param EE_Base_Class $item
397
-     * @param string        $column_name
398
-     * @param string        $primary
399
-     * @return string
400
-     */
401
-    protected function handle_row_actions($item, $column_name, $primary)
402
-    {
403
-        foreach (class_parents($this) as $parent) {
404
-            if ($parent === 'WP_List_Table' && method_exists($parent, 'handle_row_actions')) {
405
-                return parent::handle_row_actions($item, $column_name, $primary);
406
-            }
407
-        }
408
-        return '';
409
-    }
410
-
411
-
412
-    /**
413
-     * _get_bulk_actions
414
-     * This is a wrapper called by WP_List_Table::get_bulk_actions()
415
-     *
416
-     * @access protected
417
-     * @return array bulk_actions
418
-     */
419
-    protected function _get_bulk_actions()
420
-    {
421
-        $actions = [];
422
-        // the _views property should have the bulk_actions, so let's go through and extract them into a properly
423
-        // formatted array for the wp_list_table();
424
-        foreach ($this->_views as $view => $args) {
425
-            if ($this->_view === $view && isset($args['bulk_action']) && is_array($args['bulk_action'])) {
426
-                // each bulk action will correspond with a admin page route, so we can check whatever the capability is
427
-                // for that page route and skip adding the bulk action if no access for the current logged in user.
428
-                foreach ($args['bulk_action'] as $route => $label) {
429
-                    if ($this->_admin_page->check_user_access($route, true)) {
430
-                        $actions[ $route ] = $label;
431
-                    }
432
-                }
433
-            }
434
-        }
435
-        return $actions;
436
-    }
437
-
438
-
439
-    /**
440
-     * Generate the table navigation above or below the table.
441
-     * Overrides the parent table nav in WP_List_Table so we can hide the bulk action div if there are no bulk actions.
442
-     *
443
-     * @throws EE_Error
444
-     * @since 4.9.44.rc.001
445
-     */
446
-    public function display_tablenav($which)
447
-    {
448
-        if ('top' === $which) {
449
-            wp_nonce_field('bulk-' . $this->_args['plural']);
450
-        }
451
-        ?>
24
+	const ACTION_COPY    = 'duplicate';
25
+
26
+	const ACTION_DELETE  = 'delete';
27
+
28
+	const ACTION_EDIT    = 'edit';
29
+
30
+	const ACTION_RESTORE = 'restore';
31
+
32
+	const ACTION_TRASH   = 'trash';
33
+
34
+	protected static $actions = [
35
+		self::ACTION_COPY,
36
+		self::ACTION_DELETE,
37
+		self::ACTION_EDIT,
38
+		self::ACTION_RESTORE,
39
+		self::ACTION_TRASH,
40
+	];
41
+
42
+	/**
43
+	 * holds the data that will be processed for the table
44
+	 *
45
+	 * @var array $_data
46
+	 */
47
+	protected $_data;
48
+
49
+
50
+	/**
51
+	 * This holds the value of all the data available for the given view (for all pages).
52
+	 *
53
+	 * @var int $_all_data_count
54
+	 */
55
+	protected $_all_data_count;
56
+
57
+
58
+	/**
59
+	 * Will contain the count of trashed items for the view label.
60
+	 *
61
+	 * @var int $_trashed_count
62
+	 */
63
+	protected $_trashed_count;
64
+
65
+
66
+	/**
67
+	 * This is what will be referenced as the slug for the current screen
68
+	 *
69
+	 * @var string $_screen
70
+	 */
71
+	protected $_screen;
72
+
73
+
74
+	/**
75
+	 * this is the EE_Admin_Page object
76
+	 *
77
+	 * @var EE_Admin_Page $_admin_page
78
+	 */
79
+	protected $_admin_page;
80
+
81
+
82
+	/**
83
+	 * The current view
84
+	 *
85
+	 * @var string $_view
86
+	 */
87
+	protected $_view;
88
+
89
+
90
+	/**
91
+	 * array of possible views for this table
92
+	 *
93
+	 * @var array $_views
94
+	 */
95
+	protected $_views;
96
+
97
+
98
+	/**
99
+	 * An array of key => value pairs containing information about the current table
100
+	 * array(
101
+	 *        'plural' => 'plural label',
102
+	 *        'singular' => 'singular label',
103
+	 *        'ajax' => false, //whether to use ajax or not
104
+	 *        'screen' => null, //string used to reference what screen this is
105
+	 *        (WP_List_table converts to screen object)
106
+	 * )
107
+	 *
108
+	 * @var array $_wp_list_args
109
+	 */
110
+	protected $_wp_list_args;
111
+
112
+	/**
113
+	 * an array of column names
114
+	 * array(
115
+	 *    'internal-name' => 'Title'
116
+	 * )
117
+	 *
118
+	 * @var array $_columns
119
+	 */
120
+	protected $_columns;
121
+
122
+	/**
123
+	 * An array of sortable columns
124
+	 * array(
125
+	 *    'internal-name' => 'orderby' //or
126
+	 *    'internal-name' => array( 'orderby', true )
127
+	 * )
128
+	 *
129
+	 * @var array $_sortable_columns
130
+	 */
131
+	protected $_sortable_columns;
132
+
133
+	/**
134
+	 * callback method used to perform AJAX row reordering
135
+	 *
136
+	 * @var string $_ajax_sorting_callback
137
+	 */
138
+	protected $_ajax_sorting_callback;
139
+
140
+	/**
141
+	 * An array of hidden columns (if needed)
142
+	 * array('internal-name', 'internal-name')
143
+	 *
144
+	 * @var array $_hidden_columns
145
+	 */
146
+	protected $_hidden_columns;
147
+
148
+	/**
149
+	 * holds the per_page value
150
+	 *
151
+	 * @var int $_per_page
152
+	 */
153
+	protected $_per_page;
154
+
155
+	/**
156
+	 * holds what page number is currently being viewed
157
+	 *
158
+	 * @var int $_current_page
159
+	 */
160
+	protected $_current_page;
161
+
162
+	/**
163
+	 * the reference string for the nonce_action
164
+	 *
165
+	 * @var string $_nonce_action_ref
166
+	 */
167
+	protected $_nonce_action_ref;
168
+
169
+	/**
170
+	 * property to hold incoming request data (as set by the admin_page_core)
171
+	 *
172
+	 * @var array $_req_data
173
+	 */
174
+	protected $_req_data;
175
+
176
+
177
+	/**
178
+	 * yes / no array for admin form fields
179
+	 *
180
+	 * @var array $_yes_no
181
+	 */
182
+	protected $_yes_no = [];
183
+
184
+	/**
185
+	 * Array describing buttons that should appear at the bottom of the page
186
+	 * Keys are strings that represent the button's function (specifically a key in _labels['buttons']),
187
+	 * and the values are another array with the following keys
188
+	 * array(
189
+	 *    'route' => 'page_route',
190
+	 *    'extra_request' => array('evt_id' => 1 ); //extra request vars that need to be included in the button.
191
+	 * )
192
+	 *
193
+	 * @var array $_bottom_buttons
194
+	 */
195
+	protected $_bottom_buttons = [];
196
+
197
+
198
+	/**
199
+	 * Used to indicate what should be the primary column for the list table.
200
+	 * If not present then falls back to what WP calculates
201
+	 * as the primary column.
202
+	 *
203
+	 * @type string $_primary_column
204
+	 */
205
+	protected $_primary_column = '';
206
+
207
+
208
+	/**
209
+	 * Used to indicate whether the table has a checkbox column or not.
210
+	 *
211
+	 * @type bool $_has_checkbox_column
212
+	 */
213
+	protected $_has_checkbox_column = false;
214
+
215
+
216
+	/**
217
+	 * @param EE_Admin_Page $admin_page we use this for obtaining everything we need in the list table
218
+	 */
219
+	public function __construct(EE_Admin_Page $admin_page)
220
+	{
221
+		$this->_admin_page   = $admin_page;
222
+		$this->_req_data     = $this->_admin_page->get_request_data();
223
+		$this->_view         = $this->_admin_page->get_view();
224
+		$this->_views        = empty($this->_views) ? $this->_admin_page->get_list_table_view_RLs() : $this->_views;
225
+		$this->_current_page = $this->get_pagenum();
226
+		$this->_screen       = $this->_admin_page->get_current_page() . '_' . $this->_admin_page->get_current_view();
227
+		$this->_yes_no       = [
228
+			esc_html__('No', 'event_espresso'),
229
+			esc_html__('Yes', 'event_espresso')
230
+		];
231
+
232
+		$this->_per_page = $this->get_items_per_page($this->_screen . '_per_page');
233
+
234
+		$this->_setup_data();
235
+		$this->_add_view_counts();
236
+
237
+		$this->_nonce_action_ref = $this->_view;
238
+
239
+		$this->_set_properties();
240
+
241
+		// set primary column
242
+		add_filter('list_table_primary_column', [$this, 'set_primary_column']);
243
+
244
+		// set parent defaults
245
+		parent::__construct($this->_wp_list_args);
246
+
247
+		$this->prepare_items();
248
+	}
249
+
250
+
251
+	/**
252
+	 * _setup_data
253
+	 * this method is used to setup the $_data, $_all_data_count, and _per_page properties
254
+	 *
255
+	 * @return void
256
+	 * @uses $this->_admin_page
257
+	 */
258
+	abstract protected function _setup_data();
259
+
260
+
261
+	/**
262
+	 * set the properties that this class needs to be able to execute wp_list_table properly
263
+	 * properties set:
264
+	 * _wp_list_args = what the arguments required for the parent _wp_list_table.
265
+	 * _columns = set the columns in an array.
266
+	 * _sortable_columns = columns that are sortable (array).
267
+	 * _hidden_columns = columns that are hidden (array)
268
+	 * _default_orderby = the default orderby for sorting.
269
+	 *
270
+	 * @abstract
271
+	 * @access protected
272
+	 * @return void
273
+	 */
274
+	abstract protected function _set_properties();
275
+
276
+
277
+	/**
278
+	 * _get_table_filters
279
+	 * We use this to assemble and return any filters that are associated with this table that help further refine what
280
+	 * gets shown in the table.
281
+	 *
282
+	 * @abstract
283
+	 * @access protected
284
+	 * @return string
285
+	 */
286
+	abstract protected function _get_table_filters();
287
+
288
+
289
+	/**
290
+	 * this is a method that child class will do to add counts to the views array so when views are displayed the
291
+	 * counts of the views is accurate.
292
+	 *
293
+	 * @abstract
294
+	 * @access protected
295
+	 * @return void
296
+	 */
297
+	abstract protected function _add_view_counts();
298
+
299
+
300
+	/**
301
+	 * _get_hidden_fields
302
+	 * returns a html string of hidden fields so if any table filters are used the current view will be respected.
303
+	 *
304
+	 * @return string
305
+	 */
306
+	protected function _get_hidden_fields()
307
+	{
308
+		$action = isset($this->_req_data['route']) ? $this->_req_data['route'] : '';
309
+		$action = empty($action) && isset($this->_req_data['action']) ? $this->_req_data['action'] : $action;
310
+		// if action is STILL empty, then we set it to default
311
+		$action = empty($action) ? 'default' : $action;
312
+		$field  = '<input type="hidden" name="page" value="' . esc_attr($this->_req_data['page']) . '" />' . "\n";
313
+		$field  .= '<input type="hidden" name="route" value="' . esc_attr($action) . '" />' . "\n";
314
+		$field  .= '<input type="hidden" name="perpage" value="' . esc_attr($this->_per_page) . '" />' . "\n";
315
+
316
+		$bulk_actions = $this->_get_bulk_actions();
317
+		foreach ($bulk_actions as $bulk_action => $label) {
318
+			$field .= '<input type="hidden" name="' . $bulk_action . '_nonce"'
319
+					  . ' value="' . wp_create_nonce($bulk_action . '_nonce') . '" />' . "\n";
320
+		}
321
+
322
+		return $field;
323
+	}
324
+
325
+
326
+	/**
327
+	 * _set_column_info
328
+	 * we're using this to set the column headers property.
329
+	 *
330
+	 * @access protected
331
+	 * @return void
332
+	 */
333
+	protected function _set_column_info()
334
+	{
335
+		$columns   = $this->get_columns();
336
+		$hidden    = $this->get_hidden_columns();
337
+		$_sortable = $this->get_sortable_columns();
338
+
339
+		/**
340
+		 * Dynamic hook allowing for adding sortable columns in this list table.
341
+		 * Note that $this->screen->id is in the format
342
+		 * {sanitize_title($top_level_menu_label)}_page_{$espresso_admin_page_slug}.  So for the messages list
343
+		 * table it is: event-espresso_page_espresso_messages.
344
+		 * However, take note that if the top level menu label has been translated (i.e. "Event Espresso"). then the
345
+		 * hook prefix ("event-espresso") will be different.
346
+		 *
347
+		 * @var array
348
+		 */
349
+		$_sortable = apply_filters("FHEE_manage_{$this->screen->id}_sortable_columns", $_sortable, $this->_screen);
350
+
351
+		$sortable = [];
352
+		foreach ($_sortable as $id => $data) {
353
+			if (empty($data)) {
354
+				continue;
355
+			}
356
+			// fix for offset errors with WP_List_Table default get_columninfo()
357
+			if (is_array($data)) {
358
+				$_data[0] = key($data);
359
+				$_data[1] = isset($data[1]) ? $data[1] : false;
360
+			} else {
361
+				$_data[0] = $data;
362
+			}
363
+
364
+			$data = (array) $data;
365
+
366
+			if (! isset($data[1])) {
367
+				$_data[1] = false;
368
+			}
369
+
370
+			$sortable[ $id ] = $_data;
371
+		}
372
+		$primary               = $this->get_primary_column_name();
373
+		$this->_column_headers = [$columns, $hidden, $sortable, $primary];
374
+	}
375
+
376
+
377
+	/**
378
+	 * Added for WP4.1 backward compat (@see https://events.codebasehq.com/projects/event-espresso/tickets/8814)
379
+	 *
380
+	 * @return string
381
+	 */
382
+	protected function get_primary_column_name()
383
+	{
384
+		foreach (class_parents($this) as $parent) {
385
+			if ($parent === 'WP_List_Table' && method_exists($parent, 'get_primary_column_name')) {
386
+				return parent::get_primary_column_name();
387
+			}
388
+		}
389
+		return $this->_primary_column;
390
+	}
391
+
392
+
393
+	/**
394
+	 * Added for WP4.1 backward compat (@see https://events.codebasehq.com/projects/event-espresso/tickets/8814)
395
+	 *
396
+	 * @param EE_Base_Class $item
397
+	 * @param string        $column_name
398
+	 * @param string        $primary
399
+	 * @return string
400
+	 */
401
+	protected function handle_row_actions($item, $column_name, $primary)
402
+	{
403
+		foreach (class_parents($this) as $parent) {
404
+			if ($parent === 'WP_List_Table' && method_exists($parent, 'handle_row_actions')) {
405
+				return parent::handle_row_actions($item, $column_name, $primary);
406
+			}
407
+		}
408
+		return '';
409
+	}
410
+
411
+
412
+	/**
413
+	 * _get_bulk_actions
414
+	 * This is a wrapper called by WP_List_Table::get_bulk_actions()
415
+	 *
416
+	 * @access protected
417
+	 * @return array bulk_actions
418
+	 */
419
+	protected function _get_bulk_actions()
420
+	{
421
+		$actions = [];
422
+		// the _views property should have the bulk_actions, so let's go through and extract them into a properly
423
+		// formatted array for the wp_list_table();
424
+		foreach ($this->_views as $view => $args) {
425
+			if ($this->_view === $view && isset($args['bulk_action']) && is_array($args['bulk_action'])) {
426
+				// each bulk action will correspond with a admin page route, so we can check whatever the capability is
427
+				// for that page route and skip adding the bulk action if no access for the current logged in user.
428
+				foreach ($args['bulk_action'] as $route => $label) {
429
+					if ($this->_admin_page->check_user_access($route, true)) {
430
+						$actions[ $route ] = $label;
431
+					}
432
+				}
433
+			}
434
+		}
435
+		return $actions;
436
+	}
437
+
438
+
439
+	/**
440
+	 * Generate the table navigation above or below the table.
441
+	 * Overrides the parent table nav in WP_List_Table so we can hide the bulk action div if there are no bulk actions.
442
+	 *
443
+	 * @throws EE_Error
444
+	 * @since 4.9.44.rc.001
445
+	 */
446
+	public function display_tablenav($which)
447
+	{
448
+		if ('top' === $which) {
449
+			wp_nonce_field('bulk-' . $this->_args['plural']);
450
+		}
451
+		?>
452 452
         <div class="tablenav <?php echo esc_attr($which); ?>">
453 453
             <?php if ($this->_get_bulk_actions()) { ?>
454 454
                 <div class="alignleft actions bulkactions">
455 455
                     <?php $this->bulk_actions(); ?>
456 456
                 </div>
457 457
             <?php }
458
-            $this->extra_tablenav($which);
459
-            $this->pagination($which);
460
-            ?>
458
+			$this->extra_tablenav($which);
459
+			$this->pagination($which);
460
+			?>
461 461
 
462 462
             <br class="clear" />
463 463
         </div>
464 464
         <?php
465
-    }
466
-
467
-
468
-    /**
469
-     * _filters
470
-     * This receives the filters array from children _get_table_filters() and assembles the string including the filter
471
-     * button.
472
-     *
473
-     * @access private
474
-     * @return void  echos html showing filters
475
-     */
476
-    private function _filters()
477
-    {
478
-        $classname = get_class($this);
479
-        $filters   = apply_filters(
480
-            "FHEE__{$classname}__filters",
481
-            (array) $this->_get_table_filters(),
482
-            $this,
483
-            $this->_screen
484
-        );
485
-
486
-        if (empty($filters)) {
487
-            return;
488
-        }
489
-        foreach ($filters as $filter) {
490
-            echo wp_kses($filter, AllowedTags::getWithFormTags());
491
-        }
492
-        // add filter button at end
493
-        echo '<input type="submit" class="button-secondary" value="'
494
-             . esc_html__('Filter', 'event_espresso')
495
-             . '" id="post-query-submit" />';
496
-        // add reset filters button at end
497
-        echo '<a class="button button-secondary"  href="'
498
-             . esc_url_raw($this->_admin_page->get_current_page_view_url())
499
-             . '" style="display:inline-block">'
500
-             . esc_html__('Reset Filters', 'event_espresso')
501
-             . '</a>';
502
-    }
503
-
504
-
505
-    /**
506
-     * Callback for 'list_table_primary_column' WordPress filter
507
-     * If child EE_Admin_List_Table classes set the _primary_column property then that will be set as the primary
508
-     * column when class is instantiated.
509
-     *
510
-     * @param string $column_name
511
-     * @return string
512
-     * @see WP_List_Table::get_primary_column_name
513
-     */
514
-    public function set_primary_column($column_name)
515
-    {
516
-        return ! empty($this->_primary_column) ? $this->_primary_column : $column_name;
517
-    }
518
-
519
-
520
-    /**
521
-     *
522
-     */
523
-    public function prepare_items()
524
-    {
525
-
526
-        $this->_set_column_info();
527
-        // $this->_column_headers = $this->get_column_info();
528
-        $total_items = $this->_all_data_count;
529
-        $this->process_bulk_action();
530
-
531
-        $this->items = $this->_data;
532
-        $this->set_pagination_args(
533
-            [
534
-                'total_items' => $total_items,
535
-                'per_page'    => $this->_per_page,
536
-                'total_pages' => ceil($total_items / $this->_per_page),
537
-            ]
538
-        );
539
-    }
540
-
541
-
542
-    /**
543
-     * @param object|array $item
544
-     * @return string html content for the column
545
-     */
546
-    protected function column_cb($item)
547
-    {
548
-        return '';
549
-    }
550
-
551
-
552
-    /**
553
-     * This column is the default for when there is no defined column method for a registered column.
554
-     * This can be overridden by child classes, but allows for hooking in for custom columns.
555
-     *
556
-     * @param EE_Base_Class $item
557
-     * @param string        $column_name The column being called.
558
-     * @return string html content for the column
559
-     */
560
-    public function column_default($item, $column_name)
561
-    {
562
-        /**
563
-         * Dynamic hook allowing for adding additional column content in this list table.
564
-         * Note that $this->screen->id is in the format
565
-         * {sanitize_title($top_level_menu_label)}_page_{$espresso_admin_page_slug}.  So for the messages list
566
-         * table it is: event-espresso_page_espresso_messages.
567
-         * However, take note that if the top level menu label has been translated (i.e. "Event Espresso"). then the
568
-         * hook prefix ("event-espresso") will be different.
569
-         */
570
-        ob_start();
571
-        do_action(
572
-            'AHEE__EE_Admin_List_Table__column_' . $column_name . '__' . $this->screen->id,
573
-            $item,
574
-            $this->_screen
575
-        );
576
-        return ob_get_clean();
577
-    }
578
-
579
-
580
-    /**
581
-     * Get a list of columns. The format is:
582
-     * 'internal-name' => 'Title'
583
-     *
584
-     * @return array
585
-     * @since  3.1.0
586
-     * @access public
587
-     * @abstract
588
-     */
589
-    public function get_columns()
590
-    {
591
-        /**
592
-         * Dynamic hook allowing for adding additional columns in this list table.
593
-         * Note that $this->screen->id is in the format
594
-         * {sanitize_title($top_level_menu_label)}_page_{$espresso_admin_page_slug}.  So for the messages list
595
-         * table it is: event-espresso_page_espresso_messages.
596
-         * However, take note that if the top level menu label has been translated (i.e. "Event Espresso"). then the
597
-         * hook prefix ("event-espresso") will be different.
598
-         *
599
-         * @var array
600
-         */
601
-        return apply_filters('FHEE_manage_' . $this->screen->id . '_columns', $this->_columns, $this->_screen);
602
-    }
603
-
604
-
605
-    /**
606
-     * Get an associative array ( id => link ) with the list
607
-     * of views available on this table.
608
-     *
609
-     * @return array
610
-     * @since  3.1.0
611
-     * @access protected
612
-     */
613
-    public function get_views()
614
-    {
615
-        return $this->_views;
616
-    }
617
-
618
-
619
-    /**
620
-     * Generate the views html.
621
-     */
622
-    public function display_views()
623
-    {
624
-        $views           = $this->get_views();
625
-        $assembled_views = [];
626
-
627
-        if (empty($views)) {
628
-            return;
629
-        }
630
-        echo "<ul class='subsubsub'>\n";
631
-        foreach ($views as $view) {
632
-            $count = isset($view['count']) && ! empty($view['count']) ? absint($view['count']) : 0;
633
-            if (isset($view['slug'], $view['class'], $view['url'], $view['label'])) {
634
-                $filter = "<li";
635
-                $filter .= $view['class'] ? " class='" . esc_attr($view['class']) . "'" : '';
636
-                $filter .= ">";
637
-                $filter .= '<a href="' . esc_url_raw($view['url']) . '">' . esc_html($view['label']) . '</a>';
638
-                $filter .= '<span class="count">(' . $count . ')</span>';
639
-                $filter .= '</li>';
640
-                $assembled_views[ $view['slug'] ] = $filter;
641
-            }
642
-        }
643
-
644
-        echo ! empty($assembled_views)
645
-            ? implode("<li style='margin:0 .5rem;'>|</li>", $assembled_views)
646
-            : '';
647
-        echo "</ul>";
648
-    }
649
-
650
-
651
-    /**
652
-     * Generates content for a single row of the table
653
-     *
654
-     * @param EE_Base_Class $item The current item
655
-     * @since  4.1
656
-     * @access public
657
-     */
658
-    public function single_row($item)
659
-    {
660
-        $row_class = $this->_get_row_class($item);
661
-        echo '<tr class="' . esc_attr($row_class) . '">';
662
-        $this->single_row_columns($item); // already escaped
663
-        echo '</tr>';
664
-    }
665
-
666
-
667
-    /**
668
-     * This simply sets up the row class for the table rows.
669
-     * Allows for easier overriding of child methods for setting up sorting.
670
-     *
671
-     * @param EE_Base_Class $item the current item
672
-     * @return string
673
-     */
674
-    protected function _get_row_class($item)
675
-    {
676
-        static $row_class = '';
677
-        $row_class = ($row_class === '' ? 'alternate' : '');
678
-
679
-        $new_row_class = $row_class;
680
-
681
-        if (! empty($this->_ajax_sorting_callback)) {
682
-            $new_row_class .= ' rowsortable';
683
-        }
684
-
685
-        return $new_row_class;
686
-    }
687
-
688
-
689
-    /**
690
-     * @return array
691
-     */
692
-    public function get_sortable_columns()
693
-    {
694
-        return (array) $this->_sortable_columns;
695
-    }
696
-
697
-
698
-    /**
699
-     * @return string
700
-     */
701
-    public function get_ajax_sorting_callback()
702
-    {
703
-        return $this->_ajax_sorting_callback;
704
-    }
705
-
706
-
707
-    /**
708
-     * @return array
709
-     */
710
-    public function get_hidden_columns()
711
-    {
712
-        $user_id     = get_current_user_id();
713
-        $has_default = get_user_option('default' . $this->screen->id . 'columnshidden', $user_id);
714
-        if (empty($has_default) && ! empty($this->_hidden_columns)) {
715
-            update_user_option($user_id, 'default' . $this->screen->id . 'columnshidden', true);
716
-            update_user_option($user_id, 'manage' . $this->screen->id . 'columnshidden', $this->_hidden_columns, true);
717
-        }
718
-        $ref = 'manage' . $this->screen->id . 'columnshidden';
719
-        return (array) get_user_option($ref, $user_id);
720
-    }
721
-
722
-
723
-    /**
724
-     * Generates the columns for a single row of the table.
725
-     * Overridden from wp_list_table so as to allow us to filter the column content for a given
726
-     * column.
727
-     *
728
-     * @param EE_Base_Class $item The current item
729
-     * @since 3.1.0
730
-     */
731
-    public function single_row_columns($item)
732
-    {
733
-        [$columns, $hidden, $sortable, $primary] = $this->get_column_info();
734
-
735
-        foreach ($columns as $column_name => $column_display_name) {
736
-
737
-            /**
738
-             * With WordPress version 4.3.RC+ WordPress started using the hidden css class to control whether columns
739
-             * are hidden or not instead of using "display:none;".  This bit of code provides backward compat.
740
-             */
741
-            $hidden_class = in_array($column_name, $hidden) ? ' hidden' : '';
742
-
743
-            $classes = $column_name . ' column-' . $column_name . $hidden_class;
744
-            if ($primary === $column_name) {
745
-                $classes .= ' has-row-actions column-primary';
746
-            }
747
-
748
-            $data = ' data-colname="' . wp_strip_all_tags($column_display_name) . '"';
749
-
750
-            $class = 'class="' . esc_attr($classes) . '"';
751
-
752
-            $attributes = "{$class}{$data}";
753
-
754
-            if ($column_name === 'cb') {
755
-                echo '<th scope="row" class="check-column">';
756
-                echo apply_filters(
757
-                    'FHEE__EE_Admin_List_Table__single_row_columns__column_cb_content',
758
-                    $this->column_cb($item), // already escaped
759
-                    $item,
760
-                    $this
761
-                );
762
-                echo '</th>';
763
-            } elseif (method_exists($this, 'column_' . $column_name)) {
764
-                echo "<td $attributes>"; // already escaped
765
-                echo apply_filters(
766
-                    'FHEE__EE_Admin_List_Table__single_row_columns__column_' . $column_name . '__column_content',
767
-                    call_user_func([$this, 'column_' . $column_name], $item),
768
-                    $item,
769
-                    $this
770
-                );
771
-                echo wp_kses($this->handle_row_actions($item, $column_name, $primary), AllowedTags::getWithFormTags());
772
-                echo "</td>";
773
-            } else {
774
-                echo "<td $attributes>"; // already escaped
775
-                echo apply_filters(
776
-                    'FHEE__EE_Admin_List_Table__single_row_columns__column_default__column_content',
777
-                    $this->column_default($item, $column_name),
778
-                    $item,
779
-                    $column_name,
780
-                    $this
781
-                );
782
-                echo wp_kses($this->handle_row_actions($item, $column_name, $primary), AllowedTags::getWithFormTags());
783
-                echo "</td>";
784
-            }
785
-        }
786
-    }
787
-
788
-
789
-    /**
790
-     * Extra controls to be displayed between bulk actions and pagination
791
-     *
792
-     * @access public
793
-     * @param string $which
794
-     * @throws EE_Error
795
-     */
796
-    public function extra_tablenav($which)
797
-    {
798
-        if ($which === 'top') {
799
-            $this->_filters();
800
-            echo wp_kses($this->_get_hidden_fields(), AllowedTags::getWithFormTags());
801
-        } else {
802
-            echo '<div class="list-table-bottom-buttons alignleft actions">';
803
-            foreach ($this->_bottom_buttons as $type => $action) {
804
-                $route         = isset($action['route']) ? $action['route'] : '';
805
-                $extra_request = isset($action['extra_request']) ? $action['extra_request'] : '';
806
-                // already escaped
807
-                echo wp_kses($this->_admin_page->get_action_link_or_button(
808
-                    $route,
809
-                    $type,
810
-                    $extra_request,
811
-                    'button button-secondary'
812
-                ), AllowedTags::getWithFormTags());
813
-            }
814
-            do_action('AHEE__EE_Admin_List_Table__extra_tablenav__after_bottom_buttons', $this, $this->_screen);
815
-            echo '</div>';
816
-        }
817
-    }
818
-
819
-
820
-    /**
821
-     * Get an associative array ( option_name => option_title ) with the list
822
-     * of bulk actions available on this table.
823
-     *
824
-     * @return array
825
-     * @since  3.1.0
826
-     * @access protected
827
-     */
828
-    public function get_bulk_actions()
829
-    {
830
-        return (array) $this->_get_bulk_actions();
831
-    }
832
-
833
-
834
-    /**
835
-     * Processing bulk actions.
836
-     */
837
-    public function process_bulk_action()
838
-    {
839
-        // this is not used it is handled by the child EE_Admin_Page class (routes).  However, including here for
840
-        // reference in case there is a case where it gets used.
841
-    }
842
-
843
-
844
-    /**
845
-     * returns the EE admin page this list table is associated with
846
-     *
847
-     * @return EE_Admin_Page
848
-     */
849
-    public function get_admin_page()
850
-    {
851
-        return $this->_admin_page;
852
-    }
853
-
854
-
855
-    /**
856
-     * A "helper" function for all children to provide an html string of
857
-     * actions to output in their content.  It is preferable for child classes
858
-     * to use this method for generating their actions content so that it's
859
-     * filterable by plugins
860
-     *
861
-     * @param string        $action_container           what are the html container
862
-     *                                                  elements for this actions string?
863
-     * @param string        $action_class               What class is for the container
864
-     *                                                  element.
865
-     * @param string        $action_items               The contents for the action items
866
-     *                                                  container.  This is filtered before
867
-     *                                                  returned.
868
-     * @param string        $action_id                  What id (optional) is used for the
869
-     *                                                  container element.
870
-     * @param EE_Base_Class $item                       The object for the column displaying
871
-     *                                                  the actions.
872
-     * @return string The assembled action elements container.
873
-     */
874
-    protected function _action_string(
875
-        $action_items,
876
-        $item,
877
-        $action_container = 'ul',
878
-        $action_class = '',
879
-        $action_id = ''
880
-    ) {
881
-        $action_class = ! empty($action_class) ? ' class="' . esc_attr($action_class) . '"' : '';
882
-        $action_id    = ! empty($action_id) ? ' id="' . esc_attr($action_id) . '"' : '';
883
-        $open_tag     = ! empty($action_container) ? '<' . $action_container . $action_class . $action_id . '>' : '';
884
-        $close_tag    = ! empty($action_container) ? '</' . $action_container . '>' : '';
885
-        try {
886
-            $content = apply_filters(
887
-                'FHEE__EE_Admin_List_Table___action_string__action_items',
888
-                $action_items,
889
-                $item,
890
-                $this
891
-            );
892
-        } catch (Exception $e) {
893
-            if (WP_DEBUG) {
894
-                EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__);
895
-            }
896
-            $content = $action_items;
897
-        }
898
-        return "{$open_tag}{$content}{$close_tag}";
899
-    }
900
-
901
-
902
-    /**
903
-     * @return string
904
-     */
905
-    protected function getReturnUrl()
906
-    {
907
-        $host = $this->_admin_page->get_request()->getServerParam('HTTP_HOST');
908
-        $uri  = $this->_admin_page->get_request()->getServerParam('REQUEST_URI');
909
-        return urlencode(esc_url_raw("//{$host}{$uri}"));
910
-    }
465
+	}
466
+
467
+
468
+	/**
469
+	 * _filters
470
+	 * This receives the filters array from children _get_table_filters() and assembles the string including the filter
471
+	 * button.
472
+	 *
473
+	 * @access private
474
+	 * @return void  echos html showing filters
475
+	 */
476
+	private function _filters()
477
+	{
478
+		$classname = get_class($this);
479
+		$filters   = apply_filters(
480
+			"FHEE__{$classname}__filters",
481
+			(array) $this->_get_table_filters(),
482
+			$this,
483
+			$this->_screen
484
+		);
485
+
486
+		if (empty($filters)) {
487
+			return;
488
+		}
489
+		foreach ($filters as $filter) {
490
+			echo wp_kses($filter, AllowedTags::getWithFormTags());
491
+		}
492
+		// add filter button at end
493
+		echo '<input type="submit" class="button-secondary" value="'
494
+			 . esc_html__('Filter', 'event_espresso')
495
+			 . '" id="post-query-submit" />';
496
+		// add reset filters button at end
497
+		echo '<a class="button button-secondary"  href="'
498
+			 . esc_url_raw($this->_admin_page->get_current_page_view_url())
499
+			 . '" style="display:inline-block">'
500
+			 . esc_html__('Reset Filters', 'event_espresso')
501
+			 . '</a>';
502
+	}
503
+
504
+
505
+	/**
506
+	 * Callback for 'list_table_primary_column' WordPress filter
507
+	 * If child EE_Admin_List_Table classes set the _primary_column property then that will be set as the primary
508
+	 * column when class is instantiated.
509
+	 *
510
+	 * @param string $column_name
511
+	 * @return string
512
+	 * @see WP_List_Table::get_primary_column_name
513
+	 */
514
+	public function set_primary_column($column_name)
515
+	{
516
+		return ! empty($this->_primary_column) ? $this->_primary_column : $column_name;
517
+	}
518
+
519
+
520
+	/**
521
+	 *
522
+	 */
523
+	public function prepare_items()
524
+	{
525
+
526
+		$this->_set_column_info();
527
+		// $this->_column_headers = $this->get_column_info();
528
+		$total_items = $this->_all_data_count;
529
+		$this->process_bulk_action();
530
+
531
+		$this->items = $this->_data;
532
+		$this->set_pagination_args(
533
+			[
534
+				'total_items' => $total_items,
535
+				'per_page'    => $this->_per_page,
536
+				'total_pages' => ceil($total_items / $this->_per_page),
537
+			]
538
+		);
539
+	}
540
+
541
+
542
+	/**
543
+	 * @param object|array $item
544
+	 * @return string html content for the column
545
+	 */
546
+	protected function column_cb($item)
547
+	{
548
+		return '';
549
+	}
550
+
551
+
552
+	/**
553
+	 * This column is the default for when there is no defined column method for a registered column.
554
+	 * This can be overridden by child classes, but allows for hooking in for custom columns.
555
+	 *
556
+	 * @param EE_Base_Class $item
557
+	 * @param string        $column_name The column being called.
558
+	 * @return string html content for the column
559
+	 */
560
+	public function column_default($item, $column_name)
561
+	{
562
+		/**
563
+		 * Dynamic hook allowing for adding additional column content in this list table.
564
+		 * Note that $this->screen->id is in the format
565
+		 * {sanitize_title($top_level_menu_label)}_page_{$espresso_admin_page_slug}.  So for the messages list
566
+		 * table it is: event-espresso_page_espresso_messages.
567
+		 * However, take note that if the top level menu label has been translated (i.e. "Event Espresso"). then the
568
+		 * hook prefix ("event-espresso") will be different.
569
+		 */
570
+		ob_start();
571
+		do_action(
572
+			'AHEE__EE_Admin_List_Table__column_' . $column_name . '__' . $this->screen->id,
573
+			$item,
574
+			$this->_screen
575
+		);
576
+		return ob_get_clean();
577
+	}
578
+
579
+
580
+	/**
581
+	 * Get a list of columns. The format is:
582
+	 * 'internal-name' => 'Title'
583
+	 *
584
+	 * @return array
585
+	 * @since  3.1.0
586
+	 * @access public
587
+	 * @abstract
588
+	 */
589
+	public function get_columns()
590
+	{
591
+		/**
592
+		 * Dynamic hook allowing for adding additional columns in this list table.
593
+		 * Note that $this->screen->id is in the format
594
+		 * {sanitize_title($top_level_menu_label)}_page_{$espresso_admin_page_slug}.  So for the messages list
595
+		 * table it is: event-espresso_page_espresso_messages.
596
+		 * However, take note that if the top level menu label has been translated (i.e. "Event Espresso"). then the
597
+		 * hook prefix ("event-espresso") will be different.
598
+		 *
599
+		 * @var array
600
+		 */
601
+		return apply_filters('FHEE_manage_' . $this->screen->id . '_columns', $this->_columns, $this->_screen);
602
+	}
603
+
604
+
605
+	/**
606
+	 * Get an associative array ( id => link ) with the list
607
+	 * of views available on this table.
608
+	 *
609
+	 * @return array
610
+	 * @since  3.1.0
611
+	 * @access protected
612
+	 */
613
+	public function get_views()
614
+	{
615
+		return $this->_views;
616
+	}
617
+
618
+
619
+	/**
620
+	 * Generate the views html.
621
+	 */
622
+	public function display_views()
623
+	{
624
+		$views           = $this->get_views();
625
+		$assembled_views = [];
626
+
627
+		if (empty($views)) {
628
+			return;
629
+		}
630
+		echo "<ul class='subsubsub'>\n";
631
+		foreach ($views as $view) {
632
+			$count = isset($view['count']) && ! empty($view['count']) ? absint($view['count']) : 0;
633
+			if (isset($view['slug'], $view['class'], $view['url'], $view['label'])) {
634
+				$filter = "<li";
635
+				$filter .= $view['class'] ? " class='" . esc_attr($view['class']) . "'" : '';
636
+				$filter .= ">";
637
+				$filter .= '<a href="' . esc_url_raw($view['url']) . '">' . esc_html($view['label']) . '</a>';
638
+				$filter .= '<span class="count">(' . $count . ')</span>';
639
+				$filter .= '</li>';
640
+				$assembled_views[ $view['slug'] ] = $filter;
641
+			}
642
+		}
643
+
644
+		echo ! empty($assembled_views)
645
+			? implode("<li style='margin:0 .5rem;'>|</li>", $assembled_views)
646
+			: '';
647
+		echo "</ul>";
648
+	}
649
+
650
+
651
+	/**
652
+	 * Generates content for a single row of the table
653
+	 *
654
+	 * @param EE_Base_Class $item The current item
655
+	 * @since  4.1
656
+	 * @access public
657
+	 */
658
+	public function single_row($item)
659
+	{
660
+		$row_class = $this->_get_row_class($item);
661
+		echo '<tr class="' . esc_attr($row_class) . '">';
662
+		$this->single_row_columns($item); // already escaped
663
+		echo '</tr>';
664
+	}
665
+
666
+
667
+	/**
668
+	 * This simply sets up the row class for the table rows.
669
+	 * Allows for easier overriding of child methods for setting up sorting.
670
+	 *
671
+	 * @param EE_Base_Class $item the current item
672
+	 * @return string
673
+	 */
674
+	protected function _get_row_class($item)
675
+	{
676
+		static $row_class = '';
677
+		$row_class = ($row_class === '' ? 'alternate' : '');
678
+
679
+		$new_row_class = $row_class;
680
+
681
+		if (! empty($this->_ajax_sorting_callback)) {
682
+			$new_row_class .= ' rowsortable';
683
+		}
684
+
685
+		return $new_row_class;
686
+	}
687
+
688
+
689
+	/**
690
+	 * @return array
691
+	 */
692
+	public function get_sortable_columns()
693
+	{
694
+		return (array) $this->_sortable_columns;
695
+	}
696
+
697
+
698
+	/**
699
+	 * @return string
700
+	 */
701
+	public function get_ajax_sorting_callback()
702
+	{
703
+		return $this->_ajax_sorting_callback;
704
+	}
705
+
706
+
707
+	/**
708
+	 * @return array
709
+	 */
710
+	public function get_hidden_columns()
711
+	{
712
+		$user_id     = get_current_user_id();
713
+		$has_default = get_user_option('default' . $this->screen->id . 'columnshidden', $user_id);
714
+		if (empty($has_default) && ! empty($this->_hidden_columns)) {
715
+			update_user_option($user_id, 'default' . $this->screen->id . 'columnshidden', true);
716
+			update_user_option($user_id, 'manage' . $this->screen->id . 'columnshidden', $this->_hidden_columns, true);
717
+		}
718
+		$ref = 'manage' . $this->screen->id . 'columnshidden';
719
+		return (array) get_user_option($ref, $user_id);
720
+	}
721
+
722
+
723
+	/**
724
+	 * Generates the columns for a single row of the table.
725
+	 * Overridden from wp_list_table so as to allow us to filter the column content for a given
726
+	 * column.
727
+	 *
728
+	 * @param EE_Base_Class $item The current item
729
+	 * @since 3.1.0
730
+	 */
731
+	public function single_row_columns($item)
732
+	{
733
+		[$columns, $hidden, $sortable, $primary] = $this->get_column_info();
734
+
735
+		foreach ($columns as $column_name => $column_display_name) {
736
+
737
+			/**
738
+			 * With WordPress version 4.3.RC+ WordPress started using the hidden css class to control whether columns
739
+			 * are hidden or not instead of using "display:none;".  This bit of code provides backward compat.
740
+			 */
741
+			$hidden_class = in_array($column_name, $hidden) ? ' hidden' : '';
742
+
743
+			$classes = $column_name . ' column-' . $column_name . $hidden_class;
744
+			if ($primary === $column_name) {
745
+				$classes .= ' has-row-actions column-primary';
746
+			}
747
+
748
+			$data = ' data-colname="' . wp_strip_all_tags($column_display_name) . '"';
749
+
750
+			$class = 'class="' . esc_attr($classes) . '"';
751
+
752
+			$attributes = "{$class}{$data}";
753
+
754
+			if ($column_name === 'cb') {
755
+				echo '<th scope="row" class="check-column">';
756
+				echo apply_filters(
757
+					'FHEE__EE_Admin_List_Table__single_row_columns__column_cb_content',
758
+					$this->column_cb($item), // already escaped
759
+					$item,
760
+					$this
761
+				);
762
+				echo '</th>';
763
+			} elseif (method_exists($this, 'column_' . $column_name)) {
764
+				echo "<td $attributes>"; // already escaped
765
+				echo apply_filters(
766
+					'FHEE__EE_Admin_List_Table__single_row_columns__column_' . $column_name . '__column_content',
767
+					call_user_func([$this, 'column_' . $column_name], $item),
768
+					$item,
769
+					$this
770
+				);
771
+				echo wp_kses($this->handle_row_actions($item, $column_name, $primary), AllowedTags::getWithFormTags());
772
+				echo "</td>";
773
+			} else {
774
+				echo "<td $attributes>"; // already escaped
775
+				echo apply_filters(
776
+					'FHEE__EE_Admin_List_Table__single_row_columns__column_default__column_content',
777
+					$this->column_default($item, $column_name),
778
+					$item,
779
+					$column_name,
780
+					$this
781
+				);
782
+				echo wp_kses($this->handle_row_actions($item, $column_name, $primary), AllowedTags::getWithFormTags());
783
+				echo "</td>";
784
+			}
785
+		}
786
+	}
787
+
788
+
789
+	/**
790
+	 * Extra controls to be displayed between bulk actions and pagination
791
+	 *
792
+	 * @access public
793
+	 * @param string $which
794
+	 * @throws EE_Error
795
+	 */
796
+	public function extra_tablenav($which)
797
+	{
798
+		if ($which === 'top') {
799
+			$this->_filters();
800
+			echo wp_kses($this->_get_hidden_fields(), AllowedTags::getWithFormTags());
801
+		} else {
802
+			echo '<div class="list-table-bottom-buttons alignleft actions">';
803
+			foreach ($this->_bottom_buttons as $type => $action) {
804
+				$route         = isset($action['route']) ? $action['route'] : '';
805
+				$extra_request = isset($action['extra_request']) ? $action['extra_request'] : '';
806
+				// already escaped
807
+				echo wp_kses($this->_admin_page->get_action_link_or_button(
808
+					$route,
809
+					$type,
810
+					$extra_request,
811
+					'button button-secondary'
812
+				), AllowedTags::getWithFormTags());
813
+			}
814
+			do_action('AHEE__EE_Admin_List_Table__extra_tablenav__after_bottom_buttons', $this, $this->_screen);
815
+			echo '</div>';
816
+		}
817
+	}
818
+
819
+
820
+	/**
821
+	 * Get an associative array ( option_name => option_title ) with the list
822
+	 * of bulk actions available on this table.
823
+	 *
824
+	 * @return array
825
+	 * @since  3.1.0
826
+	 * @access protected
827
+	 */
828
+	public function get_bulk_actions()
829
+	{
830
+		return (array) $this->_get_bulk_actions();
831
+	}
832
+
833
+
834
+	/**
835
+	 * Processing bulk actions.
836
+	 */
837
+	public function process_bulk_action()
838
+	{
839
+		// this is not used it is handled by the child EE_Admin_Page class (routes).  However, including here for
840
+		// reference in case there is a case where it gets used.
841
+	}
842
+
843
+
844
+	/**
845
+	 * returns the EE admin page this list table is associated with
846
+	 *
847
+	 * @return EE_Admin_Page
848
+	 */
849
+	public function get_admin_page()
850
+	{
851
+		return $this->_admin_page;
852
+	}
853
+
854
+
855
+	/**
856
+	 * A "helper" function for all children to provide an html string of
857
+	 * actions to output in their content.  It is preferable for child classes
858
+	 * to use this method for generating their actions content so that it's
859
+	 * filterable by plugins
860
+	 *
861
+	 * @param string        $action_container           what are the html container
862
+	 *                                                  elements for this actions string?
863
+	 * @param string        $action_class               What class is for the container
864
+	 *                                                  element.
865
+	 * @param string        $action_items               The contents for the action items
866
+	 *                                                  container.  This is filtered before
867
+	 *                                                  returned.
868
+	 * @param string        $action_id                  What id (optional) is used for the
869
+	 *                                                  container element.
870
+	 * @param EE_Base_Class $item                       The object for the column displaying
871
+	 *                                                  the actions.
872
+	 * @return string The assembled action elements container.
873
+	 */
874
+	protected function _action_string(
875
+		$action_items,
876
+		$item,
877
+		$action_container = 'ul',
878
+		$action_class = '',
879
+		$action_id = ''
880
+	) {
881
+		$action_class = ! empty($action_class) ? ' class="' . esc_attr($action_class) . '"' : '';
882
+		$action_id    = ! empty($action_id) ? ' id="' . esc_attr($action_id) . '"' : '';
883
+		$open_tag     = ! empty($action_container) ? '<' . $action_container . $action_class . $action_id . '>' : '';
884
+		$close_tag    = ! empty($action_container) ? '</' . $action_container . '>' : '';
885
+		try {
886
+			$content = apply_filters(
887
+				'FHEE__EE_Admin_List_Table___action_string__action_items',
888
+				$action_items,
889
+				$item,
890
+				$this
891
+			);
892
+		} catch (Exception $e) {
893
+			if (WP_DEBUG) {
894
+				EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__);
895
+			}
896
+			$content = $action_items;
897
+		}
898
+		return "{$open_tag}{$content}{$close_tag}";
899
+	}
900
+
901
+
902
+	/**
903
+	 * @return string
904
+	 */
905
+	protected function getReturnUrl()
906
+	{
907
+		$host = $this->_admin_page->get_request()->getServerParam('HTTP_HOST');
908
+		$uri  = $this->_admin_page->get_request()->getServerParam('REQUEST_URI');
909
+		return urlencode(esc_url_raw("//{$host}{$uri}"));
910
+	}
911 911
 }
Please login to merge, or discard this patch.
core/admin/EE_Admin_Page.core.php 2 patches
Indentation   +4093 added lines, -4093 removed lines patch added patch discarded remove patch
@@ -19,4167 +19,4167 @@
 block discarded – undo
19 19
 abstract class EE_Admin_Page extends EE_Base implements InterminableInterface
20 20
 {
21 21
 
22
-    /**
23
-     * @var LoaderInterface
24
-     */
25
-    protected $loader;
22
+	/**
23
+	 * @var LoaderInterface
24
+	 */
25
+	protected $loader;
26 26
 
27
-    /**
28
-     * @var RequestInterface
29
-     */
30
-    protected $request;
27
+	/**
28
+	 * @var RequestInterface
29
+	 */
30
+	protected $request;
31 31
 
32
-    // set in _init_page_props()
33
-    public $page_slug;
32
+	// set in _init_page_props()
33
+	public $page_slug;
34 34
 
35
-    public $page_label;
35
+	public $page_label;
36 36
 
37
-    public $page_folder;
37
+	public $page_folder;
38 38
 
39
-    // set in define_page_props()
40
-    protected $_admin_base_url;
39
+	// set in define_page_props()
40
+	protected $_admin_base_url;
41 41
 
42
-    protected $_admin_base_path;
42
+	protected $_admin_base_path;
43 43
 
44
-    protected $_admin_page_title;
44
+	protected $_admin_page_title;
45 45
 
46
-    protected $_labels;
46
+	protected $_labels;
47 47
 
48 48
 
49
-    // set early within EE_Admin_Init
50
-    protected $_wp_page_slug;
49
+	// set early within EE_Admin_Init
50
+	protected $_wp_page_slug;
51 51
 
52
-    // navtabs
53
-    protected $_nav_tabs;
52
+	// navtabs
53
+	protected $_nav_tabs;
54 54
 
55
-    protected $_default_nav_tab_name;
55
+	protected $_default_nav_tab_name;
56 56
 
57 57
 
58
-    // template variables (used by templates)
59
-    protected $_template_path;
58
+	// template variables (used by templates)
59
+	protected $_template_path;
60 60
 
61
-    protected $_column_template_path;
61
+	protected $_column_template_path;
62 62
 
63
-    /**
64
-     * @var array $_template_args
65
-     */
66
-    protected $_template_args = [];
63
+	/**
64
+	 * @var array $_template_args
65
+	 */
66
+	protected $_template_args = [];
67 67
 
68
-    /**
69
-     * this will hold the list table object for a given view.
70
-     *
71
-     * @var EE_Admin_List_Table $_list_table_object
72
-     */
73
-    protected $_list_table_object;
68
+	/**
69
+	 * this will hold the list table object for a given view.
70
+	 *
71
+	 * @var EE_Admin_List_Table $_list_table_object
72
+	 */
73
+	protected $_list_table_object;
74 74
 
75
-    // bools
76
-    protected $_is_UI_request = null; // this starts at null so we can have no header routes progress through two states.
75
+	// bools
76
+	protected $_is_UI_request = null; // this starts at null so we can have no header routes progress through two states.
77 77
 
78
-    protected $_routing;
78
+	protected $_routing;
79 79
 
80
-    // list table args
81
-    protected $_view;
80
+	// list table args
81
+	protected $_view;
82 82
 
83
-    protected $_views;
83
+	protected $_views;
84 84
 
85 85
 
86
-    // action => method pairs used for routing incoming requests
87
-    protected $_page_routes;
86
+	// action => method pairs used for routing incoming requests
87
+	protected $_page_routes;
88 88
 
89
-    /**
90
-     * @var array $_page_config
91
-     */
92
-    protected $_page_config;
89
+	/**
90
+	 * @var array $_page_config
91
+	 */
92
+	protected $_page_config;
93 93
 
94
-    /**
95
-     * the current page route and route config
96
-     *
97
-     * @var string $_route
98
-     */
99
-    protected $_route;
94
+	/**
95
+	 * the current page route and route config
96
+	 *
97
+	 * @var string $_route
98
+	 */
99
+	protected $_route;
100 100
 
101
-    /**
102
-     * @var string $_cpt_route
103
-     */
104
-    protected $_cpt_route;
101
+	/**
102
+	 * @var string $_cpt_route
103
+	 */
104
+	protected $_cpt_route;
105 105
 
106
-    /**
107
-     * @var array $_route_config
108
-     */
109
-    protected $_route_config;
106
+	/**
107
+	 * @var array $_route_config
108
+	 */
109
+	protected $_route_config;
110 110
 
111
-    /**
112
-     * Used to hold default query args for list table routes to help preserve stickiness of filters for carried out
113
-     * actions.
114
-     *
115
-     * @since 4.6.x
116
-     * @var array.
117
-     */
118
-    protected $_default_route_query_args;
119
-
120
-    // set via request page and action args.
121
-    protected $_current_page;
122
-
123
-    protected $_current_view;
124
-
125
-    protected $_current_page_view_url;
126
-
127
-    /**
128
-     * unprocessed value for the 'action' request param (default '')
129
-     *
130
-     * @var string
131
-     */
132
-    protected $raw_req_action = '';
133
-
134
-    /**
135
-     * unprocessed value for the 'page' request param (default '')
136
-     *
137
-     * @var string
138
-     */
139
-    protected $raw_req_page = '';
140
-
141
-    /**
142
-     * sanitized request action (and nonce)
143
-     *
144
-     * @var string
145
-     */
146
-    protected $_req_action = '';
147
-
148
-    /**
149
-     * sanitized request action nonce
150
-     *
151
-     * @var string
152
-     */
153
-    protected $_req_nonce = '';
154
-
155
-    /**
156
-     * @var string
157
-     */
158
-    protected $_search_btn_label = '';
159
-
160
-    /**
161
-     * @var string
162
-     */
163
-    protected $_search_box_callback = '';
164
-
165
-    /**
166
-     * @var WP_Screen
167
-     */
168
-    protected $_current_screen;
169
-
170
-    // for holding EE_Admin_Hooks object when needed (set via set_hook_object())
171
-    protected $_hook_obj;
172
-
173
-    // for holding incoming request data
174
-    protected $_req_data = [];
175
-
176
-    // yes / no array for admin form fields
177
-    protected $_yes_no_values = [];
178
-
179
-    // some default things shared by all child classes
180
-    protected $_default_espresso_metaboxes;
181
-
182
-    /**
183
-     * @var EE_Registry
184
-     */
185
-    protected $EE = null;
186
-
187
-
188
-    /**
189
-     * This is just a property that flags whether the given route is a caffeinated route or not.
190
-     *
191
-     * @var boolean
192
-     */
193
-    protected $_is_caf = false;
194
-
195
-
196
-    /**
197
-     * @Constructor
198
-     * @param bool $routing indicate whether we want to just load the object and handle routing or just load the object.
199
-     * @throws EE_Error
200
-     * @throws InvalidArgumentException
201
-     * @throws ReflectionException
202
-     * @throws InvalidDataTypeException
203
-     * @throws InvalidInterfaceException
204
-     */
205
-    public function __construct($routing = true)
206
-    {
207
-        $this->loader  = LoaderFactory::getLoader();
208
-        $this->request = $this->loader->getShared(RequestInterface::class);
209
-        $this->_routing = $routing;
210
-
211
-        if (strpos($this->_get_dir(), 'caffeinated') !== false) {
212
-            $this->_is_caf = true;
213
-        }
214
-        $this->_yes_no_values = [
215
-            ['id' => true, 'text' => esc_html__('Yes', 'event_espresso')],
216
-            ['id' => false, 'text' => esc_html__('No', 'event_espresso')],
217
-        ];
218
-        // set the _req_data property.
219
-        $this->_req_data = $this->request->requestParams();
220
-        // set initial page props (child method)
221
-        $this->_init_page_props();
222
-        // set global defaults
223
-        $this->_set_defaults();
224
-        // set early because incoming requests could be ajax related and we need to register those hooks.
225
-        $this->_global_ajax_hooks();
226
-        $this->_ajax_hooks();
227
-        // other_page_hooks have to be early too.
228
-        $this->_do_other_page_hooks();
229
-        // set up page dependencies
230
-        $this->_before_page_setup();
231
-        $this->_page_setup();
232
-        // die();
233
-    }
234
-
235
-
236
-    /**
237
-     * _init_page_props
238
-     * Child classes use to set at least the following properties:
239
-     * $page_slug.
240
-     * $page_label.
241
-     *
242
-     * @abstract
243
-     * @return void
244
-     */
245
-    abstract protected function _init_page_props();
246
-
247
-
248
-    /**
249
-     * _ajax_hooks
250
-     * child classes put all their add_action('wp_ajax_{name_of_hook}') hooks in here.
251
-     * Note: within the ajax callback methods.
252
-     *
253
-     * @abstract
254
-     * @return void
255
-     */
256
-    abstract protected function _ajax_hooks();
257
-
258
-
259
-    /**
260
-     * _define_page_props
261
-     * child classes define page properties in here.  Must include at least:
262
-     * $_admin_base_url = base_url for all admin pages
263
-     * $_admin_page_title = default admin_page_title for admin pages
264
-     * $_labels = array of default labels for various automatically generated elements:
265
-     *    array(
266
-     *        'buttons' => array(
267
-     *            'add' => esc_html__('label for add new button'),
268
-     *            'edit' => esc_html__('label for edit button'),
269
-     *            'delete' => esc_html__('label for delete button')
270
-     *            )
271
-     *        )
272
-     *
273
-     * @abstract
274
-     * @return void
275
-     */
276
-    abstract protected function _define_page_props();
277
-
278
-
279
-    /**
280
-     * _set_page_routes
281
-     * child classes use this to define the page routes for all subpages handled by the class.  Page routes are
282
-     * assigned to a action => method pairs in an array and to the $_page_routes property.  Each page route must also
283
-     * have a 'default' route. Here's the format
284
-     * $this->_page_routes = array(
285
-     *        'default' => array(
286
-     *            'func' => '_default_method_handling_route',
287
-     *            'args' => array('array','of','args'),
288
-     *            'noheader' => true, //add this in if this page route is processed before any headers are loaded (i.e.
289
-     *            ajax request, backend processing)
290
-     *            'headers_sent_route'=>'headers_route_reference', //add this if noheader=>true, and you want to load a
291
-     *            headers route after.  The string you enter here should match the defined route reference for a
292
-     *            headers sent route.
293
-     *            'capability' => 'route_capability', //indicate a string for minimum capability required to access
294
-     *            this route.
295
-     *            'obj_id' => 10 // if this route has an object id, then this can include it (used for capability
296
-     *            checks).
297
-     *        ),
298
-     *        'insert_item' => '_method_for_handling_insert_item' //this can be used if all we need to have is a
299
-     *        handling method.
300
-     *        )
301
-     * )
302
-     *
303
-     * @abstract
304
-     * @return void
305
-     */
306
-    abstract protected function _set_page_routes();
307
-
308
-
309
-    /**
310
-     * _set_page_config
311
-     * child classes use this to define the _page_config array for all subpages handled by the class. Each key in the
312
-     * array corresponds to the page_route for the loaded page. Format:
313
-     * $this->_page_config = array(
314
-     *        'default' => array(
315
-     *            'labels' => array(
316
-     *                'buttons' => array(
317
-     *                    'add' => esc_html__('label for adding item'),
318
-     *                    'edit' => esc_html__('label for editing item'),
319
-     *                    'delete' => esc_html__('label for deleting item')
320
-     *                ),
321
-     *                'publishbox' => esc_html__('Localized Title for Publish metabox', 'event_espresso')
322
-     *            ), //optional an array of custom labels for various automatically generated elements to use on the
323
-     *            page. If this isn't present then the defaults will be used as set for the $this->_labels in
324
-     *            _define_page_props() method
325
-     *            'nav' => array(
326
-     *                'label' => esc_html__('Label for Tab', 'event_espresso').
327
-     *                'url' => 'http://someurl', //automatically generated UNLESS you define
328
-     *                'css_class' => 'css-class', //automatically generated UNLESS you define
329
-     *                'order' => 10, //required to indicate tab position.
330
-     *                'persistent' => false //if you want the nav tab to ONLY display when the specific route is
331
-     *                displayed then add this parameter.
332
-     *            'list_table' => 'name_of_list_table' //string for list table class to be loaded for this admin_page.
333
-     *            'metaboxes' => array('metabox1', 'metabox2'), //if present this key indicates we want to load
334
-     *            metaboxes set for eventespresso admin pages.
335
-     *            'has_metaboxes' => true, //this boolean flag can simply be used to indicate if the route will have
336
-     *            metaboxes.  Typically this is used if the 'metaboxes' index is not used because metaboxes are added
337
-     *            later.  We just use this flag to make sure the necessary js gets enqueued on page load.
338
-     *            'has_help_popups' => false //defaults(true) //this boolean flag can simply be used to indicate if the
339
-     *            given route has help popups setup and if it does then we need to make sure thickbox is enqueued.
340
-     *            'columns' => array(4, 2), //this key triggers the setup of a page that uses columns (metaboxes).  The
341
-     *            array indicates the max number of columns (4) and the default number of columns on page load (2).
342
-     *            There is an option in the "screen_options" dropdown that is setup so users can pick what columns they
343
-     *            want to display.
344
-     *            'help_tabs' => array( //this is used for adding help tabs to a page
345
-     *                'tab_id' => array(
346
-     *                    'title' => 'tab_title',
347
-     *                    'filename' => 'name_of_file_containing_content', //this is the primary method for setting
348
-     *                    help tab content.  The fallback if it isn't present is to try a the callback.  Filename
349
-     *                    should match a file in the admin folder's "help_tabs" dir (ie..
350
-     *                    events/help_tabs/name_of_file_containing_content.help_tab.php)
351
-     *                    'callback' => 'callback_method_for_content', //if 'filename' isn't present then system will
352
-     *                    attempt to use the callback which should match the name of a method in the class
353
-     *                    ),
354
-     *                'tab2_id' => array(
355
-     *                    'title' => 'tab2 title',
356
-     *                    'filename' => 'file_name_2'
357
-     *                    'callback' => 'callback_method_for_content',
358
-     *                 ),
359
-     *            'help_sidebar' => 'callback_for_sidebar_content', //this is used for setting up the sidebar in the
360
-     *            help tab area on an admin page. @return void
361
-     *
362
-     * @abstract
363
-     */
364
-    abstract protected function _set_page_config();
365
-
366
-
367
-    /**
368
-     * _add_screen_options
369
-     * Child classes can add any extra wp_screen_options within this method using built-in WP functions/methods for
370
-     * doing so. Note child classes can also define _add_screen_options_($this->_current_view) to limit screen options
371
-     * to a particular view.
372
-     *
373
-     * @link   http://chrismarslender.com/wp-tutorials/wordpress-screen-options-tutorial/
374
-     *         see also WP_Screen object documents...
375
-     * @link   http://codex.wordpress.org/Class_Reference/WP_Screen
376
-     * @abstract
377
-     * @return void
378
-     */
379
-    abstract protected function _add_screen_options();
380
-
381
-
382
-    /**
383
-     * _add_feature_pointers
384
-     * Child classes should use this method for implementing any "feature pointers" (using built-in WP styling js).
385
-     * Note child classes can also define _add_feature_pointers_($this->_current_view) to limit screen options to a
386
-     * particular view. Note: this is just a placeholder for now.  Implementation will come down the road See:
387
-     * WP_Internal_Pointers class in wp-admin/includes/template.php for example (its a final class so can't be
388
-     * extended) also see:
389
-     *
390
-     * @link   http://eamann.com/tech/wordpress-portland/
391
-     * @abstract
392
-     * @return void
393
-     */
394
-    abstract protected function _add_feature_pointers();
395
-
396
-
397
-    /**
398
-     * load_scripts_styles
399
-     * child classes put their wp_enqueue_script and wp_enqueue_style hooks in here for anything they need loaded for
400
-     * their pages/subpages.  Note this is for all pages/subpages of the system.  You can also load only specific
401
-     * scripts/styles per view by putting them in a dynamic function in this format
402
-     * (load_scripts_styles_{$this->_current_view}) which matches your page route (action request arg)
403
-     *
404
-     * @abstract
405
-     * @return void
406
-     */
407
-    abstract public function load_scripts_styles();
408
-
409
-
410
-    /**
411
-     * admin_init
412
-     * Anything that should be set/executed at 'admin_init' WP hook runtime should be put in here.  This will apply to
413
-     * all pages/views loaded by child class.
414
-     *
415
-     * @abstract
416
-     * @return void
417
-     */
418
-    abstract public function admin_init();
419
-
420
-
421
-    /**
422
-     * admin_notices
423
-     * Anything triggered by the 'admin_notices' WP hook should be put in here.  This particular method will apply to
424
-     * all pages/views loaded by child class.
425
-     *
426
-     * @abstract
427
-     * @return void
428
-     */
429
-    abstract public function admin_notices();
430
-
431
-
432
-    /**
433
-     * admin_footer_scripts
434
-     * Anything triggered by the 'admin_print_footer_scripts' WP hook should be put in here. This particular method
435
-     * will apply to all pages/views loaded by child class.
436
-     *
437
-     * @return void
438
-     */
439
-    abstract public function admin_footer_scripts();
440
-
441
-
442
-    /**
443
-     * admin_footer
444
-     * anything triggered by the 'admin_footer' WP action hook should be added to here. This particular method will
445
-     * apply to all pages/views loaded by child class.
446
-     *
447
-     * @return void
448
-     */
449
-    public function admin_footer()
450
-    {
451
-    }
452
-
453
-
454
-    /**
455
-     * _global_ajax_hooks
456
-     * all global add_action('wp_ajax_{name_of_hook}') hooks in here.
457
-     * Note: within the ajax callback methods.
458
-     *
459
-     * @abstract
460
-     * @return void
461
-     */
462
-    protected function _global_ajax_hooks()
463
-    {
464
-        // for lazy loading of metabox content
465
-        add_action('wp_ajax_espresso-ajax-content', [$this, 'ajax_metabox_content'], 10);
466
-    }
467
-
468
-
469
-    public function ajax_metabox_content()
470
-    {
471
-        $content_id  = $this->request->getRequestParam('contentid', '');
472
-        $content_url = $this->request->getRequestParam('contenturl', '', 'url');
473
-        self::cached_rss_display($content_id, $content_url);
474
-        wp_die();
475
-    }
476
-
477
-
478
-    /**
479
-     * allows extending classes do something specific before the parent constructor runs _page_setup().
480
-     *
481
-     * @return void
482
-     */
483
-    protected function _before_page_setup()
484
-    {
485
-        // default is to do nothing
486
-    }
487
-
488
-
489
-    /**
490
-     * Makes sure any things that need to be loaded early get handled.
491
-     * We also escape early here if the page requested doesn't match the object.
492
-     *
493
-     * @final
494
-     * @return void
495
-     * @throws EE_Error
496
-     * @throws InvalidArgumentException
497
-     * @throws ReflectionException
498
-     * @throws InvalidDataTypeException
499
-     * @throws InvalidInterfaceException
500
-     */
501
-    final protected function _page_setup()
502
-    {
503
-        // requires?
504
-        // admin_init stuff - global - we're setting this REALLY early
505
-        // so if EE_Admin pages have to hook into other WP pages they can.
506
-        // But keep in mind, not everything is available from the EE_Admin Page object at this point.
507
-        add_action('admin_init', [$this, 'admin_init_global'], 5);
508
-        // next verify if we need to load anything...
509
-        $this->_current_page = $this->request->getRequestParam('page', '', 'key');
510
-        $this->page_folder   = strtolower(
511
-            str_replace(['_Admin_Page', 'Extend_'], '', get_class($this))
512
-        );
513
-        global $ee_menu_slugs;
514
-        $ee_menu_slugs = (array) $ee_menu_slugs;
515
-        if (
516
-            ! $this->request->isAjax()
517
-            && (! $this->_current_page || ! isset($ee_menu_slugs[ $this->_current_page ]))
518
-        ) {
519
-            return;
520
-        }
521
-        // because WP List tables have two duplicate select inputs for choosing bulk actions,
522
-        // we need to copy the action from the second to the first
523
-        $action     = $this->request->getRequestParam('action', '-1', 'key');
524
-        $action2    = $this->request->getRequestParam('action2', '-1', 'key');
525
-        $action     = $action !== '-1' ? $action : $action2;
526
-        $req_action = $action !== '-1' ? $action : 'default';
527
-
528
-        // if a specific 'route' has been set, and the action is 'default' OR we are doing_ajax
529
-        // then let's use the route as the action.
530
-        // This covers cases where we're coming in from a list table that isn't on the default route.
531
-        $route = $this->request->getRequestParam('route');
532
-        $this->_req_action = $route && ($req_action === 'default' || $this->request->isAjax())
533
-            ? $route
534
-            : $req_action;
535
-
536
-        $this->_current_view = $this->_req_action;
537
-        $this->_req_nonce    = $this->_req_action . '_nonce';
538
-        $this->_define_page_props();
539
-        $this->_current_page_view_url = add_query_arg(
540
-            ['page' => $this->_current_page, 'action' => $this->_current_view],
541
-            $this->_admin_base_url
542
-        );
543
-        // default things
544
-        $this->_default_espresso_metaboxes = [
545
-            '_espresso_news_post_box',
546
-            '_espresso_links_post_box',
547
-            '_espresso_ratings_request',
548
-            '_espresso_sponsors_post_box',
549
-        ];
550
-        // set page configs
551
-        $this->_set_page_routes();
552
-        $this->_set_page_config();
553
-        // let's include any referrer data in our default_query_args for this route for "stickiness".
554
-        if ($this->request->requestParamIsSet('wp_referer')) {
555
-            $wp_referer = $this->request->getRequestParam('wp_referer');
556
-            if ($wp_referer) {
557
-                $this->_default_route_query_args['wp_referer'] = $wp_referer;
558
-            }
559
-        }
560
-        // for caffeinated and other extended functionality.
561
-        //  If there is a _extend_page_config method
562
-        // then let's run that to modify the all the various page configuration arrays
563
-        if (method_exists($this, '_extend_page_config')) {
564
-            $this->_extend_page_config();
565
-        }
566
-        // for CPT and other extended functionality.
567
-        // If there is an _extend_page_config_for_cpt
568
-        // then let's run that to modify all the various page configuration arrays.
569
-        if (method_exists($this, '_extend_page_config_for_cpt')) {
570
-            $this->_extend_page_config_for_cpt();
571
-        }
572
-        // filter routes and page_config so addons can add their stuff. Filtering done per class
573
-        $this->_page_routes = apply_filters(
574
-            'FHEE__' . get_class($this) . '__page_setup__page_routes',
575
-            $this->_page_routes,
576
-            $this
577
-        );
578
-        $this->_page_config = apply_filters(
579
-            'FHEE__' . get_class($this) . '__page_setup__page_config',
580
-            $this->_page_config,
581
-            $this
582
-        );
583
-        // if AHEE__EE_Admin_Page__route_admin_request_$this->_current_view method is present
584
-        // then we call it hooked into the AHEE__EE_Admin_Page__route_admin_request action
585
-        if (method_exists($this, 'AHEE__EE_Admin_Page__route_admin_request_' . $this->_current_view)) {
586
-            add_action(
587
-                'AHEE__EE_Admin_Page__route_admin_request',
588
-                [$this, 'AHEE__EE_Admin_Page__route_admin_request_' . $this->_current_view],
589
-                10,
590
-                2
591
-            );
592
-        }
593
-        // next route only if routing enabled
594
-        if ($this->_routing && ! $this->request->isAjax()) {
595
-            $this->_verify_routes();
596
-            // next let's just check user_access and kill if no access
597
-            $this->check_user_access();
598
-            if ($this->_is_UI_request) {
599
-                // admin_init stuff - global, all views for this page class, specific view
600
-                add_action('admin_init', [$this, 'admin_init'], 10);
601
-                if (method_exists($this, 'admin_init_' . $this->_current_view)) {
602
-                    add_action('admin_init', [$this, 'admin_init_' . $this->_current_view], 15);
603
-                }
604
-            } else {
605
-                // hijack regular WP loading and route admin request immediately
606
-                @ini_set('memory_limit', apply_filters('admin_memory_limit', WP_MAX_MEMORY_LIMIT));
607
-                $this->route_admin_request();
608
-            }
609
-        }
610
-    }
611
-
612
-
613
-    /**
614
-     * Provides a way for related child admin pages to load stuff on the loaded admin page.
615
-     *
616
-     * @return void
617
-     * @throws EE_Error
618
-     */
619
-    private function _do_other_page_hooks()
620
-    {
621
-        $registered_pages = apply_filters('FHEE_do_other_page_hooks_' . $this->page_slug, []);
622
-        foreach ($registered_pages as $page) {
623
-            // now let's setup the file name and class that should be present
624
-            $classname = str_replace('.class.php', '', $page);
625
-            // autoloaders should take care of loading file
626
-            if (! class_exists($classname)) {
627
-                $error_msg[] = sprintf(
628
-                    esc_html__(
629
-                        'Something went wrong with loading the %s admin hooks page.',
630
-                        'event_espresso'
631
-                    ),
632
-                    $page
633
-                );
634
-                $error_msg[] = $error_msg[0]
635
-                               . "\r\n"
636
-                               . sprintf(
637
-                                   esc_html__(
638
-                                       'There is no class in place for the %1$s admin hooks page.%2$sMake sure you have %3$s defined. If this is a non-EE-core admin page then you also must have an autoloader in place for your class',
639
-                                       'event_espresso'
640
-                                   ),
641
-                                   $page,
642
-                                   '<br />',
643
-                                   '<strong>' . $classname . '</strong>'
644
-                               );
645
-                throw new EE_Error(implode('||', $error_msg));
646
-            }
647
-            // notice we are passing the instance of this class to the hook object.
648
-            $this->loader->getShared($classname, [$this]);
649
-        }
650
-    }
651
-
652
-
653
-    /**
654
-     * @throws ReflectionException
655
-     * @throws EE_Error
656
-     */
657
-    public function load_page_dependencies()
658
-    {
659
-        try {
660
-            $this->_load_page_dependencies();
661
-        } catch (EE_Error $e) {
662
-            $e->get_error();
663
-        }
664
-    }
665
-
666
-
667
-    /**
668
-     * load_page_dependencies
669
-     * loads things specific to this page class when its loaded.  Really helps with efficiency.
670
-     *
671
-     * @return void
672
-     * @throws DomainException
673
-     * @throws EE_Error
674
-     * @throws InvalidArgumentException
675
-     * @throws InvalidDataTypeException
676
-     * @throws InvalidInterfaceException
677
-     */
678
-    protected function _load_page_dependencies()
679
-    {
680
-        // let's set the current_screen and screen options to override what WP set
681
-        $this->_current_screen = get_current_screen();
682
-        // load admin_notices - global, page class, and view specific
683
-        add_action('admin_notices', [$this, 'admin_notices_global'], 5);
684
-        add_action('admin_notices', [$this, 'admin_notices'], 10);
685
-        if (method_exists($this, 'admin_notices_' . $this->_current_view)) {
686
-            add_action('admin_notices', [$this, 'admin_notices_' . $this->_current_view], 15);
687
-        }
688
-        // load network admin_notices - global, page class, and view specific
689
-        add_action('network_admin_notices', [$this, 'network_admin_notices_global'], 5);
690
-        if (method_exists($this, 'network_admin_notices_' . $this->_current_view)) {
691
-            add_action('network_admin_notices', [$this, 'network_admin_notices_' . $this->_current_view]);
692
-        }
693
-        // this will save any per_page screen options if they are present
694
-        $this->_set_per_page_screen_options();
695
-        // setup list table properties
696
-        $this->_set_list_table();
697
-        // child classes can "register" a metabox to be automatically handled via the _page_config array property.
698
-        // However in some cases the metaboxes will need to be added within a route handling callback.
699
-        $this->_add_registered_meta_boxes();
700
-        $this->_add_screen_columns();
701
-        // add screen options - global, page child class, and view specific
702
-        $this->_add_global_screen_options();
703
-        $this->_add_screen_options();
704
-        $add_screen_options = "_add_screen_options_{$this->_current_view}";
705
-        if (method_exists($this, $add_screen_options)) {
706
-            $this->{$add_screen_options}();
707
-        }
708
-        // add help tab(s) - set via page_config and qtips.
709
-        $this->_add_help_tabs();
710
-        $this->_add_qtips();
711
-        // add feature_pointers - global, page child class, and view specific
712
-        $this->_add_feature_pointers();
713
-        $this->_add_global_feature_pointers();
714
-        $add_feature_pointer = "_add_feature_pointer_{$this->_current_view}";
715
-        if (method_exists($this, $add_feature_pointer)) {
716
-            $this->{$add_feature_pointer}();
717
-        }
718
-        // enqueue scripts/styles - global, page class, and view specific
719
-        add_action('admin_enqueue_scripts', [$this, 'load_global_scripts_styles'], 5);
720
-        add_action('admin_enqueue_scripts', [$this, 'load_scripts_styles'], 10);
721
-        if (method_exists($this, "load_scripts_styles_{$this->_current_view}")) {
722
-            add_action('admin_enqueue_scripts', [$this, "load_scripts_styles_{$this->_current_view}"], 15);
723
-        }
724
-        add_action('admin_enqueue_scripts', [$this, 'admin_footer_scripts_eei18n_js_strings'], 100);
725
-        // admin_print_footer_scripts - global, page child class, and view specific.
726
-        // NOTE, despite the name, whenever possible, scripts should NOT be loaded using this.
727
-        // In most cases that's doing_it_wrong().  But adding hidden container elements etc.
728
-        // is a good use case. Notice the late priority we're giving these
729
-        add_action('admin_print_footer_scripts', [$this, 'admin_footer_scripts_global'], 99);
730
-        add_action('admin_print_footer_scripts', [$this, 'admin_footer_scripts'], 100);
731
-        if (method_exists($this, "admin_footer_scripts_{$this->_current_view}")) {
732
-            add_action('admin_print_footer_scripts', [$this, "admin_footer_scripts_{$this->_current_view}"], 101);
733
-        }
734
-        // admin footer scripts
735
-        add_action('admin_footer', [$this, 'admin_footer_global'], 99);
736
-        add_action('admin_footer', [$this, 'admin_footer'], 100);
737
-        if (method_exists($this, "admin_footer_{$this->_current_view}")) {
738
-            add_action('admin_footer', [$this, "admin_footer_{$this->_current_view}"], 101);
739
-        }
740
-        do_action('FHEE__EE_Admin_Page___load_page_dependencies__after_load', $this->page_slug);
741
-        // targeted hook
742
-        do_action(
743
-            "FHEE__EE_Admin_Page___load_page_dependencies__after_load__{$this->page_slug}__{$this->_req_action}"
744
-        );
745
-    }
746
-
747
-
748
-    /**
749
-     * _set_defaults
750
-     * This sets some global defaults for class properties.
751
-     */
752
-    private function _set_defaults()
753
-    {
754
-        $this->_current_screen       = $this->_admin_page_title = $this->_req_action = $this->_req_nonce = null;
755
-        $this->_event                = $this->_template_path = $this->_column_template_path = null;
756
-        $this->_nav_tabs             = $this->_views = $this->_page_routes = [];
757
-        $this->_page_config          = $this->_default_route_query_args = [];
758
-        $this->_default_nav_tab_name = 'overview';
759
-        // init template args
760
-        $this->_template_args = [
761
-            'admin_page_header'  => '',
762
-            'admin_page_content' => '',
763
-            'post_body_content'  => '',
764
-            'before_list_table'  => '',
765
-            'after_list_table'   => '',
766
-        ];
767
-    }
768
-
769
-
770
-    /**
771
-     * route_admin_request
772
-     *
773
-     * @return void
774
-     * @throws InvalidArgumentException
775
-     * @throws InvalidInterfaceException
776
-     * @throws InvalidDataTypeException
777
-     * @throws EE_Error
778
-     * @throws ReflectionException
779
-     * @see    _route_admin_request()
780
-     */
781
-    public function route_admin_request()
782
-    {
783
-        try {
784
-            $this->_route_admin_request();
785
-        } catch (EE_Error $e) {
786
-            $e->get_error();
787
-        }
788
-    }
789
-
790
-
791
-    public function set_wp_page_slug($wp_page_slug)
792
-    {
793
-        $this->_wp_page_slug = $wp_page_slug;
794
-        // if in network admin then we need to append "-network" to the page slug. Why? Because that's how WP rolls...
795
-        if (is_network_admin()) {
796
-            $this->_wp_page_slug .= '-network';
797
-        }
798
-    }
799
-
800
-
801
-    /**
802
-     * _verify_routes
803
-     * All this method does is verify the incoming request and make sure that routes exist for it.  We do this early so
804
-     * we know if we need to drop out.
805
-     *
806
-     * @return bool
807
-     * @throws EE_Error
808
-     */
809
-    protected function _verify_routes()
810
-    {
811
-        do_action('AHEE_log', __FILE__, __FUNCTION__, '');
812
-        if (! $this->_current_page && ! $this->request->isAjax()) {
813
-            return false;
814
-        }
815
-        $this->_route = false;
816
-        // check that the page_routes array is not empty
817
-        if (empty($this->_page_routes)) {
818
-            // user error msg
819
-            $error_msg = sprintf(
820
-                esc_html__('No page routes have been set for the %s admin page.', 'event_espresso'),
821
-                $this->_admin_page_title
822
-            );
823
-            // developer error msg
824
-            $error_msg .= '||' . $error_msg
825
-                          . esc_html__(
826
-                              ' Make sure the "set_page_routes()" method exists, and is setting the "_page_routes" array properly.',
827
-                              'event_espresso'
828
-                          );
829
-            throw new EE_Error($error_msg);
830
-        }
831
-        // and that the requested page route exists
832
-        if (array_key_exists($this->_req_action, $this->_page_routes)) {
833
-            $this->_route        = $this->_page_routes[ $this->_req_action ];
834
-            $this->_route_config = isset($this->_page_config[ $this->_req_action ])
835
-                ? $this->_page_config[ $this->_req_action ]
836
-                : [];
837
-        } else {
838
-            // user error msg
839
-            $error_msg = sprintf(
840
-                esc_html__(
841
-                    'The requested page route does not exist for the %s admin page.',
842
-                    'event_espresso'
843
-                ),
844
-                $this->_admin_page_title
845
-            );
846
-            // developer error msg
847
-            $error_msg .= '||' . $error_msg
848
-                          . sprintf(
849
-                              esc_html__(
850
-                                  ' Create a key in the "_page_routes" array named "%s" and set its value to the appropriate method.',
851
-                                  'event_espresso'
852
-                              ),
853
-                              $this->_req_action
854
-                          );
855
-            throw new EE_Error($error_msg);
856
-        }
857
-        // and that a default route exists
858
-        if (! array_key_exists('default', $this->_page_routes)) {
859
-            // user error msg
860
-            $error_msg = sprintf(
861
-                esc_html__(
862
-                    'A default page route has not been set for the % admin page.',
863
-                    'event_espresso'
864
-                ),
865
-                $this->_admin_page_title
866
-            );
867
-            // developer error msg
868
-            $error_msg .= '||' . $error_msg
869
-                          . esc_html__(
870
-                              ' Create a key in the "_page_routes" array named "default" and set its value to your default page method.',
871
-                              'event_espresso'
872
-                          );
873
-            throw new EE_Error($error_msg);
874
-        }
875
-        // first lets' catch if the UI request has EVER been set.
876
-        if ($this->_is_UI_request === null) {
877
-            // lets set if this is a UI request or not.
878
-            $this->_is_UI_request = ! $this->request->getRequestParam('noheader', false, 'bool');
879
-            // wait a minute... we might have a noheader in the route array
880
-            $this->_is_UI_request = ! (
881
-                is_array($this->_route) && isset($this->_route['noheader']) && $this->_route['noheader']
882
-            )
883
-                ? $this->_is_UI_request
884
-                : false;
885
-        }
886
-        $this->_set_current_labels();
887
-        return true;
888
-    }
889
-
890
-
891
-    /**
892
-     * this method simply verifies a given route and makes sure its an actual route available for the loaded page
893
-     *
894
-     * @param string $route the route name we're verifying
895
-     * @return bool we'll throw an exception if this isn't a valid route.
896
-     * @throws EE_Error
897
-     */
898
-    protected function _verify_route($route)
899
-    {
900
-        if (array_key_exists($this->_req_action, $this->_page_routes)) {
901
-            return true;
902
-        }
903
-        // user error msg
904
-        $error_msg = sprintf(
905
-            esc_html__('The given page route does not exist for the %s admin page.', 'event_espresso'),
906
-            $this->_admin_page_title
907
-        );
908
-        // developer error msg
909
-        $error_msg .= '||' . $error_msg
910
-                      . sprintf(
911
-                          esc_html__(
912
-                              ' Check the route you are using in your method (%s) and make sure it matches a route set in your "_page_routes" array property',
913
-                              'event_espresso'
914
-                          ),
915
-                          $route
916
-                      );
917
-        throw new EE_Error($error_msg);
918
-    }
919
-
920
-
921
-    /**
922
-     * perform nonce verification
923
-     * This method has be encapsulated here so that any ajax requests that bypass normal routes can verify their nonces
924
-     * using this method (and save retyping!)
925
-     *
926
-     * @param string $nonce     The nonce sent
927
-     * @param string $nonce_ref The nonce reference string (name0)
928
-     * @return void
929
-     * @throws EE_Error
930
-     */
931
-    protected function _verify_nonce($nonce, $nonce_ref)
932
-    {
933
-        // verify nonce against expected value
934
-        if (! wp_verify_nonce($nonce, $nonce_ref)) {
935
-            // these are not the droids you are looking for !!!
936
-            $msg = sprintf(
937
-                esc_html__('%sNonce Fail.%s', 'event_espresso'),
938
-                '<a href="https://www.youtube.com/watch?v=56_S0WeTkzs">',
939
-                '</a>'
940
-            );
941
-            if (WP_DEBUG) {
942
-                $msg .= "\n  ";
943
-                $msg .= sprintf(
944
-                    esc_html__(
945
-                        'In order to dynamically generate nonces for your actions, use the %s::add_query_args_and_nonce() method. May the Nonce be with you!',
946
-                        'event_espresso'
947
-                    ),
948
-                    __CLASS__
949
-                );
950
-            }
951
-            if (! $this->request->isAjax()) {
952
-                wp_die($msg);
953
-            }
954
-            EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
955
-            $this->_return_json();
956
-        }
957
-    }
958
-
959
-
960
-    /**
961
-     * _route_admin_request()
962
-     * Meat and potatoes of the class.  Basically, this dude checks out what's being requested and sees if theres are
963
-     * some doodads to work the magic and handle the flingjangy. Translation:  Checks if the requested action is listed
964
-     * in the page routes and then will try to load the corresponding method.
965
-     *
966
-     * @return void
967
-     * @throws EE_Error
968
-     * @throws InvalidArgumentException
969
-     * @throws InvalidDataTypeException
970
-     * @throws InvalidInterfaceException
971
-     * @throws ReflectionException
972
-     */
973
-    protected function _route_admin_request()
974
-    {
975
-        if (! $this->_is_UI_request) {
976
-            $this->_verify_routes();
977
-        }
978
-        $nonce_check = ! isset($this->_route_config['require_nonce']) || $this->_route_config['require_nonce'];
979
-        if ($this->_req_action !== 'default' && $nonce_check) {
980
-            // set nonce from post data
981
-            $nonce = $this->request->getRequestParam($this->_req_nonce, '');
982
-            $this->_verify_nonce($nonce, $this->_req_nonce);
983
-        }
984
-        // set the nav_tabs array but ONLY if this is  UI_request
985
-        if ($this->_is_UI_request) {
986
-            $this->_set_nav_tabs();
987
-        }
988
-        // grab callback function
989
-        $func = is_array($this->_route) ? $this->_route['func'] : $this->_route;
990
-        // check if callback has args
991
-        $args      = is_array($this->_route) && isset($this->_route['args']) ? $this->_route['args'] : [];
992
-        $error_msg = '';
993
-        // action right before calling route
994
-        // (hook is something like 'AHEE__Registrations_Admin_Page__route_admin_request')
995
-        if (! did_action('AHEE__EE_Admin_Page__route_admin_request')) {
996
-            do_action('AHEE__EE_Admin_Page__route_admin_request', $this->_current_view, $this);
997
-        }
998
-        // right before calling the route, let's clean the _wp_http_referer
999
-        $this->request->setServerParam(
1000
-            'REQUEST_URI',
1001
-            remove_query_arg(
1002
-                '_wp_http_referer',
1003
-                wp_unslash($this->request->getServerParam('REQUEST_URI'))
1004
-            )
1005
-        );
1006
-        if (! empty($func)) {
1007
-            if (is_array($func)) {
1008
-                list($class, $method) = $func;
1009
-            } elseif (strpos($func, '::') !== false) {
1010
-                list($class, $method) = explode('::', $func);
1011
-            } else {
1012
-                $class  = $this;
1013
-                $method = $func;
1014
-            }
1015
-            if (! (is_object($class) && $class === $this)) {
1016
-                // send along this admin page object for access by addons.
1017
-                $args['admin_page_object'] = $this;
1018
-            }
1019
-            if (
1020
-                // is it a method on a class that doesn't work?
1021
-                (
1022
-                    (
1023
-                        method_exists($class, $method)
1024
-                        && call_user_func_array([$class, $method], $args) === false
1025
-                    )
1026
-                    && (
1027
-                        // is it a standalone function that doesn't work?
1028
-                        function_exists($method)
1029
-                        && call_user_func_array(
1030
-                            $func,
1031
-                            array_merge(['admin_page_object' => $this], $args)
1032
-                        ) === false
1033
-                    )
1034
-                )
1035
-                || (
1036
-                    // is it neither a class method NOR a standalone function?
1037
-                    ! method_exists($class, $method)
1038
-                    && ! function_exists($method)
1039
-                )
1040
-            ) {
1041
-                // user error msg
1042
-                $error_msg = esc_html__(
1043
-                    'An error occurred. The  requested page route could not be found.',
1044
-                    'event_espresso'
1045
-                );
1046
-                // developer error msg
1047
-                $error_msg .= '||';
1048
-                $error_msg .= sprintf(
1049
-                    esc_html__(
1050
-                        'Page route "%s" could not be called. Check that the spelling for method names and actions in the "_page_routes" array are all correct.',
1051
-                        'event_espresso'
1052
-                    ),
1053
-                    $method
1054
-                );
1055
-            }
1056
-            if (! empty($error_msg)) {
1057
-                throw new EE_Error($error_msg);
1058
-            }
1059
-        }
1060
-        // if we've routed and this route has a no headers route AND a sent_headers_route,
1061
-        // then we need to reset the routing properties to the new route.
1062
-        // now if UI request is FALSE and noheader is true AND we have a headers_sent_route in the route array then let's set UI_request to true because the no header route has a second func after headers have been sent.
1063
-        if (
1064
-            $this->_is_UI_request === false
1065
-            && is_array($this->_route)
1066
-            && ! empty($this->_route['headers_sent_route'])
1067
-        ) {
1068
-            $this->_reset_routing_properties($this->_route['headers_sent_route']);
1069
-        }
1070
-    }
1071
-
1072
-
1073
-    /**
1074
-     * This method just allows the resetting of page properties in the case where a no headers
1075
-     * route redirects to a headers route in its route config.
1076
-     *
1077
-     * @param string $new_route New (non header) route to redirect to.
1078
-     * @return   void
1079
-     * @throws ReflectionException
1080
-     * @throws InvalidArgumentException
1081
-     * @throws InvalidInterfaceException
1082
-     * @throws InvalidDataTypeException
1083
-     * @throws EE_Error
1084
-     * @since   4.3.0
1085
-     */
1086
-    protected function _reset_routing_properties($new_route)
1087
-    {
1088
-        $this->_is_UI_request = true;
1089
-        // now we set the current route to whatever the headers_sent_route is set at
1090
-        $this->request->setRequestParam('action', $new_route);
1091
-        // rerun page setup
1092
-        $this->_page_setup();
1093
-    }
1094
-
1095
-
1096
-    /**
1097
-     * _add_query_arg
1098
-     * adds nonce to array of arguments then calls WP add_query_arg function
1099
-     *(internally just uses EEH_URL's function with the same name)
1100
-     *
1101
-     * @param array  $args
1102
-     * @param string $url
1103
-     * @param bool   $sticky                  if true, then the existing Request params will be appended to the
1104
-     *                                        generated url in an associative array indexed by the key 'wp_referer';
1105
-     *                                        Example usage: If the current page is:
1106
-     *                                        http://mydomain.com/wp-admin/admin.php?page=espresso_registrations
1107
-     *                                        &action=default&event_id=20&month_range=March%202015
1108
-     *                                        &_wpnonce=5467821
1109
-     *                                        and you call:
1110
-     *                                        EE_Admin_Page::add_query_args_and_nonce(
1111
-     *                                        array(
1112
-     *                                        'action' => 'resend_something',
1113
-     *                                        'page=>espresso_registrations'
1114
-     *                                        ),
1115
-     *                                        $some_url,
1116
-     *                                        true
1117
-     *                                        );
1118
-     *                                        It will produce a url in this structure:
1119
-     *                                        http://{$some_url}/?page=espresso_registrations&action=resend_something
1120
-     *                                        &wp_referer[action]=default&wp_referer[event_id]=20&wpreferer[
1121
-     *                                        month_range]=March%202015
1122
-     * @param bool   $exclude_nonce           If true, the the nonce will be excluded from the generated nonce.
1123
-     * @return string
1124
-     */
1125
-    public static function add_query_args_and_nonce(
1126
-        $args = [],
1127
-        $url = false,
1128
-        $sticky = false,
1129
-        $exclude_nonce = false
1130
-    ) {
1131
-        // if there is a _wp_http_referer include the values from the request but only if sticky = true
1132
-        if ($sticky) {
1133
-            /** @var RequestInterface $request */
1134
-            $request = LoaderFactory::getLoader()->getShared(RequestInterface::class);
1135
-            $request->unSetRequestParams(['_wp_http_referer', 'wp_referer']);
1136
-            foreach ($request->requestParams() as $key => $value) {
1137
-                // do not add nonces
1138
-                if (strpos($key, 'nonce') !== false) {
1139
-                    continue;
1140
-                }
1141
-                $args[ 'wp_referer[' . $key . ']' ] = is_string($value) ? htmlspecialchars($value) : $value;
1142
-            }
1143
-        }
1144
-        return EEH_URL::add_query_args_and_nonce($args, $url, $exclude_nonce);
1145
-    }
1146
-
1147
-
1148
-    /**
1149
-     * This returns a generated link that will load the related help tab.
1150
-     *
1151
-     * @param string $help_tab_id the id for the connected help tab
1152
-     * @param string $icon_style  (optional) include css class for the style you want to use for the help icon.
1153
-     * @param string $help_text   (optional) send help text you want to use for the link if default not to be used
1154
-     * @return string              generated link
1155
-     * @uses EEH_Template::get_help_tab_link()
1156
-     */
1157
-    protected function _get_help_tab_link($help_tab_id, $icon_style = '', $help_text = '')
1158
-    {
1159
-        return EEH_Template::get_help_tab_link(
1160
-            $help_tab_id,
1161
-            $this->page_slug,
1162
-            $this->_req_action,
1163
-            $icon_style,
1164
-            $help_text
1165
-        );
1166
-    }
1167
-
1168
-
1169
-    /**
1170
-     * _add_help_tabs
1171
-     * Note child classes define their help tabs within the page_config array.
1172
-     *
1173
-     * @link   http://codex.wordpress.org/Function_Reference/add_help_tab
1174
-     * @return void
1175
-     * @throws DomainException
1176
-     * @throws EE_Error
1177
-     */
1178
-    protected function _add_help_tabs()
1179
-    {
1180
-        if (isset($this->_page_config[ $this->_req_action ])) {
1181
-            $config = $this->_page_config[ $this->_req_action ];
1182
-            // let's see if there is a help_sidebar set for the current route and we'll set that up for usage as well.
1183
-            if (is_array($config) && isset($config['help_sidebar'])) {
1184
-                // check that the callback given is valid
1185
-                if (! method_exists($this, $config['help_sidebar'])) {
1186
-                    throw new EE_Error(
1187
-                        sprintf(
1188
-                            esc_html__(
1189
-                                'The _page_config array has a callback set for the "help_sidebar" option.  However the callback given (%s) is not a valid callback.  Doublecheck the spelling and make sure this method exists for the class %s',
1190
-                                'event_espresso'
1191
-                            ),
1192
-                            $config['help_sidebar'],
1193
-                            get_class($this)
1194
-                        )
1195
-                    );
1196
-                }
1197
-                $content = apply_filters(
1198
-                    'FHEE__' . get_class($this) . '__add_help_tabs__help_sidebar',
1199
-                    $this->{$config['help_sidebar']}()
1200
-                );
1201
-                $this->_current_screen->set_help_sidebar($content);
1202
-            }
1203
-            if (! isset($config['help_tabs'])) {
1204
-                return;
1205
-            } //no help tabs for this route
1206
-            foreach ((array) $config['help_tabs'] as $tab_id => $cfg) {
1207
-                // we're here so there ARE help tabs!
1208
-                // make sure we've got what we need
1209
-                if (! isset($cfg['title'])) {
1210
-                    throw new EE_Error(
1211
-                        esc_html__(
1212
-                            'The _page_config array is not set up properly for help tabs.  It is missing a title',
1213
-                            'event_espresso'
1214
-                        )
1215
-                    );
1216
-                }
1217
-                if (! isset($cfg['filename']) && ! isset($cfg['callback']) && ! isset($cfg['content'])) {
1218
-                    throw new EE_Error(
1219
-                        esc_html__(
1220
-                            'The _page_config array is not setup properly for help tabs. It is missing a either a filename reference, or a callback reference or a content reference so there is no way to know the content for the help tab',
1221
-                            'event_espresso'
1222
-                        )
1223
-                    );
1224
-                }
1225
-                // first priority goes to content.
1226
-                if (! empty($cfg['content'])) {
1227
-                    $content = ! empty($cfg['content']) ? $cfg['content'] : null;
1228
-                    // second priority goes to filename
1229
-                } elseif (! empty($cfg['filename'])) {
1230
-                    $file_path = $this->_get_dir() . '/help_tabs/' . $cfg['filename'] . '.help_tab.php';
1231
-                    // it's possible that the file is located on decaf route (and above sets up for caf route, if this is the case then lets check decaf route too)
1232
-                    $file_path = ! is_readable($file_path) ? EE_ADMIN_PAGES
1233
-                                                             . basename($this->_get_dir())
1234
-                                                             . '/help_tabs/'
1235
-                                                             . $cfg['filename']
1236
-                                                             . '.help_tab.php' : $file_path;
1237
-                    // if file is STILL not readable then let's do a EE_Error so its more graceful than a fatal error.
1238
-                    if (! isset($cfg['callback']) && ! is_readable($file_path)) {
1239
-                        EE_Error::add_error(
1240
-                            sprintf(
1241
-                                esc_html__(
1242
-                                    'The filename given for the help tab %s is not a valid file and there is no other configuration for the tab content.  Please check that the string you set for the help tab on this route (%s) is the correct spelling.  The file should be in %s',
1243
-                                    'event_espresso'
1244
-                                ),
1245
-                                $tab_id,
1246
-                                key($config),
1247
-                                $file_path
1248
-                            ),
1249
-                            __FILE__,
1250
-                            __FUNCTION__,
1251
-                            __LINE__
1252
-                        );
1253
-                        return;
1254
-                    }
1255
-                    $template_args['admin_page_obj'] = $this;
1256
-                    $content                         = EEH_Template::display_template(
1257
-                        $file_path,
1258
-                        $template_args,
1259
-                        true
1260
-                    );
1261
-                } else {
1262
-                    $content = '';
1263
-                }
1264
-                // check if callback is valid
1265
-                if (
1266
-                    empty($content)
1267
-                    && (
1268
-                        ! isset($cfg['callback']) || ! method_exists($this, $cfg['callback'])
1269
-                    )
1270
-                ) {
1271
-                    EE_Error::add_error(
1272
-                        sprintf(
1273
-                            esc_html__(
1274
-                                'The callback given for a %s help tab on this page does not content OR a corresponding method for generating the content.  Check the spelling or make sure the method is present.',
1275
-                                'event_espresso'
1276
-                            ),
1277
-                            $cfg['title']
1278
-                        ),
1279
-                        __FILE__,
1280
-                        __FUNCTION__,
1281
-                        __LINE__
1282
-                    );
1283
-                    return;
1284
-                }
1285
-                // setup config array for help tab method
1286
-                $id  = $this->page_slug . '-' . $this->_req_action . '-' . $tab_id;
1287
-                $_ht = [
1288
-                    'id'       => $id,
1289
-                    'title'    => $cfg['title'],
1290
-                    'callback' => isset($cfg['callback']) && empty($content) ? [$this, $cfg['callback']] : null,
1291
-                    'content'  => $content,
1292
-                ];
1293
-                $this->_current_screen->add_help_tab($_ht);
1294
-            }
1295
-        }
1296
-    }
1297
-
1298
-
1299
-    /**
1300
-     * This simply sets up any qtips that have been defined in the page config
1301
-     *
1302
-     * @return void
1303
-     */
1304
-    protected function _add_qtips()
1305
-    {
1306
-        if (isset($this->_route_config['qtips'])) {
1307
-            $qtips = (array) $this->_route_config['qtips'];
1308
-            // load qtip loader
1309
-            $path = [
1310
-                $this->_get_dir() . '/qtips/',
1311
-                EE_ADMIN_PAGES . basename($this->_get_dir()) . '/qtips/',
1312
-            ];
1313
-            EEH_Qtip_Loader::instance()->register($qtips, $path);
1314
-        }
1315
-    }
1316
-
1317
-
1318
-    /**
1319
-     * _set_nav_tabs
1320
-     * This sets up the nav tabs from the page_routes array.  This method can be overwritten by child classes if you
1321
-     * wish to add additional tabs or modify accordingly.
1322
-     *
1323
-     * @return void
1324
-     * @throws InvalidArgumentException
1325
-     * @throws InvalidInterfaceException
1326
-     * @throws InvalidDataTypeException
1327
-     */
1328
-    protected function _set_nav_tabs()
1329
-    {
1330
-        do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1331
-        $i = 0;
1332
-        foreach ($this->_page_config as $slug => $config) {
1333
-            if (! is_array($config) || empty($config['nav'])) {
1334
-                continue;
1335
-            }
1336
-            // no nav tab for this config
1337
-            // check for persistent flag
1338
-            if ($slug !== $this->_req_action && isset($config['nav']['persistent']) && ! $config['nav']['persistent']) {
1339
-                // nav tab is only to appear when route requested.
1340
-                continue;
1341
-            }
1342
-            if (! $this->check_user_access($slug, true)) {
1343
-                // no nav tab because current user does not have access.
1344
-                continue;
1345
-            }
1346
-            $css_class                = isset($config['css_class']) ? $config['css_class'] . ' ' : '';
1347
-            $this->_nav_tabs[ $slug ] = [
1348
-                'url'       => isset($config['nav']['url'])
1349
-                    ? $config['nav']['url']
1350
-                    : self::add_query_args_and_nonce(
1351
-                        ['action' => $slug],
1352
-                        $this->_admin_base_url
1353
-                    ),
1354
-                'link_text' => isset($config['nav']['label'])
1355
-                    ? $config['nav']['label']
1356
-                    : ucwords(
1357
-                        str_replace('_', ' ', $slug)
1358
-                    ),
1359
-                'css_class' => $this->_req_action === $slug ? $css_class . 'nav-tab-active' : $css_class,
1360
-                'order'     => isset($config['nav']['order']) ? $config['nav']['order'] : $i,
1361
-            ];
1362
-            $i++;
1363
-        }
1364
-        // if $this->_nav_tabs is empty then lets set the default
1365
-        if (empty($this->_nav_tabs)) {
1366
-            $this->_nav_tabs[ $this->_default_nav_tab_name ] = [
1367
-                'url'       => $this->_admin_base_url,
1368
-                'link_text' => ucwords(str_replace('_', ' ', $this->_default_nav_tab_name)),
1369
-                'css_class' => 'nav-tab-active',
1370
-                'order'     => 10,
1371
-            ];
1372
-        }
1373
-        // now let's sort the tabs according to order
1374
-        usort($this->_nav_tabs, [$this, '_sort_nav_tabs']);
1375
-    }
1376
-
1377
-
1378
-    /**
1379
-     * _set_current_labels
1380
-     * This method modifies the _labels property with any optional specific labels indicated in the _page_routes
1381
-     * property array
1382
-     *
1383
-     * @return void
1384
-     */
1385
-    private function _set_current_labels()
1386
-    {
1387
-        if (is_array($this->_route_config) && isset($this->_route_config['labels'])) {
1388
-            foreach ($this->_route_config['labels'] as $label => $text) {
1389
-                if (is_array($text)) {
1390
-                    foreach ($text as $sublabel => $subtext) {
1391
-                        $this->_labels[ $label ][ $sublabel ] = $subtext;
1392
-                    }
1393
-                } else {
1394
-                    $this->_labels[ $label ] = $text;
1395
-                }
1396
-            }
1397
-        }
1398
-    }
1399
-
1400
-
1401
-    /**
1402
-     *        verifies user access for this admin page
1403
-     *
1404
-     * @param string $route_to_check if present then the capability for the route matching this string is checked.
1405
-     * @param bool   $verify_only    Default is FALSE which means if user check fails then wp_die().  Otherwise just
1406
-     *                               return false if verify fail.
1407
-     * @return bool
1408
-     * @throws InvalidArgumentException
1409
-     * @throws InvalidDataTypeException
1410
-     * @throws InvalidInterfaceException
1411
-     */
1412
-    public function check_user_access($route_to_check = '', $verify_only = false)
1413
-    {
1414
-        do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1415
-        $route_to_check = empty($route_to_check) ? $this->_req_action : $route_to_check;
1416
-        $capability     = ! empty($route_to_check) && isset($this->_page_routes[ $route_to_check ])
1417
-                          && is_array(
1418
-                              $this->_page_routes[ $route_to_check ]
1419
-                          )
1420
-                          && ! empty($this->_page_routes[ $route_to_check ]['capability'])
1421
-            ? $this->_page_routes[ $route_to_check ]['capability'] : null;
1422
-        if (empty($capability) && empty($route_to_check)) {
1423
-            $capability = is_array($this->_route) && empty($this->_route['capability']) ? 'manage_options'
1424
-                : $this->_route['capability'];
1425
-        } else {
1426
-            $capability = empty($capability) ? 'manage_options' : $capability;
1427
-        }
1428
-        $id = is_array($this->_route) && ! empty($this->_route['obj_id']) ? $this->_route['obj_id'] : 0;
1429
-        if (
1430
-            ! $this->request->isAjax()
1431
-            && (
1432
-                ! function_exists('is_admin')
1433
-                || ! EE_Registry::instance()->CAP->current_user_can(
1434
-                    $capability,
1435
-                    $this->page_slug
1436
-                    . '_'
1437
-                    . $route_to_check,
1438
-                    $id
1439
-                )
1440
-            )
1441
-        ) {
1442
-            if ($verify_only) {
1443
-                return false;
1444
-            }
1445
-            if (is_user_logged_in()) {
1446
-                wp_die(esc_html__('You do not have access to this route.', 'event_espresso'));
1447
-            } else {
1448
-                return false;
1449
-            }
1450
-        }
1451
-        return true;
1452
-    }
1453
-
1454
-
1455
-    /**
1456
-     * admin_init_global
1457
-     * This runs all the code that we want executed within the WP admin_init hook.
1458
-     * This method executes for ALL EE Admin pages.
1459
-     *
1460
-     * @return void
1461
-     */
1462
-    public function admin_init_global()
1463
-    {
1464
-    }
1465
-
1466
-
1467
-    /**
1468
-     * wp_loaded_global
1469
-     * This runs all the code that we want executed within the WP wp_loaded hook.  This method is optional for an
1470
-     * EE_Admin page and will execute on every EE Admin Page load
1471
-     *
1472
-     * @return void
1473
-     */
1474
-    public function wp_loaded()
1475
-    {
1476
-    }
1477
-
1478
-
1479
-    /**
1480
-     * admin_notices
1481
-     * Anything triggered by the 'admin_notices' WP hook should be put in here.  This particular method will apply on
1482
-     * ALL EE_Admin pages.
1483
-     *
1484
-     * @return void
1485
-     */
1486
-    public function admin_notices_global()
1487
-    {
1488
-        $this->_display_no_javascript_warning();
1489
-        $this->_display_espresso_notices();
1490
-    }
1491
-
1492
-
1493
-    public function network_admin_notices_global()
1494
-    {
1495
-        $this->_display_no_javascript_warning();
1496
-        $this->_display_espresso_notices();
1497
-    }
1498
-
1499
-
1500
-    /**
1501
-     * admin_footer_scripts_global
1502
-     * Anything triggered by the 'admin_print_footer_scripts' WP hook should be put in here. This particular method
1503
-     * will apply on ALL EE_Admin pages.
1504
-     *
1505
-     * @return void
1506
-     */
1507
-    public function admin_footer_scripts_global()
1508
-    {
1509
-        $this->_add_admin_page_ajax_loading_img();
1510
-        $this->_add_admin_page_overlay();
1511
-        // if metaboxes are present we need to add the nonce field
1512
-        if (
1513
-            isset($this->_route_config['metaboxes'])
1514
-            || isset($this->_route_config['list_table'])
1515
-            || (isset($this->_route_config['has_metaboxes']) && $this->_route_config['has_metaboxes'])
1516
-        ) {
1517
-            wp_nonce_field('closedpostboxes', 'closedpostboxesnonce', false);
1518
-            wp_nonce_field('meta-box-order', 'meta-box-order-nonce', false);
1519
-        }
1520
-    }
1521
-
1522
-
1523
-    /**
1524
-     * admin_footer_global
1525
-     * Anything triggered by the wp 'admin_footer' wp hook should be put in here. This particular method will apply on
1526
-     * ALL EE_Admin Pages.
1527
-     *
1528
-     * @return void
1529
-     */
1530
-    public function admin_footer_global()
1531
-    {
1532
-        // dialog container for dialog helper
1533
-        echo '
111
+	/**
112
+	 * Used to hold default query args for list table routes to help preserve stickiness of filters for carried out
113
+	 * actions.
114
+	 *
115
+	 * @since 4.6.x
116
+	 * @var array.
117
+	 */
118
+	protected $_default_route_query_args;
119
+
120
+	// set via request page and action args.
121
+	protected $_current_page;
122
+
123
+	protected $_current_view;
124
+
125
+	protected $_current_page_view_url;
126
+
127
+	/**
128
+	 * unprocessed value for the 'action' request param (default '')
129
+	 *
130
+	 * @var string
131
+	 */
132
+	protected $raw_req_action = '';
133
+
134
+	/**
135
+	 * unprocessed value for the 'page' request param (default '')
136
+	 *
137
+	 * @var string
138
+	 */
139
+	protected $raw_req_page = '';
140
+
141
+	/**
142
+	 * sanitized request action (and nonce)
143
+	 *
144
+	 * @var string
145
+	 */
146
+	protected $_req_action = '';
147
+
148
+	/**
149
+	 * sanitized request action nonce
150
+	 *
151
+	 * @var string
152
+	 */
153
+	protected $_req_nonce = '';
154
+
155
+	/**
156
+	 * @var string
157
+	 */
158
+	protected $_search_btn_label = '';
159
+
160
+	/**
161
+	 * @var string
162
+	 */
163
+	protected $_search_box_callback = '';
164
+
165
+	/**
166
+	 * @var WP_Screen
167
+	 */
168
+	protected $_current_screen;
169
+
170
+	// for holding EE_Admin_Hooks object when needed (set via set_hook_object())
171
+	protected $_hook_obj;
172
+
173
+	// for holding incoming request data
174
+	protected $_req_data = [];
175
+
176
+	// yes / no array for admin form fields
177
+	protected $_yes_no_values = [];
178
+
179
+	// some default things shared by all child classes
180
+	protected $_default_espresso_metaboxes;
181
+
182
+	/**
183
+	 * @var EE_Registry
184
+	 */
185
+	protected $EE = null;
186
+
187
+
188
+	/**
189
+	 * This is just a property that flags whether the given route is a caffeinated route or not.
190
+	 *
191
+	 * @var boolean
192
+	 */
193
+	protected $_is_caf = false;
194
+
195
+
196
+	/**
197
+	 * @Constructor
198
+	 * @param bool $routing indicate whether we want to just load the object and handle routing or just load the object.
199
+	 * @throws EE_Error
200
+	 * @throws InvalidArgumentException
201
+	 * @throws ReflectionException
202
+	 * @throws InvalidDataTypeException
203
+	 * @throws InvalidInterfaceException
204
+	 */
205
+	public function __construct($routing = true)
206
+	{
207
+		$this->loader  = LoaderFactory::getLoader();
208
+		$this->request = $this->loader->getShared(RequestInterface::class);
209
+		$this->_routing = $routing;
210
+
211
+		if (strpos($this->_get_dir(), 'caffeinated') !== false) {
212
+			$this->_is_caf = true;
213
+		}
214
+		$this->_yes_no_values = [
215
+			['id' => true, 'text' => esc_html__('Yes', 'event_espresso')],
216
+			['id' => false, 'text' => esc_html__('No', 'event_espresso')],
217
+		];
218
+		// set the _req_data property.
219
+		$this->_req_data = $this->request->requestParams();
220
+		// set initial page props (child method)
221
+		$this->_init_page_props();
222
+		// set global defaults
223
+		$this->_set_defaults();
224
+		// set early because incoming requests could be ajax related and we need to register those hooks.
225
+		$this->_global_ajax_hooks();
226
+		$this->_ajax_hooks();
227
+		// other_page_hooks have to be early too.
228
+		$this->_do_other_page_hooks();
229
+		// set up page dependencies
230
+		$this->_before_page_setup();
231
+		$this->_page_setup();
232
+		// die();
233
+	}
234
+
235
+
236
+	/**
237
+	 * _init_page_props
238
+	 * Child classes use to set at least the following properties:
239
+	 * $page_slug.
240
+	 * $page_label.
241
+	 *
242
+	 * @abstract
243
+	 * @return void
244
+	 */
245
+	abstract protected function _init_page_props();
246
+
247
+
248
+	/**
249
+	 * _ajax_hooks
250
+	 * child classes put all their add_action('wp_ajax_{name_of_hook}') hooks in here.
251
+	 * Note: within the ajax callback methods.
252
+	 *
253
+	 * @abstract
254
+	 * @return void
255
+	 */
256
+	abstract protected function _ajax_hooks();
257
+
258
+
259
+	/**
260
+	 * _define_page_props
261
+	 * child classes define page properties in here.  Must include at least:
262
+	 * $_admin_base_url = base_url for all admin pages
263
+	 * $_admin_page_title = default admin_page_title for admin pages
264
+	 * $_labels = array of default labels for various automatically generated elements:
265
+	 *    array(
266
+	 *        'buttons' => array(
267
+	 *            'add' => esc_html__('label for add new button'),
268
+	 *            'edit' => esc_html__('label for edit button'),
269
+	 *            'delete' => esc_html__('label for delete button')
270
+	 *            )
271
+	 *        )
272
+	 *
273
+	 * @abstract
274
+	 * @return void
275
+	 */
276
+	abstract protected function _define_page_props();
277
+
278
+
279
+	/**
280
+	 * _set_page_routes
281
+	 * child classes use this to define the page routes for all subpages handled by the class.  Page routes are
282
+	 * assigned to a action => method pairs in an array and to the $_page_routes property.  Each page route must also
283
+	 * have a 'default' route. Here's the format
284
+	 * $this->_page_routes = array(
285
+	 *        'default' => array(
286
+	 *            'func' => '_default_method_handling_route',
287
+	 *            'args' => array('array','of','args'),
288
+	 *            'noheader' => true, //add this in if this page route is processed before any headers are loaded (i.e.
289
+	 *            ajax request, backend processing)
290
+	 *            'headers_sent_route'=>'headers_route_reference', //add this if noheader=>true, and you want to load a
291
+	 *            headers route after.  The string you enter here should match the defined route reference for a
292
+	 *            headers sent route.
293
+	 *            'capability' => 'route_capability', //indicate a string for minimum capability required to access
294
+	 *            this route.
295
+	 *            'obj_id' => 10 // if this route has an object id, then this can include it (used for capability
296
+	 *            checks).
297
+	 *        ),
298
+	 *        'insert_item' => '_method_for_handling_insert_item' //this can be used if all we need to have is a
299
+	 *        handling method.
300
+	 *        )
301
+	 * )
302
+	 *
303
+	 * @abstract
304
+	 * @return void
305
+	 */
306
+	abstract protected function _set_page_routes();
307
+
308
+
309
+	/**
310
+	 * _set_page_config
311
+	 * child classes use this to define the _page_config array for all subpages handled by the class. Each key in the
312
+	 * array corresponds to the page_route for the loaded page. Format:
313
+	 * $this->_page_config = array(
314
+	 *        'default' => array(
315
+	 *            'labels' => array(
316
+	 *                'buttons' => array(
317
+	 *                    'add' => esc_html__('label for adding item'),
318
+	 *                    'edit' => esc_html__('label for editing item'),
319
+	 *                    'delete' => esc_html__('label for deleting item')
320
+	 *                ),
321
+	 *                'publishbox' => esc_html__('Localized Title for Publish metabox', 'event_espresso')
322
+	 *            ), //optional an array of custom labels for various automatically generated elements to use on the
323
+	 *            page. If this isn't present then the defaults will be used as set for the $this->_labels in
324
+	 *            _define_page_props() method
325
+	 *            'nav' => array(
326
+	 *                'label' => esc_html__('Label for Tab', 'event_espresso').
327
+	 *                'url' => 'http://someurl', //automatically generated UNLESS you define
328
+	 *                'css_class' => 'css-class', //automatically generated UNLESS you define
329
+	 *                'order' => 10, //required to indicate tab position.
330
+	 *                'persistent' => false //if you want the nav tab to ONLY display when the specific route is
331
+	 *                displayed then add this parameter.
332
+	 *            'list_table' => 'name_of_list_table' //string for list table class to be loaded for this admin_page.
333
+	 *            'metaboxes' => array('metabox1', 'metabox2'), //if present this key indicates we want to load
334
+	 *            metaboxes set for eventespresso admin pages.
335
+	 *            'has_metaboxes' => true, //this boolean flag can simply be used to indicate if the route will have
336
+	 *            metaboxes.  Typically this is used if the 'metaboxes' index is not used because metaboxes are added
337
+	 *            later.  We just use this flag to make sure the necessary js gets enqueued on page load.
338
+	 *            'has_help_popups' => false //defaults(true) //this boolean flag can simply be used to indicate if the
339
+	 *            given route has help popups setup and if it does then we need to make sure thickbox is enqueued.
340
+	 *            'columns' => array(4, 2), //this key triggers the setup of a page that uses columns (metaboxes).  The
341
+	 *            array indicates the max number of columns (4) and the default number of columns on page load (2).
342
+	 *            There is an option in the "screen_options" dropdown that is setup so users can pick what columns they
343
+	 *            want to display.
344
+	 *            'help_tabs' => array( //this is used for adding help tabs to a page
345
+	 *                'tab_id' => array(
346
+	 *                    'title' => 'tab_title',
347
+	 *                    'filename' => 'name_of_file_containing_content', //this is the primary method for setting
348
+	 *                    help tab content.  The fallback if it isn't present is to try a the callback.  Filename
349
+	 *                    should match a file in the admin folder's "help_tabs" dir (ie..
350
+	 *                    events/help_tabs/name_of_file_containing_content.help_tab.php)
351
+	 *                    'callback' => 'callback_method_for_content', //if 'filename' isn't present then system will
352
+	 *                    attempt to use the callback which should match the name of a method in the class
353
+	 *                    ),
354
+	 *                'tab2_id' => array(
355
+	 *                    'title' => 'tab2 title',
356
+	 *                    'filename' => 'file_name_2'
357
+	 *                    'callback' => 'callback_method_for_content',
358
+	 *                 ),
359
+	 *            'help_sidebar' => 'callback_for_sidebar_content', //this is used for setting up the sidebar in the
360
+	 *            help tab area on an admin page. @return void
361
+	 *
362
+	 * @abstract
363
+	 */
364
+	abstract protected function _set_page_config();
365
+
366
+
367
+	/**
368
+	 * _add_screen_options
369
+	 * Child classes can add any extra wp_screen_options within this method using built-in WP functions/methods for
370
+	 * doing so. Note child classes can also define _add_screen_options_($this->_current_view) to limit screen options
371
+	 * to a particular view.
372
+	 *
373
+	 * @link   http://chrismarslender.com/wp-tutorials/wordpress-screen-options-tutorial/
374
+	 *         see also WP_Screen object documents...
375
+	 * @link   http://codex.wordpress.org/Class_Reference/WP_Screen
376
+	 * @abstract
377
+	 * @return void
378
+	 */
379
+	abstract protected function _add_screen_options();
380
+
381
+
382
+	/**
383
+	 * _add_feature_pointers
384
+	 * Child classes should use this method for implementing any "feature pointers" (using built-in WP styling js).
385
+	 * Note child classes can also define _add_feature_pointers_($this->_current_view) to limit screen options to a
386
+	 * particular view. Note: this is just a placeholder for now.  Implementation will come down the road See:
387
+	 * WP_Internal_Pointers class in wp-admin/includes/template.php for example (its a final class so can't be
388
+	 * extended) also see:
389
+	 *
390
+	 * @link   http://eamann.com/tech/wordpress-portland/
391
+	 * @abstract
392
+	 * @return void
393
+	 */
394
+	abstract protected function _add_feature_pointers();
395
+
396
+
397
+	/**
398
+	 * load_scripts_styles
399
+	 * child classes put their wp_enqueue_script and wp_enqueue_style hooks in here for anything they need loaded for
400
+	 * their pages/subpages.  Note this is for all pages/subpages of the system.  You can also load only specific
401
+	 * scripts/styles per view by putting them in a dynamic function in this format
402
+	 * (load_scripts_styles_{$this->_current_view}) which matches your page route (action request arg)
403
+	 *
404
+	 * @abstract
405
+	 * @return void
406
+	 */
407
+	abstract public function load_scripts_styles();
408
+
409
+
410
+	/**
411
+	 * admin_init
412
+	 * Anything that should be set/executed at 'admin_init' WP hook runtime should be put in here.  This will apply to
413
+	 * all pages/views loaded by child class.
414
+	 *
415
+	 * @abstract
416
+	 * @return void
417
+	 */
418
+	abstract public function admin_init();
419
+
420
+
421
+	/**
422
+	 * admin_notices
423
+	 * Anything triggered by the 'admin_notices' WP hook should be put in here.  This particular method will apply to
424
+	 * all pages/views loaded by child class.
425
+	 *
426
+	 * @abstract
427
+	 * @return void
428
+	 */
429
+	abstract public function admin_notices();
430
+
431
+
432
+	/**
433
+	 * admin_footer_scripts
434
+	 * Anything triggered by the 'admin_print_footer_scripts' WP hook should be put in here. This particular method
435
+	 * will apply to all pages/views loaded by child class.
436
+	 *
437
+	 * @return void
438
+	 */
439
+	abstract public function admin_footer_scripts();
440
+
441
+
442
+	/**
443
+	 * admin_footer
444
+	 * anything triggered by the 'admin_footer' WP action hook should be added to here. This particular method will
445
+	 * apply to all pages/views loaded by child class.
446
+	 *
447
+	 * @return void
448
+	 */
449
+	public function admin_footer()
450
+	{
451
+	}
452
+
453
+
454
+	/**
455
+	 * _global_ajax_hooks
456
+	 * all global add_action('wp_ajax_{name_of_hook}') hooks in here.
457
+	 * Note: within the ajax callback methods.
458
+	 *
459
+	 * @abstract
460
+	 * @return void
461
+	 */
462
+	protected function _global_ajax_hooks()
463
+	{
464
+		// for lazy loading of metabox content
465
+		add_action('wp_ajax_espresso-ajax-content', [$this, 'ajax_metabox_content'], 10);
466
+	}
467
+
468
+
469
+	public function ajax_metabox_content()
470
+	{
471
+		$content_id  = $this->request->getRequestParam('contentid', '');
472
+		$content_url = $this->request->getRequestParam('contenturl', '', 'url');
473
+		self::cached_rss_display($content_id, $content_url);
474
+		wp_die();
475
+	}
476
+
477
+
478
+	/**
479
+	 * allows extending classes do something specific before the parent constructor runs _page_setup().
480
+	 *
481
+	 * @return void
482
+	 */
483
+	protected function _before_page_setup()
484
+	{
485
+		// default is to do nothing
486
+	}
487
+
488
+
489
+	/**
490
+	 * Makes sure any things that need to be loaded early get handled.
491
+	 * We also escape early here if the page requested doesn't match the object.
492
+	 *
493
+	 * @final
494
+	 * @return void
495
+	 * @throws EE_Error
496
+	 * @throws InvalidArgumentException
497
+	 * @throws ReflectionException
498
+	 * @throws InvalidDataTypeException
499
+	 * @throws InvalidInterfaceException
500
+	 */
501
+	final protected function _page_setup()
502
+	{
503
+		// requires?
504
+		// admin_init stuff - global - we're setting this REALLY early
505
+		// so if EE_Admin pages have to hook into other WP pages they can.
506
+		// But keep in mind, not everything is available from the EE_Admin Page object at this point.
507
+		add_action('admin_init', [$this, 'admin_init_global'], 5);
508
+		// next verify if we need to load anything...
509
+		$this->_current_page = $this->request->getRequestParam('page', '', 'key');
510
+		$this->page_folder   = strtolower(
511
+			str_replace(['_Admin_Page', 'Extend_'], '', get_class($this))
512
+		);
513
+		global $ee_menu_slugs;
514
+		$ee_menu_slugs = (array) $ee_menu_slugs;
515
+		if (
516
+			! $this->request->isAjax()
517
+			&& (! $this->_current_page || ! isset($ee_menu_slugs[ $this->_current_page ]))
518
+		) {
519
+			return;
520
+		}
521
+		// because WP List tables have two duplicate select inputs for choosing bulk actions,
522
+		// we need to copy the action from the second to the first
523
+		$action     = $this->request->getRequestParam('action', '-1', 'key');
524
+		$action2    = $this->request->getRequestParam('action2', '-1', 'key');
525
+		$action     = $action !== '-1' ? $action : $action2;
526
+		$req_action = $action !== '-1' ? $action : 'default';
527
+
528
+		// if a specific 'route' has been set, and the action is 'default' OR we are doing_ajax
529
+		// then let's use the route as the action.
530
+		// This covers cases where we're coming in from a list table that isn't on the default route.
531
+		$route = $this->request->getRequestParam('route');
532
+		$this->_req_action = $route && ($req_action === 'default' || $this->request->isAjax())
533
+			? $route
534
+			: $req_action;
535
+
536
+		$this->_current_view = $this->_req_action;
537
+		$this->_req_nonce    = $this->_req_action . '_nonce';
538
+		$this->_define_page_props();
539
+		$this->_current_page_view_url = add_query_arg(
540
+			['page' => $this->_current_page, 'action' => $this->_current_view],
541
+			$this->_admin_base_url
542
+		);
543
+		// default things
544
+		$this->_default_espresso_metaboxes = [
545
+			'_espresso_news_post_box',
546
+			'_espresso_links_post_box',
547
+			'_espresso_ratings_request',
548
+			'_espresso_sponsors_post_box',
549
+		];
550
+		// set page configs
551
+		$this->_set_page_routes();
552
+		$this->_set_page_config();
553
+		// let's include any referrer data in our default_query_args for this route for "stickiness".
554
+		if ($this->request->requestParamIsSet('wp_referer')) {
555
+			$wp_referer = $this->request->getRequestParam('wp_referer');
556
+			if ($wp_referer) {
557
+				$this->_default_route_query_args['wp_referer'] = $wp_referer;
558
+			}
559
+		}
560
+		// for caffeinated and other extended functionality.
561
+		//  If there is a _extend_page_config method
562
+		// then let's run that to modify the all the various page configuration arrays
563
+		if (method_exists($this, '_extend_page_config')) {
564
+			$this->_extend_page_config();
565
+		}
566
+		// for CPT and other extended functionality.
567
+		// If there is an _extend_page_config_for_cpt
568
+		// then let's run that to modify all the various page configuration arrays.
569
+		if (method_exists($this, '_extend_page_config_for_cpt')) {
570
+			$this->_extend_page_config_for_cpt();
571
+		}
572
+		// filter routes and page_config so addons can add their stuff. Filtering done per class
573
+		$this->_page_routes = apply_filters(
574
+			'FHEE__' . get_class($this) . '__page_setup__page_routes',
575
+			$this->_page_routes,
576
+			$this
577
+		);
578
+		$this->_page_config = apply_filters(
579
+			'FHEE__' . get_class($this) . '__page_setup__page_config',
580
+			$this->_page_config,
581
+			$this
582
+		);
583
+		// if AHEE__EE_Admin_Page__route_admin_request_$this->_current_view method is present
584
+		// then we call it hooked into the AHEE__EE_Admin_Page__route_admin_request action
585
+		if (method_exists($this, 'AHEE__EE_Admin_Page__route_admin_request_' . $this->_current_view)) {
586
+			add_action(
587
+				'AHEE__EE_Admin_Page__route_admin_request',
588
+				[$this, 'AHEE__EE_Admin_Page__route_admin_request_' . $this->_current_view],
589
+				10,
590
+				2
591
+			);
592
+		}
593
+		// next route only if routing enabled
594
+		if ($this->_routing && ! $this->request->isAjax()) {
595
+			$this->_verify_routes();
596
+			// next let's just check user_access and kill if no access
597
+			$this->check_user_access();
598
+			if ($this->_is_UI_request) {
599
+				// admin_init stuff - global, all views for this page class, specific view
600
+				add_action('admin_init', [$this, 'admin_init'], 10);
601
+				if (method_exists($this, 'admin_init_' . $this->_current_view)) {
602
+					add_action('admin_init', [$this, 'admin_init_' . $this->_current_view], 15);
603
+				}
604
+			} else {
605
+				// hijack regular WP loading and route admin request immediately
606
+				@ini_set('memory_limit', apply_filters('admin_memory_limit', WP_MAX_MEMORY_LIMIT));
607
+				$this->route_admin_request();
608
+			}
609
+		}
610
+	}
611
+
612
+
613
+	/**
614
+	 * Provides a way for related child admin pages to load stuff on the loaded admin page.
615
+	 *
616
+	 * @return void
617
+	 * @throws EE_Error
618
+	 */
619
+	private function _do_other_page_hooks()
620
+	{
621
+		$registered_pages = apply_filters('FHEE_do_other_page_hooks_' . $this->page_slug, []);
622
+		foreach ($registered_pages as $page) {
623
+			// now let's setup the file name and class that should be present
624
+			$classname = str_replace('.class.php', '', $page);
625
+			// autoloaders should take care of loading file
626
+			if (! class_exists($classname)) {
627
+				$error_msg[] = sprintf(
628
+					esc_html__(
629
+						'Something went wrong with loading the %s admin hooks page.',
630
+						'event_espresso'
631
+					),
632
+					$page
633
+				);
634
+				$error_msg[] = $error_msg[0]
635
+							   . "\r\n"
636
+							   . sprintf(
637
+								   esc_html__(
638
+									   'There is no class in place for the %1$s admin hooks page.%2$sMake sure you have %3$s defined. If this is a non-EE-core admin page then you also must have an autoloader in place for your class',
639
+									   'event_espresso'
640
+								   ),
641
+								   $page,
642
+								   '<br />',
643
+								   '<strong>' . $classname . '</strong>'
644
+							   );
645
+				throw new EE_Error(implode('||', $error_msg));
646
+			}
647
+			// notice we are passing the instance of this class to the hook object.
648
+			$this->loader->getShared($classname, [$this]);
649
+		}
650
+	}
651
+
652
+
653
+	/**
654
+	 * @throws ReflectionException
655
+	 * @throws EE_Error
656
+	 */
657
+	public function load_page_dependencies()
658
+	{
659
+		try {
660
+			$this->_load_page_dependencies();
661
+		} catch (EE_Error $e) {
662
+			$e->get_error();
663
+		}
664
+	}
665
+
666
+
667
+	/**
668
+	 * load_page_dependencies
669
+	 * loads things specific to this page class when its loaded.  Really helps with efficiency.
670
+	 *
671
+	 * @return void
672
+	 * @throws DomainException
673
+	 * @throws EE_Error
674
+	 * @throws InvalidArgumentException
675
+	 * @throws InvalidDataTypeException
676
+	 * @throws InvalidInterfaceException
677
+	 */
678
+	protected function _load_page_dependencies()
679
+	{
680
+		// let's set the current_screen and screen options to override what WP set
681
+		$this->_current_screen = get_current_screen();
682
+		// load admin_notices - global, page class, and view specific
683
+		add_action('admin_notices', [$this, 'admin_notices_global'], 5);
684
+		add_action('admin_notices', [$this, 'admin_notices'], 10);
685
+		if (method_exists($this, 'admin_notices_' . $this->_current_view)) {
686
+			add_action('admin_notices', [$this, 'admin_notices_' . $this->_current_view], 15);
687
+		}
688
+		// load network admin_notices - global, page class, and view specific
689
+		add_action('network_admin_notices', [$this, 'network_admin_notices_global'], 5);
690
+		if (method_exists($this, 'network_admin_notices_' . $this->_current_view)) {
691
+			add_action('network_admin_notices', [$this, 'network_admin_notices_' . $this->_current_view]);
692
+		}
693
+		// this will save any per_page screen options if they are present
694
+		$this->_set_per_page_screen_options();
695
+		// setup list table properties
696
+		$this->_set_list_table();
697
+		// child classes can "register" a metabox to be automatically handled via the _page_config array property.
698
+		// However in some cases the metaboxes will need to be added within a route handling callback.
699
+		$this->_add_registered_meta_boxes();
700
+		$this->_add_screen_columns();
701
+		// add screen options - global, page child class, and view specific
702
+		$this->_add_global_screen_options();
703
+		$this->_add_screen_options();
704
+		$add_screen_options = "_add_screen_options_{$this->_current_view}";
705
+		if (method_exists($this, $add_screen_options)) {
706
+			$this->{$add_screen_options}();
707
+		}
708
+		// add help tab(s) - set via page_config and qtips.
709
+		$this->_add_help_tabs();
710
+		$this->_add_qtips();
711
+		// add feature_pointers - global, page child class, and view specific
712
+		$this->_add_feature_pointers();
713
+		$this->_add_global_feature_pointers();
714
+		$add_feature_pointer = "_add_feature_pointer_{$this->_current_view}";
715
+		if (method_exists($this, $add_feature_pointer)) {
716
+			$this->{$add_feature_pointer}();
717
+		}
718
+		// enqueue scripts/styles - global, page class, and view specific
719
+		add_action('admin_enqueue_scripts', [$this, 'load_global_scripts_styles'], 5);
720
+		add_action('admin_enqueue_scripts', [$this, 'load_scripts_styles'], 10);
721
+		if (method_exists($this, "load_scripts_styles_{$this->_current_view}")) {
722
+			add_action('admin_enqueue_scripts', [$this, "load_scripts_styles_{$this->_current_view}"], 15);
723
+		}
724
+		add_action('admin_enqueue_scripts', [$this, 'admin_footer_scripts_eei18n_js_strings'], 100);
725
+		// admin_print_footer_scripts - global, page child class, and view specific.
726
+		// NOTE, despite the name, whenever possible, scripts should NOT be loaded using this.
727
+		// In most cases that's doing_it_wrong().  But adding hidden container elements etc.
728
+		// is a good use case. Notice the late priority we're giving these
729
+		add_action('admin_print_footer_scripts', [$this, 'admin_footer_scripts_global'], 99);
730
+		add_action('admin_print_footer_scripts', [$this, 'admin_footer_scripts'], 100);
731
+		if (method_exists($this, "admin_footer_scripts_{$this->_current_view}")) {
732
+			add_action('admin_print_footer_scripts', [$this, "admin_footer_scripts_{$this->_current_view}"], 101);
733
+		}
734
+		// admin footer scripts
735
+		add_action('admin_footer', [$this, 'admin_footer_global'], 99);
736
+		add_action('admin_footer', [$this, 'admin_footer'], 100);
737
+		if (method_exists($this, "admin_footer_{$this->_current_view}")) {
738
+			add_action('admin_footer', [$this, "admin_footer_{$this->_current_view}"], 101);
739
+		}
740
+		do_action('FHEE__EE_Admin_Page___load_page_dependencies__after_load', $this->page_slug);
741
+		// targeted hook
742
+		do_action(
743
+			"FHEE__EE_Admin_Page___load_page_dependencies__after_load__{$this->page_slug}__{$this->_req_action}"
744
+		);
745
+	}
746
+
747
+
748
+	/**
749
+	 * _set_defaults
750
+	 * This sets some global defaults for class properties.
751
+	 */
752
+	private function _set_defaults()
753
+	{
754
+		$this->_current_screen       = $this->_admin_page_title = $this->_req_action = $this->_req_nonce = null;
755
+		$this->_event                = $this->_template_path = $this->_column_template_path = null;
756
+		$this->_nav_tabs             = $this->_views = $this->_page_routes = [];
757
+		$this->_page_config          = $this->_default_route_query_args = [];
758
+		$this->_default_nav_tab_name = 'overview';
759
+		// init template args
760
+		$this->_template_args = [
761
+			'admin_page_header'  => '',
762
+			'admin_page_content' => '',
763
+			'post_body_content'  => '',
764
+			'before_list_table'  => '',
765
+			'after_list_table'   => '',
766
+		];
767
+	}
768
+
769
+
770
+	/**
771
+	 * route_admin_request
772
+	 *
773
+	 * @return void
774
+	 * @throws InvalidArgumentException
775
+	 * @throws InvalidInterfaceException
776
+	 * @throws InvalidDataTypeException
777
+	 * @throws EE_Error
778
+	 * @throws ReflectionException
779
+	 * @see    _route_admin_request()
780
+	 */
781
+	public function route_admin_request()
782
+	{
783
+		try {
784
+			$this->_route_admin_request();
785
+		} catch (EE_Error $e) {
786
+			$e->get_error();
787
+		}
788
+	}
789
+
790
+
791
+	public function set_wp_page_slug($wp_page_slug)
792
+	{
793
+		$this->_wp_page_slug = $wp_page_slug;
794
+		// if in network admin then we need to append "-network" to the page slug. Why? Because that's how WP rolls...
795
+		if (is_network_admin()) {
796
+			$this->_wp_page_slug .= '-network';
797
+		}
798
+	}
799
+
800
+
801
+	/**
802
+	 * _verify_routes
803
+	 * All this method does is verify the incoming request and make sure that routes exist for it.  We do this early so
804
+	 * we know if we need to drop out.
805
+	 *
806
+	 * @return bool
807
+	 * @throws EE_Error
808
+	 */
809
+	protected function _verify_routes()
810
+	{
811
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
812
+		if (! $this->_current_page && ! $this->request->isAjax()) {
813
+			return false;
814
+		}
815
+		$this->_route = false;
816
+		// check that the page_routes array is not empty
817
+		if (empty($this->_page_routes)) {
818
+			// user error msg
819
+			$error_msg = sprintf(
820
+				esc_html__('No page routes have been set for the %s admin page.', 'event_espresso'),
821
+				$this->_admin_page_title
822
+			);
823
+			// developer error msg
824
+			$error_msg .= '||' . $error_msg
825
+						  . esc_html__(
826
+							  ' Make sure the "set_page_routes()" method exists, and is setting the "_page_routes" array properly.',
827
+							  'event_espresso'
828
+						  );
829
+			throw new EE_Error($error_msg);
830
+		}
831
+		// and that the requested page route exists
832
+		if (array_key_exists($this->_req_action, $this->_page_routes)) {
833
+			$this->_route        = $this->_page_routes[ $this->_req_action ];
834
+			$this->_route_config = isset($this->_page_config[ $this->_req_action ])
835
+				? $this->_page_config[ $this->_req_action ]
836
+				: [];
837
+		} else {
838
+			// user error msg
839
+			$error_msg = sprintf(
840
+				esc_html__(
841
+					'The requested page route does not exist for the %s admin page.',
842
+					'event_espresso'
843
+				),
844
+				$this->_admin_page_title
845
+			);
846
+			// developer error msg
847
+			$error_msg .= '||' . $error_msg
848
+						  . sprintf(
849
+							  esc_html__(
850
+								  ' Create a key in the "_page_routes" array named "%s" and set its value to the appropriate method.',
851
+								  'event_espresso'
852
+							  ),
853
+							  $this->_req_action
854
+						  );
855
+			throw new EE_Error($error_msg);
856
+		}
857
+		// and that a default route exists
858
+		if (! array_key_exists('default', $this->_page_routes)) {
859
+			// user error msg
860
+			$error_msg = sprintf(
861
+				esc_html__(
862
+					'A default page route has not been set for the % admin page.',
863
+					'event_espresso'
864
+				),
865
+				$this->_admin_page_title
866
+			);
867
+			// developer error msg
868
+			$error_msg .= '||' . $error_msg
869
+						  . esc_html__(
870
+							  ' Create a key in the "_page_routes" array named "default" and set its value to your default page method.',
871
+							  'event_espresso'
872
+						  );
873
+			throw new EE_Error($error_msg);
874
+		}
875
+		// first lets' catch if the UI request has EVER been set.
876
+		if ($this->_is_UI_request === null) {
877
+			// lets set if this is a UI request or not.
878
+			$this->_is_UI_request = ! $this->request->getRequestParam('noheader', false, 'bool');
879
+			// wait a minute... we might have a noheader in the route array
880
+			$this->_is_UI_request = ! (
881
+				is_array($this->_route) && isset($this->_route['noheader']) && $this->_route['noheader']
882
+			)
883
+				? $this->_is_UI_request
884
+				: false;
885
+		}
886
+		$this->_set_current_labels();
887
+		return true;
888
+	}
889
+
890
+
891
+	/**
892
+	 * this method simply verifies a given route and makes sure its an actual route available for the loaded page
893
+	 *
894
+	 * @param string $route the route name we're verifying
895
+	 * @return bool we'll throw an exception if this isn't a valid route.
896
+	 * @throws EE_Error
897
+	 */
898
+	protected function _verify_route($route)
899
+	{
900
+		if (array_key_exists($this->_req_action, $this->_page_routes)) {
901
+			return true;
902
+		}
903
+		// user error msg
904
+		$error_msg = sprintf(
905
+			esc_html__('The given page route does not exist for the %s admin page.', 'event_espresso'),
906
+			$this->_admin_page_title
907
+		);
908
+		// developer error msg
909
+		$error_msg .= '||' . $error_msg
910
+					  . sprintf(
911
+						  esc_html__(
912
+							  ' Check the route you are using in your method (%s) and make sure it matches a route set in your "_page_routes" array property',
913
+							  'event_espresso'
914
+						  ),
915
+						  $route
916
+					  );
917
+		throw new EE_Error($error_msg);
918
+	}
919
+
920
+
921
+	/**
922
+	 * perform nonce verification
923
+	 * This method has be encapsulated here so that any ajax requests that bypass normal routes can verify their nonces
924
+	 * using this method (and save retyping!)
925
+	 *
926
+	 * @param string $nonce     The nonce sent
927
+	 * @param string $nonce_ref The nonce reference string (name0)
928
+	 * @return void
929
+	 * @throws EE_Error
930
+	 */
931
+	protected function _verify_nonce($nonce, $nonce_ref)
932
+	{
933
+		// verify nonce against expected value
934
+		if (! wp_verify_nonce($nonce, $nonce_ref)) {
935
+			// these are not the droids you are looking for !!!
936
+			$msg = sprintf(
937
+				esc_html__('%sNonce Fail.%s', 'event_espresso'),
938
+				'<a href="https://www.youtube.com/watch?v=56_S0WeTkzs">',
939
+				'</a>'
940
+			);
941
+			if (WP_DEBUG) {
942
+				$msg .= "\n  ";
943
+				$msg .= sprintf(
944
+					esc_html__(
945
+						'In order to dynamically generate nonces for your actions, use the %s::add_query_args_and_nonce() method. May the Nonce be with you!',
946
+						'event_espresso'
947
+					),
948
+					__CLASS__
949
+				);
950
+			}
951
+			if (! $this->request->isAjax()) {
952
+				wp_die($msg);
953
+			}
954
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
955
+			$this->_return_json();
956
+		}
957
+	}
958
+
959
+
960
+	/**
961
+	 * _route_admin_request()
962
+	 * Meat and potatoes of the class.  Basically, this dude checks out what's being requested and sees if theres are
963
+	 * some doodads to work the magic and handle the flingjangy. Translation:  Checks if the requested action is listed
964
+	 * in the page routes and then will try to load the corresponding method.
965
+	 *
966
+	 * @return void
967
+	 * @throws EE_Error
968
+	 * @throws InvalidArgumentException
969
+	 * @throws InvalidDataTypeException
970
+	 * @throws InvalidInterfaceException
971
+	 * @throws ReflectionException
972
+	 */
973
+	protected function _route_admin_request()
974
+	{
975
+		if (! $this->_is_UI_request) {
976
+			$this->_verify_routes();
977
+		}
978
+		$nonce_check = ! isset($this->_route_config['require_nonce']) || $this->_route_config['require_nonce'];
979
+		if ($this->_req_action !== 'default' && $nonce_check) {
980
+			// set nonce from post data
981
+			$nonce = $this->request->getRequestParam($this->_req_nonce, '');
982
+			$this->_verify_nonce($nonce, $this->_req_nonce);
983
+		}
984
+		// set the nav_tabs array but ONLY if this is  UI_request
985
+		if ($this->_is_UI_request) {
986
+			$this->_set_nav_tabs();
987
+		}
988
+		// grab callback function
989
+		$func = is_array($this->_route) ? $this->_route['func'] : $this->_route;
990
+		// check if callback has args
991
+		$args      = is_array($this->_route) && isset($this->_route['args']) ? $this->_route['args'] : [];
992
+		$error_msg = '';
993
+		// action right before calling route
994
+		// (hook is something like 'AHEE__Registrations_Admin_Page__route_admin_request')
995
+		if (! did_action('AHEE__EE_Admin_Page__route_admin_request')) {
996
+			do_action('AHEE__EE_Admin_Page__route_admin_request', $this->_current_view, $this);
997
+		}
998
+		// right before calling the route, let's clean the _wp_http_referer
999
+		$this->request->setServerParam(
1000
+			'REQUEST_URI',
1001
+			remove_query_arg(
1002
+				'_wp_http_referer',
1003
+				wp_unslash($this->request->getServerParam('REQUEST_URI'))
1004
+			)
1005
+		);
1006
+		if (! empty($func)) {
1007
+			if (is_array($func)) {
1008
+				list($class, $method) = $func;
1009
+			} elseif (strpos($func, '::') !== false) {
1010
+				list($class, $method) = explode('::', $func);
1011
+			} else {
1012
+				$class  = $this;
1013
+				$method = $func;
1014
+			}
1015
+			if (! (is_object($class) && $class === $this)) {
1016
+				// send along this admin page object for access by addons.
1017
+				$args['admin_page_object'] = $this;
1018
+			}
1019
+			if (
1020
+				// is it a method on a class that doesn't work?
1021
+				(
1022
+					(
1023
+						method_exists($class, $method)
1024
+						&& call_user_func_array([$class, $method], $args) === false
1025
+					)
1026
+					&& (
1027
+						// is it a standalone function that doesn't work?
1028
+						function_exists($method)
1029
+						&& call_user_func_array(
1030
+							$func,
1031
+							array_merge(['admin_page_object' => $this], $args)
1032
+						) === false
1033
+					)
1034
+				)
1035
+				|| (
1036
+					// is it neither a class method NOR a standalone function?
1037
+					! method_exists($class, $method)
1038
+					&& ! function_exists($method)
1039
+				)
1040
+			) {
1041
+				// user error msg
1042
+				$error_msg = esc_html__(
1043
+					'An error occurred. The  requested page route could not be found.',
1044
+					'event_espresso'
1045
+				);
1046
+				// developer error msg
1047
+				$error_msg .= '||';
1048
+				$error_msg .= sprintf(
1049
+					esc_html__(
1050
+						'Page route "%s" could not be called. Check that the spelling for method names and actions in the "_page_routes" array are all correct.',
1051
+						'event_espresso'
1052
+					),
1053
+					$method
1054
+				);
1055
+			}
1056
+			if (! empty($error_msg)) {
1057
+				throw new EE_Error($error_msg);
1058
+			}
1059
+		}
1060
+		// if we've routed and this route has a no headers route AND a sent_headers_route,
1061
+		// then we need to reset the routing properties to the new route.
1062
+		// now if UI request is FALSE and noheader is true AND we have a headers_sent_route in the route array then let's set UI_request to true because the no header route has a second func after headers have been sent.
1063
+		if (
1064
+			$this->_is_UI_request === false
1065
+			&& is_array($this->_route)
1066
+			&& ! empty($this->_route['headers_sent_route'])
1067
+		) {
1068
+			$this->_reset_routing_properties($this->_route['headers_sent_route']);
1069
+		}
1070
+	}
1071
+
1072
+
1073
+	/**
1074
+	 * This method just allows the resetting of page properties in the case where a no headers
1075
+	 * route redirects to a headers route in its route config.
1076
+	 *
1077
+	 * @param string $new_route New (non header) route to redirect to.
1078
+	 * @return   void
1079
+	 * @throws ReflectionException
1080
+	 * @throws InvalidArgumentException
1081
+	 * @throws InvalidInterfaceException
1082
+	 * @throws InvalidDataTypeException
1083
+	 * @throws EE_Error
1084
+	 * @since   4.3.0
1085
+	 */
1086
+	protected function _reset_routing_properties($new_route)
1087
+	{
1088
+		$this->_is_UI_request = true;
1089
+		// now we set the current route to whatever the headers_sent_route is set at
1090
+		$this->request->setRequestParam('action', $new_route);
1091
+		// rerun page setup
1092
+		$this->_page_setup();
1093
+	}
1094
+
1095
+
1096
+	/**
1097
+	 * _add_query_arg
1098
+	 * adds nonce to array of arguments then calls WP add_query_arg function
1099
+	 *(internally just uses EEH_URL's function with the same name)
1100
+	 *
1101
+	 * @param array  $args
1102
+	 * @param string $url
1103
+	 * @param bool   $sticky                  if true, then the existing Request params will be appended to the
1104
+	 *                                        generated url in an associative array indexed by the key 'wp_referer';
1105
+	 *                                        Example usage: If the current page is:
1106
+	 *                                        http://mydomain.com/wp-admin/admin.php?page=espresso_registrations
1107
+	 *                                        &action=default&event_id=20&month_range=March%202015
1108
+	 *                                        &_wpnonce=5467821
1109
+	 *                                        and you call:
1110
+	 *                                        EE_Admin_Page::add_query_args_and_nonce(
1111
+	 *                                        array(
1112
+	 *                                        'action' => 'resend_something',
1113
+	 *                                        'page=>espresso_registrations'
1114
+	 *                                        ),
1115
+	 *                                        $some_url,
1116
+	 *                                        true
1117
+	 *                                        );
1118
+	 *                                        It will produce a url in this structure:
1119
+	 *                                        http://{$some_url}/?page=espresso_registrations&action=resend_something
1120
+	 *                                        &wp_referer[action]=default&wp_referer[event_id]=20&wpreferer[
1121
+	 *                                        month_range]=March%202015
1122
+	 * @param bool   $exclude_nonce           If true, the the nonce will be excluded from the generated nonce.
1123
+	 * @return string
1124
+	 */
1125
+	public static function add_query_args_and_nonce(
1126
+		$args = [],
1127
+		$url = false,
1128
+		$sticky = false,
1129
+		$exclude_nonce = false
1130
+	) {
1131
+		// if there is a _wp_http_referer include the values from the request but only if sticky = true
1132
+		if ($sticky) {
1133
+			/** @var RequestInterface $request */
1134
+			$request = LoaderFactory::getLoader()->getShared(RequestInterface::class);
1135
+			$request->unSetRequestParams(['_wp_http_referer', 'wp_referer']);
1136
+			foreach ($request->requestParams() as $key => $value) {
1137
+				// do not add nonces
1138
+				if (strpos($key, 'nonce') !== false) {
1139
+					continue;
1140
+				}
1141
+				$args[ 'wp_referer[' . $key . ']' ] = is_string($value) ? htmlspecialchars($value) : $value;
1142
+			}
1143
+		}
1144
+		return EEH_URL::add_query_args_and_nonce($args, $url, $exclude_nonce);
1145
+	}
1146
+
1147
+
1148
+	/**
1149
+	 * This returns a generated link that will load the related help tab.
1150
+	 *
1151
+	 * @param string $help_tab_id the id for the connected help tab
1152
+	 * @param string $icon_style  (optional) include css class for the style you want to use for the help icon.
1153
+	 * @param string $help_text   (optional) send help text you want to use for the link if default not to be used
1154
+	 * @return string              generated link
1155
+	 * @uses EEH_Template::get_help_tab_link()
1156
+	 */
1157
+	protected function _get_help_tab_link($help_tab_id, $icon_style = '', $help_text = '')
1158
+	{
1159
+		return EEH_Template::get_help_tab_link(
1160
+			$help_tab_id,
1161
+			$this->page_slug,
1162
+			$this->_req_action,
1163
+			$icon_style,
1164
+			$help_text
1165
+		);
1166
+	}
1167
+
1168
+
1169
+	/**
1170
+	 * _add_help_tabs
1171
+	 * Note child classes define their help tabs within the page_config array.
1172
+	 *
1173
+	 * @link   http://codex.wordpress.org/Function_Reference/add_help_tab
1174
+	 * @return void
1175
+	 * @throws DomainException
1176
+	 * @throws EE_Error
1177
+	 */
1178
+	protected function _add_help_tabs()
1179
+	{
1180
+		if (isset($this->_page_config[ $this->_req_action ])) {
1181
+			$config = $this->_page_config[ $this->_req_action ];
1182
+			// let's see if there is a help_sidebar set for the current route and we'll set that up for usage as well.
1183
+			if (is_array($config) && isset($config['help_sidebar'])) {
1184
+				// check that the callback given is valid
1185
+				if (! method_exists($this, $config['help_sidebar'])) {
1186
+					throw new EE_Error(
1187
+						sprintf(
1188
+							esc_html__(
1189
+								'The _page_config array has a callback set for the "help_sidebar" option.  However the callback given (%s) is not a valid callback.  Doublecheck the spelling and make sure this method exists for the class %s',
1190
+								'event_espresso'
1191
+							),
1192
+							$config['help_sidebar'],
1193
+							get_class($this)
1194
+						)
1195
+					);
1196
+				}
1197
+				$content = apply_filters(
1198
+					'FHEE__' . get_class($this) . '__add_help_tabs__help_sidebar',
1199
+					$this->{$config['help_sidebar']}()
1200
+				);
1201
+				$this->_current_screen->set_help_sidebar($content);
1202
+			}
1203
+			if (! isset($config['help_tabs'])) {
1204
+				return;
1205
+			} //no help tabs for this route
1206
+			foreach ((array) $config['help_tabs'] as $tab_id => $cfg) {
1207
+				// we're here so there ARE help tabs!
1208
+				// make sure we've got what we need
1209
+				if (! isset($cfg['title'])) {
1210
+					throw new EE_Error(
1211
+						esc_html__(
1212
+							'The _page_config array is not set up properly for help tabs.  It is missing a title',
1213
+							'event_espresso'
1214
+						)
1215
+					);
1216
+				}
1217
+				if (! isset($cfg['filename']) && ! isset($cfg['callback']) && ! isset($cfg['content'])) {
1218
+					throw new EE_Error(
1219
+						esc_html__(
1220
+							'The _page_config array is not setup properly for help tabs. It is missing a either a filename reference, or a callback reference or a content reference so there is no way to know the content for the help tab',
1221
+							'event_espresso'
1222
+						)
1223
+					);
1224
+				}
1225
+				// first priority goes to content.
1226
+				if (! empty($cfg['content'])) {
1227
+					$content = ! empty($cfg['content']) ? $cfg['content'] : null;
1228
+					// second priority goes to filename
1229
+				} elseif (! empty($cfg['filename'])) {
1230
+					$file_path = $this->_get_dir() . '/help_tabs/' . $cfg['filename'] . '.help_tab.php';
1231
+					// it's possible that the file is located on decaf route (and above sets up for caf route, if this is the case then lets check decaf route too)
1232
+					$file_path = ! is_readable($file_path) ? EE_ADMIN_PAGES
1233
+															 . basename($this->_get_dir())
1234
+															 . '/help_tabs/'
1235
+															 . $cfg['filename']
1236
+															 . '.help_tab.php' : $file_path;
1237
+					// if file is STILL not readable then let's do a EE_Error so its more graceful than a fatal error.
1238
+					if (! isset($cfg['callback']) && ! is_readable($file_path)) {
1239
+						EE_Error::add_error(
1240
+							sprintf(
1241
+								esc_html__(
1242
+									'The filename given for the help tab %s is not a valid file and there is no other configuration for the tab content.  Please check that the string you set for the help tab on this route (%s) is the correct spelling.  The file should be in %s',
1243
+									'event_espresso'
1244
+								),
1245
+								$tab_id,
1246
+								key($config),
1247
+								$file_path
1248
+							),
1249
+							__FILE__,
1250
+							__FUNCTION__,
1251
+							__LINE__
1252
+						);
1253
+						return;
1254
+					}
1255
+					$template_args['admin_page_obj'] = $this;
1256
+					$content                         = EEH_Template::display_template(
1257
+						$file_path,
1258
+						$template_args,
1259
+						true
1260
+					);
1261
+				} else {
1262
+					$content = '';
1263
+				}
1264
+				// check if callback is valid
1265
+				if (
1266
+					empty($content)
1267
+					&& (
1268
+						! isset($cfg['callback']) || ! method_exists($this, $cfg['callback'])
1269
+					)
1270
+				) {
1271
+					EE_Error::add_error(
1272
+						sprintf(
1273
+							esc_html__(
1274
+								'The callback given for a %s help tab on this page does not content OR a corresponding method for generating the content.  Check the spelling or make sure the method is present.',
1275
+								'event_espresso'
1276
+							),
1277
+							$cfg['title']
1278
+						),
1279
+						__FILE__,
1280
+						__FUNCTION__,
1281
+						__LINE__
1282
+					);
1283
+					return;
1284
+				}
1285
+				// setup config array for help tab method
1286
+				$id  = $this->page_slug . '-' . $this->_req_action . '-' . $tab_id;
1287
+				$_ht = [
1288
+					'id'       => $id,
1289
+					'title'    => $cfg['title'],
1290
+					'callback' => isset($cfg['callback']) && empty($content) ? [$this, $cfg['callback']] : null,
1291
+					'content'  => $content,
1292
+				];
1293
+				$this->_current_screen->add_help_tab($_ht);
1294
+			}
1295
+		}
1296
+	}
1297
+
1298
+
1299
+	/**
1300
+	 * This simply sets up any qtips that have been defined in the page config
1301
+	 *
1302
+	 * @return void
1303
+	 */
1304
+	protected function _add_qtips()
1305
+	{
1306
+		if (isset($this->_route_config['qtips'])) {
1307
+			$qtips = (array) $this->_route_config['qtips'];
1308
+			// load qtip loader
1309
+			$path = [
1310
+				$this->_get_dir() . '/qtips/',
1311
+				EE_ADMIN_PAGES . basename($this->_get_dir()) . '/qtips/',
1312
+			];
1313
+			EEH_Qtip_Loader::instance()->register($qtips, $path);
1314
+		}
1315
+	}
1316
+
1317
+
1318
+	/**
1319
+	 * _set_nav_tabs
1320
+	 * This sets up the nav tabs from the page_routes array.  This method can be overwritten by child classes if you
1321
+	 * wish to add additional tabs or modify accordingly.
1322
+	 *
1323
+	 * @return void
1324
+	 * @throws InvalidArgumentException
1325
+	 * @throws InvalidInterfaceException
1326
+	 * @throws InvalidDataTypeException
1327
+	 */
1328
+	protected function _set_nav_tabs()
1329
+	{
1330
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1331
+		$i = 0;
1332
+		foreach ($this->_page_config as $slug => $config) {
1333
+			if (! is_array($config) || empty($config['nav'])) {
1334
+				continue;
1335
+			}
1336
+			// no nav tab for this config
1337
+			// check for persistent flag
1338
+			if ($slug !== $this->_req_action && isset($config['nav']['persistent']) && ! $config['nav']['persistent']) {
1339
+				// nav tab is only to appear when route requested.
1340
+				continue;
1341
+			}
1342
+			if (! $this->check_user_access($slug, true)) {
1343
+				// no nav tab because current user does not have access.
1344
+				continue;
1345
+			}
1346
+			$css_class                = isset($config['css_class']) ? $config['css_class'] . ' ' : '';
1347
+			$this->_nav_tabs[ $slug ] = [
1348
+				'url'       => isset($config['nav']['url'])
1349
+					? $config['nav']['url']
1350
+					: self::add_query_args_and_nonce(
1351
+						['action' => $slug],
1352
+						$this->_admin_base_url
1353
+					),
1354
+				'link_text' => isset($config['nav']['label'])
1355
+					? $config['nav']['label']
1356
+					: ucwords(
1357
+						str_replace('_', ' ', $slug)
1358
+					),
1359
+				'css_class' => $this->_req_action === $slug ? $css_class . 'nav-tab-active' : $css_class,
1360
+				'order'     => isset($config['nav']['order']) ? $config['nav']['order'] : $i,
1361
+			];
1362
+			$i++;
1363
+		}
1364
+		// if $this->_nav_tabs is empty then lets set the default
1365
+		if (empty($this->_nav_tabs)) {
1366
+			$this->_nav_tabs[ $this->_default_nav_tab_name ] = [
1367
+				'url'       => $this->_admin_base_url,
1368
+				'link_text' => ucwords(str_replace('_', ' ', $this->_default_nav_tab_name)),
1369
+				'css_class' => 'nav-tab-active',
1370
+				'order'     => 10,
1371
+			];
1372
+		}
1373
+		// now let's sort the tabs according to order
1374
+		usort($this->_nav_tabs, [$this, '_sort_nav_tabs']);
1375
+	}
1376
+
1377
+
1378
+	/**
1379
+	 * _set_current_labels
1380
+	 * This method modifies the _labels property with any optional specific labels indicated in the _page_routes
1381
+	 * property array
1382
+	 *
1383
+	 * @return void
1384
+	 */
1385
+	private function _set_current_labels()
1386
+	{
1387
+		if (is_array($this->_route_config) && isset($this->_route_config['labels'])) {
1388
+			foreach ($this->_route_config['labels'] as $label => $text) {
1389
+				if (is_array($text)) {
1390
+					foreach ($text as $sublabel => $subtext) {
1391
+						$this->_labels[ $label ][ $sublabel ] = $subtext;
1392
+					}
1393
+				} else {
1394
+					$this->_labels[ $label ] = $text;
1395
+				}
1396
+			}
1397
+		}
1398
+	}
1399
+
1400
+
1401
+	/**
1402
+	 *        verifies user access for this admin page
1403
+	 *
1404
+	 * @param string $route_to_check if present then the capability for the route matching this string is checked.
1405
+	 * @param bool   $verify_only    Default is FALSE which means if user check fails then wp_die().  Otherwise just
1406
+	 *                               return false if verify fail.
1407
+	 * @return bool
1408
+	 * @throws InvalidArgumentException
1409
+	 * @throws InvalidDataTypeException
1410
+	 * @throws InvalidInterfaceException
1411
+	 */
1412
+	public function check_user_access($route_to_check = '', $verify_only = false)
1413
+	{
1414
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1415
+		$route_to_check = empty($route_to_check) ? $this->_req_action : $route_to_check;
1416
+		$capability     = ! empty($route_to_check) && isset($this->_page_routes[ $route_to_check ])
1417
+						  && is_array(
1418
+							  $this->_page_routes[ $route_to_check ]
1419
+						  )
1420
+						  && ! empty($this->_page_routes[ $route_to_check ]['capability'])
1421
+			? $this->_page_routes[ $route_to_check ]['capability'] : null;
1422
+		if (empty($capability) && empty($route_to_check)) {
1423
+			$capability = is_array($this->_route) && empty($this->_route['capability']) ? 'manage_options'
1424
+				: $this->_route['capability'];
1425
+		} else {
1426
+			$capability = empty($capability) ? 'manage_options' : $capability;
1427
+		}
1428
+		$id = is_array($this->_route) && ! empty($this->_route['obj_id']) ? $this->_route['obj_id'] : 0;
1429
+		if (
1430
+			! $this->request->isAjax()
1431
+			&& (
1432
+				! function_exists('is_admin')
1433
+				|| ! EE_Registry::instance()->CAP->current_user_can(
1434
+					$capability,
1435
+					$this->page_slug
1436
+					. '_'
1437
+					. $route_to_check,
1438
+					$id
1439
+				)
1440
+			)
1441
+		) {
1442
+			if ($verify_only) {
1443
+				return false;
1444
+			}
1445
+			if (is_user_logged_in()) {
1446
+				wp_die(esc_html__('You do not have access to this route.', 'event_espresso'));
1447
+			} else {
1448
+				return false;
1449
+			}
1450
+		}
1451
+		return true;
1452
+	}
1453
+
1454
+
1455
+	/**
1456
+	 * admin_init_global
1457
+	 * This runs all the code that we want executed within the WP admin_init hook.
1458
+	 * This method executes for ALL EE Admin pages.
1459
+	 *
1460
+	 * @return void
1461
+	 */
1462
+	public function admin_init_global()
1463
+	{
1464
+	}
1465
+
1466
+
1467
+	/**
1468
+	 * wp_loaded_global
1469
+	 * This runs all the code that we want executed within the WP wp_loaded hook.  This method is optional for an
1470
+	 * EE_Admin page and will execute on every EE Admin Page load
1471
+	 *
1472
+	 * @return void
1473
+	 */
1474
+	public function wp_loaded()
1475
+	{
1476
+	}
1477
+
1478
+
1479
+	/**
1480
+	 * admin_notices
1481
+	 * Anything triggered by the 'admin_notices' WP hook should be put in here.  This particular method will apply on
1482
+	 * ALL EE_Admin pages.
1483
+	 *
1484
+	 * @return void
1485
+	 */
1486
+	public function admin_notices_global()
1487
+	{
1488
+		$this->_display_no_javascript_warning();
1489
+		$this->_display_espresso_notices();
1490
+	}
1491
+
1492
+
1493
+	public function network_admin_notices_global()
1494
+	{
1495
+		$this->_display_no_javascript_warning();
1496
+		$this->_display_espresso_notices();
1497
+	}
1498
+
1499
+
1500
+	/**
1501
+	 * admin_footer_scripts_global
1502
+	 * Anything triggered by the 'admin_print_footer_scripts' WP hook should be put in here. This particular method
1503
+	 * will apply on ALL EE_Admin pages.
1504
+	 *
1505
+	 * @return void
1506
+	 */
1507
+	public function admin_footer_scripts_global()
1508
+	{
1509
+		$this->_add_admin_page_ajax_loading_img();
1510
+		$this->_add_admin_page_overlay();
1511
+		// if metaboxes are present we need to add the nonce field
1512
+		if (
1513
+			isset($this->_route_config['metaboxes'])
1514
+			|| isset($this->_route_config['list_table'])
1515
+			|| (isset($this->_route_config['has_metaboxes']) && $this->_route_config['has_metaboxes'])
1516
+		) {
1517
+			wp_nonce_field('closedpostboxes', 'closedpostboxesnonce', false);
1518
+			wp_nonce_field('meta-box-order', 'meta-box-order-nonce', false);
1519
+		}
1520
+	}
1521
+
1522
+
1523
+	/**
1524
+	 * admin_footer_global
1525
+	 * Anything triggered by the wp 'admin_footer' wp hook should be put in here. This particular method will apply on
1526
+	 * ALL EE_Admin Pages.
1527
+	 *
1528
+	 * @return void
1529
+	 */
1530
+	public function admin_footer_global()
1531
+	{
1532
+		// dialog container for dialog helper
1533
+		echo '
1534 1534
         <div class="ee-admin-dialog-container auto-hide hidden">
1535 1535
             <div class="ee-notices"></div>
1536 1536
             <div class="ee-admin-dialog-container-inner-content"></div>
1537 1537
         </div>
1538 1538
         ';
1539 1539
 
1540
-        // current set timezone for timezone js
1541
-        echo '<span id="current_timezone" class="hidden">' . esc_html(EEH_DTT_Helper::get_timezone()) . '</span>';
1542
-    }
1543
-
1544
-
1545
-    /**
1546
-     * This function sees if there is a method for help popup content existing for the given route.  If there is then
1547
-     * we'll use the retrieved array to output the content using the template. For child classes: If you want to have
1548
-     * help popups then in your templates or your content you set "triggers" for the content using the
1549
-     * "_set_help_trigger('help_trigger_id')" where "help_trigger_id" is what you will use later in your custom method
1550
-     * for the help popup content on that page. Then in your Child_Admin_Page class you need to define a help popup
1551
-     * method for the content in the format "_help_popup_content_{route_name}()"  So if you are setting help content
1552
-     * for the
1553
-     * 'edit_event' route you should have a method named "_help_popup_content_edit_route". In your defined
1554
-     * "help_popup_content_..." method.  You must prepare and return an array in the following format array(
1555
-     *    'help_trigger_id' => array(
1556
-     *        'title' => esc_html__('localized title for popup', 'event_espresso'),
1557
-     *        'content' => esc_html__('localized content for popup', 'event_espresso')
1558
-     *    )
1559
-     * );
1560
-     * Then the EE_Admin_Parent will take care of making sure that is setup properly on the correct route.
1561
-     *
1562
-     * @param array $help_array
1563
-     * @param bool  $display
1564
-     * @return string content
1565
-     * @throws DomainException
1566
-     * @throws EE_Error
1567
-     */
1568
-    protected function _set_help_popup_content($help_array = [], $display = false)
1569
-    {
1570
-        $content    = '';
1571
-        $help_array = empty($help_array) ? $this->_get_help_content() : $help_array;
1572
-        // loop through the array and setup content
1573
-        foreach ($help_array as $trigger => $help) {
1574
-            // make sure the array is setup properly
1575
-            if (! isset($help['title']) || ! isset($help['content'])) {
1576
-                throw new EE_Error(
1577
-                    esc_html__(
1578
-                        'Does not look like the popup content array has been setup correctly.  Might want to double check that.  Read the comments for the _get_help_popup_content method found in "EE_Admin_Page" class',
1579
-                        'event_espresso'
1580
-                    )
1581
-                );
1582
-            }
1583
-            // we're good so let's setup the template vars and then assign parsed template content to our content.
1584
-            $template_args = [
1585
-                'help_popup_id'      => $trigger,
1586
-                'help_popup_title'   => $help['title'],
1587
-                'help_popup_content' => $help['content'],
1588
-            ];
1589
-            $content       .= EEH_Template::display_template(
1590
-                EE_ADMIN_TEMPLATE . 'admin_help_popup.template.php',
1591
-                $template_args,
1592
-                true
1593
-            );
1594
-        }
1595
-        if ($display) {
1596
-            echo wp_kses($content, AllowedTags::getWithFormTags());
1597
-            return '';
1598
-        }
1599
-        return $content;
1600
-    }
1601
-
1602
-
1603
-    /**
1604
-     * All this does is retrieve the help content array if set by the EE_Admin_Page child
1605
-     *
1606
-     * @return array properly formatted array for help popup content
1607
-     * @throws EE_Error
1608
-     */
1609
-    private function _get_help_content()
1610
-    {
1611
-        // what is the method we're looking for?
1612
-        $method_name = '_help_popup_content_' . $this->_req_action;
1613
-        // if method doesn't exist let's get out.
1614
-        if (! method_exists($this, $method_name)) {
1615
-            return [];
1616
-        }
1617
-        // k we're good to go let's retrieve the help array
1618
-        $help_array = call_user_func([$this, $method_name]);
1619
-        // make sure we've got an array!
1620
-        if (! is_array($help_array)) {
1621
-            throw new EE_Error(
1622
-                esc_html__(
1623
-                    'Something went wrong with help popup content generation. Expecting an array and well, this ain\'t no array bub.',
1624
-                    'event_espresso'
1625
-                )
1626
-            );
1627
-        }
1628
-        return $help_array;
1629
-    }
1630
-
1631
-
1632
-    /**
1633
-     * EE Admin Pages can use this to set a properly formatted trigger for a help popup.
1634
-     * By default the trigger html is printed.  Otherwise it can be returned if the $display flag is set "false"
1635
-     * See comments made on the _set_help_content method for understanding other parts to the help popup tool.
1636
-     *
1637
-     * @param string  $trigger_id reference for retrieving the trigger content for the popup
1638
-     * @param boolean $display    if false then we return the trigger string
1639
-     * @param array   $dimensions an array of dimensions for the box (array(h,w))
1640
-     * @return string
1641
-     * @throws DomainException
1642
-     * @throws EE_Error
1643
-     */
1644
-    protected function _set_help_trigger($trigger_id, $display = true, $dimensions = ['400', '640'])
1645
-    {
1646
-        if ($this->request->isAjax()) {
1647
-            return '';
1648
-        }
1649
-        // let's check and see if there is any content set for this popup.  If there isn't then we'll include a default title and content so that developers know something needs to be corrected
1650
-        $help_array   = $this->_get_help_content();
1651
-        $help_content = '';
1652
-        if (empty($help_array) || ! isset($help_array[ $trigger_id ])) {
1653
-            $help_array[ $trigger_id ] = [
1654
-                'title'   => esc_html__('Missing Content', 'event_espresso'),
1655
-                'content' => esc_html__(
1656
-                    'A trigger has been set that doesn\'t have any corresponding content. Make sure you have set the help content. (see the "_set_help_popup_content" method in the EE_Admin_Page for instructions.)',
1657
-                    'event_espresso'
1658
-                ),
1659
-            ];
1660
-            $help_content              = $this->_set_help_popup_content($help_array);
1661
-        }
1662
-        // let's setup the trigger
1663
-        $content = '<a class="ee-dialog" href="?height='
1664
-                   . esc_attr($dimensions[0])
1665
-                   . '&width='
1666
-                   . esc_attr($dimensions[1])
1667
-                   . '&inlineId='
1668
-                   . esc_attr($trigger_id)
1669
-                   . '" target="_blank"><span class="question ee-help-popup-question"></span></a>';
1670
-        $content .= $help_content;
1671
-        if ($display) {
1672
-            echo wp_kses($content, AllowedTags::getWithFormTags());
1673
-            return '';
1674
-        }
1675
-        return $content;
1676
-    }
1677
-
1678
-
1679
-    /**
1680
-     * _add_global_screen_options
1681
-     * Add any extra wp_screen_options within this method using built-in WP functions/methods for doing so.
1682
-     * This particular method will add_screen_options on ALL EE_Admin Pages
1683
-     *
1684
-     * @link   http://chrismarslender.com/wp-tutorials/wordpress-screen-options-tutorial/
1685
-     *         see also WP_Screen object documents...
1686
-     * @link   http://codex.wordpress.org/Class_Reference/WP_Screen
1687
-     * @abstract
1688
-     * @return void
1689
-     */
1690
-    private function _add_global_screen_options()
1691
-    {
1692
-    }
1693
-
1694
-
1695
-    /**
1696
-     * _add_global_feature_pointers
1697
-     * This method is used for implementing any "feature pointers" (using built-in WP styling js).
1698
-     * This particular method will implement feature pointers for ALL EE_Admin pages.
1699
-     * Note: this is just a placeholder for now.  Implementation will come down the road
1700
-     *
1701
-     * @see    WP_Internal_Pointers class in wp-admin/includes/template.php for example (its a final class so can't be
1702
-     *         extended) also see:
1703
-     * @link   http://eamann.com/tech/wordpress-portland/
1704
-     * @abstract
1705
-     * @return void
1706
-     */
1707
-    private function _add_global_feature_pointers()
1708
-    {
1709
-    }
1710
-
1711
-
1712
-    /**
1713
-     * load_global_scripts_styles
1714
-     * The scripts and styles enqueued in here will be loaded on every EE Admin page
1715
-     *
1716
-     * @return void
1717
-     */
1718
-    public function load_global_scripts_styles()
1719
-    {
1720
-        /** STYLES **/
1721
-        // add debugging styles
1722
-        if (WP_DEBUG) {
1723
-            add_action('admin_head', [$this, 'add_xdebug_style']);
1724
-        }
1725
-        // register all styles
1726
-        wp_register_style(
1727
-            'espresso-ui-theme',
1728
-            EE_GLOBAL_ASSETS_URL . 'css/espresso-ui-theme/jquery-ui-1.10.3.custom.min.css',
1729
-            [],
1730
-            EVENT_ESPRESSO_VERSION
1731
-        );
1732
-        wp_register_style('ee-admin-css', EE_ADMIN_URL . 'assets/ee-admin-page.css', [], EVENT_ESPRESSO_VERSION);
1733
-        // helpers styles
1734
-        wp_register_style(
1735
-            'ee-text-links',
1736
-            EE_PLUGIN_DIR_URL . 'core/helpers/assets/ee_text_list_helper.css',
1737
-            [],
1738
-            EVENT_ESPRESSO_VERSION
1739
-        );
1740
-        /** SCRIPTS **/
1741
-        // register all scripts
1742
-        wp_register_script(
1743
-            'ee-dialog',
1744
-            EE_ADMIN_URL . 'assets/ee-dialog-helper.js',
1745
-            ['jquery', 'jquery-ui-draggable'],
1746
-            EVENT_ESPRESSO_VERSION,
1747
-            true
1748
-        );
1749
-        wp_register_script(
1750
-            'ee_admin_js',
1751
-            EE_ADMIN_URL . 'assets/ee-admin-page.js',
1752
-            ['espresso_core', 'ee-parse-uri', 'ee-dialog'],
1753
-            EVENT_ESPRESSO_VERSION,
1754
-            true
1755
-        );
1756
-        wp_register_script(
1757
-            'jquery-ui-timepicker-addon',
1758
-            EE_GLOBAL_ASSETS_URL . 'scripts/jquery-ui-timepicker-addon.js',
1759
-            ['jquery-ui-datepicker', 'jquery-ui-slider'],
1760
-            EVENT_ESPRESSO_VERSION,
1761
-            true
1762
-        );
1763
-        // script for sorting tables
1764
-        wp_register_script(
1765
-            'espresso_ajax_table_sorting',
1766
-            EE_ADMIN_URL . 'assets/espresso_ajax_table_sorting.js',
1767
-            ['ee_admin_js', 'jquery-ui-sortable'],
1768
-            EVENT_ESPRESSO_VERSION,
1769
-            true
1770
-        );
1771
-        // script for parsing uri's
1772
-        wp_register_script(
1773
-            'ee-parse-uri',
1774
-            EE_GLOBAL_ASSETS_URL . 'scripts/parseuri.js',
1775
-            [],
1776
-            EVENT_ESPRESSO_VERSION,
1777
-            true
1778
-        );
1779
-        // and parsing associative serialized form elements
1780
-        wp_register_script(
1781
-            'ee-serialize-full-array',
1782
-            EE_GLOBAL_ASSETS_URL . 'scripts/jquery.serializefullarray.js',
1783
-            ['jquery'],
1784
-            EVENT_ESPRESSO_VERSION,
1785
-            true
1786
-        );
1787
-        // helpers scripts
1788
-        wp_register_script(
1789
-            'ee-text-links',
1790
-            EE_PLUGIN_DIR_URL . 'core/helpers/assets/ee_text_list_helper.js',
1791
-            ['jquery'],
1792
-            EVENT_ESPRESSO_VERSION,
1793
-            true
1794
-        );
1795
-        wp_register_script(
1796
-            'ee-moment-core',
1797
-            EE_THIRD_PARTY_URL . 'moment/moment-with-locales.min.js',
1798
-            [],
1799
-            EVENT_ESPRESSO_VERSION,
1800
-            true
1801
-        );
1802
-        wp_register_script(
1803
-            'ee-moment',
1804
-            EE_THIRD_PARTY_URL . 'moment/moment-timezone-with-data.min.js',
1805
-            ['ee-moment-core'],
1806
-            EVENT_ESPRESSO_VERSION,
1807
-            true
1808
-        );
1809
-        wp_register_script(
1810
-            'ee-datepicker',
1811
-            EE_ADMIN_URL . 'assets/ee-datepicker.js',
1812
-            ['jquery-ui-timepicker-addon', 'ee-moment'],
1813
-            EVENT_ESPRESSO_VERSION,
1814
-            true
1815
-        );
1816
-        // google charts
1817
-        wp_register_script(
1818
-            'google-charts',
1819
-            'https://www.gstatic.com/charts/loader.js',
1820
-            [],
1821
-            EVENT_ESPRESSO_VERSION
1822
-        );
1823
-        // ENQUEUE ALL BASICS BY DEFAULT
1824
-        wp_enqueue_style('ee-admin-css');
1825
-        wp_enqueue_script('ee_admin_js');
1826
-        wp_enqueue_script('ee-accounting');
1827
-        wp_enqueue_script('jquery-validate');
1828
-        // taking care of metaboxes
1829
-        if (
1830
-            empty($this->_cpt_route)
1831
-            && (isset($this->_route_config['metaboxes']) || isset($this->_route_config['has_metaboxes']))
1832
-        ) {
1833
-            wp_enqueue_script('dashboard');
1834
-        }
1835
-        // LOCALIZED DATA
1836
-        // localize script for ajax lazy loading
1837
-        $lazy_loader_container_ids = apply_filters(
1838
-            'FHEE__EE_Admin_Page_Core__load_global_scripts_styles__loader_containers',
1839
-            ['espresso_news_post_box_content']
1840
-        );
1841
-        wp_localize_script('ee_admin_js', 'eeLazyLoadingContainers', $lazy_loader_container_ids);
1842
-        add_filter(
1843
-            'admin_body_class',
1844
-            function ($classes) {
1845
-                if (strpos($classes, 'espresso-admin') === false) {
1846
-                    $classes .= ' espresso-admin';
1847
-                }
1848
-                return $classes;
1849
-            }
1850
-        );
1851
-    }
1852
-
1853
-
1854
-    /**
1855
-     *        admin_footer_scripts_eei18n_js_strings
1856
-     *
1857
-     * @return        void
1858
-     */
1859
-    public function admin_footer_scripts_eei18n_js_strings()
1860
-    {
1861
-        EE_Registry::$i18n_js_strings['ajax_url']       = WP_AJAX_URL;
1862
-        EE_Registry::$i18n_js_strings['confirm_delete'] = wp_strip_all_tags(
1863
-            __(
1864
-                'Are you absolutely sure you want to delete this item?\nThis action will delete ALL DATA associated with this item!!!\nThis can NOT be undone!!!',
1865
-                'event_espresso'
1866
-            )
1867
-        );
1868
-        EE_Registry::$i18n_js_strings['January']        = wp_strip_all_tags(__('January', 'event_espresso'));
1869
-        EE_Registry::$i18n_js_strings['February']       = wp_strip_all_tags(__('February', 'event_espresso'));
1870
-        EE_Registry::$i18n_js_strings['March']          = wp_strip_all_tags(__('March', 'event_espresso'));
1871
-        EE_Registry::$i18n_js_strings['April']          = wp_strip_all_tags(__('April', 'event_espresso'));
1872
-        EE_Registry::$i18n_js_strings['May']            = wp_strip_all_tags(__('May', 'event_espresso'));
1873
-        EE_Registry::$i18n_js_strings['June']           = wp_strip_all_tags(__('June', 'event_espresso'));
1874
-        EE_Registry::$i18n_js_strings['July']           = wp_strip_all_tags(__('July', 'event_espresso'));
1875
-        EE_Registry::$i18n_js_strings['August']         = wp_strip_all_tags(__('August', 'event_espresso'));
1876
-        EE_Registry::$i18n_js_strings['September']      = wp_strip_all_tags(__('September', 'event_espresso'));
1877
-        EE_Registry::$i18n_js_strings['October']        = wp_strip_all_tags(__('October', 'event_espresso'));
1878
-        EE_Registry::$i18n_js_strings['November']       = wp_strip_all_tags(__('November', 'event_espresso'));
1879
-        EE_Registry::$i18n_js_strings['December']       = wp_strip_all_tags(__('December', 'event_espresso'));
1880
-        EE_Registry::$i18n_js_strings['Jan']            = wp_strip_all_tags(__('Jan', 'event_espresso'));
1881
-        EE_Registry::$i18n_js_strings['Feb']            = wp_strip_all_tags(__('Feb', 'event_espresso'));
1882
-        EE_Registry::$i18n_js_strings['Mar']            = wp_strip_all_tags(__('Mar', 'event_espresso'));
1883
-        EE_Registry::$i18n_js_strings['Apr']            = wp_strip_all_tags(__('Apr', 'event_espresso'));
1884
-        EE_Registry::$i18n_js_strings['May']            = wp_strip_all_tags(__('May', 'event_espresso'));
1885
-        EE_Registry::$i18n_js_strings['Jun']            = wp_strip_all_tags(__('Jun', 'event_espresso'));
1886
-        EE_Registry::$i18n_js_strings['Jul']            = wp_strip_all_tags(__('Jul', 'event_espresso'));
1887
-        EE_Registry::$i18n_js_strings['Aug']            = wp_strip_all_tags(__('Aug', 'event_espresso'));
1888
-        EE_Registry::$i18n_js_strings['Sep']            = wp_strip_all_tags(__('Sep', 'event_espresso'));
1889
-        EE_Registry::$i18n_js_strings['Oct']            = wp_strip_all_tags(__('Oct', 'event_espresso'));
1890
-        EE_Registry::$i18n_js_strings['Nov']            = wp_strip_all_tags(__('Nov', 'event_espresso'));
1891
-        EE_Registry::$i18n_js_strings['Dec']            = wp_strip_all_tags(__('Dec', 'event_espresso'));
1892
-        EE_Registry::$i18n_js_strings['Sunday']         = wp_strip_all_tags(__('Sunday', 'event_espresso'));
1893
-        EE_Registry::$i18n_js_strings['Monday']         = wp_strip_all_tags(__('Monday', 'event_espresso'));
1894
-        EE_Registry::$i18n_js_strings['Tuesday']        = wp_strip_all_tags(__('Tuesday', 'event_espresso'));
1895
-        EE_Registry::$i18n_js_strings['Wednesday']      = wp_strip_all_tags(__('Wednesday', 'event_espresso'));
1896
-        EE_Registry::$i18n_js_strings['Thursday']       = wp_strip_all_tags(__('Thursday', 'event_espresso'));
1897
-        EE_Registry::$i18n_js_strings['Friday']         = wp_strip_all_tags(__('Friday', 'event_espresso'));
1898
-        EE_Registry::$i18n_js_strings['Saturday']       = wp_strip_all_tags(__('Saturday', 'event_espresso'));
1899
-        EE_Registry::$i18n_js_strings['Sun']            = wp_strip_all_tags(__('Sun', 'event_espresso'));
1900
-        EE_Registry::$i18n_js_strings['Mon']            = wp_strip_all_tags(__('Mon', 'event_espresso'));
1901
-        EE_Registry::$i18n_js_strings['Tue']            = wp_strip_all_tags(__('Tue', 'event_espresso'));
1902
-        EE_Registry::$i18n_js_strings['Wed']            = wp_strip_all_tags(__('Wed', 'event_espresso'));
1903
-        EE_Registry::$i18n_js_strings['Thu']            = wp_strip_all_tags(__('Thu', 'event_espresso'));
1904
-        EE_Registry::$i18n_js_strings['Fri']            = wp_strip_all_tags(__('Fri', 'event_espresso'));
1905
-        EE_Registry::$i18n_js_strings['Sat']            = wp_strip_all_tags(__('Sat', 'event_espresso'));
1906
-    }
1907
-
1908
-
1909
-    /**
1910
-     *        load enhanced xdebug styles for ppl with failing eyesight
1911
-     *
1912
-     * @return        void
1913
-     */
1914
-    public function add_xdebug_style()
1915
-    {
1916
-        echo '<style>.xdebug-error { font-size:1.5em; }</style>';
1917
-    }
1918
-
1919
-
1920
-    /************************/
1921
-    /** LIST TABLE METHODS **/
1922
-    /************************/
1923
-    /**
1924
-     * this sets up the list table if the current view requires it.
1925
-     *
1926
-     * @return void
1927
-     * @throws EE_Error
1928
-     */
1929
-    protected function _set_list_table()
1930
-    {
1931
-        // first is this a list_table view?
1932
-        if (! isset($this->_route_config['list_table'])) {
1933
-            return;
1934
-        } //not a list_table view so get out.
1935
-        // list table functions are per view specific (because some admin pages might have more than one list table!)
1936
-        $list_table_view = '_set_list_table_views_' . $this->_req_action;
1937
-        if (! method_exists($this, $list_table_view) || $this->{$list_table_view}() === false) {
1938
-            // user error msg
1939
-            $error_msg = esc_html__(
1940
-                'An error occurred. The requested list table views could not be found.',
1941
-                'event_espresso'
1942
-            );
1943
-            // developer error msg
1944
-            $error_msg .= '||'
1945
-                          . sprintf(
1946
-                              esc_html__(
1947
-                                  'List table views for "%s" route could not be setup. Check that you have the corresponding method, "%s" set up for defining list_table_views for this route.',
1948
-                                  'event_espresso'
1949
-                              ),
1950
-                              $this->_req_action,
1951
-                              $list_table_view
1952
-                          );
1953
-            throw new EE_Error($error_msg);
1954
-        }
1955
-        // let's provide the ability to filter the views per PAGE AND ROUTE, per PAGE, and globally
1956
-        $this->_views = apply_filters(
1957
-            'FHEE_list_table_views_' . $this->page_slug . '_' . $this->_req_action,
1958
-            $this->_views
1959
-        );
1960
-        $this->_views = apply_filters('FHEE_list_table_views_' . $this->page_slug, $this->_views);
1961
-        $this->_views = apply_filters('FHEE_list_table_views', $this->_views);
1962
-        $this->_set_list_table_view();
1963
-        $this->_set_list_table_object();
1964
-    }
1965
-
1966
-
1967
-    /**
1968
-     * set current view for List Table
1969
-     *
1970
-     * @return void
1971
-     */
1972
-    protected function _set_list_table_view()
1973
-    {
1974
-        $this->_view = isset($this->_views['in_use']) ? 'in_use' : 'all';
1975
-        $status = $this->request->getRequestParam('status', null, 'key');
1976
-        $this->_view = $status && array_key_exists($status, $this->_views)
1977
-            ? $status
1978
-            : $this->_view;
1979
-    }
1980
-
1981
-
1982
-    /**
1983
-     * _set_list_table_object
1984
-     * WP_List_Table objects need to be loaded fairly early so automatic stuff WP does is taken care of.
1985
-     *
1986
-     * @throws InvalidInterfaceException
1987
-     * @throws InvalidArgumentException
1988
-     * @throws InvalidDataTypeException
1989
-     * @throws EE_Error
1990
-     * @throws InvalidInterfaceException
1991
-     */
1992
-    protected function _set_list_table_object()
1993
-    {
1994
-        if (isset($this->_route_config['list_table'])) {
1995
-            if (! class_exists($this->_route_config['list_table'])) {
1996
-                throw new EE_Error(
1997
-                    sprintf(
1998
-                        esc_html__(
1999
-                            'The %s class defined for the list table does not exist.  Please check the spelling of the class ref in the $_page_config property on %s.',
2000
-                            'event_espresso'
2001
-                        ),
2002
-                        $this->_route_config['list_table'],
2003
-                        get_class($this)
2004
-                    )
2005
-                );
2006
-            }
2007
-            $this->_list_table_object = $this->loader->getShared(
2008
-                $this->_route_config['list_table'],
2009
-                [$this]
2010
-            );
2011
-        }
2012
-    }
2013
-
2014
-
2015
-    /**
2016
-     * get_list_table_view_RLs - get it? View RL ?? VU-RL???  URL ??
2017
-     *
2018
-     * @param array $extra_query_args                     Optional. An array of extra query args to add to the generated
2019
-     *                                                    urls.  The array should be indexed by the view it is being
2020
-     *                                                    added to.
2021
-     * @return array
2022
-     */
2023
-    public function get_list_table_view_RLs($extra_query_args = [])
2024
-    {
2025
-        do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2026
-        if (empty($this->_views)) {
2027
-            $this->_views = [];
2028
-        }
2029
-        // cycle thru views
2030
-        foreach ($this->_views as $key => $view) {
2031
-            $query_args = [];
2032
-            // check for current view
2033
-            $this->_views[ $key ]['class']               = $this->_view === $view['slug'] ? 'current' : '';
2034
-            $query_args['action']                        = $this->_req_action;
2035
-            $query_args[ $this->_req_action . '_nonce' ] = wp_create_nonce($query_args['action'] . '_nonce');
2036
-            $query_args['status']                        = $view['slug'];
2037
-            // merge any other arguments sent in.
2038
-            if (isset($extra_query_args[ $view['slug'] ])) {
2039
-                $query_args = array_merge($query_args, $extra_query_args[ $view['slug'] ]);
2040
-            }
2041
-            $this->_views[ $key ]['url'] = EE_Admin_Page::add_query_args_and_nonce($query_args, $this->_admin_base_url);
2042
-        }
2043
-        return $this->_views;
2044
-    }
2045
-
2046
-
2047
-    /**
2048
-     * _entries_per_page_dropdown
2049
-     * generates a dropdown box for selecting the number of visible rows in an admin page list table
2050
-     *
2051
-     * @param int $max_entries total number of rows in the table
2052
-     * @return string
2053
-     * @todo   : Note: ideally this should be added to the screen options dropdown as that would be consistent with how
2054
-     *         WP does it.
2055
-     */
2056
-    protected function _entries_per_page_dropdown($max_entries = 0)
2057
-    {
2058
-        do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2059
-        $values   = [10, 25, 50, 100];
2060
-        $per_page = $this->request->getRequestParam('per_page', 10, 'int');
2061
-        if ($max_entries) {
2062
-            $values[] = $max_entries;
2063
-            sort($values);
2064
-        }
2065
-        $entries_per_page_dropdown = '
1540
+		// current set timezone for timezone js
1541
+		echo '<span id="current_timezone" class="hidden">' . esc_html(EEH_DTT_Helper::get_timezone()) . '</span>';
1542
+	}
1543
+
1544
+
1545
+	/**
1546
+	 * This function sees if there is a method for help popup content existing for the given route.  If there is then
1547
+	 * we'll use the retrieved array to output the content using the template. For child classes: If you want to have
1548
+	 * help popups then in your templates or your content you set "triggers" for the content using the
1549
+	 * "_set_help_trigger('help_trigger_id')" where "help_trigger_id" is what you will use later in your custom method
1550
+	 * for the help popup content on that page. Then in your Child_Admin_Page class you need to define a help popup
1551
+	 * method for the content in the format "_help_popup_content_{route_name}()"  So if you are setting help content
1552
+	 * for the
1553
+	 * 'edit_event' route you should have a method named "_help_popup_content_edit_route". In your defined
1554
+	 * "help_popup_content_..." method.  You must prepare and return an array in the following format array(
1555
+	 *    'help_trigger_id' => array(
1556
+	 *        'title' => esc_html__('localized title for popup', 'event_espresso'),
1557
+	 *        'content' => esc_html__('localized content for popup', 'event_espresso')
1558
+	 *    )
1559
+	 * );
1560
+	 * Then the EE_Admin_Parent will take care of making sure that is setup properly on the correct route.
1561
+	 *
1562
+	 * @param array $help_array
1563
+	 * @param bool  $display
1564
+	 * @return string content
1565
+	 * @throws DomainException
1566
+	 * @throws EE_Error
1567
+	 */
1568
+	protected function _set_help_popup_content($help_array = [], $display = false)
1569
+	{
1570
+		$content    = '';
1571
+		$help_array = empty($help_array) ? $this->_get_help_content() : $help_array;
1572
+		// loop through the array and setup content
1573
+		foreach ($help_array as $trigger => $help) {
1574
+			// make sure the array is setup properly
1575
+			if (! isset($help['title']) || ! isset($help['content'])) {
1576
+				throw new EE_Error(
1577
+					esc_html__(
1578
+						'Does not look like the popup content array has been setup correctly.  Might want to double check that.  Read the comments for the _get_help_popup_content method found in "EE_Admin_Page" class',
1579
+						'event_espresso'
1580
+					)
1581
+				);
1582
+			}
1583
+			// we're good so let's setup the template vars and then assign parsed template content to our content.
1584
+			$template_args = [
1585
+				'help_popup_id'      => $trigger,
1586
+				'help_popup_title'   => $help['title'],
1587
+				'help_popup_content' => $help['content'],
1588
+			];
1589
+			$content       .= EEH_Template::display_template(
1590
+				EE_ADMIN_TEMPLATE . 'admin_help_popup.template.php',
1591
+				$template_args,
1592
+				true
1593
+			);
1594
+		}
1595
+		if ($display) {
1596
+			echo wp_kses($content, AllowedTags::getWithFormTags());
1597
+			return '';
1598
+		}
1599
+		return $content;
1600
+	}
1601
+
1602
+
1603
+	/**
1604
+	 * All this does is retrieve the help content array if set by the EE_Admin_Page child
1605
+	 *
1606
+	 * @return array properly formatted array for help popup content
1607
+	 * @throws EE_Error
1608
+	 */
1609
+	private function _get_help_content()
1610
+	{
1611
+		// what is the method we're looking for?
1612
+		$method_name = '_help_popup_content_' . $this->_req_action;
1613
+		// if method doesn't exist let's get out.
1614
+		if (! method_exists($this, $method_name)) {
1615
+			return [];
1616
+		}
1617
+		// k we're good to go let's retrieve the help array
1618
+		$help_array = call_user_func([$this, $method_name]);
1619
+		// make sure we've got an array!
1620
+		if (! is_array($help_array)) {
1621
+			throw new EE_Error(
1622
+				esc_html__(
1623
+					'Something went wrong with help popup content generation. Expecting an array and well, this ain\'t no array bub.',
1624
+					'event_espresso'
1625
+				)
1626
+			);
1627
+		}
1628
+		return $help_array;
1629
+	}
1630
+
1631
+
1632
+	/**
1633
+	 * EE Admin Pages can use this to set a properly formatted trigger for a help popup.
1634
+	 * By default the trigger html is printed.  Otherwise it can be returned if the $display flag is set "false"
1635
+	 * See comments made on the _set_help_content method for understanding other parts to the help popup tool.
1636
+	 *
1637
+	 * @param string  $trigger_id reference for retrieving the trigger content for the popup
1638
+	 * @param boolean $display    if false then we return the trigger string
1639
+	 * @param array   $dimensions an array of dimensions for the box (array(h,w))
1640
+	 * @return string
1641
+	 * @throws DomainException
1642
+	 * @throws EE_Error
1643
+	 */
1644
+	protected function _set_help_trigger($trigger_id, $display = true, $dimensions = ['400', '640'])
1645
+	{
1646
+		if ($this->request->isAjax()) {
1647
+			return '';
1648
+		}
1649
+		// let's check and see if there is any content set for this popup.  If there isn't then we'll include a default title and content so that developers know something needs to be corrected
1650
+		$help_array   = $this->_get_help_content();
1651
+		$help_content = '';
1652
+		if (empty($help_array) || ! isset($help_array[ $trigger_id ])) {
1653
+			$help_array[ $trigger_id ] = [
1654
+				'title'   => esc_html__('Missing Content', 'event_espresso'),
1655
+				'content' => esc_html__(
1656
+					'A trigger has been set that doesn\'t have any corresponding content. Make sure you have set the help content. (see the "_set_help_popup_content" method in the EE_Admin_Page for instructions.)',
1657
+					'event_espresso'
1658
+				),
1659
+			];
1660
+			$help_content              = $this->_set_help_popup_content($help_array);
1661
+		}
1662
+		// let's setup the trigger
1663
+		$content = '<a class="ee-dialog" href="?height='
1664
+				   . esc_attr($dimensions[0])
1665
+				   . '&width='
1666
+				   . esc_attr($dimensions[1])
1667
+				   . '&inlineId='
1668
+				   . esc_attr($trigger_id)
1669
+				   . '" target="_blank"><span class="question ee-help-popup-question"></span></a>';
1670
+		$content .= $help_content;
1671
+		if ($display) {
1672
+			echo wp_kses($content, AllowedTags::getWithFormTags());
1673
+			return '';
1674
+		}
1675
+		return $content;
1676
+	}
1677
+
1678
+
1679
+	/**
1680
+	 * _add_global_screen_options
1681
+	 * Add any extra wp_screen_options within this method using built-in WP functions/methods for doing so.
1682
+	 * This particular method will add_screen_options on ALL EE_Admin Pages
1683
+	 *
1684
+	 * @link   http://chrismarslender.com/wp-tutorials/wordpress-screen-options-tutorial/
1685
+	 *         see also WP_Screen object documents...
1686
+	 * @link   http://codex.wordpress.org/Class_Reference/WP_Screen
1687
+	 * @abstract
1688
+	 * @return void
1689
+	 */
1690
+	private function _add_global_screen_options()
1691
+	{
1692
+	}
1693
+
1694
+
1695
+	/**
1696
+	 * _add_global_feature_pointers
1697
+	 * This method is used for implementing any "feature pointers" (using built-in WP styling js).
1698
+	 * This particular method will implement feature pointers for ALL EE_Admin pages.
1699
+	 * Note: this is just a placeholder for now.  Implementation will come down the road
1700
+	 *
1701
+	 * @see    WP_Internal_Pointers class in wp-admin/includes/template.php for example (its a final class so can't be
1702
+	 *         extended) also see:
1703
+	 * @link   http://eamann.com/tech/wordpress-portland/
1704
+	 * @abstract
1705
+	 * @return void
1706
+	 */
1707
+	private function _add_global_feature_pointers()
1708
+	{
1709
+	}
1710
+
1711
+
1712
+	/**
1713
+	 * load_global_scripts_styles
1714
+	 * The scripts and styles enqueued in here will be loaded on every EE Admin page
1715
+	 *
1716
+	 * @return void
1717
+	 */
1718
+	public function load_global_scripts_styles()
1719
+	{
1720
+		/** STYLES **/
1721
+		// add debugging styles
1722
+		if (WP_DEBUG) {
1723
+			add_action('admin_head', [$this, 'add_xdebug_style']);
1724
+		}
1725
+		// register all styles
1726
+		wp_register_style(
1727
+			'espresso-ui-theme',
1728
+			EE_GLOBAL_ASSETS_URL . 'css/espresso-ui-theme/jquery-ui-1.10.3.custom.min.css',
1729
+			[],
1730
+			EVENT_ESPRESSO_VERSION
1731
+		);
1732
+		wp_register_style('ee-admin-css', EE_ADMIN_URL . 'assets/ee-admin-page.css', [], EVENT_ESPRESSO_VERSION);
1733
+		// helpers styles
1734
+		wp_register_style(
1735
+			'ee-text-links',
1736
+			EE_PLUGIN_DIR_URL . 'core/helpers/assets/ee_text_list_helper.css',
1737
+			[],
1738
+			EVENT_ESPRESSO_VERSION
1739
+		);
1740
+		/** SCRIPTS **/
1741
+		// register all scripts
1742
+		wp_register_script(
1743
+			'ee-dialog',
1744
+			EE_ADMIN_URL . 'assets/ee-dialog-helper.js',
1745
+			['jquery', 'jquery-ui-draggable'],
1746
+			EVENT_ESPRESSO_VERSION,
1747
+			true
1748
+		);
1749
+		wp_register_script(
1750
+			'ee_admin_js',
1751
+			EE_ADMIN_URL . 'assets/ee-admin-page.js',
1752
+			['espresso_core', 'ee-parse-uri', 'ee-dialog'],
1753
+			EVENT_ESPRESSO_VERSION,
1754
+			true
1755
+		);
1756
+		wp_register_script(
1757
+			'jquery-ui-timepicker-addon',
1758
+			EE_GLOBAL_ASSETS_URL . 'scripts/jquery-ui-timepicker-addon.js',
1759
+			['jquery-ui-datepicker', 'jquery-ui-slider'],
1760
+			EVENT_ESPRESSO_VERSION,
1761
+			true
1762
+		);
1763
+		// script for sorting tables
1764
+		wp_register_script(
1765
+			'espresso_ajax_table_sorting',
1766
+			EE_ADMIN_URL . 'assets/espresso_ajax_table_sorting.js',
1767
+			['ee_admin_js', 'jquery-ui-sortable'],
1768
+			EVENT_ESPRESSO_VERSION,
1769
+			true
1770
+		);
1771
+		// script for parsing uri's
1772
+		wp_register_script(
1773
+			'ee-parse-uri',
1774
+			EE_GLOBAL_ASSETS_URL . 'scripts/parseuri.js',
1775
+			[],
1776
+			EVENT_ESPRESSO_VERSION,
1777
+			true
1778
+		);
1779
+		// and parsing associative serialized form elements
1780
+		wp_register_script(
1781
+			'ee-serialize-full-array',
1782
+			EE_GLOBAL_ASSETS_URL . 'scripts/jquery.serializefullarray.js',
1783
+			['jquery'],
1784
+			EVENT_ESPRESSO_VERSION,
1785
+			true
1786
+		);
1787
+		// helpers scripts
1788
+		wp_register_script(
1789
+			'ee-text-links',
1790
+			EE_PLUGIN_DIR_URL . 'core/helpers/assets/ee_text_list_helper.js',
1791
+			['jquery'],
1792
+			EVENT_ESPRESSO_VERSION,
1793
+			true
1794
+		);
1795
+		wp_register_script(
1796
+			'ee-moment-core',
1797
+			EE_THIRD_PARTY_URL . 'moment/moment-with-locales.min.js',
1798
+			[],
1799
+			EVENT_ESPRESSO_VERSION,
1800
+			true
1801
+		);
1802
+		wp_register_script(
1803
+			'ee-moment',
1804
+			EE_THIRD_PARTY_URL . 'moment/moment-timezone-with-data.min.js',
1805
+			['ee-moment-core'],
1806
+			EVENT_ESPRESSO_VERSION,
1807
+			true
1808
+		);
1809
+		wp_register_script(
1810
+			'ee-datepicker',
1811
+			EE_ADMIN_URL . 'assets/ee-datepicker.js',
1812
+			['jquery-ui-timepicker-addon', 'ee-moment'],
1813
+			EVENT_ESPRESSO_VERSION,
1814
+			true
1815
+		);
1816
+		// google charts
1817
+		wp_register_script(
1818
+			'google-charts',
1819
+			'https://www.gstatic.com/charts/loader.js',
1820
+			[],
1821
+			EVENT_ESPRESSO_VERSION
1822
+		);
1823
+		// ENQUEUE ALL BASICS BY DEFAULT
1824
+		wp_enqueue_style('ee-admin-css');
1825
+		wp_enqueue_script('ee_admin_js');
1826
+		wp_enqueue_script('ee-accounting');
1827
+		wp_enqueue_script('jquery-validate');
1828
+		// taking care of metaboxes
1829
+		if (
1830
+			empty($this->_cpt_route)
1831
+			&& (isset($this->_route_config['metaboxes']) || isset($this->_route_config['has_metaboxes']))
1832
+		) {
1833
+			wp_enqueue_script('dashboard');
1834
+		}
1835
+		// LOCALIZED DATA
1836
+		// localize script for ajax lazy loading
1837
+		$lazy_loader_container_ids = apply_filters(
1838
+			'FHEE__EE_Admin_Page_Core__load_global_scripts_styles__loader_containers',
1839
+			['espresso_news_post_box_content']
1840
+		);
1841
+		wp_localize_script('ee_admin_js', 'eeLazyLoadingContainers', $lazy_loader_container_ids);
1842
+		add_filter(
1843
+			'admin_body_class',
1844
+			function ($classes) {
1845
+				if (strpos($classes, 'espresso-admin') === false) {
1846
+					$classes .= ' espresso-admin';
1847
+				}
1848
+				return $classes;
1849
+			}
1850
+		);
1851
+	}
1852
+
1853
+
1854
+	/**
1855
+	 *        admin_footer_scripts_eei18n_js_strings
1856
+	 *
1857
+	 * @return        void
1858
+	 */
1859
+	public function admin_footer_scripts_eei18n_js_strings()
1860
+	{
1861
+		EE_Registry::$i18n_js_strings['ajax_url']       = WP_AJAX_URL;
1862
+		EE_Registry::$i18n_js_strings['confirm_delete'] = wp_strip_all_tags(
1863
+			__(
1864
+				'Are you absolutely sure you want to delete this item?\nThis action will delete ALL DATA associated with this item!!!\nThis can NOT be undone!!!',
1865
+				'event_espresso'
1866
+			)
1867
+		);
1868
+		EE_Registry::$i18n_js_strings['January']        = wp_strip_all_tags(__('January', 'event_espresso'));
1869
+		EE_Registry::$i18n_js_strings['February']       = wp_strip_all_tags(__('February', 'event_espresso'));
1870
+		EE_Registry::$i18n_js_strings['March']          = wp_strip_all_tags(__('March', 'event_espresso'));
1871
+		EE_Registry::$i18n_js_strings['April']          = wp_strip_all_tags(__('April', 'event_espresso'));
1872
+		EE_Registry::$i18n_js_strings['May']            = wp_strip_all_tags(__('May', 'event_espresso'));
1873
+		EE_Registry::$i18n_js_strings['June']           = wp_strip_all_tags(__('June', 'event_espresso'));
1874
+		EE_Registry::$i18n_js_strings['July']           = wp_strip_all_tags(__('July', 'event_espresso'));
1875
+		EE_Registry::$i18n_js_strings['August']         = wp_strip_all_tags(__('August', 'event_espresso'));
1876
+		EE_Registry::$i18n_js_strings['September']      = wp_strip_all_tags(__('September', 'event_espresso'));
1877
+		EE_Registry::$i18n_js_strings['October']        = wp_strip_all_tags(__('October', 'event_espresso'));
1878
+		EE_Registry::$i18n_js_strings['November']       = wp_strip_all_tags(__('November', 'event_espresso'));
1879
+		EE_Registry::$i18n_js_strings['December']       = wp_strip_all_tags(__('December', 'event_espresso'));
1880
+		EE_Registry::$i18n_js_strings['Jan']            = wp_strip_all_tags(__('Jan', 'event_espresso'));
1881
+		EE_Registry::$i18n_js_strings['Feb']            = wp_strip_all_tags(__('Feb', 'event_espresso'));
1882
+		EE_Registry::$i18n_js_strings['Mar']            = wp_strip_all_tags(__('Mar', 'event_espresso'));
1883
+		EE_Registry::$i18n_js_strings['Apr']            = wp_strip_all_tags(__('Apr', 'event_espresso'));
1884
+		EE_Registry::$i18n_js_strings['May']            = wp_strip_all_tags(__('May', 'event_espresso'));
1885
+		EE_Registry::$i18n_js_strings['Jun']            = wp_strip_all_tags(__('Jun', 'event_espresso'));
1886
+		EE_Registry::$i18n_js_strings['Jul']            = wp_strip_all_tags(__('Jul', 'event_espresso'));
1887
+		EE_Registry::$i18n_js_strings['Aug']            = wp_strip_all_tags(__('Aug', 'event_espresso'));
1888
+		EE_Registry::$i18n_js_strings['Sep']            = wp_strip_all_tags(__('Sep', 'event_espresso'));
1889
+		EE_Registry::$i18n_js_strings['Oct']            = wp_strip_all_tags(__('Oct', 'event_espresso'));
1890
+		EE_Registry::$i18n_js_strings['Nov']            = wp_strip_all_tags(__('Nov', 'event_espresso'));
1891
+		EE_Registry::$i18n_js_strings['Dec']            = wp_strip_all_tags(__('Dec', 'event_espresso'));
1892
+		EE_Registry::$i18n_js_strings['Sunday']         = wp_strip_all_tags(__('Sunday', 'event_espresso'));
1893
+		EE_Registry::$i18n_js_strings['Monday']         = wp_strip_all_tags(__('Monday', 'event_espresso'));
1894
+		EE_Registry::$i18n_js_strings['Tuesday']        = wp_strip_all_tags(__('Tuesday', 'event_espresso'));
1895
+		EE_Registry::$i18n_js_strings['Wednesday']      = wp_strip_all_tags(__('Wednesday', 'event_espresso'));
1896
+		EE_Registry::$i18n_js_strings['Thursday']       = wp_strip_all_tags(__('Thursday', 'event_espresso'));
1897
+		EE_Registry::$i18n_js_strings['Friday']         = wp_strip_all_tags(__('Friday', 'event_espresso'));
1898
+		EE_Registry::$i18n_js_strings['Saturday']       = wp_strip_all_tags(__('Saturday', 'event_espresso'));
1899
+		EE_Registry::$i18n_js_strings['Sun']            = wp_strip_all_tags(__('Sun', 'event_espresso'));
1900
+		EE_Registry::$i18n_js_strings['Mon']            = wp_strip_all_tags(__('Mon', 'event_espresso'));
1901
+		EE_Registry::$i18n_js_strings['Tue']            = wp_strip_all_tags(__('Tue', 'event_espresso'));
1902
+		EE_Registry::$i18n_js_strings['Wed']            = wp_strip_all_tags(__('Wed', 'event_espresso'));
1903
+		EE_Registry::$i18n_js_strings['Thu']            = wp_strip_all_tags(__('Thu', 'event_espresso'));
1904
+		EE_Registry::$i18n_js_strings['Fri']            = wp_strip_all_tags(__('Fri', 'event_espresso'));
1905
+		EE_Registry::$i18n_js_strings['Sat']            = wp_strip_all_tags(__('Sat', 'event_espresso'));
1906
+	}
1907
+
1908
+
1909
+	/**
1910
+	 *        load enhanced xdebug styles for ppl with failing eyesight
1911
+	 *
1912
+	 * @return        void
1913
+	 */
1914
+	public function add_xdebug_style()
1915
+	{
1916
+		echo '<style>.xdebug-error { font-size:1.5em; }</style>';
1917
+	}
1918
+
1919
+
1920
+	/************************/
1921
+	/** LIST TABLE METHODS **/
1922
+	/************************/
1923
+	/**
1924
+	 * this sets up the list table if the current view requires it.
1925
+	 *
1926
+	 * @return void
1927
+	 * @throws EE_Error
1928
+	 */
1929
+	protected function _set_list_table()
1930
+	{
1931
+		// first is this a list_table view?
1932
+		if (! isset($this->_route_config['list_table'])) {
1933
+			return;
1934
+		} //not a list_table view so get out.
1935
+		// list table functions are per view specific (because some admin pages might have more than one list table!)
1936
+		$list_table_view = '_set_list_table_views_' . $this->_req_action;
1937
+		if (! method_exists($this, $list_table_view) || $this->{$list_table_view}() === false) {
1938
+			// user error msg
1939
+			$error_msg = esc_html__(
1940
+				'An error occurred. The requested list table views could not be found.',
1941
+				'event_espresso'
1942
+			);
1943
+			// developer error msg
1944
+			$error_msg .= '||'
1945
+						  . sprintf(
1946
+							  esc_html__(
1947
+								  'List table views for "%s" route could not be setup. Check that you have the corresponding method, "%s" set up for defining list_table_views for this route.',
1948
+								  'event_espresso'
1949
+							  ),
1950
+							  $this->_req_action,
1951
+							  $list_table_view
1952
+						  );
1953
+			throw new EE_Error($error_msg);
1954
+		}
1955
+		// let's provide the ability to filter the views per PAGE AND ROUTE, per PAGE, and globally
1956
+		$this->_views = apply_filters(
1957
+			'FHEE_list_table_views_' . $this->page_slug . '_' . $this->_req_action,
1958
+			$this->_views
1959
+		);
1960
+		$this->_views = apply_filters('FHEE_list_table_views_' . $this->page_slug, $this->_views);
1961
+		$this->_views = apply_filters('FHEE_list_table_views', $this->_views);
1962
+		$this->_set_list_table_view();
1963
+		$this->_set_list_table_object();
1964
+	}
1965
+
1966
+
1967
+	/**
1968
+	 * set current view for List Table
1969
+	 *
1970
+	 * @return void
1971
+	 */
1972
+	protected function _set_list_table_view()
1973
+	{
1974
+		$this->_view = isset($this->_views['in_use']) ? 'in_use' : 'all';
1975
+		$status = $this->request->getRequestParam('status', null, 'key');
1976
+		$this->_view = $status && array_key_exists($status, $this->_views)
1977
+			? $status
1978
+			: $this->_view;
1979
+	}
1980
+
1981
+
1982
+	/**
1983
+	 * _set_list_table_object
1984
+	 * WP_List_Table objects need to be loaded fairly early so automatic stuff WP does is taken care of.
1985
+	 *
1986
+	 * @throws InvalidInterfaceException
1987
+	 * @throws InvalidArgumentException
1988
+	 * @throws InvalidDataTypeException
1989
+	 * @throws EE_Error
1990
+	 * @throws InvalidInterfaceException
1991
+	 */
1992
+	protected function _set_list_table_object()
1993
+	{
1994
+		if (isset($this->_route_config['list_table'])) {
1995
+			if (! class_exists($this->_route_config['list_table'])) {
1996
+				throw new EE_Error(
1997
+					sprintf(
1998
+						esc_html__(
1999
+							'The %s class defined for the list table does not exist.  Please check the spelling of the class ref in the $_page_config property on %s.',
2000
+							'event_espresso'
2001
+						),
2002
+						$this->_route_config['list_table'],
2003
+						get_class($this)
2004
+					)
2005
+				);
2006
+			}
2007
+			$this->_list_table_object = $this->loader->getShared(
2008
+				$this->_route_config['list_table'],
2009
+				[$this]
2010
+			);
2011
+		}
2012
+	}
2013
+
2014
+
2015
+	/**
2016
+	 * get_list_table_view_RLs - get it? View RL ?? VU-RL???  URL ??
2017
+	 *
2018
+	 * @param array $extra_query_args                     Optional. An array of extra query args to add to the generated
2019
+	 *                                                    urls.  The array should be indexed by the view it is being
2020
+	 *                                                    added to.
2021
+	 * @return array
2022
+	 */
2023
+	public function get_list_table_view_RLs($extra_query_args = [])
2024
+	{
2025
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2026
+		if (empty($this->_views)) {
2027
+			$this->_views = [];
2028
+		}
2029
+		// cycle thru views
2030
+		foreach ($this->_views as $key => $view) {
2031
+			$query_args = [];
2032
+			// check for current view
2033
+			$this->_views[ $key ]['class']               = $this->_view === $view['slug'] ? 'current' : '';
2034
+			$query_args['action']                        = $this->_req_action;
2035
+			$query_args[ $this->_req_action . '_nonce' ] = wp_create_nonce($query_args['action'] . '_nonce');
2036
+			$query_args['status']                        = $view['slug'];
2037
+			// merge any other arguments sent in.
2038
+			if (isset($extra_query_args[ $view['slug'] ])) {
2039
+				$query_args = array_merge($query_args, $extra_query_args[ $view['slug'] ]);
2040
+			}
2041
+			$this->_views[ $key ]['url'] = EE_Admin_Page::add_query_args_and_nonce($query_args, $this->_admin_base_url);
2042
+		}
2043
+		return $this->_views;
2044
+	}
2045
+
2046
+
2047
+	/**
2048
+	 * _entries_per_page_dropdown
2049
+	 * generates a dropdown box for selecting the number of visible rows in an admin page list table
2050
+	 *
2051
+	 * @param int $max_entries total number of rows in the table
2052
+	 * @return string
2053
+	 * @todo   : Note: ideally this should be added to the screen options dropdown as that would be consistent with how
2054
+	 *         WP does it.
2055
+	 */
2056
+	protected function _entries_per_page_dropdown($max_entries = 0)
2057
+	{
2058
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2059
+		$values   = [10, 25, 50, 100];
2060
+		$per_page = $this->request->getRequestParam('per_page', 10, 'int');
2061
+		if ($max_entries) {
2062
+			$values[] = $max_entries;
2063
+			sort($values);
2064
+		}
2065
+		$entries_per_page_dropdown = '
2066 2066
 			<div id="entries-per-page-dv" class="alignleft actions">
2067 2067
 				<label class="hide-if-no-js">
2068 2068
 					Show
2069 2069
 					<select id="entries-per-page-slct" name="entries-per-page-slct">';
2070
-        foreach ($values as $value) {
2071
-            if ($value < $max_entries) {
2072
-                $selected                  = $value === $per_page ? ' selected="' . $per_page . '"' : '';
2073
-                $entries_per_page_dropdown .= '
2070
+		foreach ($values as $value) {
2071
+			if ($value < $max_entries) {
2072
+				$selected                  = $value === $per_page ? ' selected="' . $per_page . '"' : '';
2073
+				$entries_per_page_dropdown .= '
2074 2074
 						<option value="' . $value . '"' . $selected . '>' . $value . '&nbsp;&nbsp;</option>';
2075
-            }
2076
-        }
2077
-        $selected                  = $max_entries === $per_page ? ' selected="' . $per_page . '"' : '';
2078
-        $entries_per_page_dropdown .= '
2075
+			}
2076
+		}
2077
+		$selected                  = $max_entries === $per_page ? ' selected="' . $per_page . '"' : '';
2078
+		$entries_per_page_dropdown .= '
2079 2079
 						<option value="' . $max_entries . '"' . $selected . '>All&nbsp;&nbsp;</option>';
2080
-        $entries_per_page_dropdown .= '
2080
+		$entries_per_page_dropdown .= '
2081 2081
 					</select>
2082 2082
 					entries
2083 2083
 				</label>
2084 2084
 				<input id="entries-per-page-btn" class="button-secondary" type="submit" value="Go" >
2085 2085
 			</div>
2086 2086
 		';
2087
-        return $entries_per_page_dropdown;
2088
-    }
2089
-
2090
-
2091
-    /**
2092
-     *        _set_search_attributes
2093
-     *
2094
-     * @return        void
2095
-     */
2096
-    public function _set_search_attributes()
2097
-    {
2098
-        $this->_template_args['search']['btn_label'] = sprintf(
2099
-            esc_html__('Search %s', 'event_espresso'),
2100
-            empty($this->_search_btn_label) ? $this->page_label
2101
-                : $this->_search_btn_label
2102
-        );
2103
-        $this->_template_args['search']['callback']  = 'search_' . $this->page_slug;
2104
-    }
2105
-
2106
-
2107
-
2108
-    /*** END LIST TABLE METHODS **/
2109
-
2110
-
2111
-    /**
2112
-     * _add_registered_metaboxes
2113
-     *  this loads any registered metaboxes via the 'metaboxes' index in the _page_config property array.
2114
-     *
2115
-     * @link   http://codex.wordpress.org/Function_Reference/add_meta_box
2116
-     * @return void
2117
-     * @throws EE_Error
2118
-     */
2119
-    private function _add_registered_meta_boxes()
2120
-    {
2121
-        do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2122
-        // we only add meta boxes if the page_route calls for it
2123
-        if (
2124
-            is_array($this->_route_config) && isset($this->_route_config['metaboxes'])
2125
-            && is_array(
2126
-                $this->_route_config['metaboxes']
2127
-            )
2128
-        ) {
2129
-            // this simply loops through the callbacks provided
2130
-            // and checks if there is a corresponding callback registered by the child
2131
-            // if there is then we go ahead and process the metabox loader.
2132
-            foreach ($this->_route_config['metaboxes'] as $metabox_callback) {
2133
-                // first check for Closures
2134
-                if ($metabox_callback instanceof Closure) {
2135
-                    $result = $metabox_callback();
2136
-                } elseif (is_array($metabox_callback) && isset($metabox_callback[0], $metabox_callback[1])) {
2137
-                    $result = call_user_func([$metabox_callback[0], $metabox_callback[1]]);
2138
-                } else {
2139
-                    $result = call_user_func([$this, &$metabox_callback]);
2140
-                }
2141
-                if ($result === false) {
2142
-                    // user error msg
2143
-                    $error_msg = esc_html__(
2144
-                        'An error occurred. The  requested metabox could not be found.',
2145
-                        'event_espresso'
2146
-                    );
2147
-                    // developer error msg
2148
-                    $error_msg .= '||'
2149
-                                  . sprintf(
2150
-                                      esc_html__(
2151
-                                          'The metabox with the string "%s" could not be called. Check that the spelling for method names and actions in the "_page_config[\'metaboxes\']" array are all correct.',
2152
-                                          'event_espresso'
2153
-                                      ),
2154
-                                      $metabox_callback
2155
-                                  );
2156
-                    throw new EE_Error($error_msg);
2157
-                }
2158
-            }
2159
-        }
2160
-    }
2161
-
2162
-
2163
-    /**
2164
-     * _add_screen_columns
2165
-     * This will check the _page_config array and if there is "columns" key index indicated, we'll set the template as
2166
-     * the dynamic column template and we'll setup the column options for the page.
2167
-     *
2168
-     * @return void
2169
-     */
2170
-    private function _add_screen_columns()
2171
-    {
2172
-        if (
2173
-            is_array($this->_route_config)
2174
-            && isset($this->_route_config['columns'])
2175
-            && is_array($this->_route_config['columns'])
2176
-            && count($this->_route_config['columns']) === 2
2177
-        ) {
2178
-            add_screen_option(
2179
-                'layout_columns',
2180
-                [
2181
-                    'max'     => (int) $this->_route_config['columns'][0],
2182
-                    'default' => (int) $this->_route_config['columns'][1],
2183
-                ]
2184
-            );
2185
-            $this->_template_args['num_columns']                 = $this->_route_config['columns'][0];
2186
-            $screen_id                                           = $this->_current_screen->id;
2187
-            $screen_columns                                      = (int) get_user_option("screen_layout_{$screen_id}");
2188
-            $total_columns                                       = ! empty($screen_columns)
2189
-                ? $screen_columns
2190
-                : $this->_route_config['columns'][1];
2191
-            $this->_template_args['current_screen_widget_class'] = 'columns-' . $total_columns;
2192
-            $this->_template_args['current_page']                = $this->_wp_page_slug;
2193
-            $this->_template_args['screen']                      = $this->_current_screen;
2194
-            $this->_column_template_path                         = EE_ADMIN_TEMPLATE
2195
-                                                                   . 'admin_details_metabox_column_wrapper.template.php';
2196
-            // finally if we don't have has_metaboxes set in the route config
2197
-            // let's make sure it IS set other wise the necessary hidden fields for this won't be loaded.
2198
-            $this->_route_config['has_metaboxes'] = true;
2199
-        }
2200
-    }
2201
-
2202
-
2203
-
2204
-    /** GLOBALLY AVAILABLE METABOXES **/
2205
-
2206
-
2207
-    /**
2208
-     * In this section we put any globally available EE metaboxes for all EE Admin pages.  They are called by simply
2209
-     * referencing the callback in the _page_config array property.  This way you can be very specific about what pages
2210
-     * these get loaded on.
2211
-     */
2212
-    private function _espresso_news_post_box()
2213
-    {
2214
-        $news_box_title = apply_filters(
2215
-            'FHEE__EE_Admin_Page___espresso_news_post_box__news_box_title',
2216
-            esc_html__('New @ Event Espresso', 'event_espresso')
2217
-        );
2218
-        add_meta_box(
2219
-            'espresso_news_post_box',
2220
-            $news_box_title,
2221
-            [
2222
-                $this,
2223
-                'espresso_news_post_box',
2224
-            ],
2225
-            $this->_wp_page_slug,
2226
-            'side'
2227
-        );
2228
-    }
2229
-
2230
-
2231
-    /**
2232
-     * Code for setting up espresso ratings request metabox.
2233
-     */
2234
-    protected function _espresso_ratings_request()
2235
-    {
2236
-        if (! apply_filters('FHEE_show_ratings_request_meta_box', true)) {
2237
-            return;
2238
-        }
2239
-        $ratings_box_title = apply_filters(
2240
-            'FHEE__EE_Admin_Page___espresso_news_post_box__news_box_title',
2241
-            esc_html__('Keep Event Espresso Decaf Free', 'event_espresso')
2242
-        );
2243
-        add_meta_box(
2244
-            'espresso_ratings_request',
2245
-            $ratings_box_title,
2246
-            [
2247
-                $this,
2248
-                'espresso_ratings_request',
2249
-            ],
2250
-            $this->_wp_page_slug,
2251
-            'side'
2252
-        );
2253
-    }
2254
-
2255
-
2256
-    /**
2257
-     * Code for setting up espresso ratings request metabox content.
2258
-     *
2259
-     * @throws DomainException
2260
-     */
2261
-    public function espresso_ratings_request()
2262
-    {
2263
-        EEH_Template::display_template(
2264
-            EE_ADMIN_TEMPLATE . 'espresso_ratings_request_content.template.php',
2265
-            []
2266
-        );
2267
-    }
2268
-
2269
-
2270
-    public static function cached_rss_display($rss_id, $url)
2271
-    {
2272
-        $loading   = '<p class="widget-loading hide-if-no-js">'
2273
-                     . esc_html__('Loading&#8230;', 'event_espresso')
2274
-                     . '</p><p class="hide-if-js">'
2275
-                     . esc_html__('This widget requires JavaScript.', 'event_espresso')
2276
-                     . '</p>';
2277
-        $pre       = '<div class="espresso-rss-display">' . "\n\t";
2278
-        $pre       .= '<span id="' . esc_attr($rss_id) . '_url" class="hidden">' . esc_url_raw($url) . '</span>';
2279
-        $post      = '</div>' . "\n";
2280
-        $cache_key = 'ee_rss_' . md5($rss_id);
2281
-        $output    = get_transient($cache_key);
2282
-        if ($output !== false) {
2283
-            echo wp_kses($pre . $output . $post, AllowedTags::getWithFormTags());
2284
-            return true;
2285
-        }
2286
-        if (! (defined('DOING_AJAX') && DOING_AJAX)) {
2287
-            echo wp_kses($pre . $loading . $post, AllowedTags::getWithFormTags());
2288
-            return false;
2289
-        }
2290
-        ob_start();
2291
-        wp_widget_rss_output($url, ['show_date' => 0, 'items' => 5]);
2292
-        set_transient($cache_key, ob_get_flush(), 12 * HOUR_IN_SECONDS);
2293
-        return true;
2294
-    }
2295
-
2296
-
2297
-    public function espresso_news_post_box()
2298
-    {
2299
-        ?>
2087
+		return $entries_per_page_dropdown;
2088
+	}
2089
+
2090
+
2091
+	/**
2092
+	 *        _set_search_attributes
2093
+	 *
2094
+	 * @return        void
2095
+	 */
2096
+	public function _set_search_attributes()
2097
+	{
2098
+		$this->_template_args['search']['btn_label'] = sprintf(
2099
+			esc_html__('Search %s', 'event_espresso'),
2100
+			empty($this->_search_btn_label) ? $this->page_label
2101
+				: $this->_search_btn_label
2102
+		);
2103
+		$this->_template_args['search']['callback']  = 'search_' . $this->page_slug;
2104
+	}
2105
+
2106
+
2107
+
2108
+	/*** END LIST TABLE METHODS **/
2109
+
2110
+
2111
+	/**
2112
+	 * _add_registered_metaboxes
2113
+	 *  this loads any registered metaboxes via the 'metaboxes' index in the _page_config property array.
2114
+	 *
2115
+	 * @link   http://codex.wordpress.org/Function_Reference/add_meta_box
2116
+	 * @return void
2117
+	 * @throws EE_Error
2118
+	 */
2119
+	private function _add_registered_meta_boxes()
2120
+	{
2121
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2122
+		// we only add meta boxes if the page_route calls for it
2123
+		if (
2124
+			is_array($this->_route_config) && isset($this->_route_config['metaboxes'])
2125
+			&& is_array(
2126
+				$this->_route_config['metaboxes']
2127
+			)
2128
+		) {
2129
+			// this simply loops through the callbacks provided
2130
+			// and checks if there is a corresponding callback registered by the child
2131
+			// if there is then we go ahead and process the metabox loader.
2132
+			foreach ($this->_route_config['metaboxes'] as $metabox_callback) {
2133
+				// first check for Closures
2134
+				if ($metabox_callback instanceof Closure) {
2135
+					$result = $metabox_callback();
2136
+				} elseif (is_array($metabox_callback) && isset($metabox_callback[0], $metabox_callback[1])) {
2137
+					$result = call_user_func([$metabox_callback[0], $metabox_callback[1]]);
2138
+				} else {
2139
+					$result = call_user_func([$this, &$metabox_callback]);
2140
+				}
2141
+				if ($result === false) {
2142
+					// user error msg
2143
+					$error_msg = esc_html__(
2144
+						'An error occurred. The  requested metabox could not be found.',
2145
+						'event_espresso'
2146
+					);
2147
+					// developer error msg
2148
+					$error_msg .= '||'
2149
+								  . sprintf(
2150
+									  esc_html__(
2151
+										  'The metabox with the string "%s" could not be called. Check that the spelling for method names and actions in the "_page_config[\'metaboxes\']" array are all correct.',
2152
+										  'event_espresso'
2153
+									  ),
2154
+									  $metabox_callback
2155
+								  );
2156
+					throw new EE_Error($error_msg);
2157
+				}
2158
+			}
2159
+		}
2160
+	}
2161
+
2162
+
2163
+	/**
2164
+	 * _add_screen_columns
2165
+	 * This will check the _page_config array and if there is "columns" key index indicated, we'll set the template as
2166
+	 * the dynamic column template and we'll setup the column options for the page.
2167
+	 *
2168
+	 * @return void
2169
+	 */
2170
+	private function _add_screen_columns()
2171
+	{
2172
+		if (
2173
+			is_array($this->_route_config)
2174
+			&& isset($this->_route_config['columns'])
2175
+			&& is_array($this->_route_config['columns'])
2176
+			&& count($this->_route_config['columns']) === 2
2177
+		) {
2178
+			add_screen_option(
2179
+				'layout_columns',
2180
+				[
2181
+					'max'     => (int) $this->_route_config['columns'][0],
2182
+					'default' => (int) $this->_route_config['columns'][1],
2183
+				]
2184
+			);
2185
+			$this->_template_args['num_columns']                 = $this->_route_config['columns'][0];
2186
+			$screen_id                                           = $this->_current_screen->id;
2187
+			$screen_columns                                      = (int) get_user_option("screen_layout_{$screen_id}");
2188
+			$total_columns                                       = ! empty($screen_columns)
2189
+				? $screen_columns
2190
+				: $this->_route_config['columns'][1];
2191
+			$this->_template_args['current_screen_widget_class'] = 'columns-' . $total_columns;
2192
+			$this->_template_args['current_page']                = $this->_wp_page_slug;
2193
+			$this->_template_args['screen']                      = $this->_current_screen;
2194
+			$this->_column_template_path                         = EE_ADMIN_TEMPLATE
2195
+																   . 'admin_details_metabox_column_wrapper.template.php';
2196
+			// finally if we don't have has_metaboxes set in the route config
2197
+			// let's make sure it IS set other wise the necessary hidden fields for this won't be loaded.
2198
+			$this->_route_config['has_metaboxes'] = true;
2199
+		}
2200
+	}
2201
+
2202
+
2203
+
2204
+	/** GLOBALLY AVAILABLE METABOXES **/
2205
+
2206
+
2207
+	/**
2208
+	 * In this section we put any globally available EE metaboxes for all EE Admin pages.  They are called by simply
2209
+	 * referencing the callback in the _page_config array property.  This way you can be very specific about what pages
2210
+	 * these get loaded on.
2211
+	 */
2212
+	private function _espresso_news_post_box()
2213
+	{
2214
+		$news_box_title = apply_filters(
2215
+			'FHEE__EE_Admin_Page___espresso_news_post_box__news_box_title',
2216
+			esc_html__('New @ Event Espresso', 'event_espresso')
2217
+		);
2218
+		add_meta_box(
2219
+			'espresso_news_post_box',
2220
+			$news_box_title,
2221
+			[
2222
+				$this,
2223
+				'espresso_news_post_box',
2224
+			],
2225
+			$this->_wp_page_slug,
2226
+			'side'
2227
+		);
2228
+	}
2229
+
2230
+
2231
+	/**
2232
+	 * Code for setting up espresso ratings request metabox.
2233
+	 */
2234
+	protected function _espresso_ratings_request()
2235
+	{
2236
+		if (! apply_filters('FHEE_show_ratings_request_meta_box', true)) {
2237
+			return;
2238
+		}
2239
+		$ratings_box_title = apply_filters(
2240
+			'FHEE__EE_Admin_Page___espresso_news_post_box__news_box_title',
2241
+			esc_html__('Keep Event Espresso Decaf Free', 'event_espresso')
2242
+		);
2243
+		add_meta_box(
2244
+			'espresso_ratings_request',
2245
+			$ratings_box_title,
2246
+			[
2247
+				$this,
2248
+				'espresso_ratings_request',
2249
+			],
2250
+			$this->_wp_page_slug,
2251
+			'side'
2252
+		);
2253
+	}
2254
+
2255
+
2256
+	/**
2257
+	 * Code for setting up espresso ratings request metabox content.
2258
+	 *
2259
+	 * @throws DomainException
2260
+	 */
2261
+	public function espresso_ratings_request()
2262
+	{
2263
+		EEH_Template::display_template(
2264
+			EE_ADMIN_TEMPLATE . 'espresso_ratings_request_content.template.php',
2265
+			[]
2266
+		);
2267
+	}
2268
+
2269
+
2270
+	public static function cached_rss_display($rss_id, $url)
2271
+	{
2272
+		$loading   = '<p class="widget-loading hide-if-no-js">'
2273
+					 . esc_html__('Loading&#8230;', 'event_espresso')
2274
+					 . '</p><p class="hide-if-js">'
2275
+					 . esc_html__('This widget requires JavaScript.', 'event_espresso')
2276
+					 . '</p>';
2277
+		$pre       = '<div class="espresso-rss-display">' . "\n\t";
2278
+		$pre       .= '<span id="' . esc_attr($rss_id) . '_url" class="hidden">' . esc_url_raw($url) . '</span>';
2279
+		$post      = '</div>' . "\n";
2280
+		$cache_key = 'ee_rss_' . md5($rss_id);
2281
+		$output    = get_transient($cache_key);
2282
+		if ($output !== false) {
2283
+			echo wp_kses($pre . $output . $post, AllowedTags::getWithFormTags());
2284
+			return true;
2285
+		}
2286
+		if (! (defined('DOING_AJAX') && DOING_AJAX)) {
2287
+			echo wp_kses($pre . $loading . $post, AllowedTags::getWithFormTags());
2288
+			return false;
2289
+		}
2290
+		ob_start();
2291
+		wp_widget_rss_output($url, ['show_date' => 0, 'items' => 5]);
2292
+		set_transient($cache_key, ob_get_flush(), 12 * HOUR_IN_SECONDS);
2293
+		return true;
2294
+	}
2295
+
2296
+
2297
+	public function espresso_news_post_box()
2298
+	{
2299
+		?>
2300 2300
         <div class="padding">
2301 2301
             <div id="espresso_news_post_box_content" class="infolinks">
2302 2302
                 <?php
2303
-                // Get RSS Feed(s)
2304
-                self::cached_rss_display(
2305
-                    'espresso_news_post_box_content',
2306
-                    esc_url_raw(
2307
-                        apply_filters(
2308
-                            'FHEE__EE_Admin_Page__espresso_news_post_box__feed_url',
2309
-                            'https://eventespresso.com/feed/'
2310
-                        )
2311
-                    )
2312
-                );
2313
-                ?>
2303
+				// Get RSS Feed(s)
2304
+				self::cached_rss_display(
2305
+					'espresso_news_post_box_content',
2306
+					esc_url_raw(
2307
+						apply_filters(
2308
+							'FHEE__EE_Admin_Page__espresso_news_post_box__feed_url',
2309
+							'https://eventespresso.com/feed/'
2310
+						)
2311
+					)
2312
+				);
2313
+				?>
2314 2314
             </div>
2315 2315
             <?php do_action('AHEE__EE_Admin_Page__espresso_news_post_box__after_content'); ?>
2316 2316
         </div>
2317 2317
         <?php
2318
-    }
2319
-
2320
-
2321
-    private function _espresso_links_post_box()
2322
-    {
2323
-        // Hiding until we actually have content to put in here...
2324
-        // add_meta_box('espresso_links_post_box', esc_html__('Helpful Plugin Links', 'event_espresso'), array( $this, 'espresso_links_post_box'), $this->_wp_page_slug, 'side');
2325
-    }
2326
-
2327
-
2328
-    public function espresso_links_post_box()
2329
-    {
2330
-        // Hiding until we actually have content to put in here...
2331
-        // EEH_Template::display_template(
2332
-        //     EE_ADMIN_TEMPLATE . 'admin_general_metabox_contents_espresso_links.template.php'
2333
-        // );
2334
-    }
2335
-
2336
-
2337
-    protected function _espresso_sponsors_post_box()
2338
-    {
2339
-        if (apply_filters('FHEE_show_sponsors_meta_box', true)) {
2340
-            add_meta_box(
2341
-                'espresso_sponsors_post_box',
2342
-                esc_html__('Event Espresso Highlights', 'event_espresso'),
2343
-                [$this, 'espresso_sponsors_post_box'],
2344
-                $this->_wp_page_slug,
2345
-                'side'
2346
-            );
2347
-        }
2348
-    }
2349
-
2350
-
2351
-    public function espresso_sponsors_post_box()
2352
-    {
2353
-        EEH_Template::display_template(
2354
-            EE_ADMIN_TEMPLATE . 'admin_general_metabox_contents_espresso_sponsors.template.php'
2355
-        );
2356
-    }
2357
-
2358
-
2359
-    private function _publish_post_box()
2360
-    {
2361
-        $meta_box_ref = 'espresso_' . $this->page_slug . '_editor_overview';
2362
-        // if there is a array('label' => array('publishbox' => 'some title') ) present in the _page_config array
2363
-        // then we'll use that for the metabox label.
2364
-        // Otherwise we'll just use publish (publishbox itself could be an array of labels indexed by routes)
2365
-        if (! empty($this->_labels['publishbox'])) {
2366
-            $box_label = is_array($this->_labels['publishbox']) ? $this->_labels['publishbox'][ $this->_req_action ]
2367
-                : $this->_labels['publishbox'];
2368
-        } else {
2369
-            $box_label = esc_html__('Publish', 'event_espresso');
2370
-        }
2371
-        $box_label = apply_filters(
2372
-            'FHEE__EE_Admin_Page___publish_post_box__box_label',
2373
-            $box_label,
2374
-            $this->_req_action,
2375
-            $this
2376
-        );
2377
-        add_meta_box(
2378
-            $meta_box_ref,
2379
-            $box_label,
2380
-            [$this, 'editor_overview'],
2381
-            $this->_current_screen->id,
2382
-            'side',
2383
-            'high'
2384
-        );
2385
-    }
2386
-
2387
-
2388
-    public function editor_overview()
2389
-    {
2390
-        // if we have extra content set let's add it in if not make sure its empty
2391
-        $this->_template_args['publish_box_extra_content'] = isset($this->_template_args['publish_box_extra_content'])
2392
-            ? $this->_template_args['publish_box_extra_content']
2393
-            : '';
2394
-        echo EEH_Template::display_template(
2395
-            EE_ADMIN_TEMPLATE . 'admin_details_publish_metabox.template.php',
2396
-            $this->_template_args,
2397
-            true
2398
-        );
2399
-    }
2400
-
2401
-
2402
-    /** end of globally available metaboxes section **/
2403
-
2404
-
2405
-    /**
2406
-     * Public wrapper for the protected method.  Allows plugins/addons to externally call the
2407
-     * protected method.
2408
-     *
2409
-     * @param string $name
2410
-     * @param int    $id
2411
-     * @param bool   $delete
2412
-     * @param string $save_close_redirect_URL
2413
-     * @param bool   $both_btns
2414
-     * @throws EE_Error
2415
-     * @throws InvalidArgumentException
2416
-     * @throws InvalidDataTypeException
2417
-     * @throws InvalidInterfaceException
2418
-     * @see   $this->_set_publish_post_box_vars for param details
2419
-     * @since 4.6.0
2420
-     */
2421
-    public function set_publish_post_box_vars(
2422
-        $name = '',
2423
-        $id = 0,
2424
-        $delete = false,
2425
-        $save_close_redirect_URL = '',
2426
-        $both_btns = true
2427
-    ) {
2428
-        $this->_set_publish_post_box_vars(
2429
-            $name,
2430
-            $id,
2431
-            $delete,
2432
-            $save_close_redirect_URL,
2433
-            $both_btns
2434
-        );
2435
-    }
2436
-
2437
-
2438
-    /**
2439
-     * Sets the _template_args arguments used by the _publish_post_box shortcut
2440
-     * Note: currently there is no validation for this.  However if you want the delete button, the
2441
-     * save, and save and close buttons to work properly, then you will want to include a
2442
-     * values for the name and id arguments.
2443
-     *
2444
-     * @param string  $name                       key used for the action ID (i.e. event_id)
2445
-     * @param int     $id                         id attached to the item published
2446
-     * @param string  $delete                     page route callback for the delete action
2447
-     * @param string  $save_close_redirect_URL    custom URL to redirect to after Save & Close has been completed
2448
-     * @param boolean $both_btns                  whether to display BOTH the "Save & Close" and "Save" buttons or just
2449
-     *                                            the Save button
2450
-     * @throws EE_Error
2451
-     * @throws InvalidArgumentException
2452
-     * @throws InvalidDataTypeException
2453
-     * @throws InvalidInterfaceException
2454
-     * @todo  Add in validation for name/id arguments.
2455
-     */
2456
-    protected function _set_publish_post_box_vars(
2457
-        $name = '',
2458
-        $id = 0,
2459
-        $delete = '',
2460
-        $save_close_redirect_URL = '',
2461
-        $both_btns = true
2462
-    ) {
2463
-        // if Save & Close, use a custom redirect URL or default to the main page?
2464
-        $save_close_redirect_URL = ! empty($save_close_redirect_URL)
2465
-            ? $save_close_redirect_URL
2466
-            : $this->_admin_base_url;
2467
-        // create the Save & Close and Save buttons
2468
-        $this->_set_save_buttons($both_btns, [], [], $save_close_redirect_URL);
2469
-        // if we have extra content set let's add it in if not make sure its empty
2470
-        $this->_template_args['publish_box_extra_content'] = isset($this->_template_args['publish_box_extra_content'])
2471
-            ? $this->_template_args['publish_box_extra_content']
2472
-            : '';
2473
-        if ($delete && ! empty($id)) {
2474
-            // make sure we have a default if just true is sent.
2475
-            $delete           = ! empty($delete) ? $delete : 'delete';
2476
-            $delete_link_args = [$name => $id];
2477
-            $delete           = $this->get_action_link_or_button(
2478
-                $delete,
2479
-                $delete,
2480
-                $delete_link_args,
2481
-                'submitdelete deletion',
2482
-                '',
2483
-                false
2484
-            );
2485
-        }
2486
-        $this->_template_args['publish_delete_link'] = ! empty($id) ? $delete : '';
2487
-        if (! empty($name) && ! empty($id)) {
2488
-            $hidden_field_arr[ $name ] = [
2489
-                'type'  => 'hidden',
2490
-                'value' => $id,
2491
-            ];
2492
-            $hf                        = $this->_generate_admin_form_fields($hidden_field_arr, 'array');
2493
-        } else {
2494
-            $hf = '';
2495
-        }
2496
-        // add hidden field
2497
-        $this->_template_args['publish_hidden_fields'] = is_array($hf) && ! empty($name)
2498
-            ? $hf[ $name ]['field']
2499
-            : $hf;
2500
-    }
2501
-
2502
-
2503
-    /**
2504
-     * displays an error message to ppl who have javascript disabled
2505
-     *
2506
-     * @return void
2507
-     */
2508
-    private function _display_no_javascript_warning()
2509
-    {
2510
-        ?>
2318
+	}
2319
+
2320
+
2321
+	private function _espresso_links_post_box()
2322
+	{
2323
+		// Hiding until we actually have content to put in here...
2324
+		// add_meta_box('espresso_links_post_box', esc_html__('Helpful Plugin Links', 'event_espresso'), array( $this, 'espresso_links_post_box'), $this->_wp_page_slug, 'side');
2325
+	}
2326
+
2327
+
2328
+	public function espresso_links_post_box()
2329
+	{
2330
+		// Hiding until we actually have content to put in here...
2331
+		// EEH_Template::display_template(
2332
+		//     EE_ADMIN_TEMPLATE . 'admin_general_metabox_contents_espresso_links.template.php'
2333
+		// );
2334
+	}
2335
+
2336
+
2337
+	protected function _espresso_sponsors_post_box()
2338
+	{
2339
+		if (apply_filters('FHEE_show_sponsors_meta_box', true)) {
2340
+			add_meta_box(
2341
+				'espresso_sponsors_post_box',
2342
+				esc_html__('Event Espresso Highlights', 'event_espresso'),
2343
+				[$this, 'espresso_sponsors_post_box'],
2344
+				$this->_wp_page_slug,
2345
+				'side'
2346
+			);
2347
+		}
2348
+	}
2349
+
2350
+
2351
+	public function espresso_sponsors_post_box()
2352
+	{
2353
+		EEH_Template::display_template(
2354
+			EE_ADMIN_TEMPLATE . 'admin_general_metabox_contents_espresso_sponsors.template.php'
2355
+		);
2356
+	}
2357
+
2358
+
2359
+	private function _publish_post_box()
2360
+	{
2361
+		$meta_box_ref = 'espresso_' . $this->page_slug . '_editor_overview';
2362
+		// if there is a array('label' => array('publishbox' => 'some title') ) present in the _page_config array
2363
+		// then we'll use that for the metabox label.
2364
+		// Otherwise we'll just use publish (publishbox itself could be an array of labels indexed by routes)
2365
+		if (! empty($this->_labels['publishbox'])) {
2366
+			$box_label = is_array($this->_labels['publishbox']) ? $this->_labels['publishbox'][ $this->_req_action ]
2367
+				: $this->_labels['publishbox'];
2368
+		} else {
2369
+			$box_label = esc_html__('Publish', 'event_espresso');
2370
+		}
2371
+		$box_label = apply_filters(
2372
+			'FHEE__EE_Admin_Page___publish_post_box__box_label',
2373
+			$box_label,
2374
+			$this->_req_action,
2375
+			$this
2376
+		);
2377
+		add_meta_box(
2378
+			$meta_box_ref,
2379
+			$box_label,
2380
+			[$this, 'editor_overview'],
2381
+			$this->_current_screen->id,
2382
+			'side',
2383
+			'high'
2384
+		);
2385
+	}
2386
+
2387
+
2388
+	public function editor_overview()
2389
+	{
2390
+		// if we have extra content set let's add it in if not make sure its empty
2391
+		$this->_template_args['publish_box_extra_content'] = isset($this->_template_args['publish_box_extra_content'])
2392
+			? $this->_template_args['publish_box_extra_content']
2393
+			: '';
2394
+		echo EEH_Template::display_template(
2395
+			EE_ADMIN_TEMPLATE . 'admin_details_publish_metabox.template.php',
2396
+			$this->_template_args,
2397
+			true
2398
+		);
2399
+	}
2400
+
2401
+
2402
+	/** end of globally available metaboxes section **/
2403
+
2404
+
2405
+	/**
2406
+	 * Public wrapper for the protected method.  Allows plugins/addons to externally call the
2407
+	 * protected method.
2408
+	 *
2409
+	 * @param string $name
2410
+	 * @param int    $id
2411
+	 * @param bool   $delete
2412
+	 * @param string $save_close_redirect_URL
2413
+	 * @param bool   $both_btns
2414
+	 * @throws EE_Error
2415
+	 * @throws InvalidArgumentException
2416
+	 * @throws InvalidDataTypeException
2417
+	 * @throws InvalidInterfaceException
2418
+	 * @see   $this->_set_publish_post_box_vars for param details
2419
+	 * @since 4.6.0
2420
+	 */
2421
+	public function set_publish_post_box_vars(
2422
+		$name = '',
2423
+		$id = 0,
2424
+		$delete = false,
2425
+		$save_close_redirect_URL = '',
2426
+		$both_btns = true
2427
+	) {
2428
+		$this->_set_publish_post_box_vars(
2429
+			$name,
2430
+			$id,
2431
+			$delete,
2432
+			$save_close_redirect_URL,
2433
+			$both_btns
2434
+		);
2435
+	}
2436
+
2437
+
2438
+	/**
2439
+	 * Sets the _template_args arguments used by the _publish_post_box shortcut
2440
+	 * Note: currently there is no validation for this.  However if you want the delete button, the
2441
+	 * save, and save and close buttons to work properly, then you will want to include a
2442
+	 * values for the name and id arguments.
2443
+	 *
2444
+	 * @param string  $name                       key used for the action ID (i.e. event_id)
2445
+	 * @param int     $id                         id attached to the item published
2446
+	 * @param string  $delete                     page route callback for the delete action
2447
+	 * @param string  $save_close_redirect_URL    custom URL to redirect to after Save & Close has been completed
2448
+	 * @param boolean $both_btns                  whether to display BOTH the "Save & Close" and "Save" buttons or just
2449
+	 *                                            the Save button
2450
+	 * @throws EE_Error
2451
+	 * @throws InvalidArgumentException
2452
+	 * @throws InvalidDataTypeException
2453
+	 * @throws InvalidInterfaceException
2454
+	 * @todo  Add in validation for name/id arguments.
2455
+	 */
2456
+	protected function _set_publish_post_box_vars(
2457
+		$name = '',
2458
+		$id = 0,
2459
+		$delete = '',
2460
+		$save_close_redirect_URL = '',
2461
+		$both_btns = true
2462
+	) {
2463
+		// if Save & Close, use a custom redirect URL or default to the main page?
2464
+		$save_close_redirect_URL = ! empty($save_close_redirect_URL)
2465
+			? $save_close_redirect_URL
2466
+			: $this->_admin_base_url;
2467
+		// create the Save & Close and Save buttons
2468
+		$this->_set_save_buttons($both_btns, [], [], $save_close_redirect_URL);
2469
+		// if we have extra content set let's add it in if not make sure its empty
2470
+		$this->_template_args['publish_box_extra_content'] = isset($this->_template_args['publish_box_extra_content'])
2471
+			? $this->_template_args['publish_box_extra_content']
2472
+			: '';
2473
+		if ($delete && ! empty($id)) {
2474
+			// make sure we have a default if just true is sent.
2475
+			$delete           = ! empty($delete) ? $delete : 'delete';
2476
+			$delete_link_args = [$name => $id];
2477
+			$delete           = $this->get_action_link_or_button(
2478
+				$delete,
2479
+				$delete,
2480
+				$delete_link_args,
2481
+				'submitdelete deletion',
2482
+				'',
2483
+				false
2484
+			);
2485
+		}
2486
+		$this->_template_args['publish_delete_link'] = ! empty($id) ? $delete : '';
2487
+		if (! empty($name) && ! empty($id)) {
2488
+			$hidden_field_arr[ $name ] = [
2489
+				'type'  => 'hidden',
2490
+				'value' => $id,
2491
+			];
2492
+			$hf                        = $this->_generate_admin_form_fields($hidden_field_arr, 'array');
2493
+		} else {
2494
+			$hf = '';
2495
+		}
2496
+		// add hidden field
2497
+		$this->_template_args['publish_hidden_fields'] = is_array($hf) && ! empty($name)
2498
+			? $hf[ $name ]['field']
2499
+			: $hf;
2500
+	}
2501
+
2502
+
2503
+	/**
2504
+	 * displays an error message to ppl who have javascript disabled
2505
+	 *
2506
+	 * @return void
2507
+	 */
2508
+	private function _display_no_javascript_warning()
2509
+	{
2510
+		?>
2511 2511
         <noscript>
2512 2512
             <div id="no-js-message" class="error">
2513 2513
                 <p style="font-size:1.3em;">
2514 2514
                     <span style="color:red;"><?php esc_html_e('Warning!', 'event_espresso'); ?></span>
2515 2515
                     <?php esc_html_e(
2516
-                        'Javascript is currently turned off for your browser. Javascript must be enabled in order for all of the features on this page to function properly. Please turn your javascript back on.',
2517
-                        'event_espresso'
2518
-                    ); ?>
2516
+						'Javascript is currently turned off for your browser. Javascript must be enabled in order for all of the features on this page to function properly. Please turn your javascript back on.',
2517
+						'event_espresso'
2518
+					); ?>
2519 2519
                 </p>
2520 2520
             </div>
2521 2521
         </noscript>
2522 2522
         <?php
2523
-    }
2524
-
2525
-
2526
-    /**
2527
-     * displays espresso success and/or error notices
2528
-     *
2529
-     * @return void
2530
-     */
2531
-    protected function _display_espresso_notices()
2532
-    {
2533
-        $notices = $this->_get_transient(true);
2534
-        echo stripslashes($notices);
2535
-    }
2536
-
2537
-
2538
-    /**
2539
-     * spinny things pacify the masses
2540
-     *
2541
-     * @return void
2542
-     */
2543
-    protected function _add_admin_page_ajax_loading_img()
2544
-    {
2545
-        ?>
2523
+	}
2524
+
2525
+
2526
+	/**
2527
+	 * displays espresso success and/or error notices
2528
+	 *
2529
+	 * @return void
2530
+	 */
2531
+	protected function _display_espresso_notices()
2532
+	{
2533
+		$notices = $this->_get_transient(true);
2534
+		echo stripslashes($notices);
2535
+	}
2536
+
2537
+
2538
+	/**
2539
+	 * spinny things pacify the masses
2540
+	 *
2541
+	 * @return void
2542
+	 */
2543
+	protected function _add_admin_page_ajax_loading_img()
2544
+	{
2545
+		?>
2546 2546
         <div id="espresso-ajax-loading" class="ajax-loading-grey">
2547 2547
             <span class="ee-spinner ee-spin"></span><span class="hidden"><?php
2548
-                esc_html_e('loading...', 'event_espresso'); ?></span>
2548
+				esc_html_e('loading...', 'event_espresso'); ?></span>
2549 2549
         </div>
2550 2550
         <?php
2551
-    }
2551
+	}
2552 2552
 
2553 2553
 
2554
-    /**
2555
-     * add admin page overlay for modal boxes
2556
-     *
2557
-     * @return void
2558
-     */
2559
-    protected function _add_admin_page_overlay()
2560
-    {
2561
-        ?>
2554
+	/**
2555
+	 * add admin page overlay for modal boxes
2556
+	 *
2557
+	 * @return void
2558
+	 */
2559
+	protected function _add_admin_page_overlay()
2560
+	{
2561
+		?>
2562 2562
         <div id="espresso-admin-page-overlay-dv" class=""></div>
2563 2563
         <?php
2564
-    }
2565
-
2566
-
2567
-    /**
2568
-     * facade for add_meta_box
2569
-     *
2570
-     * @param string  $action        where the metabox gets displayed
2571
-     * @param string  $title         Title of Metabox (output in metabox header)
2572
-     * @param string  $callback      If not empty and $create_fun is set to false then we'll use a custom callback
2573
-     *                               instead of the one created in here.
2574
-     * @param array   $callback_args an array of args supplied for the metabox
2575
-     * @param string  $column        what metabox column
2576
-     * @param string  $priority      give this metabox a priority (using accepted priorities for wp meta boxes)
2577
-     * @param boolean $create_func   default is true.  Basically we can say we don't WANT to have the runtime function
2578
-     *                               created but just set our own callback for wp's add_meta_box.
2579
-     * @throws DomainException
2580
-     */
2581
-    public function _add_admin_page_meta_box(
2582
-        $action,
2583
-        $title,
2584
-        $callback,
2585
-        $callback_args,
2586
-        $column = 'normal',
2587
-        $priority = 'high',
2588
-        $create_func = true
2589
-    ) {
2590
-        do_action('AHEE_log', __FILE__, __FUNCTION__, $callback);
2591
-        // if we have empty callback args and we want to automatically create the metabox callback then we need to make sure the callback args are generated.
2592
-        if (empty($callback_args) && $create_func) {
2593
-            $callback_args = [
2594
-                'template_path' => $this->_template_path,
2595
-                'template_args' => $this->_template_args,
2596
-            ];
2597
-        }
2598
-        // if $create_func is true (default) then we automatically create the function for displaying the actual meta box.  If false then we take the $callback reference passed through and use it instead (so callers can define their own callback function/method if they wish)
2599
-        $call_back_func = $create_func
2600
-            ? function ($post, $metabox) {
2601
-                do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2602
-                echo EEH_Template::display_template(
2603
-                    $metabox['args']['template_path'],
2604
-                    $metabox['args']['template_args'],
2605
-                    true
2606
-                );
2607
-            }
2608
-            : $callback;
2609
-        add_meta_box(
2610
-            str_replace('_', '-', $action) . '-mbox',
2611
-            $title,
2612
-            $call_back_func,
2613
-            $this->_wp_page_slug,
2614
-            $column,
2615
-            $priority,
2616
-            $callback_args
2617
-        );
2618
-    }
2619
-
2620
-
2621
-    /**
2622
-     * generates HTML wrapper for and admin details page that contains metaboxes in columns
2623
-     *
2624
-     * @throws DomainException
2625
-     * @throws EE_Error
2626
-     */
2627
-    public function display_admin_page_with_metabox_columns()
2628
-    {
2629
-        $this->_template_args['post_body_content']  = $this->_template_args['admin_page_content'];
2630
-        $this->_template_args['admin_page_content'] = EEH_Template::display_template(
2631
-            $this->_column_template_path,
2632
-            $this->_template_args,
2633
-            true
2634
-        );
2635
-        // the final wrapper
2636
-        $this->admin_page_wrapper();
2637
-    }
2638
-
2639
-
2640
-    /**
2641
-     * generates  HTML wrapper for an admin details page
2642
-     *
2643
-     * @return void
2644
-     * @throws EE_Error
2645
-     * @throws DomainException
2646
-     */
2647
-    public function display_admin_page_with_sidebar()
2648
-    {
2649
-        $this->_display_admin_page(true);
2650
-    }
2651
-
2652
-
2653
-    /**
2654
-     * generates  HTML wrapper for an admin details page (except no sidebar)
2655
-     *
2656
-     * @return void
2657
-     * @throws EE_Error
2658
-     * @throws DomainException
2659
-     */
2660
-    public function display_admin_page_with_no_sidebar()
2661
-    {
2662
-        $this->_display_admin_page();
2663
-    }
2664
-
2665
-
2666
-    /**
2667
-     * generates HTML wrapper for an EE about admin page (no sidebar)
2668
-     *
2669
-     * @return void
2670
-     * @throws EE_Error
2671
-     * @throws DomainException
2672
-     */
2673
-    public function display_about_admin_page()
2674
-    {
2675
-        $this->_display_admin_page(false, true);
2676
-    }
2677
-
2678
-
2679
-    /**
2680
-     * display_admin_page
2681
-     * contains the code for actually displaying an admin page
2682
-     *
2683
-     * @param boolean $sidebar true with sidebar, false without
2684
-     * @param boolean $about   use the about_admin_wrapper instead of the default.
2685
-     * @return void
2686
-     * @throws DomainException
2687
-     * @throws EE_Error
2688
-     */
2689
-    private function _display_admin_page($sidebar = false, $about = false)
2690
-    {
2691
-        do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2692
-        // custom remove metaboxes hook to add or remove any metaboxes to/from Admin pages.
2693
-        do_action('AHEE__EE_Admin_Page___display_admin_page__modify_metaboxes');
2694
-        // set current wp page slug - looks like: event-espresso_page_event_categories
2695
-        // keep in mind "event-espresso" COULD be something else if the top level menu label has been translated.
2696
-        $this->_template_args['current_page']              = $this->_wp_page_slug;
2697
-        $this->_template_args['admin_page_wrapper_div_id'] = $this->_cpt_route
2698
-            ? 'poststuff'
2699
-            : 'espresso-default-admin';
2700
-        $template_path                                     = $sidebar
2701
-            ? EE_ADMIN_TEMPLATE . 'admin_details_wrapper.template.php'
2702
-            : EE_ADMIN_TEMPLATE . 'admin_details_wrapper_no_sidebar.template.php';
2703
-        if ($this->request->isAjax()) {
2704
-            $template_path = EE_ADMIN_TEMPLATE . 'admin_details_wrapper_no_sidebar_ajax.template.php';
2705
-        }
2706
-        $template_path                                     = ! empty($this->_column_template_path)
2707
-            ? $this->_column_template_path : $template_path;
2708
-        $this->_template_args['post_body_content']         = isset($this->_template_args['admin_page_content'])
2709
-            ? $this->_template_args['admin_page_content']
2710
-            : '';
2711
-        $this->_template_args['before_admin_page_content'] = isset($this->_template_args['before_admin_page_content'])
2712
-            ? $this->_template_args['before_admin_page_content']
2713
-            : '';
2714
-        $this->_template_args['after_admin_page_content']  = isset($this->_template_args['after_admin_page_content'])
2715
-            ? $this->_template_args['after_admin_page_content']
2716
-            : '';
2717
-        $this->_template_args['admin_page_content']        = EEH_Template::display_template(
2718
-            $template_path,
2719
-            $this->_template_args,
2720
-            true
2721
-        );
2722
-        // the final template wrapper
2723
-        $this->admin_page_wrapper($about);
2724
-    }
2725
-
2726
-
2727
-    /**
2728
-     * This is used to display caf preview pages.
2729
-     *
2730
-     * @param string $utm_campaign_source what is the key used for google analytics link
2731
-     * @param bool   $display_sidebar     whether to use the sidebar template or the full template for the page.  TRUE
2732
-     *                                    = SHOW sidebar, FALSE = no sidebar. Default no sidebar.
2733
-     * @return void
2734
-     * @throws DomainException
2735
-     * @throws EE_Error
2736
-     * @throws InvalidArgumentException
2737
-     * @throws InvalidDataTypeException
2738
-     * @throws InvalidInterfaceException
2739
-     * @since 4.3.2
2740
-     */
2741
-    public function display_admin_caf_preview_page($utm_campaign_source = '', $display_sidebar = true)
2742
-    {
2743
-        // let's generate a default preview action button if there isn't one already present.
2744
-        $this->_labels['buttons']['buy_now']           = esc_html__(
2745
-            'Upgrade to Event Espresso 4 Right Now',
2746
-            'event_espresso'
2747
-        );
2748
-        $buy_now_url                                   = add_query_arg(
2749
-            [
2750
-                'ee_ver'       => 'ee4',
2751
-                'utm_source'   => 'ee4_plugin_admin',
2752
-                'utm_medium'   => 'link',
2753
-                'utm_campaign' => $utm_campaign_source,
2754
-                'utm_content'  => 'buy_now_button',
2755
-            ],
2756
-            'https://eventespresso.com/pricing/'
2757
-        );
2758
-        $this->_template_args['preview_action_button'] = ! isset($this->_template_args['preview_action_button'])
2759
-            ? $this->get_action_link_or_button(
2760
-                '',
2761
-                'buy_now',
2762
-                [],
2763
-                'button-primary button-large',
2764
-                esc_url_raw($buy_now_url),
2765
-                true
2766
-            )
2767
-            : $this->_template_args['preview_action_button'];
2768
-        $this->_template_args['admin_page_content']    = EEH_Template::display_template(
2769
-            EE_ADMIN_TEMPLATE . 'admin_caf_full_page_preview.template.php',
2770
-            $this->_template_args,
2771
-            true
2772
-        );
2773
-        $this->_display_admin_page($display_sidebar);
2774
-    }
2775
-
2776
-
2777
-    /**
2778
-     * display_admin_list_table_page_with_sidebar
2779
-     * generates HTML wrapper for an admin_page with list_table
2780
-     *
2781
-     * @return void
2782
-     * @throws EE_Error
2783
-     * @throws DomainException
2784
-     */
2785
-    public function display_admin_list_table_page_with_sidebar()
2786
-    {
2787
-        $this->_display_admin_list_table_page(true);
2788
-    }
2789
-
2790
-
2791
-    /**
2792
-     * display_admin_list_table_page_with_no_sidebar
2793
-     * generates HTML wrapper for an admin_page with list_table (but with no sidebar)
2794
-     *
2795
-     * @return void
2796
-     * @throws EE_Error
2797
-     * @throws DomainException
2798
-     */
2799
-    public function display_admin_list_table_page_with_no_sidebar()
2800
-    {
2801
-        $this->_display_admin_list_table_page();
2802
-    }
2803
-
2804
-
2805
-    /**
2806
-     * generates html wrapper for an admin_list_table page
2807
-     *
2808
-     * @param boolean $sidebar whether to display with sidebar or not.
2809
-     * @return void
2810
-     * @throws DomainException
2811
-     * @throws EE_Error
2812
-     */
2813
-    private function _display_admin_list_table_page($sidebar = false)
2814
-    {
2815
-        // setup search attributes
2816
-        $this->_set_search_attributes();
2817
-        $this->_template_args['current_page']     = $this->_wp_page_slug;
2818
-        $template_path                            = EE_ADMIN_TEMPLATE . 'admin_list_wrapper.template.php';
2819
-        $this->_template_args['table_url']        = $this->request->isAjax()
2820
-            ? add_query_arg(['noheader' => 'true', 'route' => $this->_req_action], $this->_admin_base_url)
2821
-            : add_query_arg(['route' => $this->_req_action], $this->_admin_base_url);
2822
-        $this->_template_args['list_table']       = $this->_list_table_object;
2823
-        $this->_template_args['current_route']    = $this->_req_action;
2824
-        $this->_template_args['list_table_class'] = get_class($this->_list_table_object);
2825
-        $ajax_sorting_callback                    = $this->_list_table_object->get_ajax_sorting_callback();
2826
-        if (! empty($ajax_sorting_callback)) {
2827
-            $sortable_list_table_form_fields = wp_nonce_field(
2828
-                $ajax_sorting_callback . '_nonce',
2829
-                $ajax_sorting_callback . '_nonce',
2830
-                false,
2831
-                false
2832
-            );
2833
-            $sortable_list_table_form_fields .= '<input type="hidden" id="ajax_table_sort_page" name="ajax_table_sort_page" value="'
2834
-                                                . $this->page_slug
2835
-                                                . '" />';
2836
-            $sortable_list_table_form_fields .= '<input type="hidden" id="ajax_table_sort_action" name="ajax_table_sort_action" value="'
2837
-                                                . $ajax_sorting_callback
2838
-                                                . '" />';
2839
-        } else {
2840
-            $sortable_list_table_form_fields = '';
2841
-        }
2842
-        $this->_template_args['sortable_list_table_form_fields'] = $sortable_list_table_form_fields;
2843
-        $hidden_form_fields                                      =
2844
-            isset($this->_template_args['list_table_hidden_fields'])
2845
-                ? $this->_template_args['list_table_hidden_fields']
2846
-                : '';
2847
-        $nonce_ref                                               = $this->_req_action . '_nonce';
2848
-        $hidden_form_fields                                      .= '<input type="hidden" name="'
2849
-                                                                    . $nonce_ref
2850
-                                                                    . '" value="'
2851
-                                                                    . wp_create_nonce($nonce_ref)
2852
-                                                                    . '">';
2853
-        $this->_template_args['list_table_hidden_fields']        = $hidden_form_fields;
2854
-        // display message about search results?
2855
-        $search = $this->request->getRequestParam('s');
2856
-        $this->_template_args['before_list_table'] .= ! empty($search)
2857
-            ? '<p class="ee-search-results">' . sprintf(
2858
-                esc_html__('Displaying search results for the search string: %1$s', 'event_espresso'),
2859
-                trim($search, '%')
2860
-            ) . '</p>'
2861
-            : '';
2862
-        // filter before_list_table template arg
2863
-        $this->_template_args['before_list_table'] = apply_filters(
2864
-            'FHEE__EE_Admin_Page___display_admin_list_table_page__before_list_table__template_arg',
2865
-            $this->_template_args['before_list_table'],
2866
-            $this->page_slug,
2867
-            $this->request->requestParams(),
2868
-            $this->_req_action
2869
-        );
2870
-        // convert to array and filter again
2871
-        // arrays are easier to inject new items in a specific location,
2872
-        // but would not be backwards compatible, so we have to add a new filter
2873
-        $this->_template_args['before_list_table'] = implode(
2874
-            " \n",
2875
-            (array) apply_filters(
2876
-                'FHEE__EE_Admin_Page___display_admin_list_table_page__before_list_table__template_args_array',
2877
-                (array) $this->_template_args['before_list_table'],
2878
-                $this->page_slug,
2879
-                $this->request->requestParams(),
2880
-                $this->_req_action
2881
-            )
2882
-        );
2883
-        // filter after_list_table template arg
2884
-        $this->_template_args['after_list_table'] = apply_filters(
2885
-            'FHEE__EE_Admin_Page___display_admin_list_table_page__after_list_table__template_arg',
2886
-            $this->_template_args['after_list_table'],
2887
-            $this->page_slug,
2888
-            $this->request->requestParams(),
2889
-            $this->_req_action
2890
-        );
2891
-        // convert to array and filter again
2892
-        // arrays are easier to inject new items in a specific location,
2893
-        // but would not be backwards compatible, so we have to add a new filter
2894
-        $this->_template_args['after_list_table']   = implode(
2895
-            " \n",
2896
-            (array) apply_filters(
2897
-                'FHEE__EE_Admin_Page___display_admin_list_table_page__after_list_table__template_args_array',
2898
-                (array) $this->_template_args['after_list_table'],
2899
-                $this->page_slug,
2900
-                $this->request->requestParams(),
2901
-                $this->_req_action
2902
-            )
2903
-        );
2904
-        $this->_template_args['admin_page_content'] = EEH_Template::display_template(
2905
-            $template_path,
2906
-            $this->_template_args,
2907
-            true
2908
-        );
2909
-        // the final template wrapper
2910
-        if ($sidebar) {
2911
-            $this->display_admin_page_with_sidebar();
2912
-        } else {
2913
-            $this->display_admin_page_with_no_sidebar();
2914
-        }
2915
-    }
2916
-
2917
-
2918
-    /**
2919
-     * This just prepares a legend using the given items and the admin_details_legend.template.php file and returns the
2920
-     * html string for the legend.
2921
-     * $items are expected in an array in the following format:
2922
-     * $legend_items = array(
2923
-     *        'item_id' => array(
2924
-     *            'icon' => 'http://url_to_icon_being_described.png',
2925
-     *            'desc' => esc_html__('localized description of item');
2926
-     *        )
2927
-     * );
2928
-     *
2929
-     * @param array $items see above for format of array
2930
-     * @return string html string of legend
2931
-     * @throws DomainException
2932
-     */
2933
-    protected function _display_legend($items)
2934
-    {
2935
-        $this->_template_args['items'] = apply_filters(
2936
-            'FHEE__EE_Admin_Page___display_legend__items',
2937
-            (array) $items,
2938
-            $this
2939
-        );
2940
-        return EEH_Template::display_template(
2941
-            EE_ADMIN_TEMPLATE . 'admin_details_legend.template.php',
2942
-            $this->_template_args,
2943
-            true
2944
-        );
2945
-    }
2946
-
2947
-
2948
-    /**
2949
-     * This is used whenever we're DOING_AJAX to return a formatted json array that our calling javascript can expect
2950
-     * The returned json object is created from an array in the following format:
2951
-     * array(
2952
-     *  'error' => FALSE, //(default FALSE), contains any errors and/or exceptions (exceptions return json early),
2953
-     *  'success' => FALSE, //(default FALSE) - contains any special success message.
2954
-     *  'notices' => '', // - contains any EE_Error formatted notices
2955
-     *  'content' => 'string can be html', //this is a string of formatted content (can be html)
2956
-     *  'data' => array() //this can be any key/value pairs that a method returns for later json parsing by the js.
2957
-     *  We're also going to include the template args with every package (so js can pick out any specific template args
2958
-     *  that might be included in here)
2959
-     * )
2960
-     * The json object is populated by whatever is set in the $_template_args property.
2961
-     *
2962
-     * @param bool  $sticky_notices    Used to indicate whether you want to ensure notices are added to a transient
2963
-     *                                 instead of displayed.
2964
-     * @param array $notices_arguments Use this to pass any additional args on to the _process_notices.
2965
-     * @return void
2966
-     * @throws EE_Error
2967
-     */
2968
-    protected function _return_json($sticky_notices = false, $notices_arguments = [])
2969
-    {
2970
-        // make sure any EE_Error notices have been handled.
2971
-        $this->_process_notices($notices_arguments, true, $sticky_notices);
2972
-        $data = isset($this->_template_args['data']) ? $this->_template_args['data'] : [];
2973
-        unset($this->_template_args['data']);
2974
-        $json = [
2975
-            'error'     => isset($this->_template_args['error']) ? $this->_template_args['error'] : false,
2976
-            'success'   => isset($this->_template_args['success']) ? $this->_template_args['success'] : false,
2977
-            'errors'    => isset($this->_template_args['errors']) ? $this->_template_args['errors'] : false,
2978
-            'attention' => isset($this->_template_args['attention']) ? $this->_template_args['attention'] : false,
2979
-            'notices'   => EE_Error::get_notices(),
2980
-            'content'   => isset($this->_template_args['admin_page_content'])
2981
-                ? $this->_template_args['admin_page_content'] : '',
2982
-            'data'      => array_merge($data, ['template_args' => $this->_template_args]),
2983
-            'isEEajax'  => true
2984
-            // special flag so any ajax.Success methods in js can identify this return package as a EEajax package.
2985
-        ];
2986
-        // make sure there are no php errors or headers_sent.  Then we can set correct json header.
2987
-        if (null === error_get_last() || ! headers_sent()) {
2988
-            header('Content-Type: application/json; charset=UTF-8');
2989
-        }
2990
-        echo wp_json_encode($json);
2991
-        exit();
2992
-    }
2993
-
2994
-
2995
-    /**
2996
-     * Simply a wrapper for the protected method so we can call this outside the class (ONLY when doing ajax)
2997
-     *
2998
-     * @return void
2999
-     * @throws EE_Error
3000
-     */
3001
-    public function return_json()
3002
-    {
3003
-        if ($this->request->isAjax()) {
3004
-            $this->_return_json();
3005
-        } else {
3006
-            throw new EE_Error(
3007
-                sprintf(
3008
-                    esc_html__('The public %s method can only be called when DOING_AJAX = TRUE', 'event_espresso'),
3009
-                    __FUNCTION__
3010
-                )
3011
-            );
3012
-        }
3013
-    }
3014
-
3015
-
3016
-    /**
3017
-     * This provides a way for child hook classes to send along themselves by reference so methods/properties within
3018
-     * them can be accessed by EE_Admin_child pages. This is assigned to the $_hook_obj property.
3019
-     *
3020
-     * @param EE_Admin_Hooks $hook_obj This will be the object for the EE_Admin_Hooks child
3021
-     */
3022
-    public function set_hook_object(EE_Admin_Hooks $hook_obj)
3023
-    {
3024
-        $this->_hook_obj = $hook_obj;
3025
-    }
3026
-
3027
-
3028
-    /**
3029
-     *        generates  HTML wrapper with Tabbed nav for an admin page
3030
-     *
3031
-     * @param boolean $about whether to use the special about page wrapper or default.
3032
-     * @return void
3033
-     * @throws DomainException
3034
-     * @throws EE_Error
3035
-     */
3036
-    public function admin_page_wrapper($about = false)
3037
-    {
3038
-        do_action('AHEE_log', __FILE__, __FUNCTION__, '');
3039
-        $this->_nav_tabs                                   = $this->_get_main_nav_tabs();
3040
-        $this->_template_args['nav_tabs']                  = $this->_nav_tabs;
3041
-        $this->_template_args['admin_page_title']          = $this->_admin_page_title;
3042
-
3043
-        $this->_template_args['before_admin_page_content'] = apply_filters(
3044
-            "FHEE_before_admin_page_content{$this->_current_page}{$this->_current_view}",
3045
-            isset($this->_template_args['before_admin_page_content'])
3046
-                ? $this->_template_args['before_admin_page_content']
3047
-                : ''
3048
-        );
3049
-
3050
-        $this->_template_args['after_admin_page_content']  = apply_filters(
3051
-            "FHEE_after_admin_page_content{$this->_current_page}{$this->_current_view}",
3052
-            isset($this->_template_args['after_admin_page_content'])
3053
-                ? $this->_template_args['after_admin_page_content']
3054
-                : ''
3055
-        );
3056
-        $this->_template_args['after_admin_page_content']  .= $this->_set_help_popup_content();
3057
-
3058
-        if ($this->request->isAjax()) {
3059
-            $this->_template_args['admin_page_content'] = EEH_Template::display_template(
3060
-                // $template_path,
3061
-                EE_ADMIN_TEMPLATE . 'admin_wrapper_ajax.template.php',
3062
-                $this->_template_args,
3063
-                true
3064
-            );
3065
-            $this->_return_json();
3066
-        }
3067
-        // load settings page wrapper template
3068
-        $template_path = $about
3069
-            ? EE_ADMIN_TEMPLATE . 'about_admin_wrapper.template.php'
3070
-            : EE_ADMIN_TEMPLATE . 'admin_wrapper.template.php';
3071
-
3072
-        EEH_Template::display_template($template_path, $this->_template_args);
3073
-    }
3074
-
3075
-
3076
-    /**
3077
-     * This returns the admin_nav tabs html using the configuration in the _nav_tabs property
3078
-     *
3079
-     * @return string html
3080
-     * @throws EE_Error
3081
-     */
3082
-    protected function _get_main_nav_tabs()
3083
-    {
3084
-        // let's generate the html using the EEH_Tabbed_Content helper.
3085
-        // We do this here so that it's possible for child classes to add in nav tabs dynamically at the last minute
3086
-        // (rather than setting in the page_routes array)
3087
-        return EEH_Tabbed_Content::display_admin_nav_tabs($this->_nav_tabs);
3088
-    }
3089
-
3090
-
3091
-    /**
3092
-     *        sort nav tabs
3093
-     *
3094
-     * @param $a
3095
-     * @param $b
3096
-     * @return int
3097
-     */
3098
-    private function _sort_nav_tabs($a, $b)
3099
-    {
3100
-        if ($a['order'] === $b['order']) {
3101
-            return 0;
3102
-        }
3103
-        return ($a['order'] < $b['order']) ? -1 : 1;
3104
-    }
3105
-
3106
-
3107
-    /**
3108
-     *    generates HTML for the forms used on admin pages
3109
-     *
3110
-     * @param array  $input_vars   - array of input field details
3111
-     * @param string $generator    (options are 'string' or 'array', basically use this to indicate which generator to
3112
-     *                             use)
3113
-     * @param bool   $id
3114
-     * @return array|string
3115
-     * @uses   EEH_Form_Fields::get_form_fields (/helper/EEH_Form_Fields.helper.php)
3116
-     * @uses   EEH_Form_Fields::get_form_fields_array (/helper/EEH_Form_Fields.helper.php)
3117
-     */
3118
-    protected function _generate_admin_form_fields($input_vars = [], $generator = 'string', $id = false)
3119
-    {
3120
-        return $generator === 'string'
3121
-            ? EEH_Form_Fields::get_form_fields($input_vars, $id)
3122
-            : EEH_Form_Fields::get_form_fields_array($input_vars);
3123
-    }
3124
-
3125
-
3126
-    /**
3127
-     * generates the "Save" and "Save & Close" buttons for edit forms
3128
-     *
3129
-     * @param bool             $both     if true then both buttons will be generated.  If false then just the "Save &
3130
-     *                                   Close" button.
3131
-     * @param array            $text     if included, generator will use the given text for the buttons ( array([0] =>
3132
-     *                                   'Save', [1] => 'save & close')
3133
-     * @param array            $actions  if included allows us to set the actions that each button will carry out (i.e.
3134
-     *                                   via the "name" value in the button).  We can also use this to just dump
3135
-     *                                   default actions by submitting some other value.
3136
-     * @param bool|string|null $referrer if false then we just do the default action on save and close.  Other wise it
3137
-     *                                   will use the $referrer string. IF null, then we don't do ANYTHING on save and
3138
-     *                                   close (normal form handling).
3139
-     */
3140
-    protected function _set_save_buttons($both = true, $text = [], $actions = [], $referrer = null)
3141
-    {
3142
-        // make sure $text and $actions are in an array
3143
-        $text          = (array) $text;
3144
-        $actions       = (array) $actions;
3145
-        $referrer_url  = ! empty($referrer) ? $referrer : $this->request->getServerParam('REQUEST_URI');
3146
-        $button_text   = ! empty($text)
3147
-            ? $text
3148
-            : [
3149
-                esc_html__('Save', 'event_espresso'),
3150
-                esc_html__('Save and Close', 'event_espresso'),
3151
-            ];
3152
-        $default_names = ['save', 'save_and_close'];
3153
-        $buttons = '';
3154
-        foreach ($button_text as $key => $button) {
3155
-            $ref     = $default_names[ $key ];
3156
-            $name    = ! empty($actions) ? $actions[ $key ] : $ref;
3157
-            $buttons .= '<input type="submit" class="button-primary ' . $ref . '" '
3158
-                        . 'value="' . $button . '" name="' . $name . '" '
3159
-                        . 'id="' . $this->_current_view . '_' . $ref . '" />';
3160
-            if (! $both) {
3161
-                break;
3162
-            }
3163
-        }
3164
-        // add in a hidden index for the current page (so save and close redirects properly)
3165
-        $buttons .= '<input type="hidden" id="save_and_close_referrer" name="save_and_close_referrer" value="'
3166
-                   . $referrer_url
3167
-                   . '" />';
3168
-        $this->_template_args['save_buttons'] = $buttons;
3169
-    }
3170
-
3171
-
3172
-    /**
3173
-     * Wrapper for the protected function.  Allows plugins/addons to call this to set the form tags.
3174
-     *
3175
-     * @param string $route
3176
-     * @param array  $additional_hidden_fields
3177
-     * @see   $this->_set_add_edit_form_tags() for details on params
3178
-     * @since 4.6.0
3179
-     */
3180
-    public function set_add_edit_form_tags($route = '', $additional_hidden_fields = [])
3181
-    {
3182
-        $this->_set_add_edit_form_tags($route, $additional_hidden_fields);
3183
-    }
3184
-
3185
-
3186
-    /**
3187
-     * set form open and close tags on add/edit pages.
3188
-     *
3189
-     * @param string $route                    the route you want the form to direct to
3190
-     * @param array  $additional_hidden_fields any additional hidden fields required in the form header
3191
-     * @return void
3192
-     */
3193
-    protected function _set_add_edit_form_tags($route = '', $additional_hidden_fields = [])
3194
-    {
3195
-        if (empty($route)) {
3196
-            $user_msg = esc_html__(
3197
-                'An error occurred. No action was set for this page\'s form.',
3198
-                'event_espresso'
3199
-            );
3200
-            $dev_msg  = $user_msg . "\n"
3201
-                        . sprintf(
3202
-                            esc_html__('The $route argument is required for the %s->%s method.', 'event_espresso'),
3203
-                            __FUNCTION__,
3204
-                            __CLASS__
3205
-                        );
3206
-            EE_Error::add_error($user_msg . '||' . $dev_msg, __FILE__, __FUNCTION__, __LINE__);
3207
-        }
3208
-        // open form
3209
-        $this->_template_args['before_admin_page_content'] = '<form name="form" method="post" action="'
3210
-                                                             . $this->_admin_base_url
3211
-                                                             . '" id="'
3212
-                                                             . $route
3213
-                                                             . '_event_form" >';
3214
-        // add nonce
3215
-        $nonce                                             =
3216
-            wp_nonce_field($route . '_nonce', $route . '_nonce', false, false);
3217
-        $this->_template_args['before_admin_page_content'] .= "\n\t" . $nonce;
3218
-        // add REQUIRED form action
3219
-        $hidden_fields = [
3220
-            'action' => ['type' => 'hidden', 'value' => $route],
3221
-        ];
3222
-        // merge arrays
3223
-        $hidden_fields = is_array($additional_hidden_fields)
3224
-            ? array_merge($hidden_fields, $additional_hidden_fields)
3225
-            : $hidden_fields;
3226
-        // generate form fields
3227
-        $form_fields = $this->_generate_admin_form_fields($hidden_fields, 'array');
3228
-        // add fields to form
3229
-        foreach ((array) $form_fields as $form_field) {
3230
-            $this->_template_args['before_admin_page_content'] .= "\n\t" . $form_field['field'];
3231
-        }
3232
-        // close form
3233
-        $this->_template_args['after_admin_page_content'] = '</form>';
3234
-    }
3235
-
3236
-
3237
-    /**
3238
-     * Public Wrapper for _redirect_after_action() method since its
3239
-     * discovered it would be useful for external code to have access.
3240
-     *
3241
-     * @param bool   $success
3242
-     * @param string $what
3243
-     * @param string $action_desc
3244
-     * @param array  $query_args
3245
-     * @param bool   $override_overwrite
3246
-     * @throws EE_Error
3247
-     * @see   EE_Admin_Page::_redirect_after_action() for params.
3248
-     * @since 4.5.0
3249
-     */
3250
-    public function redirect_after_action(
3251
-        $success = false,
3252
-        $what = 'item',
3253
-        $action_desc = 'processed',
3254
-        $query_args = [],
3255
-        $override_overwrite = false
3256
-    ) {
3257
-        $this->_redirect_after_action(
3258
-            $success,
3259
-            $what,
3260
-            $action_desc,
3261
-            $query_args,
3262
-            $override_overwrite
3263
-        );
3264
-    }
3265
-
3266
-
3267
-    /**
3268
-     * Helper method for merging existing request data with the returned redirect url.
3269
-     *
3270
-     * This is typically used for redirects after an action so that if the original view was a filtered view those
3271
-     * filters are still applied.
3272
-     *
3273
-     * @param array $new_route_data
3274
-     * @return array
3275
-     */
3276
-    protected function mergeExistingRequestParamsWithRedirectArgs(array $new_route_data)
3277
-    {
3278
-        foreach ($this->request->requestParams() as $ref => $value) {
3279
-            // unset nonces
3280
-            if (strpos($ref, 'nonce') !== false) {
3281
-                $this->request->unSetRequestParam($ref);
3282
-                continue;
3283
-            }
3284
-            // urlencode values.
3285
-            $value = is_array($value) ? array_map('urlencode', $value) : urlencode($value);
3286
-            $this->request->setRequestParam($ref, $value);
3287
-        }
3288
-        return array_merge($this->request->requestParams(), $new_route_data);
3289
-    }
3290
-
3291
-
3292
-    /**
3293
-     *    _redirect_after_action
3294
-     *
3295
-     * @param int    $success            - whether success was for two or more records, or just one, or none
3296
-     * @param string $what               - what the action was performed on
3297
-     * @param string $action_desc        - what was done ie: updated, deleted, etc
3298
-     * @param array  $query_args         - an array of query_args to be added to the URL to redirect to after the admin
3299
-     *                                   action is completed
3300
-     * @param BOOL   $override_overwrite by default all EE_Error::success messages are overwritten, this allows you to
3301
-     *                                   override this so that they show.
3302
-     * @return void
3303
-     * @throws EE_Error
3304
-     */
3305
-    protected function _redirect_after_action(
3306
-        $success = 0,
3307
-        $what = 'item',
3308
-        $action_desc = 'processed',
3309
-        $query_args = [],
3310
-        $override_overwrite = false
3311
-    ) {
3312
-        do_action('AHEE_log', __FILE__, __FUNCTION__, '');
3313
-        // class name for actions/filters.
3314
-        $classname = get_class($this);
3315
-        // set redirect url.
3316
-        // Note if there is a "page" index in the $query_args then we go with vanilla admin.php route,
3317
-        // otherwise we go with whatever is set as the _admin_base_url
3318
-        $redirect_url = isset($query_args['page']) ? admin_url('admin.php') : $this->_admin_base_url;
3319
-        $notices      = EE_Error::get_notices(false);
3320
-        // overwrite default success messages //BUT ONLY if overwrite not overridden
3321
-        if (! $override_overwrite || ! empty($notices['errors'])) {
3322
-            EE_Error::overwrite_success();
3323
-        }
3324
-        if (! empty($what) && ! empty($action_desc) && empty($notices['errors'])) {
3325
-            // how many records affected ? more than one record ? or just one ?
3326
-            if ($success > 1) {
3327
-                // set plural msg
3328
-                EE_Error::add_success(
3329
-                    sprintf(
3330
-                        esc_html__('The "%s" have been successfully %s.', 'event_espresso'),
3331
-                        $what,
3332
-                        $action_desc
3333
-                    ),
3334
-                    __FILE__,
3335
-                    __FUNCTION__,
3336
-                    __LINE__
3337
-                );
3338
-            } elseif ($success === 1) {
3339
-                // set singular msg
3340
-                EE_Error::add_success(
3341
-                    sprintf(
3342
-                        esc_html__('The "%s" has been successfully %s.', 'event_espresso'),
3343
-                        $what,
3344
-                        $action_desc
3345
-                    ),
3346
-                    __FILE__,
3347
-                    __FUNCTION__,
3348
-                    __LINE__
3349
-                );
3350
-            }
3351
-        }
3352
-        // check that $query_args isn't something crazy
3353
-        if (! is_array($query_args)) {
3354
-            $query_args = [];
3355
-        }
3356
-        /**
3357
-         * Allow injecting actions before the query_args are modified for possible different
3358
-         * redirections on save and close actions
3359
-         *
3360
-         * @param array $query_args       The original query_args array coming into the
3361
-         *                                method.
3362
-         * @since 4.2.0
3363
-         */
3364
-        do_action(
3365
-            "AHEE__{$classname}___redirect_after_action__before_redirect_modification_{$this->_req_action}",
3366
-            $query_args
3367
-        );
3368
-        // calculate where we're going (if we have a "save and close" button pushed)
3369
-
3370
-        if (
3371
-            $this->request->requestParamIsSet('save_and_close')
3372
-            && $this->request->requestParamIsSet('save_and_close_referrer')
3373
-        ) {
3374
-            // even though we have the save_and_close referrer, we need to parse the url for the action in order to generate a nonce
3375
-            $parsed_url = parse_url($this->request->getRequestParam('save_and_close_referrer', '', 'url'));
3376
-            // regenerate query args array from referrer URL
3377
-            parse_str($parsed_url['query'], $query_args);
3378
-            // correct page and action will be in the query args now
3379
-            $redirect_url = admin_url('admin.php');
3380
-        }
3381
-        // merge any default query_args set in _default_route_query_args property
3382
-        if (! empty($this->_default_route_query_args) && ! $this->_is_UI_request) {
3383
-            $args_to_merge = [];
3384
-            foreach ($this->_default_route_query_args as $query_param => $query_value) {
3385
-                // is there a wp_referer array in our _default_route_query_args property?
3386
-                if ($query_param === 'wp_referer') {
3387
-                    $query_value = (array) $query_value;
3388
-                    foreach ($query_value as $reference => $value) {
3389
-                        if (strpos($reference, 'nonce') !== false) {
3390
-                            continue;
3391
-                        }
3392
-                        // finally we will override any arguments in the referer with
3393
-                        // what might be set on the _default_route_query_args array.
3394
-                        if (isset($this->_default_route_query_args[ $reference ])) {
3395
-                            $args_to_merge[ $reference ] = urlencode($this->_default_route_query_args[ $reference ]);
3396
-                        } else {
3397
-                            $args_to_merge[ $reference ] = urlencode($value);
3398
-                        }
3399
-                    }
3400
-                    continue;
3401
-                }
3402
-                $args_to_merge[ $query_param ] = $query_value;
3403
-            }
3404
-            // now let's merge these arguments but override with what was specifically sent in to the
3405
-            // redirect.
3406
-            $query_args = array_merge($args_to_merge, $query_args);
3407
-        }
3408
-        $this->_process_notices($query_args);
3409
-        // generate redirect url
3410
-        // if redirecting to anything other than the main page, add a nonce
3411
-        if (isset($query_args['action'])) {
3412
-            // manually generate wp_nonce and merge that with the query vars
3413
-            // becuz the wp_nonce_url function wrecks havoc on some vars
3414
-            $query_args['_wpnonce'] = wp_create_nonce($query_args['action'] . '_nonce');
3415
-        }
3416
-        // we're adding some hooks and filters in here for processing any things just before redirects
3417
-        // (example: an admin page has done an insert or update and we want to run something after that).
3418
-        do_action('AHEE_redirect_' . $classname . $this->_req_action, $query_args);
3419
-        $redirect_url = apply_filters(
3420
-            'FHEE_redirect_' . $classname . $this->_req_action,
3421
-            self::add_query_args_and_nonce($query_args, $redirect_url),
3422
-            $query_args
3423
-        );
3424
-        // check if we're doing ajax.  If we are then lets just return the results and js can handle how it wants.
3425
-        if ($this->request->isAjax()) {
3426
-            $default_data                    = [
3427
-                'close'        => true,
3428
-                'redirect_url' => $redirect_url,
3429
-                'where'        => 'main',
3430
-                'what'         => 'append',
3431
-            ];
3432
-            $this->_template_args['success'] = $success;
3433
-            $this->_template_args['data']    = ! empty($this->_template_args['data']) ? array_merge(
3434
-                $default_data,
3435
-                $this->_template_args['data']
3436
-            ) : $default_data;
3437
-            $this->_return_json();
3438
-        }
3439
-        wp_safe_redirect($redirect_url);
3440
-        exit();
3441
-    }
3442
-
3443
-
3444
-    /**
3445
-     * process any notices before redirecting (or returning ajax request)
3446
-     * This method sets the $this->_template_args['notices'] attribute;
3447
-     *
3448
-     * @param array $query_args         any query args that need to be used for notice transient ('action')
3449
-     * @param bool  $skip_route_verify  This is typically used when we are processing notices REALLY early and
3450
-     *                                  page_routes haven't been defined yet.
3451
-     * @param bool  $sticky_notices     This is used to flag that regardless of whether this is doing_ajax or not, we
3452
-     *                                  still save a transient for the notice.
3453
-     * @return void
3454
-     * @throws EE_Error
3455
-     */
3456
-    protected function _process_notices($query_args = [], $skip_route_verify = false, $sticky_notices = true)
3457
-    {
3458
-        // first let's set individual error properties if doing_ajax and the properties aren't already set.
3459
-        if ($this->request->isAjax()) {
3460
-            $notices = EE_Error::get_notices(false);
3461
-            if (empty($this->_template_args['success'])) {
3462
-                $this->_template_args['success'] = isset($notices['success']) ? $notices['success'] : false;
3463
-            }
3464
-            if (empty($this->_template_args['errors'])) {
3465
-                $this->_template_args['errors'] = isset($notices['errors']) ? $notices['errors'] : false;
3466
-            }
3467
-            if (empty($this->_template_args['attention'])) {
3468
-                $this->_template_args['attention'] = isset($notices['attention']) ? $notices['attention'] : false;
3469
-            }
3470
-        }
3471
-        $this->_template_args['notices'] = EE_Error::get_notices();
3472
-        // IF this isn't ajax we need to create a transient for the notices using the route (however, overridden if $sticky_notices == true)
3473
-        if (! $this->request->isAjax() || $sticky_notices) {
3474
-            $route = isset($query_args['action']) ? $query_args['action'] : 'default';
3475
-            $this->_add_transient(
3476
-                $route,
3477
-                $this->_template_args['notices'],
3478
-                true,
3479
-                $skip_route_verify
3480
-            );
3481
-        }
3482
-    }
3483
-
3484
-
3485
-    /**
3486
-     * get_action_link_or_button
3487
-     * returns the button html for adding, editing, or deleting an item (depending on given type)
3488
-     *
3489
-     * @param string $action        use this to indicate which action the url is generated with.
3490
-     * @param string $type          accepted strings must be defined in the $_labels['button'] array(as the key)
3491
-     *                              property.
3492
-     * @param array  $extra_request if the button requires extra params you can include them in $key=>$value pairs.
3493
-     * @param string $class         Use this to give the class for the button. Defaults to 'button-primary'
3494
-     * @param string $base_url      If this is not provided
3495
-     *                              the _admin_base_url will be used as the default for the button base_url.
3496
-     *                              Otherwise this value will be used.
3497
-     * @param bool   $exclude_nonce If true then no nonce will be in the generated button link.
3498
-     * @return string
3499
-     * @throws InvalidArgumentException
3500
-     * @throws InvalidInterfaceException
3501
-     * @throws InvalidDataTypeException
3502
-     * @throws EE_Error
3503
-     */
3504
-    public function get_action_link_or_button(
3505
-        $action,
3506
-        $type = 'add',
3507
-        $extra_request = [],
3508
-        $class = 'button-primary',
3509
-        $base_url = '',
3510
-        $exclude_nonce = false
3511
-    ) {
3512
-        // first let's validate the action (if $base_url is FALSE otherwise validation will happen further along)
3513
-        if (empty($base_url) && ! isset($this->_page_routes[ $action ])) {
3514
-            throw new EE_Error(
3515
-                sprintf(
3516
-                    esc_html__(
3517
-                        'There is no page route for given action for the button.  This action was given: %s',
3518
-                        'event_espresso'
3519
-                    ),
3520
-                    $action
3521
-                )
3522
-            );
3523
-        }
3524
-        if (! isset($this->_labels['buttons'][ $type ])) {
3525
-            throw new EE_Error(
3526
-                sprintf(
3527
-                    esc_html__(
3528
-                        'There is no label for the given button type (%s). Labels are set in the <code>_page_config</code> property.',
3529
-                        'event_espresso'
3530
-                    ),
3531
-                    $type
3532
-                )
3533
-            );
3534
-        }
3535
-        // finally check user access for this button.
3536
-        $has_access = $this->check_user_access($action, true);
3537
-        if (! $has_access) {
3538
-            return '';
3539
-        }
3540
-        $_base_url  = ! $base_url ? $this->_admin_base_url : $base_url;
3541
-        $query_args = [
3542
-            'action' => $action,
3543
-        ];
3544
-        // merge extra_request args but make sure our original action takes precedence and doesn't get overwritten.
3545
-        if (! empty($extra_request)) {
3546
-            $query_args = array_merge($extra_request, $query_args);
3547
-        }
3548
-        $url = self::add_query_args_and_nonce($query_args, $_base_url, false, $exclude_nonce);
3549
-        return EEH_Template::get_button_or_link($url, $this->_labels['buttons'][ $type ], $class);
3550
-    }
3551
-
3552
-
3553
-    /**
3554
-     * _per_page_screen_option
3555
-     * Utility function for adding in a per_page_option in the screen_options_dropdown.
3556
-     *
3557
-     * @return void
3558
-     * @throws InvalidArgumentException
3559
-     * @throws InvalidInterfaceException
3560
-     * @throws InvalidDataTypeException
3561
-     */
3562
-    protected function _per_page_screen_option()
3563
-    {
3564
-        $option = 'per_page';
3565
-        $args   = [
3566
-            'label'   => apply_filters(
3567
-                'FHEE__EE_Admin_Page___per_page_screen_options___label',
3568
-                $this->_admin_page_title,
3569
-                $this
3570
-            ),
3571
-            'default' => (int) apply_filters(
3572
-                'FHEE__EE_Admin_Page___per_page_screen_options__default',
3573
-                20
3574
-            ),
3575
-            'option'  => $this->_current_page . '_' . $this->_current_view . '_per_page',
3576
-        ];
3577
-        // ONLY add the screen option if the user has access to it.
3578
-        if ($this->check_user_access($this->_current_view, true)) {
3579
-            add_screen_option($option, $args);
3580
-        }
3581
-    }
3582
-
3583
-
3584
-    /**
3585
-     * set_per_page_screen_option
3586
-     * All this does is make sure that WordPress saves any per_page screen options (if set) for the current page.
3587
-     * we have to do this rather than running inside the 'set-screen-options' hook because it runs earlier than
3588
-     * admin_menu.
3589
-     *
3590
-     * @return void
3591
-     */
3592
-    private function _set_per_page_screen_options()
3593
-    {
3594
-        if ($this->request->requestParamIsSet('wp_screen_options')) {
3595
-            check_admin_referer('screen-options-nonce', 'screenoptionnonce');
3596
-            if (! $user = wp_get_current_user()) {
3597
-                return;
3598
-            }
3599
-            $option = $this->request->getRequestParam('wp_screen_options[option]', '', 'key');
3600
-            if (! $option) {
3601
-                return;
3602
-            }
3603
-            $value  = $this->request->getRequestParam('wp_screen_options[value]', 0, 'int');
3604
-            $map_option = $option;
3605
-            $option     = str_replace('-', '_', $option);
3606
-            switch ($map_option) {
3607
-                case $this->_current_page . '_' . $this->_current_view . '_per_page':
3608
-                    $max_value = apply_filters(
3609
-                        'FHEE__EE_Admin_Page___set_per_page_screen_options__max_value',
3610
-                        999,
3611
-                        $this->_current_page,
3612
-                        $this->_current_view
3613
-                    );
3614
-                    if ($value < 1) {
3615
-                        return;
3616
-                    }
3617
-                    $value = min($value, $max_value);
3618
-                    break;
3619
-                default:
3620
-                    $value = apply_filters(
3621
-                        'FHEE__EE_Admin_Page___set_per_page_screen_options__value',
3622
-                        false,
3623
-                        $option,
3624
-                        $value
3625
-                    );
3626
-                    if (false === $value) {
3627
-                        return;
3628
-                    }
3629
-                    break;
3630
-            }
3631
-            update_user_meta($user->ID, $option, $value);
3632
-            wp_safe_redirect(remove_query_arg(['pagenum', 'apage', 'paged'], wp_get_referer()));
3633
-            exit;
3634
-        }
3635
-    }
3636
-
3637
-
3638
-    /**
3639
-     * This just allows for setting the $_template_args property if it needs to be set outside the object
3640
-     *
3641
-     * @param array $data array that will be assigned to template args.
3642
-     */
3643
-    public function set_template_args($data)
3644
-    {
3645
-        $this->_template_args = array_merge($this->_template_args, (array) $data);
3646
-    }
3647
-
3648
-
3649
-    /**
3650
-     * This makes available the WP transient system for temporarily moving data between routes
3651
-     *
3652
-     * @param string $route             the route that should receive the transient
3653
-     * @param array  $data              the data that gets sent
3654
-     * @param bool   $notices           If this is for notices then we use this to indicate so, otherwise its just a
3655
-     *                                  normal route transient.
3656
-     * @param bool   $skip_route_verify Used to indicate we want to skip route verification.  This is usually ONLY used
3657
-     *                                  when we are adding a transient before page_routes have been defined.
3658
-     * @return void
3659
-     * @throws EE_Error
3660
-     */
3661
-    protected function _add_transient($route, $data, $notices = false, $skip_route_verify = false)
3662
-    {
3663
-        $user_id = get_current_user_id();
3664
-        if (! $skip_route_verify) {
3665
-            $this->_verify_route($route);
3666
-        }
3667
-        // now let's set the string for what kind of transient we're setting
3668
-        $transient = $notices
3669
-            ? 'ee_rte_n_tx_' . $route . '_' . $user_id
3670
-            : 'rte_tx_' . $route . '_' . $user_id;
3671
-        $data      = $notices ? ['notices' => $data] : $data;
3672
-        // is there already a transient for this route?  If there is then let's ADD to that transient
3673
-        $existing = is_multisite() && is_network_admin()
3674
-            ? get_site_transient($transient)
3675
-            : get_transient($transient);
3676
-        if ($existing) {
3677
-            $data = array_merge((array) $data, (array) $existing);
3678
-        }
3679
-        if (is_multisite() && is_network_admin()) {
3680
-            set_site_transient($transient, $data, 8);
3681
-        } else {
3682
-            set_transient($transient, $data, 8);
3683
-        }
3684
-    }
3685
-
3686
-
3687
-    /**
3688
-     * this retrieves the temporary transient that has been set for moving data between routes.
3689
-     *
3690
-     * @param bool   $notices true we get notices transient. False we just return normal route transient
3691
-     * @param string $route
3692
-     * @return mixed data
3693
-     */
3694
-    protected function _get_transient($notices = false, $route = '')
3695
-    {
3696
-        $user_id   = get_current_user_id();
3697
-        $route     = ! $route ? $this->_req_action : $route;
3698
-        $transient = $notices
3699
-            ? 'ee_rte_n_tx_' . $route . '_' . $user_id
3700
-            : 'rte_tx_' . $route . '_' . $user_id;
3701
-        $data      = is_multisite() && is_network_admin()
3702
-            ? get_site_transient($transient)
3703
-            : get_transient($transient);
3704
-        // delete transient after retrieval (just in case it hasn't expired);
3705
-        if (is_multisite() && is_network_admin()) {
3706
-            delete_site_transient($transient);
3707
-        } else {
3708
-            delete_transient($transient);
3709
-        }
3710
-        return $notices && isset($data['notices']) ? $data['notices'] : $data;
3711
-    }
3712
-
3713
-
3714
-    /**
3715
-     * The purpose of this method is just to run garbage collection on any EE transients that might have expired but
3716
-     * would not be called later. This will be assigned to run on a specific EE Admin page. (place the method in the
3717
-     * default route callback on the EE_Admin page you want it run.)
3718
-     *
3719
-     * @return void
3720
-     */
3721
-    protected function _transient_garbage_collection()
3722
-    {
3723
-        global $wpdb;
3724
-        // retrieve all existing transients
3725
-        $query =
3726
-            "SELECT option_name FROM {$wpdb->options} WHERE option_name LIKE '%rte_tx_%' OR option_name LIKE '%rte_n_tx_%'";
3727
-        if ($results = $wpdb->get_results($query)) {
3728
-            foreach ($results as $result) {
3729
-                $transient = str_replace('_transient_', '', $result->option_name);
3730
-                get_transient($transient);
3731
-                if (is_multisite() && is_network_admin()) {
3732
-                    get_site_transient($transient);
3733
-                }
3734
-            }
3735
-        }
3736
-    }
3737
-
3738
-
3739
-    /**
3740
-     * get_view
3741
-     *
3742
-     * @return string content of _view property
3743
-     */
3744
-    public function get_view()
3745
-    {
3746
-        return $this->_view;
3747
-    }
3748
-
3749
-
3750
-    /**
3751
-     * getter for the protected $_views property
3752
-     *
3753
-     * @return array
3754
-     */
3755
-    public function get_views()
3756
-    {
3757
-        return $this->_views;
3758
-    }
3759
-
3760
-
3761
-    /**
3762
-     * get_current_page
3763
-     *
3764
-     * @return string _current_page property value
3765
-     */
3766
-    public function get_current_page()
3767
-    {
3768
-        return $this->_current_page;
3769
-    }
3770
-
3771
-
3772
-    /**
3773
-     * get_current_view
3774
-     *
3775
-     * @return string _current_view property value
3776
-     */
3777
-    public function get_current_view()
3778
-    {
3779
-        return $this->_current_view;
3780
-    }
3781
-
3782
-
3783
-    /**
3784
-     * get_current_screen
3785
-     *
3786
-     * @return object The current WP_Screen object
3787
-     */
3788
-    public function get_current_screen()
3789
-    {
3790
-        return $this->_current_screen;
3791
-    }
3792
-
3793
-
3794
-    /**
3795
-     * get_current_page_view_url
3796
-     *
3797
-     * @return string This returns the url for the current_page_view.
3798
-     */
3799
-    public function get_current_page_view_url()
3800
-    {
3801
-        return $this->_current_page_view_url;
3802
-    }
3803
-
3804
-
3805
-    /**
3806
-     * just returns the Request
3807
-     *
3808
-     * @return RequestInterface
3809
-     */
3810
-    public function get_request()
3811
-    {
3812
-        return $this->request;
3813
-    }
3814
-
3815
-
3816
-    /**
3817
-     * just returns the _req_data property
3818
-     *
3819
-     * @return array
3820
-     */
3821
-    public function get_request_data()
3822
-    {
3823
-        return $this->request->requestParams();
3824
-    }
3825
-
3826
-
3827
-    /**
3828
-     * returns the _req_data protected property
3829
-     *
3830
-     * @return string
3831
-     */
3832
-    public function get_req_action()
3833
-    {
3834
-        return $this->_req_action;
3835
-    }
3836
-
3837
-
3838
-    /**
3839
-     * @return bool  value of $_is_caf property
3840
-     */
3841
-    public function is_caf()
3842
-    {
3843
-        return $this->_is_caf;
3844
-    }
3845
-
3846
-
3847
-    /**
3848
-     * @return mixed
3849
-     */
3850
-    public function default_espresso_metaboxes()
3851
-    {
3852
-        return $this->_default_espresso_metaboxes;
3853
-    }
3854
-
3855
-
3856
-    /**
3857
-     * @return mixed
3858
-     */
3859
-    public function admin_base_url()
3860
-    {
3861
-        return $this->_admin_base_url;
3862
-    }
3863
-
3864
-
3865
-    /**
3866
-     * @return mixed
3867
-     */
3868
-    public function wp_page_slug()
3869
-    {
3870
-        return $this->_wp_page_slug;
3871
-    }
3872
-
3873
-
3874
-    /**
3875
-     * updates  espresso configuration settings
3876
-     *
3877
-     * @param string                   $tab
3878
-     * @param EE_Config_Base|EE_Config $config
3879
-     * @param string                   $file file where error occurred
3880
-     * @param string                   $func function  where error occurred
3881
-     * @param string                   $line line no where error occurred
3882
-     * @return boolean
3883
-     */
3884
-    protected function _update_espresso_configuration($tab, $config, $file = '', $func = '', $line = '')
3885
-    {
3886
-        // remove any options that are NOT going to be saved with the config settings.
3887
-        if (isset($config->core->ee_ueip_optin)) {
3888
-            // TODO: remove the following two lines and make sure values are migrated from 3.1
3889
-            update_option('ee_ueip_optin', $config->core->ee_ueip_optin);
3890
-            update_option('ee_ueip_has_notified', true);
3891
-        }
3892
-        // and save it (note we're also doing the network save here)
3893
-        $net_saved    = ! is_main_site() || EE_Network_Config::instance()->update_config(false, false);
3894
-        $config_saved = EE_Config::instance()->update_espresso_config(false, false);
3895
-        if ($config_saved && $net_saved) {
3896
-            EE_Error::add_success(sprintf(esc_html__('"%s" have been successfully updated.', 'event_espresso'), $tab));
3897
-            return true;
3898
-        }
3899
-        EE_Error::add_error(sprintf(esc_html__('The "%s" were not updated.', 'event_espresso'), $tab), $file, $func, $line);
3900
-        return false;
3901
-    }
3902
-
3903
-
3904
-    /**
3905
-     * Returns an array to be used for EE_FOrm_Fields.helper.php's select_input as the $values argument.
3906
-     *
3907
-     * @return array
3908
-     */
3909
-    public function get_yes_no_values()
3910
-    {
3911
-        return $this->_yes_no_values;
3912
-    }
3913
-
3914
-
3915
-    protected function _get_dir()
3916
-    {
3917
-        $reflector = new ReflectionClass(get_class($this));
3918
-        return dirname($reflector->getFileName());
3919
-    }
3920
-
3921
-
3922
-    /**
3923
-     * A helper for getting a "next link".
3924
-     *
3925
-     * @param string $url   The url to link to
3926
-     * @param string $class The class to use.
3927
-     * @return string
3928
-     */
3929
-    protected function _next_link($url, $class = 'dashicons dashicons-arrow-right')
3930
-    {
3931
-        return '<a class="' . $class . '" href="' . $url . '"></a>';
3932
-    }
3933
-
3934
-
3935
-    /**
3936
-     * A helper for getting a "previous link".
3937
-     *
3938
-     * @param string $url   The url to link to
3939
-     * @param string $class The class to use.
3940
-     * @return string
3941
-     */
3942
-    protected function _previous_link($url, $class = 'dashicons dashicons-arrow-left')
3943
-    {
3944
-        return '<a class="' . $class . '" href="' . $url . '"></a>';
3945
-    }
3946
-
3947
-
3948
-
3949
-
3950
-
3951
-
3952
-
3953
-    // below are some messages related methods that should be available across the EE_Admin system.  Note, these methods are NOT page specific
3954
-
3955
-
3956
-    /**
3957
-     * This processes an request to resend a registration and assumes we have a _REG_ID for doing so. So if the caller
3958
-     * knows that the _REG_ID isn't in the req_data array but CAN obtain it, the caller should ADD the _REG_ID to the
3959
-     * _req_data array.
3960
-     *
3961
-     * @return bool success/fail
3962
-     * @throws EE_Error
3963
-     * @throws InvalidArgumentException
3964
-     * @throws ReflectionException
3965
-     * @throws InvalidDataTypeException
3966
-     * @throws InvalidInterfaceException
3967
-     */
3968
-    protected function _process_resend_registration()
3969
-    {
3970
-        $this->_template_args['success'] = EED_Messages::process_resend($this->_req_data);
3971
-        do_action(
3972
-            'AHEE__EE_Admin_Page___process_resend_registration',
3973
-            $this->_template_args['success'],
3974
-            $this->request->requestParams()
3975
-        );
3976
-        return $this->_template_args['success'];
3977
-    }
3978
-
3979
-
3980
-    /**
3981
-     * This automatically processes any payment message notifications when manual payment has been applied.
3982
-     *
3983
-     * @param EE_Payment $payment
3984
-     * @return bool success/fail
3985
-     */
3986
-    protected function _process_payment_notification(EE_Payment $payment)
3987
-    {
3988
-        add_filter('FHEE__EE_Payment_Processor__process_registration_payments__display_notifications', '__return_true');
3989
-        do_action('AHEE__EE_Admin_Page___process_admin_payment_notification', $payment);
3990
-        $this->_template_args['success'] = apply_filters(
3991
-            'FHEE__EE_Admin_Page___process_admin_payment_notification__success',
3992
-            false,
3993
-            $payment
3994
-        );
3995
-        return $this->_template_args['success'];
3996
-    }
3997
-
3998
-
3999
-    /**
4000
-     * @param EEM_Base      $entity_model
4001
-     * @param string        $entity_PK_name name of the primary key field used as a request param, ie: id, ID, etc
4002
-     * @param string        $action         one of the EE_Admin_List_Table::ACTION_* constants: delete, restore, trash
4003
-     * @param string        $delete_column  name of the field that denotes whether entity is trashed
4004
-     * @param callable|null $callback       called after entity is trashed, restored, or deleted
4005
-     * @return int|float
4006
-     * @throws EE_Error
4007
-     */
4008
-    protected function trashRestoreDeleteEntities(
4009
-        EEM_Base $entity_model,
4010
-        string $entity_PK_name,
4011
-        string $action = EE_Admin_List_Table::ACTION_DELETE,
4012
-        string $delete_column = '',
4013
-        callable $callback = null
4014
-    ) {
4015
-        $entity_PK      = $entity_model->get_primary_key_field();
4016
-        $entity_PK_name = $entity_PK_name ?: $entity_PK->get_name();
4017
-        $entity_PK_type = $this->resolveEntityFieldDataType($entity_PK);
4018
-        // grab ID if deleting a single entity
4019
-        if ($this->request->requestParamIsSet($entity_PK_name)) {
4020
-            $ID = $this->request->getRequestParam($entity_PK_name, 0, $entity_PK_type);
4021
-            return $this->trashRestoreDeleteEntity($entity_model, $ID, $action, $delete_column, $callback) ? 1 : 0;
4022
-        }
4023
-        // or grab checkbox array if bulk deleting
4024
-        $checkboxes = $this->request->getRequestParam('checkbox', [], $entity_PK_type, true);
4025
-        if (empty($checkboxes)) {
4026
-            return 0;
4027
-        }
4028
-        $success = 0;
4029
-        $IDs     = array_keys($checkboxes);
4030
-        // cycle thru bulk action checkboxes
4031
-        foreach ($IDs as $ID) {
4032
-            // increment $success
4033
-            if ($this->trashRestoreDeleteEntity($entity_model, $ID, $action, $delete_column, $callback)) {
4034
-                $success++;
4035
-            }
4036
-        }
4037
-        $count = (int) count($checkboxes);
4038
-        // if multiple entities were deleted successfully, then $deleted will be full count of deletions,
4039
-        // otherwise it will be a fraction of ( actual deletions / total entities to be deleted )
4040
-        return $success === $count ? $count : $success / $count;
4041
-    }
4042
-
4043
-
4044
-    /**
4045
-     * @param EE_Primary_Key_Field_Base $entity_PK
4046
-     * @return string
4047
-     * @throws EE_Error
4048
-     * @since   $VID:$
4049
-     */
4050
-    private function resolveEntityFieldDataType(EE_Primary_Key_Field_Base $entity_PK): string
4051
-    {
4052
-        $entity_PK_type = $entity_PK->getSchemaType();
4053
-        switch ($entity_PK_type) {
4054
-            case 'boolean':
4055
-                return 'bool';
4056
-            case 'integer':
4057
-                return 'int';
4058
-            case 'number':
4059
-                return 'float';
4060
-            case 'string':
4061
-                return 'string';
4062
-        }
4063
-        throw new RuntimeException(
4064
-            sprintf(
4065
-                esc_html__(
4066
-                    '"%1$s" is an invalid schema type for the %2$s primary key.',
4067
-                    'event_espresso'
4068
-                ),
4069
-                $entity_PK_type,
4070
-                $entity_PK->get_name()
4071
-            )
4072
-        );
4073
-    }
4074
-
4075
-
4076
-    /**
4077
-     * @param EEM_Base      $entity_model
4078
-     * @param int|string    $entity_ID
4079
-     * @param string        $action        one of the EE_Admin_List_Table::ACTION_* constants: delete, restore, trash
4080
-     * @param string        $delete_column name of the field that denotes whether entity is trashed
4081
-     * @param callable|null $callback      called after entity is trashed, restored, or deleted
4082
-     * @return bool
4083
-     */
4084
-    protected function trashRestoreDeleteEntity(
4085
-        EEM_Base $entity_model,
4086
-        $entity_ID,
4087
-        string $action,
4088
-        string $delete_column,
4089
-        callable $callback = null
4090
-    ) {
4091
-        $entity_ID = absint($entity_ID);
4092
-        if (! $entity_ID) {
4093
-            $this->trashRestoreDeleteError($action, $entity_model);
4094
-        }
4095
-        $result = 0;
4096
-        try {
4097
-            switch ($action) {
4098
-                case EE_Admin_List_Table::ACTION_DELETE:
4099
-                    $result = (bool) $entity_model->delete_permanently_by_ID($entity_ID);
4100
-                    break;
4101
-                case EE_Admin_List_Table::ACTION_RESTORE:
4102
-                    $this->validateDeleteColumn($entity_model, $delete_column);
4103
-                    $result = $entity_model->update_by_ID([$delete_column => 0], $entity_ID);
4104
-                    break;
4105
-                case EE_Admin_List_Table::ACTION_TRASH:
4106
-                    $this->validateDeleteColumn($entity_model, $delete_column);
4107
-                    $result = $entity_model->update_by_ID([$delete_column => 1], $entity_ID);
4108
-                    break;
4109
-            }
4110
-        } catch (Exception $exception) {
4111
-            $this->trashRestoreDeleteError($action, $entity_model, $exception);
4112
-        }
4113
-        if (is_callable($callback)) {
4114
-            call_user_func_array($callback, [$entity_model, $entity_ID, $action, $result, $delete_column]);
4115
-        }
4116
-        return $result;
4117
-    }
4118
-
4119
-
4120
-    /**
4121
-     * @param EEM_Base $entity_model
4122
-     * @param string   $delete_column
4123
-     * @since $VID:$
4124
-     */
4125
-    private function validateDeleteColumn(EEM_Base $entity_model, string $delete_column)
4126
-    {
4127
-        if (empty($delete_column)) {
4128
-            throw new DomainException(
4129
-                sprintf(
4130
-                    esc_html__(
4131
-                        'You need to specify the name of the "delete column" on the %2$s model, in order to trash or restore an entity.',
4132
-                        'event_espresso'
4133
-                    ),
4134
-                    $entity_model->get_this_model_name()
4135
-                )
4136
-            );
4137
-        }
4138
-        if (! $entity_model->has_field($delete_column)) {
4139
-            throw new DomainException(
4140
-                sprintf(
4141
-                    esc_html__(
4142
-                        'The %1$s field does not exist on the %2$s model.',
4143
-                        'event_espresso'
4144
-                    ),
4145
-                    $delete_column,
4146
-                    $entity_model->get_this_model_name()
4147
-                )
4148
-            );
4149
-        }
4150
-    }
4151
-
4152
-
4153
-    /**
4154
-     * @param EEM_Base       $entity_model
4155
-     * @param Exception|null $exception
4156
-     * @param string         $action
4157
-     * @since $VID:$
4158
-     */
4159
-    private function trashRestoreDeleteError(string $action, EEM_Base $entity_model, ?Exception $exception = null)
4160
-    {
4161
-        if ($exception instanceof Exception) {
4162
-            throw new RuntimeException(
4163
-                sprintf(
4164
-                    esc_html__(
4165
-                        'Could not %1$s the %2$s because the following error occurred: %3$s',
4166
-                        'event_espresso'
4167
-                    ),
4168
-                    $action,
4169
-                    $entity_model->get_this_model_name(),
4170
-                    $exception->getMessage()
4171
-                )
4172
-            );
4173
-        }
4174
-        throw new RuntimeException(
4175
-            sprintf(
4176
-                esc_html__(
4177
-                    'Could not %1$s the %2$s because an invalid ID was received.',
4178
-                    'event_espresso'
4179
-                ),
4180
-                $action,
4181
-                $entity_model->get_this_model_name()
4182
-            )
4183
-        );
4184
-    }
2564
+	}
2565
+
2566
+
2567
+	/**
2568
+	 * facade for add_meta_box
2569
+	 *
2570
+	 * @param string  $action        where the metabox gets displayed
2571
+	 * @param string  $title         Title of Metabox (output in metabox header)
2572
+	 * @param string  $callback      If not empty and $create_fun is set to false then we'll use a custom callback
2573
+	 *                               instead of the one created in here.
2574
+	 * @param array   $callback_args an array of args supplied for the metabox
2575
+	 * @param string  $column        what metabox column
2576
+	 * @param string  $priority      give this metabox a priority (using accepted priorities for wp meta boxes)
2577
+	 * @param boolean $create_func   default is true.  Basically we can say we don't WANT to have the runtime function
2578
+	 *                               created but just set our own callback for wp's add_meta_box.
2579
+	 * @throws DomainException
2580
+	 */
2581
+	public function _add_admin_page_meta_box(
2582
+		$action,
2583
+		$title,
2584
+		$callback,
2585
+		$callback_args,
2586
+		$column = 'normal',
2587
+		$priority = 'high',
2588
+		$create_func = true
2589
+	) {
2590
+		do_action('AHEE_log', __FILE__, __FUNCTION__, $callback);
2591
+		// if we have empty callback args and we want to automatically create the metabox callback then we need to make sure the callback args are generated.
2592
+		if (empty($callback_args) && $create_func) {
2593
+			$callback_args = [
2594
+				'template_path' => $this->_template_path,
2595
+				'template_args' => $this->_template_args,
2596
+			];
2597
+		}
2598
+		// if $create_func is true (default) then we automatically create the function for displaying the actual meta box.  If false then we take the $callback reference passed through and use it instead (so callers can define their own callback function/method if they wish)
2599
+		$call_back_func = $create_func
2600
+			? function ($post, $metabox) {
2601
+				do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2602
+				echo EEH_Template::display_template(
2603
+					$metabox['args']['template_path'],
2604
+					$metabox['args']['template_args'],
2605
+					true
2606
+				);
2607
+			}
2608
+			: $callback;
2609
+		add_meta_box(
2610
+			str_replace('_', '-', $action) . '-mbox',
2611
+			$title,
2612
+			$call_back_func,
2613
+			$this->_wp_page_slug,
2614
+			$column,
2615
+			$priority,
2616
+			$callback_args
2617
+		);
2618
+	}
2619
+
2620
+
2621
+	/**
2622
+	 * generates HTML wrapper for and admin details page that contains metaboxes in columns
2623
+	 *
2624
+	 * @throws DomainException
2625
+	 * @throws EE_Error
2626
+	 */
2627
+	public function display_admin_page_with_metabox_columns()
2628
+	{
2629
+		$this->_template_args['post_body_content']  = $this->_template_args['admin_page_content'];
2630
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template(
2631
+			$this->_column_template_path,
2632
+			$this->_template_args,
2633
+			true
2634
+		);
2635
+		// the final wrapper
2636
+		$this->admin_page_wrapper();
2637
+	}
2638
+
2639
+
2640
+	/**
2641
+	 * generates  HTML wrapper for an admin details page
2642
+	 *
2643
+	 * @return void
2644
+	 * @throws EE_Error
2645
+	 * @throws DomainException
2646
+	 */
2647
+	public function display_admin_page_with_sidebar()
2648
+	{
2649
+		$this->_display_admin_page(true);
2650
+	}
2651
+
2652
+
2653
+	/**
2654
+	 * generates  HTML wrapper for an admin details page (except no sidebar)
2655
+	 *
2656
+	 * @return void
2657
+	 * @throws EE_Error
2658
+	 * @throws DomainException
2659
+	 */
2660
+	public function display_admin_page_with_no_sidebar()
2661
+	{
2662
+		$this->_display_admin_page();
2663
+	}
2664
+
2665
+
2666
+	/**
2667
+	 * generates HTML wrapper for an EE about admin page (no sidebar)
2668
+	 *
2669
+	 * @return void
2670
+	 * @throws EE_Error
2671
+	 * @throws DomainException
2672
+	 */
2673
+	public function display_about_admin_page()
2674
+	{
2675
+		$this->_display_admin_page(false, true);
2676
+	}
2677
+
2678
+
2679
+	/**
2680
+	 * display_admin_page
2681
+	 * contains the code for actually displaying an admin page
2682
+	 *
2683
+	 * @param boolean $sidebar true with sidebar, false without
2684
+	 * @param boolean $about   use the about_admin_wrapper instead of the default.
2685
+	 * @return void
2686
+	 * @throws DomainException
2687
+	 * @throws EE_Error
2688
+	 */
2689
+	private function _display_admin_page($sidebar = false, $about = false)
2690
+	{
2691
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2692
+		// custom remove metaboxes hook to add or remove any metaboxes to/from Admin pages.
2693
+		do_action('AHEE__EE_Admin_Page___display_admin_page__modify_metaboxes');
2694
+		// set current wp page slug - looks like: event-espresso_page_event_categories
2695
+		// keep in mind "event-espresso" COULD be something else if the top level menu label has been translated.
2696
+		$this->_template_args['current_page']              = $this->_wp_page_slug;
2697
+		$this->_template_args['admin_page_wrapper_div_id'] = $this->_cpt_route
2698
+			? 'poststuff'
2699
+			: 'espresso-default-admin';
2700
+		$template_path                                     = $sidebar
2701
+			? EE_ADMIN_TEMPLATE . 'admin_details_wrapper.template.php'
2702
+			: EE_ADMIN_TEMPLATE . 'admin_details_wrapper_no_sidebar.template.php';
2703
+		if ($this->request->isAjax()) {
2704
+			$template_path = EE_ADMIN_TEMPLATE . 'admin_details_wrapper_no_sidebar_ajax.template.php';
2705
+		}
2706
+		$template_path                                     = ! empty($this->_column_template_path)
2707
+			? $this->_column_template_path : $template_path;
2708
+		$this->_template_args['post_body_content']         = isset($this->_template_args['admin_page_content'])
2709
+			? $this->_template_args['admin_page_content']
2710
+			: '';
2711
+		$this->_template_args['before_admin_page_content'] = isset($this->_template_args['before_admin_page_content'])
2712
+			? $this->_template_args['before_admin_page_content']
2713
+			: '';
2714
+		$this->_template_args['after_admin_page_content']  = isset($this->_template_args['after_admin_page_content'])
2715
+			? $this->_template_args['after_admin_page_content']
2716
+			: '';
2717
+		$this->_template_args['admin_page_content']        = EEH_Template::display_template(
2718
+			$template_path,
2719
+			$this->_template_args,
2720
+			true
2721
+		);
2722
+		// the final template wrapper
2723
+		$this->admin_page_wrapper($about);
2724
+	}
2725
+
2726
+
2727
+	/**
2728
+	 * This is used to display caf preview pages.
2729
+	 *
2730
+	 * @param string $utm_campaign_source what is the key used for google analytics link
2731
+	 * @param bool   $display_sidebar     whether to use the sidebar template or the full template for the page.  TRUE
2732
+	 *                                    = SHOW sidebar, FALSE = no sidebar. Default no sidebar.
2733
+	 * @return void
2734
+	 * @throws DomainException
2735
+	 * @throws EE_Error
2736
+	 * @throws InvalidArgumentException
2737
+	 * @throws InvalidDataTypeException
2738
+	 * @throws InvalidInterfaceException
2739
+	 * @since 4.3.2
2740
+	 */
2741
+	public function display_admin_caf_preview_page($utm_campaign_source = '', $display_sidebar = true)
2742
+	{
2743
+		// let's generate a default preview action button if there isn't one already present.
2744
+		$this->_labels['buttons']['buy_now']           = esc_html__(
2745
+			'Upgrade to Event Espresso 4 Right Now',
2746
+			'event_espresso'
2747
+		);
2748
+		$buy_now_url                                   = add_query_arg(
2749
+			[
2750
+				'ee_ver'       => 'ee4',
2751
+				'utm_source'   => 'ee4_plugin_admin',
2752
+				'utm_medium'   => 'link',
2753
+				'utm_campaign' => $utm_campaign_source,
2754
+				'utm_content'  => 'buy_now_button',
2755
+			],
2756
+			'https://eventespresso.com/pricing/'
2757
+		);
2758
+		$this->_template_args['preview_action_button'] = ! isset($this->_template_args['preview_action_button'])
2759
+			? $this->get_action_link_or_button(
2760
+				'',
2761
+				'buy_now',
2762
+				[],
2763
+				'button-primary button-large',
2764
+				esc_url_raw($buy_now_url),
2765
+				true
2766
+			)
2767
+			: $this->_template_args['preview_action_button'];
2768
+		$this->_template_args['admin_page_content']    = EEH_Template::display_template(
2769
+			EE_ADMIN_TEMPLATE . 'admin_caf_full_page_preview.template.php',
2770
+			$this->_template_args,
2771
+			true
2772
+		);
2773
+		$this->_display_admin_page($display_sidebar);
2774
+	}
2775
+
2776
+
2777
+	/**
2778
+	 * display_admin_list_table_page_with_sidebar
2779
+	 * generates HTML wrapper for an admin_page with list_table
2780
+	 *
2781
+	 * @return void
2782
+	 * @throws EE_Error
2783
+	 * @throws DomainException
2784
+	 */
2785
+	public function display_admin_list_table_page_with_sidebar()
2786
+	{
2787
+		$this->_display_admin_list_table_page(true);
2788
+	}
2789
+
2790
+
2791
+	/**
2792
+	 * display_admin_list_table_page_with_no_sidebar
2793
+	 * generates HTML wrapper for an admin_page with list_table (but with no sidebar)
2794
+	 *
2795
+	 * @return void
2796
+	 * @throws EE_Error
2797
+	 * @throws DomainException
2798
+	 */
2799
+	public function display_admin_list_table_page_with_no_sidebar()
2800
+	{
2801
+		$this->_display_admin_list_table_page();
2802
+	}
2803
+
2804
+
2805
+	/**
2806
+	 * generates html wrapper for an admin_list_table page
2807
+	 *
2808
+	 * @param boolean $sidebar whether to display with sidebar or not.
2809
+	 * @return void
2810
+	 * @throws DomainException
2811
+	 * @throws EE_Error
2812
+	 */
2813
+	private function _display_admin_list_table_page($sidebar = false)
2814
+	{
2815
+		// setup search attributes
2816
+		$this->_set_search_attributes();
2817
+		$this->_template_args['current_page']     = $this->_wp_page_slug;
2818
+		$template_path                            = EE_ADMIN_TEMPLATE . 'admin_list_wrapper.template.php';
2819
+		$this->_template_args['table_url']        = $this->request->isAjax()
2820
+			? add_query_arg(['noheader' => 'true', 'route' => $this->_req_action], $this->_admin_base_url)
2821
+			: add_query_arg(['route' => $this->_req_action], $this->_admin_base_url);
2822
+		$this->_template_args['list_table']       = $this->_list_table_object;
2823
+		$this->_template_args['current_route']    = $this->_req_action;
2824
+		$this->_template_args['list_table_class'] = get_class($this->_list_table_object);
2825
+		$ajax_sorting_callback                    = $this->_list_table_object->get_ajax_sorting_callback();
2826
+		if (! empty($ajax_sorting_callback)) {
2827
+			$sortable_list_table_form_fields = wp_nonce_field(
2828
+				$ajax_sorting_callback . '_nonce',
2829
+				$ajax_sorting_callback . '_nonce',
2830
+				false,
2831
+				false
2832
+			);
2833
+			$sortable_list_table_form_fields .= '<input type="hidden" id="ajax_table_sort_page" name="ajax_table_sort_page" value="'
2834
+												. $this->page_slug
2835
+												. '" />';
2836
+			$sortable_list_table_form_fields .= '<input type="hidden" id="ajax_table_sort_action" name="ajax_table_sort_action" value="'
2837
+												. $ajax_sorting_callback
2838
+												. '" />';
2839
+		} else {
2840
+			$sortable_list_table_form_fields = '';
2841
+		}
2842
+		$this->_template_args['sortable_list_table_form_fields'] = $sortable_list_table_form_fields;
2843
+		$hidden_form_fields                                      =
2844
+			isset($this->_template_args['list_table_hidden_fields'])
2845
+				? $this->_template_args['list_table_hidden_fields']
2846
+				: '';
2847
+		$nonce_ref                                               = $this->_req_action . '_nonce';
2848
+		$hidden_form_fields                                      .= '<input type="hidden" name="'
2849
+																	. $nonce_ref
2850
+																	. '" value="'
2851
+																	. wp_create_nonce($nonce_ref)
2852
+																	. '">';
2853
+		$this->_template_args['list_table_hidden_fields']        = $hidden_form_fields;
2854
+		// display message about search results?
2855
+		$search = $this->request->getRequestParam('s');
2856
+		$this->_template_args['before_list_table'] .= ! empty($search)
2857
+			? '<p class="ee-search-results">' . sprintf(
2858
+				esc_html__('Displaying search results for the search string: %1$s', 'event_espresso'),
2859
+				trim($search, '%')
2860
+			) . '</p>'
2861
+			: '';
2862
+		// filter before_list_table template arg
2863
+		$this->_template_args['before_list_table'] = apply_filters(
2864
+			'FHEE__EE_Admin_Page___display_admin_list_table_page__before_list_table__template_arg',
2865
+			$this->_template_args['before_list_table'],
2866
+			$this->page_slug,
2867
+			$this->request->requestParams(),
2868
+			$this->_req_action
2869
+		);
2870
+		// convert to array and filter again
2871
+		// arrays are easier to inject new items in a specific location,
2872
+		// but would not be backwards compatible, so we have to add a new filter
2873
+		$this->_template_args['before_list_table'] = implode(
2874
+			" \n",
2875
+			(array) apply_filters(
2876
+				'FHEE__EE_Admin_Page___display_admin_list_table_page__before_list_table__template_args_array',
2877
+				(array) $this->_template_args['before_list_table'],
2878
+				$this->page_slug,
2879
+				$this->request->requestParams(),
2880
+				$this->_req_action
2881
+			)
2882
+		);
2883
+		// filter after_list_table template arg
2884
+		$this->_template_args['after_list_table'] = apply_filters(
2885
+			'FHEE__EE_Admin_Page___display_admin_list_table_page__after_list_table__template_arg',
2886
+			$this->_template_args['after_list_table'],
2887
+			$this->page_slug,
2888
+			$this->request->requestParams(),
2889
+			$this->_req_action
2890
+		);
2891
+		// convert to array and filter again
2892
+		// arrays are easier to inject new items in a specific location,
2893
+		// but would not be backwards compatible, so we have to add a new filter
2894
+		$this->_template_args['after_list_table']   = implode(
2895
+			" \n",
2896
+			(array) apply_filters(
2897
+				'FHEE__EE_Admin_Page___display_admin_list_table_page__after_list_table__template_args_array',
2898
+				(array) $this->_template_args['after_list_table'],
2899
+				$this->page_slug,
2900
+				$this->request->requestParams(),
2901
+				$this->_req_action
2902
+			)
2903
+		);
2904
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template(
2905
+			$template_path,
2906
+			$this->_template_args,
2907
+			true
2908
+		);
2909
+		// the final template wrapper
2910
+		if ($sidebar) {
2911
+			$this->display_admin_page_with_sidebar();
2912
+		} else {
2913
+			$this->display_admin_page_with_no_sidebar();
2914
+		}
2915
+	}
2916
+
2917
+
2918
+	/**
2919
+	 * This just prepares a legend using the given items and the admin_details_legend.template.php file and returns the
2920
+	 * html string for the legend.
2921
+	 * $items are expected in an array in the following format:
2922
+	 * $legend_items = array(
2923
+	 *        'item_id' => array(
2924
+	 *            'icon' => 'http://url_to_icon_being_described.png',
2925
+	 *            'desc' => esc_html__('localized description of item');
2926
+	 *        )
2927
+	 * );
2928
+	 *
2929
+	 * @param array $items see above for format of array
2930
+	 * @return string html string of legend
2931
+	 * @throws DomainException
2932
+	 */
2933
+	protected function _display_legend($items)
2934
+	{
2935
+		$this->_template_args['items'] = apply_filters(
2936
+			'FHEE__EE_Admin_Page___display_legend__items',
2937
+			(array) $items,
2938
+			$this
2939
+		);
2940
+		return EEH_Template::display_template(
2941
+			EE_ADMIN_TEMPLATE . 'admin_details_legend.template.php',
2942
+			$this->_template_args,
2943
+			true
2944
+		);
2945
+	}
2946
+
2947
+
2948
+	/**
2949
+	 * This is used whenever we're DOING_AJAX to return a formatted json array that our calling javascript can expect
2950
+	 * The returned json object is created from an array in the following format:
2951
+	 * array(
2952
+	 *  'error' => FALSE, //(default FALSE), contains any errors and/or exceptions (exceptions return json early),
2953
+	 *  'success' => FALSE, //(default FALSE) - contains any special success message.
2954
+	 *  'notices' => '', // - contains any EE_Error formatted notices
2955
+	 *  'content' => 'string can be html', //this is a string of formatted content (can be html)
2956
+	 *  'data' => array() //this can be any key/value pairs that a method returns for later json parsing by the js.
2957
+	 *  We're also going to include the template args with every package (so js can pick out any specific template args
2958
+	 *  that might be included in here)
2959
+	 * )
2960
+	 * The json object is populated by whatever is set in the $_template_args property.
2961
+	 *
2962
+	 * @param bool  $sticky_notices    Used to indicate whether you want to ensure notices are added to a transient
2963
+	 *                                 instead of displayed.
2964
+	 * @param array $notices_arguments Use this to pass any additional args on to the _process_notices.
2965
+	 * @return void
2966
+	 * @throws EE_Error
2967
+	 */
2968
+	protected function _return_json($sticky_notices = false, $notices_arguments = [])
2969
+	{
2970
+		// make sure any EE_Error notices have been handled.
2971
+		$this->_process_notices($notices_arguments, true, $sticky_notices);
2972
+		$data = isset($this->_template_args['data']) ? $this->_template_args['data'] : [];
2973
+		unset($this->_template_args['data']);
2974
+		$json = [
2975
+			'error'     => isset($this->_template_args['error']) ? $this->_template_args['error'] : false,
2976
+			'success'   => isset($this->_template_args['success']) ? $this->_template_args['success'] : false,
2977
+			'errors'    => isset($this->_template_args['errors']) ? $this->_template_args['errors'] : false,
2978
+			'attention' => isset($this->_template_args['attention']) ? $this->_template_args['attention'] : false,
2979
+			'notices'   => EE_Error::get_notices(),
2980
+			'content'   => isset($this->_template_args['admin_page_content'])
2981
+				? $this->_template_args['admin_page_content'] : '',
2982
+			'data'      => array_merge($data, ['template_args' => $this->_template_args]),
2983
+			'isEEajax'  => true
2984
+			// special flag so any ajax.Success methods in js can identify this return package as a EEajax package.
2985
+		];
2986
+		// make sure there are no php errors or headers_sent.  Then we can set correct json header.
2987
+		if (null === error_get_last() || ! headers_sent()) {
2988
+			header('Content-Type: application/json; charset=UTF-8');
2989
+		}
2990
+		echo wp_json_encode($json);
2991
+		exit();
2992
+	}
2993
+
2994
+
2995
+	/**
2996
+	 * Simply a wrapper for the protected method so we can call this outside the class (ONLY when doing ajax)
2997
+	 *
2998
+	 * @return void
2999
+	 * @throws EE_Error
3000
+	 */
3001
+	public function return_json()
3002
+	{
3003
+		if ($this->request->isAjax()) {
3004
+			$this->_return_json();
3005
+		} else {
3006
+			throw new EE_Error(
3007
+				sprintf(
3008
+					esc_html__('The public %s method can only be called when DOING_AJAX = TRUE', 'event_espresso'),
3009
+					__FUNCTION__
3010
+				)
3011
+			);
3012
+		}
3013
+	}
3014
+
3015
+
3016
+	/**
3017
+	 * This provides a way for child hook classes to send along themselves by reference so methods/properties within
3018
+	 * them can be accessed by EE_Admin_child pages. This is assigned to the $_hook_obj property.
3019
+	 *
3020
+	 * @param EE_Admin_Hooks $hook_obj This will be the object for the EE_Admin_Hooks child
3021
+	 */
3022
+	public function set_hook_object(EE_Admin_Hooks $hook_obj)
3023
+	{
3024
+		$this->_hook_obj = $hook_obj;
3025
+	}
3026
+
3027
+
3028
+	/**
3029
+	 *        generates  HTML wrapper with Tabbed nav for an admin page
3030
+	 *
3031
+	 * @param boolean $about whether to use the special about page wrapper or default.
3032
+	 * @return void
3033
+	 * @throws DomainException
3034
+	 * @throws EE_Error
3035
+	 */
3036
+	public function admin_page_wrapper($about = false)
3037
+	{
3038
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
3039
+		$this->_nav_tabs                                   = $this->_get_main_nav_tabs();
3040
+		$this->_template_args['nav_tabs']                  = $this->_nav_tabs;
3041
+		$this->_template_args['admin_page_title']          = $this->_admin_page_title;
3042
+
3043
+		$this->_template_args['before_admin_page_content'] = apply_filters(
3044
+			"FHEE_before_admin_page_content{$this->_current_page}{$this->_current_view}",
3045
+			isset($this->_template_args['before_admin_page_content'])
3046
+				? $this->_template_args['before_admin_page_content']
3047
+				: ''
3048
+		);
3049
+
3050
+		$this->_template_args['after_admin_page_content']  = apply_filters(
3051
+			"FHEE_after_admin_page_content{$this->_current_page}{$this->_current_view}",
3052
+			isset($this->_template_args['after_admin_page_content'])
3053
+				? $this->_template_args['after_admin_page_content']
3054
+				: ''
3055
+		);
3056
+		$this->_template_args['after_admin_page_content']  .= $this->_set_help_popup_content();
3057
+
3058
+		if ($this->request->isAjax()) {
3059
+			$this->_template_args['admin_page_content'] = EEH_Template::display_template(
3060
+				// $template_path,
3061
+				EE_ADMIN_TEMPLATE . 'admin_wrapper_ajax.template.php',
3062
+				$this->_template_args,
3063
+				true
3064
+			);
3065
+			$this->_return_json();
3066
+		}
3067
+		// load settings page wrapper template
3068
+		$template_path = $about
3069
+			? EE_ADMIN_TEMPLATE . 'about_admin_wrapper.template.php'
3070
+			: EE_ADMIN_TEMPLATE . 'admin_wrapper.template.php';
3071
+
3072
+		EEH_Template::display_template($template_path, $this->_template_args);
3073
+	}
3074
+
3075
+
3076
+	/**
3077
+	 * This returns the admin_nav tabs html using the configuration in the _nav_tabs property
3078
+	 *
3079
+	 * @return string html
3080
+	 * @throws EE_Error
3081
+	 */
3082
+	protected function _get_main_nav_tabs()
3083
+	{
3084
+		// let's generate the html using the EEH_Tabbed_Content helper.
3085
+		// We do this here so that it's possible for child classes to add in nav tabs dynamically at the last minute
3086
+		// (rather than setting in the page_routes array)
3087
+		return EEH_Tabbed_Content::display_admin_nav_tabs($this->_nav_tabs);
3088
+	}
3089
+
3090
+
3091
+	/**
3092
+	 *        sort nav tabs
3093
+	 *
3094
+	 * @param $a
3095
+	 * @param $b
3096
+	 * @return int
3097
+	 */
3098
+	private function _sort_nav_tabs($a, $b)
3099
+	{
3100
+		if ($a['order'] === $b['order']) {
3101
+			return 0;
3102
+		}
3103
+		return ($a['order'] < $b['order']) ? -1 : 1;
3104
+	}
3105
+
3106
+
3107
+	/**
3108
+	 *    generates HTML for the forms used on admin pages
3109
+	 *
3110
+	 * @param array  $input_vars   - array of input field details
3111
+	 * @param string $generator    (options are 'string' or 'array', basically use this to indicate which generator to
3112
+	 *                             use)
3113
+	 * @param bool   $id
3114
+	 * @return array|string
3115
+	 * @uses   EEH_Form_Fields::get_form_fields (/helper/EEH_Form_Fields.helper.php)
3116
+	 * @uses   EEH_Form_Fields::get_form_fields_array (/helper/EEH_Form_Fields.helper.php)
3117
+	 */
3118
+	protected function _generate_admin_form_fields($input_vars = [], $generator = 'string', $id = false)
3119
+	{
3120
+		return $generator === 'string'
3121
+			? EEH_Form_Fields::get_form_fields($input_vars, $id)
3122
+			: EEH_Form_Fields::get_form_fields_array($input_vars);
3123
+	}
3124
+
3125
+
3126
+	/**
3127
+	 * generates the "Save" and "Save & Close" buttons for edit forms
3128
+	 *
3129
+	 * @param bool             $both     if true then both buttons will be generated.  If false then just the "Save &
3130
+	 *                                   Close" button.
3131
+	 * @param array            $text     if included, generator will use the given text for the buttons ( array([0] =>
3132
+	 *                                   'Save', [1] => 'save & close')
3133
+	 * @param array            $actions  if included allows us to set the actions that each button will carry out (i.e.
3134
+	 *                                   via the "name" value in the button).  We can also use this to just dump
3135
+	 *                                   default actions by submitting some other value.
3136
+	 * @param bool|string|null $referrer if false then we just do the default action on save and close.  Other wise it
3137
+	 *                                   will use the $referrer string. IF null, then we don't do ANYTHING on save and
3138
+	 *                                   close (normal form handling).
3139
+	 */
3140
+	protected function _set_save_buttons($both = true, $text = [], $actions = [], $referrer = null)
3141
+	{
3142
+		// make sure $text and $actions are in an array
3143
+		$text          = (array) $text;
3144
+		$actions       = (array) $actions;
3145
+		$referrer_url  = ! empty($referrer) ? $referrer : $this->request->getServerParam('REQUEST_URI');
3146
+		$button_text   = ! empty($text)
3147
+			? $text
3148
+			: [
3149
+				esc_html__('Save', 'event_espresso'),
3150
+				esc_html__('Save and Close', 'event_espresso'),
3151
+			];
3152
+		$default_names = ['save', 'save_and_close'];
3153
+		$buttons = '';
3154
+		foreach ($button_text as $key => $button) {
3155
+			$ref     = $default_names[ $key ];
3156
+			$name    = ! empty($actions) ? $actions[ $key ] : $ref;
3157
+			$buttons .= '<input type="submit" class="button-primary ' . $ref . '" '
3158
+						. 'value="' . $button . '" name="' . $name . '" '
3159
+						. 'id="' . $this->_current_view . '_' . $ref . '" />';
3160
+			if (! $both) {
3161
+				break;
3162
+			}
3163
+		}
3164
+		// add in a hidden index for the current page (so save and close redirects properly)
3165
+		$buttons .= '<input type="hidden" id="save_and_close_referrer" name="save_and_close_referrer" value="'
3166
+				   . $referrer_url
3167
+				   . '" />';
3168
+		$this->_template_args['save_buttons'] = $buttons;
3169
+	}
3170
+
3171
+
3172
+	/**
3173
+	 * Wrapper for the protected function.  Allows plugins/addons to call this to set the form tags.
3174
+	 *
3175
+	 * @param string $route
3176
+	 * @param array  $additional_hidden_fields
3177
+	 * @see   $this->_set_add_edit_form_tags() for details on params
3178
+	 * @since 4.6.0
3179
+	 */
3180
+	public function set_add_edit_form_tags($route = '', $additional_hidden_fields = [])
3181
+	{
3182
+		$this->_set_add_edit_form_tags($route, $additional_hidden_fields);
3183
+	}
3184
+
3185
+
3186
+	/**
3187
+	 * set form open and close tags on add/edit pages.
3188
+	 *
3189
+	 * @param string $route                    the route you want the form to direct to
3190
+	 * @param array  $additional_hidden_fields any additional hidden fields required in the form header
3191
+	 * @return void
3192
+	 */
3193
+	protected function _set_add_edit_form_tags($route = '', $additional_hidden_fields = [])
3194
+	{
3195
+		if (empty($route)) {
3196
+			$user_msg = esc_html__(
3197
+				'An error occurred. No action was set for this page\'s form.',
3198
+				'event_espresso'
3199
+			);
3200
+			$dev_msg  = $user_msg . "\n"
3201
+						. sprintf(
3202
+							esc_html__('The $route argument is required for the %s->%s method.', 'event_espresso'),
3203
+							__FUNCTION__,
3204
+							__CLASS__
3205
+						);
3206
+			EE_Error::add_error($user_msg . '||' . $dev_msg, __FILE__, __FUNCTION__, __LINE__);
3207
+		}
3208
+		// open form
3209
+		$this->_template_args['before_admin_page_content'] = '<form name="form" method="post" action="'
3210
+															 . $this->_admin_base_url
3211
+															 . '" id="'
3212
+															 . $route
3213
+															 . '_event_form" >';
3214
+		// add nonce
3215
+		$nonce                                             =
3216
+			wp_nonce_field($route . '_nonce', $route . '_nonce', false, false);
3217
+		$this->_template_args['before_admin_page_content'] .= "\n\t" . $nonce;
3218
+		// add REQUIRED form action
3219
+		$hidden_fields = [
3220
+			'action' => ['type' => 'hidden', 'value' => $route],
3221
+		];
3222
+		// merge arrays
3223
+		$hidden_fields = is_array($additional_hidden_fields)
3224
+			? array_merge($hidden_fields, $additional_hidden_fields)
3225
+			: $hidden_fields;
3226
+		// generate form fields
3227
+		$form_fields = $this->_generate_admin_form_fields($hidden_fields, 'array');
3228
+		// add fields to form
3229
+		foreach ((array) $form_fields as $form_field) {
3230
+			$this->_template_args['before_admin_page_content'] .= "\n\t" . $form_field['field'];
3231
+		}
3232
+		// close form
3233
+		$this->_template_args['after_admin_page_content'] = '</form>';
3234
+	}
3235
+
3236
+
3237
+	/**
3238
+	 * Public Wrapper for _redirect_after_action() method since its
3239
+	 * discovered it would be useful for external code to have access.
3240
+	 *
3241
+	 * @param bool   $success
3242
+	 * @param string $what
3243
+	 * @param string $action_desc
3244
+	 * @param array  $query_args
3245
+	 * @param bool   $override_overwrite
3246
+	 * @throws EE_Error
3247
+	 * @see   EE_Admin_Page::_redirect_after_action() for params.
3248
+	 * @since 4.5.0
3249
+	 */
3250
+	public function redirect_after_action(
3251
+		$success = false,
3252
+		$what = 'item',
3253
+		$action_desc = 'processed',
3254
+		$query_args = [],
3255
+		$override_overwrite = false
3256
+	) {
3257
+		$this->_redirect_after_action(
3258
+			$success,
3259
+			$what,
3260
+			$action_desc,
3261
+			$query_args,
3262
+			$override_overwrite
3263
+		);
3264
+	}
3265
+
3266
+
3267
+	/**
3268
+	 * Helper method for merging existing request data with the returned redirect url.
3269
+	 *
3270
+	 * This is typically used for redirects after an action so that if the original view was a filtered view those
3271
+	 * filters are still applied.
3272
+	 *
3273
+	 * @param array $new_route_data
3274
+	 * @return array
3275
+	 */
3276
+	protected function mergeExistingRequestParamsWithRedirectArgs(array $new_route_data)
3277
+	{
3278
+		foreach ($this->request->requestParams() as $ref => $value) {
3279
+			// unset nonces
3280
+			if (strpos($ref, 'nonce') !== false) {
3281
+				$this->request->unSetRequestParam($ref);
3282
+				continue;
3283
+			}
3284
+			// urlencode values.
3285
+			$value = is_array($value) ? array_map('urlencode', $value) : urlencode($value);
3286
+			$this->request->setRequestParam($ref, $value);
3287
+		}
3288
+		return array_merge($this->request->requestParams(), $new_route_data);
3289
+	}
3290
+
3291
+
3292
+	/**
3293
+	 *    _redirect_after_action
3294
+	 *
3295
+	 * @param int    $success            - whether success was for two or more records, or just one, or none
3296
+	 * @param string $what               - what the action was performed on
3297
+	 * @param string $action_desc        - what was done ie: updated, deleted, etc
3298
+	 * @param array  $query_args         - an array of query_args to be added to the URL to redirect to after the admin
3299
+	 *                                   action is completed
3300
+	 * @param BOOL   $override_overwrite by default all EE_Error::success messages are overwritten, this allows you to
3301
+	 *                                   override this so that they show.
3302
+	 * @return void
3303
+	 * @throws EE_Error
3304
+	 */
3305
+	protected function _redirect_after_action(
3306
+		$success = 0,
3307
+		$what = 'item',
3308
+		$action_desc = 'processed',
3309
+		$query_args = [],
3310
+		$override_overwrite = false
3311
+	) {
3312
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
3313
+		// class name for actions/filters.
3314
+		$classname = get_class($this);
3315
+		// set redirect url.
3316
+		// Note if there is a "page" index in the $query_args then we go with vanilla admin.php route,
3317
+		// otherwise we go with whatever is set as the _admin_base_url
3318
+		$redirect_url = isset($query_args['page']) ? admin_url('admin.php') : $this->_admin_base_url;
3319
+		$notices      = EE_Error::get_notices(false);
3320
+		// overwrite default success messages //BUT ONLY if overwrite not overridden
3321
+		if (! $override_overwrite || ! empty($notices['errors'])) {
3322
+			EE_Error::overwrite_success();
3323
+		}
3324
+		if (! empty($what) && ! empty($action_desc) && empty($notices['errors'])) {
3325
+			// how many records affected ? more than one record ? or just one ?
3326
+			if ($success > 1) {
3327
+				// set plural msg
3328
+				EE_Error::add_success(
3329
+					sprintf(
3330
+						esc_html__('The "%s" have been successfully %s.', 'event_espresso'),
3331
+						$what,
3332
+						$action_desc
3333
+					),
3334
+					__FILE__,
3335
+					__FUNCTION__,
3336
+					__LINE__
3337
+				);
3338
+			} elseif ($success === 1) {
3339
+				// set singular msg
3340
+				EE_Error::add_success(
3341
+					sprintf(
3342
+						esc_html__('The "%s" has been successfully %s.', 'event_espresso'),
3343
+						$what,
3344
+						$action_desc
3345
+					),
3346
+					__FILE__,
3347
+					__FUNCTION__,
3348
+					__LINE__
3349
+				);
3350
+			}
3351
+		}
3352
+		// check that $query_args isn't something crazy
3353
+		if (! is_array($query_args)) {
3354
+			$query_args = [];
3355
+		}
3356
+		/**
3357
+		 * Allow injecting actions before the query_args are modified for possible different
3358
+		 * redirections on save and close actions
3359
+		 *
3360
+		 * @param array $query_args       The original query_args array coming into the
3361
+		 *                                method.
3362
+		 * @since 4.2.0
3363
+		 */
3364
+		do_action(
3365
+			"AHEE__{$classname}___redirect_after_action__before_redirect_modification_{$this->_req_action}",
3366
+			$query_args
3367
+		);
3368
+		// calculate where we're going (if we have a "save and close" button pushed)
3369
+
3370
+		if (
3371
+			$this->request->requestParamIsSet('save_and_close')
3372
+			&& $this->request->requestParamIsSet('save_and_close_referrer')
3373
+		) {
3374
+			// even though we have the save_and_close referrer, we need to parse the url for the action in order to generate a nonce
3375
+			$parsed_url = parse_url($this->request->getRequestParam('save_and_close_referrer', '', 'url'));
3376
+			// regenerate query args array from referrer URL
3377
+			parse_str($parsed_url['query'], $query_args);
3378
+			// correct page and action will be in the query args now
3379
+			$redirect_url = admin_url('admin.php');
3380
+		}
3381
+		// merge any default query_args set in _default_route_query_args property
3382
+		if (! empty($this->_default_route_query_args) && ! $this->_is_UI_request) {
3383
+			$args_to_merge = [];
3384
+			foreach ($this->_default_route_query_args as $query_param => $query_value) {
3385
+				// is there a wp_referer array in our _default_route_query_args property?
3386
+				if ($query_param === 'wp_referer') {
3387
+					$query_value = (array) $query_value;
3388
+					foreach ($query_value as $reference => $value) {
3389
+						if (strpos($reference, 'nonce') !== false) {
3390
+							continue;
3391
+						}
3392
+						// finally we will override any arguments in the referer with
3393
+						// what might be set on the _default_route_query_args array.
3394
+						if (isset($this->_default_route_query_args[ $reference ])) {
3395
+							$args_to_merge[ $reference ] = urlencode($this->_default_route_query_args[ $reference ]);
3396
+						} else {
3397
+							$args_to_merge[ $reference ] = urlencode($value);
3398
+						}
3399
+					}
3400
+					continue;
3401
+				}
3402
+				$args_to_merge[ $query_param ] = $query_value;
3403
+			}
3404
+			// now let's merge these arguments but override with what was specifically sent in to the
3405
+			// redirect.
3406
+			$query_args = array_merge($args_to_merge, $query_args);
3407
+		}
3408
+		$this->_process_notices($query_args);
3409
+		// generate redirect url
3410
+		// if redirecting to anything other than the main page, add a nonce
3411
+		if (isset($query_args['action'])) {
3412
+			// manually generate wp_nonce and merge that with the query vars
3413
+			// becuz the wp_nonce_url function wrecks havoc on some vars
3414
+			$query_args['_wpnonce'] = wp_create_nonce($query_args['action'] . '_nonce');
3415
+		}
3416
+		// we're adding some hooks and filters in here for processing any things just before redirects
3417
+		// (example: an admin page has done an insert or update and we want to run something after that).
3418
+		do_action('AHEE_redirect_' . $classname . $this->_req_action, $query_args);
3419
+		$redirect_url = apply_filters(
3420
+			'FHEE_redirect_' . $classname . $this->_req_action,
3421
+			self::add_query_args_and_nonce($query_args, $redirect_url),
3422
+			$query_args
3423
+		);
3424
+		// check if we're doing ajax.  If we are then lets just return the results and js can handle how it wants.
3425
+		if ($this->request->isAjax()) {
3426
+			$default_data                    = [
3427
+				'close'        => true,
3428
+				'redirect_url' => $redirect_url,
3429
+				'where'        => 'main',
3430
+				'what'         => 'append',
3431
+			];
3432
+			$this->_template_args['success'] = $success;
3433
+			$this->_template_args['data']    = ! empty($this->_template_args['data']) ? array_merge(
3434
+				$default_data,
3435
+				$this->_template_args['data']
3436
+			) : $default_data;
3437
+			$this->_return_json();
3438
+		}
3439
+		wp_safe_redirect($redirect_url);
3440
+		exit();
3441
+	}
3442
+
3443
+
3444
+	/**
3445
+	 * process any notices before redirecting (or returning ajax request)
3446
+	 * This method sets the $this->_template_args['notices'] attribute;
3447
+	 *
3448
+	 * @param array $query_args         any query args that need to be used for notice transient ('action')
3449
+	 * @param bool  $skip_route_verify  This is typically used when we are processing notices REALLY early and
3450
+	 *                                  page_routes haven't been defined yet.
3451
+	 * @param bool  $sticky_notices     This is used to flag that regardless of whether this is doing_ajax or not, we
3452
+	 *                                  still save a transient for the notice.
3453
+	 * @return void
3454
+	 * @throws EE_Error
3455
+	 */
3456
+	protected function _process_notices($query_args = [], $skip_route_verify = false, $sticky_notices = true)
3457
+	{
3458
+		// first let's set individual error properties if doing_ajax and the properties aren't already set.
3459
+		if ($this->request->isAjax()) {
3460
+			$notices = EE_Error::get_notices(false);
3461
+			if (empty($this->_template_args['success'])) {
3462
+				$this->_template_args['success'] = isset($notices['success']) ? $notices['success'] : false;
3463
+			}
3464
+			if (empty($this->_template_args['errors'])) {
3465
+				$this->_template_args['errors'] = isset($notices['errors']) ? $notices['errors'] : false;
3466
+			}
3467
+			if (empty($this->_template_args['attention'])) {
3468
+				$this->_template_args['attention'] = isset($notices['attention']) ? $notices['attention'] : false;
3469
+			}
3470
+		}
3471
+		$this->_template_args['notices'] = EE_Error::get_notices();
3472
+		// IF this isn't ajax we need to create a transient for the notices using the route (however, overridden if $sticky_notices == true)
3473
+		if (! $this->request->isAjax() || $sticky_notices) {
3474
+			$route = isset($query_args['action']) ? $query_args['action'] : 'default';
3475
+			$this->_add_transient(
3476
+				$route,
3477
+				$this->_template_args['notices'],
3478
+				true,
3479
+				$skip_route_verify
3480
+			);
3481
+		}
3482
+	}
3483
+
3484
+
3485
+	/**
3486
+	 * get_action_link_or_button
3487
+	 * returns the button html for adding, editing, or deleting an item (depending on given type)
3488
+	 *
3489
+	 * @param string $action        use this to indicate which action the url is generated with.
3490
+	 * @param string $type          accepted strings must be defined in the $_labels['button'] array(as the key)
3491
+	 *                              property.
3492
+	 * @param array  $extra_request if the button requires extra params you can include them in $key=>$value pairs.
3493
+	 * @param string $class         Use this to give the class for the button. Defaults to 'button-primary'
3494
+	 * @param string $base_url      If this is not provided
3495
+	 *                              the _admin_base_url will be used as the default for the button base_url.
3496
+	 *                              Otherwise this value will be used.
3497
+	 * @param bool   $exclude_nonce If true then no nonce will be in the generated button link.
3498
+	 * @return string
3499
+	 * @throws InvalidArgumentException
3500
+	 * @throws InvalidInterfaceException
3501
+	 * @throws InvalidDataTypeException
3502
+	 * @throws EE_Error
3503
+	 */
3504
+	public function get_action_link_or_button(
3505
+		$action,
3506
+		$type = 'add',
3507
+		$extra_request = [],
3508
+		$class = 'button-primary',
3509
+		$base_url = '',
3510
+		$exclude_nonce = false
3511
+	) {
3512
+		// first let's validate the action (if $base_url is FALSE otherwise validation will happen further along)
3513
+		if (empty($base_url) && ! isset($this->_page_routes[ $action ])) {
3514
+			throw new EE_Error(
3515
+				sprintf(
3516
+					esc_html__(
3517
+						'There is no page route for given action for the button.  This action was given: %s',
3518
+						'event_espresso'
3519
+					),
3520
+					$action
3521
+				)
3522
+			);
3523
+		}
3524
+		if (! isset($this->_labels['buttons'][ $type ])) {
3525
+			throw new EE_Error(
3526
+				sprintf(
3527
+					esc_html__(
3528
+						'There is no label for the given button type (%s). Labels are set in the <code>_page_config</code> property.',
3529
+						'event_espresso'
3530
+					),
3531
+					$type
3532
+				)
3533
+			);
3534
+		}
3535
+		// finally check user access for this button.
3536
+		$has_access = $this->check_user_access($action, true);
3537
+		if (! $has_access) {
3538
+			return '';
3539
+		}
3540
+		$_base_url  = ! $base_url ? $this->_admin_base_url : $base_url;
3541
+		$query_args = [
3542
+			'action' => $action,
3543
+		];
3544
+		// merge extra_request args but make sure our original action takes precedence and doesn't get overwritten.
3545
+		if (! empty($extra_request)) {
3546
+			$query_args = array_merge($extra_request, $query_args);
3547
+		}
3548
+		$url = self::add_query_args_and_nonce($query_args, $_base_url, false, $exclude_nonce);
3549
+		return EEH_Template::get_button_or_link($url, $this->_labels['buttons'][ $type ], $class);
3550
+	}
3551
+
3552
+
3553
+	/**
3554
+	 * _per_page_screen_option
3555
+	 * Utility function for adding in a per_page_option in the screen_options_dropdown.
3556
+	 *
3557
+	 * @return void
3558
+	 * @throws InvalidArgumentException
3559
+	 * @throws InvalidInterfaceException
3560
+	 * @throws InvalidDataTypeException
3561
+	 */
3562
+	protected function _per_page_screen_option()
3563
+	{
3564
+		$option = 'per_page';
3565
+		$args   = [
3566
+			'label'   => apply_filters(
3567
+				'FHEE__EE_Admin_Page___per_page_screen_options___label',
3568
+				$this->_admin_page_title,
3569
+				$this
3570
+			),
3571
+			'default' => (int) apply_filters(
3572
+				'FHEE__EE_Admin_Page___per_page_screen_options__default',
3573
+				20
3574
+			),
3575
+			'option'  => $this->_current_page . '_' . $this->_current_view . '_per_page',
3576
+		];
3577
+		// ONLY add the screen option if the user has access to it.
3578
+		if ($this->check_user_access($this->_current_view, true)) {
3579
+			add_screen_option($option, $args);
3580
+		}
3581
+	}
3582
+
3583
+
3584
+	/**
3585
+	 * set_per_page_screen_option
3586
+	 * All this does is make sure that WordPress saves any per_page screen options (if set) for the current page.
3587
+	 * we have to do this rather than running inside the 'set-screen-options' hook because it runs earlier than
3588
+	 * admin_menu.
3589
+	 *
3590
+	 * @return void
3591
+	 */
3592
+	private function _set_per_page_screen_options()
3593
+	{
3594
+		if ($this->request->requestParamIsSet('wp_screen_options')) {
3595
+			check_admin_referer('screen-options-nonce', 'screenoptionnonce');
3596
+			if (! $user = wp_get_current_user()) {
3597
+				return;
3598
+			}
3599
+			$option = $this->request->getRequestParam('wp_screen_options[option]', '', 'key');
3600
+			if (! $option) {
3601
+				return;
3602
+			}
3603
+			$value  = $this->request->getRequestParam('wp_screen_options[value]', 0, 'int');
3604
+			$map_option = $option;
3605
+			$option     = str_replace('-', '_', $option);
3606
+			switch ($map_option) {
3607
+				case $this->_current_page . '_' . $this->_current_view . '_per_page':
3608
+					$max_value = apply_filters(
3609
+						'FHEE__EE_Admin_Page___set_per_page_screen_options__max_value',
3610
+						999,
3611
+						$this->_current_page,
3612
+						$this->_current_view
3613
+					);
3614
+					if ($value < 1) {
3615
+						return;
3616
+					}
3617
+					$value = min($value, $max_value);
3618
+					break;
3619
+				default:
3620
+					$value = apply_filters(
3621
+						'FHEE__EE_Admin_Page___set_per_page_screen_options__value',
3622
+						false,
3623
+						$option,
3624
+						$value
3625
+					);
3626
+					if (false === $value) {
3627
+						return;
3628
+					}
3629
+					break;
3630
+			}
3631
+			update_user_meta($user->ID, $option, $value);
3632
+			wp_safe_redirect(remove_query_arg(['pagenum', 'apage', 'paged'], wp_get_referer()));
3633
+			exit;
3634
+		}
3635
+	}
3636
+
3637
+
3638
+	/**
3639
+	 * This just allows for setting the $_template_args property if it needs to be set outside the object
3640
+	 *
3641
+	 * @param array $data array that will be assigned to template args.
3642
+	 */
3643
+	public function set_template_args($data)
3644
+	{
3645
+		$this->_template_args = array_merge($this->_template_args, (array) $data);
3646
+	}
3647
+
3648
+
3649
+	/**
3650
+	 * This makes available the WP transient system for temporarily moving data between routes
3651
+	 *
3652
+	 * @param string $route             the route that should receive the transient
3653
+	 * @param array  $data              the data that gets sent
3654
+	 * @param bool   $notices           If this is for notices then we use this to indicate so, otherwise its just a
3655
+	 *                                  normal route transient.
3656
+	 * @param bool   $skip_route_verify Used to indicate we want to skip route verification.  This is usually ONLY used
3657
+	 *                                  when we are adding a transient before page_routes have been defined.
3658
+	 * @return void
3659
+	 * @throws EE_Error
3660
+	 */
3661
+	protected function _add_transient($route, $data, $notices = false, $skip_route_verify = false)
3662
+	{
3663
+		$user_id = get_current_user_id();
3664
+		if (! $skip_route_verify) {
3665
+			$this->_verify_route($route);
3666
+		}
3667
+		// now let's set the string for what kind of transient we're setting
3668
+		$transient = $notices
3669
+			? 'ee_rte_n_tx_' . $route . '_' . $user_id
3670
+			: 'rte_tx_' . $route . '_' . $user_id;
3671
+		$data      = $notices ? ['notices' => $data] : $data;
3672
+		// is there already a transient for this route?  If there is then let's ADD to that transient
3673
+		$existing = is_multisite() && is_network_admin()
3674
+			? get_site_transient($transient)
3675
+			: get_transient($transient);
3676
+		if ($existing) {
3677
+			$data = array_merge((array) $data, (array) $existing);
3678
+		}
3679
+		if (is_multisite() && is_network_admin()) {
3680
+			set_site_transient($transient, $data, 8);
3681
+		} else {
3682
+			set_transient($transient, $data, 8);
3683
+		}
3684
+	}
3685
+
3686
+
3687
+	/**
3688
+	 * this retrieves the temporary transient that has been set for moving data between routes.
3689
+	 *
3690
+	 * @param bool   $notices true we get notices transient. False we just return normal route transient
3691
+	 * @param string $route
3692
+	 * @return mixed data
3693
+	 */
3694
+	protected function _get_transient($notices = false, $route = '')
3695
+	{
3696
+		$user_id   = get_current_user_id();
3697
+		$route     = ! $route ? $this->_req_action : $route;
3698
+		$transient = $notices
3699
+			? 'ee_rte_n_tx_' . $route . '_' . $user_id
3700
+			: 'rte_tx_' . $route . '_' . $user_id;
3701
+		$data      = is_multisite() && is_network_admin()
3702
+			? get_site_transient($transient)
3703
+			: get_transient($transient);
3704
+		// delete transient after retrieval (just in case it hasn't expired);
3705
+		if (is_multisite() && is_network_admin()) {
3706
+			delete_site_transient($transient);
3707
+		} else {
3708
+			delete_transient($transient);
3709
+		}
3710
+		return $notices && isset($data['notices']) ? $data['notices'] : $data;
3711
+	}
3712
+
3713
+
3714
+	/**
3715
+	 * The purpose of this method is just to run garbage collection on any EE transients that might have expired but
3716
+	 * would not be called later. This will be assigned to run on a specific EE Admin page. (place the method in the
3717
+	 * default route callback on the EE_Admin page you want it run.)
3718
+	 *
3719
+	 * @return void
3720
+	 */
3721
+	protected function _transient_garbage_collection()
3722
+	{
3723
+		global $wpdb;
3724
+		// retrieve all existing transients
3725
+		$query =
3726
+			"SELECT option_name FROM {$wpdb->options} WHERE option_name LIKE '%rte_tx_%' OR option_name LIKE '%rte_n_tx_%'";
3727
+		if ($results = $wpdb->get_results($query)) {
3728
+			foreach ($results as $result) {
3729
+				$transient = str_replace('_transient_', '', $result->option_name);
3730
+				get_transient($transient);
3731
+				if (is_multisite() && is_network_admin()) {
3732
+					get_site_transient($transient);
3733
+				}
3734
+			}
3735
+		}
3736
+	}
3737
+
3738
+
3739
+	/**
3740
+	 * get_view
3741
+	 *
3742
+	 * @return string content of _view property
3743
+	 */
3744
+	public function get_view()
3745
+	{
3746
+		return $this->_view;
3747
+	}
3748
+
3749
+
3750
+	/**
3751
+	 * getter for the protected $_views property
3752
+	 *
3753
+	 * @return array
3754
+	 */
3755
+	public function get_views()
3756
+	{
3757
+		return $this->_views;
3758
+	}
3759
+
3760
+
3761
+	/**
3762
+	 * get_current_page
3763
+	 *
3764
+	 * @return string _current_page property value
3765
+	 */
3766
+	public function get_current_page()
3767
+	{
3768
+		return $this->_current_page;
3769
+	}
3770
+
3771
+
3772
+	/**
3773
+	 * get_current_view
3774
+	 *
3775
+	 * @return string _current_view property value
3776
+	 */
3777
+	public function get_current_view()
3778
+	{
3779
+		return $this->_current_view;
3780
+	}
3781
+
3782
+
3783
+	/**
3784
+	 * get_current_screen
3785
+	 *
3786
+	 * @return object The current WP_Screen object
3787
+	 */
3788
+	public function get_current_screen()
3789
+	{
3790
+		return $this->_current_screen;
3791
+	}
3792
+
3793
+
3794
+	/**
3795
+	 * get_current_page_view_url
3796
+	 *
3797
+	 * @return string This returns the url for the current_page_view.
3798
+	 */
3799
+	public function get_current_page_view_url()
3800
+	{
3801
+		return $this->_current_page_view_url;
3802
+	}
3803
+
3804
+
3805
+	/**
3806
+	 * just returns the Request
3807
+	 *
3808
+	 * @return RequestInterface
3809
+	 */
3810
+	public function get_request()
3811
+	{
3812
+		return $this->request;
3813
+	}
3814
+
3815
+
3816
+	/**
3817
+	 * just returns the _req_data property
3818
+	 *
3819
+	 * @return array
3820
+	 */
3821
+	public function get_request_data()
3822
+	{
3823
+		return $this->request->requestParams();
3824
+	}
3825
+
3826
+
3827
+	/**
3828
+	 * returns the _req_data protected property
3829
+	 *
3830
+	 * @return string
3831
+	 */
3832
+	public function get_req_action()
3833
+	{
3834
+		return $this->_req_action;
3835
+	}
3836
+
3837
+
3838
+	/**
3839
+	 * @return bool  value of $_is_caf property
3840
+	 */
3841
+	public function is_caf()
3842
+	{
3843
+		return $this->_is_caf;
3844
+	}
3845
+
3846
+
3847
+	/**
3848
+	 * @return mixed
3849
+	 */
3850
+	public function default_espresso_metaboxes()
3851
+	{
3852
+		return $this->_default_espresso_metaboxes;
3853
+	}
3854
+
3855
+
3856
+	/**
3857
+	 * @return mixed
3858
+	 */
3859
+	public function admin_base_url()
3860
+	{
3861
+		return $this->_admin_base_url;
3862
+	}
3863
+
3864
+
3865
+	/**
3866
+	 * @return mixed
3867
+	 */
3868
+	public function wp_page_slug()
3869
+	{
3870
+		return $this->_wp_page_slug;
3871
+	}
3872
+
3873
+
3874
+	/**
3875
+	 * updates  espresso configuration settings
3876
+	 *
3877
+	 * @param string                   $tab
3878
+	 * @param EE_Config_Base|EE_Config $config
3879
+	 * @param string                   $file file where error occurred
3880
+	 * @param string                   $func function  where error occurred
3881
+	 * @param string                   $line line no where error occurred
3882
+	 * @return boolean
3883
+	 */
3884
+	protected function _update_espresso_configuration($tab, $config, $file = '', $func = '', $line = '')
3885
+	{
3886
+		// remove any options that are NOT going to be saved with the config settings.
3887
+		if (isset($config->core->ee_ueip_optin)) {
3888
+			// TODO: remove the following two lines and make sure values are migrated from 3.1
3889
+			update_option('ee_ueip_optin', $config->core->ee_ueip_optin);
3890
+			update_option('ee_ueip_has_notified', true);
3891
+		}
3892
+		// and save it (note we're also doing the network save here)
3893
+		$net_saved    = ! is_main_site() || EE_Network_Config::instance()->update_config(false, false);
3894
+		$config_saved = EE_Config::instance()->update_espresso_config(false, false);
3895
+		if ($config_saved && $net_saved) {
3896
+			EE_Error::add_success(sprintf(esc_html__('"%s" have been successfully updated.', 'event_espresso'), $tab));
3897
+			return true;
3898
+		}
3899
+		EE_Error::add_error(sprintf(esc_html__('The "%s" were not updated.', 'event_espresso'), $tab), $file, $func, $line);
3900
+		return false;
3901
+	}
3902
+
3903
+
3904
+	/**
3905
+	 * Returns an array to be used for EE_FOrm_Fields.helper.php's select_input as the $values argument.
3906
+	 *
3907
+	 * @return array
3908
+	 */
3909
+	public function get_yes_no_values()
3910
+	{
3911
+		return $this->_yes_no_values;
3912
+	}
3913
+
3914
+
3915
+	protected function _get_dir()
3916
+	{
3917
+		$reflector = new ReflectionClass(get_class($this));
3918
+		return dirname($reflector->getFileName());
3919
+	}
3920
+
3921
+
3922
+	/**
3923
+	 * A helper for getting a "next link".
3924
+	 *
3925
+	 * @param string $url   The url to link to
3926
+	 * @param string $class The class to use.
3927
+	 * @return string
3928
+	 */
3929
+	protected function _next_link($url, $class = 'dashicons dashicons-arrow-right')
3930
+	{
3931
+		return '<a class="' . $class . '" href="' . $url . '"></a>';
3932
+	}
3933
+
3934
+
3935
+	/**
3936
+	 * A helper for getting a "previous link".
3937
+	 *
3938
+	 * @param string $url   The url to link to
3939
+	 * @param string $class The class to use.
3940
+	 * @return string
3941
+	 */
3942
+	protected function _previous_link($url, $class = 'dashicons dashicons-arrow-left')
3943
+	{
3944
+		return '<a class="' . $class . '" href="' . $url . '"></a>';
3945
+	}
3946
+
3947
+
3948
+
3949
+
3950
+
3951
+
3952
+
3953
+	// below are some messages related methods that should be available across the EE_Admin system.  Note, these methods are NOT page specific
3954
+
3955
+
3956
+	/**
3957
+	 * This processes an request to resend a registration and assumes we have a _REG_ID for doing so. So if the caller
3958
+	 * knows that the _REG_ID isn't in the req_data array but CAN obtain it, the caller should ADD the _REG_ID to the
3959
+	 * _req_data array.
3960
+	 *
3961
+	 * @return bool success/fail
3962
+	 * @throws EE_Error
3963
+	 * @throws InvalidArgumentException
3964
+	 * @throws ReflectionException
3965
+	 * @throws InvalidDataTypeException
3966
+	 * @throws InvalidInterfaceException
3967
+	 */
3968
+	protected function _process_resend_registration()
3969
+	{
3970
+		$this->_template_args['success'] = EED_Messages::process_resend($this->_req_data);
3971
+		do_action(
3972
+			'AHEE__EE_Admin_Page___process_resend_registration',
3973
+			$this->_template_args['success'],
3974
+			$this->request->requestParams()
3975
+		);
3976
+		return $this->_template_args['success'];
3977
+	}
3978
+
3979
+
3980
+	/**
3981
+	 * This automatically processes any payment message notifications when manual payment has been applied.
3982
+	 *
3983
+	 * @param EE_Payment $payment
3984
+	 * @return bool success/fail
3985
+	 */
3986
+	protected function _process_payment_notification(EE_Payment $payment)
3987
+	{
3988
+		add_filter('FHEE__EE_Payment_Processor__process_registration_payments__display_notifications', '__return_true');
3989
+		do_action('AHEE__EE_Admin_Page___process_admin_payment_notification', $payment);
3990
+		$this->_template_args['success'] = apply_filters(
3991
+			'FHEE__EE_Admin_Page___process_admin_payment_notification__success',
3992
+			false,
3993
+			$payment
3994
+		);
3995
+		return $this->_template_args['success'];
3996
+	}
3997
+
3998
+
3999
+	/**
4000
+	 * @param EEM_Base      $entity_model
4001
+	 * @param string        $entity_PK_name name of the primary key field used as a request param, ie: id, ID, etc
4002
+	 * @param string        $action         one of the EE_Admin_List_Table::ACTION_* constants: delete, restore, trash
4003
+	 * @param string        $delete_column  name of the field that denotes whether entity is trashed
4004
+	 * @param callable|null $callback       called after entity is trashed, restored, or deleted
4005
+	 * @return int|float
4006
+	 * @throws EE_Error
4007
+	 */
4008
+	protected function trashRestoreDeleteEntities(
4009
+		EEM_Base $entity_model,
4010
+		string $entity_PK_name,
4011
+		string $action = EE_Admin_List_Table::ACTION_DELETE,
4012
+		string $delete_column = '',
4013
+		callable $callback = null
4014
+	) {
4015
+		$entity_PK      = $entity_model->get_primary_key_field();
4016
+		$entity_PK_name = $entity_PK_name ?: $entity_PK->get_name();
4017
+		$entity_PK_type = $this->resolveEntityFieldDataType($entity_PK);
4018
+		// grab ID if deleting a single entity
4019
+		if ($this->request->requestParamIsSet($entity_PK_name)) {
4020
+			$ID = $this->request->getRequestParam($entity_PK_name, 0, $entity_PK_type);
4021
+			return $this->trashRestoreDeleteEntity($entity_model, $ID, $action, $delete_column, $callback) ? 1 : 0;
4022
+		}
4023
+		// or grab checkbox array if bulk deleting
4024
+		$checkboxes = $this->request->getRequestParam('checkbox', [], $entity_PK_type, true);
4025
+		if (empty($checkboxes)) {
4026
+			return 0;
4027
+		}
4028
+		$success = 0;
4029
+		$IDs     = array_keys($checkboxes);
4030
+		// cycle thru bulk action checkboxes
4031
+		foreach ($IDs as $ID) {
4032
+			// increment $success
4033
+			if ($this->trashRestoreDeleteEntity($entity_model, $ID, $action, $delete_column, $callback)) {
4034
+				$success++;
4035
+			}
4036
+		}
4037
+		$count = (int) count($checkboxes);
4038
+		// if multiple entities were deleted successfully, then $deleted will be full count of deletions,
4039
+		// otherwise it will be a fraction of ( actual deletions / total entities to be deleted )
4040
+		return $success === $count ? $count : $success / $count;
4041
+	}
4042
+
4043
+
4044
+	/**
4045
+	 * @param EE_Primary_Key_Field_Base $entity_PK
4046
+	 * @return string
4047
+	 * @throws EE_Error
4048
+	 * @since   $VID:$
4049
+	 */
4050
+	private function resolveEntityFieldDataType(EE_Primary_Key_Field_Base $entity_PK): string
4051
+	{
4052
+		$entity_PK_type = $entity_PK->getSchemaType();
4053
+		switch ($entity_PK_type) {
4054
+			case 'boolean':
4055
+				return 'bool';
4056
+			case 'integer':
4057
+				return 'int';
4058
+			case 'number':
4059
+				return 'float';
4060
+			case 'string':
4061
+				return 'string';
4062
+		}
4063
+		throw new RuntimeException(
4064
+			sprintf(
4065
+				esc_html__(
4066
+					'"%1$s" is an invalid schema type for the %2$s primary key.',
4067
+					'event_espresso'
4068
+				),
4069
+				$entity_PK_type,
4070
+				$entity_PK->get_name()
4071
+			)
4072
+		);
4073
+	}
4074
+
4075
+
4076
+	/**
4077
+	 * @param EEM_Base      $entity_model
4078
+	 * @param int|string    $entity_ID
4079
+	 * @param string        $action        one of the EE_Admin_List_Table::ACTION_* constants: delete, restore, trash
4080
+	 * @param string        $delete_column name of the field that denotes whether entity is trashed
4081
+	 * @param callable|null $callback      called after entity is trashed, restored, or deleted
4082
+	 * @return bool
4083
+	 */
4084
+	protected function trashRestoreDeleteEntity(
4085
+		EEM_Base $entity_model,
4086
+		$entity_ID,
4087
+		string $action,
4088
+		string $delete_column,
4089
+		callable $callback = null
4090
+	) {
4091
+		$entity_ID = absint($entity_ID);
4092
+		if (! $entity_ID) {
4093
+			$this->trashRestoreDeleteError($action, $entity_model);
4094
+		}
4095
+		$result = 0;
4096
+		try {
4097
+			switch ($action) {
4098
+				case EE_Admin_List_Table::ACTION_DELETE:
4099
+					$result = (bool) $entity_model->delete_permanently_by_ID($entity_ID);
4100
+					break;
4101
+				case EE_Admin_List_Table::ACTION_RESTORE:
4102
+					$this->validateDeleteColumn($entity_model, $delete_column);
4103
+					$result = $entity_model->update_by_ID([$delete_column => 0], $entity_ID);
4104
+					break;
4105
+				case EE_Admin_List_Table::ACTION_TRASH:
4106
+					$this->validateDeleteColumn($entity_model, $delete_column);
4107
+					$result = $entity_model->update_by_ID([$delete_column => 1], $entity_ID);
4108
+					break;
4109
+			}
4110
+		} catch (Exception $exception) {
4111
+			$this->trashRestoreDeleteError($action, $entity_model, $exception);
4112
+		}
4113
+		if (is_callable($callback)) {
4114
+			call_user_func_array($callback, [$entity_model, $entity_ID, $action, $result, $delete_column]);
4115
+		}
4116
+		return $result;
4117
+	}
4118
+
4119
+
4120
+	/**
4121
+	 * @param EEM_Base $entity_model
4122
+	 * @param string   $delete_column
4123
+	 * @since $VID:$
4124
+	 */
4125
+	private function validateDeleteColumn(EEM_Base $entity_model, string $delete_column)
4126
+	{
4127
+		if (empty($delete_column)) {
4128
+			throw new DomainException(
4129
+				sprintf(
4130
+					esc_html__(
4131
+						'You need to specify the name of the "delete column" on the %2$s model, in order to trash or restore an entity.',
4132
+						'event_espresso'
4133
+					),
4134
+					$entity_model->get_this_model_name()
4135
+				)
4136
+			);
4137
+		}
4138
+		if (! $entity_model->has_field($delete_column)) {
4139
+			throw new DomainException(
4140
+				sprintf(
4141
+					esc_html__(
4142
+						'The %1$s field does not exist on the %2$s model.',
4143
+						'event_espresso'
4144
+					),
4145
+					$delete_column,
4146
+					$entity_model->get_this_model_name()
4147
+				)
4148
+			);
4149
+		}
4150
+	}
4151
+
4152
+
4153
+	/**
4154
+	 * @param EEM_Base       $entity_model
4155
+	 * @param Exception|null $exception
4156
+	 * @param string         $action
4157
+	 * @since $VID:$
4158
+	 */
4159
+	private function trashRestoreDeleteError(string $action, EEM_Base $entity_model, ?Exception $exception = null)
4160
+	{
4161
+		if ($exception instanceof Exception) {
4162
+			throw new RuntimeException(
4163
+				sprintf(
4164
+					esc_html__(
4165
+						'Could not %1$s the %2$s because the following error occurred: %3$s',
4166
+						'event_espresso'
4167
+					),
4168
+					$action,
4169
+					$entity_model->get_this_model_name(),
4170
+					$exception->getMessage()
4171
+				)
4172
+			);
4173
+		}
4174
+		throw new RuntimeException(
4175
+			sprintf(
4176
+				esc_html__(
4177
+					'Could not %1$s the %2$s because an invalid ID was received.',
4178
+					'event_espresso'
4179
+				),
4180
+				$action,
4181
+				$entity_model->get_this_model_name()
4182
+			)
4183
+		);
4184
+	}
4185 4185
 }
Please login to merge, or discard this patch.
Spacing   +185 added lines, -185 removed lines patch added patch discarded remove patch
@@ -514,7 +514,7 @@  discard block
 block discarded – undo
514 514
         $ee_menu_slugs = (array) $ee_menu_slugs;
515 515
         if (
516 516
             ! $this->request->isAjax()
517
-            && (! $this->_current_page || ! isset($ee_menu_slugs[ $this->_current_page ]))
517
+            && ( ! $this->_current_page || ! isset($ee_menu_slugs[$this->_current_page]))
518 518
         ) {
519 519
             return;
520 520
         }
@@ -534,7 +534,7 @@  discard block
 block discarded – undo
534 534
             : $req_action;
535 535
 
536 536
         $this->_current_view = $this->_req_action;
537
-        $this->_req_nonce    = $this->_req_action . '_nonce';
537
+        $this->_req_nonce    = $this->_req_action.'_nonce';
538 538
         $this->_define_page_props();
539 539
         $this->_current_page_view_url = add_query_arg(
540 540
             ['page' => $this->_current_page, 'action' => $this->_current_view],
@@ -571,21 +571,21 @@  discard block
 block discarded – undo
571 571
         }
572 572
         // filter routes and page_config so addons can add their stuff. Filtering done per class
573 573
         $this->_page_routes = apply_filters(
574
-            'FHEE__' . get_class($this) . '__page_setup__page_routes',
574
+            'FHEE__'.get_class($this).'__page_setup__page_routes',
575 575
             $this->_page_routes,
576 576
             $this
577 577
         );
578 578
         $this->_page_config = apply_filters(
579
-            'FHEE__' . get_class($this) . '__page_setup__page_config',
579
+            'FHEE__'.get_class($this).'__page_setup__page_config',
580 580
             $this->_page_config,
581 581
             $this
582 582
         );
583 583
         // if AHEE__EE_Admin_Page__route_admin_request_$this->_current_view method is present
584 584
         // then we call it hooked into the AHEE__EE_Admin_Page__route_admin_request action
585
-        if (method_exists($this, 'AHEE__EE_Admin_Page__route_admin_request_' . $this->_current_view)) {
585
+        if (method_exists($this, 'AHEE__EE_Admin_Page__route_admin_request_'.$this->_current_view)) {
586 586
             add_action(
587 587
                 'AHEE__EE_Admin_Page__route_admin_request',
588
-                [$this, 'AHEE__EE_Admin_Page__route_admin_request_' . $this->_current_view],
588
+                [$this, 'AHEE__EE_Admin_Page__route_admin_request_'.$this->_current_view],
589 589
                 10,
590 590
                 2
591 591
             );
@@ -598,8 +598,8 @@  discard block
 block discarded – undo
598 598
             if ($this->_is_UI_request) {
599 599
                 // admin_init stuff - global, all views for this page class, specific view
600 600
                 add_action('admin_init', [$this, 'admin_init'], 10);
601
-                if (method_exists($this, 'admin_init_' . $this->_current_view)) {
602
-                    add_action('admin_init', [$this, 'admin_init_' . $this->_current_view], 15);
601
+                if (method_exists($this, 'admin_init_'.$this->_current_view)) {
602
+                    add_action('admin_init', [$this, 'admin_init_'.$this->_current_view], 15);
603 603
                 }
604 604
             } else {
605 605
                 // hijack regular WP loading and route admin request immediately
@@ -618,12 +618,12 @@  discard block
 block discarded – undo
618 618
      */
619 619
     private function _do_other_page_hooks()
620 620
     {
621
-        $registered_pages = apply_filters('FHEE_do_other_page_hooks_' . $this->page_slug, []);
621
+        $registered_pages = apply_filters('FHEE_do_other_page_hooks_'.$this->page_slug, []);
622 622
         foreach ($registered_pages as $page) {
623 623
             // now let's setup the file name and class that should be present
624 624
             $classname = str_replace('.class.php', '', $page);
625 625
             // autoloaders should take care of loading file
626
-            if (! class_exists($classname)) {
626
+            if ( ! class_exists($classname)) {
627 627
                 $error_msg[] = sprintf(
628 628
                     esc_html__(
629 629
                         'Something went wrong with loading the %s admin hooks page.',
@@ -640,7 +640,7 @@  discard block
 block discarded – undo
640 640
                                    ),
641 641
                                    $page,
642 642
                                    '<br />',
643
-                                   '<strong>' . $classname . '</strong>'
643
+                                   '<strong>'.$classname.'</strong>'
644 644
                                );
645 645
                 throw new EE_Error(implode('||', $error_msg));
646 646
             }
@@ -682,13 +682,13 @@  discard block
 block discarded – undo
682 682
         // load admin_notices - global, page class, and view specific
683 683
         add_action('admin_notices', [$this, 'admin_notices_global'], 5);
684 684
         add_action('admin_notices', [$this, 'admin_notices'], 10);
685
-        if (method_exists($this, 'admin_notices_' . $this->_current_view)) {
686
-            add_action('admin_notices', [$this, 'admin_notices_' . $this->_current_view], 15);
685
+        if (method_exists($this, 'admin_notices_'.$this->_current_view)) {
686
+            add_action('admin_notices', [$this, 'admin_notices_'.$this->_current_view], 15);
687 687
         }
688 688
         // load network admin_notices - global, page class, and view specific
689 689
         add_action('network_admin_notices', [$this, 'network_admin_notices_global'], 5);
690
-        if (method_exists($this, 'network_admin_notices_' . $this->_current_view)) {
691
-            add_action('network_admin_notices', [$this, 'network_admin_notices_' . $this->_current_view]);
690
+        if (method_exists($this, 'network_admin_notices_'.$this->_current_view)) {
691
+            add_action('network_admin_notices', [$this, 'network_admin_notices_'.$this->_current_view]);
692 692
         }
693 693
         // this will save any per_page screen options if they are present
694 694
         $this->_set_per_page_screen_options();
@@ -809,7 +809,7 @@  discard block
 block discarded – undo
809 809
     protected function _verify_routes()
810 810
     {
811 811
         do_action('AHEE_log', __FILE__, __FUNCTION__, '');
812
-        if (! $this->_current_page && ! $this->request->isAjax()) {
812
+        if ( ! $this->_current_page && ! $this->request->isAjax()) {
813 813
             return false;
814 814
         }
815 815
         $this->_route = false;
@@ -821,7 +821,7 @@  discard block
 block discarded – undo
821 821
                 $this->_admin_page_title
822 822
             );
823 823
             // developer error msg
824
-            $error_msg .= '||' . $error_msg
824
+            $error_msg .= '||'.$error_msg
825 825
                           . esc_html__(
826 826
                               ' Make sure the "set_page_routes()" method exists, and is setting the "_page_routes" array properly.',
827 827
                               'event_espresso'
@@ -830,9 +830,9 @@  discard block
 block discarded – undo
830 830
         }
831 831
         // and that the requested page route exists
832 832
         if (array_key_exists($this->_req_action, $this->_page_routes)) {
833
-            $this->_route        = $this->_page_routes[ $this->_req_action ];
834
-            $this->_route_config = isset($this->_page_config[ $this->_req_action ])
835
-                ? $this->_page_config[ $this->_req_action ]
833
+            $this->_route        = $this->_page_routes[$this->_req_action];
834
+            $this->_route_config = isset($this->_page_config[$this->_req_action])
835
+                ? $this->_page_config[$this->_req_action]
836 836
                 : [];
837 837
         } else {
838 838
             // user error msg
@@ -844,7 +844,7 @@  discard block
 block discarded – undo
844 844
                 $this->_admin_page_title
845 845
             );
846 846
             // developer error msg
847
-            $error_msg .= '||' . $error_msg
847
+            $error_msg .= '||'.$error_msg
848 848
                           . sprintf(
849 849
                               esc_html__(
850 850
                                   ' Create a key in the "_page_routes" array named "%s" and set its value to the appropriate method.',
@@ -855,7 +855,7 @@  discard block
 block discarded – undo
855 855
             throw new EE_Error($error_msg);
856 856
         }
857 857
         // and that a default route exists
858
-        if (! array_key_exists('default', $this->_page_routes)) {
858
+        if ( ! array_key_exists('default', $this->_page_routes)) {
859 859
             // user error msg
860 860
             $error_msg = sprintf(
861 861
                 esc_html__(
@@ -865,7 +865,7 @@  discard block
 block discarded – undo
865 865
                 $this->_admin_page_title
866 866
             );
867 867
             // developer error msg
868
-            $error_msg .= '||' . $error_msg
868
+            $error_msg .= '||'.$error_msg
869 869
                           . esc_html__(
870 870
                               ' Create a key in the "_page_routes" array named "default" and set its value to your default page method.',
871 871
                               'event_espresso'
@@ -906,7 +906,7 @@  discard block
 block discarded – undo
906 906
             $this->_admin_page_title
907 907
         );
908 908
         // developer error msg
909
-        $error_msg .= '||' . $error_msg
909
+        $error_msg .= '||'.$error_msg
910 910
                       . sprintf(
911 911
                           esc_html__(
912 912
                               ' Check the route you are using in your method (%s) and make sure it matches a route set in your "_page_routes" array property',
@@ -931,7 +931,7 @@  discard block
 block discarded – undo
931 931
     protected function _verify_nonce($nonce, $nonce_ref)
932 932
     {
933 933
         // verify nonce against expected value
934
-        if (! wp_verify_nonce($nonce, $nonce_ref)) {
934
+        if ( ! wp_verify_nonce($nonce, $nonce_ref)) {
935 935
             // these are not the droids you are looking for !!!
936 936
             $msg = sprintf(
937 937
                 esc_html__('%sNonce Fail.%s', 'event_espresso'),
@@ -948,7 +948,7 @@  discard block
 block discarded – undo
948 948
                     __CLASS__
949 949
                 );
950 950
             }
951
-            if (! $this->request->isAjax()) {
951
+            if ( ! $this->request->isAjax()) {
952 952
                 wp_die($msg);
953 953
             }
954 954
             EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
@@ -972,7 +972,7 @@  discard block
 block discarded – undo
972 972
      */
973 973
     protected function _route_admin_request()
974 974
     {
975
-        if (! $this->_is_UI_request) {
975
+        if ( ! $this->_is_UI_request) {
976 976
             $this->_verify_routes();
977 977
         }
978 978
         $nonce_check = ! isset($this->_route_config['require_nonce']) || $this->_route_config['require_nonce'];
@@ -992,7 +992,7 @@  discard block
 block discarded – undo
992 992
         $error_msg = '';
993 993
         // action right before calling route
994 994
         // (hook is something like 'AHEE__Registrations_Admin_Page__route_admin_request')
995
-        if (! did_action('AHEE__EE_Admin_Page__route_admin_request')) {
995
+        if ( ! did_action('AHEE__EE_Admin_Page__route_admin_request')) {
996 996
             do_action('AHEE__EE_Admin_Page__route_admin_request', $this->_current_view, $this);
997 997
         }
998 998
         // right before calling the route, let's clean the _wp_http_referer
@@ -1003,7 +1003,7 @@  discard block
 block discarded – undo
1003 1003
                 wp_unslash($this->request->getServerParam('REQUEST_URI'))
1004 1004
             )
1005 1005
         );
1006
-        if (! empty($func)) {
1006
+        if ( ! empty($func)) {
1007 1007
             if (is_array($func)) {
1008 1008
                 list($class, $method) = $func;
1009 1009
             } elseif (strpos($func, '::') !== false) {
@@ -1012,7 +1012,7 @@  discard block
 block discarded – undo
1012 1012
                 $class  = $this;
1013 1013
                 $method = $func;
1014 1014
             }
1015
-            if (! (is_object($class) && $class === $this)) {
1015
+            if ( ! (is_object($class) && $class === $this)) {
1016 1016
                 // send along this admin page object for access by addons.
1017 1017
                 $args['admin_page_object'] = $this;
1018 1018
             }
@@ -1053,7 +1053,7 @@  discard block
 block discarded – undo
1053 1053
                     $method
1054 1054
                 );
1055 1055
             }
1056
-            if (! empty($error_msg)) {
1056
+            if ( ! empty($error_msg)) {
1057 1057
                 throw new EE_Error($error_msg);
1058 1058
             }
1059 1059
         }
@@ -1138,7 +1138,7 @@  discard block
 block discarded – undo
1138 1138
                 if (strpos($key, 'nonce') !== false) {
1139 1139
                     continue;
1140 1140
                 }
1141
-                $args[ 'wp_referer[' . $key . ']' ] = is_string($value) ? htmlspecialchars($value) : $value;
1141
+                $args['wp_referer['.$key.']'] = is_string($value) ? htmlspecialchars($value) : $value;
1142 1142
             }
1143 1143
         }
1144 1144
         return EEH_URL::add_query_args_and_nonce($args, $url, $exclude_nonce);
@@ -1177,12 +1177,12 @@  discard block
 block discarded – undo
1177 1177
      */
1178 1178
     protected function _add_help_tabs()
1179 1179
     {
1180
-        if (isset($this->_page_config[ $this->_req_action ])) {
1181
-            $config = $this->_page_config[ $this->_req_action ];
1180
+        if (isset($this->_page_config[$this->_req_action])) {
1181
+            $config = $this->_page_config[$this->_req_action];
1182 1182
             // let's see if there is a help_sidebar set for the current route and we'll set that up for usage as well.
1183 1183
             if (is_array($config) && isset($config['help_sidebar'])) {
1184 1184
                 // check that the callback given is valid
1185
-                if (! method_exists($this, $config['help_sidebar'])) {
1185
+                if ( ! method_exists($this, $config['help_sidebar'])) {
1186 1186
                     throw new EE_Error(
1187 1187
                         sprintf(
1188 1188
                             esc_html__(
@@ -1195,18 +1195,18 @@  discard block
 block discarded – undo
1195 1195
                     );
1196 1196
                 }
1197 1197
                 $content = apply_filters(
1198
-                    'FHEE__' . get_class($this) . '__add_help_tabs__help_sidebar',
1198
+                    'FHEE__'.get_class($this).'__add_help_tabs__help_sidebar',
1199 1199
                     $this->{$config['help_sidebar']}()
1200 1200
                 );
1201 1201
                 $this->_current_screen->set_help_sidebar($content);
1202 1202
             }
1203
-            if (! isset($config['help_tabs'])) {
1203
+            if ( ! isset($config['help_tabs'])) {
1204 1204
                 return;
1205 1205
             } //no help tabs for this route
1206 1206
             foreach ((array) $config['help_tabs'] as $tab_id => $cfg) {
1207 1207
                 // we're here so there ARE help tabs!
1208 1208
                 // make sure we've got what we need
1209
-                if (! isset($cfg['title'])) {
1209
+                if ( ! isset($cfg['title'])) {
1210 1210
                     throw new EE_Error(
1211 1211
                         esc_html__(
1212 1212
                             'The _page_config array is not set up properly for help tabs.  It is missing a title',
@@ -1214,7 +1214,7 @@  discard block
 block discarded – undo
1214 1214
                         )
1215 1215
                     );
1216 1216
                 }
1217
-                if (! isset($cfg['filename']) && ! isset($cfg['callback']) && ! isset($cfg['content'])) {
1217
+                if ( ! isset($cfg['filename']) && ! isset($cfg['callback']) && ! isset($cfg['content'])) {
1218 1218
                     throw new EE_Error(
1219 1219
                         esc_html__(
1220 1220
                             'The _page_config array is not setup properly for help tabs. It is missing a either a filename reference, or a callback reference or a content reference so there is no way to know the content for the help tab',
@@ -1223,11 +1223,11 @@  discard block
 block discarded – undo
1223 1223
                     );
1224 1224
                 }
1225 1225
                 // first priority goes to content.
1226
-                if (! empty($cfg['content'])) {
1226
+                if ( ! empty($cfg['content'])) {
1227 1227
                     $content = ! empty($cfg['content']) ? $cfg['content'] : null;
1228 1228
                     // second priority goes to filename
1229
-                } elseif (! empty($cfg['filename'])) {
1230
-                    $file_path = $this->_get_dir() . '/help_tabs/' . $cfg['filename'] . '.help_tab.php';
1229
+                } elseif ( ! empty($cfg['filename'])) {
1230
+                    $file_path = $this->_get_dir().'/help_tabs/'.$cfg['filename'].'.help_tab.php';
1231 1231
                     // it's possible that the file is located on decaf route (and above sets up for caf route, if this is the case then lets check decaf route too)
1232 1232
                     $file_path = ! is_readable($file_path) ? EE_ADMIN_PAGES
1233 1233
                                                              . basename($this->_get_dir())
@@ -1235,7 +1235,7 @@  discard block
 block discarded – undo
1235 1235
                                                              . $cfg['filename']
1236 1236
                                                              . '.help_tab.php' : $file_path;
1237 1237
                     // if file is STILL not readable then let's do a EE_Error so its more graceful than a fatal error.
1238
-                    if (! isset($cfg['callback']) && ! is_readable($file_path)) {
1238
+                    if ( ! isset($cfg['callback']) && ! is_readable($file_path)) {
1239 1239
                         EE_Error::add_error(
1240 1240
                             sprintf(
1241 1241
                                 esc_html__(
@@ -1283,7 +1283,7 @@  discard block
 block discarded – undo
1283 1283
                     return;
1284 1284
                 }
1285 1285
                 // setup config array for help tab method
1286
-                $id  = $this->page_slug . '-' . $this->_req_action . '-' . $tab_id;
1286
+                $id  = $this->page_slug.'-'.$this->_req_action.'-'.$tab_id;
1287 1287
                 $_ht = [
1288 1288
                     'id'       => $id,
1289 1289
                     'title'    => $cfg['title'],
@@ -1307,8 +1307,8 @@  discard block
 block discarded – undo
1307 1307
             $qtips = (array) $this->_route_config['qtips'];
1308 1308
             // load qtip loader
1309 1309
             $path = [
1310
-                $this->_get_dir() . '/qtips/',
1311
-                EE_ADMIN_PAGES . basename($this->_get_dir()) . '/qtips/',
1310
+                $this->_get_dir().'/qtips/',
1311
+                EE_ADMIN_PAGES.basename($this->_get_dir()).'/qtips/',
1312 1312
             ];
1313 1313
             EEH_Qtip_Loader::instance()->register($qtips, $path);
1314 1314
         }
@@ -1330,7 +1330,7 @@  discard block
 block discarded – undo
1330 1330
         do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1331 1331
         $i = 0;
1332 1332
         foreach ($this->_page_config as $slug => $config) {
1333
-            if (! is_array($config) || empty($config['nav'])) {
1333
+            if ( ! is_array($config) || empty($config['nav'])) {
1334 1334
                 continue;
1335 1335
             }
1336 1336
             // no nav tab for this config
@@ -1339,12 +1339,12 @@  discard block
 block discarded – undo
1339 1339
                 // nav tab is only to appear when route requested.
1340 1340
                 continue;
1341 1341
             }
1342
-            if (! $this->check_user_access($slug, true)) {
1342
+            if ( ! $this->check_user_access($slug, true)) {
1343 1343
                 // no nav tab because current user does not have access.
1344 1344
                 continue;
1345 1345
             }
1346
-            $css_class                = isset($config['css_class']) ? $config['css_class'] . ' ' : '';
1347
-            $this->_nav_tabs[ $slug ] = [
1346
+            $css_class                = isset($config['css_class']) ? $config['css_class'].' ' : '';
1347
+            $this->_nav_tabs[$slug] = [
1348 1348
                 'url'       => isset($config['nav']['url'])
1349 1349
                     ? $config['nav']['url']
1350 1350
                     : self::add_query_args_and_nonce(
@@ -1356,14 +1356,14 @@  discard block
 block discarded – undo
1356 1356
                     : ucwords(
1357 1357
                         str_replace('_', ' ', $slug)
1358 1358
                     ),
1359
-                'css_class' => $this->_req_action === $slug ? $css_class . 'nav-tab-active' : $css_class,
1359
+                'css_class' => $this->_req_action === $slug ? $css_class.'nav-tab-active' : $css_class,
1360 1360
                 'order'     => isset($config['nav']['order']) ? $config['nav']['order'] : $i,
1361 1361
             ];
1362 1362
             $i++;
1363 1363
         }
1364 1364
         // if $this->_nav_tabs is empty then lets set the default
1365 1365
         if (empty($this->_nav_tabs)) {
1366
-            $this->_nav_tabs[ $this->_default_nav_tab_name ] = [
1366
+            $this->_nav_tabs[$this->_default_nav_tab_name] = [
1367 1367
                 'url'       => $this->_admin_base_url,
1368 1368
                 'link_text' => ucwords(str_replace('_', ' ', $this->_default_nav_tab_name)),
1369 1369
                 'css_class' => 'nav-tab-active',
@@ -1388,10 +1388,10 @@  discard block
 block discarded – undo
1388 1388
             foreach ($this->_route_config['labels'] as $label => $text) {
1389 1389
                 if (is_array($text)) {
1390 1390
                     foreach ($text as $sublabel => $subtext) {
1391
-                        $this->_labels[ $label ][ $sublabel ] = $subtext;
1391
+                        $this->_labels[$label][$sublabel] = $subtext;
1392 1392
                     }
1393 1393
                 } else {
1394
-                    $this->_labels[ $label ] = $text;
1394
+                    $this->_labels[$label] = $text;
1395 1395
                 }
1396 1396
             }
1397 1397
         }
@@ -1413,12 +1413,12 @@  discard block
 block discarded – undo
1413 1413
     {
1414 1414
         do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1415 1415
         $route_to_check = empty($route_to_check) ? $this->_req_action : $route_to_check;
1416
-        $capability     = ! empty($route_to_check) && isset($this->_page_routes[ $route_to_check ])
1416
+        $capability     = ! empty($route_to_check) && isset($this->_page_routes[$route_to_check])
1417 1417
                           && is_array(
1418
-                              $this->_page_routes[ $route_to_check ]
1418
+                              $this->_page_routes[$route_to_check]
1419 1419
                           )
1420
-                          && ! empty($this->_page_routes[ $route_to_check ]['capability'])
1421
-            ? $this->_page_routes[ $route_to_check ]['capability'] : null;
1420
+                          && ! empty($this->_page_routes[$route_to_check]['capability'])
1421
+            ? $this->_page_routes[$route_to_check]['capability'] : null;
1422 1422
         if (empty($capability) && empty($route_to_check)) {
1423 1423
             $capability = is_array($this->_route) && empty($this->_route['capability']) ? 'manage_options'
1424 1424
                 : $this->_route['capability'];
@@ -1538,7 +1538,7 @@  discard block
 block discarded – undo
1538 1538
         ';
1539 1539
 
1540 1540
         // current set timezone for timezone js
1541
-        echo '<span id="current_timezone" class="hidden">' . esc_html(EEH_DTT_Helper::get_timezone()) . '</span>';
1541
+        echo '<span id="current_timezone" class="hidden">'.esc_html(EEH_DTT_Helper::get_timezone()).'</span>';
1542 1542
     }
1543 1543
 
1544 1544
 
@@ -1572,7 +1572,7 @@  discard block
 block discarded – undo
1572 1572
         // loop through the array and setup content
1573 1573
         foreach ($help_array as $trigger => $help) {
1574 1574
             // make sure the array is setup properly
1575
-            if (! isset($help['title']) || ! isset($help['content'])) {
1575
+            if ( ! isset($help['title']) || ! isset($help['content'])) {
1576 1576
                 throw new EE_Error(
1577 1577
                     esc_html__(
1578 1578
                         'Does not look like the popup content array has been setup correctly.  Might want to double check that.  Read the comments for the _get_help_popup_content method found in "EE_Admin_Page" class',
@@ -1586,8 +1586,8 @@  discard block
 block discarded – undo
1586 1586
                 'help_popup_title'   => $help['title'],
1587 1587
                 'help_popup_content' => $help['content'],
1588 1588
             ];
1589
-            $content       .= EEH_Template::display_template(
1590
-                EE_ADMIN_TEMPLATE . 'admin_help_popup.template.php',
1589
+            $content .= EEH_Template::display_template(
1590
+                EE_ADMIN_TEMPLATE.'admin_help_popup.template.php',
1591 1591
                 $template_args,
1592 1592
                 true
1593 1593
             );
@@ -1609,15 +1609,15 @@  discard block
 block discarded – undo
1609 1609
     private function _get_help_content()
1610 1610
     {
1611 1611
         // what is the method we're looking for?
1612
-        $method_name = '_help_popup_content_' . $this->_req_action;
1612
+        $method_name = '_help_popup_content_'.$this->_req_action;
1613 1613
         // if method doesn't exist let's get out.
1614
-        if (! method_exists($this, $method_name)) {
1614
+        if ( ! method_exists($this, $method_name)) {
1615 1615
             return [];
1616 1616
         }
1617 1617
         // k we're good to go let's retrieve the help array
1618 1618
         $help_array = call_user_func([$this, $method_name]);
1619 1619
         // make sure we've got an array!
1620
-        if (! is_array($help_array)) {
1620
+        if ( ! is_array($help_array)) {
1621 1621
             throw new EE_Error(
1622 1622
                 esc_html__(
1623 1623
                     'Something went wrong with help popup content generation. Expecting an array and well, this ain\'t no array bub.',
@@ -1649,15 +1649,15 @@  discard block
 block discarded – undo
1649 1649
         // let's check and see if there is any content set for this popup.  If there isn't then we'll include a default title and content so that developers know something needs to be corrected
1650 1650
         $help_array   = $this->_get_help_content();
1651 1651
         $help_content = '';
1652
-        if (empty($help_array) || ! isset($help_array[ $trigger_id ])) {
1653
-            $help_array[ $trigger_id ] = [
1652
+        if (empty($help_array) || ! isset($help_array[$trigger_id])) {
1653
+            $help_array[$trigger_id] = [
1654 1654
                 'title'   => esc_html__('Missing Content', 'event_espresso'),
1655 1655
                 'content' => esc_html__(
1656 1656
                     'A trigger has been set that doesn\'t have any corresponding content. Make sure you have set the help content. (see the "_set_help_popup_content" method in the EE_Admin_Page for instructions.)',
1657 1657
                     'event_espresso'
1658 1658
                 ),
1659 1659
             ];
1660
-            $help_content              = $this->_set_help_popup_content($help_array);
1660
+            $help_content = $this->_set_help_popup_content($help_array);
1661 1661
         }
1662 1662
         // let's setup the trigger
1663 1663
         $content = '<a class="ee-dialog" href="?height='
@@ -1725,15 +1725,15 @@  discard block
 block discarded – undo
1725 1725
         // register all styles
1726 1726
         wp_register_style(
1727 1727
             'espresso-ui-theme',
1728
-            EE_GLOBAL_ASSETS_URL . 'css/espresso-ui-theme/jquery-ui-1.10.3.custom.min.css',
1728
+            EE_GLOBAL_ASSETS_URL.'css/espresso-ui-theme/jquery-ui-1.10.3.custom.min.css',
1729 1729
             [],
1730 1730
             EVENT_ESPRESSO_VERSION
1731 1731
         );
1732
-        wp_register_style('ee-admin-css', EE_ADMIN_URL . 'assets/ee-admin-page.css', [], EVENT_ESPRESSO_VERSION);
1732
+        wp_register_style('ee-admin-css', EE_ADMIN_URL.'assets/ee-admin-page.css', [], EVENT_ESPRESSO_VERSION);
1733 1733
         // helpers styles
1734 1734
         wp_register_style(
1735 1735
             'ee-text-links',
1736
-            EE_PLUGIN_DIR_URL . 'core/helpers/assets/ee_text_list_helper.css',
1736
+            EE_PLUGIN_DIR_URL.'core/helpers/assets/ee_text_list_helper.css',
1737 1737
             [],
1738 1738
             EVENT_ESPRESSO_VERSION
1739 1739
         );
@@ -1741,21 +1741,21 @@  discard block
 block discarded – undo
1741 1741
         // register all scripts
1742 1742
         wp_register_script(
1743 1743
             'ee-dialog',
1744
-            EE_ADMIN_URL . 'assets/ee-dialog-helper.js',
1744
+            EE_ADMIN_URL.'assets/ee-dialog-helper.js',
1745 1745
             ['jquery', 'jquery-ui-draggable'],
1746 1746
             EVENT_ESPRESSO_VERSION,
1747 1747
             true
1748 1748
         );
1749 1749
         wp_register_script(
1750 1750
             'ee_admin_js',
1751
-            EE_ADMIN_URL . 'assets/ee-admin-page.js',
1751
+            EE_ADMIN_URL.'assets/ee-admin-page.js',
1752 1752
             ['espresso_core', 'ee-parse-uri', 'ee-dialog'],
1753 1753
             EVENT_ESPRESSO_VERSION,
1754 1754
             true
1755 1755
         );
1756 1756
         wp_register_script(
1757 1757
             'jquery-ui-timepicker-addon',
1758
-            EE_GLOBAL_ASSETS_URL . 'scripts/jquery-ui-timepicker-addon.js',
1758
+            EE_GLOBAL_ASSETS_URL.'scripts/jquery-ui-timepicker-addon.js',
1759 1759
             ['jquery-ui-datepicker', 'jquery-ui-slider'],
1760 1760
             EVENT_ESPRESSO_VERSION,
1761 1761
             true
@@ -1763,7 +1763,7 @@  discard block
 block discarded – undo
1763 1763
         // script for sorting tables
1764 1764
         wp_register_script(
1765 1765
             'espresso_ajax_table_sorting',
1766
-            EE_ADMIN_URL . 'assets/espresso_ajax_table_sorting.js',
1766
+            EE_ADMIN_URL.'assets/espresso_ajax_table_sorting.js',
1767 1767
             ['ee_admin_js', 'jquery-ui-sortable'],
1768 1768
             EVENT_ESPRESSO_VERSION,
1769 1769
             true
@@ -1771,7 +1771,7 @@  discard block
 block discarded – undo
1771 1771
         // script for parsing uri's
1772 1772
         wp_register_script(
1773 1773
             'ee-parse-uri',
1774
-            EE_GLOBAL_ASSETS_URL . 'scripts/parseuri.js',
1774
+            EE_GLOBAL_ASSETS_URL.'scripts/parseuri.js',
1775 1775
             [],
1776 1776
             EVENT_ESPRESSO_VERSION,
1777 1777
             true
@@ -1779,7 +1779,7 @@  discard block
 block discarded – undo
1779 1779
         // and parsing associative serialized form elements
1780 1780
         wp_register_script(
1781 1781
             'ee-serialize-full-array',
1782
-            EE_GLOBAL_ASSETS_URL . 'scripts/jquery.serializefullarray.js',
1782
+            EE_GLOBAL_ASSETS_URL.'scripts/jquery.serializefullarray.js',
1783 1783
             ['jquery'],
1784 1784
             EVENT_ESPRESSO_VERSION,
1785 1785
             true
@@ -1787,28 +1787,28 @@  discard block
 block discarded – undo
1787 1787
         // helpers scripts
1788 1788
         wp_register_script(
1789 1789
             'ee-text-links',
1790
-            EE_PLUGIN_DIR_URL . 'core/helpers/assets/ee_text_list_helper.js',
1790
+            EE_PLUGIN_DIR_URL.'core/helpers/assets/ee_text_list_helper.js',
1791 1791
             ['jquery'],
1792 1792
             EVENT_ESPRESSO_VERSION,
1793 1793
             true
1794 1794
         );
1795 1795
         wp_register_script(
1796 1796
             'ee-moment-core',
1797
-            EE_THIRD_PARTY_URL . 'moment/moment-with-locales.min.js',
1797
+            EE_THIRD_PARTY_URL.'moment/moment-with-locales.min.js',
1798 1798
             [],
1799 1799
             EVENT_ESPRESSO_VERSION,
1800 1800
             true
1801 1801
         );
1802 1802
         wp_register_script(
1803 1803
             'ee-moment',
1804
-            EE_THIRD_PARTY_URL . 'moment/moment-timezone-with-data.min.js',
1804
+            EE_THIRD_PARTY_URL.'moment/moment-timezone-with-data.min.js',
1805 1805
             ['ee-moment-core'],
1806 1806
             EVENT_ESPRESSO_VERSION,
1807 1807
             true
1808 1808
         );
1809 1809
         wp_register_script(
1810 1810
             'ee-datepicker',
1811
-            EE_ADMIN_URL . 'assets/ee-datepicker.js',
1811
+            EE_ADMIN_URL.'assets/ee-datepicker.js',
1812 1812
             ['jquery-ui-timepicker-addon', 'ee-moment'],
1813 1813
             EVENT_ESPRESSO_VERSION,
1814 1814
             true
@@ -1841,7 +1841,7 @@  discard block
 block discarded – undo
1841 1841
         wp_localize_script('ee_admin_js', 'eeLazyLoadingContainers', $lazy_loader_container_ids);
1842 1842
         add_filter(
1843 1843
             'admin_body_class',
1844
-            function ($classes) {
1844
+            function($classes) {
1845 1845
                 if (strpos($classes, 'espresso-admin') === false) {
1846 1846
                     $classes .= ' espresso-admin';
1847 1847
                 }
@@ -1929,12 +1929,12 @@  discard block
 block discarded – undo
1929 1929
     protected function _set_list_table()
1930 1930
     {
1931 1931
         // first is this a list_table view?
1932
-        if (! isset($this->_route_config['list_table'])) {
1932
+        if ( ! isset($this->_route_config['list_table'])) {
1933 1933
             return;
1934 1934
         } //not a list_table view so get out.
1935 1935
         // list table functions are per view specific (because some admin pages might have more than one list table!)
1936
-        $list_table_view = '_set_list_table_views_' . $this->_req_action;
1937
-        if (! method_exists($this, $list_table_view) || $this->{$list_table_view}() === false) {
1936
+        $list_table_view = '_set_list_table_views_'.$this->_req_action;
1937
+        if ( ! method_exists($this, $list_table_view) || $this->{$list_table_view}() === false) {
1938 1938
             // user error msg
1939 1939
             $error_msg = esc_html__(
1940 1940
                 'An error occurred. The requested list table views could not be found.',
@@ -1954,10 +1954,10 @@  discard block
 block discarded – undo
1954 1954
         }
1955 1955
         // let's provide the ability to filter the views per PAGE AND ROUTE, per PAGE, and globally
1956 1956
         $this->_views = apply_filters(
1957
-            'FHEE_list_table_views_' . $this->page_slug . '_' . $this->_req_action,
1957
+            'FHEE_list_table_views_'.$this->page_slug.'_'.$this->_req_action,
1958 1958
             $this->_views
1959 1959
         );
1960
-        $this->_views = apply_filters('FHEE_list_table_views_' . $this->page_slug, $this->_views);
1960
+        $this->_views = apply_filters('FHEE_list_table_views_'.$this->page_slug, $this->_views);
1961 1961
         $this->_views = apply_filters('FHEE_list_table_views', $this->_views);
1962 1962
         $this->_set_list_table_view();
1963 1963
         $this->_set_list_table_object();
@@ -1992,7 +1992,7 @@  discard block
 block discarded – undo
1992 1992
     protected function _set_list_table_object()
1993 1993
     {
1994 1994
         if (isset($this->_route_config['list_table'])) {
1995
-            if (! class_exists($this->_route_config['list_table'])) {
1995
+            if ( ! class_exists($this->_route_config['list_table'])) {
1996 1996
                 throw new EE_Error(
1997 1997
                     sprintf(
1998 1998
                         esc_html__(
@@ -2030,15 +2030,15 @@  discard block
 block discarded – undo
2030 2030
         foreach ($this->_views as $key => $view) {
2031 2031
             $query_args = [];
2032 2032
             // check for current view
2033
-            $this->_views[ $key ]['class']               = $this->_view === $view['slug'] ? 'current' : '';
2033
+            $this->_views[$key]['class']               = $this->_view === $view['slug'] ? 'current' : '';
2034 2034
             $query_args['action']                        = $this->_req_action;
2035
-            $query_args[ $this->_req_action . '_nonce' ] = wp_create_nonce($query_args['action'] . '_nonce');
2035
+            $query_args[$this->_req_action.'_nonce'] = wp_create_nonce($query_args['action'].'_nonce');
2036 2036
             $query_args['status']                        = $view['slug'];
2037 2037
             // merge any other arguments sent in.
2038
-            if (isset($extra_query_args[ $view['slug'] ])) {
2039
-                $query_args = array_merge($query_args, $extra_query_args[ $view['slug'] ]);
2038
+            if (isset($extra_query_args[$view['slug']])) {
2039
+                $query_args = array_merge($query_args, $extra_query_args[$view['slug']]);
2040 2040
             }
2041
-            $this->_views[ $key ]['url'] = EE_Admin_Page::add_query_args_and_nonce($query_args, $this->_admin_base_url);
2041
+            $this->_views[$key]['url'] = EE_Admin_Page::add_query_args_and_nonce($query_args, $this->_admin_base_url);
2042 2042
         }
2043 2043
         return $this->_views;
2044 2044
     }
@@ -2069,14 +2069,14 @@  discard block
 block discarded – undo
2069 2069
 					<select id="entries-per-page-slct" name="entries-per-page-slct">';
2070 2070
         foreach ($values as $value) {
2071 2071
             if ($value < $max_entries) {
2072
-                $selected                  = $value === $per_page ? ' selected="' . $per_page . '"' : '';
2072
+                $selected = $value === $per_page ? ' selected="'.$per_page.'"' : '';
2073 2073
                 $entries_per_page_dropdown .= '
2074
-						<option value="' . $value . '"' . $selected . '>' . $value . '&nbsp;&nbsp;</option>';
2074
+						<option value="' . $value.'"'.$selected.'>'.$value.'&nbsp;&nbsp;</option>';
2075 2075
             }
2076 2076
         }
2077
-        $selected                  = $max_entries === $per_page ? ' selected="' . $per_page . '"' : '';
2077
+        $selected = $max_entries === $per_page ? ' selected="'.$per_page.'"' : '';
2078 2078
         $entries_per_page_dropdown .= '
2079
-						<option value="' . $max_entries . '"' . $selected . '>All&nbsp;&nbsp;</option>';
2079
+						<option value="' . $max_entries.'"'.$selected.'>All&nbsp;&nbsp;</option>';
2080 2080
         $entries_per_page_dropdown .= '
2081 2081
 					</select>
2082 2082
 					entries
@@ -2100,7 +2100,7 @@  discard block
 block discarded – undo
2100 2100
             empty($this->_search_btn_label) ? $this->page_label
2101 2101
                 : $this->_search_btn_label
2102 2102
         );
2103
-        $this->_template_args['search']['callback']  = 'search_' . $this->page_slug;
2103
+        $this->_template_args['search']['callback'] = 'search_'.$this->page_slug;
2104 2104
     }
2105 2105
 
2106 2106
 
@@ -2188,7 +2188,7 @@  discard block
 block discarded – undo
2188 2188
             $total_columns                                       = ! empty($screen_columns)
2189 2189
                 ? $screen_columns
2190 2190
                 : $this->_route_config['columns'][1];
2191
-            $this->_template_args['current_screen_widget_class'] = 'columns-' . $total_columns;
2191
+            $this->_template_args['current_screen_widget_class'] = 'columns-'.$total_columns;
2192 2192
             $this->_template_args['current_page']                = $this->_wp_page_slug;
2193 2193
             $this->_template_args['screen']                      = $this->_current_screen;
2194 2194
             $this->_column_template_path                         = EE_ADMIN_TEMPLATE
@@ -2233,7 +2233,7 @@  discard block
 block discarded – undo
2233 2233
      */
2234 2234
     protected function _espresso_ratings_request()
2235 2235
     {
2236
-        if (! apply_filters('FHEE_show_ratings_request_meta_box', true)) {
2236
+        if ( ! apply_filters('FHEE_show_ratings_request_meta_box', true)) {
2237 2237
             return;
2238 2238
         }
2239 2239
         $ratings_box_title = apply_filters(
@@ -2261,7 +2261,7 @@  discard block
 block discarded – undo
2261 2261
     public function espresso_ratings_request()
2262 2262
     {
2263 2263
         EEH_Template::display_template(
2264
-            EE_ADMIN_TEMPLATE . 'espresso_ratings_request_content.template.php',
2264
+            EE_ADMIN_TEMPLATE.'espresso_ratings_request_content.template.php',
2265 2265
             []
2266 2266
         );
2267 2267
     }
@@ -2269,22 +2269,22 @@  discard block
 block discarded – undo
2269 2269
 
2270 2270
     public static function cached_rss_display($rss_id, $url)
2271 2271
     {
2272
-        $loading   = '<p class="widget-loading hide-if-no-js">'
2272
+        $loading = '<p class="widget-loading hide-if-no-js">'
2273 2273
                      . esc_html__('Loading&#8230;', 'event_espresso')
2274 2274
                      . '</p><p class="hide-if-js">'
2275 2275
                      . esc_html__('This widget requires JavaScript.', 'event_espresso')
2276 2276
                      . '</p>';
2277
-        $pre       = '<div class="espresso-rss-display">' . "\n\t";
2278
-        $pre       .= '<span id="' . esc_attr($rss_id) . '_url" class="hidden">' . esc_url_raw($url) . '</span>';
2279
-        $post      = '</div>' . "\n";
2280
-        $cache_key = 'ee_rss_' . md5($rss_id);
2277
+        $pre       = '<div class="espresso-rss-display">'."\n\t";
2278
+        $pre .= '<span id="'.esc_attr($rss_id).'_url" class="hidden">'.esc_url_raw($url).'</span>';
2279
+        $post      = '</div>'."\n";
2280
+        $cache_key = 'ee_rss_'.md5($rss_id);
2281 2281
         $output    = get_transient($cache_key);
2282 2282
         if ($output !== false) {
2283
-            echo wp_kses($pre . $output . $post, AllowedTags::getWithFormTags());
2283
+            echo wp_kses($pre.$output.$post, AllowedTags::getWithFormTags());
2284 2284
             return true;
2285 2285
         }
2286
-        if (! (defined('DOING_AJAX') && DOING_AJAX)) {
2287
-            echo wp_kses($pre . $loading . $post, AllowedTags::getWithFormTags());
2286
+        if ( ! (defined('DOING_AJAX') && DOING_AJAX)) {
2287
+            echo wp_kses($pre.$loading.$post, AllowedTags::getWithFormTags());
2288 2288
             return false;
2289 2289
         }
2290 2290
         ob_start();
@@ -2351,19 +2351,19 @@  discard block
 block discarded – undo
2351 2351
     public function espresso_sponsors_post_box()
2352 2352
     {
2353 2353
         EEH_Template::display_template(
2354
-            EE_ADMIN_TEMPLATE . 'admin_general_metabox_contents_espresso_sponsors.template.php'
2354
+            EE_ADMIN_TEMPLATE.'admin_general_metabox_contents_espresso_sponsors.template.php'
2355 2355
         );
2356 2356
     }
2357 2357
 
2358 2358
 
2359 2359
     private function _publish_post_box()
2360 2360
     {
2361
-        $meta_box_ref = 'espresso_' . $this->page_slug . '_editor_overview';
2361
+        $meta_box_ref = 'espresso_'.$this->page_slug.'_editor_overview';
2362 2362
         // if there is a array('label' => array('publishbox' => 'some title') ) present in the _page_config array
2363 2363
         // then we'll use that for the metabox label.
2364 2364
         // Otherwise we'll just use publish (publishbox itself could be an array of labels indexed by routes)
2365
-        if (! empty($this->_labels['publishbox'])) {
2366
-            $box_label = is_array($this->_labels['publishbox']) ? $this->_labels['publishbox'][ $this->_req_action ]
2365
+        if ( ! empty($this->_labels['publishbox'])) {
2366
+            $box_label = is_array($this->_labels['publishbox']) ? $this->_labels['publishbox'][$this->_req_action]
2367 2367
                 : $this->_labels['publishbox'];
2368 2368
         } else {
2369 2369
             $box_label = esc_html__('Publish', 'event_espresso');
@@ -2392,7 +2392,7 @@  discard block
 block discarded – undo
2392 2392
             ? $this->_template_args['publish_box_extra_content']
2393 2393
             : '';
2394 2394
         echo EEH_Template::display_template(
2395
-            EE_ADMIN_TEMPLATE . 'admin_details_publish_metabox.template.php',
2395
+            EE_ADMIN_TEMPLATE.'admin_details_publish_metabox.template.php',
2396 2396
             $this->_template_args,
2397 2397
             true
2398 2398
         );
@@ -2484,18 +2484,18 @@  discard block
 block discarded – undo
2484 2484
             );
2485 2485
         }
2486 2486
         $this->_template_args['publish_delete_link'] = ! empty($id) ? $delete : '';
2487
-        if (! empty($name) && ! empty($id)) {
2488
-            $hidden_field_arr[ $name ] = [
2487
+        if ( ! empty($name) && ! empty($id)) {
2488
+            $hidden_field_arr[$name] = [
2489 2489
                 'type'  => 'hidden',
2490 2490
                 'value' => $id,
2491 2491
             ];
2492
-            $hf                        = $this->_generate_admin_form_fields($hidden_field_arr, 'array');
2492
+            $hf = $this->_generate_admin_form_fields($hidden_field_arr, 'array');
2493 2493
         } else {
2494 2494
             $hf = '';
2495 2495
         }
2496 2496
         // add hidden field
2497 2497
         $this->_template_args['publish_hidden_fields'] = is_array($hf) && ! empty($name)
2498
-            ? $hf[ $name ]['field']
2498
+            ? $hf[$name]['field']
2499 2499
             : $hf;
2500 2500
     }
2501 2501
 
@@ -2597,7 +2597,7 @@  discard block
 block discarded – undo
2597 2597
         }
2598 2598
         // if $create_func is true (default) then we automatically create the function for displaying the actual meta box.  If false then we take the $callback reference passed through and use it instead (so callers can define their own callback function/method if they wish)
2599 2599
         $call_back_func = $create_func
2600
-            ? function ($post, $metabox) {
2600
+            ? function($post, $metabox) {
2601 2601
                 do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2602 2602
                 echo EEH_Template::display_template(
2603 2603
                     $metabox['args']['template_path'],
@@ -2607,7 +2607,7 @@  discard block
 block discarded – undo
2607 2607
             }
2608 2608
             : $callback;
2609 2609
         add_meta_box(
2610
-            str_replace('_', '-', $action) . '-mbox',
2610
+            str_replace('_', '-', $action).'-mbox',
2611 2611
             $title,
2612 2612
             $call_back_func,
2613 2613
             $this->_wp_page_slug,
@@ -2699,9 +2699,9 @@  discard block
 block discarded – undo
2699 2699
             : 'espresso-default-admin';
2700 2700
         $template_path                                     = $sidebar
2701 2701
             ? EE_ADMIN_TEMPLATE . 'admin_details_wrapper.template.php'
2702
-            : EE_ADMIN_TEMPLATE . 'admin_details_wrapper_no_sidebar.template.php';
2702
+            : EE_ADMIN_TEMPLATE.'admin_details_wrapper_no_sidebar.template.php';
2703 2703
         if ($this->request->isAjax()) {
2704
-            $template_path = EE_ADMIN_TEMPLATE . 'admin_details_wrapper_no_sidebar_ajax.template.php';
2704
+            $template_path = EE_ADMIN_TEMPLATE.'admin_details_wrapper_no_sidebar_ajax.template.php';
2705 2705
         }
2706 2706
         $template_path                                     = ! empty($this->_column_template_path)
2707 2707
             ? $this->_column_template_path : $template_path;
@@ -2741,11 +2741,11 @@  discard block
 block discarded – undo
2741 2741
     public function display_admin_caf_preview_page($utm_campaign_source = '', $display_sidebar = true)
2742 2742
     {
2743 2743
         // let's generate a default preview action button if there isn't one already present.
2744
-        $this->_labels['buttons']['buy_now']           = esc_html__(
2744
+        $this->_labels['buttons']['buy_now'] = esc_html__(
2745 2745
             'Upgrade to Event Espresso 4 Right Now',
2746 2746
             'event_espresso'
2747 2747
         );
2748
-        $buy_now_url                                   = add_query_arg(
2748
+        $buy_now_url = add_query_arg(
2749 2749
             [
2750 2750
                 'ee_ver'       => 'ee4',
2751 2751
                 'utm_source'   => 'ee4_plugin_admin',
@@ -2765,8 +2765,8 @@  discard block
 block discarded – undo
2765 2765
                 true
2766 2766
             )
2767 2767
             : $this->_template_args['preview_action_button'];
2768
-        $this->_template_args['admin_page_content']    = EEH_Template::display_template(
2769
-            EE_ADMIN_TEMPLATE . 'admin_caf_full_page_preview.template.php',
2768
+        $this->_template_args['admin_page_content'] = EEH_Template::display_template(
2769
+            EE_ADMIN_TEMPLATE.'admin_caf_full_page_preview.template.php',
2770 2770
             $this->_template_args,
2771 2771
             true
2772 2772
         );
@@ -2815,7 +2815,7 @@  discard block
 block discarded – undo
2815 2815
         // setup search attributes
2816 2816
         $this->_set_search_attributes();
2817 2817
         $this->_template_args['current_page']     = $this->_wp_page_slug;
2818
-        $template_path                            = EE_ADMIN_TEMPLATE . 'admin_list_wrapper.template.php';
2818
+        $template_path                            = EE_ADMIN_TEMPLATE.'admin_list_wrapper.template.php';
2819 2819
         $this->_template_args['table_url']        = $this->request->isAjax()
2820 2820
             ? add_query_arg(['noheader' => 'true', 'route' => $this->_req_action], $this->_admin_base_url)
2821 2821
             : add_query_arg(['route' => $this->_req_action], $this->_admin_base_url);
@@ -2823,10 +2823,10 @@  discard block
 block discarded – undo
2823 2823
         $this->_template_args['current_route']    = $this->_req_action;
2824 2824
         $this->_template_args['list_table_class'] = get_class($this->_list_table_object);
2825 2825
         $ajax_sorting_callback                    = $this->_list_table_object->get_ajax_sorting_callback();
2826
-        if (! empty($ajax_sorting_callback)) {
2826
+        if ( ! empty($ajax_sorting_callback)) {
2827 2827
             $sortable_list_table_form_fields = wp_nonce_field(
2828
-                $ajax_sorting_callback . '_nonce',
2829
-                $ajax_sorting_callback . '_nonce',
2828
+                $ajax_sorting_callback.'_nonce',
2829
+                $ajax_sorting_callback.'_nonce',
2830 2830
                 false,
2831 2831
                 false
2832 2832
             );
@@ -2844,20 +2844,20 @@  discard block
 block discarded – undo
2844 2844
             isset($this->_template_args['list_table_hidden_fields'])
2845 2845
                 ? $this->_template_args['list_table_hidden_fields']
2846 2846
                 : '';
2847
-        $nonce_ref                                               = $this->_req_action . '_nonce';
2848
-        $hidden_form_fields                                      .= '<input type="hidden" name="'
2847
+        $nonce_ref = $this->_req_action.'_nonce';
2848
+        $hidden_form_fields .= '<input type="hidden" name="'
2849 2849
                                                                     . $nonce_ref
2850 2850
                                                                     . '" value="'
2851 2851
                                                                     . wp_create_nonce($nonce_ref)
2852 2852
                                                                     . '">';
2853
-        $this->_template_args['list_table_hidden_fields']        = $hidden_form_fields;
2853
+        $this->_template_args['list_table_hidden_fields'] = $hidden_form_fields;
2854 2854
         // display message about search results?
2855 2855
         $search = $this->request->getRequestParam('s');
2856 2856
         $this->_template_args['before_list_table'] .= ! empty($search)
2857
-            ? '<p class="ee-search-results">' . sprintf(
2857
+            ? '<p class="ee-search-results">'.sprintf(
2858 2858
                 esc_html__('Displaying search results for the search string: %1$s', 'event_espresso'),
2859 2859
                 trim($search, '%')
2860
-            ) . '</p>'
2860
+            ).'</p>'
2861 2861
             : '';
2862 2862
         // filter before_list_table template arg
2863 2863
         $this->_template_args['before_list_table'] = apply_filters(
@@ -2891,7 +2891,7 @@  discard block
 block discarded – undo
2891 2891
         // convert to array and filter again
2892 2892
         // arrays are easier to inject new items in a specific location,
2893 2893
         // but would not be backwards compatible, so we have to add a new filter
2894
-        $this->_template_args['after_list_table']   = implode(
2894
+        $this->_template_args['after_list_table'] = implode(
2895 2895
             " \n",
2896 2896
             (array) apply_filters(
2897 2897
                 'FHEE__EE_Admin_Page___display_admin_list_table_page__after_list_table__template_args_array',
@@ -2938,7 +2938,7 @@  discard block
 block discarded – undo
2938 2938
             $this
2939 2939
         );
2940 2940
         return EEH_Template::display_template(
2941
-            EE_ADMIN_TEMPLATE . 'admin_details_legend.template.php',
2941
+            EE_ADMIN_TEMPLATE.'admin_details_legend.template.php',
2942 2942
             $this->_template_args,
2943 2943
             true
2944 2944
         );
@@ -3047,18 +3047,18 @@  discard block
 block discarded – undo
3047 3047
                 : ''
3048 3048
         );
3049 3049
 
3050
-        $this->_template_args['after_admin_page_content']  = apply_filters(
3050
+        $this->_template_args['after_admin_page_content'] = apply_filters(
3051 3051
             "FHEE_after_admin_page_content{$this->_current_page}{$this->_current_view}",
3052 3052
             isset($this->_template_args['after_admin_page_content'])
3053 3053
                 ? $this->_template_args['after_admin_page_content']
3054 3054
                 : ''
3055 3055
         );
3056
-        $this->_template_args['after_admin_page_content']  .= $this->_set_help_popup_content();
3056
+        $this->_template_args['after_admin_page_content'] .= $this->_set_help_popup_content();
3057 3057
 
3058 3058
         if ($this->request->isAjax()) {
3059 3059
             $this->_template_args['admin_page_content'] = EEH_Template::display_template(
3060 3060
                 // $template_path,
3061
-                EE_ADMIN_TEMPLATE . 'admin_wrapper_ajax.template.php',
3061
+                EE_ADMIN_TEMPLATE.'admin_wrapper_ajax.template.php',
3062 3062
                 $this->_template_args,
3063 3063
                 true
3064 3064
             );
@@ -3067,7 +3067,7 @@  discard block
 block discarded – undo
3067 3067
         // load settings page wrapper template
3068 3068
         $template_path = $about
3069 3069
             ? EE_ADMIN_TEMPLATE . 'about_admin_wrapper.template.php'
3070
-            : EE_ADMIN_TEMPLATE . 'admin_wrapper.template.php';
3070
+            : EE_ADMIN_TEMPLATE.'admin_wrapper.template.php';
3071 3071
 
3072 3072
         EEH_Template::display_template($template_path, $this->_template_args);
3073 3073
     }
@@ -3152,12 +3152,12 @@  discard block
 block discarded – undo
3152 3152
         $default_names = ['save', 'save_and_close'];
3153 3153
         $buttons = '';
3154 3154
         foreach ($button_text as $key => $button) {
3155
-            $ref     = $default_names[ $key ];
3156
-            $name    = ! empty($actions) ? $actions[ $key ] : $ref;
3157
-            $buttons .= '<input type="submit" class="button-primary ' . $ref . '" '
3158
-                        . 'value="' . $button . '" name="' . $name . '" '
3159
-                        . 'id="' . $this->_current_view . '_' . $ref . '" />';
3160
-            if (! $both) {
3155
+            $ref     = $default_names[$key];
3156
+            $name    = ! empty($actions) ? $actions[$key] : $ref;
3157
+            $buttons .= '<input type="submit" class="button-primary '.$ref.'" '
3158
+                        . 'value="'.$button.'" name="'.$name.'" '
3159
+                        . 'id="'.$this->_current_view.'_'.$ref.'" />';
3160
+            if ( ! $both) {
3161 3161
                 break;
3162 3162
             }
3163 3163
         }
@@ -3197,13 +3197,13 @@  discard block
 block discarded – undo
3197 3197
                 'An error occurred. No action was set for this page\'s form.',
3198 3198
                 'event_espresso'
3199 3199
             );
3200
-            $dev_msg  = $user_msg . "\n"
3200
+            $dev_msg = $user_msg."\n"
3201 3201
                         . sprintf(
3202 3202
                             esc_html__('The $route argument is required for the %s->%s method.', 'event_espresso'),
3203 3203
                             __FUNCTION__,
3204 3204
                             __CLASS__
3205 3205
                         );
3206
-            EE_Error::add_error($user_msg . '||' . $dev_msg, __FILE__, __FUNCTION__, __LINE__);
3206
+            EE_Error::add_error($user_msg.'||'.$dev_msg, __FILE__, __FUNCTION__, __LINE__);
3207 3207
         }
3208 3208
         // open form
3209 3209
         $this->_template_args['before_admin_page_content'] = '<form name="form" method="post" action="'
@@ -3212,9 +3212,9 @@  discard block
 block discarded – undo
3212 3212
                                                              . $route
3213 3213
                                                              . '_event_form" >';
3214 3214
         // add nonce
3215
-        $nonce                                             =
3216
-            wp_nonce_field($route . '_nonce', $route . '_nonce', false, false);
3217
-        $this->_template_args['before_admin_page_content'] .= "\n\t" . $nonce;
3215
+        $nonce =
3216
+            wp_nonce_field($route.'_nonce', $route.'_nonce', false, false);
3217
+        $this->_template_args['before_admin_page_content'] .= "\n\t".$nonce;
3218 3218
         // add REQUIRED form action
3219 3219
         $hidden_fields = [
3220 3220
             'action' => ['type' => 'hidden', 'value' => $route],
@@ -3227,7 +3227,7 @@  discard block
 block discarded – undo
3227 3227
         $form_fields = $this->_generate_admin_form_fields($hidden_fields, 'array');
3228 3228
         // add fields to form
3229 3229
         foreach ((array) $form_fields as $form_field) {
3230
-            $this->_template_args['before_admin_page_content'] .= "\n\t" . $form_field['field'];
3230
+            $this->_template_args['before_admin_page_content'] .= "\n\t".$form_field['field'];
3231 3231
         }
3232 3232
         // close form
3233 3233
         $this->_template_args['after_admin_page_content'] = '</form>';
@@ -3318,10 +3318,10 @@  discard block
 block discarded – undo
3318 3318
         $redirect_url = isset($query_args['page']) ? admin_url('admin.php') : $this->_admin_base_url;
3319 3319
         $notices      = EE_Error::get_notices(false);
3320 3320
         // overwrite default success messages //BUT ONLY if overwrite not overridden
3321
-        if (! $override_overwrite || ! empty($notices['errors'])) {
3321
+        if ( ! $override_overwrite || ! empty($notices['errors'])) {
3322 3322
             EE_Error::overwrite_success();
3323 3323
         }
3324
-        if (! empty($what) && ! empty($action_desc) && empty($notices['errors'])) {
3324
+        if ( ! empty($what) && ! empty($action_desc) && empty($notices['errors'])) {
3325 3325
             // how many records affected ? more than one record ? or just one ?
3326 3326
             if ($success > 1) {
3327 3327
                 // set plural msg
@@ -3350,7 +3350,7 @@  discard block
 block discarded – undo
3350 3350
             }
3351 3351
         }
3352 3352
         // check that $query_args isn't something crazy
3353
-        if (! is_array($query_args)) {
3353
+        if ( ! is_array($query_args)) {
3354 3354
             $query_args = [];
3355 3355
         }
3356 3356
         /**
@@ -3379,7 +3379,7 @@  discard block
 block discarded – undo
3379 3379
             $redirect_url = admin_url('admin.php');
3380 3380
         }
3381 3381
         // merge any default query_args set in _default_route_query_args property
3382
-        if (! empty($this->_default_route_query_args) && ! $this->_is_UI_request) {
3382
+        if ( ! empty($this->_default_route_query_args) && ! $this->_is_UI_request) {
3383 3383
             $args_to_merge = [];
3384 3384
             foreach ($this->_default_route_query_args as $query_param => $query_value) {
3385 3385
                 // is there a wp_referer array in our _default_route_query_args property?
@@ -3391,15 +3391,15 @@  discard block
 block discarded – undo
3391 3391
                         }
3392 3392
                         // finally we will override any arguments in the referer with
3393 3393
                         // what might be set on the _default_route_query_args array.
3394
-                        if (isset($this->_default_route_query_args[ $reference ])) {
3395
-                            $args_to_merge[ $reference ] = urlencode($this->_default_route_query_args[ $reference ]);
3394
+                        if (isset($this->_default_route_query_args[$reference])) {
3395
+                            $args_to_merge[$reference] = urlencode($this->_default_route_query_args[$reference]);
3396 3396
                         } else {
3397
-                            $args_to_merge[ $reference ] = urlencode($value);
3397
+                            $args_to_merge[$reference] = urlencode($value);
3398 3398
                         }
3399 3399
                     }
3400 3400
                     continue;
3401 3401
                 }
3402
-                $args_to_merge[ $query_param ] = $query_value;
3402
+                $args_to_merge[$query_param] = $query_value;
3403 3403
             }
3404 3404
             // now let's merge these arguments but override with what was specifically sent in to the
3405 3405
             // redirect.
@@ -3411,19 +3411,19 @@  discard block
 block discarded – undo
3411 3411
         if (isset($query_args['action'])) {
3412 3412
             // manually generate wp_nonce and merge that with the query vars
3413 3413
             // becuz the wp_nonce_url function wrecks havoc on some vars
3414
-            $query_args['_wpnonce'] = wp_create_nonce($query_args['action'] . '_nonce');
3414
+            $query_args['_wpnonce'] = wp_create_nonce($query_args['action'].'_nonce');
3415 3415
         }
3416 3416
         // we're adding some hooks and filters in here for processing any things just before redirects
3417 3417
         // (example: an admin page has done an insert or update and we want to run something after that).
3418
-        do_action('AHEE_redirect_' . $classname . $this->_req_action, $query_args);
3418
+        do_action('AHEE_redirect_'.$classname.$this->_req_action, $query_args);
3419 3419
         $redirect_url = apply_filters(
3420
-            'FHEE_redirect_' . $classname . $this->_req_action,
3420
+            'FHEE_redirect_'.$classname.$this->_req_action,
3421 3421
             self::add_query_args_and_nonce($query_args, $redirect_url),
3422 3422
             $query_args
3423 3423
         );
3424 3424
         // check if we're doing ajax.  If we are then lets just return the results and js can handle how it wants.
3425 3425
         if ($this->request->isAjax()) {
3426
-            $default_data                    = [
3426
+            $default_data = [
3427 3427
                 'close'        => true,
3428 3428
                 'redirect_url' => $redirect_url,
3429 3429
                 'where'        => 'main',
@@ -3470,7 +3470,7 @@  discard block
 block discarded – undo
3470 3470
         }
3471 3471
         $this->_template_args['notices'] = EE_Error::get_notices();
3472 3472
         // IF this isn't ajax we need to create a transient for the notices using the route (however, overridden if $sticky_notices == true)
3473
-        if (! $this->request->isAjax() || $sticky_notices) {
3473
+        if ( ! $this->request->isAjax() || $sticky_notices) {
3474 3474
             $route = isset($query_args['action']) ? $query_args['action'] : 'default';
3475 3475
             $this->_add_transient(
3476 3476
                 $route,
@@ -3510,7 +3510,7 @@  discard block
 block discarded – undo
3510 3510
         $exclude_nonce = false
3511 3511
     ) {
3512 3512
         // first let's validate the action (if $base_url is FALSE otherwise validation will happen further along)
3513
-        if (empty($base_url) && ! isset($this->_page_routes[ $action ])) {
3513
+        if (empty($base_url) && ! isset($this->_page_routes[$action])) {
3514 3514
             throw new EE_Error(
3515 3515
                 sprintf(
3516 3516
                     esc_html__(
@@ -3521,7 +3521,7 @@  discard block
 block discarded – undo
3521 3521
                 )
3522 3522
             );
3523 3523
         }
3524
-        if (! isset($this->_labels['buttons'][ $type ])) {
3524
+        if ( ! isset($this->_labels['buttons'][$type])) {
3525 3525
             throw new EE_Error(
3526 3526
                 sprintf(
3527 3527
                     esc_html__(
@@ -3534,7 +3534,7 @@  discard block
 block discarded – undo
3534 3534
         }
3535 3535
         // finally check user access for this button.
3536 3536
         $has_access = $this->check_user_access($action, true);
3537
-        if (! $has_access) {
3537
+        if ( ! $has_access) {
3538 3538
             return '';
3539 3539
         }
3540 3540
         $_base_url  = ! $base_url ? $this->_admin_base_url : $base_url;
@@ -3542,11 +3542,11 @@  discard block
 block discarded – undo
3542 3542
             'action' => $action,
3543 3543
         ];
3544 3544
         // merge extra_request args but make sure our original action takes precedence and doesn't get overwritten.
3545
-        if (! empty($extra_request)) {
3545
+        if ( ! empty($extra_request)) {
3546 3546
             $query_args = array_merge($extra_request, $query_args);
3547 3547
         }
3548 3548
         $url = self::add_query_args_and_nonce($query_args, $_base_url, false, $exclude_nonce);
3549
-        return EEH_Template::get_button_or_link($url, $this->_labels['buttons'][ $type ], $class);
3549
+        return EEH_Template::get_button_or_link($url, $this->_labels['buttons'][$type], $class);
3550 3550
     }
3551 3551
 
3552 3552
 
@@ -3572,7 +3572,7 @@  discard block
 block discarded – undo
3572 3572
                 'FHEE__EE_Admin_Page___per_page_screen_options__default',
3573 3573
                 20
3574 3574
             ),
3575
-            'option'  => $this->_current_page . '_' . $this->_current_view . '_per_page',
3575
+            'option'  => $this->_current_page.'_'.$this->_current_view.'_per_page',
3576 3576
         ];
3577 3577
         // ONLY add the screen option if the user has access to it.
3578 3578
         if ($this->check_user_access($this->_current_view, true)) {
@@ -3593,18 +3593,18 @@  discard block
 block discarded – undo
3593 3593
     {
3594 3594
         if ($this->request->requestParamIsSet('wp_screen_options')) {
3595 3595
             check_admin_referer('screen-options-nonce', 'screenoptionnonce');
3596
-            if (! $user = wp_get_current_user()) {
3596
+            if ( ! $user = wp_get_current_user()) {
3597 3597
                 return;
3598 3598
             }
3599 3599
             $option = $this->request->getRequestParam('wp_screen_options[option]', '', 'key');
3600
-            if (! $option) {
3600
+            if ( ! $option) {
3601 3601
                 return;
3602 3602
             }
3603
-            $value  = $this->request->getRequestParam('wp_screen_options[value]', 0, 'int');
3603
+            $value = $this->request->getRequestParam('wp_screen_options[value]', 0, 'int');
3604 3604
             $map_option = $option;
3605 3605
             $option     = str_replace('-', '_', $option);
3606 3606
             switch ($map_option) {
3607
-                case $this->_current_page . '_' . $this->_current_view . '_per_page':
3607
+                case $this->_current_page.'_'.$this->_current_view.'_per_page':
3608 3608
                     $max_value = apply_filters(
3609 3609
                         'FHEE__EE_Admin_Page___set_per_page_screen_options__max_value',
3610 3610
                         999,
@@ -3661,13 +3661,13 @@  discard block
 block discarded – undo
3661 3661
     protected function _add_transient($route, $data, $notices = false, $skip_route_verify = false)
3662 3662
     {
3663 3663
         $user_id = get_current_user_id();
3664
-        if (! $skip_route_verify) {
3664
+        if ( ! $skip_route_verify) {
3665 3665
             $this->_verify_route($route);
3666 3666
         }
3667 3667
         // now let's set the string for what kind of transient we're setting
3668 3668
         $transient = $notices
3669
-            ? 'ee_rte_n_tx_' . $route . '_' . $user_id
3670
-            : 'rte_tx_' . $route . '_' . $user_id;
3669
+            ? 'ee_rte_n_tx_'.$route.'_'.$user_id
3670
+            : 'rte_tx_'.$route.'_'.$user_id;
3671 3671
         $data      = $notices ? ['notices' => $data] : $data;
3672 3672
         // is there already a transient for this route?  If there is then let's ADD to that transient
3673 3673
         $existing = is_multisite() && is_network_admin()
@@ -3696,8 +3696,8 @@  discard block
 block discarded – undo
3696 3696
         $user_id   = get_current_user_id();
3697 3697
         $route     = ! $route ? $this->_req_action : $route;
3698 3698
         $transient = $notices
3699
-            ? 'ee_rte_n_tx_' . $route . '_' . $user_id
3700
-            : 'rte_tx_' . $route . '_' . $user_id;
3699
+            ? 'ee_rte_n_tx_'.$route.'_'.$user_id
3700
+            : 'rte_tx_'.$route.'_'.$user_id;
3701 3701
         $data      = is_multisite() && is_network_admin()
3702 3702
             ? get_site_transient($transient)
3703 3703
             : get_transient($transient);
@@ -3928,7 +3928,7 @@  discard block
 block discarded – undo
3928 3928
      */
3929 3929
     protected function _next_link($url, $class = 'dashicons dashicons-arrow-right')
3930 3930
     {
3931
-        return '<a class="' . $class . '" href="' . $url . '"></a>';
3931
+        return '<a class="'.$class.'" href="'.$url.'"></a>';
3932 3932
     }
3933 3933
 
3934 3934
 
@@ -3941,7 +3941,7 @@  discard block
 block discarded – undo
3941 3941
      */
3942 3942
     protected function _previous_link($url, $class = 'dashicons dashicons-arrow-left')
3943 3943
     {
3944
-        return '<a class="' . $class . '" href="' . $url . '"></a>';
3944
+        return '<a class="'.$class.'" href="'.$url.'"></a>';
3945 3945
     }
3946 3946
 
3947 3947
 
@@ -4089,7 +4089,7 @@  discard block
 block discarded – undo
4089 4089
         callable $callback = null
4090 4090
     ) {
4091 4091
         $entity_ID = absint($entity_ID);
4092
-        if (! $entity_ID) {
4092
+        if ( ! $entity_ID) {
4093 4093
             $this->trashRestoreDeleteError($action, $entity_model);
4094 4094
         }
4095 4095
         $result = 0;
@@ -4135,7 +4135,7 @@  discard block
 block discarded – undo
4135 4135
                 )
4136 4136
             );
4137 4137
         }
4138
-        if (! $entity_model->has_field($delete_column)) {
4138
+        if ( ! $entity_model->has_field($delete_column)) {
4139 4139
             throw new DomainException(
4140 4140
                 sprintf(
4141 4141
                     esc_html__(
Please login to merge, or discard this patch.