Completed
Branch dev (32a315)
by
unknown
22:37 queued 19:28
created
core/EE_Config.core.php 2 patches
Indentation   +3220 added lines, -3220 removed lines patch added patch discarded remove patch
@@ -19,2551 +19,2551 @@  discard block
 block discarded – undo
19 19
 final class EE_Config implements ResettableInterface
20 20
 {
21 21
 
22
-    const OPTION_NAME = 'ee_config';
23
-
24
-    const LOG_NAME = 'ee_config_log';
25
-
26
-    const LOG_LENGTH = 100;
27
-
28
-    const ADDON_OPTION_NAMES = 'ee_config_option_names';
29
-
30
-    /**
31
-     *    instance of the EE_Config object
32
-     *
33
-     * @var    EE_Config $_instance
34
-     * @access    private
35
-     */
36
-    private static $_instance;
37
-
38
-    /**
39
-     * @var boolean $_logging_enabled
40
-     */
41
-    private static $_logging_enabled = false;
42
-
43
-    /**
44
-     * @var LegacyShortcodesManager $legacy_shortcodes_manager
45
-     */
46
-    private $legacy_shortcodes_manager;
47
-
48
-    /**
49
-     * An StdClass whose property names are addon slugs,
50
-     * and values are their config classes
51
-     *
52
-     * @var StdClass
53
-     */
54
-    public $addons;
55
-
56
-    /**
57
-     * @var EE_Admin_Config
58
-     */
59
-    public $admin;
60
-
61
-    /**
62
-     * @var EE_Core_Config
63
-     */
64
-    public $core;
65
-
66
-    /**
67
-     * @var EE_Currency_Config
68
-     */
69
-    public $currency;
70
-
71
-    /**
72
-     * @var EE_Organization_Config
73
-     */
74
-    public $organization;
75
-
76
-    /**
77
-     * @var EE_Registration_Config
78
-     */
79
-    public $registration;
80
-
81
-    /**
82
-     * @var EE_Template_Config
83
-     */
84
-    public $template_settings;
85
-
86
-    /**
87
-     * Holds EE environment values.
88
-     *
89
-     * @var EE_Environment_Config
90
-     */
91
-    public $environment;
92
-
93
-    /**
94
-     * settings pertaining to Google maps
95
-     *
96
-     * @var EE_Map_Config
97
-     */
98
-    public $map_settings;
99
-
100
-    /**
101
-     * settings pertaining to Taxes
102
-     *
103
-     * @var EE_Tax_Config
104
-     */
105
-    public $tax_settings;
106
-
107
-    /**
108
-     * Settings pertaining to global messages settings.
109
-     *
110
-     * @var EE_Messages_Config
111
-     */
112
-    public $messages;
113
-
114
-    /**
115
-     * @deprecated
116
-     * @var EE_Gateway_Config
117
-     */
118
-    public $gateway;
119
-
120
-    /**
121
-     * @var    array $_addon_option_names
122
-     * @access    private
123
-     */
124
-    private $_addon_option_names = array();
125
-
126
-    /**
127
-     * @var    array $_module_route_map
128
-     * @access    private
129
-     */
130
-    private static $_module_route_map = array();
131
-
132
-    /**
133
-     * @var    array $_module_forward_map
134
-     * @access    private
135
-     */
136
-    private static $_module_forward_map = array();
137
-
138
-    /**
139
-     * @var    array $_module_view_map
140
-     * @access    private
141
-     */
142
-    private static $_module_view_map = array();
143
-
144
-
145
-    /**
146
-     * @singleton method used to instantiate class object
147
-     * @access    public
148
-     * @return EE_Config instance
149
-     */
150
-    public static function instance()
151
-    {
152
-        static $initialized = false;
153
-        // check if class object is instantiated, and instantiated properly
154
-        if (! self::$_instance instanceof EE_Config) {
155
-            self::$_instance = new self();
156
-            if (! $initialized) {
157
-                self::$_instance->initialize();
158
-                $initialized = true;
159
-            }
160
-        }
161
-        return self::$_instance;
162
-    }
163
-
164
-
165
-    /**
166
-     * Resets the config
167
-     *
168
-     * @param bool    $hard_reset    if TRUE, sets EE_CONFig back to its original settings in the database. If FALSE
169
-     *                               (default) leaves the database alone, and merely resets the EE_Config object to
170
-     *                               reflect its state in the database
171
-     * @param boolean $reinstantiate if TRUE (default) call instance() and return it. Otherwise, just leave
172
-     *                               $_instance as NULL. Useful in case you want to forget about the old instance on
173
-     *                               EE_Config, but might not be ready to instantiate EE_Config currently (eg if the
174
-     *                               site was put into maintenance mode)
175
-     * @return EE_Config
176
-     */
177
-    public static function reset($hard_reset = false, $reinstantiate = true)
178
-    {
179
-        if (self::$_instance instanceof EE_Config) {
180
-            if ($hard_reset) {
181
-                self::$_instance->legacy_shortcodes_manager = null;
182
-                self::$_instance->_addon_option_names = array();
183
-                self::$_instance->_initialize_config();
184
-                self::$_instance->update_espresso_config();
185
-            }
186
-            self::$_instance->update_addon_option_names();
187
-        }
188
-        self::$_instance = null;
189
-        // we don't need to reset the static properties imo because those should
190
-        // only change when a module is added or removed. Currently we don't
191
-        // support removing a module during a request when it previously existed
192
-        if ($reinstantiate) {
193
-            return self::instance();
194
-        } else {
195
-            return null;
196
-        }
197
-    }
198
-
199
-
200
-    private function __construct()
201
-    {
202
-    }
203
-
204
-
205
-    private function initialize()
206
-    {
207
-        do_action('AHEE__EE_Config__construct__begin', $this);
208
-        EE_Config::$_logging_enabled = apply_filters('FHEE__EE_Config___construct__logging_enabled', false);
209
-        // setup empty config classes
210
-        $this->_initialize_config();
211
-        // load existing EE site settings
212
-        $this->_load_core_config();
213
-        // confirm everything loaded correctly and set filtered defaults if not
214
-        $this->_verify_config();
215
-        //  register shortcodes and modules
216
-        add_action(
217
-            'AHEE__EE_System__register_shortcodes_modules_and_widgets',
218
-            [$this, 'register_shortcodes_and_modules'],
219
-            999
220
-        );
221
-        //  initialize shortcodes and modules
222
-        add_action('AHEE__EE_System__core_loaded_and_ready', [$this, 'initialize_shortcodes_and_modules']);
223
-        // register widgets
224
-        add_action('widgets_init', [$this, 'widgets_init'], 10);
225
-        // shutdown
226
-        add_action('shutdown', [$this, 'shutdown'], 10);
227
-        // construct__end hook
228
-        do_action('AHEE__EE_Config__construct__end', $this);
229
-        // hardcoded hack
230
-        $this->template_settings->current_espresso_theme = 'Espresso_Arabica_2014';
231
-    }
232
-
233
-
234
-    /**
235
-     * @return boolean
236
-     */
237
-    public static function logging_enabled()
238
-    {
239
-        return self::$_logging_enabled;
240
-    }
241
-
242
-
243
-    /**
244
-     * use to get the current theme if needed from static context
245
-     *
246
-     * @return string current theme set.
247
-     */
248
-    public static function get_current_theme()
249
-    {
250
-        return isset(self::$_instance->template_settings->current_espresso_theme)
251
-            ? self::$_instance->template_settings->current_espresso_theme : 'Espresso_Arabica_2014';
252
-    }
253
-
254
-
255
-    /**
256
-     *        _initialize_config
257
-     *
258
-     * @access private
259
-     * @return void
260
-     */
261
-    private function _initialize_config()
262
-    {
263
-        EE_Config::trim_log();
264
-        // set defaults
265
-        $this->_addon_option_names = get_option(EE_Config::ADDON_OPTION_NAMES, array());
266
-        $this->addons = new stdClass();
267
-        // set _module_route_map
268
-        EE_Config::$_module_route_map = array();
269
-        // set _module_forward_map
270
-        EE_Config::$_module_forward_map = array();
271
-        // set _module_view_map
272
-        EE_Config::$_module_view_map = array();
273
-    }
274
-
275
-
276
-    /**
277
-     *        load core plugin configuration
278
-     *
279
-     * @access private
280
-     * @return void
281
-     */
282
-    private function _load_core_config()
283
-    {
284
-        // load_core_config__start hook
285
-        do_action('AHEE__EE_Config___load_core_config__start', $this);
286
-        $espresso_config = $this->get_espresso_config();
287
-        foreach ($espresso_config as $config => $settings) {
288
-            // load_core_config__start hook
289
-            $settings = apply_filters(
290
-                'FHEE__EE_Config___load_core_config__config_settings',
291
-                $settings,
292
-                $config,
293
-                $this
294
-            );
295
-            if (is_object($settings) && property_exists($this, $config)) {
296
-                $this->{$config} = apply_filters('FHEE__EE_Config___load_core_config__' . $config, $settings);
297
-                // call configs populate method to ensure any defaults are set for empty values.
298
-                if (method_exists($settings, 'populate')) {
299
-                    $this->{$config}->populate();
300
-                }
301
-                if (method_exists($settings, 'do_hooks')) {
302
-                    $this->{$config}->do_hooks();
303
-                }
304
-            }
305
-        }
306
-        if (apply_filters('FHEE__EE_Config___load_core_config__update_espresso_config', false)) {
307
-            $this->update_espresso_config();
308
-        }
309
-        // load_core_config__end hook
310
-        do_action('AHEE__EE_Config___load_core_config__end', $this);
311
-    }
312
-
313
-
314
-    /**
315
-     *    _verify_config
316
-     *
317
-     * @access    protected
318
-     * @return    void
319
-     */
320
-    protected function _verify_config()
321
-    {
322
-        $this->core = $this->core instanceof EE_Core_Config
323
-            ? $this->core
324
-            : new EE_Core_Config();
325
-        $this->core = apply_filters('FHEE__EE_Config___initialize_config__core', $this->core);
326
-        $this->organization = $this->organization instanceof EE_Organization_Config
327
-            ? $this->organization
328
-            : new EE_Organization_Config();
329
-        $this->organization = apply_filters(
330
-            'FHEE__EE_Config___initialize_config__organization',
331
-            $this->organization
332
-        );
333
-        $this->currency = $this->currency instanceof EE_Currency_Config
334
-            ? $this->currency
335
-            : new EE_Currency_Config();
336
-        $this->currency = apply_filters('FHEE__EE_Config___initialize_config__currency', $this->currency);
337
-        $this->registration = $this->registration instanceof EE_Registration_Config
338
-            ? $this->registration
339
-            : new EE_Registration_Config();
340
-        $this->registration = apply_filters(
341
-            'FHEE__EE_Config___initialize_config__registration',
342
-            $this->registration
343
-        );
344
-        $this->admin = $this->admin instanceof EE_Admin_Config
345
-            ? $this->admin
346
-            : new EE_Admin_Config();
347
-        $this->admin = apply_filters('FHEE__EE_Config___initialize_config__admin', $this->admin);
348
-        $this->template_settings = $this->template_settings instanceof EE_Template_Config
349
-            ? $this->template_settings
350
-            : new EE_Template_Config();
351
-        $this->template_settings = apply_filters(
352
-            'FHEE__EE_Config___initialize_config__template_settings',
353
-            $this->template_settings
354
-        );
355
-        $this->map_settings = $this->map_settings instanceof EE_Map_Config
356
-            ? $this->map_settings
357
-            : new EE_Map_Config();
358
-        $this->map_settings = apply_filters(
359
-            'FHEE__EE_Config___initialize_config__map_settings',
360
-            $this->map_settings
361
-        );
362
-        $this->environment = $this->environment instanceof EE_Environment_Config
363
-            ? $this->environment
364
-            : new EE_Environment_Config();
365
-        $this->environment = apply_filters(
366
-            'FHEE__EE_Config___initialize_config__environment',
367
-            $this->environment
368
-        );
369
-        $this->tax_settings = $this->tax_settings instanceof EE_Tax_Config
370
-            ? $this->tax_settings
371
-            : new EE_Tax_Config();
372
-        $this->tax_settings = apply_filters(
373
-            'FHEE__EE_Config___initialize_config__tax_settings',
374
-            $this->tax_settings
375
-        );
376
-        $this->messages = apply_filters('FHEE__EE_Config__initialize_config__messages', $this->messages);
377
-        $this->messages = $this->messages instanceof EE_Messages_Config
378
-            ? $this->messages
379
-            : new EE_Messages_Config();
380
-        $this->gateway = $this->gateway instanceof EE_Gateway_Config
381
-            ? $this->gateway
382
-            : new EE_Gateway_Config();
383
-        $this->gateway = apply_filters('FHEE__EE_Config___initialize_config__gateway', $this->gateway);
384
-        $this->legacy_shortcodes_manager = null;
385
-    }
386
-
387
-
388
-    /**
389
-     *    get_espresso_config
390
-     *
391
-     * @access    public
392
-     * @return    array of espresso config stuff
393
-     */
394
-    public function get_espresso_config()
395
-    {
396
-        // grab espresso configuration
397
-        return apply_filters(
398
-            'FHEE__EE_Config__get_espresso_config__CFG',
399
-            get_option(EE_Config::OPTION_NAME, array())
400
-        );
401
-    }
402
-
403
-
404
-    /**
405
-     *    double_check_config_comparison
406
-     *
407
-     * @access    public
408
-     * @param string $option
409
-     * @param        $old_value
410
-     * @param        $value
411
-     */
412
-    public function double_check_config_comparison($option = '', $old_value, $value)
413
-    {
414
-        // make sure we're checking the ee config
415
-        if ($option === EE_Config::OPTION_NAME) {
416
-            // run a loose comparison of the old value against the new value for type and properties,
417
-            // but NOT exact instance like WP update_option does (ie: NOT type safe comparison)
418
-            if ($value != $old_value) {
419
-                // if they are NOT the same, then remove the hook,
420
-                // which means the subsequent update results will be based solely on the update query results
421
-                // the reason we do this is because, as stated above,
422
-                // WP update_option performs an exact instance comparison (===) on any update values passed to it
423
-                // this happens PRIOR to serialization and any subsequent update.
424
-                // If values are found to match their previous old value,
425
-                // then WP bails before performing any update.
426
-                // Since we are passing the EE_Config object, it is comparing the EXACT instance of the saved version
427
-                // it just pulled from the db, with the one being passed to it (which will not match).
428
-                // HOWEVER, once the object is serialized and passed off to MySQL to update,
429
-                // MySQL MAY ALSO NOT perform the update because
430
-                // the string it sees in the db looks the same as the new one it has been passed!!!
431
-                // This results in the query returning an "affected rows" value of ZERO,
432
-                // which gets returned immediately by WP update_option and looks like an error.
433
-                remove_action('update_option', array($this, 'check_config_updated'));
434
-            }
435
-        }
436
-    }
437
-
438
-
439
-    /**
440
-     *    update_espresso_config
441
-     *
442
-     * @access   public
443
-     */
444
-    protected function _reset_espresso_addon_config()
445
-    {
446
-        $this->_addon_option_names = array();
447
-        foreach ($this->addons as $addon_name => $addon_config_obj) {
448
-            $addon_config_obj = maybe_unserialize($addon_config_obj);
449
-            if ($addon_config_obj instanceof EE_Config_Base) {
450
-                $this->update_config('addons', $addon_name, $addon_config_obj, false);
451
-            }
452
-            $this->addons->{$addon_name} = null;
453
-        }
454
-    }
455
-
456
-
457
-    /**
458
-     *    update_espresso_config
459
-     *
460
-     * @access   public
461
-     * @param   bool $add_success
462
-     * @param   bool $add_error
463
-     * @return   bool
464
-     */
465
-    public function update_espresso_config($add_success = false, $add_error = true)
466
-    {
467
-        // don't allow config updates during WP heartbeats
468
-        /** @var RequestInterface $request */
469
-        $request = LoaderFactory::getLoader()->getShared(RequestInterface::class);
470
-        if ($request->isWordPressHeartbeat()) {
471
-            return false;
472
-        }
473
-        // commented out the following re: https://events.codebasehq.com/projects/event-espresso/tickets/8197
474
-        // $clone = clone( self::$_instance );
475
-        // self::$_instance = NULL;
476
-        do_action('AHEE__EE_Config__update_espresso_config__begin', $this);
477
-        $this->_reset_espresso_addon_config();
478
-        // hook into update_option because that happens AFTER the ( $value === $old_value ) conditional
479
-        // but BEFORE the actual update occurs
480
-        add_action('update_option', array($this, 'double_check_config_comparison'), 1, 3);
481
-        // don't want to persist legacy_shortcodes_manager, but don't want to lose it either
482
-        $legacy_shortcodes_manager = $this->legacy_shortcodes_manager;
483
-        $this->legacy_shortcodes_manager = null;
484
-        // now update "ee_config"
485
-        $saved = update_option(EE_Config::OPTION_NAME, $this);
486
-        $this->legacy_shortcodes_manager = $legacy_shortcodes_manager;
487
-        EE_Config::log(EE_Config::OPTION_NAME);
488
-        // if not saved... check if the hook we just added still exists;
489
-        // if it does, it means one of two things:
490
-        // that update_option bailed at the($value === $old_value) conditional,
491
-        // or...
492
-        // the db update query returned 0 rows affected
493
-        // (probably because the data  value was the same from it's perspective)
494
-        // so the existence of the hook means that a negative result from update_option is NOT an error,
495
-        // but just means no update occurred, so don't display an error to the user.
496
-        // BUT... if update_option returns FALSE, AND the hook is missing,
497
-        // then it means that something truly went wrong
498
-        $saved = ! $saved ? has_action('update_option', array($this, 'double_check_config_comparison')) : $saved;
499
-        // remove our action since we don't want it in the system anymore
500
-        remove_action('update_option', array($this, 'double_check_config_comparison'), 1);
501
-        do_action('AHEE__EE_Config__update_espresso_config__end', $this, $saved);
502
-        // self::$_instance = $clone;
503
-        // unset( $clone );
504
-        // if config remains the same or was updated successfully
505
-        if ($saved) {
506
-            if ($add_success) {
507
-                EE_Error::add_success(
508
-                    esc_html__('The Event Espresso Configuration Settings have been successfully updated.', 'event_espresso'),
509
-                    __FILE__,
510
-                    __FUNCTION__,
511
-                    __LINE__
512
-                );
513
-            }
514
-            return true;
515
-        } else {
516
-            if ($add_error) {
517
-                EE_Error::add_error(
518
-                    esc_html__('The Event Espresso Configuration Settings were not updated.', 'event_espresso'),
519
-                    __FILE__,
520
-                    __FUNCTION__,
521
-                    __LINE__
522
-                );
523
-            }
524
-            return false;
525
-        }
526
-    }
527
-
528
-
529
-    /**
530
-     *    _verify_config_params
531
-     *
532
-     * @access    private
533
-     * @param    string         $section
534
-     * @param    string         $name
535
-     * @param    string         $config_class
536
-     * @param    EE_Config_Base $config_obj
537
-     * @param    array          $tests_to_run
538
-     * @param    bool           $display_errors
539
-     * @return    bool    TRUE on success, FALSE on fail
540
-     */
541
-    private function _verify_config_params(
542
-        $section = '',
543
-        $name = '',
544
-        $config_class = '',
545
-        $config_obj = null,
546
-        $tests_to_run = array(1, 2, 3, 4, 5, 6, 7, 8),
547
-        $display_errors = true
548
-    ) {
549
-        try {
550
-            foreach ($tests_to_run as $test) {
551
-                switch ($test) {
552
-                    // TEST #1 : check that section was set
553
-                    case 1:
554
-                        if (empty($section)) {
555
-                            if ($display_errors) {
556
-                                throw new EE_Error(
557
-                                    sprintf(
558
-                                        esc_html__(
559
-                                            'No configuration section has been provided while attempting to save "%s".',
560
-                                            'event_espresso'
561
-                                        ),
562
-                                        $config_class
563
-                                    )
564
-                                );
565
-                            }
566
-                            return false;
567
-                        }
568
-                        break;
569
-                    // TEST #2 : check that settings section exists
570
-                    case 2:
571
-                        if (! isset($this->{$section})) {
572
-                            if ($display_errors) {
573
-                                throw new EE_Error(
574
-                                    sprintf(
575
-                                        esc_html__('The "%s" configuration section does not exist.', 'event_espresso'),
576
-                                        $section
577
-                                    )
578
-                                );
579
-                            }
580
-                            return false;
581
-                        }
582
-                        break;
583
-                    // TEST #3 : check that section is the proper format
584
-                    case 3:
585
-                        if (
586
-                            ! ($this->{$section} instanceof EE_Config_Base || $this->{$section} instanceof stdClass)
587
-                        ) {
588
-                            if ($display_errors) {
589
-                                throw new EE_Error(
590
-                                    sprintf(
591
-                                        esc_html__(
592
-                                            'The "%s" configuration settings have not been formatted correctly.',
593
-                                            'event_espresso'
594
-                                        ),
595
-                                        $section
596
-                                    )
597
-                                );
598
-                            }
599
-                            return false;
600
-                        }
601
-                        break;
602
-                    // TEST #4 : check that config section name has been set
603
-                    case 4:
604
-                        if (empty($name)) {
605
-                            if ($display_errors) {
606
-                                throw new EE_Error(
607
-                                    esc_html__(
608
-                                        'No name has been provided for the specific configuration section.',
609
-                                        'event_espresso'
610
-                                    )
611
-                                );
612
-                            }
613
-                            return false;
614
-                        }
615
-                        break;
616
-                    // TEST #5 : check that a config class name has been set
617
-                    case 5:
618
-                        if (empty($config_class)) {
619
-                            if ($display_errors) {
620
-                                throw new EE_Error(
621
-                                    esc_html__(
622
-                                        'No class name has been provided for the specific configuration section.',
623
-                                        'event_espresso'
624
-                                    )
625
-                                );
626
-                            }
627
-                            return false;
628
-                        }
629
-                        break;
630
-                    // TEST #6 : verify config class is accessible
631
-                    case 6:
632
-                        if (! class_exists($config_class)) {
633
-                            if ($display_errors) {
634
-                                throw new EE_Error(
635
-                                    sprintf(
636
-                                        esc_html__(
637
-                                            'The "%s" class does not exist. Please ensure that an autoloader has been set for it.',
638
-                                            'event_espresso'
639
-                                        ),
640
-                                        $config_class
641
-                                    )
642
-                                );
643
-                            }
644
-                            return false;
645
-                        }
646
-                        break;
647
-                    // TEST #7 : check that config has even been set
648
-                    case 7:
649
-                        if (! isset($this->{$section}->{$name})) {
650
-                            if ($display_errors) {
651
-                                throw new EE_Error(
652
-                                    sprintf(
653
-                                        esc_html__('No configuration has been set for "%1$s->%2$s".', 'event_espresso'),
654
-                                        $section,
655
-                                        $name
656
-                                    )
657
-                                );
658
-                            }
659
-                            return false;
660
-                        } else {
661
-                            // and make sure it's not serialized
662
-                            $this->{$section}->{$name} = maybe_unserialize($this->{$section}->{$name});
663
-                        }
664
-                        break;
665
-                    // TEST #8 : check that config is the requested type
666
-                    case 8:
667
-                        if (! $this->{$section}->{$name} instanceof $config_class) {
668
-                            if ($display_errors) {
669
-                                throw new EE_Error(
670
-                                    sprintf(
671
-                                        esc_html__(
672
-                                            'The configuration for "%1$s->%2$s" is not of the "%3$s" class.',
673
-                                            'event_espresso'
674
-                                        ),
675
-                                        $section,
676
-                                        $name,
677
-                                        $config_class
678
-                                    )
679
-                                );
680
-                            }
681
-                            return false;
682
-                        }
683
-                        break;
684
-                    // TEST #9 : verify config object
685
-                    case 9:
686
-                        if (! $config_obj instanceof EE_Config_Base) {
687
-                            if ($display_errors) {
688
-                                throw new EE_Error(
689
-                                    sprintf(
690
-                                        esc_html__('The "%s" class is not an instance of EE_Config_Base.', 'event_espresso'),
691
-                                        print_r($config_obj, true)
692
-                                    )
693
-                                );
694
-                            }
695
-                            return false;
696
-                        }
697
-                        break;
698
-                }
699
-            }
700
-        } catch (EE_Error $e) {
701
-            $e->get_error();
702
-        }
703
-        // you have successfully run the gauntlet
704
-        return true;
705
-    }
706
-
707
-
708
-    /**
709
-     *    _generate_config_option_name
710
-     *
711
-     * @access        protected
712
-     * @param        string $section
713
-     * @param        string $name
714
-     * @return        string
715
-     */
716
-    private function _generate_config_option_name($section = '', $name = '')
717
-    {
718
-        return 'ee_config-' . strtolower($section . '-' . str_replace(array('EE_', 'EED_'), '', $name));
719
-    }
720
-
721
-
722
-    /**
723
-     *    _set_config_class
724
-     * ensures that a config class is set, either from a passed config class or one generated from the config name
725
-     *
726
-     * @access    private
727
-     * @param    string $config_class
728
-     * @param    string $name
729
-     * @return    string
730
-     */
731
-    private function _set_config_class($config_class = '', $name = '')
732
-    {
733
-        return ! empty($config_class)
734
-            ? $config_class
735
-            : str_replace(' ', '_', ucwords(str_replace('_', ' ', $name))) . '_Config';
736
-    }
737
-
738
-
739
-    /**
740
-     *    set_config
741
-     *
742
-     * @access    protected
743
-     * @param    string         $section
744
-     * @param    string         $name
745
-     * @param    string         $config_class
746
-     * @param    EE_Config_Base $config_obj
747
-     * @return    EE_Config_Base
748
-     */
749
-    public function set_config($section = '', $name = '', $config_class = '', EE_Config_Base $config_obj = null)
750
-    {
751
-        // ensure config class is set to something
752
-        $config_class = $this->_set_config_class($config_class, $name);
753
-        // run tests 1-4, 6, and 7 to verify all config params are set and valid
754
-        if (! $this->_verify_config_params($section, $name, $config_class, null, array(1, 2, 3, 4, 5, 6))) {
755
-            return null;
756
-        }
757
-        $config_option_name = $this->_generate_config_option_name($section, $name);
758
-        // if the config option name hasn't been added yet to the list of option names we're tracking, then do so now
759
-        if (! isset($this->_addon_option_names[ $config_option_name ])) {
760
-            $this->_addon_option_names[ $config_option_name ] = $config_class;
761
-            $this->update_addon_option_names();
762
-        }
763
-        // verify the incoming config object but suppress errors
764
-        if (! $this->_verify_config_params($section, $name, $config_class, $config_obj, array(9), false)) {
765
-            $config_obj = new $config_class();
766
-        }
767
-        if (get_option($config_option_name)) {
768
-            EE_Config::log($config_option_name);
769
-            update_option($config_option_name, $config_obj);
770
-            $this->{$section}->{$name} = $config_obj;
771
-            return $this->{$section}->{$name};
772
-        } else {
773
-            // create a wp-option for this config
774
-            if (add_option($config_option_name, $config_obj, '', 'no')) {
775
-                $this->{$section}->{$name} = maybe_unserialize($config_obj);
776
-                return $this->{$section}->{$name};
777
-            } else {
778
-                EE_Error::add_error(
779
-                    sprintf(esc_html__('The "%s" could not be saved to the database.', 'event_espresso'), $config_class),
780
-                    __FILE__,
781
-                    __FUNCTION__,
782
-                    __LINE__
783
-                );
784
-                return null;
785
-            }
786
-        }
787
-    }
788
-
789
-
790
-    /**
791
-     *    update_config
792
-     * Important: the config object must ALREADY be set, otherwise this will produce an error.
793
-     *
794
-     * @access    public
795
-     * @param    string                $section
796
-     * @param    string                $name
797
-     * @param    EE_Config_Base|string $config_obj
798
-     * @param    bool                  $throw_errors
799
-     * @return    bool
800
-     */
801
-    public function update_config($section = '', $name = '', $config_obj = '', $throw_errors = true)
802
-    {
803
-        // don't allow config updates during WP heartbeats
804
-        /** @var RequestInterface $request */
805
-        $request = LoaderFactory::getLoader()->getShared(RequestInterface::class);
806
-        if ($request->isWordPressHeartbeat()) {
807
-            return false;
808
-        }
809
-        $config_obj = maybe_unserialize($config_obj);
810
-        // get class name of the incoming object
811
-        $config_class = get_class($config_obj);
812
-        // run tests 1-5 and 9 to verify config
813
-        if (
814
-            ! $this->_verify_config_params(
815
-                $section,
816
-                $name,
817
-                $config_class,
818
-                $config_obj,
819
-                array(1, 2, 3, 4, 7, 9)
820
-            )
821
-        ) {
822
-            return false;
823
-        }
824
-        $config_option_name = $this->_generate_config_option_name($section, $name);
825
-        // check if config object has been added to db by seeing if config option name is in $this->_addon_option_names array
826
-        if (! isset($this->_addon_option_names[ $config_option_name ])) {
827
-            // save new config to db
828
-            if ($this->set_config($section, $name, $config_class, $config_obj)) {
829
-                return true;
830
-            }
831
-        } else {
832
-            // first check if the record already exists
833
-            $existing_config = get_option($config_option_name);
834
-            $config_obj = serialize($config_obj);
835
-            // just return if db record is already up to date (NOT type safe comparison)
836
-            if ($existing_config == $config_obj) {
837
-                $this->{$section}->{$name} = $config_obj;
838
-                return true;
839
-            } elseif (update_option($config_option_name, $config_obj)) {
840
-                EE_Config::log($config_option_name);
841
-                // update wp-option for this config class
842
-                $this->{$section}->{$name} = $config_obj;
843
-                return true;
844
-            } elseif ($throw_errors) {
845
-                EE_Error::add_error(
846
-                    sprintf(
847
-                        esc_html__(
848
-                            'The "%1$s" object stored at"%2$s" was not successfully updated in the database.',
849
-                            'event_espresso'
850
-                        ),
851
-                        $config_class,
852
-                        'EE_Config->' . $section . '->' . $name
853
-                    ),
854
-                    __FILE__,
855
-                    __FUNCTION__,
856
-                    __LINE__
857
-                );
858
-            }
859
-        }
860
-        return false;
861
-    }
862
-
863
-
864
-    /**
865
-     *    get_config
866
-     *
867
-     * @access    public
868
-     * @param    string $section
869
-     * @param    string $name
870
-     * @param    string $config_class
871
-     * @return    mixed EE_Config_Base | NULL
872
-     */
873
-    public function get_config($section = '', $name = '', $config_class = '')
874
-    {
875
-        // ensure config class is set to something
876
-        $config_class = $this->_set_config_class($config_class, $name);
877
-        // run tests 1-4, 6 and 7 to verify that all params have been set
878
-        if (! $this->_verify_config_params($section, $name, $config_class, null, array(1, 2, 3, 4, 5, 6))) {
879
-            return null;
880
-        }
881
-        // now test if the requested config object exists, but suppress errors
882
-        if ($this->_verify_config_params($section, $name, $config_class, null, array(7, 8), false)) {
883
-            // config already exists, so pass it back
884
-            return $this->{$section}->{$name};
885
-        }
886
-        // load config option from db if it exists
887
-        $config_obj = $this->get_config_option($this->_generate_config_option_name($section, $name));
888
-        // verify the newly retrieved config object, but suppress errors
889
-        if ($this->_verify_config_params($section, $name, $config_class, $config_obj, array(9), false)) {
890
-            // config is good, so set it and pass it back
891
-            $this->{$section}->{$name} = $config_obj;
892
-            return $this->{$section}->{$name};
893
-        }
894
-        // oops! $config_obj is not already set and does not exist in the db, so create a new one
895
-        $config_obj = $this->set_config($section, $name, $config_class);
896
-        // verify the newly created config object
897
-        if ($this->_verify_config_params($section, $name, $config_class, $config_obj, array(9))) {
898
-            return $this->{$section}->{$name};
899
-        } else {
900
-            EE_Error::add_error(
901
-                sprintf(esc_html__('The "%s" could not be retrieved from the database.', 'event_espresso'), $config_class),
902
-                __FILE__,
903
-                __FUNCTION__,
904
-                __LINE__
905
-            );
906
-        }
907
-        return null;
908
-    }
909
-
910
-
911
-    /**
912
-     *    get_config_option
913
-     *
914
-     * @access    public
915
-     * @param    string $config_option_name
916
-     * @return    mixed EE_Config_Base | FALSE
917
-     */
918
-    public function get_config_option($config_option_name = '')
919
-    {
920
-        // retrieve the wp-option for this config class.
921
-        $config_option = maybe_unserialize(get_option($config_option_name, array()));
922
-        if (empty($config_option)) {
923
-            EE_Config::log($config_option_name . '-NOT-FOUND');
924
-        }
925
-        return $config_option;
926
-    }
927
-
928
-
929
-    /**
930
-     * log
931
-     *
932
-     * @param string $config_option_name
933
-     */
934
-    public static function log($config_option_name = '')
935
-    {
936
-        if (EE_Config::logging_enabled() && ! empty($config_option_name)) {
937
-            $config_log = get_option(EE_Config::LOG_NAME, array());
938
-            /** @var RequestParams $request */
939
-            $request = LoaderFactory::getLoader()->getShared(RequestParams::class);
940
-            $config_log[ (string) microtime(true) ] = array(
941
-                'config_name' => $config_option_name,
942
-                'request'     => $request->requestParams(),
943
-            );
944
-            update_option(EE_Config::LOG_NAME, $config_log);
945
-        }
946
-    }
947
-
948
-
949
-    /**
950
-     * trim_log
951
-     * reduces the size of the config log to the length specified by EE_Config::LOG_LENGTH
952
-     */
953
-    public static function trim_log()
954
-    {
955
-        if (! EE_Config::logging_enabled()) {
956
-            return;
957
-        }
958
-        $config_log = maybe_unserialize(get_option(EE_Config::LOG_NAME, array()));
959
-        $log_length = count($config_log);
960
-        if ($log_length > EE_Config::LOG_LENGTH) {
961
-            ksort($config_log);
962
-            $config_log = array_slice($config_log, $log_length - EE_Config::LOG_LENGTH, null, true);
963
-            update_option(EE_Config::LOG_NAME, $config_log);
964
-        }
965
-    }
966
-
967
-
968
-    /**
969
-     *    get_page_for_posts
970
-     *    if the wp-option "show_on_front" is set to "page", then this is the post_name for the post set in the
971
-     *    wp-option "page_for_posts", or "posts" if no page is selected
972
-     *
973
-     * @access    public
974
-     * @return    string
975
-     */
976
-    public static function get_page_for_posts()
977
-    {
978
-        $page_for_posts = get_option('page_for_posts');
979
-        if (! $page_for_posts) {
980
-            return 'posts';
981
-        }
982
-        global $wpdb;
983
-        $SQL = "SELECT post_name from $wpdb->posts WHERE post_type='posts' OR post_type='page' AND post_status='publish' AND ID=%d";
984
-        return $wpdb->get_var($wpdb->prepare($SQL, $page_for_posts));
985
-    }
986
-
987
-
988
-    /**
989
-     *    register_shortcodes_and_modules.
990
-     *    At this point, it's too early to tell if we're maintenance mode or not.
991
-     *    In fact, this is where we give modules a chance to let core know they exist
992
-     *    so they can help trigger maintenance mode if it's needed
993
-     *
994
-     * @access    public
995
-     * @return    void
996
-     */
997
-    public function register_shortcodes_and_modules()
998
-    {
999
-        // allow modules to set hooks for the rest of the system
1000
-        EE_Registry::instance()->modules = $this->_register_modules();
1001
-    }
1002
-
1003
-
1004
-    /**
1005
-     *    initialize_shortcodes_and_modules
1006
-     *    meaning they can start adding their hooks to get stuff done
1007
-     *
1008
-     * @access    public
1009
-     * @return    void
1010
-     */
1011
-    public function initialize_shortcodes_and_modules()
1012
-    {
1013
-        // allow modules to set hooks for the rest of the system
1014
-        $this->_initialize_modules();
1015
-    }
1016
-
1017
-
1018
-    /**
1019
-     *    widgets_init
1020
-     *
1021
-     * @access private
1022
-     * @return void
1023
-     */
1024
-    public function widgets_init()
1025
-    {
1026
-        // only init widgets on admin pages when not in complete maintenance, and
1027
-        // on frontend when not in any maintenance mode
1028
-        if (
1029
-            ! EE_Maintenance_Mode::instance()->level()
1030
-            || (
1031
-                is_admin()
1032
-                && EE_Maintenance_Mode::instance()->level() !== EE_Maintenance_Mode::level_2_complete_maintenance
1033
-            )
1034
-        ) {
1035
-            // grab list of installed widgets
1036
-            $widgets_to_register = glob(EE_WIDGETS . '*', GLOB_ONLYDIR);
1037
-            // filter list of modules to register
1038
-            $widgets_to_register = apply_filters(
1039
-                'FHEE__EE_Config__register_widgets__widgets_to_register',
1040
-                $widgets_to_register
1041
-            );
1042
-            if (! empty($widgets_to_register)) {
1043
-                // cycle thru widget folders
1044
-                foreach ($widgets_to_register as $widget_path) {
1045
-                    // add to list of installed widget modules
1046
-                    EE_Config::register_ee_widget($widget_path);
1047
-                }
1048
-            }
1049
-            // filter list of installed modules
1050
-            EE_Registry::instance()->widgets = apply_filters(
1051
-                'FHEE__EE_Config__register_widgets__installed_widgets',
1052
-                EE_Registry::instance()->widgets
1053
-            );
1054
-        }
1055
-    }
1056
-
1057
-
1058
-    /**
1059
-     *    register_ee_widget - makes core aware of this widget
1060
-     *
1061
-     * @access    public
1062
-     * @param    string $widget_path - full path up to and including widget folder
1063
-     * @return    void
1064
-     */
1065
-    public static function register_ee_widget($widget_path = null)
1066
-    {
1067
-        do_action('AHEE__EE_Config__register_widget__begin', $widget_path);
1068
-        $widget_ext = '.widget.php';
1069
-        // make all separators match
1070
-        $widget_path = rtrim(str_replace('\\', DS, $widget_path), DS);
1071
-        // does the file path INCLUDE the actual file name as part of the path ?
1072
-        if (strpos($widget_path, $widget_ext) !== false) {
1073
-            // grab and shortcode file name from directory name and break apart at dots
1074
-            $file_name = explode('.', basename($widget_path));
1075
-            // take first segment from file name pieces and remove class prefix if it exists
1076
-            $widget = strpos($file_name[0], 'EEW_') === 0 ? substr($file_name[0], 4) : $file_name[0];
1077
-            // sanitize shortcode directory name
1078
-            $widget = sanitize_key($widget);
1079
-            // now we need to rebuild the shortcode path
1080
-            $widget_path = explode('/', $widget_path);
1081
-            // remove last segment
1082
-            array_pop($widget_path);
1083
-            // glue it back together
1084
-            $widget_path = implode(DS, $widget_path);
1085
-        } else {
1086
-            // grab and sanitize widget directory name
1087
-            $widget = sanitize_key(basename($widget_path));
1088
-        }
1089
-        // create classname from widget directory name
1090
-        $widget = str_replace(' ', '_', ucwords(str_replace('_', ' ', $widget)));
1091
-        // add class prefix
1092
-        $widget_class = 'EEW_' . $widget;
1093
-        // does the widget exist ?
1094
-        if (! is_readable($widget_path . '/' . $widget_class . $widget_ext)) {
1095
-            $msg = sprintf(
1096
-                esc_html__(
1097
-                    'The requested %s widget file could not be found or is not readable due to file permissions. Please ensure the following path is correct: %s',
1098
-                    'event_espresso'
1099
-                ),
1100
-                $widget_class,
1101
-                $widget_path . '/' . $widget_class . $widget_ext
1102
-            );
1103
-            EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__);
1104
-            return;
1105
-        }
1106
-        // load the widget class file
1107
-        require_once($widget_path . '/' . $widget_class . $widget_ext);
1108
-        // verify that class exists
1109
-        if (! class_exists($widget_class)) {
1110
-            $msg = sprintf(esc_html__('The requested %s widget class does not exist.', 'event_espresso'), $widget_class);
1111
-            EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__);
1112
-            return;
1113
-        }
1114
-        register_widget($widget_class);
1115
-        // add to array of registered widgets
1116
-        EE_Registry::instance()->widgets->{$widget_class} = $widget_path . '/' . $widget_class . $widget_ext;
1117
-    }
1118
-
1119
-
1120
-    /**
1121
-     *        _register_modules
1122
-     *
1123
-     * @access private
1124
-     * @return array
1125
-     */
1126
-    private function _register_modules()
1127
-    {
1128
-        // grab list of installed modules
1129
-        $modules_to_register = glob(EE_MODULES . '*', GLOB_ONLYDIR);
1130
-        // filter list of modules to register
1131
-        $modules_to_register = apply_filters(
1132
-            'FHEE__EE_Config__register_modules__modules_to_register',
1133
-            $modules_to_register
1134
-        );
1135
-        if (! empty($modules_to_register)) {
1136
-            // loop through folders
1137
-            foreach ($modules_to_register as $module_path) {
1138
-                /**TEMPORARILY EXCLUDE gateways from modules for time being**/
1139
-                if (
1140
-                    $module_path !== EE_MODULES . 'zzz-copy-this-module-template'
1141
-                    && $module_path !== EE_MODULES . 'gateways'
1142
-                ) {
1143
-                    // add to list of installed modules
1144
-                    EE_Config::register_module($module_path);
1145
-                }
1146
-            }
1147
-        }
1148
-        // filter list of installed modules
1149
-        return apply_filters(
1150
-            'FHEE__EE_Config___register_modules__installed_modules',
1151
-            EE_Registry::instance()->modules
1152
-        );
1153
-    }
1154
-
1155
-
1156
-    /**
1157
-     *    register_module - makes core aware of this module
1158
-     *
1159
-     * @access    public
1160
-     * @param    string $module_path - full path up to and including module folder
1161
-     * @return    bool
1162
-     */
1163
-    public static function register_module($module_path = null)
1164
-    {
1165
-        do_action('AHEE__EE_Config__register_module__begin', $module_path);
1166
-        $module_ext = '.module.php';
1167
-        // make all separators match
1168
-        $module_path = str_replace(array('\\', '/'), '/', $module_path);
1169
-        // does the file path INCLUDE the actual file name as part of the path ?
1170
-        if (strpos($module_path, $module_ext) !== false) {
1171
-            // grab and shortcode file name from directory name and break apart at dots
1172
-            $module_file = explode('.', basename($module_path));
1173
-            // now we need to rebuild the shortcode path
1174
-            $module_path = explode('/', $module_path);
1175
-            // remove last segment
1176
-            array_pop($module_path);
1177
-            // glue it back together
1178
-            $module_path = implode('/', $module_path) . '/';
1179
-            // take first segment from file name pieces and sanitize it
1180
-            $module = preg_replace('/[^a-zA-Z0-9_\-]/', '', $module_file[0]);
1181
-            // ensure class prefix is added
1182
-            $module_class = strpos($module, 'EED_') !== 0 ? 'EED_' . $module : $module;
1183
-        } else {
1184
-            // we need to generate the filename based off of the folder name
1185
-            // grab and sanitize module name
1186
-            $module = strtolower(basename($module_path));
1187
-            $module = preg_replace('/[^a-z0-9_\-]/', '', $module);
1188
-            // like trailingslashit()
1189
-            $module_path = rtrim($module_path, '/') . '/';
1190
-            // create classname from module directory name
1191
-            $module = str_replace(' ', '_', ucwords(str_replace('_', ' ', $module)));
1192
-            // add class prefix
1193
-            $module_class = 'EED_' . $module;
1194
-        }
1195
-        // does the module exist ?
1196
-        if (! is_readable($module_path . '/' . $module_class . $module_ext)) {
1197
-            $msg = sprintf(
1198
-                esc_html__(
1199
-                    'The requested %s module file could not be found or is not readable due to file permissions.',
1200
-                    'event_espresso'
1201
-                ),
1202
-                $module
1203
-            );
1204
-            EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__);
1205
-            return false;
1206
-        }
1207
-        // load the module class file
1208
-        require_once($module_path . $module_class . $module_ext);
1209
-        // verify that class exists
1210
-        if (! class_exists($module_class)) {
1211
-            $msg = sprintf(esc_html__('The requested %s module class does not exist.', 'event_espresso'), $module_class);
1212
-            EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__);
1213
-            return false;
1214
-        }
1215
-        // add to array of registered modules
1216
-        EE_Registry::instance()->modules->{$module_class} = $module_path . $module_class . $module_ext;
1217
-        do_action(
1218
-            'AHEE__EE_Config__register_module__complete',
1219
-            $module_class,
1220
-            EE_Registry::instance()->modules->{$module_class}
1221
-        );
1222
-        return true;
1223
-    }
1224
-
1225
-
1226
-    /**
1227
-     *    _initialize_modules
1228
-     *    allow modules to set hooks for the rest of the system
1229
-     *
1230
-     * @access private
1231
-     * @return void
1232
-     */
1233
-    private function _initialize_modules()
1234
-    {
1235
-        // cycle thru shortcode folders
1236
-        foreach (EE_Registry::instance()->modules as $module_class => $module_path) {
1237
-            // fire the shortcode class's set_hooks methods in case it needs to hook into other parts of the system
1238
-            // which set hooks ?
1239
-            if (is_admin()) {
1240
-                // fire immediately
1241
-                call_user_func(array($module_class, 'set_hooks_admin'));
1242
-            } else {
1243
-                // delay until other systems are online
1244
-                add_action(
1245
-                    'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons',
1246
-                    array($module_class, 'set_hooks')
1247
-                );
1248
-            }
1249
-        }
1250
-    }
1251
-
1252
-
1253
-    /**
1254
-     *    register_route - adds module method routes to route_map
1255
-     *
1256
-     * @access    public
1257
-     * @param    string $route       - "pretty" public alias for module method
1258
-     * @param    string $module      - module name (classname without EED_ prefix)
1259
-     * @param    string $method_name - the actual module method to be routed to
1260
-     * @param    string $key         - url param key indicating a route is being called
1261
-     * @return    bool
1262
-     */
1263
-    public static function register_route($route = null, $module = null, $method_name = null, $key = 'ee')
1264
-    {
1265
-        do_action('AHEE__EE_Config__register_route__begin', $route, $module, $method_name);
1266
-        $module = str_replace('EED_', '', $module);
1267
-        $module_class = 'EED_' . $module;
1268
-        if (! isset(EE_Registry::instance()->modules->{$module_class})) {
1269
-            $msg = sprintf(esc_html__('The module %s has not been registered.', 'event_espresso'), $module);
1270
-            EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__);
1271
-            return false;
1272
-        }
1273
-        if (empty($route)) {
1274
-            $msg = sprintf(esc_html__('No route has been supplied.', 'event_espresso'), $route);
1275
-            EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__);
1276
-            return false;
1277
-        }
1278
-        if (! method_exists('EED_' . $module, $method_name)) {
1279
-            $msg = sprintf(
1280
-                esc_html__('A valid class method for the %s route has not been supplied.', 'event_espresso'),
1281
-                $route
1282
-            );
1283
-            EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__);
1284
-            return false;
1285
-        }
1286
-        EE_Config::$_module_route_map[ (string) $key ][ (string) $route ] = array('EED_' . $module, $method_name);
1287
-        return true;
1288
-    }
1289
-
1290
-
1291
-    /**
1292
-     *    get_route - get module method route
1293
-     *
1294
-     * @access    public
1295
-     * @param    string $route - "pretty" public alias for module method
1296
-     * @param    string $key   - url param key indicating a route is being called
1297
-     * @return    string
1298
-     */
1299
-    public static function get_route($route = null, $key = 'ee')
1300
-    {
1301
-        do_action('AHEE__EE_Config__get_route__begin', $route);
1302
-        $route = (string) apply_filters('FHEE__EE_Config__get_route', $route);
1303
-        if (isset(EE_Config::$_module_route_map[ $key ][ $route ])) {
1304
-            return EE_Config::$_module_route_map[ $key ][ $route ];
1305
-        }
1306
-        return null;
1307
-    }
1308
-
1309
-
1310
-    /**
1311
-     *    get_routes - get ALL module method routes
1312
-     *
1313
-     * @access    public
1314
-     * @return    array
1315
-     */
1316
-    public static function get_routes()
1317
-    {
1318
-        return EE_Config::$_module_route_map;
1319
-    }
1320
-
1321
-
1322
-    /**
1323
-     *    register_forward - allows modules to forward request to another module for further processing
1324
-     *
1325
-     * @access    public
1326
-     * @param    string       $route   - "pretty" public alias for module method
1327
-     * @param    integer      $status  - integer value corresponding  to status constant strings set in module parent
1328
-     *                                 class, allows different forwards to be served based on status
1329
-     * @param    array|string $forward - function name or array( class, method )
1330
-     * @param    string       $key     - url param key indicating a route is being called
1331
-     * @return    bool
1332
-     */
1333
-    public static function register_forward($route = null, $status = 0, $forward = null, $key = 'ee')
1334
-    {
1335
-        do_action('AHEE__EE_Config__register_forward', $route, $status, $forward);
1336
-        if (! isset(EE_Config::$_module_route_map[ $key ][ $route ]) || empty($route)) {
1337
-            $msg = sprintf(
1338
-                esc_html__('The module route %s for this forward has not been registered.', 'event_espresso'),
1339
-                $route
1340
-            );
1341
-            EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__);
1342
-            return false;
1343
-        }
1344
-        if (empty($forward)) {
1345
-            $msg = sprintf(esc_html__('No forwarding route has been supplied.', 'event_espresso'), $route);
1346
-            EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__);
1347
-            return false;
1348
-        }
1349
-        if (is_array($forward)) {
1350
-            if (! isset($forward[1])) {
1351
-                $msg = sprintf(
1352
-                    esc_html__('A class method for the %s forwarding route has not been supplied.', 'event_espresso'),
1353
-                    $route
1354
-                );
1355
-                EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__);
1356
-                return false;
1357
-            }
1358
-            if (! method_exists($forward[0], $forward[1])) {
1359
-                $msg = sprintf(
1360
-                    esc_html__('The class method %s for the %s forwarding route is in invalid.', 'event_espresso'),
1361
-                    $forward[1],
1362
-                    $route
1363
-                );
1364
-                EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__);
1365
-                return false;
1366
-            }
1367
-        } elseif (! function_exists($forward)) {
1368
-            $msg = sprintf(
1369
-                esc_html__('The function %s for the %s forwarding route is in invalid.', 'event_espresso'),
1370
-                $forward,
1371
-                $route
1372
-            );
1373
-            EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__);
1374
-            return false;
1375
-        }
1376
-        EE_Config::$_module_forward_map[ $key ][ $route ][ absint($status) ] = $forward;
1377
-        return true;
1378
-    }
1379
-
1380
-
1381
-    /**
1382
-     *    get_forward - get forwarding route
1383
-     *
1384
-     * @access    public
1385
-     * @param    string  $route  - "pretty" public alias for module method
1386
-     * @param    integer $status - integer value corresponding  to status constant strings set in module parent class,
1387
-     *                           allows different forwards to be served based on status
1388
-     * @param    string  $key    - url param key indicating a route is being called
1389
-     * @return    string
1390
-     */
1391
-    public static function get_forward($route = null, $status = 0, $key = 'ee')
1392
-    {
1393
-        do_action('AHEE__EE_Config__get_forward__begin', $route, $status);
1394
-        if (isset(EE_Config::$_module_forward_map[ $key ][ $route ][ $status ])) {
1395
-            return apply_filters(
1396
-                'FHEE__EE_Config__get_forward',
1397
-                EE_Config::$_module_forward_map[ $key ][ $route ][ $status ],
1398
-                $route,
1399
-                $status
1400
-            );
1401
-        }
1402
-        return null;
1403
-    }
1404
-
1405
-
1406
-    /**
1407
-     *    register_forward - allows modules to specify different view templates for different method routes and status
1408
-     *    results
1409
-     *
1410
-     * @access    public
1411
-     * @param    string  $route  - "pretty" public alias for module method
1412
-     * @param    integer $status - integer value corresponding  to status constant strings set in module parent class,
1413
-     *                           allows different views to be served based on status
1414
-     * @param    string  $view
1415
-     * @param    string  $key    - url param key indicating a route is being called
1416
-     * @return    bool
1417
-     */
1418
-    public static function register_view($route = null, $status = 0, $view = null, $key = 'ee')
1419
-    {
1420
-        do_action('AHEE__EE_Config__register_view__begin', $route, $status, $view);
1421
-        if (! isset(EE_Config::$_module_route_map[ $key ][ $route ]) || empty($route)) {
1422
-            $msg = sprintf(
1423
-                esc_html__('The module route %s for this view has not been registered.', 'event_espresso'),
1424
-                $route
1425
-            );
1426
-            EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__);
1427
-            return false;
1428
-        }
1429
-        if (! is_readable($view)) {
1430
-            $msg = sprintf(
1431
-                esc_html__(
1432
-                    'The %s view file could not be found or is not readable due to file permissions.',
1433
-                    'event_espresso'
1434
-                ),
1435
-                $view
1436
-            );
1437
-            EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__);
1438
-            return false;
1439
-        }
1440
-        EE_Config::$_module_view_map[ $key ][ $route ][ absint($status) ] = $view;
1441
-        return true;
1442
-    }
1443
-
1444
-
1445
-    /**
1446
-     *    get_view - get view for route and status
1447
-     *
1448
-     * @access    public
1449
-     * @param    string  $route  - "pretty" public alias for module method
1450
-     * @param    integer $status - integer value corresponding  to status constant strings set in module parent class,
1451
-     *                           allows different views to be served based on status
1452
-     * @param    string  $key    - url param key indicating a route is being called
1453
-     * @return    string
1454
-     */
1455
-    public static function get_view($route = null, $status = 0, $key = 'ee')
1456
-    {
1457
-        do_action('AHEE__EE_Config__get_view__begin', $route, $status);
1458
-        if (isset(EE_Config::$_module_view_map[ $key ][ $route ][ $status ])) {
1459
-            return apply_filters(
1460
-                'FHEE__EE_Config__get_view',
1461
-                EE_Config::$_module_view_map[ $key ][ $route ][ $status ],
1462
-                $route,
1463
-                $status
1464
-            );
1465
-        }
1466
-        return null;
1467
-    }
1468
-
1469
-
1470
-    public function update_addon_option_names()
1471
-    {
1472
-        update_option(EE_Config::ADDON_OPTION_NAMES, $this->_addon_option_names);
1473
-    }
1474
-
1475
-
1476
-    public function shutdown()
1477
-    {
1478
-        $this->update_addon_option_names();
1479
-    }
1480
-
1481
-
1482
-    /**
1483
-     * @return LegacyShortcodesManager
1484
-     */
1485
-    public static function getLegacyShortcodesManager()
1486
-    {
1487
-        if (! EE_Config::instance()->legacy_shortcodes_manager instanceof LegacyShortcodesManager) {
1488
-            EE_Config::instance()->legacy_shortcodes_manager = LoaderFactory::getLoader()->getShared(
1489
-                LegacyShortcodesManager::class
1490
-            );
1491
-        }
1492
-        return EE_Config::instance()->legacy_shortcodes_manager;
1493
-    }
1494
-
1495
-
1496
-    /**
1497
-     * register_shortcode - makes core aware of this shortcode
1498
-     *
1499
-     * @deprecated 4.9.26
1500
-     * @param    string $shortcode_path - full path up to and including shortcode folder
1501
-     * @return    bool
1502
-     */
1503
-    public static function register_shortcode($shortcode_path = null)
1504
-    {
1505
-        EE_Error::doing_it_wrong(
1506
-            __METHOD__,
1507
-            esc_html__(
1508
-                'Usage is deprecated. Use \EventEspresso\core\services\shortcodes\LegacyShortcodesManager::registerShortcode() as direct replacement, or better yet, please see the new \EventEspresso\core\services\shortcodes\ShortcodesManager class.',
1509
-                'event_espresso'
1510
-            ),
1511
-            '4.9.26'
1512
-        );
1513
-        return EE_Config::instance()->getLegacyShortcodesManager()->registerShortcode($shortcode_path);
1514
-    }
1515
-}
1516
-
1517
-/**
1518
- * Base class used for config classes. These classes should generally not have
1519
- * magic functions in use, except we'll allow them to magically set and get stuff...
1520
- * basically, they should just be well-defined stdClasses
1521
- */
1522
-class EE_Config_Base
1523
-{
1524
-
1525
-    /**
1526
-     * Utility function for escaping the value of a property and returning.
1527
-     *
1528
-     * @param string $property property name (checks to see if exists).
1529
-     * @return mixed if a detected type found return the escaped value, otherwise just the raw value is returned.
1530
-     * @throws EE_Error
1531
-     */
1532
-    public function get_pretty($property)
1533
-    {
1534
-        if (! property_exists($this, $property)) {
1535
-            throw new EE_Error(
1536
-                sprintf(
1537
-                    esc_html__(
1538
-                        '%1$s::get_pretty() has been called with the property %2$s which does not exist on the %1$s config class.',
1539
-                        'event_espresso'
1540
-                    ),
1541
-                    get_class($this),
1542
-                    $property
1543
-                )
1544
-            );
1545
-        }
1546
-        // just handling escaping of strings for now.
1547
-        if (is_string($this->{$property})) {
1548
-            return stripslashes($this->{$property});
1549
-        }
1550
-        return $this->{$property};
1551
-    }
1552
-
1553
-
1554
-    public function populate()
1555
-    {
1556
-        // grab defaults via a new instance of this class.
1557
-        $class_name = get_class($this);
1558
-        $defaults = new $class_name();
1559
-        // loop through the properties for this class and see if they are set.  If they are NOT, then grab the
1560
-        // default from our $defaults object.
1561
-        foreach (get_object_vars($defaults) as $property => $value) {
1562
-            if ($this->{$property} === null) {
1563
-                $this->{$property} = $value;
1564
-            }
1565
-        }
1566
-        // cleanup
1567
-        unset($defaults);
1568
-    }
1569
-
1570
-
1571
-    /**
1572
-     *        __isset
1573
-     *
1574
-     * @param $a
1575
-     * @return bool
1576
-     */
1577
-    public function __isset($a)
1578
-    {
1579
-        return false;
1580
-    }
1581
-
1582
-
1583
-    /**
1584
-     *        __unset
1585
-     *
1586
-     * @param $a
1587
-     * @return bool
1588
-     */
1589
-    public function __unset($a)
1590
-    {
1591
-        return false;
1592
-    }
1593
-
1594
-
1595
-    /**
1596
-     *        __clone
1597
-     */
1598
-    public function __clone()
1599
-    {
1600
-    }
1601
-
1602
-
1603
-    /**
1604
-     *        __wakeup
1605
-     */
1606
-    public function __wakeup()
1607
-    {
1608
-    }
1609
-
1610
-
1611
-    /**
1612
-     *        __destruct
1613
-     */
1614
-    public function __destruct()
1615
-    {
1616
-    }
1617
-}
1618
-
1619
-/**
1620
- * Class for defining what's in the EE_Config relating to registration settings
1621
- */
1622
-class EE_Core_Config extends EE_Config_Base
1623
-{
1624
-
1625
-    const OPTION_NAME_UXIP = 'ee_ueip_optin';
1626
-
1627
-
1628
-    public $current_blog_id;
1629
-
1630
-    public $ee_ueip_optin;
1631
-
1632
-    public $ee_ueip_has_notified;
1633
-
1634
-    /**
1635
-     * Not to be confused with the 4 critical page variables (See
1636
-     * get_critical_pages_array()), this is just an array of wp posts that have EE
1637
-     * shortcodes in them. Keys are slugs, values are arrays with only 1 element: where the key is the shortcode
1638
-     * in the page, and the value is the page's ID. The key 'posts' is basically a duplicate of this same array.
1639
-     *
1640
-     * @var array
1641
-     */
1642
-    public $post_shortcodes;
1643
-
1644
-    public $module_route_map;
1645
-
1646
-    public $module_forward_map;
1647
-
1648
-    public $module_view_map;
1649
-
1650
-    /**
1651
-     * The next 4 vars are the IDs of critical EE pages.
1652
-     *
1653
-     * @var int
1654
-     */
1655
-    public $reg_page_id;
1656
-
1657
-    public $txn_page_id;
1658
-
1659
-    public $thank_you_page_id;
1660
-
1661
-    public $cancel_page_id;
1662
-
1663
-    /**
1664
-     * The next 4 vars are the URLs of critical EE pages.
1665
-     *
1666
-     * @var int
1667
-     */
1668
-    public $reg_page_url;
1669
-
1670
-    public $txn_page_url;
1671
-
1672
-    public $thank_you_page_url;
1673
-
1674
-    public $cancel_page_url;
1675
-
1676
-    /**
1677
-     * The next vars relate to the custom slugs for EE CPT routes
1678
-     */
1679
-    public $event_cpt_slug;
1680
-
1681
-    /**
1682
-     * This caches the _ee_ueip_option in case this config is reset in the same
1683
-     * request across blog switches in a multisite context.
1684
-     * Avoids extra queries to the db for this option.
1685
-     *
1686
-     * @var bool
1687
-     */
1688
-    public static $ee_ueip_option;
1689
-
1690
-
1691
-    /**
1692
-     *    class constructor
1693
-     *
1694
-     * @access    public
1695
-     */
1696
-    public function __construct()
1697
-    {
1698
-        // set default organization settings
1699
-        $this->current_blog_id = get_current_blog_id();
1700
-        $this->current_blog_id = $this->current_blog_id === null ? 1 : $this->current_blog_id;
1701
-        $this->ee_ueip_optin = $this->_get_main_ee_ueip_optin();
1702
-        $this->ee_ueip_has_notified = is_main_site() ? get_option('ee_ueip_has_notified', false) : true;
1703
-        $this->post_shortcodes = array();
1704
-        $this->module_route_map = array();
1705
-        $this->module_forward_map = array();
1706
-        $this->module_view_map = array();
1707
-        // critical EE page IDs
1708
-        $this->reg_page_id = 0;
1709
-        $this->txn_page_id = 0;
1710
-        $this->thank_you_page_id = 0;
1711
-        $this->cancel_page_id = 0;
1712
-        // critical EE page URLs
1713
-        $this->reg_page_url = '';
1714
-        $this->txn_page_url = '';
1715
-        $this->thank_you_page_url = '';
1716
-        $this->cancel_page_url = '';
1717
-        // cpt slugs
1718
-        $this->event_cpt_slug = esc_html__('events', 'event_espresso');
1719
-        // ueip constant check
1720
-        if (defined('EE_DISABLE_UXIP') && EE_DISABLE_UXIP) {
1721
-            $this->ee_ueip_optin = false;
1722
-            $this->ee_ueip_has_notified = true;
1723
-        }
1724
-    }
1725
-
1726
-
1727
-    /**
1728
-     * @return array
1729
-     */
1730
-    public function get_critical_pages_array()
1731
-    {
1732
-        return array(
1733
-            $this->reg_page_id,
1734
-            $this->txn_page_id,
1735
-            $this->thank_you_page_id,
1736
-            $this->cancel_page_id,
1737
-        );
1738
-    }
1739
-
1740
-
1741
-    /**
1742
-     * @return array
1743
-     */
1744
-    public function get_critical_pages_shortcodes_array()
1745
-    {
1746
-        return array(
1747
-            $this->reg_page_id       => 'ESPRESSO_CHECKOUT',
1748
-            $this->txn_page_id       => 'ESPRESSO_TXN_PAGE',
1749
-            $this->thank_you_page_id => 'ESPRESSO_THANK_YOU',
1750
-            $this->cancel_page_id    => 'ESPRESSO_CANCELLED',
1751
-        );
1752
-    }
1753
-
1754
-
1755
-    /**
1756
-     *  gets/returns URL for EE reg_page
1757
-     *
1758
-     * @access    public
1759
-     * @return    string
1760
-     */
1761
-    public function reg_page_url()
1762
-    {
1763
-        if (! $this->reg_page_url) {
1764
-            $this->reg_page_url = add_query_arg(
1765
-                array('uts' => time()),
1766
-                get_permalink($this->reg_page_id)
1767
-            ) . '#checkout';
1768
-        }
1769
-        return $this->reg_page_url;
1770
-    }
1771
-
1772
-
1773
-    /**
1774
-     *  gets/returns URL for EE txn_page
1775
-     *
1776
-     * @param array $query_args like what gets passed to
1777
-     *                          add_query_arg() as the first argument
1778
-     * @access    public
1779
-     * @return    string
1780
-     */
1781
-    public function txn_page_url($query_args = array())
1782
-    {
1783
-        if (! $this->txn_page_url) {
1784
-            $this->txn_page_url = get_permalink($this->txn_page_id);
1785
-        }
1786
-        if ($query_args) {
1787
-            return add_query_arg($query_args, $this->txn_page_url);
1788
-        } else {
1789
-            return $this->txn_page_url;
1790
-        }
1791
-    }
1792
-
1793
-
1794
-    /**
1795
-     *  gets/returns URL for EE thank_you_page
1796
-     *
1797
-     * @param array $query_args like what gets passed to
1798
-     *                          add_query_arg() as the first argument
1799
-     * @access    public
1800
-     * @return    string
1801
-     */
1802
-    public function thank_you_page_url($query_args = array())
1803
-    {
1804
-        if (! $this->thank_you_page_url) {
1805
-            $this->thank_you_page_url = get_permalink($this->thank_you_page_id);
1806
-        }
1807
-        if ($query_args) {
1808
-            return add_query_arg($query_args, $this->thank_you_page_url);
1809
-        } else {
1810
-            return $this->thank_you_page_url;
1811
-        }
1812
-    }
1813
-
1814
-
1815
-    /**
1816
-     *  gets/returns URL for EE cancel_page
1817
-     *
1818
-     * @access    public
1819
-     * @return    string
1820
-     */
1821
-    public function cancel_page_url()
1822
-    {
1823
-        if (! $this->cancel_page_url) {
1824
-            $this->cancel_page_url = get_permalink($this->cancel_page_id);
1825
-        }
1826
-        return $this->cancel_page_url;
1827
-    }
1828
-
1829
-
1830
-    /**
1831
-     * Resets all critical page urls to their original state.  Used primarily by the __sleep() magic method currently.
1832
-     *
1833
-     * @since 4.7.5
1834
-     */
1835
-    protected function _reset_urls()
1836
-    {
1837
-        $this->reg_page_url = '';
1838
-        $this->txn_page_url = '';
1839
-        $this->cancel_page_url = '';
1840
-        $this->thank_you_page_url = '';
1841
-    }
1842
-
1843
-
1844
-    /**
1845
-     * Used to return what the optin value is set for the EE User Experience Program.
1846
-     * This accounts for multisite and this value being requested for a subsite.  In multisite, the value is set
1847
-     * on the main site only.
1848
-     *
1849
-     * @return bool
1850
-     */
1851
-    protected function _get_main_ee_ueip_optin()
1852
-    {
1853
-        // if this is the main site then we can just bypass our direct query.
1854
-        if (is_main_site()) {
1855
-            return get_option(self::OPTION_NAME_UXIP, false);
1856
-        }
1857
-        // is this already cached for this request?  If so use it.
1858
-        if (EE_Core_Config::$ee_ueip_option !== null) {
1859
-            return EE_Core_Config::$ee_ueip_option;
1860
-        }
1861
-        global $wpdb;
1862
-        $current_network_main_site = is_multisite() ? get_current_site() : null;
1863
-        $current_main_site_id = ! empty($current_network_main_site) ? $current_network_main_site->blog_id : 1;
1864
-        $option = self::OPTION_NAME_UXIP;
1865
-        // set correct table for query
1866
-        $table_name = $wpdb->get_blog_prefix($current_main_site_id) . 'options';
1867
-        // rather than getting blog option for the $current_main_site_id, we do a direct $wpdb query because
1868
-        // get_blog_option() does a switch_to_blog an that could cause infinite recursion because EE_Core_Config might be
1869
-        // re-constructed on the blog switch.  Note, we are still executing any core wp filters on this option retrieval.
1870
-        // this bit of code is basically a direct copy of get_option without any caching because we are NOT switched to the blog
1871
-        // for the purpose of caching.
1872
-        $pre = apply_filters('pre_option_' . $option, false, $option);
1873
-        if (false !== $pre) {
1874
-            EE_Core_Config::$ee_ueip_option = $pre;
1875
-            return EE_Core_Config::$ee_ueip_option;
1876
-        }
1877
-        $row = $wpdb->get_row(
1878
-            $wpdb->prepare(
1879
-                "SELECT option_value FROM $table_name WHERE option_name = %s LIMIT 1",
1880
-                $option
1881
-            )
1882
-        );
1883
-        if (is_object($row)) {
1884
-            $value = $row->option_value;
1885
-        } else { // option does not exist so use default.
1886
-            EE_Core_Config::$ee_ueip_option =  apply_filters('default_option_' . $option, false, $option);
1887
-            return EE_Core_Config::$ee_ueip_option;
1888
-        }
1889
-        EE_Core_Config::$ee_ueip_option = apply_filters('option_' . $option, maybe_unserialize($value), $option);
1890
-        return EE_Core_Config::$ee_ueip_option;
1891
-    }
1892
-
1893
-
1894
-    /**
1895
-     * Utility function for escaping the value of a property and returning.
1896
-     *
1897
-     * @param string $property property name (checks to see if exists).
1898
-     * @return mixed if a detected type found return the escaped value, otherwise just the raw value is returned.
1899
-     * @throws EE_Error
1900
-     */
1901
-    public function get_pretty($property)
1902
-    {
1903
-        if ($property === self::OPTION_NAME_UXIP) {
1904
-            return $this->ee_ueip_optin ? 'yes' : 'no';
1905
-        }
1906
-        return parent::get_pretty($property);
1907
-    }
1908
-
1909
-
1910
-    /**
1911
-     * Currently used to ensure critical page urls have initial values saved to the db instead of any current set values
1912
-     * on the object.
1913
-     *
1914
-     * @return array
1915
-     */
1916
-    public function __sleep()
1917
-    {
1918
-        // reset all url properties
1919
-        $this->_reset_urls();
1920
-        // return what to save to db
1921
-        return array_keys(get_object_vars($this));
1922
-    }
1923
-}
1924
-
1925
-/**
1926
- * Config class for storing info on the Organization
1927
- */
1928
-class EE_Organization_Config extends EE_Config_Base
1929
-{
1930
-
1931
-    /**
1932
-     * @var string $name
1933
-     * eg EE4.1
1934
-     */
1935
-    public $name;
1936
-
1937
-    /**
1938
-     * @var string $address_1
1939
-     * eg 123 Onna Road
1940
-     */
1941
-    public $address_1 = '';
1942
-
1943
-    /**
1944
-     * @var string $address_2
1945
-     * eg PO Box 123
1946
-     */
1947
-    public $address_2 = '';
1948
-
1949
-    /**
1950
-     * @var string $city
1951
-     * eg Inna City
1952
-     */
1953
-    public $city = '';
1954
-
1955
-    /**
1956
-     * @var int $STA_ID
1957
-     * eg 4
1958
-     */
1959
-    public $STA_ID = 0;
1960
-
1961
-    /**
1962
-     * @var string $CNT_ISO
1963
-     * eg US
1964
-     */
1965
-    public $CNT_ISO = '';
1966
-
1967
-    /**
1968
-     * @var string $zip
1969
-     * eg 12345  or V1A 2B3
1970
-     */
1971
-    public $zip = '';
1972
-
1973
-    /**
1974
-     * @var string $email
1975
-     * eg [email protected]
1976
-     */
1977
-    public $email;
1978
-
1979
-    /**
1980
-     * @var string $phone
1981
-     * eg. 111-111-1111
1982
-     */
1983
-    public $phone = '';
1984
-
1985
-    /**
1986
-     * @var string $vat
1987
-     * VAT/Tax Number
1988
-     */
1989
-    public $vat = '';
1990
-
1991
-    /**
1992
-     * @var string $logo_url
1993
-     * eg http://www.somedomain.com/wp-content/uploads/kittehs.jpg
1994
-     */
1995
-    public $logo_url = '';
1996
-
1997
-    /**
1998
-     * The below are all various properties for holding links to organization social network profiles
1999
-     *
2000
-     * @var string
2001
-     */
2002
-    /**
2003
-     * facebook (facebook.com/profile.name)
2004
-     *
2005
-     * @var string
2006
-     */
2007
-    public $facebook = '';
2008
-
2009
-    /**
2010
-     * twitter (twitter.com/twitter_handle)
2011
-     *
2012
-     * @var string
2013
-     */
2014
-    public $twitter = '';
2015
-
2016
-    /**
2017
-     * linkedin (linkedin.com/in/profile_name)
2018
-     *
2019
-     * @var string
2020
-     */
2021
-    public $linkedin = '';
2022
-
2023
-    /**
2024
-     * pinterest (www.pinterest.com/profile_name)
2025
-     *
2026
-     * @var string
2027
-     */
2028
-    public $pinterest = '';
2029
-
2030
-    /**
2031
-     * google+ (google.com/+profileName)
2032
-     *
2033
-     * @var string
2034
-     */
2035
-    public $google = '';
2036
-
2037
-    /**
2038
-     * instagram (instagram.com/handle)
2039
-     *
2040
-     * @var string
2041
-     */
2042
-    public $instagram = '';
2043
-
2044
-
2045
-    /**
2046
-     *    class constructor
2047
-     *
2048
-     * @access    public
2049
-     */
2050
-    public function __construct()
2051
-    {
2052
-        // set default organization settings
2053
-        // decode HTML entities from the WP blogname, because it's stored in the DB with HTML entities encoded
2054
-        $this->name = wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES);
2055
-        $this->email = get_bloginfo('admin_email');
2056
-    }
2057
-}
2058
-
2059
-/**
2060
- * Class for defining what's in the EE_Config relating to currency
2061
- */
2062
-class EE_Currency_Config extends EE_Config_Base
2063
-{
2064
-
2065
-    /**
2066
-     * @var string $code
2067
-     * eg 'US'
2068
-     */
2069
-    public $code;
2070
-
2071
-    /**
2072
-     * @var string $name
2073
-     * eg 'Dollar'
2074
-     */
2075
-    public $name;
2076
-
2077
-    /**
2078
-     * plural name
2079
-     *
2080
-     * @var string $plural
2081
-     * eg 'Dollars'
2082
-     */
2083
-    public $plural;
2084
-
2085
-    /**
2086
-     * currency sign
2087
-     *
2088
-     * @var string $sign
2089
-     * eg '$'
2090
-     */
2091
-    public $sign;
2092
-
2093
-    /**
2094
-     * Whether the currency sign should come before the number or not
2095
-     *
2096
-     * @var boolean $sign_b4
2097
-     */
2098
-    public $sign_b4;
2099
-
2100
-    /**
2101
-     * How many digits should come after the decimal place
2102
-     *
2103
-     * @var int $dec_plc
2104
-     */
2105
-    public $dec_plc;
2106
-
2107
-    /**
2108
-     * Symbol to use for decimal mark
2109
-     *
2110
-     * @var string $dec_mrk
2111
-     * eg '.'
2112
-     */
2113
-    public $dec_mrk;
2114
-
2115
-    /**
2116
-     * Symbol to use for thousands
2117
-     *
2118
-     * @var string $thsnds
2119
-     * eg ','
2120
-     */
2121
-    public $thsnds;
2122
-
2123
-
2124
-    /**
2125
-     *    class constructor
2126
-     *
2127
-     * @access    public
2128
-     * @param string $CNT_ISO
2129
-     * @throws EE_Error
2130
-     * @throws ReflectionException
2131
-     */
2132
-    public function __construct($CNT_ISO = '')
2133
-    {
2134
-        /** @var TableAnalysis $table_analysis */
2135
-        $table_analysis = EE_Registry::instance()->create('TableAnalysis', array(), true);
2136
-        // get country code from organization settings or use default
2137
-        $ORG_CNT = isset(EE_Registry::instance()->CFG->organization)
2138
-                   && EE_Registry::instance()->CFG->organization instanceof EE_Organization_Config
2139
-            ? EE_Registry::instance()->CFG->organization->CNT_ISO
2140
-            : '';
2141
-        // but override if requested
2142
-        $CNT_ISO = ! empty($CNT_ISO) ? $CNT_ISO : $ORG_CNT;
2143
-        // so if that all went well, and we are not in M-Mode (cuz you can't query the db in M-Mode) and double-check the countries table exists
2144
-        if (
2145
-            ! empty($CNT_ISO)
2146
-            && EE_Maintenance_Mode::instance()->models_can_query()
2147
-            && $table_analysis->tableExists(EE_Registry::instance()->load_model('Country')->table())
2148
-        ) {
2149
-            // retrieve the country settings from the db, just in case they have been customized
2150
-            $country = EE_Registry::instance()->load_model('Country')->get_one_by_ID($CNT_ISO);
2151
-            if ($country instanceof EE_Country) {
2152
-                $this->code = $country->currency_code();    // currency code: USD, CAD, EUR
2153
-                $this->name = $country->currency_name_single();    // Dollar
2154
-                $this->plural = $country->currency_name_plural();    // Dollars
2155
-                $this->sign = $country->currency_sign();            // currency sign: $
2156
-                $this->sign_b4 = $country->currency_sign_before(
2157
-                );        // currency sign before or after: $TRUE  or  FALSE$
2158
-                $this->dec_plc = $country->currency_decimal_places();    // decimal places: 2 = 0.00  3 = 0.000
2159
-                $this->dec_mrk = $country->currency_decimal_mark(
2160
-                );    // decimal mark: (comma) ',' = 0,01   or (decimal) '.' = 0.01
2161
-                $this->thsnds = $country->currency_thousands_separator(
2162
-                );    // thousands separator: (comma) ',' = 1,000   or (decimal) '.' = 1.000
2163
-            }
2164
-        }
2165
-        // fallback to hardcoded defaults, in case the above failed
2166
-        if (empty($this->code)) {
2167
-            // set default currency settings
2168
-            $this->code = 'USD';    // currency code: USD, CAD, EUR
2169
-            $this->name = esc_html__('Dollar', 'event_espresso');    // Dollar
2170
-            $this->plural = esc_html__('Dollars', 'event_espresso');    // Dollars
2171
-            $this->sign = '$';    // currency sign: $
2172
-            $this->sign_b4 = true;    // currency sign before or after: $TRUE  or  FALSE$
2173
-            $this->dec_plc = 2;    // decimal places: 2 = 0.00  3 = 0.000
2174
-            $this->dec_mrk = '.';    // decimal mark: (comma) ',' = 0,01   or (decimal) '.' = 0.01
2175
-            $this->thsnds = ',';    // thousands separator: (comma) ',' = 1,000   or (decimal) '.' = 1.000
2176
-        }
2177
-    }
2178
-}
2179
-
2180
-/**
2181
- * Class for defining what's in the EE_Config relating to registration settings
2182
- */
2183
-class EE_Registration_Config extends EE_Config_Base
2184
-{
2185
-
2186
-    /**
2187
-     * Default registration status
2188
-     *
2189
-     * @var string $default_STS_ID
2190
-     * eg 'RPP'
2191
-     */
2192
-    public $default_STS_ID;
2193
-
2194
-    /**
2195
-     * For new events, this will be the default value for the maximum number of tickets (equivalent to maximum number of
2196
-     * registrations)
2197
-     *
2198
-     * @var int
2199
-     */
2200
-    public $default_maximum_number_of_tickets;
2201
-
2202
-    /**
2203
-     * level of validation to apply to email addresses
2204
-     *
2205
-     * @var string $email_validation_level
2206
-     * options: 'basic', 'wp_default', 'i18n', 'i18n_dns'
2207
-     */
2208
-    public $email_validation_level;
2209
-
2210
-    /**
2211
-     *    whether or not to show alternate payment options during the reg process if payment status is pending
2212
-     *
2213
-     * @var boolean $show_pending_payment_options
2214
-     */
2215
-    public $show_pending_payment_options;
2216
-
2217
-    /**
2218
-     * Whether to skip the registration confirmation page
2219
-     *
2220
-     * @var boolean $skip_reg_confirmation
2221
-     */
2222
-    public $skip_reg_confirmation;
2223
-
2224
-    /**
2225
-     * an array of SPCO reg steps where:
2226
-     *        the keys denotes the reg step order
2227
-     *        each element consists of an array with the following elements:
2228
-     *            "file_path" => the file path to the EE_SPCO_Reg_Step class
2229
-     *            "class_name" => the specific EE_SPCO_Reg_Step child class name
2230
-     *            "slug" => the URL param used to trigger the reg step
2231
-     *
2232
-     * @var array $reg_steps
2233
-     */
2234
-    public $reg_steps;
2235
-
2236
-    /**
2237
-     * Whether registration confirmation should be the last page of SPCO
2238
-     *
2239
-     * @var boolean $reg_confirmation_last
2240
-     */
2241
-    public $reg_confirmation_last;
2242
-
2243
-    /**
2244
-     * Whether or not to enable the EE Bot Trap
2245
-     *
2246
-     * @var boolean $use_bot_trap
2247
-     */
2248
-    public $use_bot_trap;
2249
-
2250
-    /**
2251
-     * Whether or not to encrypt some data sent by the EE Bot Trap
2252
-     *
2253
-     * @var boolean $use_encryption
2254
-     */
2255
-    public $use_encryption;
2256
-
2257
-    /**
2258
-     * Whether or not to use ReCaptcha
2259
-     *
2260
-     * @var boolean $use_captcha
2261
-     */
2262
-    public $use_captcha;
2263
-
2264
-    /**
2265
-     * ReCaptcha Theme
2266
-     *
2267
-     * @var string $recaptcha_theme
2268
-     *    options: 'dark', 'light', 'invisible'
2269
-     */
2270
-    public $recaptcha_theme;
2271
-
2272
-    /**
2273
-     * ReCaptcha Badge - determines the position of the reCAPTCHA badge if using Invisible ReCaptcha.
2274
-     *
2275
-     * @var string $recaptcha_badge
2276
-     *    options: 'bottomright', 'bottomleft', 'inline'
2277
-     */
2278
-    public $recaptcha_badge;
22
+	const OPTION_NAME = 'ee_config';
23
+
24
+	const LOG_NAME = 'ee_config_log';
25
+
26
+	const LOG_LENGTH = 100;
27
+
28
+	const ADDON_OPTION_NAMES = 'ee_config_option_names';
29
+
30
+	/**
31
+	 *    instance of the EE_Config object
32
+	 *
33
+	 * @var    EE_Config $_instance
34
+	 * @access    private
35
+	 */
36
+	private static $_instance;
37
+
38
+	/**
39
+	 * @var boolean $_logging_enabled
40
+	 */
41
+	private static $_logging_enabled = false;
42
+
43
+	/**
44
+	 * @var LegacyShortcodesManager $legacy_shortcodes_manager
45
+	 */
46
+	private $legacy_shortcodes_manager;
47
+
48
+	/**
49
+	 * An StdClass whose property names are addon slugs,
50
+	 * and values are their config classes
51
+	 *
52
+	 * @var StdClass
53
+	 */
54
+	public $addons;
55
+
56
+	/**
57
+	 * @var EE_Admin_Config
58
+	 */
59
+	public $admin;
60
+
61
+	/**
62
+	 * @var EE_Core_Config
63
+	 */
64
+	public $core;
65
+
66
+	/**
67
+	 * @var EE_Currency_Config
68
+	 */
69
+	public $currency;
70
+
71
+	/**
72
+	 * @var EE_Organization_Config
73
+	 */
74
+	public $organization;
75
+
76
+	/**
77
+	 * @var EE_Registration_Config
78
+	 */
79
+	public $registration;
80
+
81
+	/**
82
+	 * @var EE_Template_Config
83
+	 */
84
+	public $template_settings;
85
+
86
+	/**
87
+	 * Holds EE environment values.
88
+	 *
89
+	 * @var EE_Environment_Config
90
+	 */
91
+	public $environment;
92
+
93
+	/**
94
+	 * settings pertaining to Google maps
95
+	 *
96
+	 * @var EE_Map_Config
97
+	 */
98
+	public $map_settings;
99
+
100
+	/**
101
+	 * settings pertaining to Taxes
102
+	 *
103
+	 * @var EE_Tax_Config
104
+	 */
105
+	public $tax_settings;
106
+
107
+	/**
108
+	 * Settings pertaining to global messages settings.
109
+	 *
110
+	 * @var EE_Messages_Config
111
+	 */
112
+	public $messages;
113
+
114
+	/**
115
+	 * @deprecated
116
+	 * @var EE_Gateway_Config
117
+	 */
118
+	public $gateway;
119
+
120
+	/**
121
+	 * @var    array $_addon_option_names
122
+	 * @access    private
123
+	 */
124
+	private $_addon_option_names = array();
125
+
126
+	/**
127
+	 * @var    array $_module_route_map
128
+	 * @access    private
129
+	 */
130
+	private static $_module_route_map = array();
131
+
132
+	/**
133
+	 * @var    array $_module_forward_map
134
+	 * @access    private
135
+	 */
136
+	private static $_module_forward_map = array();
137
+
138
+	/**
139
+	 * @var    array $_module_view_map
140
+	 * @access    private
141
+	 */
142
+	private static $_module_view_map = array();
143
+
144
+
145
+	/**
146
+	 * @singleton method used to instantiate class object
147
+	 * @access    public
148
+	 * @return EE_Config instance
149
+	 */
150
+	public static function instance()
151
+	{
152
+		static $initialized = false;
153
+		// check if class object is instantiated, and instantiated properly
154
+		if (! self::$_instance instanceof EE_Config) {
155
+			self::$_instance = new self();
156
+			if (! $initialized) {
157
+				self::$_instance->initialize();
158
+				$initialized = true;
159
+			}
160
+		}
161
+		return self::$_instance;
162
+	}
163
+
164
+
165
+	/**
166
+	 * Resets the config
167
+	 *
168
+	 * @param bool    $hard_reset    if TRUE, sets EE_CONFig back to its original settings in the database. If FALSE
169
+	 *                               (default) leaves the database alone, and merely resets the EE_Config object to
170
+	 *                               reflect its state in the database
171
+	 * @param boolean $reinstantiate if TRUE (default) call instance() and return it. Otherwise, just leave
172
+	 *                               $_instance as NULL. Useful in case you want to forget about the old instance on
173
+	 *                               EE_Config, but might not be ready to instantiate EE_Config currently (eg if the
174
+	 *                               site was put into maintenance mode)
175
+	 * @return EE_Config
176
+	 */
177
+	public static function reset($hard_reset = false, $reinstantiate = true)
178
+	{
179
+		if (self::$_instance instanceof EE_Config) {
180
+			if ($hard_reset) {
181
+				self::$_instance->legacy_shortcodes_manager = null;
182
+				self::$_instance->_addon_option_names = array();
183
+				self::$_instance->_initialize_config();
184
+				self::$_instance->update_espresso_config();
185
+			}
186
+			self::$_instance->update_addon_option_names();
187
+		}
188
+		self::$_instance = null;
189
+		// we don't need to reset the static properties imo because those should
190
+		// only change when a module is added or removed. Currently we don't
191
+		// support removing a module during a request when it previously existed
192
+		if ($reinstantiate) {
193
+			return self::instance();
194
+		} else {
195
+			return null;
196
+		}
197
+	}
198
+
199
+
200
+	private function __construct()
201
+	{
202
+	}
203
+
204
+
205
+	private function initialize()
206
+	{
207
+		do_action('AHEE__EE_Config__construct__begin', $this);
208
+		EE_Config::$_logging_enabled = apply_filters('FHEE__EE_Config___construct__logging_enabled', false);
209
+		// setup empty config classes
210
+		$this->_initialize_config();
211
+		// load existing EE site settings
212
+		$this->_load_core_config();
213
+		// confirm everything loaded correctly and set filtered defaults if not
214
+		$this->_verify_config();
215
+		//  register shortcodes and modules
216
+		add_action(
217
+			'AHEE__EE_System__register_shortcodes_modules_and_widgets',
218
+			[$this, 'register_shortcodes_and_modules'],
219
+			999
220
+		);
221
+		//  initialize shortcodes and modules
222
+		add_action('AHEE__EE_System__core_loaded_and_ready', [$this, 'initialize_shortcodes_and_modules']);
223
+		// register widgets
224
+		add_action('widgets_init', [$this, 'widgets_init'], 10);
225
+		// shutdown
226
+		add_action('shutdown', [$this, 'shutdown'], 10);
227
+		// construct__end hook
228
+		do_action('AHEE__EE_Config__construct__end', $this);
229
+		// hardcoded hack
230
+		$this->template_settings->current_espresso_theme = 'Espresso_Arabica_2014';
231
+	}
232
+
233
+
234
+	/**
235
+	 * @return boolean
236
+	 */
237
+	public static function logging_enabled()
238
+	{
239
+		return self::$_logging_enabled;
240
+	}
241
+
242
+
243
+	/**
244
+	 * use to get the current theme if needed from static context
245
+	 *
246
+	 * @return string current theme set.
247
+	 */
248
+	public static function get_current_theme()
249
+	{
250
+		return isset(self::$_instance->template_settings->current_espresso_theme)
251
+			? self::$_instance->template_settings->current_espresso_theme : 'Espresso_Arabica_2014';
252
+	}
253
+
254
+
255
+	/**
256
+	 *        _initialize_config
257
+	 *
258
+	 * @access private
259
+	 * @return void
260
+	 */
261
+	private function _initialize_config()
262
+	{
263
+		EE_Config::trim_log();
264
+		// set defaults
265
+		$this->_addon_option_names = get_option(EE_Config::ADDON_OPTION_NAMES, array());
266
+		$this->addons = new stdClass();
267
+		// set _module_route_map
268
+		EE_Config::$_module_route_map = array();
269
+		// set _module_forward_map
270
+		EE_Config::$_module_forward_map = array();
271
+		// set _module_view_map
272
+		EE_Config::$_module_view_map = array();
273
+	}
274
+
275
+
276
+	/**
277
+	 *        load core plugin configuration
278
+	 *
279
+	 * @access private
280
+	 * @return void
281
+	 */
282
+	private function _load_core_config()
283
+	{
284
+		// load_core_config__start hook
285
+		do_action('AHEE__EE_Config___load_core_config__start', $this);
286
+		$espresso_config = $this->get_espresso_config();
287
+		foreach ($espresso_config as $config => $settings) {
288
+			// load_core_config__start hook
289
+			$settings = apply_filters(
290
+				'FHEE__EE_Config___load_core_config__config_settings',
291
+				$settings,
292
+				$config,
293
+				$this
294
+			);
295
+			if (is_object($settings) && property_exists($this, $config)) {
296
+				$this->{$config} = apply_filters('FHEE__EE_Config___load_core_config__' . $config, $settings);
297
+				// call configs populate method to ensure any defaults are set for empty values.
298
+				if (method_exists($settings, 'populate')) {
299
+					$this->{$config}->populate();
300
+				}
301
+				if (method_exists($settings, 'do_hooks')) {
302
+					$this->{$config}->do_hooks();
303
+				}
304
+			}
305
+		}
306
+		if (apply_filters('FHEE__EE_Config___load_core_config__update_espresso_config', false)) {
307
+			$this->update_espresso_config();
308
+		}
309
+		// load_core_config__end hook
310
+		do_action('AHEE__EE_Config___load_core_config__end', $this);
311
+	}
312
+
313
+
314
+	/**
315
+	 *    _verify_config
316
+	 *
317
+	 * @access    protected
318
+	 * @return    void
319
+	 */
320
+	protected function _verify_config()
321
+	{
322
+		$this->core = $this->core instanceof EE_Core_Config
323
+			? $this->core
324
+			: new EE_Core_Config();
325
+		$this->core = apply_filters('FHEE__EE_Config___initialize_config__core', $this->core);
326
+		$this->organization = $this->organization instanceof EE_Organization_Config
327
+			? $this->organization
328
+			: new EE_Organization_Config();
329
+		$this->organization = apply_filters(
330
+			'FHEE__EE_Config___initialize_config__organization',
331
+			$this->organization
332
+		);
333
+		$this->currency = $this->currency instanceof EE_Currency_Config
334
+			? $this->currency
335
+			: new EE_Currency_Config();
336
+		$this->currency = apply_filters('FHEE__EE_Config___initialize_config__currency', $this->currency);
337
+		$this->registration = $this->registration instanceof EE_Registration_Config
338
+			? $this->registration
339
+			: new EE_Registration_Config();
340
+		$this->registration = apply_filters(
341
+			'FHEE__EE_Config___initialize_config__registration',
342
+			$this->registration
343
+		);
344
+		$this->admin = $this->admin instanceof EE_Admin_Config
345
+			? $this->admin
346
+			: new EE_Admin_Config();
347
+		$this->admin = apply_filters('FHEE__EE_Config___initialize_config__admin', $this->admin);
348
+		$this->template_settings = $this->template_settings instanceof EE_Template_Config
349
+			? $this->template_settings
350
+			: new EE_Template_Config();
351
+		$this->template_settings = apply_filters(
352
+			'FHEE__EE_Config___initialize_config__template_settings',
353
+			$this->template_settings
354
+		);
355
+		$this->map_settings = $this->map_settings instanceof EE_Map_Config
356
+			? $this->map_settings
357
+			: new EE_Map_Config();
358
+		$this->map_settings = apply_filters(
359
+			'FHEE__EE_Config___initialize_config__map_settings',
360
+			$this->map_settings
361
+		);
362
+		$this->environment = $this->environment instanceof EE_Environment_Config
363
+			? $this->environment
364
+			: new EE_Environment_Config();
365
+		$this->environment = apply_filters(
366
+			'FHEE__EE_Config___initialize_config__environment',
367
+			$this->environment
368
+		);
369
+		$this->tax_settings = $this->tax_settings instanceof EE_Tax_Config
370
+			? $this->tax_settings
371
+			: new EE_Tax_Config();
372
+		$this->tax_settings = apply_filters(
373
+			'FHEE__EE_Config___initialize_config__tax_settings',
374
+			$this->tax_settings
375
+		);
376
+		$this->messages = apply_filters('FHEE__EE_Config__initialize_config__messages', $this->messages);
377
+		$this->messages = $this->messages instanceof EE_Messages_Config
378
+			? $this->messages
379
+			: new EE_Messages_Config();
380
+		$this->gateway = $this->gateway instanceof EE_Gateway_Config
381
+			? $this->gateway
382
+			: new EE_Gateway_Config();
383
+		$this->gateway = apply_filters('FHEE__EE_Config___initialize_config__gateway', $this->gateway);
384
+		$this->legacy_shortcodes_manager = null;
385
+	}
386
+
387
+
388
+	/**
389
+	 *    get_espresso_config
390
+	 *
391
+	 * @access    public
392
+	 * @return    array of espresso config stuff
393
+	 */
394
+	public function get_espresso_config()
395
+	{
396
+		// grab espresso configuration
397
+		return apply_filters(
398
+			'FHEE__EE_Config__get_espresso_config__CFG',
399
+			get_option(EE_Config::OPTION_NAME, array())
400
+		);
401
+	}
402
+
403
+
404
+	/**
405
+	 *    double_check_config_comparison
406
+	 *
407
+	 * @access    public
408
+	 * @param string $option
409
+	 * @param        $old_value
410
+	 * @param        $value
411
+	 */
412
+	public function double_check_config_comparison($option = '', $old_value, $value)
413
+	{
414
+		// make sure we're checking the ee config
415
+		if ($option === EE_Config::OPTION_NAME) {
416
+			// run a loose comparison of the old value against the new value for type and properties,
417
+			// but NOT exact instance like WP update_option does (ie: NOT type safe comparison)
418
+			if ($value != $old_value) {
419
+				// if they are NOT the same, then remove the hook,
420
+				// which means the subsequent update results will be based solely on the update query results
421
+				// the reason we do this is because, as stated above,
422
+				// WP update_option performs an exact instance comparison (===) on any update values passed to it
423
+				// this happens PRIOR to serialization and any subsequent update.
424
+				// If values are found to match their previous old value,
425
+				// then WP bails before performing any update.
426
+				// Since we are passing the EE_Config object, it is comparing the EXACT instance of the saved version
427
+				// it just pulled from the db, with the one being passed to it (which will not match).
428
+				// HOWEVER, once the object is serialized and passed off to MySQL to update,
429
+				// MySQL MAY ALSO NOT perform the update because
430
+				// the string it sees in the db looks the same as the new one it has been passed!!!
431
+				// This results in the query returning an "affected rows" value of ZERO,
432
+				// which gets returned immediately by WP update_option and looks like an error.
433
+				remove_action('update_option', array($this, 'check_config_updated'));
434
+			}
435
+		}
436
+	}
437
+
438
+
439
+	/**
440
+	 *    update_espresso_config
441
+	 *
442
+	 * @access   public
443
+	 */
444
+	protected function _reset_espresso_addon_config()
445
+	{
446
+		$this->_addon_option_names = array();
447
+		foreach ($this->addons as $addon_name => $addon_config_obj) {
448
+			$addon_config_obj = maybe_unserialize($addon_config_obj);
449
+			if ($addon_config_obj instanceof EE_Config_Base) {
450
+				$this->update_config('addons', $addon_name, $addon_config_obj, false);
451
+			}
452
+			$this->addons->{$addon_name} = null;
453
+		}
454
+	}
455
+
456
+
457
+	/**
458
+	 *    update_espresso_config
459
+	 *
460
+	 * @access   public
461
+	 * @param   bool $add_success
462
+	 * @param   bool $add_error
463
+	 * @return   bool
464
+	 */
465
+	public function update_espresso_config($add_success = false, $add_error = true)
466
+	{
467
+		// don't allow config updates during WP heartbeats
468
+		/** @var RequestInterface $request */
469
+		$request = LoaderFactory::getLoader()->getShared(RequestInterface::class);
470
+		if ($request->isWordPressHeartbeat()) {
471
+			return false;
472
+		}
473
+		// commented out the following re: https://events.codebasehq.com/projects/event-espresso/tickets/8197
474
+		// $clone = clone( self::$_instance );
475
+		// self::$_instance = NULL;
476
+		do_action('AHEE__EE_Config__update_espresso_config__begin', $this);
477
+		$this->_reset_espresso_addon_config();
478
+		// hook into update_option because that happens AFTER the ( $value === $old_value ) conditional
479
+		// but BEFORE the actual update occurs
480
+		add_action('update_option', array($this, 'double_check_config_comparison'), 1, 3);
481
+		// don't want to persist legacy_shortcodes_manager, but don't want to lose it either
482
+		$legacy_shortcodes_manager = $this->legacy_shortcodes_manager;
483
+		$this->legacy_shortcodes_manager = null;
484
+		// now update "ee_config"
485
+		$saved = update_option(EE_Config::OPTION_NAME, $this);
486
+		$this->legacy_shortcodes_manager = $legacy_shortcodes_manager;
487
+		EE_Config::log(EE_Config::OPTION_NAME);
488
+		// if not saved... check if the hook we just added still exists;
489
+		// if it does, it means one of two things:
490
+		// that update_option bailed at the($value === $old_value) conditional,
491
+		// or...
492
+		// the db update query returned 0 rows affected
493
+		// (probably because the data  value was the same from it's perspective)
494
+		// so the existence of the hook means that a negative result from update_option is NOT an error,
495
+		// but just means no update occurred, so don't display an error to the user.
496
+		// BUT... if update_option returns FALSE, AND the hook is missing,
497
+		// then it means that something truly went wrong
498
+		$saved = ! $saved ? has_action('update_option', array($this, 'double_check_config_comparison')) : $saved;
499
+		// remove our action since we don't want it in the system anymore
500
+		remove_action('update_option', array($this, 'double_check_config_comparison'), 1);
501
+		do_action('AHEE__EE_Config__update_espresso_config__end', $this, $saved);
502
+		// self::$_instance = $clone;
503
+		// unset( $clone );
504
+		// if config remains the same or was updated successfully
505
+		if ($saved) {
506
+			if ($add_success) {
507
+				EE_Error::add_success(
508
+					esc_html__('The Event Espresso Configuration Settings have been successfully updated.', 'event_espresso'),
509
+					__FILE__,
510
+					__FUNCTION__,
511
+					__LINE__
512
+				);
513
+			}
514
+			return true;
515
+		} else {
516
+			if ($add_error) {
517
+				EE_Error::add_error(
518
+					esc_html__('The Event Espresso Configuration Settings were not updated.', 'event_espresso'),
519
+					__FILE__,
520
+					__FUNCTION__,
521
+					__LINE__
522
+				);
523
+			}
524
+			return false;
525
+		}
526
+	}
527
+
528
+
529
+	/**
530
+	 *    _verify_config_params
531
+	 *
532
+	 * @access    private
533
+	 * @param    string         $section
534
+	 * @param    string         $name
535
+	 * @param    string         $config_class
536
+	 * @param    EE_Config_Base $config_obj
537
+	 * @param    array          $tests_to_run
538
+	 * @param    bool           $display_errors
539
+	 * @return    bool    TRUE on success, FALSE on fail
540
+	 */
541
+	private function _verify_config_params(
542
+		$section = '',
543
+		$name = '',
544
+		$config_class = '',
545
+		$config_obj = null,
546
+		$tests_to_run = array(1, 2, 3, 4, 5, 6, 7, 8),
547
+		$display_errors = true
548
+	) {
549
+		try {
550
+			foreach ($tests_to_run as $test) {
551
+				switch ($test) {
552
+					// TEST #1 : check that section was set
553
+					case 1:
554
+						if (empty($section)) {
555
+							if ($display_errors) {
556
+								throw new EE_Error(
557
+									sprintf(
558
+										esc_html__(
559
+											'No configuration section has been provided while attempting to save "%s".',
560
+											'event_espresso'
561
+										),
562
+										$config_class
563
+									)
564
+								);
565
+							}
566
+							return false;
567
+						}
568
+						break;
569
+					// TEST #2 : check that settings section exists
570
+					case 2:
571
+						if (! isset($this->{$section})) {
572
+							if ($display_errors) {
573
+								throw new EE_Error(
574
+									sprintf(
575
+										esc_html__('The "%s" configuration section does not exist.', 'event_espresso'),
576
+										$section
577
+									)
578
+								);
579
+							}
580
+							return false;
581
+						}
582
+						break;
583
+					// TEST #3 : check that section is the proper format
584
+					case 3:
585
+						if (
586
+							! ($this->{$section} instanceof EE_Config_Base || $this->{$section} instanceof stdClass)
587
+						) {
588
+							if ($display_errors) {
589
+								throw new EE_Error(
590
+									sprintf(
591
+										esc_html__(
592
+											'The "%s" configuration settings have not been formatted correctly.',
593
+											'event_espresso'
594
+										),
595
+										$section
596
+									)
597
+								);
598
+							}
599
+							return false;
600
+						}
601
+						break;
602
+					// TEST #4 : check that config section name has been set
603
+					case 4:
604
+						if (empty($name)) {
605
+							if ($display_errors) {
606
+								throw new EE_Error(
607
+									esc_html__(
608
+										'No name has been provided for the specific configuration section.',
609
+										'event_espresso'
610
+									)
611
+								);
612
+							}
613
+							return false;
614
+						}
615
+						break;
616
+					// TEST #5 : check that a config class name has been set
617
+					case 5:
618
+						if (empty($config_class)) {
619
+							if ($display_errors) {
620
+								throw new EE_Error(
621
+									esc_html__(
622
+										'No class name has been provided for the specific configuration section.',
623
+										'event_espresso'
624
+									)
625
+								);
626
+							}
627
+							return false;
628
+						}
629
+						break;
630
+					// TEST #6 : verify config class is accessible
631
+					case 6:
632
+						if (! class_exists($config_class)) {
633
+							if ($display_errors) {
634
+								throw new EE_Error(
635
+									sprintf(
636
+										esc_html__(
637
+											'The "%s" class does not exist. Please ensure that an autoloader has been set for it.',
638
+											'event_espresso'
639
+										),
640
+										$config_class
641
+									)
642
+								);
643
+							}
644
+							return false;
645
+						}
646
+						break;
647
+					// TEST #7 : check that config has even been set
648
+					case 7:
649
+						if (! isset($this->{$section}->{$name})) {
650
+							if ($display_errors) {
651
+								throw new EE_Error(
652
+									sprintf(
653
+										esc_html__('No configuration has been set for "%1$s->%2$s".', 'event_espresso'),
654
+										$section,
655
+										$name
656
+									)
657
+								);
658
+							}
659
+							return false;
660
+						} else {
661
+							// and make sure it's not serialized
662
+							$this->{$section}->{$name} = maybe_unserialize($this->{$section}->{$name});
663
+						}
664
+						break;
665
+					// TEST #8 : check that config is the requested type
666
+					case 8:
667
+						if (! $this->{$section}->{$name} instanceof $config_class) {
668
+							if ($display_errors) {
669
+								throw new EE_Error(
670
+									sprintf(
671
+										esc_html__(
672
+											'The configuration for "%1$s->%2$s" is not of the "%3$s" class.',
673
+											'event_espresso'
674
+										),
675
+										$section,
676
+										$name,
677
+										$config_class
678
+									)
679
+								);
680
+							}
681
+							return false;
682
+						}
683
+						break;
684
+					// TEST #9 : verify config object
685
+					case 9:
686
+						if (! $config_obj instanceof EE_Config_Base) {
687
+							if ($display_errors) {
688
+								throw new EE_Error(
689
+									sprintf(
690
+										esc_html__('The "%s" class is not an instance of EE_Config_Base.', 'event_espresso'),
691
+										print_r($config_obj, true)
692
+									)
693
+								);
694
+							}
695
+							return false;
696
+						}
697
+						break;
698
+				}
699
+			}
700
+		} catch (EE_Error $e) {
701
+			$e->get_error();
702
+		}
703
+		// you have successfully run the gauntlet
704
+		return true;
705
+	}
706
+
707
+
708
+	/**
709
+	 *    _generate_config_option_name
710
+	 *
711
+	 * @access        protected
712
+	 * @param        string $section
713
+	 * @param        string $name
714
+	 * @return        string
715
+	 */
716
+	private function _generate_config_option_name($section = '', $name = '')
717
+	{
718
+		return 'ee_config-' . strtolower($section . '-' . str_replace(array('EE_', 'EED_'), '', $name));
719
+	}
720
+
721
+
722
+	/**
723
+	 *    _set_config_class
724
+	 * ensures that a config class is set, either from a passed config class or one generated from the config name
725
+	 *
726
+	 * @access    private
727
+	 * @param    string $config_class
728
+	 * @param    string $name
729
+	 * @return    string
730
+	 */
731
+	private function _set_config_class($config_class = '', $name = '')
732
+	{
733
+		return ! empty($config_class)
734
+			? $config_class
735
+			: str_replace(' ', '_', ucwords(str_replace('_', ' ', $name))) . '_Config';
736
+	}
737
+
738
+
739
+	/**
740
+	 *    set_config
741
+	 *
742
+	 * @access    protected
743
+	 * @param    string         $section
744
+	 * @param    string         $name
745
+	 * @param    string         $config_class
746
+	 * @param    EE_Config_Base $config_obj
747
+	 * @return    EE_Config_Base
748
+	 */
749
+	public function set_config($section = '', $name = '', $config_class = '', EE_Config_Base $config_obj = null)
750
+	{
751
+		// ensure config class is set to something
752
+		$config_class = $this->_set_config_class($config_class, $name);
753
+		// run tests 1-4, 6, and 7 to verify all config params are set and valid
754
+		if (! $this->_verify_config_params($section, $name, $config_class, null, array(1, 2, 3, 4, 5, 6))) {
755
+			return null;
756
+		}
757
+		$config_option_name = $this->_generate_config_option_name($section, $name);
758
+		// if the config option name hasn't been added yet to the list of option names we're tracking, then do so now
759
+		if (! isset($this->_addon_option_names[ $config_option_name ])) {
760
+			$this->_addon_option_names[ $config_option_name ] = $config_class;
761
+			$this->update_addon_option_names();
762
+		}
763
+		// verify the incoming config object but suppress errors
764
+		if (! $this->_verify_config_params($section, $name, $config_class, $config_obj, array(9), false)) {
765
+			$config_obj = new $config_class();
766
+		}
767
+		if (get_option($config_option_name)) {
768
+			EE_Config::log($config_option_name);
769
+			update_option($config_option_name, $config_obj);
770
+			$this->{$section}->{$name} = $config_obj;
771
+			return $this->{$section}->{$name};
772
+		} else {
773
+			// create a wp-option for this config
774
+			if (add_option($config_option_name, $config_obj, '', 'no')) {
775
+				$this->{$section}->{$name} = maybe_unserialize($config_obj);
776
+				return $this->{$section}->{$name};
777
+			} else {
778
+				EE_Error::add_error(
779
+					sprintf(esc_html__('The "%s" could not be saved to the database.', 'event_espresso'), $config_class),
780
+					__FILE__,
781
+					__FUNCTION__,
782
+					__LINE__
783
+				);
784
+				return null;
785
+			}
786
+		}
787
+	}
788
+
789
+
790
+	/**
791
+	 *    update_config
792
+	 * Important: the config object must ALREADY be set, otherwise this will produce an error.
793
+	 *
794
+	 * @access    public
795
+	 * @param    string                $section
796
+	 * @param    string                $name
797
+	 * @param    EE_Config_Base|string $config_obj
798
+	 * @param    bool                  $throw_errors
799
+	 * @return    bool
800
+	 */
801
+	public function update_config($section = '', $name = '', $config_obj = '', $throw_errors = true)
802
+	{
803
+		// don't allow config updates during WP heartbeats
804
+		/** @var RequestInterface $request */
805
+		$request = LoaderFactory::getLoader()->getShared(RequestInterface::class);
806
+		if ($request->isWordPressHeartbeat()) {
807
+			return false;
808
+		}
809
+		$config_obj = maybe_unserialize($config_obj);
810
+		// get class name of the incoming object
811
+		$config_class = get_class($config_obj);
812
+		// run tests 1-5 and 9 to verify config
813
+		if (
814
+			! $this->_verify_config_params(
815
+				$section,
816
+				$name,
817
+				$config_class,
818
+				$config_obj,
819
+				array(1, 2, 3, 4, 7, 9)
820
+			)
821
+		) {
822
+			return false;
823
+		}
824
+		$config_option_name = $this->_generate_config_option_name($section, $name);
825
+		// check if config object has been added to db by seeing if config option name is in $this->_addon_option_names array
826
+		if (! isset($this->_addon_option_names[ $config_option_name ])) {
827
+			// save new config to db
828
+			if ($this->set_config($section, $name, $config_class, $config_obj)) {
829
+				return true;
830
+			}
831
+		} else {
832
+			// first check if the record already exists
833
+			$existing_config = get_option($config_option_name);
834
+			$config_obj = serialize($config_obj);
835
+			// just return if db record is already up to date (NOT type safe comparison)
836
+			if ($existing_config == $config_obj) {
837
+				$this->{$section}->{$name} = $config_obj;
838
+				return true;
839
+			} elseif (update_option($config_option_name, $config_obj)) {
840
+				EE_Config::log($config_option_name);
841
+				// update wp-option for this config class
842
+				$this->{$section}->{$name} = $config_obj;
843
+				return true;
844
+			} elseif ($throw_errors) {
845
+				EE_Error::add_error(
846
+					sprintf(
847
+						esc_html__(
848
+							'The "%1$s" object stored at"%2$s" was not successfully updated in the database.',
849
+							'event_espresso'
850
+						),
851
+						$config_class,
852
+						'EE_Config->' . $section . '->' . $name
853
+					),
854
+					__FILE__,
855
+					__FUNCTION__,
856
+					__LINE__
857
+				);
858
+			}
859
+		}
860
+		return false;
861
+	}
862
+
863
+
864
+	/**
865
+	 *    get_config
866
+	 *
867
+	 * @access    public
868
+	 * @param    string $section
869
+	 * @param    string $name
870
+	 * @param    string $config_class
871
+	 * @return    mixed EE_Config_Base | NULL
872
+	 */
873
+	public function get_config($section = '', $name = '', $config_class = '')
874
+	{
875
+		// ensure config class is set to something
876
+		$config_class = $this->_set_config_class($config_class, $name);
877
+		// run tests 1-4, 6 and 7 to verify that all params have been set
878
+		if (! $this->_verify_config_params($section, $name, $config_class, null, array(1, 2, 3, 4, 5, 6))) {
879
+			return null;
880
+		}
881
+		// now test if the requested config object exists, but suppress errors
882
+		if ($this->_verify_config_params($section, $name, $config_class, null, array(7, 8), false)) {
883
+			// config already exists, so pass it back
884
+			return $this->{$section}->{$name};
885
+		}
886
+		// load config option from db if it exists
887
+		$config_obj = $this->get_config_option($this->_generate_config_option_name($section, $name));
888
+		// verify the newly retrieved config object, but suppress errors
889
+		if ($this->_verify_config_params($section, $name, $config_class, $config_obj, array(9), false)) {
890
+			// config is good, so set it and pass it back
891
+			$this->{$section}->{$name} = $config_obj;
892
+			return $this->{$section}->{$name};
893
+		}
894
+		// oops! $config_obj is not already set and does not exist in the db, so create a new one
895
+		$config_obj = $this->set_config($section, $name, $config_class);
896
+		// verify the newly created config object
897
+		if ($this->_verify_config_params($section, $name, $config_class, $config_obj, array(9))) {
898
+			return $this->{$section}->{$name};
899
+		} else {
900
+			EE_Error::add_error(
901
+				sprintf(esc_html__('The "%s" could not be retrieved from the database.', 'event_espresso'), $config_class),
902
+				__FILE__,
903
+				__FUNCTION__,
904
+				__LINE__
905
+			);
906
+		}
907
+		return null;
908
+	}
909
+
910
+
911
+	/**
912
+	 *    get_config_option
913
+	 *
914
+	 * @access    public
915
+	 * @param    string $config_option_name
916
+	 * @return    mixed EE_Config_Base | FALSE
917
+	 */
918
+	public function get_config_option($config_option_name = '')
919
+	{
920
+		// retrieve the wp-option for this config class.
921
+		$config_option = maybe_unserialize(get_option($config_option_name, array()));
922
+		if (empty($config_option)) {
923
+			EE_Config::log($config_option_name . '-NOT-FOUND');
924
+		}
925
+		return $config_option;
926
+	}
927
+
928
+
929
+	/**
930
+	 * log
931
+	 *
932
+	 * @param string $config_option_name
933
+	 */
934
+	public static function log($config_option_name = '')
935
+	{
936
+		if (EE_Config::logging_enabled() && ! empty($config_option_name)) {
937
+			$config_log = get_option(EE_Config::LOG_NAME, array());
938
+			/** @var RequestParams $request */
939
+			$request = LoaderFactory::getLoader()->getShared(RequestParams::class);
940
+			$config_log[ (string) microtime(true) ] = array(
941
+				'config_name' => $config_option_name,
942
+				'request'     => $request->requestParams(),
943
+			);
944
+			update_option(EE_Config::LOG_NAME, $config_log);
945
+		}
946
+	}
947
+
948
+
949
+	/**
950
+	 * trim_log
951
+	 * reduces the size of the config log to the length specified by EE_Config::LOG_LENGTH
952
+	 */
953
+	public static function trim_log()
954
+	{
955
+		if (! EE_Config::logging_enabled()) {
956
+			return;
957
+		}
958
+		$config_log = maybe_unserialize(get_option(EE_Config::LOG_NAME, array()));
959
+		$log_length = count($config_log);
960
+		if ($log_length > EE_Config::LOG_LENGTH) {
961
+			ksort($config_log);
962
+			$config_log = array_slice($config_log, $log_length - EE_Config::LOG_LENGTH, null, true);
963
+			update_option(EE_Config::LOG_NAME, $config_log);
964
+		}
965
+	}
966
+
967
+
968
+	/**
969
+	 *    get_page_for_posts
970
+	 *    if the wp-option "show_on_front" is set to "page", then this is the post_name for the post set in the
971
+	 *    wp-option "page_for_posts", or "posts" if no page is selected
972
+	 *
973
+	 * @access    public
974
+	 * @return    string
975
+	 */
976
+	public static function get_page_for_posts()
977
+	{
978
+		$page_for_posts = get_option('page_for_posts');
979
+		if (! $page_for_posts) {
980
+			return 'posts';
981
+		}
982
+		global $wpdb;
983
+		$SQL = "SELECT post_name from $wpdb->posts WHERE post_type='posts' OR post_type='page' AND post_status='publish' AND ID=%d";
984
+		return $wpdb->get_var($wpdb->prepare($SQL, $page_for_posts));
985
+	}
986
+
987
+
988
+	/**
989
+	 *    register_shortcodes_and_modules.
990
+	 *    At this point, it's too early to tell if we're maintenance mode or not.
991
+	 *    In fact, this is where we give modules a chance to let core know they exist
992
+	 *    so they can help trigger maintenance mode if it's needed
993
+	 *
994
+	 * @access    public
995
+	 * @return    void
996
+	 */
997
+	public function register_shortcodes_and_modules()
998
+	{
999
+		// allow modules to set hooks for the rest of the system
1000
+		EE_Registry::instance()->modules = $this->_register_modules();
1001
+	}
1002
+
1003
+
1004
+	/**
1005
+	 *    initialize_shortcodes_and_modules
1006
+	 *    meaning they can start adding their hooks to get stuff done
1007
+	 *
1008
+	 * @access    public
1009
+	 * @return    void
1010
+	 */
1011
+	public function initialize_shortcodes_and_modules()
1012
+	{
1013
+		// allow modules to set hooks for the rest of the system
1014
+		$this->_initialize_modules();
1015
+	}
1016
+
1017
+
1018
+	/**
1019
+	 *    widgets_init
1020
+	 *
1021
+	 * @access private
1022
+	 * @return void
1023
+	 */
1024
+	public function widgets_init()
1025
+	{
1026
+		// only init widgets on admin pages when not in complete maintenance, and
1027
+		// on frontend when not in any maintenance mode
1028
+		if (
1029
+			! EE_Maintenance_Mode::instance()->level()
1030
+			|| (
1031
+				is_admin()
1032
+				&& EE_Maintenance_Mode::instance()->level() !== EE_Maintenance_Mode::level_2_complete_maintenance
1033
+			)
1034
+		) {
1035
+			// grab list of installed widgets
1036
+			$widgets_to_register = glob(EE_WIDGETS . '*', GLOB_ONLYDIR);
1037
+			// filter list of modules to register
1038
+			$widgets_to_register = apply_filters(
1039
+				'FHEE__EE_Config__register_widgets__widgets_to_register',
1040
+				$widgets_to_register
1041
+			);
1042
+			if (! empty($widgets_to_register)) {
1043
+				// cycle thru widget folders
1044
+				foreach ($widgets_to_register as $widget_path) {
1045
+					// add to list of installed widget modules
1046
+					EE_Config::register_ee_widget($widget_path);
1047
+				}
1048
+			}
1049
+			// filter list of installed modules
1050
+			EE_Registry::instance()->widgets = apply_filters(
1051
+				'FHEE__EE_Config__register_widgets__installed_widgets',
1052
+				EE_Registry::instance()->widgets
1053
+			);
1054
+		}
1055
+	}
1056
+
1057
+
1058
+	/**
1059
+	 *    register_ee_widget - makes core aware of this widget
1060
+	 *
1061
+	 * @access    public
1062
+	 * @param    string $widget_path - full path up to and including widget folder
1063
+	 * @return    void
1064
+	 */
1065
+	public static function register_ee_widget($widget_path = null)
1066
+	{
1067
+		do_action('AHEE__EE_Config__register_widget__begin', $widget_path);
1068
+		$widget_ext = '.widget.php';
1069
+		// make all separators match
1070
+		$widget_path = rtrim(str_replace('\\', DS, $widget_path), DS);
1071
+		// does the file path INCLUDE the actual file name as part of the path ?
1072
+		if (strpos($widget_path, $widget_ext) !== false) {
1073
+			// grab and shortcode file name from directory name and break apart at dots
1074
+			$file_name = explode('.', basename($widget_path));
1075
+			// take first segment from file name pieces and remove class prefix if it exists
1076
+			$widget = strpos($file_name[0], 'EEW_') === 0 ? substr($file_name[0], 4) : $file_name[0];
1077
+			// sanitize shortcode directory name
1078
+			$widget = sanitize_key($widget);
1079
+			// now we need to rebuild the shortcode path
1080
+			$widget_path = explode('/', $widget_path);
1081
+			// remove last segment
1082
+			array_pop($widget_path);
1083
+			// glue it back together
1084
+			$widget_path = implode(DS, $widget_path);
1085
+		} else {
1086
+			// grab and sanitize widget directory name
1087
+			$widget = sanitize_key(basename($widget_path));
1088
+		}
1089
+		// create classname from widget directory name
1090
+		$widget = str_replace(' ', '_', ucwords(str_replace('_', ' ', $widget)));
1091
+		// add class prefix
1092
+		$widget_class = 'EEW_' . $widget;
1093
+		// does the widget exist ?
1094
+		if (! is_readable($widget_path . '/' . $widget_class . $widget_ext)) {
1095
+			$msg = sprintf(
1096
+				esc_html__(
1097
+					'The requested %s widget file could not be found or is not readable due to file permissions. Please ensure the following path is correct: %s',
1098
+					'event_espresso'
1099
+				),
1100
+				$widget_class,
1101
+				$widget_path . '/' . $widget_class . $widget_ext
1102
+			);
1103
+			EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__);
1104
+			return;
1105
+		}
1106
+		// load the widget class file
1107
+		require_once($widget_path . '/' . $widget_class . $widget_ext);
1108
+		// verify that class exists
1109
+		if (! class_exists($widget_class)) {
1110
+			$msg = sprintf(esc_html__('The requested %s widget class does not exist.', 'event_espresso'), $widget_class);
1111
+			EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__);
1112
+			return;
1113
+		}
1114
+		register_widget($widget_class);
1115
+		// add to array of registered widgets
1116
+		EE_Registry::instance()->widgets->{$widget_class} = $widget_path . '/' . $widget_class . $widget_ext;
1117
+	}
1118
+
1119
+
1120
+	/**
1121
+	 *        _register_modules
1122
+	 *
1123
+	 * @access private
1124
+	 * @return array
1125
+	 */
1126
+	private function _register_modules()
1127
+	{
1128
+		// grab list of installed modules
1129
+		$modules_to_register = glob(EE_MODULES . '*', GLOB_ONLYDIR);
1130
+		// filter list of modules to register
1131
+		$modules_to_register = apply_filters(
1132
+			'FHEE__EE_Config__register_modules__modules_to_register',
1133
+			$modules_to_register
1134
+		);
1135
+		if (! empty($modules_to_register)) {
1136
+			// loop through folders
1137
+			foreach ($modules_to_register as $module_path) {
1138
+				/**TEMPORARILY EXCLUDE gateways from modules for time being**/
1139
+				if (
1140
+					$module_path !== EE_MODULES . 'zzz-copy-this-module-template'
1141
+					&& $module_path !== EE_MODULES . 'gateways'
1142
+				) {
1143
+					// add to list of installed modules
1144
+					EE_Config::register_module($module_path);
1145
+				}
1146
+			}
1147
+		}
1148
+		// filter list of installed modules
1149
+		return apply_filters(
1150
+			'FHEE__EE_Config___register_modules__installed_modules',
1151
+			EE_Registry::instance()->modules
1152
+		);
1153
+	}
1154
+
1155
+
1156
+	/**
1157
+	 *    register_module - makes core aware of this module
1158
+	 *
1159
+	 * @access    public
1160
+	 * @param    string $module_path - full path up to and including module folder
1161
+	 * @return    bool
1162
+	 */
1163
+	public static function register_module($module_path = null)
1164
+	{
1165
+		do_action('AHEE__EE_Config__register_module__begin', $module_path);
1166
+		$module_ext = '.module.php';
1167
+		// make all separators match
1168
+		$module_path = str_replace(array('\\', '/'), '/', $module_path);
1169
+		// does the file path INCLUDE the actual file name as part of the path ?
1170
+		if (strpos($module_path, $module_ext) !== false) {
1171
+			// grab and shortcode file name from directory name and break apart at dots
1172
+			$module_file = explode('.', basename($module_path));
1173
+			// now we need to rebuild the shortcode path
1174
+			$module_path = explode('/', $module_path);
1175
+			// remove last segment
1176
+			array_pop($module_path);
1177
+			// glue it back together
1178
+			$module_path = implode('/', $module_path) . '/';
1179
+			// take first segment from file name pieces and sanitize it
1180
+			$module = preg_replace('/[^a-zA-Z0-9_\-]/', '', $module_file[0]);
1181
+			// ensure class prefix is added
1182
+			$module_class = strpos($module, 'EED_') !== 0 ? 'EED_' . $module : $module;
1183
+		} else {
1184
+			// we need to generate the filename based off of the folder name
1185
+			// grab and sanitize module name
1186
+			$module = strtolower(basename($module_path));
1187
+			$module = preg_replace('/[^a-z0-9_\-]/', '', $module);
1188
+			// like trailingslashit()
1189
+			$module_path = rtrim($module_path, '/') . '/';
1190
+			// create classname from module directory name
1191
+			$module = str_replace(' ', '_', ucwords(str_replace('_', ' ', $module)));
1192
+			// add class prefix
1193
+			$module_class = 'EED_' . $module;
1194
+		}
1195
+		// does the module exist ?
1196
+		if (! is_readable($module_path . '/' . $module_class . $module_ext)) {
1197
+			$msg = sprintf(
1198
+				esc_html__(
1199
+					'The requested %s module file could not be found or is not readable due to file permissions.',
1200
+					'event_espresso'
1201
+				),
1202
+				$module
1203
+			);
1204
+			EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__);
1205
+			return false;
1206
+		}
1207
+		// load the module class file
1208
+		require_once($module_path . $module_class . $module_ext);
1209
+		// verify that class exists
1210
+		if (! class_exists($module_class)) {
1211
+			$msg = sprintf(esc_html__('The requested %s module class does not exist.', 'event_espresso'), $module_class);
1212
+			EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__);
1213
+			return false;
1214
+		}
1215
+		// add to array of registered modules
1216
+		EE_Registry::instance()->modules->{$module_class} = $module_path . $module_class . $module_ext;
1217
+		do_action(
1218
+			'AHEE__EE_Config__register_module__complete',
1219
+			$module_class,
1220
+			EE_Registry::instance()->modules->{$module_class}
1221
+		);
1222
+		return true;
1223
+	}
1224
+
1225
+
1226
+	/**
1227
+	 *    _initialize_modules
1228
+	 *    allow modules to set hooks for the rest of the system
1229
+	 *
1230
+	 * @access private
1231
+	 * @return void
1232
+	 */
1233
+	private function _initialize_modules()
1234
+	{
1235
+		// cycle thru shortcode folders
1236
+		foreach (EE_Registry::instance()->modules as $module_class => $module_path) {
1237
+			// fire the shortcode class's set_hooks methods in case it needs to hook into other parts of the system
1238
+			// which set hooks ?
1239
+			if (is_admin()) {
1240
+				// fire immediately
1241
+				call_user_func(array($module_class, 'set_hooks_admin'));
1242
+			} else {
1243
+				// delay until other systems are online
1244
+				add_action(
1245
+					'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons',
1246
+					array($module_class, 'set_hooks')
1247
+				);
1248
+			}
1249
+		}
1250
+	}
1251
+
1252
+
1253
+	/**
1254
+	 *    register_route - adds module method routes to route_map
1255
+	 *
1256
+	 * @access    public
1257
+	 * @param    string $route       - "pretty" public alias for module method
1258
+	 * @param    string $module      - module name (classname without EED_ prefix)
1259
+	 * @param    string $method_name - the actual module method to be routed to
1260
+	 * @param    string $key         - url param key indicating a route is being called
1261
+	 * @return    bool
1262
+	 */
1263
+	public static function register_route($route = null, $module = null, $method_name = null, $key = 'ee')
1264
+	{
1265
+		do_action('AHEE__EE_Config__register_route__begin', $route, $module, $method_name);
1266
+		$module = str_replace('EED_', '', $module);
1267
+		$module_class = 'EED_' . $module;
1268
+		if (! isset(EE_Registry::instance()->modules->{$module_class})) {
1269
+			$msg = sprintf(esc_html__('The module %s has not been registered.', 'event_espresso'), $module);
1270
+			EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__);
1271
+			return false;
1272
+		}
1273
+		if (empty($route)) {
1274
+			$msg = sprintf(esc_html__('No route has been supplied.', 'event_espresso'), $route);
1275
+			EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__);
1276
+			return false;
1277
+		}
1278
+		if (! method_exists('EED_' . $module, $method_name)) {
1279
+			$msg = sprintf(
1280
+				esc_html__('A valid class method for the %s route has not been supplied.', 'event_espresso'),
1281
+				$route
1282
+			);
1283
+			EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__);
1284
+			return false;
1285
+		}
1286
+		EE_Config::$_module_route_map[ (string) $key ][ (string) $route ] = array('EED_' . $module, $method_name);
1287
+		return true;
1288
+	}
1289
+
1290
+
1291
+	/**
1292
+	 *    get_route - get module method route
1293
+	 *
1294
+	 * @access    public
1295
+	 * @param    string $route - "pretty" public alias for module method
1296
+	 * @param    string $key   - url param key indicating a route is being called
1297
+	 * @return    string
1298
+	 */
1299
+	public static function get_route($route = null, $key = 'ee')
1300
+	{
1301
+		do_action('AHEE__EE_Config__get_route__begin', $route);
1302
+		$route = (string) apply_filters('FHEE__EE_Config__get_route', $route);
1303
+		if (isset(EE_Config::$_module_route_map[ $key ][ $route ])) {
1304
+			return EE_Config::$_module_route_map[ $key ][ $route ];
1305
+		}
1306
+		return null;
1307
+	}
1308
+
1309
+
1310
+	/**
1311
+	 *    get_routes - get ALL module method routes
1312
+	 *
1313
+	 * @access    public
1314
+	 * @return    array
1315
+	 */
1316
+	public static function get_routes()
1317
+	{
1318
+		return EE_Config::$_module_route_map;
1319
+	}
1320
+
1321
+
1322
+	/**
1323
+	 *    register_forward - allows modules to forward request to another module for further processing
1324
+	 *
1325
+	 * @access    public
1326
+	 * @param    string       $route   - "pretty" public alias for module method
1327
+	 * @param    integer      $status  - integer value corresponding  to status constant strings set in module parent
1328
+	 *                                 class, allows different forwards to be served based on status
1329
+	 * @param    array|string $forward - function name or array( class, method )
1330
+	 * @param    string       $key     - url param key indicating a route is being called
1331
+	 * @return    bool
1332
+	 */
1333
+	public static function register_forward($route = null, $status = 0, $forward = null, $key = 'ee')
1334
+	{
1335
+		do_action('AHEE__EE_Config__register_forward', $route, $status, $forward);
1336
+		if (! isset(EE_Config::$_module_route_map[ $key ][ $route ]) || empty($route)) {
1337
+			$msg = sprintf(
1338
+				esc_html__('The module route %s for this forward has not been registered.', 'event_espresso'),
1339
+				$route
1340
+			);
1341
+			EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__);
1342
+			return false;
1343
+		}
1344
+		if (empty($forward)) {
1345
+			$msg = sprintf(esc_html__('No forwarding route has been supplied.', 'event_espresso'), $route);
1346
+			EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__);
1347
+			return false;
1348
+		}
1349
+		if (is_array($forward)) {
1350
+			if (! isset($forward[1])) {
1351
+				$msg = sprintf(
1352
+					esc_html__('A class method for the %s forwarding route has not been supplied.', 'event_espresso'),
1353
+					$route
1354
+				);
1355
+				EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__);
1356
+				return false;
1357
+			}
1358
+			if (! method_exists($forward[0], $forward[1])) {
1359
+				$msg = sprintf(
1360
+					esc_html__('The class method %s for the %s forwarding route is in invalid.', 'event_espresso'),
1361
+					$forward[1],
1362
+					$route
1363
+				);
1364
+				EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__);
1365
+				return false;
1366
+			}
1367
+		} elseif (! function_exists($forward)) {
1368
+			$msg = sprintf(
1369
+				esc_html__('The function %s for the %s forwarding route is in invalid.', 'event_espresso'),
1370
+				$forward,
1371
+				$route
1372
+			);
1373
+			EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__);
1374
+			return false;
1375
+		}
1376
+		EE_Config::$_module_forward_map[ $key ][ $route ][ absint($status) ] = $forward;
1377
+		return true;
1378
+	}
1379
+
1380
+
1381
+	/**
1382
+	 *    get_forward - get forwarding route
1383
+	 *
1384
+	 * @access    public
1385
+	 * @param    string  $route  - "pretty" public alias for module method
1386
+	 * @param    integer $status - integer value corresponding  to status constant strings set in module parent class,
1387
+	 *                           allows different forwards to be served based on status
1388
+	 * @param    string  $key    - url param key indicating a route is being called
1389
+	 * @return    string
1390
+	 */
1391
+	public static function get_forward($route = null, $status = 0, $key = 'ee')
1392
+	{
1393
+		do_action('AHEE__EE_Config__get_forward__begin', $route, $status);
1394
+		if (isset(EE_Config::$_module_forward_map[ $key ][ $route ][ $status ])) {
1395
+			return apply_filters(
1396
+				'FHEE__EE_Config__get_forward',
1397
+				EE_Config::$_module_forward_map[ $key ][ $route ][ $status ],
1398
+				$route,
1399
+				$status
1400
+			);
1401
+		}
1402
+		return null;
1403
+	}
1404
+
1405
+
1406
+	/**
1407
+	 *    register_forward - allows modules to specify different view templates for different method routes and status
1408
+	 *    results
1409
+	 *
1410
+	 * @access    public
1411
+	 * @param    string  $route  - "pretty" public alias for module method
1412
+	 * @param    integer $status - integer value corresponding  to status constant strings set in module parent class,
1413
+	 *                           allows different views to be served based on status
1414
+	 * @param    string  $view
1415
+	 * @param    string  $key    - url param key indicating a route is being called
1416
+	 * @return    bool
1417
+	 */
1418
+	public static function register_view($route = null, $status = 0, $view = null, $key = 'ee')
1419
+	{
1420
+		do_action('AHEE__EE_Config__register_view__begin', $route, $status, $view);
1421
+		if (! isset(EE_Config::$_module_route_map[ $key ][ $route ]) || empty($route)) {
1422
+			$msg = sprintf(
1423
+				esc_html__('The module route %s for this view has not been registered.', 'event_espresso'),
1424
+				$route
1425
+			);
1426
+			EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__);
1427
+			return false;
1428
+		}
1429
+		if (! is_readable($view)) {
1430
+			$msg = sprintf(
1431
+				esc_html__(
1432
+					'The %s view file could not be found or is not readable due to file permissions.',
1433
+					'event_espresso'
1434
+				),
1435
+				$view
1436
+			);
1437
+			EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__);
1438
+			return false;
1439
+		}
1440
+		EE_Config::$_module_view_map[ $key ][ $route ][ absint($status) ] = $view;
1441
+		return true;
1442
+	}
1443
+
1444
+
1445
+	/**
1446
+	 *    get_view - get view for route and status
1447
+	 *
1448
+	 * @access    public
1449
+	 * @param    string  $route  - "pretty" public alias for module method
1450
+	 * @param    integer $status - integer value corresponding  to status constant strings set in module parent class,
1451
+	 *                           allows different views to be served based on status
1452
+	 * @param    string  $key    - url param key indicating a route is being called
1453
+	 * @return    string
1454
+	 */
1455
+	public static function get_view($route = null, $status = 0, $key = 'ee')
1456
+	{
1457
+		do_action('AHEE__EE_Config__get_view__begin', $route, $status);
1458
+		if (isset(EE_Config::$_module_view_map[ $key ][ $route ][ $status ])) {
1459
+			return apply_filters(
1460
+				'FHEE__EE_Config__get_view',
1461
+				EE_Config::$_module_view_map[ $key ][ $route ][ $status ],
1462
+				$route,
1463
+				$status
1464
+			);
1465
+		}
1466
+		return null;
1467
+	}
1468
+
1469
+
1470
+	public function update_addon_option_names()
1471
+	{
1472
+		update_option(EE_Config::ADDON_OPTION_NAMES, $this->_addon_option_names);
1473
+	}
1474
+
1475
+
1476
+	public function shutdown()
1477
+	{
1478
+		$this->update_addon_option_names();
1479
+	}
1480
+
1481
+
1482
+	/**
1483
+	 * @return LegacyShortcodesManager
1484
+	 */
1485
+	public static function getLegacyShortcodesManager()
1486
+	{
1487
+		if (! EE_Config::instance()->legacy_shortcodes_manager instanceof LegacyShortcodesManager) {
1488
+			EE_Config::instance()->legacy_shortcodes_manager = LoaderFactory::getLoader()->getShared(
1489
+				LegacyShortcodesManager::class
1490
+			);
1491
+		}
1492
+		return EE_Config::instance()->legacy_shortcodes_manager;
1493
+	}
1494
+
1495
+
1496
+	/**
1497
+	 * register_shortcode - makes core aware of this shortcode
1498
+	 *
1499
+	 * @deprecated 4.9.26
1500
+	 * @param    string $shortcode_path - full path up to and including shortcode folder
1501
+	 * @return    bool
1502
+	 */
1503
+	public static function register_shortcode($shortcode_path = null)
1504
+	{
1505
+		EE_Error::doing_it_wrong(
1506
+			__METHOD__,
1507
+			esc_html__(
1508
+				'Usage is deprecated. Use \EventEspresso\core\services\shortcodes\LegacyShortcodesManager::registerShortcode() as direct replacement, or better yet, please see the new \EventEspresso\core\services\shortcodes\ShortcodesManager class.',
1509
+				'event_espresso'
1510
+			),
1511
+			'4.9.26'
1512
+		);
1513
+		return EE_Config::instance()->getLegacyShortcodesManager()->registerShortcode($shortcode_path);
1514
+	}
1515
+}
2279 1516
 
