Completed
Branch BUG-10738-inconsistency-in-ses... (4fb977)
by
unknown
104:46 queued 94:10
created
core/EE_Log.core.php 2 patches
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
  *
4 6
  * Class EE_Log
Please login to merge, or discard this patch.
Spacing   +56 added lines, -56 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
  * Class EE_Log
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 	 * @return EE_Log
63 63
 	 */
64 64
 	public static function instance() {
65
-		if ( ! self::$_instance instanceof EE_Log ) {
65
+		if ( ! self::$_instance instanceof EE_Log) {
66 66
 			self::$_instance = new self();
67 67
 		}
68 68
 		return self::$_instance;
@@ -74,11 +74,11 @@  discard block
 block discarded – undo
74 74
 	 */
75 75
 	private function __construct() {
76 76
 
77
-		if ( ! EE_Registry::instance()->CFG->admin->use_full_logging && ! EE_Registry::instance()->CFG->admin->use_remote_logging ) {
77
+		if ( ! EE_Registry::instance()->CFG->admin->use_full_logging && ! EE_Registry::instance()->CFG->admin->use_remote_logging) {
78 78
 			return;
79 79
 		}
80 80
 
81
-		$this->_logs_folder = EVENT_ESPRESSO_UPLOAD_DIR . 'logs' . DS;
81
+		$this->_logs_folder = EVENT_ESPRESSO_UPLOAD_DIR.'logs'.DS;
82 82
 		$this->_log_file = EE_Registry::instance()->CFG->admin->log_file_name();
83 83
 		$this->_log = '';
84 84
 		$this->_debug_file = EE_Registry::instance()->CFG->admin->debug_file_name();
@@ -86,15 +86,15 @@  discard block
 block discarded – undo
86 86
 		$this->_remote_logging_url = EE_Registry::instance()->CFG->admin->remote_logging_url;
87 87
 		$this->_remote_log = '';
88 88
 
89
-		add_action( 'admin_init', array( $this, 'verify_filesystem' ), -10 );
90
-		add_action( 'AHEE_log', array( $this, 'log' ), 10, 4 );
91
-		if ( EE_Registry::instance()->CFG->admin->use_full_logging ) {
92
-			add_action( 'shutdown', array( $this, 'write_log' ), 9999 );
89
+		add_action('admin_init', array($this, 'verify_filesystem'), -10);
90
+		add_action('AHEE_log', array($this, 'log'), 10, 4);
91
+		if (EE_Registry::instance()->CFG->admin->use_full_logging) {
92
+			add_action('shutdown', array($this, 'write_log'), 9999);
93 93
 			// if WP_DEBUG
94
-			add_action( 'shutdown', array( $this, 'write_debug' ), 9999 );
94
+			add_action('shutdown', array($this, 'write_debug'), 9999);
95 95
 		}
96
-		if ( EE_Registry::instance()->CFG->admin->use_remote_logging ) {
97
-			add_action( 'shutdown', array( $this, 'send_log' ), 9999 );
96
+		if (EE_Registry::instance()->CFG->admin->use_remote_logging) {
97
+			add_action('shutdown', array($this, 'send_log'), 9999);
98 98
 		}
99 99
 
100 100
 	}
@@ -108,11 +108,11 @@  discard block
 block discarded – undo
108 108
 	 */
109 109
 	public function verify_filesystem() {
110 110
 		try {
111
-			EEH_File::ensure_file_exists_and_is_writable( $this->_logs_folder . $this->_log_file );
112
-			EEH_File::ensure_file_exists_and_is_writable( $this->_logs_folder . $this->_debug_file );
113
-			EEH_File::add_htaccess_deny_from_all( $this->_logs_folder );
114
-		} catch( EE_Error $e ){
115
-			EE_Error::add_error( sprintf( __(  'Event Espresso logging could not be setup because: %s', 'event_espresso' ), ' &nbsp; &nbsp; ' . $e->getMessage() ), __FILE__, __FUNCTION__, __LINE__ );
111
+			EEH_File::ensure_file_exists_and_is_writable($this->_logs_folder.$this->_log_file);
112
+			EEH_File::ensure_file_exists_and_is_writable($this->_logs_folder.$this->_debug_file);
113
+			EEH_File::add_htaccess_deny_from_all($this->_logs_folder);
114
+		} catch (EE_Error $e) {
115
+			EE_Error::add_error(sprintf(__('Event Espresso logging could not be setup because: %s', 'event_espresso'), ' &nbsp; &nbsp; '.$e->getMessage()), __FILE__, __FUNCTION__, __LINE__);
116 116
 			return;
117 117
 		}
118 118
 	}
@@ -129,15 +129,15 @@  discard block
 block discarded – undo
129 129
 	 * @param string $type
130 130
 	 * @return string
131 131
 	 */
132
-	private function _format_message( $file = '', $function = '', $message = '', $type = '' ) {
133
-		$msg = '----------------------------------------------------------------------------------------' . PHP_EOL;
134
-		$msg .= '[' . current_time( 'mysql' ) . '] ';
135
-		$msg .= ! empty( $file ) ? basename( $file ) : '';
136
-		$msg .= ! empty( $file ) && ! empty( $function ) ? ' -> ' : '';
137
-		$msg .= ! empty( $function ) ? $function . '()' : '';
132
+	private function _format_message($file = '', $function = '', $message = '', $type = '') {
133
+		$msg = '----------------------------------------------------------------------------------------'.PHP_EOL;
134
+		$msg .= '['.current_time('mysql').'] ';
135
+		$msg .= ! empty($file) ? basename($file) : '';
136
+		$msg .= ! empty($file) && ! empty($function) ? ' -> ' : '';
137
+		$msg .= ! empty($function) ? $function.'()' : '';
138 138
 		$msg .= PHP_EOL;
139
-		$type = ! empty( $type ) ? $type : 'log message';
140
-		$msg .= ! empty( $message ) ? "\t" . '[' . $type . '] ' . $message . PHP_EOL : '';
139
+		$type = ! empty($type) ? $type : 'log message';
140
+		$msg .= ! empty($message) ? "\t".'['.$type.'] '.$message.PHP_EOL : '';
141 141
 		return $msg;
142 142
 	}
143 143
 
@@ -152,8 +152,8 @@  discard block
 block discarded – undo
152 152
 	 * @param string $message
153 153
 	 * @param string $type
154 154
 	 */
155
-	public function log( $file = '', $function = '', $message = '', $type = '' ) {
156
-		$this->_log .= $this->_format_message( $file, $function, $message, $type );
155
+	public function log($file = '', $function = '', $message = '', $type = '') {
156
+		$this->_log .= $this->_format_message($file, $function, $message, $type);
157 157
 	}
158 158
 
159 159
 
@@ -165,10 +165,10 @@  discard block
 block discarded – undo
165 165
 	public function write_log() {
166 166
 		try {
167 167
 			//get existing log file and append new log info
168
-			$this->_log = EEH_File::get_file_contents( $this->_logs_folder . $this->_log_file ) . $this->_log;
169
-			EEH_File::write_to_file( $this->_logs_folder . $this->_log_file, $this->_log, 'Event Espresso Log' );
170
-		} catch( EE_Error $e ){
171
-			EE_Error::add_error( sprintf( __(  'Could not write to the Event Espresso log file because: %s', 'event_espresso' ), ' &nbsp; &nbsp; ' . $e->getMessage() ), __FILE__, __FUNCTION__, __LINE__ );
168
+			$this->_log = EEH_File::get_file_contents($this->_logs_folder.$this->_log_file).$this->_log;
169
+			EEH_File::write_to_file($this->_logs_folder.$this->_log_file, $this->_log, 'Event Espresso Log');
170
+		} catch (EE_Error $e) {
171
+			EE_Error::add_error(sprintf(__('Could not write to the Event Espresso log file because: %s', 'event_espresso'), ' &nbsp; &nbsp; '.$e->getMessage()), __FILE__, __FUNCTION__, __LINE__);
172 172
 			return;
173 173
 		}
174 174
 	}
@@ -181,31 +181,31 @@  discard block
 block discarded – undo
181 181
 	 */
182 182
 	public function send_log() {
183 183
 
184
-		if ( empty( $this->_remote_logging_url )) {
184
+		if (empty($this->_remote_logging_url)) {
185 185
 			return;
186 186
 		}
187 187
 
188
-		$data = 'domain=' . $_SERVER['HTTP_HOST'];
189
-		$data .= '&ip=' . $_SERVER['SERVER_ADDR'];
190
-		$data .= '&server_type=' . $_SERVER['SERVER_SOFTWARE'];
191
-		$data .= '&time=' . time();
192
-		$data .= '&remote_log=' . $this->_log;
193
-		$data .= '&request_array=' . json_encode( $_REQUEST );
188
+		$data = 'domain='.$_SERVER['HTTP_HOST'];
189
+		$data .= '&ip='.$_SERVER['SERVER_ADDR'];
190
+		$data .= '&server_type='.$_SERVER['SERVER_SOFTWARE'];
191
+		$data .= '&time='.time();
192
+		$data .= '&remote_log='.$this->_log;
193
+		$data .= '&request_array='.json_encode($_REQUEST);
194 194
 		$data .= '&action=save';
195 195
 
196
-		if ( defined( 'EELOGGING_PASS' )) {
197
-			$data .= '&pass=' . EELOGGING_PASS;
196
+		if (defined('EELOGGING_PASS')) {
197
+			$data .= '&pass='.EELOGGING_PASS;
198 198
 		}
199
-		if ( defined( 'EELOGGING_KEY' )) {
200
-			$data .= '&key=' . EELOGGING_KEY;
199
+		if (defined('EELOGGING_KEY')) {
200
+			$data .= '&key='.EELOGGING_KEY;
201 201
 		}
202 202
 
203
-		$c = curl_init( $this->_remote_logging_url );
204
-		curl_setopt( $c, CURLOPT_POST, TRUE );
205
-		curl_setopt( $c, CURLOPT_POSTFIELDS, $data );
206
-		curl_setopt( $c, CURLOPT_RETURNTRANSFER, TRUE );
207
-		curl_exec( $c );
208
-		curl_close( $c );
203
+		$c = curl_init($this->_remote_logging_url);
204
+		curl_setopt($c, CURLOPT_POST, TRUE);
205
+		curl_setopt($c, CURLOPT_POSTFIELDS, $data);
206
+		curl_setopt($c, CURLOPT_RETURNTRANSFER, TRUE);
207
+		curl_exec($c);
208
+		curl_close($c);
209 209
 	}
210 210
 
211 211
 
@@ -216,18 +216,18 @@  discard block
 block discarded – undo
216 216
 	 * previous entries are overwritten
217 217
 	 */
218 218
 	public function write_debug() {
219
-		if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
219
+		if (defined('WP_DEBUG') && WP_DEBUG) {
220 220
 			$this->_debug_log = '';
221
-			foreach ( $_GET as $key => $value ) {
222
-				$this->_debug_log .= '$_GET["' . $key . '"] = "' . serialize($value) . '"' . PHP_EOL;
221
+			foreach ($_GET as $key => $value) {
222
+				$this->_debug_log .= '$_GET["'.$key.'"] = "'.serialize($value).'"'.PHP_EOL;
223 223
 			}
224
-			foreach ( $_POST as $key => $value ) {
225
-				$this->_debug_log .= '$_POST["' . $key . '"] = "' . serialize($value) . '"' . PHP_EOL;
224
+			foreach ($_POST as $key => $value) {
225
+				$this->_debug_log .= '$_POST["'.$key.'"] = "'.serialize($value).'"'.PHP_EOL;
226 226
 			}
227 227
 			try {
228
-				EEH_File::write_to_file( $this->_logs_folder . $this->_debug_file, $this->_debug_log, 'Event Espresso Debug Log' );
229
-			} catch( EE_Error $e ){
230
-				EE_Error::add_error( sprintf( __(  'Could not write to the Event Espresso debug log file because: %s', 'event_espresso' ), ' &nbsp; &nbsp; ' . $e->getMessage() ), __FILE__, __FUNCTION__, __LINE__ );
228
+				EEH_File::write_to_file($this->_logs_folder.$this->_debug_file, $this->_debug_log, 'Event Espresso Debug Log');
229
+			} catch (EE_Error $e) {
230
+				EE_Error::add_error(sprintf(__('Could not write to the Event Espresso debug log file because: %s', 'event_espresso'), ' &nbsp; &nbsp; '.$e->getMessage()), __FILE__, __FUNCTION__, __LINE__);
231 231
 				return;
232 232
 			}
233 233
 		}
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
 	 * __clone
240 240
 	 */
241 241
 	public function __clone() {
242
-		trigger_error( __( 'Clone is not allowed.', 'event_espresso' ), E_USER_ERROR );
242
+		trigger_error(__('Clone is not allowed.', 'event_espresso'), E_USER_ERROR);
243 243
 	}
244 244
 
245 245
 
Please login to merge, or discard this patch.
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.
Spacing   +49 added lines, -49 removed lines patch added patch discarded remove patch
@@ -61,31 +61,31 @@  discard block
 block discarded – undo
61 61
 	 * @param WP_Query $WP_Query
62 62
 	 * @return    string | NULL
63 63
 	 */
64
-	public function get_route( WP_Query $WP_Query ) {
64
+	public function get_route(WP_Query $WP_Query) {
65 65
 		$this->WP_Query = $WP_Query;
66 66
 		// assume this if first route being called
67 67
 		$previous_route = FALSE;
68 68
 		// but is it really ???
69
-		if ( ! empty( self::$_previous_routes )) {
69
+		if ( ! empty(self::$_previous_routes)) {
70 70
 			// get last run route
71
-			$previous_routes = array_values( self::$_previous_routes );
72
-			$previous_route = array_pop( $previous_routes );
71
+			$previous_routes = array_values(self::$_previous_routes);
72
+			$previous_route = array_pop($previous_routes);
73 73
 		}
74 74
 		//  has another route already been run ?
75
-		if ( $previous_route ) {
75
+		if ($previous_route) {
76 76
 			// check if  forwarding has been set
77
-			$current_route = $this->get_forward( $previous_route );
77
+			$current_route = $this->get_forward($previous_route);
78 78
 			try {
79 79
 				//check for recursive forwarding
80
-				if ( isset( self::$_previous_routes[ $current_route ] )) {
80
+				if (isset(self::$_previous_routes[$current_route])) {
81 81
 					throw new EE_Error(
82 82
 						sprintf(
83
-							__('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'),
83
+							__('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'),
84 84
 							$current_route
85 85
 						)
86 86
 					);
87 87
 				}
88
-			} catch ( EE_Error $e ) {
88
+			} catch (EE_Error $e) {
89 89
 				$e->get_error();
90 90
 				return NULL;
91 91
 			}
@@ -95,13 +95,13 @@  discard block
 block discarded – undo
95 95
 			// grab all routes
96 96
 			$routes = EE_Registry::instance()->CFG->get_routes();
97 97
 			//d( $routes );
98
-			foreach( $routes as $key => $route ) {
98
+			foreach ($routes as $key => $route) {
99 99
 				// check request for module route
100
-				if ( EE_Registry::instance()->REQ->is_set( $key )) {
100
+				if (EE_Registry::instance()->REQ->is_set($key)) {
101 101
 					//echo '<b style="color:#2EA2CC;">key : <span style="color:#E76700">' . $key . '</span></b><br />';
102
-					$current_route = sanitize_text_field( EE_Registry::instance()->REQ->get( $key ));
103
-					if ( $current_route ) {
104
-						$current_route = array( $key, $current_route );
102
+					$current_route = sanitize_text_field(EE_Registry::instance()->REQ->get($key));
103
+					if ($current_route) {
104
+						$current_route = array($key, $current_route);
105 105
 						//echo '<b style="color:#2EA2CC;">current_route : <span style="color:#E76700">' . $current_route . '</span></b><br />';
106 106
 						break;
107 107
 					}
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 			}
110 110
 		}
111 111
 		// sorry, but I can't read what you route !
112
-		if ( empty( $current_route )) {
112
+		if (empty($current_route)) {
113 113
 			return NULL;
114 114
 		}
115 115
 		//add route to previous routes array
@@ -129,46 +129,46 @@  discard block
 block discarded – undo
129 129
 	 *  @param 	string		$current_route
130 130
 	 *  @return 	mixed		EED_Module | boolean
131 131
 	 */
132
-	public function resolve_route( $key, $current_route ) {
132
+	public function resolve_route($key, $current_route) {
133 133
 		// get module method that route has been mapped to
134
-		$module_method = EE_Config::get_route( $current_route, $key );
134
+		$module_method = EE_Config::get_route($current_route, $key);
135 135
 		//EEH_Debug_Tools::printr( $module_method, '$module_method  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
136 136
 		// verify result was returned
137
-		if ( empty( $module_method )) {
138
-			$msg = sprintf( __( 'The requested route %s could not be mapped to any registered modules.', 'event_espresso' ), $current_route );
139
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
137
+		if (empty($module_method)) {
138
+			$msg = sprintf(__('The requested route %s could not be mapped to any registered modules.', 'event_espresso'), $current_route);
139
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
140 140
 			return FALSE;
141 141
 		}
142 142
 		// verify that result is an array
143
-		if ( ! is_array( $module_method )) {
144
-			$msg = sprintf( __( 'The %s  route has not been properly registered.', 'event_espresso' ), $current_route );
145
-			EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
143
+		if ( ! is_array($module_method)) {
144
+			$msg = sprintf(__('The %s  route has not been properly registered.', 'event_espresso'), $current_route);
145
+			EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
146 146
 			return FALSE;
147 147
 		}
148 148
 		// grab module name
149 149
 		$module_name = $module_method[0];
150 150
 		// verify that a class method was registered properly
151
-		if ( ! isset( $module_method[1] )) {
152
-			$msg = sprintf( __( 'A class method for the %s  route has not been properly registered.', 'event_espresso' ), $current_route );
153
-			EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
151
+		if ( ! isset($module_method[1])) {
152
+			$msg = sprintf(__('A class method for the %s  route has not been properly registered.', 'event_espresso'), $current_route);
153
+			EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
154 154
 			return FALSE;
155 155
 		}
156 156
 		// grab method
157 157
 		$method = $module_method[1];
158 158
 		// verify that class exists
159
-		if ( ! class_exists( $module_name )) {
160
-			$msg = sprintf( __( 'The requested %s class could not be found.', 'event_espresso' ), $module_name );
161
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
159
+		if ( ! class_exists($module_name)) {
160
+			$msg = sprintf(__('The requested %s class could not be found.', 'event_espresso'), $module_name);
161
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
162 162
 			return FALSE;
163 163
 		}
164 164
 		// verify that method exists
165
-		if ( ! method_exists( $module_name, $method )) {
166
-			$msg = sprintf( __( 'The class method %s for the %s route is in invalid.', 'event_espresso' ), $method, $current_route );
167
-			EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
165
+		if ( ! method_exists($module_name, $method)) {
166
+			$msg = sprintf(__('The class method %s for the %s route is in invalid.', 'event_espresso'), $method, $current_route);
167
+			EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
168 168
 			return FALSE;
169 169
 		}
170 170
 		// instantiate module and call route method
171
-		return $this->_module_router( $module_name, $method );
171
+		return $this->_module_router($module_name, $method);
172 172
 	}
173 173
 
174 174
 
@@ -182,16 +182,16 @@  discard block
 block discarded – undo
182 182
 	 * @param   string  $module_name
183 183
 	 * @return    EED_Module | NULL
184 184
 	 */
185
-	public static function module_factory( $module_name ) {
186
-		if ( $module_name == 'EED_Module' ) {
187
-			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__ );
185
+	public static function module_factory($module_name) {
186
+		if ($module_name == 'EED_Module') {
187
+			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__);
188 188
 			return NULL;
189 189
 		}
190 190
 		// let's pause to reflect on this...
191
-		$mod_reflector = new ReflectionClass( $module_name );
191
+		$mod_reflector = new ReflectionClass($module_name);
192 192
 		// ensure that class is actually a module
193
-		if ( ! $mod_reflector->isSubclassOf( 'EED_Module' )) {
194
-			EE_Error::add_error( sprintf( __( 'The requested %s module is not of the class EED_Module.', 'event_espresso' ), $module_name ), __FILE__, __FUNCTION__, __LINE__ );
193
+		if ( ! $mod_reflector->isSubclassOf('EED_Module')) {
194
+			EE_Error::add_error(sprintf(__('The requested %s module is not of the class EED_Module.', 'event_espresso'), $module_name), __FILE__, __FUNCTION__, __LINE__);
195 195
 			return NULL;
196 196
 		}
197 197
 		// instantiate and return module class
@@ -209,14 +209,14 @@  discard block
 block discarded – undo
209 209
 	 * @param   string  $method
210 210
 	 * @return    EED_Module | NULL
211 211
 	 */
212
-	private function _module_router( $module_name, $method ) {
212
+	private function _module_router($module_name, $method) {
213 213
 		// instantiate module class
214
-		$module = EE_Module_Request_Router::module_factory( $module_name );
215
-		if ( $module instanceof EED_Module ) {
214
+		$module = EE_Module_Request_Router::module_factory($module_name);
215
+		if ($module instanceof EED_Module) {
216 216
 			// and call whatever action the route was for
217 217
 			try {
218
-				call_user_func( array( $module, $method ), $this->WP_Query );
219
-			} catch ( EE_Error $e ) {
218
+				call_user_func(array($module, $method), $this->WP_Query);
219
+			} catch (EE_Error $e) {
220 220
 				$e->get_error();
221 221
 				return NULL;
222 222
 			}
@@ -233,8 +233,8 @@  discard block
 block discarded – undo
233 233
 	 * @param $current_route
234 234
 	 * @return    string
235 235
 	 */
236
-	public function get_forward( $current_route ) {
237
-		return EE_Config::get_forward( $current_route );
236
+	public function get_forward($current_route) {
237
+		return EE_Config::get_forward($current_route);
238 238
 	}
239 239
 
240 240
 
@@ -246,8 +246,8 @@  discard block
 block discarded – undo
246 246
 	 * @param $current_route
247 247
 	 * @return    string
248 248
 	 */
249
-	public function get_view( $current_route ) {
250
-		return EE_Config::get_view( $current_route );
249
+	public function get_view($current_route) {
250
+		return EE_Config::get_view($current_route);
251 251
 	}
252 252
 
253 253
 
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
257 257
 	 * @param $b
258 258
 	 * @return bool
259 259
 	 */
260
-	public function __set($a,$b) { return FALSE; }
260
+	public function __set($a, $b) { return FALSE; }
261 261
 
262 262
 
263 263
 
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.
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/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_PUE.core.php 3 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@
 block discarded – undo
32 32
 
33 33
 	/**
34 34
 	 * This property is used to hold an array of EE_default_term objects assigned to a custom post type when the post for that post type is published with no terms set for the taxonomy.
35
-	  *
35
+	 *
36 36
 	 * @var array of EE_Default_Term objects
37 37
 	 */
38 38
 	protected $_default_terms = array();
Please login to merge, or discard this patch.
Spacing   +88 added lines, -88 removed lines patch added patch discarded remove patch
@@ -49,13 +49,13 @@  discard block
 block discarded – undo
49 49
 	public function __construct() {
50 50
 //		throw new EE_Error('error');
51 51
 
52
-		do_action( 'AHEE_log', __CLASS__, __FUNCTION__ );
52
+		do_action('AHEE_log', __CLASS__, __FUNCTION__);
53 53
 
54 54
 		//wp have no MONTH_IN_SECONDS constant.  So we approximate our own assuming all months are 4 weeks long.
55
-		if ( !defined('MONTH_IN_SECONDS' ) )
56
-			define( 'MONTH_IN_SECONDS', WEEK_IN_SECONDS * 4 );
55
+		if ( ! defined('MONTH_IN_SECONDS'))
56
+			define('MONTH_IN_SECONDS', WEEK_IN_SECONDS * 4);
57 57
 
58
-		if(EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance){
58
+		if (EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance) {
59 59
 			$this->_uxip_hooks();
60 60
 		}
61 61
 
@@ -64,12 +64,12 @@  discard block
 block discarded – undo
64 64
 		$ueip_has_notified = EE_Registry::instance()->CFG->core->ee_ueip_has_notified;
65 65
 
66 66
 		//has optin been selected for data collection?
67
-		$espresso_data_optin = !empty($ueip_optin) ? $ueip_optin : NULL;
67
+		$espresso_data_optin = ! empty($ueip_optin) ? $ueip_optin : NULL;
68 68
 
69
-		if ( empty($ueip_has_notified) && EE_Maintenance_Mode::instance()->level() != EE_Maintenance_mode::level_2_complete_maintenance ) {
70
-			add_action('admin_notices', array( $this, 'espresso_data_collection_optin_notice' ), 10 );
71
-			add_action('admin_enqueue_scripts', array( $this, 'espresso_data_collection_enqueue_scripts' ), 10 );
72
-			add_action('wp_ajax_espresso_data_optin', array( $this, 'espresso_data_optin_ajax_handler' ), 10 );
69
+		if (empty($ueip_has_notified) && EE_Maintenance_Mode::instance()->level() != EE_Maintenance_mode::level_2_complete_maintenance) {
70
+			add_action('admin_notices', array($this, 'espresso_data_collection_optin_notice'), 10);
71
+			add_action('admin_enqueue_scripts', array($this, 'espresso_data_collection_enqueue_scripts'), 10);
72
+			add_action('wp_ajax_espresso_data_optin', array($this, 'espresso_data_optin_ajax_handler'), 10);
73 73
 			update_option('ee_ueip_optin', 'yes');
74 74
 			$espresso_data_optin = 'yes';
75 75
 		}
@@ -78,80 +78,80 @@  discard block
 block discarded – undo
78 78
 		$extra_stats = array();
79 79
 
80 80
 		//only collect extra stats if the plugin user has opted in.
81
-		if ( !empty($espresso_data_optin) && $espresso_data_optin == 'yes' ) {
81
+		if ( ! empty($espresso_data_optin) && $espresso_data_optin == 'yes') {
82 82
 			//let's only setup extra data if transient has expired
83
-			if ( false === ( $transient = get_transient('ee_extra_data') ) && EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance ) {
83
+			if (false === ($transient = get_transient('ee_extra_data')) && EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance) {
84 84
 
85 85
 				$current_site = is_multisite() ? get_current_site() : NULL;
86
-				$site_pre = ! is_main_site() && ! empty($current_site) ? trim( preg_replace('/\b\w\S\w\b/', '', $current_site->domain ), '.' ) . '_' : '';
86
+				$site_pre = ! is_main_site() && ! empty($current_site) ? trim(preg_replace('/\b\w\S\w\b/', '', $current_site->domain), '.').'_' : '';
87 87
 
88 88
 
89 89
 				//active gateways
90 90
 				$active_gateways = get_option('event_espresso_active_gateways');
91
-				if ( !empty($active_gateways ) ) {
92
-					foreach ( (array) $active_gateways as $gateway => $ignore ) {
93
-						$extra_stats[$site_pre . $gateway . '_gateway_active'] = 1;
91
+				if ( ! empty($active_gateways)) {
92
+					foreach ((array) $active_gateways as $gateway => $ignore) {
93
+						$extra_stats[$site_pre.$gateway.'_gateway_active'] = 1;
94 94
 					}
95 95
 				}
96 96
 
97
-				if ( is_multisite() && is_main_site() ) {
97
+				if (is_multisite() && is_main_site()) {
98 98
 					$extra_stats['is_multisite'] = true;
99 99
 				}
100 100
 
101 101
 				//what is the current active theme?
102 102
 				$active_theme = get_option('uxip_ee_active_theme');
103
-				if ( !empty( $active_theme ) )
104
-					$extra_stats[$site_pre . 'active_theme'] = $active_theme;
103
+				if ( ! empty($active_theme))
104
+					$extra_stats[$site_pre.'active_theme'] = $active_theme;
105 105
 
106 106
 				//event info regarding an all event count and all "active" event count
107 107
 				$all_events_count = get_option('uxip_ee4_all_events_count');
108
-				if ( !empty( $all_events_count ) )
109
-					$extra_stats[$site_pre . 'ee4_all_events_count'] = $all_events_count;
108
+				if ( ! empty($all_events_count))
109
+					$extra_stats[$site_pre.'ee4_all_events_count'] = $all_events_count;
110 110
 				$active_events_count = get_option('uxip_ee4_active_events_count');
111
-				if ( !empty( $active_events_count ) )
112
-					$extra_stats[$site_pre . 'ee4_active_events_count'] = $active_events_count;
111
+				if ( ! empty($active_events_count))
112
+					$extra_stats[$site_pre.'ee4_active_events_count'] = $active_events_count;
113 113
 
114 114
 				//datetime stuff
115 115
 				$dtt_count = get_option('uxip_ee_all_dtts_count');
116
-				if ( !empty( $dtt_count ) )
117
-					$extra_stats[$site_pre . 'all_dtts_count'] = $dtt_count;
116
+				if ( ! empty($dtt_count))
117
+					$extra_stats[$site_pre.'all_dtts_count'] = $dtt_count;
118 118
 
119 119
 				$dtt_sold = get_option('uxip_ee_dtt_sold');
120
-				if ( !empty( $dtt_sold ) )
121
-					$extra_stats[$site_pre . 'dtt_sold'] = $dtt_sold;
120
+				if ( ! empty($dtt_sold))
121
+					$extra_stats[$site_pre.'dtt_sold'] = $dtt_sold;
122 122
 
123 123
 				//ticket stuff
124 124
 				$all_tkt_count = get_option('uxip_ee_all_tkt_count');
125
-				if ( !empty( $all_tkt_count ) )
126
-					$extra_stats[$site_pre . 'all_tkt_count'] = $all_tkt_count;
125
+				if ( ! empty($all_tkt_count))
126
+					$extra_stats[$site_pre.'all_tkt_count'] = $all_tkt_count;
127 127
 
128 128
 				$free_tkt_count = get_option('uxip_ee_free_tkt_count');
129
-				if ( !empty( $free_tkt_count ) )
130
-					$extra_stats[$site_pre . 'free_tkt_count'] = $free_tkt_count;
129
+				if ( ! empty($free_tkt_count))
130
+					$extra_stats[$site_pre.'free_tkt_count'] = $free_tkt_count;
131 131
 
132 132
 				$paid_tkt_count = get_option('uxip_ee_paid_tkt_count');
133
-				if ( !empty( $paid_tkt_count ) )
134
-					$extra_stats[$site_pre . 'paid_tkt_count'] = $paid_tkt_count;
133
+				if ( ! empty($paid_tkt_count))
134
+					$extra_stats[$site_pre.'paid_tkt_count'] = $paid_tkt_count;
135 135
 
136
-				$tkt_sold = get_option('uxip_ee_tkt_sold' );
137
-				if ( !empty($tkt_sold) )
138
-					$extra_stats[$site_pre . 'tkt_sold'] = $tkt_sold;
136
+				$tkt_sold = get_option('uxip_ee_tkt_sold');
137
+				if ( ! empty($tkt_sold))
138
+					$extra_stats[$site_pre.'tkt_sold'] = $tkt_sold;
139 139
 
140 140
 				//phpversion checking
141 141
 				$extra_stats['phpversion'] = function_exists('phpversion') ? phpversion() : 'unknown';
142 142
 
143 143
 				//set transient
144
-				set_transient( 'ee_extra_data', $extra_stats, WEEK_IN_SECONDS );
144
+				set_transient('ee_extra_data', $extra_stats, WEEK_IN_SECONDS);
145 145
 			}
146 146
 		}
147 147
 
148 148
 
149 149
 
150 150
 		// PUE Auto Upgrades stuff
151
-		if (is_readable(EE_THIRD_PARTY . 'pue/pue-client.php')) { //include the file
152
-			require_once(EE_THIRD_PARTY . 'pue/pue-client.php' );
151
+		if (is_readable(EE_THIRD_PARTY.'pue/pue-client.php')) { //include the file
152
+			require_once(EE_THIRD_PARTY.'pue/pue-client.php');
153 153
 
154
-			$api_key = isset( EE_Registry::instance()->NET_CFG->core->site_license_key ) ? EE_Registry::instance()->NET_CFG->core->site_license_key : '';
154
+			$api_key = isset(EE_Registry::instance()->NET_CFG->core->site_license_key) ? EE_Registry::instance()->NET_CFG->core->site_license_key : '';
155 155
 			$host_server_url = 'https://eventespresso.com'; //this needs to be the host server where plugin update engine is installed. Note, if you leave this blank then it is assumed the WordPress repo will be used and we'll just check there.
156 156
 
157 157
 			//Note: PUE uses a simple preg_match to determine what type is currently installed based on version number.  So it's important that you use a key for the version type that is unique and not found in another key.
@@ -163,9 +163,9 @@  discard block
 block discarded – undo
163 163
 			//$plugin_slug['prerelease']['b'] = 'some-pre-release-slug';
164 164
 			//..WOULD work!
165 165
 			$plugin_slug = array(
166
-				'free' => array( 'decaf' => 'event-espresso-core-decaf' ),
167
-				'premium' => array( 'p' => 'event-espresso-core-reg' ),
168
-				'prerelease' => array( 'beta' => 'event-espresso-core-pr' )
166
+				'free' => array('decaf' => 'event-espresso-core-decaf'),
167
+				'premium' => array('p' => 'event-espresso-core-reg'),
168
+				'prerelease' => array('beta' => 'event-espresso-core-pr')
169 169
 				);
170 170
 
171 171
 
@@ -192,14 +192,14 @@  discard block
 block discarded – undo
192 192
 	 * The purpose of this function is to display information about Event Espresso data collection and a optin selection for extra data collecting by users.
193 193
 	 * @return string html.
194 194
 	 */
195
-	 public static function espresso_data_collection_optin_text( $extra = TRUE ) {
196
-	 	if ( ! $extra ) {
197
-			 echo '<h2 class="ee-admin-settings-hdr" '. (!$extra ? 'id="UXIP_settings"' : '').'>'.__('User eXperience Improvement Program (UXIP)', 'event_espresso').EEH_Template::get_help_tab_link('organization_logo_info').'</h2>';
198
-			 echo sprintf( __('%sPlease help us make Event Espresso better and vote for your favorite features.%s The %sUser eXperience Improvement Program (UXIP)%s, has been created so when you use Event Espresso you are voting for the features and settings that are important to you. The UXIP helps us understand how you use our products and services, track problems and in what context. If you opt-out of the UXIP you essentially elect for us to disregard how you use Event Espresso as we build new features and make changes. Participation in the program is completely voluntary but it is enabled by default. The end results of the UXIP are software improvements to better meet your needs. The data we collect will never be sold, traded, or misused in any way. %sPlease see our %sPrivacy Policy%s for more information.', 'event_espresso'), '<p><em>', '</em></p>','<a href="http://eventespresso.com/about/user-experience-improvement-program-uxip/" target="_blank">','</a>','<br><br>','<a href="http://eventespresso.com/about/privacy-policy/" target="_blank">','</a>' );
195
+	 public static function espresso_data_collection_optin_text($extra = TRUE) {
196
+	 	if ( ! $extra) {
197
+			 echo '<h2 class="ee-admin-settings-hdr" '.( ! $extra ? 'id="UXIP_settings"' : '').'>'.__('User eXperience Improvement Program (UXIP)', 'event_espresso').EEH_Template::get_help_tab_link('organization_logo_info').'</h2>';
198
+			 echo sprintf(__('%sPlease help us make Event Espresso better and vote for your favorite features.%s The %sUser eXperience Improvement Program (UXIP)%s, has been created so when you use Event Espresso you are voting for the features and settings that are important to you. The UXIP helps us understand how you use our products and services, track problems and in what context. If you opt-out of the UXIP you essentially elect for us to disregard how you use Event Espresso as we build new features and make changes. Participation in the program is completely voluntary but it is enabled by default. The end results of the UXIP are software improvements to better meet your needs. The data we collect will never be sold, traded, or misused in any way. %sPlease see our %sPrivacy Policy%s for more information.', 'event_espresso'), '<p><em>', '</em></p>', '<a href="http://eventespresso.com/about/user-experience-improvement-program-uxip/" target="_blank">', '</a>', '<br><br>', '<a href="http://eventespresso.com/about/privacy-policy/" target="_blank">', '</a>');
199 199
 		} else {
200
-			$settings_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'default'), admin_url( 'admin.php?page=espresso_general_settings') );
200
+			$settings_url = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'default'), admin_url('admin.php?page=espresso_general_settings'));
201 201
 			$settings_url .= '#UXIP_settings';
202
-			echo sprintf( __( 'The Event Espresso UXIP feature is active on your site. For %smore info%s and to opt-out %sclick here%s.', 'event_espresso' ), '<a href="http://eventespresso.com/about/user-experience-improvement-program-uxip/" traget="_blank">', '</a>', '<a href="' . $settings_url . '" target="_blank">', '</a>' );
202
+			echo sprintf(__('The Event Espresso UXIP feature is active on your site. For %smore info%s and to opt-out %sclick here%s.', 'event_espresso'), '<a href="http://eventespresso.com/about/user-experience-improvement-program-uxip/" traget="_blank">', '</a>', '<a href="'.$settings_url.'" target="_blank">', '</a>');
203 203
 		}
204 204
 	}
205 205
 
@@ -208,9 +208,9 @@  discard block
 block discarded – undo
208 208
 
209 209
 	function espresso_data_collection_optin_notice() {
210 210
 		$ueip_has_notified = EE_Registry::instance()->CFG->core->ee_ueip_has_notified;
211
-		if ( $ueip_has_notified ) return;
212
-		$settings_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'default'), admin_url( 'admin.php?page=espresso_general_settings') );
213
-		$settings_url = $settings_url . '#UXIP_settings';
211
+		if ($ueip_has_notified) return;
212
+		$settings_url = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'default'), admin_url('admin.php?page=espresso_general_settings'));
213
+		$settings_url = $settings_url.'#UXIP_settings';
214 214
 		?>
215 215
 		<div class="updated data-collect-optin" id="espresso-data-collect-optin-container">
216 216
 			<div id="data-collect-optin-options-container">
@@ -232,8 +232,8 @@  discard block
 block discarded – undo
232 232
 	 * @return void
233 233
 	 */
234 234
 	function espresso_data_collection_enqueue_scripts() {
235
-		wp_register_script( 'ee-data-optin-js', EE_GLOBAL_ASSETS_URL . 'scripts/ee-data-optin.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE );
236
-		wp_register_style( 'ee-data-optin-css', EE_GLOBAL_ASSETS_URL . 'css/ee-data-optin.css', array(), EVENT_ESPRESSO_VERSION );
235
+		wp_register_script('ee-data-optin-js', EE_GLOBAL_ASSETS_URL.'scripts/ee-data-optin.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE);
236
+		wp_register_style('ee-data-optin-css', EE_GLOBAL_ASSETS_URL.'css/ee-data-optin.css', array(), EVENT_ESPRESSO_VERSION);
237 237
 
238 238
 		wp_enqueue_script('ee-data-optin-js');
239 239
 		wp_enqueue_style('ee-data-optin-css');
@@ -248,14 +248,14 @@  discard block
 block discarded – undo
248 248
 	function espresso_data_optin_ajax_handler() {
249 249
 
250 250
 		//verify nonce
251
-		if ( isset($_POST['nonce']) && !wp_verify_nonce($_POST['nonce'], 'ee-data-optin') ) exit();
251
+		if (isset($_POST['nonce']) && ! wp_verify_nonce($_POST['nonce'], 'ee-data-optin')) exit();
252 252
 
253 253
 		//made it here so let's save the selection
254
-		$ueip_optin = isset( $_POST['selection'] ) ? $_POST['selection'] : 'no';
254
+		$ueip_optin = isset($_POST['selection']) ? $_POST['selection'] : 'no';
255 255
 
256 256
 		//update_option('ee_ueip_optin', $ueip_optin);
257 257
 		EE_Registry::instance()->CFG->core->ee_ueip_has_notified = 1;
258
-		EE_Registry::instance()->CFG->update_espresso_config( FALSE, FALSE );
258
+		EE_Registry::instance()->CFG->update_espresso_config(FALSE, FALSE);
259 259
 		exit();
260 260
 	}
261 261
 
@@ -268,22 +268,22 @@  discard block
 block discarded – undo
268 268
 	 */
269 269
 	public static function is_update_available($basename = '') {
270 270
 
271
-		$basename = ! empty( $basename ) ? $basename : EE_PLUGIN_BASENAME;
271
+		$basename = ! empty($basename) ? $basename : EE_PLUGIN_BASENAME;
272 272
 
273 273
 		$update = false;
274 274
 
275
-		$folder = DS . dirname($basename); // should take "event-espresso-core/espresso.php" and change to "/event-espresso-core"
275
+		$folder = DS.dirname($basename); // should take "event-espresso-core/espresso.php" and change to "/event-espresso-core"
276 276
 
277 277
 		$plugins = get_plugins($folder);
278
-		$current = get_site_transient( 'update_plugins' );
278
+		$current = get_site_transient('update_plugins');
279 279
 
280
-		foreach ( (array) $plugins as $plugin_file => $plugin_data ) {
281
-			if ( isset( $current->response['plugin_file'] ) )
280
+		foreach ((array) $plugins as $plugin_file => $plugin_data) {
281
+			if (isset($current->response['plugin_file']))
282 282
 				$update = true;
283 283
 		}
284 284
 
285 285
 		//it's possible that there is an update but an invalid site-license-key is in use
286
-		if ( get_site_option('pue_json_error_' . $basename ) )
286
+		if (get_site_option('pue_json_error_'.$basename))
287 287
 			$update = true;
288 288
 
289 289
 		return $update;
@@ -301,9 +301,9 @@  discard block
 block discarded – undo
301 301
 	 * @return void
302 302
 	 */
303 303
 	public function _uxip_hooks() {
304
-		if ( EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance ) {
305
-			add_action('admin_init', array( $this, 'track_active_theme' ) );
306
-			add_action('admin_init', array( $this, 'track_event_info' ) );
304
+		if (EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance) {
305
+			add_action('admin_init', array($this, 'track_active_theme'));
306
+			add_action('admin_init', array($this, 'track_event_info'));
307 307
 		}
308 308
 	}
309 309
 
@@ -312,65 +312,65 @@  discard block
 block discarded – undo
312 312
 
313 313
 	public function track_active_theme() {
314 314
 		//we only check this once a month.
315
-		if ( false === ( $transient = get_transient( 'ee_active_theme_check' ) ) ) {
315
+		if (false === ($transient = get_transient('ee_active_theme_check'))) {
316 316
 			$theme = wp_get_theme();
317
-			update_option('uxip_ee_active_theme', $theme->get('Name') );
318
-			set_transient('ee_active_theme_check', 1, MONTH_IN_SECONDS );
317
+			update_option('uxip_ee_active_theme', $theme->get('Name'));
318
+			set_transient('ee_active_theme_check', 1, MONTH_IN_SECONDS);
319 319
 		}
320 320
 	}
321 321
 
322 322
 
323 323
 	public function track_event_info() {
324 324
 		//we only check this once every couple weeks.
325
-		if ( false === ( $transient = get_transient( 'ee4_event_info_check') ) ) {
325
+		if (false === ($transient = get_transient('ee4_event_info_check'))) {
326 326
 			//first let's get the number for ALL events
327 327
 			$EVT = EE_Registry::instance()->load_model('Event');
328 328
 			$DTT = EE_Registry::instance()->load_model('Datetime');
329 329
 			$TKT = EE_Registry::instance()->load_model('Ticket');
330 330
 			$count = $EVT->count();
331
-			if ( $count > 0 )
331
+			if ($count > 0)
332 332
 				update_option('uxip_ee4_all_events_count', $count);
333 333
 
334 334
 			//next let's just get the number of ACTIVE events
335 335
 			$count_active = $EVT->get_active_events(array(), TRUE);
336
-			if ( $count_active > 0 )
336
+			if ($count_active > 0)
337 337
 				update_option('uxip_ee4_active_events_count', $count_active);
338 338
 
339 339
 			//datetimes!
340 340
 			$dtt_count = $DTT->count();
341
-			if ( $dtt_count > 0 )
342
-				update_option( 'uxip_ee_all_dtts_count', $dtt_count );
341
+			if ($dtt_count > 0)
342
+				update_option('uxip_ee_all_dtts_count', $dtt_count);
343 343
 
344 344
 
345 345
 			//dttsold
346 346
 			$dtt_sold = $DTT->sum(array(), 'DTT_sold');
347
-			if ( $dtt_sold > 0 )
348
-				update_option( 'uxip_ee_dtt_sold', $dtt_sold );
347
+			if ($dtt_sold > 0)
348
+				update_option('uxip_ee_dtt_sold', $dtt_sold);
349 349
 
350 350
 			//allticketcount
351 351
 			$all_tkt_count = $TKT->count();
352
-			if ( $all_tkt_count > 0 )
353
-				update_option( 'uxip_ee_all_tkt_count', $all_tkt_count );
352
+			if ($all_tkt_count > 0)
353
+				update_option('uxip_ee_all_tkt_count', $all_tkt_count);
354 354
 
355 355
 			//freetktcount
356
-			$_where = array( 'TKT_price' => 0 );
356
+			$_where = array('TKT_price' => 0);
357 357
 			$free_tkt_count = $TKT->count(array($_where));
358
-			if ( $free_tkt_count > 0 )
359
-				update_option( 'uxip_ee_free_tkt_count', $free_tkt_count );
358
+			if ($free_tkt_count > 0)
359
+				update_option('uxip_ee_free_tkt_count', $free_tkt_count);
360 360
 
361 361
 			//paidtktcount
362
-			$_where = array( 'TKT_price' => array('>', 0) );
363
-			$paid_tkt_count = $TKT->count( array( $_where ) );
364
-			if ( $paid_tkt_count > 0 )
365
-				update_option( 'uxip_ee_paid_tkt_count', $paid_tkt_count );
362
+			$_where = array('TKT_price' => array('>', 0));
363
+			$paid_tkt_count = $TKT->count(array($_where));
364
+			if ($paid_tkt_count > 0)
365
+				update_option('uxip_ee_paid_tkt_count', $paid_tkt_count);
366 366
 
367 367
 			//tktsold
368
-			$tkt_sold = $TKT->sum( array(), 'TKT_sold' );
369
-			if( $tkt_sold > 0 )
370
-				update_option( 'uxip_ee_tkt_sold', $tkt_sold );
368
+			$tkt_sold = $TKT->sum(array(), 'TKT_sold');
369
+			if ($tkt_sold > 0)
370
+				update_option('uxip_ee_tkt_sold', $tkt_sold);
371 371
 
372 372
 
373
-			set_transient( 'ee4_event_info_check', 1, WEEK_IN_SECONDS * 2 );
373
+			set_transient('ee4_event_info_check', 1, WEEK_IN_SECONDS * 2);
374 374
 		}
375 375
 	}
376 376
 
Please login to merge, or discard this patch.
Braces   +69 added lines, -43 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
  *
@@ -52,8 +54,9 @@  discard block
 block discarded – undo
52 54
 		do_action( 'AHEE_log', __CLASS__, __FUNCTION__ );
53 55
 
54 56
 		//wp have no MONTH_IN_SECONDS constant.  So we approximate our own assuming all months are 4 weeks long.
55
-		if ( !defined('MONTH_IN_SECONDS' ) )
56
-			define( 'MONTH_IN_SECONDS', WEEK_IN_SECONDS * 4 );
57
+		if ( !defined('MONTH_IN_SECONDS' ) ) {
58
+					define( 'MONTH_IN_SECONDS', WEEK_IN_SECONDS * 4 );
59
+		}
57 60
 
58 61
 		if(EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance){
59 62
 			$this->_uxip_hooks();
@@ -100,42 +103,51 @@  discard block
 block discarded – undo
100 103
 
101 104
 				//what is the current active theme?
102 105
 				$active_theme = get_option('uxip_ee_active_theme');
103
-				if ( !empty( $active_theme ) )
104
-					$extra_stats[$site_pre . 'active_theme'] = $active_theme;
106
+				if ( !empty( $active_theme ) ) {
107
+									$extra_stats[$site_pre . 'active_theme'] = $active_theme;
108
+				}
105 109
 
106 110
 				//event info regarding an all event count and all "active" event count
107 111
 				$all_events_count = get_option('uxip_ee4_all_events_count');
108
-				if ( !empty( $all_events_count ) )
109
-					$extra_stats[$site_pre . 'ee4_all_events_count'] = $all_events_count;
112
+				if ( !empty( $all_events_count ) ) {
113
+									$extra_stats[$site_pre . 'ee4_all_events_count'] = $all_events_count;
114
+				}
110 115
 				$active_events_count = get_option('uxip_ee4_active_events_count');
111
-				if ( !empty( $active_events_count ) )
112
-					$extra_stats[$site_pre . 'ee4_active_events_count'] = $active_events_count;
116
+				if ( !empty( $active_events_count ) ) {
117
+									$extra_stats[$site_pre . 'ee4_active_events_count'] = $active_events_count;
118
+				}
113 119
 
114 120
 				//datetime stuff
115 121
 				$dtt_count = get_option('uxip_ee_all_dtts_count');
116
-				if ( !empty( $dtt_count ) )
117
-					$extra_stats[$site_pre . 'all_dtts_count'] = $dtt_count;
122
+				if ( !empty( $dtt_count ) ) {
123
+									$extra_stats[$site_pre . 'all_dtts_count'] = $dtt_count;
124
+				}
118 125
 
119 126
 				$dtt_sold = get_option('uxip_ee_dtt_sold');
120
-				if ( !empty( $dtt_sold ) )
121
-					$extra_stats[$site_pre . 'dtt_sold'] = $dtt_sold;
127
+				if ( !empty( $dtt_sold ) ) {
128
+									$extra_stats[$site_pre . 'dtt_sold'] = $dtt_sold;
129
+				}
122 130
 
123 131
 				//ticket stuff
124 132
 				$all_tkt_count = get_option('uxip_ee_all_tkt_count');
125
-				if ( !empty( $all_tkt_count ) )
126
-					$extra_stats[$site_pre . 'all_tkt_count'] = $all_tkt_count;
133
+				if ( !empty( $all_tkt_count ) ) {
134
+									$extra_stats[$site_pre . 'all_tkt_count'] = $all_tkt_count;
135
+				}
127 136
 
128 137
 				$free_tkt_count = get_option('uxip_ee_free_tkt_count');
129
-				if ( !empty( $free_tkt_count ) )
130
-					$extra_stats[$site_pre . 'free_tkt_count'] = $free_tkt_count;
138
+				if ( !empty( $free_tkt_count ) ) {
139
+									$extra_stats[$site_pre . 'free_tkt_count'] = $free_tkt_count;
140
+				}
131 141
 
132 142
 				$paid_tkt_count = get_option('uxip_ee_paid_tkt_count');
133
-				if ( !empty( $paid_tkt_count ) )
134
-					$extra_stats[$site_pre . 'paid_tkt_count'] = $paid_tkt_count;
143
+				if ( !empty( $paid_tkt_count ) ) {
144
+									$extra_stats[$site_pre . 'paid_tkt_count'] = $paid_tkt_count;
145
+				}
135 146
 
136 147
 				$tkt_sold = get_option('uxip_ee_tkt_sold' );
137
-				if ( !empty($tkt_sold) )
138
-					$extra_stats[$site_pre . 'tkt_sold'] = $tkt_sold;
148
+				if ( !empty($tkt_sold) ) {
149
+									$extra_stats[$site_pre . 'tkt_sold'] = $tkt_sold;
150
+				}
139 151
 
140 152
 				//phpversion checking
141 153
 				$extra_stats['phpversion'] = function_exists('phpversion') ? phpversion() : 'unknown';
@@ -208,7 +220,9 @@  discard block
 block discarded – undo
208 220
 
209 221
 	function espresso_data_collection_optin_notice() {
210 222
 		$ueip_has_notified = EE_Registry::instance()->CFG->core->ee_ueip_has_notified;
211
-		if ( $ueip_has_notified ) return;
223
+		if ( $ueip_has_notified ) {
224
+			return;
225
+		}
212 226
 		$settings_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'default'), admin_url( 'admin.php?page=espresso_general_settings') );
213 227
 		$settings_url = $settings_url . '#UXIP_settings';
214 228
 		?>
@@ -248,7 +262,9 @@  discard block
 block discarded – undo
248 262
 	function espresso_data_optin_ajax_handler() {
249 263
 
250 264
 		//verify nonce
251
-		if ( isset($_POST['nonce']) && !wp_verify_nonce($_POST['nonce'], 'ee-data-optin') ) exit();
265
+		if ( isset($_POST['nonce']) && !wp_verify_nonce($_POST['nonce'], 'ee-data-optin') ) {
266
+			exit();
267
+		}
252 268
 
253 269
 		//made it here so let's save the selection
254 270
 		$ueip_optin = isset( $_POST['selection'] ) ? $_POST['selection'] : 'no';
@@ -278,13 +294,15 @@  discard block
 block discarded – undo
278 294
 		$current = get_site_transient( 'update_plugins' );
279 295
 
280 296
 		foreach ( (array) $plugins as $plugin_file => $plugin_data ) {
281
-			if ( isset( $current->response['plugin_file'] ) )
282
-				$update = true;
297
+			if ( isset( $current->response['plugin_file'] ) ) {
298
+							$update = true;
299
+			}
283 300
 		}
284 301
 
285 302
 		//it's possible that there is an update but an invalid site-license-key is in use
286
-		if ( get_site_option('pue_json_error_' . $basename ) )
287
-			$update = true;
303
+		if ( get_site_option('pue_json_error_' . $basename ) ) {
304
+					$update = true;
305
+		}
288 306
 
289 307
 		return $update;
290 308
 	}
@@ -328,46 +346,54 @@  discard block
 block discarded – undo
328 346
 			$DTT = EE_Registry::instance()->load_model('Datetime');
329 347
 			$TKT = EE_Registry::instance()->load_model('Ticket');
330 348
 			$count = $EVT->count();
331
-			if ( $count > 0 )
332
-				update_option('uxip_ee4_all_events_count', $count);
349
+			if ( $count > 0 ) {
350
+							update_option('uxip_ee4_all_events_count', $count);
351
+			}
333 352
 
334 353
 			//next let's just get the number of ACTIVE events
335 354
 			$count_active = $EVT->get_active_events(array(), TRUE);
336
-			if ( $count_active > 0 )
337
-				update_option('uxip_ee4_active_events_count', $count_active);
355
+			if ( $count_active > 0 ) {
356
+							update_option('uxip_ee4_active_events_count', $count_active);
357
+			}
338 358
 
339 359
 			//datetimes!
340 360
 			$dtt_count = $DTT->count();
341
-			if ( $dtt_count > 0 )
342
-				update_option( 'uxip_ee_all_dtts_count', $dtt_count );
361
+			if ( $dtt_count > 0 ) {
362
+							update_option( 'uxip_ee_all_dtts_count', $dtt_count );
363
+			}
343 364
 
344 365
 
345 366
 			//dttsold
346 367
 			$dtt_sold = $DTT->sum(array(), 'DTT_sold');
347
-			if ( $dtt_sold > 0 )
348
-				update_option( 'uxip_ee_dtt_sold', $dtt_sold );
368
+			if ( $dtt_sold > 0 ) {
369
+							update_option( 'uxip_ee_dtt_sold', $dtt_sold );
370
+			}
349 371
 
350 372
 			//allticketcount
351 373
 			$all_tkt_count = $TKT->count();
352
-			if ( $all_tkt_count > 0 )
353
-				update_option( 'uxip_ee_all_tkt_count', $all_tkt_count );
374
+			if ( $all_tkt_count > 0 ) {
375
+							update_option( 'uxip_ee_all_tkt_count', $all_tkt_count );
376
+			}
354 377
 
355 378
 			//freetktcount
356 379
 			$_where = array( 'TKT_price' => 0 );
357 380
 			$free_tkt_count = $TKT->count(array($_where));
358
-			if ( $free_tkt_count > 0 )
359
-				update_option( 'uxip_ee_free_tkt_count', $free_tkt_count );
381
+			if ( $free_tkt_count > 0 ) {
382
+							update_option( 'uxip_ee_free_tkt_count', $free_tkt_count );
383
+			}
360 384
 
361 385
 			//paidtktcount
362 386
 			$_where = array( 'TKT_price' => array('>', 0) );
363 387
 			$paid_tkt_count = $TKT->count( array( $_where ) );
364
-			if ( $paid_tkt_count > 0 )
365
-				update_option( 'uxip_ee_paid_tkt_count', $paid_tkt_count );
388
+			if ( $paid_tkt_count > 0 ) {
389
+							update_option( 'uxip_ee_paid_tkt_count', $paid_tkt_count );
390
+			}
366 391
 
367 392
 			//tktsold
368 393
 			$tkt_sold = $TKT->sum( array(), 'TKT_sold' );
369
-			if( $tkt_sold > 0 )
370
-				update_option( 'uxip_ee_tkt_sold', $tkt_sold );
394
+			if( $tkt_sold > 0 ) {
395
+							update_option( 'uxip_ee_tkt_sold', $tkt_sold );
396
+			}
371 397
 
372 398
 
373 399
 			set_transient( 'ee4_event_info_check', 1, WEEK_IN_SECONDS * 2 );
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 3 patches
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.
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -402,21 +402,21 @@
 block discarded – undo
402 402
 		$class_name = $this->_get_classname_for_admin_init_page( $page );
403 403
  		EE_Registry::instance()->load_file( $path, $class_name, 'core' );
404 404
 		if ( ! class_exists( $class_name )) {
405
-            $inner_error_msg = '<br />' . sprintf(
406
-                esc_html__(
407
-                    'Make sure you have %1$s defined. If this is a non-EE-core admin page then you also must have an autoloader in place for your class',
408
-                    'event_espresso'
409
-                ),
410
-                '<strong>' . $class_name . '</strong>'
411
-            );
405
+			$inner_error_msg = '<br />' . sprintf(
406
+				esc_html__(
407
+					'Make sure you have %1$s defined. If this is a non-EE-core admin page then you also must have an autoloader in place for your class',
408
+					'event_espresso'
409
+				),
410
+				'<strong>' . $class_name . '</strong>'
411
+			);
412 412
 			$error_msg[] = sprintf( __('Something went wrong with loading the %s admin page.', 'event_espresso' ), $page);
413 413
 			$error_msg[] = $error_msg[0]
414
-                           . "\r\n"
415
-                           . sprintf(
416
-                               esc_html__( 'There is no Init class in place for the %s admin page.', 'event_espresso'),
417
-                               $page
418
-                           )
419
-                           . $inner_error_msg;
414
+						   . "\r\n"
415
+						   . sprintf(
416
+							   esc_html__( 'There is no Init class in place for the %s admin page.', 'event_espresso'),
417
+							   $page
418
+						   )
419
+						   . $inner_error_msg;
420 420
 			throw new EE_Error( implode( '||', $error_msg ));
421 421
 		}
422 422
 		$a = new ReflectionClass($class_name);
Please login to merge, or discard this patch.
Spacing   +124 added lines, -124 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,26 +398,26 @@  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
-            $inner_error_msg = '<br />' . sprintf(
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
+            $inner_error_msg = '<br />'.sprintf(
406 406
                 esc_html__(
407 407
                     'Make sure you have %1$s defined. If this is a non-EE-core admin page then you also must have an autoloader in place for your class',
408 408
                     'event_espresso'
409 409
                 ),
410
-                '<strong>' . $class_name . '</strong>'
410
+                '<strong>'.$class_name.'</strong>'
411 411
             );
412
-			$error_msg[] = sprintf( __('Something went wrong with loading the %s admin page.', 'event_espresso' ), $page);
412
+			$error_msg[] = sprintf(__('Something went wrong with loading the %s admin page.', 'event_espresso'), $page);
413 413
 			$error_msg[] = $error_msg[0]
414 414
                            . "\r\n"
415 415
                            . sprintf(
416
-                               esc_html__( 'There is no Init class in place for the %s admin page.', 'event_espresso'),
416
+                               esc_html__('There is no Init class in place for the %s admin page.', 'event_espresso'),
417 417
                                $page
418 418
                            )
419 419
                            . $inner_error_msg;
420
-			throw new EE_Error( implode( '||', $error_msg ));
420
+			throw new EE_Error(implode('||', $error_msg));
421 421
 		}
422 422
 		$a = new ReflectionClass($class_name);
423 423
 		return  $a->newInstance();
@@ -436,9 +436,9 @@  discard block
 block discarded – undo
436 436
 	public function set_menus() {
437 437
 		//prep the menu pages (sort, group.)
438 438
 		$this->_prep_pages();
439
-		foreach( $this->_prepped_menu_maps as $menu_map ) {
440
-			if ( EE_Registry::instance()->CAP->current_user_can( $menu_map->capability, $menu_map->menu_slug ) ) {
441
-				$menu_map->add_menu_page( FALSE );
439
+		foreach ($this->_prepped_menu_maps as $menu_map) {
440
+			if (EE_Registry::instance()->CAP->current_user_can($menu_map->capability, $menu_map->menu_slug)) {
441
+				$menu_map->add_menu_page(FALSE);
442 442
 			}
443 443
 		}
444 444
 	}
@@ -451,11 +451,11 @@  discard block
 block discarded – undo
451 451
 	 *
452 452
 	 * @return void
453 453
 	 */
454
-	public function set_network_menus(){
454
+	public function set_network_menus() {
455 455
 		$this->_prep_pages();
456
-		foreach( $this->_prepped_menu_maps as $menu_map ) {
457
-			if ( EE_Registry::instance()->CAP->current_user_can( $menu_map->capability, $menu_map->menu_slug ) ) {
458
-				$menu_map->add_menu_page( TRUE );
456
+		foreach ($this->_prepped_menu_maps as $menu_map) {
457
+			if (EE_Registry::instance()->CAP->current_user_can($menu_map->capability, $menu_map->menu_slug)) {
458
+				$menu_map->add_menu_page(TRUE);
459 459
 			}
460 460
 		}
461 461
 	}
@@ -476,22 +476,22 @@  discard block
 block discarded – undo
476 476
 		//rearrange _admin_menu_groups to be indexed by group slug.
477 477
 		$menu_groups = $this->_rearrange_menu_groups();
478 478
 
479
-		foreach( $this->_installed_pages as $page ) {
480
-			if ( $page instanceof EE_Admin_page_Init ) {
479
+		foreach ($this->_installed_pages as $page) {
480
+			if ($page instanceof EE_Admin_page_Init) {
481 481
 				$page_map = $page->get_menu_map();
482 482
 				//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.
483
-				if ( is_array( $page_map ) || empty( $page_map ) ) {
484
-					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 ) );
483
+				if (is_array($page_map) || empty($page_map)) {
484
+					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));
485 485
 					continue;
486 486
 				}
487 487
 
488 488
 				//if page map is NOT a EE_Admin_Page_Menu_Map object then throw error.
489
-				if ( ! $page_map instanceof EE_Admin_Page_Menu_Map ) {
490
-					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 ) );
489
+				if ( ! $page_map instanceof EE_Admin_Page_Menu_Map) {
490
+					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));
491 491
 				}
492 492
 
493 493
 				//use the maintenance_mode_parent property and maintenance mode status to determine if this page even gets added to array.
494
-				if ( empty( $page_map->maintenance_mode_parent ) &&  EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance ) {
494
+				if (empty($page_map->maintenance_mode_parent) && EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance) {
495 495
 					continue;
496 496
 				}
497 497
 
@@ -500,21 +500,21 @@  discard block
 block discarded – undo
500 500
 			}
501 501
 		}
502 502
 
503
-		if ( empty( $pages_array )) {
504
-			throw new EE_Error(__('Something went wrong when prepping the admin pages', 'event_espresso') );
503
+		if (empty($pages_array)) {
504
+			throw new EE_Error(__('Something went wrong when prepping the admin pages', 'event_espresso'));
505 505
 		}
506 506
 
507 507
 		//let's sort the groups, make sure it's a valid group, add header (if to show).
508
-		foreach ( $pages_array as $group => $menu_maps ) {
508
+		foreach ($pages_array as $group => $menu_maps) {
509 509
 			//valid_group?
510
-			if ( ! array_key_exists( $group, $menu_groups ) )
510
+			if ( ! array_key_exists($group, $menu_groups))
511 511
 				continue;
512 512
 
513 513
 			//sort pages.
514
-			usort( $menu_maps, array( $this, '_sort_menu_maps' ) );
514
+			usort($menu_maps, array($this, '_sort_menu_maps'));
515 515
 
516 516
 			//prepend header
517
-			array_unshift( $menu_maps, $menu_groups[$group] );
517
+			array_unshift($menu_maps, $menu_groups[$group]);
518 518
 
519 519
 			//reset $pages_array with prepped data
520 520
 			$pages_array[$group] = $menu_maps;
@@ -522,9 +522,9 @@  discard block
 block discarded – undo
522 522
 
523 523
 
524 524
 		//now let's setup the _prepped_menu_maps property
525
-		foreach ( $menu_groups as $group => $group_objs ) {
526
-			if ( isset( $pages_array[$group] ) )
527
-				$this->_prepped_menu_maps = array_merge( $this->_prepped_menu_maps, $pages_array[$group] );
525
+		foreach ($menu_groups as $group => $group_objs) {
526
+			if (isset($pages_array[$group]))
527
+				$this->_prepped_menu_maps = array_merge($this->_prepped_menu_maps, $pages_array[$group]);
528 528
 		}/**/
529 529
 
530 530
 	}
@@ -544,10 +544,10 @@  discard block
 block discarded – undo
544 544
 	 * @param array $installed_refs the original installed_refs array that may contain our NEW EE_Admin_Pages to be loaded.
545 545
 	 * @return array
546 546
 	 */
547
-	private function _set_caffeinated( $installed_refs ) {
547
+	private function _set_caffeinated($installed_refs) {
548 548
 
549 549
 		//first let's check if there IS a caffeinated folder. If there is not then lets get out.
550
-		if ( ! is_dir( EE_PLUGIN_DIR_PATH . 'caffeinated' . DS . 'admin' ) || ( defined( 'EE_DECAF' ) && EE_DECAF )) {
550
+		if ( ! is_dir(EE_PLUGIN_DIR_PATH.'caffeinated'.DS.'admin') || (defined('EE_DECAF') && EE_DECAF)) {
551 551
 			return $installed_refs;
552 552
 		}
553 553
 
@@ -556,15 +556,15 @@  discard block
 block discarded – undo
556 556
 		$exclude = array('tickets');
557 557
 
558 558
 		//okay let's setup an "New" pages first (we'll return installed refs later)
559
-		$new_admin_screens = glob( EE_CORE_CAF_ADMIN . 'new/*', GLOB_ONLYDIR );
560
-		if ( $new_admin_screens ) {
561
-			foreach( $new_admin_screens as $admin_screen ) {
559
+		$new_admin_screens = glob(EE_CORE_CAF_ADMIN.'new/*', GLOB_ONLYDIR);
560
+		if ($new_admin_screens) {
561
+			foreach ($new_admin_screens as $admin_screen) {
562 562
 				// files and anything in the exclude array need not apply
563
-				if ( is_dir( $admin_screen ) && ! in_array( basename( $admin_screen ), $exclude )) {
563
+				if (is_dir($admin_screen) && ! in_array(basename($admin_screen), $exclude)) {
564 564
 					// these folders represent the different NEW EE admin pages
565
-					$installed_refs[ basename( $admin_screen ) ] = $admin_screen;
565
+					$installed_refs[basename($admin_screen)] = $admin_screen;
566 566
 					// set autoloaders for our admin page classes based on included path information
567
-					EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder( $admin_screen );
567
+					EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder($admin_screen);
568 568
 //					$this->_caf_autoloader[] = array(
569 569
 //						'dir' => 'new',
570 570
 //						'folder' => basename( $admin_screen )
@@ -574,18 +574,18 @@  discard block
 block discarded – undo
574 574
 		}
575 575
 
576 576
 		//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)
577
-		$extends = glob( EE_CORE_CAF_ADMIN . 'extend/*', GLOB_ONLYDIR );
578
-		if ( $extends ) {
579
-			foreach( $extends as $extend ) {
580
-				if ( is_dir( $extend ) ) {
581
-					$extend_ref = basename( $extend );
577
+		$extends = glob(EE_CORE_CAF_ADMIN.'extend/*', GLOB_ONLYDIR);
578
+		if ($extends) {
579
+			foreach ($extends as $extend) {
580
+				if (is_dir($extend)) {
581
+					$extend_ref = basename($extend);
582 582
 					//now let's make sure there is a file that matches the expected format
583
-					$filename = str_replace(' ', '_', ucwords( str_replace('_', ' ', $extend_ref ) ) );
584
-					$filename = 'Extend_' . $filename . '_Admin_Page';
585
-					$this->_caffeinated_extends[$extend_ref]['path'] = str_replace( array( '\\', '/' ), DS, EE_CORE_CAF_ADMIN . 'extend' . DS . $extend_ref . DS . $filename . '.core.php' );
583
+					$filename = str_replace(' ', '_', ucwords(str_replace('_', ' ', $extend_ref)));
584
+					$filename = 'Extend_'.$filename.'_Admin_Page';
585
+					$this->_caffeinated_extends[$extend_ref]['path'] = str_replace(array('\\', '/'), DS, EE_CORE_CAF_ADMIN.'extend'.DS.$extend_ref.DS.$filename.'.core.php');
586 586
 					$this->_caffeinated_extends[$extend_ref]['admin_page'] = $filename;
587 587
 					// set autoloaders for our admin page classes based on included path information
588
-					EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder( $extend );
588
+					EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder($extend);
589 589
 //					$this->_caf_autoloader[] = array(
590 590
 //						'dir' => 'extend',
591 591
 //						'folder' => $extend_ref
@@ -596,22 +596,22 @@  discard block
 block discarded – undo
596 596
 
597 597
 		//let's see if there are any HOOK files and instantiate them if there are (so that hooks are loaded early!).
598 598
 		$ee_admin_hooks = array();
599
-		$hooks = glob( EE_CORE_CAF_ADMIN . 'hooks/*.class.php' );
600
-		if ( $hooks ) {
601
-			foreach ( $hooks as $hook ) {
602
-				if ( is_readable( $hook ) ) {
599
+		$hooks = glob(EE_CORE_CAF_ADMIN.'hooks/*.class.php');
600
+		if ($hooks) {
601
+			foreach ($hooks as $hook) {
602
+				if (is_readable($hook)) {
603 603
 					require_once $hook;
604
-					$classname = str_replace( EE_CORE_CAF_ADMIN . 'hooks/', '', $hook );
604
+					$classname = str_replace(EE_CORE_CAF_ADMIN.'hooks/', '', $hook);
605 605
 					$classname = str_replace('.class.php', '', $classname);
606
-					if ( class_exists( $classname ) ) {
607
-						$a = new ReflectionClass( $classname );
606
+					if (class_exists($classname)) {
607
+						$a = new ReflectionClass($classname);
608 608
 						$ee_admin_hooks[] = $a->newInstance();
609 609
 					}
610 610
 				}
611 611
 			}
612 612
 		}/**/
613 613
 
614
-		$ee_admin_hooks = apply_filters( 'FHEE__EE_Admin_Page_Loader__set_caffeinated__ee_admin_hooks', $ee_admin_hooks );
614
+		$ee_admin_hooks = apply_filters('FHEE__EE_Admin_Page_Loader__set_caffeinated__ee_admin_hooks', $ee_admin_hooks);
615 615
 
616 616
 		return $installed_refs;
617 617
 
@@ -666,8 +666,8 @@  discard block
 block discarded – undo
666 666
 	 * @param  EE_Admin_Page_Menu_Map $b being compared to
667 667
 	 * @return int    sort order
668 668
 	 */
669
-	private function _sort_menu_maps( EE_Admin_Page_Menu_Map $a, EE_Admin_Page_Menu_Map $b ) {
670
-		if ( $a->menu_order == $b->menu_order )
669
+	private function _sort_menu_maps(EE_Admin_Page_Menu_Map $a, EE_Admin_Page_Menu_Map $b) {
670
+		if ($a->menu_order == $b->menu_order)
671 671
 			return 0;
672 672
 		return ($a->menu_order < $b->menu_order) ? -1 : 1;
673 673
 	}
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
@@ -1,6 +1,7 @@
 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
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.