Completed
Branch dev (8d2aa7)
by
unknown
16:56 queued 12:48
created
core/db_models/fields/EE_Money_Field.php 1 patch
Indentation   +79 added lines, -79 removed lines patch added patch discarded remove patch
@@ -9,91 +9,91 @@
 block discarded – undo
9 9
  */
10 10
 class EE_Money_Field extends EE_Float_Field
11 11
 {
12
-    /**
13
-     * @var DecimalValues
14
-     */
15
-    protected $decimal_values;
12
+	/**
13
+	 * @var DecimalValues
14
+	 */
15
+	protected $decimal_values;
16 16
 
17 17
 
18
-    /**
19
-     * @param string $table_column
20
-     * @param string $nicename
21
-     * @param bool   $nullable
22
-     * @param null   $default_value
23
-     * @throws EE_Error
24
-     * @throws ReflectionException
25
-     */
26
-    public function __construct($table_column, $nicename, $nullable, $default_value = null)
27
-    {
28
-        parent::__construct($table_column, $nicename, $nullable, $default_value);
29
-        $this->setSchemaType('object');
30
-        $this->decimal_values = LoaderFactory::getShared(
31
-            'EventEspresso\core\services\helpers\DecimalValues',
32
-            [EE_Currency_Config::getCurrencyConfig()]
33
-        );
34
-    }
18
+	/**
19
+	 * @param string $table_column
20
+	 * @param string $nicename
21
+	 * @param bool   $nullable
22
+	 * @param null   $default_value
23
+	 * @throws EE_Error
24
+	 * @throws ReflectionException
25
+	 */
26
+	public function __construct($table_column, $nicename, $nullable, $default_value = null)
27
+	{
28
+		parent::__construct($table_column, $nicename, $nullable, $default_value);
29
+		$this->setSchemaType('object');
30
+		$this->decimal_values = LoaderFactory::getShared(
31
+			'EventEspresso\core\services\helpers\DecimalValues',
32
+			[EE_Currency_Config::getCurrencyConfig()]
33
+		);
34
+	}
35 35
 
36 36
 
37
-    /**
38
-     * Schemas:
39
-     *    'localized_float': "3,023.00"
40
-     *    'no_currency_code': "$3,023.00"
41
-     *    null: "$3,023.00<span>USD</span>"
42
-     *
43
-     * @param string $value_on_field_to_be_outputted
44
-     * @param string $schema
45
-     * @return string
46
-     */
47
-    public function prepare_for_pretty_echoing($value_on_field_to_be_outputted, $schema = null): string
48
-    {
49
-        if ($schema == 'localized_float') {
50
-            return parent::prepare_for_pretty_echoing($value_on_field_to_be_outputted);
51
-        }
52
-        $display_code = $schema !== 'no_currency_code';
53
-        // we don't use the $pretty_float because format_currency will take care of it.
54
-        return EEH_Template::format_currency($value_on_field_to_be_outputted, false, $display_code);
55
-    }
37
+	/**
38
+	 * Schemas:
39
+	 *    'localized_float': "3,023.00"
40
+	 *    'no_currency_code': "$3,023.00"
41
+	 *    null: "$3,023.00<span>USD</span>"
42
+	 *
43
+	 * @param string $value_on_field_to_be_outputted
44
+	 * @param string $schema
45
+	 * @return string
46
+	 */
47
+	public function prepare_for_pretty_echoing($value_on_field_to_be_outputted, $schema = null): string
48
+	{
49
+		if ($schema == 'localized_float') {
50
+			return parent::prepare_for_pretty_echoing($value_on_field_to_be_outputted);
51
+		}
52
+		$display_code = $schema !== 'no_currency_code';
53
+		// we don't use the $pretty_float because format_currency will take care of it.
54
+		return EEH_Template::format_currency($value_on_field_to_be_outputted, false, $display_code);
55
+	}
56 56
 
57 57
 
58
-    /**
59
-     * If provided with a string, strips out money-related formatting to turn it into a proper float.
60
-     * Rounds the float to the correct number of decimal places for this country's currency.
61
-     * Also, interprets periods and commas according to the country's currency settings.
62
-     * So if you want to pass in a string that NEEDS to interpret periods as decimal marks, call floatval() on it first.
63
-     *
64
-     * @param string $value_inputted_for_field_on_model_object
65
-     * @return float
66
-     */
67
-    public function prepare_for_set($value_inputted_for_field_on_model_object): float
68
-    {
69
-        // now it's a float-style string or number
70
-        $float_val = parent::prepare_for_set($value_inputted_for_field_on_model_object);
71
-        // round to the correctly number of decimal places for this  currency
72
-        return $this->decimal_values->roundDecimalValue($float_val);
73
-    }
58
+	/**
59
+	 * If provided with a string, strips out money-related formatting to turn it into a proper float.
60
+	 * Rounds the float to the correct number of decimal places for this country's currency.
61
+	 * Also, interprets periods and commas according to the country's currency settings.
62
+	 * So if you want to pass in a string that NEEDS to interpret periods as decimal marks, call floatval() on it first.
63
+	 *
64
+	 * @param string $value_inputted_for_field_on_model_object
65
+	 * @return float
66
+	 */
67
+	public function prepare_for_set($value_inputted_for_field_on_model_object): float
68
+	{
69
+		// now it's a float-style string or number
70
+		$float_val = parent::prepare_for_set($value_inputted_for_field_on_model_object);
71
+		// round to the correctly number of decimal places for this  currency
72
+		return $this->decimal_values->roundDecimalValue($float_val);
73
+	}
74 74
 
75 75
 
76
-    /**
77
-     * @return array[]
78
-     */
79
-    public function getSchemaProperties(): array
80
-    {
81
-        return [
82
-            'raw'    => [
83
-                'description' => sprintf(
84
-                    esc_html__('%s - the raw value as it exists in the database as a simple float.', 'event_espresso'),
85
-                    $this->get_nicename()
86
-                ),
87
-                'type'        => 'number',
88
-            ],
89
-            'pretty' => [
90
-                'description' => sprintf(
91
-                    esc_html__('%s - formatted for display in the set currency and decimal places.', 'event_espresso'),
92
-                    $this->get_nicename()
93
-                ),
94
-                'type'        => 'string',
95
-                'format'      => 'money',
96
-            ],
97
-        ];
98
-    }
76
+	/**
77
+	 * @return array[]
78
+	 */
79
+	public function getSchemaProperties(): array
80
+	{
81
+		return [
82
+			'raw'    => [
83
+				'description' => sprintf(
84
+					esc_html__('%s - the raw value as it exists in the database as a simple float.', 'event_espresso'),
85
+					$this->get_nicename()
86
+				),
87
+				'type'        => 'number',
88
+			],
89
+			'pretty' => [
90
+				'description' => sprintf(
91
+					esc_html__('%s - formatted for display in the set currency and decimal places.', 'event_espresso'),
92
+					$this->get_nicename()
93
+				),
94
+				'type'        => 'string',
95
+				'format'      => 'money',
96
+			],
97
+		];
98
+	}
99 99
 }
Please login to merge, or discard this patch.
core/db_models/fields/EE_Float_Field.php 1 patch
Indentation   +68 added lines, -68 removed lines patch added patch discarded remove patch
@@ -6,78 +6,78 @@
 block discarded – undo
6 6
  */
7 7
 class EE_Float_Field extends EE_Model_Field_Base
8 8
 {
9
-    /**
10
-     * @var EE_Currency_Config
11
-     */
12
-    protected $currency;
9
+	/**
10
+	 * @var EE_Currency_Config
11
+	 */
12
+	protected $currency;
13 13
 
14 14
 
15
-    /**
16
-     * @param string $table_column
17
-     * @param string $nicename
18
-     * @param bool   $nullable
19
-     * @param null   $default_value
20
-     */
21
-    public function __construct($table_column, $nicename, $nullable, $default_value = null)
22
-    {
23
-        $this->currency = EE_Config::instance()->currency;
24
-        parent::__construct($table_column, $nicename, $nullable, $default_value);
25
-        $this->setSchemaType('number');
26
-    }
15
+	/**
16
+	 * @param string $table_column
17
+	 * @param string $nicename
18
+	 * @param bool   $nullable
19
+	 * @param null   $default_value
20
+	 */
21
+	public function __construct($table_column, $nicename, $nullable, $default_value = null)
22
+	{
23
+		$this->currency = EE_Config::instance()->currency;
24
+		parent::__construct($table_column, $nicename, $nullable, $default_value);
25
+		$this->setSchemaType('number');
26
+	}
27 27
 
28 28
 
29
-    /**
30
-     * If provided a string, strips out number-related formatting, like commas, periods, spaces, other junk, etc.
31
-     * However, treats commas and periods as thousand-separators ro decimal marks, as indicate by the config's currency.
32
-     * So if you want to pass in a string that NEEDS to interpret periods as decimal marks, call floatval() on it first.
33
-     * Returns a float
34
-     *
35
-     * @param float|string $value_inputted_for_field_on_model_object
36
-     * @return float
37
-     */
38
-    public function prepare_for_set($value_inputted_for_field_on_model_object)
39
-    {
40
-        // remove whitespaces and thousands separators
41
-        if (is_string($value_inputted_for_field_on_model_object)) {
42
-            $value_inputted_for_field_on_model_object = str_replace(
43
-                array(" ", $this->currency->thsnds),
44
-                "",
45
-                $value_inputted_for_field_on_model_object
46
-            );
47
-            // normalize it so periods are decimal marks (we don't care where you're from: we're talking PHP now)
48
-            $value_inputted_for_field_on_model_object = str_replace(
49
-                $this->currency->dec_mrk,
50
-                ".",
51
-                $value_inputted_for_field_on_model_object
52
-            );
53
-            // double-check there's absolutely nothing left on this string besides numbers
54
-            $value_inputted_for_field_on_model_object = preg_replace(
55
-                "/[^0-9,.]/",
56
-                "",
57
-                $value_inputted_for_field_on_model_object
58
-            );
59
-        }
60
-        return floatval($value_inputted_for_field_on_model_object);
61
-    }
29
+	/**
30
+	 * If provided a string, strips out number-related formatting, like commas, periods, spaces, other junk, etc.
31
+	 * However, treats commas and periods as thousand-separators ro decimal marks, as indicate by the config's currency.
32
+	 * So if you want to pass in a string that NEEDS to interpret periods as decimal marks, call floatval() on it first.
33
+	 * Returns a float
34
+	 *
35
+	 * @param float|string $value_inputted_for_field_on_model_object
36
+	 * @return float
37
+	 */
38
+	public function prepare_for_set($value_inputted_for_field_on_model_object)
39
+	{
40
+		// remove whitespaces and thousands separators
41
+		if (is_string($value_inputted_for_field_on_model_object)) {
42
+			$value_inputted_for_field_on_model_object = str_replace(
43
+				array(" ", $this->currency->thsnds),
44
+				"",
45
+				$value_inputted_for_field_on_model_object
46
+			);
47
+			// normalize it so periods are decimal marks (we don't care where you're from: we're talking PHP now)
48
+			$value_inputted_for_field_on_model_object = str_replace(
49
+				$this->currency->dec_mrk,
50
+				".",
51
+				$value_inputted_for_field_on_model_object
52
+			);
53
+			// double-check there's absolutely nothing left on this string besides numbers
54
+			$value_inputted_for_field_on_model_object = preg_replace(
55
+				"/[^0-9,.]/",
56
+				"",
57
+				$value_inputted_for_field_on_model_object
58
+			);
59
+		}
60
+		return floatval($value_inputted_for_field_on_model_object);
61
+	}
62 62
 
63
-    /**
64
-     * Returns the number formatted according to local custom (set by the country of the blog).
65
-     *
66
-     * @param float $value_on_field_to_be_outputted
67
-     * @return string
68
-     */
69
-    public function prepare_for_pretty_echoing($value_on_field_to_be_outputted, $schema = null)
70
-    {
71
-        return number_format(
72
-            $value_on_field_to_be_outputted,
73
-            $this->currency->dec_plc,
74
-            $this->currency->dec_mrk,
75
-            $this->currency->thsnds
76
-        );
77
-    }
63
+	/**
64
+	 * Returns the number formatted according to local custom (set by the country of the blog).
65
+	 *
66
+	 * @param float $value_on_field_to_be_outputted
67
+	 * @return string
68
+	 */
69
+	public function prepare_for_pretty_echoing($value_on_field_to_be_outputted, $schema = null)
70
+	{
71
+		return number_format(
72
+			$value_on_field_to_be_outputted,
73
+			$this->currency->dec_plc,
74
+			$this->currency->dec_mrk,
75
+			$this->currency->thsnds
76
+		);
77
+	}
78 78
 
79
-    public function prepare_for_set_from_db($value_found_in_db_for_model_object)
80
-    {
81
-        return floatval($value_found_in_db_for_model_object);
82
-    }
79
+	public function prepare_for_set_from_db($value_found_in_db_for_model_object)
80
+	{
81
+		return floatval($value_found_in_db_for_model_object);
82
+	}
83 83
 }
