Completed
Branch BUG-9961-paypal-pro-items (52e78c)
by
unknown
49:07 queued 32:43
created
caffeinated/admin/new/pricing/Pricing_Admin_Page.core.php 2 patches
Indentation   +91 added lines, -91 removed lines patch added patch discarded remove patch
@@ -78,9 +78,9 @@  discard block
 block discarded – undo
78 78
 
79 79
 	/**
80 80
 	 * 		an array for storing request actions and their corresponding methods
81
-	*		@access private
82
-	*		@return void
83
-	*/
81
+	 *		@access private
82
+	 *		@return void
83
+	 */
84 84
 	protected function _set_page_routes() {
85 85
 		$prc_id = ! empty( $this->_req_data['PRC_ID'] ) && ! is_array( $this->_req_data['PRC_ID'] ) ? $this->_req_data['PRC_ID'] : 0;
86 86
 		$prt_id =  ! empty( $this->_req_data['PRT_ID'] ) && ! is_array( $this->_req_data['PRT_ID'] ) ? $this->_req_data['PRT_ID'] : 0;
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
 							'order' => 10
201 201
 						),
202 202
 					'list_table' => 'Prices_List_Table',
203
-                    'help_tabs' => array(
203
+					'help_tabs' => array(
204 204
 						'pricing_default_pricing_help_tab' => array(
205 205
 							'title' => __('Default Pricing', 'event_espresso'),
206 206
 							'filename' => 'pricing_default_pricing'
@@ -223,13 +223,13 @@  discard block
 block discarded – undo
223 223
 							'order' => 20,
224 224
 							'persistent' => FALSE
225 225
 						),
226
-                    'help_tabs' => array(
226
+					'help_tabs' => array(
227 227
 						'add_new_default_price_help_tab' => array(
228 228
 							'title' => __('Add New Default Price', 'event_espresso'),
229 229
 							'filename' => 'pricing_add_new_default_price'
230 230
 							)
231 231
 						),
232
-                    'help_tour' => array('Pricing_Add_New_Default_Price_Help_Tour'),
232
+					'help_tour' => array('Pricing_Add_New_Default_Price_Help_Tour'),
233 233
 					'metaboxes' => array( '_publish_post_box', '_espresso_news_post_box', '_price_details_meta_boxes' ),
234 234
 					'require_nonce' => FALSE
235 235
 				),
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
 							'persistent' => FALSE
242 242
 						),
243 243
 					'metaboxes' => array( '_publish_post_box', '_espresso_news_post_box', '_price_details_meta_boxes' ),
244
-                    'help_tabs' => array(
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'
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
 							'order' => 30
257 257
 						),
258 258
 					'list_table' => 'Price_Types_List_Table',
259
-                    'help_tabs' => array(
259
+					'help_tabs' => array(
260 260
 						'pricing_price_types_help_tab' => array(
261 261
 							'title' => __('Price Types', 'event_espresso'),
262 262
 							'filename' => 'pricing_price_types'
@@ -280,13 +280,13 @@  discard block
 block discarded – undo
280 280
 							'order' => 40,
281 281
 							'persistent' => FALSE
282 282
 						),
283
-                    'help_tabs' => array(
283
+					'help_tabs' => array(
284 284
 						'add_new_price_type_help_tab' => array(
285 285
 							'title' => __('Add New Price Type', 'event_espresso'),
286 286
 							'filename' => 'pricing_add_new_price_type'
287 287
 							)
288 288
 						),
289
-                    'help_tour' => array( 'Pricing_Add_New_Price_Type_Help_Tour' ),
289
+					'help_tour' => array( 'Pricing_Add_New_Price_Type_Help_Tour' ),
290 290
 					'metaboxes' => array( '_publish_post_box', '_espresso_news_post_box', '_price_type_details_meta_boxes' ),
291 291
 					'require_nonce' => FALSE
292 292
 				),
@@ -296,13 +296,13 @@  discard block
 block discarded – undo
296 296
 							'order' => 40,
297 297
 							'persistent' => FALSE
298 298
 						),
299
-                    'help_tabs' => array(
299
+					'help_tabs' => array(
300 300
 						'edit_price_type_help_tab' => array(
301 301
 							'title' => __('Edit Price Type', 'event_espresso'),
302 302
 							'filename' => 'pricing_edit_price_type'
303 303
 							)
304 304
 						),
305
-                    'help_tour' => array( 'Pricing_Edit_Price_Type_Help_Tour' ),
305
+					'help_tour' => array( 'Pricing_Edit_Price_Type_Help_Tour' ),
306 306
 					'metaboxes' => array( '_publish_post_box', '_espresso_news_post_box', '_price_type_details_meta_boxes' ),
307 307
 
308 308
 					'require_nonce' => FALSE
@@ -433,16 +433,16 @@  discard block
 block discarded – undo
433 433
 
434 434
 	/**
435 435
 	 * 		generates HTML for main Prices Admin page
436
-	*		@access protected
437
-	*		@return void
438
-	*/
436
+	 *		@access protected
437
+	 *		@return void
438
+	 */
439 439
 	protected function _price_overview_list_table() {
440 440
 		$this->_admin_page_title .= ' ' . $this->get_action_link_or_button(
441
-		    'add_new_price',
442
-            'add',
443
-            array(),
444
-            'add-new-h2'
445
-        );
441
+			'add_new_price',
442
+			'add',
443
+			array(),
444
+			'add-new-h2'
445
+		);
446 446
 		$this->admin_page_title .= $this->_learn_more_about_pricing_link();
447 447
 		$this->_search_btn_label = __('Default Prices', 'event_espresso');
448 448
 		$this->display_admin_list_table_page_with_no_sidebar();
@@ -454,13 +454,13 @@  discard block
 block discarded – undo
454 454
 
455 455
 
456 456
 	/**
457
-	*	retrieve data for Prices List table
458
-	*	@access public
459
-	* 	@param  int  $per_page    how many prices displayed per page
460
-	* 	@param  boolean $count   return the count or objects
461
-	* 	@param  boolean $trashed   whether the current view is of the trash can - eww yuck!
462
-	* 	@return mixed (int|array)  int = count || array of price objects
463
-	*/
457
+	 *	retrieve data for Prices List table
458
+	 *	@access public
459
+	 * 	@param  int  $per_page    how many prices displayed per page
460
+	 * 	@param  boolean $count   return the count or objects
461
+	 * 	@param  boolean $trashed   whether the current view is of the trash can - eww yuck!
462
+	 * 	@return mixed (int|array)  int = count || array of price objects
463
+	 */
464 464
 	public function get_prices_overview_data( $per_page = 10, $count = FALSE, $trashed = FALSE ) {
465 465
 
466 466
 		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
@@ -530,9 +530,9 @@  discard block
 block discarded – undo
530 530
 
531 531
 	/**
532 532
 	 * 		_price_details
533
-	*		@access protected
534
-	*		@return void
535
-	*/
533
+	 *		@access protected
534
+	 *		@return void
535
+	 */
536 536
 	protected function _edit_price_details() {
537 537
 		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
538 538
 		// grab price ID
@@ -592,9 +592,9 @@  discard block
 block discarded – undo
592 592
 
593 593
 	/**
594 594
 	 * 		declare price details page metaboxes
595
-	*		@access protected
596
-	*		@return void
597
-	*/
595
+	 *		@access protected
596
+	 *		@return void
597
+	 */
598 598
 	protected function _price_details_meta_boxes() {
599 599
 		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' );
600 600
 	}
@@ -606,9 +606,9 @@  discard block
 block discarded – undo
606 606
 
607 607
 	/**
608 608
 	 * 		_edit_price_details_meta_box
609
-	*		@access public
610
-	*		@return void
611
-	*/
609
+	 *		@access public
610
+	 *		@return void
611
+	 */
612 612
 	public function _edit_price_details_meta_box() {
613 613
 		echo EEH_Template::display_template( PRICING_TEMPLATE_PATH . 'pricing_details_main_meta_box.template.php', $this->_template_args, TRUE );
614 614
 	}
@@ -619,9 +619,9 @@  discard block
 block discarded – undo
619 619
 
620 620
 	/**
621 621
 	 * 		set_price_column_values
622
-	*		@access protected
623
-	*		@return array
624
-	*/
622
+	 *		@access protected
623
+	 *		@return array
624
+	 */
625 625
 	protected function set_price_column_values() {
626 626
 
627 627
 		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
@@ -648,10 +648,10 @@  discard block
 block discarded – undo
648 648
 
649 649
 	/**
650 650
 	 * 		insert_or_update_price
651
-	*		@param boolean 		$insert - whether to insert or update
652
-	*		@access protected
653
-	*		@return void
654
-	*/
651
+	 *		@param boolean 		$insert - whether to insert or update
652
+	 *		@access protected
653
+	 *		@return void
654
+	 */
655 655
 	protected function _insert_or_update_price( $insert = FALSE ) {
656 656
 
657 657
 		//echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>';
@@ -724,10 +724,10 @@  discard block
 block discarded – undo
724 724
 
725 725
 	/**
726 726
 	 * 		_trash_or_restore_price
727
-	*		@param boolean 		$trash - whether to move item to trash (TRUE) or restore it (FALSE)
728
-	*		@access protected
729
-	*		@return void
730
-	*/
727
+	 *		@param boolean 		$trash - whether to move item to trash (TRUE) or restore it (FALSE)
728
+	 *		@access protected
729
+	 *		@return void
730
+	 */
731 731
 	protected function _trash_or_restore_price( $trash = TRUE ) {
732 732
 
733 733
 		//echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>';
@@ -807,9 +807,9 @@  discard block
 block discarded – undo
807 807
 
808 808
 	/**
809 809
 	 * 		_delete_price
810
-	*		@access protected
811
-	*		@return void
812
-	*/
810
+	 *		@access protected
811
+	 *		@return void
812
+	 */
813 813
 	protected function _delete_price() {
814 814
 
815 815
 		//echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>';
@@ -886,16 +886,16 @@  discard block
 block discarded – undo
886 886
 
887 887
 	/**
888 888
 	 * 		generates HTML for main Prices Admin page
889
-	*		@access protected
890
-	*		@return void
891
-	*/
889
+	 *		@access protected
890
+	 *		@return void
891
+	 */
892 892
 	protected function _price_types_overview_list_table() {
893 893
 		$this->_admin_page_title .= ' ' . $this->get_action_link_or_button(
894
-		    'add_new_price_type',
895
-            'add_type',
896
-            array(),
897
-            'add-new-h2'
898
-        );
894
+			'add_new_price_type',
895
+			'add_type',
896
+			array(),
897
+			'add-new-h2'
898
+		);
899 899
 		$this->admin_page_title .= $this->_learn_more_about_pricing_link();
900 900
 		$this->_search_btn_label = __('Price Types', 'event_espresso');
901 901
 		$this->display_admin_list_table_page_with_no_sidebar();
@@ -907,13 +907,13 @@  discard block
 block discarded – undo
907 907
 
908 908
 
909 909
 	/**
910
-	*	retrieve data for Price Types List table
911
-	*	@access public
912
-	* 	@param  int  $per_page    how many prices displayed per page
913
-	* 	@param  boolean $count   return the count or objects
914
-	* 	@param  boolean $trashed   whether the current view is of the trash can - eww yuck!
915
-	* 	@return mixed (int|array)  int = count || array of price objects
916
-	*/
910
+	 *	retrieve data for Price Types List table
911
+	 *	@access public
912
+	 * 	@param  int  $per_page    how many prices displayed per page
913
+	 * 	@param  boolean $count   return the count or objects
914
+	 * 	@param  boolean $trashed   whether the current view is of the trash can - eww yuck!
915
+	 * 	@return mixed (int|array)  int = count || array of price objects
916
+	 */
917 917
 	public function get_price_types_overview_data( $per_page = 10, $count = FALSE, $trashed = FALSE ) {
918 918
 
919 919
 		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
@@ -968,9 +968,9 @@  discard block
 block discarded – undo
968 968
 
969 969
 	/**
970 970
 	 * 		_edit_price_type_details
971
-	*		@access protected
972
-	*		@return void
973
-	*/
971
+	 *		@access protected
972
+	 *		@return void
973
+	 */
974 974
 	protected function _edit_price_type_details() {
975 975
 
976 976
 		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
@@ -1025,9 +1025,9 @@  discard block
 block discarded – undo
1025 1025
 
1026 1026
 	/**
1027 1027
 	 * 		declare price type details page metaboxes
1028
-	*		@access protected
1029
-	*		@return void
1030
-	*/
1028
+	 *		@access protected
1029
+	 *		@return void
1030
+	 */
1031 1031
 	protected function _price_type_details_meta_boxes() {
1032 1032
 		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' );
1033 1033
 	}
@@ -1038,9 +1038,9 @@  discard block
 block discarded – undo
1038 1038
 
1039 1039
 	/**
1040 1040
 	 * 		_edit_price_type_details_meta_box
1041
-	*		@access public
1042
-	*		@return void
1043
-	*/
1041
+	 *		@access public
1042
+	 *		@return void
1043
+	 */
1044 1044
 	public function _edit_price_type_details_meta_box() {
1045 1045
 		echo EEH_Template::display_template( PRICING_TEMPLATE_PATH . 'pricing_type_details_main_meta_box.template.php', $this->_template_args, TRUE );
1046 1046
 	}
@@ -1050,9 +1050,9 @@  discard block
 block discarded – undo
1050 1050
 
1051 1051
 	/**
1052 1052
 	 * 		set_price_type_column_values
1053
-	*		@access protected
1054
-	*		@return void
1055
-	*/
1053
+	 *		@access protected
1054
+	 *		@return void
1055
+	 */
1056 1056
 	protected function set_price_type_column_values() {
1057 1057
 
1058 1058
 		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
@@ -1100,10 +1100,10 @@  discard block
 block discarded – undo
1100 1100
 
1101 1101
 	/**
1102 1102
 	 * 		_insert_or_update_price_type
1103
-	*		@param boolean 		$new_price_type - whether to insert or update
1104
-	*		@access protected
1105
-	*		@return void
1106
-	*/
1103
+	 *		@param boolean 		$new_price_type - whether to insert or update
1104
+	 *		@access protected
1105
+	 *		@return void
1106
+	 */
1107 1107
 	protected function _insert_or_update_price_type( $new_price_type = FALSE ) {
1108 1108
 
1109 1109
 //		echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>';
@@ -1144,10 +1144,10 @@  discard block
 block discarded – undo
1144 1144
 
1145 1145
 	/**
1146 1146
 	 * 		_trash_or_restore_price_type
1147
-	*		@param boolean 		$trash - whether to move item to trash (TRUE) or restore it (FALSE)
1148
-	*		@access protected
1149
-	*		@return void
1150
-	*/
1147
+	 *		@param boolean 		$trash - whether to move item to trash (TRUE) or restore it (FALSE)
1148
+	 *		@access protected
1149
+	 *		@return void
1150
+	 */
1151 1151
 	protected function _trash_or_restore_price_type( $trash = TRUE ) {
1152 1152
 
1153 1153
 		//echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>';
@@ -1201,9 +1201,9 @@  discard block
 block discarded – undo
1201 1201
 
1202 1202
 	/**
1203 1203
 	 * 		_delete_price_type
1204
-	*		@access protected
1205
-	*		@return void
1206
-	*/
1204
+	 *		@access protected
1205
+	 *		@return void
1206
+	 */
1207 1207
 	protected function _delete_price_type() {
1208 1208
 
1209 1209
 		//echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>';
@@ -1240,9 +1240,9 @@  discard block
 block discarded – undo
1240 1240
 
1241 1241
 	/**
1242 1242
 	 * 		_learn_more_about_pricing_link
1243
-	*		@access protected
1244
-	*		@return string
1245
-	*/
1243
+	 *		@access protected
1244
+	 *		@return string
1245
+	 */
1246 1246
 	protected function _learn_more_about_pricing_link() {
1247 1247
 		return '<a class="hidden" style="margin:0 20px; cursor:pointer; font-size:12px;" >' . __('learn more about how pricing works', 'event_espresso') . '</a>';
1248 1248
 	}
Please login to merge, or discard this patch.
Spacing   +192 added lines, -192 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'),
@@ -437,7 +437,7 @@  discard block
 block discarded – undo
437 437
 	*		@return void
438 438
 	*/
439 439
 	protected function _price_overview_list_table() {
440
-		$this->_admin_page_title .= ' ' . $this->get_action_link_or_button(
440
+		$this->_admin_page_title .= ' '.$this->get_action_link_or_button(
441 441
 		    'add_new_price',
442 442
             'add',
443 443
             array(),
@@ -461,18 +461,18 @@  discard block
 block discarded – undo
461 461
 	* 	@param  boolean $trashed   whether the current view is of the trash can - eww yuck!
462 462
 	* 	@return mixed (int|array)  int = count || array of price objects
463 463
 	*/
464
-	public function get_prices_overview_data( $per_page = 10, $count = FALSE, $trashed = FALSE ) {
464
+	public function get_prices_overview_data($per_page = 10, $count = FALSE, $trashed = FALSE) {
465 465
 
466
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
466
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
467 467
 		// start with an empty array
468 468
 		$event_pricing = array();
469 469
 
470
-		require_once( PRICING_ADMIN . 'Prices_List_Table.class.php' );
471
-		require_once(EE_MODELS . 'EEM_Price.model.php');
470
+		require_once(PRICING_ADMIN.'Prices_List_Table.class.php');
471
+		require_once(EE_MODELS.'EEM_Price.model.php');
472 472
 		//$PRC = EEM_Price::instance();
473 473
 
474 474
 		$this->_req_data['orderby'] = empty($this->_req_data['orderby']) ? '' : $this->_req_data['orderby'];
475
-		$order = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'ASC';
475
+		$order = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'ASC';
476 476
 
477 477
 		switch ($this->_req_data['orderby']) {
478 478
 			case 'name':
@@ -485,27 +485,27 @@  discard block
 block discarded – undo
485 485
 				$orderby = array('PRC_amount'=>$order);
486 486
 				break;
487 487
 			default:
488
-				$orderby = array( 'PRC_order'=>$order, 'Price_Type.PRT_order'=>$order, 'PRC_ID'=>$order);
488
+				$orderby = array('PRC_order'=>$order, 'Price_Type.PRT_order'=>$order, 'PRC_ID'=>$order);
489 489
 		}
490 490
 
491
-		$current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1;
492
-		$per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page;
491
+		$current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1;
492
+		$per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page;
493 493
 
494 494
 		$_where = array(
495 495
 				'PRC_is_default' => 1,
496 496
 				'PRC_deleted' => $trashed
497 497
 				);
498 498
 
499
-		$offset = ($current_page-1)*$per_page;
500
-		$limit = array( $offset, $per_page );
499
+		$offset = ($current_page - 1) * $per_page;
500
+		$limit = array($offset, $per_page);
501 501
 
502
-		if ( isset( $this->_req_data['s'] ) ) {
503
-			$sstr = '%' . $this->_req_data['s'] . '%';
502
+		if (isset($this->_req_data['s'])) {
503
+			$sstr = '%'.$this->_req_data['s'].'%';
504 504
 			$_where['OR'] = array(
505
-				'PRC_name' => array('LIKE',$sstr ),
506
-				'PRC_desc' => array('LIKE',$sstr ),
507
-				'PRC_amount' => array( 'LIKE',$sstr ),
508
-				'Price_Type.PRT_name' => array( 'LIKE', $sstr )
505
+				'PRC_name' => array('LIKE', $sstr),
506
+				'PRC_desc' => array('LIKE', $sstr),
507
+				'PRC_amount' => array('LIKE', $sstr),
508
+				'Price_Type.PRT_name' => array('LIKE', $sstr)
509 509
 				);
510 510
 		}
511 511
 
@@ -516,9 +516,9 @@  discard block
 block discarded – undo
516 516
 			'group_by'=>'PRC_ID'
517 517
 			);
518 518
 
519
-		if($count){
520
-			return $trashed ? EEM_Price::instance()->count( array( $_where ) ) : EEM_Price::instance()->count_deleted_and_undeleted(array($_where));
521
-		}else{
519
+		if ($count) {
520
+			return $trashed ? EEM_Price::instance()->count(array($_where)) : EEM_Price::instance()->count_deleted_and_undeleted(array($_where));
521
+		} else {
522 522
 			return EEM_Price::instance()->get_all_deleted_and_undeleted($query_params);
523 523
 		}
524 524
 	}
@@ -534,49 +534,49 @@  discard block
 block discarded – undo
534 534
 	*		@return void
535 535
 	*/
536 536
 	protected function _edit_price_details() {
537
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
537
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
538 538
 		// grab price ID
539
-		$PRC_ID = isset( $this->_req_data['id'] ) && ! empty( $this->_req_data['id'] ) ? absint( $this->_req_data['id'] ) : FALSE;
539
+		$PRC_ID = isset($this->_req_data['id']) && ! empty($this->_req_data['id']) ? absint($this->_req_data['id']) : FALSE;
540 540
 		// change page title based on request action
541
-		switch( $this->_req_action ) {
541
+		switch ($this->_req_action) {
542 542
 			case 'add_new_price' :
543
-				$this->_admin_page_title = esc_html__( 'Add New Price', 'event_espresso' );
543
+				$this->_admin_page_title = esc_html__('Add New Price', 'event_espresso');
544 544
 				break;
545 545
 			case 'edit_price' :
546
-				$this->_admin_page_title = esc_html__( 'Edit Price', 'event_espresso' );
546
+				$this->_admin_page_title = esc_html__('Edit Price', 'event_espresso');
547 547
 				break;
548 548
 			default :
549
-				$this->_admin_page_title = ucwords( str_replace( '_', ' ', $this->_req_action ));
549
+				$this->_admin_page_title = ucwords(str_replace('_', ' ', $this->_req_action));
550 550
 		}
551 551
 		// add PRC_ID to title if editing
552
-		$this->_admin_page_title = $PRC_ID ? $this->_admin_page_title . ' # ' . $PRC_ID : $this->_admin_page_title;
552
+		$this->_admin_page_title = $PRC_ID ? $this->_admin_page_title.' # '.$PRC_ID : $this->_admin_page_title;
553 553
 
554 554
 		// get prices
555
-		require_once(EE_MODELS . 'EEM_Price.model.php');
555
+		require_once(EE_MODELS.'EEM_Price.model.php');
556 556
 		$PRC = EEM_Price::instance();
557 557
 
558
-		if ( $PRC_ID ) {
559
-			$price = $PRC->get_one_by_ID( $PRC_ID );
558
+		if ($PRC_ID) {
559
+			$price = $PRC->get_one_by_ID($PRC_ID);
560 560
 			$additional_hidden_fields = array(
561
-					'PRC_ID' => array( 'type' => 'hidden', 'value' => $PRC_ID )
561
+					'PRC_ID' => array('type' => 'hidden', 'value' => $PRC_ID)
562 562
 				);
563
-			$this->_set_add_edit_form_tags( 'update_price', $additional_hidden_fields );
563
+			$this->_set_add_edit_form_tags('update_price', $additional_hidden_fields);
564 564
 		} else {
565 565
 			$price = $PRC->get_new_price();
566
-			$this->_set_add_edit_form_tags( 'insert_price' );
566
+			$this->_set_add_edit_form_tags('insert_price');
567 567
 		}
568 568
 
569 569
 		$this->_template_args['PRC_ID'] = $PRC_ID;
570 570
 		$this->_template_args['price'] = $price;
571 571
 
572 572
 		// get price types
573
-		require_once(EE_MODELS . 'EEM_Price_Type.model.php');
573
+		require_once(EE_MODELS.'EEM_Price_Type.model.php');
574 574
 		$PRT = EEM_Price_Type::instance();
575
-		$price_types = $PRT->get_all( array( array('PBT_ID' => array('!=', 1 ) ) ) );
575
+		$price_types = $PRT->get_all(array(array('PBT_ID' => array('!=', 1))));
576 576
 		$price_type_names = array();
577 577
 		if (empty($price_types)) {
578
-			$msg = __( 'You have no price types defined. Please add a price type before adding a price.', 'event_espresso' );
579
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
578
+			$msg = __('You have no price types defined. Please add a price type before adding a price.', 'event_espresso');
579
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
580 580
 			exit();
581 581
 		} else {
582 582
 			foreach ($price_types as $type) {
@@ -589,7 +589,7 @@  discard block
 block discarded – undo
589 589
 		$this->_template_args['price_types'] = $price_type_names;
590 590
 		$this->_template_args['learn_more_about_pricing_link'] = $this->_learn_more_about_pricing_link();
591 591
 
592
-		$this->_set_publish_post_box_vars( 'id', $PRC_ID );
592
+		$this->_set_publish_post_box_vars('id', $PRC_ID);
593 593
 		// the details template wrapper
594 594
 		$this->display_admin_page_with_sidebar();
595 595
 	}
@@ -605,7 +605,7 @@  discard block
 block discarded – undo
605 605
 	*		@return void
606 606
 	*/
607 607
 	protected function _price_details_meta_boxes() {
608
-		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' );
608
+		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');
609 609
 	}
610 610
 
611 611
 
@@ -619,7 +619,7 @@  discard block
 block discarded – undo
619 619
 	*		@return void
620 620
 	*/
621 621
 	public function _edit_price_details_meta_box() {
622
-		echo EEH_Template::display_template( PRICING_TEMPLATE_PATH . 'pricing_details_main_meta_box.template.php', $this->_template_args, TRUE );
622
+		echo EEH_Template::display_template(PRICING_TEMPLATE_PATH.'pricing_details_main_meta_box.template.php', $this->_template_args, TRUE);
623 623
 	}
624 624
 
625 625
 
@@ -633,7 +633,7 @@  discard block
 block discarded – undo
633 633
 	*/
634 634
 	protected function set_price_column_values() {
635 635
 
636
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
636
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
637 637
 
638 638
 		$set_column_values = array(
639 639
 				'PRT_ID' => absint($this->_req_data['PRT_ID']),
@@ -661,12 +661,12 @@  discard block
 block discarded – undo
661 661
 	*		@access protected
662 662
 	*		@return void
663 663
 	*/
664
-	protected function _insert_or_update_price( $insert = FALSE ) {
664
+	protected function _insert_or_update_price($insert = FALSE) {
665 665
 
666 666
 		//echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>';
667
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
667
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
668 668
 
669
-		require_once(EE_MODELS . 'EEM_Price.model.php');
669
+		require_once(EE_MODELS.'EEM_Price.model.php');
670 670
 		$PRC = EEM_Price::instance();
671 671
 
672 672
 		// why be so pessimistic ???  : (
@@ -674,14 +674,14 @@  discard block
 block discarded – undo
674 674
 
675 675
 		$set_column_values = $this->set_price_column_values();
676 676
 		// is this a new Price ?
677
-		if ( $insert ) {
677
+		if ($insert) {
678 678
 			// run the insert
679
-			if ( $PRC_ID = $PRC->insert( $set_column_values )) {
679
+			if ($PRC_ID = $PRC->insert($set_column_values)) {
680 680
 				//make sure this new price modifier is attached to the ticket but ONLY if it is not a tax type
681 681
 				$PR = EEM_price::instance()->get_one_by_ID($PRC_ID);
682
-				if ( $PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax ) {
682
+				if ($PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax) {
683 683
 					$ticket = EEM_Ticket::instance()->get_one_by_ID(1);
684
-					$ticket->_add_relation_to( $PR, 'Price' );
684
+					$ticket->_add_relation_to($PR, 'Price');
685 685
 					$ticket->save();
686 686
 				}
687 687
 				$success = 1;
@@ -691,29 +691,29 @@  discard block
 block discarded – undo
691 691
 			}
692 692
 			$action_desc = 'created';
693 693
 		} else {
694
-			$PRC_ID = absint( $this->_req_data['PRC_ID'] );
694
+			$PRC_ID = absint($this->_req_data['PRC_ID']);
695 695
 			// run the update
696
-			$where_cols_n_values = array( 'PRC_ID' => $PRC_ID );
697
-			if ( $PRC->update( $set_column_values, array($where_cols_n_values))) {
696
+			$where_cols_n_values = array('PRC_ID' => $PRC_ID);
697
+			if ($PRC->update($set_column_values, array($where_cols_n_values))) {
698 698
 				$success = 1;
699 699
 			}
700 700
 
701 701
 			$PR = EEM_Price::instance()->get_one_by_ID($PRC_ID);
702
-			if ( $PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax ) {
702
+			if ($PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax) {
703 703
 
704 704
 				//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.
705
-				if ( $PRC_ID === 1 ) {
705
+				if ($PRC_ID === 1) {
706 706
 					$ticket = $PR->get_first_related('Ticket');
707
-					if ( $ticket ) {
708
-						$ticket->set('TKT_price', $PR->get('PRC_amount') );
709
-						$ticket->set('TKT_name', $PR->get('PRC_name') );
707
+					if ($ticket) {
708
+						$ticket->set('TKT_price', $PR->get('PRC_amount'));
709
+						$ticket->set('TKT_name', $PR->get('PRC_name'));
710 710
 						$ticket->set('TKT_description', $PR->get('PRC_desc'));
711 711
 						$ticket->save();
712 712
 					}
713 713
 				} else {
714 714
 					//we make sure this price is attached to base ticket. but ONLY if its not a tax ticket type.
715 715
 					$ticket = EEM_Ticket::instance()->get_one_by_ID(1);
716
-					$ticket->_add_relation_to( $PRC_ID, 'Price' );
716
+					$ticket->_add_relation_to($PRC_ID, 'Price');
717 717
 					$ticket->save();
718 718
 				}
719 719
 			}
@@ -721,9 +721,9 @@  discard block
 block discarded – undo
721 721
 			$action_desc = 'updated';
722 722
 		}
723 723
 
724
-		$query_args = array( 'action' => 'edit_price', 'id' => $PRC_ID );
724
+		$query_args = array('action' => 'edit_price', 'id' => $PRC_ID);
725 725
 
726
-		$this->_redirect_after_action( $success, 'Prices', $action_desc, $query_args );
726
+		$this->_redirect_after_action($success, 'Prices', $action_desc, $query_args);
727 727
 
728 728
 	}
729 729
 
@@ -737,12 +737,12 @@  discard block
 block discarded – undo
737 737
 	*		@access protected
738 738
 	*		@return void
739 739
 	*/
740
-	protected function _trash_or_restore_price( $trash = TRUE ) {
740
+	protected function _trash_or_restore_price($trash = TRUE) {
741 741
 
742 742
 		//echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>';
743
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
743
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
744 744
 
745
-		require_once(EE_MODELS . 'EEM_Price.model.php');
745
+		require_once(EE_MODELS.'EEM_Price.model.php');
746 746
 		$PRC = EEM_Price::instance();
747 747
 
748 748
 		$success = 1;
@@ -751,18 +751,18 @@  discard block
 block discarded – undo
751 751
 		//get base ticket for updating
752 752
 		$ticket = EEM_Ticket::instance()->get_one_by_ID(1);
753 753
 		//Checkboxes
754
-		if (!empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
754
+		if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
755 755
 			// if array has more than one element than success message should be plural
756
-			$success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1;
756
+			$success = count($this->_req_data['checkbox']) > 1 ? 2 : 1;
757 757
 			// cycle thru checkboxes
758
-			while (list( $PRC_ID, $value ) = each($this->_req_data['checkbox'])) {
759
-				if ( ! $PRC->update_by_ID(array('PRC_deleted' => $PRC_deleted), absint($PRC_ID) ) ) {
758
+			while (list($PRC_ID, $value) = each($this->_req_data['checkbox'])) {
759
+				if ( ! $PRC->update_by_ID(array('PRC_deleted' => $PRC_deleted), absint($PRC_ID))) {
760 760
 					$success = 0;
761 761
 				} else {
762 762
 					$PR = EEM_Price::instance()->get_one_by_ID($PRC_ID);
763
-					if ( $PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax ) {
763
+					if ($PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax) {
764 764
 						//if trashing then remove relations to base default ticket.  If restoring then add back to base default ticket
765
-						if ( $PRC_deleted ) {
765
+						if ($PRC_deleted) {
766 766
 							$ticket->_remove_relation_to($PRC_ID, 'Price');
767 767
 						} else {
768 768
 							$ticket->_add_relation_to($PRC_ID, 'Price');
@@ -774,14 +774,14 @@  discard block
 block discarded – undo
774 774
 
775 775
 		} else {
776 776
 			// grab single id and delete
777
-			$PRC_ID = isset( $this->_req_data['id'] ) ? absint($this->_req_data['id']) : 0;
778
-			if ( empty( $PRC_ID ) || ! $PRC->update_by_ID(array('PRC_deleted' => $PRC_deleted), $PRC_ID) ) {
777
+			$PRC_ID = isset($this->_req_data['id']) ? absint($this->_req_data['id']) : 0;
778
+			if (empty($PRC_ID) || ! $PRC->update_by_ID(array('PRC_deleted' => $PRC_deleted), $PRC_ID)) {
779 779
 				$success = 0;
780 780
 			} else {
781 781
 				$PR = EEM_Price::instance()->get_one_by_ID($PRC_ID);
782
-				if ( $PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax ) {
782
+				if ($PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax) {
783 783
 					//if trashing then remove relations to base default ticket.  If restoring then add back to base default ticket
784
-					if ( $PRC_deleted ) {
784
+					if ($PRC_deleted) {
785 785
 						$ticket->_remove_relation_to($PRC_ID, 'Price');
786 786
 					} else {
787 787
 						$ticket->_add_relation_to($PRC_ID, 'Price');
@@ -795,17 +795,17 @@  discard block
 block discarded – undo
795 795
 			'action' => 'default'
796 796
 			);
797 797
 
798
-		if ( $success ) {
799
-			if ( $trash ) {
798
+		if ($success) {
799
+			if ($trash) {
800 800
 				$msg = $success == 2 ? __('The Prices have been trashed.', 'event_espresso') : __('The Price has been trashed.', 'event_espresso');
801 801
 			} else {
802 802
 				$msg = $success == 2 ? __('The Prices have been restored.', 'event_espresso') : __('The Price has been restored.', 'event_espresso');
803 803
 			}
804 804
 
805
-			EE_Error::add_success( $msg );
805
+			EE_Error::add_success($msg);
806 806
 		}
807 807
 
808
-		$this->_redirect_after_action( FALSE, '', '', $query_args, TRUE );
808
+		$this->_redirect_after_action(FALSE, '', '', $query_args, TRUE);
809 809
 
810 810
 	}
811 811
 
@@ -822,19 +822,19 @@  discard block
 block discarded – undo
822 822
 	protected function _delete_price() {
823 823
 
824 824
 		//echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>';
825
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
825
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
826 826
 
827
-		require_once(EE_MODELS . 'EEM_Price.model.php');
827
+		require_once(EE_MODELS.'EEM_Price.model.php');
828 828
 		$PRC = EEM_Price::instance();
829 829
 
830 830
 		$success = 1;
831 831
 		//Checkboxes
832
-		if (!empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
832
+		if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
833 833
 			// if array has more than one element than success message should be plural
834
-			$success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1;
834
+			$success = count($this->_req_data['checkbox']) > 1 ? 2 : 1;
835 835
 			// cycle thru bulk action checkboxes
836
-			while (list( $PRC_ID, $value ) = each($this->_req_data['checkbox'])) {
837
-				if (!$PRC->delete_permanently_by_ID(absint($PRC_ID))) {
836
+			while (list($PRC_ID, $value) = each($this->_req_data['checkbox'])) {
837
+				if ( ! $PRC->delete_permanently_by_ID(absint($PRC_ID))) {
838 838
 					$success = 0;
839 839
 				}
840 840
 			}
@@ -848,7 +848,7 @@  discard block
 block discarded – undo
848 848
 
849 849
 		}
850 850
 
851
-		$this->_redirect_after_action( $success, 'Prices', 'deleted', array() );
851
+		$this->_redirect_after_action($success, 'Prices', 'deleted', array());
852 852
 
853 853
 	}
854 854
 
@@ -856,16 +856,16 @@  discard block
 block discarded – undo
856 856
 
857 857
 
858 858
 	public function update_price_order() {
859
-		$success = __( 'Price order was updated successfully.', 'event_espresso' );
859
+		$success = __('Price order was updated successfully.', 'event_espresso');
860 860
 
861 861
 		// grab our row IDs
862
-		$row_ids = isset( $this->_req_data['row_ids'] ) && ! empty( $this->_req_data['row_ids'] ) ? explode( ',', rtrim( $this->_req_data['row_ids'], ',' )) : FALSE;
862
+		$row_ids = isset($this->_req_data['row_ids']) && ! empty($this->_req_data['row_ids']) ? explode(',', rtrim($this->_req_data['row_ids'], ',')) : FALSE;
863 863
 
864
-		if ( is_array( $row_ids )) {
865
-			for ( $i = 0; $i < count( $row_ids ); $i++ ) {
864
+		if (is_array($row_ids)) {
865
+			for ($i = 0; $i < count($row_ids); $i++) {
866 866
 				//Update the prices when re-ordering
867 867
 				$id = absint($row_ids[$i]);
868
-				if ( EEM_Price::instance()->update ( array( 'PRC_order' => $i+1 ), array(array( 'PRC_ID' => $id ) )) === FALSE ) {
868
+				if (EEM_Price::instance()->update(array('PRC_order' => $i + 1), array(array('PRC_ID' => $id))) === FALSE) {
869 869
 					$success = FALSE;
870 870
 				}
871 871
 			}
@@ -873,9 +873,9 @@  discard block
 block discarded – undo
873 873
 			$success = FALSE;
874 874
 		}
875 875
 
876
-		$errors = ! $success ? __( 'An error occurred. The price order was not updated.', 'event_espresso' ) : FALSE;
876
+		$errors = ! $success ? __('An error occurred. The price order was not updated.', 'event_espresso') : FALSE;
877 877
 
878
-		echo json_encode( array( 'return_data' => FALSE, 'success' => $success, 'errors' => $errors ));
878
+		echo json_encode(array('return_data' => FALSE, 'success' => $success, 'errors' => $errors));
879 879
 		die();
880 880
 	}
881 881
 
@@ -899,7 +899,7 @@  discard block
 block discarded – undo
899 899
 	*		@return void
900 900
 	*/
901 901
 	protected function _price_types_overview_list_table() {
902
-		$this->_admin_page_title .= ' ' . $this->get_action_link_or_button(
902
+		$this->_admin_page_title .= ' '.$this->get_action_link_or_button(
903 903
 		    'add_new_price_type',
904 904
             'add_type',
905 905
             array(),
@@ -923,46 +923,46 @@  discard block
 block discarded – undo
923 923
 	* 	@param  boolean $trashed   whether the current view is of the trash can - eww yuck!
924 924
 	* 	@return mixed (int|array)  int = count || array of price objects
925 925
 	*/
926
-	public function get_price_types_overview_data( $per_page = 10, $count = FALSE, $trashed = FALSE ) {
926
+	public function get_price_types_overview_data($per_page = 10, $count = FALSE, $trashed = FALSE) {
927 927
 
928
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
928
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
929 929
 		// start with an empty array
930 930
 
931
-		require_once( PRICING_ADMIN . 'Price_Types_List_Table.class.php' );
932
-		require_once( EE_MODELS . 'EEM_Price_Type.model.php' );
931
+		require_once(PRICING_ADMIN.'Price_Types_List_Table.class.php');
932
+		require_once(EE_MODELS.'EEM_Price_Type.model.php');
933 933
 
934 934
 		$this->_req_data['orderby'] = empty($this->_req_data['orderby']) ? '' : $this->_req_data['orderby'];
935
-		$order = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'ASC';
935
+		$order = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'ASC';
936 936
 		switch ($this->_req_data['orderby']) {
937 937
 			case 'name':
938
-				$orderby = array( 'PRT_name' => $order);
938
+				$orderby = array('PRT_name' => $order);
939 939
 				break;
940 940
 			default:
941
-				$orderby = array( 'PRT_order' => $order);
941
+				$orderby = array('PRT_order' => $order);
942 942
 		}
943 943
 
944 944
 
945
-		$current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1;
946
-		$per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page;
945
+		$current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1;
946
+		$per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page;
947 947
 
948
-		$offset = ($current_page-1)*$per_page;
949
-		$limit = array( $offset, $per_page );
948
+		$offset = ($current_page - 1) * $per_page;
949
+		$limit = array($offset, $per_page);
950 950
 
951
-		$_where = array('PRT_deleted'=>$trashed, 'PBT_ID' => array('!=', 1 ) );
951
+		$_where = array('PRT_deleted'=>$trashed, 'PBT_ID' => array('!=', 1));
952 952
 
953
-		if ( isset( $this->_req_data['s'] ) ) {
954
-			$sstr = '%' . $this->_req_data['s'] . '%';
953
+		if (isset($this->_req_data['s'])) {
954
+			$sstr = '%'.$this->_req_data['s'].'%';
955 955
 			$_where['OR'] = array(
956
-				'PRT_name' => array( 'LIKE', $sstr )
956
+				'PRT_name' => array('LIKE', $sstr)
957 957
 				);
958 958
 		}
959 959
 		$query_params = array(
960 960
 			$_where,
961 961
 			'order_by'=>$orderby,
962 962
 			'limit'=>$limit);
963
-		if($count){
963
+		if ($count) {
964 964
 			return EEM_Price_Type::instance()->count_deleted_and_undeleted($query_params);
965
-		}else{
965
+		} else {
966 966
 			return EEM_Price_Type::instance()->get_all_deleted_and_undeleted($query_params);
967 967
 		}
968 968
 
@@ -982,34 +982,34 @@  discard block
 block discarded – undo
982 982
 	*/
983 983
 	protected function _edit_price_type_details() {
984 984
 
985
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
985
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
986 986
 
987 987
 
988 988
 		// grab price type ID
989
-		$PRT_ID = isset( $this->_req_data['id'] ) && ! empty( $this->_req_data['id'] ) ? absint( $this->_req_data['id'] ) : FALSE;
989
+		$PRT_ID = isset($this->_req_data['id']) && ! empty($this->_req_data['id']) ? absint($this->_req_data['id']) : FALSE;
990 990
 		// change page title based on request action
991
-		switch( $this->_req_action ) {
991
+		switch ($this->_req_action) {
992 992
 			case 'add_new_price_type' :
993
-				$this->_admin_page_title = esc_html__( 'Add New Price Type', 'event_espresso' );
993
+				$this->_admin_page_title = esc_html__('Add New Price Type', 'event_espresso');
994 994
 				break;
995 995
 			case 'edit_price_type' :
996
-				$this->_admin_page_title = esc_html__( 'Edit Price Type', 'event_espresso' );
996
+				$this->_admin_page_title = esc_html__('Edit Price Type', 'event_espresso');
997 997
 				break;
998 998
 			default :
999
-				$this->_admin_page_title = ucwords( str_replace( '_', ' ', $this->_req_action ));
999
+				$this->_admin_page_title = ucwords(str_replace('_', ' ', $this->_req_action));
1000 1000
 		}
1001 1001
 		// add PRT_ID to title if editing
1002
-		$this->_admin_page_title = $PRT_ID ? $this->_admin_page_title . ' # ' . $PRT_ID : $this->_admin_page_title;
1002
+		$this->_admin_page_title = $PRT_ID ? $this->_admin_page_title.' # '.$PRT_ID : $this->_admin_page_title;
1003 1003
 
1004 1004
 //		require_once(EE_MODELS . 'EEM_Price_Type.model.php');
1005 1005
 
1006
-		if ( $PRT_ID ) {
1007
-			$price_type = EEM_Price_Type::instance()->get_one_by_ID( $PRT_ID );
1008
-			$additional_hidden_fields = array( 'PRT_ID' => array( 'type' => 'hidden', 'value' => $PRT_ID ));
1009
-			$this->_set_add_edit_form_tags( 'update_price_type', $additional_hidden_fields );
1006
+		if ($PRT_ID) {
1007
+			$price_type = EEM_Price_Type::instance()->get_one_by_ID($PRT_ID);
1008
+			$additional_hidden_fields = array('PRT_ID' => array('type' => 'hidden', 'value' => $PRT_ID));
1009
+			$this->_set_add_edit_form_tags('update_price_type', $additional_hidden_fields);
1010 1010
 		} else {
1011 1011
 			$price_type = EEM_Price_Type::instance()->get_new_price_type();
1012
-			$this->_set_add_edit_form_tags( 'insert_price_type' );
1012
+			$this->_set_add_edit_form_tags('insert_price_type');
1013 1013
 		}
1014 1014
 
1015 1015
 		$this->_template_args['PRT_ID'] = $PRT_ID;
@@ -1018,19 +1018,19 @@  discard block
 block discarded – undo
1018 1018
 
1019 1019
 		$base_types = EEM_Price_Type::instance()->get_base_types();
1020 1020
 		$select_values = array();
1021
-		foreach ( $base_types as $ref => $text ) {
1022
-			if ( $ref == EEM_Price_Type::base_type_base_price ) {
1021
+		foreach ($base_types as $ref => $text) {
1022
+			if ($ref == EEM_Price_Type::base_type_base_price) {
1023 1023
 				//do not allow creation of base_type_base_prices because that's a system only base type.
1024 1024
 				continue;
1025 1025
 			}
1026
-			$values[] = array( 'id' => $ref, 'text' => $text );
1026
+			$values[] = array('id' => $ref, 'text' => $text);
1027 1027
 		}
1028 1028
 
1029 1029
 
1030 1030
 		$this->_template_args['base_type_select'] = EEH_Form_Fields::select_input('base_type', $values, $price_type->base_type(), 'id="price-type-base-type-slct"');
1031 1031
 		$this->_template_args['learn_more_about_pricing_link'] = $this->_learn_more_about_pricing_link();
1032
-		$redirect_URL = add_query_arg( array( 'action' => 'price_types'), $this->_admin_base_url );
1033
-		$this->_set_publish_post_box_vars( 'id', $PRT_ID, FALSE, $redirect_URL );
1032
+		$redirect_URL = add_query_arg(array('action' => 'price_types'), $this->_admin_base_url);
1033
+		$this->_set_publish_post_box_vars('id', $PRT_ID, FALSE, $redirect_URL);
1034 1034
 		// the details template wrapper
1035 1035
 		$this->display_admin_page_with_sidebar();
1036 1036
 
@@ -1047,7 +1047,7 @@  discard block
 block discarded – undo
1047 1047
 	*		@return void
1048 1048
 	*/
1049 1049
 	protected function _price_type_details_meta_boxes() {
1050
-		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' );
1050
+		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');
1051 1051
 	}
1052 1052
 
1053 1053
 
@@ -1060,7 +1060,7 @@  discard block
 block discarded – undo
1060 1060
 	*		@return void
1061 1061
 	*/
1062 1062
 	public function _edit_price_type_details_meta_box() {
1063
-		echo EEH_Template::display_template( PRICING_TEMPLATE_PATH . 'pricing_type_details_main_meta_box.template.php', $this->_template_args, TRUE );
1063
+		echo EEH_Template::display_template(PRICING_TEMPLATE_PATH.'pricing_type_details_main_meta_box.template.php', $this->_template_args, TRUE);
1064 1064
 	}
1065 1065
 
1066 1066
 
@@ -1073,9 +1073,9 @@  discard block
 block discarded – undo
1073 1073
 	*/
1074 1074
 	protected function set_price_type_column_values() {
1075 1075
 
1076
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
1076
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1077 1077
 
1078
-		$base_type = !empty( $this->_req_data['base_type'] ) ? $this->_req_data['base_type'] : EEM_Price_Type::base_type_base_price;
1078
+		$base_type = ! empty($this->_req_data['base_type']) ? $this->_req_data['base_type'] : EEM_Price_Type::base_type_base_price;
1079 1079
 
1080 1080
 		switch ($base_type) {
1081 1081
 
@@ -1122,12 +1122,12 @@  discard block
 block discarded – undo
1122 1122
 	*		@access protected
1123 1123
 	*		@return void
1124 1124
 	*/
1125
-	protected function _insert_or_update_price_type( $new_price_type = FALSE ) {
1125
+	protected function _insert_or_update_price_type($new_price_type = FALSE) {
1126 1126
 
1127 1127
 //		echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>';
1128
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
1128
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1129 1129
 
1130
-		require_once(EE_MODELS . 'EEM_Price_Type.model.php');
1130
+		require_once(EE_MODELS.'EEM_Price_Type.model.php');
1131 1131
 		$PRT = EEM_Price_Type::instance();
1132 1132
 
1133 1133
 		// why be so pessimistic ???  : (
@@ -1135,24 +1135,24 @@  discard block
 block discarded – undo
1135 1135
 
1136 1136
 		$set_column_values = $this->set_price_type_column_values();
1137 1137
 		// is this a new Price ?
1138
-		if ( $new_price_type ) {
1138
+		if ($new_price_type) {
1139 1139
 			// run the insert
1140
-			if ( $PRT_ID = $PRT->insert( $set_column_values )) {
1140
+			if ($PRT_ID = $PRT->insert($set_column_values)) {
1141 1141
 				$success = 1;
1142 1142
 			}
1143 1143
 			$action_desc = 'created';
1144 1144
 		} else {
1145 1145
 			$PRT_ID = absint($this->_req_data['PRT_ID']);
1146 1146
 			// run the update
1147
-			$where_cols_n_values = array('PRT_ID' => $PRT_ID );
1148
-			if ( $PRT->update( $set_column_values, array( $where_cols_n_values ))) {
1147
+			$where_cols_n_values = array('PRT_ID' => $PRT_ID);
1148
+			if ($PRT->update($set_column_values, array($where_cols_n_values))) {
1149 1149
 				$success = 1;
1150 1150
 			}
1151 1151
 			$action_desc = 'updated';
1152 1152
 		}
1153 1153
 
1154
-		$query_args = array( 'action'=> 'edit_price_type', 'id' => $PRT_ID );
1155
-		$this->_redirect_after_action( $success, 'Price Type', $action_desc, $query_args );
1154
+		$query_args = array('action'=> 'edit_price_type', 'id' => $PRT_ID);
1155
+		$this->_redirect_after_action($success, 'Price Type', $action_desc, $query_args);
1156 1156
 
1157 1157
 	}
1158 1158
 
@@ -1166,49 +1166,49 @@  discard block
 block discarded – undo
1166 1166
 	*		@access protected
1167 1167
 	*		@return void
1168 1168
 	*/
1169
-	protected function _trash_or_restore_price_type( $trash = TRUE ) {
1169
+	protected function _trash_or_restore_price_type($trash = TRUE) {
1170 1170
 
1171 1171
 		//echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>';
1172
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
1172
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1173 1173
 
1174
-		require_once(EE_MODELS . 'EEM_Price_Type.model.php');
1174
+		require_once(EE_MODELS.'EEM_Price_Type.model.php');
1175 1175
 		$PRT = EEM_Price_Type::instance();
1176 1176
 
1177 1177
 		$success = 1;
1178 1178
 		$PRT_deleted = $trash ? TRUE : FALSE;
1179 1179
 		//Checkboxes
1180
-		if (!empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
1180
+		if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
1181 1181
 			// if array has more than one element than success message should be plural
1182
-			$success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1;
1183
-			$what = count( $this->_req_data['checkbox'] ) > 1 ? 'Price Types' : 'Price Type';
1182
+			$success = count($this->_req_data['checkbox']) > 1 ? 2 : 1;
1183
+			$what = count($this->_req_data['checkbox']) > 1 ? 'Price Types' : 'Price Type';
1184 1184
 			// cycle thru checkboxes
1185
-			while (list( $PRT_ID, $value ) = each($this->_req_data['checkbox'])) {
1186
-				if ( ! $PRT->update_by_ID(array('PRT_deleted' => $PRT_deleted), $PRT_ID ) ) {
1185
+			while (list($PRT_ID, $value) = each($this->_req_data['checkbox'])) {
1186
+				if ( ! $PRT->update_by_ID(array('PRT_deleted' => $PRT_deleted), $PRT_ID)) {
1187 1187
 					$success = 0;
1188 1188
 				}
1189 1189
 			}
1190 1190
 
1191 1191
 		} else {
1192 1192
 			// grab single id and delete
1193
-			$PRT_ID = isset( $this->_req_data['id'] ) ? absint($this->_req_data['id']) : 0;
1194
-			if ( empty( $PRT_ID ) || ! $PRT->update_by_ID(array('PRT_deleted' => $PRT_deleted), $PRT_ID )) {
1193
+			$PRT_ID = isset($this->_req_data['id']) ? absint($this->_req_data['id']) : 0;
1194
+			if (empty($PRT_ID) || ! $PRT->update_by_ID(array('PRT_deleted' => $PRT_deleted), $PRT_ID)) {
1195 1195
 				$success = 0;
1196 1196
 			}
1197 1197
 			$what = 'Price Type';
1198 1198
 
1199 1199
 		}
1200 1200
 
1201
-		$query_args = array( 'action' => 'price_types' );
1202
-		if ( $success ) {
1203
-			if ( $trash ) {
1201
+		$query_args = array('action' => 'price_types');
1202
+		if ($success) {
1203
+			if ($trash) {
1204 1204
 				$msg = $success > 1 ? __('The Price Types have been trashed.', 'event_espresso') : __('The Price Type has been trashed.', 'event_espresso');
1205 1205
 			} else {
1206 1206
 				$msg = $success > 1 ? __('The Price Types have been restored.', 'event_espresso') : __('The Price Type has been restored.', 'event_espresso');
1207 1207
 			}
1208
-			EE_Error::add_success( $msg );
1208
+			EE_Error::add_success($msg);
1209 1209
 		}
1210 1210
 
1211
-		$this->_redirect_after_action( FALSE, '', '', $query_args, TRUE );
1211
+		$this->_redirect_after_action(FALSE, '', '', $query_args, TRUE);
1212 1212
 
1213 1213
 	}
1214 1214
 
@@ -1225,19 +1225,19 @@  discard block
 block discarded – undo
1225 1225
 	protected function _delete_price_type() {
1226 1226
 
1227 1227
 		//echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>';
1228
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
1228
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1229 1229
 
1230 1230
 		$PRT = EEM_Price_Type::instance();
1231 1231
 
1232 1232
 		$success = 1;
1233 1233
 		//Checkboxes
1234
-		if (!empty($this->_req_data['checkbox'])) {
1234
+		if ( ! empty($this->_req_data['checkbox'])) {
1235 1235
 			// if array has more than one element than success message should be plural
1236
-			$success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1;
1236
+			$success = count($this->_req_data['checkbox']) > 1 ? 2 : 1;
1237 1237
 			$what = $PRT->item_name($success);
1238 1238
 			// cycle thru bulk action checkboxes
1239
-			while (list( $PRT_ID, $value ) = each($this->_req_data['checkbox'])) {
1240
-				if (!$PRT->delete_permanently_by_ID($PRT_ID) ) {
1239
+			while (list($PRT_ID, $value) = each($this->_req_data['checkbox'])) {
1240
+				if ( ! $PRT->delete_permanently_by_ID($PRT_ID)) {
1241 1241
 					$success = 0;
1242 1242
 				}
1243 1243
 			}
@@ -1245,8 +1245,8 @@  discard block
 block discarded – undo
1245 1245
 		}
1246 1246
 
1247 1247
 
1248
-		$query_args = array( 'action'=> 'price_types' );
1249
-		$this->_redirect_after_action( $success, $what, 'deleted', $query_args );
1248
+		$query_args = array('action'=> 'price_types');
1249
+		$this->_redirect_after_action($success, $what, 'deleted', $query_args);
1250 1250
 
1251 1251
 	}
1252 1252
 
@@ -1262,7 +1262,7 @@  discard block
 block discarded – undo
1262 1262
 	*		@return string
1263 1263
 	*/
1264 1264
 	protected function _learn_more_about_pricing_link() {
1265
-		return '<a class="hidden" style="margin:0 20px; cursor:pointer; font-size:12px;" >' . __('learn more about how pricing works', 'event_espresso') . '</a>';
1265
+		return '<a class="hidden" style="margin:0 20px; cursor:pointer; font-size:12px;" >'.__('learn more about how pricing works', 'event_espresso').'</a>';
1266 1266
 	}
1267 1267
 
1268 1268
 
Please login to merge, or discard this patch.
admin/extend/registrations/Extend_Registrations_Admin_Page.core.php 2 patches
Indentation   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -506,9 +506,9 @@  discard block
 block discarded – undo
506 506
 
507 507
 	/**
508 508
 	 * 		generates Business Reports regarding Registrations
509
-	*		@access protected
510
-	*		@return void
511
-	*/
509
+	 *		@access protected
510
+	 *		@return void
511
+	 */
512 512
 	protected function _registration_reports() {
513 513
 		$template_path = EE_ADMIN_TEMPLATE . 'admin_reports.template.php';
514 514
 		$this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, $this->_reports_template_data, true );
@@ -676,14 +676,14 @@  discard block
 block discarded – undo
676 676
 	protected function _registration_checkin_list_table() {
677 677
 		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
678 678
 		$reg_id = isset( $this->_req_data['_REGID'] ) ? $this->_req_data['_REGID'] : null;
679
-        /** @var EE_Registration $reg */
680
-        $reg = EEM_Registration::instance()->get_one_by_ID($reg_id);
679
+		/** @var EE_Registration $reg */
680
+		$reg = EEM_Registration::instance()->get_one_by_ID($reg_id);
681 681
 		$this->_admin_page_title .= $this->get_action_link_or_button(
682
-		    'new_registration',
683
-            'add-registrant',
684
-            array('event_id' => $reg->event_ID()),
685
-            'add-new-h2'
686
-        );
682
+			'new_registration',
683
+			'add-registrant',
684
+			array('event_id' => $reg->event_ID()),
685
+			'add-new-h2'
686
+		);
687 687
 
688 688
 		$legend_items = array(
689 689
 			'checkin' => array(
@@ -745,10 +745,10 @@  discard block
 block discarded – undo
745 745
 
746 746
 	/**
747 747
 	 * 		handles toggleing the checkin status for the registration,
748
-	*		@access protected
749
-	*		@param boolean 	$check_in
750
-	*		@return void
751
-	*/
748
+	 *		@access protected
749
+	 *		@param boolean 	$check_in
750
+	 *		@return void
751
+	 */
752 752
 	protected function _toggle_checkin_status() {
753 753
 		//first let's get the query args out of the way for the redirect
754 754
 		$query_args = array(
@@ -910,11 +910,11 @@  discard block
 block discarded – undo
910 910
 				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_approved,
911 911
 				'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_approved, FALSE, 'sentence' )
912 912
 				),
913
-            'cancelled_status' => array(
913
+			'cancelled_status' => array(
914 914
 				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_cancelled,
915 915
 				'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_cancelled, FALSE, 'sentence' )
916 916
 				),
917
-            'declined_status' => array(
917
+			'declined_status' => array(
918 918
 				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_declined,
919 919
 				'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_declined, FALSE, 'sentence' )
920 920
 				),
@@ -942,9 +942,9 @@  discard block
 block discarded – undo
942 942
 	/**
943 943
 	 * 		get_attendees
944 944
 	 * 		@param bool $count whether to return count or data.
945
-	*		@access public
946
-	*		@return array
947
-	*/
945
+	 *		@access public
946
+	 *		@return array
947
+	 */
948 948
 	public function get_event_attendees( $per_page = 10, $count = FALSE, $trash = FALSE, $orderby = '' ) {
949 949
 
950 950
 		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
Please login to merge, or discard this patch.
Spacing   +237 added lines, -237 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (!defined('EVENT_ESPRESSO_VERSION') )
2
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
3 3
 	exit('NO direct script access allowed');
4 4
 
5 5
 /**
@@ -37,20 +37,20 @@  discard block
 block discarded – undo
37 37
 	protected $_reports_template_data = array();
38 38
 
39 39
 
40
-	public function __construct( $routing = TRUE ) {
41
-		parent::__construct( $routing );
42
-		define( 'REG_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND . 'registrations/templates/');
43
-		define( 'REG_CAF_ASSETS', EE_CORE_CAF_ADMIN_EXTEND . 'registrations/assets/');
44
-		define( 'REG_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL . 'registrations/assets/');
40
+	public function __construct($routing = TRUE) {
41
+		parent::__construct($routing);
42
+		define('REG_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND.'registrations/templates/');
43
+		define('REG_CAF_ASSETS', EE_CORE_CAF_ADMIN_EXTEND.'registrations/assets/');
44
+		define('REG_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL.'registrations/assets/');
45 45
 	}
46 46
 
47 47
 
48 48
 	protected function _extend_page_config() {
49
-		$this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND . 'registrations';
49
+		$this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND.'registrations';
50 50
 
51
-		$reg_id = ! empty( $this->_req_data['_REG_ID'] ) && ! is_array( $this->_req_data['_REG_ID'] ) ? $this->_req_data['_REG_ID'] : 0;
52
-		$att_id = ! empty( $this->_req_data[ 'ATT_ID' ] ) ? ! is_array( $this->_req_data['ATT_ID'] ) : 0;
53
-		$att_id = ! empty( $this->_req_data['post'] ) && ! is_array( $this->_req_data['post'] ) ? $this->_req_data['post'] : $att_id;
51
+		$reg_id = ! empty($this->_req_data['_REG_ID']) && ! is_array($this->_req_data['_REG_ID']) ? $this->_req_data['_REG_ID'] : 0;
52
+		$att_id = ! empty($this->_req_data['ATT_ID']) ? ! is_array($this->_req_data['ATT_ID']) : 0;
53
+		$att_id = ! empty($this->_req_data['post']) && ! is_array($this->_req_data['post']) ? $this->_req_data['post'] : $att_id;
54 54
 
55 55
 		$new_page_routes = array(
56 56
 			'reports' => array(
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
 				)
90 90
 			);
91 91
 
92
-		$this->_page_routes = array_merge( $this->_page_routes, $new_page_routes );
92
+		$this->_page_routes = array_merge($this->_page_routes, $new_page_routes);
93 93
 
94 94
 		$new_page_config = array(
95 95
 			'reports' => array(
@@ -134,8 +134,8 @@  discard block
 block discarded – undo
134 134
 						'filename' => 'registrations_event_checkin_other'
135 135
 					)
136 136
 				),
137
-				'help_tour' => array( 'Event_Checkin_Help_Tour' ),
138
-				'qtips' => array('Registration_List_Table_Tips' ),
137
+				'help_tour' => array('Event_Checkin_Help_Tour'),
138
+				'qtips' => array('Registration_List_Table_Tips'),
139 139
 				'list_table' => 'EE_Event_Registrations_List_Table',
140 140
 				'metaboxes' => array(),
141 141
 				'require_nonce' => FALSE
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
 				),
154 154
 			);
155 155
 
156
-		$this->_page_config = array_merge( $this->_page_config, $new_page_config );
156
+		$this->_page_config = array_merge($this->_page_config, $new_page_config);
157 157
 		$this->_page_config['contact_list']['list_table'] = 'Extend_EE_Attendee_Contact_List_Table';
158 158
 		$this->_page_config['default']['list_table'] = 'Extend_EE_Registrations_List_Table';
159 159
 	}
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
 
163 163
 	protected function _ajax_hooks() {
164 164
 		parent::_ajax_hooks();
165
-		add_action( 'wp_ajax_get_newsletter_form_content', array( $this, 'get_newsletter_form_content' ) );
165
+		add_action('wp_ajax_get_newsletter_form_content', array($this, 'get_newsletter_form_content'));
166 166
 	}
167 167
 
168 168
 
@@ -171,20 +171,20 @@  discard block
 block discarded – undo
171 171
 		parent::load_scripts_styles();
172 172
 
173 173
 		//if newsletter message type is active then let's add filter and load js for it.
174
-		if ( EEH_MSG_Template::is_mt_active('newsletter') ) {
174
+		if (EEH_MSG_Template::is_mt_active('newsletter')) {
175 175
 			//enqueue newsletter js
176
-			wp_enqueue_script( 'ee-newsletter-trigger', REG_CAF_ASSETS_URL . 'ee-newsletter-trigger.js', array( 'ee-dialog' ), EVENT_ESPRESSO_VERSION, TRUE );
177
-			wp_enqueue_style( 'ee-newsletter-trigger-css', REG_CAF_ASSETS_URL . 'ee-newsletter-trigger.css', array(), EVENT_ESPRESSO_VERSION );
176
+			wp_enqueue_script('ee-newsletter-trigger', REG_CAF_ASSETS_URL.'ee-newsletter-trigger.js', array('ee-dialog'), EVENT_ESPRESSO_VERSION, TRUE);
177
+			wp_enqueue_style('ee-newsletter-trigger-css', REG_CAF_ASSETS_URL.'ee-newsletter-trigger.css', array(), EVENT_ESPRESSO_VERSION);
178 178
 			//hook in buttons for newsletter message type trigger.
179
-			add_action('AHEE__EE_Admin_List_Table__extra_tablenav__after_bottom_buttons', array( $this, 'add_newsletter_action_buttons'), 10 );
179
+			add_action('AHEE__EE_Admin_List_Table__extra_tablenav__after_bottom_buttons', array($this, 'add_newsletter_action_buttons'), 10);
180 180
 		}
181 181
 	}
182 182
 
183 183
 
184 184
 
185 185
 	public function load_scripts_styles_reports() {
186
-		wp_register_script( 'ee-reg-reports-js', REG_CAF_ASSETS_URL . 'ee-registration-admin-reports.js', array( 'google-charts' ), EVENT_ESPRESSO_VERSION, true );
187
-		wp_enqueue_script( 'ee-reg-reports-js' );
186
+		wp_register_script('ee-reg-reports-js', REG_CAF_ASSETS_URL.'ee-registration-admin-reports.js', array('google-charts'), EVENT_ESPRESSO_VERSION, true);
187
+		wp_enqueue_script('ee-reg-reports-js');
188 188
 		$this->_registration_reports_js_setup();
189 189
 	}
190 190
 
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
 				'slug' => 'all',
217 217
 				'label' => __('All', 'event_espresso'),
218 218
 				'count' => 0,
219
-				'bulk_action' => !isset( $this->_req_data['event_id'] ) ? array() : array(
219
+				'bulk_action' => ! isset($this->_req_data['event_id']) ? array() : array(
220 220
 					'toggle_checkin_status' => __('Toggle Check-In', 'event_espresso'),
221 221
 					//'trash_registrations' => __('Trash Registrations', 'event_espresso')
222 222
 					)
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
 				'slug' => 'all',
235 235
 				'label' => __('All', 'event_espresso'),
236 236
 				'count' => 0,
237
-				'bulk_action' => array( 'delete_checkin_rows' => __('Delete Check-In Rows', 'event_espresso') )
237
+				'bulk_action' => array('delete_checkin_rows' => __('Delete Check-In Rows', 'event_espresso'))
238 238
 				),
239 239
 			);
240 240
 	}
@@ -250,20 +250,20 @@  discard block
 block discarded – undo
250 250
 	 */
251 251
 	public function get_newsletter_form_content() {
252 252
 		//do a nonce check cause we're not coming in from an normal route here.
253
-		$nonce = isset( $this->_req_data['get_newsletter_form_content_nonce'] ) ? sanitize_text_field( $this->_req_data['get_newsletter_form_content_nonce'] ) : '';
253
+		$nonce = isset($this->_req_data['get_newsletter_form_content_nonce']) ? sanitize_text_field($this->_req_data['get_newsletter_form_content_nonce']) : '';
254 254
 		$nonce_ref = 'get_newsletter_form_content_nonce';
255 255
 
256
-		$this->_verify_nonce( $nonce, $nonce_ref );
256
+		$this->_verify_nonce($nonce, $nonce_ref);
257 257
 		//let's get the mtp for the incoming MTP_ ID
258
-		if ( !isset( $this->_req_data['GRP_ID'] ) ) {
259
-			EE_Error::add_error( __('There must be something broken with the js or html structure because the required data for getting a message template group is not present (need an GRP_ID).', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
258
+		if ( ! isset($this->_req_data['GRP_ID'])) {
259
+			EE_Error::add_error(__('There must be something broken with the js or html structure because the required data for getting a message template group is not present (need an GRP_ID).', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
260 260
 			$this->_template_args['success'] = FALSE;
261 261
 			$this->_template_args['error'] = TRUE;
262 262
 			$this->_return_json();
263 263
 		}
264
-		$MTPG = EEM_Message_Template_Group::instance()->get_one_by_ID( $this->_req_data['GRP_ID'] );
265
-		if ( ! $MTPG instanceof EE_Message_Template_Group ) {
266
-			EE_Error::add_error( sprintf( __('The GRP_ID given (%d) does not appear to have a corresponding row in the database.', 'event_espresso'), $this->_req_data['GRP_ID'] ), __FILE__, __FUNCTION__, __LINE__  );
264
+		$MTPG = EEM_Message_Template_Group::instance()->get_one_by_ID($this->_req_data['GRP_ID']);
265
+		if ( ! $MTPG instanceof EE_Message_Template_Group) {
266
+			EE_Error::add_error(sprintf(__('The GRP_ID given (%d) does not appear to have a corresponding row in the database.', 'event_espresso'), $this->_req_data['GRP_ID']), __FILE__, __FUNCTION__, __LINE__);
267 267
 			$this->_template_args['success'] = FALSE;
268 268
 			$this->_template_args['error'] = TRUE;
269 269
 			$this->_return_json();
@@ -272,11 +272,11 @@  discard block
 block discarded – undo
272 272
 		$MTPs = $MTPG->context_templates();
273 273
 		$MTPs = $MTPs['attendee'];
274 274
 		$template_fields = array();
275
-		foreach ( $MTPs as $MTP ) {
275
+		foreach ($MTPs as $MTP) {
276 276
 			$field = $MTP->get('MTP_template_field');
277
-			if ( $field == 'content'  ) {
277
+			if ($field == 'content') {
278 278
 				$content = $MTP->get('MTP_content');
279
-				if ( !empty( $content['newsletter_content'] ) ) {
279
+				if ( ! empty($content['newsletter_content'])) {
280 280
 					$template_fields['newsletter_content'] = $content['newsletter_content'];
281 281
 					}
282 282
 				continue;
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
 		$this->_template_args['data'] = array(
290 290
 			'batch_message_from' => isset($template_fields['from']) ? $template_fields['from'] : '',
291 291
 			'batch_message_subject' => isset($template_fields['subject']) ? $template_fields['subject'] : '',
292
-			'batch_message_content' => isset( $template_fields['newsletter_content'] ) ? $template_fields['newsletter_content'] : ''
292
+			'batch_message_content' => isset($template_fields['newsletter_content']) ? $template_fields['newsletter_content'] : ''
293 293
 			);
294 294
 		$this->_return_json();
295 295
 	}
@@ -305,8 +305,8 @@  discard block
 block discarded – undo
305 305
 	 * @param EE_Admin_List_Table $list_table
306 306
 	 * @return string html string for extra buttons
307 307
 	 */
308
-	public function add_newsletter_action_buttons( EE_Admin_List_Table $list_table ) {
309
-		if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_registrations_newsletter_selected_send' ) ) {
308
+	public function add_newsletter_action_buttons(EE_Admin_List_Table $list_table) {
309
+		if ( ! EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_registrations_newsletter_selected_send')) {
310 310
 			return '';
311 311
 		}
312 312
 
@@ -315,13 +315,13 @@  discard block
 block discarded – undo
315 315
 			'event_registrations',
316 316
 			'default'
317 317
 			);
318
-		if ( $this->_current_page == 'espresso_registrations' && in_array( $this->_req_action, $routes_to_add_to )  ) {
319
-			if ( ( $this->_req_action == 'event_registrations' && empty( $this->_req_data['event_id'] ) ) || ( isset( $this->_req_data['status'] ) && $this->_req_data['status'] == 'trash' ) ) {
318
+		if ($this->_current_page == 'espresso_registrations' && in_array($this->_req_action, $routes_to_add_to)) {
319
+			if (($this->_req_action == 'event_registrations' && empty($this->_req_data['event_id'])) || (isset($this->_req_data['status']) && $this->_req_data['status'] == 'trash')) {
320 320
 				echo '';
321 321
 			} else {
322
-				$button_text = sprintf( __('Send Batch Message (%s selected)', 'event_espresso'), '<span class="send-selected-newsletter-count">0</span>' );
323
-				echo '<button id="selected-batch-send-trigger" class="button secondary-button"><span class="dashicons dashicons-email "></span>' . $button_text . '</button>';
324
-				add_action('admin_footer', array( $this, 'newsletter_send_form_skeleton') );
322
+				$button_text = sprintf(__('Send Batch Message (%s selected)', 'event_espresso'), '<span class="send-selected-newsletter-count">0</span>');
323
+				echo '<button id="selected-batch-send-trigger" class="button secondary-button"><span class="dashicons dashicons-email "></span>'.$button_text.'</button>';
324
+				add_action('admin_footer', array($this, 'newsletter_send_form_skeleton'));
325 325
 			}
326 326
 		}
327 327
 	}
@@ -333,37 +333,37 @@  discard block
 block discarded – undo
333 333
 		$list_table = $this->_list_table_object;
334 334
 		$codes = array();
335 335
 		//need to templates for the newsletter message type for the template selector.
336
-		$values[] = array( 'text' => __('Select Template to Use', 'event_espresso'), 'id' => 0 );
337
-		$mtps = EEM_Message_Template_Group::instance()->get_all( array( array( 'MTP_message_type' => 'newsletter', 'MTP_messenger' => 'email' ) ) );
338
-		foreach ( $mtps as $mtp ) {
336
+		$values[] = array('text' => __('Select Template to Use', 'event_espresso'), 'id' => 0);
337
+		$mtps = EEM_Message_Template_Group::instance()->get_all(array(array('MTP_message_type' => 'newsletter', 'MTP_messenger' => 'email')));
338
+		foreach ($mtps as $mtp) {
339 339
 			$name = $mtp->name();
340 340
 			$values[] = array(
341
-				'text' => empty( $name ) ? __('Global', 'event_espresso') : $name,
341
+				'text' => empty($name) ? __('Global', 'event_espresso') : $name,
342 342
 				'id' => $mtp->ID()
343 343
 				);
344 344
 		}
345 345
 
346 346
 		//need to get a list of shortcodes that are available for the newsletter message type.
347
-		$shortcodes = EEH_MSG_Template::get_shortcodes( 'newsletter', 'email', array(), 'attendee', FALSE );
348
-		foreach ( $shortcodes as $field => $shortcode_array ) {
349
-			$codes[$field] = implode(', ', array_keys($shortcode_array ) );
347
+		$shortcodes = EEH_MSG_Template::get_shortcodes('newsletter', 'email', array(), 'attendee', FALSE);
348
+		foreach ($shortcodes as $field => $shortcode_array) {
349
+			$codes[$field] = implode(', ', array_keys($shortcode_array));
350 350
 		}
351 351
 
352 352
 		$shortcodes = $codes;
353 353
 
354
-		$form_template = REG_CAF_TEMPLATE_PATH . 'newsletter-send-form.template.php';
354
+		$form_template = REG_CAF_TEMPLATE_PATH.'newsletter-send-form.template.php';
355 355
 		$form_template_args = array(
356 356
 			'form_action' => admin_url('admin.php?page=espresso_registrations'),
357 357
 			'form_route' => 'newsletter_selected_send',
358 358
 			'form_nonce_name' => 'newsletter_selected_send_nonce',
359
-			'form_nonce' => wp_create_nonce( 'newsletter_selected_send_nonce' ),
359
+			'form_nonce' => wp_create_nonce('newsletter_selected_send_nonce'),
360 360
 			'redirect_back_to' => $this->_req_action,
361
-			'ajax_nonce' => wp_create_nonce( 'get_newsletter_form_content_nonce'),
362
-			'template_selector' => EEH_Form_Fields::select_input('newsletter_mtp_selected', $values ),
361
+			'ajax_nonce' => wp_create_nonce('get_newsletter_form_content_nonce'),
362
+			'template_selector' => EEH_Form_Fields::select_input('newsletter_mtp_selected', $values),
363 363
 			'shortcodes' => $shortcodes,
364 364
 			'id_type' => $list_table instanceof EE_Attendee_Contact_List_Table ? 'contact' : 'registration'
365 365
 			);
366
-		EEH_Template::display_template( $form_template, $form_template_args );
366
+		EEH_Template::display_template($form_template, $form_template_args);
367 367
 	}
368 368
 
369 369
 
@@ -378,7 +378,7 @@  discard block
 block discarded – undo
378 378
 	protected function _newsletter_selected_send() {
379 379
 		$success = TRUE;
380 380
 		//first we need to make sure we have a GRP_ID so we know what template we're sending and updating!
381
-		if ( empty( $this->_req_data['newsletter_mtp_selected'] ) ) {
381
+		if (empty($this->_req_data['newsletter_mtp_selected'])) {
382 382
 			EE_Error::add_error(
383 383
 				__(
384 384
 					'In order to send a message, a Message Template GRP_ID is needed. It was not provided so messages were not sent.',
@@ -389,7 +389,7 @@  discard block
 block discarded – undo
389 389
 			$success = FALSE;
390 390
 		}
391 391
 
392
-		if ( $success ) {
392
+		if ($success) {
393 393
 			//update Message template in case there are any changes
394 394
 			$Message_Template_Group = EEM_Message_Template_Group::instance()->get_one_by_ID(
395 395
 				$this->_req_data['newsletter_mtp_selected']
@@ -397,7 +397,7 @@  discard block
 block discarded – undo
397 397
 			$Message_Templates = $Message_Template_Group instanceof EE_Message_Template_Group
398 398
 				? $Message_Template_Group->context_templates()
399 399
 				: array();
400
-			if ( empty( $Message_Templates ) ) {
400
+			if (empty($Message_Templates)) {
401 401
 				EE_Error::add_error(
402 402
 					__(
403 403
 						'Unable to retrieve message template fields from the db. Messages not sent.',
@@ -408,25 +408,25 @@  discard block
 block discarded – undo
408 408
 			}
409 409
 
410 410
 			//let's just update the specific fields
411
-			foreach ( $Message_Templates['attendee'] as $Message_Template ) {
412
-				if ( $Message_Template instanceof EE_Message_Template ) {
413
-					$field = $Message_Template->get( 'MTP_template_field' );
414
-					$content = $Message_Template->get( 'MTP_content' );
411
+			foreach ($Message_Templates['attendee'] as $Message_Template) {
412
+				if ($Message_Template instanceof EE_Message_Template) {
413
+					$field = $Message_Template->get('MTP_template_field');
414
+					$content = $Message_Template->get('MTP_content');
415 415
 					$new_content = $content;
416
-					switch ( $field ) {
416
+					switch ($field) {
417 417
 						case 'from' :
418
-							$new_content = ! empty( $this->_req_data['batch_message']['from'] )
418
+							$new_content = ! empty($this->_req_data['batch_message']['from'])
419 419
 								? $this->_req_data['batch_message']['from']
420 420
 								: $content;
421 421
 							break;
422 422
 						case 'subject' :
423
-							$new_content = ! empty( $this->_req_data['batch_message']['subject'] )
423
+							$new_content = ! empty($this->_req_data['batch_message']['subject'])
424 424
 								? $this->_req_data['batch_message']['subject']
425 425
 								: $content;
426 426
 							break;
427 427
 						case 'content' :
428 428
 							$new_content = $content;
429
-							$new_content['newsletter_content'] = ! empty( $this->_req_data['batch_message']['content'] )
429
+							$new_content['newsletter_content'] = ! empty($this->_req_data['batch_message']['content'])
430 430
 								? $this->_req_data['batch_message']['content']
431 431
 								: $content['newsletter_content'];
432 432
 							break;
@@ -434,35 +434,35 @@  discard block
 block discarded – undo
434 434
 							continue;
435 435
 							break;
436 436
 					}
437
-					$Message_Template->set( 'MTP_content', $new_content );
437
+					$Message_Template->set('MTP_content', $new_content);
438 438
 					$Message_Template->save();
439 439
 				}
440 440
 			}
441 441
 
442 442
 			//great fields are updated!  now let's make sure we just have contact objects (EE_Attendee).
443
-			$id_type = ! empty( $this->_req_data['batch_message']['id_type'] )
443
+			$id_type = ! empty($this->_req_data['batch_message']['id_type'])
444 444
 				? $this->_req_data['batch_message']['id_type']
445 445
 				: 'registration';
446 446
 
447 447
 			//id_type will affect how we assemble the ids.
448
-			$ids = ! empty( $this->_req_data['batch_message']['ids'] )
449
-				? json_decode( stripslashes($this->_req_data['batch_message']['ids']) )
448
+			$ids = ! empty($this->_req_data['batch_message']['ids'])
449
+				? json_decode(stripslashes($this->_req_data['batch_message']['ids']))
450 450
 				: array();
451 451
 
452 452
 			$registrations_used_for_contact_data = array();
453 453
 			//using switch because eventually we'll have other contexts that will be used for generating messages.
454
-			switch ( $id_type ) {
454
+			switch ($id_type) {
455 455
 				case 'registration' :
456 456
 					$registrations_used_for_contact_data = EEM_Registration::instance()->get_all(
457 457
 						array(
458 458
 							array(
459
-								'REG_ID' => array( 'IN', $ids )
459
+								'REG_ID' => array('IN', $ids)
460 460
 							)
461 461
 						)
462 462
 					);
463 463
 					break;
464 464
 				case 'contact' :
465
-					$registrations_used_for_contact_data = EEM_Registration::instance()->get_latest_registration_for_each_of_given_contacts( $ids );
465
+					$registrations_used_for_contact_data = EEM_Registration::instance()->get_latest_registration_for_each_of_given_contacts($ids);
466 466
 					break;
467 467
 			}
468 468
 			do_action(
@@ -473,8 +473,8 @@  discard block
 block discarded – undo
473 473
 			//kept for backward compat, internally we no longer use this action.
474 474
 			//@deprecated 4.8.36.rc.002
475 475
 			$contacts = $id_type == 'registration'
476
-				? EEM_Attendee::instance()->get_array_of_contacts_from_reg_ids( $ids )
477
-				: EEM_Attendee::instance()->get_all( array( array( 'ATT_ID' => array('in', $ids ) ) ) );
476
+				? EEM_Attendee::instance()->get_array_of_contacts_from_reg_ids($ids)
477
+				: EEM_Attendee::instance()->get_all(array(array('ATT_ID' => array('in', $ids))));
478 478
 			do_action(
479 479
 				'AHEE__Extend_Registrations_Admin_Page___newsletter_selected_send',
480 480
 				$contacts,
@@ -482,11 +482,11 @@  discard block
 block discarded – undo
482 482
 			);
483 483
 		}
484 484
 		$query_args = array(
485
-			'action' => !empty( $this->_req_data['redirect_back_to'] )
485
+			'action' => ! empty($this->_req_data['redirect_back_to'])
486 486
 				? $this->_req_data['redirect_back_to']
487 487
 				: 'default'
488 488
 			);
489
-		$this->_redirect_after_action( FALSE, '', '', $query_args, TRUE );
489
+		$this->_redirect_after_action(FALSE, '', '', $query_args, TRUE);
490 490
 	}
491 491
 
492 492
 
@@ -508,8 +508,8 @@  discard block
 block discarded – undo
508 508
 	*		@return void
509 509
 	*/
510 510
 	protected function _registration_reports() {
511
-		$template_path = EE_ADMIN_TEMPLATE . 'admin_reports.template.php';
512
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, $this->_reports_template_data, true );
511
+		$template_path = EE_ADMIN_TEMPLATE.'admin_reports.template.php';
512
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, $this->_reports_template_data, true);
513 513
 		// the final template wrapper
514 514
 		$this->display_admin_page_with_no_sidebar();
515 515
 
@@ -522,28 +522,28 @@  discard block
 block discarded – undo
522 522
 	 *
523 523
 	 * @return string
524 524
 	 */
525
-	private function _registrations_per_day_report( $period = '-1 month' ) {
525
+	private function _registrations_per_day_report($period = '-1 month') {
526 526
 		$report_ID = 'reg-admin-registrations-per-day-report-dv';
527 527
 
528
-		$results = EEM_Registration::instance()->get_registrations_per_day_and_per_status_report( $period );
528
+		$results = EEM_Registration::instance()->get_registrations_per_day_and_per_status_report($period);
529 529
 
530 530
 		$results = (array) $results;
531 531
 		$regs = array();
532 532
 		$subtitle = '';
533 533
 
534
-		if( $results ) {
534
+		if ($results) {
535 535
 			$column_titles = array();
536 536
 			$tracker = 0;
537
-			foreach ( $results as $result ) {
537
+			foreach ($results as $result) {
538 538
 				$report_column_values = array();
539
-				foreach( $result as $property_name => $property_value ) {
539
+				foreach ($result as $property_name => $property_value) {
540 540
 					$property_value = $property_name == 'Registration_REG_date' ? $property_value : (int) $property_value;
541 541
 					$report_column_values[] = $property_value;
542
-					if ( $tracker === 0 ) {
543
-						if ( $property_name == 'Registration_REG_date' ) {
544
-							$column_titles[] = __( 'Date (only days with registrations are shown)', 'event_espresso' );
542
+					if ($tracker === 0) {
543
+						if ($property_name == 'Registration_REG_date') {
544
+							$column_titles[] = __('Date (only days with registrations are shown)', 'event_espresso');
545 545
 						} else {
546
-							$column_titles[] = EEH_Template::pretty_status( $property_name, false, 'sentence' );
546
+							$column_titles[] = EEH_Template::pretty_status($property_name, false, 'sentence');
547 547
 						}
548 548
 					}
549 549
 				}
@@ -552,36 +552,36 @@  discard block
 block discarded – undo
552 552
 			}
553 553
 
554 554
 			//make sure the column_titles is pushed to the beginning of the array
555
-			array_unshift( $regs, $column_titles );
555
+			array_unshift($regs, $column_titles);
556 556
 			//setup the date range.
557
-			$DateTimeZone = new DateTimeZone( EEH_DTT_Helper::get_timezone() );
558
-			$beginning_date = new DateTime( "now " . $period, $DateTimeZone );
559
-			$ending_date = new DateTime( "now", $DateTimeZone );
557
+			$DateTimeZone = new DateTimeZone(EEH_DTT_Helper::get_timezone());
558
+			$beginning_date = new DateTime("now ".$period, $DateTimeZone);
559
+			$ending_date = new DateTime("now", $DateTimeZone);
560 560
 			$subtitle = sprintf(
561
-				_x( 'For the period: %1$s to %2$s', 'Used to give date range', 'event_espresso' ),
562
-				$beginning_date->format( 'Y-m-d' ),
563
-				$ending_date->format( 'Y-m-d' )
561
+				_x('For the period: %1$s to %2$s', 'Used to give date range', 'event_espresso'),
562
+				$beginning_date->format('Y-m-d'),
563
+				$ending_date->format('Y-m-d')
564 564
 			);
565 565
 		}
566 566
 
567
-		$report_title = __( 'Total Registrations per Day', 'event_espresso' );
567
+		$report_title = __('Total Registrations per Day', 'event_espresso');
568 568
 
569 569
 		$report_params = array(
570 570
 			'title' 	=> $report_title,
571 571
 			'subtitle' => $subtitle,
572 572
 			'id' 		=> $report_ID,
573 573
 			'regs' 	=> $regs,
574
-			'noResults' => empty( $regs ),
574
+			'noResults' => empty($regs),
575 575
 			'noRegsMsg' => sprintf(
576 576
 				__(
577 577
 					'%sThere are currently no registration records in the last month for this report.%s',
578 578
 					'event_espresso'
579 579
 				),
580
-				'<h2>' . $report_title . '</h2><p>',
580
+				'<h2>'.$report_title.'</h2><p>',
581 581
 				'</p>'
582 582
 			),
583 583
 		);
584
-		wp_localize_script( 'ee-reg-reports-js', 'regPerDay', $report_params );
584
+		wp_localize_script('ee-reg-reports-js', 'regPerDay', $report_params);
585 585
 
586 586
 		return $report_ID;
587 587
 	}
@@ -593,29 +593,29 @@  discard block
 block discarded – undo
593 593
 	 *
594 594
 	 * @return string
595 595
 	 */
596
-	private function _registrations_per_event_report( $period = '-1 month' ) {
596
+	private function _registrations_per_event_report($period = '-1 month') {
597 597
 
598 598
 		$report_ID = 'reg-admin-registrations-per-event-report-dv';
599 599
 
600
-		$results = EEM_Registration::instance()->get_registrations_per_event_and_per_status_report( $period );
600
+		$results = EEM_Registration::instance()->get_registrations_per_event_and_per_status_report($period);
601 601
 
602 602
 		$results = (array) $results;
603 603
 		$regs = array();
604 604
 		$subtitle = '';
605 605
 
606
-		if ( $results ) {
606
+		if ($results) {
607 607
 			$column_titles = array();
608 608
 			$tracker = 0;
609
-			foreach ( $results as $result ) {
609
+			foreach ($results as $result) {
610 610
 				$report_column_values = array();
611
-				foreach( $result as $property_name => $property_value ) {
612
-					$property_value = $property_name == 'Registration_Event' ? wp_trim_words( $property_value, 4, '...' ) : (int) $property_value;
611
+				foreach ($result as $property_name => $property_value) {
612
+					$property_value = $property_name == 'Registration_Event' ? wp_trim_words($property_value, 4, '...') : (int) $property_value;
613 613
 					$report_column_values[] = $property_value;
614
-					if ( $tracker === 0 ) {
615
-						if ( $property_name == 'Registration_Event' ) {
616
-							$column_titles[] = __( 'Event', 'event_espresso' );
614
+					if ($tracker === 0) {
615
+						if ($property_name == 'Registration_Event') {
616
+							$column_titles[] = __('Event', 'event_espresso');
617 617
 						} else {
618
-							$column_titles[] = EEH_Template::pretty_status( $property_name, false, 'sentence' );
618
+							$column_titles[] = EEH_Template::pretty_status($property_name, false, 'sentence');
619 619
 						}
620 620
 					}
621 621
 				}
@@ -624,37 +624,37 @@  discard block
 block discarded – undo
624 624
 			}
625 625
 
626 626
 			//make sure the column_titles is pushed to the beginning of the array
627
-			array_unshift( $regs, $column_titles );
627
+			array_unshift($regs, $column_titles);
628 628
 
629 629
 			//setup the date range.
630
-			$DateTimeZone = new DateTimeZone( EEH_DTT_Helper::get_timezone() );
631
-			$beginning_date = new DateTime( "now " . $period, $DateTimeZone );
632
-			$ending_date = new DateTime( "now", $DateTimeZone );
630
+			$DateTimeZone = new DateTimeZone(EEH_DTT_Helper::get_timezone());
631
+			$beginning_date = new DateTime("now ".$period, $DateTimeZone);
632
+			$ending_date = new DateTime("now", $DateTimeZone);
633 633
 			$subtitle = sprintf(
634
-				_x( 'For the period: %1$s to %2$s', 'Used to give date range', 'event_espresso' ),
635
-				$beginning_date->format( 'Y-m-d' ),
636
-				$ending_date->format( 'Y-m-d' )
634
+				_x('For the period: %1$s to %2$s', 'Used to give date range', 'event_espresso'),
635
+				$beginning_date->format('Y-m-d'),
636
+				$ending_date->format('Y-m-d')
637 637
 			);
638 638
 		}
639 639
 
640
-		$report_title = __( 'Total Registrations per Event', 'event_espresso' );
640
+		$report_title = __('Total Registrations per Event', 'event_espresso');
641 641
 
642 642
 		$report_params = array(
643 643
 			'title' 	=> $report_title,
644 644
 			'subtitle' => $subtitle,
645 645
 			'id' 		=> $report_ID,
646 646
 			'regs' 	=> $regs,
647
-			'noResults' => empty( $regs ),
647
+			'noResults' => empty($regs),
648 648
 			'noRegsMsg' => sprintf(
649 649
 				__(
650 650
 					'%sThere are currently no registration records in the last month for this report.%s',
651 651
 					'event_espresso'
652 652
 				),
653
-				'<h2>' . $report_title . '</h2><p>',
653
+				'<h2>'.$report_title.'</h2><p>',
654 654
 				'</p>'
655 655
 			),
656 656
 		);
657
-		wp_localize_script( 'ee-reg-reports-js', 'regPerEvent', $report_params );
657
+		wp_localize_script('ee-reg-reports-js', 'regPerEvent', $report_params);
658 658
 
659 659
 		return $report_ID;
660 660
 	}
@@ -668,8 +668,8 @@  discard block
 block discarded – undo
668 668
 	 * @return void
669 669
 	 */
670 670
 	protected function _registration_checkin_list_table() {
671
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
672
-		$reg_id = isset( $this->_req_data['_REGID'] ) ? $this->_req_data['_REGID'] : null;
671
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
672
+		$reg_id = isset($this->_req_data['_REGID']) ? $this->_req_data['_REGID'] : null;
673 673
         /** @var EE_Registration $reg */
674 674
         $reg = EEM_Registration::instance()->get_one_by_ID($reg_id);
675 675
 		$this->_admin_page_title .= $this->get_action_link_or_button(
@@ -689,15 +689,15 @@  discard block
 block discarded – undo
689 689
 				'desc' => __('This indicates the attendee has been checked out', 'event_espresso')
690 690
 				)
691 691
 			);
692
-		$this->_template_args['after_list_table'] = $this->_display_legend( $legend_items );
692
+		$this->_template_args['after_list_table'] = $this->_display_legend($legend_items);
693 693
 
694 694
 
695
-		$dtt_id = isset(  $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : NULL;
696
-		$go_back_url = !empty( $reg_id )  ? EE_Admin_Page::add_query_args_and_nonce(array('action' => 'event_registrations', 'event_id' => EEM_Registration::instance()->get_one_by_ID($reg_id)->get_first_related('Event')->ID(), 'DTT_ID' => $dtt_id ), $this->_admin_base_url ) : '';
695
+		$dtt_id = isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : NULL;
696
+		$go_back_url = ! empty($reg_id) ? EE_Admin_Page::add_query_args_and_nonce(array('action' => 'event_registrations', 'event_id' => EEM_Registration::instance()->get_one_by_ID($reg_id)->get_first_related('Event')->ID(), 'DTT_ID' => $dtt_id), $this->_admin_base_url) : '';
697 697
 
698
-		$this->_template_args['before_list_table'] = !empty( $reg_id ) && !empty( $dtt_id ) ? '<h2>' . sprintf(__("%s's check in records for %s at the event, %s", 'event_espresso'), '<span id="checkin-attendee-name">' . EEM_Registration::instance()->get_one_by_ID($reg_id)->get_first_related('Attendee')->full_name() . '</span>', '<span id="checkin-dtt"><a href="' . $go_back_url . '">' . EEM_Datetime::instance()->get_one_by_ID($dtt_id)->start_date_and_time() . ' - ' . EEM_Datetime::instance()->get_one_by_ID($dtt_id)->end_date_and_time() . '</a></span>', '<span id="checkin-event-name">' . EEM_Datetime::instance()->get_one_by_ID($dtt_id)->get_first_related('Event')->get('EVT_name') . '</span>' ) . '</h2>' : '';
699
-		$this->_template_args['list_table_hidden_fields'] = !empty( $reg_id ) ? '<input type="hidden" name="_REGID" value="' . $reg_id . '">' : '';
700
-		$this->_template_args['list_table_hidden_fields'] .= !empty( $dtt_id ) ? '<input type="hidden" name="DTT_ID" value="' . $dtt_id . '">' : '';
698
+		$this->_template_args['before_list_table'] = ! empty($reg_id) && ! empty($dtt_id) ? '<h2>'.sprintf(__("%s's check in records for %s at the event, %s", 'event_espresso'), '<span id="checkin-attendee-name">'.EEM_Registration::instance()->get_one_by_ID($reg_id)->get_first_related('Attendee')->full_name().'</span>', '<span id="checkin-dtt"><a href="'.$go_back_url.'">'.EEM_Datetime::instance()->get_one_by_ID($dtt_id)->start_date_and_time().' - '.EEM_Datetime::instance()->get_one_by_ID($dtt_id)->end_date_and_time().'</a></span>', '<span id="checkin-event-name">'.EEM_Datetime::instance()->get_one_by_ID($dtt_id)->get_first_related('Event')->get('EVT_name').'</span>').'</h2>' : '';
699
+		$this->_template_args['list_table_hidden_fields'] = ! empty($reg_id) ? '<input type="hidden" name="_REGID" value="'.$reg_id.'">' : '';
700
+		$this->_template_args['list_table_hidden_fields'] .= ! empty($dtt_id) ? '<input type="hidden" name="DTT_ID" value="'.$dtt_id.'">' : '';
701 701
 
702 702
 		$this->display_admin_list_table_page_with_no_sidebar();
703 703
 	}
@@ -710,24 +710,24 @@  discard block
 block discarded – undo
710 710
 	 */
711 711
 	public function toggle_checkin_status() {
712 712
 		//first make sure we have the necessary data
713
-		if ( !isset( $this->_req_data['_regid'] ) ) {
714
-			EE_Error::add_error( __('There must be something broken with the html structure because the required data for toggling the Check-in status is not being sent via ajax', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
713
+		if ( ! isset($this->_req_data['_regid'])) {
714
+			EE_Error::add_error(__('There must be something broken with the html structure because the required data for toggling the Check-in status is not being sent via ajax', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
715 715
 			$this->_template_args['success'] = FALSE;
716 716
 			$this->_template_args['error'] = TRUE;
717 717
 			$this->_return_json();
718 718
 		};
719 719
 
720 720
 		//do a nonce check cause we're not coming in from an normal route here.
721
-		$nonce = isset( $this->_req_data['checkinnonce'] ) ? sanitize_text_field( $this->_req_data['checkinnonce'] ) : '';
721
+		$nonce = isset($this->_req_data['checkinnonce']) ? sanitize_text_field($this->_req_data['checkinnonce']) : '';
722 722
 		$nonce_ref = 'checkin_nonce';
723 723
 
724
-		$this->_verify_nonce( $nonce, $nonce_ref );
724
+		$this->_verify_nonce($nonce, $nonce_ref);
725 725
 
726 726
 		//beautiful! Made it this far so let's get the status.
727 727
 		$new_status = $this->_toggle_checkin_status();
728 728
 
729 729
 		//setup new class to return via ajax
730
-		$this->_template_args['admin_page_content'] = 'clickable trigger-checkin checkin-icons checkedin-status-' . $new_status;
730
+		$this->_template_args['admin_page_content'] = 'clickable trigger-checkin checkin-icons checkedin-status-'.$new_status;
731 731
 		$this->_template_args['success'] = TRUE;
732 732
 		$this->_return_json();
733 733
 	}
@@ -747,32 +747,32 @@  discard block
 block discarded – undo
747 747
 		//first let's get the query args out of the way for the redirect
748 748
 		$query_args = array(
749 749
 			'action' => 'event_registrations',
750
-			'event_id' => isset( $this->_req_data['event_id'] ) ? $this->_req_data['event_id'] : NULL,
751
-			'DTT_ID' => isset( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : NULL
750
+			'event_id' => isset($this->_req_data['event_id']) ? $this->_req_data['event_id'] : NULL,
751
+			'DTT_ID' => isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : NULL
752 752
 			);
753 753
 		$new_status = FALSE;
754 754
 
755 755
 		// bulk action check in toggle
756
-		if ( ! empty( $this->_req_data['checkbox'] ) && is_array( $this->_req_data['checkbox'] )) {
756
+		if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
757 757
 			// cycle thru checkboxes
758
-			while ( list( $REG_ID, $value ) = each($this->_req_data['checkbox'])) {
759
-				$DTT_ID = isset( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : NULL;
758
+			while (list($REG_ID, $value) = each($this->_req_data['checkbox'])) {
759
+				$DTT_ID = isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : NULL;
760 760
 				$new_status = $this->_toggle_checkin($REG_ID, $DTT_ID);
761 761
 			}
762 762
 
763
-		} elseif ( isset( $this->_req_data['_regid'] ) ) {
763
+		} elseif (isset($this->_req_data['_regid'])) {
764 764
 			//coming from ajax request
765
-			$DTT_ID = isset( $this->_req_data['dttid'] ) ? $this->_req_data['dttid'] : NULL;
765
+			$DTT_ID = isset($this->_req_data['dttid']) ? $this->_req_data['dttid'] : NULL;
766 766
 			$query_args['DTT_ID'] = $DTT_ID;
767 767
 			$new_status = $this->_toggle_checkin($this->_req_data['_regid'], $DTT_ID);
768 768
 		} else {
769
-			EE_Error::add_error(__('Missing some required data to toggle the Check-in', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__  );
769
+			EE_Error::add_error(__('Missing some required data to toggle the Check-in', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
770 770
 		}
771 771
 
772
-		if ( defined('DOING_AJAX' ) )
772
+		if (defined('DOING_AJAX'))
773 773
 			return $new_status;
774 774
 
775
-		$this->_redirect_after_action( FALSE,'', '', $query_args, TRUE );
775
+		$this->_redirect_after_action(FALSE, '', '', $query_args, TRUE);
776 776
 
777 777
 	}
778 778
 
@@ -788,11 +788,11 @@  discard block
 block discarded – undo
788 788
 	 */
789 789
 	private function _toggle_checkin($REG_ID, $DTT_ID) {
790 790
 		$REG = EEM_Registration::instance()->get_one_by_ID($REG_ID);
791
-		$new_status = $REG->toggle_checkin_status( $DTT_ID );
792
-		if ( $new_status !== FALSE ) {
793
-			EE_Error::add_success($REG->get_checkin_msg($DTT_ID) );
791
+		$new_status = $REG->toggle_checkin_status($DTT_ID);
792
+		if ($new_status !== FALSE) {
793
+			EE_Error::add_success($REG->get_checkin_msg($DTT_ID));
794 794
 		} else {
795
-			EE_Error::add_error($REG->get_checkin_msg($DTT_ID, TRUE), __FILE__, __FUNCTION__, __LINE__ );
795
+			EE_Error::add_error($REG->get_checkin_msg($DTT_ID, TRUE), __FILE__, __FUNCTION__, __LINE__);
796 796
 			$new_status = FALSE;
797 797
 		}
798 798
 		return $new_status;
@@ -808,28 +808,28 @@  discard block
 block discarded – undo
808 808
 	protected function _delete_checkin_rows() {
809 809
 		$query_args = array(
810 810
 			'action' => 'registration_checkins',
811
-			'DTT_ID' => isset( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : 0,
812
-			'_REGID' => isset( $this->_req_data['_REGID'] ) ? $this->_req_data['_REGID'] : 0
811
+			'DTT_ID' => isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : 0,
812
+			'_REGID' => isset($this->_req_data['_REGID']) ? $this->_req_data['_REGID'] : 0
813 813
 			);
814
-		if ( !empty( $this->_req_data['checkbox'] ) && is_array( $this->_req_data['checkbox'] ) ) {
815
-			while ( list( $CHK_ID, $value ) = each( $this->_req_data['checkbox'] ) ) {
814
+		if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
815
+			while (list($CHK_ID, $value) = each($this->_req_data['checkbox'])) {
816 816
 				$errors = 0;
817
-				if ( ! EEM_Checkin::instance()->delete_by_ID($CHK_ID ) ) {
817
+				if ( ! EEM_Checkin::instance()->delete_by_ID($CHK_ID)) {
818 818
 					$errors++;
819 819
 				}
820 820
 			}
821 821
 		} else {
822
-			EE_Error::add_error(__('So, something went wrong with the bulk delete because there was no data received for instructions on WHAT to delete!', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
823
-			$this->_redirect_after_action( FALSE, '', '', $query_args, TRUE );
822
+			EE_Error::add_error(__('So, something went wrong with the bulk delete because there was no data received for instructions on WHAT to delete!', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
823
+			$this->_redirect_after_action(FALSE, '', '', $query_args, TRUE);
824 824
 		}
825 825
 
826
-		if ( $errors > 0 ) {
827
-			EE_Error::add_error( sprintf( __('There were %d records that did not delete successfully', 'event_espresso'), $errors ), __FILE__, __FUNCTION__, __LINE__ );
826
+		if ($errors > 0) {
827
+			EE_Error::add_error(sprintf(__('There were %d records that did not delete successfully', 'event_espresso'), $errors), __FILE__, __FUNCTION__, __LINE__);
828 828
 		} else {
829
-			EE_Error::add_success( __('Records were successfully deleted', 'event_espresso') );
829
+			EE_Error::add_success(__('Records were successfully deleted', 'event_espresso'));
830 830
 		}
831 831
 
832
-		$this->_redirect_after_action( FALSE, '', '', $query_args, TRUE );
832
+		$this->_redirect_after_action(FALSE, '', '', $query_args, TRUE);
833 833
 	}
834 834
 
835 835
 
@@ -841,20 +841,20 @@  discard block
 block discarded – undo
841 841
 	protected function _delete_checkin_row() {
842 842
 		$query_args = array(
843 843
 			'action' => 'registration_checkins',
844
-			'DTT_ID' => isset( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : 0,
845
-			'_REGID' => isset( $this->_req_data['_REGID'] ) ? $this->_req_data['_REGID'] : 0
844
+			'DTT_ID' => isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : 0,
845
+			'_REGID' => isset($this->_req_data['_REGID']) ? $this->_req_data['_REGID'] : 0
846 846
 			);
847 847
 
848
-		if ( !empty( $this->_req_data['CHK_ID'] ) ) {
849
-			if ( ! EEM_Checkin::instance()->delete_by_ID($this->_req_data['CHK_ID'] ) ) {
850
-				EE_Error::add_error(__('Something went wrong and this check-in record was not deleted', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
848
+		if ( ! empty($this->_req_data['CHK_ID'])) {
849
+			if ( ! EEM_Checkin::instance()->delete_by_ID($this->_req_data['CHK_ID'])) {
850
+				EE_Error::add_error(__('Something went wrong and this check-in record was not deleted', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
851 851
 			} else {
852
-				EE_Error::add_success( __('Check-In record successfully deleted', 'event_espresso') );
852
+				EE_Error::add_success(__('Check-In record successfully deleted', 'event_espresso'));
853 853
 			}
854 854
 		} else {
855
-			EE_Error::add_error(__('In order to delete a Check-in record, there must be a Check-In ID available. There is not. It is not your fault, there is just a gremlin living in the code', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
855
+			EE_Error::add_error(__('In order to delete a Check-in record, there must be a Check-In ID available. There is not. It is not your fault, there is just a gremlin living in the code', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
856 856
 		}
857
-		$this->_redirect_after_action( FALSE, '', '', $query_args, TRUE );
857
+		$this->_redirect_after_action(FALSE, '', '', $query_args, TRUE);
858 858
 	}
859 859
 
860 860
 
@@ -867,12 +867,12 @@  discard block
 block discarded – undo
867 867
 	 * @throws \EE_Error
868 868
 	 */
869 869
 	protected function _event_registrations_list_table() {
870
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
871
-		$this->_admin_page_title .= isset( $this->_req_data['event_id'] )
870
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
871
+		$this->_admin_page_title .= isset($this->_req_data['event_id'])
872 872
 			? $this->get_action_link_or_button(
873 873
 				'new_registration',
874 874
 				'add-registrant',
875
-				array( 'event_id' => $this->_req_data['event_id'] ),
875
+				array('event_id' => $this->_req_data['event_id']),
876 876
 				'add-new-h2',
877 877
 				'',
878 878
 				false
@@ -901,35 +901,35 @@  discard block
 block discarded – undo
901 901
 				'desc' => __('View All Check-in Records for this Registrant', 'event_espresso')
902 902
 				),
903 903
 			'approved_status' => array(
904
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_approved,
905
-				'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_approved, FALSE, 'sentence' )
904
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_approved,
905
+				'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_approved, FALSE, 'sentence')
906 906
 				),
907 907
             'cancelled_status' => array(
908
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_cancelled,
909
-				'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_cancelled, FALSE, 'sentence' )
908
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_cancelled,
909
+				'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_cancelled, FALSE, 'sentence')
910 910
 				),
911 911
             'declined_status' => array(
912
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_declined,
913
-				'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_declined, FALSE, 'sentence' )
912
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_declined,
913
+				'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_declined, FALSE, 'sentence')
914 914
 				),
915 915
 			'not_approved' => array(
916
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_not_approved,
917
-				'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_not_approved, FALSE, 'sentence' )
916
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_not_approved,
917
+				'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_not_approved, FALSE, 'sentence')
918 918
 				),
919 919
 			'pending_status' => array(
920
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_pending_payment,
921
-				'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_pending_payment, FALSE, 'sentence' )
920
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_pending_payment,
921
+				'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_pending_payment, FALSE, 'sentence')
922 922
 				),
923 923
 			'wait_list' => array(
924
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_wait_list,
925
-				'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_wait_list, FALSE, 'sentence' )
924
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_wait_list,
925
+				'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_wait_list, FALSE, 'sentence')
926 926
 				),
927 927
 			);
928
-		$this->_template_args['after_list_table'] = $this->_display_legend( $legend_items );
928
+		$this->_template_args['after_list_table'] = $this->_display_legend($legend_items);
929 929
 
930
-		$event_id = isset( $this->_req_data['event_id'] ) ? $this->_req_data['event_id'] : null;
931
-		$this->_template_args['before_list_table'] = !empty( $event_id ) ? '<h2>' . sprintf(__('Viewing Registrations for Event: %s', 'event_espresso'), EEM_Event::instance()->get_one_by_ID($event_id)->get('EVT_name') ) . '</h2>' : '';
932
-		$this->_template_args['list_table_hidden_fields'] = !empty( $event_id ) ? '<input type="hidden" name="event_id" value="' . $event_id . '">' : '';
930
+		$event_id = isset($this->_req_data['event_id']) ? $this->_req_data['event_id'] : null;
931
+		$this->_template_args['before_list_table'] = ! empty($event_id) ? '<h2>'.sprintf(__('Viewing Registrations for Event: %s', 'event_espresso'), EEM_Event::instance()->get_one_by_ID($event_id)->get('EVT_name')).'</h2>' : '';
932
+		$this->_template_args['list_table_hidden_fields'] = ! empty($event_id) ? '<input type="hidden" name="event_id" value="'.$event_id.'">' : '';
933 933
 
934 934
 		$this->display_admin_list_table_page_with_no_sidebar();
935 935
 	}
@@ -943,15 +943,15 @@  discard block
 block discarded – undo
943 943
 	*		@access public
944 944
 	*		@return array
945 945
 	*/
946
-	public function get_event_attendees( $per_page = 10, $count = FALSE, $trash = FALSE, $orderby = '' ) {
946
+	public function get_event_attendees($per_page = 10, $count = FALSE, $trash = FALSE, $orderby = '') {
947 947
 
948
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
949
-		require_once(EE_MODELS . 'EEM_Attendee.model.php');
948
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
949
+		require_once(EE_MODELS.'EEM_Attendee.model.php');
950 950
 		//$ATT_MDL = EEM_Attendee::instance();
951 951
 
952
-		$EVT_ID = isset($this->_req_data['event_id']) ? absint( $this->_req_data['event_id'] ) : FALSE;
953
-		$CAT_ID = isset($this->_req_data['category_id']) ? absint( $this->_req_data['category_id'] ) : FALSE;
954
-		$DTT_ID = isset( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : NULL;
952
+		$EVT_ID = isset($this->_req_data['event_id']) ? absint($this->_req_data['event_id']) : FALSE;
953
+		$CAT_ID = isset($this->_req_data['category_id']) ? absint($this->_req_data['category_id']) : FALSE;
954
+		$DTT_ID = isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : NULL;
955 955
 
956 956
 		$this->_req_data['orderby'] = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : $orderby;
957 957
 
@@ -964,94 +964,94 @@  discard block
 block discarded – undo
964 964
 //				$orderby = 'reg.REG_final_price';
965 965
 		}
966 966
 
967
-		$sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'ASC';
967
+		$sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'ASC';
968 968
 
969
-		$current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1;
970
-		$per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page;
969
+		$current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1;
970
+		$per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page;
971 971
 
972 972
 
973
-		$offset = ($current_page-1)*$per_page;
974
-		$limit = $count ? NULL : array( $offset, $per_page );
975
-		$query_params = array(array('Event.status'=>array('IN',  array_keys(EEM_Event::instance()->get_status_array()))));
976
-		if ($EVT_ID){
977
-			$query_params[0]['EVT_ID']=$EVT_ID;
973
+		$offset = ($current_page - 1) * $per_page;
974
+		$limit = $count ? NULL : array($offset, $per_page);
975
+		$query_params = array(array('Event.status'=>array('IN', array_keys(EEM_Event::instance()->get_status_array()))));
976
+		if ($EVT_ID) {
977
+			$query_params[0]['EVT_ID'] = $EVT_ID;
978 978
 		}
979
-		if($CAT_ID){
979
+		if ($CAT_ID) {
980 980
 			throw new EE_Error("You specified a Category Id for this query. Thats odd because we are now using terms and taxonomies. So did you mean the term taxonomy id o rthe term id?");
981 981
 		}
982 982
 
983 983
 		//if DTT is included we do multiple datetimes.
984
-		if ( $DTT_ID ) {
984
+		if ($DTT_ID) {
985 985
 			$query_params[0]['Ticket.Datetime.DTT_ID'] = $DTT_ID;
986 986
 		}
987 987
 
988 988
 		//make sure we only have default where on the current regs
989 989
 		$query_params['default_where_conditions'] = 'this_model_only';
990 990
 
991
-		$status_ids_array = apply_filters( 'FHEE__Extend_Registrations_Admin_Page__get_event_attendees__status_ids_array', array( EEM_Registration::status_id_pending_payment, EEM_Registration::status_id_approved ) );
991
+		$status_ids_array = apply_filters('FHEE__Extend_Registrations_Admin_Page__get_event_attendees__status_ids_array', array(EEM_Registration::status_id_pending_payment, EEM_Registration::status_id_approved));
992 992
 
993
-		$query_params[0]['STS_ID']= array('IN', $status_ids_array );
993
+		$query_params[0]['STS_ID'] = array('IN', $status_ids_array);
994 994
 
995
-		if($trash){
996
-			$query_params[0]['Attendee.status']=  EEM_CPT_Base::post_status_trashed;
995
+		if ($trash) {
996
+			$query_params[0]['Attendee.status'] = EEM_CPT_Base::post_status_trashed;
997 997
 		}
998 998
 
999
-		if ( isset( $this->_req_data['s'] ) ) {
1000
-			$sstr = '%' . $this->_req_data['s'] . '%';
999
+		if (isset($this->_req_data['s'])) {
1000
+			$sstr = '%'.$this->_req_data['s'].'%';
1001 1001
 			$query_params[0]['OR'] = array(
1002
-				'Event.EVT_name' => array( 'LIKE', $sstr),
1003
-				'Event.EVT_desc' => array( 'LIKE', $sstr ),
1004
-				'Event.EVT_short_desc' => array( 'LIKE' , $sstr ),
1005
-				'Attendee.ATT_fname' => array( 'LIKE', $sstr ),
1006
-				'Attendee.ATT_lname' => array( 'LIKE', $sstr ),
1007
-				'Attendee.ATT_short_bio' => array( 'LIKE', $sstr ),
1008
-				'Attendee.ATT_email' => array('LIKE', $sstr ),
1009
-				'Attendee.ATT_address' => array( 'LIKE', $sstr ),
1010
-				'Attendee.ATT_address2' => array( 'LIKE', $sstr ),
1011
-				'Attendee.ATT_city' => array( 'LIKE', $sstr ),
1012
-				'REG_final_price' => array( 'LIKE', $sstr ),
1013
-				'REG_code' => array( 'LIKE', $sstr ),
1014
-				'REG_count' => array( 'LIKE' , $sstr ),
1015
-				'REG_group_size' => array( 'LIKE' , $sstr ),
1016
-				'Ticket.TKT_name' => array( 'LIKE', $sstr ),
1017
-				'Ticket.TKT_description' => array( 'LIKE', $sstr )
1002
+				'Event.EVT_name' => array('LIKE', $sstr),
1003
+				'Event.EVT_desc' => array('LIKE', $sstr),
1004
+				'Event.EVT_short_desc' => array('LIKE', $sstr),
1005
+				'Attendee.ATT_fname' => array('LIKE', $sstr),
1006
+				'Attendee.ATT_lname' => array('LIKE', $sstr),
1007
+				'Attendee.ATT_short_bio' => array('LIKE', $sstr),
1008
+				'Attendee.ATT_email' => array('LIKE', $sstr),
1009
+				'Attendee.ATT_address' => array('LIKE', $sstr),
1010
+				'Attendee.ATT_address2' => array('LIKE', $sstr),
1011
+				'Attendee.ATT_city' => array('LIKE', $sstr),
1012
+				'REG_final_price' => array('LIKE', $sstr),
1013
+				'REG_code' => array('LIKE', $sstr),
1014
+				'REG_count' => array('LIKE', $sstr),
1015
+				'REG_group_size' => array('LIKE', $sstr),
1016
+				'Ticket.TKT_name' => array('LIKE', $sstr),
1017
+				'Ticket.TKT_description' => array('LIKE', $sstr)
1018 1018
 				);
1019 1019
 		}
1020 1020
 
1021 1021
 		$query_params['order_by'][$orderby] = $sort;
1022 1022
 		$query_params['limit'] = $limit;
1023
-		$query_params['force_join'] = array('Attendee');//force join to attendee model so that it gets cached, because we're going to need the attendee for each registration
1024
-		if($count){
1025
-			$registrations = EEM_Registration::instance()->count(array($query_params[0], 'default_where_conditions' => 'this_model_only' ));
1026
-		}else{
1023
+		$query_params['force_join'] = array('Attendee'); //force join to attendee model so that it gets cached, because we're going to need the attendee for each registration
1024
+		if ($count) {
1025
+			$registrations = EEM_Registration::instance()->count(array($query_params[0], 'default_where_conditions' => 'this_model_only'));
1026
+		} else {
1027 1027
 			$registrations = EEM_Registration::instance()->get_all($query_params);
1028 1028
 
1029 1029
 
1030 1030
 	//		$registrations = EEM_Registration::instance();
1031 1031
 	//		$all_attendees = EEM_Attendee::instance()->get_event_attendees( $EVT_ID, $CAT_ID, $reg_status, $trash, $orderby, $sort, $limit, $output );
1032
-			if ( isset( $registrations[0] ) && $registrations[0] instanceof EE_Registration ) {
1032
+			if (isset($registrations[0]) && $registrations[0] instanceof EE_Registration) {
1033 1033
 				//EEH_Debug_Tools::printr( $all_attendees[0], '$all_attendees[0]  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
1034 1034
 				// name
1035 1035
 				$first_registration = $registrations[0];
1036 1036
 				$event_obj = $first_registration->event_obj();
1037
-				if($event_obj){
1037
+				if ($event_obj) {
1038 1038
 					$event_name = $first_registration->event_obj()->name();
1039
-					$event_date = 'TODO: we need to get date from earliest price date or should this be the actual event date?';//$first_registration->date_obj()->reg_start_date_and_time('l F j, Y,', ' g:i:s a');// isset( $registrations[0]->DTT_EVT_start ) ? date( 'l F j, Y,    g:i:s a', $registrations[0]->DTT_EVT_start ) : '';
1039
+					$event_date = 'TODO: we need to get date from earliest price date or should this be the actual event date?'; //$first_registration->date_obj()->reg_start_date_and_time('l F j, Y,', ' g:i:s a');// isset( $registrations[0]->DTT_EVT_start ) ? date( 'l F j, Y,    g:i:s a', $registrations[0]->DTT_EVT_start ) : '';
1040 1040
 					// edit event link
1041
-					if ( $event_name != '' ) {
1042
-						$edit_event_url = self::add_query_args_and_nonce( array( 'action'=>'edit_event', 'EVT_ID'=>$EVT_ID ), EVENTS_ADMIN_URL );
1043
-						$edit_event_lnk = '<a href="'.$edit_event_url.'" title="' . esc_attr__( 'Edit ', 'event_espresso' ) . $event_name . '">' . __( 'Edit Event', 'event_espresso' ) . '</a>';
1044
-						$event_name .= ' <span class="admin-page-header-edit-lnk not-bold">' . $edit_event_lnk . '</span>' ;
1041
+					if ($event_name != '') {
1042
+						$edit_event_url = self::add_query_args_and_nonce(array('action'=>'edit_event', 'EVT_ID'=>$EVT_ID), EVENTS_ADMIN_URL);
1043
+						$edit_event_lnk = '<a href="'.$edit_event_url.'" title="'.esc_attr__('Edit ', 'event_espresso').$event_name.'">'.__('Edit Event', 'event_espresso').'</a>';
1044
+						$event_name .= ' <span class="admin-page-header-edit-lnk not-bold">'.$edit_event_lnk.'</span>';
1045 1045
 					}
1046 1046
 
1047
-					$back_2_reg_url = self::add_query_args_and_nonce( array( 'action'=>'default' ), REG_ADMIN_URL );
1048
-					$back_2_reg_lnk = '<a href="'.$back_2_reg_url.'" title="' . esc_attr__( 'click to return to viewing all registrations ', 'event_espresso' ) . '">&laquo; ' . __( 'Back to All Registrations', 'event_espresso' ) . '</a>';
1047
+					$back_2_reg_url = self::add_query_args_and_nonce(array('action'=>'default'), REG_ADMIN_URL);
1048
+					$back_2_reg_lnk = '<a href="'.$back_2_reg_url.'" title="'.esc_attr__('click to return to viewing all registrations ', 'event_espresso').'">&laquo; '.__('Back to All Registrations', 'event_espresso').'</a>';
1049 1049
 
1050 1050
 					$this->_template_args['before_admin_page_content'] = '
1051 1051
 				<div id="admin-page-header">
1052
-					<h1><span class="small-text not-bold">'.__( 'Event: ', 'event_espresso' ).'</span>'. $event_name .'</h1>
1053
-					<h3><span class="small-text not-bold">'.__( 'Date: ', 'event_espresso' ). '</span>'. $event_date .'</h3>
1054
-					<span class="admin-page-header-go-back-lnk not-bold">' . $back_2_reg_lnk . '</span>
1052
+					<h1><span class="small-text not-bold">'.__('Event: ', 'event_espresso').'</span>'.$event_name.'</h1>
1053
+					<h3><span class="small-text not-bold">'.__('Date: ', 'event_espresso').'</span>'.$event_date.'</h3>
1054
+					<span class="admin-page-header-go-back-lnk not-bold">' . $back_2_reg_lnk.'</span>
1055 1055
 				</div>
1056 1056
 				';
1057 1057
 				}
Please login to merge, or discard this patch.
core/libraries/shortcodes/EE_Organization_Shortcodes.lib.php 1 patch
Spacing   +25 added lines, -25 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
 /**
@@ -58,96 +58,96 @@  discard block
 block discarded – undo
58 58
 			'[CO_GOOGLE_URL]' => esc_html__('Link to organization Google page', 'event_espresso'),
59 59
 			'[CO_LINKEDIN_URL]' => esc_html__('Link to organization LinkedIn page', 'event_espresso'),
60 60
 			'[CO_INSTAGRAM_URL]' => esc_html__('Link to organization Instagram page', 'event_espresso'),
61
-			'[CO_TAX_NUMBER_*]' => sprintf( esc_html__('This is the shortcode used for displaying any tax number for the company.  %1$sNote: This is a special dynamic shortcode.%2$s You can use the "prefix" parameter to indicate what the prefix for this tax number is.  It defaults to "VAT/Tax Number:".  To change this prefix you do the following format for this shortcode:  [CO_TAX_NUMBER_* prefix="GST: "] and that will output: GST: 12345t56.  Also take note that if you have NO number in your settings, the prefix is not output either.', 'event_espresso' ),'<strong>','</strong>')
61
+			'[CO_TAX_NUMBER_*]' => sprintf(esc_html__('This is the shortcode used for displaying any tax number for the company.  %1$sNote: This is a special dynamic shortcode.%2$s You can use the "prefix" parameter to indicate what the prefix for this tax number is.  It defaults to "VAT/Tax Number:".  To change this prefix you do the following format for this shortcode:  [CO_TAX_NUMBER_* prefix="GST: "] and that will output: GST: 12345t56.  Also take note that if you have NO number in your settings, the prefix is not output either.', 'event_espresso'), '<strong>', '</strong>')
62 62
 			);
63 63
 	}
64 64
 
65 65
 
66
-	protected function _parser( $shortcode ) {
66
+	protected function _parser($shortcode) {
67 67
 
68
-		switch ( $shortcode ) {
68
+		switch ($shortcode) {
69 69
 
70 70
 			case '[COMPANY]' :
71
-				return EE_Registry::instance()->CFG->organization->get_pretty( 'name' );
71
+				return EE_Registry::instance()->CFG->organization->get_pretty('name');
72 72
 				break;
73 73
 
74 74
 			case '[CO_ADD1]' :
75
-				return EE_Registry::instance()->CFG->organization->get_pretty( 'address_1' );
75
+				return EE_Registry::instance()->CFG->organization->get_pretty('address_1');
76 76
 				break;
77 77
 
78 78
 			case '[CO_ADD2]' :
79
-				return EE_Registry::instance()->CFG->organization->get_pretty( 'address_2' );
79
+				return EE_Registry::instance()->CFG->organization->get_pretty('address_2');
80 80
 				break;
81 81
 
82 82
 			case '[CO_CITY]' :
83
-				return EE_Registry::instance()->CFG->organization->get_pretty( 'city' );
83
+				return EE_Registry::instance()->CFG->organization->get_pretty('city');
84 84
 				break;
85 85
 
86 86
 			case '[CO_STATE]' :
87
-				$state = EE_Registry::instance()->load_model( 'State' )->get_one_by_ID( EE_Registry::instance()->CFG->organization->STA_ID );
87
+				$state = EE_Registry::instance()->load_model('State')->get_one_by_ID(EE_Registry::instance()->CFG->organization->STA_ID);
88 88
 				return $state->name();
89 89
 				break;
90 90
 
91 91
 			case '[CO_ZIP]' :
92
-				return EE_Registry::instance()->CFG->organization->get_pretty( 'zip' );
92
+				return EE_Registry::instance()->CFG->organization->get_pretty('zip');
93 93
 				break;
94 94
 
95 95
 			case '[CO_EMAIL]' :
96
-				return EE_Registry::instance()->CFG->organization->get_pretty( 'email' );
96
+				return EE_Registry::instance()->CFG->organization->get_pretty('email');
97 97
 				break;
98 98
 
99 99
 			case '[CO_PHONE]' :
100
-				return EE_Registry::instance()->CFG->organization->get_pretty( 'phone' );
100
+				return EE_Registry::instance()->CFG->organization->get_pretty('phone');
101 101
 				break;
102 102
 
103 103
 			case '[CO_LOGO]' :
104
-				return '<img src="' . EE_Registry::instance()->CFG->organization->get_pretty( 'logo_url' ) . '" id="headerImage" />';
104
+				return '<img src="'.EE_Registry::instance()->CFG->organization->get_pretty('logo_url').'" id="headerImage" />';
105 105
 				break;
106 106
 
107 107
 			case '[CO_LOGO_URL]' :
108
-				return EE_Registry::instance()->CFG->organization->get_pretty( 'logo_url' );
108
+				return EE_Registry::instance()->CFG->organization->get_pretty('logo_url');
109 109
 				break;
110 110
 
111 111
 			case '[CO_FACEBOOK_URL]' :
112
-				return EE_Registry::instance()->CFG->organization->get_pretty( 'facebook' );
112
+				return EE_Registry::instance()->CFG->organization->get_pretty('facebook');
113 113
 				break;
114 114
 
115 115
 			case '[CO_TWITTER_URL]' :
116
-				return EE_Registry::instance()->CFG->organization->get_pretty( 'twitter' );
116
+				return EE_Registry::instance()->CFG->organization->get_pretty('twitter');
117 117
 				break;
118 118
 
119 119
 			case '[CO_PINTEREST_URL]' :
120
-				return EE_Registry::instance()->CFG->organization->get_pretty( 'pinterest' );
120
+				return EE_Registry::instance()->CFG->organization->get_pretty('pinterest');
121 121
 				break;
122 122
 
123 123
 			case '[CO_LINKEDIN_URL]' :
124
-				return EE_Registry::instance()->CFG->organization->get_pretty( 'linkedin' );
124
+				return EE_Registry::instance()->CFG->organization->get_pretty('linkedin');
125 125
 				break;
126 126
 
127 127
 			case '[CO_GOOGLE_URL]' :
128
-				return EE_Registry::instance()->CFG->organization->get_pretty( 'google' );
128
+				return EE_Registry::instance()->CFG->organization->get_pretty('google');
129 129
 				break;
130 130
 
131 131
 			case '[CO_INSTAGRAM_URL]' :
132
-				return EE_Registry::instance()->CFG->organization->get_pretty( 'instagram' );
132
+				return EE_Registry::instance()->CFG->organization->get_pretty('instagram');
133 133
 				break;
134 134
 
135 135
 		}
136 136
 
137 137
 		//also allow for parameter shortcode
138
-		if ( strpos( $shortcode, '[CO_TAX_NUMBER_*' ) !== FALSE ) {
138
+		if (strpos($shortcode, '[CO_TAX_NUMBER_*') !== FALSE) {
139 139
 			//first see if there is any company tax number set and bail early if not
140 140
 			$tax_number = EE_Registry::instance()->CFG->organization->vat;
141
-			if ( empty( $tax_number ) ) {
141
+			if (empty($tax_number)) {
142 142
 				return '';
143 143
 			}
144 144
 
145 145
 			//see if there are any attributes.
146
-			$attrs = $this->_get_shortcode_attrs( $shortcode );
146
+			$attrs = $this->_get_shortcode_attrs($shortcode);
147 147
 
148 148
 			//set custom attrs if present (or default)
149
-			$prefix = isset( $attrs['prefix'] ) ? $attrs['prefix'] : esc_html__('VAT/Tax Number: ', 'event_espresso');
150
-			return $prefix . $tax_number;
149
+			$prefix = isset($attrs['prefix']) ? $attrs['prefix'] : esc_html__('VAT/Tax Number: ', 'event_espresso');
150
+			return $prefix.$tax_number;
151 151
 		}
152 152
 
153 153
 		return '';
Please login to merge, or discard this patch.
core/libraries/shortcodes/EE_Email_Shortcodes.lib.php 1 patch
Spacing   +29 added lines, -29 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
 /**
@@ -43,19 +43,19 @@  discard block
 block discarded – undo
43 43
 		$this->description = esc_html__('All shortcodes related to emails', 'event_espresso');
44 44
 		$this->_shortcodes = array(
45 45
 			'[SITE_ADMIN_EMAIL]' => esc_html__('Will be replaced with the admin email for the site that Event Espresso is installed on', 'event_espresso'),
46
-			'[EVENT_AUTHOR_FORMATTED_EMAIL]' => sprintf( esc_html__('This will be replaced with a properly formatted list of Event Creator emails for the events in a registration. %1$sNOTE:%2$s If the event author has not filled out their WordPress user profile then the organization name will be used as the "From" name.', 'event_espresso'),'<strong>','</strong>' ),
47
-			'[EVENT_AUTHOR_EMAIL]' => sprintf( esc_html__('This is the same as %1$s shortcode except it is just a list of emails (not fancy headers).', 'event_espresso'), '[EVENT_AUTHOR_FORMATTED_EMAIL]' ),
48
-			'[CO_FORMATTED_EMAIL]' => esc_html__('This parses to the formatted email address of the organization name set in Your Organization Settings. "My Organization &lt;[email protected]&gt;"', 'event_espresso' ),
46
+			'[EVENT_AUTHOR_FORMATTED_EMAIL]' => sprintf(esc_html__('This will be replaced with a properly formatted list of Event Creator emails for the events in a registration. %1$sNOTE:%2$s If the event author has not filled out their WordPress user profile then the organization name will be used as the "From" name.', 'event_espresso'), '<strong>', '</strong>'),
47
+			'[EVENT_AUTHOR_EMAIL]' => sprintf(esc_html__('This is the same as %1$s shortcode except it is just a list of emails (not fancy headers).', 'event_espresso'), '[EVENT_AUTHOR_FORMATTED_EMAIL]'),
48
+			'[CO_FORMATTED_EMAIL]' => esc_html__('This parses to the formatted email address of the organization name set in Your Organization Settings. "My Organization &lt;[email protected]&gt;"', 'event_espresso'),
49 49
 			'[CO_EMAIL]' => esc_html__('This will parse to the email address only for the organization set in Your Organization Settings.', 'event_espresso'),
50
-			'[ESPRESSO_ADMIN_FORMATTED_EMAIL]' => esc_html__('This parses to the formatted email address of the organization name set in Your Organization Settings. "My Organization &lt;[email protected]&gt;"', 'event_espresso' ),
50
+			'[ESPRESSO_ADMIN_FORMATTED_EMAIL]' => esc_html__('This parses to the formatted email address of the organization name set in Your Organization Settings. "My Organization &lt;[email protected]&gt;"', 'event_espresso'),
51 51
 			'[ESPRESSO_ADMIN_EMAIL]' => esc_html__('This parses to the email address only for the organization set in Your Organization Settings page.', 'event_espresso')
52 52
 			);
53 53
 	}
54 54
 
55 55
 
56
-	protected function _parser( $shortcode ) {
56
+	protected function _parser($shortcode) {
57 57
 
58
-		switch ( $shortcode ) {
58
+		switch ($shortcode) {
59 59
 
60 60
 			case '[SITE_ADMIN_EMAIL]' :
61 61
 				return $this->_get_site_admin_email();
@@ -66,17 +66,17 @@  discard block
 block discarded – undo
66 66
 				break;
67 67
 
68 68
 			case '[EVENT_AUTHOR_EMAIL]' :
69
-				return $this->_get_event_admin_emails( FALSE );
69
+				return $this->_get_event_admin_emails(FALSE);
70 70
 				break;
71 71
 
72 72
 			case '[CO_FORMATTED_EMAIL]' :
73 73
 			case '[ESPRESSO_ADMIN_FORMATTED_EMAIL]' :
74
-				return EE_Registry::instance()->CFG->organization->get_pretty( 'name' ) . ' <' . EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) . '>';
74
+				return EE_Registry::instance()->CFG->organization->get_pretty('name').' <'.EE_Registry::instance()->CFG->organization->get_pretty('email').'>';
75 75
 				break;
76 76
 
77 77
 			case '[CO_EMAIL]' :
78 78
 			case '[ESPRESSO_ADMIN_EMAIL]' :
79
-				return EE_Registry::instance()->CFG->organization->get_pretty( 'email' );
79
+				return EE_Registry::instance()->CFG->organization->get_pretty('email');
80 80
 				break;
81 81
 
82 82
 			default :
@@ -98,12 +98,12 @@  discard block
 block discarded – undo
98 98
 	}
99 99
 
100 100
 
101
-	private function _get_event_admin_emails( $fancy_headers = TRUE ) {
101
+	private function _get_event_admin_emails($fancy_headers = TRUE) {
102 102
 
103
-		if ( !empty( $this->_data->admin_email ) ) {
104
-			if ( ! $fancy_headers )
103
+		if ( ! empty($this->_data->admin_email)) {
104
+			if ( ! $fancy_headers)
105 105
 				return $this->_data->admin_email;
106
-			return !empty( $this->_data->fname ) ? $this->_data->fname . ' ' . $this->_data->lname . ' <' . $this->_data->admin_email . '>' : EE_Registry::instance()->CFG->organization->get_pretty( 'name' ) . ' <' . $this->_data->admin_email . '>';
106
+			return ! empty($this->_data->fname) ? $this->_data->fname.' '.$this->_data->lname.' <'.$this->_data->admin_email.'>' : EE_Registry::instance()->CFG->organization->get_pretty('name').' <'.$this->_data->admin_email.'>';
107 107
 		}
108 108
 
109 109
 		//k this shortcode has been used else where.  Since we don't know what particular event this is for, let's loop through the events and get an array of event admins for the events.  We'll return the formatted list of admin emails and let the messenger make sure we only pick one if this is for a field that can only have ONE!.
@@ -111,18 +111,18 @@  discard block
 block discarded – undo
111 111
 		$admin_email = array();
112 112
 
113 113
 		//loop through events and set the list of event_ids to retrieve so we can do ONE query.
114
-		foreach ( $this->_data->events as $event ) {
114
+		foreach ($this->_data->events as $event) {
115 115
 			$ids[] = $event['ID'];
116 116
 		}
117 117
 
118 118
 		//get all the events
119
-		$events = EE_Registry::instance()->load_model('Event')->get_all( array(array('EVT_ID' => array('IN', $ids ) ) ) );
119
+		$events = EE_Registry::instance()->load_model('Event')->get_all(array(array('EVT_ID' => array('IN', $ids))));
120 120
 
121 121
 		//now loop through each event and setup the details
122 122
 		$admin_details = array();
123 123
 		$cnt = 0;
124
-		foreach ( $events as $event ) {
125
-			$user = get_userdata($event->get('EVT_wp_user') );
124
+		foreach ($events as $event) {
125
+			$user = get_userdata($event->get('EVT_wp_user'));
126 126
 			$admin_details[$cnt] = new stdClass();
127 127
 			$admin_details[$cnt]->email = $user->user_email;
128 128
 			$admin_details[$cnt]->first_name = $user->user_firstname;
@@ -131,28 +131,28 @@  discard block
 block discarded – undo
131 131
 		}
132 132
 
133 133
 		//results?
134
-		if ( empty($admin_details) || !is_array($admin_details) ) {
134
+		if (empty($admin_details) || ! is_array($admin_details)) {
135 135
 			$msg[] = esc_html__('The admin details could not be retrieved from the database.', 'event_espresso');
136
-			$msg[] = sprintf( esc_html__('Query: %s', 'event_espresso'), $sql );
137
-			$msg[] = sprintf( esc_html__('Events Data: %s', 'event_espresso'), var_export($this->_data->events, TRUE) );
138
-			$msg[] = sprintf( esc_html__('Event IDS: %s', 'event_espresso'), var_export($ids, TRUE) );
139
-			$msg[] = sprintf( esc_html__('Query Results: %s', 'event_espresso'), var_export($admin_details) );
140
-			do_action( 'AHEE_log', __FILE__, __FUNCTION__, implode( PHP_EOL, $msg ), 'shortcode_parser' );
136
+			$msg[] = sprintf(esc_html__('Query: %s', 'event_espresso'), $sql);
137
+			$msg[] = sprintf(esc_html__('Events Data: %s', 'event_espresso'), var_export($this->_data->events, TRUE));
138
+			$msg[] = sprintf(esc_html__('Event IDS: %s', 'event_espresso'), var_export($ids, TRUE));
139
+			$msg[] = sprintf(esc_html__('Query Results: %s', 'event_espresso'), var_export($admin_details));
140
+			do_action('AHEE_log', __FILE__, __FUNCTION__, implode(PHP_EOL, $msg), 'shortcode_parser');
141 141
 		}
142 142
 
143
-		foreach ( $admin_details as $admin ) {
143
+		foreach ($admin_details as $admin) {
144 144
 			//only add an admin email if it is present.
145
-			if ( empty( $admin->email ) || $admin->email == '' ) continue;
145
+			if (empty($admin->email) || $admin->email == '') continue;
146 146
 
147
-			if ( ! $fancy_headers ) {
147
+			if ( ! $fancy_headers) {
148 148
 				$admin_email[] = $admin->email;
149 149
 				continue;
150 150
 			}
151 151
 
152
-			$admin_email[] = !empty( $admin->first_name ) ? $admin->first_name . ' ' . $admin->last_name . ' <' . $admin->email . '>' : EE_Registry::instance()->CFG->organization->get_pretty( 'name' ) . ' <' . $admin->email . '>';
152
+			$admin_email[] = ! empty($admin->first_name) ? $admin->first_name.' '.$admin->last_name.' <'.$admin->email.'>' : EE_Registry::instance()->CFG->organization->get_pretty('name').' <'.$admin->email.'>';
153 153
 		}
154 154
 
155
-		$admin_email = implode( ',', $admin_email );
155
+		$admin_email = implode(',', $admin_email);
156 156
 		return $admin_email;
157 157
 	}
158 158
 
Please login to merge, or discard this patch.
caffeinated/admin/new/pricing/espresso_events_Pricing_Hooks.class.php 2 patches
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -959,12 +959,12 @@
 block discarded – undo
959 959
 			'dtt_sold' => $default ? '0' : $dtt->get('DTT_sold'),
960 960
 			'clone_icon' => !empty( $dtt ) && $dtt->get('DTT_sold') > 0 ? '' : 'clone-icon ee-icon ee-icon-clone clickable',
961 961
 			'trash_icon' => !empty( $dtt ) && $dtt->get('DTT_sold') > 0  ? 'ee-lock-icon' : 'trash-icon dashicons dashicons-post-trash clickable',
962
-		    'reg_list_url' => $default || ! $dtt->event() instanceof \EE_Event
963
-                ? ''
964
-                : EE_Admin_Page::add_query_args_and_nonce(
965
-                    array( 'event_id' => $dtt->event()->ID(), 'datetime_id' => $dtt->ID() ),
966
-                    REG_ADMIN_URL
967
-                )
962
+			'reg_list_url' => $default || ! $dtt->event() instanceof \EE_Event
963
+				? ''
964
+				: EE_Admin_Page::add_query_args_and_nonce(
965
+					array( 'event_id' => $dtt->event()->ID(), 'datetime_id' => $dtt->ID() ),
966
+					REG_ADMIN_URL
967
+				)
968 968
 		);
969 969
 
970 970
 		$template_args['show_trash'] = count( $all_dtts ) === 1 && $template_args['trash_icon'] !== 'ee-lock-icon' ? ' style="display:none"' : '';
Please login to merge, or discard this patch.
Spacing   +382 added lines, -382 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (!defined('EVENT_ESPRESSO_VERSION') )
2
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
3 3
 	exit('NO direct script access allowed');
4 4
 
5 5
 /**
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 		$this->_name = 'pricing';
55 55
 
56 56
 		//capability check
57
-		if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_default_prices', 'advanced_ticket_datetime_metabox' ) ) {
57
+		if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_default_prices', 'advanced_ticket_datetime_metabox')) {
58 58
 			return;
59 59
 		}
60 60
 
@@ -62,14 +62,14 @@  discard block
 block discarded – undo
62 62
 		//if we were going to add our own metaboxes we'd use the below.
63 63
 		$this->_metaboxes = array(
64 64
 			0 => array(
65
-				'page_route' => array('edit','create_new'),
65
+				'page_route' => array('edit', 'create_new'),
66 66
 				'func' => 'pricing_metabox',
67 67
 				'label' => __('Event Tickets & Datetimes', 'event_espresso'),
68 68
 				'priority' => 'high',
69 69
 				'context' => 'normal'
70 70
 				),
71 71
 
72
-			);/**/
72
+			); /**/
73 73
 
74 74
 		$this->_remove_metaboxes = array(
75 75
 			0 => array(
@@ -88,24 +88,24 @@  discard block
 block discarded – undo
88 88
 		 *
89 89
 		 * @var array  Expected an array returned with 'date' and 'time' keys.
90 90
 		 */
91
-		$this->_date_format_strings = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___set_hooks_properties__date_format_strings', array(
91
+		$this->_date_format_strings = apply_filters('FHEE__espresso_events_Pricing_Hooks___set_hooks_properties__date_format_strings', array(
92 92
 				'date' => 'Y-m-d',
93 93
 				'time' => 'h:i a'
94 94
 			));
95 95
 
96 96
 		//validate
97
-		$this->_date_format_strings['date'] = isset( $this->_date_format_strings['date'] ) ? $this->_date_format_strings['date'] : null;
98
-		$this->_date_format_strings['time'] = isset( $this->_date_format_strings['time'] ) ? $this->_date_format_strings['time'] : null;
97
+		$this->_date_format_strings['date'] = isset($this->_date_format_strings['date']) ? $this->_date_format_strings['date'] : null;
98
+		$this->_date_format_strings['time'] = isset($this->_date_format_strings['time']) ? $this->_date_format_strings['time'] : null;
99 99
 
100 100
 		//validate format strings
101
-		$format_validation = EEH_DTT_Helper::validate_format_string( $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] );
102
-		if ( is_array( $format_validation ) ) {
103
-			$msg = '<p>' . sprintf( __( 'The format "%s" was likely added via a filter and is invalid for the following reasons:', 'event_espresso' ), $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] ) . '</p><ul>';
104
-			foreach ( $format_validation as $error ) {
105
-				$msg .= '<li>' . $error . '</li>';
101
+		$format_validation = EEH_DTT_Helper::validate_format_string($this->_date_format_strings['date'].' '.$this->_date_format_strings['time']);
102
+		if (is_array($format_validation)) {
103
+			$msg = '<p>'.sprintf(__('The format "%s" was likely added via a filter and is invalid for the following reasons:', 'event_espresso'), $this->_date_format_strings['date'].' '.$this->_date_format_strings['time']).'</p><ul>';
104
+			foreach ($format_validation as $error) {
105
+				$msg .= '<li>'.$error.'</li>';
106 106
 			}
107
-			$msg .= '</ul></p><p>' . sprintf( __( '%sPlease note that your date and time formats have been reset to "Y-m-d" and "h:i a" respectively.%s', 'event_espresso' ), '<span style="color:#D54E21;">', '</span>' ) . '</p>';
108
-			EE_Error::add_attention( $msg, __FILE__, __FUNCTION__, __LINE__ );
107
+			$msg .= '</ul></p><p>'.sprintf(__('%sPlease note that your date and time formats have been reset to "Y-m-d" and "h:i a" respectively.%s', 'event_espresso'), '<span style="color:#D54E21;">', '</span>').'</p>';
108
+			EE_Error::add_attention($msg, __FILE__, __FUNCTION__, __LINE__);
109 109
 			$this->_date_format_strings = array(
110 110
 				'date' => 'Y-m-d',
111 111
 				'time' => 'h:i a'
@@ -116,60 +116,60 @@  discard block
 block discarded – undo
116 116
 		$this->_scripts_styles = array(
117 117
 			'registers' => array(
118 118
 				'ee-tickets-datetimes-css' => array(
119
-					'url' => PRICING_ASSETS_URL . 'event-tickets-datetimes.css',
119
+					'url' => PRICING_ASSETS_URL.'event-tickets-datetimes.css',
120 120
 					'type' => 'css'
121 121
 					),
122 122
 				'ee-dtt-ticket-metabox' => array(
123
-					'url' => PRICING_ASSETS_URL . 'ee-datetime-ticket-metabox.js',
123
+					'url' => PRICING_ASSETS_URL.'ee-datetime-ticket-metabox.js',
124 124
 					'depends' => array('ee-datepicker', 'ee-dialog', 'underscore')
125 125
 					)
126 126
 				),
127 127
 			'deregisters' => array(
128
-				'event-editor-css' => array('type' => 'css' ),
128
+				'event-editor-css' => array('type' => 'css'),
129 129
 				'event-datetime-metabox' => array('type' => 'js')
130 130
 				),
131 131
 			'enqueues' => array(
132
-				'ee-tickets-datetimes-css' => array( 'edit', 'create_new' ),
133
-				'ee-dtt-ticket-metabox' => array( 'edit', 'create_new' )
132
+				'ee-tickets-datetimes-css' => array('edit', 'create_new'),
133
+				'ee-dtt-ticket-metabox' => array('edit', 'create_new')
134 134
 				),
135 135
 			'localize' => array(
136 136
 				'ee-dtt-ticket-metabox' => array(
137 137
 					'DTT_TRASH_BLOCK' => array(
138 138
 						'main_warning' => __('The Datetime you are attempting to trash is the only datetime selected for the following ticket(s):', 'event_espresso'),
139 139
 						'after_warning' => __('In order to trash this datetime you must first make sure the above ticket(s) are assigned to other datetimes.', 'event_espresso'),
140
-						'cancel_button' => '<button class="button-secondary ee-modal-cancel">' . __('Cancel', 'event_espresso') . '</button>',
140
+						'cancel_button' => '<button class="button-secondary ee-modal-cancel">'.__('Cancel', 'event_espresso').'</button>',
141 141
 						'single_warning_from_tkt' => __('The Datetime you are attempting to unassign from this ticket is the only remaining datetime for this ticket. Tickets must always have at least one datetime assigned to them.', 'event_espresso'),
142 142
 						'single_warning_from_dtt' => __('The ticket you are attempting to unassign from this datetime cannot be unassigned because the datetime is the only remaining datetime for the ticket.  Tickets must always have at least one datetime assigned to them.', 'event_espresso'),
143
-						'dismiss_button' => '<button class="button-secondary ee-modal-cancel">' . __('Dismiss', 'event_espresso') . '</button>'
143
+						'dismiss_button' => '<button class="button-secondary ee-modal-cancel">'.__('Dismiss', 'event_espresso').'</button>'
144 144
 						),
145 145
 					'DTT_ERROR_MSG' => array(
146 146
 						'no_ticket_name' => __('General Admission', 'event_espresso'),
147
-						'dismiss_button' => '<div class="save-cancel-button-container"><button class="button-secondary ee-modal-cancel">' . __('Dismiss', 'event_espresso') . '</button></div>'
147
+						'dismiss_button' => '<div class="save-cancel-button-container"><button class="button-secondary ee-modal-cancel">'.__('Dismiss', 'event_espresso').'</button></div>'
148 148
 						),
149 149
 					'DTT_OVERSELL_WARNING' => array(
150 150
 						'datetime_ticket' => __('You cannot add this ticket to this datetime because it has a sold amount that is greater than the amount of spots remaining for this datetime.', 'event_espresso'),
151 151
 						'ticket_datetime' => __('You cannot add this datetime to this ticket because the ticket has a sold amount that is greater than the amount of spots remaining on the datetime.', 'event_espresso')
152 152
 						),
153
-					'DTT_CONVERTED_FORMATS' => EEH_DTT_Helper::convert_php_to_js_and_moment_date_formats( $this->_date_format_strings['date'], $this->_date_format_strings['time'] ),
154
-					'DTT_START_OF_WEEK' => array( 'dayValue' => (int) get_option( 'start_of_week' ) )
153
+					'DTT_CONVERTED_FORMATS' => EEH_DTT_Helper::convert_php_to_js_and_moment_date_formats($this->_date_format_strings['date'], $this->_date_format_strings['time']),
154
+					'DTT_START_OF_WEEK' => array('dayValue' => (int) get_option('start_of_week'))
155 155
 					)
156 156
 				)
157 157
 			);
158 158
 
159 159
 
160
-		add_action('AHEE__EE_Admin_Page_CPT__do_extra_autosave_stuff__after_Extend_Events_Admin_Page', array( $this, 'autosave_handling' ), 10 );
161
-		add_filter('FHEE__Events_Admin_Page___insert_update_cpt_item__event_update_callbacks', array( $this, 'caf_updates' ), 10 );
160
+		add_action('AHEE__EE_Admin_Page_CPT__do_extra_autosave_stuff__after_Extend_Events_Admin_Page', array($this, 'autosave_handling'), 10);
161
+		add_filter('FHEE__Events_Admin_Page___insert_update_cpt_item__event_update_callbacks', array($this, 'caf_updates'), 10);
162 162
 	}
163 163
 
164 164
 
165 165
 
166
-	public function caf_updates( $update_callbacks ) {
167
-		foreach ( $update_callbacks as $key => $callback ) {
168
-			if ( $callback[1] == '_default_tickets_update' )
169
-				unset( $update_callbacks[$key] );
166
+	public function caf_updates($update_callbacks) {
167
+		foreach ($update_callbacks as $key => $callback) {
168
+			if ($callback[1] == '_default_tickets_update')
169
+				unset($update_callbacks[$key]);
170 170
 		}
171 171
 
172
-		$update_callbacks[] = array( $this, 'dtt_and_tickets_caf_update' );
172
+		$update_callbacks[] = array($this, 'dtt_and_tickets_caf_update');
173 173
 		return $update_callbacks;
174 174
 	}
175 175
 
@@ -182,11 +182,11 @@  discard block
 block discarded – undo
182 182
 	 * @param  array    $data   The request data from the form
183 183
 	 * @return bool             success or fail
184 184
 	 */
185
-	public function dtt_and_tickets_caf_update( $evtobj, $data ) {
185
+	public function dtt_and_tickets_caf_update($evtobj, $data) {
186 186
 		//first we need to start with datetimes cause they are the "root" items attached to events.
187
-		$saved_dtts = $this->_update_dtts( $evtobj, $data );
187
+		$saved_dtts = $this->_update_dtts($evtobj, $data);
188 188
 		//next tackle the tickets (and prices?)
189
-		$this->_update_tkts( $evtobj, $saved_dtts, $data );
189
+		$this->_update_tkts($evtobj, $saved_dtts, $data);
190 190
 	}
191 191
 
192 192
 
@@ -197,41 +197,41 @@  discard block
 block discarded – undo
197 197
 	 * @param  array    	$data    the request data from the form
198 198
 	 * @return EE_Datetime[]
199 199
 	 */
200
-	protected function _update_dtts( $evt_obj, $data ) {
201
-		$timezone = isset( $data['timezone_string'] ) ? $data['timezone_string'] : NULL;
200
+	protected function _update_dtts($evt_obj, $data) {
201
+		$timezone = isset($data['timezone_string']) ? $data['timezone_string'] : NULL;
202 202
 		$saved_dtt_ids = array();
203 203
 		$saved_dtt_objs = array();
204 204
 
205
-		foreach ( $data['edit_event_datetimes'] as $row => $dtt ) {
205
+		foreach ($data['edit_event_datetimes'] as $row => $dtt) {
206 206
 			//trim all values to ensure any excess whitespace is removed.
207 207
 			$dtt = array_map(
208
-				function( $datetime_data ) {
209
-					return is_array( $datetime_data ) ? $datetime_data : trim( $datetime_data );
208
+				function($datetime_data) {
209
+					return is_array($datetime_data) ? $datetime_data : trim($datetime_data);
210 210
 				},
211 211
 				$dtt
212 212
 			);
213
-			$dtt['DTT_EVT_end'] = isset($dtt['DTT_EVT_end']) && ! empty( $dtt['DTT_EVT_end'] ) ? $dtt['DTT_EVT_end'] : $dtt['DTT_EVT_start'];
213
+			$dtt['DTT_EVT_end'] = isset($dtt['DTT_EVT_end']) && ! empty($dtt['DTT_EVT_end']) ? $dtt['DTT_EVT_end'] : $dtt['DTT_EVT_start'];
214 214
 			$datetime_values = array(
215
-				'DTT_ID' 			=> ! empty( $dtt['DTT_ID'] ) ? $dtt['DTT_ID'] : NULL,
216
-				'DTT_name' 			=> ! empty( $dtt['DTT_name'] ) ? $dtt['DTT_name'] : '',
217
-				'DTT_description' 	=> ! empty( $dtt['DTT_description'] ) ? $dtt['DTT_description'] : '',
215
+				'DTT_ID' 			=> ! empty($dtt['DTT_ID']) ? $dtt['DTT_ID'] : NULL,
216
+				'DTT_name' 			=> ! empty($dtt['DTT_name']) ? $dtt['DTT_name'] : '',
217
+				'DTT_description' 	=> ! empty($dtt['DTT_description']) ? $dtt['DTT_description'] : '',
218 218
 				'DTT_EVT_start' 	=> $dtt['DTT_EVT_start'],
219 219
 				'DTT_EVT_end' 		=> $dtt['DTT_EVT_end'],
220
-				'DTT_reg_limit' 	=> empty( $dtt['DTT_reg_limit'] ) ? EE_INF : $dtt[ 'DTT_reg_limit' ],
221
-				'DTT_order' 		=> ! isset( $dtt['DTT_order'] ) ? $row : $dtt['DTT_order'],
220
+				'DTT_reg_limit' 	=> empty($dtt['DTT_reg_limit']) ? EE_INF : $dtt['DTT_reg_limit'],
221
+				'DTT_order' 		=> ! isset($dtt['DTT_order']) ? $row : $dtt['DTT_order'],
222 222
 			);
223 223
 
224 224
 			//if we have an id then let's get existing object first and then set the new values.  Otherwise we instantiate a new object for save.
225 225
 
226
-			if ( !empty( $dtt['DTT_ID'] ) ) {
227
-				$DTM = EE_Registry::instance()->load_model('Datetime', array($timezone) )->get_one_by_ID($dtt['DTT_ID'] );
226
+			if ( ! empty($dtt['DTT_ID'])) {
227
+				$DTM = EE_Registry::instance()->load_model('Datetime', array($timezone))->get_one_by_ID($dtt['DTT_ID']);
228 228
 
229 229
 				//set date and time format according to what is set in this class.
230
-				$DTM->set_date_format( $this->_date_format_strings['date'] );
231
-				$DTM->set_time_format( $this->_date_format_strings['time'] );
230
+				$DTM->set_date_format($this->_date_format_strings['date']);
231
+				$DTM->set_time_format($this->_date_format_strings['time']);
232 232
 
233
-				foreach ( $datetime_values as $field => $value ) {
234
-					$DTM->set( $field, $value );
233
+				foreach ($datetime_values as $field => $value) {
234
+					$DTM->set($field, $value);
235 235
 				}
236 236
 
237 237
 				// make sure the $dtt_id here is saved just in case after the add_relation_to() the autosave replaces it.
@@ -239,24 +239,24 @@  discard block
 block discarded – undo
239 239
 				$saved_dtt_ids[$DTM->ID()] = $DTM->ID();
240 240
 
241 241
 			} else {
242
-				$DTM = EE_Registry::instance()->load_class('Datetime', array( $datetime_values, $timezone ), FALSE, FALSE );
242
+				$DTM = EE_Registry::instance()->load_class('Datetime', array($datetime_values, $timezone), FALSE, FALSE);
243 243
 
244 244
 				//reset date and times to match the format
245
-				$DTM->set_date_format( $this->_date_format_strings['date'] );
246
-				$DTM->set_time_format( $this->_date_format_strings['time'] );
247
-				foreach( $datetime_values as $field => $value ) {
248
-					$DTM->set( $field, $value );
245
+				$DTM->set_date_format($this->_date_format_strings['date']);
246
+				$DTM->set_time_format($this->_date_format_strings['time']);
247
+				foreach ($datetime_values as $field => $value) {
248
+					$DTM->set($field, $value);
249 249
 				}
250 250
 			}
251 251
 
252 252
 
253 253
 			$DTM->save();
254
-			$DTM = $evt_obj->_add_relation_to( $DTM, 'Datetime' );
254
+			$DTM = $evt_obj->_add_relation_to($DTM, 'Datetime');
255 255
 			$evt_obj->save();
256 256
 
257 257
 			//before going any further make sure our dates are setup correctly so that the end date is always equal or greater than the start date.
258
-			if( $DTM->get_raw('DTT_EVT_start') > $DTM->get_raw('DTT_EVT_end') ) {
259
-				$DTM->set('DTT_EVT_end', $DTM->get('DTT_EVT_start') );
258
+			if ($DTM->get_raw('DTT_EVT_start') > $DTM->get_raw('DTT_EVT_end')) {
259
+				$DTM->set('DTT_EVT_end', $DTM->get('DTT_EVT_start'));
260 260
 				$DTM = EEH_DTT_Helper::date_time_add($DTM, 'DTT_EVT_end', 'days');
261 261
 				$DTM->save();
262 262
 			}
@@ -271,25 +271,25 @@  discard block
 block discarded – undo
271 271
 		}
272 272
 
273 273
 		//now we need to REMOVE any dtts that got deleted.  Keep in mind that this process will only kick in for DTT's that don't have any DTT_sold on them. So its safe to permanently delete at this point.
274
-		$old_datetimes = explode(',', $data['datetime_IDs'] );
274
+		$old_datetimes = explode(',', $data['datetime_IDs']);
275 275
 		$old_datetimes = $old_datetimes[0] == '' ? array() : $old_datetimes;
276 276
 
277
-		if ( is_array( $old_datetimes ) ) {
278
-			$dtts_to_delete = array_diff( $old_datetimes, $saved_dtt_ids );
279
-			foreach ( $dtts_to_delete as $id ) {
280
-				$id = absint( $id );
281
-				if ( empty( $id ) )
277
+		if (is_array($old_datetimes)) {
278
+			$dtts_to_delete = array_diff($old_datetimes, $saved_dtt_ids);
279
+			foreach ($dtts_to_delete as $id) {
280
+				$id = absint($id);
281
+				if (empty($id))
282 282
 					continue;
283 283
 
284 284
 				$dtt_to_remove = EE_Registry::instance()->load_model('Datetime')->get_one_by_ID($id);
285 285
 
286 286
 				//remove tkt relationships.
287 287
 				$related_tickets = $dtt_to_remove->get_many_related('Ticket');
288
-				foreach ( $related_tickets as $tkt ) {
288
+				foreach ($related_tickets as $tkt) {
289 289
 					$dtt_to_remove->_remove_relation_to($tkt, 'Ticket');
290 290
 				}
291 291
 
292
-				$evt_obj->_remove_relation_to( $id, 'Datetime' );
292
+				$evt_obj->_remove_relation_to($id, 'Datetime');
293 293
 				$dtt_to_remove->refresh_cache_of_related_objects();
294 294
 
295 295
 			}
@@ -310,85 +310,85 @@  discard block
 block discarded – undo
310 310
 	 * @param  array            $data       incoming request data
311 311
 	 * @return EE_Ticket[]
312 312
 	 */
313
-	protected function _update_tkts( $evtobj, $saved_dtts, $data ) {
313
+	protected function _update_tkts($evtobj, $saved_dtts, $data) {
314 314
 
315 315
 		$new_tkt = null;
316 316
 		$new_default = null;
317 317
 		//stripslashes because WP filtered the $_POST ($data) array to add slashes
318 318
 		$data = stripslashes_deep($data);
319
-		$timezone = isset( $data['timezone_string'] ) ? $data['timezone_string'] : NULL;
319
+		$timezone = isset($data['timezone_string']) ? $data['timezone_string'] : NULL;
320 320
 		$saved_tickets = $dtts_on_existing = array();
321
-		$old_tickets = isset( $data['ticket_IDs'] ) ? explode(',', $data['ticket_IDs'] ) : array();
321
+		$old_tickets = isset($data['ticket_IDs']) ? explode(',', $data['ticket_IDs']) : array();
322 322
 
323 323
 		//load money helper
324 324
 
325
-		foreach ( $data['edit_tickets'] as $row => $tkt ) {
325
+		foreach ($data['edit_tickets'] as $row => $tkt) {
326 326
 
327 327
 			$update_prices = $create_new_TKT = FALSE;
328 328
 
329 329
 			//figure out what dtts were added to the ticket and what dtts were removed from the ticket in the session.
330 330
 
331
-			$starting_tkt_dtt_rows = explode(',',$data['starting_ticket_datetime_rows'][$row]);
332
-			$tkt_dtt_rows = explode(',', $data['ticket_datetime_rows'][$row] );
331
+			$starting_tkt_dtt_rows = explode(',', $data['starting_ticket_datetime_rows'][$row]);
332
+			$tkt_dtt_rows = explode(',', $data['ticket_datetime_rows'][$row]);
333 333
 			$dtts_added = array_diff($tkt_dtt_rows, $starting_tkt_dtt_rows);
334 334
 			$dtts_removed = array_diff($starting_tkt_dtt_rows, $tkt_dtt_rows);
335 335
 
336 336
 			// trim inputs to ensure any excess whitespace is removed.
337 337
 			$tkt = array_map(
338
-				function( $ticket_data ) {
339
-					return is_array( $ticket_data ) ? $ticket_data : trim( $ticket_data );
338
+				function($ticket_data) {
339
+					return is_array($ticket_data) ? $ticket_data : trim($ticket_data);
340 340
 				},
341 341
 				$tkt
342 342
 			);
343 343
 
344 344
 			//note we are doing conversions to floats here instead of allowing EE_Money_Field to handle because we're doing calcs prior to using the models.
345 345
 			//note incoming ['TKT_price'] value is already in standard notation (via js).
346
-			$ticket_price = isset( $tkt['TKT_price'] ) ?  round ( (float) $tkt['TKT_price'], 3 ) : 0;
346
+			$ticket_price = isset($tkt['TKT_price']) ? round((float) $tkt['TKT_price'], 3) : 0;
347 347
 
348 348
 			//note incoming base price needs converted from localized value.
349
-			$base_price = isset( $tkt['TKT_base_price'] ) ? EEH_Money::convert_to_float_from_localized_money( $tkt['TKT_base_price'] ) : 0;
349
+			$base_price = isset($tkt['TKT_base_price']) ? EEH_Money::convert_to_float_from_localized_money($tkt['TKT_base_price']) : 0;
350 350
 			//if ticket price == 0 and $base_price != 0 then ticket price == base_price
351 351
 			$ticket_price = $ticket_price === 0 && $base_price !== 0 ? $base_price : $ticket_price;
352
-			$base_price_id = isset( $tkt['TKT_base_price_ID'] ) ? $tkt['TKT_base_price_ID'] : 0;
352
+			$base_price_id = isset($tkt['TKT_base_price_ID']) ? $tkt['TKT_base_price_ID'] : 0;
353 353
 
354 354
 			$price_rows = is_array($data['edit_prices']) && isset($data['edit_prices'][$row]) ? $data['edit_prices'][$row] : array();
355 355
 
356 356
 			$now = null;
357
-			if ( empty( $tkt['TKT_start_date'] ) ) {
357
+			if (empty($tkt['TKT_start_date'])) {
358 358
 				//lets' use now in the set timezone.
359
-				$now = new DateTime( 'now', new DateTimeZone( $evtobj->get_timezone() ) );
360
-				$tkt['TKT_start_date'] = $now->format( $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] );
359
+				$now = new DateTime('now', new DateTimeZone($evtobj->get_timezone()));
360
+				$tkt['TKT_start_date'] = $now->format($this->_date_format_strings['date'].' '.$this->_date_format_strings['time']);
361 361
 			}
362 362
 
363
-			if ( empty( $tkt['TKT_end_date'] ) ) {
363
+			if (empty($tkt['TKT_end_date'])) {
364 364
 				/**
365 365
 				 * set the TKT_end_date to the first datetime attached to the ticket.
366 366
 				 */
367
-				$first_dtt = $saved_dtts[reset( $tkt_dtt_rows )];
368
-				$tkt['TKT_end_date'] = $first_dtt->start_date_and_time( $this->_date_format_strings['date'] . ' ' . $this->_date_format_string['time'] );
367
+				$first_dtt = $saved_dtts[reset($tkt_dtt_rows)];
368
+				$tkt['TKT_end_date'] = $first_dtt->start_date_and_time($this->_date_format_strings['date'].' '.$this->_date_format_string['time']);
369 369
 			}
370 370
 
371 371
 			$TKT_values = array(
372
-				'TKT_ID' 			=> ! empty( $tkt['TKT_ID'] ) ? $tkt['TKT_ID'] : NULL,
373
-				'TTM_ID' 			=> ! empty( $tkt['TTM_ID'] ) ? $tkt['TTM_ID'] : 0,
374
-				'TKT_name' 			=> ! empty( $tkt['TKT_name'] ) ? $tkt['TKT_name'] : '',
375
-				'TKT_description' 	=> ! empty( $tkt['TKT_description'] ) && $tkt['TKT_description'] != __('You can modify this description', 'event_espresso') ? $tkt['TKT_description'] : '',
372
+				'TKT_ID' 			=> ! empty($tkt['TKT_ID']) ? $tkt['TKT_ID'] : NULL,
373
+				'TTM_ID' 			=> ! empty($tkt['TTM_ID']) ? $tkt['TTM_ID'] : 0,
374
+				'TKT_name' 			=> ! empty($tkt['TKT_name']) ? $tkt['TKT_name'] : '',
375
+				'TKT_description' 	=> ! empty($tkt['TKT_description']) && $tkt['TKT_description'] != __('You can modify this description', 'event_espresso') ? $tkt['TKT_description'] : '',
376 376
 				'TKT_start_date' 	=> $tkt['TKT_start_date'],
377 377
 				'TKT_end_date' 		=> $tkt['TKT_end_date'],
378
-				'TKT_qty' 			=> ! isset( $tkt[ 'TKT_qty' ] ) || $tkt[ 'TKT_qty' ] === '' ? EE_INF : $tkt[ 'TKT_qty' ],
379
-				'TKT_uses' 			=> ! isset( $tkt[ 'TKT_uses' ] ) || $tkt[ 'TKT_uses' ] === '' ? EE_INF : $tkt['TKT_uses'],
380
-				'TKT_min' 			=> empty( $tkt['TKT_min'] ) ? 0 : $tkt['TKT_min'],
381
-				'TKT_max' 			=> empty( $tkt['TKT_max'] ) ? EE_INF : $tkt['TKT_max'],
378
+				'TKT_qty' 			=> ! isset($tkt['TKT_qty']) || $tkt['TKT_qty'] === '' ? EE_INF : $tkt['TKT_qty'],
379
+				'TKT_uses' 			=> ! isset($tkt['TKT_uses']) || $tkt['TKT_uses'] === '' ? EE_INF : $tkt['TKT_uses'],
380
+				'TKT_min' 			=> empty($tkt['TKT_min']) ? 0 : $tkt['TKT_min'],
381
+				'TKT_max' 			=> empty($tkt['TKT_max']) ? EE_INF : $tkt['TKT_max'],
382 382
 				'TKT_row' 			=> $row,
383
-				'TKT_order' 		=> isset( $tkt['TKT_order'] ) ? $tkt['TKT_order'] : 0,
384
-				'TKT_taxable' 		=> ! empty( $tkt['TKT_taxable'] ) ? 1 : 0,
385
-				'TKT_required' 		=> ! empty( $tkt['TKT_required'] ) ? 1 : 0,
383
+				'TKT_order' 		=> isset($tkt['TKT_order']) ? $tkt['TKT_order'] : 0,
384
+				'TKT_taxable' 		=> ! empty($tkt['TKT_taxable']) ? 1 : 0,
385
+				'TKT_required' 		=> ! empty($tkt['TKT_required']) ? 1 : 0,
386 386
 				'TKT_price' 		=> $ticket_price
387 387
 			);
388 388
 
389 389
 
390 390
 			//if this is a default TKT, then we need to set the TKT_ID to 0 and update accordingly, which means in turn that the prices will become new prices as well.
391
-			if ( isset( $tkt['TKT_is_default'] ) && $tkt['TKT_is_default'] ) {
391
+			if (isset($tkt['TKT_is_default']) && $tkt['TKT_is_default']) {
392 392
 				$TKT_values['TKT_ID'] = 0;
393 393
 				$TKT_values['TKT_is_default'] = 0;
394 394
 				$update_prices = TRUE;
@@ -400,21 +400,21 @@  discard block
 block discarded – undo
400 400
 			// but DID have it's items modified.
401 401
 			// keep in mind that if the TKT has been sold (and we have changed pricing information),
402 402
 			// then we won't be updating the tkt but instead a new tkt will be created and the old one archived.
403
-			if ( absint( $TKT_values['TKT_ID'] ) ) {
404
-				$TKT = EE_Registry::instance()->load_model( 'Ticket', array( $timezone ) )->get_one_by_ID( $tkt['TKT_ID'] );
405
-				if ( $TKT instanceof EE_Ticket ) {
403
+			if (absint($TKT_values['TKT_ID'])) {
404
+				$TKT = EE_Registry::instance()->load_model('Ticket', array($timezone))->get_one_by_ID($tkt['TKT_ID']);
405
+				if ($TKT instanceof EE_Ticket) {
406 406
 
407
-					$TKT = $this->_update_ticket_datetimes( $TKT, $saved_dtts, $dtts_added, $dtts_removed );
407
+					$TKT = $this->_update_ticket_datetimes($TKT, $saved_dtts, $dtts_added, $dtts_removed);
408 408
 					// are there any registrations using this ticket ?
409 409
 					$tickets_sold = $TKT->count_related(
410 410
 						'Registration',
411
-						array( array(
412
-								'STS_ID' => array( 'NOT IN', array( EEM_Registration::status_id_incomplete ) )
413
-						) )
411
+						array(array(
412
+								'STS_ID' => array('NOT IN', array(EEM_Registration::status_id_incomplete))
413
+						))
414 414
 					);
415 415
 					//set ticket formats
416
-					$TKT->set_date_format( $this->_date_format_strings['date'] );
417
-					$TKT->set_time_format( $this->_date_format_strings['time'] );
416
+					$TKT->set_date_format($this->_date_format_strings['date']);
417
+					$TKT->set_time_format($this->_date_format_strings['time']);
418 418
 
419 419
 					// let's just check the total price for the existing ticket
420 420
 					// and determine if it matches the new total price.
@@ -424,17 +424,17 @@  discard block
 block discarded – undo
424 424
 							? TRUE : FALSE;
425 425
 
426 426
 					//set new values
427
-					foreach ( $TKT_values as $field => $value ) {
428
-						if ( $field === 'TKT_qty' ) {
429
-							$TKT->set_qty( $value );
427
+					foreach ($TKT_values as $field => $value) {
428
+						if ($field === 'TKT_qty') {
429
+							$TKT->set_qty($value);
430 430
 						} else {
431
-							$TKT->set( $field, $value );
431
+							$TKT->set($field, $value);
432 432
 						}
433 433
 					}
434 434
 
435 435
 					//if $create_new_TKT is false then we can safely update the existing ticket.  Otherwise we have to create a new ticket.
436
-					if ( $create_new_TKT ) {
437
-						$new_tkt = $this->_duplicate_ticket( $TKT, $price_rows, $ticket_price, $base_price, $base_price_id );
436
+					if ($create_new_TKT) {
437
+						$new_tkt = $this->_duplicate_ticket($TKT, $price_rows, $ticket_price, $base_price, $base_price_id);
438 438
 					}
439 439
 				}
440 440
 
@@ -443,12 +443,12 @@  discard block
 block discarded – undo
443 443
 				$TKT = EE_Ticket::new_instance(
444 444
 					$TKT_values,
445 445
 					$timezone,
446
-					array( $this->_date_format_strings[ 'date' ], $this->_date_format_strings[ 'time' ]  )
446
+					array($this->_date_format_strings['date'], $this->_date_format_strings['time'])
447 447
 				);
448
-				if ( $TKT instanceof EE_Ticket ) {
448
+				if ($TKT instanceof EE_Ticket) {
449 449
 					// make sure ticket has an ID of setting relations won't work
450 450
 					$TKT->save();
451
-					$TKT = $this->_update_ticket_datetimes( $TKT, $saved_dtts, $dtts_added, $dtts_removed );
451
+					$TKT = $this->_update_ticket_datetimes($TKT, $saved_dtts, $dtts_added, $dtts_removed);
452 452
 					$update_prices = TRUE;
453 453
 				}
454 454
 			}
@@ -456,37 +456,37 @@  discard block
 block discarded – undo
456 456
 			//$TKT->save();
457 457
 
458 458
 			//before going any further make sure our dates are setup correctly so that the end date is always equal or greater than the start date.
459
-			if( $TKT->get_raw('TKT_start_date') > $TKT->get_raw('TKT_end_date') ) {
460
-				$TKT->set('TKT_end_date', $TKT->get('TKT_start_date') );
459
+			if ($TKT->get_raw('TKT_start_date') > $TKT->get_raw('TKT_end_date')) {
460
+				$TKT->set('TKT_end_date', $TKT->get('TKT_start_date'));
461 461
 				$TKT = EEH_DTT_Helper::date_time_add($TKT, 'TKT_end_date', 'days');
462 462
 			}
463 463
 
464 464
 			//let's make sure the base price is handled
465
-			$TKT = ! $create_new_TKT ? $this->_add_prices_to_ticket( array(), $TKT, $update_prices, $base_price, $base_price_id ) : $TKT;
465
+			$TKT = ! $create_new_TKT ? $this->_add_prices_to_ticket(array(), $TKT, $update_prices, $base_price, $base_price_id) : $TKT;
466 466
 
467 467
 			//add/update price_modifiers
468
-			$TKT = ! $create_new_TKT ? $this->_add_prices_to_ticket( $price_rows, $TKT, $update_prices ) : $TKT;
468
+			$TKT = ! $create_new_TKT ? $this->_add_prices_to_ticket($price_rows, $TKT, $update_prices) : $TKT;
469 469
 
470 470
 			//need to make sue that the TKT_price is accurate after saving the prices.
471 471
 			$TKT->ensure_TKT_Price_correct();
472 472
 
473 473
 			//handle CREATING a default tkt from the incoming tkt but ONLY if this isn't an autosave.
474
-			if ( ! defined('DOING_AUTOSAVE' ) ) {
475
-				if ( !empty($tkt['TKT_is_default_selector'] ) ) {
474
+			if ( ! defined('DOING_AUTOSAVE')) {
475
+				if ( ! empty($tkt['TKT_is_default_selector'])) {
476 476
 					$update_prices = TRUE;
477 477
 					$new_default = clone $TKT;
478
-					$new_default->set( 'TKT_ID', 0 );
479
-					$new_default->set( 'TKT_is_default', 1 );
480
-					$new_default->set( 'TKT_row', 1 );
481
-					$new_default->set( 'TKT_price', $ticket_price );
478
+					$new_default->set('TKT_ID', 0);
479
+					$new_default->set('TKT_is_default', 1);
480
+					$new_default->set('TKT_row', 1);
481
+					$new_default->set('TKT_price', $ticket_price);
482 482
 					//remove any dtt relations cause we DON'T want dtt relations attached (note this is just removing the cached relations in the object)
483 483
 					$new_default->_remove_relations('Datetime');
484 484
 					//todo we need to add the current attached prices as new prices to the new default ticket.
485
-					$new_default = $this->_add_prices_to_ticket( $price_rows, $new_default, $update_prices );
485
+					$new_default = $this->_add_prices_to_ticket($price_rows, $new_default, $update_prices);
486 486
 					//don't forget the base price!
487
-					$new_default = $this->_add_prices_to_ticket( array(), $new_default, $update_prices, $base_price, $base_price_id );
487
+					$new_default = $this->_add_prices_to_ticket(array(), $new_default, $update_prices, $base_price, $base_price_id);
488 488
 					$new_default->save();
489
-					do_action( 'AHEE__espresso_events_Pricing_Hooks___update_tkts_new_default_ticket', $new_default, $row, $TKT, $data );
489
+					do_action('AHEE__espresso_events_Pricing_Hooks___update_tkts_new_default_ticket', $new_default, $row, $TKT, $data);
490 490
 				}
491 491
 			}
492 492
 
@@ -497,19 +497,19 @@  discard block
 block discarded – undo
497 497
 			//let's assign any tickets that have been setup to the saved_tickets tracker
498 498
 			//save existing TKT
499 499
 			$TKT->save();
500
-			if ( $create_new_TKT && $new_tkt instanceof EE_Ticket ) {
500
+			if ($create_new_TKT && $new_tkt instanceof EE_Ticket) {
501 501
 				//save new TKT
502 502
 				$new_tkt->save();
503 503
 				//add new ticket to array
504
-				$saved_tickets[ $new_tkt->ID() ] = $new_tkt;
504
+				$saved_tickets[$new_tkt->ID()] = $new_tkt;
505 505
 
506
-				do_action( 'AHEE__espresso_events_Pricing_Hooks___update_tkts_new_ticket', $new_tkt, $row, $tkt, $data );
506
+				do_action('AHEE__espresso_events_Pricing_Hooks___update_tkts_new_ticket', $new_tkt, $row, $tkt, $data);
507 507
 
508 508
 			} else {
509 509
 				//add tkt to saved tkts
510
-				$saved_tickets[ $TKT->ID() ] = $TKT;
510
+				$saved_tickets[$TKT->ID()] = $TKT;
511 511
 
512
-				do_action( 'AHEE__espresso_events_Pricing_Hooks___update_tkts_update_ticket', $TKT, $row, $tkt, $data );
512
+				do_action('AHEE__espresso_events_Pricing_Hooks___update_tkts_update_ticket', $TKT, $row, $tkt, $data);
513 513
 			}
514 514
 
515 515
 		}
@@ -519,22 +519,22 @@  discard block
 block discarded – undo
519 519
 		// (i.e. autosaves are happening and then in between autosaves the user trashes a ticket).
520 520
 		// Or a draft event was saved and in the process of editing a ticket is trashed.
521 521
 		// No sense in keeping all the related data in the db!
522
-		$old_tickets = isset( $old_tickets[0] ) && $old_tickets[0] == '' ? array() : $old_tickets;
523
-		$tickets_removed = array_diff( $old_tickets, array_keys($saved_tickets) );
522
+		$old_tickets = isset($old_tickets[0]) && $old_tickets[0] == '' ? array() : $old_tickets;
523
+		$tickets_removed = array_diff($old_tickets, array_keys($saved_tickets));
524 524
 
525
-		foreach ( $tickets_removed as $id ) {
526
-			$id = absint( $id );
525
+		foreach ($tickets_removed as $id) {
526
+			$id = absint($id);
527 527
 
528 528
 			//get the ticket for this id
529 529
 			$tkt_to_remove = EE_Registry::instance()->load_model('Ticket')->get_one_by_ID($id);
530 530
 
531 531
 			//if this tkt is a default tkt we leave it alone cause it won't be attached to the datetime
532
-			if ( $tkt_to_remove->get('TKT_is_default') )
532
+			if ($tkt_to_remove->get('TKT_is_default'))
533 533
 				continue;
534 534
 
535 535
 			// if this tkt has any registrations attached so then we just ARCHIVE
536 536
 			// because we don't actually permanently delete these tickets.
537
-			if ( $tkt_to_remove->count_related('Registration') > 0 ) {
537
+			if ($tkt_to_remove->count_related('Registration') > 0) {
538 538
 				$tkt_to_remove->delete();
539 539
 				continue;
540 540
 			}
@@ -543,7 +543,7 @@  discard block
 block discarded – undo
543 543
 			// (remember this process can ONLY kick off if there are NO tkts_sold)
544 544
 			$dtts = $tkt_to_remove->get_many_related('Datetime');
545 545
 
546
-			foreach( $dtts as $dtt ) {
546
+			foreach ($dtts as $dtt) {
547 547
 				$tkt_to_remove->_remove_relation_to($dtt, 'Datetime');
548 548
 			}
549 549
 
@@ -551,7 +551,7 @@  discard block
 block discarded – undo
551 551
 			// tickets can only be trashed if they don't have any TKTs sold (otherwise they are just archived))
552 552
 			$tkt_to_remove->delete_related_permanently('Price');
553 553
 
554
-			do_action( 'AHEE__espresso_events_Pricing_Hooks___update_tkts_delete_ticket', $tkt_to_remove );
554
+			do_action('AHEE__espresso_events_Pricing_Hooks___update_tkts_delete_ticket', $tkt_to_remove);
555 555
 
556 556
 			// finally let's delete this ticket
557 557
 			// (which should not be blocked at this point b/c we've removed all our relationships)
@@ -583,39 +583,39 @@  discard block
 block discarded – undo
583 583
 		// and removing the ticket from datetimes it got removed from.
584 584
 
585 585
 		// first let's add datetimes
586
-		if ( ! empty( $added_datetimes ) && is_array( $added_datetimes ) ) {
587
-			foreach ( $added_datetimes as $row_id ) {
586
+		if ( ! empty($added_datetimes) && is_array($added_datetimes)) {
587
+			foreach ($added_datetimes as $row_id) {
588 588
 				$row_id = (int) $row_id;
589
-				if ( isset( $saved_datetimes[ $row_id ] ) && $saved_datetimes[ $row_id ] instanceof EE_Datetime ) {
590
-					$ticket->_add_relation_to( $saved_datetimes[ $row_id ], 'Datetime' );
589
+				if (isset($saved_datetimes[$row_id]) && $saved_datetimes[$row_id] instanceof EE_Datetime) {
590
+					$ticket->_add_relation_to($saved_datetimes[$row_id], 'Datetime');
591 591
 					// Is this an existing ticket (has an ID) and does it have any sold?
592 592
 					// If so, then we need to add that to the DTT sold because this DTT is getting added.
593
-					if ( $ticket->ID() && $ticket->sold() > 0 ) {
594
-						$saved_datetimes[ $row_id ]->increase_sold( $ticket->sold() );
595
-						$saved_datetimes[ $row_id ]->save();
593
+					if ($ticket->ID() && $ticket->sold() > 0) {
594
+						$saved_datetimes[$row_id]->increase_sold($ticket->sold());
595
+						$saved_datetimes[$row_id]->save();
596 596
 					}
597 597
 				}
598 598
 			}
599 599
 		}
600 600
 		// then remove datetimes
601
-		if ( ! empty( $removed_datetimes ) && is_array( $removed_datetimes ) ) {
602
-			foreach ( $removed_datetimes as $row_id ) {
603
-				$row_id = (int)$row_id;
601
+		if ( ! empty($removed_datetimes) && is_array($removed_datetimes)) {
602
+			foreach ($removed_datetimes as $row_id) {
603
+				$row_id = (int) $row_id;
604 604
 				// its entirely possible that a datetime got deleted (instead of just removed from relationship.
605 605
 				// So make sure we skip over this if the dtt isn't in the $saved_datetimes array)
606
-				if ( isset( $saved_datetimes[ $row_id ] ) && $saved_datetimes[ $row_id ] instanceof EE_Datetime ) {
607
-					$ticket->_remove_relation_to( $saved_datetimes[ $row_id ], 'Datetime' );
606
+				if (isset($saved_datetimes[$row_id]) && $saved_datetimes[$row_id] instanceof EE_Datetime) {
607
+					$ticket->_remove_relation_to($saved_datetimes[$row_id], 'Datetime');
608 608
 					// Is this an existing ticket (has an ID) and does it have any sold?
609 609
 					// If so, then we need to remove it's sold from the DTT_sold.
610
-					if ( $ticket->ID() && $ticket->sold() > 0 ) {
611
-						$saved_datetimes[ $row_id ]->decrease_sold( $ticket->sold() );
612
-						$saved_datetimes[ $row_id ]->save();
610
+					if ($ticket->ID() && $ticket->sold() > 0) {
611
+						$saved_datetimes[$row_id]->decrease_sold($ticket->sold());
612
+						$saved_datetimes[$row_id]->save();
613 613
 					}
614 614
 				}
615 615
 			}
616 616
 		}
617 617
 		// cap ticket qty by datetime reg limits
618
-		$ticket->set_qty( min( $ticket->qty(), $ticket->qty( 'reg_limit' ) ) );
618
+		$ticket->set_qty(min($ticket->qty(), $ticket->qty('reg_limit')));
619 619
 		return $ticket;
620 620
 	}
621 621
 
@@ -636,39 +636,39 @@  discard block
 block discarded – undo
636 636
 		EE_Ticket $ticket,
637 637
 		$price_rows = array(),
638 638
 		$ticket_price = 0,
639
-		$base_price = 0 ,
639
+		$base_price = 0,
640 640
 		$base_price_id = 0
641 641
 	) {
642 642
 
643 643
 		// create new ticket that's a copy of the existing
644 644
 		// except a new id of course (and not archived)
645 645
 		// AND has the new TKT_price associated with it.
646
-		$new_ticket = clone( $ticket );
647
-		$new_ticket->set( 'TKT_ID', 0 );
648
-		$new_ticket->set( 'TKT_deleted', 0 );
649
-		$new_ticket->set( 'TKT_price', $ticket_price );
650
-		$new_ticket->set( 'TKT_sold', 0 );
646
+		$new_ticket = clone($ticket);
647
+		$new_ticket->set('TKT_ID', 0);
648
+		$new_ticket->set('TKT_deleted', 0);
649
+		$new_ticket->set('TKT_price', $ticket_price);
650
+		$new_ticket->set('TKT_sold', 0);
651 651
 		// let's get a new ID for this ticket
652 652
 		$new_ticket->save();
653 653
 		// we also need to make sure this new ticket gets the same datetime attachments as the archived ticket
654
-		$datetimes_on_existing = $ticket->get_many_related( 'Datetime' );
654
+		$datetimes_on_existing = $ticket->get_many_related('Datetime');
655 655
 		$new_ticket = $this->_update_ticket_datetimes(
656 656
 			$new_ticket,
657 657
 			$datetimes_on_existing,
658
-			array_keys( $datetimes_on_existing )
658
+			array_keys($datetimes_on_existing)
659 659
 		);
660 660
 
661 661
 		// $ticket will get archived later b/c we are NOT adding it to the saved_tickets array.
662 662
 		// if existing $ticket has sold amount, then we need to adjust the qty for the new TKT to = the remaining
663 663
 		// available.
664
-		if ( $ticket->sold() > 0 ) {
664
+		if ($ticket->sold() > 0) {
665 665
 			$new_qty = $ticket->qty() - $ticket->sold();
666
-			$new_ticket->set_qty( $new_qty );
666
+			$new_ticket->set_qty($new_qty);
667 667
 		}
668 668
 		//now we update the prices just for this ticket
669
-		$new_ticket = $this->_add_prices_to_ticket( $price_rows, $new_ticket, true );
669
+		$new_ticket = $this->_add_prices_to_ticket($price_rows, $new_ticket, true);
670 670
 		//and we update the base price
671
-		$new_ticket = $this->_add_prices_to_ticket( array(), $new_ticket, true, $base_price, $base_price_id );
671
+		$new_ticket = $this->_add_prices_to_ticket(array(), $new_ticket, true, $base_price, $base_price_id);
672 672
 		return $new_ticket;
673 673
 	}
674 674
 
@@ -688,7 +688,7 @@  discard block
 block discarded – undo
688 688
 	 * @param int|bool 		$base_price_id  if present then this is the base_price_id being updated.
689 689
 	 * @return EE_Ticket
690 690
 	 */
691
-	protected function  _add_prices_to_ticket( $prices = array(), EE_Ticket $ticket, $new_prices = FALSE, $base_price = FALSE, $base_price_id = FALSE ) {
691
+	protected function  _add_prices_to_ticket($prices = array(), EE_Ticket $ticket, $new_prices = FALSE, $base_price = FALSE, $base_price_id = FALSE) {
692 692
 
693 693
 		//let's just get any current prices that may exist on the given ticket so we can remove any prices that got trashed in this session.
694 694
 		$current_prices_on_ticket = $base_price !== FALSE ? $ticket->base_price(TRUE) : $ticket->price_modifiers();
@@ -696,7 +696,7 @@  discard block
 block discarded – undo
696 696
 		$updated_prices = array();
697 697
 
698 698
 		// if $base_price ! FALSE then updating a base price.
699
-		if ( $base_price !== FALSE ) {
699
+		if ($base_price !== FALSE) {
700 700
 			$prices[1] = array(
701 701
 				'PRC_ID' => $new_prices || $base_price_id === 1 ? NULL : $base_price_id,
702 702
 				'PRT_ID' => 1,
@@ -707,47 +707,47 @@  discard block
 block discarded – undo
707 707
 		}
708 708
 
709 709
 		//possibly need to save tkt
710
-		if ( ! $ticket->ID() )
710
+		if ( ! $ticket->ID())
711 711
 			$ticket->save();
712 712
 
713
-		foreach ( $prices as $row => $prc ) {
714
-			$prt_id = !empty( $prc['PRT_ID'] ) ? $prc['PRT_ID'] : NULL;
715
-			if ( empty($prt_id) )
713
+		foreach ($prices as $row => $prc) {
714
+			$prt_id = ! empty($prc['PRT_ID']) ? $prc['PRT_ID'] : NULL;
715
+			if (empty($prt_id))
716 716
 				continue; //prices MUST have a price type id.
717 717
 			$PRC_values = array(
718
-				'PRC_ID' => !empty( $prc['PRC_ID'] ) ? $prc['PRC_ID'] : NULL,
718
+				'PRC_ID' => ! empty($prc['PRC_ID']) ? $prc['PRC_ID'] : NULL,
719 719
 				'PRT_ID' => $prt_id,
720
-				'PRC_amount' => !empty( $prc['PRC_amount'] ) ? $prc['PRC_amount'] : 0,
721
-				'PRC_name' => !empty( $prc['PRC_name'] ) ? $prc['PRC_name'] : '',
722
-				'PRC_desc' => !empty( $prc['PRC_desc'] ) ? $prc['PRC_desc'] : '',
720
+				'PRC_amount' => ! empty($prc['PRC_amount']) ? $prc['PRC_amount'] : 0,
721
+				'PRC_name' => ! empty($prc['PRC_name']) ? $prc['PRC_name'] : '',
722
+				'PRC_desc' => ! empty($prc['PRC_desc']) ? $prc['PRC_desc'] : '',
723 723
 				'PRC_is_default' => false, //make sure we set PRC_is_default to false for all ticket saves from event_editor
724 724
 				'PRC_order' => $row
725 725
 				);
726
-			if ( $new_prices || empty( $PRC_values['PRC_ID'] ) ) {
726
+			if ($new_prices || empty($PRC_values['PRC_ID'])) {
727 727
 				$PRC_values['PRC_ID'] = 0;
728
-				$PRC = EE_Registry::instance()->load_class('Price', array( $PRC_values ), FALSE, FALSE);
728
+				$PRC = EE_Registry::instance()->load_class('Price', array($PRC_values), FALSE, FALSE);
729 729
 			} else {
730
-				$PRC = EE_Registry::instance()->load_model( 'Price' )->get_one_by_ID( $prc['PRC_ID'] );
730
+				$PRC = EE_Registry::instance()->load_model('Price')->get_one_by_ID($prc['PRC_ID']);
731 731
 				//update this price with new values
732
-				foreach ( $PRC_values as $field => $newprc ) {
733
-					$PRC->set( $field, $newprc );
732
+				foreach ($PRC_values as $field => $newprc) {
733
+					$PRC->set($field, $newprc);
734 734
 				}
735 735
 			}
736 736
 			$PRC->save();
737 737
 			$prcid = $PRC->ID();
738 738
 			$updated_prices[$prcid] = $PRC;
739
-			$ticket->_add_relation_to( $PRC, 'Price' );
739
+			$ticket->_add_relation_to($PRC, 'Price');
740 740
 		}
741 741
 
742 742
 		//now let's remove any prices that got removed from the ticket
743
-		if ( !empty ( $current_prices_on_ticket ) ) {
743
+		if ( ! empty ($current_prices_on_ticket)) {
744 744
 			$current = array_keys($current_prices_on_ticket);
745 745
 			$updated = array_keys($updated_prices);
746 746
 			$prices_to_remove = array_diff($current, $updated);
747
-			if ( !empty( $prices_to_remove ) ) {
748
-				foreach ( $prices_to_remove as $prc_id ) {
747
+			if ( ! empty($prices_to_remove)) {
748
+				foreach ($prices_to_remove as $prc_id) {
749 749
 					$p = $current_prices_on_ticket[$prc_id];
750
-					$ticket->_remove_relation_to( $p, 'Price' );
750
+					$ticket->_remove_relation_to($p, 'Price');
751 751
 
752 752
 					//delete permanently the price
753 753
 					$p->delete_permanently();
@@ -760,7 +760,7 @@  discard block
 block discarded – undo
760 760
 
761 761
 
762 762
 
763
-	public function autosave_handling( $event_admin_obj ) {
763
+	public function autosave_handling($event_admin_obj) {
764 764
 		return $event_admin_obj; //doing nothing for the moment.
765 765
 		//todo when I get to this remember that I need to set the template args on the $event_admin_obj (use the set_template_args() method)
766 766
 
@@ -794,12 +794,12 @@  discard block
 block discarded – undo
794 794
 
795 795
 		//default main template args
796 796
 		$main_template_args = array(
797
-			'event_datetime_help_link' => EEH_Template::get_help_tab_link('event_editor_event_datetimes_help_tab', $this->_adminpage_obj->page_slug, $this->_adminpage_obj->get_req_action(), FALSE, FALSE ), //todo need to add a filter to the template for the help text in the Events_Admin_Page core file so we can add further help
797
+			'event_datetime_help_link' => EEH_Template::get_help_tab_link('event_editor_event_datetimes_help_tab', $this->_adminpage_obj->page_slug, $this->_adminpage_obj->get_req_action(), FALSE, FALSE), //todo need to add a filter to the template for the help text in the Events_Admin_Page core file so we can add further help
798 798
 			'existing_datetime_ids' => '',
799 799
 			'total_dtt_rows' => 1,
800
-			'add_new_dtt_help_link' => EEH_Template::get_help_tab_link('add_new_dtt_info', $this->_adminpage_obj->page_slug, $this->_adminpage_obj->get_req_action(), FALSE, FALSE ), //todo need to add this help info id to the Events_Admin_Page core file so we can access it here.
800
+			'add_new_dtt_help_link' => EEH_Template::get_help_tab_link('add_new_dtt_info', $this->_adminpage_obj->page_slug, $this->_adminpage_obj->get_req_action(), FALSE, FALSE), //todo need to add this help info id to the Events_Admin_Page core file so we can access it here.
801 801
 			'datetime_rows' => '',
802
-			'show_tickets_container' => '',//$this->_adminpage_obj->get_cpt_model_obj()->ID() > 1 ? ' style="display:none;"' : '',
802
+			'show_tickets_container' => '', //$this->_adminpage_obj->get_cpt_model_obj()->ID() > 1 ? ' style="display:none;"' : '',
803 803
 			'ticket_rows' => '',
804 804
 			'existing_ticket_ids' => '',
805 805
 			'total_ticket_rows' => 1,
@@ -809,7 +809,7 @@  discard block
 block discarded – undo
809 809
 
810 810
 		$timezone = $evtobj instanceof EE_Event ? $evtobj->timezone_string() : NULL;
811 811
 
812
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
812
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
813 813
 
814 814
 		/**
815 815
 		 * 1. Start with retrieving Datetimes
@@ -817,8 +817,8 @@  discard block
 block discarded – undo
817 817
 		 * 3. For each ticket get related prices
818 818
 		 */
819 819
 
820
-		$DTM = EE_Registry::instance()->load_model('Datetime', array($timezone) );
821
-		$times = $DTM->get_all_event_dates( $evtID );
820
+		$DTM = EE_Registry::instance()->load_model('Datetime', array($timezone));
821
+		$times = $DTM->get_all_event_dates($evtID);
822 822
 
823 823
 
824 824
 
@@ -826,31 +826,31 @@  discard block
 block discarded – undo
826 826
 
827 827
 		/** @see https://events.codebasehq.com/projects/event-espresso/tickets/9486 for why we are counting $dttrow and then setting that on the Datetime object */
828 828
 		$dttrow = 1;
829
-		foreach ( $times as $time ) {
829
+		foreach ($times as $time) {
830 830
 			$dttid = $time->get('DTT_ID');
831
-			$time->set( 'DTT_order', $dttrow );
831
+			$time->set('DTT_order', $dttrow);
832 832
 			$existing_datetime_ids[] = $dttid;
833 833
 
834 834
 			//tickets attached
835
-			$related_tickets = $time->ID() > 0 ? $time->get_many_related('Ticket', array( array( 'OR' => array( 'TKT_deleted' => 1, 'TKT_deleted*' => 0 ) ), 'default_where_conditions' => 'none', 'order_by' => array('TKT_order' => 'ASC' ) ) ) : array();
835
+			$related_tickets = $time->ID() > 0 ? $time->get_many_related('Ticket', array(array('OR' => array('TKT_deleted' => 1, 'TKT_deleted*' => 0)), 'default_where_conditions' => 'none', 'order_by' => array('TKT_order' => 'ASC'))) : array();
836 836
 
837 837
 			//if there are no related tickets this is likely a new event OR autodraft
838 838
 			// event so we need to generate the default tickets because dtts
839 839
 			// ALWAYS have at least one related ticket!!.  EXCEPT, we dont' do this if there is already more than one
840 840
 			// datetime on the event.
841
-			if ( empty ( $related_tickets ) && count( $times ) < 2 ) {
841
+			if (empty ($related_tickets) && count($times) < 2) {
842 842
 				$related_tickets = EE_Registry::instance()->load_model('Ticket')->get_all_default_tickets();
843 843
 
844 844
 				//this should be ordered by TKT_ID, so let's grab the first default ticket (which will be the main default) and ensure it has any default prices added to it (but do NOT save).
845 845
 				$default_prices = EEM_Price::instance()->get_all_default_prices();
846 846
 
847
-				$main_default_ticket = reset( $related_tickets );
848
-				if ( $main_default_ticket instanceof EE_Ticket ) {
849
-					foreach ( $default_prices as $default_price ) {
850
-						if ( $default_price->is_base_price() ) {
847
+				$main_default_ticket = reset($related_tickets);
848
+				if ($main_default_ticket instanceof EE_Ticket) {
849
+					foreach ($default_prices as $default_price) {
850
+						if ($default_price->is_base_price()) {
851 851
 							continue;
852 852
 						}
853
-						$main_default_ticket->cache( 'Price', $default_price );
853
+						$main_default_ticket->cache('Price', $default_price);
854 854
 					}
855 855
 				}
856 856
 			}
@@ -859,11 +859,11 @@  discard block
 block discarded – undo
859 859
 			//we can't actually setup rows in this loop yet cause we don't know all the unique tickets for this event yet (tickets are linked through all datetimes). So we're going to temporarily cache some of that information.
860 860
 
861 861
 			//loop through and setup the ticket rows and make sure the order is set.
862
-			foreach ( $related_tickets as $ticket ) {
862
+			foreach ($related_tickets as $ticket) {
863 863
 				$tktid = $ticket->get('TKT_ID');
864 864
 				$tktrow = $ticket->get('TKT_row');
865 865
 				//we only want unique tickets in our final display!!
866
-				if ( !in_array( $tktid, $existing_ticket_ids ) ) {
866
+				if ( ! in_array($tktid, $existing_ticket_ids)) {
867 867
 					$existing_ticket_ids[] = $tktid;
868 868
 					$all_tickets[] = $ticket;
869 869
 				}
@@ -872,57 +872,57 @@  discard block
 block discarded – undo
872 872
 				$datetime_tickets[$dttid][] = $tktrow;
873 873
 
874 874
 				//temporary cache of this datetime info for this ticket for later processing of ticket rows.
875
-				if ( !isset( $ticket_datetimes[$tktid] ) || ! in_array( $dttrow, $ticket_datetimes[$tktid] ) )
875
+				if ( ! isset($ticket_datetimes[$tktid]) || ! in_array($dttrow, $ticket_datetimes[$tktid]))
876 876
 					$ticket_datetimes[$tktid][] = $dttrow;
877 877
 			}
878 878
 			$dttrow++;
879 879
 		}
880 880
 
881
-		$main_template_args['total_ticket_rows'] = count( $existing_ticket_ids );
882
-		$main_template_args['existing_ticket_ids'] = implode( ',', $existing_ticket_ids );
883
-		$main_template_args['existing_datetime_ids'] = implode( ',', $existing_datetime_ids );
881
+		$main_template_args['total_ticket_rows'] = count($existing_ticket_ids);
882
+		$main_template_args['existing_ticket_ids'] = implode(',', $existing_ticket_ids);
883
+		$main_template_args['existing_datetime_ids'] = implode(',', $existing_datetime_ids);
884 884
 
885 885
 		//sort $all_tickets by order
886
-		usort( $all_tickets, function( $a, $b ) {
886
+		usort($all_tickets, function($a, $b) {
887 887
 			$a_order = (int) $a->get('TKT_order');
888 888
 			$b_order = (int) $b->get('TKT_order');
889
-			if ( $a_order == $b_order ) {
889
+			if ($a_order == $b_order) {
890 890
 				return 0;
891 891
 			}
892
-			return ( $a_order < $b_order ) ? -1 : 1;
892
+			return ($a_order < $b_order) ? -1 : 1;
893 893
 		});
894 894
 
895 895
 		//k NOW we have all the data we need for setting up the dtt rows and ticket rows so we start our dtt loop again.
896 896
 		$dttrow = 1;
897
-		foreach ( $times as $time ) {
898
-			$main_template_args['datetime_rows'] .= $this->_get_datetime_row( $dttrow, $time, $datetime_tickets, $all_tickets, FALSE, $times );
897
+		foreach ($times as $time) {
898
+			$main_template_args['datetime_rows'] .= $this->_get_datetime_row($dttrow, $time, $datetime_tickets, $all_tickets, FALSE, $times);
899 899
 			$dttrow++;
900 900
 		}
901 901
 
902 902
 		//then loop through all tickets for the ticket rows.
903 903
 		$tktrow = 1;
904
-		foreach ( $all_tickets as $ticket ) {
905
-			$main_template_args['ticket_rows'] .= $this->_get_ticket_row( $tktrow, $ticket, $ticket_datetimes, $times, FALSE, $all_tickets );
904
+		foreach ($all_tickets as $ticket) {
905
+			$main_template_args['ticket_rows'] .= $this->_get_ticket_row($tktrow, $ticket, $ticket_datetimes, $times, FALSE, $all_tickets);
906 906
 			$tktrow++;
907 907
 		}
908 908
 
909 909
 		$main_template_args['ticket_js_structure'] = $this->_get_ticket_js_structure($times, $all_tickets);
910
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_metabox_main.template.php';
911
-		EEH_Template::display_template( $template, $main_template_args );
910
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_metabox_main.template.php';
911
+		EEH_Template::display_template($template, $main_template_args);
912 912
 		return;
913 913
 	}
914 914
 
915 915
 
916 916
 
917
-	protected function _get_datetime_row( $dttrow, EE_Datetime $dtt, $datetime_tickets, $all_tickets, $default = FALSE, $all_dtts = array() ) {
917
+	protected function _get_datetime_row($dttrow, EE_Datetime $dtt, $datetime_tickets, $all_tickets, $default = FALSE, $all_dtts = array()) {
918 918
 
919 919
 		$dtt_display_template_args = array(
920
-			'dtt_edit_row' => $this->_get_dtt_edit_row( $dttrow, $dtt, $default, $all_dtts ),
921
-			'dtt_attached_tickets_row' => $this->_get_dtt_attached_tickets_row( $dttrow, $dtt, $datetime_tickets, $all_tickets, $default ),
920
+			'dtt_edit_row' => $this->_get_dtt_edit_row($dttrow, $dtt, $default, $all_dtts),
921
+			'dtt_attached_tickets_row' => $this->_get_dtt_attached_tickets_row($dttrow, $dtt, $datetime_tickets, $all_tickets, $default),
922 922
 			'dtt_row' => $default ? 'DTTNUM' : $dttrow
923 923
 			);
924
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_row_wrapper.template.php';
925
-		return EEH_Template::display_template( $template, $dtt_display_template_args, TRUE);
924
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_row_wrapper.template.php';
925
+		return EEH_Template::display_template($template, $dtt_display_template_args, TRUE);
926 926
 	}
927 927
 
928 928
 
@@ -940,7 +940,7 @@  discard block
 block discarded – undo
940 940
 	 *
941 941
 	 * @return string Generated edit row.
942 942
 	 */
943
-	protected function _get_dtt_edit_row( $dttrow, $dtt, $default, $all_dtts ) {
943
+	protected function _get_dtt_edit_row($dttrow, $dtt, $default, $all_dtts) {
944 944
 
945 945
 		// if the incoming $dtt object is NOT an instance of EE_Datetime then force default to true.
946 946
 		$default = ! $dtt instanceof EE_Datetime ? true : false;
@@ -948,36 +948,36 @@  discard block
 block discarded – undo
948 948
 		$template_args = array(
949 949
 			'dtt_row' => $default ? 'DTTNUM' : $dttrow,
950 950
 			'event_datetimes_name' => $default ? 'DTTNAMEATTR' : 'edit_event_datetimes',
951
-			'edit_dtt_expanded' => '',//$this->_adminpage_obj->get_cpt_model_obj()->ID() > 0 ? '' : ' ee-edit-editing',
951
+			'edit_dtt_expanded' => '', //$this->_adminpage_obj->get_cpt_model_obj()->ID() > 0 ? '' : ' ee-edit-editing',
952 952
 			'DTT_ID' => $default ? '' : $dtt->ID(),
953 953
 			'DTT_name' => $default ? '' : $dtt->name(),
954 954
 			'DTT_description' => $default ? '' : $dtt->description(),
955
-			'DTT_EVT_start' => $default ? '' : $dtt->start_date( $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] ),
956
-			'DTT_EVT_end' => $default ? '' : $dtt->end_date( $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] ),
957
-			'DTT_reg_limit' => $default ? '' : $dtt->get_pretty('DTT_reg_limit','input'),
955
+			'DTT_EVT_start' => $default ? '' : $dtt->start_date($this->_date_format_strings['date'].' '.$this->_date_format_strings['time']),
956
+			'DTT_EVT_end' => $default ? '' : $dtt->end_date($this->_date_format_strings['date'].' '.$this->_date_format_strings['time']),
957
+			'DTT_reg_limit' => $default ? '' : $dtt->get_pretty('DTT_reg_limit', 'input'),
958 958
 			'DTT_order' => $default ? 'DTTNUM' : $dttrow,
959 959
 			'dtt_sold' => $default ? '0' : $dtt->get('DTT_sold'),
960
-			'clone_icon' => !empty( $dtt ) && $dtt->get('DTT_sold') > 0 ? '' : 'clone-icon ee-icon ee-icon-clone clickable',
961
-			'trash_icon' => !empty( $dtt ) && $dtt->get('DTT_sold') > 0  ? 'ee-lock-icon' : 'trash-icon dashicons dashicons-post-trash clickable',
960
+			'clone_icon' => ! empty($dtt) && $dtt->get('DTT_sold') > 0 ? '' : 'clone-icon ee-icon ee-icon-clone clickable',
961
+			'trash_icon' => ! empty($dtt) && $dtt->get('DTT_sold') > 0 ? 'ee-lock-icon' : 'trash-icon dashicons dashicons-post-trash clickable',
962 962
 		    'reg_list_url' => $default || ! $dtt->event() instanceof \EE_Event
963 963
                 ? ''
964 964
                 : EE_Admin_Page::add_query_args_and_nonce(
965
-                    array( 'event_id' => $dtt->event()->ID(), 'datetime_id' => $dtt->ID() ),
965
+                    array('event_id' => $dtt->event()->ID(), 'datetime_id' => $dtt->ID()),
966 966
                     REG_ADMIN_URL
967 967
                 )
968 968
 		);
969 969
 
970
-		$template_args['show_trash'] = count( $all_dtts ) === 1 && $template_args['trash_icon'] !== 'ee-lock-icon' ? ' style="display:none"' : '';
970
+		$template_args['show_trash'] = count($all_dtts) === 1 && $template_args['trash_icon'] !== 'ee-lock-icon' ? ' style="display:none"' : '';
971 971
 
972 972
 		//allow filtering of template args at this point.
973
-		$template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_dtt_edit_row__template_args', $template_args, $dttrow, $dtt, $default, $all_dtts, $this->_is_creating_event );
973
+		$template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_dtt_edit_row__template_args', $template_args, $dttrow, $dtt, $default, $all_dtts, $this->_is_creating_event);
974 974
 
975
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_edit_row.template.php';
976
-		return EEH_Template::display_template( $template, $template_args, TRUE );
975
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_edit_row.template.php';
976
+		return EEH_Template::display_template($template, $template_args, TRUE);
977 977
 	}
978 978
 
979 979
 
980
-	protected function _get_dtt_attached_tickets_row( $dttrow, $dtt, $datetime_tickets, $all_tickets, $default ) {
980
+	protected function _get_dtt_attached_tickets_row($dttrow, $dtt, $datetime_tickets, $all_tickets, $default) {
981 981
 
982 982
 		$template_args = array(
983 983
 			'dtt_row' => $default ? 'DTTNUM' : $dttrow,
@@ -985,47 +985,47 @@  discard block
 block discarded – undo
985 985
 			'DTT_description' => $default ? '' : $dtt->description(),
986 986
 			'datetime_tickets_list' => $default ? '<li class="hidden"></li>' : '',
987 987
 			'show_tickets_row' => ' style="display:none;"', //$default || $this->_adminpage_obj->get_cpt_model_obj()->ID() > 0 ? ' style="display:none;"' : '',
988
-			'add_new_datetime_ticket_help_link' => EEH_Template::get_help_tab_link('add_new_ticket_via_datetime', $this->_adminpage_obj->page_slug, $this->_adminpage_obj->get_req_action(), FALSE, FALSE ), //todo need to add this help info id to the Events_Admin_Page core file so we can access it here.
988
+			'add_new_datetime_ticket_help_link' => EEH_Template::get_help_tab_link('add_new_ticket_via_datetime', $this->_adminpage_obj->page_slug, $this->_adminpage_obj->get_req_action(), FALSE, FALSE), //todo need to add this help info id to the Events_Admin_Page core file so we can access it here.
989 989
 			'DTT_ID' => $default ? '' : $dtt->ID()
990 990
 			);
991 991
 
992 992
 		//need to setup the list items (but only if this isnt' a default skeleton setup)
993
-		if ( !$default ) {
993
+		if ( ! $default) {
994 994
 			$tktrow = 1;
995
-			foreach ( $all_tickets as $ticket ) {
996
-				$template_args['datetime_tickets_list'] .= $this->_get_datetime_tickets_list_item( $dttrow, $tktrow, $dtt, $ticket, $datetime_tickets, $default );
995
+			foreach ($all_tickets as $ticket) {
996
+				$template_args['datetime_tickets_list'] .= $this->_get_datetime_tickets_list_item($dttrow, $tktrow, $dtt, $ticket, $datetime_tickets, $default);
997 997
 				$tktrow++;
998 998
 			}
999 999
 		}
1000 1000
 
1001 1001
 		//filter template args at this point
1002
-		$template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_dtt_attached_ticket_row__template_args', $template_args, $dttrow, $dtt, $datetime_tickets, $all_tickets, $default, $this->_is_creating_event );
1002
+		$template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_dtt_attached_ticket_row__template_args', $template_args, $dttrow, $dtt, $datetime_tickets, $all_tickets, $default, $this->_is_creating_event);
1003 1003
 
1004
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_attached_tickets_row.template.php';
1005
-		return EEH_Template::display_template( $template, $template_args, TRUE );
1004
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_attached_tickets_row.template.php';
1005
+		return EEH_Template::display_template($template, $template_args, TRUE);
1006 1006
 	}
1007 1007
 
1008 1008
 
1009 1009
 
1010
-	protected function _get_datetime_tickets_list_item( $dttrow, $tktrow, $dtt, $ticket, $datetime_tickets, $default ) {
1011
-		$tktid = !empty( $ticket ) ? $ticket->ID() : 0;
1012
-		$dtt_tkts = $dtt instanceof EE_Datetime && isset( $datetime_tickets[$dtt->ID()] ) ? $datetime_tickets[$dtt->ID()] : array();
1010
+	protected function _get_datetime_tickets_list_item($dttrow, $tktrow, $dtt, $ticket, $datetime_tickets, $default) {
1011
+		$tktid = ! empty($ticket) ? $ticket->ID() : 0;
1012
+		$dtt_tkts = $dtt instanceof EE_Datetime && isset($datetime_tickets[$dtt->ID()]) ? $datetime_tickets[$dtt->ID()] : array();
1013 1013
 
1014
-		$displayrow = !empty( $ticket ) ? $ticket->get('TKT_row') : 0;
1014
+		$displayrow = ! empty($ticket) ? $ticket->get('TKT_row') : 0;
1015 1015
 		$template_args = array(
1016 1016
 			'dtt_row' => $default ? 'DTTNUM' : $dttrow,
1017
-			'tkt_row' => $default && empty( $ticket ) ? 'TICKETNUM' : $tktrow,
1017
+			'tkt_row' => $default && empty($ticket) ? 'TICKETNUM' : $tktrow,
1018 1018
 			'datetime_ticket_checked' => in_array($displayrow, $dtt_tkts) ? ' checked="checked"' : '',
1019 1019
 			'ticket_selected' => in_array($displayrow, $dtt_tkts) ? ' ticket-selected' : '',
1020
-			'TKT_name' => $default && empty( $ticket ) ? 'TKTNAME' : $ticket->get('TKT_name'),
1021
-			'tkt_status_class' => ( $default && empty( $ticket ) ) || $this->_is_creating_event ? ' tkt-status-' . EE_Ticket::onsale : ' tkt-status-' . $ticket->ticket_status(),
1020
+			'TKT_name' => $default && empty($ticket) ? 'TKTNAME' : $ticket->get('TKT_name'),
1021
+			'tkt_status_class' => ($default && empty($ticket)) || $this->_is_creating_event ? ' tkt-status-'.EE_Ticket::onsale : ' tkt-status-'.$ticket->ticket_status(),
1022 1022
 			);
1023 1023
 
1024 1024
 		//filter template args
1025
-		$template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_datetime_tickets_list_item__template_args', $template_args, $dttrow, $tktrow, $dtt, $ticket, $datetime_tickets, $default, $this->_is_creating_event );
1025
+		$template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_datetime_tickets_list_item__template_args', $template_args, $dttrow, $tktrow, $dtt, $ticket, $datetime_tickets, $default, $this->_is_creating_event);
1026 1026
 
1027
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_dtt_tickets_list.template.php';
1028
-		return EEH_Template::display_template( $template, $template_args, TRUE );
1027
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_dtt_tickets_list.template.php';
1028
+		return EEH_Template::display_template($template, $template_args, TRUE);
1029 1029
 	}
1030 1030
 
1031 1031
 
@@ -1047,37 +1047,37 @@  discard block
 block discarded – undo
1047 1047
 	 *
1048 1048
 	 * @return [type] [description]
1049 1049
 	 */
1050
-	protected function _get_ticket_row( $tktrow, $ticket, $ticket_datetimes, $all_dtts, $default = FALSE, $all_tickets = array() ) {
1050
+	protected function _get_ticket_row($tktrow, $ticket, $ticket_datetimes, $all_dtts, $default = FALSE, $all_tickets = array()) {
1051 1051
 
1052 1052
 		//if $ticket is not an instance of EE_Ticket then force default to true.
1053
-		$default =  ! $ticket instanceof EE_Ticket ? true : false;
1053
+		$default = ! $ticket instanceof EE_Ticket ? true : false;
1054 1054
 
1055
-		$prices = ! empty( $ticket ) && ! $default ? $ticket->get_many_related('Price', array('default_where_conditions' => 'none', 'order_by' => array('PRC_order' => 'ASC') ) ) : array();
1055
+		$prices = ! empty($ticket) && ! $default ? $ticket->get_many_related('Price', array('default_where_conditions' => 'none', 'order_by' => array('PRC_order' => 'ASC'))) : array();
1056 1056
 
1057 1057
 		//if there is only one price (which would be the base price) or NO prices and this ticket is a default ticket, let's just make sure there are no cached default prices on
1058 1058
 		//the object.  This is done by not including any query_params.
1059
-		if ( $ticket instanceof EE_Ticket && $ticket->is_default() && ( count( $prices ) === 1  || empty( $prices ) ) ) {
1060
-			$prices = $ticket->get_many_related( 'Price' );
1059
+		if ($ticket instanceof EE_Ticket && $ticket->is_default() && (count($prices) === 1 || empty($prices))) {
1060
+			$prices = $ticket->get_many_related('Price');
1061 1061
 		}
1062 1062
 
1063 1063
 		// check if we're dealing with a default ticket in which case we don't want any starting_ticket_datetime_row values set (otherwise there won't be any new relationships created for tickets based off of the default ticket).  This will future proof in case there is ever any behaviour change between what the primary_key defaults to.
1064
-		$default_dtt = $default || ($ticket instanceof EE_Ticket && $ticket->get('TKT_is_default') ) ? TRUE : FALSE;
1064
+		$default_dtt = $default || ($ticket instanceof EE_Ticket && $ticket->get('TKT_is_default')) ? TRUE : FALSE;
1065 1065
 
1066
-		$tkt_dtts = $ticket instanceof EE_Ticket && isset( $ticket_datetimes[$ticket->ID()] ) ? $ticket_datetimes[$ticket->ID()] : array();
1066
+		$tkt_dtts = $ticket instanceof EE_Ticket && isset($ticket_datetimes[$ticket->ID()]) ? $ticket_datetimes[$ticket->ID()] : array();
1067 1067
 
1068 1068
 		$ticket_subtotal = $default ? 0 : $ticket->get_ticket_subtotal();
1069
-		$base_price = $default ? NULL :  $ticket->base_price();
1069
+		$base_price = $default ? NULL : $ticket->base_price();
1070 1070
 		$count_price_mods = EEM_Price::instance()->get_all_default_prices(TRUE);
1071 1071
 
1072 1072
 		//breaking out complicated condition for ticket_status
1073
-		if ( $default ) {
1074
-			$ticket_status_class = ' tkt-status-' . EE_Ticket::onsale;
1073
+		if ($default) {
1074
+			$ticket_status_class = ' tkt-status-'.EE_Ticket::onsale;
1075 1075
 		} else {
1076
-			$ticket_status_class =  $ticket->is_default() ? ' tkt-status-' . EE_Ticket::onsale : ' tkt-status-' . $ticket->ticket_status();
1076
+			$ticket_status_class = $ticket->is_default() ? ' tkt-status-'.EE_Ticket::onsale : ' tkt-status-'.$ticket->ticket_status();
1077 1077
 		}
1078 1078
 
1079 1079
 		//breaking out complicated condition for TKT_taxable
1080
-		if ( $default ) {
1080
+		if ($default) {
1081 1081
 			$TKT_taxable = '';
1082 1082
 		} else {
1083 1083
 			$TKT_taxable = $ticket->get('TKT_taxable') ? ' checked="checked"' : '';
@@ -1092,19 +1092,19 @@  discard block
 block discarded – undo
1092 1092
 			'edit_tkt_expanded' => '',
1093 1093
 			'edit_tickets_name' => $default ? 'TICKETNAMEATTR' : 'edit_tickets',
1094 1094
 			'TKT_name' => $default ? '' : $ticket->get('TKT_name'),
1095
-			'TKT_start_date' => $default ? '' : $ticket->get_date('TKT_start_date', $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] ),
1096
-			'TKT_end_date' => $default ? '' : $ticket->get_date('TKT_end_date', $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time']  ),
1097
-			'TKT_status' => $default ? EEH_Template::pretty_status(EE_Ticket::onsale, FALSE, 'sentence') : $ticket->is_default() ? EEH_Template::pretty_status( EE_Ticket::onsale, FALSE, 'sentence') : $ticket->ticket_status(TRUE),
1095
+			'TKT_start_date' => $default ? '' : $ticket->get_date('TKT_start_date', $this->_date_format_strings['date'].' '.$this->_date_format_strings['time']),
1096
+			'TKT_end_date' => $default ? '' : $ticket->get_date('TKT_end_date', $this->_date_format_strings['date'].' '.$this->_date_format_strings['time']),
1097
+			'TKT_status' => $default ? EEH_Template::pretty_status(EE_Ticket::onsale, FALSE, 'sentence') : $ticket->is_default() ? EEH_Template::pretty_status(EE_Ticket::onsale, FALSE, 'sentence') : $ticket->ticket_status(TRUE),
1098 1098
 			'TKT_price' => $default ? '' : EEH_Template::format_currency($ticket->get_ticket_total_with_taxes(), FALSE, FALSE),
1099 1099
 			'TKT_price_code' => EE_Registry::instance()->CFG->currency->code,
1100 1100
 			'TKT_price_amount' => $default ? 0 : $ticket_subtotal,
1101
-			'TKT_qty' => $default ? '' : $ticket->get_pretty('TKT_qty','symbol'),
1102
-			'TKT_qty_for_input'=> $default ? '' : $ticket->get_pretty('TKT_qty','input'),
1103
-			'TKT_uses' => $default ? '' : $ticket->get_pretty('TKT_uses','input'),
1104
-			'TKT_min' => $default ? '' : ( $ticket->get('TKT_min') === -1 || $ticket->get('TKT_min') === 0 ? '' : $ticket->get('TKT_min') ),
1105
-			'TKT_max' => $default ? '' :  $ticket->get_pretty('TKT_max','input'),
1101
+			'TKT_qty' => $default ? '' : $ticket->get_pretty('TKT_qty', 'symbol'),
1102
+			'TKT_qty_for_input'=> $default ? '' : $ticket->get_pretty('TKT_qty', 'input'),
1103
+			'TKT_uses' => $default ? '' : $ticket->get_pretty('TKT_uses', 'input'),
1104
+			'TKT_min' => $default ? '' : ($ticket->get('TKT_min') === -1 || $ticket->get('TKT_min') === 0 ? '' : $ticket->get('TKT_min')),
1105
+			'TKT_max' => $default ? '' : $ticket->get_pretty('TKT_max', 'input'),
1106 1106
 			'TKT_sold' => $default ? 0 : $ticket->tickets_sold('ticket'),
1107
-			'TKT_registrations' => $default ? 0 : $ticket->count_registrations( array( array( 'STS_ID' => array( '!=', EEM_Registration::status_id_incomplete ) ) ) ),
1107
+			'TKT_registrations' => $default ? 0 : $ticket->count_registrations(array(array('STS_ID' => array('!=', EEM_Registration::status_id_incomplete)))),
1108 1108
 			'TKT_ID' => $default ? 0 : $ticket->get('TKT_ID'),
1109 1109
 			'TKT_description' => $default ? '' : $ticket->get('TKT_description'),
1110 1110
 			'TKT_is_default' => $default ? 0 : $ticket->get('TKT_is_default'),
@@ -1113,99 +1113,99 @@  discard block
 block discarded – undo
1113 1113
 			'ticket_price_rows' => '',
1114 1114
 			'TKT_base_price' => $default || ! $base_price instanceof EE_Price ? '' : $base_price->get_pretty('PRC_amount', 'localized_float'),
1115 1115
 			'TKT_base_price_ID' => $default || ! $base_price instanceof EE_Price ? 0 : $base_price->ID(),
1116
-			'show_price_modifier' => count($prices) > 1 || ( $default && $count_price_mods > 0 ) ? '' : ' style="display:none;"',
1117
-			'show_price_mod_button' => count($prices) > 1 || ( $default && $count_price_mods > 0 ) || ( !$default && $ticket->get('TKT_deleted') ) ? ' style="display:none;"' : '',
1116
+			'show_price_modifier' => count($prices) > 1 || ($default && $count_price_mods > 0) ? '' : ' style="display:none;"',
1117
+			'show_price_mod_button' => count($prices) > 1 || ($default && $count_price_mods > 0) || ( ! $default && $ticket->get('TKT_deleted')) ? ' style="display:none;"' : '',
1118 1118
 			'total_price_rows' => count($prices) > 1 ? count($prices) : 1,
1119 1119
 			'ticket_datetimes_list' => $default ? '<li class="hidden"></li>' : '',
1120 1120
 			'starting_ticket_datetime_rows' => $default || $default_dtt ? '' : implode(',', $tkt_dtts),
1121 1121
 			'ticket_datetime_rows' => $default ? '' : implode(',', $tkt_dtts),
1122
-			'existing_ticket_price_ids' => $default, '', implode(',', array_keys( $prices) ),
1122
+			'existing_ticket_price_ids' => $default, '', implode(',', array_keys($prices)),
1123 1123
 			'ticket_template_id' => $default ? 0 : $ticket->get('TTM_ID'),
1124 1124
 			'TKT_taxable' => $TKT_taxable,
1125 1125
 			'display_subtotal' => $ticket instanceof EE_Ticket && $ticket->get('TKT_taxable') ? '' : ' style="display:none"',
1126 1126
 			'price_currency_symbol' => EE_Registry::instance()->CFG->currency->sign,
1127
-			'TKT_subtotal_amount_display' => EEH_Template::format_currency($ticket_subtotal, FALSE, FALSE ),
1127
+			'TKT_subtotal_amount_display' => EEH_Template::format_currency($ticket_subtotal, FALSE, FALSE),
1128 1128
 			'TKT_subtotal_amount' => $ticket_subtotal,
1129
-			'tax_rows' => $this->_get_tax_rows( $tktrow, $ticket ),
1130
-			'disabled' => $ticket instanceof EE_Ticket && $ticket->get('TKT_deleted') ? TRUE: FALSE,
1129
+			'tax_rows' => $this->_get_tax_rows($tktrow, $ticket),
1130
+			'disabled' => $ticket instanceof EE_Ticket && $ticket->get('TKT_deleted') ? TRUE : FALSE,
1131 1131
 			'ticket_archive_class' => $ticket instanceof EE_Ticket && $ticket->get('TKT_deleted') ? ' ticket-archived' : '',
1132 1132
 			'trash_icon' => $ticket instanceof EE_Ticket && $ticket->get('TKT_deleted') ? 'ee-lock-icon ' : 'trash-icon dashicons dashicons-post-trash clickable',
1133 1133
 			'clone_icon' => $ticket instanceof EE_Ticket && $ticket->get('TKT_deleted') ? '' : 'clone-icon ee-icon ee-icon-clone clickable'
1134 1134
 			);
1135 1135
 
1136
-		$template_args['trash_hidden'] = count( $all_tickets ) === 1 && $template_args['trash_icon'] != 'ee-lock-icon' ? ' style="display:none"' : '';
1136
+		$template_args['trash_hidden'] = count($all_tickets) === 1 && $template_args['trash_icon'] != 'ee-lock-icon' ? ' style="display:none"' : '';
1137 1137
 
1138 1138
 		//handle rows that should NOT be empty
1139
-		if ( empty( $template_args['TKT_start_date'] ) ) {
1139
+		if (empty($template_args['TKT_start_date'])) {
1140 1140
 			//if empty then the start date will be now.
1141
-			$template_args['TKT_start_date'] = date( $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] , current_time('timestamp'));
1142
-			$template_args['tkt_status_class'] = ' tkt-status-' . EE_Ticket::onsale;
1141
+			$template_args['TKT_start_date'] = date($this->_date_format_strings['date'].' '.$this->_date_format_strings['time'], current_time('timestamp'));
1142
+			$template_args['tkt_status_class'] = ' tkt-status-'.EE_Ticket::onsale;
1143 1143
 		}
1144 1144
 
1145
-		if ( empty( $template_args['TKT_end_date'] ) ) {
1145
+		if (empty($template_args['TKT_end_date'])) {
1146 1146
 
1147 1147
 			//get the earliest datetime (if present);
1148
-			$earliest_dtt = $this->_adminpage_obj->get_cpt_model_obj()->ID() > 0 ? $this->_adminpage_obj->get_cpt_model_obj()->get_first_related('Datetime', array('order_by'=> array('DTT_EVT_start' => 'ASC' ) ) ) : NULL;
1148
+			$earliest_dtt = $this->_adminpage_obj->get_cpt_model_obj()->ID() > 0 ? $this->_adminpage_obj->get_cpt_model_obj()->get_first_related('Datetime', array('order_by'=> array('DTT_EVT_start' => 'ASC'))) : NULL;
1149 1149
 
1150
-			if ( !empty( $earliest_dtt ) ) {
1151
-				$template_args['TKT_end_date'] = $earliest_dtt->get_datetime('DTT_EVT_start', $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] );
1150
+			if ( ! empty($earliest_dtt)) {
1151
+				$template_args['TKT_end_date'] = $earliest_dtt->get_datetime('DTT_EVT_start', $this->_date_format_strings['date'].' '.$this->_date_format_strings['time']);
1152 1152
 			} else {
1153 1153
 				//default so let's just use what's been set for the default date-time which is 30 days from now.
1154
-				$template_args['TKT_end_date'] = date( $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] , mktime(24, 0, 0, date("m"), date("d") + 29, date("Y") )  );
1154
+				$template_args['TKT_end_date'] = date($this->_date_format_strings['date'].' '.$this->_date_format_strings['time'], mktime(24, 0, 0, date("m"), date("d") + 29, date("Y")));
1155 1155
 			}
1156
-			$template_args['tkt_status_class'] = ' tkt-status-' . EE_Ticket::onsale;
1156
+			$template_args['tkt_status_class'] = ' tkt-status-'.EE_Ticket::onsale;
1157 1157
 		}
1158 1158
 
1159 1159
 		//generate ticket_datetime items
1160
-		if ( ! $default ) {
1160
+		if ( ! $default) {
1161 1161
 			$dttrow = 1;
1162
-			foreach ( $all_dtts as $dtt ) {
1163
-				$template_args['ticket_datetimes_list'] .= $this->_get_ticket_datetime_list_item( $dttrow, $tktrow, $dtt, $ticket, $ticket_datetimes, $default );
1162
+			foreach ($all_dtts as $dtt) {
1163
+				$template_args['ticket_datetimes_list'] .= $this->_get_ticket_datetime_list_item($dttrow, $tktrow, $dtt, $ticket, $ticket_datetimes, $default);
1164 1164
 				$dttrow++;
1165 1165
 			}
1166 1166
 		}
1167 1167
 
1168 1168
 		$prcrow = 1;
1169
-		foreach ( $prices as $price ) {
1170
-			if ( $price->is_base_price() ) {
1169
+		foreach ($prices as $price) {
1170
+			if ($price->is_base_price()) {
1171 1171
 				$prcrow++;
1172 1172
 				continue;
1173 1173
 			}
1174
-			$show_trash = ( count( $prices ) > 1 && $prcrow === 1 ) || count( $prices ) === 1  ? FALSE : TRUE;
1175
-			$show_create = count( $prices ) > 1 && count( $prices ) !== $prcrow ? FALSE : TRUE;
1176
-			$template_args['ticket_price_rows'] .= $this->_get_ticket_price_row( $tktrow, $prcrow, $price, $default, $ticket, $show_trash, $show_create );
1174
+			$show_trash = (count($prices) > 1 && $prcrow === 1) || count($prices) === 1 ? FALSE : TRUE;
1175
+			$show_create = count($prices) > 1 && count($prices) !== $prcrow ? FALSE : TRUE;
1176
+			$template_args['ticket_price_rows'] .= $this->_get_ticket_price_row($tktrow, $prcrow, $price, $default, $ticket, $show_trash, $show_create);
1177 1177
 			$prcrow++;
1178 1178
 		}
1179 1179
 
1180 1180
 		//filter $template_args
1181
-		$template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_ticket_row__template_args', $template_args, $tktrow, $ticket, $ticket_datetimes, $all_dtts, $default, $all_tickets, $this->_is_creating_event );
1181
+		$template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_ticket_row__template_args', $template_args, $tktrow, $ticket, $ticket_datetimes, $all_dtts, $default, $all_tickets, $this->_is_creating_event);
1182 1182
 
1183
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_ticket_row.template.php';
1184
-		return EEH_Template::display_template( $template, $template_args, TRUE );
1183
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_ticket_row.template.php';
1184
+		return EEH_Template::display_template($template, $template_args, TRUE);
1185 1185
 	}
1186 1186
 
1187 1187
 
1188 1188
 
1189 1189
 
1190 1190
 
1191
-	protected function _get_tax_rows( $tktrow, $ticket ) {
1191
+	protected function _get_tax_rows($tktrow, $ticket) {
1192 1192
 		$tax_rows = '';
1193
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_ticket_tax_row.template.php';
1193
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_ticket_tax_row.template.php';
1194 1194
 		$template_args = array();
1195
-		$taxes = empty( $ticket ) ? EE_Taxes::get_taxes_for_admin() : $ticket->get_ticket_taxes_for_admin();
1196
-		foreach ( $taxes as $tax ) {
1197
-			$tax_added = $this->_get_tax_added( $tax, $ticket );
1195
+		$taxes = empty($ticket) ? EE_Taxes::get_taxes_for_admin() : $ticket->get_ticket_taxes_for_admin();
1196
+		foreach ($taxes as $tax) {
1197
+			$tax_added = $this->_get_tax_added($tax, $ticket);
1198 1198
 			$template_args = array(
1199
-				'display_tax' => !empty( $ticket ) && $ticket->get('TKT_taxable') ? '' : ' style="display:none;"',
1199
+				'display_tax' => ! empty($ticket) && $ticket->get('TKT_taxable') ? '' : ' style="display:none;"',
1200 1200
 				'tax_id' => $tax->ID(),
1201 1201
 				'tkt_row' => $tktrow,
1202 1202
 				'tax_label' => $tax->get('PRC_name'),
1203 1203
 				'tax_added' => $tax_added,
1204
-				'tax_added_display' => EEH_Template::format_currency($tax_added, FALSE, FALSE ),
1204
+				'tax_added_display' => EEH_Template::format_currency($tax_added, FALSE, FALSE),
1205 1205
 				'tax_amount' => $tax->get('PRC_amount')
1206 1206
 				);
1207
-			$template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_tax_rows__template_args', $template_args, $tktrow, $ticket, $this->_is_creating_event  );
1208
-			$tax_rows .= EEH_Template::display_template( $template, $template_args, TRUE );
1207
+			$template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_tax_rows__template_args', $template_args, $tktrow, $ticket, $this->_is_creating_event);
1208
+			$tax_rows .= EEH_Template::display_template($template, $template_args, TRUE);
1209 1209
 		}
1210 1210
 
1211 1211
 
@@ -1213,81 +1213,81 @@  discard block
 block discarded – undo
1213 1213
 	}
1214 1214
 
1215 1215
 
1216
-	protected function _get_tax_added( EE_Price $tax, $ticket ) {
1217
-		$subtotal = empty( $ticket ) ? 0 : $ticket->get_ticket_subtotal();
1216
+	protected function _get_tax_added(EE_Price $tax, $ticket) {
1217
+		$subtotal = empty($ticket) ? 0 : $ticket->get_ticket_subtotal();
1218 1218
 		return $subtotal * $tax->get('PRC_amount') / 100;
1219 1219
 	}
1220 1220
 
1221 1221
 
1222 1222
 
1223 1223
 
1224
-	protected function _get_ticket_price_row( $tktrow, $prcrow, $price, $default, $ticket, $show_trash = TRUE, $show_create = TRUE ) {
1225
-		$send_disabled = !empty( $ticket ) && $ticket->get('TKT_deleted') ? TRUE : FALSE;
1224
+	protected function _get_ticket_price_row($tktrow, $prcrow, $price, $default, $ticket, $show_trash = TRUE, $show_create = TRUE) {
1225
+		$send_disabled = ! empty($ticket) && $ticket->get('TKT_deleted') ? TRUE : FALSE;
1226 1226
 		$template_args = array(
1227 1227
 			'tkt_row' => $default && empty($ticket) ? 'TICKETNUM' : $tktrow,
1228 1228
 			'PRC_order' => $default && empty($price) ? 'PRICENUM' : $prcrow,
1229 1229
 			'edit_prices_name' => $default && empty($price) ? 'PRICENAMEATTR' : 'edit_prices',
1230
-			'price_type_selector' => $default && empty( $price ) ? $this->_get_base_price_template( $tktrow, $prcrow, $price, $default ) : $this->_get_price_type_selector( $tktrow, $prcrow, $price, $default, $send_disabled ),
1230
+			'price_type_selector' => $default && empty($price) ? $this->_get_base_price_template($tktrow, $prcrow, $price, $default) : $this->_get_price_type_selector($tktrow, $prcrow, $price, $default, $send_disabled),
1231 1231
 			'PRC_ID' => $default && empty($price) ? 0 : $price->ID(),
1232 1232
 			'PRC_is_default' => $default && empty($price) ? 0 : $price->get('PRC_is_default'),
1233 1233
 			'PRC_name' => $default && empty($price) ? '' : $price->get('PRC_name'),
1234 1234
 			'price_currency_symbol' => EE_Registry::instance()->CFG->currency->sign,
1235 1235
 			'show_plus_or_minus' => $default && empty($price) ? '' : ' style="display:none;"',
1236
-			'show_plus' => $default && empty( $price ) ? ' style="display:none;"' : ( $price->is_discount() || $price->is_base_price() ? ' style="display:none;"' : ''),
1237
-			'show_minus' => $default && empty( $price ) ? ' style="display:none;"' : ($price->is_discount() ? '' : ' style="display:none;"'),
1238
-			'show_currency_symbol' => $default && empty( $price ) ? ' style="display:none"' : ($price->is_percent() ? ' style="display:none"' : '' ),
1239
-			'PRC_amount' => $default && empty( $price ) ? 0 : $price->get_pretty('PRC_amount', 'localized_float'),
1240
-			'show_percentage' => $default && empty( $price ) ? ' style="display:none;"' : ( $price->is_percent() ? '' : ' style="display:none;"' ),
1236
+			'show_plus' => $default && empty($price) ? ' style="display:none;"' : ($price->is_discount() || $price->is_base_price() ? ' style="display:none;"' : ''),
1237
+			'show_minus' => $default && empty($price) ? ' style="display:none;"' : ($price->is_discount() ? '' : ' style="display:none;"'),
1238
+			'show_currency_symbol' => $default && empty($price) ? ' style="display:none"' : ($price->is_percent() ? ' style="display:none"' : ''),
1239
+			'PRC_amount' => $default && empty($price) ? 0 : $price->get_pretty('PRC_amount', 'localized_float'),
1240
+			'show_percentage' => $default && empty($price) ? ' style="display:none;"' : ($price->is_percent() ? '' : ' style="display:none;"'),
1241 1241
 			'show_trash_icon' => $show_trash ? '' : ' style="display:none;"',
1242 1242
 			'show_create_button' => $show_create ? '' : ' style="display:none;"',
1243
-			'PRC_desc' => $default && empty( $price ) ? '' : $price->get('PRC_desc'),
1244
-			'disabled' => !empty( $ticket ) && $ticket->get('TKT_deleted') ? TRUE : FALSE
1243
+			'PRC_desc' => $default && empty($price) ? '' : $price->get('PRC_desc'),
1244
+			'disabled' => ! empty($ticket) && $ticket->get('TKT_deleted') ? TRUE : FALSE
1245 1245
 			);
1246 1246
 
1247
-	$template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_ticket_price_row__template_args', $template_args, $tktrow, $prcrow, $price, $default, $ticket, $show_trash, $show_create, $this->_is_creating_event );
1247
+	$template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_ticket_price_row__template_args', $template_args, $tktrow, $prcrow, $price, $default, $ticket, $show_trash, $show_create, $this->_is_creating_event);
1248 1248
 
1249
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_ticket_price_row.template.php';
1250
-		return EEH_Template::display_template( $template, $template_args, TRUE );
1249
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_ticket_price_row.template.php';
1250
+		return EEH_Template::display_template($template, $template_args, TRUE);
1251 1251
 	}
1252 1252
 
1253 1253
 
1254
-	protected function _get_price_type_selector( $tktrow, $prcrow, $price, $default, $disabled = FALSE ) {
1255
-		if ( $price->is_base_price() ) {
1256
-			return $this->_get_base_price_template( $tktrow, $prcrow, $price, $default );
1254
+	protected function _get_price_type_selector($tktrow, $prcrow, $price, $default, $disabled = FALSE) {
1255
+		if ($price->is_base_price()) {
1256
+			return $this->_get_base_price_template($tktrow, $prcrow, $price, $default);
1257 1257
 		} else {
1258
-			return $this->_get_price_modifier_template( $tktrow, $prcrow, $price, $default, $disabled );
1258
+			return $this->_get_price_modifier_template($tktrow, $prcrow, $price, $default, $disabled);
1259 1259
 		}
1260 1260
 
1261 1261
 	}
1262 1262
 
1263 1263
 
1264
-	protected function _get_base_price_template( $tktrow, $prcrow, $price, $default ) {
1264
+	protected function _get_base_price_template($tktrow, $prcrow, $price, $default) {
1265 1265
 		$template_args = array(
1266 1266
 				'tkt_row' => $default ? 'TICKETNUM' : $tktrow,
1267
-				'PRC_order' => $default && empty( $price ) ? 'PRICENUM' : $prcrow,
1268
-				'PRT_ID' => $default && empty( $price ) ? 1 : $price->get('PRT_ID'),
1267
+				'PRC_order' => $default && empty($price) ? 'PRICENUM' : $prcrow,
1268
+				'PRT_ID' => $default && empty($price) ? 1 : $price->get('PRT_ID'),
1269 1269
 				'PRT_name' => __('Price', 'event_espresso'),
1270 1270
 				'price_selected_operator' => '+',
1271 1271
 				'price_selected_is_percent' => 0
1272 1272
 			);
1273
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_price_type_base.template.php';
1273
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_price_type_base.template.php';
1274 1274
 
1275
-		$template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_base_price_template__template_args', $template_args, $tktrow, $prcrow, $price, $default, $this->_is_creating_event );
1275
+		$template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_base_price_template__template_args', $template_args, $tktrow, $prcrow, $price, $default, $this->_is_creating_event);
1276 1276
 
1277
-		return EEH_Template::display_template( $template, $template_args, TRUE );
1277
+		return EEH_Template::display_template($template, $template_args, TRUE);
1278 1278
 	}
1279 1279
 
1280 1280
 
1281 1281
 
1282
-	protected function _get_price_modifier_template( $tktrow, $prcrow, $price, $default, $disabled = FALSE ) {
1283
-		$select_name = $default && empty( $price ) ? 'edit_prices[TICKETNUM][PRICENUM][PRT_ID]' : 'edit_prices[' . $tktrow . '][' . $prcrow . '][PRT_ID]';
1284
-		$price_types = EE_Registry::instance()->load_model('Price_Type')->get_all(array( array('OR' => array('PBT_ID' => '2', 'PBT_ID*' => '3' ) ) ) );
1285
-		$price_option_span_template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_price_option_span.template.php';
1286
-		$all_price_types = $default && empty( $price ) ? array(array('id' => 0, 'text' => __('Select Modifier', 'event_espresso')) ) : array();
1287
-		$selected_price_type_id = $default && empty( $price ) ? 0 : $price->type();
1282
+	protected function _get_price_modifier_template($tktrow, $prcrow, $price, $default, $disabled = FALSE) {
1283
+		$select_name = $default && empty($price) ? 'edit_prices[TICKETNUM][PRICENUM][PRT_ID]' : 'edit_prices['.$tktrow.']['.$prcrow.'][PRT_ID]';
1284
+		$price_types = EE_Registry::instance()->load_model('Price_Type')->get_all(array(array('OR' => array('PBT_ID' => '2', 'PBT_ID*' => '3'))));
1285
+		$price_option_span_template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_price_option_span.template.php';
1286
+		$all_price_types = $default && empty($price) ? array(array('id' => 0, 'text' => __('Select Modifier', 'event_espresso'))) : array();
1287
+		$selected_price_type_id = $default && empty($price) ? 0 : $price->type();
1288 1288
 		$price_option_spans = '';
1289 1289
 		//setup pricetypes for selector
1290
-		foreach ( $price_types as $price_type ) {
1290
+		foreach ($price_types as $price_type) {
1291 1291
 			$all_price_types[] = array(
1292 1292
 				'id' => $price_type->ID(),
1293 1293
 				'text' => $price_type->get('PRT_name'),
@@ -1299,50 +1299,50 @@  discard block
 block discarded – undo
1299 1299
 				'PRT_operator' => $price_type->is_discount() ? '-' : '+',
1300 1300
 				'PRT_is_percent' => $price_type->get('PRT_is_percent') ? 1 : 0
1301 1301
 				);
1302
-			$price_option_spans .= EEH_Template::display_template($price_option_span_template, $spanargs, TRUE );
1302
+			$price_option_spans .= EEH_Template::display_template($price_option_span_template, $spanargs, TRUE);
1303 1303
 		}
1304 1304
 
1305
-		$select_params = $disabled ? 'style="width:auto;" disabled'  : 'style="width:auto;"';
1305
+		$select_params = $disabled ? 'style="width:auto;" disabled' : 'style="width:auto;"';
1306 1306
 		$main_name = $select_name;
1307
-		$select_name = $disabled ? 'archive_price[' . $tktrow . '][' . $prcrow . '][PRT_ID]' : $main_name;
1307
+		$select_name = $disabled ? 'archive_price['.$tktrow.']['.$prcrow.'][PRT_ID]' : $main_name;
1308 1308
 
1309 1309
 		$template_args = array(
1310 1310
 			'tkt_row' => $default ? 'TICKETNUM' : $tktrow,
1311
-			'PRC_order' => $default && empty( $price ) ? 'PRICENUM' : $prcrow,
1312
-			'price_modifier_selector' => EEH_Form_Fields::select_input( $select_name, $all_price_types, $selected_price_type_id, $select_params, 'edit-price-PRT_ID' ),
1311
+			'PRC_order' => $default && empty($price) ? 'PRICENUM' : $prcrow,
1312
+			'price_modifier_selector' => EEH_Form_Fields::select_input($select_name, $all_price_types, $selected_price_type_id, $select_params, 'edit-price-PRT_ID'),
1313 1313
 			'main_name' => $main_name,
1314 1314
 			'selected_price_type_id' => $selected_price_type_id,
1315 1315
 			'price_option_spans' => $price_option_spans,
1316
-			'price_selected_operator' => $default && empty( $price ) ? '' : ( $price->is_discount() ? '-' : '+' ),
1317
-			'price_selected_is_percent' => $default && empty( $price ) ? '' : ( $price->is_percent() ? 1 : 0 ),
1316
+			'price_selected_operator' => $default && empty($price) ? '' : ($price->is_discount() ? '-' : '+'),
1317
+			'price_selected_is_percent' => $default && empty($price) ? '' : ($price->is_percent() ? 1 : 0),
1318 1318
 			'disabled' => $disabled
1319 1319
 			);
1320 1320
 
1321
-		$template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_price_modifier_template__template_args', $template_args, $tktrow, $prcrow, $price, $default, $disabled, $this->_is_creating_event );
1321
+		$template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_price_modifier_template__template_args', $template_args, $tktrow, $prcrow, $price, $default, $disabled, $this->_is_creating_event);
1322 1322
 
1323
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_price_modifier_selector.template.php';
1323
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_price_modifier_selector.template.php';
1324 1324
 
1325
-		return EEH_Template::display_template( $template, $template_args, TRUE );
1325
+		return EEH_Template::display_template($template, $template_args, TRUE);
1326 1326
 	}
1327 1327
 
1328 1328
 
1329 1329
 
1330
-	protected function _get_ticket_datetime_list_item( $dttrow, $tktrow, $dtt, $ticket, $ticket_datetimes, $default ) {
1331
-		$dttid = !empty($dtt) ? $dtt->ID() : 0;
1332
-		$displayrow = !empty($dtt) ? $dtt->get('DTT_order') : 0;
1333
-		$tkt_dtts = $ticket instanceof EE_Ticket && isset( $ticket_datetimes[$ticket->ID()] ) ? $ticket_datetimes[$ticket->ID()] : array();
1330
+	protected function _get_ticket_datetime_list_item($dttrow, $tktrow, $dtt, $ticket, $ticket_datetimes, $default) {
1331
+		$dttid = ! empty($dtt) ? $dtt->ID() : 0;
1332
+		$displayrow = ! empty($dtt) ? $dtt->get('DTT_order') : 0;
1333
+		$tkt_dtts = $ticket instanceof EE_Ticket && isset($ticket_datetimes[$ticket->ID()]) ? $ticket_datetimes[$ticket->ID()] : array();
1334 1334
 		$template_args = array(
1335
-			'dtt_row' => $default && empty( $dtt ) ? 'DTTNUM' : $dttrow,
1335
+			'dtt_row' => $default && empty($dtt) ? 'DTTNUM' : $dttrow,
1336 1336
 			'tkt_row' => $default ? 'TICKETNUM' : $tktrow,
1337
-			'ticket_datetime_selected' => in_array( $displayrow, $tkt_dtts ) ? ' ticket-selected' : '',
1338
-			'ticket_datetime_checked' => in_array( $displayrow, $tkt_dtts ) ? ' checked="checked"' : '',
1339
-			'DTT_name' => $default && empty( $dtt ) ? 'DTTNAME' : $dtt->get_dtt_display_name( TRUE ),
1337
+			'ticket_datetime_selected' => in_array($displayrow, $tkt_dtts) ? ' ticket-selected' : '',
1338
+			'ticket_datetime_checked' => in_array($displayrow, $tkt_dtts) ? ' checked="checked"' : '',
1339
+			'DTT_name' => $default && empty($dtt) ? 'DTTNAME' : $dtt->get_dtt_display_name(TRUE),
1340 1340
 			'tkt_status_class' => '',
1341 1341
 			);
1342 1342
 
1343
-		$template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_ticket_datetime_list_item__template_args', $template_args, $dttrow, $tktrow, $dtt, $ticket, $ticket_datetimes, $default, $this->_is_creating_event );
1344
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_ticket_datetimes_list_item.template.php';
1345
-		return EEH_Template::display_template( $template, $template_args, TRUE );
1343
+		$template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_ticket_datetime_list_item__template_args', $template_args, $dttrow, $tktrow, $dtt, $ticket, $ticket_datetimes, $default, $this->_is_creating_event);
1344
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_ticket_datetimes_list_item.template.php';
1345
+		return EEH_Template::display_template($template, $template_args, TRUE);
1346 1346
 	}
1347 1347
 
1348 1348
 
@@ -1350,53 +1350,53 @@  discard block
 block discarded – undo
1350 1350
 	protected function _get_ticket_js_structure($all_dtts, $all_tickets) {
1351 1351
 		$template_args = array(
1352 1352
 			'default_datetime_edit_row' => $this->_get_dtt_edit_row('DTTNUM', NULL, TRUE, $all_dtts),
1353
-			'default_ticket_row' => $this->_get_ticket_row( 'TICKETNUM', NULL, array(), array(), TRUE),
1354
-			'default_price_row' => $this->_get_ticket_price_row( 'TICKETNUM', 'PRICENUM', NULL, TRUE, NULL ),
1353
+			'default_ticket_row' => $this->_get_ticket_row('TICKETNUM', NULL, array(), array(), TRUE),
1354
+			'default_price_row' => $this->_get_ticket_price_row('TICKETNUM', 'PRICENUM', NULL, TRUE, NULL),
1355 1355
 			'default_price_rows' => '',
1356 1356
 			'default_base_price_amount' => 0,
1357 1357
 			'default_base_price_name' => '',
1358 1358
 			'default_base_price_description' => '',
1359
-			'default_price_modifier_selector_row' => $this->_get_price_modifier_template( 'TICKETNUM', 'PRICENUM', NULL, TRUE ),
1360
-			'default_available_tickets_for_datetime' => $this->_get_dtt_attached_tickets_row( 'DTTNUM', NULL, array(), array(), TRUE ),
1359
+			'default_price_modifier_selector_row' => $this->_get_price_modifier_template('TICKETNUM', 'PRICENUM', NULL, TRUE),
1360
+			'default_available_tickets_for_datetime' => $this->_get_dtt_attached_tickets_row('DTTNUM', NULL, array(), array(), TRUE),
1361 1361
 			'existing_available_datetime_tickets_list' => '',
1362 1362
 			'existing_available_ticket_datetimes_list' => '',
1363
-			'new_available_datetime_ticket_list_item' => $this->_get_datetime_tickets_list_item( 'DTTNUM', 'TICKETNUM', NULL, NULL, array(), TRUE ),
1364
-			'new_available_ticket_datetime_list_item' => $this->_get_ticket_datetime_list_item( 'DTTNUM', 'TICKETNUM', NULL, NULL, array(), TRUE )
1363
+			'new_available_datetime_ticket_list_item' => $this->_get_datetime_tickets_list_item('DTTNUM', 'TICKETNUM', NULL, NULL, array(), TRUE),
1364
+			'new_available_ticket_datetime_list_item' => $this->_get_ticket_datetime_list_item('DTTNUM', 'TICKETNUM', NULL, NULL, array(), TRUE)
1365 1365
 			);
1366 1366
 
1367 1367
 		$tktrow = 1;
1368
-		foreach ( $all_tickets as $ticket ) {
1369
-			$template_args['existing_available_datetime_tickets_list'] .= $this->_get_datetime_tickets_list_item( 'DTTNUM', $tktrow, NULL, $ticket, array(), TRUE );
1368
+		foreach ($all_tickets as $ticket) {
1369
+			$template_args['existing_available_datetime_tickets_list'] .= $this->_get_datetime_tickets_list_item('DTTNUM', $tktrow, NULL, $ticket, array(), TRUE);
1370 1370
 			$tktrow++;
1371 1371
 		}
1372 1372
 
1373 1373
 
1374 1374
 		$dttrow = 1;
1375
-		foreach ( $all_dtts as $dtt ) {
1376
-			$template_args['existing_available_ticket_datetimes_list'] .= $this->_get_ticket_datetime_list_item( $dttrow, 'TICKETNUM', $dtt, NULL, array(), TRUE );
1375
+		foreach ($all_dtts as $dtt) {
1376
+			$template_args['existing_available_ticket_datetimes_list'] .= $this->_get_ticket_datetime_list_item($dttrow, 'TICKETNUM', $dtt, NULL, array(), TRUE);
1377 1377
 			$dttrow++;
1378 1378
 		}
1379 1379
 
1380 1380
 		$default_prices = EE_Registry::instance()->load_model('Price')->get_all_default_prices();
1381 1381
 		$prcrow = 1;
1382
-		foreach ( $default_prices as $price ) {
1383
-			if ( $price->is_base_price() ) {
1382
+		foreach ($default_prices as $price) {
1383
+			if ($price->is_base_price()) {
1384 1384
 				$template_args['default_base_price_amount'] = $price->get_pretty('PRC_amount', 'localized_float');
1385 1385
 				$template_args['default_base_price_name'] = $price->get('PRC_name');
1386 1386
 				$template_args['default_base_price_description'] = $price->get('PRC_desc');
1387 1387
 				$prcrow++;
1388 1388
 				continue;
1389 1389
 			}
1390
-			$show_trash = ( count( $default_prices ) > 1 && $prcrow === 1 ) || count( $default_prices ) === 1  ? FALSE : TRUE;
1391
-			$show_create = count( $default_prices ) > 1 && count( $default_prices ) !== $prcrow ? FALSE : TRUE;
1392
-			$template_args['default_price_rows'] .= $this->_get_ticket_price_row( 'TICKETNUM', $prcrow, $price, TRUE, NULL, $show_trash, $show_create );
1390
+			$show_trash = (count($default_prices) > 1 && $prcrow === 1) || count($default_prices) === 1 ? FALSE : TRUE;
1391
+			$show_create = count($default_prices) > 1 && count($default_prices) !== $prcrow ? FALSE : TRUE;
1392
+			$template_args['default_price_rows'] .= $this->_get_ticket_price_row('TICKETNUM', $prcrow, $price, TRUE, NULL, $show_trash, $show_create);
1393 1393
 			$prcrow++;
1394 1394
 		}
1395 1395
 
1396
-		$template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_ticket_js_structure__template_args', $template_args, $all_dtts, $all_tickets, $this->_is_creating_event );
1396
+		$template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_ticket_js_structure__template_args', $template_args, $all_dtts, $all_tickets, $this->_is_creating_event);
1397 1397
 
1398
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_ticket_js_structure.template.php';
1399
-		return EEH_Template::display_template( $template, $template_args, TRUE );
1398
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_ticket_js_structure.template.php';
1399
+		return EEH_Template::display_template($template, $template_args, TRUE);
1400 1400
 	}
1401 1401
 
1402 1402
 
Please login to merge, or discard this patch.
admin/extend/registrations/EE_Event_Registrations_List_Table.class.php 1 patch
Spacing   +80 added lines, -80 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
 
17 17
 
18 18
 
19
-	public function __construct( $admin_page ) {
19
+	public function __construct($admin_page) {
20 20
 		parent::__construct($admin_page);
21 21
 		$this->_status = $this->_admin_page->get_registration_status_array();
22 22
 	}
@@ -25,15 +25,15 @@  discard block
 block discarded – undo
25 25
 
26 26
 
27 27
 	protected function _setup_data() {
28
-		$this->_data = $this->_view != 'trash' ? $this->_admin_page->get_event_attendees( $this->_per_page ) : $this->_admin_page->get_event_attendees( $this->_per_page, FALSE, TRUE );
29
-		$this->_all_data_count = $this->_view != 'trash' ? $this->_admin_page->get_event_attendees(  $this->_per_page, TRUE ) : $this->_admin_page->get_event_attendees(  $this->_per_page, TRUE, TRUE);
28
+		$this->_data = $this->_view != 'trash' ? $this->_admin_page->get_event_attendees($this->_per_page) : $this->_admin_page->get_event_attendees($this->_per_page, FALSE, TRUE);
29
+		$this->_all_data_count = $this->_view != 'trash' ? $this->_admin_page->get_event_attendees($this->_per_page, TRUE) : $this->_admin_page->get_event_attendees($this->_per_page, TRUE, TRUE);
30 30
 	}
31 31
 
32 32
 
33 33
 
34 34
 
35 35
 	protected function _set_properties() {
36
-		$evt_id = isset( $this->_req_data['event_id'] ) ? $this->_req_data['event_id'] : NULL;
36
+		$evt_id = isset($this->_req_data['event_id']) ? $this->_req_data['event_id'] : NULL;
37 37
 
38 38
 		$this->_wp_list_args = array(
39 39
 			'singular' => __('registrant', 'event_espresso'),
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 
45 45
 		$columns = array();
46 46
 		//$columns['_Reg_Status'] = '';
47
-		if ( !empty( $evt_id ) ) {
47
+		if ( ! empty($evt_id)) {
48 48
 			$columns['cb'] = '<input type="checkbox" />'; //Render a checkbox instead of text
49 49
 			$this->_has_checkbox_column = true;
50 50
 		}
@@ -60,26 +60,26 @@  discard block
 block discarded – undo
60 60
 				'TXN_total' => __('Total', 'event_espresso')
61 61
 			);
62 62
 
63
-		$this->_columns = array_merge( $columns, $this->_columns);
63
+		$this->_columns = array_merge($columns, $this->_columns);
64 64
 
65 65
 		$this->_primary_column = '_REG_att_checked_in';
66 66
 
67
-		if ( !empty( $evt_id ) && EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'espresso_registrations_registrations_reports', $evt_id )  ) {
67
+		if ( ! empty($evt_id) && EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'espresso_registrations_registrations_reports', $evt_id)) {
68 68
 			$this->_bottom_buttons = array(
69 69
 				'report'=> array(
70 70
 					'route' => 'registrations_report',
71 71
 					'extra_request' => 
72 72
 						array( 
73 73
 							'EVT_ID'=> $evt_id, 
74
-							'return_url' => urlencode( "//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}") )
74
+							'return_url' => urlencode("//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}") )
75 75
 				)
76 76
 			);
77 77
 		}
78 78
 
79 79
 		$this->_sortable_columns = array(
80 80
 			 //true means its already sorted
81
-			'ATT_name' => array( 'ATT_name' => TRUE ),
82
-			'Event' => array( 'Event.EVT.Name' => FALSE )
81
+			'ATT_name' => array('ATT_name' => TRUE),
82
+			'Event' => array('Event.EVT.Name' => FALSE)
83 83
 		);
84 84
 
85 85
 		$this->_hidden_columns = array();
@@ -91,11 +91,11 @@  discard block
 block discarded – undo
91 91
 
92 92
 
93 93
 
94
-	protected function _get_row_class( $item ) {
95
-		$class = parent::_get_row_class( $item );
94
+	protected function _get_row_class($item) {
95
+		$class = parent::_get_row_class($item);
96 96
 		//add status class
97
-		$class .= ' ee-status-strip reg-status-' . $item->status_ID();
98
-		if ( $this->_has_checkbox_column ) {
97
+		$class .= ' ee-status-strip reg-status-'.$item->status_ID();
98
+		if ($this->_has_checkbox_column) {
99 99
 			$class .= ' has-checkbox-column';
100 100
 		}
101 101
 		return $class;
@@ -107,42 +107,42 @@  discard block
 block discarded – undo
107 107
 		$filters = $where = array();
108 108
 
109 109
 
110
-		if ( empty( $this->_dtts_for_event ) ) {
110
+		if (empty($this->_dtts_for_event)) {
111 111
 			//this means we don't have an event so let's setup a filter dropdown for all the events to select
112 112
 			//note possible capability restrictions
113
-			if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_private_events', 'get_events') ) {
114
-				$where['status**'] =  array( '!=', 'private' );
113
+			if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_private_events', 'get_events')) {
114
+				$where['status**'] = array('!=', 'private');
115 115
 			}
116 116
 
117
-			if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_events', 'get_events' ) ) {
118
-				$where['EVT_wp_user'] =  get_current_user_id();
117
+			if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_events', 'get_events')) {
118
+				$where['EVT_wp_user'] = get_current_user_id();
119 119
 			}
120 120
 
121
-			$events = EEM_Event::instance()->get_all(array( $where, 'order_by' => array( 'Datetime.DTT_EVT_start' => 'DESC' ) ) );
122
-			$evts[] = array('id' => 0, 'text' => __('To toggle Check-in status, select an event', 'event_espresso') );
123
-			foreach ( $events as $evt ) {
121
+			$events = EEM_Event::instance()->get_all(array($where, 'order_by' => array('Datetime.DTT_EVT_start' => 'DESC')));
122
+			$evts[] = array('id' => 0, 'text' => __('To toggle Check-in status, select an event', 'event_espresso'));
123
+			foreach ($events as $evt) {
124 124
 				//any registrations for this event?
125
-				if ( ! $evt->get_count_of_all_registrations() )
125
+				if ( ! $evt->get_count_of_all_registrations())
126 126
 					continue;
127 127
 				$evts[] = array(
128 128
 					'id' => $evt->ID(),
129
-					'text' => $evt->get( 'EVT_name' ),
129
+					'text' => $evt->get('EVT_name'),
130 130
 					'class' => $evt->is_expired() ? 'ee-expired-event' : ''
131 131
 				);
132 132
 			}
133 133
 			$event_filter = '<div class="ee-event-filter">';
134
-			$event_filter .= EEH_Form_Fields::select_input( 'event_id', $evts );
135
-			$event_filter .= '<br><span class="ee-event-filter-toggle"><input type="checkbox" id="js-ee-hide-expired-events" checked>' . ' ' . __( 'Hide Expired Events', 'event_espresso' ) . '</span>';
134
+			$event_filter .= EEH_Form_Fields::select_input('event_id', $evts);
135
+			$event_filter .= '<br><span class="ee-event-filter-toggle"><input type="checkbox" id="js-ee-hide-expired-events" checked>'.' '.__('Hide Expired Events', 'event_espresso').'</span>';
136 136
 			$event_filter .= '</div>';
137 137
 			$filters[] = $event_filter;
138 138
 
139 139
 		} else {
140 140
 			//DTT datetimes filter
141
-			$cur_dtt = isset( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : $this->_evt->primary_datetime()->ID();
141
+			$cur_dtt = isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : $this->_evt->primary_datetime()->ID();
142 142
 			$dtts = array();
143
-			foreach ( $this->_dtts_for_event as $dtt ) {
144
-				$datetime_string = $dtt->start_date_and_time() . ' - ' . $dtt->end_date_and_time();
145
-				$dtts[] = array('id' => $dtt->ID(), 'text' => $datetime_string );
143
+			foreach ($this->_dtts_for_event as $dtt) {
144
+				$datetime_string = $dtt->start_date_and_time().' - '.$dtt->end_date_and_time();
145
+				$dtts[] = array('id' => $dtt->ID(), 'text' => $datetime_string);
146 146
 			}
147 147
 			$filters[] = EEH_Form_Fields::select_input('DTT_ID', $dtts, $cur_dtt);
148 148
 		}
@@ -163,19 +163,19 @@  discard block
 block discarded – undo
163 163
 
164 164
 
165 165
 	protected function _get_total_event_attendees() {
166
-		$EVT_ID = isset($this->_req_data['event_id']) ? absint( $this->_req_data['event_id'] ) : FALSE;
167
-		$DTT_ID = isset( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : NULL;
166
+		$EVT_ID = isset($this->_req_data['event_id']) ? absint($this->_req_data['event_id']) : FALSE;
167
+		$DTT_ID = isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : NULL;
168 168
 		$query_params = array();
169
-		if ($EVT_ID){
170
-			$query_params[0]['EVT_ID']=$EVT_ID;
169
+		if ($EVT_ID) {
170
+			$query_params[0]['EVT_ID'] = $EVT_ID;
171 171
 		}
172 172
 		//if DTT is included we do multiple datetimes.  Otherwise we just do primary datetime
173
-		if ( $DTT_ID ) {
173
+		if ($DTT_ID) {
174 174
 			$query_params[0]['Ticket.Datetime.DTT_ID'] = $DTT_ID;
175 175
 		}
176
-		$status_ids_array = apply_filters( 'FHEE__Extend_Registrations_Admin_Page__get_event_attendees__status_ids_array', array( EEM_Registration::status_id_pending_payment, EEM_Registration::status_id_approved ) );
176
+		$status_ids_array = apply_filters('FHEE__Extend_Registrations_Admin_Page__get_event_attendees__status_ids_array', array(EEM_Registration::status_id_pending_payment, EEM_Registration::status_id_approved));
177 177
 
178
-		$query_params[0]['STS_ID']= array('IN', $status_ids_array );
178
+		$query_params[0]['STS_ID'] = array('IN', $status_ids_array);
179 179
 
180 180
 		return EEM_Registration::instance()->count($query_params);
181 181
 	}
@@ -186,8 +186,8 @@  discard block
 block discarded – undo
186 186
 
187 187
 
188 188
 
189
-	function column__Reg_Status( EE_Registration $item ) {
190
-		return '<span class="ee-status-strip ee-status-strip-td reg-status-' . $item->status_ID() . '"></span>';
189
+	function column__Reg_Status(EE_Registration $item) {
190
+		return '<span class="ee-status-strip ee-status-strip-td reg-status-'.$item->status_ID().'"></span>';
191 191
 	}
192 192
 
193 193
 
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
 
196 196
 
197 197
 	function column_cb($item) {
198
-		return sprintf( '<input type="checkbox" name="checkbox[%1$s]" value="%1$s" />', $item->ID() );
198
+		return sprintf('<input type="checkbox" name="checkbox[%1$s]" value="%1$s" />', $item->ID());
199 199
 	}
200 200
 
201 201
 
@@ -208,18 +208,18 @@  discard block
 block discarded – undo
208 208
 	/**
209 209
 	 * 		column_REG_att_checked_in
210 210
 	*/
211
-	function column__REG_att_checked_in(EE_Registration $item){
211
+	function column__REG_att_checked_in(EE_Registration $item) {
212 212
 		$attendee = $item->attendee();
213 213
 		$attendee_name = $attendee instanceof EE_Attendee ? $attendee->full_name() : '';
214
-		$DTT_ID = isset( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : 0;
214
+		$DTT_ID = isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : 0;
215 215
 		$checkinstatus = $item->check_in_status_for_datetime($DTT_ID);
216 216
 		$nonce = wp_create_nonce('checkin_nonce');
217
-		$evt_id = isset( $this->_req_data['event_id'] ) ? $this->_req_data['event_id'] : NULL;
218
-		$toggle_active = !empty ( $evt_id ) && EE_Registry::instance()->CAP->current_user_can( 'ee_edit_checkin', 'espresso_registrations_toggle_checkin_status', $item->ID() ) ? ' clickable trigger-checkin' : '';
217
+		$evt_id = isset($this->_req_data['event_id']) ? $this->_req_data['event_id'] : NULL;
218
+		$toggle_active = ! empty ($evt_id) && EE_Registry::instance()->CAP->current_user_can('ee_edit_checkin', 'espresso_registrations_toggle_checkin_status', $item->ID()) ? ' clickable trigger-checkin' : '';
219 219
 
220
-		$mobile_view_content = ' <span class="show-on-mobile-view-only">' . $attendee_name . '</span>';
220
+		$mobile_view_content = ' <span class="show-on-mobile-view-only">'.$attendee_name.'</span>';
221 221
 
222
-		 return '<span class="checkin-icons checkedin-status-' . $checkinstatus . $toggle_active . '" data-_regid="' . $item->ID() . '" data-dttid="' . $DTT_ID . '" data-nonce="' . $nonce . '"></span>' . $mobile_view_content;
222
+		 return '<span class="checkin-icons checkedin-status-'.$checkinstatus.$toggle_active.'" data-_regid="'.$item->ID().'" data-dttid="'.$DTT_ID.'" data-nonce="'.$nonce.'"></span>'.$mobile_view_content;
223 223
 	}
224 224
 
225 225
 
@@ -228,45 +228,45 @@  discard block
 block discarded – undo
228 228
 
229 229
 	function column_ATT_name(EE_Registration $item) {
230 230
 		$attendee = $item->attendee();
231
-		if ( ! $attendee instanceof EE_Attendee ) {
231
+		if ( ! $attendee instanceof EE_Attendee) {
232 232
 			return __('No contact record for this registration.', 'event_espresso');
233 233
 		}
234 234
 
235 235
 		// edit attendee link
236
-		$edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_registration', '_REG_ID'=>$item->ID() ), REG_ADMIN_URL );
237
-		$name_link = EE_Registry::instance()->CAP->current_user_can( 'ee_edit_contacts', 'espresso_registrations_edit_attendee' ) ?  '<a href="'.$edit_lnk_url.'" title="' . esc_attr__( 'Edit Contact', 'event_espresso' ) . '">' . $item->attendee()->full_name() . '</a>' : $item->attendee()->full_name();
236
+		$edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_registration', '_REG_ID'=>$item->ID()), REG_ADMIN_URL);
237
+		$name_link = EE_Registry::instance()->CAP->current_user_can('ee_edit_contacts', 'espresso_registrations_edit_attendee') ? '<a href="'.$edit_lnk_url.'" title="'.esc_attr__('Edit Contact', 'event_espresso').'">'.$item->attendee()->full_name().'</a>' : $item->attendee()->full_name();
238 238
 		$name_link .= $item->count() == 1 ? '&nbsp;<sup><div class="dashicons dashicons-star-filled lt-blue-icon ee-icon-size-8"></div></sup>	' : '';
239 239
 
240 240
 		//add group details
241
-		$name_link .= '&nbsp;' . sprintf(__( '(%s of %s)', 'event_espresso' ),$item->count(), $item->group_size());
241
+		$name_link .= '&nbsp;'.sprintf(__('(%s of %s)', 'event_espresso'), $item->count(), $item->group_size());
242 242
 
243 243
 		//add regcode
244
-		$link = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'view_registration', '_REG_ID' => $item->ID() ), REG_ADMIN_URL );
244
+		$link = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'view_registration', '_REG_ID' => $item->ID()), REG_ADMIN_URL);
245 245
 		$name_link .= '<br>';
246
-		$name_link .= EE_Registry::instance()->instance()->CAP->current_user_can('ee_read_registration', 'view_registration', $item->ID() )
247
-			? '<a href="' . $link . '" title="' . esc_attr__('View Registration Details', 'event_espresso') .'">' . $item->reg_code() . '</a>'
246
+		$name_link .= EE_Registry::instance()->instance()->CAP->current_user_can('ee_read_registration', 'view_registration', $item->ID())
247
+			? '<a href="'.$link.'" title="'.esc_attr__('View Registration Details', 'event_espresso').'">'.$item->reg_code().'</a>'
248 248
 			: $item->reg_code();
249 249
 
250 250
 		//status
251
-		$name_link .= '<br><span class="ee-status-text-small">' . EEH_Template::pretty_status( $item->status_ID(), false, 'sentence' ) . '</span>';
251
+		$name_link .= '<br><span class="ee-status-text-small">'.EEH_Template::pretty_status($item->status_ID(), false, 'sentence').'</span>';
252 252
 
253 253
 		$actions = array();
254
-		$DTT_ID = !empty( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : NULL;
255
-		$DTT_ID = empty( $DTT_ID ) && !empty( $this->_req_data['event_id'] ) ? EEM_Event::instance()->get_one_by_ID( $this->_req_data['event_id'] )->primary_datetime()->ID() : $DTT_ID;
254
+		$DTT_ID = ! empty($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : NULL;
255
+		$DTT_ID = empty($DTT_ID) && ! empty($this->_req_data['event_id']) ? EEM_Event::instance()->get_one_by_ID($this->_req_data['event_id'])->primary_datetime()->ID() : $DTT_ID;
256 256
 
257
-		if ( !empty($DTT_ID) && EE_Registry::instance()->CAP->current_user_can( 'ee_read_checkins', 'espresso_registrations_registration_checkins' ) ) {
258
-			$checkin_list_url = EE_Admin_Page::add_query_args_and_nonce( array('action' => 'registration_checkins', '_REGID' => $item->ID(), 'DTT_ID' => $DTT_ID));
259
-			$actions['checkin'] = '<a href="' . $checkin_list_url . '" title="' . esc_attr__('View all the check-ins/checkouts for this registrant', 'event_espresso' ) . '">' . __('View', 'event_espresso') . '</a>';
257
+		if ( ! empty($DTT_ID) && EE_Registry::instance()->CAP->current_user_can('ee_read_checkins', 'espresso_registrations_registration_checkins')) {
258
+			$checkin_list_url = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'registration_checkins', '_REGID' => $item->ID(), 'DTT_ID' => $DTT_ID));
259
+			$actions['checkin'] = '<a href="'.$checkin_list_url.'" title="'.esc_attr__('View all the check-ins/checkouts for this registrant', 'event_espresso').'">'.__('View', 'event_espresso').'</a>';
260 260
 		}
261 261
 
262 262
 
263 263
 
264
-		return !empty( $DTT_ID ) ? sprintf( '%1$s %2$s', $name_link, $this->row_actions($actions) ) : $name_link;
264
+		return ! empty($DTT_ID) ? sprintf('%1$s %2$s', $name_link, $this->row_actions($actions)) : $name_link;
265 265
 	}
266 266
 
267 267
 
268 268
 
269
-	function column_ATT_email( EE_Registration $item ) {
269
+	function column_ATT_email(EE_Registration $item) {
270 270
 		$attendee = $item->attendee();
271 271
 		return $attendee instanceof EE_Attendee ? $attendee->email() : '';
272 272
 		return $item->get_first_related('Attendee')->email();
@@ -279,10 +279,10 @@  discard block
 block discarded – undo
279 279
 	function column_Event(EE_Registration $item) {
280 280
 		try {
281 281
 			$event = $this->_evt instanceof EE_Event ? $this->_evt : $item->event();
282
-			$chkin_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'event_registrations', 'event_id'=>$event->ID() ), REG_ADMIN_URL );
283
-			$event_label = EE_Registry::instance()->CAP->current_user_can( 'ee_read_checkins', 'espresso_registrations_registration_checkins' ) ?  '<a href="'.$chkin_lnk_url.'" title="' . esc_attr__( 'View Checkins for this Event', 'event_espresso' ) . '">' . $event->name() . '</a>' : $event->name();
284
-		} catch( \EventEspresso\core\exceptions\EntityNotFoundException $e ) {
285
-			$event_label = esc_html__( 'Unknown', 'event_espresso' );
282
+			$chkin_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'event_registrations', 'event_id'=>$event->ID()), REG_ADMIN_URL);
283
+			$event_label = EE_Registry::instance()->CAP->current_user_can('ee_read_checkins', 'espresso_registrations_registration_checkins') ? '<a href="'.$chkin_lnk_url.'" title="'.esc_attr__('View Checkins for this Event', 'event_espresso').'">'.$event->name().'</a>' : $event->name();
284
+		} catch (\EventEspresso\core\exceptions\EntityNotFoundException $e) {
285
+			$event_label = esc_html__('Unknown', 'event_espresso');
286 286
 		}
287 287
 
288 288
 		return $event_label;
@@ -292,7 +292,7 @@  discard block
 block discarded – undo
292 292
 
293 293
 
294 294
 
295
-	function column_PRC_name(EE_Registration $item){
295
+	function column_PRC_name(EE_Registration $item) {
296 296
 		return $item->ticket() instanceof EE_Ticket ? $item->ticket()->name() : __("Unknown", "event_espresso");
297 297
 	}
298 298
 
@@ -304,8 +304,8 @@  discard block
 block discarded – undo
304 304
 	/**
305 305
 	 * 		column_REG_final_price
306 306
 	*/
307
-	function column__REG_final_price(EE_Registration $item){
308
-		return '<span class="reg-pad-rght">' .  ' ' . $item->pretty_final_price() . '</span>';
307
+	function column__REG_final_price(EE_Registration $item) {
308
+		return '<span class="reg-pad-rght">'.' '.$item->pretty_final_price().'</span>';
309 309
 	}
310 310
 
311 311
 
@@ -315,20 +315,20 @@  discard block
 block discarded – undo
315 315
 	/**
316 316
 	 * 		column_TXN_paid
317 317
 	*/
318
-	function column_TXN_paid(EE_Registration $item){
318
+	function column_TXN_paid(EE_Registration $item) {
319 319
 
320
-		if ( $item->count() == 1 ) {
320
+		if ($item->count() == 1) {
321 321
 
322
-			if ( $item->transaction()->paid() >= $item->transaction()->total() ) {
322
+			if ($item->transaction()->paid() >= $item->transaction()->total()) {
323 323
 				return '<span class="reg-pad-rght"><div class="dashicons dashicons-yes green-icon"></div></span>';
324 324
 			} else {
325
-				$view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->transaction_ID() ), TXN_ADMIN_URL );
326
-				return EE_Registry::instance()->CAP->current_user_can( 'ee_read_transaction', 'espresso_transactions_view_transaction' ) ?  '
325
+				$view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$item->transaction_ID()), TXN_ADMIN_URL);
326
+				return EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction') ? '
327 327
 				<span class="reg-pad-rght">
328
-					<a class="status-'. $item->transaction()->status_ID() .'" href="'.$view_txn_lnk_url.'"  title="' . esc_attr__( 'View Transaction', 'event_espresso' ) . '">
329
-						' . $item->transaction()->pretty_paid(). '
328
+					<a class="status-'. $item->transaction()->status_ID().'" href="'.$view_txn_lnk_url.'"  title="'.esc_attr__('View Transaction', 'event_espresso').'">
329
+						' . $item->transaction()->pretty_paid().'
330 330
 					</a>
331
-				<span>' : '<span class="reg-pad-rght">' . $item->transaction()->pretty_paid() . '</span>';
331
+				<span>' : '<span class="reg-pad-rght">'.$item->transaction()->pretty_paid().'</span>';
332 332
 			}
333 333
 		} else {
334 334
 			return '<span class="reg-pad-rght"></span>';
@@ -342,13 +342,13 @@  discard block
 block discarded – undo
342 342
 	/**
343 343
 	 * 		column_TXN_total
344 344
 	*/
345
-	function column_TXN_total(EE_Registration $item){
345
+	function column_TXN_total(EE_Registration $item) {
346 346
 		$txn = $item->transaction();
347
-		$view_txn_url = add_query_arg( array('action' => 'view_transaction', 'TXN_ID' => $txn->ID() ), TXN_ADMIN_URL );
348
-		if ( $item->get('REG_count') == 1 ) {
347
+		$view_txn_url = add_query_arg(array('action' => 'view_transaction', 'TXN_ID' => $txn->ID()), TXN_ADMIN_URL);
348
+		if ($item->get('REG_count') == 1) {
349 349
 			$line_total_obj = $txn->total_line_item();
350 350
 			$txn_total = $line_total_obj instanceof EE_Line_Item ? $line_total_obj->get_pretty('LIN_total') : __('View Transaction', 'event_espresso');
351
-			return EE_Registry::instance()->CAP->current_user_can( 'ee_read_transaction', 'espresso_transactions_view_transaction' ) ?  '<a href="' . $view_txn_url . '" title="' . esc_attr__('View Transaction', 'event_espresso') . '"><span class="reg-pad-rght">'. $txn_total  .'</span></a>' : '<span class="reg-pad-rght">' . $txn_total . '</span>';
351
+			return EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction') ? '<a href="'.$view_txn_url.'" title="'.esc_attr__('View Transaction', 'event_espresso').'"><span class="reg-pad-rght">'.$txn_total.'</span></a>' : '<span class="reg-pad-rght">'.$txn_total.'</span>';
352 352
 		} else {
353 353
 			return '<span class="reg-pad-rght"></span>';
354 354
 		}
Please login to merge, or discard this patch.
core/libraries/form_sections/form_handlers/SequentialStepFormManager.php 1 patch
Spacing   +76 added lines, -76 removed lines patch added patch discarded remove patch
@@ -16,8 +16,8 @@  discard block
 block discarded – undo
16 16
 use Exception;
17 17
 use InvalidArgumentException;
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
 
@@ -115,11 +115,11 @@  discard block
 block discarded – undo
115 115
 		$progress_step_style = 'number_bubbles',
116 116
 		EE_Request $request
117 117
 	) {
118
-		$this->setBaseUrl( $base_url );
119
-		$this->setDefaultFormStep( $default_form_step );
120
-		$this->setFormAction( $form_action );
121
-		$this->setFormConfig( $form_config );
122
-		$this->setProgressStepStyle( $progress_step_style );
118
+		$this->setBaseUrl($base_url);
119
+		$this->setDefaultFormStep($default_form_step);
120
+		$this->setFormAction($form_action);
121
+		$this->setFormConfig($form_config);
122
+		$this->setProgressStepStyle($progress_step_style);
123 123
 		$this->request = $request;
124 124
 	}
125 125
 
@@ -130,9 +130,9 @@  discard block
 block discarded – undo
130 130
 	 * @throws \EventEspresso\core\exceptions\InvalidDataTypeException
131 131
 	 */
132 132
 	public function baseUrl() {
133
-		if ( strpos( $this->base_url, $this->getCurrentStep()->slug() ) === false ) {
133
+		if (strpos($this->base_url, $this->getCurrentStep()->slug()) === false) {
134 134
 			add_query_arg(
135
-				array( $this->form_step_url_key => $this->getCurrentStep()->slug() ),
135
+				array($this->form_step_url_key => $this->getCurrentStep()->slug()),
136 136
 				$this->base_url
137 137
 			);
138 138
 		}
@@ -146,13 +146,13 @@  discard block
 block discarded – undo
146 146
 	 * @throws InvalidDataTypeException
147 147
 	 * @throws InvalidArgumentException
148 148
 	 */
149
-	protected function setBaseUrl( $base_url ) {
150
-		if ( ! is_string( $base_url ) ) {
151
-			throw new InvalidDataTypeException( '$base_url', $base_url, 'string' );
149
+	protected function setBaseUrl($base_url) {
150
+		if ( ! is_string($base_url)) {
151
+			throw new InvalidDataTypeException('$base_url', $base_url, 'string');
152 152
 		}
153
-		if ( empty( $base_url ) ) {
153
+		if (empty($base_url)) {
154 154
 			throw new InvalidArgumentException(
155
-				__( 'The base URL can not be an empty string.', 'event_espresso' )
155
+				__('The base URL can not be an empty string.', 'event_espresso')
156 156
 			);
157 157
 		}
158 158
 		$this->base_url = $base_url;
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
 	 * @throws InvalidDataTypeException
166 166
 	 */
167 167
 	public function formStepUrlKey() {
168
-		if ( empty( $this->form_step_url_key ) ) {
168
+		if (empty($this->form_step_url_key)) {
169 169
 			$this->setFormStepUrlKey();
170 170
 		}
171 171
 		return $this->form_step_url_key;
@@ -177,11 +177,11 @@  discard block
 block discarded – undo
177 177
 	 * @param string $form_step_url_key
178 178
 	 * @throws InvalidDataTypeException
179 179
 	 */
180
-	public function setFormStepUrlKey( $form_step_url_key = 'ee-form-step' ) {
181
-		if ( ! is_string( $form_step_url_key ) ) {
182
-			throw new InvalidDataTypeException( '$form_step_key', $form_step_url_key, 'string' );
180
+	public function setFormStepUrlKey($form_step_url_key = 'ee-form-step') {
181
+		if ( ! is_string($form_step_url_key)) {
182
+			throw new InvalidDataTypeException('$form_step_key', $form_step_url_key, 'string');
183 183
 		}
184
-		$this->form_step_url_key = ! empty( $form_step_url_key ) ? $form_step_url_key : 'ee-form-step';
184
+		$this->form_step_url_key = ! empty($form_step_url_key) ? $form_step_url_key : 'ee-form-step';
185 185
 	}
186 186
 
187 187
 
@@ -199,9 +199,9 @@  discard block
 block discarded – undo
199 199
 	 * @param $default_form_step
200 200
 	 * @throws InvalidDataTypeException
201 201
 	 */
202
-	protected function setDefaultFormStep( $default_form_step ) {
203
-		if ( ! is_string( $default_form_step ) ) {
204
-			throw new InvalidDataTypeException( '$default_form_step', $default_form_step, 'string' );
202
+	protected function setDefaultFormStep($default_form_step) {
203
+		if ( ! is_string($default_form_step)) {
204
+			throw new InvalidDataTypeException('$default_form_step', $default_form_step, 'string');
205 205
 		}
206 206
 		$this->default_form_step = $default_form_step;
207 207
 	}
@@ -214,8 +214,8 @@  discard block
 block discarded – undo
214 214
 	 * @throws InvalidDataTypeException
215 215
 	 */
216 216
 	protected function setCurrentStepFromRequest() {
217
-		$current_step_slug = $this->request()->get( $this->formStepUrlKey(), $this->defaultFormStep() );
218
-		if ( ! $this->form_steps->setCurrent( $current_step_slug ) ) {
217
+		$current_step_slug = $this->request()->get($this->formStepUrlKey(), $this->defaultFormStep());
218
+		if ( ! $this->form_steps->setCurrent($current_step_slug)) {
219 219
 			throw new InvalidIdentifierException(
220 220
 				$current_step_slug,
221 221
 				$this->defaultFormStep(),
@@ -237,8 +237,8 @@  discard block
 block discarded – undo
237 237
 	 * @throws \EventEspresso\core\exceptions\InvalidDataTypeException
238 238
 	 */
239 239
 	public function getCurrentStep() {
240
-		if ( ! $this->form_steps->current() instanceof SequentialStepForm ) {
241
-			throw new InvalidFormHandlerException( $this->form_steps->current() );
240
+		if ( ! $this->form_steps->current() instanceof SequentialStepForm) {
241
+			throw new InvalidFormHandlerException($this->form_steps->current());
242 242
 		}
243 243
 		return $this->form_steps->current();
244 244
 	}
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
 	 * @throws \EventEspresso\core\exceptions\InvalidDataTypeException
251 251
 	 */
252 252
 	public function formAction() {
253
-		if ( ! is_string( $this->form_action ) || empty( $this->form_action ) ) {
253
+		if ( ! is_string($this->form_action) || empty($this->form_action)) {
254 254
 			$this->form_action = $this->baseUrl();
255 255
 		}
256 256
 		return $this->form_action;
@@ -262,9 +262,9 @@  discard block
 block discarded – undo
262 262
 	 * @param string $form_action
263 263
 	 * @throws InvalidDataTypeException
264 264
 	 */
265
-	public function setFormAction( $form_action ) {
266
-		if ( ! is_string( $form_action ) ) {
267
-			throw new InvalidDataTypeException( '$form_action', $form_action, 'string' );
265
+	public function setFormAction($form_action) {
266
+		if ( ! is_string($form_action)) {
267
+			throw new InvalidDataTypeException('$form_action', $form_action, 'string');
268 268
 		}
269 269
 		$this->form_action = $form_action;
270 270
 	}
@@ -275,15 +275,15 @@  discard block
 block discarded – undo
275 275
 	 * @param array $form_action_args
276 276
 	 * @throws InvalidDataTypeException
277 277
 	 */
278
-	public function addFormActionArgs( $form_action_args = array() ) {
279
-		if ( ! is_array( $form_action_args ) ) {
280
-			throw new InvalidDataTypeException( '$form_action_args', $form_action_args, 'array' );
278
+	public function addFormActionArgs($form_action_args = array()) {
279
+		if ( ! is_array($form_action_args)) {
280
+			throw new InvalidDataTypeException('$form_action_args', $form_action_args, 'array');
281 281
 		}
282
-		$form_action_args = ! empty( $form_action_args )
282
+		$form_action_args = ! empty($form_action_args)
283 283
 			? $form_action_args
284
-			: array( $this->formStepUrlKey() => $this->form_steps->current()->slug() );
284
+			: array($this->formStepUrlKey() => $this->form_steps->current()->slug());
285 285
 		$this->getCurrentStep()->setFormAction(
286
-			add_query_arg( $form_action_args, $this->formAction() )
286
+			add_query_arg($form_action_args, $this->formAction())
287 287
 		);
288 288
 		$this->form_action = $this->getCurrentStep()->formAction();
289 289
 	}
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
 	/**
303 303
 	 * @param string $form_config
304 304
 	 */
305
-	public function setFormConfig( $form_config ) {
305
+	public function setFormConfig($form_config) {
306 306
 		$this->form_config = $form_config;
307 307
 	}
308 308
 
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
 	/**
321 321
 	 * @param string $progress_step_style
322 322
 	 */
323
-	public function setProgressStepStyle( $progress_step_style ) {
323
+	public function setProgressStepStyle($progress_step_style) {
324 324
 		$this->progress_step_style = $progress_step_style;
325 325
 	}
326 326
 
@@ -340,7 +340,7 @@  discard block
 block discarded – undo
340 340
 	 */
341 341
 	protected function getProgressStepsCollection() {
342 342
 		static $collection = null;
343
-		if ( ! $collection instanceof ProgressStepCollection ) {
343
+		if ( ! $collection instanceof ProgressStepCollection) {
344 344
 			$collection = new ProgressStepCollection();
345 345
 		}
346 346
 		return $collection;
@@ -356,12 +356,12 @@  discard block
 block discarded – undo
356 356
 	 * @throws InvalidClassException
357 357
 	 * @throws InvalidInterfaceException
358 358
 	 */
359
-	protected function generateProgressSteps( Collection $progress_steps_collection ) {
359
+	protected function generateProgressSteps(Collection $progress_steps_collection) {
360 360
 		$current_step = $this->getCurrentStep();
361 361
 		/** @var SequentialStepForm $form_step */
362
-		foreach ( $this->form_steps as $form_step ) {
362
+		foreach ($this->form_steps as $form_step) {
363 363
 			// is this step active ?
364
-			if ( ! $form_step->initialize() ) {
364
+			if ( ! $form_step->initialize()) {
365 365
 				continue;
366 366
 			}
367 367
 			$progress_steps_collection->add(
@@ -375,7 +375,7 @@  discard block
 block discarded – undo
375 375
 			);
376 376
 		}
377 377
 		// set collection pointer back to current step
378
-		$this->form_steps->setCurrentUsingObject( $current_step );
378
+		$this->form_steps->setCurrentUsingObject($current_step);
379 379
 		return new ProgressStepManager(
380 380
 			$this->progressStepStyle(),
381 381
 			$this->defaultFormStep(),
@@ -409,9 +409,9 @@  discard block
 block discarded – undo
409 409
 	 * @throws InvalidInterfaceException
410 410
 	 * @throws InvalidArgumentException
411 411
 	 */
412
-	public function processForm( $form_data = array() ) {
412
+	public function processForm($form_data = array()) {
413 413
 		$this->buildCurrentStepFormForProcessing();
414
-		$this->processCurrentStepForm( $form_data );
414
+		$this->processCurrentStepForm($form_data);
415 415
 	}
416 416
 
417 417
 
@@ -427,10 +427,10 @@  discard block
 block discarded – undo
427 427
 	public function buildCurrentStepFormForDisplay() {
428 428
 		$form_step = $this->buildCurrentStepForm();
429 429
 		// no displayable content ? then skip straight to processing
430
-		if ( ! $form_step->displayable() ) {
430
+		if ( ! $form_step->displayable()) {
431 431
 			$this->addFormActionArgs();
432
-			$form_step->setFormAction( $this->formAction() );
433
-			wp_safe_redirect( $form_step->formAction() );
432
+			$form_step->setFormAction($this->formAction());
433
+			wp_safe_redirect($form_step->formAction());
434 434
 		}
435 435
 	}
436 436
 
@@ -445,7 +445,7 @@  discard block
 block discarded – undo
445 445
 	 * @throws InvalidArgumentException
446 446
 	 */
447 447
 	public function buildCurrentStepFormForProcessing() {
448
-		$this->buildCurrentStepForm( false );
448
+		$this->buildCurrentStepForm(false);
449 449
 	}
450 450
 
451 451
 
@@ -460,14 +460,14 @@  discard block
 block discarded – undo
460 460
 	 * @throws InvalidInterfaceException
461 461
 	 * @throws InvalidArgumentException
462 462
 	 */
463
-	private function buildCurrentStepForm( $for_display = true ) {
463
+	private function buildCurrentStepForm($for_display = true) {
464 464
 		$this->form_steps = $this->getFormStepsCollection();
465 465
 		$this->setCurrentStepFromRequest();
466 466
 		$form_step = $this->getCurrentStep();
467
-		if ( $form_step->submitBtnText() === __( 'Submit', 'event_espresso' ) ) {
468
-			$form_step->setSubmitBtnText( __( 'Next Step', 'event_espresso' ) );
467
+		if ($form_step->submitBtnText() === __('Submit', 'event_espresso')) {
468
+			$form_step->setSubmitBtnText(__('Next Step', 'event_espresso'));
469 469
 		}
470
-		if ( $for_display && $form_step->displayable() ) {
470
+		if ($for_display && $form_step->displayable()) {
471 471
 			$this->progress_step_manager = $this->generateProgressSteps(
472 472
 				$this->getProgressStepsCollection()
473 473
 			);
@@ -478,16 +478,16 @@  discard block
 block discarded – undo
478 478
 			$this->progress_step_manager->setPreviousStepsCompleted();
479 479
 			$this->progress_step_manager->enqueueStylesAndScripts();
480 480
 			$this->addFormActionArgs();
481
-			$form_step->setFormAction( $this->formAction() );
481
+			$form_step->setFormAction($this->formAction());
482 482
 
483 483
 		} else {
484
-			$form_step->setRedirectUrl( $this->baseUrl() );
484
+			$form_step->setRedirectUrl($this->baseUrl());
485 485
 			$form_step->addRedirectArgs(
486
-				array( $this->formStepUrlKey() => $this->form_steps->current()->slug() )
486
+				array($this->formStepUrlKey() => $this->form_steps->current()->slug())
487 487
 			);
488 488
 		}
489 489
 		$form_step->generate();
490
-		if ( $for_display ) {
490
+		if ($for_display) {
491 491
 			$form_step->enqueueStylesAndScripts();
492 492
 		}
493 493
 		return $form_step;
@@ -499,7 +499,7 @@  discard block
 block discarded – undo
499 499
 	 * @param bool $return_as_string
500 500
 	 * @return string
501 501
 	 */
502
-	public function displayProgressSteps( $return_as_string = true ) {
502
+	public function displayProgressSteps($return_as_string = true) {
503 503
 		$progress_steps = apply_filters(
504 504
 			'FHEE__EventEspresso_core_libraries_form_sections_form_handlers_SequentialStepFormManager__displayProgressSteps__before_steps',
505 505
 			''
@@ -509,7 +509,7 @@  discard block
 block discarded – undo
509 509
 			'FHEE__EventEspresso_core_libraries_form_sections_form_handlers_SequentialStepFormManager__displayProgressSteps__after_steps',
510 510
 			''
511 511
 		);
512
-		if ( $return_as_string ) {
512
+		if ($return_as_string) {
513 513
 			return $progress_steps;
514 514
 		}
515 515
 		echo $progress_steps;
@@ -523,8 +523,8 @@  discard block
 block discarded – undo
523 523
 	 * @return string
524 524
 	 * @throws \EventEspresso\core\exceptions\InvalidDataTypeException
525 525
 	 */
526
-	public function displayCurrentStepForm( $return_as_string = true ) {
527
-		if ( $return_as_string ) {
526
+	public function displayCurrentStepForm($return_as_string = true) {
527
+		if ($return_as_string) {
528 528
 			return $this->getCurrentStep()->display();
529 529
 		}
530 530
 		echo $this->getCurrentStep()->display();
@@ -539,32 +539,32 @@  discard block
 block discarded – undo
539 539
 	 * @throws InvalidArgumentException
540 540
 	 * @throws InvalidDataTypeException
541 541
 	 */
542
-	public function processCurrentStepForm( $form_data = array() ) {
542
+	public function processCurrentStepForm($form_data = array()) {
543 543
 		// grab instance of current step because after calling next() below,
544 544
 		// any calls to getCurrentStep() will return the "next" step because we advanced
545 545
 		$current_step = $this->getCurrentStep();
546 546
 		try {
547 547
 			// form processing should either throw exceptions or return true
548
-			$current_step->process( $form_data );
549
-		} catch ( Exception $e ) {
548
+			$current_step->process($form_data);
549
+		} catch (Exception $e) {
550 550
 			// something went wrong, so...
551 551
 			// if WP_DEBUG === true, display the Exception and stack trace right now
552
-			new ExceptionStackTraceDisplay( $e );
552
+			new ExceptionStackTraceDisplay($e);
553 553
 			// else convert the Exception to an EE_Error
554
-			EE_Error::add_error( $e->getMessage(), __FILE__, __FUNCTION__, __LINE__ );
554
+			EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__);
555 555
 			// prevent redirect to next step or other if exception was thrown
556 556
 			if (
557 557
 				$current_step->redirectTo() === SequentialStepForm::REDIRECT_TO_NEXT_STEP
558 558
 				|| $current_step->redirectTo() === SequentialStepForm::REDIRECT_TO_OTHER
559 559
 			) {
560
-				$current_step->setRedirectTo( SequentialStepForm::REDIRECT_TO_CURRENT_STEP );
560
+				$current_step->setRedirectTo(SequentialStepForm::REDIRECT_TO_CURRENT_STEP);
561 561
 			}
562 562
 		}
563 563
 		// save notices to a transient so that when we redirect back
564 564
 		// to the display portion for this step
565 565
 		// those notices can be displayed
566
-		EE_Error::get_notices( false, true );
567
-		$this->redirectForm( $current_step );
566
+		EE_Error::get_notices(false, true);
567
+		$this->redirectForm($current_step);
568 568
 	}
569 569
 
570 570
 
@@ -574,13 +574,13 @@  discard block
 block discarded – undo
574 574
 	 *
575 575
 	 * @param \EventEspresso\core\libraries\form_sections\form_handlers\SequentialStepFormInterface $current_step
576 576
 	 */
577
-	public function redirectForm( SequentialStepFormInterface $current_step ) {
577
+	public function redirectForm(SequentialStepFormInterface $current_step) {
578 578
 		$redirect_step = $current_step;
579
-		switch( $current_step->redirectTo() ) {
579
+		switch ($current_step->redirectTo()) {
580 580
 
581 581
 			case SequentialStepForm::REDIRECT_TO_OTHER :
582 582
 				// going somewhere else, so just check out now
583
-				wp_safe_redirect( $redirect_step->redirectUrl() );
583
+				wp_safe_redirect($redirect_step->redirectUrl());
584 584
 				exit();
585 585
 				break;
586 586
 
@@ -590,7 +590,7 @@  discard block
 block discarded – undo
590 590
 
591 591
 			case SequentialStepForm::REDIRECT_TO_NEXT_STEP :
592 592
 				$this->form_steps->next();
593
-				if ( $this->form_steps->valid() ) {
593
+				if ($this->form_steps->valid()) {
594 594
 					$redirect_step = $this->form_steps->current();
595 595
 				}
596 596
 				break;
@@ -600,12 +600,12 @@  discard block
 block discarded – undo
600 600
 				// $redirect_step is already set
601 601
 
602 602
 		}
603
-		$current_step->setRedirectUrl( $this->baseUrl() );
603
+		$current_step->setRedirectUrl($this->baseUrl());
604 604
 		$current_step->addRedirectArgs(
605 605
 			// use the slug for whatever step we are redirecting too
606
-			array( $this->formStepUrlKey() => $redirect_step->slug() )
606
+			array($this->formStepUrlKey() => $redirect_step->slug())
607 607
 		);
608
-		wp_safe_redirect( $current_step->redirectUrl() );
608
+		wp_safe_redirect($current_step->redirectUrl());
609 609
 		exit();
610 610
 	}
611 611
 
Please login to merge, or discard this patch.
core/libraries/rest_api/Model_Version_Info.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -92,7 +92,7 @@
 block discarded – undo
92 92
     /**
93 93
      * Model_Version_Info constructor.
94 94
      *
95
-     * @param array $requested_version
95
+     * @param string $requested_version
96 96
      */
97 97
     public function __construct( $requested_version ) {
98 98
 		$this->_requested_version = $requested_version;
Please login to merge, or discard this patch.
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -89,12 +89,12 @@  discard block
 block discarded – undo
89 89
 
90 90
 
91 91
 
92
-    /**
93
-     * Model_Version_Info constructor.
94
-     *
95
-     * @param array $requested_version
96
-     */
97
-    public function __construct( $requested_version ) {
92
+	/**
93
+	 * Model_Version_Info constructor.
94
+	 *
95
+	 * @param array $requested_version
96
+	 */
97
+	public function __construct( $requested_version ) {
98 98
 		$this->_requested_version = $requested_version;
99 99
 		$this->_model_changes = array(
100 100
 			'4.8.29' => array(
@@ -209,10 +209,10 @@  discard block
 block discarded – undo
209 209
 				}
210 210
 			}
211 211
 			$this->_cached_models_for_requested_version = apply_filters(
212
-			    'FHEE__EventEspresso_core_libraries_rest_api__models_for_requested_version',
213
-                $all_models_in_current_version,
214
-                $this
215
-            );
212
+				'FHEE__EventEspresso_core_libraries_rest_api__models_for_requested_version',
213
+				$all_models_in_current_version,
214
+				$this
215
+			);
216 216
 		}
217 217
 		return $this->_cached_models_for_requested_version;
218 218
 	}
Please login to merge, or discard this patch.
Spacing   +61 added lines, -61 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 namespace EventEspresso\core\libraries\rest_api;
3 3
 
4
-if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) {
5
-	exit( 'No direct script access allowed' );
4
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
5
+	exit('No direct script access allowed');
6 6
 }
7 7
 
8 8
 /**
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
      *
95 95
      * @param array $requested_version
96 96
      */
97
-    public function __construct( $requested_version ) {
97
+    public function __construct($requested_version) {
98 98
 		$this->_requested_version = $requested_version;
99 99
 		$this->_model_changes = array(
100 100
 			'4.8.29' => array(
@@ -116,13 +116,13 @@  discard block
 block discarded – undo
116 116
 			'table_column' => 'N/A',
117 117
 			'always_available' => true,
118 118
 		);
119
-		foreach( $this->_resource_changes as $version => $model_classnames ) {
120
-			foreach( $model_classnames as $model_classname => $extra_fields ) {
121
-				foreach( $extra_fields as $fieldname => $field_data ) {
122
-					$this->_resource_changes[ $model_classname ][ $fieldname ][ 'name' ] = $fieldname;
123
-					foreach( $defaults as $attribute => $default_value ) {
124
-						if( ! isset( $this->_resource_changes[ $model_classname ][ $fieldname ][ $attribute ] ) ) {
125
-							$this->_resource_changes[ $model_classname ][ $fieldname ][ $attribute ] = $default_value;
119
+		foreach ($this->_resource_changes as $version => $model_classnames) {
120
+			foreach ($model_classnames as $model_classname => $extra_fields) {
121
+				foreach ($extra_fields as $fieldname => $field_data) {
122
+					$this->_resource_changes[$model_classname][$fieldname]['name'] = $fieldname;
123
+					foreach ($defaults as $attribute => $default_value) {
124
+						if ( ! isset($this->_resource_changes[$model_classname][$fieldname][$attribute])) {
125
+							$this->_resource_changes[$model_classname][$fieldname][$attribute] = $default_value;
126 126
 						}
127 127
 					}
128 128
 				}
@@ -138,11 +138,11 @@  discard block
 block discarded – undo
138 138
 	 * @return array
139 139
 	 */
140 140
 	public function model_changes_between_requested_version_and_current() {
141
-		if( $this->_cached_model_changes_between_requested_version_and_current === null ) {
141
+		if ($this->_cached_model_changes_between_requested_version_and_current === null) {
142 142
 			$model_changes = array();
143
-			foreach( $this->model_changes() as $version => $models_changed_in_version ) {
144
-				if( $version <= \EED_Core_Rest_Api::core_version() && $version > $this->requested_version() ) {
145
-					$model_changes[ $version ] = $models_changed_in_version;
143
+			foreach ($this->model_changes() as $version => $models_changed_in_version) {
144
+				if ($version <= \EED_Core_Rest_Api::core_version() && $version > $this->requested_version()) {
145
+					$model_changes[$version] = $models_changed_in_version;
146 146
 				}
147 147
 			}
148 148
 			$this->_cached_model_changes_between_requested_version_and_current = $model_changes;
@@ -158,11 +158,11 @@  discard block
 block discarded – undo
158 158
 	 * @return array
159 159
 	 */
160 160
 	public function resource_changes_between_requested_version_and_current() {
161
-		if( $this->_cached_resource_changes_between_requested_version_and_current === null ) {
161
+		if ($this->_cached_resource_changes_between_requested_version_and_current === null) {
162 162
 			$resource_changes = array();
163
-			foreach( $this->resource_changes() as $version => $model_classnames ) {
164
-				if( $version <= \EED_Core_Rest_Api::core_version()  && $version > $this->requested_version()  ) {
165
-					$resource_changes[ $version ] = $model_classnames;
163
+			foreach ($this->resource_changes() as $version => $model_classnames) {
164
+				if ($version <= \EED_Core_Rest_Api::core_version() && $version > $this->requested_version()) {
165
+					$resource_changes[$version] = $model_classnames;
166 166
 				}
167 167
 			}
168 168
 			$this->_cached_resource_changes_between_requested_version_and_current = $resource_changes;
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
 	 * If a request was sent to 'wp-json/ee/v4.7/events' this would be '4.7'
175 175
 	 * @return string like '4.6'
176 176
 	 */
177
-	public function requested_version(){
177
+	public function requested_version() {
178 178
 		return $this->_requested_version;
179 179
 	}
180 180
 
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
 	 * If a version is missing then we don't know anything about what changes it introduced from the previous version
189 189
 	 * @return array
190 190
 	 */
191
-	public function model_changes(){
191
+	public function model_changes() {
192 192
 		return $this->_model_changes;
193 193
 	}
194 194
 
@@ -199,12 +199,12 @@  discard block
 block discarded – undo
199 199
 	 * @return array keys are model names, values are their classname
200 200
 	 */
201 201
 	public function models_for_requested_version() {
202
-		if( $this->_cached_models_for_requested_version === null ) {
202
+		if ($this->_cached_models_for_requested_version === null) {
203 203
 			$all_models_in_current_version = \EE_Registry::instance()->non_abstract_db_models;
204
-			foreach( $this->model_changes_between_requested_version_and_current() as $version => $models_changed ) {
205
-				foreach( $models_changed as $model_name => $new_indicator_or_fields_added ) {
206
-					if( $new_indicator_or_fields_added === Model_Version_Info::model_added ) {
207
-						unset( $all_models_in_current_version[ $model_name ] );
204
+			foreach ($this->model_changes_between_requested_version_and_current() as $version => $models_changed) {
205
+				foreach ($models_changed as $model_name => $new_indicator_or_fields_added) {
206
+					if ($new_indicator_or_fields_added === Model_Version_Info::model_added) {
207
+						unset($all_models_in_current_version[$model_name]);
208 208
 					}
209 209
 				}
210 210
 			}
@@ -227,11 +227,11 @@  discard block
 block discarded – undo
227 227
 	 * @param string $model_name eg 'Event'
228 228
 	 * @return boolean
229 229
 	 */
230
-	public function is_model_name_in_this_version( $model_name ) {
230
+	public function is_model_name_in_this_version($model_name) {
231 231
 		$model_names = $this->models_for_requested_version();
232
-		if( isset( $model_names[ $model_name ] ) ) {
232
+		if (isset($model_names[$model_name])) {
233 233
 			return true;
234
-		}else{
234
+		} else {
235 235
 			return false;
236 236
 		}
237 237
 	}
@@ -246,10 +246,10 @@  discard block
 block discarded – undo
246 246
 	 * @return \EEM_Base
247 247
 	 * @throws \EE_Error
248 248
 	 */
249
-	public function load_model( $model_name ) {
250
-		if( $this->is_model_name_in_this_version( $model_name ) ) {
251
-			return \EE_Registry::instance()->load_model( $model_name );
252
-		}else{
249
+	public function load_model($model_name) {
250
+		if ($this->is_model_name_in_this_version($model_name)) {
251
+			return \EE_Registry::instance()->load_model($model_name);
252
+		} else {
253 253
 			throw new \EE_Error(
254 254
 				sprintf(
255 255
 					__(
@@ -271,21 +271,21 @@  discard block
 block discarded – undo
271 271
 	 * @param \EEM_Base $model
272 272
 	 * @return array|\EE_Model_Field_Base[]
273 273
 	 */
274
-	public function fields_on_model_in_this_version( $model ) {
275
-		if( ! isset( $this->_cached_fields_on_models[ $model->get_this_model_name() ] ) ) {
274
+	public function fields_on_model_in_this_version($model) {
275
+		if ( ! isset($this->_cached_fields_on_models[$model->get_this_model_name()])) {
276 276
 			//get all model changes between the requested version and current core version
277 277
 			$changes = $this->model_changes_between_requested_version_and_current();
278 278
 			//fetch all fields currently on this model
279 279
 			$current_fields = $model->field_settings();
280 280
 			//remove all fields that have been added since
281
-			foreach( $changes as $version => $changes_in_version ) {
282
-				if(
283
-					isset( $changes_in_version[ $model->get_this_model_name() ] )
284
-					&& $changes_in_version[ $model->get_this_model_name() ] !== Model_Version_Info::model_added
281
+			foreach ($changes as $version => $changes_in_version) {
282
+				if (
283
+					isset($changes_in_version[$model->get_this_model_name()])
284
+					&& $changes_in_version[$model->get_this_model_name()] !== Model_Version_Info::model_added
285 285
 				) {
286 286
 					$current_fields = array_diff_key(
287 287
 						$current_fields,
288
-						array_flip( $changes_in_version[ $model->get_this_model_name() ] )
288
+						array_flip($changes_in_version[$model->get_this_model_name()])
289 289
 					);
290 290
 				}
291 291
 			}
@@ -303,9 +303,9 @@  discard block
 block discarded – undo
303 303
 	 * @param array $classnames
304 304
 	 * @return boolean
305 305
 	 */
306
-	public function is_subclass_of_one( $object, $classnames ) {
307
-		foreach( $classnames as $classname ) {
308
-			if( is_a( $object, $classname ) ) {
306
+	public function is_subclass_of_one($object, $classnames) {
307
+		foreach ($classnames as $classname) {
308
+			if (is_a($object, $classname)) {
309 309
 				return true;
310 310
 			}
311 311
 		}
@@ -316,10 +316,10 @@  discard block
 block discarded – undo
316 316
 	 * Returns the list of model field classes that that the API basically ignores
317 317
 	 * @return array
318 318
 	 */
319
-	public function fields_ignored(){
319
+	public function fields_ignored() {
320 320
 		return apply_filters(
321 321
 			'FHEE__Controller_Model_Read_fields_ignored',
322
-			array( 'EE_Foreign_Key_Field_Base', 'EE_Any_Foreign_Model_Name_Field' )
322
+			array('EE_Foreign_Key_Field_Base', 'EE_Any_Foreign_Model_Name_Field')
323 323
 		);
324 324
 	}
325 325
 
@@ -328,8 +328,8 @@  discard block
 block discarded – undo
328 328
 	 * @param EE_Model_Field_Base
329 329
 	 * @return boolean
330 330
 	 */
331
-	public function field_is_ignored( $field_obj ){
332
-		 return $this->is_subclass_of_one( $field_obj, $this->fields_ignored() );
331
+	public function field_is_ignored($field_obj) {
332
+		 return $this->is_subclass_of_one($field_obj, $this->fields_ignored());
333 333
 	}
334 334
 
335 335
 	/**
@@ -340,7 +340,7 @@  discard block
 block discarded – undo
340 340
 	public function fields_that_have_rendered_format() {
341 341
 		return apply_filters(
342 342
 			'FHEE__Controller_Model_Read__fields_raw',
343
-			array( 'EE_Post_Content_Field', 'EE_Full_HTML_Field' )
343
+			array('EE_Post_Content_Field', 'EE_Full_HTML_Field')
344 344
 		);
345 345
 	}
346 346
 
@@ -349,8 +349,8 @@  discard block
 block discarded – undo
349 349
 	 * @param EE_Model_Field_Base
350 350
 	 * @return boolean
351 351
 	 */
352
-	public function field_has_rendered_format( $field_obj ){
353
-		 return $this->is_subclass_of_one( $field_obj, $this->fields_that_have_rendered_format() );
352
+	public function field_has_rendered_format($field_obj) {
353
+		 return $this->is_subclass_of_one($field_obj, $this->fields_that_have_rendered_format());
354 354
 	}
355 355
 
356 356
 	/**
@@ -362,7 +362,7 @@  discard block
 block discarded – undo
362 362
 	public function fields_that_have_pretty_format() {
363 363
 		return apply_filters(
364 364
 			'FHEE__Controller_Model_Read__fields_pretty',
365
-			array( 'EE_Enum_Integer_Field', 'EE_Enum_Text_Field', 'EE_Money_Field' )
365
+			array('EE_Enum_Integer_Field', 'EE_Enum_Text_Field', 'EE_Money_Field')
366 366
 		);
367 367
 	}
368 368
 
@@ -371,8 +371,8 @@  discard block
 block discarded – undo
371 371
 	 * @param EE_Model_Field_Base
372 372
 	 * @return boolean
373 373
 	 */
374
-	public function field_has_pretty_format( $field_obj ){
375
-		 return $this->is_subclass_of_one( $field_obj, $this->fields_that_have_pretty_format() );
374
+	public function field_has_pretty_format($field_obj) {
375
+		 return $this->is_subclass_of_one($field_obj, $this->fields_that_have_pretty_format());
376 376
 	}
377 377
 
378 378
 	/**
@@ -389,12 +389,12 @@  discard block
 block discarded – undo
389 389
 	 * @param \EEM_Base $model
390 390
 	 * @return array
391 391
 	 */
392
-	public function extra_resource_properties_for_model( $model ) {
392
+	public function extra_resource_properties_for_model($model) {
393 393
 		$extra_properties = array();
394
-		foreach( $this->resource_changes_between_requested_version_and_current() as $version => $model_classnames ) {
395
-			foreach( $model_classnames as $model_classname => $properties_added_in_this_version ) {
396
-				if( is_subclass_of( $model, $model_classname ) ) {
397
-					$extra_properties = array_merge( $extra_properties, $properties_added_in_this_version );
394
+		foreach ($this->resource_changes_between_requested_version_and_current() as $version => $model_classnames) {
395
+			foreach ($model_classnames as $model_classname => $properties_added_in_this_version) {
396
+				if (is_subclass_of($model, $model_classname)) {
397
+					$extra_properties = array_merge($extra_properties, $properties_added_in_this_version);
398 398
 				}
399 399
 			}
400 400
 		}
@@ -407,11 +407,11 @@  discard block
 block discarded – undo
407 407
 	 * @param \EEM_Base $model
408 408
 	 * @return \EE_Model_Relation_Base[]
409 409
 	 */
410
-	public function relation_settings( \EEM_Base $model ) {
410
+	public function relation_settings(\EEM_Base $model) {
411 411
 		$relations = array();
412
-		foreach( $model->relation_settings() as $relation_name => $relation_obj ) {
413
-			if( $this->is_model_name_in_this_version(  $relation_name ) ) {
414
-				$relations[ $relation_name ] = $relation_obj;
412
+		foreach ($model->relation_settings() as $relation_name => $relation_obj) {
413
+			if ($this->is_model_name_in_this_version($relation_name)) {
414
+				$relations[$relation_name] = $relation_obj;
415 415
 			}
416 416
 		}
417 417
 		//filter the results, but use the old filter name
Please login to merge, or discard this patch.
core/EE_Capabilities.core.php 2 patches
Indentation   +19 added lines, -20 removed lines patch added patch discarded remove patch
@@ -113,7 +113,6 @@  discard block
 block discarded – undo
113 113
 
114 114
 	/**
115 115
 	 * This sets the meta caps property.
116
-
117 116
 	 * @since 4.5.0
118 117
 	 *
119 118
 	 * @return void
@@ -227,7 +226,7 @@  discard block
 block discarded – undo
227 226
 			 * capability mapping which will be used for accessing payment methods owned by
228 227
 			 * other users.  This is not fully implemented yet in the payment method ui.
229 228
 			 * Currently only the "plural" caps are in active use. (Specific payment method caps are in use as well).
230
-			**/
229
+			 **/
231 230
 				'ee_manage_gateways',
232 231
 				'ee_read_payment_method',
233 232
 				'ee_read_payment_methods',
@@ -739,15 +738,15 @@  discard block
 block discarded – undo
739 738
 				}
740 739
 			}
741 740
 		} else {
742
-            //not a cpt object so handled differently
743
-            $has_cap = false;
744
-            try {
745
-                $has_cap = method_exists($obj, 'wp_user') && $obj->wp_user() && $user_id == $obj->wp_user();
746
-            } catch (Exception $e) {
747
-                if (WP_DEBUG) {
748
-                    EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__);
749
-                }
750
-            }
741
+			//not a cpt object so handled differently
742
+			$has_cap = false;
743
+			try {
744
+				$has_cap = method_exists($obj, 'wp_user') && $obj->wp_user() && $user_id == $obj->wp_user();
745
+			} catch (Exception $e) {
746
+				if (WP_DEBUG) {
747
+					EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__);
748
+				}
749
+			}
751 750
 			if ($has_cap) {
752 751
 				$caps[] = $cap;
753 752
 			} else {
@@ -854,15 +853,15 @@  discard block
 block discarded – undo
854 853
 				$caps[] = $cap;
855 854
 			}
856 855
 		} else {
857
-            //not a cpt object so handled differently
858
-            $has_cap = false;
859
-            try {
860
-                $has_cap = method_exists($obj, 'wp_user') && $obj->wp_user() && $user_id == $obj->wp_user();
861
-            } catch (Exception $e) {
862
-                if (WP_DEBUG) {
863
-                    EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__);
864
-                }
865
-            }
856
+			//not a cpt object so handled differently
857
+			$has_cap = false;
858
+			try {
859
+				$has_cap = method_exists($obj, 'wp_user') && $obj->wp_user() && $user_id == $obj->wp_user();
860
+			} catch (Exception $e) {
861
+				if (WP_DEBUG) {
862
+					EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__);
863
+				}
864
+			}
866 865
 			if ($has_cap) {
867 866
 				$caps[] = $cap;
868 867
 			} elseif ( ! empty( $this->private_cap ) ) {
Please login to merge, or discard this patch.
Spacing   +128 added lines, -128 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
 
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 	 */
72 72
 	public static function instance() {
73 73
 		//check if instantiated, and if not do so.
74
-		if ( ! self::$_instance instanceof EE_Capabilities ) {
74
+		if ( ! self::$_instance instanceof EE_Capabilities) {
75 75
 			self::$_instance = new self();
76 76
 		}
77 77
 		return self::$_instance;
@@ -100,10 +100,10 @@  discard block
 block discarded – undo
100 100
 	 * @since 4.5.0
101 101
 	 * @return void
102 102
 	 */
103
-	public function init_caps( $reset = false ) {
104
-		if ( EE_Maintenance_Mode::instance()->models_can_query() ){
103
+	public function init_caps($reset = false) {
104
+		if (EE_Maintenance_Mode::instance()->models_can_query()) {
105 105
 			$this->_caps_map = $this->_init_caps_map();
106
-			$this->init_role_caps( $reset );
106
+			$this->init_role_caps($reset);
107 107
 			$this->_set_meta_caps();
108 108
 		}
109 109
 	}
@@ -122,11 +122,11 @@  discard block
 block discarded – undo
122 122
 		//make sure we're only ever initializing the default _meta_caps array once if it's empty.
123 123
 		$this->_meta_caps = $this->_get_default_meta_caps_array();
124 124
 
125
-		$this->_meta_caps = apply_filters( 'FHEE__EE_Capabilities___set_meta_caps__meta_caps', $this->_meta_caps );
125
+		$this->_meta_caps = apply_filters('FHEE__EE_Capabilities___set_meta_caps__meta_caps', $this->_meta_caps);
126 126
 
127 127
 		//add filter for map_meta_caps but only if models can query.
128
-		if ( EE_Maintenance_Mode::instance()->models_can_query() && ! has_filter( 'map_meta_cap', array( $this, 'map_meta_caps' ) ) ) {
129
-			add_filter( 'map_meta_cap', array( $this, 'map_meta_caps' ), 10, 4 );
128
+		if (EE_Maintenance_Mode::instance()->models_can_query() && ! has_filter('map_meta_cap', array($this, 'map_meta_caps'))) {
129
+			add_filter('map_meta_cap', array($this, 'map_meta_caps'), 10, 4);
130 130
 		}
131 131
 	}
132 132
 
@@ -139,37 +139,37 @@  discard block
 block discarded – undo
139 139
 	 */
140 140
 	private function _get_default_meta_caps_array() {
141 141
 		static $default_meta_caps = array();
142
-		if ( empty( $default_meta_caps ) ) {
142
+		if (empty($default_meta_caps)) {
143 143
 			$default_meta_caps = array(
144 144
 				//edits
145
-				new EE_Meta_Capability_Map_Edit( 'ee_edit_event', array( 'Event', 'ee_edit_published_events', 'ee_edit_others_events', 'ee_edit_private_events' ) ),
146
-				new EE_Meta_Capability_Map_Edit( 'ee_edit_venue', array( 'Venue', 'ee_edit_published_venues', 'ee_edit_others_venues', 'ee_edit_private_venues' ) ),
147
-				new EE_Meta_Capability_Map_Edit( 'ee_edit_registration', array( 'Registration', '', 'ee_edit_others_registrations', '' ) ),
148
-				new EE_Meta_Capability_Map_Edit( 'ee_edit_checkin', array( 'Registration', '', 'ee_edit_others_checkins', '' ) ),
149
-				new EE_Meta_Capability_Map_Messages_Cap( 'ee_edit_message', array( 'Message_Template_Group', '', 'ee_edit_others_messages', 'ee_edit_global_messages' ) ),
150
-				new EE_Meta_Capability_Map_Edit( 'ee_edit_default_ticket', array( 'Ticket', '', 'ee_edit_others_default_tickets', '' ) ),
151
-				new EE_Meta_Capability_Map_Registration_Form_Cap( 'ee_edit_question', array( 'Question', '', '', 'ee_edit_system_questions' ) ),
152
-				new EE_Meta_Capability_Map_Registration_Form_Cap( 'ee_edit_question_group', array( 'Question_Group', '', '', 'ee_edit_system_question_groups' ) ),
153
-				new EE_Meta_Capability_Map_Edit( 'ee_edit_payment_method', array( 'Payment_Method', '', 'ee_edit_others_payment_methods', '' ) ),
145
+				new EE_Meta_Capability_Map_Edit('ee_edit_event', array('Event', 'ee_edit_published_events', 'ee_edit_others_events', 'ee_edit_private_events')),
146
+				new EE_Meta_Capability_Map_Edit('ee_edit_venue', array('Venue', 'ee_edit_published_venues', 'ee_edit_others_venues', 'ee_edit_private_venues')),
147
+				new EE_Meta_Capability_Map_Edit('ee_edit_registration', array('Registration', '', 'ee_edit_others_registrations', '')),
148
+				new EE_Meta_Capability_Map_Edit('ee_edit_checkin', array('Registration', '', 'ee_edit_others_checkins', '')),
149
+				new EE_Meta_Capability_Map_Messages_Cap('ee_edit_message', array('Message_Template_Group', '', 'ee_edit_others_messages', 'ee_edit_global_messages')),
150
+				new EE_Meta_Capability_Map_Edit('ee_edit_default_ticket', array('Ticket', '', 'ee_edit_others_default_tickets', '')),
151
+				new EE_Meta_Capability_Map_Registration_Form_Cap('ee_edit_question', array('Question', '', '', 'ee_edit_system_questions')),
152
+				new EE_Meta_Capability_Map_Registration_Form_Cap('ee_edit_question_group', array('Question_Group', '', '', 'ee_edit_system_question_groups')),
153
+				new EE_Meta_Capability_Map_Edit('ee_edit_payment_method', array('Payment_Method', '', 'ee_edit_others_payment_methods', '')),
154 154
 				//reads
155
-				new EE_Meta_Capability_Map_Read( 'ee_read_event', array( 'Event', '', 'ee_read_others_events', 'ee_read_private_events' ) ),
156
-				new EE_Meta_Capability_Map_Read( 'ee_read_venue', array( 'Venue', '', 'ee_read_others_venues', 'ee_read_private_venues' ) ),
157
-				new EE_Meta_Capability_Map_Read( 'ee_read_registration', array( 'Registration', '', '', 'ee_edit_others_registrations' ) ),
158
-				new EE_Meta_Capability_Map_Read( 'ee_read_checkin', array( 'Registration', '', '', 'ee_read_others_checkins' ) ),
159
-				new EE_Meta_Capability_Map_Messages_Cap( 'ee_read_message', array( 'Message_Template_Group', '', 'ee_read_others_messages', 'ee_read_global_messages' ) ),
160
-				new EE_Meta_Capability_Map_Read( 'ee_read_default_ticket', array( 'Ticket', '', '', 'ee_read_others_default_tickets' ) ),
161
-				new EE_Meta_Capability_Map_Read( 'ee_read_payment_method', array( 'Payment_Method', '', '', 'ee_read_others_payment_methods' ) ),
155
+				new EE_Meta_Capability_Map_Read('ee_read_event', array('Event', '', 'ee_read_others_events', 'ee_read_private_events')),
156
+				new EE_Meta_Capability_Map_Read('ee_read_venue', array('Venue', '', 'ee_read_others_venues', 'ee_read_private_venues')),
157
+				new EE_Meta_Capability_Map_Read('ee_read_registration', array('Registration', '', '', 'ee_edit_others_registrations')),
158
+				new EE_Meta_Capability_Map_Read('ee_read_checkin', array('Registration', '', '', 'ee_read_others_checkins')),
159
+				new EE_Meta_Capability_Map_Messages_Cap('ee_read_message', array('Message_Template_Group', '', 'ee_read_others_messages', 'ee_read_global_messages')),
160
+				new EE_Meta_Capability_Map_Read('ee_read_default_ticket', array('Ticket', '', '', 'ee_read_others_default_tickets')),
161
+				new EE_Meta_Capability_Map_Read('ee_read_payment_method', array('Payment_Method', '', '', 'ee_read_others_payment_methods')),
162 162
 
163 163
 				//deletes
164
-				new EE_Meta_Capability_Map_Delete( 'ee_delete_event', array( 'Event', 'ee_delete_published_events', 'ee_delete_others_events', 'ee_delete_private_events' ) ),
165
-				new EE_Meta_Capability_Map_Delete( 'ee_delete_venue', array( 'Venue', 'ee_delete_published_venues', 'ee_delete_others_venues', 'ee_delete_private_venues' ) ),
166
-				new EE_Meta_Capability_Map_Delete( 'ee_delete_registration', array( 'Registration', '', 'ee_delete_others_registrations', '' ) ),
167
-				new EE_Meta_Capability_Map_Delete( 'ee_delete_checkin', array( 'Registration', '', 'ee_delete_others_checkins', '' ) ),
168
-				new EE_Meta_Capability_Map_Messages_Cap( 'ee_delete_message', array( 'Message_Template_Group', '', 'ee_delete_others_messages', 'ee_delete_global_messages' ) ),
169
-				new EE_Meta_Capability_Map_Delete( 'ee_delete_default_ticket', array( 'Ticket', '', 'ee_delete_others_default_tickets', '' ) ),
170
-				new EE_Meta_Capability_Map_Registration_Form_Cap( 'ee_delete_question', array( 'Question', '', '', 'delete_system_questions' ) ),
171
-				new EE_Meta_Capability_Map_Registration_Form_Cap( 'ee_delete_question_group', array( 'Question_Group', '', '', 'delete_system_question_groups' ) ),
172
-				new EE_Meta_Capability_Map_Delete( 'ee_delete_payment_method', array( 'Payment_Method', '', 'ee_delete_others_payment_methods', '' ) ),
164
+				new EE_Meta_Capability_Map_Delete('ee_delete_event', array('Event', 'ee_delete_published_events', 'ee_delete_others_events', 'ee_delete_private_events')),
165
+				new EE_Meta_Capability_Map_Delete('ee_delete_venue', array('Venue', 'ee_delete_published_venues', 'ee_delete_others_venues', 'ee_delete_private_venues')),
166
+				new EE_Meta_Capability_Map_Delete('ee_delete_registration', array('Registration', '', 'ee_delete_others_registrations', '')),
167
+				new EE_Meta_Capability_Map_Delete('ee_delete_checkin', array('Registration', '', 'ee_delete_others_checkins', '')),
168
+				new EE_Meta_Capability_Map_Messages_Cap('ee_delete_message', array('Message_Template_Group', '', 'ee_delete_others_messages', 'ee_delete_global_messages')),
169
+				new EE_Meta_Capability_Map_Delete('ee_delete_default_ticket', array('Ticket', '', 'ee_delete_others_default_tickets', '')),
170
+				new EE_Meta_Capability_Map_Registration_Form_Cap('ee_delete_question', array('Question', '', '', 'delete_system_questions')),
171
+				new EE_Meta_Capability_Map_Registration_Form_Cap('ee_delete_question_group', array('Question_Group', '', '', 'delete_system_question_groups')),
172
+				new EE_Meta_Capability_Map_Delete('ee_delete_payment_method', array('Payment_Method', '', 'ee_delete_others_payment_methods', '')),
173 173
 			);
174 174
 		}
175 175
 		return $default_meta_caps;
@@ -193,15 +193,15 @@  discard block
 block discarded – undo
193 193
 	 *
194 194
 	 * @return array   actual users capabilities
195 195
 	 */
196
-	public function map_meta_caps( $caps, $cap, $user_id, $args ) {
196
+	public function map_meta_caps($caps, $cap, $user_id, $args) {
197 197
 		//loop through our _meta_caps array
198
-		foreach ( $this->_meta_caps as $meta_map ) {
199
-			if ( ! $meta_map instanceof EE_Meta_Capability_Map ) {
198
+		foreach ($this->_meta_caps as $meta_map) {
199
+			if ( ! $meta_map instanceof EE_Meta_Capability_Map) {
200 200
 				continue;
201 201
 			}
202 202
 			$meta_map->ensure_is_model();
203 203
 
204
-			$caps = $meta_map->map_meta_caps( $caps, $cap, $user_id, $args );
204
+			$caps = $meta_map->map_meta_caps($caps, $cap, $user_id, $args);
205 205
 		}
206 206
 		return $caps;
207 207
 	}
@@ -528,7 +528,7 @@  discard block
 block discarded – undo
528 528
 			)
529 529
 		);
530 530
 
531
-		$caps = apply_filters( 'FHEE__EE_Capabilities__init_caps_map__caps', $caps );
531
+		$caps = apply_filters('FHEE__EE_Capabilities__init_caps_map__caps', $caps);
532 532
 		return $caps;
533 533
 	}
534 534
 
@@ -545,27 +545,27 @@  discard block
 block discarded – undo
545 545
 	 *
546 546
 	 * @return void
547 547
 	 */
548
-	public function init_role_caps( $reset = false, $custom_map = array() ) {
548
+	public function init_role_caps($reset = false, $custom_map = array()) {
549 549
 
550
-		$caps_map = empty( $custom_map ) ? $this->_caps_map : $custom_map;
550
+		$caps_map = empty($custom_map) ? $this->_caps_map : $custom_map;
551 551
 
552 552
 		//first let's determine if these caps have already been set.
553
-		$caps_set_before = get_option( self::option_name, array() );
553
+		$caps_set_before = get_option(self::option_name, array());
554 554
 		//if not reset, see what caps are new for each role. if they're new, add them.
555
-		foreach ( $caps_map as $role => $caps_for_role ) {
556
-			foreach ( $caps_for_role as $cap ) {
555
+		foreach ($caps_map as $role => $caps_for_role) {
556
+			foreach ($caps_for_role as $cap) {
557 557
 				//first check we haven't already added this cap before, or it's a reset
558
-				if ( $reset || ! isset( $caps_set_before[ $role ] ) || ! in_array( $cap, $caps_set_before[ $role ] ) ) {
559
-					if ( $this->add_cap_to_role( $role, $cap ) ) {
560
-						$caps_set_before[ $role ][] = $cap;
558
+				if ($reset || ! isset($caps_set_before[$role]) || ! in_array($cap, $caps_set_before[$role])) {
559
+					if ($this->add_cap_to_role($role, $cap)) {
560
+						$caps_set_before[$role][] = $cap;
561 561
 					}
562 562
 				}
563 563
 			}
564 564
 		}
565 565
 
566 566
 		//now let's just save the cap that has been set.
567
-		update_option( self::option_name, $caps_set_before );
568
-		do_action( 'AHEE__EE_Capabilities__init_role_caps__complete', $caps_set_before );
567
+		update_option(self::option_name, $caps_set_before);
568
+		do_action('AHEE__EE_Capabilities__init_role_caps__complete', $caps_set_before);
569 569
 	}
570 570
 
571 571
 
@@ -584,20 +584,20 @@  discard block
 block discarded – undo
584 584
 	 * @param bool $grant  Whether to grant access to this cap on this role.
585 585
 	 * @return bool
586 586
 	 */
587
-	public function add_cap_to_role( $role, $cap, $grant = true ) {
588
-		$role_object = get_role( $role );
587
+	public function add_cap_to_role($role, $cap, $grant = true) {
588
+		$role_object = get_role($role);
589 589
 		//if the role isn't available then we create it.
590
-		if ( ! $role_object instanceof WP_Role ) {
590
+		if ( ! $role_object instanceof WP_Role) {
591 591
 			//if a plugin wants to create a specific role name then they should create the role before
592 592
 			//EE_Capabilities does.  Otherwise this function will create the role name from the slug:
593 593
 			// - removes any `ee_` namespacing from the start of the slug.
594 594
 			// - replaces `_` with ` ` (empty space).
595 595
 			// - sentence case on the resulting string.
596
-			$role_label = ucwords( str_replace( '_', ' ', str_replace( 'ee_', '', $role ) ) );
597
-			$role_object = add_role( $role, $role_label );
596
+			$role_label = ucwords(str_replace('_', ' ', str_replace('ee_', '', $role)));
597
+			$role_object = add_role($role, $role_label);
598 598
 		}
599
-		if ( $role_object instanceof WP_Role ) {
600
-			$role_object->add_cap( $cap, $grant );
599
+		if ($role_object instanceof WP_Role) {
600
+			$role_object->add_cap($cap, $grant);
601 601
 			return true;
602 602
 		}
603 603
 		return false;
@@ -619,10 +619,10 @@  discard block
 block discarded – undo
619 619
 	 *
620 620
 	 * @return void
621 621
 	 */
622
-	public function remove_cap_from_role( $role, $cap ) {
623
-		$role = get_role( $role );
624
-		if ( $role instanceof WP_Role ) {
625
-			$role->remove_cap( $cap );
622
+	public function remove_cap_from_role($role, $cap) {
623
+		$role = get_role($role);
624
+		if ($role instanceof WP_Role) {
625
+			$role->remove_cap($cap);
626 626
 		}
627 627
 	}
628 628
 
@@ -643,11 +643,11 @@  discard block
 block discarded – undo
643 643
 	 *
644 644
 	 * @return bool  Whether user can or not.
645 645
 	 */
646
-	public function current_user_can( $cap, $context, $id = 0 ) {
646
+	public function current_user_can($cap, $context, $id = 0) {
647 647
 		//apply filters (both a global on just the cap, and context specific.  Global overrides context specific)
648
-		$filtered_cap = apply_filters( 'FHEE__EE_Capabilities__current_user_can__cap__' . $context,  $cap, $id );
649
-		$filtered_cap = apply_filters( 'FHEE__EE_Capabilities__current_user_can__cap', $filtered_cap, $context, $cap, $id );
650
-		return ! empty( $id ) ? current_user_can( $filtered_cap, $id ) : current_user_can( $filtered_cap );
648
+		$filtered_cap = apply_filters('FHEE__EE_Capabilities__current_user_can__cap__'.$context, $cap, $id);
649
+		$filtered_cap = apply_filters('FHEE__EE_Capabilities__current_user_can__cap', $filtered_cap, $context, $cap, $id);
650
+		return ! empty($id) ? current_user_can($filtered_cap, $id) : current_user_can($filtered_cap);
651 651
 	}
652 652
 
653 653
 
@@ -664,11 +664,11 @@  discard block
 block discarded – undo
664 664
 	 *
665 665
 	 * @return bool Whether user can or not.
666 666
 	 */
667
-	public function user_can( $user, $cap, $context, $id = 0 ) {
667
+	public function user_can($user, $cap, $context, $id = 0) {
668 668
 		//apply filters (both a global on just the cap, and context specific.  Global overrides context specific)
669
-		$filtered_cap = apply_filters( 'FHEE__EE_Capabilities__user_can__cap__' . $context, $cap, $user, $id );
670
-		$filtered_cap = apply_filters( 'FHEE__EE_Capabilities__user_can__cap', $filtered_cap, $context, $cap, $user,  $id );
671
-		return ! empty( $id ) ? user_can( $user, $filtered_cap, $id ) : user_can( $user, $filtered_cap );
669
+		$filtered_cap = apply_filters('FHEE__EE_Capabilities__user_can__cap__'.$context, $cap, $user, $id);
670
+		$filtered_cap = apply_filters('FHEE__EE_Capabilities__user_can__cap', $filtered_cap, $context, $cap, $user, $id);
671
+		return ! empty($id) ? user_can($user, $filtered_cap, $id) : user_can($user, $filtered_cap);
672 672
 	}
673 673
 
674 674
 
@@ -688,12 +688,12 @@  discard block
 block discarded – undo
688 688
 	 *
689 689
 	 * @return bool  Whether user can or not.
690 690
 	 */
691
-	public function current_user_can_for_blog( $blog_id, $cap, $context, $id = 0 ) {
692
-		$user_can = ! empty( $id ) ? current_user_can_for_blog( $blog_id, $cap, $id ) : current_user_can( $blog_id, $cap );
691
+	public function current_user_can_for_blog($blog_id, $cap, $context, $id = 0) {
692
+		$user_can = ! empty($id) ? current_user_can_for_blog($blog_id, $cap, $id) : current_user_can($blog_id, $cap);
693 693
 
694 694
 		//apply filters (both a global on just the cap, and context specific.  Global overrides context specific)
695
-		$user_can = apply_filters( 'FHEE__EE_Capabilities__current_user_can_for_blog__user_can__' . $context, $user_can, $blog_id, $cap, $id );
696
-		$user_can = apply_filters( 'FHEE__EE_Capabilities__current_user_can_for_blog__user_can', $user_can, $context, $blog_id, $cap, $id );
695
+		$user_can = apply_filters('FHEE__EE_Capabilities__current_user_can_for_blog__user_can__'.$context, $user_can, $blog_id, $cap, $id);
696
+		$user_can = apply_filters('FHEE__EE_Capabilities__current_user_can_for_blog__user_can', $user_can, $context, $blog_id, $cap, $id);
697 697
 		return $user_can;
698 698
 	}
699 699
 
@@ -709,12 +709,12 @@  discard block
 block discarded – undo
709 709
 	 *
710 710
 	 * @return array
711 711
 	 */
712
-	public function get_ee_capabilities( $role = 'administrator' ) {
712
+	public function get_ee_capabilities($role = 'administrator') {
713 713
 		$capabilities = $this->_init_caps_map();
714
-		if ( empty( $role ) ) {
714
+		if (empty($role)) {
715 715
 			return $capabilities;
716 716
 		}
717
-		return isset( $capabilities[ $role ] ) ? $capabilities[ $role ] : array();
717
+		return isset($capabilities[$role]) ? $capabilities[$role] : array();
718 718
 	}
719 719
 }
720 720
 
@@ -762,11 +762,11 @@  discard block
 block discarded – undo
762 762
 	 * 	}
763 763
 	 * @throws EE_Error
764 764
 	 */
765
-	public function __construct( $meta_cap, $map_values ) {
765
+	public function __construct($meta_cap, $map_values) {
766 766
 		$this->meta_cap = $meta_cap;
767 767
 		//verify there are four args in the $map_values array;
768
-		if ( count( $map_values ) !== 4 ) {
769
-			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 ) ) );
768
+		if (count($map_values) !== 4) {
769
+			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)));
770 770
 		}
771 771
 
772 772
 		//set properties
@@ -780,8 +780,8 @@  discard block
 block discarded – undo
780 780
 	/**
781 781
 	 * Makes it so this object stops filtering caps
782 782
 	 */
783
-	public function remove_filters(){
784
-		remove_filter( 'map_meta_cap', array( $this, 'map_meta_caps' ), 10 );
783
+	public function remove_filters() {
784
+		remove_filter('map_meta_cap', array($this, 'map_meta_caps'), 10);
785 785
 	}
786 786
 
787 787
 
@@ -796,19 +796,19 @@  discard block
 block discarded – undo
796 796
 	 */
797 797
 	public function ensure_is_model() {
798 798
 		//is it already instantiated?
799
-		if ( $this->_model instanceof EEM_Base ) {
799
+		if ($this->_model instanceof EEM_Base) {
800 800
 			return;
801 801
 		}
802 802
 
803 803
 		//ensure model name is string
804 804
 		$this->_model_name = (string) $this->_model_name;
805 805
 		//error proof if the name has EEM in it
806
-		$this->_model_name = str_replace( 'EEM', '', $this->_model_name );
806
+		$this->_model_name = str_replace('EEM', '', $this->_model_name);
807 807
 
808
-		$this->_model = EE_Registry::instance()->load_model( $this->_model_name );
808
+		$this->_model = EE_Registry::instance()->load_model($this->_model_name);
809 809
 
810
-		if ( ! $this->_model instanceof EEM_Base ) {
811
-			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 ) );
810
+		if ( ! $this->_model instanceof EEM_Base) {
811
+			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));
812 812
 		}
813 813
 	}
814 814
 
@@ -824,8 +824,8 @@  discard block
 block discarded – undo
824 824
 	 *
825 825
 	 * @return array
826 826
 	 */
827
-	public function map_meta_caps( $caps, $cap, $user_id, $args ) {
828
-		return $this->_map_meta_caps( $caps, $cap, $user_id, $args );
827
+	public function map_meta_caps($caps, $cap, $user_id, $args) {
828
+		return $this->_map_meta_caps($caps, $cap, $user_id, $args);
829 829
 	}
830 830
 
831 831
 
@@ -843,7 +843,7 @@  discard block
 block discarded – undo
843 843
 	 *
844 844
 	 * @return array   actual users capabilities
845 845
 	 */
846
-	abstract protected function _map_meta_caps( $caps, $cap, $user_id, $args );
846
+	abstract protected function _map_meta_caps($caps, $cap, $user_id, $args);
847 847
 }
848 848
 
849 849
 
@@ -875,28 +875,28 @@  discard block
 block discarded – undo
875 875
 	 *
876 876
 	 * @return array   actual users capabilities
877 877
 	 */
878
-	protected function _map_meta_caps( $caps, $cap, $user_id, $args ) {
878
+	protected function _map_meta_caps($caps, $cap, $user_id, $args) {
879 879
 		//only process if we're checking our mapped_cap
880
-		if ( $cap !== $this->meta_cap ) {
880
+		if ($cap !== $this->meta_cap) {
881 881
 			return $caps;
882 882
 		}
883 883
 
884
-		$obj = ! empty( $args[0] ) ? $this->_model->get_one_by_ID( $args[0] ) : null;
884
+		$obj = ! empty($args[0]) ? $this->_model->get_one_by_ID($args[0]) : null;
885 885
 
886 886
 		//if no obj then let's just do cap
887
-		if ( ! $obj instanceof EE_Base_Class ) {
887
+		if ( ! $obj instanceof EE_Base_Class) {
888 888
 			$caps[] = $cap;
889 889
 			return $caps;
890 890
 		}
891 891
 
892
-		if ( $obj instanceof EE_CPT_Base ) {
892
+		if ($obj instanceof EE_CPT_Base) {
893 893
 			//if the item author is set and the user is the author...
894
-			if ( $obj->wp_user() && $user_id == $obj->wp_user() ) {
895
-				if ( empty( $this->published_cap ) ) {
894
+			if ($obj->wp_user() && $user_id == $obj->wp_user()) {
895
+				if (empty($this->published_cap)) {
896 896
 					$caps[] = $cap;
897 897
 				} else {
898 898
 					//if obj is published...
899
-					if ( $obj->status() == 'publish' ) {
899
+					if ($obj->status() == 'publish') {
900 900
 						$caps[] = $this->published_cap;
901 901
 					} else {
902 902
 						$caps[] = $cap;
@@ -904,12 +904,12 @@  discard block
 block discarded – undo
904 904
 				}
905 905
 			} else {
906 906
 				//the user is trying to edit someone else's obj
907
-				if ( ! empty( $this->others_cap ) ) {
907
+				if ( ! empty($this->others_cap)) {
908 908
 					$caps[] = $this->others_cap;
909 909
 				}
910
-				if ( ! empty( $this->published_cap ) && $obj->status() == 'publish' ) {
910
+				if ( ! empty($this->published_cap) && $obj->status() == 'publish') {
911 911
 					$caps[] = $this->published_cap;
912
-				} elseif ( ! empty( $this->private_cap ) && $obj->status() == 'private' ) {
912
+				} elseif ( ! empty($this->private_cap) && $obj->status() == 'private') {
913 913
 					$caps[] = $this->private_cap;
914 914
 				}
915 915
 			}
@@ -926,7 +926,7 @@  discard block
 block discarded – undo
926 926
 			if ($has_cap) {
927 927
 				$caps[] = $cap;
928 928
 			} else {
929
-				if ( ! empty( $this->others_cap ) ) {
929
+				if ( ! empty($this->others_cap)) {
930 930
 					$caps[] = $this->others_cap;
931 931
 				}
932 932
 			}
@@ -963,8 +963,8 @@  discard block
 block discarded – undo
963 963
 	 *
964 964
 	 * @return array   actual users capabilities
965 965
 	 */
966
-	protected function _map_meta_caps( $caps, $cap, $user_id, $args ) {
967
-		return parent::_map_meta_caps( $caps, $cap, $user_id, $args );
966
+	protected function _map_meta_caps($caps, $cap, $user_id, $args) {
967
+		return parent::_map_meta_caps($caps, $cap, $user_id, $args);
968 968
 	}
969 969
 }
970 970
 
@@ -996,34 +996,34 @@  discard block
 block discarded – undo
996 996
 	 *
997 997
 	 * @return array   actual users capabilities
998 998
 	 */
999
-	protected function _map_meta_caps( $caps, $cap, $user_id, $args ) {
999
+	protected function _map_meta_caps($caps, $cap, $user_id, $args) {
1000 1000
 		//only process if we're checking our mapped cap;
1001
-		if ( $cap !== $this->meta_cap ) {
1001
+		if ($cap !== $this->meta_cap) {
1002 1002
 			return $caps;
1003 1003
 		}
1004 1004
 
1005
-		$obj = ! empty( $args[0] ) ? $this->_model->get_one_by_ID( $args[0] ) : null;
1005
+		$obj = ! empty($args[0]) ? $this->_model->get_one_by_ID($args[0]) : null;
1006 1006
 
1007 1007
 		//if no obj then let's just do cap
1008
-		if ( ! $obj instanceof EE_Base_Class ) {
1008
+		if ( ! $obj instanceof EE_Base_Class) {
1009 1009
 			$caps[] = $cap;
1010 1010
 			return $caps;
1011 1011
 		}
1012 1012
 
1013
-		if ( $obj instanceof EE_CPT_Base ) {
1014
-			$status_obj = get_post_status_object( $obj->status() );
1015
-			if ( $status_obj->public ) {
1013
+		if ($obj instanceof EE_CPT_Base) {
1014
+			$status_obj = get_post_status_object($obj->status());
1015
+			if ($status_obj->public) {
1016 1016
 				$caps[] = $cap;
1017 1017
 				return $caps;
1018 1018
 			}
1019 1019
 
1020 1020
 			//if the item author is set and the user is the author...
1021
-			if ( $obj->wp_user() && $user_id == $obj->wp_user() ) {
1021
+			if ($obj->wp_user() && $user_id == $obj->wp_user()) {
1022 1022
 				$caps[] = $cap;
1023
-			} elseif ( $status_obj->private && ! empty( $this->private_cap ) ) {
1023
+			} elseif ($status_obj->private && ! empty($this->private_cap)) {
1024 1024
 				//the user is trying to view someone else's obj
1025 1025
 				$caps[] = $this->private_cap;
1026
-			} elseif ( ! empty( $this->others_cap ) ) {
1026
+			} elseif ( ! empty($this->others_cap)) {
1027 1027
 				$caps[] = $this->others_cap;
1028 1028
 			} else {
1029 1029
 				$caps[] = $cap;
@@ -1040,9 +1040,9 @@  discard block
 block discarded – undo
1040 1040
             }
1041 1041
 			if ($has_cap) {
1042 1042
 				$caps[] = $cap;
1043
-			} elseif ( ! empty( $this->private_cap ) ) {
1043
+			} elseif ( ! empty($this->private_cap)) {
1044 1044
 				$caps[] = $this->private_cap;
1045
-			} elseif ( ! empty( $this->others_cap ) ) {
1045
+			} elseif ( ! empty($this->others_cap)) {
1046 1046
 				$caps[] = $this->others_cap;
1047 1047
 			} else {
1048 1048
 				$caps[] = $cap;
@@ -1079,30 +1079,30 @@  discard block
 block discarded – undo
1079 1079
 	 *
1080 1080
 	 * @return array   actual users capabilities
1081 1081
 	 */
1082
-	protected function _map_meta_caps( $caps, $cap, $user_id, $args ) {
1082
+	protected function _map_meta_caps($caps, $cap, $user_id, $args) {
1083 1083
 		//only process if we're checking our mapped_cap
1084
-		if ( $cap !== $this->meta_cap ) {
1084
+		if ($cap !== $this->meta_cap) {
1085 1085
 			return $caps;
1086 1086
 		}
1087 1087
 
1088
-		$obj = ! empty( $args[0] ) ? $this->_model->get_one_by_ID( $args[0] ) : null;
1088
+		$obj = ! empty($args[0]) ? $this->_model->get_one_by_ID($args[0]) : null;
1089 1089
 
1090 1090
 		//if no obj then let's just do cap
1091
-		if ( ! $obj instanceof EE_Message_Template_Group ) {
1091
+		if ( ! $obj instanceof EE_Message_Template_Group) {
1092 1092
 			$caps[] = $cap;
1093 1093
 			return $caps;
1094 1094
 		}
1095 1095
 
1096 1096
 		$is_global = $obj->is_global();
1097 1097
 
1098
-		if ( $obj->wp_user() && $user_id == $obj->wp_user() ) {
1099
-			if ( $is_global ) {
1100
-				$caps[]  = $this->private_cap;
1098
+		if ($obj->wp_user() && $user_id == $obj->wp_user()) {
1099
+			if ($is_global) {
1100
+				$caps[] = $this->private_cap;
1101 1101
 			} else {
1102 1102
 				$caps[] = $cap;
1103 1103
 			}
1104 1104
 		} else {
1105
-			if ( $is_global ) {
1105
+			if ($is_global) {
1106 1106
 				$caps[] = $this->private_cap;
1107 1107
 			} else {
1108 1108
 				$caps[] = $this->others_cap;
@@ -1140,16 +1140,16 @@  discard block
 block discarded – undo
1140 1140
 	 *
1141 1141
 	 * @return array   actual users capabilities
1142 1142
 	 */
1143
-	protected function _map_meta_caps( $caps, $cap, $user_id, $args ) {
1143
+	protected function _map_meta_caps($caps, $cap, $user_id, $args) {
1144 1144
 		//only process if we're checking our mapped_cap
1145
-		if ( $cap !== $this->meta_cap ) {
1145
+		if ($cap !== $this->meta_cap) {
1146 1146
 			return $caps;
1147 1147
 		}
1148 1148
 
1149
-		$obj = ! empty( $args[0] ) ? $this->_model->get_one_by_ID( $args[0] ) : null;
1149
+		$obj = ! empty($args[0]) ? $this->_model->get_one_by_ID($args[0]) : null;
1150 1150
 
1151 1151
 		//if no obj then let's just do cap
1152
-		if ( ! $obj instanceof EE_Base_Class ) {
1152
+		if ( ! $obj instanceof EE_Base_Class) {
1153 1153
 			$caps[] = $cap;
1154 1154
 			return $caps;
1155 1155
 		}
@@ -1157,7 +1157,7 @@  discard block
 block discarded – undo
1157 1157
 		$is_system = $obj instanceof EE_Question_Group ? $obj->system_group() : false;
1158 1158
 		$is_system = $obj instanceof EE_Question ? $obj->is_system_question() : $is_system;
1159 1159
 
1160
-		if ( $is_system ) {
1160
+		if ($is_system) {
1161 1161
 			$caps[] = $this->private_cap;
1162 1162
 		} else {
1163 1163
 			$caps[] = $cap;
Please login to merge, or discard this patch.