@@ -17,38 +17,38 @@ |
||
17 | 17 | { |
18 | 18 | |
19 | 19 | |
20 | - /** |
|
21 | - * @type \EventEspresso\core\Psr4Autoloader |
|
22 | - */ |
|
23 | - protected static $psr4_loader; |
|
24 | - |
|
25 | - |
|
26 | - /** |
|
27 | - * @return \EventEspresso\core\Psr4Autoloader |
|
28 | - */ |
|
29 | - public function initializeAutoloader() |
|
30 | - { |
|
31 | - static $initialized = false; |
|
32 | - if (! $initialized) { |
|
33 | - // instantiate PSR4 autoloader |
|
34 | - espresso_load_required('Psr4Autoloader', EE_CORE . 'Psr4Autoloader.php'); |
|
35 | - EE_Psr4AutoloaderInit::$psr4_loader = new Psr4Autoloader(); |
|
36 | - // register the autoloader |
|
37 | - EE_Psr4AutoloaderInit::$psr4_loader->register(); |
|
38 | - // register the base directories for the namespace prefix |
|
39 | - EE_Psr4AutoloaderInit::$psr4_loader->addNamespace('EventEspresso', EE_PLUGIN_DIR_PATH); |
|
40 | - EE_Psr4AutoloaderInit::$psr4_loader->addNamespace('EventEspressoBatchRequest', EE_LIBRARIES . 'batch'); |
|
41 | - EE_Psr4AutoloaderInit::$psr4_loader->addNamespace('EventEspressoVendor', EE_THIRD_PARTY); |
|
42 | - $initialized = true; |
|
43 | - } |
|
44 | - } |
|
45 | - |
|
46 | - |
|
47 | - /** |
|
48 | - * @return \EventEspresso\core\Psr4Autoloader |
|
49 | - */ |
|
50 | - public static function psr4_loader() |
|
51 | - { |
|
52 | - return self::$psr4_loader; |
|
53 | - } |
|
20 | + /** |
|
21 | + * @type \EventEspresso\core\Psr4Autoloader |
|
22 | + */ |
|
23 | + protected static $psr4_loader; |
|
24 | + |
|
25 | + |
|
26 | + /** |
|
27 | + * @return \EventEspresso\core\Psr4Autoloader |
|
28 | + */ |
|
29 | + public function initializeAutoloader() |
|
30 | + { |
|
31 | + static $initialized = false; |
|
32 | + if (! $initialized) { |
|
33 | + // instantiate PSR4 autoloader |
|
34 | + espresso_load_required('Psr4Autoloader', EE_CORE . 'Psr4Autoloader.php'); |
|
35 | + EE_Psr4AutoloaderInit::$psr4_loader = new Psr4Autoloader(); |
|
36 | + // register the autoloader |
|
37 | + EE_Psr4AutoloaderInit::$psr4_loader->register(); |
|
38 | + // register the base directories for the namespace prefix |
|
39 | + EE_Psr4AutoloaderInit::$psr4_loader->addNamespace('EventEspresso', EE_PLUGIN_DIR_PATH); |
|
40 | + EE_Psr4AutoloaderInit::$psr4_loader->addNamespace('EventEspressoBatchRequest', EE_LIBRARIES . 'batch'); |
|
41 | + EE_Psr4AutoloaderInit::$psr4_loader->addNamespace('EventEspressoVendor', EE_THIRD_PARTY); |
|
42 | + $initialized = true; |
|
43 | + } |
|
44 | + } |
|
45 | + |
|
46 | + |
|
47 | + /** |
|
48 | + * @return \EventEspresso\core\Psr4Autoloader |
|
49 | + */ |
|
50 | + public static function psr4_loader() |
|
51 | + { |
|
52 | + return self::$psr4_loader; |
|
53 | + } |
|
54 | 54 | } |
@@ -29,15 +29,15 @@ |
||
29 | 29 | public function initializeAutoloader() |
30 | 30 | { |
31 | 31 | static $initialized = false; |
32 | - if (! $initialized) { |
|
32 | + if ( ! $initialized) { |
|
33 | 33 | // instantiate PSR4 autoloader |
34 | - espresso_load_required('Psr4Autoloader', EE_CORE . 'Psr4Autoloader.php'); |
|
34 | + espresso_load_required('Psr4Autoloader', EE_CORE.'Psr4Autoloader.php'); |
|
35 | 35 | EE_Psr4AutoloaderInit::$psr4_loader = new Psr4Autoloader(); |
36 | 36 | // register the autoloader |
37 | 37 | EE_Psr4AutoloaderInit::$psr4_loader->register(); |
38 | 38 | // register the base directories for the namespace prefix |
39 | 39 | EE_Psr4AutoloaderInit::$psr4_loader->addNamespace('EventEspresso', EE_PLUGIN_DIR_PATH); |
40 | - EE_Psr4AutoloaderInit::$psr4_loader->addNamespace('EventEspressoBatchRequest', EE_LIBRARIES . 'batch'); |
|
40 | + EE_Psr4AutoloaderInit::$psr4_loader->addNamespace('EventEspressoBatchRequest', EE_LIBRARIES.'batch'); |
|
41 | 41 | EE_Psr4AutoloaderInit::$psr4_loader->addNamespace('EventEspressoVendor', EE_THIRD_PARTY); |
42 | 42 | $initialized = true; |
43 | 43 | } |
@@ -16,98 +16,98 @@ |
||
16 | 16 | abstract class EE_Object_Repository extends EE_Object_Collection implements EEI_Repository |
17 | 17 | { |
18 | 18 | |
19 | - /** |
|
20 | - * default persist method called on repository objects if none supplied |
|
21 | - * |
|
22 | - * @type string $persist_method |
|
23 | - */ |
|
24 | - protected $persist_method; |
|
19 | + /** |
|
20 | + * default persist method called on repository objects if none supplied |
|
21 | + * |
|
22 | + * @type string $persist_method |
|
23 | + */ |
|
24 | + protected $persist_method; |
|
25 | 25 | |
26 | 26 | |
27 | - /** |
|
28 | - * _call_user_func_array_on_current |
|
29 | - * |
|
30 | - * calls the supplied callback method name on the current repository object, |
|
31 | - * an array of arguments can also be supplied that will be passed along to the callback method, |
|
32 | - * where each element of the $arguments array corresponds to a parameter for the callback method |
|
33 | - * PLZ NOTE: if the first argument of the callback requires an array, for example array( 'key' => 'value' ) |
|
34 | - * then $arguments needs to be a DOUBLE array ie: array( array( 'key' => 'value' ) ) |
|
35 | - * |
|
36 | - * @access public |
|
37 | - * @param string $callback name of method found on object to be called. |
|
38 | - * @param array $arguments arrays of arguments that will be passed to the object's callback method |
|
39 | - * @return bool | int |
|
40 | - */ |
|
41 | - protected function _call_user_func_array_on_current($callback = '', $arguments = array()) |
|
42 | - { |
|
43 | - if ($callback !== '' && method_exists($this->current(), $callback)) { |
|
44 | - return call_user_func_array(array($this->current(), $callback), $arguments); |
|
45 | - } |
|
46 | - return false; |
|
47 | - } |
|
27 | + /** |
|
28 | + * _call_user_func_array_on_current |
|
29 | + * |
|
30 | + * calls the supplied callback method name on the current repository object, |
|
31 | + * an array of arguments can also be supplied that will be passed along to the callback method, |
|
32 | + * where each element of the $arguments array corresponds to a parameter for the callback method |
|
33 | + * PLZ NOTE: if the first argument of the callback requires an array, for example array( 'key' => 'value' ) |
|
34 | + * then $arguments needs to be a DOUBLE array ie: array( array( 'key' => 'value' ) ) |
|
35 | + * |
|
36 | + * @access public |
|
37 | + * @param string $callback name of method found on object to be called. |
|
38 | + * @param array $arguments arrays of arguments that will be passed to the object's callback method |
|
39 | + * @return bool | int |
|
40 | + */ |
|
41 | + protected function _call_user_func_array_on_current($callback = '', $arguments = array()) |
|
42 | + { |
|
43 | + if ($callback !== '' && method_exists($this->current(), $callback)) { |
|
44 | + return call_user_func_array(array($this->current(), $callback), $arguments); |
|
45 | + } |
|
46 | + return false; |
|
47 | + } |
|
48 | 48 | |
49 | 49 | |
50 | - /** |
|
51 | - * _call_user_func_on_all |
|
52 | - * |
|
53 | - * calls the supplied callback method name on ALL repository objects, |
|
54 | - * |
|
55 | - * @access public |
|
56 | - * @param string $callback name of method found on repository objects to be called |
|
57 | - * @return bool | int |
|
58 | - */ |
|
59 | - protected function _call_user_func_on_all($callback = '') |
|
60 | - { |
|
61 | - $success = true; |
|
62 | - if ($this->valid()) { |
|
63 | - $this->rewind(); |
|
64 | - while ($this->valid()) { |
|
65 | - // any negative result will toggle success to false |
|
66 | - $success = $this->_call_user_func_array_on_current($callback) ? $success : false; |
|
67 | - $this->next(); |
|
68 | - } |
|
69 | - $this->rewind(); |
|
70 | - } |
|
71 | - return $success; |
|
72 | - } |
|
50 | + /** |
|
51 | + * _call_user_func_on_all |
|
52 | + * |
|
53 | + * calls the supplied callback method name on ALL repository objects, |
|
54 | + * |
|
55 | + * @access public |
|
56 | + * @param string $callback name of method found on repository objects to be called |
|
57 | + * @return bool | int |
|
58 | + */ |
|
59 | + protected function _call_user_func_on_all($callback = '') |
|
60 | + { |
|
61 | + $success = true; |
|
62 | + if ($this->valid()) { |
|
63 | + $this->rewind(); |
|
64 | + while ($this->valid()) { |
|
65 | + // any negative result will toggle success to false |
|
66 | + $success = $this->_call_user_func_array_on_current($callback) ? $success : false; |
|
67 | + $this->next(); |
|
68 | + } |
|
69 | + $this->rewind(); |
|
70 | + } |
|
71 | + return $success; |
|
72 | + } |
|
73 | 73 | |
74 | 74 | |
75 | - /** |
|
76 | - * persist |
|
77 | - * |
|
78 | - * primarily used for saving EE_Base_Class classes to the database, |
|
79 | - * but can be supplied with a "persistence callback" that can be used for classes that are not instances of |
|
80 | - * EE_Base_Class, or for providing alternate ways to persist an object such as session caching, etc... an array of |
|
81 | - * arguments can also be supplied that will be passed along to the object's persistence method |
|
82 | - * |
|
83 | - * @access public |
|
84 | - * @param string $persistence_callback name of method found on object that can |
|
85 | - * be used for persisting the object |
|
86 | - * defaults to |
|
87 | - * EE_Object_Repository::$persist_method |
|
88 | - * @param array $persistence_arguments arrays of arguments that will be passed |
|
89 | - * to the object's persistence method |
|
90 | - * @return bool | int |
|
91 | - */ |
|
92 | - public function persist($persistence_callback = '', $persistence_arguments = array()) |
|
93 | - { |
|
94 | - $persistence_callback = ! empty($persistence_callback) ? $persistence_callback : $this->persist_method; |
|
95 | - return $this->_call_user_func_array_on_current($persistence_callback, $persistence_arguments); |
|
96 | - } |
|
75 | + /** |
|
76 | + * persist |
|
77 | + * |
|
78 | + * primarily used for saving EE_Base_Class classes to the database, |
|
79 | + * but can be supplied with a "persistence callback" that can be used for classes that are not instances of |
|
80 | + * EE_Base_Class, or for providing alternate ways to persist an object such as session caching, etc... an array of |
|
81 | + * arguments can also be supplied that will be passed along to the object's persistence method |
|
82 | + * |
|
83 | + * @access public |
|
84 | + * @param string $persistence_callback name of method found on object that can |
|
85 | + * be used for persisting the object |
|
86 | + * defaults to |
|
87 | + * EE_Object_Repository::$persist_method |
|
88 | + * @param array $persistence_arguments arrays of arguments that will be passed |
|
89 | + * to the object's persistence method |
|
90 | + * @return bool | int |
|
91 | + */ |
|
92 | + public function persist($persistence_callback = '', $persistence_arguments = array()) |
|
93 | + { |
|
94 | + $persistence_callback = ! empty($persistence_callback) ? $persistence_callback : $this->persist_method; |
|
95 | + return $this->_call_user_func_array_on_current($persistence_callback, $persistence_arguments); |
|
96 | + } |
|
97 | 97 | |
98 | 98 | |
99 | - /** |
|
100 | - * persist_all |
|
101 | - * |
|
102 | - * calls \EE_Object_Repository::persist() on all objects within the repository |
|
103 | - * |
|
104 | - * @access public |
|
105 | - * @param string $persistence_callback name of method found on object that can be used for persisting the object |
|
106 | - * @return bool | int |
|
107 | - */ |
|
108 | - public function persist_all($persistence_callback = '') |
|
109 | - { |
|
110 | - $persistence_callback = ! empty($persistence_callback) ? $persistence_callback : $this->persist_method; |
|
111 | - return $this->_call_user_func_on_all($persistence_callback); |
|
112 | - } |
|
99 | + /** |
|
100 | + * persist_all |
|
101 | + * |
|
102 | + * calls \EE_Object_Repository::persist() on all objects within the repository |
|
103 | + * |
|
104 | + * @access public |
|
105 | + * @param string $persistence_callback name of method found on object that can be used for persisting the object |
|
106 | + * @return bool | int |
|
107 | + */ |
|
108 | + public function persist_all($persistence_callback = '') |
|
109 | + { |
|
110 | + $persistence_callback = ! empty($persistence_callback) ? $persistence_callback : $this->persist_method; |
|
111 | + return $this->_call_user_func_on_all($persistence_callback); |
|
112 | + } |
|
113 | 113 | } |
@@ -12,110 +12,110 @@ |
||
12 | 12 | abstract class EED_Module extends EE_Configurable implements ResettableInterface |
13 | 13 | { |
14 | 14 | |
15 | - /** |
|
16 | - * rendered output to be returned to WP |
|
17 | - * |
|
18 | - * @var string $output |
|
19 | - */ |
|
20 | - protected $output = ''; |
|
21 | - |
|
22 | - /** |
|
23 | - * the current active espresso template theme |
|
24 | - * |
|
25 | - * @var string $theme |
|
26 | - */ |
|
27 | - protected $theme = ''; |
|
28 | - |
|
29 | - |
|
30 | - /** |
|
31 | - * @return void |
|
32 | - */ |
|
33 | - public static function reset() |
|
34 | - { |
|
35 | - $module_name = get_called_class(); |
|
36 | - new $module_name(); |
|
37 | - } |
|
38 | - |
|
39 | - |
|
40 | - /** |
|
41 | - * set_hooks - for hooking into EE Core, other modules, etc |
|
42 | - * |
|
43 | - * @access public |
|
44 | - * @return void |
|
45 | - */ |
|
46 | - public static function set_hooks() |
|
47 | - { |
|
48 | - } |
|
49 | - |
|
50 | - |
|
51 | - /** |
|
52 | - * set_hooks_admin - for hooking into EE Admin Core, other modules, etc |
|
53 | - * |
|
54 | - * @access public |
|
55 | - * @return void |
|
56 | - */ |
|
57 | - public static function set_hooks_admin() |
|
58 | - { |
|
59 | - } |
|
60 | - |
|
61 | - |
|
62 | - /** |
|
63 | - * run - initial module setup |
|
64 | - * this method is primarily used for activating resources in the EE_Front_Controller thru the use of filters |
|
65 | - * |
|
66 | - * @access public |
|
67 | - * @var WP $WP |
|
68 | - * @return void |
|
69 | - */ |
|
70 | - abstract public function run($WP); |
|
71 | - |
|
72 | - |
|
73 | - /** |
|
74 | - * EED_Module constructor. |
|
75 | - */ |
|
76 | - final public function __construct() |
|
77 | - { |
|
78 | - $this->theme = EE_Config::get_current_theme(); |
|
79 | - $module_name = $this->module_name(); |
|
80 | - EE_Registry::instance()->modules->{$module_name} = $this; |
|
81 | - } |
|
82 | - |
|
83 | - |
|
84 | - /** |
|
85 | - * @param $module_name |
|
86 | - * @return EED_Module |
|
87 | - */ |
|
88 | - protected static function get_instance($module_name = '') |
|
89 | - { |
|
90 | - $module_name = ! empty($module_name) |
|
91 | - ? $module_name |
|
92 | - : get_called_class(); |
|
93 | - if (! isset(EE_Registry::instance()->modules->{$module_name}) |
|
94 | - || ! EE_Registry::instance()->modules->{$module_name} instanceof EED_Module |
|
95 | - ) { |
|
96 | - EE_Registry::instance()->add_module($module_name); |
|
97 | - } |
|
98 | - return EE_Registry::instance()->get_module($module_name); |
|
99 | - } |
|
100 | - |
|
101 | - |
|
102 | - /** |
|
103 | - * module_name |
|
104 | - * |
|
105 | - * @access public |
|
106 | - * @return string |
|
107 | - */ |
|
108 | - public function module_name() |
|
109 | - { |
|
110 | - return get_class($this); |
|
111 | - } |
|
112 | - |
|
113 | - |
|
114 | - /** |
|
115 | - * @return string |
|
116 | - */ |
|
117 | - public function theme() |
|
118 | - { |
|
119 | - return $this->theme; |
|
120 | - } |
|
15 | + /** |
|
16 | + * rendered output to be returned to WP |
|
17 | + * |
|
18 | + * @var string $output |
|
19 | + */ |
|
20 | + protected $output = ''; |
|
21 | + |
|
22 | + /** |
|
23 | + * the current active espresso template theme |
|
24 | + * |
|
25 | + * @var string $theme |
|
26 | + */ |
|
27 | + protected $theme = ''; |
|
28 | + |
|
29 | + |
|
30 | + /** |
|
31 | + * @return void |
|
32 | + */ |
|
33 | + public static function reset() |
|
34 | + { |
|
35 | + $module_name = get_called_class(); |
|
36 | + new $module_name(); |
|
37 | + } |
|
38 | + |
|
39 | + |
|
40 | + /** |
|
41 | + * set_hooks - for hooking into EE Core, other modules, etc |
|
42 | + * |
|
43 | + * @access public |
|
44 | + * @return void |
|
45 | + */ |
|
46 | + public static function set_hooks() |
|
47 | + { |
|
48 | + } |
|
49 | + |
|
50 | + |
|
51 | + /** |
|
52 | + * set_hooks_admin - for hooking into EE Admin Core, other modules, etc |
|
53 | + * |
|
54 | + * @access public |
|
55 | + * @return void |
|
56 | + */ |
|
57 | + public static function set_hooks_admin() |
|
58 | + { |
|
59 | + } |
|
60 | + |
|
61 | + |
|
62 | + /** |
|
63 | + * run - initial module setup |
|
64 | + * this method is primarily used for activating resources in the EE_Front_Controller thru the use of filters |
|
65 | + * |
|
66 | + * @access public |
|
67 | + * @var WP $WP |
|
68 | + * @return void |
|
69 | + */ |
|
70 | + abstract public function run($WP); |
|
71 | + |
|
72 | + |
|
73 | + /** |
|
74 | + * EED_Module constructor. |
|
75 | + */ |
|
76 | + final public function __construct() |
|
77 | + { |
|
78 | + $this->theme = EE_Config::get_current_theme(); |
|
79 | + $module_name = $this->module_name(); |
|
80 | + EE_Registry::instance()->modules->{$module_name} = $this; |
|
81 | + } |
|
82 | + |
|
83 | + |
|
84 | + /** |
|
85 | + * @param $module_name |
|
86 | + * @return EED_Module |
|
87 | + */ |
|
88 | + protected static function get_instance($module_name = '') |
|
89 | + { |
|
90 | + $module_name = ! empty($module_name) |
|
91 | + ? $module_name |
|
92 | + : get_called_class(); |
|
93 | + if (! isset(EE_Registry::instance()->modules->{$module_name}) |
|
94 | + || ! EE_Registry::instance()->modules->{$module_name} instanceof EED_Module |
|
95 | + ) { |
|
96 | + EE_Registry::instance()->add_module($module_name); |
|
97 | + } |
|
98 | + return EE_Registry::instance()->get_module($module_name); |
|
99 | + } |
|
100 | + |
|
101 | + |
|
102 | + /** |
|
103 | + * module_name |
|
104 | + * |
|
105 | + * @access public |
|
106 | + * @return string |
|
107 | + */ |
|
108 | + public function module_name() |
|
109 | + { |
|
110 | + return get_class($this); |
|
111 | + } |
|
112 | + |
|
113 | + |
|
114 | + /** |
|
115 | + * @return string |
|
116 | + */ |
|
117 | + public function theme() |
|
118 | + { |
|
119 | + return $this->theme; |
|
120 | + } |
|
121 | 121 | } |
@@ -90,7 +90,7 @@ |
||
90 | 90 | $module_name = ! empty($module_name) |
91 | 91 | ? $module_name |
92 | 92 | : get_called_class(); |
93 | - if (! isset(EE_Registry::instance()->modules->{$module_name}) |
|
93 | + if ( ! isset(EE_Registry::instance()->modules->{$module_name}) |
|
94 | 94 | || ! EE_Registry::instance()->modules->{$module_name} instanceof EED_Module |
95 | 95 | ) { |
96 | 96 | EE_Registry::instance()->add_module($module_name); |
@@ -11,42 +11,42 @@ |
||
11 | 11 | class EE_Base |
12 | 12 | { |
13 | 13 | |
14 | - /** |
|
15 | - * @ override magic methods |
|
16 | - * @ return void |
|
17 | - */ |
|
18 | - public function __get($a) |
|
19 | - { |
|
20 | - return false; |
|
21 | - } |
|
14 | + /** |
|
15 | + * @ override magic methods |
|
16 | + * @ return void |
|
17 | + */ |
|
18 | + public function __get($a) |
|
19 | + { |
|
20 | + return false; |
|
21 | + } |
|
22 | 22 | |
23 | - public function __set($a, $b) |
|
24 | - { |
|
25 | - return false; |
|
26 | - } |
|
23 | + public function __set($a, $b) |
|
24 | + { |
|
25 | + return false; |
|
26 | + } |
|
27 | 27 | |
28 | - public function __isset($a) |
|
29 | - { |
|
30 | - return false; |
|
31 | - } |
|
28 | + public function __isset($a) |
|
29 | + { |
|
30 | + return false; |
|
31 | + } |
|
32 | 32 | |
33 | - public function __unset($a) |
|
34 | - { |
|
35 | - return false; |
|
36 | - } |
|
33 | + public function __unset($a) |
|
34 | + { |
|
35 | + return false; |
|
36 | + } |
|
37 | 37 | |
38 | - public function __clone() |
|
39 | - { |
|
40 | - return false; |
|
41 | - } |
|
38 | + public function __clone() |
|
39 | + { |
|
40 | + return false; |
|
41 | + } |
|
42 | 42 | |
43 | - public function __wakeup() |
|
44 | - { |
|
45 | - return false; |
|
46 | - } |
|
43 | + public function __wakeup() |
|
44 | + { |
|
45 | + return false; |
|
46 | + } |
|
47 | 47 | |
48 | - public function __destruct() |
|
49 | - { |
|
50 | - return false; |
|
51 | - } |
|
48 | + public function __destruct() |
|
49 | + { |
|
50 | + return false; |
|
51 | + } |
|
52 | 52 | } |
@@ -14,333 +14,333 @@ |
||
14 | 14 | class EE_Maintenance_Mode implements ResettableInterface |
15 | 15 | { |
16 | 16 | |
17 | - /** |
|
18 | - * constants available to client code for interpreting the values of EE_Maintenance_Mode::level(). |
|
19 | - * level_0_not_in_maintenance means the site is NOT in maintenance mode (so everything's normal) |
|
20 | - */ |
|
21 | - const level_0_not_in_maintenance = 0; |
|
22 | - |
|
23 | - /** |
|
24 | - * level_1_frontend_only_maintenance means that the site's frontend EE code should be completely disabled |
|
25 | - * but the admin backend should be running as normal. Maybe an admin can view the frontend though |
|
26 | - */ |
|
27 | - const level_1_frontend_only_maintenance = 1; |
|
28 | - |
|
29 | - /** |
|
30 | - * level_2_complete_maintenance means the frontend AND EE backend code are disabled. The only system running |
|
31 | - * is the maintenance mode stuff, which will require users to update all addons, and then finish running all |
|
32 | - * migration scripts before taking the site out of maintenance mode |
|
33 | - */ |
|
34 | - const level_2_complete_maintenance = 2; |
|
35 | - |
|
36 | - /** |
|
37 | - * the name of the option which stores the current level of maintenance mode |
|
38 | - */ |
|
39 | - const option_name_maintenance_mode = 'ee_maintenance_mode'; |
|
40 | - |
|
41 | - |
|
42 | - /** |
|
43 | - * @var EE_Maintenance_Mode $_instance |
|
44 | - */ |
|
45 | - private static $_instance; |
|
46 | - |
|
47 | - /** |
|
48 | - * @var EE_Registry $EE |
|
49 | - */ |
|
50 | - protected $EE; |
|
51 | - |
|
52 | - |
|
53 | - /** |
|
54 | - * @singleton method used to instantiate class object |
|
55 | - * @return EE_Maintenance_Mode |
|
56 | - */ |
|
57 | - public static function instance() |
|
58 | - { |
|
59 | - // check if class object is instantiated |
|
60 | - if (! self::$_instance instanceof EE_Maintenance_Mode) { |
|
61 | - self::$_instance = new self(); |
|
62 | - } |
|
63 | - return self::$_instance; |
|
64 | - } |
|
65 | - |
|
66 | - |
|
67 | - /** |
|
68 | - * Resets maintenance mode (mostly just re-checks whether or not we should be in maintenance mode) |
|
69 | - * |
|
70 | - * @return EE_Maintenance_Mode |
|
71 | - */ |
|
72 | - public static function reset() |
|
73 | - { |
|
74 | - self::instance()->set_maintenance_mode_if_db_old(); |
|
75 | - return self::instance(); |
|
76 | - } |
|
77 | - |
|
78 | - |
|
79 | - /** |
|
80 | - *private constructor to prevent direct creation |
|
81 | - */ |
|
82 | - private function __construct() |
|
83 | - { |
|
84 | - // if M-Mode level 2 is engaged, we still need basic assets loaded |
|
85 | - add_action('wp_enqueue_scripts', array($this, 'load_assets_required_for_m_mode')); |
|
86 | - // shut 'er down down for maintenance ? |
|
87 | - add_filter('the_content', array($this, 'the_content'), 2); |
|
88 | - // add powered by EE msg |
|
89 | - add_action('shutdown', array($this, 'display_maintenance_mode_notice'), 10); |
|
90 | - } |
|
91 | - |
|
92 | - |
|
93 | - /** |
|
94 | - * retrieves the maintenance mode option value from the db |
|
95 | - * |
|
96 | - * @return int |
|
97 | - */ |
|
98 | - public function real_level() |
|
99 | - { |
|
100 | - return (int) get_option(self::option_name_maintenance_mode, EE_Maintenance_Mode::level_0_not_in_maintenance); |
|
101 | - } |
|
102 | - |
|
103 | - |
|
104 | - /** |
|
105 | - * Returns whether or not the models reportedly are able to run queries or not |
|
106 | - * (ie, if the system thinks their tables are present and up-to-date). |
|
107 | - * |
|
108 | - * @return boolean |
|
109 | - */ |
|
110 | - public function models_can_query() |
|
111 | - { |
|
112 | - return $this->real_level() !== EE_Maintenance_Mode::level_2_complete_maintenance; |
|
113 | - } |
|
114 | - |
|
115 | - |
|
116 | - /** |
|
117 | - * Determines whether or not we're in maintenance mode and what level. However, while the site |
|
118 | - * is in level 1 maintenance, and an admin visits the frontend, this function makes it appear |
|
119 | - * to them as if teh site isn't in maintenance mode. |
|
120 | - * EE_Maintenance_Mode::level_0_not_in_maintenance => not in maintenance mode (in normal mode) |
|
121 | - * EE_Maintenance_Mode::level_1_frontend_only_maintenance=> frontend-only maintenance mode |
|
122 | - * EE_Maintenance_Mode::level_2_complete_maintenance => frontend and backend maintenance mode |
|
123 | - * |
|
124 | - * @return int |
|
125 | - */ |
|
126 | - public function level() |
|
127 | - { |
|
128 | - $maintenance_mode_level = $this->real_level(); |
|
129 | - // if this is an admin request, we'll be honest... except if it's ajax, because that might be from the frontend |
|
130 | - if ($maintenance_mode_level === EE_Maintenance_Mode::level_1_frontend_only_maintenance// we're in level 1 |
|
131 | - && ((defined('DOING_AJAX') && DOING_AJAX) || ! is_admin()) // on non-ajax frontend requests |
|
132 | - && current_user_can('administrator') // when the user is an admin |
|
133 | - ) { |
|
134 | - $maintenance_mode_level = EE_Maintenance_Mode::level_0_not_in_maintenance; |
|
135 | - } |
|
136 | - return $maintenance_mode_level; |
|
137 | - } |
|
138 | - |
|
139 | - |
|
140 | - /** |
|
141 | - * Determines if we need to put EE in maintenance mode because the database needs updating |
|
142 | - * |
|
143 | - * @return boolean true if DB is old and maintenance mode was triggered; false otherwise |
|
144 | - */ |
|
145 | - public function set_maintenance_mode_if_db_old() |
|
146 | - { |
|
147 | - EE_Registry::instance()->load_core('Data_Migration_Manager'); |
|
148 | - if (EE_Data_Migration_Manager::instance()->check_for_applicable_data_migration_scripts()) { |
|
149 | - update_option(self::option_name_maintenance_mode, self::level_2_complete_maintenance); |
|
150 | - return true; |
|
151 | - } |
|
152 | - if ($this->level() === self::level_2_complete_maintenance) { |
|
153 | - // we also want to handle the opposite: if the site is mm2, but there aren't any migrations to run |
|
154 | - // then we shouldn't be in mm2. (Maybe an addon got deactivated?) |
|
155 | - update_option(self::option_name_maintenance_mode, self::level_0_not_in_maintenance); |
|
156 | - return false; |
|
157 | - } |
|
158 | - return false; |
|
159 | - } |
|
160 | - |
|
161 | - |
|
162 | - /** |
|
163 | - * Updates the maintenance level on the site |
|
164 | - * |
|
165 | - * @param int $level |
|
166 | - * @return void |
|
167 | - */ |
|
168 | - public function set_maintenance_level($level) |
|
169 | - { |
|
170 | - do_action('AHEE__EE_Maintenance_Mode__set_maintenance_level', $level); |
|
171 | - update_option(self::option_name_maintenance_mode, (int) $level); |
|
172 | - } |
|
173 | - |
|
174 | - |
|
175 | - /** |
|
176 | - * returns TRUE if M-Mode is engaged and the current request is not for the admin |
|
177 | - * |
|
178 | - * @return string |
|
179 | - */ |
|
180 | - public static function disable_frontend_for_maintenance() |
|
181 | - { |
|
182 | - return (! is_admin() && EE_Maintenance_Mode::instance()->level()); |
|
183 | - } |
|
184 | - |
|
185 | - |
|
186 | - /** |
|
187 | - * @return void |
|
188 | - */ |
|
189 | - public function load_assets_required_for_m_mode() |
|
190 | - { |
|
191 | - if ($this->real_level() === EE_Maintenance_Mode::level_2_complete_maintenance |
|
192 | - && ! wp_script_is('espresso_core') |
|
193 | - ) { |
|
194 | - wp_register_style( |
|
195 | - 'espresso_default', |
|
196 | - EE_GLOBAL_ASSETS_URL . 'css/espresso_default.css', |
|
197 | - array('dashicons'), |
|
198 | - EVENT_ESPRESSO_VERSION |
|
199 | - ); |
|
200 | - wp_enqueue_style('espresso_default'); |
|
201 | - wp_register_script( |
|
202 | - 'espresso_core', |
|
203 | - EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js', |
|
204 | - array('jquery'), |
|
205 | - EVENT_ESPRESSO_VERSION, |
|
206 | - true |
|
207 | - ); |
|
208 | - wp_enqueue_script('espresso_core'); |
|
209 | - } |
|
210 | - } |
|
211 | - |
|
212 | - |
|
213 | - /** |
|
214 | - * replacement EE CPT template that displays message notifying site visitors |
|
215 | - * that EE has been temporarily placed into maintenance mode |
|
216 | - * does NOT get called on non-EE-CPT requests |
|
217 | - * |
|
218 | - * @return string |
|
219 | - */ |
|
220 | - public static function template_include() |
|
221 | - { |
|
222 | - // shut 'er down down for maintenance ? then don't use any of our templates for our endpoints |
|
223 | - return get_template_directory() . '/index.php'; |
|
224 | - } |
|
225 | - |
|
226 | - |
|
227 | - /** |
|
228 | - * displays message notifying site visitors that EE has been temporarily |
|
229 | - * placed into maintenance mode when post_type != EE CPT |
|
230 | - * |
|
231 | - * @param string $the_content |
|
232 | - * @return string |
|
233 | - */ |
|
234 | - public function the_content($the_content) |
|
235 | - { |
|
236 | - // check if M-mode is engaged and for EE shortcode |
|
237 | - if ($this->level() && strpos($the_content, '[ESPRESSO_') !== false) { |
|
238 | - // this can eventually be moved to a template, or edited via admin. But for now... |
|
239 | - $the_content = sprintf( |
|
240 | - esc_html__( |
|
241 | - '%sMaintenance Mode%sEvent Registration has been temporarily closed while system maintenance is being performed. We\'re sorry for any inconveniences this may have caused. Please try back again later.%s', |
|
242 | - 'event_espresso' |
|
243 | - ), |
|
244 | - '<h3>', |
|
245 | - '</h3><p>', |
|
246 | - '</p>' |
|
247 | - ); |
|
248 | - } |
|
249 | - return $the_content; |
|
250 | - } |
|
251 | - |
|
252 | - |
|
253 | - /** |
|
254 | - * displays message on frontend of site notifying admin that EE has been temporarily placed into maintenance mode |
|
255 | - */ |
|
256 | - public function display_maintenance_mode_notice() |
|
257 | - { |
|
258 | - // check if M-mode is engaged and for EE shortcode |
|
259 | - if (! (defined('DOING_AJAX') && DOING_AJAX) |
|
260 | - && $this->real_level() |
|
261 | - && ! is_admin() |
|
262 | - && current_user_can('administrator') |
|
263 | - && EE_Registry::instance()->REQ->is_espresso_page() |
|
264 | - ) { |
|
265 | - printf( |
|
266 | - esc_html__( |
|
267 | - '%sclose%sEvent Registration is currently disabled because Event Espresso has been placed into Maintenance Mode. To change Maintenance Mode settings, click here %sEE Maintenance Mode Admin Page%s', |
|
268 | - 'event_espresso' |
|
269 | - ), |
|
270 | - '<div id="ee-m-mode-admin-notice-dv" class="ee-really-important-notice-dv"><a class="close-espresso-notice" title="', |
|
271 | - '"><span class="dashicons dashicons-no"></span></a><p>', |
|
272 | - ' » <a href="' . add_query_arg( |
|
273 | - array('page' => 'espresso_maintenance_settings'), |
|
274 | - admin_url('admin.php') |
|
275 | - ) . '">', |
|
276 | - '</a></p></div>' |
|
277 | - ); |
|
278 | - } |
|
279 | - } |
|
280 | - // espresso-notices important-notice ee-attention |
|
281 | - |
|
282 | - |
|
283 | - /** |
|
284 | - * override magic methods |
|
285 | - */ |
|
286 | - final public function __destruct() |
|
287 | - { |
|
288 | - } |
|
289 | - |
|
290 | - |
|
291 | - final public function __call($a, $b) |
|
292 | - { |
|
293 | - } |
|
294 | - |
|
295 | - |
|
296 | - final public function __get($a) |
|
297 | - { |
|
298 | - } |
|
299 | - |
|
300 | - |
|
301 | - final public function __set($a, $b) |
|
302 | - { |
|
303 | - } |
|
304 | - |
|
305 | - |
|
306 | - final public function __isset($a) |
|
307 | - { |
|
308 | - } |
|
309 | - |
|
310 | - |
|
311 | - final public function __unset($a) |
|
312 | - { |
|
313 | - } |
|
314 | - |
|
315 | - |
|
316 | - final public function __sleep() |
|
317 | - { |
|
318 | - return array(); |
|
319 | - } |
|
320 | - |
|
321 | - |
|
322 | - final public function __wakeup() |
|
323 | - { |
|
324 | - } |
|
325 | - |
|
326 | - |
|
327 | - final public function __invoke() |
|
328 | - { |
|
329 | - } |
|
330 | - |
|
331 | - |
|
332 | - final public static function __set_state($a = null) |
|
333 | - { |
|
334 | - return EE_Maintenance_Mode::instance(); |
|
335 | - } |
|
336 | - |
|
337 | - |
|
338 | - final public function __clone() |
|
339 | - { |
|
340 | - } |
|
17 | + /** |
|
18 | + * constants available to client code for interpreting the values of EE_Maintenance_Mode::level(). |
|
19 | + * level_0_not_in_maintenance means the site is NOT in maintenance mode (so everything's normal) |
|
20 | + */ |
|
21 | + const level_0_not_in_maintenance = 0; |
|
22 | + |
|
23 | + /** |
|
24 | + * level_1_frontend_only_maintenance means that the site's frontend EE code should be completely disabled |
|
25 | + * but the admin backend should be running as normal. Maybe an admin can view the frontend though |
|
26 | + */ |
|
27 | + const level_1_frontend_only_maintenance = 1; |
|
28 | + |
|
29 | + /** |
|
30 | + * level_2_complete_maintenance means the frontend AND EE backend code are disabled. The only system running |
|
31 | + * is the maintenance mode stuff, which will require users to update all addons, and then finish running all |
|
32 | + * migration scripts before taking the site out of maintenance mode |
|
33 | + */ |
|
34 | + const level_2_complete_maintenance = 2; |
|
35 | + |
|
36 | + /** |
|
37 | + * the name of the option which stores the current level of maintenance mode |
|
38 | + */ |
|
39 | + const option_name_maintenance_mode = 'ee_maintenance_mode'; |
|
40 | + |
|
41 | + |
|
42 | + /** |
|
43 | + * @var EE_Maintenance_Mode $_instance |
|
44 | + */ |
|
45 | + private static $_instance; |
|
46 | + |
|
47 | + /** |
|
48 | + * @var EE_Registry $EE |
|
49 | + */ |
|
50 | + protected $EE; |
|
51 | + |
|
52 | + |
|
53 | + /** |
|
54 | + * @singleton method used to instantiate class object |
|
55 | + * @return EE_Maintenance_Mode |
|
56 | + */ |
|
57 | + public static function instance() |
|
58 | + { |
|
59 | + // check if class object is instantiated |
|
60 | + if (! self::$_instance instanceof EE_Maintenance_Mode) { |
|
61 | + self::$_instance = new self(); |
|
62 | + } |
|
63 | + return self::$_instance; |
|
64 | + } |
|
65 | + |
|
66 | + |
|
67 | + /** |
|
68 | + * Resets maintenance mode (mostly just re-checks whether or not we should be in maintenance mode) |
|
69 | + * |
|
70 | + * @return EE_Maintenance_Mode |
|
71 | + */ |
|
72 | + public static function reset() |
|
73 | + { |
|
74 | + self::instance()->set_maintenance_mode_if_db_old(); |
|
75 | + return self::instance(); |
|
76 | + } |
|
77 | + |
|
78 | + |
|
79 | + /** |
|
80 | + *private constructor to prevent direct creation |
|
81 | + */ |
|
82 | + private function __construct() |
|
83 | + { |
|
84 | + // if M-Mode level 2 is engaged, we still need basic assets loaded |
|
85 | + add_action('wp_enqueue_scripts', array($this, 'load_assets_required_for_m_mode')); |
|
86 | + // shut 'er down down for maintenance ? |
|
87 | + add_filter('the_content', array($this, 'the_content'), 2); |
|
88 | + // add powered by EE msg |
|
89 | + add_action('shutdown', array($this, 'display_maintenance_mode_notice'), 10); |
|
90 | + } |
|
91 | + |
|
92 | + |
|
93 | + /** |
|
94 | + * retrieves the maintenance mode option value from the db |
|
95 | + * |
|
96 | + * @return int |
|
97 | + */ |
|
98 | + public function real_level() |
|
99 | + { |
|
100 | + return (int) get_option(self::option_name_maintenance_mode, EE_Maintenance_Mode::level_0_not_in_maintenance); |
|
101 | + } |
|
102 | + |
|
103 | + |
|
104 | + /** |
|
105 | + * Returns whether or not the models reportedly are able to run queries or not |
|
106 | + * (ie, if the system thinks their tables are present and up-to-date). |
|
107 | + * |
|
108 | + * @return boolean |
|
109 | + */ |
|
110 | + public function models_can_query() |
|
111 | + { |
|
112 | + return $this->real_level() !== EE_Maintenance_Mode::level_2_complete_maintenance; |
|
113 | + } |
|
114 | + |
|
115 | + |
|
116 | + /** |
|
117 | + * Determines whether or not we're in maintenance mode and what level. However, while the site |
|
118 | + * is in level 1 maintenance, and an admin visits the frontend, this function makes it appear |
|
119 | + * to them as if teh site isn't in maintenance mode. |
|
120 | + * EE_Maintenance_Mode::level_0_not_in_maintenance => not in maintenance mode (in normal mode) |
|
121 | + * EE_Maintenance_Mode::level_1_frontend_only_maintenance=> frontend-only maintenance mode |
|
122 | + * EE_Maintenance_Mode::level_2_complete_maintenance => frontend and backend maintenance mode |
|
123 | + * |
|
124 | + * @return int |
|
125 | + */ |
|
126 | + public function level() |
|
127 | + { |
|
128 | + $maintenance_mode_level = $this->real_level(); |
|
129 | + // if this is an admin request, we'll be honest... except if it's ajax, because that might be from the frontend |
|
130 | + if ($maintenance_mode_level === EE_Maintenance_Mode::level_1_frontend_only_maintenance// we're in level 1 |
|
131 | + && ((defined('DOING_AJAX') && DOING_AJAX) || ! is_admin()) // on non-ajax frontend requests |
|
132 | + && current_user_can('administrator') // when the user is an admin |
|
133 | + ) { |
|
134 | + $maintenance_mode_level = EE_Maintenance_Mode::level_0_not_in_maintenance; |
|
135 | + } |
|
136 | + return $maintenance_mode_level; |
|
137 | + } |
|
138 | + |
|
139 | + |
|
140 | + /** |
|
141 | + * Determines if we need to put EE in maintenance mode because the database needs updating |
|
142 | + * |
|
143 | + * @return boolean true if DB is old and maintenance mode was triggered; false otherwise |
|
144 | + */ |
|
145 | + public function set_maintenance_mode_if_db_old() |
|
146 | + { |
|
147 | + EE_Registry::instance()->load_core('Data_Migration_Manager'); |
|
148 | + if (EE_Data_Migration_Manager::instance()->check_for_applicable_data_migration_scripts()) { |
|
149 | + update_option(self::option_name_maintenance_mode, self::level_2_complete_maintenance); |
|
150 | + return true; |
|
151 | + } |
|
152 | + if ($this->level() === self::level_2_complete_maintenance) { |
|
153 | + // we also want to handle the opposite: if the site is mm2, but there aren't any migrations to run |
|
154 | + // then we shouldn't be in mm2. (Maybe an addon got deactivated?) |
|
155 | + update_option(self::option_name_maintenance_mode, self::level_0_not_in_maintenance); |
|
156 | + return false; |
|
157 | + } |
|
158 | + return false; |
|
159 | + } |
|
160 | + |
|
161 | + |
|
162 | + /** |
|
163 | + * Updates the maintenance level on the site |
|
164 | + * |
|
165 | + * @param int $level |
|
166 | + * @return void |
|
167 | + */ |
|
168 | + public function set_maintenance_level($level) |
|
169 | + { |
|
170 | + do_action('AHEE__EE_Maintenance_Mode__set_maintenance_level', $level); |
|
171 | + update_option(self::option_name_maintenance_mode, (int) $level); |
|
172 | + } |
|
173 | + |
|
174 | + |
|
175 | + /** |
|
176 | + * returns TRUE if M-Mode is engaged and the current request is not for the admin |
|
177 | + * |
|
178 | + * @return string |
|
179 | + */ |
|
180 | + public static function disable_frontend_for_maintenance() |
|
181 | + { |
|
182 | + return (! is_admin() && EE_Maintenance_Mode::instance()->level()); |
|
183 | + } |
|
184 | + |
|
185 | + |
|
186 | + /** |
|
187 | + * @return void |
|
188 | + */ |
|
189 | + public function load_assets_required_for_m_mode() |
|
190 | + { |
|
191 | + if ($this->real_level() === EE_Maintenance_Mode::level_2_complete_maintenance |
|
192 | + && ! wp_script_is('espresso_core') |
|
193 | + ) { |
|
194 | + wp_register_style( |
|
195 | + 'espresso_default', |
|
196 | + EE_GLOBAL_ASSETS_URL . 'css/espresso_default.css', |
|
197 | + array('dashicons'), |
|
198 | + EVENT_ESPRESSO_VERSION |
|
199 | + ); |
|
200 | + wp_enqueue_style('espresso_default'); |
|
201 | + wp_register_script( |
|
202 | + 'espresso_core', |
|
203 | + EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js', |
|
204 | + array('jquery'), |
|
205 | + EVENT_ESPRESSO_VERSION, |
|
206 | + true |
|
207 | + ); |
|
208 | + wp_enqueue_script('espresso_core'); |
|
209 | + } |
|
210 | + } |
|
211 | + |
|
212 | + |
|
213 | + /** |
|
214 | + * replacement EE CPT template that displays message notifying site visitors |
|
215 | + * that EE has been temporarily placed into maintenance mode |
|
216 | + * does NOT get called on non-EE-CPT requests |
|
217 | + * |
|
218 | + * @return string |
|
219 | + */ |
|
220 | + public static function template_include() |
|
221 | + { |
|
222 | + // shut 'er down down for maintenance ? then don't use any of our templates for our endpoints |
|
223 | + return get_template_directory() . '/index.php'; |
|
224 | + } |
|
225 | + |
|
226 | + |
|
227 | + /** |
|
228 | + * displays message notifying site visitors that EE has been temporarily |
|
229 | + * placed into maintenance mode when post_type != EE CPT |
|
230 | + * |
|
231 | + * @param string $the_content |
|
232 | + * @return string |
|
233 | + */ |
|
234 | + public function the_content($the_content) |
|
235 | + { |
|
236 | + // check if M-mode is engaged and for EE shortcode |
|
237 | + if ($this->level() && strpos($the_content, '[ESPRESSO_') !== false) { |
|
238 | + // this can eventually be moved to a template, or edited via admin. But for now... |
|
239 | + $the_content = sprintf( |
|
240 | + esc_html__( |
|
241 | + '%sMaintenance Mode%sEvent Registration has been temporarily closed while system maintenance is being performed. We\'re sorry for any inconveniences this may have caused. Please try back again later.%s', |
|
242 | + 'event_espresso' |
|
243 | + ), |
|
244 | + '<h3>', |
|
245 | + '</h3><p>', |
|
246 | + '</p>' |
|
247 | + ); |
|
248 | + } |
|
249 | + return $the_content; |
|
250 | + } |
|
251 | + |
|
252 | + |
|
253 | + /** |
|
254 | + * displays message on frontend of site notifying admin that EE has been temporarily placed into maintenance mode |
|
255 | + */ |
|
256 | + public function display_maintenance_mode_notice() |
|
257 | + { |
|
258 | + // check if M-mode is engaged and for EE shortcode |
|
259 | + if (! (defined('DOING_AJAX') && DOING_AJAX) |
|
260 | + && $this->real_level() |
|
261 | + && ! is_admin() |
|
262 | + && current_user_can('administrator') |
|
263 | + && EE_Registry::instance()->REQ->is_espresso_page() |
|
264 | + ) { |
|
265 | + printf( |
|
266 | + esc_html__( |
|
267 | + '%sclose%sEvent Registration is currently disabled because Event Espresso has been placed into Maintenance Mode. To change Maintenance Mode settings, click here %sEE Maintenance Mode Admin Page%s', |
|
268 | + 'event_espresso' |
|
269 | + ), |
|
270 | + '<div id="ee-m-mode-admin-notice-dv" class="ee-really-important-notice-dv"><a class="close-espresso-notice" title="', |
|
271 | + '"><span class="dashicons dashicons-no"></span></a><p>', |
|
272 | + ' » <a href="' . add_query_arg( |
|
273 | + array('page' => 'espresso_maintenance_settings'), |
|
274 | + admin_url('admin.php') |
|
275 | + ) . '">', |
|
276 | + '</a></p></div>' |
|
277 | + ); |
|
278 | + } |
|
279 | + } |
|
280 | + // espresso-notices important-notice ee-attention |
|
281 | + |
|
282 | + |
|
283 | + /** |
|
284 | + * override magic methods |
|
285 | + */ |
|
286 | + final public function __destruct() |
|
287 | + { |
|
288 | + } |
|
289 | + |
|
290 | + |
|
291 | + final public function __call($a, $b) |
|
292 | + { |
|
293 | + } |
|
294 | + |
|
295 | + |
|
296 | + final public function __get($a) |
|
297 | + { |
|
298 | + } |
|
299 | + |
|
300 | + |
|
301 | + final public function __set($a, $b) |
|
302 | + { |
|
303 | + } |
|
304 | + |
|
305 | + |
|
306 | + final public function __isset($a) |
|
307 | + { |
|
308 | + } |
|
309 | + |
|
310 | + |
|
311 | + final public function __unset($a) |
|
312 | + { |
|
313 | + } |
|
314 | + |
|
315 | + |
|
316 | + final public function __sleep() |
|
317 | + { |
|
318 | + return array(); |
|
319 | + } |
|
320 | + |
|
321 | + |
|
322 | + final public function __wakeup() |
|
323 | + { |
|
324 | + } |
|
325 | + |
|
326 | + |
|
327 | + final public function __invoke() |
|
328 | + { |
|
329 | + } |
|
330 | + |
|
331 | + |
|
332 | + final public static function __set_state($a = null) |
|
333 | + { |
|
334 | + return EE_Maintenance_Mode::instance(); |
|
335 | + } |
|
336 | + |
|
337 | + |
|
338 | + final public function __clone() |
|
339 | + { |
|
340 | + } |
|
341 | 341 | |
342 | 342 | |
343 | - final public static function __callStatic($a, $b) |
|
344 | - { |
|
345 | - } |
|
343 | + final public static function __callStatic($a, $b) |
|
344 | + { |
|
345 | + } |
|
346 | 346 | } |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | public static function instance() |
58 | 58 | { |
59 | 59 | // check if class object is instantiated |
60 | - if (! self::$_instance instanceof EE_Maintenance_Mode) { |
|
60 | + if ( ! self::$_instance instanceof EE_Maintenance_Mode) { |
|
61 | 61 | self::$_instance = new self(); |
62 | 62 | } |
63 | 63 | return self::$_instance; |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | */ |
180 | 180 | public static function disable_frontend_for_maintenance() |
181 | 181 | { |
182 | - return (! is_admin() && EE_Maintenance_Mode::instance()->level()); |
|
182 | + return ( ! is_admin() && EE_Maintenance_Mode::instance()->level()); |
|
183 | 183 | } |
184 | 184 | |
185 | 185 | |
@@ -193,14 +193,14 @@ discard block |
||
193 | 193 | ) { |
194 | 194 | wp_register_style( |
195 | 195 | 'espresso_default', |
196 | - EE_GLOBAL_ASSETS_URL . 'css/espresso_default.css', |
|
196 | + EE_GLOBAL_ASSETS_URL.'css/espresso_default.css', |
|
197 | 197 | array('dashicons'), |
198 | 198 | EVENT_ESPRESSO_VERSION |
199 | 199 | ); |
200 | 200 | wp_enqueue_style('espresso_default'); |
201 | 201 | wp_register_script( |
202 | 202 | 'espresso_core', |
203 | - EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js', |
|
203 | + EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js', |
|
204 | 204 | array('jquery'), |
205 | 205 | EVENT_ESPRESSO_VERSION, |
206 | 206 | true |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | public static function template_include() |
221 | 221 | { |
222 | 222 | // shut 'er down down for maintenance ? then don't use any of our templates for our endpoints |
223 | - return get_template_directory() . '/index.php'; |
|
223 | + return get_template_directory().'/index.php'; |
|
224 | 224 | } |
225 | 225 | |
226 | 226 | |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | public function display_maintenance_mode_notice() |
257 | 257 | { |
258 | 258 | // check if M-mode is engaged and for EE shortcode |
259 | - if (! (defined('DOING_AJAX') && DOING_AJAX) |
|
259 | + if ( ! (defined('DOING_AJAX') && DOING_AJAX) |
|
260 | 260 | && $this->real_level() |
261 | 261 | && ! is_admin() |
262 | 262 | && current_user_can('administrator') |
@@ -269,10 +269,10 @@ discard block |
||
269 | 269 | ), |
270 | 270 | '<div id="ee-m-mode-admin-notice-dv" class="ee-really-important-notice-dv"><a class="close-espresso-notice" title="', |
271 | 271 | '"><span class="dashicons dashicons-no"></span></a><p>', |
272 | - ' » <a href="' . add_query_arg( |
|
272 | + ' » <a href="'.add_query_arg( |
|
273 | 273 | array('page' => 'espresso_maintenance_settings'), |
274 | 274 | admin_url('admin.php') |
275 | - ) . '">', |
|
275 | + ).'">', |
|
276 | 276 | '</a></p></div>' |
277 | 277 | ); |
278 | 278 | } |
@@ -4,19 +4,19 @@ |
||
4 | 4 | <div class="about-text"><?php echo ! empty($admin_page_subtitle) ? $admin_page_subtitle : ''; ?></div> |
5 | 5 | <div class="ee-badge"><img class="" src=" <?php echo EE_GLOBAL_ASSETS_URL; ?>images/event-espresso-cup-90x90.png" |
6 | 6 | width="90" height="90" alt="<?php |
7 | - printf( |
|
8 | - esc_attr__('%s Logo', 'event_espresso'), |
|
9 | - 'Event Espresso' |
|
10 | - ); ?>"/> |
|
7 | + printf( |
|
8 | + esc_attr__('%s Logo', 'event_espresso'), |
|
9 | + 'Event Espresso' |
|
10 | + ); ?>"/> |
|
11 | 11 | <br/><?php printf(__('Version %s', 'event_espresso'), EVENT_ESPRESSO_VERSION); ?></div> |
12 | 12 | |
13 | 13 | <?php echo $nav_tabs; ?> |
14 | 14 | |
15 | 15 | |
16 | 16 | <?php |
17 | - do_action('AHEE__admin_wrapper__template__before_about_admin_page_content'); |
|
18 | - echo $about_admin_page_content; |
|
19 | - do_action('AHEE__admin_wrapper__template__after_about_admin_page_content'); |
|
20 | - ?> |
|
17 | + do_action('AHEE__admin_wrapper__template__before_about_admin_page_content'); |
|
18 | + echo $about_admin_page_content; |
|
19 | + do_action('AHEE__admin_wrapper__template__after_about_admin_page_content'); |
|
20 | + ?> |
|
21 | 21 | |
22 | 22 | </div> |
@@ -10,17 +10,17 @@ discard block |
||
10 | 10 | <dl class="alignleft ee-list-table-legend"> |
11 | 11 | <?php foreach ($items as $item => $details) : ?> |
12 | 12 | <?php |
13 | - if ($per_col < $count) : ?> |
|
13 | + if ($per_col < $count) : ?> |
|
14 | 14 | </dl> |
15 | 15 | <dl class="alignleft ee-list-table-legend"> |
16 | 16 | <?php $count = 1; |
17 | - endif; ?> |
|
17 | + endif; ?> |
|
18 | 18 | <dt id="ee-legend-item-<?php echo $item; ?>"> |
19 | 19 | <?php $class = ! empty($details['class']) ? $details['class'] : 'ee-legend-img-container'; ?> |
20 | 20 | <?php |
21 | - if (strpos($details['class'], '<span') !== false) { |
|
22 | - echo $class; |
|
23 | - } else { ?> |
|
21 | + if (strpos($details['class'], '<span') !== false) { |
|
22 | + echo $class; |
|
23 | + } else { ?> |
|
24 | 24 | <span class="<?php echo $class; ?>"> |
25 | 25 | <?php if (! empty($details['icon'])) : ?> |
26 | 26 | <img src="<?php echo $details['icon']; ?>" class="ee-legend-icon" |
@@ -28,11 +28,11 @@ discard block |
||
28 | 28 | <?php endif; ?> |
29 | 29 | </span> |
30 | 30 | <?php |
31 | - } ?> |
|
31 | + } ?> |
|
32 | 32 | <span class="ee-legend-description"><?php echo $details['desc']; ?></span> |
33 | 33 | </dt> |
34 | 34 | <?php $count++; |
35 | - endforeach; ?> |
|
35 | + endforeach; ?> |
|
36 | 36 | </dl> |
37 | 37 | <div style="clear:both"></div> |
38 | 38 | </div> |
@@ -22,7 +22,7 @@ |
||
22 | 22 | echo $class; |
23 | 23 | } else { ?> |
24 | 24 | <span class="<?php echo $class; ?>"> |
25 | - <?php if (! empty($details['icon'])) : ?> |
|
25 | + <?php if ( ! empty($details['icon'])) : ?> |
|
26 | 26 | <img src="<?php echo $details['icon']; ?>" class="ee-legend-icon" |
27 | 27 | alt="<?php echo esc_attr($details['desc']); ?>"/> |
28 | 28 | <?php endif; ?> |
@@ -7,11 +7,11 @@ |
||
7 | 7 | <?php echo $nav_tabs; ?> |
8 | 8 | |
9 | 9 | <?php |
10 | - do_action('AHEE__admin_wrapper__template__before_admin_page_content'); |
|
11 | - echo $before_admin_page_content; |
|
12 | - echo $admin_page_content; |
|
13 | - echo $after_admin_page_content; |
|
14 | - do_action('AHEE__admin_wrapper__template__after_admin_page_content'); |
|
15 | - ?> |
|
10 | + do_action('AHEE__admin_wrapper__template__before_admin_page_content'); |
|
11 | + echo $before_admin_page_content; |
|
12 | + echo $admin_page_content; |
|
13 | + echo $after_admin_page_content; |
|
14 | + do_action('AHEE__admin_wrapper__template__after_admin_page_content'); |
|
15 | + ?> |
|
16 | 16 | |
17 | 17 | </div> |
@@ -9,11 +9,11 @@ |
||
9 | 9 | </div> <!-- post-body-content --> |
10 | 10 | |
11 | 11 | <?php |
12 | - // let's loop through the columns |
|
13 | - for ($i = 1; $i <= $num_columns; $i++) { |
|
14 | - $metaref = ($i === 1) ? 'normal' : 'side'; |
|
15 | - $metaref = ($i > 2) ? 'column' . $i : $metaref; |
|
16 | - ?> |
|
12 | + // let's loop through the columns |
|
13 | + for ($i = 1; $i <= $num_columns; $i++) { |
|
14 | + $metaref = ($i === 1) ? 'normal' : 'side'; |
|
15 | + $metaref = ($i > 2) ? 'column' . $i : $metaref; |
|
16 | + ?> |
|
17 | 17 | |
18 | 18 | <div id='postbox-container-<?php echo $i; ?>' class='postbox-container'> |
19 | 19 | <?php do_meta_boxes($current_page, $metaref, null); ?> |
@@ -12,7 +12,7 @@ |
||
12 | 12 | // let's loop through the columns |
13 | 13 | for ($i = 1; $i <= $num_columns; $i++) { |
14 | 14 | $metaref = ($i === 1) ? 'normal' : 'side'; |
15 | - $metaref = ($i > 2) ? 'column' . $i : $metaref; |
|
15 | + $metaref = ($i > 2) ? 'column'.$i : $metaref; |
|
16 | 16 | ?> |
17 | 17 | |
18 | 18 | <div id='postbox-container-<?php echo $i; ?>' class='postbox-container'> |