Completed
Branch FET-9576-iframes (685a28)
by
unknown
196:05 queued 174:48
created
modules/invalid_checkout_access/EED_Invalid_Checkout_Access.module.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 use EventEspresso\modules\invalid_checkout_access\InvalidCheckoutAccess;
3 3
 
4
-if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
5
-	exit( 'No direct script access allowed' );
4
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
5
+	exit('No direct script access allowed');
6 6
 }
7 7
 
8 8
 
@@ -36,12 +36,12 @@  discard block
 block discarded – undo
36 36
 	public static function set_hooks_admin() {
37 37
 		add_action(
38 38
 			'AHEE__Extend_Registration_Form_Admin_Page___reg_form_settings_template',
39
-			array( 'EED_Invalid_Checkout_Access', 'display_invalid_checkout_access_form' ),
39
+			array('EED_Invalid_Checkout_Access', 'display_invalid_checkout_access_form'),
40 40
 			15
41 41
 		);
42 42
 		add_filter(
43 43
 			'FHEE__Extend_Registration_Form_Admin_Page___update_reg_form_settings__CFG_registration',
44
-			array( 'EED_Invalid_Checkout_Access', 'process_invalid_checkout_access_form' )
44
+			array('EED_Invalid_Checkout_Access', 'process_invalid_checkout_access_form')
45 45
 		);
46 46
 	}
47 47
 
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 	 *
54 54
 	 * @var WP $WP
55 55
 	 */