2280
-    /**
2281
-     * ReCaptcha Type
2282
-     *
2283
-     * @var string $recaptcha_type
2284
-     *    options: 'audio', 'image'
2285
-     */
2286
-    public $recaptcha_type;
1517
+/**
1518
+ * Base class used for config classes. These classes should generally not have
1519
+ * magic functions in use, except we'll allow them to magically set and get stuff...
1520
+ * basically, they should just be well-defined stdClasses
1521
+ */
1522
+class EE_Config_Base
1523
+{
2287 1524
 
2288
-    /**
2289
-     * ReCaptcha language
2290
-     *
2291
-     * @var string $recaptcha_language
2292
-     * eg 'en'
2293
-     */
2294
-    public $recaptcha_language;
1525
+	/**
1526
+	 * Utility function for escaping the value of a property and returning.
1527
+	 *
1528
+	 * @param string $property property name (checks to see if exists).
1529
+	 * @return mixed if a detected type found return the escaped value, otherwise just the raw value is returned.
1530
+	 * @throws EE_Error
1531
+	 */
1532
+	public function get_pretty($property)
1533
+	{
1534
+		if (! property_exists($this, $property)) {
1535
+			throw new EE_Error(
1536
+				sprintf(
1537
+					esc_html__(
1538
+						'%1$s::get_pretty() has been called with the property %2$s which does not exist on the %1$s config class.',
1539
+						'event_espresso'
1540
+					),
1541
+					get_class($this),
1542
+					$property
1543
+				)
1544
+			);
1545
+		}
1546
+		// just handling escaping of strings for now.
1547
+		if (is_string($this->{$property})) {
1548
+			return stripslashes($this->{$property});
1549
+		}
1550
+		return $this->{$property};
1551
+	}
1552
+
1553
+
1554
+	public function populate()
1555
+	{
1556
+		// grab defaults via a new instance of this class.
1557
+		$class_name = get_class($this);
1558
+		$defaults = new $class_name();
1559
+		// loop through the properties for this class and see if they are set.  If they are NOT, then grab the
1560
+		// default from our $defaults object.
1561
+		foreach (get_object_vars($defaults) as $property => $value) {
1562
+			if ($this->{$property} === null) {
1563
+				$this->{$property} = $value;
1564
+			}
1565
+		}
1566
+		// cleanup
1567
+		unset($defaults);
1568
+	}
1569
+
1570
+
1571
+	/**
1572
+	 *        __isset
1573
+	 *
1574
+	 * @param $a
1575
+	 * @return bool
1576
+	 */
1577
+	public function __isset($a)
1578
+	{
1579
+		return false;
1580
+	}
1581
+
1582
+
1583
+	/**
1584
+	 *        __unset
1585
+	 *
1586
+	 * @param $a
1587
+	 * @return bool
1588
+	 */
1589
+	public function __unset($a)
1590
+	{
1591
+		return false;
1592
+	}
1593
+
1594
+
1595
+	/**
1596
+	 *        __clone
1597
+	 */
1598
+	public function __clone()
1599
+	{
1600
+	}
1601
+
1602
+
1603
+	/**
1604
+	 *        __wakeup
1605
+	 */
1606
+	public function __wakeup()
1607
+	{
1608
+	}
1609
+
1610
+
1611
+	/**
1612
+	 *        __destruct
1613
+	 */
1614
+	public function __destruct()
1615
+	{
1616
+	}
1617
+}
2295 1618
 
