Completed
Branch EDTR/master (50dd13)
by
unknown
25:34 queued 17:04
created
core/admin/EE_Admin_Page.core.php 3 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -1,7 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 use EventEspresso\core\domain\services\assets\EspressoLegacyAdminAssetManager;
4
-use EventEspresso\core\domain\services\assets\LegacyAccountingAssetManager;
5 4
 use EventEspresso\core\exceptions\InvalidDataTypeException;
6 5
 use EventEspresso\core\exceptions\InvalidInterfaceException;
7 6
 use EventEspresso\core\interfaces\InterminableInterface;
Please login to merge, or discard this patch.
Indentation   +4035 added lines, -4035 removed lines patch added patch discarded remove patch
@@ -19,4103 +19,4103 @@
 block discarded – undo
19 19
 abstract class EE_Admin_Page extends EE_Base implements InterminableInterface
20 20
 {
21 21
 
22
-    /**
23
-     * @var LoaderInterface $loader
24
-     */
25
-    protected $loader;
22
+	/**
23
+	 * @var LoaderInterface $loader
24
+	 */
25
+	protected $loader;
26 26
 
27
-    // set in _init_page_props()
28
-    public $page_slug;
27
+	// set in _init_page_props()
28
+	public $page_slug;
29 29
 
30
-    public $page_label;
30
+	public $page_label;
31 31
 
32
-    public $page_folder;
32
+	public $page_folder;
33 33
 
34
-    // set in define_page_props()
35
-    protected $_admin_base_url;
34
+	// set in define_page_props()
35
+	protected $_admin_base_url;
36 36
 
37
-    protected $_admin_base_path;
37
+	protected $_admin_base_path;
38 38
 
39
-    protected $_admin_page_title;
39
+	protected $_admin_page_title;
40 40
 
41
-    protected $_labels;
41
+	protected $_labels;
42 42
 
43 43
 
44
-    // set early within EE_Admin_Init
45
-    protected $_wp_page_slug;
44
+	// set early within EE_Admin_Init
45
+	protected $_wp_page_slug;
46 46
 
47
-    // nav tabs
48
-    protected $_nav_tabs;
47
+	// nav tabs
48
+	protected $_nav_tabs;
49 49
 
50
-    protected $_default_nav_tab_name;
50
+	protected $_default_nav_tab_name;
51 51
 
52
-    /**
53
-     * @var array $_help_tour
54
-     */
55
-    protected $_help_tour = array();
52
+	/**
53
+	 * @var array $_help_tour
54
+	 */
55
+	protected $_help_tour = array();
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 = array();
63
+	/**
64
+	 * @var array $_template_args
65
+	 */
66
+	protected $_template_args = array();
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
-    // boolean
76
-    protected $_is_UI_request; // this starts at null so we can have no header routes progress through two states.
75
+	// boolean
76
+	protected $_is_UI_request; // 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
-    // sanitized request action (and nonce)
128
-
129
-    /**
130
-     * @var string $_req_action
131
-     */
132
-    protected $_req_action;
133
-
134
-    /**
135
-     * @var string $_req_nonce
136
-     */
137
-    protected $_req_nonce;
138
-
139
-    // search related
140
-    protected $_search_btn_label;
141
-
142
-    protected $_search_box_callback;
143
-
144
-    /**
145
-     * WP Current Screen object
146
-     *
147
-     * @var WP_Screen
148
-     */
149
-    protected $_current_screen;
150
-
151
-    // for holding EE_Admin_Hooks object when needed (set via set_hook_object())
152
-    protected $_hook_obj;
153
-
154
-    // for holding incoming request data
155
-    protected $_req_data;
156
-
157
-    // yes / no array for admin form fields
158
-    protected $_yes_no_values = array();
159
-
160
-    // some default things shared by all child classes
161
-    protected $_default_espresso_metaboxes;
162
-
163
-    /**
164
-     *    EE_Registry Object
165
-     *
166
-     * @var    EE_Registry
167
-     */
168
-    protected $EE;
169
-
170
-
171
-    /**
172
-     * This is just a property that flags whether the given route is a caffeinated route or not.
173
-     *
174
-     * @var boolean
175
-     */
176
-    protected $_is_caf = false;
177
-
178
-
179
-    /**
180
-     * @Constructor
181
-     * @param bool $routing indicate whether we want to just load the object and handle routing or just load the object.
182
-     * @throws InvalidArgumentException
183
-     * @throws InvalidDataTypeException
184
-     * @throws InvalidInterfaceException
185
-     * @throws ReflectionException
186
-     */
187
-    public function __construct($routing = true)
188
-    {
189
-        $this->loader = LoaderFactory::getLoader();
190
-        if (strpos($this->_get_dir(), 'caffeinated') !== false) {
191
-            $this->_is_caf = true;
192
-        }
193
-        $this->_yes_no_values = array(
194
-            array('id' => true, 'text' => esc_html__('Yes', 'event_espresso')),
195
-            array('id' => false, 'text' => esc_html__('No', 'event_espresso')),
196
-        );
197
-        // set the _req_data property.
198
-        $this->_req_data = array_merge($_GET, $_POST);
199
-        // routing enabled?
200
-        $this->_routing = $routing;
201
-    }
202
-
203
-
204
-    /**
205
-     * This logic used to be in the constructor, but that caused a chicken <--> egg scenario
206
-     * for child classes that needed to set properties prior to these methods getting called,
207
-     * but also needed the parent class to have its construction completed as well.
208
-     * Bottom line is that constructors should ONLY be used for setting initial properties
209
-     * and any complex initialization logic should only run after instantiation is complete.
210
-     *
211
-     * This method gets called immediately after construction from within
212
-     *      EE_Admin_Page_Init::_initialize_admin_page()
213
-     *
214
-     * @throws EE_Error
215
-     * @throws InvalidArgumentException
216
-     * @throws InvalidDataTypeException
217
-     * @throws InvalidInterfaceException
218
-     * @throws ReflectionException
219
-     * @since $VID:$
220
-     */
221
-    public function initializePage()
222
-    {
223
-        // set initial page props (child method)
224
-        $this->_init_page_props();
225
-        // set global defaults
226
-        $this->_set_defaults();
227
-        // set early because incoming requests could be ajax related and we need to register those hooks.
228
-        $this->_global_ajax_hooks();
229
-        $this->_ajax_hooks();
230
-        // other_page_hooks have to be early too.
231
-        $this->_do_other_page_hooks();
232
-        // This just allows us to have extending classes do something specific
233
-        // before the parent constructor runs _page_setup().
234
-        if (method_exists($this, '_before_page_setup')) {
235
-            $this->_before_page_setup();
236
-        }
237
-        // set up page dependencies
238
-        $this->_page_setup();
239
-    }
240
-
241
-
242
-    /**
243
-     * _init_page_props
244
-     * Child classes use to set at least the following properties:
245
-     * $page_slug.
246
-     * $page_label.
247
-     *
248
-     * @abstract
249
-     * @return void
250
-     */
251
-    abstract protected function _init_page_props();
252
-
253
-
254
-    /**
255
-     * _ajax_hooks
256
-     * child classes put all their add_action('wp_ajax_{name_of_hook}') hooks in here.
257
-     * Note: within the ajax callback methods.
258
-     *
259
-     * @abstract
260
-     * @return void
261
-     */
262
-    abstract protected function _ajax_hooks();
263
-
264
-
265
-    /**
266
-     * _define_page_props
267
-     * child classes define page properties in here.  Must include at least:
268
-     * $_admin_base_url = base_url for all admin pages
269
-     * $_admin_page_title = default admin_page_title for admin pages
270
-     * $_labels = array of default labels for various automatically generated elements:
271
-     *    array(
272
-     *        'buttons' => array(
273
-     *            'add' => esc_html__('label for add new button'),
274
-     *            'edit' => esc_html__('label for edit button'),
275
-     *            'delete' => esc_html__('label for delete button')
276
-     *            )
277
-     *        )
278
-     *
279
-     * @abstract
280
-     * @return void
281
-     */
282
-    abstract protected function _define_page_props();
283
-
284
-
285
-    /**
286
-     * _set_page_routes
287
-     * child classes use this to define the page routes for all subpages handled by the class.  Page routes are
288
-     * assigned to a action => method pairs in an array and to the $_page_routes property.  Each page route must also
289
-     * have a 'default' route. Here's the format
290
-     * $this->_page_routes = array(
291
-     *        'default' => array(
292
-     *            'func' => '_default_method_handling_route',
293
-     *            'args' => array('array','of','args'),
294
-     *            'noheader' => true, //add this in if this page route is processed before any headers are loaded (i.e.
295
-     *            ajax request, backend processing)
296
-     *            'headers_sent_route'=>'headers_route_reference', //add this if noheader=>true, and you want to load a
297
-     *            headers route after.  The string you enter here should match the defined route reference for a
298
-     *            headers sent route.
299
-     *            'capability' => 'route_capability', //indicate a string for minimum capability required to access
300
-     *            this route.
301
-     *            'obj_id' => 10 // if this route has an object id, then this can include it (used for capability
302
-     *            checks).
303
-     *        ),
304
-     *        'insert_item' => '_method_for_handling_insert_item' //this can be used if all we need to have is a
305
-     *        handling method.
306
-     *        )
307
-     * )
308
-     *
309
-     * @abstract
310
-     * @return void
311
-     */
312
-    abstract protected function _set_page_routes();
313
-
314
-
315
-    /**
316
-     * _set_page_config
317
-     * child classes use this to define the _page_config array for all subpages handled by the class. Each key in the
318
-     * array corresponds to the page_route for the loaded page. Format:
319
-     * $this->_page_config = array(
320
-     *        'default' => array(
321
-     *            'labels' => array(
322
-     *                'buttons' => array(
323
-     *                    'add' => esc_html__('label for adding item'),
324
-     *                    'edit' => esc_html__('label for editing item'),
325
-     *                    'delete' => esc_html__('label for deleting item')
326
-     *                ),
327
-     *                'publishbox' => esc_html__('Localized Title for Publish metabox', 'event_espresso')
328
-     *            ), //optional an array of custom labels for various automatically generated elements to use on the
329
-     *            page. If this isn't present then the defaults will be used as set for the $this->_labels in
330
-     *            _define_page_props() method
331
-     *            'nav' => array(
332
-     *                'label' => esc_html__('Label for Tab', 'event_espresso').
333
-     *                'url' => 'http://someurl', //automatically generated UNLESS you define
334
-     *                'css_class' => 'css-class', //automatically generated UNLESS you define
335
-     *                'order' => 10, //required to indicate tab position.
336
-     *                'persistent' => false //if you want the nav tab to ONLY display when the specific route is
337
-     *                displayed then add this parameter.
338
-     *            'list_table' => 'name_of_list_table' //string for list table class to be loaded for this admin_page.
339
-     *            'metaboxes' => array('metabox1', 'metabox2'), //if present this key indicates we want to load
340
-     *            metaboxes set for eventespresso admin pages.
341
-     *            'has_metaboxes' => true, //this boolean flag can simply be used to indicate if the route will have
342
-     *            metaboxes.  Typically this is used if the 'metaboxes' index is not used because metaboxes are added
343
-     *            later.  We just use this flag to make sure the necessary js gets enqueued on page load.
344
-     *            'has_help_popups' => false //defaults(true) //this boolean flag can simply be used to indicate if the
345
-     *            given route has help popups setup and if it does then we need to make sure thickbox is enqueued.
346
-     *            'columns' => array(4, 2), //this key triggers the setup of a page that uses columns (metaboxes).  The
347
-     *            array indicates the max number of columns (4) and the default number of columns on page load (2).
348
-     *            There is an option in the "screen_options" dropdown that is setup so users can pick what columns they
349
-     *            want to display.
350
-     *            'help_tabs' => array( //this is used for adding help tabs to a page
351
-     *                'tab_id' => array(
352
-     *                    'title' => 'tab_title',
353
-     *                    'filename' => 'name_of_file_containing_content', //this is the primary method for setting
354
-     *                    help tab content.  The fallback if it isn't present is to try a the callback.  Filename
355
-     *                    should match a file in the admin folder's "help_tabs" dir (ie..
356
-     *                    events/help_tabs/name_of_file_containing_content.help_tab.php)
357
-     *                    'callback' => 'callback_method_for_content', //if 'filename' isn't present then system will
358
-     *                    attempt to use the callback which should match the name of a method in the class
359
-     *                    ),
360
-     *                'tab2_id' => array(
361
-     *                    'title' => 'tab2 title',
362
-     *                    'filename' => 'file_name_2'
363
-     *                    'callback' => 'callback_method_for_content',
364
-     *                 ),
365
-     *            'help_sidebar' => 'callback_for_sidebar_content', //this is used for setting up the sidebar in the
366
-     *            help tab area on an admin page. @link
367
-     *            http://make.wordpress.org/core/2011/12/06/help-and-screen-api-changes-in-3-3/
368
-     *            'help_tour' => array(
369
-     *                'name_of_help_tour_class', //all help tours shoudl be a child class of EE_Help_Tour and located
370
-     *                in a folder for this admin page named "help_tours", a file name matching the key given here
371
-     *                (name_of_help_tour_class.class.php), and class matching key given here (name_of_help_tour_class)
372
-     *            ),
373
-     *            'require_nonce' => TRUE //this is used if you want to set a route to NOT require a nonce (default is
374
-     *            true if it isn't present).  To remove the requirement for a nonce check when this route is visited
375
-     *            just set
376
-     *            'require_nonce' to FALSE
377
-     *            )
378
-     * )
379
-     *
380
-     * @abstract
381
-     * @return void
382
-     */
383
-    abstract protected function _set_page_config();
384
-
385
-
386
-
387
-
388
-
389
-    /** end sample help_tour methods **/
390
-    /**
391
-     * _add_screen_options
392
-     * Child classes can add any extra wp_screen_options within this method using built-in WP functions/methods for
393
-     * doing so. Note child classes can also define _add_screen_options_($this->_current_view) to limit screen options
394
-     * to a particular view.
395
-     *
396
-     * @link   http://chrismarslender.com/wp-tutorials/wordpress-screen-options-tutorial/
397
-     *         see also WP_Screen object documents...
398
-     * @link   http://codex.wordpress.org/Class_Reference/WP_Screen
399
-     * @abstract
400
-     * @return void
401
-     */
402
-    abstract protected function _add_screen_options();
403
-
404
-
405
-    /**
406
-     * _add_feature_pointers
407
-     * Child classes should use this method for implementing any "feature pointers" (using built-in WP styling js).
408
-     * Note child classes can also define _add_feature_pointers_($this->_current_view) to limit screen options to a
409
-     * particular view. Note: this is just a placeholder for now.  Implementation will come down the road See:
410
-     * WP_Internal_Pointers class in wp-admin/includes/template.php for example (its a final class so can't be
411
-     * extended) also see:
412
-     *
413
-     * @link   http://eamann.com/tech/wordpress-portland/
414
-     * @abstract
415
-     * @return void
416
-     */
417
-    abstract protected function _add_feature_pointers();
418
-
419
-
420
-    /**
421
-     * load_scripts_styles
422
-     * child classes put their wp_enqueue_script and wp_enqueue_style hooks in here for anything they need loaded for
423
-     * their pages/subpages.  Note this is for all pages/subpages of the system.  You can also load only specific
424
-     * scripts/styles per view by putting them in a dynamic function in this format
425
-     * (load_scripts_styles_{$this->_current_view}) which matches your page route (action request arg)
426
-     *
427
-     * @abstract
428
-     * @return void
429
-     */
430
-    abstract public function load_scripts_styles();
431
-
432
-
433
-    /**
434
-     * admin_init
435
-     * Anything that should be set/executed at 'admin_init' WP hook runtime should be put in here.  This will apply to
436
-     * all pages/views loaded by child class.
437
-     *
438
-     * @abstract
439
-     * @return void
440
-     */
441
-    abstract public function admin_init();
442
-
443
-
444
-    /**
445
-     * admin_notices
446
-     * Anything triggered by the 'admin_notices' WP hook should be put in here.  This particular method will apply to
447
-     * all pages/views loaded by child class.
448
-     *
449
-     * @abstract
450
-     * @return void
451
-     */
452
-    abstract public function admin_notices();
453
-
454
-
455
-    /**
456
-     * admin_footer_scripts
457
-     * Anything triggered by the 'admin_print_footer_scripts' WP hook should be put in here. This particular method
458
-     * will apply to all pages/views loaded by child class.
459
-     *
460
-     * @return void
461
-     */
462
-    abstract public function admin_footer_scripts();
463
-
464
-
465
-    /**
466
-     * admin_footer
467
-     * anything triggered by the 'admin_footer' WP action hook should be added to here. This particular method will
468
-     * apply to all pages/views loaded by child class.
469
-     *
470
-     * @return void
471
-     */
472
-    public function admin_footer()
473
-    {
474
-    }
475
-
476
-
477
-    /**
478
-     * _global_ajax_hooks
479
-     * all global add_action('wp_ajax_{name_of_hook}') hooks in here.
480
-     * Note: within the ajax callback methods.
481
-     *
482
-     * @abstract
483
-     * @return void
484
-     */
485
-    protected function _global_ajax_hooks()
486
-    {
487
-        // for lazy loading of metabox content
488
-        add_action('wp_ajax_espresso-ajax-content', array($this, 'ajax_metabox_content'), 10);
489
-    }
490
-
491
-
492
-    public function ajax_metabox_content()
493
-    {
494
-        $contentid = isset($this->_req_data['contentid']) ? $this->_req_data['contentid'] : '';
495
-        $url = isset($this->_req_data['contenturl']) ? $this->_req_data['contenturl'] : '';
496
-        EE_Admin_Page::cached_rss_display($contentid, $url);
497
-        wp_die();
498
-    }
499
-
500
-
501
-    /**
502
-     * _page_setup
503
-     * Makes sure any things that need to be loaded early get handled.  We also escape early here if the page requested
504
-     * doesn't match the object.
505
-     *
506
-     * @final
507
-     * @return void
508
-     * @throws EE_Error
509
-     * @throws InvalidArgumentException
510
-     * @throws ReflectionException
511
-     * @throws InvalidDataTypeException
512
-     * @throws InvalidInterfaceException
513
-     */
514
-    final protected function _page_setup()
515
-    {
516
-        // requires?
517
-        // admin_init stuff - global - we're setting this REALLY early
518
-        // so if EE_Admin pages have to hook into other WP pages they can.
519
-        // But keep in mind, not everything is available from the EE_Admin Page object at this point.
520
-        add_action('admin_init', array($this, 'admin_init_global'), 5);
521
-        // next verify if we need to load anything...
522
-        $this->_current_page = ! empty($_GET['page']) ? sanitize_key($_GET['page']) : '';
523
-        $this->page_folder = strtolower(
524
-            str_replace(array('_Admin_Page', 'Extend_'), '', get_class($this))
525
-        );
526
-        global $ee_menu_slugs;
527
-        $ee_menu_slugs = (array) $ee_menu_slugs;
528
-        if (! defined('DOING_AJAX') && (! $this->_current_page || ! isset($ee_menu_slugs[ $this->_current_page ]))) {
529
-            return;
530
-        }
531
-        // becuz WP List tables have two duplicate select inputs for choosing bulk actions, we need to copy the action from the second to the first
532
-        if (isset($this->_req_data['action2']) && $this->_req_data['action'] === '-1') {
533
-            $this->_req_data['action'] = ! empty($this->_req_data['action2']) && $this->_req_data['action2'] !== '-1'
534
-                ? $this->_req_data['action2']
535
-                : $this->_req_data['action'];
536
-        }
537
-        // then set blank or -1 action values to 'default'
538
-        $this->_req_action = isset($this->_req_data['action'])
539
-                             && ! empty($this->_req_data['action'])
540
-                             && $this->_req_data['action'] !== '-1'
541
-            ? sanitize_key($this->_req_data['action'])
542
-            : 'default';
543
-        // if action is 'default' after the above BUT we have  'route' var set, then let's use the route as the action.
544
-        //  This covers cases where we're coming in from a list table that isn't on the default route.
545
-        $this->_req_action = $this->_req_action === 'default' && isset($this->_req_data['route'])
546
-            ? $this->_req_data['route'] : $this->_req_action;
547
-        // however if we are doing_ajax and we've got a 'route' set then that's what the req_action will be
548
-        $this->_req_action = defined('DOING_AJAX') && isset($this->_req_data['route'])
549
-            ? $this->_req_data['route']
550
-            : $this->_req_action;
551
-        $this->_current_view = $this->_req_action;
552
-        $this->_req_nonce = $this->_req_action . '_nonce';
553
-        $this->_define_page_props();
554
-        $this->_current_page_view_url = add_query_arg(
555
-            array('page' => $this->_current_page, 'action' => $this->_current_view),
556
-            $this->_admin_base_url
557
-        );
558
-        // default things
559
-        $this->_default_espresso_metaboxes = array(
560
-            '_espresso_news_post_box',
561
-            '_espresso_links_post_box',
562
-            '_espresso_ratings_request',
563
-            '_espresso_sponsors_post_box',
564
-        );
565
-        // set page configs
566
-        $this->_set_page_routes();
567
-        $this->_set_page_config();
568
-        // let's include any referrer data in our default_query_args for this route for "stickiness".
569
-        if (isset($this->_req_data['wp_referer'])) {
570
-            $this->_default_route_query_args['wp_referer'] = $this->_req_data['wp_referer'];
571
-        }
572
-        // for caffeinated and other extended functionality.
573
-        //  If there is a _extend_page_config method
574
-        // then let's run that to modify the all the various page configuration arrays
575
-        if (method_exists($this, '_extend_page_config')) {
576
-            $this->_extend_page_config();
577
-        }
578
-        // for CPT and other extended functionality.
579
-        // If there is an _extend_page_config_for_cpt
580
-        // then let's run that to modify all the various page configuration arrays.
581
-        if (method_exists($this, '_extend_page_config_for_cpt')) {
582
-            $this->_extend_page_config_for_cpt();
583
-        }
584
-        // filter routes and page_config so addons can add their stuff. Filtering done per class
585
-        $this->_page_routes = apply_filters(
586
-            'FHEE__' . get_class($this) . '__page_setup__page_routes',
587
-            $this->_page_routes,
588
-            $this
589
-        );
590
-        $this->_page_config = apply_filters(
591
-            'FHEE__' . get_class($this) . '__page_setup__page_config',
592
-            $this->_page_config,
593
-            $this
594
-        );
595
-        // if AHEE__EE_Admin_Page__route_admin_request_$this->_current_view method is present
596
-        // then we call it hooked into the AHEE__EE_Admin_Page__route_admin_request action
597
-        if (method_exists($this, 'AHEE__EE_Admin_Page__route_admin_request_' . $this->_current_view)) {
598
-            add_action(
599
-                'AHEE__EE_Admin_Page__route_admin_request',
600
-                array($this, 'AHEE__EE_Admin_Page__route_admin_request_' . $this->_current_view),
601
-                10,
602
-                2
603
-            );
604
-        }
605
-        // next route only if routing enabled
606
-        if ($this->_routing && ! defined('DOING_AJAX')) {
607
-            $this->_verify_routes();
608
-            // next let's just check user_access and kill if no access
609
-            $this->check_user_access();
610
-            if ($this->_is_UI_request) {
611
-                // admin_init stuff - global, all views for this page class, specific view
612
-                add_action('admin_init', array($this, 'admin_init'), 10);
613
-                if (method_exists($this, 'admin_init_' . $this->_current_view)) {
614
-                    add_action('admin_init', array($this, 'admin_init_' . $this->_current_view), 15);
615
-                }
616
-            } else {
617
-                // hijack regular WP loading and route admin request immediately
618
-                @ini_set('memory_limit', apply_filters('admin_memory_limit', WP_MAX_MEMORY_LIMIT));
619
-                $this->route_admin_request();
620
-            }
621
-        }
622
-    }
623
-
624
-
625
-    /**
626
-     * Provides a way for related child admin pages to load stuff on the loaded admin page.
627
-     *
628
-     * @return void
629
-     * @throws EE_Error
630
-     */
631
-    private function _do_other_page_hooks()
632
-    {
633
-        $registered_pages = apply_filters('FHEE_do_other_page_hooks_' . $this->page_slug, array());
634
-        foreach ($registered_pages as $page) {
635
-            // now let's setup the file name and class that should be present
636
-            $classname = str_replace('.class.php', '', $page);
637
-            // autoloaders should take care of loading file
638
-            if (! class_exists($classname)) {
639
-                $error_msg[] = sprintf(
640
-                    esc_html__(
641
-                        'Something went wrong with loading the %s admin hooks page.',
642
-                        'event_espresso'
643
-                    ),
644
-                    $page
645
-                );
646
-                $error_msg[] = $error_msg[0]
647
-                               . "\r\n"
648
-                               . sprintf(
649
-                                   esc_html__(
650
-                                       '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',
651
-                                       'event_espresso'
652
-                                   ),
653
-                                   $page,
654
-                                   '<br />',
655
-                                   '<strong>' . $classname . '</strong>'
656
-                               );
657
-                throw new EE_Error(implode('||', $error_msg));
658
-            }
659
-            // // notice we are passing the instance of this class to the hook object.
660
-            $this->loader->getShared($classname, [$this]);
661
-        }
662
-    }
663
-
664
-
665
-    /**
666
-     * @throws DomainException
667
-     * @throws EE_Error
668
-     * @throws InvalidArgumentException
669
-     * @throws InvalidDataTypeException
670
-     * @throws InvalidInterfaceException
671
-     * @throws ReflectionException
672
-     * @since $VID:$
673
-     */
674
-    public function load_page_dependencies()
675
-    {
676
-        try {
677
-            $this->_load_page_dependencies();
678
-        } catch (EE_Error $e) {
679
-            $e->get_error();
680
-        }
681
-    }
682
-
683
-
684
-    /**
685
-     * load_page_dependencies
686
-     * loads things specific to this page class when its loaded.  Really helps with efficiency.
687
-     *
688
-     * @return void
689
-     * @throws DomainException
690
-     * @throws EE_Error
691
-     * @throws InvalidArgumentException
692
-     * @throws InvalidDataTypeException
693
-     * @throws InvalidInterfaceException
694
-     * @throws ReflectionException
695
-     */
696
-    protected function _load_page_dependencies()
697
-    {
698
-        // let's set the current_screen and screen options to override what WP set
699
-        $this->_current_screen = get_current_screen();
700
-        // load admin_notices - global, page class, and view specific
701
-        add_action('admin_notices', array($this, 'admin_notices_global'), 5);
702
-        add_action('admin_notices', array($this, 'admin_notices'), 10);
703
-        if (method_exists($this, 'admin_notices_' . $this->_current_view)) {
704
-            add_action('admin_notices', array($this, 'admin_notices_' . $this->_current_view), 15);
705
-        }
706
-        // load network admin_notices - global, page class, and view specific
707
-        add_action('network_admin_notices', array($this, 'network_admin_notices_global'), 5);
708
-        if (method_exists($this, 'network_admin_notices_' . $this->_current_view)) {
709
-            add_action('network_admin_notices', array($this, 'network_admin_notices_' . $this->_current_view));
710
-        }
711
-        // this will save any per_page screen options if they are present
712
-        $this->_set_per_page_screen_options();
713
-        // setup list table properties
714
-        $this->_set_list_table();
715
-        // child classes can "register" a metabox to be automatically handled via the _page_config array property.
716
-        // However in some cases the metaboxes will need to be added within a route handling callback.
717
-        $this->_add_registered_meta_boxes();
718
-        $this->_add_screen_columns();
719
-        // add screen options - global, page child class, and view specific
720
-        $this->_add_global_screen_options();
721
-        $this->_add_screen_options();
722
-        $add_screen_options = "_add_screen_options_{$this->_current_view}";
723
-        if (method_exists($this, $add_screen_options)) {
724
-            $this->{$add_screen_options}();
725
-        }
726
-        // add help tab(s) and tours- set via page_config and qtips.
727
-        $this->_add_help_tour();
728
-        $this->_add_help_tabs();
729
-        $this->_add_qtips();
730
-        // add feature_pointers - global, page child class, and view specific
731
-        $this->_add_feature_pointers();
732
-        $this->_add_global_feature_pointers();
733
-        $add_feature_pointer = "_add_feature_pointer_{$this->_current_view}";
734
-        if (method_exists($this, $add_feature_pointer)) {
735
-            $this->{$add_feature_pointer}();
736
-        }
737
-        // enqueue scripts/styles - global, page class, and view specific
738
-        add_action('admin_enqueue_scripts', array($this, 'load_global_scripts_styles'), 5);
739
-        add_action('admin_enqueue_scripts', array($this, 'load_scripts_styles'), 10);
740
-        if (method_exists($this, "load_scripts_styles_{$this->_current_view}")) {
741
-            add_action('admin_enqueue_scripts', array($this, "load_scripts_styles_{$this->_current_view}"), 15);
742
-        }
743
-        add_action('admin_enqueue_scripts', array($this, 'admin_footer_scripts_eei18n_js_strings'), 100);
744
-        // admin_print_footer_scripts - global, page child class, and view specific.
745
-        // NOTE, despite the name, whenever possible, scripts should NOT be loaded using this.
746
-        // In most cases that's doing_it_wrong().  But adding hidden container elements etc.
747
-        // is a good use case. Notice the late priority we're giving these
748
-        add_action('admin_print_footer_scripts', array($this, 'admin_footer_scripts_global'), 99);
749
-        add_action('admin_print_footer_scripts', array($this, 'admin_footer_scripts'), 100);
750
-        if (method_exists($this, "admin_footer_scripts_{$this->_current_view}")) {
751
-            add_action('admin_print_footer_scripts', array($this, "admin_footer_scripts_{$this->_current_view}"), 101);
752
-        }
753
-        // admin footer scripts
754
-        add_action('admin_footer', array($this, 'admin_footer_global'), 99);
755
-        add_action('admin_footer', array($this, 'admin_footer'), 100);
756
-        if (method_exists($this, "admin_footer_{$this->_current_view}")) {
757
-            add_action('admin_footer', array($this, "admin_footer_{$this->_current_view}"), 101);
758
-        }
759
-        do_action('FHEE__EE_Admin_Page___load_page_dependencies__after_load', $this->page_slug);
760
-        // targeted hook
761
-        do_action(
762
-            "FHEE__EE_Admin_Page___load_page_dependencies__after_load__{$this->page_slug}__{$this->_req_action}"
763
-        );
764
-    }
765
-
766
-
767
-    /**
768
-     * _set_defaults
769
-     * This sets some global defaults for class properties.
770
-     */
771
-    private function _set_defaults()
772
-    {
773
-        $this->_current_screen = $this->_admin_page_title = $this->_req_action = $this->_req_nonce = null;
774
-        $this->_event = $this->_template_path = $this->_column_template_path = null;
775
-        $this->_nav_tabs = $this->_views = $this->_page_routes = array();
776
-        $this->_page_config = $this->_default_route_query_args = array();
777
-        $this->_default_nav_tab_name = 'overview';
778
-        // init template args
779
-        $this->_template_args = array(
780
-            'admin_page_header'  => '',
781
-            'admin_page_content' => '',
782
-            'post_body_content'  => '',
783
-            'before_list_table'  => '',
784
-            'after_list_table'   => '',
785
-        );
786
-    }
787
-
788
-
789
-    /**
790
-     * route_admin_request
791
-     *
792
-     * @see    _route_admin_request()
793
-     * @return exception|void error
794
-     * @throws InvalidArgumentException
795
-     * @throws InvalidInterfaceException
796
-     * @throws InvalidDataTypeException
797
-     * @throws EE_Error
798
-     * @throws ReflectionException
799
-     */
800
-    public function route_admin_request()
801
-    {
802
-        try {
803
-            $this->_route_admin_request();
804
-        } catch (EE_Error $e) {
805
-            $e->get_error();
806
-        }
807
-    }
808
-
809
-
810
-    public function set_wp_page_slug($wp_page_slug)
811
-    {
812
-        $this->_wp_page_slug = $wp_page_slug;
813
-        // if in network admin then we need to append "-network" to the page slug. Why? Because that's how WP rolls...
814
-        if (is_network_admin()) {
815
-            $this->_wp_page_slug .= '-network';
816
-        }
817
-    }
818
-
819
-
820
-    /**
821
-     * _verify_routes
822
-     * All this method does is verify the incoming request and make sure that routes exist for it.  We do this early so
823
-     * we know if we need to drop out.
824
-     *
825
-     * @return bool
826
-     * @throws EE_Error
827
-     */
828
-    protected function _verify_routes()
829
-    {
830
-        if (! $this->_current_page && ! defined('DOING_AJAX')) {
831
-            return false;
832
-        }
833
-        $this->_route = false;
834
-        // check that the page_routes array is not empty
835
-        if (empty($this->_page_routes)) {
836
-            // user error msg
837
-            $error_msg = sprintf(
838
-                esc_html__('No page routes have been set for the %s admin page.', 'event_espresso'),
839
-                $this->_admin_page_title
840
-            );
841
-            // developer error msg
842
-            $error_msg .= '||' . $error_msg
843
-                          . esc_html__(
844
-                              ' Make sure the "set_page_routes()" method exists, and is setting the "_page_routes" array properly.',
845
-                              'event_espresso'
846
-                          );
847
-            throw new EE_Error($error_msg);
848
-        }
849
-        // and that the requested page route exists
850
-        if (array_key_exists($this->_req_action, $this->_page_routes)) {
851
-            $this->_route = $this->_page_routes[ $this->_req_action ];
852
-            $this->_route_config = isset($this->_page_config[ $this->_req_action ])
853
-                ? $this->_page_config[ $this->_req_action ] : array();
854
-        } else {
855
-            // user error msg
856
-            $error_msg = sprintf(
857
-                esc_html__(
858
-                    'The requested page route does not exist for the %s admin page.',
859
-                    'event_espresso'
860
-                ),
861
-                $this->_admin_page_title
862
-            );
863
-            // developer error msg
864
-            $error_msg .= '||' . $error_msg
865
-                          . sprintf(
866
-                              esc_html__(
867
-                                  ' Create a key in the "_page_routes" array named "%s" and set its value to the appropriate method.',
868
-                                  'event_espresso'
869
-                              ),
870
-                              $this->_req_action
871
-                          );
872
-            throw new EE_Error($error_msg);
873
-        }
874
-        // and that a default route exists
875
-        if (! array_key_exists('default', $this->_page_routes)) {
876
-            // user error msg
877
-            $error_msg = sprintf(
878
-                esc_html__(
879
-                    'A default page route has not been set for the % admin page.',
880
-                    'event_espresso'
881
-                ),
882
-                $this->_admin_page_title
883
-            );
884
-            // developer error msg
885
-            $error_msg .= '||' . $error_msg
886
-                          . esc_html__(
887
-                              ' Create a key in the "_page_routes" array named "default" and set its value to your default page method.',
888
-                              'event_espresso'
889
-                          );
890
-            throw new EE_Error($error_msg);
891
-        }
892
-
893
-        // first lets' catch if the UI request has EVER been set.
894
-        if ($this->_is_UI_request === null) {
895
-            // lets set if this is a UI request or not.
896
-            $this->_is_UI_request = ! isset($this->_req_data['noheader']) || $this->_req_data['noheader'] !== true;
897
-            // wait a minute... we might have a noheader in the route array
898
-            $this->_is_UI_request = is_array($this->_route)
899
-                                    && isset($this->_route['noheader'])
900
-                                    && $this->_route['noheader'] ? false : $this->_is_UI_request;
901
-        }
902
-        $this->_set_current_labels();
903
-        return true;
904
-    }
905
-
906
-
907
-    /**
908
-     * this method simply verifies a given route and makes sure its an actual route available for the loaded page
909
-     *
910
-     * @param  string $route the route name we're verifying
911
-     * @return mixed (bool|Exception)      we'll throw an exception if this isn't a valid route.
912
-     * @throws EE_Error
913
-     */
914
-    protected function _verify_route($route)
915
-    {
916
-        if (array_key_exists($this->_req_action, $this->_page_routes)) {
917
-            return true;
918
-        }
919
-        // user error msg
920
-        $error_msg = sprintf(
921
-            esc_html__('The given page route does not exist for the %s admin page.', 'event_espresso'),
922
-            $this->_admin_page_title
923
-        );
924
-        // developer error msg
925
-        $error_msg .= '||' . $error_msg
926
-                      . sprintf(
927
-                          esc_html__(
928
-                              ' Check the route you are using in your method (%s) and make sure it matches a route set in your "_page_routes" array property',
929
-                              'event_espresso'
930
-                          ),
931
-                          $route
932
-                      );
933
-        throw new EE_Error($error_msg);
934
-    }
935
-
936
-
937
-    /**
938
-     * perform nonce verification
939
-     * This method has be encapsulated here so that any ajax requests that bypass normal routes can verify their nonces
940
-     * using this method (and save retyping!)
941
-     *
942
-     * @param string $nonce     The nonce sent
943
-     * @param string $nonce_ref The nonce reference string (name0)
944
-     * @return void
945
-     * @throws EE_Error
946
-     * @throws InvalidArgumentException
947
-     * @throws InvalidDataTypeException
948
-     * @throws InvalidInterfaceException
949
-     */
950
-    protected function _verify_nonce($nonce, $nonce_ref)
951
-    {
952
-        // verify nonce against expected value
953
-        if (! wp_verify_nonce($nonce, $nonce_ref)) {
954
-            // these are not the droids you are looking for !!!
955
-            $msg = sprintf(
956
-                esc_html__('%sNonce Fail.%s', 'event_espresso'),
957
-                '<a href="http://www.youtube.com/watch?v=56_S0WeTkzs">',
958
-                '</a>'
959
-            );
960
-            if (WP_DEBUG) {
961
-                $msg .= "\n  "
962
-                        . sprintf(
963
-                            esc_html__(
964
-                                'In order to dynamically generate nonces for your actions, use the %s::add_query_args_and_nonce() method. May the Nonce be with you!',
965
-                                'event_espresso'
966
-                            ),
967
-                            EE_Admin_Page::class
968
-                        );
969
-            }
970
-            if (! defined('DOING_AJAX')) {
971
-                wp_die($msg);
972
-            } else {
973
-                EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
974
-                $this->_return_json();
975
-            }
976
-        }
977
-    }
978
-
979
-
980
-    /**
981
-     * _route_admin_request()
982
-     * Meat and potatoes of the class.  Basically, this dude checks out what's being requested and sees if there are
983
-     * some doodads to work the magic and handle the flingjangy. Translation:  Checks if the requested action is listed
984
-     * in the page routes and then will try to load the corresponding method.
985
-     *
986
-     * @return void
987
-     * @throws EE_Error
988
-     * @throws InvalidArgumentException
989
-     * @throws InvalidDataTypeException
990
-     * @throws InvalidInterfaceException
991
-     * @throws ReflectionException
992
-     */
993
-    protected function _route_admin_request()
994
-    {
995
-        if (! $this->_is_UI_request) {
996
-            $this->_verify_routes();
997
-        }
998
-        $nonce_check = isset($this->_route_config['require_nonce'])
999
-            ? $this->_route_config['require_nonce']
1000
-            : true;
1001
-        if ($this->_req_action !== 'default' && $nonce_check) {
1002
-            // set nonce from post data
1003
-            $nonce = isset($this->_req_data[ $this->_req_nonce ])
1004
-                ? sanitize_text_field($this->_req_data[ $this->_req_nonce ])
1005
-                : '';
1006
-            $this->_verify_nonce($nonce, $this->_req_nonce);
1007
-        }
1008
-        // set the nav_tabs array but ONLY if this is  UI_request
1009
-        if ($this->_is_UI_request) {
1010
-            $this->_set_nav_tabs();
1011
-        }
1012
-        // grab callback function
1013
-        $func = is_array($this->_route) && isset($this->_route['func']) ? $this->_route['func'] : $this->_route;
1014
-        // check if callback has args
1015
-        $args = is_array($this->_route) && isset($this->_route['args']) ? $this->_route['args'] : array();
1016
-        $error_msg = '';
1017
-        // action right before calling route
1018
-        // (hook is something like 'AHEE__Registrations_Admin_Page__route_admin_request')
1019
-        if (! did_action('AHEE__EE_Admin_Page__route_admin_request')) {
1020
-            do_action('AHEE__EE_Admin_Page__route_admin_request', $this->_current_view, $this);
1021
-        }
1022
-        // right before calling the route, let's remove _wp_http_referer from the
1023
-        // $_SERVER[REQUEST_URI] global (its now in _req_data for route processing).
1024
-        $_SERVER['REQUEST_URI'] = remove_query_arg(
1025
-            '_wp_http_referer',
1026
-            wp_unslash($_SERVER['REQUEST_URI'])
1027
-        );
1028
-        if (! empty($func)) {
1029
-            if (is_array($func)) {
1030
-                list($class, $method) = $func;
1031
-            } elseif (strpos($func, '::') !== false) {
1032
-                list($class, $method) = explode('::', $func);
1033
-            } else {
1034
-                $class = $this;
1035
-                $method = $func;
1036
-            }
1037
-            if (! (is_object($class) && $class === $this)) {
1038
-                // send along this admin page object for access by addons.
1039
-                $args['admin_page_object'] = $this;
1040
-            }
1041
-            // is it a method on a class that doesn't work?
1042
-            if (((method_exists($class, $method)
1043
-                  && call_user_func_array(array($class, $method), $args) === false)
1044
-                 && (// is it a standalone function that doesn't work?
1045
-                     function_exists($method)
1046
-                     && call_user_func_array(
1047
-                         $func,
1048
-                         array_merge(array('admin_page_object' => $this), $args)
1049
-                     ) === false
1050
-                 )) || (// is it neither a class method NOR a standalone function?
1051
-                    ! function_exists($method)
1052
-                    && ! method_exists($class, $method)
1053
-                )
1054
-            ) {
1055
-                // user error msg
1056
-                $error_msg = esc_html__(
1057
-                    'An error occurred. The  requested page route could not be found.',
1058
-                    'event_espresso'
1059
-                );
1060
-                // developer error msg
1061
-                $error_msg .= '||';
1062
-                $error_msg .= sprintf(
1063
-                    esc_html__(
1064
-                        'Page route "%s" could not be called. Check that the spelling for method names and actions in the "_page_routes" array are all correct.',
1065
-                        'event_espresso'
1066
-                    ),
1067
-                    $method
1068
-                );
1069
-            }
1070
-            if (! empty($error_msg)) {
1071
-                throw new EE_Error($error_msg);
1072
-            }
1073
-        }
1074
-        // if we've routed and this route has a no headers route AND a sent_headers_route,
1075
-        // then we need to reset the routing properties to the new route.
1076
-        // 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.
1077
-        if ($this->_is_UI_request === false
1078
-            && is_array($this->_route)
1079
-            && ! empty($this->_route['headers_sent_route'])
1080
-        ) {
1081
-            $this->_reset_routing_properties($this->_route['headers_sent_route']);
1082
-        }
1083
-    }
1084
-
1085
-
1086
-    /**
1087
-     * This method just allows the resetting of page properties in the case where a no headers
1088
-     * route redirects to a headers route in its route config.
1089
-     *
1090
-     * @since   4.3.0
1091
-     * @param  string $new_route New (non header) route to redirect to.
1092
-     * @return   void
1093
-     * @throws ReflectionException
1094
-     * @throws InvalidArgumentException
1095
-     * @throws InvalidInterfaceException
1096
-     * @throws InvalidDataTypeException
1097
-     * @throws EE_Error
1098
-     */
1099
-    protected function _reset_routing_properties($new_route)
1100
-    {
1101
-        $this->_is_UI_request = true;
1102
-        // now we set the current route to whatever the headers_sent_route is set at
1103
-        $this->_req_data['action'] = $new_route;
1104
-        // rerun page setup
1105
-        $this->_page_setup();
1106
-    }
1107
-
1108
-
1109
-    /**
1110
-     * _add_query_arg
1111
-     * adds nonce to array of arguments then calls WP add_query_arg function
1112
-     *(internally just uses EEH_URL's function with the same name)
1113
-     *
1114
-     * @param array  $args
1115
-     * @param string $url
1116
-     * @param bool   $sticky                  if true, then the existing Request params will be appended to the
1117
-     *                                        generated url in an associative array indexed by the key 'wp_referer';
1118
-     *                                        Example usage: If the current page is:
1119
-     *                                        http://mydomain.com/wp-admin/admin.php?page=espresso_registrations
1120
-     *                                        &action=default&event_id=20&month_range=March%202015
1121
-     *                                        &_wpnonce=5467821
1122
-     *                                        and you call:
1123
-     *                                        EE_Admin_Page::add_query_args_and_nonce(
1124
-     *                                        array(
1125
-     *                                        'action' => 'resend_something',
1126
-     *                                        'page=>espresso_registrations'
1127
-     *                                        ),
1128
-     *                                        $some_url,
1129
-     *                                        true
1130
-     *                                        );
1131
-     *                                        It will produce a url in this structure:
1132
-     *                                        http://{$some_url}/?page=espresso_registrations&action=resend_something
1133
-     *                                        &wp_referer[action]=default&wp_referer[event_id]=20&wpreferer[
1134
-     *                                        month_range]=March%202015
1135
-     * @param   bool $exclude_nonce           If true, the the nonce will be excluded from the generated nonce.
1136
-     * @return string
1137
-     */
1138
-    public static function add_query_args_and_nonce(
1139
-        $args = array(),
1140
-        $url = '',
1141
-        $sticky = false,
1142
-        $exclude_nonce = false
1143
-    ) {
1144
-        // if there is a _wp_http_referer include the values from the request but only if sticky = true
1145
-        if ($sticky) {
1146
-            $request = $_REQUEST;
1147
-            unset($request['_wp_http_referer'], $request['wp_referer']);
1148
-            foreach ($request as $key => $value) {
1149
-                // do not add nonces
1150
-                if (strpos($key, 'nonce') !== false) {
1151
-                    continue;
1152
-                }
1153
-                $args[ 'wp_referer[' . $key . ']' ] = $value;
1154
-            }
1155
-        }
1156
-        return EEH_URL::add_query_args_and_nonce($args, $url, $exclude_nonce);
1157
-    }
1158
-
1159
-
1160
-    /**
1161
-     * This returns a generated link that will load the related help tab.
1162
-     *
1163
-     * @param  string $help_tab_id the id for the connected help tab
1164
-     * @param  string $icon_style  (optional) include css class for the style you want to use for the help icon.
1165
-     * @param  string $help_text   (optional) send help text you want to use for the link if default not to be used
1166
-     * @uses EEH_Template::get_help_tab_link()
1167
-     * @return string              generated link
1168
-     */
1169
-    protected function _get_help_tab_link($help_tab_id, $icon_style = '', $help_text = '')
1170
-    {
1171
-        return EEH_Template::get_help_tab_link(
1172
-            $help_tab_id,
1173
-            $this->page_slug,
1174
-            $this->_req_action,
1175
-            $icon_style,
1176
-            $help_text
1177
-        );
1178
-    }
1179
-
1180
-
1181
-    /**
1182
-     * _add_help_tabs
1183
-     * Note child classes define their help tabs within the page_config array.
1184
-     *
1185
-     * @link   http://codex.wordpress.org/Function_Reference/add_help_tab
1186
-     * @return void
1187
-     * @throws DomainException
1188
-     * @throws EE_Error
1189
-     * @throws ReflectionException
1190
-     */
1191
-    protected function _add_help_tabs()
1192
-    {
1193
-        $tour_buttons = '';
1194
-        if (isset($this->_page_config[ $this->_req_action ])) {
1195
-            $config = $this->_page_config[ $this->_req_action ];
1196
-            // is there a help tour for the current route?  if there is let's setup the tour buttons
1197
-            if (isset($this->_help_tour[ $this->_req_action ])) {
1198
-                $tb = array();
1199
-                $tour_buttons = '<div class="ee-abs-container"><div class="ee-help-tour-restart-buttons">';
1200
-                foreach ($this->_help_tour['tours'] as $tour) {
1201
-                    // if this is the end tour then we don't need to setup a button
1202
-                    if ($tour instanceof EE_Help_Tour_final_stop || ! $tour instanceof EE_Help_Tour) {
1203
-                        continue;
1204
-                    }
1205
-                    $tb[] = '<button id="trigger-tour-'
1206
-                            . $tour->get_slug()
1207
-                            . '" class="button-primary trigger-ee-help-tour">'
1208
-                            . $tour->get_label()
1209
-                            . '</button>';
1210
-                }
1211
-                $tour_buttons .= implode('<br />', $tb);
1212
-                $tour_buttons .= '</div></div>';
1213
-            }
1214
-            // let's see if there is a help_sidebar set for the current route and we'll set that up for usage as well.
1215
-            if (is_array($config) && isset($config['help_sidebar'])) {
1216
-                // check that the callback given is valid
1217
-                if (! method_exists($this, $config['help_sidebar'])) {
1218
-                    throw new EE_Error(
1219
-                        sprintf(
1220
-                            esc_html__(
1221
-                                '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',
1222
-                                'event_espresso'
1223
-                            ),
1224
-                            $config['help_sidebar'],
1225
-                            get_class($this)
1226
-                        )
1227
-                    );
1228
-                }
1229
-                $content = apply_filters(
1230
-                    'FHEE__' . get_class($this) . '__add_help_tabs__help_sidebar',
1231
-                    $this->{$config['help_sidebar']}()
1232
-                );
1233
-                $content .= $tour_buttons; // add help tour buttons.
1234
-                // do we have any help tours setup?  Cause if we do we want to add the buttons
1235
-                $this->_current_screen->set_help_sidebar($content);
1236
-            }
1237
-            // if there ARE tour buttons...
1238
-            if (! empty($tour_buttons)) {
1239
-                // if we DON'T have config help sidebar then we'll just add the tour buttons to the sidebar.
1240
-                if (! isset($config['help_sidebar'])) {
1241
-                    $this->_current_screen->set_help_sidebar($tour_buttons);
1242
-                }
1243
-                // handle if no help_tabs are set so the sidebar will still show for the help tour buttons
1244
-                if (! isset($config['help_tabs'])) {
1245
-                    $_ht['id'] = $this->page_slug;
1246
-                    $_ht['title'] = esc_html__('Help Tours', 'event_espresso');
1247
-                    $_ht['content'] = '<p>'
1248
-                                      . esc_html__(
1249
-                                          'The buttons to the right allow you to start/restart any help tours available for this page',
1250
-                                          'event_espresso'
1251
-                                      ) . '</p>';
1252
-                    $this->_current_screen->add_help_tab($_ht);
1253
-                }
1254
-            }
1255
-            if (! isset($config['help_tabs'])) {
1256
-                return;
1257
-            } //no help tabs for this route
1258
-            foreach ((array) $config['help_tabs'] as $tab_id => $cfg) {
1259
-                // we're here so there ARE help tabs!
1260
-                // make sure we've got what we need
1261
-                if (! isset($cfg['title'])) {
1262
-                    throw new EE_Error(
1263
-                        esc_html__(
1264
-                            'The _page_config array is not set up properly for help tabs.  It is missing a title',
1265
-                            'event_espresso'
1266
-                        )
1267
-                    );
1268
-                }
1269
-                if (! isset($cfg['filename']) && ! isset($cfg['callback']) && ! isset($cfg['content'])) {
1270
-                    throw new EE_Error(
1271
-                        esc_html__(
1272
-                            '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',
1273
-                            'event_espresso'
1274
-                        )
1275
-                    );
1276
-                }
1277
-                // first priority goes to content.
1278
-                if (! empty($cfg['content'])) {
1279
-                    $content = ! empty($cfg['content']) ? $cfg['content'] : null;
1280
-                    // second priority goes to filename
1281
-                } elseif (! empty($cfg['filename'])) {
1282
-                    $file_path = $this->_get_dir() . '/help_tabs/' . $cfg['filename'] . '.help_tab.php';
1283
-                    // 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)
1284
-                    $file_path = ! is_readable($file_path) ? EE_ADMIN_PAGES
1285
-                                                             . basename($this->_get_dir())
1286
-                                                             . '/help_tabs/'
1287
-                                                             . $cfg['filename']
1288
-                                                             . '.help_tab.php' : $file_path;
1289
-                    // if file is STILL not readable then let's do a EE_Error so its more graceful than a fatal error.
1290
-                    if (! isset($cfg['callback']) && ! is_readable($file_path)) {
1291
-                        EE_Error::add_error(
1292
-                            sprintf(
1293
-                                esc_html__(
1294
-                                    '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',
1295
-                                    'event_espresso'
1296
-                                ),
1297
-                                $tab_id,
1298
-                                key($config),
1299
-                                $file_path
1300
-                            ),
1301
-                            __FILE__,
1302
-                            __FUNCTION__,
1303
-                            __LINE__
1304
-                        );
1305
-                        return;
1306
-                    }
1307
-                    $template_args['admin_page_obj'] = $this;
1308
-                    $content = EEH_Template::display_template(
1309
-                        $file_path,
1310
-                        $template_args,
1311
-                        true
1312
-                    );
1313
-                } else {
1314
-                    $content = '';
1315
-                }
1316
-                // check if callback is valid
1317
-                if (empty($content) && (
1318
-                        ! isset($cfg['callback']) || ! method_exists($this, $cfg['callback'])
1319
-                    )
1320
-                ) {
1321
-                    EE_Error::add_error(
1322
-                        sprintf(
1323
-                            esc_html__(
1324
-                                '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.',
1325
-                                'event_espresso'
1326
-                            ),
1327
-                            $cfg['title']
1328
-                        ),
1329
-                        __FILE__,
1330
-                        __FUNCTION__,
1331
-                        __LINE__
1332
-                    );
1333
-                    return;
1334
-                }
1335
-                // setup config array for help tab method
1336
-                $id = $this->page_slug . '-' . $this->_req_action . '-' . $tab_id;
1337
-                $_ht = array(
1338
-                    'id'       => $id,
1339
-                    'title'    => $cfg['title'],
1340
-                    'callback' => isset($cfg['callback']) && empty($content) ? array($this, $cfg['callback']) : null,
1341
-                    'content'  => $content,
1342
-                );
1343
-                $this->_current_screen->add_help_tab($_ht);
1344
-            }
1345
-        }
1346
-    }
1347
-
1348
-
1349
-    /**
1350
-     * This basically checks loaded $_page_config property to see if there are any help_tours defined.  "help_tours" is
1351
-     * an array with properties for setting up usage of the joyride plugin
1352
-     *
1353
-     * @link   http://zurb.com/playground/jquery-joyride-feature-tour-plugin
1354
-     * @see    instructions regarding the format and construction of the "help_tour" array element is found in the
1355
-     *         _set_page_config() comments
1356
-     * @return void
1357
-     * @throws EE_Error
1358
-     * @throws InvalidArgumentException
1359
-     * @throws InvalidDataTypeException
1360
-     * @throws InvalidInterfaceException
1361
-     * @throws ReflectionException
1362
-     */
1363
-    protected function _add_help_tour()
1364
-    {
1365
-        $tours = array();
1366
-        $this->_help_tour = array();
1367
-        // exit early if help tours are turned off globally
1368
-        if ((defined('EE_DISABLE_HELP_TOURS') && EE_DISABLE_HELP_TOURS)
1369
-            || ! EE_Registry::instance()->CFG->admin->help_tour_activation
1370
-        ) {
1371
-            return;
1372
-        }
1373
-        // loop through _page_config to find any help_tour defined
1374
-        foreach ($this->_page_config as $route => $config) {
1375
-            // we're only going to set things up for this route
1376
-            if ($route !== $this->_req_action) {
1377
-                continue;
1378
-            }
1379
-            if (isset($config['help_tour'])) {
1380
-                foreach ($config['help_tour'] as $tour) {
1381
-                    $file_path = $this->_get_dir() . '/help_tours/' . $tour . '.class.php';
1382
-                    // let's see if we can get that file...
1383
-                    // if not its possible this is a decaf route not set in caffeinated
1384
-                    // so lets try and get the caffeinated equivalent
1385
-                    $file_path = ! is_readable($file_path) ? EE_ADMIN_PAGES
1386
-                                                             . basename($this->_get_dir())
1387
-                                                             . '/help_tours/'
1388
-                                                             . $tour
1389
-                                                             . '.class.php' : $file_path;
1390
-                    // if file is STILL not readable then let's do a EE_Error so its more graceful than a fatal error.
1391
-                    if (! is_readable($file_path)) {
1392
-                        EE_Error::add_error(
1393
-                            sprintf(
1394
-                                esc_html__(
1395
-                                    'The file path given for the help tour (%s) is not a valid path.  Please check that the string you set for the help tour on this route (%s) is the correct spelling',
1396
-                                    'event_espresso'
1397
-                                ),
1398
-                                $file_path,
1399
-                                $tour
1400
-                            ),
1401
-                            __FILE__,
1402
-                            __FUNCTION__,
1403
-                            __LINE__
1404
-                        );
1405
-                        return;
1406
-                    }
1407
-                    require_once $file_path;
1408
-                    if (! class_exists($tour)) {
1409
-                        $error_msg = [];
1410
-                        $error_msg[] = sprintf(
1411
-                            esc_html__('Something went wrong with loading the %s Help Tour Class.', 'event_espresso'),
1412
-                            $tour
1413
-                        );
1414
-                        $error_msg[] = $error_msg[0] . "\r\n"
1415
-                                       . sprintf(
1416
-                                           esc_html__(
1417
-                                               'There is no class in place for the %s help tour.%s Make sure you have <strong>%s</strong> defined in the "help_tour" array for the %s route of the % admin page.',
1418
-                                               'event_espresso'
1419
-                                           ),
1420
-                                           $tour,
1421
-                                           '<br />',
1422
-                                           $tour,
1423
-                                           $this->_req_action,
1424
-                                           get_class($this)
1425
-                                       );
1426
-                        throw new EE_Error(implode('||', $error_msg));
1427
-                    }
1428
-                    $tour_obj = new $tour($this->_is_caf);
1429
-                    $tours[] = $tour_obj;
1430
-                    $this->_help_tour[ $route ][] = EEH_Template::help_tour_stops_generator($tour_obj);
1431
-                }
1432
-                // let's inject the end tour stop element common to all pages... this will only get seen once per machine.
1433
-                $end_stop_tour = new EE_Help_Tour_final_stop($this->_is_caf);
1434
-                $tours[] = $end_stop_tour;
1435
-                $this->_help_tour[ $route ][] = EEH_Template::help_tour_stops_generator($end_stop_tour);
1436
-            }
1437
-        }
1438
-
1439
-        if (! empty($tours)) {
1440
-            $this->_help_tour['tours'] = $tours;
1441
-        }
1442
-        // that's it!  Now that the $_help_tours property is set (or not)
1443
-        // the scripts and html should be taken care of automatically.
1444
-
1445
-        /**
1446
-         * Allow extending the help tours variable.
1447
-         *
1448
-         * @param array $_help_tour The array containing all help tour information to be displayed.
1449
-         */
1450
-        $this->_help_tour = apply_filters('FHEE__EE_Admin_Page___add_help_tour___help_tour', $this->_help_tour);
1451
-    }
1452
-
1453
-
1454
-    /**
1455
-     * This simply sets up any qtips that have been defined in the page config
1456
-     *
1457
-     * @return void
1458
-     * @throws ReflectionException
1459
-     * @throws EE_Error
1460
-     */
1461
-    protected function _add_qtips()
1462
-    {
1463
-        if (isset($this->_route_config['qtips'])) {
1464
-            $qtips = (array) $this->_route_config['qtips'];
1465
-            // load qtip loader
1466
-            $path = array(
1467
-                $this->_get_dir() . '/qtips/',
1468
-                EE_ADMIN_PAGES . basename($this->_get_dir()) . '/qtips/',
1469
-            );
1470
-            $qtip_loader = EEH_Qtip_Loader::instance();
1471
-            if ($qtip_loader instanceof EEH_Qtip_Loader) {
1472
-                $qtip_loader->register($qtips, $path);
1473
-            }
1474
-        }
1475
-    }
1476
-
1477
-
1478
-    /**
1479
-     * _set_nav_tabs
1480
-     * This sets up the nav tabs from the page_routes array.  This method can be overwritten by child classes if you
1481
-     * wish to add additional tabs or modify accordingly.
1482
-     *
1483
-     * @return void
1484
-     * @throws InvalidArgumentException
1485
-     * @throws InvalidInterfaceException
1486
-     * @throws InvalidDataTypeException
1487
-     */
1488
-    protected function _set_nav_tabs()
1489
-    {
1490
-        do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1491
-        $i = 0;
1492
-        foreach ($this->_page_config as $slug => $config) {
1493
-            if (! is_array($config)
1494
-                || (
1495
-                    is_array($config)
1496
-                    && (
1497
-                        (isset($config['nav']) && ! $config['nav'])
1498
-                        || ! isset($config['nav'])
1499
-                    )
1500
-                )
1501
-            ) {
1502
-                continue;
1503
-            }
1504
-            // no nav tab for this config
1505
-            // check for persistent flag
1506
-            if ($slug !== $this->_req_action && isset($config['nav']['persistent']) && ! $config['nav']['persistent']) {
1507
-                // nav tab is only to appear when route requested.
1508
-                continue;
1509
-            }
1510
-            if (! $this->check_user_access($slug, true)) {
1511
-                // no nav tab because current user does not have access.
1512
-                continue;
1513
-            }
1514
-            $css_class = isset($config['css_class']) ? $config['css_class'] . ' ' : '';
1515
-            $this->_nav_tabs[ $slug ] = array(
1516
-                'url'       => isset($config['nav']['url'])
1517
-                    ? $config['nav']['url']
1518
-                    : EE_Admin_Page::add_query_args_and_nonce(
1519
-                        array('action' => $slug),
1520
-                        $this->_admin_base_url
1521
-                    ),
1522
-                'link_text' => isset($config['nav']['label'])
1523
-                    ? $config['nav']['label']
1524
-                    : ucwords(
1525
-                        str_replace('_', ' ', $slug)
1526
-                    ),
1527
-                'css_class' => $this->_req_action === $slug ? $css_class . 'nav-tab-active' : $css_class,
1528
-                'order'     => isset($config['nav']['order']) ? $config['nav']['order'] : $i,
1529
-            );
1530
-            $i++;
1531
-        }
1532
-        // if $this->_nav_tabs is empty then lets set the default
1533
-        if (empty($this->_nav_tabs)) {
1534
-            $this->_nav_tabs[ $this->_default_nav_tab_name ] = array(
1535
-                'url'       => $this->_admin_base_url,
1536
-                'link_text' => ucwords(str_replace('_', ' ', $this->_default_nav_tab_name)),
1537
-                'css_class' => 'nav-tab-active',
1538
-                'order'     => 10,
1539
-            );
1540
-        }
1541
-        // now let's sort the tabs according to order
1542
-        usort($this->_nav_tabs, array($this, '_sort_nav_tabs'));
1543
-    }
1544
-
1545
-
1546
-    /**
1547
-     * _set_current_labels
1548
-     * This method modifies the _labels property with any optional specific labels indicated in the _page_routes
1549
-     * property array
1550
-     *
1551
-     * @return void
1552
-     */
1553
-    private function _set_current_labels()
1554
-    {
1555
-        if (is_array($this->_route_config) && isset($this->_route_config['labels'])) {
1556
-            foreach ($this->_route_config['labels'] as $label => $text) {
1557
-                if (is_array($text)) {
1558
-                    foreach ($text as $sublabel => $subtext) {
1559
-                        $this->_labels[ $label ][ $sublabel ] = $subtext;
1560
-                    }
1561
-                } else {
1562
-                    $this->_labels[ $label ] = $text;
1563
-                }
1564
-            }
1565
-        }
1566
-    }
1567
-
1568
-
1569
-    /**
1570
-     *        verifies user access for this admin page
1571
-     *
1572
-     * @param string $route_to_check if present then the capability for the route matching this string is checked.
1573
-     * @param bool   $verify_only    Default is FALSE which means if user check fails then wp_die().  Otherwise just
1574
-     *                               return false if verify fail.
1575
-     * @return bool
1576
-     * @throws InvalidArgumentException
1577
-     * @throws InvalidDataTypeException
1578
-     * @throws InvalidInterfaceException
1579
-     */
1580
-    public function check_user_access($route_to_check = '', $verify_only = false)
1581
-    {
1582
-        do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1583
-        $route_to_check = empty($route_to_check) ? $this->_req_action : $route_to_check;
1584
-        $capability = ! empty($route_to_check) && isset($this->_page_routes[ $route_to_check ])
1585
-                      && is_array(
1586
-                          $this->_page_routes[ $route_to_check ]
1587
-                      )
1588
-                      && ! empty($this->_page_routes[ $route_to_check ]['capability'])
1589
-            ? $this->_page_routes[ $route_to_check ]['capability'] : null;
1590
-        if (empty($capability) && empty($route_to_check)) {
1591
-            $capability = is_array($this->_route) && empty($this->_route['capability']) ? 'manage_options'
1592
-                : $this->_route['capability'];
1593
-        } else {
1594
-            $capability = empty($capability) ? 'manage_options' : $capability;
1595
-        }
1596
-        $id = is_array($this->_route) && ! empty($this->_route['obj_id']) ? $this->_route['obj_id'] : 0;
1597
-        if (! defined('DOING_AJAX')
1598
-            && (
1599
-                ! function_exists('is_admin')
1600
-                || ! EE_Registry::instance()->CAP->current_user_can(
1601
-                    $capability,
1602
-                    $this->page_slug
1603
-                    . '_'
1604
-                    . $route_to_check,
1605
-                    $id
1606
-                )
1607
-            )
1608
-        ) {
1609
-            if ($verify_only) {
1610
-                return false;
1611
-            }
1612
-            if (is_user_logged_in()) {
1613
-                wp_die(__('You do not have access to this route.', 'event_espresso'));
1614
-            } else {
1615
-                return false;
1616
-            }
1617
-        }
1618
-        return true;
1619
-    }
1620
-
1621
-
1622
-    /**
1623
-     * admin_init_global
1624
-     * This runs all the code that we want executed within the WP admin_init hook.
1625
-     * This method executes for ALL EE Admin pages.
1626
-     *
1627
-     * @return void
1628
-     */
1629
-    public function admin_init_global()
1630
-    {
1631
-    }
1632
-
1633
-
1634
-    /**
1635
-     * wp_loaded_global
1636
-     * This runs all the code that we want executed within the WP wp_loaded hook.  This method is optional for an
1637
-     * EE_Admin page and will execute on every EE Admin Page load
1638
-     *
1639
-     * @return void
1640
-     */
1641
-    public function wp_loaded()
1642
-    {
1643
-    }
1644
-
1645
-
1646
-    /**
1647
-     * admin_notices
1648
-     * Anything triggered by the 'admin_notices' WP hook should be put in here.  This particular method will apply on
1649
-     * ALL EE_Admin pages.
1650
-     *
1651
-     * @return void
1652
-     */
1653
-    public function admin_notices_global()
1654
-    {
1655
-        $this->_display_no_javascript_warning();
1656
-        $this->_display_espresso_notices();
1657
-    }
1658
-
1659
-
1660
-    public function network_admin_notices_global()
1661
-    {
1662
-        $this->_display_no_javascript_warning();
1663
-        $this->_display_espresso_notices();
1664
-    }
1665
-
1666
-
1667
-    /**
1668
-     * admin_footer_scripts_global
1669
-     * Anything triggered by the 'admin_print_footer_scripts' WP hook should be put in here. This particular method
1670
-     * will apply on ALL EE_Admin pages.
1671
-     *
1672
-     * @return void
1673
-     */
1674
-    public function admin_footer_scripts_global()
1675
-    {
1676
-        $this->_add_admin_page_ajax_loading_img();
1677
-        $this->_add_admin_page_overlay();
1678
-        // if metaboxes are present we need to add the nonce field
1679
-        if (isset($this->_route_config['metaboxes'])
1680
-            || isset($this->_route_config['list_table'])
1681
-            || (isset($this->_route_config['has_metaboxes']) && $this->_route_config['has_metaboxes'])
1682
-        ) {
1683
-            wp_nonce_field('closedpostboxes', 'closedpostboxesnonce', false);
1684
-            wp_nonce_field('meta-box-order', 'meta-box-order-nonce', false);
1685
-        }
1686
-    }
1687
-
1688
-
1689
-    /**
1690
-     * admin_footer_global
1691
-     * Anything triggered by the wp 'admin_footer' wp hook should be put in here.
1692
-     * This particular method will apply on ALL EE_Admin Pages.
1693
-     *
1694
-     * @return void
1695
-     * @throws InvalidArgumentException
1696
-     * @throws InvalidDataTypeException
1697
-     * @throws InvalidInterfaceException
1698
-     */
1699
-    public function admin_footer_global()
1700
-    {
1701
-        // dialog container for dialog helper
1702
-        $d_cont = '<div class="ee-admin-dialog-container auto-hide hidden">' . "\n";
1703
-        $d_cont .= '<div class="ee-notices"></div>';
1704
-        $d_cont .= '<div class="ee-admin-dialog-container-inner-content"></div>';
1705
-        $d_cont .= '</div>';
1706
-        echo $d_cont;
1707
-        // help tour stuff?
1708
-        if (isset($this->_help_tour[ $this->_req_action ])) {
1709
-            echo implode('<br />', $this->_help_tour[ $this->_req_action ]);
1710
-        }
1711
-        // current set timezone for timezone js
1712
-        echo '<span id="current_timezone" class="hidden">' . EEH_DTT_Helper::get_timezone() . '</span>';
1713
-    }
1714
-
1715
-
1716
-    /**
1717
-     * This function sees if there is a method for help popup content existing for the given route.  If there is then
1718
-     * we'll use the retrieved array to output the content using the template. For child classes: If you want to have
1719
-     * help popups then in your templates or your content you set "triggers" for the content using the
1720
-     * "_set_help_trigger('help_trigger_id')" where "help_trigger_id" is what you will use later in your custom method
1721
-     * for the help popup content on that page. Then in your Child_Admin_Page class you need to define a help popup
1722
-     * method for the content in the format "_help_popup_content_{route_name}()"  So if you are setting help content
1723
-     * for the
1724
-     * 'edit_event' route you should have a method named "_help_popup_content_edit_route". In your defined
1725
-     * "help_popup_content_..." method.  You must prepare and return an array in the following format array(
1726
-     *    'help_trigger_id' => array(
1727
-     *        'title' => esc_html__('localized title for popup', 'event_espresso'),
1728
-     *        'content' => esc_html__('localized content for popup', 'event_espresso')
1729
-     *    )
1730
-     * );
1731
-     * Then the EE_Admin_Parent will take care of making sure that is setup properly on the correct route.
1732
-     *
1733
-     * @param array $help_array
1734
-     * @param bool  $display
1735
-     * @return string content
1736
-     * @throws DomainException
1737
-     * @throws EE_Error
1738
-     */
1739
-    protected function _set_help_popup_content($help_array = array(), $display = false)
1740
-    {
1741
-        $content = '';
1742
-        $help_array = empty($help_array) ? $this->_get_help_content() : $help_array;
1743
-        // loop through the array and setup content
1744
-        foreach ($help_array as $trigger => $help) {
1745
-            // make sure the array is setup properly
1746
-            if (! isset($help['title'], $help['content'])) {
1747
-                throw new EE_Error(
1748
-                    esc_html__(
1749
-                        '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',
1750
-                        'event_espresso'
1751
-                    )
1752
-                );
1753
-            }
1754
-            // we're good so let'd setup the template vars and then assign parsed template content to our content.
1755
-            $template_args = array(
1756
-                'help_popup_id'      => $trigger,
1757
-                'help_popup_title'   => $help['title'],
1758
-                'help_popup_content' => $help['content'],
1759
-            );
1760
-            $content .= EEH_Template::display_template(
1761
-                EE_ADMIN_TEMPLATE . 'admin_help_popup.template.php',
1762
-                $template_args,
1763
-                true
1764
-            );
1765
-        }
1766
-        if ($display) {
1767
-            echo $content;
1768
-            return '';
1769
-        }
1770
-        return $content;
1771
-    }
1772
-
1773
-
1774
-    /**
1775
-     * All this does is retrieve the help content array if set by the EE_Admin_Page child
1776
-     *
1777
-     * @return array properly formatted array for help popup content
1778
-     * @throws EE_Error
1779
-     */
1780
-    private function _get_help_content()
1781
-    {
1782
-        // what is the method we're looking for?
1783
-        $method_name = '_help_popup_content_' . $this->_req_action;
1784
-        // if method doesn't exist let's get out.
1785
-        if (! method_exists($this, $method_name)) {
1786
-            return array();
1787
-        }
1788
-        // k we're good to go let's retrieve the help array
1789
-        $help_array = $this->{$method_name}();
1790
-        // make sure we've got an array!
1791
-        if (! is_array($help_array)) {
1792
-            throw new EE_Error(
1793
-                esc_html__(
1794
-                    'Something went wrong with help popup content generation. Expecting an array and well, this ain\'t no array bub.',
1795
-                    'event_espresso'
1796
-                )
1797
-            );
1798
-        }
1799
-        return $help_array;
1800
-    }
1801
-
1802
-
1803
-    /**
1804
-     * EE Admin Pages can use this to set a properly formatted trigger for a help popup.
1805
-     * By default the trigger html is printed.  Otherwise it can be returned if the $display flag is set "false"
1806
-     * See comments made on the _set_help_content method for understanding other parts to the help popup tool.
1807
-     *
1808
-     * @param string  $trigger_id reference for retrieving the trigger content for the popup
1809
-     * @param boolean $display    if false then we return the trigger string
1810
-     * @param array   $dimensions an array of dimensions for the box (array(h,w))
1811
-     * @return string
1812
-     * @throws DomainException
1813
-     * @throws EE_Error
1814
-     */
1815
-    protected function _set_help_trigger($trigger_id, $display = true, $dimensions = array('400', '640'))
1816
-    {
1817
-        if (defined('DOING_AJAX')) {
1818
-            return '';
1819
-        }
1820
-        // 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
1821
-        $help_array = $this->_get_help_content();
1822
-        $help_content = '';
1823
-        if (empty($help_array) || ! isset($help_array[ $trigger_id ])) {
1824
-            $help_array[ $trigger_id ] = array(
1825
-                'title'   => esc_html__('Missing Content', 'event_espresso'),
1826
-                'content' => esc_html__(
1827
-                    '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.)',
1828
-                    'event_espresso'
1829
-                ),
1830
-            );
1831
-            $help_content = $this->_set_help_popup_content($help_array);
1832
-        }
1833
-        // let's setup the trigger
1834
-        $content = '<a class="ee-dialog" href="?height='
1835
-                   . $dimensions[0]
1836
-                   . '&width='
1837
-                   . $dimensions[1]
1838
-                   . '&inlineId='
1839
-                   . $trigger_id
1840
-                   . '" target="_blank"><span class="question ee-help-popup-question"></span></a>';
1841
-        $content .= $help_content;
1842
-        if ($display) {
1843
-            echo $content;
1844
-            return '';
1845
-        }
1846
-        return $content;
1847
-    }
1848
-
1849
-
1850
-    /**
1851
-     * _add_global_screen_options
1852
-     * Add any extra wp_screen_options within this method using built-in WP functions/methods for doing so.
1853
-     * This particular method will add_screen_options on ALL EE_Admin Pages
1854
-     *
1855
-     * @link   http://chrismarslender.com/wp-tutorials/wordpress-screen-options-tutorial/
1856
-     *         see also WP_Screen object documents...
1857
-     * @link   http://codex.wordpress.org/Class_Reference/WP_Screen
1858
-     * @abstract
1859
-     * @return void
1860
-     */
1861
-    private function _add_global_screen_options()
1862
-    {
1863
-    }
1864
-
1865
-
1866
-    /**
1867
-     * _add_global_feature_pointers
1868
-     * This method is used for implementing any "feature pointers" (using built-in WP styling js).
1869
-     * This particular method will implement feature pointers for ALL EE_Admin pages.
1870
-     * Note: this is just a placeholder for now.  Implementation will come down the road
1871
-     *
1872
-     * @see    WP_Internal_Pointers class in wp-admin/includes/template.php for example (its a final class so can't be
1873
-     *         extended) also see:
1874
-     * @link   http://eamann.com/tech/wordpress-portland/
1875
-     * @abstract
1876
-     * @return void
1877
-     */
1878
-    private function _add_global_feature_pointers()
1879
-    {
1880
-    }
1881
-
1882
-
1883
-    /**
1884
-     * load_global_scripts_styles
1885
-     * The scripts and styles enqueued in here will be loaded on every EE Admin page
1886
-     *
1887
-     * @return void
1888
-     * @throws EE_Error
1889
-     */
1890
-    public function load_global_scripts_styles()
1891
-    {
1892
-        // add debugging styles
1893
-        if (WP_DEBUG) {
1894
-            add_action('admin_head', array($this, 'add_xdebug_style'));
1895
-        }
1896
-        // taking care of metaboxes
1897
-        if (empty($this->_cpt_route)
1898
-            && (isset($this->_route_config['metaboxes']) || isset($this->_route_config['has_metaboxes']))
1899
-        ) {
1900
-            wp_enqueue_script('dashboard');
1901
-        }
1902
-
1903
-        // LOCALIZED DATA
1904
-        // localize script for ajax lazy loading
1905
-        wp_localize_script(
1906
-            EspressoLegacyAdminAssetManager::JS_HANDLE_EE_ADMIN,
1907
-            'eeLazyLoadingContainers',
1908
-            apply_filters(
1909
-                'FHEE__EE_Admin_Page_Core__load_global_scripts_styles__loader_containers',
1910
-                ['espresso_news_post_box_content']
1911
-            )
1912
-        );
1913
-        /**
1914
-         * help tour stuff
1915
-         */
1916
-        if (EE_Registry::instance()->CFG->admin->help_tour_activation && ! empty($this->_help_tour)) {
1917
-            add_filter('FHEE_load_joyride', '__return_true');
1918
-            $tours = array();
1919
-            // setup tours for the js tour object
1920
-            foreach ($this->_help_tour['tours'] as $tour) {
1921
-                if ($tour instanceof EE_Help_Tour) {
1922
-                    $tours[] = array(
1923
-                        'id'      => $tour->get_slug(),
1924
-                        'options' => $tour->get_options(),
1925
-                    );
1926
-                }
1927
-            }
1928
-            wp_localize_script(
1929
-                EspressoLegacyAdminAssetManager::JS_HANDLE_EE_HELP_TOUR,
1930
-                'EE_HELP_TOUR',
1931
-                ['tours' => $tours]
1932
-            );
1933
-            // admin_footer_global will take care of making sure our help_tour skeleton gets printed via the info stored in $this->_help_tour
1934
-        }
1935
-    }
1936
-
1937
-
1938
-    /**
1939
-     *        admin_footer_scripts_eei18n_js_strings
1940
-     *
1941
-     * @return        void
1942
-     */
1943
-    public function admin_footer_scripts_eei18n_js_strings()
1944
-    {
1945
-        EE_Registry::$i18n_js_strings['ajax_url'] = WP_AJAX_URL;
1946
-        EE_Registry::$i18n_js_strings['confirm_delete'] = esc_html__(
1947
-            '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!!!',
1948
-            'event_espresso'
1949
-        );
1950
-        EE_Registry::$i18n_js_strings['January'] = esc_html__('January', 'event_espresso');
1951
-        EE_Registry::$i18n_js_strings['February'] = esc_html__('February', 'event_espresso');
1952
-        EE_Registry::$i18n_js_strings['March'] = esc_html__('March', 'event_espresso');
1953
-        EE_Registry::$i18n_js_strings['April'] = esc_html__('April', 'event_espresso');
1954
-        EE_Registry::$i18n_js_strings['May'] = esc_html__('May', 'event_espresso');
1955
-        EE_Registry::$i18n_js_strings['June'] = esc_html__('June', 'event_espresso');
1956
-        EE_Registry::$i18n_js_strings['July'] = esc_html__('July', 'event_espresso');
1957
-        EE_Registry::$i18n_js_strings['August'] = esc_html__('August', 'event_espresso');
1958
-        EE_Registry::$i18n_js_strings['September'] = esc_html__('September', 'event_espresso');
1959
-        EE_Registry::$i18n_js_strings['October'] = esc_html__('October', 'event_espresso');
1960
-        EE_Registry::$i18n_js_strings['November'] = esc_html__('November', 'event_espresso');
1961
-        EE_Registry::$i18n_js_strings['December'] = esc_html__('December', 'event_espresso');
1962
-        EE_Registry::$i18n_js_strings['Jan'] = esc_html__('Jan', 'event_espresso');
1963
-        EE_Registry::$i18n_js_strings['Feb'] = esc_html__('Feb', 'event_espresso');
1964
-        EE_Registry::$i18n_js_strings['Mar'] = esc_html__('Mar', 'event_espresso');
1965
-        EE_Registry::$i18n_js_strings['Apr'] = esc_html__('Apr', 'event_espresso');
1966
-        EE_Registry::$i18n_js_strings['May'] = esc_html__('May', 'event_espresso');
1967
-        EE_Registry::$i18n_js_strings['Jun'] = esc_html__('Jun', 'event_espresso');
1968
-        EE_Registry::$i18n_js_strings['Jul'] = esc_html__('Jul', 'event_espresso');
1969
-        EE_Registry::$i18n_js_strings['Aug'] = esc_html__('Aug', 'event_espresso');
1970
-        EE_Registry::$i18n_js_strings['Sep'] = esc_html__('Sep', 'event_espresso');
1971
-        EE_Registry::$i18n_js_strings['Oct'] = esc_html__('Oct', 'event_espresso');
1972
-        EE_Registry::$i18n_js_strings['Nov'] = esc_html__('Nov', 'event_espresso');
1973
-        EE_Registry::$i18n_js_strings['Dec'] = esc_html__('Dec', 'event_espresso');
1974
-        EE_Registry::$i18n_js_strings['Sunday'] = esc_html__('Sunday', 'event_espresso');
1975
-        EE_Registry::$i18n_js_strings['Monday'] = esc_html__('Monday', 'event_espresso');
1976
-        EE_Registry::$i18n_js_strings['Tuesday'] = esc_html__('Tuesday', 'event_espresso');
1977
-        EE_Registry::$i18n_js_strings['Wednesday'] = esc_html__('Wednesday', 'event_espresso');
1978
-        EE_Registry::$i18n_js_strings['Thursday'] = esc_html__('Thursday', 'event_espresso');
1979
-        EE_Registry::$i18n_js_strings['Friday'] = esc_html__('Friday', 'event_espresso');
1980
-        EE_Registry::$i18n_js_strings['Saturday'] = esc_html__('Saturday', 'event_espresso');
1981
-        EE_Registry::$i18n_js_strings['Sun'] = esc_html__('Sun', 'event_espresso');
1982
-        EE_Registry::$i18n_js_strings['Mon'] = esc_html__('Mon', 'event_espresso');
1983
-        EE_Registry::$i18n_js_strings['Tue'] = esc_html__('Tue', 'event_espresso');
1984
-        EE_Registry::$i18n_js_strings['Wed'] = esc_html__('Wed', 'event_espresso');
1985
-        EE_Registry::$i18n_js_strings['Thu'] = esc_html__('Thu', 'event_espresso');
1986
-        EE_Registry::$i18n_js_strings['Fri'] = esc_html__('Fri', 'event_espresso');
1987
-        EE_Registry::$i18n_js_strings['Sat'] = esc_html__('Sat', 'event_espresso');
1988
-    }
1989
-
1990
-
1991
-    /**
1992
-     *        load enhanced xdebug styles for ppl with failing eyesight
1993
-     *
1994
-     * @return        void
1995
-     */
1996
-    public function add_xdebug_style()
1997
-    {
1998
-        echo '<style>.xdebug-error { font-size:1.5em; }</style>';
1999
-    }
2000
-
2001
-
2002
-    /************************/
2003
-    /** LIST TABLE METHODS **/
2004
-    /************************/
2005
-    /**
2006
-     * this sets up the list table if the current view requires it.
2007
-     *
2008
-     * @return void
2009
-     * @throws EE_Error
2010
-     * @throws InvalidArgumentException
2011
-     * @throws InvalidDataTypeException
2012
-     * @throws InvalidInterfaceException
2013
-     */
2014
-    protected function _set_list_table()
2015
-    {
2016
-        // first is this a list_table view?
2017
-        if (! isset($this->_route_config['list_table'])) {
2018
-            return;
2019
-        } //not a list_table view so get out.
2020
-        // list table functions are per view specific (because some admin pages might have more than one list table!)
2021
-        $list_table_view = '_set_list_table_views_' . $this->_req_action;
2022
-        if (! method_exists($this, $list_table_view) || $this->{$list_table_view}() === false) {
2023
-            // user error msg
2024
-            $error_msg = esc_html__(
2025
-                'An error occurred. The requested list table views could not be found.',
2026
-                'event_espresso'
2027
-            );
2028
-            // developer error msg
2029
-            $error_msg .= '||'
2030
-                          . sprintf(
2031
-                              esc_html__(
2032
-                                  '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.',
2033
-                                  'event_espresso'
2034
-                              ),
2035
-                              $this->_req_action,
2036
-                              $list_table_view
2037
-                          );
2038
-            throw new EE_Error($error_msg);
2039
-        }
2040
-        // let's provide the ability to filter the views per PAGE AND ROUTE, per PAGE, and globally
2041
-        $this->_views = apply_filters(
2042
-            'FHEE_list_table_views_' . $this->page_slug . '_' . $this->_req_action,
2043
-            $this->_views
2044
-        );
2045
-        $this->_views = apply_filters('FHEE_list_table_views_' . $this->page_slug, $this->_views);
2046
-        $this->_views = apply_filters('FHEE_list_table_views', $this->_views);
2047
-        $this->_set_list_table_view();
2048
-        $this->_set_list_table_object();
2049
-    }
2050
-
2051
-
2052
-    /**
2053
-     * set current view for List Table
2054
-     *
2055
-     * @return void
2056
-     */
2057
-    protected function _set_list_table_view()
2058
-    {
2059
-        do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2060
-        // looking at active items or dumpster diving ?
2061
-        if (! isset($this->_req_data['status']) || ! array_key_exists($this->_req_data['status'], $this->_views)) {
2062
-            $this->_view = isset($this->_views['in_use']) ? 'in_use' : 'all';
2063
-        } else {
2064
-            $this->_view = sanitize_key($this->_req_data['status']);
2065
-        }
2066
-    }
2067
-
2068
-
2069
-    /**
2070
-     * _set_list_table_object
2071
-     * WP_List_Table objects need to be loaded fairly early so automatic stuff WP does is taken care of.
2072
-     *
2073
-     * @throws InvalidInterfaceException
2074
-     * @throws InvalidArgumentException
2075
-     * @throws InvalidDataTypeException
2076
-     * @throws EE_Error
2077
-     * @throws InvalidInterfaceException
2078
-     */
2079
-    protected function _set_list_table_object()
2080
-    {
2081
-        if (isset($this->_route_config['list_table'])) {
2082
-            if (! class_exists($this->_route_config['list_table'])) {
2083
-                throw new EE_Error(
2084
-                    sprintf(
2085
-                        esc_html__(
2086
-                            '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.',
2087
-                            'event_espresso'
2088
-                        ),
2089
-                        $this->_route_config['list_table'],
2090
-                        get_class($this)
2091
-                    )
2092
-                );
2093
-            }
2094
-            $this->_list_table_object = $this->loader->getShared(
2095
-                $this->_route_config['list_table'],
2096
-                array($this)
2097
-            );
2098
-        }
2099
-    }
2100
-
2101
-
2102
-    /**
2103
-     * get_list_table_view_RLs - get it? View RL ?? VU-RL???  URL ??
2104
-     *
2105
-     * @param array $extra_query_args                     Optional. An array of extra query args to add to the generated
2106
-     *                                                    urls.  The array should be indexed by the view it is being
2107
-     *                                                    added to.
2108
-     * @return array
2109
-     */
2110
-    public function get_list_table_view_RLs($extra_query_args = array())
2111
-    {
2112
-        do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2113
-        if (empty($this->_views)) {
2114
-            $this->_views = array();
2115
-        }
2116
-        // cycle thru views
2117
-        foreach ($this->_views as $key => $view) {
2118
-            $query_args = array();
2119
-            // check for current view
2120
-            $this->_views[ $key ]['class'] = $this->_view === $view['slug'] ? 'current' : '';
2121
-            $query_args['action'] = $this->_req_action;
2122
-            $query_args[ $this->_req_action . '_nonce' ] = wp_create_nonce($query_args['action'] . '_nonce');
2123
-            $query_args['status'] = $view['slug'];
2124
-            // merge any other arguments sent in.
2125
-            if (isset($extra_query_args[ $view['slug'] ])) {
2126
-                foreach ($extra_query_args[ $view['slug'] ] as $extra_query_arg) {
2127
-                    $query_args[] = $extra_query_arg;
2128
-                }
2129
-            }
2130
-            $this->_views[ $key ]['url'] = EE_Admin_Page::add_query_args_and_nonce($query_args, $this->_admin_base_url);
2131
-        }
2132
-        return $this->_views;
2133
-    }
2134
-
2135
-
2136
-    /**
2137
-     * _entries_per_page_dropdown
2138
-     * generates a drop down box for selecting the number of visible rows in an admin page list table
2139
-     *
2140
-     * @todo   : Note: ideally this should be added to the screen options dropdown as that would be consistent with how
2141
-     *         WP does it.
2142
-     * @param int $max_entries total number of rows in the table
2143
-     * @return string
2144
-     */
2145
-    protected function _entries_per_page_dropdown($max_entries = 0)
2146
-    {
2147
-        do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2148
-        $values = array(10, 25, 50, 100);
2149
-        $per_page = (! empty($this->_req_data['per_page'])) ? absint($this->_req_data['per_page']) : 10;
2150
-        if ($max_entries) {
2151
-            $values[] = $max_entries;
2152
-            sort($values);
2153
-        }
2154
-        $entries_per_page_dropdown = '
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
+	// sanitized request action (and nonce)
128
+
129
+	/**
130
+	 * @var string $_req_action
131
+	 */
132
+	protected $_req_action;
133
+
134
+	/**
135
+	 * @var string $_req_nonce
136
+	 */
137
+	protected $_req_nonce;
138
+
139
+	// search related
140
+	protected $_search_btn_label;
141
+
142
+	protected $_search_box_callback;
143
+
144
+	/**
145
+	 * WP Current Screen object
146
+	 *
147
+	 * @var WP_Screen
148
+	 */
149
+	protected $_current_screen;
150
+
151
+	// for holding EE_Admin_Hooks object when needed (set via set_hook_object())
152
+	protected $_hook_obj;
153
+
154
+	// for holding incoming request data
155
+	protected $_req_data;
156
+
157
+	// yes / no array for admin form fields
158
+	protected $_yes_no_values = array();
159
+
160
+	// some default things shared by all child classes
161
+	protected $_default_espresso_metaboxes;
162
+
163
+	/**
164
+	 *    EE_Registry Object
165
+	 *
166
+	 * @var    EE_Registry
167
+	 */
168
+	protected $EE;
169
+
170
+
171
+	/**
172
+	 * This is just a property that flags whether the given route is a caffeinated route or not.
173
+	 *
174
+	 * @var boolean
175
+	 */
176
+	protected $_is_caf = false;
177
+
178
+
179
+	/**
180
+	 * @Constructor
181
+	 * @param bool $routing indicate whether we want to just load the object and handle routing or just load the object.
182
+	 * @throws InvalidArgumentException
183
+	 * @throws InvalidDataTypeException
184
+	 * @throws InvalidInterfaceException
185
+	 * @throws ReflectionException
186
+	 */
187
+	public function __construct($routing = true)
188
+	{
189
+		$this->loader = LoaderFactory::getLoader();
190
+		if (strpos($this->_get_dir(), 'caffeinated') !== false) {
191
+			$this->_is_caf = true;
192
+		}
193
+		$this->_yes_no_values = array(
194
+			array('id' => true, 'text' => esc_html__('Yes', 'event_espresso')),
195
+			array('id' => false, 'text' => esc_html__('No', 'event_espresso')),
196
+		);
197
+		// set the _req_data property.
198
+		$this->_req_data = array_merge($_GET, $_POST);
199
+		// routing enabled?
200
+		$this->_routing = $routing;
201
+	}
202
+
203
+
204
+	/**
205
+	 * This logic used to be in the constructor, but that caused a chicken <--> egg scenario
206
+	 * for child classes that needed to set properties prior to these methods getting called,
207
+	 * but also needed the parent class to have its construction completed as well.
208
+	 * Bottom line is that constructors should ONLY be used for setting initial properties
209
+	 * and any complex initialization logic should only run after instantiation is complete.
210
+	 *
211
+	 * This method gets called immediately after construction from within
212
+	 *      EE_Admin_Page_Init::_initialize_admin_page()
213
+	 *
214
+	 * @throws EE_Error
215
+	 * @throws InvalidArgumentException
216
+	 * @throws InvalidDataTypeException
217
+	 * @throws InvalidInterfaceException
218
+	 * @throws ReflectionException
219
+	 * @since $VID:$
220
+	 */
221
+	public function initializePage()
222
+	{
223
+		// set initial page props (child method)
224
+		$this->_init_page_props();
225
+		// set global defaults
226
+		$this->_set_defaults();
227
+		// set early because incoming requests could be ajax related and we need to register those hooks.
228
+		$this->_global_ajax_hooks();
229
+		$this->_ajax_hooks();
230
+		// other_page_hooks have to be early too.
231
+		$this->_do_other_page_hooks();
232
+		// This just allows us to have extending classes do something specific
233
+		// before the parent constructor runs _page_setup().
234
+		if (method_exists($this, '_before_page_setup')) {
235
+			$this->_before_page_setup();
236
+		}
237
+		// set up page dependencies
238
+		$this->_page_setup();
239
+	}
240
+
241
+
242
+	/**
243
+	 * _init_page_props
244
+	 * Child classes use to set at least the following properties:
245
+	 * $page_slug.
246
+	 * $page_label.
247
+	 *
248
+	 * @abstract
249
+	 * @return void
250
+	 */
251
+	abstract protected function _init_page_props();
252
+
253
+
254
+	/**
255
+	 * _ajax_hooks
256
+	 * child classes put all their add_action('wp_ajax_{name_of_hook}') hooks in here.
257
+	 * Note: within the ajax callback methods.
258
+	 *
259
+	 * @abstract
260
+	 * @return void
261
+	 */
262
+	abstract protected function _ajax_hooks();
263
+
264
+
265
+	/**
266
+	 * _define_page_props
267
+	 * child classes define page properties in here.  Must include at least:
268
+	 * $_admin_base_url = base_url for all admin pages
269
+	 * $_admin_page_title = default admin_page_title for admin pages
270
+	 * $_labels = array of default labels for various automatically generated elements:
271
+	 *    array(
272
+	 *        'buttons' => array(
273
+	 *            'add' => esc_html__('label for add new button'),
274
+	 *            'edit' => esc_html__('label for edit button'),
275
+	 *            'delete' => esc_html__('label for delete button')
276
+	 *            )
277
+	 *        )
278
+	 *
279
+	 * @abstract
280
+	 * @return void
281
+	 */
282
+	abstract protected function _define_page_props();
283
+
284
+
285
+	/**
286
+	 * _set_page_routes
287
+	 * child classes use this to define the page routes for all subpages handled by the class.  Page routes are
288
+	 * assigned to a action => method pairs in an array and to the $_page_routes property.  Each page route must also
289
+	 * have a 'default' route. Here's the format
290
+	 * $this->_page_routes = array(
291
+	 *        'default' => array(
292
+	 *            'func' => '_default_method_handling_route',
293
+	 *            'args' => array('array','of','args'),
294
+	 *            'noheader' => true, //add this in if this page route is processed before any headers are loaded (i.e.
295
+	 *            ajax request, backend processing)
296
+	 *            'headers_sent_route'=>'headers_route_reference', //add this if noheader=>true, and you want to load a
297
+	 *            headers route after.  The string you enter here should match the defined route reference for a
298
+	 *            headers sent route.
299
+	 *            'capability' => 'route_capability', //indicate a string for minimum capability required to access
300
+	 *            this route.
301
+	 *            'obj_id' => 10 // if this route has an object id, then this can include it (used for capability
302
+	 *            checks).
303
+	 *        ),
304
+	 *        'insert_item' => '_method_for_handling_insert_item' //this can be used if all we need to have is a
305
+	 *        handling method.
306
+	 *        )
307
+	 * )
308
+	 *
309
+	 * @abstract
310
+	 * @return void
311
+	 */
312
+	abstract protected function _set_page_routes();
313
+
314
+
315
+	/**
316
+	 * _set_page_config
317
+	 * child classes use this to define the _page_config array for all subpages handled by the class. Each key in the
318
+	 * array corresponds to the page_route for the loaded page. Format:
319
+	 * $this->_page_config = array(
320
+	 *        'default' => array(
321
+	 *            'labels' => array(
322
+	 *                'buttons' => array(
323
+	 *                    'add' => esc_html__('label for adding item'),
324
+	 *                    'edit' => esc_html__('label for editing item'),
325
+	 *                    'delete' => esc_html__('label for deleting item')
326
+	 *                ),
327
+	 *                'publishbox' => esc_html__('Localized Title for Publish metabox', 'event_espresso')
328
+	 *            ), //optional an array of custom labels for various automatically generated elements to use on the
329
+	 *            page. If this isn't present then the defaults will be used as set for the $this->_labels in
330
+	 *            _define_page_props() method
331
+	 *            'nav' => array(
332
+	 *                'label' => esc_html__('Label for Tab', 'event_espresso').
333
+	 *                'url' => 'http://someurl', //automatically generated UNLESS you define
334
+	 *                'css_class' => 'css-class', //automatically generated UNLESS you define
335
+	 *                'order' => 10, //required to indicate tab position.
336
+	 *                'persistent' => false //if you want the nav tab to ONLY display when the specific route is
337
+	 *                displayed then add this parameter.
338
+	 *            'list_table' => 'name_of_list_table' //string for list table class to be loaded for this admin_page.
339
+	 *            'metaboxes' => array('metabox1', 'metabox2'), //if present this key indicates we want to load
340
+	 *            metaboxes set for eventespresso admin pages.
341
+	 *            'has_metaboxes' => true, //this boolean flag can simply be used to indicate if the route will have
342
+	 *            metaboxes.  Typically this is used if the 'metaboxes' index is not used because metaboxes are added
343
+	 *            later.  We just use this flag to make sure the necessary js gets enqueued on page load.
344
+	 *            'has_help_popups' => false //defaults(true) //this boolean flag can simply be used to indicate if the
345
+	 *            given route has help popups setup and if it does then we need to make sure thickbox is enqueued.
346
+	 *            'columns' => array(4, 2), //this key triggers the setup of a page that uses columns (metaboxes).  The
347
+	 *            array indicates the max number of columns (4) and the default number of columns on page load (2).
348
+	 *            There is an option in the "screen_options" dropdown that is setup so users can pick what columns they
349
+	 *            want to display.
350
+	 *            'help_tabs' => array( //this is used for adding help tabs to a page
351
+	 *                'tab_id' => array(
352
+	 *                    'title' => 'tab_title',
353
+	 *                    'filename' => 'name_of_file_containing_content', //this is the primary method for setting
354
+	 *                    help tab content.  The fallback if it isn't present is to try a the callback.  Filename
355
+	 *                    should match a file in the admin folder's "help_tabs" dir (ie..
356
+	 *                    events/help_tabs/name_of_file_containing_content.help_tab.php)
357
+	 *                    'callback' => 'callback_method_for_content', //if 'filename' isn't present then system will
358
+	 *                    attempt to use the callback which should match the name of a method in the class
359
+	 *                    ),
360
+	 *                'tab2_id' => array(
361
+	 *                    'title' => 'tab2 title',
362
+	 *                    'filename' => 'file_name_2'
363
+	 *                    'callback' => 'callback_method_for_content',
364
+	 *                 ),
365
+	 *            'help_sidebar' => 'callback_for_sidebar_content', //this is used for setting up the sidebar in the
366
+	 *            help tab area on an admin page. @link
367
+	 *            http://make.wordpress.org/core/2011/12/06/help-and-screen-api-changes-in-3-3/
368
+	 *            'help_tour' => array(
369
+	 *                'name_of_help_tour_class', //all help tours shoudl be a child class of EE_Help_Tour and located
370
+	 *                in a folder for this admin page named "help_tours", a file name matching the key given here
371
+	 *                (name_of_help_tour_class.class.php), and class matching key given here (name_of_help_tour_class)
372
+	 *            ),
373
+	 *            'require_nonce' => TRUE //this is used if you want to set a route to NOT require a nonce (default is
374
+	 *            true if it isn't present).  To remove the requirement for a nonce check when this route is visited
375
+	 *            just set
376
+	 *            'require_nonce' to FALSE
377
+	 *            )
378
+	 * )
379
+	 *
380
+	 * @abstract
381
+	 * @return void
382
+	 */
383
+	abstract protected function _set_page_config();
384
+
385
+
386
+
387
+
388
+
389
+	/** end sample help_tour methods **/
390
+	/**
391
+	 * _add_screen_options
392
+	 * Child classes can add any extra wp_screen_options within this method using built-in WP functions/methods for
393
+	 * doing so. Note child classes can also define _add_screen_options_($this->_current_view) to limit screen options
394
+	 * to a particular view.
395
+	 *
396
+	 * @link   http://chrismarslender.com/wp-tutorials/wordpress-screen-options-tutorial/
397
+	 *         see also WP_Screen object documents...
398
+	 * @link   http://codex.wordpress.org/Class_Reference/WP_Screen
399
+	 * @abstract
400
+	 * @return void
401
+	 */
402
+	abstract protected function _add_screen_options();
403
+
404
+
405
+	/**
406
+	 * _add_feature_pointers
407
+	 * Child classes should use this method for implementing any "feature pointers" (using built-in WP styling js).
408
+	 * Note child classes can also define _add_feature_pointers_($this->_current_view) to limit screen options to a
409
+	 * particular view. Note: this is just a placeholder for now.  Implementation will come down the road See:
410
+	 * WP_Internal_Pointers class in wp-admin/includes/template.php for example (its a final class so can't be
411
+	 * extended) also see:
412
+	 *
413
+	 * @link   http://eamann.com/tech/wordpress-portland/
414
+	 * @abstract
415
+	 * @return void
416
+	 */
417
+	abstract protected function _add_feature_pointers();
418
+
419
+
420
+	/**
421
+	 * load_scripts_styles
422
+	 * child classes put their wp_enqueue_script and wp_enqueue_style hooks in here for anything they need loaded for
423
+	 * their pages/subpages.  Note this is for all pages/subpages of the system.  You can also load only specific
424
+	 * scripts/styles per view by putting them in a dynamic function in this format
425
+	 * (load_scripts_styles_{$this->_current_view}) which matches your page route (action request arg)
426
+	 *
427
+	 * @abstract
428
+	 * @return void
429
+	 */
430
+	abstract public function load_scripts_styles();
431
+
432
+
433
+	/**
434
+	 * admin_init
435
+	 * Anything that should be set/executed at 'admin_init' WP hook runtime should be put in here.  This will apply to
436
+	 * all pages/views loaded by child class.
437
+	 *
438
+	 * @abstract
439
+	 * @return void
440
+	 */
441
+	abstract public function admin_init();
442
+
443
+
444
+	/**
445
+	 * admin_notices
446
+	 * Anything triggered by the 'admin_notices' WP hook should be put in here.  This particular method will apply to
447
+	 * all pages/views loaded by child class.
448
+	 *
449
+	 * @abstract
450
+	 * @return void
451
+	 */
452
+	abstract public function admin_notices();
453
+
454
+
455
+	/**
456
+	 * admin_footer_scripts
457
+	 * Anything triggered by the 'admin_print_footer_scripts' WP hook should be put in here. This particular method
458
+	 * will apply to all pages/views loaded by child class.
459
+	 *
460
+	 * @return void
461
+	 */
462
+	abstract public function admin_footer_scripts();
463
+
464
+
465
+	/**
466
+	 * admin_footer
467
+	 * anything triggered by the 'admin_footer' WP action hook should be added to here. This particular method will
468
+	 * apply to all pages/views loaded by child class.
469
+	 *
470
+	 * @return void
471
+	 */
472
+	public function admin_footer()
473
+	{
474
+	}
475
+
476
+
477
+	/**
478
+	 * _global_ajax_hooks
479
+	 * all global add_action('wp_ajax_{name_of_hook}') hooks in here.
480
+	 * Note: within the ajax callback methods.
481
+	 *
482
+	 * @abstract
483
+	 * @return void
484
+	 */
485
+	protected function _global_ajax_hooks()
486
+	{
487
+		// for lazy loading of metabox content
488
+		add_action('wp_ajax_espresso-ajax-content', array($this, 'ajax_metabox_content'), 10);
489
+	}
490
+
491
+
492
+	public function ajax_metabox_content()
493
+	{
494
+		$contentid = isset($this->_req_data['contentid']) ? $this->_req_data['contentid'] : '';
495
+		$url = isset($this->_req_data['contenturl']) ? $this->_req_data['contenturl'] : '';
496
+		EE_Admin_Page::cached_rss_display($contentid, $url);
497
+		wp_die();
498
+	}
499
+
500
+
501
+	/**
502
+	 * _page_setup
503
+	 * Makes sure any things that need to be loaded early get handled.  We also escape early here if the page requested
504
+	 * doesn't match the object.
505
+	 *
506
+	 * @final
507
+	 * @return void
508
+	 * @throws EE_Error
509
+	 * @throws InvalidArgumentException
510
+	 * @throws ReflectionException
511
+	 * @throws InvalidDataTypeException
512
+	 * @throws InvalidInterfaceException
513
+	 */
514
+	final protected function _page_setup()
515
+	{
516
+		// requires?
517
+		// admin_init stuff - global - we're setting this REALLY early
518
+		// so if EE_Admin pages have to hook into other WP pages they can.
519
+		// But keep in mind, not everything is available from the EE_Admin Page object at this point.
520
+		add_action('admin_init', array($this, 'admin_init_global'), 5);
521
+		// next verify if we need to load anything...
522
+		$this->_current_page = ! empty($_GET['page']) ? sanitize_key($_GET['page']) : '';
523
+		$this->page_folder = strtolower(
524
+			str_replace(array('_Admin_Page', 'Extend_'), '', get_class($this))
525
+		);
526
+		global $ee_menu_slugs;
527
+		$ee_menu_slugs = (array) $ee_menu_slugs;
528
+		if (! defined('DOING_AJAX') && (! $this->_current_page || ! isset($ee_menu_slugs[ $this->_current_page ]))) {
529
+			return;
530
+		}
531
+		// becuz WP List tables have two duplicate select inputs for choosing bulk actions, we need to copy the action from the second to the first
532
+		if (isset($this->_req_data['action2']) && $this->_req_data['action'] === '-1') {
533
+			$this->_req_data['action'] = ! empty($this->_req_data['action2']) && $this->_req_data['action2'] !== '-1'
534
+				? $this->_req_data['action2']
535
+				: $this->_req_data['action'];
536
+		}
537
+		// then set blank or -1 action values to 'default'
538
+		$this->_req_action = isset($this->_req_data['action'])
539
+							 && ! empty($this->_req_data['action'])
540
+							 && $this->_req_data['action'] !== '-1'
541
+			? sanitize_key($this->_req_data['action'])
542
+			: 'default';
543
+		// if action is 'default' after the above BUT we have  'route' var set, then let's use the route as the action.
544
+		//  This covers cases where we're coming in from a list table that isn't on the default route.
545
+		$this->_req_action = $this->_req_action === 'default' && isset($this->_req_data['route'])
546
+			? $this->_req_data['route'] : $this->_req_action;
547
+		// however if we are doing_ajax and we've got a 'route' set then that's what the req_action will be
548
+		$this->_req_action = defined('DOING_AJAX') && isset($this->_req_data['route'])
549
+			? $this->_req_data['route']
550
+			: $this->_req_action;
551
+		$this->_current_view = $this->_req_action;
552
+		$this->_req_nonce = $this->_req_action . '_nonce';
553
+		$this->_define_page_props();
554
+		$this->_current_page_view_url = add_query_arg(
555
+			array('page' => $this->_current_page, 'action' => $this->_current_view),
556
+			$this->_admin_base_url
557
+		);
558
+		// default things
559
+		$this->_default_espresso_metaboxes = array(
560
+			'_espresso_news_post_box',
561
+			'_espresso_links_post_box',
562
+			'_espresso_ratings_request',
563
+			'_espresso_sponsors_post_box',
564
+		);
565
+		// set page configs
566
+		$this->_set_page_routes();
567
+		$this->_set_page_config();
568
+		// let's include any referrer data in our default_query_args for this route for "stickiness".
569
+		if (isset($this->_req_data['wp_referer'])) {
570
+			$this->_default_route_query_args['wp_referer'] = $this->_req_data['wp_referer'];
571
+		}
572
+		// for caffeinated and other extended functionality.
573
+		//  If there is a _extend_page_config method
574
+		// then let's run that to modify the all the various page configuration arrays
575
+		if (method_exists($this, '_extend_page_config')) {
576
+			$this->_extend_page_config();
577
+		}
578
+		// for CPT and other extended functionality.
579
+		// If there is an _extend_page_config_for_cpt
580
+		// then let's run that to modify all the various page configuration arrays.
581
+		if (method_exists($this, '_extend_page_config_for_cpt')) {
582
+			$this->_extend_page_config_for_cpt();
583
+		}
584
+		// filter routes and page_config so addons can add their stuff. Filtering done per class
585
+		$this->_page_routes = apply_filters(
586
+			'FHEE__' . get_class($this) . '__page_setup__page_routes',
587
+			$this->_page_routes,
588
+			$this
589
+		);
590
+		$this->_page_config = apply_filters(
591
+			'FHEE__' . get_class($this) . '__page_setup__page_config',
592
+			$this->_page_config,
593
+			$this
594
+		);
595
+		// if AHEE__EE_Admin_Page__route_admin_request_$this->_current_view method is present
596
+		// then we call it hooked into the AHEE__EE_Admin_Page__route_admin_request action
597
+		if (method_exists($this, 'AHEE__EE_Admin_Page__route_admin_request_' . $this->_current_view)) {
598
+			add_action(
599
+				'AHEE__EE_Admin_Page__route_admin_request',
600
+				array($this, 'AHEE__EE_Admin_Page__route_admin_request_' . $this->_current_view),
601
+				10,
602
+				2
603
+			);
604
+		}
605
+		// next route only if routing enabled
606
+		if ($this->_routing && ! defined('DOING_AJAX')) {
607
+			$this->_verify_routes();
608
+			// next let's just check user_access and kill if no access
609
+			$this->check_user_access();
610
+			if ($this->_is_UI_request) {
611
+				// admin_init stuff - global, all views for this page class, specific view
612
+				add_action('admin_init', array($this, 'admin_init'), 10);
613
+				if (method_exists($this, 'admin_init_' . $this->_current_view)) {
614
+					add_action('admin_init', array($this, 'admin_init_' . $this->_current_view), 15);
615
+				}
616
+			} else {
617
+				// hijack regular WP loading and route admin request immediately
618
+				@ini_set('memory_limit', apply_filters('admin_memory_limit', WP_MAX_MEMORY_LIMIT));
619
+				$this->route_admin_request();
620
+			}
621
+		}
622
+	}
623
+
624
+
625
+	/**
626
+	 * Provides a way for related child admin pages to load stuff on the loaded admin page.
627
+	 *
628
+	 * @return void
629
+	 * @throws EE_Error
630
+	 */
631
+	private function _do_other_page_hooks()
632
+	{
633
+		$registered_pages = apply_filters('FHEE_do_other_page_hooks_' . $this->page_slug, array());
634
+		foreach ($registered_pages as $page) {
635
+			// now let's setup the file name and class that should be present
636
+			$classname = str_replace('.class.php', '', $page);
637
+			// autoloaders should take care of loading file
638
+			if (! class_exists($classname)) {
639
+				$error_msg[] = sprintf(
640
+					esc_html__(
641
+						'Something went wrong with loading the %s admin hooks page.',
642
+						'event_espresso'
643
+					),
644
+					$page
645
+				);
646
+				$error_msg[] = $error_msg[0]
647
+							   . "\r\n"
648
+							   . sprintf(
649
+								   esc_html__(
650
+									   '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',
651
+									   'event_espresso'
652
+								   ),
653
+								   $page,
654
+								   '<br />',
655
+								   '<strong>' . $classname . '</strong>'
656
+							   );
657
+				throw new EE_Error(implode('||', $error_msg));
658
+			}
659
+			// // notice we are passing the instance of this class to the hook object.
660
+			$this->loader->getShared($classname, [$this]);
661
+		}
662
+	}
663
+
664
+
665
+	/**
666
+	 * @throws DomainException
667
+	 * @throws EE_Error
668
+	 * @throws InvalidArgumentException
669
+	 * @throws InvalidDataTypeException
670
+	 * @throws InvalidInterfaceException
671
+	 * @throws ReflectionException
672
+	 * @since $VID:$
673
+	 */
674
+	public function load_page_dependencies()
675
+	{
676
+		try {
677
+			$this->_load_page_dependencies();
678
+		} catch (EE_Error $e) {
679
+			$e->get_error();
680
+		}
681
+	}
682
+
683
+
684
+	/**
685
+	 * load_page_dependencies
686
+	 * loads things specific to this page class when its loaded.  Really helps with efficiency.
687
+	 *
688
+	 * @return void
689
+	 * @throws DomainException
690
+	 * @throws EE_Error
691
+	 * @throws InvalidArgumentException
692
+	 * @throws InvalidDataTypeException
693
+	 * @throws InvalidInterfaceException
694
+	 * @throws ReflectionException
695
+	 */
696
+	protected function _load_page_dependencies()
697
+	{
698
+		// let's set the current_screen and screen options to override what WP set
699
+		$this->_current_screen = get_current_screen();
700
+		// load admin_notices - global, page class, and view specific
701
+		add_action('admin_notices', array($this, 'admin_notices_global'), 5);
702
+		add_action('admin_notices', array($this, 'admin_notices'), 10);
703
+		if (method_exists($this, 'admin_notices_' . $this->_current_view)) {
704
+			add_action('admin_notices', array($this, 'admin_notices_' . $this->_current_view), 15);
705
+		}
706
+		// load network admin_notices - global, page class, and view specific
707
+		add_action('network_admin_notices', array($this, 'network_admin_notices_global'), 5);
708
+		if (method_exists($this, 'network_admin_notices_' . $this->_current_view)) {
709
+			add_action('network_admin_notices', array($this, 'network_admin_notices_' . $this->_current_view));
710
+		}
711
+		// this will save any per_page screen options if they are present
712
+		$this->_set_per_page_screen_options();
713
+		// setup list table properties
714
+		$this->_set_list_table();
715
+		// child classes can "register" a metabox to be automatically handled via the _page_config array property.
716
+		// However in some cases the metaboxes will need to be added within a route handling callback.
717
+		$this->_add_registered_meta_boxes();
718
+		$this->_add_screen_columns();
719
+		// add screen options - global, page child class, and view specific
720
+		$this->_add_global_screen_options();
721
+		$this->_add_screen_options();
722
+		$add_screen_options = "_add_screen_options_{$this->_current_view}";
723
+		if (method_exists($this, $add_screen_options)) {
724
+			$this->{$add_screen_options}();
725
+		}
726
+		// add help tab(s) and tours- set via page_config and qtips.
727
+		$this->_add_help_tour();
728
+		$this->_add_help_tabs();
729
+		$this->_add_qtips();
730
+		// add feature_pointers - global, page child class, and view specific
731
+		$this->_add_feature_pointers();
732
+		$this->_add_global_feature_pointers();
733
+		$add_feature_pointer = "_add_feature_pointer_{$this->_current_view}";
734
+		if (method_exists($this, $add_feature_pointer)) {
735
+			$this->{$add_feature_pointer}();
736
+		}
737
+		// enqueue scripts/styles - global, page class, and view specific
738
+		add_action('admin_enqueue_scripts', array($this, 'load_global_scripts_styles'), 5);
739
+		add_action('admin_enqueue_scripts', array($this, 'load_scripts_styles'), 10);
740
+		if (method_exists($this, "load_scripts_styles_{$this->_current_view}")) {
741
+			add_action('admin_enqueue_scripts', array($this, "load_scripts_styles_{$this->_current_view}"), 15);
742
+		}
743
+		add_action('admin_enqueue_scripts', array($this, 'admin_footer_scripts_eei18n_js_strings'), 100);
744
+		// admin_print_footer_scripts - global, page child class, and view specific.
745
+		// NOTE, despite the name, whenever possible, scripts should NOT be loaded using this.
746
+		// In most cases that's doing_it_wrong().  But adding hidden container elements etc.
747
+		// is a good use case. Notice the late priority we're giving these
748
+		add_action('admin_print_footer_scripts', array($this, 'admin_footer_scripts_global'), 99);
749
+		add_action('admin_print_footer_scripts', array($this, 'admin_footer_scripts'), 100);
750
+		if (method_exists($this, "admin_footer_scripts_{$this->_current_view}")) {
751
+			add_action('admin_print_footer_scripts', array($this, "admin_footer_scripts_{$this->_current_view}"), 101);
752
+		}
753
+		// admin footer scripts
754
+		add_action('admin_footer', array($this, 'admin_footer_global'), 99);
755
+		add_action('admin_footer', array($this, 'admin_footer'), 100);
756
+		if (method_exists($this, "admin_footer_{$this->_current_view}")) {
757
+			add_action('admin_footer', array($this, "admin_footer_{$this->_current_view}"), 101);
758
+		}
759
+		do_action('FHEE__EE_Admin_Page___load_page_dependencies__after_load', $this->page_slug);
760
+		// targeted hook
761
+		do_action(
762
+			"FHEE__EE_Admin_Page___load_page_dependencies__after_load__{$this->page_slug}__{$this->_req_action}"
763
+		);
764
+	}
765
+
766
+
767
+	/**
768
+	 * _set_defaults
769
+	 * This sets some global defaults for class properties.
770
+	 */
771
+	private function _set_defaults()
772
+	{
773
+		$this->_current_screen = $this->_admin_page_title = $this->_req_action = $this->_req_nonce = null;
774
+		$this->_event = $this->_template_path = $this->_column_template_path = null;
775
+		$this->_nav_tabs = $this->_views = $this->_page_routes = array();
776
+		$this->_page_config = $this->_default_route_query_args = array();
777
+		$this->_default_nav_tab_name = 'overview';
778
+		// init template args
779
+		$this->_template_args = array(
780
+			'admin_page_header'  => '',
781
+			'admin_page_content' => '',
782
+			'post_body_content'  => '',
783
+			'before_list_table'  => '',
784
+			'after_list_table'   => '',
785
+		);
786
+	}
787
+
788
+
789
+	/**
790
+	 * route_admin_request
791
+	 *
792
+	 * @see    _route_admin_request()
793
+	 * @return exception|void error
794
+	 * @throws InvalidArgumentException
795
+	 * @throws InvalidInterfaceException
796
+	 * @throws InvalidDataTypeException
797
+	 * @throws EE_Error
798
+	 * @throws ReflectionException
799
+	 */
800
+	public function route_admin_request()
801
+	{
802
+		try {
803
+			$this->_route_admin_request();
804
+		} catch (EE_Error $e) {
805
+			$e->get_error();
806
+		}
807
+	}
808
+
809
+
810
+	public function set_wp_page_slug($wp_page_slug)
811
+	{
812
+		$this->_wp_page_slug = $wp_page_slug;
813
+		// if in network admin then we need to append "-network" to the page slug. Why? Because that's how WP rolls...
814
+		if (is_network_admin()) {
815
+			$this->_wp_page_slug .= '-network';
816
+		}
817
+	}
818
+
819
+
820
+	/**
821
+	 * _verify_routes
822
+	 * All this method does is verify the incoming request and make sure that routes exist for it.  We do this early so
823
+	 * we know if we need to drop out.
824
+	 *
825
+	 * @return bool
826
+	 * @throws EE_Error
827
+	 */
828
+	protected function _verify_routes()
829
+	{
830
+		if (! $this->_current_page && ! defined('DOING_AJAX')) {
831
+			return false;
832
+		}
833
+		$this->_route = false;
834
+		// check that the page_routes array is not empty
835
+		if (empty($this->_page_routes)) {
836
+			// user error msg
837
+			$error_msg = sprintf(
838
+				esc_html__('No page routes have been set for the %s admin page.', 'event_espresso'),
839
+				$this->_admin_page_title
840
+			);
841
+			// developer error msg
842
+			$error_msg .= '||' . $error_msg
843
+						  . esc_html__(
844
+							  ' Make sure the "set_page_routes()" method exists, and is setting the "_page_routes" array properly.',
845
+							  'event_espresso'
846
+						  );
847
+			throw new EE_Error($error_msg);
848
+		}
849
+		// and that the requested page route exists
850
+		if (array_key_exists($this->_req_action, $this->_page_routes)) {
851
+			$this->_route = $this->_page_routes[ $this->_req_action ];
852
+			$this->_route_config = isset($this->_page_config[ $this->_req_action ])
853
+				? $this->_page_config[ $this->_req_action ] : array();
854
+		} else {
855
+			// user error msg
856
+			$error_msg = sprintf(
857
+				esc_html__(
858
+					'The requested page route does not exist for the %s admin page.',
859
+					'event_espresso'
860
+				),
861
+				$this->_admin_page_title
862
+			);
863
+			// developer error msg
864
+			$error_msg .= '||' . $error_msg
865
+						  . sprintf(
866
+							  esc_html__(
867
+								  ' Create a key in the "_page_routes" array named "%s" and set its value to the appropriate method.',
868
+								  'event_espresso'
869
+							  ),
870
+							  $this->_req_action
871
+						  );
872
+			throw new EE_Error($error_msg);
873
+		}
874
+		// and that a default route exists
875
+		if (! array_key_exists('default', $this->_page_routes)) {
876
+			// user error msg
877
+			$error_msg = sprintf(
878
+				esc_html__(
879
+					'A default page route has not been set for the % admin page.',
880
+					'event_espresso'
881
+				),
882
+				$this->_admin_page_title
883
+			);
884
+			// developer error msg
885
+			$error_msg .= '||' . $error_msg
886
+						  . esc_html__(
887
+							  ' Create a key in the "_page_routes" array named "default" and set its value to your default page method.',
888
+							  'event_espresso'
889
+						  );
890
+			throw new EE_Error($error_msg);
891
+		}
892
+
893
+		// first lets' catch if the UI request has EVER been set.
894
+		if ($this->_is_UI_request === null) {
895
+			// lets set if this is a UI request or not.
896
+			$this->_is_UI_request = ! isset($this->_req_data['noheader']) || $this->_req_data['noheader'] !== true;
897
+			// wait a minute... we might have a noheader in the route array
898
+			$this->_is_UI_request = is_array($this->_route)
899
+									&& isset($this->_route['noheader'])
900
+									&& $this->_route['noheader'] ? false : $this->_is_UI_request;
901
+		}
902
+		$this->_set_current_labels();
903
+		return true;
904
+	}
905
+
906
+
907
+	/**
908
+	 * this method simply verifies a given route and makes sure its an actual route available for the loaded page
909
+	 *
910
+	 * @param  string $route the route name we're verifying
911
+	 * @return mixed (bool|Exception)      we'll throw an exception if this isn't a valid route.
912
+	 * @throws EE_Error
913
+	 */
914
+	protected function _verify_route($route)
915
+	{
916
+		if (array_key_exists($this->_req_action, $this->_page_routes)) {
917
+			return true;
918
+		}
919
+		// user error msg
920
+		$error_msg = sprintf(
921
+			esc_html__('The given page route does not exist for the %s admin page.', 'event_espresso'),
922
+			$this->_admin_page_title
923
+		);
924
+		// developer error msg
925
+		$error_msg .= '||' . $error_msg
926
+					  . sprintf(
927
+						  esc_html__(
928
+							  ' Check the route you are using in your method (%s) and make sure it matches a route set in your "_page_routes" array property',
929
+							  'event_espresso'
930
+						  ),
931
+						  $route
932
+					  );
933
+		throw new EE_Error($error_msg);
934
+	}
935
+
936
+
937
+	/**
938
+	 * perform nonce verification
939
+	 * This method has be encapsulated here so that any ajax requests that bypass normal routes can verify their nonces
940
+	 * using this method (and save retyping!)
941
+	 *
942
+	 * @param string $nonce     The nonce sent
943
+	 * @param string $nonce_ref The nonce reference string (name0)
944
+	 * @return void
945
+	 * @throws EE_Error
946
+	 * @throws InvalidArgumentException
947
+	 * @throws InvalidDataTypeException
948
+	 * @throws InvalidInterfaceException
949
+	 */
950
+	protected function _verify_nonce($nonce, $nonce_ref)
951
+	{
952
+		// verify nonce against expected value
953
+		if (! wp_verify_nonce($nonce, $nonce_ref)) {
954
+			// these are not the droids you are looking for !!!
955
+			$msg = sprintf(
956
+				esc_html__('%sNonce Fail.%s', 'event_espresso'),
957
+				'<a href="http://www.youtube.com/watch?v=56_S0WeTkzs">',
958
+				'</a>'
959
+			);
960
+			if (WP_DEBUG) {
961
+				$msg .= "\n  "
962
+						. sprintf(
963
+							esc_html__(
964
+								'In order to dynamically generate nonces for your actions, use the %s::add_query_args_and_nonce() method. May the Nonce be with you!',
965
+								'event_espresso'
966
+							),
967
+							EE_Admin_Page::class
968
+						);
969
+			}
970
+			if (! defined('DOING_AJAX')) {
971
+				wp_die($msg);
972
+			} else {
973
+				EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
974
+				$this->_return_json();
975
+			}
976
+		}
977
+	}
978
+
979
+
980
+	/**
981
+	 * _route_admin_request()
982
+	 * Meat and potatoes of the class.  Basically, this dude checks out what's being requested and sees if there are
983
+	 * some doodads to work the magic and handle the flingjangy. Translation:  Checks if the requested action is listed
984
+	 * in the page routes and then will try to load the corresponding method.
985
+	 *
986
+	 * @return void
987
+	 * @throws EE_Error
988
+	 * @throws InvalidArgumentException
989
+	 * @throws InvalidDataTypeException
990
+	 * @throws InvalidInterfaceException
991
+	 * @throws ReflectionException
992
+	 */
993
+	protected function _route_admin_request()
994
+	{
995
+		if (! $this->_is_UI_request) {
996
+			$this->_verify_routes();
997
+		}
998
+		$nonce_check = isset($this->_route_config['require_nonce'])
999
+			? $this->_route_config['require_nonce']
1000
+			: true;
1001
+		if ($this->_req_action !== 'default' && $nonce_check) {
1002
+			// set nonce from post data
1003
+			$nonce = isset($this->_req_data[ $this->_req_nonce ])
1004
+				? sanitize_text_field($this->_req_data[ $this->_req_nonce ])
1005
+				: '';
1006
+			$this->_verify_nonce($nonce, $this->_req_nonce);
1007
+		}
1008
+		// set the nav_tabs array but ONLY if this is  UI_request
1009
+		if ($this->_is_UI_request) {
1010
+			$this->_set_nav_tabs();
1011
+		}
1012
+		// grab callback function
1013
+		$func = is_array($this->_route) && isset($this->_route['func']) ? $this->_route['func'] : $this->_route;
1014
+		// check if callback has args
1015
+		$args = is_array($this->_route) && isset($this->_route['args']) ? $this->_route['args'] : array();
1016
+		$error_msg = '';
1017
+		// action right before calling route
1018
+		// (hook is something like 'AHEE__Registrations_Admin_Page__route_admin_request')
1019
+		if (! did_action('AHEE__EE_Admin_Page__route_admin_request')) {
1020
+			do_action('AHEE__EE_Admin_Page__route_admin_request', $this->_current_view, $this);
1021
+		}
1022
+		// right before calling the route, let's remove _wp_http_referer from the
1023
+		// $_SERVER[REQUEST_URI] global (its now in _req_data for route processing).
1024
+		$_SERVER['REQUEST_URI'] = remove_query_arg(
1025
+			'_wp_http_referer',
1026
+			wp_unslash($_SERVER['REQUEST_URI'])
1027
+		);
1028
+		if (! empty($func)) {
1029
+			if (is_array($func)) {
1030
+				list($class, $method) = $func;
1031
+			} elseif (strpos($func, '::') !== false) {
1032
+				list($class, $method) = explode('::', $func);
1033
+			} else {
1034
+				$class = $this;
1035
+				$method = $func;
1036
+			}
1037
+			if (! (is_object($class) && $class === $this)) {
1038
+				// send along this admin page object for access by addons.
1039
+				$args['admin_page_object'] = $this;
1040
+			}
1041
+			// is it a method on a class that doesn't work?
1042
+			if (((method_exists($class, $method)
1043
+				  && call_user_func_array(array($class, $method), $args) === false)
1044
+				 && (// is it a standalone function that doesn't work?
1045
+					 function_exists($method)
1046
+					 && call_user_func_array(
1047
+						 $func,
1048
+						 array_merge(array('admin_page_object' => $this), $args)
1049
+					 ) === false
1050
+				 )) || (// is it neither a class method NOR a standalone function?
1051
+					! function_exists($method)
1052
+					&& ! method_exists($class, $method)
1053
+				)
1054
+			) {
1055
+				// user error msg
1056
+				$error_msg = esc_html__(
1057
+					'An error occurred. The  requested page route could not be found.',
1058
+					'event_espresso'
1059
+				);
1060
+				// developer error msg
1061
+				$error_msg .= '||';
1062
+				$error_msg .= sprintf(
1063
+					esc_html__(
1064
+						'Page route "%s" could not be called. Check that the spelling for method names and actions in the "_page_routes" array are all correct.',
1065
+						'event_espresso'
1066
+					),
1067
+					$method
1068
+				);
1069
+			}
1070
+			if (! empty($error_msg)) {
1071
+				throw new EE_Error($error_msg);
1072
+			}
1073
+		}
1074
+		// if we've routed and this route has a no headers route AND a sent_headers_route,
1075
+		// then we need to reset the routing properties to the new route.
1076
+		// 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.
1077
+		if ($this->_is_UI_request === false
1078
+			&& is_array($this->_route)
1079
+			&& ! empty($this->_route['headers_sent_route'])
1080
+		) {
1081
+			$this->_reset_routing_properties($this->_route['headers_sent_route']);
1082
+		}
1083
+	}
1084
+
1085
+
1086
+	/**
1087
+	 * This method just allows the resetting of page properties in the case where a no headers
1088
+	 * route redirects to a headers route in its route config.
1089
+	 *
1090
+	 * @since   4.3.0
1091
+	 * @param  string $new_route New (non header) route to redirect to.
1092
+	 * @return   void
1093
+	 * @throws ReflectionException
1094
+	 * @throws InvalidArgumentException
1095
+	 * @throws InvalidInterfaceException
1096
+	 * @throws InvalidDataTypeException
1097
+	 * @throws EE_Error
1098
+	 */
1099
+	protected function _reset_routing_properties($new_route)
1100
+	{
1101
+		$this->_is_UI_request = true;
1102
+		// now we set the current route to whatever the headers_sent_route is set at
1103
+		$this->_req_data['action'] = $new_route;
1104
+		// rerun page setup
1105
+		$this->_page_setup();
1106
+	}
1107
+
1108
+
1109
+	/**
1110
+	 * _add_query_arg
1111
+	 * adds nonce to array of arguments then calls WP add_query_arg function
1112
+	 *(internally just uses EEH_URL's function with the same name)
1113
+	 *
1114
+	 * @param array  $args
1115
+	 * @param string $url
1116
+	 * @param bool   $sticky                  if true, then the existing Request params will be appended to the
1117
+	 *                                        generated url in an associative array indexed by the key 'wp_referer';
1118
+	 *                                        Example usage: If the current page is:
1119
+	 *                                        http://mydomain.com/wp-admin/admin.php?page=espresso_registrations
1120
+	 *                                        &action=default&event_id=20&month_range=March%202015
1121
+	 *                                        &_wpnonce=5467821
1122
+	 *                                        and you call:
1123
+	 *                                        EE_Admin_Page::add_query_args_and_nonce(
1124
+	 *                                        array(
1125
+	 *                                        'action' => 'resend_something',
1126
+	 *                                        'page=>espresso_registrations'
1127
+	 *                                        ),
1128
+	 *                                        $some_url,
1129
+	 *                                        true
1130
+	 *                                        );
1131
+	 *                                        It will produce a url in this structure:
1132
+	 *                                        http://{$some_url}/?page=espresso_registrations&action=resend_something
1133
+	 *                                        &wp_referer[action]=default&wp_referer[event_id]=20&wpreferer[
1134
+	 *                                        month_range]=March%202015
1135
+	 * @param   bool $exclude_nonce           If true, the the nonce will be excluded from the generated nonce.
1136
+	 * @return string
1137
+	 */
1138
+	public static function add_query_args_and_nonce(
1139
+		$args = array(),
1140
+		$url = '',
1141
+		$sticky = false,
1142
+		$exclude_nonce = false
1143
+	) {
1144
+		// if there is a _wp_http_referer include the values from the request but only if sticky = true
1145
+		if ($sticky) {
1146
+			$request = $_REQUEST;
1147
+			unset($request['_wp_http_referer'], $request['wp_referer']);
1148
+			foreach ($request as $key => $value) {
1149
+				// do not add nonces
1150
+				if (strpos($key, 'nonce') !== false) {
1151
+					continue;
1152
+				}
1153
+				$args[ 'wp_referer[' . $key . ']' ] = $value;
1154
+			}
1155
+		}
1156
+		return EEH_URL::add_query_args_and_nonce($args, $url, $exclude_nonce);
1157
+	}
1158
+
1159
+
1160
+	/**
1161
+	 * This returns a generated link that will load the related help tab.
1162
+	 *
1163
+	 * @param  string $help_tab_id the id for the connected help tab
1164
+	 * @param  string $icon_style  (optional) include css class for the style you want to use for the help icon.
1165
+	 * @param  string $help_text   (optional) send help text you want to use for the link if default not to be used
1166
+	 * @uses EEH_Template::get_help_tab_link()
1167
+	 * @return string              generated link
1168
+	 */
1169
+	protected function _get_help_tab_link($help_tab_id, $icon_style = '', $help_text = '')
1170
+	{
1171
+		return EEH_Template::get_help_tab_link(
1172
+			$help_tab_id,
1173
+			$this->page_slug,
1174
+			$this->_req_action,
1175
+			$icon_style,
1176
+			$help_text
1177
+		);
1178
+	}
1179
+
1180
+
1181
+	/**
1182
+	 * _add_help_tabs
1183
+	 * Note child classes define their help tabs within the page_config array.
1184
+	 *
1185
+	 * @link   http://codex.wordpress.org/Function_Reference/add_help_tab
1186
+	 * @return void
1187
+	 * @throws DomainException
1188
+	 * @throws EE_Error
1189
+	 * @throws ReflectionException
1190
+	 */
1191
+	protected function _add_help_tabs()
1192
+	{
1193
+		$tour_buttons = '';
1194
+		if (isset($this->_page_config[ $this->_req_action ])) {
1195
+			$config = $this->_page_config[ $this->_req_action ];
1196
+			// is there a help tour for the current route?  if there is let's setup the tour buttons
1197
+			if (isset($this->_help_tour[ $this->_req_action ])) {
1198
+				$tb = array();
1199
+				$tour_buttons = '<div class="ee-abs-container"><div class="ee-help-tour-restart-buttons">';
1200
+				foreach ($this->_help_tour['tours'] as $tour) {
1201
+					// if this is the end tour then we don't need to setup a button
1202
+					if ($tour instanceof EE_Help_Tour_final_stop || ! $tour instanceof EE_Help_Tour) {
1203
+						continue;
1204
+					}
1205
+					$tb[] = '<button id="trigger-tour-'
1206
+							. $tour->get_slug()
1207
+							. '" class="button-primary trigger-ee-help-tour">'
1208
+							. $tour->get_label()
1209
+							. '</button>';
1210
+				}
1211
+				$tour_buttons .= implode('<br />', $tb);
1212
+				$tour_buttons .= '</div></div>';
1213
+			}
1214
+			// let's see if there is a help_sidebar set for the current route and we'll set that up for usage as well.
1215
+			if (is_array($config) && isset($config['help_sidebar'])) {
1216
+				// check that the callback given is valid
1217
+				if (! method_exists($this, $config['help_sidebar'])) {
1218
+					throw new EE_Error(
1219
+						sprintf(
1220
+							esc_html__(
1221
+								'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',
1222
+								'event_espresso'
1223
+							),
1224
+							$config['help_sidebar'],
1225
+							get_class($this)
1226
+						)
1227
+					);
1228
+				}
1229
+				$content = apply_filters(
1230
+					'FHEE__' . get_class($this) . '__add_help_tabs__help_sidebar',
1231
+					$this->{$config['help_sidebar']}()
1232
+				);
1233
+				$content .= $tour_buttons; // add help tour buttons.
1234
+				// do we have any help tours setup?  Cause if we do we want to add the buttons
1235
+				$this->_current_screen->set_help_sidebar($content);
1236
+			}
1237
+			// if there ARE tour buttons...
1238
+			if (! empty($tour_buttons)) {
1239
+				// if we DON'T have config help sidebar then we'll just add the tour buttons to the sidebar.
1240
+				if (! isset($config['help_sidebar'])) {
1241
+					$this->_current_screen->set_help_sidebar($tour_buttons);
1242
+				}
1243
+				// handle if no help_tabs are set so the sidebar will still show for the help tour buttons
1244
+				if (! isset($config['help_tabs'])) {
1245
+					$_ht['id'] = $this->page_slug;
1246
+					$_ht['title'] = esc_html__('Help Tours', 'event_espresso');
1247
+					$_ht['content'] = '<p>'
1248
+									  . esc_html__(
1249
+										  'The buttons to the right allow you to start/restart any help tours available for this page',
1250
+										  'event_espresso'
1251
+									  ) . '</p>';
1252
+					$this->_current_screen->add_help_tab($_ht);
1253
+				}
1254
+			}
1255
+			if (! isset($config['help_tabs'])) {
1256
+				return;
1257
+			} //no help tabs for this route
1258
+			foreach ((array) $config['help_tabs'] as $tab_id => $cfg) {
1259
+				// we're here so there ARE help tabs!
1260
+				// make sure we've got what we need
1261
+				if (! isset($cfg['title'])) {
1262
+					throw new EE_Error(
1263
+						esc_html__(
1264
+							'The _page_config array is not set up properly for help tabs.  It is missing a title',
1265
+							'event_espresso'
1266
+						)
1267
+					);
1268
+				}
1269
+				if (! isset($cfg['filename']) && ! isset($cfg['callback']) && ! isset($cfg['content'])) {
1270
+					throw new EE_Error(
1271
+						esc_html__(
1272
+							'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',
1273
+							'event_espresso'
1274
+						)
1275
+					);
1276
+				}
1277
+				// first priority goes to content.
1278
+				if (! empty($cfg['content'])) {
1279
+					$content = ! empty($cfg['content']) ? $cfg['content'] : null;
1280
+					// second priority goes to filename
1281
+				} elseif (! empty($cfg['filename'])) {
1282
+					$file_path = $this->_get_dir() . '/help_tabs/' . $cfg['filename'] . '.help_tab.php';
1283
+					// 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)
1284
+					$file_path = ! is_readable($file_path) ? EE_ADMIN_PAGES
1285
+															 . basename($this->_get_dir())
1286
+															 . '/help_tabs/'
1287
+															 . $cfg['filename']
1288
+															 . '.help_tab.php' : $file_path;
1289
+					// if file is STILL not readable then let's do a EE_Error so its more graceful than a fatal error.
1290
+					if (! isset($cfg['callback']) && ! is_readable($file_path)) {
1291
+						EE_Error::add_error(
1292
+							sprintf(
1293
+								esc_html__(
1294
+									'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',
1295
+									'event_espresso'
1296
+								),
1297
+								$tab_id,
1298
+								key($config),
1299
+								$file_path
1300
+							),
1301
+							__FILE__,
1302
+							__FUNCTION__,
1303
+							__LINE__
1304
+						);
1305
+						return;
1306
+					}
1307
+					$template_args['admin_page_obj'] = $this;
1308
+					$content = EEH_Template::display_template(
1309
+						$file_path,
1310
+						$template_args,
1311
+						true
1312
+					);
1313
+				} else {
1314
+					$content = '';
1315
+				}
1316
+				// check if callback is valid
1317
+				if (empty($content) && (
1318
+						! isset($cfg['callback']) || ! method_exists($this, $cfg['callback'])
1319
+					)
1320
+				) {
1321
+					EE_Error::add_error(
1322
+						sprintf(
1323
+							esc_html__(
1324
+								'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.',
1325
+								'event_espresso'
1326
+							),
1327
+							$cfg['title']
1328
+						),
1329
+						__FILE__,
1330
+						__FUNCTION__,
1331
+						__LINE__
1332
+					);
1333
+					return;
1334
+				}
1335
+				// setup config array for help tab method
1336
+				$id = $this->page_slug . '-' . $this->_req_action . '-' . $tab_id;
1337
+				$_ht = array(
1338
+					'id'       => $id,
1339
+					'title'    => $cfg['title'],
1340
+					'callback' => isset($cfg['callback']) && empty($content) ? array($this, $cfg['callback']) : null,
1341
+					'content'  => $content,
1342
+				);
1343
+				$this->_current_screen->add_help_tab($_ht);
1344
+			}
1345
+		}
1346
+	}
1347
+
1348
+
1349
+	/**
1350
+	 * This basically checks loaded $_page_config property to see if there are any help_tours defined.  "help_tours" is
1351
+	 * an array with properties for setting up usage of the joyride plugin
1352
+	 *
1353
+	 * @link   http://zurb.com/playground/jquery-joyride-feature-tour-plugin
1354
+	 * @see    instructions regarding the format and construction of the "help_tour" array element is found in the
1355
+	 *         _set_page_config() comments
1356
+	 * @return void
1357
+	 * @throws EE_Error
1358
+	 * @throws InvalidArgumentException
1359
+	 * @throws InvalidDataTypeException
1360
+	 * @throws InvalidInterfaceException
1361
+	 * @throws ReflectionException
1362
+	 */
1363
+	protected function _add_help_tour()
1364
+	{
1365
+		$tours = array();
1366
+		$this->_help_tour = array();
1367
+		// exit early if help tours are turned off globally
1368
+		if ((defined('EE_DISABLE_HELP_TOURS') && EE_DISABLE_HELP_TOURS)
1369
+			|| ! EE_Registry::instance()->CFG->admin->help_tour_activation
1370
+		) {
1371
+			return;
1372
+		}
1373
+		// loop through _page_config to find any help_tour defined
1374
+		foreach ($this->_page_config as $route => $config) {
1375
+			// we're only going to set things up for this route
1376
+			if ($route !== $this->_req_action) {
1377
+				continue;
1378
+			}
1379
+			if (isset($config['help_tour'])) {
1380
+				foreach ($config['help_tour'] as $tour) {
1381
+					$file_path = $this->_get_dir() . '/help_tours/' . $tour . '.class.php';
1382
+					// let's see if we can get that file...
1383
+					// if not its possible this is a decaf route not set in caffeinated
1384
+					// so lets try and get the caffeinated equivalent
1385
+					$file_path = ! is_readable($file_path) ? EE_ADMIN_PAGES
1386
+															 . basename($this->_get_dir())
1387
+															 . '/help_tours/'
1388
+															 . $tour
1389
+															 . '.class.php' : $file_path;
1390
+					// if file is STILL not readable then let's do a EE_Error so its more graceful than a fatal error.
1391
+					if (! is_readable($file_path)) {
1392
+						EE_Error::add_error(
1393
+							sprintf(
1394
+								esc_html__(
1395
+									'The file path given for the help tour (%s) is not a valid path.  Please check that the string you set for the help tour on this route (%s) is the correct spelling',
1396
+									'event_espresso'
1397
+								),
1398
+								$file_path,
1399
+								$tour
1400
+							),
1401
+							__FILE__,
1402
+							__FUNCTION__,
1403
+							__LINE__
1404
+						);
1405
+						return;
1406
+					}
1407
+					require_once $file_path;
1408
+					if (! class_exists($tour)) {
1409
+						$error_msg = [];
1410
+						$error_msg[] = sprintf(
1411
+							esc_html__('Something went wrong with loading the %s Help Tour Class.', 'event_espresso'),
1412
+							$tour
1413
+						);
1414
+						$error_msg[] = $error_msg[0] . "\r\n"
1415
+									   . sprintf(
1416
+										   esc_html__(
1417
+											   'There is no class in place for the %s help tour.%s Make sure you have <strong>%s</strong> defined in the "help_tour" array for the %s route of the % admin page.',
1418
+											   'event_espresso'
1419
+										   ),
1420
+										   $tour,
1421
+										   '<br />',
1422
+										   $tour,
1423
+										   $this->_req_action,
1424
+										   get_class($this)
1425
+									   );
1426
+						throw new EE_Error(implode('||', $error_msg));
1427
+					}
1428
+					$tour_obj = new $tour($this->_is_caf);
1429
+					$tours[] = $tour_obj;
1430
+					$this->_help_tour[ $route ][] = EEH_Template::help_tour_stops_generator($tour_obj);
1431
+				}
1432
+				// let's inject the end tour stop element common to all pages... this will only get seen once per machine.
1433
+				$end_stop_tour = new EE_Help_Tour_final_stop($this->_is_caf);
1434
+				$tours[] = $end_stop_tour;
1435
+				$this->_help_tour[ $route ][] = EEH_Template::help_tour_stops_generator($end_stop_tour);
1436
+			}
1437
+		}
1438
+
1439
+		if (! empty($tours)) {
1440
+			$this->_help_tour['tours'] = $tours;
1441
+		}
1442
+		// that's it!  Now that the $_help_tours property is set (or not)
1443
+		// the scripts and html should be taken care of automatically.
1444
+
1445
+		/**
1446
+		 * Allow extending the help tours variable.
1447
+		 *
1448
+		 * @param array $_help_tour The array containing all help tour information to be displayed.
1449
+		 */
1450
+		$this->_help_tour = apply_filters('FHEE__EE_Admin_Page___add_help_tour___help_tour', $this->_help_tour);
1451
+	}
1452
+
1453
+
1454
+	/**
1455
+	 * This simply sets up any qtips that have been defined in the page config
1456
+	 *
1457
+	 * @return void
1458
+	 * @throws ReflectionException
1459
+	 * @throws EE_Error
1460
+	 */
1461
+	protected function _add_qtips()
1462
+	{
1463
+		if (isset($this->_route_config['qtips'])) {
1464
+			$qtips = (array) $this->_route_config['qtips'];
1465
+			// load qtip loader
1466
+			$path = array(
1467
+				$this->_get_dir() . '/qtips/',
1468
+				EE_ADMIN_PAGES . basename($this->_get_dir()) . '/qtips/',
1469
+			);
1470
+			$qtip_loader = EEH_Qtip_Loader::instance();
1471
+			if ($qtip_loader instanceof EEH_Qtip_Loader) {
1472
+				$qtip_loader->register($qtips, $path);
1473
+			}
1474
+		}
1475
+	}
1476
+
1477
+
1478
+	/**
1479
+	 * _set_nav_tabs
1480
+	 * This sets up the nav tabs from the page_routes array.  This method can be overwritten by child classes if you
1481
+	 * wish to add additional tabs or modify accordingly.
1482
+	 *
1483
+	 * @return void
1484
+	 * @throws InvalidArgumentException
1485
+	 * @throws InvalidInterfaceException
1486
+	 * @throws InvalidDataTypeException
1487
+	 */
1488
+	protected function _set_nav_tabs()
1489
+	{
1490
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1491
+		$i = 0;
1492
+		foreach ($this->_page_config as $slug => $config) {
1493
+			if (! is_array($config)
1494
+				|| (
1495
+					is_array($config)
1496
+					&& (
1497
+						(isset($config['nav']) && ! $config['nav'])
1498
+						|| ! isset($config['nav'])
1499
+					)
1500
+				)
1501
+			) {
1502
+				continue;
1503
+			}
1504
+			// no nav tab for this config
1505
+			// check for persistent flag
1506
+			if ($slug !== $this->_req_action && isset($config['nav']['persistent']) && ! $config['nav']['persistent']) {
1507
+				// nav tab is only to appear when route requested.
1508
+				continue;
1509
+			}
1510
+			if (! $this->check_user_access($slug, true)) {
1511
+				// no nav tab because current user does not have access.
1512
+				continue;
1513
+			}
1514
+			$css_class = isset($config['css_class']) ? $config['css_class'] . ' ' : '';
1515
+			$this->_nav_tabs[ $slug ] = array(
1516
+				'url'       => isset($config['nav']['url'])
1517
+					? $config['nav']['url']
1518
+					: EE_Admin_Page::add_query_args_and_nonce(
1519
+						array('action' => $slug),
1520
+						$this->_admin_base_url
1521
+					),
1522
+				'link_text' => isset($config['nav']['label'])
1523
+					? $config['nav']['label']
1524
+					: ucwords(
1525
+						str_replace('_', ' ', $slug)
1526
+					),
1527
+				'css_class' => $this->_req_action === $slug ? $css_class . 'nav-tab-active' : $css_class,
1528
+				'order'     => isset($config['nav']['order']) ? $config['nav']['order'] : $i,
1529
+			);
1530
+			$i++;
1531
+		}
1532
+		// if $this->_nav_tabs is empty then lets set the default
1533
+		if (empty($this->_nav_tabs)) {
1534
+			$this->_nav_tabs[ $this->_default_nav_tab_name ] = array(
1535
+				'url'       => $this->_admin_base_url,
1536
+				'link_text' => ucwords(str_replace('_', ' ', $this->_default_nav_tab_name)),
1537
+				'css_class' => 'nav-tab-active',
1538
+				'order'     => 10,
1539
+			);
1540
+		}
1541
+		// now let's sort the tabs according to order
1542
+		usort($this->_nav_tabs, array($this, '_sort_nav_tabs'));
1543
+	}
1544
+
1545
+
1546
+	/**
1547
+	 * _set_current_labels
1548
+	 * This method modifies the _labels property with any optional specific labels indicated in the _page_routes
1549
+	 * property array
1550
+	 *
1551
+	 * @return void
1552
+	 */
1553
+	private function _set_current_labels()
1554
+	{
1555
+		if (is_array($this->_route_config) && isset($this->_route_config['labels'])) {
1556
+			foreach ($this->_route_config['labels'] as $label => $text) {
1557
+				if (is_array($text)) {
1558
+					foreach ($text as $sublabel => $subtext) {
1559
+						$this->_labels[ $label ][ $sublabel ] = $subtext;
1560
+					}
1561
+				} else {
1562
+					$this->_labels[ $label ] = $text;
1563
+				}
1564
+			}
1565
+		}
1566
+	}
1567
+
1568
+
1569
+	/**
1570
+	 *        verifies user access for this admin page
1571
+	 *
1572
+	 * @param string $route_to_check if present then the capability for the route matching this string is checked.
1573
+	 * @param bool   $verify_only    Default is FALSE which means if user check fails then wp_die().  Otherwise just
1574
+	 *                               return false if verify fail.
1575
+	 * @return bool
1576
+	 * @throws InvalidArgumentException
1577
+	 * @throws InvalidDataTypeException
1578
+	 * @throws InvalidInterfaceException
1579
+	 */
1580
+	public function check_user_access($route_to_check = '', $verify_only = false)
1581
+	{
1582
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1583
+		$route_to_check = empty($route_to_check) ? $this->_req_action : $route_to_check;
1584
+		$capability = ! empty($route_to_check) && isset($this->_page_routes[ $route_to_check ])
1585
+					  && is_array(
1586
+						  $this->_page_routes[ $route_to_check ]
1587
+					  )
1588
+					  && ! empty($this->_page_routes[ $route_to_check ]['capability'])
1589
+			? $this->_page_routes[ $route_to_check ]['capability'] : null;
1590
+		if (empty($capability) && empty($route_to_check)) {
1591
+			$capability = is_array($this->_route) && empty($this->_route['capability']) ? 'manage_options'
1592
+				: $this->_route['capability'];
1593
+		} else {
1594
+			$capability = empty($capability) ? 'manage_options' : $capability;
1595
+		}
1596
+		$id = is_array($this->_route) && ! empty($this->_route['obj_id']) ? $this->_route['obj_id'] : 0;
1597
+		if (! defined('DOING_AJAX')
1598
+			&& (
1599
+				! function_exists('is_admin')
1600
+				|| ! EE_Registry::instance()->CAP->current_user_can(
1601
+					$capability,
1602
+					$this->page_slug
1603
+					. '_'
1604
+					. $route_to_check,
1605
+					$id
1606
+				)
1607
+			)
1608
+		) {
1609
+			if ($verify_only) {
1610
+				return false;
1611
+			}
1612
+			if (is_user_logged_in()) {
1613
+				wp_die(__('You do not have access to this route.', 'event_espresso'));
1614
+			} else {
1615
+				return false;
1616
+			}
1617
+		}
1618
+		return true;
1619
+	}
1620
+
1621
+
1622
+	/**
1623
+	 * admin_init_global
1624
+	 * This runs all the code that we want executed within the WP admin_init hook.
1625
+	 * This method executes for ALL EE Admin pages.
1626
+	 *
1627
+	 * @return void
1628
+	 */
1629
+	public function admin_init_global()
1630
+	{
1631
+	}
1632
+
1633
+
1634
+	/**
1635
+	 * wp_loaded_global
1636
+	 * This runs all the code that we want executed within the WP wp_loaded hook.  This method is optional for an
1637
+	 * EE_Admin page and will execute on every EE Admin Page load
1638
+	 *
1639
+	 * @return void
1640
+	 */
1641
+	public function wp_loaded()
1642
+	{
1643
+	}
1644
+
1645
+
1646
+	/**
1647
+	 * admin_notices
1648
+	 * Anything triggered by the 'admin_notices' WP hook should be put in here.  This particular method will apply on
1649
+	 * ALL EE_Admin pages.
1650
+	 *
1651
+	 * @return void
1652
+	 */
1653
+	public function admin_notices_global()
1654
+	{
1655
+		$this->_display_no_javascript_warning();
1656
+		$this->_display_espresso_notices();
1657
+	}
1658
+
1659
+
1660
+	public function network_admin_notices_global()
1661
+	{
1662
+		$this->_display_no_javascript_warning();
1663
+		$this->_display_espresso_notices();
1664
+	}
1665
+
1666
+
1667
+	/**
1668
+	 * admin_footer_scripts_global
1669
+	 * Anything triggered by the 'admin_print_footer_scripts' WP hook should be put in here. This particular method
1670
+	 * will apply on ALL EE_Admin pages.
1671
+	 *
1672
+	 * @return void
1673
+	 */
1674
+	public function admin_footer_scripts_global()
1675
+	{
1676
+		$this->_add_admin_page_ajax_loading_img();
1677
+		$this->_add_admin_page_overlay();
1678
+		// if metaboxes are present we need to add the nonce field
1679
+		if (isset($this->_route_config['metaboxes'])
1680
+			|| isset($this->_route_config['list_table'])
1681
+			|| (isset($this->_route_config['has_metaboxes']) && $this->_route_config['has_metaboxes'])
1682
+		) {
1683
+			wp_nonce_field('closedpostboxes', 'closedpostboxesnonce', false);
1684
+			wp_nonce_field('meta-box-order', 'meta-box-order-nonce', false);
1685
+		}
1686
+	}
1687
+
1688
+
1689
+	/**
1690
+	 * admin_footer_global
1691
+	 * Anything triggered by the wp 'admin_footer' wp hook should be put in here.
1692
+	 * This particular method will apply on ALL EE_Admin Pages.
1693
+	 *
1694
+	 * @return void
1695
+	 * @throws InvalidArgumentException
1696
+	 * @throws InvalidDataTypeException
1697
+	 * @throws InvalidInterfaceException
1698
+	 */
1699
+	public function admin_footer_global()
1700
+	{
1701
+		// dialog container for dialog helper
1702
+		$d_cont = '<div class="ee-admin-dialog-container auto-hide hidden">' . "\n";
1703
+		$d_cont .= '<div class="ee-notices"></div>';
1704
+		$d_cont .= '<div class="ee-admin-dialog-container-inner-content"></div>';
1705
+		$d_cont .= '</div>';
1706
+		echo $d_cont;
1707
+		// help tour stuff?
1708
+		if (isset($this->_help_tour[ $this->_req_action ])) {
1709
+			echo implode('<br />', $this->_help_tour[ $this->_req_action ]);
1710
+		}
1711
+		// current set timezone for timezone js
1712
+		echo '<span id="current_timezone" class="hidden">' . EEH_DTT_Helper::get_timezone() . '</span>';
1713
+	}
1714
+
1715
+
1716
+	/**
1717
+	 * This function sees if there is a method for help popup content existing for the given route.  If there is then
1718
+	 * we'll use the retrieved array to output the content using the template. For child classes: If you want to have
1719
+	 * help popups then in your templates or your content you set "triggers" for the content using the
1720
+	 * "_set_help_trigger('help_trigger_id')" where "help_trigger_id" is what you will use later in your custom method
1721
+	 * for the help popup content on that page. Then in your Child_Admin_Page class you need to define a help popup
1722
+	 * method for the content in the format "_help_popup_content_{route_name}()"  So if you are setting help content
1723
+	 * for the
1724
+	 * 'edit_event' route you should have a method named "_help_popup_content_edit_route". In your defined
1725
+	 * "help_popup_content_..." method.  You must prepare and return an array in the following format array(
1726
+	 *    'help_trigger_id' => array(
1727
+	 *        'title' => esc_html__('localized title for popup', 'event_espresso'),
1728
+	 *        'content' => esc_html__('localized content for popup', 'event_espresso')
1729
+	 *    )
1730
+	 * );
1731
+	 * Then the EE_Admin_Parent will take care of making sure that is setup properly on the correct route.
1732
+	 *
1733
+	 * @param array $help_array
1734
+	 * @param bool  $display
1735
+	 * @return string content
1736
+	 * @throws DomainException
1737
+	 * @throws EE_Error
1738
+	 */
1739
+	protected function _set_help_popup_content($help_array = array(), $display = false)
1740
+	{
1741
+		$content = '';
1742
+		$help_array = empty($help_array) ? $this->_get_help_content() : $help_array;
1743
+		// loop through the array and setup content
1744
+		foreach ($help_array as $trigger => $help) {
1745
+			// make sure the array is setup properly
1746
+			if (! isset($help['title'], $help['content'])) {
1747
+				throw new EE_Error(
1748
+					esc_html__(
1749
+						'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',
1750
+						'event_espresso'
1751
+					)
1752
+				);
1753
+			}
1754
+			// we're good so let'd setup the template vars and then assign parsed template content to our content.
1755
+			$template_args = array(
1756
+				'help_popup_id'      => $trigger,
1757
+				'help_popup_title'   => $help['title'],
1758
+				'help_popup_content' => $help['content'],
1759
+			);
1760
+			$content .= EEH_Template::display_template(
1761
+				EE_ADMIN_TEMPLATE . 'admin_help_popup.template.php',
1762
+				$template_args,
1763
+				true
1764
+			);
1765
+		}
1766
+		if ($display) {
1767
+			echo $content;
1768
+			return '';
1769
+		}
1770
+		return $content;
1771
+	}
1772
+
1773
+
1774
+	/**
1775
+	 * All this does is retrieve the help content array if set by the EE_Admin_Page child
1776
+	 *
1777
+	 * @return array properly formatted array for help popup content
1778
+	 * @throws EE_Error
1779
+	 */
1780
+	private function _get_help_content()
1781
+	{
1782
+		// what is the method we're looking for?
1783
+		$method_name = '_help_popup_content_' . $this->_req_action;
1784
+		// if method doesn't exist let's get out.
1785
+		if (! method_exists($this, $method_name)) {
1786
+			return array();
1787
+		}
1788
+		// k we're good to go let's retrieve the help array
1789
+		$help_array = $this->{$method_name}();
1790
+		// make sure we've got an array!
1791
+		if (! is_array($help_array)) {
1792
+			throw new EE_Error(
1793
+				esc_html__(
1794
+					'Something went wrong with help popup content generation. Expecting an array and well, this ain\'t no array bub.',
1795
+					'event_espresso'
1796
+				)
1797
+			);
1798
+		}
1799
+		return $help_array;
1800
+	}
1801
+
1802
+
1803
+	/**
1804
+	 * EE Admin Pages can use this to set a properly formatted trigger for a help popup.
1805
+	 * By default the trigger html is printed.  Otherwise it can be returned if the $display flag is set "false"
1806
+	 * See comments made on the _set_help_content method for understanding other parts to the help popup tool.
1807
+	 *
1808
+	 * @param string  $trigger_id reference for retrieving the trigger content for the popup
1809
+	 * @param boolean $display    if false then we return the trigger string
1810
+	 * @param array   $dimensions an array of dimensions for the box (array(h,w))
1811
+	 * @return string
1812
+	 * @throws DomainException
1813
+	 * @throws EE_Error
1814
+	 */
1815
+	protected function _set_help_trigger($trigger_id, $display = true, $dimensions = array('400', '640'))
1816
+	{
1817
+		if (defined('DOING_AJAX')) {
1818
+			return '';
1819
+		}
1820
+		// 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
1821
+		$help_array = $this->_get_help_content();
1822
+		$help_content = '';
1823
+		if (empty($help_array) || ! isset($help_array[ $trigger_id ])) {
1824
+			$help_array[ $trigger_id ] = array(
1825
+				'title'   => esc_html__('Missing Content', 'event_espresso'),
1826
+				'content' => esc_html__(
1827
+					'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.)',
1828
+					'event_espresso'
1829
+				),
1830
+			);
1831
+			$help_content = $this->_set_help_popup_content($help_array);
1832
+		}
1833
+		// let's setup the trigger
1834
+		$content = '<a class="ee-dialog" href="?height='
1835
+				   . $dimensions[0]
1836
+				   . '&width='
1837
+				   . $dimensions[1]
1838
+				   . '&inlineId='
1839
+				   . $trigger_id
1840
+				   . '" target="_blank"><span class="question ee-help-popup-question"></span></a>';
1841
+		$content .= $help_content;
1842
+		if ($display) {
1843
+			echo $content;
1844
+			return '';
1845
+		}
1846
+		return $content;
1847
+	}
1848
+
1849
+
1850
+	/**
1851
+	 * _add_global_screen_options
1852
+	 * Add any extra wp_screen_options within this method using built-in WP functions/methods for doing so.
1853
+	 * This particular method will add_screen_options on ALL EE_Admin Pages
1854
+	 *
1855
+	 * @link   http://chrismarslender.com/wp-tutorials/wordpress-screen-options-tutorial/
1856
+	 *         see also WP_Screen object documents...
1857
+	 * @link   http://codex.wordpress.org/Class_Reference/WP_Screen
1858
+	 * @abstract
1859
+	 * @return void
1860
+	 */
1861
+	private function _add_global_screen_options()
1862
+	{
1863
+	}
1864
+
1865
+
1866
+	/**
1867
+	 * _add_global_feature_pointers
1868
+	 * This method is used for implementing any "feature pointers" (using built-in WP styling js).
1869
+	 * This particular method will implement feature pointers for ALL EE_Admin pages.
1870
+	 * Note: this is just a placeholder for now.  Implementation will come down the road
1871
+	 *
1872
+	 * @see    WP_Internal_Pointers class in wp-admin/includes/template.php for example (its a final class so can't be
1873
+	 *         extended) also see:
1874
+	 * @link   http://eamann.com/tech/wordpress-portland/
1875
+	 * @abstract
1876
+	 * @return void
1877
+	 */
1878
+	private function _add_global_feature_pointers()
1879
+	{
1880
+	}
1881
+
1882
+
1883
+	/**
1884
+	 * load_global_scripts_styles
1885
+	 * The scripts and styles enqueued in here will be loaded on every EE Admin page
1886
+	 *
1887
+	 * @return void
1888
+	 * @throws EE_Error
1889
+	 */
1890
+	public function load_global_scripts_styles()
1891
+	{
1892
+		// add debugging styles
1893
+		if (WP_DEBUG) {
1894
+			add_action('admin_head', array($this, 'add_xdebug_style'));
1895
+		}
1896
+		// taking care of metaboxes
1897
+		if (empty($this->_cpt_route)
1898
+			&& (isset($this->_route_config['metaboxes']) || isset($this->_route_config['has_metaboxes']))
1899
+		) {
1900
+			wp_enqueue_script('dashboard');
1901
+		}
1902
+
1903
+		// LOCALIZED DATA
1904
+		// localize script for ajax lazy loading
1905
+		wp_localize_script(
1906
+			EspressoLegacyAdminAssetManager::JS_HANDLE_EE_ADMIN,
1907
+			'eeLazyLoadingContainers',
1908
+			apply_filters(
1909
+				'FHEE__EE_Admin_Page_Core__load_global_scripts_styles__loader_containers',
1910
+				['espresso_news_post_box_content']
1911
+			)
1912
+		);
1913
+		/**
1914
+		 * help tour stuff
1915
+		 */
1916
+		if (EE_Registry::instance()->CFG->admin->help_tour_activation && ! empty($this->_help_tour)) {
1917
+			add_filter('FHEE_load_joyride', '__return_true');
1918
+			$tours = array();
1919
+			// setup tours for the js tour object
1920
+			foreach ($this->_help_tour['tours'] as $tour) {
1921
+				if ($tour instanceof EE_Help_Tour) {
1922
+					$tours[] = array(
1923
+						'id'      => $tour->get_slug(),
1924
+						'options' => $tour->get_options(),
1925
+					);
1926
+				}
1927
+			}
1928
+			wp_localize_script(
1929
+				EspressoLegacyAdminAssetManager::JS_HANDLE_EE_HELP_TOUR,
1930
+				'EE_HELP_TOUR',
1931
+				['tours' => $tours]
1932
+			);
1933
+			// admin_footer_global will take care of making sure our help_tour skeleton gets printed via the info stored in $this->_help_tour
1934
+		}
1935
+	}
1936
+
1937
+
1938
+	/**
1939
+	 *        admin_footer_scripts_eei18n_js_strings
1940
+	 *
1941
+	 * @return        void
1942
+	 */
1943
+	public function admin_footer_scripts_eei18n_js_strings()
1944
+	{
1945
+		EE_Registry::$i18n_js_strings['ajax_url'] = WP_AJAX_URL;
1946
+		EE_Registry::$i18n_js_strings['confirm_delete'] = esc_html__(
1947
+			'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!!!',
1948
+			'event_espresso'
1949
+		);
1950
+		EE_Registry::$i18n_js_strings['January'] = esc_html__('January', 'event_espresso');
1951
+		EE_Registry::$i18n_js_strings['February'] = esc_html__('February', 'event_espresso');
1952
+		EE_Registry::$i18n_js_strings['March'] = esc_html__('March', 'event_espresso');
1953
+		EE_Registry::$i18n_js_strings['April'] = esc_html__('April', 'event_espresso');
1954
+		EE_Registry::$i18n_js_strings['May'] = esc_html__('May', 'event_espresso');
1955
+		EE_Registry::$i18n_js_strings['June'] = esc_html__('June', 'event_espresso');
1956
+		EE_Registry::$i18n_js_strings['July'] = esc_html__('July', 'event_espresso');
1957
+		EE_Registry::$i18n_js_strings['August'] = esc_html__('August', 'event_espresso');
1958
+		EE_Registry::$i18n_js_strings['September'] = esc_html__('September', 'event_espresso');
1959
+		EE_Registry::$i18n_js_strings['October'] = esc_html__('October', 'event_espresso');
1960
+		EE_Registry::$i18n_js_strings['November'] = esc_html__('November', 'event_espresso');
1961
+		EE_Registry::$i18n_js_strings['December'] = esc_html__('December', 'event_espresso');
1962
+		EE_Registry::$i18n_js_strings['Jan'] = esc_html__('Jan', 'event_espresso');
1963
+		EE_Registry::$i18n_js_strings['Feb'] = esc_html__('Feb', 'event_espresso');
1964
+		EE_Registry::$i18n_js_strings['Mar'] = esc_html__('Mar', 'event_espresso');
1965
+		EE_Registry::$i18n_js_strings['Apr'] = esc_html__('Apr', 'event_espresso');
1966
+		EE_Registry::$i18n_js_strings['May'] = esc_html__('May', 'event_espresso');
1967
+		EE_Registry::$i18n_js_strings['Jun'] = esc_html__('Jun', 'event_espresso');
1968
+		EE_Registry::$i18n_js_strings['Jul'] = esc_html__('Jul', 'event_espresso');
1969
+		EE_Registry::$i18n_js_strings['Aug'] = esc_html__('Aug', 'event_espresso');
1970
+		EE_Registry::$i18n_js_strings['Sep'] = esc_html__('Sep', 'event_espresso');
1971
+		EE_Registry::$i18n_js_strings['Oct'] = esc_html__('Oct', 'event_espresso');
1972
+		EE_Registry::$i18n_js_strings['Nov'] = esc_html__('Nov', 'event_espresso');
1973
+		EE_Registry::$i18n_js_strings['Dec'] = esc_html__('Dec', 'event_espresso');
1974
+		EE_Registry::$i18n_js_strings['Sunday'] = esc_html__('Sunday', 'event_espresso');
1975
+		EE_Registry::$i18n_js_strings['Monday'] = esc_html__('Monday', 'event_espresso');
1976
+		EE_Registry::$i18n_js_strings['Tuesday'] = esc_html__('Tuesday', 'event_espresso');
1977
+		EE_Registry::$i18n_js_strings['Wednesday'] = esc_html__('Wednesday', 'event_espresso');
1978
+		EE_Registry::$i18n_js_strings['Thursday'] = esc_html__('Thursday', 'event_espresso');
1979
+		EE_Registry::$i18n_js_strings['Friday'] = esc_html__('Friday', 'event_espresso');
1980
+		EE_Registry::$i18n_js_strings['Saturday'] = esc_html__('Saturday', 'event_espresso');
1981
+		EE_Registry::$i18n_js_strings['Sun'] = esc_html__('Sun', 'event_espresso');
1982
+		EE_Registry::$i18n_js_strings['Mon'] = esc_html__('Mon', 'event_espresso');
1983
+		EE_Registry::$i18n_js_strings['Tue'] = esc_html__('Tue', 'event_espresso');
1984
+		EE_Registry::$i18n_js_strings['Wed'] = esc_html__('Wed', 'event_espresso');
1985
+		EE_Registry::$i18n_js_strings['Thu'] = esc_html__('Thu', 'event_espresso');
1986
+		EE_Registry::$i18n_js_strings['Fri'] = esc_html__('Fri', 'event_espresso');
1987
+		EE_Registry::$i18n_js_strings['Sat'] = esc_html__('Sat', 'event_espresso');
1988
+	}
1989
+
1990
+
1991
+	/**
1992
+	 *        load enhanced xdebug styles for ppl with failing eyesight
1993
+	 *
1994
+	 * @return        void
1995
+	 */
1996
+	public function add_xdebug_style()
1997
+	{
1998
+		echo '<style>.xdebug-error { font-size:1.5em; }</style>';
1999
+	}
2000
+
2001
+
2002
+	/************************/
2003
+	/** LIST TABLE METHODS **/
2004
+	/************************/
2005
+	/**
2006
+	 * this sets up the list table if the current view requires it.
2007
+	 *
2008
+	 * @return void
2009
+	 * @throws EE_Error
2010
+	 * @throws InvalidArgumentException
2011
+	 * @throws InvalidDataTypeException
2012
+	 * @throws InvalidInterfaceException
2013
+	 */
2014
+	protected function _set_list_table()
2015
+	{
2016
+		// first is this a list_table view?
2017
+		if (! isset($this->_route_config['list_table'])) {
2018
+			return;
2019
+		} //not a list_table view so get out.
2020
+		// list table functions are per view specific (because some admin pages might have more than one list table!)
2021
+		$list_table_view = '_set_list_table_views_' . $this->_req_action;
2022
+		if (! method_exists($this, $list_table_view) || $this->{$list_table_view}() === false) {
2023
+			// user error msg
2024
+			$error_msg = esc_html__(
2025
+				'An error occurred. The requested list table views could not be found.',
2026
+				'event_espresso'
2027
+			);
2028
+			// developer error msg
2029
+			$error_msg .= '||'
2030
+						  . sprintf(
2031
+							  esc_html__(
2032
+								  '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.',
2033
+								  'event_espresso'
2034
+							  ),
2035
+							  $this->_req_action,
2036
+							  $list_table_view
2037
+						  );
2038
+			throw new EE_Error($error_msg);
2039
+		}
2040
+		// let's provide the ability to filter the views per PAGE AND ROUTE, per PAGE, and globally
2041
+		$this->_views = apply_filters(
2042
+			'FHEE_list_table_views_' . $this->page_slug . '_' . $this->_req_action,
2043
+			$this->_views
2044
+		);
2045
+		$this->_views = apply_filters('FHEE_list_table_views_' . $this->page_slug, $this->_views);
2046
+		$this->_views = apply_filters('FHEE_list_table_views', $this->_views);
2047
+		$this->_set_list_table_view();
2048
+		$this->_set_list_table_object();
2049
+	}
2050
+
2051
+
2052
+	/**
2053
+	 * set current view for List Table
2054
+	 *
2055
+	 * @return void
2056
+	 */
2057
+	protected function _set_list_table_view()
2058
+	{
2059
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2060
+		// looking at active items or dumpster diving ?
2061
+		if (! isset($this->_req_data['status']) || ! array_key_exists($this->_req_data['status'], $this->_views)) {
2062
+			$this->_view = isset($this->_views['in_use']) ? 'in_use' : 'all';
2063
+		} else {
2064
+			$this->_view = sanitize_key($this->_req_data['status']);
2065
+		}
2066
+	}
2067
+
2068
+
2069
+	/**
2070
+	 * _set_list_table_object
2071
+	 * WP_List_Table objects need to be loaded fairly early so automatic stuff WP does is taken care of.
2072
+	 *
2073
+	 * @throws InvalidInterfaceException
2074
+	 * @throws InvalidArgumentException
2075
+	 * @throws InvalidDataTypeException
2076
+	 * @throws EE_Error
2077
+	 * @throws InvalidInterfaceException
2078
+	 */
2079
+	protected function _set_list_table_object()
2080
+	{
2081
+		if (isset($this->_route_config['list_table'])) {
2082
+			if (! class_exists($this->_route_config['list_table'])) {
2083
+				throw new EE_Error(
2084
+					sprintf(
2085
+						esc_html__(
2086
+							'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.',
2087
+							'event_espresso'
2088
+						),
2089
+						$this->_route_config['list_table'],
2090
+						get_class($this)
2091
+					)
2092
+				);
2093
+			}
2094
+			$this->_list_table_object = $this->loader->getShared(
2095
+				$this->_route_config['list_table'],
2096
+				array($this)
2097
+			);
2098
+		}
2099
+	}
2100
+
2101
+
2102
+	/**
2103
+	 * get_list_table_view_RLs - get it? View RL ?? VU-RL???  URL ??
2104
+	 *
2105
+	 * @param array $extra_query_args                     Optional. An array of extra query args to add to the generated
2106
+	 *                                                    urls.  The array should be indexed by the view it is being
2107
+	 *                                                    added to.
2108
+	 * @return array
2109
+	 */
2110
+	public function get_list_table_view_RLs($extra_query_args = array())
2111
+	{
2112
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2113
+		if (empty($this->_views)) {
2114
+			$this->_views = array();
2115
+		}
2116
+		// cycle thru views
2117
+		foreach ($this->_views as $key => $view) {
2118
+			$query_args = array();
2119
+			// check for current view
2120
+			$this->_views[ $key ]['class'] = $this->_view === $view['slug'] ? 'current' : '';
2121
+			$query_args['action'] = $this->_req_action;
2122
+			$query_args[ $this->_req_action . '_nonce' ] = wp_create_nonce($query_args['action'] . '_nonce');
2123
+			$query_args['status'] = $view['slug'];
2124
+			// merge any other arguments sent in.
2125
+			if (isset($extra_query_args[ $view['slug'] ])) {
2126
+				foreach ($extra_query_args[ $view['slug'] ] as $extra_query_arg) {
2127
+					$query_args[] = $extra_query_arg;
2128
+				}
2129
+			}
2130
+			$this->_views[ $key ]['url'] = EE_Admin_Page::add_query_args_and_nonce($query_args, $this->_admin_base_url);
2131
+		}
2132
+		return $this->_views;
2133
+	}
2134
+
2135
+
2136
+	/**
2137
+	 * _entries_per_page_dropdown
2138
+	 * generates a drop down box for selecting the number of visible rows in an admin page list table
2139
+	 *
2140
+	 * @todo   : Note: ideally this should be added to the screen options dropdown as that would be consistent with how
2141
+	 *         WP does it.
2142
+	 * @param int $max_entries total number of rows in the table
2143
+	 * @return string
2144
+	 */
2145
+	protected function _entries_per_page_dropdown($max_entries = 0)
2146
+	{
2147
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2148
+		$values = array(10, 25, 50, 100);
2149
+		$per_page = (! empty($this->_req_data['per_page'])) ? absint($this->_req_data['per_page']) : 10;
2150
+		if ($max_entries) {
2151
+			$values[] = $max_entries;
2152
+			sort($values);
2153
+		}
2154
+		$entries_per_page_dropdown = '
2155 2155
 			<div id="entries-per-page-dv" class="alignleft actions">
2156 2156
 				<label class="hide-if-no-js">
2157 2157
 					Show
2158 2158
 					<select id="entries-per-page-slct" name="entries-per-page-slct">';
2159
-        foreach ($values as $value) {
2160
-            if ($value < $max_entries) {
2161
-                $selected = $value === $per_page ? ' selected="' . $per_page . '"' : '';
2162
-                $entries_per_page_dropdown .= '
2159
+		foreach ($values as $value) {
2160
+			if ($value < $max_entries) {
2161
+				$selected = $value === $per_page ? ' selected="' . $per_page . '"' : '';
2162
+				$entries_per_page_dropdown .= '
2163 2163
 						<option value="' . $value . '"' . $selected . '>' . $value . '&nbsp;&nbsp;</option>';
2164
-            }
2165
-        }
2166
-        $selected = $max_entries === $per_page ? ' selected="' . $per_page . '"' : '';
2167
-        $entries_per_page_dropdown .= '
2164
+			}
2165
+		}
2166
+		$selected = $max_entries === $per_page ? ' selected="' . $per_page . '"' : '';
2167
+		$entries_per_page_dropdown .= '
2168 2168
 						<option value="' . $max_entries . '"' . $selected . '>All&nbsp;&nbsp;</option>';
2169
-        $entries_per_page_dropdown .= '
2169
+		$entries_per_page_dropdown .= '
2170 2170
 					</select>
2171 2171
 					entries
2172 2172
 				</label>
2173 2173
 				<input id="entries-per-page-btn" class="button-secondary" type="submit" value="Go" >
2174 2174
 			</div>
2175 2175
 		';
2176
-        return $entries_per_page_dropdown;
2177
-    }
2178
-
2179
-
2180
-    /**
2181
-     *        _set_search_attributes
2182
-     *
2183
-     * @return        void
2184
-     */
2185
-    public function _set_search_attributes()
2186
-    {
2187
-        $this->_template_args['search']['btn_label'] = sprintf(
2188
-            esc_html__('Search %s', 'event_espresso'),
2189
-            empty($this->_search_btn_label) ? $this->page_label
2190
-                : $this->_search_btn_label
2191
-        );
2192
-        $this->_template_args['search']['callback'] = 'search_' . $this->page_slug;
2193
-    }
2194
-
2195
-
2196
-
2197
-    /*** END LIST TABLE METHODS **/
2198
-
2199
-
2200
-    /**
2201
-     * _add_registered_metaboxes
2202
-     *  this loads any registered metaboxes via the 'metaboxes' index in the _page_config property array.
2203
-     *
2204
-     * @link   http://codex.wordpress.org/Function_Reference/add_meta_box
2205
-     * @return void
2206
-     * @throws EE_Error
2207
-     */
2208
-    private function _add_registered_meta_boxes()
2209
-    {
2210
-        do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2211
-        // we only add meta boxes if the page_route calls for it
2212
-        if (is_array($this->_route_config) && isset($this->_route_config['metaboxes'])
2213
-            && is_array(
2214
-                $this->_route_config['metaboxes']
2215
-            )
2216
-        ) {
2217
-            // this simply loops through the callbacks provided
2218
-            // and checks if there is a corresponding callback registered by the child
2219
-            // if there is then we go ahead and process the metabox loader.
2220
-            foreach ($this->_route_config['metaboxes'] as $metabox_callback) {
2221
-                // first check for Closures
2222
-                if ($metabox_callback instanceof Closure) {
2223
-                    $result = $metabox_callback();
2224
-                } elseif (is_array($metabox_callback) && isset($metabox_callback[0], $metabox_callback[1])) {
2225
-                    $result = call_user_func(array($metabox_callback[0], $metabox_callback[1]));
2226
-                } else {
2227
-                    $result = $this->{$metabox_callback}();
2228
-                }
2229
-                if ($result === false) {
2230
-                    // user error msg
2231
-                    $error_msg = esc_html__(
2232
-                        'An error occurred. The  requested metabox could not be found.',
2233
-                        'event_espresso'
2234
-                    );
2235
-                    // developer error msg
2236
-                    $error_msg .= '||'
2237
-                                  . sprintf(
2238
-                                      esc_html__(
2239
-                                          '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.',
2240
-                                          'event_espresso'
2241
-                                      ),
2242
-                                      $metabox_callback
2243
-                                  );
2244
-                    throw new EE_Error($error_msg);
2245
-                }
2246
-            }
2247
-        }
2248
-    }
2249
-
2250
-
2251
-    /**
2252
-     * _add_screen_columns
2253
-     * This will check the _page_config array and if there is "columns" key index indicated, we'll set the template as
2254
-     * the dynamic column template and we'll setup the column options for the page.
2255
-     *
2256
-     * @return void
2257
-     */
2258
-    private function _add_screen_columns()
2259
-    {
2260
-        if (is_array($this->_route_config)
2261
-            && isset($this->_route_config['columns'])
2262
-            && is_array($this->_route_config['columns'])
2263
-            && count($this->_route_config['columns']) === 2
2264
-        ) {
2265
-            add_screen_option(
2266
-                'layout_columns',
2267
-                array(
2268
-                    'max'     => (int) $this->_route_config['columns'][0],
2269
-                    'default' => (int) $this->_route_config['columns'][1],
2270
-                )
2271
-            );
2272
-            $this->_template_args['num_columns'] = $this->_route_config['columns'][0];
2273
-            $screen_id = $this->_current_screen->id;
2274
-            $screen_columns = (int) get_user_option("screen_layout_{$screen_id}");
2275
-            $total_columns = ! empty($screen_columns)
2276
-                ? $screen_columns
2277
-                : $this->_route_config['columns'][1];
2278
-            $this->_template_args['current_screen_widget_class'] = 'columns-' . $total_columns;
2279
-            $this->_template_args['current_page'] = $this->_wp_page_slug;
2280
-            $this->_template_args['screen'] = $this->_current_screen;
2281
-            $this->_column_template_path = EE_ADMIN_TEMPLATE
2282
-                                           . 'admin_details_metabox_column_wrapper.template.php';
2283
-            // finally if we don't have has_metaboxes set in the route config
2284
-            // let's make sure it IS set other wise the necessary hidden fields for this won't be loaded.
2285
-            $this->_route_config['has_metaboxes'] = true;
2286
-        }
2287
-    }
2288
-
2289
-
2290
-
2291
-    /** GLOBALLY AVAILABLE METABOXES **/
2292
-
2293
-
2294
-    /**
2295
-     * In this section we put any globally available EE metaboxes for all EE Admin pages.  They are called by simply
2296
-     * referencing the callback in the _page_config array property.  This way you can be very specific about what pages
2297
-     * these get loaded on.
2298
-     */
2299
-    private function _espresso_news_post_box()
2300
-    {
2301
-        $news_box_title = apply_filters(
2302
-            'FHEE__EE_Admin_Page___espresso_news_post_box__news_box_title',
2303
-            esc_html__('New @ Event Espresso', 'event_espresso')
2304
-        );
2305
-        add_meta_box(
2306
-            'espresso_news_post_box',
2307
-            $news_box_title,
2308
-            array(
2309
-                $this,
2310
-                'espresso_news_post_box',
2311
-            ),
2312
-            $this->_wp_page_slug,
2313
-            'side'
2314
-        );
2315
-    }
2316
-
2317
-
2318
-    /**
2319
-     * Code for setting up espresso ratings request metabox.
2320
-     */
2321
-    protected function _espresso_ratings_request()
2322
-    {
2323
-        if (! apply_filters('FHEE_show_ratings_request_meta_box', true)) {
2324
-            return;
2325
-        }
2326
-        $ratings_box_title = apply_filters(
2327
-            'FHEE__EE_Admin_Page___espresso_news_post_box__news_box_title',
2328
-            esc_html__('Keep Event Espresso Decaf Free', 'event_espresso')
2329
-        );
2330
-        add_meta_box(
2331
-            'espresso_ratings_request',
2332
-            $ratings_box_title,
2333
-            array(
2334
-                $this,
2335
-                'espresso_ratings_request',
2336
-            ),
2337
-            $this->_wp_page_slug,
2338
-            'side'
2339
-        );
2340
-    }
2341
-
2342
-
2343
-    /**
2344
-     * Code for setting up espresso ratings request metabox content.
2345
-     *
2346
-     * @throws DomainException
2347
-     */
2348
-    public function espresso_ratings_request()
2349
-    {
2350
-        EEH_Template::display_template(EE_ADMIN_TEMPLATE . 'espresso_ratings_request_content.template.php');
2351
-    }
2352
-
2353
-
2354
-    public static function cached_rss_display($rss_id, $url)
2355
-    {
2356
-        $loading = '<p class="widget-loading hide-if-no-js">'
2357
-                   . __('Loading&#8230;', 'event_espresso')
2358
-                   . '</p><p class="hide-if-js">'
2359
-                   . esc_html__('This widget requires JavaScript.', 'event_espresso')
2360
-                   . '</p>';
2361
-        $pre = '<div class="espresso-rss-display">' . "\n\t";
2362
-        $pre .= '<span id="' . $rss_id . '_url" class="hidden">' . $url . '</span>';
2363
-        $post = '</div>' . "\n";
2364
-        $cache_key = 'ee_rss_' . md5($rss_id);
2365
-        $output = get_transient($cache_key);
2366
-        if ($output !== false) {
2367
-            echo $pre . $output . $post;
2368
-            return true;
2369
-        }
2370
-        if (! (defined('DOING_AJAX') && DOING_AJAX)) {
2371
-            echo $pre . $loading . $post;
2372
-            return false;
2373
-        }
2374
-        ob_start();
2375
-        wp_widget_rss_output($url, array('show_date' => 0, 'items' => 5));
2376
-        set_transient($cache_key, ob_get_flush(), 12 * HOUR_IN_SECONDS);
2377
-        return true;
2378
-    }
2379
-
2380
-
2381
-    public function espresso_news_post_box()
2382
-    {
2383
-        ?>
2176
+		return $entries_per_page_dropdown;
2177
+	}
2178
+
2179
+
2180
+	/**
2181
+	 *        _set_search_attributes
2182
+	 *
2183
+	 * @return        void
2184
+	 */
2185
+	public function _set_search_attributes()
2186
+	{
2187
+		$this->_template_args['search']['btn_label'] = sprintf(
2188
+			esc_html__('Search %s', 'event_espresso'),
2189
+			empty($this->_search_btn_label) ? $this->page_label
2190
+				: $this->_search_btn_label
2191
+		);
2192
+		$this->_template_args['search']['callback'] = 'search_' . $this->page_slug;
2193
+	}
2194
+
2195
+
2196
+
2197
+	/*** END LIST TABLE METHODS **/
2198
+
2199
+
2200
+	/**
2201
+	 * _add_registered_metaboxes
2202
+	 *  this loads any registered metaboxes via the 'metaboxes' index in the _page_config property array.
2203
+	 *
2204
+	 * @link   http://codex.wordpress.org/Function_Reference/add_meta_box
2205
+	 * @return void
2206
+	 * @throws EE_Error
2207
+	 */
2208
+	private function _add_registered_meta_boxes()
2209
+	{
2210
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2211
+		// we only add meta boxes if the page_route calls for it
2212
+		if (is_array($this->_route_config) && isset($this->_route_config['metaboxes'])
2213
+			&& is_array(
2214
+				$this->_route_config['metaboxes']
2215
+			)
2216
+		) {
2217
+			// this simply loops through the callbacks provided
2218
+			// and checks if there is a corresponding callback registered by the child
2219
+			// if there is then we go ahead and process the metabox loader.
2220
+			foreach ($this->_route_config['metaboxes'] as $metabox_callback) {
2221
+				// first check for Closures
2222
+				if ($metabox_callback instanceof Closure) {
2223
+					$result = $metabox_callback();
2224
+				} elseif (is_array($metabox_callback) && isset($metabox_callback[0], $metabox_callback[1])) {
2225
+					$result = call_user_func(array($metabox_callback[0], $metabox_callback[1]));
2226
+				} else {
2227
+					$result = $this->{$metabox_callback}();
2228
+				}
2229
+				if ($result === false) {
2230
+					// user error msg
2231
+					$error_msg = esc_html__(
2232
+						'An error occurred. The  requested metabox could not be found.',
2233
+						'event_espresso'
2234
+					);
2235
+					// developer error msg
2236
+					$error_msg .= '||'
2237
+								  . sprintf(
2238
+									  esc_html__(
2239
+										  '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.',
2240
+										  'event_espresso'
2241
+									  ),
2242
+									  $metabox_callback
2243
+								  );
2244
+					throw new EE_Error($error_msg);
2245
+				}
2246
+			}
2247
+		}
2248
+	}
2249
+
2250
+
2251
+	/**
2252
+	 * _add_screen_columns
2253
+	 * This will check the _page_config array and if there is "columns" key index indicated, we'll set the template as
2254
+	 * the dynamic column template and we'll setup the column options for the page.
2255
+	 *
2256
+	 * @return void
2257
+	 */
2258
+	private function _add_screen_columns()
2259
+	{
2260
+		if (is_array($this->_route_config)
2261
+			&& isset($this->_route_config['columns'])
2262
+			&& is_array($this->_route_config['columns'])
2263
+			&& count($this->_route_config['columns']) === 2
2264
+		) {
2265
+			add_screen_option(
2266
+				'layout_columns',
2267
+				array(
2268
+					'max'     => (int) $this->_route_config['columns'][0],
2269
+					'default' => (int) $this->_route_config['columns'][1],
2270
+				)
2271
+			);
2272
+			$this->_template_args['num_columns'] = $this->_route_config['columns'][0];
2273
+			$screen_id = $this->_current_screen->id;
2274
+			$screen_columns = (int) get_user_option("screen_layout_{$screen_id}");
2275
+			$total_columns = ! empty($screen_columns)
2276
+				? $screen_columns
2277
+				: $this->_route_config['columns'][1];
2278
+			$this->_template_args['current_screen_widget_class'] = 'columns-' . $total_columns;
2279
+			$this->_template_args['current_page'] = $this->_wp_page_slug;
2280
+			$this->_template_args['screen'] = $this->_current_screen;
2281
+			$this->_column_template_path = EE_ADMIN_TEMPLATE
2282
+										   . 'admin_details_metabox_column_wrapper.template.php';
2283
+			// finally if we don't have has_metaboxes set in the route config
2284
+			// let's make sure it IS set other wise the necessary hidden fields for this won't be loaded.
2285
+			$this->_route_config['has_metaboxes'] = true;
2286
+		}
2287
+	}
2288
+
2289
+
2290
+
2291
+	/** GLOBALLY AVAILABLE METABOXES **/
2292
+
2293
+
2294
+	/**
2295
+	 * In this section we put any globally available EE metaboxes for all EE Admin pages.  They are called by simply
2296
+	 * referencing the callback in the _page_config array property.  This way you can be very specific about what pages
2297
+	 * these get loaded on.
2298
+	 */
2299
+	private function _espresso_news_post_box()
2300
+	{
2301
+		$news_box_title = apply_filters(
2302
+			'FHEE__EE_Admin_Page___espresso_news_post_box__news_box_title',
2303
+			esc_html__('New @ Event Espresso', 'event_espresso')
2304
+		);
2305
+		add_meta_box(
2306
+			'espresso_news_post_box',
2307
+			$news_box_title,
2308
+			array(
2309
+				$this,
2310
+				'espresso_news_post_box',
2311
+			),
2312
+			$this->_wp_page_slug,
2313
+			'side'
2314
+		);
2315
+	}
2316
+
2317
+
2318
+	/**
2319
+	 * Code for setting up espresso ratings request metabox.
2320
+	 */
2321
+	protected function _espresso_ratings_request()
2322
+	{
2323
+		if (! apply_filters('FHEE_show_ratings_request_meta_box', true)) {
2324
+			return;
2325
+		}
2326
+		$ratings_box_title = apply_filters(
2327
+			'FHEE__EE_Admin_Page___espresso_news_post_box__news_box_title',
2328
+			esc_html__('Keep Event Espresso Decaf Free', 'event_espresso')
2329
+		);
2330
+		add_meta_box(
2331
+			'espresso_ratings_request',
2332
+			$ratings_box_title,
2333
+			array(
2334
+				$this,
2335
+				'espresso_ratings_request',
2336
+			),
2337
+			$this->_wp_page_slug,
2338
+			'side'
2339
+		);
2340
+	}
2341
+
2342
+
2343
+	/**
2344
+	 * Code for setting up espresso ratings request metabox content.
2345
+	 *
2346
+	 * @throws DomainException
2347
+	 */
2348
+	public function espresso_ratings_request()
2349
+	{
2350
+		EEH_Template::display_template(EE_ADMIN_TEMPLATE . 'espresso_ratings_request_content.template.php');
2351
+	}
2352
+
2353
+
2354
+	public static function cached_rss_display($rss_id, $url)
2355
+	{
2356
+		$loading = '<p class="widget-loading hide-if-no-js">'
2357
+				   . __('Loading&#8230;', 'event_espresso')
2358
+				   . '</p><p class="hide-if-js">'
2359
+				   . esc_html__('This widget requires JavaScript.', 'event_espresso')
2360
+				   . '</p>';
2361
+		$pre = '<div class="espresso-rss-display">' . "\n\t";
2362
+		$pre .= '<span id="' . $rss_id . '_url" class="hidden">' . $url . '</span>';
2363
+		$post = '</div>' . "\n";
2364
+		$cache_key = 'ee_rss_' . md5($rss_id);
2365
+		$output = get_transient($cache_key);
2366
+		if ($output !== false) {
2367
+			echo $pre . $output . $post;
2368
+			return true;
2369
+		}
2370
+		if (! (defined('DOING_AJAX') && DOING_AJAX)) {
2371
+			echo $pre . $loading . $post;
2372
+			return false;
2373
+		}
2374
+		ob_start();
2375
+		wp_widget_rss_output($url, array('show_date' => 0, 'items' => 5));
2376
+		set_transient($cache_key, ob_get_flush(), 12 * HOUR_IN_SECONDS);
2377
+		return true;
2378
+	}
2379
+
2380
+
2381
+	public function espresso_news_post_box()
2382
+	{
2383
+		?>
2384 2384
         <div class="padding">
2385 2385
             <div id="espresso_news_post_box_content" class="infolinks">
2386 2386
                 <?php
2387
-                // Get RSS Feed(s)
2388
-                EE_Admin_Page::cached_rss_display(
2389
-                    'espresso_news_post_box_content',
2390
-                    urlencode(
2391
-                        apply_filters(
2392
-                            'FHEE__EE_Admin_Page__espresso_news_post_box__feed_url',
2393
-                            'http://eventespresso.com/feed/'
2394
-                        )
2395
-                    )
2396
-                );
2397
-                ?>
2387
+				// Get RSS Feed(s)
2388
+				EE_Admin_Page::cached_rss_display(
2389
+					'espresso_news_post_box_content',
2390
+					urlencode(
2391
+						apply_filters(
2392
+							'FHEE__EE_Admin_Page__espresso_news_post_box__feed_url',
2393
+							'http://eventespresso.com/feed/'
2394
+						)
2395
+					)
2396
+				);
2397
+				?>
2398 2398
             </div>
2399 2399
             <?php do_action('AHEE__EE_Admin_Page__espresso_news_post_box__after_content'); ?>
2400 2400
         </div>
2401 2401
         <?php
2402
-    }
2403
-
2404
-
2405
-    private function _espresso_links_post_box()
2406
-    {
2407
-        // Hiding until we actually have content to put in here...
2408
-        // 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');
2409
-    }
2410
-
2411
-
2412
-    public function espresso_links_post_box()
2413
-    {
2414
-        // Hiding until we actually have content to put in here...
2415
-        // EEH_Template::display_template(
2416
-        //     EE_ADMIN_TEMPLATE . 'admin_general_metabox_contents_espresso_links.template.php'
2417
-        // );
2418
-    }
2419
-
2420
-
2421
-    protected function _espresso_sponsors_post_box()
2422
-    {
2423
-        if (apply_filters('FHEE_show_sponsors_meta_box', true)) {
2424
-            add_meta_box(
2425
-                'espresso_sponsors_post_box',
2426
-                esc_html__('Event Espresso Highlights', 'event_espresso'),
2427
-                array($this, 'espresso_sponsors_post_box'),
2428
-                $this->_wp_page_slug,
2429
-                'side'
2430
-            );
2431
-        }
2432
-    }
2433
-
2434
-
2435
-    public function espresso_sponsors_post_box()
2436
-    {
2437
-        EEH_Template::display_template(
2438
-            EE_ADMIN_TEMPLATE . 'admin_general_metabox_contents_espresso_sponsors.template.php'
2439
-        );
2440
-    }
2441
-
2442
-
2443
-    private function _publish_post_box()
2444
-    {
2445
-        $meta_box_ref = 'espresso_' . $this->page_slug . '_editor_overview';
2446
-        // if there is a array('label' => array('publishbox' => 'some title') ) present in the _page_config array
2447
-        // then we'll use that for the metabox label.
2448
-        // Otherwise we'll just use publish (publishbox itself could be an array of labels indexed by routes)
2449
-        if (! empty($this->_labels['publishbox'])) {
2450
-            $box_label = is_array($this->_labels['publishbox']) ? $this->_labels['publishbox'][ $this->_req_action ]
2451
-                : $this->_labels['publishbox'];
2452
-        } else {
2453
-            $box_label = esc_html__('Publish', 'event_espresso');
2454
-        }
2455
-        $box_label = apply_filters(
2456
-            'FHEE__EE_Admin_Page___publish_post_box__box_label',
2457
-            $box_label,
2458
-            $this->_req_action,
2459
-            $this
2460
-        );
2461
-        add_meta_box(
2462
-            $meta_box_ref,
2463
-            $box_label,
2464
-            array($this, 'editor_overview'),
2465
-            $this->_current_screen->id,
2466
-            'side',
2467
-            'high'
2468
-        );
2469
-    }
2470
-
2471
-
2472
-    public function editor_overview()
2473
-    {
2474
-        // if we have extra content set let's add it in if not make sure its empty
2475
-        $this->_template_args['publish_box_extra_content'] = isset($this->_template_args['publish_box_extra_content'])
2476
-            ? $this->_template_args['publish_box_extra_content']
2477
-            : '';
2478
-        echo EEH_Template::display_template(
2479
-            EE_ADMIN_TEMPLATE . 'admin_details_publish_metabox.template.php',
2480
-            $this->_template_args,
2481
-            true
2482
-        );
2483
-    }
2484
-
2485
-
2486
-    /** end of globally available metaboxes section **/
2487
-
2488
-
2489
-    /**
2490
-     * Public wrapper for the protected method.  Allows plugins/addons to externally call the
2491
-     * protected method.
2492
-     *
2493
-     * @see   $this->_set_publish_post_box_vars for param details
2494
-     * @since 4.6.0
2495
-     * @param string $name
2496
-     * @param int    $id
2497
-     * @param bool   $delete
2498
-     * @param string $save_close_redirect_URL
2499
-     * @param bool   $both_btns
2500
-     * @throws EE_Error
2501
-     * @throws InvalidArgumentException
2502
-     * @throws InvalidDataTypeException
2503
-     * @throws InvalidInterfaceException
2504
-     */
2505
-    public function set_publish_post_box_vars(
2506
-        $name = '',
2507
-        $id = 0,
2508
-        $delete = false,
2509
-        $save_close_redirect_URL = '',
2510
-        $both_btns = true
2511
-    ) {
2512
-        $this->_set_publish_post_box_vars(
2513
-            $name,
2514
-            $id,
2515
-            $delete,
2516
-            $save_close_redirect_URL,
2517
-            $both_btns
2518
-        );
2519
-    }
2520
-
2521
-
2522
-    /**
2523
-     * Sets the _template_args arguments used by the _publish_post_box shortcut
2524
-     * Note: currently there is no validation for this.  However if you want the delete button, the
2525
-     * save, and save and close buttons to work properly, then you will want to include a
2526
-     * values for the name and id arguments.
2527
-     *
2528
-     * @todo  Add in validation for name/id arguments.
2529
-     * @param    string  $name                    key used for the action ID (i.e. event_id)
2530
-     * @param    int     $id                      id attached to the item published
2531
-     * @param    string  $delete                  page route callback for the delete action
2532
-     * @param    string  $save_close_redirect_URL custom URL to redirect to after Save & Close has been completed
2533
-     * @param    boolean $both_btns               whether to display BOTH the "Save & Close" and "Save" buttons or just
2534
-     *                                            the Save button
2535
-     * @throws EE_Error
2536
-     * @throws InvalidArgumentException
2537
-     * @throws InvalidDataTypeException
2538
-     * @throws InvalidInterfaceException
2539
-     */
2540
-    protected function _set_publish_post_box_vars(
2541
-        $name = '',
2542
-        $id = 0,
2543
-        $delete = '',
2544
-        $save_close_redirect_URL = '',
2545
-        $both_btns = true
2546
-    ) {
2547
-        // if Save & Close, use a custom redirect URL or default to the main page?
2548
-        $save_close_redirect_URL = ! empty($save_close_redirect_URL)
2549
-            ? $save_close_redirect_URL
2550
-            : $this->_admin_base_url;
2551
-        // create the Save & Close and Save buttons
2552
-        $this->_set_save_buttons($both_btns, array(), array(), $save_close_redirect_URL);
2553
-        // if we have extra content set let's add it in if not make sure its empty
2554
-        $this->_template_args['publish_box_extra_content'] = isset($this->_template_args['publish_box_extra_content'])
2555
-            ? $this->_template_args['publish_box_extra_content']
2556
-            : '';
2557
-        if ($delete && ! empty($id)) {
2558
-            // make sure we have a default if just true is sent.
2559
-            $delete = ! empty($delete) ? $delete : 'delete';
2560
-            $delete_link_args = array($name => $id);
2561
-            $delete = $this->get_action_link_or_button(
2562
-                $delete,
2563
-                $delete,
2564
-                $delete_link_args,
2565
-                'submitdelete deletion'
2566
-            );
2567
-        }
2568
-        $this->_template_args['publish_delete_link'] = ! empty($id) ? $delete : '';
2569
-        if (! empty($name) && ! empty($id)) {
2570
-            $hidden_field_arr[ $name ] = array(
2571
-                'type'  => 'hidden',
2572
-                'value' => $id,
2573
-            );
2574
-            $hf = $this->_generate_admin_form_fields($hidden_field_arr, 'array');
2575
-        } else {
2576
-            $hf = '';
2577
-        }
2578
-        // add hidden field
2579
-        $this->_template_args['publish_hidden_fields'] = is_array($hf) && ! empty($name)
2580
-            ? $hf[ $name ]['field']
2581
-            : $hf;
2582
-    }
2583
-
2584
-
2585
-    /**
2586
-     * displays an error message to ppl who have javascript disabled
2587
-     *
2588
-     * @return void
2589
-     */
2590
-    private function _display_no_javascript_warning()
2591
-    {
2592
-        ?>
2402
+	}
2403
+
2404
+
2405
+	private function _espresso_links_post_box()
2406
+	{
2407
+		// Hiding until we actually have content to put in here...
2408
+		// 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');
2409
+	}
2410
+
2411
+
2412
+	public function espresso_links_post_box()
2413
+	{
2414
+		// Hiding until we actually have content to put in here...
2415
+		// EEH_Template::display_template(
2416
+		//     EE_ADMIN_TEMPLATE . 'admin_general_metabox_contents_espresso_links.template.php'
2417
+		// );
2418
+	}
2419
+
2420
+
2421
+	protected function _espresso_sponsors_post_box()
2422
+	{
2423
+		if (apply_filters('FHEE_show_sponsors_meta_box', true)) {
2424
+			add_meta_box(
2425
+				'espresso_sponsors_post_box',
2426
+				esc_html__('Event Espresso Highlights', 'event_espresso'),
2427
+				array($this, 'espresso_sponsors_post_box'),
2428
+				$this->_wp_page_slug,
2429
+				'side'
2430
+			);
2431
+		}
2432
+	}
2433
+
2434
+
2435
+	public function espresso_sponsors_post_box()
2436
+	{
2437
+		EEH_Template::display_template(
2438
+			EE_ADMIN_TEMPLATE . 'admin_general_metabox_contents_espresso_sponsors.template.php'
2439
+		);
2440
+	}
2441
+
2442
+
2443
+	private function _publish_post_box()
2444
+	{
2445
+		$meta_box_ref = 'espresso_' . $this->page_slug . '_editor_overview';
2446
+		// if there is a array('label' => array('publishbox' => 'some title') ) present in the _page_config array
2447
+		// then we'll use that for the metabox label.
2448
+		// Otherwise we'll just use publish (publishbox itself could be an array of labels indexed by routes)
2449
+		if (! empty($this->_labels['publishbox'])) {
2450
+			$box_label = is_array($this->_labels['publishbox']) ? $this->_labels['publishbox'][ $this->_req_action ]
2451
+				: $this->_labels['publishbox'];
2452
+		} else {
2453
+			$box_label = esc_html__('Publish', 'event_espresso');
2454
+		}
2455
+		$box_label = apply_filters(
2456
+			'FHEE__EE_Admin_Page___publish_post_box__box_label',
2457
+			$box_label,
2458
+			$this->_req_action,
2459
+			$this
2460
+		);
2461
+		add_meta_box(
2462
+			$meta_box_ref,
2463
+			$box_label,
2464
+			array($this, 'editor_overview'),
2465
+			$this->_current_screen->id,
2466
+			'side',
2467
+			'high'
2468
+		);
2469
+	}
2470
+
2471
+
2472
+	public function editor_overview()
2473
+	{
2474
+		// if we have extra content set let's add it in if not make sure its empty
2475
+		$this->_template_args['publish_box_extra_content'] = isset($this->_template_args['publish_box_extra_content'])
2476
+			? $this->_template_args['publish_box_extra_content']
2477
+			: '';
2478
+		echo EEH_Template::display_template(
2479
+			EE_ADMIN_TEMPLATE . 'admin_details_publish_metabox.template.php',
2480
+			$this->_template_args,
2481
+			true
2482
+		);
2483
+	}
2484
+
2485
+
2486
+	/** end of globally available metaboxes section **/
2487
+
2488
+
2489
+	/**
2490
+	 * Public wrapper for the protected method.  Allows plugins/addons to externally call the
2491
+	 * protected method.
2492
+	 *
2493
+	 * @see   $this->_set_publish_post_box_vars for param details
2494
+	 * @since 4.6.0
2495
+	 * @param string $name
2496
+	 * @param int    $id
2497
+	 * @param bool   $delete
2498
+	 * @param string $save_close_redirect_URL
2499
+	 * @param bool   $both_btns
2500
+	 * @throws EE_Error
2501
+	 * @throws InvalidArgumentException
2502
+	 * @throws InvalidDataTypeException
2503
+	 * @throws InvalidInterfaceException
2504
+	 */
2505
+	public function set_publish_post_box_vars(
2506
+		$name = '',
2507
+		$id = 0,
2508
+		$delete = false,
2509
+		$save_close_redirect_URL = '',
2510
+		$both_btns = true
2511
+	) {
2512
+		$this->_set_publish_post_box_vars(
2513
+			$name,
2514
+			$id,
2515
+			$delete,
2516
+			$save_close_redirect_URL,
2517
+			$both_btns
2518
+		);
2519
+	}
2520
+
2521
+
2522
+	/**
2523
+	 * Sets the _template_args arguments used by the _publish_post_box shortcut
2524
+	 * Note: currently there is no validation for this.  However if you want the delete button, the
2525
+	 * save, and save and close buttons to work properly, then you will want to include a
2526
+	 * values for the name and id arguments.
2527
+	 *
2528
+	 * @todo  Add in validation for name/id arguments.
2529
+	 * @param    string  $name                    key used for the action ID (i.e. event_id)
2530
+	 * @param    int     $id                      id attached to the item published
2531
+	 * @param    string  $delete                  page route callback for the delete action
2532
+	 * @param    string  $save_close_redirect_URL custom URL to redirect to after Save & Close has been completed
2533
+	 * @param    boolean $both_btns               whether to display BOTH the "Save & Close" and "Save" buttons or just
2534
+	 *                                            the Save button
2535
+	 * @throws EE_Error
2536
+	 * @throws InvalidArgumentException
2537
+	 * @throws InvalidDataTypeException
2538
+	 * @throws InvalidInterfaceException
2539
+	 */
2540
+	protected function _set_publish_post_box_vars(
2541
+		$name = '',
2542
+		$id = 0,
2543
+		$delete = '',
2544
+		$save_close_redirect_URL = '',
2545
+		$both_btns = true
2546
+	) {
2547
+		// if Save & Close, use a custom redirect URL or default to the main page?
2548
+		$save_close_redirect_URL = ! empty($save_close_redirect_URL)
2549
+			? $save_close_redirect_URL
2550
+			: $this->_admin_base_url;
2551
+		// create the Save & Close and Save buttons
2552
+		$this->_set_save_buttons($both_btns, array(), array(), $save_close_redirect_URL);
2553
+		// if we have extra content set let's add it in if not make sure its empty
2554
+		$this->_template_args['publish_box_extra_content'] = isset($this->_template_args['publish_box_extra_content'])
2555
+			? $this->_template_args['publish_box_extra_content']
2556
+			: '';
2557
+		if ($delete && ! empty($id)) {
2558
+			// make sure we have a default if just true is sent.
2559
+			$delete = ! empty($delete) ? $delete : 'delete';
2560
+			$delete_link_args = array($name => $id);
2561
+			$delete = $this->get_action_link_or_button(
2562
+				$delete,
2563
+				$delete,
2564
+				$delete_link_args,
2565
+				'submitdelete deletion'
2566
+			);
2567
+		}
2568
+		$this->_template_args['publish_delete_link'] = ! empty($id) ? $delete : '';
2569
+		if (! empty($name) && ! empty($id)) {
2570
+			$hidden_field_arr[ $name ] = array(
2571
+				'type'  => 'hidden',
2572
+				'value' => $id,
2573
+			);
2574
+			$hf = $this->_generate_admin_form_fields($hidden_field_arr, 'array');
2575
+		} else {
2576
+			$hf = '';
2577
+		}
2578
+		// add hidden field
2579
+		$this->_template_args['publish_hidden_fields'] = is_array($hf) && ! empty($name)
2580
+			? $hf[ $name ]['field']
2581
+			: $hf;
2582
+	}
2583
+
2584
+
2585
+	/**
2586
+	 * displays an error message to ppl who have javascript disabled
2587
+	 *
2588
+	 * @return void
2589
+	 */
2590
+	private function _display_no_javascript_warning()
2591
+	{
2592
+		?>
2593 2593
         <noscript>
2594 2594
             <div id="no-js-message" class="error">
2595 2595
                 <p style="font-size:1.3em;">
2596 2596
                     <span style="color:red;"><?php esc_html_e('Warning!', 'event_espresso'); ?></span>
2597 2597
                     <?php esc_html_e(
2598
-                        '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.',
2599
-                        'event_espresso'
2600
-                    ); ?>
2598
+						'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.',
2599
+						'event_espresso'
2600
+					); ?>
2601 2601
                 </p>
2602 2602
             </div>
2603 2603
         </noscript>
2604 2604
         <?php
2605
-    }
2606
-
2607
-
2608
-    /**
2609
-     * displays espresso success and/or error notices
2610
-     *
2611
-     * @return void
2612
-     */
2613
-    private function _display_espresso_notices()
2614
-    {
2615
-        $notices = $this->_get_transient(true);
2616
-        echo stripslashes($notices);
2617
-    }
2618
-
2619
-
2620
-    /**
2621
-     * spinny things pacify the masses
2622
-     *
2623
-     * @return void
2624
-     */
2625
-    protected function _add_admin_page_ajax_loading_img()
2626
-    {
2627
-        ?>
2605
+	}
2606
+
2607
+
2608
+	/**
2609
+	 * displays espresso success and/or error notices
2610
+	 *
2611
+	 * @return void
2612
+	 */
2613
+	private function _display_espresso_notices()
2614
+	{
2615
+		$notices = $this->_get_transient(true);
2616
+		echo stripslashes($notices);
2617
+	}
2618
+
2619
+
2620
+	/**
2621
+	 * spinny things pacify the masses
2622
+	 *
2623
+	 * @return void
2624
+	 */
2625
+	protected function _add_admin_page_ajax_loading_img()
2626
+	{
2627
+		?>
2628 2628
         <div id="espresso-ajax-loading" class="ajax-loading-grey">
2629 2629
             <span class="ee-spinner ee-spin"></span><span class="hidden"><?php
2630
-                esc_html_e('loading...', 'event_espresso'); ?></span>
2630
+				esc_html_e('loading...', 'event_espresso'); ?></span>
2631 2631
         </div>
2632 2632
         <?php
2633
-    }
2633
+	}
2634 2634
 
2635 2635
 
2636
-    /**
2637
-     * add admin page overlay for modal boxes
2638
-     *
2639
-     * @return void
2640
-     */
2641
-    protected function _add_admin_page_overlay()
2642
-    {
2643
-        ?>
2636
+	/**
2637
+	 * add admin page overlay for modal boxes
2638
+	 *
2639
+	 * @return void
2640
+	 */
2641
+	protected function _add_admin_page_overlay()
2642
+	{
2643
+		?>
2644 2644
         <div id="espresso-admin-page-overlay-dv" class=""></div>
2645 2645
         <?php
2646
-    }
2647
-
2648
-
2649
-    /**
2650
-     * facade for add_meta_box
2651
-     *
2652
-     * @param string  $action        where the metabox get's displayed
2653
-     * @param string  $title         Title of Metabox (output in metabox header)
2654
-     * @param string  $callback      If not empty and $create_fun is set to false then we'll use a custom callback
2655
-     *                               instead of the one created in here.
2656
-     * @param array   $callback_args an array of args supplied for the metabox
2657
-     * @param string  $column        what metabox column
2658
-     * @param string  $priority      give this metabox a priority (using accepted priorities for wp meta boxes)
2659
-     * @param boolean $create_func   default is true.  Basically we can say we don't WANT to have the runtime function
2660
-     *                               created but just set our own callback for wp's add_meta_box.
2661
-     * @throws DomainException
2662
-     */
2663
-    public function _add_admin_page_meta_box(
2664
-        $action,
2665
-        $title,
2666
-        $callback,
2667
-        $callback_args,
2668
-        $column = 'normal',
2669
-        $priority = 'high',
2670
-        $create_func = true
2671
-    ) {
2672
-        do_action('AHEE_log', __FILE__, __FUNCTION__, $callback);
2673
-        // 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.
2674
-        if (empty($callback_args) && $create_func) {
2675
-            $callback_args = array(
2676
-                'template_path' => $this->_template_path,
2677
-                'template_args' => $this->_template_args,
2678
-            );
2679
-        }
2680
-        // 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)
2681
-        $call_back_func = $create_func
2682
-            ? static function ($post, $metabox) {
2683
-                do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2684
-                echo EEH_Template::display_template(
2685
-                    $metabox['args']['template_path'],
2686
-                    $metabox['args']['template_args'],
2687
-                    true
2688
-                );
2689
-            }
2690
-            : $callback;
2691
-        add_meta_box(
2692
-            str_replace('_', '-', $action) . '-mbox',
2693
-            $title,
2694
-            $call_back_func,
2695
-            $this->_wp_page_slug,
2696
-            $column,
2697
-            $priority,
2698
-            $callback_args
2699
-        );
2700
-    }
2701
-
2702
-
2703
-    /**
2704
-     * generates HTML wrapper for and admin details page that contains metaboxes in columns
2705
-     *
2706
-     * @throws DomainException
2707
-     * @throws EE_Error
2708
-     * @throws InvalidArgumentException
2709
-     * @throws InvalidDataTypeException
2710
-     * @throws InvalidInterfaceException
2711
-     */
2712
-    public function display_admin_page_with_metabox_columns()
2713
-    {
2714
-        $this->_template_args['post_body_content'] = $this->_template_args['admin_page_content'];
2715
-        $this->_template_args['admin_page_content'] = EEH_Template::display_template(
2716
-            $this->_column_template_path,
2717
-            $this->_template_args,
2718
-            true
2719
-        );
2720
-        // the final wrapper
2721
-        $this->admin_page_wrapper();
2722
-    }
2723
-
2724
-
2725
-    /**
2726
-     * generates  HTML wrapper for an admin details page
2727
-     *
2728
-     * @return void
2729
-     * @throws DomainException
2730
-     * @throws EE_Error
2731
-     * @throws InvalidArgumentException
2732
-     * @throws InvalidDataTypeException
2733
-     * @throws InvalidInterfaceException
2734
-     */
2735
-    public function display_admin_page_with_sidebar()
2736
-    {
2737
-        $this->_display_admin_page(true);
2738
-    }
2739
-
2740
-
2741
-    /**
2742
-     * generates  HTML wrapper for an admin details page (except no sidebar)
2743
-     *
2744
-     * @return void
2745
-     * @throws DomainException
2746
-     * @throws EE_Error
2747
-     * @throws InvalidArgumentException
2748
-     * @throws InvalidDataTypeException
2749
-     * @throws InvalidInterfaceException
2750
-     */
2751
-    public function display_admin_page_with_no_sidebar()
2752
-    {
2753
-        $this->_display_admin_page();
2754
-    }
2755
-
2756
-
2757
-    /**
2758
-     * generates HTML wrapper for an EE about admin page (no sidebar)
2759
-     *
2760
-     * @return void
2761
-     * @throws DomainException
2762
-     * @throws EE_Error
2763
-     * @throws InvalidArgumentException
2764
-     * @throws InvalidDataTypeException
2765
-     * @throws InvalidInterfaceException
2766
-     */
2767
-    public function display_about_admin_page()
2768
-    {
2769
-        $this->_display_admin_page(false, true);
2770
-    }
2771
-
2772
-
2773
-    /**
2774
-     * display_admin_page
2775
-     * contains the code for actually displaying an admin page
2776
-     *
2777
-     * @param boolean $sidebar true with sidebar, false without
2778
-     * @param boolean $about   use the about admin wrapper instead of the default.
2779
-     * @return void
2780
-     * @throws DomainException
2781
-     * @throws EE_Error
2782
-     * @throws InvalidArgumentException
2783
-     * @throws InvalidDataTypeException
2784
-     * @throws InvalidInterfaceException
2785
-     */
2786
-    private function _display_admin_page($sidebar = false, $about = false)
2787
-    {
2788
-        do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2789
-        // custom remove metaboxes hook to add or remove any metaboxes to/from Admin pages.
2790
-        do_action('AHEE__EE_Admin_Page___display_admin_page__modify_metaboxes');
2791
-        // set current wp page slug - looks like: event-espresso_page_event_categories
2792
-        // keep in mind "event-espresso" COULD be something else if the top level menu label has been translated.
2793
-        $this->_template_args['current_page'] = $this->_wp_page_slug;
2794
-        $this->_template_args['admin_page_wrapper_div_id'] = $this->_cpt_route
2795
-            ? 'poststuff'
2796
-            : 'espresso-default-admin';
2797
-        $template_path = $sidebar
2798
-            ? EE_ADMIN_TEMPLATE . 'admin_details_wrapper.template.php'
2799
-            : EE_ADMIN_TEMPLATE . 'admin_details_wrapper_no_sidebar.template.php';
2800
-        if (defined('DOING_AJAX') && DOING_AJAX) {
2801
-            $template_path = EE_ADMIN_TEMPLATE . 'admin_details_wrapper_no_sidebar_ajax.template.php';
2802
-        }
2803
-        $template_path = ! empty($this->_column_template_path)
2804
-            ? $this->_column_template_path : $template_path;
2805
-        $this->_template_args['post_body_content'] = isset($this->_template_args['admin_page_content'])
2806
-            ? $this->_template_args['admin_page_content']
2807
-            : '';
2808
-        $this->_template_args['before_admin_page_content'] = isset($this->_template_args['before_admin_page_content'])
2809
-            ? $this->_template_args['before_admin_page_content']
2810
-            : '';
2811
-        $this->_template_args['after_admin_page_content'] = isset($this->_template_args['after_admin_page_content'])
2812
-            ? $this->_template_args['after_admin_page_content']
2813
-            : '';
2814
-        $this->_template_args['admin_page_content'] = EEH_Template::display_template(
2815
-            $template_path,
2816
-            $this->_template_args,
2817
-            true
2818
-        );
2819
-        // the final template wrapper
2820
-        $this->admin_page_wrapper($about);
2821
-    }
2822
-
2823
-
2824
-    /**
2825
-     * This is used to display caf preview pages.
2826
-     *
2827
-     * @since 4.3.2
2828
-     * @param string $utm_campaign_source what is the key used for google analytics link
2829
-     * @param bool   $display_sidebar     whether to use the sidebar template or the full template for the page.  TRUE
2830
-     *                                    = SHOW sidebar, FALSE = no sidebar. Default no sidebar.
2831
-     * @return void
2832
-     * @throws DomainException
2833
-     * @throws EE_Error
2834
-     * @throws InvalidArgumentException
2835
-     * @throws InvalidDataTypeException
2836
-     * @throws InvalidInterfaceException
2837
-     */
2838
-    public function display_admin_caf_preview_page($utm_campaign_source = '', $display_sidebar = true)
2839
-    {
2840
-        // let's generate a default preview action button if there isn't one already present.
2841
-        $this->_labels['buttons']['buy_now'] = esc_html__(
2842
-            'Upgrade to Event Espresso 4 Right Now',
2843
-            'event_espresso'
2844
-        );
2845
-        $buy_now_url = add_query_arg(
2846
-            array(
2847
-                'ee_ver'       => 'ee4',
2848
-                'utm_source'   => 'ee4_plugin_admin',
2849
-                'utm_medium'   => 'link',
2850
-                'utm_campaign' => $utm_campaign_source,
2851
-                'utm_content'  => 'buy_now_button',
2852
-            ),
2853
-            'http://eventespresso.com/pricing/'
2854
-        );
2855
-        $this->_template_args['preview_action_button'] = ! isset($this->_template_args['preview_action_button'])
2856
-            ? $this->get_action_link_or_button(
2857
-                '',
2858
-                'buy_now',
2859
-                array(),
2860
-                'button-primary button-large',
2861
-                $buy_now_url,
2862
-                true
2863
-            )
2864
-            : $this->_template_args['preview_action_button'];
2865
-        $this->_template_args['admin_page_content'] = EEH_Template::display_template(
2866
-            EE_ADMIN_TEMPLATE . 'admin_caf_full_page_preview.template.php',
2867
-            $this->_template_args,
2868
-            true
2869
-        );
2870
-        $this->_display_admin_page($display_sidebar);
2871
-    }
2872
-
2873
-
2874
-    /**
2875
-     * display_admin_list_table_page_with_sidebar
2876
-     * generates HTML wrapper for an admin_page with list_table
2877
-     *
2878
-     * @return void
2879
-     * @throws DomainException
2880
-     * @throws EE_Error
2881
-     * @throws InvalidArgumentException
2882
-     * @throws InvalidDataTypeException
2883
-     * @throws InvalidInterfaceException
2884
-     */
2885
-    public function display_admin_list_table_page_with_sidebar()
2886
-    {
2887
-        $this->_display_admin_list_table_page(true);
2888
-    }
2889
-
2890
-
2891
-    /**
2892
-     * display_admin_list_table_page_with_no_sidebar
2893
-     * generates HTML wrapper for an admin_page with list_table (but with no sidebar)
2894
-     *
2895
-     * @return void
2896
-     * @throws DomainException
2897
-     * @throws EE_Error
2898
-     * @throws InvalidArgumentException
2899
-     * @throws InvalidDataTypeException
2900
-     * @throws InvalidInterfaceException
2901
-     */
2902
-    public function display_admin_list_table_page_with_no_sidebar()
2903
-    {
2904
-        $this->_display_admin_list_table_page();
2905
-    }
2906
-
2907
-
2908
-    /**
2909
-     * generates html wrapper for an admin_list_table page
2910
-     *
2911
-     * @param boolean $sidebar whether to display with sidebar or not.
2912
-     * @return void
2913
-     * @throws DomainException
2914
-     * @throws EE_Error
2915
-     * @throws InvalidArgumentException
2916
-     * @throws InvalidDataTypeException
2917
-     * @throws InvalidInterfaceException
2918
-     */
2919
-    private function _display_admin_list_table_page($sidebar = false)
2920
-    {
2921
-        // setup search attributes
2922
-        $this->_set_search_attributes();
2923
-        $this->_template_args['current_page'] = $this->_wp_page_slug;
2924
-        $template_path = EE_ADMIN_TEMPLATE . 'admin_list_wrapper.template.php';
2925
-        $this->_template_args['table_url'] = defined('DOING_AJAX')
2926
-            ? add_query_arg(array('noheader' => 'true', 'route' => $this->_req_action), $this->_admin_base_url)
2927
-            : add_query_arg(array('route' => $this->_req_action), $this->_admin_base_url);
2928
-        $this->_template_args['list_table'] = $this->_list_table_object;
2929
-        $this->_template_args['current_route'] = $this->_req_action;
2930
-        $this->_template_args['list_table_class'] = get_class($this->_list_table_object);
2931
-        $ajax_sorting_callback = $this->_list_table_object->get_ajax_sorting_callback();
2932
-        if (! empty($ajax_sorting_callback)) {
2933
-            $sortable_list_table_form_fields = wp_nonce_field(
2934
-                $ajax_sorting_callback . '_nonce',
2935
-                $ajax_sorting_callback . '_nonce',
2936
-                false,
2937
-                false
2938
-            );
2939
-            $sortable_list_table_form_fields .= '<input type="hidden" id="ajax_table_sort_page" name="ajax_table_sort_page" value="'
2940
-                                                . $this->page_slug
2941
-                                                . '" />';
2942
-            $sortable_list_table_form_fields .= '<input type="hidden" id="ajax_table_sort_action" name="ajax_table_sort_action" value="'
2943
-                                                . $ajax_sorting_callback
2944
-                                                . '" />';
2945
-        } else {
2946
-            $sortable_list_table_form_fields = '';
2947
-        }
2948
-        $this->_template_args['sortable_list_table_form_fields'] = $sortable_list_table_form_fields;
2949
-        $hidden_form_fields = isset($this->_template_args['list_table_hidden_fields'])
2950
-            ? $this->_template_args['list_table_hidden_fields']
2951
-            : '';
2952
-        $nonce_ref = $this->_req_action . '_nonce';
2953
-        $hidden_form_fields .= '<input type="hidden" name="'
2954
-                               . $nonce_ref
2955
-                               . '" value="'
2956
-                               . wp_create_nonce($nonce_ref)
2957
-                               . '">';
2958
-        $this->_template_args['list_table_hidden_fields'] = $hidden_form_fields;
2959
-        // display message about search results?
2960
-        $this->_template_args['before_list_table'] .= ! empty($this->_req_data['s'])
2961
-            ? '<p class="ee-search-results">' . sprintf(
2962
-                esc_html__('Displaying search results for the search string: %1$s', 'event_espresso'),
2963
-                trim($this->_req_data['s'], '%')
2964
-            ) . '</p>'
2965
-            : '';
2966
-        // filter before_list_table template arg
2967
-        $this->_template_args['before_list_table'] = apply_filters(
2968
-            'FHEE__EE_Admin_Page___display_admin_list_table_page__before_list_table__template_arg',
2969
-            $this->_template_args['before_list_table'],
2970
-            $this->page_slug,
2971
-            $this->_req_data,
2972
-            $this->_req_action
2973
-        );
2974
-        // convert to array and filter again
2975
-        // arrays are easier to inject new items in a specific location,
2976
-        // but would not be backwards compatible, so we have to add a new filter
2977
-        $this->_template_args['before_list_table'] = implode(
2978
-            " \n",
2979
-            (array) apply_filters(
2980
-                'FHEE__EE_Admin_Page___display_admin_list_table_page__before_list_table__template_args_array',
2981
-                (array) $this->_template_args['before_list_table'],
2982
-                $this->page_slug,
2983
-                $this->_req_data,
2984
-                $this->_req_action
2985
-            )
2986
-        );
2987
-        // filter after_list_table template arg
2988
-        $this->_template_args['after_list_table'] = apply_filters(
2989
-            'FHEE__EE_Admin_Page___display_admin_list_table_page__after_list_table__template_arg',
2990
-            $this->_template_args['after_list_table'],
2991
-            $this->page_slug,
2992
-            $this->_req_data,
2993
-            $this->_req_action
2994
-        );
2995
-        // convert to array and filter again
2996
-        // arrays are easier to inject new items in a specific location,
2997
-        // but would not be backwards compatible, so we have to add a new filter
2998
-        $this->_template_args['after_list_table'] = implode(
2999
-            " \n",
3000
-            (array) apply_filters(
3001
-                'FHEE__EE_Admin_Page___display_admin_list_table_page__after_list_table__template_args_array',
3002
-                (array) $this->_template_args['after_list_table'],
3003
-                $this->page_slug,
3004
-                $this->_req_data,
3005
-                $this->_req_action
3006
-            )
3007
-        );
3008
-        $this->_template_args['admin_page_content'] = EEH_Template::display_template(
3009
-            $template_path,
3010
-            $this->_template_args,
3011
-            true
3012
-        );
3013
-        // the final template wrapper
3014
-        if ($sidebar) {
3015
-            $this->display_admin_page_with_sidebar();
3016
-        } else {
3017
-            $this->display_admin_page_with_no_sidebar();
3018
-        }
3019
-    }
3020
-
3021
-
3022
-    /**
3023
-     * This just prepares a legend using the given items and the admin_details_legend.template.php file and returns the
3024
-     * html string for the legend.
3025
-     * $items are expected in an array in the following format:
3026
-     * $legend_items = array(
3027
-     *        'item_id' => array(
3028
-     *            'icon' => 'http://url_to_icon_being_described.png',
3029
-     *            'desc' => esc_html__('localized description of item');
3030
-     *        )
3031
-     * );
3032
-     *
3033
-     * @param  array $items see above for format of array
3034
-     * @return string html string of legend
3035
-     * @throws DomainException
3036
-     */
3037
-    protected function _display_legend($items)
3038
-    {
3039
-        $this->_template_args['items'] = apply_filters(
3040
-            'FHEE__EE_Admin_Page___display_legend__items',
3041
-            (array) $items,
3042
-            $this
3043
-        );
3044
-        $this->_template_args['status_change_notice'] = EEH_Template::display_template(
3045
-            EE_ADMIN_TEMPLATE . 'status_change_notice.template.php',
3046
-            [ 'context' => '__admin-legend' ],
3047
-            true
3048
-        );
3049
-        return EEH_Template::display_template(
3050
-            EE_ADMIN_TEMPLATE . 'admin_details_legend.template.php',
3051
-            $this->_template_args,
3052
-            true
3053
-        );
3054
-    }
3055
-
3056
-
3057
-    /**
3058
-     * This is used whenever we're DOING_AJAX to return a formatted json array that our calling javascript can expect
3059
-     * The returned json object is created from an array in the following format:
3060
-     * array(
3061
-     *  'error' => FALSE, //(default FALSE), contains any errors and/or exceptions (exceptions return json early),
3062
-     *  'success' => FALSE, //(default FALSE) - contains any special success message.
3063
-     *  'notices' => '', // - contains any EE_Error formatted notices
3064
-     *  'content' => 'string can be html', //this is a string of formatted content (can be html)
3065
-     *  'data' => array() //this can be any key/value pairs that a method returns for later json parsing by the js.
3066
-     *  We're also going to include the template args with every package (so js can pick out any specific template args
3067
-     *  that might be included in here)
3068
-     * )
3069
-     * The json object is populated by whatever is set in the $_template_args property.
3070
-     *
3071
-     * @param bool  $sticky_notices    Used to indicate whether you want to ensure notices are added to a transient
3072
-     *                                 instead of displayed.
3073
-     * @param array $notices_arguments Use this to pass any additional args on to the _process_notices.
3074
-     * @return void
3075
-     * @throws EE_Error
3076
-     * @throws InvalidArgumentException
3077
-     * @throws InvalidDataTypeException
3078
-     * @throws InvalidInterfaceException
3079
-     */
3080
-    protected function _return_json($sticky_notices = false, $notices_arguments = array())
3081
-    {
3082
-        // make sure any EE_Error notices have been handled.
3083
-        $this->_process_notices($notices_arguments, true, $sticky_notices);
3084
-        $data = isset($this->_template_args['data']) ? $this->_template_args['data'] : array();
3085
-        unset($this->_template_args['data']);
3086
-        $json = array(
3087
-            'error'     => isset($this->_template_args['error']) ? $this->_template_args['error'] : false,
3088
-            'success'   => isset($this->_template_args['success']) ? $this->_template_args['success'] : false,
3089
-            'errors'    => isset($this->_template_args['errors']) ? $this->_template_args['errors'] : false,
3090
-            'attention' => isset($this->_template_args['attention']) ? $this->_template_args['attention'] : false,
3091
-            'notices'   => EE_Error::get_notices(),
3092
-            'content'   => isset($this->_template_args['admin_page_content'])
3093
-                ? $this->_template_args['admin_page_content'] : '',
3094
-            'data'      => array_merge($data, array('template_args' => $this->_template_args)),
3095
-            'isEEajax'  => true
3096
-            // special flag so any ajax.Success methods in js can identify this return package as a EEajax package.
3097
-        );
3098
-        // make sure there are no php errors or headers_sent.  Then we can set correct json header.
3099
-        if (null === error_get_last() || ! headers_sent()) {
3100
-            header('Content-Type: application/json; charset=UTF-8');
3101
-        }
3102
-        echo wp_json_encode($json);
3103
-        exit();
3104
-    }
3105
-
3106
-
3107
-    /**
3108
-     * Simply a wrapper for the protected method so we can call this outside the class (ONLY when doing ajax)
3109
-     *
3110
-     * @return void
3111
-     * @throws EE_Error
3112
-     * @throws InvalidArgumentException
3113
-     * @throws InvalidDataTypeException
3114
-     * @throws InvalidInterfaceException
3115
-     */
3116
-    public function return_json()
3117
-    {
3118
-        if (defined('DOING_AJAX') && DOING_AJAX) {
3119
-            $this->_return_json();
3120
-        } else {
3121
-            throw new EE_Error(
3122
-                sprintf(
3123
-                    esc_html__('The public %s method can only be called when DOING_AJAX = TRUE', 'event_espresso'),
3124
-                    __FUNCTION__
3125
-                )
3126
-            );
3127
-        }
3128
-    }
3129
-
3130
-
3131
-    /**
3132
-     * This provides a way for child hook classes to send along themselves by reference so methods/properties within
3133
-     * them can be accessed by EE_Admin_child pages. This is assigned to the $_hook_obj property.
3134
-     *
3135
-     * @param EE_Admin_Hooks $hook_obj This will be the object for the EE_Admin_Hooks child
3136
-     */
3137
-    public function set_hook_object(EE_Admin_Hooks $hook_obj)
3138
-    {
3139
-        $this->_hook_obj = $hook_obj;
3140
-    }
3141
-
3142
-
3143
-    /**
3144
-     *        generates  HTML wrapper with Tabbed nav for an admin page
3145
-     *
3146
-     * @param boolean $about whether to use the special about page wrapper or default.
3147
-     * @return void
3148
-     * @throws DomainException
3149
-     * @throws EE_Error
3150
-     * @throws InvalidArgumentException
3151
-     * @throws InvalidDataTypeException
3152
-     * @throws InvalidInterfaceException
3153
-     */
3154
-    public function admin_page_wrapper($about = false)
3155
-    {
3156
-        do_action('AHEE_log', __FILE__, __FUNCTION__, '');
3157
-        $this->_nav_tabs = $this->_get_main_nav_tabs();
3158
-        $this->_template_args['nav_tabs'] = $this->_nav_tabs;
3159
-        $this->_template_args['admin_page_title'] = $this->_admin_page_title;
3160
-        $this->_template_args['before_admin_page_content'] = apply_filters(
3161
-            "FHEE_before_admin_page_content{$this->_current_page}{$this->_current_view}",
3162
-            isset($this->_template_args['before_admin_page_content'])
3163
-                ? $this->_template_args['before_admin_page_content']
3164
-                : ''
3165
-        );
3166
-        $this->_template_args['after_admin_page_content'] = apply_filters(
3167
-            "FHEE_after_admin_page_content{$this->_current_page}{$this->_current_view}",
3168
-            isset($this->_template_args['after_admin_page_content'])
3169
-                ? $this->_template_args['after_admin_page_content']
3170
-                : ''
3171
-        );
3172
-        $this->_template_args['after_admin_page_content'] .= $this->_set_help_popup_content();
3173
-        // load settings page wrapper template
3174
-        $template_path = ! defined('DOING_AJAX')
3175
-            ? EE_ADMIN_TEMPLATE . 'admin_wrapper.template.php'
3176
-            : EE_ADMIN_TEMPLATE
3177
-              . 'admin_wrapper_ajax.template.php';
3178
-        // about page?
3179
-        $template_path = $about
3180
-            ? EE_ADMIN_TEMPLATE . 'about_admin_wrapper.template.php'
3181
-            : $template_path;
3182
-        if (defined('DOING_AJAX')) {
3183
-            $this->_template_args['admin_page_content'] = EEH_Template::display_template(
3184
-                $template_path,
3185
-                $this->_template_args,
3186
-                true
3187
-            );
3188
-            $this->_return_json();
3189
-        } else {
3190
-            EEH_Template::display_template($template_path, $this->_template_args);
3191
-        }
3192
-    }
3193
-
3194
-
3195
-    /**
3196
-     * This returns the admin_nav tabs html using the configuration in the _nav_tabs property
3197
-     *
3198
-     * @return string html
3199
-     * @throws EE_Error
3200
-     */
3201
-    protected function _get_main_nav_tabs()
3202
-    {
3203
-        // let's generate the html using the EEH_Tabbed_Content helper.
3204
-        // We do this here so that it's possible for child classes to add in nav tabs dynamically at the last minute
3205
-        // (rather than setting in the page_routes array)
3206
-        return EEH_Tabbed_Content::display_admin_nav_tabs($this->_nav_tabs);
3207
-    }
3208
-
3209
-
3210
-    /**
3211
-     *        sort nav tabs
3212
-     *
3213
-     * @param $a
3214
-     * @param $b
3215
-     * @return int
3216
-     */
3217
-    private function _sort_nav_tabs($a, $b)
3218
-    {
3219
-        if ($a['order'] === $b['order']) {
3220
-            return 0;
3221
-        }
3222
-        return ($a['order'] < $b['order']) ? -1 : 1;
3223
-    }
3224
-
3225
-
3226
-    /**
3227
-     *    generates HTML for the forms used on admin pages
3228
-     *
3229
-     * @param    array $input_vars - array of input field details
3230
-     * @param string   $generator  (options are 'string' or 'array', basically use this to indicate which generator to
3231
-     *                             use)
3232
-     * @param bool     $id
3233
-     * @return string
3234
-     * @uses   EEH_Form_Fields::get_form_fields (/helper/EEH_Form_Fields.helper.php)
3235
-     * @uses   EEH_Form_Fields::get_form_fields_array (/helper/EEH_Form_Fields.helper.php)
3236
-     */
3237
-    protected function _generate_admin_form_fields($input_vars = array(), $generator = 'string', $id = false)
3238
-    {
3239
-        return $generator === 'string'
3240
-            ? EEH_Form_Fields::get_form_fields($input_vars, $id)
3241
-            : EEH_Form_Fields::get_form_fields_array($input_vars);
3242
-    }
3243
-
3244
-
3245
-    /**
3246
-     * generates the "Save" and "Save & Close" buttons for edit forms
3247
-     *
3248
-     * @param bool             $both     if true then both buttons will be generated.  If false then just the "Save &
3249
-     *                                   Close" button.
3250
-     * @param array            $text     if included, generator will use the given text for the buttons ( array([0] =>
3251
-     *                                   'Save', [1] => 'save & close')
3252
-     * @param array            $actions  if included allows us to set the actions that each button will carry out (i.e.
3253
-     *                                   via the "name" value in the button).  We can also use this to just dump
3254
-     *                                   default actions by submitting some other value.
3255
-     * @param bool|string|null $referrer if false then we just do the default action on save and close.  Other wise it
3256
-     *                                   will use the $referrer string. IF null, then we don't do ANYTHING on save and
3257
-     *                                   close (normal form handling).
3258
-     */
3259
-    protected function _set_save_buttons($both = true, $text = array(), $actions = array(), $referrer = null)
3260
-    {
3261
-        // make sure $text and $actions are in an array
3262
-        $text = (array) $text;
3263
-        $actions = (array) $actions;
3264
-        $referrer_url = empty($referrer)
3265
-            ? '<input type="hidden" id="save_and_close_referrer" name="save_and_close_referrer" value="'
3266
-              . $_SERVER['REQUEST_URI']
3267
-              . '" />'
3268
-            : '<input type="hidden" id="save_and_close_referrer" name="save_and_close_referrer" value="'
3269
-              . $referrer
3270
-              . '" />';
3271
-        $button_text = ! empty($text)
3272
-            ? $text
3273
-            : array(
3274
-                esc_html__('Save', 'event_espresso'),
3275
-                esc_html__('Save and Close', 'event_espresso'),
3276
-            );
3277
-        $default_names = array('save', 'save_and_close');
3278
-        // add in a hidden index for the current page (so save and close redirects properly)
3279
-        $this->_template_args['save_buttons'] = $referrer_url;
3280
-        foreach ($button_text as $key => $button) {
3281
-            $ref = $default_names[ $key ];
3282
-            $this->_template_args['save_buttons'] .= '<input type="submit" class="button-primary '
3283
-                                                     . $ref
3284
-                                                     . '" value="'
3285
-                                                     . $button
3286
-                                                     . '" name="'
3287
-                                                     . (! empty($actions) ? $actions[ $key ] : $ref)
3288
-                                                     . '" id="'
3289
-                                                     . $this->_current_view . '_' . $ref
3290
-                                                     . '" />';
3291
-            if (! $both) {
3292
-                break;
3293
-            }
3294
-        }
3295
-    }
3296
-
3297
-
3298
-    /**
3299
-     * Wrapper for the protected function.  Allows plugins/addons to call this to set the form tags.
3300
-     *
3301
-     * @see   $this->_set_add_edit_form_tags() for details on params
3302
-     * @since 4.6.0
3303
-     * @param string $route
3304
-     * @param array  $additional_hidden_fields
3305
-     */
3306
-    public function set_add_edit_form_tags($route = '', $additional_hidden_fields = array())
3307
-    {
3308
-        $this->_set_add_edit_form_tags($route, $additional_hidden_fields);
3309
-    }
3310
-
3311
-
3312
-    /**
3313
-     * set form open and close tags on add/edit pages.
3314
-     *
3315
-     * @param string $route                    the route you want the form to direct to
3316
-     * @param array  $additional_hidden_fields any additional hidden fields required in the form header
3317
-     * @return void
3318
-     */
3319
-    protected function _set_add_edit_form_tags($route = '', $additional_hidden_fields = array())
3320
-    {
3321
-        if (empty($route)) {
3322
-            $user_msg = esc_html__(
3323
-                'An error occurred. No action was set for this page\'s form.',
3324
-                'event_espresso'
3325
-            );
3326
-            $dev_msg = $user_msg . "\n"
3327
-                       . sprintf(
3328
-                           esc_html__('The $route argument is required for the %s->%s method.', 'event_espresso'),
3329
-                           __FUNCTION__,
3330
-                           EE_Admin_Page::class
3331
-                       );
3332
-            EE_Error::add_error($user_msg . '||' . $dev_msg, __FILE__, __FUNCTION__, __LINE__);
3333
-        }
3334
-        // open form
3335
-        $this->_template_args['before_admin_page_content'] = '<form name="form" method="post" action="'
3336
-                                                             . $this->_admin_base_url
3337
-                                                             . '" id="'
3338
-                                                             . $route
3339
-                                                             . '_event_form" >';
3340
-        // add nonce
3341
-        $nonce = wp_nonce_field($route . '_nonce', $route . '_nonce', false, false);
3342
-        $this->_template_args['before_admin_page_content'] .= "\n\t" . $nonce;
3343
-        // add REQUIRED form action
3344
-        $hidden_fields = array(
3345
-            'action' => array('type' => 'hidden', 'value' => $route),
3346
-        );
3347
-        // merge arrays
3348
-        $hidden_fields = is_array($additional_hidden_fields)
3349
-            ? array_merge($hidden_fields, $additional_hidden_fields)
3350
-            : $hidden_fields;
3351
-        // generate form fields
3352
-        $form_fields = $this->_generate_admin_form_fields($hidden_fields, 'array');
3353
-        // add fields to form
3354
-        foreach ((array) $form_fields as $field_name => $form_field) {
3355
-            $this->_template_args['before_admin_page_content'] .= "\n\t" . $form_field['field'];
3356
-        }
3357
-        // close form
3358
-        $this->_template_args['after_admin_page_content'] = '</form>';
3359
-    }
3360
-
3361
-
3362
-    /**
3363
-     * Public Wrapper for _redirect_after_action() method since its
3364
-     * discovered it would be useful for external code to have access.
3365
-     *
3366
-     * @param bool   $success
3367
-     * @param string $what
3368
-     * @param string $action_desc
3369
-     * @param array  $query_args
3370
-     * @param bool   $override_overwrite
3371
-     * @throws EE_Error
3372
-     * @throws InvalidArgumentException
3373
-     * @throws InvalidDataTypeException
3374
-     * @throws InvalidInterfaceException
3375
-     * @see   EE_Admin_Page::_redirect_after_action() for params.
3376
-     * @since 4.5.0
3377
-     */
3378
-    public function redirect_after_action(
3379
-        $success = false,
3380
-        $what = 'item',
3381
-        $action_desc = 'processed',
3382
-        $query_args = array(),
3383
-        $override_overwrite = false
3384
-    ) {
3385
-        $this->_redirect_after_action(
3386
-            $success,
3387
-            $what,
3388
-            $action_desc,
3389
-            $query_args,
3390
-            $override_overwrite
3391
-        );
3392
-    }
3393
-
3394
-
3395
-    /**
3396
-     * Helper method for merging existing request data with the returned redirect url.
3397
-     *
3398
-     * This is typically used for redirects after an action so that if the original view was a filtered view those
3399
-     * filters are still applied.
3400
-     *
3401
-     * @param array $new_route_data
3402
-     * @return array
3403
-     */
3404
-    protected function mergeExistingRequestParamsWithRedirectArgs(array $new_route_data)
3405
-    {
3406
-        foreach ($this->_req_data as $ref => $value) {
3407
-            // unset nonces
3408
-            if (strpos($ref, 'nonce') !== false) {
3409
-                unset($this->_req_data[ $ref ]);
3410
-                continue;
3411
-            }
3412
-            // urlencode values.
3413
-            $value = is_array($value) ? array_map('urlencode', $value) : urlencode($value);
3414
-            $this->_req_data[ $ref ] = $value;
3415
-        }
3416
-        return array_merge($this->_req_data, $new_route_data);
3417
-    }
3418
-
3419
-
3420
-    /**
3421
-     *    _redirect_after_action
3422
-     *
3423
-     * @param int    $success            - whether success was for two or more records, or just one, or none
3424
-     * @param string $what               - what the action was performed on
3425
-     * @param string $action_desc        - what was done ie: updated, deleted, etc
3426
-     * @param array  $query_args         - an array of query_args to be added to the URL to redirect to after the admin
3427
-     *                                   action is completed
3428
-     * @param BOOL   $override_overwrite by default all EE_Error::success messages are overwritten, this allows you to
3429
-     *                                   override this so that they show.
3430
-     * @return void
3431
-     * @throws EE_Error
3432
-     * @throws InvalidArgumentException
3433
-     * @throws InvalidDataTypeException
3434
-     * @throws InvalidInterfaceException
3435
-     */
3436
-    protected function _redirect_after_action(
3437
-        $success = 0,
3438
-        $what = 'item',
3439
-        $action_desc = 'processed',
3440
-        $query_args = array(),
3441
-        $override_overwrite = false
3442
-    ) {
3443
-        do_action('AHEE_log', __FILE__, __FUNCTION__, '');
3444
-        // class name for actions/filters.
3445
-        $classname = get_class($this);
3446
-        // set redirect url.
3447
-        // Note if there is a "page" index in the $query_args then we go with vanilla admin.php route,
3448
-        // otherwise we go with whatever is set as the _admin_base_url
3449
-        $redirect_url = isset($query_args['page']) ? admin_url('admin.php') : $this->_admin_base_url;
3450
-        $notices = EE_Error::get_notices(false);
3451
-        // overwrite default success messages //BUT ONLY if overwrite not overridden
3452
-        if (! $override_overwrite || ! empty($notices['errors'])) {
3453
-            EE_Error::overwrite_success();
3454
-        }
3455
-        if (! empty($what) && ! empty($action_desc) && empty($notices['errors'])) {
3456
-            // how many records affected ? more than one record ? or just one ?
3457
-            if ($success > 1) {
3458
-                // set plural msg
3459
-                EE_Error::add_success(
3460
-                    sprintf(
3461
-                        esc_html__('The "%s" have been successfully %s.', 'event_espresso'),
3462
-                        $what,
3463
-                        $action_desc
3464
-                    ),
3465
-                    __FILE__,
3466
-                    __FUNCTION__,
3467
-                    __LINE__
3468
-                );
3469
-            } elseif ($success === 1) {
3470
-                // set singular msg
3471
-                EE_Error::add_success(
3472
-                    sprintf(
3473
-                        esc_html__('The "%s" has been successfully %s.', 'event_espresso'),
3474
-                        $what,
3475
-                        $action_desc
3476
-                    ),
3477
-                    __FILE__,
3478
-                    __FUNCTION__,
3479
-                    __LINE__
3480
-                );
3481
-            }
3482
-        }
3483
-        // check that $query_args isn't something crazy
3484
-        if (! is_array($query_args)) {
3485
-            $query_args = array();
3486
-        }
3487
-        /**
3488
-         * Allow injecting actions before the query_args are modified for possible different
3489
-         * redirections on save and close actions
3490
-         *
3491
-         * @since 4.2.0
3492
-         * @param array $query_args       The original query_args array coming into the
3493
-         *                                method.
3494
-         */
3495
-        do_action(
3496
-            "AHEE__{$classname}___redirect_after_action__before_redirect_modification_{$this->_req_action}",
3497
-            $query_args
3498
-        );
3499
-        // calculate where we're going (if we have a "save and close" button pushed)
3500
-        if (isset($this->_req_data['save_and_close'], $this->_req_data['save_and_close_referrer'])) {
3501
-            // even though we have the save_and_close referrer, we need to parse the url for the action in order to generate a nonce
3502
-            $parsed_url = parse_url($this->_req_data['save_and_close_referrer']);
3503
-            // regenerate query args array from referrer URL
3504
-            parse_str($parsed_url['query'], $query_args);
3505
-            // correct page and action will be in the query args now
3506
-            $redirect_url = admin_url('admin.php');
3507
-        }
3508
-        // merge any default query_args set in _default_route_query_args property
3509
-        if (! empty($this->_default_route_query_args) && ! $this->_is_UI_request) {
3510
-            $args_to_merge = array();
3511
-            foreach ($this->_default_route_query_args as $query_param => $query_value) {
3512
-                // is there a wp_referer array in our _default_route_query_args property?
3513
-                if ($query_param === 'wp_referer') {
3514
-                    $query_value = (array) $query_value;
3515
-                    foreach ($query_value as $reference => $value) {
3516
-                        if (strpos($reference, 'nonce') !== false) {
3517
-                            continue;
3518
-                        }
3519
-                        // finally we will override any arguments in the referer with
3520
-                        // what might be set on the _default_route_query_args array.
3521
-                        if (isset($this->_default_route_query_args[ $reference ])) {
3522
-                            $args_to_merge[ $reference ] = urlencode($this->_default_route_query_args[ $reference ]);
3523
-                        } else {
3524
-                            $args_to_merge[ $reference ] = urlencode($value);
3525
-                        }
3526
-                    }
3527
-                    continue;
3528
-                }
3529
-                $args_to_merge[ $query_param ] = $query_value;
3530
-            }
3531
-            // now let's merge these arguments but override with what was specifically sent in to the
3532
-            // redirect.
3533
-            $query_args = array_merge($args_to_merge, $query_args);
3534
-        }
3535
-        $this->_process_notices($query_args);
3536
-        // generate redirect url
3537
-        // if redirecting to anything other than the main page, add a nonce
3538
-        if (isset($query_args['action'])) {
3539
-            // manually generate wp_nonce and merge that with the query vars
3540
-            // becuz the wp_nonce_url function wrecks havoc on some vars
3541
-            $query_args['_wpnonce'] = wp_create_nonce($query_args['action'] . '_nonce');
3542
-        }
3543
-        // we're adding some hooks and filters in here for processing any things just before redirects
3544
-        // (example: an admin page has done an insert or update and we want to run something after that).
3545
-        do_action('AHEE_redirect_' . $classname . $this->_req_action, $query_args);
3546
-        $redirect_url = apply_filters(
3547
-            'FHEE_redirect_' . $classname . $this->_req_action,
3548
-            EE_Admin_Page::add_query_args_and_nonce($query_args, $redirect_url),
3549
-            $query_args
3550
-        );
3551
-        // check if we're doing ajax.  If we are then lets just return the results and js can handle how it wants.
3552
-        if (defined('DOING_AJAX')) {
3553
-            $default_data = array(
3554
-                'close'        => true,
3555
-                'redirect_url' => $redirect_url,
3556
-                'where'        => 'main',
3557
-                'what'         => 'append',
3558
-            );
3559
-            $this->_template_args['success'] = $success;
3560
-            $this->_template_args['data'] = ! empty($this->_template_args['data']) ? array_merge(
3561
-                $default_data,
3562
-                $this->_template_args['data']
3563
-            ) : $default_data;
3564
-            $this->_return_json();
3565
-        }
3566
-        wp_safe_redirect($redirect_url);
3567
-        exit();
3568
-    }
3569
-
3570
-
3571
-    /**
3572
-     * process any notices before redirecting (or returning ajax request)
3573
-     * This method sets the $this->_template_args['notices'] attribute;
3574
-     *
3575
-     * @param array $query_args         any query args that need to be used for notice transient ('action')
3576
-     * @param bool  $skip_route_verify  This is typically used when we are processing notices REALLY early and
3577
-     *                                  page_routes haven't been defined yet.
3578
-     * @param bool  $sticky_notices     This is used to flag that regardless of whether this is doing_ajax or not, we
3579
-     *                                  still save a transient for the notice.
3580
-     * @return void
3581
-     * @throws EE_Error
3582
-     * @throws InvalidArgumentException
3583
-     * @throws InvalidDataTypeException
3584
-     * @throws InvalidInterfaceException
3585
-     */
3586
-    protected function _process_notices($query_args = array(), $skip_route_verify = false, $sticky_notices = true)
3587
-    {
3588
-        // first let's set individual error properties if doing_ajax and the properties aren't already set.
3589
-        if (defined('DOING_AJAX') && DOING_AJAX) {
3590
-            $notices = EE_Error::get_notices(false);
3591
-            if (empty($this->_template_args['success'])) {
3592
-                $this->_template_args['success'] = isset($notices['success']) ? $notices['success'] : false;
3593
-            }
3594
-            if (empty($this->_template_args['errors'])) {
3595
-                $this->_template_args['errors'] = isset($notices['errors']) ? $notices['errors'] : false;
3596
-            }
3597
-            if (empty($this->_template_args['attention'])) {
3598
-                $this->_template_args['attention'] = isset($notices['attention']) ? $notices['attention'] : false;
3599
-            }
3600
-        }
3601
-        $this->_template_args['notices'] = EE_Error::get_notices();
3602
-        // IF this isn't ajax we need to create a transient for the notices using the route (however, overridden if $sticky_notices == true)
3603
-        if (! defined('DOING_AJAX') || $sticky_notices) {
3604
-            $route = isset($query_args['action']) ? $query_args['action'] : 'default';
3605
-            $this->_add_transient(
3606
-                $route,
3607
-                $this->_template_args['notices'],
3608
-                true,
3609
-                $skip_route_verify
3610
-            );
3611
-        }
3612
-    }
3613
-
3614
-
3615
-    /**
3616
-     * get_action_link_or_button
3617
-     * returns the button html for adding, editing, or deleting an item (depending on given type)
3618
-     *
3619
-     * @param string $action        use this to indicate which action the url is generated with.
3620
-     * @param string $type          accepted strings must be defined in the $_labels['button'] array(as the key)
3621
-     *                              property.
3622
-     * @param array  $extra_request if the button requires extra params you can include them in $key=>$value pairs.
3623
-     * @param string $class         Use this to give the class for the button. Defaults to 'button-primary'
3624
-     * @param string $base_url      If this is not provided
3625
-     *                              the _admin_base_url will be used as the default for the button base_url.
3626
-     *                              Otherwise this value will be used.
3627
-     * @param bool   $exclude_nonce If true then no nonce will be in the generated button link.
3628
-     * @return string
3629
-     * @throws InvalidArgumentException
3630
-     * @throws InvalidInterfaceException
3631
-     * @throws InvalidDataTypeException
3632
-     * @throws EE_Error
3633
-     */
3634
-    public function get_action_link_or_button(
3635
-        $action,
3636
-        $type = 'add',
3637
-        $extra_request = array(),
3638
-        $class = 'button-primary',
3639
-        $base_url = '',
3640
-        $exclude_nonce = false
3641
-    ) {
3642
-        // first let's validate the action (if $base_url is FALSE otherwise validation will happen further along)
3643
-        if (empty($base_url) && ! isset($this->_page_routes[ $action ])) {
3644
-            throw new EE_Error(
3645
-                sprintf(
3646
-                    esc_html__(
3647
-                        'There is no page route for given action for the button.  This action was given: %s',
3648
-                        'event_espresso'
3649
-                    ),
3650
-                    $action
3651
-                )
3652
-            );
3653
-        }
3654
-        if (! isset($this->_labels['buttons'][ $type ])) {
3655
-            throw new EE_Error(
3656
-                sprintf(
3657
-                    __(
3658
-                        'There is no label for the given button type (%s). Labels are set in the <code>_page_config</code> property.',
3659
-                        'event_espresso'
3660
-                    ),
3661
-                    $type
3662
-                )
3663
-            );
3664
-        }
3665
-        // finally check user access for this button.
3666
-        $has_access = $this->check_user_access($action, true);
3667
-        if (! $has_access) {
3668
-            return '';
3669
-        }
3670
-        $_base_url = ! $base_url ? $this->_admin_base_url : $base_url;
3671
-        $query_args = array(
3672
-            'action' => $action,
3673
-        );
3674
-        // merge extra_request args but make sure our original action takes precedence and doesn't get overwritten.
3675
-        if (! empty($extra_request)) {
3676
-            $query_args = array_merge($extra_request, $query_args);
3677
-        }
3678
-        $url = EE_Admin_Page::add_query_args_and_nonce($query_args, $_base_url, false, $exclude_nonce);
3679
-        return EEH_Template::get_button_or_link($url, $this->_labels['buttons'][ $type ], $class);
3680
-    }
3681
-
3682
-
3683
-    /**
3684
-     * _per_page_screen_option
3685
-     * Utility function for adding in a per_page_option in the screen_options_dropdown.
3686
-     *
3687
-     * @return void
3688
-     * @throws InvalidArgumentException
3689
-     * @throws InvalidInterfaceException
3690
-     * @throws InvalidDataTypeException
3691
-     */
3692
-    protected function _per_page_screen_option()
3693
-    {
3694
-        $option = 'per_page';
3695
-        $args = array(
3696
-            'label'   => apply_filters(
3697
-                'FHEE__EE_Admin_Page___per_page_screen_options___label',
3698
-                $this->_admin_page_title,
3699
-                $this
3700
-            ),
3701
-            'default' => (int) apply_filters(
3702
-                'FHEE__EE_Admin_Page___per_page_screen_options__default',
3703
-                20
3704
-            ),
3705
-            'option'  => $this->_current_page . '_' . $this->_current_view . '_per_page',
3706
-        );
3707
-        // ONLY add the screen option if the user has access to it.
3708
-        if ($this->check_user_access($this->_current_view, true)) {
3709
-            add_screen_option($option, $args);
3710
-        }
3711
-    }
3712
-
3713
-
3714
-    /**
3715
-     * set_per_page_screen_option
3716
-     * All this does is make sure that WordPress saves any per_page screen options (if set) for the current page.
3717
-     * we have to do this rather than running inside the 'set-screen-options' hook because it runs earlier than
3718
-     * admin_menu.
3719
-     *
3720
-     * @return void
3721
-     */
3722
-    private function _set_per_page_screen_options()
3723
-    {
3724
-        if (isset($_POST['wp_screen_options']) && is_array($_POST['wp_screen_options'])) {
3725
-            check_admin_referer('screen-options-nonce', 'screenoptionnonce');
3726
-            if (! $user = wp_get_current_user()) {
3727
-                return;
3728
-            }
3729
-            $option = $_POST['wp_screen_options']['option'];
3730
-            $value = $_POST['wp_screen_options']['value'];
3731
-            if ($option !== sanitize_key($option)) {
3732
-                return;
3733
-            }
3734
-            $map_option = $option;
3735
-            $option = str_replace('-', '_', $option);
3736
-            switch ($map_option) {
3737
-                case $this->_current_page . '_' . $this->_current_view . '_per_page':
3738
-                    $value = (int) $value;
3739
-                    $max_value = apply_filters(
3740
-                        'FHEE__EE_Admin_Page___set_per_page_screen_options__max_value',
3741
-                        999,
3742
-                        $this->_current_page,
3743
-                        $this->_current_view
3744
-                    );
3745
-                    if ($value < 1) {
3746
-                        return;
3747
-                    }
3748
-                    $value = min($value, $max_value);
3749
-                    break;
3750
-                default:
3751
-                    $value = apply_filters(
3752
-                        'FHEE__EE_Admin_Page___set_per_page_screen_options__value',
3753
-                        false,
3754
-                        $option,
3755
-                        $value
3756
-                    );
3757
-                    if (false === $value) {
3758
-                        return;
3759
-                    }
3760
-                    break;
3761
-            }
3762
-            update_user_meta($user->ID, $option, $value);
3763
-            wp_safe_redirect(remove_query_arg(array('pagenum', 'apage', 'paged'), wp_get_referer()));
3764
-            exit;
3765
-        }
3766
-    }
3767
-
3768
-
3769
-    /**
3770
-     * This just allows for setting the $_template_args property if it needs to be set outside the object
3771
-     *
3772
-     * @param array $data array that will be assigned to template args.
3773
-     */
3774
-    public function set_template_args($data)
3775
-    {
3776
-        $this->_template_args = array_merge($this->_template_args, (array) $data);
3777
-    }
3778
-
3779
-
3780
-    /**
3781
-     * This makes available the WP transient system for temporarily moving data between routes
3782
-     *
3783
-     * @param string $route             the route that should receive the transient
3784
-     * @param array  $data              the data that gets sent
3785
-     * @param bool   $notices           If this is for notices then we use this to indicate so, otherwise its just a
3786
-     *                                  normal route transient.
3787
-     * @param bool   $skip_route_verify Used to indicate we want to skip route verification.  This is usually ONLY used
3788
-     *                                  when we are adding a transient before page_routes have been defined.
3789
-     * @return void
3790
-     * @throws EE_Error
3791
-     */
3792
-    protected function _add_transient($route, $data, $notices = false, $skip_route_verify = false)
3793
-    {
3794
-        $user_id = get_current_user_id();
3795
-        if (! $skip_route_verify) {
3796
-            $this->_verify_route($route);
3797
-        }
3798
-        // now let's set the string for what kind of transient we're setting
3799
-        $transient = $notices
3800
-            ? 'ee_rte_n_tx_' . $route . '_' . $user_id
3801
-            : 'rte_tx_' . $route . '_' . $user_id;
3802
-        $data = $notices ? array('notices' => $data) : $data;
3803
-        // is there already a transient for this route?  If there is then let's ADD to that transient
3804
-        $existing = is_multisite() && is_network_admin()
3805
-            ? get_site_transient($transient)
3806
-            : get_transient($transient);
3807
-        if ($existing) {
3808
-            $data = array_merge((array) $data, (array) $existing);
3809
-        }
3810
-        if (is_multisite() && is_network_admin()) {
3811
-            set_site_transient($transient, $data, 8);
3812
-        } else {
3813
-            set_transient($transient, $data, 8);
3814
-        }
3815
-    }
3816
-
3817
-
3818
-    /**
3819
-     * this retrieves the temporary transient that has been set for moving data between routes.
3820
-     *
3821
-     * @param bool   $notices true we get notices transient. False we just return normal route transient
3822
-     * @param string $route
3823
-     * @return mixed data
3824
-     */
3825
-    protected function _get_transient($notices = false, $route = '')
3826
-    {
3827
-        $user_id = get_current_user_id();
3828
-        $route = ! $route ? $this->_req_action : $route;
3829
-        $transient = $notices
3830
-            ? 'ee_rte_n_tx_' . $route . '_' . $user_id
3831
-            : 'rte_tx_' . $route . '_' . $user_id;
3832
-        $data = is_multisite() && is_network_admin()
3833
-            ? get_site_transient($transient)
3834
-            : get_transient($transient);
3835
-        // delete transient after retrieval (just in case it hasn't expired);
3836
-        if (is_multisite() && is_network_admin()) {
3837
-            delete_site_transient($transient);
3838
-        } else {
3839
-            delete_transient($transient);
3840
-        }
3841
-        return $notices && isset($data['notices']) ? $data['notices'] : $data;
3842
-    }
3843
-
3844
-
3845
-    /**
3846
-     * The purpose of this method is just to run garbage collection on any EE transients that might have expired but
3847
-     * would not be called later. This will be assigned to run on a specific EE Admin page. (place the method in the
3848
-     * default route callback on the EE_Admin page you want it run.)
3849
-     *
3850
-     * @return void
3851
-     */
3852
-    protected function _transient_garbage_collection()
3853
-    {
3854
-        global $wpdb;
3855
-        // retrieve all existing transients
3856
-        $query = "SELECT option_name FROM {$wpdb->options} WHERE option_name LIKE '%rte_tx_%' OR option_name LIKE '%rte_n_tx_%'";
3857
-        if ($results = $wpdb->get_results($query)) {
3858
-            foreach ($results as $result) {
3859
-                $transient = str_replace('_transient_', '', $result->option_name);
3860
-                get_transient($transient);
3861
-                if (is_multisite() && is_network_admin()) {
3862
-                    get_site_transient($transient);
3863
-                }
3864
-            }
3865
-        }
3866
-    }
3867
-
3868
-
3869
-    /**
3870
-     * get_view
3871
-     *
3872
-     * @return string content of _view property
3873
-     */
3874
-    public function get_view()
3875
-    {
3876
-        return $this->_view;
3877
-    }
3878
-
3879
-
3880
-    /**
3881
-     * getter for the protected $_views property
3882
-     *
3883
-     * @return array
3884
-     */
3885
-    public function get_views()
3886
-    {
3887
-        return $this->_views;
3888
-    }
3889
-
3890
-
3891
-    /**
3892
-     * get_current_page
3893
-     *
3894
-     * @return string _current_page property value
3895
-     */
3896
-    public function get_current_page()
3897
-    {
3898
-        return $this->_current_page;
3899
-    }
3900
-
3901
-
3902
-    /**
3903
-     * get_current_view
3904
-     *
3905
-     * @return string _current_view property value
3906
-     */
3907
-    public function get_current_view()
3908
-    {
3909
-        return $this->_current_view;
3910
-    }
3911
-
3912
-
3913
-    /**
3914
-     * get_current_screen
3915
-     *
3916
-     * @return object The current WP_Screen object
3917
-     */
3918
-    public function get_current_screen()
3919
-    {
3920
-        return $this->_current_screen;
3921
-    }
3922
-
3923
-
3924
-    /**
3925
-     * get_current_page_view_url
3926
-     *
3927
-     * @return string This returns the url for the current_page_view.
3928
-     */
3929
-    public function get_current_page_view_url()
3930
-    {
3931
-        return $this->_current_page_view_url;
3932
-    }
3933
-
3934
-
3935
-    /**
3936
-     * just returns the _req_data property
3937
-     *
3938
-     * @return array
3939
-     */
3940
-    public function get_request_data()
3941
-    {
3942
-        return $this->_req_data;
3943
-    }
3944
-
3945
-
3946
-    /**
3947
-     * returns the _req_data protected property
3948
-     *
3949
-     * @return string
3950
-     */
3951
-    public function get_req_action()
3952
-    {
3953
-        return $this->_req_action;
3954
-    }
3955
-
3956
-
3957
-    /**
3958
-     * @return bool  value of $_is_caf property
3959
-     */
3960
-    public function is_caf()
3961
-    {
3962
-        return $this->_is_caf;
3963
-    }
3964
-
3965
-
3966
-    /**
3967
-     * @return mixed
3968
-     */
3969
-    public function default_espresso_metaboxes()
3970
-    {
3971
-        return $this->_default_espresso_metaboxes;
3972
-    }
3973
-
3974
-
3975
-    /**
3976
-     * @return mixed
3977
-     */
3978
-    public function admin_base_url()
3979
-    {
3980
-        return $this->_admin_base_url;
3981
-    }
3982
-
3983
-
3984
-    /**
3985
-     * @return mixed
3986
-     */
3987
-    public function wp_page_slug()
3988
-    {
3989
-        return $this->_wp_page_slug;
3990
-    }
3991
-
3992
-
3993
-    /**
3994
-     * updates  espresso configuration settings
3995
-     *
3996
-     * @param string                   $tab
3997
-     * @param EE_Config_Base|EE_Config $config
3998
-     * @param string                   $file file where error occurred
3999
-     * @param string                   $func function  where error occurred
4000
-     * @param string                   $line line no where error occurred
4001
-     * @return boolean
4002
-     */
4003
-    protected function _update_espresso_configuration($tab, $config, $file = '', $func = '', $line = '')
4004
-    {
4005
-        // remove any options that are NOT going to be saved with the config settings.
4006
-        if (isset($config->core->ee_ueip_optin)) {
4007
-            // TODO: remove the following two lines and make sure values are migrated from 3.1
4008
-            update_option('ee_ueip_optin', $config->core->ee_ueip_optin);
4009
-            update_option('ee_ueip_has_notified', true);
4010
-        }
4011
-        // and save it (note we're also doing the network save here)
4012
-        $net_saved = is_main_site() ? EE_Network_Config::instance()->update_config(false, false) : true;
4013
-        $config_saved = EE_Config::instance()->update_espresso_config(false, false);
4014
-        if ($config_saved && $net_saved) {
4015
-            EE_Error::add_success(sprintf(__('"%s" have been successfully updated.', 'event_espresso'), $tab));
4016
-            return true;
4017
-        }
4018
-        EE_Error::add_error(sprintf(__('The "%s" were not updated.', 'event_espresso'), $tab), $file, $func, $line);
4019
-        return false;
4020
-    }
4021
-
4022
-
4023
-    /**
4024
-     * Returns an array to be used for EE_FOrm_Fields.helper.php's select_input as the $values argument.
4025
-     *
4026
-     * @return array
4027
-     */
4028
-    public function get_yes_no_values()
4029
-    {
4030
-        return $this->_yes_no_values;
4031
-    }
4032
-
4033
-
4034
-    /**
4035
-     * @return string
4036
-     * @throws ReflectionException
4037
-     * @since $VID:$
4038
-     */
4039
-    protected function _get_dir()
4040
-    {
4041
-        $reflector = new ReflectionClass(get_class($this));
4042
-        return dirname($reflector->getFileName());
4043
-    }
4044
-
4045
-
4046
-    /**
4047
-     * A helper for getting a "next link".
4048
-     *
4049
-     * @param string $url   The url to link to
4050
-     * @param string $class The class to use.
4051
-     * @return string
4052
-     */
4053
-    protected function _next_link($url, $class = 'dashicons dashicons-arrow-right')
4054
-    {
4055
-        return '<a class="' . $class . '" href="' . $url . '"></a>';
4056
-    }
4057
-
4058
-
4059
-    /**
4060
-     * A helper for getting a "previous link".
4061
-     *
4062
-     * @param string $url   The url to link to
4063
-     * @param string $class The class to use.
4064
-     * @return string
4065
-     */
4066
-    protected function _previous_link($url, $class = 'dashicons dashicons-arrow-left')
4067
-    {
4068
-        return '<a class="' . $class . '" href="' . $url . '"></a>';
4069
-    }
4070
-
4071
-
4072
-
4073
-
4074
-
4075
-
4076
-
4077
-    // below are some messages related methods that should be available across the EE_Admin system.  Note, these methods are NOT page specific
4078
-
4079
-
4080
-    /**
4081
-     * This processes an request to resend a registration and assumes we have a _REG_ID for doing so. So if the caller
4082
-     * 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
4083
-     * _req_data array.
4084
-     *
4085
-     * @return bool success/fail
4086
-     * @throws EE_Error
4087
-     * @throws InvalidArgumentException
4088
-     * @throws ReflectionException
4089
-     * @throws InvalidDataTypeException
4090
-     * @throws InvalidInterfaceException
4091
-     */
4092
-    protected function _process_resend_registration()
4093
-    {
4094
-        $this->_template_args['success'] = EED_Messages::process_resend($this->_req_data);
4095
-        do_action(
4096
-            'AHEE__EE_Admin_Page___process_resend_registration',
4097
-            $this->_template_args['success'],
4098
-            $this->_req_data
4099
-        );
4100
-        return $this->_template_args['success'];
4101
-    }
4102
-
4103
-
4104
-    /**
4105
-     * This automatically processes any payment message notifications when manual payment has been applied.
4106
-     *
4107
-     * @param EE_Payment $payment
4108
-     * @return bool success/fail
4109
-     */
4110
-    protected function _process_payment_notification(EE_Payment $payment)
4111
-    {
4112
-        add_filter('FHEE__EE_Payment_Processor__process_registration_payments__display_notifications', '__return_true');
4113
-        do_action('AHEE__EE_Admin_Page___process_admin_payment_notification', $payment);
4114
-        $this->_template_args['success'] = apply_filters(
4115
-            'FHEE__EE_Admin_Page___process_admin_payment_notification__success',
4116
-            false,
4117
-            $payment
4118
-        );
4119
-        return $this->_template_args['success'];
4120
-    }
2646
+	}
2647
+
2648
+
2649
+	/**
2650
+	 * facade for add_meta_box
2651
+	 *
2652
+	 * @param string  $action        where the metabox get's displayed
2653
+	 * @param string  $title         Title of Metabox (output in metabox header)
2654
+	 * @param string  $callback      If not empty and $create_fun is set to false then we'll use a custom callback
2655
+	 *                               instead of the one created in here.
2656
+	 * @param array   $callback_args an array of args supplied for the metabox
2657
+	 * @param string  $column        what metabox column
2658
+	 * @param string  $priority      give this metabox a priority (using accepted priorities for wp meta boxes)
2659
+	 * @param boolean $create_func   default is true.  Basically we can say we don't WANT to have the runtime function
2660
+	 *                               created but just set our own callback for wp's add_meta_box.
2661
+	 * @throws DomainException
2662
+	 */
2663
+	public function _add_admin_page_meta_box(
2664
+		$action,
2665
+		$title,
2666
+		$callback,
2667
+		$callback_args,
2668
+		$column = 'normal',
2669
+		$priority = 'high',
2670
+		$create_func = true
2671
+	) {
2672
+		do_action('AHEE_log', __FILE__, __FUNCTION__, $callback);
2673
+		// 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.
2674
+		if (empty($callback_args) && $create_func) {
2675
+			$callback_args = array(
2676
+				'template_path' => $this->_template_path,
2677
+				'template_args' => $this->_template_args,
2678
+			);
2679
+		}
2680
+		// 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)
2681
+		$call_back_func = $create_func
2682
+			? static function ($post, $metabox) {
2683
+				do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2684
+				echo EEH_Template::display_template(
2685
+					$metabox['args']['template_path'],
2686
+					$metabox['args']['template_args'],
2687
+					true
2688
+				);
2689
+			}
2690
+			: $callback;
2691
+		add_meta_box(
2692
+			str_replace('_', '-', $action) . '-mbox',
2693
+			$title,
2694
+			$call_back_func,
2695
+			$this->_wp_page_slug,
2696
+			$column,
2697
+			$priority,
2698
+			$callback_args
2699
+		);
2700
+	}
2701
+
2702
+
2703
+	/**
2704
+	 * generates HTML wrapper for and admin details page that contains metaboxes in columns
2705
+	 *
2706
+	 * @throws DomainException
2707
+	 * @throws EE_Error
2708
+	 * @throws InvalidArgumentException
2709
+	 * @throws InvalidDataTypeException
2710
+	 * @throws InvalidInterfaceException
2711
+	 */
2712
+	public function display_admin_page_with_metabox_columns()
2713
+	{
2714
+		$this->_template_args['post_body_content'] = $this->_template_args['admin_page_content'];
2715
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template(
2716
+			$this->_column_template_path,
2717
+			$this->_template_args,
2718
+			true
2719
+		);
2720
+		// the final wrapper
2721
+		$this->admin_page_wrapper();
2722
+	}
2723
+
2724
+
2725
+	/**
2726
+	 * generates  HTML wrapper for an admin details page
2727
+	 *
2728
+	 * @return void
2729
+	 * @throws DomainException
2730
+	 * @throws EE_Error
2731
+	 * @throws InvalidArgumentException
2732
+	 * @throws InvalidDataTypeException
2733
+	 * @throws InvalidInterfaceException
2734
+	 */
2735
+	public function display_admin_page_with_sidebar()
2736
+	{
2737
+		$this->_display_admin_page(true);
2738
+	}
2739
+
2740
+
2741
+	/**
2742
+	 * generates  HTML wrapper for an admin details page (except no sidebar)
2743
+	 *
2744
+	 * @return void
2745
+	 * @throws DomainException
2746
+	 * @throws EE_Error
2747
+	 * @throws InvalidArgumentException
2748
+	 * @throws InvalidDataTypeException
2749
+	 * @throws InvalidInterfaceException
2750
+	 */
2751
+	public function display_admin_page_with_no_sidebar()
2752
+	{
2753
+		$this->_display_admin_page();
2754
+	}
2755
+
2756
+
2757
+	/**
2758
+	 * generates HTML wrapper for an EE about admin page (no sidebar)
2759
+	 *
2760
+	 * @return void
2761
+	 * @throws DomainException
2762
+	 * @throws EE_Error
2763
+	 * @throws InvalidArgumentException
2764
+	 * @throws InvalidDataTypeException
2765
+	 * @throws InvalidInterfaceException
2766
+	 */
2767
+	public function display_about_admin_page()
2768
+	{
2769
+		$this->_display_admin_page(false, true);
2770
+	}
2771
+
2772
+
2773
+	/**
2774
+	 * display_admin_page
2775
+	 * contains the code for actually displaying an admin page
2776
+	 *
2777
+	 * @param boolean $sidebar true with sidebar, false without
2778
+	 * @param boolean $about   use the about admin wrapper instead of the default.
2779
+	 * @return void
2780
+	 * @throws DomainException
2781
+	 * @throws EE_Error
2782
+	 * @throws InvalidArgumentException
2783
+	 * @throws InvalidDataTypeException
2784
+	 * @throws InvalidInterfaceException
2785
+	 */
2786
+	private function _display_admin_page($sidebar = false, $about = false)
2787
+	{
2788
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2789
+		// custom remove metaboxes hook to add or remove any metaboxes to/from Admin pages.
2790
+		do_action('AHEE__EE_Admin_Page___display_admin_page__modify_metaboxes');
2791
+		// set current wp page slug - looks like: event-espresso_page_event_categories
2792
+		// keep in mind "event-espresso" COULD be something else if the top level menu label has been translated.
2793
+		$this->_template_args['current_page'] = $this->_wp_page_slug;
2794
+		$this->_template_args['admin_page_wrapper_div_id'] = $this->_cpt_route
2795
+			? 'poststuff'
2796
+			: 'espresso-default-admin';
2797
+		$template_path = $sidebar
2798
+			? EE_ADMIN_TEMPLATE . 'admin_details_wrapper.template.php'
2799
+			: EE_ADMIN_TEMPLATE . 'admin_details_wrapper_no_sidebar.template.php';
2800
+		if (defined('DOING_AJAX') && DOING_AJAX) {
2801
+			$template_path = EE_ADMIN_TEMPLATE . 'admin_details_wrapper_no_sidebar_ajax.template.php';
2802
+		}
2803
+		$template_path = ! empty($this->_column_template_path)
2804
+			? $this->_column_template_path : $template_path;
2805
+		$this->_template_args['post_body_content'] = isset($this->_template_args['admin_page_content'])
2806
+			? $this->_template_args['admin_page_content']
2807
+			: '';
2808
+		$this->_template_args['before_admin_page_content'] = isset($this->_template_args['before_admin_page_content'])
2809
+			? $this->_template_args['before_admin_page_content']
2810
+			: '';
2811
+		$this->_template_args['after_admin_page_content'] = isset($this->_template_args['after_admin_page_content'])
2812
+			? $this->_template_args['after_admin_page_content']
2813
+			: '';
2814
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template(
2815
+			$template_path,
2816
+			$this->_template_args,
2817
+			true
2818
+		);
2819
+		// the final template wrapper
2820
+		$this->admin_page_wrapper($about);
2821
+	}
2822
+
2823
+
2824
+	/**
2825
+	 * This is used to display caf preview pages.
2826
+	 *
2827
+	 * @since 4.3.2
2828
+	 * @param string $utm_campaign_source what is the key used for google analytics link
2829
+	 * @param bool   $display_sidebar     whether to use the sidebar template or the full template for the page.  TRUE
2830
+	 *                                    = SHOW sidebar, FALSE = no sidebar. Default no sidebar.
2831
+	 * @return void
2832
+	 * @throws DomainException
2833
+	 * @throws EE_Error
2834
+	 * @throws InvalidArgumentException
2835
+	 * @throws InvalidDataTypeException
2836
+	 * @throws InvalidInterfaceException
2837
+	 */
2838
+	public function display_admin_caf_preview_page($utm_campaign_source = '', $display_sidebar = true)
2839
+	{
2840
+		// let's generate a default preview action button if there isn't one already present.
2841
+		$this->_labels['buttons']['buy_now'] = esc_html__(
2842
+			'Upgrade to Event Espresso 4 Right Now',
2843
+			'event_espresso'
2844
+		);
2845
+		$buy_now_url = add_query_arg(
2846
+			array(
2847
+				'ee_ver'       => 'ee4',
2848
+				'utm_source'   => 'ee4_plugin_admin',
2849
+				'utm_medium'   => 'link',
2850
+				'utm_campaign' => $utm_campaign_source,
2851
+				'utm_content'  => 'buy_now_button',
2852
+			),
2853
+			'http://eventespresso.com/pricing/'
2854
+		);
2855
+		$this->_template_args['preview_action_button'] = ! isset($this->_template_args['preview_action_button'])
2856
+			? $this->get_action_link_or_button(
2857
+				'',
2858
+				'buy_now',
2859
+				array(),
2860
+				'button-primary button-large',
2861
+				$buy_now_url,
2862
+				true
2863
+			)
2864
+			: $this->_template_args['preview_action_button'];
2865
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template(
2866
+			EE_ADMIN_TEMPLATE . 'admin_caf_full_page_preview.template.php',
2867
+			$this->_template_args,
2868
+			true
2869
+		);
2870
+		$this->_display_admin_page($display_sidebar);
2871
+	}
2872
+
2873
+
2874
+	/**
2875
+	 * display_admin_list_table_page_with_sidebar
2876
+	 * generates HTML wrapper for an admin_page with list_table
2877
+	 *
2878
+	 * @return void
2879
+	 * @throws DomainException
2880
+	 * @throws EE_Error
2881
+	 * @throws InvalidArgumentException
2882
+	 * @throws InvalidDataTypeException
2883
+	 * @throws InvalidInterfaceException
2884
+	 */
2885
+	public function display_admin_list_table_page_with_sidebar()
2886
+	{
2887
+		$this->_display_admin_list_table_page(true);
2888
+	}
2889
+
2890
+
2891
+	/**
2892
+	 * display_admin_list_table_page_with_no_sidebar
2893
+	 * generates HTML wrapper for an admin_page with list_table (but with no sidebar)
2894
+	 *
2895
+	 * @return void
2896
+	 * @throws DomainException
2897
+	 * @throws EE_Error
2898
+	 * @throws InvalidArgumentException
2899
+	 * @throws InvalidDataTypeException
2900
+	 * @throws InvalidInterfaceException
2901
+	 */
2902
+	public function display_admin_list_table_page_with_no_sidebar()
2903
+	{
2904
+		$this->_display_admin_list_table_page();
2905
+	}
2906
+
2907
+
2908
+	/**
2909
+	 * generates html wrapper for an admin_list_table page
2910
+	 *
2911
+	 * @param boolean $sidebar whether to display with sidebar or not.
2912
+	 * @return void
2913
+	 * @throws DomainException
2914
+	 * @throws EE_Error
2915
+	 * @throws InvalidArgumentException
2916
+	 * @throws InvalidDataTypeException
2917
+	 * @throws InvalidInterfaceException
2918
+	 */
2919
+	private function _display_admin_list_table_page($sidebar = false)
2920
+	{
2921
+		// setup search attributes
2922
+		$this->_set_search_attributes();
2923
+		$this->_template_args['current_page'] = $this->_wp_page_slug;
2924
+		$template_path = EE_ADMIN_TEMPLATE . 'admin_list_wrapper.template.php';
2925
+		$this->_template_args['table_url'] = defined('DOING_AJAX')
2926
+			? add_query_arg(array('noheader' => 'true', 'route' => $this->_req_action), $this->_admin_base_url)
2927
+			: add_query_arg(array('route' => $this->_req_action), $this->_admin_base_url);
2928
+		$this->_template_args['list_table'] = $this->_list_table_object;
2929
+		$this->_template_args['current_route'] = $this->_req_action;
2930
+		$this->_template_args['list_table_class'] = get_class($this->_list_table_object);
2931
+		$ajax_sorting_callback = $this->_list_table_object->get_ajax_sorting_callback();
2932
+		if (! empty($ajax_sorting_callback)) {
2933
+			$sortable_list_table_form_fields = wp_nonce_field(
2934
+				$ajax_sorting_callback . '_nonce',
2935
+				$ajax_sorting_callback . '_nonce',
2936
+				false,
2937
+				false
2938
+			);
2939
+			$sortable_list_table_form_fields .= '<input type="hidden" id="ajax_table_sort_page" name="ajax_table_sort_page" value="'
2940
+												. $this->page_slug
2941
+												. '" />';
2942
+			$sortable_list_table_form_fields .= '<input type="hidden" id="ajax_table_sort_action" name="ajax_table_sort_action" value="'
2943
+												. $ajax_sorting_callback
2944
+												. '" />';
2945
+		} else {
2946
+			$sortable_list_table_form_fields = '';
2947
+		}
2948
+		$this->_template_args['sortable_list_table_form_fields'] = $sortable_list_table_form_fields;
2949
+		$hidden_form_fields = isset($this->_template_args['list_table_hidden_fields'])
2950
+			? $this->_template_args['list_table_hidden_fields']
2951
+			: '';
2952
+		$nonce_ref = $this->_req_action . '_nonce';
2953
+		$hidden_form_fields .= '<input type="hidden" name="'
2954
+							   . $nonce_ref
2955
+							   . '" value="'
2956
+							   . wp_create_nonce($nonce_ref)
2957
+							   . '">';
2958
+		$this->_template_args['list_table_hidden_fields'] = $hidden_form_fields;
2959
+		// display message about search results?
2960
+		$this->_template_args['before_list_table'] .= ! empty($this->_req_data['s'])
2961
+			? '<p class="ee-search-results">' . sprintf(
2962
+				esc_html__('Displaying search results for the search string: %1$s', 'event_espresso'),
2963
+				trim($this->_req_data['s'], '%')
2964
+			) . '</p>'
2965
+			: '';
2966
+		// filter before_list_table template arg
2967
+		$this->_template_args['before_list_table'] = apply_filters(
2968
+			'FHEE__EE_Admin_Page___display_admin_list_table_page__before_list_table__template_arg',
2969
+			$this->_template_args['before_list_table'],
2970
+			$this->page_slug,
2971
+			$this->_req_data,
2972
+			$this->_req_action
2973
+		);
2974
+		// convert to array and filter again
2975
+		// arrays are easier to inject new items in a specific location,
2976
+		// but would not be backwards compatible, so we have to add a new filter
2977
+		$this->_template_args['before_list_table'] = implode(
2978
+			" \n",
2979
+			(array) apply_filters(
2980
+				'FHEE__EE_Admin_Page___display_admin_list_table_page__before_list_table__template_args_array',
2981
+				(array) $this->_template_args['before_list_table'],
2982
+				$this->page_slug,
2983
+				$this->_req_data,
2984
+				$this->_req_action
2985
+			)
2986
+		);
2987
+		// filter after_list_table template arg
2988
+		$this->_template_args['after_list_table'] = apply_filters(
2989
+			'FHEE__EE_Admin_Page___display_admin_list_table_page__after_list_table__template_arg',
2990
+			$this->_template_args['after_list_table'],
2991
+			$this->page_slug,
2992
+			$this->_req_data,
2993
+			$this->_req_action
2994
+		);
2995
+		// convert to array and filter again
2996
+		// arrays are easier to inject new items in a specific location,
2997
+		// but would not be backwards compatible, so we have to add a new filter
2998
+		$this->_template_args['after_list_table'] = implode(
2999
+			" \n",
3000
+			(array) apply_filters(
3001
+				'FHEE__EE_Admin_Page___display_admin_list_table_page__after_list_table__template_args_array',
3002
+				(array) $this->_template_args['after_list_table'],
3003
+				$this->page_slug,
3004
+				$this->_req_data,
3005
+				$this->_req_action
3006
+			)
3007
+		);
3008
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template(
3009
+			$template_path,
3010
+			$this->_template_args,
3011
+			true
3012
+		);
3013
+		// the final template wrapper
3014
+		if ($sidebar) {
3015
+			$this->display_admin_page_with_sidebar();
3016
+		} else {
3017
+			$this->display_admin_page_with_no_sidebar();
3018
+		}
3019
+	}
3020
+
3021
+
3022
+	/**
3023
+	 * This just prepares a legend using the given items and the admin_details_legend.template.php file and returns the
3024
+	 * html string for the legend.
3025
+	 * $items are expected in an array in the following format:
3026
+	 * $legend_items = array(
3027
+	 *        'item_id' => array(
3028
+	 *            'icon' => 'http://url_to_icon_being_described.png',
3029
+	 *            'desc' => esc_html__('localized description of item');
3030
+	 *        )
3031
+	 * );
3032
+	 *
3033
+	 * @param  array $items see above for format of array
3034
+	 * @return string html string of legend
3035
+	 * @throws DomainException
3036
+	 */
3037
+	protected function _display_legend($items)
3038
+	{
3039
+		$this->_template_args['items'] = apply_filters(
3040
+			'FHEE__EE_Admin_Page___display_legend__items',
3041
+			(array) $items,
3042
+			$this
3043
+		);
3044
+		$this->_template_args['status_change_notice'] = EEH_Template::display_template(
3045
+			EE_ADMIN_TEMPLATE . 'status_change_notice.template.php',
3046
+			[ 'context' => '__admin-legend' ],
3047
+			true
3048
+		);
3049
+		return EEH_Template::display_template(
3050
+			EE_ADMIN_TEMPLATE . 'admin_details_legend.template.php',
3051
+			$this->_template_args,
3052
+			true
3053
+		);
3054
+	}
3055
+
3056
+
3057
+	/**
3058
+	 * This is used whenever we're DOING_AJAX to return a formatted json array that our calling javascript can expect
3059
+	 * The returned json object is created from an array in the following format:
3060
+	 * array(
3061
+	 *  'error' => FALSE, //(default FALSE), contains any errors and/or exceptions (exceptions return json early),
3062
+	 *  'success' => FALSE, //(default FALSE) - contains any special success message.
3063
+	 *  'notices' => '', // - contains any EE_Error formatted notices
3064
+	 *  'content' => 'string can be html', //this is a string of formatted content (can be html)
3065
+	 *  'data' => array() //this can be any key/value pairs that a method returns for later json parsing by the js.
3066
+	 *  We're also going to include the template args with every package (so js can pick out any specific template args
3067
+	 *  that might be included in here)
3068
+	 * )
3069
+	 * The json object is populated by whatever is set in the $_template_args property.
3070
+	 *
3071
+	 * @param bool  $sticky_notices    Used to indicate whether you want to ensure notices are added to a transient
3072
+	 *                                 instead of displayed.
3073
+	 * @param array $notices_arguments Use this to pass any additional args on to the _process_notices.
3074
+	 * @return void
3075
+	 * @throws EE_Error
3076
+	 * @throws InvalidArgumentException
3077
+	 * @throws InvalidDataTypeException
3078
+	 * @throws InvalidInterfaceException
3079
+	 */
3080
+	protected function _return_json($sticky_notices = false, $notices_arguments = array())
3081
+	{
3082
+		// make sure any EE_Error notices have been handled.
3083
+		$this->_process_notices($notices_arguments, true, $sticky_notices);
3084
+		$data = isset($this->_template_args['data']) ? $this->_template_args['data'] : array();
3085
+		unset($this->_template_args['data']);
3086
+		$json = array(
3087
+			'error'     => isset($this->_template_args['error']) ? $this->_template_args['error'] : false,
3088
+			'success'   => isset($this->_template_args['success']) ? $this->_template_args['success'] : false,
3089
+			'errors'    => isset($this->_template_args['errors']) ? $this->_template_args['errors'] : false,
3090
+			'attention' => isset($this->_template_args['attention']) ? $this->_template_args['attention'] : false,
3091
+			'notices'   => EE_Error::get_notices(),
3092
+			'content'   => isset($this->_template_args['admin_page_content'])
3093
+				? $this->_template_args['admin_page_content'] : '',
3094
+			'data'      => array_merge($data, array('template_args' => $this->_template_args)),
3095
+			'isEEajax'  => true
3096
+			// special flag so any ajax.Success methods in js can identify this return package as a EEajax package.
3097
+		);
3098
+		// make sure there are no php errors or headers_sent.  Then we can set correct json header.
3099
+		if (null === error_get_last() || ! headers_sent()) {
3100
+			header('Content-Type: application/json; charset=UTF-8');
3101
+		}
3102
+		echo wp_json_encode($json);
3103
+		exit();
3104
+	}
3105
+
3106
+
3107
+	/**
3108
+	 * Simply a wrapper for the protected method so we can call this outside the class (ONLY when doing ajax)
3109
+	 *
3110
+	 * @return void
3111
+	 * @throws EE_Error
3112
+	 * @throws InvalidArgumentException
3113
+	 * @throws InvalidDataTypeException
3114
+	 * @throws InvalidInterfaceException
3115
+	 */
3116
+	public function return_json()
3117
+	{
3118
+		if (defined('DOING_AJAX') && DOING_AJAX) {
3119
+			$this->_return_json();
3120
+		} else {
3121
+			throw new EE_Error(
3122
+				sprintf(
3123
+					esc_html__('The public %s method can only be called when DOING_AJAX = TRUE', 'event_espresso'),
3124
+					__FUNCTION__
3125
+				)
3126
+			);
3127
+		}
3128
+	}
3129
+
3130
+
3131
+	/**
3132
+	 * This provides a way for child hook classes to send along themselves by reference so methods/properties within
3133
+	 * them can be accessed by EE_Admin_child pages. This is assigned to the $_hook_obj property.
3134
+	 *
3135
+	 * @param EE_Admin_Hooks $hook_obj This will be the object for the EE_Admin_Hooks child
3136
+	 */
3137
+	public function set_hook_object(EE_Admin_Hooks $hook_obj)
3138
+	{
3139
+		$this->_hook_obj = $hook_obj;
3140
+	}
3141
+
3142
+
3143
+	/**
3144
+	 *        generates  HTML wrapper with Tabbed nav for an admin page
3145
+	 *
3146
+	 * @param boolean $about whether to use the special about page wrapper or default.
3147
+	 * @return void
3148
+	 * @throws DomainException
3149
+	 * @throws EE_Error
3150
+	 * @throws InvalidArgumentException
3151
+	 * @throws InvalidDataTypeException
3152
+	 * @throws InvalidInterfaceException
3153
+	 */
3154
+	public function admin_page_wrapper($about = false)
3155
+	{
3156
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
3157
+		$this->_nav_tabs = $this->_get_main_nav_tabs();
3158
+		$this->_template_args['nav_tabs'] = $this->_nav_tabs;
3159
+		$this->_template_args['admin_page_title'] = $this->_admin_page_title;
3160
+		$this->_template_args['before_admin_page_content'] = apply_filters(
3161
+			"FHEE_before_admin_page_content{$this->_current_page}{$this->_current_view}",
3162
+			isset($this->_template_args['before_admin_page_content'])
3163
+				? $this->_template_args['before_admin_page_content']
3164
+				: ''
3165
+		);
3166
+		$this->_template_args['after_admin_page_content'] = apply_filters(
3167
+			"FHEE_after_admin_page_content{$this->_current_page}{$this->_current_view}",
3168
+			isset($this->_template_args['after_admin_page_content'])
3169
+				? $this->_template_args['after_admin_page_content']
3170
+				: ''
3171
+		);
3172
+		$this->_template_args['after_admin_page_content'] .= $this->_set_help_popup_content();
3173
+		// load settings page wrapper template
3174
+		$template_path = ! defined('DOING_AJAX')
3175
+			? EE_ADMIN_TEMPLATE . 'admin_wrapper.template.php'
3176
+			: EE_ADMIN_TEMPLATE
3177
+			  . 'admin_wrapper_ajax.template.php';
3178
+		// about page?
3179
+		$template_path = $about
3180
+			? EE_ADMIN_TEMPLATE . 'about_admin_wrapper.template.php'
3181
+			: $template_path;
3182
+		if (defined('DOING_AJAX')) {
3183
+			$this->_template_args['admin_page_content'] = EEH_Template::display_template(
3184
+				$template_path,
3185
+				$this->_template_args,
3186
+				true
3187
+			);
3188
+			$this->_return_json();
3189
+		} else {
3190
+			EEH_Template::display_template($template_path, $this->_template_args);
3191
+		}
3192
+	}
3193
+
3194
+
3195
+	/**
3196
+	 * This returns the admin_nav tabs html using the configuration in the _nav_tabs property
3197
+	 *
3198
+	 * @return string html
3199
+	 * @throws EE_Error
3200
+	 */
3201
+	protected function _get_main_nav_tabs()
3202
+	{
3203
+		// let's generate the html using the EEH_Tabbed_Content helper.
3204
+		// We do this here so that it's possible for child classes to add in nav tabs dynamically at the last minute
3205
+		// (rather than setting in the page_routes array)
3206
+		return EEH_Tabbed_Content::display_admin_nav_tabs($this->_nav_tabs);
3207
+	}
3208
+
3209
+
3210
+	/**
3211
+	 *        sort nav tabs
3212
+	 *
3213
+	 * @param $a
3214
+	 * @param $b
3215
+	 * @return int
3216
+	 */
3217
+	private function _sort_nav_tabs($a, $b)
3218
+	{
3219
+		if ($a['order'] === $b['order']) {
3220
+			return 0;
3221
+		}
3222
+		return ($a['order'] < $b['order']) ? -1 : 1;
3223
+	}
3224
+
3225
+
3226
+	/**
3227
+	 *    generates HTML for the forms used on admin pages
3228
+	 *
3229
+	 * @param    array $input_vars - array of input field details
3230
+	 * @param string   $generator  (options are 'string' or 'array', basically use this to indicate which generator to
3231
+	 *                             use)
3232
+	 * @param bool     $id
3233
+	 * @return string
3234
+	 * @uses   EEH_Form_Fields::get_form_fields (/helper/EEH_Form_Fields.helper.php)
3235
+	 * @uses   EEH_Form_Fields::get_form_fields_array (/helper/EEH_Form_Fields.helper.php)
3236
+	 */
3237
+	protected function _generate_admin_form_fields($input_vars = array(), $generator = 'string', $id = false)
3238
+	{
3239
+		return $generator === 'string'
3240
+			? EEH_Form_Fields::get_form_fields($input_vars, $id)
3241
+			: EEH_Form_Fields::get_form_fields_array($input_vars);
3242
+	}
3243
+
3244
+
3245
+	/**
3246
+	 * generates the "Save" and "Save & Close" buttons for edit forms
3247
+	 *
3248
+	 * @param bool             $both     if true then both buttons will be generated.  If false then just the "Save &
3249
+	 *                                   Close" button.
3250
+	 * @param array            $text     if included, generator will use the given text for the buttons ( array([0] =>
3251
+	 *                                   'Save', [1] => 'save & close')
3252
+	 * @param array            $actions  if included allows us to set the actions that each button will carry out (i.e.
3253
+	 *                                   via the "name" value in the button).  We can also use this to just dump
3254
+	 *                                   default actions by submitting some other value.
3255
+	 * @param bool|string|null $referrer if false then we just do the default action on save and close.  Other wise it
3256
+	 *                                   will use the $referrer string. IF null, then we don't do ANYTHING on save and
3257
+	 *                                   close (normal form handling).
3258
+	 */
3259
+	protected function _set_save_buttons($both = true, $text = array(), $actions = array(), $referrer = null)
3260
+	{
3261
+		// make sure $text and $actions are in an array
3262
+		$text = (array) $text;
3263
+		$actions = (array) $actions;
3264
+		$referrer_url = empty($referrer)
3265
+			? '<input type="hidden" id="save_and_close_referrer" name="save_and_close_referrer" value="'
3266
+			  . $_SERVER['REQUEST_URI']
3267
+			  . '" />'
3268
+			: '<input type="hidden" id="save_and_close_referrer" name="save_and_close_referrer" value="'
3269
+			  . $referrer
3270
+			  . '" />';
3271
+		$button_text = ! empty($text)
3272
+			? $text
3273
+			: array(
3274
+				esc_html__('Save', 'event_espresso'),
3275
+				esc_html__('Save and Close', 'event_espresso'),
3276
+			);
3277
+		$default_names = array('save', 'save_and_close');
3278
+		// add in a hidden index for the current page (so save and close redirects properly)
3279
+		$this->_template_args['save_buttons'] = $referrer_url;
3280
+		foreach ($button_text as $key => $button) {
3281
+			$ref = $default_names[ $key ];
3282
+			$this->_template_args['save_buttons'] .= '<input type="submit" class="button-primary '
3283
+													 . $ref
3284
+													 . '" value="'
3285
+													 . $button
3286
+													 . '" name="'
3287
+													 . (! empty($actions) ? $actions[ $key ] : $ref)
3288
+													 . '" id="'
3289
+													 . $this->_current_view . '_' . $ref
3290
+													 . '" />';
3291
+			if (! $both) {
3292
+				break;
3293
+			}
3294
+		}
3295
+	}
3296
+
3297
+
3298
+	/**
3299
+	 * Wrapper for the protected function.  Allows plugins/addons to call this to set the form tags.
3300
+	 *
3301
+	 * @see   $this->_set_add_edit_form_tags() for details on params
3302
+	 * @since 4.6.0
3303
+	 * @param string $route
3304
+	 * @param array  $additional_hidden_fields
3305
+	 */
3306
+	public function set_add_edit_form_tags($route = '', $additional_hidden_fields = array())
3307
+	{
3308
+		$this->_set_add_edit_form_tags($route, $additional_hidden_fields);
3309
+	}
3310
+
3311
+
3312
+	/**
3313
+	 * set form open and close tags on add/edit pages.
3314
+	 *
3315
+	 * @param string $route                    the route you want the form to direct to
3316
+	 * @param array  $additional_hidden_fields any additional hidden fields required in the form header
3317
+	 * @return void
3318
+	 */
3319
+	protected function _set_add_edit_form_tags($route = '', $additional_hidden_fields = array())
3320
+	{
3321
+		if (empty($route)) {
3322
+			$user_msg = esc_html__(
3323
+				'An error occurred. No action was set for this page\'s form.',
3324
+				'event_espresso'
3325
+			);
3326
+			$dev_msg = $user_msg . "\n"
3327
+					   . sprintf(
3328
+						   esc_html__('The $route argument is required for the %s->%s method.', 'event_espresso'),
3329
+						   __FUNCTION__,
3330
+						   EE_Admin_Page::class
3331
+					   );
3332
+			EE_Error::add_error($user_msg . '||' . $dev_msg, __FILE__, __FUNCTION__, __LINE__);
3333
+		}
3334
+		// open form
3335
+		$this->_template_args['before_admin_page_content'] = '<form name="form" method="post" action="'
3336
+															 . $this->_admin_base_url
3337
+															 . '" id="'
3338
+															 . $route
3339
+															 . '_event_form" >';
3340
+		// add nonce
3341
+		$nonce = wp_nonce_field($route . '_nonce', $route . '_nonce', false, false);
3342
+		$this->_template_args['before_admin_page_content'] .= "\n\t" . $nonce;
3343
+		// add REQUIRED form action
3344
+		$hidden_fields = array(
3345
+			'action' => array('type' => 'hidden', 'value' => $route),
3346
+		);
3347
+		// merge arrays
3348
+		$hidden_fields = is_array($additional_hidden_fields)
3349
+			? array_merge($hidden_fields, $additional_hidden_fields)
3350
+			: $hidden_fields;
3351
+		// generate form fields
3352
+		$form_fields = $this->_generate_admin_form_fields($hidden_fields, 'array');
3353
+		// add fields to form
3354
+		foreach ((array) $form_fields as $field_name => $form_field) {
3355
+			$this->_template_args['before_admin_page_content'] .= "\n\t" . $form_field['field'];
3356
+		}
3357
+		// close form
3358
+		$this->_template_args['after_admin_page_content'] = '</form>';
3359
+	}
3360
+
3361
+
3362
+	/**
3363
+	 * Public Wrapper for _redirect_after_action() method since its
3364
+	 * discovered it would be useful for external code to have access.
3365
+	 *
3366
+	 * @param bool   $success
3367
+	 * @param string $what
3368
+	 * @param string $action_desc
3369
+	 * @param array  $query_args
3370
+	 * @param bool   $override_overwrite
3371
+	 * @throws EE_Error
3372
+	 * @throws InvalidArgumentException
3373
+	 * @throws InvalidDataTypeException
3374
+	 * @throws InvalidInterfaceException
3375
+	 * @see   EE_Admin_Page::_redirect_after_action() for params.
3376
+	 * @since 4.5.0
3377
+	 */
3378
+	public function redirect_after_action(
3379
+		$success = false,
3380
+		$what = 'item',
3381
+		$action_desc = 'processed',
3382
+		$query_args = array(),
3383
+		$override_overwrite = false
3384
+	) {
3385
+		$this->_redirect_after_action(
3386
+			$success,
3387
+			$what,
3388
+			$action_desc,
3389
+			$query_args,
3390
+			$override_overwrite
3391
+		);
3392
+	}
3393
+
3394
+
3395
+	/**
3396
+	 * Helper method for merging existing request data with the returned redirect url.
3397
+	 *
3398
+	 * This is typically used for redirects after an action so that if the original view was a filtered view those
3399
+	 * filters are still applied.
3400
+	 *
3401
+	 * @param array $new_route_data
3402
+	 * @return array
3403
+	 */
3404
+	protected function mergeExistingRequestParamsWithRedirectArgs(array $new_route_data)
3405
+	{
3406
+		foreach ($this->_req_data as $ref => $value) {
3407
+			// unset nonces
3408
+			if (strpos($ref, 'nonce') !== false) {
3409
+				unset($this->_req_data[ $ref ]);
3410
+				continue;
3411
+			}
3412
+			// urlencode values.
3413
+			$value = is_array($value) ? array_map('urlencode', $value) : urlencode($value);
3414
+			$this->_req_data[ $ref ] = $value;
3415
+		}
3416
+		return array_merge($this->_req_data, $new_route_data);
3417
+	}
3418
+
3419
+
3420
+	/**
3421
+	 *    _redirect_after_action
3422
+	 *
3423
+	 * @param int    $success            - whether success was for two or more records, or just one, or none
3424
+	 * @param string $what               - what the action was performed on
3425
+	 * @param string $action_desc        - what was done ie: updated, deleted, etc
3426
+	 * @param array  $query_args         - an array of query_args to be added to the URL to redirect to after the admin
3427
+	 *                                   action is completed
3428
+	 * @param BOOL   $override_overwrite by default all EE_Error::success messages are overwritten, this allows you to
3429
+	 *                                   override this so that they show.
3430
+	 * @return void
3431
+	 * @throws EE_Error
3432
+	 * @throws InvalidArgumentException
3433
+	 * @throws InvalidDataTypeException
3434
+	 * @throws InvalidInterfaceException
3435
+	 */
3436
+	protected function _redirect_after_action(
3437
+		$success = 0,
3438
+		$what = 'item',
3439
+		$action_desc = 'processed',
3440
+		$query_args = array(),
3441
+		$override_overwrite = false
3442
+	) {
3443
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
3444
+		// class name for actions/filters.
3445
+		$classname = get_class($this);
3446
+		// set redirect url.
3447
+		// Note if there is a "page" index in the $query_args then we go with vanilla admin.php route,
3448
+		// otherwise we go with whatever is set as the _admin_base_url
3449
+		$redirect_url = isset($query_args['page']) ? admin_url('admin.php') : $this->_admin_base_url;
3450
+		$notices = EE_Error::get_notices(false);
3451
+		// overwrite default success messages //BUT ONLY if overwrite not overridden
3452
+		if (! $override_overwrite || ! empty($notices['errors'])) {
3453
+			EE_Error::overwrite_success();
3454
+		}
3455
+		if (! empty($what) && ! empty($action_desc) && empty($notices['errors'])) {
3456
+			// how many records affected ? more than one record ? or just one ?
3457
+			if ($success > 1) {
3458
+				// set plural msg
3459
+				EE_Error::add_success(
3460
+					sprintf(
3461
+						esc_html__('The "%s" have been successfully %s.', 'event_espresso'),
3462
+						$what,
3463
+						$action_desc
3464
+					),
3465
+					__FILE__,
3466
+					__FUNCTION__,
3467
+					__LINE__
3468
+				);
3469
+			} elseif ($success === 1) {
3470
+				// set singular msg
3471
+				EE_Error::add_success(
3472
+					sprintf(
3473
+						esc_html__('The "%s" has been successfully %s.', 'event_espresso'),
3474
+						$what,
3475
+						$action_desc
3476
+					),
3477
+					__FILE__,
3478
+					__FUNCTION__,
3479
+					__LINE__
3480
+				);
3481
+			}
3482
+		}
3483
+		// check that $query_args isn't something crazy
3484
+		if (! is_array($query_args)) {
3485
+			$query_args = array();
3486
+		}
3487
+		/**
3488
+		 * Allow injecting actions before the query_args are modified for possible different
3489
+		 * redirections on save and close actions
3490
+		 *
3491
+		 * @since 4.2.0
3492
+		 * @param array $query_args       The original query_args array coming into the
3493
+		 *                                method.
3494
+		 */
3495
+		do_action(
3496
+			"AHEE__{$classname}___redirect_after_action__before_redirect_modification_{$this->_req_action}",
3497
+			$query_args
3498
+		);
3499
+		// calculate where we're going (if we have a "save and close" button pushed)
3500
+		if (isset($this->_req_data['save_and_close'], $this->_req_data['save_and_close_referrer'])) {
3501
+			// even though we have the save_and_close referrer, we need to parse the url for the action in order to generate a nonce
3502
+			$parsed_url = parse_url($this->_req_data['save_and_close_referrer']);
3503
+			// regenerate query args array from referrer URL
3504
+			parse_str($parsed_url['query'], $query_args);
3505
+			// correct page and action will be in the query args now
3506
+			$redirect_url = admin_url('admin.php');
3507
+		}
3508
+		// merge any default query_args set in _default_route_query_args property
3509
+		if (! empty($this->_default_route_query_args) && ! $this->_is_UI_request) {
3510
+			$args_to_merge = array();
3511
+			foreach ($this->_default_route_query_args as $query_param => $query_value) {
3512
+				// is there a wp_referer array in our _default_route_query_args property?
3513
+				if ($query_param === 'wp_referer') {
3514
+					$query_value = (array) $query_value;
3515
+					foreach ($query_value as $reference => $value) {
3516
+						if (strpos($reference, 'nonce') !== false) {
3517
+							continue;
3518
+						}
3519
+						// finally we will override any arguments in the referer with
3520
+						// what might be set on the _default_route_query_args array.
3521
+						if (isset($this->_default_route_query_args[ $reference ])) {
3522
+							$args_to_merge[ $reference ] = urlencode($this->_default_route_query_args[ $reference ]);
3523
+						} else {
3524
+							$args_to_merge[ $reference ] = urlencode($value);
3525
+						}
3526
+					}
3527
+					continue;
3528
+				}
3529
+				$args_to_merge[ $query_param ] = $query_value;
3530
+			}
3531
+			// now let's merge these arguments but override with what was specifically sent in to the
3532
+			// redirect.
3533
+			$query_args = array_merge($args_to_merge, $query_args);
3534
+		}
3535
+		$this->_process_notices($query_args);
3536
+		// generate redirect url
3537
+		// if redirecting to anything other than the main page, add a nonce
3538
+		if (isset($query_args['action'])) {
3539
+			// manually generate wp_nonce and merge that with the query vars
3540
+			// becuz the wp_nonce_url function wrecks havoc on some vars
3541
+			$query_args['_wpnonce'] = wp_create_nonce($query_args['action'] . '_nonce');
3542
+		}
3543
+		// we're adding some hooks and filters in here for processing any things just before redirects
3544
+		// (example: an admin page has done an insert or update and we want to run something after that).
3545
+		do_action('AHEE_redirect_' . $classname . $this->_req_action, $query_args);
3546
+		$redirect_url = apply_filters(
3547
+			'FHEE_redirect_' . $classname . $this->_req_action,
3548
+			EE_Admin_Page::add_query_args_and_nonce($query_args, $redirect_url),
3549
+			$query_args
3550
+		);
3551
+		// check if we're doing ajax.  If we are then lets just return the results and js can handle how it wants.
3552
+		if (defined('DOING_AJAX')) {
3553
+			$default_data = array(
3554
+				'close'        => true,
3555
+				'redirect_url' => $redirect_url,
3556
+				'where'        => 'main',
3557
+				'what'         => 'append',
3558
+			);
3559
+			$this->_template_args['success'] = $success;
3560
+			$this->_template_args['data'] = ! empty($this->_template_args['data']) ? array_merge(
3561
+				$default_data,
3562
+				$this->_template_args['data']
3563
+			) : $default_data;
3564
+			$this->_return_json();
3565
+		}
3566
+		wp_safe_redirect($redirect_url);
3567
+		exit();
3568
+	}
3569
+
3570
+
3571
+	/**
3572
+	 * process any notices before redirecting (or returning ajax request)
3573
+	 * This method sets the $this->_template_args['notices'] attribute;
3574
+	 *
3575
+	 * @param array $query_args         any query args that need to be used for notice transient ('action')
3576
+	 * @param bool  $skip_route_verify  This is typically used when we are processing notices REALLY early and
3577
+	 *                                  page_routes haven't been defined yet.
3578
+	 * @param bool  $sticky_notices     This is used to flag that regardless of whether this is doing_ajax or not, we
3579
+	 *                                  still save a transient for the notice.
3580
+	 * @return void
3581
+	 * @throws EE_Error
3582
+	 * @throws InvalidArgumentException
3583
+	 * @throws InvalidDataTypeException
3584
+	 * @throws InvalidInterfaceException
3585
+	 */
3586
+	protected function _process_notices($query_args = array(), $skip_route_verify = false, $sticky_notices = true)
3587
+	{
3588
+		// first let's set individual error properties if doing_ajax and the properties aren't already set.
3589
+		if (defined('DOING_AJAX') && DOING_AJAX) {
3590
+			$notices = EE_Error::get_notices(false);
3591
+			if (empty($this->_template_args['success'])) {
3592
+				$this->_template_args['success'] = isset($notices['success']) ? $notices['success'] : false;
3593
+			}
3594
+			if (empty($this->_template_args['errors'])) {
3595
+				$this->_template_args['errors'] = isset($notices['errors']) ? $notices['errors'] : false;
3596
+			}
3597
+			if (empty($this->_template_args['attention'])) {
3598
+				$this->_template_args['attention'] = isset($notices['attention']) ? $notices['attention'] : false;
3599
+			}
3600
+		}
3601
+		$this->_template_args['notices'] = EE_Error::get_notices();
3602
+		// IF this isn't ajax we need to create a transient for the notices using the route (however, overridden if $sticky_notices == true)
3603
+		if (! defined('DOING_AJAX') || $sticky_notices) {
3604
+			$route = isset($query_args['action']) ? $query_args['action'] : 'default';
3605
+			$this->_add_transient(
3606
+				$route,
3607
+				$this->_template_args['notices'],
3608
+				true,
3609
+				$skip_route_verify
3610
+			);
3611
+		}
3612
+	}
3613
+
3614
+
3615
+	/**
3616
+	 * get_action_link_or_button
3617
+	 * returns the button html for adding, editing, or deleting an item (depending on given type)
3618
+	 *
3619
+	 * @param string $action        use this to indicate which action the url is generated with.
3620
+	 * @param string $type          accepted strings must be defined in the $_labels['button'] array(as the key)
3621
+	 *                              property.
3622
+	 * @param array  $extra_request if the button requires extra params you can include them in $key=>$value pairs.
3623
+	 * @param string $class         Use this to give the class for the button. Defaults to 'button-primary'
3624
+	 * @param string $base_url      If this is not provided
3625
+	 *                              the _admin_base_url will be used as the default for the button base_url.
3626
+	 *                              Otherwise this value will be used.
3627
+	 * @param bool   $exclude_nonce If true then no nonce will be in the generated button link.
3628
+	 * @return string
3629
+	 * @throws InvalidArgumentException
3630
+	 * @throws InvalidInterfaceException
3631
+	 * @throws InvalidDataTypeException
3632
+	 * @throws EE_Error
3633
+	 */
3634
+	public function get_action_link_or_button(
3635
+		$action,
3636
+		$type = 'add',
3637
+		$extra_request = array(),
3638
+		$class = 'button-primary',
3639
+		$base_url = '',
3640
+		$exclude_nonce = false
3641
+	) {
3642
+		// first let's validate the action (if $base_url is FALSE otherwise validation will happen further along)
3643
+		if (empty($base_url) && ! isset($this->_page_routes[ $action ])) {
3644
+			throw new EE_Error(
3645
+				sprintf(
3646
+					esc_html__(
3647
+						'There is no page route for given action for the button.  This action was given: %s',
3648
+						'event_espresso'
3649
+					),
3650
+					$action
3651
+				)
3652
+			);
3653
+		}
3654
+		if (! isset($this->_labels['buttons'][ $type ])) {
3655
+			throw new EE_Error(
3656
+				sprintf(
3657
+					__(
3658
+						'There is no label for the given button type (%s). Labels are set in the <code>_page_config</code> property.',
3659
+						'event_espresso'
3660
+					),
3661
+					$type
3662
+				)
3663
+			);
3664
+		}
3665
+		// finally check user access for this button.
3666
+		$has_access = $this->check_user_access($action, true);
3667
+		if (! $has_access) {
3668
+			return '';
3669
+		}
3670
+		$_base_url = ! $base_url ? $this->_admin_base_url : $base_url;
3671
+		$query_args = array(
3672
+			'action' => $action,
3673
+		);
3674
+		// merge extra_request args but make sure our original action takes precedence and doesn't get overwritten.
3675
+		if (! empty($extra_request)) {
3676
+			$query_args = array_merge($extra_request, $query_args);
3677
+		}
3678
+		$url = EE_Admin_Page::add_query_args_and_nonce($query_args, $_base_url, false, $exclude_nonce);
3679
+		return EEH_Template::get_button_or_link($url, $this->_labels['buttons'][ $type ], $class);
3680
+	}
3681
+
3682
+
3683
+	/**
3684
+	 * _per_page_screen_option
3685
+	 * Utility function for adding in a per_page_option in the screen_options_dropdown.
3686
+	 *
3687
+	 * @return void
3688
+	 * @throws InvalidArgumentException
3689
+	 * @throws InvalidInterfaceException
3690
+	 * @throws InvalidDataTypeException
3691
+	 */
3692
+	protected function _per_page_screen_option()
3693
+	{
3694
+		$option = 'per_page';
3695
+		$args = array(
3696
+			'label'   => apply_filters(
3697
+				'FHEE__EE_Admin_Page___per_page_screen_options___label',
3698
+				$this->_admin_page_title,
3699
+				$this
3700
+			),
3701
+			'default' => (int) apply_filters(
3702
+				'FHEE__EE_Admin_Page___per_page_screen_options__default',
3703
+				20
3704
+			),
3705
+			'option'  => $this->_current_page . '_' . $this->_current_view . '_per_page',
3706
+		);
3707
+		// ONLY add the screen option if the user has access to it.
3708
+		if ($this->check_user_access($this->_current_view, true)) {
3709
+			add_screen_option($option, $args);
3710
+		}
3711
+	}
3712
+
3713
+
3714
+	/**
3715
+	 * set_per_page_screen_option
3716
+	 * All this does is make sure that WordPress saves any per_page screen options (if set) for the current page.
3717
+	 * we have to do this rather than running inside the 'set-screen-options' hook because it runs earlier than
3718
+	 * admin_menu.
3719
+	 *
3720
+	 * @return void
3721
+	 */
3722
+	private function _set_per_page_screen_options()
3723
+	{
3724
+		if (isset($_POST['wp_screen_options']) && is_array($_POST['wp_screen_options'])) {
3725
+			check_admin_referer('screen-options-nonce', 'screenoptionnonce');
3726
+			if (! $user = wp_get_current_user()) {
3727
+				return;
3728
+			}
3729
+			$option = $_POST['wp_screen_options']['option'];
3730
+			$value = $_POST['wp_screen_options']['value'];
3731
+			if ($option !== sanitize_key($option)) {
3732
+				return;
3733
+			}
3734
+			$map_option = $option;
3735
+			$option = str_replace('-', '_', $option);
3736
+			switch ($map_option) {
3737
+				case $this->_current_page . '_' . $this->_current_view . '_per_page':
3738
+					$value = (int) $value;
3739
+					$max_value = apply_filters(
3740
+						'FHEE__EE_Admin_Page___set_per_page_screen_options__max_value',
3741
+						999,
3742
+						$this->_current_page,
3743
+						$this->_current_view
3744
+					);
3745
+					if ($value < 1) {
3746
+						return;
3747
+					}
3748
+					$value = min($value, $max_value);
3749
+					break;
3750
+				default:
3751
+					$value = apply_filters(
3752
+						'FHEE__EE_Admin_Page___set_per_page_screen_options__value',
3753
+						false,
3754
+						$option,
3755
+						$value
3756
+					);
3757
+					if (false === $value) {
3758
+						return;
3759
+					}
3760
+					break;
3761
+			}
3762
+			update_user_meta($user->ID, $option, $value);
3763
+			wp_safe_redirect(remove_query_arg(array('pagenum', 'apage', 'paged'), wp_get_referer()));
3764
+			exit;
3765
+		}
3766
+	}
3767
+
3768
+
3769
+	/**
3770
+	 * This just allows for setting the $_template_args property if it needs to be set outside the object
3771
+	 *
3772
+	 * @param array $data array that will be assigned to template args.
3773
+	 */
3774
+	public function set_template_args($data)
3775
+	{
3776
+		$this->_template_args = array_merge($this->_template_args, (array) $data);
3777
+	}
3778
+
3779
+
3780
+	/**
3781
+	 * This makes available the WP transient system for temporarily moving data between routes
3782
+	 *
3783
+	 * @param string $route             the route that should receive the transient
3784
+	 * @param array  $data              the data that gets sent
3785
+	 * @param bool   $notices           If this is for notices then we use this to indicate so, otherwise its just a
3786
+	 *                                  normal route transient.
3787
+	 * @param bool   $skip_route_verify Used to indicate we want to skip route verification.  This is usually ONLY used
3788
+	 *                                  when we are adding a transient before page_routes have been defined.
3789
+	 * @return void
3790
+	 * @throws EE_Error
3791
+	 */
3792
+	protected function _add_transient($route, $data, $notices = false, $skip_route_verify = false)
3793
+	{
3794
+		$user_id = get_current_user_id();
3795
+		if (! $skip_route_verify) {
3796
+			$this->_verify_route($route);
3797
+		}
3798
+		// now let's set the string for what kind of transient we're setting
3799
+		$transient = $notices
3800
+			? 'ee_rte_n_tx_' . $route . '_' . $user_id
3801
+			: 'rte_tx_' . $route . '_' . $user_id;
3802
+		$data = $notices ? array('notices' => $data) : $data;
3803
+		// is there already a transient for this route?  If there is then let's ADD to that transient
3804
+		$existing = is_multisite() && is_network_admin()
3805
+			? get_site_transient($transient)
3806
+			: get_transient($transient);
3807
+		if ($existing) {
3808
+			$data = array_merge((array) $data, (array) $existing);
3809
+		}
3810
+		if (is_multisite() && is_network_admin()) {
3811
+			set_site_transient($transient, $data, 8);
3812
+		} else {
3813
+			set_transient($transient, $data, 8);
3814
+		}
3815
+	}
3816
+
3817
+
3818
+	/**
3819
+	 * this retrieves the temporary transient that has been set for moving data between routes.
3820
+	 *
3821
+	 * @param bool   $notices true we get notices transient. False we just return normal route transient
3822
+	 * @param string $route
3823
+	 * @return mixed data
3824
+	 */
3825
+	protected function _get_transient($notices = false, $route = '')
3826
+	{
3827
+		$user_id = get_current_user_id();
3828
+		$route = ! $route ? $this->_req_action : $route;
3829
+		$transient = $notices
3830
+			? 'ee_rte_n_tx_' . $route . '_' . $user_id
3831
+			: 'rte_tx_' . $route . '_' . $user_id;
3832
+		$data = is_multisite() && is_network_admin()
3833
+			? get_site_transient($transient)
3834
+			: get_transient($transient);
3835
+		// delete transient after retrieval (just in case it hasn't expired);
3836
+		if (is_multisite() && is_network_admin()) {
3837
+			delete_site_transient($transient);
3838
+		} else {
3839
+			delete_transient($transient);
3840
+		}
3841
+		return $notices && isset($data['notices']) ? $data['notices'] : $data;
3842
+	}
3843
+
3844
+
3845
+	/**
3846
+	 * The purpose of this method is just to run garbage collection on any EE transients that might have expired but
3847
+	 * would not be called later. This will be assigned to run on a specific EE Admin page. (place the method in the
3848
+	 * default route callback on the EE_Admin page you want it run.)
3849
+	 *
3850
+	 * @return void
3851
+	 */
3852
+	protected function _transient_garbage_collection()
3853
+	{
3854
+		global $wpdb;
3855
+		// retrieve all existing transients
3856
+		$query = "SELECT option_name FROM {$wpdb->options} WHERE option_name LIKE '%rte_tx_%' OR option_name LIKE '%rte_n_tx_%'";
3857
+		if ($results = $wpdb->get_results($query)) {
3858
+			foreach ($results as $result) {
3859
+				$transient = str_replace('_transient_', '', $result->option_name);
3860
+				get_transient($transient);
3861
+				if (is_multisite() && is_network_admin()) {
3862
+					get_site_transient($transient);
3863
+				}
3864
+			}
3865
+		}
3866
+	}
3867
+
3868
+
3869
+	/**
3870
+	 * get_view
3871
+	 *
3872
+	 * @return string content of _view property
3873
+	 */
3874
+	public function get_view()
3875
+	{
3876
+		return $this->_view;
3877
+	}
3878
+
3879
+
3880
+	/**
3881
+	 * getter for the protected $_views property
3882
+	 *
3883
+	 * @return array
3884
+	 */
3885
+	public function get_views()
3886
+	{
3887
+		return $this->_views;
3888
+	}
3889
+
3890
+
3891
+	/**
3892
+	 * get_current_page
3893
+	 *
3894
+	 * @return string _current_page property value
3895
+	 */
3896
+	public function get_current_page()
3897
+	{
3898
+		return $this->_current_page;
3899
+	}
3900
+
3901
+
3902
+	/**
3903
+	 * get_current_view
3904
+	 *
3905
+	 * @return string _current_view property value
3906
+	 */
3907
+	public function get_current_view()
3908
+	{
3909
+		return $this->_current_view;
3910
+	}
3911
+
3912
+
3913
+	/**
3914
+	 * get_current_screen
3915
+	 *
3916
+	 * @return object The current WP_Screen object
3917
+	 */
3918
+	public function get_current_screen()
3919
+	{
3920
+		return $this->_current_screen;
3921
+	}
3922
+
3923
+
3924
+	/**
3925
+	 * get_current_page_view_url
3926
+	 *
3927
+	 * @return string This returns the url for the current_page_view.
3928
+	 */
3929
+	public function get_current_page_view_url()
3930
+	{
3931
+		return $this->_current_page_view_url;
3932
+	}
3933
+
3934
+
3935
+	/**
3936
+	 * just returns the _req_data property
3937
+	 *
3938
+	 * @return array
3939
+	 */
3940
+	public function get_request_data()
3941
+	{
3942
+		return $this->_req_data;
3943
+	}
3944
+
3945
+
3946
+	/**
3947
+	 * returns the _req_data protected property
3948
+	 *
3949
+	 * @return string
3950
+	 */
3951
+	public function get_req_action()
3952
+	{
3953
+		return $this->_req_action;
3954
+	}
3955
+
3956
+
3957
+	/**
3958
+	 * @return bool  value of $_is_caf property
3959
+	 */
3960
+	public function is_caf()
3961
+	{
3962
+		return $this->_is_caf;
3963
+	}
3964
+
3965
+
3966
+	/**
3967
+	 * @return mixed
3968
+	 */
3969
+	public function default_espresso_metaboxes()
3970
+	{
3971
+		return $this->_default_espresso_metaboxes;
3972
+	}
3973
+
3974
+
3975
+	/**
3976
+	 * @return mixed
3977
+	 */
3978
+	public function admin_base_url()
3979
+	{
3980
+		return $this->_admin_base_url;
3981
+	}
3982
+
3983
+
3984
+	/**
3985
+	 * @return mixed
3986
+	 */
3987
+	public function wp_page_slug()
3988
+	{
3989
+		return $this->_wp_page_slug;
3990
+	}
3991
+
3992
+
3993
+	/**
3994
+	 * updates  espresso configuration settings
3995
+	 *
3996
+	 * @param string                   $tab
3997
+	 * @param EE_Config_Base|EE_Config $config
3998
+	 * @param string                   $file file where error occurred
3999
+	 * @param string                   $func function  where error occurred
4000
+	 * @param string                   $line line no where error occurred
4001
+	 * @return boolean
4002
+	 */
4003
+	protected function _update_espresso_configuration($tab, $config, $file = '', $func = '', $line = '')
4004
+	{
4005
+		// remove any options that are NOT going to be saved with the config settings.
4006
+		if (isset($config->core->ee_ueip_optin)) {
4007
+			// TODO: remove the following two lines and make sure values are migrated from 3.1
4008
+			update_option('ee_ueip_optin', $config->core->ee_ueip_optin);
4009
+			update_option('ee_ueip_has_notified', true);
4010
+		}
4011
+		// and save it (note we're also doing the network save here)
4012
+		$net_saved = is_main_site() ? EE_Network_Config::instance()->update_config(false, false) : true;
4013
+		$config_saved = EE_Config::instance()->update_espresso_config(false, false);
4014
+		if ($config_saved && $net_saved) {
4015
+			EE_Error::add_success(sprintf(__('"%s" have been successfully updated.', 'event_espresso'), $tab));
4016
+			return true;
4017
+		}
4018
+		EE_Error::add_error(sprintf(__('The "%s" were not updated.', 'event_espresso'), $tab), $file, $func, $line);
4019
+		return false;
4020
+	}
4021
+
4022
+
4023
+	/**
4024
+	 * Returns an array to be used for EE_FOrm_Fields.helper.php's select_input as the $values argument.
4025
+	 *
4026
+	 * @return array
4027
+	 */
4028
+	public function get_yes_no_values()
4029
+	{
4030
+		return $this->_yes_no_values;
4031
+	}
4032
+
4033
+
4034
+	/**
4035
+	 * @return string
4036
+	 * @throws ReflectionException
4037
+	 * @since $VID:$
4038
+	 */
4039
+	protected function _get_dir()
4040
+	{
4041
+		$reflector = new ReflectionClass(get_class($this));
4042
+		return dirname($reflector->getFileName());
4043
+	}
4044
+
4045
+
4046
+	/**
4047
+	 * A helper for getting a "next link".
4048
+	 *
4049
+	 * @param string $url   The url to link to
4050
+	 * @param string $class The class to use.
4051
+	 * @return string
4052
+	 */
4053
+	protected function _next_link($url, $class = 'dashicons dashicons-arrow-right')
4054
+	{
4055
+		return '<a class="' . $class . '" href="' . $url . '"></a>';
4056
+	}
4057
+
4058
+
4059
+	/**
4060
+	 * A helper for getting a "previous link".
4061
+	 *
4062
+	 * @param string $url   The url to link to
4063
+	 * @param string $class The class to use.
4064
+	 * @return string
4065
+	 */
4066
+	protected function _previous_link($url, $class = 'dashicons dashicons-arrow-left')
4067
+	{
4068
+		return '<a class="' . $class . '" href="' . $url . '"></a>';
4069
+	}
4070
+
4071
+
4072
+
4073
+
4074
+
4075
+
4076
+
4077
+	// below are some messages related methods that should be available across the EE_Admin system.  Note, these methods are NOT page specific
4078
+
4079
+
4080
+	/**
4081
+	 * This processes an request to resend a registration and assumes we have a _REG_ID for doing so. So if the caller
4082
+	 * 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
4083
+	 * _req_data array.
4084
+	 *
4085
+	 * @return bool success/fail
4086
+	 * @throws EE_Error
4087
+	 * @throws InvalidArgumentException
4088
+	 * @throws ReflectionException
4089
+	 * @throws InvalidDataTypeException
4090
+	 * @throws InvalidInterfaceException
4091
+	 */
4092
+	protected function _process_resend_registration()
4093
+	{
4094
+		$this->_template_args['success'] = EED_Messages::process_resend($this->_req_data);
4095
+		do_action(
4096
+			'AHEE__EE_Admin_Page___process_resend_registration',
4097
+			$this->_template_args['success'],
4098
+			$this->_req_data
4099
+		);
4100
+		return $this->_template_args['success'];
4101
+	}
4102
+
4103
+
4104
+	/**
4105
+	 * This automatically processes any payment message notifications when manual payment has been applied.
4106
+	 *
4107
+	 * @param EE_Payment $payment
4108
+	 * @return bool success/fail
4109
+	 */
4110
+	protected function _process_payment_notification(EE_Payment $payment)
4111
+	{
4112
+		add_filter('FHEE__EE_Payment_Processor__process_registration_payments__display_notifications', '__return_true');
4113
+		do_action('AHEE__EE_Admin_Page___process_admin_payment_notification', $payment);
4114
+		$this->_template_args['success'] = apply_filters(
4115
+			'FHEE__EE_Admin_Page___process_admin_payment_notification__success',
4116
+			false,
4117
+			$payment
4118
+		);
4119
+		return $this->_template_args['success'];
4120
+	}
4121 4121
 }
Please login to merge, or discard this patch.
Spacing   +173 added lines, -173 removed lines patch added patch discarded remove patch
@@ -525,7 +525,7 @@  discard block
 block discarded – undo
525 525
         );
526 526
         global $ee_menu_slugs;
527 527
         $ee_menu_slugs = (array) $ee_menu_slugs;
528
-        if (! defined('DOING_AJAX') && (! $this->_current_page || ! isset($ee_menu_slugs[ $this->_current_page ]))) {
528
+        if ( ! defined('DOING_AJAX') && ( ! $this->_current_page || ! isset($ee_menu_slugs[$this->_current_page]))) {
529 529
             return;
530 530
         }
531 531
         // becuz WP List tables have two duplicate select inputs for choosing bulk actions, we need to copy the action from the second to the first
@@ -549,7 +549,7 @@  discard block
 block discarded – undo
549 549
             ? $this->_req_data['route']
550 550
             : $this->_req_action;
551 551
         $this->_current_view = $this->_req_action;
552
-        $this->_req_nonce = $this->_req_action . '_nonce';
552
+        $this->_req_nonce = $this->_req_action.'_nonce';
553 553
         $this->_define_page_props();
554 554
         $this->_current_page_view_url = add_query_arg(
555 555
             array('page' => $this->_current_page, 'action' => $this->_current_view),
@@ -583,21 +583,21 @@  discard block
 block discarded – undo
583 583
         }
584 584
         // filter routes and page_config so addons can add their stuff. Filtering done per class
585 585
         $this->_page_routes = apply_filters(
586
-            'FHEE__' . get_class($this) . '__page_setup__page_routes',
586
+            'FHEE__'.get_class($this).'__page_setup__page_routes',
587 587
             $this->_page_routes,
588 588
             $this
589 589
         );
590 590
         $this->_page_config = apply_filters(
591
-            'FHEE__' . get_class($this) . '__page_setup__page_config',
591
+            'FHEE__'.get_class($this).'__page_setup__page_config',
592 592
             $this->_page_config,
593 593
             $this
594 594
         );
595 595
         // if AHEE__EE_Admin_Page__route_admin_request_$this->_current_view method is present
596 596
         // then we call it hooked into the AHEE__EE_Admin_Page__route_admin_request action
597
-        if (method_exists($this, 'AHEE__EE_Admin_Page__route_admin_request_' . $this->_current_view)) {
597
+        if (method_exists($this, 'AHEE__EE_Admin_Page__route_admin_request_'.$this->_current_view)) {
598 598
             add_action(
599 599
                 'AHEE__EE_Admin_Page__route_admin_request',
600
-                array($this, 'AHEE__EE_Admin_Page__route_admin_request_' . $this->_current_view),
600
+                array($this, 'AHEE__EE_Admin_Page__route_admin_request_'.$this->_current_view),
601 601
                 10,
602 602
                 2
603 603
             );
@@ -610,8 +610,8 @@  discard block
 block discarded – undo
610 610
             if ($this->_is_UI_request) {
611 611
                 // admin_init stuff - global, all views for this page class, specific view
612 612
                 add_action('admin_init', array($this, 'admin_init'), 10);
613
-                if (method_exists($this, 'admin_init_' . $this->_current_view)) {
614
-                    add_action('admin_init', array($this, 'admin_init_' . $this->_current_view), 15);
613
+                if (method_exists($this, 'admin_init_'.$this->_current_view)) {
614
+                    add_action('admin_init', array($this, 'admin_init_'.$this->_current_view), 15);
615 615
                 }
616 616
             } else {
617 617
                 // hijack regular WP loading and route admin request immediately
@@ -630,12 +630,12 @@  discard block
 block discarded – undo
630 630
      */
631 631
     private function _do_other_page_hooks()
632 632
     {
633
-        $registered_pages = apply_filters('FHEE_do_other_page_hooks_' . $this->page_slug, array());
633
+        $registered_pages = apply_filters('FHEE_do_other_page_hooks_'.$this->page_slug, array());
634 634
         foreach ($registered_pages as $page) {
635 635
             // now let's setup the file name and class that should be present
636 636
             $classname = str_replace('.class.php', '', $page);
637 637
             // autoloaders should take care of loading file
638
-            if (! class_exists($classname)) {
638
+            if ( ! class_exists($classname)) {
639 639
                 $error_msg[] = sprintf(
640 640
                     esc_html__(
641 641
                         'Something went wrong with loading the %s admin hooks page.',
@@ -652,7 +652,7 @@  discard block
 block discarded – undo
652 652
                                    ),
653 653
                                    $page,
654 654
                                    '<br />',
655
-                                   '<strong>' . $classname . '</strong>'
655
+                                   '<strong>'.$classname.'</strong>'
656 656
                                );
657 657
                 throw new EE_Error(implode('||', $error_msg));
658 658
             }
@@ -700,13 +700,13 @@  discard block
 block discarded – undo
700 700
         // load admin_notices - global, page class, and view specific
701 701
         add_action('admin_notices', array($this, 'admin_notices_global'), 5);
702 702
         add_action('admin_notices', array($this, 'admin_notices'), 10);
703
-        if (method_exists($this, 'admin_notices_' . $this->_current_view)) {
704
-            add_action('admin_notices', array($this, 'admin_notices_' . $this->_current_view), 15);
703
+        if (method_exists($this, 'admin_notices_'.$this->_current_view)) {
704
+            add_action('admin_notices', array($this, 'admin_notices_'.$this->_current_view), 15);
705 705
         }
706 706
         // load network admin_notices - global, page class, and view specific
707 707
         add_action('network_admin_notices', array($this, 'network_admin_notices_global'), 5);
708
-        if (method_exists($this, 'network_admin_notices_' . $this->_current_view)) {
709
-            add_action('network_admin_notices', array($this, 'network_admin_notices_' . $this->_current_view));
708
+        if (method_exists($this, 'network_admin_notices_'.$this->_current_view)) {
709
+            add_action('network_admin_notices', array($this, 'network_admin_notices_'.$this->_current_view));
710 710
         }
711 711
         // this will save any per_page screen options if they are present
712 712
         $this->_set_per_page_screen_options();
@@ -827,7 +827,7 @@  discard block
 block discarded – undo
827 827
      */
828 828
     protected function _verify_routes()
829 829
     {
830
-        if (! $this->_current_page && ! defined('DOING_AJAX')) {
830
+        if ( ! $this->_current_page && ! defined('DOING_AJAX')) {
831 831
             return false;
832 832
         }
833 833
         $this->_route = false;
@@ -839,7 +839,7 @@  discard block
 block discarded – undo
839 839
                 $this->_admin_page_title
840 840
             );
841 841
             // developer error msg
842
-            $error_msg .= '||' . $error_msg
842
+            $error_msg .= '||'.$error_msg
843 843
                           . esc_html__(
844 844
                               ' Make sure the "set_page_routes()" method exists, and is setting the "_page_routes" array properly.',
845 845
                               'event_espresso'
@@ -848,9 +848,9 @@  discard block
 block discarded – undo
848 848
         }
849 849
         // and that the requested page route exists
850 850
         if (array_key_exists($this->_req_action, $this->_page_routes)) {
851
-            $this->_route = $this->_page_routes[ $this->_req_action ];
852
-            $this->_route_config = isset($this->_page_config[ $this->_req_action ])
853
-                ? $this->_page_config[ $this->_req_action ] : array();
851
+            $this->_route = $this->_page_routes[$this->_req_action];
852
+            $this->_route_config = isset($this->_page_config[$this->_req_action])
853
+                ? $this->_page_config[$this->_req_action] : array();
854 854
         } else {
855 855
             // user error msg
856 856
             $error_msg = sprintf(
@@ -861,7 +861,7 @@  discard block
 block discarded – undo
861 861
                 $this->_admin_page_title
862 862
             );
863 863
             // developer error msg
864
-            $error_msg .= '||' . $error_msg
864
+            $error_msg .= '||'.$error_msg
865 865
                           . sprintf(
866 866
                               esc_html__(
867 867
                                   ' Create a key in the "_page_routes" array named "%s" and set its value to the appropriate method.',
@@ -872,7 +872,7 @@  discard block
 block discarded – undo
872 872
             throw new EE_Error($error_msg);
873 873
         }
874 874
         // and that a default route exists
875
-        if (! array_key_exists('default', $this->_page_routes)) {
875
+        if ( ! array_key_exists('default', $this->_page_routes)) {
876 876
             // user error msg
877 877
             $error_msg = sprintf(
878 878
                 esc_html__(
@@ -882,7 +882,7 @@  discard block
 block discarded – undo
882 882
                 $this->_admin_page_title
883 883
             );
884 884
             // developer error msg
885
-            $error_msg .= '||' . $error_msg
885
+            $error_msg .= '||'.$error_msg
886 886
                           . esc_html__(
887 887
                               ' Create a key in the "_page_routes" array named "default" and set its value to your default page method.',
888 888
                               'event_espresso'
@@ -922,7 +922,7 @@  discard block
 block discarded – undo
922 922
             $this->_admin_page_title
923 923
         );
924 924
         // developer error msg
925
-        $error_msg .= '||' . $error_msg
925
+        $error_msg .= '||'.$error_msg
926 926
                       . sprintf(
927 927
                           esc_html__(
928 928
                               ' Check the route you are using in your method (%s) and make sure it matches a route set in your "_page_routes" array property',
@@ -950,7 +950,7 @@  discard block
 block discarded – undo
950 950
     protected function _verify_nonce($nonce, $nonce_ref)
951 951
     {
952 952
         // verify nonce against expected value
953
-        if (! wp_verify_nonce($nonce, $nonce_ref)) {
953
+        if ( ! wp_verify_nonce($nonce, $nonce_ref)) {
954 954
             // these are not the droids you are looking for !!!
955 955
             $msg = sprintf(
956 956
                 esc_html__('%sNonce Fail.%s', 'event_espresso'),
@@ -967,7 +967,7 @@  discard block
 block discarded – undo
967 967
                             EE_Admin_Page::class
968 968
                         );
969 969
             }
970
-            if (! defined('DOING_AJAX')) {
970
+            if ( ! defined('DOING_AJAX')) {
971 971
                 wp_die($msg);
972 972
             } else {
973 973
                 EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
@@ -992,7 +992,7 @@  discard block
 block discarded – undo
992 992
      */
993 993
     protected function _route_admin_request()
994 994
     {
995
-        if (! $this->_is_UI_request) {
995
+        if ( ! $this->_is_UI_request) {
996 996
             $this->_verify_routes();
997 997
         }
998 998
         $nonce_check = isset($this->_route_config['require_nonce'])
@@ -1000,8 +1000,8 @@  discard block
 block discarded – undo
1000 1000
             : true;
1001 1001
         if ($this->_req_action !== 'default' && $nonce_check) {
1002 1002
             // set nonce from post data
1003
-            $nonce = isset($this->_req_data[ $this->_req_nonce ])
1004
-                ? sanitize_text_field($this->_req_data[ $this->_req_nonce ])
1003
+            $nonce = isset($this->_req_data[$this->_req_nonce])
1004
+                ? sanitize_text_field($this->_req_data[$this->_req_nonce])
1005 1005
                 : '';
1006 1006
             $this->_verify_nonce($nonce, $this->_req_nonce);
1007 1007
         }
@@ -1016,7 +1016,7 @@  discard block
 block discarded – undo
1016 1016
         $error_msg = '';
1017 1017
         // action right before calling route
1018 1018
         // (hook is something like 'AHEE__Registrations_Admin_Page__route_admin_request')
1019
-        if (! did_action('AHEE__EE_Admin_Page__route_admin_request')) {
1019
+        if ( ! did_action('AHEE__EE_Admin_Page__route_admin_request')) {
1020 1020
             do_action('AHEE__EE_Admin_Page__route_admin_request', $this->_current_view, $this);
1021 1021
         }
1022 1022
         // right before calling the route, let's remove _wp_http_referer from the
@@ -1025,7 +1025,7 @@  discard block
 block discarded – undo
1025 1025
             '_wp_http_referer',
1026 1026
             wp_unslash($_SERVER['REQUEST_URI'])
1027 1027
         );
1028
-        if (! empty($func)) {
1028
+        if ( ! empty($func)) {
1029 1029
             if (is_array($func)) {
1030 1030
                 list($class, $method) = $func;
1031 1031
             } elseif (strpos($func, '::') !== false) {
@@ -1034,7 +1034,7 @@  discard block
 block discarded – undo
1034 1034
                 $class = $this;
1035 1035
                 $method = $func;
1036 1036
             }
1037
-            if (! (is_object($class) && $class === $this)) {
1037
+            if ( ! (is_object($class) && $class === $this)) {
1038 1038
                 // send along this admin page object for access by addons.
1039 1039
                 $args['admin_page_object'] = $this;
1040 1040
             }
@@ -1067,7 +1067,7 @@  discard block
 block discarded – undo
1067 1067
                     $method
1068 1068
                 );
1069 1069
             }
1070
-            if (! empty($error_msg)) {
1070
+            if ( ! empty($error_msg)) {
1071 1071
                 throw new EE_Error($error_msg);
1072 1072
             }
1073 1073
         }
@@ -1150,7 +1150,7 @@  discard block
 block discarded – undo
1150 1150
                 if (strpos($key, 'nonce') !== false) {
1151 1151
                     continue;
1152 1152
                 }
1153
-                $args[ 'wp_referer[' . $key . ']' ] = $value;
1153
+                $args['wp_referer['.$key.']'] = $value;
1154 1154
             }
1155 1155
         }
1156 1156
         return EEH_URL::add_query_args_and_nonce($args, $url, $exclude_nonce);
@@ -1191,10 +1191,10 @@  discard block
 block discarded – undo
1191 1191
     protected function _add_help_tabs()
1192 1192
     {
1193 1193
         $tour_buttons = '';
1194
-        if (isset($this->_page_config[ $this->_req_action ])) {
1195
-            $config = $this->_page_config[ $this->_req_action ];
1194
+        if (isset($this->_page_config[$this->_req_action])) {
1195
+            $config = $this->_page_config[$this->_req_action];
1196 1196
             // is there a help tour for the current route?  if there is let's setup the tour buttons
1197
-            if (isset($this->_help_tour[ $this->_req_action ])) {
1197
+            if (isset($this->_help_tour[$this->_req_action])) {
1198 1198
                 $tb = array();
1199 1199
                 $tour_buttons = '<div class="ee-abs-container"><div class="ee-help-tour-restart-buttons">';
1200 1200
                 foreach ($this->_help_tour['tours'] as $tour) {
@@ -1214,7 +1214,7 @@  discard block
 block discarded – undo
1214 1214
             // let's see if there is a help_sidebar set for the current route and we'll set that up for usage as well.
1215 1215
             if (is_array($config) && isset($config['help_sidebar'])) {
1216 1216
                 // check that the callback given is valid
1217
-                if (! method_exists($this, $config['help_sidebar'])) {
1217
+                if ( ! method_exists($this, $config['help_sidebar'])) {
1218 1218
                     throw new EE_Error(
1219 1219
                         sprintf(
1220 1220
                             esc_html__(
@@ -1227,7 +1227,7 @@  discard block
 block discarded – undo
1227 1227
                     );
1228 1228
                 }
1229 1229
                 $content = apply_filters(
1230
-                    'FHEE__' . get_class($this) . '__add_help_tabs__help_sidebar',
1230
+                    'FHEE__'.get_class($this).'__add_help_tabs__help_sidebar',
1231 1231
                     $this->{$config['help_sidebar']}()
1232 1232
                 );
1233 1233
                 $content .= $tour_buttons; // add help tour buttons.
@@ -1235,30 +1235,30 @@  discard block
 block discarded – undo
1235 1235
                 $this->_current_screen->set_help_sidebar($content);
1236 1236
             }
1237 1237
             // if there ARE tour buttons...
1238
-            if (! empty($tour_buttons)) {
1238
+            if ( ! empty($tour_buttons)) {
1239 1239
                 // if we DON'T have config help sidebar then we'll just add the tour buttons to the sidebar.
1240
-                if (! isset($config['help_sidebar'])) {
1240
+                if ( ! isset($config['help_sidebar'])) {
1241 1241
                     $this->_current_screen->set_help_sidebar($tour_buttons);
1242 1242
                 }
1243 1243
                 // handle if no help_tabs are set so the sidebar will still show for the help tour buttons
1244
-                if (! isset($config['help_tabs'])) {
1244
+                if ( ! isset($config['help_tabs'])) {
1245 1245
                     $_ht['id'] = $this->page_slug;
1246 1246
                     $_ht['title'] = esc_html__('Help Tours', 'event_espresso');
1247 1247
                     $_ht['content'] = '<p>'
1248 1248
                                       . esc_html__(
1249 1249
                                           'The buttons to the right allow you to start/restart any help tours available for this page',
1250 1250
                                           'event_espresso'
1251
-                                      ) . '</p>';
1251
+                                      ).'</p>';
1252 1252
                     $this->_current_screen->add_help_tab($_ht);
1253 1253
                 }
1254 1254
             }
1255
-            if (! isset($config['help_tabs'])) {
1255
+            if ( ! isset($config['help_tabs'])) {
1256 1256
                 return;
1257 1257
             } //no help tabs for this route
1258 1258
             foreach ((array) $config['help_tabs'] as $tab_id => $cfg) {
1259 1259
                 // we're here so there ARE help tabs!
1260 1260
                 // make sure we've got what we need
1261
-                if (! isset($cfg['title'])) {
1261
+                if ( ! isset($cfg['title'])) {
1262 1262
                     throw new EE_Error(
1263 1263
                         esc_html__(
1264 1264
                             'The _page_config array is not set up properly for help tabs.  It is missing a title',
@@ -1266,7 +1266,7 @@  discard block
 block discarded – undo
1266 1266
                         )
1267 1267
                     );
1268 1268
                 }
1269
-                if (! isset($cfg['filename']) && ! isset($cfg['callback']) && ! isset($cfg['content'])) {
1269
+                if ( ! isset($cfg['filename']) && ! isset($cfg['callback']) && ! isset($cfg['content'])) {
1270 1270
                     throw new EE_Error(
1271 1271
                         esc_html__(
1272 1272
                             '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',
@@ -1275,11 +1275,11 @@  discard block
 block discarded – undo
1275 1275
                     );
1276 1276
                 }
1277 1277
                 // first priority goes to content.
1278
-                if (! empty($cfg['content'])) {
1278
+                if ( ! empty($cfg['content'])) {
1279 1279
                     $content = ! empty($cfg['content']) ? $cfg['content'] : null;
1280 1280
                     // second priority goes to filename
1281
-                } elseif (! empty($cfg['filename'])) {
1282
-                    $file_path = $this->_get_dir() . '/help_tabs/' . $cfg['filename'] . '.help_tab.php';
1281
+                } elseif ( ! empty($cfg['filename'])) {
1282
+                    $file_path = $this->_get_dir().'/help_tabs/'.$cfg['filename'].'.help_tab.php';
1283 1283
                     // 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)
1284 1284
                     $file_path = ! is_readable($file_path) ? EE_ADMIN_PAGES
1285 1285
                                                              . basename($this->_get_dir())
@@ -1287,7 +1287,7 @@  discard block
 block discarded – undo
1287 1287
                                                              . $cfg['filename']
1288 1288
                                                              . '.help_tab.php' : $file_path;
1289 1289
                     // if file is STILL not readable then let's do a EE_Error so its more graceful than a fatal error.
1290
-                    if (! isset($cfg['callback']) && ! is_readable($file_path)) {
1290
+                    if ( ! isset($cfg['callback']) && ! is_readable($file_path)) {
1291 1291
                         EE_Error::add_error(
1292 1292
                             sprintf(
1293 1293
                                 esc_html__(
@@ -1333,7 +1333,7 @@  discard block
 block discarded – undo
1333 1333
                     return;
1334 1334
                 }
1335 1335
                 // setup config array for help tab method
1336
-                $id = $this->page_slug . '-' . $this->_req_action . '-' . $tab_id;
1336
+                $id = $this->page_slug.'-'.$this->_req_action.'-'.$tab_id;
1337 1337
                 $_ht = array(
1338 1338
                     'id'       => $id,
1339 1339
                     'title'    => $cfg['title'],
@@ -1378,7 +1378,7 @@  discard block
 block discarded – undo
1378 1378
             }
1379 1379
             if (isset($config['help_tour'])) {
1380 1380
                 foreach ($config['help_tour'] as $tour) {
1381
-                    $file_path = $this->_get_dir() . '/help_tours/' . $tour . '.class.php';
1381
+                    $file_path = $this->_get_dir().'/help_tours/'.$tour.'.class.php';
1382 1382
                     // let's see if we can get that file...
1383 1383
                     // if not its possible this is a decaf route not set in caffeinated
1384 1384
                     // so lets try and get the caffeinated equivalent
@@ -1388,7 +1388,7 @@  discard block
 block discarded – undo
1388 1388
                                                              . $tour
1389 1389
                                                              . '.class.php' : $file_path;
1390 1390
                     // if file is STILL not readable then let's do a EE_Error so its more graceful than a fatal error.
1391
-                    if (! is_readable($file_path)) {
1391
+                    if ( ! is_readable($file_path)) {
1392 1392
                         EE_Error::add_error(
1393 1393
                             sprintf(
1394 1394
                                 esc_html__(
@@ -1405,13 +1405,13 @@  discard block
 block discarded – undo
1405 1405
                         return;
1406 1406
                     }
1407 1407
                     require_once $file_path;
1408
-                    if (! class_exists($tour)) {
1408
+                    if ( ! class_exists($tour)) {
1409 1409
                         $error_msg = [];
1410 1410
                         $error_msg[] = sprintf(
1411 1411
                             esc_html__('Something went wrong with loading the %s Help Tour Class.', 'event_espresso'),
1412 1412
                             $tour
1413 1413
                         );
1414
-                        $error_msg[] = $error_msg[0] . "\r\n"
1414
+                        $error_msg[] = $error_msg[0]."\r\n"
1415 1415
                                        . sprintf(
1416 1416
                                            esc_html__(
1417 1417
                                                'There is no class in place for the %s help tour.%s Make sure you have <strong>%s</strong> defined in the "help_tour" array for the %s route of the % admin page.',
@@ -1427,16 +1427,16 @@  discard block
 block discarded – undo
1427 1427
                     }
1428 1428
                     $tour_obj = new $tour($this->_is_caf);
1429 1429
                     $tours[] = $tour_obj;
1430
-                    $this->_help_tour[ $route ][] = EEH_Template::help_tour_stops_generator($tour_obj);
1430
+                    $this->_help_tour[$route][] = EEH_Template::help_tour_stops_generator($tour_obj);
1431 1431
                 }
1432 1432
                 // let's inject the end tour stop element common to all pages... this will only get seen once per machine.
1433 1433
                 $end_stop_tour = new EE_Help_Tour_final_stop($this->_is_caf);
1434 1434
                 $tours[] = $end_stop_tour;
1435
-                $this->_help_tour[ $route ][] = EEH_Template::help_tour_stops_generator($end_stop_tour);
1435
+                $this->_help_tour[$route][] = EEH_Template::help_tour_stops_generator($end_stop_tour);
1436 1436
             }
1437 1437
         }
1438 1438
 
1439
-        if (! empty($tours)) {
1439
+        if ( ! empty($tours)) {
1440 1440
             $this->_help_tour['tours'] = $tours;
1441 1441
         }
1442 1442
         // that's it!  Now that the $_help_tours property is set (or not)
@@ -1464,8 +1464,8 @@  discard block
 block discarded – undo
1464 1464
             $qtips = (array) $this->_route_config['qtips'];
1465 1465
             // load qtip loader
1466 1466
             $path = array(
1467
-                $this->_get_dir() . '/qtips/',
1468
-                EE_ADMIN_PAGES . basename($this->_get_dir()) . '/qtips/',
1467
+                $this->_get_dir().'/qtips/',
1468
+                EE_ADMIN_PAGES.basename($this->_get_dir()).'/qtips/',
1469 1469
             );
1470 1470
             $qtip_loader = EEH_Qtip_Loader::instance();
1471 1471
             if ($qtip_loader instanceof EEH_Qtip_Loader) {
@@ -1490,7 +1490,7 @@  discard block
 block discarded – undo
1490 1490
         do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1491 1491
         $i = 0;
1492 1492
         foreach ($this->_page_config as $slug => $config) {
1493
-            if (! is_array($config)
1493
+            if ( ! is_array($config)
1494 1494
                 || (
1495 1495
                     is_array($config)
1496 1496
                     && (
@@ -1507,12 +1507,12 @@  discard block
 block discarded – undo
1507 1507
                 // nav tab is only to appear when route requested.
1508 1508
                 continue;
1509 1509
             }
1510
-            if (! $this->check_user_access($slug, true)) {
1510
+            if ( ! $this->check_user_access($slug, true)) {
1511 1511
                 // no nav tab because current user does not have access.
1512 1512
                 continue;
1513 1513
             }
1514
-            $css_class = isset($config['css_class']) ? $config['css_class'] . ' ' : '';
1515
-            $this->_nav_tabs[ $slug ] = array(
1514
+            $css_class = isset($config['css_class']) ? $config['css_class'].' ' : '';
1515
+            $this->_nav_tabs[$slug] = array(
1516 1516
                 'url'       => isset($config['nav']['url'])
1517 1517
                     ? $config['nav']['url']
1518 1518
                     : EE_Admin_Page::add_query_args_and_nonce(
@@ -1524,14 +1524,14 @@  discard block
 block discarded – undo
1524 1524
                     : ucwords(
1525 1525
                         str_replace('_', ' ', $slug)
1526 1526
                     ),
1527
-                'css_class' => $this->_req_action === $slug ? $css_class . 'nav-tab-active' : $css_class,
1527
+                'css_class' => $this->_req_action === $slug ? $css_class.'nav-tab-active' : $css_class,
1528 1528
                 'order'     => isset($config['nav']['order']) ? $config['nav']['order'] : $i,
1529 1529
             );
1530 1530
             $i++;
1531 1531
         }
1532 1532
         // if $this->_nav_tabs is empty then lets set the default
1533 1533
         if (empty($this->_nav_tabs)) {
1534
-            $this->_nav_tabs[ $this->_default_nav_tab_name ] = array(
1534
+            $this->_nav_tabs[$this->_default_nav_tab_name] = array(
1535 1535
                 'url'       => $this->_admin_base_url,
1536 1536
                 'link_text' => ucwords(str_replace('_', ' ', $this->_default_nav_tab_name)),
1537 1537
                 'css_class' => 'nav-tab-active',
@@ -1556,10 +1556,10 @@  discard block
 block discarded – undo
1556 1556
             foreach ($this->_route_config['labels'] as $label => $text) {
1557 1557
                 if (is_array($text)) {
1558 1558
                     foreach ($text as $sublabel => $subtext) {
1559
-                        $this->_labels[ $label ][ $sublabel ] = $subtext;
1559
+                        $this->_labels[$label][$sublabel] = $subtext;
1560 1560
                     }
1561 1561
                 } else {
1562
-                    $this->_labels[ $label ] = $text;
1562
+                    $this->_labels[$label] = $text;
1563 1563
                 }
1564 1564
             }
1565 1565
         }
@@ -1581,12 +1581,12 @@  discard block
 block discarded – undo
1581 1581
     {
1582 1582
         do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1583 1583
         $route_to_check = empty($route_to_check) ? $this->_req_action : $route_to_check;
1584
-        $capability = ! empty($route_to_check) && isset($this->_page_routes[ $route_to_check ])
1584
+        $capability = ! empty($route_to_check) && isset($this->_page_routes[$route_to_check])
1585 1585
                       && is_array(
1586
-                          $this->_page_routes[ $route_to_check ]
1586
+                          $this->_page_routes[$route_to_check]
1587 1587
                       )
1588
-                      && ! empty($this->_page_routes[ $route_to_check ]['capability'])
1589
-            ? $this->_page_routes[ $route_to_check ]['capability'] : null;
1588
+                      && ! empty($this->_page_routes[$route_to_check]['capability'])
1589
+            ? $this->_page_routes[$route_to_check]['capability'] : null;
1590 1590
         if (empty($capability) && empty($route_to_check)) {
1591 1591
             $capability = is_array($this->_route) && empty($this->_route['capability']) ? 'manage_options'
1592 1592
                 : $this->_route['capability'];
@@ -1594,7 +1594,7 @@  discard block
 block discarded – undo
1594 1594
             $capability = empty($capability) ? 'manage_options' : $capability;
1595 1595
         }
1596 1596
         $id = is_array($this->_route) && ! empty($this->_route['obj_id']) ? $this->_route['obj_id'] : 0;
1597
-        if (! defined('DOING_AJAX')
1597
+        if ( ! defined('DOING_AJAX')
1598 1598
             && (
1599 1599
                 ! function_exists('is_admin')
1600 1600
                 || ! EE_Registry::instance()->CAP->current_user_can(
@@ -1699,17 +1699,17 @@  discard block
 block discarded – undo
1699 1699
     public function admin_footer_global()
1700 1700
     {
1701 1701
         // dialog container for dialog helper
1702
-        $d_cont = '<div class="ee-admin-dialog-container auto-hide hidden">' . "\n";
1702
+        $d_cont = '<div class="ee-admin-dialog-container auto-hide hidden">'."\n";
1703 1703
         $d_cont .= '<div class="ee-notices"></div>';
1704 1704
         $d_cont .= '<div class="ee-admin-dialog-container-inner-content"></div>';
1705 1705
         $d_cont .= '</div>';
1706 1706
         echo $d_cont;
1707 1707
         // help tour stuff?
1708
-        if (isset($this->_help_tour[ $this->_req_action ])) {
1709
-            echo implode('<br />', $this->_help_tour[ $this->_req_action ]);
1708
+        if (isset($this->_help_tour[$this->_req_action])) {
1709
+            echo implode('<br />', $this->_help_tour[$this->_req_action]);
1710 1710
         }
1711 1711
         // current set timezone for timezone js
1712
-        echo '<span id="current_timezone" class="hidden">' . EEH_DTT_Helper::get_timezone() . '</span>';
1712
+        echo '<span id="current_timezone" class="hidden">'.EEH_DTT_Helper::get_timezone().'</span>';
1713 1713
     }
1714 1714
 
1715 1715
 
@@ -1743,7 +1743,7 @@  discard block
 block discarded – undo
1743 1743
         // loop through the array and setup content
1744 1744
         foreach ($help_array as $trigger => $help) {
1745 1745
             // make sure the array is setup properly
1746
-            if (! isset($help['title'], $help['content'])) {
1746
+            if ( ! isset($help['title'], $help['content'])) {
1747 1747
                 throw new EE_Error(
1748 1748
                     esc_html__(
1749 1749
                         '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',
@@ -1758,7 +1758,7 @@  discard block
 block discarded – undo
1758 1758
                 'help_popup_content' => $help['content'],
1759 1759
             );
1760 1760
             $content .= EEH_Template::display_template(
1761
-                EE_ADMIN_TEMPLATE . 'admin_help_popup.template.php',
1761
+                EE_ADMIN_TEMPLATE.'admin_help_popup.template.php',
1762 1762
                 $template_args,
1763 1763
                 true
1764 1764
             );
@@ -1780,15 +1780,15 @@  discard block
 block discarded – undo
1780 1780
     private function _get_help_content()
1781 1781
     {
1782 1782
         // what is the method we're looking for?
1783
-        $method_name = '_help_popup_content_' . $this->_req_action;
1783
+        $method_name = '_help_popup_content_'.$this->_req_action;
1784 1784
         // if method doesn't exist let's get out.
1785
-        if (! method_exists($this, $method_name)) {
1785
+        if ( ! method_exists($this, $method_name)) {
1786 1786
             return array();
1787 1787
         }
1788 1788
         // k we're good to go let's retrieve the help array
1789 1789
         $help_array = $this->{$method_name}();
1790 1790
         // make sure we've got an array!
1791
-        if (! is_array($help_array)) {
1791
+        if ( ! is_array($help_array)) {
1792 1792
             throw new EE_Error(
1793 1793
                 esc_html__(
1794 1794
                     'Something went wrong with help popup content generation. Expecting an array and well, this ain\'t no array bub.',
@@ -1820,8 +1820,8 @@  discard block
 block discarded – undo
1820 1820
         // 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
1821 1821
         $help_array = $this->_get_help_content();
1822 1822
         $help_content = '';
1823
-        if (empty($help_array) || ! isset($help_array[ $trigger_id ])) {
1824
-            $help_array[ $trigger_id ] = array(
1823
+        if (empty($help_array) || ! isset($help_array[$trigger_id])) {
1824
+            $help_array[$trigger_id] = array(
1825 1825
                 'title'   => esc_html__('Missing Content', 'event_espresso'),
1826 1826
                 'content' => esc_html__(
1827 1827
                     '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.)',
@@ -2014,12 +2014,12 @@  discard block
 block discarded – undo
2014 2014
     protected function _set_list_table()
2015 2015
     {
2016 2016
         // first is this a list_table view?
2017
-        if (! isset($this->_route_config['list_table'])) {
2017
+        if ( ! isset($this->_route_config['list_table'])) {
2018 2018
             return;
2019 2019
         } //not a list_table view so get out.
2020 2020
         // list table functions are per view specific (because some admin pages might have more than one list table!)
2021
-        $list_table_view = '_set_list_table_views_' . $this->_req_action;
2022
-        if (! method_exists($this, $list_table_view) || $this->{$list_table_view}() === false) {
2021
+        $list_table_view = '_set_list_table_views_'.$this->_req_action;
2022
+        if ( ! method_exists($this, $list_table_view) || $this->{$list_table_view}() === false) {
2023 2023
             // user error msg
2024 2024
             $error_msg = esc_html__(
2025 2025
                 'An error occurred. The requested list table views could not be found.',
@@ -2039,10 +2039,10 @@  discard block
 block discarded – undo
2039 2039
         }
2040 2040
         // let's provide the ability to filter the views per PAGE AND ROUTE, per PAGE, and globally
2041 2041
         $this->_views = apply_filters(
2042
-            'FHEE_list_table_views_' . $this->page_slug . '_' . $this->_req_action,
2042
+            'FHEE_list_table_views_'.$this->page_slug.'_'.$this->_req_action,
2043 2043
             $this->_views
2044 2044
         );
2045
-        $this->_views = apply_filters('FHEE_list_table_views_' . $this->page_slug, $this->_views);
2045
+        $this->_views = apply_filters('FHEE_list_table_views_'.$this->page_slug, $this->_views);
2046 2046
         $this->_views = apply_filters('FHEE_list_table_views', $this->_views);
2047 2047
         $this->_set_list_table_view();
2048 2048
         $this->_set_list_table_object();
@@ -2058,7 +2058,7 @@  discard block
 block discarded – undo
2058 2058
     {
2059 2059
         do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2060 2060
         // looking at active items or dumpster diving ?
2061
-        if (! isset($this->_req_data['status']) || ! array_key_exists($this->_req_data['status'], $this->_views)) {
2061
+        if ( ! isset($this->_req_data['status']) || ! array_key_exists($this->_req_data['status'], $this->_views)) {
2062 2062
             $this->_view = isset($this->_views['in_use']) ? 'in_use' : 'all';
2063 2063
         } else {
2064 2064
             $this->_view = sanitize_key($this->_req_data['status']);
@@ -2079,7 +2079,7 @@  discard block
 block discarded – undo
2079 2079
     protected function _set_list_table_object()
2080 2080
     {
2081 2081
         if (isset($this->_route_config['list_table'])) {
2082
-            if (! class_exists($this->_route_config['list_table'])) {
2082
+            if ( ! class_exists($this->_route_config['list_table'])) {
2083 2083
                 throw new EE_Error(
2084 2084
                     sprintf(
2085 2085
                         esc_html__(
@@ -2117,17 +2117,17 @@  discard block
 block discarded – undo
2117 2117
         foreach ($this->_views as $key => $view) {
2118 2118
             $query_args = array();
2119 2119
             // check for current view
2120
-            $this->_views[ $key ]['class'] = $this->_view === $view['slug'] ? 'current' : '';
2120
+            $this->_views[$key]['class'] = $this->_view === $view['slug'] ? 'current' : '';
2121 2121
             $query_args['action'] = $this->_req_action;
2122
-            $query_args[ $this->_req_action . '_nonce' ] = wp_create_nonce($query_args['action'] . '_nonce');
2122
+            $query_args[$this->_req_action.'_nonce'] = wp_create_nonce($query_args['action'].'_nonce');
2123 2123
             $query_args['status'] = $view['slug'];
2124 2124
             // merge any other arguments sent in.
2125
-            if (isset($extra_query_args[ $view['slug'] ])) {
2126
-                foreach ($extra_query_args[ $view['slug'] ] as $extra_query_arg) {
2125
+            if (isset($extra_query_args[$view['slug']])) {
2126
+                foreach ($extra_query_args[$view['slug']] as $extra_query_arg) {
2127 2127
                     $query_args[] = $extra_query_arg;
2128 2128
                 }
2129 2129
             }
2130
-            $this->_views[ $key ]['url'] = EE_Admin_Page::add_query_args_and_nonce($query_args, $this->_admin_base_url);
2130
+            $this->_views[$key]['url'] = EE_Admin_Page::add_query_args_and_nonce($query_args, $this->_admin_base_url);
2131 2131
         }
2132 2132
         return $this->_views;
2133 2133
     }
@@ -2146,7 +2146,7 @@  discard block
 block discarded – undo
2146 2146
     {
2147 2147
         do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2148 2148
         $values = array(10, 25, 50, 100);
2149
-        $per_page = (! empty($this->_req_data['per_page'])) ? absint($this->_req_data['per_page']) : 10;
2149
+        $per_page = ( ! empty($this->_req_data['per_page'])) ? absint($this->_req_data['per_page']) : 10;
2150 2150
         if ($max_entries) {
2151 2151
             $values[] = $max_entries;
2152 2152
             sort($values);
@@ -2158,14 +2158,14 @@  discard block
 block discarded – undo
2158 2158
 					<select id="entries-per-page-slct" name="entries-per-page-slct">';
2159 2159
         foreach ($values as $value) {
2160 2160
             if ($value < $max_entries) {
2161
-                $selected = $value === $per_page ? ' selected="' . $per_page . '"' : '';
2161
+                $selected = $value === $per_page ? ' selected="'.$per_page.'"' : '';
2162 2162
                 $entries_per_page_dropdown .= '
2163
-						<option value="' . $value . '"' . $selected . '>' . $value . '&nbsp;&nbsp;</option>';
2163
+						<option value="' . $value.'"'.$selected.'>'.$value.'&nbsp;&nbsp;</option>';
2164 2164
             }
2165 2165
         }
2166
-        $selected = $max_entries === $per_page ? ' selected="' . $per_page . '"' : '';
2166
+        $selected = $max_entries === $per_page ? ' selected="'.$per_page.'"' : '';
2167 2167
         $entries_per_page_dropdown .= '
2168
-						<option value="' . $max_entries . '"' . $selected . '>All&nbsp;&nbsp;</option>';
2168
+						<option value="' . $max_entries.'"'.$selected.'>All&nbsp;&nbsp;</option>';
2169 2169
         $entries_per_page_dropdown .= '
2170 2170
 					</select>
2171 2171
 					entries
@@ -2189,7 +2189,7 @@  discard block
 block discarded – undo
2189 2189
             empty($this->_search_btn_label) ? $this->page_label
2190 2190
                 : $this->_search_btn_label
2191 2191
         );
2192
-        $this->_template_args['search']['callback'] = 'search_' . $this->page_slug;
2192
+        $this->_template_args['search']['callback'] = 'search_'.$this->page_slug;
2193 2193
     }
2194 2194
 
2195 2195
 
@@ -2275,7 +2275,7 @@  discard block
 block discarded – undo
2275 2275
             $total_columns = ! empty($screen_columns)
2276 2276
                 ? $screen_columns
2277 2277
                 : $this->_route_config['columns'][1];
2278
-            $this->_template_args['current_screen_widget_class'] = 'columns-' . $total_columns;
2278
+            $this->_template_args['current_screen_widget_class'] = 'columns-'.$total_columns;
2279 2279
             $this->_template_args['current_page'] = $this->_wp_page_slug;
2280 2280
             $this->_template_args['screen'] = $this->_current_screen;
2281 2281
             $this->_column_template_path = EE_ADMIN_TEMPLATE
@@ -2320,7 +2320,7 @@  discard block
 block discarded – undo
2320 2320
      */
2321 2321
     protected function _espresso_ratings_request()
2322 2322
     {
2323
-        if (! apply_filters('FHEE_show_ratings_request_meta_box', true)) {
2323
+        if ( ! apply_filters('FHEE_show_ratings_request_meta_box', true)) {
2324 2324
             return;
2325 2325
         }
2326 2326
         $ratings_box_title = apply_filters(
@@ -2347,7 +2347,7 @@  discard block
 block discarded – undo
2347 2347
      */
2348 2348
     public function espresso_ratings_request()
2349 2349
     {
2350
-        EEH_Template::display_template(EE_ADMIN_TEMPLATE . 'espresso_ratings_request_content.template.php');
2350
+        EEH_Template::display_template(EE_ADMIN_TEMPLATE.'espresso_ratings_request_content.template.php');
2351 2351
     }
2352 2352
 
2353 2353
 
@@ -2358,17 +2358,17 @@  discard block
 block discarded – undo
2358 2358
                    . '</p><p class="hide-if-js">'
2359 2359
                    . esc_html__('This widget requires JavaScript.', 'event_espresso')
2360 2360
                    . '</p>';
2361
-        $pre = '<div class="espresso-rss-display">' . "\n\t";
2362
-        $pre .= '<span id="' . $rss_id . '_url" class="hidden">' . $url . '</span>';
2363
-        $post = '</div>' . "\n";
2364
-        $cache_key = 'ee_rss_' . md5($rss_id);
2361
+        $pre = '<div class="espresso-rss-display">'."\n\t";
2362
+        $pre .= '<span id="'.$rss_id.'_url" class="hidden">'.$url.'</span>';
2363
+        $post = '</div>'."\n";
2364
+        $cache_key = 'ee_rss_'.md5($rss_id);
2365 2365
         $output = get_transient($cache_key);
2366 2366
         if ($output !== false) {
2367
-            echo $pre . $output . $post;
2367
+            echo $pre.$output.$post;
2368 2368
             return true;
2369 2369
         }
2370
-        if (! (defined('DOING_AJAX') && DOING_AJAX)) {
2371
-            echo $pre . $loading . $post;
2370
+        if ( ! (defined('DOING_AJAX') && DOING_AJAX)) {
2371
+            echo $pre.$loading.$post;
2372 2372
             return false;
2373 2373
         }
2374 2374
         ob_start();
@@ -2435,19 +2435,19 @@  discard block
 block discarded – undo
2435 2435
     public function espresso_sponsors_post_box()
2436 2436
     {
2437 2437
         EEH_Template::display_template(
2438
-            EE_ADMIN_TEMPLATE . 'admin_general_metabox_contents_espresso_sponsors.template.php'
2438
+            EE_ADMIN_TEMPLATE.'admin_general_metabox_contents_espresso_sponsors.template.php'
2439 2439
         );
2440 2440
     }
2441 2441
 
2442 2442
 
2443 2443
     private function _publish_post_box()
2444 2444
     {
2445
-        $meta_box_ref = 'espresso_' . $this->page_slug . '_editor_overview';
2445
+        $meta_box_ref = 'espresso_'.$this->page_slug.'_editor_overview';
2446 2446
         // if there is a array('label' => array('publishbox' => 'some title') ) present in the _page_config array
2447 2447
         // then we'll use that for the metabox label.
2448 2448
         // Otherwise we'll just use publish (publishbox itself could be an array of labels indexed by routes)
2449
-        if (! empty($this->_labels['publishbox'])) {
2450
-            $box_label = is_array($this->_labels['publishbox']) ? $this->_labels['publishbox'][ $this->_req_action ]
2449
+        if ( ! empty($this->_labels['publishbox'])) {
2450
+            $box_label = is_array($this->_labels['publishbox']) ? $this->_labels['publishbox'][$this->_req_action]
2451 2451
                 : $this->_labels['publishbox'];
2452 2452
         } else {
2453 2453
             $box_label = esc_html__('Publish', 'event_espresso');
@@ -2476,7 +2476,7 @@  discard block
 block discarded – undo
2476 2476
             ? $this->_template_args['publish_box_extra_content']
2477 2477
             : '';
2478 2478
         echo EEH_Template::display_template(
2479
-            EE_ADMIN_TEMPLATE . 'admin_details_publish_metabox.template.php',
2479
+            EE_ADMIN_TEMPLATE.'admin_details_publish_metabox.template.php',
2480 2480
             $this->_template_args,
2481 2481
             true
2482 2482
         );
@@ -2566,8 +2566,8 @@  discard block
 block discarded – undo
2566 2566
             );
2567 2567
         }
2568 2568
         $this->_template_args['publish_delete_link'] = ! empty($id) ? $delete : '';
2569
-        if (! empty($name) && ! empty($id)) {
2570
-            $hidden_field_arr[ $name ] = array(
2569
+        if ( ! empty($name) && ! empty($id)) {
2570
+            $hidden_field_arr[$name] = array(
2571 2571
                 'type'  => 'hidden',
2572 2572
                 'value' => $id,
2573 2573
             );
@@ -2577,7 +2577,7 @@  discard block
 block discarded – undo
2577 2577
         }
2578 2578
         // add hidden field
2579 2579
         $this->_template_args['publish_hidden_fields'] = is_array($hf) && ! empty($name)
2580
-            ? $hf[ $name ]['field']
2580
+            ? $hf[$name]['field']
2581 2581
             : $hf;
2582 2582
     }
2583 2583
 
@@ -2679,7 +2679,7 @@  discard block
 block discarded – undo
2679 2679
         }
2680 2680
         // 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)
2681 2681
         $call_back_func = $create_func
2682
-            ? static function ($post, $metabox) {
2682
+            ? static function($post, $metabox) {
2683 2683
                 do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2684 2684
                 echo EEH_Template::display_template(
2685 2685
                     $metabox['args']['template_path'],
@@ -2689,7 +2689,7 @@  discard block
 block discarded – undo
2689 2689
             }
2690 2690
             : $callback;
2691 2691
         add_meta_box(
2692
-            str_replace('_', '-', $action) . '-mbox',
2692
+            str_replace('_', '-', $action).'-mbox',
2693 2693
             $title,
2694 2694
             $call_back_func,
2695 2695
             $this->_wp_page_slug,
@@ -2796,9 +2796,9 @@  discard block
 block discarded – undo
2796 2796
             : 'espresso-default-admin';
2797 2797
         $template_path = $sidebar
2798 2798
             ? EE_ADMIN_TEMPLATE . 'admin_details_wrapper.template.php'
2799
-            : EE_ADMIN_TEMPLATE . 'admin_details_wrapper_no_sidebar.template.php';
2799
+            : EE_ADMIN_TEMPLATE.'admin_details_wrapper_no_sidebar.template.php';
2800 2800
         if (defined('DOING_AJAX') && DOING_AJAX) {
2801
-            $template_path = EE_ADMIN_TEMPLATE . 'admin_details_wrapper_no_sidebar_ajax.template.php';
2801
+            $template_path = EE_ADMIN_TEMPLATE.'admin_details_wrapper_no_sidebar_ajax.template.php';
2802 2802
         }
2803 2803
         $template_path = ! empty($this->_column_template_path)
2804 2804
             ? $this->_column_template_path : $template_path;
@@ -2863,7 +2863,7 @@  discard block
 block discarded – undo
2863 2863
             )
2864 2864
             : $this->_template_args['preview_action_button'];
2865 2865
         $this->_template_args['admin_page_content'] = EEH_Template::display_template(
2866
-            EE_ADMIN_TEMPLATE . 'admin_caf_full_page_preview.template.php',
2866
+            EE_ADMIN_TEMPLATE.'admin_caf_full_page_preview.template.php',
2867 2867
             $this->_template_args,
2868 2868
             true
2869 2869
         );
@@ -2921,7 +2921,7 @@  discard block
 block discarded – undo
2921 2921
         // setup search attributes
2922 2922
         $this->_set_search_attributes();
2923 2923
         $this->_template_args['current_page'] = $this->_wp_page_slug;
2924
-        $template_path = EE_ADMIN_TEMPLATE . 'admin_list_wrapper.template.php';
2924
+        $template_path = EE_ADMIN_TEMPLATE.'admin_list_wrapper.template.php';
2925 2925
         $this->_template_args['table_url'] = defined('DOING_AJAX')
2926 2926
             ? add_query_arg(array('noheader' => 'true', 'route' => $this->_req_action), $this->_admin_base_url)
2927 2927
             : add_query_arg(array('route' => $this->_req_action), $this->_admin_base_url);
@@ -2929,10 +2929,10 @@  discard block
 block discarded – undo
2929 2929
         $this->_template_args['current_route'] = $this->_req_action;
2930 2930
         $this->_template_args['list_table_class'] = get_class($this->_list_table_object);
2931 2931
         $ajax_sorting_callback = $this->_list_table_object->get_ajax_sorting_callback();
2932
-        if (! empty($ajax_sorting_callback)) {
2932
+        if ( ! empty($ajax_sorting_callback)) {
2933 2933
             $sortable_list_table_form_fields = wp_nonce_field(
2934
-                $ajax_sorting_callback . '_nonce',
2935
-                $ajax_sorting_callback . '_nonce',
2934
+                $ajax_sorting_callback.'_nonce',
2935
+                $ajax_sorting_callback.'_nonce',
2936 2936
                 false,
2937 2937
                 false
2938 2938
             );
@@ -2949,7 +2949,7 @@  discard block
 block discarded – undo
2949 2949
         $hidden_form_fields = isset($this->_template_args['list_table_hidden_fields'])
2950 2950
             ? $this->_template_args['list_table_hidden_fields']
2951 2951
             : '';
2952
-        $nonce_ref = $this->_req_action . '_nonce';
2952
+        $nonce_ref = $this->_req_action.'_nonce';
2953 2953
         $hidden_form_fields .= '<input type="hidden" name="'
2954 2954
                                . $nonce_ref
2955 2955
                                . '" value="'
@@ -2958,10 +2958,10 @@  discard block
 block discarded – undo
2958 2958
         $this->_template_args['list_table_hidden_fields'] = $hidden_form_fields;
2959 2959
         // display message about search results?
2960 2960
         $this->_template_args['before_list_table'] .= ! empty($this->_req_data['s'])
2961
-            ? '<p class="ee-search-results">' . sprintf(
2961
+            ? '<p class="ee-search-results">'.sprintf(
2962 2962
                 esc_html__('Displaying search results for the search string: %1$s', 'event_espresso'),
2963 2963
                 trim($this->_req_data['s'], '%')
2964
-            ) . '</p>'
2964
+            ).'</p>'
2965 2965
             : '';
2966 2966
         // filter before_list_table template arg
2967 2967
         $this->_template_args['before_list_table'] = apply_filters(
@@ -3042,12 +3042,12 @@  discard block
 block discarded – undo
3042 3042
             $this
3043 3043
         );
3044 3044
         $this->_template_args['status_change_notice'] = EEH_Template::display_template(
3045
-            EE_ADMIN_TEMPLATE . 'status_change_notice.template.php',
3046
-            [ 'context' => '__admin-legend' ],
3045
+            EE_ADMIN_TEMPLATE.'status_change_notice.template.php',
3046
+            ['context' => '__admin-legend'],
3047 3047
             true
3048 3048
         );
3049 3049
         return EEH_Template::display_template(
3050
-            EE_ADMIN_TEMPLATE . 'admin_details_legend.template.php',
3050
+            EE_ADMIN_TEMPLATE.'admin_details_legend.template.php',
3051 3051
             $this->_template_args,
3052 3052
             true
3053 3053
         );
@@ -3278,17 +3278,17 @@  discard block
 block discarded – undo
3278 3278
         // add in a hidden index for the current page (so save and close redirects properly)
3279 3279
         $this->_template_args['save_buttons'] = $referrer_url;
3280 3280
         foreach ($button_text as $key => $button) {
3281
-            $ref = $default_names[ $key ];
3281
+            $ref = $default_names[$key];
3282 3282
             $this->_template_args['save_buttons'] .= '<input type="submit" class="button-primary '
3283 3283
                                                      . $ref
3284 3284
                                                      . '" value="'
3285 3285
                                                      . $button
3286 3286
                                                      . '" name="'
3287
-                                                     . (! empty($actions) ? $actions[ $key ] : $ref)
3287
+                                                     . ( ! empty($actions) ? $actions[$key] : $ref)
3288 3288
                                                      . '" id="'
3289
-                                                     . $this->_current_view . '_' . $ref
3289
+                                                     . $this->_current_view.'_'.$ref
3290 3290
                                                      . '" />';
3291
-            if (! $both) {
3291
+            if ( ! $both) {
3292 3292
                 break;
3293 3293
             }
3294 3294
         }
@@ -3323,13 +3323,13 @@  discard block
 block discarded – undo
3323 3323
                 'An error occurred. No action was set for this page\'s form.',
3324 3324
                 'event_espresso'
3325 3325
             );
3326
-            $dev_msg = $user_msg . "\n"
3326
+            $dev_msg = $user_msg."\n"
3327 3327
                        . sprintf(
3328 3328
                            esc_html__('The $route argument is required for the %s->%s method.', 'event_espresso'),
3329 3329
                            __FUNCTION__,
3330 3330
                            EE_Admin_Page::class
3331 3331
                        );
3332
-            EE_Error::add_error($user_msg . '||' . $dev_msg, __FILE__, __FUNCTION__, __LINE__);
3332
+            EE_Error::add_error($user_msg.'||'.$dev_msg, __FILE__, __FUNCTION__, __LINE__);
3333 3333
         }
3334 3334
         // open form
3335 3335
         $this->_template_args['before_admin_page_content'] = '<form name="form" method="post" action="'
@@ -3338,8 +3338,8 @@  discard block
 block discarded – undo
3338 3338
                                                              . $route
3339 3339
                                                              . '_event_form" >';
3340 3340
         // add nonce
3341
-        $nonce = wp_nonce_field($route . '_nonce', $route . '_nonce', false, false);
3342
-        $this->_template_args['before_admin_page_content'] .= "\n\t" . $nonce;
3341
+        $nonce = wp_nonce_field($route.'_nonce', $route.'_nonce', false, false);
3342
+        $this->_template_args['before_admin_page_content'] .= "\n\t".$nonce;
3343 3343
         // add REQUIRED form action
3344 3344
         $hidden_fields = array(
3345 3345
             'action' => array('type' => 'hidden', 'value' => $route),
@@ -3352,7 +3352,7 @@  discard block
 block discarded – undo
3352 3352
         $form_fields = $this->_generate_admin_form_fields($hidden_fields, 'array');
3353 3353
         // add fields to form
3354 3354
         foreach ((array) $form_fields as $field_name => $form_field) {
3355
-            $this->_template_args['before_admin_page_content'] .= "\n\t" . $form_field['field'];
3355
+            $this->_template_args['before_admin_page_content'] .= "\n\t".$form_field['field'];
3356 3356
         }
3357 3357
         // close form
3358 3358
         $this->_template_args['after_admin_page_content'] = '</form>';
@@ -3406,12 +3406,12 @@  discard block
 block discarded – undo
3406 3406
         foreach ($this->_req_data as $ref => $value) {
3407 3407
             // unset nonces
3408 3408
             if (strpos($ref, 'nonce') !== false) {
3409
-                unset($this->_req_data[ $ref ]);
3409
+                unset($this->_req_data[$ref]);
3410 3410
                 continue;
3411 3411
             }
3412 3412
             // urlencode values.
3413 3413
             $value = is_array($value) ? array_map('urlencode', $value) : urlencode($value);
3414
-            $this->_req_data[ $ref ] = $value;
3414
+            $this->_req_data[$ref] = $value;
3415 3415
         }
3416 3416
         return array_merge($this->_req_data, $new_route_data);
3417 3417
     }
@@ -3449,10 +3449,10 @@  discard block
 block discarded – undo
3449 3449
         $redirect_url = isset($query_args['page']) ? admin_url('admin.php') : $this->_admin_base_url;
3450 3450
         $notices = EE_Error::get_notices(false);
3451 3451
         // overwrite default success messages //BUT ONLY if overwrite not overridden
3452
-        if (! $override_overwrite || ! empty($notices['errors'])) {
3452
+        if ( ! $override_overwrite || ! empty($notices['errors'])) {
3453 3453
             EE_Error::overwrite_success();
3454 3454
         }
3455
-        if (! empty($what) && ! empty($action_desc) && empty($notices['errors'])) {
3455
+        if ( ! empty($what) && ! empty($action_desc) && empty($notices['errors'])) {
3456 3456
             // how many records affected ? more than one record ? or just one ?
3457 3457
             if ($success > 1) {
3458 3458
                 // set plural msg
@@ -3481,7 +3481,7 @@  discard block
 block discarded – undo
3481 3481
             }
3482 3482
         }
3483 3483
         // check that $query_args isn't something crazy
3484
-        if (! is_array($query_args)) {
3484
+        if ( ! is_array($query_args)) {
3485 3485
             $query_args = array();
3486 3486
         }
3487 3487
         /**
@@ -3506,7 +3506,7 @@  discard block
 block discarded – undo
3506 3506
             $redirect_url = admin_url('admin.php');
3507 3507
         }
3508 3508
         // merge any default query_args set in _default_route_query_args property
3509
-        if (! empty($this->_default_route_query_args) && ! $this->_is_UI_request) {
3509
+        if ( ! empty($this->_default_route_query_args) && ! $this->_is_UI_request) {
3510 3510
             $args_to_merge = array();
3511 3511
             foreach ($this->_default_route_query_args as $query_param => $query_value) {
3512 3512
                 // is there a wp_referer array in our _default_route_query_args property?
@@ -3518,15 +3518,15 @@  discard block
 block discarded – undo
3518 3518
                         }
3519 3519
                         // finally we will override any arguments in the referer with
3520 3520
                         // what might be set on the _default_route_query_args array.
3521
-                        if (isset($this->_default_route_query_args[ $reference ])) {
3522
-                            $args_to_merge[ $reference ] = urlencode($this->_default_route_query_args[ $reference ]);
3521
+                        if (isset($this->_default_route_query_args[$reference])) {
3522
+                            $args_to_merge[$reference] = urlencode($this->_default_route_query_args[$reference]);
3523 3523
                         } else {
3524
-                            $args_to_merge[ $reference ] = urlencode($value);
3524
+                            $args_to_merge[$reference] = urlencode($value);
3525 3525
                         }
3526 3526
                     }
3527 3527
                     continue;
3528 3528
                 }
3529
-                $args_to_merge[ $query_param ] = $query_value;
3529
+                $args_to_merge[$query_param] = $query_value;
3530 3530
             }
3531 3531
             // now let's merge these arguments but override with what was specifically sent in to the
3532 3532
             // redirect.
@@ -3538,13 +3538,13 @@  discard block
 block discarded – undo
3538 3538
         if (isset($query_args['action'])) {
3539 3539
             // manually generate wp_nonce and merge that with the query vars
3540 3540
             // becuz the wp_nonce_url function wrecks havoc on some vars
3541
-            $query_args['_wpnonce'] = wp_create_nonce($query_args['action'] . '_nonce');
3541
+            $query_args['_wpnonce'] = wp_create_nonce($query_args['action'].'_nonce');
3542 3542
         }
3543 3543
         // we're adding some hooks and filters in here for processing any things just before redirects
3544 3544
         // (example: an admin page has done an insert or update and we want to run something after that).
3545
-        do_action('AHEE_redirect_' . $classname . $this->_req_action, $query_args);
3545
+        do_action('AHEE_redirect_'.$classname.$this->_req_action, $query_args);
3546 3546
         $redirect_url = apply_filters(
3547
-            'FHEE_redirect_' . $classname . $this->_req_action,
3547
+            'FHEE_redirect_'.$classname.$this->_req_action,
3548 3548
             EE_Admin_Page::add_query_args_and_nonce($query_args, $redirect_url),
3549 3549
             $query_args
3550 3550
         );
@@ -3600,7 +3600,7 @@  discard block
 block discarded – undo
3600 3600
         }
3601 3601
         $this->_template_args['notices'] = EE_Error::get_notices();
3602 3602
         // IF this isn't ajax we need to create a transient for the notices using the route (however, overridden if $sticky_notices == true)
3603
-        if (! defined('DOING_AJAX') || $sticky_notices) {
3603
+        if ( ! defined('DOING_AJAX') || $sticky_notices) {
3604 3604
             $route = isset($query_args['action']) ? $query_args['action'] : 'default';
3605 3605
             $this->_add_transient(
3606 3606
                 $route,
@@ -3640,7 +3640,7 @@  discard block
 block discarded – undo
3640 3640
         $exclude_nonce = false
3641 3641
     ) {
3642 3642
         // first let's validate the action (if $base_url is FALSE otherwise validation will happen further along)
3643
-        if (empty($base_url) && ! isset($this->_page_routes[ $action ])) {
3643
+        if (empty($base_url) && ! isset($this->_page_routes[$action])) {
3644 3644
             throw new EE_Error(
3645 3645
                 sprintf(
3646 3646
                     esc_html__(
@@ -3651,7 +3651,7 @@  discard block
 block discarded – undo
3651 3651
                 )
3652 3652
             );
3653 3653
         }
3654
-        if (! isset($this->_labels['buttons'][ $type ])) {
3654
+        if ( ! isset($this->_labels['buttons'][$type])) {
3655 3655
             throw new EE_Error(
3656 3656
                 sprintf(
3657 3657
                     __(
@@ -3664,7 +3664,7 @@  discard block
 block discarded – undo
3664 3664
         }
3665 3665
         // finally check user access for this button.
3666 3666
         $has_access = $this->check_user_access($action, true);
3667
-        if (! $has_access) {
3667
+        if ( ! $has_access) {
3668 3668
             return '';
3669 3669
         }
3670 3670
         $_base_url = ! $base_url ? $this->_admin_base_url : $base_url;
@@ -3672,11 +3672,11 @@  discard block
 block discarded – undo
3672 3672
             'action' => $action,
3673 3673
         );
3674 3674
         // merge extra_request args but make sure our original action takes precedence and doesn't get overwritten.
3675
-        if (! empty($extra_request)) {
3675
+        if ( ! empty($extra_request)) {
3676 3676
             $query_args = array_merge($extra_request, $query_args);
3677 3677
         }
3678 3678
         $url = EE_Admin_Page::add_query_args_and_nonce($query_args, $_base_url, false, $exclude_nonce);
3679
-        return EEH_Template::get_button_or_link($url, $this->_labels['buttons'][ $type ], $class);
3679
+        return EEH_Template::get_button_or_link($url, $this->_labels['buttons'][$type], $class);
3680 3680
     }
3681 3681
 
3682 3682
 
@@ -3702,7 +3702,7 @@  discard block
 block discarded – undo
3702 3702
                 'FHEE__EE_Admin_Page___per_page_screen_options__default',
3703 3703
                 20
3704 3704
             ),
3705
-            'option'  => $this->_current_page . '_' . $this->_current_view . '_per_page',
3705
+            'option'  => $this->_current_page.'_'.$this->_current_view.'_per_page',
3706 3706
         );
3707 3707
         // ONLY add the screen option if the user has access to it.
3708 3708
         if ($this->check_user_access($this->_current_view, true)) {
@@ -3723,7 +3723,7 @@  discard block
 block discarded – undo
3723 3723
     {
3724 3724
         if (isset($_POST['wp_screen_options']) && is_array($_POST['wp_screen_options'])) {
3725 3725
             check_admin_referer('screen-options-nonce', 'screenoptionnonce');
3726
-            if (! $user = wp_get_current_user()) {
3726
+            if ( ! $user = wp_get_current_user()) {
3727 3727
                 return;
3728 3728
             }
3729 3729
             $option = $_POST['wp_screen_options']['option'];
@@ -3734,7 +3734,7 @@  discard block
 block discarded – undo
3734 3734
             $map_option = $option;
3735 3735
             $option = str_replace('-', '_', $option);
3736 3736
             switch ($map_option) {
3737
-                case $this->_current_page . '_' . $this->_current_view . '_per_page':
3737
+                case $this->_current_page.'_'.$this->_current_view.'_per_page':
3738 3738
                     $value = (int) $value;
3739 3739
                     $max_value = apply_filters(
3740 3740
                         'FHEE__EE_Admin_Page___set_per_page_screen_options__max_value',
@@ -3792,13 +3792,13 @@  discard block
 block discarded – undo
3792 3792
     protected function _add_transient($route, $data, $notices = false, $skip_route_verify = false)
3793 3793
     {
3794 3794
         $user_id = get_current_user_id();
3795
-        if (! $skip_route_verify) {
3795
+        if ( ! $skip_route_verify) {
3796 3796
             $this->_verify_route($route);
3797 3797
         }
3798 3798
         // now let's set the string for what kind of transient we're setting
3799 3799
         $transient = $notices
3800
-            ? 'ee_rte_n_tx_' . $route . '_' . $user_id
3801
-            : 'rte_tx_' . $route . '_' . $user_id;
3800
+            ? 'ee_rte_n_tx_'.$route.'_'.$user_id
3801
+            : 'rte_tx_'.$route.'_'.$user_id;
3802 3802
         $data = $notices ? array('notices' => $data) : $data;
3803 3803
         // is there already a transient for this route?  If there is then let's ADD to that transient
3804 3804
         $existing = is_multisite() && is_network_admin()
@@ -3827,8 +3827,8 @@  discard block
 block discarded – undo
3827 3827
         $user_id = get_current_user_id();
3828 3828
         $route = ! $route ? $this->_req_action : $route;
3829 3829
         $transient = $notices
3830
-            ? 'ee_rte_n_tx_' . $route . '_' . $user_id
3831
-            : 'rte_tx_' . $route . '_' . $user_id;
3830
+            ? 'ee_rte_n_tx_'.$route.'_'.$user_id
3831
+            : 'rte_tx_'.$route.'_'.$user_id;
3832 3832
         $data = is_multisite() && is_network_admin()
3833 3833
             ? get_site_transient($transient)
3834 3834
             : get_transient($transient);
@@ -4052,7 +4052,7 @@  discard block
 block discarded – undo
4052 4052
      */
4053 4053
     protected function _next_link($url, $class = 'dashicons dashicons-arrow-right')
4054 4054
     {
4055
-        return '<a class="' . $class . '" href="' . $url . '"></a>';
4055
+        return '<a class="'.$class.'" href="'.$url.'"></a>';
4056 4056
     }
4057 4057
 
4058 4058
 
@@ -4065,7 +4065,7 @@  discard block
 block discarded – undo
4065 4065
      */
4066 4066
     protected function _previous_link($url, $class = 'dashicons dashicons-arrow-left')
4067 4067
     {
4068
-        return '<a class="' . $class . '" href="' . $url . '"></a>';
4068
+        return '<a class="'.$class.'" href="'.$url.'"></a>';
4069 4069
     }
4070 4070
 
4071 4071
 
Please login to merge, or discard this patch.
admin/extend/registrations/EE_Event_Registrations_List_Table.class.php 2 patches
Indentation   +557 added lines, -557 removed lines patch added patch discarded remove patch
@@ -12,566 +12,566 @@
 block discarded – undo
12 12
 class EE_Event_Registrations_List_Table extends EE_Admin_List_Table
13 13
 {
14 14
 
15
-    /**
16
-     * This property will hold the related Datetimes on an event IF the event id is included in the request.
17
-     *
18
-     * @var EE_Datetime[]
19
-     */
20
-    protected $_dtts_for_event = array();
21
-
22
-
23
-    /**
24
-     * The event if one is specified in the request
25
-     *
26
-     * @var EE_Event
27
-     */
28
-    protected $_evt = null;
29
-
30
-
31
-    /**
32
-     * The DTT_ID if the current view has a specified datetime.
33
-     *
34
-     * @var int $_cur_dtt_id
35
-     */
36
-    protected $_cur_dtt_id = 0;
37
-
38
-
39
-    /**
40
-     * EE_Event_Registrations_List_Table constructor.
41
-     *
42
-     * @param \Registrations_Admin_Page $admin_page
43
-     */
44
-    public function __construct($admin_page)
45
-    {
46
-        parent::__construct($admin_page);
47
-        $this->_status = $this->_admin_page->get_registration_status_array();
48
-    }
49
-
50
-
51
-    protected function _setup_data()
52
-    {
53
-        $this->_data = $this->_view !== 'trash' ? $this->_admin_page->get_event_attendees($this->_per_page)
54
-            : $this->_admin_page->get_event_attendees($this->_per_page, false, true);
55
-        $this->_all_data_count = $this->_view !== 'trash' ? $this->_admin_page->get_event_attendees(
56
-            $this->_per_page,
57
-            true
58
-        ) : $this->_admin_page->get_event_attendees($this->_per_page, true, true);
59
-    }
60
-
61
-
62
-    protected function _set_properties()
63
-    {
64
-        $evt_id = isset($this->_req_data['event_id']) ? $this->_req_data['event_id'] : null;
65
-        $this->_wp_list_args = array(
66
-            'singular' => __('registrant', 'event_espresso'),
67
-            'plural'   => __('registrants', 'event_espresso'),
68
-            'ajax'     => true,
69
-            'screen'   => $this->_admin_page->get_current_screen()->id,
70
-        );
71
-        $columns = array();
72
-        // $columns['_Reg_Status'] = '';
73
-        $this->_columns = array(
74
-            '_REG_att_checked_in' => '<span class="dashicons dashicons-yes ee-icon-size-18"></span>',
75
-            'ATT_name'            => __('Registrant', 'event_espresso'),
76
-            'ATT_email'           => __('Email Address', 'event_espresso'),
77
-            'Event'               => __('Event', 'event_espresso'),
78
-            'PRC_name'            => __('TKT Option', 'event_espresso'),
79
-            '_REG_final_price'    => __('Price', 'event_espresso'),
80
-            'TXN_paid'            => __('Paid', 'event_espresso'),
81
-            'TXN_total'           => __('Total', 'event_espresso'),
82
-        );
83
-        // Add/remove columns when an event has been selected
84
-        if (! empty($evt_id)) {
85
-            // Render a checkbox column
86
-            $columns['cb'] = '<input type="checkbox" />';
87
-            $this->_has_checkbox_column = true;
88
-            // Remove the 'Event' column
89
-            unset($this->_columns['Event']);
90
-        }
91
-        $this->_columns = array_merge($columns, $this->_columns);
92
-        $this->_primary_column = '_REG_att_checked_in';
93
-        if (! empty($evt_id)
94
-            && EE_Registry::instance()->CAP->current_user_can(
95
-                'ee_read_registrations',
96
-                'espresso_registrations_registrations_reports',
97
-                $evt_id
98
-            )
99
-        ) {
100
-            $this->_bottom_buttons = array(
101
-                'report' => array(
102
-                    'route'         => 'registrations_report',
103
-                    'extra_request' =>
104
-                        array(
105
-                            'EVT_ID'     => $evt_id,
106
-                            'return_url' => urlencode("//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}"),
107
-                        ),
108
-                ),
109
-            );
110
-        }
111
-        $this->_bottom_buttons['report_filtered'] = array(
112
-            'route'         => 'registrations_checkin_report',
113
-            'extra_request' => array(
114
-                'use_filters' => true,
115
-                'filters'     => array_merge(
116
-                    array(
117
-                        'EVT_ID' => $evt_id,
118
-                    ),
119
-                    array_diff_key(
120
-                        $this->_req_data,
121
-                        array_flip(
122
-                            array(
123
-                                'page',
124
-                                'action',
125
-                                'default_nonce',
126
-                            )
127
-                        )
128
-                    )
129
-                ),
130
-                'return_url'  => urlencode("//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}"),
131
-            ),
132
-        );
133
-        $this->_sortable_columns = array(
134
-            /**
135
-             * Allows users to change the default sort if they wish.
136
-             * Returning a falsey on this filter will result in the default sort to be by firstname rather than last name.
137
-             *
138
-             * Note: usual naming conventions for filters aren't followed here so that just one filter can be used to
139
-             * change the sorts on any list table involving registration contacts.  If you want to only change the filter
140
-             * for a specific list table you can use the provided reference to this object instance.
141
-             */
142
-            'ATT_name' => array(
143
-                'FHEE__EE_Registrations_List_Table___set_properties__default_sort_by_registration_last_name',
144
-                true,
145
-                $this,
146
-            )
147
-                ? array('ATT_lname' => true)
148
-                : array('ATT_fname' => true),
149
-            'Event'    => array('Event.EVT_name' => false),
150
-        );
151
-        $this->_hidden_columns = array();
152
-        $this->_evt = EEM_Event::instance()->get_one_by_ID($evt_id);
153
-        $this->_dtts_for_event = $this->_evt instanceof EE_Event ? $this->_evt->datetimes_ordered() : array();
154
-    }
155
-
156
-
157
-    /**
158
-     * @param \EE_Registration $item
159
-     * @return string
160
-     */
161
-    protected function _get_row_class($item)
162
-    {
163
-        $class = parent::_get_row_class($item);
164
-        // add status class
165
-        $class .= ' ee-status-strip reg-status-' . $item->status_ID();
166
-        if ($this->_has_checkbox_column) {
167
-            $class .= ' has-checkbox-column';
168
-        }
169
-        return $class;
170
-    }
171
-
172
-
173
-    /**
174
-     * @return array
175
-     * @throws \EE_Error
176
-     */
177
-    protected function _get_table_filters()
178
-    {
179
-        $filters = $where = array();
180
-        $current_EVT_ID = isset($this->_req_data['event_id']) ? (int) $this->_req_data['event_id'] : 0;
181
-        if (empty($this->_dtts_for_event) || count($this->_dtts_for_event) === 1) {
182
-            // this means we don't have an event so let's setup a filter dropdown for all the events to select
183
-            // note possible capability restrictions
184
-            if (! EE_Registry::instance()->CAP->current_user_can('ee_read_private_events', 'get_events')) {
185
-                $where['status**'] = array('!=', 'private');
186
-            }
187
-            if (! EE_Registry::instance()->CAP->current_user_can('ee_read_others_events', 'get_events')) {
188
-                $where['EVT_wp_user'] = get_current_user_id();
189
-            }
190
-            $events = EEM_Event::instance()->get_all(
191
-                array(
192
-                    $where,
193
-                    'order_by' => array('Datetime.DTT_EVT_start' => 'DESC'),
194
-                )
195
-            );
196
-            $evts[] = array(
197
-                'id'   => 0,
198
-                'text' => __('To toggle Check-in status, select an event', 'event_espresso'),
199
-            );
200
-            $checked = 'checked';
201
-            /** @var EE_Event $evt */
202
-            foreach ($events as $evt) {
203
-                // any registrations for this event?
204
-                if (! $evt->get_count_of_all_registrations()) {
205
-                    continue;
206
-                }
207
-                $evts[] = array(
208
-                    'id'    => $evt->ID(),
209
-                    'text'  => apply_filters(
210
-                        'FHEE__EE_Event_Registrations___get_table_filters__event_name',
211
-                        $evt->get('EVT_name'),
212
-                        $evt
213
-                    ),
214
-                    'class' => $evt->is_expired() ? 'ee-expired-event' : '',
215
-                );
216
-                if ($evt->ID() === $current_EVT_ID && $evt->is_expired()) {
217
-                    $checked = '';
218
-                }
219
-            }
220
-            $event_filter = '<div class="ee-event-filter">';
221
-            $event_filter .= EEH_Form_Fields::select_input('event_id', $evts, $current_EVT_ID);
222
-            $event_filter .= '<span class="ee-event-filter-toggle">';
223
-            $event_filter .= '<input type="checkbox" id="js-ee-hide-expired-events" ' . $checked . '> ';
224
-            $event_filter .= __('Hide Expired Events', 'event_espresso');
225
-            $event_filter .= '</span>';
226
-            $event_filter .= '</div>';
227
-            $filters[] = $event_filter;
228
-        }
229
-        if (! empty($this->_dtts_for_event)) {
230
-            // DTT datetimes filter
231
-            $this->_cur_dtt_id = isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : 0;
232
-            if (count($this->_dtts_for_event) > 1) {
233
-                $dtts[0] = __('To toggle check-in status, select a datetime.', 'event_espresso');
234
-                foreach ($this->_dtts_for_event as $dtt) {
235
-                    $datetime_string = $dtt->name();
236
-                    $datetime_string = ! empty($datetime_string) ? ' (' . $datetime_string . ')' : '';
237
-                    $datetime_string = $dtt->start_date_and_time() . ' - ' . $dtt->end_date_and_time() . $datetime_string;
238
-                    $dtts[ $dtt->ID() ] = $datetime_string;
239
-                }
240
-                $input = new EE_Select_Input(
241
-                    $dtts,
242
-                    array(
243
-                        'html_name' => 'DTT_ID',
244
-                        'html_id'   => 'DTT_ID',
245
-                        'default'   => $this->_cur_dtt_id,
246
-                    )
247
-                );
248
-                $filters[] = $input->get_html_for_input();
249
-                $filters[] = '<input type="hidden" name="event_id" value="' . $current_EVT_ID . '">';
250
-            }
251
-        }
252
-        return $filters;
253
-    }
254
-
255
-
256
-    protected function _add_view_counts()
257
-    {
258
-        $this->_views['all']['count'] = $this->_get_total_event_attendees();
259
-    }
260
-
261
-
262
-    /**
263
-     * @return int
264
-     * @throws \EE_Error
265
-     */
266
-    protected function _get_total_event_attendees()
267
-    {
268
-        $EVT_ID = isset($this->_req_data['event_id']) ? absint($this->_req_data['event_id']) : false;
269
-        $DTT_ID = $this->_cur_dtt_id;
270
-        $query_params = array();
271
-        if ($EVT_ID) {
272
-            $query_params[0]['EVT_ID'] = $EVT_ID;
273
-        }
274
-        // if DTT is included we only show for that datetime.  Otherwise we're showing for all datetimes (the event).
275
-        if ($DTT_ID) {
276
-            $query_params[0]['Ticket.Datetime.DTT_ID'] = $DTT_ID;
277
-        }
278
-        $status_ids_array = apply_filters(
279
-            'FHEE__Extend_Registrations_Admin_Page__get_event_attendees__status_ids_array',
280
-            array(EEM_Registration::status_id_pending_payment, EEM_Registration::status_id_approved)
281
-        );
282
-        $query_params[0]['STS_ID'] = array('IN', $status_ids_array);
283
-        return EEM_Registration::instance()->count($query_params);
284
-    }
285
-
286
-
287
-    /**
288
-     * @param \EE_Registration $item
289
-     * @return string
290
-     */
291
-    public function column__Reg_Status(EE_Registration $item)
292
-    {
293
-        return '<span class="ee-status-strip ee-status-strip-td reg-status-' . $item->status_ID() . '"></span>';
294
-    }
295
-
296
-
297
-    /**
298
-     * @param \EE_Registration $item
299
-     * @return string
300
-     * @throws \EE_Error
301
-     */
302
-    public function column_cb($item)
303
-    {
304
-        return sprintf('<input type="checkbox" name="checkbox[%1$s]" value="%1$s" />', $item->ID());
305
-    }
306
-
307
-
308
-    /**
309
-     * column_REG_att_checked_in
310
-     *
311
-     * @param EE_Registration $item
312
-     * @return string
313
-     * @throws EE_Error
314
-     * @throws InvalidArgumentException
315
-     * @throws InvalidDataTypeException
316
-     * @throws InvalidInterfaceException
317
-     */
318
-    public function column__REG_att_checked_in(EE_Registration $item)
319
-    {
320
-        $attendee = $item->attendee();
321
-        $attendee_name = $attendee instanceof EE_Attendee ? $attendee->full_name() : '';
322
-
323
-        if ($this->_cur_dtt_id === 0 && count($this->_dtts_for_event) === 1) {
324
-            $latest_related_datetime = $item->get_latest_related_datetime();
325
-            if ($latest_related_datetime instanceof EE_Datetime) {
326
-                $this->_cur_dtt_id = $latest_related_datetime->ID();
327
-            }
328
-        }
329
-        $checkin_status_dashicon = CheckinStatusDashicon::fromRegistrationAndDatetimeId(
330
-            $item,
331
-            $this->_cur_dtt_id
332
-        );
333
-        $nonce = wp_create_nonce('checkin_nonce');
334
-        $toggle_active = ! empty($this->_cur_dtt_id)
335
-                         && EE_Registry::instance()->CAP->current_user_can(
336
-                             'ee_edit_checkin',
337
-                             'espresso_registrations_toggle_checkin_status',
338
-                             $item->ID()
339
-                         )
340
-            ? ' clickable trigger-checkin'
341
-            : '';
342
-        $mobile_view_content = ' <span class="show-on-mobile-view-only">' . $attendee_name . '</span>';
343
-        return '<span class="' . $checkin_status_dashicon->cssClasses() . $toggle_active . '"'
344
-               . ' data-_regid="' . $item->ID() . '"'
345
-               . ' data-dttid="' . $this->_cur_dtt_id . '"'
346
-               . ' data-nonce="' . $nonce . '">'
347
-               . '</span>'
348
-               . $mobile_view_content;
349
-    }
350
-
351
-
352
-    /**
353
-     * @param \EE_Registration $item
354
-     * @return mixed|string|void
355
-     * @throws \EE_Error
356
-     */
357
-    public function column_ATT_name(EE_Registration $item)
358
-    {
359
-        $attendee = $item->attendee();
360
-        if (! $attendee instanceof EE_Attendee) {
361
-            return __('No contact record for this registration.', 'event_espresso');
362
-        }
363
-        // edit attendee link
364
-        $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(
365
-            array('action' => 'view_registration', '_REG_ID' => $item->ID()),
366
-            REG_ADMIN_URL
367
-        );
368
-        $name_link = EE_Registry::instance()->CAP->current_user_can(
369
-            'ee_edit_contacts',
370
-            'espresso_registrations_edit_attendee'
371
-        )
372
-            ? '<a href="' . $edit_lnk_url . '" title="' . esc_attr__('View Registration Details', 'event_espresso') . '">'
373
-              . $item->attendee()->full_name()
374
-              . '</a>'
375
-            : $item->attendee()->full_name();
376
-        $name_link .= $item->count() === 1
377
-            ? '&nbsp;<sup><div class="dashicons dashicons-star-filled yellow-icon ee-icon-size-8"></div></sup>	'
378
-            : '';
379
-        // add group details
380
-        $name_link .= '&nbsp;' . sprintf(__('(%s of %s)', 'event_espresso'), $item->count(), $item->group_size());
381
-        // add regcode
382
-        $link = EE_Admin_Page::add_query_args_and_nonce(
383
-            array('action' => 'view_registration', '_REG_ID' => $item->ID()),
384
-            REG_ADMIN_URL
385
-        );
386
-        $name_link .= '<br>';
387
-        $name_link .= EE_Registry::instance()->instance()->CAP->current_user_can(
388
-            'ee_read_registration',
389
-            'view_registration',
390
-            $item->ID()
391
-        )
392
-            ? '<a href="' . $link . '" title="' . esc_attr__('View Registration Details', 'event_espresso') . '">'
393
-              . $item->reg_code()
394
-              . '</a>'
395
-            : $item->reg_code();
396
-        // status
397
-        $name_link .= '<br><span class="ee-status-text-small">';
398
-        $name_link .= EEH_Template::pretty_status($item->status_ID(), false, 'sentence');
399
-        $name_link .= '</span>';
400
-        $actions = array();
401
-        $DTT_ID = $this->_cur_dtt_id;
402
-        $latest_related_datetime = empty($DTT_ID) && ! empty($this->_req_data['event_id']) && $item instanceof EE_Registration
403
-            ? $item->get_latest_related_datetime()
404
-            : null;
405
-        $DTT_ID = $latest_related_datetime instanceof EE_Datetime
406
-            ? $latest_related_datetime->ID()
407
-            : $DTT_ID;
408
-        if (! empty($DTT_ID)
409
-            && EE_Registry::instance()->CAP->current_user_can(
410
-                'ee_read_checkins',
411
-                'espresso_registrations_registration_checkins'
412
-            )
413
-        ) {
414
-            $checkin_list_url = EE_Admin_Page::add_query_args_and_nonce(
415
-                array('action' => 'registration_checkins', '_REG_ID' => $item->ID(), 'DTT_ID' => $DTT_ID),
416
-                REG_ADMIN_URL
417
-            );
418
-            // get the timestamps for this registration's checkins, related to the selected datetime
419
-            $timestamps = $item->get_many_related('Checkin', array(array('DTT_ID' => $DTT_ID)));
420
-            if (! empty($timestamps)) {
421
-                // get the last timestamp
422
-                $last_timestamp = end($timestamps);
423
-                // checked in or checked out?
424
-                $checkin_status = $last_timestamp->get('CHK_in')
425
-                    ? esc_html__('Checked In', 'event_espresso')
426
-                    : esc_html__('Checked Out', 'event_espresso');
427
-                // get timestamp string
428
-                $timestamp_string = $last_timestamp->get_datetime('CHK_timestamp');
429
-                $actions['checkin'] = '<a href="' . $checkin_list_url . '" title="'
430
-                                      . esc_attr__(
431
-                                          'View this registrant\'s check-ins/checkouts for the datetime',
432
-                                          'event_espresso'
433
-                                      ) . '">' . $checkin_status . ': ' . $timestamp_string . '</a>';
434
-            }
435
-        }
436
-        return (! empty($DTT_ID) && ! empty($timestamps))
437
-            ? sprintf('%1$s %2$s', $name_link, $this->row_actions($actions, true))
438
-            : $name_link;
439
-    }
440
-
441
-
442
-    /**
443
-     * @param \EE_Registration $item
444
-     * @return string
445
-     */
446
-    public function column_ATT_email(EE_Registration $item)
447
-    {
448
-        $attendee = $item->attendee();
449
-        return $attendee instanceof EE_Attendee ? $attendee->email() : '';
450
-    }
451
-
452
-
453
-    /**
454
-     * @param \EE_Registration $item
455
-     * @return bool|string
456
-     * @throws \EE_Error
457
-     */
458
-    public function column_Event(EE_Registration $item)
459
-    {
460
-        try {
461
-            $event = $this->_evt instanceof EE_Event ? $this->_evt : $item->event();
462
-            $chkin_lnk_url = EE_Admin_Page::add_query_args_and_nonce(
463
-                array('action' => 'event_registrations', 'event_id' => $event->ID()),
464
-                REG_ADMIN_URL
465
-            );
466
-            $event_label = EE_Registry::instance()->CAP->current_user_can(
467
-                'ee_read_checkins',
468
-                'espresso_registrations_registration_checkins'
469
-            ) ? '<a href="' . $chkin_lnk_url . '" title="'
470
-                . esc_attr__(
471
-                    'View Checkins for this Event',
472
-                    'event_espresso'
473
-                ) . '">' . $event->name() . '</a>' : $event->name();
474
-        } catch (\EventEspresso\core\exceptions\EntityNotFoundException $e) {
475
-            $event_label = esc_html__('Unknown', 'event_espresso');
476
-        }
477
-        return $event_label;
478
-    }
479
-
480
-
481
-    /**
482
-     * @param \EE_Registration $item
483
-     * @return mixed|string|void
484
-     */
485
-    public function column_PRC_name(EE_Registration $item)
486
-    {
487
-        return $item->ticket() instanceof EE_Ticket ? $item->ticket()->name() : __("Unknown", "event_espresso");
488
-    }
489
-
490
-
491
-    /**
492
-     * column_REG_final_price
493
-     *
494
-     * @param \EE_Registration $item
495
-     * @return string
496
-     */
497
-    public function column__REG_final_price(EE_Registration $item)
498
-    {
499
-        return '<span class="reg-pad-rght">' . ' ' . $item->pretty_final_price() . '</span>';
500
-    }
501
-
502
-
503
-    /**
504
-     * column_TXN_paid
505
-     *
506
-     * @param \EE_Registration $item
507
-     * @return string
508
-     * @throws \EE_Error
509
-     */
510
-    public function column_TXN_paid(EE_Registration $item)
511
-    {
512
-        if ($item->count() === 1) {
513
-            if ($item->transaction()->paid() >= $item->transaction()->total()) {
514
-                return '<span class="reg-pad-rght"><div class="dashicons dashicons-yes green-icon"></div></span>';
515
-            } else {
516
-                $view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce(
517
-                    array('action' => 'view_transaction', 'TXN_ID' => $item->transaction_ID()),
518
-                    TXN_ADMIN_URL
519
-                );
520
-                return EE_Registry::instance()->CAP->current_user_can(
521
-                    'ee_read_transaction',
522
-                    'espresso_transactions_view_transaction'
523
-                ) ? '
15
+	/**
16
+	 * This property will hold the related Datetimes on an event IF the event id is included in the request.
17
+	 *
18
+	 * @var EE_Datetime[]
19
+	 */
20
+	protected $_dtts_for_event = array();
21
+
22
+
23
+	/**
24
+	 * The event if one is specified in the request
25
+	 *
26
+	 * @var EE_Event
27
+	 */
28
+	protected $_evt = null;
29
+
30
+
31
+	/**
32
+	 * The DTT_ID if the current view has a specified datetime.
33
+	 *
34
+	 * @var int $_cur_dtt_id
35
+	 */
36
+	protected $_cur_dtt_id = 0;
37
+
38
+
39
+	/**
40
+	 * EE_Event_Registrations_List_Table constructor.
41
+	 *
42
+	 * @param \Registrations_Admin_Page $admin_page
43
+	 */
44
+	public function __construct($admin_page)
45
+	{
46
+		parent::__construct($admin_page);
47
+		$this->_status = $this->_admin_page->get_registration_status_array();
48
+	}
49
+
50
+
51
+	protected function _setup_data()
52
+	{
53
+		$this->_data = $this->_view !== 'trash' ? $this->_admin_page->get_event_attendees($this->_per_page)
54
+			: $this->_admin_page->get_event_attendees($this->_per_page, false, true);
55
+		$this->_all_data_count = $this->_view !== 'trash' ? $this->_admin_page->get_event_attendees(
56
+			$this->_per_page,
57
+			true
58
+		) : $this->_admin_page->get_event_attendees($this->_per_page, true, true);
59
+	}
60
+
61
+
62
+	protected function _set_properties()
63
+	{
64
+		$evt_id = isset($this->_req_data['event_id']) ? $this->_req_data['event_id'] : null;
65
+		$this->_wp_list_args = array(
66
+			'singular' => __('registrant', 'event_espresso'),
67
+			'plural'   => __('registrants', 'event_espresso'),
68
+			'ajax'     => true,
69
+			'screen'   => $this->_admin_page->get_current_screen()->id,
70
+		);
71
+		$columns = array();
72
+		// $columns['_Reg_Status'] = '';
73
+		$this->_columns = array(
74
+			'_REG_att_checked_in' => '<span class="dashicons dashicons-yes ee-icon-size-18"></span>',
75
+			'ATT_name'            => __('Registrant', 'event_espresso'),
76
+			'ATT_email'           => __('Email Address', 'event_espresso'),
77
+			'Event'               => __('Event', 'event_espresso'),
78
+			'PRC_name'            => __('TKT Option', 'event_espresso'),
79
+			'_REG_final_price'    => __('Price', 'event_espresso'),
80
+			'TXN_paid'            => __('Paid', 'event_espresso'),
81
+			'TXN_total'           => __('Total', 'event_espresso'),
82
+		);
83
+		// Add/remove columns when an event has been selected
84
+		if (! empty($evt_id)) {
85
+			// Render a checkbox column
86
+			$columns['cb'] = '<input type="checkbox" />';
87
+			$this->_has_checkbox_column = true;
88
+			// Remove the 'Event' column
89
+			unset($this->_columns['Event']);
90
+		}
91
+		$this->_columns = array_merge($columns, $this->_columns);
92
+		$this->_primary_column = '_REG_att_checked_in';
93
+		if (! empty($evt_id)
94
+			&& EE_Registry::instance()->CAP->current_user_can(
95
+				'ee_read_registrations',
96
+				'espresso_registrations_registrations_reports',
97
+				$evt_id
98
+			)
99
+		) {
100
+			$this->_bottom_buttons = array(
101
+				'report' => array(
102
+					'route'         => 'registrations_report',
103
+					'extra_request' =>
104
+						array(
105
+							'EVT_ID'     => $evt_id,
106
+							'return_url' => urlencode("//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}"),
107
+						),
108
+				),
109
+			);
110
+		}
111
+		$this->_bottom_buttons['report_filtered'] = array(
112
+			'route'         => 'registrations_checkin_report',
113
+			'extra_request' => array(
114
+				'use_filters' => true,
115
+				'filters'     => array_merge(
116
+					array(
117
+						'EVT_ID' => $evt_id,
118
+					),
119
+					array_diff_key(
120
+						$this->_req_data,
121
+						array_flip(
122
+							array(
123
+								'page',
124
+								'action',
125
+								'default_nonce',
126
+							)
127
+						)
128
+					)
129
+				),
130
+				'return_url'  => urlencode("//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}"),
131
+			),
132
+		);
133
+		$this->_sortable_columns = array(
134
+			/**
135
+			 * Allows users to change the default sort if they wish.
136
+			 * Returning a falsey on this filter will result in the default sort to be by firstname rather than last name.
137
+			 *
138
+			 * Note: usual naming conventions for filters aren't followed here so that just one filter can be used to
139
+			 * change the sorts on any list table involving registration contacts.  If you want to only change the filter
140
+			 * for a specific list table you can use the provided reference to this object instance.
141
+			 */
142
+			'ATT_name' => array(
143
+				'FHEE__EE_Registrations_List_Table___set_properties__default_sort_by_registration_last_name',
144
+				true,
145
+				$this,
146
+			)
147
+				? array('ATT_lname' => true)
148
+				: array('ATT_fname' => true),
149
+			'Event'    => array('Event.EVT_name' => false),
150
+		);
151
+		$this->_hidden_columns = array();
152
+		$this->_evt = EEM_Event::instance()->get_one_by_ID($evt_id);
153
+		$this->_dtts_for_event = $this->_evt instanceof EE_Event ? $this->_evt->datetimes_ordered() : array();
154
+	}
155
+
156
+
157
+	/**
158
+	 * @param \EE_Registration $item
159
+	 * @return string
160
+	 */
161
+	protected function _get_row_class($item)
162
+	{
163
+		$class = parent::_get_row_class($item);
164
+		// add status class
165
+		$class .= ' ee-status-strip reg-status-' . $item->status_ID();
166
+		if ($this->_has_checkbox_column) {
167
+			$class .= ' has-checkbox-column';
168
+		}
169
+		return $class;
170
+	}
171
+
172
+
173
+	/**
174
+	 * @return array
175
+	 * @throws \EE_Error
176
+	 */
177
+	protected function _get_table_filters()
178
+	{
179
+		$filters = $where = array();
180
+		$current_EVT_ID = isset($this->_req_data['event_id']) ? (int) $this->_req_data['event_id'] : 0;
181
+		if (empty($this->_dtts_for_event) || count($this->_dtts_for_event) === 1) {
182
+			// this means we don't have an event so let's setup a filter dropdown for all the events to select
183
+			// note possible capability restrictions
184
+			if (! EE_Registry::instance()->CAP->current_user_can('ee_read_private_events', 'get_events')) {
185
+				$where['status**'] = array('!=', 'private');
186
+			}
187
+			if (! EE_Registry::instance()->CAP->current_user_can('ee_read_others_events', 'get_events')) {
188
+				$where['EVT_wp_user'] = get_current_user_id();
189
+			}
190
+			$events = EEM_Event::instance()->get_all(
191
+				array(
192
+					$where,
193
+					'order_by' => array('Datetime.DTT_EVT_start' => 'DESC'),
194
+				)
195
+			);
196
+			$evts[] = array(
197
+				'id'   => 0,
198
+				'text' => __('To toggle Check-in status, select an event', 'event_espresso'),
199
+			);
200
+			$checked = 'checked';
201
+			/** @var EE_Event $evt */
202
+			foreach ($events as $evt) {
203
+				// any registrations for this event?
204
+				if (! $evt->get_count_of_all_registrations()) {
205
+					continue;
206
+				}
207
+				$evts[] = array(
208
+					'id'    => $evt->ID(),
209
+					'text'  => apply_filters(
210
+						'FHEE__EE_Event_Registrations___get_table_filters__event_name',
211
+						$evt->get('EVT_name'),
212
+						$evt
213
+					),
214
+					'class' => $evt->is_expired() ? 'ee-expired-event' : '',
215
+				);
216
+				if ($evt->ID() === $current_EVT_ID && $evt->is_expired()) {
217
+					$checked = '';
218
+				}
219
+			}
220
+			$event_filter = '<div class="ee-event-filter">';
221
+			$event_filter .= EEH_Form_Fields::select_input('event_id', $evts, $current_EVT_ID);
222
+			$event_filter .= '<span class="ee-event-filter-toggle">';
223
+			$event_filter .= '<input type="checkbox" id="js-ee-hide-expired-events" ' . $checked . '> ';
224
+			$event_filter .= __('Hide Expired Events', 'event_espresso');
225
+			$event_filter .= '</span>';
226
+			$event_filter .= '</div>';
227
+			$filters[] = $event_filter;
228
+		}
229
+		if (! empty($this->_dtts_for_event)) {
230
+			// DTT datetimes filter
231
+			$this->_cur_dtt_id = isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : 0;
232
+			if (count($this->_dtts_for_event) > 1) {
233
+				$dtts[0] = __('To toggle check-in status, select a datetime.', 'event_espresso');
234
+				foreach ($this->_dtts_for_event as $dtt) {
235
+					$datetime_string = $dtt->name();
236
+					$datetime_string = ! empty($datetime_string) ? ' (' . $datetime_string . ')' : '';
237
+					$datetime_string = $dtt->start_date_and_time() . ' - ' . $dtt->end_date_and_time() . $datetime_string;
238
+					$dtts[ $dtt->ID() ] = $datetime_string;
239
+				}
240
+				$input = new EE_Select_Input(
241
+					$dtts,
242
+					array(
243
+						'html_name' => 'DTT_ID',
244
+						'html_id'   => 'DTT_ID',
245
+						'default'   => $this->_cur_dtt_id,
246
+					)
247
+				);
248
+				$filters[] = $input->get_html_for_input();
249
+				$filters[] = '<input type="hidden" name="event_id" value="' . $current_EVT_ID . '">';
250
+			}
251
+		}
252
+		return $filters;
253
+	}
254
+
255
+
256
+	protected function _add_view_counts()
257
+	{
258
+		$this->_views['all']['count'] = $this->_get_total_event_attendees();
259
+	}
260
+
261
+
262
+	/**
263
+	 * @return int
264
+	 * @throws \EE_Error
265
+	 */
266
+	protected function _get_total_event_attendees()
267
+	{
268
+		$EVT_ID = isset($this->_req_data['event_id']) ? absint($this->_req_data['event_id']) : false;
269
+		$DTT_ID = $this->_cur_dtt_id;
270
+		$query_params = array();
271
+		if ($EVT_ID) {
272
+			$query_params[0]['EVT_ID'] = $EVT_ID;
273
+		}
274
+		// if DTT is included we only show for that datetime.  Otherwise we're showing for all datetimes (the event).
275
+		if ($DTT_ID) {
276
+			$query_params[0]['Ticket.Datetime.DTT_ID'] = $DTT_ID;
277
+		}
278
+		$status_ids_array = apply_filters(
279
+			'FHEE__Extend_Registrations_Admin_Page__get_event_attendees__status_ids_array',
280
+			array(EEM_Registration::status_id_pending_payment, EEM_Registration::status_id_approved)
281
+		);
282
+		$query_params[0]['STS_ID'] = array('IN', $status_ids_array);
283
+		return EEM_Registration::instance()->count($query_params);
284
+	}
285
+
286
+
287
+	/**
288
+	 * @param \EE_Registration $item
289
+	 * @return string
290
+	 */
291
+	public function column__Reg_Status(EE_Registration $item)
292
+	{
293
+		return '<span class="ee-status-strip ee-status-strip-td reg-status-' . $item->status_ID() . '"></span>';
294
+	}
295
+
296
+
297
+	/**
298
+	 * @param \EE_Registration $item
299
+	 * @return string
300
+	 * @throws \EE_Error
301
+	 */
302
+	public function column_cb($item)
303
+	{
304
+		return sprintf('<input type="checkbox" name="checkbox[%1$s]" value="%1$s" />', $item->ID());
305
+	}
306
+
307
+
308
+	/**
309
+	 * column_REG_att_checked_in
310
+	 *
311
+	 * @param EE_Registration $item
312
+	 * @return string
313
+	 * @throws EE_Error
314
+	 * @throws InvalidArgumentException
315
+	 * @throws InvalidDataTypeException
316
+	 * @throws InvalidInterfaceException
317
+	 */
318
+	public function column__REG_att_checked_in(EE_Registration $item)
319
+	{
320
+		$attendee = $item->attendee();
321
+		$attendee_name = $attendee instanceof EE_Attendee ? $attendee->full_name() : '';
322
+
323
+		if ($this->_cur_dtt_id === 0 && count($this->_dtts_for_event) === 1) {
324
+			$latest_related_datetime = $item->get_latest_related_datetime();
325
+			if ($latest_related_datetime instanceof EE_Datetime) {
326
+				$this->_cur_dtt_id = $latest_related_datetime->ID();
327
+			}
328
+		}
329
+		$checkin_status_dashicon = CheckinStatusDashicon::fromRegistrationAndDatetimeId(
330
+			$item,
331
+			$this->_cur_dtt_id
332
+		);
333
+		$nonce = wp_create_nonce('checkin_nonce');
334
+		$toggle_active = ! empty($this->_cur_dtt_id)
335
+						 && EE_Registry::instance()->CAP->current_user_can(
336
+							 'ee_edit_checkin',
337
+							 'espresso_registrations_toggle_checkin_status',
338
+							 $item->ID()
339
+						 )
340
+			? ' clickable trigger-checkin'
341
+			: '';
342
+		$mobile_view_content = ' <span class="show-on-mobile-view-only">' . $attendee_name . '</span>';
343
+		return '<span class="' . $checkin_status_dashicon->cssClasses() . $toggle_active . '"'
344
+			   . ' data-_regid="' . $item->ID() . '"'
345
+			   . ' data-dttid="' . $this->_cur_dtt_id . '"'
346
+			   . ' data-nonce="' . $nonce . '">'
347
+			   . '</span>'
348
+			   . $mobile_view_content;
349
+	}
350
+
351
+
352
+	/**
353
+	 * @param \EE_Registration $item
354
+	 * @return mixed|string|void
355
+	 * @throws \EE_Error
356
+	 */
357
+	public function column_ATT_name(EE_Registration $item)
358
+	{
359
+		$attendee = $item->attendee();
360
+		if (! $attendee instanceof EE_Attendee) {
361
+			return __('No contact record for this registration.', 'event_espresso');
362
+		}
363
+		// edit attendee link
364
+		$edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(
365
+			array('action' => 'view_registration', '_REG_ID' => $item->ID()),
366
+			REG_ADMIN_URL
367
+		);
368
+		$name_link = EE_Registry::instance()->CAP->current_user_can(
369
+			'ee_edit_contacts',
370
+			'espresso_registrations_edit_attendee'
371
+		)
372
+			? '<a href="' . $edit_lnk_url . '" title="' . esc_attr__('View Registration Details', 'event_espresso') . '">'
373
+			  . $item->attendee()->full_name()
374
+			  . '</a>'
375
+			: $item->attendee()->full_name();
376
+		$name_link .= $item->count() === 1
377
+			? '&nbsp;<sup><div class="dashicons dashicons-star-filled yellow-icon ee-icon-size-8"></div></sup>	'
378
+			: '';
379
+		// add group details
380
+		$name_link .= '&nbsp;' . sprintf(__('(%s of %s)', 'event_espresso'), $item->count(), $item->group_size());
381
+		// add regcode
382
+		$link = EE_Admin_Page::add_query_args_and_nonce(
383
+			array('action' => 'view_registration', '_REG_ID' => $item->ID()),
384
+			REG_ADMIN_URL
385
+		);
386
+		$name_link .= '<br>';
387
+		$name_link .= EE_Registry::instance()->instance()->CAP->current_user_can(
388
+			'ee_read_registration',
389
+			'view_registration',
390
+			$item->ID()
391
+		)
392
+			? '<a href="' . $link . '" title="' . esc_attr__('View Registration Details', 'event_espresso') . '">'
393
+			  . $item->reg_code()
394
+			  . '</a>'
395
+			: $item->reg_code();
396
+		// status
397
+		$name_link .= '<br><span class="ee-status-text-small">';
398
+		$name_link .= EEH_Template::pretty_status($item->status_ID(), false, 'sentence');
399
+		$name_link .= '</span>';
400
+		$actions = array();
401
+		$DTT_ID = $this->_cur_dtt_id;
402
+		$latest_related_datetime = empty($DTT_ID) && ! empty($this->_req_data['event_id']) && $item instanceof EE_Registration
403
+			? $item->get_latest_related_datetime()
404
+			: null;
405
+		$DTT_ID = $latest_related_datetime instanceof EE_Datetime
406
+			? $latest_related_datetime->ID()
407
+			: $DTT_ID;
408
+		if (! empty($DTT_ID)
409
+			&& EE_Registry::instance()->CAP->current_user_can(
410
+				'ee_read_checkins',
411
+				'espresso_registrations_registration_checkins'
412
+			)
413
+		) {
414
+			$checkin_list_url = EE_Admin_Page::add_query_args_and_nonce(
415
+				array('action' => 'registration_checkins', '_REG_ID' => $item->ID(), 'DTT_ID' => $DTT_ID),
416
+				REG_ADMIN_URL
417
+			);
418
+			// get the timestamps for this registration's checkins, related to the selected datetime
419
+			$timestamps = $item->get_many_related('Checkin', array(array('DTT_ID' => $DTT_ID)));
420
+			if (! empty($timestamps)) {
421
+				// get the last timestamp
422
+				$last_timestamp = end($timestamps);
423
+				// checked in or checked out?
424
+				$checkin_status = $last_timestamp->get('CHK_in')
425
+					? esc_html__('Checked In', 'event_espresso')
426
+					: esc_html__('Checked Out', 'event_espresso');
427
+				// get timestamp string
428
+				$timestamp_string = $last_timestamp->get_datetime('CHK_timestamp');
429
+				$actions['checkin'] = '<a href="' . $checkin_list_url . '" title="'
430
+									  . esc_attr__(
431
+										  'View this registrant\'s check-ins/checkouts for the datetime',
432
+										  'event_espresso'
433
+									  ) . '">' . $checkin_status . ': ' . $timestamp_string . '</a>';
434
+			}
435
+		}
436
+		return (! empty($DTT_ID) && ! empty($timestamps))
437
+			? sprintf('%1$s %2$s', $name_link, $this->row_actions($actions, true))
438
+			: $name_link;
439
+	}
440
+
441
+
442
+	/**
443
+	 * @param \EE_Registration $item
444
+	 * @return string
445
+	 */
446
+	public function column_ATT_email(EE_Registration $item)
447
+	{
448
+		$attendee = $item->attendee();
449
+		return $attendee instanceof EE_Attendee ? $attendee->email() : '';
450
+	}
451
+
452
+
453
+	/**
454
+	 * @param \EE_Registration $item
455
+	 * @return bool|string
456
+	 * @throws \EE_Error
457
+	 */
458
+	public function column_Event(EE_Registration $item)
459
+	{
460
+		try {
461
+			$event = $this->_evt instanceof EE_Event ? $this->_evt : $item->event();
462
+			$chkin_lnk_url = EE_Admin_Page::add_query_args_and_nonce(
463
+				array('action' => 'event_registrations', 'event_id' => $event->ID()),
464
+				REG_ADMIN_URL
465
+			);
466
+			$event_label = EE_Registry::instance()->CAP->current_user_can(
467
+				'ee_read_checkins',
468
+				'espresso_registrations_registration_checkins'
469
+			) ? '<a href="' . $chkin_lnk_url . '" title="'
470
+				. esc_attr__(
471
+					'View Checkins for this Event',
472
+					'event_espresso'
473
+				) . '">' . $event->name() . '</a>' : $event->name();
474
+		} catch (\EventEspresso\core\exceptions\EntityNotFoundException $e) {
475
+			$event_label = esc_html__('Unknown', 'event_espresso');
476
+		}
477
+		return $event_label;
478
+	}
479
+
480
+
481
+	/**
482
+	 * @param \EE_Registration $item
483
+	 * @return mixed|string|void
484
+	 */
485
+	public function column_PRC_name(EE_Registration $item)
486
+	{
487
+		return $item->ticket() instanceof EE_Ticket ? $item->ticket()->name() : __("Unknown", "event_espresso");
488
+	}
489
+
490
+
491
+	/**
492
+	 * column_REG_final_price
493
+	 *
494
+	 * @param \EE_Registration $item
495
+	 * @return string
496
+	 */
497
+	public function column__REG_final_price(EE_Registration $item)
498
+	{
499
+		return '<span class="reg-pad-rght">' . ' ' . $item->pretty_final_price() . '</span>';
500
+	}
501
+
502
+
503
+	/**
504
+	 * column_TXN_paid
505
+	 *
506
+	 * @param \EE_Registration $item
507
+	 * @return string
508
+	 * @throws \EE_Error
509
+	 */
510
+	public function column_TXN_paid(EE_Registration $item)
511
+	{
512
+		if ($item->count() === 1) {
513
+			if ($item->transaction()->paid() >= $item->transaction()->total()) {
514
+				return '<span class="reg-pad-rght"><div class="dashicons dashicons-yes green-icon"></div></span>';
515
+			} else {
516
+				$view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce(
517
+					array('action' => 'view_transaction', 'TXN_ID' => $item->transaction_ID()),
518
+					TXN_ADMIN_URL
519
+				);
520
+				return EE_Registry::instance()->CAP->current_user_can(
521
+					'ee_read_transaction',
522
+					'espresso_transactions_view_transaction'
523
+				) ? '
524 524
 				<span class="reg-pad-rght">
525 525
 					<a class="status-'
526
-                    . $item->transaction()->status_ID()
527
-                    . '" href="'
528
-                    . $view_txn_lnk_url
529
-                    . '"  title="'
530
-                    . esc_attr__('View Transaction', 'event_espresso')
531
-                    . '">
526
+					. $item->transaction()->status_ID()
527
+					. '" href="'
528
+					. $view_txn_lnk_url
529
+					. '"  title="'
530
+					. esc_attr__('View Transaction', 'event_espresso')
531
+					. '">
532 532
 						'
533
-                    . $item->transaction()->pretty_paid()
534
-                    . '
533
+					. $item->transaction()->pretty_paid()
534
+					. '
535 535
 					</a>
536 536
 				<span>' : '<span class="reg-pad-rght">' . $item->transaction()->pretty_paid() . '</span>';
537
-            }
538
-        } else {
539
-            return '<span class="reg-pad-rght"></span>';
540
-        }
541
-    }
542
-
543
-
544
-    /**
545
-     *        column_TXN_total
546
-     *
547
-     * @param \EE_Registration $item
548
-     * @return string
549
-     * @throws \EE_Error
550
-     */
551
-    public function column_TXN_total(EE_Registration $item)
552
-    {
553
-        $txn = $item->transaction();
554
-        $view_txn_url = add_query_arg(array('action' => 'view_transaction', 'TXN_ID' => $txn->ID()), TXN_ADMIN_URL);
555
-        if ($item->get('REG_count') === 1) {
556
-            $line_total_obj = $txn->total_line_item();
557
-            $txn_total = $line_total_obj instanceof EE_Line_Item
558
-                ? $line_total_obj->get_pretty('LIN_total')
559
-                : __(
560
-                    'View Transaction',
561
-                    'event_espresso'
562
-                );
563
-            return EE_Registry::instance()->CAP->current_user_can(
564
-                'ee_read_transaction',
565
-                'espresso_transactions_view_transaction'
566
-            ) ? '<a href="'
567
-                . $view_txn_url
568
-                . '" title="'
569
-                . esc_attr__('View Transaction', 'event_espresso')
570
-                . '"><span class="reg-pad-rght">'
571
-                . $txn_total
572
-                . '</span></a>' : '<span class="reg-pad-rght">' . $txn_total . '</span>';
573
-        } else {
574
-            return '<span class="reg-pad-rght"></span>';
575
-        }
576
-    }
537
+			}
538
+		} else {
539
+			return '<span class="reg-pad-rght"></span>';
540
+		}
541
+	}
542
+
543
+
544
+	/**
545
+	 *        column_TXN_total
546
+	 *
547
+	 * @param \EE_Registration $item
548
+	 * @return string
549
+	 * @throws \EE_Error
550
+	 */
551
+	public function column_TXN_total(EE_Registration $item)
552
+	{
553
+		$txn = $item->transaction();
554
+		$view_txn_url = add_query_arg(array('action' => 'view_transaction', 'TXN_ID' => $txn->ID()), TXN_ADMIN_URL);
555
+		if ($item->get('REG_count') === 1) {
556
+			$line_total_obj = $txn->total_line_item();
557
+			$txn_total = $line_total_obj instanceof EE_Line_Item
558
+				? $line_total_obj->get_pretty('LIN_total')
559
+				: __(
560
+					'View Transaction',
561
+					'event_espresso'
562
+				);
563
+			return EE_Registry::instance()->CAP->current_user_can(
564
+				'ee_read_transaction',
565
+				'espresso_transactions_view_transaction'
566
+			) ? '<a href="'
567
+				. $view_txn_url
568
+				. '" title="'
569
+				. esc_attr__('View Transaction', 'event_espresso')
570
+				. '"><span class="reg-pad-rght">'
571
+				. $txn_total
572
+				. '</span></a>' : '<span class="reg-pad-rght">' . $txn_total . '</span>';
573
+		} else {
574
+			return '<span class="reg-pad-rght"></span>';
575
+		}
576
+	}
577 577
 }
Please login to merge, or discard this patch.
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
             'TXN_total'           => __('Total', 'event_espresso'),
82 82
         );
83 83
         // Add/remove columns when an event has been selected
84
-        if (! empty($evt_id)) {
84
+        if ( ! empty($evt_id)) {
85 85
             // Render a checkbox column
86 86
             $columns['cb'] = '<input type="checkbox" />';
87 87
             $this->_has_checkbox_column = true;
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
         }
91 91
         $this->_columns = array_merge($columns, $this->_columns);
92 92
         $this->_primary_column = '_REG_att_checked_in';
93
-        if (! empty($evt_id)
93
+        if ( ! empty($evt_id)
94 94
             && EE_Registry::instance()->CAP->current_user_can(
95 95
                 'ee_read_registrations',
96 96
                 'espresso_registrations_registrations_reports',
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
     {
163 163
         $class = parent::_get_row_class($item);
164 164
         // add status class
165
-        $class .= ' ee-status-strip reg-status-' . $item->status_ID();
165
+        $class .= ' ee-status-strip reg-status-'.$item->status_ID();
166 166
         if ($this->_has_checkbox_column) {
167 167
             $class .= ' has-checkbox-column';
168 168
         }
@@ -181,10 +181,10 @@  discard block
 block discarded – undo
181 181
         if (empty($this->_dtts_for_event) || count($this->_dtts_for_event) === 1) {
182 182
             // this means we don't have an event so let's setup a filter dropdown for all the events to select
183 183
             // note possible capability restrictions
184
-            if (! EE_Registry::instance()->CAP->current_user_can('ee_read_private_events', 'get_events')) {
184
+            if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_private_events', 'get_events')) {
185 185
                 $where['status**'] = array('!=', 'private');
186 186
             }
187
-            if (! EE_Registry::instance()->CAP->current_user_can('ee_read_others_events', 'get_events')) {
187
+            if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_events', 'get_events')) {
188 188
                 $where['EVT_wp_user'] = get_current_user_id();
189 189
             }
190 190
             $events = EEM_Event::instance()->get_all(
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
             /** @var EE_Event $evt */
202 202
             foreach ($events as $evt) {
203 203
                 // any registrations for this event?
204
-                if (! $evt->get_count_of_all_registrations()) {
204
+                if ( ! $evt->get_count_of_all_registrations()) {
205 205
                     continue;
206 206
                 }
207 207
                 $evts[] = array(
@@ -220,22 +220,22 @@  discard block
 block discarded – undo
220 220
             $event_filter = '<div class="ee-event-filter">';
221 221
             $event_filter .= EEH_Form_Fields::select_input('event_id', $evts, $current_EVT_ID);
222 222
             $event_filter .= '<span class="ee-event-filter-toggle">';
223
-            $event_filter .= '<input type="checkbox" id="js-ee-hide-expired-events" ' . $checked . '> ';
223
+            $event_filter .= '<input type="checkbox" id="js-ee-hide-expired-events" '.$checked.'> ';
224 224
             $event_filter .= __('Hide Expired Events', 'event_espresso');
225 225
             $event_filter .= '</span>';
226 226
             $event_filter .= '</div>';
227 227
             $filters[] = $event_filter;
228 228
         }
229
-        if (! empty($this->_dtts_for_event)) {
229
+        if ( ! empty($this->_dtts_for_event)) {
230 230
             // DTT datetimes filter
231 231
             $this->_cur_dtt_id = isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : 0;
232 232
             if (count($this->_dtts_for_event) > 1) {
233 233
                 $dtts[0] = __('To toggle check-in status, select a datetime.', 'event_espresso');
234 234
                 foreach ($this->_dtts_for_event as $dtt) {
235 235
                     $datetime_string = $dtt->name();
236
-                    $datetime_string = ! empty($datetime_string) ? ' (' . $datetime_string . ')' : '';
237
-                    $datetime_string = $dtt->start_date_and_time() . ' - ' . $dtt->end_date_and_time() . $datetime_string;
238
-                    $dtts[ $dtt->ID() ] = $datetime_string;
236
+                    $datetime_string = ! empty($datetime_string) ? ' ('.$datetime_string.')' : '';
237
+                    $datetime_string = $dtt->start_date_and_time().' - '.$dtt->end_date_and_time().$datetime_string;
238
+                    $dtts[$dtt->ID()] = $datetime_string;
239 239
                 }
240 240
                 $input = new EE_Select_Input(
241 241
                     $dtts,
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
                     )
247 247
                 );
248 248
                 $filters[] = $input->get_html_for_input();
249
-                $filters[] = '<input type="hidden" name="event_id" value="' . $current_EVT_ID . '">';
249
+                $filters[] = '<input type="hidden" name="event_id" value="'.$current_EVT_ID.'">';
250 250
             }
251 251
         }
252 252
         return $filters;
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
      */
291 291
     public function column__Reg_Status(EE_Registration $item)
292 292
     {
293
-        return '<span class="ee-status-strip ee-status-strip-td reg-status-' . $item->status_ID() . '"></span>';
293
+        return '<span class="ee-status-strip ee-status-strip-td reg-status-'.$item->status_ID().'"></span>';
294 294
     }
295 295
 
296 296
 
@@ -339,11 +339,11 @@  discard block
 block discarded – undo
339 339
                          )
340 340
             ? ' clickable trigger-checkin'
341 341
             : '';
342
-        $mobile_view_content = ' <span class="show-on-mobile-view-only">' . $attendee_name . '</span>';
343
-        return '<span class="' . $checkin_status_dashicon->cssClasses() . $toggle_active . '"'
344
-               . ' data-_regid="' . $item->ID() . '"'
345
-               . ' data-dttid="' . $this->_cur_dtt_id . '"'
346
-               . ' data-nonce="' . $nonce . '">'
342
+        $mobile_view_content = ' <span class="show-on-mobile-view-only">'.$attendee_name.'</span>';
343
+        return '<span class="'.$checkin_status_dashicon->cssClasses().$toggle_active.'"'
344
+               . ' data-_regid="'.$item->ID().'"'
345
+               . ' data-dttid="'.$this->_cur_dtt_id.'"'
346
+               . ' data-nonce="'.$nonce.'">'
347 347
                . '</span>'
348 348
                . $mobile_view_content;
349 349
     }
@@ -357,7 +357,7 @@  discard block
 block discarded – undo
357 357
     public function column_ATT_name(EE_Registration $item)
358 358
     {
359 359
         $attendee = $item->attendee();
360
-        if (! $attendee instanceof EE_Attendee) {
360
+        if ( ! $attendee instanceof EE_Attendee) {
361 361
             return __('No contact record for this registration.', 'event_espresso');
362 362
         }
363 363
         // edit attendee link
@@ -369,7 +369,7 @@  discard block
 block discarded – undo
369 369
             'ee_edit_contacts',
370 370
             'espresso_registrations_edit_attendee'
371 371
         )
372
-            ? '<a href="' . $edit_lnk_url . '" title="' . esc_attr__('View Registration Details', 'event_espresso') . '">'
372
+            ? '<a href="'.$edit_lnk_url.'" title="'.esc_attr__('View Registration Details', 'event_espresso').'">'
373 373
               . $item->attendee()->full_name()
374 374
               . '</a>'
375 375
             : $item->attendee()->full_name();
@@ -377,7 +377,7 @@  discard block
 block discarded – undo
377 377
             ? '&nbsp;<sup><div class="dashicons dashicons-star-filled yellow-icon ee-icon-size-8"></div></sup>	'
378 378
             : '';
379 379
         // add group details
380
-        $name_link .= '&nbsp;' . sprintf(__('(%s of %s)', 'event_espresso'), $item->count(), $item->group_size());
380
+        $name_link .= '&nbsp;'.sprintf(__('(%s of %s)', 'event_espresso'), $item->count(), $item->group_size());
381 381
         // add regcode
382 382
         $link = EE_Admin_Page::add_query_args_and_nonce(
383 383
             array('action' => 'view_registration', '_REG_ID' => $item->ID()),
@@ -389,7 +389,7 @@  discard block
 block discarded – undo
389 389
             'view_registration',
390 390
             $item->ID()
391 391
         )
392
-            ? '<a href="' . $link . '" title="' . esc_attr__('View Registration Details', 'event_espresso') . '">'
392
+            ? '<a href="'.$link.'" title="'.esc_attr__('View Registration Details', 'event_espresso').'">'
393 393
               . $item->reg_code()
394 394
               . '</a>'
395 395
             : $item->reg_code();
@@ -405,7 +405,7 @@  discard block
 block discarded – undo
405 405
         $DTT_ID = $latest_related_datetime instanceof EE_Datetime
406 406
             ? $latest_related_datetime->ID()
407 407
             : $DTT_ID;
408
-        if (! empty($DTT_ID)
408
+        if ( ! empty($DTT_ID)
409 409
             && EE_Registry::instance()->CAP->current_user_can(
410 410
                 'ee_read_checkins',
411 411
                 'espresso_registrations_registration_checkins'
@@ -417,7 +417,7 @@  discard block
 block discarded – undo
417 417
             );
418 418
             // get the timestamps for this registration's checkins, related to the selected datetime
419 419
             $timestamps = $item->get_many_related('Checkin', array(array('DTT_ID' => $DTT_ID)));
420
-            if (! empty($timestamps)) {
420
+            if ( ! empty($timestamps)) {
421 421
                 // get the last timestamp
422 422
                 $last_timestamp = end($timestamps);
423 423
                 // checked in or checked out?
@@ -426,14 +426,14 @@  discard block
 block discarded – undo
426 426
                     : esc_html__('Checked Out', 'event_espresso');
427 427
                 // get timestamp string
428 428
                 $timestamp_string = $last_timestamp->get_datetime('CHK_timestamp');
429
-                $actions['checkin'] = '<a href="' . $checkin_list_url . '" title="'
429
+                $actions['checkin'] = '<a href="'.$checkin_list_url.'" title="'
430 430
                                       . esc_attr__(
431 431
                                           'View this registrant\'s check-ins/checkouts for the datetime',
432 432
                                           'event_espresso'
433
-                                      ) . '">' . $checkin_status . ': ' . $timestamp_string . '</a>';
433
+                                      ).'">'.$checkin_status.': '.$timestamp_string.'</a>';
434 434
             }
435 435
         }
436
-        return (! empty($DTT_ID) && ! empty($timestamps))
436
+        return ( ! empty($DTT_ID) && ! empty($timestamps))
437 437
             ? sprintf('%1$s %2$s', $name_link, $this->row_actions($actions, true))
438 438
             : $name_link;
439 439
     }
@@ -466,11 +466,11 @@  discard block
 block discarded – undo
466 466
             $event_label = EE_Registry::instance()->CAP->current_user_can(
467 467
                 'ee_read_checkins',
468 468
                 'espresso_registrations_registration_checkins'
469
-            ) ? '<a href="' . $chkin_lnk_url . '" title="'
469
+            ) ? '<a href="'.$chkin_lnk_url.'" title="'
470 470
                 . esc_attr__(
471 471
                     'View Checkins for this Event',
472 472
                     'event_espresso'
473
-                ) . '">' . $event->name() . '</a>' : $event->name();
473
+                ).'">'.$event->name().'</a>' : $event->name();
474 474
         } catch (\EventEspresso\core\exceptions\EntityNotFoundException $e) {
475 475
             $event_label = esc_html__('Unknown', 'event_espresso');
476 476
         }
@@ -496,7 +496,7 @@  discard block
 block discarded – undo
496 496
      */
497 497
     public function column__REG_final_price(EE_Registration $item)
498 498
     {
499
-        return '<span class="reg-pad-rght">' . ' ' . $item->pretty_final_price() . '</span>';
499
+        return '<span class="reg-pad-rght">'.' '.$item->pretty_final_price().'</span>';
500 500
     }
501 501
 
502 502
 
@@ -533,7 +533,7 @@  discard block
 block discarded – undo
533 533
                     . $item->transaction()->pretty_paid()
534 534
                     . '
535 535
 					</a>
536
-				<span>' : '<span class="reg-pad-rght">' . $item->transaction()->pretty_paid() . '</span>';
536
+				<span>' : '<span class="reg-pad-rght">'.$item->transaction()->pretty_paid().'</span>';
537 537
             }
538 538
         } else {
539 539
             return '<span class="reg-pad-rght"></span>';
@@ -569,7 +569,7 @@  discard block
 block discarded – undo
569 569
                 . esc_attr__('View Transaction', 'event_espresso')
570 570
                 . '"><span class="reg-pad-rght">'
571 571
                 . $txn_total
572
-                . '</span></a>' : '<span class="reg-pad-rght">' . $txn_total . '</span>';
572
+                . '</span></a>' : '<span class="reg-pad-rght">'.$txn_total.'</span>';
573 573
         } else {
574 574
             return '<span class="reg-pad-rght"></span>';
575 575
         }
Please login to merge, or discard this patch.
admin/extend/registrations/Extend_Registrations_Admin_Page.core.php 1 patch
Indentation   +1210 added lines, -1210 removed lines patch added patch discarded remove patch
@@ -16,1267 +16,1267 @@
 block discarded – undo
16 16
 {
17 17
 
18 18
 
19
-    /**
20
-     * This is used to hold the reports template data which is setup early in the request.
21
-     *
22
-     * @type array
23
-     */
24
-    protected $_reports_template_data = array();
19
+	/**
20
+	 * This is used to hold the reports template data which is setup early in the request.
21
+	 *
22
+	 * @type array
23
+	 */
24
+	protected $_reports_template_data = array();
25 25
 
26 26
 
27
-    /**
28
-     * Extend_Registrations_Admin_Page constructor.
29
-     *
30
-     * @param bool $routing
31
-     */
32
-    public function __construct($routing = true)
33
-    {
34
-        parent::__construct($routing);
35
-        if (! defined('REG_CAF_TEMPLATE_PATH')) {
36
-            define('REG_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND . 'registrations/templates/');
37
-            define('REG_CAF_ASSETS', EE_CORE_CAF_ADMIN_EXTEND . 'registrations/assets/');
38
-            define('REG_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL . 'registrations/assets/');
39
-        }
40
-    }
27
+	/**
28
+	 * Extend_Registrations_Admin_Page constructor.
29
+	 *
30
+	 * @param bool $routing
31
+	 */
32
+	public function __construct($routing = true)
33
+	{
34
+		parent::__construct($routing);
35
+		if (! defined('REG_CAF_TEMPLATE_PATH')) {
36
+			define('REG_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND . 'registrations/templates/');
37
+			define('REG_CAF_ASSETS', EE_CORE_CAF_ADMIN_EXTEND . 'registrations/assets/');
38
+			define('REG_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL . 'registrations/assets/');
39
+		}
40
+	}
41 41
 
42 42
 
43
-    /**
44
-     * Extending page configuration.
45
-     */
46
-    protected function _extend_page_config()
47
-    {
48
-        $this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND . 'registrations';
49
-        $reg_id = ! empty($this->_req_data['_REG_ID']) && ! is_array($this->_req_data['_REG_ID'])
50
-            ? $this->_req_data['_REG_ID']
51
-            : 0;
52
-        $new_page_routes = array(
53
-            'reports'                      => array(
54
-                'func'       => '_registration_reports',
55
-                'capability' => 'ee_read_registrations',
56
-            ),
57
-            'registration_checkins'        => array(
58
-                'func'       => '_registration_checkin_list_table',
59
-                'capability' => 'ee_read_checkins',
60
-            ),
61
-            'newsletter_selected_send'     => array(
62
-                'func'       => '_newsletter_selected_send',
63
-                'noheader'   => true,
64
-                'capability' => 'ee_send_message',
65
-            ),
66
-            'delete_checkin_rows'          => array(
67
-                'func'       => '_delete_checkin_rows',
68
-                'noheader'   => true,
69
-                'capability' => 'ee_delete_checkins',
70
-            ),
71
-            'delete_checkin_row'           => array(
72
-                'func'       => '_delete_checkin_row',
73
-                'noheader'   => true,
74
-                'capability' => 'ee_delete_checkin',
75
-                'obj_id'     => $reg_id,
76
-            ),
77
-            'toggle_checkin_status'        => array(
78
-                'func'       => '_toggle_checkin_status',
79
-                'noheader'   => true,
80
-                'capability' => 'ee_edit_checkin',
81
-                'obj_id'     => $reg_id,
82
-            ),
83
-            'toggle_checkin_status_bulk'   => array(
84
-                'func'       => '_toggle_checkin_status',
85
-                'noheader'   => true,
86
-                'capability' => 'ee_edit_checkins',
87
-            ),
88
-            'event_registrations'          => array(
89
-                'func'       => '_event_registrations_list_table',
90
-                'capability' => 'ee_read_checkins',
91
-            ),
92
-            'registrations_checkin_report' => array(
93
-                'func'       => '_registrations_checkin_report',
94
-                'noheader'   => true,
95
-                'capability' => 'ee_read_registrations',
96
-            ),
97
-        );
98
-        $this->_page_routes = array_merge($this->_page_routes, $new_page_routes);
99
-        $new_page_config = array(
100
-            'reports'               => array(
101
-                'nav'           => array(
102
-                    'label' => esc_html__('Reports', 'event_espresso'),
103
-                    'order' => 30,
104
-                ),
105
-                'help_tabs'     => array(
106
-                    'registrations_reports_help_tab' => array(
107
-                        'title'    => esc_html__('Registration Reports', 'event_espresso'),
108
-                        'filename' => 'registrations_reports',
109
-                    ),
110
-                ),
111
-                /*'help_tour' => array( 'Registration_Reports_Help_Tour' ),*/
112
-                'require_nonce' => false,
113
-            ),
114
-            'event_registrations'   => array(
115
-                'nav'           => array(
116
-                    'label'      => esc_html__('Event Check-In', 'event_espresso'),
117
-                    'order'      => 10,
118
-                    'persistent' => true,
119
-                ),
120
-                'help_tabs'     => array(
121
-                    'registrations_event_checkin_help_tab'                       => array(
122
-                        'title'    => esc_html__('Registrations Event Check-In', 'event_espresso'),
123
-                        'filename' => 'registrations_event_checkin',
124
-                    ),
125
-                    'registrations_event_checkin_table_column_headings_help_tab' => array(
126
-                        'title'    => esc_html__('Event Check-In Table Column Headings', 'event_espresso'),
127
-                        'filename' => 'registrations_event_checkin_table_column_headings',
128
-                    ),
129
-                    'registrations_event_checkin_filters_help_tab'               => array(
130
-                        'title'    => esc_html__('Event Check-In Filters', 'event_espresso'),
131
-                        'filename' => 'registrations_event_checkin_filters',
132
-                    ),
133
-                    'registrations_event_checkin_views_help_tab'                 => array(
134
-                        'title'    => esc_html__('Event Check-In Views', 'event_espresso'),
135
-                        'filename' => 'registrations_event_checkin_views',
136
-                    ),
137
-                    'registrations_event_checkin_other_help_tab'                 => array(
138
-                        'title'    => esc_html__('Event Check-In Other', 'event_espresso'),
139
-                        'filename' => 'registrations_event_checkin_other',
140
-                    ),
141
-                ),
142
-                'help_tour'     => array('Event_Checkin_Help_Tour'),
143
-                'qtips'         => array('Registration_List_Table_Tips'),
144
-                'list_table'    => 'EE_Event_Registrations_List_Table',
145
-                'metaboxes'     => array(),
146
-                'require_nonce' => false,
147
-            ),
148
-            'registration_checkins' => array(
149
-                'nav'           => array(
150
-                    'label'      => esc_html__('Check-In Records', 'event_espresso'),
151
-                    'order'      => 15,
152
-                    'persistent' => false,
153
-                    'url'        => '',
154
-                ),
155
-                'list_table'    => 'EE_Registration_CheckIn_List_Table',
156
-                // 'help_tour' => array( 'Checkin_Toggle_View_Help_Tour' ),
157
-                'metaboxes'     => array(),
158
-                'require_nonce' => false,
159
-            ),
160
-        );
161
-        $this->_page_config = array_merge($this->_page_config, $new_page_config);
162
-        $this->_page_config['contact_list']['list_table'] = 'Extend_EE_Attendee_Contact_List_Table';
163
-        $this->_page_config['default']['list_table'] = 'Extend_EE_Registrations_List_Table';
164
-    }
43
+	/**
44
+	 * Extending page configuration.
45
+	 */
46
+	protected function _extend_page_config()
47
+	{
48
+		$this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND . 'registrations';
49
+		$reg_id = ! empty($this->_req_data['_REG_ID']) && ! is_array($this->_req_data['_REG_ID'])
50
+			? $this->_req_data['_REG_ID']
51
+			: 0;
52
+		$new_page_routes = array(
53
+			'reports'                      => array(
54
+				'func'       => '_registration_reports',
55
+				'capability' => 'ee_read_registrations',
56
+			),
57
+			'registration_checkins'        => array(
58
+				'func'       => '_registration_checkin_list_table',
59
+				'capability' => 'ee_read_checkins',
60
+			),
61
+			'newsletter_selected_send'     => array(
62
+				'func'       => '_newsletter_selected_send',
63
+				'noheader'   => true,
64
+				'capability' => 'ee_send_message',
65
+			),
66
+			'delete_checkin_rows'          => array(
67
+				'func'       => '_delete_checkin_rows',
68
+				'noheader'   => true,
69
+				'capability' => 'ee_delete_checkins',
70
+			),
71
+			'delete_checkin_row'           => array(
72
+				'func'       => '_delete_checkin_row',
73
+				'noheader'   => true,
74
+				'capability' => 'ee_delete_checkin',
75
+				'obj_id'     => $reg_id,
76
+			),
77
+			'toggle_checkin_status'        => array(
78
+				'func'       => '_toggle_checkin_status',
79
+				'noheader'   => true,
80
+				'capability' => 'ee_edit_checkin',
81
+				'obj_id'     => $reg_id,
82
+			),
83
+			'toggle_checkin_status_bulk'   => array(
84
+				'func'       => '_toggle_checkin_status',
85
+				'noheader'   => true,
86
+				'capability' => 'ee_edit_checkins',
87
+			),
88
+			'event_registrations'          => array(
89
+				'func'       => '_event_registrations_list_table',
90
+				'capability' => 'ee_read_checkins',
91
+			),
92
+			'registrations_checkin_report' => array(
93
+				'func'       => '_registrations_checkin_report',
94
+				'noheader'   => true,
95
+				'capability' => 'ee_read_registrations',
96
+			),
97
+		);
98
+		$this->_page_routes = array_merge($this->_page_routes, $new_page_routes);
99
+		$new_page_config = array(
100
+			'reports'               => array(
101
+				'nav'           => array(
102
+					'label' => esc_html__('Reports', 'event_espresso'),
103
+					'order' => 30,
104
+				),
105
+				'help_tabs'     => array(
106
+					'registrations_reports_help_tab' => array(
107
+						'title'    => esc_html__('Registration Reports', 'event_espresso'),
108
+						'filename' => 'registrations_reports',
109
+					),
110
+				),
111
+				/*'help_tour' => array( 'Registration_Reports_Help_Tour' ),*/
112
+				'require_nonce' => false,
113
+			),
114
+			'event_registrations'   => array(
115
+				'nav'           => array(
116
+					'label'      => esc_html__('Event Check-In', 'event_espresso'),
117
+					'order'      => 10,
118
+					'persistent' => true,
119
+				),
120
+				'help_tabs'     => array(
121
+					'registrations_event_checkin_help_tab'                       => array(
122
+						'title'    => esc_html__('Registrations Event Check-In', 'event_espresso'),
123
+						'filename' => 'registrations_event_checkin',
124
+					),
125
+					'registrations_event_checkin_table_column_headings_help_tab' => array(
126
+						'title'    => esc_html__('Event Check-In Table Column Headings', 'event_espresso'),
127
+						'filename' => 'registrations_event_checkin_table_column_headings',
128
+					),
129
+					'registrations_event_checkin_filters_help_tab'               => array(
130
+						'title'    => esc_html__('Event Check-In Filters', 'event_espresso'),
131
+						'filename' => 'registrations_event_checkin_filters',
132
+					),
133
+					'registrations_event_checkin_views_help_tab'                 => array(
134
+						'title'    => esc_html__('Event Check-In Views', 'event_espresso'),
135
+						'filename' => 'registrations_event_checkin_views',
136
+					),
137
+					'registrations_event_checkin_other_help_tab'                 => array(
138
+						'title'    => esc_html__('Event Check-In Other', 'event_espresso'),
139
+						'filename' => 'registrations_event_checkin_other',
140
+					),
141
+				),
142
+				'help_tour'     => array('Event_Checkin_Help_Tour'),
143
+				'qtips'         => array('Registration_List_Table_Tips'),
144
+				'list_table'    => 'EE_Event_Registrations_List_Table',
145
+				'metaboxes'     => array(),
146
+				'require_nonce' => false,
147
+			),
148
+			'registration_checkins' => array(
149
+				'nav'           => array(
150
+					'label'      => esc_html__('Check-In Records', 'event_espresso'),
151
+					'order'      => 15,
152
+					'persistent' => false,
153
+					'url'        => '',
154
+				),
155
+				'list_table'    => 'EE_Registration_CheckIn_List_Table',
156
+				// 'help_tour' => array( 'Checkin_Toggle_View_Help_Tour' ),
157
+				'metaboxes'     => array(),
158
+				'require_nonce' => false,
159
+			),
160
+		);
161
+		$this->_page_config = array_merge($this->_page_config, $new_page_config);
162
+		$this->_page_config['contact_list']['list_table'] = 'Extend_EE_Attendee_Contact_List_Table';
163
+		$this->_page_config['default']['list_table'] = 'Extend_EE_Registrations_List_Table';
164
+	}
165 165
 
166 166
 
167
-    /**
168
-     * Ajax hooks for all routes in this page.
169
-     */
170
-    protected function _ajax_hooks()
171
-    {
172
-        parent::_ajax_hooks();
173
-        add_action('wp_ajax_get_newsletter_form_content', array($this, 'get_newsletter_form_content'));
174
-    }
167
+	/**
168
+	 * Ajax hooks for all routes in this page.
169
+	 */
170
+	protected function _ajax_hooks()
171
+	{
172
+		parent::_ajax_hooks();
173
+		add_action('wp_ajax_get_newsletter_form_content', array($this, 'get_newsletter_form_content'));
174
+	}
175 175
 
176 176
 
177
-    /**
178
-     * Global scripts for all routes in this page.
179
-     */
180
-    public function load_scripts_styles()
181
-    {
182
-        parent::load_scripts_styles();
183
-        // if newsletter message type is active then let's add filter and load js for it.
184
-        if (EEH_MSG_Template::is_mt_active('newsletter')) {
185
-            // enqueue newsletter js
186
-            wp_enqueue_script(
187
-                'ee-newsletter-trigger',
188
-                REG_CAF_ASSETS_URL . 'ee-newsletter-trigger.js',
189
-                array('ee-dialog'),
190
-                EVENT_ESPRESSO_VERSION,
191
-                true
192
-            );
193
-            wp_enqueue_style(
194
-                'ee-newsletter-trigger-css',
195
-                REG_CAF_ASSETS_URL . 'ee-newsletter-trigger.css',
196
-                array(),
197
-                EVENT_ESPRESSO_VERSION
198
-            );
199
-            // hook in buttons for newsletter message type trigger.
200
-            add_action(
201
-                'AHEE__EE_Admin_List_Table__extra_tablenav__after_bottom_buttons',
202
-                array($this, 'add_newsletter_action_buttons'),
203
-                10
204
-            );
205
-        }
206
-    }
177
+	/**
178
+	 * Global scripts for all routes in this page.
179
+	 */
180
+	public function load_scripts_styles()
181
+	{
182
+		parent::load_scripts_styles();
183
+		// if newsletter message type is active then let's add filter and load js for it.
184
+		if (EEH_MSG_Template::is_mt_active('newsletter')) {
185
+			// enqueue newsletter js
186
+			wp_enqueue_script(
187
+				'ee-newsletter-trigger',
188
+				REG_CAF_ASSETS_URL . 'ee-newsletter-trigger.js',
189
+				array('ee-dialog'),
190
+				EVENT_ESPRESSO_VERSION,
191
+				true
192
+			);
193
+			wp_enqueue_style(
194
+				'ee-newsletter-trigger-css',
195
+				REG_CAF_ASSETS_URL . 'ee-newsletter-trigger.css',
196
+				array(),
197
+				EVENT_ESPRESSO_VERSION
198
+			);
199
+			// hook in buttons for newsletter message type trigger.
200
+			add_action(
201
+				'AHEE__EE_Admin_List_Table__extra_tablenav__after_bottom_buttons',
202
+				array($this, 'add_newsletter_action_buttons'),
203
+				10
204
+			);
205
+		}
206
+	}
207 207
 
208 208
 
209
-    /**
210
-     * Scripts and styles for just the reports route.
211
-     */
212
-    public function load_scripts_styles_reports()
213
-    {
214
-        wp_register_script(
215
-            'ee-reg-reports-js',
216
-            REG_CAF_ASSETS_URL . 'ee-registration-admin-reports.js',
217
-            array('google-charts'),
218
-            EVENT_ESPRESSO_VERSION,
219
-            true
220
-        );
221
-        wp_enqueue_script('ee-reg-reports-js');
222
-        $this->_registration_reports_js_setup();
223
-    }
209
+	/**
210
+	 * Scripts and styles for just the reports route.
211
+	 */
212
+	public function load_scripts_styles_reports()
213
+	{
214
+		wp_register_script(
215
+			'ee-reg-reports-js',
216
+			REG_CAF_ASSETS_URL . 'ee-registration-admin-reports.js',
217
+			array('google-charts'),
218
+			EVENT_ESPRESSO_VERSION,
219
+			true
220
+		);
221
+		wp_enqueue_script('ee-reg-reports-js');
222
+		$this->_registration_reports_js_setup();
223
+	}
224 224
 
225 225
 
226
-    /**
227
-     * Register screen options for event_registrations route.
228
-     */
229
-    protected function _add_screen_options_event_registrations()
230
-    {
231
-        $this->_per_page_screen_option();
232
-    }
226
+	/**
227
+	 * Register screen options for event_registrations route.
228
+	 */
229
+	protected function _add_screen_options_event_registrations()
230
+	{
231
+		$this->_per_page_screen_option();
232
+	}
233 233
 
234 234
 
235
-    /**
236
-     * Register screen options for registration_checkins route
237
-     */
238
-    protected function _add_screen_options_registration_checkins()
239
-    {
240
-        $page_title = $this->_admin_page_title;
241
-        $this->_admin_page_title = esc_html__('Check-In Records', 'event_espresso');
242
-        $this->_per_page_screen_option();
243
-        $this->_admin_page_title = $page_title;
244
-    }
235
+	/**
236
+	 * Register screen options for registration_checkins route
237
+	 */
238
+	protected function _add_screen_options_registration_checkins()
239
+	{
240
+		$page_title = $this->_admin_page_title;
241
+		$this->_admin_page_title = esc_html__('Check-In Records', 'event_espresso');
242
+		$this->_per_page_screen_option();
243
+		$this->_admin_page_title = $page_title;
244
+	}
245 245
 
246 246
 
247
-    /**
248
-     * Set views property for event_registrations route.
249
-     */
250
-    protected function _set_list_table_views_event_registrations()
251
-    {
252
-        $this->_views = array(
253
-            'all' => array(
254
-                'slug'        => 'all',
255
-                'label'       => esc_html__('All', 'event_espresso'),
256
-                'count'       => 0,
257
-                'bulk_action' => ! isset($this->_req_data['event_id'])
258
-                    ? array()
259
-                    : array(
260
-                        'toggle_checkin_status_bulk' => esc_html__('Toggle Check-In', 'event_espresso'),
261
-                    ),
262
-            ),
263
-        );
264
-    }
247
+	/**
248
+	 * Set views property for event_registrations route.
249
+	 */
250
+	protected function _set_list_table_views_event_registrations()
251
+	{
252
+		$this->_views = array(
253
+			'all' => array(
254
+				'slug'        => 'all',
255
+				'label'       => esc_html__('All', 'event_espresso'),
256
+				'count'       => 0,
257
+				'bulk_action' => ! isset($this->_req_data['event_id'])
258
+					? array()
259
+					: array(
260
+						'toggle_checkin_status_bulk' => esc_html__('Toggle Check-In', 'event_espresso'),
261
+					),
262
+			),
263
+		);
264
+	}
265 265
 
266 266
 
267
-    /**
268
-     * Set views property for registration_checkins route.
269
-     */
270
-    protected function _set_list_table_views_registration_checkins()
271
-    {
272
-        $this->_views = array(
273
-            'all' => array(
274
-                'slug'        => 'all',
275
-                'label'       => esc_html__('All', 'event_espresso'),
276
-                'count'       => 0,
277
-                'bulk_action' => array('delete_checkin_rows' => esc_html__('Delete Check-In Rows', 'event_espresso')),
278
-            ),
279
-        );
280
-    }
267
+	/**
268
+	 * Set views property for registration_checkins route.
269
+	 */
270
+	protected function _set_list_table_views_registration_checkins()
271
+	{
272
+		$this->_views = array(
273
+			'all' => array(
274
+				'slug'        => 'all',
275
+				'label'       => esc_html__('All', 'event_espresso'),
276
+				'count'       => 0,
277
+				'bulk_action' => array('delete_checkin_rows' => esc_html__('Delete Check-In Rows', 'event_espresso')),
278
+			),
279
+		);
280
+	}
281 281
 
282 282
 
283
-    /**
284
-     * callback for ajax action.
285
-     *
286
-     * @since 4.3.0
287
-     * @return void (JSON)
288
-     * @throws EE_Error
289
-     * @throws InvalidArgumentException
290
-     * @throws InvalidDataTypeException
291
-     * @throws InvalidInterfaceException
292
-     */
293
-    public function get_newsletter_form_content()
294
-    {
295
-        // do a nonce check cause we're not coming in from an normal route here.
296
-        $nonce = isset($this->_req_data['get_newsletter_form_content_nonce']) ? sanitize_text_field(
297
-            $this->_req_data['get_newsletter_form_content_nonce']
298
-        ) : '';
299
-        $nonce_ref = 'get_newsletter_form_content_nonce';
300
-        $this->_verify_nonce($nonce, $nonce_ref);
301
-        // let's get the mtp for the incoming MTP_ ID
302
-        if (! isset($this->_req_data['GRP_ID'])) {
303
-            EE_Error::add_error(
304
-                esc_html__(
305
-                    'There must be something broken with the js or html structure because the required data for getting a message template group is not present (need an GRP_ID).',
306
-                    'event_espresso'
307
-                ),
308
-                __FILE__,
309
-                __FUNCTION__,
310
-                __LINE__
311
-            );
312
-            $this->_template_args['success'] = false;
313
-            $this->_template_args['error'] = true;
314
-            $this->_return_json();
315
-        }
316
-        $MTPG = EEM_Message_Template_Group::instance()->get_one_by_ID($this->_req_data['GRP_ID']);
317
-        if (! $MTPG instanceof EE_Message_Template_Group) {
318
-            EE_Error::add_error(
319
-                sprintf(
320
-                    esc_html__(
321
-                        'The GRP_ID given (%d) does not appear to have a corresponding row in the database.',
322
-                        'event_espresso'
323
-                    ),
324
-                    $this->_req_data['GRP_ID']
325
-                ),
326
-                __FILE__,
327
-                __FUNCTION__,
328
-                __LINE__
329
-            );
330
-            $this->_template_args['success'] = false;
331
-            $this->_template_args['error'] = true;
332
-            $this->_return_json();
333
-        }
334
-        $MTPs = $MTPG->context_templates();
335
-        $MTPs = $MTPs['attendee'];
336
-        $template_fields = array();
337
-        /** @var EE_Message_Template $MTP */
338
-        foreach ($MTPs as $MTP) {
339
-            $field = $MTP->get('MTP_template_field');
340
-            if ($field === 'content') {
341
-                $content = $MTP->get('MTP_content');
342
-                if (! empty($content['newsletter_content'])) {
343
-                    $template_fields['newsletter_content'] = $content['newsletter_content'];
344
-                }
345
-                continue;
346
-            }
347
-            $template_fields[ $MTP->get('MTP_template_field') ] = $MTP->get('MTP_content');
348
-        }
349
-        $this->_template_args['success'] = true;
350
-        $this->_template_args['error'] = false;
351
-        $this->_template_args['data'] = array(
352
-            'batch_message_from'    => isset($template_fields['from'])
353
-                ? $template_fields['from']
354
-                : '',
355
-            'batch_message_subject' => isset($template_fields['subject'])
356
-                ? $template_fields['subject']
357
-                : '',
358
-            'batch_message_content' => isset($template_fields['newsletter_content'])
359
-                ? $template_fields['newsletter_content']
360
-                : '',
361
-        );
362
-        $this->_return_json();
363
-    }
283
+	/**
284
+	 * callback for ajax action.
285
+	 *
286
+	 * @since 4.3.0
287
+	 * @return void (JSON)
288
+	 * @throws EE_Error
289
+	 * @throws InvalidArgumentException
290
+	 * @throws InvalidDataTypeException
291
+	 * @throws InvalidInterfaceException
292
+	 */
293
+	public function get_newsletter_form_content()
294
+	{
295
+		// do a nonce check cause we're not coming in from an normal route here.
296
+		$nonce = isset($this->_req_data['get_newsletter_form_content_nonce']) ? sanitize_text_field(
297
+			$this->_req_data['get_newsletter_form_content_nonce']
298
+		) : '';
299
+		$nonce_ref = 'get_newsletter_form_content_nonce';
300
+		$this->_verify_nonce($nonce, $nonce_ref);
301
+		// let's get the mtp for the incoming MTP_ ID
302
+		if (! isset($this->_req_data['GRP_ID'])) {
303
+			EE_Error::add_error(
304
+				esc_html__(
305
+					'There must be something broken with the js or html structure because the required data for getting a message template group is not present (need an GRP_ID).',
306
+					'event_espresso'
307
+				),
308
+				__FILE__,
309
+				__FUNCTION__,
310
+				__LINE__
311
+			);
312
+			$this->_template_args['success'] = false;
313
+			$this->_template_args['error'] = true;
314
+			$this->_return_json();
315
+		}
316
+		$MTPG = EEM_Message_Template_Group::instance()->get_one_by_ID($this->_req_data['GRP_ID']);
317
+		if (! $MTPG instanceof EE_Message_Template_Group) {
318
+			EE_Error::add_error(
319
+				sprintf(
320
+					esc_html__(
321
+						'The GRP_ID given (%d) does not appear to have a corresponding row in the database.',
322
+						'event_espresso'
323
+					),
324
+					$this->_req_data['GRP_ID']
325
+				),
326
+				__FILE__,
327
+				__FUNCTION__,
328
+				__LINE__
329
+			);
330
+			$this->_template_args['success'] = false;
331
+			$this->_template_args['error'] = true;
332
+			$this->_return_json();
333
+		}
334
+		$MTPs = $MTPG->context_templates();
335
+		$MTPs = $MTPs['attendee'];
336
+		$template_fields = array();
337
+		/** @var EE_Message_Template $MTP */
338
+		foreach ($MTPs as $MTP) {
339
+			$field = $MTP->get('MTP_template_field');
340
+			if ($field === 'content') {
341
+				$content = $MTP->get('MTP_content');
342
+				if (! empty($content['newsletter_content'])) {
343
+					$template_fields['newsletter_content'] = $content['newsletter_content'];
344
+				}
345
+				continue;
346
+			}
347
+			$template_fields[ $MTP->get('MTP_template_field') ] = $MTP->get('MTP_content');
348
+		}
349
+		$this->_template_args['success'] = true;
350
+		$this->_template_args['error'] = false;
351
+		$this->_template_args['data'] = array(
352
+			'batch_message_from'    => isset($template_fields['from'])
353
+				? $template_fields['from']
354
+				: '',
355
+			'batch_message_subject' => isset($template_fields['subject'])
356
+				? $template_fields['subject']
357
+				: '',
358
+			'batch_message_content' => isset($template_fields['newsletter_content'])
359
+				? $template_fields['newsletter_content']
360
+				: '',
361
+		);
362
+		$this->_return_json();
363
+	}
364 364
 
365 365
 
366
-    /**
367
-     * callback for AHEE__EE_Admin_List_Table__extra_tablenav__after_bottom_buttons action
368
-     *
369
-     * @since 4.3.0
370
-     * @param EE_Admin_List_Table $list_table
371
-     * @return void
372
-     * @throws InvalidArgumentException
373
-     * @throws InvalidDataTypeException
374
-     * @throws InvalidInterfaceException
375
-     */
376
-    public function add_newsletter_action_buttons(EE_Admin_List_Table $list_table)
377
-    {
378
-        if (! EE_Registry::instance()->CAP->current_user_can(
379
-            'ee_send_message',
380
-            'espresso_registrations_newsletter_selected_send'
381
-        )
382
-        ) {
383
-            return;
384
-        }
385
-        $routes_to_add_to = array(
386
-            'contact_list',
387
-            'event_registrations',
388
-            'default',
389
-        );
390
-        if ($this->_current_page === 'espresso_registrations' && in_array($this->_req_action, $routes_to_add_to)) {
391
-            if (($this->_req_action === 'event_registrations' && empty($this->_req_data['event_id']))
392
-                || (isset($this->_req_data['status']) && $this->_req_data['status'] === 'trash')
393
-            ) {
394
-                echo '';
395
-            } else {
396
-                $button_text = sprintf(
397
-                    esc_html__('Send Batch Message (%s selected)', 'event_espresso'),
398
-                    '<span class="send-selected-newsletter-count">0</span>'
399
-                );
400
-                echo '<button id="selected-batch-send-trigger" class="button secondary-button">'
401
-                     . '<span class="dashicons dashicons-email "></span>'
402
-                     . $button_text
403
-                     . '</button>';
404
-                add_action('admin_footer', array($this, 'newsletter_send_form_skeleton'));
405
-            }
406
-        }
407
-    }
366
+	/**
367
+	 * callback for AHEE__EE_Admin_List_Table__extra_tablenav__after_bottom_buttons action
368
+	 *
369
+	 * @since 4.3.0
370
+	 * @param EE_Admin_List_Table $list_table
371
+	 * @return void
372
+	 * @throws InvalidArgumentException
373
+	 * @throws InvalidDataTypeException
374
+	 * @throws InvalidInterfaceException
375
+	 */
376
+	public function add_newsletter_action_buttons(EE_Admin_List_Table $list_table)
377
+	{
378
+		if (! EE_Registry::instance()->CAP->current_user_can(
379
+			'ee_send_message',
380
+			'espresso_registrations_newsletter_selected_send'
381
+		)
382
+		) {
383
+			return;
384
+		}
385
+		$routes_to_add_to = array(
386
+			'contact_list',
387
+			'event_registrations',
388
+			'default',
389
+		);
390
+		if ($this->_current_page === 'espresso_registrations' && in_array($this->_req_action, $routes_to_add_to)) {
391
+			if (($this->_req_action === 'event_registrations' && empty($this->_req_data['event_id']))
392
+				|| (isset($this->_req_data['status']) && $this->_req_data['status'] === 'trash')
393
+			) {
394
+				echo '';
395
+			} else {
396
+				$button_text = sprintf(
397
+					esc_html__('Send Batch Message (%s selected)', 'event_espresso'),
398
+					'<span class="send-selected-newsletter-count">0</span>'
399
+				);
400
+				echo '<button id="selected-batch-send-trigger" class="button secondary-button">'
401
+					 . '<span class="dashicons dashicons-email "></span>'
402
+					 . $button_text
403
+					 . '</button>';
404
+				add_action('admin_footer', array($this, 'newsletter_send_form_skeleton'));
405
+			}
406
+		}
407
+	}
408 408
 
409 409
 
410
-    /**
411
-     * @throws DomainException
412
-     * @throws EE_Error
413
-     * @throws InvalidArgumentException
414
-     * @throws InvalidDataTypeException
415
-     * @throws InvalidInterfaceException
416
-     */
417
-    public function newsletter_send_form_skeleton()
418
-    {
419
-        $list_table = $this->_list_table_object;
420
-        $codes = array();
421
-        // need to templates for the newsletter message type for the template selector.
422
-        $values[] = array('text' => esc_html__('Select Template to Use', 'event_espresso'), 'id' => 0);
423
-        $mtps = EEM_Message_Template_Group::instance()->get_all(
424
-            array(array('MTP_message_type' => 'newsletter', 'MTP_messenger' => 'email'))
425
-        );
426
-        foreach ($mtps as $mtp) {
427
-            $name = $mtp->name();
428
-            $values[] = array(
429
-                'text' => empty($name) ? esc_html__('Global', 'event_espresso') : $name,
430
-                'id'   => $mtp->ID(),
431
-            );
432
-        }
433
-        // need to get a list of shortcodes that are available for the newsletter message type.
434
-        $shortcodes = EEH_MSG_Template::get_shortcodes(
435
-            'newsletter',
436
-            'email',
437
-            array(),
438
-            'attendee',
439
-            false
440
-        );
441
-        foreach ($shortcodes as $field => $shortcode_array) {
442
-            $available_shortcodes = array();
443
-            foreach ($shortcode_array as $shortcode => $shortcode_details) {
444
-                $field_id = $field === '[NEWSLETTER_CONTENT]'
445
-                    ? 'content'
446
-                    : $field;
447
-                $field_id = 'batch-message-' . strtolower($field_id);
448
-                $available_shortcodes[] = '<span class="js-shortcode-selection" data-value="'
449
-                                          . $shortcode
450
-                                          . '" data-linked-input-id="' . $field_id . '">'
451
-                                          . $shortcode
452
-                                          . '</span>';
453
-            }
454
-            $codes[ $field ] = implode(', ', $available_shortcodes);
455
-        }
456
-        $shortcodes = $codes;
457
-        $form_template = REG_CAF_TEMPLATE_PATH . 'newsletter-send-form.template.php';
458
-        $form_template_args = array(
459
-            'form_action'       => admin_url('admin.php?page=espresso_registrations'),
460
-            'form_route'        => 'newsletter_selected_send',
461
-            'form_nonce_name'   => 'newsletter_selected_send_nonce',
462
-            'form_nonce'        => wp_create_nonce('newsletter_selected_send_nonce'),
463
-            'redirect_back_to'  => $this->_req_action,
464
-            'ajax_nonce'        => wp_create_nonce('get_newsletter_form_content_nonce'),
465
-            'template_selector' => EEH_Form_Fields::select_input('newsletter_mtp_selected', $values),
466
-            'shortcodes'        => $shortcodes,
467
-            'id_type'           => $list_table instanceof EE_Attendee_Contact_List_Table ? 'contact' : 'registration',
468
-        );
469
-        EEH_Template::display_template($form_template, $form_template_args);
470
-    }
410
+	/**
411
+	 * @throws DomainException
412
+	 * @throws EE_Error
413
+	 * @throws InvalidArgumentException
414
+	 * @throws InvalidDataTypeException
415
+	 * @throws InvalidInterfaceException
416
+	 */
417
+	public function newsletter_send_form_skeleton()
418
+	{
419
+		$list_table = $this->_list_table_object;
420
+		$codes = array();
421
+		// need to templates for the newsletter message type for the template selector.
422
+		$values[] = array('text' => esc_html__('Select Template to Use', 'event_espresso'), 'id' => 0);
423
+		$mtps = EEM_Message_Template_Group::instance()->get_all(
424
+			array(array('MTP_message_type' => 'newsletter', 'MTP_messenger' => 'email'))
425
+		);
426
+		foreach ($mtps as $mtp) {
427
+			$name = $mtp->name();
428
+			$values[] = array(
429
+				'text' => empty($name) ? esc_html__('Global', 'event_espresso') : $name,
430
+				'id'   => $mtp->ID(),
431
+			);
432
+		}
433
+		// need to get a list of shortcodes that are available for the newsletter message type.
434
+		$shortcodes = EEH_MSG_Template::get_shortcodes(
435
+			'newsletter',
436
+			'email',
437
+			array(),
438
+			'attendee',
439
+			false
440
+		);
441
+		foreach ($shortcodes as $field => $shortcode_array) {
442
+			$available_shortcodes = array();
443
+			foreach ($shortcode_array as $shortcode => $shortcode_details) {
444
+				$field_id = $field === '[NEWSLETTER_CONTENT]'
445
+					? 'content'
446
+					: $field;
447
+				$field_id = 'batch-message-' . strtolower($field_id);
448
+				$available_shortcodes[] = '<span class="js-shortcode-selection" data-value="'
449
+										  . $shortcode
450
+										  . '" data-linked-input-id="' . $field_id . '">'
451
+										  . $shortcode
452
+										  . '</span>';
453
+			}
454
+			$codes[ $field ] = implode(', ', $available_shortcodes);
455
+		}
456
+		$shortcodes = $codes;
457
+		$form_template = REG_CAF_TEMPLATE_PATH . 'newsletter-send-form.template.php';
458
+		$form_template_args = array(
459
+			'form_action'       => admin_url('admin.php?page=espresso_registrations'),
460
+			'form_route'        => 'newsletter_selected_send',
461
+			'form_nonce_name'   => 'newsletter_selected_send_nonce',
462
+			'form_nonce'        => wp_create_nonce('newsletter_selected_send_nonce'),
463
+			'redirect_back_to'  => $this->_req_action,
464
+			'ajax_nonce'        => wp_create_nonce('get_newsletter_form_content_nonce'),
465
+			'template_selector' => EEH_Form_Fields::select_input('newsletter_mtp_selected', $values),
466
+			'shortcodes'        => $shortcodes,
467
+			'id_type'           => $list_table instanceof EE_Attendee_Contact_List_Table ? 'contact' : 'registration',
468
+		);
469
+		EEH_Template::display_template($form_template, $form_template_args);
470
+	}
471 471
 
472 472
 
473
-    /**
474
-     * Handles sending selected registrations/contacts a newsletter.
475
-     *
476
-     * @since  4.3.0
477
-     * @return void
478
-     * @throws EE_Error
479
-     * @throws InvalidArgumentException
480
-     * @throws InvalidDataTypeException
481
-     * @throws InvalidInterfaceException
482
-     */
483
-    protected function _newsletter_selected_send()
484
-    {
485
-        $success = true;
486
-        // first we need to make sure we have a GRP_ID so we know what template we're sending and updating!
487
-        if (empty($this->_req_data['newsletter_mtp_selected'])) {
488
-            EE_Error::add_error(
489
-                esc_html__(
490
-                    'In order to send a message, a Message Template GRP_ID is needed. It was not provided so messages were not sent.',
491
-                    'event_espresso'
492
-                ),
493
-                __FILE__,
494
-                __FUNCTION__,
495
-                __LINE__
496
-            );
497
-            $success = false;
498
-        }
499
-        if ($success) {
500
-            // update Message template in case there are any changes
501
-            $Message_Template_Group = EEM_Message_Template_Group::instance()->get_one_by_ID(
502
-                $this->_req_data['newsletter_mtp_selected']
503
-            );
504
-            $Message_Templates = $Message_Template_Group instanceof EE_Message_Template_Group
505
-                ? $Message_Template_Group->context_templates()
506
-                : array();
507
-            if (empty($Message_Templates)) {
508
-                EE_Error::add_error(
509
-                    esc_html__(
510
-                        'Unable to retrieve message template fields from the db. Messages not sent.',
511
-                        'event_espresso'
512
-                    ),
513
-                    __FILE__,
514
-                    __FUNCTION__,
515
-                    __LINE__
516
-                );
517
-            }
518
-            // let's just update the specific fields
519
-            foreach ($Message_Templates['attendee'] as $Message_Template) {
520
-                if ($Message_Template instanceof EE_Message_Template) {
521
-                    $field = $Message_Template->get('MTP_template_field');
522
-                    $content = $Message_Template->get('MTP_content');
523
-                    $new_content = $content;
524
-                    switch ($field) {
525
-                        case 'from':
526
-                            $new_content = ! empty($this->_req_data['batch_message']['from'])
527
-                                ? $this->_req_data['batch_message']['from']
528
-                                : $content;
529
-                            break;
530
-                        case 'subject':
531
-                            $new_content = ! empty($this->_req_data['batch_message']['subject'])
532
-                                ? $this->_req_data['batch_message']['subject']
533
-                                : $content;
534
-                            break;
535
-                        case 'content':
536
-                            $new_content = $content;
537
-                            $new_content['newsletter_content'] = ! empty($this->_req_data['batch_message']['content'])
538
-                                ? $this->_req_data['batch_message']['content']
539
-                                : $content['newsletter_content'];
540
-                            break;
541
-                        default:
542
-                            // continue the foreach loop, we don't want to set $new_content nor save.
543
-                            continue 2;
544
-                    }
545
-                    $Message_Template->set('MTP_content', $new_content);
546
-                    $Message_Template->save();
547
-                }
548
-            }
549
-            // great fields are updated!  now let's make sure we just have contact objects (EE_Attendee).
550
-            $id_type = ! empty($this->_req_data['batch_message']['id_type'])
551
-                ? $this->_req_data['batch_message']['id_type']
552
-                : 'registration';
553
-            // id_type will affect how we assemble the ids.
554
-            $ids = ! empty($this->_req_data['batch_message']['ids'])
555
-                ? json_decode(stripslashes($this->_req_data['batch_message']['ids']))
556
-                : array();
557
-            $registrations_used_for_contact_data = array();
558
-            // using switch because eventually we'll have other contexts that will be used for generating messages.
559
-            switch ($id_type) {
560
-                case 'registration':
561
-                    $registrations_used_for_contact_data = EEM_Registration::instance()->get_all(
562
-                        array(
563
-                            array(
564
-                                'REG_ID' => array('IN', $ids),
565
-                            ),
566
-                        )
567
-                    );
568
-                    break;
569
-                case 'contact':
570
-                    $registrations_used_for_contact_data = EEM_Registration::instance()
571
-                                                                           ->get_latest_registration_for_each_of_given_contacts(
572
-                                                                               $ids
573
-                                                                           );
574
-                    break;
575
-            }
576
-            do_action_ref_array(
577
-                'AHEE__Extend_Registrations_Admin_Page___newsletter_selected_send__with_registrations',
578
-                array(
579
-                    $registrations_used_for_contact_data,
580
-                    $Message_Template_Group->ID(),
581
-                )
582
-            );
583
-            // kept for backward compat, internally we no longer use this action.
584
-            // @deprecated 4.8.36.rc.002
585
-            $contacts = $id_type === 'registration'
586
-                ? EEM_Attendee::instance()->get_array_of_contacts_from_reg_ids($ids)
587
-                : EEM_Attendee::instance()->get_all(array(array('ATT_ID' => array('in', $ids))));
588
-            do_action_ref_array(
589
-                'AHEE__Extend_Registrations_Admin_Page___newsletter_selected_send',
590
-                array(
591
-                    $contacts,
592
-                    $Message_Template_Group->ID(),
593
-                )
594
-            );
595
-        }
596
-        $query_args = array(
597
-            'action' => ! empty($this->_req_data['redirect_back_to'])
598
-                ? $this->_req_data['redirect_back_to']
599
-                : 'default',
600
-        );
601
-        $this->_redirect_after_action(false, '', '', $query_args, true);
602
-    }
473
+	/**
474
+	 * Handles sending selected registrations/contacts a newsletter.
475
+	 *
476
+	 * @since  4.3.0
477
+	 * @return void
478
+	 * @throws EE_Error
479
+	 * @throws InvalidArgumentException
480
+	 * @throws InvalidDataTypeException
481
+	 * @throws InvalidInterfaceException
482
+	 */
483
+	protected function _newsletter_selected_send()
484
+	{
485
+		$success = true;
486
+		// first we need to make sure we have a GRP_ID so we know what template we're sending and updating!
487
+		if (empty($this->_req_data['newsletter_mtp_selected'])) {
488
+			EE_Error::add_error(
489
+				esc_html__(
490
+					'In order to send a message, a Message Template GRP_ID is needed. It was not provided so messages were not sent.',
491
+					'event_espresso'
492
+				),
493
+				__FILE__,
494
+				__FUNCTION__,
495
+				__LINE__
496
+			);
497
+			$success = false;
498
+		}
499
+		if ($success) {
500
+			// update Message template in case there are any changes
501
+			$Message_Template_Group = EEM_Message_Template_Group::instance()->get_one_by_ID(
502
+				$this->_req_data['newsletter_mtp_selected']
503
+			);
504
+			$Message_Templates = $Message_Template_Group instanceof EE_Message_Template_Group
505
+				? $Message_Template_Group->context_templates()
506
+				: array();
507
+			if (empty($Message_Templates)) {
508
+				EE_Error::add_error(
509
+					esc_html__(
510
+						'Unable to retrieve message template fields from the db. Messages not sent.',
511
+						'event_espresso'
512
+					),
513
+					__FILE__,
514
+					__FUNCTION__,
515
+					__LINE__
516
+				);
517
+			}
518
+			// let's just update the specific fields
519
+			foreach ($Message_Templates['attendee'] as $Message_Template) {
520
+				if ($Message_Template instanceof EE_Message_Template) {
521
+					$field = $Message_Template->get('MTP_template_field');
522
+					$content = $Message_Template->get('MTP_content');
523
+					$new_content = $content;
524
+					switch ($field) {
525
+						case 'from':
526
+							$new_content = ! empty($this->_req_data['batch_message']['from'])
527
+								? $this->_req_data['batch_message']['from']
528
+								: $content;
529
+							break;
530
+						case 'subject':
531
+							$new_content = ! empty($this->_req_data['batch_message']['subject'])
532
+								? $this->_req_data['batch_message']['subject']
533
+								: $content;
534
+							break;
535
+						case 'content':
536
+							$new_content = $content;
537
+							$new_content['newsletter_content'] = ! empty($this->_req_data['batch_message']['content'])
538
+								? $this->_req_data['batch_message']['content']
539
+								: $content['newsletter_content'];
540
+							break;
541
+						default:
542
+							// continue the foreach loop, we don't want to set $new_content nor save.
543
+							continue 2;
544
+					}
545
+					$Message_Template->set('MTP_content', $new_content);
546
+					$Message_Template->save();
547
+				}
548
+			}
549
+			// great fields are updated!  now let's make sure we just have contact objects (EE_Attendee).
550
+			$id_type = ! empty($this->_req_data['batch_message']['id_type'])
551
+				? $this->_req_data['batch_message']['id_type']
552
+				: 'registration';
553
+			// id_type will affect how we assemble the ids.
554
+			$ids = ! empty($this->_req_data['batch_message']['ids'])
555
+				? json_decode(stripslashes($this->_req_data['batch_message']['ids']))
556
+				: array();
557
+			$registrations_used_for_contact_data = array();
558
+			// using switch because eventually we'll have other contexts that will be used for generating messages.
559
+			switch ($id_type) {
560
+				case 'registration':
561
+					$registrations_used_for_contact_data = EEM_Registration::instance()->get_all(
562
+						array(
563
+							array(
564
+								'REG_ID' => array('IN', $ids),
565
+							),
566
+						)
567
+					);
568
+					break;
569
+				case 'contact':
570
+					$registrations_used_for_contact_data = EEM_Registration::instance()
571
+																		   ->get_latest_registration_for_each_of_given_contacts(
572
+																			   $ids
573
+																		   );
574
+					break;
575
+			}
576
+			do_action_ref_array(
577
+				'AHEE__Extend_Registrations_Admin_Page___newsletter_selected_send__with_registrations',
578
+				array(
579
+					$registrations_used_for_contact_data,
580
+					$Message_Template_Group->ID(),
581
+				)
582
+			);
583
+			// kept for backward compat, internally we no longer use this action.
584
+			// @deprecated 4.8.36.rc.002
585
+			$contacts = $id_type === 'registration'
586
+				? EEM_Attendee::instance()->get_array_of_contacts_from_reg_ids($ids)
587
+				: EEM_Attendee::instance()->get_all(array(array('ATT_ID' => array('in', $ids))));
588
+			do_action_ref_array(
589
+				'AHEE__Extend_Registrations_Admin_Page___newsletter_selected_send',
590
+				array(
591
+					$contacts,
592
+					$Message_Template_Group->ID(),
593
+				)
594
+			);
595
+		}
596
+		$query_args = array(
597
+			'action' => ! empty($this->_req_data['redirect_back_to'])
598
+				? $this->_req_data['redirect_back_to']
599
+				: 'default',
600
+		);
601
+		$this->_redirect_after_action(false, '', '', $query_args, true);
602
+	}
603 603
 
604 604
 
605
-    /**
606
-     * This is called when javascript is being enqueued to setup the various data needed for the reports js.
607
-     * Also $this->{$_reports_template_data} property is set for later usage by the _registration_reports method.
608
-     */
609
-    protected function _registration_reports_js_setup()
610
-    {
611
-        $this->_reports_template_data['admin_reports'][] = $this->_registrations_per_day_report();
612
-        $this->_reports_template_data['admin_reports'][] = $this->_registrations_per_event_report();
613
-    }
605
+	/**
606
+	 * This is called when javascript is being enqueued to setup the various data needed for the reports js.
607
+	 * Also $this->{$_reports_template_data} property is set for later usage by the _registration_reports method.
608
+	 */
609
+	protected function _registration_reports_js_setup()
610
+	{
611
+		$this->_reports_template_data['admin_reports'][] = $this->_registrations_per_day_report();
612
+		$this->_reports_template_data['admin_reports'][] = $this->_registrations_per_event_report();
613
+	}
614 614
 
615 615
 
616
-    /**
617
-     *        generates Business Reports regarding Registrations
618
-     *
619
-     * @access protected
620
-     * @return void
621
-     * @throws DomainException
622
-     */
623
-    protected function _registration_reports()
624
-    {
625
-        $template_path = EE_ADMIN_TEMPLATE . 'admin_reports.template.php';
626
-        $this->_template_args['admin_page_content'] = EEH_Template::display_template(
627
-            $template_path,
628
-            $this->_reports_template_data,
629
-            true
630
-        );
631
-        // the final template wrapper
632
-        $this->display_admin_page_with_no_sidebar();
633
-    }
616
+	/**
617
+	 *        generates Business Reports regarding Registrations
618
+	 *
619
+	 * @access protected
620
+	 * @return void
621
+	 * @throws DomainException
622
+	 */
623
+	protected function _registration_reports()
624
+	{
625
+		$template_path = EE_ADMIN_TEMPLATE . 'admin_reports.template.php';
626
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template(
627
+			$template_path,
628
+			$this->_reports_template_data,
629
+			true
630
+		);
631
+		// the final template wrapper
632
+		$this->display_admin_page_with_no_sidebar();
633
+	}
634 634
 
635 635
 
636
-    /**
637
-     * Generates Business Report showing total registrations per day.
638
-     *
639
-     * @param string $period The period (acceptable by PHP Datetime constructor) for which the report is generated.
640
-     * @return string
641
-     * @throws EE_Error
642
-     * @throws InvalidArgumentException
643
-     * @throws InvalidDataTypeException
644
-     * @throws InvalidInterfaceException
645
-     */
646
-    private function _registrations_per_day_report($period = '-1 month')
647
-    {
648
-        $report_ID = 'reg-admin-registrations-per-day-report-dv';
649
-        $results = EEM_Registration::instance()->get_registrations_per_day_and_per_status_report($period);
650
-        $results = (array) $results;
651
-        $regs = array();
652
-        $subtitle = '';
653
-        if ($results) {
654
-            $column_titles = array();
655
-            $tracker = 0;
656
-            foreach ($results as $result) {
657
-                $report_column_values = array();
658
-                foreach ($result as $property_name => $property_value) {
659
-                    $property_value = $property_name === 'Registration_REG_date' ? $property_value
660
-                        : (int) $property_value;
661
-                    $report_column_values[] = $property_value;
662
-                    if ($tracker === 0) {
663
-                        if ($property_name === 'Registration_REG_date') {
664
-                            $column_titles[] = esc_html__(
665
-                                'Date (only days with registrations are shown)',
666
-                                'event_espresso'
667
-                            );
668
-                        } else {
669
-                            $column_titles[] = EEH_Template::pretty_status($property_name, false, 'sentence');
670
-                        }
671
-                    }
672
-                }
673
-                $tracker++;
674
-                $regs[] = $report_column_values;
675
-            }
676
-            // make sure the column_titles is pushed to the beginning of the array
677
-            array_unshift($regs, $column_titles);
678
-            // setup the date range.
679
-            $DateTimeZone = new DateTimeZone(EEH_DTT_Helper::get_timezone());
680
-            $beginning_date = new DateTime("now " . $period, $DateTimeZone);
681
-            $ending_date = new DateTime("now", $DateTimeZone);
682
-            $subtitle = sprintf(
683
-                _x('For the period: %1$s to %2$s', 'Used to give date range', 'event_espresso'),
684
-                $beginning_date->format('Y-m-d'),
685
-                $ending_date->format('Y-m-d')
686
-            );
687
-        }
688
-        $report_title = esc_html__('Total Registrations per Day', 'event_espresso');
689
-        $report_params = array(
690
-            'title'     => $report_title,
691
-            'subtitle'  => $subtitle,
692
-            'id'        => $report_ID,
693
-            'regs'      => $regs,
694
-            'noResults' => empty($regs),
695
-            'noRegsMsg' => sprintf(
696
-                esc_html__(
697
-                    '%sThere are currently no registration records in the last month for this report.%s',
698
-                    'event_espresso'
699
-                ),
700
-                '<h2>' . $report_title . '</h2><p>',
701
-                '</p>'
702
-            ),
703
-        );
704
-        wp_localize_script('ee-reg-reports-js', 'regPerDay', $report_params);
705
-        return $report_ID;
706
-    }
636
+	/**
637
+	 * Generates Business Report showing total registrations per day.
638
+	 *
639
+	 * @param string $period The period (acceptable by PHP Datetime constructor) for which the report is generated.
640
+	 * @return string
641
+	 * @throws EE_Error
642
+	 * @throws InvalidArgumentException
643
+	 * @throws InvalidDataTypeException
644
+	 * @throws InvalidInterfaceException
645
+	 */
646
+	private function _registrations_per_day_report($period = '-1 month')
647
+	{
648
+		$report_ID = 'reg-admin-registrations-per-day-report-dv';
649
+		$results = EEM_Registration::instance()->get_registrations_per_day_and_per_status_report($period);
650
+		$results = (array) $results;
651
+		$regs = array();
652
+		$subtitle = '';
653
+		if ($results) {
654
+			$column_titles = array();
655
+			$tracker = 0;
656
+			foreach ($results as $result) {
657
+				$report_column_values = array();
658
+				foreach ($result as $property_name => $property_value) {
659
+					$property_value = $property_name === 'Registration_REG_date' ? $property_value
660
+						: (int) $property_value;
661
+					$report_column_values[] = $property_value;
662
+					if ($tracker === 0) {
663
+						if ($property_name === 'Registration_REG_date') {
664
+							$column_titles[] = esc_html__(
665
+								'Date (only days with registrations are shown)',
666
+								'event_espresso'
667
+							);
668
+						} else {
669
+							$column_titles[] = EEH_Template::pretty_status($property_name, false, 'sentence');
670
+						}
671
+					}
672
+				}
673
+				$tracker++;
674
+				$regs[] = $report_column_values;
675
+			}
676
+			// make sure the column_titles is pushed to the beginning of the array
677
+			array_unshift($regs, $column_titles);
678
+			// setup the date range.
679
+			$DateTimeZone = new DateTimeZone(EEH_DTT_Helper::get_timezone());
680
+			$beginning_date = new DateTime("now " . $period, $DateTimeZone);
681
+			$ending_date = new DateTime("now", $DateTimeZone);
682
+			$subtitle = sprintf(
683
+				_x('For the period: %1$s to %2$s', 'Used to give date range', 'event_espresso'),
684
+				$beginning_date->format('Y-m-d'),
685
+				$ending_date->format('Y-m-d')
686
+			);
687
+		}
688
+		$report_title = esc_html__('Total Registrations per Day', 'event_espresso');
689
+		$report_params = array(
690
+			'title'     => $report_title,
691
+			'subtitle'  => $subtitle,
692
+			'id'        => $report_ID,
693
+			'regs'      => $regs,
694
+			'noResults' => empty($regs),
695
+			'noRegsMsg' => sprintf(
696
+				esc_html__(
697
+					'%sThere are currently no registration records in the last month for this report.%s',
698
+					'event_espresso'
699
+				),
700
+				'<h2>' . $report_title . '</h2><p>',
701
+				'</p>'
702
+			),
703
+		);
704
+		wp_localize_script('ee-reg-reports-js', 'regPerDay', $report_params);
705
+		return $report_ID;
706
+	}
707 707
 
708 708
 
709
-    /**
710
-     * Generates Business Report showing total registrations per event.
711
-     *
712
-     * @param string $period The period (acceptable by PHP Datetime constructor) for which the report is generated.
713
-     * @return string
714
-     * @throws EE_Error
715
-     * @throws InvalidArgumentException
716
-     * @throws InvalidDataTypeException
717
-     * @throws InvalidInterfaceException
718
-     */
719
-    private function _registrations_per_event_report($period = '-1 month')
720
-    {
721
-        $report_ID = 'reg-admin-registrations-per-event-report-dv';
722
-        $results = EEM_Registration::instance()->get_registrations_per_event_and_per_status_report($period);
723
-        $results = (array) $results;
724
-        $regs = array();
725
-        $subtitle = '';
726
-        if ($results) {
727
-            $column_titles = array();
728
-            $tracker = 0;
729
-            foreach ($results as $result) {
730
-                $report_column_values = array();
731
-                foreach ($result as $property_name => $property_value) {
732
-                    $property_value = $property_name === 'Registration_Event' ? wp_trim_words(
733
-                        $property_value,
734
-                        4,
735
-                        '...'
736
-                    ) : (int) $property_value;
737
-                    $report_column_values[] = $property_value;
738
-                    if ($tracker === 0) {
739
-                        if ($property_name === 'Registration_Event') {
740
-                            $column_titles[] = esc_html__('Event', 'event_espresso');
741
-                        } else {
742
-                            $column_titles[] = EEH_Template::pretty_status($property_name, false, 'sentence');
743
-                        }
744
-                    }
745
-                }
746
-                $tracker++;
747
-                $regs[] = $report_column_values;
748
-            }
749
-            // make sure the column_titles is pushed to the beginning of the array
750
-            array_unshift($regs, $column_titles);
751
-            // setup the date range.
752
-            $DateTimeZone = new DateTimeZone(EEH_DTT_Helper::get_timezone());
753
-            $beginning_date = new DateTime("now " . $period, $DateTimeZone);
754
-            $ending_date = new DateTime("now", $DateTimeZone);
755
-            $subtitle = sprintf(
756
-                _x('For the period: %1$s to %2$s', 'Used to give date range', 'event_espresso'),
757
-                $beginning_date->format('Y-m-d'),
758
-                $ending_date->format('Y-m-d')
759
-            );
760
-        }
761
-        $report_title = esc_html__('Total Registrations per Event', 'event_espresso');
762
-        $report_params = array(
763
-            'title'     => $report_title,
764
-            'subtitle'  => $subtitle,
765
-            'id'        => $report_ID,
766
-            'regs'      => $regs,
767
-            'noResults' => empty($regs),
768
-            'noRegsMsg' => sprintf(
769
-                esc_html__(
770
-                    '%sThere are currently no registration records in the last month for this report.%s',
771
-                    'event_espresso'
772
-                ),
773
-                '<h2>' . $report_title . '</h2><p>',
774
-                '</p>'
775
-            ),
776
-        );
777
-        wp_localize_script('ee-reg-reports-js', 'regPerEvent', $report_params);
778
-        return $report_ID;
779
-    }
709
+	/**
710
+	 * Generates Business Report showing total registrations per event.
711
+	 *
712
+	 * @param string $period The period (acceptable by PHP Datetime constructor) for which the report is generated.
713
+	 * @return string
714
+	 * @throws EE_Error
715
+	 * @throws InvalidArgumentException
716
+	 * @throws InvalidDataTypeException
717
+	 * @throws InvalidInterfaceException
718
+	 */
719
+	private function _registrations_per_event_report($period = '-1 month')
720
+	{
721
+		$report_ID = 'reg-admin-registrations-per-event-report-dv';
722
+		$results = EEM_Registration::instance()->get_registrations_per_event_and_per_status_report($period);
723
+		$results = (array) $results;
724
+		$regs = array();
725
+		$subtitle = '';
726
+		if ($results) {
727
+			$column_titles = array();
728
+			$tracker = 0;
729
+			foreach ($results as $result) {
730
+				$report_column_values = array();
731
+				foreach ($result as $property_name => $property_value) {
732
+					$property_value = $property_name === 'Registration_Event' ? wp_trim_words(
733
+						$property_value,
734
+						4,
735
+						'...'
736
+					) : (int) $property_value;
737
+					$report_column_values[] = $property_value;
738
+					if ($tracker === 0) {
739
+						if ($property_name === 'Registration_Event') {
740
+							$column_titles[] = esc_html__('Event', 'event_espresso');
741
+						} else {
742
+							$column_titles[] = EEH_Template::pretty_status($property_name, false, 'sentence');
743
+						}
744
+					}
745
+				}
746
+				$tracker++;
747
+				$regs[] = $report_column_values;
748
+			}
749
+			// make sure the column_titles is pushed to the beginning of the array
750
+			array_unshift($regs, $column_titles);
751
+			// setup the date range.
752
+			$DateTimeZone = new DateTimeZone(EEH_DTT_Helper::get_timezone());
753
+			$beginning_date = new DateTime("now " . $period, $DateTimeZone);
754
+			$ending_date = new DateTime("now", $DateTimeZone);
755
+			$subtitle = sprintf(
756
+				_x('For the period: %1$s to %2$s', 'Used to give date range', 'event_espresso'),
757
+				$beginning_date->format('Y-m-d'),
758
+				$ending_date->format('Y-m-d')
759
+			);
760
+		}
761
+		$report_title = esc_html__('Total Registrations per Event', 'event_espresso');
762
+		$report_params = array(
763
+			'title'     => $report_title,
764
+			'subtitle'  => $subtitle,
765
+			'id'        => $report_ID,
766
+			'regs'      => $regs,
767
+			'noResults' => empty($regs),
768
+			'noRegsMsg' => sprintf(
769
+				esc_html__(
770
+					'%sThere are currently no registration records in the last month for this report.%s',
771
+					'event_espresso'
772
+				),
773
+				'<h2>' . $report_title . '</h2><p>',
774
+				'</p>'
775
+			),
776
+		);
777
+		wp_localize_script('ee-reg-reports-js', 'regPerEvent', $report_params);
778
+		return $report_ID;
779
+	}
780 780
 
781 781
 
782
-    /**
783
-     * generates HTML for the Registration Check-in list table (showing all Check-ins for a specific registration)
784
-     *
785
-     * @access protected
786
-     * @return void
787
-     * @throws EE_Error
788
-     * @throws InvalidArgumentException
789
-     * @throws InvalidDataTypeException
790
-     * @throws InvalidInterfaceException
791
-     * @throws \EventEspresso\core\exceptions\EntityNotFoundException
792
-     */
793
-    protected function _registration_checkin_list_table()
794
-    {
795
-        do_action('AHEE_log', __FILE__, __FUNCTION__, '');
796
-        $reg_id = isset($this->_req_data['_REG_ID']) ? $this->_req_data['_REG_ID'] : null;
797
-        /** @var EE_Registration $registration */
798
-        $registration = EEM_Registration::instance()->get_one_by_ID($reg_id);
799
-        if (! $registration instanceof EE_Registration) {
800
-            throw new EE_Error(
801
-                sprintf(
802
-                    esc_html__('An error occurred. There is no registration with ID (%d)', 'event_espresso'),
803
-                    $reg_id
804
-                )
805
-            );
806
-        }
807
-        $attendee = $registration->attendee();
808
-        $this->_admin_page_title .= $this->get_action_link_or_button(
809
-            'new_registration',
810
-            'add-registrant',
811
-            array('event_id' => $registration->event_ID()),
812
-            'add-new-h2'
813
-        );
814
-        $checked_in = new CheckinStatusDashicon(EE_Checkin::status_checked_in);
815
-        $checked_out = new CheckinStatusDashicon(EE_Checkin::status_checked_out);
816
-        $legend_items = array(
817
-            'checkin'  => array(
818
-                'class' => $checked_in->cssClasses(),
819
-                'desc'  => $checked_in->legendLabel(),
820
-            ),
821
-            'checkout' => array(
822
-                'class' => $checked_out->cssClasses(),
823
-                'desc'  => $checked_out->legendLabel(),
824
-            ),
825
-        );
826
-        $this->_template_args['after_list_table'] = $this->_display_legend($legend_items);
827
-        $dtt_id = isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : null;
828
-        /** @var EE_Datetime $datetime */
829
-        $datetime = EEM_Datetime::instance()->get_one_by_ID($dtt_id);
830
-        $datetime_label = '';
831
-        if ($datetime instanceof EE_Datetime) {
832
-            $datetime_label = $datetime->get_dtt_display_name(true);
833
-            $datetime_label .= ! empty($datetime_label)
834
-                ? ' (' . $datetime->get_dtt_display_name() . ')'
835
-                : $datetime->get_dtt_display_name();
836
-        }
837
-        $datetime_link = ! empty($dtt_id) && $registration instanceof EE_Registration
838
-            ? EE_Admin_Page::add_query_args_and_nonce(
839
-                array(
840
-                    'action'   => 'event_registrations',
841
-                    'event_id' => $registration->event_ID(),
842
-                    'DTT_ID'   => $dtt_id,
843
-                ),
844
-                $this->_admin_base_url
845
-            )
846
-            : '';
847
-        $datetime_link = ! empty($datetime_link)
848
-            ? '<a href="' . $datetime_link . '">'
849
-              . '<span id="checkin-dtt">'
850
-              . $datetime_label
851
-              . '</span></a>'
852
-            : $datetime_label;
853
-        $attendee_name = $attendee instanceof EE_Attendee
854
-            ? $attendee->full_name()
855
-            : '';
856
-        $attendee_link = $attendee instanceof EE_Attendee
857
-            ? $attendee->get_admin_details_link()
858
-            : '';
859
-        $attendee_link = ! empty($attendee_link)
860
-            ? '<a href="' . $attendee->get_admin_details_link() . '"'
861
-              . ' title="' . esc_html__('Click for attendee details', 'event_espresso') . '">'
862
-              . '<span id="checkin-attendee-name">'
863
-              . $attendee_name
864
-              . '</span></a>'
865
-            : '';
866
-        $event_link = $registration->event() instanceof EE_Event
867
-            ? $registration->event()->get_admin_details_link()
868
-            : '';
869
-        $event_link = ! empty($event_link)
870
-            ? '<a href="' . $event_link . '"'
871
-              . ' title="' . esc_html__('Click here to edit event.', 'event_espresso') . '">'
872
-              . '<span id="checkin-event-name">'
873
-              . $registration->event_name()
874
-              . '</span>'
875
-              . '</a>'
876
-            : '';
877
-        $this->_template_args['before_list_table'] = ! empty($reg_id) && ! empty($dtt_id)
878
-            ? '<h2>' . sprintf(
879
-                esc_html__('Displaying check in records for %1$s for %2$s at the event, %3$s', 'event_espresso'),
880
-                $attendee_link,
881
-                $datetime_link,
882
-                $event_link
883
-            ) . '</h2>'
884
-            : '';
885
-        $this->_template_args['list_table_hidden_fields'] = ! empty($reg_id)
886
-            ? '<input type="hidden" name="_REG_ID" value="' . $reg_id . '">' : '';
887
-        $this->_template_args['list_table_hidden_fields'] .= ! empty($dtt_id)
888
-            ? '<input type="hidden" name="DTT_ID" value="' . $dtt_id . '">' : '';
889
-        $this->display_admin_list_table_page_with_no_sidebar();
890
-    }
782
+	/**
783
+	 * generates HTML for the Registration Check-in list table (showing all Check-ins for a specific registration)
784
+	 *
785
+	 * @access protected
786
+	 * @return void
787
+	 * @throws EE_Error
788
+	 * @throws InvalidArgumentException
789
+	 * @throws InvalidDataTypeException
790
+	 * @throws InvalidInterfaceException
791
+	 * @throws \EventEspresso\core\exceptions\EntityNotFoundException
792
+	 */
793
+	protected function _registration_checkin_list_table()
794
+	{
795
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
796
+		$reg_id = isset($this->_req_data['_REG_ID']) ? $this->_req_data['_REG_ID'] : null;
797
+		/** @var EE_Registration $registration */
798
+		$registration = EEM_Registration::instance()->get_one_by_ID($reg_id);
799
+		if (! $registration instanceof EE_Registration) {
800
+			throw new EE_Error(
801
+				sprintf(
802
+					esc_html__('An error occurred. There is no registration with ID (%d)', 'event_espresso'),
803
+					$reg_id
804
+				)
805
+			);
806
+		}
807
+		$attendee = $registration->attendee();
808
+		$this->_admin_page_title .= $this->get_action_link_or_button(
809
+			'new_registration',
810
+			'add-registrant',
811
+			array('event_id' => $registration->event_ID()),
812
+			'add-new-h2'
813
+		);
814
+		$checked_in = new CheckinStatusDashicon(EE_Checkin::status_checked_in);
815
+		$checked_out = new CheckinStatusDashicon(EE_Checkin::status_checked_out);
816
+		$legend_items = array(
817
+			'checkin'  => array(
818
+				'class' => $checked_in->cssClasses(),
819
+				'desc'  => $checked_in->legendLabel(),
820
+			),
821
+			'checkout' => array(
822
+				'class' => $checked_out->cssClasses(),
823
+				'desc'  => $checked_out->legendLabel(),
824
+			),
825
+		);
826
+		$this->_template_args['after_list_table'] = $this->_display_legend($legend_items);
827
+		$dtt_id = isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : null;
828
+		/** @var EE_Datetime $datetime */
829
+		$datetime = EEM_Datetime::instance()->get_one_by_ID($dtt_id);
830
+		$datetime_label = '';
831
+		if ($datetime instanceof EE_Datetime) {
832
+			$datetime_label = $datetime->get_dtt_display_name(true);
833
+			$datetime_label .= ! empty($datetime_label)
834
+				? ' (' . $datetime->get_dtt_display_name() . ')'
835
+				: $datetime->get_dtt_display_name();
836
+		}
837
+		$datetime_link = ! empty($dtt_id) && $registration instanceof EE_Registration
838
+			? EE_Admin_Page::add_query_args_and_nonce(
839
+				array(
840
+					'action'   => 'event_registrations',
841
+					'event_id' => $registration->event_ID(),
842
+					'DTT_ID'   => $dtt_id,
843
+				),
844
+				$this->_admin_base_url
845
+			)
846
+			: '';
847
+		$datetime_link = ! empty($datetime_link)
848
+			? '<a href="' . $datetime_link . '">'
849
+			  . '<span id="checkin-dtt">'
850
+			  . $datetime_label
851
+			  . '</span></a>'
852
+			: $datetime_label;
853
+		$attendee_name = $attendee instanceof EE_Attendee
854
+			? $attendee->full_name()
855
+			: '';
856
+		$attendee_link = $attendee instanceof EE_Attendee
857
+			? $attendee->get_admin_details_link()
858
+			: '';
859
+		$attendee_link = ! empty($attendee_link)
860
+			? '<a href="' . $attendee->get_admin_details_link() . '"'
861
+			  . ' title="' . esc_html__('Click for attendee details', 'event_espresso') . '">'
862
+			  . '<span id="checkin-attendee-name">'
863
+			  . $attendee_name
864
+			  . '</span></a>'
865
+			: '';
866
+		$event_link = $registration->event() instanceof EE_Event
867
+			? $registration->event()->get_admin_details_link()
868
+			: '';
869
+		$event_link = ! empty($event_link)
870
+			? '<a href="' . $event_link . '"'
871
+			  . ' title="' . esc_html__('Click here to edit event.', 'event_espresso') . '">'
872
+			  . '<span id="checkin-event-name">'
873
+			  . $registration->event_name()
874
+			  . '</span>'
875
+			  . '</a>'
876
+			: '';
877
+		$this->_template_args['before_list_table'] = ! empty($reg_id) && ! empty($dtt_id)
878
+			? '<h2>' . sprintf(
879
+				esc_html__('Displaying check in records for %1$s for %2$s at the event, %3$s', 'event_espresso'),
880
+				$attendee_link,
881
+				$datetime_link,
882
+				$event_link
883
+			) . '</h2>'
884
+			: '';
885
+		$this->_template_args['list_table_hidden_fields'] = ! empty($reg_id)
886
+			? '<input type="hidden" name="_REG_ID" value="' . $reg_id . '">' : '';
887
+		$this->_template_args['list_table_hidden_fields'] .= ! empty($dtt_id)
888
+			? '<input type="hidden" name="DTT_ID" value="' . $dtt_id . '">' : '';
889
+		$this->display_admin_list_table_page_with_no_sidebar();
890
+	}
891 891
 
892 892
 
893
-    /**
894
-     * toggle the Check-in status for the given registration (coming from ajax)
895
-     *
896
-     * @return void (JSON)
897
-     * @throws EE_Error
898
-     * @throws InvalidArgumentException
899
-     * @throws InvalidDataTypeException
900
-     * @throws InvalidInterfaceException
901
-     */
902
-    public function toggle_checkin_status()
903
-    {
904
-        // first make sure we have the necessary data
905
-        if (! isset($this->_req_data['_regid'])) {
906
-            EE_Error::add_error(
907
-                esc_html__(
908
-                    'There must be something broken with the html structure because the required data for toggling the Check-in status is not being sent via ajax',
909
-                    'event_espresso'
910
-                ),
911
-                __FILE__,
912
-                __FUNCTION__,
913
-                __LINE__
914
-            );
915
-            $this->_template_args['success'] = false;
916
-            $this->_template_args['error'] = true;
917
-            $this->_return_json();
918
-        };
919
-        // do a nonce check cause we're not coming in from an normal route here.
920
-        $nonce = isset($this->_req_data['checkinnonce']) ? sanitize_text_field($this->_req_data['checkinnonce'])
921
-            : '';
922
-        $nonce_ref = 'checkin_nonce';
923
-        $this->_verify_nonce($nonce, $nonce_ref);
924
-        // beautiful! Made it this far so let's get the status.
925
-        $new_status = new CheckinStatusDashicon($this->_toggle_checkin_status());
926
-        // setup new class to return via ajax
927
-        $this->_template_args['admin_page_content'] = 'clickable trigger-checkin ' . $new_status->cssClasses();
928
-        $this->_template_args['success'] = true;
929
-        $this->_return_json();
930
-    }
893
+	/**
894
+	 * toggle the Check-in status for the given registration (coming from ajax)
895
+	 *
896
+	 * @return void (JSON)
897
+	 * @throws EE_Error
898
+	 * @throws InvalidArgumentException
899
+	 * @throws InvalidDataTypeException
900
+	 * @throws InvalidInterfaceException
901
+	 */
902
+	public function toggle_checkin_status()
903
+	{
904
+		// first make sure we have the necessary data
905
+		if (! isset($this->_req_data['_regid'])) {
906
+			EE_Error::add_error(
907
+				esc_html__(
908
+					'There must be something broken with the html structure because the required data for toggling the Check-in status is not being sent via ajax',
909
+					'event_espresso'
910
+				),
911
+				__FILE__,
912
+				__FUNCTION__,
913
+				__LINE__
914
+			);
915
+			$this->_template_args['success'] = false;
916
+			$this->_template_args['error'] = true;
917
+			$this->_return_json();
918
+		};
919
+		// do a nonce check cause we're not coming in from an normal route here.
920
+		$nonce = isset($this->_req_data['checkinnonce']) ? sanitize_text_field($this->_req_data['checkinnonce'])
921
+			: '';
922
+		$nonce_ref = 'checkin_nonce';
923
+		$this->_verify_nonce($nonce, $nonce_ref);
924
+		// beautiful! Made it this far so let's get the status.
925
+		$new_status = new CheckinStatusDashicon($this->_toggle_checkin_status());
926
+		// setup new class to return via ajax
927
+		$this->_template_args['admin_page_content'] = 'clickable trigger-checkin ' . $new_status->cssClasses();
928
+		$this->_template_args['success'] = true;
929
+		$this->_return_json();
930
+	}
931 931
 
932 932
 
933
-    /**
934
-     * handles toggling the checkin status for the registration,
935
-     *
936
-     * @access protected
937
-     * @return int|void
938
-     * @throws EE_Error
939
-     * @throws InvalidArgumentException
940
-     * @throws InvalidDataTypeException
941
-     * @throws InvalidInterfaceException
942
-     */
943
-    protected function _toggle_checkin_status()
944
-    {
945
-        // first let's get the query args out of the way for the redirect
946
-        $query_args = array(
947
-            'action'   => 'event_registrations',
948
-            'event_id' => isset($this->_req_data['event_id']) ? $this->_req_data['event_id'] : null,
949
-            'DTT_ID'   => isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : null,
950
-        );
951
-        $new_status = false;
952
-        // bulk action check in toggle
953
-        if (! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
954
-            // cycle thru checkboxes
955
-            while (list($REG_ID, $value) = each($this->_req_data['checkbox'])) {
956
-                $DTT_ID = isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : null;
957
-                $new_status = $this->_toggle_checkin($REG_ID, $DTT_ID);
958
-            }
959
-        } elseif (isset($this->_req_data['_regid'])) {
960
-            // coming from ajax request
961
-            $DTT_ID = isset($this->_req_data['dttid']) ? $this->_req_data['dttid'] : null;
962
-            $query_args['DTT_ID'] = $DTT_ID;
963
-            $new_status = $this->_toggle_checkin($this->_req_data['_regid'], $DTT_ID);
964
-        } else {
965
-            EE_Error::add_error(
966
-                esc_html__('Missing some required data to toggle the Check-in', 'event_espresso'),
967
-                __FILE__,
968
-                __FUNCTION__,
969
-                __LINE__
970
-            );
971
-        }
972
-        if (defined('DOING_AJAX')) {
973
-            return $new_status;
974
-        }
975
-        $this->_redirect_after_action(false, '', '', $query_args, true);
976
-    }
933
+	/**
934
+	 * handles toggling the checkin status for the registration,
935
+	 *
936
+	 * @access protected
937
+	 * @return int|void
938
+	 * @throws EE_Error
939
+	 * @throws InvalidArgumentException
940
+	 * @throws InvalidDataTypeException
941
+	 * @throws InvalidInterfaceException
942
+	 */
943
+	protected function _toggle_checkin_status()
944
+	{
945
+		// first let's get the query args out of the way for the redirect
946
+		$query_args = array(
947
+			'action'   => 'event_registrations',
948
+			'event_id' => isset($this->_req_data['event_id']) ? $this->_req_data['event_id'] : null,
949
+			'DTT_ID'   => isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : null,
950
+		);
951
+		$new_status = false;
952
+		// bulk action check in toggle
953
+		if (! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
954
+			// cycle thru checkboxes
955
+			while (list($REG_ID, $value) = each($this->_req_data['checkbox'])) {
956
+				$DTT_ID = isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : null;
957
+				$new_status = $this->_toggle_checkin($REG_ID, $DTT_ID);
958
+			}
959
+		} elseif (isset($this->_req_data['_regid'])) {
960
+			// coming from ajax request
961
+			$DTT_ID = isset($this->_req_data['dttid']) ? $this->_req_data['dttid'] : null;
962
+			$query_args['DTT_ID'] = $DTT_ID;
963
+			$new_status = $this->_toggle_checkin($this->_req_data['_regid'], $DTT_ID);
964
+		} else {
965
+			EE_Error::add_error(
966
+				esc_html__('Missing some required data to toggle the Check-in', 'event_espresso'),
967
+				__FILE__,
968
+				__FUNCTION__,
969
+				__LINE__
970
+			);
971
+		}
972
+		if (defined('DOING_AJAX')) {
973
+			return $new_status;
974
+		}
975
+		$this->_redirect_after_action(false, '', '', $query_args, true);
976
+	}
977 977
 
978 978
 
979
-    /**
980
-     * This is toggles a single Check-in for the given registration and datetime.
981
-     *
982
-     * @param  int $REG_ID The registration we're toggling
983
-     * @param  int $DTT_ID The datetime we're toggling
984
-     * @return int The new status toggled to.
985
-     * @throws EE_Error
986
-     * @throws InvalidArgumentException
987
-     * @throws InvalidDataTypeException
988
-     * @throws InvalidInterfaceException
989
-     */
990
-    private function _toggle_checkin($REG_ID, $DTT_ID)
991
-    {
992
-        /** @var EE_Registration $REG */
993
-        $REG = EEM_Registration::instance()->get_one_by_ID($REG_ID);
994
-        $new_status = $REG->toggle_checkin_status($DTT_ID);
995
-        if ($new_status !== false) {
996
-            EE_Error::add_success($REG->get_checkin_msg($DTT_ID));
997
-        } else {
998
-            EE_Error::add_error($REG->get_checkin_msg($DTT_ID, true), __FILE__, __FUNCTION__, __LINE__);
999
-            $new_status = false;
1000
-        }
1001
-        return $new_status;
1002
-    }
979
+	/**
980
+	 * This is toggles a single Check-in for the given registration and datetime.
981
+	 *
982
+	 * @param  int $REG_ID The registration we're toggling
983
+	 * @param  int $DTT_ID The datetime we're toggling
984
+	 * @return int The new status toggled to.
985
+	 * @throws EE_Error
986
+	 * @throws InvalidArgumentException
987
+	 * @throws InvalidDataTypeException
988
+	 * @throws InvalidInterfaceException
989
+	 */
990
+	private function _toggle_checkin($REG_ID, $DTT_ID)
991
+	{
992
+		/** @var EE_Registration $REG */
993
+		$REG = EEM_Registration::instance()->get_one_by_ID($REG_ID);
994
+		$new_status = $REG->toggle_checkin_status($DTT_ID);
995
+		if ($new_status !== false) {
996
+			EE_Error::add_success($REG->get_checkin_msg($DTT_ID));
997
+		} else {
998
+			EE_Error::add_error($REG->get_checkin_msg($DTT_ID, true), __FILE__, __FUNCTION__, __LINE__);
999
+			$new_status = false;
1000
+		}
1001
+		return $new_status;
1002
+	}
1003 1003
 
1004 1004
 
1005
-    /**
1006
-     * Takes care of deleting multiple EE_Checkin table rows
1007
-     *
1008
-     * @access protected
1009
-     * @return void
1010
-     * @throws EE_Error
1011
-     * @throws InvalidArgumentException
1012
-     * @throws InvalidDataTypeException
1013
-     * @throws InvalidInterfaceException
1014
-     */
1015
-    protected function _delete_checkin_rows()
1016
-    {
1017
-        $query_args = array(
1018
-            'action'  => 'registration_checkins',
1019
-            'DTT_ID'  => isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : 0,
1020
-            '_REG_ID' => isset($this->_req_data['_REG_ID']) ? $this->_req_data['_REG_ID'] : 0,
1021
-        );
1022
-        $errors = 0;
1023
-        if (! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
1024
-            while (list($CHK_ID, $value) = each($this->_req_data['checkbox'])) {
1025
-                if (! EEM_Checkin::instance()->delete_by_ID($CHK_ID)) {
1026
-                    $errors++;
1027
-                }
1028
-            }
1029
-        } else {
1030
-            EE_Error::add_error(
1031
-                esc_html__(
1032
-                    'So, something went wrong with the bulk delete because there was no data received for instructions on WHAT to delete!',
1033
-                    'event_espresso'
1034
-                ),
1035
-                __FILE__,
1036
-                __FUNCTION__,
1037
-                __LINE__
1038
-            );
1039
-            $this->_redirect_after_action(false, '', '', $query_args, true);
1040
-        }
1041
-        if ($errors > 0) {
1042
-            EE_Error::add_error(
1043
-                sprintf(__('There were %d records that did not delete successfully', 'event_espresso'), $errors),
1044
-                __FILE__,
1045
-                __FUNCTION__,
1046
-                __LINE__
1047
-            );
1048
-        } else {
1049
-            EE_Error::add_success(__('Records were successfully deleted', 'event_espresso'));
1050
-        }
1051
-        $this->_redirect_after_action(false, '', '', $query_args, true);
1052
-    }
1005
+	/**
1006
+	 * Takes care of deleting multiple EE_Checkin table rows
1007
+	 *
1008
+	 * @access protected
1009
+	 * @return void
1010
+	 * @throws EE_Error
1011
+	 * @throws InvalidArgumentException
1012
+	 * @throws InvalidDataTypeException
1013
+	 * @throws InvalidInterfaceException
1014
+	 */
1015
+	protected function _delete_checkin_rows()
1016
+	{
1017
+		$query_args = array(
1018
+			'action'  => 'registration_checkins',
1019
+			'DTT_ID'  => isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : 0,
1020
+			'_REG_ID' => isset($this->_req_data['_REG_ID']) ? $this->_req_data['_REG_ID'] : 0,
1021
+		);
1022
+		$errors = 0;
1023
+		if (! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
1024
+			while (list($CHK_ID, $value) = each($this->_req_data['checkbox'])) {
1025
+				if (! EEM_Checkin::instance()->delete_by_ID($CHK_ID)) {
1026
+					$errors++;
1027
+				}
1028
+			}
1029
+		} else {
1030
+			EE_Error::add_error(
1031
+				esc_html__(
1032
+					'So, something went wrong with the bulk delete because there was no data received for instructions on WHAT to delete!',
1033
+					'event_espresso'
1034
+				),
1035
+				__FILE__,
1036
+				__FUNCTION__,
1037
+				__LINE__
1038
+			);
1039
+			$this->_redirect_after_action(false, '', '', $query_args, true);
1040
+		}
1041
+		if ($errors > 0) {
1042
+			EE_Error::add_error(
1043
+				sprintf(__('There were %d records that did not delete successfully', 'event_espresso'), $errors),
1044
+				__FILE__,
1045
+				__FUNCTION__,
1046
+				__LINE__
1047
+			);
1048
+		} else {
1049
+			EE_Error::add_success(__('Records were successfully deleted', 'event_espresso'));
1050
+		}
1051
+		$this->_redirect_after_action(false, '', '', $query_args, true);
1052
+	}
1053 1053
 
1054 1054
 
1055
-    /**
1056
-     * Deletes a single EE_Checkin row
1057
-     *
1058
-     * @return void
1059
-     * @throws EE_Error
1060
-     * @throws InvalidArgumentException
1061
-     * @throws InvalidDataTypeException
1062
-     * @throws InvalidInterfaceException
1063
-     */
1064
-    protected function _delete_checkin_row()
1065
-    {
1066
-        $query_args = array(
1067
-            'action'  => 'registration_checkins',
1068
-            'DTT_ID'  => isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : 0,
1069
-            '_REG_ID' => isset($this->_req_data['_REG_ID']) ? $this->_req_data['_REG_ID'] : 0,
1070
-        );
1071
-        if (! empty($this->_req_data['CHK_ID'])) {
1072
-            if (! EEM_Checkin::instance()->delete_by_ID($this->_req_data['CHK_ID'])) {
1073
-                EE_Error::add_error(
1074
-                    esc_html__('Something went wrong and this check-in record was not deleted', 'event_espresso'),
1075
-                    __FILE__,
1076
-                    __FUNCTION__,
1077
-                    __LINE__
1078
-                );
1079
-            } else {
1080
-                EE_Error::add_success(__('Check-In record successfully deleted', 'event_espresso'));
1081
-            }
1082
-        } else {
1083
-            EE_Error::add_error(
1084
-                esc_html__(
1085
-                    'In order to delete a Check-in record, there must be a Check-In ID available. There is not. It is not your fault, there is just a gremlin living in the code',
1086
-                    'event_espresso'
1087
-                ),
1088
-                __FILE__,
1089
-                __FUNCTION__,
1090
-                __LINE__
1091
-            );
1092
-        }
1093
-        $this->_redirect_after_action(false, '', '', $query_args, true);
1094
-    }
1055
+	/**
1056
+	 * Deletes a single EE_Checkin row
1057
+	 *
1058
+	 * @return void
1059
+	 * @throws EE_Error
1060
+	 * @throws InvalidArgumentException
1061
+	 * @throws InvalidDataTypeException
1062
+	 * @throws InvalidInterfaceException
1063
+	 */
1064
+	protected function _delete_checkin_row()
1065
+	{
1066
+		$query_args = array(
1067
+			'action'  => 'registration_checkins',
1068
+			'DTT_ID'  => isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : 0,
1069
+			'_REG_ID' => isset($this->_req_data['_REG_ID']) ? $this->_req_data['_REG_ID'] : 0,
1070
+		);
1071
+		if (! empty($this->_req_data['CHK_ID'])) {
1072
+			if (! EEM_Checkin::instance()->delete_by_ID($this->_req_data['CHK_ID'])) {
1073
+				EE_Error::add_error(
1074
+					esc_html__('Something went wrong and this check-in record was not deleted', 'event_espresso'),
1075
+					__FILE__,
1076
+					__FUNCTION__,
1077
+					__LINE__
1078
+				);
1079
+			} else {
1080
+				EE_Error::add_success(__('Check-In record successfully deleted', 'event_espresso'));
1081
+			}
1082
+		} else {
1083
+			EE_Error::add_error(
1084
+				esc_html__(
1085
+					'In order to delete a Check-in record, there must be a Check-In ID available. There is not. It is not your fault, there is just a gremlin living in the code',
1086
+					'event_espresso'
1087
+				),
1088
+				__FILE__,
1089
+				__FUNCTION__,
1090
+				__LINE__
1091
+			);
1092
+		}
1093
+		$this->_redirect_after_action(false, '', '', $query_args, true);
1094
+	}
1095 1095
 
1096 1096
 
1097
-    /**
1098
-     *        generates HTML for the Event Registrations List Table
1099
-     *
1100
-     * @access protected
1101
-     * @return void
1102
-     * @throws EE_Error
1103
-     * @throws InvalidArgumentException
1104
-     * @throws InvalidDataTypeException
1105
-     * @throws InvalidInterfaceException
1106
-     */
1107
-    protected function _event_registrations_list_table()
1108
-    {
1109
-        do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1110
-        $this->_admin_page_title .= isset($this->_req_data['event_id'])
1111
-            ? $this->get_action_link_or_button(
1112
-                'new_registration',
1113
-                'add-registrant',
1114
-                array('event_id' => $this->_req_data['event_id']),
1115
-                'add-new-h2',
1116
-                '',
1117
-                false
1118
-            )
1119
-            : '';
1120
-        $checked_in = new CheckinStatusDashicon(EE_Checkin::status_checked_in);
1121
-        $checked_out = new CheckinStatusDashicon(EE_Checkin::status_checked_out);
1122
-        $checked_never = new CheckinStatusDashicon(EE_Checkin::status_checked_never);
1123
-        $legend_items = array(
1124
-            'star-icon'        => array(
1125
-                'class' => 'dashicons dashicons-star-filled yellow-icon ee-icon-size-8',
1126
-                'desc'  => esc_html__('This Registrant is the Primary Registrant', 'event_espresso'),
1127
-            ),
1128
-            'checkin'          => array(
1129
-                'class' => $checked_in->cssClasses(),
1130
-                'desc'  => $checked_in->legendLabel(),
1131
-            ),
1132
-            'checkout'         => array(
1133
-                'class' => $checked_out->cssClasses(),
1134
-                'desc'  => $checked_out->legendLabel(),
1135
-            ),
1136
-            'nocheckinrecord'  => array(
1137
-                'class' => $checked_never->cssClasses(),
1138
-                'desc'  => $checked_never->legendLabel(),
1139
-            ),
1140
-            'approved_status'  => array(
1141
-                'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_approved,
1142
-                'desc'  => EEH_Template::pretty_status(EEM_Registration::status_id_approved, false, 'sentence'),
1143
-            ),
1144
-            'cancelled_status' => array(
1145
-                'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_cancelled,
1146
-                'desc'  => EEH_Template::pretty_status(EEM_Registration::status_id_cancelled, false, 'sentence'),
1147
-            ),
1148
-            'declined_status'  => array(
1149
-                'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_declined,
1150
-                'desc'  => EEH_Template::pretty_status(EEM_Registration::status_id_declined, false, 'sentence'),
1151
-            ),
1152
-            'not_approved'     => array(
1153
-                'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_not_approved,
1154
-                'desc'  => EEH_Template::pretty_status(EEM_Registration::status_id_not_approved, false, 'sentence'),
1155
-            ),
1156
-            'pending_status'   => array(
1157
-                'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_pending_payment,
1158
-                'desc'  => EEH_Template::pretty_status(EEM_Registration::status_id_pending_payment, false, 'sentence'),
1159
-            ),
1160
-            'wait_list'        => array(
1161
-                'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_wait_list,
1162
-                'desc'  => EEH_Template::pretty_status(EEM_Registration::status_id_wait_list, false, 'sentence'),
1163
-            ),
1164
-        );
1165
-        $this->_template_args['after_list_table'] = $this->_display_legend($legend_items);
1166
-        $event_id = isset($this->_req_data['event_id']) ? $this->_req_data['event_id'] : null;
1167
-        /** @var EE_Event $event */
1168
-        $event = EEM_Event::instance()->get_one_by_ID($event_id);
1169
-        $this->_template_args['before_list_table'] = $event instanceof EE_Event
1170
-            ? '<h2>' . sprintf(
1171
-                esc_html__('Viewing Registrations for Event: %s', 'event_espresso'),
1172
-                EEM_Event::instance()->get_one_by_ID($event_id)->get('EVT_name')
1173
-            ) . '</h2>'
1174
-            : '';
1175
-        // need to get the number of datetimes on the event and set default datetime_id if there is only one datetime on
1176
-        // the event.
1177
-        $DTT_ID = ! empty($this->_req_data['DTT_ID']) ? absint($this->_req_data['DTT_ID']) : 0;
1178
-        $datetime = null;
1179
-        if ($event instanceof EE_Event) {
1180
-            $datetimes_on_event = $event->datetimes();
1181
-            if (count($datetimes_on_event) === 1) {
1182
-                $datetime = reset($datetimes_on_event);
1183
-            }
1184
-        }
1185
-        $datetime = $datetime instanceof EE_Datetime ? $datetime : EEM_Datetime::instance()->get_one_by_ID($DTT_ID);
1186
-        if ($datetime instanceof EE_Datetime && $this->_template_args['before_list_table'] !== '') {
1187
-            $this->_template_args['before_list_table'] = substr($this->_template_args['before_list_table'], 0, -5);
1188
-            $this->_template_args['before_list_table'] .= ' &nbsp;<span class="drk-grey-text">';
1189
-            $this->_template_args['before_list_table'] .= '<span class="dashicons dashicons-calendar"></span>';
1190
-            $this->_template_args['before_list_table'] .= $datetime->name();
1191
-            $this->_template_args['before_list_table'] .= ' ( ' . $datetime->date_and_time_range() . ' )';
1192
-            $this->_template_args['before_list_table'] .= '</span></h2>';
1193
-        }
1194
-        // if no datetime, then we're on the initial view, so let's give some helpful instructions on what the status
1195
-        // column represents
1196
-        if (! $datetime instanceof EE_Datetime) {
1197
-            $this->_template_args['before_list_table'] .= '<br><p class="description">'
1198
-                                                          . esc_html__(
1199
-                                                              'In this view, the check-in status represents the latest check-in record for the registration in that row.',
1200
-                                                              'event_espresso'
1201
-                                                          )
1202
-                                                          . '</p>';
1203
-        }
1204
-        $this->display_admin_list_table_page_with_no_sidebar();
1205
-    }
1097
+	/**
1098
+	 *        generates HTML for the Event Registrations List Table
1099
+	 *
1100
+	 * @access protected
1101
+	 * @return void
1102
+	 * @throws EE_Error
1103
+	 * @throws InvalidArgumentException
1104
+	 * @throws InvalidDataTypeException
1105
+	 * @throws InvalidInterfaceException
1106
+	 */
1107
+	protected function _event_registrations_list_table()
1108
+	{
1109
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1110
+		$this->_admin_page_title .= isset($this->_req_data['event_id'])
1111
+			? $this->get_action_link_or_button(
1112
+				'new_registration',
1113
+				'add-registrant',
1114
+				array('event_id' => $this->_req_data['event_id']),
1115
+				'add-new-h2',
1116
+				'',
1117
+				false
1118
+			)
1119
+			: '';
1120
+		$checked_in = new CheckinStatusDashicon(EE_Checkin::status_checked_in);
1121
+		$checked_out = new CheckinStatusDashicon(EE_Checkin::status_checked_out);
1122
+		$checked_never = new CheckinStatusDashicon(EE_Checkin::status_checked_never);
1123
+		$legend_items = array(
1124
+			'star-icon'        => array(
1125
+				'class' => 'dashicons dashicons-star-filled yellow-icon ee-icon-size-8',
1126
+				'desc'  => esc_html__('This Registrant is the Primary Registrant', 'event_espresso'),
1127
+			),
1128
+			'checkin'          => array(
1129
+				'class' => $checked_in->cssClasses(),
1130
+				'desc'  => $checked_in->legendLabel(),
1131
+			),
1132
+			'checkout'         => array(
1133
+				'class' => $checked_out->cssClasses(),
1134
+				'desc'  => $checked_out->legendLabel(),
1135
+			),
1136
+			'nocheckinrecord'  => array(
1137
+				'class' => $checked_never->cssClasses(),
1138
+				'desc'  => $checked_never->legendLabel(),
1139
+			),
1140
+			'approved_status'  => array(
1141
+				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_approved,
1142
+				'desc'  => EEH_Template::pretty_status(EEM_Registration::status_id_approved, false, 'sentence'),
1143
+			),
1144
+			'cancelled_status' => array(
1145
+				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_cancelled,
1146
+				'desc'  => EEH_Template::pretty_status(EEM_Registration::status_id_cancelled, false, 'sentence'),
1147
+			),
1148
+			'declined_status'  => array(
1149
+				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_declined,
1150
+				'desc'  => EEH_Template::pretty_status(EEM_Registration::status_id_declined, false, 'sentence'),
1151
+			),
1152
+			'not_approved'     => array(
1153
+				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_not_approved,
1154
+				'desc'  => EEH_Template::pretty_status(EEM_Registration::status_id_not_approved, false, 'sentence'),
1155
+			),
1156
+			'pending_status'   => array(
1157
+				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_pending_payment,
1158
+				'desc'  => EEH_Template::pretty_status(EEM_Registration::status_id_pending_payment, false, 'sentence'),
1159
+			),
1160
+			'wait_list'        => array(
1161
+				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_wait_list,
1162
+				'desc'  => EEH_Template::pretty_status(EEM_Registration::status_id_wait_list, false, 'sentence'),
1163
+			),
1164
+		);
1165
+		$this->_template_args['after_list_table'] = $this->_display_legend($legend_items);
1166
+		$event_id = isset($this->_req_data['event_id']) ? $this->_req_data['event_id'] : null;
1167
+		/** @var EE_Event $event */
1168
+		$event = EEM_Event::instance()->get_one_by_ID($event_id);
1169
+		$this->_template_args['before_list_table'] = $event instanceof EE_Event
1170
+			? '<h2>' . sprintf(
1171
+				esc_html__('Viewing Registrations for Event: %s', 'event_espresso'),
1172
+				EEM_Event::instance()->get_one_by_ID($event_id)->get('EVT_name')
1173
+			) . '</h2>'
1174
+			: '';
1175
+		// need to get the number of datetimes on the event and set default datetime_id if there is only one datetime on
1176
+		// the event.
1177
+		$DTT_ID = ! empty($this->_req_data['DTT_ID']) ? absint($this->_req_data['DTT_ID']) : 0;
1178
+		$datetime = null;
1179
+		if ($event instanceof EE_Event) {
1180
+			$datetimes_on_event = $event->datetimes();
1181
+			if (count($datetimes_on_event) === 1) {
1182
+				$datetime = reset($datetimes_on_event);
1183
+			}
1184
+		}
1185
+		$datetime = $datetime instanceof EE_Datetime ? $datetime : EEM_Datetime::instance()->get_one_by_ID($DTT_ID);
1186
+		if ($datetime instanceof EE_Datetime && $this->_template_args['before_list_table'] !== '') {
1187
+			$this->_template_args['before_list_table'] = substr($this->_template_args['before_list_table'], 0, -5);
1188
+			$this->_template_args['before_list_table'] .= ' &nbsp;<span class="drk-grey-text">';
1189
+			$this->_template_args['before_list_table'] .= '<span class="dashicons dashicons-calendar"></span>';
1190
+			$this->_template_args['before_list_table'] .= $datetime->name();
1191
+			$this->_template_args['before_list_table'] .= ' ( ' . $datetime->date_and_time_range() . ' )';
1192
+			$this->_template_args['before_list_table'] .= '</span></h2>';
1193
+		}
1194
+		// if no datetime, then we're on the initial view, so let's give some helpful instructions on what the status
1195
+		// column represents
1196
+		if (! $datetime instanceof EE_Datetime) {
1197
+			$this->_template_args['before_list_table'] .= '<br><p class="description">'
1198
+														  . esc_html__(
1199
+															  'In this view, the check-in status represents the latest check-in record for the registration in that row.',
1200
+															  'event_espresso'
1201
+														  )
1202
+														  . '</p>';
1203
+		}
1204
+		$this->display_admin_list_table_page_with_no_sidebar();
1205
+	}
1206 1206
 
1207
-    /**
1208
-     * Download the registrations check-in report (same as the normal registration report, but with different where
1209
-     * conditions)
1210
-     *
1211
-     * @return void ends the request by a redirect or download
1212
-     */
1213
-    public function _registrations_checkin_report()
1214
-    {
1215
-        $this->_registrations_report_base('_get_checkin_query_params_from_request');
1216
-    }
1207
+	/**
1208
+	 * Download the registrations check-in report (same as the normal registration report, but with different where
1209
+	 * conditions)
1210
+	 *
1211
+	 * @return void ends the request by a redirect or download
1212
+	 */
1213
+	public function _registrations_checkin_report()
1214
+	{
1215
+		$this->_registrations_report_base('_get_checkin_query_params_from_request');
1216
+	}
1217 1217
 
1218
-    /**
1219
-     * Gets the query params from the request, plus adds a where condition for the registration status,
1220
-     * because on the checkin page we only ever want to see approved and pending-approval registrations
1221
-     *
1222
-     * @param array $request
1223
-     * @param int   $per_page
1224
-     * @param bool  $count
1225
-     * @return array
1226
-     * @throws EE_Error
1227
-     */
1228
-    protected function _get_checkin_query_params_from_request(
1229
-        $request,
1230
-        $per_page = 10,
1231
-        $count = false
1232
-    ) {
1233
-        $query_params = $this->_get_registration_query_parameters($request, $per_page, $count);
1234
-        // unlike the regular registrations list table,
1235
-        $status_ids_array = apply_filters(
1236
-            'FHEE__Extend_Registrations_Admin_Page__get_event_attendees__status_ids_array',
1237
-            array(EEM_Registration::status_id_pending_payment, EEM_Registration::status_id_approved)
1238
-        );
1239
-        $query_params[0]['STS_ID'] = array('IN', $status_ids_array);
1240
-        return $query_params;
1241
-    }
1218
+	/**
1219
+	 * Gets the query params from the request, plus adds a where condition for the registration status,
1220
+	 * because on the checkin page we only ever want to see approved and pending-approval registrations
1221
+	 *
1222
+	 * @param array $request
1223
+	 * @param int   $per_page
1224
+	 * @param bool  $count
1225
+	 * @return array
1226
+	 * @throws EE_Error
1227
+	 */
1228
+	protected function _get_checkin_query_params_from_request(
1229
+		$request,
1230
+		$per_page = 10,
1231
+		$count = false
1232
+	) {
1233
+		$query_params = $this->_get_registration_query_parameters($request, $per_page, $count);
1234
+		// unlike the regular registrations list table,
1235
+		$status_ids_array = apply_filters(
1236
+			'FHEE__Extend_Registrations_Admin_Page__get_event_attendees__status_ids_array',
1237
+			array(EEM_Registration::status_id_pending_payment, EEM_Registration::status_id_approved)
1238
+		);
1239
+		$query_params[0]['STS_ID'] = array('IN', $status_ids_array);
1240
+		return $query_params;
1241
+	}
1242 1242
 
1243 1243
 
1244
-    /**
1245
-     * Gets registrations for an event
1246
-     *
1247
-     * @param int    $per_page
1248
-     * @param bool   $count whether to return count or data.
1249
-     * @param bool   $trash
1250
-     * @param string $orderby
1251
-     * @return EE_Registration[]|int
1252
-     * @throws EE_Error
1253
-     * @throws InvalidArgumentException
1254
-     * @throws InvalidDataTypeException
1255
-     * @throws InvalidInterfaceException
1256
-     */
1257
-    public function get_event_attendees($per_page = 10, $count = false, $trash = false, $orderby = 'ATT_fname')
1258
-    {
1259
-        // normalize some request params that get setup by the parent `get_registrations` method.
1260
-        $request = $this->_req_data;
1261
-        $request['orderby'] = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : $orderby;
1262
-        $request['order'] = ! empty($this->_req_data['order']) ? $this->_req_data['order'] : 'ASC';
1263
-        if ($trash) {
1264
-            $request['status'] = 'trash';
1265
-        }
1266
-        $query_params = $this->_get_checkin_query_params_from_request($request, $per_page, $count);
1267
-        /**
1268
-         * Override the default groupby added by EEM_Base so that sorts with multiple order bys work as expected
1269
-         *
1270
-         * @link https://events.codebasehq.com/projects/event-espresso/tickets/10093
1271
-         * @see https://github.com/eventespresso/event-espresso-core/tree/master/docs/G--Model-System/model-query-params.md
1272
-         *                             or if you have the development copy of EE you can view this at the path:
1273
-         *                             /docs/G--Model-System/model-query-params.md
1274
-         */
1275
-        $query_params['group_by'] = '';
1244
+	/**
1245
+	 * Gets registrations for an event
1246
+	 *
1247
+	 * @param int    $per_page
1248
+	 * @param bool   $count whether to return count or data.
1249
+	 * @param bool   $trash
1250
+	 * @param string $orderby
1251
+	 * @return EE_Registration[]|int
1252
+	 * @throws EE_Error
1253
+	 * @throws InvalidArgumentException
1254
+	 * @throws InvalidDataTypeException
1255
+	 * @throws InvalidInterfaceException
1256
+	 */
1257
+	public function get_event_attendees($per_page = 10, $count = false, $trash = false, $orderby = 'ATT_fname')
1258
+	{
1259
+		// normalize some request params that get setup by the parent `get_registrations` method.
1260
+		$request = $this->_req_data;
1261
+		$request['orderby'] = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : $orderby;
1262
+		$request['order'] = ! empty($this->_req_data['order']) ? $this->_req_data['order'] : 'ASC';
1263
+		if ($trash) {
1264
+			$request['status'] = 'trash';
1265
+		}
1266
+		$query_params = $this->_get_checkin_query_params_from_request($request, $per_page, $count);
1267
+		/**
1268
+		 * Override the default groupby added by EEM_Base so that sorts with multiple order bys work as expected
1269
+		 *
1270
+		 * @link https://events.codebasehq.com/projects/event-espresso/tickets/10093
1271
+		 * @see https://github.com/eventespresso/event-espresso-core/tree/master/docs/G--Model-System/model-query-params.md
1272
+		 *                             or if you have the development copy of EE you can view this at the path:
1273
+		 *                             /docs/G--Model-System/model-query-params.md
1274
+		 */
1275
+		$query_params['group_by'] = '';
1276 1276
 
1277
-        return $count
1278
-            ? EEM_Registration::instance()->count($query_params)
1279
-            /** @type EE_Registration[] */
1280
-            : EEM_Registration::instance()->get_all($query_params);
1281
-    }
1277
+		return $count
1278
+			? EEM_Registration::instance()->count($query_params)
1279
+			/** @type EE_Registration[] */
1280
+			: EEM_Registration::instance()->get_all($query_params);
1281
+	}
1282 1282
 }
Please login to merge, or discard this patch.
core/admin/EE_Admin_Page_Init.core.php 2 patches
Indentation   +440 added lines, -440 removed lines patch added patch discarded remove patch
@@ -17,444 +17,444 @@
 block discarded – undo
17 17
 abstract class EE_Admin_Page_Init extends EE_Base
18 18
 {
19 19
 
20
-    /**
21
-     * @var LoaderInterface $loader
22
-     */
23
-    protected $loader;
24
-
25
-    // identity properties (set in _set_defaults and _set_init_properties)
26
-    public $label;
27
-
28
-    /**
29
-     * Menu map has a capability.  However, this allows admin pages to have separate capability requirements for menus
30
-     * and accessing pages.  If capability is NOT set, then it defaults to the menu_map capability.
31
-     *
32
-     * @var string
33
-     */
34
-    public $capability;
35
-
36
-
37
-    /**
38
-     * This holds the menu map object for this admin page.
39
-     *
40
-     * @var EE_Admin_Page_Menu_Map
41
-     */
42
-    protected $_menu_map;
43
-
44
-    /**
45
-     * deprecated
46
-     */
47
-    public $menu_label;
48
-    public $menu_slug;
49
-
50
-
51
-    // set in _set_defaults
52
-    protected $_folder_name;
53
-    protected $_folder_path;
54
-    protected $_file_name;
55
-    public $hook_file;
56
-    protected $_wp_page_slug;
57
-    protected $_routing;
58
-
59
-
60
-    /**
61
-     * This holds the page object.
62
-     *
63
-     * @var EE_Admin_Page
64
-     */
65
-    protected $_loaded_page_object;
66
-
67
-
68
-    // for caf
69
-    protected $_files_hooked;
70
-    protected $_hook_paths;
71
-
72
-    // load_page?
73
-    private $_load_page;
74
-
75
-
76
-    /**
77
-     * @throws InvalidArgumentException
78
-     * @throws InvalidDataTypeException
79
-     * @throws InvalidInterfaceException
80
-     */
81
-    public function __construct()
82
-    {
83
-        $this->loader = LoaderFactory::getLoader();
84
-        // set global defaults
85
-        $this->_set_defaults();
86
-        // set properties that are always available with objects.
87
-        $this->_set_init_properties();
88
-        // global styles/scripts across all wp admin pages
89
-        add_action('admin_enqueue_scripts', array($this, 'load_wp_global_scripts_styles'), 5);
90
-        // load initial stuff.
91
-        $this->_set_file_and_folder_name();
92
-        $this->_set_menu_map();
93
-        if (empty($this->_menu_map) || is_array($this->_menu_map)) {
94
-            EE_Error::doing_it_wrong(
95
-                get_class($this) . '::$_menu_map',
96
-                sprintf(
97
-                    __(
98
-                        'The EE4 addon with the class %s is setting up the _menu_map property incorrectly for this version of EE core.  Please see Admin_Page_Init class examples in core for the new way of setting this property up.',
99
-                        'event_espresso'
100
-                    ),
101
-                    get_class($this)
102
-                ),
103
-                '4.4.0'
104
-            );
105
-            return;
106
-        }
107
-        // set default capability
108
-        $this->_set_capability();
109
-    }
110
-
111
-
112
-    /**
113
-     * _set_init_properties
114
-     * Child classes use to set the following properties:
115
-     * $label
116
-     *
117
-     * @abstract
118
-     * @access protected
119
-     * @return void
120
-     */
121
-    abstract protected function _set_init_properties();
122
-
123
-
124
-    /**
125
-     * _set_menu_map is a function that child classes use to set the menu_map property (which should be an instance of
126
-     * EE_Admin_Page_Menu_Map.  Their menu can either be EE_Admin_Page_Main_Menu or EE_Admin_Page_Sub_Menu.
127
-     *
128
-     * @since 4.4.0
129
-     * @ return void.
130
-     */
131
-    protected function _set_menu_map()
132
-    {
133
-        return array();
134
-    }
135
-
136
-
137
-    /**
138
-     * returns the menu map for this admin page
139
-     *
140
-     * @since 4.4.0
141
-     * @return EE_Admin_Page_Menu_Map
142
-     */
143
-    public function get_menu_map()
144
-    {
145
-        return $this->_menu_map;
146
-    }
147
-
148
-
149
-    /**
150
-     * This loads scripts and styles for the EE_Admin system
151
-     * that must be available on ALL WP admin pages (i.e. EE_menu items)
152
-     *
153
-     * @return void
154
-     */
155
-    public function load_wp_global_scripts_styles()
156
-    {
157
-    }
158
-
159
-
160
-    /**
161
-     * this sets default properties (might be overridden in _set_init_properties);
162
-     *
163
-     * @access private
164
-     * @return  void
165
-     */
166
-    private function _set_defaults()
167
-    {
168
-        $this->_file_name = $this->_folder_name = $this->_wp_page_slug = $this->capability = null;
169
-        $this->_routing = true;
170
-        $this->_load_page = false;
171
-        $this->_files_hooked = $this->_hook_paths = array();
172
-        // menu_map
173
-        $this->_menu_map = $this->get_menu_map();
174
-    }
175
-
176
-
177
-    protected function _set_capability()
178
-    {
179
-        $capability = empty($this->capability) ? $this->_menu_map->capability : $this->capability;
180
-        $this->capability = apply_filters('FHEE_' . $this->_menu_map->menu_slug . '_capability', $capability);
181
-    }
182
-
183
-
184
-    /**
185
-     * initialize_admin_page
186
-     * This method is what executes the loading of the specific page class for the given dir_name as called by the
187
-     * EE_Admin_Init class.
188
-     *
189
-     * @access  public
190
-     * @return void
191
-     * @throws EE_Error
192
-     * @throws InvalidArgumentException
193
-     * @throws InvalidDataTypeException
194
-     * @throws InvalidInterfaceException
195
-     * @throws ReflectionException
196
-     * @uses    _initialize_admin_page()
197
-     */
198
-    public function initialize_admin_page()
199
-    {
200
-        // let's check user access first
201
-        $this->_check_user_access();
202
-        if (! is_object($this->_loaded_page_object)) {
203
-            return;
204
-        }
205
-        $this->_loaded_page_object->route_admin_request();
206
-    }
207
-
208
-
209
-    /**
210
-     * @param string $wp_page_slug
211
-     * @throws EE_Error
212
-     * @since $VID:$
213
-     */
214
-    public function set_page_dependencies($wp_page_slug)
215
-    {
216
-        if (! $this->_load_page) {
217
-            return;
218
-        }
219
-        if (! is_object($this->_loaded_page_object)) {
220
-            $msg[] = __(
221
-                'We can\'t load the page because we\'re missing a valid page object that tells us what to load',
222
-                'event_espresso'
223
-            );
224
-            $msg[] = $msg[0] . "\r\n"
225
-                     . sprintf(
226
-                         __(
227
-                             'The custom slug you have set for this page is %s. This means we\'re looking for the class %s_Admin_Page (found in %s_Admin_Page.core.php) within your %s directory',
228
-                             'event_espresso'
229
-                         ),
230
-                         $this->_file_name,
231
-                         $this->_file_name,
232
-                         $this->_folder_path . $this->_file_name,
233
-                         $this->_menu_map->menu_slug
234
-                     );
235
-            throw new EE_Error(implode('||', $msg));
236
-        }
237
-        $this->_loaded_page_object->set_wp_page_slug($wp_page_slug);
238
-        $page_hook = 'load-' . $wp_page_slug;
239
-        // hook into page load hook so all page specific stuff get's loaded.
240
-        if (! empty($wp_page_slug)) {
241
-            add_action($page_hook, array($this->_loaded_page_object, 'load_page_dependencies'));
242
-        }
243
-    }
244
-
245
-
246
-    /**
247
-     * This executes the initial page loads for EE_Admin pages to take care of any ajax or other code needing to run
248
-     * before the load-page... hook. Note, the page loads are happening around the wp_init hook.
249
-     *
250
-     * @return void
251
-     * @throws EE_Error
252
-     * @throws InvalidArgumentException
253
-     * @throws InvalidDataTypeException
254
-     * @throws InvalidInterfaceException
255
-     * @throws ReflectionException
256
-     */
257
-    public function do_initial_loads()
258
-    {
259
-        // no loading or initializing if menu map is setup incorrectly.
260
-        if (empty($this->_menu_map) || is_array($this->_menu_map)) {
261
-            return;
262
-        }
263
-        $this->_initialize_admin_page();
264
-    }
265
-
266
-
267
-    /**
268
-     * all we're doing here is setting the $_file_name property for later use.
269
-     *
270
-     * @access private
271
-     * @return void
272
-     */
273
-    private function _set_file_and_folder_name()
274
-    {
275
-        $bt = debug_backtrace();
276
-        // for more reliable determination of folder name
277
-        // we're using this to get the actual folder name of the CALLING class (i.e. the child class that extends this).  Why?  Because $this->menu_slug may be different than the folder name (to avoid conflicts with other plugins)
278
-        $class = get_class($this);
279
-        foreach ($bt as $index => $values) {
280
-            if (isset($values['class']) && $values['class'] === $class) {
281
-                $file_index = $index - 1;
282
-                $this->_folder_name = basename(dirname($bt[ $file_index ]['file']));
283
-                if (! empty($this->_folder_name)) {
284
-                    break;
285
-                }
286
-            }
287
-        }
288
-        $this->_folder_path = EE_ADMIN_PAGES . $this->_folder_name . '/';
289
-        $this->_file_name = preg_replace('/^ee/', 'EE', $this->_folder_name);
290
-        $this->_file_name = ucwords(str_replace('_', ' ', $this->_file_name));
291
-        $this->_file_name = str_replace(' ', '_', $this->_file_name);
292
-    }
293
-
294
-
295
-    /**
296
-     * This automatically checks if we have a hook class in the loaded child directory.  If we DO then we will register
297
-     * it with the appropriate pages.  That way all we have to do is make sure the file is named correctly and
298
-     * "dropped" in. Example: if we wanted to set this up for Messages hooking into Events then we would do:
299
-     * events_Messages_Hooks.class.php
300
-     *
301
-     * @param bool $extend This indicates whether we're checking the extend directory for any register_hooks
302
-     *                     files/classes
303
-     * @return array
304
-     */
305
-    public function register_hooks($extend = false)
306
-    {
307
-
308
-        // get a list of files in the directory that have the "Hook" in their name an
309
-        // if this is an extended check (i.e. caf is active) then we will scan the caffeinated/extend directory first and any hook files that are found will be have their reference added to the $_files_hook array property.  Then, we make sure that when we loop through the core decaf directories to find hook files that we skip over any hooks files that have already been set by caf.
310
-        if ($extend) {
311
-            $hook_files_glob_path = apply_filters(
312
-                'FHEE__EE_Admin_Page_Init__register_hooks__hook_files_glob_path__extend',
313
-                EE_CORE_CAF_ADMIN_EXTEND
314
-                . $this->_folder_name
315
-                . '/*'
316
-                . $this->_file_name
317
-                . '_Hooks_Extend.class.php'
318
-            );
319
-            $this->_hook_paths = $this->_register_hook_files($hook_files_glob_path, $extend);
320
-        }
321
-        // loop through decaf folders
322
-        $hook_files_glob_path = apply_filters(
323
-            'FHEE__EE_Admin_Page_Init__register_hooks__hook_files_glob_path',
324
-            $this->_folder_path . '*' . $this->_file_name . '_Hooks.class.php'
325
-        );
326
-        $this->_hook_paths = array_merge(
327
-            $this->_register_hook_files($hook_files_glob_path),
328
-            $this->_hook_paths
329
-        );  // making sure any extended hook paths are later in the array than the core hook paths!
330
-        return $this->_hook_paths;
331
-    }
332
-
333
-
334
-    protected function _register_hook_files($hook_files_glob_path, $extend = false)
335
-    {
336
-        $hook_paths = array();
337
-        if ($hook_files = glob($hook_files_glob_path)) {
338
-            if (empty($hook_files)) {
339
-                return array();
340
-            }
341
-            foreach ($hook_files as $file) {
342
-                // lets get the linked admin.
343
-                $hook_file = $extend ? str_replace(EE_CORE_CAF_ADMIN_EXTEND . $this->_folder_name . '/', '', $file)
344
-                    : str_replace($this->_folder_path, '', $file);
345
-                $replace = $extend
346
-                    ? '_' . $this->_file_name . '_Hooks_Extend.class.php'
347
-                    : '_'
348
-                      . $this->_file_name
349
-                      . '_Hooks.class.php';
350
-                $rel_admin = str_replace($replace, '', $hook_file);
351
-                $rel_admin = strtolower($rel_admin);
352
-                $hook_paths[] = $file;
353
-                // make sure we haven't already got a hook setup for this page path
354
-                if (in_array($rel_admin, $this->_files_hooked, true)) {
355
-                    continue;
356
-                }
357
-                $this->hook_file = $hook_file;
358
-                $rel_admin_hook = 'FHEE_do_other_page_hooks_' . $rel_admin;
359
-                add_filter($rel_admin_hook, array($this, 'load_admin_hook'));
360
-                $this->_files_hooked[] = $rel_admin;
361
-            }
362
-        }
363
-        return $hook_paths;
364
-    }
365
-
366
-
367
-    public function load_admin_hook($registered_pages)
368
-    {
369
-        $this->hook_file;
370
-        $hook_file = (array) $this->hook_file;
371
-        return array_merge($hook_file, $registered_pages);
372
-    }
373
-
374
-
375
-    /**
376
-     * _initialize_admin_page
377
-     *
378
-     * @throws EE_Error
379
-     * @throws InvalidArgumentException
380
-     * @throws InvalidDataTypeException
381
-     * @throws InvalidInterfaceException
382
-     * @throws ReflectionException
383
-     * @see  initialize_admin_page() for info
384
-     */
385
-    protected function _initialize_admin_page()
386
-    {
387
-        // just check we're on right page and if not get out
388
-        if ((! isset($_REQUEST['page']) || $_REQUEST['page'] !== $this->_menu_map->menu_slug) && $this->_routing) {
389
-            return;
390
-        }
391
-        $this->_load_page = true;
392
-
393
-        // we don't need to do a page_request check here because it's only called via WP menu system.
394
-        $admin_page = $this->_file_name . '_Admin_Page';
395
-        $hook_suffix = $this->_menu_map->menu_slug . '_' . $admin_page;
396
-        $admin_page = apply_filters(
397
-            "FHEE__EE_Admin_Page_Init___initialize_admin_page__admin_page__{$hook_suffix}",
398
-            $admin_page
399
-        );
400
-        // define requested admin page class name then load the file and instantiate
401
-        $path_to_file = str_replace(array('\\', '/'), '/', $this->_folder_path . $admin_page . '.core.php');
402
-        $path_to_file = apply_filters(
403
-            "FHEE__EE_Admin_Page_Init___initialize_admin_page__path_to_file__{$hook_suffix}",
404
-            $path_to_file
405
-        );// so if the file would be in EE_ADMIN/attendees/Attendee_Admin_Page.core.php, the filter would be FHEE__EE_Admin_Page_Init___initialize_admin_page__path_to_file__attendees_Attendee_Admin_Page
406
-        if (is_readable($path_to_file)) {
407
-            // This is a place where EE plugins can hook in to make sure their own files are required in the appropriate place
408
-            do_action('AHEE__EE_Admin_Page___initialize_admin_page__before_initialization');
409
-            do_action(
410
-                'AHEE__EE_Admin_Page___initialize_admin_page__before_initialization_' . $this->_menu_map->menu_slug
411
-            );
412
-            require_once($path_to_file);
413
-            $this->_loaded_page_object = $this->loader->getShared($admin_page, [$this->_routing]);
414
-            $this->_loaded_page_object->initializePage();
415
-        }
416
-        do_action('AHEE__EE_Admin_Page___initialize_admin_page__after_initialization');
417
-        do_action('AHEE__EE_Admin_Page___initialize_admin_page__after_initialization_' . $this->_menu_map->menu_slug);
418
-    }
419
-
420
-
421
-    public function get_admin_page_name()
422
-    {
423
-        return $this->_file_name . '_Admin_Page';
424
-    }
425
-
426
-
427
-    /**
428
-     * @return mixed
429
-     */
430
-    public function loaded_page_object()
431
-    {
432
-        return $this->_loaded_page_object;
433
-    }
434
-
435
-
436
-    // public function set_autoloaders($className)
437
-    // {
438
-    //     $dir_ref = array(
439
-    //         $this->_folder_path => array('core', 'class'),
440
-    //     );
441
-    //     EEH_Autoloader::try_autoload($dir_ref, $className);
442
-    // }
443
-    /**
444
-     * _check_user_access
445
-     * verifies user access for this admin page.  If no user access is available then let's gracefully exit with a
446
-     * WordPress die message.
447
-     *
448
-     * @return bool true if pass (or admin) wp_die if fail
449
-     */
450
-    private function _check_user_access()
451
-    {
452
-        if (! EE_Registry::instance()->CAP->current_user_can(
453
-            $this->_menu_map->capability,
454
-            $this->_menu_map->menu_slug
455
-        )) {
456
-            wp_die(__('You don\'t have access to this page.', 'event_espresso'), '', array('back_link' => true));
457
-        }
458
-        return true;
459
-    }
20
+	/**
21
+	 * @var LoaderInterface $loader
22
+	 */
23
+	protected $loader;
24
+
25
+	// identity properties (set in _set_defaults and _set_init_properties)
26
+	public $label;
27
+
28
+	/**
29
+	 * Menu map has a capability.  However, this allows admin pages to have separate capability requirements for menus
30
+	 * and accessing pages.  If capability is NOT set, then it defaults to the menu_map capability.
31
+	 *
32
+	 * @var string
33
+	 */
34
+	public $capability;
35
+
36
+
37
+	/**
38
+	 * This holds the menu map object for this admin page.
39
+	 *
40
+	 * @var EE_Admin_Page_Menu_Map
41
+	 */
42
+	protected $_menu_map;
43
+
44
+	/**
45
+	 * deprecated
46
+	 */
47
+	public $menu_label;
48
+	public $menu_slug;
49
+
50
+
51
+	// set in _set_defaults
52
+	protected $_folder_name;
53
+	protected $_folder_path;
54
+	protected $_file_name;
55
+	public $hook_file;
56
+	protected $_wp_page_slug;
57
+	protected $_routing;
58
+
59
+
60
+	/**
61
+	 * This holds the page object.
62
+	 *
63
+	 * @var EE_Admin_Page
64
+	 */
65
+	protected $_loaded_page_object;
66
+
67
+
68
+	// for caf
69
+	protected $_files_hooked;
70
+	protected $_hook_paths;
71
+
72
+	// load_page?
73
+	private $_load_page;
74
+
75
+
76
+	/**
77
+	 * @throws InvalidArgumentException
78
+	 * @throws InvalidDataTypeException
79
+	 * @throws InvalidInterfaceException
80
+	 */
81
+	public function __construct()
82
+	{
83
+		$this->loader = LoaderFactory::getLoader();
84
+		// set global defaults
85
+		$this->_set_defaults();
86
+		// set properties that are always available with objects.
87
+		$this->_set_init_properties();
88
+		// global styles/scripts across all wp admin pages
89
+		add_action('admin_enqueue_scripts', array($this, 'load_wp_global_scripts_styles'), 5);
90
+		// load initial stuff.
91
+		$this->_set_file_and_folder_name();
92
+		$this->_set_menu_map();
93
+		if (empty($this->_menu_map) || is_array($this->_menu_map)) {
94
+			EE_Error::doing_it_wrong(
95
+				get_class($this) . '::$_menu_map',
96
+				sprintf(
97
+					__(
98
+						'The EE4 addon with the class %s is setting up the _menu_map property incorrectly for this version of EE core.  Please see Admin_Page_Init class examples in core for the new way of setting this property up.',
99
+						'event_espresso'
100
+					),
101
+					get_class($this)
102
+				),
103
+				'4.4.0'
104
+			);
105
+			return;
106
+		}
107
+		// set default capability
108
+		$this->_set_capability();
109
+	}
110
+
111
+
112
+	/**
113
+	 * _set_init_properties
114
+	 * Child classes use to set the following properties:
115
+	 * $label
116
+	 *
117
+	 * @abstract
118
+	 * @access protected
119
+	 * @return void
120
+	 */
121
+	abstract protected function _set_init_properties();
122
+
123
+
124
+	/**
125
+	 * _set_menu_map is a function that child classes use to set the menu_map property (which should be an instance of
126
+	 * EE_Admin_Page_Menu_Map.  Their menu can either be EE_Admin_Page_Main_Menu or EE_Admin_Page_Sub_Menu.
127
+	 *
128
+	 * @since 4.4.0
129
+	 * @ return void.
130
+	 */
131
+	protected function _set_menu_map()
132
+	{
133
+		return array();
134
+	}
135
+
136
+
137
+	/**
138
+	 * returns the menu map for this admin page
139
+	 *
140
+	 * @since 4.4.0
141
+	 * @return EE_Admin_Page_Menu_Map
142
+	 */
143
+	public function get_menu_map()
144
+	{
145
+		return $this->_menu_map;
146
+	}
147
+
148
+
149
+	/**
150
+	 * This loads scripts and styles for the EE_Admin system
151
+	 * that must be available on ALL WP admin pages (i.e. EE_menu items)
152
+	 *
153
+	 * @return void
154
+	 */
155
+	public function load_wp_global_scripts_styles()
156
+	{
157
+	}
158
+
159
+
160
+	/**
161
+	 * this sets default properties (might be overridden in _set_init_properties);
162
+	 *
163
+	 * @access private
164
+	 * @return  void
165
+	 */
166
+	private function _set_defaults()
167
+	{
168
+		$this->_file_name = $this->_folder_name = $this->_wp_page_slug = $this->capability = null;
169
+		$this->_routing = true;
170
+		$this->_load_page = false;
171
+		$this->_files_hooked = $this->_hook_paths = array();
172
+		// menu_map
173
+		$this->_menu_map = $this->get_menu_map();
174
+	}
175
+
176
+
177
+	protected function _set_capability()
178
+	{
179
+		$capability = empty($this->capability) ? $this->_menu_map->capability : $this->capability;
180
+		$this->capability = apply_filters('FHEE_' . $this->_menu_map->menu_slug . '_capability', $capability);
181
+	}
182
+
183
+
184
+	/**
185
+	 * initialize_admin_page
186
+	 * This method is what executes the loading of the specific page class for the given dir_name as called by the
187
+	 * EE_Admin_Init class.
188
+	 *
189
+	 * @access  public
190
+	 * @return void
191
+	 * @throws EE_Error
192
+	 * @throws InvalidArgumentException
193
+	 * @throws InvalidDataTypeException
194
+	 * @throws InvalidInterfaceException
195
+	 * @throws ReflectionException
196
+	 * @uses    _initialize_admin_page()
197
+	 */
198
+	public function initialize_admin_page()
199
+	{
200
+		// let's check user access first
201
+		$this->_check_user_access();
202
+		if (! is_object($this->_loaded_page_object)) {
203
+			return;
204
+		}
205
+		$this->_loaded_page_object->route_admin_request();
206
+	}
207
+
208
+
209
+	/**
210
+	 * @param string $wp_page_slug
211
+	 * @throws EE_Error
212
+	 * @since $VID:$
213
+	 */
214
+	public function set_page_dependencies($wp_page_slug)
215
+	{
216
+		if (! $this->_load_page) {
217
+			return;
218
+		}
219
+		if (! is_object($this->_loaded_page_object)) {
220
+			$msg[] = __(
221
+				'We can\'t load the page because we\'re missing a valid page object that tells us what to load',
222
+				'event_espresso'
223
+			);
224
+			$msg[] = $msg[0] . "\r\n"
225
+					 . sprintf(
226
+						 __(
227
+							 'The custom slug you have set for this page is %s. This means we\'re looking for the class %s_Admin_Page (found in %s_Admin_Page.core.php) within your %s directory',
228
+							 'event_espresso'
229
+						 ),
230
+						 $this->_file_name,
231
+						 $this->_file_name,
232
+						 $this->_folder_path . $this->_file_name,
233
+						 $this->_menu_map->menu_slug
234
+					 );
235
+			throw new EE_Error(implode('||', $msg));
236
+		}
237
+		$this->_loaded_page_object->set_wp_page_slug($wp_page_slug);
238
+		$page_hook = 'load-' . $wp_page_slug;
239
+		// hook into page load hook so all page specific stuff get's loaded.
240
+		if (! empty($wp_page_slug)) {
241
+			add_action($page_hook, array($this->_loaded_page_object, 'load_page_dependencies'));
242
+		}
243
+	}
244
+
245
+
246
+	/**
247
+	 * This executes the initial page loads for EE_Admin pages to take care of any ajax or other code needing to run
248
+	 * before the load-page... hook. Note, the page loads are happening around the wp_init hook.
249
+	 *
250
+	 * @return void
251
+	 * @throws EE_Error
252
+	 * @throws InvalidArgumentException
253
+	 * @throws InvalidDataTypeException
254
+	 * @throws InvalidInterfaceException
255
+	 * @throws ReflectionException
256
+	 */
257
+	public function do_initial_loads()
258
+	{
259
+		// no loading or initializing if menu map is setup incorrectly.
260
+		if (empty($this->_menu_map) || is_array($this->_menu_map)) {
261
+			return;
262
+		}
263
+		$this->_initialize_admin_page();
264
+	}
265
+
266
+
267
+	/**
268
+	 * all we're doing here is setting the $_file_name property for later use.
269
+	 *
270
+	 * @access private
271
+	 * @return void
272
+	 */
273
+	private function _set_file_and_folder_name()
274
+	{
275
+		$bt = debug_backtrace();
276
+		// for more reliable determination of folder name
277
+		// we're using this to get the actual folder name of the CALLING class (i.e. the child class that extends this).  Why?  Because $this->menu_slug may be different than the folder name (to avoid conflicts with other plugins)
278
+		$class = get_class($this);
279
+		foreach ($bt as $index => $values) {
280
+			if (isset($values['class']) && $values['class'] === $class) {
281
+				$file_index = $index - 1;
282
+				$this->_folder_name = basename(dirname($bt[ $file_index ]['file']));
283
+				if (! empty($this->_folder_name)) {
284
+					break;
285
+				}
286
+			}
287
+		}
288
+		$this->_folder_path = EE_ADMIN_PAGES . $this->_folder_name . '/';
289
+		$this->_file_name = preg_replace('/^ee/', 'EE', $this->_folder_name);
290
+		$this->_file_name = ucwords(str_replace('_', ' ', $this->_file_name));
291
+		$this->_file_name = str_replace(' ', '_', $this->_file_name);
292
+	}
293
+
294
+
295
+	/**
296
+	 * This automatically checks if we have a hook class in the loaded child directory.  If we DO then we will register
297
+	 * it with the appropriate pages.  That way all we have to do is make sure the file is named correctly and
298
+	 * "dropped" in. Example: if we wanted to set this up for Messages hooking into Events then we would do:
299
+	 * events_Messages_Hooks.class.php
300
+	 *
301
+	 * @param bool $extend This indicates whether we're checking the extend directory for any register_hooks
302
+	 *                     files/classes
303
+	 * @return array
304
+	 */
305
+	public function register_hooks($extend = false)
306
+	{
307
+
308
+		// get a list of files in the directory that have the "Hook" in their name an
309
+		// if this is an extended check (i.e. caf is active) then we will scan the caffeinated/extend directory first and any hook files that are found will be have their reference added to the $_files_hook array property.  Then, we make sure that when we loop through the core decaf directories to find hook files that we skip over any hooks files that have already been set by caf.
310
+		if ($extend) {
311
+			$hook_files_glob_path = apply_filters(
312
+				'FHEE__EE_Admin_Page_Init__register_hooks__hook_files_glob_path__extend',
313
+				EE_CORE_CAF_ADMIN_EXTEND
314
+				. $this->_folder_name
315
+				. '/*'
316
+				. $this->_file_name
317
+				. '_Hooks_Extend.class.php'
318
+			);
319
+			$this->_hook_paths = $this->_register_hook_files($hook_files_glob_path, $extend);
320
+		}
321
+		// loop through decaf folders
322
+		$hook_files_glob_path = apply_filters(
323
+			'FHEE__EE_Admin_Page_Init__register_hooks__hook_files_glob_path',
324
+			$this->_folder_path . '*' . $this->_file_name . '_Hooks.class.php'
325
+		);
326
+		$this->_hook_paths = array_merge(
327
+			$this->_register_hook_files($hook_files_glob_path),
328
+			$this->_hook_paths
329
+		);  // making sure any extended hook paths are later in the array than the core hook paths!
330
+		return $this->_hook_paths;
331
+	}
332
+
333
+
334
+	protected function _register_hook_files($hook_files_glob_path, $extend = false)
335
+	{
336
+		$hook_paths = array();
337
+		if ($hook_files = glob($hook_files_glob_path)) {
338
+			if (empty($hook_files)) {
339
+				return array();
340
+			}
341
+			foreach ($hook_files as $file) {
342
+				// lets get the linked admin.
343
+				$hook_file = $extend ? str_replace(EE_CORE_CAF_ADMIN_EXTEND . $this->_folder_name . '/', '', $file)
344
+					: str_replace($this->_folder_path, '', $file);
345
+				$replace = $extend
346
+					? '_' . $this->_file_name . '_Hooks_Extend.class.php'
347
+					: '_'
348
+					  . $this->_file_name
349
+					  . '_Hooks.class.php';
350
+				$rel_admin = str_replace($replace, '', $hook_file);
351
+				$rel_admin = strtolower($rel_admin);
352
+				$hook_paths[] = $file;
353
+				// make sure we haven't already got a hook setup for this page path
354
+				if (in_array($rel_admin, $this->_files_hooked, true)) {
355
+					continue;
356
+				}
357
+				$this->hook_file = $hook_file;
358
+				$rel_admin_hook = 'FHEE_do_other_page_hooks_' . $rel_admin;
359
+				add_filter($rel_admin_hook, array($this, 'load_admin_hook'));
360
+				$this->_files_hooked[] = $rel_admin;
361
+			}
362
+		}
363
+		return $hook_paths;
364
+	}
365
+
366
+
367
+	public function load_admin_hook($registered_pages)
368
+	{
369
+		$this->hook_file;
370
+		$hook_file = (array) $this->hook_file;
371
+		return array_merge($hook_file, $registered_pages);
372
+	}
373
+
374
+
375
+	/**
376
+	 * _initialize_admin_page
377
+	 *
378
+	 * @throws EE_Error
379
+	 * @throws InvalidArgumentException
380
+	 * @throws InvalidDataTypeException
381
+	 * @throws InvalidInterfaceException
382
+	 * @throws ReflectionException
383
+	 * @see  initialize_admin_page() for info
384
+	 */
385
+	protected function _initialize_admin_page()
386
+	{
387
+		// just check we're on right page and if not get out
388
+		if ((! isset($_REQUEST['page']) || $_REQUEST['page'] !== $this->_menu_map->menu_slug) && $this->_routing) {
389
+			return;
390
+		}
391
+		$this->_load_page = true;
392
+
393
+		// we don't need to do a page_request check here because it's only called via WP menu system.
394
+		$admin_page = $this->_file_name . '_Admin_Page';
395
+		$hook_suffix = $this->_menu_map->menu_slug . '_' . $admin_page;
396
+		$admin_page = apply_filters(
397
+			"FHEE__EE_Admin_Page_Init___initialize_admin_page__admin_page__{$hook_suffix}",
398
+			$admin_page
399
+		);
400
+		// define requested admin page class name then load the file and instantiate
401
+		$path_to_file = str_replace(array('\\', '/'), '/', $this->_folder_path . $admin_page . '.core.php');
402
+		$path_to_file = apply_filters(
403
+			"FHEE__EE_Admin_Page_Init___initialize_admin_page__path_to_file__{$hook_suffix}",
404
+			$path_to_file
405
+		);// so if the file would be in EE_ADMIN/attendees/Attendee_Admin_Page.core.php, the filter would be FHEE__EE_Admin_Page_Init___initialize_admin_page__path_to_file__attendees_Attendee_Admin_Page
406
+		if (is_readable($path_to_file)) {
407
+			// This is a place where EE plugins can hook in to make sure their own files are required in the appropriate place
408
+			do_action('AHEE__EE_Admin_Page___initialize_admin_page__before_initialization');
409
+			do_action(
410
+				'AHEE__EE_Admin_Page___initialize_admin_page__before_initialization_' . $this->_menu_map->menu_slug
411
+			);
412
+			require_once($path_to_file);
413
+			$this->_loaded_page_object = $this->loader->getShared($admin_page, [$this->_routing]);
414
+			$this->_loaded_page_object->initializePage();
415
+		}
416
+		do_action('AHEE__EE_Admin_Page___initialize_admin_page__after_initialization');
417
+		do_action('AHEE__EE_Admin_Page___initialize_admin_page__after_initialization_' . $this->_menu_map->menu_slug);
418
+	}
419
+
420
+
421
+	public function get_admin_page_name()
422
+	{
423
+		return $this->_file_name . '_Admin_Page';
424
+	}
425
+
426
+
427
+	/**
428
+	 * @return mixed
429
+	 */
430
+	public function loaded_page_object()
431
+	{
432
+		return $this->_loaded_page_object;
433
+	}
434
+
435
+
436
+	// public function set_autoloaders($className)
437
+	// {
438
+	//     $dir_ref = array(
439
+	//         $this->_folder_path => array('core', 'class'),
440
+	//     );
441
+	//     EEH_Autoloader::try_autoload($dir_ref, $className);
442
+	// }
443
+	/**
444
+	 * _check_user_access
445
+	 * verifies user access for this admin page.  If no user access is available then let's gracefully exit with a
446
+	 * WordPress die message.
447
+	 *
448
+	 * @return bool true if pass (or admin) wp_die if fail
449
+	 */
450
+	private function _check_user_access()
451
+	{
452
+		if (! EE_Registry::instance()->CAP->current_user_can(
453
+			$this->_menu_map->capability,
454
+			$this->_menu_map->menu_slug
455
+		)) {
456
+			wp_die(__('You don\'t have access to this page.', 'event_espresso'), '', array('back_link' => true));
457
+		}
458
+		return true;
459
+	}
460 460
 }
Please login to merge, or discard this patch.
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
         $this->_set_menu_map();
93 93
         if (empty($this->_menu_map) || is_array($this->_menu_map)) {
94 94
             EE_Error::doing_it_wrong(
95
-                get_class($this) . '::$_menu_map',
95
+                get_class($this).'::$_menu_map',
96 96
                 sprintf(
97 97
                     __(
98 98
                         'The EE4 addon with the class %s is setting up the _menu_map property incorrectly for this version of EE core.  Please see Admin_Page_Init class examples in core for the new way of setting this property up.',
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
     protected function _set_capability()
178 178
     {
179 179
         $capability = empty($this->capability) ? $this->_menu_map->capability : $this->capability;
180
-        $this->capability = apply_filters('FHEE_' . $this->_menu_map->menu_slug . '_capability', $capability);
180
+        $this->capability = apply_filters('FHEE_'.$this->_menu_map->menu_slug.'_capability', $capability);
181 181
     }
182 182
 
183 183
 
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
     {
200 200
         // let's check user access first
201 201
         $this->_check_user_access();
202
-        if (! is_object($this->_loaded_page_object)) {
202
+        if ( ! is_object($this->_loaded_page_object)) {
203 203
             return;
204 204
         }
205 205
         $this->_loaded_page_object->route_admin_request();
@@ -213,15 +213,15 @@  discard block
 block discarded – undo
213 213
      */
214 214
     public function set_page_dependencies($wp_page_slug)
215 215
     {
216
-        if (! $this->_load_page) {
216
+        if ( ! $this->_load_page) {
217 217
             return;
218 218
         }
219
-        if (! is_object($this->_loaded_page_object)) {
219
+        if ( ! is_object($this->_loaded_page_object)) {
220 220
             $msg[] = __(
221 221
                 'We can\'t load the page because we\'re missing a valid page object that tells us what to load',
222 222
                 'event_espresso'
223 223
             );
224
-            $msg[] = $msg[0] . "\r\n"
224
+            $msg[] = $msg[0]."\r\n"
225 225
                      . sprintf(
226 226
                          __(
227 227
                              'The custom slug you have set for this page is %s. This means we\'re looking for the class %s_Admin_Page (found in %s_Admin_Page.core.php) within your %s directory',
@@ -229,15 +229,15 @@  discard block
 block discarded – undo
229 229
                          ),
230 230
                          $this->_file_name,
231 231
                          $this->_file_name,
232
-                         $this->_folder_path . $this->_file_name,
232
+                         $this->_folder_path.$this->_file_name,
233 233
                          $this->_menu_map->menu_slug
234 234
                      );
235 235
             throw new EE_Error(implode('||', $msg));
236 236
         }
237 237
         $this->_loaded_page_object->set_wp_page_slug($wp_page_slug);
238
-        $page_hook = 'load-' . $wp_page_slug;
238
+        $page_hook = 'load-'.$wp_page_slug;
239 239
         // hook into page load hook so all page specific stuff get's loaded.
240
-        if (! empty($wp_page_slug)) {
240
+        if ( ! empty($wp_page_slug)) {
241 241
             add_action($page_hook, array($this->_loaded_page_object, 'load_page_dependencies'));
242 242
         }
243 243
     }
@@ -279,13 +279,13 @@  discard block
 block discarded – undo
279 279
         foreach ($bt as $index => $values) {
280 280
             if (isset($values['class']) && $values['class'] === $class) {
281 281
                 $file_index = $index - 1;
282
-                $this->_folder_name = basename(dirname($bt[ $file_index ]['file']));
283
-                if (! empty($this->_folder_name)) {
282
+                $this->_folder_name = basename(dirname($bt[$file_index]['file']));
283
+                if ( ! empty($this->_folder_name)) {
284 284
                     break;
285 285
                 }
286 286
             }
287 287
         }
288
-        $this->_folder_path = EE_ADMIN_PAGES . $this->_folder_name . '/';
288
+        $this->_folder_path = EE_ADMIN_PAGES.$this->_folder_name.'/';
289 289
         $this->_file_name = preg_replace('/^ee/', 'EE', $this->_folder_name);
290 290
         $this->_file_name = ucwords(str_replace('_', ' ', $this->_file_name));
291 291
         $this->_file_name = str_replace(' ', '_', $this->_file_name);
@@ -321,12 +321,12 @@  discard block
 block discarded – undo
321 321
         // loop through decaf folders
322 322
         $hook_files_glob_path = apply_filters(
323 323
             'FHEE__EE_Admin_Page_Init__register_hooks__hook_files_glob_path',
324
-            $this->_folder_path . '*' . $this->_file_name . '_Hooks.class.php'
324
+            $this->_folder_path.'*'.$this->_file_name.'_Hooks.class.php'
325 325
         );
326 326
         $this->_hook_paths = array_merge(
327 327
             $this->_register_hook_files($hook_files_glob_path),
328 328
             $this->_hook_paths
329
-        );  // making sure any extended hook paths are later in the array than the core hook paths!
329
+        ); // making sure any extended hook paths are later in the array than the core hook paths!
330 330
         return $this->_hook_paths;
331 331
     }
332 332
 
@@ -340,10 +340,10 @@  discard block
 block discarded – undo
340 340
             }
341 341
             foreach ($hook_files as $file) {
342 342
                 // lets get the linked admin.
343
-                $hook_file = $extend ? str_replace(EE_CORE_CAF_ADMIN_EXTEND . $this->_folder_name . '/', '', $file)
343
+                $hook_file = $extend ? str_replace(EE_CORE_CAF_ADMIN_EXTEND.$this->_folder_name.'/', '', $file)
344 344
                     : str_replace($this->_folder_path, '', $file);
345 345
                 $replace = $extend
346
-                    ? '_' . $this->_file_name . '_Hooks_Extend.class.php'
346
+                    ? '_'.$this->_file_name.'_Hooks_Extend.class.php'
347 347
                     : '_'
348 348
                       . $this->_file_name
349 349
                       . '_Hooks.class.php';
@@ -355,7 +355,7 @@  discard block
 block discarded – undo
355 355
                     continue;
356 356
                 }
357 357
                 $this->hook_file = $hook_file;
358
-                $rel_admin_hook = 'FHEE_do_other_page_hooks_' . $rel_admin;
358
+                $rel_admin_hook = 'FHEE_do_other_page_hooks_'.$rel_admin;
359 359
                 add_filter($rel_admin_hook, array($this, 'load_admin_hook'));
360 360
                 $this->_files_hooked[] = $rel_admin;
361 361
             }
@@ -385,42 +385,42 @@  discard block
 block discarded – undo
385 385
     protected function _initialize_admin_page()
386 386
     {
387 387
         // just check we're on right page and if not get out
388
-        if ((! isset($_REQUEST['page']) || $_REQUEST['page'] !== $this->_menu_map->menu_slug) && $this->_routing) {
388
+        if (( ! isset($_REQUEST['page']) || $_REQUEST['page'] !== $this->_menu_map->menu_slug) && $this->_routing) {
389 389
             return;
390 390
         }
391 391
         $this->_load_page = true;
392 392
 
393 393
         // we don't need to do a page_request check here because it's only called via WP menu system.
394
-        $admin_page = $this->_file_name . '_Admin_Page';
395
-        $hook_suffix = $this->_menu_map->menu_slug . '_' . $admin_page;
394
+        $admin_page = $this->_file_name.'_Admin_Page';
395
+        $hook_suffix = $this->_menu_map->menu_slug.'_'.$admin_page;
396 396
         $admin_page = apply_filters(
397 397
             "FHEE__EE_Admin_Page_Init___initialize_admin_page__admin_page__{$hook_suffix}",
398 398
             $admin_page
399 399
         );
400 400
         // define requested admin page class name then load the file and instantiate
401
-        $path_to_file = str_replace(array('\\', '/'), '/', $this->_folder_path . $admin_page . '.core.php');
401
+        $path_to_file = str_replace(array('\\', '/'), '/', $this->_folder_path.$admin_page.'.core.php');
402 402
         $path_to_file = apply_filters(
403 403
             "FHEE__EE_Admin_Page_Init___initialize_admin_page__path_to_file__{$hook_suffix}",
404 404
             $path_to_file
405
-        );// so if the file would be in EE_ADMIN/attendees/Attendee_Admin_Page.core.php, the filter would be FHEE__EE_Admin_Page_Init___initialize_admin_page__path_to_file__attendees_Attendee_Admin_Page
405
+        ); // so if the file would be in EE_ADMIN/attendees/Attendee_Admin_Page.core.php, the filter would be FHEE__EE_Admin_Page_Init___initialize_admin_page__path_to_file__attendees_Attendee_Admin_Page
406 406
         if (is_readable($path_to_file)) {
407 407
             // This is a place where EE plugins can hook in to make sure their own files are required in the appropriate place
408 408
             do_action('AHEE__EE_Admin_Page___initialize_admin_page__before_initialization');
409 409
             do_action(
410
-                'AHEE__EE_Admin_Page___initialize_admin_page__before_initialization_' . $this->_menu_map->menu_slug
410
+                'AHEE__EE_Admin_Page___initialize_admin_page__before_initialization_'.$this->_menu_map->menu_slug
411 411
             );
412 412
             require_once($path_to_file);
413 413
             $this->_loaded_page_object = $this->loader->getShared($admin_page, [$this->_routing]);
414 414
             $this->_loaded_page_object->initializePage();
415 415
         }
416 416
         do_action('AHEE__EE_Admin_Page___initialize_admin_page__after_initialization');
417
-        do_action('AHEE__EE_Admin_Page___initialize_admin_page__after_initialization_' . $this->_menu_map->menu_slug);
417
+        do_action('AHEE__EE_Admin_Page___initialize_admin_page__after_initialization_'.$this->_menu_map->menu_slug);
418 418
     }
419 419
 
420 420
 
421 421
     public function get_admin_page_name()
422 422
     {
423
-        return $this->_file_name . '_Admin_Page';
423
+        return $this->_file_name.'_Admin_Page';
424 424
     }
425 425
 
426 426
 
@@ -449,7 +449,7 @@  discard block
 block discarded – undo
449 449
      */
450 450
     private function _check_user_access()
451 451
     {
452
-        if (! EE_Registry::instance()->CAP->current_user_can(
452
+        if ( ! EE_Registry::instance()->CAP->current_user_can(
453 453
             $this->_menu_map->capability,
454 454
             $this->_menu_map->menu_slug
455 455
         )) {
Please login to merge, or discard this patch.
core/domain/values/assets/Asset.php 1 patch
Indentation   +187 added lines, -187 removed lines patch added patch discarded remove patch
@@ -16,191 +16,191 @@
 block discarded – undo
16 16
 abstract class Asset
17 17
 {
18 18
 
19
-    /**
20
-     * indicates the file extension for a build distribution CSS file
21
-     */
22
-    const FILE_EXTENSION_DISTRIBUTION_CSS = '.dist.css';
23
-
24
-    /**
25
-     * indicates the file extension for a build distribution JS file
26
-     */
27
-    const FILE_EXTENSION_DISTRIBUTION_JS = '.dist.js';
28
-
29
-    /**
30
-     * Indicates the file extension for a build distribution dependencies json file.
31
-     */
32
-    const FILE_EXTENSION_DISTRIBUTION_DEPS = '.dist.deps.php';
33
-
34
-    /**
35
-     * indicates a Cascading Style Sheet asset
36
-     */
37
-    const TYPE_CSS = 'css';
38
-
39
-    /**
40
-     * indicates a Javascript asset
41
-     */
42
-    const TYPE_JS = 'js';
43
-
44
-    /**
45
-     * indicates a JSON asset
46
-     */
47
-    CONST TYPE_JSON = 'json';
48
-    /**
49
-     * indicates a PHP asset
50
-     */
51
-    CONST TYPE_PHP = 'php';
52
-
53
-    /**
54
-     * indicates a Javascript manifest file
55
-     */
56
-    const TYPE_MANIFEST = 'manifest';
57
-
58
-    /**
59
-     * @var DomainInterface $domain
60
-     */
61
-    protected $domain;
62
-
63
-    /**
64
-     * @var string $type
65
-     */
66
-    private $type;
67
-
68
-    /**
69
-     * @var string $handle
70
-     */
71
-    private $handle;
72
-
73
-    /**
74
-     * @var bool $registered
75
-     */
76
-    private $registered = false;
77
-
78
-    /**
79
-     * @var bool $enqueue_immediately
80
-     */
81
-    private $enqueue_immediately = false;
82
-
83
-
84
-    /**
85
-     * Asset constructor.
86
-     *
87
-     * @param                 $type
88
-     * @param string          $handle
89
-     * @param DomainInterface $domain
90
-     * @throws InvalidDataTypeException
91
-     */
92
-    public function __construct($type, $handle, DomainInterface $domain)
93
-    {
94
-        $this->domain = $domain;
95
-        $this->setType($type);
96
-        $this->setHandle($handle);
97
-    }
98
-
99
-
100
-    /**
101
-     * @return array
102
-     */
103
-    public function validAssetTypes()
104
-    {
105
-        return array(
106
-            Asset::TYPE_CSS,
107
-            Asset::TYPE_JS,
108
-            Asset::TYPE_MANIFEST,
109
-        );
110
-    }
111
-
112
-
113
-    /**
114
-     * @param string $type
115
-     * @throws InvalidDataTypeException
116
-     */
117
-    private function setType($type)
118
-    {
119
-        if (! in_array($type, $this->validAssetTypes(), true)) {
120
-            throw new InvalidDataTypeException(
121
-                'Asset::$type',
122
-                $type,
123
-                'one of the TYPE_* class constants on \EventEspresso\core\domain\values\Asset is required'
124
-            );
125
-        }
126
-        $this->type = $type;
127
-    }
128
-
129
-
130
-    /**
131
-     * @param string $handle
132
-     * @throws InvalidDataTypeException
133
-     */
134
-    private function setHandle($handle)
135
-    {
136
-        if (! is_string($handle)) {
137
-            throw new InvalidDataTypeException(
138
-                '$handle',
139
-                $handle,
140
-                'string'
141
-            );
142
-        }
143
-        $this->handle = $handle;
144
-    }
145
-
146
-
147
-    /**
148
-     * @return string
149
-     */
150
-    public function assetNamespace()
151
-    {
152
-        return $this->domain->assetNamespace();
153
-    }
154
-
155
-
156
-    /**
157
-     * @return string
158
-     */
159
-    public function type()
160
-    {
161
-        return $this->type;
162
-    }
163
-
164
-
165
-    /**
166
-     * @return string
167
-     */
168
-    public function handle()
169
-    {
170
-        return $this->handle;
171
-    }
172
-
173
-    /**
174
-     * @return bool
175
-     */
176
-    public function isRegistered()
177
-    {
178
-        return $this->registered;
179
-    }
180
-
181
-    /**
182
-     * @param bool $registered
183
-     */
184
-    public function setRegistered($registered = true)
185
-    {
186
-        $this->registered = filter_var($registered, FILTER_VALIDATE_BOOLEAN);
187
-    }
188
-
189
-
190
-    /**
191
-     * @return bool
192
-     */
193
-    public function enqueueImmediately()
194
-    {
195
-        return $this->enqueue_immediately;
196
-    }
197
-
198
-
199
-    /**
200
-     * @param bool $enqueue_immediately
201
-     */
202
-    public function setEnqueueImmediately($enqueue_immediately = true)
203
-    {
204
-        $this->enqueue_immediately = filter_var($enqueue_immediately, FILTER_VALIDATE_BOOLEAN);
205
-    }
19
+	/**
20
+	 * indicates the file extension for a build distribution CSS file
21
+	 */
22
+	const FILE_EXTENSION_DISTRIBUTION_CSS = '.dist.css';
23
+
24
+	/**
25
+	 * indicates the file extension for a build distribution JS file
26
+	 */
27
+	const FILE_EXTENSION_DISTRIBUTION_JS = '.dist.js';
28
+
29
+	/**
30
+	 * Indicates the file extension for a build distribution dependencies json file.
31
+	 */
32
+	const FILE_EXTENSION_DISTRIBUTION_DEPS = '.dist.deps.php';
33
+
34
+	/**
35
+	 * indicates a Cascading Style Sheet asset
36
+	 */
37
+	const TYPE_CSS = 'css';
38
+
39
+	/**
40
+	 * indicates a Javascript asset
41
+	 */
42
+	const TYPE_JS = 'js';
43
+
44
+	/**
45
+	 * indicates a JSON asset
46
+	 */
47
+	CONST TYPE_JSON = 'json';
48
+	/**
49
+	 * indicates a PHP asset
50
+	 */
51
+	CONST TYPE_PHP = 'php';
52
+
53
+	/**
54
+	 * indicates a Javascript manifest file
55
+	 */
56
+	const TYPE_MANIFEST = 'manifest';
57
+
58
+	/**
59
+	 * @var DomainInterface $domain
60
+	 */
61
+	protected $domain;
62
+
63
+	/**
64
+	 * @var string $type
65
+	 */
66
+	private $type;
67
+
68
+	/**
69
+	 * @var string $handle
70
+	 */
71
+	private $handle;
72
+
73
+	/**
74
+	 * @var bool $registered
75
+	 */
76
+	private $registered = false;
77
+
78
+	/**
79
+	 * @var bool $enqueue_immediately
80
+	 */
81
+	private $enqueue_immediately = false;
82
+
83
+
84
+	/**
85
+	 * Asset constructor.
86
+	 *
87
+	 * @param                 $type
88
+	 * @param string          $handle
89
+	 * @param DomainInterface $domain
90
+	 * @throws InvalidDataTypeException
91
+	 */
92
+	public function __construct($type, $handle, DomainInterface $domain)
93
+	{
94
+		$this->domain = $domain;
95
+		$this->setType($type);
96
+		$this->setHandle($handle);
97
+	}
98
+
99
+
100
+	/**
101
+	 * @return array
102
+	 */
103
+	public function validAssetTypes()
104
+	{
105
+		return array(
106
+			Asset::TYPE_CSS,
107
+			Asset::TYPE_JS,
108
+			Asset::TYPE_MANIFEST,
109
+		);
110
+	}
111
+
112
+
113
+	/**
114
+	 * @param string $type
115
+	 * @throws InvalidDataTypeException
116
+	 */
117
+	private function setType($type)
118
+	{
119
+		if (! in_array($type, $this->validAssetTypes(), true)) {
120
+			throw new InvalidDataTypeException(
121
+				'Asset::$type',
122
+				$type,
123
+				'one of the TYPE_* class constants on \EventEspresso\core\domain\values\Asset is required'
124
+			);
125
+		}
126
+		$this->type = $type;
127
+	}
128
+
129
+
130
+	/**
131
+	 * @param string $handle
132
+	 * @throws InvalidDataTypeException
133
+	 */
134
+	private function setHandle($handle)
135
+	{
136
+		if (! is_string($handle)) {
137
+			throw new InvalidDataTypeException(
138
+				'$handle',
139
+				$handle,
140
+				'string'
141
+			);
142
+		}
143
+		$this->handle = $handle;
144
+	}
145
+
146
+
147
+	/**
148
+	 * @return string
149
+	 */
150
+	public function assetNamespace()
151
+	{
152
+		return $this->domain->assetNamespace();
153
+	}
154
+
155
+
156
+	/**
157
+	 * @return string
158
+	 */
159
+	public function type()
160
+	{
161
+		return $this->type;
162
+	}
163
+
164
+
165
+	/**
166
+	 * @return string
167
+	 */
168
+	public function handle()
169
+	{
170
+		return $this->handle;
171
+	}
172
+
173
+	/**
174
+	 * @return bool
175
+	 */
176
+	public function isRegistered()
177
+	{
178
+		return $this->registered;
179
+	}
180
+
181
+	/**
182
+	 * @param bool $registered
183
+	 */
184
+	public function setRegistered($registered = true)
185
+	{
186
+		$this->registered = filter_var($registered, FILTER_VALIDATE_BOOLEAN);
187
+	}
188
+
189
+
190
+	/**
191
+	 * @return bool
192
+	 */
193
+	public function enqueueImmediately()
194
+	{
195
+		return $this->enqueue_immediately;
196
+	}
197
+
198
+
199
+	/**
200
+	 * @param bool $enqueue_immediately
201
+	 */
202
+	public function setEnqueueImmediately($enqueue_immediately = true)
203
+	{
204
+		$this->enqueue_immediately = filter_var($enqueue_immediately, FILTER_VALIDATE_BOOLEAN);
205
+	}
206 206
 }
Please login to merge, or discard this patch.
core/domain/services/assets/CoreAssetManager.php 2 patches
Indentation   +188 added lines, -188 removed lines patch added patch discarded remove patch
@@ -30,192 +30,192 @@
 block discarded – undo
30 30
 class CoreAssetManager extends AssetManager
31 31
 {
32 32
 
33
-    // WordPress core / Third party JS asset handles
34
-    const JS_HANDLE_JS_CORE = 'eejs-core';
35
-
36
-    const JS_HANDLE_CORE = 'espresso_core';
37
-
38
-    const JS_HANDLE_I18N = 'eei18n';
39
-
40
-    const JS_HANDLE_VENDOR = 'eventespresso-vendor';
41
-
42
-    // EE CSS assets handles
43
-    const CSS_HANDLE_DEFAULT = 'espresso_default';
44
-
45
-    const CSS_HANDLE_CUSTOM = 'espresso_custom_css';
46
-
47
-    /**
48
-     * @var EE_Currency_Config $currency_config
49
-     */
50
-    protected $currency_config;
51
-
52
-    /**
53
-     * @var EE_Template_Config $template_config
54
-     */
55
-    protected $template_config;
56
-
57
-
58
-    /**
59
-     * CoreAssetRegister constructor.
60
-     *
61
-     * @param AssetCollection    $assets
62
-     * @param EE_Currency_Config $currency_config
63
-     * @param EE_Template_Config $template_config
64
-     * @param DomainInterface    $domain
65
-     * @param Registry           $registry
66
-     */
67
-    public function __construct(
68
-        AssetCollection $assets,
69
-        EE_Currency_Config $currency_config,
70
-        EE_Template_Config $template_config,
71
-        DomainInterface $domain,
72
-        Registry $registry
73
-    ) {
74
-        $this->currency_config = $currency_config;
75
-        $this->template_config = $template_config;
76
-        parent::__construct($domain, $assets, $registry);
77
-    }
78
-
79
-
80
-    /**
81
-     * @since 4.9.62.p
82
-     * @throws DomainException
83
-     * @throws DuplicateCollectionIdentifierException
84
-     * @throws InvalidArgumentException
85
-     * @throws InvalidDataTypeException
86
-     * @throws InvalidEntityException
87
-     * @throws InvalidInterfaceException
88
-     */
89
-    public function addAssets()
90
-    {
91
-        $this->addJavascriptFiles();
92
-        $this->addStylesheetFiles();
93
-    }
94
-
95
-
96
-    /**
97
-     * @since 4.9.62.p
98
-     * @throws DomainException
99
-     * @throws DuplicateCollectionIdentifierException
100
-     * @throws InvalidArgumentException
101
-     * @throws InvalidDataTypeException
102
-     * @throws InvalidEntityException
103
-     * @throws InvalidInterfaceException
104
-     */
105
-    public function addJavascriptFiles()
106
-    {
107
-        $this->addJs(CoreAssetManager::JS_HANDLE_VENDOR);
108
-        $this->addJs(CoreAssetManager::JS_HANDLE_JS_CORE)->setHasInlineData();
109
-        // todo verify that the following data is no longer being used anywhere and remove
110
-        $this->registry->addData('eejs_api_nonce', wp_create_nonce('wp_rest'));
111
-        $this->registry->addData(
112
-            'paths',
113
-            array(
114
-                'base_rest_route' => rest_url(),
115
-                'rest_route' => rest_url('ee/v4.8.36/'),
116
-                'collection_endpoints' => EED_Core_Rest_Api::getCollectionRoutesIndexedByModelName(),
117
-                'primary_keys' => EED_Core_Rest_Api::getPrimaryKeyNamesIndexedByModelName(),
118
-                'site_url' => site_url('/'),
119
-                'admin_url' => admin_url('/'),
120
-            )
121
-        );
122
-        // Event Espresso brand name
123
-        $this->registry->addData('brandName', Domain::brandName());
124
-        /** site formatting values **/
125
-        $this->registry->addData(
126
-            'site_formats',
127
-            array(
128
-                'date_formats' => EEH_DTT_Helper::convert_php_to_js_and_moment_date_formats()
129
-            )
130
-        );
131
-        /** currency data **/
132
-        $this->registry->addData(
133
-            'currency_config',
134
-            $this->getCurrencySettings()
135
-        );
136
-        /** site timezone */
137
-        $this->registry->addData(
138
-            'default_timezone',
139
-            array(
140
-                'pretty' => EEH_DTT_Helper::get_timezone_string_for_display(),
141
-                'string' => get_option('timezone_string'),
142
-                'offset' => EEH_DTT_Helper::get_site_timezone_gmt_offset(),
143
-            )
144
-        );
145
-        /** site locale (user locale if user logged in) */
146
-        $this->registry->addData(
147
-            'locale',
148
-            array(
149
-                'user' => get_user_locale(),
150
-                'site' => get_locale()
151
-            )
152
-        );
153
-
154
-        $this->addJavascript(
155
-            CoreAssetManager::JS_HANDLE_CORE,
156
-            EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js',
157
-            array(JqueryAssetManager::JS_HANDLE_JQUERY)
158
-        );
159
-    }
160
-
161
-
162
-    /**
163
-     * @throws DuplicateCollectionIdentifierException
164
-     * @throws InvalidDataTypeException
165
-     * @throws InvalidEntityException
166
-     * @throws DomainException
167
-     * @since 4.9.62.p
168
-     */
169
-    public function addStylesheetFiles()
170
-    {
171
-        if ($this->template_config->enable_default_style && ! is_admin()) {
172
-            $this->addStylesheet(
173
-                CoreAssetManager::CSS_HANDLE_DEFAULT,
174
-                is_readable(EVENT_ESPRESSO_UPLOAD_DIR . 'css/espresso_default.css')
175
-                    ? EVENT_ESPRESSO_UPLOAD_URL . 'css/espresso_default.css'
176
-                    : EE_GLOBAL_ASSETS_URL . 'css/espresso_default.css',
177
-                array('dashicons')
178
-            );
179
-            //Load custom style sheet if available
180
-            if ($this->template_config->custom_style_sheet !== null) {
181
-                $this->addStylesheet(
182
-                    CoreAssetManager::CSS_HANDLE_CUSTOM,
183
-                    EVENT_ESPRESSO_UPLOAD_URL . 'css/' . $this->template_config->custom_style_sheet,
184
-                    array(CoreAssetManager::CSS_HANDLE_DEFAULT)
185
-                );
186
-            }
187
-        }
188
-    }
189
-
190
-
191
-
192
-    /**
193
-     * Returns configuration data for the js Currency VO.
194
-     * @since 4.9.71.p
195
-     * @return array
196
-     */
197
-    private function getCurrencySettings()
198
-    {
199
-        return array(
200
-            'code' => $this->currency_config->code,
201
-            'singularLabel' => $this->currency_config->name,
202
-            'pluralLabel' => $this->currency_config->plural,
203
-            'sign' => $this->currency_config->sign,
204
-            'signB4' => $this->currency_config->sign_b4,
205
-            'decimalPlaces' => $this->currency_config->dec_plc,
206
-            'decimalMark' => $this->currency_config->dec_mrk,
207
-            'thousandsSeparator' => $this->currency_config->thsnds,
208
-        );
209
-    }
210
-
211
-
212
-    /**
213
-     * @param JavascriptAsset $script
214
-     * @deprecated $VID:$
215
-     */
216
-    public function loadQtipJs(JavascriptAsset $script)
217
-    {
218
-        // replacement:
219
-        // EventEspresso\core\domain\services\assets\EspressoLegacyAdminAssetManager::loadQtipJs()
220
-    }
33
+	// WordPress core / Third party JS asset handles
34
+	const JS_HANDLE_JS_CORE = 'eejs-core';
35
+
36
+	const JS_HANDLE_CORE = 'espresso_core';
37
+
38
+	const JS_HANDLE_I18N = 'eei18n';
39
+
40
+	const JS_HANDLE_VENDOR = 'eventespresso-vendor';
41
+
42
+	// EE CSS assets handles
43
+	const CSS_HANDLE_DEFAULT = 'espresso_default';
44
+
45
+	const CSS_HANDLE_CUSTOM = 'espresso_custom_css';
46
+
47
+	/**
48
+	 * @var EE_Currency_Config $currency_config
49
+	 */
50
+	protected $currency_config;
51
+
52
+	/**
53
+	 * @var EE_Template_Config $template_config
54
+	 */
55
+	protected $template_config;
56
+
57
+
58
+	/**
59
+	 * CoreAssetRegister constructor.
60
+	 *
61
+	 * @param AssetCollection    $assets
62
+	 * @param EE_Currency_Config $currency_config
63
+	 * @param EE_Template_Config $template_config
64
+	 * @param DomainInterface    $domain
65
+	 * @param Registry           $registry
66
+	 */
67
+	public function __construct(
68
+		AssetCollection $assets,
69
+		EE_Currency_Config $currency_config,
70
+		EE_Template_Config $template_config,
71
+		DomainInterface $domain,
72
+		Registry $registry
73
+	) {
74
+		$this->currency_config = $currency_config;
75
+		$this->template_config = $template_config;
76
+		parent::__construct($domain, $assets, $registry);
77
+	}
78
+
79
+
80
+	/**
81
+	 * @since 4.9.62.p
82
+	 * @throws DomainException
83
+	 * @throws DuplicateCollectionIdentifierException
84
+	 * @throws InvalidArgumentException
85
+	 * @throws InvalidDataTypeException
86
+	 * @throws InvalidEntityException
87
+	 * @throws InvalidInterfaceException
88
+	 */
89
+	public function addAssets()
90
+	{
91
+		$this->addJavascriptFiles();
92
+		$this->addStylesheetFiles();
93
+	}
94
+
95
+
96
+	/**
97
+	 * @since 4.9.62.p
98
+	 * @throws DomainException
99
+	 * @throws DuplicateCollectionIdentifierException
100
+	 * @throws InvalidArgumentException
101
+	 * @throws InvalidDataTypeException
102
+	 * @throws InvalidEntityException
103
+	 * @throws InvalidInterfaceException
104
+	 */
105
+	public function addJavascriptFiles()
106
+	{
107
+		$this->addJs(CoreAssetManager::JS_HANDLE_VENDOR);
108
+		$this->addJs(CoreAssetManager::JS_HANDLE_JS_CORE)->setHasInlineData();
109
+		// todo verify that the following data is no longer being used anywhere and remove
110
+		$this->registry->addData('eejs_api_nonce', wp_create_nonce('wp_rest'));
111
+		$this->registry->addData(
112
+			'paths',
113
+			array(
114
+				'base_rest_route' => rest_url(),
115
+				'rest_route' => rest_url('ee/v4.8.36/'),
116
+				'collection_endpoints' => EED_Core_Rest_Api::getCollectionRoutesIndexedByModelName(),
117
+				'primary_keys' => EED_Core_Rest_Api::getPrimaryKeyNamesIndexedByModelName(),
118
+				'site_url' => site_url('/'),
119
+				'admin_url' => admin_url('/'),
120
+			)
121
+		);
122
+		// Event Espresso brand name
123
+		$this->registry->addData('brandName', Domain::brandName());
124
+		/** site formatting values **/
125
+		$this->registry->addData(
126
+			'site_formats',
127
+			array(
128
+				'date_formats' => EEH_DTT_Helper::convert_php_to_js_and_moment_date_formats()
129
+			)
130
+		);
131
+		/** currency data **/
132
+		$this->registry->addData(
133
+			'currency_config',
134
+			$this->getCurrencySettings()
135
+		);
136
+		/** site timezone */
137
+		$this->registry->addData(
138
+			'default_timezone',
139
+			array(
140
+				'pretty' => EEH_DTT_Helper::get_timezone_string_for_display(),
141
+				'string' => get_option('timezone_string'),
142
+				'offset' => EEH_DTT_Helper::get_site_timezone_gmt_offset(),
143
+			)
144
+		);
145
+		/** site locale (user locale if user logged in) */
146
+		$this->registry->addData(
147
+			'locale',
148
+			array(
149
+				'user' => get_user_locale(),
150
+				'site' => get_locale()
151
+			)
152
+		);
153
+
154
+		$this->addJavascript(
155
+			CoreAssetManager::JS_HANDLE_CORE,
156
+			EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js',
157
+			array(JqueryAssetManager::JS_HANDLE_JQUERY)
158
+		);
159
+	}
160
+
161
+
162
+	/**
163
+	 * @throws DuplicateCollectionIdentifierException
164
+	 * @throws InvalidDataTypeException
165
+	 * @throws InvalidEntityException
166
+	 * @throws DomainException
167
+	 * @since 4.9.62.p
168
+	 */
169
+	public function addStylesheetFiles()
170
+	{
171
+		if ($this->template_config->enable_default_style && ! is_admin()) {
172
+			$this->addStylesheet(
173
+				CoreAssetManager::CSS_HANDLE_DEFAULT,
174
+				is_readable(EVENT_ESPRESSO_UPLOAD_DIR . 'css/espresso_default.css')
175
+					? EVENT_ESPRESSO_UPLOAD_URL . 'css/espresso_default.css'
176
+					: EE_GLOBAL_ASSETS_URL . 'css/espresso_default.css',
177
+				array('dashicons')
178
+			);
179
+			//Load custom style sheet if available
180
+			if ($this->template_config->custom_style_sheet !== null) {
181
+				$this->addStylesheet(
182
+					CoreAssetManager::CSS_HANDLE_CUSTOM,
183
+					EVENT_ESPRESSO_UPLOAD_URL . 'css/' . $this->template_config->custom_style_sheet,
184
+					array(CoreAssetManager::CSS_HANDLE_DEFAULT)
185
+				);
186
+			}
187
+		}
188
+	}
189
+
190
+
191
+
192
+	/**
193
+	 * Returns configuration data for the js Currency VO.
194
+	 * @since 4.9.71.p
195
+	 * @return array
196
+	 */
197
+	private function getCurrencySettings()
198
+	{
199
+		return array(
200
+			'code' => $this->currency_config->code,
201
+			'singularLabel' => $this->currency_config->name,
202
+			'pluralLabel' => $this->currency_config->plural,
203
+			'sign' => $this->currency_config->sign,
204
+			'signB4' => $this->currency_config->sign_b4,
205
+			'decimalPlaces' => $this->currency_config->dec_plc,
206
+			'decimalMark' => $this->currency_config->dec_mrk,
207
+			'thousandsSeparator' => $this->currency_config->thsnds,
208
+		);
209
+	}
210
+
211
+
212
+	/**
213
+	 * @param JavascriptAsset $script
214
+	 * @deprecated $VID:$
215
+	 */
216
+	public function loadQtipJs(JavascriptAsset $script)
217
+	{
218
+		// replacement:
219
+		// EventEspresso\core\domain\services\assets\EspressoLegacyAdminAssetManager::loadQtipJs()
220
+	}
221 221
 }
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
 
154 154
         $this->addJavascript(
155 155
             CoreAssetManager::JS_HANDLE_CORE,
156
-            EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js',
156
+            EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js',
157 157
             array(JqueryAssetManager::JS_HANDLE_JQUERY)
158 158
         );
159 159
     }
@@ -171,16 +171,16 @@  discard block
 block discarded – undo
171 171
         if ($this->template_config->enable_default_style && ! is_admin()) {
172 172
             $this->addStylesheet(
173 173
                 CoreAssetManager::CSS_HANDLE_DEFAULT,
174
-                is_readable(EVENT_ESPRESSO_UPLOAD_DIR . 'css/espresso_default.css')
174
+                is_readable(EVENT_ESPRESSO_UPLOAD_DIR.'css/espresso_default.css')
175 175
                     ? EVENT_ESPRESSO_UPLOAD_URL . 'css/espresso_default.css'
176
-                    : EE_GLOBAL_ASSETS_URL . 'css/espresso_default.css',
176
+                    : EE_GLOBAL_ASSETS_URL.'css/espresso_default.css',
177 177
                 array('dashicons')
178 178
             );
179 179
             //Load custom style sheet if available
180 180
             if ($this->template_config->custom_style_sheet !== null) {
181 181
                 $this->addStylesheet(
182 182
                     CoreAssetManager::CSS_HANDLE_CUSTOM,
183
-                    EVENT_ESPRESSO_UPLOAD_URL . 'css/' . $this->template_config->custom_style_sheet,
183
+                    EVENT_ESPRESSO_UPLOAD_URL.'css/'.$this->template_config->custom_style_sheet,
184 184
                     array(CoreAssetManager::CSS_HANDLE_DEFAULT)
185 185
                 );
186 186
             }
Please login to merge, or discard this patch.
core/domain/services/assets/EspressoLegacyAdminAssetManager.php 2 patches
Indentation   +244 added lines, -244 removed lines patch added patch discarded remove patch
@@ -15,269 +15,269 @@
 block discarded – undo
15 15
 class EspressoLegacyAdminAssetManager extends AssetManager
16 16
 {
17 17
 
18
-    const JS_HANDLE_EE_ADMIN                = 'ee_admin_js';
18
+	const JS_HANDLE_EE_ADMIN                = 'ee_admin_js';
19 19
 
20
-    const JS_HANDLE_EE_AJAX_TABLE_SORTING   = 'espresso_ajax_table_sorting';
20
+	const JS_HANDLE_EE_AJAX_TABLE_SORTING   = 'espresso_ajax_table_sorting';
21 21
 
22
-    const JS_HANDLE_EE_DATEPICKER           = 'ee-datepicker';
22
+	const JS_HANDLE_EE_DATEPICKER           = 'ee-datepicker';
23 23
 
24
-    const JS_HANDLE_EE_DIALOG               = 'ee-dialog';
24
+	const JS_HANDLE_EE_DIALOG               = 'ee-dialog';
25 25
 
26
-    const JS_HANDLE_EE_HELP_TOUR            = 'ee-help-tour';
26
+	const JS_HANDLE_EE_HELP_TOUR            = 'ee-help-tour';
27 27
 
28
-    const JS_HANDLE_EE_INJECT_WP            = 'ee-inject-wp';
28
+	const JS_HANDLE_EE_INJECT_WP            = 'ee-inject-wp';
29 29
 
30
-    const JS_HANDLE_EE_LEGACY_ADMIN = 'eventespresso-legacy-admin';
30
+	const JS_HANDLE_EE_LEGACY_ADMIN = 'eventespresso-legacy-admin';
31 31
 
32
-    const JS_HANDLE_GOOGLE_CHARTS           = 'google-charts';
32
+	const JS_HANDLE_GOOGLE_CHARTS           = 'google-charts';
33 33
 
34
-    const JS_HANDLE_MOMENT                  = 'ee-moment';
34
+	const JS_HANDLE_MOMENT                  = 'ee-moment';
35 35
 
36
-    const JS_HANDLE_MOMENT_CORE             = 'ee-moment-core';
36
+	const JS_HANDLE_MOMENT_CORE             = 'ee-moment-core';
37 37
 
38
-    const JS_HANDLE_PARSE_URI               = 'ee-parse-uri';
38
+	const JS_HANDLE_PARSE_URI               = 'ee-parse-uri';
39 39
 
40
-    const JS_HANDLE_EE_TEXT_LINKS           = 'ee-text-links';
40
+	const JS_HANDLE_EE_TEXT_LINKS           = 'ee-text-links';
41 41
 
42
-    const JS_HANDLE_EE_SERIALIZE_FULL_ARRAY = 'ee-serialize-full-array';
42
+	const JS_HANDLE_EE_SERIALIZE_FULL_ARRAY = 'ee-serialize-full-array';
43 43
 
44
-    const JS_HANDLE_JOYRIDE_MODERNIZR       = 'joyride-modernizr';
44
+	const JS_HANDLE_JOYRIDE_MODERNIZR       = 'joyride-modernizr';
45 45
 
46
-    const JS_HANDLE_JQUERY_JOYRIDE          = 'jquery-joyride';
46
+	const JS_HANDLE_JQUERY_JOYRIDE          = 'jquery-joyride';
47 47
 
48
-    const CSS_HANDLE_EE_ADMIN               = 'ee-admin-css';
48
+	const CSS_HANDLE_EE_ADMIN               = 'ee-admin-css';
49 49
 
50
-    const CSS_HANDLE_EE_JOYRIDE             = 'ee-joyride-css';
50
+	const CSS_HANDLE_EE_JOYRIDE             = 'ee-joyride-css';
51 51
 
52
-    const CSS_HANDLE_EE_LEGACY_ADMIN = 'eventespresso-legacy-admin';
52
+	const CSS_HANDLE_EE_LEGACY_ADMIN = 'eventespresso-legacy-admin';
53 53
 
54
-    const CSS_HANDLE_EE_ADMIN_MENU = 'espresso_menu';
54
+	const CSS_HANDLE_EE_ADMIN_MENU = 'espresso_menu';
55 55
 
56
-    const CSS_HANDLE_EE_TEXT_LINKS          = 'ee-text-links';
56
+	const CSS_HANDLE_EE_TEXT_LINKS          = 'ee-text-links';
57 57
 
58
-    const CSS_HANDLE_EE_UI_THEME            = 'espresso-ui-theme';
58
+	const CSS_HANDLE_EE_UI_THEME            = 'espresso-ui-theme';
59 59
 
60
-    const CSS_HANDLE_JOYRIDE                = 'joyride-css';
61
-
62
-
63
-    /**
64
-     * @inheritDoc
65
-     */
66
-    public function addAssets()
67
-    {
68
-        $joyride = filter_var(apply_filters('FHEE_load_joyride', false), FILTER_VALIDATE_BOOLEAN);
69
-        $this->registerJavascript($joyride);
70
-        $this->registerStyleSheets($joyride);
71
-    }
72
-
73
-
74
-    /**
75
-     * Register javascript assets
76
-     *
77
-     * @param bool $joyride
78
-     */
79
-    private function registerJavascript($joyride = false)
80
-    {
81
-        $this->addJs(
82
-            EspressoLegacyAdminAssetManager::JS_HANDLE_EE_LEGACY_ADMIN,
83
-            [
84
-                EspressoLegacyAdminAssetManager::JS_HANDLE_EE_ADMIN,
85
-                EspressoLegacyAdminAssetManager::JS_HANDLE_EE_AJAX_TABLE_SORTING,
86
-                EspressoLegacyAdminAssetManager::JS_HANDLE_EE_SERIALIZE_FULL_ARRAY,
87
-                EspressoLegacyAdminAssetManager::JS_HANDLE_EE_TEXT_LINKS,
88
-                EspressoLegacyAdminAssetManager::JS_HANDLE_EE_DATEPICKER,
89
-                EspressoLegacyAdminAssetManager::JS_HANDLE_GOOGLE_CHARTS,
90
-                EspressoLegacyAdminAssetManager::JS_HANDLE_EE_INJECT_WP,
91
-            ]
92
-        )->setEnqueueImmediately();
93
-
94
-        $this->addJavascript(
95
-            EspressoLegacyAdminAssetManager::JS_HANDLE_EE_DIALOG,
96
-            EE_ADMIN_URL . 'assets/ee-dialog-helper.js',
97
-            [
98
-                JqueryAssetManager::JS_HANDLE_JQUERY,
99
-                JqueryAssetManager::JS_HANDLE_JQUERY_UI_DRAGGABLE,
100
-            ]
101
-        );
102
-
103
-        $this->addJavascript(
104
-            EspressoLegacyAdminAssetManager::JS_HANDLE_EE_ADMIN,
105
-            EE_ADMIN_URL . 'assets/ee-admin-page.js',
106
-            [
107
-                CoreAssetManager::JS_HANDLE_CORE,
108
-                EspressoLegacyAdminAssetManager::JS_HANDLE_PARSE_URI,
109
-                EspressoLegacyAdminAssetManager::JS_HANDLE_EE_DIALOG,
110
-            ]
111
-        );
112
-
113
-        // script for sorting tables
114
-        $this->addJavascript(
115
-            EspressoLegacyAdminAssetManager::JS_HANDLE_EE_AJAX_TABLE_SORTING,
116
-            EE_ADMIN_URL . 'assets/espresso_ajax_table_sorting.js',
117
-            [
118
-                EspressoLegacyAdminAssetManager::JS_HANDLE_EE_ADMIN,
119
-                JqueryAssetManager::JS_HANDLE_JQUERY_UI_SORTABLE,
120
-            ]
121
-        )->setEnqueueImmediately();
122
-
123
-        // script for parsing uri's
124
-        $this->addJavascript(
125
-            EspressoLegacyAdminAssetManager::JS_HANDLE_PARSE_URI,
126
-            EE_GLOBAL_ASSETS_URL . 'scripts/parseuri.js'
127
-        );
128
-
129
-        // and parsing associative serialized form elements
130
-        $this->addJavascript(
131
-            EspressoLegacyAdminAssetManager::JS_HANDLE_EE_SERIALIZE_FULL_ARRAY,
132
-            EE_GLOBAL_ASSETS_URL . 'scripts/jquery.serializefullarray.js',
133
-            [JqueryAssetManager::JS_HANDLE_JQUERY]
134
-
135
-        );
136
-
137
-        // helpers scripts
138
-        $this->addJavascript(
139
-            EspressoLegacyAdminAssetManager::JS_HANDLE_EE_TEXT_LINKS,
140
-            EE_PLUGIN_DIR_URL . 'core/helpers/assets/ee_text_list_helper.js',
141
-            [JqueryAssetManager::JS_HANDLE_JQUERY]
142
-        );
143
-
144
-        $this->addJavascript(
145
-            EspressoLegacyAdminAssetManager::JS_HANDLE_MOMENT_CORE,
146
-            EE_THIRD_PARTY_URL . 'moment/moment-with-locales.min.js'
147
-        );
148
-
149
-        $this->addJavascript(
150
-            EspressoLegacyAdminAssetManager::JS_HANDLE_MOMENT,
151
-            EE_THIRD_PARTY_URL . 'moment/moment-timezone-with-data.min.js',
152
-            [EspressoLegacyAdminAssetManager::JS_HANDLE_MOMENT_CORE]
153
-        );
154
-
155
-        $this->addJavascript(
156
-            EspressoLegacyAdminAssetManager::JS_HANDLE_EE_DATEPICKER,
157
-            EE_ADMIN_URL . 'assets/ee-datepicker.js',
158
-            [
159
-                JqueryAssetManager::JS_HANDLE_JQUERY_UI_TIMEPICKER_ADDON,
160
-                EspressoLegacyAdminAssetManager::JS_HANDLE_MOMENT,
161
-            ]
162
-        );
163
-
164
-        // google charts
165
-        $this->addJavascript(
166
-            EspressoLegacyAdminAssetManager::JS_HANDLE_GOOGLE_CHARTS,
167
-            'https://www.gstatic.com/charts/loader.js'
168
-        );
169
-
170
-        // this javascript is loaded on every admin page to catch any injections ee needs to add to wp run js.
171
-        // Note: the intention of this script is to only do TARGETED injections.
172
-        //ie: only injecting on certain script calls.
173
-        $this->addJavascript(
174
-            EspressoLegacyAdminAssetManager::JS_HANDLE_EE_INJECT_WP,
175
-            EE_ADMIN_URL . 'assets/ee-cpt-wp-injects.js',
176
-            [JqueryAssetManager::JS_HANDLE_JQUERY]
177
-        );
178
-
179
-        $this->loadQtipJs();
180
-        // joyride is turned OFF by default, but prior to the admin_enqueue_scripts hook,
181
-        // can be turned back on again via: add_filter('FHEE_load_joyride', '__return_true' );
182
-        if (! $joyride) {
183
-            return;
184
-        }
185
-
186
-        $this->addJavascript(
187
-            EspressoLegacyAdminAssetManager::JS_HANDLE_JOYRIDE_MODERNIZR,
188
-            EE_THIRD_PARTY_URL . 'joyride/modernizr.mq.js',
189
-            [],
190
-            true,
191
-            '2.1'
192
-        );
193
-
194
-        // wanna go for a joyride?
195
-        $this->addJavascript(
196
-            EspressoLegacyAdminAssetManager::JS_HANDLE_JQUERY_JOYRIDE,
197
-            EE_THIRD_PARTY_URL . 'joyride/jquery.joyride-2.1.js',
198
-            [
199
-                JqueryAssetManager::JS_HANDLE_JQUERY_COOKIE,
200
-                EspressoLegacyAdminAssetManager::JS_HANDLE_JOYRIDE_MODERNIZR,
201
-            ],
202
-            true,
203
-            '2.1'
204
-        )->setEnqueueImmediately();
205
-
206
-        $this->addJavascript(
207
-            EspressoLegacyAdminAssetManager::JS_HANDLE_EE_HELP_TOUR,
208
-            EE_ADMIN_URL . 'assets/ee-help-tour.js',
209
-            [
210
-                EspressoLegacyAdminAssetManager::JS_HANDLE_JQUERY_JOYRIDE,
211
-            ],
212
-            true,
213
-            '2.1'
214
-        )->setEnqueueImmediately();
215
-    }
216
-
217
-
218
-    /**
219
-     * Register CSS assets.
220
-     *
221
-     * @param bool $joyride
222
-     */
223
-    private function registerStyleSheets($joyride = false)
224
-    {
225
-
226
-        $this->addStylesheet(
227
-            EspressoLegacyAdminAssetManager::CSS_HANDLE_EE_UI_THEME,
228
-            EE_GLOBAL_ASSETS_URL . 'css/espresso-ui-theme/jquery-ui-1.10.3.custom.min.css'
229
-        );
230
-
231
-        $this->addStylesheet(
232
-            EspressoLegacyAdminAssetManager::CSS_HANDLE_EE_TEXT_LINKS,
233
-            EE_PLUGIN_DIR_URL . 'core/helpers/assets/ee_text_list_helper.css'
234
-        );
235
-
236
-        $this->addStylesheet(
237
-            EspressoLegacyAdminAssetManager::CSS_HANDLE_EE_ADMIN,
238
-            EE_ADMIN_URL . 'assets/ee-admin-page.css'
239
-        )->setEnqueueImmediately();
240
-
241
-        $this->addStylesheet(
242
-            EspressoLegacyAdminAssetManager::CSS_HANDLE_EE_ADMIN_MENU,
243
-            EE_ADMIN_URL . 'assets/admin-menu-styles.css',
244
-            ['dashicons']
245
-        )->setEnqueueImmediately();
246
-
247
-        if (! $joyride) {
248
-            return;
249
-        }
250
-        // joyride style
251
-        $this->addStylesheet(
252
-            EspressoLegacyAdminAssetManager::CSS_HANDLE_JOYRIDE,
253
-            EE_THIRD_PARTY_URL . 'joyride/joyride-2.1.css',
254
-            [],
255
-            'all',
256
-            '2.1'
257
-        );
258
-
259
-        $this->addStylesheet(
260
-            EspressoLegacyAdminAssetManager::CSS_HANDLE_EE_JOYRIDE,
261
-            EE_GLOBAL_ASSETS_URL . 'css/ee-joyride-styles.css',
262
-            [EspressoLegacyAdminAssetManager::CSS_HANDLE_JOYRIDE],
263
-            'all',
264
-            EVENT_ESPRESSO_VERSION
265
-        )->setEnqueueImmediately();
266
-    }
267
-
268
-
269
-    /**
270
-     * registers assets for cleaning your ears
271
-     */
272
-    public function loadQtipJs()
273
-    {
274
-        // qtip is turned OFF by default, but prior to the wp_enqueue_scripts hook,
275
-        // can be turned back on again via: add_filter('FHEE_load_qtip', '__return_true' );
276
-        if (apply_filters('FHEE_load_qtip', false)) {
277
-            $qtip_loader = EEH_Qtip_Loader::instance();
278
-            if ($qtip_loader instanceof EEH_Qtip_Loader) {
279
-                $qtip_loader->register_and_enqueue();
280
-            }
281
-        }
282
-    }
60
+	const CSS_HANDLE_JOYRIDE                = 'joyride-css';
61
+
62
+
63
+	/**
64
+	 * @inheritDoc
65
+	 */
66
+	public function addAssets()
67
+	{
68
+		$joyride = filter_var(apply_filters('FHEE_load_joyride', false), FILTER_VALIDATE_BOOLEAN);
69
+		$this->registerJavascript($joyride);
70
+		$this->registerStyleSheets($joyride);
71
+	}
72
+
73
+
74
+	/**
75
+	 * Register javascript assets
76
+	 *
77
+	 * @param bool $joyride
78
+	 */
79
+	private function registerJavascript($joyride = false)
80
+	{
81
+		$this->addJs(
82
+			EspressoLegacyAdminAssetManager::JS_HANDLE_EE_LEGACY_ADMIN,
83
+			[
84
+				EspressoLegacyAdminAssetManager::JS_HANDLE_EE_ADMIN,
85
+				EspressoLegacyAdminAssetManager::JS_HANDLE_EE_AJAX_TABLE_SORTING,
86
+				EspressoLegacyAdminAssetManager::JS_HANDLE_EE_SERIALIZE_FULL_ARRAY,
87
+				EspressoLegacyAdminAssetManager::JS_HANDLE_EE_TEXT_LINKS,
88
+				EspressoLegacyAdminAssetManager::JS_HANDLE_EE_DATEPICKER,
89
+				EspressoLegacyAdminAssetManager::JS_HANDLE_GOOGLE_CHARTS,
90
+				EspressoLegacyAdminAssetManager::JS_HANDLE_EE_INJECT_WP,
91
+			]
92
+		)->setEnqueueImmediately();
93
+
94
+		$this->addJavascript(
95
+			EspressoLegacyAdminAssetManager::JS_HANDLE_EE_DIALOG,
96
+			EE_ADMIN_URL . 'assets/ee-dialog-helper.js',
97
+			[
98
+				JqueryAssetManager::JS_HANDLE_JQUERY,
99
+				JqueryAssetManager::JS_HANDLE_JQUERY_UI_DRAGGABLE,
100
+			]
101
+		);
102
+
103
+		$this->addJavascript(
104
+			EspressoLegacyAdminAssetManager::JS_HANDLE_EE_ADMIN,
105
+			EE_ADMIN_URL . 'assets/ee-admin-page.js',
106
+			[
107
+				CoreAssetManager::JS_HANDLE_CORE,
108
+				EspressoLegacyAdminAssetManager::JS_HANDLE_PARSE_URI,
109
+				EspressoLegacyAdminAssetManager::JS_HANDLE_EE_DIALOG,
110
+			]
111
+		);
112
+
113
+		// script for sorting tables
114
+		$this->addJavascript(
115
+			EspressoLegacyAdminAssetManager::JS_HANDLE_EE_AJAX_TABLE_SORTING,
116
+			EE_ADMIN_URL . 'assets/espresso_ajax_table_sorting.js',
117
+			[
118
+				EspressoLegacyAdminAssetManager::JS_HANDLE_EE_ADMIN,
119
+				JqueryAssetManager::JS_HANDLE_JQUERY_UI_SORTABLE,
120
+			]
121
+		)->setEnqueueImmediately();
122
+
123
+		// script for parsing uri's
124
+		$this->addJavascript(
125
+			EspressoLegacyAdminAssetManager::JS_HANDLE_PARSE_URI,
126
+			EE_GLOBAL_ASSETS_URL . 'scripts/parseuri.js'
127
+		);
128
+
129
+		// and parsing associative serialized form elements
130
+		$this->addJavascript(
131
+			EspressoLegacyAdminAssetManager::JS_HANDLE_EE_SERIALIZE_FULL_ARRAY,
132
+			EE_GLOBAL_ASSETS_URL . 'scripts/jquery.serializefullarray.js',
133
+			[JqueryAssetManager::JS_HANDLE_JQUERY]
134
+
135
+		);
136
+
137
+		// helpers scripts
138
+		$this->addJavascript(
139
+			EspressoLegacyAdminAssetManager::JS_HANDLE_EE_TEXT_LINKS,
140
+			EE_PLUGIN_DIR_URL . 'core/helpers/assets/ee_text_list_helper.js',
141
+			[JqueryAssetManager::JS_HANDLE_JQUERY]
142
+		);
143
+
144
+		$this->addJavascript(
145
+			EspressoLegacyAdminAssetManager::JS_HANDLE_MOMENT_CORE,
146
+			EE_THIRD_PARTY_URL . 'moment/moment-with-locales.min.js'
147
+		);
148
+
149
+		$this->addJavascript(
150
+			EspressoLegacyAdminAssetManager::JS_HANDLE_MOMENT,
151
+			EE_THIRD_PARTY_URL . 'moment/moment-timezone-with-data.min.js',
152
+			[EspressoLegacyAdminAssetManager::JS_HANDLE_MOMENT_CORE]
153
+		);
154
+
155
+		$this->addJavascript(
156
+			EspressoLegacyAdminAssetManager::JS_HANDLE_EE_DATEPICKER,
157
+			EE_ADMIN_URL . 'assets/ee-datepicker.js',
158
+			[
159
+				JqueryAssetManager::JS_HANDLE_JQUERY_UI_TIMEPICKER_ADDON,
160
+				EspressoLegacyAdminAssetManager::JS_HANDLE_MOMENT,
161
+			]
162
+		);
163
+
164
+		// google charts
165
+		$this->addJavascript(
166
+			EspressoLegacyAdminAssetManager::JS_HANDLE_GOOGLE_CHARTS,
167
+			'https://www.gstatic.com/charts/loader.js'
168
+		);
169
+
170
+		// this javascript is loaded on every admin page to catch any injections ee needs to add to wp run js.
171
+		// Note: the intention of this script is to only do TARGETED injections.
172
+		//ie: only injecting on certain script calls.
173
+		$this->addJavascript(
174
+			EspressoLegacyAdminAssetManager::JS_HANDLE_EE_INJECT_WP,
175
+			EE_ADMIN_URL . 'assets/ee-cpt-wp-injects.js',
176
+			[JqueryAssetManager::JS_HANDLE_JQUERY]
177
+		);
178
+
179
+		$this->loadQtipJs();
180
+		// joyride is turned OFF by default, but prior to the admin_enqueue_scripts hook,
181
+		// can be turned back on again via: add_filter('FHEE_load_joyride', '__return_true' );
182
+		if (! $joyride) {
183
+			return;
184
+		}
185
+
186
+		$this->addJavascript(
187
+			EspressoLegacyAdminAssetManager::JS_HANDLE_JOYRIDE_MODERNIZR,
188
+			EE_THIRD_PARTY_URL . 'joyride/modernizr.mq.js',
189
+			[],
190
+			true,
191
+			'2.1'
192
+		);
193
+
194
+		// wanna go for a joyride?
195
+		$this->addJavascript(
196
+			EspressoLegacyAdminAssetManager::JS_HANDLE_JQUERY_JOYRIDE,
197
+			EE_THIRD_PARTY_URL . 'joyride/jquery.joyride-2.1.js',
198
+			[
199
+				JqueryAssetManager::JS_HANDLE_JQUERY_COOKIE,
200
+				EspressoLegacyAdminAssetManager::JS_HANDLE_JOYRIDE_MODERNIZR,
201
+			],
202
+			true,
203
+			'2.1'
204
+		)->setEnqueueImmediately();
205
+
206
+		$this->addJavascript(
207
+			EspressoLegacyAdminAssetManager::JS_HANDLE_EE_HELP_TOUR,
208
+			EE_ADMIN_URL . 'assets/ee-help-tour.js',
209
+			[
210
+				EspressoLegacyAdminAssetManager::JS_HANDLE_JQUERY_JOYRIDE,
211
+			],
212
+			true,
213
+			'2.1'
214
+		)->setEnqueueImmediately();
215
+	}
216
+
217
+
218
+	/**
219
+	 * Register CSS assets.
220
+	 *
221
+	 * @param bool $joyride
222
+	 */
223
+	private function registerStyleSheets($joyride = false)
224
+	{
225
+
226
+		$this->addStylesheet(
227
+			EspressoLegacyAdminAssetManager::CSS_HANDLE_EE_UI_THEME,
228
+			EE_GLOBAL_ASSETS_URL . 'css/espresso-ui-theme/jquery-ui-1.10.3.custom.min.css'
229
+		);
230
+
231
+		$this->addStylesheet(
232
+			EspressoLegacyAdminAssetManager::CSS_HANDLE_EE_TEXT_LINKS,
233
+			EE_PLUGIN_DIR_URL . 'core/helpers/assets/ee_text_list_helper.css'
234
+		);
235
+
236
+		$this->addStylesheet(
237
+			EspressoLegacyAdminAssetManager::CSS_HANDLE_EE_ADMIN,
238
+			EE_ADMIN_URL . 'assets/ee-admin-page.css'
239
+		)->setEnqueueImmediately();
240
+
241
+		$this->addStylesheet(
242
+			EspressoLegacyAdminAssetManager::CSS_HANDLE_EE_ADMIN_MENU,
243
+			EE_ADMIN_URL . 'assets/admin-menu-styles.css',
244
+			['dashicons']
245
+		)->setEnqueueImmediately();
246
+
247
+		if (! $joyride) {
248
+			return;
249
+		}
250
+		// joyride style
251
+		$this->addStylesheet(
252
+			EspressoLegacyAdminAssetManager::CSS_HANDLE_JOYRIDE,
253
+			EE_THIRD_PARTY_URL . 'joyride/joyride-2.1.css',
254
+			[],
255
+			'all',
256
+			'2.1'
257
+		);
258
+
259
+		$this->addStylesheet(
260
+			EspressoLegacyAdminAssetManager::CSS_HANDLE_EE_JOYRIDE,
261
+			EE_GLOBAL_ASSETS_URL . 'css/ee-joyride-styles.css',
262
+			[EspressoLegacyAdminAssetManager::CSS_HANDLE_JOYRIDE],
263
+			'all',
264
+			EVENT_ESPRESSO_VERSION
265
+		)->setEnqueueImmediately();
266
+	}
267
+
268
+
269
+	/**
270
+	 * registers assets for cleaning your ears
271
+	 */
272
+	public function loadQtipJs()
273
+	{
274
+		// qtip is turned OFF by default, but prior to the wp_enqueue_scripts hook,
275
+		// can be turned back on again via: add_filter('FHEE_load_qtip', '__return_true' );
276
+		if (apply_filters('FHEE_load_qtip', false)) {
277
+			$qtip_loader = EEH_Qtip_Loader::instance();
278
+			if ($qtip_loader instanceof EEH_Qtip_Loader) {
279
+				$qtip_loader->register_and_enqueue();
280
+			}
281
+		}
282
+	}
283 283
 }
Please login to merge, or discard this patch.
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 
94 94
         $this->addJavascript(
95 95
             EspressoLegacyAdminAssetManager::JS_HANDLE_EE_DIALOG,
96
-            EE_ADMIN_URL . 'assets/ee-dialog-helper.js',
96
+            EE_ADMIN_URL.'assets/ee-dialog-helper.js',
97 97
             [
98 98
                 JqueryAssetManager::JS_HANDLE_JQUERY,
99 99
                 JqueryAssetManager::JS_HANDLE_JQUERY_UI_DRAGGABLE,
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 
103 103
         $this->addJavascript(
104 104
             EspressoLegacyAdminAssetManager::JS_HANDLE_EE_ADMIN,
105
-            EE_ADMIN_URL . 'assets/ee-admin-page.js',
105
+            EE_ADMIN_URL.'assets/ee-admin-page.js',
106 106
             [
107 107
                 CoreAssetManager::JS_HANDLE_CORE,
108 108
                 EspressoLegacyAdminAssetManager::JS_HANDLE_PARSE_URI,
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
         // script for sorting tables
114 114
         $this->addJavascript(
115 115
             EspressoLegacyAdminAssetManager::JS_HANDLE_EE_AJAX_TABLE_SORTING,
116
-            EE_ADMIN_URL . 'assets/espresso_ajax_table_sorting.js',
116
+            EE_ADMIN_URL.'assets/espresso_ajax_table_sorting.js',
117 117
             [
118 118
                 EspressoLegacyAdminAssetManager::JS_HANDLE_EE_ADMIN,
119 119
                 JqueryAssetManager::JS_HANDLE_JQUERY_UI_SORTABLE,
@@ -123,13 +123,13 @@  discard block
 block discarded – undo
123 123
         // script for parsing uri's
124 124
         $this->addJavascript(
125 125
             EspressoLegacyAdminAssetManager::JS_HANDLE_PARSE_URI,
126
-            EE_GLOBAL_ASSETS_URL . 'scripts/parseuri.js'
126
+            EE_GLOBAL_ASSETS_URL.'scripts/parseuri.js'
127 127
         );
128 128
 
129 129
         // and parsing associative serialized form elements
130 130
         $this->addJavascript(
131 131
             EspressoLegacyAdminAssetManager::JS_HANDLE_EE_SERIALIZE_FULL_ARRAY,
132
-            EE_GLOBAL_ASSETS_URL . 'scripts/jquery.serializefullarray.js',
132
+            EE_GLOBAL_ASSETS_URL.'scripts/jquery.serializefullarray.js',
133 133
             [JqueryAssetManager::JS_HANDLE_JQUERY]
134 134
 
135 135
         );
@@ -137,24 +137,24 @@  discard block
 block discarded – undo
137 137
         // helpers scripts
138 138
         $this->addJavascript(
139 139
             EspressoLegacyAdminAssetManager::JS_HANDLE_EE_TEXT_LINKS,
140
-            EE_PLUGIN_DIR_URL . 'core/helpers/assets/ee_text_list_helper.js',
140
+            EE_PLUGIN_DIR_URL.'core/helpers/assets/ee_text_list_helper.js',
141 141
             [JqueryAssetManager::JS_HANDLE_JQUERY]
142 142
         );
143 143
 
144 144
         $this->addJavascript(
145 145
             EspressoLegacyAdminAssetManager::JS_HANDLE_MOMENT_CORE,
146
-            EE_THIRD_PARTY_URL . 'moment/moment-with-locales.min.js'
146
+            EE_THIRD_PARTY_URL.'moment/moment-with-locales.min.js'
147 147
         );
148 148
 
149 149
         $this->addJavascript(
150 150
             EspressoLegacyAdminAssetManager::JS_HANDLE_MOMENT,
151
-            EE_THIRD_PARTY_URL . 'moment/moment-timezone-with-data.min.js',
151
+            EE_THIRD_PARTY_URL.'moment/moment-timezone-with-data.min.js',
152 152
             [EspressoLegacyAdminAssetManager::JS_HANDLE_MOMENT_CORE]
153 153
         );
154 154
 
155 155
         $this->addJavascript(
156 156
             EspressoLegacyAdminAssetManager::JS_HANDLE_EE_DATEPICKER,
157
-            EE_ADMIN_URL . 'assets/ee-datepicker.js',
157
+            EE_ADMIN_URL.'assets/ee-datepicker.js',
158 158
             [
159 159
                 JqueryAssetManager::JS_HANDLE_JQUERY_UI_TIMEPICKER_ADDON,
160 160
                 EspressoLegacyAdminAssetManager::JS_HANDLE_MOMENT,
@@ -172,20 +172,20 @@  discard block
 block discarded – undo
172 172
         //ie: only injecting on certain script calls.
173 173
         $this->addJavascript(
174 174
             EspressoLegacyAdminAssetManager::JS_HANDLE_EE_INJECT_WP,
175
-            EE_ADMIN_URL . 'assets/ee-cpt-wp-injects.js',
175
+            EE_ADMIN_URL.'assets/ee-cpt-wp-injects.js',
176 176
             [JqueryAssetManager::JS_HANDLE_JQUERY]
177 177
         );
178 178
 
179 179
         $this->loadQtipJs();
180 180
         // joyride is turned OFF by default, but prior to the admin_enqueue_scripts hook,
181 181
         // can be turned back on again via: add_filter('FHEE_load_joyride', '__return_true' );
182
-        if (! $joyride) {
182
+        if ( ! $joyride) {
183 183
             return;
184 184
         }
185 185
 
186 186
         $this->addJavascript(
187 187
             EspressoLegacyAdminAssetManager::JS_HANDLE_JOYRIDE_MODERNIZR,
188
-            EE_THIRD_PARTY_URL . 'joyride/modernizr.mq.js',
188
+            EE_THIRD_PARTY_URL.'joyride/modernizr.mq.js',
189 189
             [],
190 190
             true,
191 191
             '2.1'
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
         // wanna go for a joyride?
195 195
         $this->addJavascript(
196 196
             EspressoLegacyAdminAssetManager::JS_HANDLE_JQUERY_JOYRIDE,
197
-            EE_THIRD_PARTY_URL . 'joyride/jquery.joyride-2.1.js',
197
+            EE_THIRD_PARTY_URL.'joyride/jquery.joyride-2.1.js',
198 198
             [
199 199
                 JqueryAssetManager::JS_HANDLE_JQUERY_COOKIE,
200 200
                 EspressoLegacyAdminAssetManager::JS_HANDLE_JOYRIDE_MODERNIZR,
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
 
206 206
         $this->addJavascript(
207 207
             EspressoLegacyAdminAssetManager::JS_HANDLE_EE_HELP_TOUR,
208
-            EE_ADMIN_URL . 'assets/ee-help-tour.js',
208
+            EE_ADMIN_URL.'assets/ee-help-tour.js',
209 209
             [
210 210
                 EspressoLegacyAdminAssetManager::JS_HANDLE_JQUERY_JOYRIDE,
211 211
             ],
@@ -225,32 +225,32 @@  discard block
 block discarded – undo
225 225
 
226 226
         $this->addStylesheet(
227 227
             EspressoLegacyAdminAssetManager::CSS_HANDLE_EE_UI_THEME,
228
-            EE_GLOBAL_ASSETS_URL . 'css/espresso-ui-theme/jquery-ui-1.10.3.custom.min.css'
228
+            EE_GLOBAL_ASSETS_URL.'css/espresso-ui-theme/jquery-ui-1.10.3.custom.min.css'
229 229
         );
230 230
 
231 231
         $this->addStylesheet(
232 232
             EspressoLegacyAdminAssetManager::CSS_HANDLE_EE_TEXT_LINKS,
233
-            EE_PLUGIN_DIR_URL . 'core/helpers/assets/ee_text_list_helper.css'
233
+            EE_PLUGIN_DIR_URL.'core/helpers/assets/ee_text_list_helper.css'
234 234
         );
235 235
 
236 236
         $this->addStylesheet(
237 237
             EspressoLegacyAdminAssetManager::CSS_HANDLE_EE_ADMIN,
238
-            EE_ADMIN_URL . 'assets/ee-admin-page.css'
238
+            EE_ADMIN_URL.'assets/ee-admin-page.css'
239 239
         )->setEnqueueImmediately();
240 240
 
241 241
         $this->addStylesheet(
242 242
             EspressoLegacyAdminAssetManager::CSS_HANDLE_EE_ADMIN_MENU,
243
-            EE_ADMIN_URL . 'assets/admin-menu-styles.css',
243
+            EE_ADMIN_URL.'assets/admin-menu-styles.css',
244 244
             ['dashicons']
245 245
         )->setEnqueueImmediately();
246 246
 
247
-        if (! $joyride) {
247
+        if ( ! $joyride) {
248 248
             return;
249 249
         }
250 250
         // joyride style
251 251
         $this->addStylesheet(
252 252
             EspressoLegacyAdminAssetManager::CSS_HANDLE_JOYRIDE,
253
-            EE_THIRD_PARTY_URL . 'joyride/joyride-2.1.css',
253
+            EE_THIRD_PARTY_URL.'joyride/joyride-2.1.css',
254 254
             [],
255 255
             'all',
256 256
             '2.1'
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
 
259 259
         $this->addStylesheet(
260 260
             EspressoLegacyAdminAssetManager::CSS_HANDLE_EE_JOYRIDE,
261
-            EE_GLOBAL_ASSETS_URL . 'css/ee-joyride-styles.css',
261
+            EE_GLOBAL_ASSETS_URL.'css/ee-joyride-styles.css',
262 262
             [EspressoLegacyAdminAssetManager::CSS_HANDLE_JOYRIDE],
263 263
             'all',
264 264
             EVENT_ESPRESSO_VERSION
Please login to merge, or discard this patch.
core/domain/services/assets/LegacyAccountingAssetManager.php 1 patch
Indentation   +121 added lines, -121 removed lines patch added patch discarded remove patch
@@ -24,125 +24,125 @@
 block discarded – undo
24 24
 class LegacyAccountingAssetManager extends AssetManager
25 25
 {
26 26
 
27
-    const JS_HANDLE_UNDERSCORE = 'underscore';
28
-
29
-    const JS_HANDLE_ACCOUNTING_CORE = 'ee-accounting-core';
30
-
31
-    const JS_HANDLE_ACCOUNTING = 'ee-accounting';
32
-
33
-
34
-    /**
35
-     * @var EE_Currency_Config $currency_config
36
-     */
37
-    protected $currency_config;
38
-
39
-    /**
40
-     * CoreAssetRegister constructor.
41
-     *
42
-     * @param AssetCollection    $assets
43
-     * @param DomainInterface    $domain
44
-     * @param Registry           $registry
45
-     * @param EE_Currency_Config $currency_config
46
-     */
47
-    public function __construct(
48
-        AssetCollection $assets,
49
-        DomainInterface $domain,
50
-        Registry $registry,
51
-        EE_Currency_Config $currency_config
52
-    ) {
53
-        $this->currency_config = $currency_config;
54
-        parent::__construct($domain, $assets, $registry);
55
-    }
56
-
57
-
58
-
59
-    /**
60
-     * @throws InvalidDataTypeException
61
-     * @throws InvalidEntityException
62
-     * @throws DuplicateCollectionIdentifierException
63
-     * @throws DomainException
64
-     */
65
-    public function addAssets()
66
-    {
67
-        $this->loadAccountingJs();
68
-        add_action('admin_enqueue_scripts', [$this, 'enqueueLegacyAccountingAssets'], 100);
69
-    }
70
-
71
-
72
-    /**
73
-     * accounting.js for performing client-side calculations
74
-     *
75
-     * @throws DomainException
76
-     * @throws DuplicateCollectionIdentifierException
77
-     * @throws InvalidDataTypeException
78
-     * @throws InvalidEntityException
79
-     * @since $VID:$
80
-     */
81
-    private function loadAccountingJs()
82
-    {
83
-        //accounting.js library
84
-        // @link http://josscrowcroft.github.io/accounting.js/
85
-        $this->addJavascript(
86
-            LegacyAccountingAssetManager::JS_HANDLE_ACCOUNTING_CORE,
87
-            EE_THIRD_PARTY_URL . 'accounting/accounting.js',
88
-            [LegacyAccountingAssetManager::JS_HANDLE_UNDERSCORE],
89
-            true,
90
-            '0.3.2'
91
-        );
92
-
93
-        $this->addJavascript(
94
-            LegacyAccountingAssetManager::JS_HANDLE_ACCOUNTING,
95
-            EE_GLOBAL_ASSETS_URL . 'scripts/ee-accounting-config.js',
96
-            [LegacyAccountingAssetManager::JS_HANDLE_ACCOUNTING_CORE]
97
-        )
98
-             ->setInlineDataCallback(
99
-                 function () {
100
-                     wp_localize_script(
101
-                         LegacyAccountingAssetManager::JS_HANDLE_ACCOUNTING,
102
-                         'EE_ACCOUNTING_CFG',
103
-                         $this->getAccountingSettings()
104
-                     );
105
-                 }
106
-             );
107
-    }
108
-
109
-
110
-    /**
111
-     * Returns configuration data for the accounting-js library.
112
-     *
113
-     * @return array
114
-     * @since $VID:$
115
-     */
116
-    private function getAccountingSettings()
117
-    {
118
-        return [
119
-            'currency' => [
120
-                'symbol'    => $this->currency_config->sign,
121
-                'format'    => [
122
-                    'pos'  => $this->currency_config->sign_b4 ? '%s%v' : '%v%s',
123
-                    'neg'  => $this->currency_config->sign_b4 ? '- %s%v' : '- %v%s',
124
-                    'zero' => $this->currency_config->sign_b4 ? '%s--' : '--%s',
125
-                ],
126
-                'decimal'   => $this->currency_config->dec_mrk,
127
-                'thousand'  => $this->currency_config->thsnds,
128
-                'precision' => $this->currency_config->dec_plc,
129
-            ],
130
-            'number'   => [
131
-                'precision' => $this->currency_config->dec_plc,
132
-                'thousand'  => $this->currency_config->thsnds,
133
-                'decimal'   => $this->currency_config->dec_mrk,
134
-            ],
135
-        ];
136
-    }
137
-
138
-
139
-    /**
140
-     * enqueue_scripts - Load the scripts and css
141
-     *
142
-     * @return void
143
-     */
144
-    public function enqueueLegacyAccountingAssets()
145
-    {
146
-        $this->enqueueAsset(LegacyAccountingAssetManager::JS_HANDLE_ACCOUNTING);
147
-    }
27
+	const JS_HANDLE_UNDERSCORE = 'underscore';
28
+
29
+	const JS_HANDLE_ACCOUNTING_CORE = 'ee-accounting-core';
30
+
31
+	const JS_HANDLE_ACCOUNTING = 'ee-accounting';
32
+
33
+
34
+	/**
35
+	 * @var EE_Currency_Config $currency_config
36
+	 */
37
+	protected $currency_config;
38
+
39
+	/**
40
+	 * CoreAssetRegister constructor.
41
+	 *
42
+	 * @param AssetCollection    $assets
43
+	 * @param DomainInterface    $domain
44
+	 * @param Registry           $registry
45
+	 * @param EE_Currency_Config $currency_config
46
+	 */
47
+	public function __construct(
48
+		AssetCollection $assets,
49
+		DomainInterface $domain,
50
+		Registry $registry,
51
+		EE_Currency_Config $currency_config
52
+	) {
53
+		$this->currency_config = $currency_config;
54
+		parent::__construct($domain, $assets, $registry);
55
+	}
56
+
57
+
58
+
59
+	/**
60
+	 * @throws InvalidDataTypeException
61
+	 * @throws InvalidEntityException
62
+	 * @throws DuplicateCollectionIdentifierException
63
+	 * @throws DomainException
64
+	 */
65
+	public function addAssets()
66
+	{
67
+		$this->loadAccountingJs();
68
+		add_action('admin_enqueue_scripts', [$this, 'enqueueLegacyAccountingAssets'], 100);
69
+	}
70
+
71
+
72
+	/**
73
+	 * accounting.js for performing client-side calculations
74
+	 *
75
+	 * @throws DomainException
76
+	 * @throws DuplicateCollectionIdentifierException
77
+	 * @throws InvalidDataTypeException
78
+	 * @throws InvalidEntityException
79
+	 * @since $VID:$
80
+	 */
81
+	private function loadAccountingJs()
82
+	{
83
+		//accounting.js library
84
+		// @link http://josscrowcroft.github.io/accounting.js/
85
+		$this->addJavascript(
86
+			LegacyAccountingAssetManager::JS_HANDLE_ACCOUNTING_CORE,
87
+			EE_THIRD_PARTY_URL . 'accounting/accounting.js',
88
+			[LegacyAccountingAssetManager::JS_HANDLE_UNDERSCORE],
89
+			true,
90
+			'0.3.2'
91
+		);
92
+
93
+		$this->addJavascript(
94
+			LegacyAccountingAssetManager::JS_HANDLE_ACCOUNTING,
95
+			EE_GLOBAL_ASSETS_URL . 'scripts/ee-accounting-config.js',
96
+			[LegacyAccountingAssetManager::JS_HANDLE_ACCOUNTING_CORE]
97
+		)
98
+			 ->setInlineDataCallback(
99
+				 function () {
100
+					 wp_localize_script(
101
+						 LegacyAccountingAssetManager::JS_HANDLE_ACCOUNTING,
102
+						 'EE_ACCOUNTING_CFG',
103
+						 $this->getAccountingSettings()
104
+					 );
105
+				 }
106
+			 );
107
+	}
108
+
109
+
110
+	/**
111
+	 * Returns configuration data for the accounting-js library.
112
+	 *
113
+	 * @return array
114
+	 * @since $VID:$
115
+	 */
116
+	private function getAccountingSettings()
117
+	{
118
+		return [
119
+			'currency' => [
120
+				'symbol'    => $this->currency_config->sign,
121
+				'format'    => [
122
+					'pos'  => $this->currency_config->sign_b4 ? '%s%v' : '%v%s',
123
+					'neg'  => $this->currency_config->sign_b4 ? '- %s%v' : '- %v%s',
124
+					'zero' => $this->currency_config->sign_b4 ? '%s--' : '--%s',
125
+				],
126
+				'decimal'   => $this->currency_config->dec_mrk,
127
+				'thousand'  => $this->currency_config->thsnds,
128
+				'precision' => $this->currency_config->dec_plc,
129
+			],
130
+			'number'   => [
131
+				'precision' => $this->currency_config->dec_plc,
132
+				'thousand'  => $this->currency_config->thsnds,
133
+				'decimal'   => $this->currency_config->dec_mrk,
134
+			],
135
+		];
136
+	}
137
+
138
+
139
+	/**
140
+	 * enqueue_scripts - Load the scripts and css
141
+	 *
142
+	 * @return void
143
+	 */
144
+	public function enqueueLegacyAccountingAssets()
145
+	{
146
+		$this->enqueueAsset(LegacyAccountingAssetManager::JS_HANDLE_ACCOUNTING);
147
+	}
148 148
 }
Please login to merge, or discard this patch.
core/domain/services/assets/JqueryAssetManager.php 2 patches
Indentation   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -6,63 +6,63 @@
 block discarded – undo
6 6
 
7 7
 class JqueryAssetManager extends AssetManager
8 8
 {
9
-    const JS_HANDLE_JQUERY = 'jquery';
9
+	const JS_HANDLE_JQUERY = 'jquery';
10 10
 
11
-    const JS_HANDLE_JQUERY_COOKIE = 'jquery-cookie';
11
+	const JS_HANDLE_JQUERY_COOKIE = 'jquery-cookie';
12 12
 
13
-    const JS_HANDLE_JQUERY_VALIDATE = 'jquery-validate';
13
+	const JS_HANDLE_JQUERY_VALIDATE = 'jquery-validate';
14 14
 
15
-    const JS_HANDLE_JQUERY_VALIDATE_EXTRA = 'jquery-validate-extra-methods';
15
+	const JS_HANDLE_JQUERY_VALIDATE_EXTRA = 'jquery-validate-extra-methods';
16 16
 
17
-    const JS_HANDLE_JQUERY_UI_DATEPICKER = 'jquery-ui-datepicker';
17
+	const JS_HANDLE_JQUERY_UI_DATEPICKER = 'jquery-ui-datepicker';
18 18
 
19
-    const JS_HANDLE_JQUERY_UI_DRAGGABLE = 'jquery-ui-draggable';
19
+	const JS_HANDLE_JQUERY_UI_DRAGGABLE = 'jquery-ui-draggable';
20 20
 
21
-    const JS_HANDLE_JQUERY_UI_SLIDER = 'jquery-ui-slider';
21
+	const JS_HANDLE_JQUERY_UI_SLIDER = 'jquery-ui-slider';
22 22
 
23
-    const JS_HANDLE_JQUERY_UI_SORTABLE = 'jquery-ui-sortable';
23
+	const JS_HANDLE_JQUERY_UI_SORTABLE = 'jquery-ui-sortable';
24 24
 
25
-    const JS_HANDLE_JQUERY_UI_TIMEPICKER_ADDON = 'jquery-ui-timepicker-addon';
25
+	const JS_HANDLE_JQUERY_UI_TIMEPICKER_ADDON = 'jquery-ui-timepicker-addon';
26 26
 
27 27
 
28 28
 
29
-    /**
29
+	/**
30 30
 	 * @inheritDoc
31 31
 	 */
32 32
 	public function addAssets()
33 33
 	{
34
-        // register cookie script for future dependencies
35
-        $this->addJavascript(
36
-            JqueryAssetManager::JS_HANDLE_JQUERY_COOKIE,
37
-            EE_THIRD_PARTY_URL . 'joyride/jquery.cookie.js',
38
-            ['jquery'],
39
-            true,
40
-            '2.1'
41
-        );
42
-
43
-        $this->addJavascript(
44
-            JqueryAssetManager::JS_HANDLE_JQUERY_VALIDATE,
45
-            EE_GLOBAL_ASSETS_URL . 'scripts/jquery.validate.min.js',
46
-            array(JqueryAssetManager::JS_HANDLE_JQUERY),
47
-            true,
48
-            '1.15.0'
49
-        )->setEnqueueImmediately();
50
-
51
-        $this->addJavascript(
52
-            JqueryAssetManager::JS_HANDLE_JQUERY_VALIDATE_EXTRA,
53
-            EE_GLOBAL_ASSETS_URL . 'scripts/jquery.validate.additional-methods.min.js',
54
-            array(JqueryAssetManager::JS_HANDLE_JQUERY_VALIDATE),
55
-            true,
56
-            '1.15.0'
57
-        );
58
-
59
-        $this->addJavascript(
60
-            JqueryAssetManager::JS_HANDLE_JQUERY_UI_TIMEPICKER_ADDON,
61
-            EE_GLOBAL_ASSETS_URL . 'scripts/jquery-ui-timepicker-addon.js',
62
-            [
63
-                JqueryAssetManager::JS_HANDLE_JQUERY_UI_DATEPICKER,
64
-                JqueryAssetManager::JS_HANDLE_JQUERY_UI_SLIDER
65
-            ]
66
-        );
34
+		// register cookie script for future dependencies
35
+		$this->addJavascript(
36
+			JqueryAssetManager::JS_HANDLE_JQUERY_COOKIE,
37
+			EE_THIRD_PARTY_URL . 'joyride/jquery.cookie.js',
38
+			['jquery'],
39
+			true,
40
+			'2.1'
41
+		);
42
+
43
+		$this->addJavascript(
44
+			JqueryAssetManager::JS_HANDLE_JQUERY_VALIDATE,
45
+			EE_GLOBAL_ASSETS_URL . 'scripts/jquery.validate.min.js',
46
+			array(JqueryAssetManager::JS_HANDLE_JQUERY),
47
+			true,
48
+			'1.15.0'
49
+		)->setEnqueueImmediately();
50
+
51
+		$this->addJavascript(
52
+			JqueryAssetManager::JS_HANDLE_JQUERY_VALIDATE_EXTRA,
53
+			EE_GLOBAL_ASSETS_URL . 'scripts/jquery.validate.additional-methods.min.js',
54
+			array(JqueryAssetManager::JS_HANDLE_JQUERY_VALIDATE),
55
+			true,
56
+			'1.15.0'
57
+		);
58
+
59
+		$this->addJavascript(
60
+			JqueryAssetManager::JS_HANDLE_JQUERY_UI_TIMEPICKER_ADDON,
61
+			EE_GLOBAL_ASSETS_URL . 'scripts/jquery-ui-timepicker-addon.js',
62
+			[
63
+				JqueryAssetManager::JS_HANDLE_JQUERY_UI_DATEPICKER,
64
+				JqueryAssetManager::JS_HANDLE_JQUERY_UI_SLIDER
65
+			]
66
+		);
67 67
 	}
68 68
 }
69 69
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
         // register cookie script for future dependencies
35 35
         $this->addJavascript(
36 36
             JqueryAssetManager::JS_HANDLE_JQUERY_COOKIE,
37
-            EE_THIRD_PARTY_URL . 'joyride/jquery.cookie.js',
37
+            EE_THIRD_PARTY_URL.'joyride/jquery.cookie.js',
38 38
             ['jquery'],
39 39
             true,
40 40
             '2.1'
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 
43 43
         $this->addJavascript(
44 44
             JqueryAssetManager::JS_HANDLE_JQUERY_VALIDATE,
45
-            EE_GLOBAL_ASSETS_URL . 'scripts/jquery.validate.min.js',
45
+            EE_GLOBAL_ASSETS_URL.'scripts/jquery.validate.min.js',
46 46
             array(JqueryAssetManager::JS_HANDLE_JQUERY),
47 47
             true,
48 48
             '1.15.0'
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 
51 51
         $this->addJavascript(
52 52
             JqueryAssetManager::JS_HANDLE_JQUERY_VALIDATE_EXTRA,
53
-            EE_GLOBAL_ASSETS_URL . 'scripts/jquery.validate.additional-methods.min.js',
53
+            EE_GLOBAL_ASSETS_URL.'scripts/jquery.validate.additional-methods.min.js',
54 54
             array(JqueryAssetManager::JS_HANDLE_JQUERY_VALIDATE),
55 55
             true,
56 56
             '1.15.0'
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 
59 59
         $this->addJavascript(
60 60
             JqueryAssetManager::JS_HANDLE_JQUERY_UI_TIMEPICKER_ADDON,
61
-            EE_GLOBAL_ASSETS_URL . 'scripts/jquery-ui-timepicker-addon.js',
61
+            EE_GLOBAL_ASSETS_URL.'scripts/jquery-ui-timepicker-addon.js',
62 62
             [
63 63
                 JqueryAssetManager::JS_HANDLE_JQUERY_UI_DATEPICKER,
64 64
                 JqueryAssetManager::JS_HANDLE_JQUERY_UI_SLIDER
Please login to merge, or discard this patch.