56
-	public function run( $WP ) {
56
+	public function run($WP) {
57 57
 		// TODO: Implement run() method.
58 58
 	}
59 59
 
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 	 * @return InvalidCheckoutAccess
64 64
 	 */
65 65
 	public static function getInvalidCheckoutAccess() {
66
-		if ( ! self::$invalid_checkout_access_form instanceof InvalidCheckoutAccess ) {
66
+		if ( ! self::$invalid_checkout_access_form instanceof InvalidCheckoutAccess) {
67 67
 			self::$invalid_checkout_access_form = new InvalidCheckoutAccess();
68 68
 		}
69 69
 		return self::$invalid_checkout_access_form;
@@ -90,9 +90,9 @@  discard block
 block discarded – undo
90 90
 	 * @param \EE_Registration_Config $EE_Registration_Config
91 91
 	 * @return \EE_Registration_Config
92 92
 	 */
93
-	public static function process_invalid_checkout_access_form( \EE_Registration_Config $EE_Registration_Config ) {
93
+	public static function process_invalid_checkout_access_form(\EE_Registration_Config $EE_Registration_Config) {
94 94
 		$invalid_checkout_access_form = \EED_Invalid_Checkout_Access::getInvalidCheckoutAccess();
95
-		return $invalid_checkout_access_form->processForm( $EE_Registration_Config );
95
+		return $invalid_checkout_access_form->processForm($EE_Registration_Config);
96 96
 	}
97 97
 
98 98
 
Please login to merge, or discard this patch.
core/request_stack/EE_Request.core.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -67,15 +67,15 @@  discard block
 block discarded – undo
67 67
 	 * @param array $post
68 68
 	 * @param array $cookie
69 69
 	 */
70
-	public function __construct( $get, $post, $cookie ) {
70
+	public function __construct($get, $post, $cookie) {
71 71
 		// grab request vars
72 72
 		$this->_get    = $get;
73 73
 		$this->_post   = $post;
74 74
 		$this->_cookie = $cookie;
75
-		$this->_params = array_merge( $get, $post );
75
+		$this->_params = array_merge($get, $post);
76 76
 		// AJAX ???
77
-		$this->ajax       = defined( 'DOING_AJAX' ) ? true : false;
78
-		$this->front_ajax = $this->is_set( 'ee_front_ajax' ) && $this->get( 'ee_front_ajax' ) == 1 ? true : false;
77
+		$this->ajax       = defined('DOING_AJAX') ? true : false;
78
+		$this->front_ajax = $this->is_set('ee_front_ajax') && $this->get('ee_front_ajax') == 1 ? true : false;
79 79
 		// grab user IP
80 80
 		$this->_ip_address = $this->_visitor_ip();
81 81
 	}
@@ -128,10 +128,10 @@  discard block
 block discarded – undo
128 128
 	 * @param bool $override_ee
129 129
 	 * @return    void
130 130
 	 */
131
-	public function set( $key, $value, $override_ee = FALSE ) {
131
+	public function set($key, $value, $override_ee = FALSE) {
132 132
 		// don't allow "ee" to be overwritten unless explicitly instructed to do so
133
-		if ( $key != 'ee' || ( $key == 'ee' && empty( $this->_params['ee'] )) || ( $key == 'ee' && ! empty( $this->_params['ee'] ) && $override_ee )) {
134
-			$this->_params[ $key ] = $value;
133
+		if ($key != 'ee' || ($key == 'ee' && empty($this->_params['ee'])) || ($key == 'ee' && ! empty($this->_params['ee']) && $override_ee)) {
134
+			$this->_params[$key] = $value;
135 135
 		}
136 136
 	}
137 137
 
@@ -145,8 +145,8 @@  discard block
 block discarded – undo
145 145
 	 * @param null $default
146 146
 	 * @return    mixed
147 147
 	 */
148
-	public function get( $key, $default = NULL ) {
149
-		return isset( $this->_params[ $key ] ) ? $this->_params[ $key ] : $default;
148
+	public function get($key, $default = NULL) {
149
+		return isset($this->_params[$key]) ? $this->_params[$key] : $default;
150 150
 	}
151 151
 
152 152
 
@@ -158,8 +158,8 @@  discard block
 block discarded – undo
158 158
 	 * @param $key
159 159
 	 * @return    boolean
160 160
 	 */
161
-	public function is_set( $key ) {
162
-		return isset( $this->_params[ $key ] ) ? TRUE : FALSE;
161
+	public function is_set($key) {
162
+		return isset($this->_params[$key]) ? TRUE : FALSE;
163 163
 	}
164 164
 
165 165
 
@@ -171,10 +171,10 @@  discard block
 block discarded – undo
171 171
 	 * @param $key
172 172
 	 * @param bool $unset_from_global_too
173 173
 	 */
174
-	public function un_set( $key, $unset_from_global_too = false ) {
175
-		unset( $this->_params[ $key ] );
176
-		if ( $unset_from_global_too ) {
177
-			unset( $_REQUEST[ $key ] );
174
+	public function un_set($key, $unset_from_global_too = false) {
175
+		unset($this->_params[$key]);
176
+		if ($unset_from_global_too) {
177
+			unset($_REQUEST[$key]);
178 178
 		}
179 179
 	}
180 180
 
@@ -208,10 +208,10 @@  discard block
 block discarded – undo
208 208
 			'HTTP_FORWARDED',
209 209
 			'REMOTE_ADDR'
210 210
 		);
211
-		foreach ( $server_keys as $key ) {
212
-			if ( isset( $_SERVER[ $key ] ) ) {
213
-				foreach ( array_map( 'trim', explode( ',', $_SERVER[ $key ] ) ) as $ip ) {
214
-					if ( $ip === '127.0.0.1' || filter_var( $ip, FILTER_VALIDATE_IP ) !== false ) {
211
+		foreach ($server_keys as $key) {
212
+			if (isset($_SERVER[$key])) {
213
+				foreach (array_map('trim', explode(',', $_SERVER[$key])) as $ip) {
214
+					if ($ip === '127.0.0.1' || filter_var($ip, FILTER_VALIDATE_IP) !== false) {
215 215
 						$visitor_ip = $ip;
216 216
 					}
217 217
 				}
Please login to merge, or discard this patch.
core/EE_Session.core.php 3 patches
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -341,7 +341,7 @@
 block discarded – undo
341 341
 		}
342 342
 		 if ( ! empty( $key ))  {
343 343
 			return  isset( $this->_session_data[ $key ] ) ? $this->_session_data[ $key ] : NULL;
344
-		}  else  {
344
+		} else  {
345 345
 			return $this->_session_data;
346 346
 		}
347 347
 	}
Please login to merge, or discard this patch.
Spacing   +182 added lines, -182 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php use EventEspresso\core\exceptions\InvalidSessionDataException;
2 2
 
3
-if (!defined( 'EVENT_ESPRESSO_VERSION')) {exit('No direct script access allowed');}
3
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {exit('No direct script access allowed'); }
4 4
 /**
5 5
  *
6 6
  * EE_Session class
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 	  * array for defining default session vars
92 92
 	  * @var array
93 93
 	  */
94
-	 private $_default_session_vars = array (
94
+	 private $_default_session_vars = array(
95 95
 		'id' => NULL,
96 96
 		'user_id' => NULL,
97 97
 		'ip_address' => NULL,
@@ -111,12 +111,12 @@  discard block
 block discarded – undo
111 111
 	  * @throws InvalidSessionDataException
112 112
 	  * @throws \EE_Error
113 113
 	  */
114
-	public static function instance( EE_Encryption $encryption = null ) {
114
+	public static function instance(EE_Encryption $encryption = null) {
115 115
 		// check if class object is instantiated
116 116
 		// session loading is turned ON by default, but prior to the init hook, can be turned back OFF via:
117 117
 		// add_filter( 'FHEE_load_EE_Session', '__return_false' );
118
-		if ( ! self::$_instance instanceof EE_Session && apply_filters( 'FHEE_load_EE_Session', true ) ) {
119
-			self::$_instance = new self( $encryption );
118
+		if ( ! self::$_instance instanceof EE_Session && apply_filters('FHEE_load_EE_Session', true)) {
119
+			self::$_instance = new self($encryption);
120 120
 		}
121 121
 		return self::$_instance;
122 122
 	}
@@ -132,15 +132,15 @@  discard block
 block discarded – undo
132 132
 	  * @throws \EE_Error
133 133
 	  * @throws \EventEspresso\core\exceptions\InvalidSessionDataException
134 134
 	  */
135
-	 protected function __construct( EE_Encryption $encryption = null ) {
135
+	 protected function __construct(EE_Encryption $encryption = null) {
136 136
 
137 137
 		// 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' );
138
-		if ( ! apply_filters( 'FHEE_load_EE_Session', TRUE ) ) {
138
+		if ( ! apply_filters('FHEE_load_EE_Session', TRUE)) {
139 139
 			return;
140 140
 		}
141
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
142
-		if ( ! defined( 'ESPRESSO_SESSION' ) ) {
143
-			define( 'ESPRESSO_SESSION', true );
141
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
142
+		if ( ! defined('ESPRESSO_SESSION')) {
143
+			define('ESPRESSO_SESSION', true);
144 144
 		}
145 145
 		// default session lifespan in seconds
146 146
 		$this->_lifespan = apply_filters(
@@ -154,36 +154,36 @@  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
-				$var_name = '_' . $var_name;
162
+				$var_name = '_'.$var_name;
163 163
 				$this->{$var_name} = $session_setting;
164 164
 			}
165 165
 		}
166 166
 		// are we using encryption?
167
-		if ( $this->_use_encryption && $encryption instanceof EE_Encryption ) {
167
+		if ($this->_use_encryption && $encryption instanceof EE_Encryption) {
168 168
 			// encrypt data via: $this->encryption->encrypt();
169 169
 			$this->encryption = $encryption;
170 170
 		}
171 171
 		// filter hook allows outside functions/classes/plugins to change default empty cart
172
-		$extra_default_session_vars = apply_filters( 'FHEE__EE_Session__construct__extra_default_session_vars', array() );
173
-		array_merge( $this->_default_session_vars, $extra_default_session_vars );
172
+		$extra_default_session_vars = apply_filters('FHEE__EE_Session__construct__extra_default_session_vars', array());
173
+		array_merge($this->_default_session_vars, $extra_default_session_vars);
174 174
 		// apply default session vars
175 175
 		$this->_set_defaults();
176 176
 		// check for existing session and retrieve it from db
177
-		if ( ! $this->_espresso_session() ) {
177
+		if ( ! $this->_espresso_session()) {
178 178
 			// or just start a new one
179 179
 			$this->_create_espresso_session();
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 );
186
-		add_filter( 'wp_redirect', array( $this, 'update_on_redirect' ), 100, 1 );
184
+		add_action('shutdown', array($this, 'update'), 100);
185
+		add_action('shutdown', array($this, 'garbage_collection'), 999);
186
+		add_filter('wp_redirect', array($this, 'update_on_redirect'), 100, 1);
187 187
 	}
188 188
 
189 189
 
@@ -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
 
@@ -299,9 +299,9 @@  discard block
 block discarded – undo
299 299
 	  * @return bool
300 300
 	  * @throws \EE_Error
301 301
 	  */
302
-	 public function set_transaction( EE_Transaction $transaction ) {
302
+	 public function set_transaction(EE_Transaction $transaction) {
303 303
 		 // first remove the session from the transaction before we save the transaction in the session
304
-		 $transaction->set_txn_session_data( NULL );
304
+		 $transaction->set_txn_session_data(NULL);
305 305
 		 $this->_session_data['transaction'] = $transaction;
306 306
 		 return TRUE;
307 307
 	 }
@@ -321,7 +321,7 @@  discard block
 block discarded – undo
321 321
 	  * @return \EE_Transaction
322 322
 	  */
323 323
 	 public function transaction() {
324
-		 return isset( $this->_session_data['transaction'] ) ? $this->_session_data['transaction'] : NULL;
324
+		 return isset($this->_session_data['transaction']) ? $this->_session_data['transaction'] : NULL;
325 325
 	 }
326 326
 
327 327
 
@@ -333,15 +333,15 @@  discard block
 block discarded – undo
333 333
 	  * @param bool $reset_cache
334 334
 	  * @return    array
335 335
 	  */
336
-	public function get_session_data( $key = NULL, $reset_cache = FALSE ) {
337
-		if ( $reset_cache ) {
336
+	public function get_session_data($key = NULL, $reset_cache = FALSE) {
337
+		if ($reset_cache) {
338 338
 			$this->reset_cart();
339 339
 			$this->reset_checkout();
340 340
 			$this->reset_transaction();
341 341
 		}
342
-		 if ( ! empty( $key ))  {
343
-			return  isset( $this->_session_data[ $key ] ) ? $this->_session_data[ $key ] : NULL;
344
-		}  else  {
342
+		 if ( ! empty($key)) {
343
+			return  isset($this->_session_data[$key]) ? $this->_session_data[$key] : NULL;
344
+		} else {
345 345
 			return $this->_session_data;
346 346
 		}
347 347
 	}
@@ -354,20 +354,20 @@  discard block
 block discarded – undo
354 354
 	  * @param 	array $data
355 355
 	  * @return 	TRUE on success, FALSE on fail
356 356
 	  */
357
-	public function set_session_data( $data ) {
357
+	public function set_session_data($data) {
358 358
 
359 359
 		// nothing ??? bad data ??? go home!
360
-		if ( empty( $data ) || ! is_array( $data )) {
361
-			EE_Error::add_error( __( 'No session data or invalid session data was provided.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
360
+		if (empty($data) || ! is_array($data)) {
361
+			EE_Error::add_error(__('No session data or invalid session data was provided.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
362 362
 			return FALSE;
363 363
 		}
364 364
 
365
-		foreach ( $data as $key =>$value ) {
366
-			if ( isset( $this->_default_session_vars[ $key ] )) {
367
-				EE_Error::add_error( sprintf( __( 'Sorry! %s is a default session datum and can not be reset.', 'event_espresso' ), $key ), __FILE__, __FUNCTION__, __LINE__ );
365
+		foreach ($data as $key =>$value) {
366
+			if (isset($this->_default_session_vars[$key])) {
367
+				EE_Error::add_error(sprintf(__('Sorry! %s is a default session datum and can not be reset.', 'event_espresso'), $key), __FILE__, __FUNCTION__, __LINE__);
368 368
 				return FALSE;
369 369
 			} else {
370
-				$this->_session_data[ $key ] = $value;
370
+				$this->_session_data[$key] = $value;
371 371
 			}
372 372
 		}
373 373
 
@@ -385,9 +385,9 @@  discard block
 block discarded – undo
385 385
 	  * @throws \EE_Error
386 386
 	  */
387 387
 	private function _espresso_session() {
388
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
388
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
389 389
 		// check that session has started
390
-		if ( session_id() === '' ) {
390
+		if (session_id() === '') {
391 391
 			//starts a new session if one doesn't already exist, or re-initiates an existing one
392 392
 			session_start();
393 393
 		}
@@ -396,18 +396,18 @@  discard block
 block discarded – undo
396 396
 		// and the visitors IP
397 397
 		$this->_ip_address = $this->_visitor_ip();
398 398
 		// set the "user agent"
399
-		$this->_user_agent = ( isset($_SERVER['HTTP_USER_AGENT'])) ? esc_attr( $_SERVER['HTTP_USER_AGENT'] ) : FALSE;
399
+		$this->_user_agent = (isset($_SERVER['HTTP_USER_AGENT'])) ? esc_attr($_SERVER['HTTP_USER_AGENT']) : FALSE;
400 400
 		// now let's retrieve what's in the db
401 401
 		// we're using WP's Transient API to store session data using the PHP session ID as the option name
402
-		$session_data = get_transient( EE_Session::session_id_prefix . $this->_sid );
403
-		if ( $session_data ) {
404
-			if ( apply_filters( 'FHEE__EE_Session___perform_session_id_hash_check', WP_DEBUG ) ) {
405
-				$hash_check = get_transient( EE_Session::hash_check_prefix . $this->_sid );
406
-				if ( $hash_check && $hash_check !== md5( $session_data ) ) {
402
+		$session_data = get_transient(EE_Session::session_id_prefix.$this->_sid);
403
+		if ($session_data) {
404
+			if (apply_filters('FHEE__EE_Session___perform_session_id_hash_check', WP_DEBUG)) {
405
+				$hash_check = get_transient(EE_Session::hash_check_prefix.$this->_sid);
406
+				if ($hash_check && $hash_check !== md5($session_data)) {
407 407
 					EE_Error::add_error(
408 408
 						sprintf(
409
-							__( 'The stored data for session %1$s failed to pass a hash check and therefore appears to be invalid.', 'event_espresso' ),
410
-							EE_Session::session_id_prefix . $this->_sid
409
+							__('The stored data for session %1$s failed to pass a hash check and therefore appears to be invalid.', 'event_espresso'),
410
+							EE_Session::session_id_prefix.$this->_sid
411 411
 						),
412 412
 						__FILE__, __FUNCTION__, __LINE__
413 413
 					);
@@ -418,33 +418,33 @@  discard block
 block discarded – undo
418 418
                 $session_data = $this->valid_base_64($session_data) ? base64_decode($session_data) : $session_data;
419 419
             }
420 420
 			// un-encrypt the data ?
421
-			$session_data = $this->_use_encryption ? $this->encryption->decrypt( $session_data ) : $session_data;
422
-			if ( ! is_array( $session_data ) ) {
421
+			$session_data = $this->_use_encryption ? $this->encryption->decrypt($session_data) : $session_data;
422
+			if ( ! is_array($session_data)) {
423 423
 				try {
424
-					$session_data = maybe_unserialize( $session_data );
425
-				} catch ( Exception $e ) {
424
+					$session_data = maybe_unserialize($session_data);
425
+				} catch (Exception $e) {
426 426
 					$msg = esc_html__(
427 427
 						'An error occurred while attempting to unserialize the session data.',
428 428
 						'event_espresso'
429 429
 					);
430
-					$msg .= WP_DEBUG ? '<br>' . $this->find_serialize_error( $session_data ) : '';
431
-					throw new InvalidSessionDataException( $msg, 0, $e );
430
+					$msg .= WP_DEBUG ? '<br>'.$this->find_serialize_error($session_data) : '';
431
+					throw new InvalidSessionDataException($msg, 0, $e);
432 432
 				}
433 433
 			}
434 434
 			// just a check to make sure the session array is indeed an array
435
-			if ( ! is_array( $session_data ) ) {
435
+			if ( ! is_array($session_data)) {
436 436
 				// no?!?! then something is wrong
437 437
 				$msg = esc_html__(
438 438
 					'The session data is missing, invalid, or corrupted.',
439 439
 					'event_espresso'
440 440
 				);
441
-				$msg .= WP_DEBUG ? '<br>' . $this->find_serialize_error( $session_data ) : '';
442
-				throw new InvalidSessionDataException( $msg );
441
+				$msg .= WP_DEBUG ? '<br>'.$this->find_serialize_error($session_data) : '';
442
+				throw new InvalidSessionDataException($msg);
443 443
 			}
444 444
 			// get the current time in UTC
445
-			$this->_time = isset( $this->_time ) ? $this->_time : time();
445
+			$this->_time = isset($this->_time) ? $this->_time : time();
446 446
 			// and reset the session expiration
447
-			$this->_expiration = isset( $session_data['expiration'] )
447
+			$this->_expiration = isset($session_data['expiration'])
448 448
 				? $session_data['expiration']
449 449
 				: $this->_time + $this->_lifespan;
450 450
 
@@ -452,24 +452,24 @@  discard block
 block discarded – undo
452 452
 			// set initial site access time and the session expiration
453 453
 			$this->_set_init_access_and_expiration();
454 454
 			// set referer
455
-			$this->_session_data[ 'pages_visited' ][ $this->_session_data['init_access'] ] = isset( $_SERVER['HTTP_REFERER'] )
456
-				? esc_attr( $_SERVER['HTTP_REFERER'] )
455
+			$this->_session_data['pages_visited'][$this->_session_data['init_access']] = isset($_SERVER['HTTP_REFERER'])
456
+				? esc_attr($_SERVER['HTTP_REFERER'])
457 457
 				: '';
458 458
 			// no previous session = go back and create one (on top of the data above)
459 459
 			return FALSE;
460 460
 		}
461 461
 		// now the user agent
462
-		if ( $session_data['user_agent'] !== $this->_user_agent ) {
462
+		if ($session_data['user_agent'] !== $this->_user_agent) {
463 463
 			return FALSE;
464 464
 		}
465 465
 		// wait a minute... how old are you?
466
-		if ( $this->_time > $this->_expiration ) {
466
+		if ($this->_time > $this->_expiration) {
467 467
 			// yer too old fer me!
468 468
 			// wipe out everything that isn't a default session datum
469
-			$this->clear_session( __CLASS__, __FUNCTION__ );
469
+			$this->clear_session(__CLASS__, __FUNCTION__);
470 470
 		}
471 471
 		// make event espresso session data available to plugin
472
-		$this->_session_data = array_merge( $this->_session_data, $session_data );
472
+		$this->_session_data = array_merge($this->_session_data, $session_data);
473 473
 		return TRUE;
474 474
 
475 475
 	}
@@ -487,12 +487,12 @@  discard block
 block discarded – undo
487 487
 	  */
488 488
 	protected function _generate_session_id() {
489 489
 		// check if the SID was passed explicitly, otherwise get from session, then add salt and hash it to reduce length
490
-		if ( isset( $_REQUEST[ 'EESID' ] ) ) {
491
-			$session_id = sanitize_text_field( $_REQUEST[ 'EESID' ] );
490
+		if (isset($_REQUEST['EESID'])) {
491
+			$session_id = sanitize_text_field($_REQUEST['EESID']);
492 492
 		} else {
493
-			$session_id = md5( session_id() . get_current_blog_id() . $this->_get_sid_salt() );
493
+			$session_id = md5(session_id().get_current_blog_id().$this->_get_sid_salt());
494 494
 		}
495
-		return apply_filters( 'FHEE__EE_Session___generate_session_id__session_id', $session_id );
495
+		return apply_filters('FHEE__EE_Session___generate_session_id__session_id', $session_id);
496 496
 	}
497 497
 
498 498
 
@@ -504,20 +504,20 @@  discard block
 block discarded – undo
504 504
 	  */
505 505
 	protected function _get_sid_salt() {
506 506
 		// was session id salt already saved to db ?
507
-		if ( empty( $this->_sid_salt ) ) {
507
+		if (empty($this->_sid_salt)) {
508 508
 			// no?  then maybe use WP defined constant
509
-			if ( defined( 'AUTH_SALT' ) ) {
509
+			if (defined('AUTH_SALT')) {
510 510
 				$this->_sid_salt = AUTH_SALT;
511 511
 			}
512 512
 			// if salt doesn't exist or is too short
513
-			if ( empty( $this->_sid_salt ) || strlen( $this->_sid_salt ) < 32 ) {
513
+			if (empty($this->_sid_salt) || strlen($this->_sid_salt) < 32) {
514 514
 				// create a new one
515
-				$this->_sid_salt = wp_generate_password( 64 );
515
+				$this->_sid_salt = wp_generate_password(64);
516 516
 			}
517 517
 			// and save it as a permanent session setting
518
-			$session_settings = get_option( 'ee_session_settings' );
519
-			$session_settings[ 'sid_salt' ] = $this->_sid_salt;
520
-			update_option( 'ee_session_settings', $session_settings );
518
+			$session_settings = get_option('ee_session_settings');
519
+			$session_settings['sid_salt'] = $this->_sid_salt;
520
+			update_option('ee_session_settings', $session_settings);
521 521
 		}
522 522
 		return $this->_sid_salt;
523 523
 	}
@@ -545,19 +545,19 @@  discard block
 block discarded – undo
545 545
 	  * @param bool $new_session
546 546
 	  * @return TRUE on success, FALSE on fail
547 547
 	  */
548
-	public function update( $new_session = FALSE ) {
549
-		$this->_session_data = isset( $this->_session_data )
550
-			&& is_array( $this->_session_data )
551
-			&& isset( $this->_session_data['id'])
548
+	public function update($new_session = FALSE) {
549
+		$this->_session_data = isset($this->_session_data)
550
+			&& is_array($this->_session_data)
551
+			&& isset($this->_session_data['id'])
552 552
 			? $this->_session_data
553 553
 			: NULL;
554
-		if ( empty( $this->_session_data )) {
554
+		if (empty($this->_session_data)) {
555 555
 			$this->_set_defaults();
556 556
 		}
557 557
 		$session_data = array();
558
-		foreach ( $this->_session_data as $key => $value ) {
558
+		foreach ($this->_session_data as $key => $value) {
559 559
 
560
-			switch( $key ) {
560
+			switch ($key) {
561 561
 
562 562
 				case 'id' :
563 563
 					// session ID
@@ -575,7 +575,7 @@  discard block
 block discarded – undo
575 575
 				break;
576 576
 
577 577
 				case 'init_access' :
578
-					$session_data['init_access'] = absint( $value );
578
+					$session_data['init_access'] = absint($value);
579 579
 				break;
580 580
 
581 581
 				case 'last_access' :
@@ -585,7 +585,7 @@  discard block
 block discarded – undo
585 585
 
586 586
 				case 'expiration' :
587 587
 					// when the session expires
588
-					$session_data['expiration'] = ! empty( $this->_expiration )
588
+					$session_data['expiration'] = ! empty($this->_expiration)
589 589
 						? $this->_expiration
590 590
 						: $session_data['init_access'] + $this->_lifespan;
591 591
 				break;
@@ -597,11 +597,11 @@  discard block
 block discarded – undo
597 597
 
598 598
 				case 'pages_visited' :
599 599
 					$page_visit = $this->_get_page_visit();
600
-					if ( $page_visit ) {
600
+					if ($page_visit) {
601 601
 						// set pages visited where the first will be the http referrer
602
-						$this->_session_data[ 'pages_visited' ][ $this->_time ] = $page_visit;
602
+						$this->_session_data['pages_visited'][$this->_time] = $page_visit;
603 603
 						// we'll only save the last 10 page visits.
604
-						$session_data[ 'pages_visited' ] = array_slice( $this->_session_data['pages_visited'], -10 );
604
+						$session_data['pages_visited'] = array_slice($this->_session_data['pages_visited'], -10);
605 605
 					}
606 606
 				break;
607 607
 
@@ -615,9 +615,9 @@  discard block
 block discarded – undo
615 615
 
616 616
 		$this->_session_data = $session_data;
617 617
 		// creating a new session does not require saving to the db just yet
618
-		if ( ! $new_session ) {
618
+		if ( ! $new_session) {
619 619
 			// ready? let's save
620
-			if ( $this->_save_session_to_db() ) {
620
+			if ($this->_save_session_to_db()) {
621 621
 				return TRUE;
622 622
 			} else {
623 623
 				return FALSE;
@@ -639,7 +639,7 @@  discard block
 block discarded – undo
639 639
 	  * @param string $location
640 640
 	  * @return mixed
641 641
 	  */
642
-	 public function update_on_redirect( $location ) {
642
+	 public function update_on_redirect($location) {
643 643
 		 $this->update();
644 644
 		 return $location;
645 645
 	}
@@ -651,9 +651,9 @@  discard block
 block discarded – undo
651 651
 	 * 	@return bool
652 652
 	 */
653 653
 	private function _create_espresso_session( ) {
654
-		do_action( 'AHEE_log', __CLASS__, __FUNCTION__, '' );
654
+		do_action('AHEE_log', __CLASS__, __FUNCTION__, '');
655 655
 		// use the update function for now with $new_session arg set to TRUE
656
-		return  $this->update( TRUE ) ? TRUE : FALSE;
656
+		return  $this->update(TRUE) ? TRUE : FALSE;
657 657
 	}
658 658
 
659 659
 
@@ -680,7 +680,7 @@  discard block
 block discarded – undo
680 680
 				// OR an admin request that is NOT AJAX
681 681
 				|| (
682 682
 					is_admin()
683
-					&& ! ( defined( 'DOING_AJAX' ) && DOING_AJAX )
683
+					&& ! (defined('DOING_AJAX') && DOING_AJAX)
684 684
 				)
685 685
 			)
686 686
 		) {
@@ -693,13 +693,13 @@  discard block
 block discarded – undo
693 693
             $session_data = base64_encode($this->_session_data);
694 694
         }
695 695
 		// encrypt it if we are using encryption
696
-		$session_data = $this->_use_encryption ? $this->encryption->encrypt( $session_data ) : $session_data;
696
+		$session_data = $this->_use_encryption ? $this->encryption->encrypt($session_data) : $session_data;
697 697
 		// maybe save hash check
698
-		if ( apply_filters( 'FHEE__EE_Session___perform_session_id_hash_check', WP_DEBUG ) ) {
699
-			set_transient( EE_Session::hash_check_prefix . $this->_sid, md5( $session_data ), $this->_lifespan );
698
+		if (apply_filters('FHEE__EE_Session___perform_session_id_hash_check', WP_DEBUG)) {
699
+			set_transient(EE_Session::hash_check_prefix.$this->_sid, md5($session_data), $this->_lifespan);
700 700
 		}
701 701
 		// we're using the Transient API for storing session data, cuz it's so damn simple -> set_transient(  transient ID, data, expiry )
702
-		return set_transient( EE_Session::session_id_prefix . $this->_sid, $session_data, $this->_lifespan );
702
+		return set_transient(EE_Session::session_id_prefix.$this->_sid, $session_data, $this->_lifespan);
703 703
 	}
704 704
 
705 705
 
@@ -725,10 +725,10 @@  discard block
 block discarded – undo
725 725
 			'HTTP_FORWARDED',
726 726
 			'REMOTE_ADDR'
727 727
 		);
728
-		foreach ( $server_keys as $key ){
729
-			if ( isset( $_SERVER[ $key ] )) {
730
-				foreach ( array_map( 'trim', explode( ',', $_SERVER[ $key ] )) as $ip ) {
731
-					if ( $ip === '127.0.0.1' || filter_var( $ip, FILTER_VALIDATE_IP ) !== FALSE ) {
728
+		foreach ($server_keys as $key) {
729
+			if (isset($_SERVER[$key])) {
730
+				foreach (array_map('trim', explode(',', $_SERVER[$key])) as $ip) {
731
+					if ($ip === '127.0.0.1' || filter_var($ip, FILTER_VALIDATE_IP) !== FALSE) {
732 732
 						$visitor_ip = $ip;
733 733
 					}
734 734
 				}
@@ -747,32 +747,32 @@  discard block
 block discarded – undo
747 747
 	 *			@return string
748 748
 	 */
749 749
 	public function _get_page_visit() {
750
-		$page_visit = home_url('/') . 'wp-admin/admin-ajax.php';
750
+		$page_visit = home_url('/').'wp-admin/admin-ajax.php';
751 751
 		// check for request url
752
-		if ( isset( $_SERVER['REQUEST_URI'] )) {
752
+		if (isset($_SERVER['REQUEST_URI'])) {
753 753
 			$http_host = '';
754 754
 			$page_id = '?';
755 755
 			$e_reg = '';
756
-			$request_uri = esc_url( $_SERVER['REQUEST_URI'] );
757
-			$ru_bits = explode( '?', $request_uri );
756
+			$request_uri = esc_url($_SERVER['REQUEST_URI']);
757
+			$ru_bits = explode('?', $request_uri);
758 758
 			$request_uri = $ru_bits[0];
759 759
 			// check for and grab host as well
760
-			if ( isset( $_SERVER['HTTP_HOST'] )) {
761
-				$http_host = esc_url( $_SERVER['HTTP_HOST'] );
760
+			if (isset($_SERVER['HTTP_HOST'])) {
761
+				$http_host = esc_url($_SERVER['HTTP_HOST']);
762 762
 			}
763 763
 			// check for page_id in SERVER REQUEST
764
-			if ( isset( $_REQUEST['page_id'] )) {
764
+			if (isset($_REQUEST['page_id'])) {
765 765
 				// rebuild $e_reg without any of the extra parameters
766
-				$page_id = '?page_id=' . esc_attr( $_REQUEST['page_id'] ) . '&amp;';
766
+				$page_id = '?page_id='.esc_attr($_REQUEST['page_id']).'&amp;';
767 767
 			}
768 768
 			// check for $e_reg in SERVER REQUEST
769
-			if ( isset( $_REQUEST['ee'] )) {
769
+			if (isset($_REQUEST['ee'])) {
770 770
 				// rebuild $e_reg without any of the extra parameters
771
-				$e_reg = 'ee=' . esc_attr( $_REQUEST['ee'] );
771
+				$e_reg = 'ee='.esc_attr($_REQUEST['ee']);
772 772
 			}
773
-			$page_visit = rtrim( $http_host . $request_uri . $page_id . $e_reg, '?' );
773
+			$page_visit = rtrim($http_host.$request_uri.$page_id.$e_reg, '?');
774 774
 		}
775
-		return $page_visit !== home_url( '/wp-admin/admin-ajax.php' ) ? $page_visit : '';
775
+		return $page_visit !== home_url('/wp-admin/admin-ajax.php') ? $page_visit : '';
776 776
 
777 777
 	}
778 778
 
@@ -801,14 +801,14 @@  discard block
 block discarded – undo
801 801
 	  * @param string $function
802 802
 	  * @return void
803 803
 	  */
804
-	public function clear_session( $class = '', $function = '' ) {
804
+	public function clear_session($class = '', $function = '') {
805 805
 		//echo '<h3 style="color:#999;line-height:.9em;"><span style="color:#2EA2CC">' . __CLASS__ . '</span>::<span style="color:#E76700">' . __FUNCTION__ . '( ' . $class . '::' . $function . '() )</span><br/><span style="font-size:9px;font-weight:normal;">' . __FILE__ . '</span>    <b style="font-size:10px;">  ' . __LINE__ . ' </b></h3>';
806
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, 'session cleared by : ' . $class . '::' .  $function . '()' );
806
+		do_action('AHEE_log', __FILE__, __FUNCTION__, 'session cleared by : '.$class.'::'.$function.'()');
807 807
 		$this->reset_cart();
808 808
 		$this->reset_checkout();
809 809
 		$this->reset_transaction();
810 810
 		// wipe out everything that isn't a default session datum
811
-		$this->reset_data( array_keys( $this->_session_data ));
811
+		$this->reset_data(array_keys($this->_session_data));
812 812
 		// reset initial site access time and the session expiration
813 813
 		$this->_set_init_access_and_expiration();
814 814
 		$this->_save_session_to_db();
@@ -823,42 +823,42 @@  discard block
 block discarded – undo
823 823
 	  * @param bool  $show_all_notices
824 824
 	  * @return TRUE on success, FALSE on fail
825 825
 	  */
826
-	public function reset_data( $data_to_reset = array(), $show_all_notices = FALSE ) {
826
+	public function reset_data($data_to_reset = array(), $show_all_notices = FALSE) {
827 827
 		// if $data_to_reset is not in an array, then put it in one
828
-		if ( ! is_array( $data_to_reset ) ) {
829
-			$data_to_reset = array ( $data_to_reset );
828
+		if ( ! is_array($data_to_reset)) {
829
+			$data_to_reset = array($data_to_reset);
830 830
 		}
831 831
 		// nothing ??? go home!
832
-		if ( empty( $data_to_reset )) {
833
-			EE_Error::add_error( __( 'No session data could be reset, because no session var name was provided.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
832
+		if (empty($data_to_reset)) {
833
+			EE_Error::add_error(__('No session data could be reset, because no session var name was provided.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
834 834
 			return FALSE;
835 835
 		}
836 836
 		$return_value = TRUE;
837 837
 		// since $data_to_reset is an array, cycle through the values
838
-		foreach ( $data_to_reset as $reset ) {
838
+		foreach ($data_to_reset as $reset) {
839 839
 
840 840
 			// first check to make sure it is a valid session var
841
-			if ( isset( $this->_session_data[ $reset ] )) {
841
+			if (isset($this->_session_data[$reset])) {
842 842
 				// then check to make sure it is not a default var
843
-				if ( ! array_key_exists( $reset, $this->_default_session_vars )) {
843
+				if ( ! array_key_exists($reset, $this->_default_session_vars)) {
844 844
 					// remove session var
845
-					unset( $this->_session_data[ $reset ] );
846
-					if ( $show_all_notices ) {
847
-						EE_Error::add_success( sprintf( __( 'The session variable %s was removed.', 'event_espresso' ), $reset ), __FILE__, __FUNCTION__, __LINE__ );
845
+					unset($this->_session_data[$reset]);
846
+					if ($show_all_notices) {
847
+						EE_Error::add_success(sprintf(__('The session variable %s was removed.', 'event_espresso'), $reset), __FILE__, __FUNCTION__, __LINE__);
848 848
 					}
849
-					$return_value = !isset($return_value) ? TRUE : $return_value;
849
+					$return_value = ! isset($return_value) ? TRUE : $return_value;
850 850
 
851 851
 				} else {
852 852
 					// yeeeeeeeeerrrrrrrrrrr OUT !!!!
853
-					if ( $show_all_notices ) {
854
-						EE_Error::add_error( sprintf( __( 'Sorry! %s is a default session datum and can not be reset.', 'event_espresso' ), $reset ), __FILE__, __FUNCTION__, __LINE__ );
853
+					if ($show_all_notices) {
854
+						EE_Error::add_error(sprintf(__('Sorry! %s is a default session datum and can not be reset.', 'event_espresso'), $reset), __FILE__, __FUNCTION__, __LINE__);
855 855
 					}
856 856
 					$return_value = FALSE;
857 857
 				}
858 858
 
859
-			} else if ( $show_all_notices ) {
859
+			} else if ($show_all_notices) {
860 860
 				// oops! that session var does not exist!
861
-				EE_Error::add_error( sprintf( __( 'The session item provided, %s, is invalid or does not exist.', 'event_espresso' ), $reset ), __FILE__, __FUNCTION__, __LINE__ );
861
+				EE_Error::add_error(sprintf(__('The session item provided, %s, is invalid or does not exist.', 'event_espresso'), $reset), __FILE__, __FUNCTION__, __LINE__);
862 862
 				$return_value = FALSE;
863 863
 			}
864 864
 
@@ -878,8 +878,8 @@  discard block
 block discarded – undo
878 878
 	 *   @access public
879 879
 	 */
880 880
 	public function wp_loaded() {
881
-		if ( isset(  EE_Registry::instance()->REQ ) && EE_Registry::instance()->REQ->is_set( 'clear_session' )) {
882
-			$this->clear_session( __CLASS__, __FUNCTION__ );
881
+		if (isset(EE_Registry::instance()->REQ) && EE_Registry::instance()->REQ->is_set('clear_session')) {
882
+			$this->clear_session(__CLASS__, __FUNCTION__);
883 883
 		}
884 884
 	}
885 885
 
@@ -904,24 +904,24 @@  discard block
 block discarded – undo
904 904
 	  */
905 905
 	 public function garbage_collection() {
906 906
 		 // only perform during regular requests
907
-		 if ( ! defined( 'DOING_AJAX') || ! DOING_AJAX ) {
907
+		 if ( ! defined('DOING_AJAX') || ! DOING_AJAX) {
908 908
 			 /** @type WPDB $wpdb */
909 909
 			 global $wpdb;
910 910
 			 // since transient expiration timestamps are set in the future, we can compare against NOW
911 911
 			 $expiration = time();
912
-			 $too_far_in_the_the_future = $expiration + ( $this->_lifespan * 2 );
912
+			 $too_far_in_the_the_future = $expiration + ($this->_lifespan * 2);
913 913
 			 // filter the query limit. Set to 0 to turn off garbage collection
914
-			 $expired_session_transient_delete_query_limit = absint( apply_filters( 'FHEE__EE_Session__garbage_collection___expired_session_transient_delete_query_limit', 50 ));
914
+			 $expired_session_transient_delete_query_limit = absint(apply_filters('FHEE__EE_Session__garbage_collection___expired_session_transient_delete_query_limit', 50));
915 915
 			 // non-zero LIMIT means take out the trash
916
-			 if ( $expired_session_transient_delete_query_limit ) {
916
+			 if ($expired_session_transient_delete_query_limit) {
917 917
 				 //array of transient keys that require garbage collection
918 918
 				 $session_keys = array(
919 919
 					 EE_Session::session_id_prefix,
920 920
 					 EE_Session::hash_check_prefix,
921 921
 				 );
922
-				 foreach ( $session_keys as $session_key ) {
923
-					 $session_key = str_replace( '_', '\_', $session_key );
924
-					 $session_key = '\_transient\_timeout\_' . $session_key . '%';
922
+				 foreach ($session_keys as $session_key) {
923
+					 $session_key = str_replace('_', '\_', $session_key);
924
+					 $session_key = '\_transient\_timeout\_'.$session_key.'%';
925 925
 					 $SQL = "
926 926
 					SELECT option_name
927 927
 					FROM {$wpdb->options}
@@ -931,25 +931,25 @@  discard block
 block discarded – undo
931 931
 					OR option_value > {$too_far_in_the_the_future} )
932 932
 					LIMIT {$expired_session_transient_delete_query_limit}
933 933
 				";
934
-					 $expired_sessions = $wpdb->get_col( $SQL );
934
+					 $expired_sessions = $wpdb->get_col($SQL);
935 935
 					 // valid results?
936
-					 if ( ! $expired_sessions instanceof WP_Error && ! empty( $expired_sessions ) ) {
936
+					 if ( ! $expired_sessions instanceof WP_Error && ! empty($expired_sessions)) {
937 937
 						 // format array of results into something usable within the actual DELETE query's IN clause
938 938
 						 $expired = array();
939
-						 foreach ( $expired_sessions as $expired_session ) {
940
-							 $expired[ ] = "'" . $expired_session . "'";
941
-							 $expired[ ] = "'" . str_replace( 'timeout_', '', $expired_session ) . "'";
939
+						 foreach ($expired_sessions as $expired_session) {
940
+							 $expired[] = "'".$expired_session."'";
941
+							 $expired[] = "'".str_replace('timeout_', '', $expired_session)."'";
942 942
 						 }
943
-						 $expired = implode( ', ', $expired );
943
+						 $expired = implode(', ', $expired);
944 944
 						 $SQL = "
945 945
 						DELETE FROM {$wpdb->options}
946 946
 						WHERE option_name
947 947
 						IN ( $expired );
948 948
 					 ";
949
-						 $results = $wpdb->query( $SQL );
949
+						 $results = $wpdb->query($SQL);
950 950
 						 // if something went wrong, then notify the admin
951
-						 if ( $results instanceof WP_Error && is_admin() ) {
952
-							 EE_Error::add_error( $results->get_error_message(), __FILE__, __FUNCTION__, __LINE__ );
951
+						 if ($results instanceof WP_Error && is_admin()) {
952
+							 EE_Error::add_error($results->get_error_message(), __FILE__, __FUNCTION__, __LINE__);
953 953
 						 }
954 954
 					 }
955 955
 				 }
@@ -970,18 +970,18 @@  discard block
 block discarded – undo
970 970
 	  * @param $string
971 971
 	  * @return bool
972 972
 	  */
973
-	 private function valid_base_64( $string ) {
974
-		 $decoded = base64_decode( $string, true );
973
+	 private function valid_base_64($string) {
974
+		 $decoded = base64_decode($string, true);
975 975
 		 // Check if there is no invalid character in string
976
-		 if ( ! preg_match( '/^[a-zA-Z0-9\/\r\n+]*={0,2}$/', $string ) ) {
976
+		 if ( ! preg_match('/^[a-zA-Z0-9\/\r\n+]*={0,2}$/', $string)) {
977 977
 			 return false;
978 978
 		 }
979 979
 		 // Decode the string in strict mode and send the response
980
-		 if ( ! base64_decode( $string, true ) ) {
980
+		 if ( ! base64_decode($string, true)) {
981 981
 			 return false;
982 982
 		 }
983 983
 		 // Encode and compare it to original one
984
-		 return base64_encode( $decoded ) === $string;
984
+		 return base64_encode($decoded) === $string;
985 985
 	 }
986 986
 
987 987
 
@@ -991,34 +991,34 @@  discard block
 block discarded – undo
991 991
 	  * @param $data1
992 992
 	  * @return string
993 993
 	  */
994
-	 private function find_serialize_error( $data1 ) {
994
+	 private function find_serialize_error($data1) {
995 995
 		$error = "<pre>";
996 996
 		 $data2 = preg_replace_callback(
997 997
 			 '!s:(\d+):"(.*?)";!',
998
-			 function ( $match ) {
999
-				 return ( $match[1] === strlen( $match[2] ) )
998
+			 function($match) {
999
+				 return ($match[1] === strlen($match[2]))
1000 1000
 					 ? $match[0]
1001 1001
 					 : 's:'
1002
-					   . strlen( $match[2] )
1002
+					   . strlen($match[2])
1003 1003
 					   . ':"'
1004 1004
 					   . $match[2]
1005 1005
 					   . '";';
1006 1006
 			 },
1007 1007
 			 $data1
1008 1008
 		 );
1009
-		$max = ( strlen( $data1 ) > strlen( $data2 ) ) ? strlen( $data1 ) : strlen( $data2 );
1010
-		$error .= $data1 . PHP_EOL;
1011
-		$error .= $data2 . PHP_EOL;
1012
-		for ( $i = 0; $i < $max; $i++ ) {
1013
-			if ( @$data1[ $i ] !== @$data2[ $i ] ) {
1014
-				$error .= "Difference " . @$data1[ $i ] . " != " . @$data2[ $i ] . PHP_EOL;
1015
-				$error .= "\t-> ORD number " . ord( @$data1[ $i ] ) . " != " . ord( @$data2[ $i ] ) . PHP_EOL;
1016
-				$error .= "\t-> Line Number = $i" . PHP_EOL;
1017
-				$start = ( $i - 20 );
1018
-				$start = ( $start < 0 ) ? 0 : $start;
1009
+		$max = (strlen($data1) > strlen($data2)) ? strlen($data1) : strlen($data2);
1010
+		$error .= $data1.PHP_EOL;
1011
+		$error .= $data2.PHP_EOL;
1012
+		for ($i = 0; $i < $max; $i++) {
1013
+			if (@$data1[$i] !== @$data2[$i]) {
1014
+				$error .= "Difference ".@$data1[$i]." != ".@$data2[$i].PHP_EOL;
1015
+				$error .= "\t-> ORD number ".ord(@$data1[$i])." != ".ord(@$data2[$i]).PHP_EOL;
1016
+				$error .= "\t-> Line Number = $i".PHP_EOL;
1017
+				$start = ($i - 20);
1018
+				$start = ($start < 0) ? 0 : $start;
1019 1019
 				$length = 40;
1020 1020
 				$point = $max - $i;
1021
-				if ( $point < 20 ) {
1021
+				if ($point < 20) {
1022 1022
 					$rlength = 1;
1023 1023
 					$rpoint = -$point;
1024 1024
 				} else {
@@ -1027,16 +1027,16 @@  discard block
 block discarded – undo
1027 1027
 				}
1028 1028
 				$error .= "\t-> Section Data1  = ";
1029 1029
 				$error .= substr_replace(
1030
-					substr( $data1, $start, $length ),
1031
-					"<b style=\"color:green\">{$data1[ $i ]}</b>",
1030
+					substr($data1, $start, $length),
1031
+					"<b style=\"color:green\">{$data1[$i]}</b>",
1032 1032
 					$rpoint,
1033 1033
 					$rlength
1034 1034
 				);
1035 1035
 				$error .= PHP_EOL;
1036 1036
 				$error .= "\t-> Section Data2  = ";
1037 1037
 				$error .= substr_replace(
1038
-					substr( $data2, $start, $length ),
1039
-					"<b style=\"color:red\">{$data2[ $i ]}</b>",
1038
+					substr($data2, $start, $length),
1039
+					"<b style=\"color:red\">{$data2[$i]}</b>",
1040 1040
 					$rpoint,
1041 1041
 					$rlength
1042 1042
 				);
Please login to merge, or discard this patch.
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -414,7 +414,7 @@  discard block
 block discarded – undo
414 414
 				}
415 415
 			}
416 416
 			// decode the data ?
417
-            $session_data = $this->valid_base_64($session_data) ? base64_decode($session_data) : $session_data;
417
+			$session_data = $this->valid_base_64($session_data) ? base64_decode($session_data) : $session_data;
418 418
 			// un-encrypt the data ?
419 419
 			$session_data = $this->_use_encryption ? $this->encryption->decrypt( $session_data ) : $session_data;
420 420
 			if ( ! is_array( $session_data ) ) {
@@ -684,12 +684,12 @@  discard block
 block discarded – undo
684 684
 		) {
685 685
 			return false;
686 686
 		}
687
-        // then serialize all of our session data
688
-        $session_data = serialize($this->_session_data);
689
-        // do we need to also encode it to avoid corrupted data when saved to the db?
690
-        if (EE_Registry::instance()->CFG->admin->encode_session_data()) {
691
-            $session_data = base64_encode($session_data);
692
-        }
687
+		// then serialize all of our session data
688
+		$session_data = serialize($this->_session_data);
689
+		// do we need to also encode it to avoid corrupted data when saved to the db?
690
+		if (EE_Registry::instance()->CFG->admin->encode_session_data()) {
691
+			$session_data = base64_encode($session_data);
692
+		}
693 693
 		// encrypt it if we are using encryption
694 694
 		$session_data = $this->_use_encryption ? $this->encryption->encrypt( $session_data ) : $session_data;
695 695
 		// maybe save hash check
Please login to merge, or discard this patch.
core/exceptions/InvalidSessionDataException.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 namespace EventEspresso\core\exceptions;
3 3
 
4
-defined( 'ABSPATH' ) || exit;
4
+defined('ABSPATH') || exit;
5 5
 
6 6
 
7 7
 
@@ -22,11 +22,11 @@  discard block
 block discarded – undo
22 22
 	 * @param int        $code
23 23
 	 * @param \Exception $previous
24 24
 	 */
25
-	public function __construct( $message = '', $code = 0, \Exception $previous = null ) {
26
-		if ( empty( $message ) ) {
27
-			$message = esc_html__( 'The session data is either missing or invalid.', 'event_espresso' );
25
+	public function __construct($message = '', $code = 0, \Exception $previous = null) {
26
+		if (empty($message)) {
27
+			$message = esc_html__('The session data is either missing or invalid.', 'event_espresso');
28 28
 		}
29
-		parent::__construct( $message, $code, $previous );
29
+		parent::__construct($message, $code, $previous);
30 30
 	}
31 31
 
32 32
 
Please login to merge, or discard this patch.
support/templates/support_admin_details_additional_information.template.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,3 +1,3 @@
 block discarded – undo
1 1
 <div class="padding">
2
-	<p><?php printf( esc_html__( 'Check out the %1$sroadmap for Event Espresso%2$s.', 'event_espresso' ), '<a href="https://trello.com/b/zg9DCIpe/event-espresso-public-roadmap" target="_blank">','</a>' ); ?></p>
2
+	<p><?php printf(esc_html__('Check out the %1$sroadmap for Event Espresso%2$s.', 'event_espresso'), '<a href="https://trello.com/b/zg9DCIpe/event-espresso-public-roadmap" target="_blank">', '</a>'); ?></p>
3 3
 </div>
4 4
\ No newline at end of file
Please login to merge, or discard this patch.
admin/extend/support/templates/support_admin_details_faq.template.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@
 block discarded – undo
1 1
 <div class="padding">
2
-	<h3><?php esc_html_e( 'Frequently Asked Questions about Event Espresso', 'event_espresso' ); ?></h3>
2
+	<h3><?php esc_html_e('Frequently Asked Questions about Event Espresso', 'event_espresso'); ?></h3>
3 3
 	
4
-	<h4><?php esc_html_e( 'New to Event Espresso?', 'event_espresso' ); ?></h4>
4
+	<h4><?php esc_html_e('New to Event Espresso?', 'event_espresso'); ?></h4>
5 5
 
6
-	<p><?php printf( esc_html__( 'Check out the %1$squick start guide for Event Espresso 4%2$s. It has recommendations, tips, and tutorials so you can get your project started %3$squicker%4$s.', 'event_espresso' ), '<a href="https://eventespresso.com/wiki/welcome-to-event-espresso/#event-espresso-4" target="_blank">','</a>','<em>','</em>' ); ?></p>
6
+	<p><?php printf(esc_html__('Check out the %1$squick start guide for Event Espresso 4%2$s. It has recommendations, tips, and tutorials so you can get your project started %3$squicker%4$s.', 'event_espresso'), '<a href="https://eventespresso.com/wiki/welcome-to-event-espresso/#event-espresso-4" target="_blank">', '</a>', '<em>', '</em>'); ?></p>
7 7
 </div>
8 8
\ No newline at end of file
Please login to merge, or discard this patch.
admin/extend/general_settings/Extend_General_Settings_Admin_Page.core.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (!defined('EVENT_ESPRESSO_VERSION') )
2
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
3 3
 	exit('NO direct script access allowed');
4 4
 
5 5
 /**
@@ -32,20 +32,20 @@  discard block
 block discarded – undo
32 32
 
33 33
 
34 34
 
35
-	public function __construct( $routing = TRUE ) {
36
-		parent::__construct( $routing );
37
-		define( 'GEN_SET_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND . 'general_settings/templates/' );
35
+	public function __construct($routing = TRUE) {
36
+		parent::__construct($routing);
37
+		define('GEN_SET_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND.'general_settings/templates/');
38 38
 	}
39 39
 
40 40
 
41 41
 
42 42
 	protected function _extend_page_config() {
43 43
 
44
-		$this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND . 'general_settings';
44
+		$this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND.'general_settings';
45 45
 
46 46
 		//filters and action hooks here
47
-		add_action( 'AHEE__admin_option_settings__template__before', array( $this, 'debug_logging_options' ), 9 );
48
-		add_filter( 'FHEE__General_Settings_Admin_Page___update_admin_option_settings__CFG_admin', array( $this, 'update_debug_logging_options' ), 10, 1 );
47
+		add_action('AHEE__admin_option_settings__template__before', array($this, 'debug_logging_options'), 9);
48
+		add_filter('FHEE__General_Settings_Admin_Page___update_admin_option_settings__CFG_admin', array($this, 'update_debug_logging_options'), 10, 1);
49 49
 
50 50
 	}
51 51
 
@@ -59,12 +59,12 @@  discard block
 block discarded – undo
59 59
 	 * @param array $template_args
60 60
 	 * @return void
61 61
 	 */
62
-	public function debug_logging_options( $template_args = array() ) {
62
+	public function debug_logging_options($template_args = array()) {
63 63
 		$template_args['use_full_logging'] = EE_Registry::instance()->CFG->admin->use_full_logging;
64
-		$template_args['use_remote_logging'] = isset( EE_Registry::instance()->CFG->admin->use_remote_logging ) ? absint( EE_Registry::instance()->CFG->admin->use_remote_logging ) : FALSE;
65
-		$template_args['remote_logging_url'] = isset( EE_Registry::instance()->CFG->admin->remote_logging_url ) && ! empty( EE_Registry::instance()->CFG->admin->remote_logging_url ) ? stripslashes( EE_Registry::instance()->CFG->admin->remote_logging_url ) : '';
66
-		$template = GEN_SET_CAF_TEMPLATE_PATH . 'debug_log_settings.template.php';
67
-		EEH_Template::display_template( $template, $template_args );
64
+		$template_args['use_remote_logging'] = isset(EE_Registry::instance()->CFG->admin->use_remote_logging) ? absint(EE_Registry::instance()->CFG->admin->use_remote_logging) : FALSE;
65
+		$template_args['remote_logging_url'] = isset(EE_Registry::instance()->CFG->admin->remote_logging_url) && ! empty(EE_Registry::instance()->CFG->admin->remote_logging_url) ? stripslashes(EE_Registry::instance()->CFG->admin->remote_logging_url) : '';
66
+		$template = GEN_SET_CAF_TEMPLATE_PATH.'debug_log_settings.template.php';
67
+		EEH_Template::display_template($template, $template_args);
68 68
 	}
69 69
 
70 70
 
@@ -75,17 +75,17 @@  discard block
 block discarded – undo
75 75
 	 * @param array $admin_options
76 76
 	 * @return array
77 77
 	 */
78
-	public function update_debug_logging_options( $admin_options = array() ) {
79
-		$use_full_logging = isset( $this->_req_data['use_full_logging'] ) ? (bool)absint( $this->_req_data['use_full_logging'] ) : $admin_options->use_full_logging;
78
+	public function update_debug_logging_options($admin_options = array()) {
79
+		$use_full_logging = isset($this->_req_data['use_full_logging']) ? (bool) absint($this->_req_data['use_full_logging']) : $admin_options->use_full_logging;
80 80
 		$admin_options->use_full_logging = $use_full_logging;
81 81
 
82
-		if ( $use_full_logging === FALSE ) {
83
-			EE_Error::get_notices( FALSE );
82
+		if ($use_full_logging === FALSE) {
83
+			EE_Error::get_notices(FALSE);
84 84
 			EE_Error::reset_notices();
85 85
 		}
86 86
 
87
-		$admin_options->use_remote_logging = isset( $this->_req_data['use_remote_logging'] ) ? absint( $this->_req_data['use_remote_logging'] ) : $admin_options->use_remote_logging;
88
-		$admin_options->remote_logging_url = isset( $this->_req_data['remote_logging_url'] ) ? esc_url_raw( $this->_req_data['remote_logging_url'] ) : $admin_options->remote_logging_url;
87
+		$admin_options->use_remote_logging = isset($this->_req_data['use_remote_logging']) ? absint($this->_req_data['use_remote_logging']) : $admin_options->use_remote_logging;
88
+		$admin_options->remote_logging_url = isset($this->_req_data['remote_logging_url']) ? esc_url_raw($this->_req_data['remote_logging_url']) : $admin_options->remote_logging_url;
89 89
 		return $admin_options;
90 90
 	}
91 91
 
Please login to merge, or discard this patch.
admin_pages/general_settings/AdminOptionsSettings.php 2 patches
Indentation   +218 added lines, -218 removed lines patch added patch discarded remove patch
@@ -30,224 +30,224 @@
 block discarded – undo
30 30
 class AdminOptionsSettings extends FormHandler
31 31
 {
32 32
 
33
-    protected $template_args = array();
34
-
35
-    /**
36
-     * Form constructor.
37
-     *
38
-     * @param \EE_Registry $registry
39
-     */
40
-    public function __construct(\EE_Registry $registry) {
41
-        parent::__construct(
42
-            esc_html__('Admin Options', 'event_espresso'),
43
-            esc_html__('Admin Options', 'event_espresso'),
44
-            'admin_option_settings',
45
-            '',
46
-            FormHandler::DO_NOT_SETUP_FORM,
47
-            $registry
48
-        );
49
-    }
50
-
51
-
52
-
53
-    /**
54
-     * @param array $template_args
55
-     */
56
-    public function setTemplateArgs(array $template_args)
57
-    {
58
-        $this->template_args = $template_args;
59
-    }
60
-
61
-
62
-
63
-    /**
64
-     * creates and returns the actual form
65
-     *
66
-     * @return EE_Form_Section_Proper
67
-     * @throws \EE_Error
68
-     */
69
-    public function generate()
70
-    {
71
-        $form = new \EE_Form_Section_Proper(
72
-            array(
73
-                'name'            => 'admin_option_settings',
74
-                'html_id'         => 'admin_option_settings',
75
-                'layout_strategy' => new EE_Admin_Two_Column_Layout(),
76
-                'subsections'     => array(
77
-                    'help_tour_activation_hdr' => new EE_Form_Section_HTML(
78
-                        EEH_HTML::h2(
79
-                            esc_html__('Help Tour Global Activation', 'event_espresso')
80
-                            . ' '
81
-                            . EEH_HTML::span(
82
-                                EEH_Template::get_help_tab_link('help_tour_activation_info'),
83
-                                'help_tour_activation'
84
-                            ),
85
-                            '', 'ee-admin-settings-hdr'
86
-                        )
87
-                    ),
88
-                    'help_tour_activation' => new EE_Yes_No_Input(
89
-                        array(
90
-                            'html_label_text' => esc_html__('Activate Global Help Tours?', 'event_espresso'),
91
-                            'html_help_text'  => esc_html__(
92
-                                'This toggles whether the Event Espresso help tours are active globally or not.',
93
-                                'event_espresso'
94
-                            ),
95
-                            'default'         => isset($this->registry->CFG->admin->help_tour_activation)
96
-                                ? filter_var($this->registry->CFG->admin->help_tour_activation, FILTER_VALIDATE_BOOLEAN)
97
-                                : true,
98
-                            'required'        => false
99
-                        )
100
-                    ),
101
-                    'compatibility_hdr'   => new EE_Form_Section_HTML(
102
-                        EEH_HTML::h2(
103
-                            esc_html__('Compatibility Settings', 'event_espresso'),
104
-                            '', 'ee-admin-settings-hdr'
105
-                        )
106
-                    ),
107
-                    'encode_session_data' => new EE_Yes_No_Input(
108
-                        array(
109
-                            'html_label_text' => esc_html__('Encode Session Data?', 'event_espresso'),
110
-                            'html_help_text'  => sprintf(
111
-                                esc_html__(
112
-                                    'Some servers and database configurations can cause problems when saving the Event Espresso session data. Setting this option to "Yes" adds an extra layer of encoding to session data to prevent serialization errors, but can be incompatible with some server configurations.%1$sIf you receive "500 internal server" type errors during registration, try turning this option on.%1$sIf you get fatal PHP errors regarding missing base64 functions, then turn this option off.',
113
-                                    'event_espresso'
114
-                                ),
115
-                                '<br>'
116
-                            ),
117
-                            'default'         => $this->registry->CFG->admin->encode_session_data(),
118
-                            'required'        => false
119
-                        )
120
-                    ),
121
-                )
122
-            )
123
-        );
124
-        if (
125
-            $this->registry->CAP->current_user_can(
126
-                'manage_options',
127
-                'display_admin_settings_options_promote_and_affiliate'
128
-            )
129
-        ) {
130
-            $form->add_subsections(
131
-                array(
132
-                    'promote_ee_hdr'  => new EE_Form_Section_HTML(
133
-                        EEH_HTML::h2(
134
-                            esc_html__('Promote Event Espresso', 'event_espresso')
135
-                            . ' '
136
-                            . EEH_HTML::span(
137
-                                EEH_Template::get_help_tab_link('affiliate_info'),
138
-                                'affiliate_info'
139
-                            ),
140
-                            '', 'ee-admin-settings-hdr'
141
-                        )
142
-                    ),
143
-                    'show_reg_footer' => new EE_Yes_No_Input(
144
-                        array(
145
-                            'html_label_text' => esc_html__(
146
-                                                     'Link to Event Espresso in your Registration Page?',
147
-                                                     'event_espresso'
148
-                                                 )
149
-                                                 . EEH_Template::get_help_tab_link('email_validation_info'),
150
-                            'html_help_text'  => esc_html__(
151
-                                'adds an unobtrusive link to Event Espresso\'s website in the footer of your registration form. Get an affiliate link (see below) and make money if people click the link and purchase Event Espresso.',
152
-                                'event_espresso'
153
-                            ),
154
-                            'default'         => isset($this->registry->CFG->admin->show_reg_footer)
155
-                                ? filter_var($this->registry->CFG->admin->show_reg_footer, FILTER_VALIDATE_BOOLEAN)
156
-                                : true,
157
-                            'required'        => false
158
-                        )
159
-                    ),
160
-                    'affiliate_id'    => new EE_Text_Input(
161
-                        array(
162
-                            'html_label_text' => sprintf(
163
-                                esc_html__('Event Espresso %sAffiliate%s ID', 'event_espresso'),
164
-                                '<a href="http://eventespresso.com/affiliates/" target="_blank">',
165
-                                '</a>'
166
-                            ),
167
-                            'html_help_text'  => esc_html__(
168
-                                'Earn cash for promoting Event Espresso.',
169
-                                'event_espresso'
170
-                            ),
171
-                            'html_class'      => 'regular-text',
172
-                            'default'         => isset($this->registry->CFG->admin->affiliate_id)
173
-                                ? $this->registry->CFG->admin->get_pretty('affiliate_id')
174
-                                : '',
175
-                            'required'        => false
176
-                        )
177
-                    ),
178
-                ),
179
-                'help_tour_activation_hdr'
180
-            );
181
-        }
182
-        return $form;
183
-    }
184
-
185
-
186
-
187
-    /**
188
-     * takes the generated form and displays it along with ony other non-form HTML that may be required
189
-     * returns a string of HTML that can be directly echoed in a template
190
-     *
191
-     * @return string
192
-     * @throws LogicException
193
-     * @throws \EE_Error
194
-     */
195
-    public function display()
196
-    {
197
-        add_filter(
198
-            'FHEE__EventEspresso_core_libraries_form_sections_form_handlers_FormHandler__display__before_form',
199
-            array($this, 'handleOldAdminOptionsSettingsAction')
200
-        );
201
-        return parent::display();
202
-    }
203
-
204
-
205
-
206
-    /**
207
-     * @return string
208
-     */
209
-    public function handleOldAdminOptionsSettingsAction()
210
-    {
211
-        ob_start();
212
-        do_action('AHEE__admin_option_settings__template__before', $this->template_args);
213
-        return ob_get_clean();
214
-    }
215
-
216
-
217
-
218
-    /**
219
-     * handles processing the form submission
220
-     * returns true or false depending on whether the form was processed successfully or not
221
-     *
222
-     * @param array $form_data
223
-     * @return bool
224
-     * @throws InvalidFormSubmissionException
225
-     * @throws EE_Error
226
-     * @throws LogicException
227
-     * @throws InvalidArgumentException
228
-     * @throws InvalidDataTypeException
229
-     */
230
-    public function process($form_data = array())
231
-    {
232
-        // process form
233
-        $valid_data = (array)parent::process($form_data);
234
-        if (empty($valid_data)) {
235
-            return false;
236
-        }
237
-        $this->registry->CFG->admin->show_reg_footer = isset( $form_data['show_reg_footer'] )
238
-            ? absint( $form_data['show_reg_footer'] )
239
-            : $this->registry->CFG->admin->show_reg_footer;
240
-        $this->registry->CFG->admin->affiliate_id = isset( $form_data['affiliate_id'] )
241
-            ? sanitize_text_field( $form_data['affiliate_id'] )
242
-            : $this->registry->CFG->admin->affiliate_id;
243
-        $this->registry->CFG->admin->help_tour_activation = isset( $form_data['help_tour_activation'] )
244
-            ? absint( $form_data['help_tour_activation'])
245
-            : $this->registry->CFG->admin->help_tour_activation;
246
-        if (isset($form_data['encode_session_data'])) {
247
-            $this->registry->CFG->admin->set_encode_session_data($form_data['encode_session_data']);
248
-        }
249
-        return false;
250
-    }
33
+	protected $template_args = array();
34
+
35
+	/**
36
+	 * Form constructor.
37
+	 *
38
+	 * @param \EE_Registry $registry
39
+	 */
40
+	public function __construct(\EE_Registry $registry) {
41
+		parent::__construct(
42
+			esc_html__('Admin Options', 'event_espresso'),
43
+			esc_html__('Admin Options', 'event_espresso'),
44
+			'admin_option_settings',
45
+			'',
46
+			FormHandler::DO_NOT_SETUP_FORM,
47
+			$registry
48
+		);
49
+	}
50
+
51
+
52
+
53
+	/**
54
+	 * @param array $template_args
55
+	 */
56
+	public function setTemplateArgs(array $template_args)
57
+	{
58
+		$this->template_args = $template_args;
59
+	}
60
+
61
+
62
+
63
+	/**
64
+	 * creates and returns the actual form
65
+	 *
66
+	 * @return EE_Form_Section_Proper
67
+	 * @throws \EE_Error
68
+	 */
69
+	public function generate()
70
+	{
71
+		$form = new \EE_Form_Section_Proper(
72
+			array(
73
+				'name'            => 'admin_option_settings',
74
+				'html_id'         => 'admin_option_settings',
75
+				'layout_strategy' => new EE_Admin_Two_Column_Layout(),
76
+				'subsections'     => array(
77
+					'help_tour_activation_hdr' => new EE_Form_Section_HTML(
78
+						EEH_HTML::h2(
79
+							esc_html__('Help Tour Global Activation', 'event_espresso')
80
+							. ' '
81
+							. EEH_HTML::span(
82
+								EEH_Template::get_help_tab_link('help_tour_activation_info'),
83
+								'help_tour_activation'
84
+							),
85
+							'', 'ee-admin-settings-hdr'
86
+						)
87
+					),
88
+					'help_tour_activation' => new EE_Yes_No_Input(
89
+						array(
90
+							'html_label_text' => esc_html__('Activate Global Help Tours?', 'event_espresso'),
91
+							'html_help_text'  => esc_html__(
92
+								'This toggles whether the Event Espresso help tours are active globally or not.',
93
+								'event_espresso'
94
+							),
95
+							'default'         => isset($this->registry->CFG->admin->help_tour_activation)
96
+								? filter_var($this->registry->CFG->admin->help_tour_activation, FILTER_VALIDATE_BOOLEAN)
97
+								: true,
98
+							'required'        => false
99
+						)
100
+					),
101
+					'compatibility_hdr'   => new EE_Form_Section_HTML(
102
+						EEH_HTML::h2(
103
+							esc_html__('Compatibility Settings', 'event_espresso'),
104
+							'', 'ee-admin-settings-hdr'
105
+						)
106
+					),
107
+					'encode_session_data' => new EE_Yes_No_Input(
108
+						array(
109
+							'html_label_text' => esc_html__('Encode Session Data?', 'event_espresso'),
110
+							'html_help_text'  => sprintf(
111
+								esc_html__(
112
+									'Some servers and database configurations can cause problems when saving the Event Espresso session data. Setting this option to "Yes" adds an extra layer of encoding to session data to prevent serialization errors, but can be incompatible with some server configurations.%1$sIf you receive "500 internal server" type errors during registration, try turning this option on.%1$sIf you get fatal PHP errors regarding missing base64 functions, then turn this option off.',
113
+									'event_espresso'
114
+								),
115
+								'<br>'
116
+							),
117
+							'default'         => $this->registry->CFG->admin->encode_session_data(),
118
+							'required'        => false
119
+						)
120
+					),
121
+				)
122
+			)
123
+		);
124
+		if (
125
+			$this->registry->CAP->current_user_can(
126
+				'manage_options',
127
+				'display_admin_settings_options_promote_and_affiliate'
128
+			)
129
+		) {
130
+			$form->add_subsections(
131
+				array(
132
+					'promote_ee_hdr'  => new EE_Form_Section_HTML(
133
+						EEH_HTML::h2(
134
+							esc_html__('Promote Event Espresso', 'event_espresso')
135
+							. ' '
136
+							. EEH_HTML::span(
137
+								EEH_Template::get_help_tab_link('affiliate_info'),
138
+								'affiliate_info'
139
+							),
140
+							'', 'ee-admin-settings-hdr'
141
+						)
142
+					),
143
+					'show_reg_footer' => new EE_Yes_No_Input(
144
+						array(
145
+							'html_label_text' => esc_html__(
146
+													 'Link to Event Espresso in your Registration Page?',
147
+													 'event_espresso'
148
+												 )
149
+												 . EEH_Template::get_help_tab_link('email_validation_info'),
150
+							'html_help_text'  => esc_html__(
151
+								'adds an unobtrusive link to Event Espresso\'s website in the footer of your registration form. Get an affiliate link (see below) and make money if people click the link and purchase Event Espresso.',
152
+								'event_espresso'
153
+							),
154
+							'default'         => isset($this->registry->CFG->admin->show_reg_footer)
155
+								? filter_var($this->registry->CFG->admin->show_reg_footer, FILTER_VALIDATE_BOOLEAN)
156
+								: true,
157
+							'required'        => false
158
+						)
159
+					),
160
+					'affiliate_id'    => new EE_Text_Input(
161
+						array(
162
+							'html_label_text' => sprintf(
163
+								esc_html__('Event Espresso %sAffiliate%s ID', 'event_espresso'),
164
+								'<a href="http://eventespresso.com/affiliates/" target="_blank">',
165
+								'</a>'
166
+							),
167
+							'html_help_text'  => esc_html__(
168
+								'Earn cash for promoting Event Espresso.',
169
+								'event_espresso'
170
+							),
171
+							'html_class'      => 'regular-text',
172
+							'default'         => isset($this->registry->CFG->admin->affiliate_id)
173
+								? $this->registry->CFG->admin->get_pretty('affiliate_id')
174
+								: '',
175
+							'required'        => false
176
+						)
177
+					),
178
+				),
179
+				'help_tour_activation_hdr'
180
+			);
181
+		}
182
+		return $form;
183
+	}
184
+
185
+
186
+
187
+	/**
188
+	 * takes the generated form and displays it along with ony other non-form HTML that may be required
189
+	 * returns a string of HTML that can be directly echoed in a template
190
+	 *
191
+	 * @return string
192
+	 * @throws LogicException
193
+	 * @throws \EE_Error
194
+	 */
195
+	public function display()
196
+	{
197
+		add_filter(
198
+			'FHEE__EventEspresso_core_libraries_form_sections_form_handlers_FormHandler__display__before_form',
199
+			array($this, 'handleOldAdminOptionsSettingsAction')
200
+		);
201
+		return parent::display();
202
+	}
203
+
204
+
205
+
206
+	/**
207
+	 * @return string
208
+	 */
209
+	public function handleOldAdminOptionsSettingsAction()
210
+	{
211
+		ob_start();
212
+		do_action('AHEE__admin_option_settings__template__before', $this->template_args);
213
+		return ob_get_clean();
214
+	}
215
+
216
+
217
+
218
+	/**
219
+	 * handles processing the form submission
220
+	 * returns true or false depending on whether the form was processed successfully or not
221
+	 *
222
+	 * @param array $form_data
223
+	 * @return bool
224
+	 * @throws InvalidFormSubmissionException
225
+	 * @throws EE_Error
226
+	 * @throws LogicException
227
+	 * @throws InvalidArgumentException
228
+	 * @throws InvalidDataTypeException
229
+	 */
230
+	public function process($form_data = array())
231
+	{
232
+		// process form
233
+		$valid_data = (array)parent::process($form_data);
234
+		if (empty($valid_data)) {
235
+			return false;
236
+		}
237
+		$this->registry->CFG->admin->show_reg_footer = isset( $form_data['show_reg_footer'] )
238
+			? absint( $form_data['show_reg_footer'] )
239
+			: $this->registry->CFG->admin->show_reg_footer;
240
+		$this->registry->CFG->admin->affiliate_id = isset( $form_data['affiliate_id'] )
241
+			? sanitize_text_field( $form_data['affiliate_id'] )
242
+			: $this->registry->CFG->admin->affiliate_id;
243
+		$this->registry->CFG->admin->help_tour_activation = isset( $form_data['help_tour_activation'] )
244
+			? absint( $form_data['help_tour_activation'])
245
+			: $this->registry->CFG->admin->help_tour_activation;
246
+		if (isset($form_data['encode_session_data'])) {
247
+			$this->registry->CFG->admin->set_encode_session_data($form_data['encode_session_data']);
248
+		}
249
+		return false;
250
+	}
251 251
 
252 252
 }
253 253
 // End of file AdminOptionsSettings.php
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -230,18 +230,18 @@
 block discarded – undo
230 230
     public function process($form_data = array())
231 231
     {
232 232
         // process form
233
-        $valid_data = (array)parent::process($form_data);
233
+        $valid_data = (array) parent::process($form_data);
234 234
         if (empty($valid_data)) {
235 235
             return false;
236 236
         }
237
-        $this->registry->CFG->admin->show_reg_footer = isset( $form_data['show_reg_footer'] )
238
-            ? absint( $form_data['show_reg_footer'] )
237
+        $this->registry->CFG->admin->show_reg_footer = isset($form_data['show_reg_footer'])
238
+            ? absint($form_data['show_reg_footer'])
239 239
             : $this->registry->CFG->admin->show_reg_footer;
240
-        $this->registry->CFG->admin->affiliate_id = isset( $form_data['affiliate_id'] )
241
-            ? sanitize_text_field( $form_data['affiliate_id'] )
240
+        $this->registry->CFG->admin->affiliate_id = isset($form_data['affiliate_id'])
241
+            ? sanitize_text_field($form_data['affiliate_id'])
242 242
             : $this->registry->CFG->admin->affiliate_id;
243
-        $this->registry->CFG->admin->help_tour_activation = isset( $form_data['help_tour_activation'] )
244
-            ? absint( $form_data['help_tour_activation'])
243
+        $this->registry->CFG->admin->help_tour_activation = isset($form_data['help_tour_activation'])
244
+            ? absint($form_data['help_tour_activation'])
245 245
             : $this->registry->CFG->admin->help_tour_activation;
246 246
         if (isset($form_data['encode_session_data'])) {
247 247
             $this->registry->CFG->admin->set_encode_session_data($form_data['encode_session_data']);
Please login to merge, or discard this patch.
admin_pages/general_settings/General_Settings_Admin_Page.core.php 2 patches
Indentation   +65 added lines, -65 removed lines patch added patch discarded remove patch
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
 					'order' => 50
157 157
 					),
158 158
 				'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array( '_publish_post_box' ) ),
159
-               			'help_tabs' => array(
159
+			   			'help_tabs' => array(
160 160
 					'general_settings_critical_pages_help_tab' => array(
161 161
 						'title' => __('Critical Pages', 'event_espresso'),
162 162
 						'filename' => 'general_settings_critical_pages'
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
 					'label' => __('Your Organization', 'event_espresso'),
171 171
 					'order' => 20
172 172
 				),
173
-                			'help_tabs' => array(
173
+							'help_tabs' => array(
174 174
 					'general_settings_your_organization_help_tab' => array(
175 175
 						'title' => __('Your Organization', 'event_espresso'),
176 176
 						'filename' => 'general_settings_your_organization'
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
 					'order' => 60
187 187
 					),
188 188
 				'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array( '_publish_post_box' ) ),
189
-                			'help_tabs' => array(
189
+							'help_tabs' => array(
190 190
 					'general_settings_admin_options_help_tab' => array(
191 191
 						'title' => __('Admin Options', 'event_espresso'),
192 192
 						'filename' => 'general_settings_admin_options'
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
 					'label' => __('Countries', 'event_espresso'),
201 201
 					'order' => 70
202 202
 					),
203
-                'help_tabs' => array(
203
+				'help_tabs' => array(
204 204
 					'general_settings_countries_help_tab' => array(
205 205
 						'title' => __('Countries', 'event_espresso'),
206 206
 						'filename' => 'general_settings_countries'
@@ -453,68 +453,68 @@  discard block
 block discarded – undo
453 453
 
454 454
 
455 455
 
456
-    /*************        Admin Options        *************/
457
-
458
-
459
-
460
-    /**
461
-     * _admin_option_settings
462
-     *
463
-     * @throws \EE_Error
464
-     * @throws \LogicException
465
-     */
466
-    protected function _admin_option_settings() {
467
-        $this->_template_args['admin_page_content'] = '';
468
-        try {
469
-            $admin_options_settings_form = new AdminOptionsSettings(EE_Registry::instance());
470
-            // still need this for the old school form in Extend_General_Settings_Admin_Page
471
-            $this->_template_args['values'] = $this->_yes_no_values;
472
-            // also need to account for the do_action that was in the old template
473
-            $admin_options_settings_form->setTemplateArgs($this->_template_args);
474
-            $this->_template_args['admin_page_content'] = $admin_options_settings_form->display();
475
-        } catch (Exception $e) {
476
-            EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__);
477
-        }
478
-        $this->_set_add_edit_form_tags('update_admin_option_settings');
479
-        $this->_set_publish_post_box_vars(null, false, false, null, false);
480
-        $this->display_admin_page_with_sidebar();
481
-    }
482
-
483
-
484
-
485
-    /**
486
-     * _update_admin_option_settings
487
-     *
488
-     * @throws \EE_Error
489
-     * @throws \EventEspresso\core\exceptions\InvalidDataTypeException
490
-     * @throws \EventEspresso\core\exceptions\InvalidFormSubmissionException
491
-     * @throws \InvalidArgumentException
492
-     * @throws \LogicException
493
-     */
494
-    protected function _update_admin_option_settings() {
495
-        try {
496
-            $admin_options_settings_form = new AdminOptionsSettings(EE_Registry::instance());
497
-            $admin_options_settings_form->process($this->_req_data[$admin_options_settings_form->slug()]);
498
-            EE_Registry::instance()->CFG->admin = apply_filters(
499
-                'FHEE__General_Settings_Admin_Page___update_admin_option_settings__CFG_admin',
500
-                EE_Registry::instance()->CFG->admin
501
-            );
502
-        } catch (Exception $e) {
503
-            EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__);
504
-        }
456
+	/*************        Admin Options        *************/
457
+
458
+
459
+
460
+	/**
461
+	 * _admin_option_settings
462
+	 *
463
+	 * @throws \EE_Error
464
+	 * @throws \LogicException
465
+	 */
466
+	protected function _admin_option_settings() {
467
+		$this->_template_args['admin_page_content'] = '';
468
+		try {
469
+			$admin_options_settings_form = new AdminOptionsSettings(EE_Registry::instance());
470
+			// still need this for the old school form in Extend_General_Settings_Admin_Page
471
+			$this->_template_args['values'] = $this->_yes_no_values;
472
+			// also need to account for the do_action that was in the old template
473
+			$admin_options_settings_form->setTemplateArgs($this->_template_args);
474
+			$this->_template_args['admin_page_content'] = $admin_options_settings_form->display();
475
+		} catch (Exception $e) {
476
+			EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__);
477
+		}
478
+		$this->_set_add_edit_form_tags('update_admin_option_settings');
479
+		$this->_set_publish_post_box_vars(null, false, false, null, false);
480
+		$this->display_admin_page_with_sidebar();
481
+	}
482
+
483
+
484
+
485
+	/**
486
+	 * _update_admin_option_settings
487
+	 *
488
+	 * @throws \EE_Error
489
+	 * @throws \EventEspresso\core\exceptions\InvalidDataTypeException
490
+	 * @throws \EventEspresso\core\exceptions\InvalidFormSubmissionException
491
+	 * @throws \InvalidArgumentException
492
+	 * @throws \LogicException
493
+	 */
494
+	protected function _update_admin_option_settings() {
495
+		try {
496
+			$admin_options_settings_form = new AdminOptionsSettings(EE_Registry::instance());
497
+			$admin_options_settings_form->process($this->_req_data[$admin_options_settings_form->slug()]);
498
+			EE_Registry::instance()->CFG->admin = apply_filters(
499
+				'FHEE__General_Settings_Admin_Page___update_admin_option_settings__CFG_admin',
500
+				EE_Registry::instance()->CFG->admin
501
+			);
502
+		} catch (Exception $e) {
503
+			EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__);
504
+		}
505 505
 		$this->_redirect_after_action(
506
-            apply_filters(
507
-                'FHEE__General_Settings_Admin_Page___update_admin_option_settings__success',
508
-                $this->_update_espresso_configuration(
509
-                    'Admin Options',
510
-                    EE_Registry::instance()->CFG->admin,
511
-                    __FILE__, __FUNCTION__, __LINE__
512
-                )
513
-            ),
514
-            'Admin Options',
515
-            'updated',
516
-            array( 'action' => 'admin_option_settings' )
517
-        );
506
+			apply_filters(
507
+				'FHEE__General_Settings_Admin_Page___update_admin_option_settings__success',
508
+				$this->_update_espresso_configuration(
509
+					'Admin Options',
510
+					EE_Registry::instance()->CFG->admin,
511
+					__FILE__, __FUNCTION__, __LINE__
512
+				)
513
+			),
514
+			'Admin Options',
515
+			'updated',
516
+			array( 'action' => 'admin_option_settings' )
517
+		);
518 518
 
519 519
 	}
520 520
 
Please login to merge, or discard this patch.
Spacing   +259 added lines, -260 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 use EventEspresso\admin_pages\general_settings\AdminOptionsSettings;
3 3
 
4
-if (!defined('EVENT_ESPRESSO_VERSION') )
4
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
5 5
 	exit('NO direct script access allowed');
6 6
 
7 7
 /**
@@ -42,8 +42,8 @@  discard block
 block discarded – undo
42 42
 
43 43
 
44 44
 
45
-	public function __construct( $routing = TRUE ) {
46
-		parent::__construct( $routing );
45
+	public function __construct($routing = TRUE) {
46
+		parent::__construct($routing);
47 47
 	}
48 48
 
49 49
 
@@ -59,10 +59,10 @@  discard block
 block discarded – undo
59 59
 
60 60
 
61 61
 	protected function _ajax_hooks() {
62
-		add_action('wp_ajax_espresso_display_country_settings', array( $this, 'display_country_settings'));
63
-		add_action('wp_ajax_espresso_display_country_states', array( $this, 'display_country_states'));
64
-		add_action('wp_ajax_espresso_delete_state', array( $this, 'delete_state'), 10, 3 );
65
-		add_action('wp_ajax_espresso_add_new_state', array( $this, 'add_new_state'));
62
+		add_action('wp_ajax_espresso_display_country_settings', array($this, 'display_country_settings'));
63
+		add_action('wp_ajax_espresso_display_country_states', array($this, 'display_country_states'));
64
+		add_action('wp_ajax_espresso_delete_state', array($this, 'delete_state'), 10, 3);
65
+		add_action('wp_ajax_espresso_add_new_state', array($this, 'add_new_state'));
66 66
 	}
67 67
 
68 68
 
@@ -155,14 +155,14 @@  discard block
 block discarded – undo
155 155
 					'label' => __('Critical Pages', 'event_espresso'),
156 156
 					'order' => 50
157 157
 					),
158
-				'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array( '_publish_post_box' ) ),
158
+				'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')),
159 159
                			'help_tabs' => array(
160 160
 					'general_settings_critical_pages_help_tab' => array(
161 161
 						'title' => __('Critical Pages', 'event_espresso'),
162 162
 						'filename' => 'general_settings_critical_pages'
163 163
 						)
164 164
 					),
165
-				'help_tour' => array( 'Critical_Pages_Help_Tour' ),
165
+				'help_tour' => array('Critical_Pages_Help_Tour'),
166 166
 				'require_nonce' => FALSE
167 167
 				),
168 168
 			'default' => array(
@@ -176,8 +176,8 @@  discard block
 block discarded – undo
176 176
 						'filename' => 'general_settings_your_organization'
177 177
 						)
178 178
 					),
179
-				'help_tour' => array( 'Your_Organization_Help_Tour' ),
180
-				'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array( '_publish_post_box' ) ),
179
+				'help_tour' => array('Your_Organization_Help_Tour'),
180
+				'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')),
181 181
 				'require_nonce' => FALSE
182 182
 				),
183 183
 			'admin_option_settings' => array(
@@ -185,14 +185,14 @@  discard block
 block discarded – undo
185 185
 					'label' => __('Admin Options', 'event_espresso'),
186 186
 					'order' => 60
187 187
 					),
188
-				'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array( '_publish_post_box' ) ),
188
+				'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')),
189 189
                 			'help_tabs' => array(
190 190
 					'general_settings_admin_options_help_tab' => array(
191 191
 						'title' => __('Admin Options', 'event_espresso'),
192 192
 						'filename' => 'general_settings_admin_options'
193 193
 						)
194 194
 					),
195
-				'help_tour' => array( 'Admin_Options_Help_Tour' ),
195
+				'help_tour' => array('Admin_Options_Help_Tour'),
196 196
 				'require_nonce' => FALSE
197 197
 				),
198 198
 			'country_settings' => array(
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
 						'filename' => 'general_settings_countries'
207 207
 						)
208 208
 					),
209
-				'help_tour' => array( 'Countries_Help_Tour' ),
209
+				'help_tour' => array('Countries_Help_Tour'),
210 210
 				'require_nonce' => FALSE
211 211
 				)
212 212
 			);
@@ -224,11 +224,11 @@  discard block
 block discarded – undo
224 224
 	}
225 225
 
226 226
 	public function admin_init() {
227
-		EE_Registry::$i18n_js_strings[ 'invalid_server_response' ] = __( 'An error occurred! Your request may have been processed, but a valid response from the server was not received. Please refresh the page and try again.', 'event_espresso' );
228
-		EE_Registry::$i18n_js_strings[ 'error_occurred' ] = __( 'An error occurred! Please refresh the page and try again.', 'event_espresso' );
229
-		EE_Registry::$i18n_js_strings[ 'confirm_delete_state' ] = __( 'Are you sure you want to delete this State / Province?', 'event_espresso' );
230
-		$protocol = isset( $_SERVER[ 'HTTPS' ] ) ? 'https://' : 'http://';
231
-		EE_Registry::$i18n_js_strings[ 'ajax_url' ] = admin_url( 'admin-ajax.php?page=espresso_general_settings', $protocol );
227
+		EE_Registry::$i18n_js_strings['invalid_server_response'] = __('An error occurred! Your request may have been processed, but a valid response from the server was not received. Please refresh the page and try again.', 'event_espresso');
228
+		EE_Registry::$i18n_js_strings['error_occurred'] = __('An error occurred! Please refresh the page and try again.', 'event_espresso');
229
+		EE_Registry::$i18n_js_strings['confirm_delete_state'] = __('Are you sure you want to delete this State / Province?', 'event_espresso');
230
+		$protocol = isset($_SERVER['HTTPS']) ? 'https://' : 'http://';
231
+		EE_Registry::$i18n_js_strings['ajax_url'] = admin_url('admin-ajax.php?page=espresso_general_settings', $protocol);
232 232
 	}
233 233
 
234 234
 	public function admin_notices() {}
@@ -241,21 +241,21 @@  discard block
 block discarded – undo
241 241
 		//scripts
242 242
 		wp_enqueue_script('media-upload');
243 243
 		wp_enqueue_script('thickbox');
244
-		wp_register_script( 'organization_settings', GEN_SET_ASSETS_URL . 'your_organization_settings.js', array( 'jquery','media-upload','thickbox' ), EVENT_ESPRESSO_VERSION, TRUE );
245
-		wp_register_style( 'organization-css', GEN_SET_ASSETS_URL . 'organization.css', array(), EVENT_ESPRESSO_VERSION );
246
-		wp_enqueue_script( 'organization_settings' );
247
-		wp_enqueue_style( 'organization-css' );
248
-		$confirm_image_delete = array( 'text' => __('Do you really want to delete this image? Please remember to save your settings to complete the removal.', 'event_espresso'));
249
-		wp_localize_script( 'organization_settings', 'confirm_image_delete', $confirm_image_delete );
244
+		wp_register_script('organization_settings', GEN_SET_ASSETS_URL.'your_organization_settings.js', array('jquery', 'media-upload', 'thickbox'), EVENT_ESPRESSO_VERSION, TRUE);
245
+		wp_register_style('organization-css', GEN_SET_ASSETS_URL.'organization.css', array(), EVENT_ESPRESSO_VERSION);
246
+		wp_enqueue_script('organization_settings');
247
+		wp_enqueue_style('organization-css');
248
+		$confirm_image_delete = array('text' => __('Do you really want to delete this image? Please remember to save your settings to complete the removal.', 'event_espresso'));
249
+		wp_localize_script('organization_settings', 'confirm_image_delete', $confirm_image_delete);
250 250
 
251 251
 	}
252 252
 
253 253
 	public function load_scripts_styles_country_settings() {
254 254
 		//scripts
255
-		wp_register_script( 'gen_settings_countries', GEN_SET_ASSETS_URL . 'gen_settings_countries.js', array( 'ee_admin_js' ), EVENT_ESPRESSO_VERSION, TRUE );
256
-		wp_register_style( 'organization-css', GEN_SET_ASSETS_URL . 'organization.css', array(), EVENT_ESPRESSO_VERSION );
257
-		wp_enqueue_script( 'gen_settings_countries' );
258
-		wp_enqueue_style( 'organization-css' );
255
+		wp_register_script('gen_settings_countries', GEN_SET_ASSETS_URL.'gen_settings_countries.js', array('ee_admin_js'), EVENT_ESPRESSO_VERSION, TRUE);
256
+		wp_register_style('organization-css', GEN_SET_ASSETS_URL.'organization.css', array(), EVENT_ESPRESSO_VERSION);
257
+		wp_enqueue_script('gen_settings_countries');
258
+		wp_enqueue_style('organization-css');
259 259
 
260 260
 	}
261 261
 
@@ -272,31 +272,31 @@  discard block
 block discarded – undo
272 272
 		$this->_transient_garbage_collection();
273 273
 		$this->_template_args['values'] = $this->_yes_no_values;
274 274
 
275
-		$this->_template_args['reg_page_id'] = isset(EE_Registry::instance()->CFG->core->reg_page_id ) ?EE_Registry::instance()->CFG->core->reg_page_id : NULL;
276
-		$this->_template_args['reg_page_obj'] = isset(EE_Registry::instance()->CFG->core->reg_page_id ) ? get_page(EE_Registry::instance()->CFG->core->reg_page_id ) : FALSE;
275
+		$this->_template_args['reg_page_id'] = isset(EE_Registry::instance()->CFG->core->reg_page_id) ? EE_Registry::instance()->CFG->core->reg_page_id : NULL;
276
+		$this->_template_args['reg_page_obj'] = isset(EE_Registry::instance()->CFG->core->reg_page_id) ? get_page(EE_Registry::instance()->CFG->core->reg_page_id) : FALSE;
277 277
 
278
-		$this->_template_args['txn_page_id'] = isset(EE_Registry::instance()->CFG->core->txn_page_id) ?EE_Registry::instance()->CFG->core->txn_page_id : NULL;
279
-		$this->_template_args['txn_page_obj'] = isset(EE_Registry::instance()->CFG->core->txn_page_id ) ? get_page(EE_Registry::instance()->CFG->core->txn_page_id ) : FALSE;
278
+		$this->_template_args['txn_page_id'] = isset(EE_Registry::instance()->CFG->core->txn_page_id) ? EE_Registry::instance()->CFG->core->txn_page_id : NULL;
279
+		$this->_template_args['txn_page_obj'] = isset(EE_Registry::instance()->CFG->core->txn_page_id) ? get_page(EE_Registry::instance()->CFG->core->txn_page_id) : FALSE;
280 280
 
281
-		$this->_template_args['thank_you_page_id'] = isset(EE_Registry::instance()->CFG->core->thank_you_page_id ) ?EE_Registry::instance()->CFG->core->thank_you_page_id : NULL;
282
-		$this->_template_args['thank_you_page_obj'] = isset(EE_Registry::instance()->CFG->core->thank_you_page_id ) ? get_page(EE_Registry::instance()->CFG->core->thank_you_page_id ) : FALSE;
281
+		$this->_template_args['thank_you_page_id'] = isset(EE_Registry::instance()->CFG->core->thank_you_page_id) ? EE_Registry::instance()->CFG->core->thank_you_page_id : NULL;
282
+		$this->_template_args['thank_you_page_obj'] = isset(EE_Registry::instance()->CFG->core->thank_you_page_id) ? get_page(EE_Registry::instance()->CFG->core->thank_you_page_id) : FALSE;
283 283
 
284
-		$this->_template_args['cancel_page_id'] = isset(EE_Registry::instance()->CFG->core->cancel_page_id ) ?EE_Registry::instance()->CFG->core->cancel_page_id : NULL;
285
-		$this->_template_args['cancel_page_obj'] = isset(EE_Registry::instance()->CFG->core->cancel_page_id ) ? get_page(EE_Registry::instance()->CFG->core->cancel_page_id ) : FALSE;
284
+		$this->_template_args['cancel_page_id'] = isset(EE_Registry::instance()->CFG->core->cancel_page_id) ? EE_Registry::instance()->CFG->core->cancel_page_id : NULL;
285
+		$this->_template_args['cancel_page_obj'] = isset(EE_Registry::instance()->CFG->core->cancel_page_id) ? get_page(EE_Registry::instance()->CFG->core->cancel_page_id) : FALSE;
286 286
 
287
-		$this->_set_add_edit_form_tags( 'update_espresso_page_settings' );
288
-		$this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE );
289
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( GEN_SET_TEMPLATE_PATH . 'espresso_page_settings.template.php', $this->_template_args, TRUE );
287
+		$this->_set_add_edit_form_tags('update_espresso_page_settings');
288
+		$this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE);
289
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template(GEN_SET_TEMPLATE_PATH.'espresso_page_settings.template.php', $this->_template_args, TRUE);
290 290
 		$this->display_admin_page_with_sidebar();
291 291
 
292 292
 	}
293 293
 
294 294
 	protected function _update_espresso_page_settings() {
295 295
 		// capture incoming request data
296
-		$reg_page_id = isset( $this->_req_data['reg_page_id'] ) ? absint( $this->_req_data['reg_page_id'] ) : EE_Registry::instance()->CFG->core->reg_page_id;
297
-		$txn_page_id = isset( $this->_req_data['txn_page_id'] ) ? absint( $this->_req_data['txn_page_id'] ) : EE_Registry::instance()->CFG->core->txn_page_id;
298
-		$thank_you_page_id = isset( $this->_req_data['thank_you_page_id'] ) ? absint( $this->_req_data['thank_you_page_id'] ) : EE_Registry::instance()->CFG->core->thank_you_page_id;
299
-		$cancel_page_id = isset( $this->_req_data['cancel_page_id'] ) ? absint( $this->_req_data['cancel_page_id'] ) : EE_Registry::instance()->CFG->core->cancel_page_id;
296
+		$reg_page_id = isset($this->_req_data['reg_page_id']) ? absint($this->_req_data['reg_page_id']) : EE_Registry::instance()->CFG->core->reg_page_id;
297
+		$txn_page_id = isset($this->_req_data['txn_page_id']) ? absint($this->_req_data['txn_page_id']) : EE_Registry::instance()->CFG->core->txn_page_id;
298
+		$thank_you_page_id = isset($this->_req_data['thank_you_page_id']) ? absint($this->_req_data['thank_you_page_id']) : EE_Registry::instance()->CFG->core->thank_you_page_id;
299
+		$cancel_page_id = isset($this->_req_data['cancel_page_id']) ? absint($this->_req_data['cancel_page_id']) : EE_Registry::instance()->CFG->core->cancel_page_id;
300 300
 		// pack critical_pages into an array
301 301
 		$critical_pages = array(
302 302
 			'reg_page_id' 				=> $reg_page_id,
@@ -304,17 +304,17 @@  discard block
 block discarded – undo
304 304
 			'thank_you_page_id' 	=> $thank_you_page_id,
305 305
 			'cancel_page_id' 		=> $cancel_page_id
306 306
 		);
307
-		foreach ( $critical_pages as $critical_page_name => $critical_page_id ) {
307
+		foreach ($critical_pages as $critical_page_name => $critical_page_id) {
308 308
 			// has the page changed ?
309
-			if ( EE_Registry::instance()->CFG->core->{$critical_page_name} !== $critical_page_id ) {
309
+			if (EE_Registry::instance()->CFG->core->{$critical_page_name} !== $critical_page_id) {
310 310
 				// grab post object for old page
311
-				$post = get_post( EE_Registry::instance()->CFG->core->{$critical_page_name} );
311
+				$post = get_post(EE_Registry::instance()->CFG->core->{$critical_page_name} );
312 312
 				// update post shortcodes for old page
313
-				EventEspresso\core\admin\PostShortcodeTracking::parse_post_content_on_save( $critical_page_id, $post );
313
+				EventEspresso\core\admin\PostShortcodeTracking::parse_post_content_on_save($critical_page_id, $post);
314 314
 				// grab post object for new page
315
-				$post = get_post( $critical_page_id );
315
+				$post = get_post($critical_page_id);
316 316
 				// update post shortcodes for new page
317
-				EventEspresso\core\admin\PostShortcodeTracking::parse_post_content_on_save( $critical_page_id, $post );
317
+				EventEspresso\core\admin\PostShortcodeTracking::parse_post_content_on_save($critical_page_id, $post);
318 318
 			}
319 319
 		}
320 320
 		// set page IDs
@@ -323,14 +323,14 @@  discard block
 block discarded – undo
323 323
 		EE_Registry::instance()->CFG->core->thank_you_page_id = $thank_you_page_id;
324 324
 		EE_Registry::instance()->CFG->core->cancel_page_id = $cancel_page_id;
325 325
 
326
-		EE_Registry::instance()->CFG->core = apply_filters( 'FHEE__General_Settings_Admin_Page___update_espresso_page_settings__CFG_core', EE_Registry::instance()->CFG->core, $this->_req_data );
326
+		EE_Registry::instance()->CFG->core = apply_filters('FHEE__General_Settings_Admin_Page___update_espresso_page_settings__CFG_core', EE_Registry::instance()->CFG->core, $this->_req_data);
327 327
 
328 328
 		$what = __('Critical Pages & Shortcodes', 'event_espresso');
329
-		$success = $this->_update_espresso_configuration( $what, EE_Registry::instance()->CFG->core, __FILE__, __FUNCTION__, __LINE__ );
329
+		$success = $this->_update_espresso_configuration($what, EE_Registry::instance()->CFG->core, __FILE__, __FUNCTION__, __LINE__);
330 330
 		$query_args = array(
331 331
 			'action' => 'critical_pages'
332 332
 			);
333
-		$this->_redirect_after_action( FALSE, '', '', $query_args, TRUE );
333
+		$this->_redirect_after_action(FALSE, '', '', $query_args, TRUE);
334 334
 
335 335
 	}
336 336
 
@@ -345,34 +345,34 @@  discard block
 block discarded – undo
345 345
 
346 346
 	protected function _your_organization_settings() {
347 347
 
348
-		$this->_template_args['site_license_key'] = isset( EE_Registry::instance()->NET_CFG->core->site_license_key ) ? EE_Registry::instance()->NET_CFG->core->get_pretty( 'site_license_key' ) : '';
349
-		$this->_template_args['organization_name'] = isset( EE_Registry::instance()->CFG->organization->name ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'name' ) : '';
350
-		$this->_template_args['organization_address_1'] = isset( EE_Registry::instance()->CFG->organization->address_1 ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'address_1' ) : '';
351
-		$this->_template_args['organization_address_2'] = isset( EE_Registry::instance()->CFG->organization->address_2 ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'address_2' ) : '';
352
-		$this->_template_args['organization_city'] = isset( EE_Registry::instance()->CFG->organization->city ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'city' ) : '';
353
-		$this->_template_args['organization_zip'] = isset( EE_Registry::instance()->CFG->organization->zip ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'zip' ) : '';
354
-		$this->_template_args['organization_email'] = isset( EE_Registry::instance()->CFG->organization->email ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) : '';
355
-		$this->_template_args['organization_phone'] = isset( EE_Registry::instance()->CFG->organization->phone ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'phone' ) : '';
356
-		$this->_template_args['organization_vat'] = isset( EE_Registry::instance()->CFG->organization->vat ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'vat' ) : '';
357
-		$this->_template_args['currency_sign'] = isset( EE_Registry::instance()->CFG->currency->sign ) ? EE_Registry::instance()->CFG->currency->get_pretty( 'sign' ) : '$';
358
-		$this->_template_args['organization_logo_url'] = isset( EE_Registry::instance()->CFG->organization->logo_url ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'logo_url' ) : FALSE;
359
-		$this->_template_args['organization_facebook'] = isset( EE_Registry::instance()->CFG->organization->facebook ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'facebook' ) : '';
360
-		$this->_template_args['organization_twitter'] = isset( EE_Registry::instance()->CFG->organization->twitter ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'twitter' ) : '';
361
-		$this->_template_args['organization_linkedin'] = isset( EE_Registry::instance()->CFG->organization->linkedin ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'linkedin' ) : '';
362
-		$this->_template_args['organization_pinterest'] = isset( EE_Registry::instance()->CFG->organization->pinterest ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'pinterest' ) : '';
363
-		$this->_template_args['organization_google'] = isset( EE_Registry::instance()->CFG->organization->google ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'google' ) : '';
364
-		$this->_template_args['organization_instagram'] = isset( EE_Registry::instance()->CFG->organization->instagram ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'instagram' ) : '';
348
+		$this->_template_args['site_license_key'] = isset(EE_Registry::instance()->NET_CFG->core->site_license_key) ? EE_Registry::instance()->NET_CFG->core->get_pretty('site_license_key') : '';
349
+		$this->_template_args['organization_name'] = isset(EE_Registry::instance()->CFG->organization->name) ? EE_Registry::instance()->CFG->organization->get_pretty('name') : '';
350
+		$this->_template_args['organization_address_1'] = isset(EE_Registry::instance()->CFG->organization->address_1) ? EE_Registry::instance()->CFG->organization->get_pretty('address_1') : '';
351
+		$this->_template_args['organization_address_2'] = isset(EE_Registry::instance()->CFG->organization->address_2) ? EE_Registry::instance()->CFG->organization->get_pretty('address_2') : '';
352
+		$this->_template_args['organization_city'] = isset(EE_Registry::instance()->CFG->organization->city) ? EE_Registry::instance()->CFG->organization->get_pretty('city') : '';
353
+		$this->_template_args['organization_zip'] = isset(EE_Registry::instance()->CFG->organization->zip) ? EE_Registry::instance()->CFG->organization->get_pretty('zip') : '';
354
+		$this->_template_args['organization_email'] = isset(EE_Registry::instance()->CFG->organization->email) ? EE_Registry::instance()->CFG->organization->get_pretty('email') : '';
355
+		$this->_template_args['organization_phone'] = isset(EE_Registry::instance()->CFG->organization->phone) ? EE_Registry::instance()->CFG->organization->get_pretty('phone') : '';
356
+		$this->_template_args['organization_vat'] = isset(EE_Registry::instance()->CFG->organization->vat) ? EE_Registry::instance()->CFG->organization->get_pretty('vat') : '';
357
+		$this->_template_args['currency_sign'] = isset(EE_Registry::instance()->CFG->currency->sign) ? EE_Registry::instance()->CFG->currency->get_pretty('sign') : '$';
358
+		$this->_template_args['organization_logo_url'] = isset(EE_Registry::instance()->CFG->organization->logo_url) ? EE_Registry::instance()->CFG->organization->get_pretty('logo_url') : FALSE;
359
+		$this->_template_args['organization_facebook'] = isset(EE_Registry::instance()->CFG->organization->facebook) ? EE_Registry::instance()->CFG->organization->get_pretty('facebook') : '';
360
+		$this->_template_args['organization_twitter'] = isset(EE_Registry::instance()->CFG->organization->twitter) ? EE_Registry::instance()->CFG->organization->get_pretty('twitter') : '';
361
+		$this->_template_args['organization_linkedin'] = isset(EE_Registry::instance()->CFG->organization->linkedin) ? EE_Registry::instance()->CFG->organization->get_pretty('linkedin') : '';
362
+		$this->_template_args['organization_pinterest'] = isset(EE_Registry::instance()->CFG->organization->pinterest) ? EE_Registry::instance()->CFG->organization->get_pretty('pinterest') : '';
363
+		$this->_template_args['organization_google'] = isset(EE_Registry::instance()->CFG->organization->google) ? EE_Registry::instance()->CFG->organization->get_pretty('google') : '';
364
+		$this->_template_args['organization_instagram'] = isset(EE_Registry::instance()->CFG->organization->instagram) ? EE_Registry::instance()->CFG->organization->get_pretty('instagram') : '';
365 365
 		//UXIP settings
366
-		$this->_template_args['ee_ueip_optin'] = isset( EE_Registry::instance()->CFG->core->ee_ueip_optin ) ? EE_Registry::instance()->CFG->core->get_pretty( 'ee_ueip_optin' ) : TRUE;
366
+		$this->_template_args['ee_ueip_optin'] = isset(EE_Registry::instance()->CFG->core->ee_ueip_optin) ? EE_Registry::instance()->CFG->core->get_pretty('ee_ueip_optin') : TRUE;
367 367
 
368
-		$STA_ID = isset( EE_Registry::instance()->CFG->organization->STA_ID ) ? EE_Registry::instance()->CFG->organization->STA_ID : 4;
368
+		$STA_ID = isset(EE_Registry::instance()->CFG->organization->STA_ID) ? EE_Registry::instance()->CFG->organization->STA_ID : 4;
369 369
 		$this->_template_args['states'] = new EE_Question_Form_Input(
370
-				EE_Question::new_instance ( array(
370
+				EE_Question::new_instance(array(
371 371
 					'QST_ID'=> 0,
372 372
 					'QST_display_text'=> __('State/Province', 'event_espresso'),
373 373
 					'QST_system'=>'admin-state'
374 374
 				)),
375
-				EE_Answer::new_instance ( array(
375
+				EE_Answer::new_instance(array(
376 376
 					'ANS_ID' => 0,
377 377
 					'ANS_value' => $STA_ID
378 378
 				)),
@@ -384,14 +384,14 @@  discard block
 block discarded – undo
384 384
 				)
385 385
 			);
386 386
 
387
-		$CNT_ISO = isset( EE_Registry::instance()->CFG->organization->CNT_ISO ) ? EE_Registry::instance()->CFG->organization->CNT_ISO : 'US';
387
+		$CNT_ISO = isset(EE_Registry::instance()->CFG->organization->CNT_ISO) ? EE_Registry::instance()->CFG->organization->CNT_ISO : 'US';
388 388
 		$this->_template_args['countries'] = new EE_Question_Form_Input(
389
-				EE_Question::new_instance ( array(
389
+				EE_Question::new_instance(array(
390 390
 					'QST_ID'=> 0,
391 391
 					'QST_display_text'=> __('Country', 'event_espresso'),
392 392
 					'QST_system'=>'admin-country'
393 393
 				)),
394
-				EE_Answer::new_instance ( array(
394
+				EE_Answer::new_instance(array(
395 395
 					'ANS_ID' => 0,
396 396
 					'ANS_value' => $CNT_ISO
397 397
 				)),
@@ -403,51 +403,51 @@  discard block
 block discarded – undo
403 403
 				)
404 404
 			);
405 405
 
406
-		add_filter( 'FHEE__EEH_Form_Fields__label_html', array( $this, 'country_form_field_label_wrap' ), 10, 2 );
407
-		add_filter( 'FHEE__EEH_Form_Fields__input_html', array( $this, 'country_form_field_input__wrap' ), 10, 2 );
406
+		add_filter('FHEE__EEH_Form_Fields__label_html', array($this, 'country_form_field_label_wrap'), 10, 2);
407
+		add_filter('FHEE__EEH_Form_Fields__input_html', array($this, 'country_form_field_input__wrap'), 10, 2);
408 408
 
409 409
 		//PUE verification stuff
410
-		$ver_option_key = 'puvererr_' . basename( EE_PLUGIN_BASENAME );
411
-		$verify_fail = get_option( $ver_option_key );
412
-		$this->_template_args['site_license_key_verified'] = $verify_fail || !empty( $verify_fail ) || ( empty( $this->_template_args['site_license_key'] ) && empty( $verify_fail ) )? '<span class="dashicons dashicons-admin-network ee-icon-color-ee-red ee-icon-size-20"></span>' : '<span class="dashicons dashicons-admin-network ee-icon-color-ee-green ee-icon-size-20"></span>';
410
+		$ver_option_key = 'puvererr_'.basename(EE_PLUGIN_BASENAME);
411
+		$verify_fail = get_option($ver_option_key);
412
+		$this->_template_args['site_license_key_verified'] = $verify_fail || ! empty($verify_fail) || (empty($this->_template_args['site_license_key']) && empty($verify_fail)) ? '<span class="dashicons dashicons-admin-network ee-icon-color-ee-red ee-icon-size-20"></span>' : '<span class="dashicons dashicons-admin-network ee-icon-color-ee-green ee-icon-size-20"></span>';
413 413
 
414
-		$this->_set_add_edit_form_tags( 'update_your_organization_settings' );
415
-		$this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE );
416
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( GEN_SET_TEMPLATE_PATH . 'your_organization_settings.template.php', $this->_template_args, TRUE );
414
+		$this->_set_add_edit_form_tags('update_your_organization_settings');
415
+		$this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE);
416
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template(GEN_SET_TEMPLATE_PATH.'your_organization_settings.template.php', $this->_template_args, TRUE);
417 417
 
418 418
 		$this->display_admin_page_with_sidebar();
419 419
 	}
420 420
 
421 421
 	protected function _update_your_organization_settings() {
422
-		if ( is_main_site() )
423
-			EE_Registry::instance()->NET_CFG->core->site_license_key = isset( $this->_req_data['site_license_key'] ) ? sanitize_text_field( $this->_req_data['site_license_key'] ) : EE_Registry::instance()->NET_CFG->core->site_license_key;
424
-		EE_Registry::instance()->CFG->organization->name = isset( $this->_req_data['organization_name'] ) ? sanitize_text_field( $this->_req_data['organization_name'] ) : EE_Registry::instance()->CFG->organization->name;
425
-		EE_Registry::instance()->CFG->organization->address_1 = isset( $this->_req_data['organization_address_1'] ) ? sanitize_text_field( $this->_req_data['organization_address_1'] ) : EE_Registry::instance()->CFG->organization->address_1;
426
-		EE_Registry::instance()->CFG->organization->address_2 = isset( $this->_req_data['organization_address_2'] ) ? sanitize_text_field( $this->_req_data['organization_address_2'] ) : EE_Registry::instance()->CFG->organization->address_2;
427
-		EE_Registry::instance()->CFG->organization->city = isset( $this->_req_data['organization_city'] ) ? sanitize_text_field( $this->_req_data['organization_city'] ) : EE_Registry::instance()->CFG->organization->city;
428
-		EE_Registry::instance()->CFG->organization->STA_ID = isset( $this->_req_data['organization_state'] ) ? absint( $this->_req_data['organization_state'] ) : EE_Registry::instance()->CFG->organization->STA_ID;
429
-		EE_Registry::instance()->CFG->organization->CNT_ISO = isset( $this->_req_data['organization_country'] ) ? sanitize_text_field( $this->_req_data['organization_country'] ) : EE_Registry::instance()->CFG->organization->CNT_ISO;
430
-		EE_Registry::instance()->CFG->organization->zip = isset( $this->_req_data['organization_zip'] ) ? sanitize_text_field( $this->_req_data['organization_zip'] ) : EE_Registry::instance()->CFG->organization->zip;
431
-		EE_Registry::instance()->CFG->organization->email = isset( $this->_req_data['organization_email'] ) ? sanitize_email( $this->_req_data['organization_email'] ) : EE_Registry::instance()->CFG->organization->email;
432
-		EE_Registry::instance()->CFG->organization->vat = isset( $this->_req_data['organization_vat'] ) ? sanitize_text_field( $this->_req_data['organization_vat'] ) : EE_Registry::instance()->CFG->organization->vat;
433
-		EE_Registry::instance()->CFG->organization->phone = isset( $this->_req_data['organization_phone'] ) ? sanitize_text_field( $this->_req_data['organization_phone'] ) : EE_Registry::instance()->CFG->organization->phone;
434
-		EE_Registry::instance()->CFG->organization->logo_url = isset( $this->_req_data['organization_logo_url'] ) ? esc_url_raw( $this->_req_data['organization_logo_url'] ) : EE_Registry::instance()->CFG->organization->logo_url;
435
-		EE_Registry::instance()->CFG->organization->facebook = isset( $this->_req_data['organization_facebook'] ) ? esc_url_raw( $this->_req_data['organization_facebook'] ) : EE_Registry::instance()->CFG->organization->facebook;
436
-		EE_Registry::instance()->CFG->organization->twitter = isset( $this->_req_data['organization_twitter'] ) ? esc_url_raw( $this->_req_data['organization_twitter'] ) : EE_Registry::instance()->CFG->organization->twitter;
437
-		EE_Registry::instance()->CFG->organization->linkedin = isset( $this->_req_data['organization_linkedin'] ) ? esc_url_raw( $this->_req_data['organization_linkedin'] ) : EE_Registry::instance()->CFG->organization->linkedin;
438
-		EE_Registry::instance()->CFG->organization->pinterest = isset( $this->_req_data['organization_pinterest'] ) ? esc_url_raw( $this->_req_data['organization_pinterest'] ) : EE_Registry::instance()->CFG->organization->pinterest;
439
-		EE_Registry::instance()->CFG->organization->google = isset( $this->_req_data['organization_google'] ) ? esc_url_raw( $this->_req_data['organization_google'] ) : EE_Registry::instance()->CFG->organization->google;
440
-		EE_Registry::instance()->CFG->organization->instagram = isset( $this->_req_data['organization_instagram'] ) ? esc_url_raw( $this->_req_data['organization_instagram'] ) : EE_Registry::instance()->CFG->organization->instagram;
441
-		EE_Registry::instance()->CFG->core->ee_ueip_optin = isset( $this->_req_data['ueip_optin'] ) && !empty( $this->_req_data['ueip_optin'] ) ? $this->_req_data['ueip_optin'] : EE_Registry::instance()->CFG->core->ee_ueip_optin;
442
-
443
-		EE_Registry::instance()->CFG->currency = new EE_Currency_Config( EE_Registry::instance()->CFG->organization->CNT_ISO );
444
-
445
-		EE_Registry::instance()->CFG = apply_filters( 'FHEE__General_Settings_Admin_Page___update_your_organization_settings__CFG', EE_Registry::instance()->CFG );
422
+		if (is_main_site())
423
+			EE_Registry::instance()->NET_CFG->core->site_license_key = isset($this->_req_data['site_license_key']) ? sanitize_text_field($this->_req_data['site_license_key']) : EE_Registry::instance()->NET_CFG->core->site_license_key;
424
+		EE_Registry::instance()->CFG->organization->name = isset($this->_req_data['organization_name']) ? sanitize_text_field($this->_req_data['organization_name']) : EE_Registry::instance()->CFG->organization->name;
425
+		EE_Registry::instance()->CFG->organization->address_1 = isset($this->_req_data['organization_address_1']) ? sanitize_text_field($this->_req_data['organization_address_1']) : EE_Registry::instance()->CFG->organization->address_1;
426
+		EE_Registry::instance()->CFG->organization->address_2 = isset($this->_req_data['organization_address_2']) ? sanitize_text_field($this->_req_data['organization_address_2']) : EE_Registry::instance()->CFG->organization->address_2;
427
+		EE_Registry::instance()->CFG->organization->city = isset($this->_req_data['organization_city']) ? sanitize_text_field($this->_req_data['organization_city']) : EE_Registry::instance()->CFG->organization->city;
428
+		EE_Registry::instance()->CFG->organization->STA_ID = isset($this->_req_data['organization_state']) ? absint($this->_req_data['organization_state']) : EE_Registry::instance()->CFG->organization->STA_ID;
429
+		EE_Registry::instance()->CFG->organization->CNT_ISO = isset($this->_req_data['organization_country']) ? sanitize_text_field($this->_req_data['organization_country']) : EE_Registry::instance()->CFG->organization->CNT_ISO;
430
+		EE_Registry::instance()->CFG->organization->zip = isset($this->_req_data['organization_zip']) ? sanitize_text_field($this->_req_data['organization_zip']) : EE_Registry::instance()->CFG->organization->zip;
431
+		EE_Registry::instance()->CFG->organization->email = isset($this->_req_data['organization_email']) ? sanitize_email($this->_req_data['organization_email']) : EE_Registry::instance()->CFG->organization->email;
432
+		EE_Registry::instance()->CFG->organization->vat = isset($this->_req_data['organization_vat']) ? sanitize_text_field($this->_req_data['organization_vat']) : EE_Registry::instance()->CFG->organization->vat;
433
+		EE_Registry::instance()->CFG->organization->phone = isset($this->_req_data['organization_phone']) ? sanitize_text_field($this->_req_data['organization_phone']) : EE_Registry::instance()->CFG->organization->phone;
434
+		EE_Registry::instance()->CFG->organization->logo_url = isset($this->_req_data['organization_logo_url']) ? esc_url_raw($this->_req_data['organization_logo_url']) : EE_Registry::instance()->CFG->organization->logo_url;
435
+		EE_Registry::instance()->CFG->organization->facebook = isset($this->_req_data['organization_facebook']) ? esc_url_raw($this->_req_data['organization_facebook']) : EE_Registry::instance()->CFG->organization->facebook;
436
+		EE_Registry::instance()->CFG->organization->twitter = isset($this->_req_data['organization_twitter']) ? esc_url_raw($this->_req_data['organization_twitter']) : EE_Registry::instance()->CFG->organization->twitter;
437
+		EE_Registry::instance()->CFG->organization->linkedin = isset($this->_req_data['organization_linkedin']) ? esc_url_raw($this->_req_data['organization_linkedin']) : EE_Registry::instance()->CFG->organization->linkedin;
438
+		EE_Registry::instance()->CFG->organization->pinterest = isset($this->_req_data['organization_pinterest']) ? esc_url_raw($this->_req_data['organization_pinterest']) : EE_Registry::instance()->CFG->organization->pinterest;
439
+		EE_Registry::instance()->CFG->organization->google = isset($this->_req_data['organization_google']) ? esc_url_raw($this->_req_data['organization_google']) : EE_Registry::instance()->CFG->organization->google;
440
+		EE_Registry::instance()->CFG->organization->instagram = isset($this->_req_data['organization_instagram']) ? esc_url_raw($this->_req_data['organization_instagram']) : EE_Registry::instance()->CFG->organization->instagram;
441
+		EE_Registry::instance()->CFG->core->ee_ueip_optin = isset($this->_req_data['ueip_optin']) && ! empty($this->_req_data['ueip_optin']) ? $this->_req_data['ueip_optin'] : EE_Registry::instance()->CFG->core->ee_ueip_optin;
442
+
443
+		EE_Registry::instance()->CFG->currency = new EE_Currency_Config(EE_Registry::instance()->CFG->organization->CNT_ISO);
444
+
445
+		EE_Registry::instance()->CFG = apply_filters('FHEE__General_Settings_Admin_Page___update_your_organization_settings__CFG', EE_Registry::instance()->CFG);
446 446
 
447 447
 		$what = 'Your Organization Settings';
448
-		$success = $this->_update_espresso_configuration( $what, EE_Registry::instance()->CFG, __FILE__, __FUNCTION__, __LINE__ );
448
+		$success = $this->_update_espresso_configuration($what, EE_Registry::instance()->CFG, __FILE__, __FUNCTION__, __LINE__);
449 449
 
450
-		$this->_redirect_after_action( $success, $what, 'updated', array( 'action' => 'default' ) );
450
+		$this->_redirect_after_action($success, $what, 'updated', array('action' => 'default'));
451 451
 
452 452
 	}
453 453
 
@@ -513,7 +513,7 @@  discard block
 block discarded – undo
513 513
             ),
514 514
             'Admin Options',
515 515
             'updated',
516
-            array( 'action' => 'admin_option_settings' )
516
+            array('action' => 'admin_option_settings')
517 517
         );
518 518
 
519 519
 	}
@@ -527,20 +527,20 @@  discard block
 block discarded – undo
527 527
 
528 528
 	protected function _country_settings() {
529 529
 
530
-		$CNT_ISO = isset( EE_Registry::instance()->CFG->organization->CNT_ISO ) ? EE_Registry::instance()->CFG->organization->CNT_ISO : 'US';
531
-		$CNT_ISO = isset( $this->_req_data['country'] ) ? strtoupper( sanitize_text_field( $this->_req_data['country'] )) : $CNT_ISO;
530
+		$CNT_ISO = isset(EE_Registry::instance()->CFG->organization->CNT_ISO) ? EE_Registry::instance()->CFG->organization->CNT_ISO : 'US';
531
+		$CNT_ISO = isset($this->_req_data['country']) ? strtoupper(sanitize_text_field($this->_req_data['country'])) : $CNT_ISO;
532 532
 
533 533
 		//load field generator helper
534 534
 
535 535
 		$this->_template_args['values'] = $this->_yes_no_values;
536 536
 
537 537
 		$this->_template_args['countries'] = new EE_Question_Form_Input(
538
-				EE_Question::new_instance ( array(
538
+				EE_Question::new_instance(array(
539 539
 					'QST_ID'=> 0,
540 540
 					'QST_display_text'=> __('Select Country', 'event_espresso'),
541 541
 					'QST_system'=>'admin-country'
542 542
 				)),
543
-				EE_Answer::new_instance ( array(
543
+				EE_Answer::new_instance(array(
544 544
 					'ANS_ID' => 0,
545 545
 					'ANS_value' => $CNT_ISO
546 546
 				)),
@@ -553,14 +553,14 @@  discard block
 block discarded – undo
553 553
 			);
554 554
 //		EEH_Debug_Tools::printr( $this->_template_args['countries'], 'countries  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
555 555
 
556
-		add_filter( 'FHEE__EEH_Form_Fields__label_html', array( $this, 'country_form_field_label_wrap' ), 10, 2 );
557
-		add_filter( 'FHEE__EEH_Form_Fields__input_html', array( $this, 'country_form_field_input__wrap' ), 10, 2 );
556
+		add_filter('FHEE__EEH_Form_Fields__label_html', array($this, 'country_form_field_label_wrap'), 10, 2);
557
+		add_filter('FHEE__EEH_Form_Fields__input_html', array($this, 'country_form_field_input__wrap'), 10, 2);
558 558
 		$this->_template_args['country_details_settings'] = $this->display_country_settings();
559 559
 		$this->_template_args['country_states_settings'] = $this->display_country_states();
560 560
 
561
-		$this->_set_add_edit_form_tags( 'update_country_settings' );
562
-		$this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE );
563
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( GEN_SET_TEMPLATE_PATH . 'countries_settings.template.php', $this->_template_args, TRUE );
561
+		$this->_set_add_edit_form_tags('update_country_settings');
562
+		$this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE);
563
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template(GEN_SET_TEMPLATE_PATH.'countries_settings.template.php', $this->_template_args, TRUE);
564 564
 		$this->display_admin_page_with_no_sidebar();
565 565
 	}
566 566
 
@@ -573,43 +573,43 @@  discard block
 block discarded – undo
573 573
 	 * 		@param 	string 		$CNT_ISO
574 574
 	 * 		@return 		mixed		string | array
575 575
 	 */
576
-	public function display_country_settings( $CNT_ISO = '' ) {
576
+	public function display_country_settings($CNT_ISO = '') {
577 577
 
578
-		$CNT_ISO = isset( $this->_req_data['country'] ) ? strtoupper( sanitize_text_field( $this->_req_data['country'] )) : $CNT_ISO;
579
-		if ( ! $CNT_ISO ) {
578
+		$CNT_ISO = isset($this->_req_data['country']) ? strtoupper(sanitize_text_field($this->_req_data['country'])) : $CNT_ISO;
579
+		if ( ! $CNT_ISO) {
580 580
 			return '';
581 581
 		}
582 582
 
583 583
 		// for ajax
584
-		remove_all_filters( 'FHEE__EEH_Form_Fields__label_html' );
585
-		remove_all_filters( 'FHEE__EEH_Form_Fields__input_html' );
586
-		add_filter( 'FHEE__EEH_Form_Fields__label_html', array( $this, 'country_form_field_label_wrap' ), 10, 2 );
587
-		add_filter( 'FHEE__EEH_Form_Fields__input_html', array( $this, 'country_form_field_input__wrap' ), 10, 2 );
588
-		$country = EEM_Country::instance()->get_one_by_ID( $CNT_ISO );
584
+		remove_all_filters('FHEE__EEH_Form_Fields__label_html');
585
+		remove_all_filters('FHEE__EEH_Form_Fields__input_html');
586
+		add_filter('FHEE__EEH_Form_Fields__label_html', array($this, 'country_form_field_label_wrap'), 10, 2);
587
+		add_filter('FHEE__EEH_Form_Fields__input_html', array($this, 'country_form_field_input__wrap'), 10, 2);
588
+		$country = EEM_Country::instance()->get_one_by_ID($CNT_ISO);
589 589
 		//EEH_Debug_Tools::printr( $country, '$country  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
590 590
 		$country_input_types = array(
591
-			'CNT_active' => array( 'type' => 'RADIO_BTN', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => '', 'options' => $this->_yes_no_values, 'use_desc_4_label' => TRUE  ),
592
-			'CNT_ISO' => array( 'type' => 'TEXT', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => 'small-text' ),
593
-			'CNT_ISO3' => array( 'type' => 'TEXT', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => 'small-text' ),
594
-			'RGN_ID' => array( 'type' => 'TEXT', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => 'small-text' ),
595
-			'CNT_name' => array( 'type' => 'TEXT', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => 'regular-text' ),
596
-			'CNT_cur_code' => array( 'type' => 'TEXT', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => 'small-text' ),
597
-			'CNT_cur_single' => array( 'type' => 'TEXT', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => 'medium-text' ),
598
-			'CNT_cur_plural' => array( 'type' => 'TEXT', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => 'medium-text' ),
599
-			'CNT_cur_sign' => array( 'type' => 'TEXT', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => 'small-text', 'htmlentities' => FALSE ),
600
-			'CNT_cur_sign_b4' => array( 'type' => 'RADIO_BTN', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => '', 'options' => $this->_yes_no_values, 'use_desc_4_label' => TRUE ),
601
-			'CNT_cur_dec_plc' => array( 'type' => 'RADIO_BTN', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => '', 'options' => array( array( 'id' => 0, 'text' => '' ), array( 'id' => 1, 'text' => '' ), array( 'id' => 2, 'text' => '' ), array( 'id' => 3, 'text' => '' ))),
602
-			'CNT_cur_dec_mrk' => array( 'type' => 'RADIO_BTN', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => '', 'options' => array( array( 'id' => ',', 'text' => __(', (comma)', 'event_espresso')), array( 'id' => '.', 'text' => __('. (decimal)', 'event_espresso'))), 'use_desc_4_label' => TRUE ),
603
-			'CNT_cur_thsnds' => array( 'type' => 'RADIO_BTN', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => '', 'options' => array( array( 'id' => ',', 'text' => __(', (comma)', 'event_espresso')), array( 'id' => '.', 'text' => __('. (decimal)', 'event_espresso'))), 'use_desc_4_label' => TRUE ),
604
-			'CNT_tel_code' => array( 'type' => 'TEXT', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => 'small-text' ),
605
-			'CNT_is_EU' => array( 'type' => 'RADIO_BTN', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => '', 'options' => $this->_yes_no_values, 'use_desc_4_label' => TRUE  )
591
+			'CNT_active' => array('type' => 'RADIO_BTN', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => '', 'options' => $this->_yes_no_values, 'use_desc_4_label' => TRUE),
592
+			'CNT_ISO' => array('type' => 'TEXT', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => 'small-text'),
593
+			'CNT_ISO3' => array('type' => 'TEXT', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => 'small-text'),
594
+			'RGN_ID' => array('type' => 'TEXT', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => 'small-text'),
595
+			'CNT_name' => array('type' => 'TEXT', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => 'regular-text'),
596
+			'CNT_cur_code' => array('type' => 'TEXT', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => 'small-text'),
597
+			'CNT_cur_single' => array('type' => 'TEXT', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => 'medium-text'),
598
+			'CNT_cur_plural' => array('type' => 'TEXT', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => 'medium-text'),
599
+			'CNT_cur_sign' => array('type' => 'TEXT', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => 'small-text', 'htmlentities' => FALSE),
600
+			'CNT_cur_sign_b4' => array('type' => 'RADIO_BTN', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => '', 'options' => $this->_yes_no_values, 'use_desc_4_label' => TRUE),
601
+			'CNT_cur_dec_plc' => array('type' => 'RADIO_BTN', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => '', 'options' => array(array('id' => 0, 'text' => ''), array('id' => 1, 'text' => ''), array('id' => 2, 'text' => ''), array('id' => 3, 'text' => ''))),
602
+			'CNT_cur_dec_mrk' => array('type' => 'RADIO_BTN', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => '', 'options' => array(array('id' => ',', 'text' => __(', (comma)', 'event_espresso')), array('id' => '.', 'text' => __('. (decimal)', 'event_espresso'))), 'use_desc_4_label' => TRUE),
603
+			'CNT_cur_thsnds' => array('type' => 'RADIO_BTN', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => '', 'options' => array(array('id' => ',', 'text' => __(', (comma)', 'event_espresso')), array('id' => '.', 'text' => __('. (decimal)', 'event_espresso'))), 'use_desc_4_label' => TRUE),
604
+			'CNT_tel_code' => array('type' => 'TEXT', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => 'small-text'),
605
+			'CNT_is_EU' => array('type' => 'RADIO_BTN', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => '', 'options' => $this->_yes_no_values, 'use_desc_4_label' => TRUE)
606 606
 		);
607
-		$this->_template_args['inputs'] = EE_Question_Form_Input::generate_question_form_inputs_for_object( $country, $country_input_types );
608
-		$country_details_settings = EEH_Template::display_template( GEN_SET_TEMPLATE_PATH . 'country_details_settings.template.php', $this->_template_args, TRUE );
607
+		$this->_template_args['inputs'] = EE_Question_Form_Input::generate_question_form_inputs_for_object($country, $country_input_types);
608
+		$country_details_settings = EEH_Template::display_template(GEN_SET_TEMPLATE_PATH.'country_details_settings.template.php', $this->_template_args, TRUE);
609 609
 
610
-		if ( defined( 'DOING_AJAX' )) {
611
-			$notices = EE_Error::get_notices( FALSE, FALSE, FALSE );
612
-			echo json_encode( array( 'return_data' => $country_details_settings, 'success' => $notices['success'], 'errors' => $notices['errors'] ));
610
+		if (defined('DOING_AJAX')) {
611
+			$notices = EE_Error::get_notices(FALSE, FALSE, FALSE);
612
+			echo json_encode(array('return_data' => $country_details_settings, 'success' => $notices['success'], 'errors' => $notices['errors']));
613 613
 			die();
614 614
 		} else {
615 615
 			return $country_details_settings;
@@ -627,49 +627,49 @@  discard block
 block discarded – undo
627 627
 	 * 		@param 	string 		$CNT_ISO
628 628
 	 * 		@return 		string
629 629
 	 */
630
-	public function display_country_states( $CNT_ISO = '' ) {
630
+	public function display_country_states($CNT_ISO = '') {
631 631
 
632
-		$CNT_ISO = isset( $this->_req_data['country'] ) ? sanitize_text_field( $this->_req_data['country'] ) : $CNT_ISO;
632
+		$CNT_ISO = isset($this->_req_data['country']) ? sanitize_text_field($this->_req_data['country']) : $CNT_ISO;
633 633
 
634
-		if ( ! $CNT_ISO ) {
634
+		if ( ! $CNT_ISO) {
635 635
 			return '';
636 636
 		}
637 637
 		// for ajax
638
-		remove_all_filters( 'FHEE__EEH_Form_Fields__label_html' );
639
-		remove_all_filters( 'FHEE__EEH_Form_Fields__input_html' );
640
-		add_filter( 'FHEE__EEH_Form_Fields__label_html', array( $this, 'state_form_field_label_wrap' ), 10, 2 );
641
-		add_filter( 'FHEE__EEH_Form_Fields__input_html', array( $this, 'state_form_field_input__wrap' ), 10, 2 );
642
-		$states = EEM_State::instance()->get_all_states_for_these_countries( array( $CNT_ISO => $CNT_ISO ));
638
+		remove_all_filters('FHEE__EEH_Form_Fields__label_html');
639
+		remove_all_filters('FHEE__EEH_Form_Fields__input_html');
640
+		add_filter('FHEE__EEH_Form_Fields__label_html', array($this, 'state_form_field_label_wrap'), 10, 2);
641
+		add_filter('FHEE__EEH_Form_Fields__input_html', array($this, 'state_form_field_input__wrap'), 10, 2);
642
+		$states = EEM_State::instance()->get_all_states_for_these_countries(array($CNT_ISO => $CNT_ISO));
643 643
 
644 644
 //			echo '<h4>$CNT_ISO : ' . $CNT_ISO . '  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>';
645 645
 //			global $wpdb;
646 646
 //			echo '<h4>' . $wpdb->last_query . '  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>';
647 647
 //			EEH_Debug_Tools::printr( $states, '$states  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
648
-		if ( $states ) {
649
-			foreach ( $states as $STA_ID => $state ) {
650
-				if ( $state instanceof EE_State ) {
648
+		if ($states) {
649
+			foreach ($states as $STA_ID => $state) {
650
+				if ($state instanceof EE_State) {
651 651
 					//STA_abbrev 	STA_name 	STA_active
652 652
 					$state_input_types = array(
653
-						'STA_abbrev' => array( 'type' => 'TEXT', 'input_name' => 'states[' . $STA_ID . ']', 'class' => 'mid-text' ),
654
-						'STA_name'   => array( 'type'       => 'TEXT', 'input_name' => 'states[' . $STA_ID . ']', 'class' => 'regular-text' ),
655
-						'STA_active' => array( 'type' => 'RADIO_BTN', 'input_name' => 'states[' . $STA_ID . ']', 'options' => $this->_yes_no_values, 'use_desc_4_label' => true )
653
+						'STA_abbrev' => array('type' => 'TEXT', 'input_name' => 'states['.$STA_ID.']', 'class' => 'mid-text'),
654
+						'STA_name'   => array('type'       => 'TEXT', 'input_name' => 'states['.$STA_ID.']', 'class' => 'regular-text'),
655
+						'STA_active' => array('type' => 'RADIO_BTN', 'input_name' => 'states['.$STA_ID.']', 'options' => $this->_yes_no_values, 'use_desc_4_label' => true)
656 656
 					);
657
-					$this->_template_args[ 'states' ][ $STA_ID ][ 'inputs' ] = EE_Question_Form_Input::generate_question_form_inputs_for_object( $state, $state_input_types );
658
-					$query_args = array( 'action'     => 'delete_state', 'STA_ID' => $STA_ID, 'CNT_ISO' => $CNT_ISO, 'STA_abbrev' => $state->abbrev() );
659
-					$this->_template_args[ 'states' ][ $STA_ID ][ 'delete_state_url' ] = EE_Admin_Page::add_query_args_and_nonce( $query_args, GEN_SET_ADMIN_URL );
657
+					$this->_template_args['states'][$STA_ID]['inputs'] = EE_Question_Form_Input::generate_question_form_inputs_for_object($state, $state_input_types);
658
+					$query_args = array('action'     => 'delete_state', 'STA_ID' => $STA_ID, 'CNT_ISO' => $CNT_ISO, 'STA_abbrev' => $state->abbrev());
659
+					$this->_template_args['states'][$STA_ID]['delete_state_url'] = EE_Admin_Page::add_query_args_and_nonce($query_args, GEN_SET_ADMIN_URL);
660 660
 				}
661 661
 			}
662 662
 		} else {
663 663
 			$this->_template_args['states'] = FALSE;
664 664
 		}
665 665
 //		EEH_Debug_Tools::printr( $this->_template_args['states'], 'states  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
666
-		$this->_template_args['add_new_state_url'] = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'add_new_state' ),  GEN_SET_ADMIN_URL );
666
+		$this->_template_args['add_new_state_url'] = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'add_new_state'), GEN_SET_ADMIN_URL);
667 667
 
668
-		$state_details_settings = EEH_Template::display_template( GEN_SET_TEMPLATE_PATH . 'state_details_settings.template.php', $this->_template_args, TRUE );
668
+		$state_details_settings = EEH_Template::display_template(GEN_SET_TEMPLATE_PATH.'state_details_settings.template.php', $this->_template_args, TRUE);
669 669
 
670
-		if ( defined( 'DOING_AJAX' )) {
671
-			$notices = EE_Error::get_notices( FALSE, FALSE, FALSE );
672
-			echo json_encode( array( 'return_data' => $state_details_settings, 'success' => $notices['success'], 'errors' => $notices['errors'] ));
670
+		if (defined('DOING_AJAX')) {
671
+			$notices = EE_Error::get_notices(FALSE, FALSE, FALSE);
672
+			echo json_encode(array('return_data' => $state_details_settings, 'success' => $notices['success'], 'errors' => $notices['errors']));
673 673
 			die();
674 674
 		} else {
675 675
 			return $state_details_settings;
@@ -690,40 +690,39 @@  discard block
 block discarded – undo
690 690
 
691 691
 		$success = TRUE;
692 692
 
693
-		$CNT_ISO = isset( $this->_req_data['CNT_ISO'] ) ? strtoupper( sanitize_text_field( $this->_req_data['CNT_ISO'] )) : FALSE;
694
-		if ( ! $CNT_ISO ) {
695
-			EE_Error::add_error( __( 'No Country ISO code or an invalid Country ISO code was received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
693
+		$CNT_ISO = isset($this->_req_data['CNT_ISO']) ? strtoupper(sanitize_text_field($this->_req_data['CNT_ISO'])) : FALSE;
694
+		if ( ! $CNT_ISO) {
695
+			EE_Error::add_error(__('No Country ISO code or an invalid Country ISO code was received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
696 696
 			$success = FALSE;
697 697
 		}
698
-		$STA_abbrev = isset( $this->_req_data['STA_abbrev'] ) ? sanitize_text_field( $this->_req_data['STA_abbrev'] ) : FALSE;
699
-		if ( ! $STA_abbrev ) {
700
-			EE_Error::add_error( __( 'No State ISO code or an invalid State ISO code was received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
698
+		$STA_abbrev = isset($this->_req_data['STA_abbrev']) ? sanitize_text_field($this->_req_data['STA_abbrev']) : FALSE;
699
+		if ( ! $STA_abbrev) {
700
+			EE_Error::add_error(__('No State ISO code or an invalid State ISO code was received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
701 701
 			$success = FALSE;
702 702
 		}
703
-		$STA_name = isset( $this->_req_data['STA_name'] ) ?  sanitize_text_field( $this->_req_data['STA_name'] ) :
704
-			FALSE;
705
-		if ( ! $STA_name ) {
706
-			EE_Error::add_error( __( 'No State name or an invalid State name was received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
703
+		$STA_name = isset($this->_req_data['STA_name']) ? sanitize_text_field($this->_req_data['STA_name']) : FALSE;
704
+		if ( ! $STA_name) {
705
+			EE_Error::add_error(__('No State name or an invalid State name was received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
707 706
 			$success = FALSE;
708 707
 		}
709 708
 
710
-		if ( $success ) {
709
+		if ($success) {
711 710
 			$cols_n_values = array(
712 711
 				'CNT_ISO' => $CNT_ISO,
713 712
 				'STA_abbrev' => $STA_abbrev,
714 713
 				'STA_name' => $STA_name,
715 714
 				'STA_active' => TRUE
716 715
 			);
717
-			$success = EEM_State::instance()->insert ( $cols_n_values );
718
-			EE_Error::add_success( __( 'The State was added successfully.', 'event_espresso' ) );
716
+			$success = EEM_State::instance()->insert($cols_n_values);
717
+			EE_Error::add_success(__('The State was added successfully.', 'event_espresso'));
719 718
 		}
720 719
 
721
-		if ( defined( 'DOING_AJAX' )) {
722
-			$notices = EE_Error::get_notices( FALSE, FALSE, FALSE );
723
-			echo json_encode( array_merge( $notices, array( 'return_data' => $CNT_ISO ) ) );
720
+		if (defined('DOING_AJAX')) {
721
+			$notices = EE_Error::get_notices(FALSE, FALSE, FALSE);
722
+			echo json_encode(array_merge($notices, array('return_data' => $CNT_ISO)));
724 723
 			die();
725 724
 		} else {
726
-			$this->_redirect_after_action( $success, 'State', 'added', array( 'action' => 'country_settings' ) );
725
+			$this->_redirect_after_action($success, 'State', 'added', array('action' => 'country_settings'));
727 726
 		}
728 727
 	}
729 728
 
@@ -736,25 +735,25 @@  discard block
 block discarded – undo
736 735
 	 * 		@return 		boolean | void
737 736
 	 */
738 737
 	public function delete_state() {
739
-		$CNT_ISO = isset( $this->_req_data['CNT_ISO'] ) ? strtoupper( sanitize_text_field( $this->_req_data['CNT_ISO'] )) : FALSE;
740
-		$STA_ID = isset( $this->_req_data['STA_ID'] ) ? sanitize_text_field( $this->_req_data['STA_ID'] ) : FALSE;
741
-		$STA_abbrev = isset( $this->_req_data['STA_abbrev'] ) ? sanitize_text_field( $this->_req_data['STA_abbrev'] ) : FALSE;
742
-		if ( ! $STA_ID ) {
743
-			EE_Error::add_error( __( 'No State ID or an invalid State ID was received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
738
+		$CNT_ISO = isset($this->_req_data['CNT_ISO']) ? strtoupper(sanitize_text_field($this->_req_data['CNT_ISO'])) : FALSE;
739
+		$STA_ID = isset($this->_req_data['STA_ID']) ? sanitize_text_field($this->_req_data['STA_ID']) : FALSE;
740
+		$STA_abbrev = isset($this->_req_data['STA_abbrev']) ? sanitize_text_field($this->_req_data['STA_abbrev']) : FALSE;
741
+		if ( ! $STA_ID) {
742
+			EE_Error::add_error(__('No State ID or an invalid State ID was received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
744 743
 			return FALSE;
745 744
 		}
746
-		$success = EEM_State::instance()->delete_by_ID( $STA_ID );
747
-		if ( $success !== FALSE ) {
748
-			do_action( 'AHEE__General_Settings_Admin_Page__delete_state__state_deleted', $CNT_ISO, $STA_ID, array( 'STA_abbrev' => $STA_abbrev ));
749
-			EE_Error::add_success( __( 'The State was deleted successfully.', 'event_espresso' ));
745
+		$success = EEM_State::instance()->delete_by_ID($STA_ID);
746
+		if ($success !== FALSE) {
747
+			do_action('AHEE__General_Settings_Admin_Page__delete_state__state_deleted', $CNT_ISO, $STA_ID, array('STA_abbrev' => $STA_abbrev));
748
+			EE_Error::add_success(__('The State was deleted successfully.', 'event_espresso'));
750 749
 		}
751
-		if ( defined( 'DOING_AJAX' )) {
752
-			$notices = EE_Error::get_notices( FALSE, FALSE );
750
+		if (defined('DOING_AJAX')) {
751
+			$notices = EE_Error::get_notices(FALSE, FALSE);
753 752
 			$notices['return_data'] = TRUE;
754
-			echo json_encode( $notices );
753
+			echo json_encode($notices);
755 754
 			die();
756 755
 		} else {
757
-			$this->_redirect_after_action( $success, 'State', 'deleted', array( 'action' => 'country_settings' ) );
756
+			$this->_redirect_after_action($success, 'State', 'deleted', array('action' => 'country_settings'));
758 757
 		}
759 758
 	}
760 759
 
@@ -770,63 +769,63 @@  discard block
 block discarded – undo
770 769
 	protected function _update_country_settings() {
771 770
 //		EEH_Debug_Tools::printr( $this->_req_data, '$this->_req_data  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
772 771
 		// grab the country ISO code
773
-		$CNT_ISO = isset( $this->_req_data['country'] ) ? strtoupper( sanitize_text_field( $this->_req_data['country'] )) : FALSE;
774
-		if ( ! $CNT_ISO ) {
775
-			EE_Error::add_error( __( 'No Country ISO code or an invalid Country ISO code was received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
772
+		$CNT_ISO = isset($this->_req_data['country']) ? strtoupper(sanitize_text_field($this->_req_data['country'])) : FALSE;
773
+		if ( ! $CNT_ISO) {
774
+			EE_Error::add_error(__('No Country ISO code or an invalid Country ISO code was received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
776 775
 			return;
777 776
 		}
778 777
 		$cols_n_values = array();
779
-		$cols_n_values['CNT_ISO3'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_ISO3'] ) ? strtoupper( sanitize_text_field( $this->_req_data['cntry'][$CNT_ISO]['CNT_ISO3'] )) : FALSE;
780
-		$cols_n_values['RGN_ID'] = isset( $this->_req_data['cntry'][$CNT_ISO]['RGN_ID'] ) ? absint( $this->_req_data['cntry'][$CNT_ISO]['RGN_ID'] ) : NULL;
781
-		$cols_n_values['CNT_name'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_name'] ) ? sanitize_text_field( $this->_req_data['cntry'][$CNT_ISO]['CNT_name'] ) : NULL;
782
-		$cols_n_values['CNT_cur_code'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_code'] ) ? strtoupper( sanitize_text_field( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_code'] )) : 'USD';
783
-		$cols_n_values['CNT_cur_single'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_single'] ) ? sanitize_text_field( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_single'] ) : 'dollar';
784
-		$cols_n_values['CNT_cur_plural'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_plural'] ) ? sanitize_text_field( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_plural'] ) : 'dollars';
785
-		$cols_n_values['CNT_cur_sign'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_sign'] ) ? sanitize_text_field( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_sign'] ) : '$';
786
-		$cols_n_values['CNT_cur_sign_b4'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_sign_b4'] ) ? absint( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_sign_b4'] ) : TRUE;
787
-		$cols_n_values['CNT_cur_dec_plc'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_dec_plc'] ) ? absint( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_dec_plc'] ) : 2;
788
-		$cols_n_values['CNT_cur_dec_mrk'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_dec_mrk'] ) ? sanitize_text_field( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_dec_mrk'] ) : '.';
789
-		$cols_n_values['CNT_cur_thsnds'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_thsnds'] ) ? sanitize_text_field( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_thsnds'] ) : ',';
790
-		$cols_n_values['CNT_tel_code'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_tel_code'] ) ? sanitize_text_field( $this->_req_data['cntry'][$CNT_ISO]['CNT_tel_code'] ) : NULL;
791
-		$cols_n_values['CNT_is_EU'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_is_EU'] ) ? absint( $this->_req_data['cntry'][$CNT_ISO]['CNT_is_EU'] ) : FALSE;
792
-		$cols_n_values['CNT_active'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_active'] ) ? absint( $this->_req_data['cntry'][$CNT_ISO]['CNT_active'] ) : FALSE;
778
+		$cols_n_values['CNT_ISO3'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_ISO3']) ? strtoupper(sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_ISO3'])) : FALSE;
779
+		$cols_n_values['RGN_ID'] = isset($this->_req_data['cntry'][$CNT_ISO]['RGN_ID']) ? absint($this->_req_data['cntry'][$CNT_ISO]['RGN_ID']) : NULL;
780
+		$cols_n_values['CNT_name'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_name']) ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_name']) : NULL;
781
+		$cols_n_values['CNT_cur_code'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_code']) ? strtoupper(sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_code'])) : 'USD';
782
+		$cols_n_values['CNT_cur_single'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_single']) ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_single']) : 'dollar';
783
+		$cols_n_values['CNT_cur_plural'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_plural']) ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_plural']) : 'dollars';
784
+		$cols_n_values['CNT_cur_sign'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_sign']) ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_sign']) : '$';
785
+		$cols_n_values['CNT_cur_sign_b4'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_sign_b4']) ? absint($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_sign_b4']) : TRUE;
786
+		$cols_n_values['CNT_cur_dec_plc'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_dec_plc']) ? absint($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_dec_plc']) : 2;
787
+		$cols_n_values['CNT_cur_dec_mrk'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_dec_mrk']) ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_dec_mrk']) : '.';
788
+		$cols_n_values['CNT_cur_thsnds'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_thsnds']) ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_thsnds']) : ',';
789
+		$cols_n_values['CNT_tel_code'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_tel_code']) ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_tel_code']) : NULL;
790
+		$cols_n_values['CNT_is_EU'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_is_EU']) ? absint($this->_req_data['cntry'][$CNT_ISO]['CNT_is_EU']) : FALSE;
791
+		$cols_n_values['CNT_active'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_active']) ? absint($this->_req_data['cntry'][$CNT_ISO]['CNT_active']) : FALSE;
793 792
 		// allow filtering of country data
794
-		$cols_n_values = apply_filters( 'FHEE__General_Settings_Admin_Page___update_country_settings__cols_n_values', $cols_n_values );
793
+		$cols_n_values = apply_filters('FHEE__General_Settings_Admin_Page___update_country_settings__cols_n_values', $cols_n_values);
795 794
 		//EEH_Debug_Tools::printr( $cols_n_values, '$cols_n_values  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
796 795
 		// where values
797
-		$where_cols_n_values = array( array( 'CNT_ISO' => $CNT_ISO ));
796
+		$where_cols_n_values = array(array('CNT_ISO' => $CNT_ISO));
798 797
 		// run the update
799
-		$success = EEM_Country::instance()->update( $cols_n_values, $where_cols_n_values );
798
+		$success = EEM_Country::instance()->update($cols_n_values, $where_cols_n_values);
800 799
 //		global $wpdb;
801 800
 //		echo '<h4>' . $wpdb->last_query . '  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>';
802 801
 //		echo '<h4>$success : ' . $success . '  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>';
803
-		if ( isset( $this->_req_data['states'] ) && is_array( $this->_req_data['states'] ) && $success !== FALSE ) {
802
+		if (isset($this->_req_data['states']) && is_array($this->_req_data['states']) && $success !== FALSE) {
804 803
 			// allow filtering of states data
805
-			$states = apply_filters( 'FHEE__General_Settings_Admin_Page___update_country_settings__states', $this->_req_data['states'] );
804
+			$states = apply_filters('FHEE__General_Settings_Admin_Page___update_country_settings__states', $this->_req_data['states']);
806 805
 //			EEH_Debug_Tools::printr( $states, '$states  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
807 806
 			// loop thru state data ( looks like : states[75][STA_name] )
808
-			foreach( $states as $STA_ID => $state ) {
807
+			foreach ($states as $STA_ID => $state) {
809 808
 				$cols_n_values = array(
810 809
 					'CNT_ISO' 		=> $CNT_ISO,
811
-					'STA_abbrev' => sanitize_text_field( $state['STA_abbrev'] ),
812
-					'STA_name' 	=> sanitize_text_field( $state['STA_name'] ),
813
-					'STA_active' 	=> (bool)absint( $state['STA_active'] )
810
+					'STA_abbrev' => sanitize_text_field($state['STA_abbrev']),
811
+					'STA_name' 	=> sanitize_text_field($state['STA_name']),
812
+					'STA_active' 	=> (bool) absint($state['STA_active'])
814 813
 				);
815 814
 				// where values
816
-				$where_cols_n_values = array( array( 'STA_ID' => $STA_ID ));
815
+				$where_cols_n_values = array(array('STA_ID' => $STA_ID));
817 816
 				// run the update
818
-				$success = EEM_State::instance()->update( $cols_n_values, $where_cols_n_values );
819
-				if ( $success !== FALSE ) {
820
-					do_action( 'AHEE__General_Settings_Admin_Page__update_country_settings__state_saved', $CNT_ISO, $STA_ID, $cols_n_values );
817
+				$success = EEM_State::instance()->update($cols_n_values, $where_cols_n_values);
818
+				if ($success !== FALSE) {
819
+					do_action('AHEE__General_Settings_Admin_Page__update_country_settings__state_saved', $CNT_ISO, $STA_ID, $cols_n_values);
821 820
 				}
822 821
 			}
823 822
 		}
824 823
 		// check if country being edited matches org option country, and if so, then  update EE_Config with new settings
825
-		if ( isset( EE_Registry::instance()->CFG->organization->CNT_ISO ) && $CNT_ISO == EE_Registry::instance()->CFG->organization->CNT_ISO ) {
826
-			EE_Registry::instance()->CFG->currency = new EE_Currency_Config( $CNT_ISO );
824
+		if (isset(EE_Registry::instance()->CFG->organization->CNT_ISO) && $CNT_ISO == EE_Registry::instance()->CFG->organization->CNT_ISO) {
825
+			EE_Registry::instance()->CFG->currency = new EE_Currency_Config($CNT_ISO);
827 826
 			EE_Registry::instance()->CFG->update_espresso_config();
828 827
 		}
829
-		$this->_redirect_after_action( $success, 'Countries', 'updated', array( 'action' => 'country_settings', 'country' => $CNT_ISO ));
828
+		$this->_redirect_after_action($success, 'Countries', 'updated', array('action' => 'country_settings', 'country' => $CNT_ISO));
830 829
 	}
831 830
 
832 831
 
@@ -840,11 +839,11 @@  discard block
 block discarded – undo
840 839
 	 * 		@param 		string 		$label
841 840
 	 * 		@return 		string
842 841
 	 */
843
-	public function country_form_field_label_wrap( $label, $required_text ) {
842
+	public function country_form_field_label_wrap($label, $required_text) {
844 843
 		return '
845 844
 			<tr>
846 845
 				<th>
847
-					' . $label  . '
846
+					' . $label.'
848 847
 				</th>';
849 848
 	}
850 849
 
@@ -858,10 +857,10 @@  discard block
 block discarded – undo
858 857
 	 * 		@param 		string 		$label
859 858
 	 * 		@return 		string
860 859
 	 */
861
-	public function country_form_field_input__wrap( $input, $label ) {
860
+	public function country_form_field_input__wrap($input, $label) {
862 861
 		return '
863 862
 				<td class="general-settings-country-input-td">
864
-					' . $input . '
863
+					' . $input.'
865 864
 				</td>
866 865
 			</tr>';
867 866
 	}
@@ -877,7 +876,7 @@  discard block
 block discarded – undo
877 876
 	 * 		@param 		string 		$required_text
878 877
 	 * 		@return 		string
879 878
 	 */
880
-	public function state_form_field_label_wrap( $label, $required_text  ) {
879
+	public function state_form_field_label_wrap($label, $required_text) {
881 880
 		return $required_text;
882 881
 	}
883 882
 
@@ -891,10 +890,10 @@  discard block
 block discarded – undo
891 890
 	 * 		@param 		string 		$label
892 891
 	 * 		@return 		string
893 892
 	 */
894
-	public function state_form_field_input__wrap( $input, $label ) {
893
+	public function state_form_field_input__wrap($input, $label) {
895 894
 		return '
896 895
 				<td class="general-settings-country-state-input-td">
897
-					' . $input . '
896
+					' . $input.'
898 897
 				</td>';
899 898
 
900 899
 	}
@@ -917,10 +916,10 @@  discard block
 block discarded – undo
917 916
 	 * @param int $ee_page_id
918 917
 	 * @return string
919 918
 	 */
920
-	public static function edit_view_links( $ee_page_id ) {
921
-		$links = '<a href="' . add_query_arg( array( 'post' => $ee_page_id, 'action' => 'edit' ),  admin_url( 'post.php' )) . '" >' . __('Edit', 'event_espresso') . '</a>';
919
+	public static function edit_view_links($ee_page_id) {
920
+		$links = '<a href="'.add_query_arg(array('post' => $ee_page_id, 'action' => 'edit'), admin_url('post.php')).'" >'.__('Edit', 'event_espresso').'</a>';
922 921
 		$links .= ' &nbsp;|&nbsp; ';
923
-		$links .= '<a href="' . get_permalink( $ee_page_id ) . '" >' . __('View', 'event_espresso') . '</a>';
922
+		$links .= '<a href="'.get_permalink($ee_page_id).'" >'.__('View', 'event_espresso').'</a>';
924 923
 		return $links;
925 924
 	}
926 925
 
@@ -933,27 +932,27 @@  discard block
 block discarded – undo
933 932
 	 * @param WP page object $ee_page
934 933
 	 * @return string
935 934
 	 */
936
-	public static function page_and_shortcode_status( $ee_page, $shortcode ) {
935
+	public static function page_and_shortcode_status($ee_page, $shortcode) {
937 936
 
938 937
 		// page status
939
-		if ( isset( $ee_page->post_status ) && $ee_page->post_status == 'publish') {
938
+		if (isset($ee_page->post_status) && $ee_page->post_status == 'publish') {
940 939
 			$pg_colour = 'green';
941
-			$pg_status = sprintf( __('Page%sStatus%sOK', 'event_espresso'), '&nbsp;' , '&nbsp;' );
940
+			$pg_status = sprintf(__('Page%sStatus%sOK', 'event_espresso'), '&nbsp;', '&nbsp;');
942 941
 		 } else {
943 942
 			$pg_colour = 'red';
944
-			$pg_status = sprintf( __('Page%sVisibility%sProblem', 'event_espresso'), '&nbsp;', '&nbsp;'  );
943
+			$pg_status = sprintf(__('Page%sVisibility%sProblem', 'event_espresso'), '&nbsp;', '&nbsp;');
945 944
 		}
946 945
 
947 946
 		// shortcode status
948
-		if ( isset( $ee_page->post_content ) && strpos( $ee_page->post_content, $shortcode ) !== FALSE ) {
947
+		if (isset($ee_page->post_content) && strpos($ee_page->post_content, $shortcode) !== FALSE) {
949 948
 			$sc_colour = 'green';
950
-			$sc_status = sprintf( __('Shortcode%sOK', 'event_espresso'), '&nbsp;' );
949
+			$sc_status = sprintf(__('Shortcode%sOK', 'event_espresso'), '&nbsp;');
951 950
 		 } else {
952 951
 			$sc_colour = 'red';
953
-			$sc_status = sprintf( __('Shortcode%sProblem', 'event_espresso'), '&nbsp;' );
952
+			$sc_status = sprintf(__('Shortcode%sProblem', 'event_espresso'), '&nbsp;');
954 953
 		}
955 954
 
956
-		return '<span style="color:' . $pg_colour . '; margin-right:2em;"><strong>' . $pg_status . '</strong></span><span style="color:' . $sc_colour . '"><strong>' . $sc_status . '</strong></span>';
955
+		return '<span style="color:'.$pg_colour.'; margin-right:2em;"><strong>'.$pg_status.'</strong></span><span style="color:'.$sc_colour.'"><strong>'.$sc_status.'</strong></span>';
957 956
 
958 957
 	}
959 958
 
@@ -968,20 +967,20 @@  discard block
 block discarded – undo
968 967
 	 * @param unknown_type $level
969 968
 	 * @return unknown
970 969
 	 */
971
-	public static function page_settings_dropdown( $default = 0, $parent = 0, $level = 0 ) {
970
+	public static function page_settings_dropdown($default = 0, $parent = 0, $level = 0) {
972 971
 		global $wpdb;
973
-		$items = $wpdb->get_results( $wpdb->prepare("SELECT ID, post_parent, post_title FROM $wpdb->posts WHERE post_parent = %d AND post_type = 'page' AND post_status != 'trash' ORDER BY menu_order", $parent) );
972
+		$items = $wpdb->get_results($wpdb->prepare("SELECT ID, post_parent, post_title FROM $wpdb->posts WHERE post_parent = %d AND post_type = 'page' AND post_status != 'trash' ORDER BY menu_order", $parent));
974 973
 
975
-		if ( $items ) {
976
-			foreach ( $items as $item ) {
977
-				$pad = str_repeat( '&nbsp;', $level * 3 );
978
-				if ( $item->ID == $default)
974
+		if ($items) {
975
+			foreach ($items as $item) {
976
+				$pad = str_repeat('&nbsp;', $level * 3);
977
+				if ($item->ID == $default)
979 978
 					$current = ' selected="selected"';
980 979
 				else
981 980
 					$current = '';
982 981
 
983
-				echo "\n\t<option class='level-$level' value='$item->ID'$current>$pad " . esc_html($item->post_title) . "</option>";
984
-				parent_dropdown( $default, $item->ID, $level +1 );
982
+				echo "\n\t<option class='level-$level' value='$item->ID'$current>$pad ".esc_html($item->post_title)."</option>";
983
+				parent_dropdown($default, $item->ID, $level + 1);
985 984
 			}
986 985
 		} else {
987 986
 			return false;
Please login to merge, or discard this patch.