Completed
Branch FET-8347-separate-logging (f2247f)
by
unknown
715:40 queued 700:36
created
core/EE_Encryption.core.php 2 patches
Spacing   +63 added lines, -63 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
  * EE_Encryption class
4 4
  *
@@ -27,9 +27,9 @@  discard block
 block discarded – undo
27 27
 	 */
28 28
   private function __construct() {
29 29
 
30
-		define( 'ESPRESSO_ENCRYPT', TRUE );
30
+		define('ESPRESSO_ENCRYPT', TRUE);
31 31
 
32
-		if ( ! function_exists( 'mcrypt_encrypt' ) ) {
32
+		if ( ! function_exists('mcrypt_encrypt')) {
33 33
 			self::$_use_mcrypt = FALSE;
34 34
 		}
35 35
 
@@ -42,9 +42,9 @@  discard block
 block discarded – undo
42 42
 	 *	@access public
43 43
 	 * @return \EE_Encryption
44 44
 	 */
45
-	public static function instance ( ) {
45
+	public static function instance( ) {
46 46
 		// check if class object is instantiated
47
-		if ( ! self::$_instance instanceof EE_Encryption ) {
47
+		if ( ! self::$_instance instanceof EE_Encryption) {
48 48
 			self::$_instance = new self();
49 49
 		}
50 50
 		return self::$_instance;
@@ -60,17 +60,17 @@  discard block
 block discarded – undo
60 60
 	public  function get_encryption_key() {
61 61
 
62 62
 		// if encryption key has not been set
63
-		if ( empty( self::$_encryption_key )) {
63
+		if (empty(self::$_encryption_key)) {
64 64
 
65 65
 			// retrieve encryption_key from db
66
-			self::$_encryption_key = get_option( 'ee_encryption_key' );
66
+			self::$_encryption_key = get_option('ee_encryption_key');
67 67
 
68 68
 			// WHAT?? No encryption_key in the db ??
69
-			if ( self::$_encryption_key == FALSE ) {
69
+			if (self::$_encryption_key == FALSE) {
70 70
 				// let's make one. And md5 it to make it just the right size for a key
71
-				$new_key =  md5( self::generate_random_string() );
71
+				$new_key = md5(self::generate_random_string());
72 72
 				// now save it to the db for later
73
-				add_option( 'ee_encryption_key', $new_key );
73
+				add_option('ee_encryption_key', $new_key);
74 74
 				// here's the key - FINALLY !
75 75
 				self::$_encryption_key = $new_key;
76 76
 			}
@@ -87,17 +87,17 @@  discard block
 block discarded – undo
87 87
 	 * @param string $text_string  - the text to be encrypted
88 88
 	 * @return string
89 89
 	 */
90
-	public function encrypt ( $text_string = '' ) {
90
+	public function encrypt($text_string = '') {
91 91
 
92 92
 		// you give me nothing??? GET OUT !
93
-		if  ( empty( $text_string ))  {
93
+		if (empty($text_string)) {
94 94
 			return FALSE;
95 95
 		}
96 96
 
97
-		if ( self::$_use_mcrypt ) {
98
-			$encrypted_text = $this->m_encrypt( $text_string );
97
+		if (self::$_use_mcrypt) {
98
+			$encrypted_text = $this->m_encrypt($text_string);
99 99
 		} else {
100
-			$encrypted_text = $this->acme_encrypt( $text_string );
100
+			$encrypted_text = $this->acme_encrypt($text_string);
101 101
 		}
102 102
 
103 103
 		return $encrypted_text;
@@ -112,18 +112,18 @@  discard block
 block discarded – undo
112 112
 	 * @param string $encrypted_text - the text to be decrypted
113 113
 	 * @return string
114 114
 	 */
115
-	public function decrypt  ( $encrypted_text = '' )  {
115
+	public function decrypt($encrypted_text = '') {
116 116
 
117 117
 		// you give me nothing??? GET OUT !
118
-		if  ( empty( $encrypted_text ))  {
118
+		if (empty($encrypted_text)) {
119 119
 			return FALSE;
120 120
 		}
121 121
 
122 122
 		// if PHP's mcrypt functions are installed then we'll use them
123
-		if ( self::$_use_mcrypt ) {
124
-			$decrypted_text = $this->m_decrypt( $encrypted_text );
123
+		if (self::$_use_mcrypt) {
124
+			$decrypted_text = $this->m_decrypt($encrypted_text);
125 125
 		} else {
126
-			$decrypted_text = $this->acme_decrypt( $encrypted_text );
126
+			$decrypted_text = $this->acme_decrypt($encrypted_text);
127 127
 		}
128 128
 
129 129
 		return $decrypted_text;
@@ -140,17 +140,17 @@  discard block
 block discarded – undo
140 140
 	 * @internal param $string - the text to be encoded
141 141
 	 * @return string
142 142
 	 */
143
-	public function base64_url_encode ( $text_string = FALSE ) {
143
+	public function base64_url_encode($text_string = FALSE) {
144 144
 
145 145
 		// you give me nothing??? GET OUT !
146
-		if  ( ! $text_string )  {
146
+		if ( ! $text_string) {
147 147
 			return FALSE;
148 148
 		}
149 149
 
150 150
 		// encode
151
-		$encoded_string = base64_encode ( $text_string );
151
+		$encoded_string = base64_encode($text_string);
152 152
 		// remove chars to make encoding more URL friendly
153
-		$encoded_string = strtr ( $encoded_string, '+/=', '-_,' );
153
+		$encoded_string = strtr($encoded_string, '+/=', '-_,');
154 154
 
155 155
 		return $encoded_string;
156 156
 
@@ -166,17 +166,17 @@  discard block
 block discarded – undo
166 166
 	 * @internal param $string - the text to be decoded
167 167
 	 * @return string
168 168
 	 */
169
-	public function base64_url_decode ( $encoded_string = FALSE ) {
169
+	public function base64_url_decode($encoded_string = FALSE) {
170 170
 
171 171
 		// you give me nothing??? GET OUT !
172
-		if  ( ! $encoded_string )  {
172
+		if ( ! $encoded_string) {
173 173
 			return FALSE;
174 174
 		}
175 175
 
176 176
 		// replace previously removed characters
177
-		$encoded_string = strtr ( $encoded_string, '-_,', '+/=' );
177
+		$encoded_string = strtr($encoded_string, '-_,', '+/=');
178 178
 		// decode
179
-		$decoded_string = base64_decode ( $encoded_string );
179
+		$decoded_string = base64_decode($encoded_string);
180 180
 
181 181
 		return $decoded_string;
182 182
 
@@ -191,22 +191,22 @@  discard block
 block discarded – undo
191 191
 	 * @internal param $string - the text to be encrypted
192 192
 	 * @return string
193 193
 	 */
194
-	private function m_encrypt  ( $text_string = FALSE ) {
194
+	private function m_encrypt($text_string = FALSE) {
195 195
 
196 196
 		// you give me nothing??? GET OUT !
197
-		if  ( ! $text_string )  {
197
+		if ( ! $text_string) {
198 198
 			return FALSE;
199 199
 		}
200 200
 
201 201
 		// get the initialization vector size
202
-		$iv_size = mcrypt_get_iv_size ( MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB );
202
+		$iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB);
203 203
 		// initialization vector
204
-		$iv = mcrypt_create_iv ( $iv_size, MCRYPT_RAND );
204
+		$iv = mcrypt_create_iv($iv_size, MCRYPT_RAND);
205 205
 
206 206
 		// encrypt it
207
-		$encrypted_text = mcrypt_encrypt ( MCRYPT_RIJNDAEL_256, self::$_encryption_key, $text_string, MCRYPT_MODE_ECB, $iv );
207
+		$encrypted_text = mcrypt_encrypt(MCRYPT_RIJNDAEL_256, self::$_encryption_key, $text_string, MCRYPT_MODE_ECB, $iv);
208 208
 		// trim and encode
209
-		$encrypted_text = trim ( base64_encode( $encrypted_text ) );
209
+		$encrypted_text = trim(base64_encode($encrypted_text));
210 210
 
211 211
 		return $encrypted_text;
212 212
 
@@ -221,23 +221,23 @@  discard block
 block discarded – undo
221 221
 	 * @internal param $string - the text to be decrypted
222 222
 	 * @return string
223 223
 	 */
224
-	private function m_decrypt  ( $encrypted_text = FALSE )  {
224
+	private function m_decrypt($encrypted_text = FALSE) {
225 225
 
226 226
 		// you give me nothing??? GET OUT !
227
-		if  ( ! $encrypted_text )  {
227
+		if ( ! $encrypted_text) {
228 228
 			return FALSE;
229 229
 		}
230 230
 
231 231
 		// decode
232
-		$encrypted_text = base64_decode ( $encrypted_text );
232
+		$encrypted_text = base64_decode($encrypted_text);
233 233
 
234 234
 		// get the initialization vector size
235
-		$iv_size = mcrypt_get_iv_size ( MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB );
236
-		$iv = mcrypt_create_iv ( $iv_size, MCRYPT_RAND );
235
+		$iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB);
236
+		$iv = mcrypt_create_iv($iv_size, MCRYPT_RAND);
237 237
 
238 238
 		// decrypt it
239
-		$decrypted_text = mcrypt_decrypt ( MCRYPT_RIJNDAEL_256, self::$_encryption_key, $encrypted_text, MCRYPT_MODE_ECB, $iv );
240
-		$decrypted_text = trim ( $decrypted_text );
239
+		$decrypted_text = mcrypt_decrypt(MCRYPT_RIJNDAEL_256, self::$_encryption_key, $encrypted_text, MCRYPT_MODE_ECB, $iv);
240
+		$decrypted_text = trim($decrypted_text);
241 241
 
242 242
 		return $decrypted_text;
243 243
 
@@ -253,22 +253,22 @@  discard block
 block discarded – undo
253 253
 	 * @internal param $string - the text to be decrypted
254 254
 	 * @return string
255 255
 	 */
256
-	private function acme_encrypt ( $text_string = FALSE ) {
256
+	private function acme_encrypt($text_string = FALSE) {
257 257
 
258 258
 		// you give me nothing??? GET OUT !
259
-		if  ( ! $text_string )  {
259
+		if ( ! $text_string) {
260 260
 			return FALSE;
261 261
 		}
262 262
 
263
-		$key_bits = str_split ( str_pad ( '', strlen( $text_string ), $this->get_encryption_key(), STR_PAD_RIGHT ));
264
-		$string_bits = str_split( $text_string );
263
+		$key_bits = str_split(str_pad('', strlen($text_string), $this->get_encryption_key(), STR_PAD_RIGHT));
264
+		$string_bits = str_split($text_string);
265 265
 
266
-		foreach ( $string_bits as $k =>$v ) {
267
-			$temp = ord( $v ) + ord ( $key_bits[$k] );
268
-			$string_bits[$k] = chr ( $temp > 255 ? ( $temp - 256 ) : $temp );
266
+		foreach ($string_bits as $k =>$v) {
267
+			$temp = ord($v) + ord($key_bits[$k]);
268
+			$string_bits[$k] = chr($temp > 255 ? ($temp - 256) : $temp);
269 269
 		}
270 270
 
271
-		$encrypted = base64_encode( join( '', $string_bits ) );
271
+		$encrypted = base64_encode(join('', $string_bits));
272 272
 
273 273
 		return $encrypted;
274 274
 
@@ -284,24 +284,24 @@  discard block
 block discarded – undo
284 284
 	 * @internal param $string - the text to be decrypted
285 285
 	 * @return string
286 286
 	 */
287
-	private function acme_decrypt ( $encrypted_text = FALSE ) {
287
+	private function acme_decrypt($encrypted_text = FALSE) {
288 288
 
289 289
 		// you give me nothing??? GET OUT !
290
-		if  ( ! $encrypted_text )  {
290
+		if ( ! $encrypted_text) {
291 291
 			return FALSE;
292 292
 		}
293 293
 
294
-		$encrypted_text = base64_decode ( $encrypted_text );
294
+		$encrypted_text = base64_decode($encrypted_text);
295 295
 
296
-		$key_bits = str_split ( str_pad ( '', strlen ( $encrypted_text ), $this->get_encryption_key(), STR_PAD_RIGHT ));
297
-		$string_bits = str_split ( $encrypted_text );
296
+		$key_bits = str_split(str_pad('', strlen($encrypted_text), $this->get_encryption_key(), STR_PAD_RIGHT));
297
+		$string_bits = str_split($encrypted_text);
298 298
 
299
-		foreach ( $string_bits as $k => $v ) {
300
-			$temp = ord ( $v ) - ord ( $key_bits[$k] );
301
-			$string_bits[$k] = chr ( $temp < 0 ? ( $temp + 256 ) : $temp );
299
+		foreach ($string_bits as $k => $v) {
300
+			$temp = ord($v) - ord($key_bits[$k]);
301
+			$string_bits[$k] = chr($temp < 0 ? ($temp + 256) : $temp);
302 302
 		}
303 303
 
304
-		$decrypted = join( '', $string_bits );
304
+		$decrypted = join('', $string_bits);
305 305
 
306 306
 		return $decrypted;
307 307
 
@@ -317,16 +317,16 @@  discard block
 block discarded – undo
317 317
 	 * @internal param $string - number of characters for random string
318 318
 	 * @return string
319 319
 	 */
320
-	public function generate_random_string ( $length = 40 ) {
320
+	public function generate_random_string($length = 40) {
321 321
 
322
-		$iterations = ceil ( $length / 40 );
322
+		$iterations = ceil($length / 40);
323 323
 
324 324
 		$random_string = '';
325 325
 
326
-		for ($i = 0; $i < $iterations; $i ++) {
327
-			$random_string .= sha1( microtime(TRUE) . mt_rand( 10000, 90000 ));
326
+		for ($i = 0; $i < $iterations; $i++) {
327
+			$random_string .= sha1(microtime(TRUE).mt_rand(10000, 90000));
328 328
 		}
329
-		$random_string =  substr( $random_string, 0, $length );
329
+		$random_string = substr($random_string, 0, $length);
330 330
 
331 331
 		return $random_string;
332 332
 
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
 do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
3 5
 /**
4 6
  * Event Espresso
Please login to merge, or discard this patch.
core/EE_Load_Textdomain.core.php 2 patches
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -39,13 +39,13 @@  discard block
 block discarded – undo
39 39
 	public static function load_textdomain() {
40 40
 		self::_maybe_get_langfile();
41 41
 		//now load the textdomain
42
-		EE_Registry::instance()->load_helper( 'File' );
43
-		if ( ! empty( self::$_lang ) && is_readable( EE_LANGUAGES_SAFE_DIR . 'event_espresso-' . self::$_lang . '.mo' ) ) {
42
+		EE_Registry::instance()->load_helper('File');
43
+		if ( ! empty(self::$_lang) && is_readable(EE_LANGUAGES_SAFE_DIR.'event_espresso-'.self::$_lang.'.mo')) {
44 44
 			load_plugin_textdomain('event_espresso', FALSE, EE_LANGUAGES_SAFE_LOC);
45
-		} else if ( ! empty( self::$_lang ) && is_readable( EE_LANGUAGES_SAFE_DIR . 'event-espresso-4-' . self::$_lang . '.mo' ) ) {
46
-			load_textdomain( 'event_espresso', EE_LANGUAGES_SAFE_DIR . 'event-espresso-4-' . self::$_lang . '.mo'  );
45
+		} else if ( ! empty(self::$_lang) && is_readable(EE_LANGUAGES_SAFE_DIR.'event-espresso-4-'.self::$_lang.'.mo')) {
46
+			load_textdomain('event_espresso', EE_LANGUAGES_SAFE_DIR.'event-espresso-4-'.self::$_lang.'.mo');
47 47
 		} else {
48
-			load_plugin_textdomain( 'event_espresso', FALSE, dirname( EE_PLUGIN_BASENAME ) . '/languages/');
48
+			load_plugin_textdomain('event_espresso', FALSE, dirname(EE_PLUGIN_BASENAME).'/languages/');
49 49
 		}
50 50
 	}
51 51
 
@@ -60,24 +60,24 @@  discard block
 block discarded – undo
60 60
 	 */
61 61
 	private static function _maybe_get_langfile() {
62 62
 		self::$_lang = get_locale();
63
-		if ( $has_check = get_option( 'ee_lang_check_' . self::$_lang . '_' . EVENT_ESPRESSO_VERSION ) || empty( self::$_lang ) )
63
+		if ($has_check = get_option('ee_lang_check_'.self::$_lang.'_'.EVENT_ESPRESSO_VERSION) || empty(self::$_lang))
64 64
 			return;
65 65
 
66 66
 		//if lang is en_US or empty then lets just get out.  (Event Espresso core is en_US)
67
-		if ( empty( self::$_lang ) || self::$_lang == 'en_US' )
67
+		if (empty(self::$_lang) || self::$_lang == 'en_US')
68 68
 			return;
69 69
 
70 70
 		//made it here so let's get the file from the github repo
71 71
 		$sideloader_args = array(
72
-			'_upload_to' => EE_PLUGIN_DIR_PATH . 'languages/',
73
-			'_upload_from' => 'https://github.com/eventespresso/languages-ee4/blob/master/event_espresso-' . self::$_lang . '.mo?raw=true',
74
-			'_new_file_name' => 'event_espresso-' . self::$_lang . '.mo'
72
+			'_upload_to' => EE_PLUGIN_DIR_PATH.'languages/',
73
+			'_upload_from' => 'https://github.com/eventespresso/languages-ee4/blob/master/event_espresso-'.self::$_lang.'.mo?raw=true',
74
+			'_new_file_name' => 'event_espresso-'.self::$_lang.'.mo'
75 75
 			);
76 76
 
77 77
 
78
-		$sideloader = EE_Registry::instance()->load_helper('Sideloader', $sideloader_args, FALSE );
78
+		$sideloader = EE_Registry::instance()->load_helper('Sideloader', $sideloader_args, FALSE);
79 79
 
80 80
 		$sideloader->sideload();
81
-		update_option( 'ee_lang_check_' . self::$_lang . '_' . EVENT_ESPRESSO_VERSION, 1 );
81
+		update_option('ee_lang_check_'.self::$_lang.'_'.EVENT_ESPRESSO_VERSION, 1);
82 82
 	}
83 83
 } //end EE_Load_Textdomain
Please login to merge, or discard this patch.
Braces   +9 added lines, -5 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
  *
@@ -60,12 +62,14 @@  discard block
 block discarded – undo
60 62
 	 */
61 63
 	private static function _maybe_get_langfile() {
62 64
 		self::$_lang = get_locale();
63
-		if ( $has_check = get_option( 'ee_lang_check_' . self::$_lang . '_' . EVENT_ESPRESSO_VERSION ) || empty( self::$_lang ) )
64
-			return;
65
+		if ( $has_check = get_option( 'ee_lang_check_' . self::$_lang . '_' . EVENT_ESPRESSO_VERSION ) || empty( self::$_lang ) ) {
66
+					return;
67
+		}
65 68
 
66 69
 		//if lang is en_US or empty then lets just get out.  (Event Espresso core is en_US)
67
-		if ( empty( self::$_lang ) || self::$_lang == 'en_US' )
68
-			return;
70
+		if ( empty( self::$_lang ) || self::$_lang == 'en_US' ) {
71
+					return;
72
+		}
69 73
 
70 74
 		//made it here so let's get the file from the github repo
71 75
 		$sideloader_args = array(
Please login to merge, or discard this patch.
core/EE_Module_Request_Router.core.php 3 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.
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_Network_Config.core.php 2 patches
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 	 */
59 59
 	public static function instance() {
60 60
 		// check if class object is instantiated, and instantiated properly
61
-		if ( self::$_instance === NULL  or ! is_object( self::$_instance ) or ! ( self::$_instance instanceof EE_Network_Config )) {
61
+		if (self::$_instance === NULL or ! is_object(self::$_instance) or ! (self::$_instance instanceof EE_Network_Config)) {
62 62
 			self::$_instance = new self();
63 63
 		}
64 64
 		return self::$_instance;
@@ -74,15 +74,15 @@  discard block
 block discarded – undo
74 74
 	 *  @return 	void
75 75
 	 */
76 76
 	private function __construct() {
77
-		do_action( 'AHEE__EE_Network_Config__construct__begin',$this );
77
+		do_action('AHEE__EE_Network_Config__construct__begin', $this);
78 78
 		//set defaults
79
-		$this->core = apply_filters( 'FHEE__EE_Network_Config___construct__core', new EE_Network_Core_Config() );
79
+		$this->core = apply_filters('FHEE__EE_Network_Config___construct__core', new EE_Network_Core_Config());
80 80
 		$this->addons = array();
81 81
 
82 82
 		$this->_load_config();
83 83
 
84 84
 		// construct__end hook
85
-		do_action( 'AHEE__EE_Network_Config__construct__end',$this );
85
+		do_action('AHEE__EE_Network_Config__construct__end', $this);
86 86
 	}
87 87
 
88 88
 
@@ -95,9 +95,9 @@  discard block
 block discarded – undo
95 95
 	 */
96 96
 	private function _load_config() {
97 97
 		$config = $this->get_config();
98
-		foreach ( $config as $prop => $settings ) {
99
-			$prop_class = is_object( $settings ) ? get_class( $this->$prop ) : FALSE;
100
-			if ( ! empty( $settings ) && ( ! $prop_class || ( $settings instanceof $prop_class ))) {
98
+		foreach ($config as $prop => $settings) {
99
+			$prop_class = is_object($settings) ? get_class($this->$prop) : FALSE;
100
+			if ( ! empty($settings) && ( ! $prop_class || ($settings instanceof $prop_class))) {
101 101
 				$this->$prop = $settings;
102 102
 			}
103 103
 		}
@@ -114,8 +114,8 @@  discard block
 block discarded – undo
114 114
 	 */
115 115
 	public function get_config() {
116 116
 		// grab network configuration
117
-		$CFG = get_site_option( 'ee_network_config', array() );
118
-		$CFG = apply_filters( 'FHEE__EE_Network_Config__get_config__CFG', $CFG );
117
+		$CFG = get_site_option('ee_network_config', array());
118
+		$CFG = apply_filters('FHEE__EE_Network_Config__get_config__CFG', $CFG);
119 119
 		return $CFG;
120 120
 	}
121 121
 
@@ -127,24 +127,24 @@  discard block
 block discarded – undo
127 127
 	 *  @access 	public
128 128
 	 *  @return 	boolean success
129 129
 	 */
130
-	public function update_config( $add_success = FALSE, $add_error = TRUE ) {
131
-		do_action( 'AHEE__EE_Network_Config__update_config__begin',$this );
130
+	public function update_config($add_success = FALSE, $add_error = TRUE) {
131
+		do_action('AHEE__EE_Network_Config__update_config__begin', $this);
132 132
 		// compare existing settings with what's already saved'
133 133
 		$saved_config = $this->get_config();
134 134
 		// update
135
-		$saved = $saved_config == $this ? TRUE : update_site_option( 'ee_network_config', $this );
136
-		do_action( 'AHEE__EE_Network_Config__update_config__end', $this, $saved );
135
+		$saved = $saved_config == $this ? TRUE : update_site_option('ee_network_config', $this);
136
+		do_action('AHEE__EE_Network_Config__update_config__end', $this, $saved);
137 137
 		// if config remains the same or was updated successfully
138
-		if ( $saved ) {
139
-			if ( $add_success ) {
140
-				$msg = is_multisite() ? __( 'The Event Espresso Network Configuration Settings have been successfully updated.', 'event_espresso' ) : __( 'Extra Event Espresso Configuration settings were successfully updated.', 'event_espresso' );
141
-				EE_Error::add_success( $msg );
138
+		if ($saved) {
139
+			if ($add_success) {
140
+				$msg = is_multisite() ? __('The Event Espresso Network Configuration Settings have been successfully updated.', 'event_espresso') : __('Extra Event Espresso Configuration settings were successfully updated.', 'event_espresso');
141
+				EE_Error::add_success($msg);
142 142
 			}
143 143
 			return TRUE;
144 144
 		} else {
145
-			if ( $add_error ) {
146
-				$msg = is_multisite() ? __( 'The Event Espresso Network Configuration Settings were not updated.', 'event_espresso' ) : __( 'Extra Event Espresso Network Configuration settings were not updated.', 'event_espresso' );
147
-				EE_Error::add_error( $msg , __FILE__, __FUNCTION__, __LINE__ );
145
+			if ($add_error) {
146
+				$msg = is_multisite() ? __('The Event Espresso Network Configuration Settings were not updated.', 'event_espresso') : __('Extra Event Espresso Network Configuration settings were not updated.', 'event_espresso');
147
+				EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
148 148
 			}
149 149
 			return FALSE;
150 150
 		}
@@ -158,9 +158,9 @@  discard block
 block discarded – undo
158 158
 	 *  @return 	array
159 159
 	 */
160 160
 	public function __sleep() {
161
-		return apply_filters( 'FHEE__EE_Network_Config__sleep',array(
161
+		return apply_filters('FHEE__EE_Network_Config__sleep', array(
162 162
 			'core',
163
-		) );
163
+		));
164 164
 	}
165 165
 
166 166
 } //end EE_Network_Config.
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_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.
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
  *
@@ -53,8 +55,9 @@  discard block
 block discarded – undo
53 55
 		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
54 56
 
55 57
 		//wp have no MONTH_IN_SECONDS constant.  So we approximate our own assuming all months are 4 weeks long.
56
-		if ( !defined('MONTH_IN_SECONDS' ) )
57
-			define( 'MONTH_IN_SECONDS', WEEK_IN_SECONDS * 4 );
58
+		if ( !defined('MONTH_IN_SECONDS' ) ) {
59
+					define( 'MONTH_IN_SECONDS', WEEK_IN_SECONDS * 4 );
60
+		}
58 61
 
59 62
 		if(EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance){
60 63
 			$this->_uxip_hooks();
@@ -101,42 +104,51 @@  discard block
 block discarded – undo
101 104
 
102 105
 				//what is the current active theme?
103 106
 				$active_theme = get_option('uxip_ee_active_theme');
104
-				if ( !empty( $active_theme ) )
105
-					$extra_stats[$site_pre . 'active_theme'] = $active_theme;
107
+				if ( !empty( $active_theme ) ) {
108
+									$extra_stats[$site_pre . 'active_theme'] = $active_theme;
109
+				}
106 110
 
107 111
 				//event info regarding an all event count and all "active" event count
108 112
 				$all_events_count = get_option('uxip_ee4_all_events_count');
109
-				if ( !empty( $all_events_count ) )
110
-					$extra_stats[$site_pre . 'ee4_all_events_count'] = $all_events_count;
113
+				if ( !empty( $all_events_count ) ) {
114
+									$extra_stats[$site_pre . 'ee4_all_events_count'] = $all_events_count;
115
+				}
111 116
 				$active_events_count = get_option('uxip_ee4_active_events_count');
112
-				if ( !empty( $active_events_count ) )
113
-					$extra_stats[$site_pre . 'ee4_active_events_count'] = $active_events_count;
117
+				if ( !empty( $active_events_count ) ) {
118
+									$extra_stats[$site_pre . 'ee4_active_events_count'] = $active_events_count;
119
+				}
114 120
 
115 121
 				//datetime stuff
116 122
 				$dtt_count = get_option('uxip_ee_all_dtts_count');
117
-				if ( !empty( $dtt_count ) )
118
-					$extra_stats[$site_pre . 'all_dtts_count'] = $dtt_count;
123
+				if ( !empty( $dtt_count ) ) {
124
+									$extra_stats[$site_pre . 'all_dtts_count'] = $dtt_count;
125
+				}
119 126
 
120 127
 				$dtt_sold = get_option('uxip_ee_dtt_sold');
121
-				if ( !empty( $dtt_sold ) )
122
-					$extra_stats[$site_pre . 'dtt_sold'] = $dtt_sold;
128
+				if ( !empty( $dtt_sold ) ) {
129
+									$extra_stats[$site_pre . 'dtt_sold'] = $dtt_sold;
130
+				}
123 131
 
124 132
 				//ticket stuff
125 133
 				$all_tkt_count = get_option('uxip_ee_all_tkt_count');
126
-				if ( !empty( $all_tkt_count ) )
127
-					$extra_stats[$site_pre . 'all_tkt_count'] = $all_tkt_count;
134
+				if ( !empty( $all_tkt_count ) ) {
135
+									$extra_stats[$site_pre . 'all_tkt_count'] = $all_tkt_count;
136
+				}
128 137
 
129 138
 				$free_tkt_count = get_option('uxip_ee_free_tkt_count');
130
-				if ( !empty( $free_tkt_count ) )
131
-					$extra_stats[$site_pre . 'free_tkt_count'] = $free_tkt_count;
139
+				if ( !empty( $free_tkt_count ) ) {
140
+									$extra_stats[$site_pre . 'free_tkt_count'] = $free_tkt_count;
141
+				}
132 142
 
133 143
 				$paid_tkt_count = get_option('uxip_ee_paid_tkt_count');
134
-				if ( !empty( $paid_tkt_count ) )
135
-					$extra_stats[$site_pre . 'paid_tkt_count'] = $paid_tkt_count;
144
+				if ( !empty( $paid_tkt_count ) ) {
145
+									$extra_stats[$site_pre . 'paid_tkt_count'] = $paid_tkt_count;
146
+				}
136 147
 
137 148
 				$tkt_sold = get_option('uxip_ee_tkt_sold' );
138
-				if ( !empty($tkt_sold) )
139
-					$extra_stats[$site_pre . 'tkt_sold'] = $tkt_sold;
149
+				if ( !empty($tkt_sold) ) {
150
+									$extra_stats[$site_pre . 'tkt_sold'] = $tkt_sold;
151
+				}
140 152
 
141 153
 				//phpversion checking
142 154
 				$extra_stats['phpversion'] = function_exists('phpversion') ? phpversion() : 'unknown';
@@ -209,7 +221,9 @@  discard block
 block discarded – undo
209 221
 
210 222
 	function espresso_data_collection_optin_notice() {
211 223
 		$ueip_has_notified = EE_Registry::instance()->CFG->core->ee_ueip_has_notified;
212
-		if ( $ueip_has_notified ) return;
224
+		if ( $ueip_has_notified ) {
225
+			return;
226
+		}
213 227
 		$settings_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'default'), admin_url( 'admin.php?page=espresso_general_settings') );
214 228
 		$settings_url = $settings_url . '#UXIP_settings';
215 229
 		?>
@@ -249,7 +263,9 @@  discard block
 block discarded – undo
249 263
 	function espresso_data_optin_ajax_handler() {
250 264
 
251 265
 		//verify nonce
252
-		if ( isset($_POST['nonce']) && !wp_verify_nonce($_POST['nonce'], 'ee-data-optin') ) exit();
266
+		if ( isset($_POST['nonce']) && !wp_verify_nonce($_POST['nonce'], 'ee-data-optin') ) {
267
+			exit();
268
+		}
253 269
 
254 270
 		//made it here so let's save the selection
255 271
 		$ueip_optin = isset( $_POST['selection'] ) ? $_POST['selection'] : 'no';
@@ -279,13 +295,15 @@  discard block
 block discarded – undo
279 295
 		$current = get_site_transient( 'update_plugins' );
280 296
 
281 297
 		foreach ( (array) $plugins as $plugin_file => $plugin_data ) {
282
-			if ( isset( $current->response['plugin_file'] ) )
283
-				$update = true;
298
+			if ( isset( $current->response['plugin_file'] ) ) {
299
+							$update = true;
300
+			}
284 301
 		}
285 302
 
286 303
 		//it's possible that there is an update but an invalid site-license-key is in use
287
-		if ( get_site_option('pue_json_error_' . $basename ) )
288
-			$update = true;
304
+		if ( get_site_option('pue_json_error_' . $basename ) ) {
305
+					$update = true;
306
+		}
289 307
 
290 308
 		return $update;
291 309
 	}
@@ -329,46 +347,54 @@  discard block
 block discarded – undo
329 347
 			$DTT = EE_Registry::instance()->load_model('Datetime');
330 348
 			$TKT = EE_Registry::instance()->load_model('Ticket');
331 349
 			$count = $EVT->count();
332
-			if ( $count > 0 )
333
-				update_option('uxip_ee4_all_events_count', $count);
350
+			if ( $count > 0 ) {
351
+							update_option('uxip_ee4_all_events_count', $count);
352
+			}
334 353
 
335 354
 			//next let's just get the number of ACTIVE events
336 355
 			$count_active = $EVT->get_active_events(array(), TRUE);
337
-			if ( $count_active > 0 )
338
-				update_option('uxip_ee4_active_events_count', $count_active);
356
+			if ( $count_active > 0 ) {
357
+							update_option('uxip_ee4_active_events_count', $count_active);
358
+			}
339 359
 
340 360
 			//datetimes!
341 361
 			$dtt_count = $DTT->count();
342
-			if ( $dtt_count > 0 )
343
-				update_option( 'uxip_ee_all_dtts_count', $dtt_count );
362
+			if ( $dtt_count > 0 ) {
363
+							update_option( 'uxip_ee_all_dtts_count', $dtt_count );
364
+			}
344 365
 
345 366
 
346 367
 			//dttsold
347 368
 			$dtt_sold = $DTT->sum(array(), 'DTT_sold');
348
-			if ( $dtt_sold > 0 )
349
-				update_option( 'uxip_ee_dtt_sold', $dtt_sold );
369
+			if ( $dtt_sold > 0 ) {
370
+							update_option( 'uxip_ee_dtt_sold', $dtt_sold );
371
+			}
350 372
 
351 373
 			//allticketcount
352 374
 			$all_tkt_count = $TKT->count();
353
-			if ( $all_tkt_count > 0 )
354
-				update_option( 'uxip_ee_all_tkt_count', $all_tkt_count );
375
+			if ( $all_tkt_count > 0 ) {
376
+							update_option( 'uxip_ee_all_tkt_count', $all_tkt_count );
377
+			}
355 378
 
356 379
 			//freetktcount
357 380
 			$_where = array( 'TKT_price' => 0 );
358 381
 			$free_tkt_count = $TKT->count(array($_where));
359
-			if ( $free_tkt_count > 0 )
360
-				update_option( 'uxip_ee_free_tkt_count', $free_tkt_count );
382
+			if ( $free_tkt_count > 0 ) {
383
+							update_option( 'uxip_ee_free_tkt_count', $free_tkt_count );
384
+			}
361 385
 
362 386
 			//paidtktcount
363 387
 			$_where = array( 'TKT_price' => array('>', 0) );
364 388
 			$paid_tkt_count = $TKT->count( array( $_where ) );
365
-			if ( $paid_tkt_count > 0 )
366
-				update_option( 'uxip_ee_paid_tkt_count', $paid_tkt_count );
389
+			if ( $paid_tkt_count > 0 ) {
390
+							update_option( 'uxip_ee_paid_tkt_count', $paid_tkt_count );
391
+			}
367 392
 
368 393
 			//tktsold
369 394
 			$tkt_sold = $TKT->sum( array(), 'TKT_sold' );
370
-			if( $tkt_sold > 0 )
371
-				update_option( 'uxip_ee_tkt_sold', $tkt_sold );
395
+			if( $tkt_sold > 0 ) {
396
+							update_option( 'uxip_ee_tkt_sold', $tkt_sold );
397
+			}
372 398
 
373 399
 
374 400
 			set_transient( 'ee4_event_info_check', 1, WEEK_IN_SECONDS * 2 );
Please login to merge, or discard this patch.
Spacing   +88 added lines, -88 removed lines patch added patch discarded remove patch
@@ -50,13 +50,13 @@  discard block
 block discarded – undo
50 50
 	public function __construct() {
51 51
 //		throw new EE_Error('error');
52 52
 
53
-		do_action( 'AHEE_log', __CLASS__, __FUNCTION__ );
53
+		do_action('AHEE_log', __CLASS__, __FUNCTION__);
54 54
 
55 55
 		//wp have no MONTH_IN_SECONDS constant.  So we approximate our own assuming all months are 4 weeks long.
56
-		if ( !defined('MONTH_IN_SECONDS' ) )
57
-			define( 'MONTH_IN_SECONDS', WEEK_IN_SECONDS * 4 );
56
+		if ( ! defined('MONTH_IN_SECONDS'))
57
+			define('MONTH_IN_SECONDS', WEEK_IN_SECONDS * 4);
58 58
 
59
-		if(EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance){
59
+		if (EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance) {
60 60
 			$this->_uxip_hooks();
61 61
 		}
62 62
 
@@ -65,12 +65,12 @@  discard block
 block discarded – undo
65 65
 		$ueip_has_notified = EE_Registry::instance()->CFG->core->ee_ueip_has_notified;
66 66
 
67 67
 		//has optin been selected for datacollection?
68
-		$espresso_data_optin = !empty($ueip_optin) ? $ueip_optin : NULL;
68
+		$espresso_data_optin = ! empty($ueip_optin) ? $ueip_optin : NULL;
69 69
 
70
-		if ( empty($ueip_has_notified) && EE_Maintenance_Mode::instance()->level() != EE_Maintenance_mode::level_2_complete_maintenance ) {
71
-			add_action('admin_notices', array( $this, 'espresso_data_collection_optin_notice' ), 10 );
72
-			add_action('admin_enqueue_scripts', array( $this, 'espresso_data_collection_enqueue_scripts' ), 10 );
73
-			add_action('wp_ajax_espresso_data_optin', array( $this, 'espresso_data_optin_ajax_handler' ), 10 );
70
+		if (empty($ueip_has_notified) && EE_Maintenance_Mode::instance()->level() != EE_Maintenance_mode::level_2_complete_maintenance) {
71
+			add_action('admin_notices', array($this, 'espresso_data_collection_optin_notice'), 10);
72
+			add_action('admin_enqueue_scripts', array($this, 'espresso_data_collection_enqueue_scripts'), 10);
73
+			add_action('wp_ajax_espresso_data_optin', array($this, 'espresso_data_optin_ajax_handler'), 10);
74 74
 			update_option('ee_ueip_optin', 'yes');
75 75
 			$espresso_data_optin = 'yes';
76 76
 		}
@@ -79,80 +79,80 @@  discard block
 block discarded – undo
79 79
 		$extra_stats = array();
80 80
 
81 81
 		//only collect extra stats if the plugin user has opted in.
82
-		if ( !empty($espresso_data_optin) && $espresso_data_optin == 'yes' ) {
82
+		if ( ! empty($espresso_data_optin) && $espresso_data_optin == 'yes') {
83 83
 			//let's only setup extra data if transient has expired
84
-			if ( false === ( $transient = get_transient('ee_extra_data') ) && EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance ) {
84
+			if (false === ($transient = get_transient('ee_extra_data')) && EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance) {
85 85
 
86 86
 				$current_site = is_multisite() ? get_current_site() : NULL;
87
-				$site_pre = ! is_main_site() && ! empty($current_site) ? trim( preg_replace('/\b\w\S\w\b/', '', $current_site->domain ), '.' ) . '_' : '';
87
+				$site_pre = ! is_main_site() && ! empty($current_site) ? trim(preg_replace('/\b\w\S\w\b/', '', $current_site->domain), '.').'_' : '';
88 88
 
89 89
 
90 90
 				//active gateways
91 91
 				$active_gateways = get_option('event_espresso_active_gateways');
92
-				if ( !empty($active_gateways ) ) {
93
-					foreach ( (array) $active_gateways as $gateway => $ignore ) {
94
-						$extra_stats[$site_pre . $gateway . '_gateway_active'] = 1;
92
+				if ( ! empty($active_gateways)) {
93
+					foreach ((array) $active_gateways as $gateway => $ignore) {
94
+						$extra_stats[$site_pre.$gateway.'_gateway_active'] = 1;
95 95
 					}
96 96
 				}
97 97
 
98
-				if ( is_multisite() && is_main_site() ) {
98
+				if (is_multisite() && is_main_site()) {
99 99
 					$extra_stats['is_multisite'] = true;
100 100
 				}
101 101
 
102 102
 				//what is the current active theme?
103 103
 				$active_theme = get_option('uxip_ee_active_theme');
104
-				if ( !empty( $active_theme ) )
105
-					$extra_stats[$site_pre . 'active_theme'] = $active_theme;
104
+				if ( ! empty($active_theme))
105
+					$extra_stats[$site_pre.'active_theme'] = $active_theme;
106 106
 
107 107
 				//event info regarding an all event count and all "active" event count
108 108
 				$all_events_count = get_option('uxip_ee4_all_events_count');
109
-				if ( !empty( $all_events_count ) )
110
-					$extra_stats[$site_pre . 'ee4_all_events_count'] = $all_events_count;
109
+				if ( ! empty($all_events_count))
110
+					$extra_stats[$site_pre.'ee4_all_events_count'] = $all_events_count;
111 111
 				$active_events_count = get_option('uxip_ee4_active_events_count');
112
-				if ( !empty( $active_events_count ) )
113
-					$extra_stats[$site_pre . 'ee4_active_events_count'] = $active_events_count;
112
+				if ( ! empty($active_events_count))
113
+					$extra_stats[$site_pre.'ee4_active_events_count'] = $active_events_count;
114 114
 
115 115
 				//datetime stuff
116 116
 				$dtt_count = get_option('uxip_ee_all_dtts_count');
117
-				if ( !empty( $dtt_count ) )
118
-					$extra_stats[$site_pre . 'all_dtts_count'] = $dtt_count;
117
+				if ( ! empty($dtt_count))
118
+					$extra_stats[$site_pre.'all_dtts_count'] = $dtt_count;
119 119
 
120 120
 				$dtt_sold = get_option('uxip_ee_dtt_sold');
121
-				if ( !empty( $dtt_sold ) )
122
-					$extra_stats[$site_pre . 'dtt_sold'] = $dtt_sold;
121
+				if ( ! empty($dtt_sold))
122
+					$extra_stats[$site_pre.'dtt_sold'] = $dtt_sold;
123 123
 
124 124
 				//ticket stuff
125 125
 				$all_tkt_count = get_option('uxip_ee_all_tkt_count');
126
-				if ( !empty( $all_tkt_count ) )
127
-					$extra_stats[$site_pre . 'all_tkt_count'] = $all_tkt_count;
126
+				if ( ! empty($all_tkt_count))
127
+					$extra_stats[$site_pre.'all_tkt_count'] = $all_tkt_count;
128 128
 
129 129
 				$free_tkt_count = get_option('uxip_ee_free_tkt_count');
130
-				if ( !empty( $free_tkt_count ) )
131
-					$extra_stats[$site_pre . 'free_tkt_count'] = $free_tkt_count;
130
+				if ( ! empty($free_tkt_count))
131
+					$extra_stats[$site_pre.'free_tkt_count'] = $free_tkt_count;
132 132
 
133 133
 				$paid_tkt_count = get_option('uxip_ee_paid_tkt_count');
134
-				if ( !empty( $paid_tkt_count ) )
135
-					$extra_stats[$site_pre . 'paid_tkt_count'] = $paid_tkt_count;
134
+				if ( ! empty($paid_tkt_count))
135
+					$extra_stats[$site_pre.'paid_tkt_count'] = $paid_tkt_count;
136 136
 
137
-				$tkt_sold = get_option('uxip_ee_tkt_sold' );
138
-				if ( !empty($tkt_sold) )
139
-					$extra_stats[$site_pre . 'tkt_sold'] = $tkt_sold;
137
+				$tkt_sold = get_option('uxip_ee_tkt_sold');
138
+				if ( ! empty($tkt_sold))
139
+					$extra_stats[$site_pre.'tkt_sold'] = $tkt_sold;
140 140
 
141 141
 				//phpversion checking
142 142
 				$extra_stats['phpversion'] = function_exists('phpversion') ? phpversion() : 'unknown';
143 143
 
144 144
 				//set transient
145
-				set_transient( 'ee_extra_data', $extra_stats, WEEK_IN_SECONDS );
145
+				set_transient('ee_extra_data', $extra_stats, WEEK_IN_SECONDS);
146 146
 			}
147 147
 		}
148 148
 
149 149
 
150 150
 
151 151
 		// PUE Auto Upgrades stuff
152
-		if (is_readable(EE_THIRD_PARTY . 'pue/pue-client.php')) { //include the file
153
-			require_once(EE_THIRD_PARTY . 'pue/pue-client.php' );
152
+		if (is_readable(EE_THIRD_PARTY.'pue/pue-client.php')) { //include the file
153
+			require_once(EE_THIRD_PARTY.'pue/pue-client.php');
154 154
 
155
-			$api_key = isset( EE_Registry::instance()->NET_CFG->core->site_license_key ) ? EE_Registry::instance()->NET_CFG->core->site_license_key : '';
155
+			$api_key = isset(EE_Registry::instance()->NET_CFG->core->site_license_key) ? EE_Registry::instance()->NET_CFG->core->site_license_key : '';
156 156
 			$host_server_url = 'http://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.
157 157
 
158 158
 			//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.
@@ -164,9 +164,9 @@  discard block
 block discarded – undo
164 164
 			//$plugin_slug['prerelease']['b'] = 'some-pre-release-slug';
165 165
 			//..WOULD work!
166 166
 			$plugin_slug = array(
167
-				'free' => array( 'decaf' => 'event-espresso-core-decaf' ),
168
-				'premium' => array( 'p' => 'event-espresso-core-reg' ),
169
-				'prerelease' => array( 'beta' => 'event-espresso-core-pr' )
167
+				'free' => array('decaf' => 'event-espresso-core-decaf'),
168
+				'premium' => array('p' => 'event-espresso-core-reg'),
169
+				'prerelease' => array('beta' => 'event-espresso-core-pr')
170 170
 				);
171 171
 
172 172
 
@@ -193,14 +193,14 @@  discard block
 block discarded – undo
193 193
 	 * The purpose of this function is to display information about Event Espresso data collection and a optin selection for extra data collecting by users.
194 194
 	 * @return string html.
195 195
 	 */
196
-	 public static function espresso_data_collection_optin_text( $extra = TRUE ) {
197
-	 	if ( ! $extra ) {
198
-			 echo '<h4 '. (!$extra ? 'id="UXIP_settings"' : '').'>'.__('User eXperience Improvement Program (UXIP)', 'event_espresso').'</h4>';
199
-			 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>' );
196
+	 public static function espresso_data_collection_optin_text($extra = TRUE) {
197
+	 	if ( ! $extra) {
198
+			 echo '<h4 '.( ! $extra ? 'id="UXIP_settings"' : '').'>'.__('User eXperience Improvement Program (UXIP)', 'event_espresso').'</h4>';
199
+			 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>');
200 200
 		} else {
201
-			$settings_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'default'), admin_url( 'admin.php?page=espresso_general_settings') );
201
+			$settings_url = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'default'), admin_url('admin.php?page=espresso_general_settings'));
202 202
 			$settings_url .= '#UXIP_settings';
203
-			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
+			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>');
204 204
 		}
205 205
 	}
206 206
 
@@ -209,9 +209,9 @@  discard block
 block discarded – undo
209 209
 
210 210
 	function espresso_data_collection_optin_notice() {
211 211
 		$ueip_has_notified = EE_Registry::instance()->CFG->core->ee_ueip_has_notified;
212
-		if ( $ueip_has_notified ) return;
213
-		$settings_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'default'), admin_url( 'admin.php?page=espresso_general_settings') );
214
-		$settings_url = $settings_url . '#UXIP_settings';
212
+		if ($ueip_has_notified) return;
213
+		$settings_url = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'default'), admin_url('admin.php?page=espresso_general_settings'));
214
+		$settings_url = $settings_url.'#UXIP_settings';
215 215
 		?>
216 216
 		<div class="updated data-collect-optin" id="espresso-data-collect-optin-container">
217 217
 			<div id="data-collect-optin-options-container">
@@ -233,8 +233,8 @@  discard block
 block discarded – undo
233 233
 	 * @return void
234 234
 	 */
235 235
 	function espresso_data_collection_enqueue_scripts() {
236
-		wp_register_script( 'ee-data-optin-js', EE_GLOBAL_ASSETS_URL . 'scripts/ee-data-optin.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE );
237
-		wp_register_style( 'ee-data-optin-css', EE_GLOBAL_ASSETS_URL . 'css/ee-data-optin.css', array(), EVENT_ESPRESSO_VERSION );
236
+		wp_register_script('ee-data-optin-js', EE_GLOBAL_ASSETS_URL.'scripts/ee-data-optin.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE);
237
+		wp_register_style('ee-data-optin-css', EE_GLOBAL_ASSETS_URL.'css/ee-data-optin.css', array(), EVENT_ESPRESSO_VERSION);
238 238
 
239 239
 		wp_enqueue_script('ee-data-optin-js');
240 240
 		wp_enqueue_style('ee-data-optin-css');
@@ -249,14 +249,14 @@  discard block
 block discarded – undo
249 249
 	function espresso_data_optin_ajax_handler() {
250 250
 
251 251
 		//verify nonce
252
-		if ( isset($_POST['nonce']) && !wp_verify_nonce($_POST['nonce'], 'ee-data-optin') ) exit();
252
+		if (isset($_POST['nonce']) && ! wp_verify_nonce($_POST['nonce'], 'ee-data-optin')) exit();
253 253
 
254 254
 		//made it here so let's save the selection
255
-		$ueip_optin = isset( $_POST['selection'] ) ? $_POST['selection'] : 'no';
255
+		$ueip_optin = isset($_POST['selection']) ? $_POST['selection'] : 'no';
256 256
 
257 257
 		//update_option('ee_ueip_optin', $ueip_optin);
258 258
 		EE_Registry::instance()->CFG->core->ee_ueip_has_notified = 1;
259
-		EE_Registry::instance()->CFG->update_espresso_config( FALSE, FALSE );
259
+		EE_Registry::instance()->CFG->update_espresso_config(FALSE, FALSE);
260 260
 		exit();
261 261
 	}
262 262
 
@@ -269,22 +269,22 @@  discard block
 block discarded – undo
269 269
 	 */
270 270
 	public static function is_update_available($basename = '') {
271 271
 
272
-		$basename = ! empty( $basename ) ? $basename : EE_PLUGIN_BASENAME;
272
+		$basename = ! empty($basename) ? $basename : EE_PLUGIN_BASENAME;
273 273
 
274 274
 		$update = false;
275 275
 
276
-		$folder = DS . dirname($basename); // should take "event-espresso-core/espresso.php" and change to "/event-espresso-core"
276
+		$folder = DS.dirname($basename); // should take "event-espresso-core/espresso.php" and change to "/event-espresso-core"
277 277
 
278 278
 		$plugins = get_plugins($folder);
279
-		$current = get_site_transient( 'update_plugins' );
279
+		$current = get_site_transient('update_plugins');
280 280
 
281
-		foreach ( (array) $plugins as $plugin_file => $plugin_data ) {
282
-			if ( isset( $current->response['plugin_file'] ) )
281
+		foreach ((array) $plugins as $plugin_file => $plugin_data) {
282
+			if (isset($current->response['plugin_file']))
283 283
 				$update = true;
284 284
 		}
285 285
 
286 286
 		//it's possible that there is an update but an invalid site-license-key is in use
287
-		if ( get_site_option('pue_json_error_' . $basename ) )
287
+		if (get_site_option('pue_json_error_'.$basename))
288 288
 			$update = true;
289 289
 
290 290
 		return $update;
@@ -302,9 +302,9 @@  discard block
 block discarded – undo
302 302
 	 * @return void
303 303
 	 */
304 304
 	public function _uxip_hooks() {
305
-		if ( EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance ) {
306
-			add_action('admin_init', array( $this, 'track_active_theme' ) );
307
-			add_action('admin_init', array( $this, 'track_event_info' ) );
305
+		if (EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance) {
306
+			add_action('admin_init', array($this, 'track_active_theme'));
307
+			add_action('admin_init', array($this, 'track_event_info'));
308 308
 		}
309 309
 	}
310 310
 
@@ -313,65 +313,65 @@  discard block
 block discarded – undo
313 313
 
314 314
 	public function track_active_theme() {
315 315
 		//we only check this once a month.
316
-		if ( false === ( $transient = get_transient( 'ee_active_theme_check' ) ) ) {
316
+		if (false === ($transient = get_transient('ee_active_theme_check'))) {
317 317
 			$theme = wp_get_theme();
318
-			update_option('uxip_ee_active_theme', $theme->get('Name') );
319
-			set_transient('ee_active_theme_check', 1, MONTH_IN_SECONDS );
318
+			update_option('uxip_ee_active_theme', $theme->get('Name'));
319
+			set_transient('ee_active_theme_check', 1, MONTH_IN_SECONDS);
320 320
 		}
321 321
 	}
322 322
 
323 323
 
324 324
 	public function track_event_info() {
325 325
 		//we only check this once every couple weeks.
326
-		if ( false === ( $transient = get_transient( 'ee4_event_info_check') ) ) {
326
+		if (false === ($transient = get_transient('ee4_event_info_check'))) {
327 327
 			//first let's get the number for ALL events
328 328
 			$EVT = EE_Registry::instance()->load_model('Event');
329 329
 			$DTT = EE_Registry::instance()->load_model('Datetime');
330 330
 			$TKT = EE_Registry::instance()->load_model('Ticket');
331 331
 			$count = $EVT->count();
332
-			if ( $count > 0 )
332
+			if ($count > 0)
333 333
 				update_option('uxip_ee4_all_events_count', $count);
334 334
 
335 335
 			//next let's just get the number of ACTIVE events
336 336
 			$count_active = $EVT->get_active_events(array(), TRUE);
337
-			if ( $count_active > 0 )
337
+			if ($count_active > 0)
338 338
 				update_option('uxip_ee4_active_events_count', $count_active);
339 339
 
340 340
 			//datetimes!
341 341
 			$dtt_count = $DTT->count();
342
-			if ( $dtt_count > 0 )
343
-				update_option( 'uxip_ee_all_dtts_count', $dtt_count );
342
+			if ($dtt_count > 0)
343
+				update_option('uxip_ee_all_dtts_count', $dtt_count);
344 344
 
345 345
 
346 346
 			//dttsold
347 347
 			$dtt_sold = $DTT->sum(array(), 'DTT_sold');
348
-			if ( $dtt_sold > 0 )
349
-				update_option( 'uxip_ee_dtt_sold', $dtt_sold );
348
+			if ($dtt_sold > 0)
349
+				update_option('uxip_ee_dtt_sold', $dtt_sold);
350 350
 
351 351
 			//allticketcount
352 352
 			$all_tkt_count = $TKT->count();
353
-			if ( $all_tkt_count > 0 )
354
-				update_option( 'uxip_ee_all_tkt_count', $all_tkt_count );
353
+			if ($all_tkt_count > 0)
354
+				update_option('uxip_ee_all_tkt_count', $all_tkt_count);
355 355
 
356 356
 			//freetktcount
357
-			$_where = array( 'TKT_price' => 0 );
357
+			$_where = array('TKT_price' => 0);
358 358
 			$free_tkt_count = $TKT->count(array($_where));
359
-			if ( $free_tkt_count > 0 )
360
-				update_option( 'uxip_ee_free_tkt_count', $free_tkt_count );
359
+			if ($free_tkt_count > 0)
360
+				update_option('uxip_ee_free_tkt_count', $free_tkt_count);
361 361
 
362 362
 			//paidtktcount
363
-			$_where = array( 'TKT_price' => array('>', 0) );
364
-			$paid_tkt_count = $TKT->count( array( $_where ) );
365
-			if ( $paid_tkt_count > 0 )
366
-				update_option( 'uxip_ee_paid_tkt_count', $paid_tkt_count );
363
+			$_where = array('TKT_price' => array('>', 0));
364
+			$paid_tkt_count = $TKT->count(array($_where));
365
+			if ($paid_tkt_count > 0)
366
+				update_option('uxip_ee_paid_tkt_count', $paid_tkt_count);
367 367
 
368 368
 			//tktsold
369
-			$tkt_sold = $TKT->sum( array(), 'TKT_sold' );
370
-			if( $tkt_sold > 0 )
371
-				update_option( 'uxip_ee_tkt_sold', $tkt_sold );
369
+			$tkt_sold = $TKT->sum(array(), 'TKT_sold');
370
+			if ($tkt_sold > 0)
371
+				update_option('uxip_ee_tkt_sold', $tkt_sold);
372 372
 
373 373
 
374
-			set_transient( 'ee4_event_info_check', 1, WEEK_IN_SECONDS * 2 );
374
+			set_transient('ee4_event_info_check', 1, WEEK_IN_SECONDS * 2);
375 375
 		}
376 376
 	}
377 377
 
Please login to merge, or discard this patch.
core/EE_Payment_Processor.core.php 3 patches
Braces   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -148,11 +148,11 @@  discard block
 block discarded – undo
148 148
 		EE_Processor_Base::set_IPN( $separate_IPN_request );
149 149
 		if( $transaction instanceof EE_Transaction && $payment_method instanceof EE_Payment_Method ){
150 150
 			$obj_for_log = EEM_Payment::instance()->get_one( array( array( 'TXN_ID' => $transaction->ID(), 'PMD_ID' => $payment_method->ID() ), 'order_by' => array( 'PAY_timestamp' => 'desc' ) ) );
151
-		}elseif( $payment_method instanceof EE_Payment ){
151
+		} elseif( $payment_method instanceof EE_Payment ){
152 152
 			$obj_for_log = $payment_method;
153
-		}elseif( $transaction instanceof EE_Transaction ){
153
+		} elseif( $transaction instanceof EE_Transaction ){
154 154
 			$obj_for_log = $transaction;
155
-		}else{
155
+		} else{
156 156
 			$obj_for_log = null;
157 157
 		}
158 158
 		$log = EEM_Change_Log::instance()->log(EEM_Change_Log::type_gateway, array('IPN data received'=>$_req_data), $obj_for_log);
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
 						__FILE__, __FUNCTION__, __LINE__
181 181
 					);
182 182
 				}
183
-			}else{
183
+			} else{
184 184
 				//that's actually pretty ok. The IPN just wasn't able
185 185
 				//to identify which transaction or payment method this was for
186 186
 				// give all active payment methods a chance to claim it
@@ -201,11 +201,11 @@  discard block
 block discarded – undo
201 201
 				$payment->save();
202 202
 				//  update the TXN
203 203
 				$this->update_txn_based_on_payment( $transaction, $payment, $update_txn, $separate_IPN_request );
204
-			}else{
204
+			} else{
205 205
 				//we couldn't find the payment for this IPN... let's try and log at least SOMETHING
206 206
 				if($payment_method){
207 207
 					EEM_Change_Log::instance()->log(EEM_Change_Log::type_gateway, array('IPN data'=>$_req_data), $payment_method);
208
-				}elseif($transaction){
208
+				} elseif($transaction){
209 209
 					EEM_Change_Log::instance()->log(EEM_Change_Log::type_gateway, array('IPN data'=>$_req_data), $transaction);
210 210
 				}
211 211
 			}
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
 			foreach( $request_data as $key => $value ) {
237 237
 				$return_data[ $this->_remove_unusable_characters( $key ) ] = $this->_remove_unusable_characters( $value );
238 238
 			}
239
-		}else{
239
+		} else{
240 240
 			$return_data =  preg_replace('/[^[:print:]]/', '', $request_data);
241 241
 		}
242 242
 		return $return_data;
Please login to merge, or discard this patch.
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -13,9 +13,9 @@
 block discarded – undo
13 13
  */
14 14
 class EE_Payment_Processor extends EE_Processor_Base {
15 15
 	/**
16
-     * 	@var EE_Payment_Processor $_instance
16
+	 * 	@var EE_Payment_Processor $_instance
17 17
 	 * 	@access 	private
18
-     */
18
+	 */
19 19
 	private static $_instance = NULL;
20 20
 
21 21
 
Please login to merge, or discard this patch.
Spacing   +127 added lines, -127 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); }
2
-EE_Registry::instance()->load_class( 'Processor_Base' );
2
+EE_Registry::instance()->load_class('Processor_Base');
3 3
 /**
4 4
  *
5 5
  * EE_Payment_Processor
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 	 */
28 28
 	public static function instance() {
29 29
 		// check if class object is instantiated
30
-		if ( ! self::$_instance instanceof EE_Payment_Processor ) {
30
+		if ( ! self::$_instance instanceof EE_Payment_Processor) {
31 31
 			self::$_instance = new self();
32 32
 		}
33 33
 		return self::$_instance;
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 	 *@return EE_Payment_Processor
43 43
 	 */
44 44
 	private function __construct() {
45
-		do_action( 'AHEE__EE_Payment_Processor__construct' );
45
+		do_action('AHEE__EE_Payment_Processor__construct');
46 46
 	}
47 47
 
48 48
 
@@ -61,35 +61,35 @@  discard block
 block discarded – undo
61 61
 	 * @param boolean              				$update_txn  	whether or not to call EE_Transaction_Processor::update_transaction_and_registrations_after_checkout_or_payment()
62 62
 	 * @return EE_Payment
63 63
 	 */
64
-	public function process_payment( EE_Payment_Method $payment_method, EE_Transaction $transaction, $amount = NULL, $billing_form = NULL, $return_url = NULL, $method = 'CART', $by_admin = FALSE, $update_txn = TRUE ) {
64
+	public function process_payment(EE_Payment_Method $payment_method, EE_Transaction $transaction, $amount = NULL, $billing_form = NULL, $return_url = NULL, $method = 'CART', $by_admin = FALSE, $update_txn = TRUE) {
65 65
 		// verify payment method
66
-		$payment_method = EEM_Payment_Method::instance()->ensure_is_obj( $payment_method, TRUE );
66
+		$payment_method = EEM_Payment_Method::instance()->ensure_is_obj($payment_method, TRUE);
67 67
 		// verify transaction
68
-		EEM_Transaction::instance()->ensure_is_obj( $transaction );
69
-		$transaction->set_payment_method_ID( $payment_method->ID() );
68
+		EEM_Transaction::instance()->ensure_is_obj($transaction);
69
+		$transaction->set_payment_method_ID($payment_method->ID());
70 70
 		// verify payment method type
71
-		if ( $payment_method->type_obj() instanceof EE_PMT_Base ){
71
+		if ($payment_method->type_obj() instanceof EE_PMT_Base) {
72 72
 			$payment = $payment_method->type_obj()->process_payment(
73 73
 				$transaction,
74
-				min( $amount, $transaction->remaining() ),//make sure we don't overcharge
74
+				min($amount, $transaction->remaining()), //make sure we don't overcharge
75 75
 				$billing_form,
76 76
 				$return_url,
77
-				add_query_arg( array( 'ee_cancel_payment' => true ), $return_url ),
77
+				add_query_arg(array('ee_cancel_payment' => true), $return_url),
78 78
 				$method,
79 79
 				$by_admin
80 80
 			);
81 81
 			// check if payment method uses an off-site gateway
82
-			if ( $payment_method->type_obj()->payment_occurs() != EE_PMT_Base::offsite ) {
82
+			if ($payment_method->type_obj()->payment_occurs() != EE_PMT_Base::offsite) {
83 83
 				// don't process payments for off-site gateways yet because no payment has occurred yet
84
-				$this->update_txn_based_on_payment( $transaction, $payment, $update_txn );
84
+				$this->update_txn_based_on_payment($transaction, $payment, $update_txn);
85 85
 			}
86 86
 			return $payment;
87 87
 		} else {
88 88
 			EE_Error::add_error(
89 89
 				sprintf(
90
-					__( 'A valid payment method could not be determined due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso' ),
90
+					__('A valid payment method could not be determined due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso'),
91 91
 					'<br/>',
92
-					EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
92
+					EE_Registry::instance()->CFG->organization->get_pretty('email')
93 93
 				), __FILE__, __FUNCTION__, __LINE__
94 94
 			);
95 95
 			return NULL;
@@ -105,14 +105,14 @@  discard block
 block discarded – undo
105 105
 	 * @throws EE_Error
106 106
 	 * @return string
107 107
 	 */
108
-	public function get_ipn_url_for_payment_method( $transaction, $payment_method ){
108
+	public function get_ipn_url_for_payment_method($transaction, $payment_method) {
109 109
 		/** @type EE_Transaction $transaction */
110
-		$transaction = EEM_Transaction::instance()->ensure_is_obj( $transaction );
110
+		$transaction = EEM_Transaction::instance()->ensure_is_obj($transaction);
111 111
 		$primary_reg = $transaction->primary_registration();
112
-		if( ! $primary_reg instanceof EE_Registration ){
113
-			throw new EE_Error(sprintf(__("Cannot get IPN URL for transaction with ID %d because it has no primary registration", "event_espresso"),$transaction->ID()));
112
+		if ( ! $primary_reg instanceof EE_Registration) {
113
+			throw new EE_Error(sprintf(__("Cannot get IPN URL for transaction with ID %d because it has no primary registration", "event_espresso"), $transaction->ID()));
114 114
 		}
115
-		$payment_method = EEM_Payment_Method::instance()->ensure_is_obj($payment_method,true);
115
+		$payment_method = EEM_Payment_Method::instance()->ensure_is_obj($payment_method, true);
116 116
 		$url = add_query_arg(
117 117
 			array(
118 118
 				'e_reg_url_link'=>$primary_reg->reg_url_link(),
@@ -139,81 +139,81 @@  discard block
 block discarded – undo
139 139
 	 * @throws Exception
140 140
 	 * @return EE_Payment
141 141
 	 */
142
-	public function process_ipn( $_req_data, $transaction = NULL, $payment_method = NULL, $update_txn = true, $separate_IPN_request = true ){
143
-		$_req_data = $this->_remove_unusable_characters( $_req_data );
144
-		EE_Registry::instance()->load_model( 'Change_Log' );
145
-		EE_Processor_Base::set_IPN( $separate_IPN_request );
146
-		if( $transaction instanceof EE_Transaction && $payment_method instanceof EE_Payment_Method ){
147
-			$obj_for_log = EEM_Payment::instance()->get_one( array( array( 'TXN_ID' => $transaction->ID(), 'PMD_ID' => $payment_method->ID() ), 'order_by' => array( 'PAY_timestamp' => 'desc' ) ) );
148
-		}elseif( $payment_method instanceof EE_Payment ){
142
+	public function process_ipn($_req_data, $transaction = NULL, $payment_method = NULL, $update_txn = true, $separate_IPN_request = true) {
143
+		$_req_data = $this->_remove_unusable_characters($_req_data);
144
+		EE_Registry::instance()->load_model('Change_Log');
145
+		EE_Processor_Base::set_IPN($separate_IPN_request);
146
+		if ($transaction instanceof EE_Transaction && $payment_method instanceof EE_Payment_Method) {
147
+			$obj_for_log = EEM_Payment::instance()->get_one(array(array('TXN_ID' => $transaction->ID(), 'PMD_ID' => $payment_method->ID()), 'order_by' => array('PAY_timestamp' => 'desc')));
148
+		}elseif ($payment_method instanceof EE_Payment) {
149 149
 			$obj_for_log = $payment_method;
150
-		}elseif( $transaction instanceof EE_Transaction ){
150
+		}elseif ($transaction instanceof EE_Transaction) {
151 151
 			$obj_for_log = $transaction;
152
-		}else{
152
+		} else {
153 153
 			$obj_for_log = null;
154 154
 		}
155 155
 		$log = EEM_Change_Log::instance()->log(EEM_Change_Log::type_gateway, array('IPN data received'=>$_req_data), $obj_for_log);
156
-		try{
156
+		try {
157 157
 			/**
158 158
 			 * @var EE_Payment $payment
159 159
 			 */
160 160
 			$payment = NULL;
161
-			if($transaction && $payment_method){
161
+			if ($transaction && $payment_method) {
162 162
 				/** @type EE_Transaction $transaction */
163 163
 				$transaction = EEM_Transaction::instance()->ensure_is_obj($transaction);
164 164
 				/** @type EE_Payment_Method $payment_method */
165 165
 				$payment_method = EEM_Payment_Method::instance()->ensure_is_obj($payment_method);
166
-				if ( $payment_method->type_obj() instanceof EE_PMT_Base ) {
167
-						$payment = $payment_method->type_obj()->handle_ipn( $_req_data, $transaction );
166
+				if ($payment_method->type_obj() instanceof EE_PMT_Base) {
167
+						$payment = $payment_method->type_obj()->handle_ipn($_req_data, $transaction);
168 168
 						$log->set_object($payment);
169 169
 				} else {
170 170
 					// not a payment
171 171
 					EE_Error::add_error(
172 172
 						sprintf(
173
-							__( 'A valid payment method could not be determined due to a technical issue.%sPlease refresh your browser and try again or contact %s for assistance.', 'event_espresso' ),
173
+							__('A valid payment method could not be determined due to a technical issue.%sPlease refresh your browser and try again or contact %s for assistance.', 'event_espresso'),
174 174
 							'<br/>',
175
-							EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
175
+							EE_Registry::instance()->CFG->organization->get_pretty('email')
176 176
 						),
177 177
 						__FILE__, __FUNCTION__, __LINE__
178 178
 					);
179 179
 				}
180
-			}else{
180
+			} else {
181 181
 				//that's actually pretty ok. The IPN just wasn't able
182 182
 				//to identify which transaction or payment method this was for
183 183
 				// give all active payment methods a chance to claim it
184 184
 				$active_pms = EEM_Payment_Method::instance()->get_all_active();
185
-				foreach( $active_pms as $payment_method ){
186
-					try{
187
-						$payment = $payment_method->type_obj()->handle_unclaimed_ipn( $_req_data );
185
+				foreach ($active_pms as $payment_method) {
186
+					try {
187
+						$payment = $payment_method->type_obj()->handle_unclaimed_ipn($_req_data);
188 188
 						EEM_Change_Log::instance()->log(EEM_Change_Log::type_gateway, array('IPN data'=>$_req_data), $payment);
189 189
 						break;
190
-					} catch( EE_Error $e ) {
190
+					} catch (EE_Error $e) {
191 191
 						//that's fine- it apparently couldn't handle the IPN
192 192
 					}
193 193
 				}
194 194
 
195 195
 			}
196 196
 // 			EEM_Payment_Log::instance()->log("got to 7",$transaction,$payment_method);
197
-			if( $payment instanceof EE_Payment){
197
+			if ($payment instanceof EE_Payment) {
198 198
 				$payment->save();
199 199
 				//  update the TXN
200
-				$this->update_txn_based_on_payment( $transaction, $payment, $update_txn, $separate_IPN_request );
201
-			}else{
200
+				$this->update_txn_based_on_payment($transaction, $payment, $update_txn, $separate_IPN_request);
201
+			} else {
202 202
 				//we couldn't find the payment for this IPN... let's try and log at least SOMETHING
203
-				if($payment_method){
203
+				if ($payment_method) {
204 204
 					EEM_Change_Log::instance()->log(EEM_Change_Log::type_gateway, array('IPN data'=>$_req_data), $payment_method);
205
-				}elseif($transaction){
205
+				}elseif ($transaction) {
206 206
 					EEM_Change_Log::instance()->log(EEM_Change_Log::type_gateway, array('IPN data'=>$_req_data), $transaction);
207 207
 				}
208 208
 			}
209 209
 			return $payment;
210 210
 
211
-		} catch( EE_Error $e ) {
211
+		} catch (EE_Error $e) {
212 212
 			do_action(
213 213
 				'AHEE__log', __FILE__, __FUNCTION__, sprintf(
214 214
 					"Error occurred while receiving IPN. Transaction: %s, req data: %s. The error was '%s'",
215
-					print_r( $transaction, TRUE ),
216
-					print_r( $_req_data, TRUE ),
215
+					print_r($transaction, TRUE),
216
+					print_r($_req_data, TRUE),
217 217
 					$e->getMessage()
218 218
 				)
219 219
 			);
@@ -227,14 +227,14 @@  discard block
 block discarded – undo
227 227
 	 * @param type $request_data
228 228
 	 * @return array|string
229 229
 	 */
230
-	protected function _remove_unusable_characters( $request_data ) {
231
-		if( is_array( $request_data ) ) {
230
+	protected function _remove_unusable_characters($request_data) {
231
+		if (is_array($request_data)) {
232 232
 			$return_data = array();
233
-			foreach( $request_data as $key => $value ) {
234
-				$return_data[ $this->_remove_unusable_characters( $key ) ] = $this->_remove_unusable_characters( $value );
233
+			foreach ($request_data as $key => $value) {
234
+				$return_data[$this->_remove_unusable_characters($key)] = $this->_remove_unusable_characters($value);
235 235
 			}
236
-		}else{
237
-			$return_data =  preg_replace('/[^[:print:]]/', '', $request_data);
236
+		} else {
237
+			$return_data = preg_replace('/[^[:print:]]/', '', $request_data);
238 238
 		}
239 239
 		return $return_data;
240 240
 	}
@@ -256,13 +256,13 @@  discard block
 block discarded – undo
256 256
 	 * @return EE_Payment
257 257
 	 * @deprecated 4.6.24 method is no longer used. Instead it is up to client code, like SPCO, to call handle_ipn() for offsite gateways that don't receive separate IPNs
258 258
 	 */
259
-	public function finalize_payment_for( $transaction, $update_txn = TRUE ){
259
+	public function finalize_payment_for($transaction, $update_txn = TRUE) {
260 260
 		/** @var $transaction EE_Transaction */
261
-		$transaction = EEM_Transaction::instance()->ensure_is_obj( $transaction );
261
+		$transaction = EEM_Transaction::instance()->ensure_is_obj($transaction);
262 262
 		$last_payment_method = $transaction->payment_method();
263
-		if ( $last_payment_method instanceof EE_Payment_Method ) {
264
-			$payment = $last_payment_method->type_obj()->finalize_payment_for( $transaction );
265
-			$this->update_txn_based_on_payment( $transaction, $payment, $update_txn );
263
+		if ($last_payment_method instanceof EE_Payment_Method) {
264
+			$payment = $last_payment_method->type_obj()->finalize_payment_for($transaction);
265
+			$this->update_txn_based_on_payment($transaction, $payment, $update_txn);
266 266
 			return $payment;
267 267
 		} else {
268 268
 			return NULL;
@@ -279,12 +279,12 @@  discard block
 block discarded – undo
279 279
 	 * @internal param float $amount
280 280
 	 * @return EE_Payment
281 281
 	 */
282
-	public function process_refund( $payment_method, $payment_to_refund, $refund_info = array() ){
282
+	public function process_refund($payment_method, $payment_to_refund, $refund_info = array()) {
283 283
 		/** @type EE_Payment_Method $payment_method */
284 284
 		$payment_method = EEM_Payment_Method::instance()->ensure_is_ID($payment_method);
285
-		if ( $payment_method->type_obj()->supports_sending_refunds() ) {
286
-			$payment_method->do_direct_refund( $payment_to_refund,$refund_info );
287
-			$this->update_txn_based_on_payment( $payment_to_refund->transaction(), $payment_to_refund );
285
+		if ($payment_method->type_obj()->supports_sending_refunds()) {
286
+			$payment_method->do_direct_refund($payment_to_refund, $refund_info);
287
+			$this->update_txn_based_on_payment($payment_to_refund->transaction(), $payment_to_refund);
288 288
 		}
289 289
 		return $payment_to_refund;
290 290
 	}
@@ -326,12 +326,12 @@  discard block
 block discarded – undo
326 326
 	 *                        TXN is locked before updating
327 327
 	 * @throws \EE_Error
328 328
 	 */
329
-	public function update_txn_based_on_payment( $transaction, $payment, $update_txn = true, $IPN = false ){
329
+	public function update_txn_based_on_payment($transaction, $payment, $update_txn = true, $IPN = false) {
330 330
 		$do_action = 'AHEE__EE_Payment_Processor__update_txn_based_on_payment__not_successful';
331 331
 		/** @type EE_Transaction $transaction */
332
-		$transaction = EEM_Transaction::instance()->ensure_is_obj( $transaction );
332
+		$transaction = EEM_Transaction::instance()->ensure_is_obj($transaction);
333 333
 		// can we freely update the TXN at this moment?
334
-		if ( $IPN && $transaction->is_locked() ) {
334
+		if ($IPN && $transaction->is_locked()) {
335 335
 			// don't update the transaction at this exact moment
336 336
 			// because the TXN is active in another request
337 337
 			EE_Cron_Tasks::schedule_update_transaction_with_payment(
@@ -341,39 +341,39 @@  discard block
 block discarded – undo
341 341
 			);
342 342
 		} else {
343 343
 			// verify payment and that it has been saved
344
-			if ( $payment instanceof EE_Payment && $payment->ID() ) {
345
-				if( $payment->payment_method() instanceof EE_Payment_Method && $payment->payment_method()->type_obj() instanceof EE_PMT_Base ){
346
-					$payment->payment_method()->type_obj()->update_txn_based_on_payment( $payment );
344
+			if ($payment instanceof EE_Payment && $payment->ID()) {
345
+				if ($payment->payment_method() instanceof EE_Payment_Method && $payment->payment_method()->type_obj() instanceof EE_PMT_Base) {
346
+					$payment->payment_method()->type_obj()->update_txn_based_on_payment($payment);
347 347
 					// update TXN registrations with payment info
348
-					$this->process_registration_payments( $transaction, $payment );
348
+					$this->process_registration_payments($transaction, $payment);
349 349
 				}
350 350
 				$do_action = $payment->just_approved() ? 'AHEE__EE_Payment_Processor__update_txn_based_on_payment__successful' : $do_action;
351 351
 			} else {
352 352
 				// send out notifications
353
-				add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true' );
353
+				add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true');
354 354
 				$do_action = 'AHEE__EE_Payment_Processor__update_txn_based_on_payment__no_payment_made';
355 355
 			}
356 356
 			// if this is an IPN, then we want to know the initial TXN status prior to updating the TXN
357 357
 			// so that we know whether the status has changed and notifications should be triggered
358
-			if ( $IPN ) {
358
+			if ($IPN) {
359 359
 				/** @type EE_Transaction_Processor $transaction_processor */
360
-				$transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' );
361
-				$transaction_processor->set_old_txn_status( $transaction->status_ID() );
360
+				$transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor');
361
+				$transaction_processor->set_old_txn_status($transaction->status_ID());
362 362
 			}
363
-			if ( $payment->status() !== EEM_Payment::status_id_failed ) {
363
+			if ($payment->status() !== EEM_Payment::status_id_failed) {
364 364
 				/** @type EE_Transaction_Payments $transaction_payments */
365
-				$transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' );
365
+				$transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments');
366 366
 				// set new value for total paid
367
-				$transaction_payments->calculate_total_payments_and_update_status( $transaction );
367
+				$transaction_payments->calculate_total_payments_and_update_status($transaction);
368 368
 				// call EE_Transaction_Processor::update_transaction_and_registrations_after_checkout_or_payment() ???
369
-				if ( $update_txn ) {
370
-					$this->_post_payment_processing( $transaction, $payment, $IPN );
369
+				if ($update_txn) {
370
+					$this->_post_payment_processing($transaction, $payment, $IPN);
371 371
 				}
372 372
 			}
373 373
 			// granular hook for others to use.
374
-			do_action( $do_action, $transaction, $payment );
374
+			do_action($do_action, $transaction, $payment);
375 375
 			//global hook for others to use.
376
-			do_action( 'AHEE__EE_Payment_Processor__update_txn_based_on_payment', $transaction, $payment );
376
+			do_action('AHEE__EE_Payment_Processor__update_txn_based_on_payment', $transaction, $payment);
377 377
 		}
378 378
 	}
379 379
 
@@ -387,25 +387,25 @@  discard block
 block discarded – undo
387 387
 	 * @param EE_Registration[] $registrations
388 388
 	 * @throws \EE_Error
389 389
 	 */
390
-	public function process_registration_payments( EE_Transaction $transaction, EE_Payment $payment, $registrations = array() ) {
390
+	public function process_registration_payments(EE_Transaction $transaction, EE_Payment $payment, $registrations = array()) {
391 391
 		// only process if payment was successful
392
-		if ( $payment->status() !== EEM_Payment::status_id_approved ) {
392
+		if ($payment->status() !== EEM_Payment::status_id_approved) {
393 393
 			return;
394 394
 		}
395 395
 		//EEM_Registration::instance()->show_next_x_db_queries();
396
-		if ( empty( $registrations )) {
396
+		if (empty($registrations)) {
397 397
 			// find registrations with monies owing that can receive a payment
398
-			$registrations = $transaction->registrations( array(
398
+			$registrations = $transaction->registrations(array(
399 399
 				array(
400 400
 					// only these reg statuses can receive payments
401
-					'STS_ID'  => array( 'IN', EEM_Registration::reg_statuses_that_allow_payment() ),
402
-					'REG_final_price'  => array( '!=', 0 ),
403
-					'REG_final_price*' => array( '!=', 'REG_paid', true ),
401
+					'STS_ID'  => array('IN', EEM_Registration::reg_statuses_that_allow_payment()),
402
+					'REG_final_price'  => array('!=', 0),
403
+					'REG_final_price*' => array('!=', 'REG_paid', true),
404 404
 				)
405
-			) );
405
+			));
406 406
 		}
407 407
 		// still nothing ??!??
408
-		if ( empty( $registrations )) {
408
+		if (empty($registrations)) {
409 409
 			return;
410 410
 		}
411 411
 
@@ -418,18 +418,18 @@  discard block
 block discarded – undo
418 418
 
419 419
 		$refund = $payment->is_a_refund();
420 420
 		// how much is available to apply to registrations?
421
-		$available_payment_amount = abs( $payment->amount() );
421
+		$available_payment_amount = abs($payment->amount());
422 422
 		//EEH_Debug_Tools::printr( $available_payment_amount, '$available_payment_amount', __FILE__, __LINE__ );
423
-		foreach ( $registrations as $registration ) {
424
-			if ( $registration instanceof EE_Registration ) {
423
+		foreach ($registrations as $registration) {
424
+			if ($registration instanceof EE_Registration) {
425 425
 				// nothing left?
426
-				if ( $available_payment_amount <= 0 ) {
426
+				if ($available_payment_amount <= 0) {
427 427
 					break;
428 428
 				}
429
-				if ( $refund ) {
430
-					$available_payment_amount = $this->process_registration_refund( $registration, $payment, $available_payment_amount );
429
+				if ($refund) {
430
+					$available_payment_amount = $this->process_registration_refund($registration, $payment, $available_payment_amount);
431 431
 				} else {
432
-					$available_payment_amount = $this->process_registration_payment( $registration, $payment, $available_payment_amount );
432
+					$available_payment_amount = $this->process_registration_payment($registration, $payment, $available_payment_amount);
433 433
 				}
434 434
 			}
435 435
 		}
@@ -445,19 +445,19 @@  discard block
 block discarded – undo
445 445
 	 * @param float $available_payment_amount
446 446
 	 * @return float
447 447
 	 */
448
-	public function process_registration_payment( EE_Registration $registration, EE_Payment $payment, $available_payment_amount = 0.00 ) {
448
+	public function process_registration_payment(EE_Registration $registration, EE_Payment $payment, $available_payment_amount = 0.00) {
449 449
 		$owing = $registration->final_price() - $registration->paid();
450 450
 		//EEH_Debug_Tools::printr( $owing, '$owing', __FILE__, __LINE__ );
451 451
 		//EEH_Debug_Tools::printr( $payment->amount(), '$payment->amount()', __FILE__, __LINE__ );
452
-		if ( $owing > 0 ) {
452
+		if ($owing > 0) {
453 453
 			// don't allow payment amount to exceed the available payment amount, OR the amount owing
454
-			$payment_amount = min( $available_payment_amount, $owing );
454
+			$payment_amount = min($available_payment_amount, $owing);
455 455
 			// update $available_payment_amount
456 456
 			$available_payment_amount = $available_payment_amount - $payment_amount;
457 457
 			//calculate and set new REG_paid
458
-			$registration->set_paid( $registration->paid() + $payment_amount );
458
+			$registration->set_paid($registration->paid() + $payment_amount);
459 459
 			// now save it
460
-			$this->_apply_registration_payment( $registration, $payment, $payment_amount );
460
+			$this->_apply_registration_payment($registration, $payment, $payment_amount);
461 461
 		}
462 462
 		return $available_payment_amount;
463 463
 	}
@@ -472,19 +472,19 @@  discard block
 block discarded – undo
472 472
 	 * @param float $payment_amount
473 473
 	 * @return float
474 474
 	 */
475
-	protected function _apply_registration_payment( EE_Registration $registration, EE_Payment $payment, $payment_amount = 0.00 ) {
475
+	protected function _apply_registration_payment(EE_Registration $registration, EE_Payment $payment, $payment_amount = 0.00) {
476 476
 		// find any existing reg payment records for this registration and payment
477 477
 		$existing_reg_payment = EEM_Registration_Payment::instance()->get_one(
478
-			array( array( 'REG_ID' => $registration->ID(), 'PAY_ID' => $payment->ID() ) )
478
+			array(array('REG_ID' => $registration->ID(), 'PAY_ID' => $payment->ID()))
479 479
 		);
480 480
 		// if existing registration payment exists
481
-		if ( $existing_reg_payment instanceof EE_Registration_Payment ) {
481
+		if ($existing_reg_payment instanceof EE_Registration_Payment) {
482 482
 			// then update that record
483
-			$existing_reg_payment->set_amount( $payment_amount );
483
+			$existing_reg_payment->set_amount($payment_amount);
484 484
 			$existing_reg_payment->save();
485 485
 		} else {
486 486
 			// or add new relation between registration and payment and set amount
487
-			$registration->_add_relation_to( $payment, 'Payment', array( 'RPY_amount' => $payment_amount ) );
487
+			$registration->_add_relation_to($payment, 'Payment', array('RPY_amount' => $payment_amount));
488 488
 			// make it stick
489 489
 			$registration->save();
490 490
 		}
@@ -500,21 +500,21 @@  discard block
 block discarded – undo
500 500
 	 * @param float $available_refund_amount - IMPORTANT !!! SEND AVAILABLE REFUND AMOUNT AS A POSITIVE NUMBER
501 501
 	 * @return float
502 502
 	 */
503
-	public function process_registration_refund( EE_Registration $registration, EE_Payment $payment, $available_refund_amount = 0.00 ) {
503
+	public function process_registration_refund(EE_Registration $registration, EE_Payment $payment, $available_refund_amount = 0.00) {
504 504
 		//EEH_Debug_Tools::printr( $payment->amount(), '$payment->amount()', __FILE__, __LINE__ );
505
-		if ( $registration->paid() > 0 ) {
505
+		if ($registration->paid() > 0) {
506 506
 			// ensure $available_refund_amount is NOT negative
507
-			$available_refund_amount = abs( $available_refund_amount );
507
+			$available_refund_amount = abs($available_refund_amount);
508 508
 			// don't allow refund amount to exceed the available payment amount, OR the amount paid
509
-			$refund_amount = min( $available_refund_amount, $registration->paid() );
509
+			$refund_amount = min($available_refund_amount, $registration->paid());
510 510
 			// update $available_payment_amount
511 511
 			$available_refund_amount = $available_refund_amount - $refund_amount;
512 512
 			//calculate and set new REG_paid
513
-			$registration->set_paid( $registration->paid() - $refund_amount );
513
+			$registration->set_paid($registration->paid() - $refund_amount);
514 514
 			// convert payment amount back to a negative value for storage in the db
515
-			$refund_amount = abs( $refund_amount ) * -1;
515
+			$refund_amount = abs($refund_amount) * -1;
516 516
 			// now save it
517
-			$this->_apply_registration_payment( $registration, $payment, $refund_amount );
517
+			$this->_apply_registration_payment($registration, $payment, $refund_amount);
518 518
 		}
519 519
 		return $available_refund_amount;
520 520
 	}
@@ -532,12 +532,12 @@  discard block
 block discarded – undo
532 532
 	 * @param EE_Payment     $payment
533 533
 	 * @param bool           $IPN
534 534
 	 */
535
-	protected function _post_payment_processing( EE_Transaction $transaction, EE_Payment $payment, $IPN = false ) {
535
+	protected function _post_payment_processing(EE_Transaction $transaction, EE_Payment $payment, $IPN = false) {
536 536
 
537 537
 		/** @type EE_Transaction_Processor $transaction_processor */
538
-		$transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' );
538
+		$transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor');
539 539
 		// is the Payment Options Reg Step completed ?
540
-		$payment_options_step_completed = $transaction_processor->reg_step_completed( $transaction, 'payment_options' );
540
+		$payment_options_step_completed = $transaction_processor->reg_step_completed($transaction, 'payment_options');
541 541
 		// DEBUG LOG
542 542
 		//$this->log(
543 543
 		//	__CLASS__, __FUNCTION__, __LINE__,
@@ -550,14 +550,14 @@  discard block
 block discarded – undo
550 550
 		// if the Payment Options Reg Step is completed...
551 551
 		$revisit = $payment_options_step_completed === true ? true : false;
552 552
 		// then this is kinda sorta a revisit with regards to payments at least
553
-		$transaction_processor->set_revisit( $revisit );
553
+		$transaction_processor->set_revisit($revisit);
554 554
 		// if this is an IPN, let's consider the Payment Options Reg Step completed if not already
555 555
 		if (
556 556
 			$IPN &&
557 557
 			$payment_options_step_completed !== true &&
558
-			( $payment->is_approved() || $payment->is_pending() )
558
+			($payment->is_approved() || $payment->is_pending())
559 559
 		) {
560
-			$payment_options_step_completed = $transaction_processor->set_reg_step_completed( $transaction, 'payment_options' );
560
+			$payment_options_step_completed = $transaction_processor->set_reg_step_completed($transaction, 'payment_options');
561 561
 		}
562 562
 		// DEBUG LOG
563 563
 		//$this->log(
@@ -569,11 +569,11 @@  discard block
 block discarded – undo
569 569
 		//	)
570 570
 		//);
571 571
 		/** @type EE_Transaction_Payments $transaction_payments */
572
-		$transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' );
572
+		$transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments');
573 573
 		// maybe update status, but don't save transaction just yet
574
-		$transaction_payments->update_transaction_status_based_on_total_paid( $transaction, false );
574
+		$transaction_payments->update_transaction_status_based_on_total_paid($transaction, false);
575 575
 		// check if 'finalize_registration' step has been completed...
576
-		$finalized = $transaction_processor->reg_step_completed( $transaction, 'finalize_registration' );
576
+		$finalized = $transaction_processor->reg_step_completed($transaction, 'finalize_registration');
577 577
 		// DEBUG LOG
578 578
 		//$this->log(
579 579
 		//	__CLASS__, __FUNCTION__, __LINE__,
@@ -584,9 +584,9 @@  discard block
 block discarded – undo
584 584
 		//	)
585 585
 		//);
586 586
 		//  if this is an IPN and the final step has not been initiated
587
-		if ( $IPN && $payment_options_step_completed && $finalized === false ) {
587
+		if ($IPN && $payment_options_step_completed && $finalized === false) {
588 588
 			// and if it hasn't already been set as being started...
589
-			$finalized = $transaction_processor->set_reg_step_initiated( $transaction, 'finalize_registration' );
589
+			$finalized = $transaction_processor->set_reg_step_initiated($transaction, 'finalize_registration');
590 590
 			// DEBUG LOG
591 591
 			//$this->log(
592 592
 			//	__CLASS__, __FUNCTION__, __LINE__,
@@ -599,13 +599,13 @@  discard block
 block discarded – undo
599 599
 		}
600 600
 		$transaction->save();
601 601
 		// because the above will return false if the final step was not fully completed, we need to check again...
602
-		if ( $IPN && $finalized !== false ) {
602
+		if ($IPN && $finalized !== false) {
603 603
 			// and if we are all good to go, then send out notifications
604
-			add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true' );
604
+			add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true');
605 605
 			// DEBUG LOG
606 606
 			//$this->log( __CLASS__, __FUNCTION__, __LINE__, $transaction );
607 607
 			//ok, now process the transaction according to the payment
608
-			$transaction_processor->update_transaction_and_registrations_after_checkout_or_payment( $transaction, $payment );
608
+			$transaction_processor->update_transaction_and_registrations_after_checkout_or_payment($transaction, $payment);
609 609
 		}
610 610
 		// DEBUG LOG
611 611
 		//$this->log(
Please login to merge, or discard this patch.
core/EE_Session.core.php 4 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -137,11 +137,11 @@
 block discarded – undo
137 137
 
138 138
 
139 139
 	/**
140
-	* 	private constructor to prevent direct creation
141
-	* 	@Constructor
142
-	* 	@access private
143
-	* 	@return EE_Session
144
-	*/
140
+	 * 	private constructor to prevent direct creation
141
+	 * 	@Constructor
142
+	 * 	@access private
143
+	 * 	@return EE_Session
144
+	 */
145 145
 	private function __construct() {
146 146
 
147 147
 		// session loading is turned ON by default, but prior to the init hook, can be turned back OFF via: add_filter( 'FHEE_load_EE_Session', '__return_false' );
Please login to merge, or discard this patch.
Doc Comments   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -327,7 +327,7 @@  discard block
 block discarded – undo
327 327
 	 /**
328 328
 	  * retrieve session data
329 329
 	  * @access    public
330
-	  * @param null $key
330
+	  * @param string|null $key
331 331
 	  * @param bool $reset_cache
332 332
 	  * @return    array
333 333
 	  */
@@ -351,7 +351,7 @@  discard block
 block discarded – undo
351 351
 	  * set session data
352 352
 	  * @access 	public
353 353
 	  * @param 	array $data
354
-	  * @return 	TRUE on success, FALSE on fail
354
+	  * @return 	boolean on success, FALSE on fail
355 355
 	  */
356 356
 	public function set_session_data( $data ) {
357 357
 
@@ -384,7 +384,7 @@  discard block
 block discarded – undo
384 384
 	/**
385 385
 	 *			@initiate session
386 386
 	 *		  @access private
387
-	 *			@return TRUE on success, FALSE on fail
387
+	 *			@return boolean on success, FALSE on fail
388 388
 	 */
389 389
 	private function _espresso_session() {
390 390
 
@@ -475,7 +475,7 @@  discard block
 block discarded – undo
475 475
 	  * @update session data  prior to saving to the db
476 476
 	  * @access public
477 477
 	  * @param bool $new_session
478
-	  * @return TRUE on success, FALSE on fail
478
+	  * @return boolean on success, FALSE on fail
479 479
 	  */
480 480
 	public function update( $new_session = FALSE ) {
481 481
 		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
@@ -585,7 +585,7 @@  discard block
 block discarded – undo
585 585
 	/**
586 586
 	 * 	@attempt to get IP address of current visitor from server
587 587
 	 * 	@access public
588
-	 * 	@return string
588
+	 * 	@return boolean
589 589
 	 */
590 590
 	private function _save_session_to_db() {
591 591
 		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
@@ -739,7 +739,7 @@  discard block
 block discarded – undo
739 739
 	  * @access public
740 740
 	  * @param array $data_to_reset
741 741
 	  * @param bool  $show_all_notices
742
-	  * @return TRUE on success, FALSE on fail
742
+	  * @return boolean on success, FALSE on fail
743 743
 	  */
744 744
 	public function reset_data( $data_to_reset = array(), $show_all_notices = FALSE ) {
745 745
 		// if $data_to_reset is not in an array, then put it in one
Please login to merge, or discard this patch.
Spacing   +133 added lines, -133 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
2
-do_action( 'AHEE_log', __FILE__, ' FILE LOADED', '' );
2
+do_action('AHEE_log', __FILE__, ' FILE LOADED', '');
3 3
 /**
4 4
  *
5 5
  * Event Espresso
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 	  * array for defining default session vars
97 97
 	  * @var array
98 98
 	  */
99
-	 private $_default_session_vars = array (
99
+	 private $_default_session_vars = array(
100 100
 		'id' => NULL,
101 101
 		'user_id' => NULL,
102 102
 		'ip_address' => NULL,
@@ -118,9 +118,9 @@  discard block
 block discarded – undo
118 118
 	 *		@access public
119 119
 	 *		@return EE_Session
120 120
 	 */
121
-	public static function instance ( ) {
121
+	public static function instance( ) {
122 122
 		// check if class object is instantiated
123
-		if ( ! self::$_instance instanceof EE_Session ) {
123
+		if ( ! self::$_instance instanceof EE_Session) {
124 124
 			self::$_instance = new self();
125 125
 		}
126 126
 		return self::$_instance;
@@ -137,11 +137,11 @@  discard block
 block discarded – undo
137 137
 	private function __construct() {
138 138
 
139 139
 		// session loading is turned ON by default, but prior to the init hook, can be turned back OFF via: add_filter( 'FHEE_load_EE_Session', '__return_false' );
140
-		if ( ! apply_filters( 'FHEE_load_EE_Session', TRUE ) ) {
140
+		if ( ! apply_filters('FHEE_load_EE_Session', TRUE)) {
141 141
 			return NULL;
142 142
 		}
143
-		do_action( 'AHEE_log', __CLASS__, __FUNCTION__, 'instantiated' );
144
-		define( 'ESPRESSO_SESSION', TRUE );
143
+		do_action('AHEE_log', __CLASS__, __FUNCTION__, 'instantiated');
144
+		define('ESPRESSO_SESSION', TRUE);
145 145
 		// default session lifespan in seconds
146 146
 		$this->_lifespan = apply_filters(
147 147
 			'FHEE__EE_Session__construct___lifespan',
@@ -154,35 +154,35 @@  discard block
 block discarded – undo
154 154
 		 * 		}
155 155
 		 */
156 156
 		// retrieve session options from db
157
-		$session_settings = get_option( 'ee_session_settings' );
158
-		if ( $session_settings !== FALSE ) {
157
+		$session_settings = get_option('ee_session_settings');
158
+		if ($session_settings !== FALSE) {
159 159
 			// cycle though existing session options
160
-			foreach ( $session_settings as $var_name => $session_setting ) {
160
+			foreach ($session_settings as $var_name => $session_setting) {
161 161
 				// set values for class properties
162 162
 				$this->_{$var_name} = $session_setting;
163 163
 			}
164 164
 		}
165 165
 		// are we using encryption?
166
-		if ( $this->_use_encryption ) {
166
+		if ($this->_use_encryption) {
167 167
 			// instantiate the class object making all properties and methods accessible via $this->encryption ex: $this->encryption->encrypt();
168
-			$this->encryption = EE_Registry::instance()->load_core( 'Encryption' );
168
+			$this->encryption = EE_Registry::instance()->load_core('Encryption');
169 169
 		}
170 170
 		// filter hook allows outside functions/classes/plugins to change default empty cart
171
-		$extra_default_session_vars = apply_filters( 'FHEE__EE_Session__construct__extra_default_session_vars', array() );
172
-		array_merge( $this->_default_session_vars, $extra_default_session_vars );
171
+		$extra_default_session_vars = apply_filters('FHEE__EE_Session__construct__extra_default_session_vars', array());
172
+		array_merge($this->_default_session_vars, $extra_default_session_vars);
173 173
 		// apply default session vars
174 174
 		$this->_set_defaults();
175 175
 		// check for existing session and retrieve it from db
176
-		if ( ! $this->_espresso_session() ) {
176
+		if ( ! $this->_espresso_session()) {
177 177
 			// or just start a new one
178 178
 			$this->_create_espresso_session();
179 179
 		}
180 180
 
181 181
 		// check request for 'clear_session' param
182
-		add_action( 'AHEE__EE_Request_Handler__construct__complete', array( $this, 'wp_loaded' ));
182
+		add_action('AHEE__EE_Request_Handler__construct__complete', array($this, 'wp_loaded'));
183 183
 		// once everything is all said and done,
184
-		add_action( 'shutdown', array( $this, 'update' ), 100 );
185
-		add_action( 'shutdown', array( $this, 'garbage_collection' ), 999 );
184
+		add_action('shutdown', array($this, 'update'), 100);
185
+		add_action('shutdown', array($this, 'garbage_collection'), 999);
186 186
 
187 187
 	}
188 188
 
@@ -214,11 +214,11 @@  discard block
 block discarded – undo
214 214
 	 */
215 215
 	private function _set_defaults() {
216 216
 		// set some defaults
217
-		foreach ( $this->_default_session_vars as $key => $default_var ) {
218
-			if ( is_array( $default_var )) {
219
-				$this->_session_data[ $key ] = array();
217
+		foreach ($this->_default_session_vars as $key => $default_var) {
218
+			if (is_array($default_var)) {
219
+				$this->_session_data[$key] = array();
220 220
 			} else {
221
-				$this->_session_data[ $key ] = '';
221
+				$this->_session_data[$key] = '';
222 222
 			}
223 223
 		}
224 224
 	}
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
 	  * @param \EE_Cart $cart
241 241
 	  * @return bool
242 242
 	  */
243
-	 public function set_cart( EE_Cart $cart ) {
243
+	 public function set_cart(EE_Cart $cart) {
244 244
 		 $this->_session_data['cart'] = $cart;
245 245
 		 return TRUE;
246 246
 	 }
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
 	  * @return \EE_Cart
261 261
 	  */
262 262
 	 public function cart() {
263
-		 return isset( $this->_session_data['cart'] ) ? $this->_session_data['cart'] : NULL;
263
+		 return isset($this->_session_data['cart']) ? $this->_session_data['cart'] : NULL;
264 264
 	 }
265 265
 
266 266
 
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
 	  * @param \EE_Checkout $checkout
270 270
 	  * @return bool
271 271
 	  */
272
-	 public function set_checkout( EE_Checkout $checkout ) {
272
+	 public function set_checkout(EE_Checkout $checkout) {
273 273
 		 $this->_session_data['checkout'] = $checkout;
274 274
 		 return TRUE;
275 275
 	 }
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
 	  * @return \EE_Checkout
290 290
 	  */
291 291
 	 public function checkout() {
292
-		 return isset( $this->_session_data['checkout'] ) ? $this->_session_data['checkout'] : NULL;
292
+		 return isset($this->_session_data['checkout']) ? $this->_session_data['checkout'] : NULL;
293 293
 	 }
294 294
 
295 295
 
@@ -298,9 +298,9 @@  discard block
 block discarded – undo
298 298
 	  * @param \EE_Transaction $transaction
299 299
 	  * @return bool
300 300
 	  */
301
-	 public function set_transaction( EE_Transaction $transaction ) {
301
+	 public function set_transaction(EE_Transaction $transaction) {
302 302
 		 // first remove the session from the transaction before we save the transaction in the session
303
-		 $transaction->set_txn_session_data( NULL );
303
+		 $transaction->set_txn_session_data(NULL);
304 304
 		 $this->_session_data['transaction'] = $transaction;
305 305
 		 return TRUE;
306 306
 	 }
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
 	  * @return \EE_Transaction
321 321
 	  */
322 322
 	 public function transaction() {
323
-		 return isset( $this->_session_data['transaction'] ) ? $this->_session_data['transaction'] : NULL;
323
+		 return isset($this->_session_data['transaction']) ? $this->_session_data['transaction'] : NULL;
324 324
 	 }
325 325
 
326 326
 
@@ -332,15 +332,15 @@  discard block
 block discarded – undo
332 332
 	  * @param bool $reset_cache
333 333
 	  * @return    array
334 334
 	  */
335
-	public function get_session_data( $key = NULL, $reset_cache = FALSE ) {
336
-		if ( $reset_cache ) {
335
+	public function get_session_data($key = NULL, $reset_cache = FALSE) {
336
+		if ($reset_cache) {
337 337
 			$this->reset_cart();
338 338
 			$this->reset_checkout();
339 339
 			$this->reset_transaction();
340 340
 		}
341
-		 if ( ! empty( $key ))  {
342
-			return  isset( $this->_session_data[ $key ] ) ? $this->_session_data[ $key ] : NULL;
343
-		}  else  {
341
+		 if ( ! empty($key)) {
342
+			return  isset($this->_session_data[$key]) ? $this->_session_data[$key] : NULL;
343
+		} else {
344 344
 			return $this->_session_data;
345 345
 		}
346 346
 	}
@@ -353,20 +353,20 @@  discard block
 block discarded – undo
353 353
 	  * @param 	array $data
354 354
 	  * @return 	TRUE on success, FALSE on fail
355 355
 	  */
356
-	public function set_session_data( $data ) {
356
+	public function set_session_data($data) {
357 357
 
358 358
 		// nothing ??? bad data ??? go home!
359
-		if ( empty( $data ) || ! is_array( $data )) {
360
-			EE_Error::add_error( __( 'No session data or invalid session data was provided.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
359
+		if (empty($data) || ! is_array($data)) {
360
+			EE_Error::add_error(__('No session data or invalid session data was provided.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
361 361
 			return FALSE;
362 362
 		}
363 363
 
364
-		foreach ( $data as $key =>$value ) {
365
-			if ( isset( $this->_default_session_vars[ $key ] )) {
366
-				EE_Error::add_error( sprintf( __( 'Sorry! %s is a default session datum and can not be reset.', 'event_espresso' ), $key ), __FILE__, __FUNCTION__, __LINE__ );
364
+		foreach ($data as $key =>$value) {
365
+			if (isset($this->_default_session_vars[$key])) {
366
+				EE_Error::add_error(sprintf(__('Sorry! %s is a default session datum and can not be reset.', 'event_espresso'), $key), __FILE__, __FUNCTION__, __LINE__);
367 367
 				return FALSE;
368 368
 			} else {
369
-				$this->_session_data[ $key ] = $value;
369
+				$this->_session_data[$key] = $value;
370 370
 			}
371 371
 		}
372 372
 
@@ -386,46 +386,46 @@  discard block
 block discarded – undo
386 386
 	private function _espresso_session() {
387 387
 
388 388
 		// is the SID being passed explicitly ?
389
-		if ( isset( $_REQUEST['EESID'] )) {
390
-			session_id( sanitize_text_field( $_REQUEST['EESID'] ));
389
+		if (isset($_REQUEST['EESID'])) {
390
+			session_id(sanitize_text_field($_REQUEST['EESID']));
391 391
 		}
392 392
 		// check that session has started
393
-		if ( session_id() === '' ) {
393
+		if (session_id() === '') {
394 394
 			//starts a new session if one doesn't already exist, or re-initiates an existing one
395 395
 			session_start();
396
-			do_action( 'AHEE_log', __CLASS__, __FUNCTION__, 'Session Start' );
396
+			do_action('AHEE_log', __CLASS__, __FUNCTION__, 'Session Start');
397 397
 		}
398 398
 		// grab the session ID
399 399
 		$this->_sid = session_id();
400
-		do_action( 'AHEE_log', __CLASS__, __FUNCTION__, 'SID='. $this->_sid );
400
+		do_action('AHEE_log', __CLASS__, __FUNCTION__, 'SID='.$this->_sid);
401 401
 		// and the visitors IP
402 402
 		$this->_ip_address = $this->_visitor_ip();
403 403
 		// set the "user agent"
404
-		$this->_user_agent = ( isset($_SERVER['HTTP_USER_AGENT'])) ? esc_attr( $_SERVER['HTTP_USER_AGENT'] ) : FALSE;
404
+		$this->_user_agent = (isset($_SERVER['HTTP_USER_AGENT'])) ? esc_attr($_SERVER['HTTP_USER_AGENT']) : FALSE;
405 405
 		// now let's retrieve what's in the db
406 406
 		// we're using WP's Transient API to store session data using the PHP session ID as the option name
407
-		$session_data = get_transient( 'ee_ssn_' . $this->_sid );
408
-		if ( $session_data ) {
407
+		$session_data = get_transient('ee_ssn_'.$this->_sid);
408
+		if ($session_data) {
409 409
 			// un-encrypt the data
410
-			$session_data = $this->_use_encryption ? $this->encryption->decrypt( $session_data ) : $session_data;
410
+			$session_data = $this->_use_encryption ? $this->encryption->decrypt($session_data) : $session_data;
411 411
 			// unserialize
412
-			$session_data = maybe_unserialize( $session_data );
412
+			$session_data = maybe_unserialize($session_data);
413 413
 			// just a check to make sure the session array is indeed an array
414
-			if ( ! is_array( $session_data ) ) {
414
+			if ( ! is_array($session_data)) {
415 415
 				// no?!?! then something is wrong
416 416
 				return FALSE;
417 417
 			}
418 418
 			// get the current time in UTC
419
-			$this->_time = isset( $this->_time ) ? $this->_time : time();
419
+			$this->_time = isset($this->_time) ? $this->_time : time();
420 420
 			// and reset the session expiration
421
-			$this->_expiration = isset( $session_data['expiration'] ) ?
421
+			$this->_expiration = isset($session_data['expiration']) ?
422 422
 				$session_data['expiration'] : $this->_time + $this->_lifespan;
423 423
 
424 424
 		} else {
425 425
 			// set initial site access time and the session expiration
426 426
 			$this->_set_init_access_and_expiration();
427 427
 			// set referer
428
-			$this->_session_data[ 'pages_visited' ][ $this->_session_data['init_access'] ] = isset( $_SERVER['HTTP_REFERER'] ) ? esc_attr( $_SERVER['HTTP_REFERER'] ) : '';
428
+			$this->_session_data['pages_visited'][$this->_session_data['init_access']] = isset($_SERVER['HTTP_REFERER']) ? esc_attr($_SERVER['HTTP_REFERER']) : '';
429 429
 			// no previous session = go back and create one (on top of the data above)
430 430
 			return FALSE;
431 431
 		}
@@ -433,22 +433,22 @@  discard block
 block discarded – undo
433 433
 		// have we met before???
434 434
 		// let's compare our stored session details with the current visitor
435 435
 		// first the ip address
436
-		if ( $session_data['ip_address'] != $this->_ip_address ) {
436
+		if ($session_data['ip_address'] != $this->_ip_address) {
437 437
 			return FALSE;
438 438
 		}
439 439
 		// now the user agent
440
-		if ( $session_data['user_agent'] != $this->_user_agent ) {
440
+		if ($session_data['user_agent'] != $this->_user_agent) {
441 441
 			return FALSE;
442 442
 		}
443 443
 		// wait a minute... how old are you?
444
-		if ( $this->_time > $this->_expiration ) {
445
-			do_action( 'AHEE_log', __CLASS__, __FUNCTION__, 'Session Expired' );
444
+		if ($this->_time > $this->_expiration) {
445
+			do_action('AHEE_log', __CLASS__, __FUNCTION__, 'Session Expired');
446 446
 			// yer too old fer me!
447 447
 			// wipe out everything that isn't a default session datum
448
-			$this->clear_session( __CLASS__, __FUNCTION__ );
448
+			$this->clear_session(__CLASS__, __FUNCTION__);
449 449
 		}
450 450
 		// make event espresso session data available to plugin
451
-		$this->_session_data = array_merge( $this->_session_data, $session_data );
451
+		$this->_session_data = array_merge($this->_session_data, $session_data);
452 452
 		return TRUE;
453 453
 
454 454
 	}
@@ -476,20 +476,20 @@  discard block
 block discarded – undo
476 476
 	  * @param bool $new_session
477 477
 	  * @return TRUE on success, FALSE on fail
478 478
 	  */
479
-	public function update( $new_session = FALSE ) {
479
+	public function update($new_session = FALSE) {
480 480
 
481
-		$this->_session_data = isset( $this->_session_data )
482
-			&& is_array( $this->_session_data )
483
-			&& isset( $this->_session_data['id'])
481
+		$this->_session_data = isset($this->_session_data)
482
+			&& is_array($this->_session_data)
483
+			&& isset($this->_session_data['id'])
484 484
 			? $this->_session_data
485 485
 			: NULL;
486
-		if ( empty( $this->_session_data )) {
486
+		if (empty($this->_session_data)) {
487 487
 			$this->_set_defaults();
488 488
 		}
489 489
 		$session_data = array();
490
-		foreach ( $this->_session_data as $key => $value ) {
490
+		foreach ($this->_session_data as $key => $value) {
491 491
 
492
-			switch( $key ) {
492
+			switch ($key) {
493 493
 
494 494
 				case 'id' :
495 495
 					// session ID
@@ -507,7 +507,7 @@  discard block
 block discarded – undo
507 507
 				break;
508 508
 
509 509
 				case 'init_access' :
510
-					$session_data['init_access'] = absint( $value );
510
+					$session_data['init_access'] = absint($value);
511 511
 				break;
512 512
 
513 513
 				case 'last_access' :
@@ -517,7 +517,7 @@  discard block
 block discarded – undo
517 517
 
518 518
 				case 'expiration' :
519 519
 					// when the session expires
520
-					$session_data['expiration'] = ! empty( $this->_expiration )
520
+					$session_data['expiration'] = ! empty($this->_expiration)
521 521
 						? $this->_expiration
522 522
 						: $session_data['init_access'] + $this->_lifespan;
523 523
 				break;
@@ -529,11 +529,11 @@  discard block
 block discarded – undo
529 529
 
530 530
 				case 'pages_visited' :
531 531
 					$page_visit = $this->_get_page_visit();
532
-					if ( $page_visit ) {
532
+					if ($page_visit) {
533 533
 						// set pages visited where the first will be the http referrer
534
-						$this->_session_data[ 'pages_visited' ][ $this->_time ] = $page_visit;
534
+						$this->_session_data['pages_visited'][$this->_time] = $page_visit;
535 535
 						// we'll only save the last 10 page visits.
536
-						$session_data[ 'pages_visited' ] = array_slice( $this->_session_data['pages_visited'], -10 );
536
+						$session_data['pages_visited'] = array_slice($this->_session_data['pages_visited'], -10);
537 537
 					}
538 538
 				break;
539 539
 
@@ -549,10 +549,10 @@  discard block
 block discarded – undo
549 549
 		$this->_session_data = $session_data;
550 550
 
551 551
 		// creating a new session does not require saving to the db just yet
552
-		if ( ! $new_session ) {
553
-			do_action( 'AHEE_log', __CLASS__, __FUNCTION__, 'Session Updated' );
552
+		if ( ! $new_session) {
553
+			do_action('AHEE_log', __CLASS__, __FUNCTION__, 'Session Updated');
554 554
 			// ready? let's save
555
-			if ( $this->_save_session_to_db() ) {
555
+			if ($this->_save_session_to_db()) {
556 556
 				return TRUE;
557 557
 			} else {
558 558
 				return FALSE;
@@ -573,9 +573,9 @@  discard block
 block discarded – undo
573 573
 	 * 	@return bool
574 574
 	 */
575 575
 	private function _create_espresso_session( ) {
576
-		do_action( 'AHEE_log', __CLASS__, __FUNCTION__, 'Create New Session' );
576
+		do_action('AHEE_log', __CLASS__, __FUNCTION__, 'Create New Session');
577 577
 		// use the update function for now with $new_session arg set to TRUE
578
-		return  $this->update( TRUE ) ? TRUE : FALSE;
578
+		return  $this->update(TRUE) ? TRUE : FALSE;
579 579
 	}
580 580
 
581 581
 
@@ -598,11 +598,11 @@  discard block
 block discarded – undo
598 598
 			return FALSE;
599 599
 		}
600 600
 		// first serialize all of our session data
601
-		$session_data = serialize( $this->_session_data );
601
+		$session_data = serialize($this->_session_data);
602 602
 		// encrypt it if we are using encryption
603
-		$session_data = $this->_use_encryption ? $this->encryption->encrypt( $session_data ) : $session_data;
603
+		$session_data = $this->_use_encryption ? $this->encryption->encrypt($session_data) : $session_data;
604 604
 		// we're using the Transient API for storing session data, cuz it's so damn simple -> set_transient(  transient ID, data, expiry )
605
-		return set_transient( 'ee_ssn_' . $this->_sid, $session_data, $this->_lifespan ) ? TRUE : FALSE;
605
+		return set_transient('ee_ssn_'.$this->_sid, $session_data, $this->_lifespan) ? TRUE : FALSE;
606 606
 
607 607
 	}
608 608
 
@@ -627,10 +627,10 @@  discard block
 block discarded – undo
627 627
 			'HTTP_FORWARDED',
628 628
 			'REMOTE_ADDR'
629 629
 		);
630
-		foreach ( $server_keys as $key ){
631
-			if ( isset( $_SERVER[ $key ] )) {
632
-				foreach ( array_map( 'trim', explode( ',', $_SERVER[ $key ] )) as $ip ) {
633
-					if ( $ip === '127.0.0.1' || filter_var( $ip, FILTER_VALIDATE_IP ) !== FALSE ) {
630
+		foreach ($server_keys as $key) {
631
+			if (isset($_SERVER[$key])) {
632
+				foreach (array_map('trim', explode(',', $_SERVER[$key])) as $ip) {
633
+					if ($ip === '127.0.0.1' || filter_var($ip, FILTER_VALIDATE_IP) !== FALSE) {
634 634
 						$visitor_ip = $ip;
635 635
 					}
636 636
 				}
@@ -650,45 +650,45 @@  discard block
 block discarded – undo
650 650
 	 */
651 651
 	public function _get_page_visit() {
652 652
 
653
-		$page_visit = home_url('/') . 'wp-admin/admin-ajax.php';
653
+		$page_visit = home_url('/').'wp-admin/admin-ajax.php';
654 654
 
655 655
 		// check for request url
656
-		if ( isset( $_SERVER['REQUEST_URI'] )) {
656
+		if (isset($_SERVER['REQUEST_URI'])) {
657 657
 
658
-			$request_uri = esc_url( $_SERVER['REQUEST_URI'] );
658
+			$request_uri = esc_url($_SERVER['REQUEST_URI']);
659 659
 
660
-			$ru_bits = explode( '?', $request_uri );
660
+			$ru_bits = explode('?', $request_uri);
661 661
 			$request_uri = $ru_bits[0];
662 662
 			//echo '<h1>$request_uri   ' . $request_uri . '</h1>';
663 663
 
664 664
 			// check for and grab host as well
665
-			if ( isset( $_SERVER['HTTP_HOST'] )) {
666
-				$http_host = esc_url( $_SERVER['HTTP_HOST'] );
665
+			if (isset($_SERVER['HTTP_HOST'])) {
666
+				$http_host = esc_url($_SERVER['HTTP_HOST']);
667 667
 			} else {
668 668
 				$http_host = '';
669 669
 			}
670 670
 			//echo '<h1>$http_host   ' . $http_host . '</h1>';
671 671
 
672 672
 			// check for page_id in SERVER REQUEST
673
-			if ( isset( $_REQUEST['page_id'] )) {
673
+			if (isset($_REQUEST['page_id'])) {
674 674
 				// rebuild $e_reg without any of the extra parameters
675
-				$page_id = '?page_id=' . esc_attr( $_REQUEST['page_id'] ) . '&amp;';
675
+				$page_id = '?page_id='.esc_attr($_REQUEST['page_id']).'&amp;';
676 676
 			} else {
677 677
 				$page_id = '?';
678 678
 			}
679 679
 			// check for $e_reg in SERVER REQUEST
680
-			if ( isset( $_REQUEST['ee'] )) {
680
+			if (isset($_REQUEST['ee'])) {
681 681
 				// rebuild $e_reg without any of the extra parameters
682
-				$e_reg = 'ee=' . esc_attr( $_REQUEST['ee'] );
682
+				$e_reg = 'ee='.esc_attr($_REQUEST['ee']);
683 683
 			} else {
684 684
 				$e_reg = '';
685 685
 			}
686 686
 
687
-			$page_visit = rtrim( $http_host . $request_uri . $page_id . $e_reg, '?' );
687
+			$page_visit = rtrim($http_host.$request_uri.$page_id.$e_reg, '?');
688 688
 
689 689
 		}
690 690
 
691
-		return $page_visit != home_url( '/wp-admin/admin-ajax.php' ) ? $page_visit : '';
691
+		return $page_visit != home_url('/wp-admin/admin-ajax.php') ? $page_visit : '';
692 692
 
693 693
 	}
694 694
 
@@ -717,13 +717,13 @@  discard block
 block discarded – undo
717 717
 	  * @param string $function
718 718
 	  * @return void
719 719
 	  */
720
-	public function clear_session( $class = '', $function = '' ) {
721
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, 'session cleared by : ' . $class . '::' .  $function . '()' );
720
+	public function clear_session($class = '', $function = '') {
721
+		do_action('AHEE_log', __FILE__, __FUNCTION__, 'session cleared by : '.$class.'::'.$function.'()');
722 722
 		$this->reset_cart();
723 723
 		$this->reset_checkout();
724 724
 		$this->reset_transaction();
725 725
 		// wipe out everything that isn't a default session datum
726
-		$this->reset_data( array_keys( $this->_session_data ));
726
+		$this->reset_data(array_keys($this->_session_data));
727 727
 		// reset initial site access time and the session expiration
728 728
 		$this->_set_init_access_and_expiration();
729 729
 	}
@@ -737,42 +737,42 @@  discard block
 block discarded – undo
737 737
 	  * @param bool  $show_all_notices
738 738
 	  * @return TRUE on success, FALSE on fail
739 739
 	  */
740
-	public function reset_data( $data_to_reset = array(), $show_all_notices = FALSE ) {
740
+	public function reset_data($data_to_reset = array(), $show_all_notices = FALSE) {
741 741
 		// if $data_to_reset is not in an array, then put it in one
742
-		if ( ! is_array( $data_to_reset ) ) {
743
-			$data_to_reset = array ( $data_to_reset );
742
+		if ( ! is_array($data_to_reset)) {
743
+			$data_to_reset = array($data_to_reset);
744 744
 		}
745 745
 		// nothing ??? go home!
746
-		if ( empty( $data_to_reset )) {
747
-			EE_Error::add_error( __( 'No session data could be reset, because no session var name was provided.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
746
+		if (empty($data_to_reset)) {
747
+			EE_Error::add_error(__('No session data could be reset, because no session var name was provided.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
748 748
 			return FALSE;
749 749
 		}
750 750
 		$return_value = TRUE;
751 751
 		// since $data_to_reset is an array, cycle through the values
752
-		foreach ( $data_to_reset as $reset ) {
752
+		foreach ($data_to_reset as $reset) {
753 753
 
754 754
 			// first check to make sure it is a valid session var
755
-			if ( isset( $this->_session_data[ $reset ] )) {
755
+			if (isset($this->_session_data[$reset])) {
756 756
 				// then check to make sure it is not a default var
757
-				if ( ! array_key_exists( $reset, $this->_default_session_vars )) {
757
+				if ( ! array_key_exists($reset, $this->_default_session_vars)) {
758 758
 					// remove session var
759
-					unset( $this->_session_data[ $reset ] );
760
-					if ( $show_all_notices ) {
761
-						EE_Error::add_success( sprintf( __( 'The session variable %s was removed.', 'event_espresso' ), $reset ), __FILE__, __FUNCTION__, __LINE__ );
759
+					unset($this->_session_data[$reset]);
760
+					if ($show_all_notices) {
761
+						EE_Error::add_success(sprintf(__('The session variable %s was removed.', 'event_espresso'), $reset), __FILE__, __FUNCTION__, __LINE__);
762 762
 					}
763
-					$return_value = !isset($return_value) ? TRUE : $return_value;
763
+					$return_value = ! isset($return_value) ? TRUE : $return_value;
764 764
 
765 765
 				} else {
766 766
 					// yeeeeeeeeerrrrrrrrrrr OUT !!!!
767
-					if ( $show_all_notices ) {
768
-						EE_Error::add_error( sprintf( __( 'Sorry! %s is a default session datum and can not be reset.', 'event_espresso' ), $reset ), __FILE__, __FUNCTION__, __LINE__ );
767
+					if ($show_all_notices) {
768
+						EE_Error::add_error(sprintf(__('Sorry! %s is a default session datum and can not be reset.', 'event_espresso'), $reset), __FILE__, __FUNCTION__, __LINE__);
769 769
 					}
770 770
 					$return_value = FALSE;
771 771
 				}
772 772
 
773
-			} else if ( $show_all_notices ) {
773
+			} else if ($show_all_notices) {
774 774
 				// oops! that session var does not exist!
775
-				EE_Error::add_error( sprintf( __( 'The session item provided, %s, is invalid or does not exist.', 'event_espresso' ), $reset ), __FILE__, __FUNCTION__, __LINE__ );
775
+				EE_Error::add_error(sprintf(__('The session item provided, %s, is invalid or does not exist.', 'event_espresso'), $reset), __FILE__, __FUNCTION__, __LINE__);
776 776
 				$return_value = FALSE;
777 777
 			}
778 778
 
@@ -793,8 +793,8 @@  discard block
 block discarded – undo
793 793
 	 *   @return	 string
794 794
 	 */
795 795
 	public function wp_loaded() {
796
-		if ( isset(  EE_Registry::instance()->REQ ) && EE_Registry::instance()->REQ->is_set( 'clear_session' )) {
797
-			$this->clear_session( __CLASS__, __FUNCTION__ );
796
+		if (isset(EE_Registry::instance()->REQ) && EE_Registry::instance()->REQ->is_set('clear_session')) {
797
+			$this->clear_session(__CLASS__, __FUNCTION__);
798 798
 		}
799 799
 	}
800 800
 
@@ -819,16 +819,16 @@  discard block
 block discarded – undo
819 819
 	  */
820 820
 	 public function garbage_collection() {
821 821
 		 // only perform during regular requests
822
-		 if ( ! defined( 'DOING_AJAX') || ! DOING_AJAX ) {
822
+		 if ( ! defined('DOING_AJAX') || ! DOING_AJAX) {
823 823
 			 /** @type WPDB $wpdb */
824 824
 			 global $wpdb;
825 825
 			 // since transient expiration timestamps are set in the future, we can compare against NOW
826 826
 			 $expiration = time();
827
-			 $too_far_in_the_the_future = $expiration + ( $this->_lifespan * 2 );
827
+			 $too_far_in_the_the_future = $expiration + ($this->_lifespan * 2);
828 828
 			 // filter the query limit. Set to 0 to turn off garbage collection
829
-			 $expired_session_transient_delete_query_limit = absint( apply_filters( 'FHEE__EE_Session__garbage_collection___expired_session_transient_delete_query_limit', 50 ));
829
+			 $expired_session_transient_delete_query_limit = absint(apply_filters('FHEE__EE_Session__garbage_collection___expired_session_transient_delete_query_limit', 50));
830 830
 			 // non-zero LIMIT means take out the trash
831
-			 if ( $expired_session_transient_delete_query_limit ) {
831
+			 if ($expired_session_transient_delete_query_limit) {
832 832
 				 $SQL = "
833 833
 					SELECT option_name
834 834
 					FROM {$wpdb->options}
@@ -838,29 +838,29 @@  discard block
 block discarded – undo
838 838
 					OR option_value > {$too_far_in_the_the_future} )
839 839
 					LIMIT {$expired_session_transient_delete_query_limit}
840 840
 				";
841
-				 $expired_sessions = $wpdb->get_col( $SQL );
841
+				 $expired_sessions = $wpdb->get_col($SQL);
842 842
 				 // valid results?
843
-				 if ( ! $expired_sessions instanceof WP_Error && ! empty( $expired_sessions )) {
843
+				 if ( ! $expired_sessions instanceof WP_Error && ! empty($expired_sessions)) {
844 844
 					 // format array of results into something usable within the actual DELETE query's IN clause
845 845
 					 $expired = array();
846
-					 foreach( $expired_sessions as $expired_session ) {
847
-						 $expired[] = "'" . $expired_session . "'";
848
-						 $expired[] = "'" . str_replace( 'timeout_', '', $expired_session ) . "'";
846
+					 foreach ($expired_sessions as $expired_session) {
847
+						 $expired[] = "'".$expired_session."'";
848
+						 $expired[] = "'".str_replace('timeout_', '', $expired_session)."'";
849 849
 					 }
850
-					 $expired = implode( ', ', $expired );
850
+					 $expired = implode(', ', $expired);
851 851
 					 $SQL = "
852 852
 						DELETE FROM {$wpdb->options}
853 853
 						WHERE option_name
854 854
 						IN ( $expired );
855 855
 					 ";
856
-					 $results = $wpdb->query( $SQL );
856
+					 $results = $wpdb->query($SQL);
857 857
 					 // if something went wrong, then notify the admin
858
-					 if ( $results instanceof WP_Error && is_admin() ) {
859
-						 EE_Error::add_error( $results->get_error_message(), __FILE__, __FUNCTION__, __LINE__ );
858
+					 if ($results instanceof WP_Error && is_admin()) {
859
+						 EE_Error::add_error($results->get_error_message(), __FILE__, __FUNCTION__, __LINE__);
860 860
 					 }
861
-					 do_action( 'AHEE_log', __CLASS__, __FUNCTION__, $results . ' expired sessions deleted' );
861
+					 do_action('AHEE_log', __CLASS__, __FUNCTION__, $results.' expired sessions deleted');
862 862
 				 }
863
-				 do_action( 'FHEE__EE_Session__garbage_collection___end', $expired_session_transient_delete_query_limit );
863
+				 do_action('FHEE__EE_Session__garbage_collection___end', $expired_session_transient_delete_query_limit);
864 864
 			 }
865 865
 		 }
866 866
 
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@  discard block
 block discarded – undo
1
-<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 do_action( 'AHEE_log', __FILE__, ' FILE LOADED', '' );
3 5
 /**
4 6
  *
@@ -340,7 +342,7 @@  discard block
 block discarded – undo
340 342
 		}
341 343
 		 if ( ! empty( $key ))  {
342 344
 			return  isset( $this->_session_data[ $key ] ) ? $this->_session_data[ $key ] : NULL;
343
-		}  else  {
345
+		} else  {
344 346
 			return $this->_session_data;
345 347
 		}
346 348
 	}
Please login to merge, or discard this patch.
core/EE_System.core.php 3 patches
Braces   +11 added lines, -9 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
  *
@@ -578,7 +580,7 @@  discard block
 block discarded – undo
578 580
 				$espresso_db_update =  array( $espresso_db_update=>array() );
579 581
 				update_option( 'espresso_db_update', $espresso_db_update );
580 582
 			}
581
-		}else{
583
+		} else{
582 584
 			$corrected_db_update = array();
583 585
 			//if IS an array, but is it an array where KEYS are version numbers, and values are arrays?
584 586
 			foreach($espresso_db_update as $should_be_version_string => $should_be_array){
@@ -588,7 +590,7 @@  discard block
 block discarded – undo
588 590
 					//fix it!
589 591
 					$version_string = $should_be_array;
590 592
 					$corrected_db_update[$version_string] = array('unknown-date');
591
-				}else{
593
+				} else{
592 594
 					//ok it checks out
593 595
 					$corrected_db_update[$should_be_version_string] = $should_be_array;
594 596
 				}
@@ -633,7 +635,7 @@  discard block
 block discarded – undo
633 635
 					$addon->initialize_db_if_no_migrations_required();
634 636
 				}
635 637
 			}
636
-		}else{
638
+		} else{
637 639
 			EE_Data_Migration_Manager::instance()->enqueue_db_initialization_for( 'Core' );
638 640
 		}
639 641
 		if ( $request_type == EE_System::req_type_new_activation || $request_type == EE_System::req_type_reactivation || $request_type == EE_System::req_type_upgrade ) {
@@ -703,7 +705,7 @@  discard block
 block discarded – undo
703 705
 				//it a version we haven't seen before
704 706
 				if( $version_is_higher === 1 ){
705 707
 					$req_type = EE_System::req_type_upgrade;
706
-				}else{
708
+				} else{
707 709
 					$req_type = EE_System::req_type_downgrade;
708 710
 				}
709 711
 				delete_option( $activation_indicator_option_name );
@@ -712,10 +714,10 @@  discard block
 block discarded – undo
712 714
 				if( get_option( $activation_indicator_option_name, FALSE ) ){
713 715
 					if ( $version_is_higher === -1 ){
714 716
 						$req_type = EE_System::req_type_downgrade;
715
-					}elseif( $version_is_higher === 0 ){
717
+					} elseif( $version_is_higher === 0 ){
716 718
 						//we've seen this version before, but it's an activation. must be a reactivation
717 719
 						$req_type = EE_System::req_type_reactivation;
718
-					}else{//$version_is_higher === 1
720
+					} else{//$version_is_higher === 1
719 721
 						$req_type = EE_System::req_type_upgrade;
720 722
 					}
721 723
 					delete_option( $activation_indicator_option_name );
@@ -723,10 +725,10 @@  discard block
 block discarded – undo
723 725
 					//we've seen this version before and the activation indicate doesn't show it was just activated
724 726
 					if ( $version_is_higher === -1 ){
725 727
 						$req_type = EE_System::req_type_downgrade;
726
-					}elseif( $version_is_higher === 0 ){
728
+					} elseif( $version_is_higher === 0 ){
727 729
 						//we've seen this version before and it's not an activation. its normal request
728 730
 						$req_type = EE_System::req_type_normal;
729
-					}else{//$version_is_higher === 1
731
+					} else{//$version_is_higher === 1
730 732
 						$req_type = EE_System::req_type_upgrade;
731 733
 					}
732 734
 				}
Please login to merge, or discard this patch.
Spacing   +331 added lines, -331 removed lines patch added patch discarded remove patch
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
 	 */
90 90
 	public static function instance() {
91 91
 		// check if class object is instantiated, and instantiated properly
92
-		if ( self::$_instance === NULL  or ! is_object( self::$_instance ) or ! ( self::$_instance instanceof  EE_System )) {
92
+		if (self::$_instance === NULL or ! is_object(self::$_instance) or ! (self::$_instance instanceof  EE_System)) {
93 93
 			self::$_instance = new self();
94 94
 		}
95 95
 		return self::$_instance;
@@ -98,12 +98,12 @@  discard block
 block discarded – undo
98 98
 	 * resets the instance and returns it
99 99
 	 * @return EE_System
100 100
 	 */
101
-	public static function reset(){
101
+	public static function reset() {
102 102
 		self::$_instance->_req_type = NULL;
103 103
 		//we need to reset the migration manager in order for it to detect DMSs properly
104 104
 		EE_Data_Migration_Manager::reset();
105 105
 		//make sure none of the old hooks are left hanging around
106
-		remove_all_actions( 'AHEE__EE_System__perform_activations_upgrades_and_migrations');
106
+		remove_all_actions('AHEE__EE_System__perform_activations_upgrades_and_migrations');
107 107
 		self::instance()->detect_activations_or_upgrades();
108 108
 		self::instance()->perform_activations_upgrades_and_migrations();
109 109
 		return self::instance();
@@ -124,25 +124,25 @@  discard block
 block discarded – undo
124 124
 	 * @return \EE_System
125 125
 	 */
126 126
 	private function __construct() {
127
-		do_action( 'AHEE__EE_System__construct__begin',$this );
127
+		do_action('AHEE__EE_System__construct__begin', $this);
128 128
 		// check required WP version
129
-		if ( ! $this->_minimum_wp_version_required() ) {
130
-			unset( $_GET['activate'] );
131
-			add_action( 'admin_notices', array( $this, 'minimum_wp_version_error' ), 1 );
129
+		if ( ! $this->_minimum_wp_version_required()) {
130
+			unset($_GET['activate']);
131
+			add_action('admin_notices', array($this, 'minimum_wp_version_error'), 1);
132 132
 			return;
133 133
 		}
134 134
 		// check required PHP version
135
-		if ( ! $this->_minimum_php_version_required() ) {
136
-			unset( $_GET['activate'] );
137
-			add_action( 'admin_notices', array( $this, 'minimum_php_version_error' ), 1 );
135
+		if ( ! $this->_minimum_php_version_required()) {
136
+			unset($_GET['activate']);
137
+			add_action('admin_notices', array($this, 'minimum_php_version_error'), 1);
138 138
 			return;
139 139
 		}
140 140
 		// check recommended WP version
141
-		if ( ! $this->_minimum_wp_version_recommended() ) {
141
+		if ( ! $this->_minimum_wp_version_recommended()) {
142 142
 			$this->_display_minimum_recommended_wp_version_notice();
143 143
 		}
144 144
 		// check recommended PHP version
145
-		if ( ! $this->_minimum_php_version_recommended() ) {
145
+		if ( ! $this->_minimum_php_version_recommended()) {
146 146
 			$this->_display_minimum_recommended_php_version_notice();
147 147
 		}
148 148
 		$this->display_alpha_banner_warning();
@@ -151,40 +151,40 @@  discard block
 block discarded – undo
151 151
 		// workarounds for PHP < 5.3
152 152
 		$this->_load_class_tools();
153 153
 		// load a few helper files
154
-		EE_Registry::instance()->load_helper( 'File' );
155
-		EE_Registry::instance()->load_helper( 'Autoloader', array(), FALSE );
154
+		EE_Registry::instance()->load_helper('File');
155
+		EE_Registry::instance()->load_helper('Autoloader', array(), FALSE);
156 156
 		// enable logging?
157
-		if ( WP_DEBUG ) {
158
-			EE_Registry::instance()->load_core( 'Log' );
159
-			do_action( 'AHEE_log', __CLASS__, __FUNCTION__, 'WP_DEBUG Logging Initiated' );
157
+		if (WP_DEBUG) {
158
+			EE_Registry::instance()->load_core('Log');
159
+			do_action('AHEE_log', __CLASS__, __FUNCTION__, 'WP_DEBUG Logging Initiated');
160 160
 		}
161
-		require_once EE_CORE . 'EE_Deprecated.core.php';
161
+		require_once EE_CORE.'EE_Deprecated.core.php';
162 162
 		// load interfaces
163
-		require_once EE_CORE . 'EEI_Interfaces.php';
164
-		require_once EE_LIBRARIES . 'payment_methods' . DS . 'EEI_Payment_Method_Interfaces.php';
163
+		require_once EE_CORE.'EEI_Interfaces.php';
164
+		require_once EE_LIBRARIES.'payment_methods'.DS.'EEI_Payment_Method_Interfaces.php';
165 165
 		// WP cron jobs
166
-		EE_Registry::instance()->load_core( 'Cron_Tasks' );
166
+		EE_Registry::instance()->load_core('Cron_Tasks');
167 167
 
168 168
 		// allow addons to load first so that they can register autoloaders, set hooks for running DMS's, etc
169
-		add_action( 'plugins_loaded', array( $this, 'load_espresso_addons' ), 1 );
169
+		add_action('plugins_loaded', array($this, 'load_espresso_addons'), 1);
170 170
 		// when an ee addon is activated, we want to call the core hook(s) again
171 171
 		// because the newly-activated addon didn't get a chance to run at all
172
-		add_action( 'activate_plugin', array( $this, 'load_espresso_addons' ), 1 );
172
+		add_action('activate_plugin', array($this, 'load_espresso_addons'), 1);
173 173
 		// detect whether install or upgrade
174
-		add_action( 'plugins_loaded', array( $this, 'detect_activations_or_upgrades' ), 3 );
174
+		add_action('plugins_loaded', array($this, 'detect_activations_or_upgrades'), 3);
175 175
 		// load EE_Config, EE_Textdomain, etc
176
-		add_action( 'plugins_loaded', array( $this, 'load_core_configuration' ), 5 );
176
+		add_action('plugins_loaded', array($this, 'load_core_configuration'), 5);
177 177
 		// load EE_Config, EE_Textdomain, etc
178
-		add_action( 'plugins_loaded', array( $this, 'register_shortcodes_modules_and_widgets' ), 7 );
178
+		add_action('plugins_loaded', array($this, 'register_shortcodes_modules_and_widgets'), 7);
179 179
 		// you wanna get going? I wanna get going... let's get going!
180
-		add_action( 'plugins_loaded', array( $this, 'brew_espresso' ), 9 );
180
+		add_action('plugins_loaded', array($this, 'brew_espresso'), 9);
181 181
 
182 182
 		//other housekeeping
183 183
 		//exclude EE critical pages from wp_list_pages
184
-		add_filter('wp_list_pages_excludes', array( $this, 'remove_pages_from_wp_list_pages'), 10 );
184
+		add_filter('wp_list_pages_excludes', array($this, 'remove_pages_from_wp_list_pages'), 10);
185 185
 		// ALL EE Addons should use the following hook point to attach their initial setup too
186 186
 		// it's extremely important for EE Addons to register any class autoloaders so that they can be available when the EE_Config loads
187
-		do_action( 'AHEE__EE_System__construct__complete', $this );
187
+		do_action('AHEE__EE_System__construct__complete', $this);
188 188
 	}
189 189
 
190 190
 
@@ -199,22 +199,22 @@  discard block
 block discarded – undo
199 199
 	 */
200 200
 	public function display_alpha_banner_warning() {
201 201
 		// skip AJAX requests
202
-		if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
202
+		if (defined('DOING_AJAX') && DOING_AJAX) {
203 203
 			return;
204 204
 		}
205 205
 		// skip stable releases
206
-		if ( strpos( EVENT_ESPRESSO_VERSION, '.alpha' ) === false ) {
206
+		if (strpos(EVENT_ESPRESSO_VERSION, '.alpha') === false) {
207 207
 			return;
208 208
 		}
209 209
 		// post release candidate warning
210
-		if ( is_admin() ) {
211
-			add_action( 'admin_notices', array( $this, 'alpha_banner_admin_notice' ), -999 );
210
+		if (is_admin()) {
211
+			add_action('admin_notices', array($this, 'alpha_banner_admin_notice'), -999);
212 212
 		} else {
213 213
 			// site admin has authorized use of non-stable release candidate for production
214
-			if ( defined( 'ALLOW_NON_STABLE_RELEASE_ON_LIVE_SITE' ) && ALLOW_NON_STABLE_RELEASE_ON_LIVE_SITE ) {
214
+			if (defined('ALLOW_NON_STABLE_RELEASE_ON_LIVE_SITE') && ALLOW_NON_STABLE_RELEASE_ON_LIVE_SITE) {
215 215
 				return;
216 216
 			}
217
-			add_action( 'shutdown', array( $this, 'alpha_banner_warning_notice' ), 10 );
217
+			add_action('shutdown', array($this, 'alpha_banner_warning_notice'), 10);
218 218
 		}
219 219
 	}
220 220
 
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
 	public function alpha_banner_admin_notice() {
231 231
 		EE_Error::add_attention(
232 232
 			sprintf(
233
-				__( 'This version of Event Espresso is for testing and/or evaluation purposes only. It is %1$snot%2$s considered a stable release and should therefore %1$snot%2$s be activated on a live or production website.', 'event_espresso' ),
233
+				__('This version of Event Espresso is for testing and/or evaluation purposes only. It is %1$snot%2$s considered a stable release and should therefore %1$snot%2$s be activated on a live or production website.', 'event_espresso'),
234 234
 				'<strong>',
235 235
 				'</strong>'
236 236
 			),
@@ -249,11 +249,11 @@  discard block
 block discarded – undo
249 249
 	 */
250 250
 	public function alpha_banner_warning_notice() {
251 251
 		global $pagenow;
252
-		if ( in_array( $pagenow, array( 'wp-login.php', 'wp-register.php' ) ) ) {
252
+		if (in_array($pagenow, array('wp-login.php', 'wp-register.php'))) {
253 253
 			return;
254 254
 		}
255 255
 		printf(
256
-			__( '%1$sThis version of Event Espresso is for testing and/or evaluation purposes only. It is %2$snot%3$s considered a stable release and should therefore %2$snot%3$s be activated on a live or production website.%4$s', 'event_espresso' ),
256
+			__('%1$sThis version of Event Espresso is for testing and/or evaluation purposes only. It is %2$snot%3$s considered a stable release and should therefore %2$snot%3$s be activated on a live or production website.%4$s', 'event_espresso'),
257 257
 			'<div id="ee-release-candidate-notice-dv" class="ee-really-important-notice-dv"><p>',
258 258
 			'<strong>',
259 259
 			'</strong>',
@@ -270,9 +270,9 @@  discard block
 block discarded – undo
270 270
 	 * @param string $min_version
271 271
 	 * @return boolean
272 272
 	 */
273
-	private function _check_wp_version( $min_version = EE_MIN_WP_VER_REQUIRED ) {
273
+	private function _check_wp_version($min_version = EE_MIN_WP_VER_REQUIRED) {
274 274
 		global $wp_version;
275
-		return version_compare( $wp_version, $min_version, '>=' ) ? TRUE : FALSE;
275
+		return version_compare($wp_version, $min_version, '>=') ? TRUE : FALSE;
276 276
 	}
277 277
 
278 278
 	/**
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
 	 * 	@return boolean
283 283
 	 */
284 284
 	private function _minimum_wp_version_required() {
285
-		return $this->_check_wp_version( EE_MIN_WP_VER_REQUIRED );
285
+		return $this->_check_wp_version(EE_MIN_WP_VER_REQUIRED);
286 286
 	}
287 287
 
288 288
 	/**
@@ -292,7 +292,7 @@  discard block
 block discarded – undo
292 292
 	 * 	@return boolean
293 293
 	 */
294 294
 	private function _minimum_wp_version_recommended() {
295
-		return $this->_check_wp_version( EE_MIN_WP_VER_RECOMMENDED );
295
+		return $this->_check_wp_version(EE_MIN_WP_VER_RECOMMENDED);
296 296
 	}
297 297
 
298 298
 
@@ -304,8 +304,8 @@  discard block
 block discarded – undo
304 304
 	 * @param string $min_version
305 305
 	 * @return boolean
306 306
 	 */
307
-	private function _check_php_version( $min_version = EE_MIN_PHP_VER_RECOMMENDED ) {
308
-		return version_compare( PHP_VERSION, $min_version, '>=' ) ? TRUE : FALSE;
307
+	private function _check_php_version($min_version = EE_MIN_PHP_VER_RECOMMENDED) {
308
+		return version_compare(PHP_VERSION, $min_version, '>=') ? TRUE : FALSE;
309 309
 	}
310 310
 
311 311
 	/**
@@ -315,7 +315,7 @@  discard block
 block discarded – undo
315 315
 	 * 	@return boolean
316 316
 	 */
317 317
 	private function _minimum_php_version_required() {
318
-		return $this->_check_php_version( EE_MIN_PHP_VER_REQUIRED );
318
+		return $this->_check_php_version(EE_MIN_PHP_VER_REQUIRED);
319 319
 	}
320 320
 
321 321
 	/**
@@ -325,7 +325,7 @@  discard block
 block discarded – undo
325 325
 	 * 	@return boolean
326 326
 	 */
327 327
 	private function _minimum_php_version_recommended() {
328
-		return $this->_check_php_version( EE_MIN_PHP_VER_RECOMMENDED );
328
+		return $this->_check_php_version(EE_MIN_PHP_VER_RECOMMENDED);
329 329
 	}
330 330
 
331 331
 
@@ -342,7 +342,7 @@  discard block
 block discarded – undo
342 342
 		<p>
343 343
 		<?php
344 344
 		printf(
345
-			__( 'We\'re sorry, but Event Espresso requires WordPress version %1$s or greater in order to operate. You are currently running version %2$s.%3$sFor information on how to update your version of WordPress, please go to %4$s.', 'event_espresso' ),
345
+			__('We\'re sorry, but Event Espresso requires WordPress version %1$s or greater in order to operate. You are currently running version %2$s.%3$sFor information on how to update your version of WordPress, please go to %4$s.', 'event_espresso'),
346 346
 			EE_MIN_WP_VER_REQUIRED,
347 347
 			$wp_version,
348 348
 			'<br/>',
@@ -352,7 +352,7 @@  discard block
 block discarded – undo
352 352
 		</p>
353 353
 		</div>
354 354
 		<?php
355
-		EE_System::deactivate_plugin( EE_PLUGIN_BASENAME );
355
+		EE_System::deactivate_plugin(EE_PLUGIN_BASENAME);
356 356
 	}
357 357
 
358 358
 
@@ -368,7 +368,7 @@  discard block
 block discarded – undo
368 368
 		<p>
369 369
 		<?php
370 370
 		printf(
371
-			__( 'We\'re sorry, but Event Espresso requires PHP version %1$s or greater in order to operate. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.', 'event_espresso' ),
371
+			__('We\'re sorry, but Event Espresso requires PHP version %1$s or greater in order to operate. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.', 'event_espresso'),
372 372
 			EE_MIN_PHP_VER_REQUIRED,
373 373
 			PHP_VERSION,
374 374
 			'<br/>',
@@ -378,7 +378,7 @@  discard block
 block discarded – undo
378 378
 		</p>
379 379
 		</div>
380 380
 		<?php
381
-		deactivate_plugins( EE_PLUGIN_BASENAME );
381
+		deactivate_plugins(EE_PLUGIN_BASENAME);
382 382
 	}
383 383
 
384 384
 
@@ -392,9 +392,9 @@  discard block
 block discarded – undo
392 392
 	private function _display_minimum_recommended_wp_version_notice() {
393 393
 		global $wp_version;
394 394
 		EE_Error::add_persistent_admin_notice(
395
-			'wp_version_' . str_replace( '.', '-', EE_MIN_WP_VER_RECOMMENDED ) . '_recommended',
395
+			'wp_version_'.str_replace('.', '-', EE_MIN_WP_VER_RECOMMENDED).'_recommended',
396 396
 			sprintf(
397
-				__( 'Event Espresso recommends WordPress version %1$s or greater in order for everything to operate properly. You are currently running version %2$s.%3$sFor information on how to update your version of WordPress, please go to %4$s.', 'event_espresso' ),
397
+				__('Event Espresso recommends WordPress version %1$s or greater in order for everything to operate properly. You are currently running version %2$s.%3$sFor information on how to update your version of WordPress, please go to %4$s.', 'event_espresso'),
398 398
 				EE_MIN_WP_VER_RECOMMENDED,
399 399
 				$wp_version,
400 400
 				'<br/>',
@@ -413,9 +413,9 @@  discard block
 block discarded – undo
413 413
 	 */
414 414
 	private function _display_minimum_recommended_php_version_notice() {
415 415
 		EE_Error::add_persistent_admin_notice(
416
-			'php_version_' . str_replace( '.', '-', EE_MIN_PHP_VER_RECOMMENDED ) . '_recommended',
416
+			'php_version_'.str_replace('.', '-', EE_MIN_PHP_VER_RECOMMENDED).'_recommended',
417 417
 			sprintf(
418
-				__( 'Event Espresso recommends PHP version %1$s or greater for optimal performance. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.', 'event_espresso' ),
418
+				__('Event Espresso recommends PHP version %1$s or greater for optimal performance. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.', 'event_espresso'),
419 419
 				EE_MIN_PHP_VER_RECOMMENDED,
420 420
 				PHP_VERSION,
421 421
 				'<br/>',
@@ -433,12 +433,12 @@  discard block
 block discarded – undo
433 433
 	 * 	@return void
434 434
 	 */
435 435
 	private function _load_registry() {
436
-		if ( is_readable( EE_CORE . 'EE_Registry.core.php' )) {
437
-			require_once( EE_CORE . 'EE_Registry.core.php' );
436
+		if (is_readable(EE_CORE.'EE_Registry.core.php')) {
437
+			require_once(EE_CORE.'EE_Registry.core.php');
438 438
 		} else {
439
-			$msg = __( 'The EE_Registry core class could not be loaded.', 'event_espresso' );
440
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
441
-			wp_die( EE_Error::get_notices() );
439
+			$msg = __('The EE_Registry core class could not be loaded.', 'event_espresso');
440
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
441
+			wp_die(EE_Error::get_notices());
442 442
 		}
443 443
 	}
444 444
 
@@ -450,11 +450,11 @@  discard block
 block discarded – undo
450 450
 	 * 	@return void
451 451
 	 */
452 452
 	private function _load_class_tools() {
453
-		if ( is_readable( EE_HELPERS . 'EEH_Class_Tools.helper.php' )) {
454
-			require_once( EE_HELPERS . 'EEH_Class_Tools.helper.php' );
453
+		if (is_readable(EE_HELPERS.'EEH_Class_Tools.helper.php')) {
454
+			require_once(EE_HELPERS.'EEH_Class_Tools.helper.php');
455 455
 		} else {
456
-			$msg = __( 'The EEH_Class_Tools helper could not be loaded.', 'event_espresso' );
457
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
456
+			$msg = __('The EEH_Class_Tools helper could not be loaded.', 'event_espresso');
457
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
458 458
 		}
459 459
 	}
460 460
 
@@ -469,13 +469,13 @@  discard block
 block discarded – undo
469 469
 	* @return void
470 470
 	*/
471 471
 	public function load_espresso_addons() {
472
-		do_action( 'AHEE_log', __CLASS__, __FUNCTION__ );
472
+		do_action('AHEE_log', __CLASS__, __FUNCTION__);
473 473
 		// set autoloaders for all of the classes implementing EEI_Plugin_API
474 474
 		// which provide helpers for EE plugin authors to more easily register certain components with EE.
475
-		EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder( EE_LIBRARIES . 'plugin_api' );
475
+		EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder(EE_LIBRARIES.'plugin_api');
476 476
 		//load and setup EE_Capabilities
477
-		EE_Registry::instance()->load_core( 'Capabilities' );
478
-		do_action( 'AHEE__EE_System__load_espresso_addons' );
477
+		EE_Registry::instance()->load_core('Capabilities');
478
+		do_action('AHEE__EE_System__load_espresso_addons');
479 479
 	}
480 480
 
481 481
 
@@ -483,11 +483,11 @@  discard block
 block discarded – undo
483 483
 	 * Checks for activation or upgrade of core first; then also checks if any registered
484 484
 	 * addons have been activated or upgraded
485 485
 	 */
486
-	public function detect_activations_or_upgrades(){
487
-		do_action( 'AHEE_log', __CLASS__, __FUNCTION__ );
486
+	public function detect_activations_or_upgrades() {
487
+		do_action('AHEE_log', __CLASS__, __FUNCTION__);
488 488
 		//first off: let's make sure to handle core
489 489
 		$this->detect_if_activation_or_upgrade();
490
-		foreach(EE_Registry::instance()->addons as $addon){
490
+		foreach (EE_Registry::instance()->addons as $addon) {
491 491
 			//detect teh request type for that addon
492 492
 			$addon->detect_activation_or_upgrade();
493 493
 		}
@@ -502,48 +502,48 @@  discard block
 block discarded – undo
502 502
 	* @return void
503 503
 	*/
504 504
 	public function detect_if_activation_or_upgrade() {
505
-		do_action( 'AHEE_log', __CLASS__, __FUNCTION__ );
505
+		do_action('AHEE_log', __CLASS__, __FUNCTION__);
506 506
 		do_action('AHEE__EE_System___detect_if_activation_or_upgrade__begin');
507 507
 
508 508
 		// load M-Mode class
509
-		EE_Registry::instance()->load_core( 'Maintenance_Mode' );
509
+		EE_Registry::instance()->load_core('Maintenance_Mode');
510 510
 		// check if db has been updated, or if its a brand-new installation
511 511
 
512 512
 		$espresso_db_update = $this->fix_espresso_db_upgrade_option();
513
-		$request_type =  $this->detect_req_type($espresso_db_update);
513
+		$request_type = $this->detect_req_type($espresso_db_update);
514 514
 		//EEH_Debug_Tools::printr( $request_type, '$request_type', __FILE__, __LINE__ );
515
-		if( $request_type != EE_System::req_type_normal){
515
+		if ($request_type != EE_System::req_type_normal) {
516 516
 			EE_Registry::instance()->load_helper('Activation');
517 517
 		}
518
-		do_action( 'AHEE_log', __CLASS__, __FUNCTION__, $request_type, '$request_type' );
519
-		switch($request_type){
518
+		do_action('AHEE_log', __CLASS__, __FUNCTION__, $request_type, '$request_type');
519
+		switch ($request_type) {
520 520
 			case EE_System::req_type_new_activation:
521
-				do_action( 'AHEE__EE_System__detect_if_activation_or_upgrade__new_activation' );
522
-				$this->_handle_core_version_change( $espresso_db_update );
521
+				do_action('AHEE__EE_System__detect_if_activation_or_upgrade__new_activation');
522
+				$this->_handle_core_version_change($espresso_db_update);
523 523
 				break;
524 524
 			case EE_System::req_type_reactivation:
525
-				do_action( 'AHEE__EE_System__detect_if_activation_or_upgrade__reactivation' );
526
-				$this->_handle_core_version_change( $espresso_db_update );
525
+				do_action('AHEE__EE_System__detect_if_activation_or_upgrade__reactivation');
526
+				$this->_handle_core_version_change($espresso_db_update);
527 527
 				break;
528 528
 			case EE_System::req_type_upgrade:
529
-				do_action( 'AHEE__EE_System__detect_if_activation_or_upgrade__upgrade' );
529
+				do_action('AHEE__EE_System__detect_if_activation_or_upgrade__upgrade');
530 530
 				//migrations may be required now that we've upgraded
531 531
 				EE_Maintenance_Mode::instance()->set_maintenance_mode_if_db_old();
532
-				$this->_handle_core_version_change( $espresso_db_update );
532
+				$this->_handle_core_version_change($espresso_db_update);
533 533
 //				echo "done upgrade";die;
534 534
 				break;
535 535
 			case EE_System::req_type_downgrade:
536
-				do_action( 'AHEE__EE_System__detect_if_activation_or_upgrade__downgrade' );
536
+				do_action('AHEE__EE_System__detect_if_activation_or_upgrade__downgrade');
537 537
 				//its possible migrations are no longer required
538 538
 				EE_Maintenance_Mode::instance()->set_maintenance_mode_if_db_old();
539
-				$this->_handle_core_version_change( $espresso_db_update );
539
+				$this->_handle_core_version_change($espresso_db_update);
540 540
 				break;
541 541
 			case EE_System::req_type_normal:
542 542
 			default:
543 543
 //				$this->_maybe_redirect_to_ee_about();
544 544
 				break;
545 545
 		}
546
-		do_action( 'AHEE__EE_System__detect_if_activation_or_upgrade__complete' );
546
+		do_action('AHEE__EE_System__detect_if_activation_or_upgrade__complete');
547 547
 	}
548 548
 
549 549
 	/**
@@ -551,11 +551,11 @@  discard block
 block discarded – undo
551 551
 	 * initializing the database later during the request
552 552
 	 * @param array $espresso_db_update
553 553
 	 */
554
-	protected function _handle_core_version_change( $espresso_db_update ){
555
-		do_action( 'AHEE_log', __CLASS__, __FUNCTION__ );
556
-		$this->update_list_of_installed_versions( $espresso_db_update );
554
+	protected function _handle_core_version_change($espresso_db_update) {
555
+		do_action('AHEE_log', __CLASS__, __FUNCTION__);
556
+		$this->update_list_of_installed_versions($espresso_db_update);
557 557
 		//get ready to verify the DB is ok (provided we aren't in maintenance mode, of course)
558
-		add_action( 'AHEE__EE_System__perform_activations_upgrades_and_migrations', array( $this, 'initialize_db_if_no_migrations_required' ));
558
+		add_action('AHEE__EE_System__perform_activations_upgrades_and_migrations', array($this, 'initialize_db_if_no_migrations_required'));
559 559
 	}
560 560
 
561 561
 
@@ -570,45 +570,45 @@  discard block
 block discarded – undo
570 570
 	 * @internal param array $espresso_db_update_value the value of the WordPress option. If not supplied, fetches it from the options table
571 571
 	 * @return array the correct value of 'espresso_db_upgrade', after saving it, if it needed correction
572 572
 	 */
573
-	private function fix_espresso_db_upgrade_option($espresso_db_update = null){
574
-		do_action( 'AHEE_log', __CLASS__, __FUNCTION__ );
575
-		do_action( 'FHEE__EE_System__manage_fix_espresso_db_upgrade_option__begin', $espresso_db_update );
576
-		if( ! $espresso_db_update){
577
-			$espresso_db_update = get_option( 'espresso_db_update' );
573
+	private function fix_espresso_db_upgrade_option($espresso_db_update = null) {
574
+		do_action('AHEE_log', __CLASS__, __FUNCTION__);
575
+		do_action('FHEE__EE_System__manage_fix_espresso_db_upgrade_option__begin', $espresso_db_update);
576
+		if ( ! $espresso_db_update) {
577
+			$espresso_db_update = get_option('espresso_db_update');
578 578
 		}
579 579
 		// check that option is an array
580
-		if( ! is_array( $espresso_db_update )) {
580
+		if ( ! is_array($espresso_db_update)) {
581 581
 			// if option is FALSE, then it never existed
582
-			if ( $espresso_db_update === FALSE ) {
582
+			if ($espresso_db_update === FALSE) {
583 583
 				// make $espresso_db_update an array and save option with autoload OFF
584
-				$espresso_db_update =  array();
585
-				add_option( 'espresso_db_update', $espresso_db_update, '', 'no' );
584
+				$espresso_db_update = array();
585
+				add_option('espresso_db_update', $espresso_db_update, '', 'no');
586 586
 			} else {
587 587
 				// option is NOT FALSE but also is NOT an array, so make it an array and save it
588
-				$espresso_db_update =  array( $espresso_db_update=>array() );
589
-				update_option( 'espresso_db_update', $espresso_db_update );
588
+				$espresso_db_update = array($espresso_db_update=>array());
589
+				update_option('espresso_db_update', $espresso_db_update);
590 590
 			}
591
-		}else{
591
+		} else {
592 592
 			$corrected_db_update = array();
593 593
 			//if IS an array, but is it an array where KEYS are version numbers, and values are arrays?
594
-			foreach($espresso_db_update as $should_be_version_string => $should_be_array){
595
-				if(is_int($should_be_version_string) && ! is_array($should_be_array)){
594
+			foreach ($espresso_db_update as $should_be_version_string => $should_be_array) {
595
+				if (is_int($should_be_version_string) && ! is_array($should_be_array)) {
596 596
 					//the key is an int, and the value IS NOT an array
597 597
 					//so it must be numerically-indexed, where values are versions installed...
598 598
 					//fix it!
599 599
 					$version_string = $should_be_array;
600 600
 					$corrected_db_update[$version_string] = array('unknown-date');
601
-				}else{
601
+				} else {
602 602
 					//ok it checks out
603 603
 					$corrected_db_update[$should_be_version_string] = $should_be_array;
604 604
 				}
605 605
 			}
606 606
 			$espresso_db_update = $corrected_db_update;
607
-			update_option( 'espresso_db_update', $espresso_db_update );
607
+			update_option('espresso_db_update', $espresso_db_update);
608 608
 
609 609
 		}
610 610
 
611
-		do_action( 'FHEE__EE_System__manage_fix_espresso_db_upgrade_option__complete', $espresso_db_update );
611
+		do_action('FHEE__EE_System__manage_fix_espresso_db_upgrade_option__complete', $espresso_db_update);
612 612
 		return $espresso_db_update;
613 613
 	}
614 614
 
@@ -625,26 +625,26 @@  discard block
 block discarded – undo
625 625
 	 *		however,
626 626
 	 * @return void
627 627
 	 */
628
-	public function initialize_db_if_no_migrations_required( $initialize_addons_too = FALSE ){
629
-		do_action( 'AHEE_log', __CLASS__, __FUNCTION__, EE_Maintenance_Mode::instance()->level(), 'EE_Maintenance_Mode::instance()->level()' );
628
+	public function initialize_db_if_no_migrations_required($initialize_addons_too = FALSE) {
629
+		do_action('AHEE_log', __CLASS__, __FUNCTION__, EE_Maintenance_Mode::instance()->level(), 'EE_Maintenance_Mode::instance()->level()');
630 630
 		$request_type = $this->detect_req_type();
631 631
 		//only initialize system if we're not in maintenance mode.
632
-		if( EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance ){
633
-			update_option( 'ee_flush_rewrite_rules', TRUE );
632
+		if (EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance) {
633
+			update_option('ee_flush_rewrite_rules', TRUE);
634 634
 			EEH_Activation::system_initialization();
635 635
 			EEH_Activation::initialize_db_and_folders();
636 636
 			EEH_Activation::initialize_db_content();
637
-			if( $initialize_addons_too ) {
637
+			if ($initialize_addons_too) {
638 638
 				//foreach registered addon, make sure its db is up-to-date too
639
-				foreach(EE_Registry::instance()->addons as $addon){
639
+				foreach (EE_Registry::instance()->addons as $addon) {
640 640
 					$addon->initialize_db_if_no_migrations_required();
641 641
 				}
642 642
 			}
643
-		}else{
644
-			EE_Data_Migration_Manager::instance()->enqueue_db_initialization_for( 'Core' );
643
+		} else {
644
+			EE_Data_Migration_Manager::instance()->enqueue_db_initialization_for('Core');
645 645
 		}
646
-		if ( $request_type == EE_System::req_type_new_activation || $request_type == EE_System::req_type_reactivation || $request_type == EE_System::req_type_upgrade ) {
647
-			add_action( 'AHEE__EE_System__load_CPTs_and_session__start', array( $this, 'redirect_to_about_ee' ), 9 );
646
+		if ($request_type == EE_System::req_type_new_activation || $request_type == EE_System::req_type_reactivation || $request_type == EE_System::req_type_upgrade) {
647
+			add_action('AHEE__EE_System__load_CPTs_and_session__start', array($this, 'redirect_to_about_ee'), 9);
648 648
 		}
649 649
 	}
650 650
 
@@ -656,17 +656,17 @@  discard block
 block discarded – undo
656 656
 	 * @param 	string 	$current_version_to_add 	version to be added to the version history
657 657
 	 * @return 	boolean success as to whether or not this option was changed
658 658
 	 */
659
-	public function update_list_of_installed_versions($version_history = NULL,$current_version_to_add = NULL) {
660
-		do_action( 'AHEE_log', __CLASS__, __FUNCTION__ );
661
-		if( ! $version_history ) {
659
+	public function update_list_of_installed_versions($version_history = NULL, $current_version_to_add = NULL) {
660
+		do_action('AHEE_log', __CLASS__, __FUNCTION__);
661
+		if ( ! $version_history) {
662 662
 			$version_history = $this->fix_espresso_db_upgrade_option($version_history);
663 663
 		}
664
-		if( $current_version_to_add == NULL){
664
+		if ($current_version_to_add == NULL) {
665 665
 			$current_version_to_add = espresso_version();
666 666
 		}
667
-		$version_history[ $current_version_to_add ][] = date( 'Y-m-d H:i:s',time() );
667
+		$version_history[$current_version_to_add][] = date('Y-m-d H:i:s', time());
668 668
 		// re-save
669
-		return update_option( 'espresso_db_update', $version_history );
669
+		return update_option('espresso_db_update', $version_history);
670 670
 	}
671 671
 
672 672
 
@@ -683,11 +683,11 @@  discard block
 block discarded – undo
683 683
 	 *                            but still know if this is a new install or not
684 684
 	 * @return int one of the constants on EE_System::req_type_
685 685
 	 */
686
-	public function detect_req_type( $espresso_db_update = NULL ){
687
-		do_action( 'AHEE_log', __CLASS__, __FUNCTION__ );
688
-		if ( $this->_req_type === NULL ){
689
-			$espresso_db_update = ! empty( $espresso_db_update ) ? $espresso_db_update : $this->fix_espresso_db_upgrade_option();
690
-			$this->_req_type = $this->detect_req_type_given_activation_history( $espresso_db_update, 'ee_espresso_activation', espresso_version() );
686
+	public function detect_req_type($espresso_db_update = NULL) {
687
+		do_action('AHEE_log', __CLASS__, __FUNCTION__);
688
+		if ($this->_req_type === NULL) {
689
+			$espresso_db_update = ! empty($espresso_db_update) ? $espresso_db_update : $this->fix_espresso_db_upgrade_option();
690
+			$this->_req_type = $this->detect_req_type_given_activation_history($espresso_db_update, 'ee_espresso_activation', espresso_version());
691 691
 		}
692 692
 		return $this->_req_type;
693 693
 	}
@@ -703,41 +703,41 @@  discard block
 block discarded – undo
703 703
 	 * @param string $version_to_upgrade_to the version that was just upgraded to (for core that will be espresso_version())
704 704
 	 * @return int one of the constants on EE_System::req_type_*
705 705
 	 */
706
-	public static function detect_req_type_given_activation_history( $activation_history_for_addon, $activation_indicator_option_name, $version_to_upgrade_to ){
707
-		do_action( 'AHEE_log', __CLASS__, __FUNCTION__, $activation_indicator_option_name, '$activation_indicator_option_name' );
708
-		do_action( 'AHEE_log', __CLASS__, __FUNCTION__, $version_to_upgrade_to, '$version_to_upgrade_to' );
709
-		$version_is_higher = self::_new_version_is_higher( $activation_history_for_addon, $version_to_upgrade_to );
710
-		if( $activation_history_for_addon ){
706
+	public static function detect_req_type_given_activation_history($activation_history_for_addon, $activation_indicator_option_name, $version_to_upgrade_to) {
707
+		do_action('AHEE_log', __CLASS__, __FUNCTION__, $activation_indicator_option_name, '$activation_indicator_option_name');
708
+		do_action('AHEE_log', __CLASS__, __FUNCTION__, $version_to_upgrade_to, '$version_to_upgrade_to');
709
+		$version_is_higher = self::_new_version_is_higher($activation_history_for_addon, $version_to_upgrade_to);
710
+		if ($activation_history_for_addon) {
711 711
 			//it exists, so this isn't a completely new install
712 712
 			//check if this version already in that list of previously installed versions
713
-			if ( ! isset( $activation_history_for_addon[ $version_to_upgrade_to ] )) {
713
+			if ( ! isset($activation_history_for_addon[$version_to_upgrade_to])) {
714 714
 				//it a version we haven't seen before
715
-				if( $version_is_higher === 1 ){
715
+				if ($version_is_higher === 1) {
716 716
 					$req_type = EE_System::req_type_upgrade;
717
-				}else{
717
+				} else {
718 718
 					$req_type = EE_System::req_type_downgrade;
719 719
 				}
720
-				delete_option( $activation_indicator_option_name );
720
+				delete_option($activation_indicator_option_name);
721 721
 			} else {
722 722
 				// its not an update. maybe a reactivation?
723
-				if( get_option( $activation_indicator_option_name, FALSE ) ){
724
-					if ( $version_is_higher === -1 ){
723
+				if (get_option($activation_indicator_option_name, FALSE)) {
724
+					if ($version_is_higher === -1) {
725 725
 						$req_type = EE_System::req_type_downgrade;
726
-					}elseif( $version_is_higher === 0 ){
726
+					}elseif ($version_is_higher === 0) {
727 727
 						//we've seen this version before, but it's an activation. must be a reactivation
728 728
 						$req_type = EE_System::req_type_reactivation;
729
-					}else{//$version_is_higher === 1
729
+					} else {//$version_is_higher === 1
730 730
 						$req_type = EE_System::req_type_upgrade;
731 731
 					}
732
-					delete_option( $activation_indicator_option_name );
732
+					delete_option($activation_indicator_option_name);
733 733
 				} else {
734 734
 					//we've seen this version before and the activation indicate doesn't show it was just activated
735
-					if ( $version_is_higher === -1 ){
735
+					if ($version_is_higher === -1) {
736 736
 						$req_type = EE_System::req_type_downgrade;
737
-					}elseif( $version_is_higher === 0 ){
737
+					}elseif ($version_is_higher === 0) {
738 738
 						//we've seen this version before and it's not an activation. its normal request
739 739
 						$req_type = EE_System::req_type_normal;
740
-					}else{//$version_is_higher === 1
740
+					} else {//$version_is_higher === 1
741 741
 						$req_type = EE_System::req_type_upgrade;
742 742
 					}
743 743
 				}
@@ -745,7 +745,7 @@  discard block
 block discarded – undo
745 745
 		} else {
746 746
 			//brand new install
747 747
 			$req_type = EE_System::req_type_new_activation;
748
-			delete_option( $activation_indicator_option_name );
748
+			delete_option($activation_indicator_option_name);
749 749
 		}
750 750
 		return $req_type;
751 751
 	}
@@ -763,31 +763,31 @@  discard block
 block discarded – undo
763 763
 	 *		0 if $version_to_upgrade_to MATCHES (reactivation or normal request);
764 764
 	 *		1 if $version_to_upgrade_to is HIGHER (upgrade) ;
765 765
 	 */
766
-	protected static function _new_version_is_higher( $activation_history_for_addon, $version_to_upgrade_to ){
767
-		do_action( 'AHEE_log', __CLASS__, __FUNCTION__ );
766
+	protected static function _new_version_is_higher($activation_history_for_addon, $version_to_upgrade_to) {
767
+		do_action('AHEE_log', __CLASS__, __FUNCTION__);
768 768
 		//find the most recently-activated version
769 769
 		$most_recently_active_version_activation = '1970-01-01 00:00:00';
770 770
 		$most_recently_active_version = '0.0.0.dev.000';
771
-		if( is_array( $activation_history_for_addon ) ){
772
-			foreach( $activation_history_for_addon as $version => $times_activated ){
771
+		if (is_array($activation_history_for_addon)) {
772
+			foreach ($activation_history_for_addon as $version => $times_activated) {
773 773
 				//check there is a record of when this version was activated. Otherwise,
774 774
 				//mark it as unknown
775
-				if( ! $times_activated ){
776
-					$times_activated = array( 'unknown-date');
775
+				if ( ! $times_activated) {
776
+					$times_activated = array('unknown-date');
777 777
 				}
778
-				if( is_string( $times_activated ) ){
779
-					$times_activated = array( $times_activated );
778
+				if (is_string($times_activated)) {
779
+					$times_activated = array($times_activated);
780 780
 				}
781
-				foreach( $times_activated as $an_activation ){
782
-					if( $an_activation != 'unknown-date' &&
783
-							$an_activation > $most_recently_active_version_activation  ){
781
+				foreach ($times_activated as $an_activation) {
782
+					if ($an_activation != 'unknown-date' &&
783
+							$an_activation > $most_recently_active_version_activation) {
784 784
 						$most_recently_active_version = $version;
785 785
 						$most_recently_active_version_activation = $an_activation == 'unknown-date' ? '1970-01-01 00:00:00' : $an_activation;
786 786
 					}
787 787
 				}
788 788
 			}
789 789
 		}
790
-		return version_compare( $version_to_upgrade_to, $most_recently_active_version );
790
+		return version_compare($version_to_upgrade_to, $most_recently_active_version);
791 791
 	}
792 792
 
793 793
 
@@ -797,21 +797,21 @@  discard block
 block discarded – undo
797 797
 	 * @return void
798 798
 	 */
799 799
 	public function redirect_to_about_ee() {
800
-		do_action( 'AHEE_log', __CLASS__, __FUNCTION__ );
801
-		$notices = EE_Error::get_notices( FALSE );
800
+		do_action('AHEE_log', __CLASS__, __FUNCTION__);
801
+		$notices = EE_Error::get_notices(FALSE);
802 802
 		//if current user is an admin and it's not an ajax request
803
-		if(EE_Registry::instance()->CAP->current_user_can( 'manage_options', 'espresso_about_default' ) && ! ( defined('DOING_AJAX') && DOING_AJAX  ) && ! isset( $notices[ 'errors' ] ) ){
804
-			$query_params =  array( 'page' => 'espresso_about' );
803
+		if (EE_Registry::instance()->CAP->current_user_can('manage_options', 'espresso_about_default') && ! (defined('DOING_AJAX') && DOING_AJAX) && ! isset($notices['errors'])) {
804
+			$query_params = array('page' => 'espresso_about');
805 805
 
806
-			if ( EE_System::instance()->detect_req_type() == EE_System::req_type_new_activation ) {
806
+			if (EE_System::instance()->detect_req_type() == EE_System::req_type_new_activation) {
807 807
 			    $query_params['new_activation'] = TRUE;
808 808
 			}
809 809
 
810
-			if ( EE_System::instance()->detect_req_type() == EE_System::req_type_reactivation ) {
810
+			if (EE_System::instance()->detect_req_type() == EE_System::req_type_reactivation) {
811 811
 			    $query_params['reactivation'] = TRUE;
812 812
 			}
813
-			$url = add_query_arg( $query_params, admin_url( 'admin.php' ) );
814
-			wp_safe_redirect( $url );
813
+			$url = add_query_arg($query_params, admin_url('admin.php'));
814
+			wp_safe_redirect($url);
815 815
 			exit();
816 816
 		}
817 817
 	}
@@ -822,33 +822,33 @@  discard block
 block discarded – undo
822 822
 	 *
823 823
 	 * @return void
824 824
 	 */
825
-	public function load_core_configuration(){
826
-		do_action( 'AHEE_log', __CLASS__, __FUNCTION__ );
827
-		do_action( 'AHEE__EE_System__load_core_configuration__begin', $this );
825
+	public function load_core_configuration() {
826
+		do_action('AHEE_log', __CLASS__, __FUNCTION__);
827
+		do_action('AHEE__EE_System__load_core_configuration__begin', $this);
828 828
 		// load and setup EE_Config and EE_Network_Config
829
-		EE_Registry::instance()->load_core( 'Config' );
830
-		EE_Registry::instance()->load_core( 'Network_Config' );
829
+		EE_Registry::instance()->load_core('Config');
830
+		EE_Registry::instance()->load_core('Network_Config');
831 831
 		// setup autoloaders
832
-		EE_Registry::instance()->load_core( 'EE_Load_Textdomain' );
832
+		EE_Registry::instance()->load_core('EE_Load_Textdomain');
833 833
 		//load textdomain
834 834
 		EE_Load_Textdomain::load_textdomain();
835 835
 		// enable logging?
836
-		if ( EE_Registry::instance()->CFG->admin->use_full_logging ) {
837
-			EE_Registry::instance()->load_core( 'Log' );
836
+		if (EE_Registry::instance()->CFG->admin->use_full_logging) {
837
+			EE_Registry::instance()->load_core('Log');
838 838
 		}
839
-		do_action( 'AHEE_log', __CLASS__, __FUNCTION__ );
839
+		do_action('AHEE_log', __CLASS__, __FUNCTION__);
840 840
 		// check for activation errors
841
-		$activation_errors = get_option( 'ee_plugin_activation_errors', FALSE );
842
-		if ( $activation_errors ) {
843
-			EE_Error::add_error( $activation_errors, __FILE__, __FUNCTION__, __LINE__ );
844
-			update_option( 'ee_plugin_activation_errors', FALSE );
841
+		$activation_errors = get_option('ee_plugin_activation_errors', FALSE);
842
+		if ($activation_errors) {
843
+			EE_Error::add_error($activation_errors, __FILE__, __FUNCTION__, __LINE__);
844
+			update_option('ee_plugin_activation_errors', FALSE);
845 845
 		}
846 846
 		// get model names
847 847
 		$this->_parse_model_names();
848 848
 
849 849
 		//load caf stuff a chance to play during the activation process too.
850 850
 		$this->_maybe_brew_regular();
851
-		do_action( 'AHEE__EE_System__load_core_configuration__complete', $this );
851
+		do_action('AHEE__EE_System__load_core_configuration__complete', $this);
852 852
 	}
853 853
 
854 854
 
@@ -857,24 +857,24 @@  discard block
 block discarded – undo
857 857
 	 *
858 858
 	 * @return void
859 859
 	 */
860
-	private function _parse_model_names(){
861
-		do_action( 'AHEE_log', __CLASS__, __FUNCTION__ );
860
+	private function _parse_model_names() {
861
+		do_action('AHEE_log', __CLASS__, __FUNCTION__);
862 862
 		//get all the files in the EE_MODELS folder that end in .model.php
863
-		$models = glob( EE_MODELS.'*.model.php');
863
+		$models = glob(EE_MODELS.'*.model.php');
864 864
 		$model_names = array();
865 865
 		$non_abstract_db_models = array();
866
-		foreach( $models as $model ){
866
+		foreach ($models as $model) {
867 867
 			// get model classname
868
-			$classname = EEH_File::get_classname_from_filepath_with_standard_filename( $model );
869
-			$shortname = str_replace( 'EEM_', '', $classname );
868
+			$classname = EEH_File::get_classname_from_filepath_with_standard_filename($model);
869
+			$shortname = str_replace('EEM_', '', $classname);
870 870
 			$reflectionClass = new ReflectionClass($classname);
871
-			if( $reflectionClass->isSubclassOf('EEM_Base') && ! $reflectionClass->isAbstract()){
871
+			if ($reflectionClass->isSubclassOf('EEM_Base') && ! $reflectionClass->isAbstract()) {
872 872
 				$non_abstract_db_models[$shortname] = $classname;
873 873
 			}
874
-			$model_names[ $shortname ] = $classname;
874
+			$model_names[$shortname] = $classname;
875 875
 		}
876
-		EE_Registry::instance()->models = apply_filters( 'FHEE__EE_System__parse_model_names', $model_names );
877
-		EE_Registry::instance()->non_abstract_db_models = apply_filters( 'FHEE__EE_System__parse_implemented_model_names', $non_abstract_db_models );
876
+		EE_Registry::instance()->models = apply_filters('FHEE__EE_System__parse_model_names', $model_names);
877
+		EE_Registry::instance()->non_abstract_db_models = apply_filters('FHEE__EE_System__parse_implemented_model_names', $non_abstract_db_models);
878 878
 	}
879 879
 
880 880
 
@@ -884,9 +884,9 @@  discard block
 block discarded – undo
884 884
 	 * @return void
885 885
 	 */
886 886
 	private function _maybe_brew_regular() {
887
-		if (( ! defined( 'EE_DECAF' ) ||  EE_DECAF !== TRUE ) && is_readable( EE_CAFF_PATH . 'brewing_regular.php' )) {
888
-			do_action( 'AHEE_log', __CLASS__, __FUNCTION__, 'coffee\'s on' );
889
-			require_once EE_CAFF_PATH . 'brewing_regular.php';
887
+		if (( ! defined('EE_DECAF') || EE_DECAF !== TRUE) && is_readable(EE_CAFF_PATH.'brewing_regular.php')) {
888
+			do_action('AHEE_log', __CLASS__, __FUNCTION__, 'coffee\'s on');
889
+			require_once EE_CAFF_PATH.'brewing_regular.php';
890 890
 		}
891 891
 	}
892 892
 
@@ -901,10 +901,10 @@  discard block
 block discarded – undo
901 901
 	* @return void
902 902
 	*/
903 903
 	public function register_shortcodes_modules_and_widgets() {
904
-		do_action( 'AHEE_log', __CLASS__, __FUNCTION__ );
905
-		do_action( 'AHEE__EE_System__register_shortcodes_modules_and_widgets' );
904
+		do_action('AHEE_log', __CLASS__, __FUNCTION__);
905
+		do_action('AHEE__EE_System__register_shortcodes_modules_and_widgets');
906 906
 		// check for addons using old hookpoint
907
-		if ( has_action( 'AHEE__EE_System__register_shortcodes_modules_and_addons' )) {
907
+		if (has_action('AHEE__EE_System__register_shortcodes_modules_and_addons')) {
908 908
 			$this->_incompatible_addon_error();
909 909
 		}
910 910
 	}
@@ -917,21 +917,21 @@  discard block
 block discarded – undo
917 917
 	* @return void
918 918
 	*/
919 919
 	private function _incompatible_addon_error() {
920
-		do_action( 'AHEE_log', __CLASS__, __FUNCTION__ );
920
+		do_action('AHEE_log', __CLASS__, __FUNCTION__);
921 921
 		// get array of classes hooking into here
922
-		$class_names = EEH_Class_Tools::get_class_names_for_all_callbacks_on_hook( 'AHEE__EE_System__register_shortcodes_modules_and_addons' );
923
-		if ( ! empty( $class_names )) {
924
-			$msg = __( 'The following plugins, addons, or modules appear to be incompatible with this version of Event Espresso and were automatically deactivated to avoid fatal errors:', 'event_espresso' );
922
+		$class_names = EEH_Class_Tools::get_class_names_for_all_callbacks_on_hook('AHEE__EE_System__register_shortcodes_modules_and_addons');
923
+		if ( ! empty($class_names)) {
924
+			$msg = __('The following plugins, addons, or modules appear to be incompatible with this version of Event Espresso and were automatically deactivated to avoid fatal errors:', 'event_espresso');
925 925
 			$msg .= '<ul>';
926
-			foreach ( $class_names as $class_name ) {
927
-				$msg .= '<li><b>Event Espresso - ' . str_replace( array( 'EE_', 'EEM_', 'EED_', 'EES_', 'EEW_' ), '', $class_name ) . '</b></li>';
926
+			foreach ($class_names as $class_name) {
927
+				$msg .= '<li><b>Event Espresso - '.str_replace(array('EE_', 'EEM_', 'EED_', 'EES_', 'EEW_'), '', $class_name).'</b></li>';
928 928
 			}
929 929
 			$msg .= '</ul>';
930
-			$msg .= __( 'Compatibility issues can be avoided and/or resolved by keeping addons and plugins updated to the latest version.', 'event_espresso' );
930
+			$msg .= __('Compatibility issues can be avoided and/or resolved by keeping addons and plugins updated to the latest version.', 'event_espresso');
931 931
 			// save list of incompatible addons to wp-options for later use
932
-			add_option( 'ee_incompatible_addons', $class_names, '', 'no' );
933
-			if ( is_admin() ) {
934
-				EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
932
+			add_option('ee_incompatible_addons', $class_names, '', 'no');
933
+			if (is_admin()) {
934
+				EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
935 935
 			}
936 936
 		}
937 937
 	}
@@ -947,26 +947,26 @@  discard block
 block discarded – undo
947 947
 	 *
948 948
 	 * @return void
949 949
 	 */
950
-	public function brew_espresso(){
951
-		do_action( 'AHEE_log', __CLASS__, __FUNCTION__ );
952
-		do_action( 'AHEE__EE_System__brew_espresso__begin', $this );
950
+	public function brew_espresso() {
951
+		do_action('AHEE_log', __CLASS__, __FUNCTION__);
952
+		do_action('AHEE__EE_System__brew_espresso__begin', $this);
953 953
 		// load some final core systems
954
-		add_action( 'init', array( $this, 'set_hooks_for_core' ), 1 );
955
-		add_action( 'init', array( $this, 'perform_activations_upgrades_and_migrations' ), 3 );
956
-		add_action( 'init', array( $this, 'load_CPTs_and_session' ), 5 );
957
-		add_action( 'init', array( $this, 'load_controllers' ), 7 );
958
-		add_action( 'init', array( $this, 'core_loaded_and_ready' ), 9 );
959
-		add_action( 'init', array( $this, 'initialize' ), 10 );
960
-		add_action( 'init', array( $this, 'initialize_last' ), 100 );
961
-		add_action('wp_enqueue_scripts', array( $this, 'wp_enqueue_scripts' ), 25 );
962
-		add_action( 'admin_bar_menu', array( $this, 'espresso_toolbar_items' ), 100 );
963
-
964
-		if ( is_admin() && apply_filters( 'FHEE__EE_System__brew_espresso__load_pue', TRUE )  ) {
954
+		add_action('init', array($this, 'set_hooks_for_core'), 1);
955
+		add_action('init', array($this, 'perform_activations_upgrades_and_migrations'), 3);
956
+		add_action('init', array($this, 'load_CPTs_and_session'), 5);
957
+		add_action('init', array($this, 'load_controllers'), 7);
958
+		add_action('init', array($this, 'core_loaded_and_ready'), 9);
959
+		add_action('init', array($this, 'initialize'), 10);
960
+		add_action('init', array($this, 'initialize_last'), 100);
961
+		add_action('wp_enqueue_scripts', array($this, 'wp_enqueue_scripts'), 25);
962
+		add_action('admin_bar_menu', array($this, 'espresso_toolbar_items'), 100);
963
+
964
+		if (is_admin() && apply_filters('FHEE__EE_System__brew_espresso__load_pue', TRUE)) {
965 965
 			// pew pew pew
966
-			EE_Registry::instance()->load_core( 'PUE' );
967
-			do_action( 'AHEE__EE_System__brew_espresso__after_pue_init' );
966
+			EE_Registry::instance()->load_core('PUE');
967
+			do_action('AHEE__EE_System__brew_espresso__after_pue_init');
968 968
 		}
969
-		do_action( 'AHEE__EE_System__brew_espresso__complete', $this );
969
+		do_action('AHEE__EE_System__brew_espresso__complete', $this);
970 970
 	}
971 971
 
972 972
 
@@ -979,9 +979,9 @@  discard block
 block discarded – undo
979 979
 	 *  	@return 	void
980 980
 	 */
981 981
 	public function set_hooks_for_core() {
982
-		do_action( 'AHEE_log', __CLASS__, __FUNCTION__ );
982
+		do_action('AHEE_log', __CLASS__, __FUNCTION__);
983 983
 		$this->_deactivate_incompatible_addons();
984
-		do_action( 'AHEE__EE_System__set_hooks_for_core' );
984
+		do_action('AHEE__EE_System__set_hooks_for_core');
985 985
 	}
986 986
 
987 987
 
@@ -990,16 +990,16 @@  discard block
 block discarded – undo
990 990
 	 * Using the information gathered in EE_System::_incompatible_addon_error,
991 991
 	 * deactivates any addons considered incompatible with the current version of EE
992 992
 	 */
993
-	private function _deactivate_incompatible_addons(){
994
-		$incompatible_addons = get_option( 'ee_incompatible_addons', array() );
995
-		if ( ! empty( $incompatible_addons )) {
996
-			do_action( 'AHEE_log', __CLASS__, __FUNCTION__, $incompatible_addons, '$incompatible_addons' );
997
-			$active_plugins = get_option( 'active_plugins', array() );
998
-			foreach ( $active_plugins as $active_plugin ) {
999
-				foreach ( $incompatible_addons as $incompatible_addon ) {
1000
-					if ( strpos( $active_plugin,  $incompatible_addon ) !== FALSE ) {
1001
-						unset( $_GET['activate'] );
1002
-						EE_System::deactivate_plugin( $active_plugin );
993
+	private function _deactivate_incompatible_addons() {
994
+		$incompatible_addons = get_option('ee_incompatible_addons', array());
995
+		if ( ! empty($incompatible_addons)) {
996
+			do_action('AHEE_log', __CLASS__, __FUNCTION__, $incompatible_addons, '$incompatible_addons');
997
+			$active_plugins = get_option('active_plugins', array());
998
+			foreach ($active_plugins as $active_plugin) {
999
+				foreach ($incompatible_addons as $incompatible_addon) {
1000
+					if (strpos($active_plugin, $incompatible_addon) !== FALSE) {
1001
+						unset($_GET['activate']);
1002
+						EE_System::deactivate_plugin($active_plugin);
1003 1003
 					}
1004 1004
 				}
1005 1005
 			}
@@ -1016,12 +1016,12 @@  discard block
 block discarded – undo
1016 1016
 	 * @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file
1017 1017
 	 * @return    void
1018 1018
 	 */
1019
-	public static function deactivate_plugin( $plugin_basename = '' ) {
1020
-		do_action( 'AHEE_log', __CLASS__, __FUNCTION__, $plugin_basename, '$plugin_basename' );
1021
-		if ( ! function_exists( 'deactivate_plugins' )) {
1022
-			require_once(ABSPATH . 'wp-admin/includes/plugin.php');
1019
+	public static function deactivate_plugin($plugin_basename = '') {
1020
+		do_action('AHEE_log', __CLASS__, __FUNCTION__, $plugin_basename, '$plugin_basename');
1021
+		if ( ! function_exists('deactivate_plugins')) {
1022
+			require_once(ABSPATH.'wp-admin/includes/plugin.php');
1023 1023
 		}
1024
-		deactivate_plugins( $plugin_basename );
1024
+		deactivate_plugins($plugin_basename);
1025 1025
 	}
1026 1026
 
1027 1027
 
@@ -1033,8 +1033,8 @@  discard block
 block discarded – undo
1033 1033
 	 *  	@return 	void
1034 1034
 	 */
1035 1035
 	public function perform_activations_upgrades_and_migrations() {
1036
-		do_action( 'AHEE_log', __CLASS__, __FUNCTION__ );
1037
-		do_action( 'AHEE__EE_System__perform_activations_upgrades_and_migrations' );
1036
+		do_action('AHEE_log', __CLASS__, __FUNCTION__);
1037
+		do_action('AHEE__EE_System__perform_activations_upgrades_and_migrations');
1038 1038
 	}
1039 1039
 
1040 1040
 
@@ -1046,12 +1046,12 @@  discard block
 block discarded – undo
1046 1046
 	 *  	@return 	void
1047 1047
 	 */
1048 1048
 	public function load_CPTs_and_session() {
1049
-		do_action( 'AHEE_log', __CLASS__, __FUNCTION__ );
1050
-		do_action( 'AHEE__EE_System__load_CPTs_and_session__start' );
1049
+		do_action('AHEE_log', __CLASS__, __FUNCTION__);
1050
+		do_action('AHEE__EE_System__load_CPTs_and_session__start');
1051 1051
 		// register Custom Post Types
1052
-		EE_Registry::instance()->load_core( 'Register_CPTs' );
1052
+		EE_Registry::instance()->load_core('Register_CPTs');
1053 1053
 //		EE_Registry::instance()->load_core( 'Session' );
1054
-		do_action( 'AHEE__EE_System__load_CPTs_and_session__complete' );
1054
+		do_action('AHEE__EE_System__load_CPTs_and_session__complete');
1055 1055
 	}
1056 1056
 
1057 1057
 
@@ -1066,17 +1066,17 @@  discard block
 block discarded – undo
1066 1066
 	* @return void
1067 1067
 	*/
1068 1068
 	public function load_controllers() {
1069
-		do_action( 'AHEE_log', __CLASS__, __FUNCTION__ );
1070
-		do_action( 'AHEE__EE_System__load_controllers__start' );
1069
+		do_action('AHEE_log', __CLASS__, __FUNCTION__);
1070
+		do_action('AHEE__EE_System__load_controllers__start');
1071 1071
 		// let's get it started
1072
-		if ( ! is_admin() && !  EE_Maintenance_Mode::instance()->level() ) {
1073
-			do_action( 'AHEE__EE_System__load_controllers__load_front_controllers' );
1074
-			EE_Registry::instance()->load_core( 'Front_Controller' );
1075
-		} else if ( ! EE_FRONT_AJAX ) {
1076
-			do_action( 'AHEE__EE_System__load_controllers__load_admin_controllers' );
1077
-			EE_Registry::instance()->load_core( 'Admin' );
1072
+		if ( ! is_admin() && ! EE_Maintenance_Mode::instance()->level()) {
1073
+			do_action('AHEE__EE_System__load_controllers__load_front_controllers');
1074
+			EE_Registry::instance()->load_core('Front_Controller');
1075
+		} else if ( ! EE_FRONT_AJAX) {
1076
+			do_action('AHEE__EE_System__load_controllers__load_admin_controllers');
1077
+			EE_Registry::instance()->load_core('Admin');
1078 1078
 		}
1079
-		do_action( 'AHEE__EE_System__load_controllers__complete' );
1079
+		do_action('AHEE__EE_System__load_controllers__complete');
1080 1080
 	}
1081 1081
 
1082 1082
 
@@ -1090,11 +1090,11 @@  discard block
 block discarded – undo
1090 1090
 	* @return void
1091 1091
 	*/
1092 1092
 	public function core_loaded_and_ready() {
1093
-		do_action( 'AHEE_log', __CLASS__, __FUNCTION__ );
1094
-		do_action( 'AHEE__EE_System__core_loaded_and_ready' );
1095
-		do_action( 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons' );
1093
+		do_action('AHEE_log', __CLASS__, __FUNCTION__);
1094
+		do_action('AHEE__EE_System__core_loaded_and_ready');
1095
+		do_action('AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons');
1096 1096
 //		add_action( 'wp_loaded', array( $this, 'set_hooks_for_shortcodes_modules_and_addons' ), 1 );
1097
-		EE_Registry::instance()->load_core( 'Session' );
1097
+		EE_Registry::instance()->load_core('Session');
1098 1098
 	}
1099 1099
 
1100 1100
 
@@ -1108,8 +1108,8 @@  discard block
 block discarded – undo
1108 1108
 	* @return void
1109 1109
 	*/
1110 1110
 	public function initialize() {
1111
-		do_action( 'AHEE_log', __CLASS__, __FUNCTION__ );
1112
-		do_action( 'AHEE__EE_System__initialize' );
1111
+		do_action('AHEE_log', __CLASS__, __FUNCTION__);
1112
+		do_action('AHEE__EE_System__initialize');
1113 1113
 //		EE_Cron_Tasks::check_for_abandoned_transactions( 802 );
1114 1114
 	}
1115 1115
 
@@ -1124,8 +1124,8 @@  discard block
 block discarded – undo
1124 1124
 	* @return void
1125 1125
 	*/
1126 1126
 	public function initialize_last() {
1127
-		do_action( 'AHEE_log', __CLASS__, __FUNCTION__ );
1128
-		do_action( 'AHEE__EE_System__initialize_last' );
1127
+		do_action('AHEE_log', __CLASS__, __FUNCTION__);
1128
+		do_action('AHEE__EE_System__initialize_last');
1129 1129
 	}
1130 1130
 
1131 1131
 
@@ -1157,21 +1157,21 @@  discard block
 block discarded – undo
1157 1157
 	*/
1158 1158
 	public static function do_not_cache() {
1159 1159
 		// set no cache constants
1160
-		if ( ! defined( 'DONOTCACHEPAGE' ) ) {
1161
-			define( 'DONOTCACHEPAGE', true );
1160
+		if ( ! defined('DONOTCACHEPAGE')) {
1161
+			define('DONOTCACHEPAGE', true);
1162 1162
 		}
1163
-		if ( ! defined( 'DONOTCACHCEOBJECT' ) ) {
1164
-			define( 'DONOTCACHCEOBJECT', true );
1163
+		if ( ! defined('DONOTCACHCEOBJECT')) {
1164
+			define('DONOTCACHCEOBJECT', true);
1165 1165
 		}
1166
-		if ( ! defined( 'DONOTCACHEDB' ) ) {
1167
-			define( 'DONOTCACHEDB', true );
1166
+		if ( ! defined('DONOTCACHEDB')) {
1167
+			define('DONOTCACHEDB', true);
1168 1168
 		}
1169 1169
 		// add no cache headers
1170
-		add_action( 'send_headers' , array( 'EE_System', 'nocache_headers' ), 10 );
1170
+		add_action('send_headers', array('EE_System', 'nocache_headers'), 10);
1171 1171
 		// plus a little extra for nginx
1172
-		add_filter( 'nocache_headers', array( 'EE_System', 'nocache_headers_nginx' ), 10, 1 );
1172
+		add_filter('nocache_headers', array('EE_System', 'nocache_headers_nginx'), 10, 1);
1173 1173
 		// prevent browsers from prefetching of the rel='next' link, because it may contain content that interferes with the registration process
1174
-		remove_action( 'wp_head', 'adjacent_posts_rel_link_wp_head' );
1174
+		remove_action('wp_head', 'adjacent_posts_rel_link_wp_head');
1175 1175
 	}
1176 1176
 
1177 1177
 
@@ -1183,7 +1183,7 @@  discard block
 block discarded – undo
1183 1183
 	 * @param $headers
1184 1184
 	 * @return    array
1185 1185
 	 */
1186
-	public static function nocache_headers_nginx ( $headers ) {
1186
+	public static function nocache_headers_nginx($headers) {
1187 1187
 		$headers['X-Accel-Expires'] = 0;
1188 1188
 		return $headers;
1189 1189
 	}
@@ -1209,13 +1209,13 @@  discard block
 block discarded – undo
1209 1209
 	 * @param $admin_bar
1210 1210
 	 * @return    void
1211 1211
 	 */
1212
-	public function espresso_toolbar_items( $admin_bar ) {
1212
+	public function espresso_toolbar_items($admin_bar) {
1213 1213
 		// if in full M-Mode, or its an AJAX request, or user is NOT an admin
1214
-		if ( EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance || defined( 'DOING_AJAX' ) || ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_ee', 'ee_admin_bar_menu_top_level' )) {
1214
+		if (EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance || defined('DOING_AJAX') || ! EE_Registry::instance()->CAP->current_user_can('ee_read_ee', 'ee_admin_bar_menu_top_level')) {
1215 1215
 			return;
1216 1216
 		}
1217
-		do_action( 'AHEE_log', __CLASS__, __FUNCTION__ );
1218
-		EE_Registry::instance()->load_helper( 'URL' );
1217
+		do_action('AHEE_log', __CLASS__, __FUNCTION__);
1218
+		EE_Registry::instance()->load_helper('URL');
1219 1219
 		$menu_class = 'espresso_menu_item_class';
1220 1220
 		//we don't use the constants EVENTS_ADMIN_URL or REG_ADMIN_URL
1221 1221
 		//because they're only defined in each of their respective constructors
@@ -1226,20 +1226,20 @@  discard block
 block discarded – undo
1226 1226
 		//Top Level
1227 1227
 		$admin_bar->add_menu(array(
1228 1228
 				'id' => 'espresso-toolbar',
1229
-				'title' => '<span class="ee-icon ee-icon-ee-cup-thick ee-icon-size-20"></span><span class="ab-label">' . _x('Event Espresso', 'admin bar menu group label', 'event_espresso') . '</span>',
1229
+				'title' => '<span class="ee-icon ee-icon-ee-cup-thick ee-icon-size-20"></span><span class="ab-label">'._x('Event Espresso', 'admin bar menu group label', 'event_espresso').'</span>',
1230 1230
 				'href' => $events_admin_url,
1231 1231
 				'meta' => array(
1232 1232
 						'title' => __('Event Espresso', 'event_espresso'),
1233
-						'class' => $menu_class . 'first'
1233
+						'class' => $menu_class.'first'
1234 1234
 				),
1235 1235
 		));
1236 1236
 
1237 1237
 		//Events
1238
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events' ) ) {
1238
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events')) {
1239 1239
 			$admin_bar->add_menu(array(
1240 1240
 					'id' => 'espresso-toolbar-events',
1241 1241
 					'parent' => 'espresso-toolbar',
1242
-					'title' => __( 'Events', 'event_espresso' ),
1242
+					'title' => __('Events', 'event_espresso'),
1243 1243
 					'href' => $events_admin_url,
1244 1244
 					'meta' => array(
1245 1245
 							'title' => __('Events', 'event_espresso'),
@@ -1250,13 +1250,13 @@  discard block
 block discarded – undo
1250 1250
 		}
1251 1251
 
1252 1252
 
1253
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_edit_events', 'ee_admin_bar_menu_espresso-toolbar-events-new' ) ) {
1253
+		if (EE_Registry::instance()->CAP->current_user_can('ee_edit_events', 'ee_admin_bar_menu_espresso-toolbar-events-new')) {
1254 1254
 			//Events Add New
1255 1255
 			$admin_bar->add_menu(array(
1256 1256
 					'id' => 'espresso-toolbar-events-new',
1257 1257
 					'parent' => 'espresso-toolbar-events',
1258 1258
 					'title' => __('Add New', 'event_espresso'),
1259
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'create_new' ), $events_admin_url ),
1259
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'create_new'), $events_admin_url),
1260 1260
 					'meta' => array(
1261 1261
 							'title' => __('Add New', 'event_espresso'),
1262 1262
 							'target' => '',
@@ -1266,11 +1266,11 @@  discard block
 block discarded – undo
1266 1266
 		}
1267 1267
 
1268 1268
 		//Events View
1269
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-view' ) ) {
1269
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-view')) {
1270 1270
 			$admin_bar->add_menu(array(
1271 1271
 					'id' => 'espresso-toolbar-events-view',
1272 1272
 					'parent' => 'espresso-toolbar-events',
1273
-					'title' => __( 'View', 'event_espresso' ),
1273
+					'title' => __('View', 'event_espresso'),
1274 1274
 					'href' => $events_admin_url,
1275 1275
 					'meta' => array(
1276 1276
 							'title' => __('View', 'event_espresso'),
@@ -1280,12 +1280,12 @@  discard block
 block discarded – undo
1280 1280
 			));
1281 1281
 		}
1282 1282
 
1283
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-all' ) ) {
1283
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-all')) {
1284 1284
 			//Events View All
1285 1285
 			$admin_bar->add_menu(array(
1286 1286
 					'id' => 'espresso-toolbar-events-all',
1287 1287
 					'parent' => 'espresso-toolbar-events-view',
1288
-					'title' => __( 'All', 'event_espresso' ),
1288
+					'title' => __('All', 'event_espresso'),
1289 1289
 					'href' => $events_admin_url,
1290 1290
 					'meta' => array(
1291 1291
 							'title' => __('All', 'event_espresso'),
@@ -1296,13 +1296,13 @@  discard block
 block discarded – undo
1296 1296
 		}
1297 1297
 
1298 1298
 
1299
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-today' ) ) {
1299
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-today')) {
1300 1300
 			//Events View Today
1301 1301
 			$admin_bar->add_menu(array(
1302 1302
 					'id' => 'espresso-toolbar-events-today',
1303 1303
 					'parent' => 'espresso-toolbar-events-view',
1304 1304
 					'title' => __('Today', 'event_espresso'),
1305
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today' ), $events_admin_url ),
1305
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today'), $events_admin_url),
1306 1306
 					'meta' => array(
1307 1307
 							'title' => __('Today', 'event_espresso'),
1308 1308
 							'target' => '',
@@ -1312,13 +1312,13 @@  discard block
 block discarded – undo
1312 1312
 		}
1313 1313
 
1314 1314
 
1315
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-month' ) ) {
1315
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-month')) {
1316 1316
 			//Events View This Month
1317 1317
 			$admin_bar->add_menu(array(
1318 1318
 					'id' => 'espresso-toolbar-events-month',
1319 1319
 					'parent' => 'espresso-toolbar-events-view',
1320
-					'title' => __( 'This Month', 'event_espresso'),
1321
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month' ), $events_admin_url ),
1320
+					'title' => __('This Month', 'event_espresso'),
1321
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month'), $events_admin_url),
1322 1322
 					'meta' => array(
1323 1323
 							'title' => __('This Month', 'event_espresso'),
1324 1324
 							'target' => '',
@@ -1328,11 +1328,11 @@  discard block
 block discarded – undo
1328 1328
 		}
1329 1329
 
1330 1330
 		//Registration Overview
1331
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations' ) ) {
1331
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations')) {
1332 1332
 			$admin_bar->add_menu(array(
1333 1333
 					'id' => 'espresso-toolbar-registrations',
1334 1334
 					'parent' => 'espresso-toolbar',
1335
-					'title' => __( 'Registrations', 'event_espresso' ),
1335
+					'title' => __('Registrations', 'event_espresso'),
1336 1336
 					'href' => $reg_admin_url,
1337 1337
 					'meta' => array(
1338 1338
 							'title' => __('Registrations', 'event_espresso'),
@@ -1343,12 +1343,12 @@  discard block
 block discarded – undo
1343 1343
 		}
1344 1344
 
1345 1345
 		//Registration Overview Today
1346
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today' ) ) {
1346
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today')) {
1347 1347
 			$admin_bar->add_menu(array(
1348 1348
 					'id' => 'espresso-toolbar-registrations-today',
1349 1349
 					'parent' => 'espresso-toolbar-registrations',
1350
-					'title' => __( 'Today', 'event_espresso'),
1351
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today' ), $reg_admin_url ),
1350
+					'title' => __('Today', 'event_espresso'),
1351
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today'), $reg_admin_url),
1352 1352
 					'meta' => array(
1353 1353
 							'title' => __('Today', 'event_espresso'),
1354 1354
 							'target' => '',
@@ -1358,14 +1358,14 @@  discard block
 block discarded – undo
1358 1358
 		}
1359 1359
 
1360 1360
 		//Registration Overview Today Completed
1361
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-approved' ) ) {
1361
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-approved')) {
1362 1362
 			$admin_bar->add_menu(array(
1363 1363
 					'id' => 'espresso-toolbar-registrations-today-approved',
1364 1364
 					'parent' => 'espresso-toolbar-registrations-today',
1365
-					'title' => __( 'Approved', 'event_espresso' ),
1366
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_approved ), $reg_admin_url ),
1365
+					'title' => __('Approved', 'event_espresso'),
1366
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_approved), $reg_admin_url),
1367 1367
 					'meta' => array(
1368
-							'title' => __('Approved', 'event_espresso' ),
1368
+							'title' => __('Approved', 'event_espresso'),
1369 1369
 							'target' => '',
1370 1370
 							'class' => $menu_class
1371 1371
 					),
@@ -1373,14 +1373,14 @@  discard block
 block discarded – undo
1373 1373
 		}
1374 1374
 
1375 1375
 		//Registration Overview Today Pending\
1376
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-pending' ) ) {
1376
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-pending')) {
1377 1377
 			$admin_bar->add_menu(array(
1378 1378
 					'id' => 'espresso-toolbar-registrations-today-pending',
1379 1379
 					'parent' => 'espresso-toolbar-registrations-today',
1380
-					'title' => __( 'Pending', 'event_espresso' ),
1381
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today', 'reg_status'=>EEM_Registration::status_id_pending_payment ), $reg_admin_url ),
1380
+					'title' => __('Pending', 'event_espresso'),
1381
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today', 'reg_status'=>EEM_Registration::status_id_pending_payment), $reg_admin_url),
1382 1382
 					'meta' => array(
1383
-							'title' => __('Pending Payment', 'event_espresso' ),
1383
+							'title' => __('Pending Payment', 'event_espresso'),
1384 1384
 							'target' => '',
1385 1385
 							'class' => $menu_class
1386 1386
 					),
@@ -1388,14 +1388,14 @@  discard block
 block discarded – undo
1388 1388
 		}
1389 1389
 
1390 1390
 		//Registration Overview Today Incomplete
1391
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-not-approved' ) ) {
1391
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-not-approved')) {
1392 1392
 			$admin_bar->add_menu(array(
1393 1393
 					'id' => 'espresso-toolbar-registrations-today-not-approved',
1394 1394
 					'parent' => 'espresso-toolbar-registrations-today',
1395
-					'title' => __( 'Not Approved', 'event_espresso' ),
1396
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_not_approved ), $reg_admin_url ),
1395
+					'title' => __('Not Approved', 'event_espresso'),
1396
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_not_approved), $reg_admin_url),
1397 1397
 					'meta' => array(
1398
-							'title' => __('Not Approved', 'event_espresso' ),
1398
+							'title' => __('Not Approved', 'event_espresso'),
1399 1399
 							'target' => '',
1400 1400
 							'class' => $menu_class
1401 1401
 					),
@@ -1403,12 +1403,12 @@  discard block
 block discarded – undo
1403 1403
 		}
1404 1404
 
1405 1405
 		//Registration Overview Today Incomplete
1406
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-cancelled' ) ) {
1406
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-cancelled')) {
1407 1407
 			$admin_bar->add_menu(array(
1408 1408
 					'id' => 'espresso-toolbar-registrations-today-cancelled',
1409 1409
 					'parent' => 'espresso-toolbar-registrations-today',
1410
-					'title' => __( 'Cancelled', 'event_espresso'),
1411
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_cancelled ), $reg_admin_url ),
1410
+					'title' => __('Cancelled', 'event_espresso'),
1411
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_cancelled), $reg_admin_url),
1412 1412
 					'meta' => array(
1413 1413
 							'title' => __('Cancelled', 'event_espresso'),
1414 1414
 							'target' => '',
@@ -1418,12 +1418,12 @@  discard block
 block discarded – undo
1418 1418
 		}
1419 1419
 
1420 1420
 		//Registration Overview This Month
1421
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month' ) ) {
1421
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month')) {
1422 1422
 			$admin_bar->add_menu(array(
1423 1423
 					'id' => 'espresso-toolbar-registrations-month',
1424 1424
 					'parent' => 'espresso-toolbar-registrations',
1425
-					'title' => __( 'This Month', 'event_espresso' ),
1426
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month' ), $reg_admin_url ),
1425
+					'title' => __('This Month', 'event_espresso'),
1426
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month'), $reg_admin_url),
1427 1427
 					'meta' => array(
1428 1428
 							'title' => __('This Month', 'event_espresso'),
1429 1429
 							'target' => '',
@@ -1433,12 +1433,12 @@  discard block
 block discarded – undo
1433 1433
 		}
1434 1434
 
1435 1435
 		//Registration Overview This Month Approved
1436
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-approved' ) ) {
1436
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-approved')) {
1437 1437
 			$admin_bar->add_menu(array(
1438 1438
 					'id' => 'espresso-toolbar-registrations-month-approved',
1439 1439
 					'parent' => 'espresso-toolbar-registrations-month',
1440
-					'title' => __( 'Approved', 'event_espresso' ),
1441
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_approved ), $reg_admin_url ),
1440
+					'title' => __('Approved', 'event_espresso'),
1441
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_approved), $reg_admin_url),
1442 1442
 					'meta' => array(
1443 1443
 							'title' => __('Approved', 'event_espresso'),
1444 1444
 							'target' => '',
@@ -1448,12 +1448,12 @@  discard block
 block discarded – undo
1448 1448
 		}
1449 1449
 
1450 1450
 		//Registration Overview This Month Pending
1451
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-pending' ) ) {
1451
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-pending')) {
1452 1452
 			$admin_bar->add_menu(array(
1453 1453
 					'id' => 'espresso-toolbar-registrations-month-pending',
1454 1454
 					'parent' => 'espresso-toolbar-registrations-month',
1455
-					'title' => __( 'Pending', 'event_espresso'),
1456
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_pending_payment ), $reg_admin_url ),
1455
+					'title' => __('Pending', 'event_espresso'),
1456
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_pending_payment), $reg_admin_url),
1457 1457
 					'meta' => array(
1458 1458
 							'title' => __('Pending', 'event_espresso'),
1459 1459
 							'target' => '',
@@ -1463,14 +1463,14 @@  discard block
 block discarded – undo
1463 1463
 		}
1464 1464
 
1465 1465
 		//Registration Overview This Month Not Approved
1466
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-not-approved' ) ) {
1466
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-not-approved')) {
1467 1467
 			$admin_bar->add_menu(array(
1468 1468
 					'id' => 'espresso-toolbar-registrations-month-not-approved',
1469 1469
 					'parent' => 'espresso-toolbar-registrations-month',
1470
-					'title' => __( 'Not Approved', 'event_espresso'),
1471
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_not_approved ), $reg_admin_url ),
1470
+					'title' => __('Not Approved', 'event_espresso'),
1471
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_not_approved), $reg_admin_url),
1472 1472
 					'meta' => array(
1473
-							'title' => __('Not Approved', 'event_espresso' ),
1473
+							'title' => __('Not Approved', 'event_espresso'),
1474 1474
 							'target' => '',
1475 1475
 							'class' => $menu_class
1476 1476
 					),
@@ -1479,12 +1479,12 @@  discard block
 block discarded – undo
1479 1479
 
1480 1480
 
1481 1481
 		//Registration Overview This Month Cancelled
1482
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-cancelled' ) ) {
1482
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-cancelled')) {
1483 1483
 			$admin_bar->add_menu(array(
1484 1484
 					'id' => 'espresso-toolbar-registrations-month-cancelled',
1485 1485
 					'parent' => 'espresso-toolbar-registrations-month',
1486 1486
 					'title' => __('Cancelled', 'event_espresso'),
1487
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_cancelled ), $reg_admin_url ),
1487
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_cancelled), $reg_admin_url),
1488 1488
 					'meta' => array(
1489 1489
 							'title' => __('Cancelled', 'event_espresso'),
1490 1490
 							'target' => '',
@@ -1505,8 +1505,8 @@  discard block
 block discarded – undo
1505 1505
 	 * @param  array  $exclude_array any existing pages being excluded are in this array.
1506 1506
 	 * @return array
1507 1507
 	 */
1508
-	public function remove_pages_from_wp_list_pages( $exclude_array ) {
1509
-		return  array_merge( $exclude_array, EE_Registry::instance()->CFG->core->get_critical_pages_array() );
1508
+	public function remove_pages_from_wp_list_pages($exclude_array) {
1509
+		return  array_merge($exclude_array, EE_Registry::instance()->CFG->core->get_critical_pages_array());
1510 1510
 	}
1511 1511
 
1512 1512
 
@@ -1526,11 +1526,11 @@  discard block
 block discarded – undo
1526 1526
 	 */
1527 1527
 	public function wp_enqueue_scripts() {
1528 1528
 		// unlike other systems, EE_System_scripts loading is turned ON by default, but prior to the init hook, can be turned off via: add_filter( 'FHEE_load_EE_System_scripts', '__return_false' );
1529
-		if ( apply_filters( 'FHEE_load_EE_System_scripts', TRUE ) ) {
1529
+		if (apply_filters('FHEE_load_EE_System_scripts', TRUE)) {
1530 1530
 			// jquery_validate loading is turned OFF by default, but prior to the wp_enqueue_scripts hook, can be turned back on again via:  add_filter( 'FHEE_load_jquery_validate', '__return_true' );
1531
-			if ( apply_filters( 'FHEE_load_jquery_validate', FALSE ) ) {
1531
+			if (apply_filters('FHEE_load_jquery_validate', FALSE)) {
1532 1532
 				// register jQuery Validate
1533
-				wp_register_script( 'jquery-validate', EE_GLOBAL_ASSETS_URL . 'scripts/jquery.validate.min.js', array('jquery'), '1.11.1', TRUE );
1533
+				wp_register_script('jquery-validate', EE_GLOBAL_ASSETS_URL.'scripts/jquery.validate.min.js', array('jquery'), '1.11.1', TRUE);
1534 1534
 			}
1535 1535
 		}
1536 1536
 	}
Please login to merge, or discard this patch.
Indentation   +73 added lines, -73 removed lines patch added patch discarded remove patch
@@ -468,13 +468,13 @@  discard block
 block discarded – undo
468 468
 
469 469
 
470 470
 	/**
471
-	* load_espresso_addons
472
-	*
473
-	* allow addons to load first so that they can set hooks for running DMS's, etc
474
-	*
475
-	* @access public
476
-	* @return void
477
-	*/
471
+	 * load_espresso_addons
472
+	 *
473
+	 * allow addons to load first so that they can set hooks for running DMS's, etc
474
+	 *
475
+	 * @access public
476
+	 * @return void
477
+	 */
478 478
 	public function load_espresso_addons() {
479 479
 		// set autoloaders for all of the classes implementing EEI_Plugin_API
480 480
 		// which provide helpers for EE plugin authors to more easily register certain components with EE.
@@ -498,14 +498,14 @@  discard block
 block discarded – undo
498 498
 		}
499 499
 	}
500 500
 	/**
501
-	* detect_if_activation_or_upgrade
502
-	*
503
-	* Takes care of detecting whether this is a brand new install or code upgrade,
504
-	* and either setting up the DB or setting up maintenance mode etc.
505
-	*
506
-	* @access private
507
-	* @return void
508
-	*/
501
+	 * detect_if_activation_or_upgrade
502
+	 *
503
+	 * Takes care of detecting whether this is a brand new install or code upgrade,
504
+	 * and either setting up the DB or setting up maintenance mode etc.
505
+	 *
506
+	 * @access private
507
+	 * @return void
508
+	 */
509 509
 	public function detect_if_activation_or_upgrade() {
510 510
 		do_action('AHEE__EE_System___detect_if_activation_or_upgrade__begin');
511 511
 
@@ -803,11 +803,11 @@  discard block
 block discarded – undo
803 803
 			$query_params =  array( 'page' => 'espresso_about' );
804 804
 
805 805
 			if ( EE_System::instance()->detect_req_type() == EE_System::req_type_new_activation ) {
806
-			    $query_params['new_activation'] = TRUE;
806
+				$query_params['new_activation'] = TRUE;
807 807
 			}
808 808
 
809 809
 			if ( EE_System::instance()->detect_req_type() == EE_System::req_type_reactivation ) {
810
-			    $query_params['reactivation'] = TRUE;
810
+				$query_params['reactivation'] = TRUE;
811 811
 			}
812 812
 			$url = add_query_arg( $query_params, admin_url( 'admin.php' ) );
813 813
 			wp_safe_redirect( $url );
@@ -888,13 +888,13 @@  discard block
 block discarded – undo
888 888
 
889 889
 
890 890
 	/**
891
-	* register_shortcodes_modules_and_widgets
892
-	*
893
-	* generate lists of shortcodes and modules, then verify paths and classes
894
-	*
895
-	* @access public
896
-	* @return void
897
-	*/
891
+	 * register_shortcodes_modules_and_widgets
892
+	 *
893
+	 * generate lists of shortcodes and modules, then verify paths and classes
894
+	 *
895
+	 * @access public
896
+	 * @return void
897
+	 */
898 898
 	public function register_shortcodes_modules_and_widgets() {
899 899
 		do_action( 'AHEE__EE_System__register_shortcodes_modules_and_widgets' );
900 900
 		// check for addons using old hookpoint
@@ -905,11 +905,11 @@  discard block
 block discarded – undo
905 905
 
906 906
 
907 907
 	/**
908
-	* _incompatible_addon_error
909
-	*
910
-	* @access public
911
-	* @return void
912
-	*/
908
+	 * _incompatible_addon_error
909
+	 *
910
+	 * @access public
911
+	 * @return void
912
+	 */
913 913
 	private function _incompatible_addon_error() {
914 914
 		// get array of classes hooking into here
915 915
 		$class_names = EEH_Class_Tools::get_class_names_for_all_callbacks_on_hook( 'AHEE__EE_System__register_shortcodes_modules_and_addons' );
@@ -1048,14 +1048,14 @@  discard block
 block discarded – undo
1048 1048
 
1049 1049
 
1050 1050
 	/**
1051
-	* load_controllers
1052
-	*
1053
-	* this is the best place to load any additional controllers that needs access to EE core.
1054
-	* it is expected that all basic core EE systems, that are not dependant on the current request are loaded at this time
1055
-	*
1056
-	* @access public
1057
-	* @return void
1058
-	*/
1051
+	 * load_controllers
1052
+	 *
1053
+	 * this is the best place to load any additional controllers that needs access to EE core.
1054
+	 * it is expected that all basic core EE systems, that are not dependant on the current request are loaded at this time
1055
+	 *
1056
+	 * @access public
1057
+	 * @return void
1058
+	 */
1059 1059
 	public function load_controllers() {
1060 1060
 		do_action( 'AHEE__EE_System__load_controllers__start' );
1061 1061
 		// let's get it started
@@ -1072,13 +1072,13 @@  discard block
 block discarded – undo
1072 1072
 
1073 1073
 
1074 1074
 	/**
1075
-	* core_loaded_and_ready
1076
-	*
1077
-	* all of the basic EE core should be loaded at this point and available regardless of M-Mode
1078
-	*
1079
-	* @access public
1080
-	* @return void
1081
-	*/
1075
+	 * core_loaded_and_ready
1076
+	 *
1077
+	 * all of the basic EE core should be loaded at this point and available regardless of M-Mode
1078
+	 *
1079
+	 * @access public
1080
+	 * @return void
1081
+	 */
1082 1082
 	public function core_loaded_and_ready() {
1083 1083
 		do_action( 'AHEE__EE_System__core_loaded_and_ready' );
1084 1084
 		do_action( 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons' );
@@ -1089,13 +1089,13 @@  discard block
 block discarded – undo
1089 1089
 
1090 1090
 
1091 1091
 	/**
1092
-	* initialize
1093
-	*
1094
-	* this is the best place to begin initializing client code
1095
-	*
1096
-	* @access public
1097
-	* @return void
1098
-	*/
1092
+	 * initialize
1093
+	 *
1094
+	 * this is the best place to begin initializing client code
1095
+	 *
1096
+	 * @access public
1097
+	 * @return void
1098
+	 */
1099 1099
 	public function initialize() {
1100 1100
 		do_action( 'AHEE__EE_System__initialize' );
1101 1101
 //		EE_Cron_Tasks::check_for_abandoned_transactions( 802 );
@@ -1104,13 +1104,13 @@  discard block
 block discarded – undo
1104 1104
 
1105 1105
 
1106 1106
 	/**
1107
-	* initialize_last
1108
-	*
1109
-	* this is run really late during the WP init hookpoint, and ensures that mostly everything else that needs to initialize has done so
1110
-	*
1111
-	* @access public
1112
-	* @return void
1113
-	*/
1107
+	 * initialize_last
1108
+	 *
1109
+	 * this is run really late during the WP init hookpoint, and ensures that mostly everything else that needs to initialize has done so
1110
+	 *
1111
+	 * @access public
1112
+	 * @return void
1113
+	 */
1114 1114
 	public function initialize_last() {
1115 1115
 		do_action( 'AHEE__EE_System__initialize_last' );
1116 1116
 	}
@@ -1119,14 +1119,14 @@  discard block
 block discarded – undo
1119 1119
 
1120 1120
 
1121 1121
 	/**
1122
-	* set_hooks_for_shortcodes_modules_and_addons
1123
-	*
1124
-	* this is the best place for other systems to set callbacks for hooking into other parts of EE
1125
-	* this happens at the very beginning of the wp_loaded hookpoint
1126
-	*
1127
-	* @access public
1128
-	* @return void
1129
-	*/
1122
+	 * set_hooks_for_shortcodes_modules_and_addons
1123
+	 *
1124
+	 * this is the best place for other systems to set callbacks for hooking into other parts of EE
1125
+	 * this happens at the very beginning of the wp_loaded hookpoint
1126
+	 *
1127
+	 * @access public
1128
+	 * @return void
1129
+	 */
1130 1130
 	public function set_hooks_for_shortcodes_modules_and_addons() {
1131 1131
 //		do_action( 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons' );
1132 1132
 	}
@@ -1135,13 +1135,13 @@  discard block
 block discarded – undo
1135 1135
 
1136 1136
 
1137 1137
 	/**
1138
-	* do_not_cache
1139
-	*
1140
-	* sets no cache headers and defines no cache constants for WP plugins
1141
-	*
1142
-	* @access public
1143
-	* @return void
1144
-	*/
1138
+	 * do_not_cache
1139
+	 *
1140
+	 * sets no cache headers and defines no cache constants for WP plugins
1141
+	 *
1142
+	 * @access public
1143
+	 * @return void
1144
+	 */
1145 1145
 	public static function do_not_cache() {
1146 1146
 		// set no cache constants
1147 1147
 		if ( ! defined( 'DONOTCACHEPAGE' ) ) {
Please login to merge, or discard this patch.
core/admin/EE_Admin.core.php 3 patches
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -24,10 +24,10 @@  discard block
 block discarded – undo
24 24
 final class EE_Admin {
25 25
 
26 26
    /**
27
-     * 	EE_Admin Object
28
-     * 	@private _instance
29
-	 * 	@private 	protected
30
-     */
27
+    * 	EE_Admin Object
28
+    * 	@private _instance
29
+    * 	@private 	protected
30
+    */
31 31
 	private static $_instance = NULL;
32 32
 
33 33
 	/**
@@ -56,8 +56,8 @@  discard block
 block discarded – undo
56 56
 
57 57
 
58 58
    /**
59
-     * class constructor
60
-     */
59
+    * class constructor
60
+    */
61 61
 	protected function __construct() {
62 62
 		// define global EE_Admin constants
63 63
 		$this->_define_all_constants();
@@ -168,11 +168,11 @@  discard block
 block discarded – undo
168 168
 
169 169
 
170 170
 	/**
171
-	* init- should fire after shortcode, module,  addon, other plugin (default priority), and even EE_Front_Controller's init phases have run
172
-	*
173
-	* @access public
174
-	* @return void
175
-	*/
171
+	 * init- should fire after shortcode, module,  addon, other plugin (default priority), and even EE_Front_Controller's init phases have run
172
+	 *
173
+	 * @access public
174
+	 * @return void
175
+	 */
176 176
 	public function init() {
177 177
 
178 178
 		//only enable most of the EE_Admin IF we're not in full maintenance mode
@@ -463,11 +463,11 @@  discard block
 block discarded – undo
463 463
 
464 464
 
465 465
 	/**
466
-	* admin_init
467
-	*
468
-	* @access public
469
-	* @return void
470
-	*/
466
+	 * admin_init
467
+	 *
468
+	 * @access public
469
+	 * @return void
470
+	 */
471 471
 	public function admin_init() {
472 472
 
473 473
 		/**
@@ -624,11 +624,11 @@  discard block
 block discarded – undo
624 624
 
625 625
 
626 626
 	/**
627
-	* 	dismiss_persistent_admin_notice
628
-	*
629
-	*	@access 	public
630
-	* 	@return 		void
631
-	*/
627
+	 * 	dismiss_persistent_admin_notice
628
+	 *
629
+	 *	@access 	public
630
+	 * 	@return 		void
631
+	 */
632 632
 	public function dismiss_ee_nag_notice_callback() {
633 633
 		EE_Error::dismiss_persistent_admin_notice();
634 634
 	}
Please login to merge, or discard this patch.
Braces   +19 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,8 +222,9 @@  discard block
 block discarded – undo
220 222
 	 */
221 223
 	public function remove_pages_from_nav_menu( $post_type ) {
222 224
 		//if this isn't the "pages" post type let's get out
223
-		if ( $post_type->name !== 'page' )
224
-			return $post_type;
225
+		if ( $post_type->name !== 'page' ) {
226
+					return $post_type;
227
+		}
225 228
 
226 229
 		$critical_pages = EE_Registry::instance()->CFG->core->get_critical_pages_array();
227 230
 
@@ -240,8 +243,9 @@  discard block
 block discarded – undo
240 243
 	 */
241 244
 	public function enable_hidden_ee_nav_menu_metaboxes() {
242 245
 		global $wp_meta_boxes, $pagenow;
243
-		if ( ! is_array($wp_meta_boxes) || $pagenow !== 'nav-menus.php' )
244
-			return;
246
+		if ( ! is_array($wp_meta_boxes) || $pagenow !== 'nav-menus.php' ) {
247
+					return;
248
+		}
245 249
 
246 250
 		$initial_meta_boxes = apply_filters( 'FHEE__EE_Admin__enable_hidden_ee_nav_menu_boxes__initial_meta_boxes', array( 'nav-menu-theme-locations', 'add-page', 'add-custom-links', 'add-category', 'add-espresso_events', 'add-espresso_venues', 'add-espresso_event_categories', 'add-espresso_venue_categories' ) );
247 251
 		$hidden_meta_boxes = array();
@@ -296,8 +300,9 @@  discard block
 block discarded – undo
296 300
 	 * @return string  the (maybe) modified link
297 301
 	 */
298 302
 	public function modify_edit_post_link( $link, $id, $context ) {
299
-		if ( ! $post = get_post( $id ) )
300
-			return $link;
303
+		if ( ! $post = get_post( $id ) ) {
304
+					return $link;
305
+		}
301 306
 
302 307
 		if ( $post->post_type == 'espresso_attendees' ) {
303 308
 			$query_args = array(
@@ -337,7 +342,10 @@  discard block
 block discarded – undo
337 342
 		<div id="posttype-extra-nav-menu-pages" class="posttypediv">
338 343
 			<ul id="posttype-extra-nav-menu-pages-tabs" class="posttype-tabs add-menu-item-tabs">
339 344
 				<li <?php echo ( 'event-archives' == $current_tab ? ' class="tabs"' : '' ); ?>>
340
-					<a class="nav-tab-link" data-type="tabs-panel-posttype-extra-nav-menu-pages-event-archives" href="<?php if ( $nav_menu_selected_id ) echo esc_url(add_query_arg('extra-nav-menu-pages-tab', 'event-archives', remove_query_arg($removed_args))); ?>#tabs-panel-posttype-extra-nav-menu-pages-event-archives">
345
+					<a class="nav-tab-link" data-type="tabs-panel-posttype-extra-nav-menu-pages-event-archives" href="<?php if ( $nav_menu_selected_id ) {
346
+	echo esc_url(add_query_arg('extra-nav-menu-pages-tab', 'event-archives', remove_query_arg($removed_args)));
347
+}
348
+?>#tabs-panel-posttype-extra-nav-menu-pages-event-archives">
341 349
 						<?php _e( 'Event Archive Pages', 'event_espresso' ); ?>
342 350
 					</a>
343 351
 				</li>
@@ -864,8 +872,9 @@  discard block
 block discarded – undo
864 872
 	 */
865 873
 	public static function register_ee_admin_page( $page_basename, $page_path, $config = array() ) {
866 874
 		EE_Error::doing_it_wrong( __METHOD__, sprintf( __('Usage is deprecated.  Use EE_Register_Admin_Page::register() for registering the %s admin page.', 'event_espresso'), $page_basename), '4.3' );
867
-		if ( class_exists( 'EE_Register_Admin_Page' ) )
868
-			$config['page_path'] = $page_path;
875
+		if ( class_exists( 'EE_Register_Admin_Page' ) ) {
876
+					$config['page_path'] = $page_path;
877
+		}
869 878
 			EE_Register_Admin_Page::register( $page_basename, $config );
870 879
 	}
871 880
 
Please login to merge, or discard this patch.
Spacing   +150 added lines, -150 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 	 */
48 48
 	public static function instance() {
49 49
 		// check if class object is instantiated
50
-		if (  ! self::$_instance instanceof EE_Admin ) {
50
+		if ( ! self::$_instance instanceof EE_Admin) {
51 51
 			self::$_instance = new self();
52 52
 		}
53 53
 		return self::$_instance;
@@ -62,25 +62,25 @@  discard block
 block discarded – undo
62 62
 		// define global EE_Admin constants
63 63
 		$this->_define_all_constants();
64 64
 		// set autoloaders for our admin page classes based on included path information
65
-		EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder( EE_ADMIN );
65
+		EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder(EE_ADMIN);
66 66
 		// admin hooks
67
-		add_filter( 'plugin_action_links', array( $this, 'filter_plugin_actions' ), 10, 2 );
67
+		add_filter('plugin_action_links', array($this, 'filter_plugin_actions'), 10, 2);
68 68
 		// load EE_Request_Handler early
69
-		add_action( 'AHEE__EE_System__core_loaded_and_ready', array( $this, 'get_request' ));
70
-		add_action( 'AHEE__EE_System__initialize_last', array( $this, 'init' ));
71
-		add_action( 'AHEE__EE_Admin_Page__route_admin_request', array( $this, 'route_admin_request' ), 100, 2 );
72
-		add_action( 'wp_loaded', array( $this, 'wp_loaded' ), 100 );
73
-		add_action( 'admin_init', array( $this, 'admin_init' ), 100 );
74
-		add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_scripts' ), 20 );
75
-		add_action( 'admin_notices', array( $this, 'display_admin_notices' ), 10 );
76
-		add_action( 'network_admin_notices', array( $this, 'display_admin_notices' ), 10 );
77
-		add_filter( 'pre_update_option', array( $this, 'check_for_invalid_datetime_formats' ), 100, 2 );
78
-		add_filter('admin_footer_text', array( $this, 'espresso_admin_footer' ));
69
+		add_action('AHEE__EE_System__core_loaded_and_ready', array($this, 'get_request'));
70
+		add_action('AHEE__EE_System__initialize_last', array($this, 'init'));
71
+		add_action('AHEE__EE_Admin_Page__route_admin_request', array($this, 'route_admin_request'), 100, 2);
72
+		add_action('wp_loaded', array($this, 'wp_loaded'), 100);
73
+		add_action('admin_init', array($this, 'admin_init'), 100);
74
+		add_action('admin_enqueue_scripts', array($this, 'enqueue_admin_scripts'), 20);
75
+		add_action('admin_notices', array($this, 'display_admin_notices'), 10);
76
+		add_action('network_admin_notices', array($this, 'display_admin_notices'), 10);
77
+		add_filter('pre_update_option', array($this, 'check_for_invalid_datetime_formats'), 100, 2);
78
+		add_filter('admin_footer_text', array($this, 'espresso_admin_footer'));
79 79
 
80 80
 		//reset Environment config (we only do this on admin page loads);
81 81
 		EE_Registry::instance()->CFG->environment->recheck_values();
82 82
 
83
-		do_action( 'AHEE__EE_Admin__loaded' );
83
+		do_action('AHEE__EE_Admin__loaded');
84 84
 	}
85 85
 
86 86
 
@@ -95,12 +95,12 @@  discard block
 block discarded – undo
95 95
 	 * @return void
96 96
 	 */
97 97
 	private function _define_all_constants() {
98
-		define( 'EE_ADMIN_URL', EE_PLUGIN_DIR_URL . 'core/admin/' );
99
-		define( 'EE_ADMIN_PAGES_URL', EE_PLUGIN_DIR_URL . 'admin_pages/' );
100
-		define( 'EE_ADMIN_TEMPLATE', EE_ADMIN . 'templates' . DS );
101
-		define( 'WP_ADMIN_PATH', ABSPATH . 'wp-admin/' );
102
-		define( 'WP_AJAX_URL', admin_url( 'admin-ajax.php' ));
103
-		define( 'JQPLOT_URL', EE_GLOBAL_ASSETS_URL . 'scripts/jqplot/' );
98
+		define('EE_ADMIN_URL', EE_PLUGIN_DIR_URL.'core/admin/');
99
+		define('EE_ADMIN_PAGES_URL', EE_PLUGIN_DIR_URL.'admin_pages/');
100
+		define('EE_ADMIN_TEMPLATE', EE_ADMIN.'templates'.DS);
101
+		define('WP_ADMIN_PATH', ABSPATH.'wp-admin/');
102
+		define('WP_AJAX_URL', admin_url('admin-ajax.php'));
103
+		define('JQPLOT_URL', EE_GLOBAL_ASSETS_URL.'scripts/jqplot/');
104 104
 	}
105 105
 
106 106
 
@@ -113,23 +113,23 @@  discard block
 block discarded – undo
113 113
 	 * @param 	string 	$plugin
114 114
 	 * @return 	array
115 115
 	 */
116
-	public function filter_plugin_actions( $links, $plugin ) {
116
+	public function filter_plugin_actions($links, $plugin) {
117 117
 		// set $main_file in stone
118 118
 		static $main_file;
119 119
 		// if $main_file is not set yet
120
-		if ( ! $main_file ) {
121
-			$main_file = plugin_basename( EVENT_ESPRESSO_MAIN_FILE );
120
+		if ( ! $main_file) {
121
+			$main_file = plugin_basename(EVENT_ESPRESSO_MAIN_FILE);
122 122
 		}
123
-		 if ( $plugin == $main_file ) {
123
+		 if ($plugin == $main_file) {
124 124
 		 	// compare current plugin to this one
125
-			if ( EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance ) {
126
-				$maintenance_link = '<a href="admin.php?page=espresso_maintenance_settings" title="Event Espresso is in maintenance mode.  Click this link to learn why.">' . __('Maintenance Mode Active', 'event_espresso' ) . '</a>';
127
-				array_unshift( $links, $maintenance_link );
125
+			if (EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance) {
126
+				$maintenance_link = '<a href="admin.php?page=espresso_maintenance_settings" title="Event Espresso is in maintenance mode.  Click this link to learn why.">'.__('Maintenance Mode Active', 'event_espresso').'</a>';
127
+				array_unshift($links, $maintenance_link);
128 128
 			} else {
129
-				$org_settings_link = '<a href="admin.php?page=espresso_general_settings">' . __( 'Settings', 'event_espresso' ) . '</a>';
130
-				$events_link = '<a href="admin.php?page=espresso_events">' . __( 'Events', 'event_espresso' ) . '</a>';
129
+				$org_settings_link = '<a href="admin.php?page=espresso_general_settings">'.__('Settings', 'event_espresso').'</a>';
130
+				$events_link = '<a href="admin.php?page=espresso_events">'.__('Events', 'event_espresso').'</a>';
131 131
 				// add before other links
132
-				array_unshift( $links, $org_settings_link, $events_link );
132
+				array_unshift($links, $org_settings_link, $events_link);
133 133
 			}
134 134
 		}
135 135
 		return $links;
@@ -144,8 +144,8 @@  discard block
 block discarded – undo
144 144
 	 *	@return void
145 145
 	 */
146 146
 	public function get_request() {
147
-		EE_Registry::instance()->load_core( 'Request_Handler' );
148
-		EE_Registry::instance()->load_core( 'CPT_Strategy' );
147
+		EE_Registry::instance()->load_core('Request_Handler');
148
+		EE_Registry::instance()->load_core('CPT_Strategy');
149 149
 	}
150 150
 
151 151
 
@@ -157,11 +157,11 @@  discard block
 block discarded – undo
157 157
 	 * @param array $admin_page_folder_names
158 158
 	 * @return array
159 159
 	 */
160
-	public function hide_admin_pages_except_maintenance_mode( $admin_page_folder_names = array() ){
160
+	public function hide_admin_pages_except_maintenance_mode($admin_page_folder_names = array()) {
161 161
 		return array(
162
-			'maintenance' => EE_ADMIN_PAGES . 'maintenance' . DS,
163
-			'about' => EE_ADMIN_PAGES . 'about' . DS,
164
-			'support' => EE_ADMIN_PAGES . 'support' . DS
162
+			'maintenance' => EE_ADMIN_PAGES.'maintenance'.DS,
163
+			'about' => EE_ADMIN_PAGES.'about'.DS,
164
+			'support' => EE_ADMIN_PAGES.'support'.DS
165 165
 		);
166 166
 	}
167 167
 
@@ -176,36 +176,36 @@  discard block
 block discarded – undo
176 176
 	public function init() {
177 177
 
178 178
 		//only enable most of the EE_Admin IF we're not in full maintenance mode
179
-		if ( EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance ){
179
+		if (EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance) {
180 180
 			//ok so we want to enable the entire admin
181
-			add_action( 'wp_ajax_dismiss_ee_nag_notice', array( $this, 'dismiss_ee_nag_notice_callback' ));
182
-			add_action( 'save_post', array( 'EE_Admin', 'parse_post_content_on_save' ), 100, 2 );
183
-			add_action( 'update_option', array( $this, 'reset_page_for_posts_on_change' ), 100, 3 );
184
-			add_filter( 'content_save_pre', array( $this, 'its_eSpresso' ), 10, 1 );
185
-			add_action( 'admin_notices', array( $this, 'get_persistent_admin_notices' ), 9 );
186
-			add_action( 'network_admin_notices', array( $this, 'get_persistent_admin_notices' ), 9 );
181
+			add_action('wp_ajax_dismiss_ee_nag_notice', array($this, 'dismiss_ee_nag_notice_callback'));
182
+			add_action('save_post', array('EE_Admin', 'parse_post_content_on_save'), 100, 2);
183
+			add_action('update_option', array($this, 'reset_page_for_posts_on_change'), 100, 3);
184
+			add_filter('content_save_pre', array($this, 'its_eSpresso'), 10, 1);
185
+			add_action('admin_notices', array($this, 'get_persistent_admin_notices'), 9);
186
+			add_action('network_admin_notices', array($this, 'get_persistent_admin_notices'), 9);
187 187
 			//at a glance dashboard widget
188
-			add_filter( 'dashboard_glance_items', array( $this, 'dashboard_glance_items'), 10 );
188
+			add_filter('dashboard_glance_items', array($this, 'dashboard_glance_items'), 10);
189 189
 			//filter for get_edit_post_link used on comments for custom post types
190
-			add_filter('get_edit_post_link', array( $this, 'modify_edit_post_link' ), 10, 3 );
190
+			add_filter('get_edit_post_link', array($this, 'modify_edit_post_link'), 10, 3);
191 191
 		}
192 192
 
193 193
 		// run the admin page factory but ONLY if we are doing an ee admin ajax request
194
-		if ( !defined('DOING_AJAX') || EE_ADMIN_AJAX ) {
194
+		if ( ! defined('DOING_AJAX') || EE_ADMIN_AJAX) {
195 195
 			try {
196 196
 				//this loads the controller for the admin pages which will setup routing etc
197
-				EE_Registry::instance()->load_core( 'Admin_Page_Loader' );
198
-			} catch ( EE_Error $e ) {
197
+				EE_Registry::instance()->load_core('Admin_Page_Loader');
198
+			} catch (EE_Error $e) {
199 199
 				$e->get_error();
200 200
 			}
201 201
 		}
202 202
 
203 203
 		//make sure our CPTs and custom taxonomy metaboxes get shown for first time users
204
-		add_action('admin_head', array($this, 'enable_hidden_ee_nav_menu_metaboxes' ), 10 );
205
-		add_action('admin_head', array( $this, 'register_custom_nav_menu_boxes' ), 10 );
204
+		add_action('admin_head', array($this, 'enable_hidden_ee_nav_menu_metaboxes'), 10);
205
+		add_action('admin_head', array($this, 'register_custom_nav_menu_boxes'), 10);
206 206
 
207 207
 		//exclude EE critical pages from all nav menus and wp_list_pages
208
-		add_filter('nav_menu_meta_box_object', array( $this, 'remove_pages_from_nav_menu'), 10 );
208
+		add_filter('nav_menu_meta_box_object', array($this, 'remove_pages_from_nav_menu'), 10);
209 209
 	}
210 210
 
211 211
 
@@ -218,9 +218,9 @@  discard block
 block discarded – undo
218 218
 	 * @param  object $post_type WP post type object
219 219
 	 * @return object            WP post type object
220 220
 	 */
221
-	public function remove_pages_from_nav_menu( $post_type ) {
221
+	public function remove_pages_from_nav_menu($post_type) {
222 222
 		//if this isn't the "pages" post type let's get out
223
-		if ( $post_type->name !== 'page' )
223
+		if ($post_type->name !== 'page')
224 224
 			return $post_type;
225 225
 
226 226
 		$critical_pages = EE_Registry::instance()->CFG->core->get_critical_pages_array();
@@ -240,17 +240,17 @@  discard block
 block discarded – undo
240 240
 	 */
241 241
 	public function enable_hidden_ee_nav_menu_metaboxes() {
242 242
 		global $wp_meta_boxes, $pagenow;
243
-		if ( ! is_array($wp_meta_boxes) || $pagenow !== 'nav-menus.php' )
243
+		if ( ! is_array($wp_meta_boxes) || $pagenow !== 'nav-menus.php')
244 244
 			return;
245 245
 
246
-		$initial_meta_boxes = apply_filters( 'FHEE__EE_Admin__enable_hidden_ee_nav_menu_boxes__initial_meta_boxes', array( 'nav-menu-theme-locations', 'add-page', 'add-custom-links', 'add-category', 'add-espresso_events', 'add-espresso_venues', 'add-espresso_event_categories', 'add-espresso_venue_categories' ) );
246
+		$initial_meta_boxes = apply_filters('FHEE__EE_Admin__enable_hidden_ee_nav_menu_boxes__initial_meta_boxes', array('nav-menu-theme-locations', 'add-page', 'add-custom-links', 'add-category', 'add-espresso_events', 'add-espresso_venues', 'add-espresso_event_categories', 'add-espresso_venue_categories'));
247 247
 		$hidden_meta_boxes = array();
248 248
 
249
-		foreach ( array_keys($wp_meta_boxes['nav-menus']) as $context ) {
250
-			foreach ( array_keys($wp_meta_boxes['nav-menus'][$context]) as $priority ) {
251
-				foreach ( $wp_meta_boxes['nav-menus'][$context][$priority] as $box ) {
252
-					if ( in_array( $box['id'], $initial_meta_boxes ) ) {
253
-						unset( $box['id'] );
249
+		foreach (array_keys($wp_meta_boxes['nav-menus']) as $context) {
250
+			foreach (array_keys($wp_meta_boxes['nav-menus'][$context]) as $priority) {
251
+				foreach ($wp_meta_boxes['nav-menus'][$context][$priority] as $box) {
252
+					if (in_array($box['id'], $initial_meta_boxes)) {
253
+						unset($box['id']);
254 254
 					} else {
255 255
 						$hidden_meta_boxes[] = $box['id'];
256 256
 					}
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
 		}
260 260
 
261 261
 		$user = wp_get_current_user();
262
-		update_user_option( $user->ID, 'metaboxhidden_nav-menus', $hidden_meta_boxes, true );
262
+		update_user_option($user->ID, 'metaboxhidden_nav-menus', $hidden_meta_boxes, true);
263 263
 	}
264 264
 
265 265
 
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
 	 * @return void
279 279
 	 */
280 280
 	public function register_custom_nav_menu_boxes() {
281
-		add_meta_box( 'add-extra-nav-menu-pages', __('Event Espresso Pages', 'event_espresso'), array( $this, 'ee_cpt_archive_pages' ), 'nav-menus', 'side', 'core' );
281
+		add_meta_box('add-extra-nav-menu-pages', __('Event Espresso Pages', 'event_espresso'), array($this, 'ee_cpt_archive_pages'), 'nav-menus', 'side', 'core');
282 282
 	}
283 283
 
284 284
 
@@ -295,17 +295,17 @@  discard block
 block discarded – undo
295 295
 	 *
296 296
 	 * @return string  the (maybe) modified link
297 297
 	 */
298
-	public function modify_edit_post_link( $link, $id, $context ) {
299
-		if ( ! $post = get_post( $id ) )
298
+	public function modify_edit_post_link($link, $id, $context) {
299
+		if ( ! $post = get_post($id))
300 300
 			return $link;
301 301
 
302
-		if ( $post->post_type == 'espresso_attendees' ) {
302
+		if ($post->post_type == 'espresso_attendees') {
303 303
 			$query_args = array(
304 304
 				'action' => 'edit_attendee',
305 305
 				'post' => $id
306 306
 				);
307 307
 			EE_Registry::instance()->load_helper('URL');
308
-			return EEH_URL::add_query_args_and_nonce( $query_args, admin_url('admin.php?page=espresso_registrations') );
308
+			return EEH_URL::add_query_args_and_nonce($query_args, admin_url('admin.php?page=espresso_registrations'));
309 309
 		}
310 310
 		return $link;
311 311
 	}
@@ -317,7 +317,7 @@  discard block
 block discarded – undo
317 317
 		global $nav_menu_selected_id;
318 318
 
319 319
 		$db_fields = false;
320
-		$walker = new Walker_Nav_Menu_Checklist( $db_fields );
320
+		$walker = new Walker_Nav_Menu_Checklist($db_fields);
321 321
 		$current_tab = 'event-archives';
322 322
 
323 323
 		/*if ( ! empty( $_REQUEST['quick-search-posttype-' . $post_type_name] ) ) {
@@ -336,9 +336,9 @@  discard block
 block discarded – undo
336 336
 		?>
337 337
 		<div id="posttype-extra-nav-menu-pages" class="posttypediv">
338 338
 			<ul id="posttype-extra-nav-menu-pages-tabs" class="posttype-tabs add-menu-item-tabs">
339
-				<li <?php echo ( 'event-archives' == $current_tab ? ' class="tabs"' : '' ); ?>>
340
-					<a class="nav-tab-link" data-type="tabs-panel-posttype-extra-nav-menu-pages-event-archives" href="<?php if ( $nav_menu_selected_id ) echo esc_url(add_query_arg('extra-nav-menu-pages-tab', 'event-archives', remove_query_arg($removed_args))); ?>#tabs-panel-posttype-extra-nav-menu-pages-event-archives">
341
-						<?php _e( 'Event Archive Pages', 'event_espresso' ); ?>
339
+				<li <?php echo ('event-archives' == $current_tab ? ' class="tabs"' : ''); ?>>
340
+					<a class="nav-tab-link" data-type="tabs-panel-posttype-extra-nav-menu-pages-event-archives" href="<?php if ($nav_menu_selected_id) echo esc_url(add_query_arg('extra-nav-menu-pages-tab', 'event-archives', remove_query_arg($removed_args))); ?>#tabs-panel-posttype-extra-nav-menu-pages-event-archives">
341
+						<?php _e('Event Archive Pages', 'event_espresso'); ?>
342 342
 					</a>
343 343
 				</li>
344 344
 			<?php /* // temporarily removing but leaving skeleton in place in case we ever decide to add more tabs.
@@ -356,13 +356,13 @@  discard block
 block discarded – undo
356 356
  			<?php */ ?>
357 357
 
358 358
 			<div id="tabs-panel-posttype-extra-nav-menu-pages-event-archives" class="tabs-panel <?php
359
-			echo ( 'event-archives' == $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive' );
359
+			echo ('event-archives' == $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive');
360 360
 			?>">
361 361
 				<ul id="extra-nav-menu-pageschecklist-event-archives" class="categorychecklist form-no-clear">
362 362
 					<?php
363 363
 					$pages = $this->_get_extra_nav_menu_pages_items();
364 364
 					$args['walker'] = $walker;
365
-					echo walk_nav_menu_tree( array_map( array( $this, '_setup_extra_nav_menu_pages_items' ), $pages), 0, (object) $args );
365
+					echo walk_nav_menu_tree(array_map(array($this, '_setup_extra_nav_menu_pages_items'), $pages), 0, (object) $args);
366 366
 					?>
367 367
 				</ul>
368 368
 			</div><!-- /.tabs-panel -->
@@ -370,18 +370,18 @@  discard block
 block discarded – undo
370 370
 			<p class="button-controls">
371 371
 				<span class="list-controls">
372 372
 					<a href="<?php
373
-						echo esc_url( add_query_arg(
373
+						echo esc_url(add_query_arg(
374 374
 							array(
375 375
 								'extra-nav-menu-pages-tab' => 'event-archives',
376 376
 								'selectall' => 1,
377 377
 							),
378
-							remove_query_arg( $removed_args )
378
+							remove_query_arg($removed_args)
379 379
 						));
380 380
 					?>#posttype-extra-nav-menu-pages>" class="select-all"><?php _e('Select All'); ?></a>
381 381
 				</span>
382 382
 
383 383
 				<span class="add-to-menu">
384
-					<input type="submit"<?php wp_nav_menu_disabled_check( $nav_menu_selected_id ); ?> class="button-secondary submit-add-to-menu right" value="<?php esc_attr_e( __( 'Add to Menu' ) ); ?>" name="add-post-type-menu-item" id="<?php esc_attr_e( 'submit-posttype-extra-nav-menu-pages' ); ?>" />
384
+					<input type="submit"<?php wp_nav_menu_disabled_check($nav_menu_selected_id); ?> class="button-secondary submit-add-to-menu right" value="<?php esc_attr_e(__('Add to Menu')); ?>" name="add-post-type-menu-item" id="<?php esc_attr_e('submit-posttype-extra-nav-menu-pages'); ?>" />
385 385
 					<span class="spinner"></span>
386 386
 				</span>
387 387
 			</p>
@@ -402,10 +402,10 @@  discard block
 block discarded – undo
402 402
 	private function _get_extra_nav_menu_pages_items() {
403 403
 		$menuitems[] = array(
404 404
 			'title' => __('Event List', 'event_espresso'),
405
-			'url' => get_post_type_archive_link( 'espresso_events' ),
405
+			'url' => get_post_type_archive_link('espresso_events'),
406 406
 			'description' => __('Archive page for all events.', 'event_espresso')
407 407
 		);
408
-		return apply_filters( 'FHEE__EE_Admin__get_extra_nav_menu_pages_items', $menuitems );
408
+		return apply_filters('FHEE__EE_Admin__get_extra_nav_menu_pages_items', $menuitems);
409 409
 	}
410 410
 
411 411
 
@@ -417,7 +417,7 @@  discard block
 block discarded – undo
417 417
 	 * @param $menuitem
418 418
 	 * @return stdClass
419 419
 	 */
420
-	private function _setup_extra_nav_menu_pages_items( $menuitem ) {
420
+	private function _setup_extra_nav_menu_pages_items($menuitem) {
421 421
 		$menu_item = new stdClass();
422 422
 		$keys = array(
423 423
 			'ID' => 0,
@@ -437,7 +437,7 @@  discard block
 block discarded – undo
437 437
 			'xfn' => ''
438 438
 			);
439 439
 
440
-		foreach ( $keys as $key => $value) {
440
+		foreach ($keys as $key => $value) {
441 441
 			$menu_item->$key = isset($menuitem[$key]) ? $menuitem[$key] : $value;
442 442
 		}
443 443
 		return $menu_item;
@@ -477,10 +477,10 @@  discard block
 block discarded – undo
477 477
 		 * - check if doing post processing of one of EE CPTs
478 478
 		 * - instantiate the corresponding EE CPT model for the post_type being processed.
479 479
 		 */
480
-		if ( isset( $_POST['action'] ) && $_POST['action'] == 'editpost' ) {
481
-			if ( isset( $_POST['post_type'] ) ) {
482
-				EE_Registry::instance()->load_core( 'Register_CPTs' );
483
-				EE_Register_CPTs::instantiate_cpt_models( $_POST['post_type'] );
480
+		if (isset($_POST['action']) && $_POST['action'] == 'editpost') {
481
+			if (isset($_POST['post_type'])) {
482
+				EE_Registry::instance()->load_core('Register_CPTs');
483
+				EE_Register_CPTs::instantiate_cpt_models($_POST['post_type']);
484 484
 			}
485 485
 		}
486 486
 
@@ -496,37 +496,37 @@  discard block
 block discarded – undo
496 496
 	public function enqueue_admin_scripts() {
497 497
 		// this javascript is loaded on every admin page to catch any injections ee needs to add to wp run js.
498 498
 		// Note: the intention of this script is to only do TARGETED injections.  I.E, only injecting on certain script calls.
499
-		wp_enqueue_script('ee-inject-wp', EE_ADMIN_URL . 'assets/ee-cpt-wp-injects.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE);
499
+		wp_enqueue_script('ee-inject-wp', EE_ADMIN_URL.'assets/ee-cpt-wp-injects.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE);
500 500
 		// register cookie script for future dependencies
501
-		wp_register_script('jquery-cookie', EE_THIRD_PARTY_URL . 'joyride/jquery.cookie.js', array('jquery'), '2.1', TRUE );
501
+		wp_register_script('jquery-cookie', EE_THIRD_PARTY_URL.'joyride/jquery.cookie.js', array('jquery'), '2.1', TRUE);
502 502
 		// jquery_validate loading is turned OFF by default, but prior to the admin_enqueue_scripts hook, can be turned back on again via:  add_filter( 'FHEE_load_jquery_validate', '__return_true' );
503
-		if ( apply_filters( 'FHEE_load_jquery_validate', FALSE ) ) {
503
+		if (apply_filters('FHEE_load_jquery_validate', FALSE)) {
504 504
 			// register jQuery Validate
505
-			wp_register_script('jquery-validate', EE_GLOBAL_ASSETS_URL . 'scripts/jquery.validate.min.js', array('jquery'), '1.11.1', TRUE);
505
+			wp_register_script('jquery-validate', EE_GLOBAL_ASSETS_URL.'scripts/jquery.validate.min.js', array('jquery'), '1.11.1', TRUE);
506 506
 		}
507 507
 		//joyride is turned OFF by default, but prior to the admin_enqueue_scripts hook, can be turned back on again vai: add_filter('FHEE_load_joyride', '__return_true' );
508
-		if ( apply_filters( 'FHEE_load_joyride', FALSE ) ) {
508
+		if (apply_filters('FHEE_load_joyride', FALSE)) {
509 509
 			//joyride style
510
-			wp_register_style('joyride-css', EE_THIRD_PARTY_URL . 'joyride/joyride-2.1.css', array(), '2.1');
511
-			wp_register_style('ee-joyride-css', EE_GLOBAL_ASSETS_URL . 'css/ee-joyride-styles.css', array('joyride-css'), EVENT_ESPRESSO_VERSION );
512
-			wp_register_script('joyride-modernizr', EE_THIRD_PARTY_URL . 'joyride/modernizr.mq.js', array(), '2.1', TRUE );
510
+			wp_register_style('joyride-css', EE_THIRD_PARTY_URL.'joyride/joyride-2.1.css', array(), '2.1');
511
+			wp_register_style('ee-joyride-css', EE_GLOBAL_ASSETS_URL.'css/ee-joyride-styles.css', array('joyride-css'), EVENT_ESPRESSO_VERSION);
512
+			wp_register_script('joyride-modernizr', EE_THIRD_PARTY_URL.'joyride/modernizr.mq.js', array(), '2.1', TRUE);
513 513
 			//joyride JS
514
-			wp_register_script('jquery-joyride', EE_THIRD_PARTY_URL . 'joyride/jquery.joyride-2.1.js', array('jquery-cookie', 'joyride-modernizr'), '2.1', TRUE );
514
+			wp_register_script('jquery-joyride', EE_THIRD_PARTY_URL.'joyride/jquery.joyride-2.1.js', array('jquery-cookie', 'joyride-modernizr'), '2.1', TRUE);
515 515
 			// wanna go for a joyride?
516 516
 			wp_enqueue_style('ee-joyride-css');
517 517
 			wp_enqueue_script('jquery-joyride');
518 518
 		}
519 519
 		//qtip is turned OFF by default, but prior to the admin_enqueue_scripts hook, can be turned back on again via: add_filter('FHEE_load_qtips', '__return_true' );
520
-		if ( apply_filters( 'FHEE_load_qtip', FALSE ) ) {
520
+		if (apply_filters('FHEE_load_qtip', FALSE)) {
521 521
 			EE_Registry::instance()->load_helper('Qtip_Loader');
522 522
 			EEH_Qtip_Loader::instance()->register_and_enqueue();
523 523
 		}
524 524
 		//accounting.js library
525 525
 		// @link http://josscrowcroft.github.io/accounting.js/
526
-		if ( apply_filters( 'FHEE_load_accounting_js', FALSE ) ) {
527
-			wp_register_script( 'ee-accounting', EE_GLOBAL_ASSETS_URL . 'scripts/ee-accounting-config.js', array('ee-accounting-core'), EVENT_ESPRESSO_VERSION, TRUE );
528
-			wp_register_script( 'ee-accounting-core', EE_THIRD_PARTY_URL . 'accounting/accounting.js', array('underscore'), '0.3.2', TRUE );
529
-			wp_enqueue_script( 'ee-accounting' );
526
+		if (apply_filters('FHEE_load_accounting_js', FALSE)) {
527
+			wp_register_script('ee-accounting', EE_GLOBAL_ASSETS_URL.'scripts/ee-accounting-config.js', array('ee-accounting-core'), EVENT_ESPRESSO_VERSION, TRUE);
528
+			wp_register_script('ee-accounting-core', EE_THIRD_PARTY_URL.'accounting/accounting.js', array('underscore'), '0.3.2', TRUE);
529
+			wp_enqueue_script('ee-accounting');
530 530
 			// array of settings to get converted to JSON array via wp_localize_script
531 531
 			$currency_config = array(
532 532
 				'currency' => array(
@@ -573,11 +573,11 @@  discard block
 block discarded – undo
573 573
 	public function get_persistent_admin_notices() {
574 574
 		// http://www.example.com/wp-admin/admin.php?page=espresso_general_settings&action=critical_pages&critical_pages_nonce=2831ce0f30
575 575
 		$args = array(
576
-			'page' => EE_Registry::instance()->REQ->is_set( 'page' ) ? EE_Registry::instance()->REQ->get( 'page' ) : '',
577
-			'action' => EE_Registry::instance()->REQ->is_set( 'action' ) ? EE_Registry::instance()->REQ->get( 'action' ) : '',
576
+			'page' => EE_Registry::instance()->REQ->is_set('page') ? EE_Registry::instance()->REQ->get('page') : '',
577
+			'action' => EE_Registry::instance()->REQ->is_set('action') ? EE_Registry::instance()->REQ->get('action') : '',
578 578
 		);
579
-		$return_url = EE_Admin_Page::add_query_args_and_nonce( $args, EE_ADMIN_URL );
580
-		echo EE_Error::get_persistent_admin_notices( $return_url );
579
+		$return_url = EE_Admin_Page::add_query_args_and_nonce($args, EE_ADMIN_URL);
580
+		echo EE_Error::get_persistent_admin_notices($return_url);
581 581
 	}
582 582
 
583 583
 
@@ -598,20 +598,20 @@  discard block
 block discarded – undo
598 598
 	 * @param $elements
599 599
 	 * @return array
600 600
 	 */
601
-	public function dashboard_glance_items( $elements ) {
601
+	public function dashboard_glance_items($elements) {
602 602
 		$events = EEM_Event::instance()->count();
603
-		$items['events']['url'] = EE_Admin_Page::add_query_args_and_nonce( array('page' => 'espresso_events'), admin_url('admin.php') );
604
-		$items['events']['text'] = sprintf( _n( '%s Event', '%s Events', $events ), number_format_i18n( $events ) );
603
+		$items['events']['url'] = EE_Admin_Page::add_query_args_and_nonce(array('page' => 'espresso_events'), admin_url('admin.php'));
604
+		$items['events']['text'] = sprintf(_n('%s Event', '%s Events', $events), number_format_i18n($events));
605 605
 		$items['events']['title'] = __('Click to view all Events', 'event_espresso');
606 606
 		$registrations = EEM_Registration::instance()->count();
607
-		$items['registrations']['url'] = EE_Admin_Page::add_query_args_and_nonce( array('page' => 'espresso_registrations' ), admin_url('admin.php') );
608
-		$items['registrations']['text'] = sprintf( _n( '%s Registration', '%s Registrations', $registrations ), number_format_i18n($registrations) );
607
+		$items['registrations']['url'] = EE_Admin_Page::add_query_args_and_nonce(array('page' => 'espresso_registrations'), admin_url('admin.php'));
608
+		$items['registrations']['text'] = sprintf(_n('%s Registration', '%s Registrations', $registrations), number_format_i18n($registrations));
609 609
 		$items['registrations']['title'] = __('Click to view all registrations', 'event_espresso');
610 610
 
611
-		$items = apply_filters( 'FHEE__EE_Admin__dashboard_glance_items__items', $items );
611
+		$items = apply_filters('FHEE__EE_Admin__dashboard_glance_items__items', $items);
612 612
 
613
-		foreach ( $items as $item ) {
614
-			$elements[] = sprintf( '<a href="%s" title="%s">%s</a>', $item['url'], $item['title'], $item['text'] );
613
+		foreach ($items as $item) {
614
+			$elements[] = sprintf('<a href="%s" title="%s">%s</a>', $item['url'], $item['title'], $item['text']);
615 615
 		}
616 616
 		return $elements;
617 617
 	}
@@ -630,14 +630,14 @@  discard block
 block discarded – undo
630 630
 	 * @param $post
631 631
 	 * @return    void
632 632
 	 */
633
-	public static function parse_post_content_on_save( $post_ID, $post ) {
633
+	public static function parse_post_content_on_save($post_ID, $post) {
634 634
 		// default post types
635
-		$post_types = array( 'post' => 0, 'page' => 1 );
635
+		$post_types = array('post' => 0, 'page' => 1);
636 636
 		// add CPTs
637 637
 		$CPTs = EE_Register_CPTs::get_CPTs();
638
-		$post_types = array_merge( $post_types, $CPTs );
638
+		$post_types = array_merge($post_types, $CPTs);
639 639
 		// for default or CPT posts...
640
-		if ( isset( $post_types[ $post->post_type ] )) {
640
+		if (isset($post_types[$post->post_type])) {
641 641
 			// whether to proceed with update
642 642
 			$update_post_shortcodes = FALSE;
643 643
 			// post on frontpage ?
@@ -645,32 +645,32 @@  discard block
 block discarded – undo
645 645
 			// critical page shortcodes that we do NOT want added to the Posts page (blog)
646 646
 			$critical_shortcodes = EE_Registry::instance()->CFG->core->get_critical_pages_shortcodes_array();
647 647
 			// array of shortcodes indexed by post name
648
-			EE_Registry::instance()->CFG->core->post_shortcodes = isset( EE_Registry::instance()->CFG->core->post_shortcodes ) ? EE_Registry::instance()->CFG->core->post_shortcodes : array();
648
+			EE_Registry::instance()->CFG->core->post_shortcodes = isset(EE_Registry::instance()->CFG->core->post_shortcodes) ? EE_Registry::instance()->CFG->core->post_shortcodes : array();
649 649
 			// empty both arrays
650
-			EE_Registry::instance()->CFG->core->post_shortcodes[ $post->post_name ] = array();
650
+			EE_Registry::instance()->CFG->core->post_shortcodes[$post->post_name] = array();
651 651
 			// loop thru shortcodes
652
-			foreach ( EE_Registry::instance()->shortcodes as $EES_Shortcode => $shortcode_dir ) {
652
+			foreach (EE_Registry::instance()->shortcodes as $EES_Shortcode => $shortcode_dir) {
653 653
 				// convert to UPPERCASE to get actual shortcode
654
-				$EES_Shortcode = strtoupper( $EES_Shortcode );
654
+				$EES_Shortcode = strtoupper($EES_Shortcode);
655 655
 				// is the shortcode in the post_content ?
656
-				if ( strpos( $post->post_content, $EES_Shortcode ) !== FALSE ) {
656
+				if (strpos($post->post_content, $EES_Shortcode) !== FALSE) {
657 657
 					// map shortcode to post names and post IDs
658
-					EE_Registry::instance()->CFG->core->post_shortcodes[ $post->post_name ][ $EES_Shortcode ] = $post_ID;
658
+					EE_Registry::instance()->CFG->core->post_shortcodes[$post->post_name][$EES_Shortcode] = $post_ID;
659 659
 					// if the shortcode is NOT one of the critical page shortcodes like ESPRESSO_TXN_PAGE
660
-					if ( ! in_array( $EES_Shortcode, $critical_shortcodes )) {
660
+					if ( ! in_array($EES_Shortcode, $critical_shortcodes)) {
661 661
 						// check that posts page is already being tracked
662
-						if ( ! isset( EE_Registry::instance()->CFG->core->post_shortcodes[ $page_for_posts ] )) {
662
+						if ( ! isset(EE_Registry::instance()->CFG->core->post_shortcodes[$page_for_posts])) {
663 663
 							// if not, then ensure that it is properly added
664
-							EE_Registry::instance()->CFG->core->post_shortcodes[ $page_for_posts ] = array();
664
+							EE_Registry::instance()->CFG->core->post_shortcodes[$page_for_posts] = array();
665 665
 						}
666 666
 						// add shortcode to "Posts page" tracking
667
-						EE_Registry::instance()->CFG->core->post_shortcodes[ $page_for_posts ][ $EES_Shortcode ] = $post_ID;
667
+						EE_Registry::instance()->CFG->core->post_shortcodes[$page_for_posts][$EES_Shortcode] = $post_ID;
668 668
 					}
669 669
 					$update_post_shortcodes = TRUE;
670 670
 				}
671 671
 			}
672
-			if ( $update_post_shortcodes ) {
673
-				EE_Registry::instance()->CFG->update_post_shortcodes( $page_for_posts );
672
+			if ($update_post_shortcodes) {
673
+				EE_Registry::instance()->CFG->update_post_shortcodes($page_for_posts);
674 674
 			}
675 675
 		}
676 676
 	}
@@ -688,38 +688,38 @@  discard block
 block discarded – undo
688 688
 	 * @throws EE_Error
689 689
 	 * @return    string
690 690
 	 */
691
-	public function check_for_invalid_datetime_formats( $value, $option ) {
691
+	public function check_for_invalid_datetime_formats($value, $option) {
692 692
 		// check for date_format or time_format
693
-		switch ( $option ) {
693
+		switch ($option) {
694 694
 			case 'date_format' :
695
-				$date_time_format = $value . ' ' . get_option('time_format');
695
+				$date_time_format = $value.' '.get_option('time_format');
696 696
 				break;
697 697
 			case 'time_format' :
698
-				$date_time_format = get_option('date_format') . ' ' . $value;
698
+				$date_time_format = get_option('date_format').' '.$value;
699 699
 				break;
700 700
 			default :
701 701
 				$date_time_format = FALSE;
702 702
 		}
703 703
 		// do we have a date_time format to check ?
704
-		if ( $date_time_format ) {
704
+		if ($date_time_format) {
705 705
 			// because DateTime chokes on some formats, check first that strtotime can parse it
706
-			$date_string = strtotime( date( $date_time_format ));
706
+			$date_string = strtotime(date($date_time_format));
707 707
 			// invalid date time formats will evaluate to either "0" or ""
708
-			if ( empty( $date_string )) {
708
+			if (empty($date_string)) {
709 709
 				// trigger WP settings error
710 710
 				add_settings_error(
711 711
 					'date_format',
712 712
 					'date_format',
713 713
 					sprintf(
714
-						__('The following date time  "%s" ( %s ) can not be properly parsed by PHP due to its format and may cause incompatibility issues with Event Espresso. You will need to choose a more standard date time format in order for everything to operate correctly. %sPlease note that your date and time formats have been reset to "F j, Y" and "g:i a" respectively.%s', 'event_espresso' ),
715
-						date( $date_time_format ),
714
+						__('The following date time  "%s" ( %s ) can not be properly parsed by PHP due to its format and may cause incompatibility issues with Event Espresso. You will need to choose a more standard date time format in order for everything to operate correctly. %sPlease note that your date and time formats have been reset to "F j, Y" and "g:i a" respectively.%s', 'event_espresso'),
715
+						date($date_time_format),
716 716
 						$date_time_format,
717 717
 						'<br /><span style="color:#D54E21;">',
718 718
 						'</span>'
719 719
 					)
720 720
 				);
721 721
 				// set format to something valid
722
-				switch ( $option ) {
722
+				switch ($option) {
723 723
 					case 'date_format' :
724 724
 						$value = 'F j, Y';
725 725
 						break;
@@ -745,14 +745,14 @@  discard block
 block discarded – undo
745 745
 	 * @param 	$value
746 746
 	 * @return 	void
747 747
 	 */
748
-	public function reset_page_for_posts_on_change( $option, $old_value, $value ) {
749
-		if ( $option == 'page_for_posts' ) {
748
+	public function reset_page_for_posts_on_change($option, $old_value, $value) {
749
+		if ($option == 'page_for_posts') {
750 750
 			global $wpdb;
751
-			$SQL = 'SELECT post_name from ' . $wpdb->posts . ' WHERE post_type="posts" OR post_type="page" AND post_status="publish" AND ID=%s';
752
-			$old_page_for_posts = $old_value ? $wpdb->get_var( $wpdb->prepare( $SQL, $old_value )) : 'posts';
753
-			$new_page_for_posts = $value ? $wpdb->get_var( $wpdb->prepare( $SQL, $value )) : 'posts';
754
-			EE_Registry::instance()->CFG->core->post_shortcodes[ $new_page_for_posts ] = EE_Registry::instance()->CFG->core->post_shortcodes[ $old_page_for_posts ];
755
-			EE_Registry::instance()->CFG->update_post_shortcodes( $new_page_for_posts );
751
+			$SQL = 'SELECT post_name from '.$wpdb->posts.' WHERE post_type="posts" OR post_type="page" AND post_status="publish" AND ID=%s';
752
+			$old_page_for_posts = $old_value ? $wpdb->get_var($wpdb->prepare($SQL, $old_value)) : 'posts';
753
+			$new_page_for_posts = $value ? $wpdb->get_var($wpdb->prepare($SQL, $value)) : 'posts';
754
+			EE_Registry::instance()->CFG->core->post_shortcodes[$new_page_for_posts] = EE_Registry::instance()->CFG->core->post_shortcodes[$old_page_for_posts];
755
+			EE_Registry::instance()->CFG->update_post_shortcodes($new_page_for_posts);
756 756
 		}
757 757
 	}
758 758
 
@@ -765,8 +765,8 @@  discard block
 block discarded – undo
765 765
 	 * @param $content
766 766
 	 * @return    string
767 767
 	 */
768
-	public function its_eSpresso( $content ) {
769
-		return str_replace( '[EXPRESSO_', '[ESPRESSO_', $content );
768
+	public function its_eSpresso($content) {
769
+		return str_replace('[EXPRESSO_', '[ESPRESSO_', $content);
770 770
 	}
771 771
 
772 772
 
@@ -779,9 +779,9 @@  discard block
 block discarded – undo
779 779
 	 */
780 780
 	public function espresso_admin_footer() {
781 781
 		return sprintf(
782
-			__( 'Event Registration and Ticketing Powered by %sEvent Registration Powered by Event Espresso%s', 'event_espresso' ),
782
+			__('Event Registration and Ticketing Powered by %sEvent Registration Powered by Event Espresso%s', 'event_espresso'),
783 783
 			'<a href="http://eventespresso.com/" title="',
784
-			'">' . EVENT_ESPRESSO_POWERED_BY . '</a>'
784
+			'">'.EVENT_ESPRESSO_POWERED_BY.'</a>'
785 785
 		);
786 786
 	}
787 787
 
@@ -801,11 +801,11 @@  discard block
 block discarded – undo
801 801
 	 * @param array $config
802 802
 	 * @return void
803 803
 	 */
804
-	public static function register_ee_admin_page( $page_basename, $page_path, $config = array() ) {
805
-		EE_Error::doing_it_wrong( __METHOD__, sprintf( __('Usage is deprecated.  Use EE_Register_Admin_Page::register() for registering the %s admin page.', 'event_espresso'), $page_basename), '4.3' );
806
-		if ( class_exists( 'EE_Register_Admin_Page' ) )
804
+	public static function register_ee_admin_page($page_basename, $page_path, $config = array()) {
805
+		EE_Error::doing_it_wrong(__METHOD__, sprintf(__('Usage is deprecated.  Use EE_Register_Admin_Page::register() for registering the %s admin page.', 'event_espresso'), $page_basename), '4.3');
806
+		if (class_exists('EE_Register_Admin_Page'))
807 807
 			$config['page_path'] = $page_path;
808
-			EE_Register_Admin_Page::register( $page_basename, $config );
808
+			EE_Register_Admin_Page::register($page_basename, $config);
809 809
 	}
810 810
 
811 811
 
Please login to merge, or discard this patch.