Completed
Branch FET-9576-iframes (0c4243)
by
unknown
62:05 queued 49:26
created
core/data_migration_scripts/4_1_0_stages/EE_DMS_4_1_0_events.dmsstage.php 2 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -419,7 +419,7 @@  discard block
 block discarded – undo
419 419
 
420 420
 	/**
421 421
 	 * @param $old_event
422
-	 * @param $new_cpt_id
422
+	 * @param integer $new_cpt_id
423 423
 	 * @return int
424 424
 	 */
425 425
 	private function _insert_event_meta( $old_event, $new_cpt_id){
@@ -676,8 +676,8 @@  discard block
 block discarded – undo
676 676
 
677 677
 
678 678
 	/**
679
-	 * @param $new_event_id
680
-	 * @param $new_venue_id
679
+	 * @param integer $new_event_id
680
+	 * @param integer $new_venue_id
681 681
 	 * @return int
682 682
 	 */
683 683
 	private function _insert_new_venue_to_event( $new_event_id, $new_venue_id){
Please login to merge, or discard this patch.
Spacing   +206 added lines, -206 removed lines patch added patch discarded remove patch
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
 				'DTT_deleted' => new EE_Trashed_Flag_Field('DTT_deleted', __('Flag indicating datetime is archived', 'event_espresso'), false, false ),
159 159
 			));
160 160
  */