2296
-    /**
2297
-     * ReCaptcha public key
2298
-     *
2299
-     * @var string $recaptcha_publickey
2300
-     */
2301
-    public $recaptcha_publickey;
1619
+/**
1620
+ * Class for defining what's in the EE_Config relating to registration settings
1621
+ */
1622
+class EE_Core_Config extends EE_Config_Base
1623
+{
2302 1624
 
2303
-    /**
2304
-     * ReCaptcha private key
2305
-     *
2306
-     * @var string $recaptcha_privatekey
2307
-     */
2308
-    public $recaptcha_privatekey;
1625
+	const OPTION_NAME_UXIP = 'ee_ueip_optin';
1626
+
1627
+
1628
+	public $current_blog_id;
1629
+
1630
+	public $ee_ueip_optin;
1631
+
1632
+	public $ee_ueip_has_notified;
1633
+
1634
+	/**
1635
+	 * Not to be confused with the 4 critical page variables (See
1636
+	 * get_critical_pages_array()), this is just an array of wp posts that have EE
1637
+	 * shortcodes in them. Keys are slugs, values are arrays with only 1 element: where the key is the shortcode
1638
+	 * in the page, and the value is the page's ID. The key 'posts' is basically a duplicate of this same array.
1639
+	 *
1640
+	 * @var array
1641
+	 */
1642
+	public $post_shortcodes;
1643
+
1644
+	public $module_route_map;
1645
+
1646
+	public $module_forward_map;
1647
+
1648
+	public $module_view_map;
1649
+
1650
+	/**
1651
+	 * The next 4 vars are the IDs of critical EE pages.
1652
+	 *
1653
+	 * @var int
1654
+	 */
1655
+	public $reg_page_id;
1656
+
1657
+	public $txn_page_id;
1658
+
1659
+	public $thank_you_page_id;
1660
+
1661
+	public $cancel_page_id;
1662
+
1663
+	/**
1664
+	 * The next 4 vars are the URLs of critical EE pages.
1665
+	 *
1666
+	 * @var int
1667
+	 */
1668
+	public $reg_page_url;
1669
+
1670
+	public $txn_page_url;
1671
+
1672
+	public $thank_you_page_url;
1673
+
1674
+	public $cancel_page_url;
1675
+
1676
+	/**
1677
+	 * The next vars relate to the custom slugs for EE CPT routes
1678
+	 */
1679
+	public $event_cpt_slug;
1680
+
1681
+	/**
1682
+	 * This caches the _ee_ueip_option in case this config is reset in the same
1683
+	 * request across blog switches in a multisite context.
1684
+	 * Avoids extra queries to the db for this option.
1685
+	 *
1686
+	 * @var bool
1687
+	 */
1688
+	public static $ee_ueip_option;
1689
+
1690
+
1691
+	/**
1692
+	 *    class constructor
1693
+	 *
1694
+	 * @access    public
1695
+	 */
1696
+	public function __construct()
1697
+	{
1698
+		// set default organization settings
1699
+		$this->current_blog_id = get_current_blog_id();
1700
+		$this->current_blog_id = $this->current_blog_id === null ? 1 : $this->current_blog_id;
1701
+		$this->ee_ueip_optin = $this->_get_main_ee_ueip_optin();
1702
+		$this->ee_ueip_has_notified = is_main_site() ? get_option('ee_ueip_has_notified', false) : true;
1703
+		$this->post_shortcodes = array();
1704
+		$this->module_route_map = array();
1705
+		$this->module_forward_map = array();
1706
+		$this->module_view_map = array();
1707
+		// critical EE page IDs
1708
+		$this->reg_page_id = 0;
1709
+		$this->txn_page_id = 0;
1710
+		$this->thank_you_page_id = 0;
1711
+		$this->cancel_page_id = 0;
1712
+		// critical EE page URLs
1713
+		$this->reg_page_url = '';
1714
+		$this->txn_page_url = '';
1715
+		$this->thank_you_page_url = '';
1716
+		$this->cancel_page_url = '';
1717
+		// cpt slugs
1718
+		$this->event_cpt_slug = esc_html__('events', 'event_espresso');
1719
+		// ueip constant check
1720
+		if (defined('EE_DISABLE_UXIP') && EE_DISABLE_UXIP) {
1721
+			$this->ee_ueip_optin = false;
1722
+			$this->ee_ueip_has_notified = true;
1723
+		}
1724
+	}
1725
+
1726
+
1727
+	/**
1728
+	 * @return array
1729
+	 */
1730
+	public function get_critical_pages_array()
1731
+	{
1732
+		return array(
1733
+			$this->reg_page_id,
1734
+			$this->txn_page_id,
1735
+			$this->thank_you_page_id,
1736
+			$this->cancel_page_id,
1737
+		);
1738
+	}
1739
+
1740
+
1741
+	/**
1742
+	 * @return array
1743
+	 */
1744
+	public function get_critical_pages_shortcodes_array()
1745
+	{
1746
+		return array(
1747
+			$this->reg_page_id       => 'ESPRESSO_CHECKOUT',
1748
+			$this->txn_page_id       => 'ESPRESSO_TXN_PAGE',
1749
+			$this->thank_you_page_id => 'ESPRESSO_THANK_YOU',
1750
+			$this->cancel_page_id    => 'ESPRESSO_CANCELLED',
1751
+		);
1752
+	}
1753
+
1754
+
1755
+	/**
1756
+	 *  gets/returns URL for EE reg_page
1757
+	 *
1758
+	 * @access    public
1759
+	 * @return    string
1760
+	 */
1761
+	public function reg_page_url()
1762
+	{
1763
+		if (! $this->reg_page_url) {
1764
+			$this->reg_page_url = add_query_arg(
1765
+				array('uts' => time()),
1766
+				get_permalink($this->reg_page_id)
1767
+			) . '#checkout';
1768
+		}
1769
+		return $this->reg_page_url;
1770
+	}
1771
+
1772
+
1773
+	/**
1774
+	 *  gets/returns URL for EE txn_page
1775
+	 *
1776
+	 * @param array $query_args like what gets passed to
1777
+	 *                          add_query_arg() as the first argument
1778
+	 * @access    public
1779
+	 * @return    string
1780
+	 */
1781
+	public function txn_page_url($query_args = array())
1782
+	{
1783
+		if (! $this->txn_page_url) {
1784
+			$this->txn_page_url = get_permalink($this->txn_page_id);
1785
+		}
1786
+		if ($query_args) {
1787
+			return add_query_arg($query_args, $this->txn_page_url);
1788
+		} else {
1789
+			return $this->txn_page_url;
1790
+		}
1791
+	}
1792
+
1793
+
1794
+	/**
1795
+	 *  gets/returns URL for EE thank_you_page
1796
+	 *
1797
+	 * @param array $query_args like what gets passed to
1798
+	 *                          add_query_arg() as the first argument
1799
+	 * @access    public
1800
+	 * @return    string
1801
+	 */
1802
+	public function thank_you_page_url($query_args = array())
1803
+	{
1804
+		if (! $this->thank_you_page_url) {
1805
+			$this->thank_you_page_url = get_permalink($this->thank_you_page_id);
1806
+		}
1807
+		if ($query_args) {
1808
+			return add_query_arg($query_args, $this->thank_you_page_url);
1809
+		} else {
1810
+			return $this->thank_you_page_url;
1811
+		}
1812
+	}
1813
+
1814
+
1815
+	/**
1816
+	 *  gets/returns URL for EE cancel_page
1817
+	 *
1818
+	 * @access    public
1819
+	 * @return    string
1820
+	 */
1821
+	public function cancel_page_url()
1822
+	{
1823
+		if (! $this->cancel_page_url) {
1824
+			$this->cancel_page_url = get_permalink($this->cancel_page_id);
1825
+		}
1826
+		return $this->cancel_page_url;
1827
+	}
1828
+
1829
+
1830
+	/**
1831
+	 * Resets all critical page urls to their original state.  Used primarily by the __sleep() magic method currently.
1832
+	 *
1833
+	 * @since 4.7.5
1834
+	 */
1835
+	protected function _reset_urls()
1836
+	{
1837
+		$this->reg_page_url = '';
1838
+		$this->txn_page_url = '';
1839
+		$this->cancel_page_url = '';
1840
+		$this->thank_you_page_url = '';
1841
+	}
1842
+
1843
+
1844
+	/**
1845
+	 * Used to return what the optin value is set for the EE User Experience Program.
1846
+	 * This accounts for multisite and this value being requested for a subsite.  In multisite, the value is set
1847
+	 * on the main site only.
1848
+	 *
1849
+	 * @return bool
1850
+	 */
1851
+	protected function _get_main_ee_ueip_optin()
1852
+	{
1853
+		// if this is the main site then we can just bypass our direct query.
1854
+		if (is_main_site()) {
1855
+			return get_option(self::OPTION_NAME_UXIP, false);
1856
+		}
1857
+		// is this already cached for this request?  If so use it.
1858
+		if (EE_Core_Config::$ee_ueip_option !== null) {
1859
+			return EE_Core_Config::$ee_ueip_option;
1860
+		}
1861
+		global $wpdb;
1862
+		$current_network_main_site = is_multisite() ? get_current_site() : null;
1863
+		$current_main_site_id = ! empty($current_network_main_site) ? $current_network_main_site->blog_id : 1;
1864
+		$option = self::OPTION_NAME_UXIP;
1865
+		// set correct table for query
1866
+		$table_name = $wpdb->get_blog_prefix($current_main_site_id) . 'options';
1867
+		// rather than getting blog option for the $current_main_site_id, we do a direct $wpdb query because
1868
+		// get_blog_option() does a switch_to_blog an that could cause infinite recursion because EE_Core_Config might be
1869
+		// re-constructed on the blog switch.  Note, we are still executing any core wp filters on this option retrieval.
1870
+		// this bit of code is basically a direct copy of get_option without any caching because we are NOT switched to the blog
1871
+		// for the purpose of caching.
1872
+		$pre = apply_filters('pre_option_' . $option, false, $option);
1873
+		if (false !== $pre) {
1874
+			EE_Core_Config::$ee_ueip_option = $pre;
1875
+			return EE_Core_Config::$ee_ueip_option;
1876
+		}
1877
+		$row = $wpdb->get_row(
1878
+			$wpdb->prepare(
1879
+				"SELECT option_value FROM $table_name WHERE option_name = %s LIMIT 1",
1880
+				$option
1881
+			)
1882
+		);
1883
+		if (is_object($row)) {
1884
+			$value = $row->option_value;
1885
+		} else { // option does not exist so use default.
1886
+			EE_Core_Config::$ee_ueip_option =  apply_filters('default_option_' . $option, false, $option);
1887
+			return EE_Core_Config::$ee_ueip_option;
1888
+		}
1889
+		EE_Core_Config::$ee_ueip_option = apply_filters('option_' . $option, maybe_unserialize($value), $option);
1890
+		return EE_Core_Config::$ee_ueip_option;
1891
+	}
1892
+
1893
+
1894
+	/**
1895
+	 * Utility function for escaping the value of a property and returning.
1896
+	 *
1897
+	 * @param string $property property name (checks to see if exists).
1898
+	 * @return mixed if a detected type found return the escaped value, otherwise just the raw value is returned.
1899
+	 * @throws EE_Error
1900
+	 */
1901
+	public function get_pretty($property)
1902
+	{
1903
+		if ($property === self::OPTION_NAME_UXIP) {
1904
+			return $this->ee_ueip_optin ? 'yes' : 'no';
1905
+		}
1906
+		return parent::get_pretty($property);
1907
+	}
1908
+
1909
+
1910
+	/**
1911
+	 * Currently used to ensure critical page urls have initial values saved to the db instead of any current set values
1912
+	 * on the object.
1913
+	 *
1914
+	 * @return array
1915
+	 */
1916
+	public function __sleep()
1917
+	{
1918
+		// reset all url properties
1919
+		$this->_reset_urls();
1920
+		// return what to save to db
1921
+		return array_keys(get_object_vars($this));
1922
+	}
1923
+}
2309 1924
 