Please login to merge, or discard this patch.
core/EE_Config.core.php 2 patches
Indentation   +3264 added lines, -3264 removed lines patch added patch discarded remove patch
@@ -19,2595 +19,2595 @@  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
122
-     */
123
-    private $_addon_option_names = array();
124
-
125
-    /**
126
-     * @var array
127
-     */
128
-    private static $_module_route_map = array();
129
-
130
-    /**
131
-     * @var array
132
-     */
133
-    private static $_module_forward_map = array();
134
-
135
-    /**
136
-     * @var array
137
-     */
138
-    private static $_module_view_map = array();
139
-
140
-    /**
141
-     * @var bool
142
-     */
143
-    private static $initialized = false;
144
-
145
-
146
-    /**
147
-     * @singleton method used to instantiate class object
148
-     * @access    public
149
-     * @return EE_Config instance
150
-     */
151
-    public static function instance()
152
-    {
153
-        // check if class object is instantiated, and instantiated properly
154
-        if (! self::$_instance instanceof EE_Config) {
155
-            self::$_instance = new self();
156
-        }
157
-        return self::$_instance;
158
-    }
159
-
160
-
161
-    /**
162
-     * Resets the config
163
-     *
164
-     * @param bool    $hard_reset    if TRUE, sets EE_CONFig back to its original settings in the database. If FALSE
165
-     *                               (default) leaves the database alone, and merely resets the EE_Config object to
166
-     *                               reflect its state in the database
167
-     * @param boolean $reinstantiate if TRUE (default) call instance() and return it. Otherwise, just leave
168
-     *                               $_instance as NULL. Useful in case you want to forget about the old instance on
169
-     *                               EE_Config, but might not be ready to instantiate EE_Config currently (eg if the
170
-     *                               site was put into maintenance mode)
171
-     * @return EE_Config
172
-     */
173
-    public static function reset($hard_reset = false, $reinstantiate = true)
174
-    {
175
-        if (self::$_instance instanceof EE_Config) {
176
-            if ($hard_reset) {
177
-                self::$_instance->legacy_shortcodes_manager = null;
178
-                self::$_instance->_addon_option_names = array();
179
-                self::$_instance->_initialize_config();
180
-                self::$_instance->update_espresso_config();
181
-            }
182
-            self::$_instance->update_addon_option_names();
183
-        }
184
-        self::$_instance = null;
185
-        self::$initialized = false;
186
-        // we don't need to reset the static properties imo because those should
187
-        // only change when a module is added or removed. Currently we don't
188
-        // support removing a module during a request when it previously existed
189
-        if ($reinstantiate) {
190
-            return self::instance();
191
-        } else {
192
-            return null;
193
-        }
194
-    }
195
-
196
-
197
-    private function __construct()
198
-    {
199
-        if (self::$initialized) {
200
-            return;
201
-        }
202
-        self::$initialized = true;
203
-        do_action('AHEE__EE_Config__construct__begin', $this);
204
-        EE_Config::$_logging_enabled = apply_filters('FHEE__EE_Config___construct__logging_enabled', false);
205
-        // setup empty config classes
206
-        $this->_initialize_config();
207
-        // load existing EE site settings
208
-        $this->_load_core_config();
209
-        // confirm everything loaded correctly and set filtered defaults if not
210
-        $this->_verify_config();
211
-        //  register shortcodes and modules
212
-        add_action(
213
-            'AHEE__EE_System__register_shortcodes_modules_and_widgets',
214
-            [$this, 'register_shortcodes_and_modules'],
215
-            999
216
-        );
217
-        //  initialize shortcodes and modules
218
-        add_action('AHEE__EE_System__core_loaded_and_ready', [$this, 'initialize_shortcodes_and_modules']);
219
-        // register widgets
220
-        add_action('widgets_init', [$this, 'widgets_init'], 10);
221
-        // shutdown
222
-        add_action('shutdown', [$this, 'shutdown'], 10);
223
-        // construct__end hook
224
-        do_action('AHEE__EE_Config__construct__end', $this);
225
-        // hardcoded hack
226
-        $this->template_settings->current_espresso_theme = 'Espresso_Arabica_2014';
227
-    }
228
-
229
-
230
-    /**
231
-     * @return boolean
232
-     */
233
-    public static function logging_enabled()
234
-    {
235
-        return self::$_logging_enabled;
236
-    }
237
-
238
-
239
-    /**
240
-     * use to get the current theme if needed from static context
241
-     *
242
-     * @return string current theme set.
243
-     */
244
-    public static function get_current_theme()
245
-    {
246
-        return self::$_instance->template_settings->current_espresso_theme ?? 'Espresso_Arabica_2014';
247
-    }
248
-
249
-
250
-    /**
251
-     *        _initialize_config
252
-     *
253
-     * @access private
254
-     * @return void
255
-     */
256
-    private function _initialize_config()
257
-    {
258
-        EE_Config::trim_log();
259
-        // set defaults
260
-        $this->_addon_option_names = get_option(EE_Config::ADDON_OPTION_NAMES, array());
261
-        $this->addons = new stdClass();
262
-        // set _module_route_map
263
-        EE_Config::$_module_route_map = array();
264
-        // set _module_forward_map
265
-        EE_Config::$_module_forward_map = array();
266
-        // set _module_view_map
267
-        EE_Config::$_module_view_map = array();
268
-    }
269
-
270
-
271
-    /**
272
-     *        load core plugin configuration
273
-     *
274
-     * @access private
275
-     * @return void
276
-     */
277
-    private function _load_core_config()
278
-    {
279
-        // load_core_config__start hook
280
-        do_action('AHEE__EE_Config___load_core_config__start', $this);
281
-        $espresso_config = (array) $this->get_espresso_config();
282
-        // need to move the "addons" element to the end of the config array
283
-        // in case an addon config references one of the other config classes
284
-        $addons = $espresso_config['addons'];
285
-        unset($espresso_config['addons']);
286
-        $espresso_config['addons'] = $addons;
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
-        if ($CNT_ISO && $CNT_ISO === $this->code) {
2135
-            return;
2136
-        }
2137
-        // get country code from organization settings or use default
2138
-        $ORG_CNT = isset(EE_Registry::instance()->CFG->organization)
2139
-                   && EE_Registry::instance()->CFG->organization instanceof EE_Organization_Config
2140
-            ? EE_Registry::instance()->CFG->organization->CNT_ISO
2141
-            : '';
2142
-        // but override if requested
2143
-        $CNT_ISO = ! empty($CNT_ISO) ? $CNT_ISO : $ORG_CNT;
2144
-        // 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
2145
-        $this->setCurrency($CNT_ISO);
2146
-        // fallback to hardcoded defaults, in case the above failed
2147
-        if (empty($this->code)) {
2148
-            $this->setFallbackCurrency();
2149
-        }
2150
-    }
2151
-
2152
-
2153
-    /**
2154
-     * @param string|null $CNT_ISO
2155
-     * @throws EE_Error
2156
-     * @throws ReflectionException
2157
-     */
2158
-    public function setCurrency(?string $CNT_ISO = '')
2159
-    {
2160
-        if (empty($CNT_ISO) || ! EE_Maintenance_Mode::instance()->models_can_query()) {
2161
-            return;
2162
-        }
2163
-
2164
-        /** @var TableAnalysis $table_analysis */
2165
-        $table_analysis = EE_Registry::instance()->create('TableAnalysis', [], true);
2166
-        if (! $table_analysis->tableExists(EE_Registry::instance()->load_model('Country')->table())) {
2167
-            return;
2168
-        }
2169
-        // retrieve the country settings from the db, just in case they have been customized
2170
-        $country = EE_Registry::instance()->load_model('Country')->get_one_by_ID($CNT_ISO);
2171
-        if (! $country instanceof EE_Country) {
2172
-            throw new DomainException(
2173
-                esc_html__('Invalid Country ISO Code.', 'event_espresso')
2174
-            );
2175
-        }
2176
-        $this->code    = $country->currency_code();                  // currency code: USD, CAD, EUR
2177
-        $this->name    = $country->currency_name_single();           // Dollar
2178
-        $this->plural  = $country->currency_name_plural();           // Dollars
2179
-        $this->sign    = $country->currency_sign();                  // currency sign: $
2180
-        $this->sign_b4 = $country->currency_sign_before();           // currency sign before or after
2181
-        $this->dec_plc = $country->currency_decimal_places();        // decimal places: 2 = 0.00  3 = 0.000
2182
-        $this->dec_mrk = $country->currency_decimal_mark();          // decimal mark: ',' = 0,01 or '.' = 0.01
2183
-        $this->thsnds  = $country->currency_thousands_separator();   // thousands sep: ',' = 1,000 or '.' = 1.000
2184
-    }
2185
-
2186
-
2187
-    private function setFallbackCurrency()
2188
-    {
2189
-        // set default currency settings
2190
-        $this->code    = 'USD';
2191
-        $this->name    = esc_html__('Dollar', 'event_espresso');
2192
-        $this->plural  = esc_html__('Dollars', 'event_espresso');
2193
-        $this->sign    = '$';
2194
-        $this->sign_b4 = true;
2195
-        $this->dec_plc = 2;
2196
-        $this->dec_mrk = '.';
2197
-        $this->thsnds  = ',';
2198
-    }
2199
-
2200
-
2201
-    /**
2202
-     * @param string|null $CNT_ISO
2203
-     * @return EE_Currency_Config
2204
-     * @throws EE_Error
2205
-     * @throws ReflectionException
2206
-     */
2207
-    public static function getCurrencyConfig(?string $CNT_ISO = ''): EE_Currency_Config
2208
-    {
2209
-        // if CNT_ISO passed lets try to get currency settings for it.
2210
-        $currency_config = ! empty($CNT_ISO)
2211
-            ? new EE_Currency_Config($CNT_ISO)
2212
-            : null;
2213
-        // default currency settings for site if not set
2214
-        if ($currency_config instanceof EE_Currency_Config) {
2215
-            return $currency_config;
2216
-        }
2217
-        EE_Config::instance()->currency = EE_Config::instance()->currency instanceof EE_Currency_Config
2218
-            ? EE_Config::instance()->currency
2219
-            : new EE_Currency_Config();
2220
-        return EE_Config::instance()->currency;
2221
-    }
2222
-}
2223
-
2224
-/**
2225
- * Class for defining what's in the EE_Config relating to registration settings
2226
- */
2227
-class EE_Registration_Config extends EE_Config_Base
2228
-{
2229
-
2230
-    /**
2231
-     * Default registration status
2232
-     *
2233
-     * @var string $default_STS_ID
2234
-     * eg 'RPP'
2235
-     */
2236
-    public $default_STS_ID;
2237
-
2238
-    /**
2239
-     * For new events, this will be the default value for the maximum number of tickets (equivalent to maximum number of
2240
-     * registrations)
2241
-     *
2242
-     * @var int
2243
-     */
2244
-    public $default_maximum_number_of_tickets;
2245
-
2246
-    /**
2247
-     * level of validation to apply to email addresses
2248
-     *
2249
-     * @var string $email_validation_level
2250
-     * options: 'basic', 'wp_default', 'i18n', 'i18n_dns'
2251
-     */
2252
-    public $email_validation_level;
2253
-
2254
-    /**
2255
-     *    whether or not to show alternate payment options during the reg process if payment status is pending
2256
-     *
2257
-     * @var boolean $show_pending_payment_options
2258
-     */
2259
-    public $show_pending_payment_options;
2260
-
2261
-    /**
2262
-     * Whether to skip the registration confirmation page
2263
-     *
2264
-     * @var boolean $skip_reg_confirmation
2265
-     */
2266
-    public $skip_reg_confirmation;
2267
-
2268
-    /**
2269
-     * an array of SPCO reg steps where:
2270
-     *        the keys denotes the reg step order
2271
-     *        each element consists of an array with the following elements:
2272
-     *            "file_path" => the file path to the EE_SPCO_Reg_Step class
2273
-     *            "class_name" => the specific EE_SPCO_Reg_Step child class name
2274
-     *            "slug" => the URL param used to trigger the reg step
2275
-     *
2276
-     * @var array $reg_steps
2277
-     */
2278
-    public $reg_steps;
2279
-
2280
-    /**
2281
-     * Whether registration confirmation should be the last page of SPCO
2282
-     *
2283
-     * @var boolean $reg_confirmation_last
2284
-     */
2285
-    public $reg_confirmation_last;
2286
-
2287
-    /**
2288
-     * Whether or not to enable the EE Bot Trap
2289
-     *
2290
-     * @var boolean $use_bot_trap
2291
-     */
2292
-    public $use_bot_trap;
2293
-
2294
-    /**
2295
-     * Whether or not to encrypt some data sent by the EE Bot Trap
2296
-     *
2297
-     * @var boolean $use_encryption
2298
-     */
2299
-    public $use_encryption;
2300
-
2301
-    /**
2302
-     * Whether or not to use ReCaptcha
2303
-     *
2304
-     * @var boolean $use_captcha
2305
-     */
2306
-    public $use_captcha;
2307
-
2308
-    /**
2309
-     * ReCaptcha Theme
2310
-     *
2311
-     * @var string $recaptcha_theme
2312
-     *    options: 'dark', 'light', 'invisible'
2313
-     */
2314
-    public $recaptcha_theme;
2315
-
2316
-    /**
2317
-     * ReCaptcha Badge - determines the position of the reCAPTCHA badge if using Invisible ReCaptcha.
2318
-     *
2319
-     * @var string $recaptcha_badge
2320
-     *    options: 'bottomright', 'bottomleft', 'inline'
2321
-     */
2322
-    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
122
+	 */
123
+	private $_addon_option_names = array();
124
+
125
+	/**
126
+	 * @var array
127
+	 */
128
+	private static $_module_route_map = array();
129
+
130
+	/**
131
+	 * @var array
132
+	 */
133
+	private static $_module_forward_map = array();
134
+
135
+	/**
136
+	 * @var array
137
+	 */
138
+	private static $_module_view_map = array();
139
+
140
+	/**
141
+	 * @var bool
142
+	 */
143
+	private static $initialized = false;
144
+
145
+
146
+	/**
147
+	 * @singleton method used to instantiate class object
148
+	 * @access    public
149
+	 * @return EE_Config instance
150
+	 */
151
+	public static function instance()
152
+	{
153
+		// check if class object is instantiated, and instantiated properly
154
+		if (! self::$_instance instanceof EE_Config) {
155
+			self::$_instance = new self();
156
+		}
157
+		return self::$_instance;
158
+	}
159
+
160
+
161
+	/**
162
+	 * Resets the config
163
+	 *
164
+	 * @param bool    $hard_reset    if TRUE, sets EE_CONFig back to its original settings in the database. If FALSE
165
+	 *                               (default) leaves the database alone, and merely resets the EE_Config object to
166
+	 *                               reflect its state in the database
167
+	 * @param boolean $reinstantiate if TRUE (default) call instance() and return it. Otherwise, just leave
168
+	 *                               $_instance as NULL. Useful in case you want to forget about the old instance on
169
+	 *                               EE_Config, but might not be ready to instantiate EE_Config currently (eg if the
170
+	 *                               site was put into maintenance mode)
171
+	 * @return EE_Config
172
+	 */
173
+	public static function reset($hard_reset = false, $reinstantiate = true)
174
+	{
175
+		if (self::$_instance instanceof EE_Config) {
176
+			if ($hard_reset) {
177
+				self::$_instance->legacy_shortcodes_manager = null;
178
+				self::$_instance->_addon_option_names = array();
179
+				self::$_instance->_initialize_config();
180
+				self::$_instance->update_espresso_config();
181
+			}
182
+			self::$_instance->update_addon_option_names();
183
+		}
184
+		self::$_instance = null;
185
+		self::$initialized = false;
186
+		// we don't need to reset the static properties imo because those should
187
+		// only change when a module is added or removed. Currently we don't
188
+		// support removing a module during a request when it previously existed
189
+		if ($reinstantiate) {
190
+			return self::instance();
191
+		} else {
192
+			return null;
193
+		}
194
+	}
195
+
196
+
197
+	private function __construct()
198
+	{
199
+		if (self::$initialized) {
200
+			return;
201
+		}
202
+		self::$initialized = true;
203
+		do_action('AHEE__EE_Config__construct__begin', $this);
204
+		EE_Config::$_logging_enabled = apply_filters('FHEE__EE_Config___construct__logging_enabled', false);
205
+		// setup empty config classes
206
+		$this->_initialize_config();
207
+		// load existing EE site settings
208
+		$this->_load_core_config();
209
+		// confirm everything loaded correctly and set filtered defaults if not
210
+		$this->_verify_config();
211
+		//  register shortcodes and modules
212
+		add_action(
213
+			'AHEE__EE_System__register_shortcodes_modules_and_widgets',
214
+			[$this, 'register_shortcodes_and_modules'],
215
+			999
216
+		);
217
+		//  initialize shortcodes and modules
218
+		add_action('AHEE__EE_System__core_loaded_and_ready', [$this, 'initialize_shortcodes_and_modules']);
219
+		// register widgets
220
+		add_action('widgets_init', [$this, 'widgets_init'], 10);
221
+		// shutdown
222
+		add_action('shutdown', [$this, 'shutdown'], 10);
223
+		// construct__end hook
224
+		do_action('AHEE__EE_Config__construct__end', $this);
225
+		// hardcoded hack
226
+		$this->template_settings->current_espresso_theme = 'Espresso_Arabica_2014';
227
+	}
228
+
229
+
230
+	/**
231
+	 * @return boolean
232
+	 */
233
+	public static function logging_enabled()
234
+	{
235
+		return self::$_logging_enabled;
236
+	}
237
+
238
+
239
+	/**
240
+	 * use to get the current theme if needed from static context
241
+	 *
242
+	 * @return string current theme set.
243
+	 */
244
+	public static function get_current_theme()
245
+	{
246
+		return self::$_instance->template_settings->current_espresso_theme ?? 'Espresso_Arabica_2014';
247
+	}
248
+
249
+
250
+	/**
251
+	 *        _initialize_config
252
+	 *
253
+	 * @access private
254
+	 * @return void
255
+	 */
256
+	private function _initialize_config()
257
+	{
258
+		EE_Config::trim_log();
259
+		// set defaults
260
+		$this->_addon_option_names = get_option(EE_Config::ADDON_OPTION_NAMES, array());
261
+		$this->addons = new stdClass();
262
+		// set _module_route_map
263
+		EE_Config::$_module_route_map = array();
264
+		// set _module_forward_map
265
+		EE_Config::$_module_forward_map = array();
266
+		// set _module_view_map
267
+		EE_Config::$_module_view_map = array();
268
+	}
269
+
270
+
271
+	/**
272
+	 *        load core plugin configuration
273
+	 *
274
+	 * @access private
275
+	 * @return void
276
+	 */
277
+	private function _load_core_config()
278
+	{
279
+		// load_core_config__start hook
280
+		do_action('AHEE__EE_Config___load_core_config__start', $this);
281
+		$espresso_config = (array) $this->get_espresso_config();
282
+		// need to move the "addons" element to the end of the config array
283
+		// in case an addon config references one of the other config classes
284
+		$addons = $espresso_config['addons'];
285
+		unset($espresso_config['addons']);
286
+		$espresso_config['addons'] = $addons;
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
+}
2323 1516
 
2324
-    /**
2325
-     * ReCaptcha Type
2326
-     *
2327
-     * @var string $recaptcha_type
2328
-     *    options: 'audio', 'image'
2329
-     */
2330
-    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
+{
2331 1524
 
2332
-    /**
2333
-     * ReCaptcha language
2334
-     *
2335
-     * @var string $recaptcha_language
2336
-     * eg 'en'
2337
-     */
2338
-    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
+}
2339 1618
 
2340
-    /**
2341
-     * ReCaptcha public key
2342
-     *
2343
-     * @var string $recaptcha_publickey
2344
-     */
2345
-    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
+{
2346 1624
 
2347
-    /**
2348
-     * ReCaptcha private key
2349
-     *
2350
-     * @var string $recaptcha_privatekey
2351
-     */
2352
-    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
+}
2353 1924
 
2354
-    /**
2355
-     * array of form names protected by ReCaptcha
2356
-     *
2357
-     * @var array $recaptcha_protected_forms
2358
-     */
2359
-    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
+{
2360 1930
 
2361
-    /**
2362
-     * ReCaptcha width
2363
-     *
2364
-     * @var int $recaptcha_width
2365
-     * @deprecated
2366
-     */
2367
-    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
+}
2368 2058
 
2369
-    /**
2370
-     * Whether or not invalid attempts to directly access the registration checkout page should be tracked.
2371
-     *
2372
-     * @var boolean $track_invalid_checkout_access
2373
-     */
2374
-    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
+{
2375 2064
 
2376
-    /**
2377
-     * Whether or not to show the privacy policy consent checkbox
2378
-     *
2379
-     * @var bool
2380
-     */
2381
-    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
+		if ($CNT_ISO && $CNT_ISO === $this->code) {
2135
+			return;
2136
+		}
2137
+		// get country code from organization settings or use default
2138
+		$ORG_CNT = isset(EE_Registry::instance()->CFG->organization)
2139
+				   && EE_Registry::instance()->CFG->organization instanceof EE_Organization_Config
2140
+			? EE_Registry::instance()->CFG->organization->CNT_ISO
2141
+			: '';
2142
+		// but override if requested
2143
+		$CNT_ISO = ! empty($CNT_ISO) ? $CNT_ISO : $ORG_CNT;
2144
+		// 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
2145
+		$this->setCurrency($CNT_ISO);
2146
+		// fallback to hardcoded defaults, in case the above failed
2147
+		if (empty($this->code)) {
2148
+			$this->setFallbackCurrency();
2149
+		}
2150
+	}
2151
+
2152
+
2153
+	/**
2154
+	 * @param string|null $CNT_ISO
2155
+	 * @throws EE_Error
2156
+	 * @throws ReflectionException
2157
+	 */
2158
+	public function setCurrency(?string $CNT_ISO = '')
2159
+	{
2160
+		if (empty($CNT_ISO) || ! EE_Maintenance_Mode::instance()->models_can_query()) {
2161
+			return;
2162
+		}
2163
+
2164
+		/** @var TableAnalysis $table_analysis */
2165
+		$table_analysis = EE_Registry::instance()->create('TableAnalysis', [], true);
2166
+		if (! $table_analysis->tableExists(EE_Registry::instance()->load_model('Country')->table())) {
2167
+			return;
2168
+		}
2169
+		// retrieve the country settings from the db, just in case they have been customized
2170
+		$country = EE_Registry::instance()->load_model('Country')->get_one_by_ID($CNT_ISO);
2171
+		if (! $country instanceof EE_Country) {
2172
+			throw new DomainException(
2173
+				esc_html__('Invalid Country ISO Code.', 'event_espresso')
2174
+			);
2175
+		}
2176
+		$this->code    = $country->currency_code();                  // currency code: USD, CAD, EUR
2177
+		$this->name    = $country->currency_name_single();           // Dollar
2178
+		$this->plural  = $country->currency_name_plural();           // Dollars
2179
+		$this->sign    = $country->currency_sign();                  // currency sign: $
2180
+		$this->sign_b4 = $country->currency_sign_before();           // currency sign before or after
2181
+		$this->dec_plc = $country->currency_decimal_places();        // decimal places: 2 = 0.00  3 = 0.000
2182
+		$this->dec_mrk = $country->currency_decimal_mark();          // decimal mark: ',' = 0,01 or '.' = 0.01
2183
+		$this->thsnds  = $country->currency_thousands_separator();   // thousands sep: ',' = 1,000 or '.' = 1.000
2184
+	}
2185
+
2186
+
2187
+	private function setFallbackCurrency()
2188
+	{
2189
+		// set default currency settings
2190
+		$this->code    = 'USD';
2191
+		$this->name    = esc_html__('Dollar', 'event_espresso');
2192
+		$this->plural  = esc_html__('Dollars', 'event_espresso');
2193
+		$this->sign    = '$';
2194
+		$this->sign_b4 = true;
2195
+		$this->dec_plc = 2;
2196
+		$this->dec_mrk = '.';
2197
+		$this->thsnds  = ',';
2198
+	}
2199
+
2200
+
2201
+	/**
2202
+	 * @param string|null $CNT_ISO
2203
+	 * @return EE_Currency_Config
2204
+	 * @throws EE_Error
2205
+	 * @throws ReflectionException
2206
+	 */
2207
+	public static function getCurrencyConfig(?string $CNT_ISO = ''): EE_Currency_Config
2208
+	{
2209
+		// if CNT_ISO passed lets try to get currency settings for it.
2210
+		$currency_config = ! empty($CNT_ISO)
2211
+			? new EE_Currency_Config($CNT_ISO)
2212
+			: null;
2213
+		// default currency settings for site if not set
2214
+		if ($currency_config instanceof EE_Currency_Config) {
2215
+			return $currency_config;
2216
+		}
2217
+		EE_Config::instance()->currency = EE_Config::instance()->currency instanceof EE_Currency_Config
2218
+			? EE_Config::instance()->currency
2219
+			: new EE_Currency_Config();
2220
+		return EE_Config::instance()->currency;
2221
+	}
2222
+}
2382 2223
 
