Completed
Branch Gutenberg/components-query-lim... (09ba10)
by
unknown
63:51 queued 44:50
created
core/admin/EE_Admin_Page.core.php 3 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -897,7 +897,7 @@  discard block
 block discarded – undo
897 897
      * this method simply verifies a given route and makes sure its an actual route available for the loaded page
898 898
      *
899 899
      * @param  string $route the route name we're verifying
900
-     * @return mixed (bool|Exception)      we'll throw an exception if this isn't a valid route.
900
+     * @return boolean (bool|Exception)      we'll throw an exception if this isn't a valid route.
901 901
      * @throws EE_Error
902 902
      */
903 903
     protected function _verify_route($route)
@@ -4039,7 +4039,7 @@  discard block
 block discarded – undo
4039 4039
 
4040 4040
 
4041 4041
     /**
4042
-     * @return mixed
4042
+     * @return string[]
4043 4043
      */
4044 4044
     public function default_espresso_metaboxes()
4045 4045
     {
@@ -4059,7 +4059,7 @@  discard block
 block discarded – undo
4059 4059
 
4060 4060
 
4061 4061
     /**
4062
-     * @return mixed
4062
+     * @return string
4063 4063
      */
4064 4064
     public function wp_page_slug()
4065 4065
     {
Please login to merge, or discard this patch.
Indentation   +4014 added lines, -4014 removed lines patch added patch discarded remove patch
@@ -17,4080 +17,4080 @@
 block discarded – undo
17 17
 {
18 18
 
19 19
 
20
-    // set in _init_page_props()
21
-    public $page_slug;
20
+	// set in _init_page_props()
21
+	public $page_slug;
22 22
 
23
-    public $page_label;
23
+	public $page_label;
24 24
 
25
-    public $page_folder;
25
+	public $page_folder;
26 26
 
27
-    // set in define_page_props()
28
-    protected $_admin_base_url;
27
+	// set in define_page_props()
28
+	protected $_admin_base_url;
29 29
 
30
-    protected $_admin_base_path;
30
+	protected $_admin_base_path;
31 31
 
32
-    protected $_admin_page_title;
32
+	protected $_admin_page_title;
33 33
 
34
-    protected $_labels;
34
+	protected $_labels;
35 35
 
36 36
 
37
-    // set early within EE_Admin_Init
38
-    protected $_wp_page_slug;
37
+	// set early within EE_Admin_Init
38
+	protected $_wp_page_slug;
39 39
 
40
-    // navtabs
41
-    protected $_nav_tabs;
40
+	// navtabs
41
+	protected $_nav_tabs;
42 42
 
43
-    protected $_default_nav_tab_name;
43
+	protected $_default_nav_tab_name;
44 44
 
45
-    /**
46
-     * @var array $_help_tour
47
-     */
48
-    protected $_help_tour = array();
45
+	/**
46
+	 * @var array $_help_tour
47
+	 */
48
+	protected $_help_tour = array();
49 49
 
50 50
 
51
-    // template variables (used by templates)
52
-    protected $_template_path;
51
+	// template variables (used by templates)
52
+	protected $_template_path;
53 53
 
54
-    protected $_column_template_path;
54
+	protected $_column_template_path;
55 55
 
56
-    /**
57
-     * @var array $_template_args
58
-     */
59
-    protected $_template_args = array();
56
+	/**
57
+	 * @var array $_template_args
58
+	 */
59
+	protected $_template_args = array();
60 60
 
61
-    /**
62
-     * this will hold the list table object for a given view.
63
-     *
64
-     * @var EE_Admin_List_Table $_list_table_object
65
-     */
66
-    protected $_list_table_object;
61
+	/**
62
+	 * this will hold the list table object for a given view.
63
+	 *
64
+	 * @var EE_Admin_List_Table $_list_table_object
65
+	 */
66
+	protected $_list_table_object;
67 67
 
68
-    // bools
69
-    protected $_is_UI_request = null; // this starts at null so we can have no header routes progress through two states.
68
+	// bools
69
+	protected $_is_UI_request = null; // this starts at null so we can have no header routes progress through two states.
70 70
 
71
-    protected $_routing;
71
+	protected $_routing;
72 72
 
73
-    // list table args
74
-    protected $_view;
73
+	// list table args
74
+	protected $_view;
75 75
 
76
-    protected $_views;
76
+	protected $_views;
77 77
 
78 78
 
79
-    // action => method pairs used for routing incoming requests
80
-    protected $_page_routes;
79
+	// action => method pairs used for routing incoming requests
80
+	protected $_page_routes;
81 81
 
82
-    /**
83
-     * @var array $_page_config
84
-     */
85
-    protected $_page_config;
82
+	/**
83
+	 * @var array $_page_config
84
+	 */
85
+	protected $_page_config;
86 86
 
87
-    /**
88
-     * the current page route and route config
89
-     *
90
-     * @var string $_route
91
-     */
92
-    protected $_route;
87
+	/**
88
+	 * the current page route and route config
89
+	 *
90
+	 * @var string $_route
91
+	 */
92
+	protected $_route;
93 93
 
94
-    /**
95
-     * @var string $_cpt_route
96
-     */
97
-    protected $_cpt_route;
94
+	/**
95
+	 * @var string $_cpt_route
96
+	 */
97
+	protected $_cpt_route;
98 98
 
99
-    /**
100
-     * @var array $_route_config
101
-     */
102
-    protected $_route_config;
103
-
104
-    /**
105
-     * Used to hold default query args for list table routes to help preserve stickiness of filters for carried out
106
-     * actions.
107
-     *
108
-     * @since 4.6.x
109
-     * @var array.
110
-     */
111
-    protected $_default_route_query_args;
112
-
113
-    // set via request page and action args.
114
-    protected $_current_page;
115
-
116
-    protected $_current_view;
117
-
118
-    protected $_current_page_view_url;
119
-
120
-    // sanitized request action (and nonce)
121
-
122
-    /**
123
-     * @var string $_req_action
124
-     */
125
-    protected $_req_action;
126
-
127
-    /**
128
-     * @var string $_req_nonce
129
-     */
130
-    protected $_req_nonce;
131
-
132
-    // search related
133
-    protected $_search_btn_label;
134
-
135
-    protected $_search_box_callback;
136
-
137
-    /**
138
-     * WP Current Screen object
139
-     *
140
-     * @var WP_Screen
141
-     */
142
-    protected $_current_screen;
143
-
144
-    // for holding EE_Admin_Hooks object when needed (set via set_hook_object())
145
-    protected $_hook_obj;
146
-
147
-    // for holding incoming request data
148
-    protected $_req_data;
149
-
150
-    // yes / no array for admin form fields
151
-    protected $_yes_no_values = array();
152
-
153
-    // some default things shared by all child classes
154
-    protected $_default_espresso_metaboxes;
155
-
156
-    /**
157
-     *    EE_Registry Object
158
-     *
159
-     * @var    EE_Registry
160
-     */
161
-    protected $EE = null;
162
-
163
-
164
-    /**
165
-     * This is just a property that flags whether the given route is a caffeinated route or not.
166
-     *
167
-     * @var boolean
168
-     */
169
-    protected $_is_caf = false;
170
-
171
-
172
-    /**
173
-     * @Constructor
174
-     * @param bool $routing indicate whether we want to just load the object and handle routing or just load the object.
175
-     * @throws EE_Error
176
-     * @throws InvalidArgumentException
177
-     * @throws ReflectionException
178
-     * @throws InvalidDataTypeException
179
-     * @throws InvalidInterfaceException
180
-     */
181
-    public function __construct($routing = true)
182
-    {
183
-        if (strpos($this->_get_dir(), 'caffeinated') !== false) {
184
-            $this->_is_caf = true;
185
-        }
186
-        $this->_yes_no_values = array(
187
-            array('id' => true, 'text' => esc_html__('Yes', 'event_espresso')),
188
-            array('id' => false, 'text' => esc_html__('No', 'event_espresso')),
189
-        );
190
-        // set the _req_data property.
191
-        $this->_req_data = array_merge($_GET, $_POST);
192
-        // routing enabled?
193
-        $this->_routing = $routing;
194
-        // set initial page props (child method)
195
-        $this->_init_page_props();
196
-        // set global defaults
197
-        $this->_set_defaults();
198
-        // set early because incoming requests could be ajax related and we need to register those hooks.
199
-        $this->_global_ajax_hooks();
200
-        $this->_ajax_hooks();
201
-        // other_page_hooks have to be early too.
202
-        $this->_do_other_page_hooks();
203
-        // This just allows us to have extending classes do something specific
204
-        // before the parent constructor runs _page_setup().
205
-        if (method_exists($this, '_before_page_setup')) {
206
-            $this->_before_page_setup();
207
-        }
208
-        // set up page dependencies
209
-        $this->_page_setup();
210
-    }
211
-
212
-
213
-    /**
214
-     * _init_page_props
215
-     * Child classes use to set at least the following properties:
216
-     * $page_slug.
217
-     * $page_label.
218
-     *
219
-     * @abstract
220
-     * @return void
221
-     */
222
-    abstract protected function _init_page_props();
223
-
224
-
225
-    /**
226
-     * _ajax_hooks
227
-     * child classes put all their add_action('wp_ajax_{name_of_hook}') hooks in here.
228
-     * Note: within the ajax callback methods.
229
-     *
230
-     * @abstract
231
-     * @return void
232
-     */
233
-    abstract protected function _ajax_hooks();
234
-
235
-
236
-    /**
237
-     * _define_page_props
238
-     * child classes define page properties in here.  Must include at least:
239
-     * $_admin_base_url = base_url for all admin pages
240
-     * $_admin_page_title = default admin_page_title for admin pages
241
-     * $_labels = array of default labels for various automatically generated elements:
242
-     *    array(
243
-     *        'buttons' => array(
244
-     *            'add' => esc_html__('label for add new button'),
245
-     *            'edit' => esc_html__('label for edit button'),
246
-     *            'delete' => esc_html__('label for delete button')
247
-     *            )
248
-     *        )
249
-     *
250
-     * @abstract
251
-     * @return void
252
-     */
253
-    abstract protected function _define_page_props();
254
-
255
-
256
-    /**
257
-     * _set_page_routes
258
-     * child classes use this to define the page routes for all subpages handled by the class.  Page routes are
259
-     * assigned to a action => method pairs in an array and to the $_page_routes property.  Each page route must also
260
-     * have a 'default' route. Here's the format
261
-     * $this->_page_routes = array(
262
-     *        'default' => array(
263
-     *            'func' => '_default_method_handling_route',
264
-     *            'args' => array('array','of','args'),
265
-     *            'noheader' => true, //add this in if this page route is processed before any headers are loaded (i.e.
266
-     *            ajax request, backend processing)
267
-     *            'headers_sent_route'=>'headers_route_reference', //add this if noheader=>true, and you want to load a
268
-     *            headers route after.  The string you enter here should match the defined route reference for a
269
-     *            headers sent route.
270
-     *            'capability' => 'route_capability', //indicate a string for minimum capability required to access
271
-     *            this route.
272
-     *            'obj_id' => 10 // if this route has an object id, then this can include it (used for capability
273
-     *            checks).
274
-     *        ),
275
-     *        'insert_item' => '_method_for_handling_insert_item' //this can be used if all we need to have is a
276
-     *        handling method.
277
-     *        )
278
-     * )
279
-     *
280
-     * @abstract
281
-     * @return void
282
-     */
283
-    abstract protected function _set_page_routes();
284
-
285
-
286
-    /**
287
-     * _set_page_config
288
-     * child classes use this to define the _page_config array for all subpages handled by the class. Each key in the
289
-     * array corresponds to the page_route for the loaded page. Format:
290
-     * $this->_page_config = array(
291
-     *        'default' => array(
292
-     *            'labels' => array(
293
-     *                'buttons' => array(
294
-     *                    'add' => esc_html__('label for adding item'),
295
-     *                    'edit' => esc_html__('label for editing item'),
296
-     *                    'delete' => esc_html__('label for deleting item')
297
-     *                ),
298
-     *                'publishbox' => esc_html__('Localized Title for Publish metabox', 'event_espresso')
299
-     *            ), //optional an array of custom labels for various automatically generated elements to use on the
300
-     *            page. If this isn't present then the defaults will be used as set for the $this->_labels in
301
-     *            _define_page_props() method
302
-     *            'nav' => array(
303
-     *                'label' => esc_html__('Label for Tab', 'event_espresso').
304
-     *                'url' => 'http://someurl', //automatically generated UNLESS you define
305
-     *                'css_class' => 'css-class', //automatically generated UNLESS you define
306
-     *                'order' => 10, //required to indicate tab position.
307
-     *                'persistent' => false //if you want the nav tab to ONLY display when the specific route is
308
-     *                displayed then add this parameter.
309
-     *            'list_table' => 'name_of_list_table' //string for list table class to be loaded for this admin_page.
310
-     *            'metaboxes' => array('metabox1', 'metabox2'), //if present this key indicates we want to load
311
-     *            metaboxes set for eventespresso admin pages.
312
-     *            'has_metaboxes' => true, //this boolean flag can simply be used to indicate if the route will have
313
-     *            metaboxes.  Typically this is used if the 'metaboxes' index is not used because metaboxes are added
314
-     *            later.  We just use this flag to make sure the necessary js gets enqueued on page load.
315
-     *            'has_help_popups' => false //defaults(true) //this boolean flag can simply be used to indicate if the
316
-     *            given route has help popups setup and if it does then we need to make sure thickbox is enqueued.
317
-     *            'columns' => array(4, 2), //this key triggers the setup of a page that uses columns (metaboxes).  The
318
-     *            array indicates the max number of columns (4) and the default number of columns on page load (2).
319
-     *            There is an option in the "screen_options" dropdown that is setup so users can pick what columns they
320
-     *            want to display.
321
-     *            'help_tabs' => array( //this is used for adding help tabs to a page
322
-     *                'tab_id' => array(
323
-     *                    'title' => 'tab_title',
324
-     *                    'filename' => 'name_of_file_containing_content', //this is the primary method for setting
325
-     *                    help tab content.  The fallback if it isn't present is to try a the callback.  Filename
326
-     *                    should match a file in the admin folder's "help_tabs" dir (ie..
327
-     *                    events/help_tabs/name_of_file_containing_content.help_tab.php)
328
-     *                    'callback' => 'callback_method_for_content', //if 'filename' isn't present then system will
329
-     *                    attempt to use the callback which should match the name of a method in the class
330
-     *                    ),
331
-     *                'tab2_id' => array(
332
-     *                    'title' => 'tab2 title',
333
-     *                    'filename' => 'file_name_2'
334
-     *                    'callback' => 'callback_method_for_content',
335
-     *                 ),
336
-     *            'help_sidebar' => 'callback_for_sidebar_content', //this is used for setting up the sidebar in the
337
-     *            help tab area on an admin page. @link
338
-     *            http://make.wordpress.org/core/2011/12/06/help-and-screen-api-changes-in-3-3/
339
-     *            'help_tour' => array(
340
-     *                'name_of_help_tour_class', //all help tours shoudl be a child class of EE_Help_Tour and located
341
-     *                in a folder for this admin page named "help_tours", a file name matching the key given here
342
-     *                (name_of_help_tour_class.class.php), and class matching key given here (name_of_help_tour_class)
343
-     *            ),
344
-     *            'require_nonce' => TRUE //this is used if you want to set a route to NOT require a nonce (default is
345
-     *            true if it isn't present).  To remove the requirement for a nonce check when this route is visited
346
-     *            just set
347
-     *            'require_nonce' to FALSE
348
-     *            )
349
-     * )
350
-     *
351
-     * @abstract
352
-     * @return void
353
-     */
354
-    abstract protected function _set_page_config();
355
-
356
-
357
-
358
-
359
-
360
-    /** end sample help_tour methods **/
361
-    /**
362
-     * _add_screen_options
363
-     * Child classes can add any extra wp_screen_options within this method using built-in WP functions/methods for
364
-     * doing so. Note child classes can also define _add_screen_options_($this->_current_view) to limit screen options
365
-     * to a particular view.
366
-     *
367
-     * @link   http://chrismarslender.com/wp-tutorials/wordpress-screen-options-tutorial/
368
-     *         see also WP_Screen object documents...
369
-     * @link   http://codex.wordpress.org/Class_Reference/WP_Screen
370
-     * @abstract
371
-     * @return void
372
-     */
373
-    abstract protected function _add_screen_options();
374
-
375
-
376
-    /**
377
-     * _add_feature_pointers
378
-     * Child classes should use this method for implementing any "feature pointers" (using built-in WP styling js).
379
-     * Note child classes can also define _add_feature_pointers_($this->_current_view) to limit screen options to a
380
-     * particular view. Note: this is just a placeholder for now.  Implementation will come down the road See:
381
-     * WP_Internal_Pointers class in wp-admin/includes/template.php for example (its a final class so can't be
382
-     * extended) also see:
383
-     *
384
-     * @link   http://eamann.com/tech/wordpress-portland/
385
-     * @abstract
386
-     * @return void
387
-     */
388
-    abstract protected function _add_feature_pointers();
389
-
390
-
391
-    /**
392
-     * load_scripts_styles
393
-     * child classes put their wp_enqueue_script and wp_enqueue_style hooks in here for anything they need loaded for
394
-     * their pages/subpages.  Note this is for all pages/subpages of the system.  You can also load only specific
395
-     * scripts/styles per view by putting them in a dynamic function in this format
396
-     * (load_scripts_styles_{$this->_current_view}) which matches your page route (action request arg)
397
-     *
398
-     * @abstract
399
-     * @return void
400
-     */
401
-    abstract public function load_scripts_styles();
402
-
403
-
404
-    /**
405
-     * admin_init
406
-     * Anything that should be set/executed at 'admin_init' WP hook runtime should be put in here.  This will apply to
407
-     * all pages/views loaded by child class.
408
-     *
409
-     * @abstract
410
-     * @return void
411
-     */
412
-    abstract public function admin_init();
413
-
414
-
415
-    /**
416
-     * admin_notices
417
-     * Anything triggered by the 'admin_notices' WP hook should be put in here.  This particular method will apply to
418
-     * all pages/views loaded by child class.
419
-     *
420
-     * @abstract
421
-     * @return void
422
-     */
423
-    abstract public function admin_notices();
424
-
425
-
426
-    /**
427
-     * admin_footer_scripts
428
-     * Anything triggered by the 'admin_print_footer_scripts' WP hook should be put in here. This particular method
429
-     * will apply to all pages/views loaded by child class.
430
-     *
431
-     * @return void
432
-     */
433
-    abstract public function admin_footer_scripts();
434
-
435
-
436
-    /**
437
-     * admin_footer
438
-     * anything triggered by the 'admin_footer' WP action hook should be added to here. This particular method will
439
-     * apply to all pages/views loaded by child class.
440
-     *
441
-     * @return void
442
-     */
443
-    public function admin_footer()
444
-    {
445
-    }
446
-
447
-
448
-    /**
449
-     * _global_ajax_hooks
450
-     * all global add_action('wp_ajax_{name_of_hook}') hooks in here.
451
-     * Note: within the ajax callback methods.
452
-     *
453
-     * @abstract
454
-     * @return void
455
-     */
456
-    protected function _global_ajax_hooks()
457
-    {
458
-        // for lazy loading of metabox content
459
-        add_action('wp_ajax_espresso-ajax-content', array($this, 'ajax_metabox_content'), 10);
460
-    }
461
-
462
-
463
-    public function ajax_metabox_content()
464
-    {
465
-        $contentid = isset($this->_req_data['contentid']) ? $this->_req_data['contentid'] : '';
466
-        $url = isset($this->_req_data['contenturl']) ? $this->_req_data['contenturl'] : '';
467
-        self::cached_rss_display($contentid, $url);
468
-        wp_die();
469
-    }
470
-
471
-
472
-    /**
473
-     * _page_setup
474
-     * Makes sure any things that need to be loaded early get handled.  We also escape early here if the page requested
475
-     * doesn't match the object.
476
-     *
477
-     * @final
478
-     * @return void
479
-     * @throws EE_Error
480
-     * @throws InvalidArgumentException
481
-     * @throws ReflectionException
482
-     * @throws InvalidDataTypeException
483
-     * @throws InvalidInterfaceException
484
-     */
485
-    final protected function _page_setup()
486
-    {
487
-        // requires?
488
-        // admin_init stuff - global - we're setting this REALLY early so if EE_Admin pages have to hook into other WP pages they can.  But keep in mind, not everything is available from the EE_Admin Page object at this point.
489
-        add_action('admin_init', array($this, 'admin_init_global'), 5);
490
-        // next verify if we need to load anything...
491
-        $this->_current_page = ! empty($_GET['page']) ? sanitize_key($_GET['page']) : '';
492
-        $this->page_folder = strtolower(
493
-            str_replace(array('_Admin_Page', 'Extend_'), '', get_class($this))
494
-        );
495
-        global $ee_menu_slugs;
496
-        $ee_menu_slugs = (array) $ee_menu_slugs;
497
-        if (! defined('DOING_AJAX') && (! $this->_current_page || ! isset($ee_menu_slugs[ $this->_current_page ]))) {
498
-            return;
499
-        }
500
-        // 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
501
-        if (isset($this->_req_data['action2']) && $this->_req_data['action'] === '-1') {
502
-            $this->_req_data['action'] = ! empty($this->_req_data['action2']) && $this->_req_data['action2'] !== '-1'
503
-                ? $this->_req_data['action2']
504
-                : $this->_req_data['action'];
505
-        }
506
-        // then set blank or -1 action values to 'default'
507
-        $this->_req_action = isset($this->_req_data['action'])
508
-                             && ! empty($this->_req_data['action'])
509
-                             && $this->_req_data['action'] !== '-1'
510
-            ? sanitize_key($this->_req_data['action'])
511
-            : 'default';
512
-        // if action is 'default' after the above BUT we have  'route' var set, then let's use the route as the action.
513
-        //  This covers cases where we're coming in from a list table that isn't on the default route.
514
-        $this->_req_action = $this->_req_action === 'default' && isset($this->_req_data['route'])
515
-            ? $this->_req_data['route'] : $this->_req_action;
516
-        // however if we are doing_ajax and we've got a 'route' set then that's what the req_action will be
517
-        $this->_req_action = defined('DOING_AJAX') && isset($this->_req_data['route'])
518
-            ? $this->_req_data['route']
519
-            : $this->_req_action;
520
-        $this->_current_view = $this->_req_action;
521
-        $this->_req_nonce = $this->_req_action . '_nonce';
522
-        $this->_define_page_props();
523
-        $this->_current_page_view_url = add_query_arg(
524
-            array('page' => $this->_current_page, 'action' => $this->_current_view),
525
-            $this->_admin_base_url
526
-        );
527
-        // default things
528
-        $this->_default_espresso_metaboxes = array(
529
-            '_espresso_news_post_box',
530
-            '_espresso_links_post_box',
531
-            '_espresso_ratings_request',
532
-            '_espresso_sponsors_post_box',
533
-        );
534
-        // set page configs
535
-        $this->_set_page_routes();
536
-        $this->_set_page_config();
537
-        // let's include any referrer data in our default_query_args for this route for "stickiness".
538
-        if (isset($this->_req_data['wp_referer'])) {
539
-            $this->_default_route_query_args['wp_referer'] = $this->_req_data['wp_referer'];
540
-        }
541
-        // for caffeinated and other extended functionality.
542
-        //  If there is a _extend_page_config method
543
-        // then let's run that to modify the all the various page configuration arrays
544
-        if (method_exists($this, '_extend_page_config')) {
545
-            $this->_extend_page_config();
546
-        }
547
-        // for CPT and other extended functionality.
548
-        // If there is an _extend_page_config_for_cpt
549
-        // then let's run that to modify all the various page configuration arrays.
550
-        if (method_exists($this, '_extend_page_config_for_cpt')) {
551
-            $this->_extend_page_config_for_cpt();
552
-        }
553
-        // filter routes and page_config so addons can add their stuff. Filtering done per class
554
-        $this->_page_routes = apply_filters(
555
-            'FHEE__' . get_class($this) . '__page_setup__page_routes',
556
-            $this->_page_routes,
557
-            $this
558
-        );
559
-        $this->_page_config = apply_filters(
560
-            'FHEE__' . get_class($this) . '__page_setup__page_config',
561
-            $this->_page_config,
562
-            $this
563
-        );
564
-        // if AHEE__EE_Admin_Page__route_admin_request_$this->_current_view method is present
565
-        // then we call it hooked into the AHEE__EE_Admin_Page__route_admin_request action
566
-        if (method_exists($this, 'AHEE__EE_Admin_Page__route_admin_request_' . $this->_current_view)) {
567
-            add_action(
568
-                'AHEE__EE_Admin_Page__route_admin_request',
569
-                array($this, 'AHEE__EE_Admin_Page__route_admin_request_' . $this->_current_view),
570
-                10,
571
-                2
572
-            );
573
-        }
574
-        // next route only if routing enabled
575
-        if ($this->_routing && ! defined('DOING_AJAX')) {
576
-            $this->_verify_routes();
577
-            // next let's just check user_access and kill if no access
578
-            $this->check_user_access();
579
-            if ($this->_is_UI_request) {
580
-                // admin_init stuff - global, all views for this page class, specific view
581
-                add_action('admin_init', array($this, 'admin_init'), 10);
582
-                if (method_exists($this, 'admin_init_' . $this->_current_view)) {
583
-                    add_action('admin_init', array($this, 'admin_init_' . $this->_current_view), 15);
584
-                }
585
-            } else {
586
-                // hijack regular WP loading and route admin request immediately
587
-                @ini_set('memory_limit', apply_filters('admin_memory_limit', WP_MAX_MEMORY_LIMIT));
588
-                $this->route_admin_request();
589
-            }
590
-        }
591
-    }
592
-
593
-
594
-    /**
595
-     * Provides a way for related child admin pages to load stuff on the loaded admin page.
596
-     *
597
-     * @return void
598
-     * @throws ReflectionException
599
-     * @throws EE_Error
600
-     */
601
-    private function _do_other_page_hooks()
602
-    {
603
-        $registered_pages = apply_filters('FHEE_do_other_page_hooks_' . $this->page_slug, array());
604
-        foreach ($registered_pages as $page) {
605
-            // now let's setup the file name and class that should be present
606
-            $classname = str_replace('.class.php', '', $page);
607
-            // autoloaders should take care of loading file
608
-            if (! class_exists($classname)) {
609
-                $error_msg[] = sprintf(
610
-                    esc_html__(
611
-                        'Something went wrong with loading the %s admin hooks page.',
612
-                        'event_espresso'
613
-                    ),
614
-                    $page
615
-                );
616
-                $error_msg[] = $error_msg[0]
617
-                               . "\r\n"
618
-                               . sprintf(
619
-                                   esc_html__(
620
-                                       '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',
621
-                                       'event_espresso'
622
-                                   ),
623
-                                   $page,
624
-                                   '<br />',
625
-                                   '<strong>' . $classname . '</strong>'
626
-                               );
627
-                throw new EE_Error(implode('||', $error_msg));
628
-            }
629
-            $a = new ReflectionClass($classname);
630
-            // notice we are passing the instance of this class to the hook object.
631
-            $hookobj[] = $a->newInstance($this);
632
-        }
633
-    }
634
-
635
-
636
-    public function load_page_dependencies()
637
-    {
638
-        try {
639
-            $this->_load_page_dependencies();
640
-        } catch (EE_Error $e) {
641
-            $e->get_error();
642
-        }
643
-    }
644
-
645
-
646
-    /**
647
-     * load_page_dependencies
648
-     * loads things specific to this page class when its loaded.  Really helps with efficiency.
649
-     *
650
-     * @return void
651
-     * @throws DomainException
652
-     * @throws EE_Error
653
-     * @throws InvalidArgumentException
654
-     * @throws InvalidDataTypeException
655
-     * @throws InvalidInterfaceException
656
-     * @throws ReflectionException
657
-     */
658
-    protected function _load_page_dependencies()
659
-    {
660
-        // let's set the current_screen and screen options to override what WP set
661
-        $this->_current_screen = get_current_screen();
662
-        // load admin_notices - global, page class, and view specific
663
-        add_action('admin_notices', array($this, 'admin_notices_global'), 5);
664
-        add_action('admin_notices', array($this, 'admin_notices'), 10);
665
-        if (method_exists($this, 'admin_notices_' . $this->_current_view)) {
666
-            add_action('admin_notices', array($this, 'admin_notices_' . $this->_current_view), 15);
667
-        }
668
-        // load network admin_notices - global, page class, and view specific
669
-        add_action('network_admin_notices', array($this, 'network_admin_notices_global'), 5);
670
-        if (method_exists($this, 'network_admin_notices_' . $this->_current_view)) {
671
-            add_action('network_admin_notices', array($this, 'network_admin_notices_' . $this->_current_view));
672
-        }
673
-        // this will save any per_page screen options if they are present
674
-        $this->_set_per_page_screen_options();
675
-        // setup list table properties
676
-        $this->_set_list_table();
677
-        // child classes can "register" a metabox to be automatically handled via the _page_config array property.
678
-        // However in some cases the metaboxes will need to be added within a route handling callback.
679
-        $this->_add_registered_meta_boxes();
680
-        $this->_add_screen_columns();
681
-        // add screen options - global, page child class, and view specific
682
-        $this->_add_global_screen_options();
683
-        $this->_add_screen_options();
684
-        $add_screen_options = "_add_screen_options_{$this->_current_view}";
685
-        if (method_exists($this, $add_screen_options)) {
686
-            $this->{$add_screen_options}();
687
-        }
688
-        // add help tab(s) and tours- set via page_config and qtips.
689
-        $this->_add_help_tour();
690
-        $this->_add_help_tabs();
691
-        $this->_add_qtips();
692
-        // add feature_pointers - global, page child class, and view specific
693
-        $this->_add_feature_pointers();
694
-        $this->_add_global_feature_pointers();
695
-        $add_feature_pointer = "_add_feature_pointer_{$this->_current_view}";
696
-        if (method_exists($this, $add_feature_pointer)) {
697
-            $this->{$add_feature_pointer}();
698
-        }
699
-        // enqueue scripts/styles - global, page class, and view specific
700
-        add_action('admin_enqueue_scripts', array($this, 'load_global_scripts_styles'), 5);
701
-        add_action('admin_enqueue_scripts', array($this, 'load_scripts_styles'), 10);
702
-        if (method_exists($this, "load_scripts_styles_{$this->_current_view}")) {
703
-            add_action('admin_enqueue_scripts', array($this, "load_scripts_styles_{$this->_current_view}"), 15);
704
-        }
705
-        add_action('admin_enqueue_scripts', array($this, 'admin_footer_scripts_eei18n_js_strings'), 100);
706
-        // admin_print_footer_scripts - global, page child class, and view specific.
707
-        // NOTE, despite the name, whenever possible, scripts should NOT be loaded using this.
708
-        // In most cases that's doing_it_wrong().  But adding hidden container elements etc.
709
-        // is a good use case. Notice the late priority we're giving these
710
-        add_action('admin_print_footer_scripts', array($this, 'admin_footer_scripts_global'), 99);
711
-        add_action('admin_print_footer_scripts', array($this, 'admin_footer_scripts'), 100);
712
-        if (method_exists($this, "admin_footer_scripts_{$this->_current_view}")) {
713
-            add_action('admin_print_footer_scripts', array($this, "admin_footer_scripts_{$this->_current_view}"), 101);
714
-        }
715
-        // admin footer scripts
716
-        add_action('admin_footer', array($this, 'admin_footer_global'), 99);
717
-        add_action('admin_footer', array($this, 'admin_footer'), 100);
718
-        if (method_exists($this, "admin_footer_{$this->_current_view}")) {
719
-            add_action('admin_footer', array($this, "admin_footer_{$this->_current_view}"), 101);
720
-        }
721
-        do_action('FHEE__EE_Admin_Page___load_page_dependencies__after_load', $this->page_slug);
722
-        // targeted hook
723
-        do_action(
724
-            "FHEE__EE_Admin_Page___load_page_dependencies__after_load__{$this->page_slug}__{$this->_req_action}"
725
-        );
726
-    }
727
-
728
-
729
-    /**
730
-     * _set_defaults
731
-     * This sets some global defaults for class properties.
732
-     */
733
-    private function _set_defaults()
734
-    {
735
-        $this->_current_screen = $this->_admin_page_title = $this->_req_action = $this->_req_nonce = null;
736
-        $this->_event = $this->_template_path = $this->_column_template_path = null;
737
-        $this->_nav_tabs = $this->_views = $this->_page_routes = array();
738
-        $this->_page_config = $this->_default_route_query_args = array();
739
-        $this->_default_nav_tab_name = 'overview';
740
-        // init template args
741
-        $this->_template_args = array(
742
-            'admin_page_header'  => '',
743
-            'admin_page_content' => '',
744
-            'post_body_content'  => '',
745
-            'before_list_table'  => '',
746
-            'after_list_table'   => '',
747
-        );
748
-    }
749
-
750
-
751
-    /**
752
-     * route_admin_request
753
-     *
754
-     * @see    _route_admin_request()
755
-     * @return exception|void error
756
-     * @throws InvalidArgumentException
757
-     * @throws InvalidInterfaceException
758
-     * @throws InvalidDataTypeException
759
-     * @throws EE_Error
760
-     * @throws ReflectionException
761
-     */
762
-    public function route_admin_request()
763
-    {
764
-        try {
765
-            $this->_route_admin_request();
766
-        } catch (EE_Error $e) {
767
-            $e->get_error();
768
-        }
769
-    }
770
-
771
-
772
-    public function set_wp_page_slug($wp_page_slug)
773
-    {
774
-        $this->_wp_page_slug = $wp_page_slug;
775
-        // if in network admin then we need to append "-network" to the page slug. Why? Because that's how WP rolls...
776
-        if (is_network_admin()) {
777
-            $this->_wp_page_slug .= '-network';
778
-        }
779
-    }
780
-
781
-
782
-    /**
783
-     * _verify_routes
784
-     * All this method does is verify the incoming request and make sure that routes exist for it.  We do this early so
785
-     * we know if we need to drop out.
786
-     *
787
-     * @return bool
788
-     * @throws EE_Error
789
-     */
790
-    protected function _verify_routes()
791
-    {
792
-        do_action('AHEE_log', __FILE__, __FUNCTION__, '');
793
-        if (! $this->_current_page && ! defined('DOING_AJAX')) {
794
-            return false;
795
-        }
796
-        $this->_route = false;
797
-        // check that the page_routes array is not empty
798
-        if (empty($this->_page_routes)) {
799
-            // user error msg
800
-            $error_msg = sprintf(
801
-                esc_html__('No page routes have been set for the %s admin page.', 'event_espresso'),
802
-                $this->_admin_page_title
803
-            );
804
-            // developer error msg
805
-            $error_msg .= '||' . $error_msg
806
-                          . esc_html__(
807
-                              ' Make sure the "set_page_routes()" method exists, and is setting the "_page_routes" array properly.',
808
-                              'event_espresso'
809
-                          );
810
-            throw new EE_Error($error_msg);
811
-        }
812
-        // and that the requested page route exists
813
-        if (array_key_exists($this->_req_action, $this->_page_routes)) {
814
-            $this->_route = $this->_page_routes[ $this->_req_action ];
815
-            $this->_route_config = isset($this->_page_config[ $this->_req_action ])
816
-                ? $this->_page_config[ $this->_req_action ] : array();
817
-        } else {
818
-            // user error msg
819
-            $error_msg = sprintf(
820
-                esc_html__(
821
-                    'The requested page route does not exist for the %s admin page.',
822
-                    'event_espresso'
823
-                ),
824
-                $this->_admin_page_title
825
-            );
826
-            // developer error msg
827
-            $error_msg .= '||' . $error_msg
828
-                          . sprintf(
829
-                              esc_html__(
830
-                                  ' Create a key in the "_page_routes" array named "%s" and set its value to the appropriate method.',
831
-                                  'event_espresso'
832
-                              ),
833
-                              $this->_req_action
834
-                          );
835
-            throw new EE_Error($error_msg);
836
-        }
837
-        // and that a default route exists
838
-        if (! array_key_exists('default', $this->_page_routes)) {
839
-            // user error msg
840
-            $error_msg = sprintf(
841
-                esc_html__(
842
-                    'A default page route has not been set for the % admin page.',
843
-                    'event_espresso'
844
-                ),
845
-                $this->_admin_page_title
846
-            );
847
-            // developer error msg
848
-            $error_msg .= '||' . $error_msg
849
-                          . esc_html__(
850
-                              ' Create a key in the "_page_routes" array named "default" and set its value to your default page method.',
851
-                              'event_espresso'
852
-                          );
853
-            throw new EE_Error($error_msg);
854
-        }
855
-        // first lets' catch if the UI request has EVER been set.
856
-        if ($this->_is_UI_request === null) {
857
-            // lets set if this is a UI request or not.
858
-            $this->_is_UI_request = ! isset($this->_req_data['noheader']) || $this->_req_data['noheader'] !== true;
859
-            // wait a minute... we might have a noheader in the route array
860
-            $this->_is_UI_request = is_array($this->_route)
861
-                                    && isset($this->_route['noheader'])
862
-                                    && $this->_route['noheader'] ? false : $this->_is_UI_request;
863
-        }
864
-        $this->_set_current_labels();
865
-        return true;
866
-    }
867
-
868
-
869
-    /**
870
-     * this method simply verifies a given route and makes sure its an actual route available for the loaded page
871
-     *
872
-     * @param  string $route the route name we're verifying
873
-     * @return mixed (bool|Exception)      we'll throw an exception if this isn't a valid route.
874
-     * @throws EE_Error
875
-     */
876
-    protected function _verify_route($route)
877
-    {
878
-        if (array_key_exists($this->_req_action, $this->_page_routes)) {
879
-            return true;
880
-        }
881
-        // user error msg
882
-        $error_msg = sprintf(
883
-            esc_html__('The given page route does not exist for the %s admin page.', 'event_espresso'),
884
-            $this->_admin_page_title
885
-        );
886
-        // developer error msg
887
-        $error_msg .= '||' . $error_msg
888
-                      . sprintf(
889
-                          esc_html__(
890
-                              ' Check the route you are using in your method (%s) and make sure it matches a route set in your "_page_routes" array property',
891
-                              'event_espresso'
892
-                          ),
893
-                          $route
894
-                      );
895
-        throw new EE_Error($error_msg);
896
-    }
897
-
898
-
899
-    /**
900
-     * perform nonce verification
901
-     * This method has be encapsulated here so that any ajax requests that bypass normal routes can verify their nonces
902
-     * using this method (and save retyping!)
903
-     *
904
-     * @param  string $nonce     The nonce sent
905
-     * @param  string $nonce_ref The nonce reference string (name0)
906
-     * @return void
907
-     * @throws EE_Error
908
-     */
909
-    protected function _verify_nonce($nonce, $nonce_ref)
910
-    {
911
-        // verify nonce against expected value
912
-        if (! wp_verify_nonce($nonce, $nonce_ref)) {
913
-            // these are not the droids you are looking for !!!
914
-            $msg = sprintf(
915
-                esc_html__('%sNonce Fail.%s', 'event_espresso'),
916
-                '<a href="http://www.youtube.com/watch?v=56_S0WeTkzs">',
917
-                '</a>'
918
-            );
919
-            if (WP_DEBUG) {
920
-                $msg .= "\n  "
921
-                        . sprintf(
922
-                            esc_html__(
923
-                                'In order to dynamically generate nonces for your actions, use the %s::add_query_args_and_nonce() method. May the Nonce be with you!',
924
-                                'event_espresso'
925
-                            ),
926
-                            __CLASS__
927
-                        );
928
-            }
929
-            if (! defined('DOING_AJAX')) {
930
-                wp_die($msg);
931
-            } else {
932
-                EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
933
-                $this->_return_json();
934
-            }
935
-        }
936
-    }
937
-
938
-
939
-    /**
940
-     * _route_admin_request()
941
-     * Meat and potatoes of the class.  Basically, this dude checks out what's being requested and sees if theres are
942
-     * some doodads to work the magic and handle the flingjangy. Translation:  Checks if the requested action is listed
943
-     * in the page routes and then will try to load the corresponding method.
944
-     *
945
-     * @return void
946
-     * @throws EE_Error
947
-     * @throws InvalidArgumentException
948
-     * @throws InvalidDataTypeException
949
-     * @throws InvalidInterfaceException
950
-     * @throws ReflectionException
951
-     */
952
-    protected function _route_admin_request()
953
-    {
954
-        if (! $this->_is_UI_request) {
955
-            $this->_verify_routes();
956
-        }
957
-        $nonce_check = isset($this->_route_config['require_nonce'])
958
-            ? $this->_route_config['require_nonce']
959
-            : true;
960
-        if ($this->_req_action !== 'default' && $nonce_check) {
961
-            // set nonce from post data
962
-            $nonce = isset($this->_req_data[ $this->_req_nonce ])
963
-                ? sanitize_text_field($this->_req_data[ $this->_req_nonce ])
964
-                : '';
965
-            $this->_verify_nonce($nonce, $this->_req_nonce);
966
-        }
967
-        // set the nav_tabs array but ONLY if this is  UI_request
968
-        if ($this->_is_UI_request) {
969
-            $this->_set_nav_tabs();
970
-        }
971
-        // grab callback function
972
-        $func = is_array($this->_route) ? $this->_route['func'] : $this->_route;
973
-        // check if callback has args
974
-        $args = is_array($this->_route) && isset($this->_route['args']) ? $this->_route['args'] : array();
975
-        $error_msg = '';
976
-        // action right before calling route
977
-        // (hook is something like 'AHEE__Registrations_Admin_Page__route_admin_request')
978
-        if (! did_action('AHEE__EE_Admin_Page__route_admin_request')) {
979
-            do_action('AHEE__EE_Admin_Page__route_admin_request', $this->_current_view, $this);
980
-        }
981
-        // right before calling the route, let's remove _wp_http_referer from the
982
-        // $_SERVER[REQUEST_URI] global (its now in _req_data for route processing).
983
-        $_SERVER['REQUEST_URI'] = remove_query_arg(
984
-            '_wp_http_referer',
985
-            wp_unslash($_SERVER['REQUEST_URI'])
986
-        );
987
-        if (! empty($func)) {
988
-            if (is_array($func)) {
989
-                list($class, $method) = $func;
990
-            } elseif (strpos($func, '::') !== false) {
991
-                list($class, $method) = explode('::', $func);
992
-            } else {
993
-                $class = $this;
994
-                $method = $func;
995
-            }
996
-            if (! (is_object($class) && $class === $this)) {
997
-                // send along this admin page object for access by addons.
998
-                $args['admin_page_object'] = $this;
999
-            }
1000
-            if (// is it a method on a class that doesn't work?
1001
-                (
1002
-                    (
1003
-                        method_exists($class, $method)
1004
-                        && call_user_func_array(array($class, $method), $args) === false
1005
-                    )
1006
-                    && (
1007
-                        // is it a standalone function that doesn't work?
1008
-                        function_exists($method)
1009
-                        && call_user_func_array(
1010
-                            $func,
1011
-                            array_merge(array('admin_page_object' => $this), $args)
1012
-                        ) === false
1013
-                    )
1014
-                )
1015
-                || (
1016
-                    // is it neither a class method NOR a standalone function?
1017
-                    ! method_exists($class, $method)
1018
-                    && ! function_exists($method)
1019
-                )
1020
-            ) {
1021
-                // user error msg
1022
-                $error_msg = esc_html__(
1023
-                    'An error occurred. The  requested page route could not be found.',
1024
-                    'event_espresso'
1025
-                );
1026
-                // developer error msg
1027
-                $error_msg .= '||';
1028
-                $error_msg .= sprintf(
1029
-                    esc_html__(
1030
-                        'Page route "%s" could not be called. Check that the spelling for method names and actions in the "_page_routes" array are all correct.',
1031
-                        'event_espresso'
1032
-                    ),
1033
-                    $method
1034
-                );
1035
-            }
1036
-            if (! empty($error_msg)) {
1037
-                throw new EE_Error($error_msg);
1038
-            }
1039
-        }
1040
-        // if we've routed and this route has a no headers route AND a sent_headers_route,
1041
-        // then we need to reset the routing properties to the new route.
1042
-        // 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.
1043
-        if ($this->_is_UI_request === false
1044
-            && is_array($this->_route)
1045
-            && ! empty($this->_route['headers_sent_route'])
1046
-        ) {
1047
-            $this->_reset_routing_properties($this->_route['headers_sent_route']);
1048
-        }
1049
-    }
1050
-
1051
-
1052
-    /**
1053
-     * This method just allows the resetting of page properties in the case where a no headers
1054
-     * route redirects to a headers route in its route config.
1055
-     *
1056
-     * @since   4.3.0
1057
-     * @param  string $new_route New (non header) route to redirect to.
1058
-     * @return   void
1059
-     * @throws ReflectionException
1060
-     * @throws InvalidArgumentException
1061
-     * @throws InvalidInterfaceException
1062
-     * @throws InvalidDataTypeException
1063
-     * @throws EE_Error
1064
-     */
1065
-    protected function _reset_routing_properties($new_route)
1066
-    {
1067
-        $this->_is_UI_request = true;
1068
-        // now we set the current route to whatever the headers_sent_route is set at
1069
-        $this->_req_data['action'] = $new_route;
1070
-        // rerun page setup
1071
-        $this->_page_setup();
1072
-    }
1073
-
1074
-
1075
-    /**
1076
-     * _add_query_arg
1077
-     * adds nonce to array of arguments then calls WP add_query_arg function
1078
-     *(internally just uses EEH_URL's function with the same name)
1079
-     *
1080
-     * @param array  $args
1081
-     * @param string $url
1082
-     * @param bool   $sticky                  if true, then the existing Request params will be appended to the
1083
-     *                                        generated url in an associative array indexed by the key 'wp_referer';
1084
-     *                                        Example usage: If the current page is:
1085
-     *                                        http://mydomain.com/wp-admin/admin.php?page=espresso_registrations
1086
-     *                                        &action=default&event_id=20&month_range=March%202015
1087
-     *                                        &_wpnonce=5467821
1088
-     *                                        and you call:
1089
-     *                                        EE_Admin_Page::add_query_args_and_nonce(
1090
-     *                                        array(
1091
-     *                                        'action' => 'resend_something',
1092
-     *                                        'page=>espresso_registrations'
1093
-     *                                        ),
1094
-     *                                        $some_url,
1095
-     *                                        true
1096
-     *                                        );
1097
-     *                                        It will produce a url in this structure:
1098
-     *                                        http://{$some_url}/?page=espresso_registrations&action=resend_something
1099
-     *                                        &wp_referer[action]=default&wp_referer[event_id]=20&wpreferer[
1100
-     *                                        month_range]=March%202015
1101
-     * @param   bool $exclude_nonce           If true, the the nonce will be excluded from the generated nonce.
1102
-     * @return string
1103
-     */
1104
-    public static function add_query_args_and_nonce(
1105
-        $args = array(),
1106
-        $url = false,
1107
-        $sticky = false,
1108
-        $exclude_nonce = false
1109
-    ) {
1110
-        // if there is a _wp_http_referer include the values from the request but only if sticky = true
1111
-        if ($sticky) {
1112
-            $request = $_REQUEST;
1113
-            unset($request['_wp_http_referer']);
1114
-            unset($request['wp_referer']);
1115
-            foreach ($request as $key => $value) {
1116
-                // do not add nonces
1117
-                if (strpos($key, 'nonce') !== false) {
1118
-                    continue;
1119
-                }
1120
-                $args[ 'wp_referer[' . $key . ']' ] = $value;
1121
-            }
1122
-        }
1123
-        return EEH_URL::add_query_args_and_nonce($args, $url, $exclude_nonce);
1124
-    }
1125
-
1126
-
1127
-    /**
1128
-     * This returns a generated link that will load the related help tab.
1129
-     *
1130
-     * @param  string $help_tab_id the id for the connected help tab
1131
-     * @param  string $icon_style  (optional) include css class for the style you want to use for the help icon.
1132
-     * @param  string $help_text   (optional) send help text you want to use for the link if default not to be used
1133
-     * @uses EEH_Template::get_help_tab_link()
1134
-     * @return string              generated link
1135
-     */
1136
-    protected function _get_help_tab_link($help_tab_id, $icon_style = '', $help_text = '')
1137
-    {
1138
-        return EEH_Template::get_help_tab_link(
1139
-            $help_tab_id,
1140
-            $this->page_slug,
1141
-            $this->_req_action,
1142
-            $icon_style,
1143
-            $help_text
1144
-        );
1145
-    }
1146
-
1147
-
1148
-    /**
1149
-     * _add_help_tabs
1150
-     * Note child classes define their help tabs within the page_config array.
1151
-     *
1152
-     * @link   http://codex.wordpress.org/Function_Reference/add_help_tab
1153
-     * @return void
1154
-     * @throws DomainException
1155
-     * @throws EE_Error
1156
-     */
1157
-    protected function _add_help_tabs()
1158
-    {
1159
-        $tour_buttons = '';
1160
-        if (isset($this->_page_config[ $this->_req_action ])) {
1161
-            $config = $this->_page_config[ $this->_req_action ];
1162
-            // is there a help tour for the current route?  if there is let's setup the tour buttons
1163
-            if (isset($this->_help_tour[ $this->_req_action ])) {
1164
-                $tb = array();
1165
-                $tour_buttons = '<div class="ee-abs-container"><div class="ee-help-tour-restart-buttons">';
1166
-                foreach ($this->_help_tour['tours'] as $tour) {
1167
-                    // if this is the end tour then we don't need to setup a button
1168
-                    if ($tour instanceof EE_Help_Tour_final_stop || ! $tour instanceof EE_Help_Tour) {
1169
-                        continue;
1170
-                    }
1171
-                    $tb[] = '<button id="trigger-tour-'
1172
-                            . $tour->get_slug()
1173
-                            . '" class="button-primary trigger-ee-help-tour">'
1174
-                            . $tour->get_label()
1175
-                            . '</button>';
1176
-                }
1177
-                $tour_buttons .= implode('<br />', $tb);
1178
-                $tour_buttons .= '</div></div>';
1179
-            }
1180
-            // let's see if there is a help_sidebar set for the current route and we'll set that up for usage as well.
1181
-            if (is_array($config) && isset($config['help_sidebar'])) {
1182
-                // check that the callback given is valid
1183
-                if (! method_exists($this, $config['help_sidebar'])) {
1184
-                    throw new EE_Error(
1185
-                        sprintf(
1186
-                            esc_html__(
1187
-                                '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',
1188
-                                'event_espresso'
1189
-                            ),
1190
-                            $config['help_sidebar'],
1191
-                            get_class($this)
1192
-                        )
1193
-                    );
1194
-                }
1195
-                $content = apply_filters(
1196
-                    'FHEE__' . get_class($this) . '__add_help_tabs__help_sidebar',
1197
-                    $this->{$config['help_sidebar']}()
1198
-                );
1199
-                $content .= $tour_buttons; // add help tour buttons.
1200
-                // do we have any help tours setup?  Cause if we do we want to add the buttons
1201
-                $this->_current_screen->set_help_sidebar($content);
1202
-            }
1203
-            // if we DON'T have config help sidebar and there ARE tour buttons then we'll just add the tour buttons to the sidebar.
1204
-            if (! isset($config['help_sidebar']) && ! empty($tour_buttons)) {
1205
-                $this->_current_screen->set_help_sidebar($tour_buttons);
1206
-            }
1207
-            // handle if no help_tabs are set so the sidebar will still show for the help tour buttons
1208
-            if (! isset($config['help_tabs']) && ! empty($tour_buttons)) {
1209
-                $_ht['id'] = $this->page_slug;
1210
-                $_ht['title'] = esc_html__('Help Tours', 'event_espresso');
1211
-                $_ht['content'] = '<p>'
1212
-                                  . esc_html__(
1213
-                                      'The buttons to the right allow you to start/restart any help tours available for this page',
1214
-                                      'event_espresso'
1215
-                                  ) . '</p>';
1216
-                $this->_current_screen->add_help_tab($_ht);
1217
-            }
1218
-            if (! isset($config['help_tabs'])) {
1219
-                return;
1220
-            } //no help tabs for this route
1221
-            foreach ((array) $config['help_tabs'] as $tab_id => $cfg) {
1222
-                // we're here so there ARE help tabs!
1223
-                // make sure we've got what we need
1224
-                if (! isset($cfg['title'])) {
1225
-                    throw new EE_Error(
1226
-                        esc_html__(
1227
-                            'The _page_config array is not set up properly for help tabs.  It is missing a title',
1228
-                            'event_espresso'
1229
-                        )
1230
-                    );
1231
-                }
1232
-                if (! isset($cfg['filename']) && ! isset($cfg['callback']) && ! isset($cfg['content'])) {
1233
-                    throw new EE_Error(
1234
-                        esc_html__(
1235
-                            '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',
1236
-                            'event_espresso'
1237
-                        )
1238
-                    );
1239
-                }
1240
-                // first priority goes to content.
1241
-                if (! empty($cfg['content'])) {
1242
-                    $content = ! empty($cfg['content']) ? $cfg['content'] : null;
1243
-                    // second priority goes to filename
1244
-                } elseif (! empty($cfg['filename'])) {
1245
-                    $file_path = $this->_get_dir() . '/help_tabs/' . $cfg['filename'] . '.help_tab.php';
1246
-                    // 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)
1247
-                    $file_path = ! is_readable($file_path) ? EE_ADMIN_PAGES
1248
-                                                             . basename($this->_get_dir())
1249
-                                                             . '/help_tabs/'
1250
-                                                             . $cfg['filename']
1251
-                                                             . '.help_tab.php' : $file_path;
1252
-                    // if file is STILL not readable then let's do a EE_Error so its more graceful than a fatal error.
1253
-                    if (! isset($cfg['callback']) && ! is_readable($file_path)) {
1254
-                        EE_Error::add_error(
1255
-                            sprintf(
1256
-                                esc_html__(
1257
-                                    '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',
1258
-                                    'event_espresso'
1259
-                                ),
1260
-                                $tab_id,
1261
-                                key($config),
1262
-                                $file_path
1263
-                            ),
1264
-                            __FILE__,
1265
-                            __FUNCTION__,
1266
-                            __LINE__
1267
-                        );
1268
-                        return;
1269
-                    }
1270
-                    $template_args['admin_page_obj'] = $this;
1271
-                    $content = EEH_Template::display_template(
1272
-                        $file_path,
1273
-                        $template_args,
1274
-                        true
1275
-                    );
1276
-                } else {
1277
-                    $content = '';
1278
-                }
1279
-                // check if callback is valid
1280
-                if (empty($content) && (
1281
-                        ! isset($cfg['callback']) || ! method_exists($this, $cfg['callback'])
1282
-                    )
1283
-                ) {
1284
-                    EE_Error::add_error(
1285
-                        sprintf(
1286
-                            esc_html__(
1287
-                                '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.',
1288
-                                'event_espresso'
1289
-                            ),
1290
-                            $cfg['title']
1291
-                        ),
1292
-                        __FILE__,
1293
-                        __FUNCTION__,
1294
-                        __LINE__
1295
-                    );
1296
-                    return;
1297
-                }
1298
-                // setup config array for help tab method
1299
-                $id = $this->page_slug . '-' . $this->_req_action . '-' . $tab_id;
1300
-                $_ht = array(
1301
-                    'id'       => $id,
1302
-                    'title'    => $cfg['title'],
1303
-                    'callback' => isset($cfg['callback']) && empty($content) ? array($this, $cfg['callback']) : null,
1304
-                    'content'  => $content,
1305
-                );
1306
-                $this->_current_screen->add_help_tab($_ht);
1307
-            }
1308
-        }
1309
-    }
1310
-
1311
-
1312
-    /**
1313
-     * This basically checks loaded $_page_config property to see if there are any help_tours defined.  "help_tours" is
1314
-     * an array with properties for setting up usage of the joyride plugin
1315
-     *
1316
-     * @link   http://zurb.com/playground/jquery-joyride-feature-tour-plugin
1317
-     * @see    instructions regarding the format and construction of the "help_tour" array element is found in the
1318
-     *         _set_page_config() comments
1319
-     * @return void
1320
-     * @throws EE_Error
1321
-     * @throws InvalidArgumentException
1322
-     * @throws InvalidDataTypeException
1323
-     * @throws InvalidInterfaceException
1324
-     */
1325
-    protected function _add_help_tour()
1326
-    {
1327
-        $tours = array();
1328
-        $this->_help_tour = array();
1329
-        // exit early if help tours are turned off globally
1330
-        if ((defined('EE_DISABLE_HELP_TOURS') && EE_DISABLE_HELP_TOURS)
1331
-            || ! EE_Registry::instance()->CFG->admin->help_tour_activation
1332
-        ) {
1333
-            return;
1334
-        }
1335
-        // loop through _page_config to find any help_tour defined
1336
-        foreach ($this->_page_config as $route => $config) {
1337
-            // we're only going to set things up for this route
1338
-            if ($route !== $this->_req_action) {
1339
-                continue;
1340
-            }
1341
-            if (isset($config['help_tour'])) {
1342
-                foreach ($config['help_tour'] as $tour) {
1343
-                    $file_path = $this->_get_dir() . '/help_tours/' . $tour . '.class.php';
1344
-                    // let's see if we can get that file...
1345
-                    // if not its possible this is a decaf route not set in caffeinated
1346
-                    // so lets try and get the caffeinated equivalent
1347
-                    $file_path = ! is_readable($file_path) ? EE_ADMIN_PAGES
1348
-                                                             . basename($this->_get_dir())
1349
-                                                             . '/help_tours/'
1350
-                                                             . $tour
1351
-                                                             . '.class.php' : $file_path;
1352
-                    // if file is STILL not readable then let's do a EE_Error so its more graceful than a fatal error.
1353
-                    if (! is_readable($file_path)) {
1354
-                        EE_Error::add_error(
1355
-                            sprintf(
1356
-                                esc_html__(
1357
-                                    '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',
1358
-                                    'event_espresso'
1359
-                                ),
1360
-                                $file_path,
1361
-                                $tour
1362
-                            ),
1363
-                            __FILE__,
1364
-                            __FUNCTION__,
1365
-                            __LINE__
1366
-                        );
1367
-                        return;
1368
-                    }
1369
-                    require_once $file_path;
1370
-                    if (! class_exists($tour)) {
1371
-                        $error_msg[] = sprintf(
1372
-                            esc_html__('Something went wrong with loading the %s Help Tour Class.', 'event_espresso'),
1373
-                            $tour
1374
-                        );
1375
-                        $error_msg[] = $error_msg[0] . "\r\n"
1376
-                                       . sprintf(
1377
-                                           esc_html__(
1378
-                                               '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.',
1379
-                                               'event_espresso'
1380
-                                           ),
1381
-                                           $tour,
1382
-                                           '<br />',
1383
-                                           $tour,
1384
-                                           $this->_req_action,
1385
-                                           get_class($this)
1386
-                                       );
1387
-                        throw new EE_Error(implode('||', $error_msg));
1388
-                    }
1389
-                    $tour_obj = new $tour($this->_is_caf);
1390
-                    $tours[] = $tour_obj;
1391
-                    $this->_help_tour[ $route ][] = EEH_Template::help_tour_stops_generator($tour_obj);
1392
-                }
1393
-                // let's inject the end tour stop element common to all pages... this will only get seen once per machine.
1394
-                $end_stop_tour = new EE_Help_Tour_final_stop($this->_is_caf);
1395
-                $tours[] = $end_stop_tour;
1396
-                $this->_help_tour[ $route ][] = EEH_Template::help_tour_stops_generator($end_stop_tour);
1397
-            }
1398
-        }
1399
-        if (! empty($tours)) {
1400
-            $this->_help_tour['tours'] = $tours;
1401
-        }
1402
-        // that's it!  Now that the $_help_tours property is set (or not)
1403
-        // the scripts and html should be taken care of automatically.
1404
-    }
1405
-
1406
-
1407
-    /**
1408
-     * This simply sets up any qtips that have been defined in the page config
1409
-     *
1410
-     * @return void
1411
-     */
1412
-    protected function _add_qtips()
1413
-    {
1414
-        if (isset($this->_route_config['qtips'])) {
1415
-            $qtips = (array) $this->_route_config['qtips'];
1416
-            // load qtip loader
1417
-            $path = array(
1418
-                $this->_get_dir() . '/qtips/',
1419
-                EE_ADMIN_PAGES . basename($this->_get_dir()) . '/qtips/',
1420
-            );
1421
-            EEH_Qtip_Loader::instance()->register($qtips, $path);
1422
-        }
1423
-    }
1424
-
1425
-
1426
-    /**
1427
-     * _set_nav_tabs
1428
-     * This sets up the nav tabs from the page_routes array.  This method can be overwritten by child classes if you
1429
-     * wish to add additional tabs or modify accordingly.
1430
-     *
1431
-     * @return void
1432
-     * @throws InvalidArgumentException
1433
-     * @throws InvalidInterfaceException
1434
-     * @throws InvalidDataTypeException
1435
-     */
1436
-    protected function _set_nav_tabs()
1437
-    {
1438
-        do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1439
-        $i = 0;
1440
-        foreach ($this->_page_config as $slug => $config) {
1441
-            if (! is_array($config)
1442
-                || (
1443
-                    is_array($config)
1444
-                    && (
1445
-                        (isset($config['nav']) && ! $config['nav'])
1446
-                        || ! isset($config['nav'])
1447
-                    )
1448
-                )
1449
-            ) {
1450
-                continue;
1451
-            }
1452
-            // no nav tab for this config
1453
-            // check for persistent flag
1454
-            if ($slug !== $this->_req_action && isset($config['nav']['persistent']) && ! $config['nav']['persistent']) {
1455
-                // nav tab is only to appear when route requested.
1456
-                continue;
1457
-            }
1458
-            if (! $this->check_user_access($slug, true)) {
1459
-                // no nav tab because current user does not have access.
1460
-                continue;
1461
-            }
1462
-            $css_class = isset($config['css_class']) ? $config['css_class'] . ' ' : '';
1463
-            $this->_nav_tabs[ $slug ] = array(
1464
-                'url'       => isset($config['nav']['url'])
1465
-                    ? $config['nav']['url']
1466
-                    : self::add_query_args_and_nonce(
1467
-                        array('action' => $slug),
1468
-                        $this->_admin_base_url
1469
-                    ),
1470
-                'link_text' => isset($config['nav']['label'])
1471
-                    ? $config['nav']['label']
1472
-                    : ucwords(
1473
-                        str_replace('_', ' ', $slug)
1474
-                    ),
1475
-                'css_class' => $this->_req_action === $slug ? $css_class . 'nav-tab-active' : $css_class,
1476
-                'order'     => isset($config['nav']['order']) ? $config['nav']['order'] : $i,
1477
-            );
1478
-            $i++;
1479
-        }
1480
-        // if $this->_nav_tabs is empty then lets set the default
1481
-        if (empty($this->_nav_tabs)) {
1482
-            $this->_nav_tabs[ $this->_default_nav_tab_name ] = array(
1483
-                'url'       => $this->_admin_base_url,
1484
-                'link_text' => ucwords(str_replace('_', ' ', $this->_default_nav_tab_name)),
1485
-                'css_class' => 'nav-tab-active',
1486
-                'order'     => 10,
1487
-            );
1488
-        }
1489
-        // now let's sort the tabs according to order
1490
-        usort($this->_nav_tabs, array($this, '_sort_nav_tabs'));
1491
-    }
1492
-
1493
-
1494
-    /**
1495
-     * _set_current_labels
1496
-     * This method modifies the _labels property with any optional specific labels indicated in the _page_routes
1497
-     * property array
1498
-     *
1499
-     * @return void
1500
-     */
1501
-    private function _set_current_labels()
1502
-    {
1503
-        if (is_array($this->_route_config) && isset($this->_route_config['labels'])) {
1504
-            foreach ($this->_route_config['labels'] as $label => $text) {
1505
-                if (is_array($text)) {
1506
-                    foreach ($text as $sublabel => $subtext) {
1507
-                        $this->_labels[ $label ][ $sublabel ] = $subtext;
1508
-                    }
1509
-                } else {
1510
-                    $this->_labels[ $label ] = $text;
1511
-                }
1512
-            }
1513
-        }
1514
-    }
1515
-
1516
-
1517
-    /**
1518
-     *        verifies user access for this admin page
1519
-     *
1520
-     * @param string $route_to_check if present then the capability for the route matching this string is checked.
1521
-     * @param bool   $verify_only    Default is FALSE which means if user check fails then wp_die().  Otherwise just
1522
-     *                               return false if verify fail.
1523
-     * @return bool
1524
-     * @throws InvalidArgumentException
1525
-     * @throws InvalidDataTypeException
1526
-     * @throws InvalidInterfaceException
1527
-     */
1528
-    public function check_user_access($route_to_check = '', $verify_only = false)
1529
-    {
1530
-        do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1531
-        $route_to_check = empty($route_to_check) ? $this->_req_action : $route_to_check;
1532
-        $capability = ! empty($route_to_check) && isset($this->_page_routes[ $route_to_check ])
1533
-                      && is_array(
1534
-                          $this->_page_routes[ $route_to_check ]
1535
-                      )
1536
-                      && ! empty($this->_page_routes[ $route_to_check ]['capability'])
1537
-            ? $this->_page_routes[ $route_to_check ]['capability'] : null;
1538
-        if (empty($capability) && empty($route_to_check)) {
1539
-            $capability = is_array($this->_route) && empty($this->_route['capability']) ? 'manage_options'
1540
-                : $this->_route['capability'];
1541
-        } else {
1542
-            $capability = empty($capability) ? 'manage_options' : $capability;
1543
-        }
1544
-        $id = is_array($this->_route) && ! empty($this->_route['obj_id']) ? $this->_route['obj_id'] : 0;
1545
-        if (! defined('DOING_AJAX')
1546
-            && (
1547
-                ! function_exists('is_admin')
1548
-                || ! EE_Registry::instance()->CAP->current_user_can(
1549
-                    $capability,
1550
-                    $this->page_slug
1551
-                    . '_'
1552
-                    . $route_to_check,
1553
-                    $id
1554
-                )
1555
-            )
1556
-        ) {
1557
-            if ($verify_only) {
1558
-                return false;
1559
-            }
1560
-            if (is_user_logged_in()) {
1561
-                wp_die(__('You do not have access to this route.', 'event_espresso'));
1562
-            } else {
1563
-                return false;
1564
-            }
1565
-        }
1566
-        return true;
1567
-    }
1568
-
1569
-
1570
-    /**
1571
-     * admin_init_global
1572
-     * This runs all the code that we want executed within the WP admin_init hook.
1573
-     * This method executes for ALL EE Admin pages.
1574
-     *
1575
-     * @return void
1576
-     */
1577
-    public function admin_init_global()
1578
-    {
1579
-    }
1580
-
1581
-
1582
-    /**
1583
-     * wp_loaded_global
1584
-     * This runs all the code that we want executed within the WP wp_loaded hook.  This method is optional for an
1585
-     * EE_Admin page and will execute on every EE Admin Page load
1586
-     *
1587
-     * @return void
1588
-     */
1589
-    public function wp_loaded()
1590
-    {
1591
-    }
1592
-
1593
-
1594
-    /**
1595
-     * admin_notices
1596
-     * Anything triggered by the 'admin_notices' WP hook should be put in here.  This particular method will apply on
1597
-     * ALL EE_Admin pages.
1598
-     *
1599
-     * @return void
1600
-     */
1601
-    public function admin_notices_global()
1602
-    {
1603
-        $this->_display_no_javascript_warning();
1604
-        $this->_display_espresso_notices();
1605
-    }
1606
-
1607
-
1608
-    public function network_admin_notices_global()
1609
-    {
1610
-        $this->_display_no_javascript_warning();
1611
-        $this->_display_espresso_notices();
1612
-    }
1613
-
1614
-
1615
-    /**
1616
-     * admin_footer_scripts_global
1617
-     * Anything triggered by the 'admin_print_footer_scripts' WP hook should be put in here. This particular method
1618
-     * will apply on ALL EE_Admin pages.
1619
-     *
1620
-     * @return void
1621
-     */
1622
-    public function admin_footer_scripts_global()
1623
-    {
1624
-        $this->_add_admin_page_ajax_loading_img();
1625
-        $this->_add_admin_page_overlay();
1626
-        // if metaboxes are present we need to add the nonce field
1627
-        if (isset($this->_route_config['metaboxes'])
1628
-            || isset($this->_route_config['list_table'])
1629
-            || (isset($this->_route_config['has_metaboxes']) && $this->_route_config['has_metaboxes'])
1630
-        ) {
1631
-            wp_nonce_field('closedpostboxes', 'closedpostboxesnonce', false);
1632
-            wp_nonce_field('meta-box-order', 'meta-box-order-nonce', false);
1633
-        }
1634
-    }
1635
-
1636
-
1637
-    /**
1638
-     * admin_footer_global
1639
-     * Anything triggered by the wp 'admin_footer' wp hook should be put in here. This particular method will apply on
1640
-     * ALL EE_Admin Pages.
1641
-     *
1642
-     * @return void
1643
-     * @throws EE_Error
1644
-     */
1645
-    public function admin_footer_global()
1646
-    {
1647
-        // dialog container for dialog helper
1648
-        $d_cont = '<div class="ee-admin-dialog-container auto-hide hidden">' . "\n";
1649
-        $d_cont .= '<div class="ee-notices"></div>';
1650
-        $d_cont .= '<div class="ee-admin-dialog-container-inner-content"></div>';
1651
-        $d_cont .= '</div>';
1652
-        echo $d_cont;
1653
-        // help tour stuff?
1654
-        if (isset($this->_help_tour[ $this->_req_action ])) {
1655
-            echo implode('<br />', $this->_help_tour[ $this->_req_action ]);
1656
-        }
1657
-        // current set timezone for timezone js
1658
-        echo '<span id="current_timezone" class="hidden">' . EEH_DTT_Helper::get_timezone() . '</span>';
1659
-    }
1660
-
1661
-
1662
-    /**
1663
-     * This function sees if there is a method for help popup content existing for the given route.  If there is then
1664
-     * we'll use the retrieved array to output the content using the template. For child classes: If you want to have
1665
-     * help popups then in your templates or your content you set "triggers" for the content using the
1666
-     * "_set_help_trigger('help_trigger_id')" where "help_trigger_id" is what you will use later in your custom method
1667
-     * for the help popup content on that page. Then in your Child_Admin_Page class you need to define a help popup
1668
-     * method for the content in the format "_help_popup_content_{route_name}()"  So if you are setting help content
1669
-     * for the
1670
-     * 'edit_event' route you should have a method named "_help_popup_content_edit_route". In your defined
1671
-     * "help_popup_content_..." method.  You must prepare and return an array in the following format array(
1672
-     *    'help_trigger_id' => array(
1673
-     *        'title' => esc_html__('localized title for popup', 'event_espresso'),
1674
-     *        'content' => esc_html__('localized content for popup', 'event_espresso')
1675
-     *    )
1676
-     * );
1677
-     * Then the EE_Admin_Parent will take care of making sure that is setup properly on the correct route.
1678
-     *
1679
-     * @param array $help_array
1680
-     * @param bool  $display
1681
-     * @return string content
1682
-     * @throws DomainException
1683
-     * @throws EE_Error
1684
-     */
1685
-    protected function _set_help_popup_content($help_array = array(), $display = false)
1686
-    {
1687
-        $content = '';
1688
-        $help_array = empty($help_array) ? $this->_get_help_content() : $help_array;
1689
-        // loop through the array and setup content
1690
-        foreach ($help_array as $trigger => $help) {
1691
-            // make sure the array is setup properly
1692
-            if (! isset($help['title']) || ! isset($help['content'])) {
1693
-                throw new EE_Error(
1694
-                    esc_html__(
1695
-                        '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',
1696
-                        'event_espresso'
1697
-                    )
1698
-                );
1699
-            }
1700
-            // we're good so let'd setup the template vars and then assign parsed template content to our content.
1701
-            $template_args = array(
1702
-                'help_popup_id'      => $trigger,
1703
-                'help_popup_title'   => $help['title'],
1704
-                'help_popup_content' => $help['content'],
1705
-            );
1706
-            $content .= EEH_Template::display_template(
1707
-                EE_ADMIN_TEMPLATE . 'admin_help_popup.template.php',
1708
-                $template_args,
1709
-                true
1710
-            );
1711
-        }
1712
-        if ($display) {
1713
-            echo $content;
1714
-            return '';
1715
-        }
1716
-        return $content;
1717
-    }
1718
-
1719
-
1720
-    /**
1721
-     * All this does is retrieve the help content array if set by the EE_Admin_Page child
1722
-     *
1723
-     * @return array properly formatted array for help popup content
1724
-     * @throws EE_Error
1725
-     */
1726
-    private function _get_help_content()
1727
-    {
1728
-        // what is the method we're looking for?
1729
-        $method_name = '_help_popup_content_' . $this->_req_action;
1730
-        // if method doesn't exist let's get out.
1731
-        if (! method_exists($this, $method_name)) {
1732
-            return array();
1733
-        }
1734
-        // k we're good to go let's retrieve the help array
1735
-        $help_array = call_user_func(array($this, $method_name));
1736
-        // make sure we've got an array!
1737
-        if (! is_array($help_array)) {
1738
-            throw new EE_Error(
1739
-                esc_html__(
1740
-                    'Something went wrong with help popup content generation. Expecting an array and well, this ain\'t no array bub.',
1741
-                    'event_espresso'
1742
-                )
1743
-            );
1744
-        }
1745
-        return $help_array;
1746
-    }
1747
-
1748
-
1749
-    /**
1750
-     * EE Admin Pages can use this to set a properly formatted trigger for a help popup.
1751
-     * By default the trigger html is printed.  Otherwise it can be returned if the $display flag is set "false"
1752
-     * See comments made on the _set_help_content method for understanding other parts to the help popup tool.
1753
-     *
1754
-     * @param string  $trigger_id reference for retrieving the trigger content for the popup
1755
-     * @param boolean $display    if false then we return the trigger string
1756
-     * @param array   $dimensions an array of dimensions for the box (array(h,w))
1757
-     * @return string
1758
-     * @throws DomainException
1759
-     * @throws EE_Error
1760
-     */
1761
-    protected function _set_help_trigger($trigger_id, $display = true, $dimensions = array('400', '640'))
1762
-    {
1763
-        if (defined('DOING_AJAX')) {
1764
-            return '';
1765
-        }
1766
-        // 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
1767
-        $help_array = $this->_get_help_content();
1768
-        $help_content = '';
1769
-        if (empty($help_array) || ! isset($help_array[ $trigger_id ])) {
1770
-            $help_array[ $trigger_id ] = array(
1771
-                'title'   => esc_html__('Missing Content', 'event_espresso'),
1772
-                'content' => esc_html__(
1773
-                    '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.)',
1774
-                    'event_espresso'
1775
-                ),
1776
-            );
1777
-            $help_content = $this->_set_help_popup_content($help_array, false);
1778
-        }
1779
-        // let's setup the trigger
1780
-        $content = '<a class="ee-dialog" href="?height='
1781
-                   . $dimensions[0]
1782
-                   . '&width='
1783
-                   . $dimensions[1]
1784
-                   . '&inlineId='
1785
-                   . $trigger_id
1786
-                   . '" target="_blank"><span class="question ee-help-popup-question"></span></a>';
1787
-        $content .= $help_content;
1788
-        if ($display) {
1789
-            echo $content;
1790
-            return '';
1791
-        }
1792
-        return $content;
1793
-    }
1794
-
1795
-
1796
-    /**
1797
-     * _add_global_screen_options
1798
-     * Add any extra wp_screen_options within this method using built-in WP functions/methods for doing so.
1799
-     * This particular method will add_screen_options on ALL EE_Admin Pages
1800
-     *
1801
-     * @link   http://chrismarslender.com/wp-tutorials/wordpress-screen-options-tutorial/
1802
-     *         see also WP_Screen object documents...
1803
-     * @link   http://codex.wordpress.org/Class_Reference/WP_Screen
1804
-     * @abstract
1805
-     * @return void
1806
-     */
1807
-    private function _add_global_screen_options()
1808
-    {
1809
-    }
1810
-
1811
-
1812
-    /**
1813
-     * _add_global_feature_pointers
1814
-     * This method is used for implementing any "feature pointers" (using built-in WP styling js).
1815
-     * This particular method will implement feature pointers for ALL EE_Admin pages.
1816
-     * Note: this is just a placeholder for now.  Implementation will come down the road
1817
-     *
1818
-     * @see    WP_Internal_Pointers class in wp-admin/includes/template.php for example (its a final class so can't be
1819
-     *         extended) also see:
1820
-     * @link   http://eamann.com/tech/wordpress-portland/
1821
-     * @abstract
1822
-     * @return void
1823
-     */
1824
-    private function _add_global_feature_pointers()
1825
-    {
1826
-    }
1827
-
1828
-
1829
-    /**
1830
-     * load_global_scripts_styles
1831
-     * The scripts and styles enqueued in here will be loaded on every EE Admin page
1832
-     *
1833
-     * @return void
1834
-     * @throws EE_Error
1835
-     */
1836
-    public function load_global_scripts_styles()
1837
-    {
1838
-        /** STYLES **/
1839
-        // add debugging styles
1840
-        if (WP_DEBUG) {
1841
-            add_action('admin_head', array($this, 'add_xdebug_style'));
1842
-        }
1843
-        // register all styles
1844
-        wp_register_style(
1845
-            'espresso-ui-theme',
1846
-            EE_GLOBAL_ASSETS_URL . 'css/espresso-ui-theme/jquery-ui-1.10.3.custom.min.css',
1847
-            array(),
1848
-            EVENT_ESPRESSO_VERSION
1849
-        );
1850
-        wp_register_style('ee-admin-css', EE_ADMIN_URL . 'assets/ee-admin-page.css', array(), EVENT_ESPRESSO_VERSION);
1851
-        // helpers styles
1852
-        wp_register_style(
1853
-            'ee-text-links',
1854
-            EE_PLUGIN_DIR_URL . 'core/helpers/assets/ee_text_list_helper.css',
1855
-            array(),
1856
-            EVENT_ESPRESSO_VERSION
1857
-        );
1858
-        /** SCRIPTS **/
1859
-        // register all scripts
1860
-        wp_register_script(
1861
-            'ee-dialog',
1862
-            EE_ADMIN_URL . 'assets/ee-dialog-helper.js',
1863
-            array('jquery', 'jquery-ui-draggable'),
1864
-            EVENT_ESPRESSO_VERSION,
1865
-            true
1866
-        );
1867
-        wp_register_script(
1868
-            'ee_admin_js',
1869
-            EE_ADMIN_URL . 'assets/ee-admin-page.js',
1870
-            array('espresso_core', 'ee-parse-uri', 'ee-dialog'),
1871
-            EVENT_ESPRESSO_VERSION,
1872
-            true
1873
-        );
1874
-        wp_register_script(
1875
-            'jquery-ui-timepicker-addon',
1876
-            EE_GLOBAL_ASSETS_URL . 'scripts/jquery-ui-timepicker-addon.js',
1877
-            array('jquery-ui-datepicker', 'jquery-ui-slider'),
1878
-            EVENT_ESPRESSO_VERSION,
1879
-            true
1880
-        );
1881
-        add_filter('FHEE_load_joyride', '__return_true');
1882
-        // script for sorting tables
1883
-        wp_register_script(
1884
-            'espresso_ajax_table_sorting',
1885
-            EE_ADMIN_URL . 'assets/espresso_ajax_table_sorting.js',
1886
-            array('ee_admin_js', 'jquery-ui-sortable'),
1887
-            EVENT_ESPRESSO_VERSION,
1888
-            true
1889
-        );
1890
-        // script for parsing uri's
1891
-        wp_register_script(
1892
-            'ee-parse-uri',
1893
-            EE_GLOBAL_ASSETS_URL . 'scripts/parseuri.js',
1894
-            array(),
1895
-            EVENT_ESPRESSO_VERSION,
1896
-            true
1897
-        );
1898
-        // and parsing associative serialized form elements
1899
-        wp_register_script(
1900
-            'ee-serialize-full-array',
1901
-            EE_GLOBAL_ASSETS_URL . 'scripts/jquery.serializefullarray.js',
1902
-            array('jquery'),
1903
-            EVENT_ESPRESSO_VERSION,
1904
-            true
1905
-        );
1906
-        // helpers scripts
1907
-        wp_register_script(
1908
-            'ee-text-links',
1909
-            EE_PLUGIN_DIR_URL . 'core/helpers/assets/ee_text_list_helper.js',
1910
-            array('jquery'),
1911
-            EVENT_ESPRESSO_VERSION,
1912
-            true
1913
-        );
1914
-        wp_register_script(
1915
-            'ee-moment-core',
1916
-            EE_THIRD_PARTY_URL . 'moment/moment-with-locales.min.js',
1917
-            array(),
1918
-            EVENT_ESPRESSO_VERSION,
1919
-            true
1920
-        );
1921
-        wp_register_script(
1922
-            'ee-moment',
1923
-            EE_THIRD_PARTY_URL . 'moment/moment-timezone-with-data.min.js',
1924
-            array('ee-moment-core'),
1925
-            EVENT_ESPRESSO_VERSION,
1926
-            true
1927
-        );
1928
-        wp_register_script(
1929
-            'ee-datepicker',
1930
-            EE_ADMIN_URL . 'assets/ee-datepicker.js',
1931
-            array('jquery-ui-timepicker-addon', 'ee-moment'),
1932
-            EVENT_ESPRESSO_VERSION,
1933
-            true
1934
-        );
1935
-        // google charts
1936
-        wp_register_script(
1937
-            'google-charts',
1938
-            'https://www.gstatic.com/charts/loader.js',
1939
-            array(),
1940
-            EVENT_ESPRESSO_VERSION,
1941
-            false
1942
-        );
1943
-        // ENQUEUE ALL BASICS BY DEFAULT
1944
-        wp_enqueue_style('ee-admin-css');
1945
-        wp_enqueue_script('ee_admin_js');
1946
-        wp_enqueue_script('ee-accounting');
1947
-        wp_enqueue_script('jquery-validate');
1948
-        // taking care of metaboxes
1949
-        if (empty($this->_cpt_route)
1950
-            && (isset($this->_route_config['metaboxes']) || isset($this->_route_config['has_metaboxes']))
1951
-        ) {
1952
-            wp_enqueue_script('dashboard');
1953
-        }
1954
-        // LOCALIZED DATA
1955
-        // localize script for ajax lazy loading
1956
-        $lazy_loader_container_ids = apply_filters(
1957
-            'FHEE__EE_Admin_Page_Core__load_global_scripts_styles__loader_containers',
1958
-            array('espresso_news_post_box_content')
1959
-        );
1960
-        wp_localize_script('ee_admin_js', 'eeLazyLoadingContainers', $lazy_loader_container_ids);
1961
-        /**
1962
-         * help tour stuff
1963
-         */
1964
-        if (! empty($this->_help_tour)) {
1965
-            // register the js for kicking things off
1966
-            wp_enqueue_script(
1967
-                'ee-help-tour',
1968
-                EE_ADMIN_URL . 'assets/ee-help-tour.js',
1969
-                array('jquery-joyride'),
1970
-                EVENT_ESPRESSO_VERSION,
1971
-                true
1972
-            );
1973
-            $tours = array();
1974
-            // setup tours for the js tour object
1975
-            foreach ($this->_help_tour['tours'] as $tour) {
1976
-                if ($tour instanceof EE_Help_Tour) {
1977
-                    $tours[] = array(
1978
-                        'id'      => $tour->get_slug(),
1979
-                        'options' => $tour->get_options(),
1980
-                    );
1981
-                }
1982
-            }
1983
-            wp_localize_script('ee-help-tour', 'EE_HELP_TOUR', array('tours' => $tours));
1984
-            // admin_footer_global will take care of making sure our help_tour skeleton gets printed via the info stored in $this->_help_tour
1985
-        }
1986
-    }
1987
-
1988
-
1989
-    /**
1990
-     *        admin_footer_scripts_eei18n_js_strings
1991
-     *
1992
-     * @return        void
1993
-     */
1994
-    public function admin_footer_scripts_eei18n_js_strings()
1995
-    {
1996
-        EE_Registry::$i18n_js_strings['ajax_url'] = WP_AJAX_URL;
1997
-        EE_Registry::$i18n_js_strings['confirm_delete'] = esc_html__(
1998
-            '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!!!',
1999
-            'event_espresso'
2000
-        );
2001
-        EE_Registry::$i18n_js_strings['January'] = esc_html__('January', 'event_espresso');
2002
-        EE_Registry::$i18n_js_strings['February'] = esc_html__('February', 'event_espresso');
2003
-        EE_Registry::$i18n_js_strings['March'] = esc_html__('March', 'event_espresso');
2004
-        EE_Registry::$i18n_js_strings['April'] = esc_html__('April', 'event_espresso');
2005
-        EE_Registry::$i18n_js_strings['May'] = esc_html__('May', 'event_espresso');
2006
-        EE_Registry::$i18n_js_strings['June'] = esc_html__('June', 'event_espresso');
2007
-        EE_Registry::$i18n_js_strings['July'] = esc_html__('July', 'event_espresso');
2008
-        EE_Registry::$i18n_js_strings['August'] = esc_html__('August', 'event_espresso');
2009
-        EE_Registry::$i18n_js_strings['September'] = esc_html__('September', 'event_espresso');
2010
-        EE_Registry::$i18n_js_strings['October'] = esc_html__('October', 'event_espresso');
2011
-        EE_Registry::$i18n_js_strings['November'] = esc_html__('November', 'event_espresso');
2012
-        EE_Registry::$i18n_js_strings['December'] = esc_html__('December', 'event_espresso');
2013
-        EE_Registry::$i18n_js_strings['Jan'] = esc_html__('Jan', 'event_espresso');
2014
-        EE_Registry::$i18n_js_strings['Feb'] = esc_html__('Feb', 'event_espresso');
2015
-        EE_Registry::$i18n_js_strings['Mar'] = esc_html__('Mar', 'event_espresso');
2016
-        EE_Registry::$i18n_js_strings['Apr'] = esc_html__('Apr', 'event_espresso');
2017
-        EE_Registry::$i18n_js_strings['May'] = esc_html__('May', 'event_espresso');
2018
-        EE_Registry::$i18n_js_strings['Jun'] = esc_html__('Jun', 'event_espresso');
2019
-        EE_Registry::$i18n_js_strings['Jul'] = esc_html__('Jul', 'event_espresso');
2020
-        EE_Registry::$i18n_js_strings['Aug'] = esc_html__('Aug', 'event_espresso');
2021
-        EE_Registry::$i18n_js_strings['Sep'] = esc_html__('Sep', 'event_espresso');
2022
-        EE_Registry::$i18n_js_strings['Oct'] = esc_html__('Oct', 'event_espresso');
2023
-        EE_Registry::$i18n_js_strings['Nov'] = esc_html__('Nov', 'event_espresso');
2024
-        EE_Registry::$i18n_js_strings['Dec'] = esc_html__('Dec', 'event_espresso');
2025
-        EE_Registry::$i18n_js_strings['Sunday'] = esc_html__('Sunday', 'event_espresso');
2026
-        EE_Registry::$i18n_js_strings['Monday'] = esc_html__('Monday', 'event_espresso');
2027
-        EE_Registry::$i18n_js_strings['Tuesday'] = esc_html__('Tuesday', 'event_espresso');
2028
-        EE_Registry::$i18n_js_strings['Wednesday'] = esc_html__('Wednesday', 'event_espresso');
2029
-        EE_Registry::$i18n_js_strings['Thursday'] = esc_html__('Thursday', 'event_espresso');
2030
-        EE_Registry::$i18n_js_strings['Friday'] = esc_html__('Friday', 'event_espresso');
2031
-        EE_Registry::$i18n_js_strings['Saturday'] = esc_html__('Saturday', 'event_espresso');
2032
-        EE_Registry::$i18n_js_strings['Sun'] = esc_html__('Sun', 'event_espresso');
2033
-        EE_Registry::$i18n_js_strings['Mon'] = esc_html__('Mon', 'event_espresso');
2034
-        EE_Registry::$i18n_js_strings['Tue'] = esc_html__('Tue', 'event_espresso');
2035
-        EE_Registry::$i18n_js_strings['Wed'] = esc_html__('Wed', 'event_espresso');
2036
-        EE_Registry::$i18n_js_strings['Thu'] = esc_html__('Thu', 'event_espresso');
2037
-        EE_Registry::$i18n_js_strings['Fri'] = esc_html__('Fri', 'event_espresso');
2038
-        EE_Registry::$i18n_js_strings['Sat'] = esc_html__('Sat', 'event_espresso');
2039
-    }
2040
-
2041
-
2042
-    /**
2043
-     *        load enhanced xdebug styles for ppl with failing eyesight
2044
-     *
2045
-     * @return        void
2046
-     */
2047
-    public function add_xdebug_style()
2048
-    {
2049
-        echo '<style>.xdebug-error { font-size:1.5em; }</style>';
2050
-    }
2051
-
2052
-
2053
-    /************************/
2054
-    /** LIST TABLE METHODS **/
2055
-    /************************/
2056
-    /**
2057
-     * this sets up the list table if the current view requires it.
2058
-     *
2059
-     * @return void
2060
-     * @throws EE_Error
2061
-     */
2062
-    protected function _set_list_table()
2063
-    {
2064
-        // first is this a list_table view?
2065
-        if (! isset($this->_route_config['list_table'])) {
2066
-            return;
2067
-        } //not a list_table view so get out.
2068
-        // list table functions are per view specific (because some admin pages might have more than one list table!)
2069
-        $list_table_view = '_set_list_table_views_' . $this->_req_action;
2070
-        if (! method_exists($this, $list_table_view) || $this->{$list_table_view}() === false) {
2071
-            // user error msg
2072
-            $error_msg = esc_html__(
2073
-                'An error occurred. The requested list table views could not be found.',
2074
-                'event_espresso'
2075
-            );
2076
-            // developer error msg
2077
-            $error_msg .= '||'
2078
-                          . sprintf(
2079
-                              esc_html__(
2080
-                                  '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.',
2081
-                                  'event_espresso'
2082
-                              ),
2083
-                              $this->_req_action,
2084
-                              $list_table_view
2085
-                          );
2086
-            throw new EE_Error($error_msg);
2087
-        }
2088
-        // let's provide the ability to filter the views per PAGE AND ROUTE, per PAGE, and globally
2089
-        $this->_views = apply_filters(
2090
-            'FHEE_list_table_views_' . $this->page_slug . '_' . $this->_req_action,
2091
-            $this->_views
2092
-        );
2093
-        $this->_views = apply_filters('FHEE_list_table_views_' . $this->page_slug, $this->_views);
2094
-        $this->_views = apply_filters('FHEE_list_table_views', $this->_views);
2095
-        $this->_set_list_table_view();
2096
-        $this->_set_list_table_object();
2097
-    }
2098
-
2099
-
2100
-    /**
2101
-     * set current view for List Table
2102
-     *
2103
-     * @return void
2104
-     */
2105
-    protected function _set_list_table_view()
2106
-    {
2107
-        do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2108
-        // looking at active items or dumpster diving ?
2109
-        if (! isset($this->_req_data['status']) || ! array_key_exists($this->_req_data['status'], $this->_views)) {
2110
-            $this->_view = isset($this->_views['in_use']) ? 'in_use' : 'all';
2111
-        } else {
2112
-            $this->_view = sanitize_key($this->_req_data['status']);
2113
-        }
2114
-    }
2115
-
2116
-
2117
-    /**
2118
-     * _set_list_table_object
2119
-     * WP_List_Table objects need to be loaded fairly early so automatic stuff WP does is taken care of.
2120
-     *
2121
-     * @throws \EventEspresso\core\exceptions\InvalidInterfaceException
2122
-     * @throws \InvalidArgumentException
2123
-     * @throws \EventEspresso\core\exceptions\InvalidDataTypeException
2124
-     * @throws EE_Error
2125
-     * @throws InvalidInterfaceException
2126
-     */
2127
-    protected function _set_list_table_object()
2128
-    {
2129
-        if (isset($this->_route_config['list_table'])) {
2130
-            if (! class_exists($this->_route_config['list_table'])) {
2131
-                throw new EE_Error(
2132
-                    sprintf(
2133
-                        esc_html__(
2134
-                            '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.',
2135
-                            'event_espresso'
2136
-                        ),
2137
-                        $this->_route_config['list_table'],
2138
-                        get_class($this)
2139
-                    )
2140
-                );
2141
-            }
2142
-            $this->_list_table_object = LoaderFactory::getLoader()->getShared(
2143
-                $this->_route_config['list_table'],
2144
-                array($this)
2145
-            );
2146
-        }
2147
-    }
2148
-
2149
-
2150
-    /**
2151
-     * get_list_table_view_RLs - get it? View RL ?? VU-RL???  URL ??
2152
-     *
2153
-     * @param array $extra_query_args                     Optional. An array of extra query args to add to the generated
2154
-     *                                                    urls.  The array should be indexed by the view it is being
2155
-     *                                                    added to.
2156
-     * @return array
2157
-     */
2158
-    public function get_list_table_view_RLs($extra_query_args = array())
2159
-    {
2160
-        do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2161
-        if (empty($this->_views)) {
2162
-            $this->_views = array();
2163
-        }
2164
-        // cycle thru views
2165
-        foreach ($this->_views as $key => $view) {
2166
-            $query_args = array();
2167
-            // check for current view
2168
-            $this->_views[ $key ]['class'] = $this->_view === $view['slug'] ? 'current' : '';
2169
-            $query_args['action'] = $this->_req_action;
2170
-            $query_args[ $this->_req_action . '_nonce' ] = wp_create_nonce($query_args['action'] . '_nonce');
2171
-            $query_args['status'] = $view['slug'];
2172
-            // merge any other arguments sent in.
2173
-            if (isset($extra_query_args[ $view['slug'] ])) {
2174
-                $query_args = array_merge($query_args, $extra_query_args[ $view['slug'] ]);
2175
-            }
2176
-            $this->_views[ $key ]['url'] = EE_Admin_Page::add_query_args_and_nonce($query_args, $this->_admin_base_url);
2177
-        }
2178
-        return $this->_views;
2179
-    }
2180
-
2181
-
2182
-    /**
2183
-     * _entries_per_page_dropdown
2184
-     * generates a drop down box for selecting the number of visible rows in an admin page list table
2185
-     *
2186
-     * @todo   : Note: ideally this should be added to the screen options dropdown as that would be consistent with how
2187
-     *         WP does it.
2188
-     * @param int $max_entries total number of rows in the table
2189
-     * @return string
2190
-     */
2191
-    protected function _entries_per_page_dropdown($max_entries = 0)
2192
-    {
2193
-        do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2194
-        $values = array(10, 25, 50, 100);
2195
-        $per_page = (! empty($this->_req_data['per_page'])) ? absint($this->_req_data['per_page']) : 10;
2196
-        if ($max_entries) {
2197
-            $values[] = $max_entries;
2198
-            sort($values);
2199
-        }
2200
-        $entries_per_page_dropdown = '
99
+	/**
100
+	 * @var array $_route_config
101
+	 */
102
+	protected $_route_config;
103
+
104
+	/**
105
+	 * Used to hold default query args for list table routes to help preserve stickiness of filters for carried out
106
+	 * actions.
107
+	 *
108
+	 * @since 4.6.x
109
+	 * @var array.
110
+	 */
111
+	protected $_default_route_query_args;
112
+
113
+	// set via request page and action args.
114
+	protected $_current_page;
115
+
116
+	protected $_current_view;
117
+
118
+	protected $_current_page_view_url;
119
+
120
+	// sanitized request action (and nonce)
121
+
122
+	/**
123
+	 * @var string $_req_action
124
+	 */
125
+	protected $_req_action;
126
+
127
+	/**
128
+	 * @var string $_req_nonce
129
+	 */
130
+	protected $_req_nonce;
131
+
132
+	// search related
133
+	protected $_search_btn_label;
134
+
135
+	protected $_search_box_callback;
136
+
137
+	/**
138
+	 * WP Current Screen object
139
+	 *
140
+	 * @var WP_Screen
141
+	 */
142
+	protected $_current_screen;
143
+
144
+	// for holding EE_Admin_Hooks object when needed (set via set_hook_object())
145
+	protected $_hook_obj;
146
+
147
+	// for holding incoming request data
148
+	protected $_req_data;
149
+
150
+	// yes / no array for admin form fields
151
+	protected $_yes_no_values = array();
152
+
153
+	// some default things shared by all child classes
154
+	protected $_default_espresso_metaboxes;
155
+
156
+	/**
157
+	 *    EE_Registry Object
158
+	 *
159
+	 * @var    EE_Registry
160
+	 */
161
+	protected $EE = null;
162
+
163
+
164
+	/**
165
+	 * This is just a property that flags whether the given route is a caffeinated route or not.
166
+	 *
167
+	 * @var boolean
168
+	 */
169
+	protected $_is_caf = false;
170
+
171
+
172
+	/**
173
+	 * @Constructor
174
+	 * @param bool $routing indicate whether we want to just load the object and handle routing or just load the object.
175
+	 * @throws EE_Error
176
+	 * @throws InvalidArgumentException
177
+	 * @throws ReflectionException
178
+	 * @throws InvalidDataTypeException
179
+	 * @throws InvalidInterfaceException
180
+	 */
181
+	public function __construct($routing = true)
182
+	{
183
+		if (strpos($this->_get_dir(), 'caffeinated') !== false) {
184
+			$this->_is_caf = true;
185
+		}
186
+		$this->_yes_no_values = array(
187
+			array('id' => true, 'text' => esc_html__('Yes', 'event_espresso')),
188
+			array('id' => false, 'text' => esc_html__('No', 'event_espresso')),
189
+		);
190
+		// set the _req_data property.
191
+		$this->_req_data = array_merge($_GET, $_POST);
192
+		// routing enabled?
193
+		$this->_routing = $routing;
194
+		// set initial page props (child method)
195
+		$this->_init_page_props();
196
+		// set global defaults
197
+		$this->_set_defaults();
198
+		// set early because incoming requests could be ajax related and we need to register those hooks.
199
+		$this->_global_ajax_hooks();
200
+		$this->_ajax_hooks();
201
+		// other_page_hooks have to be early too.
202
+		$this->_do_other_page_hooks();
203
+		// This just allows us to have extending classes do something specific
204
+		// before the parent constructor runs _page_setup().
205
+		if (method_exists($this, '_before_page_setup')) {
206
+			$this->_before_page_setup();
207
+		}
208
+		// set up page dependencies
209
+		$this->_page_setup();
210
+	}
211
+
212
+
213
+	/**
214
+	 * _init_page_props
215
+	 * Child classes use to set at least the following properties:
216
+	 * $page_slug.
217
+	 * $page_label.
218
+	 *
219
+	 * @abstract
220
+	 * @return void
221
+	 */
222
+	abstract protected function _init_page_props();
223
+
224
+
225
+	/**
226
+	 * _ajax_hooks
227
+	 * child classes put all their add_action('wp_ajax_{name_of_hook}') hooks in here.
228
+	 * Note: within the ajax callback methods.
229
+	 *
230
+	 * @abstract
231
+	 * @return void
232
+	 */
233
+	abstract protected function _ajax_hooks();
234
+
235
+
236
+	/**
237
+	 * _define_page_props
238
+	 * child classes define page properties in here.  Must include at least:
239
+	 * $_admin_base_url = base_url for all admin pages
240
+	 * $_admin_page_title = default admin_page_title for admin pages
241
+	 * $_labels = array of default labels for various automatically generated elements:
242
+	 *    array(
243
+	 *        'buttons' => array(
244
+	 *            'add' => esc_html__('label for add new button'),
245
+	 *            'edit' => esc_html__('label for edit button'),
246
+	 *            'delete' => esc_html__('label for delete button')
247
+	 *            )
248
+	 *        )
249
+	 *
250
+	 * @abstract
251
+	 * @return void
252
+	 */
253
+	abstract protected function _define_page_props();
254
+
255
+
256
+	/**
257
+	 * _set_page_routes
258
+	 * child classes use this to define the page routes for all subpages handled by the class.  Page routes are
259
+	 * assigned to a action => method pairs in an array and to the $_page_routes property.  Each page route must also
260
+	 * have a 'default' route. Here's the format
261
+	 * $this->_page_routes = array(
262
+	 *        'default' => array(
263
+	 *            'func' => '_default_method_handling_route',
264
+	 *            'args' => array('array','of','args'),
265
+	 *            'noheader' => true, //add this in if this page route is processed before any headers are loaded (i.e.
266
+	 *            ajax request, backend processing)
267
+	 *            'headers_sent_route'=>'headers_route_reference', //add this if noheader=>true, and you want to load a
268
+	 *            headers route after.  The string you enter here should match the defined route reference for a
269
+	 *            headers sent route.
270
+	 *            'capability' => 'route_capability', //indicate a string for minimum capability required to access
271
+	 *            this route.
272
+	 *            'obj_id' => 10 // if this route has an object id, then this can include it (used for capability
273
+	 *            checks).
274
+	 *        ),
275
+	 *        'insert_item' => '_method_for_handling_insert_item' //this can be used if all we need to have is a
276
+	 *        handling method.
277
+	 *        )
278
+	 * )
279
+	 *
280
+	 * @abstract
281
+	 * @return void
282
+	 */
283
+	abstract protected function _set_page_routes();
284
+
285
+
286
+	/**
287
+	 * _set_page_config
288
+	 * child classes use this to define the _page_config array for all subpages handled by the class. Each key in the
289
+	 * array corresponds to the page_route for the loaded page. Format:
290
+	 * $this->_page_config = array(
291
+	 *        'default' => array(
292
+	 *            'labels' => array(
293
+	 *                'buttons' => array(
294
+	 *                    'add' => esc_html__('label for adding item'),
295
+	 *                    'edit' => esc_html__('label for editing item'),
296
+	 *                    'delete' => esc_html__('label for deleting item')
297
+	 *                ),
298
+	 *                'publishbox' => esc_html__('Localized Title for Publish metabox', 'event_espresso')
299
+	 *            ), //optional an array of custom labels for various automatically generated elements to use on the
300
+	 *            page. If this isn't present then the defaults will be used as set for the $this->_labels in
301
+	 *            _define_page_props() method
302
+	 *            'nav' => array(
303
+	 *                'label' => esc_html__('Label for Tab', 'event_espresso').
304
+	 *                'url' => 'http://someurl', //automatically generated UNLESS you define
305
+	 *                'css_class' => 'css-class', //automatically generated UNLESS you define
306
+	 *                'order' => 10, //required to indicate tab position.
307
+	 *                'persistent' => false //if you want the nav tab to ONLY display when the specific route is
308
+	 *                displayed then add this parameter.
309
+	 *            'list_table' => 'name_of_list_table' //string for list table class to be loaded for this admin_page.
310
+	 *            'metaboxes' => array('metabox1', 'metabox2'), //if present this key indicates we want to load
311
+	 *            metaboxes set for eventespresso admin pages.
312
+	 *            'has_metaboxes' => true, //this boolean flag can simply be used to indicate if the route will have
313
+	 *            metaboxes.  Typically this is used if the 'metaboxes' index is not used because metaboxes are added
314
+	 *            later.  We just use this flag to make sure the necessary js gets enqueued on page load.
315
+	 *            'has_help_popups' => false //defaults(true) //this boolean flag can simply be used to indicate if the
316
+	 *            given route has help popups setup and if it does then we need to make sure thickbox is enqueued.
317
+	 *            'columns' => array(4, 2), //this key triggers the setup of a page that uses columns (metaboxes).  The
318
+	 *            array indicates the max number of columns (4) and the default number of columns on page load (2).
319
+	 *            There is an option in the "screen_options" dropdown that is setup so users can pick what columns they
320
+	 *            want to display.
321
+	 *            'help_tabs' => array( //this is used for adding help tabs to a page
322
+	 *                'tab_id' => array(
323
+	 *                    'title' => 'tab_title',
324
+	 *                    'filename' => 'name_of_file_containing_content', //this is the primary method for setting
325
+	 *                    help tab content.  The fallback if it isn't present is to try a the callback.  Filename
326
+	 *                    should match a file in the admin folder's "help_tabs" dir (ie..
327
+	 *                    events/help_tabs/name_of_file_containing_content.help_tab.php)
328
+	 *                    'callback' => 'callback_method_for_content', //if 'filename' isn't present then system will
329
+	 *                    attempt to use the callback which should match the name of a method in the class
330
+	 *                    ),
331
+	 *                'tab2_id' => array(
332
+	 *                    'title' => 'tab2 title',
333
+	 *                    'filename' => 'file_name_2'
334
+	 *                    'callback' => 'callback_method_for_content',
335
+	 *                 ),
336
+	 *            'help_sidebar' => 'callback_for_sidebar_content', //this is used for setting up the sidebar in the
337
+	 *            help tab area on an admin page. @link
338
+	 *            http://make.wordpress.org/core/2011/12/06/help-and-screen-api-changes-in-3-3/
339
+	 *            'help_tour' => array(
340
+	 *                'name_of_help_tour_class', //all help tours shoudl be a child class of EE_Help_Tour and located
341
+	 *                in a folder for this admin page named "help_tours", a file name matching the key given here
342
+	 *                (name_of_help_tour_class.class.php), and class matching key given here (name_of_help_tour_class)
343
+	 *            ),
344
+	 *            'require_nonce' => TRUE //this is used if you want to set a route to NOT require a nonce (default is
345
+	 *            true if it isn't present).  To remove the requirement for a nonce check when this route is visited
346
+	 *            just set
347
+	 *            'require_nonce' to FALSE
348
+	 *            )
349
+	 * )
350
+	 *
351
+	 * @abstract
352
+	 * @return void
353
+	 */
354
+	abstract protected function _set_page_config();
355
+
356
+
357
+
358
+
359
+
360
+	/** end sample help_tour methods **/
361
+	/**
362
+	 * _add_screen_options
363
+	 * Child classes can add any extra wp_screen_options within this method using built-in WP functions/methods for
364
+	 * doing so. Note child classes can also define _add_screen_options_($this->_current_view) to limit screen options
365
+	 * to a particular view.
366
+	 *
367
+	 * @link   http://chrismarslender.com/wp-tutorials/wordpress-screen-options-tutorial/
368
+	 *         see also WP_Screen object documents...
369
+	 * @link   http://codex.wordpress.org/Class_Reference/WP_Screen
370
+	 * @abstract
371
+	 * @return void
372
+	 */
373
+	abstract protected function _add_screen_options();
374
+
375
+
376
+	/**
377
+	 * _add_feature_pointers
378
+	 * Child classes should use this method for implementing any "feature pointers" (using built-in WP styling js).
379
+	 * Note child classes can also define _add_feature_pointers_($this->_current_view) to limit screen options to a
380
+	 * particular view. Note: this is just a placeholder for now.  Implementation will come down the road See:
381
+	 * WP_Internal_Pointers class in wp-admin/includes/template.php for example (its a final class so can't be
382
+	 * extended) also see:
383
+	 *
384
+	 * @link   http://eamann.com/tech/wordpress-portland/
385
+	 * @abstract
386
+	 * @return void
387
+	 */
388
+	abstract protected function _add_feature_pointers();
389
+
390
+
391
+	/**
392
+	 * load_scripts_styles
393
+	 * child classes put their wp_enqueue_script and wp_enqueue_style hooks in here for anything they need loaded for
394
+	 * their pages/subpages.  Note this is for all pages/subpages of the system.  You can also load only specific
395
+	 * scripts/styles per view by putting them in a dynamic function in this format
396
+	 * (load_scripts_styles_{$this->_current_view}) which matches your page route (action request arg)
397
+	 *
398
+	 * @abstract
399
+	 * @return void
400
+	 */
401
+	abstract public function load_scripts_styles();
402
+
403
+
404
+	/**
405
+	 * admin_init
406
+	 * Anything that should be set/executed at 'admin_init' WP hook runtime should be put in here.  This will apply to
407
+	 * all pages/views loaded by child class.
408
+	 *
409
+	 * @abstract
410
+	 * @return void
411
+	 */
412
+	abstract public function admin_init();
413
+
414
+
415
+	/**
416
+	 * admin_notices
417
+	 * Anything triggered by the 'admin_notices' WP hook should be put in here.  This particular method will apply to
418
+	 * all pages/views loaded by child class.
419
+	 *
420
+	 * @abstract
421
+	 * @return void
422
+	 */
423
+	abstract public function admin_notices();
424
+
425
+
426
+	/**
427
+	 * admin_footer_scripts
428
+	 * Anything triggered by the 'admin_print_footer_scripts' WP hook should be put in here. This particular method
429
+	 * will apply to all pages/views loaded by child class.
430
+	 *
431
+	 * @return void
432
+	 */
433
+	abstract public function admin_footer_scripts();
434
+
435
+
436
+	/**
437
+	 * admin_footer
438
+	 * anything triggered by the 'admin_footer' WP action hook should be added to here. This particular method will
439
+	 * apply to all pages/views loaded by child class.
440
+	 *
441
+	 * @return void
442
+	 */
443
+	public function admin_footer()
444
+	{
445
+	}
446
+
447
+
448
+	/**
449
+	 * _global_ajax_hooks
450
+	 * all global add_action('wp_ajax_{name_of_hook}') hooks in here.
451
+	 * Note: within the ajax callback methods.
452
+	 *
453
+	 * @abstract
454
+	 * @return void
455
+	 */
456
+	protected function _global_ajax_hooks()
457
+	{
458
+		// for lazy loading of metabox content
459
+		add_action('wp_ajax_espresso-ajax-content', array($this, 'ajax_metabox_content'), 10);
460
+	}
461
+
462
+
463
+	public function ajax_metabox_content()
464
+	{
465
+		$contentid = isset($this->_req_data['contentid']) ? $this->_req_data['contentid'] : '';
466
+		$url = isset($this->_req_data['contenturl']) ? $this->_req_data['contenturl'] : '';
467
+		self::cached_rss_display($contentid, $url);
468
+		wp_die();
469
+	}
470
+
471
+
472
+	/**
473
+	 * _page_setup
474
+	 * Makes sure any things that need to be loaded early get handled.  We also escape early here if the page requested
475
+	 * doesn't match the object.
476
+	 *
477
+	 * @final
478
+	 * @return void
479
+	 * @throws EE_Error
480
+	 * @throws InvalidArgumentException
481
+	 * @throws ReflectionException
482
+	 * @throws InvalidDataTypeException
483
+	 * @throws InvalidInterfaceException
484
+	 */
485
+	final protected function _page_setup()
486
+	{
487
+		// requires?
488
+		// admin_init stuff - global - we're setting this REALLY early so if EE_Admin pages have to hook into other WP pages they can.  But keep in mind, not everything is available from the EE_Admin Page object at this point.
489
+		add_action('admin_init', array($this, 'admin_init_global'), 5);
490
+		// next verify if we need to load anything...
491
+		$this->_current_page = ! empty($_GET['page']) ? sanitize_key($_GET['page']) : '';
492
+		$this->page_folder = strtolower(
493
+			str_replace(array('_Admin_Page', 'Extend_'), '', get_class($this))
494
+		);
495
+		global $ee_menu_slugs;
496
+		$ee_menu_slugs = (array) $ee_menu_slugs;
497
+		if (! defined('DOING_AJAX') && (! $this->_current_page || ! isset($ee_menu_slugs[ $this->_current_page ]))) {
498
+			return;
499
+		}
500
+		// 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
501
+		if (isset($this->_req_data['action2']) && $this->_req_data['action'] === '-1') {
502
+			$this->_req_data['action'] = ! empty($this->_req_data['action2']) && $this->_req_data['action2'] !== '-1'
503
+				? $this->_req_data['action2']
504
+				: $this->_req_data['action'];
505
+		}
506
+		// then set blank or -1 action values to 'default'
507
+		$this->_req_action = isset($this->_req_data['action'])
508
+							 && ! empty($this->_req_data['action'])
509
+							 && $this->_req_data['action'] !== '-1'
510
+			? sanitize_key($this->_req_data['action'])
511
+			: 'default';
512
+		// if action is 'default' after the above BUT we have  'route' var set, then let's use the route as the action.
513
+		//  This covers cases where we're coming in from a list table that isn't on the default route.
514
+		$this->_req_action = $this->_req_action === 'default' && isset($this->_req_data['route'])
515
+			? $this->_req_data['route'] : $this->_req_action;
516
+		// however if we are doing_ajax and we've got a 'route' set then that's what the req_action will be
517
+		$this->_req_action = defined('DOING_AJAX') && isset($this->_req_data['route'])
518
+			? $this->_req_data['route']
519
+			: $this->_req_action;
520
+		$this->_current_view = $this->_req_action;
521
+		$this->_req_nonce = $this->_req_action . '_nonce';
522
+		$this->_define_page_props();
523
+		$this->_current_page_view_url = add_query_arg(
524
+			array('page' => $this->_current_page, 'action' => $this->_current_view),
525
+			$this->_admin_base_url
526
+		);
527
+		// default things
528
+		$this->_default_espresso_metaboxes = array(
529
+			'_espresso_news_post_box',
530
+			'_espresso_links_post_box',
531
+			'_espresso_ratings_request',
532
+			'_espresso_sponsors_post_box',
533
+		);
534
+		// set page configs
535
+		$this->_set_page_routes();
536
+		$this->_set_page_config();
537
+		// let's include any referrer data in our default_query_args for this route for "stickiness".
538
+		if (isset($this->_req_data['wp_referer'])) {
539
+			$this->_default_route_query_args['wp_referer'] = $this->_req_data['wp_referer'];
540
+		}
541
+		// for caffeinated and other extended functionality.
542
+		//  If there is a _extend_page_config method
543
+		// then let's run that to modify the all the various page configuration arrays
544
+		if (method_exists($this, '_extend_page_config')) {
545
+			$this->_extend_page_config();
546
+		}
547
+		// for CPT and other extended functionality.
548
+		// If there is an _extend_page_config_for_cpt
549
+		// then let's run that to modify all the various page configuration arrays.
550
+		if (method_exists($this, '_extend_page_config_for_cpt')) {
551
+			$this->_extend_page_config_for_cpt();
552
+		}
553
+		// filter routes and page_config so addons can add their stuff. Filtering done per class
554
+		$this->_page_routes = apply_filters(
555
+			'FHEE__' . get_class($this) . '__page_setup__page_routes',
556
+			$this->_page_routes,
557
+			$this
558
+		);
559
+		$this->_page_config = apply_filters(
560
+			'FHEE__' . get_class($this) . '__page_setup__page_config',
561
+			$this->_page_config,
562
+			$this
563
+		);
564
+		// if AHEE__EE_Admin_Page__route_admin_request_$this->_current_view method is present
565
+		// then we call it hooked into the AHEE__EE_Admin_Page__route_admin_request action
566
+		if (method_exists($this, 'AHEE__EE_Admin_Page__route_admin_request_' . $this->_current_view)) {
567
+			add_action(
568
+				'AHEE__EE_Admin_Page__route_admin_request',
569
+				array($this, 'AHEE__EE_Admin_Page__route_admin_request_' . $this->_current_view),
570
+				10,
571
+				2
572
+			);
573
+		}
574
+		// next route only if routing enabled
575
+		if ($this->_routing && ! defined('DOING_AJAX')) {
576
+			$this->_verify_routes();
577
+			// next let's just check user_access and kill if no access
578
+			$this->check_user_access();
579
+			if ($this->_is_UI_request) {
580
+				// admin_init stuff - global, all views for this page class, specific view
581
+				add_action('admin_init', array($this, 'admin_init'), 10);
582
+				if (method_exists($this, 'admin_init_' . $this->_current_view)) {
583
+					add_action('admin_init', array($this, 'admin_init_' . $this->_current_view), 15);
584
+				}
585
+			} else {
586
+				// hijack regular WP loading and route admin request immediately
587
+				@ini_set('memory_limit', apply_filters('admin_memory_limit', WP_MAX_MEMORY_LIMIT));
588
+				$this->route_admin_request();
589
+			}
590
+		}
591
+	}
592
+
593
+
594
+	/**
595
+	 * Provides a way for related child admin pages to load stuff on the loaded admin page.
596
+	 *
597
+	 * @return void
598
+	 * @throws ReflectionException
599
+	 * @throws EE_Error
600
+	 */
601
+	private function _do_other_page_hooks()
602
+	{
603
+		$registered_pages = apply_filters('FHEE_do_other_page_hooks_' . $this->page_slug, array());
604
+		foreach ($registered_pages as $page) {
605
+			// now let's setup the file name and class that should be present
606
+			$classname = str_replace('.class.php', '', $page);
607
+			// autoloaders should take care of loading file
608
+			if (! class_exists($classname)) {
609
+				$error_msg[] = sprintf(
610
+					esc_html__(
611
+						'Something went wrong with loading the %s admin hooks page.',
612
+						'event_espresso'
613
+					),
614
+					$page
615
+				);
616
+				$error_msg[] = $error_msg[0]
617
+							   . "\r\n"
618
+							   . sprintf(
619
+								   esc_html__(
620
+									   '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',
621
+									   'event_espresso'
622
+								   ),
623
+								   $page,
624
+								   '<br />',
625
+								   '<strong>' . $classname . '</strong>'
626
+							   );
627
+				throw new EE_Error(implode('||', $error_msg));
628
+			}
629
+			$a = new ReflectionClass($classname);
630
+			// notice we are passing the instance of this class to the hook object.
631
+			$hookobj[] = $a->newInstance($this);
632
+		}
633
+	}
634
+
635
+
636
+	public function load_page_dependencies()
637
+	{
638
+		try {
639
+			$this->_load_page_dependencies();
640
+		} catch (EE_Error $e) {
641
+			$e->get_error();
642
+		}
643
+	}
644
+
645
+
646
+	/**
647
+	 * load_page_dependencies
648
+	 * loads things specific to this page class when its loaded.  Really helps with efficiency.
649
+	 *
650
+	 * @return void
651
+	 * @throws DomainException
652
+	 * @throws EE_Error
653
+	 * @throws InvalidArgumentException
654
+	 * @throws InvalidDataTypeException
655
+	 * @throws InvalidInterfaceException
656
+	 * @throws ReflectionException
657
+	 */
658
+	protected function _load_page_dependencies()
659
+	{
660
+		// let's set the current_screen and screen options to override what WP set
661
+		$this->_current_screen = get_current_screen();
662
+		// load admin_notices - global, page class, and view specific
663
+		add_action('admin_notices', array($this, 'admin_notices_global'), 5);
664
+		add_action('admin_notices', array($this, 'admin_notices'), 10);
665
+		if (method_exists($this, 'admin_notices_' . $this->_current_view)) {
666
+			add_action('admin_notices', array($this, 'admin_notices_' . $this->_current_view), 15);
667
+		}
668
+		// load network admin_notices - global, page class, and view specific
669
+		add_action('network_admin_notices', array($this, 'network_admin_notices_global'), 5);
670
+		if (method_exists($this, 'network_admin_notices_' . $this->_current_view)) {
671
+			add_action('network_admin_notices', array($this, 'network_admin_notices_' . $this->_current_view));
672
+		}
673
+		// this will save any per_page screen options if they are present
674
+		$this->_set_per_page_screen_options();
675
+		// setup list table properties
676
+		$this->_set_list_table();
677
+		// child classes can "register" a metabox to be automatically handled via the _page_config array property.
678
+		// However in some cases the metaboxes will need to be added within a route handling callback.
679
+		$this->_add_registered_meta_boxes();
680
+		$this->_add_screen_columns();
681
+		// add screen options - global, page child class, and view specific
682
+		$this->_add_global_screen_options();
683
+		$this->_add_screen_options();
684
+		$add_screen_options = "_add_screen_options_{$this->_current_view}";
685
+		if (method_exists($this, $add_screen_options)) {
686
+			$this->{$add_screen_options}();
687
+		}
688
+		// add help tab(s) and tours- set via page_config and qtips.
689
+		$this->_add_help_tour();
690
+		$this->_add_help_tabs();
691
+		$this->_add_qtips();
692
+		// add feature_pointers - global, page child class, and view specific
693
+		$this->_add_feature_pointers();
694
+		$this->_add_global_feature_pointers();
695
+		$add_feature_pointer = "_add_feature_pointer_{$this->_current_view}";
696
+		if (method_exists($this, $add_feature_pointer)) {
697
+			$this->{$add_feature_pointer}();
698
+		}
699
+		// enqueue scripts/styles - global, page class, and view specific
700
+		add_action('admin_enqueue_scripts', array($this, 'load_global_scripts_styles'), 5);
701
+		add_action('admin_enqueue_scripts', array($this, 'load_scripts_styles'), 10);
702
+		if (method_exists($this, "load_scripts_styles_{$this->_current_view}")) {
703
+			add_action('admin_enqueue_scripts', array($this, "load_scripts_styles_{$this->_current_view}"), 15);
704
+		}
705
+		add_action('admin_enqueue_scripts', array($this, 'admin_footer_scripts_eei18n_js_strings'), 100);
706
+		// admin_print_footer_scripts - global, page child class, and view specific.
707
+		// NOTE, despite the name, whenever possible, scripts should NOT be loaded using this.
708
+		// In most cases that's doing_it_wrong().  But adding hidden container elements etc.
709
+		// is a good use case. Notice the late priority we're giving these
710
+		add_action('admin_print_footer_scripts', array($this, 'admin_footer_scripts_global'), 99);
711
+		add_action('admin_print_footer_scripts', array($this, 'admin_footer_scripts'), 100);
712
+		if (method_exists($this, "admin_footer_scripts_{$this->_current_view}")) {
713
+			add_action('admin_print_footer_scripts', array($this, "admin_footer_scripts_{$this->_current_view}"), 101);
714
+		}
715
+		// admin footer scripts
716
+		add_action('admin_footer', array($this, 'admin_footer_global'), 99);
717
+		add_action('admin_footer', array($this, 'admin_footer'), 100);
718
+		if (method_exists($this, "admin_footer_{$this->_current_view}")) {
719
+			add_action('admin_footer', array($this, "admin_footer_{$this->_current_view}"), 101);
720
+		}
721
+		do_action('FHEE__EE_Admin_Page___load_page_dependencies__after_load', $this->page_slug);
722
+		// targeted hook
723
+		do_action(
724
+			"FHEE__EE_Admin_Page___load_page_dependencies__after_load__{$this->page_slug}__{$this->_req_action}"
725
+		);
726
+	}
727
+
728
+
729
+	/**
730
+	 * _set_defaults
731
+	 * This sets some global defaults for class properties.
732
+	 */
733
+	private function _set_defaults()
734
+	{
735
+		$this->_current_screen = $this->_admin_page_title = $this->_req_action = $this->_req_nonce = null;
736
+		$this->_event = $this->_template_path = $this->_column_template_path = null;
737
+		$this->_nav_tabs = $this->_views = $this->_page_routes = array();
738
+		$this->_page_config = $this->_default_route_query_args = array();
739
+		$this->_default_nav_tab_name = 'overview';
740
+		// init template args
741
+		$this->_template_args = array(
742
+			'admin_page_header'  => '',
743
+			'admin_page_content' => '',
744
+			'post_body_content'  => '',
745
+			'before_list_table'  => '',
746
+			'after_list_table'   => '',
747
+		);
748
+	}
749
+
750
+
751
+	/**
752
+	 * route_admin_request
753
+	 *
754
+	 * @see    _route_admin_request()
755
+	 * @return exception|void error
756
+	 * @throws InvalidArgumentException
757
+	 * @throws InvalidInterfaceException
758
+	 * @throws InvalidDataTypeException
759
+	 * @throws EE_Error
760
+	 * @throws ReflectionException
761
+	 */
762
+	public function route_admin_request()
763
+	{
764
+		try {
765
+			$this->_route_admin_request();
766
+		} catch (EE_Error $e) {
767
+			$e->get_error();
768
+		}
769
+	}
770
+
771
+
772
+	public function set_wp_page_slug($wp_page_slug)
773
+	{
774
+		$this->_wp_page_slug = $wp_page_slug;
775
+		// if in network admin then we need to append "-network" to the page slug. Why? Because that's how WP rolls...
776
+		if (is_network_admin()) {
777
+			$this->_wp_page_slug .= '-network';
778
+		}
779
+	}
780
+
781
+
782
+	/**
783
+	 * _verify_routes
784
+	 * All this method does is verify the incoming request and make sure that routes exist for it.  We do this early so
785
+	 * we know if we need to drop out.
786
+	 *
787
+	 * @return bool
788
+	 * @throws EE_Error
789
+	 */
790
+	protected function _verify_routes()
791
+	{
792
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
793
+		if (! $this->_current_page && ! defined('DOING_AJAX')) {
794
+			return false;
795
+		}
796
+		$this->_route = false;
797
+		// check that the page_routes array is not empty
798
+		if (empty($this->_page_routes)) {
799
+			// user error msg
800
+			$error_msg = sprintf(
801
+				esc_html__('No page routes have been set for the %s admin page.', 'event_espresso'),
802
+				$this->_admin_page_title
803
+			);
804
+			// developer error msg
805
+			$error_msg .= '||' . $error_msg
806
+						  . esc_html__(
807
+							  ' Make sure the "set_page_routes()" method exists, and is setting the "_page_routes" array properly.',
808
+							  'event_espresso'
809
+						  );
810
+			throw new EE_Error($error_msg);
811
+		}
812
+		// and that the requested page route exists
813
+		if (array_key_exists($this->_req_action, $this->_page_routes)) {
814
+			$this->_route = $this->_page_routes[ $this->_req_action ];
815
+			$this->_route_config = isset($this->_page_config[ $this->_req_action ])
816
+				? $this->_page_config[ $this->_req_action ] : array();
817
+		} else {
818
+			// user error msg
819
+			$error_msg = sprintf(
820
+				esc_html__(
821
+					'The requested page route does not exist for the %s admin page.',
822
+					'event_espresso'
823
+				),
824
+				$this->_admin_page_title
825
+			);
826
+			// developer error msg
827
+			$error_msg .= '||' . $error_msg
828
+						  . sprintf(
829
+							  esc_html__(
830
+								  ' Create a key in the "_page_routes" array named "%s" and set its value to the appropriate method.',
831
+								  'event_espresso'
832
+							  ),
833
+							  $this->_req_action
834
+						  );
835
+			throw new EE_Error($error_msg);
836
+		}
837
+		// and that a default route exists
838
+		if (! array_key_exists('default', $this->_page_routes)) {
839
+			// user error msg
840
+			$error_msg = sprintf(
841
+				esc_html__(
842
+					'A default page route has not been set for the % admin page.',
843
+					'event_espresso'
844
+				),
845
+				$this->_admin_page_title
846
+			);
847
+			// developer error msg
848
+			$error_msg .= '||' . $error_msg
849
+						  . esc_html__(
850
+							  ' Create a key in the "_page_routes" array named "default" and set its value to your default page method.',
851
+							  'event_espresso'
852
+						  );
853
+			throw new EE_Error($error_msg);
854
+		}
855
+		// first lets' catch if the UI request has EVER been set.
856
+		if ($this->_is_UI_request === null) {
857
+			// lets set if this is a UI request or not.
858
+			$this->_is_UI_request = ! isset($this->_req_data['noheader']) || $this->_req_data['noheader'] !== true;
859
+			// wait a minute... we might have a noheader in the route array
860
+			$this->_is_UI_request = is_array($this->_route)
861
+									&& isset($this->_route['noheader'])
862
+									&& $this->_route['noheader'] ? false : $this->_is_UI_request;
863
+		}
864
+		$this->_set_current_labels();
865
+		return true;
866
+	}
867
+
868
+
869
+	/**
870
+	 * this method simply verifies a given route and makes sure its an actual route available for the loaded page
871
+	 *
872
+	 * @param  string $route the route name we're verifying
873
+	 * @return mixed (bool|Exception)      we'll throw an exception if this isn't a valid route.
874
+	 * @throws EE_Error
875
+	 */
876
+	protected function _verify_route($route)
877
+	{
878
+		if (array_key_exists($this->_req_action, $this->_page_routes)) {
879
+			return true;
880
+		}
881
+		// user error msg
882
+		$error_msg = sprintf(
883
+			esc_html__('The given page route does not exist for the %s admin page.', 'event_espresso'),
884
+			$this->_admin_page_title
885
+		);
886
+		// developer error msg
887
+		$error_msg .= '||' . $error_msg
888
+					  . sprintf(
889
+						  esc_html__(
890
+							  ' Check the route you are using in your method (%s) and make sure it matches a route set in your "_page_routes" array property',
891
+							  'event_espresso'
892
+						  ),
893
+						  $route
894
+					  );
895
+		throw new EE_Error($error_msg);
896
+	}
897
+
898
+
899
+	/**
900
+	 * perform nonce verification
901
+	 * This method has be encapsulated here so that any ajax requests that bypass normal routes can verify their nonces
902
+	 * using this method (and save retyping!)
903
+	 *
904
+	 * @param  string $nonce     The nonce sent
905
+	 * @param  string $nonce_ref The nonce reference string (name0)
906
+	 * @return void
907
+	 * @throws EE_Error
908
+	 */
909
+	protected function _verify_nonce($nonce, $nonce_ref)
910
+	{
911
+		// verify nonce against expected value
912
+		if (! wp_verify_nonce($nonce, $nonce_ref)) {
913
+			// these are not the droids you are looking for !!!
914
+			$msg = sprintf(
915
+				esc_html__('%sNonce Fail.%s', 'event_espresso'),
916
+				'<a href="http://www.youtube.com/watch?v=56_S0WeTkzs">',
917
+				'</a>'
918
+			);
919
+			if (WP_DEBUG) {
920
+				$msg .= "\n  "
921
+						. sprintf(
922
+							esc_html__(
923
+								'In order to dynamically generate nonces for your actions, use the %s::add_query_args_and_nonce() method. May the Nonce be with you!',
924
+								'event_espresso'
925
+							),
926
+							__CLASS__
927
+						);
928
+			}
929
+			if (! defined('DOING_AJAX')) {
930
+				wp_die($msg);
931
+			} else {
932
+				EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
933
+				$this->_return_json();
934
+			}
935
+		}
936
+	}
937
+
938
+
939
+	/**
940
+	 * _route_admin_request()
941
+	 * Meat and potatoes of the class.  Basically, this dude checks out what's being requested and sees if theres are
942
+	 * some doodads to work the magic and handle the flingjangy. Translation:  Checks if the requested action is listed
943
+	 * in the page routes and then will try to load the corresponding method.
944
+	 *
945
+	 * @return void
946
+	 * @throws EE_Error
947
+	 * @throws InvalidArgumentException
948
+	 * @throws InvalidDataTypeException
949
+	 * @throws InvalidInterfaceException
950
+	 * @throws ReflectionException
951
+	 */
952
+	protected function _route_admin_request()
953
+	{
954
+		if (! $this->_is_UI_request) {
955
+			$this->_verify_routes();
956
+		}
957
+		$nonce_check = isset($this->_route_config['require_nonce'])
958
+			? $this->_route_config['require_nonce']
959
+			: true;
960
+		if ($this->_req_action !== 'default' && $nonce_check) {
961
+			// set nonce from post data
962
+			$nonce = isset($this->_req_data[ $this->_req_nonce ])
963
+				? sanitize_text_field($this->_req_data[ $this->_req_nonce ])
964
+				: '';
965
+			$this->_verify_nonce($nonce, $this->_req_nonce);
966
+		}
967
+		// set the nav_tabs array but ONLY if this is  UI_request
968
+		if ($this->_is_UI_request) {
969
+			$this->_set_nav_tabs();
970
+		}
971
+		// grab callback function
972
+		$func = is_array($this->_route) ? $this->_route['func'] : $this->_route;
973
+		// check if callback has args
974
+		$args = is_array($this->_route) && isset($this->_route['args']) ? $this->_route['args'] : array();
975
+		$error_msg = '';
976
+		// action right before calling route
977
+		// (hook is something like 'AHEE__Registrations_Admin_Page__route_admin_request')
978
+		if (! did_action('AHEE__EE_Admin_Page__route_admin_request')) {
979
+			do_action('AHEE__EE_Admin_Page__route_admin_request', $this->_current_view, $this);
980
+		}
981
+		// right before calling the route, let's remove _wp_http_referer from the
982
+		// $_SERVER[REQUEST_URI] global (its now in _req_data for route processing).
983
+		$_SERVER['REQUEST_URI'] = remove_query_arg(
984
+			'_wp_http_referer',
985
+			wp_unslash($_SERVER['REQUEST_URI'])
986
+		);
987
+		if (! empty($func)) {
988
+			if (is_array($func)) {
989
+				list($class, $method) = $func;
990
+			} elseif (strpos($func, '::') !== false) {
991
+				list($class, $method) = explode('::', $func);
992
+			} else {
993
+				$class = $this;
994
+				$method = $func;
995
+			}
996
+			if (! (is_object($class) && $class === $this)) {
997
+				// send along this admin page object for access by addons.
998
+				$args['admin_page_object'] = $this;
999
+			}
1000
+			if (// is it a method on a class that doesn't work?
1001
+				(
1002
+					(
1003
+						method_exists($class, $method)
1004
+						&& call_user_func_array(array($class, $method), $args) === false
1005
+					)
1006
+					&& (
1007
+						// is it a standalone function that doesn't work?
1008
+						function_exists($method)
1009
+						&& call_user_func_array(
1010
+							$func,
1011
+							array_merge(array('admin_page_object' => $this), $args)
1012
+						) === false
1013
+					)
1014
+				)
1015
+				|| (
1016
+					// is it neither a class method NOR a standalone function?
1017
+					! method_exists($class, $method)
1018
+					&& ! function_exists($method)
1019
+				)
1020
+			) {
1021
+				// user error msg
1022
+				$error_msg = esc_html__(
1023
+					'An error occurred. The  requested page route could not be found.',
1024
+					'event_espresso'
1025
+				);
1026
+				// developer error msg
1027
+				$error_msg .= '||';
1028
+				$error_msg .= sprintf(
1029
+					esc_html__(
1030
+						'Page route "%s" could not be called. Check that the spelling for method names and actions in the "_page_routes" array are all correct.',
1031
+						'event_espresso'
1032
+					),
1033
+					$method
1034
+				);
1035
+			}
1036
+			if (! empty($error_msg)) {
1037
+				throw new EE_Error($error_msg);
1038
+			}
1039
+		}
1040
+		// if we've routed and this route has a no headers route AND a sent_headers_route,
1041
+		// then we need to reset the routing properties to the new route.
1042
+		// 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.
1043
+		if ($this->_is_UI_request === false
1044
+			&& is_array($this->_route)
1045
+			&& ! empty($this->_route['headers_sent_route'])
1046
+		) {
1047
+			$this->_reset_routing_properties($this->_route['headers_sent_route']);
1048
+		}
1049
+	}
1050
+
1051
+
1052
+	/**
1053
+	 * This method just allows the resetting of page properties in the case where a no headers
1054
+	 * route redirects to a headers route in its route config.
1055
+	 *
1056
+	 * @since   4.3.0
1057
+	 * @param  string $new_route New (non header) route to redirect to.
1058
+	 * @return   void
1059
+	 * @throws ReflectionException
1060
+	 * @throws InvalidArgumentException
1061
+	 * @throws InvalidInterfaceException
1062
+	 * @throws InvalidDataTypeException
1063
+	 * @throws EE_Error
1064
+	 */
1065
+	protected function _reset_routing_properties($new_route)
1066
+	{
1067
+		$this->_is_UI_request = true;
1068
+		// now we set the current route to whatever the headers_sent_route is set at
1069
+		$this->_req_data['action'] = $new_route;
1070
+		// rerun page setup
1071
+		$this->_page_setup();
1072
+	}
1073
+
1074
+
1075
+	/**
1076
+	 * _add_query_arg
1077
+	 * adds nonce to array of arguments then calls WP add_query_arg function
1078
+	 *(internally just uses EEH_URL's function with the same name)
1079
+	 *
1080
+	 * @param array  $args
1081
+	 * @param string $url
1082
+	 * @param bool   $sticky                  if true, then the existing Request params will be appended to the
1083
+	 *                                        generated url in an associative array indexed by the key 'wp_referer';
1084
+	 *                                        Example usage: If the current page is:
1085
+	 *                                        http://mydomain.com/wp-admin/admin.php?page=espresso_registrations
1086
+	 *                                        &action=default&event_id=20&month_range=March%202015
1087
+	 *                                        &_wpnonce=5467821
1088
+	 *                                        and you call:
1089
+	 *                                        EE_Admin_Page::add_query_args_and_nonce(
1090
+	 *                                        array(
1091
+	 *                                        'action' => 'resend_something',
1092
+	 *                                        'page=>espresso_registrations'
1093
+	 *                                        ),
1094
+	 *                                        $some_url,
1095
+	 *                                        true
1096
+	 *                                        );
1097
+	 *                                        It will produce a url in this structure:
1098
+	 *                                        http://{$some_url}/?page=espresso_registrations&action=resend_something
1099
+	 *                                        &wp_referer[action]=default&wp_referer[event_id]=20&wpreferer[
1100
+	 *                                        month_range]=March%202015
1101
+	 * @param   bool $exclude_nonce           If true, the the nonce will be excluded from the generated nonce.
1102
+	 * @return string
1103
+	 */
1104
+	public static function add_query_args_and_nonce(
1105
+		$args = array(),
1106
+		$url = false,
1107
+		$sticky = false,
1108
+		$exclude_nonce = false
1109
+	) {
1110
+		// if there is a _wp_http_referer include the values from the request but only if sticky = true
1111
+		if ($sticky) {
1112
+			$request = $_REQUEST;
1113
+			unset($request['_wp_http_referer']);
1114
+			unset($request['wp_referer']);
1115
+			foreach ($request as $key => $value) {
1116
+				// do not add nonces
1117
+				if (strpos($key, 'nonce') !== false) {
1118
+					continue;
1119
+				}
1120
+				$args[ 'wp_referer[' . $key . ']' ] = $value;
1121
+			}
1122
+		}
1123
+		return EEH_URL::add_query_args_and_nonce($args, $url, $exclude_nonce);
1124
+	}
1125
+
1126
+
1127
+	/**
1128
+	 * This returns a generated link that will load the related help tab.
1129
+	 *
1130
+	 * @param  string $help_tab_id the id for the connected help tab
1131
+	 * @param  string $icon_style  (optional) include css class for the style you want to use for the help icon.
1132
+	 * @param  string $help_text   (optional) send help text you want to use for the link if default not to be used
1133
+	 * @uses EEH_Template::get_help_tab_link()
1134
+	 * @return string              generated link
1135
+	 */
1136
+	protected function _get_help_tab_link($help_tab_id, $icon_style = '', $help_text = '')
1137
+	{
1138
+		return EEH_Template::get_help_tab_link(
1139
+			$help_tab_id,
1140
+			$this->page_slug,
1141
+			$this->_req_action,
1142
+			$icon_style,
1143
+			$help_text
1144
+		);
1145
+	}
1146
+
1147
+
1148
+	/**
1149
+	 * _add_help_tabs
1150
+	 * Note child classes define their help tabs within the page_config array.
1151
+	 *
1152
+	 * @link   http://codex.wordpress.org/Function_Reference/add_help_tab
1153
+	 * @return void
1154
+	 * @throws DomainException
1155
+	 * @throws EE_Error
1156
+	 */
1157
+	protected function _add_help_tabs()
1158
+	{
1159
+		$tour_buttons = '';
1160
+		if (isset($this->_page_config[ $this->_req_action ])) {
1161
+			$config = $this->_page_config[ $this->_req_action ];
1162
+			// is there a help tour for the current route?  if there is let's setup the tour buttons
1163
+			if (isset($this->_help_tour[ $this->_req_action ])) {
1164
+				$tb = array();
1165
+				$tour_buttons = '<div class="ee-abs-container"><div class="ee-help-tour-restart-buttons">';
1166
+				foreach ($this->_help_tour['tours'] as $tour) {
1167
+					// if this is the end tour then we don't need to setup a button
1168
+					if ($tour instanceof EE_Help_Tour_final_stop || ! $tour instanceof EE_Help_Tour) {
1169
+						continue;
1170
+					}
1171
+					$tb[] = '<button id="trigger-tour-'
1172
+							. $tour->get_slug()
1173
+							. '" class="button-primary trigger-ee-help-tour">'
1174
+							. $tour->get_label()
1175
+							. '</button>';
1176
+				}
1177
+				$tour_buttons .= implode('<br />', $tb);
1178
+				$tour_buttons .= '</div></div>';
1179
+			}
1180
+			// let's see if there is a help_sidebar set for the current route and we'll set that up for usage as well.
1181
+			if (is_array($config) && isset($config['help_sidebar'])) {
1182
+				// check that the callback given is valid
1183
+				if (! method_exists($this, $config['help_sidebar'])) {
1184
+					throw new EE_Error(
1185
+						sprintf(
1186
+							esc_html__(
1187
+								'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',
1188
+								'event_espresso'
1189
+							),
1190
+							$config['help_sidebar'],
1191
+							get_class($this)
1192
+						)
1193
+					);
1194
+				}
1195
+				$content = apply_filters(
1196
+					'FHEE__' . get_class($this) . '__add_help_tabs__help_sidebar',
1197
+					$this->{$config['help_sidebar']}()
1198
+				);
1199
+				$content .= $tour_buttons; // add help tour buttons.
1200
+				// do we have any help tours setup?  Cause if we do we want to add the buttons
1201
+				$this->_current_screen->set_help_sidebar($content);
1202
+			}
1203
+			// if we DON'T have config help sidebar and there ARE tour buttons then we'll just add the tour buttons to the sidebar.
1204
+			if (! isset($config['help_sidebar']) && ! empty($tour_buttons)) {
1205
+				$this->_current_screen->set_help_sidebar($tour_buttons);
1206
+			}
1207
+			// handle if no help_tabs are set so the sidebar will still show for the help tour buttons
1208
+			if (! isset($config['help_tabs']) && ! empty($tour_buttons)) {
1209
+				$_ht['id'] = $this->page_slug;
1210
+				$_ht['title'] = esc_html__('Help Tours', 'event_espresso');
1211
+				$_ht['content'] = '<p>'
1212
+								  . esc_html__(
1213
+									  'The buttons to the right allow you to start/restart any help tours available for this page',
1214
+									  'event_espresso'
1215
+								  ) . '</p>';
1216
+				$this->_current_screen->add_help_tab($_ht);
1217
+			}
1218
+			if (! isset($config['help_tabs'])) {
1219
+				return;
1220
+			} //no help tabs for this route
1221
+			foreach ((array) $config['help_tabs'] as $tab_id => $cfg) {
1222
+				// we're here so there ARE help tabs!
1223
+				// make sure we've got what we need
1224
+				if (! isset($cfg['title'])) {
1225
+					throw new EE_Error(
1226
+						esc_html__(
1227
+							'The _page_config array is not set up properly for help tabs.  It is missing a title',
1228
+							'event_espresso'
1229
+						)
1230
+					);
1231
+				}
1232
+				if (! isset($cfg['filename']) && ! isset($cfg['callback']) && ! isset($cfg['content'])) {
1233
+					throw new EE_Error(
1234
+						esc_html__(
1235
+							'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',
1236
+							'event_espresso'
1237
+						)
1238
+					);
1239
+				}
1240
+				// first priority goes to content.
1241
+				if (! empty($cfg['content'])) {
1242
+					$content = ! empty($cfg['content']) ? $cfg['content'] : null;
1243
+					// second priority goes to filename
1244
+				} elseif (! empty($cfg['filename'])) {
1245
+					$file_path = $this->_get_dir() . '/help_tabs/' . $cfg['filename'] . '.help_tab.php';
1246
+					// 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)
1247
+					$file_path = ! is_readable($file_path) ? EE_ADMIN_PAGES
1248
+															 . basename($this->_get_dir())
1249
+															 . '/help_tabs/'
1250
+															 . $cfg['filename']
1251
+															 . '.help_tab.php' : $file_path;
1252
+					// if file is STILL not readable then let's do a EE_Error so its more graceful than a fatal error.
1253
+					if (! isset($cfg['callback']) && ! is_readable($file_path)) {
1254
+						EE_Error::add_error(
1255
+							sprintf(
1256
+								esc_html__(
1257
+									'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',
1258
+									'event_espresso'
1259
+								),
1260
+								$tab_id,
1261
+								key($config),
1262
+								$file_path
1263
+							),
1264
+							__FILE__,
1265
+							__FUNCTION__,
1266
+							__LINE__
1267
+						);
1268
+						return;
1269
+					}
1270
+					$template_args['admin_page_obj'] = $this;
1271
+					$content = EEH_Template::display_template(
1272
+						$file_path,
1273
+						$template_args,
1274
+						true
1275
+					);
1276
+				} else {
1277
+					$content = '';
1278
+				}
1279
+				// check if callback is valid
1280
+				if (empty($content) && (
1281
+						! isset($cfg['callback']) || ! method_exists($this, $cfg['callback'])
1282
+					)
1283
+				) {
1284
+					EE_Error::add_error(
1285
+						sprintf(
1286
+							esc_html__(
1287
+								'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.',
1288
+								'event_espresso'
1289
+							),
1290
+							$cfg['title']
1291
+						),
1292
+						__FILE__,
1293
+						__FUNCTION__,
1294
+						__LINE__
1295
+					);
1296
+					return;
1297
+				}
1298
+				// setup config array for help tab method
1299
+				$id = $this->page_slug . '-' . $this->_req_action . '-' . $tab_id;
1300
+				$_ht = array(
1301
+					'id'       => $id,
1302
+					'title'    => $cfg['title'],
1303
+					'callback' => isset($cfg['callback']) && empty($content) ? array($this, $cfg['callback']) : null,
1304
+					'content'  => $content,
1305
+				);
1306
+				$this->_current_screen->add_help_tab($_ht);
1307
+			}
1308
+		}
1309
+	}
1310
+
1311
+
1312
+	/**
1313
+	 * This basically checks loaded $_page_config property to see if there are any help_tours defined.  "help_tours" is
1314
+	 * an array with properties for setting up usage of the joyride plugin
1315
+	 *
1316
+	 * @link   http://zurb.com/playground/jquery-joyride-feature-tour-plugin
1317
+	 * @see    instructions regarding the format and construction of the "help_tour" array element is found in the
1318
+	 *         _set_page_config() comments
1319
+	 * @return void
1320
+	 * @throws EE_Error
1321
+	 * @throws InvalidArgumentException
1322
+	 * @throws InvalidDataTypeException
1323
+	 * @throws InvalidInterfaceException
1324
+	 */
1325
+	protected function _add_help_tour()
1326
+	{
1327
+		$tours = array();
1328
+		$this->_help_tour = array();
1329
+		// exit early if help tours are turned off globally
1330
+		if ((defined('EE_DISABLE_HELP_TOURS') && EE_DISABLE_HELP_TOURS)
1331
+			|| ! EE_Registry::instance()->CFG->admin->help_tour_activation
1332
+		) {
1333
+			return;
1334
+		}
1335
+		// loop through _page_config to find any help_tour defined
1336
+		foreach ($this->_page_config as $route => $config) {
1337
+			// we're only going to set things up for this route
1338
+			if ($route !== $this->_req_action) {
1339
+				continue;
1340
+			}
1341
+			if (isset($config['help_tour'])) {
1342
+				foreach ($config['help_tour'] as $tour) {
1343
+					$file_path = $this->_get_dir() . '/help_tours/' . $tour . '.class.php';
1344
+					// let's see if we can get that file...
1345
+					// if not its possible this is a decaf route not set in caffeinated
1346
+					// so lets try and get the caffeinated equivalent
1347
+					$file_path = ! is_readable($file_path) ? EE_ADMIN_PAGES
1348
+															 . basename($this->_get_dir())
1349
+															 . '/help_tours/'
1350
+															 . $tour
1351
+															 . '.class.php' : $file_path;
1352
+					// if file is STILL not readable then let's do a EE_Error so its more graceful than a fatal error.
1353
+					if (! is_readable($file_path)) {
1354
+						EE_Error::add_error(
1355
+							sprintf(
1356
+								esc_html__(
1357
+									'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',
1358
+									'event_espresso'
1359
+								),
1360
+								$file_path,
1361
+								$tour
1362
+							),
1363
+							__FILE__,
1364
+							__FUNCTION__,
1365
+							__LINE__
1366
+						);
1367
+						return;
1368
+					}
1369
+					require_once $file_path;
1370
+					if (! class_exists($tour)) {
1371
+						$error_msg[] = sprintf(
1372
+							esc_html__('Something went wrong with loading the %s Help Tour Class.', 'event_espresso'),
1373
+							$tour
1374
+						);
1375
+						$error_msg[] = $error_msg[0] . "\r\n"
1376
+									   . sprintf(
1377
+										   esc_html__(
1378
+											   '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.',
1379
+											   'event_espresso'
1380
+										   ),
1381
+										   $tour,
1382
+										   '<br />',
1383
+										   $tour,
1384
+										   $this->_req_action,
1385
+										   get_class($this)
1386
+									   );
1387
+						throw new EE_Error(implode('||', $error_msg));
1388
+					}
1389
+					$tour_obj = new $tour($this->_is_caf);
1390
+					$tours[] = $tour_obj;
1391
+					$this->_help_tour[ $route ][] = EEH_Template::help_tour_stops_generator($tour_obj);
1392
+				}
1393
+				// let's inject the end tour stop element common to all pages... this will only get seen once per machine.
1394
+				$end_stop_tour = new EE_Help_Tour_final_stop($this->_is_caf);
1395
+				$tours[] = $end_stop_tour;
1396
+				$this->_help_tour[ $route ][] = EEH_Template::help_tour_stops_generator($end_stop_tour);
1397
+			}
1398
+		}
1399
+		if (! empty($tours)) {
1400
+			$this->_help_tour['tours'] = $tours;
1401
+		}
1402
+		// that's it!  Now that the $_help_tours property is set (or not)
1403
+		// the scripts and html should be taken care of automatically.
1404
+	}
1405
+
1406
+
1407
+	/**
1408
+	 * This simply sets up any qtips that have been defined in the page config
1409
+	 *
1410
+	 * @return void
1411
+	 */
1412
+	protected function _add_qtips()
1413
+	{
1414
+		if (isset($this->_route_config['qtips'])) {
1415
+			$qtips = (array) $this->_route_config['qtips'];
1416
+			// load qtip loader
1417
+			$path = array(
1418
+				$this->_get_dir() . '/qtips/',
1419
+				EE_ADMIN_PAGES . basename($this->_get_dir()) . '/qtips/',
1420
+			);
1421
+			EEH_Qtip_Loader::instance()->register($qtips, $path);
1422
+		}
1423
+	}
1424
+
1425
+
1426
+	/**
1427
+	 * _set_nav_tabs
1428
+	 * This sets up the nav tabs from the page_routes array.  This method can be overwritten by child classes if you
1429
+	 * wish to add additional tabs or modify accordingly.
1430
+	 *
1431
+	 * @return void
1432
+	 * @throws InvalidArgumentException
1433
+	 * @throws InvalidInterfaceException
1434
+	 * @throws InvalidDataTypeException
1435
+	 */
1436
+	protected function _set_nav_tabs()
1437
+	{
1438
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1439
+		$i = 0;
1440
+		foreach ($this->_page_config as $slug => $config) {
1441
+			if (! is_array($config)
1442
+				|| (
1443
+					is_array($config)
1444
+					&& (
1445
+						(isset($config['nav']) && ! $config['nav'])
1446
+						|| ! isset($config['nav'])
1447
+					)
1448
+				)
1449
+			) {
1450
+				continue;
1451
+			}
1452
+			// no nav tab for this config
1453
+			// check for persistent flag
1454
+			if ($slug !== $this->_req_action && isset($config['nav']['persistent']) && ! $config['nav']['persistent']) {
1455
+				// nav tab is only to appear when route requested.
1456
+				continue;
1457
+			}
1458
+			if (! $this->check_user_access($slug, true)) {
1459
+				// no nav tab because current user does not have access.
1460
+				continue;
1461
+			}
1462
+			$css_class = isset($config['css_class']) ? $config['css_class'] . ' ' : '';
1463
+			$this->_nav_tabs[ $slug ] = array(
1464
+				'url'       => isset($config['nav']['url'])
1465
+					? $config['nav']['url']
1466
+					: self::add_query_args_and_nonce(
1467
+						array('action' => $slug),
1468
+						$this->_admin_base_url
1469
+					),
1470
+				'link_text' => isset($config['nav']['label'])
1471
+					? $config['nav']['label']
1472
+					: ucwords(
1473
+						str_replace('_', ' ', $slug)
1474
+					),
1475
+				'css_class' => $this->_req_action === $slug ? $css_class . 'nav-tab-active' : $css_class,
1476
+				'order'     => isset($config['nav']['order']) ? $config['nav']['order'] : $i,
1477
+			);
1478
+			$i++;
1479
+		}
1480
+		// if $this->_nav_tabs is empty then lets set the default
1481
+		if (empty($this->_nav_tabs)) {
1482
+			$this->_nav_tabs[ $this->_default_nav_tab_name ] = array(
1483
+				'url'       => $this->_admin_base_url,
1484
+				'link_text' => ucwords(str_replace('_', ' ', $this->_default_nav_tab_name)),
1485
+				'css_class' => 'nav-tab-active',
1486
+				'order'     => 10,
1487
+			);
1488
+		}
1489
+		// now let's sort the tabs according to order
1490
+		usort($this->_nav_tabs, array($this, '_sort_nav_tabs'));
1491
+	}
1492
+
1493
+
1494
+	/**
1495
+	 * _set_current_labels
1496
+	 * This method modifies the _labels property with any optional specific labels indicated in the _page_routes
1497
+	 * property array
1498
+	 *
1499
+	 * @return void
1500
+	 */
1501
+	private function _set_current_labels()
1502
+	{
1503
+		if (is_array($this->_route_config) && isset($this->_route_config['labels'])) {
1504
+			foreach ($this->_route_config['labels'] as $label => $text) {
1505
+				if (is_array($text)) {
1506
+					foreach ($text as $sublabel => $subtext) {
1507
+						$this->_labels[ $label ][ $sublabel ] = $subtext;
1508
+					}
1509
+				} else {
1510
+					$this->_labels[ $label ] = $text;
1511
+				}
1512
+			}
1513
+		}
1514
+	}
1515
+
1516
+
1517
+	/**
1518
+	 *        verifies user access for this admin page
1519
+	 *
1520
+	 * @param string $route_to_check if present then the capability for the route matching this string is checked.
1521
+	 * @param bool   $verify_only    Default is FALSE which means if user check fails then wp_die().  Otherwise just
1522
+	 *                               return false if verify fail.
1523
+	 * @return bool
1524
+	 * @throws InvalidArgumentException
1525
+	 * @throws InvalidDataTypeException
1526
+	 * @throws InvalidInterfaceException
1527
+	 */
1528
+	public function check_user_access($route_to_check = '', $verify_only = false)
1529
+	{
1530
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1531
+		$route_to_check = empty($route_to_check) ? $this->_req_action : $route_to_check;
1532
+		$capability = ! empty($route_to_check) && isset($this->_page_routes[ $route_to_check ])
1533
+					  && is_array(
1534
+						  $this->_page_routes[ $route_to_check ]
1535
+					  )
1536
+					  && ! empty($this->_page_routes[ $route_to_check ]['capability'])
1537
+			? $this->_page_routes[ $route_to_check ]['capability'] : null;
1538
+		if (empty($capability) && empty($route_to_check)) {
1539
+			$capability = is_array($this->_route) && empty($this->_route['capability']) ? 'manage_options'
1540
+				: $this->_route['capability'];
1541
+		} else {
1542
+			$capability = empty($capability) ? 'manage_options' : $capability;
1543
+		}
1544
+		$id = is_array($this->_route) && ! empty($this->_route['obj_id']) ? $this->_route['obj_id'] : 0;
1545
+		if (! defined('DOING_AJAX')
1546
+			&& (
1547
+				! function_exists('is_admin')
1548
+				|| ! EE_Registry::instance()->CAP->current_user_can(
1549
+					$capability,
1550
+					$this->page_slug
1551
+					. '_'
1552
+					. $route_to_check,
1553
+					$id
1554
+				)
1555
+			)
1556
+		) {
1557
+			if ($verify_only) {
1558
+				return false;
1559
+			}
1560
+			if (is_user_logged_in()) {
1561
+				wp_die(__('You do not have access to this route.', 'event_espresso'));
1562
+			} else {
1563
+				return false;
1564
+			}
1565
+		}
1566
+		return true;
1567
+	}
1568
+
1569
+
1570
+	/**
1571
+	 * admin_init_global
1572
+	 * This runs all the code that we want executed within the WP admin_init hook.
1573
+	 * This method executes for ALL EE Admin pages.
1574
+	 *
1575
+	 * @return void
1576
+	 */
1577
+	public function admin_init_global()
1578
+	{
1579
+	}
1580
+
1581
+
1582
+	/**
1583
+	 * wp_loaded_global
1584
+	 * This runs all the code that we want executed within the WP wp_loaded hook.  This method is optional for an
1585
+	 * EE_Admin page and will execute on every EE Admin Page load
1586
+	 *
1587
+	 * @return void
1588
+	 */
1589
+	public function wp_loaded()
1590
+	{
1591
+	}
1592
+
1593
+
1594
+	/**
1595
+	 * admin_notices
1596
+	 * Anything triggered by the 'admin_notices' WP hook should be put in here.  This particular method will apply on
1597
+	 * ALL EE_Admin pages.
1598
+	 *
1599
+	 * @return void
1600
+	 */
1601
+	public function admin_notices_global()
1602
+	{
1603
+		$this->_display_no_javascript_warning();
1604
+		$this->_display_espresso_notices();
1605
+	}
1606
+
1607
+
1608
+	public function network_admin_notices_global()
1609
+	{
1610
+		$this->_display_no_javascript_warning();
1611
+		$this->_display_espresso_notices();
1612
+	}
1613
+
1614
+
1615
+	/**
1616
+	 * admin_footer_scripts_global
1617
+	 * Anything triggered by the 'admin_print_footer_scripts' WP hook should be put in here. This particular method
1618
+	 * will apply on ALL EE_Admin pages.
1619
+	 *
1620
+	 * @return void
1621
+	 */
1622
+	public function admin_footer_scripts_global()
1623
+	{
1624
+		$this->_add_admin_page_ajax_loading_img();
1625
+		$this->_add_admin_page_overlay();
1626
+		// if metaboxes are present we need to add the nonce field
1627
+		if (isset($this->_route_config['metaboxes'])
1628
+			|| isset($this->_route_config['list_table'])
1629
+			|| (isset($this->_route_config['has_metaboxes']) && $this->_route_config['has_metaboxes'])
1630
+		) {
1631
+			wp_nonce_field('closedpostboxes', 'closedpostboxesnonce', false);
1632
+			wp_nonce_field('meta-box-order', 'meta-box-order-nonce', false);
1633
+		}
1634
+	}
1635
+
1636
+
1637
+	/**
1638
+	 * admin_footer_global
1639
+	 * Anything triggered by the wp 'admin_footer' wp hook should be put in here. This particular method will apply on
1640
+	 * ALL EE_Admin Pages.
1641
+	 *
1642
+	 * @return void
1643
+	 * @throws EE_Error
1644
+	 */
1645
+	public function admin_footer_global()
1646
+	{
1647
+		// dialog container for dialog helper
1648
+		$d_cont = '<div class="ee-admin-dialog-container auto-hide hidden">' . "\n";
1649
+		$d_cont .= '<div class="ee-notices"></div>';
1650
+		$d_cont .= '<div class="ee-admin-dialog-container-inner-content"></div>';
1651
+		$d_cont .= '</div>';
1652
+		echo $d_cont;
1653
+		// help tour stuff?
1654
+		if (isset($this->_help_tour[ $this->_req_action ])) {
1655
+			echo implode('<br />', $this->_help_tour[ $this->_req_action ]);
1656
+		}
1657
+		// current set timezone for timezone js
1658
+		echo '<span id="current_timezone" class="hidden">' . EEH_DTT_Helper::get_timezone() . '</span>';
1659
+	}
1660
+
1661
+
1662
+	/**
1663
+	 * This function sees if there is a method for help popup content existing for the given route.  If there is then
1664
+	 * we'll use the retrieved array to output the content using the template. For child classes: If you want to have
1665
+	 * help popups then in your templates or your content you set "triggers" for the content using the
1666
+	 * "_set_help_trigger('help_trigger_id')" where "help_trigger_id" is what you will use later in your custom method
1667
+	 * for the help popup content on that page. Then in your Child_Admin_Page class you need to define a help popup
1668
+	 * method for the content in the format "_help_popup_content_{route_name}()"  So if you are setting help content
1669
+	 * for the
1670
+	 * 'edit_event' route you should have a method named "_help_popup_content_edit_route". In your defined
1671
+	 * "help_popup_content_..." method.  You must prepare and return an array in the following format array(
1672
+	 *    'help_trigger_id' => array(
1673
+	 *        'title' => esc_html__('localized title for popup', 'event_espresso'),
1674
+	 *        'content' => esc_html__('localized content for popup', 'event_espresso')
1675
+	 *    )
1676
+	 * );
1677
+	 * Then the EE_Admin_Parent will take care of making sure that is setup properly on the correct route.
1678
+	 *
1679
+	 * @param array $help_array
1680
+	 * @param bool  $display
1681
+	 * @return string content
1682
+	 * @throws DomainException
1683
+	 * @throws EE_Error
1684
+	 */
1685
+	protected function _set_help_popup_content($help_array = array(), $display = false)
1686
+	{
1687
+		$content = '';
1688
+		$help_array = empty($help_array) ? $this->_get_help_content() : $help_array;
1689
+		// loop through the array and setup content
1690
+		foreach ($help_array as $trigger => $help) {
1691
+			// make sure the array is setup properly
1692
+			if (! isset($help['title']) || ! isset($help['content'])) {
1693
+				throw new EE_Error(
1694
+					esc_html__(
1695
+						'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',
1696
+						'event_espresso'
1697
+					)
1698
+				);
1699
+			}
1700
+			// we're good so let'd setup the template vars and then assign parsed template content to our content.
1701
+			$template_args = array(
1702
+				'help_popup_id'      => $trigger,
1703
+				'help_popup_title'   => $help['title'],
1704
+				'help_popup_content' => $help['content'],
1705
+			);
1706
+			$content .= EEH_Template::display_template(
1707
+				EE_ADMIN_TEMPLATE . 'admin_help_popup.template.php',
1708
+				$template_args,
1709
+				true
1710
+			);
1711
+		}
1712
+		if ($display) {
1713
+			echo $content;
1714
+			return '';
1715
+		}
1716
+		return $content;
1717
+	}
1718
+
1719
+
1720
+	/**
1721
+	 * All this does is retrieve the help content array if set by the EE_Admin_Page child
1722
+	 *
1723
+	 * @return array properly formatted array for help popup content
1724
+	 * @throws EE_Error
1725
+	 */
1726
+	private function _get_help_content()
1727
+	{
1728
+		// what is the method we're looking for?
1729
+		$method_name = '_help_popup_content_' . $this->_req_action;
1730
+		// if method doesn't exist let's get out.
1731
+		if (! method_exists($this, $method_name)) {
1732
+			return array();
1733
+		}
1734
+		// k we're good to go let's retrieve the help array
1735
+		$help_array = call_user_func(array($this, $method_name));
1736
+		// make sure we've got an array!
1737
+		if (! is_array($help_array)) {
1738
+			throw new EE_Error(
1739
+				esc_html__(
1740
+					'Something went wrong with help popup content generation. Expecting an array and well, this ain\'t no array bub.',
1741
+					'event_espresso'
1742
+				)
1743
+			);
1744
+		}
1745
+		return $help_array;
1746
+	}
1747
+
1748
+
1749
+	/**
1750
+	 * EE Admin Pages can use this to set a properly formatted trigger for a help popup.
1751
+	 * By default the trigger html is printed.  Otherwise it can be returned if the $display flag is set "false"
1752
+	 * See comments made on the _set_help_content method for understanding other parts to the help popup tool.
1753
+	 *
1754
+	 * @param string  $trigger_id reference for retrieving the trigger content for the popup
1755
+	 * @param boolean $display    if false then we return the trigger string
1756
+	 * @param array   $dimensions an array of dimensions for the box (array(h,w))
1757
+	 * @return string
1758
+	 * @throws DomainException
1759
+	 * @throws EE_Error
1760
+	 */
1761
+	protected function _set_help_trigger($trigger_id, $display = true, $dimensions = array('400', '640'))
1762
+	{
1763
+		if (defined('DOING_AJAX')) {
1764
+			return '';
1765
+		}
1766
+		// 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
1767
+		$help_array = $this->_get_help_content();
1768
+		$help_content = '';
1769
+		if (empty($help_array) || ! isset($help_array[ $trigger_id ])) {
1770
+			$help_array[ $trigger_id ] = array(
1771
+				'title'   => esc_html__('Missing Content', 'event_espresso'),
1772
+				'content' => esc_html__(
1773
+					'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.)',
1774
+					'event_espresso'
1775
+				),
1776
+			);
1777
+			$help_content = $this->_set_help_popup_content($help_array, false);
1778
+		}
1779
+		// let's setup the trigger
1780
+		$content = '<a class="ee-dialog" href="?height='
1781
+				   . $dimensions[0]
1782
+				   . '&width='
1783
+				   . $dimensions[1]
1784
+				   . '&inlineId='
1785
+				   . $trigger_id
1786
+				   . '" target="_blank"><span class="question ee-help-popup-question"></span></a>';
1787
+		$content .= $help_content;
1788
+		if ($display) {
1789
+			echo $content;
1790
+			return '';
1791
+		}
1792
+		return $content;
1793
+	}
1794
+
1795
+
1796
+	/**
1797
+	 * _add_global_screen_options
1798
+	 * Add any extra wp_screen_options within this method using built-in WP functions/methods for doing so.
1799
+	 * This particular method will add_screen_options on ALL EE_Admin Pages
1800
+	 *
1801
+	 * @link   http://chrismarslender.com/wp-tutorials/wordpress-screen-options-tutorial/
1802
+	 *         see also WP_Screen object documents...
1803
+	 * @link   http://codex.wordpress.org/Class_Reference/WP_Screen
1804
+	 * @abstract
1805
+	 * @return void
1806
+	 */
1807
+	private function _add_global_screen_options()
1808
+	{
1809
+	}
1810
+
1811
+
1812
+	/**
1813
+	 * _add_global_feature_pointers
1814
+	 * This method is used for implementing any "feature pointers" (using built-in WP styling js).
1815
+	 * This particular method will implement feature pointers for ALL EE_Admin pages.
1816
+	 * Note: this is just a placeholder for now.  Implementation will come down the road
1817
+	 *
1818
+	 * @see    WP_Internal_Pointers class in wp-admin/includes/template.php for example (its a final class so can't be
1819
+	 *         extended) also see:
1820
+	 * @link   http://eamann.com/tech/wordpress-portland/
1821
+	 * @abstract
1822
+	 * @return void
1823
+	 */
1824
+	private function _add_global_feature_pointers()
1825
+	{
1826
+	}
1827
+
1828
+
1829
+	/**
1830
+	 * load_global_scripts_styles
1831
+	 * The scripts and styles enqueued in here will be loaded on every EE Admin page
1832
+	 *
1833
+	 * @return void
1834
+	 * @throws EE_Error
1835
+	 */
1836
+	public function load_global_scripts_styles()
1837
+	{
1838
+		/** STYLES **/
1839
+		// add debugging styles
1840
+		if (WP_DEBUG) {
1841
+			add_action('admin_head', array($this, 'add_xdebug_style'));
1842
+		}
1843
+		// register all styles
1844
+		wp_register_style(
1845
+			'espresso-ui-theme',
1846
+			EE_GLOBAL_ASSETS_URL . 'css/espresso-ui-theme/jquery-ui-1.10.3.custom.min.css',
1847
+			array(),
1848
+			EVENT_ESPRESSO_VERSION
1849
+		);
1850
+		wp_register_style('ee-admin-css', EE_ADMIN_URL . 'assets/ee-admin-page.css', array(), EVENT_ESPRESSO_VERSION);
1851
+		// helpers styles
1852
+		wp_register_style(
1853
+			'ee-text-links',
1854
+			EE_PLUGIN_DIR_URL . 'core/helpers/assets/ee_text_list_helper.css',
1855
+			array(),
1856
+			EVENT_ESPRESSO_VERSION
1857
+		);
1858
+		/** SCRIPTS **/
1859
+		// register all scripts
1860
+		wp_register_script(
1861
+			'ee-dialog',
1862
+			EE_ADMIN_URL . 'assets/ee-dialog-helper.js',
1863
+			array('jquery', 'jquery-ui-draggable'),
1864
+			EVENT_ESPRESSO_VERSION,
1865
+			true
1866
+		);
1867
+		wp_register_script(
1868
+			'ee_admin_js',
1869
+			EE_ADMIN_URL . 'assets/ee-admin-page.js',
1870
+			array('espresso_core', 'ee-parse-uri', 'ee-dialog'),
1871
+			EVENT_ESPRESSO_VERSION,
1872
+			true
1873
+		);
1874
+		wp_register_script(
1875
+			'jquery-ui-timepicker-addon',
1876
+			EE_GLOBAL_ASSETS_URL . 'scripts/jquery-ui-timepicker-addon.js',
1877
+			array('jquery-ui-datepicker', 'jquery-ui-slider'),
1878
+			EVENT_ESPRESSO_VERSION,
1879
+			true
1880
+		);
1881
+		add_filter('FHEE_load_joyride', '__return_true');
1882
+		// script for sorting tables
1883
+		wp_register_script(
1884
+			'espresso_ajax_table_sorting',
1885
+			EE_ADMIN_URL . 'assets/espresso_ajax_table_sorting.js',
1886
+			array('ee_admin_js', 'jquery-ui-sortable'),
1887
+			EVENT_ESPRESSO_VERSION,
1888
+			true
1889
+		);
1890
+		// script for parsing uri's
1891
+		wp_register_script(
1892
+			'ee-parse-uri',
1893
+			EE_GLOBAL_ASSETS_URL . 'scripts/parseuri.js',
1894
+			array(),
1895
+			EVENT_ESPRESSO_VERSION,
1896
+			true
1897
+		);
1898
+		// and parsing associative serialized form elements
1899
+		wp_register_script(
1900
+			'ee-serialize-full-array',
1901
+			EE_GLOBAL_ASSETS_URL . 'scripts/jquery.serializefullarray.js',
1902
+			array('jquery'),
1903
+			EVENT_ESPRESSO_VERSION,
1904
+			true
1905
+		);
1906
+		// helpers scripts
1907
+		wp_register_script(
1908
+			'ee-text-links',
1909
+			EE_PLUGIN_DIR_URL . 'core/helpers/assets/ee_text_list_helper.js',
1910
+			array('jquery'),
1911
+			EVENT_ESPRESSO_VERSION,
1912
+			true
1913
+		);
1914
+		wp_register_script(
1915
+			'ee-moment-core',
1916
+			EE_THIRD_PARTY_URL . 'moment/moment-with-locales.min.js',
1917
+			array(),
1918
+			EVENT_ESPRESSO_VERSION,
1919
+			true
1920
+		);
1921
+		wp_register_script(
1922
+			'ee-moment',
1923
+			EE_THIRD_PARTY_URL . 'moment/moment-timezone-with-data.min.js',
1924
+			array('ee-moment-core'),
1925
+			EVENT_ESPRESSO_VERSION,
1926
+			true
1927
+		);
1928
+		wp_register_script(
1929
+			'ee-datepicker',
1930
+			EE_ADMIN_URL . 'assets/ee-datepicker.js',
1931
+			array('jquery-ui-timepicker-addon', 'ee-moment'),
1932
+			EVENT_ESPRESSO_VERSION,
1933
+			true
1934
+		);
1935
+		// google charts
1936
+		wp_register_script(
1937
+			'google-charts',
1938
+			'https://www.gstatic.com/charts/loader.js',
1939
+			array(),
1940
+			EVENT_ESPRESSO_VERSION,
1941
+			false
1942
+		);
1943
+		// ENQUEUE ALL BASICS BY DEFAULT
1944
+		wp_enqueue_style('ee-admin-css');
1945
+		wp_enqueue_script('ee_admin_js');
1946
+		wp_enqueue_script('ee-accounting');
1947
+		wp_enqueue_script('jquery-validate');
1948
+		// taking care of metaboxes
1949
+		if (empty($this->_cpt_route)
1950
+			&& (isset($this->_route_config['metaboxes']) || isset($this->_route_config['has_metaboxes']))
1951
+		) {
1952
+			wp_enqueue_script('dashboard');
1953
+		}
1954
+		// LOCALIZED DATA
1955
+		// localize script for ajax lazy loading
1956
+		$lazy_loader_container_ids = apply_filters(
1957
+			'FHEE__EE_Admin_Page_Core__load_global_scripts_styles__loader_containers',
1958
+			array('espresso_news_post_box_content')
1959
+		);
1960
+		wp_localize_script('ee_admin_js', 'eeLazyLoadingContainers', $lazy_loader_container_ids);
1961
+		/**
1962
+		 * help tour stuff
1963
+		 */
1964
+		if (! empty($this->_help_tour)) {
1965
+			// register the js for kicking things off
1966
+			wp_enqueue_script(
1967
+				'ee-help-tour',
1968
+				EE_ADMIN_URL . 'assets/ee-help-tour.js',
1969
+				array('jquery-joyride'),
1970
+				EVENT_ESPRESSO_VERSION,
1971
+				true
1972
+			);
1973
+			$tours = array();
1974
+			// setup tours for the js tour object
1975
+			foreach ($this->_help_tour['tours'] as $tour) {
1976
+				if ($tour instanceof EE_Help_Tour) {
1977
+					$tours[] = array(
1978
+						'id'      => $tour->get_slug(),
1979
+						'options' => $tour->get_options(),
1980
+					);
1981
+				}
1982
+			}
1983
+			wp_localize_script('ee-help-tour', 'EE_HELP_TOUR', array('tours' => $tours));
1984
+			// admin_footer_global will take care of making sure our help_tour skeleton gets printed via the info stored in $this->_help_tour
1985
+		}
1986
+	}
1987
+
1988
+
1989
+	/**
1990
+	 *        admin_footer_scripts_eei18n_js_strings
1991
+	 *
1992
+	 * @return        void
1993
+	 */
1994
+	public function admin_footer_scripts_eei18n_js_strings()
1995
+	{
1996
+		EE_Registry::$i18n_js_strings['ajax_url'] = WP_AJAX_URL;
1997
+		EE_Registry::$i18n_js_strings['confirm_delete'] = esc_html__(
1998
+			'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!!!',
1999
+			'event_espresso'
2000
+		);
2001
+		EE_Registry::$i18n_js_strings['January'] = esc_html__('January', 'event_espresso');
2002
+		EE_Registry::$i18n_js_strings['February'] = esc_html__('February', 'event_espresso');
2003
+		EE_Registry::$i18n_js_strings['March'] = esc_html__('March', 'event_espresso');
2004
+		EE_Registry::$i18n_js_strings['April'] = esc_html__('April', 'event_espresso');
2005
+		EE_Registry::$i18n_js_strings['May'] = esc_html__('May', 'event_espresso');
2006
+		EE_Registry::$i18n_js_strings['June'] = esc_html__('June', 'event_espresso');
2007
+		EE_Registry::$i18n_js_strings['July'] = esc_html__('July', 'event_espresso');
2008
+		EE_Registry::$i18n_js_strings['August'] = esc_html__('August', 'event_espresso');
2009
+		EE_Registry::$i18n_js_strings['September'] = esc_html__('September', 'event_espresso');
2010
+		EE_Registry::$i18n_js_strings['October'] = esc_html__('October', 'event_espresso');
2011
+		EE_Registry::$i18n_js_strings['November'] = esc_html__('November', 'event_espresso');
2012
+		EE_Registry::$i18n_js_strings['December'] = esc_html__('December', 'event_espresso');
2013
+		EE_Registry::$i18n_js_strings['Jan'] = esc_html__('Jan', 'event_espresso');
2014
+		EE_Registry::$i18n_js_strings['Feb'] = esc_html__('Feb', 'event_espresso');
2015
+		EE_Registry::$i18n_js_strings['Mar'] = esc_html__('Mar', 'event_espresso');
2016
+		EE_Registry::$i18n_js_strings['Apr'] = esc_html__('Apr', 'event_espresso');
2017
+		EE_Registry::$i18n_js_strings['May'] = esc_html__('May', 'event_espresso');
2018
+		EE_Registry::$i18n_js_strings['Jun'] = esc_html__('Jun', 'event_espresso');
2019
+		EE_Registry::$i18n_js_strings['Jul'] = esc_html__('Jul', 'event_espresso');
2020
+		EE_Registry::$i18n_js_strings['Aug'] = esc_html__('Aug', 'event_espresso');
2021
+		EE_Registry::$i18n_js_strings['Sep'] = esc_html__('Sep', 'event_espresso');
2022
+		EE_Registry::$i18n_js_strings['Oct'] = esc_html__('Oct', 'event_espresso');
2023
+		EE_Registry::$i18n_js_strings['Nov'] = esc_html__('Nov', 'event_espresso');
2024
+		EE_Registry::$i18n_js_strings['Dec'] = esc_html__('Dec', 'event_espresso');
2025
+		EE_Registry::$i18n_js_strings['Sunday'] = esc_html__('Sunday', 'event_espresso');
2026
+		EE_Registry::$i18n_js_strings['Monday'] = esc_html__('Monday', 'event_espresso');
2027
+		EE_Registry::$i18n_js_strings['Tuesday'] = esc_html__('Tuesday', 'event_espresso');
2028
+		EE_Registry::$i18n_js_strings['Wednesday'] = esc_html__('Wednesday', 'event_espresso');
2029
+		EE_Registry::$i18n_js_strings['Thursday'] = esc_html__('Thursday', 'event_espresso');
2030
+		EE_Registry::$i18n_js_strings['Friday'] = esc_html__('Friday', 'event_espresso');
2031
+		EE_Registry::$i18n_js_strings['Saturday'] = esc_html__('Saturday', 'event_espresso');
2032
+		EE_Registry::$i18n_js_strings['Sun'] = esc_html__('Sun', 'event_espresso');
2033
+		EE_Registry::$i18n_js_strings['Mon'] = esc_html__('Mon', 'event_espresso');
2034
+		EE_Registry::$i18n_js_strings['Tue'] = esc_html__('Tue', 'event_espresso');
2035
+		EE_Registry::$i18n_js_strings['Wed'] = esc_html__('Wed', 'event_espresso');
2036
+		EE_Registry::$i18n_js_strings['Thu'] = esc_html__('Thu', 'event_espresso');
2037
+		EE_Registry::$i18n_js_strings['Fri'] = esc_html__('Fri', 'event_espresso');
2038
+		EE_Registry::$i18n_js_strings['Sat'] = esc_html__('Sat', 'event_espresso');
2039
+	}
2040
+
2041
+
2042
+	/**
2043
+	 *        load enhanced xdebug styles for ppl with failing eyesight
2044
+	 *
2045
+	 * @return        void
2046
+	 */
2047
+	public function add_xdebug_style()
2048
+	{
2049
+		echo '<style>.xdebug-error { font-size:1.5em; }</style>';
2050
+	}
2051
+
2052
+
2053
+	/************************/
2054
+	/** LIST TABLE METHODS **/
2055
+	/************************/
2056
+	/**
2057
+	 * this sets up the list table if the current view requires it.
2058
+	 *
2059
+	 * @return void
2060
+	 * @throws EE_Error
2061
+	 */
2062
+	protected function _set_list_table()
2063
+	{
2064
+		// first is this a list_table view?
2065
+		if (! isset($this->_route_config['list_table'])) {
2066
+			return;
2067
+		} //not a list_table view so get out.
2068
+		// list table functions are per view specific (because some admin pages might have more than one list table!)
2069
+		$list_table_view = '_set_list_table_views_' . $this->_req_action;
2070
+		if (! method_exists($this, $list_table_view) || $this->{$list_table_view}() === false) {
2071
+			// user error msg
2072
+			$error_msg = esc_html__(
2073
+				'An error occurred. The requested list table views could not be found.',
2074
+				'event_espresso'
2075
+			);
2076
+			// developer error msg
2077
+			$error_msg .= '||'
2078
+						  . sprintf(
2079
+							  esc_html__(
2080
+								  '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.',
2081
+								  'event_espresso'
2082
+							  ),
2083
+							  $this->_req_action,
2084
+							  $list_table_view
2085
+						  );
2086
+			throw new EE_Error($error_msg);
2087
+		}
2088
+		// let's provide the ability to filter the views per PAGE AND ROUTE, per PAGE, and globally
2089
+		$this->_views = apply_filters(
2090
+			'FHEE_list_table_views_' . $this->page_slug . '_' . $this->_req_action,
2091
+			$this->_views
2092
+		);
2093
+		$this->_views = apply_filters('FHEE_list_table_views_' . $this->page_slug, $this->_views);
2094
+		$this->_views = apply_filters('FHEE_list_table_views', $this->_views);
2095
+		$this->_set_list_table_view();
2096
+		$this->_set_list_table_object();
2097
+	}
2098
+
2099
+
2100
+	/**
2101
+	 * set current view for List Table
2102
+	 *
2103
+	 * @return void
2104
+	 */
2105
+	protected function _set_list_table_view()
2106
+	{
2107
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2108
+		// looking at active items or dumpster diving ?
2109
+		if (! isset($this->_req_data['status']) || ! array_key_exists($this->_req_data['status'], $this->_views)) {
2110
+			$this->_view = isset($this->_views['in_use']) ? 'in_use' : 'all';
2111
+		} else {
2112
+			$this->_view = sanitize_key($this->_req_data['status']);
2113
+		}
2114
+	}
2115
+
2116
+
2117
+	/**
2118
+	 * _set_list_table_object
2119
+	 * WP_List_Table objects need to be loaded fairly early so automatic stuff WP does is taken care of.
2120
+	 *
2121
+	 * @throws \EventEspresso\core\exceptions\InvalidInterfaceException
2122
+	 * @throws \InvalidArgumentException
2123
+	 * @throws \EventEspresso\core\exceptions\InvalidDataTypeException
2124
+	 * @throws EE_Error
2125
+	 * @throws InvalidInterfaceException
2126
+	 */
2127
+	protected function _set_list_table_object()
2128
+	{
2129
+		if (isset($this->_route_config['list_table'])) {
2130
+			if (! class_exists($this->_route_config['list_table'])) {
2131
+				throw new EE_Error(
2132
+					sprintf(
2133
+						esc_html__(
2134
+							'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.',
2135
+							'event_espresso'
2136
+						),
2137
+						$this->_route_config['list_table'],
2138
+						get_class($this)
2139
+					)
2140
+				);
2141
+			}
2142
+			$this->_list_table_object = LoaderFactory::getLoader()->getShared(
2143
+				$this->_route_config['list_table'],
2144
+				array($this)
2145
+			);
2146
+		}
2147
+	}
2148
+
2149
+
2150
+	/**
2151
+	 * get_list_table_view_RLs - get it? View RL ?? VU-RL???  URL ??
2152
+	 *
2153
+	 * @param array $extra_query_args                     Optional. An array of extra query args to add to the generated
2154
+	 *                                                    urls.  The array should be indexed by the view it is being
2155
+	 *                                                    added to.
2156
+	 * @return array
2157
+	 */
2158
+	public function get_list_table_view_RLs($extra_query_args = array())
2159
+	{
2160
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2161
+		if (empty($this->_views)) {
2162
+			$this->_views = array();
2163
+		}
2164
+		// cycle thru views
2165
+		foreach ($this->_views as $key => $view) {
2166
+			$query_args = array();
2167
+			// check for current view
2168
+			$this->_views[ $key ]['class'] = $this->_view === $view['slug'] ? 'current' : '';
2169
+			$query_args['action'] = $this->_req_action;
2170
+			$query_args[ $this->_req_action . '_nonce' ] = wp_create_nonce($query_args['action'] . '_nonce');
2171
+			$query_args['status'] = $view['slug'];
2172
+			// merge any other arguments sent in.
2173
+			if (isset($extra_query_args[ $view['slug'] ])) {
2174
+				$query_args = array_merge($query_args, $extra_query_args[ $view['slug'] ]);
2175
+			}
2176
+			$this->_views[ $key ]['url'] = EE_Admin_Page::add_query_args_and_nonce($query_args, $this->_admin_base_url);
2177
+		}
2178
+		return $this->_views;
2179
+	}
2180
+
2181
+
2182
+	/**
2183
+	 * _entries_per_page_dropdown
2184
+	 * generates a drop down box for selecting the number of visible rows in an admin page list table
2185
+	 *
2186
+	 * @todo   : Note: ideally this should be added to the screen options dropdown as that would be consistent with how
2187
+	 *         WP does it.
2188
+	 * @param int $max_entries total number of rows in the table
2189
+	 * @return string
2190
+	 */
2191
+	protected function _entries_per_page_dropdown($max_entries = 0)
2192
+	{
2193
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2194
+		$values = array(10, 25, 50, 100);
2195
+		$per_page = (! empty($this->_req_data['per_page'])) ? absint($this->_req_data['per_page']) : 10;
2196
+		if ($max_entries) {
2197
+			$values[] = $max_entries;
2198
+			sort($values);
2199
+		}
2200
+		$entries_per_page_dropdown = '
2201 2201
 			<div id="entries-per-page-dv" class="alignleft actions">
2202 2202
 				<label class="hide-if-no-js">
2203 2203
 					Show
2204 2204
 					<select id="entries-per-page-slct" name="entries-per-page-slct">';
2205
-        foreach ($values as $value) {
2206
-            if ($value < $max_entries) {
2207
-                $selected = $value === $per_page ? ' selected="' . $per_page . '"' : '';
2208
-                $entries_per_page_dropdown .= '
2205
+		foreach ($values as $value) {
2206
+			if ($value < $max_entries) {
2207
+				$selected = $value === $per_page ? ' selected="' . $per_page . '"' : '';
2208
+				$entries_per_page_dropdown .= '
2209 2209
 						<option value="' . $value . '"' . $selected . '>' . $value . '&nbsp;&nbsp;</option>';
2210
-            }
2211
-        }
2212
-        $selected = $max_entries === $per_page ? ' selected="' . $per_page . '"' : '';
2213
-        $entries_per_page_dropdown .= '
2210
+			}
2211
+		}
2212
+		$selected = $max_entries === $per_page ? ' selected="' . $per_page . '"' : '';
2213
+		$entries_per_page_dropdown .= '
2214 2214
 						<option value="' . $max_entries . '"' . $selected . '>All&nbsp;&nbsp;</option>';
2215
-        $entries_per_page_dropdown .= '
2215
+		$entries_per_page_dropdown .= '
2216 2216
 					</select>
2217 2217
 					entries
2218 2218
 				</label>
2219 2219
 				<input id="entries-per-page-btn" class="button-secondary" type="submit" value="Go" >
2220 2220
 			</div>
2221 2221
 		';
2222
-        return $entries_per_page_dropdown;
2223
-    }
2224
-
2225
-
2226
-    /**
2227
-     *        _set_search_attributes
2228
-     *
2229
-     * @return        void
2230
-     */
2231
-    public function _set_search_attributes()
2232
-    {
2233
-        $this->_template_args['search']['btn_label'] = sprintf(
2234
-            esc_html__('Search %s', 'event_espresso'),
2235
-            empty($this->_search_btn_label) ? $this->page_label
2236
-                : $this->_search_btn_label
2237
-        );
2238
-        $this->_template_args['search']['callback'] = 'search_' . $this->page_slug;
2239
-    }
2240
-
2241
-
2242
-
2243
-    /*** END LIST TABLE METHODS **/
2244
-
2245
-
2246
-    /**
2247
-     * _add_registered_metaboxes
2248
-     *  this loads any registered metaboxes via the 'metaboxes' index in the _page_config property array.
2249
-     *
2250
-     * @link   http://codex.wordpress.org/Function_Reference/add_meta_box
2251
-     * @return void
2252
-     * @throws EE_Error
2253
-     */
2254
-    private function _add_registered_meta_boxes()
2255
-    {
2256
-        do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2257
-        // we only add meta boxes if the page_route calls for it
2258
-        if (is_array($this->_route_config) && isset($this->_route_config['metaboxes'])
2259
-            && is_array(
2260
-                $this->_route_config['metaboxes']
2261
-            )
2262
-        ) {
2263
-            // this simply loops through the callbacks provided
2264
-            // and checks if there is a corresponding callback registered by the child
2265
-            // if there is then we go ahead and process the metabox loader.
2266
-            foreach ($this->_route_config['metaboxes'] as $metabox_callback) {
2267
-                // first check for Closures
2268
-                if ($metabox_callback instanceof Closure) {
2269
-                    $result = $metabox_callback();
2270
-                } elseif (is_array($metabox_callback) && isset($metabox_callback[0], $metabox_callback[1])) {
2271
-                    $result = call_user_func(array($metabox_callback[0], $metabox_callback[1]));
2272
-                } else {
2273
-                    $result = call_user_func(array($this, &$metabox_callback));
2274
-                }
2275
-                if ($result === false) {
2276
-                    // user error msg
2277
-                    $error_msg = esc_html__(
2278
-                        'An error occurred. The  requested metabox could not be found.',
2279
-                        'event_espresso'
2280
-                    );
2281
-                    // developer error msg
2282
-                    $error_msg .= '||'
2283
-                                  . sprintf(
2284
-                                      esc_html__(
2285
-                                          '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.',
2286
-                                          'event_espresso'
2287
-                                      ),
2288
-                                      $metabox_callback
2289
-                                  );
2290
-                    throw new EE_Error($error_msg);
2291
-                }
2292
-            }
2293
-        }
2294
-    }
2295
-
2296
-
2297
-    /**
2298
-     * _add_screen_columns
2299
-     * This will check the _page_config array and if there is "columns" key index indicated, we'll set the template as
2300
-     * the dynamic column template and we'll setup the column options for the page.
2301
-     *
2302
-     * @return void
2303
-     */
2304
-    private function _add_screen_columns()
2305
-    {
2306
-        if (is_array($this->_route_config)
2307
-            && isset($this->_route_config['columns'])
2308
-            && is_array($this->_route_config['columns'])
2309
-            && count($this->_route_config['columns']) === 2
2310
-        ) {
2311
-            add_screen_option(
2312
-                'layout_columns',
2313
-                array(
2314
-                    'max'     => (int) $this->_route_config['columns'][0],
2315
-                    'default' => (int) $this->_route_config['columns'][1],
2316
-                )
2317
-            );
2318
-            $this->_template_args['num_columns'] = $this->_route_config['columns'][0];
2319
-            $screen_id = $this->_current_screen->id;
2320
-            $screen_columns = (int) get_user_option("screen_layout_{$screen_id}");
2321
-            $total_columns = ! empty($screen_columns)
2322
-                ? $screen_columns
2323
-                : $this->_route_config['columns'][1];
2324
-            $this->_template_args['current_screen_widget_class'] = 'columns-' . $total_columns;
2325
-            $this->_template_args['current_page'] = $this->_wp_page_slug;
2326
-            $this->_template_args['screen'] = $this->_current_screen;
2327
-            $this->_column_template_path = EE_ADMIN_TEMPLATE
2328
-                                           . 'admin_details_metabox_column_wrapper.template.php';
2329
-            // finally if we don't have has_metaboxes set in the route config
2330
-            // let's make sure it IS set other wise the necessary hidden fields for this won't be loaded.
2331
-            $this->_route_config['has_metaboxes'] = true;
2332
-        }
2333
-    }
2334
-
2335
-
2336
-
2337
-    /** GLOBALLY AVAILABLE METABOXES **/
2338
-
2339
-
2340
-    /**
2341
-     * In this section we put any globally available EE metaboxes for all EE Admin pages.  They are called by simply
2342
-     * referencing the callback in the _page_config array property.  This way you can be very specific about what pages
2343
-     * these get loaded on.
2344
-     */
2345
-    private function _espresso_news_post_box()
2346
-    {
2347
-        $news_box_title = apply_filters(
2348
-            'FHEE__EE_Admin_Page___espresso_news_post_box__news_box_title',
2349
-            esc_html__('New @ Event Espresso', 'event_espresso')
2350
-        );
2351
-        add_meta_box(
2352
-            'espresso_news_post_box',
2353
-            $news_box_title,
2354
-            array(
2355
-                $this,
2356
-                'espresso_news_post_box',
2357
-            ),
2358
-            $this->_wp_page_slug,
2359
-            'side'
2360
-        );
2361
-    }
2362
-
2363
-
2364
-    /**
2365
-     * Code for setting up espresso ratings request metabox.
2366
-     */
2367
-    protected function _espresso_ratings_request()
2368
-    {
2369
-        if (! apply_filters('FHEE_show_ratings_request_meta_box', true)) {
2370
-            return;
2371
-        }
2372
-        $ratings_box_title = apply_filters(
2373
-            'FHEE__EE_Admin_Page___espresso_news_post_box__news_box_title',
2374
-            esc_html__('Keep Event Espresso Decaf Free', 'event_espresso')
2375
-        );
2376
-        add_meta_box(
2377
-            'espresso_ratings_request',
2378
-            $ratings_box_title,
2379
-            array(
2380
-                $this,
2381
-                'espresso_ratings_request',
2382
-            ),
2383
-            $this->_wp_page_slug,
2384
-            'side'
2385
-        );
2386
-    }
2387
-
2388
-
2389
-    /**
2390
-     * Code for setting up espresso ratings request metabox content.
2391
-     *
2392
-     * @throws DomainException
2393
-     */
2394
-    public function espresso_ratings_request()
2395
-    {
2396
-        EEH_Template::display_template(
2397
-            EE_ADMIN_TEMPLATE . 'espresso_ratings_request_content.template.php',
2398
-            array()
2399
-        );
2400
-    }
2401
-
2402
-
2403
-    public static function cached_rss_display($rss_id, $url)
2404
-    {
2405
-        $loading = '<p class="widget-loading hide-if-no-js">'
2406
-                   . __('Loading&#8230;', 'event_espresso')
2407
-                   . '</p><p class="hide-if-js">'
2408
-                   . esc_html__('This widget requires JavaScript.', 'event_espresso')
2409
-                   . '</p>';
2410
-        $pre = '<div class="espresso-rss-display">' . "\n\t";
2411
-        $pre .= '<span id="' . $rss_id . '_url" class="hidden">' . $url . '</span>';
2412
-        $post = '</div>' . "\n";
2413
-        $cache_key = 'ee_rss_' . md5($rss_id);
2414
-        $output = get_transient($cache_key);
2415
-        if ($output !== false) {
2416
-            echo $pre . $output . $post;
2417
-            return true;
2418
-        }
2419
-        if (! (defined('DOING_AJAX') && DOING_AJAX)) {
2420
-            echo $pre . $loading . $post;
2421
-            return false;
2422
-        }
2423
-        ob_start();
2424
-        wp_widget_rss_output($url, array('show_date' => 0, 'items' => 5));
2425
-        set_transient($cache_key, ob_get_flush(), 12 * HOUR_IN_SECONDS);
2426
-        return true;
2427
-    }
2428
-
2429
-
2430
-    public function espresso_news_post_box()
2431
-    {
2432
-        ?>
2222
+		return $entries_per_page_dropdown;
2223
+	}
2224
+
2225
+
2226
+	/**
2227
+	 *        _set_search_attributes
2228
+	 *
2229
+	 * @return        void
2230
+	 */
2231
+	public function _set_search_attributes()
2232
+	{
2233
+		$this->_template_args['search']['btn_label'] = sprintf(
2234
+			esc_html__('Search %s', 'event_espresso'),
2235
+			empty($this->_search_btn_label) ? $this->page_label
2236
+				: $this->_search_btn_label
2237
+		);
2238
+		$this->_template_args['search']['callback'] = 'search_' . $this->page_slug;
2239
+	}
2240
+
2241
+
2242
+
2243
+	/*** END LIST TABLE METHODS **/
2244
+
2245
+
2246
+	/**
2247
+	 * _add_registered_metaboxes
2248
+	 *  this loads any registered metaboxes via the 'metaboxes' index in the _page_config property array.
2249
+	 *
2250
+	 * @link   http://codex.wordpress.org/Function_Reference/add_meta_box
2251
+	 * @return void
2252
+	 * @throws EE_Error
2253
+	 */
2254
+	private function _add_registered_meta_boxes()
2255
+	{
2256
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2257
+		// we only add meta boxes if the page_route calls for it
2258
+		if (is_array($this->_route_config) && isset($this->_route_config['metaboxes'])
2259
+			&& is_array(
2260
+				$this->_route_config['metaboxes']
2261
+			)
2262
+		) {
2263
+			// this simply loops through the callbacks provided
2264
+			// and checks if there is a corresponding callback registered by the child
2265
+			// if there is then we go ahead and process the metabox loader.
2266
+			foreach ($this->_route_config['metaboxes'] as $metabox_callback) {
2267
+				// first check for Closures
2268
+				if ($metabox_callback instanceof Closure) {
2269
+					$result = $metabox_callback();
2270
+				} elseif (is_array($metabox_callback) && isset($metabox_callback[0], $metabox_callback[1])) {
2271
+					$result = call_user_func(array($metabox_callback[0], $metabox_callback[1]));
2272
+				} else {
2273
+					$result = call_user_func(array($this, &$metabox_callback));
2274
+				}
2275
+				if ($result === false) {
2276
+					// user error msg
2277
+					$error_msg = esc_html__(
2278
+						'An error occurred. The  requested metabox could not be found.',
2279
+						'event_espresso'
2280
+					);
2281
+					// developer error msg
2282
+					$error_msg .= '||'
2283
+								  . sprintf(
2284
+									  esc_html__(
2285
+										  '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.',
2286
+										  'event_espresso'
2287
+									  ),
2288
+									  $metabox_callback
2289
+								  );
2290
+					throw new EE_Error($error_msg);
2291
+				}
2292
+			}
2293
+		}
2294
+	}
2295
+
2296
+
2297
+	/**
2298
+	 * _add_screen_columns
2299
+	 * This will check the _page_config array and if there is "columns" key index indicated, we'll set the template as
2300
+	 * the dynamic column template and we'll setup the column options for the page.
2301
+	 *
2302
+	 * @return void
2303
+	 */
2304
+	private function _add_screen_columns()
2305
+	{
2306
+		if (is_array($this->_route_config)
2307
+			&& isset($this->_route_config['columns'])
2308
+			&& is_array($this->_route_config['columns'])
2309
+			&& count($this->_route_config['columns']) === 2
2310
+		) {
2311
+			add_screen_option(
2312
+				'layout_columns',
2313
+				array(
2314
+					'max'     => (int) $this->_route_config['columns'][0],
2315
+					'default' => (int) $this->_route_config['columns'][1],
2316
+				)
2317
+			);
2318
+			$this->_template_args['num_columns'] = $this->_route_config['columns'][0];
2319
+			$screen_id = $this->_current_screen->id;
2320
+			$screen_columns = (int) get_user_option("screen_layout_{$screen_id}");
2321
+			$total_columns = ! empty($screen_columns)
2322
+				? $screen_columns
2323
+				: $this->_route_config['columns'][1];
2324
+			$this->_template_args['current_screen_widget_class'] = 'columns-' . $total_columns;
2325
+			$this->_template_args['current_page'] = $this->_wp_page_slug;
2326
+			$this->_template_args['screen'] = $this->_current_screen;
2327
+			$this->_column_template_path = EE_ADMIN_TEMPLATE
2328
+										   . 'admin_details_metabox_column_wrapper.template.php';
2329
+			// finally if we don't have has_metaboxes set in the route config
2330
+			// let's make sure it IS set other wise the necessary hidden fields for this won't be loaded.
2331
+			$this->_route_config['has_metaboxes'] = true;
2332
+		}
2333
+	}
2334
+
2335
+
2336
+
2337
+	/** GLOBALLY AVAILABLE METABOXES **/
2338
+
2339
+
2340
+	/**
2341
+	 * In this section we put any globally available EE metaboxes for all EE Admin pages.  They are called by simply
2342
+	 * referencing the callback in the _page_config array property.  This way you can be very specific about what pages
2343
+	 * these get loaded on.
2344
+	 */
2345
+	private function _espresso_news_post_box()
2346
+	{
2347
+		$news_box_title = apply_filters(
2348
+			'FHEE__EE_Admin_Page___espresso_news_post_box__news_box_title',
2349
+			esc_html__('New @ Event Espresso', 'event_espresso')
2350
+		);
2351
+		add_meta_box(
2352
+			'espresso_news_post_box',
2353
+			$news_box_title,
2354
+			array(
2355
+				$this,
2356
+				'espresso_news_post_box',
2357
+			),
2358
+			$this->_wp_page_slug,
2359
+			'side'
2360
+		);
2361
+	}
2362
+
2363
+
2364
+	/**
2365
+	 * Code for setting up espresso ratings request metabox.
2366
+	 */
2367
+	protected function _espresso_ratings_request()
2368
+	{
2369
+		if (! apply_filters('FHEE_show_ratings_request_meta_box', true)) {
2370
+			return;
2371
+		}
2372
+		$ratings_box_title = apply_filters(
2373
+			'FHEE__EE_Admin_Page___espresso_news_post_box__news_box_title',
2374
+			esc_html__('Keep Event Espresso Decaf Free', 'event_espresso')
2375
+		);
2376
+		add_meta_box(
2377
+			'espresso_ratings_request',
2378
+			$ratings_box_title,
2379
+			array(
2380
+				$this,
2381
+				'espresso_ratings_request',
2382
+			),
2383
+			$this->_wp_page_slug,
2384
+			'side'
2385
+		);
2386
+	}
2387
+
2388
+
2389
+	/**
2390
+	 * Code for setting up espresso ratings request metabox content.
2391
+	 *
2392
+	 * @throws DomainException
2393
+	 */
2394
+	public function espresso_ratings_request()
2395
+	{
2396
+		EEH_Template::display_template(
2397
+			EE_ADMIN_TEMPLATE . 'espresso_ratings_request_content.template.php',
2398
+			array()
2399
+		);
2400
+	}
2401
+
2402
+
2403
+	public static function cached_rss_display($rss_id, $url)
2404
+	{
2405
+		$loading = '<p class="widget-loading hide-if-no-js">'
2406
+				   . __('Loading&#8230;', 'event_espresso')
2407
+				   . '</p><p class="hide-if-js">'
2408
+				   . esc_html__('This widget requires JavaScript.', 'event_espresso')
2409
+				   . '</p>';
2410
+		$pre = '<div class="espresso-rss-display">' . "\n\t";
2411
+		$pre .= '<span id="' . $rss_id . '_url" class="hidden">' . $url . '</span>';
2412
+		$post = '</div>' . "\n";
2413
+		$cache_key = 'ee_rss_' . md5($rss_id);
2414
+		$output = get_transient($cache_key);
2415
+		if ($output !== false) {
2416
+			echo $pre . $output . $post;
2417
+			return true;
2418
+		}
2419
+		if (! (defined('DOING_AJAX') && DOING_AJAX)) {
2420
+			echo $pre . $loading . $post;
2421
+			return false;
2422
+		}
2423
+		ob_start();
2424
+		wp_widget_rss_output($url, array('show_date' => 0, 'items' => 5));
2425
+		set_transient($cache_key, ob_get_flush(), 12 * HOUR_IN_SECONDS);
2426
+		return true;
2427
+	}
2428
+
2429
+
2430
+	public function espresso_news_post_box()
2431
+	{
2432
+		?>
2433 2433
         <div class="padding">
2434 2434
             <div id="espresso_news_post_box_content" class="infolinks">
2435 2435
                 <?php
2436
-                // Get RSS Feed(s)
2437
-                self::cached_rss_display(
2438
-                    'espresso_news_post_box_content',
2439
-                    urlencode(
2440
-                        apply_filters(
2441
-                            'FHEE__EE_Admin_Page__espresso_news_post_box__feed_url',
2442
-                            'http://eventespresso.com/feed/'
2443
-                        )
2444
-                    )
2445
-                );
2446
-                ?>
2436
+				// Get RSS Feed(s)
2437
+				self::cached_rss_display(
2438
+					'espresso_news_post_box_content',
2439
+					urlencode(
2440
+						apply_filters(
2441
+							'FHEE__EE_Admin_Page__espresso_news_post_box__feed_url',
2442
+							'http://eventespresso.com/feed/'
2443
+						)
2444
+					)
2445
+				);
2446
+				?>
2447 2447
             </div>
2448 2448
             <?php do_action('AHEE__EE_Admin_Page__espresso_news_post_box__after_content'); ?>
2449 2449
         </div>
2450 2450
         <?php
2451
-    }
2452
-
2453
-
2454
-    private function _espresso_links_post_box()
2455
-    {
2456
-        // Hiding until we actually have content to put in here...
2457
-        // 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');
2458
-    }
2459
-
2460
-
2461
-    public function espresso_links_post_box()
2462
-    {
2463
-        // Hiding until we actually have content to put in here...
2464
-        // EEH_Template::display_template(
2465
-        //     EE_ADMIN_TEMPLATE . 'admin_general_metabox_contents_espresso_links.template.php'
2466
-        // );
2467
-    }
2468
-
2469
-
2470
-    protected function _espresso_sponsors_post_box()
2471
-    {
2472
-        if (apply_filters('FHEE_show_sponsors_meta_box', true)) {
2473
-            add_meta_box(
2474
-                'espresso_sponsors_post_box',
2475
-                esc_html__('Event Espresso Highlights', 'event_espresso'),
2476
-                array($this, 'espresso_sponsors_post_box'),
2477
-                $this->_wp_page_slug,
2478
-                'side'
2479
-            );
2480
-        }
2481
-    }
2482
-
2483
-
2484
-    public function espresso_sponsors_post_box()
2485
-    {
2486
-        EEH_Template::display_template(
2487
-            EE_ADMIN_TEMPLATE . 'admin_general_metabox_contents_espresso_sponsors.template.php'
2488
-        );
2489
-    }
2490
-
2491
-
2492
-    private function _publish_post_box()
2493
-    {
2494
-        $meta_box_ref = 'espresso_' . $this->page_slug . '_editor_overview';
2495
-        // if there is a array('label' => array('publishbox' => 'some title') ) present in the _page_config array
2496
-        // then we'll use that for the metabox label.
2497
-        // Otherwise we'll just use publish (publishbox itself could be an array of labels indexed by routes)
2498
-        if (! empty($this->_labels['publishbox'])) {
2499
-            $box_label = is_array($this->_labels['publishbox']) ? $this->_labels['publishbox'][ $this->_req_action ]
2500
-                : $this->_labels['publishbox'];
2501
-        } else {
2502
-            $box_label = esc_html__('Publish', 'event_espresso');
2503
-        }
2504
-        $box_label = apply_filters(
2505
-            'FHEE__EE_Admin_Page___publish_post_box__box_label',
2506
-            $box_label,
2507
-            $this->_req_action,
2508
-            $this
2509
-        );
2510
-        add_meta_box(
2511
-            $meta_box_ref,
2512
-            $box_label,
2513
-            array($this, 'editor_overview'),
2514
-            $this->_current_screen->id,
2515
-            'side',
2516
-            'high'
2517
-        );
2518
-    }
2519
-
2520
-
2521
-    public function editor_overview()
2522
-    {
2523
-        // if we have extra content set let's add it in if not make sure its empty
2524
-        $this->_template_args['publish_box_extra_content'] = isset($this->_template_args['publish_box_extra_content'])
2525
-            ? $this->_template_args['publish_box_extra_content']
2526
-            : '';
2527
-        echo EEH_Template::display_template(
2528
-            EE_ADMIN_TEMPLATE . 'admin_details_publish_metabox.template.php',
2529
-            $this->_template_args,
2530
-            true
2531
-        );
2532
-    }
2533
-
2534
-
2535
-    /** end of globally available metaboxes section **/
2536
-
2537
-
2538
-    /**
2539
-     * Public wrapper for the protected method.  Allows plugins/addons to externally call the
2540
-     * protected method.
2541
-     *
2542
-     * @see   $this->_set_publish_post_box_vars for param details
2543
-     * @since 4.6.0
2544
-     * @param string $name
2545
-     * @param int    $id
2546
-     * @param bool   $delete
2547
-     * @param string $save_close_redirect_URL
2548
-     * @param bool   $both_btns
2549
-     * @throws EE_Error
2550
-     * @throws InvalidArgumentException
2551
-     * @throws InvalidDataTypeException
2552
-     * @throws InvalidInterfaceException
2553
-     */
2554
-    public function set_publish_post_box_vars(
2555
-        $name = '',
2556
-        $id = 0,
2557
-        $delete = false,
2558
-        $save_close_redirect_URL = '',
2559
-        $both_btns = true
2560
-    ) {
2561
-        $this->_set_publish_post_box_vars(
2562
-            $name,
2563
-            $id,
2564
-            $delete,
2565
-            $save_close_redirect_URL,
2566
-            $both_btns
2567
-        );
2568
-    }
2569
-
2570
-
2571
-    /**
2572
-     * Sets the _template_args arguments used by the _publish_post_box shortcut
2573
-     * Note: currently there is no validation for this.  However if you want the delete button, the
2574
-     * save, and save and close buttons to work properly, then you will want to include a
2575
-     * values for the name and id arguments.
2576
-     *
2577
-     * @todo  Add in validation for name/id arguments.
2578
-     * @param    string  $name                    key used for the action ID (i.e. event_id)
2579
-     * @param    int     $id                      id attached to the item published
2580
-     * @param    string  $delete                  page route callback for the delete action
2581
-     * @param    string  $save_close_redirect_URL custom URL to redirect to after Save & Close has been completed
2582
-     * @param    boolean $both_btns               whether to display BOTH the "Save & Close" and "Save" buttons or just
2583
-     *                                            the Save button
2584
-     * @throws EE_Error
2585
-     * @throws InvalidArgumentException
2586
-     * @throws InvalidDataTypeException
2587
-     * @throws InvalidInterfaceException
2588
-     */
2589
-    protected function _set_publish_post_box_vars(
2590
-        $name = '',
2591
-        $id = 0,
2592
-        $delete = '',
2593
-        $save_close_redirect_URL = '',
2594
-        $both_btns = true
2595
-    ) {
2596
-        // if Save & Close, use a custom redirect URL or default to the main page?
2597
-        $save_close_redirect_URL = ! empty($save_close_redirect_URL)
2598
-            ? $save_close_redirect_URL
2599
-            : $this->_admin_base_url;
2600
-        // create the Save & Close and Save buttons
2601
-        $this->_set_save_buttons($both_btns, array(), array(), $save_close_redirect_URL);
2602
-        // if we have extra content set let's add it in if not make sure its empty
2603
-        $this->_template_args['publish_box_extra_content'] = isset($this->_template_args['publish_box_extra_content'])
2604
-            ? $this->_template_args['publish_box_extra_content']
2605
-            : '';
2606
-        if ($delete && ! empty($id)) {
2607
-            // make sure we have a default if just true is sent.
2608
-            $delete = ! empty($delete) ? $delete : 'delete';
2609
-            $delete_link_args = array($name => $id);
2610
-            $delete = $this->get_action_link_or_button(
2611
-                $delete,
2612
-                $delete,
2613
-                $delete_link_args,
2614
-                'submitdelete deletion',
2615
-                '',
2616
-                false
2617
-            );
2618
-        }
2619
-        $this->_template_args['publish_delete_link'] = ! empty($id) ? $delete : '';
2620
-        if (! empty($name) && ! empty($id)) {
2621
-            $hidden_field_arr[ $name ] = array(
2622
-                'type'  => 'hidden',
2623
-                'value' => $id,
2624
-            );
2625
-            $hf = $this->_generate_admin_form_fields($hidden_field_arr, 'array');
2626
-        } else {
2627
-            $hf = '';
2628
-        }
2629
-        // add hidden field
2630
-        $this->_template_args['publish_hidden_fields'] = is_array($hf) && ! empty($name)
2631
-            ? $hf[ $name ]['field']
2632
-            : $hf;
2633
-    }
2634
-
2635
-
2636
-    /**
2637
-     * displays an error message to ppl who have javascript disabled
2638
-     *
2639
-     * @return void
2640
-     */
2641
-    private function _display_no_javascript_warning()
2642
-    {
2643
-        ?>
2451
+	}
2452
+
2453
+
2454
+	private function _espresso_links_post_box()
2455
+	{
2456
+		// Hiding until we actually have content to put in here...
2457
+		// 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');
2458
+	}
2459
+
2460
+
2461
+	public function espresso_links_post_box()
2462
+	{
2463
+		// Hiding until we actually have content to put in here...
2464
+		// EEH_Template::display_template(
2465
+		//     EE_ADMIN_TEMPLATE . 'admin_general_metabox_contents_espresso_links.template.php'
2466
+		// );
2467
+	}
2468
+
2469
+
2470
+	protected function _espresso_sponsors_post_box()
2471
+	{
2472
+		if (apply_filters('FHEE_show_sponsors_meta_box', true)) {
2473
+			add_meta_box(
2474
+				'espresso_sponsors_post_box',
2475
+				esc_html__('Event Espresso Highlights', 'event_espresso'),
2476
+				array($this, 'espresso_sponsors_post_box'),
2477
+				$this->_wp_page_slug,
2478
+				'side'
2479
+			);
2480
+		}
2481
+	}
2482
+
2483
+
2484
+	public function espresso_sponsors_post_box()
2485
+	{
2486
+		EEH_Template::display_template(
2487
+			EE_ADMIN_TEMPLATE . 'admin_general_metabox_contents_espresso_sponsors.template.php'
2488
+		);
2489
+	}
2490
+
2491
+
2492
+	private function _publish_post_box()
2493
+	{
2494
+		$meta_box_ref = 'espresso_' . $this->page_slug . '_editor_overview';
2495
+		// if there is a array('label' => array('publishbox' => 'some title') ) present in the _page_config array
2496
+		// then we'll use that for the metabox label.
2497
+		// Otherwise we'll just use publish (publishbox itself could be an array of labels indexed by routes)
2498
+		if (! empty($this->_labels['publishbox'])) {
2499
+			$box_label = is_array($this->_labels['publishbox']) ? $this->_labels['publishbox'][ $this->_req_action ]
2500
+				: $this->_labels['publishbox'];
2501
+		} else {
2502
+			$box_label = esc_html__('Publish', 'event_espresso');
2503
+		}
2504
+		$box_label = apply_filters(
2505
+			'FHEE__EE_Admin_Page___publish_post_box__box_label',
2506
+			$box_label,
2507
+			$this->_req_action,
2508
+			$this
2509
+		);
2510
+		add_meta_box(
2511
+			$meta_box_ref,
2512
+			$box_label,
2513
+			array($this, 'editor_overview'),
2514
+			$this->_current_screen->id,
2515
+			'side',
2516
+			'high'
2517
+		);
2518
+	}
2519
+
2520
+
2521
+	public function editor_overview()
2522
+	{
2523
+		// if we have extra content set let's add it in if not make sure its empty
2524
+		$this->_template_args['publish_box_extra_content'] = isset($this->_template_args['publish_box_extra_content'])
2525
+			? $this->_template_args['publish_box_extra_content']
2526
+			: '';
2527
+		echo EEH_Template::display_template(
2528
+			EE_ADMIN_TEMPLATE . 'admin_details_publish_metabox.template.php',
2529
+			$this->_template_args,
2530
+			true
2531
+		);
2532
+	}
2533
+
2534
+
2535
+	/** end of globally available metaboxes section **/
2536
+
2537
+
2538
+	/**
2539
+	 * Public wrapper for the protected method.  Allows plugins/addons to externally call the
2540
+	 * protected method.
2541
+	 *
2542
+	 * @see   $this->_set_publish_post_box_vars for param details
2543
+	 * @since 4.6.0
2544
+	 * @param string $name
2545
+	 * @param int    $id
2546
+	 * @param bool   $delete
2547
+	 * @param string $save_close_redirect_URL
2548
+	 * @param bool   $both_btns
2549
+	 * @throws EE_Error
2550
+	 * @throws InvalidArgumentException
2551
+	 * @throws InvalidDataTypeException
2552
+	 * @throws InvalidInterfaceException
2553
+	 */
2554
+	public function set_publish_post_box_vars(
2555
+		$name = '',
2556
+		$id = 0,
2557
+		$delete = false,
2558
+		$save_close_redirect_URL = '',
2559
+		$both_btns = true
2560
+	) {
2561
+		$this->_set_publish_post_box_vars(
2562
+			$name,
2563
+			$id,
2564
+			$delete,
2565
+			$save_close_redirect_URL,
2566
+			$both_btns
2567
+		);
2568
+	}
2569
+
2570
+
2571
+	/**
2572
+	 * Sets the _template_args arguments used by the _publish_post_box shortcut
2573
+	 * Note: currently there is no validation for this.  However if you want the delete button, the
2574
+	 * save, and save and close buttons to work properly, then you will want to include a
2575
+	 * values for the name and id arguments.
2576
+	 *
2577
+	 * @todo  Add in validation for name/id arguments.
2578
+	 * @param    string  $name                    key used for the action ID (i.e. event_id)
2579
+	 * @param    int     $id                      id attached to the item published
2580
+	 * @param    string  $delete                  page route callback for the delete action
2581
+	 * @param    string  $save_close_redirect_URL custom URL to redirect to after Save & Close has been completed
2582
+	 * @param    boolean $both_btns               whether to display BOTH the "Save & Close" and "Save" buttons or just
2583
+	 *                                            the Save button
2584
+	 * @throws EE_Error
2585
+	 * @throws InvalidArgumentException
2586
+	 * @throws InvalidDataTypeException
2587
+	 * @throws InvalidInterfaceException
2588
+	 */
2589
+	protected function _set_publish_post_box_vars(
2590
+		$name = '',
2591
+		$id = 0,
2592
+		$delete = '',
2593
+		$save_close_redirect_URL = '',
2594
+		$both_btns = true
2595
+	) {
2596
+		// if Save & Close, use a custom redirect URL or default to the main page?
2597
+		$save_close_redirect_URL = ! empty($save_close_redirect_URL)
2598
+			? $save_close_redirect_URL
2599
+			: $this->_admin_base_url;
2600
+		// create the Save & Close and Save buttons
2601
+		$this->_set_save_buttons($both_btns, array(), array(), $save_close_redirect_URL);
2602
+		// if we have extra content set let's add it in if not make sure its empty
2603
+		$this->_template_args['publish_box_extra_content'] = isset($this->_template_args['publish_box_extra_content'])
2604
+			? $this->_template_args['publish_box_extra_content']
2605
+			: '';
2606
+		if ($delete && ! empty($id)) {
2607
+			// make sure we have a default if just true is sent.
2608
+			$delete = ! empty($delete) ? $delete : 'delete';
2609
+			$delete_link_args = array($name => $id);
2610
+			$delete = $this->get_action_link_or_button(
2611
+				$delete,
2612
+				$delete,
2613
+				$delete_link_args,
2614
+				'submitdelete deletion',
2615
+				'',
2616
+				false
2617
+			);
2618
+		}
2619
+		$this->_template_args['publish_delete_link'] = ! empty($id) ? $delete : '';
2620
+		if (! empty($name) && ! empty($id)) {
2621
+			$hidden_field_arr[ $name ] = array(
2622
+				'type'  => 'hidden',
2623
+				'value' => $id,
2624
+			);
2625
+			$hf = $this->_generate_admin_form_fields($hidden_field_arr, 'array');
2626
+		} else {
2627
+			$hf = '';
2628
+		}
2629
+		// add hidden field
2630
+		$this->_template_args['publish_hidden_fields'] = is_array($hf) && ! empty($name)
2631
+			? $hf[ $name ]['field']
2632
+			: $hf;
2633
+	}
2634
+
2635
+
2636
+	/**
2637
+	 * displays an error message to ppl who have javascript disabled
2638
+	 *
2639
+	 * @return void
2640
+	 */
2641
+	private function _display_no_javascript_warning()
2642
+	{
2643
+		?>
2644 2644
         <noscript>
2645 2645
             <div id="no-js-message" class="error">
2646 2646
                 <p style="font-size:1.3em;">
2647 2647
                     <span style="color:red;"><?php esc_html_e('Warning!', 'event_espresso'); ?></span>
2648 2648
                     <?php esc_html_e(
2649
-                        '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.',
2650
-                        'event_espresso'
2651
-                    ); ?>
2649
+						'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.',
2650
+						'event_espresso'
2651
+					); ?>
2652 2652
                 </p>
2653 2653
             </div>
2654 2654
         </noscript>
2655 2655
         <?php
2656
-    }
2657
-
2658
-
2659
-    /**
2660
-     * displays espresso success and/or error notices
2661
-     *
2662
-     * @return void
2663
-     */
2664
-    private function _display_espresso_notices()
2665
-    {
2666
-        $notices = $this->_get_transient(true);
2667
-        echo stripslashes($notices);
2668
-    }
2669
-
2670
-
2671
-    /**
2672
-     * spinny things pacify the masses
2673
-     *
2674
-     * @return void
2675
-     */
2676
-    protected function _add_admin_page_ajax_loading_img()
2677
-    {
2678
-        ?>
2656
+	}
2657
+
2658
+
2659
+	/**
2660
+	 * displays espresso success and/or error notices
2661
+	 *
2662
+	 * @return void
2663
+	 */
2664
+	private function _display_espresso_notices()
2665
+	{
2666
+		$notices = $this->_get_transient(true);
2667
+		echo stripslashes($notices);
2668
+	}
2669
+
2670
+
2671
+	/**
2672
+	 * spinny things pacify the masses
2673
+	 *
2674
+	 * @return void
2675
+	 */
2676
+	protected function _add_admin_page_ajax_loading_img()
2677
+	{
2678
+		?>
2679 2679
         <div id="espresso-ajax-loading" class="ajax-loading-grey">
2680 2680
             <span class="ee-spinner ee-spin"></span><span class="hidden"><?php
2681
-                esc_html_e('loading...', 'event_espresso'); ?></span>
2681
+				esc_html_e('loading...', 'event_espresso'); ?></span>
2682 2682
         </div>
2683 2683
         <?php
2684
-    }
2684
+	}
2685 2685
 
2686 2686
 
2687
-    /**
2688
-     * add admin page overlay for modal boxes
2689
-     *
2690
-     * @return void
2691
-     */
2692
-    protected function _add_admin_page_overlay()
2693
-    {
2694
-        ?>
2687
+	/**
2688
+	 * add admin page overlay for modal boxes
2689
+	 *
2690
+	 * @return void
2691
+	 */
2692
+	protected function _add_admin_page_overlay()
2693
+	{
2694
+		?>
2695 2695
         <div id="espresso-admin-page-overlay-dv" class=""></div>
2696 2696
         <?php
2697
-    }
2698
-
2699
-
2700
-    /**
2701
-     * facade for add_meta_box
2702
-     *
2703
-     * @param string  $action        where the metabox get's displayed
2704
-     * @param string  $title         Title of Metabox (output in metabox header)
2705
-     * @param string  $callback      If not empty and $create_fun is set to false then we'll use a custom callback
2706
-     *                               instead of the one created in here.
2707
-     * @param array   $callback_args an array of args supplied for the metabox
2708
-     * @param string  $column        what metabox column
2709
-     * @param string  $priority      give this metabox a priority (using accepted priorities for wp meta boxes)
2710
-     * @param boolean $create_func   default is true.  Basically we can say we don't WANT to have the runtime function
2711
-     *                               created but just set our own callback for wp's add_meta_box.
2712
-     * @throws \DomainException
2713
-     */
2714
-    public function _add_admin_page_meta_box(
2715
-        $action,
2716
-        $title,
2717
-        $callback,
2718
-        $callback_args,
2719
-        $column = 'normal',
2720
-        $priority = 'high',
2721
-        $create_func = true
2722
-    ) {
2723
-        do_action('AHEE_log', __FILE__, __FUNCTION__, $callback);
2724
-        // 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.
2725
-        if (empty($callback_args) && $create_func) {
2726
-            $callback_args = array(
2727
-                'template_path' => $this->_template_path,
2728
-                'template_args' => $this->_template_args,
2729
-            );
2730
-        }
2731
-        // 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)
2732
-        $call_back_func = $create_func
2733
-            ? function ($post, $metabox) {
2734
-                do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2735
-                echo EEH_Template::display_template(
2736
-                    $metabox['args']['template_path'],
2737
-                    $metabox['args']['template_args'],
2738
-                    true
2739
-                );
2740
-            }
2741
-            : $callback;
2742
-        add_meta_box(
2743
-            str_replace('_', '-', $action) . '-mbox',
2744
-            $title,
2745
-            $call_back_func,
2746
-            $this->_wp_page_slug,
2747
-            $column,
2748
-            $priority,
2749
-            $callback_args
2750
-        );
2751
-    }
2752
-
2753
-
2754
-    /**
2755
-     * generates HTML wrapper for and admin details page that contains metaboxes in columns
2756
-     *
2757
-     * @throws DomainException
2758
-     * @throws EE_Error
2759
-     */
2760
-    public function display_admin_page_with_metabox_columns()
2761
-    {
2762
-        $this->_template_args['post_body_content'] = $this->_template_args['admin_page_content'];
2763
-        $this->_template_args['admin_page_content'] = EEH_Template::display_template(
2764
-            $this->_column_template_path,
2765
-            $this->_template_args,
2766
-            true
2767
-        );
2768
-        // the final wrapper
2769
-        $this->admin_page_wrapper();
2770
-    }
2771
-
2772
-
2773
-    /**
2774
-     * generates  HTML wrapper for an admin details page
2775
-     *
2776
-     * @return void
2777
-     * @throws EE_Error
2778
-     * @throws DomainException
2779
-     */
2780
-    public function display_admin_page_with_sidebar()
2781
-    {
2782
-        $this->_display_admin_page(true);
2783
-    }
2784
-
2785
-
2786
-    /**
2787
-     * generates  HTML wrapper for an admin details page (except no sidebar)
2788
-     *
2789
-     * @return void
2790
-     * @throws EE_Error
2791
-     * @throws DomainException
2792
-     */
2793
-    public function display_admin_page_with_no_sidebar()
2794
-    {
2795
-        $this->_display_admin_page();
2796
-    }
2797
-
2798
-
2799
-    /**
2800
-     * generates HTML wrapper for an EE about admin page (no sidebar)
2801
-     *
2802
-     * @return void
2803
-     * @throws EE_Error
2804
-     * @throws DomainException
2805
-     */
2806
-    public function display_about_admin_page()
2807
-    {
2808
-        $this->_display_admin_page(false, true);
2809
-    }
2810
-
2811
-
2812
-    /**
2813
-     * display_admin_page
2814
-     * contains the code for actually displaying an admin page
2815
-     *
2816
-     * @param  boolean $sidebar true with sidebar, false without
2817
-     * @param  boolean $about   use the about admin wrapper instead of the default.
2818
-     * @return void
2819
-     * @throws DomainException
2820
-     * @throws EE_Error
2821
-     */
2822
-    private function _display_admin_page($sidebar = false, $about = false)
2823
-    {
2824
-        do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2825
-        // custom remove metaboxes hook to add or remove any metaboxes to/from Admin pages.
2826
-        do_action('AHEE__EE_Admin_Page___display_admin_page__modify_metaboxes');
2827
-        // set current wp page slug - looks like: event-espresso_page_event_categories
2828
-        // keep in mind "event-espresso" COULD be something else if the top level menu label has been translated.
2829
-        $this->_template_args['current_page'] = $this->_wp_page_slug;
2830
-        $this->_template_args['admin_page_wrapper_div_id'] = $this->_cpt_route
2831
-            ? 'poststuff'
2832
-            : 'espresso-default-admin';
2833
-        $template_path = $sidebar
2834
-            ? EE_ADMIN_TEMPLATE . 'admin_details_wrapper.template.php'
2835
-            : EE_ADMIN_TEMPLATE . 'admin_details_wrapper_no_sidebar.template.php';
2836
-        if (defined('DOING_AJAX') && DOING_AJAX) {
2837
-            $template_path = EE_ADMIN_TEMPLATE . 'admin_details_wrapper_no_sidebar_ajax.template.php';
2838
-        }
2839
-        $template_path = ! empty($this->_column_template_path)
2840
-            ? $this->_column_template_path : $template_path;
2841
-        $this->_template_args['post_body_content'] = isset($this->_template_args['admin_page_content'])
2842
-            ? $this->_template_args['admin_page_content']
2843
-            : '';
2844
-        $this->_template_args['before_admin_page_content'] = isset($this->_template_args['before_admin_page_content'])
2845
-            ? $this->_template_args['before_admin_page_content']
2846
-            : '';
2847
-        $this->_template_args['after_admin_page_content'] = isset($this->_template_args['after_admin_page_content'])
2848
-            ? $this->_template_args['after_admin_page_content']
2849
-            : '';
2850
-        $this->_template_args['admin_page_content'] = EEH_Template::display_template(
2851
-            $template_path,
2852
-            $this->_template_args,
2853
-            true
2854
-        );
2855
-        // the final template wrapper
2856
-        $this->admin_page_wrapper($about);
2857
-    }
2858
-
2859
-
2860
-    /**
2861
-     * This is used to display caf preview pages.
2862
-     *
2863
-     * @since 4.3.2
2864
-     * @param string $utm_campaign_source what is the key used for google analytics link
2865
-     * @param bool   $display_sidebar     whether to use the sidebar template or the full template for the page.  TRUE
2866
-     *                                    = SHOW sidebar, FALSE = no sidebar. Default no sidebar.
2867
-     * @return void
2868
-     * @throws DomainException
2869
-     * @throws EE_Error
2870
-     * @throws InvalidArgumentException
2871
-     * @throws InvalidDataTypeException
2872
-     * @throws InvalidInterfaceException
2873
-     */
2874
-    public function display_admin_caf_preview_page($utm_campaign_source = '', $display_sidebar = true)
2875
-    {
2876
-        // let's generate a default preview action button if there isn't one already present.
2877
-        $this->_labels['buttons']['buy_now'] = esc_html__(
2878
-            'Upgrade to Event Espresso 4 Right Now',
2879
-            'event_espresso'
2880
-        );
2881
-        $buy_now_url = add_query_arg(
2882
-            array(
2883
-                'ee_ver'       => 'ee4',
2884
-                'utm_source'   => 'ee4_plugin_admin',
2885
-                'utm_medium'   => 'link',
2886
-                'utm_campaign' => $utm_campaign_source,
2887
-                'utm_content'  => 'buy_now_button',
2888
-            ),
2889
-            'http://eventespresso.com/pricing/'
2890
-        );
2891
-        $this->_template_args['preview_action_button'] = ! isset($this->_template_args['preview_action_button'])
2892
-            ? $this->get_action_link_or_button(
2893
-                '',
2894
-                'buy_now',
2895
-                array(),
2896
-                'button-primary button-large',
2897
-                $buy_now_url,
2898
-                true
2899
-            )
2900
-            : $this->_template_args['preview_action_button'];
2901
-        $this->_template_args['admin_page_content'] = EEH_Template::display_template(
2902
-            EE_ADMIN_TEMPLATE . 'admin_caf_full_page_preview.template.php',
2903
-            $this->_template_args,
2904
-            true
2905
-        );
2906
-        $this->_display_admin_page($display_sidebar);
2907
-    }
2908
-
2909
-
2910
-    /**
2911
-     * display_admin_list_table_page_with_sidebar
2912
-     * generates HTML wrapper for an admin_page with list_table
2913
-     *
2914
-     * @return void
2915
-     * @throws EE_Error
2916
-     * @throws DomainException
2917
-     */
2918
-    public function display_admin_list_table_page_with_sidebar()
2919
-    {
2920
-        $this->_display_admin_list_table_page(true);
2921
-    }
2922
-
2923
-
2924
-    /**
2925
-     * display_admin_list_table_page_with_no_sidebar
2926
-     * generates HTML wrapper for an admin_page with list_table (but with no sidebar)
2927
-     *
2928
-     * @return void
2929
-     * @throws EE_Error
2930
-     * @throws DomainException
2931
-     */
2932
-    public function display_admin_list_table_page_with_no_sidebar()
2933
-    {
2934
-        $this->_display_admin_list_table_page();
2935
-    }
2936
-
2937
-
2938
-    /**
2939
-     * generates html wrapper for an admin_list_table page
2940
-     *
2941
-     * @param boolean $sidebar whether to display with sidebar or not.
2942
-     * @return void
2943
-     * @throws DomainException
2944
-     * @throws EE_Error
2945
-     */
2946
-    private function _display_admin_list_table_page($sidebar = false)
2947
-    {
2948
-        // setup search attributes
2949
-        $this->_set_search_attributes();
2950
-        $this->_template_args['current_page'] = $this->_wp_page_slug;
2951
-        $template_path = EE_ADMIN_TEMPLATE . 'admin_list_wrapper.template.php';
2952
-        $this->_template_args['table_url'] = defined('DOING_AJAX')
2953
-            ? add_query_arg(array('noheader' => 'true', 'route' => $this->_req_action), $this->_admin_base_url)
2954
-            : add_query_arg(array('route' => $this->_req_action), $this->_admin_base_url);
2955
-        $this->_template_args['list_table'] = $this->_list_table_object;
2956
-        $this->_template_args['current_route'] = $this->_req_action;
2957
-        $this->_template_args['list_table_class'] = get_class($this->_list_table_object);
2958
-        $ajax_sorting_callback = $this->_list_table_object->get_ajax_sorting_callback();
2959
-        if (! empty($ajax_sorting_callback)) {
2960
-            $sortable_list_table_form_fields = wp_nonce_field(
2961
-                $ajax_sorting_callback . '_nonce',
2962
-                $ajax_sorting_callback . '_nonce',
2963
-                false,
2964
-                false
2965
-            );
2966
-            $sortable_list_table_form_fields .= '<input type="hidden" id="ajax_table_sort_page" name="ajax_table_sort_page" value="'
2967
-                                                . $this->page_slug
2968
-                                                . '" />';
2969
-            $sortable_list_table_form_fields .= '<input type="hidden" id="ajax_table_sort_action" name="ajax_table_sort_action" value="'
2970
-                                                . $ajax_sorting_callback
2971
-                                                . '" />';
2972
-        } else {
2973
-            $sortable_list_table_form_fields = '';
2974
-        }
2975
-        $this->_template_args['sortable_list_table_form_fields'] = $sortable_list_table_form_fields;
2976
-        $hidden_form_fields = isset($this->_template_args['list_table_hidden_fields'])
2977
-            ? $this->_template_args['list_table_hidden_fields']
2978
-            : '';
2979
-        $nonce_ref = $this->_req_action . '_nonce';
2980
-        $hidden_form_fields .= '<input type="hidden" name="'
2981
-                               . $nonce_ref
2982
-                               . '" value="'
2983
-                               . wp_create_nonce($nonce_ref)
2984
-                               . '">';
2985
-        $this->_template_args['list_table_hidden_fields'] = $hidden_form_fields;
2986
-        // display message about search results?
2987
-        $this->_template_args['before_list_table'] .= ! empty($this->_req_data['s'])
2988
-            ? '<p class="ee-search-results">' . sprintf(
2989
-                esc_html__('Displaying search results for the search string: %1$s', 'event_espresso'),
2990
-                trim($this->_req_data['s'], '%')
2991
-            ) . '</p>'
2992
-            : '';
2993
-        // filter before_list_table template arg
2994
-        $this->_template_args['before_list_table'] = apply_filters(
2995
-            'FHEE__EE_Admin_Page___display_admin_list_table_page__before_list_table__template_arg',
2996
-            $this->_template_args['before_list_table'],
2997
-            $this->page_slug,
2998
-            $this->_req_data,
2999
-            $this->_req_action
3000
-        );
3001
-        // convert to array and filter again
3002
-        // arrays are easier to inject new items in a specific location,
3003
-        // but would not be backwards compatible, so we have to add a new filter
3004
-        $this->_template_args['before_list_table'] = implode(
3005
-            " \n",
3006
-            (array) apply_filters(
3007
-                'FHEE__EE_Admin_Page___display_admin_list_table_page__before_list_table__template_args_array',
3008
-                (array) $this->_template_args['before_list_table'],
3009
-                $this->page_slug,
3010
-                $this->_req_data,
3011
-                $this->_req_action
3012
-            )
3013
-        );
3014
-        // filter after_list_table template arg
3015
-        $this->_template_args['after_list_table'] = apply_filters(
3016
-            'FHEE__EE_Admin_Page___display_admin_list_table_page__after_list_table__template_arg',
3017
-            $this->_template_args['after_list_table'],
3018
-            $this->page_slug,
3019
-            $this->_req_data,
3020
-            $this->_req_action
3021
-        );
3022
-        // convert to array and filter again
3023
-        // arrays are easier to inject new items in a specific location,
3024
-        // but would not be backwards compatible, so we have to add a new filter
3025
-        $this->_template_args['after_list_table'] = implode(
3026
-            " \n",
3027
-            (array) apply_filters(
3028
-                'FHEE__EE_Admin_Page___display_admin_list_table_page__after_list_table__template_args_array',
3029
-                (array) $this->_template_args['after_list_table'],
3030
-                $this->page_slug,
3031
-                $this->_req_data,
3032
-                $this->_req_action
3033
-            )
3034
-        );
3035
-        $this->_template_args['admin_page_content'] = EEH_Template::display_template(
3036
-            $template_path,
3037
-            $this->_template_args,
3038
-            true
3039
-        );
3040
-        // the final template wrapper
3041
-        if ($sidebar) {
3042
-            $this->display_admin_page_with_sidebar();
3043
-        } else {
3044
-            $this->display_admin_page_with_no_sidebar();
3045
-        }
3046
-    }
3047
-
3048
-
3049
-    /**
3050
-     * This just prepares a legend using the given items and the admin_details_legend.template.php file and returns the
3051
-     * html string for the legend.
3052
-     * $items are expected in an array in the following format:
3053
-     * $legend_items = array(
3054
-     *        'item_id' => array(
3055
-     *            'icon' => 'http://url_to_icon_being_described.png',
3056
-     *            'desc' => esc_html__('localized description of item');
3057
-     *        )
3058
-     * );
3059
-     *
3060
-     * @param  array $items see above for format of array
3061
-     * @return string html string of legend
3062
-     * @throws DomainException
3063
-     */
3064
-    protected function _display_legend($items)
3065
-    {
3066
-        $this->_template_args['items'] = apply_filters(
3067
-            'FHEE__EE_Admin_Page___display_legend__items',
3068
-            (array) $items,
3069
-            $this
3070
-        );
3071
-        return EEH_Template::display_template(
3072
-            EE_ADMIN_TEMPLATE . 'admin_details_legend.template.php',
3073
-            $this->_template_args,
3074
-            true
3075
-        );
3076
-    }
3077
-
3078
-
3079
-    /**
3080
-     * This is used whenever we're DOING_AJAX to return a formatted json array that our calling javascript can expect
3081
-     * The returned json object is created from an array in the following format:
3082
-     * array(
3083
-     *  'error' => FALSE, //(default FALSE), contains any errors and/or exceptions (exceptions return json early),
3084
-     *  'success' => FALSE, //(default FALSE) - contains any special success message.
3085
-     *  'notices' => '', // - contains any EE_Error formatted notices
3086
-     *  'content' => 'string can be html', //this is a string of formatted content (can be html)
3087
-     *  'data' => array() //this can be any key/value pairs that a method returns for later json parsing by the js.
3088
-     *  We're also going to include the template args with every package (so js can pick out any specific template args
3089
-     *  that might be included in here)
3090
-     * )
3091
-     * The json object is populated by whatever is set in the $_template_args property.
3092
-     *
3093
-     * @param bool  $sticky_notices    Used to indicate whether you want to ensure notices are added to a transient
3094
-     *                                 instead of displayed.
3095
-     * @param array $notices_arguments Use this to pass any additional args on to the _process_notices.
3096
-     * @return void
3097
-     * @throws EE_Error
3098
-     */
3099
-    protected function _return_json($sticky_notices = false, $notices_arguments = array())
3100
-    {
3101
-        // make sure any EE_Error notices have been handled.
3102
-        $this->_process_notices($notices_arguments, true, $sticky_notices);
3103
-        $data = isset($this->_template_args['data']) ? $this->_template_args['data'] : array();
3104
-        unset($this->_template_args['data']);
3105
-        $json = array(
3106
-            'error'     => isset($this->_template_args['error']) ? $this->_template_args['error'] : false,
3107
-            'success'   => isset($this->_template_args['success']) ? $this->_template_args['success'] : false,
3108
-            'errors'    => isset($this->_template_args['errors']) ? $this->_template_args['errors'] : false,
3109
-            'attention' => isset($this->_template_args['attention']) ? $this->_template_args['attention'] : false,
3110
-            'notices'   => EE_Error::get_notices(),
3111
-            'content'   => isset($this->_template_args['admin_page_content'])
3112
-                ? $this->_template_args['admin_page_content'] : '',
3113
-            'data'      => array_merge($data, array('template_args' => $this->_template_args)),
3114
-            'isEEajax'  => true
3115
-            // special flag so any ajax.Success methods in js can identify this return package as a EEajax package.
3116
-        );
3117
-        // make sure there are no php errors or headers_sent.  Then we can set correct json header.
3118
-        if (null === error_get_last() || ! headers_sent()) {
3119
-            header('Content-Type: application/json; charset=UTF-8');
3120
-        }
3121
-        echo wp_json_encode($json);
3122
-        exit();
3123
-    }
3124
-
3125
-
3126
-    /**
3127
-     * Simply a wrapper for the protected method so we can call this outside the class (ONLY when doing ajax)
3128
-     *
3129
-     * @return void
3130
-     * @throws EE_Error
3131
-     */
3132
-    public function return_json()
3133
-    {
3134
-        if (defined('DOING_AJAX') && DOING_AJAX) {
3135
-            $this->_return_json();
3136
-        } else {
3137
-            throw new EE_Error(
3138
-                sprintf(
3139
-                    esc_html__('The public %s method can only be called when DOING_AJAX = TRUE', 'event_espresso'),
3140
-                    __FUNCTION__
3141
-                )
3142
-            );
3143
-        }
3144
-    }
3145
-
3146
-
3147
-    /**
3148
-     * This provides a way for child hook classes to send along themselves by reference so methods/properties within
3149
-     * them can be accessed by EE_Admin_child pages. This is assigned to the $_hook_obj property.
3150
-     *
3151
-     * @param EE_Admin_Hooks $hook_obj This will be the object for the EE_Admin_Hooks child
3152
-     */
3153
-    public function set_hook_object(EE_Admin_Hooks $hook_obj)
3154
-    {
3155
-        $this->_hook_obj = $hook_obj;
3156
-    }
3157
-
3158
-
3159
-    /**
3160
-     *        generates  HTML wrapper with Tabbed nav for an admin page
3161
-     *
3162
-     * @param  boolean $about whether to use the special about page wrapper or default.
3163
-     * @return void
3164
-     * @throws DomainException
3165
-     * @throws EE_Error
3166
-     */
3167
-    public function admin_page_wrapper($about = false)
3168
-    {
3169
-        do_action('AHEE_log', __FILE__, __FUNCTION__, '');
3170
-        $this->_nav_tabs = $this->_get_main_nav_tabs();
3171
-        $this->_template_args['nav_tabs'] = $this->_nav_tabs;
3172
-        $this->_template_args['admin_page_title'] = $this->_admin_page_title;
3173
-        $this->_template_args['before_admin_page_content'] = apply_filters(
3174
-            "FHEE_before_admin_page_content{$this->_current_page}{$this->_current_view}",
3175
-            isset($this->_template_args['before_admin_page_content'])
3176
-                ? $this->_template_args['before_admin_page_content']
3177
-                : ''
3178
-        );
3179
-        $this->_template_args['after_admin_page_content'] = apply_filters(
3180
-            "FHEE_after_admin_page_content{$this->_current_page}{$this->_current_view}",
3181
-            isset($this->_template_args['after_admin_page_content'])
3182
-                ? $this->_template_args['after_admin_page_content']
3183
-                : ''
3184
-        );
3185
-        $this->_template_args['after_admin_page_content'] .= $this->_set_help_popup_content();
3186
-        // load settings page wrapper template
3187
-        $template_path = ! defined('DOING_AJAX')
3188
-            ? EE_ADMIN_TEMPLATE . 'admin_wrapper.template.php'
3189
-            : EE_ADMIN_TEMPLATE
3190
-              . 'admin_wrapper_ajax.template.php';
3191
-        // about page?
3192
-        $template_path = $about
3193
-            ? EE_ADMIN_TEMPLATE . 'about_admin_wrapper.template.php'
3194
-            : $template_path;
3195
-        if (defined('DOING_AJAX')) {
3196
-            $this->_template_args['admin_page_content'] = EEH_Template::display_template(
3197
-                $template_path,
3198
-                $this->_template_args,
3199
-                true
3200
-            );
3201
-            $this->_return_json();
3202
-        } else {
3203
-            EEH_Template::display_template($template_path, $this->_template_args);
3204
-        }
3205
-    }
3206
-
3207
-
3208
-    /**
3209
-     * This returns the admin_nav tabs html using the configuration in the _nav_tabs property
3210
-     *
3211
-     * @return string html
3212
-     * @throws EE_Error
3213
-     */
3214
-    protected function _get_main_nav_tabs()
3215
-    {
3216
-        // let's generate the html using the EEH_Tabbed_Content helper.
3217
-        // We do this here so that it's possible for child classes to add in nav tabs dynamically at the last minute
3218
-        // (rather than setting in the page_routes array)
3219
-        return EEH_Tabbed_Content::display_admin_nav_tabs($this->_nav_tabs);
3220
-    }
3221
-
3222
-
3223
-    /**
3224
-     *        sort nav tabs
3225
-     *
3226
-     * @param $a
3227
-     * @param $b
3228
-     * @return int
3229
-     */
3230
-    private function _sort_nav_tabs($a, $b)
3231
-    {
3232
-        if ($a['order'] === $b['order']) {
3233
-            return 0;
3234
-        }
3235
-        return ($a['order'] < $b['order']) ? -1 : 1;
3236
-    }
3237
-
3238
-
3239
-    /**
3240
-     *    generates HTML for the forms used on admin pages
3241
-     *
3242
-     * @param    array $input_vars - array of input field details
3243
-     * @param string   $generator  (options are 'string' or 'array', basically use this to indicate which generator to
3244
-     *                             use)
3245
-     * @param bool     $id
3246
-     * @return string
3247
-     * @uses   EEH_Form_Fields::get_form_fields (/helper/EEH_Form_Fields.helper.php)
3248
-     * @uses   EEH_Form_Fields::get_form_fields_array (/helper/EEH_Form_Fields.helper.php)
3249
-     */
3250
-    protected function _generate_admin_form_fields($input_vars = array(), $generator = 'string', $id = false)
3251
-    {
3252
-        $content = $generator === 'string'
3253
-            ? EEH_Form_Fields::get_form_fields($input_vars, $id)
3254
-            : EEH_Form_Fields::get_form_fields_array($input_vars);
3255
-        return $content;
3256
-    }
3257
-
3258
-
3259
-    /**
3260
-     * generates the "Save" and "Save & Close" buttons for edit forms
3261
-     *
3262
-     * @param bool             $both     if true then both buttons will be generated.  If false then just the "Save &
3263
-     *                                   Close" button.
3264
-     * @param array            $text     if included, generator will use the given text for the buttons ( array([0] =>
3265
-     *                                   'Save', [1] => 'save & close')
3266
-     * @param array            $actions  if included allows us to set the actions that each button will carry out (i.e.
3267
-     *                                   via the "name" value in the button).  We can also use this to just dump
3268
-     *                                   default actions by submitting some other value.
3269
-     * @param bool|string|null $referrer if false then we just do the default action on save and close.  Other wise it
3270
-     *                                   will use the $referrer string. IF null, then we don't do ANYTHING on save and
3271
-     *                                   close (normal form handling).
3272
-     */
3273
-    protected function _set_save_buttons($both = true, $text = array(), $actions = array(), $referrer = null)
3274
-    {
3275
-        // make sure $text and $actions are in an array
3276
-        $text = (array) $text;
3277
-        $actions = (array) $actions;
3278
-        $referrer_url = empty($referrer)
3279
-            ? '<input type="hidden" id="save_and_close_referrer" name="save_and_close_referrer" value="'
3280
-              . $_SERVER['REQUEST_URI']
3281
-              . '" />'
3282
-            : '<input type="hidden" id="save_and_close_referrer" name="save_and_close_referrer" value="'
3283
-              . $referrer
3284
-              . '" />';
3285
-        $button_text = ! empty($text)
3286
-            ? $text
3287
-            : array(
3288
-                esc_html__('Save', 'event_espresso'),
3289
-                esc_html__('Save and Close', 'event_espresso'),
3290
-            );
3291
-        $default_names = array('save', 'save_and_close');
3292
-        // add in a hidden index for the current page (so save and close redirects properly)
3293
-        $this->_template_args['save_buttons'] = $referrer_url;
3294
-        foreach ($button_text as $key => $button) {
3295
-            $ref = $default_names[ $key ];
3296
-            $this->_template_args['save_buttons'] .= '<input type="submit" class="button-primary '
3297
-                                                     . $ref
3298
-                                                     . '" value="'
3299
-                                                     . $button
3300
-                                                     . '" name="'
3301
-                                                     . (! empty($actions) ? $actions[ $key ] : $ref)
3302
-                                                     . '" id="'
3303
-                                                     . $this->_current_view . '_' . $ref
3304
-                                                     . '" />';
3305
-            if (! $both) {
3306
-                break;
3307
-            }
3308
-        }
3309
-    }
3310
-
3311
-
3312
-    /**
3313
-     * Wrapper for the protected function.  Allows plugins/addons to call this to set the form tags.
3314
-     *
3315
-     * @see   $this->_set_add_edit_form_tags() for details on params
3316
-     * @since 4.6.0
3317
-     * @param string $route
3318
-     * @param array  $additional_hidden_fields
3319
-     */
3320
-    public function set_add_edit_form_tags($route = '', $additional_hidden_fields = array())
3321
-    {
3322
-        $this->_set_add_edit_form_tags($route, $additional_hidden_fields);
3323
-    }
3324
-
3325
-
3326
-    /**
3327
-     * set form open and close tags on add/edit pages.
3328
-     *
3329
-     * @param string $route                    the route you want the form to direct to
3330
-     * @param array  $additional_hidden_fields any additional hidden fields required in the form header
3331
-     * @return void
3332
-     */
3333
-    protected function _set_add_edit_form_tags($route = '', $additional_hidden_fields = array())
3334
-    {
3335
-        if (empty($route)) {
3336
-            $user_msg = esc_html__(
3337
-                'An error occurred. No action was set for this page\'s form.',
3338
-                'event_espresso'
3339
-            );
3340
-            $dev_msg = $user_msg . "\n"
3341
-                       . sprintf(
3342
-                           esc_html__('The $route argument is required for the %s->%s method.', 'event_espresso'),
3343
-                           __FUNCTION__,
3344
-                           __CLASS__
3345
-                       );
3346
-            EE_Error::add_error($user_msg . '||' . $dev_msg, __FILE__, __FUNCTION__, __LINE__);
3347
-        }
3348
-        // open form
3349
-        $this->_template_args['before_admin_page_content'] = '<form name="form" method="post" action="'
3350
-                                                             . $this->_admin_base_url
3351
-                                                             . '" id="'
3352
-                                                             . $route
3353
-                                                             . '_event_form" >';
3354
-        // add nonce
3355
-        $nonce = wp_nonce_field($route . '_nonce', $route . '_nonce', false, false);
3356
-        $this->_template_args['before_admin_page_content'] .= "\n\t" . $nonce;
3357
-        // add REQUIRED form action
3358
-        $hidden_fields = array(
3359
-            'action' => array('type' => 'hidden', 'value' => $route),
3360
-        );
3361
-        // merge arrays
3362
-        $hidden_fields = is_array($additional_hidden_fields)
3363
-            ? array_merge($hidden_fields, $additional_hidden_fields)
3364
-            : $hidden_fields;
3365
-        // generate form fields
3366
-        $form_fields = $this->_generate_admin_form_fields($hidden_fields, 'array');
3367
-        // add fields to form
3368
-        foreach ((array) $form_fields as $field_name => $form_field) {
3369
-            $this->_template_args['before_admin_page_content'] .= "\n\t" . $form_field['field'];
3370
-        }
3371
-        // close form
3372
-        $this->_template_args['after_admin_page_content'] = '</form>';
3373
-    }
3374
-
3375
-
3376
-    /**
3377
-     * Public Wrapper for _redirect_after_action() method since its
3378
-     * discovered it would be useful for external code to have access.
3379
-     *
3380
-     * @see   EE_Admin_Page::_redirect_after_action() for params.
3381
-     * @since 4.5.0
3382
-     * @param bool   $success
3383
-     * @param string $what
3384
-     * @param string $action_desc
3385
-     * @param array  $query_args
3386
-     * @param bool   $override_overwrite
3387
-     * @throws EE_Error
3388
-     */
3389
-    public function redirect_after_action(
3390
-        $success = false,
3391
-        $what = 'item',
3392
-        $action_desc = 'processed',
3393
-        $query_args = array(),
3394
-        $override_overwrite = false
3395
-    ) {
3396
-        $this->_redirect_after_action(
3397
-            $success,
3398
-            $what,
3399
-            $action_desc,
3400
-            $query_args,
3401
-            $override_overwrite
3402
-        );
3403
-    }
3404
-
3405
-
3406
-    /**
3407
-     *    _redirect_after_action
3408
-     *
3409
-     * @param int    $success            - whether success was for two or more records, or just one, or none
3410
-     * @param string $what               - what the action was performed on
3411
-     * @param string $action_desc        - what was done ie: updated, deleted, etc
3412
-     * @param array  $query_args         - an array of query_args to be added to the URL to redirect to after the admin
3413
-     *                                   action is completed
3414
-     * @param BOOL   $override_overwrite by default all EE_Error::success messages are overwritten, this allows you to
3415
-     *                                   override this so that they show.
3416
-     * @return void
3417
-     * @throws EE_Error
3418
-     */
3419
-    protected function _redirect_after_action(
3420
-        $success = 0,
3421
-        $what = 'item',
3422
-        $action_desc = 'processed',
3423
-        $query_args = array(),
3424
-        $override_overwrite = false
3425
-    ) {
3426
-        do_action('AHEE_log', __FILE__, __FUNCTION__, '');
3427
-        // class name for actions/filters.
3428
-        $classname = get_class($this);
3429
-        // set redirect url.
3430
-        // Note if there is a "page" index in the $query_args then we go with vanilla admin.php route,
3431
-        // otherwise we go with whatever is set as the _admin_base_url
3432
-        $redirect_url = isset($query_args['page']) ? admin_url('admin.php') : $this->_admin_base_url;
3433
-        $notices = EE_Error::get_notices(false);
3434
-        // overwrite default success messages //BUT ONLY if overwrite not overridden
3435
-        if (! $override_overwrite || ! empty($notices['errors'])) {
3436
-            EE_Error::overwrite_success();
3437
-        }
3438
-        if (! empty($what) && ! empty($action_desc) && empty($notices['errors'])) {
3439
-            // how many records affected ? more than one record ? or just one ?
3440
-            if ($success > 1) {
3441
-                // set plural msg
3442
-                EE_Error::add_success(
3443
-                    sprintf(
3444
-                        esc_html__('The "%s" have been successfully %s.', 'event_espresso'),
3445
-                        $what,
3446
-                        $action_desc
3447
-                    ),
3448
-                    __FILE__,
3449
-                    __FUNCTION__,
3450
-                    __LINE__
3451
-                );
3452
-            } elseif ($success === 1) {
3453
-                // set singular msg
3454
-                EE_Error::add_success(
3455
-                    sprintf(
3456
-                        esc_html__('The "%s" has been successfully %s.', 'event_espresso'),
3457
-                        $what,
3458
-                        $action_desc
3459
-                    ),
3460
-                    __FILE__,
3461
-                    __FUNCTION__,
3462
-                    __LINE__
3463
-                );
3464
-            }
3465
-        }
3466
-        // check that $query_args isn't something crazy
3467
-        if (! is_array($query_args)) {
3468
-            $query_args = array();
3469
-        }
3470
-        /**
3471
-         * Allow injecting actions before the query_args are modified for possible different
3472
-         * redirections on save and close actions
3473
-         *
3474
-         * @since 4.2.0
3475
-         * @param array $query_args       The original query_args array coming into the
3476
-         *                                method.
3477
-         */
3478
-        do_action(
3479
-            "AHEE__{$classname}___redirect_after_action__before_redirect_modification_{$this->_req_action}",
3480
-            $query_args
3481
-        );
3482
-        // calculate where we're going (if we have a "save and close" button pushed)
3483
-        if (isset($this->_req_data['save_and_close'], $this->_req_data['save_and_close_referrer'])) {
3484
-            // even though we have the save_and_close referrer, we need to parse the url for the action in order to generate a nonce
3485
-            $parsed_url = parse_url($this->_req_data['save_and_close_referrer']);
3486
-            // regenerate query args array from referrer URL
3487
-            parse_str($parsed_url['query'], $query_args);
3488
-            // correct page and action will be in the query args now
3489
-            $redirect_url = admin_url('admin.php');
3490
-        }
3491
-        // merge any default query_args set in _default_route_query_args property
3492
-        if (! empty($this->_default_route_query_args) && ! $this->_is_UI_request) {
3493
-            $args_to_merge = array();
3494
-            foreach ($this->_default_route_query_args as $query_param => $query_value) {
3495
-                // is there a wp_referer array in our _default_route_query_args property?
3496
-                if ($query_param === 'wp_referer') {
3497
-                    $query_value = (array) $query_value;
3498
-                    foreach ($query_value as $reference => $value) {
3499
-                        if (strpos($reference, 'nonce') !== false) {
3500
-                            continue;
3501
-                        }
3502
-                        // finally we will override any arguments in the referer with
3503
-                        // what might be set on the _default_route_query_args array.
3504
-                        if (isset($this->_default_route_query_args[ $reference ])) {
3505
-                            $args_to_merge[ $reference ] = urlencode($this->_default_route_query_args[ $reference ]);
3506
-                        } else {
3507
-                            $args_to_merge[ $reference ] = urlencode($value);
3508
-                        }
3509
-                    }
3510
-                    continue;
3511
-                }
3512
-                $args_to_merge[ $query_param ] = $query_value;
3513
-            }
3514
-            // now let's merge these arguments but override with what was specifically sent in to the
3515
-            // redirect.
3516
-            $query_args = array_merge($args_to_merge, $query_args);
3517
-        }
3518
-        $this->_process_notices($query_args);
3519
-        // generate redirect url
3520
-        // if redirecting to anything other than the main page, add a nonce
3521
-        if (isset($query_args['action'])) {
3522
-            // manually generate wp_nonce and merge that with the query vars
3523
-            // becuz the wp_nonce_url function wrecks havoc on some vars
3524
-            $query_args['_wpnonce'] = wp_create_nonce($query_args['action'] . '_nonce');
3525
-        }
3526
-        // we're adding some hooks and filters in here for processing any things just before redirects
3527
-        // (example: an admin page has done an insert or update and we want to run something after that).
3528
-        do_action('AHEE_redirect_' . $classname . $this->_req_action, $query_args);
3529
-        $redirect_url = apply_filters(
3530
-            'FHEE_redirect_' . $classname . $this->_req_action,
3531
-            self::add_query_args_and_nonce($query_args, $redirect_url),
3532
-            $query_args
3533
-        );
3534
-        // check if we're doing ajax.  If we are then lets just return the results and js can handle how it wants.
3535
-        if (defined('DOING_AJAX')) {
3536
-            $default_data = array(
3537
-                'close'        => true,
3538
-                'redirect_url' => $redirect_url,
3539
-                'where'        => 'main',
3540
-                'what'         => 'append',
3541
-            );
3542
-            $this->_template_args['success'] = $success;
3543
-            $this->_template_args['data'] = ! empty($this->_template_args['data']) ? array_merge(
3544
-                $default_data,
3545
-                $this->_template_args['data']
3546
-            ) : $default_data;
3547
-            $this->_return_json();
3548
-        }
3549
-        wp_safe_redirect($redirect_url);
3550
-        exit();
3551
-    }
3552
-
3553
-
3554
-    /**
3555
-     * process any notices before redirecting (or returning ajax request)
3556
-     * This method sets the $this->_template_args['notices'] attribute;
3557
-     *
3558
-     * @param  array $query_args        any query args that need to be used for notice transient ('action')
3559
-     * @param bool   $skip_route_verify This is typically used when we are processing notices REALLY early and
3560
-     *                                  page_routes haven't been defined yet.
3561
-     * @param bool   $sticky_notices    This is used to flag that regardless of whether this is doing_ajax or not, we
3562
-     *                                  still save a transient for the notice.
3563
-     * @return void
3564
-     * @throws EE_Error
3565
-     */
3566
-    protected function _process_notices($query_args = array(), $skip_route_verify = false, $sticky_notices = true)
3567
-    {
3568
-        // first let's set individual error properties if doing_ajax and the properties aren't already set.
3569
-        if (defined('DOING_AJAX') && DOING_AJAX) {
3570
-            $notices = EE_Error::get_notices(false);
3571
-            if (empty($this->_template_args['success'])) {
3572
-                $this->_template_args['success'] = isset($notices['success']) ? $notices['success'] : false;
3573
-            }
3574
-            if (empty($this->_template_args['errors'])) {
3575
-                $this->_template_args['errors'] = isset($notices['errors']) ? $notices['errors'] : false;
3576
-            }
3577
-            if (empty($this->_template_args['attention'])) {
3578
-                $this->_template_args['attention'] = isset($notices['attention']) ? $notices['attention'] : false;
3579
-            }
3580
-        }
3581
-        $this->_template_args['notices'] = EE_Error::get_notices();
3582
-        // IF this isn't ajax we need to create a transient for the notices using the route (however, overridden if $sticky_notices == true)
3583
-        if (! defined('DOING_AJAX') || $sticky_notices) {
3584
-            $route = isset($query_args['action']) ? $query_args['action'] : 'default';
3585
-            $this->_add_transient(
3586
-                $route,
3587
-                $this->_template_args['notices'],
3588
-                true,
3589
-                $skip_route_verify
3590
-            );
3591
-        }
3592
-    }
3593
-
3594
-
3595
-    /**
3596
-     * get_action_link_or_button
3597
-     * returns the button html for adding, editing, or deleting an item (depending on given type)
3598
-     *
3599
-     * @param string $action        use this to indicate which action the url is generated with.
3600
-     * @param string $type          accepted strings must be defined in the $_labels['button'] array(as the key)
3601
-     *                              property.
3602
-     * @param array  $extra_request if the button requires extra params you can include them in $key=>$value pairs.
3603
-     * @param string $class         Use this to give the class for the button. Defaults to 'button-primary'
3604
-     * @param string $base_url      If this is not provided
3605
-     *                              the _admin_base_url will be used as the default for the button base_url.
3606
-     *                              Otherwise this value will be used.
3607
-     * @param bool   $exclude_nonce If true then no nonce will be in the generated button link.
3608
-     * @return string
3609
-     * @throws InvalidArgumentException
3610
-     * @throws InvalidInterfaceException
3611
-     * @throws InvalidDataTypeException
3612
-     * @throws EE_Error
3613
-     */
3614
-    public function get_action_link_or_button(
3615
-        $action,
3616
-        $type = 'add',
3617
-        $extra_request = array(),
3618
-        $class = 'button-primary',
3619
-        $base_url = '',
3620
-        $exclude_nonce = false
3621
-    ) {
3622
-        // first let's validate the action (if $base_url is FALSE otherwise validation will happen further along)
3623
-        if (empty($base_url) && ! isset($this->_page_routes[ $action ])) {
3624
-            throw new EE_Error(
3625
-                sprintf(
3626
-                    esc_html__(
3627
-                        'There is no page route for given action for the button.  This action was given: %s',
3628
-                        'event_espresso'
3629
-                    ),
3630
-                    $action
3631
-                )
3632
-            );
3633
-        }
3634
-        if (! isset($this->_labels['buttons'][ $type ])) {
3635
-            throw new EE_Error(
3636
-                sprintf(
3637
-                    __(
3638
-                        'There is no label for the given button type (%s). Labels are set in the <code>_page_config</code> property.',
3639
-                        'event_espresso'
3640
-                    ),
3641
-                    $type
3642
-                )
3643
-            );
3644
-        }
3645
-        // finally check user access for this button.
3646
-        $has_access = $this->check_user_access($action, true);
3647
-        if (! $has_access) {
3648
-            return '';
3649
-        }
3650
-        $_base_url = ! $base_url ? $this->_admin_base_url : $base_url;
3651
-        $query_args = array(
3652
-            'action' => $action,
3653
-        );
3654
-        // merge extra_request args but make sure our original action takes precedence and doesn't get overwritten.
3655
-        if (! empty($extra_request)) {
3656
-            $query_args = array_merge($extra_request, $query_args);
3657
-        }
3658
-        $url = self::add_query_args_and_nonce($query_args, $_base_url, false, $exclude_nonce);
3659
-        return EEH_Template::get_button_or_link($url, $this->_labels['buttons'][ $type ], $class);
3660
-    }
3661
-
3662
-
3663
-    /**
3664
-     * _per_page_screen_option
3665
-     * Utility function for adding in a per_page_option in the screen_options_dropdown.
3666
-     *
3667
-     * @return void
3668
-     * @throws InvalidArgumentException
3669
-     * @throws InvalidInterfaceException
3670
-     * @throws InvalidDataTypeException
3671
-     */
3672
-    protected function _per_page_screen_option()
3673
-    {
3674
-        $option = 'per_page';
3675
-        $args = array(
3676
-            'label'   => apply_filters(
3677
-                'FHEE__EE_Admin_Page___per_page_screen_options___label',
3678
-                $this->_admin_page_title,
3679
-                $this
3680
-            ),
3681
-            'default' => (int) apply_filters(
3682
-                'FHEE__EE_Admin_Page___per_page_screen_options__default',
3683
-                10
3684
-            ),
3685
-            'option'  => $this->_current_page . '_' . $this->_current_view . '_per_page',
3686
-        );
3687
-        // ONLY add the screen option if the user has access to it.
3688
-        if ($this->check_user_access($this->_current_view, true)) {
3689
-            add_screen_option($option, $args);
3690
-        }
3691
-    }
3692
-
3693
-
3694
-    /**
3695
-     * set_per_page_screen_option
3696
-     * All this does is make sure that WordPress saves any per_page screen options (if set) for the current page.
3697
-     * we have to do this rather than running inside the 'set-screen-options' hook because it runs earlier than
3698
-     * admin_menu.
3699
-     *
3700
-     * @return void
3701
-     */
3702
-    private function _set_per_page_screen_options()
3703
-    {
3704
-        if (isset($_POST['wp_screen_options']) && is_array($_POST['wp_screen_options'])) {
3705
-            check_admin_referer('screen-options-nonce', 'screenoptionnonce');
3706
-            if (! $user = wp_get_current_user()) {
3707
-                return;
3708
-            }
3709
-            $option = $_POST['wp_screen_options']['option'];
3710
-            $value = $_POST['wp_screen_options']['value'];
3711
-            if ($option != sanitize_key($option)) {
3712
-                return;
3713
-            }
3714
-            $map_option = $option;
3715
-            $option = str_replace('-', '_', $option);
3716
-            switch ($map_option) {
3717
-                case $this->_current_page . '_' . $this->_current_view . '_per_page':
3718
-                    $value = (int) $value;
3719
-                    $max_value = apply_filters(
3720
-                        'FHEE__EE_Admin_Page___set_per_page_screen_options__max_value',
3721
-                        999,
3722
-                        $this->_current_page,
3723
-                        $this->_current_view
3724
-                    );
3725
-                    if ($value < 1) {
3726
-                        return;
3727
-                    }
3728
-                    $value = min($value, $max_value);
3729
-                    break;
3730
-                default:
3731
-                    $value = apply_filters(
3732
-                        'FHEE__EE_Admin_Page___set_per_page_screen_options__value',
3733
-                        false,
3734
-                        $option,
3735
-                        $value
3736
-                    );
3737
-                    if (false === $value) {
3738
-                        return;
3739
-                    }
3740
-                    break;
3741
-            }
3742
-            update_user_meta($user->ID, $option, $value);
3743
-            wp_safe_redirect(remove_query_arg(array('pagenum', 'apage', 'paged'), wp_get_referer()));
3744
-            exit;
3745
-        }
3746
-    }
3747
-
3748
-
3749
-    /**
3750
-     * This just allows for setting the $_template_args property if it needs to be set outside the object
3751
-     *
3752
-     * @param array $data array that will be assigned to template args.
3753
-     */
3754
-    public function set_template_args($data)
3755
-    {
3756
-        $this->_template_args = array_merge($this->_template_args, (array) $data);
3757
-    }
3758
-
3759
-
3760
-    /**
3761
-     * This makes available the WP transient system for temporarily moving data between routes
3762
-     *
3763
-     * @param string $route             the route that should receive the transient
3764
-     * @param array  $data              the data that gets sent
3765
-     * @param bool   $notices           If this is for notices then we use this to indicate so, otherwise its just a
3766
-     *                                  normal route transient.
3767
-     * @param bool   $skip_route_verify Used to indicate we want to skip route verification.  This is usually ONLY used
3768
-     *                                  when we are adding a transient before page_routes have been defined.
3769
-     * @return void
3770
-     * @throws EE_Error
3771
-     */
3772
-    protected function _add_transient($route, $data, $notices = false, $skip_route_verify = false)
3773
-    {
3774
-        $user_id = get_current_user_id();
3775
-        if (! $skip_route_verify) {
3776
-            $this->_verify_route($route);
3777
-        }
3778
-        // now let's set the string for what kind of transient we're setting
3779
-        $transient = $notices
3780
-            ? 'ee_rte_n_tx_' . $route . '_' . $user_id
3781
-            : 'rte_tx_' . $route . '_' . $user_id;
3782
-        $data = $notices ? array('notices' => $data) : $data;
3783
-        // is there already a transient for this route?  If there is then let's ADD to that transient
3784
-        $existing = is_multisite() && is_network_admin()
3785
-            ? get_site_transient($transient)
3786
-            : get_transient($transient);
3787
-        if ($existing) {
3788
-            $data = array_merge((array) $data, (array) $existing);
3789
-        }
3790
-        if (is_multisite() && is_network_admin()) {
3791
-            set_site_transient($transient, $data, 8);
3792
-        } else {
3793
-            set_transient($transient, $data, 8);
3794
-        }
3795
-    }
3796
-
3797
-
3798
-    /**
3799
-     * this retrieves the temporary transient that has been set for moving data between routes.
3800
-     *
3801
-     * @param bool   $notices true we get notices transient. False we just return normal route transient
3802
-     * @param string $route
3803
-     * @return mixed data
3804
-     */
3805
-    protected function _get_transient($notices = false, $route = '')
3806
-    {
3807
-        $user_id = get_current_user_id();
3808
-        $route = ! $route ? $this->_req_action : $route;
3809
-        $transient = $notices
3810
-            ? 'ee_rte_n_tx_' . $route . '_' . $user_id
3811
-            : 'rte_tx_' . $route . '_' . $user_id;
3812
-        $data = is_multisite() && is_network_admin()
3813
-            ? get_site_transient($transient)
3814
-            : get_transient($transient);
3815
-        // delete transient after retrieval (just in case it hasn't expired);
3816
-        if (is_multisite() && is_network_admin()) {
3817
-            delete_site_transient($transient);
3818
-        } else {
3819
-            delete_transient($transient);
3820
-        }
3821
-        return $notices && isset($data['notices']) ? $data['notices'] : $data;
3822
-    }
3823
-
3824
-
3825
-    /**
3826
-     * The purpose of this method is just to run garbage collection on any EE transients that might have expired but
3827
-     * would not be called later. This will be assigned to run on a specific EE Admin page. (place the method in the
3828
-     * default route callback on the EE_Admin page you want it run.)
3829
-     *
3830
-     * @return void
3831
-     */
3832
-    protected function _transient_garbage_collection()
3833
-    {
3834
-        global $wpdb;
3835
-        // retrieve all existing transients
3836
-        $query = "SELECT option_name FROM {$wpdb->options} WHERE option_name LIKE '%rte_tx_%' OR option_name LIKE '%rte_n_tx_%'";
3837
-        if ($results = $wpdb->get_results($query)) {
3838
-            foreach ($results as $result) {
3839
-                $transient = str_replace('_transient_', '', $result->option_name);
3840
-                get_transient($transient);
3841
-                if (is_multisite() && is_network_admin()) {
3842
-                    get_site_transient($transient);
3843
-                }
3844
-            }
3845
-        }
3846
-    }
3847
-
3848
-
3849
-    /**
3850
-     * get_view
3851
-     *
3852
-     * @return string content of _view property
3853
-     */
3854
-    public function get_view()
3855
-    {
3856
-        return $this->_view;
3857
-    }
3858
-
3859
-
3860
-    /**
3861
-     * getter for the protected $_views property
3862
-     *
3863
-     * @return array
3864
-     */
3865
-    public function get_views()
3866
-    {
3867
-        return $this->_views;
3868
-    }
3869
-
3870
-
3871
-    /**
3872
-     * get_current_page
3873
-     *
3874
-     * @return string _current_page property value
3875
-     */
3876
-    public function get_current_page()
3877
-    {
3878
-        return $this->_current_page;
3879
-    }
3880
-
3881
-
3882
-    /**
3883
-     * get_current_view
3884
-     *
3885
-     * @return string _current_view property value
3886
-     */
3887
-    public function get_current_view()
3888
-    {
3889
-        return $this->_current_view;
3890
-    }
3891
-
3892
-
3893
-    /**
3894
-     * get_current_screen
3895
-     *
3896
-     * @return object The current WP_Screen object
3897
-     */
3898
-    public function get_current_screen()
3899
-    {
3900
-        return $this->_current_screen;
3901
-    }
3902
-
3903
-
3904
-    /**
3905
-     * get_current_page_view_url
3906
-     *
3907
-     * @return string This returns the url for the current_page_view.
3908
-     */
3909
-    public function get_current_page_view_url()
3910
-    {
3911
-        return $this->_current_page_view_url;
3912
-    }
3913
-
3914
-
3915
-    /**
3916
-     * just returns the _req_data property
3917
-     *
3918
-     * @return array
3919
-     */
3920
-    public function get_request_data()
3921
-    {
3922
-        return $this->_req_data;
3923
-    }
3924
-
3925
-
3926
-    /**
3927
-     * returns the _req_data protected property
3928
-     *
3929
-     * @return string
3930
-     */
3931
-    public function get_req_action()
3932
-    {
3933
-        return $this->_req_action;
3934
-    }
3935
-
3936
-
3937
-    /**
3938
-     * @return bool  value of $_is_caf property
3939
-     */
3940
-    public function is_caf()
3941
-    {
3942
-        return $this->_is_caf;
3943
-    }
3944
-
3945
-
3946
-    /**
3947
-     * @return mixed
3948
-     */
3949
-    public function default_espresso_metaboxes()
3950
-    {
3951
-        return $this->_default_espresso_metaboxes;
3952
-    }
3953
-
3954
-
3955
-    /**
3956
-     * @return mixed
3957
-     */
3958
-    public function admin_base_url()
3959
-    {
3960
-        return $this->_admin_base_url;
3961
-    }
3962
-
3963
-
3964
-    /**
3965
-     * @return mixed
3966
-     */
3967
-    public function wp_page_slug()
3968
-    {
3969
-        return $this->_wp_page_slug;
3970
-    }
3971
-
3972
-
3973
-    /**
3974
-     * updates  espresso configuration settings
3975
-     *
3976
-     * @param string                   $tab
3977
-     * @param EE_Config_Base|EE_Config $config
3978
-     * @param string                   $file file where error occurred
3979
-     * @param string                   $func function  where error occurred
3980
-     * @param string                   $line line no where error occurred
3981
-     * @return boolean
3982
-     */
3983
-    protected function _update_espresso_configuration($tab, $config, $file = '', $func = '', $line = '')
3984
-    {
3985
-        // remove any options that are NOT going to be saved with the config settings.
3986
-        if (isset($config->core->ee_ueip_optin)) {
3987
-            // TODO: remove the following two lines and make sure values are migrated from 3.1
3988
-            update_option('ee_ueip_optin', $config->core->ee_ueip_optin);
3989
-            update_option('ee_ueip_has_notified', true);
3990
-        }
3991
-        // and save it (note we're also doing the network save here)
3992
-        $net_saved = is_main_site() ? EE_Network_Config::instance()->update_config(false, false) : true;
3993
-        $config_saved = EE_Config::instance()->update_espresso_config(false, false);
3994
-        if ($config_saved && $net_saved) {
3995
-            EE_Error::add_success(sprintf(__('"%s" have been successfully updated.', 'event_espresso'), $tab));
3996
-            return true;
3997
-        }
3998
-        EE_Error::add_error(sprintf(__('The "%s" were not updated.', 'event_espresso'), $tab), $file, $func, $line);
3999
-        return false;
4000
-    }
4001
-
4002
-
4003
-    /**
4004
-     * Returns an array to be used for EE_FOrm_Fields.helper.php's select_input as the $values argument.
4005
-     *
4006
-     * @return array
4007
-     */
4008
-    public function get_yes_no_values()
4009
-    {
4010
-        return $this->_yes_no_values;
4011
-    }
4012
-
4013
-
4014
-    protected function _get_dir()
4015
-    {
4016
-        $reflector = new ReflectionClass(get_class($this));
4017
-        return dirname($reflector->getFileName());
4018
-    }
4019
-
4020
-
4021
-    /**
4022
-     * A helper for getting a "next link".
4023
-     *
4024
-     * @param string $url   The url to link to
4025
-     * @param string $class The class to use.
4026
-     * @return string
4027
-     */
4028
-    protected function _next_link($url, $class = 'dashicons dashicons-arrow-right')
4029
-    {
4030
-        return '<a class="' . $class . '" href="' . $url . '"></a>';
4031
-    }
4032
-
4033
-
4034
-    /**
4035
-     * A helper for getting a "previous link".
4036
-     *
4037
-     * @param string $url   The url to link to
4038
-     * @param string $class The class to use.
4039
-     * @return string
4040
-     */
4041
-    protected function _previous_link($url, $class = 'dashicons dashicons-arrow-left')
4042
-    {
4043
-        return '<a class="' . $class . '" href="' . $url . '"></a>';
4044
-    }
4045
-
4046
-
4047
-
4048
-
4049
-
4050
-
4051
-
4052
-    // below are some messages related methods that should be available across the EE_Admin system.  Note, these methods are NOT page specific
4053
-
4054
-
4055
-    /**
4056
-     * This processes an request to resend a registration and assumes we have a _REG_ID for doing so. So if the caller
4057
-     * 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
4058
-     * _req_data array.
4059
-     *
4060
-     * @return bool success/fail
4061
-     * @throws EE_Error
4062
-     * @throws InvalidArgumentException
4063
-     * @throws ReflectionException
4064
-     * @throws InvalidDataTypeException
4065
-     * @throws InvalidInterfaceException
4066
-     */
4067
-    protected function _process_resend_registration()
4068
-    {
4069
-        $this->_template_args['success'] = EED_Messages::process_resend($this->_req_data);
4070
-        do_action(
4071
-            'AHEE__EE_Admin_Page___process_resend_registration',
4072
-            $this->_template_args['success'],
4073
-            $this->_req_data
4074
-        );
4075
-        return $this->_template_args['success'];
4076
-    }
4077
-
4078
-
4079
-    /**
4080
-     * This automatically processes any payment message notifications when manual payment has been applied.
4081
-     *
4082
-     * @param \EE_Payment $payment
4083
-     * @return bool success/fail
4084
-     */
4085
-    protected function _process_payment_notification(EE_Payment $payment)
4086
-    {
4087
-        add_filter('FHEE__EE_Payment_Processor__process_registration_payments__display_notifications', '__return_true');
4088
-        do_action('AHEE__EE_Admin_Page___process_admin_payment_notification', $payment);
4089
-        $this->_template_args['success'] = apply_filters(
4090
-            'FHEE__EE_Admin_Page___process_admin_payment_notification__success',
4091
-            false,
4092
-            $payment
4093
-        );
4094
-        return $this->_template_args['success'];
4095
-    }
2697
+	}
2698
+
2699
+
2700
+	/**
2701
+	 * facade for add_meta_box
2702
+	 *
2703
+	 * @param string  $action        where the metabox get's displayed
2704
+	 * @param string  $title         Title of Metabox (output in metabox header)
2705
+	 * @param string  $callback      If not empty and $create_fun is set to false then we'll use a custom callback
2706
+	 *                               instead of the one created in here.
2707
+	 * @param array   $callback_args an array of args supplied for the metabox
2708
+	 * @param string  $column        what metabox column
2709
+	 * @param string  $priority      give this metabox a priority (using accepted priorities for wp meta boxes)
2710
+	 * @param boolean $create_func   default is true.  Basically we can say we don't WANT to have the runtime function
2711
+	 *                               created but just set our own callback for wp's add_meta_box.
2712
+	 * @throws \DomainException
2713
+	 */
2714
+	public function _add_admin_page_meta_box(
2715
+		$action,
2716
+		$title,
2717
+		$callback,
2718
+		$callback_args,
2719
+		$column = 'normal',
2720
+		$priority = 'high',
2721
+		$create_func = true
2722
+	) {
2723
+		do_action('AHEE_log', __FILE__, __FUNCTION__, $callback);
2724
+		// 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.
2725
+		if (empty($callback_args) && $create_func) {
2726
+			$callback_args = array(
2727
+				'template_path' => $this->_template_path,
2728
+				'template_args' => $this->_template_args,
2729
+			);
2730
+		}
2731
+		// 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)
2732
+		$call_back_func = $create_func
2733
+			? function ($post, $metabox) {
2734
+				do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2735
+				echo EEH_Template::display_template(
2736
+					$metabox['args']['template_path'],
2737
+					$metabox['args']['template_args'],
2738
+					true
2739
+				);
2740
+			}
2741
+			: $callback;
2742
+		add_meta_box(
2743
+			str_replace('_', '-', $action) . '-mbox',
2744
+			$title,
2745
+			$call_back_func,
2746
+			$this->_wp_page_slug,
2747
+			$column,
2748
+			$priority,
2749
+			$callback_args
2750
+		);
2751
+	}
2752
+
2753
+
2754
+	/**
2755
+	 * generates HTML wrapper for and admin details page that contains metaboxes in columns
2756
+	 *
2757
+	 * @throws DomainException
2758
+	 * @throws EE_Error
2759
+	 */
2760
+	public function display_admin_page_with_metabox_columns()
2761
+	{
2762
+		$this->_template_args['post_body_content'] = $this->_template_args['admin_page_content'];
2763
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template(
2764
+			$this->_column_template_path,
2765
+			$this->_template_args,
2766
+			true
2767
+		);
2768
+		// the final wrapper
2769
+		$this->admin_page_wrapper();
2770
+	}
2771
+
2772
+
2773
+	/**
2774
+	 * generates  HTML wrapper for an admin details page
2775
+	 *
2776
+	 * @return void
2777
+	 * @throws EE_Error
2778
+	 * @throws DomainException
2779
+	 */
2780
+	public function display_admin_page_with_sidebar()
2781
+	{
2782
+		$this->_display_admin_page(true);
2783
+	}
2784
+
2785
+
2786
+	/**
2787
+	 * generates  HTML wrapper for an admin details page (except no sidebar)
2788
+	 *
2789
+	 * @return void
2790
+	 * @throws EE_Error
2791
+	 * @throws DomainException
2792
+	 */
2793
+	public function display_admin_page_with_no_sidebar()
2794
+	{
2795
+		$this->_display_admin_page();
2796
+	}
2797
+
2798
+
2799
+	/**
2800
+	 * generates HTML wrapper for an EE about admin page (no sidebar)
2801
+	 *
2802
+	 * @return void
2803
+	 * @throws EE_Error
2804
+	 * @throws DomainException
2805
+	 */
2806
+	public function display_about_admin_page()
2807
+	{
2808
+		$this->_display_admin_page(false, true);
2809
+	}
2810
+
2811
+
2812
+	/**
2813
+	 * display_admin_page
2814
+	 * contains the code for actually displaying an admin page
2815
+	 *
2816
+	 * @param  boolean $sidebar true with sidebar, false without
2817
+	 * @param  boolean $about   use the about admin wrapper instead of the default.
2818
+	 * @return void
2819
+	 * @throws DomainException
2820
+	 * @throws EE_Error
2821
+	 */
2822
+	private function _display_admin_page($sidebar = false, $about = false)
2823
+	{
2824
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2825
+		// custom remove metaboxes hook to add or remove any metaboxes to/from Admin pages.
2826
+		do_action('AHEE__EE_Admin_Page___display_admin_page__modify_metaboxes');
2827
+		// set current wp page slug - looks like: event-espresso_page_event_categories
2828
+		// keep in mind "event-espresso" COULD be something else if the top level menu label has been translated.
2829
+		$this->_template_args['current_page'] = $this->_wp_page_slug;
2830
+		$this->_template_args['admin_page_wrapper_div_id'] = $this->_cpt_route
2831
+			? 'poststuff'
2832
+			: 'espresso-default-admin';
2833
+		$template_path = $sidebar
2834
+			? EE_ADMIN_TEMPLATE . 'admin_details_wrapper.template.php'
2835
+			: EE_ADMIN_TEMPLATE . 'admin_details_wrapper_no_sidebar.template.php';
2836
+		if (defined('DOING_AJAX') && DOING_AJAX) {
2837
+			$template_path = EE_ADMIN_TEMPLATE . 'admin_details_wrapper_no_sidebar_ajax.template.php';
2838
+		}
2839
+		$template_path = ! empty($this->_column_template_path)
2840
+			? $this->_column_template_path : $template_path;
2841
+		$this->_template_args['post_body_content'] = isset($this->_template_args['admin_page_content'])
2842
+			? $this->_template_args['admin_page_content']
2843
+			: '';
2844
+		$this->_template_args['before_admin_page_content'] = isset($this->_template_args['before_admin_page_content'])
2845
+			? $this->_template_args['before_admin_page_content']
2846
+			: '';
2847
+		$this->_template_args['after_admin_page_content'] = isset($this->_template_args['after_admin_page_content'])
2848
+			? $this->_template_args['after_admin_page_content']
2849
+			: '';
2850
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template(
2851
+			$template_path,
2852
+			$this->_template_args,
2853
+			true
2854
+		);
2855
+		// the final template wrapper
2856
+		$this->admin_page_wrapper($about);
2857
+	}
2858
+
2859
+
2860
+	/**
2861
+	 * This is used to display caf preview pages.
2862
+	 *
2863
+	 * @since 4.3.2
2864
+	 * @param string $utm_campaign_source what is the key used for google analytics link
2865
+	 * @param bool   $display_sidebar     whether to use the sidebar template or the full template for the page.  TRUE
2866
+	 *                                    = SHOW sidebar, FALSE = no sidebar. Default no sidebar.
2867
+	 * @return void
2868
+	 * @throws DomainException
2869
+	 * @throws EE_Error
2870
+	 * @throws InvalidArgumentException
2871
+	 * @throws InvalidDataTypeException
2872
+	 * @throws InvalidInterfaceException
2873
+	 */
2874
+	public function display_admin_caf_preview_page($utm_campaign_source = '', $display_sidebar = true)
2875
+	{
2876
+		// let's generate a default preview action button if there isn't one already present.
2877
+		$this->_labels['buttons']['buy_now'] = esc_html__(
2878
+			'Upgrade to Event Espresso 4 Right Now',
2879
+			'event_espresso'
2880
+		);
2881
+		$buy_now_url = add_query_arg(
2882
+			array(
2883
+				'ee_ver'       => 'ee4',
2884
+				'utm_source'   => 'ee4_plugin_admin',
2885
+				'utm_medium'   => 'link',
2886
+				'utm_campaign' => $utm_campaign_source,
2887
+				'utm_content'  => 'buy_now_button',
2888
+			),
2889
+			'http://eventespresso.com/pricing/'
2890
+		);
2891
+		$this->_template_args['preview_action_button'] = ! isset($this->_template_args['preview_action_button'])
2892
+			? $this->get_action_link_or_button(
2893
+				'',
2894
+				'buy_now',
2895
+				array(),
2896
+				'button-primary button-large',
2897
+				$buy_now_url,
2898
+				true
2899
+			)
2900
+			: $this->_template_args['preview_action_button'];
2901
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template(
2902
+			EE_ADMIN_TEMPLATE . 'admin_caf_full_page_preview.template.php',
2903
+			$this->_template_args,
2904
+			true
2905
+		);
2906
+		$this->_display_admin_page($display_sidebar);
2907
+	}
2908
+
2909
+
2910
+	/**
2911
+	 * display_admin_list_table_page_with_sidebar
2912
+	 * generates HTML wrapper for an admin_page with list_table
2913
+	 *
2914
+	 * @return void
2915
+	 * @throws EE_Error
2916
+	 * @throws DomainException
2917
+	 */
2918
+	public function display_admin_list_table_page_with_sidebar()
2919
+	{
2920
+		$this->_display_admin_list_table_page(true);
2921
+	}
2922
+
2923
+
2924
+	/**
2925
+	 * display_admin_list_table_page_with_no_sidebar
2926
+	 * generates HTML wrapper for an admin_page with list_table (but with no sidebar)
2927
+	 *
2928
+	 * @return void
2929
+	 * @throws EE_Error
2930
+	 * @throws DomainException
2931
+	 */
2932
+	public function display_admin_list_table_page_with_no_sidebar()
2933
+	{
2934
+		$this->_display_admin_list_table_page();
2935
+	}
2936
+
2937
+
2938
+	/**
2939
+	 * generates html wrapper for an admin_list_table page
2940
+	 *
2941
+	 * @param boolean $sidebar whether to display with sidebar or not.
2942
+	 * @return void
2943
+	 * @throws DomainException
2944
+	 * @throws EE_Error
2945
+	 */
2946
+	private function _display_admin_list_table_page($sidebar = false)
2947
+	{
2948
+		// setup search attributes
2949
+		$this->_set_search_attributes();
2950
+		$this->_template_args['current_page'] = $this->_wp_page_slug;
2951
+		$template_path = EE_ADMIN_TEMPLATE . 'admin_list_wrapper.template.php';
2952
+		$this->_template_args['table_url'] = defined('DOING_AJAX')
2953
+			? add_query_arg(array('noheader' => 'true', 'route' => $this->_req_action), $this->_admin_base_url)
2954
+			: add_query_arg(array('route' => $this->_req_action), $this->_admin_base_url);
2955
+		$this->_template_args['list_table'] = $this->_list_table_object;
2956
+		$this->_template_args['current_route'] = $this->_req_action;
2957
+		$this->_template_args['list_table_class'] = get_class($this->_list_table_object);
2958
+		$ajax_sorting_callback = $this->_list_table_object->get_ajax_sorting_callback();
2959
+		if (! empty($ajax_sorting_callback)) {
2960
+			$sortable_list_table_form_fields = wp_nonce_field(
2961
+				$ajax_sorting_callback . '_nonce',
2962
+				$ajax_sorting_callback . '_nonce',
2963
+				false,
2964
+				false
2965
+			);
2966
+			$sortable_list_table_form_fields .= '<input type="hidden" id="ajax_table_sort_page" name="ajax_table_sort_page" value="'
2967
+												. $this->page_slug
2968
+												. '" />';
2969
+			$sortable_list_table_form_fields .= '<input type="hidden" id="ajax_table_sort_action" name="ajax_table_sort_action" value="'
2970
+												. $ajax_sorting_callback
2971
+												. '" />';
2972
+		} else {
2973
+			$sortable_list_table_form_fields = '';
2974
+		}
2975
+		$this->_template_args['sortable_list_table_form_fields'] = $sortable_list_table_form_fields;
2976
+		$hidden_form_fields = isset($this->_template_args['list_table_hidden_fields'])
2977
+			? $this->_template_args['list_table_hidden_fields']
2978
+			: '';
2979
+		$nonce_ref = $this->_req_action . '_nonce';
2980
+		$hidden_form_fields .= '<input type="hidden" name="'
2981
+							   . $nonce_ref
2982
+							   . '" value="'
2983
+							   . wp_create_nonce($nonce_ref)
2984
+							   . '">';
2985
+		$this->_template_args['list_table_hidden_fields'] = $hidden_form_fields;
2986
+		// display message about search results?
2987
+		$this->_template_args['before_list_table'] .= ! empty($this->_req_data['s'])
2988
+			? '<p class="ee-search-results">' . sprintf(
2989
+				esc_html__('Displaying search results for the search string: %1$s', 'event_espresso'),
2990
+				trim($this->_req_data['s'], '%')
2991
+			) . '</p>'
2992
+			: '';
2993
+		// filter before_list_table template arg
2994
+		$this->_template_args['before_list_table'] = apply_filters(
2995
+			'FHEE__EE_Admin_Page___display_admin_list_table_page__before_list_table__template_arg',
2996
+			$this->_template_args['before_list_table'],
2997
+			$this->page_slug,
2998
+			$this->_req_data,
2999
+			$this->_req_action
3000
+		);
3001
+		// convert to array and filter again
3002
+		// arrays are easier to inject new items in a specific location,
3003
+		// but would not be backwards compatible, so we have to add a new filter
3004
+		$this->_template_args['before_list_table'] = implode(
3005
+			" \n",
3006
+			(array) apply_filters(
3007
+				'FHEE__EE_Admin_Page___display_admin_list_table_page__before_list_table__template_args_array',
3008
+				(array) $this->_template_args['before_list_table'],
3009
+				$this->page_slug,
3010
+				$this->_req_data,
3011
+				$this->_req_action
3012
+			)
3013
+		);
3014
+		// filter after_list_table template arg
3015
+		$this->_template_args['after_list_table'] = apply_filters(
3016
+			'FHEE__EE_Admin_Page___display_admin_list_table_page__after_list_table__template_arg',
3017
+			$this->_template_args['after_list_table'],
3018
+			$this->page_slug,
3019
+			$this->_req_data,
3020
+			$this->_req_action
3021
+		);
3022
+		// convert to array and filter again
3023
+		// arrays are easier to inject new items in a specific location,
3024
+		// but would not be backwards compatible, so we have to add a new filter
3025
+		$this->_template_args['after_list_table'] = implode(
3026
+			" \n",
3027
+			(array) apply_filters(
3028
+				'FHEE__EE_Admin_Page___display_admin_list_table_page__after_list_table__template_args_array',
3029
+				(array) $this->_template_args['after_list_table'],
3030
+				$this->page_slug,
3031
+				$this->_req_data,
3032
+				$this->_req_action
3033
+			)
3034
+		);
3035
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template(
3036
+			$template_path,
3037
+			$this->_template_args,
3038
+			true
3039
+		);
3040
+		// the final template wrapper
3041
+		if ($sidebar) {
3042
+			$this->display_admin_page_with_sidebar();
3043
+		} else {
3044
+			$this->display_admin_page_with_no_sidebar();
3045
+		}
3046
+	}
3047
+
3048
+
3049
+	/**
3050
+	 * This just prepares a legend using the given items and the admin_details_legend.template.php file and returns the
3051
+	 * html string for the legend.
3052
+	 * $items are expected in an array in the following format:
3053
+	 * $legend_items = array(
3054
+	 *        'item_id' => array(
3055
+	 *            'icon' => 'http://url_to_icon_being_described.png',
3056
+	 *            'desc' => esc_html__('localized description of item');
3057
+	 *        )
3058
+	 * );
3059
+	 *
3060
+	 * @param  array $items see above for format of array
3061
+	 * @return string html string of legend
3062
+	 * @throws DomainException
3063
+	 */
3064
+	protected function _display_legend($items)
3065
+	{
3066
+		$this->_template_args['items'] = apply_filters(
3067
+			'FHEE__EE_Admin_Page___display_legend__items',
3068
+			(array) $items,
3069
+			$this
3070
+		);
3071
+		return EEH_Template::display_template(
3072
+			EE_ADMIN_TEMPLATE . 'admin_details_legend.template.php',
3073
+			$this->_template_args,
3074
+			true
3075
+		);
3076
+	}
3077
+
3078
+
3079
+	/**
3080
+	 * This is used whenever we're DOING_AJAX to return a formatted json array that our calling javascript can expect
3081
+	 * The returned json object is created from an array in the following format:
3082
+	 * array(
3083
+	 *  'error' => FALSE, //(default FALSE), contains any errors and/or exceptions (exceptions return json early),
3084
+	 *  'success' => FALSE, //(default FALSE) - contains any special success message.
3085
+	 *  'notices' => '', // - contains any EE_Error formatted notices
3086
+	 *  'content' => 'string can be html', //this is a string of formatted content (can be html)
3087
+	 *  'data' => array() //this can be any key/value pairs that a method returns for later json parsing by the js.
3088
+	 *  We're also going to include the template args with every package (so js can pick out any specific template args
3089
+	 *  that might be included in here)
3090
+	 * )
3091
+	 * The json object is populated by whatever is set in the $_template_args property.
3092
+	 *
3093
+	 * @param bool  $sticky_notices    Used to indicate whether you want to ensure notices are added to a transient
3094
+	 *                                 instead of displayed.
3095
+	 * @param array $notices_arguments Use this to pass any additional args on to the _process_notices.
3096
+	 * @return void
3097
+	 * @throws EE_Error
3098
+	 */
3099
+	protected function _return_json($sticky_notices = false, $notices_arguments = array())
3100
+	{
3101
+		// make sure any EE_Error notices have been handled.
3102
+		$this->_process_notices($notices_arguments, true, $sticky_notices);
3103
+		$data = isset($this->_template_args['data']) ? $this->_template_args['data'] : array();
3104
+		unset($this->_template_args['data']);
3105
+		$json = array(
3106
+			'error'     => isset($this->_template_args['error']) ? $this->_template_args['error'] : false,
3107
+			'success'   => isset($this->_template_args['success']) ? $this->_template_args['success'] : false,
3108
+			'errors'    => isset($this->_template_args['errors']) ? $this->_template_args['errors'] : false,
3109
+			'attention' => isset($this->_template_args['attention']) ? $this->_template_args['attention'] : false,
3110
+			'notices'   => EE_Error::get_notices(),
3111
+			'content'   => isset($this->_template_args['admin_page_content'])
3112
+				? $this->_template_args['admin_page_content'] : '',
3113
+			'data'      => array_merge($data, array('template_args' => $this->_template_args)),
3114
+			'isEEajax'  => true
3115
+			// special flag so any ajax.Success methods in js can identify this return package as a EEajax package.
3116
+		);
3117
+		// make sure there are no php errors or headers_sent.  Then we can set correct json header.
3118
+		if (null === error_get_last() || ! headers_sent()) {
3119
+			header('Content-Type: application/json; charset=UTF-8');
3120
+		}
3121
+		echo wp_json_encode($json);
3122
+		exit();
3123
+	}
3124
+
3125
+
3126
+	/**
3127
+	 * Simply a wrapper for the protected method so we can call this outside the class (ONLY when doing ajax)
3128
+	 *
3129
+	 * @return void
3130
+	 * @throws EE_Error
3131
+	 */
3132
+	public function return_json()
3133
+	{
3134
+		if (defined('DOING_AJAX') && DOING_AJAX) {
3135
+			$this->_return_json();
3136
+		} else {
3137
+			throw new EE_Error(
3138
+				sprintf(
3139
+					esc_html__('The public %s method can only be called when DOING_AJAX = TRUE', 'event_espresso'),
3140
+					__FUNCTION__
3141
+				)
3142
+			);
3143
+		}
3144
+	}
3145
+
3146
+
3147
+	/**
3148
+	 * This provides a way for child hook classes to send along themselves by reference so methods/properties within
3149
+	 * them can be accessed by EE_Admin_child pages. This is assigned to the $_hook_obj property.
3150
+	 *
3151
+	 * @param EE_Admin_Hooks $hook_obj This will be the object for the EE_Admin_Hooks child
3152
+	 */
3153
+	public function set_hook_object(EE_Admin_Hooks $hook_obj)
3154
+	{
3155
+		$this->_hook_obj = $hook_obj;
3156
+	}
3157
+
3158
+
3159
+	/**
3160
+	 *        generates  HTML wrapper with Tabbed nav for an admin page
3161
+	 *
3162
+	 * @param  boolean $about whether to use the special about page wrapper or default.
3163
+	 * @return void
3164
+	 * @throws DomainException
3165
+	 * @throws EE_Error
3166
+	 */
3167
+	public function admin_page_wrapper($about = false)
3168
+	{
3169
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
3170
+		$this->_nav_tabs = $this->_get_main_nav_tabs();
3171
+		$this->_template_args['nav_tabs'] = $this->_nav_tabs;
3172
+		$this->_template_args['admin_page_title'] = $this->_admin_page_title;
3173
+		$this->_template_args['before_admin_page_content'] = apply_filters(
3174
+			"FHEE_before_admin_page_content{$this->_current_page}{$this->_current_view}",
3175
+			isset($this->_template_args['before_admin_page_content'])
3176
+				? $this->_template_args['before_admin_page_content']
3177
+				: ''
3178
+		);
3179
+		$this->_template_args['after_admin_page_content'] = apply_filters(
3180
+			"FHEE_after_admin_page_content{$this->_current_page}{$this->_current_view}",
3181
+			isset($this->_template_args['after_admin_page_content'])
3182
+				? $this->_template_args['after_admin_page_content']
3183
+				: ''
3184
+		);
3185
+		$this->_template_args['after_admin_page_content'] .= $this->_set_help_popup_content();
3186
+		// load settings page wrapper template
3187
+		$template_path = ! defined('DOING_AJAX')
3188
+			? EE_ADMIN_TEMPLATE . 'admin_wrapper.template.php'
3189
+			: EE_ADMIN_TEMPLATE
3190
+			  . 'admin_wrapper_ajax.template.php';
3191
+		// about page?
3192
+		$template_path = $about
3193
+			? EE_ADMIN_TEMPLATE . 'about_admin_wrapper.template.php'
3194
+			: $template_path;
3195
+		if (defined('DOING_AJAX')) {
3196
+			$this->_template_args['admin_page_content'] = EEH_Template::display_template(
3197
+				$template_path,
3198
+				$this->_template_args,
3199
+				true
3200
+			);
3201
+			$this->_return_json();
3202
+		} else {
3203
+			EEH_Template::display_template($template_path, $this->_template_args);
3204
+		}
3205
+	}
3206
+
3207
+
3208
+	/**
3209
+	 * This returns the admin_nav tabs html using the configuration in the _nav_tabs property
3210
+	 *
3211
+	 * @return string html
3212
+	 * @throws EE_Error
3213
+	 */
3214
+	protected function _get_main_nav_tabs()
3215
+	{
3216
+		// let's generate the html using the EEH_Tabbed_Content helper.
3217
+		// We do this here so that it's possible for child classes to add in nav tabs dynamically at the last minute
3218
+		// (rather than setting in the page_routes array)
3219
+		return EEH_Tabbed_Content::display_admin_nav_tabs($this->_nav_tabs);
3220
+	}
3221
+
3222
+
3223
+	/**
3224
+	 *        sort nav tabs
3225
+	 *
3226
+	 * @param $a
3227
+	 * @param $b
3228
+	 * @return int
3229
+	 */
3230
+	private function _sort_nav_tabs($a, $b)
3231
+	{
3232
+		if ($a['order'] === $b['order']) {
3233
+			return 0;
3234
+		}
3235
+		return ($a['order'] < $b['order']) ? -1 : 1;
3236
+	}
3237
+
3238
+
3239
+	/**
3240
+	 *    generates HTML for the forms used on admin pages
3241
+	 *
3242
+	 * @param    array $input_vars - array of input field details
3243
+	 * @param string   $generator  (options are 'string' or 'array', basically use this to indicate which generator to
3244
+	 *                             use)
3245
+	 * @param bool     $id
3246
+	 * @return string
3247
+	 * @uses   EEH_Form_Fields::get_form_fields (/helper/EEH_Form_Fields.helper.php)
3248
+	 * @uses   EEH_Form_Fields::get_form_fields_array (/helper/EEH_Form_Fields.helper.php)
3249
+	 */
3250
+	protected function _generate_admin_form_fields($input_vars = array(), $generator = 'string', $id = false)
3251
+	{
3252
+		$content = $generator === 'string'
3253
+			? EEH_Form_Fields::get_form_fields($input_vars, $id)
3254
+			: EEH_Form_Fields::get_form_fields_array($input_vars);
3255
+		return $content;
3256
+	}
3257
+
3258
+
3259
+	/**
3260
+	 * generates the "Save" and "Save & Close" buttons for edit forms
3261
+	 *
3262
+	 * @param bool             $both     if true then both buttons will be generated.  If false then just the "Save &
3263
+	 *                                   Close" button.
3264
+	 * @param array            $text     if included, generator will use the given text for the buttons ( array([0] =>
3265
+	 *                                   'Save', [1] => 'save & close')
3266
+	 * @param array            $actions  if included allows us to set the actions that each button will carry out (i.e.
3267
+	 *                                   via the "name" value in the button).  We can also use this to just dump
3268
+	 *                                   default actions by submitting some other value.
3269
+	 * @param bool|string|null $referrer if false then we just do the default action on save and close.  Other wise it
3270
+	 *                                   will use the $referrer string. IF null, then we don't do ANYTHING on save and
3271
+	 *                                   close (normal form handling).
3272
+	 */
3273
+	protected function _set_save_buttons($both = true, $text = array(), $actions = array(), $referrer = null)
3274
+	{
3275
+		// make sure $text and $actions are in an array
3276
+		$text = (array) $text;
3277
+		$actions = (array) $actions;
3278
+		$referrer_url = empty($referrer)
3279
+			? '<input type="hidden" id="save_and_close_referrer" name="save_and_close_referrer" value="'
3280
+			  . $_SERVER['REQUEST_URI']
3281
+			  . '" />'
3282
+			: '<input type="hidden" id="save_and_close_referrer" name="save_and_close_referrer" value="'
3283
+			  . $referrer
3284
+			  . '" />';
3285
+		$button_text = ! empty($text)
3286
+			? $text
3287
+			: array(
3288
+				esc_html__('Save', 'event_espresso'),
3289
+				esc_html__('Save and Close', 'event_espresso'),
3290
+			);
3291
+		$default_names = array('save', 'save_and_close');
3292
+		// add in a hidden index for the current page (so save and close redirects properly)
3293
+		$this->_template_args['save_buttons'] = $referrer_url;
3294
+		foreach ($button_text as $key => $button) {
3295
+			$ref = $default_names[ $key ];
3296
+			$this->_template_args['save_buttons'] .= '<input type="submit" class="button-primary '
3297
+													 . $ref
3298
+													 . '" value="'
3299
+													 . $button
3300
+													 . '" name="'
3301
+													 . (! empty($actions) ? $actions[ $key ] : $ref)
3302
+													 . '" id="'
3303
+													 . $this->_current_view . '_' . $ref
3304
+													 . '" />';
3305
+			if (! $both) {
3306
+				break;
3307
+			}
3308
+		}
3309
+	}
3310
+
3311
+
3312
+	/**
3313
+	 * Wrapper for the protected function.  Allows plugins/addons to call this to set the form tags.
3314
+	 *
3315
+	 * @see   $this->_set_add_edit_form_tags() for details on params
3316
+	 * @since 4.6.0
3317
+	 * @param string $route
3318
+	 * @param array  $additional_hidden_fields
3319
+	 */
3320
+	public function set_add_edit_form_tags($route = '', $additional_hidden_fields = array())
3321
+	{
3322
+		$this->_set_add_edit_form_tags($route, $additional_hidden_fields);
3323
+	}
3324
+
3325
+
3326
+	/**
3327
+	 * set form open and close tags on add/edit pages.
3328
+	 *
3329
+	 * @param string $route                    the route you want the form to direct to
3330
+	 * @param array  $additional_hidden_fields any additional hidden fields required in the form header
3331
+	 * @return void
3332
+	 */
3333
+	protected function _set_add_edit_form_tags($route = '', $additional_hidden_fields = array())
3334
+	{
3335
+		if (empty($route)) {
3336
+			$user_msg = esc_html__(
3337
+				'An error occurred. No action was set for this page\'s form.',
3338
+				'event_espresso'
3339
+			);
3340
+			$dev_msg = $user_msg . "\n"
3341
+					   . sprintf(
3342
+						   esc_html__('The $route argument is required for the %s->%s method.', 'event_espresso'),
3343
+						   __FUNCTION__,
3344
+						   __CLASS__
3345
+					   );
3346
+			EE_Error::add_error($user_msg . '||' . $dev_msg, __FILE__, __FUNCTION__, __LINE__);
3347
+		}
3348
+		// open form
3349
+		$this->_template_args['before_admin_page_content'] = '<form name="form" method="post" action="'
3350
+															 . $this->_admin_base_url
3351
+															 . '" id="'
3352
+															 . $route
3353
+															 . '_event_form" >';
3354
+		// add nonce
3355
+		$nonce = wp_nonce_field($route . '_nonce', $route . '_nonce', false, false);
3356
+		$this->_template_args['before_admin_page_content'] .= "\n\t" . $nonce;
3357
+		// add REQUIRED form action
3358
+		$hidden_fields = array(
3359
+			'action' => array('type' => 'hidden', 'value' => $route),
3360
+		);
3361
+		// merge arrays
3362
+		$hidden_fields = is_array($additional_hidden_fields)
3363
+			? array_merge($hidden_fields, $additional_hidden_fields)
3364
+			: $hidden_fields;
3365
+		// generate form fields
3366
+		$form_fields = $this->_generate_admin_form_fields($hidden_fields, 'array');
3367
+		// add fields to form
3368
+		foreach ((array) $form_fields as $field_name => $form_field) {
3369
+			$this->_template_args['before_admin_page_content'] .= "\n\t" . $form_field['field'];
3370
+		}
3371
+		// close form
3372
+		$this->_template_args['after_admin_page_content'] = '</form>';
3373
+	}
3374
+
3375
+
3376
+	/**
3377
+	 * Public Wrapper for _redirect_after_action() method since its
3378
+	 * discovered it would be useful for external code to have access.
3379
+	 *
3380
+	 * @see   EE_Admin_Page::_redirect_after_action() for params.
3381
+	 * @since 4.5.0
3382
+	 * @param bool   $success
3383
+	 * @param string $what
3384
+	 * @param string $action_desc
3385
+	 * @param array  $query_args
3386
+	 * @param bool   $override_overwrite
3387
+	 * @throws EE_Error
3388
+	 */
3389
+	public function redirect_after_action(
3390
+		$success = false,
3391
+		$what = 'item',
3392
+		$action_desc = 'processed',
3393
+		$query_args = array(),
3394
+		$override_overwrite = false
3395
+	) {
3396
+		$this->_redirect_after_action(
3397
+			$success,
3398
+			$what,
3399
+			$action_desc,
3400
+			$query_args,
3401
+			$override_overwrite
3402
+		);
3403
+	}
3404
+
3405
+
3406
+	/**
3407
+	 *    _redirect_after_action
3408
+	 *
3409
+	 * @param int    $success            - whether success was for two or more records, or just one, or none
3410
+	 * @param string $what               - what the action was performed on
3411
+	 * @param string $action_desc        - what was done ie: updated, deleted, etc
3412
+	 * @param array  $query_args         - an array of query_args to be added to the URL to redirect to after the admin
3413
+	 *                                   action is completed
3414
+	 * @param BOOL   $override_overwrite by default all EE_Error::success messages are overwritten, this allows you to
3415
+	 *                                   override this so that they show.
3416
+	 * @return void
3417
+	 * @throws EE_Error
3418
+	 */
3419
+	protected function _redirect_after_action(
3420
+		$success = 0,
3421
+		$what = 'item',
3422
+		$action_desc = 'processed',
3423
+		$query_args = array(),
3424
+		$override_overwrite = false
3425
+	) {
3426
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
3427
+		// class name for actions/filters.
3428
+		$classname = get_class($this);
3429
+		// set redirect url.
3430
+		// Note if there is a "page" index in the $query_args then we go with vanilla admin.php route,
3431
+		// otherwise we go with whatever is set as the _admin_base_url
3432
+		$redirect_url = isset($query_args['page']) ? admin_url('admin.php') : $this->_admin_base_url;
3433
+		$notices = EE_Error::get_notices(false);
3434
+		// overwrite default success messages //BUT ONLY if overwrite not overridden
3435
+		if (! $override_overwrite || ! empty($notices['errors'])) {
3436
+			EE_Error::overwrite_success();
3437
+		}
3438
+		if (! empty($what) && ! empty($action_desc) && empty($notices['errors'])) {
3439
+			// how many records affected ? more than one record ? or just one ?
3440
+			if ($success > 1) {
3441
+				// set plural msg
3442
+				EE_Error::add_success(
3443
+					sprintf(
3444
+						esc_html__('The "%s" have been successfully %s.', 'event_espresso'),
3445
+						$what,
3446
+						$action_desc
3447
+					),
3448
+					__FILE__,
3449
+					__FUNCTION__,
3450
+					__LINE__
3451
+				);
3452
+			} elseif ($success === 1) {
3453
+				// set singular msg
3454
+				EE_Error::add_success(
3455
+					sprintf(
3456
+						esc_html__('The "%s" has been successfully %s.', 'event_espresso'),
3457
+						$what,
3458
+						$action_desc
3459
+					),
3460
+					__FILE__,
3461
+					__FUNCTION__,
3462
+					__LINE__
3463
+				);
3464
+			}
3465
+		}
3466
+		// check that $query_args isn't something crazy
3467
+		if (! is_array($query_args)) {
3468
+			$query_args = array();
3469
+		}
3470
+		/**
3471
+		 * Allow injecting actions before the query_args are modified for possible different
3472
+		 * redirections on save and close actions
3473
+		 *
3474
+		 * @since 4.2.0
3475
+		 * @param array $query_args       The original query_args array coming into the
3476
+		 *                                method.
3477
+		 */
3478
+		do_action(
3479
+			"AHEE__{$classname}___redirect_after_action__before_redirect_modification_{$this->_req_action}",
3480
+			$query_args
3481
+		);
3482
+		// calculate where we're going (if we have a "save and close" button pushed)
3483
+		if (isset($this->_req_data['save_and_close'], $this->_req_data['save_and_close_referrer'])) {
3484
+			// even though we have the save_and_close referrer, we need to parse the url for the action in order to generate a nonce
3485
+			$parsed_url = parse_url($this->_req_data['save_and_close_referrer']);
3486
+			// regenerate query args array from referrer URL
3487
+			parse_str($parsed_url['query'], $query_args);
3488
+			// correct page and action will be in the query args now
3489
+			$redirect_url = admin_url('admin.php');
3490
+		}
3491
+		// merge any default query_args set in _default_route_query_args property
3492
+		if (! empty($this->_default_route_query_args) && ! $this->_is_UI_request) {
3493
+			$args_to_merge = array();
3494
+			foreach ($this->_default_route_query_args as $query_param => $query_value) {
3495
+				// is there a wp_referer array in our _default_route_query_args property?
3496
+				if ($query_param === 'wp_referer') {
3497
+					$query_value = (array) $query_value;
3498
+					foreach ($query_value as $reference => $value) {
3499
+						if (strpos($reference, 'nonce') !== false) {
3500
+							continue;
3501
+						}
3502
+						// finally we will override any arguments in the referer with
3503
+						// what might be set on the _default_route_query_args array.
3504
+						if (isset($this->_default_route_query_args[ $reference ])) {
3505
+							$args_to_merge[ $reference ] = urlencode($this->_default_route_query_args[ $reference ]);
3506
+						} else {
3507
+							$args_to_merge[ $reference ] = urlencode($value);
3508
+						}
3509
+					}
3510
+					continue;
3511
+				}
3512
+				$args_to_merge[ $query_param ] = $query_value;
3513
+			}
3514
+			// now let's merge these arguments but override with what was specifically sent in to the
3515
+			// redirect.
3516
+			$query_args = array_merge($args_to_merge, $query_args);
3517
+		}
3518
+		$this->_process_notices($query_args);
3519
+		// generate redirect url
3520
+		// if redirecting to anything other than the main page, add a nonce
3521
+		if (isset($query_args['action'])) {
3522
+			// manually generate wp_nonce and merge that with the query vars
3523
+			// becuz the wp_nonce_url function wrecks havoc on some vars
3524
+			$query_args['_wpnonce'] = wp_create_nonce($query_args['action'] . '_nonce');
3525
+		}
3526
+		// we're adding some hooks and filters in here for processing any things just before redirects
3527
+		// (example: an admin page has done an insert or update and we want to run something after that).
3528
+		do_action('AHEE_redirect_' . $classname . $this->_req_action, $query_args);
3529
+		$redirect_url = apply_filters(
3530
+			'FHEE_redirect_' . $classname . $this->_req_action,
3531
+			self::add_query_args_and_nonce($query_args, $redirect_url),
3532
+			$query_args
3533
+		);
3534
+		// check if we're doing ajax.  If we are then lets just return the results and js can handle how it wants.
3535
+		if (defined('DOING_AJAX')) {
3536
+			$default_data = array(
3537
+				'close'        => true,
3538
+				'redirect_url' => $redirect_url,
3539
+				'where'        => 'main',
3540
+				'what'         => 'append',
3541
+			);
3542
+			$this->_template_args['success'] = $success;
3543
+			$this->_template_args['data'] = ! empty($this->_template_args['data']) ? array_merge(
3544
+				$default_data,
3545
+				$this->_template_args['data']
3546
+			) : $default_data;
3547
+			$this->_return_json();
3548
+		}
3549
+		wp_safe_redirect($redirect_url);
3550
+		exit();
3551
+	}
3552
+
3553
+
3554
+	/**
3555
+	 * process any notices before redirecting (or returning ajax request)
3556
+	 * This method sets the $this->_template_args['notices'] attribute;
3557
+	 *
3558
+	 * @param  array $query_args        any query args that need to be used for notice transient ('action')
3559
+	 * @param bool   $skip_route_verify This is typically used when we are processing notices REALLY early and
3560
+	 *                                  page_routes haven't been defined yet.
3561
+	 * @param bool   $sticky_notices    This is used to flag that regardless of whether this is doing_ajax or not, we
3562
+	 *                                  still save a transient for the notice.
3563
+	 * @return void
3564
+	 * @throws EE_Error
3565
+	 */
3566
+	protected function _process_notices($query_args = array(), $skip_route_verify = false, $sticky_notices = true)
3567
+	{
3568
+		// first let's set individual error properties if doing_ajax and the properties aren't already set.
3569
+		if (defined('DOING_AJAX') && DOING_AJAX) {
3570
+			$notices = EE_Error::get_notices(false);
3571
+			if (empty($this->_template_args['success'])) {
3572
+				$this->_template_args['success'] = isset($notices['success']) ? $notices['success'] : false;
3573
+			}
3574
+			if (empty($this->_template_args['errors'])) {
3575
+				$this->_template_args['errors'] = isset($notices['errors']) ? $notices['errors'] : false;
3576
+			}
3577
+			if (empty($this->_template_args['attention'])) {
3578
+				$this->_template_args['attention'] = isset($notices['attention']) ? $notices['attention'] : false;
3579
+			}
3580
+		}
3581
+		$this->_template_args['notices'] = EE_Error::get_notices();
3582
+		// IF this isn't ajax we need to create a transient for the notices using the route (however, overridden if $sticky_notices == true)
3583
+		if (! defined('DOING_AJAX') || $sticky_notices) {
3584
+			$route = isset($query_args['action']) ? $query_args['action'] : 'default';
3585
+			$this->_add_transient(
3586
+				$route,
3587
+				$this->_template_args['notices'],
3588
+				true,
3589
+				$skip_route_verify
3590
+			);
3591
+		}
3592
+	}
3593
+
3594
+
3595
+	/**
3596
+	 * get_action_link_or_button
3597
+	 * returns the button html for adding, editing, or deleting an item (depending on given type)
3598
+	 *
3599
+	 * @param string $action        use this to indicate which action the url is generated with.
3600
+	 * @param string $type          accepted strings must be defined in the $_labels['button'] array(as the key)
3601
+	 *                              property.
3602
+	 * @param array  $extra_request if the button requires extra params you can include them in $key=>$value pairs.
3603
+	 * @param string $class         Use this to give the class for the button. Defaults to 'button-primary'
3604
+	 * @param string $base_url      If this is not provided
3605
+	 *                              the _admin_base_url will be used as the default for the button base_url.
3606
+	 *                              Otherwise this value will be used.
3607
+	 * @param bool   $exclude_nonce If true then no nonce will be in the generated button link.
3608
+	 * @return string
3609
+	 * @throws InvalidArgumentException
3610
+	 * @throws InvalidInterfaceException
3611
+	 * @throws InvalidDataTypeException
3612
+	 * @throws EE_Error
3613
+	 */
3614
+	public function get_action_link_or_button(
3615
+		$action,
3616
+		$type = 'add',
3617
+		$extra_request = array(),
3618
+		$class = 'button-primary',
3619
+		$base_url = '',
3620
+		$exclude_nonce = false
3621
+	) {
3622
+		// first let's validate the action (if $base_url is FALSE otherwise validation will happen further along)
3623
+		if (empty($base_url) && ! isset($this->_page_routes[ $action ])) {
3624
+			throw new EE_Error(
3625
+				sprintf(
3626
+					esc_html__(
3627
+						'There is no page route for given action for the button.  This action was given: %s',
3628
+						'event_espresso'
3629
+					),
3630
+					$action
3631
+				)
3632
+			);
3633
+		}
3634
+		if (! isset($this->_labels['buttons'][ $type ])) {
3635
+			throw new EE_Error(
3636
+				sprintf(
3637
+					__(
3638
+						'There is no label for the given button type (%s). Labels are set in the <code>_page_config</code> property.',
3639
+						'event_espresso'
3640
+					),
3641
+					$type
3642
+				)
3643
+			);
3644
+		}
3645
+		// finally check user access for this button.
3646
+		$has_access = $this->check_user_access($action, true);
3647
+		if (! $has_access) {
3648
+			return '';
3649
+		}
3650
+		$_base_url = ! $base_url ? $this->_admin_base_url : $base_url;
3651
+		$query_args = array(
3652
+			'action' => $action,
3653
+		);
3654
+		// merge extra_request args but make sure our original action takes precedence and doesn't get overwritten.
3655
+		if (! empty($extra_request)) {
3656
+			$query_args = array_merge($extra_request, $query_args);
3657
+		}
3658
+		$url = self::add_query_args_and_nonce($query_args, $_base_url, false, $exclude_nonce);
3659
+		return EEH_Template::get_button_or_link($url, $this->_labels['buttons'][ $type ], $class);
3660
+	}
3661
+
3662
+
3663
+	/**
3664
+	 * _per_page_screen_option
3665
+	 * Utility function for adding in a per_page_option in the screen_options_dropdown.
3666
+	 *
3667
+	 * @return void
3668
+	 * @throws InvalidArgumentException
3669
+	 * @throws InvalidInterfaceException
3670
+	 * @throws InvalidDataTypeException
3671
+	 */
3672
+	protected function _per_page_screen_option()
3673
+	{
3674
+		$option = 'per_page';
3675
+		$args = array(
3676
+			'label'   => apply_filters(
3677
+				'FHEE__EE_Admin_Page___per_page_screen_options___label',
3678
+				$this->_admin_page_title,
3679
+				$this
3680
+			),
3681
+			'default' => (int) apply_filters(
3682
+				'FHEE__EE_Admin_Page___per_page_screen_options__default',
3683
+				10
3684
+			),
3685
+			'option'  => $this->_current_page . '_' . $this->_current_view . '_per_page',
3686
+		);
3687
+		// ONLY add the screen option if the user has access to it.
3688
+		if ($this->check_user_access($this->_current_view, true)) {
3689
+			add_screen_option($option, $args);
3690
+		}
3691
+	}
3692
+
3693
+
3694
+	/**
3695
+	 * set_per_page_screen_option
3696
+	 * All this does is make sure that WordPress saves any per_page screen options (if set) for the current page.
3697
+	 * we have to do this rather than running inside the 'set-screen-options' hook because it runs earlier than
3698
+	 * admin_menu.
3699
+	 *
3700
+	 * @return void
3701
+	 */
3702
+	private function _set_per_page_screen_options()
3703
+	{
3704
+		if (isset($_POST['wp_screen_options']) && is_array($_POST['wp_screen_options'])) {
3705
+			check_admin_referer('screen-options-nonce', 'screenoptionnonce');
3706
+			if (! $user = wp_get_current_user()) {
3707
+				return;
3708
+			}
3709
+			$option = $_POST['wp_screen_options']['option'];
3710
+			$value = $_POST['wp_screen_options']['value'];
3711
+			if ($option != sanitize_key($option)) {
3712
+				return;
3713
+			}
3714
+			$map_option = $option;
3715
+			$option = str_replace('-', '_', $option);
3716
+			switch ($map_option) {
3717
+				case $this->_current_page . '_' . $this->_current_view . '_per_page':
3718
+					$value = (int) $value;
3719
+					$max_value = apply_filters(
3720
+						'FHEE__EE_Admin_Page___set_per_page_screen_options__max_value',
3721
+						999,
3722
+						$this->_current_page,
3723
+						$this->_current_view
3724
+					);
3725
+					if ($value < 1) {
3726
+						return;
3727
+					}
3728
+					$value = min($value, $max_value);
3729
+					break;
3730
+				default:
3731
+					$value = apply_filters(
3732
+						'FHEE__EE_Admin_Page___set_per_page_screen_options__value',
3733
+						false,
3734
+						$option,
3735
+						$value
3736
+					);
3737
+					if (false === $value) {
3738
+						return;
3739
+					}
3740
+					break;
3741
+			}
3742
+			update_user_meta($user->ID, $option, $value);
3743
+			wp_safe_redirect(remove_query_arg(array('pagenum', 'apage', 'paged'), wp_get_referer()));
3744
+			exit;
3745
+		}
3746
+	}
3747
+
3748
+
3749
+	/**
3750
+	 * This just allows for setting the $_template_args property if it needs to be set outside the object
3751
+	 *
3752
+	 * @param array $data array that will be assigned to template args.
3753
+	 */
3754
+	public function set_template_args($data)
3755
+	{
3756
+		$this->_template_args = array_merge($this->_template_args, (array) $data);
3757
+	}
3758
+
3759
+
3760
+	/**
3761
+	 * This makes available the WP transient system for temporarily moving data between routes
3762
+	 *
3763
+	 * @param string $route             the route that should receive the transient
3764
+	 * @param array  $data              the data that gets sent
3765
+	 * @param bool   $notices           If this is for notices then we use this to indicate so, otherwise its just a
3766
+	 *                                  normal route transient.
3767
+	 * @param bool   $skip_route_verify Used to indicate we want to skip route verification.  This is usually ONLY used
3768
+	 *                                  when we are adding a transient before page_routes have been defined.
3769
+	 * @return void
3770
+	 * @throws EE_Error
3771
+	 */
3772
+	protected function _add_transient($route, $data, $notices = false, $skip_route_verify = false)
3773
+	{
3774
+		$user_id = get_current_user_id();
3775
+		if (! $skip_route_verify) {
3776
+			$this->_verify_route($route);
3777
+		}
3778
+		// now let's set the string for what kind of transient we're setting
3779
+		$transient = $notices
3780
+			? 'ee_rte_n_tx_' . $route . '_' . $user_id
3781
+			: 'rte_tx_' . $route . '_' . $user_id;
3782
+		$data = $notices ? array('notices' => $data) : $data;
3783
+		// is there already a transient for this route?  If there is then let's ADD to that transient
3784
+		$existing = is_multisite() && is_network_admin()
3785
+			? get_site_transient($transient)
3786
+			: get_transient($transient);
3787
+		if ($existing) {
3788
+			$data = array_merge((array) $data, (array) $existing);
3789
+		}
3790
+		if (is_multisite() && is_network_admin()) {
3791
+			set_site_transient($transient, $data, 8);
3792
+		} else {
3793
+			set_transient($transient, $data, 8);
3794
+		}
3795
+	}
3796
+
3797
+
3798
+	/**
3799
+	 * this retrieves the temporary transient that has been set for moving data between routes.
3800
+	 *
3801
+	 * @param bool   $notices true we get notices transient. False we just return normal route transient
3802
+	 * @param string $route
3803
+	 * @return mixed data
3804
+	 */
3805
+	protected function _get_transient($notices = false, $route = '')
3806
+	{
3807
+		$user_id = get_current_user_id();
3808
+		$route = ! $route ? $this->_req_action : $route;
3809
+		$transient = $notices
3810
+			? 'ee_rte_n_tx_' . $route . '_' . $user_id
3811
+			: 'rte_tx_' . $route . '_' . $user_id;
3812
+		$data = is_multisite() && is_network_admin()
3813
+			? get_site_transient($transient)
3814
+			: get_transient($transient);
3815
+		// delete transient after retrieval (just in case it hasn't expired);
3816
+		if (is_multisite() && is_network_admin()) {
3817
+			delete_site_transient($transient);
3818
+		} else {
3819
+			delete_transient($transient);
3820
+		}
3821
+		return $notices && isset($data['notices']) ? $data['notices'] : $data;
3822
+	}
3823
+
3824
+
3825
+	/**
3826
+	 * The purpose of this method is just to run garbage collection on any EE transients that might have expired but
3827
+	 * would not be called later. This will be assigned to run on a specific EE Admin page. (place the method in the
3828
+	 * default route callback on the EE_Admin page you want it run.)
3829
+	 *
3830
+	 * @return void
3831
+	 */
3832
+	protected function _transient_garbage_collection()
3833
+	{
3834
+		global $wpdb;
3835
+		// retrieve all existing transients
3836
+		$query = "SELECT option_name FROM {$wpdb->options} WHERE option_name LIKE '%rte_tx_%' OR option_name LIKE '%rte_n_tx_%'";
3837
+		if ($results = $wpdb->get_results($query)) {
3838
+			foreach ($results as $result) {
3839
+				$transient = str_replace('_transient_', '', $result->option_name);
3840
+				get_transient($transient);
3841
+				if (is_multisite() && is_network_admin()) {
3842
+					get_site_transient($transient);
3843
+				}
3844
+			}
3845
+		}
3846
+	}
3847
+
3848
+
3849
+	/**
3850
+	 * get_view
3851
+	 *
3852
+	 * @return string content of _view property
3853
+	 */
3854
+	public function get_view()
3855
+	{
3856
+		return $this->_view;
3857
+	}
3858
+
3859
+
3860
+	/**
3861
+	 * getter for the protected $_views property
3862
+	 *
3863
+	 * @return array
3864
+	 */
3865
+	public function get_views()
3866
+	{
3867
+		return $this->_views;
3868
+	}
3869
+
3870
+
3871
+	/**
3872
+	 * get_current_page
3873
+	 *
3874
+	 * @return string _current_page property value
3875
+	 */
3876
+	public function get_current_page()
3877
+	{
3878
+		return $this->_current_page;
3879
+	}
3880
+
3881
+
3882
+	/**
3883
+	 * get_current_view
3884
+	 *
3885
+	 * @return string _current_view property value
3886
+	 */
3887
+	public function get_current_view()
3888
+	{
3889
+		return $this->_current_view;
3890
+	}
3891
+
3892
+
3893
+	/**
3894
+	 * get_current_screen
3895
+	 *
3896
+	 * @return object The current WP_Screen object
3897
+	 */
3898
+	public function get_current_screen()
3899
+	{
3900
+		return $this->_current_screen;
3901
+	}
3902
+
3903
+
3904
+	/**
3905
+	 * get_current_page_view_url
3906
+	 *
3907
+	 * @return string This returns the url for the current_page_view.
3908
+	 */
3909
+	public function get_current_page_view_url()
3910
+	{
3911
+		return $this->_current_page_view_url;
3912
+	}
3913
+
3914
+
3915
+	/**
3916
+	 * just returns the _req_data property
3917
+	 *
3918
+	 * @return array
3919
+	 */
3920
+	public function get_request_data()
3921
+	{
3922
+		return $this->_req_data;
3923
+	}
3924
+
3925
+
3926
+	/**
3927
+	 * returns the _req_data protected property
3928
+	 *
3929
+	 * @return string
3930
+	 */
3931
+	public function get_req_action()
3932
+	{
3933
+		return $this->_req_action;
3934
+	}
3935
+
3936
+
3937
+	/**
3938
+	 * @return bool  value of $_is_caf property
3939
+	 */
3940
+	public function is_caf()
3941
+	{
3942
+		return $this->_is_caf;
3943
+	}
3944
+
3945
+
3946
+	/**
3947
+	 * @return mixed
3948
+	 */
3949
+	public function default_espresso_metaboxes()
3950
+	{
3951
+		return $this->_default_espresso_metaboxes;
3952
+	}
3953
+
3954
+
3955
+	/**
3956
+	 * @return mixed
3957
+	 */
3958
+	public function admin_base_url()
3959
+	{
3960
+		return $this->_admin_base_url;
3961
+	}
3962
+
3963
+
3964
+	/**
3965
+	 * @return mixed
3966
+	 */
3967
+	public function wp_page_slug()
3968
+	{
3969
+		return $this->_wp_page_slug;
3970
+	}
3971
+
3972
+
3973
+	/**
3974
+	 * updates  espresso configuration settings
3975
+	 *
3976
+	 * @param string                   $tab
3977
+	 * @param EE_Config_Base|EE_Config $config
3978
+	 * @param string                   $file file where error occurred
3979
+	 * @param string                   $func function  where error occurred
3980
+	 * @param string                   $line line no where error occurred
3981
+	 * @return boolean
3982
+	 */
3983
+	protected function _update_espresso_configuration($tab, $config, $file = '', $func = '', $line = '')
3984
+	{
3985
+		// remove any options that are NOT going to be saved with the config settings.
3986
+		if (isset($config->core->ee_ueip_optin)) {
3987
+			// TODO: remove the following two lines and make sure values are migrated from 3.1
3988
+			update_option('ee_ueip_optin', $config->core->ee_ueip_optin);
3989
+			update_option('ee_ueip_has_notified', true);
3990
+		}
3991
+		// and save it (note we're also doing the network save here)
3992
+		$net_saved = is_main_site() ? EE_Network_Config::instance()->update_config(false, false) : true;
3993
+		$config_saved = EE_Config::instance()->update_espresso_config(false, false);
3994
+		if ($config_saved && $net_saved) {
3995
+			EE_Error::add_success(sprintf(__('"%s" have been successfully updated.', 'event_espresso'), $tab));
3996
+			return true;
3997
+		}
3998
+		EE_Error::add_error(sprintf(__('The "%s" were not updated.', 'event_espresso'), $tab), $file, $func, $line);
3999
+		return false;
4000
+	}
4001
+
4002
+
4003
+	/**
4004
+	 * Returns an array to be used for EE_FOrm_Fields.helper.php's select_input as the $values argument.
4005
+	 *
4006
+	 * @return array
4007
+	 */
4008
+	public function get_yes_no_values()
4009
+	{
4010
+		return $this->_yes_no_values;
4011
+	}
4012
+
4013
+
4014
+	protected function _get_dir()
4015
+	{
4016
+		$reflector = new ReflectionClass(get_class($this));
4017
+		return dirname($reflector->getFileName());
4018
+	}
4019
+
4020
+
4021
+	/**
4022
+	 * A helper for getting a "next link".
4023
+	 *
4024
+	 * @param string $url   The url to link to
4025
+	 * @param string $class The class to use.
4026
+	 * @return string
4027
+	 */
4028
+	protected function _next_link($url, $class = 'dashicons dashicons-arrow-right')
4029
+	{
4030
+		return '<a class="' . $class . '" href="' . $url . '"></a>';
4031
+	}
4032
+
4033
+
4034
+	/**
4035
+	 * A helper for getting a "previous link".
4036
+	 *
4037
+	 * @param string $url   The url to link to
4038
+	 * @param string $class The class to use.
4039
+	 * @return string
4040
+	 */
4041
+	protected function _previous_link($url, $class = 'dashicons dashicons-arrow-left')
4042
+	{
4043
+		return '<a class="' . $class . '" href="' . $url . '"></a>';
4044
+	}
4045
+
4046
+
4047
+
4048
+
4049
+
4050
+
4051
+
4052
+	// below are some messages related methods that should be available across the EE_Admin system.  Note, these methods are NOT page specific
4053
+
4054
+
4055
+	/**
4056
+	 * This processes an request to resend a registration and assumes we have a _REG_ID for doing so. So if the caller
4057
+	 * 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
4058
+	 * _req_data array.
4059
+	 *
4060
+	 * @return bool success/fail
4061
+	 * @throws EE_Error
4062
+	 * @throws InvalidArgumentException
4063
+	 * @throws ReflectionException
4064
+	 * @throws InvalidDataTypeException
4065
+	 * @throws InvalidInterfaceException
4066
+	 */
4067
+	protected function _process_resend_registration()
4068
+	{
4069
+		$this->_template_args['success'] = EED_Messages::process_resend($this->_req_data);
4070
+		do_action(
4071
+			'AHEE__EE_Admin_Page___process_resend_registration',
4072
+			$this->_template_args['success'],
4073
+			$this->_req_data
4074
+		);
4075
+		return $this->_template_args['success'];
4076
+	}
4077
+
4078
+
4079
+	/**
4080
+	 * This automatically processes any payment message notifications when manual payment has been applied.
4081
+	 *
4082
+	 * @param \EE_Payment $payment
4083
+	 * @return bool success/fail
4084
+	 */
4085
+	protected function _process_payment_notification(EE_Payment $payment)
4086
+	{
4087
+		add_filter('FHEE__EE_Payment_Processor__process_registration_payments__display_notifications', '__return_true');
4088
+		do_action('AHEE__EE_Admin_Page___process_admin_payment_notification', $payment);
4089
+		$this->_template_args['success'] = apply_filters(
4090
+			'FHEE__EE_Admin_Page___process_admin_payment_notification__success',
4091
+			false,
4092
+			$payment
4093
+		);
4094
+		return $this->_template_args['success'];
4095
+	}
4096 4096
 }
Please login to merge, or discard this patch.
Spacing   +183 added lines, -183 removed lines patch added patch discarded remove patch
@@ -494,7 +494,7 @@  discard block
 block discarded – undo
494 494
         );
495 495
         global $ee_menu_slugs;
496 496
         $ee_menu_slugs = (array) $ee_menu_slugs;
497
-        if (! defined('DOING_AJAX') && (! $this->_current_page || ! isset($ee_menu_slugs[ $this->_current_page ]))) {
497
+        if ( ! defined('DOING_AJAX') && ( ! $this->_current_page || ! isset($ee_menu_slugs[$this->_current_page]))) {
498 498
             return;
499 499
         }
500 500
         // 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
@@ -518,7 +518,7 @@  discard block
 block discarded – undo
518 518
             ? $this->_req_data['route']
519 519
             : $this->_req_action;
520 520
         $this->_current_view = $this->_req_action;
521
-        $this->_req_nonce = $this->_req_action . '_nonce';
521
+        $this->_req_nonce = $this->_req_action.'_nonce';
522 522
         $this->_define_page_props();
523 523
         $this->_current_page_view_url = add_query_arg(
524 524
             array('page' => $this->_current_page, 'action' => $this->_current_view),
@@ -552,21 +552,21 @@  discard block
 block discarded – undo
552 552
         }
553 553
         // filter routes and page_config so addons can add their stuff. Filtering done per class
554 554
         $this->_page_routes = apply_filters(
555
-            'FHEE__' . get_class($this) . '__page_setup__page_routes',
555
+            'FHEE__'.get_class($this).'__page_setup__page_routes',
556 556
             $this->_page_routes,
557 557
             $this
558 558
         );
559 559
         $this->_page_config = apply_filters(
560
-            'FHEE__' . get_class($this) . '__page_setup__page_config',
560
+            'FHEE__'.get_class($this).'__page_setup__page_config',
561 561
             $this->_page_config,
562 562
             $this
563 563
         );
564 564
         // if AHEE__EE_Admin_Page__route_admin_request_$this->_current_view method is present
565 565
         // then we call it hooked into the AHEE__EE_Admin_Page__route_admin_request action
566
-        if (method_exists($this, 'AHEE__EE_Admin_Page__route_admin_request_' . $this->_current_view)) {
566
+        if (method_exists($this, 'AHEE__EE_Admin_Page__route_admin_request_'.$this->_current_view)) {
567 567
             add_action(
568 568
                 'AHEE__EE_Admin_Page__route_admin_request',
569
-                array($this, 'AHEE__EE_Admin_Page__route_admin_request_' . $this->_current_view),
569
+                array($this, 'AHEE__EE_Admin_Page__route_admin_request_'.$this->_current_view),
570 570
                 10,
571 571
                 2
572 572
             );
@@ -579,8 +579,8 @@  discard block
 block discarded – undo
579 579
             if ($this->_is_UI_request) {
580 580
                 // admin_init stuff - global, all views for this page class, specific view
581 581
                 add_action('admin_init', array($this, 'admin_init'), 10);
582
-                if (method_exists($this, 'admin_init_' . $this->_current_view)) {
583
-                    add_action('admin_init', array($this, 'admin_init_' . $this->_current_view), 15);
582
+                if (method_exists($this, 'admin_init_'.$this->_current_view)) {
583
+                    add_action('admin_init', array($this, 'admin_init_'.$this->_current_view), 15);
584 584
                 }
585 585
             } else {
586 586
                 // hijack regular WP loading and route admin request immediately
@@ -600,12 +600,12 @@  discard block
 block discarded – undo
600 600
      */
601 601
     private function _do_other_page_hooks()
602 602
     {
603
-        $registered_pages = apply_filters('FHEE_do_other_page_hooks_' . $this->page_slug, array());
603
+        $registered_pages = apply_filters('FHEE_do_other_page_hooks_'.$this->page_slug, array());
604 604
         foreach ($registered_pages as $page) {
605 605
             // now let's setup the file name and class that should be present
606 606
             $classname = str_replace('.class.php', '', $page);
607 607
             // autoloaders should take care of loading file
608
-            if (! class_exists($classname)) {
608
+            if ( ! class_exists($classname)) {
609 609
                 $error_msg[] = sprintf(
610 610
                     esc_html__(
611 611
                         'Something went wrong with loading the %s admin hooks page.',
@@ -622,7 +622,7 @@  discard block
 block discarded – undo
622 622
                                    ),
623 623
                                    $page,
624 624
                                    '<br />',
625
-                                   '<strong>' . $classname . '</strong>'
625
+                                   '<strong>'.$classname.'</strong>'
626 626
                                );
627 627
                 throw new EE_Error(implode('||', $error_msg));
628 628
             }
@@ -662,13 +662,13 @@  discard block
 block discarded – undo
662 662
         // load admin_notices - global, page class, and view specific
663 663
         add_action('admin_notices', array($this, 'admin_notices_global'), 5);
664 664
         add_action('admin_notices', array($this, 'admin_notices'), 10);
665
-        if (method_exists($this, 'admin_notices_' . $this->_current_view)) {
666
-            add_action('admin_notices', array($this, 'admin_notices_' . $this->_current_view), 15);
665
+        if (method_exists($this, 'admin_notices_'.$this->_current_view)) {
666
+            add_action('admin_notices', array($this, 'admin_notices_'.$this->_current_view), 15);
667 667
         }
668 668
         // load network admin_notices - global, page class, and view specific
669 669
         add_action('network_admin_notices', array($this, 'network_admin_notices_global'), 5);
670
-        if (method_exists($this, 'network_admin_notices_' . $this->_current_view)) {
671
-            add_action('network_admin_notices', array($this, 'network_admin_notices_' . $this->_current_view));
670
+        if (method_exists($this, 'network_admin_notices_'.$this->_current_view)) {
671
+            add_action('network_admin_notices', array($this, 'network_admin_notices_'.$this->_current_view));
672 672
         }
673 673
         // this will save any per_page screen options if they are present
674 674
         $this->_set_per_page_screen_options();
@@ -790,7 +790,7 @@  discard block
 block discarded – undo
790 790
     protected function _verify_routes()
791 791
     {
792 792
         do_action('AHEE_log', __FILE__, __FUNCTION__, '');
793
-        if (! $this->_current_page && ! defined('DOING_AJAX')) {
793
+        if ( ! $this->_current_page && ! defined('DOING_AJAX')) {
794 794
             return false;
795 795
         }
796 796
         $this->_route = false;
@@ -802,7 +802,7 @@  discard block
 block discarded – undo
802 802
                 $this->_admin_page_title
803 803
             );
804 804
             // developer error msg
805
-            $error_msg .= '||' . $error_msg
805
+            $error_msg .= '||'.$error_msg
806 806
                           . esc_html__(
807 807
                               ' Make sure the "set_page_routes()" method exists, and is setting the "_page_routes" array properly.',
808 808
                               'event_espresso'
@@ -811,9 +811,9 @@  discard block
 block discarded – undo
811 811
         }
812 812
         // and that the requested page route exists
813 813
         if (array_key_exists($this->_req_action, $this->_page_routes)) {
814
-            $this->_route = $this->_page_routes[ $this->_req_action ];
815
-            $this->_route_config = isset($this->_page_config[ $this->_req_action ])
816
-                ? $this->_page_config[ $this->_req_action ] : array();
814
+            $this->_route = $this->_page_routes[$this->_req_action];
815
+            $this->_route_config = isset($this->_page_config[$this->_req_action])
816
+                ? $this->_page_config[$this->_req_action] : array();
817 817
         } else {
818 818
             // user error msg
819 819
             $error_msg = sprintf(
@@ -824,7 +824,7 @@  discard block
 block discarded – undo
824 824
                 $this->_admin_page_title
825 825
             );
826 826
             // developer error msg
827
-            $error_msg .= '||' . $error_msg
827
+            $error_msg .= '||'.$error_msg
828 828
                           . sprintf(
829 829
                               esc_html__(
830 830
                                   ' Create a key in the "_page_routes" array named "%s" and set its value to the appropriate method.',
@@ -835,7 +835,7 @@  discard block
 block discarded – undo
835 835
             throw new EE_Error($error_msg);
836 836
         }
837 837
         // and that a default route exists
838
-        if (! array_key_exists('default', $this->_page_routes)) {
838
+        if ( ! array_key_exists('default', $this->_page_routes)) {
839 839
             // user error msg
840 840
             $error_msg = sprintf(
841 841
                 esc_html__(
@@ -845,7 +845,7 @@  discard block
 block discarded – undo
845 845
                 $this->_admin_page_title
846 846
             );
847 847
             // developer error msg
848
-            $error_msg .= '||' . $error_msg
848
+            $error_msg .= '||'.$error_msg
849 849
                           . esc_html__(
850 850
                               ' Create a key in the "_page_routes" array named "default" and set its value to your default page method.',
851 851
                               'event_espresso'
@@ -884,7 +884,7 @@  discard block
 block discarded – undo
884 884
             $this->_admin_page_title
885 885
         );
886 886
         // developer error msg
887
-        $error_msg .= '||' . $error_msg
887
+        $error_msg .= '||'.$error_msg
888 888
                       . sprintf(
889 889
                           esc_html__(
890 890
                               ' Check the route you are using in your method (%s) and make sure it matches a route set in your "_page_routes" array property',
@@ -909,7 +909,7 @@  discard block
 block discarded – undo
909 909
     protected function _verify_nonce($nonce, $nonce_ref)
910 910
     {
911 911
         // verify nonce against expected value
912
-        if (! wp_verify_nonce($nonce, $nonce_ref)) {
912
+        if ( ! wp_verify_nonce($nonce, $nonce_ref)) {
913 913
             // these are not the droids you are looking for !!!
914 914
             $msg = sprintf(
915 915
                 esc_html__('%sNonce Fail.%s', 'event_espresso'),
@@ -926,7 +926,7 @@  discard block
 block discarded – undo
926 926
                             __CLASS__
927 927
                         );
928 928
             }
929
-            if (! defined('DOING_AJAX')) {
929
+            if ( ! defined('DOING_AJAX')) {
930 930
                 wp_die($msg);
931 931
             } else {
932 932
                 EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
@@ -951,7 +951,7 @@  discard block
 block discarded – undo
951 951
      */
952 952
     protected function _route_admin_request()
953 953
     {
954
-        if (! $this->_is_UI_request) {
954
+        if ( ! $this->_is_UI_request) {
955 955
             $this->_verify_routes();
956 956
         }
957 957
         $nonce_check = isset($this->_route_config['require_nonce'])
@@ -959,8 +959,8 @@  discard block
 block discarded – undo
959 959
             : true;
960 960
         if ($this->_req_action !== 'default' && $nonce_check) {
961 961
             // set nonce from post data
962
-            $nonce = isset($this->_req_data[ $this->_req_nonce ])
963
-                ? sanitize_text_field($this->_req_data[ $this->_req_nonce ])
962
+            $nonce = isset($this->_req_data[$this->_req_nonce])
963
+                ? sanitize_text_field($this->_req_data[$this->_req_nonce])
964 964
                 : '';
965 965
             $this->_verify_nonce($nonce, $this->_req_nonce);
966 966
         }
@@ -975,7 +975,7 @@  discard block
 block discarded – undo
975 975
         $error_msg = '';
976 976
         // action right before calling route
977 977
         // (hook is something like 'AHEE__Registrations_Admin_Page__route_admin_request')
978
-        if (! did_action('AHEE__EE_Admin_Page__route_admin_request')) {
978
+        if ( ! did_action('AHEE__EE_Admin_Page__route_admin_request')) {
979 979
             do_action('AHEE__EE_Admin_Page__route_admin_request', $this->_current_view, $this);
980 980
         }
981 981
         // right before calling the route, let's remove _wp_http_referer from the
@@ -984,7 +984,7 @@  discard block
 block discarded – undo
984 984
             '_wp_http_referer',
985 985
             wp_unslash($_SERVER['REQUEST_URI'])
986 986
         );
987
-        if (! empty($func)) {
987
+        if ( ! empty($func)) {
988 988
             if (is_array($func)) {
989 989
                 list($class, $method) = $func;
990 990
             } elseif (strpos($func, '::') !== false) {
@@ -993,7 +993,7 @@  discard block
 block discarded – undo
993 993
                 $class = $this;
994 994
                 $method = $func;
995 995
             }
996
-            if (! (is_object($class) && $class === $this)) {
996
+            if ( ! (is_object($class) && $class === $this)) {
997 997
                 // send along this admin page object for access by addons.
998 998
                 $args['admin_page_object'] = $this;
999 999
             }
@@ -1033,7 +1033,7 @@  discard block
 block discarded – undo
1033 1033
                     $method
1034 1034
                 );
1035 1035
             }
1036
-            if (! empty($error_msg)) {
1036
+            if ( ! empty($error_msg)) {
1037 1037
                 throw new EE_Error($error_msg);
1038 1038
             }
1039 1039
         }
@@ -1117,7 +1117,7 @@  discard block
 block discarded – undo
1117 1117
                 if (strpos($key, 'nonce') !== false) {
1118 1118
                     continue;
1119 1119
                 }
1120
-                $args[ 'wp_referer[' . $key . ']' ] = $value;
1120
+                $args['wp_referer['.$key.']'] = $value;
1121 1121
             }
1122 1122
         }
1123 1123
         return EEH_URL::add_query_args_and_nonce($args, $url, $exclude_nonce);
@@ -1157,10 +1157,10 @@  discard block
 block discarded – undo
1157 1157
     protected function _add_help_tabs()
1158 1158
     {
1159 1159
         $tour_buttons = '';
1160
-        if (isset($this->_page_config[ $this->_req_action ])) {
1161
-            $config = $this->_page_config[ $this->_req_action ];
1160
+        if (isset($this->_page_config[$this->_req_action])) {
1161
+            $config = $this->_page_config[$this->_req_action];
1162 1162
             // is there a help tour for the current route?  if there is let's setup the tour buttons
1163
-            if (isset($this->_help_tour[ $this->_req_action ])) {
1163
+            if (isset($this->_help_tour[$this->_req_action])) {
1164 1164
                 $tb = array();
1165 1165
                 $tour_buttons = '<div class="ee-abs-container"><div class="ee-help-tour-restart-buttons">';
1166 1166
                 foreach ($this->_help_tour['tours'] as $tour) {
@@ -1180,7 +1180,7 @@  discard block
 block discarded – undo
1180 1180
             // let's see if there is a help_sidebar set for the current route and we'll set that up for usage as well.
1181 1181
             if (is_array($config) && isset($config['help_sidebar'])) {
1182 1182
                 // check that the callback given is valid
1183
-                if (! method_exists($this, $config['help_sidebar'])) {
1183
+                if ( ! method_exists($this, $config['help_sidebar'])) {
1184 1184
                     throw new EE_Error(
1185 1185
                         sprintf(
1186 1186
                             esc_html__(
@@ -1193,7 +1193,7 @@  discard block
 block discarded – undo
1193 1193
                     );
1194 1194
                 }
1195 1195
                 $content = apply_filters(
1196
-                    'FHEE__' . get_class($this) . '__add_help_tabs__help_sidebar',
1196
+                    'FHEE__'.get_class($this).'__add_help_tabs__help_sidebar',
1197 1197
                     $this->{$config['help_sidebar']}()
1198 1198
                 );
1199 1199
                 $content .= $tour_buttons; // add help tour buttons.
@@ -1201,27 +1201,27 @@  discard block
 block discarded – undo
1201 1201
                 $this->_current_screen->set_help_sidebar($content);
1202 1202
             }
1203 1203
             // if we DON'T have config help sidebar and there ARE tour buttons then we'll just add the tour buttons to the sidebar.
1204
-            if (! isset($config['help_sidebar']) && ! empty($tour_buttons)) {
1204
+            if ( ! isset($config['help_sidebar']) && ! empty($tour_buttons)) {
1205 1205
                 $this->_current_screen->set_help_sidebar($tour_buttons);
1206 1206
             }
1207 1207
             // handle if no help_tabs are set so the sidebar will still show for the help tour buttons
1208
-            if (! isset($config['help_tabs']) && ! empty($tour_buttons)) {
1208
+            if ( ! isset($config['help_tabs']) && ! empty($tour_buttons)) {
1209 1209
                 $_ht['id'] = $this->page_slug;
1210 1210
                 $_ht['title'] = esc_html__('Help Tours', 'event_espresso');
1211 1211
                 $_ht['content'] = '<p>'
1212 1212
                                   . esc_html__(
1213 1213
                                       'The buttons to the right allow you to start/restart any help tours available for this page',
1214 1214
                                       'event_espresso'
1215
-                                  ) . '</p>';
1215
+                                  ).'</p>';
1216 1216
                 $this->_current_screen->add_help_tab($_ht);
1217 1217
             }
1218
-            if (! isset($config['help_tabs'])) {
1218
+            if ( ! isset($config['help_tabs'])) {
1219 1219
                 return;
1220 1220
             } //no help tabs for this route
1221 1221
             foreach ((array) $config['help_tabs'] as $tab_id => $cfg) {
1222 1222
                 // we're here so there ARE help tabs!
1223 1223
                 // make sure we've got what we need
1224
-                if (! isset($cfg['title'])) {
1224
+                if ( ! isset($cfg['title'])) {
1225 1225
                     throw new EE_Error(
1226 1226
                         esc_html__(
1227 1227
                             'The _page_config array is not set up properly for help tabs.  It is missing a title',
@@ -1229,7 +1229,7 @@  discard block
 block discarded – undo
1229 1229
                         )
1230 1230
                     );
1231 1231
                 }
1232
-                if (! isset($cfg['filename']) && ! isset($cfg['callback']) && ! isset($cfg['content'])) {
1232
+                if ( ! isset($cfg['filename']) && ! isset($cfg['callback']) && ! isset($cfg['content'])) {
1233 1233
                     throw new EE_Error(
1234 1234
                         esc_html__(
1235 1235
                             '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',
@@ -1238,11 +1238,11 @@  discard block
 block discarded – undo
1238 1238
                     );
1239 1239
                 }
1240 1240
                 // first priority goes to content.
1241
-                if (! empty($cfg['content'])) {
1241
+                if ( ! empty($cfg['content'])) {
1242 1242
                     $content = ! empty($cfg['content']) ? $cfg['content'] : null;
1243 1243
                     // second priority goes to filename
1244
-                } elseif (! empty($cfg['filename'])) {
1245
-                    $file_path = $this->_get_dir() . '/help_tabs/' . $cfg['filename'] . '.help_tab.php';
1244
+                } elseif ( ! empty($cfg['filename'])) {
1245
+                    $file_path = $this->_get_dir().'/help_tabs/'.$cfg['filename'].'.help_tab.php';
1246 1246
                     // 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)
1247 1247
                     $file_path = ! is_readable($file_path) ? EE_ADMIN_PAGES
1248 1248
                                                              . basename($this->_get_dir())
@@ -1250,7 +1250,7 @@  discard block
 block discarded – undo
1250 1250
                                                              . $cfg['filename']
1251 1251
                                                              . '.help_tab.php' : $file_path;
1252 1252
                     // if file is STILL not readable then let's do a EE_Error so its more graceful than a fatal error.
1253
-                    if (! isset($cfg['callback']) && ! is_readable($file_path)) {
1253
+                    if ( ! isset($cfg['callback']) && ! is_readable($file_path)) {
1254 1254
                         EE_Error::add_error(
1255 1255
                             sprintf(
1256 1256
                                 esc_html__(
@@ -1296,7 +1296,7 @@  discard block
 block discarded – undo
1296 1296
                     return;
1297 1297
                 }
1298 1298
                 // setup config array for help tab method
1299
-                $id = $this->page_slug . '-' . $this->_req_action . '-' . $tab_id;
1299
+                $id = $this->page_slug.'-'.$this->_req_action.'-'.$tab_id;
1300 1300
                 $_ht = array(
1301 1301
                     'id'       => $id,
1302 1302
                     'title'    => $cfg['title'],
@@ -1340,7 +1340,7 @@  discard block
 block discarded – undo
1340 1340
             }
1341 1341
             if (isset($config['help_tour'])) {
1342 1342
                 foreach ($config['help_tour'] as $tour) {
1343
-                    $file_path = $this->_get_dir() . '/help_tours/' . $tour . '.class.php';
1343
+                    $file_path = $this->_get_dir().'/help_tours/'.$tour.'.class.php';
1344 1344
                     // let's see if we can get that file...
1345 1345
                     // if not its possible this is a decaf route not set in caffeinated
1346 1346
                     // so lets try and get the caffeinated equivalent
@@ -1350,7 +1350,7 @@  discard block
 block discarded – undo
1350 1350
                                                              . $tour
1351 1351
                                                              . '.class.php' : $file_path;
1352 1352
                     // if file is STILL not readable then let's do a EE_Error so its more graceful than a fatal error.
1353
-                    if (! is_readable($file_path)) {
1353
+                    if ( ! is_readable($file_path)) {
1354 1354
                         EE_Error::add_error(
1355 1355
                             sprintf(
1356 1356
                                 esc_html__(
@@ -1367,12 +1367,12 @@  discard block
 block discarded – undo
1367 1367
                         return;
1368 1368
                     }
1369 1369
                     require_once $file_path;
1370
-                    if (! class_exists($tour)) {
1370
+                    if ( ! class_exists($tour)) {
1371 1371
                         $error_msg[] = sprintf(
1372 1372
                             esc_html__('Something went wrong with loading the %s Help Tour Class.', 'event_espresso'),
1373 1373
                             $tour
1374 1374
                         );
1375
-                        $error_msg[] = $error_msg[0] . "\r\n"
1375
+                        $error_msg[] = $error_msg[0]."\r\n"
1376 1376
                                        . sprintf(
1377 1377
                                            esc_html__(
1378 1378
                                                '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.',
@@ -1388,15 +1388,15 @@  discard block
 block discarded – undo
1388 1388
                     }
1389 1389
                     $tour_obj = new $tour($this->_is_caf);
1390 1390
                     $tours[] = $tour_obj;
1391
-                    $this->_help_tour[ $route ][] = EEH_Template::help_tour_stops_generator($tour_obj);
1391
+                    $this->_help_tour[$route][] = EEH_Template::help_tour_stops_generator($tour_obj);
1392 1392
                 }
1393 1393
                 // let's inject the end tour stop element common to all pages... this will only get seen once per machine.
1394 1394
                 $end_stop_tour = new EE_Help_Tour_final_stop($this->_is_caf);
1395 1395
                 $tours[] = $end_stop_tour;
1396
-                $this->_help_tour[ $route ][] = EEH_Template::help_tour_stops_generator($end_stop_tour);
1396
+                $this->_help_tour[$route][] = EEH_Template::help_tour_stops_generator($end_stop_tour);
1397 1397
             }
1398 1398
         }
1399
-        if (! empty($tours)) {
1399
+        if ( ! empty($tours)) {
1400 1400
             $this->_help_tour['tours'] = $tours;
1401 1401
         }
1402 1402
         // that's it!  Now that the $_help_tours property is set (or not)
@@ -1415,8 +1415,8 @@  discard block
 block discarded – undo
1415 1415
             $qtips = (array) $this->_route_config['qtips'];
1416 1416
             // load qtip loader
1417 1417
             $path = array(
1418
-                $this->_get_dir() . '/qtips/',
1419
-                EE_ADMIN_PAGES . basename($this->_get_dir()) . '/qtips/',
1418
+                $this->_get_dir().'/qtips/',
1419
+                EE_ADMIN_PAGES.basename($this->_get_dir()).'/qtips/',
1420 1420
             );
1421 1421
             EEH_Qtip_Loader::instance()->register($qtips, $path);
1422 1422
         }
@@ -1438,7 +1438,7 @@  discard block
 block discarded – undo
1438 1438
         do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1439 1439
         $i = 0;
1440 1440
         foreach ($this->_page_config as $slug => $config) {
1441
-            if (! is_array($config)
1441
+            if ( ! is_array($config)
1442 1442
                 || (
1443 1443
                     is_array($config)
1444 1444
                     && (
@@ -1455,12 +1455,12 @@  discard block
 block discarded – undo
1455 1455
                 // nav tab is only to appear when route requested.
1456 1456
                 continue;
1457 1457
             }
1458
-            if (! $this->check_user_access($slug, true)) {
1458
+            if ( ! $this->check_user_access($slug, true)) {
1459 1459
                 // no nav tab because current user does not have access.
1460 1460
                 continue;
1461 1461
             }
1462
-            $css_class = isset($config['css_class']) ? $config['css_class'] . ' ' : '';
1463
-            $this->_nav_tabs[ $slug ] = array(
1462
+            $css_class = isset($config['css_class']) ? $config['css_class'].' ' : '';
1463
+            $this->_nav_tabs[$slug] = array(
1464 1464
                 'url'       => isset($config['nav']['url'])
1465 1465
                     ? $config['nav']['url']
1466 1466
                     : self::add_query_args_and_nonce(
@@ -1472,14 +1472,14 @@  discard block
 block discarded – undo
1472 1472
                     : ucwords(
1473 1473
                         str_replace('_', ' ', $slug)
1474 1474
                     ),
1475
-                'css_class' => $this->_req_action === $slug ? $css_class . 'nav-tab-active' : $css_class,
1475
+                'css_class' => $this->_req_action === $slug ? $css_class.'nav-tab-active' : $css_class,
1476 1476
                 'order'     => isset($config['nav']['order']) ? $config['nav']['order'] : $i,
1477 1477
             );
1478 1478
             $i++;
1479 1479
         }
1480 1480
         // if $this->_nav_tabs is empty then lets set the default
1481 1481
         if (empty($this->_nav_tabs)) {
1482
-            $this->_nav_tabs[ $this->_default_nav_tab_name ] = array(
1482
+            $this->_nav_tabs[$this->_default_nav_tab_name] = array(
1483 1483
                 'url'       => $this->_admin_base_url,
1484 1484
                 'link_text' => ucwords(str_replace('_', ' ', $this->_default_nav_tab_name)),
1485 1485
                 'css_class' => 'nav-tab-active',
@@ -1504,10 +1504,10 @@  discard block
 block discarded – undo
1504 1504
             foreach ($this->_route_config['labels'] as $label => $text) {
1505 1505
                 if (is_array($text)) {
1506 1506
                     foreach ($text as $sublabel => $subtext) {
1507
-                        $this->_labels[ $label ][ $sublabel ] = $subtext;
1507
+                        $this->_labels[$label][$sublabel] = $subtext;
1508 1508
                     }
1509 1509
                 } else {
1510
-                    $this->_labels[ $label ] = $text;
1510
+                    $this->_labels[$label] = $text;
1511 1511
                 }
1512 1512
             }
1513 1513
         }
@@ -1529,12 +1529,12 @@  discard block
 block discarded – undo
1529 1529
     {
1530 1530
         do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1531 1531
         $route_to_check = empty($route_to_check) ? $this->_req_action : $route_to_check;
1532
-        $capability = ! empty($route_to_check) && isset($this->_page_routes[ $route_to_check ])
1532
+        $capability = ! empty($route_to_check) && isset($this->_page_routes[$route_to_check])
1533 1533
                       && is_array(
1534
-                          $this->_page_routes[ $route_to_check ]
1534
+                          $this->_page_routes[$route_to_check]
1535 1535
                       )
1536
-                      && ! empty($this->_page_routes[ $route_to_check ]['capability'])
1537
-            ? $this->_page_routes[ $route_to_check ]['capability'] : null;
1536
+                      && ! empty($this->_page_routes[$route_to_check]['capability'])
1537
+            ? $this->_page_routes[$route_to_check]['capability'] : null;
1538 1538
         if (empty($capability) && empty($route_to_check)) {
1539 1539
             $capability = is_array($this->_route) && empty($this->_route['capability']) ? 'manage_options'
1540 1540
                 : $this->_route['capability'];
@@ -1542,7 +1542,7 @@  discard block
 block discarded – undo
1542 1542
             $capability = empty($capability) ? 'manage_options' : $capability;
1543 1543
         }
1544 1544
         $id = is_array($this->_route) && ! empty($this->_route['obj_id']) ? $this->_route['obj_id'] : 0;
1545
-        if (! defined('DOING_AJAX')
1545
+        if ( ! defined('DOING_AJAX')
1546 1546
             && (
1547 1547
                 ! function_exists('is_admin')
1548 1548
                 || ! EE_Registry::instance()->CAP->current_user_can(
@@ -1645,17 +1645,17 @@  discard block
 block discarded – undo
1645 1645
     public function admin_footer_global()
1646 1646
     {
1647 1647
         // dialog container for dialog helper
1648
-        $d_cont = '<div class="ee-admin-dialog-container auto-hide hidden">' . "\n";
1648
+        $d_cont = '<div class="ee-admin-dialog-container auto-hide hidden">'."\n";
1649 1649
         $d_cont .= '<div class="ee-notices"></div>';
1650 1650
         $d_cont .= '<div class="ee-admin-dialog-container-inner-content"></div>';
1651 1651
         $d_cont .= '</div>';
1652 1652
         echo $d_cont;
1653 1653
         // help tour stuff?
1654
-        if (isset($this->_help_tour[ $this->_req_action ])) {
1655
-            echo implode('<br />', $this->_help_tour[ $this->_req_action ]);
1654
+        if (isset($this->_help_tour[$this->_req_action])) {
1655
+            echo implode('<br />', $this->_help_tour[$this->_req_action]);
1656 1656
         }
1657 1657
         // current set timezone for timezone js
1658
-        echo '<span id="current_timezone" class="hidden">' . EEH_DTT_Helper::get_timezone() . '</span>';
1658
+        echo '<span id="current_timezone" class="hidden">'.EEH_DTT_Helper::get_timezone().'</span>';
1659 1659
     }
1660 1660
 
1661 1661
 
@@ -1689,7 +1689,7 @@  discard block
 block discarded – undo
1689 1689
         // loop through the array and setup content
1690 1690
         foreach ($help_array as $trigger => $help) {
1691 1691
             // make sure the array is setup properly
1692
-            if (! isset($help['title']) || ! isset($help['content'])) {
1692
+            if ( ! isset($help['title']) || ! isset($help['content'])) {
1693 1693
                 throw new EE_Error(
1694 1694
                     esc_html__(
1695 1695
                         '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',
@@ -1704,7 +1704,7 @@  discard block
 block discarded – undo
1704 1704
                 'help_popup_content' => $help['content'],
1705 1705
             );
1706 1706
             $content .= EEH_Template::display_template(
1707
-                EE_ADMIN_TEMPLATE . 'admin_help_popup.template.php',
1707
+                EE_ADMIN_TEMPLATE.'admin_help_popup.template.php',
1708 1708
                 $template_args,
1709 1709
                 true
1710 1710
             );
@@ -1726,15 +1726,15 @@  discard block
 block discarded – undo
1726 1726
     private function _get_help_content()
1727 1727
     {
1728 1728
         // what is the method we're looking for?
1729
-        $method_name = '_help_popup_content_' . $this->_req_action;
1729
+        $method_name = '_help_popup_content_'.$this->_req_action;
1730 1730
         // if method doesn't exist let's get out.
1731
-        if (! method_exists($this, $method_name)) {
1731
+        if ( ! method_exists($this, $method_name)) {
1732 1732
             return array();
1733 1733
         }
1734 1734
         // k we're good to go let's retrieve the help array
1735 1735
         $help_array = call_user_func(array($this, $method_name));
1736 1736
         // make sure we've got an array!
1737
-        if (! is_array($help_array)) {
1737
+        if ( ! is_array($help_array)) {
1738 1738
             throw new EE_Error(
1739 1739
                 esc_html__(
1740 1740
                     'Something went wrong with help popup content generation. Expecting an array and well, this ain\'t no array bub.',
@@ -1766,8 +1766,8 @@  discard block
 block discarded – undo
1766 1766
         // 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
1767 1767
         $help_array = $this->_get_help_content();
1768 1768
         $help_content = '';
1769
-        if (empty($help_array) || ! isset($help_array[ $trigger_id ])) {
1770
-            $help_array[ $trigger_id ] = array(
1769
+        if (empty($help_array) || ! isset($help_array[$trigger_id])) {
1770
+            $help_array[$trigger_id] = array(
1771 1771
                 'title'   => esc_html__('Missing Content', 'event_espresso'),
1772 1772
                 'content' => esc_html__(
1773 1773
                     '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.)',
@@ -1843,15 +1843,15 @@  discard block
 block discarded – undo
1843 1843
         // register all styles
1844 1844
         wp_register_style(
1845 1845
             'espresso-ui-theme',
1846
-            EE_GLOBAL_ASSETS_URL . 'css/espresso-ui-theme/jquery-ui-1.10.3.custom.min.css',
1846
+            EE_GLOBAL_ASSETS_URL.'css/espresso-ui-theme/jquery-ui-1.10.3.custom.min.css',
1847 1847
             array(),
1848 1848
             EVENT_ESPRESSO_VERSION
1849 1849
         );
1850
-        wp_register_style('ee-admin-css', EE_ADMIN_URL . 'assets/ee-admin-page.css', array(), EVENT_ESPRESSO_VERSION);
1850
+        wp_register_style('ee-admin-css', EE_ADMIN_URL.'assets/ee-admin-page.css', array(), EVENT_ESPRESSO_VERSION);
1851 1851
         // helpers styles
1852 1852
         wp_register_style(
1853 1853
             'ee-text-links',
1854
-            EE_PLUGIN_DIR_URL . 'core/helpers/assets/ee_text_list_helper.css',
1854
+            EE_PLUGIN_DIR_URL.'core/helpers/assets/ee_text_list_helper.css',
1855 1855
             array(),
1856 1856
             EVENT_ESPRESSO_VERSION
1857 1857
         );
@@ -1859,21 +1859,21 @@  discard block
 block discarded – undo
1859 1859
         // register all scripts
1860 1860
         wp_register_script(
1861 1861
             'ee-dialog',
1862
-            EE_ADMIN_URL . 'assets/ee-dialog-helper.js',
1862
+            EE_ADMIN_URL.'assets/ee-dialog-helper.js',
1863 1863
             array('jquery', 'jquery-ui-draggable'),
1864 1864
             EVENT_ESPRESSO_VERSION,
1865 1865
             true
1866 1866
         );
1867 1867
         wp_register_script(
1868 1868
             'ee_admin_js',
1869
-            EE_ADMIN_URL . 'assets/ee-admin-page.js',
1869
+            EE_ADMIN_URL.'assets/ee-admin-page.js',
1870 1870
             array('espresso_core', 'ee-parse-uri', 'ee-dialog'),
1871 1871
             EVENT_ESPRESSO_VERSION,
1872 1872
             true
1873 1873
         );
1874 1874
         wp_register_script(
1875 1875
             'jquery-ui-timepicker-addon',
1876
-            EE_GLOBAL_ASSETS_URL . 'scripts/jquery-ui-timepicker-addon.js',
1876
+            EE_GLOBAL_ASSETS_URL.'scripts/jquery-ui-timepicker-addon.js',
1877 1877
             array('jquery-ui-datepicker', 'jquery-ui-slider'),
1878 1878
             EVENT_ESPRESSO_VERSION,
1879 1879
             true
@@ -1882,7 +1882,7 @@  discard block
 block discarded – undo
1882 1882
         // script for sorting tables
1883 1883
         wp_register_script(
1884 1884
             'espresso_ajax_table_sorting',
1885
-            EE_ADMIN_URL . 'assets/espresso_ajax_table_sorting.js',
1885
+            EE_ADMIN_URL.'assets/espresso_ajax_table_sorting.js',
1886 1886
             array('ee_admin_js', 'jquery-ui-sortable'),
1887 1887
             EVENT_ESPRESSO_VERSION,
1888 1888
             true
@@ -1890,7 +1890,7 @@  discard block
 block discarded – undo
1890 1890
         // script for parsing uri's
1891 1891
         wp_register_script(
1892 1892
             'ee-parse-uri',
1893
-            EE_GLOBAL_ASSETS_URL . 'scripts/parseuri.js',
1893
+            EE_GLOBAL_ASSETS_URL.'scripts/parseuri.js',
1894 1894
             array(),
1895 1895
             EVENT_ESPRESSO_VERSION,
1896 1896
             true
@@ -1898,7 +1898,7 @@  discard block
 block discarded – undo
1898 1898
         // and parsing associative serialized form elements
1899 1899
         wp_register_script(
1900 1900
             'ee-serialize-full-array',
1901
-            EE_GLOBAL_ASSETS_URL . 'scripts/jquery.serializefullarray.js',
1901
+            EE_GLOBAL_ASSETS_URL.'scripts/jquery.serializefullarray.js',
1902 1902
             array('jquery'),
1903 1903
             EVENT_ESPRESSO_VERSION,
1904 1904
             true
@@ -1906,28 +1906,28 @@  discard block
 block discarded – undo
1906 1906
         // helpers scripts
1907 1907
         wp_register_script(
1908 1908
             'ee-text-links',
1909
-            EE_PLUGIN_DIR_URL . 'core/helpers/assets/ee_text_list_helper.js',
1909
+            EE_PLUGIN_DIR_URL.'core/helpers/assets/ee_text_list_helper.js',
1910 1910
             array('jquery'),
1911 1911
             EVENT_ESPRESSO_VERSION,
1912 1912
             true
1913 1913
         );
1914 1914
         wp_register_script(
1915 1915
             'ee-moment-core',
1916
-            EE_THIRD_PARTY_URL . 'moment/moment-with-locales.min.js',
1916
+            EE_THIRD_PARTY_URL.'moment/moment-with-locales.min.js',
1917 1917
             array(),
1918 1918
             EVENT_ESPRESSO_VERSION,
1919 1919
             true
1920 1920
         );
1921 1921
         wp_register_script(
1922 1922
             'ee-moment',
1923
-            EE_THIRD_PARTY_URL . 'moment/moment-timezone-with-data.min.js',
1923
+            EE_THIRD_PARTY_URL.'moment/moment-timezone-with-data.min.js',
1924 1924
             array('ee-moment-core'),
1925 1925
             EVENT_ESPRESSO_VERSION,
1926 1926
             true
1927 1927
         );
1928 1928
         wp_register_script(
1929 1929
             'ee-datepicker',
1930
-            EE_ADMIN_URL . 'assets/ee-datepicker.js',
1930
+            EE_ADMIN_URL.'assets/ee-datepicker.js',
1931 1931
             array('jquery-ui-timepicker-addon', 'ee-moment'),
1932 1932
             EVENT_ESPRESSO_VERSION,
1933 1933
             true
@@ -1961,11 +1961,11 @@  discard block
 block discarded – undo
1961 1961
         /**
1962 1962
          * help tour stuff
1963 1963
          */
1964
-        if (! empty($this->_help_tour)) {
1964
+        if ( ! empty($this->_help_tour)) {
1965 1965
             // register the js for kicking things off
1966 1966
             wp_enqueue_script(
1967 1967
                 'ee-help-tour',
1968
-                EE_ADMIN_URL . 'assets/ee-help-tour.js',
1968
+                EE_ADMIN_URL.'assets/ee-help-tour.js',
1969 1969
                 array('jquery-joyride'),
1970 1970
                 EVENT_ESPRESSO_VERSION,
1971 1971
                 true
@@ -2062,12 +2062,12 @@  discard block
 block discarded – undo
2062 2062
     protected function _set_list_table()
2063 2063
     {
2064 2064
         // first is this a list_table view?
2065
-        if (! isset($this->_route_config['list_table'])) {
2065
+        if ( ! isset($this->_route_config['list_table'])) {
2066 2066
             return;
2067 2067
         } //not a list_table view so get out.
2068 2068
         // list table functions are per view specific (because some admin pages might have more than one list table!)
2069
-        $list_table_view = '_set_list_table_views_' . $this->_req_action;
2070
-        if (! method_exists($this, $list_table_view) || $this->{$list_table_view}() === false) {
2069
+        $list_table_view = '_set_list_table_views_'.$this->_req_action;
2070
+        if ( ! method_exists($this, $list_table_view) || $this->{$list_table_view}() === false) {
2071 2071
             // user error msg
2072 2072
             $error_msg = esc_html__(
2073 2073
                 'An error occurred. The requested list table views could not be found.',
@@ -2087,10 +2087,10 @@  discard block
 block discarded – undo
2087 2087
         }
2088 2088
         // let's provide the ability to filter the views per PAGE AND ROUTE, per PAGE, and globally
2089 2089
         $this->_views = apply_filters(
2090
-            'FHEE_list_table_views_' . $this->page_slug . '_' . $this->_req_action,
2090
+            'FHEE_list_table_views_'.$this->page_slug.'_'.$this->_req_action,
2091 2091
             $this->_views
2092 2092
         );
2093
-        $this->_views = apply_filters('FHEE_list_table_views_' . $this->page_slug, $this->_views);
2093
+        $this->_views = apply_filters('FHEE_list_table_views_'.$this->page_slug, $this->_views);
2094 2094
         $this->_views = apply_filters('FHEE_list_table_views', $this->_views);
2095 2095
         $this->_set_list_table_view();
2096 2096
         $this->_set_list_table_object();
@@ -2106,7 +2106,7 @@  discard block
 block discarded – undo
2106 2106
     {
2107 2107
         do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2108 2108
         // looking at active items or dumpster diving ?
2109
-        if (! isset($this->_req_data['status']) || ! array_key_exists($this->_req_data['status'], $this->_views)) {
2109
+        if ( ! isset($this->_req_data['status']) || ! array_key_exists($this->_req_data['status'], $this->_views)) {
2110 2110
             $this->_view = isset($this->_views['in_use']) ? 'in_use' : 'all';
2111 2111
         } else {
2112 2112
             $this->_view = sanitize_key($this->_req_data['status']);
@@ -2127,7 +2127,7 @@  discard block
 block discarded – undo
2127 2127
     protected function _set_list_table_object()
2128 2128
     {
2129 2129
         if (isset($this->_route_config['list_table'])) {
2130
-            if (! class_exists($this->_route_config['list_table'])) {
2130
+            if ( ! class_exists($this->_route_config['list_table'])) {
2131 2131
                 throw new EE_Error(
2132 2132
                     sprintf(
2133 2133
                         esc_html__(
@@ -2165,15 +2165,15 @@  discard block
 block discarded – undo
2165 2165
         foreach ($this->_views as $key => $view) {
2166 2166
             $query_args = array();
2167 2167
             // check for current view
2168
-            $this->_views[ $key ]['class'] = $this->_view === $view['slug'] ? 'current' : '';
2168
+            $this->_views[$key]['class'] = $this->_view === $view['slug'] ? 'current' : '';
2169 2169
             $query_args['action'] = $this->_req_action;
2170
-            $query_args[ $this->_req_action . '_nonce' ] = wp_create_nonce($query_args['action'] . '_nonce');
2170
+            $query_args[$this->_req_action.'_nonce'] = wp_create_nonce($query_args['action'].'_nonce');
2171 2171
             $query_args['status'] = $view['slug'];
2172 2172
             // merge any other arguments sent in.
2173
-            if (isset($extra_query_args[ $view['slug'] ])) {
2174
-                $query_args = array_merge($query_args, $extra_query_args[ $view['slug'] ]);
2173
+            if (isset($extra_query_args[$view['slug']])) {
2174
+                $query_args = array_merge($query_args, $extra_query_args[$view['slug']]);
2175 2175
             }
2176
-            $this->_views[ $key ]['url'] = EE_Admin_Page::add_query_args_and_nonce($query_args, $this->_admin_base_url);
2176
+            $this->_views[$key]['url'] = EE_Admin_Page::add_query_args_and_nonce($query_args, $this->_admin_base_url);
2177 2177
         }
2178 2178
         return $this->_views;
2179 2179
     }
@@ -2192,7 +2192,7 @@  discard block
 block discarded – undo
2192 2192
     {
2193 2193
         do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2194 2194
         $values = array(10, 25, 50, 100);
2195
-        $per_page = (! empty($this->_req_data['per_page'])) ? absint($this->_req_data['per_page']) : 10;
2195
+        $per_page = ( ! empty($this->_req_data['per_page'])) ? absint($this->_req_data['per_page']) : 10;
2196 2196
         if ($max_entries) {
2197 2197
             $values[] = $max_entries;
2198 2198
             sort($values);
@@ -2204,14 +2204,14 @@  discard block
 block discarded – undo
2204 2204
 					<select id="entries-per-page-slct" name="entries-per-page-slct">';
2205 2205
         foreach ($values as $value) {
2206 2206
             if ($value < $max_entries) {
2207
-                $selected = $value === $per_page ? ' selected="' . $per_page . '"' : '';
2207
+                $selected = $value === $per_page ? ' selected="'.$per_page.'"' : '';
2208 2208
                 $entries_per_page_dropdown .= '
2209
-						<option value="' . $value . '"' . $selected . '>' . $value . '&nbsp;&nbsp;</option>';
2209
+						<option value="' . $value.'"'.$selected.'>'.$value.'&nbsp;&nbsp;</option>';
2210 2210
             }
2211 2211
         }
2212
-        $selected = $max_entries === $per_page ? ' selected="' . $per_page . '"' : '';
2212
+        $selected = $max_entries === $per_page ? ' selected="'.$per_page.'"' : '';
2213 2213
         $entries_per_page_dropdown .= '
2214
-						<option value="' . $max_entries . '"' . $selected . '>All&nbsp;&nbsp;</option>';
2214
+						<option value="' . $max_entries.'"'.$selected.'>All&nbsp;&nbsp;</option>';
2215 2215
         $entries_per_page_dropdown .= '
2216 2216
 					</select>
2217 2217
 					entries
@@ -2235,7 +2235,7 @@  discard block
 block discarded – undo
2235 2235
             empty($this->_search_btn_label) ? $this->page_label
2236 2236
                 : $this->_search_btn_label
2237 2237
         );
2238
-        $this->_template_args['search']['callback'] = 'search_' . $this->page_slug;
2238
+        $this->_template_args['search']['callback'] = 'search_'.$this->page_slug;
2239 2239
     }
2240 2240
 
2241 2241
 
@@ -2321,7 +2321,7 @@  discard block
 block discarded – undo
2321 2321
             $total_columns = ! empty($screen_columns)
2322 2322
                 ? $screen_columns
2323 2323
                 : $this->_route_config['columns'][1];
2324
-            $this->_template_args['current_screen_widget_class'] = 'columns-' . $total_columns;
2324
+            $this->_template_args['current_screen_widget_class'] = 'columns-'.$total_columns;
2325 2325
             $this->_template_args['current_page'] = $this->_wp_page_slug;
2326 2326
             $this->_template_args['screen'] = $this->_current_screen;
2327 2327
             $this->_column_template_path = EE_ADMIN_TEMPLATE
@@ -2366,7 +2366,7 @@  discard block
 block discarded – undo
2366 2366
      */
2367 2367
     protected function _espresso_ratings_request()
2368 2368
     {
2369
-        if (! apply_filters('FHEE_show_ratings_request_meta_box', true)) {
2369
+        if ( ! apply_filters('FHEE_show_ratings_request_meta_box', true)) {
2370 2370
             return;
2371 2371
         }
2372 2372
         $ratings_box_title = apply_filters(
@@ -2394,7 +2394,7 @@  discard block
 block discarded – undo
2394 2394
     public function espresso_ratings_request()
2395 2395
     {
2396 2396
         EEH_Template::display_template(
2397
-            EE_ADMIN_TEMPLATE . 'espresso_ratings_request_content.template.php',
2397
+            EE_ADMIN_TEMPLATE.'espresso_ratings_request_content.template.php',
2398 2398
             array()
2399 2399
         );
2400 2400
     }
@@ -2407,17 +2407,17 @@  discard block
 block discarded – undo
2407 2407
                    . '</p><p class="hide-if-js">'
2408 2408
                    . esc_html__('This widget requires JavaScript.', 'event_espresso')
2409 2409
                    . '</p>';
2410
-        $pre = '<div class="espresso-rss-display">' . "\n\t";
2411
-        $pre .= '<span id="' . $rss_id . '_url" class="hidden">' . $url . '</span>';
2412
-        $post = '</div>' . "\n";
2413
-        $cache_key = 'ee_rss_' . md5($rss_id);
2410
+        $pre = '<div class="espresso-rss-display">'."\n\t";
2411
+        $pre .= '<span id="'.$rss_id.'_url" class="hidden">'.$url.'</span>';
2412
+        $post = '</div>'."\n";
2413
+        $cache_key = 'ee_rss_'.md5($rss_id);
2414 2414
         $output = get_transient($cache_key);
2415 2415
         if ($output !== false) {
2416
-            echo $pre . $output . $post;
2416
+            echo $pre.$output.$post;
2417 2417
             return true;
2418 2418
         }
2419
-        if (! (defined('DOING_AJAX') && DOING_AJAX)) {
2420
-            echo $pre . $loading . $post;
2419
+        if ( ! (defined('DOING_AJAX') && DOING_AJAX)) {
2420
+            echo $pre.$loading.$post;
2421 2421
             return false;
2422 2422
         }
2423 2423
         ob_start();
@@ -2484,19 +2484,19 @@  discard block
 block discarded – undo
2484 2484
     public function espresso_sponsors_post_box()
2485 2485
     {
2486 2486
         EEH_Template::display_template(
2487
-            EE_ADMIN_TEMPLATE . 'admin_general_metabox_contents_espresso_sponsors.template.php'
2487
+            EE_ADMIN_TEMPLATE.'admin_general_metabox_contents_espresso_sponsors.template.php'
2488 2488
         );
2489 2489
     }
2490 2490
 
2491 2491
 
2492 2492
     private function _publish_post_box()
2493 2493
     {
2494
-        $meta_box_ref = 'espresso_' . $this->page_slug . '_editor_overview';
2494
+        $meta_box_ref = 'espresso_'.$this->page_slug.'_editor_overview';
2495 2495
         // if there is a array('label' => array('publishbox' => 'some title') ) present in the _page_config array
2496 2496
         // then we'll use that for the metabox label.
2497 2497
         // Otherwise we'll just use publish (publishbox itself could be an array of labels indexed by routes)
2498
-        if (! empty($this->_labels['publishbox'])) {
2499
-            $box_label = is_array($this->_labels['publishbox']) ? $this->_labels['publishbox'][ $this->_req_action ]
2498
+        if ( ! empty($this->_labels['publishbox'])) {
2499
+            $box_label = is_array($this->_labels['publishbox']) ? $this->_labels['publishbox'][$this->_req_action]
2500 2500
                 : $this->_labels['publishbox'];
2501 2501
         } else {
2502 2502
             $box_label = esc_html__('Publish', 'event_espresso');
@@ -2525,7 +2525,7 @@  discard block
 block discarded – undo
2525 2525
             ? $this->_template_args['publish_box_extra_content']
2526 2526
             : '';
2527 2527
         echo EEH_Template::display_template(
2528
-            EE_ADMIN_TEMPLATE . 'admin_details_publish_metabox.template.php',
2528
+            EE_ADMIN_TEMPLATE.'admin_details_publish_metabox.template.php',
2529 2529
             $this->_template_args,
2530 2530
             true
2531 2531
         );
@@ -2617,8 +2617,8 @@  discard block
 block discarded – undo
2617 2617
             );
2618 2618
         }
2619 2619
         $this->_template_args['publish_delete_link'] = ! empty($id) ? $delete : '';
2620
-        if (! empty($name) && ! empty($id)) {
2621
-            $hidden_field_arr[ $name ] = array(
2620
+        if ( ! empty($name) && ! empty($id)) {
2621
+            $hidden_field_arr[$name] = array(
2622 2622
                 'type'  => 'hidden',
2623 2623
                 'value' => $id,
2624 2624
             );
@@ -2628,7 +2628,7 @@  discard block
 block discarded – undo
2628 2628
         }
2629 2629
         // add hidden field
2630 2630
         $this->_template_args['publish_hidden_fields'] = is_array($hf) && ! empty($name)
2631
-            ? $hf[ $name ]['field']
2631
+            ? $hf[$name]['field']
2632 2632
             : $hf;
2633 2633
     }
2634 2634
 
@@ -2730,7 +2730,7 @@  discard block
 block discarded – undo
2730 2730
         }
2731 2731
         // 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)
2732 2732
         $call_back_func = $create_func
2733
-            ? function ($post, $metabox) {
2733
+            ? function($post, $metabox) {
2734 2734
                 do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2735 2735
                 echo EEH_Template::display_template(
2736 2736
                     $metabox['args']['template_path'],
@@ -2740,7 +2740,7 @@  discard block
 block discarded – undo
2740 2740
             }
2741 2741
             : $callback;
2742 2742
         add_meta_box(
2743
-            str_replace('_', '-', $action) . '-mbox',
2743
+            str_replace('_', '-', $action).'-mbox',
2744 2744
             $title,
2745 2745
             $call_back_func,
2746 2746
             $this->_wp_page_slug,
@@ -2832,9 +2832,9 @@  discard block
 block discarded – undo
2832 2832
             : 'espresso-default-admin';
2833 2833
         $template_path = $sidebar
2834 2834
             ? EE_ADMIN_TEMPLATE . 'admin_details_wrapper.template.php'
2835
-            : EE_ADMIN_TEMPLATE . 'admin_details_wrapper_no_sidebar.template.php';
2835
+            : EE_ADMIN_TEMPLATE.'admin_details_wrapper_no_sidebar.template.php';
2836 2836
         if (defined('DOING_AJAX') && DOING_AJAX) {
2837
-            $template_path = EE_ADMIN_TEMPLATE . 'admin_details_wrapper_no_sidebar_ajax.template.php';
2837
+            $template_path = EE_ADMIN_TEMPLATE.'admin_details_wrapper_no_sidebar_ajax.template.php';
2838 2838
         }
2839 2839
         $template_path = ! empty($this->_column_template_path)
2840 2840
             ? $this->_column_template_path : $template_path;
@@ -2899,7 +2899,7 @@  discard block
 block discarded – undo
2899 2899
             )
2900 2900
             : $this->_template_args['preview_action_button'];
2901 2901
         $this->_template_args['admin_page_content'] = EEH_Template::display_template(
2902
-            EE_ADMIN_TEMPLATE . 'admin_caf_full_page_preview.template.php',
2902
+            EE_ADMIN_TEMPLATE.'admin_caf_full_page_preview.template.php',
2903 2903
             $this->_template_args,
2904 2904
             true
2905 2905
         );
@@ -2948,7 +2948,7 @@  discard block
 block discarded – undo
2948 2948
         // setup search attributes
2949 2949
         $this->_set_search_attributes();
2950 2950
         $this->_template_args['current_page'] = $this->_wp_page_slug;
2951
-        $template_path = EE_ADMIN_TEMPLATE . 'admin_list_wrapper.template.php';
2951
+        $template_path = EE_ADMIN_TEMPLATE.'admin_list_wrapper.template.php';
2952 2952
         $this->_template_args['table_url'] = defined('DOING_AJAX')
2953 2953
             ? add_query_arg(array('noheader' => 'true', 'route' => $this->_req_action), $this->_admin_base_url)
2954 2954
             : add_query_arg(array('route' => $this->_req_action), $this->_admin_base_url);
@@ -2956,10 +2956,10 @@  discard block
 block discarded – undo
2956 2956
         $this->_template_args['current_route'] = $this->_req_action;
2957 2957
         $this->_template_args['list_table_class'] = get_class($this->_list_table_object);
2958 2958
         $ajax_sorting_callback = $this->_list_table_object->get_ajax_sorting_callback();
2959
-        if (! empty($ajax_sorting_callback)) {
2959
+        if ( ! empty($ajax_sorting_callback)) {
2960 2960
             $sortable_list_table_form_fields = wp_nonce_field(
2961
-                $ajax_sorting_callback . '_nonce',
2962
-                $ajax_sorting_callback . '_nonce',
2961
+                $ajax_sorting_callback.'_nonce',
2962
+                $ajax_sorting_callback.'_nonce',
2963 2963
                 false,
2964 2964
                 false
2965 2965
             );
@@ -2976,7 +2976,7 @@  discard block
 block discarded – undo
2976 2976
         $hidden_form_fields = isset($this->_template_args['list_table_hidden_fields'])
2977 2977
             ? $this->_template_args['list_table_hidden_fields']
2978 2978
             : '';
2979
-        $nonce_ref = $this->_req_action . '_nonce';
2979
+        $nonce_ref = $this->_req_action.'_nonce';
2980 2980
         $hidden_form_fields .= '<input type="hidden" name="'
2981 2981
                                . $nonce_ref
2982 2982
                                . '" value="'
@@ -2985,10 +2985,10 @@  discard block
 block discarded – undo
2985 2985
         $this->_template_args['list_table_hidden_fields'] = $hidden_form_fields;
2986 2986
         // display message about search results?
2987 2987
         $this->_template_args['before_list_table'] .= ! empty($this->_req_data['s'])
2988
-            ? '<p class="ee-search-results">' . sprintf(
2988
+            ? '<p class="ee-search-results">'.sprintf(
2989 2989
                 esc_html__('Displaying search results for the search string: %1$s', 'event_espresso'),
2990 2990
                 trim($this->_req_data['s'], '%')
2991
-            ) . '</p>'
2991
+            ).'</p>'
2992 2992
             : '';
2993 2993
         // filter before_list_table template arg
2994 2994
         $this->_template_args['before_list_table'] = apply_filters(
@@ -3069,7 +3069,7 @@  discard block
 block discarded – undo
3069 3069
             $this
3070 3070
         );
3071 3071
         return EEH_Template::display_template(
3072
-            EE_ADMIN_TEMPLATE . 'admin_details_legend.template.php',
3072
+            EE_ADMIN_TEMPLATE.'admin_details_legend.template.php',
3073 3073
             $this->_template_args,
3074 3074
             true
3075 3075
         );
@@ -3292,17 +3292,17 @@  discard block
 block discarded – undo
3292 3292
         // add in a hidden index for the current page (so save and close redirects properly)
3293 3293
         $this->_template_args['save_buttons'] = $referrer_url;
3294 3294
         foreach ($button_text as $key => $button) {
3295
-            $ref = $default_names[ $key ];
3295
+            $ref = $default_names[$key];
3296 3296
             $this->_template_args['save_buttons'] .= '<input type="submit" class="button-primary '
3297 3297
                                                      . $ref
3298 3298
                                                      . '" value="'
3299 3299
                                                      . $button
3300 3300
                                                      . '" name="'
3301
-                                                     . (! empty($actions) ? $actions[ $key ] : $ref)
3301
+                                                     . ( ! empty($actions) ? $actions[$key] : $ref)
3302 3302
                                                      . '" id="'
3303
-                                                     . $this->_current_view . '_' . $ref
3303
+                                                     . $this->_current_view.'_'.$ref
3304 3304
                                                      . '" />';
3305
-            if (! $both) {
3305
+            if ( ! $both) {
3306 3306
                 break;
3307 3307
             }
3308 3308
         }
@@ -3337,13 +3337,13 @@  discard block
 block discarded – undo
3337 3337
                 'An error occurred. No action was set for this page\'s form.',
3338 3338
                 'event_espresso'
3339 3339
             );
3340
-            $dev_msg = $user_msg . "\n"
3340
+            $dev_msg = $user_msg."\n"
3341 3341
                        . sprintf(
3342 3342
                            esc_html__('The $route argument is required for the %s->%s method.', 'event_espresso'),
3343 3343
                            __FUNCTION__,
3344 3344
                            __CLASS__
3345 3345
                        );
3346
-            EE_Error::add_error($user_msg . '||' . $dev_msg, __FILE__, __FUNCTION__, __LINE__);
3346
+            EE_Error::add_error($user_msg.'||'.$dev_msg, __FILE__, __FUNCTION__, __LINE__);
3347 3347
         }
3348 3348
         // open form
3349 3349
         $this->_template_args['before_admin_page_content'] = '<form name="form" method="post" action="'
@@ -3352,8 +3352,8 @@  discard block
 block discarded – undo
3352 3352
                                                              . $route
3353 3353
                                                              . '_event_form" >';
3354 3354
         // add nonce
3355
-        $nonce = wp_nonce_field($route . '_nonce', $route . '_nonce', false, false);
3356
-        $this->_template_args['before_admin_page_content'] .= "\n\t" . $nonce;
3355
+        $nonce = wp_nonce_field($route.'_nonce', $route.'_nonce', false, false);
3356
+        $this->_template_args['before_admin_page_content'] .= "\n\t".$nonce;
3357 3357
         // add REQUIRED form action
3358 3358
         $hidden_fields = array(
3359 3359
             'action' => array('type' => 'hidden', 'value' => $route),
@@ -3366,7 +3366,7 @@  discard block
 block discarded – undo
3366 3366
         $form_fields = $this->_generate_admin_form_fields($hidden_fields, 'array');
3367 3367
         // add fields to form
3368 3368
         foreach ((array) $form_fields as $field_name => $form_field) {
3369
-            $this->_template_args['before_admin_page_content'] .= "\n\t" . $form_field['field'];
3369
+            $this->_template_args['before_admin_page_content'] .= "\n\t".$form_field['field'];
3370 3370
         }
3371 3371
         // close form
3372 3372
         $this->_template_args['after_admin_page_content'] = '</form>';
@@ -3432,10 +3432,10 @@  discard block
 block discarded – undo
3432 3432
         $redirect_url = isset($query_args['page']) ? admin_url('admin.php') : $this->_admin_base_url;
3433 3433
         $notices = EE_Error::get_notices(false);
3434 3434
         // overwrite default success messages //BUT ONLY if overwrite not overridden
3435
-        if (! $override_overwrite || ! empty($notices['errors'])) {
3435
+        if ( ! $override_overwrite || ! empty($notices['errors'])) {
3436 3436
             EE_Error::overwrite_success();
3437 3437
         }
3438
-        if (! empty($what) && ! empty($action_desc) && empty($notices['errors'])) {
3438
+        if ( ! empty($what) && ! empty($action_desc) && empty($notices['errors'])) {
3439 3439
             // how many records affected ? more than one record ? or just one ?
3440 3440
             if ($success > 1) {
3441 3441
                 // set plural msg
@@ -3464,7 +3464,7 @@  discard block
 block discarded – undo
3464 3464
             }
3465 3465
         }
3466 3466
         // check that $query_args isn't something crazy
3467
-        if (! is_array($query_args)) {
3467
+        if ( ! is_array($query_args)) {
3468 3468
             $query_args = array();
3469 3469
         }
3470 3470
         /**
@@ -3489,7 +3489,7 @@  discard block
 block discarded – undo
3489 3489
             $redirect_url = admin_url('admin.php');
3490 3490
         }
3491 3491
         // merge any default query_args set in _default_route_query_args property
3492
-        if (! empty($this->_default_route_query_args) && ! $this->_is_UI_request) {
3492
+        if ( ! empty($this->_default_route_query_args) && ! $this->_is_UI_request) {
3493 3493
             $args_to_merge = array();
3494 3494
             foreach ($this->_default_route_query_args as $query_param => $query_value) {
3495 3495
                 // is there a wp_referer array in our _default_route_query_args property?
@@ -3501,15 +3501,15 @@  discard block
 block discarded – undo
3501 3501
                         }
3502 3502
                         // finally we will override any arguments in the referer with
3503 3503
                         // what might be set on the _default_route_query_args array.
3504
-                        if (isset($this->_default_route_query_args[ $reference ])) {
3505
-                            $args_to_merge[ $reference ] = urlencode($this->_default_route_query_args[ $reference ]);
3504
+                        if (isset($this->_default_route_query_args[$reference])) {
3505
+                            $args_to_merge[$reference] = urlencode($this->_default_route_query_args[$reference]);
3506 3506
                         } else {
3507
-                            $args_to_merge[ $reference ] = urlencode($value);
3507
+                            $args_to_merge[$reference] = urlencode($value);
3508 3508
                         }
3509 3509
                     }
3510 3510
                     continue;
3511 3511
                 }
3512
-                $args_to_merge[ $query_param ] = $query_value;
3512
+                $args_to_merge[$query_param] = $query_value;
3513 3513
             }
3514 3514
             // now let's merge these arguments but override with what was specifically sent in to the
3515 3515
             // redirect.
@@ -3521,13 +3521,13 @@  discard block
 block discarded – undo
3521 3521
         if (isset($query_args['action'])) {
3522 3522
             // manually generate wp_nonce and merge that with the query vars
3523 3523
             // becuz the wp_nonce_url function wrecks havoc on some vars
3524
-            $query_args['_wpnonce'] = wp_create_nonce($query_args['action'] . '_nonce');
3524
+            $query_args['_wpnonce'] = wp_create_nonce($query_args['action'].'_nonce');
3525 3525
         }
3526 3526
         // we're adding some hooks and filters in here for processing any things just before redirects
3527 3527
         // (example: an admin page has done an insert or update and we want to run something after that).
3528
-        do_action('AHEE_redirect_' . $classname . $this->_req_action, $query_args);
3528
+        do_action('AHEE_redirect_'.$classname.$this->_req_action, $query_args);
3529 3529
         $redirect_url = apply_filters(
3530
-            'FHEE_redirect_' . $classname . $this->_req_action,
3530
+            'FHEE_redirect_'.$classname.$this->_req_action,
3531 3531
             self::add_query_args_and_nonce($query_args, $redirect_url),
3532 3532
             $query_args
3533 3533
         );
@@ -3580,7 +3580,7 @@  discard block
 block discarded – undo
3580 3580
         }
3581 3581
         $this->_template_args['notices'] = EE_Error::get_notices();
3582 3582
         // IF this isn't ajax we need to create a transient for the notices using the route (however, overridden if $sticky_notices == true)
3583
-        if (! defined('DOING_AJAX') || $sticky_notices) {
3583
+        if ( ! defined('DOING_AJAX') || $sticky_notices) {
3584 3584
             $route = isset($query_args['action']) ? $query_args['action'] : 'default';
3585 3585
             $this->_add_transient(
3586 3586
                 $route,
@@ -3620,7 +3620,7 @@  discard block
 block discarded – undo
3620 3620
         $exclude_nonce = false
3621 3621
     ) {
3622 3622
         // first let's validate the action (if $base_url is FALSE otherwise validation will happen further along)
3623
-        if (empty($base_url) && ! isset($this->_page_routes[ $action ])) {
3623
+        if (empty($base_url) && ! isset($this->_page_routes[$action])) {
3624 3624
             throw new EE_Error(
3625 3625
                 sprintf(
3626 3626
                     esc_html__(
@@ -3631,7 +3631,7 @@  discard block
 block discarded – undo
3631 3631
                 )
3632 3632
             );
3633 3633
         }
3634
-        if (! isset($this->_labels['buttons'][ $type ])) {
3634
+        if ( ! isset($this->_labels['buttons'][$type])) {
3635 3635
             throw new EE_Error(
3636 3636
                 sprintf(
3637 3637
                     __(
@@ -3644,7 +3644,7 @@  discard block
 block discarded – undo
3644 3644
         }
3645 3645
         // finally check user access for this button.
3646 3646
         $has_access = $this->check_user_access($action, true);
3647
-        if (! $has_access) {
3647
+        if ( ! $has_access) {
3648 3648
             return '';
3649 3649
         }
3650 3650
         $_base_url = ! $base_url ? $this->_admin_base_url : $base_url;
@@ -3652,11 +3652,11 @@  discard block
 block discarded – undo
3652 3652
             'action' => $action,
3653 3653
         );
3654 3654
         // merge extra_request args but make sure our original action takes precedence and doesn't get overwritten.
3655
-        if (! empty($extra_request)) {
3655
+        if ( ! empty($extra_request)) {
3656 3656
             $query_args = array_merge($extra_request, $query_args);
3657 3657
         }
3658 3658
         $url = self::add_query_args_and_nonce($query_args, $_base_url, false, $exclude_nonce);
3659
-        return EEH_Template::get_button_or_link($url, $this->_labels['buttons'][ $type ], $class);
3659
+        return EEH_Template::get_button_or_link($url, $this->_labels['buttons'][$type], $class);
3660 3660
     }
3661 3661
 
3662 3662
 
@@ -3682,7 +3682,7 @@  discard block
 block discarded – undo
3682 3682
                 'FHEE__EE_Admin_Page___per_page_screen_options__default',
3683 3683
                 10
3684 3684
             ),
3685
-            'option'  => $this->_current_page . '_' . $this->_current_view . '_per_page',
3685
+            'option'  => $this->_current_page.'_'.$this->_current_view.'_per_page',
3686 3686
         );
3687 3687
         // ONLY add the screen option if the user has access to it.
3688 3688
         if ($this->check_user_access($this->_current_view, true)) {
@@ -3703,7 +3703,7 @@  discard block
 block discarded – undo
3703 3703
     {
3704 3704
         if (isset($_POST['wp_screen_options']) && is_array($_POST['wp_screen_options'])) {
3705 3705
             check_admin_referer('screen-options-nonce', 'screenoptionnonce');
3706
-            if (! $user = wp_get_current_user()) {
3706
+            if ( ! $user = wp_get_current_user()) {
3707 3707
                 return;
3708 3708
             }
3709 3709
             $option = $_POST['wp_screen_options']['option'];
@@ -3714,7 +3714,7 @@  discard block
 block discarded – undo
3714 3714
             $map_option = $option;
3715 3715
             $option = str_replace('-', '_', $option);
3716 3716
             switch ($map_option) {
3717
-                case $this->_current_page . '_' . $this->_current_view . '_per_page':
3717
+                case $this->_current_page.'_'.$this->_current_view.'_per_page':
3718 3718
                     $value = (int) $value;
3719 3719
                     $max_value = apply_filters(
3720 3720
                         'FHEE__EE_Admin_Page___set_per_page_screen_options__max_value',
@@ -3772,13 +3772,13 @@  discard block
 block discarded – undo
3772 3772
     protected function _add_transient($route, $data, $notices = false, $skip_route_verify = false)
3773 3773
     {
3774 3774
         $user_id = get_current_user_id();
3775
-        if (! $skip_route_verify) {
3775
+        if ( ! $skip_route_verify) {
3776 3776
             $this->_verify_route($route);
3777 3777
         }
3778 3778
         // now let's set the string for what kind of transient we're setting
3779 3779
         $transient = $notices
3780
-            ? 'ee_rte_n_tx_' . $route . '_' . $user_id
3781
-            : 'rte_tx_' . $route . '_' . $user_id;
3780
+            ? 'ee_rte_n_tx_'.$route.'_'.$user_id
3781
+            : 'rte_tx_'.$route.'_'.$user_id;
3782 3782
         $data = $notices ? array('notices' => $data) : $data;
3783 3783
         // is there already a transient for this route?  If there is then let's ADD to that transient
3784 3784
         $existing = is_multisite() && is_network_admin()
@@ -3807,8 +3807,8 @@  discard block
 block discarded – undo
3807 3807
         $user_id = get_current_user_id();
3808 3808
         $route = ! $route ? $this->_req_action : $route;
3809 3809
         $transient = $notices
3810
-            ? 'ee_rte_n_tx_' . $route . '_' . $user_id
3811
-            : 'rte_tx_' . $route . '_' . $user_id;
3810
+            ? 'ee_rte_n_tx_'.$route.'_'.$user_id
3811
+            : 'rte_tx_'.$route.'_'.$user_id;
3812 3812
         $data = is_multisite() && is_network_admin()
3813 3813
             ? get_site_transient($transient)
3814 3814
             : get_transient($transient);
@@ -4027,7 +4027,7 @@  discard block
 block discarded – undo
4027 4027
      */
4028 4028
     protected function _next_link($url, $class = 'dashicons dashicons-arrow-right')
4029 4029
     {
4030
-        return '<a class="' . $class . '" href="' . $url . '"></a>';
4030
+        return '<a class="'.$class.'" href="'.$url.'"></a>';
4031 4031
     }
4032 4032
 
4033 4033
 
@@ -4040,7 +4040,7 @@  discard block
 block discarded – undo
4040 4040
      */
4041 4041
     protected function _previous_link($url, $class = 'dashicons dashicons-arrow-left')
4042 4042
     {
4043
-        return '<a class="' . $class . '" href="' . $url . '"></a>';
4043
+        return '<a class="'.$class.'" href="'.$url.'"></a>';
4044 4044
     }
4045 4045
 
4046 4046
 
Please login to merge, or discard this patch.
admin/extend/registrations/Extend_Registrations_Admin_Page.core.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -924,7 +924,7 @@
 block discarded – undo
924 924
      * handles toggling the checkin status for the registration,
925 925
      *
926 926
      * @access protected
927
-     * @return int|void
927
+     * @return integer
928 928
      * @throws EE_Error
929 929
      * @throws InvalidArgumentException
930 930
      * @throws InvalidDataTypeException
Please login to merge, or discard this patch.
Indentation   +1199 added lines, -1199 removed lines patch added patch discarded remove patch
@@ -16,1256 +16,1256 @@
 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
-                ),
154
-                'list_table'    => 'EE_Registration_CheckIn_List_Table',
155
-                // 'help_tour' => array( 'Checkin_Toggle_View_Help_Tour' ),
156
-                'metaboxes'     => array(),
157
-                'require_nonce' => false,
158
-            ),
159
-        );
160
-        $this->_page_config = array_merge($this->_page_config, $new_page_config);
161
-        $this->_page_config['contact_list']['list_table'] = 'Extend_EE_Attendee_Contact_List_Table';
162
-        $this->_page_config['default']['list_table'] = 'Extend_EE_Registrations_List_Table';
163
-    }
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
+				),
154
+				'list_table'    => 'EE_Registration_CheckIn_List_Table',
155
+				// 'help_tour' => array( 'Checkin_Toggle_View_Help_Tour' ),
156
+				'metaboxes'     => array(),
157
+				'require_nonce' => false,
158
+			),
159
+		);
160
+		$this->_page_config = array_merge($this->_page_config, $new_page_config);
161
+		$this->_page_config['contact_list']['list_table'] = 'Extend_EE_Attendee_Contact_List_Table';
162
+		$this->_page_config['default']['list_table'] = 'Extend_EE_Registrations_List_Table';
163
+	}
164 164
 
165 165
 
166
-    /**
167
-     * Ajax hooks for all routes in this page.
168
-     */
169
-    protected function _ajax_hooks()
170
-    {
171
-        parent::_ajax_hooks();
172
-        add_action('wp_ajax_get_newsletter_form_content', array($this, 'get_newsletter_form_content'));
173
-    }
166
+	/**
167
+	 * Ajax hooks for all routes in this page.
168
+	 */
169
+	protected function _ajax_hooks()
170
+	{
171
+		parent::_ajax_hooks();
172
+		add_action('wp_ajax_get_newsletter_form_content', array($this, 'get_newsletter_form_content'));
173
+	}
174 174
 
175 175
 
176
-    /**
177
-     * Global scripts for all routes in this page.
178
-     */
179
-    public function load_scripts_styles()
180
-    {
181
-        parent::load_scripts_styles();
182
-        // if newsletter message type is active then let's add filter and load js for it.
183
-        if (EEH_MSG_Template::is_mt_active('newsletter')) {
184
-            // enqueue newsletter js
185
-            wp_enqueue_script(
186
-                'ee-newsletter-trigger',
187
-                REG_CAF_ASSETS_URL . 'ee-newsletter-trigger.js',
188
-                array('ee-dialog'),
189
-                EVENT_ESPRESSO_VERSION,
190
-                true
191
-            );
192
-            wp_enqueue_style(
193
-                'ee-newsletter-trigger-css',
194
-                REG_CAF_ASSETS_URL . 'ee-newsletter-trigger.css',
195
-                array(),
196
-                EVENT_ESPRESSO_VERSION
197
-            );
198
-            // hook in buttons for newsletter message type trigger.
199
-            add_action(
200
-                'AHEE__EE_Admin_List_Table__extra_tablenav__after_bottom_buttons',
201
-                array($this, 'add_newsletter_action_buttons'),
202
-                10
203
-            );
204
-        }
205
-    }
176
+	/**
177
+	 * Global scripts for all routes in this page.
178
+	 */
179
+	public function load_scripts_styles()
180
+	{
181
+		parent::load_scripts_styles();
182
+		// if newsletter message type is active then let's add filter and load js for it.
183
+		if (EEH_MSG_Template::is_mt_active('newsletter')) {
184
+			// enqueue newsletter js
185
+			wp_enqueue_script(
186
+				'ee-newsletter-trigger',
187
+				REG_CAF_ASSETS_URL . 'ee-newsletter-trigger.js',
188
+				array('ee-dialog'),
189
+				EVENT_ESPRESSO_VERSION,
190
+				true
191
+			);
192
+			wp_enqueue_style(
193
+				'ee-newsletter-trigger-css',
194
+				REG_CAF_ASSETS_URL . 'ee-newsletter-trigger.css',
195
+				array(),
196
+				EVENT_ESPRESSO_VERSION
197
+			);
198
+			// hook in buttons for newsletter message type trigger.
199
+			add_action(
200
+				'AHEE__EE_Admin_List_Table__extra_tablenav__after_bottom_buttons',
201
+				array($this, 'add_newsletter_action_buttons'),
202
+				10
203
+			);
204
+		}
205
+	}
206 206
 
207 207
 
208
-    /**
209
-     * Scripts and styles for just the reports route.
210
-     */
211
-    public function load_scripts_styles_reports()
212
-    {
213
-        wp_register_script(
214
-            'ee-reg-reports-js',
215
-            REG_CAF_ASSETS_URL . 'ee-registration-admin-reports.js',
216
-            array('google-charts'),
217
-            EVENT_ESPRESSO_VERSION,
218
-            true
219
-        );
220
-        wp_enqueue_script('ee-reg-reports-js');
221
-        $this->_registration_reports_js_setup();
222
-    }
208
+	/**
209
+	 * Scripts and styles for just the reports route.
210
+	 */
211
+	public function load_scripts_styles_reports()
212
+	{
213
+		wp_register_script(
214
+			'ee-reg-reports-js',
215
+			REG_CAF_ASSETS_URL . 'ee-registration-admin-reports.js',
216
+			array('google-charts'),
217
+			EVENT_ESPRESSO_VERSION,
218
+			true
219
+		);
220
+		wp_enqueue_script('ee-reg-reports-js');
221
+		$this->_registration_reports_js_setup();
222
+	}
223 223
 
224 224
 
225
-    /**
226
-     * Register screen options for event_registrations route.
227
-     */
228
-    protected function _add_screen_options_event_registrations()
229
-    {
230
-        $this->_per_page_screen_option();
231
-    }
225
+	/**
226
+	 * Register screen options for event_registrations route.
227
+	 */
228
+	protected function _add_screen_options_event_registrations()
229
+	{
230
+		$this->_per_page_screen_option();
231
+	}
232 232
 
233 233
 
234
-    /**
235
-     * Register screen options for registration_checkins route
236
-     */
237
-    protected function _add_screen_options_registration_checkins()
238
-    {
239
-        $page_title = $this->_admin_page_title;
240
-        $this->_admin_page_title = esc_html__('Check-In Records', 'event_espresso');
241
-        $this->_per_page_screen_option();
242
-        $this->_admin_page_title = $page_title;
243
-    }
234
+	/**
235
+	 * Register screen options for registration_checkins route
236
+	 */
237
+	protected function _add_screen_options_registration_checkins()
238
+	{
239
+		$page_title = $this->_admin_page_title;
240
+		$this->_admin_page_title = esc_html__('Check-In Records', 'event_espresso');
241
+		$this->_per_page_screen_option();
242
+		$this->_admin_page_title = $page_title;
243
+	}
244 244
 
245 245
 
246
-    /**
247
-     * Set views property for event_registrations route.
248
-     */
249
-    protected function _set_list_table_views_event_registrations()
250
-    {
251
-        $this->_views = array(
252
-            'all' => array(
253
-                'slug'        => 'all',
254
-                'label'       => esc_html__('All', 'event_espresso'),
255
-                'count'       => 0,
256
-                'bulk_action' => ! isset($this->_req_data['event_id'])
257
-                    ? array()
258
-                    : array(
259
-                        'toggle_checkin_status_bulk' => esc_html__('Toggle Check-In', 'event_espresso'),
260
-                    ),
261
-            ),
262
-        );
263
-    }
246
+	/**
247
+	 * Set views property for event_registrations route.
248
+	 */
249
+	protected function _set_list_table_views_event_registrations()
250
+	{
251
+		$this->_views = array(
252
+			'all' => array(
253
+				'slug'        => 'all',
254
+				'label'       => esc_html__('All', 'event_espresso'),
255
+				'count'       => 0,
256
+				'bulk_action' => ! isset($this->_req_data['event_id'])
257
+					? array()
258
+					: array(
259
+						'toggle_checkin_status_bulk' => esc_html__('Toggle Check-In', 'event_espresso'),
260
+					),
261
+			),
262
+		);
263
+	}
264 264
 
265 265
 
266
-    /**
267
-     * Set views property for registration_checkins route.
268
-     */
269
-    protected function _set_list_table_views_registration_checkins()
270
-    {
271
-        $this->_views = array(
272
-            'all' => array(
273
-                'slug'        => 'all',
274
-                'label'       => esc_html__('All', 'event_espresso'),
275
-                'count'       => 0,
276
-                'bulk_action' => array('delete_checkin_rows' => esc_html__('Delete Check-In Rows', 'event_espresso')),
277
-            ),
278
-        );
279
-    }
266
+	/**
267
+	 * Set views property for registration_checkins route.
268
+	 */
269
+	protected function _set_list_table_views_registration_checkins()
270
+	{
271
+		$this->_views = array(
272
+			'all' => array(
273
+				'slug'        => 'all',
274
+				'label'       => esc_html__('All', 'event_espresso'),
275
+				'count'       => 0,
276
+				'bulk_action' => array('delete_checkin_rows' => esc_html__('Delete Check-In Rows', 'event_espresso')),
277
+			),
278
+		);
279
+	}
280 280
 
281 281
 
282
-    /**
283
-     * callback for ajax action.
284
-     *
285
-     * @since 4.3.0
286
-     * @return void (JSON)
287
-     * @throws EE_Error
288
-     * @throws InvalidArgumentException
289
-     * @throws InvalidDataTypeException
290
-     * @throws InvalidInterfaceException
291
-     */
292
-    public function get_newsletter_form_content()
293
-    {
294
-        // do a nonce check cause we're not coming in from an normal route here.
295
-        $nonce = isset($this->_req_data['get_newsletter_form_content_nonce']) ? sanitize_text_field(
296
-            $this->_req_data['get_newsletter_form_content_nonce']
297
-        ) : '';
298
-        $nonce_ref = 'get_newsletter_form_content_nonce';
299
-        $this->_verify_nonce($nonce, $nonce_ref);
300
-        // let's get the mtp for the incoming MTP_ ID
301
-        if (! isset($this->_req_data['GRP_ID'])) {
302
-            EE_Error::add_error(
303
-                esc_html__(
304
-                    '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).',
305
-                    'event_espresso'
306
-                ),
307
-                __FILE__,
308
-                __FUNCTION__,
309
-                __LINE__
310
-            );
311
-            $this->_template_args['success'] = false;
312
-            $this->_template_args['error'] = true;
313
-            $this->_return_json();
314
-        }
315
-        $MTPG = EEM_Message_Template_Group::instance()->get_one_by_ID($this->_req_data['GRP_ID']);
316
-        if (! $MTPG instanceof EE_Message_Template_Group) {
317
-            EE_Error::add_error(
318
-                sprintf(
319
-                    esc_html__(
320
-                        'The GRP_ID given (%d) does not appear to have a corresponding row in the database.',
321
-                        'event_espresso'
322
-                    ),
323
-                    $this->_req_data['GRP_ID']
324
-                ),
325
-                __FILE__,
326
-                __FUNCTION__,
327
-                __LINE__
328
-            );
329
-            $this->_template_args['success'] = false;
330
-            $this->_template_args['error'] = true;
331
-            $this->_return_json();
332
-        }
333
-        $MTPs = $MTPG->context_templates();
334
-        $MTPs = $MTPs['attendee'];
335
-        $template_fields = array();
336
-        /** @var EE_Message_Template $MTP */
337
-        foreach ($MTPs as $MTP) {
338
-            $field = $MTP->get('MTP_template_field');
339
-            if ($field === 'content') {
340
-                $content = $MTP->get('MTP_content');
341
-                if (! empty($content['newsletter_content'])) {
342
-                    $template_fields['newsletter_content'] = $content['newsletter_content'];
343
-                }
344
-                continue;
345
-            }
346
-            $template_fields[ $MTP->get('MTP_template_field') ] = $MTP->get('MTP_content');
347
-        }
348
-        $this->_template_args['success'] = true;
349
-        $this->_template_args['error'] = false;
350
-        $this->_template_args['data'] = array(
351
-            'batch_message_from'    => isset($template_fields['from'])
352
-                ? $template_fields['from']
353
-                : '',
354
-            'batch_message_subject' => isset($template_fields['subject'])
355
-                ? $template_fields['subject']
356
-                : '',
357
-            'batch_message_content' => isset($template_fields['newsletter_content'])
358
-                ? $template_fields['newsletter_content']
359
-                : '',
360
-        );
361
-        $this->_return_json();
362
-    }
282
+	/**
283
+	 * callback for ajax action.
284
+	 *
285
+	 * @since 4.3.0
286
+	 * @return void (JSON)
287
+	 * @throws EE_Error
288
+	 * @throws InvalidArgumentException
289
+	 * @throws InvalidDataTypeException
290
+	 * @throws InvalidInterfaceException
291
+	 */
292
+	public function get_newsletter_form_content()
293
+	{
294
+		// do a nonce check cause we're not coming in from an normal route here.
295
+		$nonce = isset($this->_req_data['get_newsletter_form_content_nonce']) ? sanitize_text_field(
296
+			$this->_req_data['get_newsletter_form_content_nonce']
297
+		) : '';
298
+		$nonce_ref = 'get_newsletter_form_content_nonce';
299
+		$this->_verify_nonce($nonce, $nonce_ref);
300
+		// let's get the mtp for the incoming MTP_ ID
301
+		if (! isset($this->_req_data['GRP_ID'])) {
302
+			EE_Error::add_error(
303
+				esc_html__(
304
+					'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).',
305
+					'event_espresso'
306
+				),
307
+				__FILE__,
308
+				__FUNCTION__,
309
+				__LINE__
310
+			);
311
+			$this->_template_args['success'] = false;
312
+			$this->_template_args['error'] = true;
313
+			$this->_return_json();
314
+		}
315
+		$MTPG = EEM_Message_Template_Group::instance()->get_one_by_ID($this->_req_data['GRP_ID']);
316
+		if (! $MTPG instanceof EE_Message_Template_Group) {
317
+			EE_Error::add_error(
318
+				sprintf(
319
+					esc_html__(
320
+						'The GRP_ID given (%d) does not appear to have a corresponding row in the database.',
321
+						'event_espresso'
322
+					),
323
+					$this->_req_data['GRP_ID']
324
+				),
325
+				__FILE__,
326
+				__FUNCTION__,
327
+				__LINE__
328
+			);
329
+			$this->_template_args['success'] = false;
330
+			$this->_template_args['error'] = true;
331
+			$this->_return_json();
332
+		}
333
+		$MTPs = $MTPG->context_templates();
334
+		$MTPs = $MTPs['attendee'];
335
+		$template_fields = array();
336
+		/** @var EE_Message_Template $MTP */
337
+		foreach ($MTPs as $MTP) {
338
+			$field = $MTP->get('MTP_template_field');
339
+			if ($field === 'content') {
340
+				$content = $MTP->get('MTP_content');
341
+				if (! empty($content['newsletter_content'])) {
342
+					$template_fields['newsletter_content'] = $content['newsletter_content'];
343
+				}
344
+				continue;
345
+			}
346
+			$template_fields[ $MTP->get('MTP_template_field') ] = $MTP->get('MTP_content');
347
+		}
348
+		$this->_template_args['success'] = true;
349
+		$this->_template_args['error'] = false;
350
+		$this->_template_args['data'] = array(
351
+			'batch_message_from'    => isset($template_fields['from'])
352
+				? $template_fields['from']
353
+				: '',
354
+			'batch_message_subject' => isset($template_fields['subject'])
355
+				? $template_fields['subject']
356
+				: '',
357
+			'batch_message_content' => isset($template_fields['newsletter_content'])
358
+				? $template_fields['newsletter_content']
359
+				: '',
360
+		);
361
+		$this->_return_json();
362
+	}
363 363
 
364 364
 
365
-    /**
366
-     * callback for AHEE__EE_Admin_List_Table__extra_tablenav__after_bottom_buttons action
367
-     *
368
-     * @since 4.3.0
369
-     * @param EE_Admin_List_Table $list_table
370
-     * @return void
371
-     * @throws InvalidArgumentException
372
-     * @throws InvalidDataTypeException
373
-     * @throws InvalidInterfaceException
374
-     */
375
-    public function add_newsletter_action_buttons(EE_Admin_List_Table $list_table)
376
-    {
377
-        if (! EE_Registry::instance()->CAP->current_user_can(
378
-            'ee_send_message',
379
-            'espresso_registrations_newsletter_selected_send'
380
-        )
381
-        ) {
382
-            return;
383
-        }
384
-        $routes_to_add_to = array(
385
-            'contact_list',
386
-            'event_registrations',
387
-            'default',
388
-        );
389
-        if ($this->_current_page === 'espresso_registrations' && in_array($this->_req_action, $routes_to_add_to)) {
390
-            if (($this->_req_action === 'event_registrations' && empty($this->_req_data['event_id']))
391
-                || (isset($this->_req_data['status']) && $this->_req_data['status'] === 'trash')
392
-            ) {
393
-                echo '';
394
-            } else {
395
-                $button_text = sprintf(
396
-                    esc_html__('Send Batch Message (%s selected)', 'event_espresso'),
397
-                    '<span class="send-selected-newsletter-count">0</span>'
398
-                );
399
-                echo '<button id="selected-batch-send-trigger" class="button secondary-button">'
400
-                     . '<span class="dashicons dashicons-email "></span>'
401
-                     . $button_text
402
-                     . '</button>';
403
-                add_action('admin_footer', array($this, 'newsletter_send_form_skeleton'));
404
-            }
405
-        }
406
-    }
365
+	/**
366
+	 * callback for AHEE__EE_Admin_List_Table__extra_tablenav__after_bottom_buttons action
367
+	 *
368
+	 * @since 4.3.0
369
+	 * @param EE_Admin_List_Table $list_table
370
+	 * @return void
371
+	 * @throws InvalidArgumentException
372
+	 * @throws InvalidDataTypeException
373
+	 * @throws InvalidInterfaceException
374
+	 */
375
+	public function add_newsletter_action_buttons(EE_Admin_List_Table $list_table)
376
+	{
377
+		if (! EE_Registry::instance()->CAP->current_user_can(
378
+			'ee_send_message',
379
+			'espresso_registrations_newsletter_selected_send'
380
+		)
381
+		) {
382
+			return;
383
+		}
384
+		$routes_to_add_to = array(
385
+			'contact_list',
386
+			'event_registrations',
387
+			'default',
388
+		);
389
+		if ($this->_current_page === 'espresso_registrations' && in_array($this->_req_action, $routes_to_add_to)) {
390
+			if (($this->_req_action === 'event_registrations' && empty($this->_req_data['event_id']))
391
+				|| (isset($this->_req_data['status']) && $this->_req_data['status'] === 'trash')
392
+			) {
393
+				echo '';
394
+			} else {
395
+				$button_text = sprintf(
396
+					esc_html__('Send Batch Message (%s selected)', 'event_espresso'),
397
+					'<span class="send-selected-newsletter-count">0</span>'
398
+				);
399
+				echo '<button id="selected-batch-send-trigger" class="button secondary-button">'
400
+					 . '<span class="dashicons dashicons-email "></span>'
401
+					 . $button_text
402
+					 . '</button>';
403
+				add_action('admin_footer', array($this, 'newsletter_send_form_skeleton'));
404
+			}
405
+		}
406
+	}
407 407
 
408 408
 
409
-    /**
410
-     * @throws DomainException
411
-     * @throws EE_Error
412
-     * @throws InvalidArgumentException
413
-     * @throws InvalidDataTypeException
414
-     * @throws InvalidInterfaceException
415
-     */
416
-    public function newsletter_send_form_skeleton()
417
-    {
418
-        $list_table = $this->_list_table_object;
419
-        $codes = array();
420
-        // need to templates for the newsletter message type for the template selector.
421
-        $values[] = array('text' => esc_html__('Select Template to Use', 'event_espresso'), 'id' => 0);
422
-        $mtps = EEM_Message_Template_Group::instance()->get_all(
423
-            array(array('MTP_message_type' => 'newsletter', 'MTP_messenger' => 'email'))
424
-        );
425
-        foreach ($mtps as $mtp) {
426
-            $name = $mtp->name();
427
-            $values[] = array(
428
-                'text' => empty($name) ? esc_html__('Global', 'event_espresso') : $name,
429
-                'id'   => $mtp->ID(),
430
-            );
431
-        }
432
-        // need to get a list of shortcodes that are available for the newsletter message type.
433
-        $shortcodes = EEH_MSG_Template::get_shortcodes(
434
-            'newsletter',
435
-            'email',
436
-            array(),
437
-            'attendee',
438
-            false
439
-        );
440
-        foreach ($shortcodes as $field => $shortcode_array) {
441
-            $available_shortcodes = array();
442
-            foreach ($shortcode_array as $shortcode => $shortcode_details) {
443
-                $field_id = $field === '[NEWSLETTER_CONTENT]'
444
-                    ? 'content'
445
-                    : $field;
446
-                $field_id = 'batch-message-' . strtolower($field_id);
447
-                $available_shortcodes[] = '<span class="js-shortcode-selection" data-value="'
448
-                                          . $shortcode
449
-                                          . '" data-linked-input-id="' . $field_id . '">'
450
-                                          . $shortcode
451
-                                          . '</span>';
452
-            }
453
-            $codes[ $field ] = implode(', ', $available_shortcodes);
454
-        }
455
-        $shortcodes = $codes;
456
-        $form_template = REG_CAF_TEMPLATE_PATH . 'newsletter-send-form.template.php';
457
-        $form_template_args = array(
458
-            'form_action'       => admin_url('admin.php?page=espresso_registrations'),
459
-            'form_route'        => 'newsletter_selected_send',
460
-            'form_nonce_name'   => 'newsletter_selected_send_nonce',
461
-            'form_nonce'        => wp_create_nonce('newsletter_selected_send_nonce'),
462
-            'redirect_back_to'  => $this->_req_action,
463
-            'ajax_nonce'        => wp_create_nonce('get_newsletter_form_content_nonce'),
464
-            'template_selector' => EEH_Form_Fields::select_input('newsletter_mtp_selected', $values),
465
-            'shortcodes'        => $shortcodes,
466
-            'id_type'           => $list_table instanceof EE_Attendee_Contact_List_Table ? 'contact' : 'registration',
467
-        );
468
-        EEH_Template::display_template($form_template, $form_template_args);
469
-    }
409
+	/**
410
+	 * @throws DomainException
411
+	 * @throws EE_Error
412
+	 * @throws InvalidArgumentException
413
+	 * @throws InvalidDataTypeException
414
+	 * @throws InvalidInterfaceException
415
+	 */
416
+	public function newsletter_send_form_skeleton()
417
+	{
418
+		$list_table = $this->_list_table_object;
419
+		$codes = array();
420
+		// need to templates for the newsletter message type for the template selector.
421
+		$values[] = array('text' => esc_html__('Select Template to Use', 'event_espresso'), 'id' => 0);
422
+		$mtps = EEM_Message_Template_Group::instance()->get_all(
423
+			array(array('MTP_message_type' => 'newsletter', 'MTP_messenger' => 'email'))
424
+		);
425
+		foreach ($mtps as $mtp) {
426
+			$name = $mtp->name();
427
+			$values[] = array(
428
+				'text' => empty($name) ? esc_html__('Global', 'event_espresso') : $name,
429
+				'id'   => $mtp->ID(),
430
+			);
431
+		}
432
+		// need to get a list of shortcodes that are available for the newsletter message type.
433
+		$shortcodes = EEH_MSG_Template::get_shortcodes(
434
+			'newsletter',
435
+			'email',
436
+			array(),
437
+			'attendee',
438
+			false
439
+		);
440
+		foreach ($shortcodes as $field => $shortcode_array) {
441
+			$available_shortcodes = array();
442
+			foreach ($shortcode_array as $shortcode => $shortcode_details) {
443
+				$field_id = $field === '[NEWSLETTER_CONTENT]'
444
+					? 'content'
445
+					: $field;
446
+				$field_id = 'batch-message-' . strtolower($field_id);
447
+				$available_shortcodes[] = '<span class="js-shortcode-selection" data-value="'
448
+										  . $shortcode
449
+										  . '" data-linked-input-id="' . $field_id . '">'
450
+										  . $shortcode
451
+										  . '</span>';
452
+			}
453
+			$codes[ $field ] = implode(', ', $available_shortcodes);
454
+		}
455
+		$shortcodes = $codes;
456
+		$form_template = REG_CAF_TEMPLATE_PATH . 'newsletter-send-form.template.php';
457
+		$form_template_args = array(
458
+			'form_action'       => admin_url('admin.php?page=espresso_registrations'),
459
+			'form_route'        => 'newsletter_selected_send',
460
+			'form_nonce_name'   => 'newsletter_selected_send_nonce',
461
+			'form_nonce'        => wp_create_nonce('newsletter_selected_send_nonce'),
462
+			'redirect_back_to'  => $this->_req_action,
463
+			'ajax_nonce'        => wp_create_nonce('get_newsletter_form_content_nonce'),
464
+			'template_selector' => EEH_Form_Fields::select_input('newsletter_mtp_selected', $values),
465
+			'shortcodes'        => $shortcodes,
466
+			'id_type'           => $list_table instanceof EE_Attendee_Contact_List_Table ? 'contact' : 'registration',
467
+		);
468
+		EEH_Template::display_template($form_template, $form_template_args);
469
+	}
470 470
 
471 471
 
472
-    /**
473
-     * Handles sending selected registrations/contacts a newsletter.
474
-     *
475
-     * @since  4.3.0
476
-     * @return void
477
-     * @throws EE_Error
478
-     * @throws InvalidArgumentException
479
-     * @throws InvalidDataTypeException
480
-     * @throws InvalidInterfaceException
481
-     */
482
-    protected function _newsletter_selected_send()
483
-    {
484
-        $success = true;
485
-        // first we need to make sure we have a GRP_ID so we know what template we're sending and updating!
486
-        if (empty($this->_req_data['newsletter_mtp_selected'])) {
487
-            EE_Error::add_error(
488
-                esc_html__(
489
-                    'In order to send a message, a Message Template GRP_ID is needed. It was not provided so messages were not sent.',
490
-                    'event_espresso'
491
-                ),
492
-                __FILE__,
493
-                __FUNCTION__,
494
-                __LINE__
495
-            );
496
-            $success = false;
497
-        }
498
-        if ($success) {
499
-            // update Message template in case there are any changes
500
-            $Message_Template_Group = EEM_Message_Template_Group::instance()->get_one_by_ID(
501
-                $this->_req_data['newsletter_mtp_selected']
502
-            );
503
-            $Message_Templates = $Message_Template_Group instanceof EE_Message_Template_Group
504
-                ? $Message_Template_Group->context_templates()
505
-                : array();
506
-            if (empty($Message_Templates)) {
507
-                EE_Error::add_error(
508
-                    esc_html__(
509
-                        'Unable to retrieve message template fields from the db. Messages not sent.',
510
-                        'event_espresso'
511
-                    ),
512
-                    __FILE__,
513
-                    __FUNCTION__,
514
-                    __LINE__
515
-                );
516
-            }
517
-            // let's just update the specific fields
518
-            foreach ($Message_Templates['attendee'] as $Message_Template) {
519
-                if ($Message_Template instanceof EE_Message_Template) {
520
-                    $field = $Message_Template->get('MTP_template_field');
521
-                    $content = $Message_Template->get('MTP_content');
522
-                    $new_content = $content;
523
-                    switch ($field) {
524
-                        case 'from':
525
-                            $new_content = ! empty($this->_req_data['batch_message']['from'])
526
-                                ? $this->_req_data['batch_message']['from']
527
-                                : $content;
528
-                            break;
529
-                        case 'subject':
530
-                            $new_content = ! empty($this->_req_data['batch_message']['subject'])
531
-                                ? $this->_req_data['batch_message']['subject']
532
-                                : $content;
533
-                            break;
534
-                        case 'content':
535
-                            $new_content = $content;
536
-                            $new_content['newsletter_content'] = ! empty($this->_req_data['batch_message']['content'])
537
-                                ? $this->_req_data['batch_message']['content']
538
-                                : $content['newsletter_content'];
539
-                            break;
540
-                        default:
541
-                            // continue the foreach loop, we don't want to set $new_content nor save.
542
-                            continue 2;
543
-                    }
544
-                    $Message_Template->set('MTP_content', $new_content);
545
-                    $Message_Template->save();
546
-                }
547
-            }
548
-            // great fields are updated!  now let's make sure we just have contact objects (EE_Attendee).
549
-            $id_type = ! empty($this->_req_data['batch_message']['id_type'])
550
-                ? $this->_req_data['batch_message']['id_type']
551
-                : 'registration';
552
-            // id_type will affect how we assemble the ids.
553
-            $ids = ! empty($this->_req_data['batch_message']['ids'])
554
-                ? json_decode(stripslashes($this->_req_data['batch_message']['ids']))
555
-                : array();
556
-            $registrations_used_for_contact_data = array();
557
-            // using switch because eventually we'll have other contexts that will be used for generating messages.
558
-            switch ($id_type) {
559
-                case 'registration':
560
-                    $registrations_used_for_contact_data = EEM_Registration::instance()->get_all(
561
-                        array(
562
-                            array(
563
-                                'REG_ID' => array('IN', $ids),
564
-                            ),
565
-                        )
566
-                    );
567
-                    break;
568
-                case 'contact':
569
-                    $registrations_used_for_contact_data = EEM_Registration::instance()
570
-                                                                           ->get_latest_registration_for_each_of_given_contacts(
571
-                                                                               $ids
572
-                                                                           );
573
-                    break;
574
-            }
575
-            do_action_ref_array(
576
-                'AHEE__Extend_Registrations_Admin_Page___newsletter_selected_send__with_registrations',
577
-                array(
578
-                    $registrations_used_for_contact_data,
579
-                    $Message_Template_Group->ID(),
580
-                )
581
-            );
582
-            // kept for backward compat, internally we no longer use this action.
583
-            // @deprecated 4.8.36.rc.002
584
-            $contacts = $id_type === 'registration'
585
-                ? EEM_Attendee::instance()->get_array_of_contacts_from_reg_ids($ids)
586
-                : EEM_Attendee::instance()->get_all(array(array('ATT_ID' => array('in', $ids))));
587
-            do_action_ref_array(
588
-                'AHEE__Extend_Registrations_Admin_Page___newsletter_selected_send',
589
-                array(
590
-                    $contacts,
591
-                    $Message_Template_Group->ID(),
592
-                )
593
-            );
594
-        }
595
-        $query_args = array(
596
-            'action' => ! empty($this->_req_data['redirect_back_to'])
597
-                ? $this->_req_data['redirect_back_to']
598
-                : 'default',
599
-        );
600
-        $this->_redirect_after_action(false, '', '', $query_args, true);
601
-    }
472
+	/**
473
+	 * Handles sending selected registrations/contacts a newsletter.
474
+	 *
475
+	 * @since  4.3.0
476
+	 * @return void
477
+	 * @throws EE_Error
478
+	 * @throws InvalidArgumentException
479
+	 * @throws InvalidDataTypeException
480
+	 * @throws InvalidInterfaceException
481
+	 */
482
+	protected function _newsletter_selected_send()
483
+	{
484
+		$success = true;
485
+		// first we need to make sure we have a GRP_ID so we know what template we're sending and updating!
486
+		if (empty($this->_req_data['newsletter_mtp_selected'])) {
487
+			EE_Error::add_error(
488
+				esc_html__(
489
+					'In order to send a message, a Message Template GRP_ID is needed. It was not provided so messages were not sent.',
490
+					'event_espresso'
491
+				),
492
+				__FILE__,
493
+				__FUNCTION__,
494
+				__LINE__
495
+			);
496
+			$success = false;
497
+		}
498
+		if ($success) {
499
+			// update Message template in case there are any changes
500
+			$Message_Template_Group = EEM_Message_Template_Group::instance()->get_one_by_ID(
501
+				$this->_req_data['newsletter_mtp_selected']
502
+			);
503
+			$Message_Templates = $Message_Template_Group instanceof EE_Message_Template_Group
504
+				? $Message_Template_Group->context_templates()
505
+				: array();
506
+			if (empty($Message_Templates)) {
507
+				EE_Error::add_error(
508
+					esc_html__(
509
+						'Unable to retrieve message template fields from the db. Messages not sent.',
510
+						'event_espresso'
511
+					),
512
+					__FILE__,
513
+					__FUNCTION__,
514
+					__LINE__
515
+				);
516
+			}
517
+			// let's just update the specific fields
518
+			foreach ($Message_Templates['attendee'] as $Message_Template) {
519
+				if ($Message_Template instanceof EE_Message_Template) {
520
+					$field = $Message_Template->get('MTP_template_field');
521
+					$content = $Message_Template->get('MTP_content');
522
+					$new_content = $content;
523
+					switch ($field) {
524
+						case 'from':
525
+							$new_content = ! empty($this->_req_data['batch_message']['from'])
526
+								? $this->_req_data['batch_message']['from']
527
+								: $content;
528
+							break;
529
+						case 'subject':
530
+							$new_content = ! empty($this->_req_data['batch_message']['subject'])
531
+								? $this->_req_data['batch_message']['subject']
532
+								: $content;
533
+							break;
534
+						case 'content':
535
+							$new_content = $content;
536
+							$new_content['newsletter_content'] = ! empty($this->_req_data['batch_message']['content'])
537
+								? $this->_req_data['batch_message']['content']
538
+								: $content['newsletter_content'];
539
+							break;
540
+						default:
541
+							// continue the foreach loop, we don't want to set $new_content nor save.
542
+							continue 2;
543
+					}
544
+					$Message_Template->set('MTP_content', $new_content);
545
+					$Message_Template->save();
546
+				}
547
+			}
548
+			// great fields are updated!  now let's make sure we just have contact objects (EE_Attendee).
549
+			$id_type = ! empty($this->_req_data['batch_message']['id_type'])
550
+				? $this->_req_data['batch_message']['id_type']
551
+				: 'registration';
552
+			// id_type will affect how we assemble the ids.
553
+			$ids = ! empty($this->_req_data['batch_message']['ids'])
554
+				? json_decode(stripslashes($this->_req_data['batch_message']['ids']))
555
+				: array();
556
+			$registrations_used_for_contact_data = array();
557
+			// using switch because eventually we'll have other contexts that will be used for generating messages.
558
+			switch ($id_type) {
559
+				case 'registration':
560
+					$registrations_used_for_contact_data = EEM_Registration::instance()->get_all(
561
+						array(
562
+							array(
563
+								'REG_ID' => array('IN', $ids),
564
+							),
565
+						)
566
+					);
567
+					break;
568
+				case 'contact':
569
+					$registrations_used_for_contact_data = EEM_Registration::instance()
570
+																		   ->get_latest_registration_for_each_of_given_contacts(
571
+																			   $ids
572
+																		   );
573
+					break;
574
+			}
575
+			do_action_ref_array(
576
+				'AHEE__Extend_Registrations_Admin_Page___newsletter_selected_send__with_registrations',
577
+				array(
578
+					$registrations_used_for_contact_data,
579
+					$Message_Template_Group->ID(),
580
+				)
581
+			);
582
+			// kept for backward compat, internally we no longer use this action.
583
+			// @deprecated 4.8.36.rc.002
584
+			$contacts = $id_type === 'registration'
585
+				? EEM_Attendee::instance()->get_array_of_contacts_from_reg_ids($ids)
586
+				: EEM_Attendee::instance()->get_all(array(array('ATT_ID' => array('in', $ids))));
587
+			do_action_ref_array(
588
+				'AHEE__Extend_Registrations_Admin_Page___newsletter_selected_send',
589
+				array(
590
+					$contacts,
591
+					$Message_Template_Group->ID(),
592
+				)
593
+			);
594
+		}
595
+		$query_args = array(
596
+			'action' => ! empty($this->_req_data['redirect_back_to'])
597
+				? $this->_req_data['redirect_back_to']
598
+				: 'default',
599
+		);
600
+		$this->_redirect_after_action(false, '', '', $query_args, true);
601
+	}
602 602
 
603 603
 
604
-    /**
605
-     * This is called when javascript is being enqueued to setup the various data needed for the reports js.
606
-     * Also $this->{$_reports_template_data} property is set for later usage by the _registration_reports method.
607
-     */
608
-    protected function _registration_reports_js_setup()
609
-    {
610
-        $this->_reports_template_data['admin_reports'][] = $this->_registrations_per_day_report();
611
-        $this->_reports_template_data['admin_reports'][] = $this->_registrations_per_event_report();
612
-    }
604
+	/**
605
+	 * This is called when javascript is being enqueued to setup the various data needed for the reports js.
606
+	 * Also $this->{$_reports_template_data} property is set for later usage by the _registration_reports method.
607
+	 */
608
+	protected function _registration_reports_js_setup()
609
+	{
610
+		$this->_reports_template_data['admin_reports'][] = $this->_registrations_per_day_report();
611
+		$this->_reports_template_data['admin_reports'][] = $this->_registrations_per_event_report();
612
+	}
613 613
 
614 614
 
615
-    /**
616
-     *        generates Business Reports regarding Registrations
617
-     *
618
-     * @access protected
619
-     * @return void
620
-     * @throws DomainException
621
-     */
622
-    protected function _registration_reports()
623
-    {
624
-        $template_path = EE_ADMIN_TEMPLATE . 'admin_reports.template.php';
625
-        $this->_template_args['admin_page_content'] = EEH_Template::display_template(
626
-            $template_path,
627
-            $this->_reports_template_data,
628
-            true
629
-        );
630
-        // the final template wrapper
631
-        $this->display_admin_page_with_no_sidebar();
632
-    }
615
+	/**
616
+	 *        generates Business Reports regarding Registrations
617
+	 *
618
+	 * @access protected
619
+	 * @return void
620
+	 * @throws DomainException
621
+	 */
622
+	protected function _registration_reports()
623
+	{
624
+		$template_path = EE_ADMIN_TEMPLATE . 'admin_reports.template.php';
625
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template(
626
+			$template_path,
627
+			$this->_reports_template_data,
628
+			true
629
+		);
630
+		// the final template wrapper
631
+		$this->display_admin_page_with_no_sidebar();
632
+	}
633 633
 
634 634
 
635
-    /**
636
-     * Generates Business Report showing total registrations per day.
637
-     *
638
-     * @param string $period The period (acceptable by PHP Datetime constructor) for which the report is generated.
639
-     * @return string
640
-     * @throws EE_Error
641
-     * @throws InvalidArgumentException
642
-     * @throws InvalidDataTypeException
643
-     * @throws InvalidInterfaceException
644
-     */
645
-    private function _registrations_per_day_report($period = '-1 month')
646
-    {
647
-        $report_ID = 'reg-admin-registrations-per-day-report-dv';
648
-        $results = EEM_Registration::instance()->get_registrations_per_day_and_per_status_report($period);
649
-        $results = (array) $results;
650
-        $regs = array();
651
-        $subtitle = '';
652
-        if ($results) {
653
-            $column_titles = array();
654
-            $tracker = 0;
655
-            foreach ($results as $result) {
656
-                $report_column_values = array();
657
-                foreach ($result as $property_name => $property_value) {
658
-                    $property_value = $property_name === 'Registration_REG_date' ? $property_value
659
-                        : (int) $property_value;
660
-                    $report_column_values[] = $property_value;
661
-                    if ($tracker === 0) {
662
-                        if ($property_name === 'Registration_REG_date') {
663
-                            $column_titles[] = esc_html__(
664
-                                'Date (only days with registrations are shown)',
665
-                                'event_espresso'
666
-                            );
667
-                        } else {
668
-                            $column_titles[] = EEH_Template::pretty_status($property_name, false, 'sentence');
669
-                        }
670
-                    }
671
-                }
672
-                $tracker++;
673
-                $regs[] = $report_column_values;
674
-            }
675
-            // make sure the column_titles is pushed to the beginning of the array
676
-            array_unshift($regs, $column_titles);
677
-            // setup the date range.
678
-            $DateTimeZone = new DateTimeZone(EEH_DTT_Helper::get_timezone());
679
-            $beginning_date = new DateTime("now " . $period, $DateTimeZone);
680
-            $ending_date = new DateTime("now", $DateTimeZone);
681
-            $subtitle = sprintf(
682
-                _x('For the period: %1$s to %2$s', 'Used to give date range', 'event_espresso'),
683
-                $beginning_date->format('Y-m-d'),
684
-                $ending_date->format('Y-m-d')
685
-            );
686
-        }
687
-        $report_title = esc_html__('Total Registrations per Day', 'event_espresso');
688
-        $report_params = array(
689
-            'title'     => $report_title,
690
-            'subtitle'  => $subtitle,
691
-            'id'        => $report_ID,
692
-            'regs'      => $regs,
693
-            'noResults' => empty($regs),
694
-            'noRegsMsg' => sprintf(
695
-                esc_html__(
696
-                    '%sThere are currently no registration records in the last month for this report.%s',
697
-                    'event_espresso'
698
-                ),
699
-                '<h2>' . $report_title . '</h2><p>',
700
-                '</p>'
701
-            ),
702
-        );
703
-        wp_localize_script('ee-reg-reports-js', 'regPerDay', $report_params);
704
-        return $report_ID;
705
-    }
635
+	/**
636
+	 * Generates Business Report showing total registrations per day.
637
+	 *
638
+	 * @param string $period The period (acceptable by PHP Datetime constructor) for which the report is generated.
639
+	 * @return string
640
+	 * @throws EE_Error
641
+	 * @throws InvalidArgumentException
642
+	 * @throws InvalidDataTypeException
643
+	 * @throws InvalidInterfaceException
644
+	 */
645
+	private function _registrations_per_day_report($period = '-1 month')
646
+	{
647
+		$report_ID = 'reg-admin-registrations-per-day-report-dv';
648
+		$results = EEM_Registration::instance()->get_registrations_per_day_and_per_status_report($period);
649
+		$results = (array) $results;
650
+		$regs = array();
651
+		$subtitle = '';
652
+		if ($results) {
653
+			$column_titles = array();
654
+			$tracker = 0;
655
+			foreach ($results as $result) {
656
+				$report_column_values = array();
657
+				foreach ($result as $property_name => $property_value) {
658
+					$property_value = $property_name === 'Registration_REG_date' ? $property_value
659
+						: (int) $property_value;
660
+					$report_column_values[] = $property_value;
661
+					if ($tracker === 0) {
662
+						if ($property_name === 'Registration_REG_date') {
663
+							$column_titles[] = esc_html__(
664
+								'Date (only days with registrations are shown)',
665
+								'event_espresso'
666
+							);
667
+						} else {
668
+							$column_titles[] = EEH_Template::pretty_status($property_name, false, 'sentence');
669
+						}
670
+					}
671
+				}
672
+				$tracker++;
673
+				$regs[] = $report_column_values;
674
+			}
675
+			// make sure the column_titles is pushed to the beginning of the array
676
+			array_unshift($regs, $column_titles);
677
+			// setup the date range.
678
+			$DateTimeZone = new DateTimeZone(EEH_DTT_Helper::get_timezone());
679
+			$beginning_date = new DateTime("now " . $period, $DateTimeZone);
680
+			$ending_date = new DateTime("now", $DateTimeZone);
681
+			$subtitle = sprintf(
682
+				_x('For the period: %1$s to %2$s', 'Used to give date range', 'event_espresso'),
683
+				$beginning_date->format('Y-m-d'),
684
+				$ending_date->format('Y-m-d')
685
+			);
686
+		}
687
+		$report_title = esc_html__('Total Registrations per Day', 'event_espresso');
688
+		$report_params = array(
689
+			'title'     => $report_title,
690
+			'subtitle'  => $subtitle,
691
+			'id'        => $report_ID,
692
+			'regs'      => $regs,
693
+			'noResults' => empty($regs),
694
+			'noRegsMsg' => sprintf(
695
+				esc_html__(
696
+					'%sThere are currently no registration records in the last month for this report.%s',
697
+					'event_espresso'
698
+				),
699
+				'<h2>' . $report_title . '</h2><p>',
700
+				'</p>'
701
+			),
702
+		);
703
+		wp_localize_script('ee-reg-reports-js', 'regPerDay', $report_params);
704
+		return $report_ID;
705
+	}
706 706
 
707 707
 
708
-    /**
709
-     * Generates Business Report showing total registrations per event.
710
-     *
711
-     * @param string $period The period (acceptable by PHP Datetime constructor) for which the report is generated.
712
-     * @return string
713
-     * @throws EE_Error
714
-     * @throws InvalidArgumentException
715
-     * @throws InvalidDataTypeException
716
-     * @throws InvalidInterfaceException
717
-     */
718
-    private function _registrations_per_event_report($period = '-1 month')
719
-    {
720
-        $report_ID = 'reg-admin-registrations-per-event-report-dv';
721
-        $results = EEM_Registration::instance()->get_registrations_per_event_and_per_status_report($period);
722
-        $results = (array) $results;
723
-        $regs = array();
724
-        $subtitle = '';
725
-        if ($results) {
726
-            $column_titles = array();
727
-            $tracker = 0;
728
-            foreach ($results as $result) {
729
-                $report_column_values = array();
730
-                foreach ($result as $property_name => $property_value) {
731
-                    $property_value = $property_name === 'Registration_Event' ? wp_trim_words(
732
-                        $property_value,
733
-                        4,
734
-                        '...'
735
-                    ) : (int) $property_value;
736
-                    $report_column_values[] = $property_value;
737
-                    if ($tracker === 0) {
738
-                        if ($property_name === 'Registration_Event') {
739
-                            $column_titles[] = esc_html__('Event', 'event_espresso');
740
-                        } else {
741
-                            $column_titles[] = EEH_Template::pretty_status($property_name, false, 'sentence');
742
-                        }
743
-                    }
744
-                }
745
-                $tracker++;
746
-                $regs[] = $report_column_values;
747
-            }
748
-            // make sure the column_titles is pushed to the beginning of the array
749
-            array_unshift($regs, $column_titles);
750
-            // setup the date range.
751
-            $DateTimeZone = new DateTimeZone(EEH_DTT_Helper::get_timezone());
752
-            $beginning_date = new DateTime("now " . $period, $DateTimeZone);
753
-            $ending_date = new DateTime("now", $DateTimeZone);
754
-            $subtitle = sprintf(
755
-                _x('For the period: %1$s to %2$s', 'Used to give date range', 'event_espresso'),
756
-                $beginning_date->format('Y-m-d'),
757
-                $ending_date->format('Y-m-d')
758
-            );
759
-        }
760
-        $report_title = esc_html__('Total Registrations per Event', 'event_espresso');
761
-        $report_params = array(
762
-            'title'     => $report_title,
763
-            'subtitle'  => $subtitle,
764
-            'id'        => $report_ID,
765
-            'regs'      => $regs,
766
-            'noResults' => empty($regs),
767
-            'noRegsMsg' => sprintf(
768
-                esc_html__(
769
-                    '%sThere are currently no registration records in the last month for this report.%s',
770
-                    'event_espresso'
771
-                ),
772
-                '<h2>' . $report_title . '</h2><p>',
773
-                '</p>'
774
-            ),
775
-        );
776
-        wp_localize_script('ee-reg-reports-js', 'regPerEvent', $report_params);
777
-        return $report_ID;
778
-    }
708
+	/**
709
+	 * Generates Business Report showing total registrations per event.
710
+	 *
711
+	 * @param string $period The period (acceptable by PHP Datetime constructor) for which the report is generated.
712
+	 * @return string
713
+	 * @throws EE_Error
714
+	 * @throws InvalidArgumentException
715
+	 * @throws InvalidDataTypeException
716
+	 * @throws InvalidInterfaceException
717
+	 */
718
+	private function _registrations_per_event_report($period = '-1 month')
719
+	{
720
+		$report_ID = 'reg-admin-registrations-per-event-report-dv';
721
+		$results = EEM_Registration::instance()->get_registrations_per_event_and_per_status_report($period);
722
+		$results = (array) $results;
723
+		$regs = array();
724
+		$subtitle = '';
725
+		if ($results) {
726
+			$column_titles = array();
727
+			$tracker = 0;
728
+			foreach ($results as $result) {
729
+				$report_column_values = array();
730
+				foreach ($result as $property_name => $property_value) {
731
+					$property_value = $property_name === 'Registration_Event' ? wp_trim_words(
732
+						$property_value,
733
+						4,
734
+						'...'
735
+					) : (int) $property_value;
736
+					$report_column_values[] = $property_value;
737
+					if ($tracker === 0) {
738
+						if ($property_name === 'Registration_Event') {
739
+							$column_titles[] = esc_html__('Event', 'event_espresso');
740
+						} else {
741
+							$column_titles[] = EEH_Template::pretty_status($property_name, false, 'sentence');
742
+						}
743
+					}
744
+				}
745
+				$tracker++;
746
+				$regs[] = $report_column_values;
747
+			}
748
+			// make sure the column_titles is pushed to the beginning of the array
749
+			array_unshift($regs, $column_titles);
750
+			// setup the date range.
751
+			$DateTimeZone = new DateTimeZone(EEH_DTT_Helper::get_timezone());
752
+			$beginning_date = new DateTime("now " . $period, $DateTimeZone);
753
+			$ending_date = new DateTime("now", $DateTimeZone);
754
+			$subtitle = sprintf(
755
+				_x('For the period: %1$s to %2$s', 'Used to give date range', 'event_espresso'),
756
+				$beginning_date->format('Y-m-d'),
757
+				$ending_date->format('Y-m-d')
758
+			);
759
+		}
760
+		$report_title = esc_html__('Total Registrations per Event', 'event_espresso');
761
+		$report_params = array(
762
+			'title'     => $report_title,
763
+			'subtitle'  => $subtitle,
764
+			'id'        => $report_ID,
765
+			'regs'      => $regs,
766
+			'noResults' => empty($regs),
767
+			'noRegsMsg' => sprintf(
768
+				esc_html__(
769
+					'%sThere are currently no registration records in the last month for this report.%s',
770
+					'event_espresso'
771
+				),
772
+				'<h2>' . $report_title . '</h2><p>',
773
+				'</p>'
774
+			),
775
+		);
776
+		wp_localize_script('ee-reg-reports-js', 'regPerEvent', $report_params);
777
+		return $report_ID;
778
+	}
779 779
 
780 780
 
781
-    /**
782
-     * generates HTML for the Registration Check-in list table (showing all Check-ins for a specific registration)
783
-     *
784
-     * @access protected
785
-     * @return void
786
-     * @throws EE_Error
787
-     * @throws InvalidArgumentException
788
-     * @throws InvalidDataTypeException
789
-     * @throws InvalidInterfaceException
790
-     * @throws \EventEspresso\core\exceptions\EntityNotFoundException
791
-     */
792
-    protected function _registration_checkin_list_table()
793
-    {
794
-        do_action('AHEE_log', __FILE__, __FUNCTION__, '');
795
-        $reg_id = isset($this->_req_data['_REG_ID']) ? $this->_req_data['_REG_ID'] : null;
796
-        /** @var EE_Registration $registration */
797
-        $registration = EEM_Registration::instance()->get_one_by_ID($reg_id);
798
-        $attendee = $registration->attendee();
799
-        $this->_admin_page_title .= $this->get_action_link_or_button(
800
-            'new_registration',
801
-            'add-registrant',
802
-            array('event_id' => $registration->event_ID()),
803
-            'add-new-h2'
804
-        );
805
-        $checked_in = new CheckinStatusDashicon(EE_Checkin::status_checked_in);
806
-        $checked_out = new CheckinStatusDashicon(EE_Checkin::status_checked_out);
807
-        $legend_items = array(
808
-            'checkin'  => array(
809
-                'class' => $checked_in->cssClasses(),
810
-                'desc'  => $checked_in->legendLabel(),
811
-            ),
812
-            'checkout' => array(
813
-                'class' => $checked_out->cssClasses(),
814
-                'desc'  => $checked_out->legendLabel(),
815
-            ),
816
-        );
817
-        $this->_template_args['after_list_table'] = $this->_display_legend($legend_items);
818
-        $dtt_id = isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : null;
819
-        /** @var EE_Datetime $datetime */
820
-        $datetime = EEM_Datetime::instance()->get_one_by_ID($dtt_id);
821
-        $datetime_label = '';
822
-        if ($datetime instanceof EE_Datetime) {
823
-            $datetime_label = $datetime->get_dtt_display_name(true);
824
-            $datetime_label .= ! empty($datetime_label)
825
-                ? ' (' . $datetime->get_dtt_display_name() . ')'
826
-                : $datetime->get_dtt_display_name();
827
-        }
828
-        $datetime_link = ! empty($dtt_id) && $registration instanceof EE_Registration
829
-            ? EE_Admin_Page::add_query_args_and_nonce(
830
-                array(
831
-                    'action'   => 'event_registrations',
832
-                    'event_id' => $registration->event_ID(),
833
-                    'DTT_ID'   => $dtt_id,
834
-                ),
835
-                $this->_admin_base_url
836
-            )
837
-            : '';
838
-        $datetime_link = ! empty($datetime_link)
839
-            ? '<a href="' . $datetime_link . '">'
840
-              . '<span id="checkin-dtt">'
841
-              . $datetime_label
842
-              . '</span></a>'
843
-            : $datetime_label;
844
-        $attendee_name = $attendee instanceof EE_Attendee
845
-            ? $attendee->full_name()
846
-            : '';
847
-        $attendee_link = $attendee instanceof EE_Attendee
848
-            ? $attendee->get_admin_details_link()
849
-            : '';
850
-        $attendee_link = ! empty($attendee_link)
851
-            ? '<a href="' . $attendee->get_admin_details_link() . '"'
852
-              . ' title="' . esc_html__('Click for attendee details', 'event_espresso') . '">'
853
-              . '<span id="checkin-attendee-name">'
854
-              . $attendee_name
855
-              . '</span></a>'
856
-            : '';
857
-        $event_link = $registration->event() instanceof EE_Event
858
-            ? $registration->event()->get_admin_details_link()
859
-            : '';
860
-        $event_link = ! empty($event_link)
861
-            ? '<a href="' . $event_link . '"'
862
-              . ' title="' . esc_html__('Click here to edit event.', 'event_espresso') . '">'
863
-              . '<span id="checkin-event-name">'
864
-              . $registration->event_name()
865
-              . '</span>'
866
-              . '</a>'
867
-            : '';
868
-        $this->_template_args['before_list_table'] = ! empty($reg_id) && ! empty($dtt_id)
869
-            ? '<h2>' . sprintf(
870
-                esc_html__('Displaying check in records for %1$s for %2$s at the event, %3$s', 'event_espresso'),
871
-                $attendee_link,
872
-                $datetime_link,
873
-                $event_link
874
-            ) . '</h2>'
875
-            : '';
876
-        $this->_template_args['list_table_hidden_fields'] = ! empty($reg_id)
877
-            ? '<input type="hidden" name="_REG_ID" value="' . $reg_id . '">' : '';
878
-        $this->_template_args['list_table_hidden_fields'] .= ! empty($dtt_id)
879
-            ? '<input type="hidden" name="DTT_ID" value="' . $dtt_id . '">' : '';
880
-        $this->display_admin_list_table_page_with_no_sidebar();
881
-    }
781
+	/**
782
+	 * generates HTML for the Registration Check-in list table (showing all Check-ins for a specific registration)
783
+	 *
784
+	 * @access protected
785
+	 * @return void
786
+	 * @throws EE_Error
787
+	 * @throws InvalidArgumentException
788
+	 * @throws InvalidDataTypeException
789
+	 * @throws InvalidInterfaceException
790
+	 * @throws \EventEspresso\core\exceptions\EntityNotFoundException
791
+	 */
792
+	protected function _registration_checkin_list_table()
793
+	{
794
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
795
+		$reg_id = isset($this->_req_data['_REG_ID']) ? $this->_req_data['_REG_ID'] : null;
796
+		/** @var EE_Registration $registration */
797
+		$registration = EEM_Registration::instance()->get_one_by_ID($reg_id);
798
+		$attendee = $registration->attendee();
799
+		$this->_admin_page_title .= $this->get_action_link_or_button(
800
+			'new_registration',
801
+			'add-registrant',
802
+			array('event_id' => $registration->event_ID()),
803
+			'add-new-h2'
804
+		);
805
+		$checked_in = new CheckinStatusDashicon(EE_Checkin::status_checked_in);
806
+		$checked_out = new CheckinStatusDashicon(EE_Checkin::status_checked_out);
807
+		$legend_items = array(
808
+			'checkin'  => array(
809
+				'class' => $checked_in->cssClasses(),
810
+				'desc'  => $checked_in->legendLabel(),
811
+			),
812
+			'checkout' => array(
813
+				'class' => $checked_out->cssClasses(),
814
+				'desc'  => $checked_out->legendLabel(),
815
+			),
816
+		);
817
+		$this->_template_args['after_list_table'] = $this->_display_legend($legend_items);
818
+		$dtt_id = isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : null;
819
+		/** @var EE_Datetime $datetime */
820
+		$datetime = EEM_Datetime::instance()->get_one_by_ID($dtt_id);
821
+		$datetime_label = '';
822
+		if ($datetime instanceof EE_Datetime) {
823
+			$datetime_label = $datetime->get_dtt_display_name(true);
824
+			$datetime_label .= ! empty($datetime_label)
825
+				? ' (' . $datetime->get_dtt_display_name() . ')'
826
+				: $datetime->get_dtt_display_name();
827
+		}
828
+		$datetime_link = ! empty($dtt_id) && $registration instanceof EE_Registration
829
+			? EE_Admin_Page::add_query_args_and_nonce(
830
+				array(
831
+					'action'   => 'event_registrations',
832
+					'event_id' => $registration->event_ID(),
833
+					'DTT_ID'   => $dtt_id,
834
+				),
835
+				$this->_admin_base_url
836
+			)
837
+			: '';
838
+		$datetime_link = ! empty($datetime_link)
839
+			? '<a href="' . $datetime_link . '">'
840
+			  . '<span id="checkin-dtt">'
841
+			  . $datetime_label
842
+			  . '</span></a>'
843
+			: $datetime_label;
844
+		$attendee_name = $attendee instanceof EE_Attendee
845
+			? $attendee->full_name()
846
+			: '';
847
+		$attendee_link = $attendee instanceof EE_Attendee
848
+			? $attendee->get_admin_details_link()
849
+			: '';
850
+		$attendee_link = ! empty($attendee_link)
851
+			? '<a href="' . $attendee->get_admin_details_link() . '"'
852
+			  . ' title="' . esc_html__('Click for attendee details', 'event_espresso') . '">'
853
+			  . '<span id="checkin-attendee-name">'
854
+			  . $attendee_name
855
+			  . '</span></a>'
856
+			: '';
857
+		$event_link = $registration->event() instanceof EE_Event
858
+			? $registration->event()->get_admin_details_link()
859
+			: '';
860
+		$event_link = ! empty($event_link)
861
+			? '<a href="' . $event_link . '"'
862
+			  . ' title="' . esc_html__('Click here to edit event.', 'event_espresso') . '">'
863
+			  . '<span id="checkin-event-name">'
864
+			  . $registration->event_name()
865
+			  . '</span>'
866
+			  . '</a>'
867
+			: '';
868
+		$this->_template_args['before_list_table'] = ! empty($reg_id) && ! empty($dtt_id)
869
+			? '<h2>' . sprintf(
870
+				esc_html__('Displaying check in records for %1$s for %2$s at the event, %3$s', 'event_espresso'),
871
+				$attendee_link,
872
+				$datetime_link,
873
+				$event_link
874
+			) . '</h2>'
875
+			: '';
876
+		$this->_template_args['list_table_hidden_fields'] = ! empty($reg_id)
877
+			? '<input type="hidden" name="_REG_ID" value="' . $reg_id . '">' : '';
878
+		$this->_template_args['list_table_hidden_fields'] .= ! empty($dtt_id)
879
+			? '<input type="hidden" name="DTT_ID" value="' . $dtt_id . '">' : '';
880
+		$this->display_admin_list_table_page_with_no_sidebar();
881
+	}
882 882
 
883 883
 
884
-    /**
885
-     * toggle the Check-in status for the given registration (coming from ajax)
886
-     *
887
-     * @return void (JSON)
888
-     * @throws EE_Error
889
-     * @throws InvalidArgumentException
890
-     * @throws InvalidDataTypeException
891
-     * @throws InvalidInterfaceException
892
-     */
893
-    public function toggle_checkin_status()
894
-    {
895
-        // first make sure we have the necessary data
896
-        if (! isset($this->_req_data['_regid'])) {
897
-            EE_Error::add_error(
898
-                esc_html__(
899
-                    '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',
900
-                    'event_espresso'
901
-                ),
902
-                __FILE__,
903
-                __FUNCTION__,
904
-                __LINE__
905
-            );
906
-            $this->_template_args['success'] = false;
907
-            $this->_template_args['error'] = true;
908
-            $this->_return_json();
909
-        };
910
-        // do a nonce check cause we're not coming in from an normal route here.
911
-        $nonce = isset($this->_req_data['checkinnonce']) ? sanitize_text_field($this->_req_data['checkinnonce'])
912
-            : '';
913
-        $nonce_ref = 'checkin_nonce';
914
-        $this->_verify_nonce($nonce, $nonce_ref);
915
-        // beautiful! Made it this far so let's get the status.
916
-        $new_status = new CheckinStatusDashicon($this->_toggle_checkin_status());
917
-        // setup new class to return via ajax
918
-        $this->_template_args['admin_page_content'] = 'clickable trigger-checkin ' . $new_status->cssClasses();
919
-        $this->_template_args['success'] = true;
920
-        $this->_return_json();
921
-    }
884
+	/**
885
+	 * toggle the Check-in status for the given registration (coming from ajax)
886
+	 *
887
+	 * @return void (JSON)
888
+	 * @throws EE_Error
889
+	 * @throws InvalidArgumentException
890
+	 * @throws InvalidDataTypeException
891
+	 * @throws InvalidInterfaceException
892
+	 */
893
+	public function toggle_checkin_status()
894
+	{
895
+		// first make sure we have the necessary data
896
+		if (! isset($this->_req_data['_regid'])) {
897
+			EE_Error::add_error(
898
+				esc_html__(
899
+					'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',
900
+					'event_espresso'
901
+				),
902
+				__FILE__,
903
+				__FUNCTION__,
904
+				__LINE__
905
+			);
906
+			$this->_template_args['success'] = false;
907
+			$this->_template_args['error'] = true;
908
+			$this->_return_json();
909
+		};
910
+		// do a nonce check cause we're not coming in from an normal route here.
911
+		$nonce = isset($this->_req_data['checkinnonce']) ? sanitize_text_field($this->_req_data['checkinnonce'])
912
+			: '';
913
+		$nonce_ref = 'checkin_nonce';
914
+		$this->_verify_nonce($nonce, $nonce_ref);
915
+		// beautiful! Made it this far so let's get the status.
916
+		$new_status = new CheckinStatusDashicon($this->_toggle_checkin_status());
917
+		// setup new class to return via ajax
918
+		$this->_template_args['admin_page_content'] = 'clickable trigger-checkin ' . $new_status->cssClasses();
919
+		$this->_template_args['success'] = true;
920
+		$this->_return_json();
921
+	}
922 922
 
923 923
 
924
-    /**
925
-     * handles toggling the checkin status for the registration,
926
-     *
927
-     * @access protected
928
-     * @return int|void
929
-     * @throws EE_Error
930
-     * @throws InvalidArgumentException
931
-     * @throws InvalidDataTypeException
932
-     * @throws InvalidInterfaceException
933
-     */
934
-    protected function _toggle_checkin_status()
935
-    {
936
-        // first let's get the query args out of the way for the redirect
937
-        $query_args = array(
938
-            'action'   => 'event_registrations',
939
-            'event_id' => isset($this->_req_data['event_id']) ? $this->_req_data['event_id'] : null,
940
-            'DTT_ID'   => isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : null,
941
-        );
942
-        $new_status = false;
943
-        // bulk action check in toggle
944
-        if (! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
945
-            // cycle thru checkboxes
946
-            while (list($REG_ID, $value) = each($this->_req_data['checkbox'])) {
947
-                $DTT_ID = isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : null;
948
-                $new_status = $this->_toggle_checkin($REG_ID, $DTT_ID);
949
-            }
950
-        } elseif (isset($this->_req_data['_regid'])) {
951
-            // coming from ajax request
952
-            $DTT_ID = isset($this->_req_data['dttid']) ? $this->_req_data['dttid'] : null;
953
-            $query_args['DTT_ID'] = $DTT_ID;
954
-            $new_status = $this->_toggle_checkin($this->_req_data['_regid'], $DTT_ID);
955
-        } else {
956
-            EE_Error::add_error(
957
-                esc_html__('Missing some required data to toggle the Check-in', 'event_espresso'),
958
-                __FILE__,
959
-                __FUNCTION__,
960
-                __LINE__
961
-            );
962
-        }
963
-        if (defined('DOING_AJAX')) {
964
-            return $new_status;
965
-        }
966
-        $this->_redirect_after_action(false, '', '', $query_args, true);
967
-    }
924
+	/**
925
+	 * handles toggling the checkin status for the registration,
926
+	 *
927
+	 * @access protected
928
+	 * @return int|void
929
+	 * @throws EE_Error
930
+	 * @throws InvalidArgumentException
931
+	 * @throws InvalidDataTypeException
932
+	 * @throws InvalidInterfaceException
933
+	 */
934
+	protected function _toggle_checkin_status()
935
+	{
936
+		// first let's get the query args out of the way for the redirect
937
+		$query_args = array(
938
+			'action'   => 'event_registrations',
939
+			'event_id' => isset($this->_req_data['event_id']) ? $this->_req_data['event_id'] : null,
940
+			'DTT_ID'   => isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : null,
941
+		);
942
+		$new_status = false;
943
+		// bulk action check in toggle
944
+		if (! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
945
+			// cycle thru checkboxes
946
+			while (list($REG_ID, $value) = each($this->_req_data['checkbox'])) {
947
+				$DTT_ID = isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : null;
948
+				$new_status = $this->_toggle_checkin($REG_ID, $DTT_ID);
949
+			}
950
+		} elseif (isset($this->_req_data['_regid'])) {
951
+			// coming from ajax request
952
+			$DTT_ID = isset($this->_req_data['dttid']) ? $this->_req_data['dttid'] : null;
953
+			$query_args['DTT_ID'] = $DTT_ID;
954
+			$new_status = $this->_toggle_checkin($this->_req_data['_regid'], $DTT_ID);
955
+		} else {
956
+			EE_Error::add_error(
957
+				esc_html__('Missing some required data to toggle the Check-in', 'event_espresso'),
958
+				__FILE__,
959
+				__FUNCTION__,
960
+				__LINE__
961
+			);
962
+		}
963
+		if (defined('DOING_AJAX')) {
964
+			return $new_status;
965
+		}
966
+		$this->_redirect_after_action(false, '', '', $query_args, true);
967
+	}
968 968
 
969 969
 
970
-    /**
971
-     * This is toggles a single Check-in for the given registration and datetime.
972
-     *
973
-     * @param  int $REG_ID The registration we're toggling
974
-     * @param  int $DTT_ID The datetime we're toggling
975
-     * @return int The new status toggled to.
976
-     * @throws EE_Error
977
-     * @throws InvalidArgumentException
978
-     * @throws InvalidDataTypeException
979
-     * @throws InvalidInterfaceException
980
-     */
981
-    private function _toggle_checkin($REG_ID, $DTT_ID)
982
-    {
983
-        /** @var EE_Registration $REG */
984
-        $REG = EEM_Registration::instance()->get_one_by_ID($REG_ID);
985
-        $new_status = $REG->toggle_checkin_status($DTT_ID);
986
-        if ($new_status !== false) {
987
-            EE_Error::add_success($REG->get_checkin_msg($DTT_ID));
988
-        } else {
989
-            EE_Error::add_error($REG->get_checkin_msg($DTT_ID, true), __FILE__, __FUNCTION__, __LINE__);
990
-            $new_status = false;
991
-        }
992
-        return $new_status;
993
-    }
970
+	/**
971
+	 * This is toggles a single Check-in for the given registration and datetime.
972
+	 *
973
+	 * @param  int $REG_ID The registration we're toggling
974
+	 * @param  int $DTT_ID The datetime we're toggling
975
+	 * @return int The new status toggled to.
976
+	 * @throws EE_Error
977
+	 * @throws InvalidArgumentException
978
+	 * @throws InvalidDataTypeException
979
+	 * @throws InvalidInterfaceException
980
+	 */
981
+	private function _toggle_checkin($REG_ID, $DTT_ID)
982
+	{
983
+		/** @var EE_Registration $REG */
984
+		$REG = EEM_Registration::instance()->get_one_by_ID($REG_ID);
985
+		$new_status = $REG->toggle_checkin_status($DTT_ID);
986
+		if ($new_status !== false) {
987
+			EE_Error::add_success($REG->get_checkin_msg($DTT_ID));
988
+		} else {
989
+			EE_Error::add_error($REG->get_checkin_msg($DTT_ID, true), __FILE__, __FUNCTION__, __LINE__);
990
+			$new_status = false;
991
+		}
992
+		return $new_status;
993
+	}
994 994
 
995 995
 
996
-    /**
997
-     * Takes care of deleting multiple EE_Checkin table rows
998
-     *
999
-     * @access protected
1000
-     * @return void
1001
-     * @throws EE_Error
1002
-     * @throws InvalidArgumentException
1003
-     * @throws InvalidDataTypeException
1004
-     * @throws InvalidInterfaceException
1005
-     */
1006
-    protected function _delete_checkin_rows()
1007
-    {
1008
-        $query_args = array(
1009
-            'action'  => 'registration_checkins',
1010
-            'DTT_ID'  => isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : 0,
1011
-            '_REG_ID' => isset($this->_req_data['_REG_ID']) ? $this->_req_data['_REG_ID'] : 0,
1012
-        );
1013
-        $errors = 0;
1014
-        if (! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
1015
-            while (list($CHK_ID, $value) = each($this->_req_data['checkbox'])) {
1016
-                if (! EEM_Checkin::instance()->delete_by_ID($CHK_ID)) {
1017
-                    $errors++;
1018
-                }
1019
-            }
1020
-        } else {
1021
-            EE_Error::add_error(
1022
-                esc_html__(
1023
-                    'So, something went wrong with the bulk delete because there was no data received for instructions on WHAT to delete!',
1024
-                    'event_espresso'
1025
-                ),
1026
-                __FILE__,
1027
-                __FUNCTION__,
1028
-                __LINE__
1029
-            );
1030
-            $this->_redirect_after_action(false, '', '', $query_args, true);
1031
-        }
1032
-        if ($errors > 0) {
1033
-            EE_Error::add_error(
1034
-                sprintf(__('There were %d records that did not delete successfully', 'event_espresso'), $errors),
1035
-                __FILE__,
1036
-                __FUNCTION__,
1037
-                __LINE__
1038
-            );
1039
-        } else {
1040
-            EE_Error::add_success(__('Records were successfully deleted', 'event_espresso'));
1041
-        }
1042
-        $this->_redirect_after_action(false, '', '', $query_args, true);
1043
-    }
996
+	/**
997
+	 * Takes care of deleting multiple EE_Checkin table rows
998
+	 *
999
+	 * @access protected
1000
+	 * @return void
1001
+	 * @throws EE_Error
1002
+	 * @throws InvalidArgumentException
1003
+	 * @throws InvalidDataTypeException
1004
+	 * @throws InvalidInterfaceException
1005
+	 */
1006
+	protected function _delete_checkin_rows()
1007
+	{
1008
+		$query_args = array(
1009
+			'action'  => 'registration_checkins',
1010
+			'DTT_ID'  => isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : 0,
1011
+			'_REG_ID' => isset($this->_req_data['_REG_ID']) ? $this->_req_data['_REG_ID'] : 0,
1012
+		);
1013
+		$errors = 0;
1014
+		if (! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
1015
+			while (list($CHK_ID, $value) = each($this->_req_data['checkbox'])) {
1016
+				if (! EEM_Checkin::instance()->delete_by_ID($CHK_ID)) {
1017
+					$errors++;
1018
+				}
1019
+			}
1020
+		} else {
1021
+			EE_Error::add_error(
1022
+				esc_html__(
1023
+					'So, something went wrong with the bulk delete because there was no data received for instructions on WHAT to delete!',
1024
+					'event_espresso'
1025
+				),
1026
+				__FILE__,
1027
+				__FUNCTION__,
1028
+				__LINE__
1029
+			);
1030
+			$this->_redirect_after_action(false, '', '', $query_args, true);
1031
+		}
1032
+		if ($errors > 0) {
1033
+			EE_Error::add_error(
1034
+				sprintf(__('There were %d records that did not delete successfully', 'event_espresso'), $errors),
1035
+				__FILE__,
1036
+				__FUNCTION__,
1037
+				__LINE__
1038
+			);
1039
+		} else {
1040
+			EE_Error::add_success(__('Records were successfully deleted', 'event_espresso'));
1041
+		}
1042
+		$this->_redirect_after_action(false, '', '', $query_args, true);
1043
+	}
1044 1044
 
1045 1045
 
1046
-    /**
1047
-     * Deletes a single EE_Checkin row
1048
-     *
1049
-     * @return void
1050
-     * @throws EE_Error
1051
-     * @throws InvalidArgumentException
1052
-     * @throws InvalidDataTypeException
1053
-     * @throws InvalidInterfaceException
1054
-     */
1055
-    protected function _delete_checkin_row()
1056
-    {
1057
-        $query_args = array(
1058
-            'action'  => 'registration_checkins',
1059
-            'DTT_ID'  => isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : 0,
1060
-            '_REG_ID' => isset($this->_req_data['_REG_ID']) ? $this->_req_data['_REG_ID'] : 0,
1061
-        );
1062
-        if (! empty($this->_req_data['CHK_ID'])) {
1063
-            if (! EEM_Checkin::instance()->delete_by_ID($this->_req_data['CHK_ID'])) {
1064
-                EE_Error::add_error(
1065
-                    esc_html__('Something went wrong and this check-in record was not deleted', 'event_espresso'),
1066
-                    __FILE__,
1067
-                    __FUNCTION__,
1068
-                    __LINE__
1069
-                );
1070
-            } else {
1071
-                EE_Error::add_success(__('Check-In record successfully deleted', 'event_espresso'));
1072
-            }
1073
-        } else {
1074
-            EE_Error::add_error(
1075
-                esc_html__(
1076
-                    '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',
1077
-                    'event_espresso'
1078
-                ),
1079
-                __FILE__,
1080
-                __FUNCTION__,
1081
-                __LINE__
1082
-            );
1083
-        }
1084
-        $this->_redirect_after_action(false, '', '', $query_args, true);
1085
-    }
1046
+	/**
1047
+	 * Deletes a single EE_Checkin row
1048
+	 *
1049
+	 * @return void
1050
+	 * @throws EE_Error
1051
+	 * @throws InvalidArgumentException
1052
+	 * @throws InvalidDataTypeException
1053
+	 * @throws InvalidInterfaceException
1054
+	 */
1055
+	protected function _delete_checkin_row()
1056
+	{
1057
+		$query_args = array(
1058
+			'action'  => 'registration_checkins',
1059
+			'DTT_ID'  => isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : 0,
1060
+			'_REG_ID' => isset($this->_req_data['_REG_ID']) ? $this->_req_data['_REG_ID'] : 0,
1061
+		);
1062
+		if (! empty($this->_req_data['CHK_ID'])) {
1063
+			if (! EEM_Checkin::instance()->delete_by_ID($this->_req_data['CHK_ID'])) {
1064
+				EE_Error::add_error(
1065
+					esc_html__('Something went wrong and this check-in record was not deleted', 'event_espresso'),
1066
+					__FILE__,
1067
+					__FUNCTION__,
1068
+					__LINE__
1069
+				);
1070
+			} else {
1071
+				EE_Error::add_success(__('Check-In record successfully deleted', 'event_espresso'));
1072
+			}
1073
+		} else {
1074
+			EE_Error::add_error(
1075
+				esc_html__(
1076
+					'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',
1077
+					'event_espresso'
1078
+				),
1079
+				__FILE__,
1080
+				__FUNCTION__,
1081
+				__LINE__
1082
+			);
1083
+		}
1084
+		$this->_redirect_after_action(false, '', '', $query_args, true);
1085
+	}
1086 1086
 
1087 1087
 
1088
-    /**
1089
-     *        generates HTML for the Event Registrations List Table
1090
-     *
1091
-     * @access protected
1092
-     * @return void
1093
-     * @throws EE_Error
1094
-     * @throws InvalidArgumentException
1095
-     * @throws InvalidDataTypeException
1096
-     * @throws InvalidInterfaceException
1097
-     */
1098
-    protected function _event_registrations_list_table()
1099
-    {
1100
-        do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1101
-        $this->_admin_page_title .= isset($this->_req_data['event_id'])
1102
-            ? $this->get_action_link_or_button(
1103
-                'new_registration',
1104
-                'add-registrant',
1105
-                array('event_id' => $this->_req_data['event_id']),
1106
-                'add-new-h2',
1107
-                '',
1108
-                false
1109
-            )
1110
-            : '';
1111
-        $checked_in = new CheckinStatusDashicon(EE_Checkin::status_checked_in);
1112
-        $checked_out = new CheckinStatusDashicon(EE_Checkin::status_checked_out);
1113
-        $checked_never = new CheckinStatusDashicon(EE_Checkin::status_checked_never);
1114
-        $legend_items = array(
1115
-            'star-icon'        => array(
1116
-                'class' => 'dashicons dashicons-star-filled lt-blue-icon ee-icon-size-8',
1117
-                'desc'  => esc_html__('This Registrant is the Primary Registrant', 'event_espresso'),
1118
-            ),
1119
-            'checkin'          => array(
1120
-                'class' => $checked_in->cssClasses(),
1121
-                'desc'  => $checked_in->legendLabel(),
1122
-            ),
1123
-            'checkout'         => array(
1124
-                'class' => $checked_out->cssClasses(),
1125
-                'desc'  => $checked_out->legendLabel(),
1126
-            ),
1127
-            'nocheckinrecord'  => array(
1128
-                'class' => $checked_never->cssClasses(),
1129
-                'desc'  => $checked_never->legendLabel(),
1130
-            ),
1131
-            'approved_status'  => array(
1132
-                'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_approved,
1133
-                'desc'  => EEH_Template::pretty_status(EEM_Registration::status_id_approved, false, 'sentence'),
1134
-            ),
1135
-            'cancelled_status' => array(
1136
-                'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_cancelled,
1137
-                'desc'  => EEH_Template::pretty_status(EEM_Registration::status_id_cancelled, false, 'sentence'),
1138
-            ),
1139
-            'declined_status'  => array(
1140
-                'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_declined,
1141
-                'desc'  => EEH_Template::pretty_status(EEM_Registration::status_id_declined, false, 'sentence'),
1142
-            ),
1143
-            'not_approved'     => array(
1144
-                'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_not_approved,
1145
-                'desc'  => EEH_Template::pretty_status(EEM_Registration::status_id_not_approved, false, 'sentence'),
1146
-            ),
1147
-            'pending_status'   => array(
1148
-                'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_pending_payment,
1149
-                'desc'  => EEH_Template::pretty_status(EEM_Registration::status_id_pending_payment, false, 'sentence'),
1150
-            ),
1151
-            'wait_list'        => array(
1152
-                'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_wait_list,
1153
-                'desc'  => EEH_Template::pretty_status(EEM_Registration::status_id_wait_list, false, 'sentence'),
1154
-            ),
1155
-        );
1156
-        $this->_template_args['after_list_table'] = $this->_display_legend($legend_items);
1157
-        $event_id = isset($this->_req_data['event_id']) ? $this->_req_data['event_id'] : null;
1158
-        $this->_template_args['before_list_table'] = ! empty($event_id)
1159
-            ? '<h2>' . sprintf(
1160
-                esc_html__('Viewing Registrations for Event: %s', 'event_espresso'),
1161
-                EEM_Event::instance()->get_one_by_ID($event_id)->get('EVT_name')
1162
-            ) . '</h2>'
1163
-            : '';
1164
-        // need to get the number of datetimes on the event and set default datetime_id if there is only one datetime on
1165
-        // the event.
1166
-        /** @var EE_Event $event */
1167
-        $event = EEM_Event::instance()->get_one_by_ID($event_id);
1168
-        $DTT_ID = ! empty($this->_req_data['DTT_ID']) ? absint($this->_req_data['DTT_ID']) : 0;
1169
-        $datetime = null;
1170
-        if ($event instanceof EE_Event) {
1171
-            $datetimes_on_event = $event->datetimes();
1172
-            if (count($datetimes_on_event) === 1) {
1173
-                $datetime = reset($datetimes_on_event);
1174
-            }
1175
-        }
1176
-        $datetime = $datetime instanceof EE_Datetime ? $datetime : EEM_Datetime::instance()->get_one_by_ID($DTT_ID);
1177
-        if ($datetime instanceof EE_Datetime && $this->_template_args['before_list_table'] !== '') {
1178
-            $this->_template_args['before_list_table'] = substr($this->_template_args['before_list_table'], 0, -5);
1179
-            $this->_template_args['before_list_table'] .= ' &nbsp;<span class="drk-grey-text">';
1180
-            $this->_template_args['before_list_table'] .= '<span class="dashicons dashicons-calendar"></span>';
1181
-            $this->_template_args['before_list_table'] .= $datetime->name();
1182
-            $this->_template_args['before_list_table'] .= ' ( ' . $datetime->date_and_time_range() . ' )';
1183
-            $this->_template_args['before_list_table'] .= '</span></h2>';
1184
-        }
1185
-        // if no datetime, then we're on the initial view, so let's give some helpful instructions on what the status
1186
-        // column represents
1187
-        if (! $datetime instanceof EE_Datetime) {
1188
-            $this->_template_args['before_list_table'] .= '<br><p class="description">'
1189
-                                                          . esc_html__(
1190
-                                                              'In this view, the check-in status represents the latest check-in record for the registration in that row.',
1191
-                                                              'event_espresso'
1192
-                                                          )
1193
-                                                          . '</p>';
1194
-        }
1195
-        $this->display_admin_list_table_page_with_no_sidebar();
1196
-    }
1088
+	/**
1089
+	 *        generates HTML for the Event Registrations List Table
1090
+	 *
1091
+	 * @access protected
1092
+	 * @return void
1093
+	 * @throws EE_Error
1094
+	 * @throws InvalidArgumentException
1095
+	 * @throws InvalidDataTypeException
1096
+	 * @throws InvalidInterfaceException
1097
+	 */
1098
+	protected function _event_registrations_list_table()
1099
+	{
1100
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1101
+		$this->_admin_page_title .= isset($this->_req_data['event_id'])
1102
+			? $this->get_action_link_or_button(
1103
+				'new_registration',
1104
+				'add-registrant',
1105
+				array('event_id' => $this->_req_data['event_id']),
1106
+				'add-new-h2',
1107
+				'',
1108
+				false
1109
+			)
1110
+			: '';
1111
+		$checked_in = new CheckinStatusDashicon(EE_Checkin::status_checked_in);
1112
+		$checked_out = new CheckinStatusDashicon(EE_Checkin::status_checked_out);
1113
+		$checked_never = new CheckinStatusDashicon(EE_Checkin::status_checked_never);
1114
+		$legend_items = array(
1115
+			'star-icon'        => array(
1116
+				'class' => 'dashicons dashicons-star-filled lt-blue-icon ee-icon-size-8',
1117
+				'desc'  => esc_html__('This Registrant is the Primary Registrant', 'event_espresso'),
1118
+			),
1119
+			'checkin'          => array(
1120
+				'class' => $checked_in->cssClasses(),
1121
+				'desc'  => $checked_in->legendLabel(),
1122
+			),
1123
+			'checkout'         => array(
1124
+				'class' => $checked_out->cssClasses(),
1125
+				'desc'  => $checked_out->legendLabel(),
1126
+			),
1127
+			'nocheckinrecord'  => array(
1128
+				'class' => $checked_never->cssClasses(),
1129
+				'desc'  => $checked_never->legendLabel(),
1130
+			),
1131
+			'approved_status'  => array(
1132
+				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_approved,
1133
+				'desc'  => EEH_Template::pretty_status(EEM_Registration::status_id_approved, false, 'sentence'),
1134
+			),
1135
+			'cancelled_status' => array(
1136
+				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_cancelled,
1137
+				'desc'  => EEH_Template::pretty_status(EEM_Registration::status_id_cancelled, false, 'sentence'),
1138
+			),
1139
+			'declined_status'  => array(
1140
+				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_declined,
1141
+				'desc'  => EEH_Template::pretty_status(EEM_Registration::status_id_declined, false, 'sentence'),
1142
+			),
1143
+			'not_approved'     => array(
1144
+				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_not_approved,
1145
+				'desc'  => EEH_Template::pretty_status(EEM_Registration::status_id_not_approved, false, 'sentence'),
1146
+			),
1147
+			'pending_status'   => array(
1148
+				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_pending_payment,
1149
+				'desc'  => EEH_Template::pretty_status(EEM_Registration::status_id_pending_payment, false, 'sentence'),
1150
+			),
1151
+			'wait_list'        => array(
1152
+				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_wait_list,
1153
+				'desc'  => EEH_Template::pretty_status(EEM_Registration::status_id_wait_list, false, 'sentence'),
1154
+			),
1155
+		);
1156
+		$this->_template_args['after_list_table'] = $this->_display_legend($legend_items);
1157
+		$event_id = isset($this->_req_data['event_id']) ? $this->_req_data['event_id'] : null;
1158
+		$this->_template_args['before_list_table'] = ! empty($event_id)
1159
+			? '<h2>' . sprintf(
1160
+				esc_html__('Viewing Registrations for Event: %s', 'event_espresso'),
1161
+				EEM_Event::instance()->get_one_by_ID($event_id)->get('EVT_name')
1162
+			) . '</h2>'
1163
+			: '';
1164
+		// need to get the number of datetimes on the event and set default datetime_id if there is only one datetime on
1165
+		// the event.
1166
+		/** @var EE_Event $event */
1167
+		$event = EEM_Event::instance()->get_one_by_ID($event_id);
1168
+		$DTT_ID = ! empty($this->_req_data['DTT_ID']) ? absint($this->_req_data['DTT_ID']) : 0;
1169
+		$datetime = null;
1170
+		if ($event instanceof EE_Event) {
1171
+			$datetimes_on_event = $event->datetimes();
1172
+			if (count($datetimes_on_event) === 1) {
1173
+				$datetime = reset($datetimes_on_event);
1174
+			}
1175
+		}
1176
+		$datetime = $datetime instanceof EE_Datetime ? $datetime : EEM_Datetime::instance()->get_one_by_ID($DTT_ID);
1177
+		if ($datetime instanceof EE_Datetime && $this->_template_args['before_list_table'] !== '') {
1178
+			$this->_template_args['before_list_table'] = substr($this->_template_args['before_list_table'], 0, -5);
1179
+			$this->_template_args['before_list_table'] .= ' &nbsp;<span class="drk-grey-text">';
1180
+			$this->_template_args['before_list_table'] .= '<span class="dashicons dashicons-calendar"></span>';
1181
+			$this->_template_args['before_list_table'] .= $datetime->name();
1182
+			$this->_template_args['before_list_table'] .= ' ( ' . $datetime->date_and_time_range() . ' )';
1183
+			$this->_template_args['before_list_table'] .= '</span></h2>';
1184
+		}
1185
+		// if no datetime, then we're on the initial view, so let's give some helpful instructions on what the status
1186
+		// column represents
1187
+		if (! $datetime instanceof EE_Datetime) {
1188
+			$this->_template_args['before_list_table'] .= '<br><p class="description">'
1189
+														  . esc_html__(
1190
+															  'In this view, the check-in status represents the latest check-in record for the registration in that row.',
1191
+															  'event_espresso'
1192
+														  )
1193
+														  . '</p>';
1194
+		}
1195
+		$this->display_admin_list_table_page_with_no_sidebar();
1196
+	}
1197 1197
 
1198
-    /**
1199
-     * Download the registrations check-in report (same as the normal registration report, but with different where
1200
-     * conditions)
1201
-     *
1202
-     * @return void ends the request by a redirect or download
1203
-     */
1204
-    public function _registrations_checkin_report()
1205
-    {
1206
-        $this->_registrations_report_base('_get_checkin_query_params_from_request');
1207
-    }
1198
+	/**
1199
+	 * Download the registrations check-in report (same as the normal registration report, but with different where
1200
+	 * conditions)
1201
+	 *
1202
+	 * @return void ends the request by a redirect or download
1203
+	 */
1204
+	public function _registrations_checkin_report()
1205
+	{
1206
+		$this->_registrations_report_base('_get_checkin_query_params_from_request');
1207
+	}
1208 1208
 
1209
-    /**
1210
-     * Gets the query params from the request, plus adds a where condition for the registration status,
1211
-     * because on the checkin page we only ever want to see approved and pending-approval registrations
1212
-     *
1213
-     * @param array $request
1214
-     * @param int   $per_page
1215
-     * @param bool  $count
1216
-     * @return array
1217
-     * @throws EE_Error
1218
-     */
1219
-    protected function _get_checkin_query_params_from_request(
1220
-        $request,
1221
-        $per_page = 10,
1222
-        $count = false
1223
-    ) {
1224
-        $query_params = $this->_get_registration_query_parameters($request, $per_page, $count);
1225
-        // unlike the regular registrations list table,
1226
-        $status_ids_array = apply_filters(
1227
-            'FHEE__Extend_Registrations_Admin_Page__get_event_attendees__status_ids_array',
1228
-            array(EEM_Registration::status_id_pending_payment, EEM_Registration::status_id_approved)
1229
-        );
1230
-        $query_params[0]['STS_ID'] = array('IN', $status_ids_array);
1231
-        return $query_params;
1232
-    }
1209
+	/**
1210
+	 * Gets the query params from the request, plus adds a where condition for the registration status,
1211
+	 * because on the checkin page we only ever want to see approved and pending-approval registrations
1212
+	 *
1213
+	 * @param array $request
1214
+	 * @param int   $per_page
1215
+	 * @param bool  $count
1216
+	 * @return array
1217
+	 * @throws EE_Error
1218
+	 */
1219
+	protected function _get_checkin_query_params_from_request(
1220
+		$request,
1221
+		$per_page = 10,
1222
+		$count = false
1223
+	) {
1224
+		$query_params = $this->_get_registration_query_parameters($request, $per_page, $count);
1225
+		// unlike the regular registrations list table,
1226
+		$status_ids_array = apply_filters(
1227
+			'FHEE__Extend_Registrations_Admin_Page__get_event_attendees__status_ids_array',
1228
+			array(EEM_Registration::status_id_pending_payment, EEM_Registration::status_id_approved)
1229
+		);
1230
+		$query_params[0]['STS_ID'] = array('IN', $status_ids_array);
1231
+		return $query_params;
1232
+	}
1233 1233
 
1234 1234
 
1235
-    /**
1236
-     * Gets registrations for an event
1237
-     *
1238
-     * @param int    $per_page
1239
-     * @param bool   $count whether to return count or data.
1240
-     * @param bool   $trash
1241
-     * @param string $orderby
1242
-     * @return EE_Registration[]|int
1243
-     * @throws EE_Error
1244
-     * @throws InvalidArgumentException
1245
-     * @throws InvalidDataTypeException
1246
-     * @throws InvalidInterfaceException
1247
-     */
1248
-    public function get_event_attendees($per_page = 10, $count = false, $trash = false, $orderby = 'ATT_fname')
1249
-    {
1250
-        // normalize some request params that get setup by the parent `get_registrations` method.
1251
-        $request = $this->_req_data;
1252
-        $request['orderby'] = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : $orderby;
1253
-        $request['order'] = ! empty($this->_req_data['order']) ? $this->_req_data['order'] : 'ASC';
1254
-        if ($trash) {
1255
-            $request['status'] = 'trash';
1256
-        }
1257
-        $query_params = $this->_get_checkin_query_params_from_request($request, $per_page, $count);
1258
-        /**
1259
-         * Override the default groupby added by EEM_Base so that sorts with multiple order bys work as expected
1260
-         *
1261
-         * @link https://events.codebasehq.com/projects/event-espresso/tickets/10093
1262
-         * @see  EEM_Base::get_all()
1263
-         */
1264
-        $query_params['group_by'] = '';
1235
+	/**
1236
+	 * Gets registrations for an event
1237
+	 *
1238
+	 * @param int    $per_page
1239
+	 * @param bool   $count whether to return count or data.
1240
+	 * @param bool   $trash
1241
+	 * @param string $orderby
1242
+	 * @return EE_Registration[]|int
1243
+	 * @throws EE_Error
1244
+	 * @throws InvalidArgumentException
1245
+	 * @throws InvalidDataTypeException
1246
+	 * @throws InvalidInterfaceException
1247
+	 */
1248
+	public function get_event_attendees($per_page = 10, $count = false, $trash = false, $orderby = 'ATT_fname')
1249
+	{
1250
+		// normalize some request params that get setup by the parent `get_registrations` method.
1251
+		$request = $this->_req_data;
1252
+		$request['orderby'] = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : $orderby;
1253
+		$request['order'] = ! empty($this->_req_data['order']) ? $this->_req_data['order'] : 'ASC';
1254
+		if ($trash) {
1255
+			$request['status'] = 'trash';
1256
+		}
1257
+		$query_params = $this->_get_checkin_query_params_from_request($request, $per_page, $count);
1258
+		/**
1259
+		 * Override the default groupby added by EEM_Base so that sorts with multiple order bys work as expected
1260
+		 *
1261
+		 * @link https://events.codebasehq.com/projects/event-espresso/tickets/10093
1262
+		 * @see  EEM_Base::get_all()
1263
+		 */
1264
+		$query_params['group_by'] = '';
1265 1265
 
1266
-        return $count
1267
-            ? EEM_Registration::instance()->count($query_params)
1268
-            /** @type EE_Registration[] */
1269
-            : EEM_Registration::instance()->get_all($query_params);
1270
-    }
1266
+		return $count
1267
+			? EEM_Registration::instance()->count($query_params)
1268
+			/** @type EE_Registration[] */
1269
+			: EEM_Registration::instance()->get_all($query_params);
1270
+	}
1271 1271
 }
Please login to merge, or discard this patch.
Spacing   +49 added lines, -49 removed lines patch added patch discarded remove patch
@@ -32,10 +32,10 @@  discard block
 block discarded – undo
32 32
     public function __construct($routing = true)
33 33
     {
34 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/');
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 39
         }
40 40
     }
41 41
 
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
      */
46 46
     protected function _extend_page_config()
47 47
     {
48
-        $this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND . 'registrations';
48
+        $this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND.'registrations';
49 49
         $reg_id = ! empty($this->_req_data['_REG_ID']) && ! is_array($this->_req_data['_REG_ID'])
50 50
             ? $this->_req_data['_REG_ID']
51 51
             : 0;
@@ -184,14 +184,14 @@  discard block
 block discarded – undo
184 184
             // enqueue newsletter js
185 185
             wp_enqueue_script(
186 186
                 'ee-newsletter-trigger',
187
-                REG_CAF_ASSETS_URL . 'ee-newsletter-trigger.js',
187
+                REG_CAF_ASSETS_URL.'ee-newsletter-trigger.js',
188 188
                 array('ee-dialog'),
189 189
                 EVENT_ESPRESSO_VERSION,
190 190
                 true
191 191
             );
192 192
             wp_enqueue_style(
193 193
                 'ee-newsletter-trigger-css',
194
-                REG_CAF_ASSETS_URL . 'ee-newsletter-trigger.css',
194
+                REG_CAF_ASSETS_URL.'ee-newsletter-trigger.css',
195 195
                 array(),
196 196
                 EVENT_ESPRESSO_VERSION
197 197
             );
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
     {
213 213
         wp_register_script(
214 214
             'ee-reg-reports-js',
215
-            REG_CAF_ASSETS_URL . 'ee-registration-admin-reports.js',
215
+            REG_CAF_ASSETS_URL.'ee-registration-admin-reports.js',
216 216
             array('google-charts'),
217 217
             EVENT_ESPRESSO_VERSION,
218 218
             true
@@ -298,7 +298,7 @@  discard block
 block discarded – undo
298 298
         $nonce_ref = 'get_newsletter_form_content_nonce';
299 299
         $this->_verify_nonce($nonce, $nonce_ref);
300 300
         // let's get the mtp for the incoming MTP_ ID
301
-        if (! isset($this->_req_data['GRP_ID'])) {
301
+        if ( ! isset($this->_req_data['GRP_ID'])) {
302 302
             EE_Error::add_error(
303 303
                 esc_html__(
304 304
                     '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).',
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
             $this->_return_json();
314 314
         }
315 315
         $MTPG = EEM_Message_Template_Group::instance()->get_one_by_ID($this->_req_data['GRP_ID']);
316
-        if (! $MTPG instanceof EE_Message_Template_Group) {
316
+        if ( ! $MTPG instanceof EE_Message_Template_Group) {
317 317
             EE_Error::add_error(
318 318
                 sprintf(
319 319
                     esc_html__(
@@ -338,12 +338,12 @@  discard block
 block discarded – undo
338 338
             $field = $MTP->get('MTP_template_field');
339 339
             if ($field === 'content') {
340 340
                 $content = $MTP->get('MTP_content');
341
-                if (! empty($content['newsletter_content'])) {
341
+                if ( ! empty($content['newsletter_content'])) {
342 342
                     $template_fields['newsletter_content'] = $content['newsletter_content'];
343 343
                 }
344 344
                 continue;
345 345
             }
346
-            $template_fields[ $MTP->get('MTP_template_field') ] = $MTP->get('MTP_content');
346
+            $template_fields[$MTP->get('MTP_template_field')] = $MTP->get('MTP_content');
347 347
         }
348 348
         $this->_template_args['success'] = true;
349 349
         $this->_template_args['error'] = false;
@@ -374,7 +374,7 @@  discard block
 block discarded – undo
374 374
      */
375 375
     public function add_newsletter_action_buttons(EE_Admin_List_Table $list_table)
376 376
     {
377
-        if (! EE_Registry::instance()->CAP->current_user_can(
377
+        if ( ! EE_Registry::instance()->CAP->current_user_can(
378 378
             'ee_send_message',
379 379
             'espresso_registrations_newsletter_selected_send'
380 380
         )
@@ -443,17 +443,17 @@  discard block
 block discarded – undo
443 443
                 $field_id = $field === '[NEWSLETTER_CONTENT]'
444 444
                     ? 'content'
445 445
                     : $field;
446
-                $field_id = 'batch-message-' . strtolower($field_id);
446
+                $field_id = 'batch-message-'.strtolower($field_id);
447 447
                 $available_shortcodes[] = '<span class="js-shortcode-selection" data-value="'
448 448
                                           . $shortcode
449
-                                          . '" data-linked-input-id="' . $field_id . '">'
449
+                                          . '" data-linked-input-id="'.$field_id.'">'
450 450
                                           . $shortcode
451 451
                                           . '</span>';
452 452
             }
453
-            $codes[ $field ] = implode(', ', $available_shortcodes);
453
+            $codes[$field] = implode(', ', $available_shortcodes);
454 454
         }
455 455
         $shortcodes = $codes;
456
-        $form_template = REG_CAF_TEMPLATE_PATH . 'newsletter-send-form.template.php';
456
+        $form_template = REG_CAF_TEMPLATE_PATH.'newsletter-send-form.template.php';
457 457
         $form_template_args = array(
458 458
             'form_action'       => admin_url('admin.php?page=espresso_registrations'),
459 459
             'form_route'        => 'newsletter_selected_send',
@@ -621,7 +621,7 @@  discard block
 block discarded – undo
621 621
      */
622 622
     protected function _registration_reports()
623 623
     {
624
-        $template_path = EE_ADMIN_TEMPLATE . 'admin_reports.template.php';
624
+        $template_path = EE_ADMIN_TEMPLATE.'admin_reports.template.php';
625 625
         $this->_template_args['admin_page_content'] = EEH_Template::display_template(
626 626
             $template_path,
627 627
             $this->_reports_template_data,
@@ -676,7 +676,7 @@  discard block
 block discarded – undo
676 676
             array_unshift($regs, $column_titles);
677 677
             // setup the date range.
678 678
             $DateTimeZone = new DateTimeZone(EEH_DTT_Helper::get_timezone());
679
-            $beginning_date = new DateTime("now " . $period, $DateTimeZone);
679
+            $beginning_date = new DateTime("now ".$period, $DateTimeZone);
680 680
             $ending_date = new DateTime("now", $DateTimeZone);
681 681
             $subtitle = sprintf(
682 682
                 _x('For the period: %1$s to %2$s', 'Used to give date range', 'event_espresso'),
@@ -696,7 +696,7 @@  discard block
 block discarded – undo
696 696
                     '%sThere are currently no registration records in the last month for this report.%s',
697 697
                     'event_espresso'
698 698
                 ),
699
-                '<h2>' . $report_title . '</h2><p>',
699
+                '<h2>'.$report_title.'</h2><p>',
700 700
                 '</p>'
701 701
             ),
702 702
         );
@@ -749,7 +749,7 @@  discard block
 block discarded – undo
749 749
             array_unshift($regs, $column_titles);
750 750
             // setup the date range.
751 751
             $DateTimeZone = new DateTimeZone(EEH_DTT_Helper::get_timezone());
752
-            $beginning_date = new DateTime("now " . $period, $DateTimeZone);
752
+            $beginning_date = new DateTime("now ".$period, $DateTimeZone);
753 753
             $ending_date = new DateTime("now", $DateTimeZone);
754 754
             $subtitle = sprintf(
755 755
                 _x('For the period: %1$s to %2$s', 'Used to give date range', 'event_espresso'),
@@ -769,7 +769,7 @@  discard block
 block discarded – undo
769 769
                     '%sThere are currently no registration records in the last month for this report.%s',
770 770
                     'event_espresso'
771 771
                 ),
772
-                '<h2>' . $report_title . '</h2><p>',
772
+                '<h2>'.$report_title.'</h2><p>',
773 773
                 '</p>'
774 774
             ),
775 775
         );
@@ -822,7 +822,7 @@  discard block
 block discarded – undo
822 822
         if ($datetime instanceof EE_Datetime) {
823 823
             $datetime_label = $datetime->get_dtt_display_name(true);
824 824
             $datetime_label .= ! empty($datetime_label)
825
-                ? ' (' . $datetime->get_dtt_display_name() . ')'
825
+                ? ' ('.$datetime->get_dtt_display_name().')'
826 826
                 : $datetime->get_dtt_display_name();
827 827
         }
828 828
         $datetime_link = ! empty($dtt_id) && $registration instanceof EE_Registration
@@ -836,7 +836,7 @@  discard block
 block discarded – undo
836 836
             )
837 837
             : '';
838 838
         $datetime_link = ! empty($datetime_link)
839
-            ? '<a href="' . $datetime_link . '">'
839
+            ? '<a href="'.$datetime_link.'">'
840 840
               . '<span id="checkin-dtt">'
841 841
               . $datetime_label
842 842
               . '</span></a>'
@@ -848,8 +848,8 @@  discard block
 block discarded – undo
848 848
             ? $attendee->get_admin_details_link()
849 849
             : '';
850 850
         $attendee_link = ! empty($attendee_link)
851
-            ? '<a href="' . $attendee->get_admin_details_link() . '"'
852
-              . ' title="' . esc_html__('Click for attendee details', 'event_espresso') . '">'
851
+            ? '<a href="'.$attendee->get_admin_details_link().'"'
852
+              . ' title="'.esc_html__('Click for attendee details', 'event_espresso').'">'
853 853
               . '<span id="checkin-attendee-name">'
854 854
               . $attendee_name
855 855
               . '</span></a>'
@@ -858,25 +858,25 @@  discard block
 block discarded – undo
858 858
             ? $registration->event()->get_admin_details_link()
859 859
             : '';
860 860
         $event_link = ! empty($event_link)
861
-            ? '<a href="' . $event_link . '"'
862
-              . ' title="' . esc_html__('Click here to edit event.', 'event_espresso') . '">'
861
+            ? '<a href="'.$event_link.'"'
862
+              . ' title="'.esc_html__('Click here to edit event.', 'event_espresso').'">'
863 863
               . '<span id="checkin-event-name">'
864 864
               . $registration->event_name()
865 865
               . '</span>'
866 866
               . '</a>'
867 867
             : '';
868 868
         $this->_template_args['before_list_table'] = ! empty($reg_id) && ! empty($dtt_id)
869
-            ? '<h2>' . sprintf(
869
+            ? '<h2>'.sprintf(
870 870
                 esc_html__('Displaying check in records for %1$s for %2$s at the event, %3$s', 'event_espresso'),
871 871
                 $attendee_link,
872 872
                 $datetime_link,
873 873
                 $event_link
874
-            ) . '</h2>'
874
+            ).'</h2>'
875 875
             : '';
876 876
         $this->_template_args['list_table_hidden_fields'] = ! empty($reg_id)
877
-            ? '<input type="hidden" name="_REG_ID" value="' . $reg_id . '">' : '';
877
+            ? '<input type="hidden" name="_REG_ID" value="'.$reg_id.'">' : '';
878 878
         $this->_template_args['list_table_hidden_fields'] .= ! empty($dtt_id)
879
-            ? '<input type="hidden" name="DTT_ID" value="' . $dtt_id . '">' : '';
879
+            ? '<input type="hidden" name="DTT_ID" value="'.$dtt_id.'">' : '';
880 880
         $this->display_admin_list_table_page_with_no_sidebar();
881 881
     }
882 882
 
@@ -893,7 +893,7 @@  discard block
 block discarded – undo
893 893
     public function toggle_checkin_status()
894 894
     {
895 895
         // first make sure we have the necessary data
896
-        if (! isset($this->_req_data['_regid'])) {
896
+        if ( ! isset($this->_req_data['_regid'])) {
897 897
             EE_Error::add_error(
898 898
                 esc_html__(
899 899
                     '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',
@@ -915,7 +915,7 @@  discard block
 block discarded – undo
915 915
         // beautiful! Made it this far so let's get the status.
916 916
         $new_status = new CheckinStatusDashicon($this->_toggle_checkin_status());
917 917
         // setup new class to return via ajax
918
-        $this->_template_args['admin_page_content'] = 'clickable trigger-checkin ' . $new_status->cssClasses();
918
+        $this->_template_args['admin_page_content'] = 'clickable trigger-checkin '.$new_status->cssClasses();
919 919
         $this->_template_args['success'] = true;
920 920
         $this->_return_json();
921 921
     }
@@ -941,7 +941,7 @@  discard block
 block discarded – undo
941 941
         );
942 942
         $new_status = false;
943 943
         // bulk action check in toggle
944
-        if (! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
944
+        if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
945 945
             // cycle thru checkboxes
946 946
             while (list($REG_ID, $value) = each($this->_req_data['checkbox'])) {
947 947
                 $DTT_ID = isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : null;
@@ -1011,9 +1011,9 @@  discard block
 block discarded – undo
1011 1011
             '_REG_ID' => isset($this->_req_data['_REG_ID']) ? $this->_req_data['_REG_ID'] : 0,
1012 1012
         );
1013 1013
         $errors = 0;
1014
-        if (! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
1014
+        if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
1015 1015
             while (list($CHK_ID, $value) = each($this->_req_data['checkbox'])) {
1016
-                if (! EEM_Checkin::instance()->delete_by_ID($CHK_ID)) {
1016
+                if ( ! EEM_Checkin::instance()->delete_by_ID($CHK_ID)) {
1017 1017
                     $errors++;
1018 1018
                 }
1019 1019
             }
@@ -1059,8 +1059,8 @@  discard block
 block discarded – undo
1059 1059
             'DTT_ID'  => isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : 0,
1060 1060
             '_REG_ID' => isset($this->_req_data['_REG_ID']) ? $this->_req_data['_REG_ID'] : 0,
1061 1061
         );
1062
-        if (! empty($this->_req_data['CHK_ID'])) {
1063
-            if (! EEM_Checkin::instance()->delete_by_ID($this->_req_data['CHK_ID'])) {
1062
+        if ( ! empty($this->_req_data['CHK_ID'])) {
1063
+            if ( ! EEM_Checkin::instance()->delete_by_ID($this->_req_data['CHK_ID'])) {
1064 1064
                 EE_Error::add_error(
1065 1065
                     esc_html__('Something went wrong and this check-in record was not deleted', 'event_espresso'),
1066 1066
                     __FILE__,
@@ -1129,37 +1129,37 @@  discard block
 block discarded – undo
1129 1129
                 'desc'  => $checked_never->legendLabel(),
1130 1130
             ),
1131 1131
             'approved_status'  => array(
1132
-                'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_approved,
1132
+                'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_approved,
1133 1133
                 'desc'  => EEH_Template::pretty_status(EEM_Registration::status_id_approved, false, 'sentence'),
1134 1134
             ),
1135 1135
             'cancelled_status' => array(
1136
-                'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_cancelled,
1136
+                'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_cancelled,
1137 1137
                 'desc'  => EEH_Template::pretty_status(EEM_Registration::status_id_cancelled, false, 'sentence'),
1138 1138
             ),
1139 1139
             'declined_status'  => array(
1140
-                'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_declined,
1140
+                'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_declined,
1141 1141
                 'desc'  => EEH_Template::pretty_status(EEM_Registration::status_id_declined, false, 'sentence'),
1142 1142
             ),
1143 1143
             'not_approved'     => array(
1144
-                'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_not_approved,
1144
+                'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_not_approved,
1145 1145
                 'desc'  => EEH_Template::pretty_status(EEM_Registration::status_id_not_approved, false, 'sentence'),
1146 1146
             ),
1147 1147
             'pending_status'   => array(
1148
-                'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_pending_payment,
1148
+                'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_pending_payment,
1149 1149
                 'desc'  => EEH_Template::pretty_status(EEM_Registration::status_id_pending_payment, false, 'sentence'),
1150 1150
             ),
1151 1151
             'wait_list'        => array(
1152
-                'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_wait_list,
1152
+                'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_wait_list,
1153 1153
                 'desc'  => EEH_Template::pretty_status(EEM_Registration::status_id_wait_list, false, 'sentence'),
1154 1154
             ),
1155 1155
         );
1156 1156
         $this->_template_args['after_list_table'] = $this->_display_legend($legend_items);
1157 1157
         $event_id = isset($this->_req_data['event_id']) ? $this->_req_data['event_id'] : null;
1158 1158
         $this->_template_args['before_list_table'] = ! empty($event_id)
1159
-            ? '<h2>' . sprintf(
1159
+            ? '<h2>'.sprintf(
1160 1160
                 esc_html__('Viewing Registrations for Event: %s', 'event_espresso'),
1161 1161
                 EEM_Event::instance()->get_one_by_ID($event_id)->get('EVT_name')
1162
-            ) . '</h2>'
1162
+            ).'</h2>'
1163 1163
             : '';
1164 1164
         // need to get the number of datetimes on the event and set default datetime_id if there is only one datetime on
1165 1165
         // the event.
@@ -1179,12 +1179,12 @@  discard block
 block discarded – undo
1179 1179
             $this->_template_args['before_list_table'] .= ' &nbsp;<span class="drk-grey-text">';
1180 1180
             $this->_template_args['before_list_table'] .= '<span class="dashicons dashicons-calendar"></span>';
1181 1181
             $this->_template_args['before_list_table'] .= $datetime->name();
1182
-            $this->_template_args['before_list_table'] .= ' ( ' . $datetime->date_and_time_range() . ' )';
1182
+            $this->_template_args['before_list_table'] .= ' ( '.$datetime->date_and_time_range().' )';
1183 1183
             $this->_template_args['before_list_table'] .= '</span></h2>';
1184 1184
         }
1185 1185
         // if no datetime, then we're on the initial view, so let's give some helpful instructions on what the status
1186 1186
         // column represents
1187
-        if (! $datetime instanceof EE_Datetime) {
1187
+        if ( ! $datetime instanceof EE_Datetime) {
1188 1188
             $this->_template_args['before_list_table'] .= '<br><p class="description">'
1189 1189
                                                           . esc_html__(
1190 1190
                                                               'In this view, the check-in status represents the latest check-in record for the registration in that row.',
Please login to merge, or discard this patch.
form_sections/strategies/display/EE_Button_Display_Strategy.strategy.php 1 patch
Indentation   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -12,32 +12,32 @@
 block discarded – undo
12 12
 class EE_Button_Display_Strategy extends EE_Display_Strategy_Base
13 13
 {
14 14
 
15
-    /**
16
-     * @return string of html to display the input
17
-     */
18
-    public function display()
19
-    {
20
-        $default_value = $this->_input->get_default();
21
-        if ($this->_input->get_normalization_strategy() instanceof EE_Normalization_Strategy_Base) {
22
-            $default_value = $this->_input->get_normalization_strategy()->unnormalize($default_value);
23
-        }
24
-        $html = $this->_opening_tag('button');
25
-        $html .= $this->_attributes_string(
26
-            array_merge(
27
-                $this->_standard_attributes_array(),
28
-                array(
29
-                    'value' => $default_value,
30
-                )
31
-            )
32
-        );
33
-        if ($this->_input instanceof EE_Button_Input) {
34
-            $button_content = $this->_input->button_content();
35
-        } else {
36
-            $button_content = $this->_input->get_default();
37
-        }
38
-        $html .= '>';
39
-        $html .= $button_content;
40
-        $html .= $this->_closing_tag();
41
-        return $html;
42
-    }
15
+	/**
16
+	 * @return string of html to display the input
17
+	 */
18
+	public function display()
19
+	{
20
+		$default_value = $this->_input->get_default();
21
+		if ($this->_input->get_normalization_strategy() instanceof EE_Normalization_Strategy_Base) {
22
+			$default_value = $this->_input->get_normalization_strategy()->unnormalize($default_value);
23
+		}
24
+		$html = $this->_opening_tag('button');
25
+		$html .= $this->_attributes_string(
26
+			array_merge(
27
+				$this->_standard_attributes_array(),
28
+				array(
29
+					'value' => $default_value,
30
+				)
31
+			)
32
+		);
33
+		if ($this->_input instanceof EE_Button_Input) {
34
+			$button_content = $this->_input->button_content();
35
+		} else {
36
+			$button_content = $this->_input->get_default();
37
+		}
38
+		$html .= '>';
39
+		$html .= $button_content;
40
+		$html .= $this->_closing_tag();
41
+		return $html;
42
+	}
43 43
 }
Please login to merge, or discard this patch.
core/domain/DomainFactory.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
      */
41 41
     public static function getShared(FullyQualifiedName $domain_fqcn, array $arguments)
42 42
     {
43
-        if (! isset($arguments[0], $arguments[1])) {
43
+        if ( ! isset($arguments[0], $arguments[1])) {
44 44
             throw new InvalidArgumentException(
45 45
                 esc_html__(
46 46
                     'You need to pass at least two arguments, representing the addon plugin file and version, in order to generate a Domain class',
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
             );
50 50
         }
51 51
         $domain = LoaderFactory::getLoader()->getShared($domain_fqcn, $arguments);
52
-        if (! $domain instanceof $domain_fqcn && ! $domain instanceof DomainBase) {
52
+        if ( ! $domain instanceof $domain_fqcn && ! $domain instanceof DomainBase) {
53 53
             throw new DomainException(
54 54
                 sprintf(
55 55
                     esc_html__(
Please login to merge, or discard this patch.
Indentation   +55 added lines, -55 removed lines patch added patch discarded remove patch
@@ -28,63 +28,63 @@
 block discarded – undo
28 28
 class DomainFactory
29 29
 {
30 30
 
31
-    /**
32
-     * @param FullyQualifiedName $domain_fqcn   [required] Fully Qualified Class Name for the Domain class
33
-     * @param array $arguments                  [required] array of arguments to be passed to the Domain class
34
-     *                                          constructor. Must at least include the following two value objects:
35
-     *                                          array(
36
-     *                                              EventEspresso\core\domain\values\FilePath $plugin_file
37
-     *                                              EventEspresso\core\domain\values\Version $version
38
-     *                                          )
39
-     * @return mixed
40
-     * @throws DomainException
41
-     * @throws InvalidArgumentException
42
-     * @throws InvalidDataTypeException
43
-     * @throws InvalidInterfaceException
44
-     */
45
-    public static function getShared(FullyQualifiedName $domain_fqcn, array $arguments)
46
-    {
47
-        if (! isset($arguments[0], $arguments[1])) {
48
-            throw new InvalidArgumentException(
49
-                esc_html__(
50
-                    'You need to pass at least two arguments, representing the addon plugin file and version, in order to generate a Domain class',
51
-                    'event_espresso'
52
-                )
53
-            );
54
-        }
55
-        $domain = LoaderFactory::getLoader()->getShared($domain_fqcn, $arguments);
56
-        if (! $domain instanceof $domain_fqcn && ! $domain instanceof DomainBase) {
57
-            throw new DomainException(
58
-                sprintf(
59
-                    esc_html__(
60
-                        'The requested Domain class "%1$s" could not be loaded.',
61
-                        'event_espresso'
62
-                    ),
63
-                    $domain_fqcn
64
-                )
65
-            );
66
-        }
67
-        return $domain;
68
-    }
31
+	/**
32
+	 * @param FullyQualifiedName $domain_fqcn   [required] Fully Qualified Class Name for the Domain class
33
+	 * @param array $arguments                  [required] array of arguments to be passed to the Domain class
34
+	 *                                          constructor. Must at least include the following two value objects:
35
+	 *                                          array(
36
+	 *                                              EventEspresso\core\domain\values\FilePath $plugin_file
37
+	 *                                              EventEspresso\core\domain\values\Version $version
38
+	 *                                          )
39
+	 * @return mixed
40
+	 * @throws DomainException
41
+	 * @throws InvalidArgumentException
42
+	 * @throws InvalidDataTypeException
43
+	 * @throws InvalidInterfaceException
44
+	 */
45
+	public static function getShared(FullyQualifiedName $domain_fqcn, array $arguments)
46
+	{
47
+		if (! isset($arguments[0], $arguments[1])) {
48
+			throw new InvalidArgumentException(
49
+				esc_html__(
50
+					'You need to pass at least two arguments, representing the addon plugin file and version, in order to generate a Domain class',
51
+					'event_espresso'
52
+				)
53
+			);
54
+		}
55
+		$domain = LoaderFactory::getLoader()->getShared($domain_fqcn, $arguments);
56
+		if (! $domain instanceof $domain_fqcn && ! $domain instanceof DomainBase) {
57
+			throw new DomainException(
58
+				sprintf(
59
+					esc_html__(
60
+						'The requested Domain class "%1$s" could not be loaded.',
61
+						'event_espresso'
62
+					),
63
+					$domain_fqcn
64
+				)
65
+			);
66
+		}
67
+		return $domain;
68
+	}
69 69
 
70 70
 
71
-    /**
72
-     * @return Domain
73
-     * @throws DomainException
74
-     * @throws InvalidArgumentException
75
-     * @throws InvalidDataTypeException
76
-     * @throws InvalidFilePathException
77
-     * @throws InvalidInterfaceException
78
-     */
79
-    public static function getEventEspressoCoreDomain()
80
-    {
81
-        $domain = new Domain(
82
-            new FilePath(EVENT_ESPRESSO_MAIN_FILE),
83
-            Version::fromString(espresso_version())
84
-        );
85
-        LoaderFactory::getLoader()->share('EventEspresso\core\domain\Domain', $domain);
86
-        return $domain;
87
-    }
71
+	/**
72
+	 * @return Domain
73
+	 * @throws DomainException
74
+	 * @throws InvalidArgumentException
75
+	 * @throws InvalidDataTypeException
76
+	 * @throws InvalidFilePathException
77
+	 * @throws InvalidInterfaceException
78
+	 */
79
+	public static function getEventEspressoCoreDomain()
80
+	{
81
+		$domain = new Domain(
82
+			new FilePath(EVENT_ESPRESSO_MAIN_FILE),
83
+			Version::fromString(espresso_version())
84
+		);
85
+		LoaderFactory::getLoader()->share('EventEspresso\core\domain\Domain', $domain);
86
+		return $domain;
87
+	}
88 88
 }
89 89
 
90 90
 
Please login to merge, or discard this patch.
core/domain/values/FilePath.php 2 patches
Indentation   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -20,42 +20,42 @@
 block discarded – undo
20 20
 class FilePath
21 21
 {
22 22
 
23
-    /**
24
-     * @var string file_path
25
-     */
26
-    private $file_path;
27
-
28
-
29
-    /**
30
-     * FilePath constructor.
31
-     *
32
-     * @param string $file_path
33
-     * @throws InvalidDataTypeException
34
-     * @throws InvalidFilePathException
35
-     */
36
-    public function __construct($file_path)
37
-    {
38
-        if (! is_string($file_path)) {
39
-            throw new InvalidDataTypeException(
40
-                '$file_path',
41
-                $file_path,
42
-                'string'
43
-            );
44
-        }
45
-        if (! is_readable($file_path)) {
46
-            throw new InvalidFilePathException($file_path);
47
-        }
48
-        $this->file_path = $file_path;
49
-    }
50
-
51
-
52
-    /**
53
-     * @return string
54
-     */
55
-    public function __toString()
56
-    {
57
-        return $this->file_path;
58
-    }
23
+	/**
24
+	 * @var string file_path
25
+	 */
26
+	private $file_path;
27
+
28
+
29
+	/**
30
+	 * FilePath constructor.
31
+	 *
32
+	 * @param string $file_path
33
+	 * @throws InvalidDataTypeException
34
+	 * @throws InvalidFilePathException
35
+	 */
36
+	public function __construct($file_path)
37
+	{
38
+		if (! is_string($file_path)) {
39
+			throw new InvalidDataTypeException(
40
+				'$file_path',
41
+				$file_path,
42
+				'string'
43
+			);
44
+		}
45
+		if (! is_readable($file_path)) {
46
+			throw new InvalidFilePathException($file_path);
47
+		}
48
+		$this->file_path = $file_path;
49
+	}
50
+
51
+
52
+	/**
53
+	 * @return string
54
+	 */
55
+	public function __toString()
56
+	{
57
+		return $this->file_path;
58
+	}
59 59
 
60 60
 
61 61
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -35,14 +35,14 @@
 block discarded – undo
35 35
      */
36 36
     public function __construct($file_path)
37 37
     {
38
-        if (! is_string($file_path)) {
38
+        if ( ! is_string($file_path)) {
39 39
             throw new InvalidDataTypeException(
40 40
                 '$file_path',
41 41
                 $file_path,
42 42
                 'string'
43 43
             );
44 44
         }
45
-        if (! is_readable($file_path)) {
45
+        if ( ! is_readable($file_path)) {
46 46
             throw new InvalidFilePathException($file_path);
47 47
         }
48 48
         $this->file_path = $file_path;
Please login to merge, or discard this patch.
core/domain/values/FullyQualifiedName.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -37,14 +37,14 @@
 block discarded – undo
37 37
      */
38 38
     public function __construct($fully_qualified_name)
39 39
     {
40
-        if (! is_string($fully_qualified_name)) {
40
+        if ( ! is_string($fully_qualified_name)) {
41 41
             throw new InvalidDataTypeException(
42 42
                 '$fully_qualified_name',
43 43
                 $fully_qualified_name,
44 44
                 'string'
45 45
             );
46 46
         }
47
-        if (! class_exists($fully_qualified_name) && ! interface_exists($fully_qualified_name)) {
47
+        if ( ! class_exists($fully_qualified_name) && ! interface_exists($fully_qualified_name)) {
48 48
             if (strpos($fully_qualified_name, 'Interface') !== false) {
49 49
                 throw new InvalidInterfaceException($fully_qualified_name);
50 50
             }
Please login to merge, or discard this patch.
Indentation   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -21,54 +21,54 @@
 block discarded – undo
21 21
 class FullyQualifiedName
22 22
 {
23 23
 
24
-    /**
25
-     * @var string $fully_qualified_name
26
-     */
27
-    private $fully_qualified_name;
24
+	/**
25
+	 * @var string $fully_qualified_name
26
+	 */
27
+	private $fully_qualified_name;
28 28
 
29 29
 
30
-    /**
31
-     * FullyQualifiedName constructor.
32
-     *
33
-     * @param string $fully_qualified_name
34
-     * @throws InvalidClassException
35
-     * @throws InvalidInterfaceException
36
-     * @throws InvalidDataTypeException
37
-     */
38
-    public function __construct($fully_qualified_name)
39
-    {
40
-        if (! is_string($fully_qualified_name)) {
41
-            throw new InvalidDataTypeException(
42
-                '$fully_qualified_name',
43
-                $fully_qualified_name,
44
-                'string'
45
-            );
46
-        }
47
-        if (! class_exists($fully_qualified_name) && ! interface_exists($fully_qualified_name)) {
48
-            if (strpos($fully_qualified_name, 'Interface') !== false) {
49
-                throw new InvalidInterfaceException($fully_qualified_name);
50
-            }
51
-            throw new InvalidClassException($fully_qualified_name);
52
-        }
53
-        $this->fully_qualified_name = $fully_qualified_name;
54
-    }
30
+	/**
31
+	 * FullyQualifiedName constructor.
32
+	 *
33
+	 * @param string $fully_qualified_name
34
+	 * @throws InvalidClassException
35
+	 * @throws InvalidInterfaceException
36
+	 * @throws InvalidDataTypeException
37
+	 */
38
+	public function __construct($fully_qualified_name)
39
+	{
40
+		if (! is_string($fully_qualified_name)) {
41
+			throw new InvalidDataTypeException(
42
+				'$fully_qualified_name',
43
+				$fully_qualified_name,
44
+				'string'
45
+			);
46
+		}
47
+		if (! class_exists($fully_qualified_name) && ! interface_exists($fully_qualified_name)) {
48
+			if (strpos($fully_qualified_name, 'Interface') !== false) {
49
+				throw new InvalidInterfaceException($fully_qualified_name);
50
+			}
51
+			throw new InvalidClassException($fully_qualified_name);
52
+		}
53
+		$this->fully_qualified_name = $fully_qualified_name;
54
+	}
55 55
 
56 56
 
57
-    /**
58
-     * @return string
59
-     */
60
-    public function string()
61
-    {
62
-        return $this->fully_qualified_name;
63
-    }
57
+	/**
58
+	 * @return string
59
+	 */
60
+	public function string()
61
+	{
62
+		return $this->fully_qualified_name;
63
+	}
64 64
 
65 65
 
66
-    /**
67
-     * @return string
68
-     */
69
-    public function __toString()
70
-    {
71
-        return $this->fully_qualified_name;
72
-    }
66
+	/**
67
+	 * @return string
68
+	 */
69
+	public function __toString()
70
+	{
71
+		return $this->fully_qualified_name;
72
+	}
73 73
 
74 74
 }
Please login to merge, or discard this patch.
core/domain/DomainBase.php 4 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -121,7 +121,7 @@
 block discarded – undo
121 121
 
122 122
 
123 123
     /**
124
-     * @return Version
124
+     * @return string
125 125
      */
126 126
     public function versionValueObject()
127 127
     {
Please login to merge, or discard this patch.
Indentation   +145 added lines, -145 removed lines patch added patch discarded remove patch
@@ -19,150 +19,150 @@
 block discarded – undo
19 19
 abstract class DomainBase implements DomainInterface
20 20
 {
21 21
 
22
-    /**
23
-     * Equivalent to `__FILE__` for main plugin file.
24
-     *
25
-     * @var FilePath
26
-     */
27
-    private $plugin_file;
28
-
29
-    /**
30
-     * String indicating version for plugin
31
-     *
32
-     * @var string
33
-     */
34
-    private $version;
35
-
36
-    /**
37
-     * @var string $plugin_basename
38
-     */
39
-    private $plugin_basename;
40
-
41
-    /**
42
-     * @var string $plugin_path
43
-     */
44
-    private $plugin_path;
45
-
46
-    /**
47
-     * @var string $plugin_url
48
-     */
49
-    private $plugin_url;
50
-
51
-    /**
52
-     * @var string $asset_namespace
53
-     */
54
-    private $asset_namespace;
55
-
56
-
57
-
58
-    /**
59
-     * Initializes internal properties.
60
-     *
61
-     * @param FilePath $plugin_file
62
-     * @param Version  $version
63
-     */
64
-    public function __construct(FilePath $plugin_file, Version $version)
65
-    {
66
-        $this->plugin_file = $plugin_file;
67
-        $this->version = $version;
68
-        $this->plugin_basename = plugin_basename($this->pluginFile());
69
-        $this->plugin_path = plugin_dir_path($this->pluginFile());
70
-        $this->plugin_url = plugin_dir_url($this->pluginFile());
71
-        $this->setAssetNamespace();
72
-    }
73
-
74
-
75
-    /**
76
-     * @return string
77
-     */
78
-    public function pluginFile()
79
-    {
80
-        return (string) $this->plugin_file;
81
-    }
82
-
83
-
84
-
85
-    /**
86
-     * @return string
87
-     */
88
-    public function pluginBasename()
89
-    {
90
-        return $this->plugin_basename;
91
-    }
92
-
93
-
94
-
95
-    /**
96
-     * @return string
97
-     */
98
-    public function pluginPath()
99
-    {
100
-        return $this->plugin_path;
101
-    }
102
-
103
-
104
-
105
-    /**
106
-     * @return string
107
-     */
108
-    public function pluginUrl()
109
-    {
110
-        return $this->plugin_url;
111
-    }
112
-
113
-
114
-
115
-    /**
116
-     * @return string
117
-     */
118
-    public function version()
119
-    {
120
-        return (string) $this->version;
121
-    }
122
-
123
-
124
-
125
-    /**
126
-     * @return Version
127
-     */
128
-    public function versionValueObject()
129
-    {
130
-        return $this->version;
131
-    }
132
-
133
-
134
-    /**
135
-     * @return string
136
-     */
137
-    public function distributionAssetsPath()
138
-    {
139
-        return $this->pluginPath() . 'assets/dist/';
140
-    }
141
-
142
-
143
-    /**
144
-     * @return string
145
-     */
146
-    public function distributionAssetsUrl()
147
-    {
148
-        return $this->pluginUrl() . 'assets/dist/';
149
-    }
22
+	/**
23
+	 * Equivalent to `__FILE__` for main plugin file.
24
+	 *
25
+	 * @var FilePath
26
+	 */
27
+	private $plugin_file;
28
+
29
+	/**
30
+	 * String indicating version for plugin
31
+	 *
32
+	 * @var string
33
+	 */
34
+	private $version;
35
+
36
+	/**
37
+	 * @var string $plugin_basename
38
+	 */
39
+	private $plugin_basename;
40
+
41
+	/**
42
+	 * @var string $plugin_path
43
+	 */
44
+	private $plugin_path;
45
+
46
+	/**
47
+	 * @var string $plugin_url
48
+	 */
49
+	private $plugin_url;
50
+
51
+	/**
52
+	 * @var string $asset_namespace
53
+	 */
54
+	private $asset_namespace;
55
+
56
+
57
+
58
+	/**
59
+	 * Initializes internal properties.
60
+	 *
61
+	 * @param FilePath $plugin_file
62
+	 * @param Version  $version
63
+	 */
64
+	public function __construct(FilePath $plugin_file, Version $version)
65
+	{
66
+		$this->plugin_file = $plugin_file;
67
+		$this->version = $version;
68
+		$this->plugin_basename = plugin_basename($this->pluginFile());
69
+		$this->plugin_path = plugin_dir_path($this->pluginFile());
70
+		$this->plugin_url = plugin_dir_url($this->pluginFile());
71
+		$this->setAssetNamespace();
72
+	}
73
+
74
+
75
+	/**
76
+	 * @return string
77
+	 */
78
+	public function pluginFile()
79
+	{
80
+		return (string) $this->plugin_file;
81
+	}
82
+
83
+
84
+
85
+	/**
86
+	 * @return string
87
+	 */
88
+	public function pluginBasename()
89
+	{
90
+		return $this->plugin_basename;
91
+	}
92
+
93
+
94
+
95
+	/**
96
+	 * @return string
97
+	 */
98
+	public function pluginPath()
99
+	{
100
+		return $this->plugin_path;
101
+	}
102
+
103
+
104
+
105
+	/**
106
+	 * @return string
107
+	 */
108
+	public function pluginUrl()
109
+	{
110
+		return $this->plugin_url;
111
+	}
112
+
113
+
114
+
115
+	/**
116
+	 * @return string
117
+	 */
118
+	public function version()
119
+	{
120
+		return (string) $this->version;
121
+	}
122
+
123
+
124
+
125
+	/**
126
+	 * @return Version
127
+	 */
128
+	public function versionValueObject()
129
+	{
130
+		return $this->version;
131
+	}
132
+
133
+
134
+	/**
135
+	 * @return string
136
+	 */
137
+	public function distributionAssetsPath()
138
+	{
139
+		return $this->pluginPath() . 'assets/dist/';
140
+	}
141
+
142
+
143
+	/**
144
+	 * @return string
145
+	 */
146
+	public function distributionAssetsUrl()
147
+	{
148
+		return $this->pluginUrl() . 'assets/dist/';
149
+	}
150 150
 
151
-
152
-    /**
153
-     * @return string
154
-     */
155
-    public function assetNamespace()
156
-    {
157
-        return $this->asset_namespace;
158
-    }
159
-
160
-
161
-    /**
162
-     * @return void
163
-     */
164
-    private function setAssetNamespace()
165
-    {
166
-        $this->asset_namespace = sanitize_key($this->plugin_basename);
167
-    }
151
+
152
+	/**
153
+	 * @return string
154
+	 */
155
+	public function assetNamespace()
156
+	{
157
+		return $this->asset_namespace;
158
+	}
159
+
160
+
161
+	/**
162
+	 * @return void
163
+	 */
164
+	private function setAssetNamespace()
165
+	{
166
+		$this->asset_namespace = sanitize_key($this->plugin_basename);
167
+	}
168 168
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
      */
137 137
     public function distributionAssetsPath()
138 138
     {
139
-        return $this->pluginPath() . 'assets/dist/';
139
+        return $this->pluginPath().'assets/dist/';
140 140
     }
141 141
 
142 142
 
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
      */
146 146
     public function distributionAssetsUrl()
147 147
     {
148
-        return $this->pluginUrl() . 'assets/dist/';
148
+        return $this->pluginUrl().'assets/dist/';
149 149
     }
150 150
 
151 151
 
Please login to merge, or discard this patch.
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -4,7 +4,6 @@
 block discarded – undo
4 4
 
5 5
 use EventEspresso\core\domain\values\FilePath;
6 6
 use EventEspresso\core\domain\values\Version;
7
-use EventEspresso\core\services\assets\Registry;
8 7
 
9 8
 /**
10 9
  * DomainBase Class
Please login to merge, or discard this patch.
core/domain/entities/contexts/RequestTypeContext.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -91,7 +91,7 @@
 block discarded – undo
91 91
     public function __construct($slug, $description)
92 92
     {
93 93
         parent::__construct($slug, $description);
94
-        if (! in_array($this->slug(), $this->validRequestTypes(), true)) {
94
+        if ( ! in_array($this->slug(), $this->validRequestTypes(), true)) {
95 95
             throw new InvalidArgumentException(
96 96
                 sprintf(
97 97
                     esc_html__(
Please login to merge, or discard this patch.
Indentation   +133 added lines, -133 removed lines patch added patch discarded remove patch
@@ -16,137 +16,137 @@
 block discarded – undo
16 16
 class RequestTypeContext extends Context
17 17
 {
18 18
 
19
-    /**
20
-     * indicates that the current request involves some form of activation
21
-     */
22
-    const ACTIVATION = 'activation-request';
23
-
24
-    /**
25
-     * indicates that the current request is for the admin but is not being made via AJAX
26
-     */
27
-    const ADMIN = 'non-ajax-admin-request';
28
-
29
-    /**
30
-     * indicates that the current request is for the admin AND is being made via AJAX
31
-     */
32
-    const AJAX_ADMIN = 'admin-ajax-request';
33
-
34
-    /**
35
-     * indicates that the current request is for the frontend AND is being made via AJAX
36
-     */
37
-    const AJAX_FRONT = 'frontend-ajax-request';
38
-
39
-    /**
40
-     * indicates that the current request is being made via AJAX, but is NOT for EE
41
-     */
42
-    const AJAX_OTHER = 'other-ajax-request';
43
-
44
-    /**
45
-     * indicates that the current request is for the EE REST API
46
-     */
47
-    const API = 'rest-api';
48
-
49
-    /**
50
-     * indicates that the current request is from the command line
51
-     */
52
-    const CLI = 'command-line';
53
-
54
-    /**
55
-     * indicates that the current request is for a WP_Cron
56
-     */
57
-    const CRON = 'wp-cron';
58
-
59
-    /**
60
-     * indicates that the current request is for a feed (ie: RSS)
61
-     */
62
-    const FEED = 'feed-request';
63
-
64
-    /**
65
-     * indicates that the current request is for the frontend but is not being made via AJAX
66
-     */
67
-    const FRONTEND = 'non-ajax-frontend-request';
68
-
69
-    /**
70
-     * indicates that the current request is for content that is to be displayed within an iframe
71
-     */
72
-    const IFRAME = 'iframe-request';
73
-
74
-    /**
75
-     * @var boolean $is_activation
76
-     */
77
-    private $is_activation = false;
78
-
79
-    /**
80
-     * @var array $valid_request_types
81
-     */
82
-    private $valid_request_types = array();
83
-
84
-
85
-    /**
86
-     * RequestTypeContext constructor.
87
-     *
88
-     * @param string $slug
89
-     * @param string $description
90
-     * @throws InvalidArgumentException
91
-     */
92
-    public function __construct($slug, $description)
93
-    {
94
-        parent::__construct($slug, $description);
95
-        if (! in_array($this->slug(), $this->validRequestTypes(), true)) {
96
-            throw new InvalidArgumentException(
97
-                sprintf(
98
-                    esc_html__(
99
-                        'The RequestTypeContext slug must be one of the following values: %1$s %2$s',
100
-                        'event_espresso'
101
-                    ),
102
-                    var_export($this->validRequestTypes(), true)
103
-                )
104
-            );
105
-        }
106
-    }
107
-
108
-
109
-    /**
110
-     * @return array
111
-     */
112
-    public function validRequestTypes()
113
-    {
114
-        if (empty($this->valid_request_types)) {
115
-            $this->valid_request_types = apply_filters(
116
-                'FHEE__EventEspresso_core_domain_entities_contexts_RequestTypeContext__validRequestTypes',
117
-                array(
118
-                    RequestTypeContext::ACTIVATION,
119
-                    RequestTypeContext::ADMIN,
120
-                    RequestTypeContext::AJAX_ADMIN,
121
-                    RequestTypeContext::AJAX_FRONT,
122
-                    RequestTypeContext::AJAX_OTHER,
123
-                    RequestTypeContext::API,
124
-                    RequestTypeContext::CLI,
125
-                    RequestTypeContext::CRON,
126
-                    RequestTypeContext::FEED,
127
-                    RequestTypeContext::FRONTEND,
128
-                    RequestTypeContext::IFRAME,
129
-                )
130
-            );
131
-        }
132
-        return $this->valid_request_types;
133
-    }
134
-
135
-
136
-    /**
137
-     * @return bool
138
-     */
139
-    public function isActivation()
140
-    {
141
-        return $this->is_activation;
142
-    }
143
-
144
-
145
-    /**
146
-     * @param bool $is_activation
147
-     */
148
-    public function setIsActivation($is_activation)
149
-    {
150
-        $this->is_activation = filter_var($is_activation, FILTER_VALIDATE_BOOLEAN);
151
-    }
19
+	/**
20
+	 * indicates that the current request involves some form of activation
21
+	 */
22
+	const ACTIVATION = 'activation-request';
23
+
24
+	/**
25
+	 * indicates that the current request is for the admin but is not being made via AJAX
26
+	 */
27
+	const ADMIN = 'non-ajax-admin-request';
28
+
29
+	/**
30
+	 * indicates that the current request is for the admin AND is being made via AJAX
31
+	 */
32
+	const AJAX_ADMIN = 'admin-ajax-request';
33
+
34
+	/**
35
+	 * indicates that the current request is for the frontend AND is being made via AJAX
36
+	 */
37
+	const AJAX_FRONT = 'frontend-ajax-request';
38
+
39
+	/**
40
+	 * indicates that the current request is being made via AJAX, but is NOT for EE
41
+	 */
42
+	const AJAX_OTHER = 'other-ajax-request';
43
+
44
+	/**
45
+	 * indicates that the current request is for the EE REST API
46
+	 */
47
+	const API = 'rest-api';
48
+
49
+	/**
50
+	 * indicates that the current request is from the command line
51
+	 */
52
+	const CLI = 'command-line';
53
+
54
+	/**
55
+	 * indicates that the current request is for a WP_Cron
56
+	 */
57
+	const CRON = 'wp-cron';
58
+
59
+	/**
60
+	 * indicates that the current request is for a feed (ie: RSS)
61
+	 */
62
+	const FEED = 'feed-request';
63
+
64
+	/**
65
+	 * indicates that the current request is for the frontend but is not being made via AJAX
66
+	 */
67
+	const FRONTEND = 'non-ajax-frontend-request';
68
+
69
+	/**
70
+	 * indicates that the current request is for content that is to be displayed within an iframe
71
+	 */
72
+	const IFRAME = 'iframe-request';
73
+
74
+	/**
75
+	 * @var boolean $is_activation
76
+	 */
77
+	private $is_activation = false;
78
+
79
+	/**
80
+	 * @var array $valid_request_types
81
+	 */
82
+	private $valid_request_types = array();
83
+
84
+
85
+	/**
86
+	 * RequestTypeContext constructor.
87
+	 *
88
+	 * @param string $slug
89
+	 * @param string $description
90
+	 * @throws InvalidArgumentException
91
+	 */
92
+	public function __construct($slug, $description)
93
+	{
94
+		parent::__construct($slug, $description);
95
+		if (! in_array($this->slug(), $this->validRequestTypes(), true)) {
96
+			throw new InvalidArgumentException(
97
+				sprintf(
98
+					esc_html__(
99
+						'The RequestTypeContext slug must be one of the following values: %1$s %2$s',
100
+						'event_espresso'
101
+					),
102
+					var_export($this->validRequestTypes(), true)
103
+				)
104
+			);
105
+		}
106
+	}
107
+
108
+
109
+	/**
110
+	 * @return array
111
+	 */
112
+	public function validRequestTypes()
113
+	{
114
+		if (empty($this->valid_request_types)) {
115
+			$this->valid_request_types = apply_filters(
116
+				'FHEE__EventEspresso_core_domain_entities_contexts_RequestTypeContext__validRequestTypes',
117
+				array(
118
+					RequestTypeContext::ACTIVATION,
119
+					RequestTypeContext::ADMIN,
120
+					RequestTypeContext::AJAX_ADMIN,
121
+					RequestTypeContext::AJAX_FRONT,
122
+					RequestTypeContext::AJAX_OTHER,
123
+					RequestTypeContext::API,
124
+					RequestTypeContext::CLI,
125
+					RequestTypeContext::CRON,
126
+					RequestTypeContext::FEED,
127
+					RequestTypeContext::FRONTEND,
128
+					RequestTypeContext::IFRAME,
129
+				)
130
+			);
131
+		}
132
+		return $this->valid_request_types;
133
+	}
134
+
135
+
136
+	/**
137
+	 * @return bool
138
+	 */
139
+	public function isActivation()
140
+	{
141
+		return $this->is_activation;
142
+	}
143
+
144
+
145
+	/**
146
+	 * @param bool $is_activation
147
+	 */
148
+	public function setIsActivation($is_activation)
149
+	{
150
+		$this->is_activation = filter_var($is_activation, FILTER_VALIDATE_BOOLEAN);
151
+	}
152 152
 }
Please login to merge, or discard this patch.
core/helpers/EEH_URL.helper.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -251,7 +251,7 @@
 block discarded – undo
251 251
     /**
252 252
      * Identical in functionality to EEH_current_url except it removes any provided query_parameters from it.
253 253
      *
254
-     * @param array $query_parameters An array of query_parameters to remove from the current url.
254
+     * @param string[] $query_parameters An array of query_parameters to remove from the current url.
255 255
      * @since 4.9.46.rc.029
256 256
      * @return string
257 257
      */
Please login to merge, or discard this patch.
Indentation   +238 added lines, -238 removed lines patch added patch discarded remove patch
@@ -12,262 +12,262 @@
 block discarded – undo
12 12
 class EEH_URL
13 13
 {
14 14
 
15
-    /**
16
-     * _add_query_arg
17
-     * adds nonce to array of arguments then calls WP add_query_arg function
18
-     *
19
-     * @access public
20
-     * @param array  $args
21
-     * @param string $url
22
-     * @param bool   $exclude_nonce If true then the nonce will be excluded from the generated url.
23
-     * @return string
24
-     */
25
-    public static function add_query_args_and_nonce($args = array(), $url = '', $exclude_nonce = false)
26
-    {
27
-        if (empty($url)) {
28
-            $user_msg = esc_html__(
29
-                'An error occurred. A URL is a required parameter for the add_query_args_and_nonce method.',
30
-                'event_espresso'
31
-            );
32
-            $dev_msg  = $user_msg . "\n"
33
-                . sprintf(
34
-                    esc_html__(
35
-                        'In order to dynamically generate nonces for your actions, you need to supply a valid URL as a second parameter for the %s method.',
36
-                        'event_espresso'
37
-                    ),
38
-                    __CLASS__ . '::add_query_args_and_nonce'
39
-                );
40
-            EE_Error::add_error($user_msg . '||' . $dev_msg, __FILE__, __FUNCTION__, __LINE__);
41
-        }
42
-        // check that an action exists and add nonce
43
-        if (! $exclude_nonce) {
44
-            if (isset($args['action']) && ! empty($args['action'])) {
45
-                $args = array_merge(
46
-                    $args,
47
-                    array(
48
-                        $args['action'] . '_nonce' => wp_create_nonce($args['action'] . '_nonce')
49
-                    )
50
-                );
51
-            } else {
52
-                $args = array_merge(
53
-                    $args,
54
-                    array(
55
-                        'action' => 'default', 'default_nonce' => wp_create_nonce('default_nonce')
56
-                    )
57
-                );
58
-            }
59
-        }
15
+	/**
16
+	 * _add_query_arg
17
+	 * adds nonce to array of arguments then calls WP add_query_arg function
18
+	 *
19
+	 * @access public
20
+	 * @param array  $args
21
+	 * @param string $url
22
+	 * @param bool   $exclude_nonce If true then the nonce will be excluded from the generated url.
23
+	 * @return string
24
+	 */
25
+	public static function add_query_args_and_nonce($args = array(), $url = '', $exclude_nonce = false)
26
+	{
27
+		if (empty($url)) {
28
+			$user_msg = esc_html__(
29
+				'An error occurred. A URL is a required parameter for the add_query_args_and_nonce method.',
30
+				'event_espresso'
31
+			);
32
+			$dev_msg  = $user_msg . "\n"
33
+				. sprintf(
34
+					esc_html__(
35
+						'In order to dynamically generate nonces for your actions, you need to supply a valid URL as a second parameter for the %s method.',
36
+						'event_espresso'
37
+					),
38
+					__CLASS__ . '::add_query_args_and_nonce'
39
+				);
40
+			EE_Error::add_error($user_msg . '||' . $dev_msg, __FILE__, __FUNCTION__, __LINE__);
41
+		}
42
+		// check that an action exists and add nonce
43
+		if (! $exclude_nonce) {
44
+			if (isset($args['action']) && ! empty($args['action'])) {
45
+				$args = array_merge(
46
+					$args,
47
+					array(
48
+						$args['action'] . '_nonce' => wp_create_nonce($args['action'] . '_nonce')
49
+					)
50
+				);
51
+			} else {
52
+				$args = array_merge(
53
+					$args,
54
+					array(
55
+						'action' => 'default', 'default_nonce' => wp_create_nonce('default_nonce')
56
+					)
57
+				);
58
+			}
59
+		}
60 60
 
61
-        // finally, let's always add a return address (if present) :)
62
-        $args = ! empty($_REQUEST['action']) && ! isset($_REQUEST['return'])
63
-            ? array_merge($args, array('return' => $_REQUEST['action']))
64
-            : $args;
61
+		// finally, let's always add a return address (if present) :)
62
+		$args = ! empty($_REQUEST['action']) && ! isset($_REQUEST['return'])
63
+			? array_merge($args, array('return' => $_REQUEST['action']))
64
+			: $args;
65 65
 
66
-        return add_query_arg($args, $url);
67
-    }
66
+		return add_query_arg($args, $url);
67
+	}
68 68
 
69 69
 
70
-    /**
71
-     * Returns whether not the remote file exists.
72
-     * Checking via GET because HEAD requests are blocked on some server configurations.
73
-     *
74
-     * @param string  $url
75
-     * @param array $args  the arguments that should be passed through to the wp_remote_request call.
76
-     * @return boolean
77
-     */
78
-    public static function remote_file_exists($url, $args = array())
79
-    {
80
-        $results = wp_remote_request(
81
-            $url,
82
-            array_merge(
83
-                array(
84
-                    'method'      => 'GET',
85
-                    'redirection' => 1,
86
-                ),
87
-                $args
88
-            )
89
-        );
90
-        if (! $results instanceof WP_Error &&
91
-            isset($results['response']) &&
92
-            isset($results['response']['code']) &&
93
-            $results['response']['code'] == '200') {
94
-            return true;
95
-        } else {
96
-            return false;
97
-        }
98
-    }
70
+	/**
71
+	 * Returns whether not the remote file exists.
72
+	 * Checking via GET because HEAD requests are blocked on some server configurations.
73
+	 *
74
+	 * @param string  $url
75
+	 * @param array $args  the arguments that should be passed through to the wp_remote_request call.
76
+	 * @return boolean
77
+	 */
78
+	public static function remote_file_exists($url, $args = array())
79
+	{
80
+		$results = wp_remote_request(
81
+			$url,
82
+			array_merge(
83
+				array(
84
+					'method'      => 'GET',
85
+					'redirection' => 1,
86
+				),
87
+				$args
88
+			)
89
+		);
90
+		if (! $results instanceof WP_Error &&
91
+			isset($results['response']) &&
92
+			isset($results['response']['code']) &&
93
+			$results['response']['code'] == '200') {
94
+			return true;
95
+		} else {
96
+			return false;
97
+		}
98
+	}
99 99
 
100 100
 
101
-    /**
102
-     * refactor_url
103
-     * primarily used for removing the query string from a URL
104
-     *
105
-     * @param string $url
106
-     * @param bool   $remove_query  - TRUE (default) will strip off any URL params, ie: ?this=1&that=2
107
-     * @param bool   $base_url_only - TRUE will only return the scheme and host with no other parameters
108
-     * @return string
109
-     */
110
-    public static function refactor_url($url = '', $remove_query = true, $base_url_only = false)
111
-    {
112
-        // break apart incoming URL
113
-        $url_bits = parse_url($url);
114
-        // HTTP or HTTPS ?
115
-        $scheme = isset($url_bits['scheme']) ? $url_bits['scheme'] . '://' : 'http://';
116
-        // domain
117
-        $host = isset($url_bits['host']) ? $url_bits['host'] : '';
118
-        // if only the base URL is requested, then return that now
119
-        if ($base_url_only) {
120
-            return $scheme . $host;
121
-        }
122
-        $port = isset($url_bits['port']) ? ':' . $url_bits['port'] : '';
123
-        $user = isset($url_bits['user']) ? $url_bits['user'] : '';
124
-        $pass = isset($url_bits['pass']) ? ':' . $url_bits['pass'] : '';
125
-        $pass = ($user || $pass) ? $pass . '@' : '';
126
-        $path = isset($url_bits['path']) ? $url_bits['path'] : '';
127
-        // if the query string is not required, then return what we have so far
128
-        if ($remove_query) {
129
-            return $scheme . $user . $pass . $host . $port . $path;
130
-        }
131
-        $query    = isset($url_bits['query']) ? '?' . $url_bits['query'] : '';
132
-        $fragment = isset($url_bits['fragment']) ? '#' . $url_bits['fragment'] : '';
133
-        return $scheme . $user . $pass . $host . $port . $path . $query . $fragment;
134
-    }
101
+	/**
102
+	 * refactor_url
103
+	 * primarily used for removing the query string from a URL
104
+	 *
105
+	 * @param string $url
106
+	 * @param bool   $remove_query  - TRUE (default) will strip off any URL params, ie: ?this=1&that=2
107
+	 * @param bool   $base_url_only - TRUE will only return the scheme and host with no other parameters
108
+	 * @return string
109
+	 */
110
+	public static function refactor_url($url = '', $remove_query = true, $base_url_only = false)
111
+	{
112
+		// break apart incoming URL
113
+		$url_bits = parse_url($url);
114
+		// HTTP or HTTPS ?
115
+		$scheme = isset($url_bits['scheme']) ? $url_bits['scheme'] . '://' : 'http://';
116
+		// domain
117
+		$host = isset($url_bits['host']) ? $url_bits['host'] : '';
118
+		// if only the base URL is requested, then return that now
119
+		if ($base_url_only) {
120
+			return $scheme . $host;
121
+		}
122
+		$port = isset($url_bits['port']) ? ':' . $url_bits['port'] : '';
123
+		$user = isset($url_bits['user']) ? $url_bits['user'] : '';
124
+		$pass = isset($url_bits['pass']) ? ':' . $url_bits['pass'] : '';
125
+		$pass = ($user || $pass) ? $pass . '@' : '';
126
+		$path = isset($url_bits['path']) ? $url_bits['path'] : '';
127
+		// if the query string is not required, then return what we have so far
128
+		if ($remove_query) {
129
+			return $scheme . $user . $pass . $host . $port . $path;
130
+		}
131
+		$query    = isset($url_bits['query']) ? '?' . $url_bits['query'] : '';
132
+		$fragment = isset($url_bits['fragment']) ? '#' . $url_bits['fragment'] : '';
133
+		return $scheme . $user . $pass . $host . $port . $path . $query . $fragment;
134
+	}
135 135
 
136 136
 
137
-    /**
138
-     * get_query_string
139
-     * returns just the query string from a URL, formatted by default into an array of key value pairs
140
-     *
141
-     * @param string $url
142
-     * @param bool   $as_array TRUE (default) will return query params as an array of key value pairs, FALSE will
143
-     *                         simply return the query string
144
-     * @return string|array
145
-     */
146
-    public static function get_query_string($url = '', $as_array = true)
147
-    {
148
-        // decode, then break apart incoming URL
149
-        $url_bits = parse_url(html_entity_decode($url));
150
-        // grab query string from URL
151
-        $query = isset($url_bits['query']) ? $url_bits['query'] : '';
152
-        // if we don't want the query string formatted into an array of key => value pairs, then just return it as is
153
-        if (! $as_array) {
154
-            return $query;
155
-        }
156
-        // if no query string exists then just return an empty array now
157
-        if (empty($query)) {
158
-            return array();
159
-        }
160
-        // empty array to hold results
161
-        $query_params = array();
162
-        // now break apart the query string into separate params
163
-        $query = explode('&', $query);
164
-        // loop thru our query params
165
-        foreach ($query as $query_args) {
166
-            // break apart the key value pairs
167
-            $query_args = explode('=', $query_args);
168
-            // and add to our results array
169
-            $query_params[ $query_args[0] ] = $query_args[1];
170
-        }
171
-        return $query_params;
172
-    }
137
+	/**
138
+	 * get_query_string
139
+	 * returns just the query string from a URL, formatted by default into an array of key value pairs
140
+	 *
141
+	 * @param string $url
142
+	 * @param bool   $as_array TRUE (default) will return query params as an array of key value pairs, FALSE will
143
+	 *                         simply return the query string
144
+	 * @return string|array
145
+	 */
146
+	public static function get_query_string($url = '', $as_array = true)
147
+	{
148
+		// decode, then break apart incoming URL
149
+		$url_bits = parse_url(html_entity_decode($url));
150
+		// grab query string from URL
151
+		$query = isset($url_bits['query']) ? $url_bits['query'] : '';
152
+		// if we don't want the query string formatted into an array of key => value pairs, then just return it as is
153
+		if (! $as_array) {
154
+			return $query;
155
+		}
156
+		// if no query string exists then just return an empty array now
157
+		if (empty($query)) {
158
+			return array();
159
+		}
160
+		// empty array to hold results
161
+		$query_params = array();
162
+		// now break apart the query string into separate params
163
+		$query = explode('&', $query);
164
+		// loop thru our query params
165
+		foreach ($query as $query_args) {
166
+			// break apart the key value pairs
167
+			$query_args = explode('=', $query_args);
168
+			// and add to our results array
169
+			$query_params[ $query_args[0] ] = $query_args[1];
170
+		}
171
+		return $query_params;
172
+	}
173 173
 
174 174
 
175
-    /**
176
-     * prevent_prefetching
177
-     *
178
-     * @return void
179
-     */
180
-    public static function prevent_prefetching()
181
-    {
182
-        // prevent browsers from prefetching of the rel='next' link, because it may contain content that interferes
183
-        // with the registration process
184
-        remove_action('wp_head', 'adjacent_posts_rel_link_wp_head');
185
-    }
175
+	/**
176
+	 * prevent_prefetching
177
+	 *
178
+	 * @return void
179
+	 */
180
+	public static function prevent_prefetching()
181
+	{
182
+		// prevent browsers from prefetching of the rel='next' link, because it may contain content that interferes
183
+		// with the registration process
184
+		remove_action('wp_head', 'adjacent_posts_rel_link_wp_head');
185
+	}
186 186
 
187 187
 
188
-    /**
189
-     * This generates a unique site-specific string.
190
-     * An example usage for this string would be to save as a unique identifier for a record in the db for usage in
191
-     * urls.
192
-     *
193
-     * @param   string $prefix Use this to prefix the string with something.
194
-     * @return string
195
-     */
196
-    public static function generate_unique_token($prefix = '')
197
-    {
198
-        $token = md5(uniqid() . mt_rand());
199
-        return $prefix ? $prefix . '_' . $token : $token;
200
-    }
188
+	/**
189
+	 * This generates a unique site-specific string.
190
+	 * An example usage for this string would be to save as a unique identifier for a record in the db for usage in
191
+	 * urls.
192
+	 *
193
+	 * @param   string $prefix Use this to prefix the string with something.
194
+	 * @return string
195
+	 */
196
+	public static function generate_unique_token($prefix = '')
197
+	{
198
+		$token = md5(uniqid() . mt_rand());
199
+		return $prefix ? $prefix . '_' . $token : $token;
200
+	}
201 201
 
202 202
 
203
-    /**
204
-     * filter_input_server_url
205
-     * uses filter_input() to sanitize one of the INPUT_SERVER URL values
206
-     * but adds a backup in case filter_input() returns nothing, which can erringly happen on some servers
207
-     *
208
-     * @param string $server_variable
209
-     * @return string
210
-     */
211
-    public static function filter_input_server_url($server_variable = 'REQUEST_URI')
212
-    {
213
-        $URL              = '';
214
-        $server_variables = array(
215
-            'REQUEST_URI' => 1,
216
-            'HTTP_HOST'   => 1,
217
-            'PHP_SELF'    => 1,
218
-        );
219
-        $server_variable  = strtoupper($server_variable);
220
-        // whitelist INPUT_SERVER var
221
-        if (isset($server_variables[ $server_variable ])) {
222
-            $URL = filter_input(INPUT_SERVER, $server_variable, FILTER_SANITIZE_URL, FILTER_NULL_ON_FAILURE);
223
-            if (empty($URL)) {
224
-                // fallback sanitization if the above fails
225
-                $URL = wp_sanitize_redirect($_SERVER[ $server_variable ]);
226
-            }
227
-        }
228
-        return $URL;
229
-    }
203
+	/**
204
+	 * filter_input_server_url
205
+	 * uses filter_input() to sanitize one of the INPUT_SERVER URL values
206
+	 * but adds a backup in case filter_input() returns nothing, which can erringly happen on some servers
207
+	 *
208
+	 * @param string $server_variable
209
+	 * @return string
210
+	 */
211
+	public static function filter_input_server_url($server_variable = 'REQUEST_URI')
212
+	{
213
+		$URL              = '';
214
+		$server_variables = array(
215
+			'REQUEST_URI' => 1,
216
+			'HTTP_HOST'   => 1,
217
+			'PHP_SELF'    => 1,
218
+		);
219
+		$server_variable  = strtoupper($server_variable);
220
+		// whitelist INPUT_SERVER var
221
+		if (isset($server_variables[ $server_variable ])) {
222
+			$URL = filter_input(INPUT_SERVER, $server_variable, FILTER_SANITIZE_URL, FILTER_NULL_ON_FAILURE);
223
+			if (empty($URL)) {
224
+				// fallback sanitization if the above fails
225
+				$URL = wp_sanitize_redirect($_SERVER[ $server_variable ]);
226
+			}
227
+		}
228
+		return $URL;
229
+	}
230 230
 
231 231
 
232
-    /**
233
-     * Gets the current page's full URL.
234
-     *
235
-     * @return string
236
-     */
237
-    public static function current_url()
238
-    {
239
-        $url = '';
240
-        if (isset($_SERVER['HTTP_HOST'], $_SERVER['REQUEST_URI'])) {
241
-            $url = is_ssl() ? 'https://' : 'http://';
242
-            $url .= \EEH_URL::filter_input_server_url('HTTP_HOST');
243
-            $url .= \EEH_URL::filter_input_server_url('REQUEST_URI');
244
-        }
245
-        return $url;
246
-    }
232
+	/**
233
+	 * Gets the current page's full URL.
234
+	 *
235
+	 * @return string
236
+	 */
237
+	public static function current_url()
238
+	{
239
+		$url = '';
240
+		if (isset($_SERVER['HTTP_HOST'], $_SERVER['REQUEST_URI'])) {
241
+			$url = is_ssl() ? 'https://' : 'http://';
242
+			$url .= \EEH_URL::filter_input_server_url('HTTP_HOST');
243
+			$url .= \EEH_URL::filter_input_server_url('REQUEST_URI');
244
+		}
245
+		return $url;
246
+	}
247 247
 
248 248
 
249
-    /**
250
-     * Identical in functionality to EEH_current_url except it removes any provided query_parameters from it.
251
-     *
252
-     * @param array $query_parameters An array of query_parameters to remove from the current url.
253
-     * @since 4.9.46.rc.029
254
-     * @return string
255
-     */
256
-    public static function current_url_without_query_paramaters(array $query_parameters)
257
-    {
258
-        return remove_query_arg($query_parameters, EEH_URL::current_url());
259
-    }
249
+	/**
250
+	 * Identical in functionality to EEH_current_url except it removes any provided query_parameters from it.
251
+	 *
252
+	 * @param array $query_parameters An array of query_parameters to remove from the current url.
253
+	 * @since 4.9.46.rc.029
254
+	 * @return string
255
+	 */
256
+	public static function current_url_without_query_paramaters(array $query_parameters)
257
+	{
258
+		return remove_query_arg($query_parameters, EEH_URL::current_url());
259
+	}
260 260
 
261 261
 
262
-    /**
263
-     * @param string $location
264
-     * @param int    $status
265
-     * @param string $exit_notice
266
-     */
267
-    public static function safeRedirectAndExit($location, $status = 302, $exit_notice = '')
268
-    {
269
-        EE_Error::get_notices(false, true);
270
-        wp_safe_redirect($location, $status);
271
-        exit($exit_notice);
272
-    }
262
+	/**
263
+	 * @param string $location
264
+	 * @param int    $status
265
+	 * @param string $exit_notice
266
+	 */
267
+	public static function safeRedirectAndExit($location, $status = 302, $exit_notice = '')
268
+	{
269
+		EE_Error::get_notices(false, true);
270
+		wp_safe_redirect($location, $status);
271
+		exit($exit_notice);
272
+	}
273 273
 }
Please login to merge, or discard this patch.
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -29,23 +29,23 @@  discard block
 block discarded – undo
29 29
                 'An error occurred. A URL is a required parameter for the add_query_args_and_nonce method.',
30 30
                 'event_espresso'
31 31
             );
32
-            $dev_msg  = $user_msg . "\n"
32
+            $dev_msg = $user_msg."\n"
33 33
                 . sprintf(
34 34
                     esc_html__(
35 35
                         'In order to dynamically generate nonces for your actions, you need to supply a valid URL as a second parameter for the %s method.',
36 36
                         'event_espresso'
37 37
                     ),
38
-                    __CLASS__ . '::add_query_args_and_nonce'
38
+                    __CLASS__.'::add_query_args_and_nonce'
39 39
                 );
40
-            EE_Error::add_error($user_msg . '||' . $dev_msg, __FILE__, __FUNCTION__, __LINE__);
40
+            EE_Error::add_error($user_msg.'||'.$dev_msg, __FILE__, __FUNCTION__, __LINE__);
41 41
         }
42 42
         // check that an action exists and add nonce
43
-        if (! $exclude_nonce) {
43
+        if ( ! $exclude_nonce) {
44 44
             if (isset($args['action']) && ! empty($args['action'])) {
45 45
                 $args = array_merge(
46 46
                     $args,
47 47
                     array(
48
-                        $args['action'] . '_nonce' => wp_create_nonce($args['action'] . '_nonce')
48
+                        $args['action'].'_nonce' => wp_create_nonce($args['action'].'_nonce')
49 49
                     )
50 50
                 );
51 51
             } else {
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
                 $args
88 88
             )
89 89
         );
90
-        if (! $results instanceof WP_Error &&
90
+        if ( ! $results instanceof WP_Error &&
91 91
             isset($results['response']) &&
92 92
             isset($results['response']['code']) &&
93 93
             $results['response']['code'] == '200') {
@@ -112,25 +112,25 @@  discard block
 block discarded – undo
112 112
         // break apart incoming URL
113 113
         $url_bits = parse_url($url);
114 114
         // HTTP or HTTPS ?
115
-        $scheme = isset($url_bits['scheme']) ? $url_bits['scheme'] . '://' : 'http://';
115
+        $scheme = isset($url_bits['scheme']) ? $url_bits['scheme'].'://' : 'http://';
116 116
         // domain
117 117
         $host = isset($url_bits['host']) ? $url_bits['host'] : '';
118 118
         // if only the base URL is requested, then return that now
119 119
         if ($base_url_only) {
120
-            return $scheme . $host;
120
+            return $scheme.$host;
121 121
         }
122
-        $port = isset($url_bits['port']) ? ':' . $url_bits['port'] : '';
122
+        $port = isset($url_bits['port']) ? ':'.$url_bits['port'] : '';
123 123
         $user = isset($url_bits['user']) ? $url_bits['user'] : '';
124
-        $pass = isset($url_bits['pass']) ? ':' . $url_bits['pass'] : '';
125
-        $pass = ($user || $pass) ? $pass . '@' : '';
124
+        $pass = isset($url_bits['pass']) ? ':'.$url_bits['pass'] : '';
125
+        $pass = ($user || $pass) ? $pass.'@' : '';
126 126
         $path = isset($url_bits['path']) ? $url_bits['path'] : '';
127 127
         // if the query string is not required, then return what we have so far
128 128
         if ($remove_query) {
129
-            return $scheme . $user . $pass . $host . $port . $path;
129
+            return $scheme.$user.$pass.$host.$port.$path;
130 130
         }
131
-        $query    = isset($url_bits['query']) ? '?' . $url_bits['query'] : '';
132
-        $fragment = isset($url_bits['fragment']) ? '#' . $url_bits['fragment'] : '';
133
-        return $scheme . $user . $pass . $host . $port . $path . $query . $fragment;
131
+        $query    = isset($url_bits['query']) ? '?'.$url_bits['query'] : '';
132
+        $fragment = isset($url_bits['fragment']) ? '#'.$url_bits['fragment'] : '';
133
+        return $scheme.$user.$pass.$host.$port.$path.$query.$fragment;
134 134
     }
135 135
 
136 136
 
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
         // grab query string from URL
151 151
         $query = isset($url_bits['query']) ? $url_bits['query'] : '';
152 152
         // if we don't want the query string formatted into an array of key => value pairs, then just return it as is
153
-        if (! $as_array) {
153
+        if ( ! $as_array) {
154 154
             return $query;
155 155
         }
156 156
         // if no query string exists then just return an empty array now
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
             // break apart the key value pairs
167 167
             $query_args = explode('=', $query_args);
168 168
             // and add to our results array
169
-            $query_params[ $query_args[0] ] = $query_args[1];
169
+            $query_params[$query_args[0]] = $query_args[1];
170 170
         }
171 171
         return $query_params;
172 172
     }
@@ -195,8 +195,8 @@  discard block
 block discarded – undo
195 195
      */
196 196
     public static function generate_unique_token($prefix = '')
197 197
     {
198
-        $token = md5(uniqid() . mt_rand());
199
-        return $prefix ? $prefix . '_' . $token : $token;
198
+        $token = md5(uniqid().mt_rand());
199
+        return $prefix ? $prefix.'_'.$token : $token;
200 200
     }
201 201
 
202 202
 
@@ -216,13 +216,13 @@  discard block
 block discarded – undo
216 216
             'HTTP_HOST'   => 1,
217 217
             'PHP_SELF'    => 1,
218 218
         );
219
-        $server_variable  = strtoupper($server_variable);
219
+        $server_variable = strtoupper($server_variable);
220 220
         // whitelist INPUT_SERVER var
221
-        if (isset($server_variables[ $server_variable ])) {
221
+        if (isset($server_variables[$server_variable])) {
222 222
             $URL = filter_input(INPUT_SERVER, $server_variable, FILTER_SANITIZE_URL, FILTER_NULL_ON_FAILURE);
223 223
             if (empty($URL)) {
224 224
                 // fallback sanitization if the above fails
225
-                $URL = wp_sanitize_redirect($_SERVER[ $server_variable ]);
225
+                $URL = wp_sanitize_redirect($_SERVER[$server_variable]);
226 226
             }
227 227
         }
228 228
         return $URL;
Please login to merge, or discard this patch.