2310
-    /**
2311
-     * array of form names protected by ReCaptcha
2312
-     *
2313
-     * @var array $recaptcha_protected_forms
2314
-     */
2315
-    public $recaptcha_protected_forms;
1925
+/**
1926
+ * Config class for storing info on the Organization
1927
+ */
1928
+class EE_Organization_Config extends EE_Config_Base
1929
+{
2316 1930
 
2317
-    /**
2318
-     * ReCaptcha width
2319
-     *
2320
-     * @var int $recaptcha_width
2321
-     * @deprecated
2322
-     */
2323
-    public $recaptcha_width;
1931
+	/**
1932
+	 * @var string $name
1933
+	 * eg EE4.1
1934
+	 */
1935
+	public $name;
1936
+
1937
+	/**
1938
+	 * @var string $address_1
1939
+	 * eg 123 Onna Road
1940
+	 */
1941
+	public $address_1 = '';
1942
+
1943
+	/**
1944
+	 * @var string $address_2
1945
+	 * eg PO Box 123
1946
+	 */
1947
+	public $address_2 = '';
1948
+
1949
+	/**
1950
+	 * @var string $city
1951
+	 * eg Inna City
1952
+	 */
1953
+	public $city = '';
1954
+
1955
+	/**
1956
+	 * @var int $STA_ID
1957
+	 * eg 4
1958
+	 */
1959
+	public $STA_ID = 0;
1960
+
1961
+	/**
1962
+	 * @var string $CNT_ISO
1963
+	 * eg US
1964
+	 */
1965
+	public $CNT_ISO = '';
1966
+
1967
+	/**
1968
+	 * @var string $zip
1969
+	 * eg 12345  or V1A 2B3
1970
+	 */
1971
+	public $zip = '';
1972
+
1973
+	/**
1974
+	 * @var string $email
1975
+	 * eg [email protected]
1976
+	 */
1977
+	public $email;
1978
+
1979
+	/**
1980
+	 * @var string $phone
1981
+	 * eg. 111-111-1111
1982
+	 */
1983
+	public $phone = '';
1984
+
1985
+	/**
1986
+	 * @var string $vat
1987
+	 * VAT/Tax Number
1988
+	 */
1989
+	public $vat = '';
1990
+
1991
+	/**
1992
+	 * @var string $logo_url
1993
+	 * eg http://www.somedomain.com/wp-content/uploads/kittehs.jpg
1994
+	 */
1995
+	public $logo_url = '';
1996
+
1997
+	/**
1998
+	 * The below are all various properties for holding links to organization social network profiles
1999
+	 *
2000
+	 * @var string
2001
+	 */
2002
+	/**
2003
+	 * facebook (facebook.com/profile.name)
2004
+	 *
2005
+	 * @var string
2006
+	 */
2007
+	public $facebook = '';
2008
+
2009
+	/**
2010
+	 * twitter (twitter.com/twitter_handle)
2011
+	 *
2012
+	 * @var string
2013
+	 */
2014
+	public $twitter = '';
2015
+
2016
+	/**
2017
+	 * linkedin (linkedin.com/in/profile_name)
2018
+	 *
2019
+	 * @var string
2020
+	 */
2021
+	public $linkedin = '';
2022
+
2023
+	/**
2024
+	 * pinterest (www.pinterest.com/profile_name)
2025
+	 *
2026
+	 * @var string
2027
+	 */
2028
+	public $pinterest = '';
2029
+
2030
+	/**
2031
+	 * google+ (google.com/+profileName)
2032
+	 *
2033
+	 * @var string
2034
+	 */
2035
+	public $google = '';
2036
+
2037
+	/**
2038
+	 * instagram (instagram.com/handle)
2039
+	 *
2040
+	 * @var string
2041
+	 */
2042
+	public $instagram = '';
2043
+
2044
+
2045
+	/**
2046
+	 *    class constructor
2047
+	 *
2048
+	 * @access    public
2049
+	 */
2050
+	public function __construct()
2051
+	{
2052
+		// set default organization settings
2053
+		// decode HTML entities from the WP blogname, because it's stored in the DB with HTML entities encoded
2054
+		$this->name = wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES);
2055
+		$this->email = get_bloginfo('admin_email');
2056
+	}
2057
+}
2324 2058
 