2383
-    /**
2384
-     * Label text to show on the checkbox
2385
-     *
2386
-     * @var string
2387
-     */
2388
-    public $consent_checkbox_label_text;
2224
+/**
2225
+ * Class for defining what's in the EE_Config relating to registration settings
2226
+ */
2227
+class EE_Registration_Config extends EE_Config_Base
2228
+{
2389 2229
 
2390
-    /*
2230
+	/**
2231
+	 * Default registration status
2232
+	 *
2233
+	 * @var string $default_STS_ID
2234
+	 * eg 'RPP'
2235
+	 */
2236
+	public $default_STS_ID;
2237
+
2238
+	/**
2239
+	 * For new events, this will be the default value for the maximum number of tickets (equivalent to maximum number of
2240
+	 * registrations)
2241
+	 *
2242
+	 * @var int
2243
+	 */
2244
+	public $default_maximum_number_of_tickets;
2245
+
2246
+	/**
2247
+	 * level of validation to apply to email addresses
2248
+	 *
2249
+	 * @var string $email_validation_level
2250
+	 * options: 'basic', 'wp_default', 'i18n', 'i18n_dns'
2251
+	 */
2252
+	public $email_validation_level;
2253
+
2254
+	/**
2255
+	 *    whether or not to show alternate payment options during the reg process if payment status is pending
2256
+	 *
2257
+	 * @var boolean $show_pending_payment_options
2258
+	 */
2259
+	public $show_pending_payment_options;
2260
+
2261
+	/**
2262
+	 * Whether to skip the registration confirmation page
2263
+	 *
2264
+	 * @var boolean $skip_reg_confirmation
2265
+	 */
2266
+	public $skip_reg_confirmation;
2267
+
2268
+	/**
2269
+	 * an array of SPCO reg steps where:
2270
+	 *        the keys denotes the reg step order
2271
+	 *        each element consists of an array with the following elements:
2272
+	 *            "file_path" => the file path to the EE_SPCO_Reg_Step class
2273
+	 *            "class_name" => the specific EE_SPCO_Reg_Step child class name
2274
+	 *            "slug" => the URL param used to trigger the reg step
2275
+	 *
2276
+	 * @var array $reg_steps
2277
+	 */
2278
+	public $reg_steps;
2279
+
2280
+	/**
2281
+	 * Whether registration confirmation should be the last page of SPCO
2282
+	 *
2283
+	 * @var boolean $reg_confirmation_last
2284
+	 */
2285
+	public $reg_confirmation_last;
2286
+
2287
+	/**
2288
+	 * Whether or not to enable the EE Bot Trap
2289
+	 *
2290
+	 * @var boolean $use_bot_trap
2291
+	 */
2292
+	public $use_bot_trap;
2293
+
2294
+	/**
2295
+	 * Whether or not to encrypt some data sent by the EE Bot Trap
2296
+	 *
2297
+	 * @var boolean $use_encryption
2298
+	 */
2299
+	public $use_encryption;
2300
+
2301
+	/**
2302
+	 * Whether or not to use ReCaptcha
2303
+	 *
2304
+	 * @var boolean $use_captcha
2305
+	 */
2306
+	public $use_captcha;
2307
+
2308
+	/**
2309
+	 * ReCaptcha Theme
2310
+	 *
2311
+	 * @var string $recaptcha_theme
2312
+	 *    options: 'dark', 'light', 'invisible'
2313
+	 */
2314
+	public $recaptcha_theme;
2315
+
2316
+	/**
2317
+	 * ReCaptcha Badge - determines the position of the reCAPTCHA badge if using Invisible ReCaptcha.
2318
+	 *
2319
+	 * @var string $recaptcha_badge
2320
+	 *    options: 'bottomright', 'bottomleft', 'inline'
2321
+	 */
2322
+	public $recaptcha_badge;
2323
+
2324
+	/**
2325
+	 * ReCaptcha Type
2326
+	 *
2327
+	 * @var string $recaptcha_type
2328
+	 *    options: 'audio', 'image'
2329
+	 */
2330
+	public $recaptcha_type;
2331
+
2332
+	/**
2333
+	 * ReCaptcha language
2334
+	 *
2335
+	 * @var string $recaptcha_language
2336
+	 * eg 'en'
2337
+	 */
2338
+	public $recaptcha_language;
2339
+
2340
+	/**
2341
+	 * ReCaptcha public key
2342
+	 *
2343
+	 * @var string $recaptcha_publickey
2344
+	 */
2345
+	public $recaptcha_publickey;
2346
+
2347
+	/**
2348
+	 * ReCaptcha private key
2349
+	 *
2350
+	 * @var string $recaptcha_privatekey
2351
+	 */
2352
+	public $recaptcha_privatekey;
2353
+
2354
+	/**
2355
+	 * array of form names protected by ReCaptcha
2356
+	 *
2357
+	 * @var array $recaptcha_protected_forms
2358
+	 */
2359
+	public $recaptcha_protected_forms;
2360
+
2361
+	/**
2362
+	 * ReCaptcha width
2363
+	 *
2364
+	 * @var int $recaptcha_width
2365
+	 * @deprecated
2366
+	 */
2367
+	public $recaptcha_width;
2368
+
2369
+	/**
2370
+	 * Whether or not invalid attempts to directly access the registration checkout page should be tracked.
2371
+	 *
2372
+	 * @var boolean $track_invalid_checkout_access
2373
+	 */
2374
+	protected $track_invalid_checkout_access = true;
2375
+
2376
+	/**
2377
+	 * Whether or not to show the privacy policy consent checkbox
2378
+	 *
2379
+	 * @var bool
2380
+	 */
2381
+	public $consent_checkbox_enabled;
2382
+
2383
+	/**
2384
+	 * Label text to show on the checkbox
2385
+	 *
2386
+	 * @var string
2387
+	 */
2388
+	public $consent_checkbox_label_text;
2389
+
2390
+	/*
2391 2391
      * String describing how long to keep payment logs. Passed into DateTime constructor
2392 2392
      * @var string
2393 2393
      */
2394
-    public $gateway_log_lifespan = '1 week';
2395
-
2396
-    /**
2397
-     * Enable copy attendee info at form
2398
-     *
2399
-     * @var boolean $enable_copy_attendee
2400
-     */
2401
-    protected $copy_attendee_info = true;
2402
-
2403
-
2404
-    /**
2405
-     *    class constructor
2406
-     *
2407
-     * @access    public
2408
-     */
2409
-    public function __construct()
2410
-    {
2411
-        // set default registration settings
2412
-        $this->default_STS_ID = EEM_Registration::status_id_pending_payment;
2413
-        $this->email_validation_level = 'wp_default';
2414
-        $this->show_pending_payment_options = true;
2415
-        $this->skip_reg_confirmation = true;
2416
-        $this->reg_steps = array();
2417
-        $this->reg_confirmation_last = false;
2418
-        $this->use_bot_trap = true;
2419
-        $this->use_encryption = true;
2420
-        $this->use_captcha = false;
2421
-        $this->recaptcha_theme = 'light';
2422
-        $this->recaptcha_badge = 'bottomleft';
2423
-        $this->recaptcha_type = 'image';
2424
-        $this->recaptcha_language = 'en';
2425
-        $this->recaptcha_publickey = null;
2426
-        $this->recaptcha_privatekey = null;
2427
-        $this->recaptcha_protected_forms = array();
2428
-        $this->recaptcha_width = 500;
2429
-        $this->default_maximum_number_of_tickets = 10;
2430
-        $this->consent_checkbox_enabled = false;
2431
-        $this->consent_checkbox_label_text = '';
2432
-        $this->gateway_log_lifespan = '7 days';
2433
-        $this->copy_attendee_info = true;
2434
-    }
2435
-
2436
-
2437
-    /**
2438
-     * This is called by the config loader and hooks are initialized AFTER the config has been populated.
2439
-     *
2440
-     * @since 4.8.8.rc.019
2441
-     */
2442
-    public function do_hooks()
2443
-    {
2444
-        add_action('AHEE__EE_Config___load_core_config__end', array($this, 'set_default_reg_status_on_EEM_Event'));
2445
-        add_action('AHEE__EE_Config___load_core_config__end', array($this, 'set_default_max_ticket_on_EEM_Event'));
2446
-        add_action('setup_theme', array($this, 'setDefaultCheckboxLabelText'));
2447
-    }
2448
-
2449
-
2450
-    /**
2451
-     * Hooked into `AHEE__EE_Config___load_core_config__end` to ensure the default for the
2452
-     * EVT_default_registration_status field matches the config setting for default_STS_ID.
2453
-     */
2454
-    public function set_default_reg_status_on_EEM_Event()
2455
-    {
2456
-        EEM_Event::set_default_reg_status($this->default_STS_ID);
2457
-    }
2458
-
2459
-
2460
-    /**
2461
-     * Hooked into `AHEE__EE_Config___load_core_config__end` to ensure the default for the EVT_additional_limit field
2462
-     * for Events matches the config setting for default_maximum_number_of_tickets
2463
-     */
2464
-    public function set_default_max_ticket_on_EEM_Event()
2465
-    {
2466
-        EEM_Event::set_default_additional_limit($this->default_maximum_number_of_tickets);
2467
-    }
2468
-
2469
-
2470
-    /**
2471
-     * Sets the default consent checkbox text. This needs to be done a bit later than when EE_Registration_Config is
2472
-     * constructed because that happens before we can get the privacy policy page's permalink.
2473
-     *
2474
-     * @throws InvalidArgumentException
2475
-     * @throws InvalidDataTypeException
2476
-     * @throws InvalidInterfaceException
2477
-     */
2478
-    public function setDefaultCheckboxLabelText()
2479
-    {
2480
-        if (
2481
-            $this->getConsentCheckboxLabelText() === null
2482
-            || $this->getConsentCheckboxLabelText() === ''
2483
-        ) {
2484
-            $opening_a_tag = '';
2485
-            $closing_a_tag = '';
2486
-            if (function_exists('get_privacy_policy_url')) {
2487
-                $privacy_page_url = get_privacy_policy_url();
2488
-                if (! empty($privacy_page_url)) {
2489
-                    $opening_a_tag = '<a href="' . $privacy_page_url . '" target="_blank">';
2490
-                    $closing_a_tag = '</a>';
2491
-                }
2492
-            }
2493
-            $loader = LoaderFactory::getLoader();
2494
-            $org_config = $loader->getShared('EE_Organization_Config');
2495
-            /**
2496
-             * @var $org_config EE_Organization_Config
2497
-             */
2498
-
2499
-            $this->setConsentCheckboxLabelText(
2500
-                sprintf(
2501
-                    esc_html__(
2502
-                        'I consent to %1$s storing and using my personal information, according to their %2$sprivacy policy%3$s.',
2503
-                        'event_espresso'
2504
-                    ),
2505
-                    $org_config->name,
2506
-                    $opening_a_tag,
2507
-                    $closing_a_tag
2508
-                )
2509
-            );
2510
-        }
2511
-    }
2512
-
2513
-
2514
-    /**
2515
-     * @return boolean
2516
-     */
2517
-    public function track_invalid_checkout_access()
2518
-    {
2519
-        return $this->track_invalid_checkout_access;
2520
-    }
2521
-
2522
-
2523
-    /**
2524
-     * @param boolean $track_invalid_checkout_access
2525
-     */
2526
-    public function set_track_invalid_checkout_access($track_invalid_checkout_access)
2527
-    {
2528
-        $this->track_invalid_checkout_access = filter_var(
2529
-            $track_invalid_checkout_access,
2530
-            FILTER_VALIDATE_BOOLEAN
2531
-        );
2532
-    }
2533
-
2534
-    /**
2535
-     * @return boolean
2536
-     */
2537
-    public function copyAttendeeInfo()
2538
-    {
2539
-        return $this->copy_attendee_info;
2540
-    }
2541
-
2542
-
2543
-    /**
2544
-     * @param boolean $copy_attendee_info
2545
-     */
2546
-    public function setCopyAttendeeInfo($copy_attendee_info)
2547
-    {
2548
-        $this->copy_attendee_info = filter_var(
2549
-            $copy_attendee_info,
2550
-            FILTER_VALIDATE_BOOLEAN
2551
-        );
2552
-    }
2553
-
2554
-
2555
-    /**
2556
-     * Gets the options to make availalbe for the gateway log lifespan
2557
-     * @return array
2558
-     */
2559
-    public function gatewayLogLifespanOptions()
2560
-    {
2561
-        return (array) apply_filters(
2562
-            'FHEE_EE_Admin_Config__gatewayLogLifespanOptions',
2563
-            array(
2564
-                '1 second' => esc_html__('Don\'t Log At All', 'event_espresso'),
2565
-                '1 day' => esc_html__('1 Day', 'event_espresso'),
2566
-                '7 days' => esc_html__('7 Days', 'event_espresso'),
2567
-                '14 days' => esc_html__('14 Days', 'event_espresso'),
2568
-                '30 days' => esc_html__('30 Days', 'event_espresso')
2569
-            )
2570
-        );
2571
-    }
2572
-
2573
-
2574
-    /**
2575
-     * @return bool
2576
-     */
2577
-    public function isConsentCheckboxEnabled()
2578
-    {
2579
-        return $this->consent_checkbox_enabled;
2580
-    }
2581
-
2582
-
2583
-    /**
2584
-     * @param bool $consent_checkbox_enabled
2585
-     */
2586
-    public function setConsentCheckboxEnabled($consent_checkbox_enabled)
2587
-    {
2588
-        $this->consent_checkbox_enabled = filter_var(
2589
-            $consent_checkbox_enabled,
2590
-            FILTER_VALIDATE_BOOLEAN
2591
-        );
2592
-    }
2593
-
2594
-
2595
-    /**
2596
-     * @return string
2597
-     */
2598
-    public function getConsentCheckboxLabelText()
2599
-    {
2600
-        return $this->consent_checkbox_label_text;
2601
-    }
2602
-
2603
-
2604
-    /**
2605
-     * @param string $consent_checkbox_label_text
2606
-     */
2607
-    public function setConsentCheckboxLabelText($consent_checkbox_label_text)
2608
-    {
2609
-        $this->consent_checkbox_label_text = (string) $consent_checkbox_label_text;
2610
-    }
2394
+	public $gateway_log_lifespan = '1 week';
2395
+
2396
+	/**
2397
+	 * Enable copy attendee info at form
2398
+	 *
2399
+	 * @var boolean $enable_copy_attendee
2400
+	 */
2401
+	protected $copy_attendee_info = true;
2402
+
2403
+
2404
+	/**
2405
+	 *    class constructor
2406
+	 *
2407
+	 * @access    public
2408
+	 */
2409
+	public function __construct()
2410
+	{
2411
+		// set default registration settings
2412
+		$this->default_STS_ID = EEM_Registration::status_id_pending_payment;
2413
+		$this->email_validation_level = 'wp_default';
2414
+		$this->show_pending_payment_options = true;
2415
+		$this->skip_reg_confirmation = true;
2416
+		$this->reg_steps = array();
2417
+		$this->reg_confirmation_last = false;
2418
+		$this->use_bot_trap = true;
2419
+		$this->use_encryption = true;
2420
+		$this->use_captcha = false;
2421
+		$this->recaptcha_theme = 'light';
2422
+		$this->recaptcha_badge = 'bottomleft';
2423
+		$this->recaptcha_type = 'image';
2424
+		$this->recaptcha_language = 'en';
2425
+		$this->recaptcha_publickey = null;
2426
+		$this->recaptcha_privatekey = null;
2427
+		$this->recaptcha_protected_forms = array();
2428
+		$this->recaptcha_width = 500;
2429
+		$this->default_maximum_number_of_tickets = 10;
2430
+		$this->consent_checkbox_enabled = false;
2431
+		$this->consent_checkbox_label_text = '';
2432
+		$this->gateway_log_lifespan = '7 days';
2433
+		$this->copy_attendee_info = true;
2434
+	}
2435
+
2436
+
2437
+	/**
2438
+	 * This is called by the config loader and hooks are initialized AFTER the config has been populated.
2439
+	 *
2440
+	 * @since 4.8.8.rc.019
2441
+	 */
2442
+	public function do_hooks()
2443
+	{
2444
+		add_action('AHEE__EE_Config___load_core_config__end', array($this, 'set_default_reg_status_on_EEM_Event'));
2445
+		add_action('AHEE__EE_Config___load_core_config__end', array($this, 'set_default_max_ticket_on_EEM_Event'));
2446
+		add_action('setup_theme', array($this, 'setDefaultCheckboxLabelText'));
2447
+	}
2448
+
2449
+
2450
+	/**
2451
+	 * Hooked into `AHEE__EE_Config___load_core_config__end` to ensure the default for the
2452
+	 * EVT_default_registration_status field matches the config setting for default_STS_ID.
2453
+	 */
2454
+	public function set_default_reg_status_on_EEM_Event()
2455
+	{
2456
+		EEM_Event::set_default_reg_status($this->default_STS_ID);
2457
+	}
2458
+
2459
+
2460
+	/**
2461
+	 * Hooked into `AHEE__EE_Config___load_core_config__end` to ensure the default for the EVT_additional_limit field
2462
+	 * for Events matches the config setting for default_maximum_number_of_tickets
2463
+	 */
2464
+	public function set_default_max_ticket_on_EEM_Event()
2465
+	{
2466
+		EEM_Event::set_default_additional_limit($this->default_maximum_number_of_tickets);
2467
+	}
2468
+
2469
+
2470
+	/**
2471
+	 * Sets the default consent checkbox text. This needs to be done a bit later than when EE_Registration_Config is
2472
+	 * constructed because that happens before we can get the privacy policy page's permalink.
2473
+	 *
2474
+	 * @throws InvalidArgumentException
2475
+	 * @throws InvalidDataTypeException
2476
+	 * @throws InvalidInterfaceException
2477
+	 */
2478
+	public function setDefaultCheckboxLabelText()
2479
+	{
2480
+		if (
2481
+			$this->getConsentCheckboxLabelText() === null
2482
+			|| $this->getConsentCheckboxLabelText() === ''
2483
+		) {
2484
+			$opening_a_tag = '';
2485
+			$closing_a_tag = '';
2486
+			if (function_exists('get_privacy_policy_url')) {
2487
+				$privacy_page_url = get_privacy_policy_url();
2488
+				if (! empty($privacy_page_url)) {
2489
+					$opening_a_tag = '<a href="' . $privacy_page_url . '" target="_blank">';
2490
+					$closing_a_tag = '</a>';
2491
+				}
2492
+			}
2493
+			$loader = LoaderFactory::getLoader();
2494
+			$org_config = $loader->getShared('EE_Organization_Config');
2495
+			/**
2496
+			 * @var $org_config EE_Organization_Config
2497
+			 */
2498
+
2499
+			$this->setConsentCheckboxLabelText(
2500
+				sprintf(
2501
+					esc_html__(
2502
+						'I consent to %1$s storing and using my personal information, according to their %2$sprivacy policy%3$s.',
2503
+						'event_espresso'
2504
+					),
2505
+					$org_config->name,
2506
+					$opening_a_tag,
2507
+					$closing_a_tag
2508
+				)
2509
+			);
2510
+		}
2511
+	}
2512
+
2513
+
2514
+	/**
2515
+	 * @return boolean
2516
+	 */
2517
+	public function track_invalid_checkout_access()
2518
+	{
2519
+		return $this->track_invalid_checkout_access;
2520
+	}
2521
+
2522
+
2523
+	/**
2524
+	 * @param boolean $track_invalid_checkout_access
2525
+	 */
2526
+	public function set_track_invalid_checkout_access($track_invalid_checkout_access)
2527
+	{
2528
+		$this->track_invalid_checkout_access = filter_var(
2529
+			$track_invalid_checkout_access,
2530
+			FILTER_VALIDATE_BOOLEAN
2531
+		);
2532
+	}
2533
+
2534
+	/**
2535
+	 * @return boolean
2536
+	 */
2537
+	public function copyAttendeeInfo()
2538
+	{
2539
+		return $this->copy_attendee_info;
2540
+	}
2541
+
2542
+
2543
+	/**
2544
+	 * @param boolean $copy_attendee_info
2545
+	 */
2546
+	public function setCopyAttendeeInfo($copy_attendee_info)
2547
+	{
2548
+		$this->copy_attendee_info = filter_var(
2549
+			$copy_attendee_info,
2550
+			FILTER_VALIDATE_BOOLEAN
2551
+		);
2552
+	}
2553
+
2554
+
2555
+	/**
2556
+	 * Gets the options to make availalbe for the gateway log lifespan
2557
+	 * @return array
2558
+	 */
2559
+	public function gatewayLogLifespanOptions()
2560
+	{
2561
+		return (array) apply_filters(
2562
+			'FHEE_EE_Admin_Config__gatewayLogLifespanOptions',
2563
+			array(
2564
+				'1 second' => esc_html__('Don\'t Log At All', 'event_espresso'),
2565
+				'1 day' => esc_html__('1 Day', 'event_espresso'),
2566
+				'7 days' => esc_html__('7 Days', 'event_espresso'),
2567
+				'14 days' => esc_html__('14 Days', 'event_espresso'),
2568
+				'30 days' => esc_html__('30 Days', 'event_espresso')
2569
+			)
2570
+		);
2571
+	}
2572
+
2573
+
2574
+	/**
2575
+	 * @return bool
2576
+	 */
2577
+	public function isConsentCheckboxEnabled()
2578
+	{
2579
+		return $this->consent_checkbox_enabled;
2580
+	}
2581
+
2582
+
2583
+	/**
2584
+	 * @param bool $consent_checkbox_enabled
2585
+	 */
2586
+	public function setConsentCheckboxEnabled($consent_checkbox_enabled)
2587
+	{
2588
+		$this->consent_checkbox_enabled = filter_var(
2589
+			$consent_checkbox_enabled,
2590
+			FILTER_VALIDATE_BOOLEAN
2591
+		);
2592
+	}
2593
+
2594
+
2595
+	/**
2596
+	 * @return string
2597
+	 */
2598
+	public function getConsentCheckboxLabelText()
2599
+	{
2600
+		return $this->consent_checkbox_label_text;
2601
+	}
2602
+
2603
+
2604
+	/**
2605
+	 * @param string $consent_checkbox_label_text
2606
+	 */
2607
+	public function setConsentCheckboxLabelText($consent_checkbox_label_text)
2608
+	{
2609
+		$this->consent_checkbox_label_text = (string) $consent_checkbox_label_text;
2610
+	}
2611 2611
 }
