Completed
Branch TASK-9118-extensions-page (b89c2b)
by
unknown
506:56 queued 485:08
created
caffeinated/admin/new/pricing/Pricing_Admin_Page.core.php 1 patch
Spacing   +184 added lines, -184 removed lines patch added patch discarded remove patch
@@ -31,8 +31,8 @@  discard block
 block discarded – undo
31 31
 	 * @param bool $routing
32 32
 	 * @return Pricing_Admin_Page
33 33
 	 */
34
-	public function __construct( $routing = TRUE ) {
35
-		parent::__construct( $routing );
34
+	public function __construct($routing = TRUE) {
35
+		parent::__construct($routing);
36 36
 	}
37 37
 
38 38
 
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 
50 50
 
51 51
 	protected function _ajax_hooks() {
52
-		add_action('wp_ajax_espresso_update_prices_order', array( $this, 'update_price_order' ));
52
+		add_action('wp_ajax_espresso_update_prices_order', array($this, 'update_price_order'));
53 53
 	}
54 54
 
55 55
 
@@ -82,8 +82,8 @@  discard block
 block discarded – undo
82 82
 	*		@return void
83 83
 	*/
84 84
 	protected function _set_page_routes() {
85
-		$prc_id = ! empty( $this->_req_data['PRC_ID'] ) && ! is_array( $this->_req_data['PRC_ID'] ) ? $this->_req_data['PRC_ID'] : 0;
86
-		$prt_id =  ! empty( $this->_req_data['PRT_ID'] ) && ! is_array( $this->_req_data['PRT_ID'] ) ? $this->_req_data['PRT_ID'] : 0;
85
+		$prc_id = ! empty($this->_req_data['PRC_ID']) && ! is_array($this->_req_data['PRC_ID']) ? $this->_req_data['PRC_ID'] : 0;
86
+		$prt_id = ! empty($this->_req_data['PRT_ID']) && ! is_array($this->_req_data['PRT_ID']) ? $this->_req_data['PRT_ID'] : 0;
87 87
 		$this->_page_routes = array(
88 88
 			'default' => array(
89 89
 					'func' => '_price_overview_list_table',
@@ -91,38 +91,38 @@  discard block
 block discarded – undo
91 91
 				),
92 92
 			'add_new_price'	=> array(
93 93
 					'func' => '_edit_price_details',
94
-					'args' => array( 'new_price' => TRUE ),
94
+					'args' => array('new_price' => TRUE),
95 95
 					'capability' => 'ee_edit_default_prices'
96 96
 				),
97 97
 			'edit_price'	=> array(
98 98
 					'func' => '_edit_price_details',
99
-					'args' => array( 'new_price' => FALSE ),
99
+					'args' => array('new_price' => FALSE),
100 100
 					'capability' => 'ee_edit_default_price',
101 101
 					'obj_id' => $prc_id
102 102
 				),
103 103
 			'insert_price'	=> array(
104 104
 					'func' => '_insert_or_update_price',
105
-					'args' => array( 'new_price' => TRUE ),
105
+					'args' => array('new_price' => TRUE),
106 106
 					'noheader' => TRUE,
107 107
 					'capability' => 'ee_edit_default_prices',
108 108
 				),
109 109
 			'update_price'	=> array(
110 110
 					'func' => '_insert_or_update_price',
111
-					'args' => array( 'new_price' => FALSE ),
111
+					'args' => array('new_price' => FALSE),
112 112
 					'noheader' => TRUE,
113 113
 					'capability' => 'ee_edit_default_price',
114 114
 					'obj_id' => $prc_id
115 115
 				),
116 116
 			'trash_price'	=> array(
117 117
 					'func' => '_trash_or_restore_price',
118
-					'args' => array( 'trash' => TRUE ),
118
+					'args' => array('trash' => TRUE),
119 119
 					'noheader' => TRUE,
120 120
 					'capability' => 'ee_delete_default_price',
121 121
 					'obj_id' => $prc_id
122 122
 				),
123 123
 			'restore_price'	=> array(
124 124
 					'func' => '_trash_or_restore_price',
125
-					'args' => array( 'trash' => FALSE ),
125
+					'args' => array('trash' => FALSE),
126 126
 					'noheader' => TRUE,
127 127
 					'capability' => 'ee_delete_default_price',
128 128
 					'obj_id' => $prc_id
@@ -154,27 +154,27 @@  discard block
 block discarded – undo
154 154
 				),
155 155
 			'insert_price_type'	=> array(
156 156
 					'func' => '_insert_or_update_price_type',
157
-					'args' => array( 'new_price_type' => TRUE ),
157
+					'args' => array('new_price_type' => TRUE),
158 158
 					'noheader' => TRUE,
159 159
 					'capability' => 'ee_edit_default_price_types'
160 160
 				),
161 161
 			'update_price_type' => array(
162 162
 					'func' => '_insert_or_update_price_type',
163
-					'args' => array( 'new_price_type' => FALSE ),
163
+					'args' => array('new_price_type' => FALSE),
164 164
 					'noheader' => TRUE,
165 165
 					'capability' => 'ee_edit_default_price_type',
166 166
 					'obj_id' => $prt_id
167 167
 				),
168 168
 			'trash_price_type'	=> array(
169 169
 					'func' => '_trash_or_restore_price_type',
170
-					'args' => array( 'trash' => TRUE ),
170
+					'args' => array('trash' => TRUE),
171 171
 					'noheader' => TRUE,
172 172
 					'capability' => 'ee_delete_default_price_type',
173 173
 					'obj_id' => $prt_id
174 174
 				),
175 175
 			'restore_price_type'	=> array(
176 176
 					'func' => '_trash_or_restore_price_type',
177
-					'args' => array( 'trash' => FALSE ),
177
+					'args' => array('trash' => FALSE),
178 178
 					'noheader' => TRUE,
179 179
 					'capability' => 'ee_delete_default_price_type',
180 180
 					'obj_id' => $prt_id
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
 							'filename' => 'pricing_default_pricing_views_bulk_actions_search'
215 215
 							)
216 216
 						),
217
-					'help_tour' => array( 'Pricing_Default_Prices_Help_Tour'),
217
+					'help_tour' => array('Pricing_Default_Prices_Help_Tour'),
218 218
 					'require_nonce' => FALSE
219 219
 				),
220 220
 			'add_new_price' => array(
@@ -230,24 +230,24 @@  discard block
 block discarded – undo
230 230
 							)
231 231
 						),
232 232
                     'help_tour' => array('Pricing_Add_New_Default_Price_Help_Tour'),
233
-					'metaboxes' => array( '_publish_post_box', '_espresso_news_post_box', '_price_details_meta_boxes' ),
233
+					'metaboxes' => array('_publish_post_box', '_espresso_news_post_box', '_price_details_meta_boxes'),
234 234
 					'require_nonce' => FALSE
235 235
 				),
236 236
 			'edit_price' => array(
237 237
 					'nav' => array(
238 238
 							'label' => __('Edit Default Price', 'event_espresso'),
239 239
 							'order' => 20,
240
-							'url' => isset($this->_req_data['id']) ? add_query_arg(array('id' => $this->_req_data['id'] ), $this->_current_page_view_url )  : $this->_admin_base_url,
240
+							'url' => isset($this->_req_data['id']) ? add_query_arg(array('id' => $this->_req_data['id']), $this->_current_page_view_url) : $this->_admin_base_url,
241 241
 							'persistent' => FALSE
242 242
 						),
243
-					'metaboxes' => array( '_publish_post_box', '_espresso_news_post_box', '_price_details_meta_boxes' ),
243
+					'metaboxes' => array('_publish_post_box', '_espresso_news_post_box', '_price_details_meta_boxes'),
244 244
                     'help_tabs' => array(
245 245
 						'edit_default_price_help_tab' => array(
246 246
 							'title' => __('Edit Default Price', 'event_espresso'),
247 247
 							'filename' => 'pricing_edit_default_price'
248 248
 							)
249 249
 						),
250
-					'help_tour' => array( 'Pricing_Edit_Default_Price_Help_Tour' ),
250
+					'help_tour' => array('Pricing_Edit_Default_Price_Help_Tour'),
251 251
 					'require_nonce' => FALSE
252 252
 				),
253 253
 			'price_types' => array(
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
 							'filename' => 'pricing_price_types_views_bulk_actions_search'
271 271
 							),
272 272
 						),
273
-					'help_tour' => array( 'Pricing_Price_Types_Default_Help_Tour' ),
273
+					'help_tour' => array('Pricing_Price_Types_Default_Help_Tour'),
274 274
 					'metaboxes' => array('_espresso_news_post_box', '_espresso_links_post_box'),
275 275
 					'require_nonce' => FALSE
276 276
 				),
@@ -286,8 +286,8 @@  discard block
 block discarded – undo
286 286
 							'filename' => 'pricing_add_new_price_type'
287 287
 							)
288 288
 						),
289
-                    'help_tour' => array( 'Pricing_Add_New_Price_Type_Help_Tour' ),
290
-					'metaboxes' => array( '_publish_post_box', '_espresso_news_post_box', '_price_type_details_meta_boxes' ),
289
+                    'help_tour' => array('Pricing_Add_New_Price_Type_Help_Tour'),
290
+					'metaboxes' => array('_publish_post_box', '_espresso_news_post_box', '_price_type_details_meta_boxes'),
291 291
 					'require_nonce' => FALSE
292 292
 				),
293 293
 			'edit_price_type' => array(
@@ -302,8 +302,8 @@  discard block
 block discarded – undo
302 302
 							'filename' => 'pricing_edit_price_type'
303 303
 							)
304 304
 						),
305
-                    'help_tour' => array( 'Pricing_Edit_Price_Type_Help_Tour' ),
306
-					'metaboxes' => array( '_publish_post_box', '_espresso_news_post_box', '_price_type_details_meta_boxes' ),
305
+                    'help_tour' => array('Pricing_Edit_Price_Type_Help_Tour'),
306
+					'metaboxes' => array('_publish_post_box', '_espresso_news_post_box', '_price_type_details_meta_boxes'),
307 307
 
308 308
 					'require_nonce' => FALSE
309 309
 				)
@@ -340,7 +340,7 @@  discard block
 block discarded – undo
340 340
 	public function load_scripts_styles() {
341 341
 		//styles
342 342
 		wp_enqueue_style('espresso-ui-theme');
343
-		wp_register_style( 'espresso_PRICING', PRICING_ASSETS_URL . 'espresso_pricing_admin.css', array(), EVENT_ESPRESSO_VERSION );
343
+		wp_register_style('espresso_PRICING', PRICING_ASSETS_URL.'espresso_pricing_admin.css', array(), EVENT_ESPRESSO_VERSION);
344 344
 		wp_enqueue_style('espresso_PRICING');
345 345
 
346 346
 		//scripts
@@ -350,8 +350,8 @@  discard block
 block discarded – undo
350 350
 		//wp_enqueue_script('jquery-ui-dialog');
351 351
 		//wp_enqueue_script('jquery-ui-draggable');
352 352
 		//wp_enqueue_script('jquery-ui-datepicker');
353
-		wp_register_script( 'espresso_PRICING', PRICING_ASSETS_URL . 'espresso_pricing_admin.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE );
354
-		wp_enqueue_script( 'espresso_PRICING' );
353
+		wp_register_script('espresso_PRICING', PRICING_ASSETS_URL.'espresso_pricing_admin.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE);
354
+		wp_enqueue_script('espresso_PRICING');
355 355
 	}
356 356
 
357 357
 
@@ -359,7 +359,7 @@  discard block
 block discarded – undo
359 359
 
360 360
 
361 361
 	public function load_scripts_styles_default() {
362
-		wp_enqueue_script( 'espresso_ajax_table_sorting' );
362
+		wp_enqueue_script('espresso_ajax_table_sorting');
363 363
 	}
364 364
 
365 365
 
@@ -387,7 +387,7 @@  discard block
 block discarded – undo
387 387
 				)
388 388
 		);
389 389
 
390
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_default_prices', 'pricing_trash_price' ) ) {
390
+		if (EE_Registry::instance()->CAP->current_user_can('ee_delete_default_prices', 'pricing_trash_price')) {
391 391
 			$this->_views['trashed'] = array(
392 392
 					'slug' => 'trashed',
393 393
 					'label' => __('Trash', 'event_espresso'),
@@ -417,7 +417,7 @@  discard block
 block discarded – undo
417 417
 				)
418 418
 		);
419 419
 