2325
-    /**
2326
-     * Whether or not invalid attempts to directly access the registration checkout page should be tracked.
2327
-     *
2328
-     * @var boolean $track_invalid_checkout_access
2329
-     */
2330
-    protected $track_invalid_checkout_access = true;
2059
+/**
2060
+ * Class for defining what's in the EE_Config relating to currency
2061
+ */
2062
+class EE_Currency_Config extends EE_Config_Base
2063
+{
2331 2064
 
2332
-    /**
2333
-     * Whether or not to show the privacy policy consent checkbox
2334
-     *
2335
-     * @var bool
2336
-     */
2337
-    public $consent_checkbox_enabled;
2065
+	/**
2066
+	 * @var string $code
2067
+	 * eg 'US'
2068
+	 */
2069
+	public $code;
2070
+
2071
+	/**
2072
+	 * @var string $name
2073
+	 * eg 'Dollar'
2074
+	 */
2075
+	public $name;
2076
+
2077
+	/**
2078
+	 * plural name
2079
+	 *
2080
+	 * @var string $plural
2081
+	 * eg 'Dollars'
2082
+	 */
2083
+	public $plural;
2084
+
2085
+	/**
2086
+	 * currency sign
2087
+	 *
2088
+	 * @var string $sign
2089
+	 * eg '$'
2090
+	 */
2091
+	public $sign;
2092
+
2093
+	/**
2094
+	 * Whether the currency sign should come before the number or not
2095
+	 *
2096
+	 * @var boolean $sign_b4
2097
+	 */
2098
+	public $sign_b4;
2099
+
2100
+	/**
2101
+	 * How many digits should come after the decimal place
2102
+	 *
2103
+	 * @var int $dec_plc
2104
+	 */
2105
+	public $dec_plc;
2106
+
2107
+	/**
2108
+	 * Symbol to use for decimal mark
2109
+	 *
2110
+	 * @var string $dec_mrk
2111
+	 * eg '.'
2112
+	 */
2113
+	public $dec_mrk;
2114
+
2115
+	/**
2116
+	 * Symbol to use for thousands
2117
+	 *
2118
+	 * @var string $thsnds
2119
+	 * eg ','
2120
+	 */
2121
+	public $thsnds;
2122
+
2123
+
2124
+	/**
2125
+	 *    class constructor
2126
+	 *
2127
+	 * @access    public
2128
+	 * @param string $CNT_ISO
2129
+	 * @throws EE_Error
2130
+	 * @throws ReflectionException
2131
+	 */
2132
+	public function __construct($CNT_ISO = '')
2133
+	{
2134
+		/** @var TableAnalysis $table_analysis */
2135
+		$table_analysis = EE_Registry::instance()->create('TableAnalysis', array(), true);
2136
+		// get country code from organization settings or use default
2137
+		$ORG_CNT = isset(EE_Registry::instance()->CFG->organization)
2138
+				   && EE_Registry::instance()->CFG->organization instanceof EE_Organization_Config
2139
+			? EE_Registry::instance()->CFG->organization->CNT_ISO
2140
+			: '';
2141
+		// but override if requested
2142
+		$CNT_ISO = ! empty($CNT_ISO) ? $CNT_ISO : $ORG_CNT;
2143
+		// so if that all went well, and we are not in M-Mode (cuz you can't query the db in M-Mode) and double-check the countries table exists
2144
+		if (
2145
+			! empty($CNT_ISO)
2146
+			&& EE_Maintenance_Mode::instance()->models_can_query()
2147
+			&& $table_analysis->tableExists(EE_Registry::instance()->load_model('Country')->table())
2148
+		) {
2149
+			// retrieve the country settings from the db, just in case they have been customized
2150
+			$country = EE_Registry::instance()->load_model('Country')->get_one_by_ID($CNT_ISO);
2151
+			if ($country instanceof EE_Country) {
2152
+				$this->code = $country->currency_code();    // currency code: USD, CAD, EUR
2153
+				$this->name = $country->currency_name_single();    // Dollar
2154
+				$this->plural = $country->currency_name_plural();    // Dollars
2155
+				$this->sign = $country->currency_sign();            // currency sign: $
2156
+				$this->sign_b4 = $country->currency_sign_before(
2157
+				);        // currency sign before or after: $TRUE  or  FALSE$
2158
+				$this->dec_plc = $country->currency_decimal_places();    // decimal places: 2 = 0.00  3 = 0.000
2159
+				$this->dec_mrk = $country->currency_decimal_mark(
2160
+				);    // decimal mark: (comma) ',' = 0,01   or (decimal) '.' = 0.01
2161
+				$this->thsnds = $country->currency_thousands_separator(
2162
+				);    // thousands separator: (comma) ',' = 1,000   or (decimal) '.' = 1.000
2163
+			}
2164
+		}
2165
+		// fallback to hardcoded defaults, in case the above failed
2166
+		if (empty($this->code)) {
2167
+			// set default currency settings
2168
+			$this->code = 'USD';    // currency code: USD, CAD, EUR
2169
+			$this->name = esc_html__('Dollar', 'event_espresso');    // Dollar
2170
+			$this->plural = esc_html__('Dollars', 'event_espresso');    // Dollars
2171
+			$this->sign = '$';    // currency sign: $
2172
+			$this->sign_b4 = true;    // currency sign before or after: $TRUE  or  FALSE$
2173
+			$this->dec_plc = 2;    // decimal places: 2 = 0.00  3 = 0.000
2174
+			$this->dec_mrk = '.';    // decimal mark: (comma) ',' = 0,01   or (decimal) '.' = 0.01
2175
+			$this->thsnds = ',';    // thousands separator: (comma) ',' = 1,000   or (decimal) '.' = 1.000
2176
+		}
2177
+	}
2178
+}
2338 2179
 