2612 2612
 
2613 2613
 /**
@@ -2616,180 +2616,180 @@  discard block
 block discarded – undo
2616 2616
 class EE_Admin_Config extends EE_Config_Base
2617 2617
 {
2618 2618
 
2619
-    /**
2620
-     * @var boolean $useAdvancedEditor
2621
-     */
2622
-    private $useAdvancedEditor;
2623
-
2624
-    /**
2625
-     * @var boolean $use_personnel_manager
2626
-     */
2627
-    public $use_personnel_manager;
2628
-
2629
-    /**
2630
-     * @var boolean $use_dashboard_widget
2631
-     */
2632
-    public $use_dashboard_widget;
2633
-
2634
-    /**
2635
-     * @var int $events_in_dashboard
2636
-     */
2637
-    public $events_in_dashboard;
2638
-
2639
-    /**
2640
-     * @var boolean $use_event_timezones
2641
-     */
2642
-    public $use_event_timezones;
2643
-
2644
-    /**
2645
-     * @var string $log_file_name
2646
-     */
2647
-    public $log_file_name;
2648
-
2649
-    /**
2650
-     * @var string $debug_file_name
2651
-     */
2652
-    public $debug_file_name;
2653
-
2654
-    /**
2655
-     * @var boolean $use_remote_logging
2656
-     */
2657
-    public $use_remote_logging;
2658
-
2659
-    /**
2660
-     * @var string $remote_logging_url
2661
-     */
2662
-    public $remote_logging_url;
2663
-
2664
-    /**
2665
-     * @var boolean $show_reg_footer
2666
-     */
2667
-    public $show_reg_footer;
2668
-
2669
-    /**
2670
-     * @var string $affiliate_id
2671
-     */
2672
-    public $affiliate_id;
2673
-
2674
-    /**
2675
-     * adds extra layer of encoding to session data to prevent serialization errors
2676
-     * but is incompatible with some server configuration errors
2677
-     * if you get "500 internal server errors" during registration, try turning this on
2678
-     * if you get PHP fatal errors regarding base 64 methods not defined, then turn this off
2679
-     *
2680
-     * @var boolean $encode_session_data
2681
-     */
2682
-    private $encode_session_data = false;
2683
-
2684
-    /**
2685
-     * @var boolean
2686
-     */
2687
-    private $is_caffeinated;
2688
-
2689
-
2690
-    /**
2691
-     *    class constructor
2692
-     *
2693
-     * @access    public
2694
-     */
2695
-    public function __construct()
2696
-    {
2697
-        // set default general admin settings
2698
-        $this->useAdvancedEditor = true;
2699
-        $this->use_personnel_manager = true;
2700
-        $this->use_dashboard_widget = true;
2701
-        $this->events_in_dashboard = 30;
2702
-        $this->use_event_timezones = false;
2703
-        $this->use_remote_logging = false;
2704
-        $this->remote_logging_url = null;
2705
-        $this->show_reg_footer = apply_filters(
2706
-            'FHEE__EE_Admin_Config__show_reg_footer__default',
2707
-            false
2708
-        );
2709
-        $this->affiliate_id = 'default';
2710
-        $this->encode_session_data = false;
2711
-    }
2712
-
2713
-
2714
-    /**
2715
-     * @param bool $reset
2716
-     * @return string
2717
-     */
2718
-    public function log_file_name($reset = false)
2719
-    {
2720
-        if (empty($this->log_file_name) || $reset) {
2721
-            $this->log_file_name = sanitize_key('espresso_log_' . md5(uniqid('', true))) . '.txt';
2722
-            EE_Config::instance()->update_espresso_config(false, false);
2723
-        }
2724
-        return $this->log_file_name;
2725
-    }
2726
-
2727
-
2728
-    /**
2729
-     * @param bool $reset
2730
-     * @return string
2731
-     */
2732
-    public function debug_file_name($reset = false)
2733
-    {
2734
-        if (empty($this->debug_file_name) || $reset) {
2735
-            $this->debug_file_name = sanitize_key('espresso_debug_' . md5(uniqid('', true))) . '.txt';
2736
-            EE_Config::instance()->update_espresso_config(false, false);
2737
-        }
2738
-        return $this->debug_file_name;
2739
-    }
2740
-
2741
-
2742
-    /**
2743
-     * @return string
2744
-     */
2745
-    public function affiliate_id()
2746
-    {
2747
-        return ! empty($this->affiliate_id) ? $this->affiliate_id : 'default';
2748
-    }
2749
-
2750
-
2751
-    /**
2752
-     * @return boolean
2753
-     */
2754
-    public function encode_session_data()
2755
-    {
2756
-        return filter_var($this->encode_session_data, FILTER_VALIDATE_BOOLEAN);
2757
-    }
2758
-
2759
-
2760
-    /**
2761
-     * @param boolean $encode_session_data
2762
-     */
2763
-    public function set_encode_session_data($encode_session_data)
2764
-    {
2765
-        $this->encode_session_data = filter_var($encode_session_data, FILTER_VALIDATE_BOOLEAN);
2766
-    }
2767
-
2768
-    /**
2769
-     * @return boolean
2770
-     */
2771
-    public function useAdvancedEditor()
2772
-    {
2773
-        if ($this->is_caffeinated === null) {
2774
-            $domain = LoaderFactory::getLoader()->getShared('EventEspresso\core\domain\Domain');
2775
-            $this->is_caffeinated = $domain->isCaffeinated();
2776
-        }
2777
-        return $this->useAdvancedEditor && $this->is_caffeinated;
2778
-    }
2779
-
2780
-    /**
2781
-     * @param boolean $use_advanced_editor
2782
-     */
2783
-    public function setUseAdvancedEditor($use_advanced_editor = true)
2784
-    {
2785
-        $this->useAdvancedEditor = filter_var(
2786
-            apply_filters(
2787
-                'FHEE__EE_Admin_Config__setUseAdvancedEditor__use_advanced_editor',
2788
-                $use_advanced_editor
2789
-            ),
2790
-            FILTER_VALIDATE_BOOLEAN
2791
-        );
2792
-    }
2619
+	/**
2620
+	 * @var boolean $useAdvancedEditor
2621
+	 */
2622
+	private $useAdvancedEditor;
2623
+
2624
+	/**
2625
+	 * @var boolean $use_personnel_manager
2626
+	 */
2627
+	public $use_personnel_manager;
2628
+
2629
+	/**
2630
+	 * @var boolean $use_dashboard_widget
2631
+	 */
2632
+	public $use_dashboard_widget;
2633
+
2634
+	/**
2635
+	 * @var int $events_in_dashboard
2636
+	 */
2637
+	public $events_in_dashboard;
2638
+
2639
+	/**
2640
+	 * @var boolean $use_event_timezones
2641
+	 */
2642
+	public $use_event_timezones;
2643
+
2644
+	/**
2645
+	 * @var string $log_file_name
2646
+	 */
2647
+	public $log_file_name;
2648
+
2649
+	/**
2650
+	 * @var string $debug_file_name
2651
+	 */
2652
+	public $debug_file_name;
2653
+
2654
+	/**
2655
+	 * @var boolean $use_remote_logging
2656
+	 */
2657
+	public $use_remote_logging;
2658
+
2659
+	/**
2660
+	 * @var string $remote_logging_url
2661
+	 */
2662
+	public $remote_logging_url;
2663
+
2664
+	/**
2665
+	 * @var boolean $show_reg_footer
2666
+	 */
2667
+	public $show_reg_footer;
2668
+
2669
+	/**
2670
+	 * @var string $affiliate_id
2671
+	 */
2672
+	public $affiliate_id;
2673
+
2674
+	/**
2675
+	 * adds extra layer of encoding to session data to prevent serialization errors
2676
+	 * but is incompatible with some server configuration errors
2677
+	 * if you get "500 internal server errors" during registration, try turning this on
2678
+	 * if you get PHP fatal errors regarding base 64 methods not defined, then turn this off
2679
+	 *
2680
+	 * @var boolean $encode_session_data
2681
+	 */
2682
+	private $encode_session_data = false;
2683
+
2684
+	/**
2685
+	 * @var boolean
2686
+	 */
2687
+	private $is_caffeinated;
2688
+
2689
+
2690
+	/**
2691
+	 *    class constructor
2692
+	 *
2693
+	 * @access    public
2694
+	 */
2695
+	public function __construct()
2696
+	{
2697
+		// set default general admin settings
2698
+		$this->useAdvancedEditor = true;
2699
+		$this->use_personnel_manager = true;
2700
+		$this->use_dashboard_widget = true;
2701
+		$this->events_in_dashboard = 30;
2702
+		$this->use_event_timezones = false;
2703
+		$this->use_remote_logging = false;
2704
+		$this->remote_logging_url = null;
2705
+		$this->show_reg_footer = apply_filters(
2706
+			'FHEE__EE_Admin_Config__show_reg_footer__default',
2707
+			false
2708
+		);
2709
+		$this->affiliate_id = 'default';
2710
+		$this->encode_session_data = false;
2711
+	}
2712
+
2713
+
2714
+	/**
2715
+	 * @param bool $reset
2716
+	 * @return string
2717
+	 */
2718
+	public function log_file_name($reset = false)
2719
+	{
2720
+		if (empty($this->log_file_name) || $reset) {
2721
+			$this->log_file_name = sanitize_key('espresso_log_' . md5(uniqid('', true))) . '.txt';
2722
+			EE_Config::instance()->update_espresso_config(false, false);
2723
+		}
2724
+		return $this->log_file_name;
2725
+	}
2726
+
2727
+
2728
+	/**
2729
+	 * @param bool $reset
2730
+	 * @return string
2731
+	 */
2732
+	public function debug_file_name($reset = false)
2733
+	{
2734
+		if (empty($this->debug_file_name) || $reset) {
2735
+			$this->debug_file_name = sanitize_key('espresso_debug_' . md5(uniqid('', true))) . '.txt';
2736
+			EE_Config::instance()->update_espresso_config(false, false);
2737
+		}
2738
+		return $this->debug_file_name;
2739
+	}
2740
+
2741
+
2742
+	/**
2743
+	 * @return string
2744
+	 */
2745
+	public function affiliate_id()
2746
+	{
2747
+		return ! empty($this->affiliate_id) ? $this->affiliate_id : 'default';
2748
+	}
2749
+
2750
+
2751
+	/**
2752
+	 * @return boolean
2753
+	 */
2754
+	public function encode_session_data()
2755
+	{
2756
+		return filter_var($this->encode_session_data, FILTER_VALIDATE_BOOLEAN);
2757
+	}
2758
+
2759
+
2760
+	/**
2761
+	 * @param boolean $encode_session_data
2762
+	 */
2763
+	public function set_encode_session_data($encode_session_data)
2764
+	{
2765
+		$this->encode_session_data = filter_var($encode_session_data, FILTER_VALIDATE_BOOLEAN);
2766
+	}
2767
+
2768
+	/**
2769
+	 * @return boolean
2770
+	 */
2771
+	public function useAdvancedEditor()
2772
+	{
2773
+		if ($this->is_caffeinated === null) {
2774
+			$domain = LoaderFactory::getLoader()->getShared('EventEspresso\core\domain\Domain');
2775
+			$this->is_caffeinated = $domain->isCaffeinated();
2776
+		}
2777
+		return $this->useAdvancedEditor && $this->is_caffeinated;
2778
+	}
2779
+
2780
+	/**
2781
+	 * @param boolean $use_advanced_editor
2782
+	 */
2783
+	public function setUseAdvancedEditor($use_advanced_editor = true)
2784
+	{
2785
+		$this->useAdvancedEditor = filter_var(
2786
+			apply_filters(
2787
+				'FHEE__EE_Admin_Config__setUseAdvancedEditor__use_advanced_editor',
2788
+				$use_advanced_editor
2789
+			),
2790
+			FILTER_VALIDATE_BOOLEAN
2791
+		);
2792
+	}
2793 2793
 }
