Completed
Branch FET-9795-new-interfaces (ea072c)
by
unknown
19:19
created
core/EE_Module_Request_Router.core.php 4 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -121,7 +121,7 @@
 block discarded – undo
121 121
 
122 122
 	/**
123 123
 	 * 	resolve_route
124
-	*
124
+	 *
125 125
 	 * 	this method simply takes a valid route, and resolves what module class method the route points to
126 126
 	 *
127 127
 	 *  @access 	public
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -243,7 +243,7 @@
 block discarded – undo
243 243
 	 *    get_view
244 244
 	 *
245 245
 	 * @access    public
246
-	 * @param $current_route
246
+	 * @param string $current_route
247 247
 	 * @return    string
248 248
 	 */
249 249
 	public function get_view( $current_route ) {
Please login to merge, or discard this patch.
Spacing   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php use EventEspresso\core\interfaces\InterminableInterface;
2 2
 
3
-if ( ! defined( 'EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
3
+if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
4 4
 /**
5 5
  * Event Espresso
6 6
  *
@@ -63,31 +63,31 @@  discard block
 block discarded – undo
63 63
 	 * @param WP_Query $WP_Query
64 64
 	 * @return    string | NULL
65 65
 	 */
66
-	public function get_route( WP_Query $WP_Query ) {
66
+	public function get_route(WP_Query $WP_Query) {
67 67
 		$this->WP_Query = $WP_Query;
68 68
 		// assume this if first route being called
69 69
 		$previous_route = FALSE;
70 70
 		// but is it really ???
71
-		if ( ! empty( self::$_previous_routes )) {
71
+		if ( ! empty(self::$_previous_routes)) {
72 72
 			// get last run route
73
-			$previous_routes = array_values( self::$_previous_routes );
74
-			$previous_route = array_pop( $previous_routes );
73
+			$previous_routes = array_values(self::$_previous_routes);
74
+			$previous_route = array_pop($previous_routes);
75 75
 		}
76 76
 		//  has another route already been run ?
77
-		if ( $previous_route ) {
77
+		if ($previous_route) {
78 78
 			// check if  forwarding has been set
79
-			$current_route = $this->get_forward( $previous_route );
79
+			$current_route = $this->get_forward($previous_route);
80 80
 			try {
81 81
 				//check for recursive forwarding
82
-				if ( isset( self::$_previous_routes[ $current_route ] )) {
82
+				if (isset(self::$_previous_routes[$current_route])) {
83 83
 					throw new EE_Error(
84 84
 						sprintf(
85
-							__('An error occurred. The %s route has already been called, and therefore can not be forwarded to, because an infinite loop would be created and break the interweb.','event_espresso'),
85
+							__('An error occurred. The %s route has already been called, and therefore can not be forwarded to, because an infinite loop would be created and break the interweb.', 'event_espresso'),
86 86
 							$current_route
87 87
 						)
88 88
 					);
89 89
 				}
90
-			} catch ( EE_Error $e ) {
90
+			} catch (EE_Error $e) {
91 91
 				$e->get_error();
92 92
 				return NULL;
93 93
 			}
@@ -97,13 +97,13 @@  discard block
 block discarded – undo
97 97
 			// grab all routes
98 98
 			$routes = EE_Registry::instance()->CFG->get_routes();
99 99
 			//d( $routes );
100
-			foreach( $routes as $key => $route ) {
100
+			foreach ($routes as $key => $route) {
101 101
 				// check request for module route
102
-				if ( EE_Registry::instance()->REQ->is_set( $key )) {
102
+				if (EE_Registry::instance()->REQ->is_set($key)) {
103 103
 					//echo '<b style="color:#2EA2CC;">key : <span style="color:#E76700">' . $key . '</span></b><br />';
104
-					$current_route = sanitize_text_field( EE_Registry::instance()->REQ->get( $key ));
105
-					if ( $current_route ) {
106
-						$current_route = array( $key, $current_route );
104
+					$current_route = sanitize_text_field(EE_Registry::instance()->REQ->get($key));
105
+					if ($current_route) {
106
+						$current_route = array($key, $current_route);
107 107
 						//echo '<b style="color:#2EA2CC;">current_route : <span style="color:#E76700">' . $current_route . '</span></b><br />';
108 108
 						break;
109 109
 					}
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 			}
112 112
 		}
113 113
 		// sorry, but I can't read what you route !
114
-		if ( empty( $current_route )) {
114
+		if (empty($current_route)) {
115 115
 			return NULL;
116 116
 		}
117 117
 		//add route to previous routes array
@@ -131,46 +131,46 @@  discard block
 block discarded – undo
131 131
 	 *  @param 	string		$current_route
132 132
 	 *  @return 	mixed		EED_Module | boolean
133 133
 	 */
134
-	public function resolve_route( $key, $current_route ) {
134
+	public function resolve_route($key, $current_route) {
135 135
 		// get module method that route has been mapped to
136
-		$module_method = EE_Config::get_route( $current_route, $key );
136
+		$module_method = EE_Config::get_route($current_route, $key);
137 137
 		//EEH_Debug_Tools::printr( $module_method, '$module_method  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
138 138
 		// verify result was returned
139
-		if ( empty( $module_method )) {
140
-			$msg = sprintf( __( 'The requested route %s could not be mapped to any registered modules.', 'event_espresso' ), $current_route );
141
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
139
+		if (empty($module_method)) {
140
+			$msg = sprintf(__('The requested route %s could not be mapped to any registered modules.', 'event_espresso'), $current_route);
141
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
142 142
 			return FALSE;
143 143
 		}
144 144
 		// verify that result is an array
145
-		if ( ! is_array( $module_method )) {
146
-			$msg = sprintf( __( 'The %s  route has not been properly registered.', 'event_espresso' ), $current_route );
147
-			EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
145
+		if ( ! is_array($module_method)) {
146
+			$msg = sprintf(__('The %s  route has not been properly registered.', 'event_espresso'), $current_route);
147
+			EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
148 148
 			return FALSE;
149 149
 		}
150 150
 		// grab module name
151 151
 		$module_name = $module_method[0];
152 152
 		// verify that a class method was registered properly
153
-		if ( ! isset( $module_method[1] )) {
154
-			$msg = sprintf( __( 'A class method for the %s  route has not been properly registered.', 'event_espresso' ), $current_route );
155
-			EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
153
+		if ( ! isset($module_method[1])) {
154
+			$msg = sprintf(__('A class method for the %s  route has not been properly registered.', 'event_espresso'), $current_route);
155
+			EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
156 156
 			return FALSE;
157 157
 		}
158 158
 		// grab method
159 159
 		$method = $module_method[1];
160 160
 		// verify that class exists
161
-		if ( ! class_exists( $module_name )) {
162
-			$msg = sprintf( __( 'The requested %s class could not be found.', 'event_espresso' ), $module_name );
163
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
161
+		if ( ! class_exists($module_name)) {
162
+			$msg = sprintf(__('The requested %s class could not be found.', 'event_espresso'), $module_name);
163
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
164 164
 			return FALSE;
165 165
 		}
166 166
 		// verify that method exists
167
-		if ( ! method_exists( $module_name, $method )) {
168
-			$msg = sprintf( __( 'The class method %s for the %s route is in invalid.', 'event_espresso' ), $method, $current_route );
169
-			EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
167
+		if ( ! method_exists($module_name, $method)) {
168
+			$msg = sprintf(__('The class method %s for the %s route is in invalid.', 'event_espresso'), $method, $current_route);
169
+			EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
170 170
 			return FALSE;
171 171
 		}
172 172
 		// instantiate module and call route method
173
-		return $this->_module_router( $module_name, $method );
173
+		return $this->_module_router($module_name, $method);
174 174
 	}
175 175
 
176 176
 
@@ -184,16 +184,16 @@  discard block
 block discarded – undo
184 184
 	 * @param   string  $module_name
185 185
 	 * @return    EED_Module | NULL
186 186
 	 */
187
-	public static function module_factory( $module_name ) {
188
-		if ( $module_name == 'EED_Module' ) {
189
-			EE_Error::add_error( sprintf( __( 'EED_Module is an abstract parent class an can not be instantiated. Please provide a proper module name.', 'event_espresso' ), $module_name ), __FILE__, __FUNCTION__, __LINE__ );
187
+	public static function module_factory($module_name) {
188
+		if ($module_name == 'EED_Module') {
189
+			EE_Error::add_error(sprintf(__('EED_Module is an abstract parent class an can not be instantiated. Please provide a proper module name.', 'event_espresso'), $module_name), __FILE__, __FUNCTION__, __LINE__);
190 190
 			return NULL;
191 191
 		}
192 192
 		// let's pause to reflect on this...
193
-		$mod_reflector = new ReflectionClass( $module_name );
193
+		$mod_reflector = new ReflectionClass($module_name);
194 194
 		// ensure that class is actually a module
195
-		if ( ! $mod_reflector->isSubclassOf( 'EED_Module' )) {
196
-			EE_Error::add_error( sprintf( __( 'The requested %s module is not of the class EED_Module.', 'event_espresso' ), $module_name ), __FILE__, __FUNCTION__, __LINE__ );
195
+		if ( ! $mod_reflector->isSubclassOf('EED_Module')) {
196
+			EE_Error::add_error(sprintf(__('The requested %s module is not of the class EED_Module.', 'event_espresso'), $module_name), __FILE__, __FUNCTION__, __LINE__);
197 197
 			return NULL;
198 198
 		}
199 199
 		// instantiate and return module class
@@ -211,14 +211,14 @@  discard block
 block discarded – undo
211 211
 	 * @param   string  $method
212 212
 	 * @return    EED_Module | NULL
213 213
 	 */
214
-	private function _module_router( $module_name, $method ) {
214
+	private function _module_router($module_name, $method) {
215 215
 		// instantiate module class
216
-		$module = EE_Module_Request_Router::module_factory( $module_name );
217
-		if ( $module instanceof EED_Module ) {
216
+		$module = EE_Module_Request_Router::module_factory($module_name);
217
+		if ($module instanceof EED_Module) {
218 218
 			// and call whatever action the route was for
219 219
 			try {
220
-				call_user_func( array( $module, $method ), $this->WP_Query );
221
-			} catch ( EE_Error $e ) {
220
+				call_user_func(array($module, $method), $this->WP_Query);
221
+			} catch (EE_Error $e) {
222 222
 				$e->get_error();
223 223
 				return NULL;
224 224
 			}
@@ -235,8 +235,8 @@  discard block
 block discarded – undo
235 235
 	 * @param $current_route
236 236
 	 * @return    string
237 237
 	 */
238
-	public function get_forward( $current_route ) {
239
-		return EE_Config::get_forward( $current_route );
238
+	public function get_forward($current_route) {
239
+		return EE_Config::get_forward($current_route);
240 240
 	}
241 241
 
242 242
 
@@ -248,8 +248,8 @@  discard block
 block discarded – undo
248 248
 	 * @param $current_route
249 249
 	 * @return    string
250 250
 	 */
251
-	public function get_view( $current_route ) {
252
-		return EE_Config::get_view( $current_route );
251
+	public function get_view($current_route) {
252
+		return EE_Config::get_view($current_route);
253 253
 	}
254 254
 
255 255
 
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
 	 * @param $b
260 260
 	 * @return bool
261 261
 	 */
262
-	public function __set($a,$b) { return FALSE; }
262
+	public function __set($a, $b) { return FALSE; }
263 263
 
264 264
 
265 265
 
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,8 @@
 block discarded – undo
1 1
 <?php use EventEspresso\core\interfaces\ResettableInterface;
2 2
 
3
-if ( ! defined( 'EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
3
+if ( ! defined( 'EVENT_ESPRESSO_VERSION')) {
4
+	exit('No direct script access allowed');
5
+}
4 6
 /**
5 7
  * Event Espresso
6 8
  *
Please login to merge, or discard this patch.
core/EE_Object_Collection.core.php 2 patches
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1
-<?php if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
2
-	exit( 'No direct script access allowed' );
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3 3
 }
4 4
 /**
5 5
  * Class EE_Object_Collection
@@ -37,14 +37,14 @@  discard block
 block discarded – undo
37 37
 	 * @param mixed $info
38 38
 	 * @return bool
39 39
 	 */
40
-	public function add( $object, $info = null ) {
40
+	public function add($object, $info = null) {
41 41
 		$class = $this->interface;
42
-		if ( ! $object instanceof $class ) {
42
+		if ( ! $object instanceof $class) {
43 43
 			return false;
44 44
 		}
45
-		$this->attach( $object );
46
-		$this->set_info( $object, $info );
47
-		return $this->contains( $object );
45
+		$this->attach($object);
46
+		$this->set_info($object, $info);
47
+		return $this->contains($object);
48 48
 	}
49 49
 
50 50
 
@@ -60,12 +60,12 @@  discard block
 block discarded – undo
60 60
 	 * @param mixed $info
61 61
 	 * @return bool
62 62
 	 */
63
-	public function set_info( $object, $info = null ) {
64
-		$info = ! empty( $info ) ? $info : spl_object_hash( $object );
63
+	public function set_info($object, $info = null) {
64
+		$info = ! empty($info) ? $info : spl_object_hash($object);
65 65
 		$this->rewind();
66
-		while ( $this->valid() ) {
67
-			if ( $object == $this->current() ) {
68
-				$this->setInfo( $info );
66
+		while ($this->valid()) {
67
+			if ($object == $this->current()) {
68
+				$this->setInfo($info);
69 69
 				$this->rewind();
70 70
 				return true;
71 71
 			}
@@ -86,10 +86,10 @@  discard block
 block discarded – undo
86 86
 	 * @param mixed
87 87
 	 * @return null | object
88 88
 	 */
89
-	public function get_by_info( $info ) {
89
+	public function get_by_info($info) {
90 90
 		$this->rewind();
91
-		while ( $this->valid() ) {
92
-			if ( $info === $this->getInfo() ) {
91
+		while ($this->valid()) {
92
+			if ($info === $this->getInfo()) {
93 93
 				$object = $this->current();
94 94
 				$this->rewind();
95 95
 				return $object;
@@ -110,8 +110,8 @@  discard block
 block discarded – undo
110 110
 	 * @param object $object
111 111
 	 * @return bool
112 112
 	 */
113
-	public function has( $object ) {
114
-		return $this->contains( $object );
113
+	public function has($object) {
114
+		return $this->contains($object);
115 115
 	}
116 116
 
117 117
 
@@ -125,8 +125,8 @@  discard block
 block discarded – undo
125 125
 	 * @param $object
126 126
 	 * @return void
127 127
 	 */
128
-	public function remove( $object ) {
129
-		$this->detach( $object );
128
+	public function remove($object) {
129
+		$this->detach($object);
130 130
 	}
131 131
 
132 132
 
@@ -140,10 +140,10 @@  discard block
 block discarded – undo
140 140
 	 * @param $object
141 141
 	 * @return void
142 142
 	 */
143
-	public function set_current( $object ) {
143
+	public function set_current($object) {
144 144
 		$this->rewind();
145
-		while ( $this->valid() ) {
146
-			if ( $this->current() === $object ) {
145
+		while ($this->valid()) {
146
+			if ($this->current() === $object) {
147 147
 				break;
148 148
 			}
149 149
 			$this->next();
@@ -161,10 +161,10 @@  discard block
 block discarded – undo
161 161
 	 * @param $info
162 162
 	 * @return void
163 163
 	 */
164
-	public function set_current_by_info( $info ) {
164
+	public function set_current_by_info($info) {
165 165
 		$this->rewind();
166
-		while ( $this->valid() ) {
167
-			if ( $info === $this->getInfo() ) {
166
+		while ($this->valid()) {
167
+			if ($info === $this->getInfo()) {
168 168
 				break;
169 169
 			}
170 170
 			$this->next();
Please login to merge, or discard this patch.
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -84,6 +84,7 @@
 block discarded – undo
84 84
 	 *
85 85
 	 * @access public
86 86
 	 * @param mixed
87
+	 * @param string $info
87 88
 	 * @return null | object
88 89
 	 */
89 90
 	public function get_by_info( $info ) {
Please login to merge, or discard this patch.
core/EE_Object_Repository.core.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1
-<?php if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
2
-	exit( 'No direct script access allowed' );
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3 3
 }
4 4
 /**
5 5
  * Class EE_Object_Repository
@@ -38,9 +38,9 @@  discard block
 block discarded – undo
38 38
 	 * @param array $arguments	arrays of arguments that will be passed to the object's callback method
39 39
 	 * @return bool | int
40 40
 	 */
41
-	protected function _call_user_func_array_on_current( $callback = '', $arguments = array() ) {
42
-		if ( $callback !== '' && method_exists( $this->current(), $callback ) ) {
43
-			return call_user_func_array( array( $this->current(), $callback ), $arguments );
41
+	protected function _call_user_func_array_on_current($callback = '', $arguments = array()) {
42
+		if ($callback !== '' && method_exists($this->current(), $callback)) {
43
+			return call_user_func_array(array($this->current(), $callback), $arguments);
44 44
 		}
45 45
 		return false;
46 46
 	}
@@ -56,13 +56,13 @@  discard block
 block discarded – undo
56 56
 	 * @param string $callback  name of method found on repository objects to be called
57 57
 	 * @return bool | int
58 58
 	 */
59
-	protected function _call_user_func_on_all( $callback = '' ) {
59
+	protected function _call_user_func_on_all($callback = '') {
60 60
 		$success = true;
61
-		if ( $this->valid() ) {
61
+		if ($this->valid()) {
62 62
 			$this->rewind();
63
-			while ( $this->valid() ) {
63
+			while ($this->valid()) {
64 64
 				// any negative result will toggle success to false
65
-				$success = $this->_call_user_func_array_on_current( $callback ) ? $success : false;
65
+				$success = $this->_call_user_func_array_on_current($callback) ? $success : false;
66 66
 				$this->next();
67 67
 			}
68 68
 			$this->rewind();
@@ -86,9 +86,9 @@  discard block
 block discarded – undo
86 86
 	 * @param array 	$persistence_arguments	arrays of arguments that will be passed to the object's persistence method
87 87
 	 * @return bool | int
88 88
 	 */
89
-	public function persist( $persistence_callback = '', $persistence_arguments = array() ) {
90
-		$persistence_callback = ! empty( $persistence_callback ) ? $persistence_callback : $this->persist_method;
91
-		return $this->_call_user_func_array_on_current( $persistence_callback, $persistence_arguments );
89
+	public function persist($persistence_callback = '', $persistence_arguments = array()) {
90
+		$persistence_callback = ! empty($persistence_callback) ? $persistence_callback : $this->persist_method;
91
+		return $this->_call_user_func_array_on_current($persistence_callback, $persistence_arguments);
92 92
 	}
93 93
 
94 94
 
@@ -102,9 +102,9 @@  discard block
 block discarded – undo
102 102
 	 * @param string 	$persistence_callback 		name of method found on object that can be used for persisting the object
103 103
 	 * @return bool | int
104 104
 	 */
105
-	public function persist_all( $persistence_callback = '' ) {
106
-		$persistence_callback = ! empty( $persistence_callback ) ? $persistence_callback : $this->persist_method;
107
-		return $this->_call_user_func_on_all( $persistence_callback );
105
+	public function persist_all($persistence_callback = '') {
106
+		$persistence_callback = ! empty($persistence_callback) ? $persistence_callback : $this->persist_method;
107
+		return $this->_call_user_func_on_all($persistence_callback);
108 108
 	}
109 109
 
110 110
 
Please login to merge, or discard this patch.
core/EE_Session.core.php 3 patches
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@  discard block
 block discarded – undo
1
-<?php if (!defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
1
+<?php if (!defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );/**
3 5
  *
4 6
  * Event Espresso
@@ -349,7 +351,7 @@  discard block
 block discarded – undo
349 351
 		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
350 352
 		 if ( ! empty( $key ))  {
351 353
 			return  isset( $this->_session_data[ $key ] ) ? $this->_session_data[ $key ] : NULL;
352
-		}  else  {
354
+		} else  {
353 355
 			return $this->_session_data;
354 356
 		}
355 357
 	}
Please login to merge, or discard this patch.
Doc Comments   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -364,7 +364,7 @@  discard block
 block discarded – undo
364 364
 	  * set session data
365 365
 	  * @access 	public
366 366
 	  * @param 	array $data
367
-	  * @return 	TRUE on success, FALSE on fail
367
+	  * @return 	boolean on success, FALSE on fail
368 368
 	  */
369 369
 	public function set_session_data( $data ) {
370 370
 
@@ -392,7 +392,7 @@  discard block
 block discarded – undo
392 392
 	 /**
393 393
 	  * @initiate session
394 394
 	  * @access   private
395
-	  * @return TRUE on success, FALSE on fail
395
+	  * @return boolean on success, FALSE on fail
396 396
 	  * @throws \EE_Error
397 397
 	  */
398 398
 	private function _espresso_session() {
@@ -531,7 +531,7 @@  discard block
 block discarded – undo
531 531
 	  * @update session data  prior to saving to the db
532 532
 	  * @access public
533 533
 	  * @param bool $new_session
534
-	  * @return TRUE on success, FALSE on fail
534
+	  * @return boolean on success, FALSE on fail
535 535
 	  */
536 536
 	public function update( $new_session = FALSE ) {
537 537
 		$this->_session_data = isset( $this->_session_data )
@@ -625,7 +625,7 @@  discard block
 block discarded – undo
625 625
 	  * This is a callback for the 'wp_redirect' filter
626 626
 	  *
627 627
 	  * @param string $location
628
-	  * @return mixed
628
+	  * @return string
629 629
 	  */
630 630
 	 public function update_on_redirect( $location ) {
631 631
 		 $this->update();
@@ -811,7 +811,7 @@  discard block
 block discarded – undo
811 811
 	  * @access public
812 812
 	  * @param array $data_to_reset
813 813
 	  * @param bool  $show_all_notices
814
-	  * @return TRUE on success, FALSE on fail
814
+	  * @return boolean on success, FALSE on fail
815 815
 	  */
816 816
 	public function reset_data( $data_to_reset = array(), $show_all_notices = FALSE ) {
817 817
 		// if $data_to_reset is not in an array, then put it in one
Please login to merge, or discard this patch.
Spacing   +153 added lines, -153 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@  discard block
 block discarded – undo
1
-<?php if (!defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
2 2
 /**
3 3
  *
4 4
  * Event Espresso
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
 	  * array for defining default session vars
105 105
 	  * @var array
106 106
 	  */
107
-	 private $_default_session_vars = array (
107
+	 private $_default_session_vars = array(
108 108
 		'id' => NULL,
109 109
 		'user_id' => NULL,
110 110
 		'ip_address' => NULL,
@@ -127,12 +127,12 @@  discard block
 block discarded – undo
127 127
 	 * @param \EE_Encryption $encryption
128 128
 	 *	@return EE_Session
129 129
 	 */
130
-	public static function instance( EE_Encryption $encryption = null ) {
130
+	public static function instance(EE_Encryption $encryption = null) {
131 131
 		// check if class object is instantiated
132 132
 		// session loading is turned ON by default, but prior to the init hook, can be turned back OFF via:
133 133
 		// add_filter( 'FHEE_load_EE_Session', '__return_false' );
134
-		if ( ! self::$_instance instanceof EE_Session && apply_filters( 'FHEE_load_EE_Session', true ) ) {
135
-			self::$_instance = new self( $encryption );
134
+		if ( ! self::$_instance instanceof EE_Session && apply_filters('FHEE_load_EE_Session', true)) {
135
+			self::$_instance = new self($encryption);
136 136
 		}
137 137
 		return self::$_instance;
138 138
 	}
@@ -145,15 +145,15 @@  discard block
 block discarded – undo
145 145
 	  * @access protected
146 146
 	  * @param \EE_Encryption $encryption
147 147
 	  */
148
-	 protected function __construct( EE_Encryption $encryption = null ) {
148
+	 protected function __construct(EE_Encryption $encryption = null) {
149 149
 
150 150
 		// session loading is turned ON by default, but prior to the init hook, can be turned back OFF via: add_filter( 'FHEE_load_EE_Session', '__return_false' );
151
-		if ( ! apply_filters( 'FHEE_load_EE_Session', TRUE ) ) {
151
+		if ( ! apply_filters('FHEE_load_EE_Session', TRUE)) {
152 152
 			return NULL;
153 153
 		}
154
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
155
-		if ( ! defined( 'ESPRESSO_SESSION' ) ) {
156
-			define( 'ESPRESSO_SESSION', true );
154
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
155
+		if ( ! defined('ESPRESSO_SESSION')) {
156
+			define('ESPRESSO_SESSION', true);
157 157
 		}
158 158
 		// default session lifespan in seconds
159 159
 		$this->_lifespan = apply_filters(
@@ -167,36 +167,36 @@  discard block
 block discarded – undo
167 167
 		 * 		}
168 168
 		 */
169 169
 		// retrieve session options from db
170
-		$session_settings = get_option( 'ee_session_settings' );
171
-		if ( $session_settings !== FALSE ) {
170
+		$session_settings = get_option('ee_session_settings');
171
+		if ($session_settings !== FALSE) {
172 172
 			// cycle though existing session options
173
-			foreach ( $session_settings as $var_name => $session_setting ) {
173
+			foreach ($session_settings as $var_name => $session_setting) {
174 174
 				// set values for class properties
175
-				$var_name = '_' . $var_name;
175
+				$var_name = '_'.$var_name;
176 176
 				$this->{$var_name} = $session_setting;
177 177
 			}
178 178
 		}
179 179
 		// are we using encryption?
180
-		if ( $this->_use_encryption && $encryption instanceof EE_Encryption ) {
180
+		if ($this->_use_encryption && $encryption instanceof EE_Encryption) {
181 181
 			// encrypt data via: $this->encryption->encrypt();
182 182
 			$this->encryption = $encryption;
183 183
 		}
184 184
 		// filter hook allows outside functions/classes/plugins to change default empty cart
185
-		$extra_default_session_vars = apply_filters( 'FHEE__EE_Session__construct__extra_default_session_vars', array() );
186
-		array_merge( $this->_default_session_vars, $extra_default_session_vars );
185
+		$extra_default_session_vars = apply_filters('FHEE__EE_Session__construct__extra_default_session_vars', array());
186
+		array_merge($this->_default_session_vars, $extra_default_session_vars);
187 187
 		// apply default session vars
188 188
 		$this->_set_defaults();
189 189
 		// check for existing session and retrieve it from db
190
-		if ( ! $this->_espresso_session() ) {
190
+		if ( ! $this->_espresso_session()) {
191 191
 			// or just start a new one
192 192
 			$this->_create_espresso_session();
193 193
 		}
194 194
 		// check request for 'clear_session' param
195
-		add_action( 'AHEE__EE_Request_Handler__construct__complete', array( $this, 'wp_loaded' ));
195
+		add_action('AHEE__EE_Request_Handler__construct__complete', array($this, 'wp_loaded'));
196 196
 		// once everything is all said and done,
197
-		add_action( 'shutdown', array( $this, 'update' ), 100 );
198
-		add_action( 'shutdown', array( $this, 'garbage_collection' ), 999 );
199
-		add_filter( 'wp_redirect', array( $this, 'update_on_redirect' ), 100, 1 );
197
+		add_action('shutdown', array($this, 'update'), 100);
198
+		add_action('shutdown', array($this, 'garbage_collection'), 999);
199
+		add_filter('wp_redirect', array($this, 'update_on_redirect'), 100, 1);
200 200
 	}
201 201
 
202 202
 
@@ -227,11 +227,11 @@  discard block
 block discarded – undo
227 227
 	 */
228 228
 	private function _set_defaults() {
229 229
 		// set some defaults
230
-		foreach ( $this->_default_session_vars as $key => $default_var ) {
231
-			if ( is_array( $default_var )) {
232
-				$this->_session_data[ $key ] = array();
230
+		foreach ($this->_default_session_vars as $key => $default_var) {
231
+			if (is_array($default_var)) {
232
+				$this->_session_data[$key] = array();
233 233
 			} else {
234
-				$this->_session_data[ $key ] = '';
234
+				$this->_session_data[$key] = '';
235 235
 			}
236 236
 		}
237 237
 	}
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
 	  * @param \EE_Cart $cart
254 254
 	  * @return bool
255 255
 	  */
256
-	 public function set_cart( EE_Cart $cart ) {
256
+	 public function set_cart(EE_Cart $cart) {
257 257
 		 $this->_session_data['cart'] = $cart;
258 258
 		 return TRUE;
259 259
 	 }
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
 	  * @return \EE_Cart
274 274
 	  */
275 275
 	 public function cart() {
276
-		 return isset( $this->_session_data['cart'] ) ? $this->_session_data['cart'] : NULL;
276
+		 return isset($this->_session_data['cart']) ? $this->_session_data['cart'] : NULL;
277 277
 	 }
278 278
 
279 279
 
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
 	  * @param \EE_Checkout $checkout
283 283
 	  * @return bool
284 284
 	  */
285
-	 public function set_checkout( EE_Checkout $checkout ) {
285
+	 public function set_checkout(EE_Checkout $checkout) {
286 286
 		 $this->_session_data['checkout'] = $checkout;
287 287
 		 return TRUE;
288 288
 	 }
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
 	  * @return \EE_Checkout
303 303
 	  */
304 304
 	 public function checkout() {
305
-		 return isset( $this->_session_data['checkout'] ) ? $this->_session_data['checkout'] : NULL;
305
+		 return isset($this->_session_data['checkout']) ? $this->_session_data['checkout'] : NULL;
306 306
 	 }
307 307
 
308 308
 
@@ -311,9 +311,9 @@  discard block
 block discarded – undo
311 311
 	  * @param \EE_Transaction $transaction
312 312
 	  * @return bool
313 313
 	  */
314
-	 public function set_transaction( EE_Transaction $transaction ) {
314
+	 public function set_transaction(EE_Transaction $transaction) {
315 315
 		 // first remove the session from the transaction before we save the transaction in the session
316
-		 $transaction->set_txn_session_data( NULL );
316
+		 $transaction->set_txn_session_data(NULL);
317 317
 		 $this->_session_data['transaction'] = $transaction;
318 318
 		 return TRUE;
319 319
 	 }
@@ -333,7 +333,7 @@  discard block
 block discarded – undo
333 333
 	  * @return \EE_Transaction
334 334
 	  */
335 335
 	 public function transaction() {
336
-		 return isset( $this->_session_data['transaction'] ) ? $this->_session_data['transaction'] : NULL;
336
+		 return isset($this->_session_data['transaction']) ? $this->_session_data['transaction'] : NULL;
337 337
 	 }
338 338
 
339 339
 
@@ -345,15 +345,15 @@  discard block
 block discarded – undo
345 345
 	  * @param bool $reset_cache
346 346
 	  * @return    array
347 347
 	  */
348
-	public function get_session_data( $key = NULL, $reset_cache = FALSE ) {
349
-		if ( $reset_cache ) {
348
+	public function get_session_data($key = NULL, $reset_cache = FALSE) {
349
+		if ($reset_cache) {
350 350
 			$this->reset_cart();
351 351
 			$this->reset_checkout();
352 352
 			$this->reset_transaction();
353 353
 		}
354
-		 if ( ! empty( $key ))  {
355
-			return  isset( $this->_session_data[ $key ] ) ? $this->_session_data[ $key ] : NULL;
356
-		}  else  {
354
+		 if ( ! empty($key)) {
355
+			return  isset($this->_session_data[$key]) ? $this->_session_data[$key] : NULL;
356
+		} else {
357 357
 			return $this->_session_data;
358 358
 		}
359 359
 	}
@@ -366,20 +366,20 @@  discard block
 block discarded – undo
366 366
 	  * @param 	array $data
367 367
 	  * @return 	TRUE on success, FALSE on fail
368 368
 	  */
369
-	public function set_session_data( $data ) {
369
+	public function set_session_data($data) {
370 370
 
371 371
 		// nothing ??? bad data ??? go home!
372
-		if ( empty( $data ) || ! is_array( $data )) {
373
-			EE_Error::add_error( __( 'No session data or invalid session data was provided.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
372
+		if (empty($data) || ! is_array($data)) {
373
+			EE_Error::add_error(__('No session data or invalid session data was provided.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
374 374
 			return FALSE;
375 375
 		}
376 376
 
377
-		foreach ( $data as $key =>$value ) {
378
-			if ( isset( $this->_default_session_vars[ $key ] )) {
379
-				EE_Error::add_error( sprintf( __( 'Sorry! %s is a default session datum and can not be reset.', 'event_espresso' ), $key ), __FILE__, __FUNCTION__, __LINE__ );
377
+		foreach ($data as $key =>$value) {
378
+			if (isset($this->_default_session_vars[$key])) {
379
+				EE_Error::add_error(sprintf(__('Sorry! %s is a default session datum and can not be reset.', 'event_espresso'), $key), __FILE__, __FUNCTION__, __LINE__);
380 380
 				return FALSE;
381 381
 			} else {
382
-				$this->_session_data[ $key ] = $value;
382
+				$this->_session_data[$key] = $value;
383 383
 			}
384 384
 		}
385 385
 
@@ -396,9 +396,9 @@  discard block
 block discarded – undo
396 396
 	  * @throws \EE_Error
397 397
 	  */
398 398
 	private function _espresso_session() {
399
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
399
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
400 400
 		// check that session has started
401
-		if ( session_id() === '' ) {
401
+		if (session_id() === '') {
402 402
 			//starts a new session if one doesn't already exist, or re-initiates an existing one
403 403
 			session_start();
404 404
 		}
@@ -407,57 +407,57 @@  discard block
 block discarded – undo
407 407
 		// and the visitors IP
408 408
 		$this->_ip_address = $this->_visitor_ip();
409 409
 		// set the "user agent"
410
-		$this->_user_agent = ( isset($_SERVER['HTTP_USER_AGENT'])) ? esc_attr( $_SERVER['HTTP_USER_AGENT'] ) : FALSE;
410
+		$this->_user_agent = (isset($_SERVER['HTTP_USER_AGENT'])) ? esc_attr($_SERVER['HTTP_USER_AGENT']) : FALSE;
411 411
 		// now let's retrieve what's in the db
412 412
 		// we're using WP's Transient API to store session data using the PHP session ID as the option name
413
-		$session_data = get_transient( EE_Session::session_id_prefix . $this->_sid );
414
-		if ( $session_data ) {
415
-			if ( apply_filters( 'FHEE__EE_Session___perform_session_id_hash_check', WP_DEBUG ) ) {
416
-				$hash_check = get_transient( EE_Session::hash_check_prefix . $this->_sid );
417
-				if ( $hash_check && $hash_check !== md5( $session_data ) ) {
413
+		$session_data = get_transient(EE_Session::session_id_prefix.$this->_sid);
414
+		if ($session_data) {
415
+			if (apply_filters('FHEE__EE_Session___perform_session_id_hash_check', WP_DEBUG)) {
416
+				$hash_check = get_transient(EE_Session::hash_check_prefix.$this->_sid);
417
+				if ($hash_check && $hash_check !== md5($session_data)) {
418 418
 					EE_Error::add_error(
419 419
 						sprintf(
420
-							__( 'The stored data for session %1$s failed to pass a hash check and therefore appears to be invalid.', 'event_espresso' ),
421
-							EE_Session::session_id_prefix . $this->_sid
420
+							__('The stored data for session %1$s failed to pass a hash check and therefore appears to be invalid.', 'event_espresso'),
421
+							EE_Session::session_id_prefix.$this->_sid
422 422
 						),
423 423
 						__FILE__, __FUNCTION__, __LINE__
424 424
 					);
425 425
 				}
426 426
 			}
427 427
 			// un-encrypt the data
428
-			$session_data = $this->_use_encryption ? $this->encryption->decrypt( $session_data ) : $session_data;
428
+			$session_data = $this->_use_encryption ? $this->encryption->decrypt($session_data) : $session_data;
429 429
 			// unserialize
430
-			$session_data = maybe_unserialize( $session_data );
430
+			$session_data = maybe_unserialize($session_data);
431 431
 			// just a check to make sure the session array is indeed an array
432
-			if ( ! is_array( $session_data ) ) {
432
+			if ( ! is_array($session_data)) {
433 433
 				// no?!?! then something is wrong
434 434
 				return FALSE;
435 435
 			}
436 436
 			// get the current time in UTC
437
-			$this->_time = isset( $this->_time ) ? $this->_time : time();
437
+			$this->_time = isset($this->_time) ? $this->_time : time();
438 438
 			// and reset the session expiration
439
-			$this->_expiration = isset( $session_data['expiration'] ) ? $session_data['expiration'] : $this->_time + $this->_lifespan;
439
+			$this->_expiration = isset($session_data['expiration']) ? $session_data['expiration'] : $this->_time + $this->_lifespan;
440 440
 
441 441
 		} else {
442 442
 			// set initial site access time and the session expiration
443 443
 			$this->_set_init_access_and_expiration();
444 444
 			// set referer
445
-			$this->_session_data[ 'pages_visited' ][ $this->_session_data['init_access'] ] = isset( $_SERVER['HTTP_REFERER'] ) ? esc_attr( $_SERVER['HTTP_REFERER'] ) : '';
445
+			$this->_session_data['pages_visited'][$this->_session_data['init_access']] = isset($_SERVER['HTTP_REFERER']) ? esc_attr($_SERVER['HTTP_REFERER']) : '';
446 446
 			// no previous session = go back and create one (on top of the data above)
447 447
 			return FALSE;
448 448
 		}
449 449
 		// now the user agent
450
-		if ( $session_data['user_agent'] != $this->_user_agent ) {
450
+		if ($session_data['user_agent'] != $this->_user_agent) {
451 451
 			return FALSE;
452 452
 		}
453 453
 		// wait a minute... how old are you?
454
-		if ( $this->_time > $this->_expiration ) {
454
+		if ($this->_time > $this->_expiration) {
455 455
 			// yer too old fer me!
456 456
 			// wipe out everything that isn't a default session datum
457
-			$this->clear_session( __CLASS__, __FUNCTION__ );
457
+			$this->clear_session(__CLASS__, __FUNCTION__);
458 458
 		}
459 459
 		// make event espresso session data available to plugin
460
-		$this->_session_data = array_merge( $this->_session_data, $session_data );
460
+		$this->_session_data = array_merge($this->_session_data, $session_data);
461 461
 		return TRUE;
462 462
 
463 463
 	}
@@ -475,12 +475,12 @@  discard block
 block discarded – undo
475 475
 	  */
476 476
 	protected function _generate_session_id() {
477 477
 		// check if the SID was passed explicitly, otherwise get from session, then add salt and hash it to reduce length
478
-		if ( isset( $_REQUEST[ 'EESID' ] ) ) {
479
-			$session_id = sanitize_text_field( $_REQUEST[ 'EESID' ] );
478
+		if (isset($_REQUEST['EESID'])) {
479
+			$session_id = sanitize_text_field($_REQUEST['EESID']);
480 480
 		} else {
481
-			$session_id = md5( session_id() . get_current_blog_id() . $this->_get_sid_salt() );
481
+			$session_id = md5(session_id().get_current_blog_id().$this->_get_sid_salt());
482 482
 		}
483
-		return apply_filters( 'FHEE__EE_Session___generate_session_id__session_id', $session_id );
483
+		return apply_filters('FHEE__EE_Session___generate_session_id__session_id', $session_id);
484 484
 	}
485 485
 
486 486
 
@@ -492,20 +492,20 @@  discard block
 block discarded – undo
492 492
 	  */
493 493
 	protected function _get_sid_salt() {
494 494
 		// was session id salt already saved to db ?
495
-		if ( empty( $this->_sid_salt ) ) {
495
+		if (empty($this->_sid_salt)) {
496 496
 			// no?  then maybe use WP defined constant
497
-			if ( defined( 'AUTH_SALT' ) ) {
497
+			if (defined('AUTH_SALT')) {
498 498
 				$this->_sid_salt = AUTH_SALT;
499 499
 			}
500 500
 			// if salt doesn't exist or is too short
501
-			if ( empty( $this->_sid_salt ) || strlen( $this->_sid_salt ) < 32 ) {
501
+			if (empty($this->_sid_salt) || strlen($this->_sid_salt) < 32) {
502 502
 				// create a new one
503
-				$this->_sid_salt = wp_generate_password( 64 );
503
+				$this->_sid_salt = wp_generate_password(64);
504 504
 			}
505 505
 			// and save it as a permanent session setting
506
-			$session_settings = get_option( 'ee_session_settings' );
507
-			$session_settings[ 'sid_salt' ] = $this->_sid_salt;
508
-			update_option( 'ee_session_settings', $session_settings );
506
+			$session_settings = get_option('ee_session_settings');
507
+			$session_settings['sid_salt'] = $this->_sid_salt;
508
+			update_option('ee_session_settings', $session_settings);
509 509
 		}
510 510
 		return $this->_sid_salt;
511 511
 	}
@@ -533,19 +533,19 @@  discard block
 block discarded – undo
533 533
 	  * @param bool $new_session
534 534
 	  * @return TRUE on success, FALSE on fail
535 535
 	  */
536
-	public function update( $new_session = FALSE ) {
537
-		$this->_session_data = isset( $this->_session_data )
538
-			&& is_array( $this->_session_data )
539
-			&& isset( $this->_session_data['id'])
536
+	public function update($new_session = FALSE) {
537
+		$this->_session_data = isset($this->_session_data)
538
+			&& is_array($this->_session_data)
539
+			&& isset($this->_session_data['id'])
540 540
 			? $this->_session_data
541 541
 			: NULL;
542
-		if ( empty( $this->_session_data )) {
542
+		if (empty($this->_session_data)) {
543 543
 			$this->_set_defaults();
544 544
 		}
545 545
 		$session_data = array();
546
-		foreach ( $this->_session_data as $key => $value ) {
546
+		foreach ($this->_session_data as $key => $value) {
547 547
 
548
-			switch( $key ) {
548
+			switch ($key) {
549 549
 
550 550
 				case 'id' :
551 551
 					// session ID
@@ -563,7 +563,7 @@  discard block
 block discarded – undo
563 563
 				break;
564 564
 
565 565
 				case 'init_access' :
566
-					$session_data['init_access'] = absint( $value );
566
+					$session_data['init_access'] = absint($value);
567 567
 				break;
568 568
 
569 569
 				case 'last_access' :
@@ -573,7 +573,7 @@  discard block
 block discarded – undo
573 573
 
574 574
 				case 'expiration' :
575 575
 					// when the session expires
576
-					$session_data['expiration'] = ! empty( $this->_expiration )
576
+					$session_data['expiration'] = ! empty($this->_expiration)
577 577
 						? $this->_expiration
578 578
 						: $session_data['init_access'] + $this->_lifespan;
579 579
 				break;
@@ -585,11 +585,11 @@  discard block
 block discarded – undo
585 585
 
586 586
 				case 'pages_visited' :
587 587
 					$page_visit = $this->_get_page_visit();
588
-					if ( $page_visit ) {
588
+					if ($page_visit) {
589 589
 						// set pages visited where the first will be the http referrer
590
-						$this->_session_data[ 'pages_visited' ][ $this->_time ] = $page_visit;
590
+						$this->_session_data['pages_visited'][$this->_time] = $page_visit;
591 591
 						// we'll only save the last 10 page visits.
592
-						$session_data[ 'pages_visited' ] = array_slice( $this->_session_data['pages_visited'], -10 );
592
+						$session_data['pages_visited'] = array_slice($this->_session_data['pages_visited'], -10);
593 593
 					}
594 594
 				break;
595 595
 
@@ -603,9 +603,9 @@  discard block
 block discarded – undo
603 603
 
604 604
 		$this->_session_data = $session_data;
605 605
 		// creating a new session does not require saving to the db just yet
606
-		if ( ! $new_session ) {
606
+		if ( ! $new_session) {
607 607
 			// ready? let's save
608
-			if ( $this->_save_session_to_db() ) {
608
+			if ($this->_save_session_to_db()) {
609 609
 				return TRUE;
610 610
 			} else {
611 611
 				return FALSE;
@@ -627,7 +627,7 @@  discard block
 block discarded – undo
627 627
 	  * @param string $location
628 628
 	  * @return mixed
629 629
 	  */
630
-	 public function update_on_redirect( $location ) {
630
+	 public function update_on_redirect($location) {
631 631
 		 $this->update();
632 632
 		 return $location;
633 633
 	}
@@ -639,9 +639,9 @@  discard block
 block discarded – undo
639 639
 	 * 	@return bool
640 640
 	 */
641 641
 	private function _create_espresso_session( ) {
642
-		do_action( 'AHEE_log', __CLASS__, __FUNCTION__, '' );
642
+		do_action('AHEE_log', __CLASS__, __FUNCTION__, '');
643 643
 		// use the update function for now with $new_session arg set to TRUE
644
-		return  $this->update( TRUE ) ? TRUE : FALSE;
644
+		return  $this->update(TRUE) ? TRUE : FALSE;
645 645
 	}
646 646
 
647 647
 
@@ -660,21 +660,21 @@  discard block
 block discarded – undo
660 660
 			|| ! (
661 661
 				EE_Registry::instance()->REQ->is_espresso_page()
662 662
 				|| EE_Registry::instance()->REQ->front_ajax
663
-				|| is_admin() && ! ( defined( 'DOING_AJAX' ) && DOING_AJAX )
663
+				|| is_admin() && ! (defined('DOING_AJAX') && DOING_AJAX)
664 664
 			)
665 665
 		) {
666 666
 			return FALSE;
667 667
 		}
668 668
 		// first serialize all of our session data
669
-		$session_data = serialize( $this->_session_data );
669
+		$session_data = serialize($this->_session_data);
670 670
 		// encrypt it if we are using encryption
671
-		$session_data = $this->_use_encryption ? $this->encryption->encrypt( $session_data ) : $session_data;
671
+		$session_data = $this->_use_encryption ? $this->encryption->encrypt($session_data) : $session_data;
672 672
 		// maybe save hash check
673
-		if ( apply_filters( 'FHEE__EE_Session___perform_session_id_hash_check', WP_DEBUG ) ) {
674
-			set_transient( EE_Session::hash_check_prefix . $this->_sid, md5( $session_data ), $this->_lifespan );
673
+		if (apply_filters('FHEE__EE_Session___perform_session_id_hash_check', WP_DEBUG)) {
674
+			set_transient(EE_Session::hash_check_prefix.$this->_sid, md5($session_data), $this->_lifespan);
675 675
 		}
676 676
 		// we're using the Transient API for storing session data, cuz it's so damn simple -> set_transient(  transient ID, data, expiry )
677
-		return set_transient( EE_Session::session_id_prefix . $this->_sid, $session_data, $this->_lifespan );
677
+		return set_transient(EE_Session::session_id_prefix.$this->_sid, $session_data, $this->_lifespan);
678 678
 	}
679 679
 
680 680
 
@@ -700,10 +700,10 @@  discard block
 block discarded – undo
700 700
 			'HTTP_FORWARDED',
701 701
 			'REMOTE_ADDR'
702 702
 		);
703
-		foreach ( $server_keys as $key ){
704
-			if ( isset( $_SERVER[ $key ] )) {
705
-				foreach ( array_map( 'trim', explode( ',', $_SERVER[ $key ] )) as $ip ) {
706
-					if ( $ip === '127.0.0.1' || filter_var( $ip, FILTER_VALIDATE_IP ) !== FALSE ) {
703
+		foreach ($server_keys as $key) {
704
+			if (isset($_SERVER[$key])) {
705
+				foreach (array_map('trim', explode(',', $_SERVER[$key])) as $ip) {
706
+					if ($ip === '127.0.0.1' || filter_var($ip, FILTER_VALIDATE_IP) !== FALSE) {
707 707
 						$visitor_ip = $ip;
708 708
 					}
709 709
 				}
@@ -724,45 +724,45 @@  discard block
 block discarded – undo
724 724
 	public function _get_page_visit() {
725 725
 
726 726
 //		echo '<h3>'. __CLASS__ .'->'.__FUNCTION__.'  ( line no: ' . __LINE__ . ' )</h3>';
727
-		$page_visit = home_url('/') . 'wp-admin/admin-ajax.php';
727
+		$page_visit = home_url('/').'wp-admin/admin-ajax.php';
728 728
 
729 729
 		// check for request url
730
-		if ( isset( $_SERVER['REQUEST_URI'] )) {
730
+		if (isset($_SERVER['REQUEST_URI'])) {
731 731
 
732
-			$request_uri = esc_url( $_SERVER['REQUEST_URI'] );
732
+			$request_uri = esc_url($_SERVER['REQUEST_URI']);
733 733
 
734
-			$ru_bits = explode( '?', $request_uri );
734
+			$ru_bits = explode('?', $request_uri);
735 735
 			$request_uri = $ru_bits[0];
736 736
 			//echo '<h1>$request_uri   ' . $request_uri . '</h1>';
737 737
 
738 738
 			// check for and grab host as well
739
-			if ( isset( $_SERVER['HTTP_HOST'] )) {
740
-				$http_host = esc_url( $_SERVER['HTTP_HOST'] );
739
+			if (isset($_SERVER['HTTP_HOST'])) {
740
+				$http_host = esc_url($_SERVER['HTTP_HOST']);
741 741
 			} else {
742 742
 				$http_host = '';
743 743
 			}
744 744
 			//echo '<h1>$http_host   ' . $http_host . '</h1>';
745 745
 
746 746
 			// check for page_id in SERVER REQUEST
747
-			if ( isset( $_REQUEST['page_id'] )) {
747
+			if (isset($_REQUEST['page_id'])) {
748 748
 				// rebuild $e_reg without any of the extra parameters
749
-				$page_id = '?page_id=' . esc_attr( $_REQUEST['page_id'] ) . '&amp;';
749
+				$page_id = '?page_id='.esc_attr($_REQUEST['page_id']).'&amp;';
750 750
 			} else {
751 751
 				$page_id = '?';
752 752
 			}
753 753
 			// check for $e_reg in SERVER REQUEST
754
-			if ( isset( $_REQUEST['ee'] )) {
754
+			if (isset($_REQUEST['ee'])) {
755 755
 				// rebuild $e_reg without any of the extra parameters
756
-				$e_reg = 'ee=' . esc_attr( $_REQUEST['ee'] );
756
+				$e_reg = 'ee='.esc_attr($_REQUEST['ee']);
757 757
 			} else {
758 758
 				$e_reg = '';
759 759
 			}
760 760
 
761
-			$page_visit = rtrim( $http_host . $request_uri . $page_id . $e_reg, '?' );
761
+			$page_visit = rtrim($http_host.$request_uri.$page_id.$e_reg, '?');
762 762
 
763 763
 		}
764 764
 
765
-		return $page_visit != home_url( '/wp-admin/admin-ajax.php' ) ? $page_visit : '';
765
+		return $page_visit != home_url('/wp-admin/admin-ajax.php') ? $page_visit : '';
766 766
 
767 767
 	}
768 768
 
@@ -791,14 +791,14 @@  discard block
 block discarded – undo
791 791
 	  * @param string $function
792 792
 	  * @return void
793 793
 	  */
794
-	public function clear_session( $class = '', $function = '' ) {
794
+	public function clear_session($class = '', $function = '') {
795 795
 		//echo '<h3 style="color:#999;line-height:.9em;"><span style="color:#2EA2CC">' . __CLASS__ . '</span>::<span style="color:#E76700">' . __FUNCTION__ . '( ' . $class . '::' . $function . '() )</span><br/><span style="font-size:9px;font-weight:normal;">' . __FILE__ . '</span>    <b style="font-size:10px;">  ' . __LINE__ . ' </b></h3>';
796
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, 'session cleared by : ' . $class . '::' .  $function . '()' );
796
+		do_action('AHEE_log', __FILE__, __FUNCTION__, 'session cleared by : '.$class.'::'.$function.'()');
797 797
 		$this->reset_cart();
798 798
 		$this->reset_checkout();
799 799
 		$this->reset_transaction();
800 800
 		// wipe out everything that isn't a default session datum
801
-		$this->reset_data( array_keys( $this->_session_data ));
801
+		$this->reset_data(array_keys($this->_session_data));
802 802
 		// reset initial site access time and the session expiration
803 803
 		$this->_set_init_access_and_expiration();
804 804
 		$this->_save_session_to_db();
@@ -813,42 +813,42 @@  discard block
 block discarded – undo
813 813
 	  * @param bool  $show_all_notices
814 814
 	  * @return TRUE on success, FALSE on fail
815 815
 	  */
816
-	public function reset_data( $data_to_reset = array(), $show_all_notices = FALSE ) {
816
+	public function reset_data($data_to_reset = array(), $show_all_notices = FALSE) {
817 817
 		// if $data_to_reset is not in an array, then put it in one
818
-		if ( ! is_array( $data_to_reset ) ) {
819
-			$data_to_reset = array ( $data_to_reset );
818
+		if ( ! is_array($data_to_reset)) {
819
+			$data_to_reset = array($data_to_reset);
820 820
 		}
821 821
 		// nothing ??? go home!
822
-		if ( empty( $data_to_reset )) {
823
-			EE_Error::add_error( __( 'No session data could be reset, because no session var name was provided.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
822
+		if (empty($data_to_reset)) {
823
+			EE_Error::add_error(__('No session data could be reset, because no session var name was provided.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
824 824
 			return FALSE;
825 825
 		}
826 826
 		$return_value = TRUE;
827 827
 		// since $data_to_reset is an array, cycle through the values
828
-		foreach ( $data_to_reset as $reset ) {
828
+		foreach ($data_to_reset as $reset) {
829 829
 
830 830
 			// first check to make sure it is a valid session var
831
-			if ( isset( $this->_session_data[ $reset ] )) {
831
+			if (isset($this->_session_data[$reset])) {
832 832
 				// then check to make sure it is not a default var
833
-				if ( ! array_key_exists( $reset, $this->_default_session_vars )) {
833
+				if ( ! array_key_exists($reset, $this->_default_session_vars)) {
834 834
 					// remove session var
835
-					unset( $this->_session_data[ $reset ] );
836
-					if ( $show_all_notices ) {
837
-						EE_Error::add_success( sprintf( __( 'The session variable %s was removed.', 'event_espresso' ), $reset ), __FILE__, __FUNCTION__, __LINE__ );
835
+					unset($this->_session_data[$reset]);
836
+					if ($show_all_notices) {
837
+						EE_Error::add_success(sprintf(__('The session variable %s was removed.', 'event_espresso'), $reset), __FILE__, __FUNCTION__, __LINE__);
838 838
 					}
839
-					$return_value = !isset($return_value) ? TRUE : $return_value;
839
+					$return_value = ! isset($return_value) ? TRUE : $return_value;
840 840
 
841 841
 				} else {
842 842
 					// yeeeeeeeeerrrrrrrrrrr OUT !!!!
843
-					if ( $show_all_notices ) {
844
-						EE_Error::add_error( sprintf( __( 'Sorry! %s is a default session datum and can not be reset.', 'event_espresso' ), $reset ), __FILE__, __FUNCTION__, __LINE__ );
843
+					if ($show_all_notices) {
844
+						EE_Error::add_error(sprintf(__('Sorry! %s is a default session datum and can not be reset.', 'event_espresso'), $reset), __FILE__, __FUNCTION__, __LINE__);
845 845
 					}
846 846
 					$return_value = FALSE;
847 847
 				}
848 848
 
849
-			} else if ( $show_all_notices ) {
849
+			} else if ($show_all_notices) {
850 850
 				// oops! that session var does not exist!
851
-				EE_Error::add_error( sprintf( __( 'The session item provided, %s, is invalid or does not exist.', 'event_espresso' ), $reset ), __FILE__, __FUNCTION__, __LINE__ );
851
+				EE_Error::add_error(sprintf(__('The session item provided, %s, is invalid or does not exist.', 'event_espresso'), $reset), __FILE__, __FUNCTION__, __LINE__);
852 852
 				$return_value = FALSE;
853 853
 			}
854 854
 
@@ -869,8 +869,8 @@  discard block
 block discarded – undo
869 869
 	 *   @return	 string
870 870
 	 */
871 871
 	public function wp_loaded() {
872
-		if ( isset(  EE_Registry::instance()->REQ ) && EE_Registry::instance()->REQ->is_set( 'clear_session' )) {
873
-			$this->clear_session( __CLASS__, __FUNCTION__ );
872
+		if (isset(EE_Registry::instance()->REQ) && EE_Registry::instance()->REQ->is_set('clear_session')) {
873
+			$this->clear_session(__CLASS__, __FUNCTION__);
874 874
 		}
875 875
 	}
876 876
 
@@ -895,24 +895,24 @@  discard block
 block discarded – undo
895 895
 	  */
896 896
 	 public function garbage_collection() {
897 897
 		 // only perform during regular requests
898
-		 if ( ! defined( 'DOING_AJAX') || ! DOING_AJAX ) {
898
+		 if ( ! defined('DOING_AJAX') || ! DOING_AJAX) {
899 899
 			 /** @type WPDB $wpdb */
900 900
 			 global $wpdb;
901 901
 			 // since transient expiration timestamps are set in the future, we can compare against NOW
902 902
 			 $expiration = time();
903
-			 $too_far_in_the_the_future = $expiration + ( $this->_lifespan * 2 );
903
+			 $too_far_in_the_the_future = $expiration + ($this->_lifespan * 2);
904 904
 			 // filter the query limit. Set to 0 to turn off garbage collection
905
-			 $expired_session_transient_delete_query_limit = absint( apply_filters( 'FHEE__EE_Session__garbage_collection___expired_session_transient_delete_query_limit', 50 ));
905
+			 $expired_session_transient_delete_query_limit = absint(apply_filters('FHEE__EE_Session__garbage_collection___expired_session_transient_delete_query_limit', 50));
906 906
 			 // non-zero LIMIT means take out the trash
907
-			 if ( $expired_session_transient_delete_query_limit ) {
907
+			 if ($expired_session_transient_delete_query_limit) {
908 908
 				 //array of transient keys that require garbage collection
909 909
 				 $session_keys = array(
910 910
 					 EE_Session::session_id_prefix,
911 911
 					 EE_Session::hash_check_prefix,
912 912
 				 );
913
-				 foreach ( $session_keys as $session_key ) {
914
-					 $session_key = str_replace( '_', '\_', $session_key );
915
-					 $session_key = '\_transient\_timeout\_' . $session_key . '%';
913
+				 foreach ($session_keys as $session_key) {
914
+					 $session_key = str_replace('_', '\_', $session_key);
915
+					 $session_key = '\_transient\_timeout\_'.$session_key.'%';
916 916
 					 $SQL = "
917 917
 					SELECT option_name
918 918
 					FROM {$wpdb->options}
@@ -922,28 +922,28 @@  discard block
 block discarded – undo
922 922
 					OR option_value > {$too_far_in_the_the_future} )
923 923
 					LIMIT {$expired_session_transient_delete_query_limit}
924 924
 				";
925
-					 $expired_sessions = $wpdb->get_col( $SQL );
925
+					 $expired_sessions = $wpdb->get_col($SQL);
926 926
 					 // valid results?
927
-					 if ( ! $expired_sessions instanceof WP_Error && ! empty( $expired_sessions ) ) {
927
+					 if ( ! $expired_sessions instanceof WP_Error && ! empty($expired_sessions)) {
928 928
 						 // format array of results into something usable within the actual DELETE query's IN clause
929 929
 						 $expired = array();
930
-						 foreach ( $expired_sessions as $expired_session ) {
931
-							 $expired[ ] = "'" . $expired_session . "'";
932
-							 $expired[ ] = "'" . str_replace( 'timeout_', '', $expired_session ) . "'";
930
+						 foreach ($expired_sessions as $expired_session) {
931
+							 $expired[] = "'".$expired_session."'";
932
+							 $expired[] = "'".str_replace('timeout_', '', $expired_session)."'";
933 933
 						 }
934
-						 $expired = implode( ', ', $expired );
934
+						 $expired = implode(', ', $expired);
935 935
 						 $SQL = "
936 936
 						DELETE FROM {$wpdb->options}
937 937
 						WHERE option_name
938 938
 						IN ( $expired );
939 939
 					 ";
940
-						 $results = $wpdb->query( $SQL );
940
+						 $results = $wpdb->query($SQL);
941 941
 						 // if something went wrong, then notify the admin
942
-						 if ( $results instanceof WP_Error && is_admin() ) {
943
-							 EE_Error::add_error( $results->get_error_message(), __FILE__, __FUNCTION__, __LINE__ );
942
+						 if ($results instanceof WP_Error && is_admin()) {
943
+							 EE_Error::add_error($results->get_error_message(), __FILE__, __FUNCTION__, __LINE__);
944 944
 						 }
945 945
 					 }
946
-					 do_action( 'FHEE__EE_Session__garbage_collection___end', $expired_session_transient_delete_query_limit );
946
+					 do_action('FHEE__EE_Session__garbage_collection___end', $expired_session_transient_delete_query_limit);
947 947
 				 }
948 948
 			 }
949 949
 		 }
Please login to merge, or discard this patch.
core/admin/EE_Admin_Page_CPT_Init.core.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 	public function do_initial_loads() {
33 33
 		//we want to use the corresponding admin page object (but not route it!).  To do this we just set _routing to false.  That way this page object is being loaded on all pages to make sure we hook into admin properly.  But note... we are ONLY doing this if the given page is NOT pages we WANT to load ;)
34 34
 		//This is important because we have hooks that help redirect custom post type saves
35
-		if ( !isset( $_REQUEST['page'] ) || ( isset( $_REQUEST['page'] ) && $_REQUEST['page'] != $this->_menu_map->menu_slug ) ) {
35
+		if ( ! isset($_REQUEST['page']) || (isset($_REQUEST['page']) && $_REQUEST['page'] != $this->_menu_map->menu_slug)) {
36 36
 			$this->_routing = FALSE;
37 37
 			$this->_initialize_admin_page();
38 38
 		} else {
@@ -40,17 +40,17 @@  discard block
 block discarded – undo
40 40
 			$this->_initialize_admin_page();
41 41
 			//added for 4.1 to completely disable autosave for our pages. This can be removed once we fully enable autosave functionality
42 42
 			remove_filter('wp_print_scripts', 'wp_just_in_time_script_localization');
43
-			add_filter('wp_print_scripts', array($this, 'wp_just_in_time_script_localization'), 100 );
43
+			add_filter('wp_print_scripts', array($this, 'wp_just_in_time_script_localization'), 100);
44 44
 			//end removal of autosave functionality.
45 45
 		}
46 46
 	}
47 47
 
48 48
 	public function wp_just_in_time_script_localization() {
49
-		wp_localize_script( 'autosave', 'autosaveL10n', array(
49
+		wp_localize_script('autosave', 'autosaveL10n', array(
50 50
 			'autosaveInterval' => 172800,
51 51
 			'savingText' => __('Saving Draft&#8230;'),
52 52
 			'saveAlert' => __('The changes you made will be lost if you navigate away from this page.')
53
-		) );
53
+		));
54 54
 	}
55 55
 
56 56
 
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@
 block discarded – undo
1
-<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 /**
3 5
  * Event Espresso
4 6
  *
Please login to merge, or discard this patch.
core/admin/EE_Admin_Page_Init.core.php 3 patches
Spacing   +56 added lines, -56 removed lines patch added patch discarded remove patch
@@ -88,16 +88,16 @@  discard block
 block discarded – undo
88 88
 		$this->_set_init_properties();
89 89
 
90 90
 		//global styles/scripts across all wp admin pages
91
-		add_action('admin_enqueue_scripts', array($this, 'load_wp_global_scripts_styles'), 5 );
91
+		add_action('admin_enqueue_scripts', array($this, 'load_wp_global_scripts_styles'), 5);
92 92
 
93 93
 		//load initial stuff.
94 94
 		$this->_set_file_and_folder_name();
95 95
 
96 96
 		$this->_set_menu_map();
97 97
 
98
-		if ( empty( $this->_menu_map ) || is_array( $this->_menu_map ) )
98
+		if (empty($this->_menu_map) || is_array($this->_menu_map))
99 99
 			 {
100
-			 	EE_Error::doing_it_wrong( get_class( $this ) . '::$_menu_map', sprintf( __('The EE4 addon with the class %s is setting up the _menu_map property incorrectly for this version of EE core.  Please see Admin_Page_Init class examples in core for the new way of setting this property up.', 'event_espresso' ), get_class( $this ) ), '4.4.0' );
100
+			 	EE_Error::doing_it_wrong(get_class($this).'::$_menu_map', sprintf(__('The EE4 addon with the class %s is setting up the _menu_map property incorrectly for this version of EE core.  Please see Admin_Page_Init class examples in core for the new way of setting this property up.', 'event_espresso'), get_class($this)), '4.4.0');
101 101
 			 	return;
102 102
 			 }
103 103
 
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
 	public function load_wp_global_scripts_styles() {
160 160
 		/** STYLES **/
161 161
 		//register
162
-		wp_register_style('espresso_menu', EE_ADMIN_URL . 'assets/admin-menu-styles.css');
162
+		wp_register_style('espresso_menu', EE_ADMIN_URL.'assets/admin-menu-styles.css');
163 163
 
164 164
 
165 165
 
@@ -201,8 +201,8 @@  discard block
 block discarded – undo
201 201
 
202 202
 
203 203
 	protected function _set_capability() {
204
-		$capability = empty($this->capability) ?  $this->_menu_map->capability : $this->capability;
205
-		$this->capability = apply_filters( 'FHEE_' . $this->_menu_map->menu_slug . '_capability', $capability );
204
+		$capability = empty($this->capability) ? $this->_menu_map->capability : $this->capability;
205
+		$this->capability = apply_filters('FHEE_'.$this->_menu_map->menu_slug.'_capability', $capability);
206 206
 	}
207 207
 
208 208
 
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
 	public function initialize_admin_page() {
221 221
 		//let's check user access first
222 222
 		$this->_check_user_access();
223
-		if ( !is_object( $this->_loaded_page_object) ) return;
223
+		if ( ! is_object($this->_loaded_page_object)) return;
224 224
 		$this->_loaded_page_object->route_admin_request();
225 225
 		return;
226 226
 	}
@@ -232,25 +232,25 @@  discard block
 block discarded – undo
232 232
 
233 233
 
234 234
 	public function set_page_dependencies($wp_page_slug) {
235
-		if ( !$this->_load_page ) return;
235
+		if ( ! $this->_load_page) return;
236 236
 
237
-		if ( !is_object($this->_loaded_page_object) ) {
237
+		if ( ! is_object($this->_loaded_page_object)) {
238 238
 			$msg[] = __('We can\'t load the page because we\'re missing a valid page object that tells us what to load', 'event_espresso');
239
-			$msg[] = $msg[0] . "\r\n" . sprintf(
239
+			$msg[] = $msg[0]."\r\n".sprintf(
240 240
 				__('The custom slug you have set for this page is %s. This means we\'re looking for the class %s_Admin_Page (found in %s_Admin_Page.core.php) within your %s directory', 'event_espresso'),
241 241
 				 $this->_file_name,
242 242
 				 $this->_file_name,
243
-				 $this->_folder_path . $this->_file_name,
243
+				 $this->_folder_path.$this->_file_name,
244 244
 				 $this->_menu_map->menu_slug
245 245
 			);
246
-			throw new EE_Error( implode( '||', $msg) );
246
+			throw new EE_Error(implode('||', $msg));
247 247
 		}
248 248
 
249 249
 		$this->_loaded_page_object->set_wp_page_slug($wp_page_slug);
250
-		$page_hook = 'load-' . $wp_page_slug;
250
+		$page_hook = 'load-'.$wp_page_slug;
251 251
 		//hook into page load hook so all page specific stuff get's loaded.
252
-		if ( !empty($wp_page_slug) )
253
-			add_action($page_hook, array($this->_loaded_page_object, 'load_page_dependencies') );
252
+		if ( ! empty($wp_page_slug))
253
+			add_action($page_hook, array($this->_loaded_page_object, 'load_page_dependencies'));
254 254
 	}
255 255
 
256 256
 
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
 	 */
262 262
 	public function do_initial_loads() {
263 263
 		//no loading or initializing if menu map is setup incorrectly.
264
-		if ( empty( $this->_menu_map ) || is_array( $this->_menu_map ) ) {
264
+		if (empty($this->_menu_map) || is_array($this->_menu_map)) {
265 265
 			return;
266 266
 		}
267 267
 		$this->_initialize_admin_page();
@@ -278,19 +278,19 @@  discard block
 block discarded – undo
278 278
 		$bt = debug_backtrace();
279 279
 		//for more reliable determination of folder name
280 280
 		//we're using this to get the actual folder name of the CALLING class (i.e. the child class that extends this).  Why?  Because $this->menu_slug may be different than the folder name (to avoid conflicts with other plugins)
281
-		$class = get_class( $this );
282
-		foreach ( $bt as $index => $values ) {
283
-			if ( isset( $values['class'] ) && $values['class'] == $class ) {
281
+		$class = get_class($this);
282
+		foreach ($bt as $index => $values) {
283
+			if (isset($values['class']) && $values['class'] == $class) {
284 284
 				$file_index = $index - 1;
285
-				$this->_folder_name = basename(dirname($bt[$file_index]['file']) );
286
-				if ( !empty( $this->_folder_name ) ) break;
285
+				$this->_folder_name = basename(dirname($bt[$file_index]['file']));
286
+				if ( ! empty($this->_folder_name)) break;
287 287
 			}
288 288
 		}
289 289
 
290
-		$this->_folder_path = EE_ADMIN_PAGES . $this->_folder_name . DS;
290
+		$this->_folder_path = EE_ADMIN_PAGES.$this->_folder_name.DS;
291 291
 
292
-		$this->_file_name = preg_replace( '/^ee/' , 'EE', $this->_folder_name );
293
-		$this->_file_name = ucwords( str_replace('_', ' ', $this->_file_name) );
292
+		$this->_file_name = preg_replace('/^ee/', 'EE', $this->_folder_name);
293
+		$this->_file_name = ucwords(str_replace('_', ' ', $this->_file_name));
294 294
 		$this->_file_name = str_replace(' ', '_', $this->_file_name);
295 295
 	}
296 296
 
@@ -302,19 +302,19 @@  discard block
 block discarded – undo
302 302
 	 * @param bool $extend This indicates whether we're checking the extend directory for any register_hooks files/classes
303 303
 	 * @return array
304 304
 	 */
305
-	public function register_hooks( $extend = FALSE ) {
305
+	public function register_hooks($extend = FALSE) {
306 306
 
307 307
 		//get a list of files in the directory that have the "Hook" in their name an
308 308
 
309 309
 		//if this is an extended check (i.e. caf is active) then we will scan the caffeinated/extend directory first and any hook files that are found will be have their reference added to the $_files_hook array property.  Then, we make sure that when we loop through the core decaf directories to find hook files that we skip over any hooks files that have already been set by caf.
310
-		if ( $extend ) {
311
-			$hook_files_glob_path = apply_filters( 'FHEE__EE_Admin_Page_Init__register_hooks__hook_files_glob_path__extend', EE_CORE_CAF_ADMIN_EXTEND . $this->_folder_name . DS . '*' . $this->_file_name . '_Hooks_Extend.class.php' );
312
-			$this->_hook_paths = $this->_register_hook_files( $hook_files_glob_path, $extend );
310
+		if ($extend) {
311
+			$hook_files_glob_path = apply_filters('FHEE__EE_Admin_Page_Init__register_hooks__hook_files_glob_path__extend', EE_CORE_CAF_ADMIN_EXTEND.$this->_folder_name.DS.'*'.$this->_file_name.'_Hooks_Extend.class.php');
312
+			$this->_hook_paths = $this->_register_hook_files($hook_files_glob_path, $extend);
313 313
 		}
314 314
 
315 315
 		//loop through decaf folders
316
-		$hook_files_glob_path = apply_filters( 'FHEE__EE_Admin_Page_Init__register_hooks__hook_files_glob_path', $this->_folder_path . '*' . $this->_file_name . '_Hooks.class.php' );
317
-		$this->_hook_paths = array_merge( $this->_register_hook_files( $hook_files_glob_path ), $this->_hook_paths );  //making sure any extended hook paths are later in the array than the core hook paths!
316
+		$hook_files_glob_path = apply_filters('FHEE__EE_Admin_Page_Init__register_hooks__hook_files_glob_path', $this->_folder_path.'*'.$this->_file_name.'_Hooks.class.php');
317
+		$this->_hook_paths = array_merge($this->_register_hook_files($hook_files_glob_path), $this->_hook_paths); //making sure any extended hook paths are later in the array than the core hook paths!
318 318
 
319 319
 		return $this->_hook_paths;
320 320
 
@@ -322,27 +322,27 @@  discard block
 block discarded – undo
322 322
 
323 323
 
324 324
 
325
-	protected function _register_hook_files( $hook_files_glob_path, $extend = FALSE ) {
325
+	protected function _register_hook_files($hook_files_glob_path, $extend = FALSE) {
326 326
 		$hook_paths = array();
327
-		if ( $hook_files = glob( $hook_files_glob_path ) ) {
328
-			if ( empty( $hook_files ) ) {
327
+		if ($hook_files = glob($hook_files_glob_path)) {
328
+			if (empty($hook_files)) {
329 329
 				return array();
330 330
 			}
331
-			foreach ( $hook_files as $file ) {
331
+			foreach ($hook_files as $file) {
332 332
 				//lets get the linked admin.
333
-				$hook_file = $extend ? str_replace( EE_CORE_CAF_ADMIN_EXTEND . $this->_folder_name . DS, '', $file ) : str_replace($this->_folder_path, '', $file );
334
-				$replace = $extend ? '_' . $this->_file_name . '_Hooks_Extend.class.php' : '_' . $this->_file_name . '_Hooks.class.php';
335
-				$rel_admin = str_replace( $replace, '', $hook_file);
333
+				$hook_file = $extend ? str_replace(EE_CORE_CAF_ADMIN_EXTEND.$this->_folder_name.DS, '', $file) : str_replace($this->_folder_path, '', $file);
334
+				$replace = $extend ? '_'.$this->_file_name.'_Hooks_Extend.class.php' : '_'.$this->_file_name.'_Hooks.class.php';
335
+				$rel_admin = str_replace($replace, '', $hook_file);
336 336
 				$rel_admin = strtolower($rel_admin);
337 337
 				$hook_paths[] = $file;
338 338
 
339 339
 				//make sure we haven't already got a hook setup for this page path
340
-				if ( in_array( $rel_admin, $this->_files_hooked ) )
340
+				if (in_array($rel_admin, $this->_files_hooked))
341 341
 					continue;
342 342
 
343 343
 				$this->hook_file = $hook_file;
344
-				$rel_admin_hook = 'FHEE_do_other_page_hooks_' . $rel_admin;
345
-				$filter = add_filter( $rel_admin_hook, array($this, 'load_admin_hook') );
344
+				$rel_admin_hook = 'FHEE_do_other_page_hooks_'.$rel_admin;
345
+				$filter = add_filter($rel_admin_hook, array($this, 'load_admin_hook'));
346 346
 				$this->_files_hooked[] = $rel_admin;
347 347
 			}
348 348
 		}
@@ -367,7 +367,7 @@  discard block
 block discarded – undo
367 367
 	protected function _initialize_admin_page() {
368 368
 
369 369
 		//JUST CHECK WE'RE ON RIGHT PAGE.
370
-		if ( (!isset( $_REQUEST['page'] ) || $_REQUEST['page'] != $this->_menu_map->menu_slug) && $this->_routing )
370
+		if (( ! isset($_REQUEST['page']) || $_REQUEST['page'] != $this->_menu_map->menu_slug) && $this->_routing)
371 371
 			return; //not on the right page so let's get out.
372 372
 		$this->_load_page = TRUE;
373 373
 
@@ -375,30 +375,30 @@  discard block
 block discarded – undo
375 375
 //		spl_autoload_register(array( $this, 'set_autoloaders') );
376 376
 
377 377
 		//we don't need to do a page_request check here because it's only called via WP menu system.
378
-		$admin_page = $this->_file_name . '_Admin_Page';
379
-		$hook_suffix = $this->_menu_map->menu_slug . '_' . $admin_page;
378
+		$admin_page = $this->_file_name.'_Admin_Page';
379
+		$hook_suffix = $this->_menu_map->menu_slug.'_'.$admin_page;
380 380
 		$admin_page = apply_filters("FHEE__EE_Admin_Page_Init___initialize_admin_page__admin_page__{$hook_suffix}", $admin_page);
381 381
 
382 382
 		// define requested admin page class name then load the file and instantiate
383
-		$path_to_file = str_replace( array( '\\', '/' ), DS, $this->_folder_path . $admin_page . '.core.php' );
384
-		$path_to_file=apply_filters("FHEE__EE_Admin_Page_Init___initialize_admin_page__path_to_file__{$hook_suffix}",$path_to_file );//so if the file would be in EE_ADMIN/attendees/Attendee_Admin_Page.core.php, the filter would be FHEE__EE_Admin_Page_Init___initialize_admin_page__path_to_file__attendees_Attendee_Admin_Page
383
+		$path_to_file = str_replace(array('\\', '/'), DS, $this->_folder_path.$admin_page.'.core.php');
384
+		$path_to_file = apply_filters("FHEE__EE_Admin_Page_Init___initialize_admin_page__path_to_file__{$hook_suffix}", $path_to_file); //so if the file would be in EE_ADMIN/attendees/Attendee_Admin_Page.core.php, the filter would be FHEE__EE_Admin_Page_Init___initialize_admin_page__path_to_file__attendees_Attendee_Admin_Page
385 385
 
386
-		if ( is_readable( $path_to_file )) {
386
+		if (is_readable($path_to_file)) {
387 387
 			// This is a place where EE plugins can hook in to make sure their own files are required in the appropriate place
388
-			do_action( 'AHEE__EE_Admin_Page___initialize_admin_page__before_initialization' );
389
-			do_action( 'AHEE__EE_Admin_Page___initialize_admin_page__before_initialization_' . $this->_menu_map->menu_slug );
390
-			require_once( $path_to_file );
391
-			$a = new ReflectionClass( $admin_page );
392
-			$this->_loaded_page_object = $a->newInstance( $this->_routing );
388
+			do_action('AHEE__EE_Admin_Page___initialize_admin_page__before_initialization');
389
+			do_action('AHEE__EE_Admin_Page___initialize_admin_page__before_initialization_'.$this->_menu_map->menu_slug);
390
+			require_once($path_to_file);
391
+			$a = new ReflectionClass($admin_page);
392
+			$this->_loaded_page_object = $a->newInstance($this->_routing);
393 393
 		}
394
-		do_action( 'AHEE__EE_Admin_Page___initialize_admin_page__after_initialization' );
395
-		do_action( 'AHEE__EE_Admin_Page___initialize_admin_page__after_initialization_' . $this->_menu_map->menu_slug );
394
+		do_action('AHEE__EE_Admin_Page___initialize_admin_page__after_initialization');
395
+		do_action('AHEE__EE_Admin_Page___initialize_admin_page__after_initialization_'.$this->_menu_map->menu_slug);
396 396
 	}
397 397
 
398 398
 
399 399
 
400 400
 	public function get_admin_page_name() {
401
-		return $this->_file_name . '_Admin_Page';
401
+		return $this->_file_name.'_Admin_Page';
402 402
 	}
403 403
 
404 404
 
@@ -431,8 +431,8 @@  discard block
 block discarded – undo
431 431
 	 * @return bool|die true if pass (or admin) wp_die if fail
432 432
 	 */
433 433
 	private function _check_user_access() {
434
-		if ( ! EE_Registry::instance()->CAP->current_user_can( $this->_menu_map->capability, $this->_menu_map->menu_slug ) ) {
435
-			wp_die( __('You don\'t have access to this page.'), '', array( 'back_link' => true ) );
434
+		if ( ! EE_Registry::instance()->CAP->current_user_can($this->_menu_map->capability, $this->_menu_map->menu_slug)) {
435
+			wp_die(__('You don\'t have access to this page.'), '', array('back_link' => true));
436 436
 		}
437 437
 		return true;
438 438
 	}
Please login to merge, or discard this patch.
Braces   +22 added lines, -10 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@  discard block
 block discarded – undo
1
-<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 /**
3 5
  * Event Espresso
4 6
  *
@@ -220,7 +222,9 @@  discard block
 block discarded – undo
220 222
 	public function initialize_admin_page() {
221 223
 		//let's check user access first
222 224
 		$this->_check_user_access();
223
-		if ( !is_object( $this->_loaded_page_object) ) return;
225
+		if ( !is_object( $this->_loaded_page_object) ) {
226
+			return;
227
+		}
224 228
 		$this->_loaded_page_object->route_admin_request();
225 229
 		return;
226 230
 	}
@@ -232,7 +236,9 @@  discard block
 block discarded – undo
232 236
 
233 237
 
234 238
 	public function set_page_dependencies($wp_page_slug) {
235
-		if ( !$this->_load_page ) return;
239
+		if ( !$this->_load_page ) {
240
+			return;
241
+		}
236 242
 
237 243
 		if ( !is_object($this->_loaded_page_object) ) {
238 244
 			$msg[] = __('We can\'t load the page because we\'re missing a valid page object that tells us what to load', 'event_espresso');
@@ -249,8 +255,9 @@  discard block
 block discarded – undo
249 255
 		$this->_loaded_page_object->set_wp_page_slug($wp_page_slug);
250 256
 		$page_hook = 'load-' . $wp_page_slug;
251 257
 		//hook into page load hook so all page specific stuff get's loaded.
252
-		if ( !empty($wp_page_slug) )
253
-			add_action($page_hook, array($this->_loaded_page_object, 'load_page_dependencies') );
258
+		if ( !empty($wp_page_slug) ) {
259
+					add_action($page_hook, array($this->_loaded_page_object, 'load_page_dependencies') );
260
+		}
254 261
 	}
255 262
 
256 263
 
@@ -283,7 +290,9 @@  discard block
 block discarded – undo
283 290
 			if ( isset( $values['class'] ) && $values['class'] == $class ) {
284 291
 				$file_index = $index - 1;
285 292
 				$this->_folder_name = basename(dirname($bt[$file_index]['file']) );
286
-				if ( !empty( $this->_folder_name ) ) break;
293
+				if ( !empty( $this->_folder_name ) ) {
294
+					break;
295
+				}
287 296
 			}
288 297
 		}
289 298
 
@@ -337,8 +346,9 @@  discard block
 block discarded – undo
337 346
 				$hook_paths[] = $file;
338 347
 
339 348
 				//make sure we haven't already got a hook setup for this page path
340
-				if ( in_array( $rel_admin, $this->_files_hooked ) )
341
-					continue;
349
+				if ( in_array( $rel_admin, $this->_files_hooked ) ) {
350
+									continue;
351
+				}
342 352
 
343 353
 				$this->hook_file = $hook_file;
344 354
 				$rel_admin_hook = 'FHEE_do_other_page_hooks_' . $rel_admin;
@@ -367,8 +377,10 @@  discard block
 block discarded – undo
367 377
 	protected function _initialize_admin_page() {
368 378
 
369 379
 		//JUST CHECK WE'RE ON RIGHT PAGE.
370
-		if ( (!isset( $_REQUEST['page'] ) || $_REQUEST['page'] != $this->_menu_map->menu_slug) && $this->_routing )
371
-			return; //not on the right page so let's get out.
380
+		if ( (!isset( $_REQUEST['page'] ) || $_REQUEST['page'] != $this->_menu_map->menu_slug) && $this->_routing ) {
381
+					return;
382
+		}
383
+		//not on the right page so let's get out.
372 384
 		$this->_load_page = TRUE;
373 385
 
374 386
 		//let's set page specific autoloaders.  Note that this just sets autoloaders for THIS set of admin pages.
Please login to merge, or discard this patch.
Doc Comments   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -214,7 +214,6 @@  discard block
 block discarded – undo
214 214
 	 *
215 215
 	 * @access  public
216 216
 	 * @uses   _initialize_admin_page()
217
-	 * @param  string $dir_name directory name for specific admin_page being loaded.
218 217
 	 * @return void
219 218
 	 */
220 219
 	public function initialize_admin_page() {
@@ -231,6 +230,9 @@  discard block
 block discarded – undo
231 230
 
232 231
 
233 232
 
233
+	/**
234
+	 * @param string $wp_page_slug
235
+	 */
234 236
 	public function set_page_dependencies($wp_page_slug) {
235 237
 		if ( !$this->_load_page ) return;
236 238
 
Please login to merge, or discard this patch.
core/admin/EE_Admin_Page_Loader.core.php 2 patches
Spacing   +122 added lines, -122 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (!defined('EVENT_ESPRESSO_VERSION') )
2
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
3 3
 	exit('NO direct script access allowed');
4 4
 
5 5
 /**
@@ -119,8 +119,8 @@  discard block
 block discarded – undo
119 119
 		//let's do a scan and see what installed pages we have
120 120
 		$this->_get_installed_pages();
121 121
 		//set menus (has to be done on every load - we're not actually loading the page just setting the menus and where they point to).
122
-		add_action('admin_menu', array( $this, 'set_menus' ));
123
-		add_action( 'network_admin_menu', array( $this, 'set_network_menus' ) );
122
+		add_action('admin_menu', array($this, 'set_menus'));
123
+		add_action('network_admin_menu', array($this, 'set_network_menus'));
124 124
 	}
125 125
 
126 126
 
@@ -133,13 +133,13 @@  discard block
 block discarded – undo
133 133
 	 * @return void
134 134
 	 */
135 135
 	private function _define_caffeinated_constants() {
136
-		if ( ! defined( 'EE_CORE_CAF_ADMIN'  ) ) {
137
-			define( 'EE_CORE_CAF_ADMIN', EE_PLUGIN_DIR_PATH . 'caffeinated/admin/');
138
-			define( 'EE_CORE_CAF_ADMIN_URL', EE_PLUGIN_DIR_URL . 'caffeinated/admin/');
139
-			define( 'EE_CORE_CAF_ADMIN_NEW', EE_CORE_CAF_ADMIN . 'new/');
140
-			define( 'EE_CORE_CAF_ADMIN_EXTEND', EE_CORE_CAF_ADMIN . 'extend/');
141
-			define( 'EE_CORE_CAF_ADMIN_EXTEND_URL', EE_CORE_CAF_ADMIN_URL . 'extend/');
142
-			define( 'EE_CORE_CAF_ADMIN_HOOKS', EE_CORE_CAF_ADMIN . 'hooks/');
136
+		if ( ! defined('EE_CORE_CAF_ADMIN')) {
137
+			define('EE_CORE_CAF_ADMIN', EE_PLUGIN_DIR_PATH.'caffeinated/admin/');
138
+			define('EE_CORE_CAF_ADMIN_URL', EE_PLUGIN_DIR_URL.'caffeinated/admin/');
139
+			define('EE_CORE_CAF_ADMIN_NEW', EE_CORE_CAF_ADMIN.'new/');
140
+			define('EE_CORE_CAF_ADMIN_EXTEND', EE_CORE_CAF_ADMIN.'extend/');
141
+			define('EE_CORE_CAF_ADMIN_EXTEND_URL', EE_CORE_CAF_ADMIN_URL.'extend/');
142
+			define('EE_CORE_CAF_ADMIN_HOOKS', EE_CORE_CAF_ADMIN.'hooks/');
143 143
 		}
144 144
 	}
145 145
 
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
 
159 159
 		//set array of EE_Admin_Page_Menu_Group objects
160 160
 		$groups = array(
161
-			'main' => new EE_Admin_Page_Menu_Group( array(
161
+			'main' => new EE_Admin_Page_Menu_Group(array(
162 162
 				'menu_label' => __('Main', 'event_espresso'),
163 163
 				'show_on_menu' => EE_Admin_Page_Menu_Map::NONE,
164 164
 				'menu_slug' => 'main',
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
 				'menu_order' => 0,
167 167
 				'parent_slug' => 'espresso_events',
168 168
 				)),
169
-			'management' => new EE_Admin_Page_Menu_Group( array(
169
+			'management' => new EE_Admin_Page_Menu_Group(array(
170 170
 				'menu_label' => __('Management', 'event_espresso'),
171 171
 				'show_on_menu' => EE_Admin_Page_Menu_Map::BLOG_ADMIN_ONLY,
172 172
 				'menu_slug' => 'management',
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
 				'menu_order' => 10,
175 175
 				'parent_slug' => 'espresso_events'
176 176
 				)),
177
-			'settings' => new EE_Admin_Page_Menu_Group( array(
177
+			'settings' => new EE_Admin_Page_Menu_Group(array(
178 178
 				'menu_label' => __('Settings', 'event_espresso'),
179 179
 				'show_on_menu' => EE_Admin_Page_Menu_Map::BLOG_ADMIN_ONLY,
180 180
 				'menu_slug' => 'settings',
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
 				'menu_order' => 30,
183 183
 				'parent_slug' => 'espresso_events'
184 184
 				)),
185
-			'templates' => new EE_Admin_Page_Menu_Group( array(
185
+			'templates' => new EE_Admin_Page_Menu_Group(array(
186 186
 				'menu_label' => __('Templates', 'event_espresso'),
187 187
 				'show_on_menu' => EE_Admin_Page_Menu_Map::BLOG_ADMIN_ONLY,
188 188
 				'menu_slug' => 'templates',
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
 				'menu_order' => 40,
191 191
 				'parent_slug' => 'espresso_events'
192 192
 				)),
193
-			'extras' => new EE_Admin_Page_Menu_Group( array(
193
+			'extras' => new EE_Admin_Page_Menu_Group(array(
194 194
 				'menu_label' => __('Extras', 'event_espresso'),
195 195
 				'show_on_menu' => EE_Admin_Page_Menu_Map::BLOG_AND_NETWORK_ADMIN,
196 196
 				'menu_slug' => 'extras',
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
 				'parent_slug' => 'espresso_events',
200 200
 				'maintenance_mode_parent' => 'espresso_maintenance_settings'
201 201
 				)),
202
-			'tools' => new EE_Admin_Page_Menu_Group( array(
202
+			'tools' => new EE_Admin_Page_Menu_Group(array(
203 203
 				'menu_label' => __("Tools", "event_espresso"),
204 204
 				'show_on_menu' => EE_Admin_Page_Menu_Map::BLOG_ADMIN_ONLY,
205 205
 				'menu_slug' => 'tools',
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
 				'menu_order' => 60,
208 208
 				'parent_slug' => 'espresso_events'
209 209
 				)),
210
-			'addons' => new EE_Admin_Page_Menu_Group( array(
210
+			'addons' => new EE_Admin_Page_Menu_Group(array(
211 211
 				'show_on_menu' => EE_Admin_Page_Menu_Map::BLOG_AND_NETWORK_ADMIN,
212 212
 				'menu_label' => __('Add-ons', 'event_espresso'),
213 213
 				'menu_slug' => 'addons',
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
 				))
218 218
 			);
219 219
 
220
-		$this->_admin_menu_groups = apply_filters( 'FHEE__EE_Admin_Page_Loader___set_menu_groups__admin_menu_groups', $groups );
220
+		$this->_admin_menu_groups = apply_filters('FHEE__EE_Admin_Page_Loader___set_menu_groups__admin_menu_groups', $groups);
221 221
 	}
222 222
 
223 223
 
@@ -235,10 +235,10 @@  discard block
 block discarded – undo
235 235
 	private function _rearrange_menu_groups() {
236 236
 		$groups = array();
237 237
 		//first let's order the menu groups by their internal menu order (note usort type hinting to ensure the incoming array is EE_Admin_Page_Menu_Map objects )
238
-		usort( $this->_admin_menu_groups, array( $this, '_sort_menu_maps' ) );
239
-		foreach ( $this->_admin_menu_groups as $group ) {
240
-			if ( ! $group instanceof EE_Admin_Page_Menu_Group )
241
-				throw new EE_Error( sprintf( __('Unable to continue sorting the menu groups array because there is an invalid value for the menu groups.  All values in this array are required to be a EE_Admin_Page_Menu_Group object.  Instead there was: %s', 'event_espresso'), print_r($group, TRUE) ) );
238
+		usort($this->_admin_menu_groups, array($this, '_sort_menu_maps'));
239
+		foreach ($this->_admin_menu_groups as $group) {
240
+			if ( ! $group instanceof EE_Admin_Page_Menu_Group)
241
+				throw new EE_Error(sprintf(__('Unable to continue sorting the menu groups array because there is an invalid value for the menu groups.  All values in this array are required to be a EE_Admin_Page_Menu_Group object.  Instead there was: %s', 'event_espresso'), print_r($group, TRUE)));
242 242
 			$groups[$group->menu_slug] = $group;
243 243
 		}
244 244
 		return $groups;
@@ -256,48 +256,48 @@  discard block
 block discarded – undo
256 256
 	 */
257 257
 	private function _get_installed_pages() {
258 258
 		$installed_refs = array();
259
-		$exclude = array( 'assets', 'templates' );
259
+		$exclude = array('assets', 'templates');
260 260
 		// grab everything in the  admin core directory
261
-		$admin_screens = glob( EE_ADMIN_PAGES . '*', GLOB_ONLYDIR );
262
-		if ( $admin_screens ) {
263
-			foreach( $admin_screens as $admin_screen ) {
261
+		$admin_screens = glob(EE_ADMIN_PAGES.'*', GLOB_ONLYDIR);
262
+		if ($admin_screens) {
263
+			foreach ($admin_screens as $admin_screen) {
264 264
 				// files and anything in the exclude array need not apply
265
-				if ( is_dir( $admin_screen ) && ! in_array( basename( $admin_screen ), $exclude )) {
265
+				if (is_dir($admin_screen) && ! in_array(basename($admin_screen), $exclude)) {
266 266
 					// these folders represent the different EE admin pages
267
-					$installed_refs[ basename( $admin_screen ) ] = $admin_screen;
267
+					$installed_refs[basename($admin_screen)] = $admin_screen;
268 268
 				}
269 269
 			}
270 270
 		}
271 271
 
272
-		if ( empty( $installed_refs ) ) {
272
+		if (empty($installed_refs)) {
273 273
 			$error_msg[] = __('There are no EE_Admin pages detected, it looks like EE did not install properly', 'event_espresso');
274
-			$error_msg[] = $error_msg[0] . "\r\n" . sprintf( __('Check that the %s folder exists and is writable. Maybe try deactivating, then reactivating Event Espresso again.', 'event_espresso'), EE_ADMIN_PAGES );
275
-			throw new EE_Error( implode( '||', $error_msg ));
274
+			$error_msg[] = $error_msg[0]."\r\n".sprintf(__('Check that the %s folder exists and is writable. Maybe try deactivating, then reactivating Event Espresso again.', 'event_espresso'), EE_ADMIN_PAGES);
275
+			throw new EE_Error(implode('||', $error_msg));
276 276
 		}
277 277
 
278 278
 		//this just checks the caffeinated folder and takes care of setting up any caffeinated stuff.
279 279
 		$installed_refs = $this->_set_caffeinated($installed_refs);
280 280
 		//allow plugins to add in their own pages (note at this point they will need to have an autoloader defined for their class) OR hook into EEH_Autoloader::load_admin_page() to add their path.;
281
-		$installed_refs = apply_filters( 'FHEE__EE_Admin_Page_Loader___get_installed_pages__installed_refs', $installed_refs );
282
-		$this->_caffeinated_extends = apply_filters( 'FHEE__EE_Admin_Page_Loader___get_installed_pages__caffeinated_extends', $this->_caffeinated_extends );
281
+		$installed_refs = apply_filters('FHEE__EE_Admin_Page_Loader___get_installed_pages__installed_refs', $installed_refs);
282
+		$this->_caffeinated_extends = apply_filters('FHEE__EE_Admin_Page_Loader___get_installed_pages__caffeinated_extends', $this->_caffeinated_extends);
283 283
 
284 284
 		//loop through admin pages and setup the $_installed_pages array.
285 285
 		$hooks_ref = array();
286
-		foreach ( $installed_refs as $page => $path ) {
286
+		foreach ($installed_refs as $page => $path) {
287 287
 			// set autoloaders for our admin page classes based on included path information
288
-			EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder( $path );
288
+			EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder($path);
289 289
 			// build list of installed pages
290
-			$this->_installed_pages[$page] = $this->_load_admin_page( $page, $path );
290
+			$this->_installed_pages[$page] = $this->_load_admin_page($page, $path);
291 291
 			// verify returned object
292
-			if ( $this->_installed_pages[$page] instanceof EE_Admin_Page_Init ) {
293
-				if ( ! $this->_installed_pages[$page]->get_menu_map() instanceof EE_Admin_Page_Menu_Map ) {
292
+			if ($this->_installed_pages[$page] instanceof EE_Admin_Page_Init) {
293
+				if ( ! $this->_installed_pages[$page]->get_menu_map() instanceof EE_Admin_Page_Menu_Map) {
294 294
 					continue;
295 295
 				}
296 296
 
297 297
 				//skip if in full maintenance mode and maintenance_mode_parent is set
298 298
 				$maintenance_mode_parent = $this->_installed_pages[$page]->get_menu_map()->maintenance_mode_parent;
299
-				if ( empty( $maintenance_mode_parent ) && EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance ) {
300
-					unset( $installed_refs[$page] );
299
+				if (empty($maintenance_mode_parent) && EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance) {
300
+					unset($installed_refs[$page]);
301 301
 					continue;
302 302
 				}
303 303
 
@@ -305,45 +305,45 @@  discard block
 block discarded – undo
305 305
 				//flag for register hooks on extended pages b/c extended pages use the default INIT.
306 306
 				$extend = FALSE;
307 307
 				//now that we've got the admin_init objects... lets see if there are any caffeinated pages extending the originals.  If there are then let's hook into the init admin filter and load our extend instead.
308
-				if ( isset( $this->_caffeinated_extends[$page] ) ) {
308
+				if (isset($this->_caffeinated_extends[$page])) {
309 309
 					$this->_current_caf_extend_slug = $page;
310
-					$path_hook = 'FHEE__EE_Admin_Page_Init___initialize_admin_page__path_to_file__' . $this->_installed_pages[$page]->get_menu_map()->menu_slug . '_' . $this->_installed_pages[$page]->get_admin_page_name();
311
-					$path_runtime = 'return "' . $this->_caffeinated_extends[$this->_current_caf_extend_slug]["path"] . '";';
312
-					$page_hook = 'FHEE__EE_Admin_Page_Init___initialize_admin_page__admin_page__' . $this->_installed_pages[$page]->get_menu_map()->menu_slug . '_' . $this->_installed_pages[$page]->get_admin_page_name();
313
-					$page_runtime = 'return "' . $this->_caffeinated_extends[$this->_current_caf_extend_slug]["admin_page"] . '";';
310
+					$path_hook = 'FHEE__EE_Admin_Page_Init___initialize_admin_page__path_to_file__'.$this->_installed_pages[$page]->get_menu_map()->menu_slug.'_'.$this->_installed_pages[$page]->get_admin_page_name();
311
+					$path_runtime = 'return "'.$this->_caffeinated_extends[$this->_current_caf_extend_slug]["path"].'";';
312
+					$page_hook = 'FHEE__EE_Admin_Page_Init___initialize_admin_page__admin_page__'.$this->_installed_pages[$page]->get_menu_map()->menu_slug.'_'.$this->_installed_pages[$page]->get_admin_page_name();
313
+					$page_runtime = 'return "'.$this->_caffeinated_extends[$this->_current_caf_extend_slug]["admin_page"].'";';
314 314
 
315
-					$hook_function_path = create_function( '$path_to_file', $path_runtime);
316
-					$hook_function_page = create_function( '$admin_page', $page_runtime );
315
+					$hook_function_path = create_function('$path_to_file', $path_runtime);
316
+					$hook_function_page = create_function('$admin_page', $page_runtime);
317 317
 
318
-					add_filter( $path_hook, $hook_function_path );
319
-					add_filter( $page_hook, $hook_function_page );
318
+					add_filter($path_hook, $hook_function_path);
319
+					add_filter($page_hook, $hook_function_page);
320 320
 					$extend = TRUE;
321 321
 				}
322 322
 				//let's do the registered hooks
323
-				$extended_hooks = $this->_installed_pages[$page]->register_hooks( $extend );
323
+				$extended_hooks = $this->_installed_pages[$page]->register_hooks($extend);
324 324
 				$hooks_ref = array_merge($hooks_ref, $extended_hooks);
325 325
 			}
326 326
 		}
327 327
 
328 328
 		//the hooks_ref is all the pages where we have $extended _Hooks files that will extend a class in a different folder.  So we want to make sure we load the file for the parent.
329 329
 		//first make sure we've got unique values
330
-		$hooks_ref = array_unique( $hooks_ref );
330
+		$hooks_ref = array_unique($hooks_ref);
331 331
 		//now let's loop and require!
332
-		foreach ( $hooks_ref as $path ) {
333
-			require_once( $path );
332
+		foreach ($hooks_ref as $path) {
333
+			require_once($path);
334 334
 		}
335 335
 		//make sure we have menu slugs global setup. Used in EE_Admin_Page->page_setup() to ensure we don't do a full class load for an admin page that isn't requested.
336 336
 		global $ee_menu_slugs;
337 337
 		$ee_menu_slugs = $this->_menu_slugs;
338 338
 
339 339
 		//we need to loop again to run any early code
340
-		foreach ( $installed_refs as $page => $path ) {
341
-			if ( $this->_installed_pages[$page] instanceof EE_Admin_Page_Init ) {
340
+		foreach ($installed_refs as $page => $path) {
341
+			if ($this->_installed_pages[$page] instanceof EE_Admin_Page_Init) {
342 342
 				$this->_installed_pages[$page]->do_initial_loads();
343 343
 			}
344 344
 		}
345 345
 
346
-		do_action( 'AHEE__EE_Admin_Page_Loader___get_installed_pages_loaded', $this->_installed_pages );
346
+		do_action('AHEE__EE_Admin_Page_Loader___get_installed_pages_loaded', $this->_installed_pages);
347 347
 
348 348
 	}
349 349
 
@@ -355,9 +355,9 @@  discard block
 block discarded – undo
355 355
 	 * @param string $page_slug
356 356
 	 * @return EE_Admin_Page
357 357
 	 */
358
-	public function get_admin_page_object( $page_slug = '' ) {
359
-		if ( isset( $this->_installed_pages[ $page_slug ] )) {
360
-			return $this->_installed_pages[ $page_slug ]->loaded_page_object();
358
+	public function get_admin_page_object($page_slug = '') {
359
+		if (isset($this->_installed_pages[$page_slug])) {
360
+			return $this->_installed_pages[$page_slug]->loaded_page_object();
361 361
 		}
362 362
 		return NULL;
363 363
 	}
@@ -370,9 +370,9 @@  discard block
 block discarded – undo
370 370
 	 * @param $dir_name
371 371
 	 * @return string
372 372
 	 */
373
-	private function _get_classname_for_admin_page( $dir_name = '' ) {
374
-		$class_name = str_replace( '_', ' ', strtolower( $dir_name ));
375
-		return str_replace( ' ', '_', ucwords( $class_name )) . '_Admin_Page';
373
+	private function _get_classname_for_admin_page($dir_name = '') {
374
+		$class_name = str_replace('_', ' ', strtolower($dir_name));
375
+		return str_replace(' ', '_', ucwords($class_name)).'_Admin_Page';
376 376
 	}
377 377
 
378 378
 
@@ -383,9 +383,9 @@  discard block
 block discarded – undo
383 383
 	 * @param $dir_name
384 384
 	 * @return string
385 385
 	 */
386
-	private function _get_classname_for_admin_init_page( $dir_name = '' ) {
387
-		$class_name = str_replace( '_', ' ', strtolower( $dir_name ));
388
-		return str_replace( ' ', '_', ucwords( $class_name )) . '_Admin_Page_Init';
386
+	private function _get_classname_for_admin_init_page($dir_name = '') {
387
+		$class_name = str_replace('_', ' ', strtolower($dir_name));
388
+		return str_replace(' ', '_', ucwords($class_name)).'_Admin_Page_Init';
389 389
 	}
390 390
 
391 391
 
@@ -398,13 +398,13 @@  discard block
 block discarded – undo
398 398
 	 * @throws EE_Error
399 399
 	 * @return object|bool  return page object if valid, bool false if not.
400 400
 	 */
401
-	private function _load_admin_page( $page = '', $path = '' ) {
402
-		$class_name = $this->_get_classname_for_admin_init_page( $page );
403
- 		EE_Registry::instance()->load_file( $path, $class_name, 'core' );
404
-		if ( ! class_exists( $class_name )) {
405
-			$error_msg[] = sprintf( __('Something went wrong with loading the %s admin page.', 'event_espresso' ), $page);
406
-			$error_msg[] = $error_msg[0] . "\r\n" . sprintf( __( 'There is no Init class in place for the %s admin page.', 'event_espresso') . '<br />' . __( 'Make sure you have <strong>%s</strong> defined. If this is a non-EE-core admin page then you also must have an autoloader in place for your class', 'event_espresso'), $page, $class_name );
407
-			throw new EE_Error( implode( '||', $error_msg ));
401
+	private function _load_admin_page($page = '', $path = '') {
402
+		$class_name = $this->_get_classname_for_admin_init_page($page);
403
+ 		EE_Registry::instance()->load_file($path, $class_name, 'core');
404
+		if ( ! class_exists($class_name)) {
405
+			$error_msg[] = sprintf(__('Something went wrong with loading the %s admin page.', 'event_espresso'), $page);
406
+			$error_msg[] = $error_msg[0]."\r\n".sprintf(__('There is no Init class in place for the %s admin page.', 'event_espresso').'<br />'.__('Make sure you have <strong>%s</strong> defined. If this is a non-EE-core admin page then you also must have an autoloader in place for your class', 'event_espresso'), $page, $class_name);
407
+			throw new EE_Error(implode('||', $error_msg));
408 408
 		}
409 409
 		$a = new ReflectionClass($class_name);
410 410
 		return  $a->newInstance();
@@ -423,9 +423,9 @@  discard block
 block discarded – undo
423 423
 	public function set_menus() {
424 424
 		//prep the menu pages (sort, group.)
425 425
 		$this->_prep_pages();
426
-		foreach( $this->_prepped_menu_maps as $menu_map ) {
427
-			if ( EE_Registry::instance()->CAP->current_user_can( $menu_map->capability, $menu_map->menu_slug ) ) {
428
-				$menu_map->add_menu_page( FALSE );
426
+		foreach ($this->_prepped_menu_maps as $menu_map) {
427
+			if (EE_Registry::instance()->CAP->current_user_can($menu_map->capability, $menu_map->menu_slug)) {
428
+				$menu_map->add_menu_page(FALSE);
429 429
 			}
430 430
 		}
431 431
 	}
@@ -438,11 +438,11 @@  discard block
 block discarded – undo
438 438
 	 *
439 439
 	 * @return void
440 440
 	 */
441
-	public function set_network_menus(){
441
+	public function set_network_menus() {
442 442
 		$this->_prep_pages();
443
-		foreach( $this->_prepped_menu_maps as $menu_map ) {
444
-			if ( EE_Registry::instance()->CAP->current_user_can( $menu_map->capability, $menu_map->menu_slug ) ) {
445
-				$menu_map->add_menu_page( TRUE );
443
+		foreach ($this->_prepped_menu_maps as $menu_map) {
444
+			if (EE_Registry::instance()->CAP->current_user_can($menu_map->capability, $menu_map->menu_slug)) {
445
+				$menu_map->add_menu_page(TRUE);
446 446
 			}
447 447
 		}
448 448
 	}
@@ -463,22 +463,22 @@  discard block
 block discarded – undo
463 463
 		//rearrange _admin_menu_groups to be indexed by group slug.
464 464
 		$menu_groups = $this->_rearrange_menu_groups();
465 465
 
466
-		foreach( $this->_installed_pages as $page ) {
467
-			if ( $page instanceof EE_Admin_page_Init ) {
466
+		foreach ($this->_installed_pages as $page) {
467
+			if ($page instanceof EE_Admin_page_Init) {
468 468
 				$page_map = $page->get_menu_map();
469 469
 				//if we've got an array then the menu map is in the old format so let's throw a persistent notice that the admin system isn't setup correctly for this item.
470
-				if ( is_array( $page_map ) || empty( $page_map ) ) {
471
-					EE_Error::add_persistent_admin_notice( 'menu_map_warning_' . str_replace(' ', '_', $page->label) . '_' . EVENT_ESPRESSO_VERSION, sprintf( __('The admin page for %s was not correctly setup because it is using an older method for integrating with Event Espresso Core.  This means that full functionality for this component is not available.  This error message usually appears with an Add-on that is out of date.  Make sure you update all your Event Espresso 4 add-ons to the latest version to ensure they have necessary compatibility updates in place.', 'event_espresso' ), $page->label ) );
470
+				if (is_array($page_map) || empty($page_map)) {
471
+					EE_Error::add_persistent_admin_notice('menu_map_warning_'.str_replace(' ', '_', $page->label).'_'.EVENT_ESPRESSO_VERSION, sprintf(__('The admin page for %s was not correctly setup because it is using an older method for integrating with Event Espresso Core.  This means that full functionality for this component is not available.  This error message usually appears with an Add-on that is out of date.  Make sure you update all your Event Espresso 4 add-ons to the latest version to ensure they have necessary compatibility updates in place.', 'event_espresso'), $page->label));
472 472
 					continue;
473 473
 				}
474 474
 
475 475
 				//if page map is NOT a EE_Admin_Page_Menu_Map object then throw error.
476
-				if ( ! $page_map instanceof EE_Admin_Page_Menu_Map ) {
477
-					throw new EE_Error( sprintf( __('The menu map for %s must be an EE_Admin_Page_Menu_Map object.  Instead it is %s.  Please double check that the menu map has been configured correctly.', 'event_espresso'), $page->label, $page_map ) );
476
+				if ( ! $page_map instanceof EE_Admin_Page_Menu_Map) {
477
+					throw new EE_Error(sprintf(__('The menu map for %s must be an EE_Admin_Page_Menu_Map object.  Instead it is %s.  Please double check that the menu map has been configured correctly.', 'event_espresso'), $page->label, $page_map));
478 478
 				}
479 479
 
480 480
 				//use the maintenance_mode_parent property and maintenance mode status to determine if this page even gets added to array.
481
-				if ( empty( $page_map->maintenance_mode_parent ) &&  EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance ) {
481
+				if (empty($page_map->maintenance_mode_parent) && EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance) {
482 482
 					continue;
483 483
 				}
484 484
 
@@ -487,21 +487,21 @@  discard block
 block discarded – undo
487 487
 			}
488 488
 		}
489 489
 
490
-		if ( empty( $pages_array )) {
491
-			throw new EE_Error(__('Something went wrong when prepping the admin pages', 'event_espresso') );
490
+		if (empty($pages_array)) {
491
+			throw new EE_Error(__('Something went wrong when prepping the admin pages', 'event_espresso'));
492 492
 		}
493 493
 
494 494
 		//let's sort the groups, make sure it's a valid group, add header (if to show).
495
-		foreach ( $pages_array as $group => $menu_maps ) {
495
+		foreach ($pages_array as $group => $menu_maps) {
496 496
 			//valid_group?
497
-			if ( ! array_key_exists( $group, $menu_groups ) )
497
+			if ( ! array_key_exists($group, $menu_groups))
498 498
 				continue;
499 499
 
500 500
 			//sort pages.
501
-			usort( $menu_maps, array( $this, '_sort_menu_maps' ) );
501
+			usort($menu_maps, array($this, '_sort_menu_maps'));
502 502
 
503 503
 			//prepend header
504
-			array_unshift( $menu_maps, $menu_groups[$group] );
504
+			array_unshift($menu_maps, $menu_groups[$group]);
505 505
 
506 506
 			//reset $pages_array with prepped data
507 507
 			$pages_array[$group] = $menu_maps;
@@ -509,9 +509,9 @@  discard block
 block discarded – undo
509 509
 
510 510
 
511 511
 		//now let's setup the _prepped_menu_maps property
512
-		foreach ( $menu_groups as $group => $group_objs ) {
513
-			if ( isset( $pages_array[$group] ) )
514
-				$this->_prepped_menu_maps = array_merge( $this->_prepped_menu_maps, $pages_array[$group] );
512
+		foreach ($menu_groups as $group => $group_objs) {
513
+			if (isset($pages_array[$group]))
514
+				$this->_prepped_menu_maps = array_merge($this->_prepped_menu_maps, $pages_array[$group]);
515 515
 		}/**/
516 516
 
517 517
 	}
@@ -531,10 +531,10 @@  discard block
 block discarded – undo
531 531
 	 * @param array $installed_refs the original installed_refs array that may contain our NEW EE_Admin_Pages to be loaded.
532 532
 	 * @return array
533 533
 	 */
534
-	private function _set_caffeinated( $installed_refs ) {
534
+	private function _set_caffeinated($installed_refs) {
535 535
 
536 536
 		//first let's check if there IS a caffeinated folder. If there is not then lets get out.
537
-		if ( ! is_dir( EE_PLUGIN_DIR_PATH . 'caffeinated' . DS . 'admin' ) || ( defined( 'EE_DECAF' ) && EE_DECAF )) {
537
+		if ( ! is_dir(EE_PLUGIN_DIR_PATH.'caffeinated'.DS.'admin') || (defined('EE_DECAF') && EE_DECAF)) {
538 538
 			return $installed_refs;
539 539
 		}
540 540
 
@@ -543,15 +543,15 @@  discard block
 block discarded – undo
543 543
 		$exclude = array('tickets');
544 544
 
545 545
 		//okay let's setup an "New" pages first (we'll return installed refs later)
546
-		$new_admin_screens = glob( EE_CORE_CAF_ADMIN . 'new/*', GLOB_ONLYDIR );
547
-		if ( $new_admin_screens ) {
548
-			foreach( $new_admin_screens as $admin_screen ) {
546
+		$new_admin_screens = glob(EE_CORE_CAF_ADMIN.'new/*', GLOB_ONLYDIR);
547
+		if ($new_admin_screens) {
548
+			foreach ($new_admin_screens as $admin_screen) {
549 549
 				// files and anything in the exclude array need not apply
550
-				if ( is_dir( $admin_screen ) && ! in_array( basename( $admin_screen ), $exclude )) {
550
+				if (is_dir($admin_screen) && ! in_array(basename($admin_screen), $exclude)) {
551 551
 					// these folders represent the different NEW EE admin pages
552
-					$installed_refs[ basename( $admin_screen ) ] = $admin_screen;
552
+					$installed_refs[basename($admin_screen)] = $admin_screen;
553 553
 					// set autoloaders for our admin page classes based on included path information
554
-					EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder( $admin_screen );
554
+					EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder($admin_screen);
555 555
 //					$this->_caf_autoloader[] = array(
556 556
 //						'dir' => 'new',
557 557
 //						'folder' => basename( $admin_screen )
@@ -561,18 +561,18 @@  discard block
 block discarded – undo
561 561
 		}
562 562
 
563 563
 		//let's see if there are any EXTENDS to setup in the $_caffeinated_extends array (that will be used later for hooking into the _initialize_admin_age in the related core_init admin page)
564
-		$extends = glob( EE_CORE_CAF_ADMIN . 'extend/*', GLOB_ONLYDIR );
565
-		if ( $extends ) {
566
-			foreach( $extends as $extend ) {
567
-				if ( is_dir( $extend ) ) {
568
-					$extend_ref = basename( $extend );
564
+		$extends = glob(EE_CORE_CAF_ADMIN.'extend/*', GLOB_ONLYDIR);
565
+		if ($extends) {
566
+			foreach ($extends as $extend) {
567
+				if (is_dir($extend)) {
568
+					$extend_ref = basename($extend);
569 569
 					//now let's make sure there is a file that matches the expected format
570
-					$filename = str_replace(' ', '_', ucwords( str_replace('_', ' ', $extend_ref ) ) );
571
-					$filename = 'Extend_' . $filename . '_Admin_Page';
572
-					$this->_caffeinated_extends[$extend_ref]['path'] = str_replace( array( '\\', '/' ), DS, EE_CORE_CAF_ADMIN . 'extend' . DS . $extend_ref . DS . $filename . '.core.php' );
570
+					$filename = str_replace(' ', '_', ucwords(str_replace('_', ' ', $extend_ref)));
571
+					$filename = 'Extend_'.$filename.'_Admin_Page';
572
+					$this->_caffeinated_extends[$extend_ref]['path'] = str_replace(array('\\', '/'), DS, EE_CORE_CAF_ADMIN.'extend'.DS.$extend_ref.DS.$filename.'.core.php');
573 573
 					$this->_caffeinated_extends[$extend_ref]['admin_page'] = $filename;
574 574
 					// set autoloaders for our admin page classes based on included path information
575
-					EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder( $extend );
575
+					EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder($extend);
576 576
 //					$this->_caf_autoloader[] = array(
577 577
 //						'dir' => 'extend',
578 578
 //						'folder' => $extend_ref
@@ -583,22 +583,22 @@  discard block
 block discarded – undo
583 583
 
584 584
 		//let's see if there are any HOOK files and instantiate them if there are (so that hooks are loaded early!).
585 585
 		$ee_admin_hooks = array();
586
-		$hooks = glob( EE_CORE_CAF_ADMIN . 'hooks/*.class.php' );
587
-		if ( $hooks ) {
588
-			foreach ( $hooks as $hook ) {
589
-				if ( is_readable( $hook ) ) {
586
+		$hooks = glob(EE_CORE_CAF_ADMIN.'hooks/*.class.php');
587
+		if ($hooks) {
588
+			foreach ($hooks as $hook) {
589
+				if (is_readable($hook)) {
590 590
 					require_once $hook;
591
-					$classname = str_replace( EE_CORE_CAF_ADMIN . 'hooks/', '', $hook );
591
+					$classname = str_replace(EE_CORE_CAF_ADMIN.'hooks/', '', $hook);
592 592
 					$classname = str_replace('.class.php', '', $classname);
593
-					if ( class_exists( $classname ) ) {
594
-						$a = new ReflectionClass( $classname );
593
+					if (class_exists($classname)) {
594
+						$a = new ReflectionClass($classname);
595 595
 						$ee_admin_hooks[] = $a->newInstance();
596 596
 					}
597 597
 				}
598 598
 			}
599 599
 		}/**/
600 600
 
601
-		$ee_admin_hooks = apply_filters( 'FHEE__EE_Admin_Page_Loader__set_caffeinated__ee_admin_hooks', $ee_admin_hooks );
601
+		$ee_admin_hooks = apply_filters('FHEE__EE_Admin_Page_Loader__set_caffeinated__ee_admin_hooks', $ee_admin_hooks);
602 602
 
603 603
 		return $installed_refs;
604 604
 
@@ -655,8 +655,8 @@  discard block
 block discarded – undo
655 655
 	 * @param  EE_Admin_Page_Menu_Map $b being compared to
656 656
 	 * @return int    sort order
657 657
 	 */
658
-	private function _sort_menu_maps( EE_Admin_Page_Menu_Map $a, EE_Admin_Page_Menu_Map $b ) {
659
-		if ( $a->menu_order == $b->menu_order )
658
+	private function _sort_menu_maps(EE_Admin_Page_Menu_Map $a, EE_Admin_Page_Menu_Map $b) {
659
+		if ($a->menu_order == $b->menu_order)
660 660
 			return 0;
661 661
 		return ($a->menu_order < $b->menu_order) ? -1 : 1;
662 662
 	}
Please login to merge, or discard this patch.
Braces   +14 added lines, -9 removed lines patch added patch discarded remove patch
@@ -1,6 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (!defined('EVENT_ESPRESSO_VERSION') )
2
+if (!defined('EVENT_ESPRESSO_VERSION') ) {
3 3
 	exit('NO direct script access allowed');
4
+}
4 5
 
5 6
 /**
6 7
  * Event Espresso
@@ -237,8 +238,9 @@  discard block
 block discarded – undo
237 238
 		//first let's order the menu groups by their internal menu order (note usort type hinting to ensure the incoming array is EE_Admin_Page_Menu_Map objects )
238 239
 		usort( $this->_admin_menu_groups, array( $this, '_sort_menu_maps' ) );
239 240
 		foreach ( $this->_admin_menu_groups as $group ) {
240
-			if ( ! $group instanceof EE_Admin_Page_Menu_Group )
241
-				throw new EE_Error( sprintf( __('Unable to continue sorting the menu groups array because there is an invalid value for the menu groups.  All values in this array are required to be a EE_Admin_Page_Menu_Group object.  Instead there was: %s', 'event_espresso'), print_r($group, TRUE) ) );
241
+			if ( ! $group instanceof EE_Admin_Page_Menu_Group ) {
242
+							throw new EE_Error( sprintf( __('Unable to continue sorting the menu groups array because there is an invalid value for the menu groups.  All values in this array are required to be a EE_Admin_Page_Menu_Group object.  Instead there was: %s', 'event_espresso'), print_r($group, TRUE) ) );
243
+			}
242 244
 			$groups[$group->menu_slug] = $group;
243 245
 		}
244 246
 		return $groups;
@@ -494,8 +496,9 @@  discard block
 block discarded – undo
494 496
 		//let's sort the groups, make sure it's a valid group, add header (if to show).
495 497
 		foreach ( $pages_array as $group => $menu_maps ) {
496 498
 			//valid_group?
497
-			if ( ! array_key_exists( $group, $menu_groups ) )
498
-				continue;
499
+			if ( ! array_key_exists( $group, $menu_groups ) ) {
500
+							continue;
501
+			}
499 502
 
500 503
 			//sort pages.
501 504
 			usort( $menu_maps, array( $this, '_sort_menu_maps' ) );
@@ -510,8 +513,9 @@  discard block
 block discarded – undo
510 513
 
511 514
 		//now let's setup the _prepped_menu_maps property
512 515
 		foreach ( $menu_groups as $group => $group_objs ) {
513
-			if ( isset( $pages_array[$group] ) )
514
-				$this->_prepped_menu_maps = array_merge( $this->_prepped_menu_maps, $pages_array[$group] );
516
+			if ( isset( $pages_array[$group] ) ) {
517
+							$this->_prepped_menu_maps = array_merge( $this->_prepped_menu_maps, $pages_array[$group] );
518
+			}
515 519
 		}/**/
516 520
 
517 521
 	}
@@ -656,8 +660,9 @@  discard block
 block discarded – undo
656 660
 	 * @return int    sort order
657 661
 	 */
658 662
 	private function _sort_menu_maps( EE_Admin_Page_Menu_Map $a, EE_Admin_Page_Menu_Map $b ) {
659
-		if ( $a->menu_order == $b->menu_order )
660
-			return 0;
663
+		if ( $a->menu_order == $b->menu_order ) {
664
+					return 0;
665
+		}
661 666
 		return ($a->menu_order < $b->menu_order) ? -1 : 1;
662 667
 	}
663 668
 
Please login to merge, or discard this patch.
core/admin/EE_Help_Tour_final_stop.class.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (!defined('EVENT_ESPRESSO_VERSION') )
2
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
3 3
 	exit('NO direct script access allowed');
4 4
 
5 5
 /**
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 			'action' => 'admin_option_settings',
61 61
 			'page' => 'espresso_general_settings'
62 62
 			);
63
-		return '<p>' . sprintf( __('That\'s it for the tour!  At any time you can restart a tour by clicking on this help dropdown and then clicking one of the Tour buttons.  There are help tours available on all Event Espresso Admin pages.  If you want to turn off help tours for all pages, %sgo here%s. All the best with your events!', 'event_espresso'), '<a href="' . EE_Admin_Page::add_query_args_and_nonce($query_args, admin_url('admin.php') ) . '">', '</a>' ) . '</p>';
63
+		return '<p>'.sprintf(__('That\'s it for the tour!  At any time you can restart a tour by clicking on this help dropdown and then clicking one of the Tour buttons.  There are help tours available on all Event Espresso Admin pages.  If you want to turn off help tours for all pages, %sgo here%s. All the best with your events!', 'event_espresso'), '<a href="'.EE_Admin_Page::add_query_args_and_nonce($query_args, admin_url('admin.php')).'">', '</a>').'</p>';
64 64
 	}
65 65
 
66 66
 }
67 67
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,8 +6,9 @@
 block discarded – undo
6 6
  * @package Event Espresso
7 7
  * @subpackage messages
8 8
  */
9
-if (!defined('EVENT_ESPRESSO_VERSION') )
9
+if (!defined('EVENT_ESPRESSO_VERSION') ) {
10 10
 	exit('NO direct script access allowed');
11
+}
11 12
 
12 13
 /**
13 14
  *
Please login to merge, or discard this patch.
core/admin/templates/about_admin_wrapper.template.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,16 +1,16 @@
 block discarded – undo
1 1
 <div class="wrap espresso-admin about-wrap">
2 2
 
3 3
 	<h1><?php  echo $admin_page_title; ?></h1>
4
-	<div class="about-text"><?php echo !empty($admin_page_subtitle) ? $admin_page_subtitle : ''; ?></div>
5
-	<div class="ee-badge"><img class="" src=" <?php echo EE_GLOBAL_ASSETS_URL; ?>images/event-espresso-cup-90x90.png" width="90" height="90" alt="<?php printf( esc_attr__( '%s Logo', 'event_espresso' ), 'Event Espresso' ); ?>"/><br /><?php printf( __('Version %s', 'event_espresso' ),  EVENT_ESPRESSO_VERSION ); ?></div>
4
+	<div class="about-text"><?php echo ! empty($admin_page_subtitle) ? $admin_page_subtitle : ''; ?></div>
5
+	<div class="ee-badge"><img class="" src=" <?php echo EE_GLOBAL_ASSETS_URL; ?>images/event-espresso-cup-90x90.png" width="90" height="90" alt="<?php printf(esc_attr__('%s Logo', 'event_espresso'), 'Event Espresso'); ?>"/><br /><?php printf(__('Version %s', 'event_espresso'), EVENT_ESPRESSO_VERSION); ?></div>
6 6
 
7 7
 	<?php echo $nav_tabs; ?>
8 8
 
9 9
 
10 10
 <?php
11
-	do_action( 'AHEE__admin_wrapper__template__before_about_admin_page_content' );
11
+	do_action('AHEE__admin_wrapper__template__before_about_admin_page_content');
12 12
 	echo $about_admin_page_content;
13
-	do_action( 'AHEE__admin_wrapper__template__after_about_admin_page_content' );
13
+	do_action('AHEE__admin_wrapper__template__after_about_admin_page_content');
14 14
 ?>
15 15
 
16 16
 </div>
Please login to merge, or discard this patch.