2339
-    /**
2340
-     * Label text to show on the checkbox
2341
-     *
2342
-     * @var string
2343
-     */
2344
-    public $consent_checkbox_label_text;
2180
+/**
2181
+ * Class for defining what's in the EE_Config relating to registration settings
2182
+ */
2183
+class EE_Registration_Config extends EE_Config_Base
2184
+{
2345 2185
 
2346
-    /*
2186
+	/**
2187
+	 * Default registration status
2188
+	 *
2189
+	 * @var string $default_STS_ID
2190
+	 * eg 'RPP'
2191
+	 */
2192
+	public $default_STS_ID;
2193
+
2194
+	/**
2195
+	 * For new events, this will be the default value for the maximum number of tickets (equivalent to maximum number of
2196
+	 * registrations)
2197
+	 *
2198
+	 * @var int
2199
+	 */
2200
+	public $default_maximum_number_of_tickets;
2201
+
2202
+	/**
2203
+	 * level of validation to apply to email addresses
2204
+	 *
2205
+	 * @var string $email_validation_level
2206
+	 * options: 'basic', 'wp_default', 'i18n', 'i18n_dns'
2207
+	 */
2208
+	public $email_validation_level;
2209
+
2210
+	/**
2211
+	 *    whether or not to show alternate payment options during the reg process if payment status is pending
2212
+	 *
2213
+	 * @var boolean $show_pending_payment_options
2214
+	 */
2215
+	public $show_pending_payment_options;
2216
+
2217
+	/**
2218
+	 * Whether to skip the registration confirmation page
2219
+	 *
2220
+	 * @var boolean $skip_reg_confirmation
2221
+	 */
2222
+	public $skip_reg_confirmation;
2223
+
2224
+	/**
2225
+	 * an array of SPCO reg steps where:
2226
+	 *        the keys denotes the reg step order
2227
+	 *        each element consists of an array with the following elements:
2228
+	 *            "file_path" => the file path to the EE_SPCO_Reg_Step class
2229
+	 *            "class_name" => the specific EE_SPCO_Reg_Step child class name
2230
+	 *            "slug" => the URL param used to trigger the reg step
2231
+	 *
2232
+	 * @var array $reg_steps
2233
+	 */
2234
+	public $reg_steps;
2235
+
2236
+	/**
2237
+	 * Whether registration confirmation should be the last page of SPCO
2238
+	 *
2239
+	 * @var boolean $reg_confirmation_last
2240
+	 */
2241
+	public $reg_confirmation_last;
2242
+
2243
+	/**
2244
+	 * Whether or not to enable the EE Bot Trap
2245
+	 *
2246
+	 * @var boolean $use_bot_trap
2247
+	 */
2248
+	public $use_bot_trap;
2249
+
2250
+	/**
2251
+	 * Whether or not to encrypt some data sent by the EE Bot Trap
2252
+	 *
2253
+	 * @var boolean $use_encryption
2254
+	 */
2255
+	public $use_encryption;
2256
+
2257
+	/**
2258
+	 * Whether or not to use ReCaptcha
2259
+	 *
2260
+	 * @var boolean $use_captcha
2261
+	 */
2262
+	public $use_captcha;
2263
+
2264
+	/**
2265
+	 * ReCaptcha Theme
2266
+	 *
2267
+	 * @var string $recaptcha_theme
2268
+	 *    options: 'dark', 'light', 'invisible'
2269
+	 */
2270
+	public $recaptcha_theme;
2271
+
2272
+	/**
2273
+	 * ReCaptcha Badge - determines the position of the reCAPTCHA badge if using Invisible ReCaptcha.
2274
+	 *
2275
+	 * @var string $recaptcha_badge
2276
+	 *    options: 'bottomright', 'bottomleft', 'inline'
2277
+	 */
2278
+	public $recaptcha_badge;
2279
+
2280
+	/**
2281
+	 * ReCaptcha Type
2282
+	 *
2283
+	 * @var string $recaptcha_type
2284
+	 *    options: 'audio', 'image'
2285
+	 */
2286
+	public $recaptcha_type;
2287
+
2288
+	/**
2289
+	 * ReCaptcha language
2290
+	 *
2291
+	 * @var string $recaptcha_language
2292
+	 * eg 'en'
2293
+	 */
2294
+	public $recaptcha_language;
2295
+
2296
+	/**
2297
+	 * ReCaptcha public key
2298
+	 *
2299
+	 * @var string $recaptcha_publickey
2300
+	 */
2301
+	public $recaptcha_publickey;
2302
+
2303
+	/**
2304
+	 * ReCaptcha private key
2305
+	 *
2306
+	 * @var string $recaptcha_privatekey
2307
+	 */
2308
+	public $recaptcha_privatekey;
2309
+
2310
+	/**
2311
+	 * array of form names protected by ReCaptcha
2312
+	 *
2313
+	 * @var array $recaptcha_protected_forms
2314
+	 */
2315
+	public $recaptcha_protected_forms;
2316
+
2317
+	/**
2318
+	 * ReCaptcha width
2319
+	 *
2320
+	 * @var int $recaptcha_width
2321
+	 * @deprecated
2322
+	 */
2323
+	public $recaptcha_width;
2324
+
2325
+	/**
2326
+	 * Whether or not invalid attempts to directly access the registration checkout page should be tracked.
2327
+	 *
2328
+	 * @var boolean $track_invalid_checkout_access
2329
+	 */
2330
+	protected $track_invalid_checkout_access = true;
2331
+
2332
+	/**
2333
+	 * Whether or not to show the privacy policy consent checkbox
2334
+	 *
2335
+	 * @var bool
2336
+	 */
2337
+	public $consent_checkbox_enabled;
2338
+
2339
+	/**
2340
+	 * Label text to show on the checkbox
2341
+	 *
2342
+	 * @var string
2343
+	 */
2344
+	public $consent_checkbox_label_text;
2345
+
2346
+	/*
2347 2347
      * String describing how long to keep payment logs. Passed into DateTime constructor
2348 2348
      * @var string
2349 2349
      */
2350
-    public $gateway_log_lifespan = '1 week';
2351
-
2352
-    /**
2353
-     * Enable copy attendee info at form
2354
-     *
2355
-     * @var boolean $enable_copy_attendee
2356
-     */
2357
-    protected $copy_attendee_info = true;
2358
-
2359
-
2360
-    /**
2361
-     *    class constructor
2362
-     *
2363
-     * @access    public
2364
-     */
2365
-    public function __construct()
2366
-    {
2367
-        // set default registration settings
2368
-        $this->default_STS_ID = EEM_Registration::status_id_pending_payment;
2369
-        $this->email_validation_level = 'wp_default';
2370
-        $this->show_pending_payment_options = true;
2371
-        $this->skip_reg_confirmation = true;
2372
-        $this->reg_steps = array();
2373
-        $this->reg_confirmation_last = false;
2374
-        $this->use_bot_trap = true;
2375
-        $this->use_encryption = true;
2376
-        $this->use_captcha = false;
2377
-        $this->recaptcha_theme = 'light';
2378
-        $this->recaptcha_badge = 'bottomleft';
2379
-        $this->recaptcha_type = 'image';
2380
-        $this->recaptcha_language = 'en';
2381
-        $this->recaptcha_publickey = null;
2382
-        $this->recaptcha_privatekey = null;
2383
-        $this->recaptcha_protected_forms = array();
2384
-        $this->recaptcha_width = 500;
2385
-        $this->default_maximum_number_of_tickets = 10;
2386
-        $this->consent_checkbox_enabled = false;
2387
-        $this->consent_checkbox_label_text = '';
2388
-        $this->gateway_log_lifespan = '7 days';
2389
-        $this->copy_attendee_info = true;
2390
-    }
2391
-
2392
-
2393
-    /**
2394
-     * This is called by the config loader and hooks are initialized AFTER the config has been populated.
2395
-     *
2396
-     * @since 4.8.8.rc.019
2397
-     */
2398
-    public function do_hooks()
2399
-    {
2400
-        add_action('AHEE__EE_Config___load_core_config__end', array($this, 'set_default_reg_status_on_EEM_Event'));
2401
-        add_action('AHEE__EE_Config___load_core_config__end', array($this, 'set_default_max_ticket_on_EEM_Event'));
2402
-        add_action('setup_theme', array($this, 'setDefaultCheckboxLabelText'));
2403
-    }
2404
-
2405
-
2406
-    /**
2407
-     * Hooked into `AHEE__EE_Config___load_core_config__end` to ensure the default for the
2408
-     * EVT_default_registration_status field matches the config setting for default_STS_ID.
2409
-     */
2410
-    public function set_default_reg_status_on_EEM_Event()
2411
-    {
2412
-        EEM_Event::set_default_reg_status($this->default_STS_ID);
2413
-    }
2414
-
2415
-
2416
-    /**
2417
-     * Hooked into `AHEE__EE_Config___load_core_config__end` to ensure the default for the EVT_additional_limit field
2418
-     * for Events matches the config setting for default_maximum_number_of_tickets
2419
-     */
2420
-    public function set_default_max_ticket_on_EEM_Event()
2421
-    {
2422
-        EEM_Event::set_default_additional_limit($this->default_maximum_number_of_tickets);
2423
-    }
2424
-
2425
-
2426
-    /**
2427
-     * Sets the default consent checkbox text. This needs to be done a bit later than when EE_Registration_Config is
2428
-     * constructed because that happens before we can get the privacy policy page's permalink.
2429
-     *
2430
-     * @throws InvalidArgumentException
2431
-     * @throws InvalidDataTypeException
2432
-     * @throws InvalidInterfaceException
2433
-     */
2434
-    public function setDefaultCheckboxLabelText()
2435
-    {
2436
-        if (
2437
-            $this->getConsentCheckboxLabelText() === null
2438
-            || $this->getConsentCheckboxLabelText() === ''
2439
-        ) {
2440
-            $opening_a_tag = '';
2441
-            $closing_a_tag = '';
2442
-            if (function_exists('get_privacy_policy_url')) {
2443
-                $privacy_page_url = get_privacy_policy_url();
2444
-                if (! empty($privacy_page_url)) {
2445
-                    $opening_a_tag = '<a href="' . $privacy_page_url . '" target="_blank">';
2446
-                    $closing_a_tag = '</a>';
2447
-                }
2448
-            }
2449
-            $loader = LoaderFactory::getLoader();
2450
-            $org_config = $loader->getShared('EE_Organization_Config');
2451
-            /**
2452
-             * @var $org_config EE_Organization_Config
2453
-             */
2454
-
2455
-            $this->setConsentCheckboxLabelText(
2456
-                sprintf(
2457
-                    esc_html__(
2458
-                        'I consent to %1$s storing and using my personal information, according to their %2$sprivacy policy%3$s.',
2459
-                        'event_espresso'
2460
-                    ),
2461
-                    $org_config->name,
2462
-                    $opening_a_tag,
2463
-                    $closing_a_tag
2464
-                )
2465
-            );
2466
-        }
2467
-    }
2468
-
2469
-
2470
-    /**
2471
-     * @return boolean
2472
-     */
2473
-    public function track_invalid_checkout_access()
2474
-    {
2475
-        return $this->track_invalid_checkout_access;
2476
-    }
2477
-
2478
-
2479
-    /**
2480
-     * @param boolean $track_invalid_checkout_access
2481
-     */
2482
-    public function set_track_invalid_checkout_access($track_invalid_checkout_access)
2483
-    {
2484
-        $this->track_invalid_checkout_access = filter_var(
2485
-            $track_invalid_checkout_access,
2486
-            FILTER_VALIDATE_BOOLEAN
2487
-        );
2488
-    }
2489
-
2490
-    /**
2491
-     * @return boolean
2492
-     */
2493
-    public function copyAttendeeInfo()
2494
-    {
2495
-        return $this->copy_attendee_info;
2496
-    }
2497
-
2498
-
2499
-    /**
2500
-     * @param boolean $copy_attendee_info
2501
-     */
2502
-    public function setCopyAttendeeInfo($copy_attendee_info)
2503
-    {
2504
-        $this->copy_attendee_info = filter_var(
2505
-            $copy_attendee_info,
2506
-            FILTER_VALIDATE_BOOLEAN
2507
-        );
2508
-    }
2509
-
2510
-
2511
-    /**
2512
-     * Gets the options to make availalbe for the gateway log lifespan
2513
-     * @return array
2514
-     */
2515
-    public function gatewayLogLifespanOptions()
2516
-    {
2517
-        return (array) apply_filters(
2518
-            'FHEE_EE_Admin_Config__gatewayLogLifespanOptions',
2519
-            array(
2520
-                '1 second' => esc_html__('Don\'t Log At All', 'event_espresso'),
2521
-                '1 day' => esc_html__('1 Day', 'event_espresso'),
2522
-                '7 days' => esc_html__('7 Days', 'event_espresso'),
2523
-                '14 days' => esc_html__('14 Days', 'event_espresso'),
2524
-                '30 days' => esc_html__('30 Days', 'event_espresso')
2525
-            )
2526
-        );
2527
-    }
2528
-
2529
-
2530
-    /**
2531
-     * @return bool
2532
-     */
2533
-    public function isConsentCheckboxEnabled()
2534
-    {
2535
-        return $this->consent_checkbox_enabled;
2536
-    }
2537
-
2538
-
2539
-    /**
2540
-     * @param bool $consent_checkbox_enabled
2541
-     */
2542
-    public function setConsentCheckboxEnabled($consent_checkbox_enabled)
2543
-    {
2544
-        $this->consent_checkbox_enabled = filter_var(
2545
-            $consent_checkbox_enabled,
2546
-            FILTER_VALIDATE_BOOLEAN
2547
-        );
2548
-    }
2549
-
2550
-
2551
-    /**
2552
-     * @return string
2553
-     */
2554
-    public function getConsentCheckboxLabelText()
2555
-    {
2556
-        return $this->consent_checkbox_label_text;
2557
-    }
2558
-
2559
-
2560
-    /**
2561
-     * @param string $consent_checkbox_label_text
2562
-     */
2563
-    public function setConsentCheckboxLabelText($consent_checkbox_label_text)
2564
-    {
2565
-        $this->consent_checkbox_label_text = (string) $consent_checkbox_label_text;
2566
-    }
2350
+	public $gateway_log_lifespan = '1 week';
2351
+
2352
+	/**
2353
+	 * Enable copy attendee info at form
2354
+	 *
2355
+	 * @var boolean $enable_copy_attendee
2356
+	 */
2357
+	protected $copy_attendee_info = true;
2358
+
2359
+
2360
+	/**
2361
+	 *    class constructor
2362
+	 *
2363
+	 * @access    public
2364
+	 */
2365
+	public function __construct()
2366
+	{
2367
+		// set default registration settings
2368
+		$this->default_STS_ID = EEM_Registration::status_id_pending_payment;
2369
+		$this->email_validation_level = 'wp_default';
2370
+		$this->show_pending_payment_options = true;
2371
+		$this->skip_reg_confirmation = true;
2372
+		$this->reg_steps = array();
2373
+		$this->reg_confirmation_last = false;
2374
+		$this->use_bot_trap = true;
2375
+		$this->use_encryption = true;
2376
+		$this->use_captcha = false;
2377
+		$this->recaptcha_theme = 'light';
2378
+		$this->recaptcha_badge = 'bottomleft';
2379
+		$this->recaptcha_type = 'image';
2380
+		$this->recaptcha_language = 'en';
2381
+		$this->recaptcha_publickey = null;
2382
+		$this->recaptcha_privatekey = null;
2383
+		$this->recaptcha_protected_forms = array();
2384
+		$this->recaptcha_width = 500;
2385
+		$this->default_maximum_number_of_tickets = 10;
2386
+		$this->consent_checkbox_enabled = false;
2387
+		$this->consent_checkbox_label_text = '';
2388
+		$this->gateway_log_lifespan = '7 days';
2389
+		$this->copy_attendee_info = true;
2390
+	}
2391
+
2392
+
2393
+	/**
2394
+	 * This is called by the config loader and hooks are initialized AFTER the config has been populated.
2395
+	 *
2396
+	 * @since 4.8.8.rc.019
2397
+	 */
2398
+	public function do_hooks()
2399
+	{
2400
+		add_action('AHEE__EE_Config___load_core_config__end', array($this, 'set_default_reg_status_on_EEM_Event'));
2401
+		add_action('AHEE__EE_Config___load_core_config__end', array($this, 'set_default_max_ticket_on_EEM_Event'));
2402
+		add_action('setup_theme', array($this, 'setDefaultCheckboxLabelText'));
2403
+	}
2404
+
2405
+
2406
+	/**
2407
+	 * Hooked into `AHEE__EE_Config___load_core_config__end` to ensure the default for the
2408
+	 * EVT_default_registration_status field matches the config setting for default_STS_ID.
2409
+	 */
2410
+	public function set_default_reg_status_on_EEM_Event()
2411
+	{
2412
+		EEM_Event::set_default_reg_status($this->default_STS_ID);
2413
+	}
2414
+
2415
+
2416
+	/**
2417
+	 * Hooked into `AHEE__EE_Config___load_core_config__end` to ensure the default for the EVT_additional_limit field
2418
+	 * for Events matches the config setting for default_maximum_number_of_tickets
2419
+	 */
2420
+	public function set_default_max_ticket_on_EEM_Event()
2421
+	{
2422
+		EEM_Event::set_default_additional_limit($this->default_maximum_number_of_tickets);
2423
+	}
2424
+
2425
+
2426
+	/**
2427
+	 * Sets the default consent checkbox text. This needs to be done a bit later than when EE_Registration_Config is
2428
+	 * constructed because that happens before we can get the privacy policy page's permalink.
2429
+	 *
2430
+	 * @throws InvalidArgumentException
2431
+	 * @throws InvalidDataTypeException
2432
+	 * @throws InvalidInterfaceException
2433
+	 */
2434
+	public function setDefaultCheckboxLabelText()
2435
+	{
2436
+		if (
2437
+			$this->getConsentCheckboxLabelText() === null
2438
+			|| $this->getConsentCheckboxLabelText() === ''
2439
+		) {
2440
+			$opening_a_tag = '';
2441
+			$closing_a_tag = '';
2442
+			if (function_exists('get_privacy_policy_url')) {
2443
+				$privacy_page_url = get_privacy_policy_url();
2444
+				if (! empty($privacy_page_url)) {
2445
+					$opening_a_tag = '<a href="' . $privacy_page_url . '" target="_blank">';
2446
+					$closing_a_tag = '</a>';
2447
+				}
2448
+			}
2449
+			$loader = LoaderFactory::getLoader();
2450
+			$org_config = $loader->getShared('EE_Organization_Config');
2451
+			/**
2452
+			 * @var $org_config EE_Organization_Config
2453
+			 */
2454
+
2455
+			$this->setConsentCheckboxLabelText(
2456
+				sprintf(
2457
+					esc_html__(
2458
+						'I consent to %1$s storing and using my personal information, according to their %2$sprivacy policy%3$s.',
2459
+						'event_espresso'
2460
+					),
2461
+					$org_config->name,
2462
+					$opening_a_tag,
2463
+					$closing_a_tag
2464
+				)
2465
+			);
2466
+		}
2467
+	}
2468
+
2469
+
2470
+	/**
2471
+	 * @return boolean
2472
+	 */
2473
+	public function track_invalid_checkout_access()
2474
+	{
2475
+		return $this->track_invalid_checkout_access;
2476
+	}
2477
+
2478
+
2479
+	/**
2480
+	 * @param boolean $track_invalid_checkout_access
2481
+	 */
2482
+	public function set_track_invalid_checkout_access($track_invalid_checkout_access)
2483
+	{
2484
+		$this->track_invalid_checkout_access = filter_var(
2485
+			$track_invalid_checkout_access,
2486
+			FILTER_VALIDATE_BOOLEAN
2487
+		);
2488
+	}
2489
+
2490
+	/**
2491
+	 * @return boolean
2492
+	 */
2493
+	public function copyAttendeeInfo()
2494
+	{
2495
+		return $this->copy_attendee_info;
2496
+	}
2497
+
2498
+
2499
+	/**
2500
+	 * @param boolean $copy_attendee_info
2501
+	 */
2502
+	public function setCopyAttendeeInfo($copy_attendee_info)
2503
+	{
2504
+		$this->copy_attendee_info = filter_var(
2505
+			$copy_attendee_info,
2506
+			FILTER_VALIDATE_BOOLEAN
2507
+		);
2508
+	}
2509
+
2510
+
2511
+	/**
2512
+	 * Gets the options to make availalbe for the gateway log lifespan
2513
+	 * @return array
2514
+	 */
2515
+	public function gatewayLogLifespanOptions()
2516
+	{
2517
+		return (array) apply_filters(
2518
+			'FHEE_EE_Admin_Config__gatewayLogLifespanOptions',
2519
+			array(
2520
+				'1 second' => esc_html__('Don\'t Log At All', 'event_espresso'),
2521
+				'1 day' => esc_html__('1 Day', 'event_espresso'),
2522
+				'7 days' => esc_html__('7 Days', 'event_espresso'),
2523
+				'14 days' => esc_html__('14 Days', 'event_espresso'),
2524
+				'30 days' => esc_html__('30 Days', 'event_espresso')
2525
+			)
2526
+		);
2527
+	}
2528
+
2529
+
2530
+	/**
2531
+	 * @return bool
2532
+	 */
2533
+	public function isConsentCheckboxEnabled()
2534
+	{
2535
+		return $this->consent_checkbox_enabled;
2536
+	}
2537
+
2538
+
2539
+	/**
2540
+	 * @param bool $consent_checkbox_enabled
2541
+	 */
2542
+	public function setConsentCheckboxEnabled($consent_checkbox_enabled)
2543
+	{
2544
+		$this->consent_checkbox_enabled = filter_var(
2545
+			$consent_checkbox_enabled,
2546
+			FILTER_VALIDATE_BOOLEAN
2547
+		);
2548
+	}
2549
+
2550
+
2551
+	/**
2552
+	 * @return string
2553
+	 */
2554
+	public function getConsentCheckboxLabelText()
2555
+	{
2556
+		return $this->consent_checkbox_label_text;
2557
+	}
2558
+
2559
+
2560
+	/**
2561
+	 * @param string $consent_checkbox_label_text
2562
+	 */
2563
+	public function setConsentCheckboxLabelText($consent_checkbox_label_text)
2564
+	{
2565
+		$this->consent_checkbox_label_text = (string) $consent_checkbox_label_text;
2566
+	}
2567 2567
 }
2568 2568
 
2569 2569
 /**
@@ -2572,180 +2572,180 @@  discard block
 block discarded – undo
2572 2572
 class EE_Admin_Config extends EE_Config_Base
2573 2573
 {
2574 2574
 
2575
-    /**
2576
-     * @var boolean $useAdvancedEditor
2577
-     */
2578
-    private $useAdvancedEditor;
2579
-
2580
-    /**
2581
-     * @var boolean $use_personnel_manager
2582
-     */
2583
-    public $use_personnel_manager;
2584
-
2585
-    /**
2586
-     * @var boolean $use_dashboard_widget
2587
-     */
2588
-    public $use_dashboard_widget;
2589
-
2590
-    /**
2591
-     * @var int $events_in_dashboard
2592
-     */
2593
-    public $events_in_dashboard;
2594
-
2595
-    /**
2596
-     * @var boolean $use_event_timezones
2597
-     */
2598
-    public $use_event_timezones;
2599
-
2600
-    /**
2601
-     * @var string $log_file_name
2602
-     */
2603
-    public $log_file_name;
2604
-
2605
-    /**
2606
-     * @var string $debug_file_name
2607
-     */
2608
-    public $debug_file_name;
2609
-
2610
-    /**
2611
-     * @var boolean $use_remote_logging
2612
-     */
2613
-    public $use_remote_logging;
2614
-
2615
-    /**
2616
-     * @var string $remote_logging_url
2617
-     */
2618
-    public $remote_logging_url;
2619
-
2620
-    /**
2621
-     * @var boolean $show_reg_footer
2622
-     */
2623
-    public $show_reg_footer;
2624
-
2625
-    /**
2626
-     * @var string $affiliate_id
2627
-     */
2628
-    public $affiliate_id;
2629
-
2630
-    /**
2631
-     * adds extra layer of encoding to session data to prevent serialization errors
2632
-     * but is incompatible with some server configuration errors
2633
-     * if you get "500 internal server errors" during registration, try turning this on
2634
-     * if you get PHP fatal errors regarding base 64 methods not defined, then turn this off
2635
-     *
2636
-     * @var boolean $encode_session_data
2637
-     */
2638
-    private $encode_session_data = false;
2639
-
2640
-    /**
2641
-     * @var boolean
2642
-     */
2643
-    private $is_caffeinated;
2644
-
2645
-
2646
-    /**
2647
-     *    class constructor
2648
-     *
2649
-     * @access    public
2650
-     */
2651
-    public function __construct()
2652
-    {
2653
-        // set default general admin settings
2654
-        $this->useAdvancedEditor = true;
2655
-        $this->use_personnel_manager = true;
2656
-        $this->use_dashboard_widget = true;
2657
-        $this->events_in_dashboard = 30;
2658
-        $this->use_event_timezones = false;
2659
-        $this->use_remote_logging = false;
2660
-        $this->remote_logging_url = null;
2661
-        $this->show_reg_footer = apply_filters(
2662
-            'FHEE__EE_Admin_Config__show_reg_footer__default',
2663
-            false
2664
-        );
2665
-        $this->affiliate_id = 'default';
2666
-        $this->encode_session_data = false;
2667
-    }
2668
-
2669
-
2670
-    /**
2671
-     * @param bool $reset
2672
-     * @return string
2673
-     */
2674
-    public function log_file_name($reset = false)
2675
-    {
2676
-        if (empty($this->log_file_name) || $reset) {
2677
-            $this->log_file_name = sanitize_key('espresso_log_' . md5(uniqid('', true))) . '.txt';
2678
-            EE_Config::instance()->update_espresso_config(false, false);
2679
-        }
2680
-        return $this->log_file_name;
2681
-    }
2682
-
2683
-
2684
-    /**
2685
-     * @param bool $reset
2686
-     * @return string
2687
-     */
2688
-    public function debug_file_name($reset = false)
2689
-    {
2690
-        if (empty($this->debug_file_name) || $reset) {
2691
-            $this->debug_file_name = sanitize_key('espresso_debug_' . md5(uniqid('', true))) . '.txt';
2692
-            EE_Config::instance()->update_espresso_config(false, false);
2693
-        }
2694
-        return $this->debug_file_name;
2695
-    }
2696
-
2697
-
2698
-    /**
2699
-     * @return string
2700
-     */
2701
-    public function affiliate_id()
2702
-    {
2703
-        return ! empty($this->affiliate_id) ? $this->affiliate_id : 'default';
2704
-    }
2705
-
2706
-
2707
-    /**
2708
-     * @return boolean
2709
-     */
2710
-    public function encode_session_data()
2711
-    {
2712
-        return filter_var($this->encode_session_data, FILTER_VALIDATE_BOOLEAN);
2713
-    }
2714
-
2715
-
2716
-    /**
2717
-     * @param boolean $encode_session_data
2718
-     */
2719
-    public function set_encode_session_data($encode_session_data)
2720
-    {
2721
-        $this->encode_session_data = filter_var($encode_session_data, FILTER_VALIDATE_BOOLEAN);
2722
-    }
2723
-
2724
-    /**
2725
-     * @return boolean
2726
-     */
2727
-    public function useAdvancedEditor()
2728
-    {
2729
-        if ($this->is_caffeinated === null) {
2730
-            $domain = LoaderFactory::getLoader()->getShared('EventEspresso\core\domain\Domain');
2731
-            $this->is_caffeinated = $domain->isCaffeinated();
2732
-        }
2733
-        return $this->useAdvancedEditor && $this->is_caffeinated;
2734
-    }
2735
-
2736
-    /**
2737
-     * @param boolean $use_advanced_editor
2738
-     */
2739
-    public function setUseAdvancedEditor($use_advanced_editor = true)
2740
-    {
2741
-        $this->useAdvancedEditor = filter_var(
2742
-            apply_filters(
2743
-                'FHEE__EE_Admin_Config__setUseAdvancedEditor__use_advanced_editor',
2744
-                $use_advanced_editor
2745
-            ),
2746
-            FILTER_VALIDATE_BOOLEAN
2747
-        );
2748
-    }
2575
+	/**
2576
+	 * @var boolean $useAdvancedEditor
2577
+	 */
2578
+	private $useAdvancedEditor;
2579
+
2580
+	/**
2581
+	 * @var boolean $use_personnel_manager
2582
+	 */
2583
+	public $use_personnel_manager;
2584
+
2585
+	/**
2586
+	 * @var boolean $use_dashboard_widget
2587
+	 */
2588
+	public $use_dashboard_widget;
2589
+
2590
+	/**
2591
+	 * @var int $events_in_dashboard
2592
+	 */
2593
+	public $events_in_dashboard;
2594
+
2595
+	/**
2596
+	 * @var boolean $use_event_timezones
2597
+	 */
2598
+	public $use_event_timezones;
2599
+
2600
+	/**
2601
+	 * @var string $log_file_name
2602
+	 */
2603
+	public $log_file_name;
2604
+
2605
+	/**
2606
+	 * @var string $debug_file_name
2607
+	 */
2608
+	public $debug_file_name;
2609
+
2610
+	/**
2611
+	 * @var boolean $use_remote_logging
2612
+	 */
2613
+	public $use_remote_logging;
2614
+
2615
+	/**
2616
+	 * @var string $remote_logging_url
2617
+	 */
2618
+	public $remote_logging_url;
2619
+
2620
+	/**
2621
+	 * @var boolean $show_reg_footer
2622
+	 */
2623
+	public $show_reg_footer;
2624
+
2625
+	/**
2626
+	 * @var string $affiliate_id
2627
+	 */
2628
+	public $affiliate_id;
2629
+
2630
+	/**
2631
+	 * adds extra layer of encoding to session data to prevent serialization errors
2632
+	 * but is incompatible with some server configuration errors
2633
+	 * if you get "500 internal server errors" during registration, try turning this on
2634
+	 * if you get PHP fatal errors regarding base 64 methods not defined, then turn this off
2635
+	 *
2636
+	 * @var boolean $encode_session_data
2637
+	 */
2638
+	private $encode_session_data = false;
2639
+
2640
+	/**
2641
+	 * @var boolean
2642
+	 */
2643
+	private $is_caffeinated;
2644
+
2645
+
2646
+	/**
2647
+	 *    class constructor
2648
+	 *
2649
+	 * @access    public
2650
+	 */
2651
+	public function __construct()
2652
+	{
2653
+		// set default general admin settings
2654
+		$this->useAdvancedEditor = true;
2655
+		$this->use_personnel_manager = true;
2656
+		$this->use_dashboard_widget = true;
2657
+		$this->events_in_dashboard = 30;
2658
+		$this->use_event_timezones = false;
2659
+		$this->use_remote_logging = false;
2660
+		$this->remote_logging_url = null;
2661
+		$this->show_reg_footer = apply_filters(
2662
+			'FHEE__EE_Admin_Config__show_reg_footer__default',
2663
+			false
2664
+		);
2665
+		$this->affiliate_id = 'default';
2666
+		$this->encode_session_data = false;
2667
+	}
2668
+
2669
+
2670
+	/**
2671
+	 * @param bool $reset
2672
+	 * @return string
2673
+	 */
2674
+	public function log_file_name($reset = false)
2675
+	{
2676
+		if (empty($this->log_file_name) || $reset) {
2677
+			$this->log_file_name = sanitize_key('espresso_log_' . md5(uniqid('', true))) . '.txt';
2678
+			EE_Config::instance()->update_espresso_config(false, false);
2679
+		}
2680
+		return $this->log_file_name;
2681
+	}
2682
+
2683
+
2684
+	/**
2685
+	 * @param bool $reset
2686
+	 * @return string
2687
+	 */
2688
+	public function debug_file_name($reset = false)
2689
+	{
2690
+		if (empty($this->debug_file_name) || $reset) {
2691
+			$this->debug_file_name = sanitize_key('espresso_debug_' . md5(uniqid('', true))) . '.txt';
2692
+			EE_Config::instance()->update_espresso_config(false, false);
2693
+		}
2694
+		return $this->debug_file_name;
2695
+	}
2696
+
2697
+
2698
+	/**
2699
+	 * @return string
2700
+	 */
2701
+	public function affiliate_id()
2702
+	{
2703
+		return ! empty($this->affiliate_id) ? $this->affiliate_id : 'default';
2704
+	}
2705
+
2706
+
2707
+	/**
2708
+	 * @return boolean
2709
+	 */
2710
+	public function encode_session_data()
2711
+	{
2712
+		return filter_var($this->encode_session_data, FILTER_VALIDATE_BOOLEAN);
2713
+	}
2714
+
2715
+
2716
+	/**
2717
+	 * @param boolean $encode_session_data
2718
+	 */
2719
+	public function set_encode_session_data($encode_session_data)
2720
+	{
2721
+		$this->encode_session_data = filter_var($encode_session_data, FILTER_VALIDATE_BOOLEAN);
2722
+	}
2723
+
2724
+	/**
2725
+	 * @return boolean
2726
+	 */
2727
+	public function useAdvancedEditor()
2728
+	{
2729
+		if ($this->is_caffeinated === null) {
2730
+			$domain = LoaderFactory::getLoader()->getShared('EventEspresso\core\domain\Domain');
2731
+			$this->is_caffeinated = $domain->isCaffeinated();
2732
+		}
2733
+		return $this->useAdvancedEditor && $this->is_caffeinated;
2734
+	}
2735
+
2736
+	/**
2737
+	 * @param boolean $use_advanced_editor
2738
+	 */
2739
+	public function setUseAdvancedEditor($use_advanced_editor = true)
2740
+	{
2741
+		$this->useAdvancedEditor = filter_var(
2742
+			apply_filters(
2743
+				'FHEE__EE_Admin_Config__setUseAdvancedEditor__use_advanced_editor',
2744
+				$use_advanced_editor
2745
+			),
2746
+			FILTER_VALIDATE_BOOLEAN
2747
+		);
2748
+	}
2749 2749
 }
2750 2750
 
2751 2751
 /**
@@ -2754,70 +2754,70 @@  discard block
 block discarded – undo
2754 2754
 class EE_Template_Config extends EE_Config_Base
2755 2755
 {
2756 2756
 
2757
-    /**
2758
-     * @var boolean $enable_default_style
2759
-     */
2760
-    public $enable_default_style;
2761
-
2762
-    /**
2763
-     * @var string $custom_style_sheet
2764
-     */
2765
-    public $custom_style_sheet;
2766
-
2767
-    /**
2768
-     * @var boolean $display_address_in_regform
2769
-     */
2770
-    public $display_address_in_regform;
2771
-
2772
-    /**
2773
-     * @var int $display_description_on_multi_reg_page
2774
-     */
2775
-    public $display_description_on_multi_reg_page;
2776
-
2777
-    /**
2778
-     * @var boolean $use_custom_templates
2779
-     */
2780
-    public $use_custom_templates;
2781
-
2782
-    /**
2783
-     * @var string $current_espresso_theme
2784
-     */
2785
-    public $current_espresso_theme;
2786
-
2787
-    /**
2788
-     * @var EE_Ticket_Selector_Config $EED_Ticket_Selector
2789
-     */
2790
-    public $EED_Ticket_Selector;
2791
-
2792
-    /**
2793
-     * @var EE_Event_Single_Config $EED_Event_Single
2794
-     */
2795
-    public $EED_Event_Single;
2796
-
2797
-    /**
2798
-     * @var EE_Events_Archive_Config $EED_Events_Archive
2799
-     */
2800
-    public $EED_Events_Archive;
2801
-
2802
-
2803
-    /**
2804
-     *    class constructor
2805
-     *
2806
-     * @access    public
2807
-     */
2808
-    public function __construct()
2809
-    {
2810
-        // set default template settings
2811
-        $this->enable_default_style = true;
2812
-        $this->custom_style_sheet = null;
2813
-        $this->display_address_in_regform = true;
2814
-        $this->display_description_on_multi_reg_page = false;
2815
-        $this->use_custom_templates = false;
2816
-        $this->current_espresso_theme = 'Espresso_Arabica_2014';
2817
-        $this->EED_Event_Single = null;
2818
-        $this->EED_Events_Archive = null;
2819
-        $this->EED_Ticket_Selector = null;
2820
-    }
2757
+	/**
2758
+	 * @var boolean $enable_default_style
2759
+	 */
2760
+	public $enable_default_style;
2761
+
2762
+	/**
2763
+	 * @var string $custom_style_sheet
2764
+	 */
2765
+	public $custom_style_sheet;
2766
+
2767
+	/**
2768
+	 * @var boolean $display_address_in_regform
2769
+	 */
2770
+	public $display_address_in_regform;
2771
+
2772
+	/**
2773
+	 * @var int $display_description_on_multi_reg_page
2774
+	 */
2775
+	public $display_description_on_multi_reg_page;
2776
+
2777
+	/**
2778
+	 * @var boolean $use_custom_templates
2779
+	 */
2780
+	public $use_custom_templates;
2781
+
2782
+	/**
2783
+	 * @var string $current_espresso_theme
2784
+	 */
2785
+	public $current_espresso_theme;
2786
+
2787
+	/**
2788
+	 * @var EE_Ticket_Selector_Config $EED_Ticket_Selector
2789
+	 */
2790
+	public $EED_Ticket_Selector;
2791
+
2792
+	/**
2793
+	 * @var EE_Event_Single_Config $EED_Event_Single
2794
+	 */
2795
+	public $EED_Event_Single;
2796
+
2797
+	/**
2798
+	 * @var EE_Events_Archive_Config $EED_Events_Archive
2799
+	 */
2800
+	public $EED_Events_Archive;
2801
+
2802
+
2803
+	/**
2804
+	 *    class constructor
2805
+	 *
2806
+	 * @access    public
2807
+	 */
2808
+	public function __construct()
2809
+	{
2810
+		// set default template settings
2811
+		$this->enable_default_style = true;
2812
+		$this->custom_style_sheet = null;
2813
+		$this->display_address_in_regform = true;
2814
+		$this->display_description_on_multi_reg_page = false;
2815
+		$this->use_custom_templates = false;
2816
+		$this->current_espresso_theme = 'Espresso_Arabica_2014';
2817
+		$this->EED_Event_Single = null;
2818
+		$this->EED_Events_Archive = null;
2819
+		$this->EED_Ticket_Selector = null;
2820
+	}
2821 2821
 }
2822 2822
 