2794 2794
 
2795 2795
 /**
@@ -2798,70 +2798,70 @@  discard block
 block discarded – undo
2798 2798
 class EE_Template_Config extends EE_Config_Base
2799 2799
 {
2800 2800
 
2801
-    /**
2802
-     * @var boolean $enable_default_style
2803
-     */
2804
-    public $enable_default_style;
2805
-
2806
-    /**
2807
-     * @var string $custom_style_sheet
2808
-     */
2809
-    public $custom_style_sheet;
2810
-
2811
-    /**
2812
-     * @var boolean $display_address_in_regform
2813
-     */
2814
-    public $display_address_in_regform;
2815
-
2816
-    /**
2817
-     * @var int $display_description_on_multi_reg_page
2818
-     */
2819
-    public $display_description_on_multi_reg_page;
2820
-
2821
-    /**
2822
-     * @var boolean $use_custom_templates
2823
-     */
2824
-    public $use_custom_templates;
2825
-
2826
-    /**
2827
-     * @var string $current_espresso_theme
2828
-     */
2829
-    public $current_espresso_theme;
2830
-
2831
-    /**
2832
-     * @var EE_Ticket_Selector_Config $EED_Ticket_Selector
2833
-     */
2834
-    public $EED_Ticket_Selector;
2835
-
2836
-    /**
2837
-     * @var EE_Event_Single_Config $EED_Event_Single
2838
-     */
2839
-    public $EED_Event_Single;
2840
-
2841
-    /**
2842
-     * @var EE_Events_Archive_Config $EED_Events_Archive
2843
-     */
2844
-    public $EED_Events_Archive;
2845
-
2846
-
2847
-    /**
2848
-     *    class constructor
2849
-     *
2850
-     * @access    public
2851
-     */
2852
-    public function __construct()
2853
-    {
2854
-        // set default template settings
2855
-        $this->enable_default_style = true;
2856
-        $this->custom_style_sheet = null;
2857
-        $this->display_address_in_regform = true;
2858
-        $this->display_description_on_multi_reg_page = false;
2859
-        $this->use_custom_templates = false;
2860
-        $this->current_espresso_theme = 'Espresso_Arabica_2014';
2861
-        $this->EED_Event_Single = null;
2862
-        $this->EED_Events_Archive = null;
2863
-        $this->EED_Ticket_Selector = null;
2864
-    }
2801
+	/**
2802
+	 * @var boolean $enable_default_style
2803
+	 */
2804
+	public $enable_default_style;
2805
+
2806
+	/**
2807
+	 * @var string $custom_style_sheet
2808
+	 */
2809
+	public $custom_style_sheet;
2810
+
2811
+	/**
2812
+	 * @var boolean $display_address_in_regform
2813
+	 */
2814
+	public $display_address_in_regform;
2815
+
2816
+	/**
2817
+	 * @var int $display_description_on_multi_reg_page
2818
+	 */
2819
+	public $display_description_on_multi_reg_page;
2820
+
2821
+	/**
2822
+	 * @var boolean $use_custom_templates
2823
+	 */
2824
+	public $use_custom_templates;
2825
+
2826
+	/**
2827
+	 * @var string $current_espresso_theme
2828
+	 */
2829
+	public $current_espresso_theme;
2830
+
2831
+	/**
2832
+	 * @var EE_Ticket_Selector_Config $EED_Ticket_Selector
2833
+	 */
2834
+	public $EED_Ticket_Selector;
2835
+
2836
+	/**
2837
+	 * @var EE_Event_Single_Config $EED_Event_Single
2838
+	 */
2839
+	public $EED_Event_Single;
2840
+
2841
+	/**
2842
+	 * @var EE_Events_Archive_Config $EED_Events_Archive
2843
+	 */
2844
+	public $EED_Events_Archive;
2845
+
2846
+
2847
+	/**
2848
+	 *    class constructor
2849
+	 *
2850
+	 * @access    public
2851
+	 */
2852
+	public function __construct()
2853
+	{
2854
+		// set default template settings
2855
+		$this->enable_default_style = true;
2856
+		$this->custom_style_sheet = null;
2857
+		$this->display_address_in_regform = true;
2858
+		$this->display_description_on_multi_reg_page = false;
2859
+		$this->use_custom_templates = false;
2860
+		$this->current_espresso_theme = 'Espresso_Arabica_2014';
2861
+		$this->EED_Event_Single = null;
2862
+		$this->EED_Events_Archive = null;
2863
+		$this->EED_Ticket_Selector = null;
2864
+	}
2865 2865
 }