161
-class EE_DMS_4_1_0_events extends EE_Data_Migration_Script_Stage{
161
+class EE_DMS_4_1_0_events extends EE_Data_Migration_Script_Stage {
162 162
 	private $_old_table;
163 163
 	private $_old_start_end_table;
164 164
 	private $_new_table;
@@ -205,43 +205,43 @@  discard block
 block discarded – undo
205 205
 	 * @param int $num_items_to_migrate
206 206
 	 * @return int number of items ACTUALLY migrated
207 207
 	 */
208
-	protected function _migration_step( $num_items_to_migrate = 50) {
208
+	protected function _migration_step($num_items_to_migrate = 50) {
209 209
 		global $wpdb;
210 210
 		//because the migration of each event can be a LOT more work, make each step smaller
211
-		$num_items_to_migrate = max(1,$num_items_to_migrate/5);
212
-		$events = $wpdb->get_results($wpdb->prepare("SELECT * FROM $this->_old_table LIMIT %d,%d",$this->count_records_migrated(),$num_items_to_migrate),ARRAY_A);
211
+		$num_items_to_migrate = max(1, $num_items_to_migrate / 5);
212
+		$events = $wpdb->get_results($wpdb->prepare("SELECT * FROM $this->_old_table LIMIT %d,%d", $this->count_records_migrated(), $num_items_to_migrate), ARRAY_A);
213 213
 		$items_migrated_this_step = 0;
214 214
 
215
-		foreach($events as $event_row){
215
+		foreach ($events as $event_row) {
216 216
 			$guid = null;
217 217
 			//insert new 4.1 Attendee object using $wpdb
218 218
 			$post_id = $this->_insert_cpt($event_row);
219
-			if($post_id){
219
+			if ($post_id) {
220 220
 				$this->get_migration_script()->set_mapping($this->_old_table, $event_row['id'], $this->_new_table, $post_id);
221 221
 				$meta_id = $this->_insert_event_meta($event_row, $post_id);
222
-				if($meta_id){
222
+				if ($meta_id) {
223 223
 					$this->get_migration_script()->set_mapping($this->_old_table, $event_row['id'], $this->_new_meta_table, $meta_id);
224 224
 				}
225
-				$this->_convert_start_end_times($event_row,$post_id);
225
+				$this->_convert_start_end_times($event_row, $post_id);
226 226
 				$event_meta = maybe_unserialize($event_row['event_meta']);
227 227
 				$guid = isset($event_meta['event_thumbnail_url']) ? $event_meta['event_thumbnail_url'] : null;
228
-				$this->get_migration_script()->convert_image_url_to_attachment_and_attach_to_post($guid,$post_id,$this);
228
+				$this->get_migration_script()->convert_image_url_to_attachment_and_attach_to_post($guid, $post_id, $this);
229 229
 
230 230
 				//maybe create a venue from info on the event?
231 231
 				$new_venue_id = $this->_maybe_create_venue($event_row);
232
-				if($new_venue_id){
233
-					$this->_insert_new_venue_to_event($post_id,$new_venue_id);
232
+				if ($new_venue_id) {
233
+					$this->_insert_new_venue_to_event($post_id, $new_venue_id);
234 234
 				}
235 235
 				$this->_add_post_metas($event_row, $post_id);
236 236
 			}
237 237
 			$items_migrated_this_step++;
238
-			if($guid){
238
+			if ($guid) {
239 239
 				//if we had to check for an image attachment
240 240
 				//then let's call it a day (avoid timing out, because this took a long time)
241 241
 				break;
242 242
 			}
243 243
 		}
244
-		if($this->count_records_migrated() + $items_migrated_this_step >= $this->count_records_to_migrate()){
244
+		if ($this->count_records_migrated() + $items_migrated_this_step >= $this->count_records_to_migrate()) {
245 245
 			$this->set_status(EE_Data_Migration_Manager::status_completed);
246 246
 		}
247 247
 		return $items_migrated_this_step;
@@ -253,28 +253,28 @@  discard block
 block discarded – undo
253 253
 	 * @param int $post_id
254 254
 	 * @return void
255 255
 	 */
256
-	private function _add_post_metas($old_event,$post_id){
256
+	private function _add_post_metas($old_event, $post_id) {
257 257
 		$event_meta = maybe_unserialize($old_event['event_meta']);
258
-		if( ! $event_meta || ! is_array( $event_meta ) ){
258
+		if ( ! $event_meta || ! is_array($event_meta)) {
259 259
 			return;
260 260
 		}
261
-		unset($event_meta['date_submitted']);//factored into CPT
262
-		unset($event_meta['additional_attendee_reg_info']);//factored into event meta table
263
-		unset($event_meta['default_payment_status']);//dido
264
-		unset($event_meta['event_thumbnail_url']);//used to find post featured image
265
-		foreach($event_meta as $meta_key => $meta_value){
266
-			if ($meta_key){//if the meta key is just an empty string, ignore it
267
-				$success = add_post_meta($post_id,$meta_key,$meta_value,true);
268
-				if( ! $success ){
269
-					$this->add_error(sprintf(__("Could not add post meta for CPT with ID #%d. Meta key: '%s',meta value:'%d' for 3.1 event: %s", "event_espresso"),$post_id,$meta_key,$meta_value,implode(",",$old_event)));
261
+		unset($event_meta['date_submitted']); //factored into CPT
262
+		unset($event_meta['additional_attendee_reg_info']); //factored into event meta table
263
+		unset($event_meta['default_payment_status']); //dido
264
+		unset($event_meta['event_thumbnail_url']); //used to find post featured image
265
+		foreach ($event_meta as $meta_key => $meta_value) {
266
+			if ($meta_key) {//if the meta key is just an empty string, ignore it
267
+				$success = add_post_meta($post_id, $meta_key, $meta_value, true);
268
+				if ( ! $success) {
269
+					$this->add_error(sprintf(__("Could not add post meta for CPT with ID #%d. Meta key: '%s',meta value:'%d' for 3.1 event: %s", "event_espresso"), $post_id, $meta_key, $meta_value, implode(",", $old_event)));
270 270
 				}
271 271
 			}
272 272
 		}
273
-		if($old_event['alt_email']){
274
-			add_post_meta($post_id,'alt_email',$old_event['alt_email']);
273
+		if ($old_event['alt_email']) {
274
+			add_post_meta($post_id, 'alt_email', $old_event['alt_email']);
275 275
 		}
276
-		if($old_event['recurrence_id']){
277
-			add_post_meta($post_id,'recurrence_id',$old_event['recurrence_id']);
276
+		if ($old_event['recurrence_id']) {
277
+			add_post_meta($post_id, 'recurrence_id', $old_event['recurrence_id']);
278 278
 		}
279 279
 	}
280 280
 
@@ -289,10 +289,10 @@  discard block
 block discarded – undo
289 289
 	 * @param string $new_post_status a post status
290 290
 	 * @return string
291 291
 	 */
292
-	private function _find_unique_slug($event_name, $old_identifier = '', $new_post_status = 'publish'){
292
+	private function _find_unique_slug($event_name, $old_identifier = '', $new_post_status = 'publish') {
293 293
 		$count = 0;
294 294
 		$original_name = $event_name ? sanitize_title($event_name) : $old_identifier;
295
-		return wp_unique_post_slug($original_name, 0, $new_post_status, 'espresso_events', 0 );
295
+		return wp_unique_post_slug($original_name, 0, $new_post_status, 'espresso_events', 0);
296 296
 	}
297 297
 
298 298
 	/**
@@ -301,11 +301,11 @@  discard block
 block discarded – undo
301 301
 	 * @param string $slug
302 302
 	 * @return boolean
303 303
 	 */
304
-	private function _other_post_exists_with_that_slug($slug){
304
+	private function _other_post_exists_with_that_slug($slug) {
305 305
 		global $wpdb;
306
-		$query = $wpdb->prepare("SELECT COUNT(ID) FROM {$this->_new_table} WHERE post_name = %s",$slug);
306
+		$query = $wpdb->prepare("SELECT COUNT(ID) FROM {$this->_new_table} WHERE post_name = %s", $slug);
307 307
 		$count = $wpdb->get_var($query);
308
-		return (boolean)intval($count);
308
+		return (boolean) intval($count);
309 309
 	}
310 310
 
311 311
 
@@ -314,7 +314,7 @@  discard block
 block discarded – undo
314 314
 	 * @param $old_event
315 315
 	 * @return int
316 316
 	 */
317
-	private function _insert_cpt( $old_event ){
317
+	private function _insert_cpt($old_event) {
318 318
 		global $wpdb;
319 319
 		//convert 3.1 event status to 4.1 CPT status
320 320
 		//for reference, 3.1 event stati available for setting are:
@@ -333,66 +333,66 @@  discard block
 block discarded – undo
333 333
 //		and 3 custom ones: cancelled,postponed,sold_out
334 334
 		$status_conversions = array(
335 335
 			'R'=>'draft',
336
-			'X'=>'draft',//4.1 doesn't have a "not approved for publishing" status. this is what posts are set to that aren't approved
336
+			'X'=>'draft', //4.1 doesn't have a "not approved for publishing" status. this is what posts are set to that aren't approved
337 337
 			'P'=>'pending',
338
-			'IA'=>'draft',//draft and in the past
338
+			'IA'=>'draft', //draft and in the past
339 339
 //IA=inactive in 3.1: events were switched to this when they expired. in 4.1 that's just calculated
340
-			'O'=>'publish',//@todo: will be an event type later; if this is the status, set the end date WAAAY later; and add term for 'ongoing'
340
+			'O'=>'publish', //@todo: will be an event type later; if this is the status, set the end date WAAAY later; and add term for 'ongoing'
341 341
 			'A'=>'publish',
342
-			'S'=>'draft',//@todo: is it ok to just mark secondary/waitlist events as DRAFTS?
342
+			'S'=>'draft', //@todo: is it ok to just mark secondary/waitlist events as DRAFTS?
343 343
 			'D'=>'trash',
344 344
 		);
345 345
 		$post_status = $status_conversions[$old_event['event_status']];
346 346
 		//check if we've sold out
347
-		if (intval($old_event['reg_limit']) <= self::count_registrations($old_event['id'])){
347
+		if (intval($old_event['reg_limit']) <= self::count_registrations($old_event['id'])) {
348 348
 			$post_status = 'sold_out';
349 349
 		}
350 350
 //		FYI postponed and cancelled don't exist in 3.1
351 351
 		$cols_n_values = array(
352
-			'post_title'=>stripslashes($old_event['event_name']),//EVT_name
353
-			'post_content'=>stripslashes($old_event['event_desc']),//EVT_desc
354
-			'post_name'=>$this->_find_unique_slug($old_event['event_name'], $old_event['event_identifier'], $post_status ),//EVT_slug
355
-			'post_date'=>$old_event['submitted'],//EVT_created NOT
352
+			'post_title'=>stripslashes($old_event['event_name']), //EVT_name
353
+			'post_content'=>stripslashes($old_event['event_desc']), //EVT_desc
354
+			'post_name'=>$this->_find_unique_slug($old_event['event_name'], $old_event['event_identifier'], $post_status), //EVT_slug
355
+			'post_date'=>$old_event['submitted'], //EVT_created NOT
356 356
 			'post_date_gmt'=>get_gmt_from_date($old_event['submitted']),
357
-			'post_excerpt'=>'',//EVT_short_desc
358
-			'post_modified'=>$old_event['submitted'],//EVT_modified
357
+			'post_excerpt'=>'', //EVT_short_desc
358
+			'post_modified'=>$old_event['submitted'], //EVT_modified
359 359
 			'post_modified_gmt'=>get_gmt_from_date($old_event['submitted']),
360
-			'post_author'=>$old_event['wp_user'],//EVT_wp_user
361
-			'post_parent'=>0,//parent maybe get this from some REM field?
362
-			'menu_order'=>0,//EVT_order
363
-			'post_type'=>'espresso_events',//post_type
364
-			'post_status'=>$post_status,//status
360
+			'post_author'=>$old_event['wp_user'], //EVT_wp_user
361
+			'post_parent'=>0, //parent maybe get this from some REM field?
362
+			'menu_order'=>0, //EVT_order
363
+			'post_type'=>'espresso_events', //post_type
364
+			'post_status'=>$post_status, //status
365 365
 		);
366 366
 		$cols_n_values_with_no_invalid_text = array();
367
-		foreach( $cols_n_values as $col => $value ) {
368
-			$value_sans_invalid_chars = $wpdb->strip_invalid_text_for_column( $this->_new_table, $col, $value );
369
-			if( ! is_wp_error( $value_sans_invalid_chars ) ) {
370
-				$cols_n_values_with_no_invalid_text[ $col ] = $value_sans_invalid_chars;
367
+		foreach ($cols_n_values as $col => $value) {
368
+			$value_sans_invalid_chars = $wpdb->strip_invalid_text_for_column($this->_new_table, $col, $value);
369
+			if ( ! is_wp_error($value_sans_invalid_chars)) {
370
+				$cols_n_values_with_no_invalid_text[$col] = $value_sans_invalid_chars;
371 371
 			} else {
372 372
 				//otherwise leave it as-is. It will blow everything up and stop the migration
373
-				$cols_n_values_with_no_invalid_text[ $col ] = $value;
373
+				$cols_n_values_with_no_invalid_text[$col] = $value;
374 374
 			}
375 375
 		}
376 376
 		$cols_n_values = $cols_n_values_with_no_invalid_text;
377 377
 		$datatypes = array(
378
-			'%s',//EVT_name
379
-			'%s',//EVT_desc
380
-			'%s',//EVT_slug
381
-			'%s',//EVT_created
378
+			'%s', //EVT_name
379
+			'%s', //EVT_desc
380
+			'%s', //EVT_slug
381
+			'%s', //EVT_created
382 382
 			'%s',
383
-			'%s',//EVT_short_desc
384
-			'%s',//EVT_modified
383
+			'%s', //EVT_short_desc
384
+			'%s', //EVT_modified
385 385
 			'%s',
386
-			'%s',//EVT_wp_user
387
-			'%d',//post_parent
388
-			'%d',//EVT_order
389
-			'%s',//post_type
390
-			'%s',//status
386
+			'%s', //EVT_wp_user
387
+			'%d', //post_parent
388
+			'%d', //EVT_order
389
+			'%s', //post_type
390
+			'%s', //status
391 391
 		);
392 392
 		$success = $wpdb->insert($this->_new_table,
393 393
 				$cols_n_values,
394 394
 				$datatypes);
395
-		if( ! $success ){
395
+		if ( ! $success) {
396 396
 			$this->add_error($this->get_migration_script()->_create_error_message_for_db_insertion($this->_old_table, $old_event, $this->_new_table, $cols_n_values, $datatypes));
397 397
 			return 0;
398 398
 		}
@@ -405,9 +405,9 @@  discard block
 block discarded – undo
405 405
 	 * @param int $event_id
406 406
 	 * @return int
407 407
 	 */
408
-	public static function count_registrations($event_id){
408
+	public static function count_registrations($event_id) {
409 409
 		global $wpdb;
410
-		$count = $wpdb->get_var($wpdb->prepare("SELECT sum(quantity) FROM {$wpdb->prefix}events_attendee WHERE event_id=%d",$event_id));
410
+		$count = $wpdb->get_var($wpdb->prepare("SELECT sum(quantity) FROM {$wpdb->prefix}events_attendee WHERE event_id=%d", $event_id));
411 411
 		return intval($count);
412 412
 	}
413 413
 
@@ -418,7 +418,7 @@  discard block
 block discarded – undo
418 418
 	 * @param $new_cpt_id
419 419
 	 * @return int
420 420
 	 */
421
-	private function _insert_event_meta( $old_event, $new_cpt_id){
421
+	private function _insert_event_meta($old_event, $new_cpt_id) {
422 422
 		global $wpdb;
423 423
 		$event_meta = maybe_unserialize($old_event['event_meta']);
424 424
 //		for reference, 3.1 'default_payment_status' are: $default_payment_status = array(
@@ -429,10 +429,10 @@  discard block
 block discarded – undo
429 429
 //);
430 430
 		$default_reg_status = $this->get_migration_script()->convert_3_1_payment_status_to_4_1_STS_ID(isset($event_meta['default_payment_status']) ? $event_meta['default_payment_status'] : '', intval($old_event['require_pre_approval']));
431 431
 		$cols_n_values = array(
432
-			'EVT_ID'=>$new_cpt_id,//EVT_ID_fk
432
+			'EVT_ID'=>$new_cpt_id, //EVT_ID_fk
433 433
 			'EVT_display_desc'=> 'Y' == $old_event['display_desc'],
434
-			'EVT_display_ticket_selector'=> 'Y'== $old_event['display_reg_form'],
435
-			'EVT_visible_on'=> $this->get_migration_script()->convert_date_string_to_utc($this,$old_event,current_time('mysql'),$old_event['timezone_string']),//don't use the old 'visible_on', as it wasn't ever used
434
+			'EVT_display_ticket_selector'=> 'Y' == $old_event['display_reg_form'],
435
+			'EVT_visible_on'=> $this->get_migration_script()->convert_date_string_to_utc($this, $old_event, current_time('mysql'), $old_event['timezone_string']), //don't use the old 'visible_on', as it wasn't ever used
436 436
 			'EVT_additional_limit'=> $old_event['allow_multiple'] == 'N' ? 1 : $old_event['additional_limit'],
437 437
 			'EVT_default_registration_status' => $default_reg_status,
438 438
 			'EVT_member_only'=>$old_event['member_only'],
@@ -444,23 +444,23 @@  discard block
 block discarded – undo
444 444
 
445 445
 		);
446 446
 		$datatypes = array(
447
-			'%s',//EVT_ID
448
-			'%d',//EVT_display_desc
449
-			'%d',//EVT_display_ticket_selector
450
-			'%s',//EVT_visible_on
451
-			'%d',//EVT_additional_limit
452
-			'%s',//EVT_default_registration_status
453
-			'%d',//EVT_member_only
454
-			'%s',//EVT_phone
455
-			'%d',//EVT_allow_overflow
456
-			'%s',//EVT_timezone_string
457
-			'%s',//EVT_external_URL
458
-			'%d',//EVT_donations
447
+			'%s', //EVT_ID
448
+			'%d', //EVT_display_desc
449
+			'%d', //EVT_display_ticket_selector
450
+			'%s', //EVT_visible_on
451
+			'%d', //EVT_additional_limit
452
+			'%s', //EVT_default_registration_status
453
+			'%d', //EVT_member_only
454
+			'%s', //EVT_phone
455
+			'%d', //EVT_allow_overflow
456
+			'%s', //EVT_timezone_string
457
+			'%s', //EVT_external_URL
458
+			'%d', //EVT_donations
459 459
 		);
460 460
 		$success = $wpdb->insert($this->_new_meta_table,
461 461
 				$cols_n_values,
462 462
 				$datatypes);
463
-		if( ! $success ){
463
+		if ( ! $success) {
464 464
 			$this->add_error($this->get_migration_script()->_create_error_message_for_db_insertion($this->_old_table, $old_event, $this->_new_meta_table, $cols_n_values, $datatypes));
465 465
 			return 0;
466 466
 		}
@@ -473,8 +473,8 @@  discard block
 block discarded – undo
473 473
 	 * @param $old_event
474 474
 	 * @return int
475 475
 	 */
476
-	private function _maybe_create_venue( $old_event){
477
-		if(		$old_event['address'] ||
476
+	private function _maybe_create_venue($old_event) {
477
+		if ($old_event['address'] ||
478 478
 				$old_event['address2'] ||
479 479
 				$old_event['city'] ||
480 480
 				$old_event['state'] ||
@@ -485,21 +485,21 @@  discard block
 block discarded – undo
485 485
 				$old_event['venue_phone'] ||
486 486
 				$old_event['virtual_url'] ||
487 487
 				$old_event['virtual_phone']
488
-				){
489
-			$old_id = $this->_duplicate_venue_exists( $old_event );
490
-			if( $old_id ){
488
+				) {
489
+			$old_id = $this->_duplicate_venue_exists($old_event);
490
+			if ($old_id) {
491 491
 				return $old_id;
492 492
 			}
493 493
 			$new_id = $this->_insert_venue_into_posts($old_event);
494
-			if( $new_id ){
494
+			if ($new_id) {
495 495
 				$this->_insert_venue_into_meta_table($new_id, $old_event);
496
-				$guid = isset($old_event['venue_image']) ? $old_event['venue_image']  : null;
497
-				$this->get_migration_script()->convert_image_url_to_attachment_and_attach_to_post($guid, $new_id,$this);
496
+				$guid = isset($old_event['venue_image']) ? $old_event['venue_image'] : null;
497
+				$this->get_migration_script()->convert_image_url_to_attachment_and_attach_to_post($guid, $new_id, $this);
498 498
 			}
499 499
 			//we don't bother recording the conversion from old events to venues as that
500 500
 			//will complicate finding the conversion from old venues to new events
501 501
 			return $new_id;
502
-		}else{
502
+		} else {
503 503
 			return 0;
504 504
 		}
505 505
 	}
@@ -510,29 +510,29 @@  discard block
 block discarded – undo
510 510
 	 * @param array $old_event
511 511
 	 * @return int duplicate venue id
512 512
 	 */
513
-	private function _duplicate_venue_exists($old_event){
513
+	private function _duplicate_venue_exists($old_event) {
514 514
 		global $wpdb;
515 515
 		$conditions = array(
516
-			'VNU_address' => $old_event [ 'address' ],
517
-			'VNU_address2' => $old_event[ 'address2' ],
518
-			'VNU_city' => $old_event[ 'city' ],
519
-			'VNU_zip' => $old_event[ 'zip' ],
520
-			'post_title'=> $this->_get_venue_title_for_event( $old_event ),
521
-			'VNU_phone'=>$old_event['venue_phone'],//VNU_phone
522
-			'VNU_url'=>$old_event['venue_url'],//VNU_url
523
-			'VNU_virtual_phone'=>$old_event['virtual_phone'],//VNU_virtual_phone
524
-			'VNU_virtual_url'=>$old_event['virtual_url'],//VNU_virtual_url
516
+			'VNU_address' => $old_event ['address'],
517
+			'VNU_address2' => $old_event['address2'],
518
+			'VNU_city' => $old_event['city'],
519
+			'VNU_zip' => $old_event['zip'],
520
+			'post_title'=> $this->_get_venue_title_for_event($old_event),
521
+			'VNU_phone'=>$old_event['venue_phone'], //VNU_phone
522
+			'VNU_url'=>$old_event['venue_url'], //VNU_url
523
+			'VNU_virtual_phone'=>$old_event['virtual_phone'], //VNU_virtual_phone
524
+			'VNU_virtual_url'=>$old_event['virtual_url'], //VNU_virtual_url
525 525
 		);
526 526
 		$sql_conditions = array();
527
-		foreach($conditions as $column => $value){
528
-			$sql_conditions [] = $wpdb->prepare("$column = %s", $value );
527
+		foreach ($conditions as $column => $value) {
528
+			$sql_conditions [] = $wpdb->prepare("$column = %s", $value);
529 529
 		}
530 530
 		$query = "SELECT VNU_ID
531 531
 					FROM
532 532
 		{$wpdb->posts} as p INNER JOIN
533 533
 		{$wpdb->prefix}esp_venue_meta as v ON p.ID = v.VNU_ID
534
-			WHERE " . implode( " AND ",$sql_conditions ) . " LIMIT 1";
535
-		$id = $wpdb->get_var( $query );
534
+			WHERE ".implode(" AND ", $sql_conditions)." LIMIT 1";
535
+		$id = $wpdb->get_var($query);
536 536
 		return $id;
537 537
 	}
538 538
 
@@ -541,8 +541,8 @@  discard block
 block discarded – undo
541 541
 	 * @param array $event_data_array keys are events_details columns and values are their values
542 542
 	 * @return string
543 543
 	 */
544
-	protected function _get_venue_title_for_event( $event_data_array ) {
545
-		return $event_data_array['venue_title'] ? stripslashes($event_data_array['venue_title']) : stripslashes( sprintf( __( 'Venue of %s', 'event_espresso' ), $event_data_array['event_name']));
544
+	protected function _get_venue_title_for_event($event_data_array) {
545
+		return $event_data_array['venue_title'] ? stripslashes($event_data_array['venue_title']) : stripslashes(sprintf(__('Venue of %s', 'event_espresso'), $event_data_array['event_name']));
546 546
 	}
547 547
 
548 548
 	/**
@@ -551,40 +551,40 @@  discard block
 block discarded – undo
551 551
 	 * @param array $old_event keys are cols, values are col values
552 552
 	 * @return int
553 553
 	 */
554
-	private function _insert_venue_into_posts($old_event){
554
+	private function _insert_venue_into_posts($old_event) {
555 555
 		global $wpdb;
556 556
 		$insertion_array = array(
557
-					'post_title'=> $this->_get_venue_title_for_event( $old_event ),//VNU_name
558
-					'post_content'=>'',//VNU_desc
559
-					'post_name'=> $this->_find_unique_slug( $old_event['venue_title'], sanitize_title( 'venue-of-' . $old_event['event_name'] ) ),//VNU_identifier
560
-					'post_date'=>current_time('mysql'),//VNU_created
557
+					'post_title'=> $this->_get_venue_title_for_event($old_event), //VNU_name
558
+					'post_content'=>'', //VNU_desc
559
+					'post_name'=> $this->_find_unique_slug($old_event['venue_title'], sanitize_title('venue-of-'.$old_event['event_name'])), //VNU_identifier
560
+					'post_date'=>current_time('mysql'), //VNU_created
561 561
 					'post_date_gmt'=>get_gmt_from_date(current_time('mysql')),
562
-					'post_excerpt'=>'',//VNU_short_desc arbitrary only 50 characters
563
-					'post_modified'=>current_time('mysql'),//VNU_modified
562
+					'post_excerpt'=>'', //VNU_short_desc arbitrary only 50 characters
563
+					'post_modified'=>current_time('mysql'), //VNU_modified
564 564
 					'post_modified_gmt'=>get_gmt_from_date(current_time('mysql')),
565
-					'post_author'=>$old_event['wp_user'],//VNU_wp_user
566
-					'post_parent'=>0,//parent
567
-					'menu_order'=>0,//VNU_order
565
+					'post_author'=>$old_event['wp_user'], //VNU_wp_user
566
+					'post_parent'=>0, //parent
567
+					'menu_order'=>0, //VNU_order
568 568
 					'post_type'=>'espresso_venues'//post_type
569 569
 				);
570 570
 		$datatypes_array = array(
571
-					'%s',//VNU_name
572
-					'%s',//VNU_desc
573
-					'%s',//VNU_identifier
574
-					'%s',//VNU_created
571
+					'%s', //VNU_name
572
+					'%s', //VNU_desc
573
+					'%s', //VNU_identifier
574
+					'%s', //VNU_created
575 575
 					'%s',
576
-					'%s',//VNU_short_desc
577
-					'%s',//VNU_modified
576
+					'%s', //VNU_short_desc
577
+					'%s', //VNU_modified
578 578
 					'%s',
579
-					'%d',//VNU_wp_user
580
-					'%d',//parent
581
-					'%d',//VNU_order
582
-					'%s',//post_type
579
+					'%d', //VNU_wp_user
580
+					'%d', //parent
581
+					'%d', //VNU_order
582
+					'%s', //post_type
583 583
 				);
584 584
 		$success = $wpdb->insert($wpdb->posts,
585 585
 				$insertion_array,
586 586
 				$datatypes_array);
587
-		if( ! $success ){
587
+		if ( ! $success) {
588 588
 			$this->add_error(
589 589
 				$this->get_migration_script()->_create_error_message_for_db_insertion(
590 590
 					$this->_old_table,
@@ -605,64 +605,64 @@  discard block
 block discarded – undo
605 605
 	 * @param array $old_event
606 606
 	 * @return int
607 607
 	 */
608
-	private function _insert_venue_into_meta_table($cpt_id,$old_event){
608
+	private function _insert_venue_into_meta_table($cpt_id, $old_event) {
609 609
 		global $wpdb;
610 610
 
611 611
 		//assume the country is the same as the organization's old settings
612 612
 		$country_iso = $this->get_migration_script()->get_default_country_iso();
613 613
 		//find the state from the venue, or the organization, or just guess california
614
-		if( ! $old_event['state']){
614
+		if ( ! $old_event['state']) {
615 615
 			$old_org_options = get_option('events_organization_settings');
616 616
 			$state_name = stripslashes($old_org_options['organization_state']);
617
-		}else{
617
+		} else {
618 618
 			$state_name = $old_event['state'];
619 619
 		}
620
-		if ( ! $state_name ){
620
+		if ( ! $state_name) {
621 621
 			$state_name = 'CA';
622 622
 		}
623 623
 		//get a state ID with the same name, if possible
624
-		try{
625
-			$state = $this->get_migration_script()->get_or_create_state($state_name,$country_iso);
624
+		try {
625
+			$state = $this->get_migration_script()->get_or_create_state($state_name, $country_iso);
626 626
 			$state_id = $state['STA_ID'];
627
-		}catch(EE_Error $e){
627
+		} catch (EE_Error $e) {
628 628
 			$this->add_error($e->getMessage());
629 629
 			$state_id = 0;
630 630
 		}
631 631
 		//now insert into meta table
632 632
 		$insertion_array = array(
633
-			'VNU_ID'=>$cpt_id,//VNU_ID_fk
634
-			'VNU_address'=>stripslashes($old_event['address']),//VNU_address
635
-			'VNU_address2'=>stripslashes($old_event['address2']),//VNU_address2
636
-			'VNU_city'=>stripslashes($old_event['city']),//VNU_city
637
-			'STA_ID'=>$state_id,//STA_ID
638
-			'CNT_ISO'=>$country_iso,//CNT_ISO
639
-			'VNU_zip'=>$old_event['zip'],//VNU_zip
640
-			'VNU_phone'=>$old_event['venue_phone'],//VNU_phone
641
-			'VNU_capacity'=>-1,//VNU_capacity
642
-			'VNU_url'=>$old_event['venue_url'],//VNU_url
643
-			'VNU_virtual_phone'=>$old_event['virtual_phone'],//VNU_virtual_phone
644
-			'VNU_virtual_url'=>$old_event['virtual_url'],//VNU_virtual_url
645
-			'VNU_google_map_link'=>'',//VNU_google_map_link
633
+			'VNU_ID'=>$cpt_id, //VNU_ID_fk
634
+			'VNU_address'=>stripslashes($old_event['address']), //VNU_address
635
+			'VNU_address2'=>stripslashes($old_event['address2']), //VNU_address2
636
+			'VNU_city'=>stripslashes($old_event['city']), //VNU_city
637
+			'STA_ID'=>$state_id, //STA_ID
638
+			'CNT_ISO'=>$country_iso, //CNT_ISO
639
+			'VNU_zip'=>$old_event['zip'], //VNU_zip
640
+			'VNU_phone'=>$old_event['venue_phone'], //VNU_phone
641
+			'VNU_capacity'=>-1, //VNU_capacity
642
+			'VNU_url'=>$old_event['venue_url'], //VNU_url
643
+			'VNU_virtual_phone'=>$old_event['virtual_phone'], //VNU_virtual_phone
644
+			'VNU_virtual_url'=>$old_event['virtual_url'], //VNU_virtual_url
645
+			'VNU_google_map_link'=>'', //VNU_google_map_link
646 646
 			'VNU_enable_for_gmap'=>true	//VNU_enable_for_gmap
647 647
 		);
648 648
 		$datatypes = array(
649
-			'%d',//VNU_ID_fk
650
-			'%s',//VNU_address
651
-			'%s',//VNU_address2
652
-			'%s',//VNU_city
653
-			'%d',//STA_ID
654
-			'%s',//CNT_ISO
655
-			'%s',//VNU_zip
656
-			'%s',//VNU_phone
657
-			'%d',//VNU_capacity
658
-			'%s',//VNU_url
659
-			'%s',//VNU_virtual_phone
660
-			'%s',//VNU_virtual_url
661
-			'%s',//VNU_google_map_link
662
-			'%d',//VNU_enable_for_gmap
649
+			'%d', //VNU_ID_fk
650
+			'%s', //VNU_address
651
+			'%s', //VNU_address2
652
+			'%s', //VNU_city
653
+			'%d', //STA_ID
654
+			'%s', //CNT_ISO
655
+			'%s', //VNU_zip
656
+			'%s', //VNU_phone
657
+			'%d', //VNU_capacity
658
+			'%s', //VNU_url
659
+			'%s', //VNU_virtual_phone
660
+			'%s', //VNU_virtual_url
661
+			'%s', //VNU_google_map_link
662
+			'%d', //VNU_enable_for_gmap
663 663
 		);
664
-		$success = $wpdb->insert($wpdb->prefix."esp_venue_meta",$insertion_array,$datatypes);
665
-		if( ! $success ){
664
+		$success = $wpdb->insert($wpdb->prefix."esp_venue_meta", $insertion_array, $datatypes);
665
+		if ( ! $success) {
666 666
 			$this->add_error($this->get_migration_script()->_create_error_message_for_db_insertion($this->_old_table, $old_event, $this->_new_meta_table, $insertion_array, $datatypes));
667 667
 			return 0;
668 668
 		}
@@ -676,14 +676,14 @@  discard block
 block discarded – undo
676 676
 	 * @param $new_venue_id
677 677
 	 * @return int
678 678
 	 */
679
-	private function _insert_new_venue_to_event( $new_event_id, $new_venue_id){
679
+	private function _insert_new_venue_to_event($new_event_id, $new_venue_id) {
680 680
 		global $wpdb;
681
-		if( ! $new_event_id){
682
-			$this->add_error(sprintf(__("Could not find 4.1 event id for 3.1 event #%d.", "event_espresso"),$new_event_id));
681
+		if ( ! $new_event_id) {
682
+			$this->add_error(sprintf(__("Could not find 4.1 event id for 3.1 event #%d.", "event_espresso"), $new_event_id));
683 683
 			return 0;
684 684
 		}
685
-		if( ! $new_venue_id){
686
-			$this->add_error(sprintf(__("Could not find 4.1 venue id for 3.1 venue #%d.", "event_espresso"),$new_venue_id));
685
+		if ( ! $new_venue_id) {
686
+			$this->add_error(sprintf(__("Could not find 4.1 venue id for 3.1 venue #%d.", "event_espresso"), $new_venue_id));
687 687
 			return 0;
688 688
 		}
689 689
 		$cols_n_values = array(
@@ -692,12 +692,12 @@  discard block
 block discarded – undo
692 692
 			'EVV_primary'=>true
693 693
 		);
694 694
 		$datatypes = array(
695
-			'%d',//EVT_ID
696
-			'%d',//VNU_ID
697
-			'%d',//EVT_primary
695
+			'%d', //EVT_ID
696
+			'%d', //VNU_ID
697
+			'%d', //EVT_primary
698 698
 		);
699
-		$success = $wpdb->insert($wpdb->prefix."esp_event_venue",$cols_n_values,$datatypes);
700
-		if ( ! $success){
699
+		$success = $wpdb->insert($wpdb->prefix."esp_event_venue", $cols_n_values, $datatypes);
700
+		if ( ! $success) {
701 701
 			$this->add_error(
702 702
 				$this->get_migration_script()->_create_error_message_for_db_insertion(
703 703
 					$this->_old_table,
@@ -719,11 +719,11 @@  discard block
 block discarded – undo
719 719
 	 * @param int $new_cpt_id new post ID
720 720
 	 * @return void (if there are errors though, adds them to the stage's error list
721 721
 	 */
722
-	private function _convert_start_end_times($old_event,$new_cpt_id){
722
+	private function _convert_start_end_times($old_event, $new_cpt_id) {
723 723
 		$start_end_times = $this->_get_old_start_end_times($old_event['id']);
724
-		foreach($start_end_times as $start_end_time){
725
-			$datetime_id = $this->_insert_new_datetime($start_end_time,$old_event,$new_cpt_id);
726
-			if($datetime_id){
724
+		foreach ($start_end_times as $start_end_time) {
725
+			$datetime_id = $this->_insert_new_datetime($start_end_time, $old_event, $new_cpt_id);
726
+			if ($datetime_id) {
727 727
 				$this->get_migration_script()->set_mapping($this->_old_start_end_table, $start_end_time['id'], $this->_new_datetime_table, $datetime_id);
728 728
 			}
729 729
 		}
@@ -734,9 +734,9 @@  discard block
 block discarded – undo
734 734
 	 * @param int $old_event_id
735 735
 	 * @return array
736 736
 	 */
737
-	private function _get_old_start_end_times($old_event_id){
737
+	private function _get_old_start_end_times($old_event_id) {
738 738
 		global $wpdb;
739
-		return $wpdb->get_results($wpdb->prepare("SELECT * FROM $this->_old_start_end_table WHERE event_id=%d",$old_event_id),ARRAY_A);
739
+		return $wpdb->get_results($wpdb->prepare("SELECT * FROM $this->_old_start_end_table WHERE event_id=%d", $old_event_id), ARRAY_A);
740 740
 	}
741 741
 	/**
742 742
 	 * Inserts a 4.1 datetime given the 3.1 start_end db row and event_details row
@@ -745,40 +745,40 @@  discard block
 block discarded – undo
745 745
 	 * @param int $new_cpt_id
746 746
 	 * @return int ID of new datetime
747 747
 	 */
748
-	private function _insert_new_datetime($start_end_time_row,$old_event_row,$new_cpt_id){
748
+	private function _insert_new_datetime($start_end_time_row, $old_event_row, $new_cpt_id) {
749 749
 		global $wpdb;
750 750
 		$start_date = $old_event_row['start_date'];
751 751
 		$start_time = $this->get_migration_script()->convertTimeFromAMPM($start_end_time_row['start_time']);
752 752
 		$end_date = $old_event_row['end_date'];
753 753
 		$end_time = $this->get_migration_script()->convertTimeFromAMPM($start_end_time_row['end_time']);
754 754
 		$existing_datetimes = $this->_count_other_datetimes_exist_for_new_event($new_cpt_id);
755
-		$start_datetime_utc = $this->get_migration_script()->convert_date_string_to_utc($this,$start_end_time_row,"$start_date $start_time:00",$old_event_row['timezone_string']);
756
-		$end_datetime_utc = $this->get_migration_script()->convert_date_string_to_utc($this,$start_end_time_row,"$end_date $end_time:00",$old_event_row['timezone_string']);
755
+		$start_datetime_utc = $this->get_migration_script()->convert_date_string_to_utc($this, $start_end_time_row, "$start_date $start_time:00", $old_event_row['timezone_string']);
756
+		$end_datetime_utc = $this->get_migration_script()->convert_date_string_to_utc($this, $start_end_time_row, "$end_date $end_time:00", $old_event_row['timezone_string']);
757 757
 		$cols_n_values = array(
758
-			'EVT_ID'=>$new_cpt_id,//EVT_ID
759
-			'DTT_EVT_start'=>$start_datetime_utc,//DTT_EVT_start
760
-			'DTT_EVT_end'=> $end_datetime_utc,//DTT_EVT_end
761
-			'DTT_reg_limit'=>intval($start_end_time_row['reg_limit']) ? $start_end_time_row['reg_limit'] : $old_event_row['reg_limit'],//DTT_reg_limit
762
-			'DTT_sold'=>0,//note: we will increment this as registrations are added during the migration
758
+			'EVT_ID'=>$new_cpt_id, //EVT_ID
759
+			'DTT_EVT_start'=>$start_datetime_utc, //DTT_EVT_start
760
+			'DTT_EVT_end'=> $end_datetime_utc, //DTT_EVT_end
761
+			'DTT_reg_limit'=>intval($start_end_time_row['reg_limit']) ? $start_end_time_row['reg_limit'] : $old_event_row['reg_limit'], //DTT_reg_limit
762
+			'DTT_sold'=>0, //note: we will increment this as registrations are added during the migration
763 763
 //			'DTT_is_primary'=> 0 == $existing_datetimes ,//DTT_is_primary... if count==0, then we'll call it the 'primary'
764
-			'DTT_order'=> $existing_datetimes,//DTT_order, just give it the same order as the count of how many datetimes already exist
764
+			'DTT_order'=> $existing_datetimes, //DTT_order, just give it the same order as the count of how many datetimes already exist
765 765
 			'DTT_parent'=>0,
766 766
 			'DTT_deleted'=>false
767 767
 		);
768 768
 		$datatypes = array(
769
-			'%d',//EVT_Id
770
-			'%s',//DTT_EVT_start
771
-			'%s',//DTT_EVT_end
772
-			'%d',//DTT_reg_limit
773
-			'%d',//DTT_sold
769
+			'%d', //EVT_Id
770
+			'%s', //DTT_EVT_start
771
+			'%s', //DTT_EVT_end
772
+			'%d', //DTT_reg_limit
773
+			'%d', //DTT_sold
774 774
 //			'%d',//DTT_is_primary
775
-			'%d',//DTT_order
776
-			'%d',//DTT_parent
777
-			'%d',//DTT_deleted
775
+			'%d', //DTT_order
776
+			'%d', //DTT_parent
777
+			'%d', //DTT_deleted
778 778
 		);
779
-		$success = $wpdb->insert($this->_new_datetime_table,$cols_n_values,$datatypes);
780
-		if ( ! $success){
781
-			$this->add_error($this->get_migration_script()->_create_error_message_for_db_insertion($this->_old_start_end_table, array_merge($old_event_row,$start_end_time_row), $this->_new_datetime_table, $cols_n_values, $datatypes));
779
+		$success = $wpdb->insert($this->_new_datetime_table, $cols_n_values, $datatypes);
780
+		if ( ! $success) {
781
+			$this->add_error($this->get_migration_script()->_create_error_message_for_db_insertion($this->_old_start_end_table, array_merge($old_event_row, $start_end_time_row), $this->_new_datetime_table, $cols_n_values, $datatypes));
782 782
 			return 0;
783 783
 		}
784 784
 		return $wpdb->insert_id;
@@ -791,9 +791,9 @@  discard block
 block discarded – undo
791 791
 	 * @param int $cpt_event_id
792 792
 	 * @return int
793 793
 	 */
794
-	private function _count_other_datetimes_exist_for_new_event($cpt_event_id){
794
+	private function _count_other_datetimes_exist_for_new_event($cpt_event_id) {
795 795
 		global $wpdb;
796
-		$count = $wpdb->get_var($wpdb->prepare("SELECT COUNT(*) FROM $this->_new_datetime_table WHERE EVT_ID=%d",$cpt_event_id));
796
+		$count = $wpdb->get_var($wpdb->prepare("SELECT COUNT(*) FROM $this->_new_datetime_table WHERE EVT_ID=%d", $cpt_event_id));
797 797
 		return intval($count);
798 798
 	}
799 799
 
Please login to merge, or discard this patch.
public/Espresso_Arabica_2014/content-espresso_events-details.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -3,33 +3,33 @@
 block discarded – undo
3 3
 global $post;
4 4
 ?>
5 5
 <div class="event-content">
6
-<?php if ( apply_filters( 'FHEE__content_espresso_events_details_template__display_entry_meta', TRUE )): ?>
6
+<?php if (apply_filters('FHEE__content_espresso_events_details_template__display_entry_meta', TRUE)): ?>
7 7
 	<div class="entry-meta">
8
-		<span class="tags-links"><?php espresso_event_categories( $post->ID, TRUE, TRUE ); ?></span>
8
+		<span class="tags-links"><?php espresso_event_categories($post->ID, TRUE, TRUE); ?></span>
9 9
 	<?php
10
-		if ( ! post_password_required() && ( comments_open() || get_comments_number() ) ) :
10
+		if ( ! post_password_required() && (comments_open() || get_comments_number())) :
11 11
 	?>
12
-	<span class="comments-link"><?php comments_popup_link( __( 'Leave a comment', 'event_espresso' ), __( '1 Comment', 'event_espresso' ), __( '% Comments', 'event_espresso' ) ); ?></span>
12
+	<span class="comments-link"><?php comments_popup_link(__('Leave a comment', 'event_espresso'), __('1 Comment', 'event_espresso'), __('% Comments', 'event_espresso')); ?></span>
13 13
 	<?php
14 14
 		endif;
15
-		edit_post_link( __( 'Edit', 'event_espresso' ), '<span class="edit-link">', '</span>' );
15
+		edit_post_link(__('Edit', 'event_espresso'), '<span class="edit-link">', '</span>');
16 16
 	?>
17 17
 	</div>
18 18
 <?php endif;
19
-	$event_phone = espresso_event_phone( $post->ID, FALSE );
20
-	if ( $event_phone != '' ) : ?>
19
+	$event_phone = espresso_event_phone($post->ID, FALSE);
20
+	if ($event_phone != '') : ?>
21 21
 	<p>
22
-		<span class="small-text"><strong><?php _e( 'Event Phone:', 'event_espresso' ); ?> </strong></span> <?php echo $event_phone; ?>
22
+		<span class="small-text"><strong><?php _e('Event Phone:', 'event_espresso'); ?> </strong></span> <?php echo $event_phone; ?>
23 23
 	</p>
24
-<?php endif;  ?>
24
+<?php endif; ?>
25 25
 <?php
26
-	if ( apply_filters( 'FHEE__content_espresso_events_details_template__display_the_content', true ) ) {
27
-		do_action( 'AHEE_event_details_before_the_content', $post );
26
+	if (apply_filters('FHEE__content_espresso_events_details_template__display_the_content', true)) {
27
+		do_action('AHEE_event_details_before_the_content', $post);
28 28
 		echo apply_filters(
29 29
 			'FHEE__content_espresso_events_details_template__the_content',
30
-			espresso_event_content_or_excerpt( 55, null, false ) 
30
+			espresso_event_content_or_excerpt(55, null, false) 
31 31
 		);
32
-		do_action( 'AHEE_event_details_after_the_content', $post );
32
+		do_action('AHEE_event_details_after_the_content', $post);
33 33
 	}
34 34
  ?>
35 35
 </div>
Please login to merge, or discard this patch.
templates/txn_admin_details_side_meta_box_billing_info.template.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -8,8 +8,8 @@
 block discarded – undo
8 8
 		foreach( $form_section->subsections() as $subsection ) {
9 9
 			if( $subsection instanceof EE_Form_Input_Base ) {
10 10
 				if( $subsection->get_sensitive_data_removal_strategy() instanceof EE_All_Sensitive_Data_Removal
11
-                    || $subsection->get_sensitive_data_removal_strategy() instanceof EE_CCV_Sensitive_Data_Removal
12
-                    || $subsection->get_display_strategy() instanceof EE_Hidden_Display_Strategy ){
11
+					|| $subsection->get_sensitive_data_removal_strategy() instanceof EE_CCV_Sensitive_Data_Removal
12
+					|| $subsection->get_display_strategy() instanceof EE_Hidden_Display_Strategy ){
13 13
 					continue;
14 14
 				}
15 15
 				if( $subsection->get_sensitive_data_removal_strategy() instanceof EE_Credit_Card_Sensitive_Data_Removal ) {
Please login to merge, or discard this patch.
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -1,38 +1,38 @@
 block discarded – undo
1 1
 	<div id="admin-side-mbox-billing-info-dv" class="admin-side-mbox-dv">
2
-<?php if ( empty($billing_form) ) : ?>
2
+<?php if (empty($billing_form)) : ?>
3 3
 		<div class="clearfix">
4
-			<?php _e( 'There is no billing info for this transaction.', 'event_espresso' );?><br/>
4
+			<?php _e('There is no billing info for this transaction.', 'event_espresso'); ?><br/>
5 5
 		</div>
6 6
 <?php else :
7
-	function ee_show_billing_info_cleaned( EE_Form_Section_Proper $form_section, $found_cc_data = false ) {
8
-		foreach( $form_section->subsections() as $subsection ) {
9
-			if( $subsection instanceof EE_Form_Input_Base ) {
10
-				if( $subsection->get_sensitive_data_removal_strategy() instanceof EE_All_Sensitive_Data_Removal
7
+	function ee_show_billing_info_cleaned(EE_Form_Section_Proper $form_section, $found_cc_data = false) {
8
+		foreach ($form_section->subsections() as $subsection) {
9
+			if ($subsection instanceof EE_Form_Input_Base) {
10
+				if ($subsection->get_sensitive_data_removal_strategy() instanceof EE_All_Sensitive_Data_Removal
11 11
                     || $subsection->get_sensitive_data_removal_strategy() instanceof EE_CCV_Sensitive_Data_Removal
12
-                    || $subsection->get_display_strategy() instanceof EE_Hidden_Display_Strategy ){
12
+                    || $subsection->get_display_strategy() instanceof EE_Hidden_Display_Strategy) {
13 13
 					continue;
14 14
 				}
15
-				if( $subsection->get_sensitive_data_removal_strategy() instanceof EE_Credit_Card_Sensitive_Data_Removal ) {
15
+				if ($subsection->get_sensitive_data_removal_strategy() instanceof EE_Credit_Card_Sensitive_Data_Removal) {
16 16
 					$found_cc_data = true;
17 17
 				}
18 18
 				?>
19 19
 					<div class="clearfix">
20
-						<span class="admin-side-mbox-label-spn lt-grey-txt float-left"><?php echo $subsection->get_html_for_label();?></span><?php echo $subsection->pretty_value();?>
20
+						<span class="admin-side-mbox-label-spn lt-grey-txt float-left"><?php echo $subsection->get_html_for_label(); ?></span><?php echo $subsection->pretty_value(); ?>
21 21
 					</div><?php
22
-			} elseif( $subsection instanceof EE_Form_Section_Proper ) {
23
-				$found_cc_data = ee_show_billing_info_cleaned( $subsection, $found_cc_data);
22
+			} elseif ($subsection instanceof EE_Form_Section_Proper) {
23
+				$found_cc_data = ee_show_billing_info_cleaned($subsection, $found_cc_data);
24 24
 			}
25 25
 		}
26 26
 		return $found_cc_data;
27 27
 	}
28
-	$found_cc_data = ee_show_billing_info_cleaned( $billing_form );
29
-	if( apply_filters( 
28
+	$found_cc_data = ee_show_billing_info_cleaned($billing_form);
29
+	if (apply_filters( 
30 30
 			'FHEE__txn_admin_details_side_meta_box_billing_info__show_default_note', 
31 31
 			$found_cc_data,
32
-			$billing_form ) ) {?>
33
-		<p class="help"><?php _e( 'Note: Card expiry dates and CCV are not stored. Only the last 4 digits of card numbers are stored.', 'event_espresso' );?></p>
32
+			$billing_form )) {?>
33
+		<p class="help"><?php _e('Note: Card expiry dates and CCV are not stored. Only the last 4 digits of card numbers are stored.', 'event_espresso'); ?></p>
34 34
 	<?php }
35
-	do_action( 'AHEE__txn_admin_details_side_meta_box_billing_info__billing_form_footer', $billing_form );
35
+	do_action('AHEE__txn_admin_details_side_meta_box_billing_info__billing_form_footer', $billing_form);
36 36
 	endif; ?>
37 37
 
38 38
 	</div>
Please login to merge, or discard this patch.
core/admin/EE_Admin_List_Table.core.php 2 patches
Spacing   +92 added lines, -92 removed lines patch added patch discarded remove patch
@@ -1,9 +1,9 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
3
-	exit( 'NO direct script access allowed' );
2
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
3
+	exit('NO direct script access allowed');
4 4
 }
5
-if ( ! class_exists( 'WP_List_Table' ) ) {
6
-	require_once( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' );
5
+if ( ! class_exists('WP_List_Table')) {
6
+	require_once(ABSPATH.'wp-admin/includes/class-wp-list-table.php');
7 7
 }
8 8
 
9 9
 
@@ -206,16 +206,16 @@  discard block
 block discarded – undo
206 206
 	/**
207 207
 	 * @param \EE_Admin_Page $admin_page we use this for obtaining everything we need in the list table
208 208
 	 */
209
-	public function __construct( EE_Admin_Page $admin_page ) {
209
+	public function __construct(EE_Admin_Page $admin_page) {
210 210
 		$this->_admin_page = $admin_page;
211 211
 		$this->_req_data = $this->_admin_page->get_request_data();
212 212
 		$this->_view = $this->_admin_page->get_view();
213
-		$this->_views = empty( $this->_views ) ? $this->_admin_page->get_list_table_view_RLs() : $this->_views;
213
+		$this->_views = empty($this->_views) ? $this->_admin_page->get_list_table_view_RLs() : $this->_views;
214 214
 		$this->_current_page = $this->get_pagenum();
215
-		$this->_screen = $this->_admin_page->get_current_page() . '_' . $this->_admin_page->get_current_view();
216
-		$this->_yes_no = array(  __('No', 'event_espresso'), __('Yes', 'event_espresso'));
215
+		$this->_screen = $this->_admin_page->get_current_page().'_'.$this->_admin_page->get_current_view();
216
+		$this->_yes_no = array(__('No', 'event_espresso'), __('Yes', 'event_espresso'));
217 217
 
218
-		$this->_per_page = $this->get_items_per_page( $this->_screen . '_per_page', 10 );
218
+		$this->_per_page = $this->get_items_per_page($this->_screen.'_per_page', 10);
219 219
 
220 220
 		$this->_setup_data();
221 221
 		$this->_add_view_counts();
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
 		$this->_set_properties();
226 226
 
227 227
 		//set primary column
228
-		add_filter( 'list_table_primary_column', array( $this, 'set_primary_column' ) );
228
+		add_filter('list_table_primary_column', array($this, 'set_primary_column'));
229 229
 
230 230
 		//set parent defaults
231 231
 		parent::__construct($this->_wp_list_args);
@@ -301,17 +301,17 @@  discard block
 block discarded – undo
301 301
 	 * @return string
302 302
 	 */
303 303
 	protected function _get_hidden_fields() {
304
-		$action = isset( $this->_req_data['route'] ) ? $this->_req_data['route'] : '';
305
-		$action = empty( $action ) && isset( $this->_req_data['action'] ) ? $this->_req_data['action'] : $action;
304
+		$action = isset($this->_req_data['route']) ? $this->_req_data['route'] : '';
305
+		$action = empty($action) && isset($this->_req_data['action']) ? $this->_req_data['action'] : $action;
306 306
 		//if action is STILL empty, then we set it to default
307
-		$action = empty( $action ) ? 'default' : $action;
308
-		$field = '<input type="hidden" name="page" value="' . $this->_req_data['page'] . '" />' . "\n";
309
-		$field .= '<input type="hidden" name="route" value="'. $action .'" />' . "\n";/**/
310
-		$field .= '<input type="hidden" name="perpage" value="' . $this->_per_page . '" />' . "\n";
307
+		$action = empty($action) ? 'default' : $action;
308
+		$field = '<input type="hidden" name="page" value="'.$this->_req_data['page'].'" />'."\n";
309
+		$field .= '<input type="hidden" name="route" value="'.$action.'" />'."\n"; /**/
310
+		$field .= '<input type="hidden" name="perpage" value="'.$this->_per_page.'" />'."\n";
311 311
 
312 312
 		$bulk_actions = $this->_get_bulk_actions();
313
-		foreach ( $bulk_actions as $bulk_action => $label ) {
314
-			$field .= '<input type="hidden" name="' . $bulk_action . '_nonce" value="' . wp_create_nonce  ( $bulk_action . '_nonce' ) . '" />' . "\n";
313
+		foreach ($bulk_actions as $bulk_action => $label) {
314
+			$field .= '<input type="hidden" name="'.$bulk_action.'_nonce" value="'.wp_create_nonce($bulk_action.'_nonce').'" />'."\n";
315 315
 		}
316 316
 
317 317
 		return $field;
@@ -341,15 +341,15 @@  discard block
 block discarded – undo
341 341
 		 *
342 342
 		 * @var array
343 343
 		 */
344
-		$_sortable = apply_filters( "FHEE_manage_{$this->screen->id}_sortable_columns", $_sortable, $this->_screen );
344
+		$_sortable = apply_filters("FHEE_manage_{$this->screen->id}_sortable_columns", $_sortable, $this->_screen);
345 345
 
346 346
 		$sortable = array();
347
-		foreach ( $_sortable as $id => $data ) {
348
-			if ( empty( $data ) ) {
347
+		foreach ($_sortable as $id => $data) {
348
+			if (empty($data)) {
349 349
 				continue;
350 350
 			}
351 351
 			//fix for offset errors with WP_List_Table default get_columninfo()
352
-			if ( is_array($data) ) {
352
+			if (is_array($data)) {
353 353
 				$_data[0] = key($data);
354 354
 				$_data[1] = isset($data[1]) ? $data[1] : false;
355 355
 			} else {
@@ -358,14 +358,14 @@  discard block
 block discarded – undo
358 358
 
359 359
 			$data = (array) $data;
360 360
 
361
-			if ( !isset( $data[1] ) ) {
361
+			if ( ! isset($data[1])) {
362 362
 				$_data[1] = false;
363 363
 			}
364 364
 
365 365
 			$sortable[$id] = $_data;
366 366
 		}
367 367
 		$primary = $this->get_primary_column_name();
368
-		$this->_column_headers = array( $columns, $hidden, $sortable, $primary );
368
+		$this->_column_headers = array($columns, $hidden, $sortable, $primary);
369 369
 	}
370 370
 
371 371
 
@@ -374,8 +374,8 @@  discard block
 block discarded – undo
374 374
 	 * @return string
375 375
 	 */
376 376
 	protected function get_primary_column_name() {
377
-		foreach( class_parents( $this ) as $parent ) {
378
-			if ( $parent === 'WP_List_Table' && method_exists( $parent, 'get_primary_column_name' ) ) {
377
+		foreach (class_parents($this) as $parent) {
378
+			if ($parent === 'WP_List_Table' && method_exists($parent, 'get_primary_column_name')) {
379 379
 				return parent::get_primary_column_name();
380 380
 			}
381 381
 		}
@@ -392,10 +392,10 @@  discard block
 block discarded – undo
392 392
 	 * @param string $primary
393 393
 	 * @return string
394 394
 	 */
395
-	protected function handle_row_actions( $item, $column_name, $primary ) {
396
-		foreach( class_parents( $this ) as $parent ) {
397
-			if ( $parent === 'WP_List_Table' && method_exists( $parent, 'handle_row_actions' ) ) {
398
-				return parent::handle_row_actions( $item, $column_name, $primary );
395
+	protected function handle_row_actions($item, $column_name, $primary) {
396
+		foreach (class_parents($this) as $parent) {
397
+			if ($parent === 'WP_List_Table' && method_exists($parent, 'handle_row_actions')) {
398
+				return parent::handle_row_actions($item, $column_name, $primary);
399 399
 			}
400 400
 		}
401 401
 		return '';
@@ -413,11 +413,11 @@  discard block
 block discarded – undo
413 413
 	protected function _get_bulk_actions() {
414 414
 		$actions = array();
415 415
 		//the _views property should have the bulk_actions, so let's go through and extract them into a properly formatted array for the wp_list_table();
416
-		foreach ( $this->_views as $view => $args) {
417
-			if ( $this->_view === $view  && isset( $args['bulk_action']) && is_array($args['bulk_action']) ) {
416
+		foreach ($this->_views as $view => $args) {
417
+			if ($this->_view === $view && isset($args['bulk_action']) && is_array($args['bulk_action'])) {
418 418
 				//each bulk action will correspond with a admin page route, so we can check whatever the capability is for that page route and skip adding the bulk action if no access for the current logged in user.
419
-				foreach ( $args['bulk_action'] as $route =>$label ) {
420
-					if ( $this->_admin_page->check_user_access( $route, true ) ) {
419
+				foreach ($args['bulk_action'] as $route =>$label) {
420
+					if ($this->_admin_page->check_user_access($route, true)) {
421 421
 						$actions[$route] = $label;
422 422
 					}
423 423
 				}
@@ -436,18 +436,18 @@  discard block
 block discarded – undo
436 436
 	 */
437 437
 	private function _filters() {
438 438
 		$classname = get_class($this);
439
-		$filters = apply_filters( "FHEE__{$classname}__filters", (array) $this->_get_table_filters(), $this, $this->_screen );
439
+		$filters = apply_filters("FHEE__{$classname}__filters", (array) $this->_get_table_filters(), $this, $this->_screen);
440 440
 
441
-		if ( empty( $filters )) {
441
+		if (empty($filters)) {
442 442
 			return;
443 443
 		}
444
-		foreach ( $filters as $filter ) {
444
+		foreach ($filters as $filter) {
445 445
 			echo $filter;
446 446
 		}
447 447
 		//add filter button at end
448
-		echo '<input type="submit" class="button-secondary" value="' . __('Filter', 'event_espresso') . '" id="post-query-submit" />';
448
+		echo '<input type="submit" class="button-secondary" value="'.__('Filter', 'event_espresso').'" id="post-query-submit" />';
449 449
 		//add reset filters button at end
450
-		echo '<a class="button button-secondary"  href="' . $this->_admin_page->get_current_page_view_url() . '" style="display:inline-block">' . __('Reset Filters', 'event_espresso') . '</a>';
450
+		echo '<a class="button button-secondary"  href="'.$this->_admin_page->get_current_page_view_url().'" style="display:inline-block">'.__('Reset Filters', 'event_espresso').'</a>';
451 451
 	}
452 452
 
453 453
 
@@ -461,8 +461,8 @@  discard block
 block discarded – undo
461 461
 	 * @param string $column_name
462 462
 	 * @return string
463 463
 	 */
464
-	public function set_primary_column( $column_name ) {
465
-		return ! empty( $this->_primary_column ) ? $this->_primary_column : $column_name;
464
+	public function set_primary_column($column_name) {
465
+		return ! empty($this->_primary_column) ? $this->_primary_column : $column_name;
466 466
 	}
467 467
 
468 468
 
@@ -482,7 +482,7 @@  discard block
 block discarded – undo
482 482
 			array(
483 483
 				'total_items' => $total_items,
484 484
 				'per_page' => $this->_per_page,
485
-				'total_pages' => ceil($total_items / $this->_per_page )
485
+				'total_pages' => ceil($total_items / $this->_per_page)
486 486
 			)
487 487
 		);
488 488
 	}
@@ -496,7 +496,7 @@  discard block
 block discarded – undo
496 496
 	 * @param string        $column_name The column being called.
497 497
 	 * @return string html content for the column
498 498
 	 */
499
-	public function column_default( $item, $column_name ) {
499
+	public function column_default($item, $column_name) {
500 500
 		/**
501 501
 		 * Dynamic hook allowing for adding additional column content in this list table.
502 502
 		 * Note that $this->screen->id is in the format
@@ -506,7 +506,7 @@  discard block
 block discarded – undo
506 506
 		 * hook prefix ("event-espresso") will be different.
507 507
 		 *
508 508
 		 */
509
-		do_action( 'AHEE__EE_Admin_List_Table__column_' . $column_name . '__' . $this->screen->id, $item, $this->_screen );
509
+		do_action('AHEE__EE_Admin_List_Table__column_'.$column_name.'__'.$this->screen->id, $item, $this->_screen);
510 510
 	}
511 511
 
512 512
 
@@ -532,7 +532,7 @@  discard block
 block discarded – undo
532 532
 		 *
533 533
 		 * @var array
534 534
 		 */
535
-		$columns = apply_filters( 'FHEE_manage_'.$this->screen->id.'_columns', $this->_columns, $this->_screen );
535
+		$columns = apply_filters('FHEE_manage_'.$this->screen->id.'_columns', $this->_columns, $this->_screen);
536 536
 		return $columns;
537 537
 	}
538 538
 
@@ -555,18 +555,18 @@  discard block
 block discarded – undo
555 555
 		$views = $this->get_views();
556 556
 		$assembled_views = '';
557 557
 
558
-		if ( empty( $views )) {
558
+		if (empty($views)) {
559 559
 			return;
560 560
 		}
561 561
 		echo "<ul class='subsubsub'>\n";
562
-		foreach ( $views as $view ) {
563
-			$count = isset($view['count'] ) && !empty($view['count']) ? absint( $view['count'] )  : 0;
564
-			if ( isset( $view['slug'], $view['class'], $view['url'], $view['label']) ) {
565
-				$assembled_views[ $view['slug'] ] = "\t<li class='" . $view['class'] . "'>" . '<a href="' . $view['url'] . '">' . $view['label'] . '</a> <span class="count">(' . $count . ')</span>';
562
+		foreach ($views as $view) {
563
+			$count = isset($view['count']) && ! empty($view['count']) ? absint($view['count']) : 0;
564
+			if (isset($view['slug'], $view['class'], $view['url'], $view['label'])) {
565
+				$assembled_views[$view['slug']] = "\t<li class='".$view['class']."'>".'<a href="'.$view['url'].'">'.$view['label'].'</a> <span class="count">('.$count.')</span>';
566 566
 			}
567 567
 		}
568 568
 
569
-		echo is_array( $assembled_views) && ! empty( $assembled_views ) ? implode( " |</li>\n", $assembled_views ) . "</li>\n" : '';
569
+		echo is_array($assembled_views) && ! empty($assembled_views) ? implode(" |</li>\n", $assembled_views)."</li>\n" : '';
570 570
 		echo "</ul>";
571 571
 	}
572 572
 
@@ -578,10 +578,10 @@  discard block
 block discarded – undo
578 578
 	 * @access public
579 579
 	 * @param EE_Base_Class $item The current item
580 580
 	 */
581
-	public function single_row( $item ) {
582
-		$row_class = $this->_get_row_class( $item );
583
-		echo '<tr class="' . esc_attr( $row_class ) . '">';
584
-		$this->single_row_columns( $item );
581
+	public function single_row($item) {
582
+		$row_class = $this->_get_row_class($item);
583
+		echo '<tr class="'.esc_attr($row_class).'">';
584
+		$this->single_row_columns($item);
585 585
 		echo '</tr>';
586 586
 	}
587 587
 
@@ -593,13 +593,13 @@  discard block
 block discarded – undo
593 593
 	 * @param  EE_Base_Class $item the current item
594 594
 	 * @return string
595 595
 	 */
596
-	protected function _get_row_class( $item ) {
596
+	protected function _get_row_class($item) {
597 597
 		static $row_class = '';
598
-		$row_class = ( $row_class === '' ? 'alternate' : '' );
598
+		$row_class = ($row_class === '' ? 'alternate' : '');
599 599
 
600 600
 		$new_row_class = $row_class;
601 601
 
602
-		if ( !empty($this->_ajax_sorting_callback) ) {
602
+		if ( ! empty($this->_ajax_sorting_callback)) {
603 603
 			$new_row_class .= ' rowsortable';
604 604
 		}
605 605
 
@@ -631,13 +631,13 @@  discard block
 block discarded – undo
631 631
 	 */
632 632
 	public function get_hidden_columns() {
633 633
 		$user_id = get_current_user_id();
634
-		$has_default = get_user_option('default'. $this->screen->id . 'columnshidden', $user_id);
635
-		if ( empty( $has_default ) && !empty($this->_hidden_columns ) ) {
636
-			update_user_option($user_id, 'default'.$this->screen->id . 'columnshidden', TRUE);
637
-			update_user_option($user_id, 'manage' . $this->screen->id . 'columnshidden', $this->_hidden_columns, TRUE );
634
+		$has_default = get_user_option('default'.$this->screen->id.'columnshidden', $user_id);
635
+		if (empty($has_default) && ! empty($this->_hidden_columns)) {
636
+			update_user_option($user_id, 'default'.$this->screen->id.'columnshidden', TRUE);
637
+			update_user_option($user_id, 'manage'.$this->screen->id.'columnshidden', $this->_hidden_columns, TRUE);
638 638
 		}
639
-		$ref = 'manage' . $this->screen->id . 'columnshidden';
640
-		return (array) get_user_option( $ref, $user_id );
639
+		$ref = 'manage'.$this->screen->id.'columnshidden';
640
+		return (array) get_user_option($ref, $user_id);
641 641
 	}
642 642
 
643 643
 
@@ -650,47 +650,47 @@  discard block
 block discarded – undo
650 650
 	 * @since 3.1.0
651 651
 	 * @param EE_Base_Class $item The current item
652 652
 	 */
653
-	public function single_row_columns( $item ) {
654
-		list( $columns, $hidden, $sortable, $primary ) = $this->get_column_info();
653
+	public function single_row_columns($item) {
654
+		list($columns, $hidden, $sortable, $primary) = $this->get_column_info();
655 655
 
656 656
 		global $wp_version;
657
-		$use_hidden_class = version_compare( $wp_version, '4.3-RC', '>=' );
657
+		$use_hidden_class = version_compare($wp_version, '4.3-RC', '>=');
658 658
 
659
-		foreach ( $columns as $column_name => $column_display_name ) {
659
+		foreach ($columns as $column_name => $column_display_name) {
660 660
 
661 661
 			/**
662 662
 			 * With WordPress version 4.3.RC+ WordPress started using the hidden css class to control whether columns are
663 663
 			 * hidden or not instead of using "display:none;".  This bit of code provides backward compat.
664 664
 			 */
665
-			$hidden_class = $use_hidden_class && in_array( $column_name, $hidden ) ? ' hidden' : '';
666
-			$style = ! $use_hidden_class && in_array( $column_name, $hidden ) ? ' style="display:none;"' : '';
665
+			$hidden_class = $use_hidden_class && in_array($column_name, $hidden) ? ' hidden' : '';
666
+			$style = ! $use_hidden_class && in_array($column_name, $hidden) ? ' style="display:none;"' : '';
667 667
 
668
-			$classes = $column_name . ' column-' . $column_name.$hidden_class;
669
-			if ( $primary === $column_name ) {
668
+			$classes = $column_name.' column-'.$column_name.$hidden_class;
669
+			if ($primary === $column_name) {
670 670
 				$classes .= ' has-row-actions column-primary';
671 671
 			}
672 672
 
673
-			$data = ' data-colname="' . wp_strip_all_tags( $column_display_name ) . '"';
673
+			$data = ' data-colname="'.wp_strip_all_tags($column_display_name).'"';
674 674
 
675 675
 			$class = "class='$classes'";
676 676
 
677 677
 			$attributes = "$class$style$data";
678 678
 
679
-			if ( $column_name === 'cb' ) {
679
+			if ($column_name === 'cb') {
680 680
 				echo '<th scope="row" class="check-column">';
681
-				echo apply_filters( 'FHEE__EE_Admin_List_Table__single_row_columns__column_cb_content', $this->column_cb( $item ), $item, $this );
681
+				echo apply_filters('FHEE__EE_Admin_List_Table__single_row_columns__column_cb_content', $this->column_cb($item), $item, $this);
682 682
 				echo '</th>';
683 683
 			}
684
-			elseif ( method_exists( $this, 'column_' . $column_name ) ) {
684
+			elseif (method_exists($this, 'column_'.$column_name)) {
685 685
 				echo "<td $attributes>";
686
-				echo apply_filters( 'FHEE__EE_Admin_List_Table__single_row_columns__column_' . $column_name . '__column_content', call_user_func( array( $this, 'column_' . $column_name ), $item ), $item, $this );
687
-				echo $this->handle_row_actions( $item, $column_name, $primary );
686
+				echo apply_filters('FHEE__EE_Admin_List_Table__single_row_columns__column_'.$column_name.'__column_content', call_user_func(array($this, 'column_'.$column_name), $item), $item, $this);
687
+				echo $this->handle_row_actions($item, $column_name, $primary);
688 688
 				echo "</td>";
689 689
 			}
690 690
 			else {
691 691
 				echo "<td $attributes>";
692
-				echo apply_filters( 'FHEE__EE_Admin_List_Table__single_row_columns__column_default__column_content', $this->column_default( $item, $column_name ), $item, $column_name, $this );
693
-				echo $this->handle_row_actions( $item, $column_name, $primary );
692
+				echo apply_filters('FHEE__EE_Admin_List_Table__single_row_columns__column_default__column_content', $this->column_default($item, $column_name), $item, $column_name, $this);
693
+				echo $this->handle_row_actions($item, $column_name, $primary);
694 694
 				echo "</td>";
695 695
 			}
696 696
 		}
@@ -705,15 +705,15 @@  discard block
 block discarded – undo
705 705
 	 * @param string $which
706 706
 	 * @throws \EE_Error
707 707
 	 */
708
-	public function extra_tablenav( $which ) {
709
-		if ( $which === 'top' ) {
708
+	public function extra_tablenav($which) {
709
+		if ($which === 'top') {
710 710
 			$this->_filters();
711 711
 			echo $this->_get_hidden_fields();
712 712
 		} else {
713 713
 			echo '<div class="list-table-bottom-buttons alignleft actions">';
714
-			foreach ( $this->_bottom_buttons as $type => $action ){
715
-				$route = isset( $action['route'] ) ? $action['route'] : '';
716
-				$extra_request = isset( $action['extra_request'] ) ? $action['extra_request'] : '';
714
+			foreach ($this->_bottom_buttons as $type => $action) {
715
+				$route = isset($action['route']) ? $action['route'] : '';
716
+				$extra_request = isset($action['extra_request']) ? $action['extra_request'] : '';
717 717
 				echo $this->_admin_page->get_action_link_or_button(
718 718
 					$route,
719 719
 					$type,
@@ -723,7 +723,7 @@  discard block
 block discarded – undo
723 723
 					false
724 724
 				);
725 725
 			}
726
-			do_action( 'AHEE__EE_Admin_List_Table__extra_tablenav__after_bottom_buttons', $this, $this->_screen );
726
+			do_action('AHEE__EE_Admin_List_Table__extra_tablenav__after_bottom_buttons', $this, $this->_screen);
727 727
 			echo '</div>';
728 728
 		}
729 729
 		//echo $this->_entries_per_page_dropdown;
@@ -779,11 +779,11 @@  discard block
 block discarded – undo
779 779
 	 *                                                  the actions.
780 780
 	 * @return string The assembled action elements container.
781 781
 	 */
782
-	protected function _action_string( $action_items, $item, $action_container = 'ul', $action_class = '', $action_id = '' ) {
782
+	protected function _action_string($action_items, $item, $action_container = 'ul', $action_class = '', $action_id = '') {
783 783
 		$content = '';
784
-		$action_class = ! empty( $action_class ) ? ' class="' . $action_class . '"' : '';
785
-		$action_id = ! empty( $action_id ) ? ' id="' . $action_id . '"' : '';
786
-		$content .= ! empty( $action_container ) ? '<' . $action_container . $action_class . $action_id . '>' : '';
784
+		$action_class = ! empty($action_class) ? ' class="'.$action_class.'"' : '';
785
+		$action_id = ! empty($action_id) ? ' id="'.$action_id.'"' : '';
786
+		$content .= ! empty($action_container) ? '<'.$action_container.$action_class.$action_id.'>' : '';
787 787
         try {
788 788
             $content .= apply_filters(
789 789
                 'FHEE__EE_Admin_List_Table___action_string__action_items',
@@ -793,11 +793,11 @@  discard block
 block discarded – undo
793 793
             );
794 794
         } catch (\Exception $e) {
795 795
             if (WP_DEBUG) {
796
-                \EE_Error::add_error( $e->getMessage(), __FILE__, __FUNCTION__, __LINE__ );
796
+                \EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__);
797 797
             }
798 798
             $content .= $action_items;
799 799
         }
800
-		$content .= ! empty( $action_container ) ? '</' . $action_container . '>' : '';
800
+		$content .= ! empty($action_container) ? '</'.$action_container.'>' : '';
801 801
 		return $content;
802 802
 	}
803 803
 }
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -680,14 +680,12 @@
 block discarded – undo
680 680
 				echo '<th scope="row" class="check-column">';
681 681
 				echo apply_filters( 'FHEE__EE_Admin_List_Table__single_row_columns__column_cb_content', $this->column_cb( $item ), $item, $this );
682 682
 				echo '</th>';
683
-			}
684
-			elseif ( method_exists( $this, 'column_' . $column_name ) ) {
683
+			} elseif ( method_exists( $this, 'column_' . $column_name ) ) {
685 684
 				echo "<td $attributes>";
686 685
 				echo apply_filters( 'FHEE__EE_Admin_List_Table__single_row_columns__column_' . $column_name . '__column_content', call_user_func( array( $this, 'column_' . $column_name ), $item ), $item, $this );
687 686
 				echo $this->handle_row_actions( $item, $column_name, $primary );
688 687
 				echo "</td>";
689
-			}
690
-			else {
688
+			} else {
691 689
 				echo "<td $attributes>";
692 690
 				echo apply_filters( 'FHEE__EE_Admin_List_Table__single_row_columns__column_default__column_content', $this->column_default( $item, $column_name ), $item, $column_name, $this );
693 691
 				echo $this->handle_row_actions( $item, $column_name, $primary );
Please login to merge, or discard this patch.
admin/extend/registrations/EE_Event_Registrations_List_Table.class.php 2 patches
Indentation   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 		$this->_columns = array_merge( $columns, $this->_columns );
88 88
 		$this->_primary_column = '_REG_att_checked_in';
89 89
 		if ( ! empty( $evt_id )
90
-		     && EE_Registry::instance()->CAP->current_user_can(
90
+			 && EE_Registry::instance()->CAP->current_user_can(
91 91
 				'ee_read_registrations',
92 92
 				'espresso_registrations_registrations_reports',
93 93
 				$evt_id
@@ -189,8 +189,8 @@  discard block
 block discarded – undo
189 189
 			if ( count( $this->_dtts_for_event ) > 1 ) {
190 190
 				$dtts[0] = __( 'To toggle check-in status, select a datetime.', 'event_espresso' );
191 191
 				foreach ( $this->_dtts_for_event as $dtt ) {
192
-                    $datetime_string = $dtt->name();
193
-                    $datetime_string = ! empty($datetime_string ) ? ' (' . $datetime_string . ')' : '';
192
+					$datetime_string = $dtt->name();
193
+					$datetime_string = ! empty($datetime_string ) ? ' (' . $datetime_string . ')' : '';
194 194
 					$datetime_string = $dtt->start_date_and_time() . ' - ' . $dtt->end_date_and_time() . $datetime_string;
195 195
 					$dtts[ $dtt->ID() ] = $datetime_string;
196 196
 				}
@@ -284,7 +284,7 @@  discard block
 block discarded – undo
284 284
 		$checkinstatus = $item->check_in_status_for_datetime( $this->_cur_dtt_id );
285 285
 		$nonce = wp_create_nonce( 'checkin_nonce' );
286 286
 		$toggle_active = ! empty ( $this->_cur_dtt_id )
287
-		                 && EE_Registry::instance()->CAP->current_user_can(
287
+						 && EE_Registry::instance()->CAP->current_user_can(
288 288
 			'ee_edit_checkin',
289 289
 			'espresso_registrations_toggle_checkin_status',
290 290
 			$item->ID()
@@ -293,11 +293,11 @@  discard block
 block discarded – undo
293 293
 			: '';
294 294
 		$mobile_view_content = ' <span class="show-on-mobile-view-only">' . $attendee_name . '</span>';
295 295
 		return '<span class="checkin-icons checkedin-status-' . $checkinstatus . $toggle_active . '"'
296
-		       . ' data-_regid="' . $item->ID() . '"'
297
-		       . ' data-dttid="' . $this->_cur_dtt_id . '"'
298
-		       . ' data-nonce="' . $nonce . '">'
299
-		       . '</span>'
300
-		       . $mobile_view_content;
296
+			   . ' data-_regid="' . $item->ID() . '"'
297
+			   . ' data-dttid="' . $this->_cur_dtt_id . '"'
298
+			   . ' data-nonce="' . $nonce . '">'
299
+			   . '</span>'
300
+			   . $mobile_view_content;
301 301
 	}
302 302
 
303 303
 
@@ -322,8 +322,8 @@  discard block
 block discarded – undo
322 322
 			'espresso_registrations_edit_attendee'
323 323
 		)
324 324
 			? '<a href="' . $edit_lnk_url . '" title="' . esc_attr__( 'Edit Contact', 'event_espresso' ) . '">'
325
-			    . $item->attendee()->full_name()
326
-			    . '</a>'
325
+				. $item->attendee()->full_name()
326
+				. '</a>'
327 327
 			: $item->attendee()->full_name();
328 328
 		$name_link .= $item->count() === 1
329 329
 			? '&nbsp;<sup><div class="dashicons dashicons-star-filled lt-blue-icon ee-icon-size-8"></div></sup>	'
@@ -358,7 +358,7 @@  discard block
 block discarded – undo
358 358
 			? $latest_related_datetime->ID()
359 359
 			: $DTT_ID;
360 360
 		if ( ! empty( $DTT_ID )
361
-		     && EE_Registry::instance()->CAP->current_user_can(
361
+			 && EE_Registry::instance()->CAP->current_user_can(
362 362
 				'ee_read_checkins',
363 363
 				'espresso_registrations_registration_checkins'
364 364
 			)
@@ -458,15 +458,15 @@  discard block
 block discarded – undo
458 458
 				) ? '
459 459
 				<span class="reg-pad-rght">
460 460
 					<a class="status-'
461
-				    . $item->transaction()->status_ID()
462
-				    . '" href="'
463
-				    . $view_txn_lnk_url
464
-				    . '"  title="'
465
-				    . esc_attr__( 'View Transaction', 'event_espresso' )
466
-				    . '">
461
+					. $item->transaction()->status_ID()
462
+					. '" href="'
463
+					. $view_txn_lnk_url
464
+					. '"  title="'
465
+					. esc_attr__( 'View Transaction', 'event_espresso' )
466
+					. '">
467 467
 						'
468
-				    . $item->transaction()->pretty_paid()
469
-				    . '
468
+					. $item->transaction()->pretty_paid()
469
+					. '
470 470
 					</a>
471 471
 				<span>' : '<span class="reg-pad-rght">' . $item->transaction()->pretty_paid() . '</span>';
472 472
 			}
@@ -499,12 +499,12 @@  discard block
 block discarded – undo
499 499
 				'ee_read_transaction',
500 500
 				'espresso_transactions_view_transaction'
501 501
 			) ? '<a href="'
502
-			    . $view_txn_url
503
-			    . '" title="'
504
-			    . esc_attr__( 'View Transaction', 'event_espresso' )
505
-			    . '"><span class="reg-pad-rght">'
506
-			    . $txn_total
507
-			    . '</span></a>' : '<span class="reg-pad-rght">' . $txn_total . '</span>';
502
+				. $view_txn_url
503
+				. '" title="'
504
+				. esc_attr__( 'View Transaction', 'event_espresso' )
505
+				. '"><span class="reg-pad-rght">'
506
+				. $txn_total
507
+				. '</span></a>' : '<span class="reg-pad-rght">' . $txn_total . '</span>';
508 508
 		} else {
509 509
 			return '<span class="reg-pad-rght"></span>';
510 510
 		}
Please login to merge, or discard this patch.
Spacing   +110 added lines, -110 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1
-<?php if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
2
-	exit( 'No direct script access allowed' );
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3 3
 }
4 4
 
5 5
 
@@ -42,51 +42,51 @@  discard block
 block discarded – undo
42 42
 	 *
43 43
 	 * @param \Registrations_Admin_Page $admin_page
44 44
 	 */
45
-	public function __construct( $admin_page ) {
46
-		parent::__construct( $admin_page );
45
+	public function __construct($admin_page) {
46
+		parent::__construct($admin_page);
47 47
 		$this->_status = $this->_admin_page->get_registration_status_array();
48 48
 	}
49 49
 
50 50
 
51 51
 
52 52
 	protected function _setup_data() {
53
-		$this->_data = $this->_view !== 'trash' ? $this->_admin_page->get_event_attendees( $this->_per_page )
54
-			: $this->_admin_page->get_event_attendees( $this->_per_page, false, true );
53
+		$this->_data = $this->_view !== 'trash' ? $this->_admin_page->get_event_attendees($this->_per_page)
54
+			: $this->_admin_page->get_event_attendees($this->_per_page, false, true);
55 55
 		$this->_all_data_count = $this->_view !== 'trash' ? $this->_admin_page->get_event_attendees(
56 56
 			$this->_per_page,
57 57
 			true
58
-		) : $this->_admin_page->get_event_attendees( $this->_per_page, true, true );
58
+		) : $this->_admin_page->get_event_attendees($this->_per_page, true, true);
59 59
 	}
60 60
 
61 61
 
62 62
 
63 63
 	protected function _set_properties() {
64
-		$evt_id = isset( $this->_req_data['event_id'] ) ? $this->_req_data['event_id'] : null;
64
+		$evt_id = isset($this->_req_data['event_id']) ? $this->_req_data['event_id'] : null;
65 65
 		$this->_wp_list_args = array(
66
-			'singular' => __( 'registrant', 'event_espresso' ),
67
-			'plural'   => __( 'registrants', 'event_espresso' ),
66
+			'singular' => __('registrant', 'event_espresso'),
67
+			'plural'   => __('registrants', 'event_espresso'),
68 68
 			'ajax'     => true,
69 69
 			'screen'   => $this->_admin_page->get_current_screen()->id,
70 70
 		);
71 71
 		$columns = array();
72 72
 		//$columns['_Reg_Status'] = '';
73
-		if ( ! empty( $evt_id ) ) {
73
+		if ( ! empty($evt_id)) {
74 74
 			$columns['cb'] = '<input type="checkbox" />'; //Render a checkbox instead of text
75 75
 			$this->_has_checkbox_column = true;
76 76
 		}
77 77
 		$this->_columns = array(
78 78
 			'_REG_att_checked_in' => '<span class="dashicons dashicons-yes ee-icon-size-18"></span>',
79
-			'ATT_name'            => __( 'Registrant', 'event_espresso' ),
80
-			'ATT_email'           => __( 'Email Address', 'event_espresso' ),
81
-			'Event'               => __( 'Event', 'event_espresso' ),
82
-			'PRC_name'            => __( 'TKT Option', 'event_espresso' ),
83
-			'_REG_final_price'    => __( 'Price', 'event_espresso' ),
84
-			'TXN_paid'            => __( 'Paid', 'event_espresso' ),
85
-			'TXN_total'           => __( 'Total', 'event_espresso' ),
79
+			'ATT_name'            => __('Registrant', 'event_espresso'),
80
+			'ATT_email'           => __('Email Address', 'event_espresso'),
81
+			'Event'               => __('Event', 'event_espresso'),
82
+			'PRC_name'            => __('TKT Option', 'event_espresso'),
83
+			'_REG_final_price'    => __('Price', 'event_espresso'),
84
+			'TXN_paid'            => __('Paid', 'event_espresso'),
85
+			'TXN_total'           => __('Total', 'event_espresso'),
86 86
 		);
87
-		$this->_columns = array_merge( $columns, $this->_columns );
87
+		$this->_columns = array_merge($columns, $this->_columns);
88 88
 		$this->_primary_column = '_REG_att_checked_in';
89
-		if ( ! empty( $evt_id )
89
+		if ( ! empty($evt_id)
90 90
 		     && EE_Registry::instance()->CAP->current_user_can(
91 91
 				'ee_read_registrations',
92 92
 				'espresso_registrations_registrations_reports',
@@ -99,18 +99,18 @@  discard block
 block discarded – undo
99 99
 					'extra_request' =>
100 100
 						array(
101 101
 							'EVT_ID'     => $evt_id,
102
-							'return_url' => urlencode( "//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}" ),
102
+							'return_url' => urlencode("//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}"),
103 103
 						),
104 104
 				),
105 105
 			);
106 106
 		}
107 107
 		$this->_sortable_columns = array(
108 108
 			//true means its already sorted
109
-			'ATT_name' => array( 'ATT_name' => true ),
110
-			'Event'    => array( 'Event.EVT.Name' => false ),
109
+			'ATT_name' => array('ATT_name' => true),
110
+			'Event'    => array('Event.EVT.Name' => false),
111 111
 		);
112 112
 		$this->_hidden_columns = array();
113
-		$this->_evt = EEM_Event::instance()->get_one_by_ID( $evt_id );
113
+		$this->_evt = EEM_Event::instance()->get_one_by_ID($evt_id);
114 114
 		$this->_dtts_for_event = $this->_evt instanceof EE_Event ? $this->_evt->datetimes_ordered() : array();
115 115
 	}
116 116
 
@@ -120,11 +120,11 @@  discard block
 block discarded – undo
120 120
 	 * @param \EE_Registration $item
121 121
 	 * @return string
122 122
 	 */
123
-	protected function _get_row_class( $item ) {
124
-		$class = parent::_get_row_class( $item );
123
+	protected function _get_row_class($item) {
124
+		$class = parent::_get_row_class($item);
125 125
 		//add status class
126
-		$class .= ' ee-status-strip reg-status-' . $item->status_ID();
127
-		if ( $this->_has_checkbox_column ) {
126
+		$class .= ' ee-status-strip reg-status-'.$item->status_ID();
127
+		if ($this->_has_checkbox_column) {
128 128
 			$class .= ' has-checkbox-column';
129 129
 		}
130 130
 		return $class;
@@ -138,61 +138,61 @@  discard block
 block discarded – undo
138 138
 	 */
139 139
 	protected function _get_table_filters() {
140 140
 		$filters = $where = array();
141
-		$current_EVT_ID = isset( $this->_req_data['event_id'] ) ? (int) $this->_req_data['event_id'] : 0;
142
-		if ( empty( $this->_dtts_for_event ) || count( $this->_dtts_for_event ) === 1 ) {
141
+		$current_EVT_ID = isset($this->_req_data['event_id']) ? (int) $this->_req_data['event_id'] : 0;
142
+		if (empty($this->_dtts_for_event) || count($this->_dtts_for_event) === 1) {
143 143
 			//this means we don't have an event so let's setup a filter dropdown for all the events to select
144 144
 			//note possible capability restrictions
145
-			if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_private_events', 'get_events' ) ) {
146
-				$where['status**'] = array( '!=', 'private' );
145
+			if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_private_events', 'get_events')) {
146
+				$where['status**'] = array('!=', 'private');
147 147
 			}
148
-			if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_events', 'get_events' ) ) {
148
+			if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_events', 'get_events')) {
149 149
 				$where['EVT_wp_user'] = get_current_user_id();
150 150
 			}
151 151
 			$events = EEM_Event::instance()->get_all(
152 152
 				array(
153 153
 					$where,
154
-					'order_by' => array( 'Datetime.DTT_EVT_start' => 'DESC' ),
154
+					'order_by' => array('Datetime.DTT_EVT_start' => 'DESC'),
155 155
 				)
156 156
 			);
157 157
 			$evts[] = array(
158 158
 				'id'   => 0,
159
-				'text' => __( 'To toggle Check-in status, select an event', 'event_espresso' ),
159
+				'text' => __('To toggle Check-in status, select an event', 'event_espresso'),
160 160
 			);
161 161
 			$checked = 'checked';
162 162
 			/** @var EE_Event $evt */
163
-			foreach ( $events as $evt ) {
163
+			foreach ($events as $evt) {
164 164
 				//any registrations for this event?
165
-				if ( ! $evt->get_count_of_all_registrations() ) {
165
+				if ( ! $evt->get_count_of_all_registrations()) {
166 166
 					continue;
167 167
 				}
168 168
 				$evts[] = array(
169 169
 					'id'    => $evt->ID(),
170
-					'text'  => $evt->get( 'EVT_name' ),
170
+					'text'  => $evt->get('EVT_name'),
171 171
 					'class' => $evt->is_expired() ? 'ee-expired-event' : '',
172 172
 				);
173
-				if ( $evt->ID() === $current_EVT_ID && $evt->is_expired() ) {
173
+				if ($evt->ID() === $current_EVT_ID && $evt->is_expired()) {
174 174
 					$checked = '';
175 175
 				}
176 176
 			}
177 177
 			$event_filter = '<div class="ee-event-filter">';
178
-			$event_filter .= EEH_Form_Fields::select_input( 'event_id', $evts, $current_EVT_ID );
178
+			$event_filter .= EEH_Form_Fields::select_input('event_id', $evts, $current_EVT_ID);
179 179
 			$event_filter .= '<span class="ee-event-filter-toggle">';
180
-			$event_filter .= '<input type="checkbox" id="js-ee-hide-expired-events" ' . $checked . '> ';
181
-			$event_filter .= __( 'Hide Expired Events', 'event_espresso' );
180
+			$event_filter .= '<input type="checkbox" id="js-ee-hide-expired-events" '.$checked.'> ';
181
+			$event_filter .= __('Hide Expired Events', 'event_espresso');
182 182
 			$event_filter .= '</span>';
183 183
 			$event_filter .= '</div>';
184 184
 			$filters[] = $event_filter;
185 185
 		}
186
-		if ( ! empty( $this->_dtts_for_event ) ) {
186
+		if ( ! empty($this->_dtts_for_event)) {
187 187
 			//DTT datetimes filter
188
-			$this->_cur_dtt_id = isset( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : 0;
189
-			if ( count( $this->_dtts_for_event ) > 1 ) {
190
-				$dtts[0] = __( 'To toggle check-in status, select a datetime.', 'event_espresso' );
191
-				foreach ( $this->_dtts_for_event as $dtt ) {
188
+			$this->_cur_dtt_id = isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : 0;
189
+			if (count($this->_dtts_for_event) > 1) {
190
+				$dtts[0] = __('To toggle check-in status, select a datetime.', 'event_espresso');
191
+				foreach ($this->_dtts_for_event as $dtt) {
192 192
                     $datetime_string = $dtt->name();
193
-                    $datetime_string = ! empty($datetime_string ) ? ' (' . $datetime_string . ')' : '';
194
-					$datetime_string = $dtt->start_date_and_time() . ' - ' . $dtt->end_date_and_time() . $datetime_string;
195
-					$dtts[ $dtt->ID() ] = $datetime_string;
193
+                    $datetime_string = ! empty($datetime_string) ? ' ('.$datetime_string.')' : '';
194
+					$datetime_string = $dtt->start_date_and_time().' - '.$dtt->end_date_and_time().$datetime_string;
195
+					$dtts[$dtt->ID()] = $datetime_string;
196 196
 				}
197 197
 				$input = new EE_Select_Input(
198 198
 					$dtts,
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
 					)
204 204
 				);
205 205
 				$filters[] = $input->get_html_for_input();
206
-				$filters[] = '<input type="hidden" name="event_id" value="' . $current_EVT_ID . '">';
206
+				$filters[] = '<input type="hidden" name="event_id" value="'.$current_EVT_ID.'">';
207 207
 			}
208 208
 		}
209 209
 		return $filters;
@@ -222,22 +222,22 @@  discard block
 block discarded – undo
222 222
 	 * @throws \EE_Error
223 223
 	 */
224 224
 	protected function _get_total_event_attendees() {
225
-		$EVT_ID = isset( $this->_req_data['event_id'] ) ? absint( $this->_req_data['event_id'] ) : false;
225
+		$EVT_ID = isset($this->_req_data['event_id']) ? absint($this->_req_data['event_id']) : false;
226 226
 		$DTT_ID = $this->_cur_dtt_id;
227 227
 		$query_params = array();
228
-		if ( $EVT_ID ) {
228
+		if ($EVT_ID) {
229 229
 			$query_params[0]['EVT_ID'] = $EVT_ID;
230 230
 		}
231 231
 		//if DTT is included we only show for that datetime.  Otherwise we're showing for all datetimes (the event).
232
-		if ( $DTT_ID ) {
232
+		if ($DTT_ID) {
233 233
 			$query_params[0]['Ticket.Datetime.DTT_ID'] = $DTT_ID;
234 234
 		}
235 235
 		$status_ids_array = apply_filters(
236 236
 			'FHEE__Extend_Registrations_Admin_Page__get_event_attendees__status_ids_array',
237
-			array( EEM_Registration::status_id_pending_payment, EEM_Registration::status_id_approved )
237
+			array(EEM_Registration::status_id_pending_payment, EEM_Registration::status_id_approved)
238 238
 		);
239
-		$query_params[0]['STS_ID'] = array( 'IN', $status_ids_array );
240
-		return EEM_Registration::instance()->count( $query_params );
239
+		$query_params[0]['STS_ID'] = array('IN', $status_ids_array);
240
+		return EEM_Registration::instance()->count($query_params);
241 241
 	}
242 242
 
243 243
 
@@ -246,8 +246,8 @@  discard block
 block discarded – undo
246 246
 	 * @param \EE_Registration $item
247 247
 	 * @return string
248 248
 	 */
249
-	public function column__Reg_Status( EE_Registration $item ) {
250
-		return '<span class="ee-status-strip ee-status-strip-td reg-status-' . $item->status_ID() . '"></span>';
249
+	public function column__Reg_Status(EE_Registration $item) {
250
+		return '<span class="ee-status-strip ee-status-strip-td reg-status-'.$item->status_ID().'"></span>';
251 251
 	}
252 252
 
253 253
 
@@ -257,8 +257,8 @@  discard block
 block discarded – undo
257 257
 	 * @return string
258 258
 	 * @throws \EE_Error
259 259
 	 */
260
-	public function column_cb( $item ) {
261
-		return sprintf( '<input type="checkbox" name="checkbox[%1$s]" value="%1$s" />', $item->ID() );
260
+	public function column_cb($item) {
261
+		return sprintf('<input type="checkbox" name="checkbox[%1$s]" value="%1$s" />', $item->ID());
262 262
 	}
263 263
 
264 264
 
@@ -270,20 +270,20 @@  discard block
 block discarded – undo
270 270
 	 * @return string
271 271
 	 * @throws \EE_Error
272 272
 	 */
273
-	public function column__REG_att_checked_in( EE_Registration $item ) {
273
+	public function column__REG_att_checked_in(EE_Registration $item) {
274 274
 		$attendee = $item->attendee();
275 275
 		$attendee_name = $attendee instanceof EE_Attendee ? $attendee->full_name() : '';
276 276
 
277
-		if ( $this->_cur_dtt_id === 0 && count( $this->_dtts_for_event ) === 1 ) {
277
+		if ($this->_cur_dtt_id === 0 && count($this->_dtts_for_event) === 1) {
278 278
 			$latest_related_datetime = $item->get_latest_related_datetime();
279
-			if ( $latest_related_datetime instanceof EE_Datetime ) {
279
+			if ($latest_related_datetime instanceof EE_Datetime) {
280 280
 				$this->_cur_dtt_id = $latest_related_datetime->ID();
281 281
 			}
282 282
 		}
283 283
 
284
-		$checkinstatus = $item->check_in_status_for_datetime( $this->_cur_dtt_id );
285
-		$nonce = wp_create_nonce( 'checkin_nonce' );
286
-		$toggle_active = ! empty ( $this->_cur_dtt_id )
284
+		$checkinstatus = $item->check_in_status_for_datetime($this->_cur_dtt_id);
285
+		$nonce = wp_create_nonce('checkin_nonce');
286
+		$toggle_active = ! empty ($this->_cur_dtt_id)
287 287
 		                 && EE_Registry::instance()->CAP->current_user_can(
288 288
 			'ee_edit_checkin',
289 289
 			'espresso_registrations_toggle_checkin_status',
@@ -291,11 +291,11 @@  discard block
 block discarded – undo
291 291
 		)
292 292
 			? ' clickable trigger-checkin'
293 293
 			: '';
294
-		$mobile_view_content = ' <span class="show-on-mobile-view-only">' . $attendee_name . '</span>';
295
-		return '<span class="checkin-icons checkedin-status-' . $checkinstatus . $toggle_active . '"'
296
-		       . ' data-_regid="' . $item->ID() . '"'
297
-		       . ' data-dttid="' . $this->_cur_dtt_id . '"'
298
-		       . ' data-nonce="' . $nonce . '">'
294
+		$mobile_view_content = ' <span class="show-on-mobile-view-only">'.$attendee_name.'</span>';
295
+		return '<span class="checkin-icons checkedin-status-'.$checkinstatus.$toggle_active.'"'
296
+		       . ' data-_regid="'.$item->ID().'"'
297
+		       . ' data-dttid="'.$this->_cur_dtt_id.'"'
298
+		       . ' data-nonce="'.$nonce.'">'
299 299
 		       . '</span>'
300 300
 		       . $mobile_view_content;
301 301
 	}
@@ -307,21 +307,21 @@  discard block
 block discarded – undo
307 307
 	 * @return mixed|string|void
308 308
 	 * @throws \EE_Error
309 309
 	 */
310
-	public function column_ATT_name( EE_Registration $item ) {
310
+	public function column_ATT_name(EE_Registration $item) {
311 311
 		$attendee = $item->attendee();
312
-		if ( ! $attendee instanceof EE_Attendee ) {
313
-			return __( 'No contact record for this registration.', 'event_espresso' );
312
+		if ( ! $attendee instanceof EE_Attendee) {
313
+			return __('No contact record for this registration.', 'event_espresso');
314 314
 		}
315 315
 		// edit attendee link
316 316
 		$edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(
317
-			array( 'action' => 'view_registration', '_REG_ID' => $item->ID() ),
317
+			array('action' => 'view_registration', '_REG_ID' => $item->ID()),
318 318
 			REG_ADMIN_URL
319 319
 		);
320 320
 		$name_link = EE_Registry::instance()->CAP->current_user_can(
321 321
 			'ee_edit_contacts',
322 322
 			'espresso_registrations_edit_attendee'
323 323
 		)
324
-			? '<a href="' . $edit_lnk_url . '" title="' . esc_attr__( 'Edit Contact', 'event_espresso' ) . '">'
324
+			? '<a href="'.$edit_lnk_url.'" title="'.esc_attr__('Edit Contact', 'event_espresso').'">'
325 325
 			    . $item->attendee()->full_name()
326 326
 			    . '</a>'
327 327
 			: $item->attendee()->full_name();
@@ -329,10 +329,10 @@  discard block
 block discarded – undo
329 329
 			? '&nbsp;<sup><div class="dashicons dashicons-star-filled lt-blue-icon ee-icon-size-8"></div></sup>	'
330 330
 			: '';
331 331
 		//add group details
332
-		$name_link .= '&nbsp;' . sprintf( __( '(%s of %s)', 'event_espresso' ), $item->count(), $item->group_size() );
332
+		$name_link .= '&nbsp;'.sprintf(__('(%s of %s)', 'event_espresso'), $item->count(), $item->group_size());
333 333
 		//add regcode
334 334
 		$link = EE_Admin_Page::add_query_args_and_nonce(
335
-			array( 'action' => 'view_registration', '_REG_ID' => $item->ID() ),
335
+			array('action' => 'view_registration', '_REG_ID' => $item->ID()),
336 336
 			REG_ADMIN_URL
337 337
 		);
338 338
 		$name_link .= '<br>';
@@ -341,37 +341,37 @@  discard block
 block discarded – undo
341 341
 			'view_registration',
342 342
 			$item->ID()
343 343
 		)
344
-			? '<a href="' . $link . '" title="' . esc_attr__( 'View Registration Details', 'event_espresso' ) . '">'
344
+			? '<a href="'.$link.'" title="'.esc_attr__('View Registration Details', 'event_espresso').'">'
345 345
 			  . $item->reg_code()
346 346
 			  . '</a>'
347 347
 			: $item->reg_code();
348 348
 		//status
349 349
 		$name_link .= '<br><span class="ee-status-text-small">';
350
-		$name_link .= EEH_Template::pretty_status( $item->status_ID(), false, 'sentence' );
350
+		$name_link .= EEH_Template::pretty_status($item->status_ID(), false, 'sentence');
351 351
 		$name_link .= '</span>';
352 352
 		$actions = array();
353 353
 		$DTT_ID = $this->_cur_dtt_id;
354
-		$latest_related_datetime = empty( $DTT_ID ) && ! empty( $this->_req_data['event_id'] ) && $item instanceof EE_Registration
354
+		$latest_related_datetime = empty($DTT_ID) && ! empty($this->_req_data['event_id']) && $item instanceof EE_Registration
355 355
 			? $item->get_latest_related_datetime()
356 356
 			: null;
357 357
 		$DTT_ID = $latest_related_datetime instanceof EE_Datetime
358 358
 			? $latest_related_datetime->ID()
359 359
 			: $DTT_ID;
360
-		if ( ! empty( $DTT_ID )
360
+		if ( ! empty($DTT_ID)
361 361
 		     && EE_Registry::instance()->CAP->current_user_can(
362 362
 				'ee_read_checkins',
363 363
 				'espresso_registrations_registration_checkins'
364 364
 			)
365 365
 		) {
366 366
 			$checkin_list_url = EE_Admin_Page::add_query_args_and_nonce(
367
-				array( 'action' => 'registration_checkins', '_REGID' => $item->ID(), 'DTT_ID' => $DTT_ID )
367
+				array('action' => 'registration_checkins', '_REGID' => $item->ID(), 'DTT_ID' => $DTT_ID)
368 368
 			);
369
-			$actions['checkin'] = '<a href="' . $checkin_list_url . '" title="' . esc_attr__(
369
+			$actions['checkin'] = '<a href="'.$checkin_list_url.'" title="'.esc_attr__(
370 370
 					'View all the check-ins/checkouts for this registrant',
371 371
 					'event_espresso'
372
-				) . '">' . __( 'View', 'event_espresso' ) . '</a>';
372
+				).'">'.__('View', 'event_espresso').'</a>';
373 373
 		}
374
-		return ! empty( $DTT_ID ) ? sprintf( '%1$s %2$s', $name_link, $this->row_actions( $actions ) ) : $name_link;
374
+		return ! empty($DTT_ID) ? sprintf('%1$s %2$s', $name_link, $this->row_actions($actions)) : $name_link;
375 375
 	}
376 376
 
377 377
 
@@ -380,7 +380,7 @@  discard block
 block discarded – undo
380 380
 	 * @param \EE_Registration $item
381 381
 	 * @return string
382 382
 	 */
383
-	public function column_ATT_email( EE_Registration $item ) {
383
+	public function column_ATT_email(EE_Registration $item) {
384 384
 		$attendee = $item->attendee();
385 385
 		return $attendee instanceof EE_Attendee ? $attendee->email() : '';
386 386
 	}
@@ -392,22 +392,22 @@  discard block
 block discarded – undo
392 392
 	 * @return bool|string
393 393
 	 * @throws \EE_Error
394 394
 	 */
395
-	public function column_Event( EE_Registration $item ) {
395
+	public function column_Event(EE_Registration $item) {
396 396
 		try {
397 397
 			$event = $this->_evt instanceof EE_Event ? $this->_evt : $item->event();
398 398
 			$chkin_lnk_url = EE_Admin_Page::add_query_args_and_nonce(
399
-				array( 'action' => 'event_registrations', 'event_id' => $event->ID() ),
399
+				array('action' => 'event_registrations', 'event_id' => $event->ID()),
400 400
 				REG_ADMIN_URL
401 401
 			);
402 402
 			$event_label = EE_Registry::instance()->CAP->current_user_can(
403 403
 				'ee_read_checkins',
404 404
 				'espresso_registrations_registration_checkins'
405
-			) ? '<a href="' . $chkin_lnk_url . '" title="' . esc_attr__(
405
+			) ? '<a href="'.$chkin_lnk_url.'" title="'.esc_attr__(
406 406
 					'View Checkins for this Event',
407 407
 					'event_espresso'
408
-				) . '">' . $event->name() . '</a>' : $event->name();
409
-		} catch ( \EventEspresso\core\exceptions\EntityNotFoundException $e ) {
410
-			$event_label = esc_html__( 'Unknown', 'event_espresso' );
408
+				).'">'.$event->name().'</a>' : $event->name();
409
+		} catch (\EventEspresso\core\exceptions\EntityNotFoundException $e) {
410
+			$event_label = esc_html__('Unknown', 'event_espresso');
411 411
 		}
412 412
 		return $event_label;
413 413
 	}
@@ -418,8 +418,8 @@  discard block
 block discarded – undo
418 418
 	 * @param \EE_Registration $item
419 419
 	 * @return mixed|string|void
420 420
 	 */
421
-	public function column_PRC_name( EE_Registration $item ) {
422
-		return $item->ticket() instanceof EE_Ticket ? $item->ticket()->name() : __( "Unknown", "event_espresso" );
421
+	public function column_PRC_name(EE_Registration $item) {
422
+		return $item->ticket() instanceof EE_Ticket ? $item->ticket()->name() : __("Unknown", "event_espresso");
423 423
 	}
424 424
 
425 425
 
@@ -430,8 +430,8 @@  discard block
 block discarded – undo
430 430
 	 * @param \EE_Registration $item
431 431
 	 * @return string
432 432
 	 */
433
-	public function column__REG_final_price( EE_Registration $item ) {
434
-		return '<span class="reg-pad-rght">' . ' ' . $item->pretty_final_price() . '</span>';
433
+	public function column__REG_final_price(EE_Registration $item) {
434
+		return '<span class="reg-pad-rght">'.' '.$item->pretty_final_price().'</span>';
435 435
 	}
436 436
 
437 437
 
@@ -443,13 +443,13 @@  discard block
 block discarded – undo
443 443
 	 * @return string
444 444
 	 * @throws \EE_Error
445 445
 	 */
446
-	public function column_TXN_paid( EE_Registration $item ) {
447
-		if ( $item->count() === 1 ) {
448
-			if ( $item->transaction()->paid() >= $item->transaction()->total() ) {
446
+	public function column_TXN_paid(EE_Registration $item) {
447
+		if ($item->count() === 1) {
448
+			if ($item->transaction()->paid() >= $item->transaction()->total()) {
449 449
 				return '<span class="reg-pad-rght"><div class="dashicons dashicons-yes green-icon"></div></span>';
450 450
 			} else {
451 451
 				$view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce(
452
-					array( 'action' => 'view_transaction', 'TXN_ID' => $item->transaction_ID() ),
452
+					array('action' => 'view_transaction', 'TXN_ID' => $item->transaction_ID()),
453 453
 					TXN_ADMIN_URL
454 454
 				);
455 455
 				return EE_Registry::instance()->CAP->current_user_can(
@@ -462,13 +462,13 @@  discard block
 block discarded – undo
462 462
 				    . '" href="'
463 463
 				    . $view_txn_lnk_url
464 464
 				    . '"  title="'
465
-				    . esc_attr__( 'View Transaction', 'event_espresso' )
465
+				    . esc_attr__('View Transaction', 'event_espresso')
466 466
 				    . '">
467 467
 						'
468 468
 				    . $item->transaction()->pretty_paid()
469 469
 				    . '
470 470
 					</a>
471
-				<span>' : '<span class="reg-pad-rght">' . $item->transaction()->pretty_paid() . '</span>';
471
+				<span>' : '<span class="reg-pad-rght">'.$item->transaction()->pretty_paid().'</span>';
472 472
 			}
473 473
 		} else {
474 474
 			return '<span class="reg-pad-rght"></span>';
@@ -484,13 +484,13 @@  discard block
 block discarded – undo
484 484
 	 * @return string
485 485
 	 * @throws \EE_Error
486 486
 	 */
487
-	public function column_TXN_total( EE_Registration $item ) {
487
+	public function column_TXN_total(EE_Registration $item) {
488 488
 		$txn = $item->transaction();
489
-		$view_txn_url = add_query_arg( array( 'action' => 'view_transaction', 'TXN_ID' => $txn->ID() ), TXN_ADMIN_URL );
490
-		if ( $item->get( 'REG_count' ) === 1 ) {
489
+		$view_txn_url = add_query_arg(array('action' => 'view_transaction', 'TXN_ID' => $txn->ID()), TXN_ADMIN_URL);
490
+		if ($item->get('REG_count') === 1) {
491 491
 			$line_total_obj = $txn->total_line_item();
492 492
 			$txn_total = $line_total_obj instanceof EE_Line_Item
493
-				? $line_total_obj->get_pretty( 'LIN_total' )
493
+				? $line_total_obj->get_pretty('LIN_total')
494 494
 				: __(
495 495
 					'View Transaction',
496 496
 					'event_espresso'
@@ -501,10 +501,10 @@  discard block
 block discarded – undo
501 501
 			) ? '<a href="'
502 502
 			    . $view_txn_url
503 503
 			    . '" title="'
504
-			    . esc_attr__( 'View Transaction', 'event_espresso' )
504
+			    . esc_attr__('View Transaction', 'event_espresso')
505 505
 			    . '"><span class="reg-pad-rght">'
506 506
 			    . $txn_total
507
-			    . '</span></a>' : '<span class="reg-pad-rght">' . $txn_total . '</span>';
507
+			    . '</span></a>' : '<span class="reg-pad-rght">'.$txn_total.'</span>';
508 508
 		} else {
509 509
 			return '<span class="reg-pad-rght"></span>';
510 510
 		}
Please login to merge, or discard this patch.
core/helpers/EEH_Template.helper.php 2 patches
Spacing   +219 added lines, -219 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 
16 16
 
17 17
 
18
-if ( ! function_exists( 'espresso_get_template_part' )) {
18
+if ( ! function_exists('espresso_get_template_part')) {
19 19
 	/**
20 20
 	 * espresso_get_template_part
21 21
 	 * basically a copy of the WordPress get_template_part() function but uses EEH_Template::locate_template() instead, and doesn't add base versions of files
@@ -25,14 +25,14 @@  discard block
 block discarded – undo
25 25
 	 * @param string $name The name of the specialised template.
26 26
 	 * @return string        the html output for the formatted money value
27 27
 	 */
28
-	function espresso_get_template_part( $slug = NULL, $name = NULL ) {
29
-		EEH_Template::get_template_part( $slug, $name );
28
+	function espresso_get_template_part($slug = NULL, $name = NULL) {
29
+		EEH_Template::get_template_part($slug, $name);
30 30
 	}
31 31
 }
32 32
 
33 33
 
34 34
 
35
-if ( ! function_exists( 'espresso_get_object_css_class' )) {
35
+if ( ! function_exists('espresso_get_object_css_class')) {
36 36
 	/**
37 37
 	 * espresso_get_object_css_class - attempts to generate a css class based on the type of EE object passed
38 38
 	 *
@@ -42,8 +42,8 @@  discard block
 block discarded – undo
42 42
 	 * @param  string $suffix added to the end of the generated class
43 43
 	 * @return string
44 44
 	 */
45
-	function espresso_get_object_css_class( $object = NULL, $prefix = '', $suffix = '' ) {
46
-		return EEH_Template::get_object_css_class( $object, $prefix, $suffix );
45
+	function espresso_get_object_css_class($object = NULL, $prefix = '', $suffix = '') {
46
+		return EEH_Template::get_object_css_class($object, $prefix, $suffix);
47 47
 	}
48 48
 }
49 49
 
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 	 * 	@return boolean
71 71
 	 */
72 72
 	public static function is_espresso_theme() {
73
-		return wp_get_theme()->get( 'TextDomain' ) == 'event_espresso' ? TRUE : FALSE;
73
+		return wp_get_theme()->get('TextDomain') == 'event_espresso' ? TRUE : FALSE;
74 74
 	}
75 75
 
76 76
 	/**
@@ -79,9 +79,9 @@  discard block
 block discarded – undo
79 79
 	 * 	@return void
80 80
 	 */
81 81
 	public static function load_espresso_theme_functions() {
82
-		if ( ! defined( 'EE_THEME_FUNCTIONS_LOADED' )) {
83
-			if ( is_readable( EE_PUBLIC . EE_Config::get_current_theme() . DS . 'functions.php' )) {
84
-				require_once( EE_PUBLIC . EE_Config::get_current_theme() . DS . 'functions.php' );
82
+		if ( ! defined('EE_THEME_FUNCTIONS_LOADED')) {
83
+			if (is_readable(EE_PUBLIC.EE_Config::get_current_theme().DS.'functions.php')) {
84
+				require_once(EE_PUBLIC.EE_Config::get_current_theme().DS.'functions.php');
85 85
 			}
86 86
 		}
87 87
 	}
@@ -93,17 +93,17 @@  discard block
 block discarded – undo
93 93
 	 * 	@return array
94 94
 	 */
95 95
 	public static function get_espresso_themes() {
96
-		if ( empty( EEH_Template::$_espresso_themes )) {
97
-			$espresso_themes =  glob( EE_PUBLIC . '*', GLOB_ONLYDIR );
98
-			if ( empty( $espresso_themes ) ) {
96
+		if (empty(EEH_Template::$_espresso_themes)) {
97
+			$espresso_themes = glob(EE_PUBLIC.'*', GLOB_ONLYDIR);
98
+			if (empty($espresso_themes)) {
99 99
 				return array();
100 100
 			}
101
-			if (( $key = array_search( 'global_assets', $espresso_themes )) !== FALSE ) {
102
-			    unset( $espresso_themes[ $key ] );
101
+			if (($key = array_search('global_assets', $espresso_themes)) !== FALSE) {
102
+			    unset($espresso_themes[$key]);
103 103
 			}
104 104
 			EEH_Template::$_espresso_themes = array();
105
-			foreach ( $espresso_themes as $espresso_theme ) {
106
-				EEH_Template::$_espresso_themes[ basename( $espresso_theme ) ] = $espresso_theme;
105
+			foreach ($espresso_themes as $espresso_theme) {
106
+				EEH_Template::$_espresso_themes[basename($espresso_theme)] = $espresso_theme;
107 107
 			}
108 108
 		}
109 109
 		return EEH_Template::$_espresso_themes;
@@ -122,16 +122,16 @@  discard block
 block discarded – undo
122 122
 	 * @param bool   $return_string
123 123
 	 * @return string        the html output for the formatted money value
124 124
 	 */
125
-	public static function get_template_part( $slug = NULL, $name = NULL, $template_args = array(), $return_string = FALSE  ) {
126
-		do_action( "get_template_part_{$slug}-{$name}", $slug, $name );
125
+	public static function get_template_part($slug = NULL, $name = NULL, $template_args = array(), $return_string = FALSE) {
126
+		do_action("get_template_part_{$slug}-{$name}", $slug, $name);
127 127
 		$templates = array();
128 128
 		$name = (string) $name;
129
-		if ( $name != '' ) {
129
+		if ($name != '') {
130 130
 			$templates[] = "{$slug}-{$name}.php";
131 131
 		}
132 132
 		// allow template parts to be turned off via something like: add_filter( 'FHEE__content_espresso_events_tickets_template__display_datetimes', '__return_false' );
133
-		if ( apply_filters( "FHEE__EEH_Template__get_template_part__display__{$slug}_{$name}", TRUE )) {
134
-			EEH_Template::locate_template( $templates, $template_args, TRUE, $return_string );
133
+		if (apply_filters("FHEE__EEH_Template__get_template_part__display__{$slug}_{$name}", TRUE)) {
134
+			EEH_Template::locate_template($templates, $template_args, TRUE, $return_string);
135 135
 		}
136 136
 	}
137 137
 
@@ -182,26 +182,26 @@  discard block
 block discarded – undo
182 182
 	 * 				Used in places where you don't actually load the template, you just want to know if there's a custom version of it.
183 183
 	 * @return mixed
184 184
 	 */
185
-	public static function locate_template( $templates = array(), $template_args = array(), $load = TRUE, $return_string = TRUE, $check_if_custom = FALSE ) {
185
+	public static function locate_template($templates = array(), $template_args = array(), $load = TRUE, $return_string = TRUE, $check_if_custom = FALSE) {
186 186
 		// first use WP locate_template to check for template in the current theme folder
187
-		$template_path = locate_template( $templates );
187
+		$template_path = locate_template($templates);
188 188
 
189
-		if ( $check_if_custom && !empty( $template_path ) )
189
+		if ($check_if_custom && ! empty($template_path))
190 190
 			return TRUE;
191 191
 
192 192
 		// not in the theme
193
-		if ( empty( $template_path )) {
193
+		if (empty($template_path)) {
194 194
 			// not even a template to look for ?
195
-			if ( empty( $templates )) {
195
+			if (empty($templates)) {
196 196
 				// get post_type
197
-				$post_type = EE_Registry::instance()->REQ->get( 'post_type' );
197
+				$post_type = EE_Registry::instance()->REQ->get('post_type');
198 198
 				// get array of EE Custom Post Types
199 199
 				$EE_CPTs = EE_Register_CPTs::get_CPTs();
200 200
 				// build template name based on request
201
-				if ( isset( $EE_CPTs[ $post_type ] )) {
202
-					$archive_or_single =  is_archive() ? 'archive' : '';
203
-					$archive_or_single =  is_single() ? 'single' : $archive_or_single;
204
-					$templates = $archive_or_single . '-' . $post_type . '.php';
201
+				if (isset($EE_CPTs[$post_type])) {
202
+					$archive_or_single = is_archive() ? 'archive' : '';
203
+					$archive_or_single = is_single() ? 'single' : $archive_or_single;
204
+					$templates = $archive_or_single.'-'.$post_type.'.php';
205 205
 				}
206 206
 			}
207 207
 			// currently active EE template theme
@@ -210,81 +210,81 @@  discard block
 block discarded – undo
210 210
 			// array of paths to folders that may contain templates
211 211
 			$template_folder_paths = array(
212 212
 				// first check the /wp-content/uploads/espresso/templates/(current EE theme)/  folder for an EE theme template file
213
-				EVENT_ESPRESSO_TEMPLATE_DIR . $current_theme,
213
+				EVENT_ESPRESSO_TEMPLATE_DIR.$current_theme,
214 214
 				// then in the root of the /wp-content/uploads/espresso/templates/ folder
215 215
 				EVENT_ESPRESSO_TEMPLATE_DIR
216 216
 			);
217 217
 
218 218
 			//add core plugin folders for checking only if we're not $check_if_custom
219
-			if ( ! $check_if_custom ) {
219
+			if ( ! $check_if_custom) {
220 220
 				$core_paths = array(
221 221
 					// in the  /wp-content/plugins/(EE4 folder)/public/(current EE theme)/ folder within the plugin
222
-					EE_PUBLIC . $current_theme,
222
+					EE_PUBLIC.$current_theme,
223 223
 					// in the  /wp-content/plugins/(EE4 folder)/core/templates/(current EE theme)/ folder within the plugin
224
-					EE_TEMPLATES . $current_theme,
224
+					EE_TEMPLATES.$current_theme,
225 225
 					// or maybe relative from the plugin root: /wp-content/plugins/(EE4 folder)/
226 226
 					EE_PLUGIN_DIR_PATH
227 227
 					);
228
-				$template_folder_paths = array_merge( $template_folder_paths, $core_paths );
228
+				$template_folder_paths = array_merge($template_folder_paths, $core_paths);
229 229
 			}
230 230
 
231 231
 			// now filter that array
232
-			$template_folder_paths = apply_filters( 'FHEE__EEH_Template__locate_template__template_folder_paths', $template_folder_paths );
233
-			$templates = is_array( $templates ) ? $templates : array( $templates );
234
-			$template_folder_paths = is_array( $template_folder_paths ) ? $template_folder_paths : array( $template_folder_paths );
232
+			$template_folder_paths = apply_filters('FHEE__EEH_Template__locate_template__template_folder_paths', $template_folder_paths);
233
+			$templates = is_array($templates) ? $templates : array($templates);
234
+			$template_folder_paths = is_array($template_folder_paths) ? $template_folder_paths : array($template_folder_paths);
235 235
 			// array to hold all possible template paths
236 236
 			$full_template_paths = array();
237 237
 
238 238
 			// loop through $templates
239
-			foreach ( $templates as $template ) {
239
+			foreach ($templates as $template) {
240 240
 				// normalize directory separators
241
-				$template = EEH_File::standardise_directory_separators( $template );
242
-				$file_name = basename( $template );
243
-				$template_path_minus_file_name = substr( $template, 0, ( strlen( $file_name ) * -1 ) );
241
+				$template = EEH_File::standardise_directory_separators($template);
242
+				$file_name = basename($template);
243
+				$template_path_minus_file_name = substr($template, 0, (strlen($file_name) * -1));
244 244
 				// while looping through all template folder paths
245
-				foreach ( $template_folder_paths as $template_folder_path ) {
245
+				foreach ($template_folder_paths as $template_folder_path) {
246 246
 					// normalize directory separators
247
-					$template_folder_path = EEH_File::standardise_directory_separators( $template_folder_path );
247
+					$template_folder_path = EEH_File::standardise_directory_separators($template_folder_path);
248 248
 					// determine if any common base path exists between the two paths
249 249
 					$common_base_path = EEH_Template::_find_common_base_path(
250
-						array( $template_folder_path, $template_path_minus_file_name )
250
+						array($template_folder_path, $template_path_minus_file_name)
251 251
 					);
252
-					if ( $common_base_path !== '' ) {
252
+					if ($common_base_path !== '') {
253 253
 						// both paths have a common base, so just tack the filename onto our search path
254
-						$resolved_path = EEH_File::end_with_directory_separator( $template_folder_path ) . $file_name;
254
+						$resolved_path = EEH_File::end_with_directory_separator($template_folder_path).$file_name;
255 255
 					} else {
256 256
 						// no common base path, so let's just concatenate
257
-						$resolved_path = EEH_File::end_with_directory_separator( $template_folder_path ) . $template;
257
+						$resolved_path = EEH_File::end_with_directory_separator($template_folder_path).$template;
258 258
 					}
259 259
 					// build up our template locations array by adding our resolved paths
260 260
 					$full_template_paths[] = $resolved_path;
261 261
 				}
262 262
 				// if $template is an absolute path, then we'll tack it onto the start of our array so that it gets searched first
263
-				array_unshift( $full_template_paths, $template );
263
+				array_unshift($full_template_paths, $template);
264 264
 				// path to the directory of the current theme: /wp-content/themes/(current WP theme)/
265
-				array_unshift( $full_template_paths, get_stylesheet_directory() . DS . $file_name );
265
+				array_unshift($full_template_paths, get_stylesheet_directory().DS.$file_name);
266 266
 			}
267 267
 			// filter final array of full template paths
268
-			$full_template_paths = apply_filters( 'FHEE__EEH_Template__locate_template__full_template_paths', $full_template_paths, $file_name );
268
+			$full_template_paths = apply_filters('FHEE__EEH_Template__locate_template__full_template_paths', $full_template_paths, $file_name);
269 269
 			// now loop through our final array of template location paths and check each location
270
-			foreach ( (array)$full_template_paths as $full_template_path ) {
271
-				if ( is_readable( $full_template_path )) {
272
-					$template_path = str_replace( array( '\\', '/' ), DIRECTORY_SEPARATOR, $full_template_path );
270
+			foreach ((array) $full_template_paths as $full_template_path) {
271
+				if (is_readable($full_template_path)) {
272
+					$template_path = str_replace(array('\\', '/'), DIRECTORY_SEPARATOR, $full_template_path);
273 273
 					// hook that can be used to display the full template path that will be used
274
-					do_action( 'AHEE__EEH_Template__locate_template__full_template_path', $template_path );
274
+					do_action('AHEE__EEH_Template__locate_template__full_template_path', $template_path);
275 275
 					break;
276 276
 				}
277 277
 			}
278 278
 		}
279 279
 		// if we got it and you want to see it...
280
-		if ( $template_path && $load && ! $check_if_custom  ) {
281
-			if ( $return_string ) {
282
-				return EEH_Template::display_template( $template_path, $template_args, TRUE );
280
+		if ($template_path && $load && ! $check_if_custom) {
281
+			if ($return_string) {
282
+				return EEH_Template::display_template($template_path, $template_args, TRUE);
283 283
 			} else {
284
-				EEH_Template::display_template( $template_path, $template_args, FALSE );
284
+				EEH_Template::display_template($template_path, $template_args, FALSE);
285 285
 			}
286 286
 		}
287
-		return $check_if_custom && ! empty( $template_path ) ? TRUE : $template_path;
287
+		return $check_if_custom && ! empty($template_path) ? TRUE : $template_path;
288 288
 	}
289 289
 
290 290
 
@@ -297,21 +297,21 @@  discard block
 block discarded – undo
297 297
 	 * @param array $paths
298 298
 	 * @return string
299 299
 	 */
300
-	protected static function _find_common_base_path( $paths ) {
300
+	protected static function _find_common_base_path($paths) {
301 301
 		$last_offset = 0;
302 302
 		$common_base_path = '';
303
-		while ( ( $index = strpos( $paths[ 0 ], DS, $last_offset ) ) !== false ) {
303
+		while (($index = strpos($paths[0], DS, $last_offset)) !== false) {
304 304
 			$dir_length = $index - $last_offset + 1;
305
-			$directory = substr( $paths[ 0 ], $last_offset, $dir_length );
306
-			foreach ( $paths as $path ) {
307
-				if ( substr( $path, $last_offset, $dir_length ) != $directory ) {
305
+			$directory = substr($paths[0], $last_offset, $dir_length);
306
+			foreach ($paths as $path) {
307
+				if (substr($path, $last_offset, $dir_length) != $directory) {
308 308
 					return $common_base_path;
309 309
 				}
310 310
 			}
311 311
 			$common_base_path .= $directory;
312 312
 			$last_offset = $index + 1;
313 313
 		}
314
-		return substr( $common_base_path, 0, -1 );
314
+		return substr($common_base_path, 0, -1);
315 315
 	}
316 316
 
317 317
 
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
 	 * @param  boolean    $return_string whether to send output immediately to screen, or capture and return as a string
324 324
 	 * @return mixed string
325 325
 	 */
326
-	public static function display_template( $template_path = FALSE, $template_args = array(), $return_string = FALSE ) {
326
+	public static function display_template($template_path = FALSE, $template_args = array(), $return_string = FALSE) {
327 327
 
328 328
 		/**
329 329
 		 * These two filters are intended for last minute changes to templates being loaded and/or template arg
@@ -334,26 +334,26 @@  discard block
 block discarded – undo
334 334
 		 *
335 335
 		 * @since 4.6.0
336 336
 		 */
337
-		$template_path = apply_filters( 'FHEE__EEH_Template__display_template__template_path', $template_path );
338
-		$template_args = apply_filters( 'FHEE__EEH_Template__display_template__template_args', $template_args );
337
+		$template_path = apply_filters('FHEE__EEH_Template__display_template__template_path', $template_path);
338
+		$template_args = apply_filters('FHEE__EEH_Template__display_template__template_args', $template_args);
339 339
 
340 340
 		// you gimme nuttin - YOU GET NUTTIN !!
341
-		if ( ! $template_path || ! is_readable( $template_path )) {
341
+		if ( ! $template_path || ! is_readable($template_path)) {
342 342
 			return '';
343 343
 		}
344 344
 		// if $template_args are not in an array, then make it so
345
-		if ( ! is_array( $template_args ) && ! is_object( $template_args )) {
346
-			$template_args = array( $template_args );
345
+		if ( ! is_array($template_args) && ! is_object($template_args)) {
346
+			$template_args = array($template_args);
347 347
 		}
348
-		extract( (array) $template_args);
348
+		extract((array) $template_args);
349 349
 
350
-		if ( $return_string ) {
350
+		if ($return_string) {
351 351
 			// because we want to return a string, we are going to capture the output
352 352
 			ob_start();
353
-			include( $template_path );
353
+			include($template_path);
354 354
 			return ob_get_clean();
355 355
 		} else {
356
-			include( $template_path );
356
+			include($template_path);
357 357
 		}
358 358
 		return '';
359 359
 	}
@@ -371,27 +371,27 @@  discard block
 block discarded – undo
371 371
 	 * @param  string $suffix added to the end of the generated class
372 372
 	 * @return string
373 373
 	 */
374
-	public static function get_object_css_class( $object = NULL, $prefix = '', $suffix = '' ) {
374
+	public static function get_object_css_class($object = NULL, $prefix = '', $suffix = '') {
375 375
 		// in the beginning...
376
-		$prefix = ! empty( $prefix ) ? rtrim( $prefix, '-' ) . '-' : '';
376
+		$prefix = ! empty($prefix) ? rtrim($prefix, '-').'-' : '';
377 377
 		// da muddle
378 378
 		$class = '';
379 379
 		// the end
380
-		$suffix = ! empty( $suffix ) ? '-' . ltrim( $suffix, '-' ) : '';
380
+		$suffix = ! empty($suffix) ? '-'.ltrim($suffix, '-') : '';
381 381
 		// is the passed object an EE object ?
382
-		if ( $object instanceof EE_Base_Class ) {
382
+		if ($object instanceof EE_Base_Class) {
383 383
 			// grab the exact type of object
384
-			$obj_class = get_class( $object );
384
+			$obj_class = get_class($object);
385 385
 			// depending on the type of object...
386
-			switch ( $obj_class ) {
386
+			switch ($obj_class) {
387 387
 				// no specifics just yet...
388 388
 				default :
389
-					$class = strtolower( str_replace( '_', '-', $obj_class ));
390
-					$class .= method_exists( $obj_class, 'name' ) ? '-' . sanitize_title( $object->name() ) : '';
389
+					$class = strtolower(str_replace('_', '-', $obj_class));
390
+					$class .= method_exists($obj_class, 'name') ? '-'.sanitize_title($object->name()) : '';
391 391
 
392 392
 			}
393 393
 		}
394
-		return $prefix . $class . $suffix;
394
+		return $prefix.$class.$suffix;
395 395
 	}
396 396
 
397 397
 
@@ -407,54 +407,54 @@  discard block
 block discarded – undo
407 407
 	 * @param string      $cur_code_span_class
408 408
 	 * @return string        the html output for the formatted money value
409 409
 	 */
410
-	public static function format_currency( $amount = NULL, $return_raw = FALSE, $display_code = TRUE, $CNT_ISO = '', $cur_code_span_class = 'currency-code' ) {
410
+	public static function format_currency($amount = NULL, $return_raw = FALSE, $display_code = TRUE, $CNT_ISO = '', $cur_code_span_class = 'currency-code') {
411 411
 		// ensure amount was received
412
-		if ( is_null( $amount ) ) {
413
-			$msg = __( 'In order to format currency, an amount needs to be passed.', 'event_espresso' );
414
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
412
+		if (is_null($amount)) {
413
+			$msg = __('In order to format currency, an amount needs to be passed.', 'event_espresso');
414
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
415 415
 			return '';
416 416
 		}
417 417
 		//ensure amount is float
418
-		$amount = apply_filters( 'FHEE__EEH_Template__format_currency__raw_amount', (float) $amount );
419
-		$CNT_ISO = apply_filters( 'FHEE__EEH_Template__format_currency__CNT_ISO', $CNT_ISO, $amount );
418
+		$amount = apply_filters('FHEE__EEH_Template__format_currency__raw_amount', (float) $amount);
419
+		$CNT_ISO = apply_filters('FHEE__EEH_Template__format_currency__CNT_ISO', $CNT_ISO, $amount);
420 420
 		// filter raw amount (allows 0.00 to be changed to "free" for example)
421
-		$amount_formatted = apply_filters( 'FHEE__EEH_Template__format_currency__amount', $amount, $return_raw );
421
+		$amount_formatted = apply_filters('FHEE__EEH_Template__format_currency__amount', $amount, $return_raw);
422 422
 		// still a number or was amount converted to a string like "free" ?
423
-		if ( is_float( $amount_formatted )) {
423
+		if (is_float($amount_formatted)) {
424 424
 			// was a country ISO code passed ? if so generate currency config object for that country
425
-			$mny = $CNT_ISO !== '' ? new EE_Currency_Config( $CNT_ISO ) : NULL;
425
+			$mny = $CNT_ISO !== '' ? new EE_Currency_Config($CNT_ISO) : NULL;
426 426
 			// verify results
427
-			if ( ! $mny instanceof EE_Currency_Config ) {
427
+			if ( ! $mny instanceof EE_Currency_Config) {
428 428
 				// set default config country currency settings
429 429
 				$mny = EE_Registry::instance()->CFG->currency instanceof EE_Currency_Config ? EE_Registry::instance()->CFG->currency : new EE_Currency_Config();
430 430
 			}
431 431
 			// format float
432
-			$amount_formatted = number_format( $amount, $mny->dec_plc, $mny->dec_mrk, $mny->thsnds );
432
+			$amount_formatted = number_format($amount, $mny->dec_plc, $mny->dec_mrk, $mny->thsnds);
433 433
 			// add formatting ?
434
-			if ( ! $return_raw ) {
434
+			if ( ! $return_raw) {
435 435
 				// add currency sign
436
-				if( $mny->sign_b4 ){
437
-					if( $amount >= 0 ){
438
-						$amount_formatted = $mny->sign . $amount_formatted;
439
-					}else{
440
-						$amount_formatted = '-' . $mny->sign . str_replace( '-', '', $amount_formatted );
436
+				if ($mny->sign_b4) {
437
+					if ($amount >= 0) {
438
+						$amount_formatted = $mny->sign.$amount_formatted;
439
+					} else {
440
+						$amount_formatted = '-'.$mny->sign.str_replace('-', '', $amount_formatted);
441 441
 					}
442 442
 
443
-				}else{
444
-					$amount_formatted =  $amount_formatted . $mny->sign;
443
+				} else {
444
+					$amount_formatted = $amount_formatted.$mny->sign;
445 445
 				}
446 446
 
447 447
 				// filter to allow global setting of display_code
448
-				$display_code = apply_filters( 'FHEE__EEH_Template__format_currency__display_code', $display_code );
448
+				$display_code = apply_filters('FHEE__EEH_Template__format_currency__display_code', $display_code);
449 449
 
450 450
 				// add currency code ?
451
-				$amount_formatted = $display_code ? $amount_formatted . ' <span class="' . $cur_code_span_class . '">(' . $mny->code . ')</span>' : $amount_formatted;
451
+				$amount_formatted = $display_code ? $amount_formatted.' <span class="'.$cur_code_span_class.'">('.$mny->code.')</span>' : $amount_formatted;
452 452
 			}
453 453
 			// filter results
454
-			$amount_formatted = apply_filters( 'FHEE__EEH_Template__format_currency__amount_formatted', $amount_formatted, $mny, $return_raw );
454
+			$amount_formatted = apply_filters('FHEE__EEH_Template__format_currency__amount_formatted', $amount_formatted, $mny, $return_raw);
455 455
 		}
456 456
 		// clean up vars
457
-		unset( $mny );
457
+		unset($mny);
458 458
 		// return formatted currency amount
459 459
 		return $amount_formatted;
460 460
 	}
@@ -469,11 +469,11 @@  discard block
 block discarded – undo
469 469
 	 * @param  string  $schema    'UPPER', 'lower', or 'Sentence'
470 470
 	 * @return string             The localized label for the status id.
471 471
 	 */
472
-	public static function pretty_status( $status_id, $plural = FALSE, $schema = 'upper' ) {
472
+	public static function pretty_status($status_id, $plural = FALSE, $schema = 'upper') {
473 473
 		/** @type EEM_Status $EEM_Status */
474
-		$EEM_Status = EE_Registry::instance()->load_model( 'Status' );
475
-		$status = $EEM_Status->localized_status( array( $status_id => __( 'unknown', 'event_espresso' )), $plural, $schema );
476
-		return $status[ $status_id ];
474
+		$EEM_Status = EE_Registry::instance()->load_model('Status');
475
+		$status = $EEM_Status->localized_status(array($status_id => __('unknown', 'event_espresso')), $plural, $schema);
476
+		return $status[$status_id];
477 477
 	}
478 478
 
479 479
 
@@ -488,21 +488,21 @@  discard block
 block discarded – undo
488 488
 	 * @param string  $title
489 489
 	 * @return string the html output for the button
490 490
 	 */
491
-	public static function get_button_or_link( $url, $label, $class = 'button-primary', $icon = '', $title = '' ) {
491
+	public static function get_button_or_link($url, $label, $class = 'button-primary', $icon = '', $title = '') {
492 492
 		$icon_html = '';
493
-		if ( ! empty( $icon ) ) {
494
-			$dashicons = preg_split( "(ee-icon |dashicons )", $icon );
495
-			$dashicons = array_filter( $dashicons );
496
-			$count = count( $dashicons );
493
+		if ( ! empty($icon)) {
494
+			$dashicons = preg_split("(ee-icon |dashicons )", $icon);
495
+			$dashicons = array_filter($dashicons);
496
+			$count = count($dashicons);
497 497
 			$icon_html .= $count > 1 ? '<span class="ee-composite-dashicon">' : '';
498
-			foreach ( $dashicons as $dashicon ) {
499
-				$type = strpos( $dashicon, 'ee-icon' ) !== false ? 'ee-icon ' : 'dashicons ';
500
-				$icon_html .= '<span class="' . $type . $dashicon . '"></span>';
498
+			foreach ($dashicons as $dashicon) {
499
+				$type = strpos($dashicon, 'ee-icon') !== false ? 'ee-icon ' : 'dashicons ';
500
+				$icon_html .= '<span class="'.$type.$dashicon.'"></span>';
501 501
 			}
502 502
 			$icon_html .= $count > 1 ? '</span>' : '';
503 503
 		}
504
-		$label = ! empty( $icon ) ? $icon_html . $label : $label;
505
-		$button = '<a id="' . sanitize_title_with_dashes($label) . '" href="' . $url . '" class="' . $class . '" title="' . $title . '">' . $label . '</a>';
504
+		$label = ! empty($icon) ? $icon_html.$label : $label;
505
+		$button = '<a id="'.sanitize_title_with_dashes($label).'" href="'.$url.'" class="'.$class.'" title="'.$title.'">'.$label.'</a>';
506 506
 		return $button;
507 507
 	}
508 508
 
@@ -519,21 +519,21 @@  discard block
 block discarded – undo
519 519
 	 * @param bool|string $help_text   (optional) send help text you want to use for the link if default not to be used
520 520
 	 * @return string              generated link
521 521
 	 */
522
-	public static function get_help_tab_link( $help_tab_id, $page = FALSE, $action = FALSE, $icon_style = FALSE, $help_text = FALSE ) {
522
+	public static function get_help_tab_link($help_tab_id, $page = FALSE, $action = FALSE, $icon_style = FALSE, $help_text = FALSE) {
523 523
 
524
-		if ( ! $page )
525
-			$page = isset( $_REQUEST['page'] ) && ! empty( $_REQUEST['page'] ) ? sanitize_key( $_REQUEST['page'] ) : $page;
524
+		if ( ! $page)
525
+			$page = isset($_REQUEST['page']) && ! empty($_REQUEST['page']) ? sanitize_key($_REQUEST['page']) : $page;
526 526
 
527
-		if ( ! $action )
528
-			$action = isset( $_REQUEST['action'] ) && ! empty( $_REQUEST['action'] ) ? sanitize_key( $_REQUEST['action'] ) : $action;
527
+		if ( ! $action)
528
+			$action = isset($_REQUEST['action']) && ! empty($_REQUEST['action']) ? sanitize_key($_REQUEST['action']) : $action;
529 529
 
530 530
 		$action = empty($action) ? 'default' : $action;
531 531
 
532 532
 
533
-		$help_tab_lnk = $page . '-' . $action . '-' . $help_tab_id;
534
-		$icon = !$icon_style ? ' dashicons-editor-help' : $icon_style;
535
-		$help_text = !$help_text ? '' : $help_text;
536
-		return '<a id="' . $help_tab_lnk . '" class="ee-clickable dashicons espresso-help-tab-lnk ee-icon-size-22' . $icon . '" title="' . esc_attr__('Click to open the \'Help\' tab for more information about this feature.', 'event_espresso') . '" > ' . $help_text . ' </a>';
533
+		$help_tab_lnk = $page.'-'.$action.'-'.$help_tab_id;
534
+		$icon = ! $icon_style ? ' dashicons-editor-help' : $icon_style;
535
+		$help_text = ! $help_text ? '' : $help_text;
536
+		return '<a id="'.$help_tab_lnk.'" class="ee-clickable dashicons espresso-help-tab-lnk ee-icon-size-22'.$icon.'" title="'.esc_attr__('Click to open the \'Help\' tab for more information about this feature.', 'event_espresso').'" > '.$help_text.' </a>';
537 537
 	}
538 538
 
539 539
 
@@ -545,31 +545,31 @@  discard block
 block discarded – undo
545 545
 	 * @param EE_Help_Tour
546 546
 	 * @return string         html
547 547
 	 */
548
-	public static function help_tour_stops_generator( EE_Help_Tour $tour ) {
548
+	public static function help_tour_stops_generator(EE_Help_Tour $tour) {
549 549
 		$id = $tour->get_slug();
550 550
 		$stops = $tour->get_stops();
551 551
 
552
-		$content = '<ol style="display:none" id="' . $id . '">';
552
+		$content = '<ol style="display:none" id="'.$id.'">';
553 553
 
554
-		foreach ( $stops as $stop ) {
555
-			$data_id = !empty( $stop['id'] ) ? ' data-id="' . $stop['id'] . '"' : '';
556
-			$data_class = empty( $data_id ) && !empty( $stop['class'] ) ? ' data-class="' . $stop['class'] . '"' : '';
554
+		foreach ($stops as $stop) {
555
+			$data_id = ! empty($stop['id']) ? ' data-id="'.$stop['id'].'"' : '';
556
+			$data_class = empty($data_id) && ! empty($stop['class']) ? ' data-class="'.$stop['class'].'"' : '';
557 557
 
558 558
 			//if container is set to modal then let's make sure we set the options accordingly
559
-			if ( empty( $data_id ) && empty( $data_class ) ) {
559
+			if (empty($data_id) && empty($data_class)) {
560 560
 				$stop['options']['modal'] = true;
561 561
 				$stop['options']['expose'] = true;
562 562
 			}
563 563
 
564
-			$custom_class = !empty( $stop['custom_class'] ) ? ' class="' . $stop['custom_class'] . '"' : '';
565
-			$button_text = !empty( $stop['button_text'] ) ? ' data-button="' . $stop['button_text'] . '"' : '';
564
+			$custom_class = ! empty($stop['custom_class']) ? ' class="'.$stop['custom_class'].'"' : '';
565
+			$button_text = ! empty($stop['button_text']) ? ' data-button="'.$stop['button_text'].'"' : '';
566 566
 			$inner_content = isset($stop['content']) ? $stop['content'] : '';
567 567
 
568 568
 			//options
569
-			if ( isset( $stop['options'] ) && is_array( $stop['options'] ) ) {
569
+			if (isset($stop['options']) && is_array($stop['options'])) {
570 570
 				$options = ' data-options="';
571
-				foreach ( $stop['options'] as $option => $value ) {
572
-					$options .= $option . ':' . $value . ';';
571
+				foreach ($stop['options'] as $option => $value) {
572
+					$options .= $option.':'.$value.';';
573 573
 				}
574 574
 				$options .= '"';
575 575
 			} else {
@@ -577,7 +577,7 @@  discard block
 block discarded – undo
577 577
 			}
578 578
 
579 579
 			//let's put all together
580
-			$content .= '<li' . $data_id . $data_class . $custom_class . $button_text . $options . '>' . $inner_content . '</li>';
580
+			$content .= '<li'.$data_id.$data_class.$custom_class.$button_text.$options.'>'.$inner_content.'</li>';
581 581
 		}
582 582
 
583 583
 		$content .= '</ol>';
@@ -598,31 +598,31 @@  discard block
 block discarded – undo
598 598
 	 * @throws EE_Error
599 599
 	 * @return string               html structure for status.
600 600
 	 */
601
-	public static function status_legend( $status_array, $active_status = '' ) {
602
-		if ( !is_array( $status_array ) )
603
-			throw new EE_Error( esc_html__('The EEH_Template::status_legend helper required the incoming status_array argument to be an array!', 'event_espresso') );
601
+	public static function status_legend($status_array, $active_status = '') {
602
+		if ( ! is_array($status_array))
603
+			throw new EE_Error(esc_html__('The EEH_Template::status_legend helper required the incoming status_array argument to be an array!', 'event_espresso'));
604 604
 
605 605
 		$setup_array = array();
606
-		foreach ( $status_array as $item => $status ) {
606
+		foreach ($status_array as $item => $status) {
607 607
 			$setup_array[$item] = array(
608
-					'class' => 'ee-status-legend ee-status-legend-' . $status,
609
-					'desc' => EEH_Template::pretty_status( $status, FALSE, 'sentence' ),
608
+					'class' => 'ee-status-legend ee-status-legend-'.$status,
609
+					'desc' => EEH_Template::pretty_status($status, FALSE, 'sentence'),
610 610
 					'status' => $status
611 611
 				);
612 612
 		}
613 613
 
614
-		$content = '<div class="ee-list-table-legend-container">' . "\n";
615
-		$content .= '<h4 class="status-legend-title">' . esc_html__('Status Legend', 'event_espresso') . '</h4>' . "\n";
616
-		$content .= '<dl class="ee-list-table-legend">' . "\n\t";
617
-		foreach ( $setup_array as $item => $details ) {
614
+		$content = '<div class="ee-list-table-legend-container">'."\n";
615
+		$content .= '<h4 class="status-legend-title">'.esc_html__('Status Legend', 'event_espresso').'</h4>'."\n";
616
+		$content .= '<dl class="ee-list-table-legend">'."\n\t";
617
+		foreach ($setup_array as $item => $details) {
618 618
 			$active_class = $active_status == $details['status'] ? ' class="ee-is-active-status"' : '';
619
-			$content .= '<dt id="ee-legend-item-tooltip-' . $item . '"' . $active_class . '>' . "\n\t\t";
620
-			$content .= '<span class="' . $details['class'] . '"></span>' . "\n\t\t";
621
-			$content .= '<span class="ee-legend-description">' . $details['desc'] . '</span>' . "\n\t";
622
-			$content .= '</dt>' . "\n";
619
+			$content .= '<dt id="ee-legend-item-tooltip-'.$item.'"'.$active_class.'>'."\n\t\t";
620
+			$content .= '<span class="'.$details['class'].'"></span>'."\n\t\t";
621
+			$content .= '<span class="ee-legend-description">'.$details['desc'].'</span>'."\n\t";
622
+			$content .= '</dt>'."\n";
623 623
 		}
624
-		$content .= '</dl>' . "\n";
625
-		$content .= '</div>' . "\n";
624
+		$content .= '</dl>'."\n";
625
+		$content .= '</div>'."\n";
626 626
 		return $content;
627 627
 	}
628 628
 
@@ -635,8 +635,8 @@  discard block
 block discarded – undo
635 635
 	 * @return string
636 636
 	 */
637 637
 	public static function layout_array_as_table($data) {
638
-	if (is_object($data) || $data instanceof __PHP_Incomplete_Class ) {
639
-		$data = (array)$data;
638
+	if (is_object($data) || $data instanceof __PHP_Incomplete_Class) {
639
+		$data = (array) $data;
640 640
 	}
641 641
 	ob_start();
642 642
 	if (is_array($data)) {
@@ -649,10 +649,10 @@  discard block
 block discarded – undo
649 649
 						?>
650 650
 						<tr>
651 651
 							<td>
652
-								<?php echo $data_key;?>
652
+								<?php echo $data_key; ?>
653 653
 							</td>
654 654
 							<td>
655
-								<?php echo self::layout_array_as_table($data_values);?>
655
+								<?php echo self::layout_array_as_table($data_values); ?>
656 656
 							</td>
657 657
 						</tr>
658 658
 						<?php
@@ -666,7 +666,7 @@  discard block
 block discarded – undo
666 666
 			<ul>
667 667
 				<?php
668 668
 				foreach ($data as $datum) {
669
-					echo "<li>"; echo self::layout_array_as_table($datum);echo "</li>";
669
+					echo "<li>"; echo self::layout_array_as_table($datum); echo "</li>";
670 670
 				}?>
671 671
 			</ul>
672 672
 			<?php
@@ -696,8 +696,8 @@  discard block
 block discarded – undo
696 696
 	 *
697 697
 	 * @return string
698 698
 	 */
699
-	public static function paging_html( $total_items, $current, $per_page, $url, $show_num_field = TRUE, $paged_arg_name = 'paged', $items_label = array() ) {
700
-		echo self::get_paging_html( $total_items, $current, $per_page, $url, $show_num_field, $paged_arg_name, $items_label );
699
+	public static function paging_html($total_items, $current, $per_page, $url, $show_num_field = TRUE, $paged_arg_name = 'paged', $items_label = array()) {
700
+		echo self::get_paging_html($total_items, $current, $per_page, $url, $show_num_field, $paged_arg_name, $items_label);
701 701
 	}
702 702
 
703 703
 
@@ -721,13 +721,13 @@  discard block
 block discarded – undo
721 721
 	 *                                 )
722 722
 	 * @return  string
723 723
 	 */
724
-	public static function get_paging_html( $total_items, $current, $per_page, $url, $show_num_field = TRUE, $paged_arg_name = 'paged', $items_label = array() ) {
724
+	public static function get_paging_html($total_items, $current, $per_page, $url, $show_num_field = TRUE, $paged_arg_name = 'paged', $items_label = array()) {
725 725
 		$page_links = array();
726 726
 		$disable_first = $disable_last = '';
727 727
 		$total_items = (int) $total_items;
728 728
 		$per_page = (int) $per_page;
729 729
 		$current = (int) $current;
730
-		$paged_arg_name = empty( $paged_arg_name ) ? 'paged' : sanitize_key( $paged_arg_name );
730
+		$paged_arg_name = empty($paged_arg_name) ? 'paged' : sanitize_key($paged_arg_name);
731 731
 
732 732
 		//filter items_label
733 733
 		$items_label = apply_filters(
@@ -735,68 +735,68 @@  discard block
 block discarded – undo
735 735
 			$items_label
736 736
 		);
737 737
 
738
-		if ( empty( $items_label )
739
-		     || ! is_array( $items_label )
740
-		     || ! isset( $items_label['single'] )
741
-		     || ! isset( $items_label['plural'] ) ) {
738
+		if (empty($items_label)
739
+		     || ! is_array($items_label)
740
+		     || ! isset($items_label['single'])
741
+		     || ! isset($items_label['plural'])) {
742 742
 			$items_label = array(
743
-				'single' => __( '1 item', 'event_espresso' ),
744
-				'plural' => __( '%s items', 'event_espresso' )
743
+				'single' => __('1 item', 'event_espresso'),
744
+				'plural' => __('%s items', 'event_espresso')
745 745
 			);
746 746
 		} else {
747 747
 			$items_label = array(
748
-				'single' => '1 ' . esc_html( $items_label['single'] ),
749
-				'plural' => '%s ' . esc_html( $items_label['plural'] )
748
+				'single' => '1 '.esc_html($items_label['single']),
749
+				'plural' => '%s '.esc_html($items_label['plural'])
750 750
 			);
751 751
 		}
752 752
 
753
-		$total_pages = ceil( $total_items / $per_page );
753
+		$total_pages = ceil($total_items / $per_page);
754 754
 
755
-		if ( $total_pages <= 1 )
755
+		if ($total_pages <= 1)
756 756
 			return '';
757 757
 
758
-		$item_label = $total_items > 1 ? sprintf( $items_label['plural'], $total_items ) : $items_label['single'];
758
+		$item_label = $total_items > 1 ? sprintf($items_label['plural'], $total_items) : $items_label['single'];
759 759
 
760
-		$output = '<span class="displaying-num">' . $item_label . '</span>';
760
+		$output = '<span class="displaying-num">'.$item_label.'</span>';
761 761
 
762
-		if ( $current === 1 ) {
762
+		if ($current === 1) {
763 763
 			$disable_first = ' disabled';
764 764
 		}
765
-		if ( $current == $total_pages ) {
765
+		if ($current == $total_pages) {
766 766
 			$disable_last = ' disabled';
767 767
 		}
768 768
 
769
-		$page_links[] = sprintf( "<a class='%s' title='%s' href='%s'>%s</a>",
770
-			'first-page' . $disable_first,
771
-			esc_attr__( 'Go to the first page' ),
772
-			esc_url( remove_query_arg( $paged_arg_name, $url ) ),
769
+		$page_links[] = sprintf("<a class='%s' title='%s' href='%s'>%s</a>",
770
+			'first-page'.$disable_first,
771
+			esc_attr__('Go to the first page'),
772
+			esc_url(remove_query_arg($paged_arg_name, $url)),
773 773
 			'&laquo;'
774 774
 		);
775 775
 
776 776
 		$page_links[] = sprintf(
777 777
 			'<a class="%s" title="%s" href="%s">%s</a>',
778
-			'prev-page' . $disable_first,
779
-			esc_attr__( 'Go to the previous page' ),
780
-			esc_url( add_query_arg( $paged_arg_name, max( 1, $current-1 ), $url ) ),
778
+			'prev-page'.$disable_first,
779
+			esc_attr__('Go to the previous page'),
780
+			esc_url(add_query_arg($paged_arg_name, max(1, $current - 1), $url)),
781 781
 			'&lsaquo;'
782 782
 		);
783 783
 
784
-		if ( ! $show_num_field ) {
784
+		if ( ! $show_num_field) {
785 785
 			$html_current_page = $current;
786 786
 		} else {
787
-			$html_current_page = sprintf( "<input class='current-page' title='%s' type='text' name=$paged_arg_name value='%s' size='%d' />",
788
-				esc_attr__( 'Current page' ),
787
+			$html_current_page = sprintf("<input class='current-page' title='%s' type='text' name=$paged_arg_name value='%s' size='%d' />",
788
+				esc_attr__('Current page'),
789 789
 				$current,
790
-				strlen( $total_pages )
790
+				strlen($total_pages)
791 791
 			);
792 792
 		}
793 793
 
794 794
 		$html_total_pages = sprintf(
795 795
 			'<span class="total-pages">%s</span>',
796
-			number_format_i18n( $total_pages )
796
+			number_format_i18n($total_pages)
797 797
 		);
798 798
 		$page_links[] = sprintf(
799
-			_x( '%3$s%1$s of %2$s%4$s', 'paging' ),
799
+			_x('%3$s%1$s of %2$s%4$s', 'paging'),
800 800
 			$html_current_page,
801 801
 			$html_total_pages,
802 802
 			'<span class="paging-input">',
@@ -805,29 +805,29 @@  discard block
 block discarded – undo
805 805
 
806 806
 		$page_links[] = sprintf(
807 807
 			'<a class="%s" title="%s" href="%s">%s</a>',
808
-			'next-page' . $disable_last,
809
-			esc_attr__( 'Go to the next page' ),
810
-			esc_url( add_query_arg( $paged_arg_name, min( $total_pages, $current+1 ), $url ) ),
808
+			'next-page'.$disable_last,
809
+			esc_attr__('Go to the next page'),
810
+			esc_url(add_query_arg($paged_arg_name, min($total_pages, $current + 1), $url)),
811 811
 			'&rsaquo;'
812 812
 		);
813 813
 
814 814
 		$page_links[] = sprintf(
815 815
 			'<a class="%s" title="%s" href="%s">%s</a>',
816
-			'last-page' . $disable_last,
817
-			esc_attr__( 'Go to the last page' ),
818
-			esc_url( add_query_arg( $paged_arg_name, $total_pages, $url ) ),
816
+			'last-page'.$disable_last,
817
+			esc_attr__('Go to the last page'),
818
+			esc_url(add_query_arg($paged_arg_name, $total_pages, $url)),
819 819
 			'&raquo;'
820 820
 		);
821 821
 
822
-		$output .= "\n" . '<span class="pagination-links">' . join( "\n", $page_links ) . '</span>';
822
+		$output .= "\n".'<span class="pagination-links">'.join("\n", $page_links).'</span>';
823 823
 		// set page class
824
-		if ( $total_pages ) {
824
+		if ($total_pages) {
825 825
 			$page_class = $total_pages < 2 ? ' one-page' : '';
826 826
 		} else {
827 827
 			$page_class = ' no-pages';
828 828
 		}
829 829
 
830
-		return '<div class="tablenav"><div class="tablenav-pages' . $page_class . '">' . $output . '</div></div>';
830
+		return '<div class="tablenav"><div class="tablenav-pages'.$page_class.'">'.$output.'</div></div>';
831 831
 	}
832 832
 
833 833
 
@@ -837,8 +837,8 @@  discard block
 block discarded – undo
837 837
 	 * @param string $wrap_id
838 838
 	 * @return string
839 839
 	 */
840
-	public static function powered_by_event_espresso( $wrap_class = '', $wrap_id = '', array $query_args = array() ) {
841
-		$admin = is_admin() && ! ( defined( 'DOING_AJAX' ) && DOING_AJAX );
840
+	public static function powered_by_event_espresso($wrap_class = '', $wrap_id = '', array $query_args = array()) {
841
+		$admin = is_admin() && ! (defined('DOING_AJAX') && DOING_AJAX);
842 842
 		if (
843 843
 			! $admin &&
844 844
 			! apply_filters(
@@ -849,9 +849,9 @@  discard block
 block discarded – undo
849 849
 			return '';
850 850
 		}
851 851
 		$tag = $admin ? 'span' : 'div';
852
-		$attributes = ! empty( $wrap_id ) ? " id=\"{$wrap_id}\"" : '';
852
+		$attributes = ! empty($wrap_id) ? " id=\"{$wrap_id}\"" : '';
853 853
 		$wrap_class = $admin ? "{$wrap_class} float-left" : $wrap_class;
854
-		$attributes .= ! empty( $wrap_class )
854
+		$attributes .= ! empty($wrap_class)
855 855
 			? " class=\"{$wrap_class} powered-by-event-espresso-credit\""
856 856
 			: ' class="powered-by-event-espresso-credit"';
857 857
 		$query_args = array_merge(
@@ -863,9 +863,9 @@  discard block
 block discarded – undo
863 863
 			),
864 864
 			$query_args
865 865
 		);
866
-		$powered_by = apply_filters( 'FHEE__EEH_Template__powered_by_event_espresso_text', $admin ? 'Event Espresso - ' . EVENT_ESPRESSO_VERSION : 'Event Espresso' );
867
-		$url = add_query_arg( $query_args, 'https://eventespresso.com/' );
868
-		$url = apply_filters( 'FHEE__EEH_Template__powered_by_event_espresso__url', $url );
866
+		$powered_by = apply_filters('FHEE__EEH_Template__powered_by_event_espresso_text', $admin ? 'Event Espresso - '.EVENT_ESPRESSO_VERSION : 'Event Espresso');
867
+		$url = add_query_arg($query_args, 'https://eventespresso.com/');
868
+		$url = apply_filters('FHEE__EEH_Template__powered_by_event_espresso__url', $url);
869 869
 		return (string) apply_filters(
870 870
 			'FHEE__EEH_Template__powered_by_event_espresso__html',
871 871
 			sprintf(
@@ -897,7 +897,7 @@  discard block
 block discarded – undo
897 897
 //add_filter( 'FHEE__EEH_Template__format_currency__amount', 'convert_zero_to_free', 10, 2 );
898 898
 
899 899
 
900
-if ( ! function_exists( 'espresso_pagination' ) ) {
900
+if ( ! function_exists('espresso_pagination')) {
901 901
 	/**
902 902
 	 *    espresso_pagination
903 903
 	 *
@@ -909,21 +909,21 @@  discard block
 block discarded – undo
909 909
 		$big = 999999999; // need an unlikely integer
910 910
 		$pagination = paginate_links(
911 911
 		array(
912
-		'base'         => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),
912
+		'base'         => str_replace($big, '%#%', esc_url(get_pagenum_link($big))),
913 913
 		'format'       => '?paged=%#%',
914
-		'current'      => max( 1, get_query_var( 'paged' ) ),
914
+		'current'      => max(1, get_query_var('paged')),
915 915
 		'total'        => $wp_query->max_num_pages,
916 916
 		'show_all'     => true,
917 917
 		'end_size'     => 10,
918 918
 		'mid_size'     => 6,
919 919
 		'prev_next'    => true,
920
-		'prev_text'    => __( '&lsaquo; PREV', 'event_espresso' ),
921
-		'next_text'    => __( 'NEXT &rsaquo;', 'event_espresso' ),
920
+		'prev_text'    => __('&lsaquo; PREV', 'event_espresso'),
921
+		'next_text'    => __('NEXT &rsaquo;', 'event_espresso'),
922 922
 		'type'         => 'plain',
923 923
 		'add_args'     => false,
924 924
 		'add_fragment' => ''
925 925
 		)
926 926
 		);
927
-		echo ! empty( $pagination ) ? '<div class="ee-pagination-dv clear">' . $pagination . '</div>' : '';
927
+		echo ! empty($pagination) ? '<div class="ee-pagination-dv clear">'.$pagination.'</div>' : '';
928 928
 	}
929 929
 }
930 930
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +19 added lines, -16 removed lines patch added patch discarded remove patch
@@ -186,8 +186,9 @@  discard block
 block discarded – undo
186 186
 		// first use WP locate_template to check for template in the current theme folder
187 187
 		$template_path = locate_template( $templates );
188 188
 
189
-		if ( $check_if_custom && !empty( $template_path ) )
190
-			return TRUE;
189
+		if ( $check_if_custom && !empty( $template_path ) ) {
190
+					return TRUE;
191
+		}
191 192
 
192 193
 		// not in the theme
193 194
 		if ( empty( $template_path )) {
@@ -436,11 +437,11 @@  discard block
 block discarded – undo
436 437
 				if( $mny->sign_b4 ){
437 438
 					if( $amount >= 0 ){
438 439
 						$amount_formatted = $mny->sign . $amount_formatted;
439
-					}else{
440
+					} else{
440 441
 						$amount_formatted = '-' . $mny->sign . str_replace( '-', '', $amount_formatted );
441 442
 					}
442 443
 
443
-				}else{
444
+				} else{
444 445
 					$amount_formatted =  $amount_formatted . $mny->sign;
445 446
 				}
446 447
 
@@ -521,11 +522,13 @@  discard block
 block discarded – undo
521 522
 	 */
522 523
 	public static function get_help_tab_link( $help_tab_id, $page = FALSE, $action = FALSE, $icon_style = FALSE, $help_text = FALSE ) {
523 524
 
524
-		if ( ! $page )
525
-			$page = isset( $_REQUEST['page'] ) && ! empty( $_REQUEST['page'] ) ? sanitize_key( $_REQUEST['page'] ) : $page;
525
+		if ( ! $page ) {
526
+					$page = isset( $_REQUEST['page'] ) && ! empty( $_REQUEST['page'] ) ? sanitize_key( $_REQUEST['page'] ) : $page;
527
+		}
526 528
 
527
-		if ( ! $action )
528
-			$action = isset( $_REQUEST['action'] ) && ! empty( $_REQUEST['action'] ) ? sanitize_key( $_REQUEST['action'] ) : $action;
529
+		if ( ! $action ) {
530
+					$action = isset( $_REQUEST['action'] ) && ! empty( $_REQUEST['action'] ) ? sanitize_key( $_REQUEST['action'] ) : $action;
531
+		}
529 532
 
530 533
 		$action = empty($action) ? 'default' : $action;
531 534
 
@@ -599,8 +602,9 @@  discard block
 block discarded – undo
599 602
 	 * @return string               html structure for status.
600 603
 	 */
601 604
 	public static function status_legend( $status_array, $active_status = '' ) {
602
-		if ( !is_array( $status_array ) )
603
-			throw new EE_Error( esc_html__('The EEH_Template::status_legend helper required the incoming status_array argument to be an array!', 'event_espresso') );
605
+		if ( !is_array( $status_array ) ) {
606
+					throw new EE_Error( esc_html__('The EEH_Template::status_legend helper required the incoming status_array argument to be an array!', 'event_espresso') );
607
+		}
604 608
 
605 609
 		$setup_array = array();
606 610
 		foreach ( $status_array as $item => $status ) {
@@ -660,8 +664,7 @@  discard block
 block discarded – undo
660 664
 				</tbody>
661 665
 			</table>
662 666
 			<?php
663
-		}
664
-		else {
667
+		} else {
665 668
 			?>
666 669
 			<ul>
667 670
 				<?php
@@ -671,8 +674,7 @@  discard block
 block discarded – undo
671 674
 			</ul>
672 675
 			<?php
673 676
 		}
674
-	}
675
-	else {
677
+	} else {
676 678
 		//simple value
677 679
 		echo $data;
678 680
 	}
@@ -752,8 +754,9 @@  discard block
 block discarded – undo
752 754
 
753 755
 		$total_pages = ceil( $total_items / $per_page );
754 756
 
755
-		if ( $total_pages <= 1 )
756
-			return '';
757
+		if ( $total_pages <= 1 ) {
758
+					return '';
759
+		}
757 760
 
758 761
 		$item_label = $total_items > 1 ? sprintf( $items_label['plural'], $total_items ) : $items_label['single'];
759 762
 
Please login to merge, or discard this patch.
espresso.php 1 patch
Spacing   +92 added lines, -92 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1
-<?php if ( ! defined( 'ABSPATH' ) ) {
2
-	exit( 'No direct script access allowed' );
1
+<?php if ( ! defined('ABSPATH')) {
2
+	exit('No direct script access allowed');
3 3
 }
4 4
 /*
5 5
   Plugin Name:		Event Espresso
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
  *
43 43
  */
44 44
 
45
-if ( function_exists( 'espresso_version' ) ) {
45
+if (function_exists('espresso_version')) {
46 46
 
47 47
 	/**
48 48
 	 *    espresso_duplicate_plugin_error
@@ -51,12 +51,12 @@  discard block
 block discarded – undo
51 51
 	function espresso_duplicate_plugin_error() {
52 52
 		?>
53 53
 		<div class="error">
54
-			<p><?php _e( 'Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.', 'event_espresso' ); ?></p>
54
+			<p><?php _e('Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.', 'event_espresso'); ?></p>
55 55
 		</div>
56 56
 		<?php
57
-		espresso_deactivate_plugin( plugin_basename( __FILE__ ) );
57
+		espresso_deactivate_plugin(plugin_basename(__FILE__));
58 58
 	}
59
-	add_action( 'admin_notices', 'espresso_duplicate_plugin_error', 1 );
59
+	add_action('admin_notices', 'espresso_duplicate_plugin_error', 1);
60 60
 
61 61
 } else {
62 62
 
@@ -67,102 +67,102 @@  discard block
 block discarded – undo
67 67
 	 * @return string
68 68
 	 */
69 69
 	function espresso_version() {
70
-		return apply_filters( 'FHEE__espresso__espresso_version', '4.9.17.rc.026' );
70
+		return apply_filters('FHEE__espresso__espresso_version', '4.9.17.rc.026');
71 71
 	}
72 72
 
73 73
 	// define versions
74
-	define( 'EVENT_ESPRESSO_VERSION', espresso_version() );
75
-	define( 'EE_MIN_WP_VER_REQUIRED', '4.1' );
76
-	define( 'EE_MIN_WP_VER_RECOMMENDED', '4.4.2' );
77
-	define( 'EE_MIN_PHP_VER_REQUIRED', '5.3.0' );
78
-	define( 'EE_MIN_PHP_VER_RECOMMENDED', '5.4.44' );
79
-	define( 'EVENT_ESPRESSO_MAIN_FILE', __FILE__ );
74
+	define('EVENT_ESPRESSO_VERSION', espresso_version());
75
+	define('EE_MIN_WP_VER_REQUIRED', '4.1');
76
+	define('EE_MIN_WP_VER_RECOMMENDED', '4.4.2');
77
+	define('EE_MIN_PHP_VER_REQUIRED', '5.3.0');
78
+	define('EE_MIN_PHP_VER_RECOMMENDED', '5.4.44');
79
+	define('EVENT_ESPRESSO_MAIN_FILE', __FILE__);
80 80
 	//used to be DIRECTORY_SEPARATOR, but that caused issues on windows
81
-	if ( ! defined( 'DS' ) ) {
82
-		define( 'DS', '/' );
81
+	if ( ! defined('DS')) {
82
+		define('DS', '/');
83 83
 	}
84
-	if ( ! defined( 'PS' ) ) {
85
-		define( 'PS', PATH_SEPARATOR );
84
+	if ( ! defined('PS')) {
85
+		define('PS', PATH_SEPARATOR);
86 86
 	}
87
-	if ( ! defined( 'SP' ) ) {
88
-		define( 'SP', ' ' );
87
+	if ( ! defined('SP')) {
88
+		define('SP', ' ');
89 89
 	}
90
-	if ( ! defined( 'EENL' ) ) {
91
-		define( 'EENL', "\n" );
90
+	if ( ! defined('EENL')) {
91
+		define('EENL', "\n");
92 92
 	}
93
-	define( 'EE_SUPPORT_EMAIL', '[email protected]' );
93
+	define('EE_SUPPORT_EMAIL', '[email protected]');
94 94
 	// define the plugin directory and URL
95
-	define( 'EE_PLUGIN_BASENAME', plugin_basename( EVENT_ESPRESSO_MAIN_FILE ) );
96
-	define( 'EE_PLUGIN_DIR_PATH', plugin_dir_path( EVENT_ESPRESSO_MAIN_FILE ) );
97
-	define( 'EE_PLUGIN_DIR_URL', plugin_dir_url( EVENT_ESPRESSO_MAIN_FILE ) );
95
+	define('EE_PLUGIN_BASENAME', plugin_basename(EVENT_ESPRESSO_MAIN_FILE));
96
+	define('EE_PLUGIN_DIR_PATH', plugin_dir_path(EVENT_ESPRESSO_MAIN_FILE));
97
+	define('EE_PLUGIN_DIR_URL', plugin_dir_url(EVENT_ESPRESSO_MAIN_FILE));
98 98
 	// main root folder paths
99
-	define( 'EE_ADMIN_PAGES', EE_PLUGIN_DIR_PATH . 'admin_pages' . DS );
100
-	define( 'EE_CORE', EE_PLUGIN_DIR_PATH . 'core' . DS );
101
-	define( 'EE_MODULES', EE_PLUGIN_DIR_PATH . 'modules' . DS );
102
-	define( 'EE_PUBLIC', EE_PLUGIN_DIR_PATH . 'public' . DS );
103
-	define( 'EE_SHORTCODES', EE_PLUGIN_DIR_PATH . 'shortcodes' . DS );
104
-	define( 'EE_WIDGETS', EE_PLUGIN_DIR_PATH . 'widgets' . DS );
105
-	define( 'EE_PAYMENT_METHODS', EE_PLUGIN_DIR_PATH . 'payment_methods' . DS );
106
-	define( 'EE_CAFF_PATH', EE_PLUGIN_DIR_PATH . 'caffeinated' . DS );
99
+	define('EE_ADMIN_PAGES', EE_PLUGIN_DIR_PATH.'admin_pages'.DS);
100
+	define('EE_CORE', EE_PLUGIN_DIR_PATH.'core'.DS);
101
+	define('EE_MODULES', EE_PLUGIN_DIR_PATH.'modules'.DS);
102
+	define('EE_PUBLIC', EE_PLUGIN_DIR_PATH.'public'.DS);
103
+	define('EE_SHORTCODES', EE_PLUGIN_DIR_PATH.'shortcodes'.DS);
104
+	define('EE_WIDGETS', EE_PLUGIN_DIR_PATH.'widgets'.DS);
105
+	define('EE_PAYMENT_METHODS', EE_PLUGIN_DIR_PATH.'payment_methods'.DS);
106
+	define('EE_CAFF_PATH', EE_PLUGIN_DIR_PATH.'caffeinated'.DS);
107 107
 	// core system paths
108
-	define( 'EE_ADMIN', EE_CORE . 'admin' . DS );
109
-	define( 'EE_CPTS', EE_CORE . 'CPTs' . DS );
110
-	define( 'EE_CLASSES', EE_CORE . 'db_classes' . DS );
111
-	define( 'EE_INTERFACES', EE_CORE . 'interfaces' . DS );
112
-	define( 'EE_BUSINESS', EE_CORE . 'business' . DS );
113
-	define( 'EE_MODELS', EE_CORE . 'db_models' . DS );
114
-	define( 'EE_HELPERS', EE_CORE . 'helpers' . DS );
115
-	define( 'EE_LIBRARIES', EE_CORE . 'libraries' . DS );
116
-	define( 'EE_TEMPLATES', EE_CORE . 'templates' . DS );
117
-	define( 'EE_THIRD_PARTY', EE_CORE . 'third_party_libs' . DS );
118
-	define( 'EE_GLOBAL_ASSETS', EE_TEMPLATES . 'global_assets' . DS );
119
-	define( 'EE_FORM_SECTIONS', EE_LIBRARIES . 'form_sections' . DS );
108
+	define('EE_ADMIN', EE_CORE.'admin'.DS);
109
+	define('EE_CPTS', EE_CORE.'CPTs'.DS);
110
+	define('EE_CLASSES', EE_CORE.'db_classes'.DS);
111
+	define('EE_INTERFACES', EE_CORE.'interfaces'.DS);
112
+	define('EE_BUSINESS', EE_CORE.'business'.DS);
113
+	define('EE_MODELS', EE_CORE.'db_models'.DS);
114
+	define('EE_HELPERS', EE_CORE.'helpers'.DS);
115
+	define('EE_LIBRARIES', EE_CORE.'libraries'.DS);
116
+	define('EE_TEMPLATES', EE_CORE.'templates'.DS);
117
+	define('EE_THIRD_PARTY', EE_CORE.'third_party_libs'.DS);
118
+	define('EE_GLOBAL_ASSETS', EE_TEMPLATES.'global_assets'.DS);
119
+	define('EE_FORM_SECTIONS', EE_LIBRARIES.'form_sections'.DS);
120 120
 	// gateways
121
-	define( 'EE_GATEWAYS', EE_MODULES . 'gateways' . DS );
122
-	define( 'EE_GATEWAYS_URL', EE_PLUGIN_DIR_URL . 'modules' . DS . 'gateways' . DS );
121
+	define('EE_GATEWAYS', EE_MODULES.'gateways'.DS);
122
+	define('EE_GATEWAYS_URL', EE_PLUGIN_DIR_URL.'modules'.DS.'gateways'.DS);
123 123
 	// asset URL paths
124
-	define( 'EE_TEMPLATES_URL', EE_PLUGIN_DIR_URL . 'core' . DS . 'templates' . DS );
125
-	define( 'EE_GLOBAL_ASSETS_URL', EE_TEMPLATES_URL . 'global_assets' . DS );
126
-	define( 'EE_IMAGES_URL', EE_GLOBAL_ASSETS_URL . 'images' . DS );
127
-	define( 'EE_THIRD_PARTY_URL', EE_PLUGIN_DIR_URL . 'core' . DS . 'third_party_libs' . DS );
128
-	define( 'EE_HELPERS_ASSETS', EE_PLUGIN_DIR_URL . 'core/helpers/assets/' );
129
-	define( 'EE_LIBRARIES_URL', EE_PLUGIN_DIR_URL . 'core/libraries/' );
124
+	define('EE_TEMPLATES_URL', EE_PLUGIN_DIR_URL.'core'.DS.'templates'.DS);
125
+	define('EE_GLOBAL_ASSETS_URL', EE_TEMPLATES_URL.'global_assets'.DS);
126
+	define('EE_IMAGES_URL', EE_GLOBAL_ASSETS_URL.'images'.DS);
127
+	define('EE_THIRD_PARTY_URL', EE_PLUGIN_DIR_URL.'core'.DS.'third_party_libs'.DS);
128
+	define('EE_HELPERS_ASSETS', EE_PLUGIN_DIR_URL.'core/helpers/assets/');
129
+	define('EE_LIBRARIES_URL', EE_PLUGIN_DIR_URL.'core/libraries/');
130 130
 	// define upload paths
131 131
 	$uploads = wp_upload_dir();
132 132
 	// define the uploads directory and URL
133
-	define( 'EVENT_ESPRESSO_UPLOAD_DIR', $uploads[ 'basedir' ] . DS . 'espresso' . DS );
134
-	define( 'EVENT_ESPRESSO_UPLOAD_URL', $uploads[ 'baseurl' ] . DS . 'espresso' . DS );
133
+	define('EVENT_ESPRESSO_UPLOAD_DIR', $uploads['basedir'].DS.'espresso'.DS);
134
+	define('EVENT_ESPRESSO_UPLOAD_URL', $uploads['baseurl'].DS.'espresso'.DS);
135 135
 	// define the templates directory and URL
136
-	define( 'EVENT_ESPRESSO_TEMPLATE_DIR', $uploads[ 'basedir' ] . DS . 'espresso' . DS . 'templates' . DS );
137
-	define( 'EVENT_ESPRESSO_TEMPLATE_URL', $uploads[ 'baseurl' ] . DS . 'espresso' . DS . 'templates' . DS );
136
+	define('EVENT_ESPRESSO_TEMPLATE_DIR', $uploads['basedir'].DS.'espresso'.DS.'templates'.DS);
137
+	define('EVENT_ESPRESSO_TEMPLATE_URL', $uploads['baseurl'].DS.'espresso'.DS.'templates'.DS);
138 138
 	// define the gateway directory and URL
139
-	define( 'EVENT_ESPRESSO_GATEWAY_DIR', $uploads[ 'basedir' ] . DS . 'espresso' . DS . 'gateways' . DS );
140
-	define( 'EVENT_ESPRESSO_GATEWAY_URL', $uploads[ 'baseurl' ] . DS . 'espresso' . DS . 'gateways' . DS );
139
+	define('EVENT_ESPRESSO_GATEWAY_DIR', $uploads['basedir'].DS.'espresso'.DS.'gateways'.DS);
140
+	define('EVENT_ESPRESSO_GATEWAY_URL', $uploads['baseurl'].DS.'espresso'.DS.'gateways'.DS);
141 141
 	// languages folder/path
142
-	define( 'EE_LANGUAGES_SAFE_LOC', '..' . DS . 'uploads' . DS . 'espresso' . DS . 'languages' . DS );
143
-	define( 'EE_LANGUAGES_SAFE_DIR', EVENT_ESPRESSO_UPLOAD_DIR . 'languages' . DS );
142
+	define('EE_LANGUAGES_SAFE_LOC', '..'.DS.'uploads'.DS.'espresso'.DS.'languages'.DS);
143
+	define('EE_LANGUAGES_SAFE_DIR', EVENT_ESPRESSO_UPLOAD_DIR.'languages'.DS);
144 144
 	//check for dompdf fonts in uploads
145
-	if ( file_exists( EVENT_ESPRESSO_UPLOAD_DIR . 'fonts' . DS ) ) {
146
-		define( 'DOMPDF_FONT_DIR', EVENT_ESPRESSO_UPLOAD_DIR . 'fonts' . DS );
145
+	if (file_exists(EVENT_ESPRESSO_UPLOAD_DIR.'fonts'.DS)) {
146
+		define('DOMPDF_FONT_DIR', EVENT_ESPRESSO_UPLOAD_DIR.'fonts'.DS);
147 147
 	}
148 148
 	//ajax constants
149
-	define( 'EE_FRONT_AJAX', isset( $_REQUEST[ 'ee_front_ajax' ] ) || isset( $_REQUEST[ 'data' ][ 'ee_front_ajax' ] ) ? true : false );
150
-	define( 'EE_ADMIN_AJAX', isset( $_REQUEST[ 'ee_admin_ajax' ] ) || isset( $_REQUEST[ 'data' ][ 'ee_admin_ajax' ] ) ? true : false );
149
+	define('EE_FRONT_AJAX', isset($_REQUEST['ee_front_ajax']) || isset($_REQUEST['data']['ee_front_ajax']) ? true : false);
150
+	define('EE_ADMIN_AJAX', isset($_REQUEST['ee_admin_ajax']) || isset($_REQUEST['data']['ee_admin_ajax']) ? true : false);
151 151
 	//just a handy constant occasionally needed for finding values representing infinity in the DB
152 152
 	//you're better to use this than its straight value (currently -1) in case you ever
153 153
 	//want to change its default value! or find when -1 means infinity
154
-	define( 'EE_INF_IN_DB', -1 );
155
-	define( 'EE_INF', INF > (float)PHP_INT_MAX ? INF : PHP_INT_MAX );
156
-	define( 'EE_DEBUG', false );
154
+	define('EE_INF_IN_DB', -1);
155
+	define('EE_INF', INF > (float) PHP_INT_MAX ? INF : PHP_INT_MAX);
156
+	define('EE_DEBUG', false);
157 157
 
158 158
 	/**
159 159
 	 *    espresso_plugin_activation
160 160
 	 *    adds a wp-option to indicate that EE has been activated via the WP admin plugins page
161 161
 	 */
162 162
 	function espresso_plugin_activation() {
163
-		update_option( 'ee_espresso_activation', true );
163
+		update_option('ee_espresso_activation', true);
164 164
 	}
165
-	register_activation_hook( EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation' );
165
+	register_activation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation');
166 166
 
167 167
 
168 168
 
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
 		//	}
177 177
 		//
178 178
 	}
179
-	register_deactivation_hook( EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_deactivation' );
179
+	register_deactivation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_deactivation');
180 180
 
181 181
 
182 182
 
@@ -186,15 +186,15 @@  discard block
 block discarded – undo
186 186
 	 */
187 187
 	function espresso_load_error_handling() {
188 188
 		// load debugging tools
189
-		if ( WP_DEBUG === true && is_readable( EE_HELPERS . 'EEH_Debug_Tools.helper.php' ) ) {
190
-			require_once( EE_HELPERS . 'EEH_Debug_Tools.helper.php' );
189
+		if (WP_DEBUG === true && is_readable(EE_HELPERS.'EEH_Debug_Tools.helper.php')) {
190
+			require_once(EE_HELPERS.'EEH_Debug_Tools.helper.php');
191 191
 			EEH_Debug_Tools::instance();
192 192
 		}
193 193
 		// load error handling
194
-		if ( is_readable( EE_CORE . 'EE_Error.core.php' ) ) {
195
-			require_once( EE_CORE . 'EE_Error.core.php' );
194
+		if (is_readable(EE_CORE.'EE_Error.core.php')) {
195
+			require_once(EE_CORE.'EE_Error.core.php');
196 196
 		} else {
197
-			wp_die( __( 'The EE_Error core class could not be loaded.', 'event_espresso' ) );
197
+			wp_die(__('The EE_Error core class could not be loaded.', 'event_espresso'));
198 198
 		}
199 199
 	}
200 200
 
@@ -208,25 +208,25 @@  discard block
 block discarded – undo
208 208
 	 * @param    string $full_path_to_file
209 209
 	 * @throws    EE_Error
210 210
 	 */
211
-	function espresso_load_required( $classname, $full_path_to_file ) {
211
+	function espresso_load_required($classname, $full_path_to_file) {
212 212
 		static $error_handling_loaded = false;
213
-		if ( ! $error_handling_loaded ) {
213
+		if ( ! $error_handling_loaded) {
214 214
 			espresso_load_error_handling();
215 215
 			$error_handling_loaded = true;
216 216
 		}
217
-		if ( is_readable( $full_path_to_file ) ) {
218
-			require_once( $full_path_to_file );
217
+		if (is_readable($full_path_to_file)) {
218
+			require_once($full_path_to_file);
219 219
 		} else {
220
-			throw new EE_Error ( sprintf(
221
-				__( 'The %s class file could not be located or is not readable due to file permissions.', 'event_espresso' ),
220
+			throw new EE_Error(sprintf(
221
+				__('The %s class file could not be located or is not readable due to file permissions.', 'event_espresso'),
222 222
 				$classname
223
-			) );
223
+			));
224 224
 		}
225 225
 	}
226 226
 
227
-	espresso_load_required( 'EEH_Base', EE_CORE . 'helpers' . DS . 'EEH_Base.helper.php' );
228
-	espresso_load_required( 'EEH_File', EE_CORE . 'helpers' . DS . 'EEH_File.helper.php' );
229
-	espresso_load_required( 'EE_Bootstrap', EE_CORE . 'EE_Bootstrap.core.php' );
227
+	espresso_load_required('EEH_Base', EE_CORE.'helpers'.DS.'EEH_Base.helper.php');
228
+	espresso_load_required('EEH_File', EE_CORE.'helpers'.DS.'EEH_File.helper.php');
229
+	espresso_load_required('EE_Bootstrap', EE_CORE.'EE_Bootstrap.core.php');
230 230
 	new EE_Bootstrap();
231 231
 
232 232
 
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
 
236 236
 
237 237
 
238
-if ( ! function_exists( 'espresso_deactivate_plugin' ) ) {
238
+if ( ! function_exists('espresso_deactivate_plugin')) {
239 239
 	/**
240 240
 	*    deactivate_plugin
241 241
 	* usage:  espresso_deactivate_plugin( plugin_basename( __FILE__ ));
@@ -244,11 +244,11 @@  discard block
 block discarded – undo
244 244
 	* @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file
245 245
 	* @return    void
246 246
 	*/
247
-	function espresso_deactivate_plugin( $plugin_basename = '' ) {
248
-		if ( ! function_exists( 'deactivate_plugins' ) ) {
249
-			require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
247
+	function espresso_deactivate_plugin($plugin_basename = '') {
248
+		if ( ! function_exists('deactivate_plugins')) {
249
+			require_once(ABSPATH.'wp-admin/includes/plugin.php');
250 250
 		}
251
-		unset( $_GET[ 'activate' ], $_REQUEST[ 'activate' ] );
252
-		deactivate_plugins( $plugin_basename );
251
+		unset($_GET['activate'], $_REQUEST['activate']);
252
+		deactivate_plugins($plugin_basename);
253 253
 	}
254 254
 }
Please login to merge, or discard this patch.
core/libraries/iframe_display/Iframe.php 2 patches
Indentation   +285 added lines, -285 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@  discard block
 block discarded – undo
2 2
 namespace EventEspresso\core\libraries\iframe_display;
3 3
 
4 4
 if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
5
-    exit( 'No direct script access allowed' );
5
+	exit( 'No direct script access allowed' );
6 6
 }
7 7
 
8 8
 
@@ -18,317 +18,317 @@  discard block
 block discarded – undo
18 18
 class Iframe
19 19
 {
20 20
 
21
-    /*
21
+	/*
22 22
     * HTML for notices and ajax gif
23 23
     * @var string $title
24 24
     */
25
-    protected $title = '';
25
+	protected $title = '';
26 26
 
27
-    /*
27
+	/*
28 28
     * HTML for the content being displayed
29 29
     * @var string $content
30 30
     */
31
-    protected $content = '';
31
+	protected $content = '';
32 32
 
33
-    /*
33
+	/*
34 34
     * whether or not to call wp_head() and wp_footer()
35 35
     * @var boolean $enqueue_wp_assets
36 36
     */
37
-    protected $enqueue_wp_assets = false;
37
+	protected $enqueue_wp_assets = false;
38 38
 
39
-    /*
39
+	/*
40 40
     * an array of CSS URLs
41 41
     * @var array $css
42 42
     */
43
-    protected $css = array();
43
+	protected $css = array();
44 44
 
45
-    /*
45
+	/*
46 46
     * an array of JS URLs to be set in the HTML header.
47 47
     * @var array $header_js
48 48
     */
49
-    protected $header_js = array();
49
+	protected $header_js = array();
50 50
 
51
-    /*
51
+	/*
52 52
     * an array of JS URLs to be displayed before the HTML </body> tag
53 53
     * @var array $footer_js
54 54
     */
55
-    protected $footer_js = array();
55
+	protected $footer_js = array();
56 56
 
57
-    /*
57
+	/*
58 58
     * an array of JSON vars to be set in the HTML header.
59 59
     * @var array $localized_vars
60 60
     */
61
-    protected $localized_vars = array();
62
-
63
-
64
-
65
-    /**
66
-     * Iframe constructor
67
-     *
68
-     * @param string $title
69
-     * @param string $content
70
-     * @throws \EE_Error
71
-     */
72
-    public function __construct( $title, $content )
73
-    {
74
-        global $wp_version;
75
-        if ( ! defined( 'EE_IFRAME_DIR_URL' ) ) {
76
-            define( 'EE_IFRAME_DIR_URL', plugin_dir_url( __FILE__ ) );
77
-        }
78
-        $this->setContent( $content );
79
-        $this->setTitle( $title );
80
-        $this->addStylesheets(
81
-            apply_filters(
82
-                'FHEE___EventEspresso_core_libraries_iframe_display_Iframe__construct__default_css',
83
-                array(
84
-                    'dashicons'        => includes_url( 'css/dashicons.min.css?ver=' . $wp_version ),
85
-                    'espresso_default' => EE_GLOBAL_ASSETS_URL
86
-                                          . 'css/espresso_default.css?ver=' . EVENT_ESPRESSO_VERSION,
87
-                )
88
-            )
89
-        );
90
-        $this->addScripts(
91
-            apply_filters(
92
-                'FHEE___EventEspresso_core_libraries_iframe_display_Iframe__construct__default_js',
93
-                array(
94
-                    'jquery'        => includes_url( 'js/jquery/jquery.js?ver=' . $wp_version ),
95
-                    'espresso_core' => EE_GLOBAL_ASSETS_URL
96
-                                       . 'scripts/espresso_core.js?ver=' . EVENT_ESPRESSO_VERSION,
97
-                )
98
-            )
99
-        );
100
-    }
101
-
102
-
103
-
104
-    /**
105
-     * @param string $title
106
-     * @throws \EE_Error
107
-     */
108
-    public function setTitle( $title )
109
-    {
110
-        if ( empty( $title ) ) {
111
-            throw new \EE_Error(
112
-                esc_html__( 'You must provide a page title in order to create an iframe.', 'event_espresso' )
113
-            );
114
-        }
115
-        $this->title = $title;
116
-    }
117
-
118
-
119
-
120
-    /**
121
-     * @param string $content
122
-     * @throws \EE_Error
123
-     */
124
-    public function setContent( $content )
125
-    {
126
-        if ( empty( $content ) ) {
127
-            throw new \EE_Error(
128
-                esc_html__( 'You must provide content in order to create an iframe.', 'event_espresso' )
129
-            );
130
-        }
131
-        $this->content = $content;
132
-    }
133
-
134
-
135
-
136
-    /**
137
-     * @param boolean $enqueue_wp_assets
138
-     */
139
-    public function setEnqueueWpAssets( $enqueue_wp_assets )
140
-    {
141
-        $this->enqueue_wp_assets = filter_var( $enqueue_wp_assets, FILTER_VALIDATE_BOOLEAN );
142
-    }
143
-
144
-
145
-
146
-    /**
147
-     * @param array $stylesheets
148
-     * @throws \EE_Error
149
-     */
150
-    public function addStylesheets( array $stylesheets )
151
-    {
152
-        if ( empty( $stylesheets ) ) {
153
-            throw new \EE_Error(
154
-                esc_html__(
155
-                    'A non-empty array of URLs, is required to add a CSS stylesheet to an iframe.',
156
-                    'event_espresso'
157
-                )
158
-            );
159
-        }
160
-        foreach ( $stylesheets as $handle => $stylesheet ) {
161
-            $this->css[ $handle ] = $stylesheet;
162
-        }
163
-    }
164
-
165
-
166
-
167
-    /**
168
-     * @param array $scripts
169
-     * @param bool  $add_to_header
170
-     * @throws \EE_Error
171
-     */
172
-    public function addScripts( array $scripts, $add_to_header = false )
173
-    {
174
-        if ( empty( $scripts ) ) {
175
-            throw new \EE_Error(
176
-                esc_html__(
177
-                    'A non-empty array of URLs, is required to add Javascript to an iframe.',
178
-                    'event_espresso'
179
-                )
180
-            );
181
-        }
182
-        foreach ( $scripts as $handle => $script ) {
183
-            if ( $add_to_header ) {
184
-                $this->header_js[ $handle ] = $script;
185
-            } else {
186
-                $this->footer_js[ $handle ] = $script;
187
-            }
188
-        }
189
-    }
190
-
191
-
192
-
193
-    /**
194
-     * @param array  $vars
195
-     * @param string $var_name
196
-     * @throws \EE_Error
197
-     */
198
-    public function addLocalizedVars( array $vars, $var_name = 'eei18n' )
199
-    {
200
-        if ( empty( $vars ) ) {
201
-            throw new \EE_Error(
202
-                esc_html__(
203
-                    'A non-empty array of vars, is required to add localized Javascript vars to an iframe.',
204
-                    'event_espresso'
205
-                )
206
-            );
207
-        }
208
-        foreach ( $vars as $handle => $var ) {
209
-            if ( $var_name === 'eei18n' ) {
210
-                \EE_Registry::$i18n_js_strings[ $handle ] = $var;
211
-            } else {
212
-                if ( ! isset( $this->localized_vars[ $var_name ] ) ) {
213
-                    $this->localized_vars[ $var_name ] = array();
214
-                }
215
-                $this->localized_vars[ $var_name ][ $handle ] = $var;
216
-            }
217
-        }
218
-    }
219
-
220
-
221
-
222
-    /**
223
-     * @return void
224
-     * @throws \DomainException
225
-     */
226
-    public function display()
227
-    {
228
-        $this->content .= \EEH_HTML::br() . \EEH_Template::powered_by_event_espresso();
229
-        \EE_System::do_not_cache();
230
-        echo $this->getTemplate();
231
-        exit;
232
-    }
233
-
234
-
235
-
236
-    /**
237
-     * @return string
238
-     * @throws \DomainException
239
-     */
240
-    public function getTemplate()
241
-    {
242
-        $template = __DIR__ . DIRECTORY_SEPARATOR . 'iframe_wrapper.template.php';
243
-        if ( ! is_readable($template)) {
244
-            throw new \DomainException(
245
-                esc_html__(
246
-                    'Invalid, unreadable, or missing file.',
247
-                    'event_espresso'
248
-                )
249
-            );
250
-        }
251
-        return \EEH_Template::display_template(
252
-            $template,
253
-            array(
254
-                'title'             => apply_filters(
255
-                    'FHEE___EventEspresso_core_libraries_iframe_display_Iframe__getTemplate__title',
256
-                    $this->title
257
-                ),
258
-                'content'           => apply_filters(
259
-                    'FHEE___EventEspresso_core_libraries_iframe_display_Iframe__getTemplate__content',
260
-                    $this->content
261
-                ),
262
-                'enqueue_wp_assets' => apply_filters(
263
-                    'FHEE___EventEspresso_core_libraries_iframe_display_Iframe__getTemplate__enqueue_wp_assets',
264
-                    $this->enqueue_wp_assets
265
-                ),
266
-                'css'               => (array)apply_filters(
267
-                    'FHEE___EventEspresso_core_libraries_iframe_display_Iframe__getTemplate__css_urls',
268
-                    $this->css
269
-                ),
270
-                'header_js'         => (array)apply_filters(
271
-                    'FHEE___EventEspresso_core_libraries_iframe_display_Iframe__getTemplate__header_js_urls',
272
-                    $this->header_js
273
-                ),
274
-                'footer_js'         => (array)apply_filters(
275
-                    'FHEE___EventEspresso_core_libraries_iframe_display_Iframe__getTemplate__footer_js_urls',
276
-                    $this->footer_js
277
-                ),
278
-                'eei18n'            => apply_filters(
279
-                    'FHEE___EventEspresso_core_libraries_iframe_display_Iframe__getTemplate__eei18n_js_strings',
280
-                    \EE_Registry::localize_i18n_js_strings() . $this->localizeJsonVars()
281
-                ),
282
-                'notices'           => \EEH_Template::display_template(
283
-                    EE_TEMPLATES . 'espresso-ajax-notices.template.php',
284
-                    array(),
285
-                    true
286
-                ),
287
-            ),
288
-            true
289
-        );
290
-    }
291
-
292
-
293
-
294
-    /**
295
-     * localizeJsonVars
296
-     *
297
-     * @return string
298
-     */
299
-    public function localizeJsonVars()
300
-    {
301
-        $JSON = '';
302
-        foreach ( (array)$this->localized_vars as $var_name => $vars ) {
303
-            foreach ( (array)$vars as $key => $value ) {
304
-                $this->localized_vars[ $var_name ] = $this->encodeJsonVars( $value );
305
-            }
306
-            $JSON .= "/* <![CDATA[ */ var {$var_name} = ";
307
-            $JSON .= wp_json_encode( $this->localized_vars[ $var_name ] );
308
-            $JSON .= '; /* ]]> */';
309
-        }
310
-        return $JSON;
311
-    }
312
-
313
-
314
-
315
-    /**
316
-     * @param bool|int|float|string|array $var
317
-     * @return array
318
-     */
319
-    public function encodeJsonVars( $var )
320
-    {
321
-        if ( is_array( $var ) ) {
322
-            $localized_vars = array();
323
-            foreach ( (array)$var as $key => $value ) {
324
-                $localized_vars[ $key ] = $this->encodeJsonVars( $value );
325
-            }
326
-            return $localized_vars;
327
-        } else if ( is_scalar( $var ) ) {
328
-            return html_entity_decode( (string)$var, ENT_QUOTES, 'UTF-8' );
329
-        }
330
-        return null;
331
-    }
61
+	protected $localized_vars = array();
62
+
63
+
64
+
65
+	/**
66
+	 * Iframe constructor
67
+	 *
68
+	 * @param string $title
69
+	 * @param string $content
70
+	 * @throws \EE_Error
71
+	 */
72
+	public function __construct( $title, $content )
73
+	{
74
+		global $wp_version;
75
+		if ( ! defined( 'EE_IFRAME_DIR_URL' ) ) {
76
+			define( 'EE_IFRAME_DIR_URL', plugin_dir_url( __FILE__ ) );
77
+		}
78
+		$this->setContent( $content );
79
+		$this->setTitle( $title );
80
+		$this->addStylesheets(
81
+			apply_filters(
82
+				'FHEE___EventEspresso_core_libraries_iframe_display_Iframe__construct__default_css',
83
+				array(
84
+					'dashicons'        => includes_url( 'css/dashicons.min.css?ver=' . $wp_version ),
85
+					'espresso_default' => EE_GLOBAL_ASSETS_URL
86
+										  . 'css/espresso_default.css?ver=' . EVENT_ESPRESSO_VERSION,
87
+				)
88
+			)
89
+		);
90
+		$this->addScripts(
91
+			apply_filters(
92
+				'FHEE___EventEspresso_core_libraries_iframe_display_Iframe__construct__default_js',
93
+				array(
94
+					'jquery'        => includes_url( 'js/jquery/jquery.js?ver=' . $wp_version ),
95
+					'espresso_core' => EE_GLOBAL_ASSETS_URL
96
+									   . 'scripts/espresso_core.js?ver=' . EVENT_ESPRESSO_VERSION,
97
+				)
98
+			)
99
+		);
100
+	}
101
+
102
+
103
+
104
+	/**
105
+	 * @param string $title
106
+	 * @throws \EE_Error
107
+	 */
108
+	public function setTitle( $title )
109
+	{
110
+		if ( empty( $title ) ) {
111
+			throw new \EE_Error(
112
+				esc_html__( 'You must provide a page title in order to create an iframe.', 'event_espresso' )
113
+			);
114
+		}
115
+		$this->title = $title;
116
+	}
117
+
118
+
119
+
120
+	/**
121
+	 * @param string $content
122
+	 * @throws \EE_Error
123
+	 */
124
+	public function setContent( $content )
125
+	{
126
+		if ( empty( $content ) ) {
127
+			throw new \EE_Error(
128
+				esc_html__( 'You must provide content in order to create an iframe.', 'event_espresso' )
129
+			);
130
+		}
131
+		$this->content = $content;
132
+	}
133
+
134
+
135
+
136
+	/**
137
+	 * @param boolean $enqueue_wp_assets
138
+	 */
139
+	public function setEnqueueWpAssets( $enqueue_wp_assets )
140
+	{
141
+		$this->enqueue_wp_assets = filter_var( $enqueue_wp_assets, FILTER_VALIDATE_BOOLEAN );
142
+	}
143
+
144
+
145
+
146
+	/**
147
+	 * @param array $stylesheets
148
+	 * @throws \EE_Error
149
+	 */
150
+	public function addStylesheets( array $stylesheets )
151
+	{
152
+		if ( empty( $stylesheets ) ) {
153
+			throw new \EE_Error(
154
+				esc_html__(
155
+					'A non-empty array of URLs, is required to add a CSS stylesheet to an iframe.',
156
+					'event_espresso'
157
+				)
158
+			);
159
+		}
160
+		foreach ( $stylesheets as $handle => $stylesheet ) {
161
+			$this->css[ $handle ] = $stylesheet;
162
+		}
163
+	}
164
+
165
+
166
+
167
+	/**
168
+	 * @param array $scripts
169
+	 * @param bool  $add_to_header
170
+	 * @throws \EE_Error
171
+	 */
172
+	public function addScripts( array $scripts, $add_to_header = false )
173
+	{
174
+		if ( empty( $scripts ) ) {
175
+			throw new \EE_Error(
176
+				esc_html__(
177
+					'A non-empty array of URLs, is required to add Javascript to an iframe.',
178
+					'event_espresso'
179
+				)
180
+			);
181
+		}
182
+		foreach ( $scripts as $handle => $script ) {
183
+			if ( $add_to_header ) {
184
+				$this->header_js[ $handle ] = $script;
185
+			} else {
186
+				$this->footer_js[ $handle ] = $script;
187
+			}
188
+		}
189
+	}
190
+
191
+
192
+
193
+	/**
194
+	 * @param array  $vars
195
+	 * @param string $var_name
196
+	 * @throws \EE_Error
197
+	 */
198
+	public function addLocalizedVars( array $vars, $var_name = 'eei18n' )
199
+	{
200
+		if ( empty( $vars ) ) {
201
+			throw new \EE_Error(
202
+				esc_html__(
203
+					'A non-empty array of vars, is required to add localized Javascript vars to an iframe.',
204
+					'event_espresso'
205
+				)
206
+			);
207
+		}
208
+		foreach ( $vars as $handle => $var ) {
209
+			if ( $var_name === 'eei18n' ) {
210
+				\EE_Registry::$i18n_js_strings[ $handle ] = $var;
211
+			} else {
212
+				if ( ! isset( $this->localized_vars[ $var_name ] ) ) {
213
+					$this->localized_vars[ $var_name ] = array();
214
+				}
215
+				$this->localized_vars[ $var_name ][ $handle ] = $var;
216
+			}
217
+		}
218
+	}
219
+
220
+
221
+
222
+	/**
223
+	 * @return void
224
+	 * @throws \DomainException
225
+	 */
226
+	public function display()
227
+	{
228
+		$this->content .= \EEH_HTML::br() . \EEH_Template::powered_by_event_espresso();
229
+		\EE_System::do_not_cache();
230
+		echo $this->getTemplate();
231
+		exit;
232
+	}
233
+
234
+
235
+
236
+	/**
237
+	 * @return string
238
+	 * @throws \DomainException
239
+	 */
240
+	public function getTemplate()
241
+	{
242
+		$template = __DIR__ . DIRECTORY_SEPARATOR . 'iframe_wrapper.template.php';
243
+		if ( ! is_readable($template)) {
244
+			throw new \DomainException(
245
+				esc_html__(
246
+					'Invalid, unreadable, or missing file.',
247
+					'event_espresso'
248
+				)
249
+			);
250
+		}
251
+		return \EEH_Template::display_template(
252
+			$template,
253
+			array(
254
+				'title'             => apply_filters(
255
+					'FHEE___EventEspresso_core_libraries_iframe_display_Iframe__getTemplate__title',
256
+					$this->title
257
+				),
258
+				'content'           => apply_filters(
259
+					'FHEE___EventEspresso_core_libraries_iframe_display_Iframe__getTemplate__content',
260
+					$this->content
261
+				),
262
+				'enqueue_wp_assets' => apply_filters(
263
+					'FHEE___EventEspresso_core_libraries_iframe_display_Iframe__getTemplate__enqueue_wp_assets',
264
+					$this->enqueue_wp_assets
265
+				),
266
+				'css'               => (array)apply_filters(
267
+					'FHEE___EventEspresso_core_libraries_iframe_display_Iframe__getTemplate__css_urls',
268
+					$this->css
269
+				),
270
+				'header_js'         => (array)apply_filters(
271
+					'FHEE___EventEspresso_core_libraries_iframe_display_Iframe__getTemplate__header_js_urls',
272
+					$this->header_js
273
+				),
274
+				'footer_js'         => (array)apply_filters(
275
+					'FHEE___EventEspresso_core_libraries_iframe_display_Iframe__getTemplate__footer_js_urls',
276
+					$this->footer_js
277
+				),
278
+				'eei18n'            => apply_filters(
279
+					'FHEE___EventEspresso_core_libraries_iframe_display_Iframe__getTemplate__eei18n_js_strings',
280
+					\EE_Registry::localize_i18n_js_strings() . $this->localizeJsonVars()
281
+				),
282
+				'notices'           => \EEH_Template::display_template(
283
+					EE_TEMPLATES . 'espresso-ajax-notices.template.php',
284
+					array(),
285
+					true
286
+				),
287
+			),
288
+			true
289
+		);
290
+	}
291
+
292
+
293
+
294
+	/**
295
+	 * localizeJsonVars
296
+	 *
297
+	 * @return string
298
+	 */
299
+	public function localizeJsonVars()
300
+	{
301
+		$JSON = '';
302
+		foreach ( (array)$this->localized_vars as $var_name => $vars ) {
303
+			foreach ( (array)$vars as $key => $value ) {
304
+				$this->localized_vars[ $var_name ] = $this->encodeJsonVars( $value );
305
+			}
306
+			$JSON .= "/* <![CDATA[ */ var {$var_name} = ";
307
+			$JSON .= wp_json_encode( $this->localized_vars[ $var_name ] );
308
+			$JSON .= '; /* ]]> */';
309
+		}
310
+		return $JSON;
311
+	}
312
+
313
+
314
+
315
+	/**
316
+	 * @param bool|int|float|string|array $var
317
+	 * @return array
318
+	 */
319
+	public function encodeJsonVars( $var )
320
+	{
321
+		if ( is_array( $var ) ) {
322
+			$localized_vars = array();
323
+			foreach ( (array)$var as $key => $value ) {
324
+				$localized_vars[ $key ] = $this->encodeJsonVars( $value );
325
+			}
326
+			return $localized_vars;
327
+		} else if ( is_scalar( $var ) ) {
328
+			return html_entity_decode( (string)$var, ENT_QUOTES, 'UTF-8' );
329
+		}
330
+		return null;
331
+	}
332 332
 
333 333
 
334 334
 
Please login to merge, or discard this patch.
Spacing   +54 added lines, -54 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 namespace EventEspresso\core\libraries\iframe_display;
3 3
 
4
-if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
5
-    exit( 'No direct script access allowed' );
4
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
5
+    exit('No direct script access allowed');
6 6
 }
7 7
 
8 8
 
@@ -69,21 +69,21 @@  discard block
 block discarded – undo
69 69
      * @param string $content
70 70
      * @throws \EE_Error
71 71
      */
72
-    public function __construct( $title, $content )
72
+    public function __construct($title, $content)
73 73
     {
74 74
         global $wp_version;
75
-        if ( ! defined( 'EE_IFRAME_DIR_URL' ) ) {
76
-            define( 'EE_IFRAME_DIR_URL', plugin_dir_url( __FILE__ ) );
75
+        if ( ! defined('EE_IFRAME_DIR_URL')) {
76
+            define('EE_IFRAME_DIR_URL', plugin_dir_url(__FILE__));
77 77
         }
78
-        $this->setContent( $content );
79
-        $this->setTitle( $title );
78
+        $this->setContent($content);
79
+        $this->setTitle($title);
80 80
         $this->addStylesheets(
81 81
             apply_filters(
82 82
                 'FHEE___EventEspresso_core_libraries_iframe_display_Iframe__construct__default_css',
83 83
                 array(
84
-                    'dashicons'        => includes_url( 'css/dashicons.min.css?ver=' . $wp_version ),
84
+                    'dashicons'        => includes_url('css/dashicons.min.css?ver='.$wp_version),
85 85
                     'espresso_default' => EE_GLOBAL_ASSETS_URL
86
-                                          . 'css/espresso_default.css?ver=' . EVENT_ESPRESSO_VERSION,
86
+                                          . 'css/espresso_default.css?ver='.EVENT_ESPRESSO_VERSION,
87 87
                 )
88 88
             )
89 89
         );
@@ -91,9 +91,9 @@  discard block
 block discarded – undo
91 91
             apply_filters(
92 92
                 'FHEE___EventEspresso_core_libraries_iframe_display_Iframe__construct__default_js',
93 93
                 array(
94
-                    'jquery'        => includes_url( 'js/jquery/jquery.js?ver=' . $wp_version ),
94
+                    'jquery'        => includes_url('js/jquery/jquery.js?ver='.$wp_version),
95 95
                     'espresso_core' => EE_GLOBAL_ASSETS_URL
96
-                                       . 'scripts/espresso_core.js?ver=' . EVENT_ESPRESSO_VERSION,
96
+                                       . 'scripts/espresso_core.js?ver='.EVENT_ESPRESSO_VERSION,
97 97
                 )
98 98
             )
99 99
         );
@@ -105,11 +105,11 @@  discard block
 block discarded – undo
105 105
      * @param string $title
106 106
      * @throws \EE_Error
107 107
      */
108
-    public function setTitle( $title )
108
+    public function setTitle($title)
109 109
     {
110
-        if ( empty( $title ) ) {
110
+        if (empty($title)) {
111 111
             throw new \EE_Error(
112
-                esc_html__( 'You must provide a page title in order to create an iframe.', 'event_espresso' )
112
+                esc_html__('You must provide a page title in order to create an iframe.', 'event_espresso')
113 113
             );
114 114
         }
115 115
         $this->title = $title;
@@ -121,11 +121,11 @@  discard block
 block discarded – undo
121 121
      * @param string $content
122 122
      * @throws \EE_Error
123 123
      */
124
-    public function setContent( $content )
124
+    public function setContent($content)
125 125
     {
126
-        if ( empty( $content ) ) {
126
+        if (empty($content)) {
127 127
             throw new \EE_Error(
128
-                esc_html__( 'You must provide content in order to create an iframe.', 'event_espresso' )
128
+                esc_html__('You must provide content in order to create an iframe.', 'event_espresso')
129 129
             );
130 130
         }
131 131
         $this->content = $content;
@@ -136,9 +136,9 @@  discard block
 block discarded – undo
136 136
     /**
137 137
      * @param boolean $enqueue_wp_assets
138 138
      */
139
-    public function setEnqueueWpAssets( $enqueue_wp_assets )
139
+    public function setEnqueueWpAssets($enqueue_wp_assets)
140 140
     {
141
-        $this->enqueue_wp_assets = filter_var( $enqueue_wp_assets, FILTER_VALIDATE_BOOLEAN );
141
+        $this->enqueue_wp_assets = filter_var($enqueue_wp_assets, FILTER_VALIDATE_BOOLEAN);
142 142
     }
143 143
 
144 144
 
@@ -147,9 +147,9 @@  discard block
 block discarded – undo
147 147
      * @param array $stylesheets
148 148
      * @throws \EE_Error
149 149
      */
150
-    public function addStylesheets( array $stylesheets )
150
+    public function addStylesheets(array $stylesheets)
151 151
     {
152
-        if ( empty( $stylesheets ) ) {
152
+        if (empty($stylesheets)) {
153 153
             throw new \EE_Error(
154 154
                 esc_html__(
155 155
                     'A non-empty array of URLs, is required to add a CSS stylesheet to an iframe.',
@@ -157,8 +157,8 @@  discard block
 block discarded – undo
157 157
                 )
158 158
             );
159 159
         }
160
-        foreach ( $stylesheets as $handle => $stylesheet ) {
161
-            $this->css[ $handle ] = $stylesheet;
160
+        foreach ($stylesheets as $handle => $stylesheet) {
161
+            $this->css[$handle] = $stylesheet;
162 162
         }
163 163
     }
164 164
 
@@ -169,9 +169,9 @@  discard block
 block discarded – undo
169 169
      * @param bool  $add_to_header
170 170
      * @throws \EE_Error
171 171
      */
172
-    public function addScripts( array $scripts, $add_to_header = false )
172
+    public function addScripts(array $scripts, $add_to_header = false)
173 173
     {
174
-        if ( empty( $scripts ) ) {
174
+        if (empty($scripts)) {
175 175
             throw new \EE_Error(
176 176
                 esc_html__(
177 177
                     'A non-empty array of URLs, is required to add Javascript to an iframe.',
@@ -179,11 +179,11 @@  discard block
 block discarded – undo
179 179
                 )
180 180
             );
181 181
         }
182
-        foreach ( $scripts as $handle => $script ) {
183
-            if ( $add_to_header ) {
184
-                $this->header_js[ $handle ] = $script;
182
+        foreach ($scripts as $handle => $script) {
183
+            if ($add_to_header) {
184
+                $this->header_js[$handle] = $script;
185 185
             } else {
186
-                $this->footer_js[ $handle ] = $script;
186
+                $this->footer_js[$handle] = $script;
187 187
             }
188 188
         }
189 189
     }
@@ -195,9 +195,9 @@  discard block
 block discarded – undo
195 195
      * @param string $var_name
196 196
      * @throws \EE_Error
197 197
      */
198
-    public function addLocalizedVars( array $vars, $var_name = 'eei18n' )
198
+    public function addLocalizedVars(array $vars, $var_name = 'eei18n')
199 199
     {
200
-        if ( empty( $vars ) ) {
200
+        if (empty($vars)) {
201 201
             throw new \EE_Error(
202 202
                 esc_html__(
203 203
                     'A non-empty array of vars, is required to add localized Javascript vars to an iframe.',
@@ -205,14 +205,14 @@  discard block
 block discarded – undo
205 205
                 )
206 206
             );
207 207
         }
208
-        foreach ( $vars as $handle => $var ) {
209
-            if ( $var_name === 'eei18n' ) {
210
-                \EE_Registry::$i18n_js_strings[ $handle ] = $var;
208
+        foreach ($vars as $handle => $var) {
209
+            if ($var_name === 'eei18n') {
210
+                \EE_Registry::$i18n_js_strings[$handle] = $var;
211 211
             } else {
212
-                if ( ! isset( $this->localized_vars[ $var_name ] ) ) {
213
-                    $this->localized_vars[ $var_name ] = array();
212
+                if ( ! isset($this->localized_vars[$var_name])) {
213
+                    $this->localized_vars[$var_name] = array();
214 214
                 }
215
-                $this->localized_vars[ $var_name ][ $handle ] = $var;
215
+                $this->localized_vars[$var_name][$handle] = $var;
216 216
             }
217 217
         }
218 218
     }
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
      */
226 226
     public function display()
227 227
     {
228
-        $this->content .= \EEH_HTML::br() . \EEH_Template::powered_by_event_espresso();
228
+        $this->content .= \EEH_HTML::br().\EEH_Template::powered_by_event_espresso();
229 229
         \EE_System::do_not_cache();
230 230
         echo $this->getTemplate();
231 231
         exit;
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
      */
240 240
     public function getTemplate()
241 241
     {
242
-        $template = __DIR__ . DIRECTORY_SEPARATOR . 'iframe_wrapper.template.php';
242
+        $template = __DIR__.DIRECTORY_SEPARATOR.'iframe_wrapper.template.php';
243 243
         if ( ! is_readable($template)) {
244 244
             throw new \DomainException(
245 245
                 esc_html__(
@@ -263,24 +263,24 @@  discard block
 block discarded – undo
263 263
                     'FHEE___EventEspresso_core_libraries_iframe_display_Iframe__getTemplate__enqueue_wp_assets',
264 264
                     $this->enqueue_wp_assets
265 265
                 ),
266
-                'css'               => (array)apply_filters(
266
+                'css'               => (array) apply_filters(
267 267
                     'FHEE___EventEspresso_core_libraries_iframe_display_Iframe__getTemplate__css_urls',
268 268
                     $this->css
269 269
                 ),
270
-                'header_js'         => (array)apply_filters(
270
+                'header_js'         => (array) apply_filters(
271 271
                     'FHEE___EventEspresso_core_libraries_iframe_display_Iframe__getTemplate__header_js_urls',
272 272
                     $this->header_js
273 273
                 ),
274
-                'footer_js'         => (array)apply_filters(
274
+                'footer_js'         => (array) apply_filters(
275 275
                     'FHEE___EventEspresso_core_libraries_iframe_display_Iframe__getTemplate__footer_js_urls',
276 276
                     $this->footer_js
277 277
                 ),
278 278
                 'eei18n'            => apply_filters(
279 279
                     'FHEE___EventEspresso_core_libraries_iframe_display_Iframe__getTemplate__eei18n_js_strings',
280
-                    \EE_Registry::localize_i18n_js_strings() . $this->localizeJsonVars()
280
+                    \EE_Registry::localize_i18n_js_strings().$this->localizeJsonVars()
281 281
                 ),
282 282
                 'notices'           => \EEH_Template::display_template(
283
-                    EE_TEMPLATES . 'espresso-ajax-notices.template.php',
283
+                    EE_TEMPLATES.'espresso-ajax-notices.template.php',
284 284
                     array(),
285 285
                     true
286 286
                 ),
@@ -299,12 +299,12 @@  discard block
 block discarded – undo
299 299
     public function localizeJsonVars()
300 300
     {
301 301
         $JSON = '';
302
-        foreach ( (array)$this->localized_vars as $var_name => $vars ) {
303
-            foreach ( (array)$vars as $key => $value ) {
304
-                $this->localized_vars[ $var_name ] = $this->encodeJsonVars( $value );
302
+        foreach ((array) $this->localized_vars as $var_name => $vars) {
303
+            foreach ((array) $vars as $key => $value) {
304
+                $this->localized_vars[$var_name] = $this->encodeJsonVars($value);
305 305
             }
306 306
             $JSON .= "/* <![CDATA[ */ var {$var_name} = ";
307
-            $JSON .= wp_json_encode( $this->localized_vars[ $var_name ] );
307
+            $JSON .= wp_json_encode($this->localized_vars[$var_name]);
308 308
             $JSON .= '; /* ]]> */';
309 309
         }
310 310
         return $JSON;
@@ -316,16 +316,16 @@  discard block
 block discarded – undo
316 316
      * @param bool|int|float|string|array $var
317 317
      * @return array
318 318
      */
319
-    public function encodeJsonVars( $var )
319
+    public function encodeJsonVars($var)
320 320
     {
321
-        if ( is_array( $var ) ) {
321
+        if (is_array($var)) {
322 322
             $localized_vars = array();
323
-            foreach ( (array)$var as $key => $value ) {
324
-                $localized_vars[ $key ] = $this->encodeJsonVars( $value );
323
+            foreach ((array) $var as $key => $value) {
324
+                $localized_vars[$key] = $this->encodeJsonVars($value);
325 325
             }
326 326
             return $localized_vars;
327
-        } else if ( is_scalar( $var ) ) {
328
-            return html_entity_decode( (string)$var, ENT_QUOTES, 'UTF-8' );
327
+        } else if (is_scalar($var)) {
328
+            return html_entity_decode((string) $var, ENT_QUOTES, 'UTF-8');
329 329
         }
330 330
         return null;
331 331
     }
Please login to merge, or discard this patch.