Completed
Branch FET-8365-add-indexes (4b9253)
by
unknown
478:11 queued 466:02
created
core/EE_Request_Handler.core.php 3 patches
Doc Comments   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -271,7 +271,7 @@  discard block
 block discarded – undo
271 271
 	 *    is_espresso_page
272 272
 	 *
273 273
 	 * @access    public
274
-	 * @param null $value
274
+	 * @param boolean $value
275 275
 	 * @return    mixed
276 276
 	 */
277 277
 	public function set_espresso_page( $value = null ) {
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
 	 *    setter
308 308
 	 *
309 309
 	 * @access    public
310
-	 * @param      $key
310
+	 * @param      string $key
311 311
 	 * @param      $value
312 312
 	 * @param bool $override_ee
313 313
 	 * @return    void
@@ -352,7 +352,7 @@  discard block
 block discarded – undo
352 352
 	 *    remove param
353 353
 	 *
354 354
 	 * @access    public
355
-	 * @param $key
355
+	 * @param string $key
356 356
 	 * @return    void
357 357
 	 */
358 358
 	public function un_set( $key ) {
@@ -392,7 +392,7 @@  discard block
 block discarded – undo
392 392
 	 *    add_output
393 393
 	 *
394 394
 	 * @access    public
395
-	 * @param $string
395
+	 * @param string $string
396 396
 	 * @return    void
397 397
 	 */
398 398
 	public function add_output( $string ) {
Please login to merge, or discard this patch.
Spacing   +70 added lines, -70 removed lines patch added patch discarded remove patch
@@ -65,18 +65,18 @@  discard block
 block discarded – undo
65 65
 	 * @param WP_Query $wp
66 66
 	 * @return \EE_Request_Handler
67 67
 	 */
68
-	public function __construct( $wp = null ) {
68
+	public function __construct($wp = null) {
69 69
 		//if somebody forgot to provide us with WP, that's ok because its global
70
-		if( ! $wp){
70
+		if ( ! $wp) {
71 71
 			global $wp;
72 72
 		}
73 73
 		// grab request vars
74 74
 		$this->_params = $_REQUEST;
75 75
 		// AJAX ???
76
-		$this->ajax = defined( 'DOING_AJAX' ) ? true : false;
77
-		$this->front_ajax = $this->is_set( 'ee_front_ajax' ) && $this->get( 'ee_front_ajax' ) == 1 ? true : false;
78
-		$this->set_request_vars( $wp );
79
-		do_action( 'AHEE__EE_Request_Handler__construct__complete' );
76
+		$this->ajax = defined('DOING_AJAX') ? true : false;
77
+		$this->front_ajax = $this->is_set('ee_front_ajax') && $this->get('ee_front_ajax') == 1 ? true : false;
78
+		$this->set_request_vars($wp);
79
+		do_action('AHEE__EE_Request_Handler__construct__complete');
80 80
 	}
81 81
 
82 82
 
@@ -88,14 +88,14 @@  discard block
 block discarded – undo
88 88
 	 * @param WP_Query $wp
89 89
 	 * @return void
90 90
 	 */
91
-	public function set_request_vars( $wp = null ) {
92
-		if ( ! is_admin() ) {
91
+	public function set_request_vars($wp = null) {
92
+		if ( ! is_admin()) {
93 93
 			// set request post_id
94
-			$this->set( 'post_id', $this->get_post_id_from_request( $wp ));
94
+			$this->set('post_id', $this->get_post_id_from_request($wp));
95 95
 			// set request post name
96
-			$this->set( 'post_name', $this->get_post_name_from_request( $wp ));
96
+			$this->set('post_name', $this->get_post_name_from_request($wp));
97 97
 			// set request post_type
98
-			$this->set( 'post_type', $this->get_post_type_from_request( $wp ));
98
+			$this->set('post_type', $this->get_post_type_from_request($wp));
99 99
 			// true or false ? is this page being used by EE ?
100 100
 			$this->set_espresso_page();
101 101
 		}
@@ -110,20 +110,20 @@  discard block
 block discarded – undo
110 110
 	 * @param WP_Query $wp
111 111
 	 * @return int
112 112
 	 */
113
-	public function get_post_id_from_request( $wp = null ) {
114
-		if( ! $wp){
113
+	public function get_post_id_from_request($wp = null) {
114
+		if ( ! $wp) {
115 115
 			global $wp;
116 116
 		}
117 117
 		$post_id = null;
118
-		if ( isset( $wp->query_vars['p'] )) {
118
+		if (isset($wp->query_vars['p'])) {
119 119
 			$post_id = $wp->query_vars['p'];
120 120
 		}
121
-		if ( ! $post_id && isset( $wp->query_vars['page_id'] )) {
121
+		if ( ! $post_id && isset($wp->query_vars['page_id'])) {
122 122
 			$post_id = $wp->query_vars['page_id'];
123 123
 		}
124
-		if ( ! $post_id && isset( $wp->request )) {
125
-			if ( is_numeric( basename( $wp->request ))) {
126
-				$post_id = basename( $wp->request );
124
+		if ( ! $post_id && isset($wp->request)) {
125
+			if (is_numeric(basename($wp->request))) {
126
+				$post_id = basename($wp->request);
127 127
 			}
128 128
 		}
129 129
 		return $post_id;
@@ -138,35 +138,35 @@  discard block
 block discarded – undo
138 138
 	 * @param WP_Query $wp
139 139
 	 * @return string
140 140
 	 */
141
-	public function get_post_name_from_request( $wp = null ) {
142
-		if( ! $wp){
141
+	public function get_post_name_from_request($wp = null) {
142
+		if ( ! $wp) {
143 143
 			global $wp;
144 144
 		}
145 145
 		$post_name = null;
146
-		if ( isset( $wp->query_vars['name'] ) && ! empty( $wp->query_vars['name'] )) {
146
+		if (isset($wp->query_vars['name']) && ! empty($wp->query_vars['name'])) {
147 147
 			$post_name = $wp->query_vars['name'];
148 148
 		}
149
-		if ( ! $post_name && isset( $wp->query_vars['pagename'] ) && ! empty( $wp->query_vars['pagename'] )) {
149
+		if ( ! $post_name && isset($wp->query_vars['pagename']) && ! empty($wp->query_vars['pagename'])) {
150 150
 			$post_name = $wp->query_vars['pagename'];
151 151
 		}
152
-		if ( ! $post_name && isset( $wp->request ) && ! empty( $wp->request )) {
153
-			$possible_post_name = basename( $wp->request );
154
-			if ( ! is_numeric( $possible_post_name )) {
152
+		if ( ! $post_name && isset($wp->request) && ! empty($wp->request)) {
153
+			$possible_post_name = basename($wp->request);
154
+			if ( ! is_numeric($possible_post_name)) {
155 155
 				/** @type WPDB $wpdb */
156 156
 				global $wpdb;
157
-				$SQL = 'SELECT ID from ' . $wpdb->posts . ' WHERE post_status="publish" AND post_name=%d';
158
-				$possible_post_name = $wpdb->get_var( $wpdb->prepare( $SQL, $possible_post_name ));
159
-				if ( $possible_post_name ) {
157
+				$SQL = 'SELECT ID from '.$wpdb->posts.' WHERE post_status="publish" AND post_name=%d';
158
+				$possible_post_name = $wpdb->get_var($wpdb->prepare($SQL, $possible_post_name));
159
+				if ($possible_post_name) {
160 160
 					$post_name = $possible_post_name;
161 161
 				}
162 162
 			}
163 163
 		}
164
-		if ( ! $post_name && $this->get( 'post_id' )) {
164
+		if ( ! $post_name && $this->get('post_id')) {
165 165
 			/** @type WPDB $wpdb */
166 166
 			global $wpdb;
167
-			$SQL = 'SELECT post_name from ' . $wpdb->posts . ' WHERE post_status="publish" AND ID=%d';
168
-			$possible_post_name = $wpdb->get_var( $wpdb->prepare( $SQL, $this->get( 'post_id' )));
169
-			if( $possible_post_name ) {
167
+			$SQL = 'SELECT post_name from '.$wpdb->posts.' WHERE post_status="publish" AND ID=%d';
168
+			$possible_post_name = $wpdb->get_var($wpdb->prepare($SQL, $this->get('post_id')));
169
+			if ($possible_post_name) {
170 170
 				$post_name = $possible_post_name;
171 171
 			}
172 172
 		}
@@ -182,11 +182,11 @@  discard block
 block discarded – undo
182 182
 	 * @param WP_Query $wp
183 183
 	 * @return mixed
184 184
 	 */
185
-	public function get_post_type_from_request( $wp = null ) {
186
-		if( ! $wp){
185
+	public function get_post_type_from_request($wp = null) {
186
+		if ( ! $wp) {
187 187
 			global $wp;
188 188
 		}
189
-		return isset( $wp->query_vars['post_type'] ) ? $wp->query_vars['post_type'] : null;
189
+		return isset($wp->query_vars['post_type']) ? $wp->query_vars['post_type'] : null;
190 190
 	}
191 191
 
192 192
 
@@ -199,41 +199,41 @@  discard block
 block discarded – undo
199 199
 	public function test_for_espresso_page() {
200 200
 		global $wp;
201 201
 		/** @type EE_CPT_Strategy $EE_CPT_Strategy */
202
-		$EE_CPT_Strategy = EE_Registry::instance()->load_core( 'CPT_Strategy' );
202
+		$EE_CPT_Strategy = EE_Registry::instance()->load_core('CPT_Strategy');
203 203
 		$espresso_CPT_taxonomies = $EE_CPT_Strategy->get_CPT_taxonomies();
204
-		if ( is_array( $espresso_CPT_taxonomies ) ) {
205
-			foreach ( $espresso_CPT_taxonomies as $espresso_CPT_taxonomy =>$details ) {
206
-				if ( isset( $wp->query_vars, $wp->query_vars[ $espresso_CPT_taxonomy ] ) ) {
204
+		if (is_array($espresso_CPT_taxonomies)) {
205
+			foreach ($espresso_CPT_taxonomies as $espresso_CPT_taxonomy =>$details) {
206
+				if (isset($wp->query_vars, $wp->query_vars[$espresso_CPT_taxonomy])) {
207 207
 					return true;
208 208
 				}
209 209
 			}
210 210
 		}
211 211
 		// load espresso CPT endpoints
212 212
 		$espresso_CPT_endpoints = $EE_CPT_Strategy->get_CPT_endpoints();
213
-		$post_type_CPT_endpoints = array_flip( $espresso_CPT_endpoints );
214
-		$post_types = (array)$this->get( 'post_type' );
215
-		foreach ( $post_types as $post_type ) {
213
+		$post_type_CPT_endpoints = array_flip($espresso_CPT_endpoints);
214
+		$post_types = (array) $this->get('post_type');
215
+		foreach ($post_types as $post_type) {
216 216
 			// was a post name passed ?
217
-			if ( isset( $post_type_CPT_endpoints[ $post_type ] ) ) {
217
+			if (isset($post_type_CPT_endpoints[$post_type])) {
218 218
 				// kk we know this is an espresso page, but is it a specific post ?
219
-				if ( ! $this->get( 'post_name' ) ) {
219
+				if ( ! $this->get('post_name')) {
220 220
 					// there's no specific post name set, so maybe it's one of our endpoints like www.domain.com/events
221
-					$post_name = isset( $post_type_CPT_endpoints[ $this->get( 'post_type' ) ] ) ? $post_type_CPT_endpoints[ $this->get( 'post_type' ) ] : null;
221
+					$post_name = isset($post_type_CPT_endpoints[$this->get('post_type')]) ? $post_type_CPT_endpoints[$this->get('post_type')] : null;
222 222
 					// if the post type matches on of our then set the endpoint
223
-					if ( $post_name ) {
224
-						$this->set( 'post_name', $post_name );
223
+					if ($post_name) {
224
+						$this->set('post_name', $post_name);
225 225
 					}
226 226
 				}
227 227
 				return true;
228 228
 			}
229 229
 		}
230
-		if ( $this->get( 'post_name' )) {
230
+		if ($this->get('post_name')) {
231 231
 			// load all pages using espresso shortcodes
232
-			$post_shortcodes = isset( EE_Registry::instance()->CFG->core->post_shortcodes ) ? EE_Registry::instance()->CFG->core->post_shortcodes : array();
232
+			$post_shortcodes = isset(EE_Registry::instance()->CFG->core->post_shortcodes) ? EE_Registry::instance()->CFG->core->post_shortcodes : array();
233 233
 			// make sure core pages are included
234
-			$espresso_pages = array_merge( $espresso_CPT_endpoints, $post_shortcodes );
234
+			$espresso_pages = array_merge($espresso_CPT_endpoints, $post_shortcodes);
235 235
 			// was a post name passed ?
236
-			if (  isset( $espresso_pages[ $this->get( 'post_name' ) ] )) {
236
+			if (isset($espresso_pages[$this->get('post_name')])) {
237 237
 				 return true;
238 238
 			}
239 239
 		}
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
 	 * @param null $value
250 250
 	 * @return    mixed
251 251
 	 */
252
-	public function set_espresso_page( $value = null ) {
252
+	public function set_espresso_page($value = null) {
253 253
 		$value = $value ? $value : $this->test_for_espresso_page();
254 254
 		$this->_params['is_espresso_page'] = $value;
255 255
 	}
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
 	 *  @return 	mixed
264 264
 	 */
265 265
 	public function is_espresso_page() {
266
-		return isset( $this->_params['is_espresso_page'] ) ? $this->_params['is_espresso_page'] : false;
266
+		return isset($this->_params['is_espresso_page']) ? $this->_params['is_espresso_page'] : false;
267 267
 	}
268 268
 
269 269
 
@@ -287,10 +287,10 @@  discard block
 block discarded – undo
287 287
 	 * @param bool $override_ee
288 288
 	 * @return    void
289 289
 	 */
290
-	public function set( $key, $value, $override_ee = false ) {
290
+	public function set($key, $value, $override_ee = false) {
291 291
 		// don't allow "ee" to be overwritten unless explicitly instructed to do so
292
-		if ( $key != 'ee' || ( $key == 'ee' && empty( $this->_params['ee'] )) || ( $key == 'ee' && ! empty( $this->_params['ee'] ) && $override_ee )) {
293
-			$this->_params[ $key ] = $value;
292
+		if ($key != 'ee' || ($key == 'ee' && empty($this->_params['ee'])) || ($key == 'ee' && ! empty($this->_params['ee']) && $override_ee)) {
293
+			$this->_params[$key] = $value;
294 294
 		}
295 295
 	}
296 296
 
@@ -304,8 +304,8 @@  discard block
 block discarded – undo
304 304
 	 * @param null $default
305 305
 	 * @return    mixed
306 306
 	 */
307
-	public function get( $key, $default = null ) {
308
-		return isset( $this->_params[ $key ] ) ? $this->_params[ $key ] : $default;
307
+	public function get($key, $default = null) {
308
+		return isset($this->_params[$key]) ? $this->_params[$key] : $default;
309 309
 	}
310 310
 
311 311
 
@@ -317,8 +317,8 @@  discard block
 block discarded – undo
317 317
 	 * @param $key
318 318
 	 * @return    boolean
319 319
 	 */
320
-	public function is_set( $key ) {
321
-		return isset( $this->_params[ $key ] ) ? true : false;
320
+	public function is_set($key) {
321
+		return isset($this->_params[$key]) ? true : false;
322 322
 	}
323 323
 
324 324
 
@@ -330,8 +330,8 @@  discard block
 block discarded – undo
330 330
 	 * @param $key
331 331
 	 * @return    void
332 332
 	 */
333
-	public function un_set( $key ) {
334
-		unset( $this->_params[ $key ] );
333
+	public function un_set($key) {
334
+		unset($this->_params[$key]);
335 335
 	}
336 336
 
337 337
 
@@ -344,8 +344,8 @@  discard block
 block discarded – undo
344 344
 	 * @param $value
345 345
 	 * @return    void
346 346
 	 */
347
-	public function set_notice( $key, $value ) {
348
-		$this->_notice[ $key ] = $value;
347
+	public function set_notice($key, $value) {
348
+		$this->_notice[$key] = $value;
349 349
 	}
350 350
 
351 351
 
@@ -357,8 +357,8 @@  discard block
 block discarded – undo
357 357
 	 * @param $key
358 358
 	 * @return    mixed
359 359
 	 */
360
-	public function get_notice( $key ) {
361
-		return isset( $this->_notice[ $key ] ) ? $this->_notice[ $key ] : null;
360
+	public function get_notice($key) {
361
+		return isset($this->_notice[$key]) ? $this->_notice[$key] : null;
362 362
 	}
363 363
 
364 364
 
@@ -370,7 +370,7 @@  discard block
 block discarded – undo
370 370
 	 * @param $string
371 371
 	 * @return    void
372 372
 	 */
373
-	public function add_output( $string ) {
373
+	public function add_output($string) {
374 374
 		$this->_output .= $string;
375 375
 	}
376 376
 
@@ -392,8 +392,8 @@  discard block
 block discarded – undo
392 392
 	 * @param $item
393 393
 	 * @param $key
394 394
 	 */
395
-	function sanitize_text_field_for_array_walk( &$item, &$key ) {
396
-		$item = strpos( $item, 'email' ) !== false ? sanitize_email( $item ) : sanitize_text_field( $item );
395
+	function sanitize_text_field_for_array_walk(&$item, &$key) {
396
+		$item = strpos($item, 'email') !== false ? sanitize_email($item) : sanitize_text_field($item);
397 397
 	}
398 398
 
399 399
 
@@ -403,7 +403,7 @@  discard block
 block discarded – undo
403 403
 	 * @param $b
404 404
 	 * @return bool
405 405
 	 */
406
-	public function __set($a,$b) { return false; }
406
+	public function __set($a, $b) { return false; }
407 407
 
408 408
 
409 409
 
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@
 block discarded – undo
1
-<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 /**
3 5
  * Event Espresso
4 6
  *
Please login to merge, or discard this patch.
core/EE_Session.core.php 4 patches
Doc Comments   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -336,7 +336,7 @@  discard block
 block discarded – undo
336 336
 	 /**
337 337
 	  * retrieve session data
338 338
 	  * @access    public
339
-	  * @param null $key
339
+	  * @param string|null $key
340 340
 	  * @param bool $reset_cache
341 341
 	  * @return    array
342 342
 	  */
@@ -360,7 +360,7 @@  discard block
 block discarded – undo
360 360
 	  * set session data
361 361
 	  * @access 	public
362 362
 	  * @param 	array $data
363
-	  * @return 	TRUE on success, FALSE on fail
363
+	  * @return 	boolean on success, FALSE on fail
364 364
 	  */
365 365
 	public function set_session_data( $data ) {
366 366
 
@@ -390,7 +390,7 @@  discard block
 block discarded – undo
390 390
 	 /**
391 391
 	  * @initiate session
392 392
 	  * @access   private
393
-	  * @return TRUE on success, FALSE on fail
393
+	  * @return boolean on success, FALSE on fail
394 394
 	  * @throws \EE_Error
395 395
 	  */
396 396
 	private function _espresso_session() {
@@ -521,7 +521,7 @@  discard block
 block discarded – undo
521 521
 	  * @update session data  prior to saving to the db
522 522
 	  * @access public
523 523
 	  * @param bool $new_session
524
-	  * @return TRUE on success, FALSE on fail
524
+	  * @return boolean on success, FALSE on fail
525 525
 	  */
526 526
 	public function update( $new_session = FALSE ) {
527 527
 		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
@@ -791,7 +791,7 @@  discard block
 block discarded – undo
791 791
 	  * @access public
792 792
 	  * @param array $data_to_reset
793 793
 	  * @param bool  $show_all_notices
794
-	  * @return TRUE on success, FALSE on fail
794
+	  * @return boolean on success, FALSE on fail
795 795
 	  */
796 796
 	public function reset_data( $data_to_reset = array(), $show_all_notices = FALSE ) {
797 797
 		// if $data_to_reset is not in an array, then put it in one
Please login to merge, or discard this patch.
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -137,11 +137,11 @@
 block discarded – undo
137 137
 
138 138
 
139 139
 	/**
140
-	* 	private constructor to prevent direct creation
141
-	* 	@Constructor
142
-	* 	@access private
143
-	* 	@return EE_Session
144
-	*/
140
+	 * 	private constructor to prevent direct creation
141
+	 * 	@Constructor
142
+	 * 	@access private
143
+	 * 	@return EE_Session
144
+	 */
145 145
 	private function __construct() {
146 146
 
147 147
 		// session loading is turned ON by default, but prior to the init hook, can be turned back OFF via: add_filter( 'FHEE_load_EE_Session', '__return_false' );
Please login to merge, or discard this patch.
Spacing   +153 added lines, -153 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1
-<?php if (!defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
2
-do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );/**
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
2
+do_action('AHEE_log', __FILE__, __FUNCTION__, ''); /**
3 3
  *
4 4
  * Event Espresso
5 5
  *
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
 	  * array for defining default session vars
105 105
 	  * @var array
106 106
 	  */
107
-	 private $_default_session_vars = array (
107
+	 private $_default_session_vars = array(
108 108
 		'id' => NULL,
109 109
 		'user_id' => NULL,
110 110
 		'ip_address' => NULL,
@@ -126,9 +126,9 @@  discard block
 block discarded – undo
126 126
 	 *		@access public
127 127
 	 *		@return EE_Session
128 128
 	 */
129
-	public static function instance ( ) {
129
+	public static function instance( ) {
130 130
 		// check if class object is instantiated
131
-		if ( ! self::$_instance instanceof EE_Session ) {
131
+		if ( ! self::$_instance instanceof EE_Session) {
132 132
 			self::$_instance = new self();
133 133
 		}
134 134
 		return self::$_instance;
@@ -145,11 +145,11 @@  discard block
 block discarded – undo
145 145
 	private function __construct() {
146 146
 
147 147
 		// session loading is turned ON by default, but prior to the init hook, can be turned back OFF via: add_filter( 'FHEE_load_EE_Session', '__return_false' );
148
-		if ( ! apply_filters( 'FHEE_load_EE_Session', TRUE ) ) {
148
+		if ( ! apply_filters('FHEE_load_EE_Session', TRUE)) {
149 149
 			return NULL;
150 150
 		}
151
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
152
-		define( 'ESPRESSO_SESSION', TRUE );
151
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
152
+		define('ESPRESSO_SESSION', TRUE);
153 153
 		// default session lifespan in seconds
154 154
 		$this->_lifespan = apply_filters(
155 155
 			'FHEE__EE_Session__construct___lifespan',
@@ -162,35 +162,35 @@  discard block
 block discarded – undo
162 162
 		 * 		}
163 163
 		 */
164 164
 		// retrieve session options from db
165
-		$session_settings = get_option( 'ee_session_settings' );
166
-		if ( $session_settings !== FALSE ) {
165
+		$session_settings = get_option('ee_session_settings');
166
+		if ($session_settings !== FALSE) {
167 167
 			// cycle though existing session options
168
-			foreach ( $session_settings as $var_name => $session_setting ) {
168
+			foreach ($session_settings as $var_name => $session_setting) {
169 169
 				// set values for class properties
170
-				$var_name = '_' . $var_name;
170
+				$var_name = '_'.$var_name;
171 171
 				$this->{$var_name} = $session_setting;
172 172
 			}
173 173
 		}
174 174
 		// are we using encryption?
175
-		if ( $this->_use_encryption ) {
175
+		if ($this->_use_encryption) {
176 176
 			// instantiate the class object making all properties and methods accessible via $this->encryption ex: $this->encryption->encrypt();
177
-			$this->encryption = EE_Registry::instance()->load_core( 'Encryption' );
177
+			$this->encryption = EE_Registry::instance()->load_core('Encryption');
178 178
 		}
179 179
 		// filter hook allows outside functions/classes/plugins to change default empty cart
180
-		$extra_default_session_vars = apply_filters( 'FHEE__EE_Session__construct__extra_default_session_vars', array() );
181
-		array_merge( $this->_default_session_vars, $extra_default_session_vars );
180
+		$extra_default_session_vars = apply_filters('FHEE__EE_Session__construct__extra_default_session_vars', array());
181
+		array_merge($this->_default_session_vars, $extra_default_session_vars);
182 182
 		// apply default session vars
183 183
 		$this->_set_defaults();
184 184
 		// check for existing session and retrieve it from db
185
-		if ( ! $this->_espresso_session() ) {
185
+		if ( ! $this->_espresso_session()) {
186 186
 			// or just start a new one
187 187
 			$this->_create_espresso_session();
188 188
 		}
189 189
 		// check request for 'clear_session' param
190
-		add_action( 'AHEE__EE_Request_Handler__construct__complete', array( $this, 'wp_loaded' ));
190
+		add_action('AHEE__EE_Request_Handler__construct__complete', array($this, 'wp_loaded'));
191 191
 		// once everything is all said and done,
192
-		add_action( 'shutdown', array( $this, 'update' ), 100 );
193
-		add_action( 'shutdown', array( $this, 'garbage_collection' ), 999 );
192
+		add_action('shutdown', array($this, 'update'), 100);
193
+		add_action('shutdown', array($this, 'garbage_collection'), 999);
194 194
 
195 195
 	}
196 196
 
@@ -222,11 +222,11 @@  discard block
 block discarded – undo
222 222
 	 */
223 223
 	private function _set_defaults() {
224 224
 		// set some defaults
225
-		foreach ( $this->_default_session_vars as $key => $default_var ) {
226
-			if ( is_array( $default_var )) {
227
-				$this->_session_data[ $key ] = array();
225
+		foreach ($this->_default_session_vars as $key => $default_var) {
226
+			if (is_array($default_var)) {
227
+				$this->_session_data[$key] = array();
228 228
 			} else {
229
-				$this->_session_data[ $key ] = '';
229
+				$this->_session_data[$key] = '';
230 230
 			}
231 231
 		}
232 232
 	}
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
 	  * @param \EE_Cart $cart
249 249
 	  * @return bool
250 250
 	  */
251
-	 public function set_cart( EE_Cart $cart ) {
251
+	 public function set_cart(EE_Cart $cart) {
252 252
 		 $this->_session_data['cart'] = $cart;
253 253
 		 return TRUE;
254 254
 	 }
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
 	  * @return \EE_Cart
269 269
 	  */
270 270
 	 public function cart() {
271
-		 return isset( $this->_session_data['cart'] ) ? $this->_session_data['cart'] : NULL;
271
+		 return isset($this->_session_data['cart']) ? $this->_session_data['cart'] : NULL;
272 272
 	 }
273 273
 
274 274
 
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
 	  * @param \EE_Checkout $checkout
278 278
 	  * @return bool
279 279
 	  */
280
-	 public function set_checkout( EE_Checkout $checkout ) {
280
+	 public function set_checkout(EE_Checkout $checkout) {
281 281
 		 $this->_session_data['checkout'] = $checkout;
282 282
 		 return TRUE;
283 283
 	 }
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
 	  * @return \EE_Checkout
298 298
 	  */
299 299
 	 public function checkout() {
300
-		 return isset( $this->_session_data['checkout'] ) ? $this->_session_data['checkout'] : NULL;
300
+		 return isset($this->_session_data['checkout']) ? $this->_session_data['checkout'] : NULL;
301 301
 	 }
302 302
 
303 303
 
@@ -306,9 +306,9 @@  discard block
 block discarded – undo
306 306
 	  * @param \EE_Transaction $transaction
307 307
 	  * @return bool
308 308
 	  */
309
-	 public function set_transaction( EE_Transaction $transaction ) {
309
+	 public function set_transaction(EE_Transaction $transaction) {
310 310
 		 // first remove the session from the transaction before we save the transaction in the session
311
-		 $transaction->set_txn_session_data( NULL );
311
+		 $transaction->set_txn_session_data(NULL);
312 312
 		 $this->_session_data['transaction'] = $transaction;
313 313
 		 return TRUE;
314 314
 	 }
@@ -328,7 +328,7 @@  discard block
 block discarded – undo
328 328
 	  * @return \EE_Transaction
329 329
 	  */
330 330
 	 public function transaction() {
331
-		 return isset( $this->_session_data['transaction'] ) ? $this->_session_data['transaction'] : NULL;
331
+		 return isset($this->_session_data['transaction']) ? $this->_session_data['transaction'] : NULL;
332 332
 	 }
333 333
 
334 334
 
@@ -340,16 +340,16 @@  discard block
 block discarded – undo
340 340
 	  * @param bool $reset_cache
341 341
 	  * @return    array
342 342
 	  */
343
-	public function get_session_data( $key = NULL, $reset_cache = FALSE ) {
344
-		if ( $reset_cache ) {
343
+	public function get_session_data($key = NULL, $reset_cache = FALSE) {
344
+		if ($reset_cache) {
345 345
 			$this->reset_cart();
346 346
 			$this->reset_checkout();
347 347
 			$this->reset_transaction();
348 348
 		}
349
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
350
-		 if ( ! empty( $key ))  {
351
-			return  isset( $this->_session_data[ $key ] ) ? $this->_session_data[ $key ] : NULL;
352
-		}  else  {
349
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
350
+		 if ( ! empty($key)) {
351
+			return  isset($this->_session_data[$key]) ? $this->_session_data[$key] : NULL;
352
+		} else {
353 353
 			return $this->_session_data;
354 354
 		}
355 355
 	}
@@ -362,22 +362,22 @@  discard block
 block discarded – undo
362 362
 	  * @param 	array $data
363 363
 	  * @return 	TRUE on success, FALSE on fail
364 364
 	  */
365
-	public function set_session_data( $data ) {
365
+	public function set_session_data($data) {
366 366
 
367
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
367
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
368 368
 
369 369
 		// nothing ??? bad data ??? go home!
370
-		if ( empty( $data ) || ! is_array( $data )) {
371
-			EE_Error::add_error( __( 'No session data or invalid session data was provided.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
370
+		if (empty($data) || ! is_array($data)) {
371
+			EE_Error::add_error(__('No session data or invalid session data was provided.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
372 372
 			return FALSE;
373 373
 		}
374 374
 
375
-		foreach ( $data as $key =>$value ) {
376
-			if ( isset( $this->_default_session_vars[ $key ] )) {
377
-				EE_Error::add_error( sprintf( __( 'Sorry! %s is a default session datum and can not be reset.', 'event_espresso' ), $key ), __FILE__, __FUNCTION__, __LINE__ );
375
+		foreach ($data as $key =>$value) {
376
+			if (isset($this->_default_session_vars[$key])) {
377
+				EE_Error::add_error(sprintf(__('Sorry! %s is a default session datum and can not be reset.', 'event_espresso'), $key), __FILE__, __FUNCTION__, __LINE__);
378 378
 				return FALSE;
379 379
 			} else {
380
-				$this->_session_data[ $key ] = $value;
380
+				$this->_session_data[$key] = $value;
381 381
 			}
382 382
 		}
383 383
 
@@ -394,9 +394,9 @@  discard block
 block discarded – undo
394 394
 	  * @throws \EE_Error
395 395
 	  */
396 396
 	private function _espresso_session() {
397
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
397
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
398 398
 		// check that session has started
399
-		if ( session_id() === '' ) {
399
+		if (session_id() === '') {
400 400
 			//starts a new session if one doesn't already exist, or re-initiates an existing one
401 401
 			session_start();
402 402
 		}
@@ -405,42 +405,42 @@  discard block
 block discarded – undo
405 405
 		// and the visitors IP
406 406
 		$this->_ip_address = $this->_visitor_ip();
407 407
 		// set the "user agent"
408
-		$this->_user_agent = ( isset($_SERVER['HTTP_USER_AGENT'])) ? esc_attr( $_SERVER['HTTP_USER_AGENT'] ) : FALSE;
408
+		$this->_user_agent = (isset($_SERVER['HTTP_USER_AGENT'])) ? esc_attr($_SERVER['HTTP_USER_AGENT']) : FALSE;
409 409
 		// now let's retrieve what's in the db
410 410
 		// we're using WP's Transient API to store session data using the PHP session ID as the option name
411
-		$session_data = get_transient( EE_Session::session_id_prefix . $this->_sid );
412
-		if ( $session_data ) {
413
-			if ( apply_filters( 'FHEE__EE_Session___perform_session_id_hash_check', WP_DEBUG ) ) {
414
-				$hash_check = get_transient( EE_Session::hash_check_prefix . $this->_sid );
415
-				if ( $hash_check && $hash_check !== md5( $session_data ) ) {
411
+		$session_data = get_transient(EE_Session::session_id_prefix.$this->_sid);
412
+		if ($session_data) {
413
+			if (apply_filters('FHEE__EE_Session___perform_session_id_hash_check', WP_DEBUG)) {
414
+				$hash_check = get_transient(EE_Session::hash_check_prefix.$this->_sid);
415
+				if ($hash_check && $hash_check !== md5($session_data)) {
416 416
 					EE_Error::add_error(
417 417
 						sprintf(
418
-							__( 'The stored data for session %1$s failed to pass a hash check and therefore appears to be invalid.', 'event_espresso' ),
419
-							EE_Session::session_id_prefix . $this->_sid
418
+							__('The stored data for session %1$s failed to pass a hash check and therefore appears to be invalid.', 'event_espresso'),
419
+							EE_Session::session_id_prefix.$this->_sid
420 420
 						),
421 421
 						__FILE__, __FUNCTION__, __LINE__
422 422
 					);
423 423
 				}
424 424
 			}
425 425
 			// un-encrypt the data
426
-			$session_data = $this->_use_encryption ? $this->encryption->decrypt( $session_data ) : $session_data;
426
+			$session_data = $this->_use_encryption ? $this->encryption->decrypt($session_data) : $session_data;
427 427
 			// unserialize
428
-			$session_data = maybe_unserialize( $session_data );
428
+			$session_data = maybe_unserialize($session_data);
429 429
 			// just a check to make sure the session array is indeed an array
430
-			if ( ! is_array( $session_data ) ) {
430
+			if ( ! is_array($session_data)) {
431 431
 				// no?!?! then something is wrong
432 432
 				return FALSE;
433 433
 			}
434 434
 			// get the current time in UTC
435
-			$this->_time = isset( $this->_time ) ? $this->_time : time();
435
+			$this->_time = isset($this->_time) ? $this->_time : time();
436 436
 			// and reset the session expiration
437
-			$this->_expiration = isset( $session_data['expiration'] ) ? $session_data['expiration'] : $this->_time + $this->_lifespan;
437
+			$this->_expiration = isset($session_data['expiration']) ? $session_data['expiration'] : $this->_time + $this->_lifespan;
438 438
 
439 439
 		} else {
440 440
 			// set initial site access time and the session expiration
441 441
 			$this->_set_init_access_and_expiration();
442 442
 			// set referer
443
-			$this->_session_data[ 'pages_visited' ][ $this->_session_data['init_access'] ] = isset( $_SERVER['HTTP_REFERER'] ) ? esc_attr( $_SERVER['HTTP_REFERER'] ) : '';
443
+			$this->_session_data['pages_visited'][$this->_session_data['init_access']] = isset($_SERVER['HTTP_REFERER']) ? esc_attr($_SERVER['HTTP_REFERER']) : '';
444 444
 			// no previous session = go back and create one (on top of the data above)
445 445
 			return FALSE;
446 446
 		}
@@ -448,21 +448,21 @@  discard block
 block discarded – undo
448 448
 		// have we met before???
449 449
 		// let's compare our stored session details with the current visitor
450 450
 		// first the ip address
451
-		if ( $session_data['ip_address'] != $this->_ip_address ) {
451
+		if ($session_data['ip_address'] != $this->_ip_address) {
452 452
 			return FALSE;
453 453
 		}
454 454
 		// now the user agent
455
-		if ( $session_data['user_agent'] != $this->_user_agent ) {
455
+		if ($session_data['user_agent'] != $this->_user_agent) {
456 456
 			return FALSE;
457 457
 		}
458 458
 		// wait a minute... how old are you?
459
-		if ( $this->_time > $this->_expiration ) {
459
+		if ($this->_time > $this->_expiration) {
460 460
 			// yer too old fer me!
461 461
 			// wipe out everything that isn't a default session datum
462
-			$this->clear_session( __CLASS__, __FUNCTION__ );
462
+			$this->clear_session(__CLASS__, __FUNCTION__);
463 463
 		}
464 464
 		// make event espresso session data available to plugin
465
-		$this->_session_data = array_merge( $this->_session_data, $session_data );
465
+		$this->_session_data = array_merge($this->_session_data, $session_data);
466 466
 		return TRUE;
467 467
 
468 468
 	}
@@ -480,24 +480,24 @@  discard block
 block discarded – undo
480 480
 	  */
481 481
 	protected function _generate_session_id() {
482 482
 		// was session id salt already saved to db ?
483
-		if ( empty( $this->_sid_salt ) ) {
483
+		if (empty($this->_sid_salt)) {
484 484
 			// no?  then maybe use WP defined constant
485
-			if ( defined( 'AUTH_SALT' ) ) {
485
+			if (defined('AUTH_SALT')) {
486 486
 				$this->_sid_salt = AUTH_SALT;
487 487
 			}
488 488
 			// if salt doesn't exist or is too short
489
-			if ( empty( $this->_sid_salt ) || strlen( $this->_sid_salt ) < 32 ) {
489
+			if (empty($this->_sid_salt) || strlen($this->_sid_salt) < 32) {
490 490
 				// create a new one
491
-				$this->_sid_salt = wp_generate_password( 64 );
491
+				$this->_sid_salt = wp_generate_password(64);
492 492
 			}
493 493
 			// and save it as a permanent session setting
494
-			$session_settings = get_option( 'ee_session_settings' );
494
+			$session_settings = get_option('ee_session_settings');
495 495
 			$session_settings['sid_salt'] = $this->_sid_salt;
496
-			update_option( 'ee_session_settings', $session_settings );
496
+			update_option('ee_session_settings', $session_settings);
497 497
 		}
498 498
 		// check if the SID was passed explicitly, otherwise get from session, then add salt and hash it to reduce length
499
-		$session_id = isset( $_REQUEST[ 'EESID' ] ) ? sanitize_text_field( $_REQUEST[ 'EESID' ] ) : md5( session_id() . $this->_sid_salt );
500
-		return apply_filters( 'FHEE__EE_Session___generate_session_id__session_id', $session_id );
499
+		$session_id = isset($_REQUEST['EESID']) ? sanitize_text_field($_REQUEST['EESID']) : md5(session_id().$this->_sid_salt);
500
+		return apply_filters('FHEE__EE_Session___generate_session_id__session_id', $session_id);
501 501
 	}
502 502
 
503 503
 
@@ -523,20 +523,20 @@  discard block
 block discarded – undo
523 523
 	  * @param bool $new_session
524 524
 	  * @return TRUE on success, FALSE on fail
525 525
 	  */
526
-	public function update( $new_session = FALSE ) {
527
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
528
-		$this->_session_data = isset( $this->_session_data )
529
-			&& is_array( $this->_session_data )
530
-			&& isset( $this->_session_data['id'])
526
+	public function update($new_session = FALSE) {
527
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
528
+		$this->_session_data = isset($this->_session_data)
529
+			&& is_array($this->_session_data)
530
+			&& isset($this->_session_data['id'])
531 531
 			? $this->_session_data
532 532
 			: NULL;
533
-		if ( empty( $this->_session_data )) {
533
+		if (empty($this->_session_data)) {
534 534
 			$this->_set_defaults();
535 535
 		}
536 536
 		$session_data = array();
537
-		foreach ( $this->_session_data as $key => $value ) {
537
+		foreach ($this->_session_data as $key => $value) {
538 538
 
539
-			switch( $key ) {
539
+			switch ($key) {
540 540
 
541 541
 				case 'id' :
542 542
 					// session ID
@@ -554,7 +554,7 @@  discard block
 block discarded – undo
554 554
 				break;
555 555
 
556 556
 				case 'init_access' :
557
-					$session_data['init_access'] = absint( $value );
557
+					$session_data['init_access'] = absint($value);
558 558
 				break;
559 559
 
560 560
 				case 'last_access' :
@@ -564,7 +564,7 @@  discard block
 block discarded – undo
564 564
 
565 565
 				case 'expiration' :
566 566
 					// when the session expires
567
-					$session_data['expiration'] = ! empty( $this->_expiration )
567
+					$session_data['expiration'] = ! empty($this->_expiration)
568 568
 						? $this->_expiration
569 569
 						: $session_data['init_access'] + $this->_lifespan;
570 570
 				break;
@@ -576,11 +576,11 @@  discard block
 block discarded – undo
576 576
 
577 577
 				case 'pages_visited' :
578 578
 					$page_visit = $this->_get_page_visit();
579
-					if ( $page_visit ) {
579
+					if ($page_visit) {
580 580
 						// set pages visited where the first will be the http referrer
581
-						$this->_session_data[ 'pages_visited' ][ $this->_time ] = $page_visit;
581
+						$this->_session_data['pages_visited'][$this->_time] = $page_visit;
582 582
 						// we'll only save the last 10 page visits.
583
-						$session_data[ 'pages_visited' ] = array_slice( $this->_session_data['pages_visited'], -10 );
583
+						$session_data['pages_visited'] = array_slice($this->_session_data['pages_visited'], -10);
584 584
 					}
585 585
 				break;
586 586
 
@@ -594,9 +594,9 @@  discard block
 block discarded – undo
594 594
 
595 595
 		$this->_session_data = $session_data;
596 596
 		// creating a new session does not require saving to the db just yet
597
-		if ( ! $new_session ) {
597
+		if ( ! $new_session) {
598 598
 			// ready? let's save
599
-			if ( $this->_save_session_to_db() ) {
599
+			if ($this->_save_session_to_db()) {
600 600
 				return TRUE;
601 601
 			} else {
602 602
 				return FALSE;
@@ -617,9 +617,9 @@  discard block
 block discarded – undo
617 617
 	 * 	@return bool
618 618
 	 */
619 619
 	private function _create_espresso_session( ) {
620
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
620
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
621 621
 		// use the update function for now with $new_session arg set to TRUE
622
-		return  $this->update( TRUE ) ? TRUE : FALSE;
622
+		return  $this->update(TRUE) ? TRUE : FALSE;
623 623
 	}
624 624
 
625 625
 
@@ -633,7 +633,7 @@  discard block
 block discarded – undo
633 633
 	 * 	@return string
634 634
 	 */
635 635
 	private function _save_session_to_db() {
636
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
636
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
637 637
 		if (
638 638
 			! EE_Registry::instance()->REQ instanceof EE_Request_Handler
639 639
 			|| ! (
@@ -644,15 +644,15 @@  discard block
 block discarded – undo
644 644
 			return FALSE;
645 645
 		}
646 646
 		// first serialize all of our session data
647
-		$session_data = serialize( $this->_session_data );
647
+		$session_data = serialize($this->_session_data);
648 648
 		// encrypt it if we are using encryption
649
-		$session_data = $this->_use_encryption ? $this->encryption->encrypt( $session_data ) : $session_data;
649
+		$session_data = $this->_use_encryption ? $this->encryption->encrypt($session_data) : $session_data;
650 650
 		// maybe save hash check
651
-		if ( apply_filters( 'FHEE__EE_Session___perform_session_id_hash_check', WP_DEBUG ) ) {
652
-			set_transient( EE_Session::hash_check_prefix . $this->_sid, md5( $session_data ), $this->_lifespan );
651
+		if (apply_filters('FHEE__EE_Session___perform_session_id_hash_check', WP_DEBUG)) {
652
+			set_transient(EE_Session::hash_check_prefix.$this->_sid, md5($session_data), $this->_lifespan);
653 653
 		}
654 654
 		// we're using the Transient API for storing session data, cuz it's so damn simple -> set_transient(  transient ID, data, expiry )
655
-		return set_transient( EE_Session::session_id_prefix . $this->_sid, $session_data, $this->_lifespan );
655
+		return set_transient(EE_Session::session_id_prefix.$this->_sid, $session_data, $this->_lifespan);
656 656
 	}
657 657
 
658 658
 
@@ -668,7 +668,7 @@  discard block
 block discarded – undo
668 668
 	 *	@return string
669 669
 	 */
670 670
 	private function _visitor_ip() {
671
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
671
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
672 672
 		$visitor_ip = '0.0.0.0';
673 673
 		$server_keys = array(
674 674
 			'HTTP_CLIENT_IP',
@@ -679,10 +679,10 @@  discard block
 block discarded – undo
679 679
 			'HTTP_FORWARDED',
680 680
 			'REMOTE_ADDR'
681 681
 		);
682
-		foreach ( $server_keys as $key ){
683
-			if ( isset( $_SERVER[ $key ] )) {
684
-				foreach ( array_map( 'trim', explode( ',', $_SERVER[ $key ] )) as $ip ) {
685
-					if ( $ip === '127.0.0.1' || filter_var( $ip, FILTER_VALIDATE_IP ) !== FALSE ) {
682
+		foreach ($server_keys as $key) {
683
+			if (isset($_SERVER[$key])) {
684
+				foreach (array_map('trim', explode(',', $_SERVER[$key])) as $ip) {
685
+					if ($ip === '127.0.0.1' || filter_var($ip, FILTER_VALIDATE_IP) !== FALSE) {
686 686
 						$visitor_ip = $ip;
687 687
 					}
688 688
 				}
@@ -702,47 +702,47 @@  discard block
 block discarded – undo
702 702
 	 */
703 703
 	public function _get_page_visit() {
704 704
 
705
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
705
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
706 706
 //		echo '<h3>'. __CLASS__ .'->'.__FUNCTION__.'  ( line no: ' . __LINE__ . ' )</h3>';
707
-		$page_visit = home_url('/') . 'wp-admin/admin-ajax.php';
707
+		$page_visit = home_url('/').'wp-admin/admin-ajax.php';
708 708
 
709 709
 		// check for request url
710
-		if ( isset( $_SERVER['REQUEST_URI'] )) {
710
+		if (isset($_SERVER['REQUEST_URI'])) {
711 711
 
712
-			$request_uri = esc_url( $_SERVER['REQUEST_URI'] );
712
+			$request_uri = esc_url($_SERVER['REQUEST_URI']);
713 713
 
714
-			$ru_bits = explode( '?', $request_uri );
714
+			$ru_bits = explode('?', $request_uri);
715 715
 			$request_uri = $ru_bits[0];
716 716
 			//echo '<h1>$request_uri   ' . $request_uri . '</h1>';
717 717
 
718 718
 			// check for and grab host as well
719
-			if ( isset( $_SERVER['HTTP_HOST'] )) {
720
-				$http_host = esc_url( $_SERVER['HTTP_HOST'] );
719
+			if (isset($_SERVER['HTTP_HOST'])) {
720
+				$http_host = esc_url($_SERVER['HTTP_HOST']);
721 721
 			} else {
722 722
 				$http_host = '';
723 723
 			}
724 724
 			//echo '<h1>$http_host   ' . $http_host . '</h1>';
725 725
 
726 726
 			// check for page_id in SERVER REQUEST
727
-			if ( isset( $_REQUEST['page_id'] )) {
727
+			if (isset($_REQUEST['page_id'])) {
728 728
 				// rebuild $e_reg without any of the extra parameters
729
-				$page_id = '?page_id=' . esc_attr( $_REQUEST['page_id'] ) . '&amp;';
729
+				$page_id = '?page_id='.esc_attr($_REQUEST['page_id']).'&amp;';
730 730
 			} else {
731 731
 				$page_id = '?';
732 732
 			}
733 733
 			// check for $e_reg in SERVER REQUEST
734
-			if ( isset( $_REQUEST['ee'] )) {
734
+			if (isset($_REQUEST['ee'])) {
735 735
 				// rebuild $e_reg without any of the extra parameters
736
-				$e_reg = 'ee=' . esc_attr( $_REQUEST['ee'] );
736
+				$e_reg = 'ee='.esc_attr($_REQUEST['ee']);
737 737
 			} else {
738 738
 				$e_reg = '';
739 739
 			}
740 740
 
741
-			$page_visit = rtrim( $http_host . $request_uri . $page_id . $e_reg, '?' );
741
+			$page_visit = rtrim($http_host.$request_uri.$page_id.$e_reg, '?');
742 742
 
743 743
 		}
744 744
 
745
-		return $page_visit != home_url( '/wp-admin/admin-ajax.php' ) ? $page_visit : '';
745
+		return $page_visit != home_url('/wp-admin/admin-ajax.php') ? $page_visit : '';
746 746
 
747 747
 	}
748 748
 
@@ -771,14 +771,14 @@  discard block
 block discarded – undo
771 771
 	  * @param string $function
772 772
 	  * @return void
773 773
 	  */
774
-	public function clear_session( $class = '', $function = '' ) {
774
+	public function clear_session($class = '', $function = '') {
775 775
 		//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>';
776
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, 'session cleared by : ' . $class . '::' .  $function . '()' );
776
+		do_action('AHEE_log', __FILE__, __FUNCTION__, 'session cleared by : '.$class.'::'.$function.'()');
777 777
 		$this->reset_cart();
778 778
 		$this->reset_checkout();
779 779
 		$this->reset_transaction();
780 780
 		// wipe out everything that isn't a default session datum
781
-		$this->reset_data( array_keys( $this->_session_data ));
781
+		$this->reset_data(array_keys($this->_session_data));
782 782
 		// reset initial site access time and the session expiration
783 783
 		$this->_set_init_access_and_expiration();
784 784
 		$this->_save_session_to_db();
@@ -793,42 +793,42 @@  discard block
 block discarded – undo
793 793
 	  * @param bool  $show_all_notices
794 794
 	  * @return TRUE on success, FALSE on fail
795 795
 	  */
796
-	public function reset_data( $data_to_reset = array(), $show_all_notices = FALSE ) {
796
+	public function reset_data($data_to_reset = array(), $show_all_notices = FALSE) {
797 797
 		// if $data_to_reset is not in an array, then put it in one
798
-		if ( ! is_array( $data_to_reset ) ) {
799
-			$data_to_reset = array ( $data_to_reset );
798
+		if ( ! is_array($data_to_reset)) {
799
+			$data_to_reset = array($data_to_reset);
800 800
 		}
801 801
 		// nothing ??? go home!
802
-		if ( empty( $data_to_reset )) {
803
-			EE_Error::add_error( __( 'No session data could be reset, because no session var name was provided.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
802
+		if (empty($data_to_reset)) {
803
+			EE_Error::add_error(__('No session data could be reset, because no session var name was provided.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
804 804
 			return FALSE;
805 805
 		}
806 806
 		$return_value = TRUE;
807 807
 		// since $data_to_reset is an array, cycle through the values
808
-		foreach ( $data_to_reset as $reset ) {
808
+		foreach ($data_to_reset as $reset) {
809 809
 
810 810
 			// first check to make sure it is a valid session var
811
-			if ( isset( $this->_session_data[ $reset ] )) {
811
+			if (isset($this->_session_data[$reset])) {
812 812
 				// then check to make sure it is not a default var
813
-				if ( ! array_key_exists( $reset, $this->_default_session_vars )) {
813
+				if ( ! array_key_exists($reset, $this->_default_session_vars)) {
814 814
 					// remove session var
815
-					unset( $this->_session_data[ $reset ] );
816
-					if ( $show_all_notices ) {
817
-						EE_Error::add_success( sprintf( __( 'The session variable %s was removed.', 'event_espresso' ), $reset ), __FILE__, __FUNCTION__, __LINE__ );
815
+					unset($this->_session_data[$reset]);
816
+					if ($show_all_notices) {
817
+						EE_Error::add_success(sprintf(__('The session variable %s was removed.', 'event_espresso'), $reset), __FILE__, __FUNCTION__, __LINE__);
818 818
 					}
819
-					$return_value = !isset($return_value) ? TRUE : $return_value;
819
+					$return_value = ! isset($return_value) ? TRUE : $return_value;
820 820
 
821 821
 				} else {
822 822
 					// yeeeeeeeeerrrrrrrrrrr OUT !!!!
823
-					if ( $show_all_notices ) {
824
-						EE_Error::add_error( sprintf( __( 'Sorry! %s is a default session datum and can not be reset.', 'event_espresso' ), $reset ), __FILE__, __FUNCTION__, __LINE__ );
823
+					if ($show_all_notices) {
824
+						EE_Error::add_error(sprintf(__('Sorry! %s is a default session datum and can not be reset.', 'event_espresso'), $reset), __FILE__, __FUNCTION__, __LINE__);
825 825
 					}
826 826
 					$return_value = FALSE;
827 827
 				}
828 828
 
829
-			} else if ( $show_all_notices ) {
829
+			} else if ($show_all_notices) {
830 830
 				// oops! that session var does not exist!
831
-				EE_Error::add_error( sprintf( __( 'The session item provided, %s, is invalid or does not exist.', 'event_espresso' ), $reset ), __FILE__, __FUNCTION__, __LINE__ );
831
+				EE_Error::add_error(sprintf(__('The session item provided, %s, is invalid or does not exist.', 'event_espresso'), $reset), __FILE__, __FUNCTION__, __LINE__);
832 832
 				$return_value = FALSE;
833 833
 			}
834 834
 
@@ -849,8 +849,8 @@  discard block
 block discarded – undo
849 849
 	 *   @return	 string
850 850
 	 */
851 851
 	public function wp_loaded() {
852
-		if ( isset(  EE_Registry::instance()->REQ ) && EE_Registry::instance()->REQ->is_set( 'clear_session' )) {
853
-			$this->clear_session( __CLASS__, __FUNCTION__ );
852
+		if (isset(EE_Registry::instance()->REQ) && EE_Registry::instance()->REQ->is_set('clear_session')) {
853
+			$this->clear_session(__CLASS__, __FUNCTION__);
854 854
 		}
855 855
 	}
856 856
 
@@ -875,24 +875,24 @@  discard block
 block discarded – undo
875 875
 	  */
876 876
 	 public function garbage_collection() {
877 877
 		 // only perform during regular requests
878
-		 if ( ! defined( 'DOING_AJAX') || ! DOING_AJAX ) {
878
+		 if ( ! defined('DOING_AJAX') || ! DOING_AJAX) {
879 879
 			 /** @type WPDB $wpdb */
880 880
 			 global $wpdb;
881 881
 			 // since transient expiration timestamps are set in the future, we can compare against NOW
882 882
 			 $expiration = time();
883
-			 $too_far_in_the_the_future = $expiration + ( $this->_lifespan * 2 );
883
+			 $too_far_in_the_the_future = $expiration + ($this->_lifespan * 2);
884 884
 			 // filter the query limit. Set to 0 to turn off garbage collection
885
-			 $expired_session_transient_delete_query_limit = absint( apply_filters( 'FHEE__EE_Session__garbage_collection___expired_session_transient_delete_query_limit', 50 ));
885
+			 $expired_session_transient_delete_query_limit = absint(apply_filters('FHEE__EE_Session__garbage_collection___expired_session_transient_delete_query_limit', 50));
886 886
 			 // non-zero LIMIT means take out the trash
887
-			 if ( $expired_session_transient_delete_query_limit ) {
887
+			 if ($expired_session_transient_delete_query_limit) {
888 888
 				 //array of transient keys that require garbage collection
889 889
 				 $session_keys = array(
890 890
 					 EE_Session::session_id_prefix,
891 891
 					 EE_Session::hash_check_prefix,
892 892
 				 );
893
-				 foreach ( $session_keys as $session_key ) {
894
-					 $session_key = str_replace( '_', '\_', $session_key );
895
-					 $session_key = '\_transient\_timeout\_' . $session_key . '%';
893
+				 foreach ($session_keys as $session_key) {
894
+					 $session_key = str_replace('_', '\_', $session_key);
895
+					 $session_key = '\_transient\_timeout\_'.$session_key.'%';
896 896
 					 $SQL = "
897 897
 					SELECT option_name
898 898
 					FROM {$wpdb->options}
@@ -902,28 +902,28 @@  discard block
 block discarded – undo
902 902
 					OR option_value > {$too_far_in_the_the_future} )
903 903
 					LIMIT {$expired_session_transient_delete_query_limit}
904 904
 				";
905
-					 $expired_sessions = $wpdb->get_col( $SQL );
905
+					 $expired_sessions = $wpdb->get_col($SQL);
906 906
 					 // valid results?
907
-					 if ( ! $expired_sessions instanceof WP_Error && ! empty( $expired_sessions ) ) {
907
+					 if ( ! $expired_sessions instanceof WP_Error && ! empty($expired_sessions)) {
908 908
 						 // format array of results into something usable within the actual DELETE query's IN clause
909 909
 						 $expired = array();
910
-						 foreach ( $expired_sessions as $expired_session ) {
911
-							 $expired[ ] = "'" . $expired_session . "'";
912
-							 $expired[ ] = "'" . str_replace( 'timeout_', '', $expired_session ) . "'";
910
+						 foreach ($expired_sessions as $expired_session) {
911
+							 $expired[] = "'".$expired_session."'";
912
+							 $expired[] = "'".str_replace('timeout_', '', $expired_session)."'";
913 913
 						 }
914
-						 $expired = implode( ', ', $expired );
914
+						 $expired = implode(', ', $expired);
915 915
 						 $SQL = "
916 916
 						DELETE FROM {$wpdb->options}
917 917
 						WHERE option_name
918 918
 						IN ( $expired );
919 919
 					 ";
920
-						 $results = $wpdb->query( $SQL );
920
+						 $results = $wpdb->query($SQL);
921 921
 						 // if something went wrong, then notify the admin
922
-						 if ( $results instanceof WP_Error && is_admin() ) {
923
-							 EE_Error::add_error( $results->get_error_message(), __FILE__, __FUNCTION__, __LINE__ );
922
+						 if ($results instanceof WP_Error && is_admin()) {
923
+							 EE_Error::add_error($results->get_error_message(), __FILE__, __FUNCTION__, __LINE__);
924 924
 						 }
925 925
 					 }
926
-					 do_action( 'FHEE__EE_Session__garbage_collection___end', $expired_session_transient_delete_query_limit );
926
+					 do_action('FHEE__EE_Session__garbage_collection___end', $expired_session_transient_delete_query_limit);
927 927
 				 }
928 928
 			 }
929 929
 		 }
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@  discard block
 block discarded – undo
1
-<?php if (!defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
1
+<?php if (!defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );/**
3 5
  *
4 6
  * Event Espresso
@@ -349,7 +351,7 @@  discard block
 block discarded – undo
349 351
 		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
350 352
 		 if ( ! empty( $key ))  {
351 353
 			return  isset( $this->_session_data[ $key ] ) ? $this->_session_data[ $key ] : NULL;
352
-		}  else  {
354
+		} else  {
353 355
 			return $this->_session_data;
354 356
 		}
355 357
 	}
Please login to merge, or discard this patch.
core/EE_System.core.php 4 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -613,7 +613,7 @@
 block discarded – undo
613 613
 	 * so that it will be done when migrations are finished
614 614
 	 * @param boolean $initialize_addons_too if true, we double-check addons' database tables etc too;
615 615
 	 *		however,
616
-	 * @param boolean $verify_db_schema if true will re-check the database tables have the correct schema. This is a resource-intensive job
616
+	 * @param boolean $verify_schema if true will re-check the database tables have the correct schema. This is a resource-intensive job
617 617
 	 * so we prefer to only do it when necessary
618 618
 	 * @return void
619 619
 	 */
Please login to merge, or discard this patch.
Spacing   +300 added lines, -300 removed lines patch added patch discarded remove patch
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
 	 */
90 90
 	public static function instance() {
91 91
 		// check if class object is instantiated, and instantiated properly
92
-		if ( self::$_instance === NULL  or ! is_object( self::$_instance ) or ! ( self::$_instance instanceof  EE_System )) {
92
+		if (self::$_instance === NULL or ! is_object(self::$_instance) or ! (self::$_instance instanceof  EE_System)) {
93 93
 			self::$_instance = new self();
94 94
 		}
95 95
 		return self::$_instance;
@@ -98,12 +98,12 @@  discard block
 block discarded – undo
98 98
 	 * resets the instance and returns it
99 99
 	 * @return EE_System
100 100
 	 */
101
-	public static function reset(){
101
+	public static function reset() {
102 102
 		self::$_instance->_req_type = NULL;
103 103
 		//we need to reset the migration manager in order for it to detect DMSs properly
104 104
 		EE_Data_Migration_Manager::reset();
105 105
 		//make sure none of the old hooks are left hanging around
106
-		remove_all_actions( 'AHEE__EE_System__perform_activations_upgrades_and_migrations');
106
+		remove_all_actions('AHEE__EE_System__perform_activations_upgrades_and_migrations');
107 107
 		self::instance()->detect_activations_or_upgrades();
108 108
 		self::instance()->perform_activations_upgrades_and_migrations();
109 109
 		return self::instance();
@@ -124,25 +124,25 @@  discard block
 block discarded – undo
124 124
 	 * @return \EE_System
125 125
 	 */
126 126
 	private function __construct() {
127
-		do_action( 'AHEE__EE_System__construct__begin',$this );
127
+		do_action('AHEE__EE_System__construct__begin', $this);
128 128
 		// check required WP version
129
-		if ( ! $this->_minimum_wp_version_required() ) {
130
-			unset( $_GET['activate'] );
131
-			add_action( 'admin_notices', array( $this, 'minimum_wp_version_error' ), 1 );
129
+		if ( ! $this->_minimum_wp_version_required()) {
130
+			unset($_GET['activate']);
131
+			add_action('admin_notices', array($this, 'minimum_wp_version_error'), 1);
132 132
 			return;
133 133
 		}
134 134
 		// check required PHP version
135
-		if ( ! $this->_minimum_php_version_required() ) {
136
-			unset( $_GET['activate'] );
137
-			add_action( 'admin_notices', array( $this, 'minimum_php_version_error' ), 1 );
135
+		if ( ! $this->_minimum_php_version_required()) {
136
+			unset($_GET['activate']);
137
+			add_action('admin_notices', array($this, 'minimum_php_version_error'), 1);
138 138
 			return;
139 139
 		}
140 140
 		// check recommended WP version
141
-		if ( ! $this->_minimum_wp_version_recommended() ) {
141
+		if ( ! $this->_minimum_wp_version_recommended()) {
142 142
 			$this->_display_minimum_recommended_wp_version_notice();
143 143
 		}
144 144
 		// check recommended PHP version
145
-		if ( ! $this->_minimum_php_version_recommended() ) {
145
+		if ( ! $this->_minimum_php_version_recommended()) {
146 146
 			$this->_display_minimum_recommended_php_version_notice();
147 147
 		}
148 148
 		$this->display_alpha_banner_warning();
@@ -151,35 +151,35 @@  discard block
 block discarded – undo
151 151
 		// workarounds for PHP < 5.3
152 152
 		$this->_load_class_tools();
153 153
 		// load a few helper files
154
-		EE_Registry::instance()->load_helper( 'File' );
155
-		EE_Registry::instance()->load_helper( 'Autoloader', array(), FALSE );
156
-		require_once EE_CORE . 'EE_Deprecated.core.php';
154
+		EE_Registry::instance()->load_helper('File');
155
+		EE_Registry::instance()->load_helper('Autoloader', array(), FALSE);
156
+		require_once EE_CORE.'EE_Deprecated.core.php';
157 157
 		// load interfaces
158
-		require_once EE_CORE . 'EEI_Interfaces.php';
159
-		require_once EE_LIBRARIES . 'payment_methods' . DS . 'EEI_Payment_Method_Interfaces.php';
158
+		require_once EE_CORE.'EEI_Interfaces.php';
159
+		require_once EE_LIBRARIES.'payment_methods'.DS.'EEI_Payment_Method_Interfaces.php';
160 160
 		// WP cron jobs
161
-		EE_Registry::instance()->load_core( 'Cron_Tasks' );
161
+		EE_Registry::instance()->load_core('Cron_Tasks');
162 162
 
163 163
 		// allow addons to load first so that they can register autoloaders, set hooks for running DMS's, etc
164
-		add_action( 'plugins_loaded', array( $this, 'load_espresso_addons' ), 1 );
164
+		add_action('plugins_loaded', array($this, 'load_espresso_addons'), 1);
165 165
 		// when an ee addon is activated, we want to call the core hook(s) again
166 166
 		// because the newly-activated addon didn't get a chance to run at all
167
-		add_action( 'activate_plugin', array( $this, 'load_espresso_addons' ), 1 );
167
+		add_action('activate_plugin', array($this, 'load_espresso_addons'), 1);
168 168
 		// detect whether install or upgrade
169
-		add_action( 'plugins_loaded', array( $this, 'detect_activations_or_upgrades' ), 3 );
169
+		add_action('plugins_loaded', array($this, 'detect_activations_or_upgrades'), 3);
170 170
 		// load EE_Config, EE_Textdomain, etc
171
-		add_action( 'plugins_loaded', array( $this, 'load_core_configuration' ), 5 );
171
+		add_action('plugins_loaded', array($this, 'load_core_configuration'), 5);
172 172
 		// load EE_Config, EE_Textdomain, etc
173
-		add_action( 'plugins_loaded', array( $this, 'register_shortcodes_modules_and_widgets' ), 7 );
173
+		add_action('plugins_loaded', array($this, 'register_shortcodes_modules_and_widgets'), 7);
174 174
 		// you wanna get going? I wanna get going... let's get going!
175
-		add_action( 'plugins_loaded', array( $this, 'brew_espresso' ), 9 );
175
+		add_action('plugins_loaded', array($this, 'brew_espresso'), 9);
176 176
 
177 177
 		//other housekeeping
178 178
 		//exclude EE critical pages from wp_list_pages
179
-		add_filter('wp_list_pages_excludes', array( $this, 'remove_pages_from_wp_list_pages'), 10 );
179
+		add_filter('wp_list_pages_excludes', array($this, 'remove_pages_from_wp_list_pages'), 10);
180 180
 		// ALL EE Addons should use the following hook point to attach their initial setup too
181 181
 		// it's extremely important for EE Addons to register any class autoloaders so that they can be available when the EE_Config loads
182
-		do_action( 'AHEE__EE_System__construct__complete', $this );
182
+		do_action('AHEE__EE_System__construct__complete', $this);
183 183
 	}
184 184
 
185 185
 
@@ -194,22 +194,22 @@  discard block
 block discarded – undo
194 194
 	 */
195 195
 	public function display_alpha_banner_warning() {
196 196
 		// skip AJAX requests
197
-		if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
197
+		if (defined('DOING_AJAX') && DOING_AJAX) {
198 198
 			return;
199 199
 		}
200 200
 		// skip stable releases
201
-		if ( strpos( EVENT_ESPRESSO_VERSION, '.alpha' ) === false ) {
201
+		if (strpos(EVENT_ESPRESSO_VERSION, '.alpha') === false) {
202 202
 			return;
203 203
 		}
204 204
 		// post release candidate warning
205
-		if ( is_admin() ) {
206
-			add_action( 'admin_notices', array( $this, 'alpha_banner_admin_notice' ), -999 );
205
+		if (is_admin()) {
206
+			add_action('admin_notices', array($this, 'alpha_banner_admin_notice'), -999);
207 207
 		} else {
208 208
 			// site admin has authorized use of non-stable release candidate for production
209
-			if ( defined( 'ALLOW_NON_STABLE_RELEASE_ON_LIVE_SITE' ) && ALLOW_NON_STABLE_RELEASE_ON_LIVE_SITE ) {
209
+			if (defined('ALLOW_NON_STABLE_RELEASE_ON_LIVE_SITE') && ALLOW_NON_STABLE_RELEASE_ON_LIVE_SITE) {
210 210
 				return;
211 211
 			}
212
-			add_action( 'shutdown', array( $this, 'alpha_banner_warning_notice' ), 10 );
212
+			add_action('shutdown', array($this, 'alpha_banner_warning_notice'), 10);
213 213
 		}
214 214
 	}
215 215
 
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
 	public function alpha_banner_admin_notice() {
226 226
 		EE_Error::add_attention(
227 227
 			sprintf(
228
-				__( 'This version of Event Espresso is for testing and/or evaluation purposes only. It is %1$snot%2$s considered a stable release and should therefore %1$snot%2$s be activated on a live or production website.', 'event_espresso' ),
228
+				__('This version of Event Espresso is for testing and/or evaluation purposes only. It is %1$snot%2$s considered a stable release and should therefore %1$snot%2$s be activated on a live or production website.', 'event_espresso'),
229 229
 				'<strong>',
230 230
 				'</strong>'
231 231
 			),
@@ -244,11 +244,11 @@  discard block
 block discarded – undo
244 244
 	 */
245 245
 	public function alpha_banner_warning_notice() {
246 246
 		global $pagenow;
247
-		if ( in_array( $pagenow, array( 'wp-login.php', 'wp-register.php' ) ) ) {
247
+		if (in_array($pagenow, array('wp-login.php', 'wp-register.php'))) {
248 248
 			return;
249 249
 		}
250 250
 		printf(
251
-			__( '%1$sThis version of Event Espresso is for testing and/or evaluation purposes only. It is %2$snot%3$s considered a stable release and should therefore %2$snot%3$s be activated on a live or production website.%4$s', 'event_espresso' ),
251
+			__('%1$sThis version of Event Espresso is for testing and/or evaluation purposes only. It is %2$snot%3$s considered a stable release and should therefore %2$snot%3$s be activated on a live or production website.%4$s', 'event_espresso'),
252 252
 			'<div id="ee-release-candidate-notice-dv" class="ee-really-important-notice-dv"><p>',
253 253
 			'<strong>',
254 254
 			'</strong>',
@@ -265,9 +265,9 @@  discard block
 block discarded – undo
265 265
 	 * @param string $min_version
266 266
 	 * @return boolean
267 267
 	 */
268
-	private function _check_wp_version( $min_version = EE_MIN_WP_VER_REQUIRED ) {
268
+	private function _check_wp_version($min_version = EE_MIN_WP_VER_REQUIRED) {
269 269
 		global $wp_version;
270
-		return version_compare( $wp_version, $min_version, '>=' ) ? TRUE : FALSE;
270
+		return version_compare($wp_version, $min_version, '>=') ? TRUE : FALSE;
271 271
 	}
272 272
 
273 273
 	/**
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
 	 * 	@return boolean
278 278
 	 */
279 279
 	private function _minimum_wp_version_required() {
280
-		return $this->_check_wp_version( EE_MIN_WP_VER_REQUIRED );
280
+		return $this->_check_wp_version(EE_MIN_WP_VER_REQUIRED);
281 281
 	}
282 282
 
283 283
 	/**
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
 	 * 	@return boolean
288 288
 	 */
289 289
 	private function _minimum_wp_version_recommended() {
290
-		return $this->_check_wp_version( EE_MIN_WP_VER_RECOMMENDED );
290
+		return $this->_check_wp_version(EE_MIN_WP_VER_RECOMMENDED);
291 291
 	}
292 292
 
293 293
 
@@ -299,8 +299,8 @@  discard block
 block discarded – undo
299 299
 	 * @param string $min_version
300 300
 	 * @return boolean
301 301
 	 */
302
-	private function _check_php_version( $min_version = EE_MIN_PHP_VER_RECOMMENDED ) {
303
-		return version_compare( PHP_VERSION, $min_version, '>=' ) ? TRUE : FALSE;
302
+	private function _check_php_version($min_version = EE_MIN_PHP_VER_RECOMMENDED) {
303
+		return version_compare(PHP_VERSION, $min_version, '>=') ? TRUE : FALSE;
304 304
 	}
305 305
 
306 306
 	/**
@@ -310,7 +310,7 @@  discard block
 block discarded – undo
310 310
 	 * 	@return boolean
311 311
 	 */
312 312
 	private function _minimum_php_version_required() {
313
-		return $this->_check_php_version( EE_MIN_PHP_VER_REQUIRED );
313
+		return $this->_check_php_version(EE_MIN_PHP_VER_REQUIRED);
314 314
 	}
315 315
 
316 316
 	/**
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
 	 * 	@return boolean
321 321
 	 */
322 322
 	private function _minimum_php_version_recommended() {
323
-		return $this->_check_php_version( EE_MIN_PHP_VER_RECOMMENDED );
323
+		return $this->_check_php_version(EE_MIN_PHP_VER_RECOMMENDED);
324 324
 	}
325 325
 
326 326
 
@@ -337,7 +337,7 @@  discard block
 block discarded – undo
337 337
 		<p>
338 338
 		<?php
339 339
 		printf(
340
-			__( 'We\'re sorry, but Event Espresso requires WordPress version %1$s or greater in order to operate. You are currently running version %2$s.%3$sFor information on how to update your version of WordPress, please go to %4$s.', 'event_espresso' ),
340
+			__('We\'re sorry, but Event Espresso requires WordPress version %1$s or greater in order to operate. You are currently running version %2$s.%3$sFor information on how to update your version of WordPress, please go to %4$s.', 'event_espresso'),
341 341
 			EE_MIN_WP_VER_REQUIRED,
342 342
 			$wp_version,
343 343
 			'<br/>',
@@ -347,7 +347,7 @@  discard block
 block discarded – undo
347 347
 		</p>
348 348
 		</div>
349 349
 		<?php
350
-		EE_System::deactivate_plugin( EE_PLUGIN_BASENAME );
350
+		EE_System::deactivate_plugin(EE_PLUGIN_BASENAME);
351 351
 	}
352 352
 
353 353
 
@@ -363,7 +363,7 @@  discard block
 block discarded – undo
363 363
 		<p>
364 364
 		<?php
365 365
 		printf(
366
-			__( 'We\'re sorry, but Event Espresso requires PHP version %1$s or greater in order to operate. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.', 'event_espresso' ),
366
+			__('We\'re sorry, but Event Espresso requires PHP version %1$s or greater in order to operate. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.', 'event_espresso'),
367 367
 			EE_MIN_PHP_VER_REQUIRED,
368 368
 			PHP_VERSION,
369 369
 			'<br/>',
@@ -373,7 +373,7 @@  discard block
 block discarded – undo
373 373
 		</p>
374 374
 		</div>
375 375
 		<?php
376
-		deactivate_plugins( EE_PLUGIN_BASENAME );
376
+		deactivate_plugins(EE_PLUGIN_BASENAME);
377 377
 	}
378 378
 
379 379
 
@@ -387,9 +387,9 @@  discard block
 block discarded – undo
387 387
 	private function _display_minimum_recommended_wp_version_notice() {
388 388
 		global $wp_version;
389 389
 		EE_Error::add_persistent_admin_notice(
390
-			'wp_version_' . str_replace( '.', '-', EE_MIN_WP_VER_RECOMMENDED ) . '_recommended',
390
+			'wp_version_'.str_replace('.', '-', EE_MIN_WP_VER_RECOMMENDED).'_recommended',
391 391
 			sprintf(
392
-				__( 'Event Espresso recommends WordPress version %1$s or greater in order for everything to operate properly. You are currently running version %2$s.%3$sFor information on how to update your version of WordPress, please go to %4$s.', 'event_espresso' ),
392
+				__('Event Espresso recommends WordPress version %1$s or greater in order for everything to operate properly. You are currently running version %2$s.%3$sFor information on how to update your version of WordPress, please go to %4$s.', 'event_espresso'),
393 393
 				EE_MIN_WP_VER_RECOMMENDED,
394 394
 				$wp_version,
395 395
 				'<br/>',
@@ -408,9 +408,9 @@  discard block
 block discarded – undo
408 408
 	 */
409 409
 	private function _display_minimum_recommended_php_version_notice() {
410 410
 		EE_Error::add_persistent_admin_notice(
411
-			'php_version_' . str_replace( '.', '-', EE_MIN_PHP_VER_RECOMMENDED ) . '_recommended',
411
+			'php_version_'.str_replace('.', '-', EE_MIN_PHP_VER_RECOMMENDED).'_recommended',
412 412
 			sprintf(
413
-				__( 'Event Espresso recommends PHP version %1$s or greater for optimal performance. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.', 'event_espresso' ),
413
+				__('Event Espresso recommends PHP version %1$s or greater for optimal performance. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.', 'event_espresso'),
414 414
 				EE_MIN_PHP_VER_RECOMMENDED,
415 415
 				PHP_VERSION,
416 416
 				'<br/>',
@@ -428,12 +428,12 @@  discard block
 block discarded – undo
428 428
 	 * 	@return void
429 429
 	 */
430 430
 	private function _load_registry() {
431
-		if ( is_readable( EE_CORE . 'EE_Registry.core.php' )) {
432
-			require_once( EE_CORE . 'EE_Registry.core.php' );
431
+		if (is_readable(EE_CORE.'EE_Registry.core.php')) {
432
+			require_once(EE_CORE.'EE_Registry.core.php');
433 433
 		} else {
434
-			$msg = __( 'The EE_Registry core class could not be loaded.', 'event_espresso' );
435
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
436
-			wp_die( EE_Error::get_notices() );
434
+			$msg = __('The EE_Registry core class could not be loaded.', 'event_espresso');
435
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
436
+			wp_die(EE_Error::get_notices());
437 437
 		}
438 438
 	}
439 439
 
@@ -445,11 +445,11 @@  discard block
 block discarded – undo
445 445
 	 * 	@return void
446 446
 	 */
447 447
 	private function _load_class_tools() {
448
-		if ( is_readable( EE_HELPERS . 'EEH_Class_Tools.helper.php' )) {
449
-			require_once( EE_HELPERS . 'EEH_Class_Tools.helper.php' );
448
+		if (is_readable(EE_HELPERS.'EEH_Class_Tools.helper.php')) {
449
+			require_once(EE_HELPERS.'EEH_Class_Tools.helper.php');
450 450
 		} else {
451
-			$msg = __( 'The EEH_Class_Tools helper could not be loaded.', 'event_espresso' );
452
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
451
+			$msg = __('The EEH_Class_Tools helper could not be loaded.', 'event_espresso');
452
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
453 453
 		}
454 454
 	}
455 455
 
@@ -466,10 +466,10 @@  discard block
 block discarded – undo
466 466
 	public function load_espresso_addons() {
467 467
 		// set autoloaders for all of the classes implementing EEI_Plugin_API
468 468
 		// which provide helpers for EE plugin authors to more easily register certain components with EE.
469
-		EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder( EE_LIBRARIES . 'plugin_api' );
469
+		EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder(EE_LIBRARIES.'plugin_api');
470 470
 		//load and setup EE_Capabilities
471
-		EE_Registry::instance()->load_core( 'Capabilities' );
472
-		do_action( 'AHEE__EE_System__load_espresso_addons' );
471
+		EE_Registry::instance()->load_core('Capabilities');
472
+		do_action('AHEE__EE_System__load_espresso_addons');
473 473
 	}
474 474
 
475 475
 
@@ -477,10 +477,10 @@  discard block
 block discarded – undo
477 477
 	 * Checks for activation or upgrade of core first; then also checks if any registered
478 478
 	 * addons have been activated or upgraded
479 479
 	 */
480
-	public function detect_activations_or_upgrades(){
480
+	public function detect_activations_or_upgrades() {
481 481
 		//first off: let's make sure to handle core
482 482
 		$this->detect_if_activation_or_upgrade();
483
-		foreach(EE_Registry::instance()->addons as $addon){
483
+		foreach (EE_Registry::instance()->addons as $addon) {
484 484
 			//detect teh request type for that addon
485 485
 			$addon->detect_activation_or_upgrade();
486 486
 		}
@@ -498,44 +498,44 @@  discard block
 block discarded – undo
498 498
 		do_action('AHEE__EE_System___detect_if_activation_or_upgrade__begin');
499 499
 
500 500
 		// load M-Mode class
501
-		EE_Registry::instance()->load_core( 'Maintenance_Mode' );
501
+		EE_Registry::instance()->load_core('Maintenance_Mode');
502 502
 		// check if db has been updated, or if its a brand-new installation
503 503
 
504 504
 		$espresso_db_update = $this->fix_espresso_db_upgrade_option();
505
-		$request_type =  $this->detect_req_type($espresso_db_update);
505
+		$request_type = $this->detect_req_type($espresso_db_update);
506 506
 		//EEH_Debug_Tools::printr( $request_type, '$request_type', __FILE__, __LINE__ );
507
-		if( $request_type != EE_System::req_type_normal){
507
+		if ($request_type != EE_System::req_type_normal) {
508 508
 			EE_Registry::instance()->load_helper('Activation');
509 509
 		}
510 510
 
511
-		switch($request_type){
511
+		switch ($request_type) {
512 512
 			case EE_System::req_type_new_activation:
513
-				do_action( 'AHEE__EE_System__detect_if_activation_or_upgrade__new_activation' );
514
-				$this->_handle_core_version_change( $espresso_db_update );
513
+				do_action('AHEE__EE_System__detect_if_activation_or_upgrade__new_activation');
514
+				$this->_handle_core_version_change($espresso_db_update);
515 515
 				break;
516 516
 			case EE_System::req_type_reactivation:
517
-				do_action( 'AHEE__EE_System__detect_if_activation_or_upgrade__reactivation' );
518
-				$this->_handle_core_version_change( $espresso_db_update );
517
+				do_action('AHEE__EE_System__detect_if_activation_or_upgrade__reactivation');
518
+				$this->_handle_core_version_change($espresso_db_update);
519 519
 				break;
520 520
 			case EE_System::req_type_upgrade:
521
-				do_action( 'AHEE__EE_System__detect_if_activation_or_upgrade__upgrade' );
521
+				do_action('AHEE__EE_System__detect_if_activation_or_upgrade__upgrade');
522 522
 				//migrations may be required now that we've upgraded
523 523
 				EE_Maintenance_Mode::instance()->set_maintenance_mode_if_db_old();
524
-				$this->_handle_core_version_change( $espresso_db_update );
524
+				$this->_handle_core_version_change($espresso_db_update);
525 525
 //				echo "done upgrade";die;
526 526
 				break;
527 527
 			case EE_System::req_type_downgrade:
528
-				do_action( 'AHEE__EE_System__detect_if_activation_or_upgrade__downgrade' );
528
+				do_action('AHEE__EE_System__detect_if_activation_or_upgrade__downgrade');
529 529
 				//its possible migrations are no longer required
530 530
 				EE_Maintenance_Mode::instance()->set_maintenance_mode_if_db_old();
531
-				$this->_handle_core_version_change( $espresso_db_update );
531
+				$this->_handle_core_version_change($espresso_db_update);
532 532
 				break;
533 533
 			case EE_System::req_type_normal:
534 534
 			default:
535 535
 //				$this->_maybe_redirect_to_ee_about();
536 536
 				break;
537 537
 		}
538
-		do_action( 'AHEE__EE_System__detect_if_activation_or_upgrade__complete' );
538
+		do_action('AHEE__EE_System__detect_if_activation_or_upgrade__complete');
539 539
 	}
540 540
 
541 541
 	/**
@@ -543,10 +543,10 @@  discard block
 block discarded – undo
543 543
 	 * initializing the database later during the request
544 544
 	 * @param array $espresso_db_update
545 545
 	 */
546
-	protected function _handle_core_version_change( $espresso_db_update ){
547
-		$this->update_list_of_installed_versions( $espresso_db_update );
546
+	protected function _handle_core_version_change($espresso_db_update) {
547
+		$this->update_list_of_installed_versions($espresso_db_update);
548 548
 		//get ready to verify the DB is ok (provided we aren't in maintenance mode, of course)
549
-		add_action( 'AHEE__EE_System__perform_activations_upgrades_and_migrations', array( $this, 'initialize_db_if_no_migrations_required' ));
549
+		add_action('AHEE__EE_System__perform_activations_upgrades_and_migrations', array($this, 'initialize_db_if_no_migrations_required'));
550 550
 	}
551 551
 
552 552
 
@@ -561,44 +561,44 @@  discard block
 block discarded – undo
561 561
 	 * @internal param array $espresso_db_update_value the value of the WordPress option. If not supplied, fetches it from the options table
562 562
 	 * @return array the correct value of 'espresso_db_upgrade', after saving it, if it needed correction
563 563
 	 */
564
-	private function fix_espresso_db_upgrade_option($espresso_db_update = null){
565
-		do_action( 'FHEE__EE_System__manage_fix_espresso_db_upgrade_option__begin', $espresso_db_update );
566
-		if( ! $espresso_db_update){
567
-			$espresso_db_update = get_option( 'espresso_db_update' );
564
+	private function fix_espresso_db_upgrade_option($espresso_db_update = null) {
565
+		do_action('FHEE__EE_System__manage_fix_espresso_db_upgrade_option__begin', $espresso_db_update);
566
+		if ( ! $espresso_db_update) {
567
+			$espresso_db_update = get_option('espresso_db_update');
568 568
 		}
569 569
 		// check that option is an array
570
-		if( ! is_array( $espresso_db_update )) {
570
+		if ( ! is_array($espresso_db_update)) {
571 571
 			// if option is FALSE, then it never existed
572
-			if ( $espresso_db_update === FALSE ) {
572
+			if ($espresso_db_update === FALSE) {
573 573
 				// make $espresso_db_update an array and save option with autoload OFF
574
-				$espresso_db_update =  array();
575
-				add_option( 'espresso_db_update', $espresso_db_update, '', 'no' );
574
+				$espresso_db_update = array();
575
+				add_option('espresso_db_update', $espresso_db_update, '', 'no');
576 576
 			} else {
577 577
 				// option is NOT FALSE but also is NOT an array, so make it an array and save it
578
-				$espresso_db_update =  array( $espresso_db_update=>array() );
579
-				update_option( 'espresso_db_update', $espresso_db_update );
578
+				$espresso_db_update = array($espresso_db_update=>array());
579
+				update_option('espresso_db_update', $espresso_db_update);
580 580
 			}
581
-		}else{
581
+		} else {
582 582
 			$corrected_db_update = array();
583 583
 			//if IS an array, but is it an array where KEYS are version numbers, and values are arrays?
584
-			foreach($espresso_db_update as $should_be_version_string => $should_be_array){
585
-				if(is_int($should_be_version_string) && ! is_array($should_be_array)){
584
+			foreach ($espresso_db_update as $should_be_version_string => $should_be_array) {
585
+				if (is_int($should_be_version_string) && ! is_array($should_be_array)) {
586 586
 					//the key is an int, and the value IS NOT an array
587 587
 					//so it must be numerically-indexed, where values are versions installed...
588 588
 					//fix it!
589 589
 					$version_string = $should_be_array;
590 590
 					$corrected_db_update[$version_string] = array('unknown-date');
591
-				}else{
591
+				} else {
592 592
 					//ok it checks out
593 593
 					$corrected_db_update[$should_be_version_string] = $should_be_array;
594 594
 				}
595 595
 			}
596 596
 			$espresso_db_update = $corrected_db_update;
597
-			update_option( 'espresso_db_update', $espresso_db_update );
597
+			update_option('espresso_db_update', $espresso_db_update);
598 598
 
599 599
 		}
600 600
 
601
-		do_action( 'FHEE__EE_System__manage_fix_espresso_db_upgrade_option__complete', $espresso_db_update );
601
+		do_action('FHEE__EE_System__manage_fix_espresso_db_upgrade_option__complete', $espresso_db_update);
602 602
 		return $espresso_db_update;
603 603
 	}
604 604
 
@@ -617,27 +617,27 @@  discard block
 block discarded – undo
617 617
 	 * so we prefer to only do it when necessary
618 618
 	 * @return void
619 619
 	 */
620
-	public function initialize_db_if_no_migrations_required( $initialize_addons_too = FALSE, $verify_schema = true ){
620
+	public function initialize_db_if_no_migrations_required($initialize_addons_too = FALSE, $verify_schema = true) {
621 621
 		$request_type = $this->detect_req_type();
622 622
 		//only initialize system if we're not in maintenance mode.
623
-		if( EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance ){
624
-			update_option( 'ee_flush_rewrite_rules', TRUE );
623
+		if (EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance) {
624
+			update_option('ee_flush_rewrite_rules', TRUE);
625 625
 			EEH_Activation::system_initialization();
626
-			if( $verify_schema ) {
626
+			if ($verify_schema) {
627 627
 				EEH_Activation::initialize_db_and_folders();
628 628
 			}
629 629
 			EEH_Activation::initialize_db_content();
630
-			if( $initialize_addons_too ) {
630
+			if ($initialize_addons_too) {
631 631
 				//foreach registered addon, make sure its db is up-to-date too
632
-				foreach(EE_Registry::instance()->addons as $addon){
632
+				foreach (EE_Registry::instance()->addons as $addon) {
633 633
 					$addon->initialize_db_if_no_migrations_required();
634 634
 				}
635 635
 			}
636
-		}else{
637
-			EE_Data_Migration_Manager::instance()->enqueue_db_initialization_for( 'Core' );
636
+		} else {
637
+			EE_Data_Migration_Manager::instance()->enqueue_db_initialization_for('Core');
638 638
 		}
639
-		if ( $request_type == EE_System::req_type_new_activation || $request_type == EE_System::req_type_reactivation || $request_type == EE_System::req_type_upgrade ) {
640
-			add_action( 'AHEE__EE_System__load_CPTs_and_session__start', array( $this, 'redirect_to_about_ee' ), 9 );
639
+		if ($request_type == EE_System::req_type_new_activation || $request_type == EE_System::req_type_reactivation || $request_type == EE_System::req_type_upgrade) {
640
+			add_action('AHEE__EE_System__load_CPTs_and_session__start', array($this, 'redirect_to_about_ee'), 9);
641 641
 		}
642 642
 	}
643 643
 
@@ -649,16 +649,16 @@  discard block
 block discarded – undo
649 649
 	 * @param 	string 	$current_version_to_add 	version to be added to the version history
650 650
 	 * @return 	boolean success as to whether or not this option was changed
651 651
 	 */
652
-	public function update_list_of_installed_versions($version_history = NULL,$current_version_to_add = NULL) {
653
-		if( ! $version_history ) {
652
+	public function update_list_of_installed_versions($version_history = NULL, $current_version_to_add = NULL) {
653
+		if ( ! $version_history) {
654 654
 			$version_history = $this->fix_espresso_db_upgrade_option($version_history);
655 655
 		}
656
-		if( $current_version_to_add == NULL){
656
+		if ($current_version_to_add == NULL) {
657 657
 			$current_version_to_add = espresso_version();
658 658
 		}
659
-		$version_history[ $current_version_to_add ][] = date( 'Y-m-d H:i:s',time() );
659
+		$version_history[$current_version_to_add][] = date('Y-m-d H:i:s', time());
660 660
 		// re-save
661
-		return update_option( 'espresso_db_update', $version_history );
661
+		return update_option('espresso_db_update', $version_history);
662 662
 	}
663 663
 
664 664
 
@@ -675,10 +675,10 @@  discard block
 block discarded – undo
675 675
 	 *                            but still know if this is a new install or not
676 676
 	 * @return int one of the constants on EE_System::req_type_
677 677
 	 */
678
-	public function detect_req_type( $espresso_db_update = NULL ){
679
-		if ( $this->_req_type === NULL ){
680
-			$espresso_db_update = ! empty( $espresso_db_update ) ? $espresso_db_update : $this->fix_espresso_db_upgrade_option();
681
-			$this->_req_type = $this->detect_req_type_given_activation_history( $espresso_db_update, 'ee_espresso_activation', espresso_version() );
678
+	public function detect_req_type($espresso_db_update = NULL) {
679
+		if ($this->_req_type === NULL) {
680
+			$espresso_db_update = ! empty($espresso_db_update) ? $espresso_db_update : $this->fix_espresso_db_upgrade_option();
681
+			$this->_req_type = $this->detect_req_type_given_activation_history($espresso_db_update, 'ee_espresso_activation', espresso_version());
682 682
 		}
683 683
 		return $this->_req_type;
684 684
 	}
@@ -694,39 +694,39 @@  discard block
 block discarded – undo
694 694
 	 * @param string $version_to_upgrade_to the version that was just upgraded to (for core that will be espresso_version())
695 695
 	 * @return int one of the constants on EE_System::req_type_*
696 696
 	 */
697
-	public static function detect_req_type_given_activation_history( $activation_history_for_addon, $activation_indicator_option_name, $version_to_upgrade_to ){
698
-		$version_is_higher = self::_new_version_is_higher( $activation_history_for_addon, $version_to_upgrade_to );
699
-		if( $activation_history_for_addon ){
697
+	public static function detect_req_type_given_activation_history($activation_history_for_addon, $activation_indicator_option_name, $version_to_upgrade_to) {
698
+		$version_is_higher = self::_new_version_is_higher($activation_history_for_addon, $version_to_upgrade_to);
699
+		if ($activation_history_for_addon) {
700 700
 			//it exists, so this isn't a completely new install
701 701
 			//check if this version already in that list of previously installed versions
702
-			if ( ! isset( $activation_history_for_addon[ $version_to_upgrade_to ] )) {
702
+			if ( ! isset($activation_history_for_addon[$version_to_upgrade_to])) {
703 703
 				//it a version we haven't seen before
704
-				if( $version_is_higher === 1 ){
704
+				if ($version_is_higher === 1) {
705 705
 					$req_type = EE_System::req_type_upgrade;
706
-				}else{
706
+				} else {
707 707
 					$req_type = EE_System::req_type_downgrade;
708 708
 				}
709
-				delete_option( $activation_indicator_option_name );
709
+				delete_option($activation_indicator_option_name);
710 710
 			} else {
711 711
 				// its not an update. maybe a reactivation?
712
-				if( get_option( $activation_indicator_option_name, FALSE ) ){
713
-					if ( $version_is_higher === -1 ){
712
+				if (get_option($activation_indicator_option_name, FALSE)) {
713
+					if ($version_is_higher === -1) {
714 714
 						$req_type = EE_System::req_type_downgrade;
715
-					}elseif( $version_is_higher === 0 ){
715
+					}elseif ($version_is_higher === 0) {
716 716
 						//we've seen this version before, but it's an activation. must be a reactivation
717 717
 						$req_type = EE_System::req_type_reactivation;
718
-					}else{//$version_is_higher === 1
718
+					} else {//$version_is_higher === 1
719 719
 						$req_type = EE_System::req_type_upgrade;
720 720
 					}
721
-					delete_option( $activation_indicator_option_name );
721
+					delete_option($activation_indicator_option_name);
722 722
 				} else {
723 723
 					//we've seen this version before and the activation indicate doesn't show it was just activated
724
-					if ( $version_is_higher === -1 ){
724
+					if ($version_is_higher === -1) {
725 725
 						$req_type = EE_System::req_type_downgrade;
726
-					}elseif( $version_is_higher === 0 ){
726
+					}elseif ($version_is_higher === 0) {
727 727
 						//we've seen this version before and it's not an activation. its normal request
728 728
 						$req_type = EE_System::req_type_normal;
729
-					}else{//$version_is_higher === 1
729
+					} else {//$version_is_higher === 1
730 730
 						$req_type = EE_System::req_type_upgrade;
731 731
 					}
732 732
 				}
@@ -734,7 +734,7 @@  discard block
 block discarded – undo
734 734
 		} else {
735 735
 			//brand new install
736 736
 			$req_type = EE_System::req_type_new_activation;
737
-			delete_option( $activation_indicator_option_name );
737
+			delete_option($activation_indicator_option_name);
738 738
 		}
739 739
 		return $req_type;
740 740
 	}
@@ -752,30 +752,30 @@  discard block
 block discarded – undo
752 752
 	 *		0 if $version_to_upgrade_to MATCHES (reactivation or normal request);
753 753
 	 *		1 if $version_to_upgrade_to is HIGHER (upgrade) ;
754 754
 	 */
755
-	protected static function _new_version_is_higher( $activation_history_for_addon, $version_to_upgrade_to ){
755
+	protected static function _new_version_is_higher($activation_history_for_addon, $version_to_upgrade_to) {
756 756
 		//find the most recently-activated version
757 757
 		$most_recently_active_version_activation = '1970-01-01 00:00:00';
758 758
 		$most_recently_active_version = '0.0.0.dev.000';
759
-		if( is_array( $activation_history_for_addon ) ){
760
-			foreach( $activation_history_for_addon as $version => $times_activated ){
759
+		if (is_array($activation_history_for_addon)) {
760
+			foreach ($activation_history_for_addon as $version => $times_activated) {
761 761
 				//check there is a record of when this version was activated. Otherwise,
762 762
 				//mark it as unknown
763
-				if( ! $times_activated ){
764
-					$times_activated = array( 'unknown-date');
763
+				if ( ! $times_activated) {
764
+					$times_activated = array('unknown-date');
765 765
 				}
766
-				if( is_string( $times_activated ) ){
767
-					$times_activated = array( $times_activated );
766
+				if (is_string($times_activated)) {
767
+					$times_activated = array($times_activated);
768 768
 				}
769
-				foreach( $times_activated as $an_activation ){
770
-					if( $an_activation != 'unknown-date' &&
771
-							$an_activation > $most_recently_active_version_activation  ){
769
+				foreach ($times_activated as $an_activation) {
770
+					if ($an_activation != 'unknown-date' &&
771
+							$an_activation > $most_recently_active_version_activation) {
772 772
 						$most_recently_active_version = $version;
773 773
 						$most_recently_active_version_activation = $an_activation == 'unknown-date' ? '1970-01-01 00:00:00' : $an_activation;
774 774
 					}
775 775
 				}
776 776
 			}
777 777
 		}
778
-		return version_compare( $version_to_upgrade_to, $most_recently_active_version );
778
+		return version_compare($version_to_upgrade_to, $most_recently_active_version);
779 779
 	}
780 780
 
781 781
 
@@ -785,20 +785,20 @@  discard block
 block discarded – undo
785 785
 	 * @return void
786 786
 	 */
787 787
 	public function redirect_to_about_ee() {
788
-		$notices = EE_Error::get_notices( FALSE );
788
+		$notices = EE_Error::get_notices(FALSE);
789 789
 		//if current user is an admin and it's not an ajax request
790
-		if(EE_Registry::instance()->CAP->current_user_can( 'manage_options', 'espresso_about_default' ) && ! ( defined('DOING_AJAX') && DOING_AJAX  ) && ! isset( $notices[ 'errors' ] ) ){
791
-			$query_params =  array( 'page' => 'espresso_about' );
790
+		if (EE_Registry::instance()->CAP->current_user_can('manage_options', 'espresso_about_default') && ! (defined('DOING_AJAX') && DOING_AJAX) && ! isset($notices['errors'])) {
791
+			$query_params = array('page' => 'espresso_about');
792 792
 
793
-			if ( EE_System::instance()->detect_req_type() == EE_System::req_type_new_activation ) {
793
+			if (EE_System::instance()->detect_req_type() == EE_System::req_type_new_activation) {
794 794
 			    $query_params['new_activation'] = TRUE;
795 795
 			}
796 796
 
797
-			if ( EE_System::instance()->detect_req_type() == EE_System::req_type_reactivation ) {
797
+			if (EE_System::instance()->detect_req_type() == EE_System::req_type_reactivation) {
798 798
 			    $query_params['reactivation'] = TRUE;
799 799
 			}
800
-			$url = add_query_arg( $query_params, admin_url( 'admin.php' ) );
801
-			wp_safe_redirect( $url );
800
+			$url = add_query_arg($query_params, admin_url('admin.php'));
801
+			wp_safe_redirect($url);
802 802
 			exit();
803 803
 		}
804 804
 	}
@@ -809,31 +809,31 @@  discard block
 block discarded – undo
809 809
 	 *
810 810
 	 * @return void
811 811
 	 */
812
-	public function load_core_configuration(){
813
-		do_action( 'AHEE__EE_System__load_core_configuration__begin', $this );
812
+	public function load_core_configuration() {
813
+		do_action('AHEE__EE_System__load_core_configuration__begin', $this);
814 814
 		// load and setup EE_Config and EE_Network_Config
815
-		EE_Registry::instance()->load_core( 'Config' );
816
-		EE_Registry::instance()->load_core( 'Network_Config' );
815
+		EE_Registry::instance()->load_core('Config');
816
+		EE_Registry::instance()->load_core('Network_Config');
817 817
 		// setup autoloaders
818
-		EE_Registry::instance()->load_core( 'EE_Load_Textdomain' );
818
+		EE_Registry::instance()->load_core('EE_Load_Textdomain');
819 819
 		//load textdomain
820 820
 		EE_Load_Textdomain::load_textdomain();
821 821
 		// enable logging?
822
-		if ( EE_Registry::instance()->CFG->admin->use_full_logging ) {
823
-			EE_Registry::instance()->load_core( 'Log' );
822
+		if (EE_Registry::instance()->CFG->admin->use_full_logging) {
823
+			EE_Registry::instance()->load_core('Log');
824 824
 		}
825 825
 		// check for activation errors
826
-		$activation_errors = get_option( 'ee_plugin_activation_errors', FALSE );
827
-		if ( $activation_errors ) {
828
-			EE_Error::add_error( $activation_errors, __FILE__, __FUNCTION__, __LINE__ );
829
-			update_option( 'ee_plugin_activation_errors', FALSE );
826
+		$activation_errors = get_option('ee_plugin_activation_errors', FALSE);
827
+		if ($activation_errors) {
828
+			EE_Error::add_error($activation_errors, __FILE__, __FUNCTION__, __LINE__);
829
+			update_option('ee_plugin_activation_errors', FALSE);
830 830
 		}
831 831
 		// get model names
832 832
 		$this->_parse_model_names();
833 833
 
834 834
 		//load caf stuff a chance to play during the activation process too.
835 835
 		$this->_maybe_brew_regular();
836
-		do_action( 'AHEE__EE_System__load_core_configuration__complete', $this );
836
+		do_action('AHEE__EE_System__load_core_configuration__complete', $this);
837 837
 	}
838 838
 
839 839
 
@@ -842,23 +842,23 @@  discard block
 block discarded – undo
842 842
 	 *
843 843
 	 * @return void
844 844
 	 */
845
-	private function _parse_model_names(){
845
+	private function _parse_model_names() {
846 846
 		//get all the files in the EE_MODELS folder that end in .model.php
847
-		$models = glob( EE_MODELS.'*.model.php');
847
+		$models = glob(EE_MODELS.'*.model.php');
848 848
 		$model_names = array();
849 849
 		$non_abstract_db_models = array();
850
-		foreach( $models as $model ){
850
+		foreach ($models as $model) {
851 851
 			// get model classname
852
-			$classname = EEH_File::get_classname_from_filepath_with_standard_filename( $model );
853
-			$shortname = str_replace( 'EEM_', '', $classname );
852
+			$classname = EEH_File::get_classname_from_filepath_with_standard_filename($model);
853
+			$shortname = str_replace('EEM_', '', $classname);
854 854
 			$reflectionClass = new ReflectionClass($classname);
855
-			if( $reflectionClass->isSubclassOf('EEM_Base') && ! $reflectionClass->isAbstract()){
855
+			if ($reflectionClass->isSubclassOf('EEM_Base') && ! $reflectionClass->isAbstract()) {
856 856
 				$non_abstract_db_models[$shortname] = $classname;
857 857
 			}
858
-			$model_names[ $shortname ] = $classname;
858
+			$model_names[$shortname] = $classname;
859 859
 		}
860
-		EE_Registry::instance()->models = apply_filters( 'FHEE__EE_System__parse_model_names', $model_names );
861
-		EE_Registry::instance()->non_abstract_db_models = apply_filters( 'FHEE__EE_System__parse_implemented_model_names', $non_abstract_db_models );
860
+		EE_Registry::instance()->models = apply_filters('FHEE__EE_System__parse_model_names', $model_names);
861
+		EE_Registry::instance()->non_abstract_db_models = apply_filters('FHEE__EE_System__parse_implemented_model_names', $non_abstract_db_models);
862 862
 	}
863 863
 
864 864
 
@@ -868,8 +868,8 @@  discard block
 block discarded – undo
868 868
 	 * @return void
869 869
 	 */
870 870
 	private function _maybe_brew_regular() {
871
-		if (( ! defined( 'EE_DECAF' ) ||  EE_DECAF !== TRUE ) && is_readable( EE_CAFF_PATH . 'brewing_regular.php' )) {
872
-			require_once EE_CAFF_PATH . 'brewing_regular.php';
871
+		if (( ! defined('EE_DECAF') || EE_DECAF !== TRUE) && is_readable(EE_CAFF_PATH.'brewing_regular.php')) {
872
+			require_once EE_CAFF_PATH.'brewing_regular.php';
873 873
 		}
874 874
 	}
875 875
 
@@ -884,9 +884,9 @@  discard block
 block discarded – undo
884 884
 	* @return void
885 885
 	*/
886 886
 	public function register_shortcodes_modules_and_widgets() {
887
-		do_action( 'AHEE__EE_System__register_shortcodes_modules_and_widgets' );
887
+		do_action('AHEE__EE_System__register_shortcodes_modules_and_widgets');
888 888
 		// check for addons using old hookpoint
889
-		if ( has_action( 'AHEE__EE_System__register_shortcodes_modules_and_addons' )) {
889
+		if (has_action('AHEE__EE_System__register_shortcodes_modules_and_addons')) {
890 890
 			$this->_incompatible_addon_error();
891 891
 		}
892 892
 	}
@@ -900,19 +900,19 @@  discard block
 block discarded – undo
900 900
 	*/
901 901
 	private function _incompatible_addon_error() {
902 902
 		// get array of classes hooking into here
903
-		$class_names = EEH_Class_Tools::get_class_names_for_all_callbacks_on_hook( 'AHEE__EE_System__register_shortcodes_modules_and_addons' );
904
-		if ( ! empty( $class_names )) {
905
-			$msg = __( 'The following plugins, addons, or modules appear to be incompatible with this version of Event Espresso and were automatically deactivated to avoid fatal errors:', 'event_espresso' );
903
+		$class_names = EEH_Class_Tools::get_class_names_for_all_callbacks_on_hook('AHEE__EE_System__register_shortcodes_modules_and_addons');
904
+		if ( ! empty($class_names)) {
905
+			$msg = __('The following plugins, addons, or modules appear to be incompatible with this version of Event Espresso and were automatically deactivated to avoid fatal errors:', 'event_espresso');
906 906
 			$msg .= '<ul>';
907
-			foreach ( $class_names as $class_name ) {
908
-				$msg .= '<li><b>Event Espresso - ' . str_replace( array( 'EE_', 'EEM_', 'EED_', 'EES_', 'EEW_' ), '', $class_name ) . '</b></li>';
907
+			foreach ($class_names as $class_name) {
908
+				$msg .= '<li><b>Event Espresso - '.str_replace(array('EE_', 'EEM_', 'EED_', 'EES_', 'EEW_'), '', $class_name).'</b></li>';
909 909
 			}
910 910
 			$msg .= '</ul>';
911
-			$msg .= __( 'Compatibility issues can be avoided and/or resolved by keeping addons and plugins updated to the latest version.', 'event_espresso' );
911
+			$msg .= __('Compatibility issues can be avoided and/or resolved by keeping addons and plugins updated to the latest version.', 'event_espresso');
912 912
 			// save list of incompatible addons to wp-options for later use
913
-			add_option( 'ee_incompatible_addons', $class_names, '', 'no' );
914
-			if ( is_admin() ) {
915
-				EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
913
+			add_option('ee_incompatible_addons', $class_names, '', 'no');
914
+			if (is_admin()) {
915
+				EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
916 916
 			}
917 917
 		}
918 918
 	}
@@ -928,25 +928,25 @@  discard block
 block discarded – undo
928 928
 	 *
929 929
 	 * @return void
930 930
 	 */
931
-	public function brew_espresso(){
932
-		do_action( 'AHEE__EE_System__brew_espresso__begin', $this );
931
+	public function brew_espresso() {
932
+		do_action('AHEE__EE_System__brew_espresso__begin', $this);
933 933
 		// load some final core systems
934
-		add_action( 'init', array( $this, 'set_hooks_for_core' ), 1 );
935
-		add_action( 'init', array( $this, 'perform_activations_upgrades_and_migrations' ), 3 );
936
-		add_action( 'init', array( $this, 'load_CPTs_and_session' ), 5 );
937
-		add_action( 'init', array( $this, 'load_controllers' ), 7 );
938
-		add_action( 'init', array( $this, 'core_loaded_and_ready' ), 9 );
939
-		add_action( 'init', array( $this, 'initialize' ), 10 );
940
-		add_action( 'init', array( $this, 'initialize_last' ), 100 );
941
-		add_action('wp_enqueue_scripts', array( $this, 'wp_enqueue_scripts' ), 25 );
942
-		add_action( 'admin_bar_menu', array( $this, 'espresso_toolbar_items' ), 100 );
943
-
944
-		if ( is_admin() && apply_filters( 'FHEE__EE_System__brew_espresso__load_pue', TRUE )  ) {
934
+		add_action('init', array($this, 'set_hooks_for_core'), 1);
935
+		add_action('init', array($this, 'perform_activations_upgrades_and_migrations'), 3);
936
+		add_action('init', array($this, 'load_CPTs_and_session'), 5);
937
+		add_action('init', array($this, 'load_controllers'), 7);
938
+		add_action('init', array($this, 'core_loaded_and_ready'), 9);
939
+		add_action('init', array($this, 'initialize'), 10);
940
+		add_action('init', array($this, 'initialize_last'), 100);
941
+		add_action('wp_enqueue_scripts', array($this, 'wp_enqueue_scripts'), 25);
942
+		add_action('admin_bar_menu', array($this, 'espresso_toolbar_items'), 100);
943
+
944
+		if (is_admin() && apply_filters('FHEE__EE_System__brew_espresso__load_pue', TRUE)) {
945 945
 			// pew pew pew
946
-			EE_Registry::instance()->load_core( 'PUE' );
947
-			do_action( 'AHEE__EE_System__brew_espresso__after_pue_init' );
946
+			EE_Registry::instance()->load_core('PUE');
947
+			do_action('AHEE__EE_System__brew_espresso__after_pue_init');
948 948
 		}
949
-		do_action( 'AHEE__EE_System__brew_espresso__complete', $this );
949
+		do_action('AHEE__EE_System__brew_espresso__complete', $this);
950 950
 	}
951 951
 
952 952
 
@@ -960,7 +960,7 @@  discard block
 block discarded – undo
960 960
 	 */
961 961
 	public function set_hooks_for_core() {
962 962
 		$this->_deactivate_incompatible_addons();
963
-		do_action( 'AHEE__EE_System__set_hooks_for_core' );
963
+		do_action('AHEE__EE_System__set_hooks_for_core');
964 964
 	}
965 965
 
966 966
 
@@ -969,15 +969,15 @@  discard block
 block discarded – undo
969 969
 	 * Using the information gathered in EE_System::_incompatible_addon_error,
970 970
 	 * deactivates any addons considered incompatible with the current version of EE
971 971
 	 */
972
-	private function _deactivate_incompatible_addons(){
973
-		$incompatible_addons = get_option( 'ee_incompatible_addons', array() );
974
-		if ( ! empty( $incompatible_addons )) {
975
-			$active_plugins = get_option( 'active_plugins', array() );
976
-			foreach ( $active_plugins as $active_plugin ) {
977
-				foreach ( $incompatible_addons as $incompatible_addon ) {
978
-					if ( strpos( $active_plugin,  $incompatible_addon ) !== FALSE ) {
979
-						unset( $_GET['activate'] );
980
-						EE_System::deactivate_plugin( $active_plugin );
972
+	private function _deactivate_incompatible_addons() {
973
+		$incompatible_addons = get_option('ee_incompatible_addons', array());
974
+		if ( ! empty($incompatible_addons)) {
975
+			$active_plugins = get_option('active_plugins', array());
976
+			foreach ($active_plugins as $active_plugin) {
977
+				foreach ($incompatible_addons as $incompatible_addon) {
978
+					if (strpos($active_plugin, $incompatible_addon) !== FALSE) {
979
+						unset($_GET['activate']);
980
+						EE_System::deactivate_plugin($active_plugin);
981 981
 					}
982 982
 				}
983 983
 			}
@@ -994,11 +994,11 @@  discard block
 block discarded – undo
994 994
 	 * @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file
995 995
 	 * @return    void
996 996
 	 */
997
-	public static function deactivate_plugin( $plugin_basename = '' ) {
998
-		if ( ! function_exists( 'deactivate_plugins' )) {
999
-			require_once(ABSPATH . 'wp-admin/includes/plugin.php');
997
+	public static function deactivate_plugin($plugin_basename = '') {
998
+		if ( ! function_exists('deactivate_plugins')) {
999
+			require_once(ABSPATH.'wp-admin/includes/plugin.php');
1000 1000
 		}
1001
-		deactivate_plugins( $plugin_basename );
1001
+		deactivate_plugins($plugin_basename);
1002 1002
 	}
1003 1003
 
1004 1004
 
@@ -1010,7 +1010,7 @@  discard block
 block discarded – undo
1010 1010
 	 *  	@return 	void
1011 1011
 	 */
1012 1012
 	public function perform_activations_upgrades_and_migrations() {
1013
-		do_action( 'AHEE__EE_System__perform_activations_upgrades_and_migrations' );
1013
+		do_action('AHEE__EE_System__perform_activations_upgrades_and_migrations');
1014 1014
 	}
1015 1015
 
1016 1016
 
@@ -1026,11 +1026,11 @@  discard block
 block discarded – undo
1026 1026
 //		EEM_Datetime::instance()->show_next_x_db_queries();
1027 1027
 //		$ds = EEM_Datetime::instance()->get_datetimes_for_event_ordered_by_start_time($e->ID(),false);
1028 1028
 //
1029
-		do_action( 'AHEE__EE_System__load_CPTs_and_session__start' );
1029
+		do_action('AHEE__EE_System__load_CPTs_and_session__start');
1030 1030
 		// register Custom Post Types
1031
-		EE_Registry::instance()->load_core( 'Register_CPTs' );
1031
+		EE_Registry::instance()->load_core('Register_CPTs');
1032 1032
 //		EE_Registry::instance()->load_core( 'Session' );
1033
-		do_action( 'AHEE__EE_System__load_CPTs_and_session__complete' );
1033
+		do_action('AHEE__EE_System__load_CPTs_and_session__complete');
1034 1034
 	}
1035 1035
 
1036 1036
 
@@ -1045,16 +1045,16 @@  discard block
 block discarded – undo
1045 1045
 	* @return void
1046 1046
 	*/
1047 1047
 	public function load_controllers() {
1048
-		do_action( 'AHEE__EE_System__load_controllers__start' );
1048
+		do_action('AHEE__EE_System__load_controllers__start');
1049 1049
 		// let's get it started
1050
-		if ( ! is_admin() && !  EE_Maintenance_Mode::instance()->level() ) {
1051
-			do_action( 'AHEE__EE_System__load_controllers__load_front_controllers' );
1052
-			EE_Registry::instance()->load_core( 'Front_Controller' );
1053
-		} else if ( ! EE_FRONT_AJAX ) {
1054
-			do_action( 'AHEE__EE_System__load_controllers__load_admin_controllers' );
1055
-			EE_Registry::instance()->load_core( 'Admin' );
1050
+		if ( ! is_admin() && ! EE_Maintenance_Mode::instance()->level()) {
1051
+			do_action('AHEE__EE_System__load_controllers__load_front_controllers');
1052
+			EE_Registry::instance()->load_core('Front_Controller');
1053
+		} else if ( ! EE_FRONT_AJAX) {
1054
+			do_action('AHEE__EE_System__load_controllers__load_admin_controllers');
1055
+			EE_Registry::instance()->load_core('Admin');
1056 1056
 		}
1057
-		do_action( 'AHEE__EE_System__load_controllers__complete' );
1057
+		do_action('AHEE__EE_System__load_controllers__complete');
1058 1058
 	}
1059 1059
 
1060 1060
 
@@ -1068,10 +1068,10 @@  discard block
 block discarded – undo
1068 1068
 	* @return void
1069 1069
 	*/
1070 1070
 	public function core_loaded_and_ready() {
1071
-		do_action( 'AHEE__EE_System__core_loaded_and_ready' );
1072
-		do_action( 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons' );
1071
+		do_action('AHEE__EE_System__core_loaded_and_ready');
1072
+		do_action('AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons');
1073 1073
 //		add_action( 'wp_loaded', array( $this, 'set_hooks_for_shortcodes_modules_and_addons' ), 1 );
1074
-		EE_Registry::instance()->load_core( 'Session' );
1074
+		EE_Registry::instance()->load_core('Session');
1075 1075
 	}
1076 1076
 
1077 1077
 
@@ -1085,7 +1085,7 @@  discard block
 block discarded – undo
1085 1085
 	* @return void
1086 1086
 	*/
1087 1087
 	public function initialize() {
1088
-		do_action( 'AHEE__EE_System__initialize' );
1088
+		do_action('AHEE__EE_System__initialize');
1089 1089
 //		EE_Cron_Tasks::check_for_abandoned_transactions( 802 );
1090 1090
 	}
1091 1091
 
@@ -1100,7 +1100,7 @@  discard block
 block discarded – undo
1100 1100
 	* @return void
1101 1101
 	*/
1102 1102
 	public function initialize_last() {
1103
-		do_action( 'AHEE__EE_System__initialize_last' );
1103
+		do_action('AHEE__EE_System__initialize_last');
1104 1104
 	}
1105 1105
 
1106 1106
 
@@ -1132,21 +1132,21 @@  discard block
 block discarded – undo
1132 1132
 	*/
1133 1133
 	public static function do_not_cache() {
1134 1134
 		// set no cache constants
1135
-		if ( ! defined( 'DONOTCACHEPAGE' ) ) {
1136
-			define( 'DONOTCACHEPAGE', true );
1135
+		if ( ! defined('DONOTCACHEPAGE')) {
1136
+			define('DONOTCACHEPAGE', true);
1137 1137
 		}
1138
-		if ( ! defined( 'DONOTCACHCEOBJECT' ) ) {
1139
-			define( 'DONOTCACHCEOBJECT', true );
1138
+		if ( ! defined('DONOTCACHCEOBJECT')) {
1139
+			define('DONOTCACHCEOBJECT', true);
1140 1140
 		}
1141
-		if ( ! defined( 'DONOTCACHEDB' ) ) {
1142
-			define( 'DONOTCACHEDB', true );
1141
+		if ( ! defined('DONOTCACHEDB')) {
1142
+			define('DONOTCACHEDB', true);
1143 1143
 		}
1144 1144
 		// add no cache headers
1145
-		add_action( 'send_headers' , array( 'EE_System', 'nocache_headers' ), 10 );
1145
+		add_action('send_headers', array('EE_System', 'nocache_headers'), 10);
1146 1146
 		// plus a little extra for nginx
1147
-		add_filter( 'nocache_headers', array( 'EE_System', 'nocache_headers_nginx' ), 10, 1 );
1147
+		add_filter('nocache_headers', array('EE_System', 'nocache_headers_nginx'), 10, 1);
1148 1148
 		// prevent browsers from prefetching of the rel='next' link, because it may contain content that interferes with the registration process
1149
-		remove_action( 'wp_head', 'adjacent_posts_rel_link_wp_head' );
1149
+		remove_action('wp_head', 'adjacent_posts_rel_link_wp_head');
1150 1150
 	}
1151 1151
 
1152 1152
 
@@ -1158,7 +1158,7 @@  discard block
 block discarded – undo
1158 1158
 	 * @param $headers
1159 1159
 	 * @return    array
1160 1160
 	 */
1161
-	public static function nocache_headers_nginx ( $headers ) {
1161
+	public static function nocache_headers_nginx($headers) {
1162 1162
 		$headers['X-Accel-Expires'] = 0;
1163 1163
 		return $headers;
1164 1164
 	}
@@ -1184,15 +1184,15 @@  discard block
 block discarded – undo
1184 1184
 	 * @param $admin_bar
1185 1185
 	 * @return    void
1186 1186
 	 */
1187
-	public function espresso_toolbar_items( $admin_bar ) {
1187
+	public function espresso_toolbar_items($admin_bar) {
1188 1188
 
1189 1189
 		// if in full M-Mode, or its an AJAX request, or user is NOT an admin
1190
-		if ( EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance || defined( 'DOING_AJAX' ) || ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_ee', 'ee_admin_bar_menu_top_level' )) {
1190
+		if (EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance || defined('DOING_AJAX') || ! EE_Registry::instance()->CAP->current_user_can('ee_read_ee', 'ee_admin_bar_menu_top_level')) {
1191 1191
 			return;
1192 1192
 		}
1193 1193
 
1194
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
1195
-		EE_Registry::instance()->load_helper( 'URL' );
1194
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1195
+		EE_Registry::instance()->load_helper('URL');
1196 1196
 		$menu_class = 'espresso_menu_item_class';
1197 1197
 		//we don't use the constants EVENTS_ADMIN_URL or REG_ADMIN_URL
1198 1198
 		//because they're only defined in each of their respective constructors
@@ -1203,20 +1203,20 @@  discard block
 block discarded – undo
1203 1203
 		//Top Level
1204 1204
 		$admin_bar->add_menu(array(
1205 1205
 				'id' => 'espresso-toolbar',
1206
-				'title' => '<span class="ee-icon ee-icon-ee-cup-thick ee-icon-size-20"></span><span class="ab-label">' . _x('Event Espresso', 'admin bar menu group label', 'event_espresso') . '</span>',
1206
+				'title' => '<span class="ee-icon ee-icon-ee-cup-thick ee-icon-size-20"></span><span class="ab-label">'._x('Event Espresso', 'admin bar menu group label', 'event_espresso').'</span>',
1207 1207
 				'href' => $events_admin_url,
1208 1208
 				'meta' => array(
1209 1209
 						'title' => __('Event Espresso', 'event_espresso'),
1210
-						'class' => $menu_class . 'first'
1210
+						'class' => $menu_class.'first'
1211 1211
 				),
1212 1212
 		));
1213 1213
 
1214 1214
 		//Events
1215
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events' ) ) {
1215
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events')) {
1216 1216
 			$admin_bar->add_menu(array(
1217 1217
 					'id' => 'espresso-toolbar-events',
1218 1218
 					'parent' => 'espresso-toolbar',
1219
-					'title' => __( 'Events', 'event_espresso' ),
1219
+					'title' => __('Events', 'event_espresso'),
1220 1220
 					'href' => $events_admin_url,
1221 1221
 					'meta' => array(
1222 1222
 							'title' => __('Events', 'event_espresso'),
@@ -1227,13 +1227,13 @@  discard block
 block discarded – undo
1227 1227
 		}
1228 1228
 
1229 1229
 
1230
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_edit_events', 'ee_admin_bar_menu_espresso-toolbar-events-new' ) ) {
1230
+		if (EE_Registry::instance()->CAP->current_user_can('ee_edit_events', 'ee_admin_bar_menu_espresso-toolbar-events-new')) {
1231 1231
 			//Events Add New
1232 1232
 			$admin_bar->add_menu(array(
1233 1233
 					'id' => 'espresso-toolbar-events-new',
1234 1234
 					'parent' => 'espresso-toolbar-events',
1235 1235
 					'title' => __('Add New', 'event_espresso'),
1236
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'create_new' ), $events_admin_url ),
1236
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'create_new'), $events_admin_url),
1237 1237
 					'meta' => array(
1238 1238
 							'title' => __('Add New', 'event_espresso'),
1239 1239
 							'target' => '',
@@ -1243,11 +1243,11 @@  discard block
 block discarded – undo
1243 1243
 		}
1244 1244
 
1245 1245
 		//Events View
1246
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-view' ) ) {
1246
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-view')) {
1247 1247
 			$admin_bar->add_menu(array(
1248 1248
 					'id' => 'espresso-toolbar-events-view',
1249 1249
 					'parent' => 'espresso-toolbar-events',
1250
-					'title' => __( 'View', 'event_espresso' ),
1250
+					'title' => __('View', 'event_espresso'),
1251 1251
 					'href' => $events_admin_url,
1252 1252
 					'meta' => array(
1253 1253
 							'title' => __('View', 'event_espresso'),
@@ -1257,12 +1257,12 @@  discard block
 block discarded – undo
1257 1257
 			));
1258 1258
 		}
1259 1259
 
1260
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-all' ) ) {
1260
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-all')) {
1261 1261
 			//Events View All
1262 1262
 			$admin_bar->add_menu(array(
1263 1263
 					'id' => 'espresso-toolbar-events-all',
1264 1264
 					'parent' => 'espresso-toolbar-events-view',
1265
-					'title' => __( 'All', 'event_espresso' ),
1265
+					'title' => __('All', 'event_espresso'),
1266 1266
 					'href' => $events_admin_url,
1267 1267
 					'meta' => array(
1268 1268
 							'title' => __('All', 'event_espresso'),
@@ -1273,13 +1273,13 @@  discard block
 block discarded – undo
1273 1273
 		}
1274 1274
 
1275 1275
 
1276
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-today' ) ) {
1276
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-today')) {
1277 1277
 			//Events View Today
1278 1278
 			$admin_bar->add_menu(array(
1279 1279
 					'id' => 'espresso-toolbar-events-today',
1280 1280
 					'parent' => 'espresso-toolbar-events-view',
1281 1281
 					'title' => __('Today', 'event_espresso'),
1282
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today' ), $events_admin_url ),
1282
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today'), $events_admin_url),
1283 1283
 					'meta' => array(
1284 1284
 							'title' => __('Today', 'event_espresso'),
1285 1285
 							'target' => '',
@@ -1289,13 +1289,13 @@  discard block
 block discarded – undo
1289 1289
 		}
1290 1290
 
1291 1291
 
1292
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-month' ) ) {
1292
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-month')) {
1293 1293
 			//Events View This Month
1294 1294
 			$admin_bar->add_menu(array(
1295 1295
 					'id' => 'espresso-toolbar-events-month',
1296 1296
 					'parent' => 'espresso-toolbar-events-view',
1297
-					'title' => __( 'This Month', 'event_espresso'),
1298
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month' ), $events_admin_url ),
1297
+					'title' => __('This Month', 'event_espresso'),
1298
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month'), $events_admin_url),
1299 1299
 					'meta' => array(
1300 1300
 							'title' => __('This Month', 'event_espresso'),
1301 1301
 							'target' => '',
@@ -1305,11 +1305,11 @@  discard block
 block discarded – undo
1305 1305
 		}
1306 1306
 
1307 1307
 		//Registration Overview
1308
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations' ) ) {
1308
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations')) {
1309 1309
 			$admin_bar->add_menu(array(
1310 1310
 					'id' => 'espresso-toolbar-registrations',
1311 1311
 					'parent' => 'espresso-toolbar',
1312
-					'title' => __( 'Registrations', 'event_espresso' ),
1312
+					'title' => __('Registrations', 'event_espresso'),
1313 1313
 					'href' => $reg_admin_url,
1314 1314
 					'meta' => array(
1315 1315
 							'title' => __('Registrations', 'event_espresso'),
@@ -1320,12 +1320,12 @@  discard block
 block discarded – undo
1320 1320
 		}
1321 1321
 
1322 1322
 		//Registration Overview Today
1323
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today' ) ) {
1323
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today')) {
1324 1324
 			$admin_bar->add_menu(array(
1325 1325
 					'id' => 'espresso-toolbar-registrations-today',
1326 1326
 					'parent' => 'espresso-toolbar-registrations',
1327
-					'title' => __( 'Today', 'event_espresso'),
1328
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today' ), $reg_admin_url ),
1327
+					'title' => __('Today', 'event_espresso'),
1328
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today'), $reg_admin_url),
1329 1329
 					'meta' => array(
1330 1330
 							'title' => __('Today', 'event_espresso'),
1331 1331
 							'target' => '',
@@ -1335,14 +1335,14 @@  discard block
 block discarded – undo
1335 1335
 		}
1336 1336
 
1337 1337
 		//Registration Overview Today Completed
1338
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-approved' ) ) {
1338
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-approved')) {
1339 1339
 			$admin_bar->add_menu(array(
1340 1340
 					'id' => 'espresso-toolbar-registrations-today-approved',
1341 1341
 					'parent' => 'espresso-toolbar-registrations-today',
1342
-					'title' => __( 'Approved', 'event_espresso' ),
1343
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_approved ), $reg_admin_url ),
1342
+					'title' => __('Approved', 'event_espresso'),
1343
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_approved), $reg_admin_url),
1344 1344
 					'meta' => array(
1345
-							'title' => __('Approved', 'event_espresso' ),
1345
+							'title' => __('Approved', 'event_espresso'),
1346 1346
 							'target' => '',
1347 1347
 							'class' => $menu_class
1348 1348
 					),
@@ -1350,14 +1350,14 @@  discard block
 block discarded – undo
1350 1350
 		}
1351 1351
 
1352 1352
 		//Registration Overview Today Pending\
1353
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-pending' ) ) {
1353
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-pending')) {
1354 1354
 			$admin_bar->add_menu(array(
1355 1355
 					'id' => 'espresso-toolbar-registrations-today-pending',
1356 1356
 					'parent' => 'espresso-toolbar-registrations-today',
1357
-					'title' => __( 'Pending', 'event_espresso' ),
1358
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today', 'reg_status'=>EEM_Registration::status_id_pending_payment ), $reg_admin_url ),
1357
+					'title' => __('Pending', 'event_espresso'),
1358
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today', 'reg_status'=>EEM_Registration::status_id_pending_payment), $reg_admin_url),
1359 1359
 					'meta' => array(
1360
-							'title' => __('Pending Payment', 'event_espresso' ),
1360
+							'title' => __('Pending Payment', 'event_espresso'),
1361 1361
 							'target' => '',
1362 1362
 							'class' => $menu_class
1363 1363
 					),
@@ -1365,14 +1365,14 @@  discard block
 block discarded – undo
1365 1365
 		}
1366 1366
 
1367 1367
 		//Registration Overview Today Incomplete
1368
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-not-approved' ) ) {
1368
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-not-approved')) {
1369 1369
 			$admin_bar->add_menu(array(
1370 1370
 					'id' => 'espresso-toolbar-registrations-today-not-approved',
1371 1371
 					'parent' => 'espresso-toolbar-registrations-today',
1372
-					'title' => __( 'Not Approved', 'event_espresso' ),
1373
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_not_approved ), $reg_admin_url ),
1372
+					'title' => __('Not Approved', 'event_espresso'),
1373
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_not_approved), $reg_admin_url),
1374 1374
 					'meta' => array(
1375
-							'title' => __('Not Approved', 'event_espresso' ),
1375
+							'title' => __('Not Approved', 'event_espresso'),
1376 1376
 							'target' => '',
1377 1377
 							'class' => $menu_class
1378 1378
 					),
@@ -1380,12 +1380,12 @@  discard block
 block discarded – undo
1380 1380
 		}
1381 1381
 
1382 1382
 		//Registration Overview Today Incomplete
1383
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-cancelled' ) ) {
1383
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-cancelled')) {
1384 1384
 			$admin_bar->add_menu(array(
1385 1385
 					'id' => 'espresso-toolbar-registrations-today-cancelled',
1386 1386
 					'parent' => 'espresso-toolbar-registrations-today',
1387
-					'title' => __( 'Cancelled', 'event_espresso'),
1388
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_cancelled ), $reg_admin_url ),
1387
+					'title' => __('Cancelled', 'event_espresso'),
1388
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_cancelled), $reg_admin_url),
1389 1389
 					'meta' => array(
1390 1390
 							'title' => __('Cancelled', 'event_espresso'),
1391 1391
 							'target' => '',
@@ -1395,12 +1395,12 @@  discard block
 block discarded – undo
1395 1395
 		}
1396 1396
 
1397 1397
 		//Registration Overview This Month
1398
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month' ) ) {
1398
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month')) {
1399 1399
 			$admin_bar->add_menu(array(
1400 1400
 					'id' => 'espresso-toolbar-registrations-month',
1401 1401
 					'parent' => 'espresso-toolbar-registrations',
1402
-					'title' => __( 'This Month', 'event_espresso' ),
1403
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month' ), $reg_admin_url ),
1402
+					'title' => __('This Month', 'event_espresso'),
1403
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month'), $reg_admin_url),
1404 1404
 					'meta' => array(
1405 1405
 							'title' => __('This Month', 'event_espresso'),
1406 1406
 							'target' => '',
@@ -1410,12 +1410,12 @@  discard block
 block discarded – undo
1410 1410
 		}
1411 1411
 
1412 1412
 		//Registration Overview This Month Approved
1413
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-approved' ) ) {
1413
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-approved')) {
1414 1414
 			$admin_bar->add_menu(array(
1415 1415
 					'id' => 'espresso-toolbar-registrations-month-approved',
1416 1416
 					'parent' => 'espresso-toolbar-registrations-month',
1417
-					'title' => __( 'Approved', 'event_espresso' ),
1418
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_approved ), $reg_admin_url ),
1417
+					'title' => __('Approved', 'event_espresso'),
1418
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_approved), $reg_admin_url),
1419 1419
 					'meta' => array(
1420 1420
 							'title' => __('Approved', 'event_espresso'),
1421 1421
 							'target' => '',
@@ -1425,12 +1425,12 @@  discard block
 block discarded – undo
1425 1425
 		}
1426 1426
 
1427 1427
 		//Registration Overview This Month Pending
1428
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-pending' ) ) {
1428
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-pending')) {
1429 1429
 			$admin_bar->add_menu(array(
1430 1430
 					'id' => 'espresso-toolbar-registrations-month-pending',
1431 1431
 					'parent' => 'espresso-toolbar-registrations-month',
1432
-					'title' => __( 'Pending', 'event_espresso'),
1433
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_pending_payment ), $reg_admin_url ),
1432
+					'title' => __('Pending', 'event_espresso'),
1433
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_pending_payment), $reg_admin_url),
1434 1434
 					'meta' => array(
1435 1435
 							'title' => __('Pending', 'event_espresso'),
1436 1436
 							'target' => '',
@@ -1440,14 +1440,14 @@  discard block
 block discarded – undo
1440 1440
 		}
1441 1441
 
1442 1442
 		//Registration Overview This Month Not Approved
1443
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-not-approved' ) ) {
1443
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-not-approved')) {
1444 1444
 			$admin_bar->add_menu(array(
1445 1445
 					'id' => 'espresso-toolbar-registrations-month-not-approved',
1446 1446
 					'parent' => 'espresso-toolbar-registrations-month',
1447
-					'title' => __( 'Not Approved', 'event_espresso'),
1448
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_not_approved ), $reg_admin_url ),
1447
+					'title' => __('Not Approved', 'event_espresso'),
1448
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_not_approved), $reg_admin_url),
1449 1449
 					'meta' => array(
1450
-							'title' => __('Not Approved', 'event_espresso' ),
1450
+							'title' => __('Not Approved', 'event_espresso'),
1451 1451
 							'target' => '',
1452 1452
 							'class' => $menu_class
1453 1453
 					),
@@ -1456,12 +1456,12 @@  discard block
 block discarded – undo
1456 1456
 
1457 1457
 
1458 1458
 		//Registration Overview This Month Cancelled
1459
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-cancelled' ) ) {
1459
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-cancelled')) {
1460 1460
 			$admin_bar->add_menu(array(
1461 1461
 					'id' => 'espresso-toolbar-registrations-month-cancelled',
1462 1462
 					'parent' => 'espresso-toolbar-registrations-month',
1463 1463
 					'title' => __('Cancelled', 'event_espresso'),
1464
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_cancelled ), $reg_admin_url ),
1464
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_cancelled), $reg_admin_url),
1465 1465
 					'meta' => array(
1466 1466
 							'title' => __('Cancelled', 'event_espresso'),
1467 1467
 							'target' => '',
@@ -1482,8 +1482,8 @@  discard block
 block discarded – undo
1482 1482
 	 * @param  array  $exclude_array any existing pages being excluded are in this array.
1483 1483
 	 * @return array
1484 1484
 	 */
1485
-	public function remove_pages_from_wp_list_pages( $exclude_array ) {
1486
-		return  array_merge( $exclude_array, EE_Registry::instance()->CFG->core->get_critical_pages_array() );
1485
+	public function remove_pages_from_wp_list_pages($exclude_array) {
1486
+		return  array_merge($exclude_array, EE_Registry::instance()->CFG->core->get_critical_pages_array());
1487 1487
 	}
1488 1488
 
1489 1489
 
@@ -1503,11 +1503,11 @@  discard block
 block discarded – undo
1503 1503
 	 */
1504 1504
 	public function wp_enqueue_scripts() {
1505 1505
 		// unlike other systems, EE_System_scripts loading is turned ON by default, but prior to the init hook, can be turned off via: add_filter( 'FHEE_load_EE_System_scripts', '__return_false' );
1506
-		if ( apply_filters( 'FHEE_load_EE_System_scripts', TRUE ) ) {
1506
+		if (apply_filters('FHEE_load_EE_System_scripts', TRUE)) {
1507 1507
 			// jquery_validate loading is turned OFF by default, but prior to the wp_enqueue_scripts hook, can be turned back on again via:  add_filter( 'FHEE_load_jquery_validate', '__return_true' );
1508
-			if ( apply_filters( 'FHEE_load_jquery_validate', FALSE ) ) {
1508
+			if (apply_filters('FHEE_load_jquery_validate', FALSE)) {
1509 1509
 				// register jQuery Validate
1510
-				wp_register_script( 'jquery-validate', EE_GLOBAL_ASSETS_URL . 'scripts/jquery.validate.min.js', array('jquery'), '1.11.1', TRUE );
1510
+				wp_register_script('jquery-validate', EE_GLOBAL_ASSETS_URL.'scripts/jquery.validate.min.js', array('jquery'), '1.11.1', TRUE);
1511 1511
 			}
1512 1512
 		}
1513 1513
 	}
Please login to merge, or discard this patch.
Braces   +11 added lines, -9 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@  discard block
 block discarded – undo
1
-<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 /**
3 5
  * Event Espresso
4 6
  *
@@ -578,7 +580,7 @@  discard block
 block discarded – undo
578 580
 				$espresso_db_update =  array( $espresso_db_update=>array() );
579 581
 				update_option( 'espresso_db_update', $espresso_db_update );
580 582
 			}
581
-		}else{
583
+		} else{
582 584
 			$corrected_db_update = array();
583 585
 			//if IS an array, but is it an array where KEYS are version numbers, and values are arrays?
584 586
 			foreach($espresso_db_update as $should_be_version_string => $should_be_array){
@@ -588,7 +590,7 @@  discard block
 block discarded – undo
588 590
 					//fix it!
589 591
 					$version_string = $should_be_array;
590 592
 					$corrected_db_update[$version_string] = array('unknown-date');
591
-				}else{
593
+				} else{
592 594
 					//ok it checks out
593 595
 					$corrected_db_update[$should_be_version_string] = $should_be_array;
594 596
 				}
@@ -633,7 +635,7 @@  discard block
 block discarded – undo
633 635
 					$addon->initialize_db_if_no_migrations_required();
634 636
 				}
635 637
 			}
636
-		}else{
638
+		} else{
637 639
 			EE_Data_Migration_Manager::instance()->enqueue_db_initialization_for( 'Core' );
638 640
 		}
639 641
 		if ( $request_type == EE_System::req_type_new_activation || $request_type == EE_System::req_type_reactivation || $request_type == EE_System::req_type_upgrade ) {
@@ -703,7 +705,7 @@  discard block
 block discarded – undo
703 705
 				//it a version we haven't seen before
704 706
 				if( $version_is_higher === 1 ){
705 707
 					$req_type = EE_System::req_type_upgrade;
706
-				}else{
708
+				} else{
707 709
 					$req_type = EE_System::req_type_downgrade;
708 710
 				}
709 711
 				delete_option( $activation_indicator_option_name );
@@ -712,10 +714,10 @@  discard block
 block discarded – undo
712 714
 				if( get_option( $activation_indicator_option_name, FALSE ) ){
713 715
 					if ( $version_is_higher === -1 ){
714 716
 						$req_type = EE_System::req_type_downgrade;
715
-					}elseif( $version_is_higher === 0 ){
717
+					} elseif( $version_is_higher === 0 ){
716 718
 						//we've seen this version before, but it's an activation. must be a reactivation
717 719
 						$req_type = EE_System::req_type_reactivation;
718
-					}else{//$version_is_higher === 1
720
+					} else{//$version_is_higher === 1
719 721
 						$req_type = EE_System::req_type_upgrade;
720 722
 					}
721 723
 					delete_option( $activation_indicator_option_name );
@@ -723,10 +725,10 @@  discard block
 block discarded – undo
723 725
 					//we've seen this version before and the activation indicate doesn't show it was just activated
724 726
 					if ( $version_is_higher === -1 ){
725 727
 						$req_type = EE_System::req_type_downgrade;
726
-					}elseif( $version_is_higher === 0 ){
728
+					} elseif( $version_is_higher === 0 ){
727 729
 						//we've seen this version before and it's not an activation. its normal request
728 730
 						$req_type = EE_System::req_type_normal;
729
-					}else{//$version_is_higher === 1
731
+					} else{//$version_is_higher === 1
730 732
 						$req_type = EE_System::req_type_upgrade;
731 733
 					}
732 734
 				}
Please login to merge, or discard this patch.
Indentation   +73 added lines, -73 removed lines patch added patch discarded remove patch
@@ -468,13 +468,13 @@  discard block
 block discarded – undo
468 468
 
469 469
 
470 470
 	/**
471
-	* load_espresso_addons
472
-	*
473
-	* allow addons to load first so that they can set hooks for running DMS's, etc
474
-	*
475
-	* @access public
476
-	* @return void
477
-	*/
471
+	 * load_espresso_addons
472
+	 *
473
+	 * allow addons to load first so that they can set hooks for running DMS's, etc
474
+	 *
475
+	 * @access public
476
+	 * @return void
477
+	 */
478 478
 	public function load_espresso_addons() {
479 479
 		// set autoloaders for all of the classes implementing EEI_Plugin_API
480 480
 		// which provide helpers for EE plugin authors to more easily register certain components with EE.
@@ -498,14 +498,14 @@  discard block
 block discarded – undo
498 498
 		}
499 499
 	}
500 500
 	/**
501
-	* detect_if_activation_or_upgrade
502
-	*
503
-	* Takes care of detecting whether this is a brand new install or code upgrade,
504
-	* and either setting up the DB or setting up maintenance mode etc.
505
-	*
506
-	* @access private
507
-	* @return void
508
-	*/
501
+	 * detect_if_activation_or_upgrade
502
+	 *
503
+	 * Takes care of detecting whether this is a brand new install or code upgrade,
504
+	 * and either setting up the DB or setting up maintenance mode etc.
505
+	 *
506
+	 * @access private
507
+	 * @return void
508
+	 */
509 509
 	public function detect_if_activation_or_upgrade() {
510 510
 		do_action('AHEE__EE_System___detect_if_activation_or_upgrade__begin');
511 511
 
@@ -803,11 +803,11 @@  discard block
 block discarded – undo
803 803
 			$query_params =  array( 'page' => 'espresso_about' );
804 804
 
805 805
 			if ( EE_System::instance()->detect_req_type() == EE_System::req_type_new_activation ) {
806
-			    $query_params['new_activation'] = TRUE;
806
+				$query_params['new_activation'] = TRUE;
807 807
 			}
808 808
 
809 809
 			if ( EE_System::instance()->detect_req_type() == EE_System::req_type_reactivation ) {
810
-			    $query_params['reactivation'] = TRUE;
810
+				$query_params['reactivation'] = TRUE;
811 811
 			}
812 812
 			$url = add_query_arg( $query_params, admin_url( 'admin.php' ) );
813 813
 			wp_safe_redirect( $url );
@@ -888,13 +888,13 @@  discard block
 block discarded – undo
888 888
 
889 889
 
890 890
 	/**
891
-	* register_shortcodes_modules_and_widgets
892
-	*
893
-	* generate lists of shortcodes and modules, then verify paths and classes
894
-	*
895
-	* @access public
896
-	* @return void
897
-	*/
891
+	 * register_shortcodes_modules_and_widgets
892
+	 *
893
+	 * generate lists of shortcodes and modules, then verify paths and classes
894
+	 *
895
+	 * @access public
896
+	 * @return void
897
+	 */
898 898
 	public function register_shortcodes_modules_and_widgets() {
899 899
 		do_action( 'AHEE__EE_System__register_shortcodes_modules_and_widgets' );
900 900
 		// check for addons using old hookpoint
@@ -905,11 +905,11 @@  discard block
 block discarded – undo
905 905
 
906 906
 
907 907
 	/**
908
-	* _incompatible_addon_error
909
-	*
910
-	* @access public
911
-	* @return void
912
-	*/
908
+	 * _incompatible_addon_error
909
+	 *
910
+	 * @access public
911
+	 * @return void
912
+	 */
913 913
 	private function _incompatible_addon_error() {
914 914
 		// get array of classes hooking into here
915 915
 		$class_names = EEH_Class_Tools::get_class_names_for_all_callbacks_on_hook( 'AHEE__EE_System__register_shortcodes_modules_and_addons' );
@@ -1048,14 +1048,14 @@  discard block
 block discarded – undo
1048 1048
 
1049 1049
 
1050 1050
 	/**
1051
-	* load_controllers
1052
-	*
1053
-	* this is the best place to load any additional controllers that needs access to EE core.
1054
-	* it is expected that all basic core EE systems, that are not dependant on the current request are loaded at this time
1055
-	*
1056
-	* @access public
1057
-	* @return void
1058
-	*/
1051
+	 * load_controllers
1052
+	 *
1053
+	 * this is the best place to load any additional controllers that needs access to EE core.
1054
+	 * it is expected that all basic core EE systems, that are not dependant on the current request are loaded at this time
1055
+	 *
1056
+	 * @access public
1057
+	 * @return void
1058
+	 */
1059 1059
 	public function load_controllers() {
1060 1060
 		do_action( 'AHEE__EE_System__load_controllers__start' );
1061 1061
 		// let's get it started
@@ -1072,13 +1072,13 @@  discard block
 block discarded – undo
1072 1072
 
1073 1073
 
1074 1074
 	/**
1075
-	* core_loaded_and_ready
1076
-	*
1077
-	* all of the basic EE core should be loaded at this point and available regardless of M-Mode
1078
-	*
1079
-	* @access public
1080
-	* @return void
1081
-	*/
1075
+	 * core_loaded_and_ready
1076
+	 *
1077
+	 * all of the basic EE core should be loaded at this point and available regardless of M-Mode
1078
+	 *
1079
+	 * @access public
1080
+	 * @return void
1081
+	 */
1082 1082
 	public function core_loaded_and_ready() {
1083 1083
 		do_action( 'AHEE__EE_System__core_loaded_and_ready' );
1084 1084
 		do_action( 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons' );
@@ -1089,13 +1089,13 @@  discard block
 block discarded – undo
1089 1089
 
1090 1090
 
1091 1091
 	/**
1092
-	* initialize
1093
-	*
1094
-	* this is the best place to begin initializing client code
1095
-	*
1096
-	* @access public
1097
-	* @return void
1098
-	*/
1092
+	 * initialize
1093
+	 *
1094
+	 * this is the best place to begin initializing client code
1095
+	 *
1096
+	 * @access public
1097
+	 * @return void
1098
+	 */
1099 1099
 	public function initialize() {
1100 1100
 		do_action( 'AHEE__EE_System__initialize' );
1101 1101
 //		EE_Cron_Tasks::check_for_abandoned_transactions( 802 );
@@ -1104,13 +1104,13 @@  discard block
 block discarded – undo
1104 1104
 
1105 1105
 
1106 1106
 	/**
1107
-	* initialize_last
1108
-	*
1109
-	* this is run really late during the WP init hookpoint, and ensures that mostly everything else that needs to initialize has done so
1110
-	*
1111
-	* @access public
1112
-	* @return void
1113
-	*/
1107
+	 * initialize_last
1108
+	 *
1109
+	 * this is run really late during the WP init hookpoint, and ensures that mostly everything else that needs to initialize has done so
1110
+	 *
1111
+	 * @access public
1112
+	 * @return void
1113
+	 */
1114 1114
 	public function initialize_last() {
1115 1115
 		do_action( 'AHEE__EE_System__initialize_last' );
1116 1116
 	}
@@ -1119,14 +1119,14 @@  discard block
 block discarded – undo
1119 1119
 
1120 1120
 
1121 1121
 	/**
1122
-	* set_hooks_for_shortcodes_modules_and_addons
1123
-	*
1124
-	* this is the best place for other systems to set callbacks for hooking into other parts of EE
1125
-	* this happens at the very beginning of the wp_loaded hookpoint
1126
-	*
1127
-	* @access public
1128
-	* @return void
1129
-	*/
1122
+	 * set_hooks_for_shortcodes_modules_and_addons
1123
+	 *
1124
+	 * this is the best place for other systems to set callbacks for hooking into other parts of EE
1125
+	 * this happens at the very beginning of the wp_loaded hookpoint
1126
+	 *
1127
+	 * @access public
1128
+	 * @return void
1129
+	 */
1130 1130
 	public function set_hooks_for_shortcodes_modules_and_addons() {
1131 1131
 //		do_action( 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons' );
1132 1132
 	}
@@ -1135,13 +1135,13 @@  discard block
 block discarded – undo
1135 1135
 
1136 1136
 
1137 1137
 	/**
1138
-	* do_not_cache
1139
-	*
1140
-	* sets no cache headers and defines no cache constants for WP plugins
1141
-	*
1142
-	* @access public
1143
-	* @return void
1144
-	*/
1138
+	 * do_not_cache
1139
+	 *
1140
+	 * sets no cache headers and defines no cache constants for WP plugins
1141
+	 *
1142
+	 * @access public
1143
+	 * @return void
1144
+	 */
1145 1145
 	public static function do_not_cache() {
1146 1146
 		// set no cache constants
1147 1147
 		if ( ! defined( 'DONOTCACHEPAGE' ) ) {
Please login to merge, or discard this patch.
core/helpers/EEH_Activation.helper.php 3 patches
Doc Comments   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -630,6 +630,7 @@  discard block
 block discarded – undo
630 630
 	 * 	@access public
631 631
 	 * 	@static
632 632
 	 * 	@param string $table_name, without prefixed $wpdb->prefix
633
+	 * @param string $table_name
633 634
 	 * 	@return array of database column names
634 635
 	 */
635 636
 	public static function get_fields_on_table( $table_name = NULL ) {
@@ -699,7 +700,7 @@  discard block
 block discarded – undo
699 700
 	 * @access public
700 701
 	 * @static
701 702
 	 * @throws EE_Error
702
-	 * @return boolean success (whether database is setup properly or not)
703
+	 * @return false|null success (whether database is setup properly or not)
703 704
 	 */
704 705
 	public static function create_database_tables() {
705 706
 		EE_Registry::instance()->load_core( 'Data_Migration_Manager' );
Please login to merge, or discard this patch.
Braces   +17 added lines, -13 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@  discard block
 block discarded – undo
1
-<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 /**
3 5
  * Event Espresso
4 6
  *
@@ -125,15 +127,15 @@  discard block
 block discarded – undo
125 127
 		);
126 128
 		if( $which_to_include === 'all' ) {
127 129
 			//leave as-is
128
-		}elseif( $which_to_include === 'old' ) {
130
+		} elseif( $which_to_include === 'old' ) {
129 131
 			$cron_tasks = array_filter( $cron_tasks, function ( $value ) {
130 132
 				return $value === EEH_Activation::cron_task_no_longer_in_use;
131 133
 			});
132
-		}elseif( $which_to_include === 'current' ) {
134
+		} elseif( $which_to_include === 'current' ) {
133 135
 			$cron_tasks = array_filter( $cron_tasks );
134
-		}elseif( WP_DEBUG ) {
136
+		} elseif( WP_DEBUG ) {
135 137
 			throw new EE_Error( sprintf( __( 'Invalidate argument of "%1$s" passed to EEH_Activation::get_cron_tasks. Valid values are "all", "old" and "current".', 'event_espresso' ), $which_to_include ) );
136
-		}else{
138
+		} else{
137 139
 			//leave as-is
138 140
 		}
139 141
 		return $cron_tasks;
@@ -386,7 +388,7 @@  discard block
 block discarded – undo
386 388
 		$post_id = $wpdb->get_var("SELECT ID FROM {$wpdb->posts} WHERE post_content LIKE '%$shortcode_and_opening_bracket%' LIMIT 1");
387 389
 		if($post_id){
388 390
 			return get_post($post_id);
389
-		}else{
391
+		} else{
390 392
 			return NULL;
391 393
 		}
392 394
 
@@ -552,7 +554,7 @@  discard block
 block discarded – undo
552 554
 		if($drop_table_if_pre_existed && EEH_Activation::table_exists( $wp_table_name ) ){
553 555
 			if( defined( 'EE_DROP_BAD_TABLES' ) && EE_DROP_BAD_TABLES ){
554 556
 				$wpdb->query("DROP TABLE IF EXISTS $wp_table_name ");
555
-			}else{
557
+			} else{
556 558
 				//so we should be more cautious rather than just dropping tables so easily
557 559
 				EE_Error::add_persistent_admin_notice(
558 560
 						'bad_table_' . $wp_table_name . '_detected',
@@ -715,13 +717,13 @@  discard block
 block discarded – undo
715 717
 					foreach( $current_data_migration_script->get_errors() as $error ){
716 718
 						EE_Error::add_error($error, __FILE__, __FUNCTION__, __LINE__ );
717 719
 					}
718
-				}else{
720
+				} else{
719 721
 					EE_Error::add_error( __( 'There were errors creating the Event Espresso database tables and Event Espresso has been deactivated. To view the errors, please enable WP_DEBUG in your wp-config.php file.', 'event_espresso' ) );
720 722
 				}
721 723
 				return FALSE;
722 724
 			}
723 725
 			EE_Data_Migration_Manager::instance()->update_current_database_state_to();
724
-		}else{
726
+		} else{
725 727
 			EE_Error::add_error( __( 'Could not determine most up-to-date data migration script from which to pull database schema structure. So database is probably not setup properly', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__);
726 728
 			return FALSE;
727 729
 		}
@@ -1010,7 +1012,7 @@  discard block
 block discarded – undo
1010 1012
 		if( ! EEM_Payment_Method::instance()->count_active( EEM_Payment_Method::scope_cart ) ){
1011 1013
 			EE_Registry::instance()->load_lib( 'Payment_Method_Manager' );
1012 1014
 			EE_Payment_Method_Manager::instance()->activate_a_payment_method_of_type( 'Invoice' );
1013
-		}else{
1015
+		} else{
1014 1016
 			EEM_Payment_Method::instance()->verify_button_urls();
1015 1017
 		}
1016 1018
 	}
@@ -1159,7 +1161,9 @@  discard block
 block discarded – undo
1159 1161
 		//do an initial loop to determine if we need to continue
1160 1162
 		$def_ms = array();
1161 1163
 		foreach ( $default_messengers as $msgr ) {
1162
-			if ( isset($active_messengers[$msgr] ) || isset( $has_activated[$msgr] ) ) continue;
1164
+			if ( isset($active_messengers[$msgr] ) || isset( $has_activated[$msgr] ) ) {
1165
+				continue;
1166
+			}
1163 1167
 			$def_ms[] = $msgr;
1164 1168
 		}
1165 1169
 
@@ -1485,7 +1489,7 @@  discard block
 block discarded – undo
1485 1489
 				if( ! delete_option( $option_name ) ){
1486 1490
 					$undeleted_options[] = $option_name;
1487 1491
 				}
1488
-			}else{
1492
+			} else{
1489 1493
 				$option_names_to_delete_from_wildcard = $wpdb->get_col( "SELECT option_name FROM $wpdb->options WHERE option_name LIKE '%$option_name%'" );
1490 1494
 				foreach($option_names_to_delete_from_wildcard as $option_name_from_wildcard ){
1491 1495
 					if( ! delete_option( $option_name_from_wildcard ) ){
@@ -1551,7 +1555,7 @@  discard block
 block discarded – undo
1551 1555
 		$EZSQL_ERROR = $ezsql_error_cache;
1552 1556
 		if( empty( $new_error ) ){
1553 1557
 			return TRUE;
1554
-		}else{
1558
+		} else{
1555 1559
 			return FALSE;
1556 1560
 		}
1557 1561
 	}
Please login to merge, or discard this patch.
Spacing   +314 added lines, -314 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 	 * be called on plugin activation and reactivation
64 64
 	 * @return boolean success, whether the database and folders are setup properly
65 65
 	 */
66
-	public static function initialize_db_and_folders(){
66
+	public static function initialize_db_and_folders() {
67 67
 		$good_filesystem = EEH_Activation::create_upload_directories();
68 68
 		$good_db = EEH_Activation::create_database_tables();
69 69
 		return $good_filesystem && $good_db;
@@ -77,9 +77,9 @@  discard block
 block discarded – undo
77 77
 	 * upon activation of a new plugin, reactivation, and at the end
78 78
 	 * of running migration scripts
79 79
 	 */
80
-	public static function initialize_db_content(){
80
+	public static function initialize_db_content() {
81 81
 		//let's avoid doing all this logic repeatedly, especially when addons are requesting it
82
-		if( EEH_Activation::$_initialized_db_content_already_in_this_request ) {
82
+		if (EEH_Activation::$_initialized_db_content_already_in_this_request) {
83 83
 			return;
84 84
 		}
85 85
 		EEH_Activation::$_initialized_db_content_already_in_this_request = true;
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 		EEH_Activation::remove_cron_tasks();
97 97
 		EEH_Activation::create_cron_tasks();
98 98
 		//also, check for CAF default db content
99
-		do_action( 'AHEE__EEH_Activation__initialize_db_content' );
99
+		do_action('AHEE__EEH_Activation__initialize_db_content');
100 100
 		//also: EEM_Gateways::load_all_gateways() outputs a lot of success messages
101 101
 		//which users really won't care about on initial activation
102 102
 		EE_Error::overwrite_success();
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
 	 * @return array
115 115
 	 * @throws \EE_Error
116 116
 	 */
117
-	public static function get_cron_tasks( $which_to_include ) {
117
+	public static function get_cron_tasks($which_to_include) {
118 118
 		$cron_tasks = apply_filters(
119 119
 			'FHEE__EEH_Activation__get_cron_tasks',
120 120
 			array(
@@ -122,17 +122,17 @@  discard block
 block discarded – undo
122 122
 //				'AHEE__EE_Cron_Tasks__finalize_abandoned_transactions' => EEH_Activation::cron_task_no_longer_in_use, actually this is still in use
123 123
 			)
124 124
 		);
125
-		if( $which_to_include === 'all' ) {
125
+		if ($which_to_include === 'all') {
126 126
 			//leave as-is
127
-		}elseif( $which_to_include === 'old' ) {
128
-			$cron_tasks = array_filter( $cron_tasks, function ( $value ) {
127
+		}elseif ($which_to_include === 'old') {
128
+			$cron_tasks = array_filter($cron_tasks, function($value) {
129 129
 				return $value === EEH_Activation::cron_task_no_longer_in_use;
130 130
 			});
131
-		}elseif( $which_to_include === 'current' ) {
132
-			$cron_tasks = array_filter( $cron_tasks );
133
-		}elseif( WP_DEBUG ) {
134
-			throw new EE_Error( sprintf( __( 'Invalidate argument of "%1$s" passed to EEH_Activation::get_cron_tasks. Valid values are "all", "old" and "current".', 'event_espresso' ), $which_to_include ) );
135
-		}else{
131
+		}elseif ($which_to_include === 'current') {
132
+			$cron_tasks = array_filter($cron_tasks);
133
+		}elseif (WP_DEBUG) {
134
+			throw new EE_Error(sprintf(__('Invalidate argument of "%1$s" passed to EEH_Activation::get_cron_tasks. Valid values are "all", "old" and "current".', 'event_espresso'), $which_to_include));
135
+		} else {
136 136
 			//leave as-is
137 137
 		}
138 138
 		return $cron_tasks;
@@ -143,9 +143,9 @@  discard block
 block discarded – undo
143 143
 	 */
144 144
 	public static function create_cron_tasks() {
145 145
 
146
-		foreach( EEH_Activation::get_cron_tasks( 'current' ) as $hook_name => $frequency ) {
147
-			if( ! wp_next_scheduled( $hook_name ) ) {
148
-				wp_schedule_event( time(), $frequency, $hook_name );
146
+		foreach (EEH_Activation::get_cron_tasks('current') as $hook_name => $frequency) {
147
+			if ( ! wp_next_scheduled($hook_name)) {
148
+				wp_schedule_event(time(), $frequency, $hook_name);
149 149
 			}
150 150
 		}
151 151
 
@@ -155,11 +155,11 @@  discard block
 block discarded – undo
155 155
 	 * Remove the currently-existing and now-removed cron tasks.
156 156
 	 * @param boolean $remove_all whether to only remove the old ones, or remove absolutely ALL the EE ones
157 157
 	 */
158
-	public static function remove_cron_tasks( $remove_all = true ) {
158
+	public static function remove_cron_tasks($remove_all = true) {
159 159
 		$cron_tasks_to_remove = $remove_all ? 'all' : 'old';
160
-		foreach( EEH_Activation::get_cron_tasks( $cron_tasks_to_remove ) as $hook_name => $frequency ) {
161
-			while( $scheduled_time = wp_next_scheduled( $hook_name ) ) {
162
-				wp_unschedule_event( $scheduled_time, $hook_name );
160
+		foreach (EEH_Activation::get_cron_tasks($cron_tasks_to_remove) as $hook_name => $frequency) {
161
+			while ($scheduled_time = wp_next_scheduled($hook_name)) {
162
+				wp_unschedule_event($scheduled_time, $hook_name);
163 163
 			}
164 164
 		}
165 165
 	}
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
 	 */
177 177
 	public static function CPT_initialization() {
178 178
 		// register Custom Post Types
179
-		EE_Registry::instance()->load_core( 'Register_CPTs' );
179
+		EE_Registry::instance()->load_core('Register_CPTs');
180 180
 		flush_rewrite_rules();
181 181
 	}
182 182
 
@@ -192,8 +192,8 @@  discard block
 block discarded – undo
192 192
 	 */
193 193
 	public static function deactivate_event_espresso() {
194 194
 		// check permissions
195
-		if ( current_user_can( 'activate_plugins' )) {
196
-			deactivate_plugins( EE_PLUGIN_BASENAME, TRUE );
195
+		if (current_user_can('activate_plugins')) {
196
+			deactivate_plugins(EE_PLUGIN_BASENAME, TRUE);
197 197
 		}
198 198
 	}
199 199
 
@@ -215,79 +215,79 @@  discard block
 block discarded – undo
215 215
 		$critical_pages = array(
216 216
 			array(
217 217
 				'id' =>'reg_page_id',
218
-				'name' => __( 'Registration Checkout', 'event_espresso' ),
218
+				'name' => __('Registration Checkout', 'event_espresso'),
219 219
 				'post' => NULL,
220 220
 				'code' => 'ESPRESSO_CHECKOUT'
221 221
 			),
222 222
 			array(
223 223
 				'id' => 'txn_page_id',
224
-				'name' => __( 'Transactions', 'event_espresso' ),
224
+				'name' => __('Transactions', 'event_espresso'),
225 225
 				'post' => NULL,
226 226
 				'code' => 'ESPRESSO_TXN_PAGE'
227 227
 			),
228 228
 			array(
229 229
 				'id' => 'thank_you_page_id',
230
-				'name' => __( 'Thank You', 'event_espresso' ),
230
+				'name' => __('Thank You', 'event_espresso'),
231 231
 				'post' => NULL,
232 232
 				'code' => 'ESPRESSO_THANK_YOU'
233 233
 			),
234 234
 			array(
235 235
 				'id' => 'cancel_page_id',
236
-				'name' => __( 'Registration Cancelled', 'event_espresso' ),
236
+				'name' => __('Registration Cancelled', 'event_espresso'),
237 237
 				'post' => NULL,
238 238
 				'code' => 'ESPRESSO_CANCELLED'
239 239
 			),
240 240
 		);
241 241
 
242
-		foreach ( $critical_pages as $critical_page ) {
242
+		foreach ($critical_pages as $critical_page) {
243 243
 			// is critical page ID set in config ?
244
-			if ( EE_Registry::instance()->CFG->core->$critical_page['id'] !== FALSE ) {
244
+			if (EE_Registry::instance()->CFG->core->$critical_page['id'] !== FALSE) {
245 245
 				// attempt to find post by ID
246
-				$critical_page['post'] = get_post( EE_Registry::instance()->CFG->core->$critical_page['id'] );
246
+				$critical_page['post'] = get_post(EE_Registry::instance()->CFG->core->$critical_page['id']);
247 247
 			}
248 248
 			// no dice?
249
-			if ( $critical_page['post'] == NULL ) {
249
+			if ($critical_page['post'] == NULL) {
250 250
 				// attempt to find post by title
251
-				$critical_page['post'] = self::get_page_by_ee_shortcode( $critical_page['code'] );
251
+				$critical_page['post'] = self::get_page_by_ee_shortcode($critical_page['code']);
252 252
 				// still nothing?
253
-				if ( $critical_page['post'] == NULL ) {
254
-					$critical_page = EEH_Activation::create_critical_page( $critical_page );
253
+				if ($critical_page['post'] == NULL) {
254
+					$critical_page = EEH_Activation::create_critical_page($critical_page);
255 255
 					// REALLY? Still nothing ??!?!?
256
-					if ( $critical_page['post'] == NULL ) {
257
-						$msg = __( 'The Event Espresso critical page configuration settings could not be updated.', 'event_espresso' );
258
-						EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
256
+					if ($critical_page['post'] == NULL) {
257
+						$msg = __('The Event Espresso critical page configuration settings could not be updated.', 'event_espresso');
258
+						EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
259 259
 						break;
260 260
 					}
261 261
 				}
262 262
 			}
263 263
 			// track post_shortcodes
264
-			if ( $critical_page['post'] ) {
265
-				EEH_Activation::_track_critical_page_post_shortcodes( $critical_page );
264
+			if ($critical_page['post']) {
265
+				EEH_Activation::_track_critical_page_post_shortcodes($critical_page);
266 266
 			}
267 267
 			// check that Post ID matches critical page ID in config
268
-			if ( isset( $critical_page['post']->ID ) && $critical_page['post']->ID != EE_Registry::instance()->CFG->core->$critical_page['id'] ) {
268
+			if (isset($critical_page['post']->ID) && $critical_page['post']->ID != EE_Registry::instance()->CFG->core->$critical_page['id']) {
269 269
 				//update Config with post ID
270 270
 				EE_Registry::instance()->CFG->core->$critical_page['id'] = $critical_page['post']->ID;
271
-				if ( ! EE_Config::instance()->update_espresso_config( FALSE, FALSE ) ) {
272
-					$msg = __( 'The Event Espresso critical page configuration settings could not be updated.', 'event_espresso' );
273
-					EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
271
+				if ( ! EE_Config::instance()->update_espresso_config(FALSE, FALSE)) {
272
+					$msg = __('The Event Espresso critical page configuration settings could not be updated.', 'event_espresso');
273
+					EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
274 274
 				}
275 275
 			}
276 276
 
277
-			$critical_page_problem =  ! isset( $critical_page['post']->post_status ) || $critical_page['post']->post_status != 'publish' || strpos( $critical_page['post']->post_content, $critical_page['code'] ) === FALSE ? TRUE : $critical_page_problem;
277
+			$critical_page_problem = ! isset($critical_page['post']->post_status) || $critical_page['post']->post_status != 'publish' || strpos($critical_page['post']->post_content, $critical_page['code']) === FALSE ? TRUE : $critical_page_problem;
278 278
 
279 279
 		}
280 280
 
281
-		if ( $critical_page_problem ) {
281
+		if ($critical_page_problem) {
282 282
 			$msg = sprintf(
283
-				__('A potential issue has been detected with one or more of your Event Espresso pages. Go to %s to view your Event Espresso pages.', 'event_espresso' ),
284
-				'<a href="' . admin_url('admin.php?page=espresso_general_settings&action=critical_pages') . '">' . __('Event Espresso Critical Pages Settings', 'event_espresso') . '</a>'
283
+				__('A potential issue has been detected with one or more of your Event Espresso pages. Go to %s to view your Event Espresso pages.', 'event_espresso'),
284
+				'<a href="'.admin_url('admin.php?page=espresso_general_settings&action=critical_pages').'">'.__('Event Espresso Critical Pages Settings', 'event_espresso').'</a>'
285 285
 			);
286
-			EE_Error::add_persistent_admin_notice( 'critical_page_problem', $msg );
286
+			EE_Error::add_persistent_admin_notice('critical_page_problem', $msg);
287 287
 		}
288 288
 
289
-		if ( EE_Error::has_notices() ) {
290
-			EE_Error::get_notices( FALSE, TRUE, TRUE );
289
+		if (EE_Error::has_notices()) {
290
+			EE_Error::get_notices(FALSE, TRUE, TRUE);
291 291
 		}
292 292
 
293 293
 	}
@@ -300,13 +300,13 @@  discard block
 block discarded – undo
300 300
 	 * parameter to the shortcode
301 301
 	 * @return WP_Post or NULl
302 302
 	 */
303
-	public static function get_page_by_ee_shortcode($ee_shortcode){
303
+	public static function get_page_by_ee_shortcode($ee_shortcode) {
304 304
 		global $wpdb;
305 305
 		$shortcode_and_opening_bracket = '['.$ee_shortcode;
306 306
 		$post_id = $wpdb->get_var("SELECT ID FROM {$wpdb->posts} WHERE post_content LIKE '%$shortcode_and_opening_bracket%' LIMIT 1");
307
-		if($post_id){
307
+		if ($post_id) {
308 308
 			return get_post($post_id);
309
-		}else{
309
+		} else {
310 310
 			return NULL;
311 311
 		}
312 312
 
@@ -323,32 +323,32 @@  discard block
 block discarded – undo
323 323
 	 * @param array $critical_page
324 324
 	 * @return array
325 325
 	 */
326
-	public static function create_critical_page( $critical_page ) {
326
+	public static function create_critical_page($critical_page) {
327 327
 
328 328
 		$post_args = array(
329 329
 			'post_title' => $critical_page['name'],
330 330
 			'post_status' => 'publish',
331 331
 			'post_type' => 'page',
332 332
 			'comment_status' => 'closed',
333
-			'post_content' => '[' . $critical_page['code'] . ']'
333
+			'post_content' => '['.$critical_page['code'].']'
334 334
 		);
335 335
 
336
-		$post_id = wp_insert_post( $post_args );
337
-		if ( ! $post_id ) {
336
+		$post_id = wp_insert_post($post_args);
337
+		if ( ! $post_id) {
338 338
 			$msg = sprintf(
339
-				__( 'The Event Espresso  critical page entitled "%s" could not be created.', 'event_espresso' ),
339
+				__('The Event Espresso  critical page entitled "%s" could not be created.', 'event_espresso'),
340 340
 				$critical_page['name']
341 341
 			);
342
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
342
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
343 343
 			return $critical_page;
344 344
 		}
345 345
 		// get newly created post's details
346
-		if ( ! $critical_page['post'] = get_post( $post_id )) {
346
+		if ( ! $critical_page['post'] = get_post($post_id)) {
347 347
 			$msg = sprintf(
348
-				__( 'The Event Espresso critical page entitled "%s" could not be retrieved.', 'event_espresso' ),
348
+				__('The Event Espresso critical page entitled "%s" could not be retrieved.', 'event_espresso'),
349 349
 				$critical_page['name']
350 350
 			);
351
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
351
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
352 352
 		}
353 353
 
354 354
 		return $critical_page;
@@ -367,34 +367,34 @@  discard block
 block discarded – undo
367 367
 	 * @param array $critical_page
368 368
 	 * @return void
369 369
 	 */
370
-	private static function _track_critical_page_post_shortcodes( $critical_page = array() ) {
370
+	private static function _track_critical_page_post_shortcodes($critical_page = array()) {
371 371
 		// check the goods
372
-		if ( ! $critical_page['post'] instanceof WP_Post ) {
372
+		if ( ! $critical_page['post'] instanceof WP_Post) {
373 373
 			$msg = sprintf(
374
-				__( 'The Event Espresso critical page shortcode for the page %s can not be tracked because it is not a WP_Post object.', 'event_espresso' ),
374
+				__('The Event Espresso critical page shortcode for the page %s can not be tracked because it is not a WP_Post object.', 'event_espresso'),
375 375
 				$critical_page['name']
376 376
 			);
377
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
377
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
378 378
 			return;
379 379
 		}
380 380
 		// map shortcode to post
381
-		EE_Registry::instance()->CFG->core->post_shortcodes[ $critical_page['post']->post_name ][ $critical_page['code'] ] = $critical_page['post']->ID;
381
+		EE_Registry::instance()->CFG->core->post_shortcodes[$critical_page['post']->post_name][$critical_page['code']] = $critical_page['post']->ID;
382 382
 		// and make sure it's NOT added to the WP "Posts Page"
383 383
 		// name of the WP Posts Page
384 384
 		$posts_page = EE_Registry::instance()->CFG->get_page_for_posts();
385
-		if ( isset( EE_Registry::instance()->CFG->core->post_shortcodes[ $posts_page ] )) {
386
-			unset( EE_Registry::instance()->CFG->core->post_shortcodes[ $posts_page ][ $critical_page['code'] ] );
385
+		if (isset(EE_Registry::instance()->CFG->core->post_shortcodes[$posts_page])) {
386
+			unset(EE_Registry::instance()->CFG->core->post_shortcodes[$posts_page][$critical_page['code']]);
387 387
 		}
388
-		if ( $posts_page != 'posts' && isset( EE_Registry::instance()->CFG->core->post_shortcodes['posts'] )) {
389
-			unset( EE_Registry::instance()->CFG->core->post_shortcodes['posts'][ $critical_page['code'] ] );
388
+		if ($posts_page != 'posts' && isset(EE_Registry::instance()->CFG->core->post_shortcodes['posts'])) {
389
+			unset(EE_Registry::instance()->CFG->core->post_shortcodes['posts'][$critical_page['code']]);
390 390
 		}
391 391
 		// update post_shortcode CFG
392
-		if ( ! EE_Config::instance()->update_espresso_config( FALSE, FALSE )) {
392
+		if ( ! EE_Config::instance()->update_espresso_config(FALSE, FALSE)) {
393 393
 			$msg = sprintf(
394
-				__( 'The Event Espresso critical page shortcode for the %s page could not be configured properly.', 'event_espresso' ),
394
+				__('The Event Espresso critical page shortcode for the %s page could not be configured properly.', 'event_espresso'),
395 395
 				$critical_page['name']
396 396
 			);
397
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
397
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
398 398
 		}
399 399
 	}
400 400
 
@@ -412,24 +412,24 @@  discard block
 block discarded – undo
412 412
 	public static function get_default_creator_id() {
413 413
 		global $wpdb;
414 414
 
415
-		if ( ! empty( self::$_default_creator_id ) ) {
415
+		if ( ! empty(self::$_default_creator_id)) {
416 416
 			return self::$_default_creator_id;
417 417
 		}/**/
418 418
 
419
-		$role_to_check = apply_filters( 'FHEE__EEH_Activation__get_default_creator_id__role_to_check', 'administrator' );
419
+		$role_to_check = apply_filters('FHEE__EEH_Activation__get_default_creator_id__role_to_check', 'administrator');
420 420
 
421 421
 		//let's allow pre_filtering for early exits by altenative methods for getting id.  We check for truthy result and if so then exit early.
422
-		$pre_filtered_id = apply_filters( 'FHEE__EEH_Activation__get_default_creator_id__pre_filtered_id', false, $role_to_check );
423
-		if ( $pre_filtered_id !== false ) {
422
+		$pre_filtered_id = apply_filters('FHEE__EEH_Activation__get_default_creator_id__pre_filtered_id', false, $role_to_check);
423
+		if ($pre_filtered_id !== false) {
424 424
 			return (int) $pre_filtered_id;
425 425
 		}
426 426
 
427
-		$capabilities_key = $wpdb->prefix . 'capabilities';
428
-		$query = $wpdb->prepare( "SELECT user_id FROM $wpdb->usermeta WHERE meta_key = '$capabilities_key' AND meta_value LIKE %s ORDER BY user_id ASC LIMIT 0,1", '%' . $role_to_check . '%' );
429
-		$user_id = $wpdb->get_var( $query );
430
-		 $user_id = apply_filters( 'FHEE__EEH_Activation_Helper__get_default_creator_id__user_id', $user_id );
431
-		 if ( $user_id && intval( $user_id ) ) {
432
-		 	self::$_default_creator_id =  intval( $user_id );
427
+		$capabilities_key = $wpdb->prefix.'capabilities';
428
+		$query = $wpdb->prepare("SELECT user_id FROM $wpdb->usermeta WHERE meta_key = '$capabilities_key' AND meta_value LIKE %s ORDER BY user_id ASC LIMIT 0,1", '%'.$role_to_check.'%');
429
+		$user_id = $wpdb->get_var($query);
430
+		 $user_id = apply_filters('FHEE__EEH_Activation_Helper__get_default_creator_id__user_id', $user_id);
431
+		 if ($user_id && intval($user_id)) {
432
+		 	self::$_default_creator_id = intval($user_id);
433 433
 		 	return self::$_default_creator_id;
434 434
 		 } else {
435 435
 		 	return NULL;
@@ -456,26 +456,26 @@  discard block
 block discarded – undo
456 456
 	 * 	@return void
457 457
 	 * @throws EE_Error if there are database errors
458 458
 	 */
459
-	public static function create_table( $table_name, $sql, $engine = 'ENGINE=MyISAM ',$drop_table_if_pre_existed = false ) {
459
+	public static function create_table($table_name, $sql, $engine = 'ENGINE=MyISAM ', $drop_table_if_pre_existed = false) {
460 460
 //		echo "create table $table_name ". ($drop_table_if_pre_existed? 'but first nuke preexisting one' : 'or update it if it exists') . "<br>";//die;
461
-		if( apply_filters( 'FHEE__EEH_Activation__create_table__short_circuit', FALSE, $table_name, $sql ) ){
461
+		if (apply_filters('FHEE__EEH_Activation__create_table__short_circuit', FALSE, $table_name, $sql)) {
462 462
 			return;
463 463
 		}
464
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
465
-		if ( ! function_exists( 'dbDelta' )) {
466
-			require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
464
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
465
+		if ( ! function_exists('dbDelta')) {
466
+			require_once(ABSPATH.'wp-admin/includes/upgrade.php');
467 467
 		}
468 468
 		global $wpdb;
469
-		$wp_table_name = $wpdb->prefix . $table_name;
469
+		$wp_table_name = $wpdb->prefix.$table_name;
470 470
 		//		if(in_array(EE_System::instance()->detect_req_type(),array(EE_System::req_type_new_activation,  EE_System::req_t) )
471
-		if($drop_table_if_pre_existed && EEH_Activation::table_exists( $wp_table_name ) ){
472
-			if( defined( 'EE_DROP_BAD_TABLES' ) && EE_DROP_BAD_TABLES ){
471
+		if ($drop_table_if_pre_existed && EEH_Activation::table_exists($wp_table_name)) {
472
+			if (defined('EE_DROP_BAD_TABLES') && EE_DROP_BAD_TABLES) {
473 473
 				$wpdb->query("DROP TABLE IF EXISTS $wp_table_name ");
474
-			}else{
474
+			} else {
475 475
 				//so we should be more cautious rather than just dropping tables so easily
476 476
 				EE_Error::add_persistent_admin_notice(
477
-						'bad_table_' . $wp_table_name . '_detected',
478
-						sprintf( __( 'Database table %1$s existed when it shouldn\'t, and probably contained erroneous data. You probably restored to a backup that didn\'t remove old tables didn\'t you? We recommend adding %2$s to your %3$s file then restore to that backup again. This will clear out the invalid data from %1$s. Afterwards you should undo that change from your %3$s file. %4$sIf you cannot edit %3$s, you should remove the data from %1$s manually then restore to the backup again.', 'event_espresso' ),
477
+						'bad_table_'.$wp_table_name.'_detected',
478
+						sprintf(__('Database table %1$s existed when it shouldn\'t, and probably contained erroneous data. You probably restored to a backup that didn\'t remove old tables didn\'t you? We recommend adding %2$s to your %3$s file then restore to that backup again. This will clear out the invalid data from %1$s. Afterwards you should undo that change from your %3$s file. %4$sIf you cannot edit %3$s, you should remove the data from %1$s manually then restore to the backup again.', 'event_espresso'),
479 479
 								$wp_table_name,
480 480
 								"<pre>define( 'EE_DROP_BAD_TABLES', TRUE );</pre>",
481 481
 								'<b>wp-config.php</b>',
@@ -486,16 +486,16 @@  discard block
 block discarded – undo
486 486
 		$SQL = "CREATE TABLE $wp_table_name ( $sql ) $engine DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;";
487 487
 		//get $wpdb to echo errors, but buffer them. This way at least WE know an error
488 488
 		//happened. And then we can choose to tell the end user
489
-		$old_show_errors_policy = $wpdb->show_errors( TRUE );
490
-		$old_error_supression_policy = $wpdb->suppress_errors( FALSE );
489
+		$old_show_errors_policy = $wpdb->show_errors(TRUE);
490
+		$old_error_supression_policy = $wpdb->suppress_errors(FALSE);
491 491
 		ob_start();
492
-		dbDelta( $SQL );
492
+		dbDelta($SQL);
493 493
 		$output = ob_get_contents();
494 494
 		ob_end_clean();
495
-		$wpdb->show_errors( $old_show_errors_policy );
496
-		$wpdb->suppress_errors( $old_error_supression_policy );
497
-		if( ! empty( $output ) ){
498
-			throw new EE_Error( $output	);
495
+		$wpdb->show_errors($old_show_errors_policy);
496
+		$wpdb->suppress_errors($old_error_supression_policy);
497
+		if ( ! empty($output)) {
498
+			throw new EE_Error($output);
499 499
 		}
500 500
 	}
501 501
 
@@ -512,15 +512,15 @@  discard block
 block discarded – undo
512 512
 	 * @param string $column_info if your SQL were 'ALTER TABLE table_name ADD price VARCHAR(10)', this would be 'VARCHAR(10)'
513 513
 	 * @return bool|int
514 514
 	 */
515
-	public static function add_column_if_it_doesnt_exist($table_name,$column_name,$column_info='INT UNSIGNED NOT NULL'){
516
-		if( apply_filters( 'FHEE__EEH_Activation__add_column_if_it_doesnt_exist__short_circuit', FALSE ) ){
515
+	public static function add_column_if_it_doesnt_exist($table_name, $column_name, $column_info = 'INT UNSIGNED NOT NULL') {
516
+		if (apply_filters('FHEE__EEH_Activation__add_column_if_it_doesnt_exist__short_circuit', FALSE)) {
517 517
 			return FALSE;
518 518
 		}
519 519
 		global $wpdb;
520
-		$full_table_name=$wpdb->prefix.$table_name;
520
+		$full_table_name = $wpdb->prefix.$table_name;
521 521
 		$fields = self::get_fields_on_table($table_name);
522
-		if (!in_array($column_name, $fields)){
523
-			$alter_query="ALTER TABLE $full_table_name ADD $column_name $column_info";
522
+		if ( ! in_array($column_name, $fields)) {
523
+			$alter_query = "ALTER TABLE $full_table_name ADD $column_name $column_info";
524 524
 			//echo "alter query:$alter_query";
525 525
 			return $wpdb->query($alter_query);
526 526
 		}
@@ -539,15 +539,15 @@  discard block
 block discarded – undo
539 539
 	 * 	@param string $table_name, without prefixed $wpdb->prefix
540 540
 	 * 	@return array of database column names
541 541
 	 */
542
-	public static function get_fields_on_table( $table_name = NULL ) {
542
+	public static function get_fields_on_table($table_name = NULL) {
543 543
 		global $wpdb;
544
-		$table_name=$wpdb->prefix.$table_name;
545
-		if ( ! empty( $table_name )) {
544
+		$table_name = $wpdb->prefix.$table_name;
545
+		if ( ! empty($table_name)) {
546 546
 			$columns = $wpdb->get_results("SHOW COLUMNS FROM $table_name ");
547 547
 			if ($columns !== FALSE) {
548 548
 				$field_array = array();
549
-				foreach($columns as $column ){
550
-					$field_array[] = $column->Field;;
549
+				foreach ($columns as $column) {
550
+					$field_array[] = $column->Field; ;
551 551
 				}
552 552
 				return $field_array;
553 553
 			}
@@ -565,10 +565,10 @@  discard block
 block discarded – undo
565 565
 	 * @param string $table_name
566 566
 	 * @return bool | int
567 567
 	 */
568
-	public static function delete_unused_db_table( $table_name ) {
568
+	public static function delete_unused_db_table($table_name) {
569 569
 		global $wpdb;
570
-		$table_name = strpos( $table_name, $wpdb->prefix ) === FALSE ? $wpdb->prefix . $table_name : $table_name;
571
-		return $wpdb->query( "DROP TABLE IF EXISTS $table_name" );
570
+		$table_name = strpos($table_name, $wpdb->prefix) === FALSE ? $wpdb->prefix.$table_name : $table_name;
571
+		return $wpdb->query("DROP TABLE IF EXISTS $table_name");
572 572
 	}
573 573
 
574 574
 
@@ -582,18 +582,18 @@  discard block
 block discarded – undo
582 582
 	 * @param string $index_name
583 583
 	 * @return bool | int
584 584
 	 */
585
-	public static function drop_index( $table_name, $index_name ) {
586
-		if( apply_filters( 'FHEE__EEH_Activation__drop_index__short_circuit', FALSE ) ){
585
+	public static function drop_index($table_name, $index_name) {
586
+		if (apply_filters('FHEE__EEH_Activation__drop_index__short_circuit', FALSE)) {
587 587
 			return FALSE;
588 588
 		}
589 589
 		global $wpdb;
590
-		$table_name_with_prefix = $wpdb->prefix . $table_name ;
590
+		$table_name_with_prefix = $wpdb->prefix.$table_name;
591 591
 		$index_exists_query = "SHOW INDEX FROM $table_name_with_prefix WHERE Key_name = '$index_name'";
592 592
 		if (
593
-			$wpdb->get_var( "SHOW TABLES LIKE '$table_name_with_prefix'" ) == $wpdb->prefix . $table_name
594
-			&& $wpdb->get_var( $index_exists_query ) == $table_name_with_prefix //using get_var with the $index_exists_query returns the table's name
593
+			$wpdb->get_var("SHOW TABLES LIKE '$table_name_with_prefix'") == $wpdb->prefix.$table_name
594
+			&& $wpdb->get_var($index_exists_query) == $table_name_with_prefix //using get_var with the $index_exists_query returns the table's name
595 595
 		) {
596
-			return $wpdb->query( "ALTER TABLE $table_name_with_prefix DROP INDEX $index_name" );
596
+			return $wpdb->query("ALTER TABLE $table_name_with_prefix DROP INDEX $index_name");
597 597
 		}
598 598
 		return TRUE;
599 599
 	}
@@ -609,27 +609,27 @@  discard block
 block discarded – undo
609 609
 	 * @return boolean success (whether database is setup properly or not)
610 610
 	 */
611 611
 	public static function create_database_tables() {
612
-		EE_Registry::instance()->load_core( 'Data_Migration_Manager' );
612
+		EE_Registry::instance()->load_core('Data_Migration_Manager');
613 613
 		//find the migration script that sets the database to be compatible with the code
614 614
 		$dms_name = EE_Data_Migration_Manager::instance()->get_most_up_to_date_dms();
615
-		if( $dms_name ){
616
-			$current_data_migration_script = EE_Registry::instance()->load_dms( $dms_name );
617
-			$current_data_migration_script->set_migrating( FALSE );
615
+		if ($dms_name) {
616
+			$current_data_migration_script = EE_Registry::instance()->load_dms($dms_name);
617
+			$current_data_migration_script->set_migrating(FALSE);
618 618
 			$current_data_migration_script->schema_changes_before_migration();
619 619
 			$current_data_migration_script->schema_changes_after_migration();
620
-			if( $current_data_migration_script->get_errors() ){
621
-				if( WP_DEBUG ){
622
-					foreach( $current_data_migration_script->get_errors() as $error ){
623
-						EE_Error::add_error($error, __FILE__, __FUNCTION__, __LINE__ );
620
+			if ($current_data_migration_script->get_errors()) {
621
+				if (WP_DEBUG) {
622
+					foreach ($current_data_migration_script->get_errors() as $error) {
623
+						EE_Error::add_error($error, __FILE__, __FUNCTION__, __LINE__);
624 624
 					}
625
-				}else{
626
-					EE_Error::add_error( __( 'There were errors creating the Event Espresso database tables and Event Espresso has been deactivated. To view the errors, please enable WP_DEBUG in your wp-config.php file.', 'event_espresso' ) );
625
+				} else {
626
+					EE_Error::add_error(__('There were errors creating the Event Espresso database tables and Event Espresso has been deactivated. To view the errors, please enable WP_DEBUG in your wp-config.php file.', 'event_espresso'));
627 627
 				}
628 628
 				return FALSE;
629 629
 			}
630 630
 			EE_Data_Migration_Manager::instance()->update_current_database_state_to();
631
-		}else{
632
-			EE_Error::add_error( __( 'Could not determine most up-to-date data migration script from which to pull database schema structure. So database is probably not setup properly', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__);
631
+		} else {
632
+			EE_Error::add_error(__('Could not determine most up-to-date data migration script from which to pull database schema structure. So database is probably not setup properly', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
633 633
 			return FALSE;
634 634
 		}
635 635
 	}
@@ -648,26 +648,26 @@  discard block
 block discarded – undo
648 648
 	public static function initialize_system_questions() {
649 649
 		// QUESTION GROUPS
650 650
 		global $wpdb;
651
-		$SQL = 'SELECT QSG_system FROM ' . $wpdb->prefix . 'esp_question_group WHERE QSG_system != 0';
651
+		$SQL = 'SELECT QSG_system FROM '.$wpdb->prefix.'esp_question_group WHERE QSG_system != 0';
652 652
 		// what we have
653
-		$question_groups = $wpdb->get_col( $SQL );
653
+		$question_groups = $wpdb->get_col($SQL);
654 654
 		// check the response
655
-		$question_groups = is_array( $question_groups ) ? $question_groups : array();
655
+		$question_groups = is_array($question_groups) ? $question_groups : array();
656 656
 		// what we should have
657
-		$QSG_systems = array( 1, 2 );
657
+		$QSG_systems = array(1, 2);
658 658
 		// loop thru what we should have and compare to what we have
659
-		foreach ( $QSG_systems as $QSG_system ) {
659
+		foreach ($QSG_systems as $QSG_system) {
660 660
 			// reset values array
661 661
 			$QSG_values = array();
662 662
 			// if we don't have what we should have (but use $QST_system as as string because that's what we got from the db)
663
-			if ( ! in_array( "$QSG_system", $question_groups )) {
663
+			if ( ! in_array("$QSG_system", $question_groups)) {
664 664
 				// add it
665
-				switch ( $QSG_system ) {
665
+				switch ($QSG_system) {
666 666
 
667 667
 					case 1:
668 668
 							$QSG_values = array(
669
-									'QSG_name' => __( 'Personal Information', 'event_espresso' ),
670
-									'QSG_identifier' => 'personal-information-' . time(),
669
+									'QSG_name' => __('Personal Information', 'event_espresso'),
670
+									'QSG_identifier' => 'personal-information-'.time(),
671 671
 									'QSG_desc' => '',
672 672
 									'QSG_order' => 1,
673 673
 									'QSG_show_group_name' => 1,
@@ -679,8 +679,8 @@  discard block
 block discarded – undo
679 679
 
680 680
 					case 2:
681 681
 							$QSG_values = array(
682
-									'QSG_name' => __( 'Address Information','event_espresso' ),
683
-									'QSG_identifier' => 'address-information-' . time(),
682
+									'QSG_name' => __('Address Information', 'event_espresso'),
683
+									'QSG_identifier' => 'address-information-'.time(),
684 684
 									'QSG_desc' => '',
685 685
 									'QSG_order' => 2,
686 686
 									'QSG_show_group_name' => 1,
@@ -692,14 +692,14 @@  discard block
 block discarded – undo
692 692
 
693 693
 				}
694 694
 				// make sure we have some values before inserting them
695
-				if ( ! empty( $QSG_values )) {
695
+				if ( ! empty($QSG_values)) {
696 696
 					// insert system question
697 697
 					$wpdb->insert(
698
-						$wpdb->prefix . 'esp_question_group',
698
+						$wpdb->prefix.'esp_question_group',
699 699
 						$QSG_values,
700
-						array('%s', '%s', '%s', '%d', '%d', '%d', '%d', '%d' )
700
+						array('%s', '%s', '%s', '%d', '%d', '%d', '%d', '%d')
701 701
 					);
702
-					$QSG_IDs[ $QSG_system ] = $wpdb->insert_id;
702
+					$QSG_IDs[$QSG_system] = $wpdb->insert_id;
703 703
 				}
704 704
 			}
705 705
 		}
@@ -708,9 +708,9 @@  discard block
 block discarded – undo
708 708
 
709 709
 		// QUESTIONS
710 710
 		global $wpdb;
711
-		$SQL = 'SELECT QST_system FROM ' . $wpdb->prefix . "esp_question WHERE QST_system != ''";
711
+		$SQL = 'SELECT QST_system FROM '.$wpdb->prefix."esp_question WHERE QST_system != ''";
712 712
 		// what we have
713
-		$questions = $wpdb->get_col( $SQL );
713
+		$questions = $wpdb->get_col($SQL);
714 714
 		// what we should have
715 715
 		$QST_systems = array(
716 716
 			'fname',
@@ -727,22 +727,22 @@  discard block
 block discarded – undo
727 727
 		$order_for_group_1 = 1;
728 728
 		$order_for_group_2 = 1;
729 729
 		// loop thru what we should have and compare to what we have
730
-		foreach ( $QST_systems as $QST_system ) {
730
+		foreach ($QST_systems as $QST_system) {
731 731
 			// reset values array
732 732
 			$QST_values = array();
733 733
 			// if we don't have what we should have
734
-			if ( ! in_array( $QST_system, $questions )) {
734
+			if ( ! in_array($QST_system, $questions)) {
735 735
 				// add it
736
-				switch ( $QST_system ) {
736
+				switch ($QST_system) {
737 737
 
738 738
 					case 'fname':
739 739
 							$QST_values = array(
740
-									'QST_display_text' => __( 'First Name', 'event_espresso' ),
741
-									'QST_admin_label' => __( 'First Name - System Question', 'event_espresso' ),
740
+									'QST_display_text' => __('First Name', 'event_espresso'),
741
+									'QST_admin_label' => __('First Name - System Question', 'event_espresso'),
742 742
 									'QST_system' => 'fname',
743 743
 									'QST_type' => 'TEXT',
744 744
 									'QST_required' => 1,
745
-									'QST_required_text' => __( 'This field is required', 'event_espresso' ),
745
+									'QST_required_text' => __('This field is required', 'event_espresso'),
746 746
 									'QST_order' => 1,
747 747
 									'QST_admin_only' => 0,
748 748
 									'QST_wp_user' => self::get_default_creator_id(),
@@ -752,12 +752,12 @@  discard block
 block discarded – undo
752 752
 
753 753
 					case 'lname':
754 754
 							$QST_values = array(
755
-									'QST_display_text' => __( 'Last Name', 'event_espresso' ),
756
-									'QST_admin_label' => __( 'Last Name - System Question', 'event_espresso' ),
755
+									'QST_display_text' => __('Last Name', 'event_espresso'),
756
+									'QST_admin_label' => __('Last Name - System Question', 'event_espresso'),
757 757
 									'QST_system' => 'lname',
758 758
 									'QST_type' => 'TEXT',
759 759
 									'QST_required' => 1,
760
-									'QST_required_text' => __( 'This field is required', 'event_espresso' ),
760
+									'QST_required_text' => __('This field is required', 'event_espresso'),
761 761
 									'QST_order' => 2,
762 762
 									'QST_admin_only' => 0,
763 763
 									'QST_wp_user' => self::get_default_creator_id(),
@@ -767,12 +767,12 @@  discard block
 block discarded – undo
767 767
 
768 768
 					case 'email':
769 769
 							$QST_values = array(
770
-									'QST_display_text' => __( 'Email Address', 'event_espresso' ),
771
-									'QST_admin_label' => __( 'Email Address - System Question', 'event_espresso' ),
770
+									'QST_display_text' => __('Email Address', 'event_espresso'),
771
+									'QST_admin_label' => __('Email Address - System Question', 'event_espresso'),
772 772
 									'QST_system' => 'email',
773 773
 									'QST_type' => 'TEXT',
774 774
 									'QST_required' => 1,
775
-									'QST_required_text' => __( 'This field is required', 'event_espresso' ),
775
+									'QST_required_text' => __('This field is required', 'event_espresso'),
776 776
 									'QST_order' => 3,
777 777
 									'QST_admin_only' => 0,
778 778
 									'QST_wp_user' => self::get_default_creator_id(),
@@ -782,12 +782,12 @@  discard block
 block discarded – undo
782 782
 
783 783
 					case 'address':
784 784
 							$QST_values = array(
785
-									'QST_display_text' => __( 'Address', 'event_espresso' ),
786
-									'QST_admin_label' => __( 'Address - System Question', 'event_espresso' ),
785
+									'QST_display_text' => __('Address', 'event_espresso'),
786
+									'QST_admin_label' => __('Address - System Question', 'event_espresso'),
787 787
 									'QST_system' => 'address',
788 788
 									'QST_type' => 'TEXT',
789 789
 									'QST_required' => 0,
790
-									'QST_required_text' => __( 'This field is required', 'event_espresso' ),
790
+									'QST_required_text' => __('This field is required', 'event_espresso'),
791 791
 									'QST_order' => 4,
792 792
 									'QST_admin_only' => 0,
793 793
 									'QST_wp_user' => self::get_default_creator_id(),
@@ -797,12 +797,12 @@  discard block
 block discarded – undo
797 797
 
798 798
 					case 'address2':
799 799
 							$QST_values = array(
800
-									'QST_display_text' => __( 'Address2', 'event_espresso' ),
801
-									'QST_admin_label' => __( 'Address2 - System Question', 'event_espresso' ),
800
+									'QST_display_text' => __('Address2', 'event_espresso'),
801
+									'QST_admin_label' => __('Address2 - System Question', 'event_espresso'),
802 802
 									'QST_system' => 'address2',
803 803
 									'QST_type' => 'TEXT',
804 804
 									'QST_required' => 0,
805
-									'QST_required_text' => __( 'This field is required', 'event_espresso' ),
805
+									'QST_required_text' => __('This field is required', 'event_espresso'),
806 806
 									'QST_order' => 5,
807 807
 									'QST_admin_only' => 0,
808 808
 									'QST_wp_user' => self::get_default_creator_id(),
@@ -812,12 +812,12 @@  discard block
 block discarded – undo
812 812
 
813 813
 					case 'city':
814 814
 							$QST_values = array(
815
-									'QST_display_text' => __( 'City', 'event_espresso' ),
816
-									'QST_admin_label' => __( 'City - System Question', 'event_espresso' ),
815
+									'QST_display_text' => __('City', 'event_espresso'),
816
+									'QST_admin_label' => __('City - System Question', 'event_espresso'),
817 817
 									'QST_system' => 'city',
818 818
 									'QST_type' => 'TEXT',
819 819
 									'QST_required' => 0,
820
-									'QST_required_text' => __( 'This field is required', 'event_espresso' ),
820
+									'QST_required_text' => __('This field is required', 'event_espresso'),
821 821
 									'QST_order' => 6,
822 822
 									'QST_admin_only' => 0,
823 823
 									'QST_wp_user' => self::get_default_creator_id(),
@@ -827,12 +827,12 @@  discard block
 block discarded – undo
827 827
 
828 828
 					case 'state':
829 829
 							$QST_values = array(
830
-									'QST_display_text' => __( 'State/Province', 'event_espresso' ),
831
-									'QST_admin_label' => __( 'State/Province - System Question', 'event_espresso' ),
830
+									'QST_display_text' => __('State/Province', 'event_espresso'),
831
+									'QST_admin_label' => __('State/Province - System Question', 'event_espresso'),
832 832
 									'QST_system' => 'state',
833 833
 									'QST_type' => 'STATE',
834 834
 									'QST_required' => 0,
835
-									'QST_required_text' => __( 'This field is required', 'event_espresso' ),
835
+									'QST_required_text' => __('This field is required', 'event_espresso'),
836 836
 									'QST_order' => 7,
837 837
 									'QST_admin_only' => 0,
838 838
 									'QST_wp_user' => self::get_default_creator_id(),
@@ -842,12 +842,12 @@  discard block
 block discarded – undo
842 842
 
843 843
 					case 'country' :
844 844
 							$QST_values = array(
845
-									'QST_display_text' => __( 'Country', 'event_espresso' ),
846
-									'QST_admin_label' => __( 'Country - System Question', 'event_espresso' ),
845
+									'QST_display_text' => __('Country', 'event_espresso'),
846
+									'QST_admin_label' => __('Country - System Question', 'event_espresso'),
847 847
 									'QST_system' => 'country',
848 848
 									'QST_type' => 'COUNTRY',
849 849
 									'QST_required' => 0,
850
-									'QST_required_text' => __( 'This field is required', 'event_espresso' ),
850
+									'QST_required_text' => __('This field is required', 'event_espresso'),
851 851
 									'QST_order' => 8,
852 852
 									'QST_admin_only' => 0,
853 853
 									'QST_wp_user' => self::get_default_creator_id(),
@@ -857,12 +857,12 @@  discard block
 block discarded – undo
857 857
 
858 858
 					case 'zip':
859 859
 							$QST_values = array(
860
-									'QST_display_text' => __( 'Zip/Postal Code', 'event_espresso' ),
861
-									'QST_admin_label' => __( 'Zip/Postal Code - System Question', 'event_espresso' ),
860
+									'QST_display_text' => __('Zip/Postal Code', 'event_espresso'),
861
+									'QST_admin_label' => __('Zip/Postal Code - System Question', 'event_espresso'),
862 862
 									'QST_system' => 'zip',
863 863
 									'QST_type' => 'TEXT',
864 864
 									'QST_required' => 0,
865
-									'QST_required_text' => __( 'This field is required', 'event_espresso' ),
865
+									'QST_required_text' => __('This field is required', 'event_espresso'),
866 866
 									'QST_order' => 9,
867 867
 									'QST_admin_only' => 0,
868 868
 									'QST_wp_user' => self::get_default_creator_id(),
@@ -872,12 +872,12 @@  discard block
 block discarded – undo
872 872
 
873 873
 					case 'phone':
874 874
 							$QST_values = array(
875
-									'QST_display_text' => __( 'Phone Number', 'event_espresso' ),
876
-									'QST_admin_label' => __( 'Phone Number - System Question', 'event_espresso' ),
875
+									'QST_display_text' => __('Phone Number', 'event_espresso'),
876
+									'QST_admin_label' => __('Phone Number - System Question', 'event_espresso'),
877 877
 									'QST_system' => 'phone',
878 878
 									'QST_type' => 'TEXT',
879 879
 									'QST_required' => 0,
880
-									'QST_required_text' => __( 'This field is required', 'event_espresso' ),
880
+									'QST_required_text' => __('This field is required', 'event_espresso'),
881 881
 									'QST_order' => 10,
882 882
 									'QST_admin_only' => 0,
883 883
 									'QST_wp_user' => self::get_default_creator_id(),
@@ -886,22 +886,22 @@  discard block
 block discarded – undo
886 886
 						break;
887 887
 
888 888
 				}
889
-				if ( ! empty( $QST_values )) {
889
+				if ( ! empty($QST_values)) {
890 890
 					// insert system question
891 891
 					$wpdb->insert(
892
-						$wpdb->prefix . 'esp_question',
892
+						$wpdb->prefix.'esp_question',
893 893
 						$QST_values,
894
-						array( '%s', '%s', '%s', '%s', '%d', '%s', '%d', '%d', '%d', '%d' )
894
+						array('%s', '%s', '%s', '%s', '%d', '%s', '%d', '%d', '%d', '%d')
895 895
 					);
896 896
 					$QST_ID = $wpdb->insert_id;
897 897
 
898 898
 					// QUESTION GROUP QUESTIONS
899
-					$QSG_ID = in_array( $QST_system, array('fname','lname','email')) ? 1 : 2;
899
+					$QSG_ID = in_array($QST_system, array('fname', 'lname', 'email')) ? 1 : 2;
900 900
 					// add system questions to groups
901 901
 					$wpdb->insert(
902
-						$wpdb->prefix . 'esp_question_group_question',
903
-						array( 'QSG_ID' => $QSG_ID , 'QST_ID' => $QST_ID, 'QGQ_order'=>($QSG_ID==1)? $order_for_group_1++ : $order_for_group_2++ ),
904
-						array( '%d', '%d','%d' )
902
+						$wpdb->prefix.'esp_question_group_question',
903
+						array('QSG_ID' => $QSG_ID, 'QST_ID' => $QST_ID, 'QGQ_order'=>($QSG_ID == 1) ? $order_for_group_1++ : $order_for_group_2++),
904
+						array('%d', '%d', '%d')
905 905
 					);
906 906
 				}
907 907
 			}
@@ -913,11 +913,11 @@  discard block
 block discarded – undo
913 913
 	 * Makes sure the default payment method (Invoice) is active.
914 914
 	 * This used to be done automatically as part of constructing the old gateways config
915 915
 	 */
916
-	public static function insert_default_payment_methods(){
917
-		if( ! EEM_Payment_Method::instance()->count_active( EEM_Payment_Method::scope_cart ) ){
918
-			EE_Registry::instance()->load_lib( 'Payment_Method_Manager' );
919
-			EE_Payment_Method_Manager::instance()->activate_a_payment_method_of_type( 'Invoice' );
920
-		}else{
916
+	public static function insert_default_payment_methods() {
917
+		if ( ! EEM_Payment_Method::instance()->count_active(EEM_Payment_Method::scope_cart)) {
918
+			EE_Registry::instance()->load_lib('Payment_Method_Manager');
919
+			EE_Payment_Method_Manager::instance()->activate_a_payment_method_of_type('Invoice');
920
+		} else {
921 921
 			EEM_Payment_Method::instance()->verify_button_urls();
922 922
 		}
923 923
 	}
@@ -933,12 +933,12 @@  discard block
 block discarded – undo
933 933
 
934 934
 		global $wpdb;
935 935
 
936
-		if ( EEH_Activation::table_exists( EEM_Status::instance()->table() ) ) {
936
+		if (EEH_Activation::table_exists(EEM_Status::instance()->table())) {
937 937
 
938
-			$SQL = "DELETE FROM " . EEM_Status::instance()->table() . " WHERE STS_ID IN ( 'ACT', 'NAC', 'NOP', 'OPN', 'CLS', 'PND', 'ONG', 'SEC', 'DRF', 'DEL', 'DEN', 'EXP', 'RPP', 'RCN', 'RDC', 'RAP', 'RNA', 'TAB', 'TIN', 'TFL', 'TCM', 'TOP', 'PAP', 'PCN', 'PFL', 'PDC', 'EDR', 'ESN', 'PPN', 'RIC' );";
938
+			$SQL = "DELETE FROM ".EEM_Status::instance()->table()." WHERE STS_ID IN ( 'ACT', 'NAC', 'NOP', 'OPN', 'CLS', 'PND', 'ONG', 'SEC', 'DRF', 'DEL', 'DEN', 'EXP', 'RPP', 'RCN', 'RDC', 'RAP', 'RNA', 'TAB', 'TIN', 'TFL', 'TCM', 'TOP', 'PAP', 'PCN', 'PFL', 'PDC', 'EDR', 'ESN', 'PPN', 'RIC' );";
939 939
 			$wpdb->query($SQL);
940 940
 
941
-			$SQL = "INSERT INTO " . EEM_Status::instance()->table() . "
941
+			$SQL = "INSERT INTO ".EEM_Status::instance()->table()."
942 942
 					(STS_ID, STS_code, STS_type, STS_can_edit, STS_desc, STS_open) VALUES
943 943
 					('ACT', 'ACTIVE', 'event', 0, NULL, 1),
944 944
 					('NAC', 'NOT_ACTIVE', 'event', 0, NULL, 0),
@@ -997,26 +997,26 @@  discard block
 block discarded – undo
997 997
 	 * 	@return boolean success of verifying upload directories exist
998 998
 	 */
999 999
 	public static function create_upload_directories() {
1000
-		EE_Registry::instance()->load_helper( 'File' );
1000
+		EE_Registry::instance()->load_helper('File');
1001 1001
 		// Create the required folders
1002 1002
 		$folders = array(
1003 1003
 				EVENT_ESPRESSO_UPLOAD_DIR,
1004 1004
 				EVENT_ESPRESSO_TEMPLATE_DIR,
1005 1005
 				EVENT_ESPRESSO_GATEWAY_DIR,
1006
-				EVENT_ESPRESSO_UPLOAD_DIR . '/logs/',
1007
-				EVENT_ESPRESSO_UPLOAD_DIR . '/css/',
1008
-				EVENT_ESPRESSO_UPLOAD_DIR . '/tickets/'
1006
+				EVENT_ESPRESSO_UPLOAD_DIR.'/logs/',
1007
+				EVENT_ESPRESSO_UPLOAD_DIR.'/css/',
1008
+				EVENT_ESPRESSO_UPLOAD_DIR.'/tickets/'
1009 1009
 		);
1010
-		foreach ( $folders as $folder ) {
1010
+		foreach ($folders as $folder) {
1011 1011
 			try {
1012
-				EEH_File::ensure_folder_exists_and_is_writable( $folder );
1013
-				@ chmod( $folder, 0755 );
1014
-			} catch( EE_Error $e ){
1012
+				EEH_File::ensure_folder_exists_and_is_writable($folder);
1013
+				@ chmod($folder, 0755);
1014
+			} catch (EE_Error $e) {
1015 1015
 				EE_Error::add_error(
1016 1016
 					sprintf(
1017
-						__(  'Could not create the folder at "%1$s" because: %2$s', 'event_espresso' ),
1017
+						__('Could not create the folder at "%1$s" because: %2$s', 'event_espresso'),
1018 1018
 						$folder,
1019
-						'<br />' . $e->getMessage()
1019
+						'<br />'.$e->getMessage()
1020 1020
 					),
1021 1021
 					__FILE__, __FUNCTION__, __LINE__
1022 1022
 				);
@@ -1042,16 +1042,16 @@  discard block
 block discarded – undo
1042 1042
 		$settings = $installed_messengers = $default_messengers = array();
1043 1043
 
1044 1044
 		//include our helper
1045
-		EE_Registry::instance()->load_helper( 'MSG_Template' );
1045
+		EE_Registry::instance()->load_helper('MSG_Template');
1046 1046
 
1047 1047
 		//get all installed messenger objects
1048 1048
 		$installed = EEH_MSG_Template::get_installed_message_objects();
1049 1049
 
1050 1050
 		//let's setup the $installed messengers in an array AND the messengers that are set to be activated on install.
1051
-		foreach ( $installed['messengers'] as $msgr ) {
1052
-			if ( $msgr instanceof EE_messenger ) {
1051
+		foreach ($installed['messengers'] as $msgr) {
1052
+			if ($msgr instanceof EE_messenger) {
1053 1053
 				$installed_messengers[$msgr->name] = $msgr;
1054
-				if ( $msgr->activate_on_install ) {
1054
+				if ($msgr->activate_on_install) {
1055 1055
 					$default_messengers[] = $msgr->name;
1056 1056
 				}
1057 1057
 			}
@@ -1061,36 +1061,36 @@  discard block
 block discarded – undo
1061 1061
 		$active_messengers = EEH_MSG_Template::get_active_messengers_in_db();
1062 1062
 
1063 1063
 		//things that have already been activated before
1064
-		$has_activated = get_option( 'ee_has_activated_messenger' );
1064
+		$has_activated = get_option('ee_has_activated_messenger');
1065 1065
 
1066 1066
 		//do an initial loop to determine if we need to continue
1067 1067
 		$def_ms = array();
1068
-		foreach ( $default_messengers as $msgr ) {
1069
-			if ( isset($active_messengers[$msgr] ) || isset( $has_activated[$msgr] ) ) continue;
1068
+		foreach ($default_messengers as $msgr) {
1069
+			if (isset($active_messengers[$msgr]) || isset($has_activated[$msgr])) continue;
1070 1070
 			$def_ms[] = $msgr;
1071 1071
 		}
1072 1072
 
1073 1073
 		//setup the $installed_mts in an array
1074
-		foreach ( $installed['message_types'] as $imt ) {
1075
-			if ( $imt instanceof EE_message_type ) {
1074
+		foreach ($installed['message_types'] as $imt) {
1075
+			if ($imt instanceof EE_message_type) {
1076 1076
 				$installed_mts[$imt->name] = $imt;
1077 1077
 			}
1078 1078
 		}
1079 1079
 
1080 1080
 		//loop through default array for default messengers (if present)
1081
-		if ( ! empty( $def_ms ) ) {
1082
-			foreach ( $def_ms as $messenger ) {
1081
+		if ( ! empty($def_ms)) {
1082
+			foreach ($def_ms as $messenger) {
1083 1083
 				//all is good so let's setup the default stuff. We need to use the given messenger object (if exists) to get the default message type for the messenger.
1084
-				if ( ! isset( $installed_messengers[$messenger] )) {
1084
+				if ( ! isset($installed_messengers[$messenger])) {
1085 1085
 					continue;
1086 1086
 				}
1087 1087
 				/** @var EE_messenger[] $installed_messengers  */
1088 1088
 				$default_mts = $installed_messengers[$messenger]->get_default_message_types();
1089 1089
 				$active_messengers[$messenger]['obj'] = $installed_messengers[$messenger];
1090
-				foreach ( $default_mts as $index => $mt ) {
1090
+				foreach ($default_mts as $index => $mt) {
1091 1091
 					//is there an installed_mt matching the default string?  If not then nothing to do here.
1092
-					if ( ! isset( $installed_mts[$mt] ) ) {
1093
-						unset( $default_mts[$index] );
1092
+					if ( ! isset($installed_mts[$mt])) {
1093
+						unset($default_mts[$index]);
1094 1094
 						continue;
1095 1095
 					}
1096 1096
 
@@ -1099,41 +1099,41 @@  discard block
 block discarded – undo
1099 1099
 					/** @var EE_message_type[] $installed_mts */
1100 1100
 					$settings_fields = $installed_mts[$mt]->get_admin_settings_fields();
1101 1101
 					$settings = array();
1102
-					if ( is_array( $settings_fields ) ) {
1103
-						foreach ( $settings_fields as $field => $values ) {
1104
-							if ( isset( $values['default'] ) ) {
1102
+					if (is_array($settings_fields)) {
1103
+						foreach ($settings_fields as $field => $values) {
1104
+							if (isset($values['default'])) {
1105 1105
 								$settings[$field] = $values['default'];
1106 1106
 							}
1107 1107
 						}
1108 1108
 					}
1109 1109
 
1110
-					$active_messengers[$messenger]['settings'][$messenger . '-message_types'][$mt]['settings'] = $settings;
1110
+					$active_messengers[$messenger]['settings'][$messenger.'-message_types'][$mt]['settings'] = $settings;
1111 1111
 					$has_activated[$messenger][] = $mt;
1112 1112
 				}
1113 1113
 
1114 1114
 				//setup any initial settings for the messenger
1115 1115
 				$msgr_settings = $installed_messengers[$messenger]->get_admin_settings_fields();
1116 1116
 
1117
-				if ( !empty( $msgr_settings ) ) {
1118
-					foreach ( $msgr_settings as $field => $value ) {
1117
+				if ( ! empty($msgr_settings)) {
1118
+					foreach ($msgr_settings as $field => $value) {
1119 1119
 						$active_messengers[$messenger]['settings'][$field] = $value;
1120 1120
 					}
1121 1121
 				}
1122 1122
 
1123 1123
 				//now let's save the settings for this messenger! Must do now because the validator checks the db for active messengers to validate.
1124
-				EEH_MSG_Template::update_active_messengers_in_db( $active_messengers );
1124
+				EEH_MSG_Template::update_active_messengers_in_db($active_messengers);
1125 1125
 
1126 1126
 				//let's generate all the templates but only if the messenger has default_mts (otherwise its just activated).
1127
-				if ( !empty( $default_mts ) ) {
1128
-					$success = EEH_MSG_Template::generate_new_templates( $messenger, $default_mts, '', TRUE );
1127
+				if ( ! empty($default_mts)) {
1128
+					$success = EEH_MSG_Template::generate_new_templates($messenger, $default_mts, '', TRUE);
1129 1129
 				}
1130 1130
 			}
1131 1131
 		} //end check for empty( $def_ms )
1132 1132
 
1133 1133
 		//still need to see if there are any message types to activate for active messengers
1134
-		foreach ( $active_messengers as $messenger => $settings ) {
1134
+		foreach ($active_messengers as $messenger => $settings) {
1135 1135
 			$msg_obj = $settings['obj'];
1136
-			if ( ! $msg_obj instanceof EE_messenger ) {
1136
+			if ( ! $msg_obj instanceof EE_messenger) {
1137 1137
 				continue;
1138 1138
 			}
1139 1139
 
@@ -1141,45 +1141,45 @@  discard block
 block discarded – undo
1141 1141
 			$new_default_mts = array();
1142 1142
 
1143 1143
 			//loop through each default mt reported by the messenger and make sure its set in its active db entry.
1144
-			foreach( $all_default_mts as $index => $mt ) {
1144
+			foreach ($all_default_mts as $index => $mt) {
1145 1145
 				//already active? already has generated templates? || has already been activated before (we dont' want to reactivate things users intentionally deactivated).
1146
-				if ( ( isset( $has_activated[$messenger] ) && in_array($mt, $has_activated[$messenger]) ) || isset( $active_messengers[$messenger]['settings'][$messenger . '-message_types'][$mt] ) ||  EEH_MSG_Template::already_generated( $messenger, $mt, 0, FALSE ) ) {
1146
+				if ((isset($has_activated[$messenger]) && in_array($mt, $has_activated[$messenger])) || isset($active_messengers[$messenger]['settings'][$messenger.'-message_types'][$mt]) || EEH_MSG_Template::already_generated($messenger, $mt, 0, FALSE)) {
1147 1147
 					continue;
1148 1148
 				}
1149 1149
 
1150 1150
 				//is there an installed_mt matching the default string?  If not then nothing to do here.
1151
-				if ( ! isset( $installed_mts[$mt] ) ) {
1152
-					unset( $all_default_mts[$mt] );
1151
+				if ( ! isset($installed_mts[$mt])) {
1152
+					unset($all_default_mts[$mt]);
1153 1153
 					continue;
1154 1154
 				}
1155 1155
 
1156 1156
 				$settings_fields = $installed_mts[$mt]->get_admin_settings_fields();
1157 1157
 				$settings = array();
1158
-				if ( is_array( $settings_fields ) ) {
1159
-					foreach ( $settings_fields as $field => $values ) {
1160
-						if ( isset( $values['default'] ) ) {
1158
+				if (is_array($settings_fields)) {
1159
+					foreach ($settings_fields as $field => $values) {
1160
+						if (isset($values['default'])) {
1161 1161
 							$settings[$field] = $values['default'];
1162 1162
 						}
1163 1163
 					}
1164 1164
 				}
1165 1165
 
1166
-				$active_messengers[$messenger]['settings'][$messenger . '-message_types'][$mt]['settings'] = $settings;
1166
+				$active_messengers[$messenger]['settings'][$messenger.'-message_types'][$mt]['settings'] = $settings;
1167 1167
 				$new_default_mts[] = $mt;
1168 1168
 				$has_activated[$messenger][] = $mt;
1169 1169
 			}
1170 1170
 
1171 1171
 
1172
-			if ( ! empty( $new_default_mts ) ) {
1173
-				$success = EEH_MSG_Template::generate_new_templates( $messenger, $new_default_mts, '', TRUE );
1172
+			if ( ! empty($new_default_mts)) {
1173
+				$success = EEH_MSG_Template::generate_new_templates($messenger, $new_default_mts, '', TRUE);
1174 1174
 			}
1175 1175
 
1176 1176
 		}
1177 1177
 
1178 1178
 		//now let's save the settings for this messenger!
1179
-		EEH_MSG_Template::update_active_messengers_in_db( $active_messengers );
1179
+		EEH_MSG_Template::update_active_messengers_in_db($active_messengers);
1180 1180
 
1181 1181
 		//update $has_activated record
1182
-		update_option( 'ee_has_activated_messenger', $has_activated );
1182
+		update_option('ee_has_activated_messenger', $has_activated);
1183 1183
 
1184 1184
 		//that's it!
1185 1185
 		return $success;
@@ -1199,47 +1199,47 @@  discard block
 block discarded – undo
1199 1199
 	 */
1200 1200
 	public static function validate_messages_system() {
1201 1201
 		//include our helper
1202
-		EE_Registry::instance()->load_helper( 'MSG_Template' );
1202
+		EE_Registry::instance()->load_helper('MSG_Template');
1203 1203
 
1204 1204
 		//get active and installed  messengers/message types.
1205 1205
 		$active_messengers = EEH_MSG_Template::get_active_messengers_in_db();
1206 1206
 		$installed = EEH_MSG_Template::get_installed_message_objects();
1207 1207
 		$installed_messengers = $installed_mts = array();
1208 1208
 		//set up the arrays so they can be handled easier.
1209
-		foreach( $installed['messengers'] as $im ) {
1210
-			if ( $im instanceof EE_messenger ) {
1209
+		foreach ($installed['messengers'] as $im) {
1210
+			if ($im instanceof EE_messenger) {
1211 1211
 				$installed_messengers[$im->name] = $im;
1212 1212
 			}
1213 1213
 		}
1214
-		foreach( $installed['message_types'] as $imt ) {
1215
-			if ( $imt instanceof EE_message_type ) {
1214
+		foreach ($installed['message_types'] as $imt) {
1215
+			if ($imt instanceof EE_message_type) {
1216 1216
 				$installed_mts[$imt->name] = $imt;
1217 1217
 			}
1218 1218
 		}
1219 1219
 
1220 1220
 		//now let's loop through the active array and validate
1221
-		foreach( $active_messengers as $messenger => $active_details ) {
1221
+		foreach ($active_messengers as $messenger => $active_details) {
1222 1222
 			//first let's see if this messenger is installed.
1223
-			if ( ! isset( $installed_messengers[$messenger] ) ) {
1223
+			if ( ! isset($installed_messengers[$messenger])) {
1224 1224
 				//not set so let's just remove from actives and make sure templates are inactive.
1225
-				unset( $active_messengers[$messenger] );
1226
-				EEH_MSG_Template::update_to_inactive( $messenger );
1225
+				unset($active_messengers[$messenger]);
1226
+				EEH_MSG_Template::update_to_inactive($messenger);
1227 1227
 				continue;
1228 1228
 			}
1229 1229
 
1230 1230
 			//messenger is active, so let's just make sure that any active message types not installed are deactivated.
1231
-			$mts = ! empty( $active_details['settings'][$messenger . '-message_types'] ) ? $active_details['settings'][$messenger . '-message_types'] : array();
1232
-			foreach ( $mts as $mt_name => $mt ) {
1233
-				if ( ! isset( $installed_mts[$mt_name] )  ) {
1234
-					unset( $active_messengers[$messenger]['settings'][$messenger . '-message_types'][$mt_name] );
1235
-					EEH_MSG_Template::update_to_inactive( $messenger, $mt_name );
1231
+			$mts = ! empty($active_details['settings'][$messenger.'-message_types']) ? $active_details['settings'][$messenger.'-message_types'] : array();
1232
+			foreach ($mts as $mt_name => $mt) {
1233
+				if ( ! isset($installed_mts[$mt_name])) {
1234
+					unset($active_messengers[$messenger]['settings'][$messenger.'-message_types'][$mt_name]);
1235
+					EEH_MSG_Template::update_to_inactive($messenger, $mt_name);
1236 1236
 				}
1237 1237
 			}
1238 1238
 		}
1239 1239
 
1240 1240
 		//all done! let's update the active_messengers.
1241
-		EEH_MSG_Template::update_active_messengers_in_db( $active_messengers );
1242
-		do_action( 'AHEE__EEH_Activation__validate_messages_system' );
1241
+		EEH_MSG_Template::update_active_messengers_in_db($active_messengers);
1242
+		do_action('AHEE__EEH_Activation__validate_messages_system');
1243 1243
 		return;
1244 1244
 	}
1245 1245
 
@@ -1253,12 +1253,12 @@  discard block
 block discarded – undo
1253 1253
 	 * 	@static
1254 1254
 	 * 	@return void
1255 1255
 	 */
1256
-	public static function create_no_ticket_prices_array(){
1256
+	public static function create_no_ticket_prices_array() {
1257 1257
 		// this creates an array for tracking events that have no active ticket prices created
1258 1258
 		// this allows us to warn admins of the situation so that it can be corrected
1259
-		$espresso_no_ticket_prices = get_option( 'ee_no_ticket_prices', FALSE );
1260
-		if ( ! $espresso_no_ticket_prices ) {
1261
-			add_option( 'ee_no_ticket_prices', array(), '', FALSE );
1259
+		$espresso_no_ticket_prices = get_option('ee_no_ticket_prices', FALSE);
1260
+		if ( ! $espresso_no_ticket_prices) {
1261
+			add_option('ee_no_ticket_prices', array(), '', FALSE);
1262 1262
 		}
1263 1263
 	}
1264 1264
 
@@ -1280,24 +1280,24 @@  discard block
 block discarded – undo
1280 1280
 	 * Finds all our EE4 custom post types, and deletes them and their associated data (like post meta or term relations)/
1281 1281
 	 * @global wpdb $wpdb
1282 1282
 	 */
1283
-	public static function delete_all_espresso_cpt_data(){
1283
+	public static function delete_all_espresso_cpt_data() {
1284 1284
 		global $wpdb;
1285 1285
 		//get all the CPT post_types
1286 1286
 		$ee_post_types = array();
1287
-		foreach(EE_Registry::instance()->non_abstract_db_models as $model_name){
1288
-			if ( method_exists( $model_name, 'instance' )) {
1289
-				$model_obj = call_user_func( array( $model_name, 'instance' ));
1290
-				if ( $model_obj instanceof EEM_CPT_Base ) {
1291
-					$ee_post_types[] = $wpdb->prepare("%s",$model_obj->post_type());
1287
+		foreach (EE_Registry::instance()->non_abstract_db_models as $model_name) {
1288
+			if (method_exists($model_name, 'instance')) {
1289
+				$model_obj = call_user_func(array($model_name, 'instance'));
1290
+				if ($model_obj instanceof EEM_CPT_Base) {
1291
+					$ee_post_types[] = $wpdb->prepare("%s", $model_obj->post_type());
1292 1292
 				}
1293 1293
 			}
1294 1294
 		}
1295 1295
 		//get all our CPTs
1296
-		$query = "SELECT ID FROM {$wpdb->posts} WHERE post_type IN (".implode(",",$ee_post_types).")";
1296
+		$query = "SELECT ID FROM {$wpdb->posts} WHERE post_type IN (".implode(",", $ee_post_types).")";
1297 1297
 		$cpt_ids = $wpdb->get_col($query);
1298 1298
 		//delete each post meta and term relations too
1299
-		foreach($cpt_ids as $post_id){
1300
-			wp_delete_post($post_id,true);
1299
+		foreach ($cpt_ids as $post_id) {
1300
+			wp_delete_post($post_id, true);
1301 1301
 		}
1302 1302
 	}
1303 1303
 
@@ -1311,18 +1311,18 @@  discard block
 block discarded – undo
1311 1311
 	 * @param bool $remove_all
1312 1312
 	 * @return void
1313 1313
 	 */
1314
-	public static function delete_all_espresso_tables_and_data( $remove_all = true ) {
1314
+	public static function delete_all_espresso_tables_and_data($remove_all = true) {
1315 1315
 		global $wpdb;
1316 1316
 		$undeleted_tables = array();
1317 1317
 
1318 1318
 		// load registry
1319
-		foreach( EE_Registry::instance()->non_abstract_db_models as $model_name ){
1320
-			if ( method_exists( $model_name, 'instance' )) {
1321
-				$model_obj = call_user_func( array( $model_name, 'instance' ));
1322
-				if ( $model_obj instanceof EEM_Base ) {
1323
-					foreach ( $model_obj->get_tables() as $table ) {
1324
-						if ( strpos( $table->get_table_name(), 'esp_' )) {
1325
-							switch ( EEH_Activation::delete_unused_db_table( $table->get_table_name() )) {
1319
+		foreach (EE_Registry::instance()->non_abstract_db_models as $model_name) {
1320
+			if (method_exists($model_name, 'instance')) {
1321
+				$model_obj = call_user_func(array($model_name, 'instance'));
1322
+				if ($model_obj instanceof EEM_Base) {
1323
+					foreach ($model_obj->get_tables() as $table) {
1324
+						if (strpos($table->get_table_name(), 'esp_')) {
1325
+							switch (EEH_Activation::delete_unused_db_table($table->get_table_name())) {
1326 1326
 								case false :
1327 1327
 									$undeleted_tables[] = $table->get_table_name();
1328 1328
 								break;
@@ -1347,8 +1347,8 @@  discard block
 block discarded – undo
1347 1347
 			'wp_esp_promotion_rule',
1348 1348
 			'wp_esp_rule'
1349 1349
 		);
1350
-		foreach( $tables_without_models as $table ){
1351
-			EEH_Activation::delete_unused_db_table( $table );
1350
+		foreach ($tables_without_models as $table) {
1351
+			EEH_Activation::delete_unused_db_table($table);
1352 1352
 		}
1353 1353
 
1354 1354
 
@@ -1386,51 +1386,51 @@  discard block
 block discarded – undo
1386 1386
 		);
1387 1387
 
1388 1388
 		$undeleted_options = array();
1389
-		foreach ( $wp_options_to_delete as $option_name => $no_wildcard ) {
1389
+		foreach ($wp_options_to_delete as $option_name => $no_wildcard) {
1390 1390
 
1391
-			if( $no_wildcard ){
1392
-				if( ! delete_option( $option_name ) ){
1391
+			if ($no_wildcard) {
1392
+				if ( ! delete_option($option_name)) {
1393 1393
 					$undeleted_options[] = $option_name;
1394 1394
 				}
1395
-			}else{
1396
-				$option_names_to_delete_from_wildcard = $wpdb->get_col( "SELECT option_name FROM $wpdb->options WHERE option_name LIKE '%$option_name%'" );
1397
-				foreach($option_names_to_delete_from_wildcard as $option_name_from_wildcard ){
1398
-					if( ! delete_option( $option_name_from_wildcard ) ){
1395
+			} else {
1396
+				$option_names_to_delete_from_wildcard = $wpdb->get_col("SELECT option_name FROM $wpdb->options WHERE option_name LIKE '%$option_name%'");
1397
+				foreach ($option_names_to_delete_from_wildcard as $option_name_from_wildcard) {
1398
+					if ( ! delete_option($option_name_from_wildcard)) {
1399 1399
 						$undeleted_options[] = $option_name_from_wildcard;
1400 1400
 					}
1401 1401
 				}
1402 1402
 			}
1403 1403
 		}
1404 1404
 
1405
-		if ( $remove_all && $espresso_db_update = get_option( 'espresso_db_update' )) {
1405
+		if ($remove_all && $espresso_db_update = get_option('espresso_db_update')) {
1406 1406
 			$db_update_sans_ee4 = array();
1407
-			foreach($espresso_db_update as $version => $times_activated){
1408
-				if( $version[0] =='3'){//if its NON EE4
1407
+			foreach ($espresso_db_update as $version => $times_activated) {
1408
+				if ($version[0] == '3') {//if its NON EE4
1409 1409
 					$db_update_sans_ee4[$version] = $times_activated;
1410 1410
 				}
1411 1411
 			}
1412
-			update_option( 'espresso_db_update', $db_update_sans_ee4 );
1412
+			update_option('espresso_db_update', $db_update_sans_ee4);
1413 1413
 		}
1414 1414
 
1415 1415
 		$errors = '';
1416
-		if ( ! empty( $undeleted_tables )) {
1416
+		if ( ! empty($undeleted_tables)) {
1417 1417
 			$errors .= sprintf(
1418
-				__( 'The following tables could not be deleted: %s%s', 'event_espresso' ),
1418
+				__('The following tables could not be deleted: %s%s', 'event_espresso'),
1419 1419
 				'<br/>',
1420
-				implode( ',<br/>', $undeleted_tables )
1420
+				implode(',<br/>', $undeleted_tables)
1421 1421
 			);
1422 1422
 		}
1423
-		if ( ! empty( $undeleted_options )) {
1424
-			$errors .= ! empty( $undeleted_tables ) ? '<br/>' : '';
1423
+		if ( ! empty($undeleted_options)) {
1424
+			$errors .= ! empty($undeleted_tables) ? '<br/>' : '';
1425 1425
 			$errors .= sprintf(
1426
-				__( 'The following wp-options could not be deleted: %s%s', 'event_espresso' ),
1426
+				__('The following wp-options could not be deleted: %s%s', 'event_espresso'),
1427 1427
 				'<br/>',
1428
-				implode( ',<br/>', $undeleted_options )
1428
+				implode(',<br/>', $undeleted_options)
1429 1429
 			);
1430 1430
 
1431 1431
 		}
1432
-		if ( $errors != '' ) {
1433
-			EE_Error::add_attention( $errors, __FILE__, __FUNCTION__, __LINE__ );
1432
+		if ($errors != '') {
1433
+			EE_Error::add_attention($errors, __FILE__, __FUNCTION__, __LINE__);
1434 1434
 		}
1435 1435
 	}
1436 1436
 
@@ -1440,25 +1440,25 @@  discard block
 block discarded – undo
1440 1440
 	 * @param string $table_name with or without $wpdb->prefix
1441 1441
 	 * @return boolean
1442 1442
 	 */
1443
-	public static function table_exists( $table_name ){
1443
+	public static function table_exists($table_name) {
1444 1444
 		global $wpdb, $EZSQL_ERROR;
1445
-		if(strpos($table_name, $wpdb->prefix) !== 0){
1445
+		if (strpos($table_name, $wpdb->prefix) !== 0) {
1446 1446
 			$table_name = $wpdb->prefix.$table_name;
1447 1447
 		}
1448 1448
 		//ignore if this causes an sql error
1449 1449
 		$old_error = $wpdb->last_error;
1450 1450
 		$old_suppress_errors = $wpdb->suppress_errors();
1451
-		$old_show_errors_value = $wpdb->show_errors( FALSE );
1451
+		$old_show_errors_value = $wpdb->show_errors(FALSE);
1452 1452
 		$ezsql_error_cache = $EZSQL_ERROR;
1453
-		$wpdb->get_results( "SELECT * from $table_name LIMIT 1");
1454
-		$wpdb->show_errors( $old_show_errors_value );
1455
-		$wpdb->suppress_errors( $old_suppress_errors );
1453
+		$wpdb->get_results("SELECT * from $table_name LIMIT 1");
1454
+		$wpdb->show_errors($old_show_errors_value);
1455
+		$wpdb->suppress_errors($old_suppress_errors);
1456 1456
 		$new_error = $wpdb->last_error;
1457 1457
 		$wpdb->last_error = $old_error;
1458 1458
 		$EZSQL_ERROR = $ezsql_error_cache;
1459
-		if( empty( $new_error ) ){
1459
+		if (empty($new_error)) {
1460 1460
 			return TRUE;
1461
-		}else{
1461
+		} else {
1462 1462
 			return FALSE;
1463 1463
 		}
1464 1464
 	}
@@ -1466,7 +1466,7 @@  discard block
 block discarded – undo
1466 1466
 	/**
1467 1467
 	 * Resets the cache on EEH_Activation
1468 1468
 	 */
1469
-	public static function reset(){
1469
+	public static function reset() {
1470 1470
 		self::$_default_creator_id = NULL;
1471 1471
 		self::$_initialized_db_content_already_in_this_request = false;
1472 1472
 	}
Please login to merge, or discard this patch.
core/helpers/EEH_Form_Fields.helper.php 4 patches
Doc Comments   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -774,7 +774,7 @@  discard block
 block discarded – undo
774 774
 	 *
775 775
 	 * @param mixed $opt_group
776 776
 	 * @param mixed $QSOs
777
-	 * @param mixed $answer
777
+	 * @param string $answer
778 778
 	 * @return string
779 779
 	 */
780 780
 	private static function _generate_select_option_group( $opt_group, $QSOs, $answer ){
@@ -1122,7 +1122,7 @@  discard block
 block discarded – undo
1122 1122
 	/**
1123 1123
 	 * 	prep_required
1124 1124
 	 * @param string|array 	$required
1125
-	 * @return array
1125
+	 * @return string
1126 1126
 	 */
1127 1127
 	static function prep_required( $required = array() ){
1128 1128
 		// make sure required is an array
@@ -1173,8 +1173,8 @@  discard block
 block discarded – undo
1173 1173
 
1174 1174
 	/**
1175 1175
 	 * 	_load_system_dropdowns
1176
-	 * @param array 	$QFI
1177
-	 * @return array
1176
+	 * @param EE_Question_Form_Input 	$QFI
1177
+	 * @return EE_Question_Form_Input
1178 1178
 	 */
1179 1179
 	private static function _load_system_dropdowns( $QFI ){
1180 1180
 		$QST_system = $QFI->get('QST_system');
@@ -1463,7 +1463,7 @@  discard block
 block discarded – undo
1463 1463
 	 * @param    string   $nonce_action     - if using nonces
1464 1464
 	 * @param    bool|string $input_only       - whether to print form header and footer. TRUE returns the input without the form
1465 1465
 	 * @param    string   $extra_attributes - any extra attributes that need to be attached to the form input
1466
-	 * @return    void
1466
+	 * @return    string
1467 1467
 	 */
1468 1468
 	public static function submit_button( $url = '', $ID = '', $class = '', $text = '', $nonce_action = '', $input_only = FALSE, $extra_attributes = '' ) {
1469 1469
 		$btn = '';
Please login to merge, or discard this patch.
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -393,7 +393,7 @@  discard block
 block discarded – undo
393 393
 
394 394
 	/**
395 395
 	 * generate_question_groups_html
396
- 	 *
396
+	 *
397 397
 	 * @param string $question_groups
398 398
 	 * @return string HTML
399 399
 	 */
@@ -537,7 +537,7 @@  discard block
 block discarded – undo
537 537
 
538 538
 	/**
539 539
 	 * generate_form_input
540
- 	 *
540
+	 *
541 541
 	 * @param EE_Question_Form_Input $QFI
542 542
 	 * @return string HTML
543 543
 	 */
@@ -612,7 +612,7 @@  discard block
 block discarded – undo
612 612
 
613 613
 	/**
614 614
 	 * generates HTML for a form text input
615
- 	 *
615
+	 *
616 616
 	 * @param string $question 	label content
617 617
 	 * @param string $answer 		form input value attribute
618 618
 	 * @param string $name 			form input name attribute
@@ -657,7 +657,7 @@  discard block
 block discarded – undo
657 657
 
658 658
 	/**
659 659
 	 * generates HTML for a form textarea
660
- 	 *
660
+	 *
661 661
 	 * @param string $question 		label content
662 662
 	 * @param string $answer 		form input value attribute
663 663
 	 * @param string $name 			form input name attribute
@@ -708,7 +708,7 @@  discard block
 block discarded – undo
708 708
 
709 709
 	/**
710 710
 	 * generates HTML for a form select input
711
- 	 *
711
+	 *
712 712
 	 * @param string $question 		label content
713 713
 	 * @param string $answer 		form input value attribute
714 714
 	 * @param array $options			array of answer options where array key = option value and array value = option display text
@@ -885,7 +885,7 @@  discard block
 block discarded – undo
885 885
 
886 886
 	/**
887 887
 	 * generates HTML for form checkbox inputs
888
- 	 *
888
+	 *
889 889
 	 * @param string $question 		label content
890 890
 	 * @param string $answer 		form input value attribute
891 891
 	 * @param array $options 			array of options where array key = option value and array value = option display text
@@ -966,7 +966,7 @@  discard block
 block discarded – undo
966 966
 
967 967
 	/**
968 968
 	 * generates HTML for a form datepicker input
969
- 	 *
969
+	 *
970 970
 	 * @param string $question 	label content
971 971
 	 * @param string $answer 		form input value attribute
972 972
 	 * @param string $name 			form input name attribute
Please login to merge, or discard this patch.
Spacing   +381 added lines, -381 removed lines patch added patch discarded remove patch
@@ -57,10 +57,10 @@  discard block
 block discarded – undo
57 57
 	 * 	@return string
58 58
 	 * 	@todo: at some point we can break this down into other static methods to abstract it a bit better.
59 59
 	 */
60
-	static public function get_form_fields( $input_vars = array(), $id = FALSE ) {
60
+	static public function get_form_fields($input_vars = array(), $id = FALSE) {
61 61
 
62
-		if ( empty($input_vars) ) {
63
-			EE_Error::add_error( __('missing required variables for the form field generator', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
62
+		if (empty($input_vars)) {
63
+			EE_Error::add_error(__('missing required variables for the form field generator', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
64 64
 			return FALSE;
65 65
 		}
66 66
 
@@ -85,22 +85,22 @@  discard block
 block discarded – undo
85 85
 				'tabindex' => ''
86 86
 				);
87 87
 
88
-			$input_value = wp_parse_args( $input_value, $defaults );
88
+			$input_value = wp_parse_args($input_value, $defaults);
89 89
 
90 90
 			// required fields get a *
91 91
 			$required = isset($input_value['required']) && $input_value['required'] ? ' <span>*</span>: ' : ': ';
92 92
 			// and the css class "required"
93
-			$css_class = isset( $input_value['css_class'] ) ? $input_value['css_class'] : '';
94
-			$styles = $input_value['required'] ? 'required ' . $css_class : $css_class;
93
+			$css_class = isset($input_value['css_class']) ? $input_value['css_class'] : '';
94
+			$styles = $input_value['required'] ? 'required '.$css_class : $css_class;
95 95
 
96
-			$field_id = ($id) ? $id . '-' . $input_key : $input_key;
97
-			$tabindex = !empty($input_value['tabindex']) ? ' tabindex="' . $input_value['tabindex'] . '"' : '';
96
+			$field_id = ($id) ? $id.'-'.$input_key : $input_key;
97
+			$tabindex = ! empty($input_value['tabindex']) ? ' tabindex="'.$input_value['tabindex'].'"' : '';
98 98
 
99 99
 			//rows or cols?
100
-			$rows = isset($input_value['rows'] ) ? $input_value['rows'] : '10';
101
-			$cols = isset($input_value['cols'] ) ? $input_value['cols'] : '80';
100
+			$rows = isset($input_value['rows']) ? $input_value['rows'] : '10';
101
+			$cols = isset($input_value['cols']) ? $input_value['cols'] : '80';
102 102
 
103
-			$output .= (!$close) ? '<ul>' : '';
103
+			$output .= ( ! $close) ? '<ul>' : '';
104 104
 			$output .= '<li>';
105 105
 
106 106
 			// what type of input are we dealing with ?
@@ -108,15 +108,15 @@  discard block
 block discarded – undo
108 108
 
109 109
 				// text inputs
110 110
 				case 'text' :
111
-					$output .= "\n\t\t\t" . '<label for="' . $field_id . '">' . $input_value['label'] . $required . '</label>';
112
-					$output .= "\n\t\t\t" . '<input id="' . $field_id . '" class="' . $styles . '" type="text" value="' . $input_value['value'] . '" name="' . $input_value['name'] . '"' . $tabindex . '>';
111
+					$output .= "\n\t\t\t".'<label for="'.$field_id.'">'.$input_value['label'].$required.'</label>';
112
+					$output .= "\n\t\t\t".'<input id="'.$field_id.'" class="'.$styles.'" type="text" value="'.$input_value['value'].'" name="'.$input_value['name'].'"'.$tabindex.'>';
113 113
 					break;
114 114
 
115 115
 				// dropdowns
116 116
 				case 'select' :
117 117
 
118
-					$output .= "\n\t\t\t" . '<label for="' . $field_id . '">' . $input_value['label'] . $required . '</label>';
119
-					$output .= "\n\t\t\t" . '<select id="' . $field_id . '" class="' . $styles . '" name="' . $input_value['name'] . '"' . $tabindex . '>';
118
+					$output .= "\n\t\t\t".'<label for="'.$field_id.'">'.$input_value['label'].$required.'</label>';
119
+					$output .= "\n\t\t\t".'<select id="'.$field_id.'" class="'.$styles.'" name="'.$input_value['name'].'"'.$tabindex.'>';
120 120
 
121 121
 					if (is_array($input_value['options'])) {
122 122
 						$options = $input_value['options'];
@@ -125,30 +125,30 @@  discard block
 block discarded – undo
125 125
 					}
126 126
 
127 127
 					foreach ($options as $key => $value) {
128
-						$selected = isset( $input_value['value'] ) && $input_value['value'] == $key ? 'selected=selected' : '';
128
+						$selected = isset($input_value['value']) && $input_value['value'] == $key ? 'selected=selected' : '';
129 129
 						//$key = str_replace( ' ', '_', sanitize_key( $value ));
130
-						$output .= "\n\t\t\t\t" . '<option '. $selected . ' value="' . $key . '">' . $value . '</option>';
130
+						$output .= "\n\t\t\t\t".'<option '.$selected.' value="'.$key.'">'.$value.'</option>';
131 131
 					}
132
-					$output .= "\n\t\t\t" . '</select>';
132
+					$output .= "\n\t\t\t".'</select>';
133 133
 
134 134
 					break;
135 135
 
136 136
 				case 'textarea' :
137 137
 
138
-					$output .= "\n\t\t\t" . '<label for="' . $field_id . '">' . $input_value['label'] . $required . '</label>';
139
-					$output .= "\n\t\t\t" . '<textarea id="' . $field_id . '" class="' . $styles . '" rows="'.$rows.'" cols="'.$cols.'" name="' . $input_value['name'] . '"' . $tabindex . '>' . $input_value['value'] . '</textarea>';
138
+					$output .= "\n\t\t\t".'<label for="'.$field_id.'">'.$input_value['label'].$required.'</label>';
139
+					$output .= "\n\t\t\t".'<textarea id="'.$field_id.'" class="'.$styles.'" rows="'.$rows.'" cols="'.$cols.'" name="'.$input_value['name'].'"'.$tabindex.'>'.$input_value['value'].'</textarea>';
140 140
 					break;
141 141
 
142 142
 				case 'hidden' :
143 143
 					$close = false;
144 144
 					$output .= "</li></ul>";
145
-					$output .= "\n\t\t\t" . '<input id="' . $field_id . '" type="hidden" name="' . $input_value['name'] . '" value="' . $input_value['value'] . '">';
145
+					$output .= "\n\t\t\t".'<input id="'.$field_id.'" type="hidden" name="'.$input_value['name'].'" value="'.$input_value['value'].'">';
146 146
 					break;
147 147
 
148 148
 				case 'checkbox' :
149
-					$checked = ( $input_value['value'] == 1 ) ? 'checked="checked"' : '';
150
-					$output .= "\n\t\t\t" . '<label for="' . $field_id . '">' . $input_value['label'] . $required . '</label>';
151
-					$output .= "\n\t\t\t" . '<input id="' . $field_id. '" type="checkbox" name="' . $input_value['name'] . '" value="1"' . $checked . $tabindex . ' />';
149
+					$checked = ($input_value['value'] == 1) ? 'checked="checked"' : '';
150
+					$output .= "\n\t\t\t".'<label for="'.$field_id.'">'.$input_value['label'].$required.'</label>';
151
+					$output .= "\n\t\t\t".'<input id="'.$field_id.'" type="checkbox" name="'.$input_value['name'].'" value="1"'.$checked.$tabindex.' />';
152 152
 					break;
153 153
 
154 154
 				case 'wp_editor' :
@@ -161,9 +161,9 @@  discard block
 block discarded – undo
161 161
 					);
162 162
 					$output .= '</li>';
163 163
 					$output .= '</ul>';
164
-					$output .= '<h4>' . $input_value['label'] . '</h4>';
164
+					$output .= '<h4>'.$input_value['label'].'</h4>';
165 165
 					ob_start();
166
-					wp_editor( $input_value['value'], $field_id, $editor_settings);
166
+					wp_editor($input_value['value'], $field_id, $editor_settings);
167 167
 					$editor = ob_get_contents();
168 168
 					ob_end_clean();
169 169
 					$output .= $editor;
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
 		$form_fields = array();
209 209
 		$fields = (array) $fields;
210 210
 
211
-		foreach ( $fields as $field_name => $field_atts ) {
211
+		foreach ($fields as $field_name => $field_atts) {
212 212
 			//defaults:
213 213
 			$defaults = array(
214 214
 				'label' => '',
@@ -226,67 +226,67 @@  discard block
 block discarded – undo
226 226
 				'wpeditor_args' => array()
227 227
 				);
228 228
 			// merge defaults with passed arguments
229
-			$_fields = wp_parse_args( $field_atts, $defaults);
230
-			extract( $_fields );
229
+			$_fields = wp_parse_args($field_atts, $defaults);
230
+			extract($_fields);
231 231
 			// generate label
232
-			$label = empty($label) ? '' : '<label for="' . $id . '">' . $label . '</label>';
232
+			$label = empty($label) ? '' : '<label for="'.$id.'">'.$label.'</label>';
233 233
 			// generate field name
234
-			$f_name = !empty($unique_id) ? $field_name . '[' . $unique_id . ']' : $field_name;
234
+			$f_name = ! empty($unique_id) ? $field_name.'['.$unique_id.']' : $field_name;
235 235
 
236 236
 			//tabindex
237
-			$tabindex_str = !empty( $tabindex ) ? ' tabindex="' . $tabindex . '"' : '';
237
+			$tabindex_str = ! empty($tabindex) ? ' tabindex="'.$tabindex.'"' : '';
238 238
 
239 239
 			//we determine what we're building based on the type
240
-			switch ( $type ) {
240
+			switch ($type) {
241 241
 
242 242
 				case 'textarea' :
243
-						$fld = '<textarea id="' . $id . '" class="' . $class . '" rows="' . $dimensions[1] . '" cols="' . $dimensions[0] . '" name="' . $f_name . '"' . $tabindex_str . '>' . $value . '</textarea>';
243
+						$fld = '<textarea id="'.$id.'" class="'.$class.'" rows="'.$dimensions[1].'" cols="'.$dimensions[0].'" name="'.$f_name.'"'.$tabindex_str.'>'.$value.'</textarea>';
244 244
 						$fld .= $extra_desc;
245 245
 					break;
246 246
 
247 247
 				case 'checkbox' :
248 248
 						$c_input = '';
249
-						if ( is_array($value) ) {
250
-							foreach ( $value as $key => $val ) {
251
-								$c_id = $field_name . '_' . $value;
252
-								$c_class = isset($classes[$key]) ? ' class="' . $classes[$key] . '" ' : '';
253
-								$c_label = isset($labels[$key]) ? '<label for="' . $c_id . '">' . $labels[$key] . '</label>' : '';
254
-								$checked = !empty($default) && $default == $val ? ' checked="checked" ' : '';
255
-								$c_input .= '<input name="' . $f_name . '[]" type="checkbox" id="' . $c_id . '"' . $c_class . 'value="' . $val . '"' . $checked . $tabindex_str . ' />' . "\n" . $c_label;
249
+						if (is_array($value)) {
250
+							foreach ($value as $key => $val) {
251
+								$c_id = $field_name.'_'.$value;
252
+								$c_class = isset($classes[$key]) ? ' class="'.$classes[$key].'" ' : '';
253
+								$c_label = isset($labels[$key]) ? '<label for="'.$c_id.'">'.$labels[$key].'</label>' : '';
254
+								$checked = ! empty($default) && $default == $val ? ' checked="checked" ' : '';
255
+								$c_input .= '<input name="'.$f_name.'[]" type="checkbox" id="'.$c_id.'"'.$c_class.'value="'.$val.'"'.$checked.$tabindex_str.' />'."\n".$c_label;
256 256
 							}
257 257
 							$fld = $c_input;
258 258
 						} else {
259
-							$checked = !empty($default) && $default == $val ? 'checked="checked" ' : '';
260
-							$fld = '<input name="'. $f_name . '" type="checkbox" id="' . $id . '" class="' . $class . '" value="' . $value . '"' . $checked . $tabindex_str . ' />' . "\n";
259
+							$checked = ! empty($default) && $default == $val ? 'checked="checked" ' : '';
260
+							$fld = '<input name="'.$f_name.'" type="checkbox" id="'.$id.'" class="'.$class.'" value="'.$value.'"'.$checked.$tabindex_str.' />'."\n";
261 261
 						}
262 262
 					break;
263 263
 
264 264
 				case 'radio' :
265 265
 						$c_input = '';
266
-						if ( is_array($value) ) {
267
-							foreach ( $value as $key => $val ) {
268
-								$c_id = $field_name . '_' . $value;
269
-								$c_class = isset($classes[$key]) ? 'class="' . $classes[$key] . '" ' : '';
270
-								$c_label = isset($labels[$key]) ? '<label for="' . $c_id . '">' . $labels[$key] . '</label>' : '';
271
-								$checked = !empty($default) && $default == $val ? ' checked="checked" ' : '';
272
-								$c_input .= '<input name="' . $f_name . '" type="checkbox" id="' . $c_id . '"' . $c_class . 'value="' . $val . '"' . $checked . $tabindex_str . ' />' . "\n" . $c_label;
266
+						if (is_array($value)) {
267
+							foreach ($value as $key => $val) {
268
+								$c_id = $field_name.'_'.$value;
269
+								$c_class = isset($classes[$key]) ? 'class="'.$classes[$key].'" ' : '';
270
+								$c_label = isset($labels[$key]) ? '<label for="'.$c_id.'">'.$labels[$key].'</label>' : '';
271
+								$checked = ! empty($default) && $default == $val ? ' checked="checked" ' : '';
272
+								$c_input .= '<input name="'.$f_name.'" type="checkbox" id="'.$c_id.'"'.$c_class.'value="'.$val.'"'.$checked.$tabindex_str.' />'."\n".$c_label;
273 273
 							}
274 274
 							$fld = $c_input;
275 275
 						} else {
276
-							$checked = !empty($default) && $default == $val ? 'checked="checked" ' : '';
277
-							$fld = '<input name="'. $f_name . '" type="checkbox" id="' . $id . '" class="' . $class . '" value="' . $value . '"' . $checked . $tabindex_str . ' />' . "\n";
276
+							$checked = ! empty($default) && $default == $val ? 'checked="checked" ' : '';
277
+							$fld = '<input name="'.$f_name.'" type="checkbox" id="'.$id.'" class="'.$class.'" value="'.$value.'"'.$checked.$tabindex_str.' />'."\n";
278 278
 						}
279 279
 					break;
280 280
 
281 281
 				case 'hidden' :
282
-						$fld = '<input name="' . $f_name . '" type="hidden" id="' . $id . '" class="' . $class . '" value="' . $value . '" />' . "\n";
282
+						$fld = '<input name="'.$f_name.'" type="hidden" id="'.$id.'" class="'.$class.'" value="'.$value.'" />'."\n";
283 283
 					break;
284 284
 
285 285
 				case 'select' :
286
-						$fld = '<select name="' . $f_name . '" class="' . $class . '" id="' . $id . '"' . $tabindex_str . '>' . "\n";
287
-						foreach ( $value as $key => $val ) {
288
-							$checked = !empty($default) && $default == $val ? ' selected="selected"' : '';
289
-							$fld .= "\t" . '<option value="' . $val . '"' . $checked . '>' . $labels[$key] . '</option>' . "\n";
286
+						$fld = '<select name="'.$f_name.'" class="'.$class.'" id="'.$id.'"'.$tabindex_str.'>'."\n";
287
+						foreach ($value as $key => $val) {
288
+							$checked = ! empty($default) && $default == $val ? ' selected="selected"' : '';
289
+							$fld .= "\t".'<option value="'.$val.'"'.$checked.'>'.$labels[$key].'</option>'."\n";
290 290
 						}
291 291
 						$fld .= '</select>';
292 292
 					break;
@@ -298,21 +298,21 @@  discard block
 block discarded – undo
298 298
 							'editor_class' => $class,
299 299
 							'tabindex' => $tabindex
300 300
 							);
301
-						$editor_settings = array_merge( $wpeditor_args, $editor_settings );
301
+						$editor_settings = array_merge($wpeditor_args, $editor_settings);
302 302
 						ob_start();
303
-						wp_editor( $value, $id, $editor_settings );
303
+						wp_editor($value, $id, $editor_settings);
304 304
 						$editor = ob_get_contents();
305 305
 						ob_end_clean();
306 306
 						$fld = $editor;
307 307
 					break;
308 308
 
309 309
 				default : //'text fields'
310
-						$fld = '<input name="' . $f_name . '" type="text" id="' . $id . '" class="' . $class . '" value="' . $value . '"' . $tabindex_str . ' />' . "\n";
310
+						$fld = '<input name="'.$f_name.'" type="text" id="'.$id.'" class="'.$class.'" value="'.$value.'"'.$tabindex_str.' />'."\n";
311 311
 						$fld .= $extra_desc;
312 312
 
313 313
 			}
314 314
 
315
-			$form_fields[ $field_name ] = array( 'label' => $label, 'field' => $fld );
315
+			$form_fields[$field_name] = array('label' => $label, 'field' => $fld);
316 316
 		}
317 317
 
318 318
 		return $form_fields;
@@ -341,22 +341,22 @@  discard block
 block discarded – undo
341 341
 	 */
342 342
 	static public function select_input($name, $values, $default = '', $parameters = '', $class = '', $autosize = true) {
343 343
 		//if $values was submitted in the wrong format, convert it over
344
-		if(!empty($values) && (!array_key_exists(0,$values) || !is_array($values[0]))){
345
-			$converted_values=array();
346
-			foreach($values as $id=>$text){
347
-				$converted_values[]=array('id'=>$id,'text'=>$text);
344
+		if ( ! empty($values) && ( ! array_key_exists(0, $values) || ! is_array($values[0]))) {
345
+			$converted_values = array();
346
+			foreach ($values as $id=>$text) {
347
+				$converted_values[] = array('id'=>$id, 'text'=>$text);
348 348
 			}
349
-			$values=$converted_values;
349
+			$values = $converted_values;
350 350
 		}
351 351
 		//load formatter helper
352
-		EE_Registry::instance()->load_helper( 'Formatter' );
352
+		EE_Registry::instance()->load_helper('Formatter');
353 353
 		//EE_Registry::instance()->load_helper( 'Formatter' );
354 354
 
355
-		$field = '<select id="' . EEH_Formatter::ee_tep_output_string($name) . '" name="' . EEH_Formatter::ee_tep_output_string($name) . '"';
355
+		$field = '<select id="'.EEH_Formatter::ee_tep_output_string($name).'" name="'.EEH_Formatter::ee_tep_output_string($name).'"';
356 356
 		//Debug
357 357
 		//EEH_Debug_Tools::printr( $values, '$values  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
358
-		if ( EEH_Formatter::ee_tep_not_null($parameters))
359
-			$field .= ' ' . $parameters;
358
+		if (EEH_Formatter::ee_tep_not_null($parameters))
359
+			$field .= ' '.$parameters;
360 360
 		if ($autosize) {
361 361
 			$size = 'med';
362 362
 			for ($ii = 0, $ni = sizeof($values); $ii < $ni; $ii++) {
@@ -368,18 +368,18 @@  discard block
 block discarded – undo
368 368
 		} else
369 369
 			$size = '';
370 370
 
371
-		$field .= ' class="' . $class . ' ' . $size . '">';
371
+		$field .= ' class="'.$class.' '.$size.'">';
372 372
 
373 373
 		if (empty($default) && isset($GLOBALS[$name]))
374 374
 			$default = stripslashes($GLOBALS[$name]);
375 375
 
376 376
 
377 377
 		for ($i = 0, $n = sizeof($values); $i < $n; $i++) {
378
-			$field .= '<option value="' . $values[$i]['id'] . '"';
378
+			$field .= '<option value="'.$values[$i]['id'].'"';
379 379
 			if ($default == $values[$i]['id']) {
380 380
 				$field .= ' selected = "selected"';
381 381
 			}
382
-			$field .= '>' . $values[$i]['text'] . '</option>';
382
+			$field .= '>'.$values[$i]['text'].'</option>';
383 383
 		}
384 384
 		$field .= '</select>';
385 385
 
@@ -397,38 +397,38 @@  discard block
 block discarded – undo
397 397
 	 * @param string $question_groups
398 398
 	 * @return string HTML
399 399
 	 */
400
-	static function generate_question_groups_html( $question_groups = array(), $group_wrapper = 'fieldset' ) {
400
+	static function generate_question_groups_html($question_groups = array(), $group_wrapper = 'fieldset') {
401 401
 
402 402
 		$html = '';
403
-		$before_question_group_questions = apply_filters( 'FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions', '' );
404
-		$after_question_group_questions = apply_filters( 'FHEE__EEH_Form_Fields__generate_question_groups_html__after_question_group_questions', '' );
403
+		$before_question_group_questions = apply_filters('FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions', '');
404
+		$after_question_group_questions = apply_filters('FHEE__EEH_Form_Fields__generate_question_groups_html__after_question_group_questions', '');
405 405
 
406
-		if ( ! empty( $question_groups )) {
406
+		if ( ! empty($question_groups)) {
407 407
 			//EEH_Debug_Tools::printr( $question_groups, '$question_groups  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
408 408
 			// loop thru question groups
409
-			foreach ( $question_groups as $QSG ) {
409
+			foreach ($question_groups as $QSG) {
410 410
 				// check that questions exist
411
-				if ( ! empty( $QSG['QSG_questions'] )) {
411
+				if ( ! empty($QSG['QSG_questions'])) {
412 412
 					// use fieldsets
413
-					$html .= "\n\t" . '<' . $group_wrapper . ' class="espresso-question-group-wrap" id="' . $QSG['QSG_identifier'] . '">';
413
+					$html .= "\n\t".'<'.$group_wrapper.' class="espresso-question-group-wrap" id="'.$QSG['QSG_identifier'].'">';
414 414
 					// group_name
415
-					$html .= $QSG['QSG_show_group_name'] ? "\n\t\t" . '<h5 class="espresso-question-group-title-h5 section-title">' . self::prep_answer( $QSG['QSG_name'] ) . '</h5>' : '';
415
+					$html .= $QSG['QSG_show_group_name'] ? "\n\t\t".'<h5 class="espresso-question-group-title-h5 section-title">'.self::prep_answer($QSG['QSG_name']).'</h5>' : '';
416 416
 					// group_desc
417
-					$html .= $QSG['QSG_show_group_desc'] && ! empty( $QSG['QSG_desc'] ) ? '<div class="espresso-question-group-desc-pg">' . self::prep_answer( $QSG['QSG_desc'] ) . '</div>' : '';
417
+					$html .= $QSG['QSG_show_group_desc'] && ! empty($QSG['QSG_desc']) ? '<div class="espresso-question-group-desc-pg">'.self::prep_answer($QSG['QSG_desc']).'</div>' : '';
418 418
 
419 419
 					$html .= $before_question_group_questions;
420 420
 					// loop thru questions
421
-					foreach ( $QSG['QSG_questions'] as $question ) {
421
+					foreach ($QSG['QSG_questions'] as $question) {
422 422
 //						EEH_Debug_Tools::printr( $question, '$question  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
423 423
 						$QFI = new EE_Question_Form_Input(
424 424
 							$question['qst_obj'],
425 425
 							$question['ans_obj'],
426 426
 							$question
427 427
 						);
428
-						$html .= self::generate_form_input( $QFI );
428
+						$html .= self::generate_form_input($QFI);
429 429
 					}
430 430
 					$html .= $after_question_group_questions;
431
-					$html .= "\n\t" . '</' . $group_wrapper . '>';
431
+					$html .= "\n\t".'</'.$group_wrapper.'>';
432 432
 				}
433 433
 			}
434 434
 		}
@@ -448,11 +448,11 @@  discard block
 block discarded – undo
448 448
 	 * @param string       $group_wrapper
449 449
 	 * @return string HTML
450 450
 	 */
451
-	static function generate_question_groups_html2( $question_groups = array(), $q_meta = array(), 	$from_admin = FALSE, $group_wrapper = 'fieldset' ) {
451
+	static function generate_question_groups_html2($question_groups = array(), $q_meta = array(), $from_admin = FALSE, $group_wrapper = 'fieldset') {
452 452
 
453 453
 		$html = '';
454
-		$before_question_group_questions = apply_filters( 'FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions', '' );
455
-		$after_question_group_questions = apply_filters( 'FHEE__EEH_Form_Fields__generate_question_groups_html__after_question_group_questions', '' );
454
+		$before_question_group_questions = apply_filters('FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions', '');
455
+		$after_question_group_questions = apply_filters('FHEE__EEH_Form_Fields__generate_question_groups_html__after_question_group_questions', '');
456 456
 
457 457
 		$default_q_meta = array(
458 458
 				'att_nmbr' => 1,
@@ -461,55 +461,55 @@  discard block
 block discarded – undo
461 461
 				'input_id' => '',
462 462
 				'input_class' => ''
463 463
 		);
464
-		$q_meta = array_merge( $default_q_meta, $q_meta );
464
+		$q_meta = array_merge($default_q_meta, $q_meta);
465 465
 		//EEH_Debug_Tools::printr( $q_meta, '$q_meta  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
466 466
 
467
-		if ( ! empty( $question_groups )) {
467
+		if ( ! empty($question_groups)) {
468 468
 //			EEH_Debug_Tools::printr( $question_groups, '$question_groups  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
469 469
 			// loop thru question groups
470
-			foreach ( $question_groups as $QSG ) {
471
-				if ( $QSG instanceof EE_Question_Group ) {
470
+			foreach ($question_groups as $QSG) {
471
+				if ($QSG instanceof EE_Question_Group) {
472 472
 					// check that questions exist
473 473
 
474
-					$where = array( 'QST_deleted' => 0 );
475
-					if ( ! $from_admin ) {
474
+					$where = array('QST_deleted' => 0);
475
+					if ( ! $from_admin) {
476 476
 						$where['QST_admin_only'] = 0;
477 477
 					}
478
-					$questions = $QSG->questions( array( $where, 'order_by' => array( 'Question_Group_Question.QGQ_order' => 'ASC' )));
479
-					if ( ! empty( $questions )) {
478
+					$questions = $QSG->questions(array($where, 'order_by' => array('Question_Group_Question.QGQ_order' => 'ASC')));
479
+					if ( ! empty($questions)) {
480 480
 						// use fieldsets
481
-						$html .= "\n\t" . '<' . $group_wrapper . ' class="espresso-question-group-wrap" id="' . $QSG->get( 'QSG_identifier' ) . '">';
481
+						$html .= "\n\t".'<'.$group_wrapper.' class="espresso-question-group-wrap" id="'.$QSG->get('QSG_identifier').'">';
482 482
 						// group_name
483
-						if ( $QSG->show_group_name() ) {
484
-							$html .=  "\n\t\t" . '<h5 class="espresso-question-group-title-h5 section-title">' . $QSG->get_pretty( 'QSG_name' ) . '</h5>';
483
+						if ($QSG->show_group_name()) {
484
+							$html .= "\n\t\t".'<h5 class="espresso-question-group-title-h5 section-title">'.$QSG->get_pretty('QSG_name').'</h5>';
485 485
 						}
486 486
 						// group_desc
487
-						if ( $QSG->show_group_desc() ) {
488
-							$html .=  '<div class="espresso-question-group-desc-pg">' . $QSG->get_pretty( 'QSG_desc'  ) . '</div>';
487
+						if ($QSG->show_group_desc()) {
488
+							$html .= '<div class="espresso-question-group-desc-pg">'.$QSG->get_pretty('QSG_desc').'</div>';
489 489
 						}
490 490
 
491 491
 						$html .= $before_question_group_questions;
492 492
 						// loop thru questions
493
-						foreach ( $questions as $QST ) {
493
+						foreach ($questions as $QST) {
494 494
 							$qstn_id = $QST->is_system_question() ? $QST->system_ID() : $QST->ID();
495 495
 
496 496
 							$answer = NULL;
497 497
 
498
-							if (  isset( $_GET['qstn'] ) && isset( $q_meta['input_id'] ) && isset( $q_meta['att_nmbr'] )) {
498
+							if (isset($_GET['qstn']) && isset($q_meta['input_id']) && isset($q_meta['att_nmbr'])) {
499 499
 								// check for answer in $_GET in case we are reprocessing a form after an error
500
-								if ( isset( $_GET['qstn'][ $q_meta['input_id'] ][ $qstn_id ] )) {
501
-									$answer = is_array( $_GET['qstn'][ $q_meta['input_id'] ][ $qstn_id ] ) ? $_GET['qstn'][ $q_meta['input_id'] ][ $qstn_id ] : sanitize_text_field( $_GET['qstn'][ $q_meta['input_id'] ][ $qstn_id ] );
500
+								if (isset($_GET['qstn'][$q_meta['input_id']][$qstn_id])) {
501
+									$answer = is_array($_GET['qstn'][$q_meta['input_id']][$qstn_id]) ? $_GET['qstn'][$q_meta['input_id']][$qstn_id] : sanitize_text_field($_GET['qstn'][$q_meta['input_id']][$qstn_id]);
502 502
 								}
503
-							} else if ( isset( $q_meta['attendee'] ) && $q_meta['attendee'] ) {
503
+							} else if (isset($q_meta['attendee']) && $q_meta['attendee']) {
504 504
 								//attendee data from the session
505
-								$answer = isset( $q_meta['attendee'][ $qstn_id ] ) ? $q_meta['attendee'][ $qstn_id ] : NULL;
505
+								$answer = isset($q_meta['attendee'][$qstn_id]) ? $q_meta['attendee'][$qstn_id] : NULL;
506 506
 							}
507 507
 
508 508
 
509 509
 
510 510
 							$QFI = new EE_Question_Form_Input(
511 511
 									$QST,
512
-									EE_Answer::new_instance ( array(
512
+									EE_Answer::new_instance(array(
513 513
 											'ANS_ID'=> 0,
514 514
 											'QST_ID'=> 0,
515 515
 											'REG_ID'=> 0,
@@ -518,10 +518,10 @@  discard block
 block discarded – undo
518 518
 									$q_meta
519 519
 							);
520 520
 							//EEH_Debug_Tools::printr( $QFI, '$QFI  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
521
-							$html .= self::generate_form_input( $QFI );
521
+							$html .= self::generate_form_input($QFI);
522 522
 						}
523 523
 						$html .= $after_question_group_questions;
524
-						$html .= "\n\t" . '</' . $group_wrapper . '>';
524
+						$html .= "\n\t".'</'.$group_wrapper.'>';
525 525
 					}
526 526
 				}
527 527
 			}
@@ -541,63 +541,63 @@  discard block
 block discarded – undo
541 541
 	 * @param EE_Question_Form_Input $QFI
542 542
 	 * @return string HTML
543 543
 	 */
544
-	static function generate_form_input( EE_Question_Form_Input $QFI ) {
545
-		if ( isset( $QFI->QST_admin_only) && $QFI->QST_admin_only && ! is_admin() ) {
544
+	static function generate_form_input(EE_Question_Form_Input $QFI) {
545
+		if (isset($QFI->QST_admin_only) && $QFI->QST_admin_only && ! is_admin()) {
546 546
 			return '';
547 547
 		}
548 548
 
549
-		$QFI = self::_load_system_dropdowns( $QFI );
550
-		$QFI = self::_load_specialized_dropdowns( $QFI );
549
+		$QFI = self::_load_system_dropdowns($QFI);
550
+		$QFI = self::_load_specialized_dropdowns($QFI);
551 551
 
552 552
 		//we also need to verify
553 553
 
554 554
 		$display_text = $QFI->get('QST_display_text');
555 555
 		$input_name = $QFI->get('QST_input_name');
556
-		$answer = EE_Registry::instance()->REQ->is_set( $input_name ) ? EE_Registry::instance()->REQ->get( $input_name ) : $QFI->get('ANS_value');
556
+		$answer = EE_Registry::instance()->REQ->is_set($input_name) ? EE_Registry::instance()->REQ->get($input_name) : $QFI->get('ANS_value');
557 557
 		$input_id = $QFI->get('QST_input_id');
558 558
 		$input_class = $QFI->get('QST_input_class');
559 559
 //		$disabled = $QFI->get('QST_disabled') ? ' disabled="disabled"' : '';
560 560
 		$disabled = $QFI->get('QST_disabled') ? TRUE : FALSE;
561
-		$required_label = apply_filters(' FHEE__EEH_Form_Fields__generate_form_input__required_label', '<em>*</em>' );
561
+		$required_label = apply_filters(' FHEE__EEH_Form_Fields__generate_form_input__required_label', '<em>*</em>');
562 562
 		$QST_required = $QFI->get('QST_required');
563
-		$required = $QST_required ? array( 'label' => $required_label, 'class' => 'required needs-value', 'title' => $QST_required ) : array();
564
-		$use_html_entities = $QFI->get_meta( 'htmlentities' );
565
-		$required_text = $QFI->get('QST_required_text') != '' ? $QFI->get('QST_required_text') : __( 'This field is required', 'event_espresso' );
566
-		$required_text = $QST_required ? "\n\t\t\t" . '<div class="required-text hidden">' . self::prep_answer( $required_text, $use_html_entities ) . '</div>' : '';
563
+		$required = $QST_required ? array('label' => $required_label, 'class' => 'required needs-value', 'title' => $QST_required) : array();
564
+		$use_html_entities = $QFI->get_meta('htmlentities');
565
+		$required_text = $QFI->get('QST_required_text') != '' ? $QFI->get('QST_required_text') : __('This field is required', 'event_espresso');
566
+		$required_text = $QST_required ? "\n\t\t\t".'<div class="required-text hidden">'.self::prep_answer($required_text, $use_html_entities).'</div>' : '';
567 567
 		$label_class = 'espresso-form-input-lbl';
568
-		$QST_options = $QFI->options(true,$answer);
569
-		$options = is_array( $QST_options ) ? self::prep_answer_options( $QST_options ) : array();
568
+		$QST_options = $QFI->options(true, $answer);
569
+		$options = is_array($QST_options) ? self::prep_answer_options($QST_options) : array();
570 570
 		$system_ID = $QFI->get('QST_system');
571
-		$label_b4 = $QFI->get_meta( 'label_b4' );
572
-		$use_desc_4_label = $QFI->get_meta( 'use_desc_4_label' );
571
+		$label_b4 = $QFI->get_meta('label_b4');
572
+		$use_desc_4_label = $QFI->get_meta('use_desc_4_label');
573 573
 
574 574
 
575
-		switch ( $QFI->get('QST_type') ){
575
+		switch ($QFI->get('QST_type')) {
576 576
 
577 577
 			case 'TEXTAREA' :
578
-					return EEH_Form_Fields::textarea( $display_text, $answer, $input_name, $input_id, $input_class, array(), $required, $required_text, $label_class, $disabled, $system_ID, $use_html_entities );
578
+					return EEH_Form_Fields::textarea($display_text, $answer, $input_name, $input_id, $input_class, array(), $required, $required_text, $label_class, $disabled, $system_ID, $use_html_entities);
579 579
 				break;
580 580
 
581 581
 			case 'DROPDOWN' :
582
-					return EEH_Form_Fields::select( $display_text, $answer, $options, $input_name, $input_id, $input_class, $required, $required_text, $label_class, $disabled, $system_ID, $use_html_entities, TRUE );
582
+					return EEH_Form_Fields::select($display_text, $answer, $options, $input_name, $input_id, $input_class, $required, $required_text, $label_class, $disabled, $system_ID, $use_html_entities, TRUE);
583 583
 				break;
584 584
 
585 585
 
586 586
 			case 'RADIO_BTN' :
587
-					return EEH_Form_Fields::radio( $display_text, $answer, $options, $input_name, $input_id, $input_class, $required, $required_text, $label_class, $disabled, $system_ID, $use_html_entities, $label_b4, $use_desc_4_label );
587
+					return EEH_Form_Fields::radio($display_text, $answer, $options, $input_name, $input_id, $input_class, $required, $required_text, $label_class, $disabled, $system_ID, $use_html_entities, $label_b4, $use_desc_4_label);
588 588
 				break;
589 589
 
590 590
 			case 'CHECKBOX' :
591
-					return EEH_Form_Fields::checkbox( $display_text, $answer, $options, $input_name, $input_id, $input_class, $required, $required_text, $label_class, $disabled, $system_ID, $use_html_entities );
591
+					return EEH_Form_Fields::checkbox($display_text, $answer, $options, $input_name, $input_id, $input_class, $required, $required_text, $label_class, $disabled, $system_ID, $use_html_entities);
592 592
 				break;
593 593
 
594 594
 			case 'DATE' :
595
-					return EEH_Form_Fields::datepicker( $display_text, $answer, $input_name, $input_id, $input_class, $required, $required_text, $label_class, $disabled, $system_ID, $use_html_entities );
595
+					return EEH_Form_Fields::datepicker($display_text, $answer, $input_name, $input_id, $input_class, $required, $required_text, $label_class, $disabled, $system_ID, $use_html_entities);
596 596
 				break;
597 597
 
598 598
 			case 'TEXT' :
599 599
 			default:
600
-					return EEH_Form_Fields::text( $display_text, $answer, $input_name, $input_id, $input_class, $required, $required_text, $label_class, $disabled, $system_ID, $use_html_entities );
600
+					return EEH_Form_Fields::text($display_text, $answer, $input_name, $input_id, $input_class, $required, $required_text, $label_class, $disabled, $system_ID, $use_html_entities);
601 601
 				break;
602 602
 
603 603
 		}
@@ -623,31 +623,31 @@  discard block
 block discarded – undo
623 623
 	 * @param string $disabled 		disabled="disabled" or null
624 624
 	 * @return string HTML
625 625
 	 */
626
-	static function text( $question = FALSE, $answer = NULL, $name = FALSE, $id = '', $class = '', $required = FALSE, $required_text = '', $label_class = '', $disabled = FALSE, $system_ID = FALSE, $use_html_entities = TRUE ) {
626
+	static function text($question = FALSE, $answer = NULL, $name = FALSE, $id = '', $class = '', $required = FALSE, $required_text = '', $label_class = '', $disabled = FALSE, $system_ID = FALSE, $use_html_entities = TRUE) {
627 627
 		// need these
628
-		if ( ! $question || ! $name ) {
628
+		if ( ! $question || ! $name) {
629 629
 			return NULL;
630 630
 		}
631 631
 		// prep the answer
632
-		$answer = is_array( $answer ) ? '' : self::prep_answer( $answer, $use_html_entities );
632
+		$answer = is_array($answer) ? '' : self::prep_answer($answer, $use_html_entities);
633 633
 		// prep the required array
634
-		$required = self::prep_required( $required );
634
+		$required = self::prep_required($required);
635 635
 		// set disabled tag
636
-		$disabled = $answer === NULL || ! $disabled  ? '' : ' disabled="disabled"';
636
+		$disabled = $answer === NULL || ! $disabled ? '' : ' disabled="disabled"';
637 637
 		// ya gots ta have style man!!!
638 638
 		$txt_class = is_admin() ? 'regular-text' : 'espresso-text-inp';
639
-		$class = empty( $class ) ? $txt_class : $class;
640
-		$class .= ! empty( $system_ID ) ? ' ' . $system_ID : '';
641
-		$extra = apply_filters( 'FHEE__EEH_Form_Fields__additional_form_field_attributes', '' );
639
+		$class = empty($class) ? $txt_class : $class;
640
+		$class .= ! empty($system_ID) ? ' '.$system_ID : '';
641
+		$extra = apply_filters('FHEE__EEH_Form_Fields__additional_form_field_attributes', '');
642 642
 
643
-		$label_html = $required_text . "\n\t\t\t" . '<label for="' . $name . '" class="' . $label_class . '">' . self::prep_question( $question ) . $required['label'] . '</label><br/>';
643
+		$label_html = $required_text."\n\t\t\t".'<label for="'.$name.'" class="'.$label_class.'">'.self::prep_question($question).$required['label'].'</label><br/>';
644 644
 		// filter label but ensure required text comes before it
645
-		$label_html = apply_filters( 'FHEE__EEH_Form_Fields__label_html', $label_html, $required_text );
645
+		$label_html = apply_filters('FHEE__EEH_Form_Fields__label_html', $label_html, $required_text);
646 646
 
647
-		$input_html = "\n\t\t\t" . '<input type="text" name="' . $name . '" id="' . $id . '" class="' . $class . ' ' . $required['class'] . '" value="' . $answer . '"  title="' . esc_attr( $required['msg'] ) . '" ' . $disabled .' ' . $extra . '/>';
647
+		$input_html = "\n\t\t\t".'<input type="text" name="'.$name.'" id="'.$id.'" class="'.$class.' '.$required['class'].'" value="'.$answer.'"  title="'.esc_attr($required['msg']).'" '.$disabled.' '.$extra.'/>';
648 648
 
649
-		$input_html =  apply_filters( 'FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id );
650
-		return  $label_html . $input_html;
649
+		$input_html = apply_filters('FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id);
650
+		return  $label_html.$input_html;
651 651
 
652 652
 	}
653 653
 
@@ -669,35 +669,35 @@  discard block
 block discarded – undo
669 669
 	 * @param string $disabled 		disabled="disabled" or null
670 670
 	 * @return string HTML
671 671
 	 */
672
-	static function textarea( $question = FALSE, $answer = NULL, $name = FALSE, $id = '', $class = '', $dimensions = FALSE, $required = FALSE, $required_text = '', $label_class = '', $disabled = FALSE, $system_ID = FALSE, $use_html_entities = TRUE ) {
672
+	static function textarea($question = FALSE, $answer = NULL, $name = FALSE, $id = '', $class = '', $dimensions = FALSE, $required = FALSE, $required_text = '', $label_class = '', $disabled = FALSE, $system_ID = FALSE, $use_html_entities = TRUE) {
673 673
 		// need these
674
-		if ( ! $question || ! $name ) {
674
+		if ( ! $question || ! $name) {
675 675
 			return NULL;
676 676
 		}
677 677
 		// prep the answer
678
-		$answer = is_array( $answer ) ? '' : self::prep_answer( $answer, $use_html_entities );
678
+		$answer = is_array($answer) ? '' : self::prep_answer($answer, $use_html_entities);
679 679
 		// prep the required array
680
-		$required = self::prep_required( $required );
680
+		$required = self::prep_required($required);
681 681
 		// make sure $dimensions is an array
682
-		$dimensions = is_array( $dimensions ) ? $dimensions : array();
682
+		$dimensions = is_array($dimensions) ? $dimensions : array();
683 683
 		// and set some defaults
684
-		$dimensions = array_merge( array( 'rows' => 3, 'cols' => 40 ), $dimensions );
684
+		$dimensions = array_merge(array('rows' => 3, 'cols' => 40), $dimensions);
685 685
 		// set disabled tag
686
-		$disabled = $answer === NULL || ! $disabled  ? '' : ' disabled="disabled"';
686
+		$disabled = $answer === NULL || ! $disabled ? '' : ' disabled="disabled"';
687 687
 		// ya gots ta have style man!!!
688 688
 		$txt_class = is_admin() ? 'regular-text' : 'espresso-textarea-inp';
689
-		$class = empty( $class ) ? $txt_class : $class;
690
-		$class .= ! empty( $system_ID ) ? ' ' . $system_ID : '';
691
-		$extra = apply_filters( 'FHEE__EEH_Form_Fields__additional_form_field_attributes', '' );
689
+		$class = empty($class) ? $txt_class : $class;
690
+		$class .= ! empty($system_ID) ? ' '.$system_ID : '';
691
+		$extra = apply_filters('FHEE__EEH_Form_Fields__additional_form_field_attributes', '');
692 692
 
693
-		$label_html = $required_text . "\n\t\t\t" . '<label for="' . $name . '" class="' . $label_class . '">' . self::prep_question( $question ) . $required['label'] . '</label><br/>';
693
+		$label_html = $required_text."\n\t\t\t".'<label for="'.$name.'" class="'.$label_class.'">'.self::prep_question($question).$required['label'].'</label><br/>';
694 694
 		// filter label but ensure required text comes before it
695
-		$label_html = apply_filters( 'FHEE__EEH_Form_Fields__label_html', $label_html, $required_text );
695
+		$label_html = apply_filters('FHEE__EEH_Form_Fields__label_html', $label_html, $required_text);
696 696
 
697
-		$input_html = "\n\t\t\t" . '<textarea name="' . $name . '" id="' . $id . '" class="' . $class . ' ' . $required['class'] . '" rows="' . $dimensions['rows'] . '" cols="' . $dimensions['cols'] . '"  title="' . $required['msg'] . '" ' . $disabled . ' ' . $extra . '>' . $answer . '</textarea>';
697
+		$input_html = "\n\t\t\t".'<textarea name="'.$name.'" id="'.$id.'" class="'.$class.' '.$required['class'].'" rows="'.$dimensions['rows'].'" cols="'.$dimensions['cols'].'"  title="'.$required['msg'].'" '.$disabled.' '.$extra.'>'.$answer.'</textarea>';
698 698
 
699
-		$input_html =  apply_filters( 'FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id );
700
-		return  $label_html . $input_html;
699
+		$input_html = apply_filters('FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id);
700
+		return  $label_html.$input_html;
701 701
 
702 702
 	}
703 703
 
@@ -720,47 +720,47 @@  discard block
 block discarded – undo
720 720
 	 * @param string $disabled 		disabled="disabled" or null
721 721
 	 * @return string HTML
722 722
 	 */
723
-	static function select( $question = FALSE, $answer = NULL, $options = FALSE, $name = FALSE, $id = '', $class = '', $required = FALSE, $required_text = '', $label_class = '', $disabled = FALSE, $system_ID = FALSE, $use_html_entities = TRUE, $add_please_select_option = FALSE ) {
723
+	static function select($question = FALSE, $answer = NULL, $options = FALSE, $name = FALSE, $id = '', $class = '', $required = FALSE, $required_text = '', $label_class = '', $disabled = FALSE, $system_ID = FALSE, $use_html_entities = TRUE, $add_please_select_option = FALSE) {
724 724
 
725 725
 		// need these
726
-		if ( ! $question || ! $name || ! $options || empty( $options ) || ! is_array( $options )) {
726
+		if ( ! $question || ! $name || ! $options || empty($options) || ! is_array($options)) {
727 727
 			return NULL;
728 728
 		}
729 729
 		// prep the answer
730
-		$answer = is_array( $answer ) ? self::prep_answer( array_shift( $answer )) : self::prep_answer( $answer, $use_html_entities );
730
+		$answer = is_array($answer) ? self::prep_answer(array_shift($answer)) : self::prep_answer($answer, $use_html_entities);
731 731
 		// prep the required array
732
-		$required = self::prep_required( $required );
732
+		$required = self::prep_required($required);
733 733
 		// set disabled tag
734
-		$disabled = $answer === NULL || ! $disabled  ? '' : ' disabled="disabled"';
734
+		$disabled = $answer === NULL || ! $disabled ? '' : ' disabled="disabled"';
735 735
 		// ya gots ta have style man!!!
736 736
 		$txt_class = is_admin() ? 'wide' : 'espresso-select-inp';
737
-		$class = empty( $class ) ? $txt_class : $class;
738
-		$class .= ! empty( $system_ID ) ? ' ' . $system_ID : '';
739
-		$extra = apply_filters( 'FHEE__EEH_Form_Fields__additional_form_field_attributes', '' );
737
+		$class = empty($class) ? $txt_class : $class;
738
+		$class .= ! empty($system_ID) ? ' '.$system_ID : '';
739
+		$extra = apply_filters('FHEE__EEH_Form_Fields__additional_form_field_attributes', '');
740 740
 
741
-		$label_html = $required_text . "\n\t\t\t" . '<label for="' . $name . '" class="' . $label_class . '">' . self::prep_question( $question ) . $required['label'] . '</label><br/>';
741
+		$label_html = $required_text."\n\t\t\t".'<label for="'.$name.'" class="'.$label_class.'">'.self::prep_question($question).$required['label'].'</label><br/>';
742 742
 		// filter label but ensure required text comes before it
743
-		$label_html = apply_filters( 'FHEE__EEH_Form_Fields__label_html', $label_html, $required_text );
743
+		$label_html = apply_filters('FHEE__EEH_Form_Fields__label_html', $label_html, $required_text);
744 744
 
745
-		$input_html = "\n\t\t\t" . '<select name="' . $name . '" id="' . $id . '" class="' . $class . ' ' . $required['class'] . '" title="' . esc_attr( $required['msg'] ) . '"' . $disabled . ' ' . $extra . '>';
745
+		$input_html = "\n\t\t\t".'<select name="'.$name.'" id="'.$id.'" class="'.$class.' '.$required['class'].'" title="'.esc_attr($required['msg']).'"'.$disabled.' '.$extra.'>';
746 746
 		// recursively count array elements, to determine total number of options
747
-		$only_option = count( $options, 1 ) == 1 ? TRUE : FALSE;
748
-		if ( ! $only_option ) {
747
+		$only_option = count($options, 1) == 1 ? TRUE : FALSE;
748
+		if ( ! $only_option) {
749 749
 			// if there is NO answer set and there are multiple options to choose from, then set the "please select" message as selected
750 750
 			$selected = $answer === NULL ? ' selected="selected"' : '';
751
-			$input_html .= $add_please_select_option ? "\n\t\t\t\t" . '<option value=""' . $selected . '>' . __(' - please select - ', 'event_espresso') . '</option>' : '';
751
+			$input_html .= $add_please_select_option ? "\n\t\t\t\t".'<option value=""'.$selected.'>'.__(' - please select - ', 'event_espresso').'</option>' : '';
752 752
 		}
753
-		foreach ( $options as $key => $value ) {
753
+		foreach ($options as $key => $value) {
754 754
 			// if value is an array, then create option groups, else create regular ol' options
755
-			$input_html .= is_array( $value ) ? self::_generate_select_option_group( $key, $value, $answer ) : self::_generate_select_option( $value->value(), $value->desc(), $answer, $only_option );
755
+			$input_html .= is_array($value) ? self::_generate_select_option_group($key, $value, $answer) : self::_generate_select_option($value->value(), $value->desc(), $answer, $only_option);
756 756
 		}
757 757
 
758
-		$input_html .= "\n\t\t\t" . '</select>';
758
+		$input_html .= "\n\t\t\t".'</select>';
759 759
 
760
-		$input_html =  apply_filters( 'FHEE__EEH_Form_Fields__select__before_end_wrapper', $input_html, $question, $answer, $name, $id, $class, $system_ID );
760
+		$input_html = apply_filters('FHEE__EEH_Form_Fields__select__before_end_wrapper', $input_html, $question, $answer, $name, $id, $class, $system_ID);
761 761
 
762
-		$input_html =  apply_filters( 'FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id );
763
-		return  $label_html . $input_html;
762
+		$input_html = apply_filters('FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id);
763
+		return  $label_html.$input_html;
764 764
 
765 765
 	}
766 766
 
@@ -777,12 +777,12 @@  discard block
 block discarded – undo
777 777
 	 * @param mixed $answer
778 778
 	 * @return string
779 779
 	 */
780
-	private static function _generate_select_option_group( $opt_group, $QSOs, $answer ){
781
-		$html = "\n\t\t\t\t" . '<optgroup label="' . self::prep_option_value( $opt_group ) . '">';
782
-		foreach ( $QSOs as $QSO ) {
783
-			$html .= self::_generate_select_option( $QSO->value(), $QSO->desc(), $answer );
780
+	private static function _generate_select_option_group($opt_group, $QSOs, $answer) {
781
+		$html = "\n\t\t\t\t".'<optgroup label="'.self::prep_option_value($opt_group).'">';
782
+		foreach ($QSOs as $QSO) {
783
+			$html .= self::_generate_select_option($QSO->value(), $QSO->desc(), $answer);
784 784
 		}
785
-		$html .= "\n\t\t\t\t" . '</optgroup>';
785
+		$html .= "\n\t\t\t\t".'</optgroup>';
786 786
 		return $html;
787 787
 	}
788 788
 
@@ -796,12 +796,12 @@  discard block
 block discarded – undo
796 796
 	 * @param int $only_option
797 797
 	 * @return string
798 798
 	 */
799
-	private static function _generate_select_option( $key, $value, $answer, $only_option = FALSE ){
800
-		$key = self::prep_answer( $key );
801
-		$value = self::prep_answer( $value );
802
-		$value = ! empty( $value ) ? $value : $key;
803
-		$selected = ( $answer == $key || $only_option ) ? ' selected="selected"' : '';
804
-		return "\n\t\t\t\t" . '<option value="' . self::prep_option_value( $key ) . '"' . $selected . '> ' . $value . '&nbsp;&nbsp;&nbsp;</option>';
799
+	private static function _generate_select_option($key, $value, $answer, $only_option = FALSE) {
800
+		$key = self::prep_answer($key);
801
+		$value = self::prep_answer($value);
802
+		$value = ! empty($value) ? $value : $key;
803
+		$selected = ($answer == $key || $only_option) ? ' selected="selected"' : '';
804
+		return "\n\t\t\t\t".'<option value="'.self::prep_option_value($key).'"'.$selected.'> '.$value.'&nbsp;&nbsp;&nbsp;</option>';
805 805
 	}
806 806
 
807 807
 
@@ -825,56 +825,56 @@  discard block
 block discarded – undo
825 825
 	 * @param bool        $use_desc_4_label
826 826
 	 * @return string HTML
827 827
 	 */
828
-	static function radio( $question = FALSE, $answer = NULL, $options = FALSE, $name = FALSE, $id = '', $class = '', $required = FALSE, $required_text = '', $label_class = '', $disabled = FALSE, $system_ID = FALSE, $use_html_entities = TRUE, $label_b4 = FALSE, $use_desc_4_label = FALSE ) {
828
+	static function radio($question = FALSE, $answer = NULL, $options = FALSE, $name = FALSE, $id = '', $class = '', $required = FALSE, $required_text = '', $label_class = '', $disabled = FALSE, $system_ID = FALSE, $use_html_entities = TRUE, $label_b4 = FALSE, $use_desc_4_label = FALSE) {
829 829
 		// need these
830
-		if ( ! $question || ! $name || ! $options || empty( $options ) || ! is_array( $options )) {
830
+		if ( ! $question || ! $name || ! $options || empty($options) || ! is_array($options)) {
831 831
 			return NULL;
832 832
 		}
833 833
 		// prep the answer
834
-		$answer = is_array( $answer ) ? '' : self::prep_answer( $answer, $use_html_entities );
834
+		$answer = is_array($answer) ? '' : self::prep_answer($answer, $use_html_entities);
835 835
 		// prep the required array
836
-		$required = self::prep_required( $required );
836
+		$required = self::prep_required($required);
837 837
 		// set disabled tag
838
-		$disabled = $answer === NULL || ! $disabled  ? '' : ' disabled="disabled"';
838
+		$disabled = $answer === NULL || ! $disabled ? '' : ' disabled="disabled"';
839 839
 		// ya gots ta have style man!!!
840 840
 		$radio_class = is_admin() ? 'ee-admin-radio-lbl' : $label_class;
841
-		$class = ! empty( $class ) ? $class : 'espresso-radio-btn-inp';
842
-		$extra = apply_filters( 'FHEE__EEH_Form_Fields__additional_form_field_attributes', '' );
841
+		$class = ! empty($class) ? $class : 'espresso-radio-btn-inp';
842
+		$extra = apply_filters('FHEE__EEH_Form_Fields__additional_form_field_attributes', '');
843 843
 
844
-		$label_html = $required_text . "\n\t\t\t" . '<label class="' . $label_class . '">' . self::prep_question( $question ) . $required['label'] . '</label> ';
844
+		$label_html = $required_text."\n\t\t\t".'<label class="'.$label_class.'">'.self::prep_question($question).$required['label'].'</label> ';
845 845
 		// filter label but ensure required text comes before it
846
-		$label_html = apply_filters( 'FHEE__EEH_Form_Fields__label_html', $label_html, $required_text );
846
+		$label_html = apply_filters('FHEE__EEH_Form_Fields__label_html', $label_html, $required_text);
847 847
 
848
-		$input_html = "\n\t\t\t" . '<ul id="' . $id . '-ul" class="espresso-radio-btn-options-ul ' . $label_class . ' ' . $class . '-ul">';
848
+		$input_html = "\n\t\t\t".'<ul id="'.$id.'-ul" class="espresso-radio-btn-options-ul '.$label_class.' '.$class.'-ul">';
849 849
 
850
-		$class .= ! empty( $system_ID ) ? ' ' . $system_ID : '';
851
-		$class .= ! empty( $required['class'] ) ? ' ' . $required['class'] : '';
850
+		$class .= ! empty($system_ID) ? ' '.$system_ID : '';
851
+		$class .= ! empty($required['class']) ? ' '.$required['class'] : '';
852 852
 
853
-		foreach ( $options as $OPT ) {
854
-			if ( $OPT instanceof EE_Question_Option ) {
855
-				$value = self::prep_option_value( $OPT->value() );
853
+		foreach ($options as $OPT) {
854
+			if ($OPT instanceof EE_Question_Option) {
855
+				$value = self::prep_option_value($OPT->value());
856 856
 				$label = $use_desc_4_label ? $OPT->desc() : $OPT->value();
857
-				$size = $use_desc_4_label ? self::get_label_size_class( $OPT->value() . ' ' . $OPT->desc() ) : self::get_label_size_class( $OPT->value() );
858
-				$desc = $OPT->desc();//no self::prep_answer
859
-				$answer = is_numeric( $value ) && empty( $answer ) ? 0 : $answer;
860
-				$checked = (string)$value == (string)$answer ? ' checked="checked"' : '';
861
-				$opt = '-' . sanitize_key( $value );
862
-
863
-				$input_html .= "\n\t\t\t\t" . '<li' . $size . '>';
864
-				$input_html .= "\n\t\t\t\t\t" . '<label class="' . $radio_class . ' espresso-radio-btn-lbl">';
865
-				$input_html .= $label_b4  ? "\n\t\t\t\t\t\t" . '<span>' . $label . '</span>' : '';
866
-				$input_html .= "\n\t\t\t\t\t\t" . '<input type="radio" name="' . $name . '" id="' . $id . $opt . '" class="' . $class . '" value="' . $value . '" title="' . esc_attr( $required['msg'] ) . '" ' . $disabled . $checked . ' ' . $extra . '/>';
867
-				$input_html .= ! $label_b4  ? "\n\t\t\t\t\t\t" . '<span class="espresso-radio-btn-desc">' . $label . '</span>' : '';
868
-				$input_html .= "\n\t\t\t\t\t" . '</label>';
869
-				$input_html .= $use_desc_4_label ? '' : '<span class="espresso-radio-btn-option-desc small-text grey-text">' . $desc . '</span>';
870
-				$input_html .= "\n\t\t\t\t" . '</li>';
857
+				$size = $use_desc_4_label ? self::get_label_size_class($OPT->value().' '.$OPT->desc()) : self::get_label_size_class($OPT->value());
858
+				$desc = $OPT->desc(); //no self::prep_answer
859
+				$answer = is_numeric($value) && empty($answer) ? 0 : $answer;
860
+				$checked = (string) $value == (string) $answer ? ' checked="checked"' : '';
861
+				$opt = '-'.sanitize_key($value);
862
+
863
+				$input_html .= "\n\t\t\t\t".'<li'.$size.'>';
864
+				$input_html .= "\n\t\t\t\t\t".'<label class="'.$radio_class.' espresso-radio-btn-lbl">';
865
+				$input_html .= $label_b4 ? "\n\t\t\t\t\t\t".'<span>'.$label.'</span>' : '';
866
+				$input_html .= "\n\t\t\t\t\t\t".'<input type="radio" name="'.$name.'" id="'.$id.$opt.'" class="'.$class.'" value="'.$value.'" title="'.esc_attr($required['msg']).'" '.$disabled.$checked.' '.$extra.'/>';
867
+				$input_html .= ! $label_b4 ? "\n\t\t\t\t\t\t".'<span class="espresso-radio-btn-desc">'.$label.'</span>' : '';
868
+				$input_html .= "\n\t\t\t\t\t".'</label>';
869
+				$input_html .= $use_desc_4_label ? '' : '<span class="espresso-radio-btn-option-desc small-text grey-text">'.$desc.'</span>';
870
+				$input_html .= "\n\t\t\t\t".'</li>';
871 871
 			}
872 872
 		}
873 873
 
874
-		$input_html .= "\n\t\t\t" . '</ul>';
874
+		$input_html .= "\n\t\t\t".'</ul>';
875 875
 
876
-		$input_html =  apply_filters( 'FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id );
877
-		return  $label_html . $input_html;
876
+		$input_html = apply_filters('FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id);
877
+		return  $label_html.$input_html;
878 878
 
879 879
 	}
880 880
 
@@ -897,65 +897,65 @@  discard block
 block discarded – undo
897 897
 	 * @param string $disabled 		disabled="disabled" or null
898 898
 	 * @return string HTML
899 899
 	 */
900
-	static function checkbox( $question = FALSE, $answer = NULL, $options = FALSE, $name = FALSE, $id = '', $class = '', $required = FALSE, $required_text = '', $label_class = '', $disabled = FALSE, $label_b4 = FALSE, $system_ID = FALSE, $use_html_entities = TRUE ) {
900
+	static function checkbox($question = FALSE, $answer = NULL, $options = FALSE, $name = FALSE, $id = '', $class = '', $required = FALSE, $required_text = '', $label_class = '', $disabled = FALSE, $label_b4 = FALSE, $system_ID = FALSE, $use_html_entities = TRUE) {
901 901
 		// need these
902
-		if ( ! $question || ! $name || ! $options || empty( $options ) || ! is_array( $options )) {
902
+		if ( ! $question || ! $name || ! $options || empty($options) || ! is_array($options)) {
903 903
 			return NULL;
904 904
 		}
905
-		$answer = maybe_unserialize( $answer );
905
+		$answer = maybe_unserialize($answer);
906 906
 
907 907
 		// prep the answer(s)
908
-		$answer = is_array( $answer ) ? $answer : array( sanitize_key( $answer ) => $answer );
908
+		$answer = is_array($answer) ? $answer : array(sanitize_key($answer) => $answer);
909 909
 
910
-		foreach ( $answer as $key => $value ) {
911
-			$key = self::prep_option_value( $key );
912
-			$answer[$key] = self::prep_answer( $value );
910
+		foreach ($answer as $key => $value) {
911
+			$key = self::prep_option_value($key);
912
+			$answer[$key] = self::prep_answer($value);
913 913
 		}
914 914
 
915 915
 		// prep the required array
916
-		$required = self::prep_required( $required );
916
+		$required = self::prep_required($required);
917 917
 		// set disabled tag
918
-		$disabled = $answer === NULL || ! $disabled  ? '' : ' disabled="disabled"';
918
+		$disabled = $answer === NULL || ! $disabled ? '' : ' disabled="disabled"';
919 919
 		// ya gots ta have style man!!!
920 920
 		$radio_class = is_admin() ? 'ee-admin-radio-lbl' : $label_class;
921
-		$class = empty( $class ) ? 'espresso-radio-btn-inp' : $class;
922
-		$extra = apply_filters( 'FHEE__EEH_Form_Fields__additional_form_field_attributes', '' );
921
+		$class = empty($class) ? 'espresso-radio-btn-inp' : $class;
922
+		$extra = apply_filters('FHEE__EEH_Form_Fields__additional_form_field_attributes', '');
923 923
 
924
-		$label_html = $required_text . "\n\t\t\t" . '<label class="' . $label_class . '">' . self::prep_question( $question ) . $required['label'] . '</label> ';
924
+		$label_html = $required_text."\n\t\t\t".'<label class="'.$label_class.'">'.self::prep_question($question).$required['label'].'</label> ';
925 925
 		// filter label but ensure required text comes before it
926
-		$label_html = apply_filters( 'FHEE__EEH_Form_Fields__label_html', $label_html, $required_text );
927
-
928
-		$input_html = "\n\t\t\t" . '<ul id="' . $id . '-ul" class="espresso-checkbox-options-ul ' . $label_class . ' ' . $class . '-ul">';
929
-
930
-		$class .= ! empty( $system_ID ) ? ' ' . $system_ID : '';
931
-		$class .= ! empty( $required['class'] ) ? ' ' . $required['class'] : '';
932
-
933
-		foreach ( $options as $OPT ) {
934
-			$value = $OPT->value();//self::prep_option_value( $OPT->value() );
935
-			$size = self::get_label_size_class(  $OPT->value() . ' ' . $OPT->desc() );
936
-			$text = self::prep_answer( $OPT->value() );
937
-			$desc = $OPT->desc() ;
938
-			$opt = '-' . sanitize_key( $value );
939
-
940
-			$checked = is_array( $answer ) && in_array( $text, $answer ) ? ' checked="checked"' : '';
941
-
942
-			$input_html .= "\n\t\t\t\t" . '<li' . $size . '>';
943
-			$input_html .= "\n\t\t\t\t\t" . '<label class="' . $radio_class . ' espresso-checkbox-lbl">';
944
-			$input_html .= $label_b4  ? "\n\t\t\t\t\t\t" . '<span>' . $text . '</span>' : '';
945
-			$input_html .= "\n\t\t\t\t\t\t" . '<input type="checkbox" name="' . $name . '[' . $OPT->ID() . ']" id="' . $id . $opt . '" class="' . $class . '" value="' . $value . '" title="' . esc_attr( $required['msg'] ) . '" ' . $disabled . $checked . ' ' . $extra . '/>';
946
-			$input_html .= ! $label_b4  ? "\n\t\t\t\t\t\t" . '<span>' . $text . '</span>' : '';
947
- 			$input_html .= "\n\t\t\t\t\t" . '</label>';
948
-			if ( ! empty( $desc ) && $desc != $text ) {
949
-	 			$input_html .= "\n\t\t\t\t\t" . ' &nbsp; <br/><div class="espresso-checkbox-option-desc small-text grey-text">' . $desc . '</div>';
926
+		$label_html = apply_filters('FHEE__EEH_Form_Fields__label_html', $label_html, $required_text);
927
+
928
+		$input_html = "\n\t\t\t".'<ul id="'.$id.'-ul" class="espresso-checkbox-options-ul '.$label_class.' '.$class.'-ul">';
929
+
930
+		$class .= ! empty($system_ID) ? ' '.$system_ID : '';
931
+		$class .= ! empty($required['class']) ? ' '.$required['class'] : '';
932
+
933
+		foreach ($options as $OPT) {
934
+			$value = $OPT->value(); //self::prep_option_value( $OPT->value() );
935
+			$size = self::get_label_size_class($OPT->value().' '.$OPT->desc());
936
+			$text = self::prep_answer($OPT->value());
937
+			$desc = $OPT->desc();
938
+			$opt = '-'.sanitize_key($value);
939
+
940
+			$checked = is_array($answer) && in_array($text, $answer) ? ' checked="checked"' : '';
941
+
942
+			$input_html .= "\n\t\t\t\t".'<li'.$size.'>';
943
+			$input_html .= "\n\t\t\t\t\t".'<label class="'.$radio_class.' espresso-checkbox-lbl">';
944
+			$input_html .= $label_b4 ? "\n\t\t\t\t\t\t".'<span>'.$text.'</span>' : '';
945
+			$input_html .= "\n\t\t\t\t\t\t".'<input type="checkbox" name="'.$name.'['.$OPT->ID().']" id="'.$id.$opt.'" class="'.$class.'" value="'.$value.'" title="'.esc_attr($required['msg']).'" '.$disabled.$checked.' '.$extra.'/>';
946
+			$input_html .= ! $label_b4 ? "\n\t\t\t\t\t\t".'<span>'.$text.'</span>' : '';
947
+ 			$input_html .= "\n\t\t\t\t\t".'</label>';
948
+			if ( ! empty($desc) && $desc != $text) {
949
+	 			$input_html .= "\n\t\t\t\t\t".' &nbsp; <br/><div class="espresso-checkbox-option-desc small-text grey-text">'.$desc.'</div>';
950 950
 			}
951
-			$input_html .= "\n\t\t\t\t" . '</li>';
951
+			$input_html .= "\n\t\t\t\t".'</li>';
952 952
 
953 953
 		}
954 954
 
955
-		$input_html .= "\n\t\t\t" . '</ul>';
955
+		$input_html .= "\n\t\t\t".'</ul>';
956 956
 
957
-		$input_html =  apply_filters( 'FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id );
958
-		return  $label_html . $input_html;
957
+		$input_html = apply_filters('FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id);
958
+		return  $label_html.$input_html;
959 959
 
960 960
 	}
961 961
 
@@ -977,36 +977,36 @@  discard block
 block discarded – undo
977 977
 	 * @param string $disabled 		disabled="disabled" or null
978 978
 	 * @return string HTML
979 979
 	 */
980
-	static function datepicker( $question = FALSE, $answer = NULL, $name = FALSE, $id = '', $class = '', $required = FALSE, $required_text = '', $label_class = '', $disabled = FALSE, $system_ID = FALSE, $use_html_entities = TRUE ) {
980
+	static function datepicker($question = FALSE, $answer = NULL, $name = FALSE, $id = '', $class = '', $required = FALSE, $required_text = '', $label_class = '', $disabled = FALSE, $system_ID = FALSE, $use_html_entities = TRUE) {
981 981
 		// need these
982
-		if ( ! $question || ! $name ) {
982
+		if ( ! $question || ! $name) {
983 983
 			return NULL;
984 984
 		}
985 985
 		// prep the answer
986
-		$answer = is_array( $answer ) ? '' : self::prep_answer( $answer, $use_html_entities );
986
+		$answer = is_array($answer) ? '' : self::prep_answer($answer, $use_html_entities);
987 987
 		// prep the required array
988
-		$required = self::prep_required( $required );
988
+		$required = self::prep_required($required);
989 989
 		// set disabled tag
990
-		$disabled = $answer === NULL || ! $disabled  ? '' : ' disabled="disabled"';
990
+		$disabled = $answer === NULL || ! $disabled ? '' : ' disabled="disabled"';
991 991
 		// ya gots ta have style man!!!
992 992
 		$txt_class = is_admin() ? 'regular-text' : 'espresso-datepicker-inp';
993
-		$class = empty( $class ) ? $txt_class : $class;
994
-		$class .= ! empty( $system_ID ) ? ' ' . $system_ID : '';
995
-		$extra = apply_filters( 'FHEE__EEH_Form_Fields__additional_form_field_attributes', '' );
993
+		$class = empty($class) ? $txt_class : $class;
994
+		$class .= ! empty($system_ID) ? ' '.$system_ID : '';
995
+		$extra = apply_filters('FHEE__EEH_Form_Fields__additional_form_field_attributes', '');
996 996
 
997
-		$label_html = $required_text . "\n\t\t\t" . '<label for="' . $name . '" class="' . $label_class . '">' . self::prep_question( $question ) . $required['label'] . '</label><br/>';
997
+		$label_html = $required_text."\n\t\t\t".'<label for="'.$name.'" class="'.$label_class.'">'.self::prep_question($question).$required['label'].'</label><br/>';
998 998
 		// filter label but ensure required text comes before it
999
-		$label_html = apply_filters( 'FHEE__EEH_Form_Fields__label_html', $label_html, $required_text );
999
+		$label_html = apply_filters('FHEE__EEH_Form_Fields__label_html', $label_html, $required_text);
1000 1000
 
1001
-		$input_html = "\n\t\t\t" . '<input type="text" name="' . $name . '" id="' . $id . '" class="' . $class . ' ' . $required['class'] . ' datepicker" value="' . $answer . '"  title="' . esc_attr( $required['msg'] ) . '" ' . $disabled . ' ' . $extra . '/>';
1001
+		$input_html = "\n\t\t\t".'<input type="text" name="'.$name.'" id="'.$id.'" class="'.$class.' '.$required['class'].' datepicker" value="'.$answer.'"  title="'.esc_attr($required['msg']).'" '.$disabled.' '.$extra.'/>';
1002 1002
 
1003 1003
 		// enqueue scripts
1004
-		wp_register_style( 'espresso-ui-theme', EE_GLOBAL_ASSETS_URL . 'css/espresso-ui-theme/jquery-ui-1.10.3.custom.min.css', array(), EVENT_ESPRESSO_VERSION );
1005
-		wp_enqueue_style( 'espresso-ui-theme');
1006
-		wp_enqueue_script( 'jquery-ui-datepicker' );
1004
+		wp_register_style('espresso-ui-theme', EE_GLOBAL_ASSETS_URL.'css/espresso-ui-theme/jquery-ui-1.10.3.custom.min.css', array(), EVENT_ESPRESSO_VERSION);
1005
+		wp_enqueue_style('espresso-ui-theme');
1006
+		wp_enqueue_script('jquery-ui-datepicker');
1007 1007
 
1008
-		$input_html =  apply_filters( 'FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id );
1009
-		return  $label_html . $input_html;
1008
+		$input_html = apply_filters('FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id);
1009
+		return  $label_html.$input_html;
1010 1010
 
1011 1011
 	}
1012 1012
 
@@ -1018,7 +1018,7 @@  discard block
 block discarded – undo
1018 1018
 	 * 	@access public
1019 1019
 	 * 	@return 	string
1020 1020
 	 */
1021
-	public static function remove_label_keep_required_msg( $label_html, $required_text ) {
1021
+	public static function remove_label_keep_required_msg($label_html, $required_text) {
1022 1022
 		return $required_text;
1023 1023
 	}
1024 1024
 
@@ -1032,9 +1032,9 @@  discard block
 block discarded – undo
1032 1032
 	 * @param string $value
1033 1033
 	 * @return string HTML
1034 1034
 	 */
1035
-	static function hidden_input( $name, $value, $id = '' ){
1036
-		$id = ! empty( $id ) ? $id : $name;
1037
-		return '<input id="' . $id . '" type="hidden" name="'.$name.'" value="' .  $value . '"/>';
1035
+	static function hidden_input($name, $value, $id = '') {
1036
+		$id = ! empty($id) ? $id : $name;
1037
+		return '<input id="'.$id.'" type="hidden" name="'.$name.'" value="'.$value.'"/>';
1038 1038
 	}
1039 1039
 
1040 1040
 
@@ -1046,7 +1046,7 @@  discard block
 block discarded – undo
1046 1046
 	 * @param string $question
1047 1047
 	 * @return string
1048 1048
 	 */
1049
-	static function prep_question( $question ){
1049
+	static function prep_question($question) {
1050 1050
 		return $question;
1051 1051
 //		$link = '';
1052 1052
 //		// does this label have a help link attached ?
@@ -1069,13 +1069,13 @@  discard block
 block discarded – undo
1069 1069
 	 * @param mixed $answer
1070 1070
 	 * @return string
1071 1071
 	 */
1072
-	static function prep_answer( $answer, $use_html_entities = TRUE ){
1072
+	static function prep_answer($answer, $use_html_entities = TRUE) {
1073 1073
 		//make sure we convert bools first.  Otherwise (bool) false becomes an empty string which is NOT desired, we want "0".
1074
-		if ( is_bool( $answer ) ) {
1074
+		if (is_bool($answer)) {
1075 1075
 			$answer = $answer ? 1 : 0;
1076 1076
 		}
1077
-		$answer = trim( stripslashes( str_replace( '&#039;', "'", $answer )));
1078
-		return $use_html_entities ? htmlentities( $answer, ENT_QUOTES, 'UTF-8' ) : $answer;
1077
+		$answer = trim(stripslashes(str_replace('&#039;', "'", $answer)));
1078
+		return $use_html_entities ? htmlentities($answer, ENT_QUOTES, 'UTF-8') : $answer;
1079 1079
 	}
1080 1080
 
1081 1081
 
@@ -1085,18 +1085,18 @@  discard block
 block discarded – undo
1085 1085
 	 * 	@param array $QSOs  array of EE_Question_Option objects
1086 1086
 	 * 	@return array
1087 1087
 	 */
1088
-	public static function prep_answer_options( $QSOs = array() ){
1088
+	public static function prep_answer_options($QSOs = array()) {
1089 1089
 		$prepped_answer_options = array();
1090
-		if ( is_array( $QSOs ) && ! empty( $QSOs )) {
1091
-			foreach( $QSOs as $key => $QSO ) {
1092
-				if ( ! $QSO instanceof EE_Question_Option ) {
1093
-					$QSO = EE_Question_Option::new_instance( array(
1094
-						'QSO_value' => is_array( $QSO ) && isset( $QSO['id'] ) ? (string)$QSO['id'] : (string)$key,
1095
-						'QSO_desc' => is_array( $QSO ) && isset( $QSO['text'] ) ? (string)$QSO['text'] : (string)$QSO
1090
+		if (is_array($QSOs) && ! empty($QSOs)) {
1091
+			foreach ($QSOs as $key => $QSO) {
1092
+				if ( ! $QSO instanceof EE_Question_Option) {
1093
+					$QSO = EE_Question_Option::new_instance(array(
1094
+						'QSO_value' => is_array($QSO) && isset($QSO['id']) ? (string) $QSO['id'] : (string) $key,
1095
+						'QSO_desc' => is_array($QSO) && isset($QSO['text']) ? (string) $QSO['text'] : (string) $QSO
1096 1096
 					));
1097 1097
 				}
1098
-				if ( $QSO->opt_group() ) {
1099
-					$prepped_answer_options[ $QSO->opt_group() ][] = $QSO;
1098
+				if ($QSO->opt_group()) {
1099
+					$prepped_answer_options[$QSO->opt_group()][] = $QSO;
1100 1100
 				} else {
1101 1101
 					$prepped_answer_options[] = $QSO;
1102 1102
 				}
@@ -1112,8 +1112,8 @@  discard block
 block discarded – undo
1112 1112
 	 * @param string $option_value
1113 1113
 	 * @return string
1114 1114
 	 */
1115
-	static function prep_option_value( $option_value ){
1116
-		return trim( stripslashes( $option_value ));
1115
+	static function prep_option_value($option_value) {
1116
+		return trim(stripslashes($option_value));
1117 1117
 	}
1118 1118
 
1119 1119
 
@@ -1124,11 +1124,11 @@  discard block
 block discarded – undo
1124 1124
 	 * @param string|array 	$required
1125 1125
 	 * @return array
1126 1126
 	 */
1127
-	static function prep_required( $required = array() ){
1127
+	static function prep_required($required = array()) {
1128 1128
 		// make sure required is an array
1129
-		$required = is_array( $required ) ? $required : array();
1129
+		$required = is_array($required) ? $required : array();
1130 1130
 		// and set some defaults
1131
-		$required = array_merge( array( 'label' => '', 'class' => '', 'msg' => '' ), $required );
1131
+		$required = array_merge(array('label' => '', 'class' => '', 'msg' => ''), $required);
1132 1132
 		return $required;
1133 1133
 	}
1134 1134
 
@@ -1139,30 +1139,30 @@  discard block
 block discarded – undo
1139 1139
 	 * @param string 	$value
1140 1140
 	 * @return string
1141 1141
 	 */
1142
-	static function get_label_size_class( $value = FALSE ){
1143
-			if ( $value === FALSE || $value == '' ) {
1142
+	static function get_label_size_class($value = FALSE) {
1143
+			if ($value === FALSE || $value == '') {
1144 1144
 				return ' class="medium-lbl"';
1145 1145
 			}
1146 1146
 			// determine length of option value
1147
-			$val_size = strlen( $value );
1148
-			switch( $val_size ){
1147
+			$val_size = strlen($value);
1148
+			switch ($val_size) {
1149 1149
 				case $val_size < 3 :
1150
-					$size =  ' class="nano-lbl"';
1150
+					$size = ' class="nano-lbl"';
1151 1151
 					break;
1152 1152
 				case $val_size < 6 :
1153
-					$size =  ' class="micro-lbl"';
1153
+					$size = ' class="micro-lbl"';
1154 1154
 					break;
1155 1155
 				case $val_size < 12 :
1156
-					$size =  ' class="tiny-lbl"';
1156
+					$size = ' class="tiny-lbl"';
1157 1157
 					break;
1158 1158
 				case $val_size < 25 :
1159
-					$size =  ' class="small-lbl"';
1159
+					$size = ' class="small-lbl"';
1160 1160
 					break;
1161 1161
 				case $val_size > 100 :
1162
-					$size =  ' class="big-lbl"';
1162
+					$size = ' class="big-lbl"';
1163 1163
 					break;
1164 1164
 				default:
1165
-					$size =  ' class="medium-lbl"';
1165
+					$size = ' class="medium-lbl"';
1166 1166
 					break;
1167 1167
 			}
1168 1168
 		return $size;
@@ -1176,20 +1176,20 @@  discard block
 block discarded – undo
1176 1176
 	 * @param array 	$QFI
1177 1177
 	 * @return array
1178 1178
 	 */
1179
-	private static function _load_system_dropdowns( $QFI ){
1179
+	private static function _load_system_dropdowns($QFI) {
1180 1180
 		$QST_system = $QFI->get('QST_system');
1181
-		switch ( $QST_system ) {
1181
+		switch ($QST_system) {
1182 1182
 			case 'state' :
1183
-				$QFI = self::generate_state_dropdown( $QFI );
1183
+				$QFI = self::generate_state_dropdown($QFI);
1184 1184
 				break;
1185 1185
 			case 'country' :
1186
-				$QFI = self::generate_country_dropdown( $QFI );
1186
+				$QFI = self::generate_country_dropdown($QFI);
1187 1187
 				break;
1188 1188
 			case 'admin-state' :
1189
-				$QFI = self::generate_state_dropdown( $QFI, TRUE );
1189
+				$QFI = self::generate_state_dropdown($QFI, TRUE);
1190 1190
 				break;
1191 1191
 			case 'admin-country' :
1192
-				$QFI = self::generate_country_dropdown( $QFI, TRUE );
1192
+				$QFI = self::generate_country_dropdown($QFI, TRUE);
1193 1193
 				break;
1194 1194
 		}
1195 1195
 		return $QFI;
@@ -1206,13 +1206,13 @@  discard block
 block discarded – undo
1206 1206
 	 *
1207 1207
 	 * @return EE_Question_Form_Input
1208 1208
 	 */
1209
-	protected static function _load_specialized_dropdowns( $QFI ) {
1210
-		switch( $QFI->get( 'QST_type' ) ) {
1209
+	protected static function _load_specialized_dropdowns($QFI) {
1210
+		switch ($QFI->get('QST_type')) {
1211 1211
 			case 'STATE' :
1212
-				$QFI = self::generate_state_dropdown( $QFI );
1212
+				$QFI = self::generate_state_dropdown($QFI);
1213 1213
 				break;
1214 1214
 			case 'COUNTRY' :
1215
-				$QFI = self::generate_country_dropdown( $QFI );
1215
+				$QFI = self::generate_country_dropdown($QFI);
1216 1216
 				break;
1217 1217
 		}
1218 1218
 		return $QFI;
@@ -1226,23 +1226,23 @@  discard block
 block discarded – undo
1226 1226
 	 * @param bool  $get_all
1227 1227
 	 * @return array
1228 1228
 	 */
1229
-	public static function generate_state_dropdown( $QST, $get_all = FALSE ){
1229
+	public static function generate_state_dropdown($QST, $get_all = FALSE) {
1230 1230
 		$states = $get_all ? EEM_State::instance()->get_all_states() : EEM_State::instance()->get_all_states_of_active_countries();
1231
-		if ( $states && count( $states ) != count( $QST->options() )) {
1232
-			$QST->set( 'QST_type', 'DROPDOWN' );
1231
+		if ($states && count($states) != count($QST->options())) {
1232
+			$QST->set('QST_type', 'DROPDOWN');
1233 1233
 			// if multiple countries, we'll create option groups within the dropdown
1234
-			foreach ( $states as $state ) {
1235
-				if ( $state instanceof EE_State ) {
1236
-					$QSO = EE_Question_Option::new_instance ( array (
1234
+			foreach ($states as $state) {
1235
+				if ($state instanceof EE_State) {
1236
+					$QSO = EE_Question_Option::new_instance(array(
1237 1237
 						'QSO_value' => $state->ID(),
1238 1238
 						'QSO_desc' => $state->name(),
1239
-						'QST_ID' => $QST->get( 'QST_ID' ),
1239
+						'QST_ID' => $QST->get('QST_ID'),
1240 1240
 						'QSO_deleted' => FALSE
1241 1241
 					));
1242 1242
 					// set option group
1243
-					$QSO->set_opt_group( $state->country()->name() );
1243
+					$QSO->set_opt_group($state->country()->name());
1244 1244
 					// add option to question
1245
-					$QST->add_temp_option( $QSO );
1245
+					$QST->add_temp_option($QSO);
1246 1246
 				}
1247 1247
 			}
1248 1248
 		}
@@ -1258,20 +1258,20 @@  discard block
 block discarded – undo
1258 1258
 	 * @internal param array $question
1259 1259
 	 * @return array
1260 1260
 	 */
1261
-	public static function generate_country_dropdown( $QST, $get_all = FALSE ){
1261
+	public static function generate_country_dropdown($QST, $get_all = FALSE) {
1262 1262
 		$countries = $get_all ? EEM_Country::instance()->get_all_countries() : EEM_Country::instance()->get_all_active_countries();
1263
-		if ( $countries && count( $countries ) != count( $QST->options() ) ) {
1264
-			$QST->set( 'QST_type', 'DROPDOWN' );
1263
+		if ($countries && count($countries) != count($QST->options())) {
1264
+			$QST->set('QST_type', 'DROPDOWN');
1265 1265
 			// now add countries
1266
-			foreach ( $countries as $country ) {
1267
-				if ( $country instanceof EE_Country ) {
1268
-					$QSO = EE_Question_Option::new_instance ( array (
1266
+			foreach ($countries as $country) {
1267
+				if ($country instanceof EE_Country) {
1268
+					$QSO = EE_Question_Option::new_instance(array(
1269 1269
 						'QSO_value' => $country->ID(),
1270 1270
 						'QSO_desc' => $country->name(),
1271
-						'QST_ID' => $QST->get( 'QST_ID' ),
1271
+						'QST_ID' => $QST->get('QST_ID'),
1272 1272
 						'QSO_deleted' => FALSE
1273 1273
 					));
1274
-					$QST->add_temp_option( $QSO );
1274
+					$QST->add_temp_option($QSO);
1275 1275
 				}
1276 1276
 			}
1277 1277
 		}
@@ -1288,11 +1288,11 @@  discard block
 block discarded – undo
1288 1288
 	 */
1289 1289
 	public static function two_digit_months_dropdown_options() {
1290 1290
 		$options = array();
1291
-		for ( $x = 1; $x <= 12; $x++ ) {
1292
-			$mm = str_pad( $x, 2, '0', STR_PAD_LEFT );
1293
-			$options[ (string)$mm ] = (string)$mm;
1291
+		for ($x = 1; $x <= 12; $x++) {
1292
+			$mm = str_pad($x, 2, '0', STR_PAD_LEFT);
1293
+			$options[(string) $mm] = (string) $mm;
1294 1294
 		}
1295
-		return EEH_Form_Fields::prep_answer_options( $options );
1295
+		return EEH_Form_Fields::prep_answer_options($options);
1296 1296
 	}
1297 1297
 
1298 1298
 
@@ -1307,11 +1307,11 @@  discard block
 block discarded – undo
1307 1307
 		$options = array();
1308 1308
 		$current_year = date('y');
1309 1309
 		$next_decade = $current_year + 10;
1310
-		for ( $x = $current_year; $x <= $next_decade; $x++ ) {
1311
-			$yy = str_pad( $x, 2, '0', STR_PAD_LEFT );
1312
-			$options[ (string)$yy ] = (string)$yy;
1310
+		for ($x = $current_year; $x <= $next_decade; $x++) {
1311
+			$yy = str_pad($x, 2, '0', STR_PAD_LEFT);
1312
+			$options[(string) $yy] = (string) $yy;
1313 1313
 		}
1314
-		return EEH_Form_Fields::prep_answer_options( $options );
1314
+		return EEH_Form_Fields::prep_answer_options($options);
1315 1315
 	}
1316 1316
 
1317 1317
 
@@ -1325,17 +1325,17 @@  discard block
 block discarded – undo
1325 1325
 	 * @param  integer $evt_category Event Category ID if the Event Category filter is selected
1326 1326
 	 * @return string                html
1327 1327
 	 */
1328
-	public static function generate_registration_months_dropdown( $cur_date = '', $status = '', $evt_category = 0 ) {
1328
+	public static function generate_registration_months_dropdown($cur_date = '', $status = '', $evt_category = 0) {
1329 1329
 		$_where = array();
1330
-		if ( !empty( $status ) ) {
1330
+		if ( ! empty($status)) {
1331 1331
 			$_where['STS_ID'] = $status;
1332 1332
 		}
1333 1333
 
1334
-		if ( $evt_category > 0 ) {
1334
+		if ($evt_category > 0) {
1335 1335
 			$_where['Event.Term_Taxonomy.term_id'] = $evt_category;
1336 1336
 		}
1337 1337
 
1338
-		$regdtts = EEM_Registration::instance()->get_reg_months_and_years( $_where );
1338
+		$regdtts = EEM_Registration::instance()->get_reg_months_and_years($_where);
1339 1339
 
1340 1340
 		//setup vals for select input helper
1341 1341
 		$options = array(
@@ -1345,15 +1345,15 @@  discard block
 block discarded – undo
1345 1345
 				)
1346 1346
 			);
1347 1347
 
1348
-		foreach ( $regdtts as $regdtt ) {
1349
-			$date = $regdtt->reg_month. ' ' . $regdtt->reg_year;
1348
+		foreach ($regdtts as $regdtt) {
1349
+			$date = $regdtt->reg_month.' '.$regdtt->reg_year;
1350 1350
 			$options[] = array(
1351 1351
 				'text' => $date,
1352 1352
 				'id' => $date
1353 1353
 				);
1354 1354
 		}
1355 1355
 
1356
-		return self::select_input('month_range', $options, $cur_date, '', 'wide' );
1356
+		return self::select_input('month_range', $options, $cur_date, '', 'wide');
1357 1357
 	}
1358 1358
 
1359 1359
 
@@ -1367,20 +1367,20 @@  discard block
 block discarded – undo
1367 1367
 	 * @param  string $evt_active_status "upcoming", "expired", "active", or "inactive"
1368 1368
 	 * @return string                    html
1369 1369
 	 */
1370
-	public static function generate_event_months_dropdown( $cur_date = '', $status = NULL, $evt_category = NULL, $evt_active_status = NULL ) {
1370
+	public static function generate_event_months_dropdown($cur_date = '', $status = NULL, $evt_category = NULL, $evt_active_status = NULL) {
1371 1371
 		//what we need to do is get all PRIMARY datetimes for all events to filter on. Note we need to include any other filters that are set!
1372 1372
 
1373 1373
 		//determine what post_status our condition will have for the query.
1374
-		switch ( $status ) {
1374
+		switch ($status) {
1375 1375
 			case 'month' :
1376 1376
 			case 'today' :
1377 1377
 			case NULL :
1378 1378
 			case 'all' :
1379
-				$where['Event.status'] = array( 'NOT IN', array('trash') );
1379
+				$where['Event.status'] = array('NOT IN', array('trash'));
1380 1380
 				break;
1381 1381
 
1382 1382
 			case 'draft' :
1383
-				$where['Event.status'] = array( 'IN', array('draft', 'auto-draft') );
1383
+				$where['Event.status'] = array('IN', array('draft', 'auto-draft'));
1384 1384
 
1385 1385
 			default :
1386 1386
 				$where['Event.status'] = $status;
@@ -1389,33 +1389,33 @@  discard block
 block discarded – undo
1389 1389
 		//categories?
1390 1390
 
1391 1391
 
1392
-		if ( !empty ( $evt_category ) ) {
1392
+		if ( ! empty ($evt_category)) {
1393 1393
 			$where['Event.Term_Taxonomy.taxonomy'] = 'espresso_event_categories';
1394 1394
 			$where['Event.Term_Taxonomy.term_id'] = $evt_category;
1395 1395
 		}
1396 1396
 
1397 1397
 		//what about active status for the event?
1398
-		if ( !empty( $evt_active_status ) ) {
1399
-			switch ( $evt_active_status ) {
1398
+		if ( ! empty($evt_active_status)) {
1399
+			switch ($evt_active_status) {
1400 1400
 				case 'upcoming' :
1401 1401
 					$where['Event.status'] = 'publish';
1402
-					$where['DTT_EVT_start'] = array('>', date('Y-m-d g:i:s', time() ) );
1402
+					$where['DTT_EVT_start'] = array('>', date('Y-m-d g:i:s', time()));
1403 1403
 					break;
1404 1404
 
1405 1405
 				case 'expired' :
1406
-					if ( isset( $where['Event.status'] ) ) unset( $where['Event.status'] );
1407
-					$where['OR'] = array( 'Event.status' => array( '!=', 'publish' ), 'AND' => array('Event.status' => 'publish', 'DTT_EVT_end' => array( '<',  date('Y-m-d g:i:s', time() ) ) ) );
1406
+					if (isset($where['Event.status'])) unset($where['Event.status']);
1407
+					$where['OR'] = array('Event.status' => array('!=', 'publish'), 'AND' => array('Event.status' => 'publish', 'DTT_EVT_end' => array('<', date('Y-m-d g:i:s', time()))));
1408 1408
 					break;
1409 1409
 
1410 1410
 				case 'active' :
1411 1411
 					$where['Event.status'] = 'publish';
1412
-					$where['DTT_EVT_start'] = array('>',  date('Y-m-d g:i:s', time() ) );
1413
-					$where['DTT_EVT_end'] = array('<', date('Y-m-d g:i:s', time() ) );
1412
+					$where['DTT_EVT_start'] = array('>', date('Y-m-d g:i:s', time()));
1413
+					$where['DTT_EVT_end'] = array('<', date('Y-m-d g:i:s', time()));
1414 1414
 					break;
1415 1415
 
1416 1416
 				case 'inactive' :
1417
-					if ( isset( $where['Event.status'] ) ) unset( $where['Event.status'] );
1418
-					$where['OR'] = array( 'Event.status' => array( '!=', 'publish' ), 'DTT_EVT_end' => array( '<', date('Y-m-d g:i:s', time() ) ) );
1417
+					if (isset($where['Event.status'])) unset($where['Event.status']);
1418
+					$where['OR'] = array('Event.status' => array('!=', 'publish'), 'DTT_EVT_end' => array('<', date('Y-m-d g:i:s', time())));
1419 1419
 					break;
1420 1420
 			}
1421 1421
 		}
@@ -1436,8 +1436,8 @@  discard block
 block discarded – undo
1436 1436
 		//translate month and date
1437 1437
 		global $wp_locale;
1438 1438
 
1439
-		foreach ( $DTTS as $DTT ) {
1440
-			$date = $wp_locale->get_month( date('m', strtotime($DTT->dtt_month)) ) . ' ' . $DTT->dtt_year;
1439
+		foreach ($DTTS as $DTT) {
1440
+			$date = $wp_locale->get_month(date('m', strtotime($DTT->dtt_month))).' '.$DTT->dtt_year;
1441 1441
 			$options[] = array(
1442 1442
 				'text' => $date,
1443 1443
 				'id' => $date
@@ -1445,7 +1445,7 @@  discard block
 block discarded – undo
1445 1445
 		}
1446 1446
 
1447 1447
 
1448
-		return self::select_input( 'month_range', $options, $cur_date, '', 'wide' );
1448
+		return self::select_input('month_range', $options, $cur_date, '', 'wide');
1449 1449
 	}
1450 1450
 
1451 1451
 
@@ -1456,7 +1456,7 @@  discard block
 block discarded – undo
1456 1456
 	 * @param  integer $current_cat currently selected category
1457 1457
 	 * @return string               html for dropdown
1458 1458
 	 */
1459
-	public static function generate_event_category_dropdown( $current_cat = -1 ) {
1459
+	public static function generate_event_category_dropdown($current_cat = -1) {
1460 1460
 		$categories = EEM_Term::instance()->get_all_ee_categories(TRUE);
1461 1461
 		$options = array(
1462 1462
 			'0' => array(
@@ -1466,14 +1466,14 @@  discard block
 block discarded – undo
1466 1466
 			);
1467 1467
 
1468 1468
 		//setup categories for dropdown
1469
-		foreach ( $categories as $category ) {
1469
+		foreach ($categories as $category) {
1470 1470
 			$options[] = array(
1471 1471
 				'text' => $category->get('name'),
1472 1472
 				'id' => $category->ID()
1473 1473
 				);
1474 1474
 		}
1475 1475
 
1476
-		return self::select_input( 'EVT_CAT', $options, $current_cat );
1476
+		return self::select_input('EVT_CAT', $options, $current_cat);
1477 1477
 	}
1478 1478
 
1479 1479
 
@@ -1492,20 +1492,20 @@  discard block
 block discarded – undo
1492 1492
 	 * @param    string   $extra_attributes - any extra attributes that need to be attached to the form input
1493 1493
 	 * @return    void
1494 1494
 	 */
1495
-	public static function submit_button( $url = '', $ID = '', $class = '', $text = '', $nonce_action = '', $input_only = FALSE, $extra_attributes = '' ) {
1495
+	public static function submit_button($url = '', $ID = '', $class = '', $text = '', $nonce_action = '', $input_only = FALSE, $extra_attributes = '') {
1496 1496
 		$btn = '';
1497
-		if ( empty( $url ) || empty( $ID )) {
1497
+		if (empty($url) || empty($ID)) {
1498 1498
 			return $btn;
1499 1499
 		}
1500
-		$text = ! empty( $text ) ? $text : __('Submit', 'event_espresso' );
1501
-		$btn .= '<input id="' . $ID . '-btn" class="' . $class . '" type="submit" value="' . $text . '" ' . $extra_attributes . '/>';
1502
-		if ( ! $input_only ) {
1503
-			$btn_frm = '<form id="' . $ID . '-frm" method="POST" action="' . $url . '">';
1504
-			$btn_frm .= ! empty( $nonce_action ) ? wp_nonce_field( $nonce_action, $nonce_action . '_nonce', TRUE, FALSE ) : '';
1500
+		$text = ! empty($text) ? $text : __('Submit', 'event_espresso');
1501
+		$btn .= '<input id="'.$ID.'-btn" class="'.$class.'" type="submit" value="'.$text.'" '.$extra_attributes.'/>';
1502
+		if ( ! $input_only) {
1503
+			$btn_frm = '<form id="'.$ID.'-frm" method="POST" action="'.$url.'">';
1504
+			$btn_frm .= ! empty($nonce_action) ? wp_nonce_field($nonce_action, $nonce_action.'_nonce', TRUE, FALSE) : '';
1505 1505
 			$btn_frm .= $btn;
1506 1506
 			$btn_frm .= '</form>';
1507 1507
 			$btn = $btn_frm;
1508
-			unset ( $btn_frm );
1508
+			unset ($btn_frm);
1509 1509
 		}
1510 1510
 		return $btn;
1511 1511
 	}
Please login to merge, or discard this patch.
Braces   +18 added lines, -10 removed lines patch added patch discarded remove patch
@@ -355,23 +355,27 @@  discard block
 block discarded – undo
355 355
 		$field = '<select id="' . EEH_Formatter::ee_tep_output_string($name) . '" name="' . EEH_Formatter::ee_tep_output_string($name) . '"';
356 356
 		//Debug
357 357
 		//EEH_Debug_Tools::printr( $values, '$values  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
358
-		if ( EEH_Formatter::ee_tep_not_null($parameters))
359
-			$field .= ' ' . $parameters;
358
+		if ( EEH_Formatter::ee_tep_not_null($parameters)) {
359
+					$field .= ' ' . $parameters;
360
+		}
360 361
 		if ($autosize) {
361 362
 			$size = 'med';
362 363
 			for ($ii = 0, $ni = sizeof($values); $ii < $ni; $ii++) {
363 364
 				if ($values[$ii]['text']) {
364
-					if (strlen($values[$ii]['text']) > 5)
365
-						$size = 'wide';
365
+					if (strlen($values[$ii]['text']) > 5) {
366
+											$size = 'wide';
367
+					}
366 368
 				}
367 369
 			}
368
-		} else
369
-			$size = '';
370
+		} else {
371
+					$size = '';
372
+		}
370 373
 
371 374
 		$field .= ' class="' . $class . ' ' . $size . '">';
372 375
 
373
-		if (empty($default) && isset($GLOBALS[$name]))
374
-			$default = stripslashes($GLOBALS[$name]);
376
+		if (empty($default) && isset($GLOBALS[$name])) {
377
+					$default = stripslashes($GLOBALS[$name]);
378
+		}
375 379
 
376 380
 
377 381
 		for ($i = 0, $n = sizeof($values); $i < $n; $i++) {
@@ -1403,7 +1407,9 @@  discard block
 block discarded – undo
1403 1407
 					break;
1404 1408
 
1405 1409
 				case 'expired' :
1406
-					if ( isset( $where['Event.status'] ) ) unset( $where['Event.status'] );
1410
+					if ( isset( $where['Event.status'] ) ) {
1411
+						unset( $where['Event.status'] );
1412
+					}
1407 1413
 					$where['OR'] = array( 'Event.status' => array( '!=', 'publish' ), 'AND' => array('Event.status' => 'publish', 'DTT_EVT_end' => array( '<',  date('Y-m-d g:i:s', time() ) ) ) );
1408 1414
 					break;
1409 1415
 
@@ -1414,7 +1420,9 @@  discard block
 block discarded – undo
1414 1420
 					break;
1415 1421
 
1416 1422
 				case 'inactive' :
1417
-					if ( isset( $where['Event.status'] ) ) unset( $where['Event.status'] );
1423
+					if ( isset( $where['Event.status'] ) ) {
1424
+						unset( $where['Event.status'] );
1425
+					}
1418 1426
 					$where['OR'] = array( 'Event.status' => array( '!=', 'publish' ), 'DTT_EVT_end' => array( '<', date('Y-m-d g:i:s', time() ) ) );
1419 1427
 					break;
1420 1428
 			}
Please login to merge, or discard this patch.
core/helpers/EEH_Formatter.helper.php 4 patches
Doc Comments   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -88,6 +88,7 @@  discard block
 block discarded – undo
88 88
 	/**
89 89
 	 * [ee_tep_not_null description]
90 90
 	 * @param  string | array $value [description]
91
+	 * @param string $value
91 92
 	 * @return bool       [description]
92 93
 	 */
93 94
 	static public function ee_tep_not_null($value) {
@@ -573,6 +574,8 @@  discard block
 block discarded – undo
573 574
 	 * @param EE_State | string $state
574 575
 	 * @param EE_Country | string $country
575 576
 	 * @param string $zip
577
+	 * @param integer $state
578
+	 * @param string $country
576 579
 	 * @return EE_Generic_Address
577 580
 	 */
578 581
 	public function __construct( $address, $address2, $city, $state, $country, $zip ) {
@@ -660,7 +663,7 @@  discard block
 block discarded – undo
660 663
 
661 664
 
662 665
 	/**
663
-	 * @return \EE_State
666
+	 * @return string
664 667
 	 */
665 668
 	public function state_obj() {
666 669
 		return $this->_state_obj;
@@ -709,7 +712,7 @@  discard block
 block discarded – undo
709 712
 
710 713
 
711 714
 	/**
712
-	 * @return \EE_Country
715
+	 * @return string
713 716
 	 */
714 717
 	public function country_obj() {
715 718
 		return $this->_country_obj;
Please login to merge, or discard this patch.
Indentation   +87 added lines, -87 removed lines patch added patch discarded remove patch
@@ -297,12 +297,12 @@  discard block
 block discarded – undo
297 297
 
298 298
 
299 299
 	/**
300
-	* 	_get_formatter - obtain the requester formatter class
301
-	*
302
-	* 	@access private
303
-	* 	@param string $type how the address is formatted. for example: 'multiline' or 'inline'
304
-	* 	@return EEI_Address_Formatter
305
-	*/
300
+	 * 	_get_formatter - obtain the requester formatter class
301
+	 *
302
+	 * 	@access private
303
+	 * 	@param string $type how the address is formatted. for example: 'multiline' or 'inline'
304
+	 * 	@return EEI_Address_Formatter
305
+	 */
306 306
 	private static function _get_formatter( $type ) {
307 307
 		switch( $type ) {
308 308
 
@@ -348,14 +348,14 @@  discard block
 block discarded – undo
348 348
 
349 349
 
350 350
 	/**
351
-	* 	_schema_formatting
352
-	* 	adds schema.org formatting to an address
353
-	*
354
-	* 	@access private
355
-	* 	@param object EEI_Address_Formatter $formatter
356
-	* 	@param object EEI_Address $obj_with_address
357
-	* 	@return string
358
-	*/
351
+	 * 	_schema_formatting
352
+	 * 	adds schema.org formatting to an address
353
+	 *
354
+	 * 	@access private
355
+	 * 	@param object EEI_Address_Formatter $formatter
356
+	 * 	@param object EEI_Address $obj_with_address
357
+	 * 	@return string
358
+	 */
359 359
 	private static function _schema_formatting( EEI_Address_Formatter $formatter, EEI_Address $obj_with_address ){
360 360
 		$formatted_address = '<div itemprop="address" itemscope itemtype="http://schema.org/PostalAddress">';
361 361
 		$formatted_address .= $formatter->format(
@@ -396,50 +396,50 @@  discard block
 block discarded – undo
396 396
 
397 397
 
398 398
 	/**
399
-	* 	location
400
-	* 	The location of the event, organization or action.
401
-	* 	Should include the Venue name AND schema formatted address info
402
-	*
403
-	* 	@access public
404
-	* 	@param string $location
405
-	* 	@return string
406
-	*/
399
+	 * 	location
400
+	 * 	The location of the event, organization or action.
401
+	 * 	Should include the Venue name AND schema formatted address info
402
+	 *
403
+	 * 	@access public
404
+	 * 	@param string $location
405
+	 * 	@return string
406
+	 */
407 407
 	public static function location ( $location = NULL ) {
408 408
 		return ! empty( $location ) ? '<div itemprop="location" itemscope itemtype="http://schema.org/Place">' . $location . '</div>' : '';
409 409
 	}
410 410
 
411 411
 	/**
412
-	* 	name
413
-	* 	The name of the Event or Venue.
414
-	*
415
-	* 	@access public
416
-	* 	@param string $name
417
-	* 	@return string
418
-	*/
412
+	 * 	name
413
+	 * 	The name of the Event or Venue.
414
+	 *
415
+	 * 	@access public
416
+	 * 	@param string $name
417
+	 * 	@return string
418
+	 */
419 419
 	public static function name ( $name = NULL ) {
420 420
 		return ! empty( $name ) ? '<span itemprop="name">' . $name . '</span>' : '';
421 421
 	}
422 422
 
423 423
 	/**
424
-	* 	streetAddress
425
-	* 	The street address. For example, 1600 Amphitheatre Pkwy.
426
-	*
427
-	* 	@access public
428
-	* 	@param EEI_Address $obj_with_address
429
-	* 	@return string
430
-	*/
424
+	 * 	streetAddress
425
+	 * 	The street address. For example, 1600 Amphitheatre Pkwy.
426
+	 *
427
+	 * 	@access public
428
+	 * 	@param EEI_Address $obj_with_address
429
+	 * 	@return string
430
+	 */
431 431
 	public static function streetAddress ( EEI_Address $obj_with_address = NULL ) {
432 432
 		return $obj_with_address->address() !== NULL && $obj_with_address->address() !== '' ? '<span itemprop="streetAddress">' . $obj_with_address->address() . '</span>' : '';
433 433
 	}
434 434
 
435 435
 	/**
436
-	* 	postOfficeBoxNumber
437
-	* 	The post office box number for PO box addresses.
438
-	*
439
-	* 	@access public
440
-	* 	@param EEI_Address $obj_with_address
441
-	* 	@return string
442
-	*/
436
+	 * 	postOfficeBoxNumber
437
+	 * 	The post office box number for PO box addresses.
438
+	 *
439
+	 * 	@access public
440
+	 * 	@param EEI_Address $obj_with_address
441
+	 * 	@return string
442
+	 */
443 443
 	public static function postOfficeBoxNumber ( EEI_Address $obj_with_address = NULL ) {
444 444
 		// regex check for some form of PO Box or P.O. Box, etc, etc, etc
445 445
 		if ( preg_match("/^\s*((P(OST)?.?\s*(O(FF(ICE)?)?)?.?\s+(B(IN|OX))?)|B(IN|OX))/i", $obj_with_address->address2() )) {
@@ -450,25 +450,25 @@  discard block
 block discarded – undo
450 450
 	}
451 451
 
452 452
 	/**
453
-	* 	addressLocality
454
-	* 	The locality (city, town, etc). For example, Mountain View.
455
-	*
456
-	* 	@access public
457
-	* 	@param EEI_Address $obj_with_address
458
-	* 	@return string
459
-	*/
453
+	 * 	addressLocality
454
+	 * 	The locality (city, town, etc). For example, Mountain View.
455
+	 *
456
+	 * 	@access public
457
+	 * 	@param EEI_Address $obj_with_address
458
+	 * 	@return string
459
+	 */
460 460
 	public static function addressLocality ( EEI_Address $obj_with_address = NULL ) {
461 461
 		return $obj_with_address->city() !== NULL && $obj_with_address->city() !== '' ? '<span itemprop="addressLocality">' . $obj_with_address->city() . '</span>' : '';
462 462
 	}
463 463
 
464 464
 	/**
465
-	* 	addressRegion
466
-	* 	The region (state, province, etc). For example, CA.
467
-	*
468
-	* 	@access public
469
-	* 	@param EEI_Address $obj_with_address
470
-	* 	@return string
471
-	*/
465
+	 * 	addressRegion
466
+	 * 	The region (state, province, etc). For example, CA.
467
+	 *
468
+	 * 	@access public
469
+	 * 	@param EEI_Address $obj_with_address
470
+	 * 	@return string
471
+	 */
472 472
 	public static function addressRegion ( EEI_Address $obj_with_address = NULL ) {
473 473
 		$state = $obj_with_address->state();
474 474
 		if ( ! empty( $state ) ) {
@@ -479,13 +479,13 @@  discard block
 block discarded – undo
479 479
 	}
480 480
 
481 481
 	/**
482
-	* 	addressCountry
483
-	* 	The country. For example, USA. You can also provide the two-letter ISO 3166-1 alpha-2 country code.
484
-	*
485
-	* 	@access public
486
-	* 	@param EEI_Address $obj_with_address
487
-	* 	@return string
488
-	*/
482
+	 * 	addressCountry
483
+	 * 	The country. For example, USA. You can also provide the two-letter ISO 3166-1 alpha-2 country code.
484
+	 *
485
+	 * 	@access public
486
+	 * 	@param EEI_Address $obj_with_address
487
+	 * 	@return string
488
+	 */
489 489
 	public static function addressCountry ( EEI_Address $obj_with_address = NULL ) {
490 490
 		$country = $obj_with_address->country();
491 491
 		if ( ! empty( $country ) ) {
@@ -496,39 +496,39 @@  discard block
 block discarded – undo
496 496
 	}
497 497
 
498 498
 	/**
499
-	* 	postalCode
500
-	* 	The postal code. For example, 94043.
501
-	*
502
-	* 	@access public
503
-	* 	@param EEI_Address $obj_with_address
504
-	* 	@return string
505
-	*/
499
+	 * 	postalCode
500
+	 * 	The postal code. For example, 94043.
501
+	 *
502
+	 * 	@access public
503
+	 * 	@param EEI_Address $obj_with_address
504
+	 * 	@return string
505
+	 */
506 506
 	public static function postalCode ( EEI_Address $obj_with_address = NULL ) {
507 507
 		return $obj_with_address->zip() !== NULL && $obj_with_address->zip() !== ''  ? '<span itemprop="postalCode">' . $obj_with_address->zip() . '</span>' : '';
508 508
 	}
509 509
 
510 510
 	/**
511
-	* 	telephone
512
-	* 	The telephone number.
513
-	*
514
-	* 	@access public
515
-	* 	@param string $phone_nmbr
516
-	* 	@return string
517
-	*/
511
+	 * 	telephone
512
+	 * 	The telephone number.
513
+	 *
514
+	 * 	@access public
515
+	 * 	@param string $phone_nmbr
516
+	 * 	@return string
517
+	 */
518 518
 	public static function telephone ( $phone_nmbr = NULL ) {
519 519
 		return $phone_nmbr !== NULL && $phone_nmbr !== ''  ? '<span itemprop="telephone">' . $phone_nmbr . '</span>' : '';
520 520
 	}
521 521
 
522 522
 	/**
523
-	* 	URL
524
-	* 	URL of the item as a clickable link
525
-	*
526
-	* 	@access public
527
-	* 	@param string $url - the URL that the link will resolve to
528
-	* 	@param string $text - the text that will be used for the visible link
529
-	* 	@param array $attributes - array of additional link attributes in  attribute_name => value pairs. ie: array( 'title' => 'click here', 'class' => 'link-class' )
530
-	* 	@return string (link)
531
-	*/
523
+	 * 	URL
524
+	 * 	URL of the item as a clickable link
525
+	 *
526
+	 * 	@access public
527
+	 * 	@param string $url - the URL that the link will resolve to
528
+	 * 	@param string $text - the text that will be used for the visible link
529
+	 * 	@param array $attributes - array of additional link attributes in  attribute_name => value pairs. ie: array( 'title' => 'click here', 'class' => 'link-class' )
530
+	 * 	@return string (link)
531
+	 */
532 532
 	public static function url ( $url = NULL, $text = NULL, $attributes = array() ) {
533 533
 		$atts = '';
534 534
 		foreach ( $attributes as $attribute => $value ) {
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,8 +6,9 @@
 block discarded – undo
6 6
  * @package Event Espresso
7 7
  * @subpackage messages
8 8
  */
9
-if (!defined('EVENT_ESPRESSO_VERSION') )
9
+if (!defined('EVENT_ESPRESSO_VERSION') ) {
10 10
 	exit('NO direct script access allowed');
11
+}
11 12
 
12 13
 /**
13 14
  *
Please login to merge, or discard this patch.
Spacing   +79 added lines, -79 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
 /**
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 	 * @param  string $content content to format
40 40
 	 * @return string          formatted content
41 41
 	 */
42
-	static public function admin_format_content($content='') {
42
+	static public function admin_format_content($content = '') {
43 43
 		return wpautop(stripslashes_deep(html_entity_decode($content, ENT_QUOTES, "UTF-8")));
44 44
 	}
45 45
 
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 	 * @return string
80 80
 	 */
81 81
 	static public	function ee_tep_parse_input_field_data($data, $parse) {
82
-		return strtr( trim($data), $parse);
82
+		return strtr(trim($data), $parse);
83 83
 	}
84 84
 
85 85
 
@@ -116,17 +116,17 @@  discard block
 block discarded – undo
116 116
 	 * @return string
117 117
 	 * @deprecated v4.6.21
118 118
 	 */
119
-	static public function event_date_display( $date, $format = '' ) {
119
+	static public function event_date_display($date, $format = '') {
120 120
 		EE_Error::doing_it_wrong(
121 121
 			'EEH_Formatter::event_date_display()',
122
-			__( 'This method is deprecated. If you wish to display an Event date in a theme template, then there are better alternatives such as EEH_Event_View::the_event_date() which can be found in \core\helpers\EEH_Event_View.helper.php', 'event_espresso' ),
122
+			__('This method is deprecated. If you wish to display an Event date in a theme template, then there are better alternatives such as EEH_Event_View::the_event_date() which can be found in \core\helpers\EEH_Event_View.helper.php', 'event_espresso'),
123 123
 			'4.6.21'
124 124
 		);
125
-		if ( empty( $date )) {
125
+		if (empty($date)) {
126 126
 			return '';
127 127
 		} else {
128 128
 			$format = $format == '' ? get_option('date_format') : $format;
129
-			return date_i18n( $format, strtotime( $date ));
129
+			return date_i18n($format, strtotime($date));
130 130
 		}
131 131
 	}
132 132
 
@@ -163,14 +163,14 @@  discard block
 block discarded – undo
163 163
 	 * @param string $zip
164 164
 	 * @return string
165 165
 	 */
166
-	public function format( $address, $address2, $city, $state, $country, $zip ) {
166
+	public function format($address, $address2, $city, $state, $country, $zip) {
167 167
 		$formatted_address = $address;
168
-		$formatted_address .= ! empty( $address2 ) ? '<br/>' . $address2 : '';
169
-		$formatted_address .= ! empty( $city ) ? '<br/>' . $city : '';
170
-		$formatted_address .=  ! empty( $city ) && ! empty( $state ) ? ', ' : '';
171
-		$formatted_address .= ! empty( $state ) ? $state : '';
172
-		$formatted_address .= ! empty( $zip ) ? '<br/>' . $zip : '';
173
-		$formatted_address .= ! empty( $country ) ? '<br/>' . $country : '';
168
+		$formatted_address .= ! empty($address2) ? '<br/>'.$address2 : '';
169
+		$formatted_address .= ! empty($city) ? '<br/>'.$city : '';
170
+		$formatted_address .= ! empty($city) && ! empty($state) ? ', ' : '';
171
+		$formatted_address .= ! empty($state) ? $state : '';
172
+		$formatted_address .= ! empty($zip) ? '<br/>'.$zip : '';
173
+		$formatted_address .= ! empty($country) ? '<br/>'.$country : '';
174 174
 		return $formatted_address;
175 175
 	}
176 176
 }
@@ -202,18 +202,18 @@  discard block
 block discarded – undo
202 202
 	 * @param string $zip
203 203
 	 * @return string
204 204
 	 */
205
-	public function format( $address, $address2, $city, $state, $country, $zip ) {
205
+	public function format($address, $address2, $city, $state, $country, $zip) {
206 206
 		$formatted_address = $address;
207
-		$formatted_address .= substr( $formatted_address, -2 ) != ', ' ? ', ' : '';
208
-		$formatted_address .= ! empty( $address2 ) ? $address2 : '';
209
-		$formatted_address .= substr( $formatted_address, -2 ) != ', ' ? ', ' : '';
210
-		$formatted_address .= ! empty( $city ) ? $city : '';
211
-		$formatted_address .= substr( $formatted_address, -2 ) != ', ' ? ', ' : '';
212
-		$formatted_address .= ! empty( $state ) ? $state : '';
213
-		$formatted_address .= substr( $formatted_address, -2 ) != ', ' ? ', ' : '';
214
-		$formatted_address .= ! empty( $country ) ? $country : '';
215
-		$formatted_address .= substr( $formatted_address, -2 ) != ', ' ? ', ' : '';
216
-		$formatted_address .= ! empty( $zip ) ? $zip : '';
207
+		$formatted_address .= substr($formatted_address, -2) != ', ' ? ', ' : '';
208
+		$formatted_address .= ! empty($address2) ? $address2 : '';
209
+		$formatted_address .= substr($formatted_address, -2) != ', ' ? ', ' : '';
210
+		$formatted_address .= ! empty($city) ? $city : '';
211
+		$formatted_address .= substr($formatted_address, -2) != ', ' ? ', ' : '';
212
+		$formatted_address .= ! empty($state) ? $state : '';
213
+		$formatted_address .= substr($formatted_address, -2) != ', ' ? ', ' : '';
214
+		$formatted_address .= ! empty($country) ? $country : '';
215
+		$formatted_address .= substr($formatted_address, -2) != ', ' ? ', ' : '';
216
+		$formatted_address .= ! empty($zip) ? $zip : '';
217 217
 		return $formatted_address;
218 218
 	}
219 219
 }
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
 	 * @param string $zip
247 247
 	 * @return string
248 248
 	 */
249
-	public function format( $address, $address2, $city, $state, $country, $zip ) {
249
+	public function format($address, $address2, $city, $state, $country, $zip) {
250 250
 		return NULL;
251 251
 	}
252 252
 }
@@ -282,20 +282,20 @@  discard block
 block discarded – undo
282 282
 	 * @param bool    $add_wrapper
283 283
 	 * @return string
284 284
 	 */
285
-	public static function format ( $obj_with_address = null, $type = 'multiline', $use_schema = true, $add_wrapper = true ) {
285
+	public static function format($obj_with_address = null, $type = 'multiline', $use_schema = true, $add_wrapper = true) {
286 286
 		// check that incoming object implements the EEI_Address interface
287
-		if ( ! $obj_with_address instanceof EEI_Address ) {
288
-			$msg = __( 'The address could not be formatted.', 'event_espresso' );
289
-			$dev_msg = __( 'The EE_Address_Formatter requires passed objects to implement the EEI_Address interface.', 'event_espresso' );
290
-			EE_Error::add_error( $msg . '||' . $dev_msg, __FILE__, __FUNCTION__, __LINE__ );
287
+		if ( ! $obj_with_address instanceof EEI_Address) {
288
+			$msg = __('The address could not be formatted.', 'event_espresso');
289
+			$dev_msg = __('The EE_Address_Formatter requires passed objects to implement the EEI_Address interface.', 'event_espresso');
290
+			EE_Error::add_error($msg.'||'.$dev_msg, __FILE__, __FUNCTION__, __LINE__);
291 291
 			return null;
292 292
 		}
293 293
 		// obtain an address formatter
294
-		$formatter = EEH_Address::_get_formatter( $type );
294
+		$formatter = EEH_Address::_get_formatter($type);
295 295
 		// apply schema.org formatting ?
296 296
 		$use_schema = ! is_admin() ? $use_schema : false;
297
-		$formatted_address = $use_schema ? EEH_Address::_schema_formatting( $formatter, $obj_with_address ) : EEH_Address::_regular_formatting( $formatter, $obj_with_address, $add_wrapper ) ;
298
-		$formatted_address = $add_wrapper && ! $use_schema ? '<div class="espresso-address-dv">' . $formatted_address . '</div>' : $formatted_address;
297
+		$formatted_address = $use_schema ? EEH_Address::_schema_formatting($formatter, $obj_with_address) : EEH_Address::_regular_formatting($formatter, $obj_with_address, $add_wrapper);
298
+		$formatted_address = $add_wrapper && ! $use_schema ? '<div class="espresso-address-dv">'.$formatted_address.'</div>' : $formatted_address;
299 299
 		// return the formatted address
300 300
 		return $formatted_address;
301 301
 	}
@@ -309,8 +309,8 @@  discard block
 block discarded – undo
309 309
 	* 	@param string $type how the address is formatted. for example: 'multiline' or 'inline'
310 310
 	* 	@return EEI_Address_Formatter
311 311
 	*/
312
-	private static function _get_formatter( $type ) {
313
-		switch( $type ) {
312
+	private static function _get_formatter($type) {
313
+		switch ($type) {
314 314
 
315 315
 			case 'multiline' :
316 316
 				return new EE_MultiLine_Address_Formatter();
@@ -336,7 +336,7 @@  discard block
 block discarded – undo
336 336
 	 * @param bool $add_wrapper
337 337
 	 * @return string
338 338
 	 */
339
-	private static function _regular_formatting( EEI_Address_Formatter $formatter, EEI_Address $obj_with_address, $add_wrapper = TRUE ){
339
+	private static function _regular_formatting(EEI_Address_Formatter $formatter, EEI_Address $obj_with_address, $add_wrapper = TRUE) {
340 340
 		$formatted_address = $add_wrapper ? '<div>' : '';
341 341
 		$formatted_address .= $formatter->format(
342 342
 			$obj_with_address->address(),
@@ -362,15 +362,15 @@  discard block
 block discarded – undo
362 362
 	* 	@param object EEI_Address $obj_with_address
363 363
 	* 	@return string
364 364
 	*/
365
-	private static function _schema_formatting( EEI_Address_Formatter $formatter, EEI_Address $obj_with_address ){
365
+	private static function _schema_formatting(EEI_Address_Formatter $formatter, EEI_Address $obj_with_address) {
366 366
 		$formatted_address = '<div itemprop="address" itemscope itemtype="http://schema.org/PostalAddress">';
367 367
 		$formatted_address .= $formatter->format(
368
-			EEH_Schema::streetAddress( $obj_with_address ),
369
-			EEH_Schema::postOfficeBoxNumber( $obj_with_address ),
370
-			EEH_Schema::addressLocality( $obj_with_address ),
371
-			EEH_Schema::addressRegion( $obj_with_address ),
372
-			EEH_Schema::addressCountry( $obj_with_address ),
373
-			EEH_Schema::postalCode( $obj_with_address )
368
+			EEH_Schema::streetAddress($obj_with_address),
369
+			EEH_Schema::postOfficeBoxNumber($obj_with_address),
370
+			EEH_Schema::addressLocality($obj_with_address),
371
+			EEH_Schema::addressRegion($obj_with_address),
372
+			EEH_Schema::addressCountry($obj_with_address),
373
+			EEH_Schema::postalCode($obj_with_address)
374 374
 		);
375 375
 		$formatted_address .= '</div>';
376 376
 		// return the formatted address
@@ -410,8 +410,8 @@  discard block
 block discarded – undo
410 410
 	* 	@param string $location
411 411
 	* 	@return string
412 412
 	*/
413
-	public static function location ( $location = NULL ) {
414
-		return ! empty( $location ) ? '<div itemprop="location" itemscope itemtype="http://schema.org/Place">' . $location . '</div>' : '';
413
+	public static function location($location = NULL) {
414
+		return ! empty($location) ? '<div itemprop="location" itemscope itemtype="http://schema.org/Place">'.$location.'</div>' : '';
415 415
 	}
416 416
 
417 417
 	/**
@@ -422,8 +422,8 @@  discard block
 block discarded – undo
422 422
 	* 	@param string $name
423 423
 	* 	@return string
424 424
 	*/
425
-	public static function name ( $name = NULL ) {
426
-		return ! empty( $name ) ? '<span itemprop="name">' . $name . '</span>' : '';
425
+	public static function name($name = NULL) {
426
+		return ! empty($name) ? '<span itemprop="name">'.$name.'</span>' : '';
427 427
 	}
428 428
 
429 429
 	/**
@@ -434,8 +434,8 @@  discard block
 block discarded – undo
434 434
 	* 	@param EEI_Address $obj_with_address
435 435
 	* 	@return string
436 436
 	*/
437
-	public static function streetAddress ( EEI_Address $obj_with_address = NULL ) {
438
-		return $obj_with_address->address() !== NULL && $obj_with_address->address() !== '' ? '<span itemprop="streetAddress">' . $obj_with_address->address() . '</span>' : '';
437
+	public static function streetAddress(EEI_Address $obj_with_address = NULL) {
438
+		return $obj_with_address->address() !== NULL && $obj_with_address->address() !== '' ? '<span itemprop="streetAddress">'.$obj_with_address->address().'</span>' : '';
439 439
 	}
440 440
 
441 441
 	/**
@@ -446,10 +446,10 @@  discard block
 block discarded – undo
446 446
 	* 	@param EEI_Address $obj_with_address
447 447
 	* 	@return string
448 448
 	*/
449
-	public static function postOfficeBoxNumber ( EEI_Address $obj_with_address = NULL ) {
449
+	public static function postOfficeBoxNumber(EEI_Address $obj_with_address = NULL) {
450 450
 		// regex check for some form of PO Box or P.O. Box, etc, etc, etc
451
-		if ( preg_match("/^\s*((P(OST)?.?\s*(O(FF(ICE)?)?)?.?\s+(B(IN|OX))?)|B(IN|OX))/i", $obj_with_address->address2() )) {
452
-			return $obj_with_address->address2() !== NULL && $obj_with_address->address2() !== '' ? '<span itemprop="postOfficeBoxNumber">' . $obj_with_address->address2() . '</span>' : '';
451
+		if (preg_match("/^\s*((P(OST)?.?\s*(O(FF(ICE)?)?)?.?\s+(B(IN|OX))?)|B(IN|OX))/i", $obj_with_address->address2())) {
452
+			return $obj_with_address->address2() !== NULL && $obj_with_address->address2() !== '' ? '<span itemprop="postOfficeBoxNumber">'.$obj_with_address->address2().'</span>' : '';
453 453
 		} else {
454 454
 			return $obj_with_address->address2();
455 455
 		}
@@ -463,8 +463,8 @@  discard block
 block discarded – undo
463 463
 	* 	@param EEI_Address $obj_with_address
464 464
 	* 	@return string
465 465
 	*/
466
-	public static function addressLocality ( EEI_Address $obj_with_address = NULL ) {
467
-		return $obj_with_address->city() !== NULL && $obj_with_address->city() !== '' ? '<span itemprop="addressLocality">' . $obj_with_address->city() . '</span>' : '';
466
+	public static function addressLocality(EEI_Address $obj_with_address = NULL) {
467
+		return $obj_with_address->city() !== NULL && $obj_with_address->city() !== '' ? '<span itemprop="addressLocality">'.$obj_with_address->city().'</span>' : '';
468 468
 	}
469 469
 
470 470
 	/**
@@ -475,10 +475,10 @@  discard block
 block discarded – undo
475 475
 	* 	@param EEI_Address $obj_with_address
476 476
 	* 	@return string
477 477
 	*/
478
-	public static function addressRegion ( EEI_Address $obj_with_address = NULL ) {
478
+	public static function addressRegion(EEI_Address $obj_with_address = NULL) {
479 479
 		$state = $obj_with_address->state();
480
-		if ( ! empty( $state ) ) {
481
-			return '<span itemprop="addressRegion">' . $state . '</span>';
480
+		if ( ! empty($state)) {
481
+			return '<span itemprop="addressRegion">'.$state.'</span>';
482 482
 		} else {
483 483
 			return '';
484 484
 		}
@@ -492,10 +492,10 @@  discard block
 block discarded – undo
492 492
 	* 	@param EEI_Address $obj_with_address
493 493
 	* 	@return string
494 494
 	*/
495
-	public static function addressCountry ( EEI_Address $obj_with_address = NULL ) {
495
+	public static function addressCountry(EEI_Address $obj_with_address = NULL) {
496 496
 		$country = $obj_with_address->country();
497
-		if ( ! empty( $country ) ) {
498
-			return '<span itemprop="addressCountry">' . $country . '</span>';
497
+		if ( ! empty($country)) {
498
+			return '<span itemprop="addressCountry">'.$country.'</span>';
499 499
 		} else {
500 500
 			return '';
501 501
 		}
@@ -509,8 +509,8 @@  discard block
 block discarded – undo
509 509
 	* 	@param EEI_Address $obj_with_address
510 510
 	* 	@return string
511 511
 	*/
512
-	public static function postalCode ( EEI_Address $obj_with_address = NULL ) {
513
-		return $obj_with_address->zip() !== NULL && $obj_with_address->zip() !== ''  ? '<span itemprop="postalCode">' . $obj_with_address->zip() . '</span>' : '';
512
+	public static function postalCode(EEI_Address $obj_with_address = NULL) {
513
+		return $obj_with_address->zip() !== NULL && $obj_with_address->zip() !== '' ? '<span itemprop="postalCode">'.$obj_with_address->zip().'</span>' : '';
514 514
 	}
515 515
 
516 516
 	/**
@@ -521,8 +521,8 @@  discard block
 block discarded – undo
521 521
 	* 	@param string $phone_nmbr
522 522
 	* 	@return string
523 523
 	*/
524
-	public static function telephone ( $phone_nmbr = NULL ) {
525
-		return $phone_nmbr !== NULL && $phone_nmbr !== ''  ? '<span itemprop="telephone">' . $phone_nmbr . '</span>' : '';
524
+	public static function telephone($phone_nmbr = NULL) {
525
+		return $phone_nmbr !== NULL && $phone_nmbr !== '' ? '<span itemprop="telephone">'.$phone_nmbr.'</span>' : '';
526 526
 	}
527 527
 
528 528
 	/**
@@ -535,13 +535,13 @@  discard block
 block discarded – undo
535 535
 	* 	@param array $attributes - array of additional link attributes in  attribute_name => value pairs. ie: array( 'title' => 'click here', 'class' => 'link-class' )
536 536
 	* 	@return string (link)
537 537
 	*/
538
-	public static function url ( $url = NULL, $text = NULL, $attributes = array() ) {
538
+	public static function url($url = NULL, $text = NULL, $attributes = array()) {
539 539
 		$atts = '';
540
-		foreach ( $attributes as $attribute => $value ) {
541
-			$atts .= ' ' . $attribute . '="' . $value . '"';
540
+		foreach ($attributes as $attribute => $value) {
541
+			$atts .= ' '.$attribute.'="'.$value.'"';
542 542
 		}
543 543
 		$text = $text !== NULL && $text !== '' ? $text : $url;
544
-		return $url !== NULL && $url !== '' ? '<a itemprop="url" href="' . $url . '"' . $atts . '>' . $text . '</a>' : '';
544
+		return $url !== NULL && $url !== '' ? '<a itemprop="url" href="'.$url.'"'.$atts.'>'.$text.'</a>' : '';
545 545
 	}
546 546
 
547 547
 
@@ -581,17 +581,17 @@  discard block
 block discarded – undo
581 581
 	 * @param string $zip
582 582
 	 * @return EE_Generic_Address
583 583
 	 */
584
-	public function __construct( $address, $address2, $city, $state, $country, $zip ) {
584
+	public function __construct($address, $address2, $city, $state, $country, $zip) {
585 585
 		$this->_address = $address;
586 586
 		$this->_address2 = $address2;
587 587
 		$this->_city = $city;
588
-		if ( $state instanceof EE_State ) {
588
+		if ($state instanceof EE_State) {
589 589
 			$this->_state_obj = $state;
590 590
 		} else {
591 591
 			$this->_state_ID = $state;
592 592
 			$this->_state_obj = $this->_get_state_obj();
593 593
 		}
594
-		if ( $country instanceof EE_Country ) {
594
+		if ($country instanceof EE_Country) {
595 595
 			$this->_country_obj = $country;
596 596
 		} else {
597 597
 			$this->_country_ID = $country;
@@ -633,7 +633,7 @@  discard block
 block discarded – undo
633 633
 	 * @return \EE_State
634 634
 	 */
635 635
 	private function _get_state_obj() {
636
-		return $this->_state_obj instanceof EE_State ? $this->_state_obj : EE_Registry::instance()->load_model( 'State' )->get_one_by_ID( $this->_state_ID );
636
+		return $this->_state_obj instanceof EE_State ? $this->_state_obj : EE_Registry::instance()->load_model('State')->get_one_by_ID($this->_state_ID);
637 637
 	}
638 638
 
639 639
 
@@ -651,7 +651,7 @@  discard block
 block discarded – undo
651 651
 	 * @return string
652 652
 	 */
653 653
 	public function state_abbrev() {
654
-		return $this->state_obj() instanceof EE_State ? $this->state_obj()->abbrev() : __( 'Unknown', 'event_espresso' );
654
+		return $this->state_obj() instanceof EE_State ? $this->state_obj()->abbrev() : __('Unknown', 'event_espresso');
655 655
 	}
656 656
 
657 657
 
@@ -660,7 +660,7 @@  discard block
 block discarded – undo
660 660
 	 * @return string
661 661
 	 */
662 662
 	public function state_name() {
663
-		return $this->state_obj() instanceof EE_State ? $this->state_obj()->name() :  __( 'Unknown', 'event_espresso' );
663
+		return $this->state_obj() instanceof EE_State ? $this->state_obj()->name() : __('Unknown', 'event_espresso');
664 664
 	}
665 665
 
666 666
 
@@ -678,7 +678,7 @@  discard block
 block discarded – undo
678 678
 	 * @return string
679 679
 	 */
680 680
 	public function state() {
681
-		if ( apply_filters( 'FHEE__EEI_Address__state__use_abbreviation', true, $this->state_obj() ) ) {
681
+		if (apply_filters('FHEE__EEI_Address__state__use_abbreviation', true, $this->state_obj())) {
682 682
 			return $this->state_obj()->abbrev();
683 683
 		} else {
684 684
 			return $this->state_name();
@@ -691,7 +691,7 @@  discard block
 block discarded – undo
691 691
 	 * @return EE_Country
692 692
 	 */
693 693
 	private function _get_country_obj() {
694
-		return $this->_country_obj instanceof EE_Country ? $this->_country_obj : EE_Registry::instance()->load_model( 'Country' )->get_one_by_ID( $this->_country_ID );
694
+		return $this->_country_obj instanceof EE_Country ? $this->_country_obj : EE_Registry::instance()->load_model('Country')->get_one_by_ID($this->_country_ID);
695 695
 	}
696 696
 
697 697
 
@@ -709,7 +709,7 @@  discard block
 block discarded – undo
709 709
 	 * @return string
710 710
 	 */
711 711
 	public function country_name() {
712
-		return $this->country_obj() instanceof EE_Country ? $this->country_obj()->name() :  __( 'Unknown', 'event_espresso' );
712
+		return $this->country_obj() instanceof EE_Country ? $this->country_obj()->name() : __('Unknown', 'event_espresso');
713 713
 	}
714 714
 
715 715
 
@@ -727,7 +727,7 @@  discard block
 block discarded – undo
727 727
 	 * @return string
728 728
 	 */
729 729
 	public function country() {
730
-		if ( apply_filters( 'FHEE__EEI_Address__country__use_abbreviation', true, $this->country_obj() ) ) {
730
+		if (apply_filters('FHEE__EEI_Address__country__use_abbreviation', true, $this->country_obj())) {
731 731
 			return $this->country_ID();
732 732
 		} else {
733 733
 			return $this->country_name();
Please login to merge, or discard this patch.
core/helpers/EEH_Maps.helper.php 2 patches
Doc Comments   -2 removed lines patch added patch discarded remove patch
@@ -31,7 +31,6 @@  discard block
 block discarded – undo
31 31
 
32 32
 	/**
33 33
 	 * google_map - creates a Google Map Link
34
-	 * @param  array $atts aray of attributes required for the map link generation
35 34
 	 * @return string (link to map!)
36 35
 	 */
37 36
 	public static function google_map( $ee_gmaps_opts ){
@@ -116,7 +115,6 @@  discard block
 block discarded – undo
116 115
 
117 116
 	/**
118 117
 	 * creates a Google Map Link
119
-	 * @param  array $atts aray of attributes required for the map link generation
120 118
 	 * @return string (link to map!)
121 119
 	 */
122 120
 	public static function espresso_google_map_js() {
Please login to merge, or discard this patch.
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -34,20 +34,20 @@  discard block
 block discarded – undo
34 34
 	 * @param  array $atts aray of attributes required for the map link generation
35 35
 	 * @return string (link to map!)
36 36
 	 */
37
-	public static function google_map( $ee_gmaps_opts ){
37
+	public static function google_map($ee_gmaps_opts) {
38 38
 
39 39
 		//d( $ee_gmaps_opts );
40 40
 
41
-		$ee_map_width = isset( $ee_gmaps_opts['ee_map_width'] ) && ! empty( $ee_gmaps_opts['ee_map_width'] ) ? $ee_gmaps_opts['ee_map_width'] : '300';
42
-		$ee_map_height = isset( $ee_gmaps_opts['ee_map_height'] ) && ! empty( $ee_gmaps_opts['ee_map_height'] ) ? $ee_gmaps_opts['ee_map_height'] : '185';
43
-		$ee_map_zoom = isset( $ee_gmaps_opts['ee_map_zoom'] ) && ! empty( $ee_gmaps_opts['ee_map_zoom'] ) ? $ee_gmaps_opts['ee_map_zoom'] : '12';
44
-		$ee_map_nav_display = isset( $ee_gmaps_opts['ee_map_nav_display'] ) && ! empty( $ee_gmaps_opts['ee_map_nav_display'] ) ? 'true' : 'false';
45
-		$ee_map_nav_size =  isset( $ee_gmaps_opts['ee_map_nav_size'] ) && ! empty( $ee_gmaps_opts['ee_map_nav_size'] )? $ee_gmaps_opts['ee_map_nav_size'] : 'default';
46
-		$ee_map_type_control =  isset( $ee_gmaps_opts['ee_map_type_control'] ) && ! empty( $ee_gmaps_opts['ee_map_type_control'] )? $ee_gmaps_opts['ee_map_type_control'] : 'default';
47
-		$static_url =  isset( $ee_gmaps_opts['ee_static_url'] ) && ! empty( $ee_gmaps_opts['ee_static_url'] )? $ee_gmaps_opts['ee_static_url'] : FALSE;
41
+		$ee_map_width = isset($ee_gmaps_opts['ee_map_width']) && ! empty($ee_gmaps_opts['ee_map_width']) ? $ee_gmaps_opts['ee_map_width'] : '300';
42
+		$ee_map_height = isset($ee_gmaps_opts['ee_map_height']) && ! empty($ee_gmaps_opts['ee_map_height']) ? $ee_gmaps_opts['ee_map_height'] : '185';
43
+		$ee_map_zoom = isset($ee_gmaps_opts['ee_map_zoom']) && ! empty($ee_gmaps_opts['ee_map_zoom']) ? $ee_gmaps_opts['ee_map_zoom'] : '12';
44
+		$ee_map_nav_display = isset($ee_gmaps_opts['ee_map_nav_display']) && ! empty($ee_gmaps_opts['ee_map_nav_display']) ? 'true' : 'false';
45
+		$ee_map_nav_size = isset($ee_gmaps_opts['ee_map_nav_size']) && ! empty($ee_gmaps_opts['ee_map_nav_size']) ? $ee_gmaps_opts['ee_map_nav_size'] : 'default';
46
+		$ee_map_type_control = isset($ee_gmaps_opts['ee_map_type_control']) && ! empty($ee_gmaps_opts['ee_map_type_control']) ? $ee_gmaps_opts['ee_map_type_control'] : 'default';
47
+		$static_url = isset($ee_gmaps_opts['ee_static_url']) && ! empty($ee_gmaps_opts['ee_static_url']) ? $ee_gmaps_opts['ee_static_url'] : FALSE;
48 48
 
49
-		if( isset( $ee_gmaps_opts['ee_map_align'] ) && ! empty( $ee_gmaps_opts['ee_map_align'] )){
50
-			switch( $ee_gmaps_opts['ee_map_align'] ){
49
+		if (isset($ee_gmaps_opts['ee_map_align']) && ! empty($ee_gmaps_opts['ee_map_align'])) {
50
+			switch ($ee_gmaps_opts['ee_map_align']) {
51 51
 				case "left":
52 52
 					$map_align = 'ee-gmap-align-left left';
53 53
 					break;
@@ -68,18 +68,18 @@  discard block
 block discarded – undo
68 68
 
69 69
 		// Determine whether user has set a hardoded url to use and
70 70
 		// if so display a Google static iframe map else run V3 api
71
-		if( $static_url ) {
71
+		if ($static_url) {
72 72
 
73
-			$html = '<div class="ee-gmap-iframewrap ee-gmap-wrapper ' . $map_align . '">';
74
-			$html .= '<iframe src="' . $static_url . '&output=embed" style="width: ' . $ee_map_width  .'px; height: ' . $ee_map_height . 'px;" frameborder="0" scrolling="no">';
73
+			$html = '<div class="ee-gmap-iframewrap ee-gmap-wrapper '.$map_align.'">';
74
+			$html .= '<iframe src="'.$static_url.'&output=embed" style="width: '.$ee_map_width.'px; height: '.$ee_map_height.'px;" frameborder="0" scrolling="no">';
75 75
 			$html .= '</iframe>';
76
-			$html .= '<a href="' . $static_url . '">View Large map</a>';
76
+			$html .= '<a href="'.$static_url.'">View Large map</a>';
77 77
 			$html .= '</div>';
78 78
 			return $html;
79 79
 
80 80
 		 } else {
81 81
 
82
-			EEH_Maps::$gmap_vars[ $ee_gmaps_opts['map_ID'] ] = array(
82
+			EEH_Maps::$gmap_vars[$ee_gmaps_opts['map_ID']] = array(
83 83
 				'map_ID' => $ee_gmaps_opts['map_ID'],
84 84
 				'ee_map_zoom' => $ee_map_zoom,
85 85
 				'ee_map_nav_display' => $ee_map_nav_display,
@@ -89,12 +89,12 @@  discard block
 block discarded – undo
89 89
 			);
90 90
 
91 91
 			$html = '<div class="ee-gmap-wrapper '.$map_align.';">';
92
-			$html .= '<div class="ee-gmap" id="map_canvas_' . $ee_gmaps_opts['map_ID'] .'" style="width: '.$ee_map_width.'px; height: '.$ee_map_height.'px;"></div>';  //
92
+			$html .= '<div class="ee-gmap" id="map_canvas_'.$ee_gmaps_opts['map_ID'].'" style="width: '.$ee_map_width.'px; height: '.$ee_map_height.'px;"></div>'; //
93 93
 			$html .= '</div>';
94 94
 
95
-			wp_enqueue_script( 'gmap_api' );
96
-			wp_enqueue_script( 'ee_gmap' );
97
-			add_action( 'wp_footer', array( 'EEH_Maps', 'footer_enqueue_script' ));
95
+			wp_enqueue_script('gmap_api');
96
+			wp_enqueue_script('ee_gmap');
97
+			add_action('wp_footer', array('EEH_Maps', 'footer_enqueue_script'));
98 98
 
99 99
 			return $html;
100 100
 
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 	 * @return void
110 110
 	 */
111 111
 	public static function footer_enqueue_script() {
112
-		wp_localize_script( 'ee_gmap', 'ee_gmap_vars', EEH_Maps::$gmap_vars );
112
+		wp_localize_script('ee_gmap', 'ee_gmap_vars', EEH_Maps::$gmap_vars);
113 113
 	}
114 114
 
115 115
 
@@ -121,8 +121,8 @@  discard block
 block discarded – undo
121 121
 	 */
122 122
 	public static function espresso_google_map_js() {
123 123
 		$scheme = is_ssl() ? 'https://' : 'http://';
124
-		wp_register_script( 'gmap_api', $scheme . 'maps.google.com/maps/api/js?sensor=false', array('jquery'), NULL, TRUE );
125
-		wp_register_script( 'ee_gmap', plugin_dir_url(__FILE__) . 'assets/ee_gmap.js', array('gmap_api'), '1.0', TRUE );
124
+		wp_register_script('gmap_api', $scheme.'maps.google.com/maps/api/js?sensor=false', array('jquery'), NULL, TRUE);
125
+		wp_register_script('ee_gmap', plugin_dir_url(__FILE__).'assets/ee_gmap.js', array('gmap_api'), '1.0', TRUE);
126 126
 	}
127 127
 
128 128
 	/**
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
 	 * @return string (link to map!)
132 132
 	 */
133 133
 	public static function google_map_link($atts) {
134
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
134
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
135 135
 		extract($atts);
136 136
 
137 137
 		$address = "{$address}";
@@ -146,9 +146,9 @@  discard block
 block discarded – undo
146 146
 		$id = isset($id) ? $id : 'not_set';
147 147
 		$map_image_class = isset($map_image_class) ? $map_image_class : 'ee_google_map_view';
148 148
 
149
-		$address_string = ($address != '' ? $address : '') . ($city != '' ? ',' . $city : '') . ($state != '' ? ',' . $state : '') . ($zip != '' ? ',' . $zip : '') . ($country != '' ? ',' . $country : '');
149
+		$address_string = ($address != '' ? $address : '').($city != '' ? ','.$city : '').($state != '' ? ','.$state : '').($zip != '' ? ','.$zip : '').($country != '' ? ','.$country : '');
150 150
 
151
-		$google_map = htmlentities2('http://maps.google.com/maps?q=' . urlencode( $address_string ));
151
+		$google_map = htmlentities2('http://maps.google.com/maps?q='.urlencode($address_string));
152 152
 
153 153
 		switch ($type) {
154 154
 			case 'text':
@@ -162,10 +162,10 @@  discard block
 block discarded – undo
162 162
 
163 163
 			case 'map':
164 164
 				$scheme = is_ssl() ? 'https://' : 'http://';
165
-				return '<a class="a_map_image_link" href="' . $google_map . '" target="_blank">' . '<img class="map_image_link" id="venue_map_' . $id . '" ' . $map_image_class . ' src="' . htmlentities2( $scheme . 'maps.googleapis.com/maps/api/staticmap?center=' . urlencode( $address_string ) . '&amp;zoom=14&amp;size=' . $map_w . 'x' . $map_h . '&amp;markers=color:green|label:|' . urlencode( $address_string ) . '&amp;sensor=false' ) . '" /></a>';
165
+				return '<a class="a_map_image_link" href="'.$google_map.'" target="_blank">'.'<img class="map_image_link" id="venue_map_'.$id.'" '.$map_image_class.' src="'.htmlentities2($scheme.'maps.googleapis.com/maps/api/staticmap?center='.urlencode($address_string).'&amp;zoom=14&amp;size='.$map_w.'x'.$map_h.'&amp;markers=color:green|label:|'.urlencode($address_string).'&amp;sensor=false').'" /></a>';
166 166
 		}
167 167
 
168
-		return '<a href="' . $google_map . '" target="_blank">' . $text . '</a>';
168
+		return '<a href="'.$google_map.'" target="_blank">'.$text.'</a>';
169 169
 	}
170 170
 
171 171
 
Please login to merge, or discard this patch.
core/helpers/EEH_Qtip_Loader.helper.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -109,7 +109,7 @@
 block discarded – undo
109 109
 	 * - registers and enqueues the qtip scripts and styles.
110 110
 	 *
111 111
 	 * @access public
112
-	 * @param  array  $paths      Array of paths to check for the EE_Qtip class. If present we check these path(s) first.  If not present (empty array), then it's assumed it's either in core/libraries/qtips OR the file is already loaded.
112
+	 * @param  string[]  $paths      Array of paths to check for the EE_Qtip class. If present we check these path(s) first.  If not present (empty array), then it's assumed it's either in core/libraries/qtips OR the file is already loaded.
113 113
 	 * @param  string|array $configname name of the Qtip class (full class name is expected and will be used for looking for file, Qtip config classes must extend EE_Qtip_Config) [if this is an array, then we loop through the array to instantiate and setup the qtips]
114 114
 	 * @return void
115 115
 	 */
Please login to merge, or discard this patch.
Spacing   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 	 */
33 33
 	public static function instance() {
34 34
 		// check if class object is instantiated
35
-		if ( self::$_instance === NULL  or ! is_object( self::$_instance ) or ! ( self::$_instance instanceof EEH_Qtip_Loader )) {
35
+		if (self::$_instance === NULL or ! is_object(self::$_instance) or ! (self::$_instance instanceof EEH_Qtip_Loader)) {
36 36
 			self::$_instance = new self();
37 37
 		}
38 38
 		return self::$_instance;
@@ -48,8 +48,8 @@  discard block
 block discarded – undo
48 48
 	 */
49 49
 	private function __construct() {
50 50
 		//let's just make sure this is instantiated in the right place.
51
-		if ( did_action( 'wp_print_styles' ) || did_action( 'admin_head' )) {
52
-			EE_Error::doing_it_wrong( 'EEH_Qtip_Loader', __('This helper must be instantiated before or within a callback for the WordPress wp_enqueue_scripts hook action hook.', 'event_espresso' ), '4.1' );
51
+		if (did_action('wp_print_styles') || did_action('admin_head')) {
52
+			EE_Error::doing_it_wrong('EEH_Qtip_Loader', __('This helper must be instantiated before or within a callback for the WordPress wp_enqueue_scripts hook action hook.', 'event_espresso'), '4.1');
53 53
 		}
54 54
 	}
55 55
 
@@ -61,27 +61,27 @@  discard block
 block discarded – undo
61 61
 	 * @return void
62 62
 	 */
63 63
 	public function register_and_enqueue() {
64
-		$qtips_js = !defined('SCRIPT_DEBUG') ? EE_THIRD_PARTY_URL . 'qtip/jquery.qtip.min.js' : EE_THIRD_PARTY_URL . 'qtip/jquery.qtip.js';
65
-		$qtip_images_loaded = EE_THIRD_PARTY_URL . 'qtip/imagesloaded.pkg.min.js';
66
-		$qtip_map = EE_THIRD_PARTY_URL . 'qtip/jquery.qtip.min.map';
67
-		$qtipcss = !defined('SCRIPT_DEBUG') ? EE_THIRD_PARTY_URL . 'qtip/jquery.qtip.min.css' : EE_THIRD_PARTY_URL . 'qtip/jquery.qtip.css';
64
+		$qtips_js = ! defined('SCRIPT_DEBUG') ? EE_THIRD_PARTY_URL.'qtip/jquery.qtip.min.js' : EE_THIRD_PARTY_URL.'qtip/jquery.qtip.js';
65
+		$qtip_images_loaded = EE_THIRD_PARTY_URL.'qtip/imagesloaded.pkg.min.js';
66
+		$qtip_map = EE_THIRD_PARTY_URL.'qtip/jquery.qtip.min.map';
67
+		$qtipcss = ! defined('SCRIPT_DEBUG') ? EE_THIRD_PARTY_URL.'qtip/jquery.qtip.min.css' : EE_THIRD_PARTY_URL.'qtip/jquery.qtip.css';
68 68
 
69
-		wp_register_script('qtip-map', $qtip_map, array(), '3', TRUE );
70
-		wp_register_script('qtip-images-loaded', $qtip_images_loaded, array(), '2.2.0', TRUE );
71
-		wp_register_script('qtip', $qtips_js, array('jquery'), '2.2.0', TRUE );
72
-		wp_register_script('ee-qtip-helper', EE_HELPERS_ASSETS . 'ee-qtip-helper.js', array('qtip', 'jquery-cookie'), EVENT_ESPRESSO_VERSION, TRUE );
69
+		wp_register_script('qtip-map', $qtip_map, array(), '3', TRUE);
70
+		wp_register_script('qtip-images-loaded', $qtip_images_loaded, array(), '2.2.0', TRUE);
71
+		wp_register_script('qtip', $qtips_js, array('jquery'), '2.2.0', TRUE);
72
+		wp_register_script('ee-qtip-helper', EE_HELPERS_ASSETS.'ee-qtip-helper.js', array('qtip', 'jquery-cookie'), EVENT_ESPRESSO_VERSION, TRUE);
73 73
 
74
-		wp_register_style('qtip-css', $qtipcss, array(), '2.2' );
74
+		wp_register_style('qtip-css', $qtipcss, array(), '2.2');
75 75
 
76 76
 		//k now let's see if there are any registered qtips.  If there are, then we need to setup the localized script for ee-qtip-helper.js (and enqueue ee-qtip-helper.js of course!)
77
-		if ( !empty( $this->_qtips ) ) {
77
+		if ( ! empty($this->_qtips)) {
78 78
 			wp_enqueue_script('ee-qtip-helper');
79 79
 			wp_enqueue_style('qtip-css');
80 80
 			$qtips = array();
81
-			foreach ( $this->_qtips as $qtip ) {
81
+			foreach ($this->_qtips as $qtip) {
82 82
 				$qts = $qtip->get_tips();
83
-				foreach ( $qts as $qt ) {
84
-					if ( ! $qt instanceof EE_Qtip )
83
+				foreach ($qts as $qt) {
84
+					if ( ! $qt instanceof EE_Qtip)
85 85
 						continue;
86 86
 					$qtips[] = array(
87 87
 						'content_id' => $qt->content_id,
@@ -90,8 +90,8 @@  discard block
 block discarded – undo
90 90
 						);
91 91
 				}
92 92
 			}
93
-			if ( !empty($qtips) )
94
-				wp_localize_script('ee-qtip-helper', 'EE_QTIP_HELPER', array( 'qtips' => $qtips ) );
93
+			if ( ! empty($qtips))
94
+				wp_localize_script('ee-qtip-helper', 'EE_QTIP_HELPER', array('qtips' => $qtips));
95 95
 
96 96
 		} else {
97 97
 			//qtips has been requested without any registration (so assuming its just directly used in the admin).
@@ -113,24 +113,24 @@  discard block
 block discarded – undo
113 113
 	 * @param  string|array $configname name of the Qtip class (full class name is expected and will be used for looking for file, Qtip config classes must extend EE_Qtip_Config) [if this is an array, then we loop through the array to instantiate and setup the qtips]
114 114
 	 * @return void
115 115
 	 */
116
-	public function register( $configname, $paths = array() ) {
116
+	public function register($configname, $paths = array()) {
117 117
 
118 118
 		//let's just make sure this is instantiated in the right place.
119
-		if ( did_action('wp_enqueue_scripts') || did_action('admin_enqueue_scripts') ) {
120
-			EE_Error::doing_it_wrong( 'EEH_Qtip_Loader->register()', __('EE_Qtip_Config objects must be registered before wp_enqueue_scripts is called.', 'event_espresso' ), '4.1' );
119
+		if (did_action('wp_enqueue_scripts') || did_action('admin_enqueue_scripts')) {
120
+			EE_Error::doing_it_wrong('EEH_Qtip_Loader->register()', __('EE_Qtip_Config objects must be registered before wp_enqueue_scripts is called.', 'event_espresso'), '4.1');
121 121
 		}
122 122
 
123 123
 		$configname = (array) $configname; //typecast to array
124
-		foreach ( $configname as $config ) {
125
-			$this->_register( $config, $paths );
124
+		foreach ($configname as $config) {
125
+			$this->_register($config, $paths);
126 126
 		}
127 127
 
128 128
 		//hook into appropriate footer
129 129
 		$footer_action = is_admin() ? 'admin_footer' : 'wp_footer';
130
-		add_action($footer_action, array($this, 'setup_qtip'), 10 );
130
+		add_action($footer_action, array($this, 'setup_qtip'), 10);
131 131
 
132 132
 		//make sure we "turn on" qtip js.
133
-		add_filter('FHEE_load_qtip', '__return_true' );
133
+		add_filter('FHEE_load_qtip', '__return_true');
134 134
 	}
135 135
 
136 136
 
@@ -144,15 +144,15 @@  discard block
 block discarded – undo
144 144
 	 * @throws EE_Error
145 145
 	 * @return void
146 146
 	 */
147
-	private function _register( $config, $paths ) {
147
+	private function _register($config, $paths) {
148 148
 		//before doing anything we have to make sure that EE_Qtip_Config parent is required.
149
-		EE_Registry::instance()->load_lib( 'Qtip_Config', array(), TRUE );
149
+		EE_Registry::instance()->load_lib('Qtip_Config', array(), TRUE);
150 150
 
151
-		if ( !empty( $paths ) ) {
151
+		if ( ! empty($paths)) {
152 152
 			$paths = (array) $paths;
153
-			foreach ( $paths as $path ) {
154
-				$path = $path . $config . '.lib.php';
155
-				if ( !is_readable($path ) ) {
153
+			foreach ($paths as $path) {
154
+				$path = $path.$config.'.lib.php';
155
+				if ( ! is_readable($path)) {
156 156
 					continue;
157 157
 				} else {
158 158
 					require_once $path;
@@ -161,26 +161,26 @@  discard block
 block discarded – undo
161 161
 		}
162 162
 
163 163
 		//does class exist at this point?  If it does then let's instantiate.  If it doesn't then let's continue with other paths.
164
-		if ( !class_exists($config) ) {
165
-			$path = EE_LIBRARIES . 'qtips/' . $config . '.lib.php';
166
-			if ( !is_readable($path ) ) {
167
-				throw new EE_Error( sprintf( __('Unable to load the Qtip Config registered for this page (%s) because none of the file paths attempted are readable.  Please check the spelling of the paths you\'ve used in the registration', 'event_espresso'), $config ) );
164
+		if ( ! class_exists($config)) {
165
+			$path = EE_LIBRARIES.'qtips/'.$config.'.lib.php';
166
+			if ( ! is_readable($path)) {
167
+				throw new EE_Error(sprintf(__('Unable to load the Qtip Config registered for this page (%s) because none of the file paths attempted are readable.  Please check the spelling of the paths you\'ve used in the registration', 'event_espresso'), $config));
168 168
 			} else {
169 169
 				require_once $path;
170 170
 			}
171 171
 		}
172 172
 
173 173
 		//now we attempt a class_exists one more time.
174
-		if ( !class_exists( $config ) )
175
-			throw new EE_Error( sprintf( __('The Qtip_Config class being registered (%s) does not exist, please check the spelling.', 'event_espresso'), $config ) );
174
+		if ( ! class_exists($config))
175
+			throw new EE_Error(sprintf(__('The Qtip_Config class being registered (%s) does not exist, please check the spelling.', 'event_espresso'), $config));
176 176
 
177 177
 		//made it HERE?  FINALLY, let's get things setup.
178 178
 		$a = new ReflectionClass($config);
179 179
 		$qtip = $a->newInstance();
180 180
 
181 181
 		//verify that $qtip is a valid object
182
-		if ( ! $qtip instanceof EE_Qtip_Config )
183
-			throw new EE_Error( sprintf( __( 'The class given for the Qtip loader (%s) is not a child of the <strong>EE_Qtip_Config</strong> class. Please make sure you are extending EE_Qtip_Config.', 'event_espresso'), $config ) );
182
+		if ( ! $qtip instanceof EE_Qtip_Config)
183
+			throw new EE_Error(sprintf(__('The class given for the Qtip loader (%s) is not a child of the <strong>EE_Qtip_Config</strong> class. Please make sure you are extending EE_Qtip_Config.', 'event_espresso'), $config));
184 184
 
185 185
 		$this->_qtips[] = $a->newInstance();
186 186
 
@@ -196,12 +196,12 @@  discard block
 block discarded – undo
196 196
 	 * @return void
197 197
 	 */
198 198
 	public function setup_qtip() {
199
-		if ( empty( $this->_qtips ) )
199
+		if (empty($this->_qtips))
200 200
 			return; //no qtips!
201 201
 
202 202
 		$content = array();
203 203
 
204
-		foreach ( $this->_qtips as $qtip ) {
204
+		foreach ($this->_qtips as $qtip) {
205 205
 			$content[] = $this->_generate_content_container($qtip);
206 206
 		}
207 207
 
@@ -218,10 +218,10 @@  discard block
 block discarded – undo
218 218
 	private function _generate_content_container($qtip) {
219 219
 		$qts = $qtip->get_tips();
220 220
 		$content = array();
221
-		foreach ( $qts as $qt ) {
222
-			if ( ! $qt instanceof EE_Qtip )
221
+		foreach ($qts as $qt) {
222
+			if ( ! $qt instanceof EE_Qtip)
223 223
 				continue;
224
-			$content[] = '<div class="ee-qtip-helper-content hidden" id="' . $qt->content_id . '">' . $qt->content . '</div>';
224
+			$content[] = '<div class="ee-qtip-helper-content hidden" id="'.$qt->content_id.'">'.$qt->content.'</div>';
225 225
 		}
226 226
 
227 227
 		return implode('<br />', $content);
Please login to merge, or discard this patch.
Braces   +19 added lines, -12 removed lines patch added patch discarded remove patch
@@ -81,8 +81,9 @@  discard block
 block discarded – undo
81 81
 			foreach ( $this->_qtips as $qtip ) {
82 82
 				$qts = $qtip->get_tips();
83 83
 				foreach ( $qts as $qt ) {
84
-					if ( ! $qt instanceof EE_Qtip )
85
-						continue;
84
+					if ( ! $qt instanceof EE_Qtip ) {
85
+											continue;
86
+					}
86 87
 					$qtips[] = array(
87 88
 						'content_id' => $qt->content_id,
88 89
 						'options' => $qt->options,
@@ -90,8 +91,9 @@  discard block
 block discarded – undo
90 91
 						);
91 92
 				}
92 93
 			}
93
-			if ( !empty($qtips) )
94
-				wp_localize_script('ee-qtip-helper', 'EE_QTIP_HELPER', array( 'qtips' => $qtips ) );
94
+			if ( !empty($qtips) ) {
95
+							wp_localize_script('ee-qtip-helper', 'EE_QTIP_HELPER', array( 'qtips' => $qtips ) );
96
+			}
95 97
 
96 98
 		} else {
97 99
 			//qtips has been requested without any registration (so assuming its just directly used in the admin).
@@ -171,16 +173,18 @@  discard block
 block discarded – undo
171 173
 		}
172 174
 
173 175
 		//now we attempt a class_exists one more time.
174
-		if ( !class_exists( $config ) )
175
-			throw new EE_Error( sprintf( __('The Qtip_Config class being registered (%s) does not exist, please check the spelling.', 'event_espresso'), $config ) );
176
+		if ( !class_exists( $config ) ) {
177
+					throw new EE_Error( sprintf( __('The Qtip_Config class being registered (%s) does not exist, please check the spelling.', 'event_espresso'), $config ) );
178
+		}
176 179
 
177 180
 		//made it HERE?  FINALLY, let's get things setup.
178 181
 		$a = new ReflectionClass($config);
179 182
 		$qtip = $a->newInstance();
180 183
 
181 184
 		//verify that $qtip is a valid object
182
-		if ( ! $qtip instanceof EE_Qtip_Config )
183
-			throw new EE_Error( sprintf( __( 'The class given for the Qtip loader (%s) is not a child of the <strong>EE_Qtip_Config</strong> class. Please make sure you are extending EE_Qtip_Config.', 'event_espresso'), $config ) );
185
+		if ( ! $qtip instanceof EE_Qtip_Config ) {
186
+					throw new EE_Error( sprintf( __( 'The class given for the Qtip loader (%s) is not a child of the <strong>EE_Qtip_Config</strong> class. Please make sure you are extending EE_Qtip_Config.', 'event_espresso'), $config ) );
187
+		}
184 188
 
185 189
 		$this->_qtips[] = $a->newInstance();
186 190
 
@@ -196,8 +200,10 @@  discard block
 block discarded – undo
196 200
 	 * @return void
197 201
 	 */
198 202
 	public function setup_qtip() {
199
-		if ( empty( $this->_qtips ) )
200
-			return; //no qtips!
203
+		if ( empty( $this->_qtips ) ) {
204
+					return;
205
+		}
206
+		//no qtips!
201 207
 
202 208
 		$content = array();
203 209
 
@@ -219,8 +225,9 @@  discard block
 block discarded – undo
219 225
 		$qts = $qtip->get_tips();
220 226
 		$content = array();
221 227
 		foreach ( $qts as $qt ) {
222
-			if ( ! $qt instanceof EE_Qtip )
223
-				continue;
228
+			if ( ! $qt instanceof EE_Qtip ) {
229
+							continue;
230
+			}
224 231
 			$content[] = '<div class="ee-qtip-helper-content hidden" id="' . $qt->content_id . '">' . $qt->content . '</div>';
225 232
 		}
226 233
 
Please login to merge, or discard this patch.
core/helpers/EEH_Tabbed_Content.helper.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -131,7 +131,7 @@
 block discarded – undo
131 131
 	/**
132 132
 	 * this just returns the properly formatted tab content for our tab box.
133 133
 	 * @param  string $name    name of tab (used for selector)
134
-	 * @param  string $content content of tab
134
+	 * @param  string $tab_content content of tab
135 135
 	 * @return string          html for content area
136 136
 	 */
137 137
 	private static function tab_content($name, $tab_content, $active = false) {
Please login to merge, or discard this patch.
Spacing   +35 added lines, -35 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
 /**
@@ -43,22 +43,22 @@  discard block
 block discarded – undo
43 43
 	 * @param  array $tabs_content an array of the content for each tab [required]
44 44
 	 * @return string               the assembled html string containing the tabbed content for display.
45 45
 	 */
46
-	public static function display($tabs_contents, $tabs_names = array(), $small_tabs = true, $tabs_content = TRUE ) {
46
+	public static function display($tabs_contents, $tabs_names = array(), $small_tabs = true, $tabs_content = TRUE) {
47 47
 
48 48
 		//first check if $tabs_names is not empty then the count must match the count of $tabs_content otherwise we've got a problem houston
49
-		if ( !empty( $tabs_names) && ( count( (array) $tabs_names) != count( (array) $tabs_content) ) ) {
50
-			throw new EE_Error( __('The count for $tabs_names and $tabs_content does not match.', 'event_espresso') );
49
+		if ( ! empty($tabs_names) && (count((array) $tabs_names) != count((array) $tabs_content))) {
50
+			throw new EE_Error(__('The count for $tabs_names and $tabs_content does not match.', 'event_espresso'));
51 51
 		}
52 52
 
53 53
 		//make sure we've got incoming data setup properly
54
-		$tabs = !empty( $tabs_names ) ? (array) $tabs_names : array_keys( (array) $tabs_contents );
55
-		$tabs_content = !empty( $tabs_names ) ? array_combine( (array) $tabs_names, (array) $tabs_content ) : $tabs_contents;
54
+		$tabs = ! empty($tabs_names) ? (array) $tabs_names : array_keys((array) $tabs_contents);
55
+		$tabs_content = ! empty($tabs_names) ? array_combine((array) $tabs_names, (array) $tabs_content) : $tabs_contents;
56 56
 
57
-		$all_tabs = '<h2 class="nav-tab-wrapper">' . "\n";
57
+		$all_tabs = '<h2 class="nav-tab-wrapper">'."\n";
58 58
 		$all_tabs_content = '';
59 59
 
60 60
 		$index = 0;
61
-		foreach ( $tabs as $tab ) {
61
+		foreach ($tabs as $tab) {
62 62
 			$active = $index === 0 ? true : false;
63 63
 			$all_tabs .= self::tab($tab, $active);
64 64
 			$all_tabs_content .= self::tab_content($tab, $tabs_content[$tab], $active);
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 
76 76
 		$tab_container_class = $small_tabs ? 'ee-nav-tabs ee-nav-tabs-small' : 'ee-nav-tabs';
77 77
 
78
-		return '<div class="'. $tab_container_class . '">' . "\n\t" . $all_tabs . $all_tabs_content . "\n" . '</div>';
78
+		return '<div class="'.$tab_container_class.'">'."\n\t".$all_tabs.$all_tabs_content."\n".'</div>';
79 79
 	}
80 80
 
81 81
 
@@ -98,11 +98,11 @@  discard block
 block discarded – undo
98 98
 	 * @param array $nav_tabs tab array for nav tabs
99 99
 	 */
100 100
 	public static function display_admin_nav_tabs($nav_tabs = array()) {
101
-		if ( empty($nav_tabs) )
102
-			throw new EE_Error( __('Nav Tabs cannot be generated because the tab array is missing', 'event_espresso' ) );
101
+		if (empty($nav_tabs))
102
+			throw new EE_Error(__('Nav Tabs cannot be generated because the tab array is missing', 'event_espresso'));
103 103
 
104
-		$all_tabs = '<h2 class="nav-tab-wrapper">' . "\n";
105
-		foreach ( $nav_tabs as $slug => $tab ) {
104
+		$all_tabs = '<h2 class="nav-tab-wrapper">'."\n";
105
+		foreach ($nav_tabs as $slug => $tab) {
106 106
 			$all_tabs .= self::tab($slug, false, $tab['link_text'], $tab['url'], $tab['css_class']);
107 107
 		}
108 108
 		$all_tabs .= '</h2>';
@@ -118,13 +118,13 @@  discard block
 block discarded – undo
118 118
 	 * @param bool|string $css If string given then the generated tab will include that as the class.
119 119
 	 * @return string          html for tab
120 120
 	 */
121
-	private static function tab($name, $active = false, $nice_name = FALSE, $url = FALSE, $css = FALSE ) {
121
+	private static function tab($name, $active = false, $nice_name = FALSE, $url = FALSE, $css = FALSE) {
122 122
 		$name = str_replace(' ', '-', $name);
123 123
 		$class = $active ? 'nav-tab nav-tab-active' : 'nav-tab';
124
-		$class = $css ? $class . ' ' . $css : $class;
125
-		$nice_name = $nice_name ? $nice_name : ucwords( preg_replace('/(-|_)/', ' ', $name) );
126
-		$url = $url ? $url : '#' . $name;
127
-		$tab = '<a class="' . $class . '" rel="ee-tab-' . $name . '" href="' . $url . '">' . $nice_name . '</a>' . "\n\t";
124
+		$class = $css ? $class.' '.$css : $class;
125
+		$nice_name = $nice_name ? $nice_name : ucwords(preg_replace('/(-|_)/', ' ', $name));
126
+		$url = $url ? $url : '#'.$name;
127
+		$tab = '<a class="'.$class.'" rel="ee-tab-'.$name.'" href="'.$url.'">'.$nice_name.'</a>'."\n\t";
128 128
 		return $tab;
129 129
 	}
130 130
 
@@ -136,9 +136,9 @@  discard block
 block discarded – undo
136 136
 	 */
137 137
 	private static function tab_content($name, $tab_content, $active = false) {
138 138
 		$class = $active ? 'nav-tab-content' : 'nav-tab-content hidden';
139
-		$name = str_replace( ' ', '-', $name);
140
-		$content = "\t" . '<div class="'. $class . '" id="ee-tab-' . $name . '">' . "\n";
141
-		$content .= "\t" . $tab_content . "\n";
139
+		$name = str_replace(' ', '-', $name);
140
+		$content = "\t".'<div class="'.$class.'" id="ee-tab-'.$name.'">'."\n";
141
+		$content .= "\t".$tab_content."\n";
142 142
 		$content .= '<div style="clear:both"></div></div>';
143 143
 		return $content;
144 144
 	}
@@ -164,8 +164,8 @@  discard block
 block discarded – undo
164 164
 	 * @param string $default 			You can include a string for the item that will receive the "item_display" class for the js.
165 165
 	 * @return string                  a html snippet of of all the formatted link elements.
166 166
 	 */
167
-	public static function tab_text_links( $item_array, $container_class = '', $sep = '|', $default = '' ) {
168
-		if ( !is_array($item_array) || empty( $item_array ) )
167
+	public static function tab_text_links($item_array, $container_class = '', $sep = '|', $default = '') {
168
+		if ( ! is_array($item_array) || empty($item_array))
169 169
 			return false; //get out we don't have even the basic thing we need!
170 170
 
171 171
 
@@ -176,15 +176,15 @@  discard block
 block discarded – undo
176 176
 			'title' => esc_attr__('Link for Item', 'event_espresso'),
177 177
 			'slug' => 'item_slug'
178 178
 		);
179
-		$container_class = !empty($container_class) ? 'ee-text-links ' . $container_class : 'ee-text-links';
180
-		$list = '<ul class="' . $container_class . '">';
179
+		$container_class = ! empty($container_class) ? 'ee-text-links '.$container_class : 'ee-text-links';
180
+		$list = '<ul class="'.$container_class.'">';
181 181
 
182 182
 		$ci = 1;
183
-		foreach ( $item_array as $item ) {
184
-			$item = wp_parse_args( $item, $defaults );
185
-			$item['class'] = !empty($default) && $default == $item['slug'] ? 'item_display ' . $item['class'] : $item['class'];
183
+		foreach ($item_array as $item) {
184
+			$item = wp_parse_args($item, $defaults);
185
+			$item['class'] = ! empty($default) && $default == $item['slug'] ? 'item_display '.$item['class'] : $item['class'];
186 186
 			$list .= self::_text_link_item($item);
187
-			if ( !empty($sep) && $ci != count($item_array) )
187
+			if ( ! empty($sep) && $ci != count($item_array))
188 188
 				$list .= self::_text_link_item($sep);
189 189
 			$ci++;
190 190
 		}
@@ -195,9 +195,9 @@  discard block
 block discarded – undo
195 195
 
196 196
 
197 197
 
198
-	private static function _text_link_item( $item ) {
198
+	private static function _text_link_item($item) {
199 199
 		//if this isn't an array then we're doing a separator
200
-		if ( !is_array( $item ) ) {
200
+		if ( ! is_array($item)) {
201 201
 			$label = $item;
202 202
 			$class = 'ee-text-link-sep';
203 203
 			$href = '';
@@ -206,12 +206,12 @@  discard block
 block discarded – undo
206 206
 			extract($item);
207 207
 		}
208 208
 
209
-		$class = $class != 'ee-text-link-sep'  ? 'class="ee-text-link-li ' . $class . '"' : 'class="ee-text-link-sep"';
209
+		$class = $class != 'ee-text-link-sep' ? 'class="ee-text-link-li '.$class.'"' : 'class="ee-text-link-sep"';
210 210
 
211
-		$content = '<li ' . $class . '>';
212
-		$content .= !empty($href) ? '<a class="ee-text-link" href="#' . $href . '" title="' . $title . '">' : '';
211
+		$content = '<li '.$class.'>';
212
+		$content .= ! empty($href) ? '<a class="ee-text-link" href="#'.$href.'" title="'.$title.'">' : '';
213 213
 		$content .= $label;
214
-		$content .= !empty($href) ? '</a>' : '';
214
+		$content .= ! empty($href) ? '</a>' : '';
215 215
 		$content .= '</li>';
216 216
 		return $content;
217 217
 	}
Please login to merge, or discard this patch.
Braces   +12 added lines, -7 removed lines patch added patch discarded remove patch
@@ -1,6 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (!defined('EVENT_ESPRESSO_VERSION') )
2
+if (!defined('EVENT_ESPRESSO_VERSION') ) {
3 3
 	exit('NO direct script access allowed');
4
+}
4 5
 
5 6
 /**
6 7
  * Event Espresso
@@ -98,8 +99,9 @@  discard block
 block discarded – undo
98 99
 	 * @param array $nav_tabs tab array for nav tabs
99 100
 	 */
100 101
 	public static function display_admin_nav_tabs($nav_tabs = array()) {
101
-		if ( empty($nav_tabs) )
102
-			throw new EE_Error( __('Nav Tabs cannot be generated because the tab array is missing', 'event_espresso' ) );
102
+		if ( empty($nav_tabs) ) {
103
+					throw new EE_Error( __('Nav Tabs cannot be generated because the tab array is missing', 'event_espresso' ) );
104
+		}
103 105
 
104 106
 		$all_tabs = '<h2 class="nav-tab-wrapper">' . "\n";
105 107
 		foreach ( $nav_tabs as $slug => $tab ) {
@@ -165,8 +167,10 @@  discard block
 block discarded – undo
165 167
 	 * @return string                  a html snippet of of all the formatted link elements.
166 168
 	 */
167 169
 	public static function tab_text_links( $item_array, $container_class = '', $sep = '|', $default = '' ) {
168
-		if ( !is_array($item_array) || empty( $item_array ) )
169
-			return false; //get out we don't have even the basic thing we need!
170
+		if ( !is_array($item_array) || empty( $item_array ) ) {
171
+					return false;
172
+		}
173
+		//get out we don't have even the basic thing we need!
170 174
 
171 175
 
172 176
 		$defaults = array(
@@ -184,8 +188,9 @@  discard block
 block discarded – undo
184 188
 			$item = wp_parse_args( $item, $defaults );
185 189
 			$item['class'] = !empty($default) && $default == $item['slug'] ? 'item_display ' . $item['class'] : $item['class'];
186 190
 			$list .= self::_text_link_item($item);
187
-			if ( !empty($sep) && $ci != count($item_array) )
188
-				$list .= self::_text_link_item($sep);
191
+			if ( !empty($sep) && $ci != count($item_array) ) {
192
+							$list .= self::_text_link_item($sep);
193
+			}
189 194
 			$ci++;
190 195
 		}
191 196
 
Please login to merge, or discard this patch.