2866 2866
 
2867 2867
 /**
@@ -2870,114 +2870,114 @@  discard block
 block discarded – undo
2870 2870
 class EE_Map_Config extends EE_Config_Base
2871 2871
 {
2872 2872
 
2873
-    /**
2874
-     * @var boolean $use_google_maps
2875
-     */
2876
-    public $use_google_maps;
2877
-
2878
-    /**
2879
-     * @var string $api_key
2880
-     */
2881
-    public $google_map_api_key;
2882
-
2883
-    /**
2884
-     * @var int $event_details_map_width
2885
-     */
2886
-    public $event_details_map_width;
2887
-
2888
-    /**
2889
-     * @var int $event_details_map_height
2890
-     */
2891
-    public $event_details_map_height;
2892
-
2893
-    /**
2894
-     * @var int $event_details_map_zoom
2895
-     */
2896
-    public $event_details_map_zoom;
2897
-
2898
-    /**
2899
-     * @var boolean $event_details_display_nav
2900
-     */
2901
-    public $event_details_display_nav;
2902
-
2903
-    /**
2904
-     * @var boolean $event_details_nav_size
2905
-     */
2906
-    public $event_details_nav_size;
2907
-
2908
-    /**
2909
-     * @var string $event_details_control_type
2910
-     */
2911
-    public $event_details_control_type;
2912
-
2913
-    /**
2914
-     * @var string $event_details_map_align
2915
-     */
2916
-    public $event_details_map_align;
2917
-
2918
-    /**
2919
-     * @var int $event_list_map_width
2920
-     */
2921
-    public $event_list_map_width;
2922
-
2923
-    /**
2924
-     * @var int $event_list_map_height
2925
-     */
2926
-    public $event_list_map_height;
2927
-
2928
-    /**
2929
-     * @var int $event_list_map_zoom
2930
-     */
2931
-    public $event_list_map_zoom;
2932
-
2933
-    /**
2934
-     * @var boolean $event_list_display_nav
2935
-     */
2936
-    public $event_list_display_nav;
2937
-
2938
-    /**
2939
-     * @var boolean $event_list_nav_size
2940
-     */
2941
-    public $event_list_nav_size;
2942
-
2943
-    /**
2944
-     * @var string $event_list_control_type
2945
-     */
2946
-    public $event_list_control_type;
2947
-
2948
-    /**
2949
-     * @var string $event_list_map_align
2950
-     */
2951
-    public $event_list_map_align;
2952
-
2953
-
2954
-    /**
2955
-     *    class constructor
2956
-     *
2957
-     * @access    public
2958
-     */
2959
-    public function __construct()
2960
-    {
2961
-        // set default map settings
2962
-        $this->use_google_maps = true;
2963
-        $this->google_map_api_key = '';
2964
-        // for event details pages (reg page)
2965
-        $this->event_details_map_width = 585;            // ee_map_width_single
2966
-        $this->event_details_map_height = 362;            // ee_map_height_single
2967
-        $this->event_details_map_zoom = 14;            // ee_map_zoom_single
2968
-        $this->event_details_display_nav = true;            // ee_map_nav_display_single
2969
-        $this->event_details_nav_size = false;            // ee_map_nav_size_single
2970
-        $this->event_details_control_type = 'default';        // ee_map_type_control_single
2971
-        $this->event_details_map_align = 'center';            // ee_map_align_single
2972
-        // for event list pages
2973
-        $this->event_list_map_width = 300;            // ee_map_width
2974
-        $this->event_list_map_height = 185;        // ee_map_height
2975
-        $this->event_list_map_zoom = 12;            // ee_map_zoom
2976
-        $this->event_list_display_nav = false;        // ee_map_nav_display
2977
-        $this->event_list_nav_size = true;            // ee_map_nav_size
2978
-        $this->event_list_control_type = 'dropdown';        // ee_map_type_control
2979
-        $this->event_list_map_align = 'center';            // ee_map_align
2980
-    }
2873
+	/**
2874
+	 * @var boolean $use_google_maps
2875
+	 */
2876
+	public $use_google_maps;
2877
+
2878
+	/**
2879
+	 * @var string $api_key
2880
+	 */
2881
+	public $google_map_api_key;
2882
+
2883
+	/**
2884
+	 * @var int $event_details_map_width
2885
+	 */
2886
+	public $event_details_map_width;
2887
+
2888
+	/**
2889
+	 * @var int $event_details_map_height
2890
+	 */
2891
+	public $event_details_map_height;
2892
+
2893
+	/**
2894
+	 * @var int $event_details_map_zoom
2895
+	 */
2896
+	public $event_details_map_zoom;
2897
+
2898
+	/**
2899
+	 * @var boolean $event_details_display_nav
2900
+	 */
2901
+	public $event_details_display_nav;
2902
+
2903
+	/**
2904
+	 * @var boolean $event_details_nav_size
2905
+	 */
2906
+	public $event_details_nav_size;
2907
+
2908
+	/**
2909
+	 * @var string $event_details_control_type
2910
+	 */
2911
+	public $event_details_control_type;
2912
+
2913
+	/**
2914
+	 * @var string $event_details_map_align
2915
+	 */
2916
+	public $event_details_map_align;
2917
+
2918
+	/**
2919
+	 * @var int $event_list_map_width
2920
+	 */
2921
+	public $event_list_map_width;
2922
+
2923
+	/**
2924
+	 * @var int $event_list_map_height
2925
+	 */
2926
+	public $event_list_map_height;
2927
+
2928
+	/**
2929
+	 * @var int $event_list_map_zoom
2930
+	 */
2931
+	public $event_list_map_zoom;
2932
+
2933
+	/**
2934
+	 * @var boolean $event_list_display_nav
2935
+	 */
2936
+	public $event_list_display_nav;
2937
+
2938
+	/**
2939
+	 * @var boolean $event_list_nav_size
2940
+	 */
2941
+	public $event_list_nav_size;
2942
+
2943
+	/**
2944
+	 * @var string $event_list_control_type
2945
+	 */
2946
+	public $event_list_control_type;
2947
+
2948
+	/**
2949
+	 * @var string $event_list_map_align
2950
+	 */
2951
+	public $event_list_map_align;
2952
+
2953
+
2954
+	/**
2955
+	 *    class constructor
2956
+	 *
2957
+	 * @access    public
2958
+	 */
2959
+	public function __construct()
2960
+	{
2961
+		// set default map settings
2962
+		$this->use_google_maps = true;
2963
+		$this->google_map_api_key = '';
2964
+		// for event details pages (reg page)
2965
+		$this->event_details_map_width = 585;            // ee_map_width_single
2966
+		$this->event_details_map_height = 362;            // ee_map_height_single
2967
+		$this->event_details_map_zoom = 14;            // ee_map_zoom_single
2968
+		$this->event_details_display_nav = true;            // ee_map_nav_display_single
2969
+		$this->event_details_nav_size = false;            // ee_map_nav_size_single
2970
+		$this->event_details_control_type = 'default';        // ee_map_type_control_single
2971
+		$this->event_details_map_align = 'center';            // ee_map_align_single
2972
+		// for event list pages
2973
+		$this->event_list_map_width = 300;            // ee_map_width
2974
+		$this->event_list_map_height = 185;        // ee_map_height
2975
+		$this->event_list_map_zoom = 12;            // ee_map_zoom
2976
+		$this->event_list_display_nav = false;        // ee_map_nav_display
2977
+		$this->event_list_nav_size = true;            // ee_map_nav_size
2978
+		$this->event_list_control_type = 'dropdown';        // ee_map_type_control
2979
+		$this->event_list_map_align = 'center';            // ee_map_align
2980
+	}
2981 2981
 }
2982 2982
 
2983 2983
 /**
@@ -2986,46 +2986,46 @@  discard block
 block discarded – undo
2986 2986
 class EE_Events_Archive_Config extends EE_Config_Base
2987 2987
 {
2988 2988
 
2989
-    public $display_status_banner;
2989
+	public $display_status_banner;
2990 2990
 
2991
-    public $display_description;
2991
+	public $display_description;
2992 2992
 
2993
-    public $display_ticket_selector;
2993
+	public $display_ticket_selector;
2994 2994
 
2995
-    public $display_datetimes;
2995
+	public $display_datetimes;
2996 2996
 
2997
-    public $display_venue;
2997
+	public $display_venue;
2998 2998
 
2999
-    public $display_expired_events;
2999
+	public $display_expired_events;
3000 3000
 
3001
-    public $use_sortable_display_order;
3001
+	public $use_sortable_display_order;
3002 3002
 
3003
-    public $display_order_tickets;
3003
+	public $display_order_tickets;
3004 3004
 
3005
-    public $display_order_datetimes;
3005
+	public $display_order_datetimes;
3006 3006
 
3007
-    public $display_order_event;
3007
+	public $display_order_event;
3008 3008
 
3009
-    public $display_order_venue;
3009
+	public $display_order_venue;
3010 3010
 
3011 3011
 
3012
-    /**
3013
-     *    class constructor
3014
-     */
3015
-    public function __construct()
3016
-    {
3017
-        $this->display_status_banner = 0;
3018
-        $this->display_description = 1;
3019
-        $this->display_ticket_selector = 0;
3020
-        $this->display_datetimes = 1;
3021
-        $this->display_venue = 0;
3022
-        $this->display_expired_events = 0;
3023
-        $this->use_sortable_display_order = false;
3024
-        $this->display_order_tickets = 100;
3025
-        $this->display_order_datetimes = 110;
3026
-        $this->display_order_event = 120;
3027
-        $this->display_order_venue = 130;
3028
-    }
3012
+	/**
3013
+	 *    class constructor
3014
+	 */
3015
+	public function __construct()
3016
+	{
3017
+		$this->display_status_banner = 0;
3018
+		$this->display_description = 1;
3019
+		$this->display_ticket_selector = 0;
3020
+		$this->display_datetimes = 1;
3021
+		$this->display_venue = 0;
3022
+		$this->display_expired_events = 0;
3023
+		$this->use_sortable_display_order = false;
3024
+		$this->display_order_tickets = 100;
3025
+		$this->display_order_datetimes = 110;
3026
+		$this->display_order_event = 120;
3027
+		$this->display_order_venue = 130;
3028
+	}
3029 3029
 }
3030 3030
 
3031 3031
 /**
@@ -3034,34 +3034,34 @@  discard block
 block discarded – undo
3034 3034
 class EE_Event_Single_Config extends EE_Config_Base
3035 3035
 {
3036 3036
 
3037
-    public $display_status_banner_single;
3037
+	public $display_status_banner_single;
3038 3038
 
3039
-    public $display_venue;
3039
+	public $display_venue;
3040 3040
 
3041
-    public $use_sortable_display_order;
3041
+	public $use_sortable_display_order;
3042 3042
 
3043
-    public $display_order_tickets;
3043
+	public $display_order_tickets;
3044 3044
 
3045
-    public $display_order_datetimes;
3045
+	public $display_order_datetimes;
3046 3046
 
3047
-    public $display_order_event;
3047
+	public $display_order_event;
3048 3048
 
3049
-    public $display_order_venue;
3049
+	public $display_order_venue;
3050 3050
 
3051 3051
 
3052
-    /**
3053
-     *    class constructor
3054
-     */
3055
-    public function __construct()
3056
-    {
3057
-        $this->display_status_banner_single = 0;
3058
-        $this->display_venue = 1;
3059
-        $this->use_sortable_display_order = false;
3060
-        $this->display_order_tickets = 100;
3061
-        $this->display_order_datetimes = 110;
3062
-        $this->display_order_event = 120;
3063
-        $this->display_order_venue = 130;
3064
-    }
3052
+	/**
3053
+	 *    class constructor
3054
+	 */
3055
+	public function __construct()
3056
+	{
3057
+		$this->display_status_banner_single = 0;
3058
+		$this->display_venue = 1;
3059
+		$this->use_sortable_display_order = false;
3060
+		$this->display_order_tickets = 100;
3061
+		$this->display_order_datetimes = 110;
3062
+		$this->display_order_event = 120;
3063
+		$this->display_order_venue = 130;
3064
+	}
3065 3065
 }