2823 2823
 /**
@@ -2826,114 +2826,114 @@  discard block
 block discarded – undo
2826 2826
 class EE_Map_Config extends EE_Config_Base
2827 2827
 {
2828 2828
 
2829
-    /**
2830
-     * @var boolean $use_google_maps
2831
-     */
2832
-    public $use_google_maps;
2833
-
2834
-    /**
2835
-     * @var string $api_key
2836
-     */
2837
-    public $google_map_api_key;
2838
-
2839
-    /**
2840
-     * @var int $event_details_map_width
2841
-     */
2842
-    public $event_details_map_width;
2843
-
2844
-    /**
2845
-     * @var int $event_details_map_height
2846
-     */
2847
-    public $event_details_map_height;
2848
-
2849
-    /**
2850
-     * @var int $event_details_map_zoom
2851
-     */
2852
-    public $event_details_map_zoom;
2853
-
2854
-    /**
2855
-     * @var boolean $event_details_display_nav
2856
-     */
2857
-    public $event_details_display_nav;
2858
-
2859
-    /**
2860
-     * @var boolean $event_details_nav_size
2861
-     */
2862
-    public $event_details_nav_size;
2863
-
2864
-    /**
2865
-     * @var string $event_details_control_type
2866
-     */
2867
-    public $event_details_control_type;
2868
-
2869
-    /**
2870
-     * @var string $event_details_map_align
2871
-     */
2872
-    public $event_details_map_align;
2873
-
2874
-    /**
2875
-     * @var int $event_list_map_width
2876
-     */
2877
-    public $event_list_map_width;
2878
-
2879
-    /**
2880
-     * @var int $event_list_map_height
2881
-     */
2882
-    public $event_list_map_height;
2883
-
2884
-    /**
2885
-     * @var int $event_list_map_zoom
2886
-     */
2887
-    public $event_list_map_zoom;
2888
-
2889
-    /**
2890
-     * @var boolean $event_list_display_nav
2891
-     */
2892
-    public $event_list_display_nav;
2893
-
2894
-    /**
2895
-     * @var boolean $event_list_nav_size
2896
-     */
2897
-    public $event_list_nav_size;
2898
-
2899
-    /**
2900
-     * @var string $event_list_control_type
2901
-     */
2902
-    public $event_list_control_type;
2903
-
2904
-    /**
2905
-     * @var string $event_list_map_align
2906
-     */
2907
-    public $event_list_map_align;
2908
-
2909
-
2910
-    /**
2911
-     *    class constructor
2912
-     *
2913
-     * @access    public
2914
-     */
2915
-    public function __construct()
2916
-    {
2917
-        // set default map settings
2918
-        $this->use_google_maps = true;
2919
-        $this->google_map_api_key = '';
2920
-        // for event details pages (reg page)
2921
-        $this->event_details_map_width = 585;            // ee_map_width_single
2922
-        $this->event_details_map_height = 362;            // ee_map_height_single
2923
-        $this->event_details_map_zoom = 14;            // ee_map_zoom_single
2924
-        $this->event_details_display_nav = true;            // ee_map_nav_display_single
2925
-        $this->event_details_nav_size = false;            // ee_map_nav_size_single
2926
-        $this->event_details_control_type = 'default';        // ee_map_type_control_single
2927
-        $this->event_details_map_align = 'center';            // ee_map_align_single
2928
-        // for event list pages
2929
-        $this->event_list_map_width = 300;            // ee_map_width
2930
-        $this->event_list_map_height = 185;        // ee_map_height
2931
-        $this->event_list_map_zoom = 12;            // ee_map_zoom
2932
-        $this->event_list_display_nav = false;        // ee_map_nav_display
2933
-        $this->event_list_nav_size = true;            // ee_map_nav_size
2934
-        $this->event_list_control_type = 'dropdown';        // ee_map_type_control
2935
-        $this->event_list_map_align = 'center';            // ee_map_align
2936
-    }
2829
+	/**
2830
+	 * @var boolean $use_google_maps
2831
+	 */
2832
+	public $use_google_maps;
2833
+
2834
+	/**
2835
+	 * @var string $api_key
2836
+	 */
2837
+	public $google_map_api_key;
2838
+
2839
+	/**
2840
+	 * @var int $event_details_map_width
2841
+	 */
2842
+	public $event_details_map_width;
2843
+
2844
+	/**
2845
+	 * @var int $event_details_map_height
2846
+	 */
2847
+	public $event_details_map_height;
2848
+
2849
+	/**
2850
+	 * @var int $event_details_map_zoom
2851
+	 */
2852
+	public $event_details_map_zoom;
2853
+
2854
+	/**
2855
+	 * @var boolean $event_details_display_nav
2856
+	 */
2857
+	public $event_details_display_nav;
2858
+
2859
+	/**
2860
+	 * @var boolean $event_details_nav_size
2861
+	 */
2862
+	public $event_details_nav_size;
2863
+
2864
+	/**
2865
+	 * @var string $event_details_control_type
2866
+	 */
2867
+	public $event_details_control_type;
2868
+
2869
+	/**
2870
+	 * @var string $event_details_map_align
2871
+	 */
2872
+	public $event_details_map_align;
2873
+
2874
+	/**
2875
+	 * @var int $event_list_map_width
2876
+	 */
2877
+	public $event_list_map_width;
2878
+
2879
+	/**
2880
+	 * @var int $event_list_map_height
2881
+	 */
2882
+	public $event_list_map_height;
2883
+
2884
+	/**
2885
+	 * @var int $event_list_map_zoom
2886
+	 */
2887
+	public $event_list_map_zoom;
2888
+
2889
+	/**
2890
+	 * @var boolean $event_list_display_nav
2891
+	 */
2892
+	public $event_list_display_nav;
2893
+
2894
+	/**
2895
+	 * @var boolean $event_list_nav_size
2896
+	 */
2897
+	public $event_list_nav_size;
2898
+
2899
+	/**
2900
+	 * @var string $event_list_control_type
2901
+	 */
2902
+	public $event_list_control_type;
2903
+
2904
+	/**
2905
+	 * @var string $event_list_map_align
2906
+	 */
2907
+	public $event_list_map_align;
2908
+
2909
+
2910
+	/**
2911
+	 *    class constructor
2912
+	 *
2913
+	 * @access    public
2914
+	 */
2915
+	public function __construct()
2916
+	{
2917
+		// set default map settings
2918
+		$this->use_google_maps = true;
2919
+		$this->google_map_api_key = '';
2920
+		// for event details pages (reg page)
2921
+		$this->event_details_map_width = 585;            // ee_map_width_single
2922
+		$this->event_details_map_height = 362;            // ee_map_height_single
2923
+		$this->event_details_map_zoom = 14;            // ee_map_zoom_single
2924
+		$this->event_details_display_nav = true;            // ee_map_nav_display_single
2925
+		$this->event_details_nav_size = false;            // ee_map_nav_size_single
2926
+		$this->event_details_control_type = 'default';        // ee_map_type_control_single
2927
+		$this->event_details_map_align = 'center';            // ee_map_align_single
2928
+		// for event list pages
2929
+		$this->event_list_map_width = 300;            // ee_map_width
2930
+		$this->event_list_map_height = 185;        // ee_map_height
2931
+		$this->event_list_map_zoom = 12;            // ee_map_zoom
2932
+		$this->event_list_display_nav = false;        // ee_map_nav_display
2933
+		$this->event_list_nav_size = true;            // ee_map_nav_size
2934
+		$this->event_list_control_type = 'dropdown';        // ee_map_type_control
2935
+		$this->event_list_map_align = 'center';            // ee_map_align
2936
+	}
2937 2937
 }
2938 2938
 
2939 2939
 /**
@@ -2942,46 +2942,46 @@  discard block
 block discarded – undo
2942 2942
 class EE_Events_Archive_Config extends EE_Config_Base
2943 2943
 {
2944 2944
 
2945
-    public $display_status_banner;
2945
+	public $display_status_banner;
2946 2946
 
2947
-    public $display_description;
2947
+	public $display_description;
2948 2948
 
2949
-    public $display_ticket_selector;
2949
+	public $display_ticket_selector;
2950 2950
 
2951
-    public $display_datetimes;
2951
+	public $display_datetimes;
2952 2952
 
2953
-    public $display_venue;
2953
+	public $display_venue;
2954 2954
 
2955
-    public $display_expired_events;
2955
+	public $display_expired_events;
2956 2956
 
2957
-    public $use_sortable_display_order;
2957
+	public $use_sortable_display_order;
2958 2958
 
2959
-    public $display_order_tickets;
2959
+	public $display_order_tickets;
2960 2960
 
2961
-    public $display_order_datetimes;
2961
+	public $display_order_datetimes;
2962 2962
 
2963
-    public $display_order_event;
2963
+	public $display_order_event;
2964 2964
 
2965
-    public $display_order_venue;
2965
+	public $display_order_venue;
2966 2966
 
2967 2967
 
2968
-    /**
2969
-     *    class constructor
2970
-     */
2971
-    public function __construct()
2972
-    {
2973
-        $this->display_status_banner = 0;
2974
-        $this->display_description = 1;
2975
-        $this->display_ticket_selector = 0;
2976
-        $this->display_datetimes = 1;
2977
-        $this->display_venue = 0;
2978
-        $this->display_expired_events = 0;
2979
-        $this->use_sortable_display_order = false;
2980
-        $this->display_order_tickets = 100;
2981
-        $this->display_order_datetimes = 110;
2982
-        $this->display_order_event = 120;
2983
-        $this->display_order_venue = 130;
2984
-    }
2968
+	/**
2969
+	 *    class constructor
2970
+	 */
2971
+	public function __construct()
2972
+	{
2973
+		$this->display_status_banner = 0;
2974
+		$this->display_description = 1;
2975
+		$this->display_ticket_selector = 0;
2976
+		$this->display_datetimes = 1;
2977
+		$this->display_venue = 0;
2978
+		$this->display_expired_events = 0;
2979
+		$this->use_sortable_display_order = false;
2980
+		$this->display_order_tickets = 100;
2981
+		$this->display_order_datetimes = 110;
2982
+		$this->display_order_event = 120;
2983
+		$this->display_order_venue = 130;
2984
+	}
2985 2985
 }
2986 2986
 
2987 2987
 /**
@@ -2990,34 +2990,34 @@  discard block
 block discarded – undo
2990 2990
 class EE_Event_Single_Config extends EE_Config_Base
2991 2991
 {
2992 2992
 
2993
-    public $display_status_banner_single;
2993
+	public $display_status_banner_single;
2994 2994
 
2995
-    public $display_venue;
2995
+	public $display_venue;
2996 2996
 
2997
-    public $use_sortable_display_order;
2997
+	public $use_sortable_display_order;
2998 2998
 
2999
-    public $display_order_tickets;
2999
+	public $display_order_tickets;
3000 3000
 
3001
-    public $display_order_datetimes;
3001
+	public $display_order_datetimes;
3002 3002
 
3003
-    public $display_order_event;
3003
+	public $display_order_event;
3004 3004
 
3005
-    public $display_order_venue;
3005
+	public $display_order_venue;
3006 3006
 
3007 3007
 
3008
-    /**
3009
-     *    class constructor
3010
-     */
3011
-    public function __construct()
3012
-    {
3013
-        $this->display_status_banner_single = 0;
3014
-        $this->display_venue = 1;
3015
-        $this->use_sortable_display_order = false;
3016
-        $this->display_order_tickets = 100;
3017
-        $this->display_order_datetimes = 110;
3018
-        $this->display_order_event = 120;
3019
-        $this->display_order_venue = 130;
3020
-    }
3008
+	/**
3009
+	 *    class constructor
3010
+	 */
3011
+	public function __construct()
3012
+	{
3013
+		$this->display_status_banner_single = 0;
3014
+		$this->display_venue = 1;
3015
+		$this->use_sortable_display_order = false;
3016
+		$this->display_order_tickets = 100;
3017
+		$this->display_order_datetimes = 110;
3018
+		$this->display_order_event = 120;
3019
+		$this->display_order_venue = 130;
3020
+	}
3021 3021
 }
3022 3022
 
3023 3023
 /**
@@ -3026,172 +3026,172 @@  discard block
 block discarded – undo
3026 3026
 class EE_Ticket_Selector_Config extends EE_Config_Base
3027 3027
 {
3028 3028
 
3029
-    /**
3030
-     * constant to indicate that a datetime selector should NEVER be shown for ticket selectors
3031
-     */
3032
-    const DO_NOT_SHOW_DATETIME_SELECTOR = 'no_datetime_selector';
3033
-
3034
-    /**
3035
-     * constant to indicate that a datetime selector should only be shown for ticket selectors
3036
-     * when the number of datetimes for the event matches the value set for $datetime_selector_threshold
3037
-     */
3038
-    const MAYBE_SHOW_DATETIME_SELECTOR = 'maybe_datetime_selector';
3039
-
3040
-    /**
3041
-     * @var boolean $show_ticket_sale_columns
3042
-     */
3043
-    public $show_ticket_sale_columns;
3044
-
3045
-    /**
3046
-     * @var boolean $show_ticket_details
3047
-     */
3048
-    public $show_ticket_details;
3049
-
3050
-    /**
3051
-     * @var boolean $show_expired_tickets
3052
-     */
3053
-    public $show_expired_tickets;
3054
-
3055
-    /**
3056
-     * whether or not to display a dropdown box populated with event datetimes
3057
-     * that toggles which tickets are displayed for a ticket selector.
3058
-     * uses one of the *_DATETIME_SELECTOR constants defined above
3059
-     *
3060
-     * @var string $show_datetime_selector
3061
-     */
3062
-    private $show_datetime_selector = 'no_datetime_selector';
3063
-
3064
-    /**
3065
-     * the number of datetimes an event has to have before conditionally displaying a datetime selector
3066
-     *
3067
-     * @var int $datetime_selector_threshold
3068
-     */
3069
-    private $datetime_selector_threshold = 3;
3070
-
3071
-    /**
3072
-     * determines the maximum number of "checked" dates in the date and time filter
3073
-     *
3074
-     * @var int $datetime_selector_checked
3075
-     */
3076
-    private $datetime_selector_max_checked = 10;
3077
-
3078
-
3079
-    /**
3080
-     *    class constructor
3081
-     */
3082
-    public function __construct()
3083
-    {
3084
-        $this->show_ticket_sale_columns = true;
3085
-        $this->show_ticket_details = true;
3086
-        $this->show_expired_tickets = true;
3087
-        $this->show_datetime_selector = EE_Ticket_Selector_Config::DO_NOT_SHOW_DATETIME_SELECTOR;
3088
-        $this->datetime_selector_threshold = 3;
3089
-        $this->datetime_selector_max_checked = 10;
3090
-    }
3091
-
3092
-
3093
-    /**
3094
-     * returns true if a datetime selector should be displayed
3095
-     *
3096
-     * @param array $datetimes
3097
-     * @return bool
3098
-     */
3099
-    public function showDatetimeSelector(array $datetimes)
3100
-    {
3101
-        // if the settings are NOT: don't show OR below threshold, THEN active = true
3102
-        return ! (
3103
-            $this->getShowDatetimeSelector() === EE_Ticket_Selector_Config::DO_NOT_SHOW_DATETIME_SELECTOR
3104
-            || (
3105
-                $this->getShowDatetimeSelector() === EE_Ticket_Selector_Config::MAYBE_SHOW_DATETIME_SELECTOR
3106
-                && count($datetimes) < $this->getDatetimeSelectorThreshold()
3107
-            )
3108
-        );
3109
-    }
3110
-
3111
-
3112
-    /**
3113
-     * @return string
3114
-     */
3115
-    public function getShowDatetimeSelector()
3116
-    {
3117
-        return $this->show_datetime_selector;
3118
-    }
3119
-
3120
-
3121
-    /**
3122
-     * @param bool $keys_only
3123
-     * @return array
3124
-     */
3125
-    public function getShowDatetimeSelectorOptions($keys_only = true)
3126
-    {
3127
-        return $keys_only
3128
-            ? array(
3129
-                EE_Ticket_Selector_Config::DO_NOT_SHOW_DATETIME_SELECTOR,
3130
-                EE_Ticket_Selector_Config::MAYBE_SHOW_DATETIME_SELECTOR,
3131
-            )
3132
-            : array(
3133
-                EE_Ticket_Selector_Config::DO_NOT_SHOW_DATETIME_SELECTOR => esc_html__(
3134
-                    'Do not show date & time filter',
3135
-                    'event_espresso'
3136
-                ),
3137
-                EE_Ticket_Selector_Config::MAYBE_SHOW_DATETIME_SELECTOR  => esc_html__(
3138
-                    'Maybe show date & time filter',
3139
-                    'event_espresso'
3140
-                ),
3141
-            );
3142
-    }
3143
-
3144
-
3145
-    /**
3146
-     * @param string $show_datetime_selector
3147
-     */
3148
-    public function setShowDatetimeSelector($show_datetime_selector)
3149
-    {
3150
-        $this->show_datetime_selector = in_array(
3151
-            $show_datetime_selector,
3152
-            $this->getShowDatetimeSelectorOptions(),
3153
-            true
3154
-        )
3155
-            ? $show_datetime_selector
3156
-            : EE_Ticket_Selector_Config::DO_NOT_SHOW_DATETIME_SELECTOR;
3157
-    }
3158
-
3159
-
3160
-    /**
3161
-     * @return int
3162
-     */
3163
-    public function getDatetimeSelectorThreshold()
3164
-    {
3165
-        return $this->datetime_selector_threshold;
3166
-    }
3167
-
3168
-
3169
-    /**
3170
-     * @param int $datetime_selector_threshold
3171
-     */
3172
-    public function setDatetimeSelectorThreshold($datetime_selector_threshold)
3173
-    {
3174
-        $datetime_selector_threshold = absint($datetime_selector_threshold);
3175
-        $this->datetime_selector_threshold = $datetime_selector_threshold ? $datetime_selector_threshold : 3;
3176
-    }
3177
-
3178
-
3179
-    /**
3180
-     * @return int
3181
-     */
3182
-    public function getDatetimeSelectorMaxChecked()
3183
-    {
3184
-        return $this->datetime_selector_max_checked;
3185
-    }
3186
-
3187
-
3188
-    /**
3189
-     * @param int $datetime_selector_max_checked
3190
-     */
3191
-    public function setDatetimeSelectorMaxChecked($datetime_selector_max_checked)
3192
-    {
3193
-        $this->datetime_selector_max_checked = absint($datetime_selector_max_checked);
3194
-    }
3029
+	/**
3030
+	 * constant to indicate that a datetime selector should NEVER be shown for ticket selectors
3031
+	 */
3032
+	const DO_NOT_SHOW_DATETIME_SELECTOR = 'no_datetime_selector';
3033
+
3034
+	/**
3035
+	 * constant to indicate that a datetime selector should only be shown for ticket selectors
3036
+	 * when the number of datetimes for the event matches the value set for $datetime_selector_threshold
3037
+	 */
3038
+	const MAYBE_SHOW_DATETIME_SELECTOR = 'maybe_datetime_selector';
3039
+
3040
+	/**
3041
+	 * @var boolean $show_ticket_sale_columns
3042
+	 */
3043
+	public $show_ticket_sale_columns;
3044
+
3045
+	/**
3046
+	 * @var boolean $show_ticket_details
3047
+	 */
3048
+	public $show_ticket_details;
3049
+
3050
+	/**
3051
+	 * @var boolean $show_expired_tickets
3052
+	 */
3053
+	public $show_expired_tickets;
3054
+
3055
+	/**
3056
+	 * whether or not to display a dropdown box populated with event datetimes
3057
+	 * that toggles which tickets are displayed for a ticket selector.
3058
+	 * uses one of the *_DATETIME_SELECTOR constants defined above
3059
+	 *
3060
+	 * @var string $show_datetime_selector
3061
+	 */
3062
+	private $show_datetime_selector = 'no_datetime_selector';
3063
+
3064
+	/**
3065
+	 * the number of datetimes an event has to have before conditionally displaying a datetime selector
3066
+	 *
3067
+	 * @var int $datetime_selector_threshold
3068
+	 */
3069
+	private $datetime_selector_threshold = 3;
3070
+
3071
+	/**
3072
+	 * determines the maximum number of "checked" dates in the date and time filter
3073
+	 *
3074
+	 * @var int $datetime_selector_checked
3075
+	 */
3076
+	private $datetime_selector_max_checked = 10;
3077
+
3078
+
3079
+	/**
3080
+	 *    class constructor
3081
+	 */
3082
+	public function __construct()
3083
+	{
3084
+		$this->show_ticket_sale_columns = true;
3085
+		$this->show_ticket_details = true;
3086
+		$this->show_expired_tickets = true;
3087
+		$this->show_datetime_selector = EE_Ticket_Selector_Config::DO_NOT_SHOW_DATETIME_SELECTOR;
3088
+		$this->datetime_selector_threshold = 3;
3089
+		$this->datetime_selector_max_checked = 10;
3090
+	}
3091
+
3092
+
3093
+	/**
3094
+	 * returns true if a datetime selector should be displayed
3095
+	 *
3096
+	 * @param array $datetimes
3097
+	 * @return bool
3098
+	 */
3099
+	public function showDatetimeSelector(array $datetimes)
3100
+	{
3101
+		// if the settings are NOT: don't show OR below threshold, THEN active = true
3102
+		return ! (
3103
+			$this->getShowDatetimeSelector() === EE_Ticket_Selector_Config::DO_NOT_SHOW_DATETIME_SELECTOR
3104
+			|| (
3105
+				$this->getShowDatetimeSelector() === EE_Ticket_Selector_Config::MAYBE_SHOW_DATETIME_SELECTOR
3106
+				&& count($datetimes) < $this->getDatetimeSelectorThreshold()
3107
+			)
3108
+		);
3109
+	}
3110
+
3111
+
3112
+	/**
3113
+	 * @return string
3114
+	 */
3115
+	public function getShowDatetimeSelector()
3116
+	{
3117
+		return $this->show_datetime_selector;
3118
+	}
3119
+
3120
+
3121
+	/**
3122
+	 * @param bool $keys_only
3123
+	 * @return array
3124
+	 */
3125
+	public function getShowDatetimeSelectorOptions($keys_only = true)
3126
+	{
3127
+		return $keys_only
3128
+			? array(
3129
+				EE_Ticket_Selector_Config::DO_NOT_SHOW_DATETIME_SELECTOR,
3130
+				EE_Ticket_Selector_Config::MAYBE_SHOW_DATETIME_SELECTOR,
3131
+			)
3132
+			: array(
3133
+				EE_Ticket_Selector_Config::DO_NOT_SHOW_DATETIME_SELECTOR => esc_html__(
3134
+					'Do not show date & time filter',
3135
+					'event_espresso'
3136
+				),
3137
+				EE_Ticket_Selector_Config::MAYBE_SHOW_DATETIME_SELECTOR  => esc_html__(
3138
+					'Maybe show date & time filter',
3139
+					'event_espresso'
3140
+				),
3141
+			);
3142
+	}
3143
+
3144
+
3145
+	/**
3146
+	 * @param string $show_datetime_selector
3147
+	 */
3148
+	public function setShowDatetimeSelector($show_datetime_selector)
3149
+	{
3150
+		$this->show_datetime_selector = in_array(
3151
+			$show_datetime_selector,
3152
+			$this->getShowDatetimeSelectorOptions(),
3153
+			true
3154
+		)
3155
+			? $show_datetime_selector
3156
+			: EE_Ticket_Selector_Config::DO_NOT_SHOW_DATETIME_SELECTOR;
3157
+	}
3158
+
3159
+
3160
+	/**
3161
+	 * @return int
3162
+	 */
3163
+	public function getDatetimeSelectorThreshold()
3164
+	{
3165
+		return $this->datetime_selector_threshold;
3166
+	}
3167
+
3168
+
3169
+	/**
3170
+	 * @param int $datetime_selector_threshold
3171
+	 */
3172
+	public function setDatetimeSelectorThreshold($datetime_selector_threshold)
3173
+	{
3174
+		$datetime_selector_threshold = absint($datetime_selector_threshold);
3175
+		$this->datetime_selector_threshold = $datetime_selector_threshold ? $datetime_selector_threshold : 3;
3176
+	}
3177
+
3178
+
3179
+	/**
3180
+	 * @return int
3181
+	 */
3182
+	public function getDatetimeSelectorMaxChecked()
3183
+	{
3184
+		return $this->datetime_selector_max_checked;
3185
+	}
3186
+
3187
+
3188
+	/**
3189
+	 * @param int $datetime_selector_max_checked
3190
+	 */
3191
+	public function setDatetimeSelectorMaxChecked($datetime_selector_max_checked)
3192
+	{
3193
+		$this->datetime_selector_max_checked = absint($datetime_selector_max_checked);
3194
+	}
3195 3195
 }
3196 3196
 
3197 3197
 /**
@@ -3204,87 +3204,87 @@  discard block
 block discarded – undo
3204 3204
 class EE_Environment_Config extends EE_Config_Base
3205 3205
 {
3206 3206
 
3207
-    /**
3208
-     * Hold any php environment variables that we want to track.
3209
-     *
3210
-     * @var stdClass;
3211
-     */
3212
-    public $php;
3213
-
3214
-
3215
-    /**
3216
-     *    constructor
3217
-     */
3218
-    public function __construct()
3219
-    {
3220
-        $this->php = new stdClass();
3221
-        $this->_set_php_values();
3222
-    }
3223
-
3224
-
3225
-    /**
3226
-     * This sets the php environment variables.
3227
-     *
3228
-     * @since 4.4.0
3229
-     * @return void
3230
-     */
3231
-    protected function _set_php_values()
3232
-    {
3233
-        $this->php->max_input_vars = ini_get('max_input_vars');
3234
-        $this->php->version = phpversion();
3235
-    }
3236
-
3237
-
3238
-    /**
3239
-     * helper method for determining whether input_count is
3240
-     * reaching the potential maximum the server can handle
3241
-     * according to max_input_vars
3242
-     *
3243
-     * @param int   $input_count the count of input vars.
3244
-     * @return array {
3245
-     *                           An array that represents whether available space and if no available space the error
3246
-     *                           message.
3247
-     * @type bool   $has_space   whether more inputs can be added.
3248
-     * @type string $msg         Any message to be displayed.
3249
-     *                           }
3250
-     */
3251
-    public function max_input_vars_limit_check($input_count = 0)
3252
-    {
3253
-        if (
3254
-            ! empty($this->php->max_input_vars)
3255
-            && ($input_count >= $this->php->max_input_vars)
3256
-        ) {
3257
-            // check the server setting because the config value could be stale
3258
-            $max_input_vars = ini_get('max_input_vars');
3259
-            if ($input_count >= $max_input_vars) {
3260
-                return sprintf(
3261
-                    esc_html__(
3262
-                        'The maximum number of inputs on this page has been exceeded. You cannot make edits to this page because of your server\'s PHP "max_input_vars" setting.%1$sThere are %2$d inputs and the maximum amount currently allowed by your server is %3$d.%1$sPlease contact your web host and ask them to raise the "max_input_vars" limit.',
3263
-                        'event_espresso'
3264
-                    ),
3265
-                    '<br>',
3266
-                    $input_count,
3267
-                    $max_input_vars
3268
-                );
3269
-            } else {
3270
-                return '';
3271
-            }
3272
-        } else {
3273
-            return '';
3274
-        }
3275
-    }
3276
-
3277
-
3278
-    /**
3279
-     * The purpose of this method is just to force rechecking php values so if they've changed, they get updated.
3280
-     *
3281
-     * @since 4.4.1
3282
-     * @return void
3283
-     */
3284
-    public function recheck_values()
3285
-    {
3286
-        $this->_set_php_values();
3287
-    }
3207
+	/**
3208
+	 * Hold any php environment variables that we want to track.
3209
+	 *
3210
+	 * @var stdClass;
3211
+	 */
3212
+	public $php;
3213
+
3214
+
3215
+	/**
3216
+	 *    constructor
3217
+	 */
3218
+	public function __construct()
3219
+	{
3220
+		$this->php = new stdClass();
3221
+		$this->_set_php_values();
3222
+	}
3223
+
3224
+
3225
+	/**
3226
+	 * This sets the php environment variables.
3227
+	 *
3228
+	 * @since 4.4.0
3229
+	 * @return void
3230
+	 */
3231
+	protected function _set_php_values()
3232
+	{
3233
+		$this->php->max_input_vars = ini_get('max_input_vars');
3234
+		$this->php->version = phpversion();
3235
+	}
3236
+
3237
+
3238
+	/**
3239
+	 * helper method for determining whether input_count is
3240
+	 * reaching the potential maximum the server can handle
3241
+	 * according to max_input_vars
3242
+	 *
3243
+	 * @param int   $input_count the count of input vars.
3244
+	 * @return array {
3245
+	 *                           An array that represents whether available space and if no available space the error
3246
+	 *                           message.
3247
+	 * @type bool   $has_space   whether more inputs can be added.
3248
+	 * @type string $msg         Any message to be displayed.
3249
+	 *                           }
3250
+	 */
3251
+	public function max_input_vars_limit_check($input_count = 0)
3252
+	{
3253
+		if (
3254
+			! empty($this->php->max_input_vars)
3255
+			&& ($input_count >= $this->php->max_input_vars)
3256
+		) {
3257
+			// check the server setting because the config value could be stale
3258
+			$max_input_vars = ini_get('max_input_vars');
3259
+			if ($input_count >= $max_input_vars) {
3260
+				return sprintf(
3261
+					esc_html__(
3262
+						'The maximum number of inputs on this page has been exceeded. You cannot make edits to this page because of your server\'s PHP "max_input_vars" setting.%1$sThere are %2$d inputs and the maximum amount currently allowed by your server is %3$d.%1$sPlease contact your web host and ask them to raise the "max_input_vars" limit.',
3263
+						'event_espresso'
3264
+					),
3265
+					'<br>',
3266
+					$input_count,
3267
+					$max_input_vars
3268
+				);
3269
+			} else {
3270
+				return '';
3271
+			}
3272
+		} else {
3273
+			return '';
3274
+		}
3275
+	}
3276
+
3277
+
3278
+	/**
3279
+	 * The purpose of this method is just to force rechecking php values so if they've changed, they get updated.
3280
+	 *
3281
+	 * @since 4.4.1
3282
+	 * @return void
3283
+	 */
3284
+	public function recheck_values()
3285
+	{
3286
+		$this->_set_php_values();
3287
+	}
3288 3288
 }
3289 3289
 
3290 3290
 /**
@@ -3297,21 +3297,21 @@  discard block
 block discarded – undo
3297 3297
 class EE_Tax_Config extends EE_Config_Base
3298 3298
 {
3299 3299
 
3300
-    /*
3300
+	/*
3301 3301
      * flag to indicate whether or not to display ticket prices with the taxes included
3302 3302
      *
3303 3303
      * @var boolean $prices_displayed_including_taxes
3304 3304
      */
3305
-    public $prices_displayed_including_taxes;
3305
+	public $prices_displayed_including_taxes;
3306 3306
 
3307 3307
 
3308
-    /**
3309
-     *    class constructor
3310
-     */
3311
-    public function __construct()
3312
-    {
3313
-        $this->prices_displayed_including_taxes = true;
3314
-    }
3308
+	/**
3309
+	 *    class constructor
3310
+	 */
3311
+	public function __construct()
3312
+	{
3313
+		$this->prices_displayed_including_taxes = true;
3314
+	}
3315 3315
 }
3316 3316
 
3317 3317
 /**
@@ -3325,19 +3325,19 @@  discard block
 block discarded – undo
3325 3325
 class EE_Messages_Config extends EE_Config_Base
3326 3326
 {
3327 3327
 
3328
-    /**
3329
-     * This is an integer representing the deletion threshold in months for when old messages will get deleted.
3330
-     * A value of 0 represents never deleting.  Default is 0.
3331
-     *
3332
-     * @var integer
3333
-     */
3334
-    public $delete_threshold;
3328
+	/**
3329
+	 * This is an integer representing the deletion threshold in months for when old messages will get deleted.
3330
+	 * A value of 0 represents never deleting.  Default is 0.
3331
+	 *
3332
+	 * @var integer
3333
+	 */
3334
+	public $delete_threshold;
3335 3335
 
3336 3336
 
3337
-    public function __construct()
3338
-    {
3339
-        $this->delete_threshold = 0;
3340
-    }
3337
+	public function __construct()
3338
+	{
3339
+		$this->delete_threshold = 0;
3340
+	}
3341 3341
 }
3342 3342
 
3343 3343
 /**
@@ -3348,31 +3348,31 @@  discard block
 block discarded – undo
3348 3348
 class EE_Gateway_Config extends EE_Config_Base
3349 3349
 {
3350 3350
 
3351
-    /**
3352
-     * Array with keys that are payment gateways slugs, and values are arrays
3353
-     * with any config info the gateway wants to store
3354
-     *
3355
-     * @var array
3356
-     */
3357
-    public $payment_settings;
3358
-
3359
-    /**
3360
-     * Where keys are gateway slugs, and values are booleans indicating whether or not
3361
-     * the gateway is stored in the uploads directory
3362
-     *
3363
-     * @var array
3364
-     */
3365
-    public $active_gateways;
3366
-
3367
-
3368
-    /**
3369
-     *    class constructor
3370
-     *
3371
-     * @deprecated
3372
-     */
3373
-    public function __construct()
3374
-    {
3375
-        $this->payment_settings = array();
3376
-        $this->active_gateways = array('Invoice' => false);
3377
-    }
3351
+	/**
3352
+	 * Array with keys that are payment gateways slugs, and values are arrays
3353
+	 * with any config info the gateway wants to store
3354
+	 *
3355
+	 * @var array
3356
+	 */
3357
+	public $payment_settings;
3358
+
3359
+	/**
3360
+	 * Where keys are gateway slugs, and values are booleans indicating whether or not
3361
+	 * the gateway is stored in the uploads directory
3362
+	 *
3363
+	 * @var array
3364
+	 */
3365
+	public $active_gateways;
3366
+
3367
+
3368
+	/**
3369
+	 *    class constructor
3370
+	 *
3371
+	 * @deprecated
3372
+	 */
3373
+	public function __construct()
3374
+	{
3375
+		$this->payment_settings = array();
3376
+		$this->active_gateways = array('Invoice' => false);
3377
+	}
3378 3378
 }
Please login to merge, or discard this patch.
Spacing   +118 added lines, -118 removed lines patch added patch discarded remove patch
@@ -151,9 +151,9 @@  discard block
 block discarded – undo