420
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_default_price_types', 'pricing_trash_price_type' ) ) {
420
+		if (EE_Registry::instance()->CAP->current_user_can('ee_delete_default_price_types', 'pricing_trash_price_type')) {
421 421
 			 $this->_views['trashed'] = array(
422 422
 					'slug' => 'trashed',
423 423
 					'label' => __('Trash', 'event_espresso'),
@@ -456,18 +456,18 @@  discard block
 block discarded – undo
456 456
 	* 	@param  boolean $trashed   whether the current view is of the trash can - eww yuck!
457 457
 	* 	@return mixed (int|array)  int = count || array of price objects
458 458
 	*/
459
-	public function get_prices_overview_data( $per_page = 10, $count = FALSE, $trashed = FALSE ) {
459
+	public function get_prices_overview_data($per_page = 10, $count = FALSE, $trashed = FALSE) {
460 460
 
461
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
461
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
462 462
 		// start with an empty array
463 463
 		$event_pricing = array();
464 464
 
465
-		require_once( PRICING_ADMIN . 'Prices_List_Table.class.php' );
466
-		require_once(EE_MODELS . 'EEM_Price.model.php');
465
+		require_once(PRICING_ADMIN.'Prices_List_Table.class.php');
466
+		require_once(EE_MODELS.'EEM_Price.model.php');
467 467
 		//$PRC = EEM_Price::instance();
468 468
 
469 469
 		$this->_req_data['orderby'] = empty($this->_req_data['orderby']) ? '' : $this->_req_data['orderby'];
470
-		$order = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'ASC';
470
+		$order = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'ASC';
471 471
 
472 472
 		switch ($this->_req_data['orderby']) {
473 473
 			case 'name':
@@ -480,27 +480,27 @@  discard block
 block discarded – undo
480 480
 				$orderby = array('PRC_amount'=>$order);
481 481
 				break;
482 482
 			default:
483
-				$orderby = array( 'PRC_order'=>$order, 'Price_Type.PRT_order'=>$order, 'PRC_ID'=>$order);
483
+				$orderby = array('PRC_order'=>$order, 'Price_Type.PRT_order'=>$order, 'PRC_ID'=>$order);
484 484
 		}
485 485
 
486
-		$current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1;
487
-		$per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page;
486
+		$current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1;
487
+		$per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page;
488 488
 
489 489
 		$_where = array(
490 490
 				'PRC_is_default' => 1,
491 491
 				'PRC_deleted' => $trashed
492 492
 				);
493 493
 
494
-		$offset = ($current_page-1)*$per_page;
495
-		$limit = array( $offset, $per_page );
494
+		$offset = ($current_page - 1) * $per_page;
495
+		$limit = array($offset, $per_page);
496 496
 
497
-		if ( isset( $this->_req_data['s'] ) ) {
498
-			$sstr = '%' . $this->_req_data['s'] . '%';
497
+		if (isset($this->_req_data['s'])) {
498
+			$sstr = '%'.$this->_req_data['s'].'%';
499 499
 			$_where['OR'] = array(
500
-				'PRC_name' => array('LIKE',$sstr ),
501
-				'PRC_desc' => array('LIKE',$sstr ),
502
-				'PRC_amount' => array( 'LIKE',$sstr ),
503
-				'Price_Type.PRT_name' => array( 'LIKE', $sstr )
500
+				'PRC_name' => array('LIKE', $sstr),
501
+				'PRC_desc' => array('LIKE', $sstr),
502
+				'PRC_amount' => array('LIKE', $sstr),
503
+				'Price_Type.PRT_name' => array('LIKE', $sstr)
504 504
 				);
505 505
 		}
506 506
 
@@ -511,9 +511,9 @@  discard block
 block discarded – undo
511 511
 			'group_by'=>'PRC_ID'
512 512
 			);
513 513
 
514
-		if($count){
515
-			return $trashed ? EEM_Price::instance()->count( array( $_where ) ) : EEM_Price::instance()->count_deleted_and_undeleted(array($_where));
516
-		}else{
514
+		if ($count) {
515
+			return $trashed ? EEM_Price::instance()->count(array($_where)) : EEM_Price::instance()->count_deleted_and_undeleted(array($_where));
516
+		} else {
517 517
 			return EEM_Price::instance()->get_all_deleted_and_undeleted($query_params);
518 518
 		}
519 519
 	}
@@ -529,40 +529,40 @@  discard block
 block discarded – undo
529 529
 	*		@return void
530 530
 	*/
531 531
 	protected function _edit_price_details() {
532
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
532
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
533 533
 		// grab price ID
534
-		$PRC_ID = isset( $this->_req_data['id'] ) && ! empty( $this->_req_data['id'] ) ? absint( $this->_req_data['id'] ) : FALSE;
534
+		$PRC_ID = isset($this->_req_data['id']) && ! empty($this->_req_data['id']) ? absint($this->_req_data['id']) : FALSE;
535 535
 		// change page title based on request action
536
-		$this->_admin_page_title = ucwords( str_replace( '_', ' ', $this->_req_action ));
536
+		$this->_admin_page_title = ucwords(str_replace('_', ' ', $this->_req_action));
537 537
 		// add PRC_ID to title if editing
538
-		$this->_admin_page_title = $PRC_ID ? $this->_admin_page_title . ' # ' . $PRC_ID : $this->_admin_page_title;
538
+		$this->_admin_page_title = $PRC_ID ? $this->_admin_page_title.' # '.$PRC_ID : $this->_admin_page_title;
539 539
 
540 540
 		// get prices
541
-		require_once(EE_MODELS . 'EEM_Price.model.php');
541
+		require_once(EE_MODELS.'EEM_Price.model.php');
542 542
 		$PRC = EEM_Price::instance();
543 543
 
544
-		if ( $PRC_ID ) {
545
-			$price = $PRC->get_one_by_ID( $PRC_ID );
544
+		if ($PRC_ID) {
545
+			$price = $PRC->get_one_by_ID($PRC_ID);
546 546
 			$additional_hidden_fields = array(
547
-					'PRC_ID' => array( 'type' => 'hidden', 'value' => $PRC_ID )
547
+					'PRC_ID' => array('type' => 'hidden', 'value' => $PRC_ID)
548 548
 				);
549
-			$this->_set_add_edit_form_tags( 'update_price', $additional_hidden_fields );
549
+			$this->_set_add_edit_form_tags('update_price', $additional_hidden_fields);
550 550
 		} else {
551 551
 			$price = $PRC->get_new_price();
552
-			$this->_set_add_edit_form_tags( 'insert_price' );
552
+			$this->_set_add_edit_form_tags('insert_price');
553 553
 		}
554 554
 
555 555
 		$this->_template_args['PRC_ID'] = $PRC_ID;
556 556
 		$this->_template_args['price'] = $price;
557 557
 
558 558
 		// get price types
559
-		require_once(EE_MODELS . 'EEM_Price_Type.model.php');
559
+		require_once(EE_MODELS.'EEM_Price_Type.model.php');
560 560
 		$PRT = EEM_Price_Type::instance();
561
-		$price_types = $PRT->get_all( array( array('PBT_ID' => array('!=', 1 ) ) ) );
561
+		$price_types = $PRT->get_all(array(array('PBT_ID' => array('!=', 1))));
562 562
 		$price_type_names = array();
563 563
 		if (empty($price_types)) {
564
-			$msg = __( 'You have no price types defined. Please add a price type before adding a price.', 'event_espresso' );
565
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
564
+			$msg = __('You have no price types defined. Please add a price type before adding a price.', 'event_espresso');
565
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
566 566
 			exit();
567 567
 		} else {
568 568
 			foreach ($price_types as $type) {
@@ -575,7 +575,7 @@  discard block
 block discarded – undo
575 575
 		$this->_template_args['price_types'] = $price_type_names;
576 576
 		$this->_template_args['learn_more_about_pricing_link'] = $this->_learn_more_about_pricing_link();
577 577
 
578
-		$this->_set_publish_post_box_vars( 'id', $PRC_ID );
578
+		$this->_set_publish_post_box_vars('id', $PRC_ID);
579 579
 		// the details template wrapper
580 580
 		$this->display_admin_page_with_sidebar();
581 581
 	}
@@ -591,7 +591,7 @@  discard block
 block discarded – undo
591 591
 	*		@return void
592 592
 	*/
593 593
 	protected function _price_details_meta_boxes() {
594
-		add_meta_box( 'edit-price-details-mbox', __( 'Default Price Details', 'event_espresso' ), array( $this, '_edit_price_details_meta_box' ), $this->wp_page_slug, 'normal', 'high' );
594
+		add_meta_box('edit-price-details-mbox', __('Default Price Details', 'event_espresso'), array($this, '_edit_price_details_meta_box'), $this->wp_page_slug, 'normal', 'high');
595 595
 	}
596 596
 
597 597
 
@@ -605,7 +605,7 @@  discard block
 block discarded – undo
605 605
 	*		@return void
606 606
 	*/
607 607
 	public function _edit_price_details_meta_box() {
608
-		echo EEH_Template::display_template( PRICING_TEMPLATE_PATH . 'pricing_details_main_meta_box.template.php', $this->_template_args, TRUE );
608
+		echo EEH_Template::display_template(PRICING_TEMPLATE_PATH.'pricing_details_main_meta_box.template.php', $this->_template_args, TRUE);
609 609
 	}
610 610
 
611 611
 
@@ -619,7 +619,7 @@  discard block
 block discarded – undo
619 619
 	*/
620 620
 	protected function set_price_column_values() {
621 621
 
622
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
622
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
623 623
 
624 624
 		$set_column_values = array(
625 625
 				'PRT_ID' => absint($this->_req_data['PRT_ID']),
@@ -647,12 +647,12 @@  discard block
 block discarded – undo
647 647
 	*		@access protected
648 648
 	*		@return void
649 649
 	*/
650
-	protected function _insert_or_update_price( $insert = FALSE ) {
650
+	protected function _insert_or_update_price($insert = FALSE) {
651 651
 
652 652
 		//echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>';
653
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
653
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
654 654
 
655
-		require_once(EE_MODELS . 'EEM_Price.model.php');
655
+		require_once(EE_MODELS.'EEM_Price.model.php');
656 656
 		$PRC = EEM_Price::instance();
657 657
 
658 658
 		// why be so pessimistic ???  : (
@@ -660,14 +660,14 @@  discard block
 block discarded – undo
660 660
 
661 661
 		$set_column_values = $this->set_price_column_values();
662 662
 		// is this a new Price ?
663
-		if ( $insert ) {
663
+		if ($insert) {
664 664
 			// run the insert
665
-			if ( $PRC_ID = $PRC->insert( $set_column_values )) {
665
+			if ($PRC_ID = $PRC->insert($set_column_values)) {
666 666
 				//make sure this new price modifier is attached to the ticket but ONLY if it is not a tax type
667 667
 				$PR = EEM_price::instance()->get_one_by_ID($PRC_ID);
668
-				if ( $PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax ) {
668
+				if ($PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax) {
669 669
 					$ticket = EEM_Ticket::instance()->get_one_by_ID(1);
670
-					$ticket->_add_relation_to( $PR, 'Price' );
670
+					$ticket->_add_relation_to($PR, 'Price');
671 671
 					$ticket->save();
672 672
 				}
673 673
 				$success = 1;
@@ -677,29 +677,29 @@  discard block
 block discarded – undo
677 677
 			}
678 678
 			$action_desc = 'created';
679 679
 		} else {
680
-			$PRC_ID = absint( $this->_req_data['PRC_ID'] );
680
+			$PRC_ID = absint($this->_req_data['PRC_ID']);
681 681
 			// run the update
682
-			$where_cols_n_values = array( 'PRC_ID' => $PRC_ID );
683
-			if ( $PRC->update( $set_column_values, array($where_cols_n_values))) {
682
+			$where_cols_n_values = array('PRC_ID' => $PRC_ID);
683
+			if ($PRC->update($set_column_values, array($where_cols_n_values))) {
684 684
 				$success = 1;
685 685
 			}
686 686
 
687 687
 			$PR = EEM_Price::instance()->get_one_by_ID($PRC_ID);
688
-			if ( $PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax ) {
688
+			if ($PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax) {
689 689
 
690 690
 				//if this is $PRC_ID == 1, then we need to update the default ticket attached to this price so the TKT_price value is updated.
691
-				if ( $PRC_ID === 1 ) {
691
+				if ($PRC_ID === 1) {
692 692
 					$ticket = $PR->get_first_related('Ticket');
693
-					if ( $ticket ) {
694
-						$ticket->set('TKT_price', $PR->get('PRC_amount') );
695
-						$ticket->set('TKT_name', $PR->get('PRC_name') );
693
+					if ($ticket) {
694
+						$ticket->set('TKT_price', $PR->get('PRC_amount'));
695
+						$ticket->set('TKT_name', $PR->get('PRC_name'));
696 696
 						$ticket->set('TKT_description', $PR->get('PRC_desc'));
697 697
 						$ticket->save();
698 698
 					}
699 699
 				} else {
700 700
 					//we make sure this price is attached to base ticket. but ONLY if its not a tax ticket type.
701 701
 					$ticket = EEM_Ticket::instance()->get_one_by_ID(1);
702
-					$ticket->_add_relation_to( $PRC_ID, 'Price' );
702
+					$ticket->_add_relation_to($PRC_ID, 'Price');
703 703
 					$ticket->save();
704 704
 				}
705 705
 			}
@@ -707,9 +707,9 @@  discard block
 block discarded – undo
707 707
 			$action_desc = 'updated';
708 708
 		}
709 709
 
710
-		$query_args = array( 'action' => 'edit_price', 'id' => $PRC_ID );
710
+		$query_args = array('action' => 'edit_price', 'id' => $PRC_ID);
711 711
 
712
-		$this->_redirect_after_action( $success, 'Prices', $action_desc, $query_args );
712
+		$this->_redirect_after_action($success, 'Prices', $action_desc, $query_args);
713 713
 
714 714
 	}
715 715
 
@@ -723,12 +723,12 @@  discard block
 block discarded – undo
723 723
 	*		@access protected
724 724
 	*		@return void
725 725
 	*/
726
-	protected function _trash_or_restore_price( $trash = TRUE ) {
726
+	protected function _trash_or_restore_price($trash = TRUE) {
727 727
 
728 728
 		//echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>';
729
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
729
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
730 730
 
731
-		require_once(EE_MODELS . 'EEM_Price.model.php');
731
+		require_once(EE_MODELS.'EEM_Price.model.php');
732 732
 		$PRC = EEM_Price::instance();
733 733
 
734 734
 		$success = 1;
@@ -737,18 +737,18 @@  discard block
 block discarded – undo
737 737
 		//get base ticket for updating
738 738
 		$ticket = EEM_Ticket::instance()->get_one_by_ID(1);
739 739
 		//Checkboxes
740
-		if (!empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
740
+		if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
741 741
 			// if array has more than one element than success message should be plural
742
-			$success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1;
742
+			$success = count($this->_req_data['checkbox']) > 1 ? 2 : 1;
743 743
 			// cycle thru checkboxes
744
-			while (list( $PRC_ID, $value ) = each($this->_req_data['checkbox'])) {
745
-				if ( ! $PRC->update_by_ID(array('PRC_deleted' => $PRC_deleted), absint($PRC_ID) ) ) {
744
+			while (list($PRC_ID, $value) = each($this->_req_data['checkbox'])) {
745
+				if ( ! $PRC->update_by_ID(array('PRC_deleted' => $PRC_deleted), absint($PRC_ID))) {
746 746
 					$success = 0;
747 747
 				} else {
748 748
 					$PR = EEM_Price::instance()->get_one_by_ID($PRC_ID);
749
-					if ( $PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax ) {
749
+					if ($PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax) {
750 750
 						//if trashing then remove relations to base default ticket.  If restoring then add back to base default ticket
751
-						if ( $PRC_deleted ) {
751
+						if ($PRC_deleted) {
752 752
 							$ticket->_remove_relation_to($PRC_ID, 'Price');
753 753
 						} else {
754 754
 							$ticket->_add_relation_to($PRC_ID, 'Price');
@@ -760,14 +760,14 @@  discard block
 block discarded – undo
760 760
 
761 761
 		} else {
762 762
 			// grab single id and delete
763
-			$PRC_ID = isset( $this->_req_data['id'] ) ? absint($this->_req_data['id']) : 0;
764
-			if ( empty( $PRC_ID ) || ! $PRC->update_by_ID(array('PRC_deleted' => $PRC_deleted), $PRC_ID) ) {
763
+			$PRC_ID = isset($this->_req_data['id']) ? absint($this->_req_data['id']) : 0;
764
+			if (empty($PRC_ID) || ! $PRC->update_by_ID(array('PRC_deleted' => $PRC_deleted), $PRC_ID)) {
765 765
 				$success = 0;
766 766
 			} else {
767 767
 				$PR = EEM_Price::instance()->get_one_by_ID($PRC_ID);
768
-				if ( $PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax ) {
768
+				if ($PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax) {
769 769
 					//if trashing then remove relations to base default ticket.  If restoring then add back to base default ticket
770
-					if ( $PRC_deleted ) {
770
+					if ($PRC_deleted) {
771 771
 						$ticket->_remove_relation_to($PRC_ID, 'Price');
772 772
 					} else {
773 773
 						$ticket->_add_relation_to($PRC_ID, 'Price');
@@ -781,17 +781,17 @@  discard block
 block discarded – undo
781 781
 			'action' => 'default'
782 782
 			);
783 783
 
784
-		if ( $success ) {
785
-			if ( $trash ) {
784
+		if ($success) {
785
+			if ($trash) {
786 786
 				$msg = $success == 2 ? __('The Prices have been trashed.', 'event_espresso') : __('The Price has been trashed.', 'event_espresso');
787 787
 			} else {
788 788
 				$msg = $success == 2 ? __('The Prices have been restored.', 'event_espresso') : __('The Price has been restored.', 'event_espresso');
789 789
 			}
790 790
 
791
-			EE_Error::add_success( $msg );
791
+			EE_Error::add_success($msg);
792 792
 		}
793 793
 
794
-		$this->_redirect_after_action( FALSE, '', '', $query_args, TRUE );
794
+		$this->_redirect_after_action(FALSE, '', '', $query_args, TRUE);
795 795
 
796 796
 	}
797 797
 
@@ -808,19 +808,19 @@  discard block
 block discarded – undo
808 808
 	protected function _delete_price() {
809 809
 
810 810
 		//echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>';
811
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
811
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
812 812
 
813
-		require_once(EE_MODELS . 'EEM_Price.model.php');
813
+		require_once(EE_MODELS.'EEM_Price.model.php');
814 814
 		$PRC = EEM_Price::instance();
815 815
 
816 816
 		$success = 1;
817 817
 		//Checkboxes
818
-		if (!empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
818
+		if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
819 819
 			// if array has more than one element than success message should be plural
820
-			$success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1;
820
+			$success = count($this->_req_data['checkbox']) > 1 ? 2 : 1;
821 821
 			// cycle thru bulk action checkboxes
822
-			while (list( $PRC_ID, $value ) = each($this->_req_data['checkbox'])) {
823
-				if (!$PRC->delete_permanently_by_ID(absint($PRC_ID))) {
822
+			while (list($PRC_ID, $value) = each($this->_req_data['checkbox'])) {
823
+				if ( ! $PRC->delete_permanently_by_ID(absint($PRC_ID))) {
824 824
 					$success = 0;
825 825
 				}
826 826
 			}
@@ -834,7 +834,7 @@  discard block
 block discarded – undo
834 834
 
835 835
 		}
836 836
 
837
-		$this->_redirect_after_action( $success, 'Prices', 'deleted', array() );
837
+		$this->_redirect_after_action($success, 'Prices', 'deleted', array());
838 838
 
839 839
 	}
840 840
 
@@ -842,16 +842,16 @@  discard block
 block discarded – undo
842 842
 
843 843
 
844 844
 	public function update_price_order() {
845
-		$success = __( 'Price order was updated successfully.', 'event_espresso' );
845
+		$success = __('Price order was updated successfully.', 'event_espresso');
846 846
 
847 847
 		// grab our row IDs
848
-		$row_ids = isset( $this->_req_data['row_ids'] ) && ! empty( $this->_req_data['row_ids'] ) ? explode( ',', rtrim( $this->_req_data['row_ids'], ',' )) : FALSE;
848
+		$row_ids = isset($this->_req_data['row_ids']) && ! empty($this->_req_data['row_ids']) ? explode(',', rtrim($this->_req_data['row_ids'], ',')) : FALSE;
849 849
 
850
-		if ( is_array( $row_ids )) {
851
-			for ( $i = 0; $i < count( $row_ids ); $i++ ) {
850
+		if (is_array($row_ids)) {
851
+			for ($i = 0; $i < count($row_ids); $i++) {
852 852
 				//Update the prices when re-ordering
853 853
 				$id = absint($row_ids[$i]);
854
-				if ( EEM_Price::instance()->update ( array( 'PRC_order' => $i+1 ), array(array( 'PRC_ID' => $id ) )) === FALSE ) {
854
+				if (EEM_Price::instance()->update(array('PRC_order' => $i + 1), array(array('PRC_ID' => $id))) === FALSE) {
855 855
 					$success = FALSE;
856 856
 				}
857 857
 			}
@@ -859,9 +859,9 @@  discard block
 block discarded – undo
859 859
 			$success = FALSE;
860 860
 		}
861 861
 
862
-		$errors = ! $success ? __( 'An error occurred. The price order was not updated.', 'event_espresso' ) : FALSE;
862
+		$errors = ! $success ? __('An error occurred. The price order was not updated.', 'event_espresso') : FALSE;
863 863
 
864
-		echo json_encode( array( 'return_data' => FALSE, 'success' => $success, 'errors' => $errors ));
864
+		echo json_encode(array('return_data' => FALSE, 'success' => $success, 'errors' => $errors));
865 865
 		die();
866 866
 	}
867 867
 
@@ -904,46 +904,46 @@  discard block
 block discarded – undo
904 904
 	* 	@param  boolean $trashed   whether the current view is of the trash can - eww yuck!
905 905
 	* 	@return mixed (int|array)  int = count || array of price objects
906 906
 	*/
907
-	public function get_price_types_overview_data( $per_page = 10, $count = FALSE, $trashed = FALSE ) {
907
+	public function get_price_types_overview_data($per_page = 10, $count = FALSE, $trashed = FALSE) {
908 908
 
909
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
909
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
910 910
 		// start with an empty array
911 911
 
912
-		require_once( PRICING_ADMIN . 'Price_Types_List_Table.class.php' );
913
-		require_once( EE_MODELS . 'EEM_Price_Type.model.php' );
912
+		require_once(PRICING_ADMIN.'Price_Types_List_Table.class.php');
913
+		require_once(EE_MODELS.'EEM_Price_Type.model.php');
914 914
 
915 915
 		$this->_req_data['orderby'] = empty($this->_req_data['orderby']) ? '' : $this->_req_data['orderby'];
916
-		$order = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'ASC';
916
+		$order = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'ASC';
917 917
 		switch ($this->_req_data['orderby']) {
918 918
 			case 'name':
919
-				$orderby = array( 'PRT_name' => $order);
919
+				$orderby = array('PRT_name' => $order);
920 920
 				break;
921 921
 			default:
922
-				$orderby = array( 'PRT_order' => $order);
922
+				$orderby = array('PRT_order' => $order);
923 923
 		}
924 924
 
925 925
 
926
-		$current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1;
927
-		$per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page;
926
+		$current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1;
927
+		$per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page;
928 928
 
929
-		$offset = ($current_page-1)*$per_page;
930
-		$limit = array( $offset, $per_page );
929
+		$offset = ($current_page - 1) * $per_page;
930
+		$limit = array($offset, $per_page);
931 931
 
932
-		$_where = array('PRT_deleted'=>$trashed, 'PBT_ID' => array('!=', 1 ) );
932
+		$_where = array('PRT_deleted'=>$trashed, 'PBT_ID' => array('!=', 1));
933 933
 
934
-		if ( isset( $this->_req_data['s'] ) ) {
935
-			$sstr = '%' . $this->_req_data['s'] . '%';
934
+		if (isset($this->_req_data['s'])) {
935
+			$sstr = '%'.$this->_req_data['s'].'%';
936 936
 			$_where['OR'] = array(
937
-				'PRT_name' => array( 'LIKE', $sstr )
937
+				'PRT_name' => array('LIKE', $sstr)
938 938
 				);
939 939
 		}
940 940
 		$query_params = array(
941 941
 			$_where,
942 942
 			'order_by'=>$orderby,
943 943
 			'limit'=>$limit);
944
-		if($count){
944
+		if ($count) {
945 945
 			return EEM_Price_Type::instance()->count_deleted_and_undeleted($query_params);
946
-		}else{
946
+		} else {
947 947
 			return EEM_Price_Type::instance()->get_all_deleted_and_undeleted($query_params);
948 948
 		}
949 949
 
@@ -963,25 +963,25 @@  discard block
 block discarded – undo
963 963
 	*/
964 964
 	protected function _edit_price_type_details() {
965 965
 
966
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
966
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
967 967
 
968 968
 
969 969
 		// grab price type ID
970
-		$PRT_ID = isset( $this->_req_data['id'] ) && ! empty( $this->_req_data['id'] ) ? absint( $this->_req_data['id'] ) : FALSE;
970
+		$PRT_ID = isset($this->_req_data['id']) && ! empty($this->_req_data['id']) ? absint($this->_req_data['id']) : FALSE;
971 971
 		// change page title based on request action
972
-		$this->_admin_page_title = ucwords( str_replace( '_', ' ', $this->_req_action ));
972
+		$this->_admin_page_title = ucwords(str_replace('_', ' ', $this->_req_action));
973 973
 		// add PRT_ID to title if editing
974
-		$this->_admin_page_title = $PRT_ID ? $this->_admin_page_title . ' # ' . $PRT_ID : $this->_admin_page_title;
974
+		$this->_admin_page_title = $PRT_ID ? $this->_admin_page_title.' # '.$PRT_ID : $this->_admin_page_title;
975 975
 
976 976
 //		require_once(EE_MODELS . 'EEM_Price_Type.model.php');
977 977
 
978
-		if ( $PRT_ID ) {
979
-			$price_type = EEM_Price_Type::instance()->get_one_by_ID( $PRT_ID );
980
-			$additional_hidden_fields = array( 'PRT_ID' => array( 'type' => 'hidden', 'value' => $PRT_ID ));
981
-			$this->_set_add_edit_form_tags( 'update_price_type', $additional_hidden_fields );
978
+		if ($PRT_ID) {
979
+			$price_type = EEM_Price_Type::instance()->get_one_by_ID($PRT_ID);
980
+			$additional_hidden_fields = array('PRT_ID' => array('type' => 'hidden', 'value' => $PRT_ID));
981
+			$this->_set_add_edit_form_tags('update_price_type', $additional_hidden_fields);
982 982
 		} else {
983 983
 			$price_type = EEM_Price_Type::instance()->get_new_price_type();
984
-			$this->_set_add_edit_form_tags( 'insert_price_type' );
984
+			$this->_set_add_edit_form_tags('insert_price_type');
985 985
 		}
986 986
 
987 987
 		$this->_template_args['PRT_ID'] = $PRT_ID;
@@ -990,19 +990,19 @@  discard block
 block discarded – undo
990 990
 
991 991
 		$base_types = EEM_Price_Type::instance()->get_base_types();
992 992
 		$select_values = array();
993
-		foreach ( $base_types as $ref => $text ) {
994
-			if ( $ref == EEM_Price_Type::base_type_base_price ) {
993
+		foreach ($base_types as $ref => $text) {
994
+			if ($ref == EEM_Price_Type::base_type_base_price) {
995 995
 				//do not allow creation of base_type_base_prices because that's a system only base type.
996 996
 				continue;
997 997
 			}
998
-			$values[] = array( 'id' => $ref, 'text' => $text );
998
+			$values[] = array('id' => $ref, 'text' => $text);
999 999
 		}
1000 1000
 
1001 1001
 
1002 1002
 		$this->_template_args['base_type_select'] = EEH_Form_Fields::select_input('base_type', $values, $price_type->base_type(), 'id="price-type-base-type-slct"');
1003 1003
 		$this->_template_args['learn_more_about_pricing_link'] = $this->_learn_more_about_pricing_link();
1004
-		$redirect_URL = add_query_arg( array( 'action' => 'price_types'), $this->_admin_base_url );
1005
-		$this->_set_publish_post_box_vars( 'id', $PRT_ID, FALSE, $redirect_URL );
1004
+		$redirect_URL = add_query_arg(array('action' => 'price_types'), $this->_admin_base_url);
1005
+		$this->_set_publish_post_box_vars('id', $PRT_ID, FALSE, $redirect_URL);
1006 1006
 		// the details template wrapper
1007 1007
 		$this->display_admin_page_with_sidebar();
1008 1008
 
@@ -1019,7 +1019,7 @@  discard block
 block discarded – undo
1019 1019
 	*		@return void
1020 1020
 	*/
1021 1021
 	protected function _price_type_details_meta_boxes() {
1022
-		add_meta_box( 'edit-price-details-mbox', __( 'Price Type Details', 'event_espresso' ), array( $this, '_edit_price_type_details_meta_box' ), $this->wp_page_slug, 'normal', 'high' );
1022
+		add_meta_box('edit-price-details-mbox', __('Price Type Details', 'event_espresso'), array($this, '_edit_price_type_details_meta_box'), $this->wp_page_slug, 'normal', 'high');
1023 1023
 	}
1024 1024
 
1025 1025
 
@@ -1032,7 +1032,7 @@  discard block
 block discarded – undo
1032 1032
 	*		@return void
1033 1033
 	*/
1034 1034
 	public function _edit_price_type_details_meta_box() {
1035
-		echo EEH_Template::display_template( PRICING_TEMPLATE_PATH . 'pricing_type_details_main_meta_box.template.php', $this->_template_args, TRUE );
1035
+		echo EEH_Template::display_template(PRICING_TEMPLATE_PATH.'pricing_type_details_main_meta_box.template.php', $this->_template_args, TRUE);
1036 1036
 	}
1037 1037
 
1038 1038
 
@@ -1045,9 +1045,9 @@  discard block
 block discarded – undo
1045 1045
 	*/
1046 1046
 	protected function set_price_type_column_values() {
1047 1047
 
1048
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
1048
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1049 1049
 
1050
-		$base_type = !empty( $this->_req_data['base_type'] ) ? $this->_req_data['base_type'] : EEM_Price_Type::base_type_base_price;
1050
+		$base_type = ! empty($this->_req_data['base_type']) ? $this->_req_data['base_type'] : EEM_Price_Type::base_type_base_price;
1051 1051
 
1052 1052
 		switch ($base_type) {
1053 1053
 
@@ -1094,12 +1094,12 @@  discard block
 block discarded – undo
1094 1094
 	*		@access protected
1095 1095
 	*		@return void
1096 1096
 	*/
1097
-	protected function _insert_or_update_price_type( $new_price_type = FALSE ) {
1097
+	protected function _insert_or_update_price_type($new_price_type = FALSE) {
1098 1098
 
1099 1099
 //		echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>';
1100
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
1100
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1101 1101
 
1102
-		require_once(EE_MODELS . 'EEM_Price_Type.model.php');
1102
+		require_once(EE_MODELS.'EEM_Price_Type.model.php');
1103 1103
 		$PRT = EEM_Price_Type::instance();
1104 1104
 
1105 1105
 		// why be so pessimistic ???  : (
@@ -1107,24 +1107,24 @@  discard block
 block discarded – undo
1107 1107
 
1108 1108
 		$set_column_values = $this->set_price_type_column_values();
1109 1109
 		// is this a new Price ?
1110
-		if ( $new_price_type ) {
1110
+		if ($new_price_type) {
1111 1111
 			// run the insert
1112
-			if ( $PRT_ID = $PRT->insert( $set_column_values )) {
1112
+			if ($PRT_ID = $PRT->insert($set_column_values)) {
1113 1113
 				$success = 1;
1114 1114
 			}
1115 1115
 			$action_desc = 'created';
1116 1116
 		} else {
1117 1117
 			$PRT_ID = absint($this->_req_data['PRT_ID']);
1118 1118
 			// run the update
1119
-			$where_cols_n_values = array('PRT_ID' => $PRT_ID );
1120
-			if ( $PRT->update( $set_column_values, array( $where_cols_n_values ))) {
1119
+			$where_cols_n_values = array('PRT_ID' => $PRT_ID);
1120
+			if ($PRT->update($set_column_values, array($where_cols_n_values))) {
1121 1121
 				$success = 1;
1122 1122
 			}
1123 1123
 			$action_desc = 'updated';
1124 1124
 		}
1125 1125
 
1126
-		$query_args = array( 'action'=> 'edit_price_type', 'id' => $PRT_ID );
1127
-		$this->_redirect_after_action( $success, 'Price Type', $action_desc, $query_args );
1126
+		$query_args = array('action'=> 'edit_price_type', 'id' => $PRT_ID);
1127
+		$this->_redirect_after_action($success, 'Price Type', $action_desc, $query_args);
1128 1128
 
1129 1129
 	}
1130 1130
 
@@ -1138,49 +1138,49 @@  discard block
 block discarded – undo
1138 1138
 	*		@access protected
1139 1139
 	*		@return void
1140 1140
 	*/
1141
-	protected function _trash_or_restore_price_type( $trash = TRUE ) {
1141
+	protected function _trash_or_restore_price_type($trash = TRUE) {
1142 1142
 
1143 1143
 		//echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>';
1144
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
1144
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1145 1145
 
1146
-		require_once(EE_MODELS . 'EEM_Price_Type.model.php');
1146
+		require_once(EE_MODELS.'EEM_Price_Type.model.php');
1147 1147
 		$PRT = EEM_Price_Type::instance();
1148 1148
 
1149 1149
 		$success = 1;
1150 1150
 		$PRT_deleted = $trash ? TRUE : FALSE;
1151 1151
 		//Checkboxes
1152
-		if (!empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
1152
+		if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
1153 1153
 			// if array has more than one element than success message should be plural
1154
-			$success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1;
1155
-			$what = count( $this->_req_data['checkbox'] ) > 1 ? 'Price Types' : 'Price Type';
1154
+			$success = count($this->_req_data['checkbox']) > 1 ? 2 : 1;
1155
+			$what = count($this->_req_data['checkbox']) > 1 ? 'Price Types' : 'Price Type';
1156 1156
 			// cycle thru checkboxes
1157
-			while (list( $PRT_ID, $value ) = each($this->_req_data['checkbox'])) {
1158
-				if ( ! $PRT->update_by_ID(array('PRT_deleted' => $PRT_deleted), $PRT_ID ) ) {
1157
+			while (list($PRT_ID, $value) = each($this->_req_data['checkbox'])) {
1158
+				if ( ! $PRT->update_by_ID(array('PRT_deleted' => $PRT_deleted), $PRT_ID)) {
1159 1159
 					$success = 0;
1160 1160
 				}
1161 1161
 			}
1162 1162
 
1163 1163
 		} else {
1164 1164
 			// grab single id and delete
1165
-			$PRT_ID = isset( $this->_req_data['id'] ) ? absint($this->_req_data['id']) : 0;
1166
-			if ( empty( $PRT_ID ) || ! $PRT->update_by_ID(array('PRT_deleted' => $PRT_deleted), $PRT_ID )) {
1165
+			$PRT_ID = isset($this->_req_data['id']) ? absint($this->_req_data['id']) : 0;
1166
+			if (empty($PRT_ID) || ! $PRT->update_by_ID(array('PRT_deleted' => $PRT_deleted), $PRT_ID)) {
1167 1167
 				$success = 0;
1168 1168
 			}
1169 1169
 			$what = 'Price Type';
1170 1170
 
1171 1171
 		}
1172 1172
 
1173
-		$query_args = array( 'action' => 'price_types' );
1174
-		if ( $success ) {
1175
-			if ( $trash ) {
1173
+		$query_args = array('action' => 'price_types');
1174
+		if ($success) {
1175
+			if ($trash) {
1176 1176
 				$msg = $success > 1 ? __('The Price Types have been trashed.', 'event_espresso') : __('The Price Type has been trashed.', 'event_espresso');
1177 1177
 			} else {
1178 1178
 				$msg = $success > 1 ? __('The Price Types have been restored.', 'event_espresso') : __('The Price Type has been restored.', 'event_espresso');
1179 1179
 			}
1180
-			EE_Error::add_success( $msg );
1180
+			EE_Error::add_success($msg);
1181 1181
 		}
1182 1182
 
1183
-		$this->_redirect_after_action( FALSE, '', '', $query_args, TRUE );
1183
+		$this->_redirect_after_action(FALSE, '', '', $query_args, TRUE);
1184 1184
 
1185 1185
 	}
1186 1186
 
@@ -1197,19 +1197,19 @@  discard block
 block discarded – undo
1197 1197
 	protected function _delete_price_type() {
1198 1198
 
1199 1199
 		//echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>';
1200
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
1200
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1201 1201
 
1202 1202
 		$PRT = EEM_Price_Type::instance();
1203 1203
 
1204 1204
 		$success = 1;
1205 1205
 		//Checkboxes
1206
-		if (!empty($this->_req_data['checkbox'])) {
1206
+		if ( ! empty($this->_req_data['checkbox'])) {
1207 1207
 			// if array has more than one element than success message should be plural
1208
-			$success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1;
1208
+			$success = count($this->_req_data['checkbox']) > 1 ? 2 : 1;
1209 1209
 			$what = $PRT->item_name($success);
1210 1210
 			// cycle thru bulk action checkboxes
1211
-			while (list( $PRT_ID, $value ) = each($this->_req_data['checkbox'])) {
1212
-				if (!$PRT->delete_permanently_by_ID($PRT_ID) ) {
1211
+			while (list($PRT_ID, $value) = each($this->_req_data['checkbox'])) {
1212
+				if ( ! $PRT->delete_permanently_by_ID($PRT_ID)) {
1213 1213
 					$success = 0;
1214 1214
 				}
1215 1215
 			}
@@ -1217,8 +1217,8 @@  discard block
 block discarded – undo
1217 1217
 		}
1218 1218
 
1219 1219
 
1220
-		$query_args = array( 'action'=> 'price_types' );
1221
-		$this->_redirect_after_action( $success, $what, 'deleted', $query_args );
1220
+		$query_args = array('action'=> 'price_types');
1221
+		$this->_redirect_after_action($success, $what, 'deleted', $query_args);
1222 1222
 
1223 1223
 	}
1224 1224
 
@@ -1234,7 +1234,7 @@  discard block
 block discarded – undo
1234 1234
 	*		@return string
1235 1235
 	*/
1236 1236
 	protected function _learn_more_about_pricing_link() {
1237
-		return '<a class="hidden" style="margin:0 20px; cursor:pointer; font-size:12px;" >' . __('learn more about how pricing works', 'event_espresso') . '</a>';
1237
+		return '<a class="hidden" style="margin:0 20px; cursor:pointer; font-size:12px;" >'.__('learn more about how pricing works', 'event_espresso').'</a>';
1238 1238
 	}
1239 1239
 
1240 1240
 
Please login to merge, or discard this patch.
caffeinated/payment_methods/Paypal_Pro/EEG_Paypal_Pro.gateway.php 1 patch
Spacing   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if (!defined('EVENT_ESPRESSO_VERSION'))
3
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
4 4
 	exit('No direct script access allowed');
5 5
 
6 6
 /**
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
  *
26 26
  * ------------------------------------------------------------------------
27 27
  */
28
-class EEG_Paypal_Pro extends EE_Onsite_Gateway{
28
+class EEG_Paypal_Pro extends EE_Onsite_Gateway {
29 29
 	/**
30 30
 	 *
31 31
 	 * @var $_paypal_api_username string
@@ -88,21 +88,21 @@  discard block
 block discarded – undo
88 88
 	 * } @see parent::do_direct_payment for more info
89 89
 	 * @return \EE_Payment|\EEI_Payment
90 90
 	 */
91
-	public function do_direct_payment($payment,$billing_info = null){
91
+	public function do_direct_payment($payment, $billing_info = null) {
92 92
 		$transaction = $payment->transaction();
93 93
 		$primary_registrant = $transaction->primary_registration();
94
-		$order_description  = sprintf(__("Event Registrations from %s", "event_espresso"),get_bloginfo('name'));
94
+		$order_description  = sprintf(__("Event Registrations from %s", "event_espresso"), get_bloginfo('name'));
95 95
 		//charge for the full amount. Show itemized list
96
-		if( $this->_can_easily_itemize_transaction_for( $payment ) ){
96
+		if ($this->_can_easily_itemize_transaction_for($payment)) {
97 97
 			$item_num = 1;
98 98
 			$total_line_item = $transaction->total_line_item();
99 99
 			$order_items = array();
100 100
 			foreach ($total_line_item->get_items() as $line_item) {
101 101
 				$item = array(
102 102
 						// Item Name.  127 char max.
103
-						'l_name' => substr($line_item->name(),0,127),
103
+						'l_name' => substr($line_item->name(), 0, 127),
104 104
 						// Item description.  127 char max.
105
-						'l_desc' => substr($line_item->desc(),0,127),
105
+						'l_desc' => substr($line_item->desc(), 0, 127),
106 106
 						// Cost of individual item.
107 107
 						'l_amt' => $line_item->unit_price(),
108 108
 						// Item Number.  127 char max.
@@ -123,14 +123,14 @@  discard block
 block discarded – undo
123 123
 			}
124 124
 			$item_amount = $total_line_item->get_items_total();
125 125
 			$tax_amount = $total_line_item->get_total_tax();
126
-		}else{
126
+		} else {
127 127
 			$order_items = array();
128 128
 			$item_amount = $payment->amount();
129
-			$single_item_desc = sprintf(__("Partial payment of %s for %s", "event_espresso"),$payment->amount(),$primary_registrant->reg_code());
129
+			$single_item_desc = sprintf(__("Partial payment of %s for %s", "event_espresso"), $payment->amount(), $primary_registrant->reg_code());
130 130
 			$tax_amount = 0;
131
-			array_push($order_items,array(
131
+			array_push($order_items, array(
132 132
 				// Item Name.  127 char max.
133
-				'l_name' => sprintf(__("Partial payment for registration: %s", 'event_espresso'),$primary_registrant->reg_code()),
133
+				'l_name' => sprintf(__("Partial payment for registration: %s", 'event_espresso'), $primary_registrant->reg_code()),
134 134
 				// Item description.  127 char max.
135 135
 				'l_desc' => $single_item_desc,
136 136
 				// Cost of individual item.
@@ -177,11 +177,11 @@  discard block
 block discarded – undo
177 177
 			// Payer's salutation.  20 char max.
178 178
 			'salutation' => '',
179 179
 			// Payer's first name.  25 char max.
180
-			'firstname' => substr($billing_info['first_name'],0,25),
180
+			'firstname' => substr($billing_info['first_name'], 0, 25),
181 181
 			// Payer's middle name.  25 char max.
182 182
 			'middlename' => '',
183 183
 			// Payer's last name.  25 char max.
184
-			'lastname' => substr($billing_info['last_name'],0,25),
184
+			'lastname' => substr($billing_info['last_name'], 0, 25),
185 185
 			// Payer's suffix.  12 char max.
186 186
 			'suffix' => ''
187 187
 		);
@@ -194,13 +194,13 @@  discard block
 block discarded – undo
194 194
 			// Required.  Name of City.
195 195
 			'city' => $billing_info['city'],
196 196
 			// Required. Name of State or Province.
197
-			'state' => substr( $billing_info['state'], 0, 40 ),
197
+			'state' => substr($billing_info['state'], 0, 40),
198 198
 			// Required.  Country code.
199 199
 			'countrycode' => $billing_info['country'],
200 200
 			// Required.  Postal code of payer.
201 201
 			'zip' => $billing_info['zip'],
202 202
 			// Phone Number of payer.  20 char max.
203
-			'shiptophonenum' => substr($billing_info['phone'],0,20)
203
+			'shiptophonenum' => substr($billing_info['phone'], 0, 20)
204 204
 		);
205 205
 
206 206
 
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
 			// Required.  Three-letter currency code.  Default is USD.
211 211
 			'currencycode' => $payment->currency_code(),
212 212
 			// Required if you include itemized cart details. (L_AMTn, etc.)  Subtotal of items not including S&H, or tax.
213
-			'itemamt' => $this->format_currency($item_amount),//
213
+			'itemamt' => $this->format_currency($item_amount), //
214 214
 			// Total shipping costs for the order.  If you specify shippingamt, you must also specify itemamt.
215 215
 			'shippingamt' => '',
216 216
 			// Total handling costs for the order.  If you specify handlingamt, you must also specify itemamt.
@@ -222,10 +222,10 @@  discard block
 block discarded – undo
222 222
 			// Free-form field for your own use.  256 char max.
223 223
 			'custom' => $primary_registrant ? $primary_registrant->ID() : '',
224 224
 			// Your own invoice or tracking number
225
-			'invnum' => wp_generate_password(12,false),//$transaction->ID(),
225
+			'invnum' => wp_generate_password(12, false), //$transaction->ID(),
226 226
 			// URL for receiving Instant Payment Notifications.  This overrides what your profile is set to use.
227 227
 			'notifyurl' => '',
228
-			'buttonsource' => 'EventEspresso_SP',//EE will blow up if you change this
228
+			'buttonsource' => 'EventEspresso_SP', //EE will blow up if you change this
229 229
 		);
230 230
 		// Wrap all data arrays into a single, "master" array which will be passed into the class function.
231 231
 		$PayPalRequestData = array(
@@ -238,32 +238,32 @@  discard block
 block discarded – undo
238 238
 				'OrderItems' => $order_items,
239 239
 		);
240 240
 		$this->_log_clean_request($PayPalRequestData, $payment);
241
-		try{
241
+		try {
242 242
 			$PayPalResult = $this->prep_and_curl_request($PayPalRequestData);
243 243
 			//remove PCI-sensitive data so it doesn't get stored
244
-			$PayPalResult = $this->_log_clean_response($PayPalResult,$payment);
244
+			$PayPalResult = $this->_log_clean_response($PayPalResult, $payment);
245 245
 
246 246
 			$message = isset($PayPalResult['L_LONGMESSAGE0']) ? $PayPalResult['L_LONGMESSAGE0'] : $PayPalResult['ACK'];
247
-			if( empty($PayPalResult[ 'RAWRESPONSE' ] ) ) {
248
-				$payment->set_status( $this->_pay_model->failed_status() ) ;
249
-				$payment->set_gateway_response( __( 'No response received from Paypal Pro', 'event_espresso' ) );
247
+			if (empty($PayPalResult['RAWRESPONSE'])) {
248
+				$payment->set_status($this->_pay_model->failed_status());
249
+				$payment->set_gateway_response(__('No response received from Paypal Pro', 'event_espresso'));
250 250
 				$payment->set_details($PayPalResult);
251
-			}else{
252
-				if($this->_APICallSuccessful($PayPalResult)){
251
+			} else {
252
+				if ($this->_APICallSuccessful($PayPalResult)) {
253 253
 					$payment->set_status($this->_pay_model->approved_status());
254
-				}else{
254
+				} else {
255 255
 					$payment->set_status($this->_pay_model->declined_status());
256 256
 				}
257 257
 				//make sure we interpret the AMT as a float, not an international string (where periods are thousand separators)
258
-				$payment->set_amount(isset($PayPalResult['AMT']) ? floatval( $PayPalResult['AMT'] ) : 0);
258
+				$payment->set_amount(isset($PayPalResult['AMT']) ? floatval($PayPalResult['AMT']) : 0);
259 259
 				$payment->set_gateway_response($message);
260
-				$payment->set_txn_id_chq_nmbr(isset( $PayPalResult['TRANSACTIONID'] )? $PayPalResult['TRANSACTIONID'] : null);
260
+				$payment->set_txn_id_chq_nmbr(isset($PayPalResult['TRANSACTIONID']) ? $PayPalResult['TRANSACTIONID'] : null);
261 261
 
262 262
 				$primary_registration_code = $primary_registrant instanceof EE_Registration ? $primary_registrant->reg_code() : '';
263 263
 				$payment->set_extra_accntng($primary_registration_code);
264 264
 				$payment->set_details($PayPalResult);
265 265
 			}
266
-		}catch(Exception $e){
266
+		} catch (Exception $e) {
267 267
 			$payment->set_status($this->_pay_model->failed_status());
268 268
 			$payment->set_gateway_response($e->getMessage());
269 269
 		}
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
 	 * @param EEI_Payment $payment
281 281
 	 * @return array
282 282
 	 */
283
-	private function _log_clean_request($request,$payment){
283
+	private function _log_clean_request($request, $payment) {
284 284
 		$cleaned_request_data = $request;
285 285
 		unset($cleaned_request_data['CCDetails']['acct']);
286 286
 		unset($cleaned_request_data['CCDetails']['cvv2']);
@@ -296,13 +296,13 @@  discard block
 block discarded – undo
296 296
 	 * @param EEI_Payment $payment
297 297
 	 * @return array cleaned
298 298
 	 */
299
-	private function _log_clean_response($response,$payment){
299
+	private function _log_clean_response($response, $payment) {
300 300
 		unset($response['REQUESTDATA']['CREDITCARDTYPE']);
301 301
 		unset($response['REQUESTDATA']['ACCT']);
302 302
 		unset($response['REQUESTDATA']['EXPDATE']);
303 303
 		unset($response['REQUESTDATA']['CVV2']);
304 304
 		unset($response['RAWREQUEST']);
305
-		$this->log(array('Paypal Response'=>$response),$payment);
305
+		$this->log(array('Paypal Response'=>$response), $payment);
306 306
 		return $response;
307 307
 	}
308 308
 
@@ -327,32 +327,32 @@  discard block
 block discarded – undo
327 327
 		// DP Fields
328 328
 		$DPFields = isset($DataArray['DPFields']) ? $DataArray['DPFields'] : array();
329 329
 		foreach ($DPFields as $DPFieldsVar => $DPFieldsVal)
330
-			$DPFieldsNVP .= '&' . strtoupper($DPFieldsVar) . '=' . urlencode($DPFieldsVal);
330
+			$DPFieldsNVP .= '&'.strtoupper($DPFieldsVar).'='.urlencode($DPFieldsVal);
331 331
 
332 332
 		// CC Details Fields
333 333
 		$CCDetails = isset($DataArray['CCDetails']) ? $DataArray['CCDetails'] : array();
334 334
 		foreach ($CCDetails as $CCDetailsVar => $CCDetailsVal)
335
-			$CCDetailsNVP .= '&' . strtoupper($CCDetailsVar) . '=' . urlencode($CCDetailsVal);
335
+			$CCDetailsNVP .= '&'.strtoupper($CCDetailsVar).'='.urlencode($CCDetailsVal);
336 336
 
337 337
 		// PayerInfo Type Fields
338 338
 		$PayerInfo = isset($DataArray['PayerInfo']) ? $DataArray['PayerInfo'] : array();
339 339
 		foreach ($PayerInfo as $PayerInfoVar => $PayerInfoVal)
340
-			$PayerInfoNVP .= '&' . strtoupper($PayerInfoVar) . '=' . urlencode($PayerInfoVal);
340
+			$PayerInfoNVP .= '&'.strtoupper($PayerInfoVar).'='.urlencode($PayerInfoVal);
341 341
 
342 342
 		// Payer Name Fields
343 343
 		$PayerName = isset($DataArray['PayerName']) ? $DataArray['PayerName'] : array();
344 344
 		foreach ($PayerName as $PayerNameVar => $PayerNameVal)
345
-			$PayerNameNVP .= '&' . strtoupper($PayerNameVar) . '=' . urlencode($PayerNameVal);
345
+			$PayerNameNVP .= '&'.strtoupper($PayerNameVar).'='.urlencode($PayerNameVal);
346 346
 
347 347
 		// Address Fields (Billing)
348 348
 		$BillingAddress = isset($DataArray['BillingAddress']) ? $DataArray['BillingAddress'] : array();
349 349
 		foreach ($BillingAddress as $BillingAddressVar => $BillingAddressVal)
350
-			$BillingAddressNVP .= '&' . strtoupper($BillingAddressVar) . '=' . urlencode($BillingAddressVal);
350
+			$BillingAddressNVP .= '&'.strtoupper($BillingAddressVar).'='.urlencode($BillingAddressVal);
351 351
 
352 352
 		// Payment Details Type Fields
353 353
 		$PaymentDetails = isset($DataArray['PaymentDetails']) ? $DataArray['PaymentDetails'] : array();
354 354
 		foreach ($PaymentDetails as $PaymentDetailsVar => $PaymentDetailsVal)
355
-			$PaymentDetailsNVP .= '&' . strtoupper($PaymentDetailsVar) . '=' . urlencode($PaymentDetailsVal);
355
+			$PaymentDetailsNVP .= '&'.strtoupper($PaymentDetailsVar).'='.urlencode($PaymentDetailsVal);
356 356
 
357 357
 		// Payment Details Item Type Fields
358 358
 		$OrderItems = isset($DataArray['OrderItems']) ? $DataArray['OrderItems'] : array();
@@ -360,22 +360,22 @@  discard block
 block discarded – undo
360 360
 		foreach ($OrderItems as $OrderItemsVar => $OrderItemsVal) {
361 361
 			$CurrentItem = $OrderItems[$OrderItemsVar];
362 362
 			foreach ($CurrentItem as $CurrentItemVar => $CurrentItemVal)
363
-				$OrderItemsNVP .= '&' . strtoupper($CurrentItemVar) . $n . '=' . urlencode($CurrentItemVal);
363
+				$OrderItemsNVP .= '&'.strtoupper($CurrentItemVar).$n.'='.urlencode($CurrentItemVal);
364 364
 			$n++;
365 365
 		}
366 366
 
367 367
 		// Ship To Address Fields
368 368
 		$ShippingAddress = isset($DataArray['ShippingAddress']) ? $DataArray['ShippingAddress'] : array();
369 369
 		foreach ($ShippingAddress as $ShippingAddressVar => $ShippingAddressVal)
370
-			$ShippingAddressNVP .= '&' . strtoupper($ShippingAddressVar) . '=' . urlencode($ShippingAddressVal);
370
+			$ShippingAddressNVP .= '&'.strtoupper($ShippingAddressVar).'='.urlencode($ShippingAddressVal);
371 371
 
372 372
 		// 3D Secure Fields
373 373
 		$Secure3D = isset($DataArray['Secure3D']) ? $DataArray['Secure3D'] : array();
374 374
 		foreach ($Secure3D as $Secure3DVar => $Secure3DVal)
375
-			$Secure3DNVP .= '&' . strtoupper($Secure3DVar) . '=' . urlencode($Secure3DVal);
375
+			$Secure3DNVP .= '&'.strtoupper($Secure3DVar).'='.urlencode($Secure3DVal);
376 376
 
377 377
 		// Now that we have each chunk we need to go ahead and append them all together for our entire NVP string
378
-		$NVPRequest = 'USER=' . $this->_username . '&PWD=' . $this->_password . '&VERSION=64.0' . '&SIGNATURE=' . $this->_signature . $DPFieldsNVP . $CCDetailsNVP . $PayerInfoNVP . $PayerNameNVP . $BillingAddressNVP . $PaymentDetailsNVP . $OrderItemsNVP . $ShippingAddressNVP . $Secure3DNVP;
378
+		$NVPRequest = 'USER='.$this->_username.'&PWD='.$this->_password.'&VERSION=64.0'.'&SIGNATURE='.$this->_signature.$DPFieldsNVP.$CCDetailsNVP.$PayerInfoNVP.$PayerNameNVP.$BillingAddressNVP.$PaymentDetailsNVP.$OrderItemsNVP.$ShippingAddressNVP.$Secure3DNVP;
379 379
 		$NVPResponse = $this->_CURLRequest($NVPRequest);
380 380
 		$NVPRequestArray = $this->_NVPToArray($NVPRequest);
381 381
 		$NVPResponseArray = $this->_NVPToArray($NVPResponse);
@@ -399,7 +399,7 @@  discard block
 block discarded – undo
399 399
 	private function _CURLRequest($Request) {
400 400
 		$EndPointURL = $this->_debug_mode ? 'https://api-3t.sandbox.paypal.com/nvp' : 'https://api-3t.paypal.com/nvp';
401 401
 		$curl = curl_init();
402
-		curl_setopt($curl, CURLOPT_VERBOSE, apply_filters('FHEE__EEG_Paypal_Pro__CurlRequest__CURLOPT_VERBOSE', TRUE ) );
402
+		curl_setopt($curl, CURLOPT_VERBOSE, apply_filters('FHEE__EEG_Paypal_Pro__CurlRequest__CURLOPT_VERBOSE', TRUE));
403 403
 		curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
404 404
 		curl_setopt($curl, CURLOPT_TIMEOUT, 60);
405 405
 		curl_setopt($curl, CURLOPT_URL, $EndPointURL);
@@ -449,9 +449,9 @@  discard block
 block discarded – undo
449 449
 	private function _APICallSuccessful($PayPalResult) {
450 450
 		$approved = false;
451 451
 		// check main response message from PayPal
452
-		if (isset($PayPalResult['ACK']) && !empty($PayPalResult['ACK'])) {
452
+		if (isset($PayPalResult['ACK']) && ! empty($PayPalResult['ACK'])) {
453 453
 			$ack = strtoupper($PayPalResult['ACK']);
454
-			$approved = ( $ack == 'SUCCESS' || $ack == 'SUCCESSWITHWARNING' || $ack == 'PARTIALSUCCESS' ) ? true : false;
454
+			$approved = ($ack == 'SUCCESS' || $ack == 'SUCCESSWITHWARNING' || $ack == 'PARTIALSUCCESS') ? true : false;
455 455
 		}
456 456
 
457 457
 		return $approved;
@@ -467,11 +467,11 @@  discard block
 block discarded – undo
467 467
 
468 468
 		$Errors = array();
469 469
 		$n = 0;
470
-		while (isset($DataArray['L_ERRORCODE' . $n . ''])) {
471
-			$LErrorCode = isset($DataArray['L_ERRORCODE' . $n . '']) ? $DataArray['L_ERRORCODE' . $n . ''] : '';
472
-			$LShortMessage = isset($DataArray['L_SHORTMESSAGE' . $n . '']) ? $DataArray['L_SHORTMESSAGE' . $n . ''] : '';
473
-			$LLongMessage = isset($DataArray['L_LONGMESSAGE' . $n . '']) ? $DataArray['L_LONGMESSAGE' . $n . ''] : '';
474
-			$LSeverityCode = isset($DataArray['L_SEVERITYCODE' . $n . '']) ? $DataArray['L_SEVERITYCODE' . $n . ''] : '';
470
+		while (isset($DataArray['L_ERRORCODE'.$n.''])) {
471
+			$LErrorCode = isset($DataArray['L_ERRORCODE'.$n.'']) ? $DataArray['L_ERRORCODE'.$n.''] : '';
472
+			$LShortMessage = isset($DataArray['L_SHORTMESSAGE'.$n.'']) ? $DataArray['L_SHORTMESSAGE'.$n.''] : '';
473
+			$LLongMessage = isset($DataArray['L_LONGMESSAGE'.$n.'']) ? $DataArray['L_LONGMESSAGE'.$n.''] : '';
474
+			$LSeverityCode = isset($DataArray['L_SEVERITYCODE'.$n.'']) ? $DataArray['L_SEVERITYCODE'.$n.''] : '';
475 475
 
476 476
 			$CurrentItem = array(
477 477
 					'L_ERRORCODE' => $LErrorCode,
@@ -511,7 +511,7 @@  discard block
 block discarded – undo
511 511
 				elseif ($CurrentErrorVar == 'L_SEVERITYCODE')
512 512
 					$CurrentVarName = 'Severity Code';
513 513
 
514
-				$error .= '<br />' . $CurrentVarName . ': ' . $CurrentErrorVal;
514
+				$error .= '<br />'.$CurrentVarName.': '.$CurrentErrorVal;
515 515
 			}
516 516
 		}
517 517
 		return $error;
Please login to merge, or discard this patch.
core/db_models/fields/EE_Post_Content_Field.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -3,18 +3,18 @@
 block discarded – undo
3 3
  * Field to only allow tags that are normally allowed on post_content:
4 4
  * address,a,abbr,acronym,area,article,aside,b,big,blockquote,br,button,caption,cite,code,col,del,dd,dfn,details,div,dl,dt,em,fieldset,figure,figcaption,font,footer,form,h1,h2,h3,h4,h5,h6,header,hgroup,hr,i,img,ins,kbd,label,legend,li,map,mark,menu,nav,p,pre,q,s,samp,span,section,small,strike,strong,sub,summary,sup,table,tbody,td,textarea,tfoot,th,thead,title,tr,tt,u,ul,ol,var
5 5
  */
6
-class EE_Post_Content_Field extends EE_Full_HTML_Field{
6
+class EE_Post_Content_Field extends EE_Full_HTML_Field {
7 7
 	/**
8 8
 	 * removes all tags which a WP Post wouldn't allow in its content normally
9 9
 	 * @param string $value_inputted_for_field_on_model_object
10 10
 	 * @return string
11 11
 	 */
12 12
 	function prepare_for_set($value_inputted_for_field_on_model_object) {
13
-		$value_with_select_tags =  wp_kses("$value_inputted_for_field_on_model_object",wp_kses_allowed_html( 'post' ));
13
+		$value_with_select_tags = wp_kses("$value_inputted_for_field_on_model_object", wp_kses_allowed_html('post'));
14 14
 		return parent::prepare_for_set($value_with_select_tags);
15 15
 	}
16 16
 	
17
-	function prepare_for_set_from_db($value_found_in_db_for_model_object){
17
+	function prepare_for_set_from_db($value_found_in_db_for_model_object) {
18 18
 		return $value_found_in_db_for_model_object;
19 19
 	}
20 20
 }
21 21
\ No newline at end of file
Please login to merge, or discard this patch.
core/libraries/batch/JobHandlerBaseClasses/JobHandlerFile.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -16,8 +16,8 @@  discard block
 block discarded – undo
16 16
 
17 17
 use EventEspressoBatchRequest\Helpers\BatchRequestException;
18 18
 
19
-if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
20
-	exit( 'No direct script access allowed' );
19
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
20
+	exit('No direct script access allowed');
21 21
 }
22 22
 
23 23
 
@@ -39,8 +39,8 @@  discard block
 block discarded – undo
39 39
 	 *
40 40
 	 * @param \EEHI_File|null $file_helper
41 41
 	 */
42
-	public function __construct( \EEHI_File $file_helper = null ) {
43
-		if( ! $file_helper ) {
42
+	public function __construct(\EEHI_File $file_helper = null) {
43
+		if ( ! $file_helper) {
44 44
 			$this->_file_helper = new \EEH_File();
45 45
 		}
46 46
 	}
@@ -56,39 +56,39 @@  discard block
 block discarded – undo
56 56
 	 * @return string
57 57
 	 * @throws \EventEspressoBatchRequest\Helpers\BatchRequestException
58 58
 	 */
59
-	public function create_file_from_job_with_name( $job_id, $filename, $filetype = 'application/ms-excel' ) {
59
+	public function create_file_from_job_with_name($job_id, $filename, $filetype = 'application/ms-excel') {
60 60
 		$filepath = '';
61
-		try{
61
+		try {
62 62
 			$success = $this->_file_helper->ensure_folder_exists_and_is_writable(
63
-				EVENT_ESPRESSO_UPLOAD_DIR . JobHandlerFile::temp_folder_name
63
+				EVENT_ESPRESSO_UPLOAD_DIR.JobHandlerFile::temp_folder_name
64 64
 			);
65
-			if ( $success ) {
65
+			if ($success) {
66 66
 				$success = $this->_file_helper->ensure_folder_exists_and_is_writable(
67
-					EVENT_ESPRESSO_UPLOAD_DIR . JobHandlerFile::temp_folder_name . DS . $job_id
67
+					EVENT_ESPRESSO_UPLOAD_DIR.JobHandlerFile::temp_folder_name.DS.$job_id
68 68
 				);
69 69
 			}
70
-			if( $success ) {
71
-				$filepath = EVENT_ESPRESSO_UPLOAD_DIR . JobHandlerFile::temp_folder_name . DS . $job_id . DS. $filename;
72
-				$success = $this->_file_helper->ensure_file_exists_and_is_writable( $filepath );
70
+			if ($success) {
71
+				$filepath = EVENT_ESPRESSO_UPLOAD_DIR.JobHandlerFile::temp_folder_name.DS.$job_id.DS.$filename;
72
+				$success = $this->_file_helper->ensure_file_exists_and_is_writable($filepath);
73 73
 			}
74 74
 			//let's add the .htaccess file so safari will open the file properly
75
-			if( $success ) {
76
-				$extension = \EEH_File::get_file_extension( $filepath );
75
+			if ($success) {
76
+				$extension = \EEH_File::get_file_extension($filepath);
77 77
 				\EEH_File::write_to_file(
78
-					EVENT_ESPRESSO_UPLOAD_DIR . JobHandlerFile::temp_folder_name . DS . $job_id . DS . '.htaccess',
79
-					'AddType ' . $filetype . ' ' . $extension,
78
+					EVENT_ESPRESSO_UPLOAD_DIR.JobHandlerFile::temp_folder_name.DS.$job_id.DS.'.htaccess',
79
+					'AddType '.$filetype.' '.$extension,
80 80
 					'.htaccess'
81 81
 				);
82 82
 			}
83 83
 			//those methods normally fail with an exception, but if not, let's do it
84
-			if( ! $success ) {
85
-				throw new \EE_Error( 'could_not_create_temp_file',
86
-				__( 'An unknown error occurred', 'event_espresso' ));
84
+			if ( ! $success) {
85
+				throw new \EE_Error('could_not_create_temp_file',
86
+				__('An unknown error occurred', 'event_espresso'));
87 87
 			}
88
-		} catch( \EE_Error $e ) {
88
+		} catch (\EE_Error $e) {
89 89
 			throw new BatchRequestException(
90 90
 				sprintf(
91
-					__( 'Could not create temporary file for job %1$s, because: %2$s ', 'event_espresso' ),
91
+					__('Could not create temporary file for job %1$s, because: %2$s ', 'event_espresso'),
92 92
 					$job_id,
93 93
 					$e->getMessage()
94 94
 				),
@@ -104,8 +104,8 @@  discard block
 block discarded – undo
104 104
 	 * @param string $filepath
105 105
 	 * @return string url to file
106 106
 	 */
107
-	public function get_url_to_file( $filepath ) {
108
-		return str_replace( EVENT_ESPRESSO_UPLOAD_DIR, EVENT_ESPRESSO_UPLOAD_URL, $filepath );
107
+	public function get_url_to_file($filepath) {
108
+		return str_replace(EVENT_ESPRESSO_UPLOAD_DIR, EVENT_ESPRESSO_UPLOAD_URL, $filepath);
109 109
 	}
110 110
 }
111 111
 
Please login to merge, or discard this patch.
core/libraries/rest_api/controllers/model/Meta.php 1 patch
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 namespace EventEspresso\core\libraries\rest_api\controllers\model;
3
-if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) {
4
-	exit( 'No direct script access allowed' );
3
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
4
+	exit('No direct script access allowed');
5 5
 }
6 6
 
7 7
 /**
@@ -18,75 +18,75 @@  discard block
 block discarded – undo
18 18
 class Meta extends Base {
19 19
 
20 20
 
21
-	public static function handle_request_models_meta( \WP_REST_Request $request ) {
21
+	public static function handle_request_models_meta(\WP_REST_Request $request) {
22 22
 		$controller = new Meta();
23 23
 		$matches = $controller->parse_route( 
24 24
 			$request->get_route(), 
25
-			'~' . \EED_Core_Rest_Api::ee_api_namespace_for_regex . 'resources~', 
26
-			array( 'version' ) ); 
27
-		if( $matches instanceof \WP_REST_Response ) {
25
+			'~'.\EED_Core_Rest_Api::ee_api_namespace_for_regex.'resources~', 
26
+			array('version') ); 
27
+		if ($matches instanceof \WP_REST_Response) {
28 28
 			return $matches;
29 29
 		}
30
-		$controller->set_requested_version( $matches[ 'version' ] );
31
-		return $controller->send_response( $controller->_get_models_metadata_entity() );
30
+		$controller->set_requested_version($matches['version']);
31
+		return $controller->send_response($controller->_get_models_metadata_entity());
32 32
 	}
33 33
 
34 34
 	/*
35 35
 	 * Gets the model metadata resource entity
36 36
 	 * @return array for JSON response, describing all the models available in teh requested version
37 37
 	 */
38
-	protected function _get_models_metadata_entity(){
38
+	protected function _get_models_metadata_entity() {
39 39
 		$response = array();
40
-		foreach( $this->get_model_version_info()->models_for_requested_version() as $model_name => $model_classname ){
41
-			$model = $this->get_model_version_info()->load_model( $model_name );
40
+		foreach ($this->get_model_version_info()->models_for_requested_version() as $model_name => $model_classname) {
41
+			$model = $this->get_model_version_info()->load_model($model_name);
42 42
 			$fields_json = array();
43
-			foreach( $this->get_model_version_info()->fields_on_model_in_this_version( $model ) as $field_name => $field_obj ) {
44
-				if( $this->get_model_version_info()->field_is_ignored( $field_obj ) ) {
43
+			foreach ($this->get_model_version_info()->fields_on_model_in_this_version($model) as $field_name => $field_obj) {
44
+				if ($this->get_model_version_info()->field_is_ignored($field_obj)) {
45 45
 					continue;
46 46
 				}
47
-				if( $field_obj instanceof \EE_Boolean_Field ) {
47
+				if ($field_obj instanceof \EE_Boolean_Field) {
48 48
 					$datatype = 'Boolean';
49
-				}elseif( $field_obj->get_wpdb_data_type() == '%d' ) {
49
+				}elseif ($field_obj->get_wpdb_data_type() == '%d') {
50 50
 					$datatype = 'Number';
51
-				}elseif( $field_name instanceof \EE_Serialized_Text_Field ) {
51
+				}elseif ($field_name instanceof \EE_Serialized_Text_Field) {
52 52
 					$datatype = 'Object';
53
-				}else{
53
+				} else {
54 54
 					$datatype = 'String';
55 55
 				}
56 56
 				$default_value = $field_obj->get_default_value();
57
-				if( $default_value === EE_INF ) {
57
+				if ($default_value === EE_INF) {
58 58
 					$default_value = EE_INF_IN_DB;
59
-				} elseif( $field_obj instanceof \EE_Datetime_Field &&
60
-					$default_value instanceof \DateTime ) {
61
-					$default_value = $default_value->format( 'c' );
59
+				} elseif ($field_obj instanceof \EE_Datetime_Field &&
60
+					$default_value instanceof \DateTime) {
61
+					$default_value = $default_value->format('c');
62 62
 				}
63 63
 				$field_json = array(
64 64
 					'name' => $field_name,
65 65
 					'nicename' => $field_obj->get_nicename(),
66
-					'has_rendered_format' => $this->get_model_version_info()->field_has_rendered_format( $field_obj ),
67
-					'has_pretty_format' => $this->get_model_version_info()->field_has_pretty_format( $field_obj ),
68
-					'type' => str_replace('EE_', '', get_class( $field_obj ) ),
66
+					'has_rendered_format' => $this->get_model_version_info()->field_has_rendered_format($field_obj),
67
+					'has_pretty_format' => $this->get_model_version_info()->field_has_pretty_format($field_obj),
68
+					'type' => str_replace('EE_', '', get_class($field_obj)),
69 69
 					'datatype' => $datatype,
70 70
 					'nullable' => $field_obj->is_nullable(),
71 71
 					'default' => $default_value,
72 72
 					'table_alias' => $field_obj->get_table_alias(),
73 73
 					'table_column' => $field_obj->get_table_column(),
74 74
 				);
75
-				$fields_json[ $field_json[ 'name' ] ] = $field_json;
75
+				$fields_json[$field_json['name']] = $field_json;
76 76
 
77 77
 			}
78
-			$fields_json = array_merge( $fields_json, $this->get_model_version_info()->extra_resource_properties_for_model( $model ) );
79
-			$response[ $model_name ]['fields'] = apply_filters( 'FHEE__Meta__handle_request_models_meta__fields', $fields_json, $model );
78
+			$fields_json = array_merge($fields_json, $this->get_model_version_info()->extra_resource_properties_for_model($model));
79
+			$response[$model_name]['fields'] = apply_filters('FHEE__Meta__handle_request_models_meta__fields', $fields_json, $model);
80 80
 			$relations_json = array();
81
-			foreach( $model->relation_settings()  as $relation_name => $relation_obj ) {
81
+			foreach ($model->relation_settings()  as $relation_name => $relation_obj) {
82 82
 				$relation_json = array(
83 83
 					'name' => $relation_name,
84
-					'type' => str_replace( 'EE_', '', get_class( $relation_obj ) ),
84
+					'type' => str_replace('EE_', '', get_class($relation_obj)),
85 85
 					'single' => $relation_obj instanceof \EE_Belongs_To_Relation ? true : false,
86 86
 				);
87
-				$relations_json[ $relation_name ] = $relation_json;
87
+				$relations_json[$relation_name] = $relation_json;
88 88
 			}
89
-			$response[ $model_name ][ 'relations' ] = apply_filters( 'FHEE__Meta__handle_request_models_meta__relations', $relations_json, $model );
89
+			$response[$model_name]['relations'] = apply_filters('FHEE__Meta__handle_request_models_meta__relations', $relations_json, $model);
90 90
 		}
91 91
 		return $response;
92 92
 	}
@@ -96,23 +96,23 @@  discard block
 block discarded – undo
96 96
 	 * @param WP_REST_Response $rest_response_obj
97 97
 	 * @return WP_REST_Response
98 98
 	 */
99
-	public static function filter_ee_metadata_into_index( $rest_response_obj ) {
99
+	public static function filter_ee_metadata_into_index($rest_response_obj) {
100 100
 		$response_data = $rest_response_obj->get_data();
101 101
 		$addons = array();
102
-		foreach( \EE_Registry::instance()->addons as $addon){
102
+		foreach (\EE_Registry::instance()->addons as $addon) {
103 103
 			$addon_json = array(
104 104
 				'name' => $addon->name(),
105 105
 				'version' => $addon->version()
106 106
 			);
107
-			$addons[ $addon_json[ 'name' ] ] = $addon_json;
107
+			$addons[$addon_json['name']] = $addon_json;
108 108
 		}
109
-		$response_data[ 'ee' ] = array(
109
+		$response_data['ee'] = array(
110 110
 			'version' => \EEM_System_Status::instance()->get_ee_version(),
111 111
 			'addons' => $addons,
112 112
 			'maintenance_mode' => \EE_Maintenance_Mode::instance()->real_level(),
113
-			'served_core_versions' => array_keys( \EED_Core_Rest_Api::versions_served() )
113
+			'served_core_versions' => array_keys(\EED_Core_Rest_Api::versions_served())
114 114
 		);
115
-		$rest_response_obj->set_data( $response_data );
115
+		$rest_response_obj->set_data($response_data);
116 116
 		return $rest_response_obj;
117 117
 	}
118 118
 }
Please login to merge, or discard this patch.
core/EE_Capabilities.core.php 1 patch
Spacing   +127 added lines, -127 removed lines patch added patch discarded remove patch
@@ -7,8 +7,8 @@  discard block
 block discarded – undo
7 7
  * @package Event Espresso
8 8
  * @subpackage core, capabilities
9 9
  */
10
-if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
11
-	exit( 'No direct script access allowed' );
10
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
11
+	exit('No direct script access allowed');
12 12
 }
13 13
 
14 14
 
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 	 */
70 70
 	public static function instance() {
71 71
 		//check if instantiated, and if not do so.
72
-		if ( ! self::$_instance instanceof EE_Capabilities ) {
72
+		if ( ! self::$_instance instanceof EE_Capabilities) {
73 73
 			self::$_instance = new self();
74 74
 		}
75 75
 		return self::$_instance;
@@ -98,10 +98,10 @@  discard block
 block discarded – undo
98 98
 	 * @since 4.5.0
99 99
 	 * @return void
100 100
 	 */
101
-	public function init_caps( $reset = false ) {
102
-		if ( EE_Maintenance_Mode::instance()->models_can_query() ){
101
+	public function init_caps($reset = false) {
102
+		if (EE_Maintenance_Mode::instance()->models_can_query()) {
103 103
 			$this->_caps_map = $this->_init_caps_map();
104
-			$this->init_role_caps( $reset );
104
+			$this->init_role_caps($reset);
105 105
 			$this->_set_meta_caps();
106 106
 		}
107 107
 	}
@@ -120,11 +120,11 @@  discard block
 block discarded – undo
120 120
 		//make sure we're only ever initializing the default _meta_caps array once if it's empty.
121 121
 		$this->_meta_caps = $this->_get_default_meta_caps_array();
122 122
 
123
-		$this->_meta_caps = apply_filters( 'FHEE__EE_Capabilities___set_meta_caps__meta_caps', $this->_meta_caps );
123
+		$this->_meta_caps = apply_filters('FHEE__EE_Capabilities___set_meta_caps__meta_caps', $this->_meta_caps);
124 124
 
125 125
 		//add filter for map_meta_caps but only if models can query.
126
-		if ( EE_Maintenance_Mode::instance()->models_can_query() && ! has_filter( 'map_meta_cap', array( $this, 'map_meta_caps' ) ) ) {
127
-			add_filter( 'map_meta_cap', array( $this, 'map_meta_caps' ), 10, 4 );
126
+		if (EE_Maintenance_Mode::instance()->models_can_query() && ! has_filter('map_meta_cap', array($this, 'map_meta_caps'))) {
127
+			add_filter('map_meta_cap', array($this, 'map_meta_caps'), 10, 4);
128 128
 		}
129 129
 	}
130 130
 
@@ -137,37 +137,37 @@  discard block
 block discarded – undo
137 137
 	 */
138 138
 	private function _get_default_meta_caps_array() {
139 139
 		static $default_meta_caps = array();
140
-		if ( empty( $default_meta_caps ) ) {
140
+		if (empty($default_meta_caps)) {
141 141
 			$default_meta_caps = array(
142 142
 				//edits
143
-				new EE_Meta_Capability_Map_Edit( 'ee_edit_event', array( 'Event', 'ee_edit_published_events', 'ee_edit_others_events', 'ee_edit_private_events' ) ),
144
-				new EE_Meta_Capability_Map_Edit( 'ee_edit_venue', array( 'Venue', 'ee_edit_published_venues', 'ee_edit_others_venues', 'ee_edit_private_venues' ) ),
145
-				new EE_Meta_Capability_Map_Edit( 'ee_edit_registration', array( 'Registration', '', 'ee_edit_others_registrations', '' ) ),
146
-				new EE_Meta_Capability_Map_Edit( 'ee_edit_checkin', array( 'Registration', '', 'ee_edit_others_checkins', '' ) ),
147
-				new EE_Meta_Capability_Map_Messages_Cap( 'ee_edit_message', array( 'Message_Template_Group', '', 'ee_edit_others_messages', 'ee_edit_global_messages' ) ),
148
-				new EE_Meta_Capability_Map_Edit( 'ee_edit_default_ticket', array( 'Ticket', '', 'ee_edit_others_default_tickets', '' ) ),
149
-				new EE_Meta_Capability_Map_Registration_Form_Cap( 'ee_edit_question', array( 'Question', '', '', 'ee_edit_system_questions' ) ),
150
-				new EE_Meta_Capability_Map_Registration_Form_Cap( 'ee_edit_question_group', array( 'Question_Group', '', '', 'ee_edit_system_question_groups' ) ),
151
-				new EE_Meta_Capability_Map_Edit( 'ee_edit_payment_method', array( 'Payment_Method', '', 'ee_edit_others_payment_methods', '' ) ),
143
+				new EE_Meta_Capability_Map_Edit('ee_edit_event', array('Event', 'ee_edit_published_events', 'ee_edit_others_events', 'ee_edit_private_events')),
144
+				new EE_Meta_Capability_Map_Edit('ee_edit_venue', array('Venue', 'ee_edit_published_venues', 'ee_edit_others_venues', 'ee_edit_private_venues')),
145
+				new EE_Meta_Capability_Map_Edit('ee_edit_registration', array('Registration', '', 'ee_edit_others_registrations', '')),
146
+				new EE_Meta_Capability_Map_Edit('ee_edit_checkin', array('Registration', '', 'ee_edit_others_checkins', '')),
147
+				new EE_Meta_Capability_Map_Messages_Cap('ee_edit_message', array('Message_Template_Group', '', 'ee_edit_others_messages', 'ee_edit_global_messages')),
148
+				new EE_Meta_Capability_Map_Edit('ee_edit_default_ticket', array('Ticket', '', 'ee_edit_others_default_tickets', '')),
149
+				new EE_Meta_Capability_Map_Registration_Form_Cap('ee_edit_question', array('Question', '', '', 'ee_edit_system_questions')),
150
+				new EE_Meta_Capability_Map_Registration_Form_Cap('ee_edit_question_group', array('Question_Group', '', '', 'ee_edit_system_question_groups')),
151
+				new EE_Meta_Capability_Map_Edit('ee_edit_payment_method', array('Payment_Method', '', 'ee_edit_others_payment_methods', '')),
152 152
 				//reads
153
-				new EE_Meta_Capability_Map_Read( 'ee_read_event', array( 'Event', '', 'ee_read_others_events', 'ee_read_private_events' ) ),
154
-				new EE_Meta_Capability_Map_Read( 'ee_read_venue', array( 'Venue', '', 'ee_read_others_venues', 'ee_read_private_venues' ) ),
155
-				new EE_Meta_Capability_Map_Read( 'ee_read_registration', array( 'Registration', '', '', 'ee_edit_others_registrations' ) ),
156
-				new EE_Meta_Capability_Map_Read( 'ee_read_checkin', array( 'Registration', '', '', 'ee_read_others_checkins' ) ),
157
-				new EE_Meta_Capability_Map_Messages_Cap( 'ee_read_message', array( 'Message_Template_Group', '', 'ee_read_others_messages', 'ee_read_global_messages' ) ),
158
-				new EE_Meta_Capability_Map_Read( 'ee_read_default_ticket', array( 'Ticket', '', '', 'ee_read_others_default_tickets' ) ),
159
-				new EE_Meta_Capability_Map_Read( 'ee_read_payment_method', array( 'Payment_Method', '', '', 'ee_read_others_payment_methods' ) ),
153
+				new EE_Meta_Capability_Map_Read('ee_read_event', array('Event', '', 'ee_read_others_events', 'ee_read_private_events')),
154
+				new EE_Meta_Capability_Map_Read('ee_read_venue', array('Venue', '', 'ee_read_others_venues', 'ee_read_private_venues')),
155
+				new EE_Meta_Capability_Map_Read('ee_read_registration', array('Registration', '', '', 'ee_edit_others_registrations')),
156
+				new EE_Meta_Capability_Map_Read('ee_read_checkin', array('Registration', '', '', 'ee_read_others_checkins')),
157
+				new EE_Meta_Capability_Map_Messages_Cap('ee_read_message', array('Message_Template_Group', '', 'ee_read_others_messages', 'ee_read_global_messages')),
158
+				new EE_Meta_Capability_Map_Read('ee_read_default_ticket', array('Ticket', '', '', 'ee_read_others_default_tickets')),
159
+				new EE_Meta_Capability_Map_Read('ee_read_payment_method', array('Payment_Method', '', '', 'ee_read_others_payment_methods')),
160 160
 
161 161
 				//deletes
162
-				new EE_Meta_Capability_Map_Delete( 'ee_delete_event', array( 'Event', 'ee_delete_published_events', 'ee_delete_others_events', 'ee_delete_private_events' ) ),
163
-				new EE_Meta_Capability_Map_Delete( 'ee_delete_venue', array( 'Venue', 'ee_delete_published_venues', 'ee_delete_others_venues', 'ee_delete_private_venues' ) ),
164
-				new EE_Meta_Capability_Map_Delete( 'ee_delete_registration', array( 'Registration', '', 'ee_delete_others_registrations', '' ) ),
165
-				new EE_Meta_Capability_Map_Delete( 'ee_delete_checkin', array( 'Registration', '', 'ee_delete_others_checkins', '' ) ),
166
-				new EE_Meta_Capability_Map_Messages_Cap( 'ee_delete_message', array( 'Message_Template_Group', '', 'ee_delete_others_messages', 'ee_delete_global_messages' ) ),
167
-				new EE_Meta_Capability_Map_Delete( 'ee_delete_default_ticket', array( 'Ticket', '', 'ee_delete_others_default_tickets', '' ) ),
168
-				new EE_Meta_Capability_Map_Registration_Form_Cap( 'ee_delete_question', array( 'Question', '', '', 'delete_system_questions' ) ),
169
-				new EE_Meta_Capability_Map_Registration_Form_Cap( 'ee_delete_question_group', array( 'Question_Group', '', '', 'delete_system_question_groups' ) ),
170
-				new EE_Meta_Capability_Map_Delete( 'ee_delete_payment_method', array( 'Payment_Method', '', 'ee_delete_others_payment_methods', '' ) ),
162
+				new EE_Meta_Capability_Map_Delete('ee_delete_event', array('Event', 'ee_delete_published_events', 'ee_delete_others_events', 'ee_delete_private_events')),
163
+				new EE_Meta_Capability_Map_Delete('ee_delete_venue', array('Venue', 'ee_delete_published_venues', 'ee_delete_others_venues', 'ee_delete_private_venues')),
164
+				new EE_Meta_Capability_Map_Delete('ee_delete_registration', array('Registration', '', 'ee_delete_others_registrations', '')),
165
+				new EE_Meta_Capability_Map_Delete('ee_delete_checkin', array('Registration', '', 'ee_delete_others_checkins', '')),
166
+				new EE_Meta_Capability_Map_Messages_Cap('ee_delete_message', array('Message_Template_Group', '', 'ee_delete_others_messages', 'ee_delete_global_messages')),
167
+				new EE_Meta_Capability_Map_Delete('ee_delete_default_ticket', array('Ticket', '', 'ee_delete_others_default_tickets', '')),
168
+				new EE_Meta_Capability_Map_Registration_Form_Cap('ee_delete_question', array('Question', '', '', 'delete_system_questions')),
169
+				new EE_Meta_Capability_Map_Registration_Form_Cap('ee_delete_question_group', array('Question_Group', '', '', 'delete_system_question_groups')),
170
+				new EE_Meta_Capability_Map_Delete('ee_delete_payment_method', array('Payment_Method', '', 'ee_delete_others_payment_methods', '')),
171 171
 			);
172 172
 		}
173 173
 		return $default_meta_caps;
@@ -191,15 +191,15 @@  discard block
 block discarded – undo
191 191
 	 *
192 192
 	 * @return array   actual users capabilities
193 193
 	 */
194
-	public function map_meta_caps( $caps, $cap, $user_id, $args ) {
194
+	public function map_meta_caps($caps, $cap, $user_id, $args) {
195 195
 		//loop through our _meta_caps array
196
-		foreach ( $this->_meta_caps as $meta_map ) {
197
-			if ( ! $meta_map instanceof EE_Meta_Capability_Map ) {
196
+		foreach ($this->_meta_caps as $meta_map) {
197
+			if ( ! $meta_map instanceof EE_Meta_Capability_Map) {
198 198
 				continue;
199 199
 			}
200 200
 			$meta_map->ensure_is_model();
201 201
 
202
-			$caps = $meta_map->map_meta_caps( $caps, $cap, $user_id, $args );
202
+			$caps = $meta_map->map_meta_caps($caps, $cap, $user_id, $args);
203 203
 		}
204 204
 		return $caps;
205 205
 	}
@@ -364,7 +364,7 @@  discard block
 block discarded – undo
364 364
 				)
365 365
 			);
366 366
 
367
-		$caps = apply_filters( 'FHEE__EE_Capabilities__init_caps_map__caps', $caps );
367
+		$caps = apply_filters('FHEE__EE_Capabilities__init_caps_map__caps', $caps);
368 368
 		return $caps;
369 369
 	}
370 370
 
@@ -381,26 +381,26 @@  discard block
 block discarded – undo
381 381
 	 *
382 382
 	 * @return void
383 383
 	 */
384
-	public function init_role_caps( $reset = false, $custom_map = array() ) {
384
+	public function init_role_caps($reset = false, $custom_map = array()) {
385 385
 
386
-		$caps_map = empty( $custom_map ) ? $this->_caps_map : $custom_map;
386
+		$caps_map = empty($custom_map) ? $this->_caps_map : $custom_map;
387 387
 
388 388
 		//first let's determine if these caps have already been set.
389
-		$caps_set_before = get_option( self::option_name, array() );
389
+		$caps_set_before = get_option(self::option_name, array());
390 390
 		//if not reset, see what caps are new for each role. if they're new, add them.
391
-		foreach ( $caps_map as $role => $caps_for_role ) {
392
-			foreach ( $caps_for_role as $cap ) {
391
+		foreach ($caps_map as $role => $caps_for_role) {
392
+			foreach ($caps_for_role as $cap) {
393 393
 				//first check we haven't already added this cap before, or it's a reset
394
-				if ( $reset || ! isset( $caps_set_before[ $role ] ) || ! in_array( $cap, $caps_set_before[ $role ] ) ) {
395
-					$this->add_cap_to_role( $role, $cap );
396
-					$caps_set_before[ $role ][] = $cap;
394
+				if ($reset || ! isset($caps_set_before[$role]) || ! in_array($cap, $caps_set_before[$role])) {
395
+					$this->add_cap_to_role($role, $cap);
396
+					$caps_set_before[$role][] = $cap;
397 397
 				}
398 398
 			}
399 399
 		}
400 400
 
401 401
 		//now let's just save the cap that has been set.
402
-		update_option( self::option_name, $caps_set_before );
403
-		do_action( 'AHEE__EE_Capabilities__init_role_caps__complete', $caps_set_before );
402
+		update_option(self::option_name, $caps_set_before);
403
+		do_action('AHEE__EE_Capabilities__init_role_caps__complete', $caps_set_before);
404 404
 	}
405 405
 
406 406
 
@@ -419,10 +419,10 @@  discard block
 block discarded – undo
419 419
 	 * @param bool $grant  Whether to grant access to this cap on this role.
420 420
 	 * @return void
421 421
 	 */
422
-	public function add_cap_to_role( $role, $cap, $grant = true ) {
423
-		$role = get_role( $role );
424
-		if ( $role instanceof WP_Role ) {
425
-			$role->add_cap( $cap, $grant );
422
+	public function add_cap_to_role($role, $cap, $grant = true) {
423
+		$role = get_role($role);
424
+		if ($role instanceof WP_Role) {
425
+			$role->add_cap($cap, $grant);
426 426
 		}
427 427
 	}
428 428
 
@@ -442,10 +442,10 @@  discard block
 block discarded – undo
442 442
 	 *
443 443
 	 * @return void
444 444
 	 */
445
-	public function remove_cap_from_role( $role, $cap ) {
446
-		$role = get_role( $role );
447
-		if ( $role instanceof WP_Role ) {
448
-			$role->remove_cap( $cap );
445
+	public function remove_cap_from_role($role, $cap) {
446
+		$role = get_role($role);
447
+		if ($role instanceof WP_Role) {
448
+			$role->remove_cap($cap);
449 449
 		}
450 450
 	}
451 451
 
@@ -466,11 +466,11 @@  discard block
 block discarded – undo
466 466
 	 *
467 467
 	 * @return bool  Whether user can or not.
468 468
 	 */
469
-	public function current_user_can( $cap, $context, $id = 0 ) {
469
+	public function current_user_can($cap, $context, $id = 0) {
470 470
 		//apply filters (both a global on just the cap, and context specific.  Global overrides context specific)
471
-		$filtered_cap = apply_filters( 'FHEE__EE_Capabilities__current_user_can__cap__' . $context,  $cap, $id );
472
-		$filtered_cap = apply_filters( 'FHEE__EE_Capabilities__current_user_can__cap', $filtered_cap, $context, $cap, $id );
473
-		return ! empty( $id ) ? current_user_can( $filtered_cap, $id ) : current_user_can( $filtered_cap );
471
+		$filtered_cap = apply_filters('FHEE__EE_Capabilities__current_user_can__cap__'.$context, $cap, $id);
472
+		$filtered_cap = apply_filters('FHEE__EE_Capabilities__current_user_can__cap', $filtered_cap, $context, $cap, $id);
473
+		return ! empty($id) ? current_user_can($filtered_cap, $id) : current_user_can($filtered_cap);
474 474
 	}
475 475
 
476 476
 
@@ -487,11 +487,11 @@  discard block
 block discarded – undo
487 487
 	 *
488 488
 	 * @return bool Whether user can or not.
489 489
 	 */
490
-	public function user_can( $user, $cap, $context, $id = 0 ) {
490
+	public function user_can($user, $cap, $context, $id = 0) {
491 491
 		//apply filters (both a global on just the cap, and context specific.  Global overrides context specific)
492
-		$filtered_cap = apply_filters( 'FHEE__EE_Capabilities__user_can__cap__' . $context, $cap, $user, $id );
493
-		$filtered_cap = apply_filters( 'FHEE__EE_Capabilities__user_can__cap', $filtered_cap, $context, $cap, $user,  $id );
494
-		return ! empty( $id ) ? user_can( $user, $filtered_cap, $id ) : user_can( $user, $filtered_cap );
492
+		$filtered_cap = apply_filters('FHEE__EE_Capabilities__user_can__cap__'.$context, $cap, $user, $id);
493
+		$filtered_cap = apply_filters('FHEE__EE_Capabilities__user_can__cap', $filtered_cap, $context, $cap, $user, $id);
494
+		return ! empty($id) ? user_can($user, $filtered_cap, $id) : user_can($user, $filtered_cap);
495 495
 	}
496 496
 
497 497
 
@@ -511,12 +511,12 @@  discard block
 block discarded – undo
511 511
 	 *
512 512
 	 * @return bool  Whether user can or not.
513 513
 	 */
514
-	public function current_user_can_for_blog( $blog_id, $cap, $context, $id = 0 ) {
515
-		$user_can = ! empty( $id ) ? current_user_can_for_blog( $blog_id, $cap, $id ) : current_user_can( $blog_id, $cap );
514
+	public function current_user_can_for_blog($blog_id, $cap, $context, $id = 0) {
515
+		$user_can = ! empty($id) ? current_user_can_for_blog($blog_id, $cap, $id) : current_user_can($blog_id, $cap);
516 516
 
517 517
 		//apply filters (both a global on just the cap, and context specific.  Global overrides context specific)
518
-		$user_can = apply_filters( 'FHEE__EE_Capabilities__current_user_can_for_blog__user_can__' . $context, $user_can, $blog_id, $cap, $id );
519
-		$user_can = apply_filters( 'FHEE__EE_Capabilities__current_user_can_for_blog__user_can', $user_can, $context, $blog_id, $cap, $id );
518
+		$user_can = apply_filters('FHEE__EE_Capabilities__current_user_can_for_blog__user_can__'.$context, $user_can, $blog_id, $cap, $id);
519
+		$user_can = apply_filters('FHEE__EE_Capabilities__current_user_can_for_blog__user_can', $user_can, $context, $blog_id, $cap, $id);
520 520
 		return $user_can;
521 521
 	}
522 522
 
@@ -532,12 +532,12 @@  discard block
 block discarded – undo
532 532
 	 *
533 533
 	 * @return array
534 534
 	 */
535
-	public function get_ee_capabilities( $role = 'administrator' ) {
535
+	public function get_ee_capabilities($role = 'administrator') {
536 536
 		$capabilities = $this->_init_caps_map();
537
-		if ( empty( $role ) ) {
537
+		if (empty($role)) {
538 538
 			return $capabilities;
539 539
 		}
540
-		return isset( $capabilities[ $role ] ) ? $capabilities[ $role ] : array();
540
+		return isset($capabilities[$role]) ? $capabilities[$role] : array();
541 541
 	}
542 542
 }
543 543
 
@@ -585,11 +585,11 @@  discard block
 block discarded – undo
585 585
 	 * 	}
586 586
 	 * @throws EE_Error
587 587
 	 */
588
-	public function __construct( $meta_cap, $map_values ) {
588
+	public function __construct($meta_cap, $map_values) {
589 589
 		$this->meta_cap = $meta_cap;
590 590
 		//verify there are four args in the $map_values array;
591
-		if ( count( $map_values ) !== 4 ) {
592
-			throw new EE_Error( sprintf( __( 'Incoming $map_values array should have a count of four values in it.  This is what was given: %s', 'event_espresso' ), '<br>' . print_r( $map_values, true ) ) );
591
+		if (count($map_values) !== 4) {
592
+			throw new EE_Error(sprintf(__('Incoming $map_values array should have a count of four values in it.  This is what was given: %s', 'event_espresso'), '<br>'.print_r($map_values, true)));
593 593
 		}
594 594
 
595 595
 		//set properties
@@ -603,8 +603,8 @@  discard block
 block discarded – undo
603 603
 	/**
604 604
 	 * Makes it so this object stops filtering caps
605 605
 	 */
606
-	public function remove_filters(){
607
-		remove_filter( 'map_meta_cap', array( $this, 'map_meta_caps' ), 10 );
606
+	public function remove_filters() {
607
+		remove_filter('map_meta_cap', array($this, 'map_meta_caps'), 10);
608 608
 	}
609 609
 
610 610
 
@@ -619,19 +619,19 @@  discard block
 block discarded – undo
619 619
 	 */
620 620
 	public function ensure_is_model() {
621 621
 		//is it already instantiated?
622
-		if ( $this->_model instanceof EEM_Base ) {
622
+		if ($this->_model instanceof EEM_Base) {
623 623
 			return;
624 624
 		}
625 625
 
626 626
 		//ensure model name is string
627 627
 		$this->_model_name = (string) $this->_model_name;
628 628
 		//error proof if the name has EEM in it
629
-		$this->_model_name = str_replace( 'EEM', '', $this->_model_name );
629
+		$this->_model_name = str_replace('EEM', '', $this->_model_name);
630 630
 
631
-		$this->_model = EE_Registry::instance()->load_model( $this->_model_name );
631
+		$this->_model = EE_Registry::instance()->load_model($this->_model_name);
632 632
 
633
-		if ( ! $this->_model instanceof EEM_Base ) {
634
-			throw new EE_Error( sprintf( __( 'This string passed in to %s to represent a EEM_Base model class was not able to be used to instantiate the class.   Please ensure that the string is a match for the EEM_Base model name (not including the EEM_ part). This was given: %s', 'event_espresso' ), get_class( $this ), $this->_model ) );
633
+		if ( ! $this->_model instanceof EEM_Base) {
634
+			throw new EE_Error(sprintf(__('This string passed in to %s to represent a EEM_Base model class was not able to be used to instantiate the class.   Please ensure that the string is a match for the EEM_Base model name (not including the EEM_ part). This was given: %s', 'event_espresso'), get_class($this), $this->_model));
635 635
 		}
636 636
 	}
637 637
 
@@ -647,8 +647,8 @@  discard block
 block discarded – undo
647 647
 	 *
648 648
 	 * @return array
649 649
 	 */
650
-	public function map_meta_caps( $caps, $cap, $user_id, $args ) {
651
-		return $this->_map_meta_caps( $caps, $cap, $user_id, $args );
650
+	public function map_meta_caps($caps, $cap, $user_id, $args) {
651
+		return $this->_map_meta_caps($caps, $cap, $user_id, $args);
652 652
 	}
653 653
 
654 654
 
@@ -666,7 +666,7 @@  discard block
 block discarded – undo
666 666
 	 *
667 667
 	 * @return array   actual users capabilities
668 668
 	 */
669
-	abstract protected function _map_meta_caps( $caps, $cap, $user_id, $args );
669
+	abstract protected function _map_meta_caps($caps, $cap, $user_id, $args);
670 670
 }
671 671
 
672 672
 
@@ -698,28 +698,28 @@  discard block
 block discarded – undo
698 698
 	 *
699 699
 	 * @return array   actual users capabilities
700 700
 	 */
701
-	protected function _map_meta_caps( $caps, $cap, $user_id, $args ) {
701
+	protected function _map_meta_caps($caps, $cap, $user_id, $args) {
702 702
 		//only process if we're checking our mapped_cap
703
-		if ( $cap !== $this->meta_cap ) {
703
+		if ($cap !== $this->meta_cap) {
704 704
 			return $caps;
705 705
 		}
706 706
 
707
-		$obj = ! empty( $args[0] ) ? $this->_model->get_one_by_ID( $args[0] ) : null;
707
+		$obj = ! empty($args[0]) ? $this->_model->get_one_by_ID($args[0]) : null;
708 708
 
709 709
 		//if no obj then let's just do cap
710
-		if ( ! $obj instanceof EE_Base_Class ) {
710
+		if ( ! $obj instanceof EE_Base_Class) {
711 711
 			$caps[] = $cap;
712 712
 			return $caps;
713 713
 		}
714 714
 
715
-		if ( $obj instanceof EE_CPT_Base ) {
715
+		if ($obj instanceof EE_CPT_Base) {
716 716
 			//if the item author is set and the user is the author...
717
-			if ( $obj->wp_user() && $user_id == $obj->wp_user() ) {
718
-				if ( empty( $this->published_cap ) ) {
717
+			if ($obj->wp_user() && $user_id == $obj->wp_user()) {
718
+				if (empty($this->published_cap)) {
719 719
 					$caps[] = $cap;
720 720
 				} else {
721 721
 					//if obj is published...
722
-					if ( $obj->status() == 'publish' ) {
722
+					if ($obj->status() == 'publish') {
723 723
 						$caps[] = $this->published_cap;
724 724
 					} else {
725 725
 						$caps[] = $cap;
@@ -727,21 +727,21 @@  discard block
 block discarded – undo
727 727
 				}
728 728
 			} else {
729 729
 				//the user is trying to edit someone else's obj
730
-				if ( ! empty( $this->others_cap ) ) {
730
+				if ( ! empty($this->others_cap)) {
731 731
 					$caps[] = $this->others_cap;
732 732
 				}
733
-				if ( ! empty( $this->published_cap ) && $obj->status() == 'publish' ) {
733
+				if ( ! empty($this->published_cap) && $obj->status() == 'publish') {
734 734
 					$caps[] = $this->published_cap;
735
-				} elseif ( ! empty( $this->private_cap ) && $obj->status() == 'private' ) {
735
+				} elseif ( ! empty($this->private_cap) && $obj->status() == 'private') {
736 736
 					$caps[] = $this->private_cap;
737 737
 				}
738 738
 			}
739 739
 		} else {
740 740
 			//not a cpt object so handled differently
741
-			if ( method_exists( $obj, 'wp_user' ) && $obj->wp_user() && $user_id == $obj->wp_user() ) {
741
+			if (method_exists($obj, 'wp_user') && $obj->wp_user() && $user_id == $obj->wp_user()) {
742 742
 				$caps[] = $cap;
743 743
 			} else {
744
-				if ( ! empty( $this->others_cap ) ) {
744
+				if ( ! empty($this->others_cap)) {
745 745
 					$caps[] = $this->others_cap;
746 746
 				}
747 747
 			}
@@ -778,8 +778,8 @@  discard block
 block discarded – undo
778 778
 	 *
779 779
 	 * @return array   actual users capabilities
780 780
 	 */
781
-	protected function _map_meta_caps( $caps, $cap, $user_id, $args ) {
782
-		return parent::_map_meta_caps( $caps, $cap, $user_id, $args );
781
+	protected function _map_meta_caps($caps, $cap, $user_id, $args) {
782
+		return parent::_map_meta_caps($caps, $cap, $user_id, $args);
783 783
 	}
784 784
 }
785 785
 
@@ -811,45 +811,45 @@  discard block
 block discarded – undo
811 811
 	 *
812 812
 	 * @return array   actual users capabilities
813 813
 	 */
814
-	protected function _map_meta_caps( $caps, $cap, $user_id, $args ) {
814
+	protected function _map_meta_caps($caps, $cap, $user_id, $args) {
815 815
 		//only process if we're checking our mapped cap;
816
-		if ( $cap !== $this->meta_cap ) {
816
+		if ($cap !== $this->meta_cap) {
817 817
 			return $caps;
818 818
 		}
819 819
 
820
-		$obj = ! empty( $args[0] ) ? $this->_model->get_one_by_ID( $args[0] ) : null;
820
+		$obj = ! empty($args[0]) ? $this->_model->get_one_by_ID($args[0]) : null;
821 821
 
822 822
 		//if no obj then let's just do cap
823
-		if ( ! $obj instanceof EE_Base_Class ) {
823
+		if ( ! $obj instanceof EE_Base_Class) {
824 824
 			$caps[] = $cap;
825 825
 			return $caps;
826 826
 		}
827 827
 
828
-		if ( $obj instanceof EE_CPT_Base ) {
829
-			$status_obj = get_post_status_object( $obj->status() );
830
-			if ( $status_obj->public ) {
828
+		if ($obj instanceof EE_CPT_Base) {
829
+			$status_obj = get_post_status_object($obj->status());
830
+			if ($status_obj->public) {
831 831
 				$caps[] = $cap;
832 832
 				return $caps;
833 833
 			}
834 834
 
835 835
 			//if the item author is set and the user is the author...
836
-			if ( $obj->wp_user() && $user_id == $obj->wp_user() ) {
836
+			if ($obj->wp_user() && $user_id == $obj->wp_user()) {
837 837
 				$caps[] = $cap;
838
-			} elseif ( $status_obj->private && ! empty( $this->private_cap ) ) {
838
+			} elseif ($status_obj->private && ! empty($this->private_cap)) {
839 839
 				//the user is trying to view someone else's obj
840 840
 				$caps[] = $this->private_cap;
841
-			} elseif ( ! empty( $this->others_cap ) ) {
841
+			} elseif ( ! empty($this->others_cap)) {
842 842
 				$caps[] = $this->others_cap;
843 843
 			} else {
844 844
 				$caps[] = $cap;
845 845
 			}
846 846
 		} else {
847 847
 			//not a cpt object so handled differently
848
-			if ( method_exists( $obj, 'wp_user' ) && $obj->wp_user() && $user_id == $obj->wp_user() ) {
848
+			if (method_exists($obj, 'wp_user') && $obj->wp_user() && $user_id == $obj->wp_user()) {
849 849
 				$caps[] = $cap;
850
-			} elseif ( ! empty( $this->private_cap ) ) {
850
+			} elseif ( ! empty($this->private_cap)) {
851 851
 				$caps[] = $this->private_cap;
852
-			} elseif ( ! empty( $this->others_cap ) ) {
852
+			} elseif ( ! empty($this->others_cap)) {
853 853
 				$caps[] = $this->others_cap;
854 854
 			} else {
855 855
 				$caps[] = $cap;
@@ -886,30 +886,30 @@  discard block
 block discarded – undo
886 886
 	 *
887 887
 	 * @return array   actual users capabilities
888 888
 	 */
889
-	protected function _map_meta_caps( $caps, $cap, $user_id, $args ) {
889
+	protected function _map_meta_caps($caps, $cap, $user_id, $args) {
890 890
 		//only process if we're checking our mapped_cap
891
-		if ( $cap !== $this->meta_cap ) {
891
+		if ($cap !== $this->meta_cap) {
892 892
 			return $caps;
893 893
 		}
894 894
 
895
-		$obj = ! empty( $args[0] ) ? $this->_model->get_one_by_ID( $args[0] ) : null;
895
+		$obj = ! empty($args[0]) ? $this->_model->get_one_by_ID($args[0]) : null;
896 896
 
897 897
 		//if no obj then let's just do cap
898
-		if ( ! $obj instanceof EE_Message_Template_Group ) {
898
+		if ( ! $obj instanceof EE_Message_Template_Group) {
899 899
 			$caps[] = $cap;
900 900
 			return $caps;
901 901
 		}
902 902
 
903 903
 		$is_global = $obj->is_global();
904 904
 
905
-		if ( $obj->wp_user() && $user_id == $obj->wp_user() ) {
906
-			if ( $is_global ) {
907
-				$caps[]  = $this->private_cap;
905
+		if ($obj->wp_user() && $user_id == $obj->wp_user()) {
906
+			if ($is_global) {
907
+				$caps[] = $this->private_cap;
908 908
 			} else {
909 909
 				$caps[] = $cap;
910 910
 			}
911 911
 		} else {
912
-			if ( $is_global ) {
912
+			if ($is_global) {
913 913
 				$caps[] = $this->private_cap;
914 914
 			} else {
915 915
 				$caps[] = $this->others_cap;
@@ -947,16 +947,16 @@  discard block
 block discarded – undo
947 947
 	 *
948 948
 	 * @return array   actual users capabilities
949 949
 	 */
950
-	protected function _map_meta_caps( $caps, $cap, $user_id, $args ) {
950
+	protected function _map_meta_caps($caps, $cap, $user_id, $args) {
951 951
 		//only process if we're checking our mapped_cap
952
-		if ( $cap !== $this->meta_cap ) {
952
+		if ($cap !== $this->meta_cap) {
953 953
 			return $caps;
954 954
 		}
955 955
 
956
-		$obj = ! empty( $args[0] ) ? $this->_model->get_one_by_ID( $args[0] ) : null;
956
+		$obj = ! empty($args[0]) ? $this->_model->get_one_by_ID($args[0]) : null;
957 957
 
958 958
 		//if no obj then let's just do cap
959
-		if ( ! $obj instanceof EE_Base_Class ) {
959
+		if ( ! $obj instanceof EE_Base_Class) {
960 960
 			$caps[] = $cap;
961 961
 			return $caps;
962 962
 		}
@@ -964,7 +964,7 @@  discard block
 block discarded – undo
964 964
 		$is_system = $obj instanceof EE_Question_Group ? $obj->system_group() : false;
965 965
 		$is_system = $obj instanceof EE_Question ? $obj->is_system_question() : $is_system;
966 966
 
967
-		if ( $is_system ) {
967
+		if ($is_system) {
968 968
 			$caps[] = $this->private_cap;
969 969
 		} else {
970 970
 			$caps[] = $cap;
Please login to merge, or discard this patch.
core/EE_System.core.php 1 patch
Spacing   +255 added lines, -255 removed lines patch added patch discarded remove patch
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 	 */
103 103
 	public static function instance() {
104 104
 		// check if class object is instantiated
105
-		if ( ! self::$_instance instanceof EE_System ) {
105
+		if ( ! self::$_instance instanceof EE_System) {
106 106
 			self::$_instance = new self();
107 107
 		}
108 108
 		return self::$_instance;
@@ -113,12 +113,12 @@  discard block
 block discarded – undo
113 113
 	 * resets the instance and returns it
114 114
 	 * @return EE_System
115 115
 	 */
116
-	public static function reset(){
116
+	public static function reset() {
117 117
 		self::$_instance->_req_type = NULL;
118 118
 		//we need to reset the migration manager in order for it to detect DMSs properly
119 119
 		EE_Data_Migration_Manager::reset();
120 120
 		//make sure none of the old hooks are left hanging around
121
-		remove_all_actions( 'AHEE__EE_System__perform_activations_upgrades_and_migrations');
121
+		remove_all_actions('AHEE__EE_System__perform_activations_upgrades_and_migrations');
122 122
 		self::instance()->detect_activations_or_upgrades();
123 123
 		self::instance()->perform_activations_upgrades_and_migrations();
124 124
 		return self::instance();
@@ -134,26 +134,26 @@  discard block
 block discarded – undo
134 134
 	 * @access    private
135 135
 	 */
136 136
 	private function __construct() {
137
-		do_action( 'AHEE__EE_System__construct__begin', $this );
137
+		do_action('AHEE__EE_System__construct__begin', $this);
138 138
 		// allow addons to load first so that they can register autoloaders, set hooks for running DMS's, etc
139
-		add_action( 'AHEE__EE_Bootstrap__load_espresso_addons', array( $this, 'load_espresso_addons' ) );
139
+		add_action('AHEE__EE_Bootstrap__load_espresso_addons', array($this, 'load_espresso_addons'));
140 140
 		// when an ee addon is activated, we want to call the core hook(s) again
141 141
 		// because the newly-activated addon didn't get a chance to run at all
142
-		add_action( 'activate_plugin', array( $this, 'load_espresso_addons' ), 1 );
142
+		add_action('activate_plugin', array($this, 'load_espresso_addons'), 1);
143 143
 		// detect whether install or upgrade
144
-		add_action( 'AHEE__EE_Bootstrap__detect_activations_or_upgrades', array( $this, 'detect_activations_or_upgrades' ), 3 );
144
+		add_action('AHEE__EE_Bootstrap__detect_activations_or_upgrades', array($this, 'detect_activations_or_upgrades'), 3);
145 145
 		// load EE_Config, EE_Textdomain, etc
146
-		add_action( 'AHEE__EE_Bootstrap__load_core_configuration', array( $this, 'load_core_configuration' ), 5 );
146
+		add_action('AHEE__EE_Bootstrap__load_core_configuration', array($this, 'load_core_configuration'), 5);
147 147
 		// load EE_Config, EE_Textdomain, etc
148
-		add_action( 'AHEE__EE_Bootstrap__register_shortcodes_modules_and_widgets', array( $this, 'register_shortcodes_modules_and_widgets' ), 7 );
148
+		add_action('AHEE__EE_Bootstrap__register_shortcodes_modules_and_widgets', array($this, 'register_shortcodes_modules_and_widgets'), 7);
149 149
 		// you wanna get going? I wanna get going... let's get going!
150
-		add_action( 'AHEE__EE_Bootstrap__brew_espresso', array( $this, 'brew_espresso' ), 9 );
150
+		add_action('AHEE__EE_Bootstrap__brew_espresso', array($this, 'brew_espresso'), 9);
151 151
 		//other housekeeping
152 152
 		//exclude EE critical pages from wp_list_pages
153
-		add_filter( 'wp_list_pages_excludes', array( $this, 'remove_pages_from_wp_list_pages' ), 10 );
153
+		add_filter('wp_list_pages_excludes', array($this, 'remove_pages_from_wp_list_pages'), 10);
154 154
 		// ALL EE Addons should use the following hook point to attach their initial setup too
155 155
 		// it's extremely important for EE Addons to register any class autoloaders so that they can be available when the EE_Config loads
156
-		do_action( 'AHEE__EE_System__construct__complete', $this );
156
+		do_action('AHEE__EE_System__construct__complete', $this);
157 157
 	}
158 158
 
159 159
 
@@ -173,13 +173,13 @@  discard block
 block discarded – undo
173 173
 	public function load_espresso_addons() {
174 174
 		// set autoloaders for all of the classes implementing EEI_Plugin_API
175 175
 		// which provide helpers for EE plugin authors to more easily register certain components with EE.
176
-		EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder( EE_LIBRARIES . 'plugin_api' );
176
+		EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder(EE_LIBRARIES.'plugin_api');
177 177
 		//load and setup EE_Capabilities
178
-		EE_Registry::instance()->load_core( 'Capabilities' );
178
+		EE_Registry::instance()->load_core('Capabilities');
179 179
 		//caps need to be initialized on every request so that capability maps are set.
180 180
 		//@see https://events.codebasehq.com/projects/event-espresso/tickets/8674
181 181
 		EE_Registry::instance()->CAP->init_caps();
182
-		do_action( 'AHEE__EE_System__load_espresso_addons' );
182
+		do_action('AHEE__EE_System__load_espresso_addons');
183 183
 	}
184 184
 
185 185
 
@@ -194,10 +194,10 @@  discard block
 block discarded – undo
194 194
 	 * @access public
195 195
 	 * @return void
196 196
 	 */
197
-	public function detect_activations_or_upgrades(){
197
+	public function detect_activations_or_upgrades() {
198 198
 		//first off: let's make sure to handle core
199 199
 		$this->detect_if_activation_or_upgrade();
200
-		foreach(EE_Registry::instance()->addons as $addon){
200
+		foreach (EE_Registry::instance()->addons as $addon) {
201 201
 			//detect teh request type for that addon
202 202
 			$addon->detect_activation_or_upgrade();
203 203
 		}
@@ -218,44 +218,44 @@  discard block
 block discarded – undo
218 218
 		do_action('AHEE__EE_System___detect_if_activation_or_upgrade__begin');
219 219
 
220 220
 		// load M-Mode class
221
-		EE_Registry::instance()->load_core( 'Maintenance_Mode' );
221
+		EE_Registry::instance()->load_core('Maintenance_Mode');
222 222
 		// check if db has been updated, or if its a brand-new installation
223 223
 
224 224
 		$espresso_db_update = $this->fix_espresso_db_upgrade_option();
225
-		$request_type =  $this->detect_req_type($espresso_db_update);
225
+		$request_type = $this->detect_req_type($espresso_db_update);
226 226
 		//EEH_Debug_Tools::printr( $request_type, '$request_type', __FILE__, __LINE__ );
227
-		if( $request_type != EE_System::req_type_normal){
227
+		if ($request_type != EE_System::req_type_normal) {
228 228
 			EE_Registry::instance()->load_helper('Activation');
229 229
 		}
230 230
 
231
-		switch($request_type){
231
+		switch ($request_type) {
232 232
 			case EE_System::req_type_new_activation:
233
-				do_action( 'AHEE__EE_System__detect_if_activation_or_upgrade__new_activation' );
234
-				$this->_handle_core_version_change( $espresso_db_update );
233
+				do_action('AHEE__EE_System__detect_if_activation_or_upgrade__new_activation');
234
+				$this->_handle_core_version_change($espresso_db_update);
235 235
 				break;
236 236
 			case EE_System::req_type_reactivation:
237
-				do_action( 'AHEE__EE_System__detect_if_activation_or_upgrade__reactivation' );
238
-				$this->_handle_core_version_change( $espresso_db_update );
237
+				do_action('AHEE__EE_System__detect_if_activation_or_upgrade__reactivation');
238
+				$this->_handle_core_version_change($espresso_db_update);
239 239
 				break;
240 240
 			case EE_System::req_type_upgrade:
241
-				do_action( 'AHEE__EE_System__detect_if_activation_or_upgrade__upgrade' );
241
+				do_action('AHEE__EE_System__detect_if_activation_or_upgrade__upgrade');
242 242
 				//migrations may be required now that we've upgraded
243 243
 				EE_Maintenance_Mode::instance()->set_maintenance_mode_if_db_old();
244
-				$this->_handle_core_version_change( $espresso_db_update );
244
+				$this->_handle_core_version_change($espresso_db_update);
245 245
 //				echo "done upgrade";die;
246 246
 				break;
247 247
 			case EE_System::req_type_downgrade:
248
-				do_action( 'AHEE__EE_System__detect_if_activation_or_upgrade__downgrade' );
248
+				do_action('AHEE__EE_System__detect_if_activation_or_upgrade__downgrade');
249 249
 				//its possible migrations are no longer required
250 250
 				EE_Maintenance_Mode::instance()->set_maintenance_mode_if_db_old();
251
-				$this->_handle_core_version_change( $espresso_db_update );
251
+				$this->_handle_core_version_change($espresso_db_update);
252 252
 				break;
253 253
 			case EE_System::req_type_normal:
254 254
 			default:
255 255
 //				$this->_maybe_redirect_to_ee_about();
256 256
 				break;
257 257
 		}
258
-		do_action( 'AHEE__EE_System__detect_if_activation_or_upgrade__complete' );
258
+		do_action('AHEE__EE_System__detect_if_activation_or_upgrade__complete');
259 259
 	}
260 260
 
261 261
 	/**
@@ -263,10 +263,10 @@  discard block
 block discarded – undo
263 263
 	 * initializing the database later during the request
264 264
 	 * @param array $espresso_db_update
265 265
 	 */
266
-	protected function _handle_core_version_change( $espresso_db_update ){
267
-		$this->update_list_of_installed_versions( $espresso_db_update );
266
+	protected function _handle_core_version_change($espresso_db_update) {
267
+		$this->update_list_of_installed_versions($espresso_db_update);
268 268
 		//get ready to verify the DB is ok (provided we aren't in maintenance mode, of course)
269
-		add_action( 'AHEE__EE_System__perform_activations_upgrades_and_migrations', array( $this, 'initialize_db_if_no_migrations_required' ));
269
+		add_action('AHEE__EE_System__perform_activations_upgrades_and_migrations', array($this, 'initialize_db_if_no_migrations_required'));
270 270
 	}
271 271
 
272 272
 
@@ -281,44 +281,44 @@  discard block
 block discarded – undo
281 281
 	 * @internal param array $espresso_db_update_value the value of the WordPress option. If not supplied, fetches it from the options table
282 282
 	 * @return array the correct value of 'espresso_db_upgrade', after saving it, if it needed correction
283 283
 	 */
284
-	private function fix_espresso_db_upgrade_option($espresso_db_update = null){
285
-		do_action( 'FHEE__EE_System__manage_fix_espresso_db_upgrade_option__begin', $espresso_db_update );
286
-		if( ! $espresso_db_update){
287
-			$espresso_db_update = get_option( 'espresso_db_update' );
284
+	private function fix_espresso_db_upgrade_option($espresso_db_update = null) {
285
+		do_action('FHEE__EE_System__manage_fix_espresso_db_upgrade_option__begin', $espresso_db_update);
286
+		if ( ! $espresso_db_update) {
287
+			$espresso_db_update = get_option('espresso_db_update');
288 288
 		}
289 289
 		// check that option is an array
290
-		if( ! is_array( $espresso_db_update )) {
290
+		if ( ! is_array($espresso_db_update)) {
291 291
 			// if option is FALSE, then it never existed
292
-			if ( $espresso_db_update === FALSE ) {
292
+			if ($espresso_db_update === FALSE) {
293 293
 				// make $espresso_db_update an array and save option with autoload OFF
294
-				$espresso_db_update =  array();
295
-				add_option( 'espresso_db_update', $espresso_db_update, '', 'no' );
294
+				$espresso_db_update = array();
295
+				add_option('espresso_db_update', $espresso_db_update, '', 'no');
296 296
 			} else {
297 297
 				// option is NOT FALSE but also is NOT an array, so make it an array and save it
298
-				$espresso_db_update =  array( $espresso_db_update=>array() );
299
-				update_option( 'espresso_db_update', $espresso_db_update );
298
+				$espresso_db_update = array($espresso_db_update=>array());
299
+				update_option('espresso_db_update', $espresso_db_update);
300 300
 			}
301
-		}else{
301
+		} else {
302 302
 			$corrected_db_update = array();
303 303
 			//if IS an array, but is it an array where KEYS are version numbers, and values are arrays?
304
-			foreach($espresso_db_update as $should_be_version_string => $should_be_array){
305
-				if(is_int($should_be_version_string) && ! is_array($should_be_array)){
304
+			foreach ($espresso_db_update as $should_be_version_string => $should_be_array) {
305
+				if (is_int($should_be_version_string) && ! is_array($should_be_array)) {
306 306
 					//the key is an int, and the value IS NOT an array
307 307
 					//so it must be numerically-indexed, where values are versions installed...
308 308
 					//fix it!
309 309
 					$version_string = $should_be_array;
310 310
 					$corrected_db_update[$version_string] = array('unknown-date');
311
-				}else{
311
+				} else {
312 312
 					//ok it checks out
313 313
 					$corrected_db_update[$should_be_version_string] = $should_be_array;
314 314
 				}
315 315
 			}
316 316
 			$espresso_db_update = $corrected_db_update;
317
-			update_option( 'espresso_db_update', $espresso_db_update );
317
+			update_option('espresso_db_update', $espresso_db_update);
318 318
 
319 319
 		}
320 320
 
321
-		do_action( 'FHEE__EE_System__manage_fix_espresso_db_upgrade_option__complete', $espresso_db_update );
321
+		do_action('FHEE__EE_System__manage_fix_espresso_db_upgrade_option__complete', $espresso_db_update);
322 322
 		return $espresso_db_update;
323 323
 	}
324 324
 
@@ -337,33 +337,33 @@  discard block
 block discarded – undo
337 337
 	 * so we prefer to only do it when necessary
338 338
 	 * @return void
339 339
 	 */
340
-	public function initialize_db_if_no_migrations_required( $initialize_addons_too = FALSE, $verify_schema = true ){
340
+	public function initialize_db_if_no_migrations_required($initialize_addons_too = FALSE, $verify_schema = true) {
341 341
 		$request_type = $this->detect_req_type();
342 342
 		//only initialize system if we're not in maintenance mode.
343
-		if( EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance ){
344
-			update_option( 'ee_flush_rewrite_rules', TRUE );
343
+		if (EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance) {
344
+			update_option('ee_flush_rewrite_rules', TRUE);
345 345
 			EEH_Activation::system_initialization();
346
-			if( $verify_schema ) {
346
+			if ($verify_schema) {
347 347
 				EEH_Activation::initialize_db_and_folders();
348 348
 			}
349 349
 			EEH_Activation::initialize_db_content();
350
-			if( $initialize_addons_too ) {
350
+			if ($initialize_addons_too) {
351 351
 				$this->initialize_addons();
352 352
 			}
353
-		}else{
354
-			EE_Data_Migration_Manager::instance()->enqueue_db_initialization_for( 'Core' );
353
+		} else {
354
+			EE_Data_Migration_Manager::instance()->enqueue_db_initialization_for('Core');
355 355
 		}
356
-		if ( $request_type == EE_System::req_type_new_activation || $request_type == EE_System::req_type_reactivation || $request_type == EE_System::req_type_upgrade ) {
357
-			add_action( 'AHEE__EE_System__load_CPTs_and_session__start', array( $this, 'redirect_to_about_ee' ), 9 );
356
+		if ($request_type == EE_System::req_type_new_activation || $request_type == EE_System::req_type_reactivation || $request_type == EE_System::req_type_upgrade) {
357
+			add_action('AHEE__EE_System__load_CPTs_and_session__start', array($this, 'redirect_to_about_ee'), 9);
358 358
 		}
359 359
 	}
360 360
 
361 361
 	/**
362 362
 	 * Initializes the db for all registered addons
363 363
 	 */
364
-	public function initialize_addons(){
364
+	public function initialize_addons() {
365 365
 		//foreach registered addon, make sure its db is up-to-date too
366
-		foreach(EE_Registry::instance()->addons as $addon){
366
+		foreach (EE_Registry::instance()->addons as $addon) {
367 367
 			$addon->initialize_db_if_no_migrations_required();
368 368
 		}
369 369
 	}
@@ -375,16 +375,16 @@  discard block
 block discarded – undo
375 375
 	 * @param 	string 	$current_version_to_add 	version to be added to the version history
376 376
 	 * @return 	boolean success as to whether or not this option was changed
377 377
 	 */
378
-	public function update_list_of_installed_versions($version_history = NULL,$current_version_to_add = NULL) {
379
-		if( ! $version_history ) {
378
+	public function update_list_of_installed_versions($version_history = NULL, $current_version_to_add = NULL) {
379
+		if ( ! $version_history) {
380 380
 			$version_history = $this->fix_espresso_db_upgrade_option($version_history);
381 381
 		}
382
-		if( $current_version_to_add == NULL){
382
+		if ($current_version_to_add == NULL) {
383 383
 			$current_version_to_add = espresso_version();
384 384
 		}
385
-		$version_history[ $current_version_to_add ][] = date( 'Y-m-d H:i:s',time() );
385
+		$version_history[$current_version_to_add][] = date('Y-m-d H:i:s', time());
386 386
 		// re-save
387
-		return update_option( 'espresso_db_update', $version_history );
387
+		return update_option('espresso_db_update', $version_history);
388 388
 	}
389 389
 
390 390
 
@@ -401,10 +401,10 @@  discard block
 block discarded – undo
401 401
 	 *                            but still know if this is a new install or not
402 402
 	 * @return int one of the constants on EE_System::req_type_
403 403
 	 */
404
-	public function detect_req_type( $espresso_db_update = NULL ){
405
-		if ( $this->_req_type === NULL ){
406
-			$espresso_db_update = ! empty( $espresso_db_update ) ? $espresso_db_update : $this->fix_espresso_db_upgrade_option();
407
-			$this->_req_type = $this->detect_req_type_given_activation_history( $espresso_db_update, 'ee_espresso_activation', espresso_version() );
404
+	public function detect_req_type($espresso_db_update = NULL) {
405
+		if ($this->_req_type === NULL) {
406
+			$espresso_db_update = ! empty($espresso_db_update) ? $espresso_db_update : $this->fix_espresso_db_upgrade_option();
407
+			$this->_req_type = $this->detect_req_type_given_activation_history($espresso_db_update, 'ee_espresso_activation', espresso_version());
408 408
 		}
409 409
 		return $this->_req_type;
410 410
 	}
@@ -420,39 +420,39 @@  discard block
 block discarded – undo
420 420
 	 * @param string $version_to_upgrade_to the version that was just upgraded to (for core that will be espresso_version())
421 421
 	 * @return int one of the constants on EE_System::req_type_*
422 422
 	 */
423
-	public static function detect_req_type_given_activation_history( $activation_history_for_addon, $activation_indicator_option_name, $version_to_upgrade_to ){
424
-		$version_is_higher = self::_new_version_is_higher( $activation_history_for_addon, $version_to_upgrade_to );
425
-		if( $activation_history_for_addon ){
423
+	public static function detect_req_type_given_activation_history($activation_history_for_addon, $activation_indicator_option_name, $version_to_upgrade_to) {
424
+		$version_is_higher = self::_new_version_is_higher($activation_history_for_addon, $version_to_upgrade_to);
425
+		if ($activation_history_for_addon) {
426 426
 			//it exists, so this isn't a completely new install
427 427
 			//check if this version already in that list of previously installed versions
428
-			if ( ! isset( $activation_history_for_addon[ $version_to_upgrade_to ] )) {
428
+			if ( ! isset($activation_history_for_addon[$version_to_upgrade_to])) {
429 429
 				//it a version we haven't seen before
430
-				if( $version_is_higher === 1 ){
430
+				if ($version_is_higher === 1) {
431 431
 					$req_type = EE_System::req_type_upgrade;
432
-				}else{
432
+				} else {
433 433
 					$req_type = EE_System::req_type_downgrade;
434 434
 				}
435
-				delete_option( $activation_indicator_option_name );
435
+				delete_option($activation_indicator_option_name);
436 436
 			} else {
437 437
 				// its not an update. maybe a reactivation?
438
-				if( get_option( $activation_indicator_option_name, FALSE ) ){
439
-					if ( $version_is_higher === -1 ){
438
+				if (get_option($activation_indicator_option_name, FALSE)) {
439
+					if ($version_is_higher === -1) {
440 440
 						$req_type = EE_System::req_type_downgrade;
441
-					}elseif( $version_is_higher === 0 ){
441
+					}elseif ($version_is_higher === 0) {
442 442
 						//we've seen this version before, but it's an activation. must be a reactivation
443 443
 						$req_type = EE_System::req_type_reactivation;
444
-					}else{//$version_is_higher === 1
444
+					} else {//$version_is_higher === 1
445 445
 						$req_type = EE_System::req_type_upgrade;
446 446
 					}
447
-					delete_option( $activation_indicator_option_name );
447
+					delete_option($activation_indicator_option_name);
448 448
 				} else {
449 449
 					//we've seen this version before and the activation indicate doesn't show it was just activated
450
-					if ( $version_is_higher === -1 ){
450
+					if ($version_is_higher === -1) {
451 451
 						$req_type = EE_System::req_type_downgrade;
452
-					}elseif( $version_is_higher === 0 ){
452
+					}elseif ($version_is_higher === 0) {
453 453
 						//we've seen this version before and it's not an activation. its normal request
454 454
 						$req_type = EE_System::req_type_normal;
455
-					}else{//$version_is_higher === 1
455
+					} else {//$version_is_higher === 1
456 456
 						$req_type = EE_System::req_type_upgrade;
457 457
 					}
458 458
 				}
@@ -460,7 +460,7 @@  discard block
 block discarded – undo
460 460
 		} else {
461 461
 			//brand new install
462 462
 			$req_type = EE_System::req_type_new_activation;
463
-			delete_option( $activation_indicator_option_name );
463
+			delete_option($activation_indicator_option_name);
464 464
 		}
465 465
 		return $req_type;
466 466
 	}
@@ -478,30 +478,30 @@  discard block
 block discarded – undo
478 478
 	 *		0 if $version_to_upgrade_to MATCHES (reactivation or normal request);
479 479
 	 *		1 if $version_to_upgrade_to is HIGHER (upgrade) ;
480 480
 	 */
481
-	protected static function _new_version_is_higher( $activation_history_for_addon, $version_to_upgrade_to ){
481
+	protected static function _new_version_is_higher($activation_history_for_addon, $version_to_upgrade_to) {
482 482
 		//find the most recently-activated version
483 483
 		$most_recently_active_version_activation = '1970-01-01 00:00:00';
484 484
 		$most_recently_active_version = '0.0.0.dev.000';
485
-		if( is_array( $activation_history_for_addon ) ){
486
-			foreach( $activation_history_for_addon as $version => $times_activated ){
485
+		if (is_array($activation_history_for_addon)) {
486
+			foreach ($activation_history_for_addon as $version => $times_activated) {
487 487
 				//check there is a record of when this version was activated. Otherwise,
488 488
 				//mark it as unknown
489
-				if( ! $times_activated ){
490
-					$times_activated = array( 'unknown-date');
489
+				if ( ! $times_activated) {
490
+					$times_activated = array('unknown-date');
491 491
 				}
492
-				if( is_string( $times_activated ) ){
493
-					$times_activated = array( $times_activated );
492
+				if (is_string($times_activated)) {
493
+					$times_activated = array($times_activated);
494 494
 				}
495
-				foreach( $times_activated as $an_activation ){
496
-					if( $an_activation != 'unknown-date' &&
497
-							$an_activation > $most_recently_active_version_activation  ){
495
+				foreach ($times_activated as $an_activation) {
496
+					if ($an_activation != 'unknown-date' &&
497
+							$an_activation > $most_recently_active_version_activation) {
498 498
 						$most_recently_active_version = $version;
499 499
 						$most_recently_active_version_activation = $an_activation == 'unknown-date' ? '1970-01-01 00:00:00' : $an_activation;
500 500
 					}
501 501
 				}
502 502
 			}
503 503
 		}
504
-		return version_compare( $version_to_upgrade_to, $most_recently_active_version );
504
+		return version_compare($version_to_upgrade_to, $most_recently_active_version);
505 505
 	}
506 506
 
507 507
 
@@ -511,20 +511,20 @@  discard block
 block discarded – undo
511 511
 	 * @return void
512 512
 	 */
513 513
 	public function redirect_to_about_ee() {
514
-		$notices = EE_Error::get_notices( FALSE );
514
+		$notices = EE_Error::get_notices(FALSE);
515 515
 		//if current user is an admin and it's not an ajax request
516
-		if(EE_Registry::instance()->CAP->current_user_can( 'manage_options', 'espresso_about_default' ) && ! ( defined('DOING_AJAX') && DOING_AJAX  ) && ! isset( $notices[ 'errors' ] ) ){
517
-			$query_params =  array( 'page' => 'espresso_about' );
516
+		if (EE_Registry::instance()->CAP->current_user_can('manage_options', 'espresso_about_default') && ! (defined('DOING_AJAX') && DOING_AJAX) && ! isset($notices['errors'])) {
517
+			$query_params = array('page' => 'espresso_about');
518 518
 
519
-			if ( EE_System::instance()->detect_req_type() == EE_System::req_type_new_activation ) {
519
+			if (EE_System::instance()->detect_req_type() == EE_System::req_type_new_activation) {
520 520
 			    $query_params['new_activation'] = TRUE;
521 521
 			}
522 522
 
523
-			if ( EE_System::instance()->detect_req_type() == EE_System::req_type_reactivation ) {
523
+			if (EE_System::instance()->detect_req_type() == EE_System::req_type_reactivation) {
524 524
 			    $query_params['reactivation'] = TRUE;
525 525
 			}
526
-			$url = add_query_arg( $query_params, admin_url( 'admin.php' ) );
527
-			wp_safe_redirect( $url );
526
+			$url = add_query_arg($query_params, admin_url('admin.php'));
527
+			wp_safe_redirect($url);
528 528
 			exit();
529 529
 		}
530 530
 	}
@@ -538,31 +538,31 @@  discard block
 block discarded – undo
538 538
 	 *
539 539
 	 * @return void
540 540
 	 */
541
-	public function load_core_configuration(){
542
-		do_action( 'AHEE__EE_System__load_core_configuration__begin', $this );
543
-		EE_Registry::instance()->load_core( 'EE_Load_Textdomain' );
541
+	public function load_core_configuration() {
542
+		do_action('AHEE__EE_System__load_core_configuration__begin', $this);
543
+		EE_Registry::instance()->load_core('EE_Load_Textdomain');
544 544
 		//load textdomain
545 545
 		EE_Load_Textdomain::load_textdomain();
546 546
 		// load and setup EE_Config and EE_Network_Config
547
-		EE_Registry::instance()->load_core( 'Config' );
548
-		EE_Registry::instance()->load_core( 'Network_Config' );
547
+		EE_Registry::instance()->load_core('Config');
548
+		EE_Registry::instance()->load_core('Network_Config');
549 549
 		// setup autoloaders
550 550
 		// enable logging?
551
-		if ( EE_Registry::instance()->CFG->admin->use_full_logging ) {
552
-			EE_Registry::instance()->load_core( 'Log' );
551
+		if (EE_Registry::instance()->CFG->admin->use_full_logging) {
552
+			EE_Registry::instance()->load_core('Log');
553 553
 		}
554 554
 		// check for activation errors
555
-		$activation_errors = get_option( 'ee_plugin_activation_errors', FALSE );
556
-		if ( $activation_errors ) {
557
-			EE_Error::add_error( $activation_errors, __FILE__, __FUNCTION__, __LINE__ );
558
-			update_option( 'ee_plugin_activation_errors', FALSE );
555
+		$activation_errors = get_option('ee_plugin_activation_errors', FALSE);
556
+		if ($activation_errors) {
557
+			EE_Error::add_error($activation_errors, __FILE__, __FUNCTION__, __LINE__);
558
+			update_option('ee_plugin_activation_errors', FALSE);
559 559
 		}
560 560
 		// get model names
561 561
 		$this->_parse_model_names();
562 562
 
563 563
 		//load caf stuff a chance to play during the activation process too.
564 564
 		$this->_maybe_brew_regular();
565
-		do_action( 'AHEE__EE_System__load_core_configuration__complete', $this );
565
+		do_action('AHEE__EE_System__load_core_configuration__complete', $this);
566 566
 	}
567 567
 
568 568
 
@@ -571,23 +571,23 @@  discard block
 block discarded – undo
571 571
 	 *
572 572
 	 * @return void
573 573
 	 */
574
-	private function _parse_model_names(){
574
+	private function _parse_model_names() {
575 575
 		//get all the files in the EE_MODELS folder that end in .model.php
576
-		$models = glob( EE_MODELS.'*.model.php');
576
+		$models = glob(EE_MODELS.'*.model.php');
577 577
 		$model_names = array();
578 578
 		$non_abstract_db_models = array();
579
-		foreach( $models as $model ){
579
+		foreach ($models as $model) {
580 580
 			// get model classname
581
-			$classname = EEH_File::get_classname_from_filepath_with_standard_filename( $model );
582
-			$shortname = str_replace( 'EEM_', '', $classname );
581
+			$classname = EEH_File::get_classname_from_filepath_with_standard_filename($model);
582
+			$shortname = str_replace('EEM_', '', $classname);
583 583
 			$reflectionClass = new ReflectionClass($classname);
584
-			if( $reflectionClass->isSubclassOf('EEM_Base') && ! $reflectionClass->isAbstract()){
584
+			if ($reflectionClass->isSubclassOf('EEM_Base') && ! $reflectionClass->isAbstract()) {
585 585
 				$non_abstract_db_models[$shortname] = $classname;
586 586
 			}
587
-			$model_names[ $shortname ] = $classname;
587
+			$model_names[$shortname] = $classname;
588 588
 		}
589
-		EE_Registry::instance()->models = apply_filters( 'FHEE__EE_System__parse_model_names', $model_names );
590
-		EE_Registry::instance()->non_abstract_db_models = apply_filters( 'FHEE__EE_System__parse_implemented_model_names', $non_abstract_db_models );
589
+		EE_Registry::instance()->models = apply_filters('FHEE__EE_System__parse_model_names', $model_names);
590
+		EE_Registry::instance()->non_abstract_db_models = apply_filters('FHEE__EE_System__parse_implemented_model_names', $non_abstract_db_models);
591 591
 	}
592 592
 
593 593
 
@@ -597,8 +597,8 @@  discard block
 block discarded – undo
597 597
 	 * @return void
598 598
 	 */
599 599
 	private function _maybe_brew_regular() {
600
-		if (( ! defined( 'EE_DECAF' ) ||  EE_DECAF !== TRUE ) && is_readable( EE_CAFF_PATH . 'brewing_regular.php' )) {
601
-			require_once EE_CAFF_PATH . 'brewing_regular.php';
600
+		if (( ! defined('EE_DECAF') || EE_DECAF !== TRUE) && is_readable(EE_CAFF_PATH.'brewing_regular.php')) {
601
+			require_once EE_CAFF_PATH.'brewing_regular.php';
602 602
 		}
603 603
 	}
604 604
 
@@ -615,9 +615,9 @@  discard block
 block discarded – undo
615 615
 	 * @return void
616 616
 	 */
617 617
 	public function register_shortcodes_modules_and_widgets() {
618
-		do_action( 'AHEE__EE_System__register_shortcodes_modules_and_widgets' );
618
+		do_action('AHEE__EE_System__register_shortcodes_modules_and_widgets');
619 619
 		// check for addons using old hookpoint
620
-		if ( has_action( 'AHEE__EE_System__register_shortcodes_modules_and_addons' )) {
620
+		if (has_action('AHEE__EE_System__register_shortcodes_modules_and_addons')) {
621 621
 			$this->_incompatible_addon_error();
622 622
 		}
623 623
 	}
@@ -631,19 +631,19 @@  discard block
 block discarded – undo
631 631
 	*/
632 632
 	private function _incompatible_addon_error() {
633 633
 		// get array of classes hooking into here
634
-		$class_names = EEH_Class_Tools::get_class_names_for_all_callbacks_on_hook( 'AHEE__EE_System__register_shortcodes_modules_and_addons' );
635
-		if ( ! empty( $class_names )) {
636
-			$msg = __( 'The following plugins, addons, or modules appear to be incompatible with this version of Event Espresso and were automatically deactivated to avoid fatal errors:', 'event_espresso' );
634
+		$class_names = EEH_Class_Tools::get_class_names_for_all_callbacks_on_hook('AHEE__EE_System__register_shortcodes_modules_and_addons');
635
+		if ( ! empty($class_names)) {
636
+			$msg = __('The following plugins, addons, or modules appear to be incompatible with this version of Event Espresso and were automatically deactivated to avoid fatal errors:', 'event_espresso');
637 637
 			$msg .= '<ul>';
638
-			foreach ( $class_names as $class_name ) {
639
-				$msg .= '<li><b>Event Espresso - ' . str_replace( array( 'EE_', 'EEM_', 'EED_', 'EES_', 'EEW_' ), '', $class_name ) . '</b></li>';
638
+			foreach ($class_names as $class_name) {
639
+				$msg .= '<li><b>Event Espresso - '.str_replace(array('EE_', 'EEM_', 'EED_', 'EES_', 'EEW_'), '', $class_name).'</b></li>';
640 640
 			}
641 641
 			$msg .= '</ul>';
642
-			$msg .= __( 'Compatibility issues can be avoided and/or resolved by keeping addons and plugins updated to the latest version.', 'event_espresso' );
642
+			$msg .= __('Compatibility issues can be avoided and/or resolved by keeping addons and plugins updated to the latest version.', 'event_espresso');
643 643
 			// save list of incompatible addons to wp-options for later use
644
-			add_option( 'ee_incompatible_addons', $class_names, '', 'no' );
645
-			if ( is_admin() ) {
646
-				EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
644
+			add_option('ee_incompatible_addons', $class_names, '', 'no');
645
+			if (is_admin()) {
646
+				EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
647 647
 			}
648 648
 		}
649 649
 	}
@@ -660,25 +660,25 @@  discard block
 block discarded – undo
660 660
 	 *
661 661
 	 * @return void
662 662
 	 */
663
-	public function brew_espresso(){
664
-		do_action( 'AHEE__EE_System__brew_espresso__begin', $this );
663
+	public function brew_espresso() {
664
+		do_action('AHEE__EE_System__brew_espresso__begin', $this);
665 665
 		// load some final core systems
666
-		add_action( 'init', array( $this, 'set_hooks_for_core' ), 1 );
667
-		add_action( 'init', array( $this, 'perform_activations_upgrades_and_migrations' ), 3 );
668
-		add_action( 'init', array( $this, 'load_CPTs_and_session' ), 5 );
669
-		add_action( 'init', array( $this, 'load_controllers' ), 7 );
670
-		add_action( 'init', array( $this, 'core_loaded_and_ready' ), 9 );
671
-		add_action( 'init', array( $this, 'initialize' ), 10 );
672
-		add_action( 'init', array( $this, 'initialize_last' ), 100 );
673
-		add_action('wp_enqueue_scripts', array( $this, 'wp_enqueue_scripts' ), 25 );
674
-		add_action( 'admin_bar_menu', array( $this, 'espresso_toolbar_items' ), 100 );
675
-
676
-		if ( is_admin() && apply_filters( 'FHEE__EE_System__brew_espresso__load_pue', TRUE )  ) {
666
+		add_action('init', array($this, 'set_hooks_for_core'), 1);
667
+		add_action('init', array($this, 'perform_activations_upgrades_and_migrations'), 3);
668
+		add_action('init', array($this, 'load_CPTs_and_session'), 5);
669
+		add_action('init', array($this, 'load_controllers'), 7);
670
+		add_action('init', array($this, 'core_loaded_and_ready'), 9);
671
+		add_action('init', array($this, 'initialize'), 10);
672
+		add_action('init', array($this, 'initialize_last'), 100);
673
+		add_action('wp_enqueue_scripts', array($this, 'wp_enqueue_scripts'), 25);
674
+		add_action('admin_bar_menu', array($this, 'espresso_toolbar_items'), 100);
675
+
676
+		if (is_admin() && apply_filters('FHEE__EE_System__brew_espresso__load_pue', TRUE)) {
677 677
 			// pew pew pew
678
-			EE_Registry::instance()->load_core( 'PUE' );
679
-			do_action( 'AHEE__EE_System__brew_espresso__after_pue_init' );
678
+			EE_Registry::instance()->load_core('PUE');
679
+			do_action('AHEE__EE_System__brew_espresso__after_pue_init');
680 680
 		}
681
-		do_action( 'AHEE__EE_System__brew_espresso__complete', $this );
681
+		do_action('AHEE__EE_System__brew_espresso__complete', $this);
682 682
 	}
683 683
 
684 684
 
@@ -692,7 +692,7 @@  discard block
 block discarded – undo
692 692
 	 */
693 693
 	public function set_hooks_for_core() {
694 694
 		$this->_deactivate_incompatible_addons();
695
-		do_action( 'AHEE__EE_System__set_hooks_for_core' );
695
+		do_action('AHEE__EE_System__set_hooks_for_core');
696 696
 	}
697 697
 
698 698
 
@@ -701,15 +701,15 @@  discard block
 block discarded – undo
701 701
 	 * Using the information gathered in EE_System::_incompatible_addon_error,
702 702
 	 * deactivates any addons considered incompatible with the current version of EE
703 703
 	 */
704
-	private function _deactivate_incompatible_addons(){
705
-		$incompatible_addons = get_option( 'ee_incompatible_addons', array() );
706
-		if ( ! empty( $incompatible_addons )) {
707
-			$active_plugins = get_option( 'active_plugins', array() );
708
-			foreach ( $active_plugins as $active_plugin ) {
709
-				foreach ( $incompatible_addons as $incompatible_addon ) {
710
-					if ( strpos( $active_plugin,  $incompatible_addon ) !== FALSE ) {
711
-						unset( $_GET['activate'] );
712
-						espresso_deactivate_plugin( $active_plugin );
704
+	private function _deactivate_incompatible_addons() {
705
+		$incompatible_addons = get_option('ee_incompatible_addons', array());
706
+		if ( ! empty($incompatible_addons)) {
707
+			$active_plugins = get_option('active_plugins', array());
708
+			foreach ($active_plugins as $active_plugin) {
709
+				foreach ($incompatible_addons as $incompatible_addon) {
710
+					if (strpos($active_plugin, $incompatible_addon) !== FALSE) {
711
+						unset($_GET['activate']);
712
+						espresso_deactivate_plugin($active_plugin);
713 713
 					}
714 714
 				}
715 715
 			}
@@ -726,10 +726,10 @@  discard block
 block discarded – undo
726 726
 	 */
727 727
 	public function perform_activations_upgrades_and_migrations() {
728 728
 		//first check if we had previously attempted to setup EE's directories but failed
729
-		if( EEH_Activation::upload_directories_incomplete() ) {
729
+		if (EEH_Activation::upload_directories_incomplete()) {
730 730
 			EEH_Activation::create_upload_directories();
731 731
 		}
732
-		do_action( 'AHEE__EE_System__perform_activations_upgrades_and_migrations' );
732
+		do_action('AHEE__EE_System__perform_activations_upgrades_and_migrations');
733 733
 	}
734 734
 
735 735
 
@@ -741,10 +741,10 @@  discard block
 block discarded – undo
741 741
 	 *  	@return 	void
742 742
 	 */
743 743
 	public function load_CPTs_and_session() {
744
-		do_action( 'AHEE__EE_System__load_CPTs_and_session__start' );
744
+		do_action('AHEE__EE_System__load_CPTs_and_session__start');
745 745
 		// register Custom Post Types
746
-		EE_Registry::instance()->load_core( 'Register_CPTs' );
747
-		do_action( 'AHEE__EE_System__load_CPTs_and_session__complete' );
746
+		EE_Registry::instance()->load_core('Register_CPTs');
747
+		do_action('AHEE__EE_System__load_CPTs_and_session__complete');
748 748
 	}
749 749
 
750 750
 
@@ -759,16 +759,16 @@  discard block
 block discarded – undo
759 759
 	* @return void
760 760
 	*/
761 761
 	public function load_controllers() {
762
-		do_action( 'AHEE__EE_System__load_controllers__start' );
762
+		do_action('AHEE__EE_System__load_controllers__start');
763 763
 		// let's get it started
764
-		if ( ! is_admin() && !  EE_Maintenance_Mode::instance()->level() ) {
765
-			do_action( 'AHEE__EE_System__load_controllers__load_front_controllers' );
766
-			EE_Registry::instance()->load_core( 'Front_Controller' );
767
-		} else if ( ! EE_FRONT_AJAX ) {
768
-			do_action( 'AHEE__EE_System__load_controllers__load_admin_controllers' );
769
-			EE_Registry::instance()->load_core( 'Admin' );
764
+		if ( ! is_admin() && ! EE_Maintenance_Mode::instance()->level()) {
765
+			do_action('AHEE__EE_System__load_controllers__load_front_controllers');
766
+			EE_Registry::instance()->load_core('Front_Controller');
767
+		} else if ( ! EE_FRONT_AJAX) {
768
+			do_action('AHEE__EE_System__load_controllers__load_admin_controllers');
769
+			EE_Registry::instance()->load_core('Admin');
770 770
 		}
771
-		do_action( 'AHEE__EE_System__load_controllers__complete' );
771
+		do_action('AHEE__EE_System__load_controllers__complete');
772 772
 	}
773 773
 
774 774
 
@@ -782,10 +782,10 @@  discard block
 block discarded – undo
782 782
 	* @return void
783 783
 	*/
784 784
 	public function core_loaded_and_ready() {
785
-		do_action( 'AHEE__EE_System__core_loaded_and_ready' );
786
-		do_action( 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons' );
785
+		do_action('AHEE__EE_System__core_loaded_and_ready');
786
+		do_action('AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons');
787 787
 //		add_action( 'wp_loaded', array( $this, 'set_hooks_for_shortcodes_modules_and_addons' ), 1 );
788
-		EE_Registry::instance()->load_core( 'Session' );
788
+		EE_Registry::instance()->load_core('Session');
789 789
 	}
790 790
 
791 791
 
@@ -799,7 +799,7 @@  discard block
 block discarded – undo
799 799
 	* @return void
800 800
 	*/
801 801
 	public function initialize() {
802
-		do_action( 'AHEE__EE_System__initialize' );
802
+		do_action('AHEE__EE_System__initialize');
803 803
 	}
804 804
 
805 805
 
@@ -813,7 +813,7 @@  discard block
 block discarded – undo
813 813
 	* @return void
814 814
 	*/
815 815
 	public function initialize_last() {
816
-		do_action( 'AHEE__EE_System__initialize_last' );
816
+		do_action('AHEE__EE_System__initialize_last');
817 817
 	}
818 818
 
819 819
 
@@ -845,21 +845,21 @@  discard block
 block discarded – undo
845 845
 	*/
846 846
 	public static function do_not_cache() {
847 847
 		// set no cache constants
848
-		if ( ! defined( 'DONOTCACHEPAGE' ) ) {
849
-			define( 'DONOTCACHEPAGE', true );
848
+		if ( ! defined('DONOTCACHEPAGE')) {
849
+			define('DONOTCACHEPAGE', true);
850 850
 		}
851
-		if ( ! defined( 'DONOTCACHCEOBJECT' ) ) {
852
-			define( 'DONOTCACHCEOBJECT', true );
851
+		if ( ! defined('DONOTCACHCEOBJECT')) {
852
+			define('DONOTCACHCEOBJECT', true);
853 853
 		}
854
-		if ( ! defined( 'DONOTCACHEDB' ) ) {
855
-			define( 'DONOTCACHEDB', true );
854
+		if ( ! defined('DONOTCACHEDB')) {
855
+			define('DONOTCACHEDB', true);
856 856
 		}
857 857
 		// add no cache headers
858
-		add_action( 'send_headers' , array( 'EE_System', 'nocache_headers' ), 10 );
858
+		add_action('send_headers', array('EE_System', 'nocache_headers'), 10);
859 859
 		// plus a little extra for nginx
860
-		add_filter( 'nocache_headers', array( 'EE_System', 'nocache_headers_nginx' ), 10, 1 );
860
+		add_filter('nocache_headers', array('EE_System', 'nocache_headers_nginx'), 10, 1);
861 861
 		// prevent browsers from prefetching of the rel='next' link, because it may contain content that interferes with the registration process
862
-		remove_action( 'wp_head', 'adjacent_posts_rel_link_wp_head' );
862
+		remove_action('wp_head', 'adjacent_posts_rel_link_wp_head');
863 863
 	}
864 864
 
865 865
 
@@ -871,7 +871,7 @@  discard block
 block discarded – undo
871 871
 	 * @param $headers
872 872
 	 * @return    array
873 873
 	 */
874
-	public static function nocache_headers_nginx ( $headers ) {
874
+	public static function nocache_headers_nginx($headers) {
875 875
 		$headers['X-Accel-Expires'] = 0;
876 876
 		return $headers;
877 877
 	}
@@ -897,15 +897,15 @@  discard block
 block discarded – undo
897 897
 	 * @param $admin_bar
898 898
 	 * @return    void
899 899
 	 */
900
-	public function espresso_toolbar_items( $admin_bar ) {
900
+	public function espresso_toolbar_items($admin_bar) {
901 901
 
902 902
 		// if in full M-Mode, or its an AJAX request, or user is NOT an admin
903
-		if ( EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance || defined( 'DOING_AJAX' ) || ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_ee', 'ee_admin_bar_menu_top_level' )) {
903
+		if (EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance || defined('DOING_AJAX') || ! EE_Registry::instance()->CAP->current_user_can('ee_read_ee', 'ee_admin_bar_menu_top_level')) {
904 904
 			return;
905 905
 		}
906 906
 
907
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
908
-		EE_Registry::instance()->load_helper( 'URL' );
907
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
908
+		EE_Registry::instance()->load_helper('URL');
909 909
 		$menu_class = 'espresso_menu_item_class';
910 910
 		//we don't use the constants EVENTS_ADMIN_URL or REG_ADMIN_URL
911 911
 		//because they're only defined in each of their respective constructors
@@ -917,20 +917,20 @@  discard block
 block discarded – undo
917 917
 		//Top Level
918 918
 		$admin_bar->add_menu(array(
919 919
 				'id' => 'espresso-toolbar',
920
-				'title' => '<span class="ee-icon ee-icon-ee-cup-thick ee-icon-size-20"></span><span class="ab-label">' . _x('Event Espresso', 'admin bar menu group label', 'event_espresso') . '</span>',
920
+				'title' => '<span class="ee-icon ee-icon-ee-cup-thick ee-icon-size-20"></span><span class="ab-label">'._x('Event Espresso', 'admin bar menu group label', 'event_espresso').'</span>',
921 921
 				'href' => $events_admin_url,
922 922
 				'meta' => array(
923 923
 						'title' => __('Event Espresso', 'event_espresso'),
924
-						'class' => $menu_class . 'first'
924
+						'class' => $menu_class.'first'
925 925
 				),
926 926
 		));
927 927
 
928 928
 		//Events
929
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events' ) ) {
929
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events')) {
930 930
 			$admin_bar->add_menu(array(
931 931
 					'id' => 'espresso-toolbar-events',
932 932
 					'parent' => 'espresso-toolbar',
933
-					'title' => __( 'Events', 'event_espresso' ),
933
+					'title' => __('Events', 'event_espresso'),
934 934
 					'href' => $events_admin_url,
935 935
 					'meta' => array(
936 936
 							'title' => __('Events', 'event_espresso'),
@@ -941,13 +941,13 @@  discard block
 block discarded – undo
941 941
 		}
942 942
 
943 943
 
944
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_edit_events', 'ee_admin_bar_menu_espresso-toolbar-events-new' ) ) {
944
+		if (EE_Registry::instance()->CAP->current_user_can('ee_edit_events', 'ee_admin_bar_menu_espresso-toolbar-events-new')) {
945 945
 			//Events Add New
946 946
 			$admin_bar->add_menu(array(
947 947
 					'id' => 'espresso-toolbar-events-new',
948 948
 					'parent' => 'espresso-toolbar-events',
949 949
 					'title' => __('Add New', 'event_espresso'),
950
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'create_new' ), $events_admin_url ),
950
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'create_new'), $events_admin_url),
951 951
 					'meta' => array(
952 952
 							'title' => __('Add New', 'event_espresso'),
953 953
 							'target' => '',
@@ -956,18 +956,18 @@  discard block
 block discarded – undo
956 956
 			));
957 957
 		}
958 958
 
959
-		if ( is_single() && ( get_post_type() == 'espresso_events' ) ) {
959
+		if (is_single() && (get_post_type() == 'espresso_events')) {
960 960
 
961 961
 			//Current post
962 962
 			global $post;		
963 963
     	
964
-	    	if ( EE_Registry::instance()->CAP->current_user_can( 'ee_edit_event', 'ee_admin_bar_menu_espresso-toolbar-events-edit', $post->ID ) ) {
964
+	    	if (EE_Registry::instance()->CAP->current_user_can('ee_edit_event', 'ee_admin_bar_menu_espresso-toolbar-events-edit', $post->ID)) {
965 965
 				//Events Edit Current Event
966 966
 				$admin_bar->add_menu(array(
967 967
 						'id' => 'espresso-toolbar-events-edit',
968 968
 						'parent' => 'espresso-toolbar-events',
969 969
 						'title' => __('Edit Event', 'event_espresso'),
970
-						'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'edit', 'post'=>$post->ID ), $events_admin_url ),
970
+						'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'edit', 'post'=>$post->ID), $events_admin_url),
971 971
 						'meta' => array(
972 972
 								'title' => __('Edit Event', 'event_espresso'),
973 973
 								'target' => '',
@@ -979,11 +979,11 @@  discard block
 block discarded – undo
979 979
 		}
980 980
 
981 981
 		//Events View
982
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-view' ) ) {
982
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-view')) {
983 983
 			$admin_bar->add_menu(array(
984 984
 					'id' => 'espresso-toolbar-events-view',
985 985
 					'parent' => 'espresso-toolbar-events',
986
-					'title' => __( 'View', 'event_espresso' ),
986
+					'title' => __('View', 'event_espresso'),
987 987
 					'href' => $events_admin_url,
988 988
 					'meta' => array(
989 989
 							'title' => __('View', 'event_espresso'),
@@ -993,12 +993,12 @@  discard block
 block discarded – undo
993 993
 			));
994 994
 		}
995 995
 
996
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-all' ) ) {
996
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-all')) {
997 997
 			//Events View All
998 998
 			$admin_bar->add_menu(array(
999 999
 					'id' => 'espresso-toolbar-events-all',
1000 1000
 					'parent' => 'espresso-toolbar-events-view',
1001
-					'title' => __( 'All', 'event_espresso' ),
1001
+					'title' => __('All', 'event_espresso'),
1002 1002
 					'href' => $events_admin_url,
1003 1003
 					'meta' => array(
1004 1004
 							'title' => __('All', 'event_espresso'),
@@ -1009,13 +1009,13 @@  discard block
 block discarded – undo
1009 1009
 		}
1010 1010
 
1011 1011
 
1012
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-today' ) ) {
1012
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-today')) {
1013 1013
 			//Events View Today
1014 1014
 			$admin_bar->add_menu(array(
1015 1015
 					'id' => 'espresso-toolbar-events-today',
1016 1016
 					'parent' => 'espresso-toolbar-events-view',
1017 1017
 					'title' => __('Today', 'event_espresso'),
1018
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today' ), $events_admin_url ),
1018
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today'), $events_admin_url),
1019 1019
 					'meta' => array(
1020 1020
 							'title' => __('Today', 'event_espresso'),
1021 1021
 							'target' => '',
@@ -1025,13 +1025,13 @@  discard block
 block discarded – undo
1025 1025
 		}
1026 1026
 
1027 1027
 
1028
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-month' ) ) {
1028
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-month')) {
1029 1029
 			//Events View This Month
1030 1030
 			$admin_bar->add_menu(array(
1031 1031
 					'id' => 'espresso-toolbar-events-month',
1032 1032
 					'parent' => 'espresso-toolbar-events-view',
1033
-					'title' => __( 'This Month', 'event_espresso'),
1034
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month' ), $events_admin_url ),
1033
+					'title' => __('This Month', 'event_espresso'),
1034
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month'), $events_admin_url),
1035 1035
 					'meta' => array(
1036 1036
 							'title' => __('This Month', 'event_espresso'),
1037 1037
 							'target' => '',
@@ -1041,11 +1041,11 @@  discard block
 block discarded – undo
1041 1041
 		}
1042 1042
 
1043 1043
 		//Registration Overview
1044
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations' ) ) {
1044
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations')) {
1045 1045
 			$admin_bar->add_menu(array(
1046 1046
 					'id' => 'espresso-toolbar-registrations',
1047 1047
 					'parent' => 'espresso-toolbar',
1048
-					'title' => __( 'Registrations', 'event_espresso' ),
1048
+					'title' => __('Registrations', 'event_espresso'),
1049 1049
 					'href' => $reg_admin_url,
1050 1050
 					'meta' => array(
1051 1051
 							'title' => __('Registrations', 'event_espresso'),
@@ -1056,12 +1056,12 @@  discard block
 block discarded – undo
1056 1056
 		}
1057 1057
 
1058 1058
 		//Registration Overview Today
1059
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today' ) ) {
1059
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today')) {
1060 1060
 			$admin_bar->add_menu(array(
1061 1061
 					'id' => 'espresso-toolbar-registrations-today',
1062 1062
 					'parent' => 'espresso-toolbar-registrations',
1063
-					'title' => __( 'Today', 'event_espresso'),
1064
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today' ), $reg_admin_url ),
1063
+					'title' => __('Today', 'event_espresso'),
1064
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today'), $reg_admin_url),
1065 1065
 					'meta' => array(
1066 1066
 							'title' => __('Today', 'event_espresso'),
1067 1067
 							'target' => '',
@@ -1071,14 +1071,14 @@  discard block
 block discarded – undo
1071 1071
 		}
1072 1072
 
1073 1073
 		//Registration Overview Today Completed
1074
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-approved' ) ) {
1074
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-approved')) {
1075 1075
 			$admin_bar->add_menu(array(
1076 1076
 					'id' => 'espresso-toolbar-registrations-today-approved',
1077 1077
 					'parent' => 'espresso-toolbar-registrations-today',
1078
-					'title' => __( 'Approved', 'event_espresso' ),
1079
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_approved ), $reg_admin_url ),
1078
+					'title' => __('Approved', 'event_espresso'),
1079
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_approved), $reg_admin_url),
1080 1080
 					'meta' => array(
1081
-							'title' => __('Approved', 'event_espresso' ),
1081
+							'title' => __('Approved', 'event_espresso'),
1082 1082
 							'target' => '',
1083 1083
 							'class' => $menu_class
1084 1084
 					),
@@ -1086,14 +1086,14 @@  discard block
 block discarded – undo
1086 1086
 		}
1087 1087
 
1088 1088
 		//Registration Overview Today Pending\
1089
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-pending' ) ) {
1089
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-pending')) {
1090 1090
 			$admin_bar->add_menu(array(
1091 1091
 					'id' => 'espresso-toolbar-registrations-today-pending',
1092 1092
 					'parent' => 'espresso-toolbar-registrations-today',
1093
-					'title' => __( 'Pending', 'event_espresso' ),
1094
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today', 'reg_status'=>EEM_Registration::status_id_pending_payment ), $reg_admin_url ),
1093
+					'title' => __('Pending', 'event_espresso'),
1094
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today', 'reg_status'=>EEM_Registration::status_id_pending_payment), $reg_admin_url),
1095 1095
 					'meta' => array(
1096
-							'title' => __('Pending Payment', 'event_espresso' ),
1096
+							'title' => __('Pending Payment', 'event_espresso'),
1097 1097
 							'target' => '',
1098 1098
 							'class' => $menu_class
1099 1099
 					),
@@ -1101,14 +1101,14 @@  discard block
 block discarded – undo
1101 1101
 		}
1102 1102
 
1103 1103
 		//Registration Overview Today Incomplete
1104
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-not-approved' ) ) {
1104
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-not-approved')) {
1105 1105
 			$admin_bar->add_menu(array(
1106 1106
 					'id' => 'espresso-toolbar-registrations-today-not-approved',
1107 1107
 					'parent' => 'espresso-toolbar-registrations-today',
1108
-					'title' => __( 'Not Approved', 'event_espresso' ),
1109
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_not_approved ), $reg_admin_url ),
1108
+					'title' => __('Not Approved', 'event_espresso'),
1109
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_not_approved), $reg_admin_url),
1110 1110
 					'meta' => array(
1111
-							'title' => __('Not Approved', 'event_espresso' ),
1111
+							'title' => __('Not Approved', 'event_espresso'),
1112 1112
 							'target' => '',
1113 1113
 							'class' => $menu_class
1114 1114
 					),
@@ -1116,12 +1116,12 @@  discard block
 block discarded – undo
1116 1116
 		}
1117 1117
 
1118 1118
 		//Registration Overview Today Incomplete
1119
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-cancelled' ) ) {
1119
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-cancelled')) {
1120 1120
 			$admin_bar->add_menu(array(
1121 1121
 					'id' => 'espresso-toolbar-registrations-today-cancelled',
1122 1122
 					'parent' => 'espresso-toolbar-registrations-today',
1123
-					'title' => __( 'Cancelled', 'event_espresso'),
1124
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_cancelled ), $reg_admin_url ),
1123
+					'title' => __('Cancelled', 'event_espresso'),
1124
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_cancelled), $reg_admin_url),
1125 1125
 					'meta' => array(
1126 1126
 							'title' => __('Cancelled', 'event_espresso'),
1127 1127
 							'target' => '',
@@ -1131,12 +1131,12 @@  discard block
 block discarded – undo
1131 1131
 		}
1132 1132
 
1133 1133
 		//Registration Overview This Month
1134
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month' ) ) {
1134
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month')) {
1135 1135
 			$admin_bar->add_menu(array(
1136 1136
 					'id' => 'espresso-toolbar-registrations-month',
1137 1137
 					'parent' => 'espresso-toolbar-registrations',
1138
-					'title' => __( 'This Month', 'event_espresso' ),
1139
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month' ), $reg_admin_url ),
1138
+					'title' => __('This Month', 'event_espresso'),
1139
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month'), $reg_admin_url),
1140 1140
 					'meta' => array(
1141 1141
 							'title' => __('This Month', 'event_espresso'),
1142 1142
 							'target' => '',
@@ -1146,12 +1146,12 @@  discard block
 block discarded – undo
1146 1146
 		}
1147 1147
 
1148 1148
 		//Registration Overview This Month Approved
1149
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-approved' ) ) {
1149
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-approved')) {
1150 1150
 			$admin_bar->add_menu(array(
1151 1151
 					'id' => 'espresso-toolbar-registrations-month-approved',
1152 1152
 					'parent' => 'espresso-toolbar-registrations-month',
1153
-					'title' => __( 'Approved', 'event_espresso' ),
1154
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_approved ), $reg_admin_url ),
1153
+					'title' => __('Approved', 'event_espresso'),
1154
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_approved), $reg_admin_url),
1155 1155
 					'meta' => array(
1156 1156
 							'title' => __('Approved', 'event_espresso'),
1157 1157
 							'target' => '',
@@ -1161,12 +1161,12 @@  discard block
 block discarded – undo
1161 1161
 		}
1162 1162
 
1163 1163
 		//Registration Overview This Month Pending
1164
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-pending' ) ) {
1164
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-pending')) {
1165 1165
 			$admin_bar->add_menu(array(
1166 1166
 					'id' => 'espresso-toolbar-registrations-month-pending',
1167 1167
 					'parent' => 'espresso-toolbar-registrations-month',
1168
-					'title' => __( 'Pending', 'event_espresso'),
1169
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_pending_payment ), $reg_admin_url ),
1168
+					'title' => __('Pending', 'event_espresso'),
1169
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_pending_payment), $reg_admin_url),
1170 1170
 					'meta' => array(
1171 1171
 							'title' => __('Pending', 'event_espresso'),
1172 1172
 							'target' => '',
@@ -1176,14 +1176,14 @@  discard block
 block discarded – undo
1176 1176
 		}
1177 1177
 
1178 1178
 		//Registration Overview This Month Not Approved
1179
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-not-approved' ) ) {
1179
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-not-approved')) {
1180 1180
 			$admin_bar->add_menu(array(
1181 1181
 					'id' => 'espresso-toolbar-registrations-month-not-approved',
1182 1182
 					'parent' => 'espresso-toolbar-registrations-month',
1183
-					'title' => __( 'Not Approved', 'event_espresso'),
1184
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_not_approved ), $reg_admin_url ),
1183
+					'title' => __('Not Approved', 'event_espresso'),
1184
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_not_approved), $reg_admin_url),
1185 1185
 					'meta' => array(
1186
-							'title' => __('Not Approved', 'event_espresso' ),
1186
+							'title' => __('Not Approved', 'event_espresso'),
1187 1187
 							'target' => '',
1188 1188
 							'class' => $menu_class
1189 1189
 					),
@@ -1192,12 +1192,12 @@  discard block
 block discarded – undo
1192 1192
 
1193 1193
 
1194 1194
 		//Registration Overview This Month Cancelled
1195
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-cancelled' ) ) {
1195
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-cancelled')) {
1196 1196
 			$admin_bar->add_menu(array(
1197 1197
 					'id' => 'espresso-toolbar-registrations-month-cancelled',
1198 1198
 					'parent' => 'espresso-toolbar-registrations-month',
1199 1199
 					'title' => __('Cancelled', 'event_espresso'),
1200
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_cancelled ), $reg_admin_url ),
1200
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_cancelled), $reg_admin_url),
1201 1201
 					'meta' => array(
1202 1202
 							'title' => __('Cancelled', 'event_espresso'),
1203 1203
 							'target' => '',
@@ -1207,11 +1207,11 @@  discard block
 block discarded – undo
1207 1207
 		}
1208 1208
 
1209 1209
 		//Extensions & Services
1210
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_ee', 'ee_admin_bar_menu_espresso-toolbar-extensions-and-services' ) ) {
1210
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_ee', 'ee_admin_bar_menu_espresso-toolbar-extensions-and-services')) {
1211 1211
 			$admin_bar->add_menu(array(
1212 1212
 					'id' => 'espresso-toolbar-extensions-and-services',
1213 1213
 					'parent' => 'espresso-toolbar',
1214
-					'title' => __( 'Extensions & Services', 'event_espresso' ),
1214
+					'title' => __('Extensions & Services', 'event_espresso'),
1215 1215
 					'href' => $extensions_admin_url,
1216 1216
 					'meta' => array(
1217 1217
 							'title' => __('Extensions & Services', 'event_espresso'),
@@ -1233,8 +1233,8 @@  discard block
 block discarded – undo
1233 1233
 	 * @param  array  $exclude_array any existing pages being excluded are in this array.
1234 1234
 	 * @return array
1235 1235
 	 */
1236
-	public function remove_pages_from_wp_list_pages( $exclude_array ) {
1237
-		return  array_merge( $exclude_array, EE_Registry::instance()->CFG->core->get_critical_pages_array() );
1236
+	public function remove_pages_from_wp_list_pages($exclude_array) {
1237
+		return  array_merge($exclude_array, EE_Registry::instance()->CFG->core->get_critical_pages_array());
1238 1238
 	}
1239 1239
 
1240 1240
 
@@ -1254,11 +1254,11 @@  discard block
 block discarded – undo
1254 1254
 	 */
1255 1255
 	public function wp_enqueue_scripts() {
1256 1256
 		// unlike other systems, EE_System_scripts loading is turned ON by default, but prior to the init hook, can be turned off via: add_filter( 'FHEE_load_EE_System_scripts', '__return_false' );
1257
-		if ( apply_filters( 'FHEE_load_EE_System_scripts', TRUE ) ) {
1257
+		if (apply_filters('FHEE_load_EE_System_scripts', TRUE)) {
1258 1258
 			// jquery_validate loading is turned OFF by default, but prior to the wp_enqueue_scripts hook, can be turned back on again via:  add_filter( 'FHEE_load_jquery_validate', '__return_true' );
1259
-			if ( apply_filters( 'FHEE_load_jquery_validate', FALSE ) ) {
1259
+			if (apply_filters('FHEE_load_jquery_validate', FALSE)) {
1260 1260
 				// register jQuery Validate
1261
-				wp_register_script( 'jquery-validate', EE_GLOBAL_ASSETS_URL . 'scripts/jquery.validate.min.js', array('jquery'), '1.11.1', TRUE );
1261
+				wp_register_script('jquery-validate', EE_GLOBAL_ASSETS_URL.'scripts/jquery.validate.min.js', array('jquery'), '1.11.1', TRUE);
1262 1262
 			}
1263 1263
 		}
1264 1264
 	}
Please login to merge, or discard this patch.
core/helpers/EEH_Template.helper.php 1 patch
Spacing   +196 added lines, -196 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,80 +210,80 @@  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
 			EE_Registry::instance()->load_helper('File');
239 239
 			// loop through $templates
240
-			foreach ( $templates as $template ) {
240
+			foreach ($templates as $template) {
241 241
 				// normalize directory separators
242
-				$template = EEH_File::standardise_directory_separators( $template );
243
-				$file_name = basename( $template );
244
-				$template_path_minus_file_name = substr( $template, 0, ( strlen( $file_name ) * -1 ) );
242
+				$template = EEH_File::standardise_directory_separators($template);
243
+				$file_name = basename($template);
244
+				$template_path_minus_file_name = substr($template, 0, (strlen($file_name) * -1));
245 245
 				// while looping through all template folder paths
246
-				foreach ( $template_folder_paths as $template_folder_path ) {
246
+				foreach ($template_folder_paths as $template_folder_path) {
247 247
 					// normalize directory separators
248
-					$template_folder_path = EEH_File::standardise_directory_separators( $template_folder_path );
248
+					$template_folder_path = EEH_File::standardise_directory_separators($template_folder_path);
249 249
 					// determine if any common base path exists between the two paths
250 250
 					$common_base_path = EEH_Template::_find_common_base_path(
251
-						array( $template_folder_path, $template_path_minus_file_name )
251
+						array($template_folder_path, $template_path_minus_file_name)
252 252
 					);
253
-					if ( $common_base_path !== '' ) {
253
+					if ($common_base_path !== '') {
254 254
 						// both paths have a common base, so just tack the filename onto our search path
255
-						$resolved_path = EEH_File::end_with_directory_separator( $template_folder_path ) . $file_name;
255
+						$resolved_path = EEH_File::end_with_directory_separator($template_folder_path).$file_name;
256 256
 					} else {
257 257
 						// no common base path, so let's just concatenate
258
-						$resolved_path = EEH_File::end_with_directory_separator( $template_folder_path ) . $template;
258
+						$resolved_path = EEH_File::end_with_directory_separator($template_folder_path).$template;
259 259
 					}
260 260
 					// build up our template locations array by adding our resolved paths
261 261
 					$full_template_paths[] = $resolved_path;
262 262
 				}
263 263
 				// if $template is an absolute path, then we'll tack it onto the start of our array so that it gets searched first
264
-				array_unshift( $full_template_paths, $template );
264
+				array_unshift($full_template_paths, $template);
265 265
 				// path to the directory of the current theme: /wp-content/themes/(current WP theme)/
266
-				array_unshift( $full_template_paths, get_template_directory() . DS . $file_name );
266
+				array_unshift($full_template_paths, get_template_directory().DS.$file_name);
267 267
 			}
268 268
 			// filter final array of full template paths
269
-			$full_template_paths = apply_filters( 'FHEE__EEH_Template__locate_template__full_template_paths', $full_template_paths, $file_name );
269
+			$full_template_paths = apply_filters('FHEE__EEH_Template__locate_template__full_template_paths', $full_template_paths, $file_name);
270 270
 			// now loop through our final array of template location paths and check each location
271
-			foreach ( (array)$full_template_paths as $full_template_path ) {
272
-				if ( is_readable( $full_template_path )) {
273
-					$template_path = str_replace( array( '\\', '/' ), DIRECTORY_SEPARATOR, $full_template_path );
271
+			foreach ((array) $full_template_paths as $full_template_path) {
272
+				if (is_readable($full_template_path)) {
273
+					$template_path = str_replace(array('\\', '/'), DIRECTORY_SEPARATOR, $full_template_path);
274 274
 					break;
275 275
 				}
276 276
 			}
277 277
 		}
278 278
 		// if we got it and you want to see it...
279
-		if ( $template_path && $load && ! $check_if_custom  ) {
280
-			if ( $return_string ) {
281
-				return EEH_Template::display_template( $template_path, $template_args, TRUE );
279
+		if ($template_path && $load && ! $check_if_custom) {
280
+			if ($return_string) {
281
+				return EEH_Template::display_template($template_path, $template_args, TRUE);
282 282
 			} else {
283
-				EEH_Template::display_template( $template_path, $template_args, FALSE );
283
+				EEH_Template::display_template($template_path, $template_args, FALSE);
284 284
 			}
285 285
 		}
286
-		return $check_if_custom && ! empty( $template_path ) ? TRUE : $template_path;
286
+		return $check_if_custom && ! empty($template_path) ? TRUE : $template_path;
287 287
 	}
288 288
 
289 289
 
@@ -296,21 +296,21 @@  discard block
 block discarded – undo
296 296
 	 * @param array $paths
297 297
 	 * @return string
298 298
 	 */
299
-	protected static function _find_common_base_path( $paths ) {
299
+	protected static function _find_common_base_path($paths) {
300 300
 		$last_offset = 0;
301 301
 		$common_base_path = '';
302
-		while ( ( $index = strpos( $paths[ 0 ], DS, $last_offset ) ) !== false ) {
302
+		while (($index = strpos($paths[0], DS, $last_offset)) !== false) {
303 303
 			$dir_length = $index - $last_offset + 1;
304
-			$directory = substr( $paths[ 0 ], $last_offset, $dir_length );
305
-			foreach ( $paths as $path ) {
306
-				if ( substr( $path, $last_offset, $dir_length ) != $directory ) {
304
+			$directory = substr($paths[0], $last_offset, $dir_length);
305
+			foreach ($paths as $path) {
306
+				if (substr($path, $last_offset, $dir_length) != $directory) {
307 307
 					return $common_base_path;
308 308
 				}
309 309
 			}
310 310
 			$common_base_path .= $directory;
311 311
 			$last_offset = $index + 1;
312 312
 		}
313
-		return substr( $common_base_path, 0, -1 );
313
+		return substr($common_base_path, 0, -1);
314 314
 	}
315 315
 
316 316
 
@@ -322,9 +322,9 @@  discard block
 block discarded – undo
322 322
 	 * @param  boolean    $return_string whether to send output immediately to screen, or capture and return as a string
323 323
 	 * @return mixed string
324 324
 	 */
325
-	public static function display_template( $template_path = FALSE, $template_args = array(), $return_string = FALSE ) {
325
+	public static function display_template($template_path = FALSE, $template_args = array(), $return_string = FALSE) {
326 326
 		//require the template validator for verifying variables are set according to how the template requires
327
-		EE_Registry::instance()->load_helper( 'Template_Validator' );
327
+		EE_Registry::instance()->load_helper('Template_Validator');
328 328
 
329 329
 		/**
330 330
 		 * These two filters are intended for last minute changes to templates being loaded and/or template arg
@@ -335,26 +335,26 @@  discard block
 block discarded – undo
335 335
 		 *
336 336
 		 * @since 4.6.0
337 337
 		 */
338
-		$template_path = apply_filters( 'FHEE__EEH_Template__display_template__template_path', $template_path );
339
-		$template_args = apply_filters( 'FHEE__EEH_Template__display_template__template_args', $template_args );
338
+		$template_path = apply_filters('FHEE__EEH_Template__display_template__template_path', $template_path);
339
+		$template_args = apply_filters('FHEE__EEH_Template__display_template__template_args', $template_args);
340 340
 
341 341
 		// you gimme nuttin - YOU GET NUTTIN !!
342
-		if ( ! $template_path || ! is_readable( $template_path )) {
342
+		if ( ! $template_path || ! is_readable($template_path)) {
343 343
 			return '';
344 344
 		}
345 345
 		// if $template_args are not in an array, then make it so
346
-		if ( ! is_array( $template_args ) && ! is_object( $template_args )) {
347
-			$template_args = array( $template_args );
346
+		if ( ! is_array($template_args) && ! is_object($template_args)) {
347
+			$template_args = array($template_args);
348 348
 		}
349
-		extract( (array) $template_args);
349
+		extract((array) $template_args);
350 350
 
351
-		if ( $return_string ) {
351
+		if ($return_string) {
352 352
 			// because we want to return a string, we are going to capture the output
353 353
 			ob_start();
354
-			include( $template_path );
354
+			include($template_path);
355 355
 			return ob_get_clean();
356 356
 		} else {
357
-			include( $template_path );
357
+			include($template_path);
358 358
 		}
359 359
 		return '';
360 360
 	}
@@ -372,27 +372,27 @@  discard block
 block discarded – undo
372 372
 	 * @param  string $suffix added to the end of the generated class
373 373
 	 * @return string
374 374
 	 */
375
-	public static function get_object_css_class( $object = NULL, $prefix = '', $suffix = '' ) {
375
+	public static function get_object_css_class($object = NULL, $prefix = '', $suffix = '') {
376 376
 		// in the beginning...
377
-		$prefix = ! empty( $prefix ) ? rtrim( $prefix, '-' ) . '-' : '';
377
+		$prefix = ! empty($prefix) ? rtrim($prefix, '-').'-' : '';
378 378
 		// da muddle
379 379
 		$class = '';
380 380
 		// the end
381
-		$suffix = ! empty( $suffix ) ? '-' . ltrim( $suffix, '-' ) : '';
381
+		$suffix = ! empty($suffix) ? '-'.ltrim($suffix, '-') : '';
382 382
 		// is the passed object an EE object ?
383
-		if ( $object instanceof EE_Base_Class ) {
383
+		if ($object instanceof EE_Base_Class) {
384 384
 			// grab the exact type of object
385
-			$obj_class = get_class( $object );
385
+			$obj_class = get_class($object);
386 386
 			// depending on the type of object...
387
-			switch ( $obj_class ) {
387
+			switch ($obj_class) {
388 388
 				// no specifics just yet...
389 389
 				default :
390
-					$class = strtolower( str_replace( '_', '-', $obj_class ));
391
-					$class .= method_exists( $obj_class, 'name' ) ? '-' . sanitize_title( $object->name() ) : '';
390
+					$class = strtolower(str_replace('_', '-', $obj_class));
391
+					$class .= method_exists($obj_class, 'name') ? '-'.sanitize_title($object->name()) : '';
392 392
 
393 393
 			}
394 394
 		}
395
-		return $prefix . $class . $suffix;
395
+		return $prefix.$class.$suffix;
396 396
 	}
397 397
 
398 398
 
@@ -408,50 +408,50 @@  discard block
 block discarded – undo
408 408
 	 * @param string      $cur_code_span_class
409 409
 	 * @return string        the html output for the formatted money value
410 410
 	 */
411
-	public static function format_currency( $amount = NULL, $return_raw = FALSE, $display_code = TRUE, $CNT_ISO = '', $cur_code_span_class = 'currency-code' ) {
411
+	public static function format_currency($amount = NULL, $return_raw = FALSE, $display_code = TRUE, $CNT_ISO = '', $cur_code_span_class = 'currency-code') {
412 412
 		// ensure amount was received
413
-		if ( is_null( $amount ) ) {
414
-			$msg = __( 'In order to format currency, an amount needs to be passed.', 'event_espresso' );
415
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
413
+		if (is_null($amount)) {
414
+			$msg = __('In order to format currency, an amount needs to be passed.', 'event_espresso');
415
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
416 416
 			return '';
417 417
 		}
418 418
 		//ensure amount is float
419 419
 		$amount = (float) $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
 				// add currency code ?
448
-				$amount_formatted = $display_code ? $amount_formatted . ' <span class="' . $cur_code_span_class . '">(' . $mny->code . ')</span>' : $amount_formatted;
448
+				$amount_formatted = $display_code ? $amount_formatted.' <span class="'.$cur_code_span_class.'">('.$mny->code.')</span>' : $amount_formatted;
449 449
 			}
450 450
 			// filter results
451
-			$amount_formatted = apply_filters( 'FHEE__EEH_Template__format_currency__amount_formatted', $amount_formatted, $mny, $return_raw );
451
+			$amount_formatted = apply_filters('FHEE__EEH_Template__format_currency__amount_formatted', $amount_formatted, $mny, $return_raw);
452 452
 		}
453 453
 		// clean up vars
454
-		unset( $mny );
454
+		unset($mny);
455 455
 		// return formatted currency amount
456 456
 		return $amount_formatted;
457 457
 	}
@@ -466,11 +466,11 @@  discard block
 block discarded – undo
466 466
 	 * @param  string  $schema    'UPPER', 'lower', or 'Sentence'
467 467
 	 * @return string             The localized label for the status id.
468 468
 	 */
469
-	public static function pretty_status( $status_id, $plural = FALSE, $schema = 'upper' ) {
469
+	public static function pretty_status($status_id, $plural = FALSE, $schema = 'upper') {
470 470
 		/** @type EEM_Status $EEM_Status */
471
-		$EEM_Status = EE_Registry::instance()->load_model( 'Status' );
472
-		$status = $EEM_Status->localized_status( array( $status_id => __( 'unknown', 'event_espresso' )), $plural, $schema );
473
-		return $status[ $status_id ];
471
+		$EEM_Status = EE_Registry::instance()->load_model('Status');
472
+		$status = $EEM_Status->localized_status(array($status_id => __('unknown', 'event_espresso')), $plural, $schema);
473
+		return $status[$status_id];
474 474
 	}
475 475
 
476 476
 
@@ -483,9 +483,9 @@  discard block
 block discarded – undo
483 483
 	 * @param string  $icon
484 484
 	 * @return string 	the html output for the button
485 485
 	 */
486
-	public static function get_button_or_link( $url, $label, $class = 'button-primary', $icon = '' ) {
487
-		$label = ! empty( $icon ) ? '<span class="' . $icon . '"></span>' . $label : $label;
488
-		$button = '<a id="' . sanitize_title_with_dashes($label) . '" href="' . $url . '" class="' . $class . '">' . $label . '</a>';
486
+	public static function get_button_or_link($url, $label, $class = 'button-primary', $icon = '') {
487
+		$label = ! empty($icon) ? '<span class="'.$icon.'"></span>'.$label : $label;
488
+		$button = '<a id="'.sanitize_title_with_dashes($label).'" href="'.$url.'" class="'.$class.'">'.$label.'</a>';
489 489
 		return $button;
490 490
 	}
491 491
 
@@ -502,21 +502,21 @@  discard block
 block discarded – undo
502 502
 	 * @param bool|string $help_text   (optional) send help text you want to use for the link if default not to be used
503 503
 	 * @return string              generated link
504 504
 	 */
505
-	public static function get_help_tab_link( $help_tab_id, $page = FALSE, $action = FALSE, $icon_style = FALSE, $help_text = FALSE ) {
505
+	public static function get_help_tab_link($help_tab_id, $page = FALSE, $action = FALSE, $icon_style = FALSE, $help_text = FALSE) {
506 506
 
507
-		if ( ! $page )
508
-			$page = isset( $_REQUEST['page'] ) && ! empty( $_REQUEST['page'] ) ? sanitize_key( $_REQUEST['page'] ) : $page;
507
+		if ( ! $page)
508
+			$page = isset($_REQUEST['page']) && ! empty($_REQUEST['page']) ? sanitize_key($_REQUEST['page']) : $page;
509 509
 
510
-		if ( ! $action )
511
-			$action = isset( $_REQUEST['action'] ) && ! empty( $_REQUEST['action'] ) ? sanitize_key( $_REQUEST['action'] ) : $action;
510
+		if ( ! $action)
511
+			$action = isset($_REQUEST['action']) && ! empty($_REQUEST['action']) ? sanitize_key($_REQUEST['action']) : $action;
512 512
 
513 513
 		$action = empty($action) ? 'default' : $action;
514 514
 
515 515
 
516
-		$help_tab_lnk = $page . '-' . $action . '-' . $help_tab_id;
517
-		$icon = !$icon_style ? ' dashicons-editor-help' : $icon_style;
518
-		$help_text = !$help_text ? '' : $help_text;
519
-		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>';
516
+		$help_tab_lnk = $page.'-'.$action.'-'.$help_tab_id;
517
+		$icon = ! $icon_style ? ' dashicons-editor-help' : $icon_style;
518
+		$help_text = ! $help_text ? '' : $help_text;
519
+		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>';
520 520
 	}
521 521
 
522 522
 
@@ -528,31 +528,31 @@  discard block
 block discarded – undo
528 528
 	 * @param EE_Help_Tour
529 529
 	 * @return string         html
530 530
 	 */
531
-	public static function help_tour_stops_generator( EE_Help_Tour $tour ) {
531
+	public static function help_tour_stops_generator(EE_Help_Tour $tour) {
532 532
 		$id = $tour->get_slug();
533 533
 		$stops = $tour->get_stops();
534 534
 
535
-		$content = '<ol style="display:none" id="' . $id . '">';
535
+		$content = '<ol style="display:none" id="'.$id.'">';
536 536
 
537
-		foreach ( $stops as $stop ) {
538
-			$data_id = !empty( $stop['id'] ) ? ' data-id="' . $stop['id'] . '"' : '';
539
-			$data_class = empty( $data_id ) && !empty( $stop['class'] ) ? ' data-class="' . $stop['class'] . '"' : '';
537
+		foreach ($stops as $stop) {
538
+			$data_id = ! empty($stop['id']) ? ' data-id="'.$stop['id'].'"' : '';
539
+			$data_class = empty($data_id) && ! empty($stop['class']) ? ' data-class="'.$stop['class'].'"' : '';
540 540
 
541 541
 			//if container is set to modal then let's make sure we set the options accordingly
542
-			if ( empty( $data_id ) && empty( $data_class ) ) {
542
+			if (empty($data_id) && empty($data_class)) {
543 543
 				$stop['options']['modal'] = true;
544 544
 				$stop['options']['expose'] = true;
545 545
 			}
546 546
 
547
-			$custom_class = !empty( $stop['custom_class'] ) ? ' class="' . $stop['custom_class'] . '"' : '';
548
-			$button_text = !empty( $stop['button_text'] ) ? ' data-button="' . $stop['button_text'] . '"' : '';
547
+			$custom_class = ! empty($stop['custom_class']) ? ' class="'.$stop['custom_class'].'"' : '';
548
+			$button_text = ! empty($stop['button_text']) ? ' data-button="'.$stop['button_text'].'"' : '';
549 549
 			$inner_content = isset($stop['content']) ? $stop['content'] : '';
550 550
 
551 551
 			//options
552
-			if ( isset( $stop['options'] ) && is_array( $stop['options'] ) ) {
552
+			if (isset($stop['options']) && is_array($stop['options'])) {
553 553
 				$options = ' data-options="';
554
-				foreach ( $stop['options'] as $option => $value ) {
555
-					$options .= $option . ':' . $value . ';';
554
+				foreach ($stop['options'] as $option => $value) {
555
+					$options .= $option.':'.$value.';';
556 556
 				}
557 557
 				$options .= '"';
558 558
 			} else {
@@ -560,7 +560,7 @@  discard block
 block discarded – undo
560 560
 			}
561 561
 
562 562
 			//let's put all together
563
-			$content .= '<li' . $data_id . $data_class . $custom_class . $button_text . $options . '>' . $inner_content . '</li>';
563
+			$content .= '<li'.$data_id.$data_class.$custom_class.$button_text.$options.'>'.$inner_content.'</li>';
564 564
 		}
565 565
 
566 566
 		$content .= '</ol>';
@@ -581,31 +581,31 @@  discard block
 block discarded – undo
581 581
 	 * @throws EE_Error
582 582
 	 * @return string               html structure for status.
583 583
 	 */
584
-	public static function status_legend( $status_array, $active_status = '' ) {
585
-		if ( !is_array( $status_array ) )
586
-			throw new EE_Error( __('The EEH_Template::status_legend helper required the incoming status_array argument to be an array!', 'event_espresso') );
584
+	public static function status_legend($status_array, $active_status = '') {
585
+		if ( ! is_array($status_array))
586
+			throw new EE_Error(__('The EEH_Template::status_legend helper required the incoming status_array argument to be an array!', 'event_espresso'));
587 587
 
588 588
 		$setup_array = array();
589
-		foreach ( $status_array as $item => $status ) {
589
+		foreach ($status_array as $item => $status) {
590 590
 			$setup_array[$item] = array(
591
-					'class' => 'ee-status-legend ee-status-legend-' . $status,
592
-					'desc' => EEH_Template::pretty_status( $status, FALSE, 'sentence' ),
591
+					'class' => 'ee-status-legend ee-status-legend-'.$status,
592
+					'desc' => EEH_Template::pretty_status($status, FALSE, 'sentence'),
593 593
 					'status' => $status
594 594
 				);
595 595
 		}
596 596
 
597
-		$content = '<div class="ee-list-table-legend-container">' . "\n";
598
-		$content .= '<h4>' . __('Status Legend', 'event_espresso') . '</h4>' . "\n";
599
-		$content .= '<dl class="ee-list-table-legend">' . "\n\t";
600
-		foreach ( $setup_array as $item => $details ) {
597
+		$content = '<div class="ee-list-table-legend-container">'."\n";
598
+		$content .= '<h4>'.__('Status Legend', 'event_espresso').'</h4>'."\n";
599
+		$content .= '<dl class="ee-list-table-legend">'."\n\t";
600
+		foreach ($setup_array as $item => $details) {
601 601
 			$active_class = $active_status == $details['status'] ? ' class="ee-is-active-status"' : '';
602
-			$content .= '<dt id="ee-legend-item-tooltip-' . $item . '"' . $active_class . '>' . "\n\t\t";
603
-			$content .= '<span class="' . $details['class'] . '"></span>' . "\n\t\t";
604
-			$content .= '<span class="ee-legend-description">' . $details['desc'] . '</span>' . "\n\t";
605
-			$content .= '</dt>' . "\n";
602
+			$content .= '<dt id="ee-legend-item-tooltip-'.$item.'"'.$active_class.'>'."\n\t\t";
603
+			$content .= '<span class="'.$details['class'].'"></span>'."\n\t\t";
604
+			$content .= '<span class="ee-legend-description">'.$details['desc'].'</span>'."\n\t";
605
+			$content .= '</dt>'."\n";
606 606
 		}
607
-		$content .= '</dl>' . "\n";
608
-		$content .= '</div>' . "\n";
607
+		$content .= '</dl>'."\n";
608
+		$content .= '</div>'."\n";
609 609
 		return $content;
610 610
 	}
611 611
 
@@ -618,8 +618,8 @@  discard block
 block discarded – undo
618 618
 	 * @return string
619 619
 	 */
620 620
 	public static function layout_array_as_table($data) {
621
-	if (is_object($data) || $data instanceof __PHP_Incomplete_Class ) {
622
-		$data = (array)$data;
621
+	if (is_object($data) || $data instanceof __PHP_Incomplete_Class) {
622
+		$data = (array) $data;
623 623
 	}
624 624
 	EE_Registry::instance()->load_helper('Array');
625 625
 	ob_start();
@@ -633,10 +633,10 @@  discard block
 block discarded – undo
633 633
 						?>
634 634
 						<tr>
635 635
 							<td>
636
-								<?php echo $data_key;?>
636
+								<?php echo $data_key; ?>
637 637
 							</td>
638 638
 							<td>
639
-								<?php echo self::layout_array_as_table($data_values);?>
639
+								<?php echo self::layout_array_as_table($data_values); ?>
640 640
 							</td>
641 641
 						</tr>
642 642
 						<?php
@@ -650,7 +650,7 @@  discard block
 block discarded – undo
650 650
 			<ul>
651 651
 				<?php
652 652
 				foreach ($data as $datum) {
653
-					echo "<li>"; echo self::layout_array_as_table($datum);echo "</li>";
653
+					echo "<li>"; echo self::layout_array_as_table($datum); echo "</li>";
654 654
 				}?>
655 655
 			</ul>
656 656
 			<?php
@@ -680,8 +680,8 @@  discard block
 block discarded – undo
680 680
 	 *
681 681
 	 * @return string
682 682
 	 */
683
-	public static function paging_html( $total_items, $current, $per_page, $url, $show_num_field = TRUE, $paged_arg_name = 'paged', $items_label = array() ) {
684
-		echo self::get_paging_html( $total_items, $current, $per_page, $url, $show_num_field, $paged_arg_name, $items_label );
683
+	public static function paging_html($total_items, $current, $per_page, $url, $show_num_field = TRUE, $paged_arg_name = 'paged', $items_label = array()) {
684
+		echo self::get_paging_html($total_items, $current, $per_page, $url, $show_num_field, $paged_arg_name, $items_label);
685 685
 	}
686 686
 
687 687
 
@@ -705,13 +705,13 @@  discard block
 block discarded – undo
705 705
 	 *                                 )
706 706
 	 * @return  string
707 707
 	 */
708
-	public static function get_paging_html( $total_items, $current, $per_page, $url, $show_num_field = TRUE, $paged_arg_name = 'paged', $items_label = array() ) {
708
+	public static function get_paging_html($total_items, $current, $per_page, $url, $show_num_field = TRUE, $paged_arg_name = 'paged', $items_label = array()) {
709 709
 		$page_links = array();
710 710
 		$disable_first = $disable_last = '';
711 711
 		$total_items = (int) $total_items;
712 712
 		$per_page = (int) $per_page;
713 713
 		$current = (int) $current;
714
-		$paged_arg_name = empty( $paged_arg_name ) ? 'paged' : sanitize_key( $paged_arg_name );
714
+		$paged_arg_name = empty($paged_arg_name) ? 'paged' : sanitize_key($paged_arg_name);
715 715
 
716 716
 		//filter items_label
717 717
 		$items_label = apply_filters(
@@ -719,68 +719,68 @@  discard block
 block discarded – undo
719 719
 			$items_label
720 720
 		);
721 721
 
722
-		if ( empty( $items_label )
723
-		     || ! is_array( $items_label )
724
-		     || ! isset( $items_label['single'] )
725
-		     || ! isset( $items_label['plural'] ) ) {
722
+		if (empty($items_label)
723
+		     || ! is_array($items_label)
724
+		     || ! isset($items_label['single'])
725
+		     || ! isset($items_label['plural'])) {
726 726
 			$items_label = array(
727
-				'single' => __( '1 item', 'event_espresso' ),
728
-				'plural' => __( '%s items', 'event_espresso' )
727
+				'single' => __('1 item', 'event_espresso'),
728
+				'plural' => __('%s items', 'event_espresso')
729 729
 			);
730 730
 		} else {
731 731
 			$items_label = array(
732
-				'single' => '1 ' . esc_html( $items_label['single'] ),
733
-				'plural' => '%s ' . esc_html( $items_label['plural'] )
732
+				'single' => '1 '.esc_html($items_label['single']),
733
+				'plural' => '%s '.esc_html($items_label['plural'])
734 734
 			);
735 735
 		}
736 736
 
737
-		$total_pages = ceil( $total_items / $per_page );
737
+		$total_pages = ceil($total_items / $per_page);
738 738
 
739
-		if ( $total_pages <= 1 )
739
+		if ($total_pages <= 1)
740 740
 			return '';
741 741
 
742
-		$item_label = $total_items > 1 ? sprintf( $items_label['plural'], $total_items ) : $items_label['single'];
742
+		$item_label = $total_items > 1 ? sprintf($items_label['plural'], $total_items) : $items_label['single'];
743 743
 
744
-		$output = '<span class="displaying-num">' . $item_label . '</span>';
744
+		$output = '<span class="displaying-num">'.$item_label.'</span>';
745 745
 
746
-		if ( $current === 1 ) {
746
+		if ($current === 1) {
747 747
 			$disable_first = ' disabled';
748 748
 		}
749
-		if ( $current == $total_pages ) {
749
+		if ($current == $total_pages) {
750 750
 			$disable_last = ' disabled';
751 751
 		}
752 752
 
753
-		$page_links[] = sprintf( "<a class='%s' title='%s' href='%s'>%s</a>",
754
-			'first-page' . $disable_first,
755
-			esc_attr__( 'Go to the first page' ),
756
-			esc_url( remove_query_arg( $paged_arg_name, $url ) ),
753
+		$page_links[] = sprintf("<a class='%s' title='%s' href='%s'>%s</a>",
754
+			'first-page'.$disable_first,
755
+			esc_attr__('Go to the first page'),
756
+			esc_url(remove_query_arg($paged_arg_name, $url)),
757 757
 			'&laquo;'
758 758
 		);
759 759
 
760 760
 		$page_links[] = sprintf(
761 761
 			'<a class="%s" title="%s" href="%s">%s</a>',
762
-			'prev-page' . $disable_first,
763
-			esc_attr__( 'Go to the previous page' ),
764
-			esc_url( add_query_arg( $paged_arg_name, max( 1, $current-1 ), $url ) ),
762
+			'prev-page'.$disable_first,
763
+			esc_attr__('Go to the previous page'),
764
+			esc_url(add_query_arg($paged_arg_name, max(1, $current - 1), $url)),
765 765
 			'&lsaquo;'
766 766
 		);
767 767
 
768
-		if ( ! $show_num_field ) {
768
+		if ( ! $show_num_field) {
769 769
 			$html_current_page = $current;
770 770
 		} else {
771
-			$html_current_page = sprintf( "<input class='current-page' title='%s' type='text' name=$paged_arg_name value='%s' size='%d' />",
772
-				esc_attr__( 'Current page' ),
771
+			$html_current_page = sprintf("<input class='current-page' title='%s' type='text' name=$paged_arg_name value='%s' size='%d' />",
772
+				esc_attr__('Current page'),
773 773
 				$current,
774
-				strlen( $total_pages )
774
+				strlen($total_pages)
775 775
 			);
776 776
 		}
777 777
 
778 778
 		$html_total_pages = sprintf(
779 779
 			'<span class="total-pages">%s</span>',
780
-			number_format_i18n( $total_pages )
780
+			number_format_i18n($total_pages)
781 781
 		);
782 782
 		$page_links[] = sprintf(
783
-			_x( '%3$s%1$s of %2$s%4$s', 'paging' ),
783
+			_x('%3$s%1$s of %2$s%4$s', 'paging'),
784 784
 			$html_current_page,
785 785
 			$html_total_pages,
786 786
 			'<span class="paging-input">',
@@ -789,29 +789,29 @@  discard block
 block discarded – undo
789 789
 
790 790
 		$page_links[] = sprintf(
791 791
 			'<a class="%s" title="%s" href="%s">%s</a>',
792
-			'next-page' . $disable_last,
793
-			esc_attr__( 'Go to the next page' ),
794
-			esc_url( add_query_arg( $paged_arg_name, min( $total_pages, $current+1 ), $url ) ),
792
+			'next-page'.$disable_last,
793
+			esc_attr__('Go to the next page'),
794
+			esc_url(add_query_arg($paged_arg_name, min($total_pages, $current + 1), $url)),
795 795
 			'&rsaquo;'
796 796
 		);
797 797
 
798 798
 		$page_links[] = sprintf(
799 799
 			'<a class="%s" title="%s" href="%s">%s</a>',
800
-			'last-page' . $disable_last,
801
-			esc_attr__( 'Go to the last page' ),
802
-			esc_url( add_query_arg( $paged_arg_name, $total_pages, $url ) ),
800
+			'last-page'.$disable_last,
801
+			esc_attr__('Go to the last page'),
802
+			esc_url(add_query_arg($paged_arg_name, $total_pages, $url)),
803 803
 			'&raquo;'
804 804
 		);
805 805
 
806
-		$output .= "\n" . '<span class="pagination-links">' . join( "\n", $page_links ) . '</span>';
806
+		$output .= "\n".'<span class="pagination-links">'.join("\n", $page_links).'</span>';
807 807
 		// set page class
808
-		if ( $total_pages ) {
808
+		if ($total_pages) {
809 809
 			$page_class = $total_pages < 2 ? ' one-page' : '';
810 810
 		} else {
811 811
 			$page_class = ' no-pages';
812 812
 		}
813 813
 
814
-		return '<div class="tablenav"><div class="tablenav-pages' . $page_class . '">' . $output . '</div></div>';
814
+		return '<div class="tablenav"><div class="tablenav-pages'.$page_class.'">'.$output.'</div></div>';
815 815
 	}
816 816
 
817 817
 
Please login to merge, or discard this patch.
core/db_classes/EE_Datetime.class.php 1 patch
Spacing   +126 added lines, -126 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
  * Event Espresso
@@ -74,9 +74,9 @@  discard block
 block discarded – undo
74 74
 	 *                             		    date_format and the second value is the time format
75 75
 	 * @return EE_Datetime
76 76
 	 */
77
-	public static function new_instance( $props_n_values = array(), $timezone = null, $date_formats = array() ) {
78
-		$has_object = parent::_check_for_object( $props_n_values, __CLASS__ );
79
-		return $has_object ? $has_object : new self( $props_n_values, false, $timezone, $date_formats );
77
+	public static function new_instance($props_n_values = array(), $timezone = null, $date_formats = array()) {
78
+		$has_object = parent::_check_for_object($props_n_values, __CLASS__);
79
+		return $has_object ? $has_object : new self($props_n_values, false, $timezone, $date_formats);
80 80
 	}
81 81
 
82 82
 
@@ -87,8 +87,8 @@  discard block
 block discarded – undo
87 87
 	 *                          		the website will be used.
88 88
 	 * @return EE_Datetime
89 89
 	 */
90
-	public static function new_instance_from_db( $props_n_values = array(), $timezone = null ) {
91
-		return new self( $props_n_values, TRUE, $timezone );
90
+	public static function new_instance_from_db($props_n_values = array(), $timezone = null) {
91
+		return new self($props_n_values, TRUE, $timezone);
92 92
 	}
93 93
 
94 94
 
@@ -96,8 +96,8 @@  discard block
 block discarded – undo
96 96
 	/**
97 97
 	 * @param $name
98 98
 	 */
99
-	public function set_name( $name ) {
100
-		$this->set( 'DTT_name', $name );
99
+	public function set_name($name) {
100
+		$this->set('DTT_name', $name);
101 101
 	}
102 102
 
103 103
 
@@ -105,8 +105,8 @@  discard block
 block discarded – undo
105 105
 	/**
106 106
 	 * @param $description
107 107
 	 */
108
-	public function set_description( $description ) {
109
-		$this->set( 'DTT_description', $description );
108
+	public function set_description($description) {
109
+		$this->set('DTT_description', $description);
110 110
 	}
111 111
 
112 112
 
@@ -119,8 +119,8 @@  discard block
 block discarded – undo
119 119
 	 * @access        public
120 120
 	 * @param        string $date a string representation of the event's date ex:  Dec. 25, 2025 or 12-25-2025
121 121
 	 */
122
-	public function set_start_date( $date ) {
123
-		$this->_set_date_for( $date, 'DTT_EVT_start' );
122
+	public function set_start_date($date) {
123
+		$this->_set_date_for($date, 'DTT_EVT_start');
124 124
 	}
125 125
 
126 126
 
@@ -133,8 +133,8 @@  discard block
 block discarded – undo
133 133
 	 * @access        public
134 134
 	 * @param        string $time a string representation of the event time ex:  9am  or  7:30 PM
135 135
 	 */
136
-	public function set_start_time( $time ) {
137
-		$this->_set_time_for( $time, 'DTT_EVT_start' );
136
+	public function set_start_time($time) {
137
+		$this->_set_time_for($time, 'DTT_EVT_start');
138 138
 	}
139 139
 
140 140
 
@@ -147,8 +147,8 @@  discard block
 block discarded – undo
147 147
 	 * @access        public
148 148
 	 * @param        string $date a string representation of the event's date ex:  Dec. 25, 2025 or 12-25-2025
149 149
 	 */
150
-	public function set_end_date( $date ) {
151
-		$this->_set_date_for( $date, 'DTT_EVT_end' );
150
+	public function set_end_date($date) {
151
+		$this->_set_date_for($date, 'DTT_EVT_end');
152 152
 	}
153 153
 
154 154
 
@@ -161,8 +161,8 @@  discard block
 block discarded – undo
161 161
 	 * @access        public
162 162
 	 * @param        string $time a string representation of the event time ex:  9am  or  7:30 PM
163 163
 	 */
164
-	public function set_end_time( $time ) {
165
-		$this->_set_time_for( $time, 'DTT_EVT_end' );
164
+	public function set_end_time($time) {
165
+		$this->_set_time_for($time, 'DTT_EVT_end');
166 166
 	}
167 167
 
168 168
 
@@ -175,8 +175,8 @@  discard block
 block discarded – undo
175 175
 	 * @access        public
176 176
 	 * @param        int $reg_limit
177 177
 	 */
178
-	public function set_reg_limit( $reg_limit ) {
179
-		$this->set( 'DTT_reg_limit', $reg_limit );
178
+	public function set_reg_limit($reg_limit) {
179
+		$this->set('DTT_reg_limit', $reg_limit);
180 180
 	}
181 181
 
182 182
 
@@ -187,10 +187,10 @@  discard block
 block discarded – undo
187 187
 	 * @access        public
188 188
 	 * @param        int $sold
189 189
 	 */
190
-	public function set_sold( $sold ) {
190
+	public function set_sold($sold) {
191 191
 		// sold can not go below zero
192
-		$sold = max( 0, $sold );
193
-		$this->set( 'DTT_sold', $sold );
192
+		$sold = max(0, $sold);
193
+		$this->set('DTT_sold', $sold);
194 194
 	}
195 195
 
196 196
 
@@ -199,9 +199,9 @@  discard block
 block discarded – undo
199 199
 	 * increments sold by amount passed by $qty
200 200
 	 * @param int $qty
201 201
 	 */
202
-	function increase_sold( $qty = 1 ) {
202
+	function increase_sold($qty = 1) {
203 203
 		$sold = $this->sold() + $qty;
204
-		$this->set_sold( $sold );
204
+		$this->set_sold($sold);
205 205
 	}
206 206
 
207 207
 
@@ -210,9 +210,9 @@  discard block
 block discarded – undo
210 210
 	 * decrements (subtracts) sold amount passed by $qty
211 211
 	 * @param int $qty
212 212
 	 */
213
-	function decrease_sold( $qty = 1 ) {
213
+	function decrease_sold($qty = 1) {
214 214
 		$sold = $this->sold() - $qty;
215
-		$this->set_sold( $sold );
215
+		$this->set_sold($sold);
216 216
 	}
217 217
 
218 218
 
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
 	 * @return string
223 223
 	 */
224 224
 	public function name() {
225
-		return $this->get( 'DTT_name' );
225
+		return $this->get('DTT_name');
226 226
 	}
227 227
 
228 228
 
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
 	 * @return string
233 233
 	 */
234 234
 	public function description() {
235
-		return $this->get( 'DTT_description' );
235
+		return $this->get('DTT_description');
236 236
 	}
237 237
 
238 238
 
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
 	 * @return boolean          TRUE if is primary, FALSE if not.
243 243
 	 */
244 244
 	public function is_primary() {
245
-		return $this->get( 'DTT_is_primary' );
245
+		return $this->get('DTT_is_primary');
246 246
 	}
247 247
 
248 248
 
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
 	 * @return int         The order of the datetime for this event.
253 253
 	 */
254 254
 	public function order() {
255
-		return $this->get( 'DTT_order' );
255
+		return $this->get('DTT_order');
256 256
 	}
257 257
 
258 258
 
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
 	 * @return int
263 263
 	 */
264 264
 	public function parent() {
265
-		return $this->get( 'DTT_parent' );
265
+		return $this->get('DTT_parent');
266 266
 	}
267 267
 
268 268
 
@@ -278,10 +278,10 @@  discard block
 block discarded – undo
278 278
 	 * @param    bool   $echo         - whether we echo or return (note echoing uses "pretty" formats, otherwise we use the standard formats)
279 279
 	 * @return    string|bool|void  string on success, FALSE on fail
280 280
 	 */
281
-	private function _show_datetime( $date_or_time = NULL, $start_or_end = 'start', $dt_frmt = '', $tm_frmt = '', $echo = FALSE ) {
281
+	private function _show_datetime($date_or_time = NULL, $start_or_end = 'start', $dt_frmt = '', $tm_frmt = '', $echo = FALSE) {
282 282
 		$field_name = "DTT_EVT_{$start_or_end}";
283
-		$dtt = $this->_get_datetime( $field_name, $dt_frmt, $tm_frmt, $date_or_time, $echo );
284
-		if ( ! $echo ) {
283
+		$dtt = $this->_get_datetime($field_name, $dt_frmt, $tm_frmt, $date_or_time, $echo);
284
+		if ( ! $echo) {
285 285
 			return $dtt;
286 286
 		}
287 287
 		return '';
@@ -297,8 +297,8 @@  discard block
 block discarded – undo
297 297
 	 * @param null $dt_frmt - string representation of date format defaults to 'F j, Y'
298 298
 	 * @return        mixed        string on success, FALSE on fail
299 299
 	 */
300
-	public function start_date( $dt_frmt = NULL ) {
301
-		return $this->_show_datetime( 'D', 'start', $dt_frmt );
300
+	public function start_date($dt_frmt = NULL) {
301
+		return $this->_show_datetime('D', 'start', $dt_frmt);
302 302
 	}
303 303
 
304 304
 
@@ -307,8 +307,8 @@  discard block
 block discarded – undo
307 307
 	 * Echoes start_date()
308 308
 	 * @param string $dt_frmt
309 309
 	 */
310
-	public function e_start_date( $dt_frmt = NULL ) {
311
-		$this->_show_datetime( 'D', 'start', $dt_frmt, NULL, TRUE );
310
+	public function e_start_date($dt_frmt = NULL) {
311
+		$this->_show_datetime('D', 'start', $dt_frmt, NULL, TRUE);
312 312
 	}
313 313
 
314 314
 
@@ -321,8 +321,8 @@  discard block
 block discarded – undo
321 321
 	 * @param null $dt_frmt - string representation of date format defaults to 'F j, Y'
322 322
 	 * @return        mixed        string on success, FALSE on fail
323 323
 	 */
324
-	public function end_date( $dt_frmt = NULL ) {
325
-		return $this->_show_datetime( 'D', 'end', $dt_frmt );
324
+	public function end_date($dt_frmt = NULL) {
325
+		return $this->_show_datetime('D', 'end', $dt_frmt);
326 326
 	}
327 327
 
328 328
 
@@ -331,8 +331,8 @@  discard block
 block discarded – undo
331 331
 	 * Echoes the end date. See end_date()
332 332
 	 * @param string $dt_frmt
333 333
 	 */
334
-	public function e_end_date( $dt_frmt = NULL ) {
335
-		$this->_show_datetime( 'D', 'end', $dt_frmt, NULL, TRUE );
334
+	public function e_end_date($dt_frmt = NULL) {
335
+		$this->_show_datetime('D', 'end', $dt_frmt, NULL, TRUE);
336 336
 	}
337 337
 
338 338
 
@@ -345,11 +345,11 @@  discard block
 block discarded – undo
345 345
 	 * @param        string $conjunction - conjunction junction what's your function ? this string joins the start date with the end date ie: Jan 01 "to" Dec 31
346 346
 	 * @return        mixed        string on success, FALSE on fail
347 347
 	 */
348
-	public function date_range( $dt_frmt = NULL, $conjunction = ' - ' ) {
349
-		$dt_frmt = ! empty( $dt_frmt ) ? $dt_frmt : $this->_dt_frmt;
350
-		$start = str_replace( ' ', '&nbsp;', $this->get_i18n_datetime( 'DTT_EVT_start', $dt_frmt ) );
351
-		$end = str_replace( ' ', '&nbsp;', $this->get_i18n_datetime( 'DTT_EVT_end', $dt_frmt ) );
352
-		return $start != $end ? $start . $conjunction . $end : $start;
348
+	public function date_range($dt_frmt = NULL, $conjunction = ' - ') {
349
+		$dt_frmt = ! empty($dt_frmt) ? $dt_frmt : $this->_dt_frmt;
350
+		$start = str_replace(' ', '&nbsp;', $this->get_i18n_datetime('DTT_EVT_start', $dt_frmt));
351
+		$end = str_replace(' ', '&nbsp;', $this->get_i18n_datetime('DTT_EVT_end', $dt_frmt));
352
+		return $start != $end ? $start.$conjunction.$end : $start;
353 353
 	}
354 354
 
355 355
 
@@ -358,8 +358,8 @@  discard block
 block discarded – undo
358 358
 	 * @param null   $dt_frmt
359 359
 	 * @param string $conjunction
360 360
 	 */
361
-	public function e_date_range( $dt_frmt = NULL, $conjunction = ' - ' ) {
362
-		echo $this->date_range( $dt_frmt, $conjunction );
361
+	public function e_date_range($dt_frmt = NULL, $conjunction = ' - ') {
362
+		echo $this->date_range($dt_frmt, $conjunction);
363 363
 	}
364 364
 
365 365
 
@@ -371,8 +371,8 @@  discard block
 block discarded – undo
371 371
 	 * @param        string $tm_format - string representation of time format defaults to 'g:i a'
372 372
 	 * @return        mixed        string on success, FALSE on fail
373 373
 	 */
374
-	public function start_time( $tm_format = NULL ) {
375
-		return $this->_show_datetime( 'T', 'start', NULL, $tm_format );
374
+	public function start_time($tm_format = NULL) {
375
+		return $this->_show_datetime('T', 'start', NULL, $tm_format);
376 376
 	}
377 377
 
378 378
 
@@ -380,8 +380,8 @@  discard block
 block discarded – undo
380 380
 	/**
381 381
 	 * @param null $tm_format
382 382
 	 */
383
-	public function e_start_time( $tm_format = NULL ) {
384
-		$this->_show_datetime( 'T', 'start', NULL, $tm_format, TRUE );
383
+	public function e_start_time($tm_format = NULL) {
384
+		$this->_show_datetime('T', 'start', NULL, $tm_format, TRUE);
385 385
 	}
386 386
 
387 387
 
@@ -393,8 +393,8 @@  discard block
 block discarded – undo
393 393
 	 * @param        string $tm_format - string representation of time format defaults to 'g:i a'
394 394
 	 * @return        mixed        string on success, FALSE on fail
395 395
 	 */
396
-	public function end_time( $tm_format = NULL ) {
397
-		return $this->_show_datetime( 'T', 'end', NULL, $tm_format );
396
+	public function end_time($tm_format = NULL) {
397
+		return $this->_show_datetime('T', 'end', NULL, $tm_format);
398 398
 	}
399 399
 
400 400
 
@@ -402,8 +402,8 @@  discard block
 block discarded – undo
402 402
 	/**
403 403
 	 * @param null $tm_format
404 404
 	 */
405
-	public function e_end_time( $tm_format = NULL ) {
406
-		$this->_show_datetime( 'T', 'end', NULL, $tm_format, TRUE );
405
+	public function e_end_time($tm_format = NULL) {
406
+		$this->_show_datetime('T', 'end', NULL, $tm_format, TRUE);
407 407
 	}
408 408
 
409 409
 
@@ -416,12 +416,12 @@  discard block
 block discarded – undo
416 416
 	 * @param        string $conjunction - conjunction junction what's your function ? this string joins the start date with the end date ie: Jan 01 "to" Dec 31
417 417
 	 * @return        mixed        string on success, FALSE on fail
418 418
 	 */
419
-	public function time_range( $tm_format = NULL, $conjunction = ' - ' ) {
420
-		$tm_format = !empty( $tm_format ) ? $tm_format : $this->_tm_frmt;
419
+	public function time_range($tm_format = NULL, $conjunction = ' - ') {
420
+		$tm_format = ! empty($tm_format) ? $tm_format : $this->_tm_frmt;
421 421
 
422
-		$start = str_replace( ' ', '&nbsp;', $this->get_i18n_datetime( 'DTT_EVT_start', $tm_format ) );
423
-		$end = str_replace( ' ', '&nbsp;', $this->get_i18n_datetime( 'DTT_EVT_end',  $tm_format ) );
424
-		return $start != $end ? $start . $conjunction . $end : $start;
422
+		$start = str_replace(' ', '&nbsp;', $this->get_i18n_datetime('DTT_EVT_start', $tm_format));
423
+		$end = str_replace(' ', '&nbsp;', $this->get_i18n_datetime('DTT_EVT_end', $tm_format));
424
+		return $start != $end ? $start.$conjunction.$end : $start;
425 425
 	}
426 426
 
427 427
 
@@ -430,8 +430,8 @@  discard block
 block discarded – undo
430 430
 	 * @param null   $tm_format
431 431
 	 * @param string $conjunction
432 432
 	 */
433
-	public function e_time_range( $tm_format = NULL, $conjunction = ' - ' ) {
434
-		echo $this->time_range( $tm_format, $conjunction );
433
+	public function e_time_range($tm_format = NULL, $conjunction = ' - ') {
434
+		echo $this->time_range($tm_format, $conjunction);
435 435
 	}
436 436
 
437 437
 
@@ -444,8 +444,8 @@  discard block
 block discarded – undo
444 444
 	 * @param 	string 	$tm_format - string representation of time format defaults to 'g:i a'
445 445
 	 * @return 	mixed 	string on success, FALSE on fail
446 446
 	 */
447
-	public function start_date_and_time( $dt_format = NULL, $tm_format = NULL ) {
448
-		return $this->_show_datetime( '', 'start', $dt_format, $tm_format );
447
+	public function start_date_and_time($dt_format = NULL, $tm_format = NULL) {
448
+		return $this->_show_datetime('', 'start', $dt_format, $tm_format);
449 449
 	}
450 450
 
451 451
 
@@ -454,8 +454,8 @@  discard block
 block discarded – undo
454 454
 	 * @param null $dt_frmt
455 455
 	 * @param null $tm_format
456 456
 	 */
457
-	public function e_start_date_and_time( $dt_frmt = NULL, $tm_format = NULL ) {
458
-		$this->_show_datetime( '', 'start', $dt_frmt, $tm_format, TRUE );
457
+	public function e_start_date_and_time($dt_frmt = NULL, $tm_format = NULL) {
458
+		$this->_show_datetime('', 'start', $dt_frmt, $tm_format, TRUE);
459 459
 	}
460 460
 
461 461
 
@@ -469,11 +469,11 @@  discard block
 block discarded – undo
469 469
 	 * @param bool   $round_up
470 470
 	 * @return float|int|mixed
471 471
 	 */
472
-	public function length( $units = 'seconds', $round_up = FALSE ) {
473
-		$start = $this->get_raw( 'DTT_EVT_start' );
474
-		$end = $this->get_raw( 'DTT_EVT_end' );
472
+	public function length($units = 'seconds', $round_up = FALSE) {
473
+		$start = $this->get_raw('DTT_EVT_start');
474
+		$end = $this->get_raw('DTT_EVT_end');
475 475
 		$length_in_units = $end - $start;
476
-		switch ( $units ) {
476
+		switch ($units) {
477 477
 			//NOTE: We purposefully don't use "break;" in order to chain the divisions
478 478
 			/** @noinspection PhpMissingBreakStatementInspection */
479 479
 			case 'days':
@@ -486,10 +486,10 @@  discard block
 block discarded – undo
486 486
 				$length_in_units /= 60;
487 487
 			case 'seconds':
488 488
 			default:
489
-				$length_in_units = ceil( $length_in_units );
489
+				$length_in_units = ceil($length_in_units);
490 490
 		}
491
-		if ( $round_up ) {
492
-			$length_in_units = max( $length_in_units, 1 );
491
+		if ($round_up) {
492
+			$length_in_units = max($length_in_units, 1);
493 493
 		}
494 494
 		return $length_in_units;
495 495
 	}
@@ -504,8 +504,8 @@  discard block
 block discarded – undo
504 504
 	 * @param bool | string 	$tm_format - string representation of time format defaults to 'g:i a'
505 505
 	 * @return 	mixed        		string on success, FALSE on fail
506 506
 	 */
507
-	public function end_date_and_time( $dt_frmt = FALSE, $tm_format = FALSE ) {
508
-		return $this->_show_datetime( '', 'end', $dt_frmt, $tm_format );
507
+	public function end_date_and_time($dt_frmt = FALSE, $tm_format = FALSE) {
508
+		return $this->_show_datetime('', 'end', $dt_frmt, $tm_format);
509 509
 	}
510 510
 
511 511
 
@@ -514,8 +514,8 @@  discard block
 block discarded – undo
514 514
 	 * @param bool $dt_frmt
515 515
 	 * @param bool $tm_format
516 516
 	 */
517
-	public function e_end_date_and_time( $dt_frmt = FALSE, $tm_format = FALSE ) {
518
-		$this->_show_datetime( '', 'end', $dt_frmt, $tm_format, TRUE );
517
+	public function e_end_date_and_time($dt_frmt = FALSE, $tm_format = FALSE) {
518
+		$this->_show_datetime('', 'end', $dt_frmt, $tm_format, TRUE);
519 519
 	}
520 520
 
521 521
 
@@ -527,7 +527,7 @@  discard block
 block discarded – undo
527 527
 	 * @return        int
528 528
 	 */
529 529
 	public function start() {
530
-		return $this->get_raw( 'DTT_EVT_start' );
530
+		return $this->get_raw('DTT_EVT_start');
531 531
 	}
532 532
 
533 533
 
@@ -539,7 +539,7 @@  discard block
 block discarded – undo
539 539
 	 * @return        int
540 540
 	 */
541 541
 	public function end() {
542
-		return $this->get_raw( 'DTT_EVT_end' );
542
+		return $this->get_raw('DTT_EVT_end');
543 543
 	}
544 544
 
545 545
 
@@ -551,7 +551,7 @@  discard block
 block discarded – undo
551 551
 	 * @return        mixed        int on success, FALSE on fail
552 552
 	 */
553 553
 	public function reg_limit() {
554
-		return $this->get_raw( 'DTT_reg_limit' );
554
+		return $this->get_raw('DTT_reg_limit');
555 555
 	}
556 556
 
557 557
 
@@ -563,7 +563,7 @@  discard block
 block discarded – undo
563 563
 	 * @return        mixed        int on success, FALSE on fail
564 564
 	 */
565 565
 	public function sold() {
566
-		return $this->get_raw( 'DTT_sold' );
566
+		return $this->get_raw('DTT_sold');
567 567
 	}
568 568
 
569 569
 
@@ -592,15 +592,15 @@  discard block
 block discarded – undo
592 592
 	 * 																	the spaces remaining for this particular datetime, hence the flag.
593 593
 	 * @return 	int
594 594
 	 */
595
-	public function spaces_remaining( $consider_tickets = FALSE ) {
595
+	public function spaces_remaining($consider_tickets = FALSE) {
596 596
 		// tickets remaining available for purchase
597 597
 		//no need for special checks for infinite, because if DTT_reg_limit == EE_INF, then EE_INF - x = EE_INF
598 598
 		$dtt_remaining = $this->reg_limit() - $this->sold();
599
-		if ( ! $consider_tickets ) {
599
+		if ( ! $consider_tickets) {
600 600
 			return $dtt_remaining;
601 601
 		}
602 602
 		$tickets_remaining = $this->tickets_remaining();
603
-		return min( $dtt_remaining, $tickets_remaining );
603
+		return min($dtt_remaining, $tickets_remaining);
604 604
 	}
605 605
 
606 606
 
@@ -611,19 +611,19 @@  discard block
 block discarded – undo
611 611
 	 * @param array $query_params like EEM_Base::get_all's
612 612
 	 * @return int
613 613
 	 */
614
-	public function tickets_remaining( $query_params = array() ) {
614
+	public function tickets_remaining($query_params = array()) {
615 615
 		$sum = 0;
616
-		$tickets = $this->tickets( $query_params );
617
-		if ( ! empty( $tickets ) ) {
618
-			foreach ( $tickets as $ticket ) {
619
-				if ( $ticket instanceof EE_Ticket ) {
616
+		$tickets = $this->tickets($query_params);
617
+		if ( ! empty($tickets)) {
618
+			foreach ($tickets as $ticket) {
619
+				if ($ticket instanceof EE_Ticket) {
620 620
 					// get the actual amount of tickets that can be sold
621
-					$qty = $ticket->qty( 'saleable' );
622
-					if ( $qty === EE_INF ) {
621
+					$qty = $ticket->qty('saleable');
622
+					if ($qty === EE_INF) {
623 623
 						return EE_INF;
624 624
 					}
625 625
 					// no negative ticket quantities plz
626
-					if ( $qty > 0 ) {
626
+					if ($qty > 0) {
627 627
 						$sum += $qty;
628 628
 					}
629 629
 				}
@@ -640,8 +640,8 @@  discard block
 block discarded – undo
640 640
 	 * @param array $query_params like EEM_Base::get_all's
641 641
 	 * @return int
642 642
 	 */
643
-	public function sum_tickets_initially_available( $query_params = array() ) {
644
-		return $this->sum_related( 'Ticket', $query_params, 'TKT_qty' );
643
+	public function sum_tickets_initially_available($query_params = array()) {
644
+		return $this->sum_related('Ticket', $query_params, 'TKT_qty');
645 645
 	}
646 646
 
647 647
 
@@ -653,7 +653,7 @@  discard block
 block discarded – undo
653 653
 	 * @return int
654 654
 	 */
655 655
 	public function total_tickets_available_at_this_datetime() {
656
-		return $this->spaces_remaining( true );
656
+		return $this->spaces_remaining(true);
657 657
 	}
658 658
 
659 659
 
@@ -664,7 +664,7 @@  discard block
 block discarded – undo
664 664
 	 * @return boolean
665 665
 	 */
666 666
 	public function is_upcoming() {
667
-		return ( $this->get_raw( 'DTT_EVT_start' ) > time() );
667
+		return ($this->get_raw('DTT_EVT_start') > time());
668 668
 	}
669 669
 
670 670
 
@@ -674,7 +674,7 @@  discard block
 block discarded – undo
674 674
 	 * @return boolean
675 675
 	 */
676 676
 	public function is_active() {
677
-		return ( $this->get_raw( 'DTT_EVT_start' ) < time() && $this->get_raw( 'DTT_EVT_end' ) > time() );
677
+		return ($this->get_raw('DTT_EVT_start') < time() && $this->get_raw('DTT_EVT_end') > time());
678 678
 	}
679 679
 
680 680
 
@@ -684,7 +684,7 @@  discard block
 block discarded – undo
684 684
 	 * @return boolean
685 685
 	 */
686 686
 	public function is_expired() {
687
-		return ( $this->get_raw( 'DTT_EVT_end' ) < time() );
687
+		return ($this->get_raw('DTT_EVT_end') < time());
688 688
 	}
689 689
 
690 690
 
@@ -695,16 +695,16 @@  discard block
 block discarded – undo
695 695
 	 */
696 696
 	public function get_active_status() {
697 697
 		$total_tickets_for_this_dtt = $this->total_tickets_available_at_this_datetime();
698
-		if ( $total_tickets_for_this_dtt !== FALSE && $total_tickets_for_this_dtt < 1 ) {
698
+		if ($total_tickets_for_this_dtt !== FALSE && $total_tickets_for_this_dtt < 1) {
699 699
 			return EE_Datetime::sold_out;
700 700
 		}
701
-		if ( $this->is_expired() ) {
701
+		if ($this->is_expired()) {
702 702
 			return EE_Datetime::expired;
703 703
 		}
704
-		if ( $this->is_upcoming() ) {
704
+		if ($this->is_upcoming()) {
705 705
 			return EE_Datetime::upcoming;
706 706
 		}
707
-		if ( $this->is_active() ) {
707
+		if ($this->is_active()) {
708 708
 			return EE_Datetime::active;
709 709
 		}
710 710
 		return NULL;
@@ -718,24 +718,24 @@  discard block
 block discarded – undo
718 718
 	 * @param  boolean $use_dtt_name if TRUE then we'll use DTT->name() if its not empty.
719 719
 	 * @return string
720 720
 	 */
721
-	public function get_dtt_display_name( $use_dtt_name = FALSE ) {
722
-		if ( $use_dtt_name ) {
721
+	public function get_dtt_display_name($use_dtt_name = FALSE) {
722
+		if ($use_dtt_name) {
723 723
 			$dtt_name = $this->name();
724
-			if ( !empty( $dtt_name ) ) {
724
+			if ( ! empty($dtt_name)) {
725 725
 				return $dtt_name;
726 726
 			}
727 727
 		}
728 728
 		//first condition is to see if the months are different
729
-		if ( date( 'm', $this->get_raw( 'DTT_EVT_start' ) ) != date( 'm', $this->get_raw( 'DTT_EVT_end' ) ) ) {
730
-			$display_date = $this->start_date( 'M j\, Y g:i a' ) . ' - ' . $this->end_date( 'M j\, Y g:i a' );
729
+		if (date('m', $this->get_raw('DTT_EVT_start')) != date('m', $this->get_raw('DTT_EVT_end'))) {
730
+			$display_date = $this->start_date('M j\, Y g:i a').' - '.$this->end_date('M j\, Y g:i a');
731 731
 			//next condition is if its the same month but different day
732 732
 		}
733 733
 		else {
734
-			if ( date( 'm', $this->get_raw( 'DTT_EVT_start' ) ) == date( 'm', $this->get_raw( 'DTT_EVT_end' ) ) && date( 'd', $this->get_raw( 'DTT_EVT_start' ) ) != date( 'd', $this->get_raw( 'DTT_EVT_end' ) ) ) {
735
-				$display_date = $this->start_date( 'M j\, g:i a' ) . ' - ' . $this->end_date( 'M j\, g:i a Y' );
734
+			if (date('m', $this->get_raw('DTT_EVT_start')) == date('m', $this->get_raw('DTT_EVT_end')) && date('d', $this->get_raw('DTT_EVT_start')) != date('d', $this->get_raw('DTT_EVT_end'))) {
735
+				$display_date = $this->start_date('M j\, g:i a').' - '.$this->end_date('M j\, g:i a Y');
736 736
 			}
737 737
 			else {
738
-				$display_date = $this->start_date( 'F j\, Y' ) . ' @ ' . $this->start_date( 'g:i a' ) . ' - ' . $this->end_date( 'g:i a' );
738
+				$display_date = $this->start_date('F j\, Y').' @ '.$this->start_date('g:i a').' - '.$this->end_date('g:i a');
739 739
 			}
740 740
 		}
741 741
 		return $display_date;
@@ -749,8 +749,8 @@  discard block
 block discarded – undo
749 749
 *@param array $query_params see EEM_Base::get_all()
750 750
 	 * @return EE_Ticket[]
751 751
 	 */
752
-	public function tickets( $query_params = array() ) {
753
-		return $this->get_many_related( 'Ticket', $query_params );
752
+	public function tickets($query_params = array()) {
753
+		return $this->get_many_related('Ticket', $query_params);
754 754
 	}
755 755
 
756 756
 
@@ -760,21 +760,21 @@  discard block
 block discarded – undo
760 760
 	 * @param array $query_params like EEM_Base::get_all's
761 761
 	 * @return EE_Ticket[]
762 762
 	 */
763
-	public function ticket_types_available_for_purchase( $query_params = array() ) {
763
+	public function ticket_types_available_for_purchase($query_params = array()) {
764 764
 		// first check if datetime is valid
765
-		if ( ! ( $this->is_upcoming() || $this->is_active() ) || $this->sold_out() ) {
765
+		if ( ! ($this->is_upcoming() || $this->is_active()) || $this->sold_out()) {
766 766
 			return array();
767 767
 		}
768
-		if ( empty( $query_params ) ) {
768
+		if (empty($query_params)) {
769 769
 			$query_params = array(
770 770
 				array(
771
-					'TKT_start_date' => array( '<=', EEM_Ticket::instance()->current_time_for_query( 'TKT_start_date' ) ),
772
-					'TKT_end_date'   => array( '>=', EEM_Ticket::instance()->current_time_for_query( 'TKT_end_date' ) ),
771
+					'TKT_start_date' => array('<=', EEM_Ticket::instance()->current_time_for_query('TKT_start_date')),
772
+					'TKT_end_date'   => array('>=', EEM_Ticket::instance()->current_time_for_query('TKT_end_date')),
773 773
 					'TKT_deleted'    => false
774 774
 				)
775 775
 			);
776 776
 		}
777
-		return $this->tickets( $query_params );
777
+		return $this->tickets($query_params);
778 778
 	}
779 779
 
780 780
 
@@ -784,7 +784,7 @@  discard block
 block discarded – undo
784 784
 	 * @return EE_Event
785 785
 	 */
786 786
 	public function event() {
787
-		return $this->get_first_related( 'Event' );
787
+		return $this->get_first_related('Event');
788 788
 	}
789 789
 
790 790
 
@@ -796,13 +796,13 @@  discard block
 block discarded – undo
796 796
 	 */
797 797
 	public function update_sold() {
798 798
 		$count_regs_for_this_datetime = EEM_Registration::instance()->count(
799
-			array( array(
799
+			array(array(
800 800
 				'STS_ID' 					=> EEM_Registration::status_id_approved,
801 801
 				'REG_deleted' 				=> 0,
802 802
 				'Ticket.Datetime.DTT_ID' 	=> $this->ID(),
803
-			) )
803
+			))
804 804
 		);
805
-		$this->set( 'DTT_sold', $count_regs_for_this_datetime );
805
+		$this->set('DTT_sold', $count_regs_for_this_datetime);
806 806
 		$this->save();
807 807
 		return $count_regs_for_this_datetime;
808 808
 	}
Please login to merge, or discard this patch.