3066 3066
 
3067 3067
 /**
@@ -3070,172 +3070,172 @@  discard block
 block discarded – undo
3070 3070
 class EE_Ticket_Selector_Config extends EE_Config_Base
3071 3071
 {
3072 3072
 
3073
-    /**
3074
-     * constant to indicate that a datetime selector should NEVER be shown for ticket selectors
3075
-     */
3076
-    const DO_NOT_SHOW_DATETIME_SELECTOR = 'no_datetime_selector';
3077
-
3078
-    /**
3079
-     * constant to indicate that a datetime selector should only be shown for ticket selectors
3080
-     * when the number of datetimes for the event matches the value set for $datetime_selector_threshold
3081
-     */
3082
-    const MAYBE_SHOW_DATETIME_SELECTOR = 'maybe_datetime_selector';
3083
-
3084
-    /**
3085
-     * @var boolean $show_ticket_sale_columns
3086
-     */
3087
-    public $show_ticket_sale_columns;
3088
-
3089
-    /**
3090
-     * @var boolean $show_ticket_details
3091
-     */
3092
-    public $show_ticket_details;
3093
-
3094
-    /**
3095
-     * @var boolean $show_expired_tickets
3096
-     */
3097
-    public $show_expired_tickets;
3098
-
3099
-    /**
3100
-     * whether or not to display a dropdown box populated with event datetimes
3101
-     * that toggles which tickets are displayed for a ticket selector.
3102
-     * uses one of the *_DATETIME_SELECTOR constants defined above
3103
-     *
3104
-     * @var string $show_datetime_selector
3105
-     */
3106
-    private $show_datetime_selector = 'no_datetime_selector';
3107
-
3108
-    /**
3109
-     * the number of datetimes an event has to have before conditionally displaying a datetime selector
3110
-     *
3111
-     * @var int $datetime_selector_threshold
3112
-     */
3113
-    private $datetime_selector_threshold = 3;
3114
-
3115
-    /**
3116
-     * determines the maximum number of "checked" dates in the date and time filter
3117
-     *
3118
-     * @var int $datetime_selector_checked
3119
-     */
3120
-    private $datetime_selector_max_checked = 10;
3121
-
3122
-
3123
-    /**
3124
-     *    class constructor
3125
-     */
3126
-    public function __construct()
3127
-    {
3128
-        $this->show_ticket_sale_columns = true;
3129
-        $this->show_ticket_details = true;
3130
-        $this->show_expired_tickets = true;
3131
-        $this->show_datetime_selector = EE_Ticket_Selector_Config::DO_NOT_SHOW_DATETIME_SELECTOR;
3132
-        $this->datetime_selector_threshold = 3;
3133
-        $this->datetime_selector_max_checked = 10;
3134
-    }
3135
-
3136
-
3137
-    /**
3138
-     * returns true if a datetime selector should be displayed
3139
-     *
3140
-     * @param array $datetimes
3141
-     * @return bool
3142
-     */
3143
-    public function showDatetimeSelector(array $datetimes)
3144
-    {
3145
-        // if the settings are NOT: don't show OR below threshold, THEN active = true
3146
-        return ! (
3147
-            $this->getShowDatetimeSelector() === EE_Ticket_Selector_Config::DO_NOT_SHOW_DATETIME_SELECTOR
3148
-            || (
3149
-                $this->getShowDatetimeSelector() === EE_Ticket_Selector_Config::MAYBE_SHOW_DATETIME_SELECTOR
3150
-                && count($datetimes) < $this->getDatetimeSelectorThreshold()
3151
-            )
3152
-        );
3153
-    }
3154
-
3155
-
3156
-    /**
3157
-     * @return string
3158
-     */
3159
-    public function getShowDatetimeSelector()
3160
-    {
3161
-        return $this->show_datetime_selector;
3162
-    }
3163
-
3164
-
3165
-    /**
3166
-     * @param bool $keys_only
3167
-     * @return array
3168
-     */
3169
-    public function getShowDatetimeSelectorOptions($keys_only = true)
3170
-    {
3171
-        return $keys_only
3172
-            ? array(
3173
-                EE_Ticket_Selector_Config::DO_NOT_SHOW_DATETIME_SELECTOR,
3174
-                EE_Ticket_Selector_Config::MAYBE_SHOW_DATETIME_SELECTOR,
3175
-            )
3176
-            : array(
3177
-                EE_Ticket_Selector_Config::DO_NOT_SHOW_DATETIME_SELECTOR => esc_html__(
3178
-                    'Do not show date & time filter',
3179
-                    'event_espresso'
3180
-                ),
3181
-                EE_Ticket_Selector_Config::MAYBE_SHOW_DATETIME_SELECTOR  => esc_html__(
3182
-                    'Maybe show date & time filter',
3183
-                    'event_espresso'
3184
-                ),
3185
-            );
3186
-    }
3187
-
3188
-
3189
-    /**
3190
-     * @param string $show_datetime_selector
3191
-     */
3192
-    public function setShowDatetimeSelector($show_datetime_selector)
3193
-    {
3194
-        $this->show_datetime_selector = in_array(
3195
-            $show_datetime_selector,
3196
-            $this->getShowDatetimeSelectorOptions(),
3197
-            true
3198
-        )
3199
-            ? $show_datetime_selector
3200
-            : EE_Ticket_Selector_Config::DO_NOT_SHOW_DATETIME_SELECTOR;
3201
-    }
3202
-
3203
-
3204
-    /**
3205
-     * @return int
3206
-     */
3207
-    public function getDatetimeSelectorThreshold()
3208
-    {
3209
-        return $this->datetime_selector_threshold;
3210
-    }
3211
-
3212
-
3213
-    /**
3214
-     * @param int $datetime_selector_threshold
3215
-     */
3216
-    public function setDatetimeSelectorThreshold($datetime_selector_threshold)
3217
-    {
3218
-        $datetime_selector_threshold = absint($datetime_selector_threshold);
3219
-        $this->datetime_selector_threshold = $datetime_selector_threshold ? $datetime_selector_threshold : 3;
3220
-    }
3221
-
3222
-
3223
-    /**
3224
-     * @return int
3225
-     */
3226
-    public function getDatetimeSelectorMaxChecked()
3227
-    {
3228
-        return $this->datetime_selector_max_checked;
3229
-    }
3230
-
3231
-
3232
-    /**
3233
-     * @param int $datetime_selector_max_checked
3234
-     */
3235
-    public function setDatetimeSelectorMaxChecked($datetime_selector_max_checked)
3236
-    {
3237
-        $this->datetime_selector_max_checked = absint($datetime_selector_max_checked);
3238
-    }
3073
+	/**
3074
+	 * constant to indicate that a datetime selector should NEVER be shown for ticket selectors
3075
+	 */
3076
+	const DO_NOT_SHOW_DATETIME_SELECTOR = 'no_datetime_selector';
3077
+
3078
+	/**
3079
+	 * constant to indicate that a datetime selector should only be shown for ticket selectors
3080
+	 * when the number of datetimes for the event matches the value set for $datetime_selector_threshold
3081
+	 */
3082
+	const MAYBE_SHOW_DATETIME_SELECTOR = 'maybe_datetime_selector';
3083
+
3084
+	/**
3085
+	 * @var boolean $show_ticket_sale_columns
3086
+	 */
3087
+	public $show_ticket_sale_columns;
3088
+
3089
+	/**
3090
+	 * @var boolean $show_ticket_details
3091
+	 */
3092
+	public $show_ticket_details;
3093
+
3094
+	/**
3095
+	 * @var boolean $show_expired_tickets
3096
+	 */
3097
+	public $show_expired_tickets;
3098
+
3099
+	/**
3100
+	 * whether or not to display a dropdown box populated with event datetimes
3101
+	 * that toggles which tickets are displayed for a ticket selector.
3102
+	 * uses one of the *_DATETIME_SELECTOR constants defined above
3103
+	 *
3104
+	 * @var string $show_datetime_selector
3105
+	 */
3106
+	private $show_datetime_selector = 'no_datetime_selector';
3107
+
3108
+	/**
3109
+	 * the number of datetimes an event has to have before conditionally displaying a datetime selector
3110
+	 *
3111
+	 * @var int $datetime_selector_threshold
3112
+	 */
3113
+	private $datetime_selector_threshold = 3;
3114
+
3115
+	/**
3116
+	 * determines the maximum number of "checked" dates in the date and time filter
3117
+	 *
3118
+	 * @var int $datetime_selector_checked
3119
+	 */
3120
+	private $datetime_selector_max_checked = 10;
3121
+
3122
+
3123
+	/**
3124
+	 *    class constructor
3125
+	 */
3126
+	public function __construct()
3127
+	{
3128
+		$this->show_ticket_sale_columns = true;
3129
+		$this->show_ticket_details = true;
3130
+		$this->show_expired_tickets = true;
3131
+		$this->show_datetime_selector = EE_Ticket_Selector_Config::DO_NOT_SHOW_DATETIME_SELECTOR;
3132
+		$this->datetime_selector_threshold = 3;
3133
+		$this->datetime_selector_max_checked = 10;
3134
+	}
3135
+
3136
+
3137
+	/**
3138
+	 * returns true if a datetime selector should be displayed
3139
+	 *
3140
+	 * @param array $datetimes
3141
+	 * @return bool
3142
+	 */
3143
+	public function showDatetimeSelector(array $datetimes)
3144
+	{
3145
+		// if the settings are NOT: don't show OR below threshold, THEN active = true
3146
+		return ! (
3147
+			$this->getShowDatetimeSelector() === EE_Ticket_Selector_Config::DO_NOT_SHOW_DATETIME_SELECTOR
3148
+			|| (
3149
+				$this->getShowDatetimeSelector() === EE_Ticket_Selector_Config::MAYBE_SHOW_DATETIME_SELECTOR
3150
+				&& count($datetimes) < $this->getDatetimeSelectorThreshold()
3151
+			)
3152
+		);
3153
+	}
3154
+
3155
+
3156
+	/**
3157
+	 * @return string
3158
+	 */
3159
+	public function getShowDatetimeSelector()
3160
+	{
3161
+		return $this->show_datetime_selector;
3162
+	}
3163
+
3164
+
3165
+	/**
3166
+	 * @param bool $keys_only
3167
+	 * @return array
3168
+	 */
3169
+	public function getShowDatetimeSelectorOptions($keys_only = true)
3170
+	{
3171
+		return $keys_only
3172
+			? array(
3173
+				EE_Ticket_Selector_Config::DO_NOT_SHOW_DATETIME_SELECTOR,
3174
+				EE_Ticket_Selector_Config::MAYBE_SHOW_DATETIME_SELECTOR,
3175
+			)
3176
+			: array(
3177
+				EE_Ticket_Selector_Config::DO_NOT_SHOW_DATETIME_SELECTOR => esc_html__(
3178
+					'Do not show date & time filter',
3179
+					'event_espresso'
3180
+				),
3181
+				EE_Ticket_Selector_Config::MAYBE_SHOW_DATETIME_SELECTOR  => esc_html__(
3182
+					'Maybe show date & time filter',
3183
+					'event_espresso'
3184
+				),
3185
+			);
3186
+	}
3187
+
3188
+
3189
+	/**
3190
+	 * @param string $show_datetime_selector
3191
+	 */
3192
+	public function setShowDatetimeSelector($show_datetime_selector)
3193
+	{
3194
+		$this->show_datetime_selector = in_array(
3195
+			$show_datetime_selector,
3196
+			$this->getShowDatetimeSelectorOptions(),
3197
+			true
3198
+		)
3199
+			? $show_datetime_selector
3200
+			: EE_Ticket_Selector_Config::DO_NOT_SHOW_DATETIME_SELECTOR;
3201
+	}
3202
+
3203
+
3204
+	/**
3205
+	 * @return int
3206
+	 */
3207
+	public function getDatetimeSelectorThreshold()
3208
+	{
3209
+		return $this->datetime_selector_threshold;
3210
+	}
3211
+
3212
+
3213
+	/**
3214
+	 * @param int $datetime_selector_threshold
3215
+	 */
3216
+	public function setDatetimeSelectorThreshold($datetime_selector_threshold)
3217
+	{
3218
+		$datetime_selector_threshold = absint($datetime_selector_threshold);
3219
+		$this->datetime_selector_threshold = $datetime_selector_threshold ? $datetime_selector_threshold : 3;
3220
+	}
3221
+
3222
+
3223
+	/**
3224
+	 * @return int
3225
+	 */
3226
+	public function getDatetimeSelectorMaxChecked()
3227
+	{
3228
+		return $this->datetime_selector_max_checked;
3229
+	}
3230
+
3231
+
3232
+	/**
3233
+	 * @param int $datetime_selector_max_checked
3234
+	 */
3235
+	public function setDatetimeSelectorMaxChecked($datetime_selector_max_checked)
3236
+	{
3237
+		$this->datetime_selector_max_checked = absint($datetime_selector_max_checked);
3238
+	}
3239 3239
 }
3240 3240
 