151 151
     {
152 152
         static $initialized = false;
153 153
         // check if class object is instantiated, and instantiated properly
154
-        if (! self::$_instance instanceof EE_Config) {
154
+        if ( ! self::$_instance instanceof EE_Config) {
155 155
             self::$_instance = new self();
156
-            if (! $initialized) {
156
+            if ( ! $initialized) {
157 157
                 self::$_instance->initialize();
158 158
                 $initialized = true;
159 159
             }
@@ -293,7 +293,7 @@  discard block
 block discarded – undo
293 293
                 $this
294 294
             );
295 295
             if (is_object($settings) && property_exists($this, $config)) {
296
-                $this->{$config} = apply_filters('FHEE__EE_Config___load_core_config__' . $config, $settings);
296
+                $this->{$config} = apply_filters('FHEE__EE_Config___load_core_config__'.$config, $settings);
297 297
                 // call configs populate method to ensure any defaults are set for empty values.
298 298
                 if (method_exists($settings, 'populate')) {
299 299
                     $this->{$config}->populate();
@@ -568,7 +568,7 @@  discard block
 block discarded – undo
568 568
                         break;
569 569
                     // TEST #2 : check that settings section exists
570 570
                     case 2:
571
-                        if (! isset($this->{$section})) {
571
+                        if ( ! isset($this->{$section})) {
572 572
                             if ($display_errors) {
573 573
                                 throw new EE_Error(
574 574
                                     sprintf(
@@ -629,7 +629,7 @@  discard block
 block discarded – undo
629 629
                         break;
630 630
                     // TEST #6 : verify config class is accessible
631 631
                     case 6:
632
-                        if (! class_exists($config_class)) {
632
+                        if ( ! class_exists($config_class)) {
633 633
                             if ($display_errors) {
634 634
                                 throw new EE_Error(
635 635
                                     sprintf(
@@ -646,7 +646,7 @@  discard block
 block discarded – undo
646 646
                         break;
647 647
                     // TEST #7 : check that config has even been set
648 648
                     case 7:
649
-                        if (! isset($this->{$section}->{$name})) {
649
+                        if ( ! isset($this->{$section}->{$name})) {
650 650
                             if ($display_errors) {
651 651
                                 throw new EE_Error(
652 652
                                     sprintf(
@@ -664,7 +664,7 @@  discard block
 block discarded – undo
664 664
                         break;
665 665
                     // TEST #8 : check that config is the requested type
666 666
                     case 8:
667
-                        if (! $this->{$section}->{$name} instanceof $config_class) {
667
+                        if ( ! $this->{$section}->{$name} instanceof $config_class) {
668 668
                             if ($display_errors) {
669 669
                                 throw new EE_Error(
670 670
                                     sprintf(
@@ -683,7 +683,7 @@  discard block
 block discarded – undo
683 683
                         break;
684 684
                     // TEST #9 : verify config object
685 685
                     case 9:
686
-                        if (! $config_obj instanceof EE_Config_Base) {
686
+                        if ( ! $config_obj instanceof EE_Config_Base) {
687 687
                             if ($display_errors) {
688 688
                                 throw new EE_Error(
689 689
                                     sprintf(
@@ -715,7 +715,7 @@  discard block
 block discarded – undo
715 715
      */
716 716
     private function _generate_config_option_name($section = '', $name = '')
717 717
     {
718
-        return 'ee_config-' . strtolower($section . '-' . str_replace(array('EE_', 'EED_'), '', $name));
718
+        return 'ee_config-'.strtolower($section.'-'.str_replace(array('EE_', 'EED_'), '', $name));
719 719
     }
720 720
 
721 721
 
@@ -732,7 +732,7 @@  discard block
 block discarded – undo
732 732
     {
733 733
         return ! empty($config_class)
734 734
             ? $config_class
735
-            : str_replace(' ', '_', ucwords(str_replace('_', ' ', $name))) . '_Config';
735
+            : str_replace(' ', '_', ucwords(str_replace('_', ' ', $name))).'_Config';
736 736
     }
737 737
 
738 738
 
@@ -751,17 +751,17 @@  discard block
 block discarded – undo
751 751
         // ensure config class is set to something
752 752
         $config_class = $this->_set_config_class($config_class, $name);
753 753
         // run tests 1-4, 6, and 7 to verify all config params are set and valid
754
-        if (! $this->_verify_config_params($section, $name, $config_class, null, array(1, 2, 3, 4, 5, 6))) {
754
+        if ( ! $this->_verify_config_params($section, $name, $config_class, null, array(1, 2, 3, 4, 5, 6))) {
755 755
             return null;
756 756
         }
757 757
         $config_option_name = $this->_generate_config_option_name($section, $name);
758 758
         // if the config option name hasn't been added yet to the list of option names we're tracking, then do so now
759
-        if (! isset($this->_addon_option_names[ $config_option_name ])) {
760
-            $this->_addon_option_names[ $config_option_name ] = $config_class;
759
+        if ( ! isset($this->_addon_option_names[$config_option_name])) {
760
+            $this->_addon_option_names[$config_option_name] = $config_class;
761 761
             $this->update_addon_option_names();
762 762
         }
763 763
         // verify the incoming config object but suppress errors
764
-        if (! $this->_verify_config_params($section, $name, $config_class, $config_obj, array(9), false)) {
764
+        if ( ! $this->_verify_config_params($section, $name, $config_class, $config_obj, array(9), false)) {
765 765
             $config_obj = new $config_class();
766 766
         }
767 767
         if (get_option($config_option_name)) {
@@ -823,7 +823,7 @@  discard block
 block discarded – undo
823 823
         }
824 824
         $config_option_name = $this->_generate_config_option_name($section, $name);
825 825
         // check if config object has been added to db by seeing if config option name is in $this->_addon_option_names array
826
-        if (! isset($this->_addon_option_names[ $config_option_name ])) {
826
+        if ( ! isset($this->_addon_option_names[$config_option_name])) {
827 827
             // save new config to db
828 828
             if ($this->set_config($section, $name, $config_class, $config_obj)) {
829 829
                 return true;
@@ -849,7 +849,7 @@  discard block
 block discarded – undo
849 849
                             'event_espresso'
850 850
                         ),
851 851
                         $config_class,
852
-                        'EE_Config->' . $section . '->' . $name
852
+                        'EE_Config->'.$section.'->'.$name
853 853
                     ),
854 854
                     __FILE__,
855 855
                     __FUNCTION__,
@@ -875,7 +875,7 @@  discard block
 block discarded – undo
875 875
         // ensure config class is set to something
876 876
         $config_class = $this->_set_config_class($config_class, $name);
877 877
         // run tests 1-4, 6 and 7 to verify that all params have been set
878
-        if (! $this->_verify_config_params($section, $name, $config_class, null, array(1, 2, 3, 4, 5, 6))) {
878
+        if ( ! $this->_verify_config_params($section, $name, $config_class, null, array(1, 2, 3, 4, 5, 6))) {
879 879
             return null;
880 880
         }
881 881
         // now test if the requested config object exists, but suppress errors
@@ -920,7 +920,7 @@  discard block
 block discarded – undo
920 920
         // retrieve the wp-option for this config class.
921 921
         $config_option = maybe_unserialize(get_option($config_option_name, array()));
922 922
         if (empty($config_option)) {
923
-            EE_Config::log($config_option_name . '-NOT-FOUND');
923
+            EE_Config::log($config_option_name.'-NOT-FOUND');
924 924
         }
925 925
         return $config_option;
926 926
     }
@@ -937,7 +937,7 @@  discard block
 block discarded – undo
937 937
             $config_log = get_option(EE_Config::LOG_NAME, array());
938 938
             /** @var RequestParams $request */
939 939
             $request = LoaderFactory::getLoader()->getShared(RequestParams::class);
940
-            $config_log[ (string) microtime(true) ] = array(
940
+            $config_log[(string) microtime(true)] = array(
941 941
                 'config_name' => $config_option_name,
942 942
                 'request'     => $request->requestParams(),
943 943
             );
@@ -952,7 +952,7 @@  discard block
 block discarded – undo
952 952
      */
953 953
     public static function trim_log()
954 954
     {
955
-        if (! EE_Config::logging_enabled()) {
955
+        if ( ! EE_Config::logging_enabled()) {
956 956
             return;
957 957
         }
958 958
         $config_log = maybe_unserialize(get_option(EE_Config::LOG_NAME, array()));
@@ -976,7 +976,7 @@  discard block
 block discarded – undo
976 976
     public static function get_page_for_posts()
977 977
     {
978 978
         $page_for_posts = get_option('page_for_posts');
979
-        if (! $page_for_posts) {
979
+        if ( ! $page_for_posts) {
980 980
             return 'posts';
981 981
         }
982 982
         global $wpdb;
@@ -1033,13 +1033,13 @@  discard block
 block discarded – undo
1033 1033
             )
1034 1034
         ) {
1035 1035
             // grab list of installed widgets
1036
-            $widgets_to_register = glob(EE_WIDGETS . '*', GLOB_ONLYDIR);
1036
+            $widgets_to_register = glob(EE_WIDGETS.'*', GLOB_ONLYDIR);
1037 1037
             // filter list of modules to register
1038 1038
             $widgets_to_register = apply_filters(
1039 1039
                 'FHEE__EE_Config__register_widgets__widgets_to_register',
1040 1040
                 $widgets_to_register
1041 1041
             );
1042
-            if (! empty($widgets_to_register)) {
1042
+            if ( ! empty($widgets_to_register)) {
1043 1043
                 // cycle thru widget folders
1044 1044
                 foreach ($widgets_to_register as $widget_path) {
1045 1045
                     // add to list of installed widget modules
@@ -1089,31 +1089,31 @@  discard block
 block discarded – undo
1089 1089
         // create classname from widget directory name
1090 1090
         $widget = str_replace(' ', '_', ucwords(str_replace('_', ' ', $widget)));
1091 1091
         // add class prefix
1092
-        $widget_class = 'EEW_' . $widget;
1092
+        $widget_class = 'EEW_'.$widget;
1093 1093
         // does the widget exist ?
1094
-        if (! is_readable($widget_path . '/' . $widget_class . $widget_ext)) {
1094
+        if ( ! is_readable($widget_path.'/'.$widget_class.$widget_ext)) {
1095 1095
             $msg = sprintf(
1096 1096
                 esc_html__(
1097 1097
                     'The requested %s widget file could not be found or is not readable due to file permissions. Please ensure the following path is correct: %s',
1098 1098
                     'event_espresso'
1099 1099
                 ),
1100 1100
                 $widget_class,
1101
-                $widget_path . '/' . $widget_class . $widget_ext
1101
+                $widget_path.'/'.$widget_class.$widget_ext
1102 1102
             );
1103
-            EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__);
1103
+            EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1104 1104
             return;
1105 1105
         }
1106 1106
         // load the widget class file
1107
-        require_once($widget_path . '/' . $widget_class . $widget_ext);
1107
+        require_once($widget_path.'/'.$widget_class.$widget_ext);
1108 1108
         // verify that class exists
1109
-        if (! class_exists($widget_class)) {
1109
+        if ( ! class_exists($widget_class)) {
1110 1110
             $msg = sprintf(esc_html__('The requested %s widget class does not exist.', 'event_espresso'), $widget_class);
1111
-            EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__);
1111
+            EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1112 1112
             return;
1113 1113
         }
1114 1114
         register_widget($widget_class);
1115 1115
         // add to array of registered widgets
1116
-        EE_Registry::instance()->widgets->{$widget_class} = $widget_path . '/' . $widget_class . $widget_ext;
1116
+        EE_Registry::instance()->widgets->{$widget_class} = $widget_path.'/'.$widget_class.$widget_ext;
1117 1117
     }
1118 1118
 
1119 1119
 
@@ -1126,19 +1126,19 @@  discard block
 block discarded – undo
1126 1126
     private function _register_modules()
1127 1127
     {
1128 1128
         // grab list of installed modules
1129
-        $modules_to_register = glob(EE_MODULES . '*', GLOB_ONLYDIR);
1129
+        $modules_to_register = glob(EE_MODULES.'*', GLOB_ONLYDIR);
1130 1130
         // filter list of modules to register
1131 1131
         $modules_to_register = apply_filters(
1132 1132
             'FHEE__EE_Config__register_modules__modules_to_register',
1133 1133
             $modules_to_register
1134 1134
         );
1135
-        if (! empty($modules_to_register)) {
1135
+        if ( ! empty($modules_to_register)) {
1136 1136
             // loop through folders
1137 1137
             foreach ($modules_to_register as $module_path) {
1138 1138
                 /**TEMPORARILY EXCLUDE gateways from modules for time being**/
1139 1139
                 if (
1140
-                    $module_path !== EE_MODULES . 'zzz-copy-this-module-template'
1141
-                    && $module_path !== EE_MODULES . 'gateways'
1140
+                    $module_path !== EE_MODULES.'zzz-copy-this-module-template'
1141
+                    && $module_path !== EE_MODULES.'gateways'
1142 1142
                 ) {
1143 1143
                     // add to list of installed modules
1144 1144
                     EE_Config::register_module($module_path);
@@ -1175,25 +1175,25 @@  discard block
 block discarded – undo
1175 1175
             // remove last segment
1176 1176
             array_pop($module_path);
1177 1177
             // glue it back together
1178
-            $module_path = implode('/', $module_path) . '/';
1178
+            $module_path = implode('/', $module_path).'/';
1179 1179
             // take first segment from file name pieces and sanitize it
1180 1180
             $module = preg_replace('/[^a-zA-Z0-9_\-]/', '', $module_file[0]);
1181 1181
             // ensure class prefix is added
1182
-            $module_class = strpos($module, 'EED_') !== 0 ? 'EED_' . $module : $module;
1182
+            $module_class = strpos($module, 'EED_') !== 0 ? 'EED_'.$module : $module;
1183 1183
         } else {
1184 1184
             // we need to generate the filename based off of the folder name
1185 1185
             // grab and sanitize module name
1186 1186
             $module = strtolower(basename($module_path));
1187 1187
             $module = preg_replace('/[^a-z0-9_\-]/', '', $module);
1188 1188
             // like trailingslashit()
1189
-            $module_path = rtrim($module_path, '/') . '/';
1189
+            $module_path = rtrim($module_path, '/').'/';
1190 1190
             // create classname from module directory name
1191 1191
             $module = str_replace(' ', '_', ucwords(str_replace('_', ' ', $module)));
1192 1192
             // add class prefix
1193
-            $module_class = 'EED_' . $module;
1193
+            $module_class = 'EED_'.$module;
1194 1194
         }
1195 1195
         // does the module exist ?
1196
-        if (! is_readable($module_path . '/' . $module_class . $module_ext)) {
1196
+        if ( ! is_readable($module_path.'/'.$module_class.$module_ext)) {
1197 1197
             $msg = sprintf(
1198 1198
                 esc_html__(
1199 1199
                     'The requested %s module file could not be found or is not readable due to file permissions.',
@@ -1201,19 +1201,19 @@  discard block
 block discarded – undo
1201 1201
                 ),
1202 1202
                 $module
1203 1203
             );
1204
-            EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__);
1204
+            EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1205 1205
             return false;
1206 1206
         }
1207 1207
         // load the module class file
1208
-        require_once($module_path . $module_class . $module_ext);
1208
+        require_once($module_path.$module_class.$module_ext);
1209 1209
         // verify that class exists
1210
-        if (! class_exists($module_class)) {
1210
+        if ( ! class_exists($module_class)) {
1211 1211
             $msg = sprintf(esc_html__('The requested %s module class does not exist.', 'event_espresso'), $module_class);
1212
-            EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__);
1212
+            EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1213 1213
             return false;
1214 1214
         }
1215 1215
         // add to array of registered modules
1216
-        EE_Registry::instance()->modules->{$module_class} = $module_path . $module_class . $module_ext;
1216
+        EE_Registry::instance()->modules->{$module_class} = $module_path.$module_class.$module_ext;
1217 1217
         do_action(
1218 1218
             'AHEE__EE_Config__register_module__complete',
1219 1219
             $module_class,
@@ -1264,26 +1264,26 @@  discard block
 block discarded – undo
1264 1264
     {
1265 1265
         do_action('AHEE__EE_Config__register_route__begin', $route, $module, $method_name);
1266 1266
         $module = str_replace('EED_', '', $module);
1267
-        $module_class = 'EED_' . $module;
1268
-        if (! isset(EE_Registry::instance()->modules->{$module_class})) {
1267
+        $module_class = 'EED_'.$module;
1268
+        if ( ! isset(EE_Registry::instance()->modules->{$module_class})) {
1269 1269
             $msg = sprintf(esc_html__('The module %s has not been registered.', 'event_espresso'), $module);
1270
-            EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__);
1270
+            EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1271 1271
             return false;
1272 1272
         }
1273 1273
         if (empty($route)) {
1274 1274
             $msg = sprintf(esc_html__('No route has been supplied.', 'event_espresso'), $route);
1275
-            EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__);
1275
+            EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1276 1276
             return false;
1277 1277
         }
1278
-        if (! method_exists('EED_' . $module, $method_name)) {
1278
+        if ( ! method_exists('EED_'.$module, $method_name)) {
1279 1279
             $msg = sprintf(
1280 1280
                 esc_html__('A valid class method for the %s route has not been supplied.', 'event_espresso'),
1281 1281
                 $route
1282 1282
             );
1283
-            EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__);
1283
+            EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1284 1284
             return false;
1285 1285
         }
1286
-        EE_Config::$_module_route_map[ (string) $key ][ (string) $route ] = array('EED_' . $module, $method_name);
1286
+        EE_Config::$_module_route_map[(string) $key][(string) $route] = array('EED_'.$module, $method_name);
1287 1287
         return true;
1288 1288
     }
1289 1289
 
@@ -1300,8 +1300,8 @@  discard block
 block discarded – undo
1300 1300
     {
1301 1301
         do_action('AHEE__EE_Config__get_route__begin', $route);
1302 1302
         $route = (string) apply_filters('FHEE__EE_Config__get_route', $route);
1303
-        if (isset(EE_Config::$_module_route_map[ $key ][ $route ])) {
1304
-            return EE_Config::$_module_route_map[ $key ][ $route ];
1303
+        if (isset(EE_Config::$_module_route_map[$key][$route])) {
1304
+            return EE_Config::$_module_route_map[$key][$route];
1305 1305
         }
1306 1306
         return null;
1307 1307
     }
@@ -1333,47 +1333,47 @@  discard block
 block discarded – undo
1333 1333
     public static function register_forward($route = null, $status = 0, $forward = null, $key = 'ee')
1334 1334
     {
1335 1335
         do_action('AHEE__EE_Config__register_forward', $route, $status, $forward);
1336
-        if (! isset(EE_Config::$_module_route_map[ $key ][ $route ]) || empty($route)) {
1336
+        if ( ! isset(EE_Config::$_module_route_map[$key][$route]) || empty($route)) {
1337 1337
             $msg = sprintf(
1338 1338
                 esc_html__('The module route %s for this forward has not been registered.', 'event_espresso'),
1339 1339
                 $route
1340 1340
             );
1341
-            EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__);
1341
+            EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1342 1342
             return false;
1343 1343
         }
1344 1344
         if (empty($forward)) {
1345 1345
             $msg = sprintf(esc_html__('No forwarding route has been supplied.', 'event_espresso'), $route);
1346
-            EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__);
1346
+            EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1347 1347
             return false;
1348 1348
         }
1349 1349
         if (is_array($forward)) {
1350
-            if (! isset($forward[1])) {
1350
+            if ( ! isset($forward[1])) {
1351 1351
                 $msg = sprintf(
1352 1352
                     esc_html__('A class method for the %s forwarding route has not been supplied.', 'event_espresso'),
1353 1353
                     $route
1354 1354
                 );
1355
-                EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__);
1355
+                EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1356 1356
                 return false;
1357 1357
             }
1358
-            if (! method_exists($forward[0], $forward[1])) {
1358
+            if ( ! method_exists($forward[0], $forward[1])) {
1359 1359
                 $msg = sprintf(
1360 1360
                     esc_html__('The class method %s for the %s forwarding route is in invalid.', 'event_espresso'),
1361 1361
                     $forward[1],
1362 1362
                     $route
1363 1363
                 );
1364
-                EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__);
1364
+                EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1365 1365
                 return false;
1366 1366
             }
1367
-        } elseif (! function_exists($forward)) {
1367
+        } elseif ( ! function_exists($forward)) {
1368 1368
             $msg = sprintf(
1369 1369
                 esc_html__('The function %s for the %s forwarding route is in invalid.', 'event_espresso'),
1370 1370
                 $forward,
1371 1371
                 $route
1372 1372
             );
1373
-            EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__);
1373
+            EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1374 1374
             return false;
1375 1375
         }
1376
-        EE_Config::$_module_forward_map[ $key ][ $route ][ absint($status) ] = $forward;
1376
+        EE_Config::$_module_forward_map[$key][$route][absint($status)] = $forward;
1377 1377
         return true;
1378 1378
     }
1379 1379
 
@@ -1391,10 +1391,10 @@  discard block
 block discarded – undo
1391 1391
     public static function get_forward($route = null, $status = 0, $key = 'ee')
1392 1392
     {
1393 1393
         do_action('AHEE__EE_Config__get_forward__begin', $route, $status);
1394
-        if (isset(EE_Config::$_module_forward_map[ $key ][ $route ][ $status ])) {
1394
+        if (isset(EE_Config::$_module_forward_map[$key][$route][$status])) {
1395 1395
             return apply_filters(
1396 1396
                 'FHEE__EE_Config__get_forward',
1397
-                EE_Config::$_module_forward_map[ $key ][ $route ][ $status ],
1397
+                EE_Config::$_module_forward_map[$key][$route][$status],
1398 1398
                 $route,
1399 1399
                 $status
1400 1400
             );
@@ -1418,15 +1418,15 @@  discard block
 block discarded – undo
1418 1418
     public static function register_view($route = null, $status = 0, $view = null, $key = 'ee')
1419 1419
     {
1420 1420
         do_action('AHEE__EE_Config__register_view__begin', $route, $status, $view);
1421
-        if (! isset(EE_Config::$_module_route_map[ $key ][ $route ]) || empty($route)) {
1421
+        if ( ! isset(EE_Config::$_module_route_map[$key][$route]) || empty($route)) {
1422 1422
             $msg = sprintf(
1423 1423
                 esc_html__('The module route %s for this view has not been registered.', 'event_espresso'),
1424 1424
                 $route
1425 1425
             );
1426
-            EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__);
1426
+            EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1427 1427
             return false;
1428 1428
         }
1429
-        if (! is_readable($view)) {
1429
+        if ( ! is_readable($view)) {
1430 1430
             $msg = sprintf(
1431 1431
                 esc_html__(
1432 1432
                     'The %s view file could not be found or is not readable due to file permissions.',
@@ -1434,10 +1434,10 @@  discard block
 block discarded – undo
1434 1434
                 ),
1435 1435
                 $view
1436 1436
             );
1437
-            EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__);
1437
+            EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1438 1438
             return false;
1439 1439
         }
1440
-        EE_Config::$_module_view_map[ $key ][ $route ][ absint($status) ] = $view;
1440
+        EE_Config::$_module_view_map[$key][$route][absint($status)] = $view;
1441 1441
         return true;
1442 1442
     }
1443 1443
 
@@ -1455,10 +1455,10 @@  discard block
 block discarded – undo
1455 1455
     public static function get_view($route = null, $status = 0, $key = 'ee')
1456 1456
     {
1457 1457
         do_action('AHEE__EE_Config__get_view__begin', $route, $status);
1458
-        if (isset(EE_Config::$_module_view_map[ $key ][ $route ][ $status ])) {
1458
+        if (isset(EE_Config::$_module_view_map[$key][$route][$status])) {
1459 1459
             return apply_filters(
1460 1460
                 'FHEE__EE_Config__get_view',
1461
-                EE_Config::$_module_view_map[ $key ][ $route ][ $status ],
1461
+                EE_Config::$_module_view_map[$key][$route][$status],
1462 1462
                 $route,
1463 1463
                 $status
1464 1464
             );
@@ -1484,7 +1484,7 @@  discard block
 block discarded – undo
1484 1484
      */
1485 1485
     public static function getLegacyShortcodesManager()
1486 1486
     {
1487
-        if (! EE_Config::instance()->legacy_shortcodes_manager instanceof LegacyShortcodesManager) {
1487
+        if ( ! EE_Config::instance()->legacy_shortcodes_manager instanceof LegacyShortcodesManager) {
1488 1488
             EE_Config::instance()->legacy_shortcodes_manager = LoaderFactory::getLoader()->getShared(
1489 1489
                 LegacyShortcodesManager::class
1490 1490
             );
@@ -1531,7 +1531,7 @@  discard block
 block discarded – undo
1531 1531
      */
1532 1532
     public function get_pretty($property)
1533 1533
     {
1534
-        if (! property_exists($this, $property)) {
1534
+        if ( ! property_exists($this, $property)) {
1535 1535
             throw new EE_Error(
1536 1536
                 sprintf(
1537 1537
                     esc_html__(
@@ -1760,11 +1760,11 @@  discard block
 block discarded – undo
1760 1760
      */
1761 1761
     public function reg_page_url()
1762 1762
     {
1763
-        if (! $this->reg_page_url) {
1763
+        if ( ! $this->reg_page_url) {
1764 1764
             $this->reg_page_url = add_query_arg(
1765 1765
                 array('uts' => time()),
1766 1766
                 get_permalink($this->reg_page_id)
1767
-            ) . '#checkout';
1767
+            ).'#checkout';
1768 1768
         }
1769 1769
         return $this->reg_page_url;
1770 1770
     }
@@ -1780,7 +1780,7 @@  discard block
 block discarded – undo
1780 1780
      */
1781 1781
     public function txn_page_url($query_args = array())
1782 1782
     {
1783
-        if (! $this->txn_page_url) {
1783
+        if ( ! $this->txn_page_url) {
1784 1784
             $this->txn_page_url = get_permalink($this->txn_page_id);
1785 1785
         }
1786 1786
         if ($query_args) {
@@ -1801,7 +1801,7 @@  discard block
 block discarded – undo
1801 1801
      */
1802 1802
     public function thank_you_page_url($query_args = array())
1803 1803
     {
1804
-        if (! $this->thank_you_page_url) {
1804
+        if ( ! $this->thank_you_page_url) {
1805 1805
             $this->thank_you_page_url = get_permalink($this->thank_you_page_id);
1806 1806
         }
1807 1807
         if ($query_args) {
@@ -1820,7 +1820,7 @@  discard block
 block discarded – undo
1820 1820
      */
1821 1821
     public function cancel_page_url()
1822 1822
     {
1823
-        if (! $this->cancel_page_url) {
1823
+        if ( ! $this->cancel_page_url) {
1824 1824
             $this->cancel_page_url = get_permalink($this->cancel_page_id);
1825 1825
         }
1826 1826
         return $this->cancel_page_url;
@@ -1863,13 +1863,13 @@  discard block
 block discarded – undo
1863 1863
         $current_main_site_id = ! empty($current_network_main_site) ? $current_network_main_site->blog_id : 1;
1864 1864
         $option = self::OPTION_NAME_UXIP;
1865 1865
         // set correct table for query
1866
-        $table_name = $wpdb->get_blog_prefix($current_main_site_id) . 'options';
1866
+        $table_name = $wpdb->get_blog_prefix($current_main_site_id).'options';
1867 1867
         // rather than getting blog option for the $current_main_site_id, we do a direct $wpdb query because
1868 1868
         // get_blog_option() does a switch_to_blog an that could cause infinite recursion because EE_Core_Config might be
1869 1869
         // re-constructed on the blog switch.  Note, we are still executing any core wp filters on this option retrieval.
1870 1870
         // this bit of code is basically a direct copy of get_option without any caching because we are NOT switched to the blog
1871 1871
         // for the purpose of caching.
1872
-        $pre = apply_filters('pre_option_' . $option, false, $option);
1872
+        $pre = apply_filters('pre_option_'.$option, false, $option);
1873 1873
         if (false !== $pre) {
1874 1874
             EE_Core_Config::$ee_ueip_option = $pre;
1875 1875
             return EE_Core_Config::$ee_ueip_option;
@@ -1883,10 +1883,10 @@  discard block
 block discarded – undo
1883 1883
         if (is_object($row)) {
1884 1884
             $value = $row->option_value;
1885 1885
         } else { // option does not exist so use default.
1886
-            EE_Core_Config::$ee_ueip_option =  apply_filters('default_option_' . $option, false, $option);
1886
+            EE_Core_Config::$ee_ueip_option = apply_filters('default_option_'.$option, false, $option);
1887 1887
             return EE_Core_Config::$ee_ueip_option;
1888 1888
         }
1889
-        EE_Core_Config::$ee_ueip_option = apply_filters('option_' . $option, maybe_unserialize($value), $option);
1889
+        EE_Core_Config::$ee_ueip_option = apply_filters('option_'.$option, maybe_unserialize($value), $option);
1890 1890
         return EE_Core_Config::$ee_ueip_option;
1891 1891
     }
1892 1892
 
@@ -2149,30 +2149,30 @@  discard block
 block discarded – undo
2149 2149
             // retrieve the country settings from the db, just in case they have been customized
2150 2150
             $country = EE_Registry::instance()->load_model('Country')->get_one_by_ID($CNT_ISO);
2151 2151
             if ($country instanceof EE_Country) {
2152
-                $this->code = $country->currency_code();    // currency code: USD, CAD, EUR
2153
-                $this->name = $country->currency_name_single();    // Dollar
2154
-                $this->plural = $country->currency_name_plural();    // Dollars
2155
-                $this->sign = $country->currency_sign();            // currency sign: $
2152
+                $this->code = $country->currency_code(); // currency code: USD, CAD, EUR
2153
+                $this->name = $country->currency_name_single(); // Dollar
2154
+                $this->plural = $country->currency_name_plural(); // Dollars
2155
+                $this->sign = $country->currency_sign(); // currency sign: $
2156 2156
                 $this->sign_b4 = $country->currency_sign_before(
2157
-                );        // currency sign before or after: $TRUE  or  FALSE$
2158
-                $this->dec_plc = $country->currency_decimal_places();    // decimal places: 2 = 0.00  3 = 0.000
2157
+                ); // currency sign before or after: $TRUE  or  FALSE$
2158
+                $this->dec_plc = $country->currency_decimal_places(); // decimal places: 2 = 0.00  3 = 0.000
2159 2159
                 $this->dec_mrk = $country->currency_decimal_mark(
2160
-                );    // decimal mark: (comma) ',' = 0,01   or (decimal) '.' = 0.01
2160
+                ); // decimal mark: (comma) ',' = 0,01   or (decimal) '.' = 0.01
2161 2161
                 $this->thsnds = $country->currency_thousands_separator(
2162
-                );    // thousands separator: (comma) ',' = 1,000   or (decimal) '.' = 1.000
2162
+                ); // thousands separator: (comma) ',' = 1,000   or (decimal) '.' = 1.000
2163 2163
             }
2164 2164
         }
2165 2165
         // fallback to hardcoded defaults, in case the above failed
2166 2166
         if (empty($this->code)) {
2167 2167
             // set default currency settings
2168
-            $this->code = 'USD';    // currency code: USD, CAD, EUR
2169
-            $this->name = esc_html__('Dollar', 'event_espresso');    // Dollar
2170
-            $this->plural = esc_html__('Dollars', 'event_espresso');    // Dollars
2171
-            $this->sign = '$';    // currency sign: $
2172
-            $this->sign_b4 = true;    // currency sign before or after: $TRUE  or  FALSE$
2173
-            $this->dec_plc = 2;    // decimal places: 2 = 0.00  3 = 0.000
2174
-            $this->dec_mrk = '.';    // decimal mark: (comma) ',' = 0,01   or (decimal) '.' = 0.01
2175
-            $this->thsnds = ',';    // thousands separator: (comma) ',' = 1,000   or (decimal) '.' = 1.000
2168
+            $this->code = 'USD'; // currency code: USD, CAD, EUR
2169
+            $this->name = esc_html__('Dollar', 'event_espresso'); // Dollar
2170
+            $this->plural = esc_html__('Dollars', 'event_espresso'); // Dollars
2171
+            $this->sign = '$'; // currency sign: $
2172
+            $this->sign_b4 = true; // currency sign before or after: $TRUE  or  FALSE$
2173
+            $this->dec_plc = 2; // decimal places: 2 = 0.00  3 = 0.000
2174
+            $this->dec_mrk = '.'; // decimal mark: (comma) ',' = 0,01   or (decimal) '.' = 0.01
2175
+            $this->thsnds = ','; // thousands separator: (comma) ',' = 1,000   or (decimal) '.' = 1.000
2176 2176
         }
2177 2177
     }
2178 2178
 }
@@ -2441,8 +2441,8 @@  discard block
 block discarded – undo
2441 2441
             $closing_a_tag = '';
2442 2442
             if (function_exists('get_privacy_policy_url')) {
2443 2443
                 $privacy_page_url = get_privacy_policy_url();
2444
-                if (! empty($privacy_page_url)) {
2445
-                    $opening_a_tag = '<a href="' . $privacy_page_url . '" target="_blank">';
2444
+                if ( ! empty($privacy_page_url)) {
2445
+                    $opening_a_tag = '<a href="'.$privacy_page_url.'" target="_blank">';
2446 2446
                     $closing_a_tag = '</a>';
2447 2447
                 }
2448 2448
             }
@@ -2674,7 +2674,7 @@  discard block
 block discarded – undo
2674 2674
     public function log_file_name($reset = false)
2675 2675
     {
2676 2676
         if (empty($this->log_file_name) || $reset) {
2677
-            $this->log_file_name = sanitize_key('espresso_log_' . md5(uniqid('', true))) . '.txt';
2677
+            $this->log_file_name = sanitize_key('espresso_log_'.md5(uniqid('', true))).'.txt';
2678 2678
             EE_Config::instance()->update_espresso_config(false, false);
2679 2679
         }
2680 2680
         return $this->log_file_name;
@@ -2688,7 +2688,7 @@  discard block
 block discarded – undo
2688 2688
     public function debug_file_name($reset = false)
2689 2689
     {
2690 2690
         if (empty($this->debug_file_name) || $reset) {
2691
-            $this->debug_file_name = sanitize_key('espresso_debug_' . md5(uniqid('', true))) . '.txt';
2691
+            $this->debug_file_name = sanitize_key('espresso_debug_'.md5(uniqid('', true))).'.txt';
2692 2692
             EE_Config::instance()->update_espresso_config(false, false);
2693 2693
         }
2694 2694
         return $this->debug_file_name;
@@ -2918,21 +2918,21 @@  discard block
 block discarded – undo
2918 2918
         $this->use_google_maps = true;
2919 2919
         $this->google_map_api_key = '';
2920 2920
         // for event details pages (reg page)
2921
-        $this->event_details_map_width = 585;            // ee_map_width_single
2922
-        $this->event_details_map_height = 362;            // ee_map_height_single
2923
-        $this->event_details_map_zoom = 14;            // ee_map_zoom_single
2924
-        $this->event_details_display_nav = true;            // ee_map_nav_display_single
2925
-        $this->event_details_nav_size = false;            // ee_map_nav_size_single
2926
-        $this->event_details_control_type = 'default';        // ee_map_type_control_single
2927
-        $this->event_details_map_align = 'center';            // ee_map_align_single
2921
+        $this->event_details_map_width = 585; // ee_map_width_single
2922
+        $this->event_details_map_height = 362; // ee_map_height_single
2923
+        $this->event_details_map_zoom = 14; // ee_map_zoom_single
2924
+        $this->event_details_display_nav = true; // ee_map_nav_display_single
2925
+        $this->event_details_nav_size = false; // ee_map_nav_size_single
2926
+        $this->event_details_control_type = 'default'; // ee_map_type_control_single
2927
+        $this->event_details_map_align = 'center'; // ee_map_align_single
2928 2928
         // for event list pages
2929
-        $this->event_list_map_width = 300;            // ee_map_width
2930
-        $this->event_list_map_height = 185;        // ee_map_height
2931
-        $this->event_list_map_zoom = 12;            // ee_map_zoom
2932
-        $this->event_list_display_nav = false;        // ee_map_nav_display
2933
-        $this->event_list_nav_size = true;            // ee_map_nav_size
2934
-        $this->event_list_control_type = 'dropdown';        // ee_map_type_control
2935
-        $this->event_list_map_align = 'center';            // ee_map_align
2929
+        $this->event_list_map_width = 300; // ee_map_width
2930
+        $this->event_list_map_height = 185; // ee_map_height
2931
+        $this->event_list_map_zoom = 12; // ee_map_zoom
2932
+        $this->event_list_display_nav = false; // ee_map_nav_display
2933
+        $this->event_list_nav_size = true; // ee_map_nav_size
2934
+        $this->event_list_control_type = 'dropdown'; // ee_map_type_control
2935
+        $this->event_list_map_align = 'center'; // ee_map_align
2936 2936
     }
2937 2937
 }
2938 2938
 
Please login to merge, or discard this patch.