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