3241 3241
 /**
@@ -3248,87 +3248,87 @@  discard block
 block discarded – undo
3248 3248
 class EE_Environment_Config extends EE_Config_Base
3249 3249
 {
3250 3250
 
3251
-    /**
3252
-     * Hold any php environment variables that we want to track.
3253
-     *
3254
-     * @var stdClass;
3255
-     */
3256
-    public $php;
3257
-
3258
-
3259
-    /**
3260
-     *    constructor
3261
-     */
3262
-    public function __construct()
3263
-    {
3264
-        $this->php = new stdClass();
3265
-        $this->_set_php_values();
3266
-    }
3267
-
3268
-
3269
-    /**
3270
-     * This sets the php environment variables.
3271
-     *
3272
-     * @since 4.4.0
3273
-     * @return void
3274
-     */
3275
-    protected function _set_php_values()
3276
-    {
3277
-        $this->php->max_input_vars = ini_get('max_input_vars');
3278
-        $this->php->version = phpversion();
3279
-    }
3280
-
3281
-
3282
-    /**
3283
-     * helper method for determining whether input_count is
3284
-     * reaching the potential maximum the server can handle
3285
-     * according to max_input_vars
3286
-     *
3287
-     * @param int   $input_count the count of input vars.
3288
-     * @return array {
3289
-     *                           An array that represents whether available space and if no available space the error
3290
-     *                           message.
3291
-     * @type bool   $has_space   whether more inputs can be added.
3292
-     * @type string $msg         Any message to be displayed.
3293
-     *                           }
3294
-     */
3295
-    public function max_input_vars_limit_check($input_count = 0)
3296
-    {
3297
-        if (
3298
-            ! empty($this->php->max_input_vars)
3299
-            && ($input_count >= $this->php->max_input_vars)
3300
-        ) {
3301
-            // check the server setting because the config value could be stale
3302
-            $max_input_vars = ini_get('max_input_vars');
3303
-            if ($input_count >= $max_input_vars) {
3304
-                return sprintf(
3305
-                    esc_html__(
3306
-                        '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.',
3307
-                        'event_espresso'
3308
-                    ),
3309
-                    '<br>',
3310
-                    $input_count,
3311
-                    $max_input_vars
3312
-                );
3313
-            } else {
3314
-                return '';
3315
-            }
3316
-        } else {
3317
-            return '';
3318
-        }
3319
-    }
3320
-
3321
-
3322
-    /**
3323
-     * The purpose of this method is just to force rechecking php values so if they've changed, they get updated.
3324
-     *
3325
-     * @since 4.4.1
3326
-     * @return void
3327
-     */
3328
-    public function recheck_values()
3329
-    {
3330
-        $this->_set_php_values();
3331
-    }
3251
+	/**
3252
+	 * Hold any php environment variables that we want to track.
3253
+	 *
3254
+	 * @var stdClass;
3255
+	 */
3256
+	public $php;
3257
+
3258
+
3259
+	/**
3260
+	 *    constructor
3261
+	 */
3262
+	public function __construct()
3263
+	{
3264
+		$this->php = new stdClass();
3265
+		$this->_set_php_values();
3266
+	}
3267
+
3268
+
3269
+	/**
3270
+	 * This sets the php environment variables.
3271
+	 *
3272
+	 * @since 4.4.0
3273
+	 * @return void
3274
+	 */
3275
+	protected function _set_php_values()
3276
+	{
3277
+		$this->php->max_input_vars = ini_get('max_input_vars');
3278
+		$this->php->version = phpversion();
3279
+	}
3280
+
3281
+
3282
+	/**
3283
+	 * helper method for determining whether input_count is
3284
+	 * reaching the potential maximum the server can handle
3285
+	 * according to max_input_vars
3286
+	 *
3287
+	 * @param int   $input_count the count of input vars.
3288
+	 * @return array {
3289
+	 *                           An array that represents whether available space and if no available space the error
3290
+	 *                           message.
3291
+	 * @type bool   $has_space   whether more inputs can be added.
3292
+	 * @type string $msg         Any message to be displayed.
3293
+	 *                           }
3294
+	 */
3295
+	public function max_input_vars_limit_check($input_count = 0)
3296
+	{
3297
+		if (
3298
+			! empty($this->php->max_input_vars)
3299
+			&& ($input_count >= $this->php->max_input_vars)
3300
+		) {
3301
+			// check the server setting because the config value could be stale
3302
+			$max_input_vars = ini_get('max_input_vars');
3303
+			if ($input_count >= $max_input_vars) {
3304
+				return sprintf(
3305
+					esc_html__(
3306
+						'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.',
3307
+						'event_espresso'
3308
+					),
3309
+					'<br>',
3310
+					$input_count,
3311
+					$max_input_vars
3312
+				);
3313
+			} else {
3314
+				return '';
3315
+			}
3316
+		} else {
3317
+			return '';
3318
+		}
3319
+	}
3320
+
3321
+
3322
+	/**
3323
+	 * The purpose of this method is just to force rechecking php values so if they've changed, they get updated.
3324
+	 *
3325
+	 * @since 4.4.1
3326
+	 * @return void
3327
+	 */
3328
+	public function recheck_values()
3329
+	{
3330
+		$this->_set_php_values();
3331
+	}
3332 3332
 }
3333 3333
 
3334 3334
 /**
@@ -3341,21 +3341,21 @@  discard block
 block discarded – undo
3341 3341
 class EE_Tax_Config extends EE_Config_Base
3342 3342
 {
3343 3343
 
3344
-    /*
3344
+	/*
3345 3345
      * flag to indicate whether or not to display ticket prices with the taxes included
3346 3346
      *
3347 3347
      * @var boolean $prices_displayed_including_taxes
3348 3348
      */
3349
-    public $prices_displayed_including_taxes;
3349
+	public $prices_displayed_including_taxes;
3350 3350
 
3351 3351
 
3352
-    /**
3353
-     *    class constructor
3354
-     */
3355
-    public function __construct()
3356
-    {
3357
-        $this->prices_displayed_including_taxes = true;
3358
-    }
3352
+	/**
3353
+	 *    class constructor
3354
+	 */
3355
+	public function __construct()
3356
+	{
3357
+		$this->prices_displayed_including_taxes = true;
3358
+	}
3359 3359
 }
3360 3360
 
3361 3361
 /**
@@ -3369,19 +3369,19 @@  discard block
 block discarded – undo
3369 3369
 class EE_Messages_Config extends EE_Config_Base
3370 3370
 {
3371 3371
 
3372
-    /**
3373
-     * This is an integer representing the deletion threshold in months for when old messages will get deleted.
3374
-     * A value of 0 represents never deleting.  Default is 0.
3375
-     *
3376
-     * @var integer
3377
-     */
3378
-    public $delete_threshold;
3372
+	/**
3373
+	 * This is an integer representing the deletion threshold in months for when old messages will get deleted.
3374
+	 * A value of 0 represents never deleting.  Default is 0.
3375
+	 *
3376
+	 * @var integer
3377
+	 */
3378
+	public $delete_threshold;
3379 3379
 
3380 3380
 
3381
-    public function __construct()
3382
-    {
3383
-        $this->delete_threshold = 0;
3384
-    }
3381
+	public function __construct()
3382
+	{
3383
+		$this->delete_threshold = 0;
3384
+	}
3385 3385
 }
3386 3386
 
3387 3387
 /**
@@ -3392,31 +3392,31 @@  discard block
 block discarded – undo
3392 3392
 class EE_Gateway_Config extends EE_Config_Base
3393 3393
 {
3394 3394
 
3395
-    /**
3396
-     * Array with keys that are payment gateways slugs, and values are arrays
3397
-     * with any config info the gateway wants to store
3398
-     *
3399
-     * @var array
3400
-     */
3401
-    public $payment_settings;
3402
-
3403
-    /**
3404
-     * Where keys are gateway slugs, and values are booleans indicating whether or not
3405
-     * the gateway is stored in the uploads directory
3406
-     *
3407
-     * @var array
3408
-     */
3409
-    public $active_gateways;
3410
-
3411
-
3412
-    /**
3413
-     *    class constructor
3414
-     *
3415
-     * @deprecated
3416
-     */
3417
-    public function __construct()
3418
-    {
3419
-        $this->payment_settings = array();
3420
-        $this->active_gateways = array('Invoice' => false);
3421
-    }
3395
+	/**
3396
+	 * Array with keys that are payment gateways slugs, and values are arrays
3397
+	 * with any config info the gateway wants to store
3398
+	 *
3399
+	 * @var array
3400
+	 */
3401
+	public $payment_settings;
3402
+
3403
+	/**
3404
+	 * Where keys are gateway slugs, and values are booleans indicating whether or not
3405
+	 * the gateway is stored in the uploads directory
3406
+	 *
3407
+	 * @var array
3408
+	 */
3409
+	public $active_gateways;
3410
+
3411
+
3412
+	/**
3413
+	 *    class constructor
3414
+	 *
3415
+	 * @deprecated
3416
+	 */
3417
+	public function __construct()
3418
+	{
3419
+		$this->payment_settings = array();
3420
+		$this->active_gateways = array('Invoice' => false);
3421
+	}
3422 3422
 }
Please login to merge, or discard this patch.
Spacing   +111 added lines, -111 removed lines patch added patch discarded remove patch
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
     public static function instance()
152 152
     {
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 156
         }
157 157
         return self::$_instance;
@@ -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
 
@@ -2163,24 +2163,24 @@  discard block
 block discarded – undo
2163 2163
 
2164 2164
         /** @var TableAnalysis $table_analysis */
2165 2165
         $table_analysis = EE_Registry::instance()->create('TableAnalysis', [], true);
2166
-        if (! $table_analysis->tableExists(EE_Registry::instance()->load_model('Country')->table())) {
2166
+        if ( ! $table_analysis->tableExists(EE_Registry::instance()->load_model('Country')->table())) {
2167 2167
             return;
2168 2168
         }
2169 2169
         // retrieve the country settings from the db, just in case they have been customized
2170 2170
         $country = EE_Registry::instance()->load_model('Country')->get_one_by_ID($CNT_ISO);
2171
-        if (! $country instanceof EE_Country) {
2171
+        if ( ! $country instanceof EE_Country) {
2172 2172
             throw new DomainException(
2173 2173
                 esc_html__('Invalid Country ISO Code.', 'event_espresso')
2174 2174
             );
2175 2175
         }
2176
-        $this->code    = $country->currency_code();                  // currency code: USD, CAD, EUR
2177
-        $this->name    = $country->currency_name_single();           // Dollar
2178
-        $this->plural  = $country->currency_name_plural();           // Dollars
2179
-        $this->sign    = $country->currency_sign();                  // currency sign: $
2180
-        $this->sign_b4 = $country->currency_sign_before();           // currency sign before or after
2181
-        $this->dec_plc = $country->currency_decimal_places();        // decimal places: 2 = 0.00  3 = 0.000
2182
-        $this->dec_mrk = $country->currency_decimal_mark();          // decimal mark: ',' = 0,01 or '.' = 0.01
2183
-        $this->thsnds  = $country->currency_thousands_separator();   // thousands sep: ',' = 1,000 or '.' = 1.000
2176
+        $this->code    = $country->currency_code(); // currency code: USD, CAD, EUR
2177
+        $this->name    = $country->currency_name_single(); // Dollar
2178
+        $this->plural  = $country->currency_name_plural(); // Dollars
2179
+        $this->sign    = $country->currency_sign(); // currency sign: $
2180
+        $this->sign_b4 = $country->currency_sign_before(); // currency sign before or after
2181
+        $this->dec_plc = $country->currency_decimal_places(); // decimal places: 2 = 0.00  3 = 0.000
2182
+        $this->dec_mrk = $country->currency_decimal_mark(); // decimal mark: ',' = 0,01 or '.' = 0.01
2183
+        $this->thsnds  = $country->currency_thousands_separator(); // thousands sep: ',' = 1,000 or '.' = 1.000
2184 2184
     }
2185 2185
 
2186 2186
 
@@ -2485,8 +2485,8 @@  discard block
 block discarded – undo
2485 2485
             $closing_a_tag = '';
2486 2486
             if (function_exists('get_privacy_policy_url')) {
2487 2487
                 $privacy_page_url = get_privacy_policy_url();
2488
-                if (! empty($privacy_page_url)) {
2489
-                    $opening_a_tag = '<a href="' . $privacy_page_url . '" target="_blank">';
2488
+                if ( ! empty($privacy_page_url)) {
2489
+                    $opening_a_tag = '<a href="'.$privacy_page_url.'" target="_blank">';
2490 2490
                     $closing_a_tag = '</a>';
2491 2491
                 }
2492 2492
             }
@@ -2718,7 +2718,7 @@  discard block
 block discarded – undo
2718 2718
     public function log_file_name($reset = false)
2719 2719
     {
2720 2720
         if (empty($this->log_file_name) || $reset) {
2721
-            $this->log_file_name = sanitize_key('espresso_log_' . md5(uniqid('', true))) . '.txt';
2721
+            $this->log_file_name = sanitize_key('espresso_log_'.md5(uniqid('', true))).'.txt';
2722 2722
             EE_Config::instance()->update_espresso_config(false, false);
2723 2723
         }
2724 2724
         return $this->log_file_name;
@@ -2732,7 +2732,7 @@  discard block
 block discarded – undo
2732 2732
     public function debug_file_name($reset = false)
2733 2733
     {
2734 2734
         if (empty($this->debug_file_name) || $reset) {
2735
-            $this->debug_file_name = sanitize_key('espresso_debug_' . md5(uniqid('', true))) . '.txt';
2735
+            $this->debug_file_name = sanitize_key('espresso_debug_'.md5(uniqid('', true))).'.txt';
2736 2736
             EE_Config::instance()->update_espresso_config(false, false);
2737 2737
         }
2738 2738
         return $this->debug_file_name;
@@ -2962,21 +2962,21 @@  discard block
 block discarded – undo
2962 2962
         $this->use_google_maps = true;
2963 2963
         $this->google_map_api_key = '';
2964 2964
         // for event details pages (reg page)
2965
-        $this->event_details_map_width = 585;            // ee_map_width_single
2966
-        $this->event_details_map_height = 362;            // ee_map_height_single
2967
-        $this->event_details_map_zoom = 14;            // ee_map_zoom_single
2968
-        $this->event_details_display_nav = true;            // ee_map_nav_display_single
2969
-        $this->event_details_nav_size = false;            // ee_map_nav_size_single
2970
-        $this->event_details_control_type = 'default';        // ee_map_type_control_single
2971
-        $this->event_details_map_align = 'center';            // ee_map_align_single
2965
+        $this->event_details_map_width = 585; // ee_map_width_single
2966
+        $this->event_details_map_height = 362; // ee_map_height_single
2967
+        $this->event_details_map_zoom = 14; // ee_map_zoom_single
2968
+        $this->event_details_display_nav = true; // ee_map_nav_display_single
2969
+        $this->event_details_nav_size = false; // ee_map_nav_size_single
2970
+        $this->event_details_control_type = 'default'; // ee_map_type_control_single
2971
+        $this->event_details_map_align = 'center'; // ee_map_align_single
2972 2972
         // for event list pages
2973
-        $this->event_list_map_width = 300;            // ee_map_width
2974
-        $this->event_list_map_height = 185;        // ee_map_height
2975
-        $this->event_list_map_zoom = 12;            // ee_map_zoom
2976
-        $this->event_list_display_nav = false;        // ee_map_nav_display
2977
-        $this->event_list_nav_size = true;            // ee_map_nav_size
2978
-        $this->event_list_control_type = 'dropdown';        // ee_map_type_control
2979
-        $this->event_list_map_align = 'center';            // ee_map_align
2973
+        $this->event_list_map_width = 300; // ee_map_width
2974
+        $this->event_list_map_height = 185; // ee_map_height
2975
+        $this->event_list_map_zoom = 12; // ee_map_zoom
2976
+        $this->event_list_display_nav = false; // ee_map_nav_display
2977
+        $this->event_list_nav_size = true; // ee_map_nav_size
2978
+        $this->event_list_control_type = 'dropdown'; // ee_map_type_control
2979
+        $this->event_list_map_align = 'center'; // ee_map_align
2980 2980
     }
2981 2981
 }
2982 2982
 
Please login to merge, or discard this patch.