Completed
Branch BUG-9054-ee-config (5f56da)
by
unknown
245:38 queued 231:16
created
admin_pages/registrations/Registrations_Admin_Page.core.php 2 patches
Indentation   +69 added lines, -69 removed lines patch added patch discarded remove patch
@@ -124,9 +124,9 @@  discard block
 block discarded – undo
124 124
 
125 125
 	/**
126 126
 	 * 		grab url requests and route them
127
-	*		@access private
128
-	*		@return void
129
-	*/
127
+	 *		@access private
128
+	 *		@return void
129
+	 */
130 130
 	public function _set_page_routes() {
131 131
 
132 132
 		$this->_get_registration_status_array();
@@ -398,7 +398,7 @@  discard block
 block discarded – undo
398 398
 						'title' => __('Registrations Other', 'event_espresso'),
399 399
 						'filename' => 'registrations_overview_other'
400 400
 					)
401
-                ),
401
+				),
402 402
 				'help_tour' => array( 'Registration_Overview_Help_Tour' ),
403 403
 				'qtips' => array('Registration_List_Table_Tips'),
404 404
 				'list_table' => 'EE_Registrations_List_Table',
@@ -412,7 +412,7 @@  discard block
 block discarded – undo
412 412
 					'url' => isset($this->_req_data['_REG_ID']) ? add_query_arg(array('_REG_ID' => $this->_req_data['_REG_ID'] ), $this->_current_page_view_url )  : $this->_admin_base_url,
413 413
 					'persistent' => FALSE
414 414
 					),
415
-                'help_tabs' => array(
415
+				'help_tabs' => array(
416 416
 					'registrations_details_help_tab' => array(
417 417
 						'title' => __('Registration Details', 'event_espresso'),
418 418
 						'filename' => 'registrations_details'
@@ -476,7 +476,7 @@  discard block
 block discarded – undo
476 476
 					'order' => 20
477 477
 					),
478 478
 				'list_table' => 'EE_Attendee_Contact_List_Table',
479
-                'help_tabs' => array(
479
+				'help_tabs' => array(
480 480
 					'registrations_contact_list_help_tab' => array(
481 481
 						'title' => __('Registrations Contact List', 'event_espresso'),
482 482
 						'filename' => 'registrations_contact_list'
@@ -493,7 +493,7 @@  discard block
 block discarded – undo
493 493
 						'title' => __('Contact List Other', 'event_espresso'),
494 494
 						'filename' => 'registrations_contact_list_other'
495 495
 					)
496
-                ),
496
+				),
497 497
 				'help_tour' => array( 'Contact_List_Help_Tour' ),
498 498
 				'metaboxes' => array(),
499 499
 				'require_nonce' => FALSE
@@ -527,9 +527,9 @@  discard block
 block discarded – undo
527 527
 
528 528
 	/**
529 529
 	 * 		get list of registration statuses
530
-	*		@access private
531
-	*		@return void
532
-	*/
530
+	 *		@access private
531
+	 *		@return void
532
+	 */
533 533
 	private function _get_registration_status_array() {
534 534
 		self::$_reg_status = EEM_Registration::reg_status_array( array(), TRUE);
535 535
 	}
@@ -830,7 +830,7 @@  discard block
 block discarded – undo
830 830
 			return TRUE;
831 831
 		}
832 832
 
833
-	    $REG = EEM_Registration::instance();
833
+		$REG = EEM_Registration::instance();
834 834
 
835 835
 		$REG_ID = ( ! empty( $this->_req_data['_REG_ID'] )) ? absint( $this->_req_data['_REG_ID'] ) : FALSE;
836 836
 
@@ -1051,9 +1051,9 @@  discard block
 block discarded – undo
1051 1051
 
1052 1052
 	/**
1053 1053
 	 * 		generates HTML for the View Registration Details Admin page
1054
-	*		@access protected
1055
-	*		@return void
1056
-	*/
1054
+	 *		@access protected
1055
+	 *		@return void
1056
+	 */
1057 1057
 	protected function _registration_details() {
1058 1058
 
1059 1059
 		$this->_template_args = array();
@@ -1130,9 +1130,9 @@  discard block
 block discarded – undo
1130 1130
 
1131 1131
 	/**
1132 1132
 	 * 		_set_approve_or_decline_reg_status_buttons
1133
-	*		@access protected
1134
-	*		@return string
1135
-	*/
1133
+	 *		@access protected
1134
+	 *		@return string
1135
+	 */
1136 1136
 	public function set_reg_status_buttons_metabox() {
1137 1137
 
1138 1138
 		//is registration for free event OR for a completed transaction? This will determine whether the set to pending option is shown.
@@ -1321,10 +1321,10 @@  discard block
 block discarded – undo
1321 1321
 
1322 1322
 	/**
1323 1323
 	 * 		approve_registration
1324
-	*		@access protected
1325
-	*		@param bool $notify whether or not to notify the registrant about their approval.
1326
-	*		@return void
1327
-	*/
1324
+	 *		@access protected
1325
+	 *		@param bool $notify whether or not to notify the registrant about their approval.
1326
+	 *		@return void
1327
+	 */
1328 1328
 	protected function approve_registration( $notify = false ) {
1329 1329
 		$this->_reg_status_change_return( EEM_Registration::status_id_approved, $notify );
1330 1330
 	}
@@ -1334,10 +1334,10 @@  discard block
 block discarded – undo
1334 1334
 
1335 1335
 	/**
1336 1336
 	 * 		decline_registration
1337
-	*		@access protected
1338
-	*		@param bool $notify whether or not to notify the registrant about their approval.
1339
-	*		@return void
1340
-	*/
1337
+	 *		@access protected
1338
+	 *		@param bool $notify whether or not to notify the registrant about their approval.
1339
+	 *		@return void
1340
+	 */
1341 1341
 	protected function decline_registration( $notify = false ) {
1342 1342
 		$this->_reg_status_change_return( EEM_Registration::status_id_declined, $notify );
1343 1343
 	}
@@ -1347,10 +1347,10 @@  discard block
 block discarded – undo
1347 1347
 
1348 1348
 	/**
1349 1349
 	 * 		cancel_registration
1350
-	*		@access protected
1351
-	*		@param bool $notify whether or not to notify the registrant about their approval.
1352
-	*		@return void
1353
-	*/
1350
+	 *		@access protected
1351
+	 *		@param bool $notify whether or not to notify the registrant about their approval.
1352
+	 *		@return void
1353
+	 */
1354 1354
 	protected function cancel_registration( $notify = false ) {
1355 1355
 		$this->_reg_status_change_return( EEM_Registration::status_id_cancelled, $notify );
1356 1356
 	}
@@ -1361,10 +1361,10 @@  discard block
 block discarded – undo
1361 1361
 
1362 1362
 	/**
1363 1363
 	 * 		not_approve_registration
1364
-	*		@access protected
1365
-	*		@param bool $notify whether or not to notify the registrant about their approval.
1366
-	*		@return void
1367
-	*/
1364
+	 *		@access protected
1365
+	 *		@param bool $notify whether or not to notify the registrant about their approval.
1366
+	 *		@return void
1367
+	 */
1368 1368
 	protected function not_approve_registration( $notify = false ) {
1369 1369
 		$this->_reg_status_change_return( EEM_Registration::status_id_not_approved, $notify );
1370 1370
 	}
@@ -1373,10 +1373,10 @@  discard block
 block discarded – undo
1373 1373
 
1374 1374
 	/**
1375 1375
 	 * 		decline_registration
1376
-	*		@access protected
1377
-	*		@param bool $notify whether or not to notify the registrant about their approval.
1378
-	*		@return void
1379
-	*/
1376
+	 *		@access protected
1377
+	 *		@param bool $notify whether or not to notify the registrant about their approval.
1378
+	 *		@return void
1379
+	 */
1380 1380
 	protected function pending_registration( $notify = false ) {
1381 1381
 		$this->_reg_status_change_return( EEM_Registration::status_id_pending_payment, $notify );
1382 1382
 	}
@@ -1386,9 +1386,9 @@  discard block
 block discarded – undo
1386 1386
 
1387 1387
 	/**
1388 1388
 	 * 		generates HTML for the Registration main meta box
1389
-	*		@access public
1390
-	*		@return void
1391
-	*/
1389
+	 *		@access public
1390
+	 *		@return void
1391
+	 */
1392 1392
 	public function _reg_details_meta_box() {
1393 1393
 		EEH_Autoloader::register_line_item_display_autoloaders();
1394 1394
 		EEH_Autoloader::register_line_item_filter_autoloaders();
@@ -1471,9 +1471,9 @@  discard block
 block discarded – undo
1471 1471
 
1472 1472
 	/**
1473 1473
 	 * 		generates HTML for the Registration Questions meta box
1474
-	*		@access public
1475
-	*		@return void
1476
-	*/
1474
+	 *		@access public
1475
+	 *		@return void
1476
+	 */
1477 1477
 	public function _reg_questions_meta_box() {
1478 1478
 
1479 1479
 		add_filter( 'FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions', array( $this, 'form_before_question_group' ), 10, 1 );
@@ -1581,9 +1581,9 @@  discard block
 block discarded – undo
1581 1581
 
1582 1582
 	/**
1583 1583
 	 * 		generates HTML for the Registration main meta box
1584
-	*		@access protected
1585
-	*		@return void
1586
-	*/
1584
+	 *		@access protected
1585
+	 *		@return void
1586
+	 */
1587 1587
 	protected function _update_attendee_registration_form() {
1588 1588
 		$qstns = isset( $this->_req_data['qstn'] ) ? $this->_req_data['qstn'] : FALSE;
1589 1589
 		$REG_ID = isset( $this->_req_data['_REG_ID'] ) ? absint( $this->_req_data['_REG_ID'] ) : FALSE;
@@ -1665,12 +1665,12 @@  discard block
 block discarded – undo
1665 1665
 
1666 1666
 	/**
1667 1667
 	 * 		generates HTML for the Registration main meta box
1668
-	*		@access public
1669
-	*		@return void
1670
-	*/
1668
+	 *		@access public
1669
+	 *		@return void
1670
+	 */
1671 1671
 	public function _reg_attendees_meta_box() {
1672 1672
 
1673
-	    $REG = EEM_Registration::instance();
1673
+		$REG = EEM_Registration::instance();
1674 1674
 		//get all other registrations on this transaction, and cache
1675 1675
 		//the attendees for them so we don't have to run another query using force_join
1676 1676
 		$registrations = $REG->get_all(array(
@@ -1723,9 +1723,9 @@  discard block
 block discarded – undo
1723 1723
 
1724 1724
 	/**
1725 1725
 	 * 		generates HTML for the Edit Registration side meta box
1726
-	*		@access public
1727
-	*		@return void
1728
-	*/
1726
+	 *		@access public
1727
+	 *		@return void
1728
+	 */
1729 1729
 	public function _reg_registrant_side_meta_box() {
1730 1730
 
1731 1731
 		/*@var $attendee EE_Attendee */
@@ -2071,9 +2071,9 @@  discard block
 block discarded – undo
2071 2071
 
2072 2072
 	/**
2073 2073
 	 * 		set_reg_event
2074
-	*		@access private
2075
-	*		@return boolean
2076
-	*/
2074
+	 *		@access private
2075
+	 *		@return boolean
2076
+	 */
2077 2077
 	private function _set_reg_event() {
2078 2078
 		if ( is_object( $this->_reg_event )) {
2079 2079
 			return TRUE;
@@ -2177,9 +2177,9 @@  discard block
 block discarded – undo
2177 2177
 
2178 2178
 	/**
2179 2179
 	 * 		generates HTML for the Attendee Contact List
2180
-	*		@access protected
2181
-	*		@return void
2182
-	*/
2180
+	 *		@access protected
2181
+	 *		@return void
2182
+	 */
2183 2183
 	protected function _attendee_contact_list_table() {
2184 2184
 		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
2185 2185
 		$this->_search_btn_label = __('Contacts', 'event_espresso');
@@ -2193,9 +2193,9 @@  discard block
 block discarded – undo
2193 2193
 	/**
2194 2194
 	 * 		get_attendees
2195 2195
 	 * 		@param bool $count whether to return count or data.
2196
-	*		@access public
2197
-	*		@return array
2198
-	*/
2196
+	 *		@access public
2197
+	 *		@return array
2198
+	 */
2199 2199
 	public function get_attendees( $per_page, $count = FALSE, $trash = FALSE ) {
2200 2200
 
2201 2201
 		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
@@ -2513,9 +2513,9 @@  discard block
 block discarded – undo
2513 2513
 
2514 2514
 	/**
2515 2515
 	 * 		_attendee_details
2516
-	*		@access protected
2517
-	*		@return void
2518
-	*/
2516
+	 *		@access protected
2517
+	 *		@return void
2518
+	 */
2519 2519
 	public function attendee_registrations_meta_box( $post ) {
2520 2520
 
2521 2521
 		$this->_template_args['attendee'] = $this->_cpt_model_obj;
@@ -2548,10 +2548,10 @@  discard block
 block discarded – undo
2548 2548
 
2549 2549
 	/**
2550 2550
 	 * 		_trash_or_restore_attendee
2551
-	*		@param boolean 		$trash - whether to move item to trash (TRUE) or restore it (FALSE)
2552
-	*		@access protected
2553
-	*		@return void
2554
-	*/
2551
+	 *		@param boolean 		$trash - whether to move item to trash (TRUE) or restore it (FALSE)
2552
+	 *		@access protected
2553
+	 *		@return void
2554
+	 */
2555 2555
 	protected function _trash_or_restore_attendees( $trash = TRUE ) {
2556 2556
 
2557 2557
 		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
Please login to merge, or discard this patch.
Spacing   +499 added lines, -499 removed lines patch added patch discarded remove patch
@@ -42,8 +42,8 @@  discard block
 block discarded – undo
42 42
 	 * @param bool $routing
43 43
 	 * @return Registrations_Admin_Page
44 44
 	 */
45
-	public function __construct( $routing = TRUE ) {
46
-		parent::__construct( $routing );
45
+	public function __construct($routing = TRUE) {
46
+		parent::__construct($routing);
47 47
 	}
48 48
 
49 49
 
@@ -75,16 +75,16 @@  discard block
 block discarded – undo
75 75
 				'trash' => 'post.php'
76 76
 			);
77 77
 
78
-		add_action('edit_form_after_title', array($this, 'after_title_form_fields'), 10 );
78
+		add_action('edit_form_after_title', array($this, 'after_title_form_fields'), 10);
79 79
 		//add filters so that the comment urls don't take users to a confusing 404 page
80
-		add_filter('get_comment_link', array( $this, 'clear_comment_link' ), 10, 3 );
80
+		add_filter('get_comment_link', array($this, 'clear_comment_link'), 10, 3);
81 81
 	}
82 82
 
83 83
 
84
-	public function clear_comment_link( $link, $comment, $args ) {
84
+	public function clear_comment_link($link, $comment, $args) {
85 85
 		//gotta make sure this only happens on this route
86
-		$post_type = get_post_type( $comment->comment_post_ID);
87
-		if ( $post_type == 'espresso_attendees' )
86
+		$post_type = get_post_type($comment->comment_post_ID);
87
+		if ($post_type == 'espresso_attendees')
88 88
 			return '#commentsdiv';
89 89
 		return $link;
90 90
 	}
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 
93 93
 	protected function _ajax_hooks() {
94 94
 		//todo: all hooks for registrations ajax goes in here
95
-		add_action( 'wp_ajax_toggle_checkin_status', array( $this, 'toggle_checkin_status' ));
95
+		add_action('wp_ajax_toggle_checkin_status', array($this, 'toggle_checkin_status'));
96 96
 	}
97 97
 
98 98
 
@@ -107,8 +107,8 @@  discard block
 block discarded – undo
107 107
 					'add-attendee' => __('Add Contact', 'event_espresso'),
108 108
 					'edit' => __('Edit Contact', 'event_espresso'),
109 109
 					'report'=>  __("Event Registrations CSV Report", "event_espresso"),
110
-					'report_all' => __( 'All Registrations CSV Report', 'event_espresso' ),
111
-					'contact_list_report' => __( 'Contact List Report', 'event_espresso' ),
110
+					'report_all' => __('All Registrations CSV Report', 'event_espresso'),
111
+					'contact_list_report' => __('Contact List Report', 'event_espresso'),
112 112
 					'contact_list_export'=>  __("Export Data", "event_espresso"),
113 113
 				),
114 114
 			'publishbox' => array(
@@ -136,9 +136,9 @@  discard block
 block discarded – undo
136 136
 
137 137
 		$this->_get_registration_status_array();
138 138
 
139
-		$reg_id = ! empty( $this->_req_data['_REG_ID'] ) && ! is_array( $this->_req_data['_REG_ID'] ) ? $this->_req_data['_REG_ID'] : 0;
140
-		$att_id = ! empty( $this->_req_data[ 'ATT_ID' ] ) && ! is_array( $this->_req_data['ATT_ID'] ) ? $this->_req_data['ATT_ID'] : 0;
141
-		$att_id = ! empty( $this->_req_data['post'] ) && ! is_array( $this->_req_data['post'] ) ? $this->_req_data['post'] : $att_id;
139
+		$reg_id = ! empty($this->_req_data['_REG_ID']) && ! is_array($this->_req_data['_REG_ID']) ? $this->_req_data['_REG_ID'] : 0;
140
+		$att_id = ! empty($this->_req_data['ATT_ID']) && ! is_array($this->_req_data['ATT_ID']) ? $this->_req_data['ATT_ID'] : 0;
141
+		$att_id = ! empty($this->_req_data['post']) && ! is_array($this->_req_data['post']) ? $this->_req_data['post'] : $att_id;
142 142
 
143 143
 		$this->_page_routes = array(
144 144
 
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
 
156 156
 				'edit_registration'	=> array(
157 157
 						'func' => '_registration_details',
158
-						'args' => array( 'edit' ),
158
+						'args' => array('edit'),
159 159
 						'noheader' => TRUE,
160 160
 						'capability' => 'ee_edit_registration',
161 161
 						'obj_id' => $reg_id
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
 
171 171
 				'restore_registrations' => array(
172 172
 					'func' => '_trash_or_restore_registrations',
173
-					'args' => array( 'trash' => FALSE ),
173
+					'args' => array('trash' => FALSE),
174 174
 					'noheader' => TRUE,
175 175
 					'capability' => 'ee_delete_registrations'
176 176
 					),
@@ -404,7 +404,7 @@  discard block
 block discarded – undo
404 404
 						'filename' => 'registrations_overview_other'
405 405
 					)
406 406
                 ),
407
-				'help_tour' => array( 'Registration_Overview_Help_Tour' ),
407
+				'help_tour' => array('Registration_Overview_Help_Tour'),
408 408
 				'qtips' => array('Registration_List_Table_Tips'),
409 409
 				'list_table' => 'EE_Registrations_List_Table',
410 410
 				'require_nonce' => FALSE
@@ -414,7 +414,7 @@  discard block
 block discarded – undo
414 414
 				'nav' => array(
415 415
 					'label' => __('REG Details', 'event_espresso'),
416 416
 					'order' => 15,
417
-					'url' => isset($this->_req_data['_REG_ID']) ? add_query_arg(array('_REG_ID' => $this->_req_data['_REG_ID'] ), $this->_current_page_view_url )  : $this->_admin_base_url,
417
+					'url' => isset($this->_req_data['_REG_ID']) ? add_query_arg(array('_REG_ID' => $this->_req_data['_REG_ID']), $this->_current_page_view_url) : $this->_admin_base_url,
418 418
 					'persistent' => FALSE
419 419
 					),
420 420
                 'help_tabs' => array(
@@ -435,8 +435,8 @@  discard block
 block discarded – undo
435 435
 						'filename' => 'registrations_details_registrant_details'
436 436
 						)
437 437
 					),
438
-				'help_tour' => array( 'Registration_Details_Help_Tour' ),
439
-				'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array( '_registration_details_metaboxes' ) ),
438
+				'help_tour' => array('Registration_Details_Help_Tour'),
439
+				'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_registration_details_metaboxes')),
440 440
 				'require_nonce' => FALSE
441 441
 				),
442 442
 
@@ -460,7 +460,7 @@  discard block
 block discarded – undo
460 460
 					'order' => 15,
461 461
 					'persistent' => FALSE
462 462
 					),
463
-				'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array('_publish_post_box', 'attendee_editor_metaboxes' ) ),
463
+				'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box', 'attendee_editor_metaboxes')),
464 464
 				'require_nonce' => FALSE
465 465
 				),
466 466
 
@@ -469,7 +469,7 @@  discard block
 block discarded – undo
469 469
 					'label' => __('Edit Contact', 'event_espresso'),
470 470
 					'order' => 15,
471 471
 					'persistent' => FALSE,
472
-					'url' => isset($this->_req_data['ATT_ID']) ? add_query_arg(array('ATT_ID' => $this->_req_data['ATT_ID'] ), $this->_current_page_view_url )  : $this->_admin_base_url
472
+					'url' => isset($this->_req_data['ATT_ID']) ? add_query_arg(array('ATT_ID' => $this->_req_data['ATT_ID']), $this->_current_page_view_url) : $this->_admin_base_url
473 473
 					),
474 474
 				'metaboxes' => array('attendee_editor_metaboxes'),
475 475
 				'require_nonce' => FALSE
@@ -499,7 +499,7 @@  discard block
 block discarded – undo
499 499
 						'filename' => 'registrations_contact_list_other'
500 500
 					)
501 501
                 ),
502
-				'help_tour' => array( 'Contact_List_Help_Tour' ),
502
+				'help_tour' => array('Contact_List_Help_Tour'),
503 503
 				'metaboxes' => array(),
504 504
 				'require_nonce' => FALSE
505 505
 				),
@@ -518,7 +518,7 @@  discard block
 block discarded – undo
518 518
 	protected function _add_screen_options() {}
519 519
 	protected function _add_feature_pointers() {}
520 520
 	public function admin_init() {
521
-		EE_Registry::$i18n_js_strings[ 'update_att_qstns' ] = __( 'click "Update Registration Questions" to save your changes', 'event_espresso' );
521
+		EE_Registry::$i18n_js_strings['update_att_qstns'] = __('click "Update Registration Questions" to save your changes', 'event_espresso');
522 522
 	}
523 523
 	public function admin_notices() {}
524 524
 	public function admin_footer_scripts() {}
@@ -536,7 +536,7 @@  discard block
 block discarded – undo
536 536
 	*		@return void
537 537
 	*/
538 538
 	private function _get_registration_status_array() {
539
-		self::$_reg_status = EEM_Registration::reg_status_array( array(), TRUE);
539
+		self::$_reg_status = EEM_Registration::reg_status_array(array(), TRUE);
540 540
 	}
541 541
 
542 542
 
@@ -559,11 +559,11 @@  discard block
 block discarded – undo
559 559
 	public function load_scripts_styles() {
560 560
 		//style
561 561
 		//wp_register_style('espresso_attendees', ATT_ASSETS_URL . 'espresso_attendees_admin.css', array(), EVENT_ESPRESSO_VERSION );
562
-		wp_register_style('espresso_reg', REG_ASSETS_URL . 'espresso_registrations_admin.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION );
562
+		wp_register_style('espresso_reg', REG_ASSETS_URL.'espresso_registrations_admin.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION);
563 563
 		wp_enqueue_style('espresso_reg');
564 564
 
565 565
 		//script
566
-		wp_register_script('espresso_reg', REG_ASSETS_URL . 'espresso_registrations_admin.js', array('jquery-ui-datepicker', 'jquery-ui-draggable', 'ee_admin_js'), EVENT_ESPRESSO_VERSION, TRUE);
566
+		wp_register_script('espresso_reg', REG_ASSETS_URL.'espresso_registrations_admin.js', array('jquery-ui-datepicker', 'jquery-ui-draggable', 'ee_admin_js'), EVENT_ESPRESSO_VERSION, TRUE);
567 567
 		wp_enqueue_script('espresso_reg');
568 568
 	}
569 569
 
@@ -572,9 +572,9 @@  discard block
 block discarded – undo
572 572
 	public function load_scripts_styles_edit_attendee() {
573 573
 		//stuff to only show up on our attendee edit details page.
574 574
 		$attendee_details_translations = array(
575
-			'att_publish_text' => sprintf( __('Created on: <b>%1$s</b>', 'event_espresso'), $this->_cpt_model_obj->get_datetime('ATT_created') )
575
+			'att_publish_text' => sprintf(__('Created on: <b>%1$s</b>', 'event_espresso'), $this->_cpt_model_obj->get_datetime('ATT_created'))
576 576
 			);
577
-		wp_localize_script( 'espresso_reg', 'ATTENDEE_DETAILS', $attendee_details_translations );
577
+		wp_localize_script('espresso_reg', 'ATTENDEE_DETAILS', $attendee_details_translations);
578 578
 		wp_enqueue_script('jquery-validate');
579 579
 	}
580 580
 
@@ -592,7 +592,7 @@  discard block
 block discarded – undo
592 592
 
593 593
 	public function load_scripts_styles_contact_list() {
594 594
 		wp_deregister_style('espresso_reg');
595
-		wp_register_style('espresso_att', REG_ASSETS_URL . 'espresso_attendees_admin.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION );
595
+		wp_register_style('espresso_att', REG_ASSETS_URL.'espresso_attendees_admin.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION);
596 596
 		wp_enqueue_style('espresso_att');
597 597
 	}
598 598
 
@@ -601,9 +601,9 @@  discard block
 block discarded – undo
601 601
 
602 602
 
603 603
 	public function load_scripts_styles_new_registration() {
604
-		wp_register_script( 'ee-spco-for-admin', REG_ASSETS_URL . 'spco_for_admin.js', array('underscore', 'jquery'), EVENT_ESPRESSO_VERSION, TRUE );
604
+		wp_register_script('ee-spco-for-admin', REG_ASSETS_URL.'spco_for_admin.js', array('underscore', 'jquery'), EVENT_ESPRESSO_VERSION, TRUE);
605 605
 		wp_enqueue_script('ee-spco-for-admin');
606
-		add_filter('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true' );
606
+		add_filter('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true');
607 607
 		EE_Form_Section_Proper::wp_enqueue_scripts();
608 608
 		EED_Ticket_Selector::load_tckt_slctr_assets();
609 609
 		EE_Datepicker_Input::enqueue_styles_and_scripts();
@@ -642,23 +642,23 @@  discard block
 block discarded – undo
642 642
 
643 643
 		/** setup reg status bulk actions **/
644 644
 		$def_reg_status_actions['approve_registration'] = __('Approve Registrations', 'event_espresso');
645
-		if ( in_array( $match_array['approve_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) {
645
+		if (in_array($match_array['approve_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) {
646 646
 			$def_reg_status_actions['approve_and_notify_registration'] = __('Approve and Notify Registrations', 'event_espresso');
647 647
 		}
648 648
 		$def_reg_status_actions['decline_registration'] = __('Decline Registrations', 'event_espresso');
649
-		if ( in_array( $match_array['decline_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) {
649
+		if (in_array($match_array['decline_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) {
650 650
 			$def_reg_status_actions['decline_and_notify_registration'] = __('Decline and Notify Registrations', 'event_espresso');
651 651
 		}
652 652
 		$def_reg_status_actions['pending_registration'] = __('Set Registrations to Pending Payment', 'event_espresso');
653
-		if ( in_array( $match_array['pending_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) {
653
+		if (in_array($match_array['pending_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) {
654 654
 			$def_reg_status_actions['pending_and_notify_registration'] = __('Set Registrations to Pending Payment and Notify', 'event_espresso');
655 655
 		}
656 656
 		$def_reg_status_actions['no_approve_registration'] = __('Set Registrations to Not Approved', 'event_espresso');
657
-		if ( in_array( $match_array['no_approve_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) {
657
+		if (in_array($match_array['no_approve_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) {
658 658
 			$def_reg_status_actions['no_approve_and_notify_registration'] = __('Set Registrations to Not Approved and Notify', 'event_espresso');
659 659
 		}
660 660
 		$def_reg_status_actions['cancel_registration'] = __('Cancel Registrations', 'event_espresso');
661
-		if ( in_array( $match_array['cancel_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) {
661
+		if (in_array($match_array['cancel_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) {
662 662
 			$def_reg_status_actions['cancel_and_notify_registration'] = __('Cancel Registrations and Notify', 'event_espresso');
663 663
 		}
664 664
 
@@ -667,29 +667,29 @@  discard block
 block discarded – undo
667 667
 				'slug' => 'all',
668 668
 				'label' => __('View All Registrations', 'event_espresso'),
669 669
 				'count' => 0,
670
-				'bulk_action' => array_merge( $def_reg_status_actions, array(
670
+				'bulk_action' => array_merge($def_reg_status_actions, array(
671 671
 					'trash_registrations' => __('Trash Registrations', 'event_espresso')
672
-					) )
672
+					))
673 673
 				),
674 674
 			'month' => array(
675 675
 				'slug' => 'month',
676 676
 				'label' => __('This Month', 'event_espresso'),
677 677
 				'count' => 0,
678
-				'bulk_action' => array_merge( $def_reg_status_actions, array(
678
+				'bulk_action' => array_merge($def_reg_status_actions, array(
679 679
 					'trash_registrations' => __('Trash Registrations', 'event_espresso')
680 680
 					))
681 681
 				),
682 682
 			'today' => array(
683 683
 				'slug' => 'today',
684
-				'label' => sprintf( __('Today - %s', 'event_espresso'), date('M d, Y', current_time('timestamp' ) ) ),
684
+				'label' => sprintf(__('Today - %s', 'event_espresso'), date('M d, Y', current_time('timestamp'))),
685 685
 				'count' => 0,
686
-				'bulk_action' => array_merge( $def_reg_status_actions,  array(
686
+				'bulk_action' => array_merge($def_reg_status_actions, array(
687 687
 					'trash_registrations' => __('Trash Registrations', 'event_espresso')
688 688
 					))
689 689
 				)
690 690
 			);
691 691
 
692
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_registrations', 'espresso_registrations_delete_registration' ) ) {
692
+		if (EE_Registry::instance()->CAP->current_user_can('ee_delete_registrations', 'espresso_registrations_delete_registration')) {
693 693
 			$this->_views['incomplete'] = array(
694 694
 				'slug' => 'incomplete',
695 695
 				'label' => __('Incomplete', 'event_espresso'),
@@ -725,7 +725,7 @@  discard block
 block discarded – undo
725 725
 				)
726 726
 			);
727 727
 
728
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_contacts', 'espresso_registrations_trash_attendees' ) ) {
728
+		if (EE_Registry::instance()->CAP->current_user_can('ee_delete_contacts', 'espresso_registrations_trash_attendees')) {
729 729
 			$this->_views['trash'] = array(
730 730
 				'slug' => 'trash',
731 731
 				'label' => __('Trash', 'event_espresso'),
@@ -764,42 +764,42 @@  discard block
 block discarded – undo
764 764
 				'desc' => __('View Transaction Invoice', 'event_espresso')
765 765
 				),
766 766
  			);
767
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_registrations_resend_registration' ) ) {
767
+		if (EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_registrations_resend_registration')) {
768 768
 			$fc_items['resend_registration'] = array(
769 769
 				'class' => 'dashicons dashicons-email-alt',
770 770
 				'desc' => __('Resend Registration Details', 'event_espresso')
771 771
 				);
772 772
 		} else {
773
-			$fc_items['blank'] = array( 'class' => 'blank', 'desc' => '' );
773
+			$fc_items['blank'] = array('class' => 'blank', 'desc' => '');
774 774
 		}
775 775
 
776 776
 		$sc_items = array(
777 777
 			'approved_status' => array(
778
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_approved,
779
-				'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_approved, FALSE, 'sentence' )
778
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_approved,
779
+				'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_approved, FALSE, 'sentence')
780 780
 				),
781 781
 			'pending_status' => array(
782
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_pending_payment,
783
-				'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_pending_payment, FALSE, 'sentence' )
782
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_pending_payment,
783
+				'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_pending_payment, FALSE, 'sentence')
784 784
 				),
785 785
 			'incomplete_status' => array(
786
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_incomplete,
787
-				'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_incomplete, FALSE, 'sentence' )
786
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_incomplete,
787
+				'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_incomplete, FALSE, 'sentence')
788 788
 			),
789 789
 			'not_approved' => array(
790
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_not_approved,
791
-				'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_not_approved, FALSE, 'sentence' )
790
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_not_approved,
791
+				'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_not_approved, FALSE, 'sentence')
792 792
 				),
793 793
 			'declined_status' => array(
794
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_declined,
795
-				'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_declined, FALSE, 'sentence' )
794
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_declined,
795
+				'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_declined, FALSE, 'sentence')
796 796
 				),
797 797
 			'cancelled_status' => array(
798
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_cancelled,
799
-				'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_cancelled, FALSE, 'sentence' )
798
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_cancelled,
799
+				'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_cancelled, FALSE, 'sentence')
800 800
 				)
801 801
 			);
802
-		return array_merge( $fc_items, $sc_items );
802
+		return array_merge($fc_items, $sc_items);
803 803
 	}
804 804
 
805 805
 
@@ -812,15 +812,15 @@  discard block
 block discarded – undo
812 812
 
813 813
 
814 814
 	protected function _registrations_overview_list_table() {
815
-		$EVT_ID = ( ! empty( $this->_req_data['event_id'] )) ? absint( $this->_req_data['event_id'] ) : FALSE;
816
-		if ( $EVT_ID ) {
817
-			if ( EE_Registry::instance()->CAP->current_user_can( 'ee_edit_registrations', 'espresso_registrations_new_registration', $EVT_ID ) ) {
818
-				$this->_admin_page_title .= $this->get_action_link_or_button( 'new_registration', 'add-registrant', array( 'event_id' => $EVT_ID ), 'add-new-h2' );
815
+		$EVT_ID = ( ! empty($this->_req_data['event_id'])) ? absint($this->_req_data['event_id']) : FALSE;
816
+		if ($EVT_ID) {
817
+			if (EE_Registry::instance()->CAP->current_user_can('ee_edit_registrations', 'espresso_registrations_new_registration', $EVT_ID)) {
818
+				$this->_admin_page_title .= $this->get_action_link_or_button('new_registration', 'add-registrant', array('event_id' => $EVT_ID), 'add-new-h2');
819 819
 			}
820
-			$event = EEM_Event::instance()->get_one_by_ID( $EVT_ID );
821
-			$this->_template_args['admin_page_header'] = $event instanceof EE_Event ? sprintf( __('%s Viewing registrations for the event: %s%s', 'event_espresso'), '<h2>', '<a href="' . EE_Admin_Page::add_query_args_and_nonce( array('action' => 'edit', 'post' => $event->ID() ), EVENTS_ADMIN_URL ) . '">' . $event->get('EVT_name') . '</a>', '</h2>' ) : '';
820
+			$event = EEM_Event::instance()->get_one_by_ID($EVT_ID);
821
+			$this->_template_args['admin_page_header'] = $event instanceof EE_Event ? sprintf(__('%s Viewing registrations for the event: %s%s', 'event_espresso'), '<h2>', '<a href="'.EE_Admin_Page::add_query_args_and_nonce(array('action' => 'edit', 'post' => $event->ID()), EVENTS_ADMIN_URL).'">'.$event->get('EVT_name').'</a>', '</h2>') : '';
822 822
 		}
823
-		$this->_template_args['after_list_table'] = $this->_display_legend( $this->_registration_legend_items() );
823
+		$this->_template_args['after_list_table'] = $this->_display_legend($this->_registration_legend_items());
824 824
 		$this->display_admin_list_table_page_with_no_sidebar();
825 825
 	}
826 826
 
@@ -835,19 +835,19 @@  discard block
 block discarded – undo
835 835
 	 */
836 836
 	private function _set_registration_object() {
837 837
 		//get out if we've already set the object
838
-		if ( is_object( $this->_registration )) {
838
+		if (is_object($this->_registration)) {
839 839
 			return TRUE;
840 840
 		}
841 841
 
842 842
 	    $REG = EEM_Registration::instance();
843 843
 
844
-		$REG_ID = ( ! empty( $this->_req_data['_REG_ID'] )) ? absint( $this->_req_data['_REG_ID'] ) : FALSE;
844
+		$REG_ID = ( ! empty($this->_req_data['_REG_ID'])) ? absint($this->_req_data['_REG_ID']) : FALSE;
845 845
 
846
-		if ( $this->_registration = $REG->get_one_by_ID( $REG_ID ))
846
+		if ($this->_registration = $REG->get_one_by_ID($REG_ID))
847 847
 			return TRUE;
848 848
 		else {
849
-			$error_msg = sprintf( __('An error occurred and the details for Registration ID #%s could not be retrieved.', 'event_espresso'), $REG_ID );
850
-			EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ );
849
+			$error_msg = sprintf(__('An error occurred and the details for Registration ID #%s could not be retrieved.', 'event_espresso'), $REG_ID);
850
+			EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__);
851 851
 			$this->_registration = NULL;
852 852
 			return FALSE;
853 853
 		}
@@ -866,25 +866,25 @@  discard block
 block discarded – undo
866 866
 	 * @internal param bool $all whether to ignore all query params and just return ALL registrations (or count if count is set)
867 867
 	 * @return mixed (int|array)  int = count || array of registration objects
868 868
 	 */
869
-	public function get_registrations( $per_page = 10, $count = FALSE, $this_month = FALSE, $today = FALSE ) {
870
-
871
-		$EVT_ID = ! empty( $this->_req_data['event_id'] ) && $this->_req_data['event_id'] > 0 ? absint( $this->_req_data['event_id'] ) : FALSE;
872
-		$CAT_ID = ! empty( $this->_req_data['EVT_CAT'] ) && (int) $this->_req_data['EVT_CAT'] > 0? absint( $this->_req_data['EVT_CAT'] ) : FALSE;
873
-		$reg_status = ! empty( $this->_req_data['_reg_status'] ) ? sanitize_text_field( $this->_req_data['_reg_status'] ) : FALSE;
874
-		$month_range = ! empty( $this->_req_data['month_range'] ) ? sanitize_text_field( $this->_req_data['month_range'] ) : FALSE;//should be like 2013-april
875
-		$today_a = ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] == 'today' ? TRUE : FALSE;
876
-		$this_month_a = ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] == 'month' ? TRUE  : FALSE;
869
+	public function get_registrations($per_page = 10, $count = FALSE, $this_month = FALSE, $today = FALSE) {
870
+
871
+		$EVT_ID = ! empty($this->_req_data['event_id']) && $this->_req_data['event_id'] > 0 ? absint($this->_req_data['event_id']) : FALSE;
872
+		$CAT_ID = ! empty($this->_req_data['EVT_CAT']) && (int) $this->_req_data['EVT_CAT'] > 0 ? absint($this->_req_data['EVT_CAT']) : FALSE;
873
+		$reg_status = ! empty($this->_req_data['_reg_status']) ? sanitize_text_field($this->_req_data['_reg_status']) : FALSE;
874
+		$month_range = ! empty($this->_req_data['month_range']) ? sanitize_text_field($this->_req_data['month_range']) : FALSE; //should be like 2013-april
875
+		$today_a = ! empty($this->_req_data['status']) && $this->_req_data['status'] == 'today' ? TRUE : FALSE;
876
+		$this_month_a = ! empty($this->_req_data['status']) && $this->_req_data['status'] == 'month' ? TRUE : FALSE;
877 877
 		$start_date = FALSE;
878 878
 		$end_date = FALSE;
879 879
 		$_where = array();
880
-		$trash = ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] == 'trash' ? TRUE : FALSE;
881
-		$incomplete = ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] == 'incomplete' ? TRUE : FALSE;
880
+		$trash = ! empty($this->_req_data['status']) && $this->_req_data['status'] == 'trash' ? TRUE : FALSE;
881
+		$incomplete = ! empty($this->_req_data['status']) && $this->_req_data['status'] == 'incomplete' ? TRUE : FALSE;
882 882
 
883 883
 		//set orderby
884 884
 		$this->_req_data['orderby'] = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : '';
885 885
 
886 886
 
887
-		switch ( $this->_req_data['orderby'] ) {
887
+		switch ($this->_req_data['orderby']) {
888 888
 			case '_REG_ID':
889 889
 				$orderby = 'REG_ID';
890 890
 				break;
@@ -904,26 +904,26 @@  discard block
 block discarded – undo
904 904
 				$orderby = 'REG_date';
905 905
 		}
906 906
 
907
-		$sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'DESC';
908
-		$current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1;
909
-		$per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page;
907
+		$sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'DESC';
908
+		$current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1;
909
+		$per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page;
910 910
 
911 911
 
912
-		$offset = ($current_page-1)*$per_page;
913
-		$limit = $count  ? NULL : array( $offset, $per_page );
912
+		$offset = ($current_page - 1) * $per_page;
913
+		$limit = $count ? NULL : array($offset, $per_page);
914 914
 
915
-		if($EVT_ID){
916
-			$_where['EVT_ID']=$EVT_ID;
915
+		if ($EVT_ID) {
916
+			$_where['EVT_ID'] = $EVT_ID;
917 917
 		}
918
-		if($CAT_ID){
918
+		if ($CAT_ID) {
919 919
 			$_where['Event.Term_Taxonomy.term_id'] = $CAT_ID;
920 920
 		}
921
-		if ( $incomplete ) {
921
+		if ($incomplete) {
922 922
 			$_where['STS_ID'] = EEM_Registration::status_id_incomplete;
923 923
 		} else if ( ! $trash) {
924
-			$_where['STS_ID'] = array( '!=', EEM_Registration::status_id_incomplete );
924
+			$_where['STS_ID'] = array('!=', EEM_Registration::status_id_incomplete);
925 925
 		}
926
-		if($reg_status){
926
+		if ($reg_status) {
927 927
 			$_where['STS_ID'] = $reg_status;
928 928
 		}
929 929
 
@@ -935,105 +935,105 @@  discard block
 block discarded – undo
935 935
 		$time_start = ' 00:00:00';
936 936
 		$time_end = ' 23:59:59';
937 937
 
938
-		if($today_a || $today ){
938
+		if ($today_a || $today) {
939 939
 			$curdate = date('Y-m-d', current_time('timestamp'));
940
-			$_where['REG_date']= array('BETWEEN',
940
+			$_where['REG_date'] = array('BETWEEN',
941 941
 				array(
942
-					EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $curdate . $time_start, 'Y-m-d H:i:s' ),
943
-					EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $curdate . $time_end, 'Y-m-d H:i:s' ),
942
+					EEM_Registration::instance()->convert_datetime_for_query('REG_date', $curdate.$time_start, 'Y-m-d H:i:s'),
943
+					EEM_Registration::instance()->convert_datetime_for_query('REG_date', $curdate.$time_end, 'Y-m-d H:i:s'),
944 944
 			));
945
-		}elseif($this_month_a || $this_month){
945
+		}elseif ($this_month_a || $this_month) {
946 946
 			$this_month_r = date('m', current_time('timestamp'));
947
-			$days_this_month = date( 't', current_time('timestamp') );
948
-			$_where['REG_date']= array('BETWEEN',
947
+			$days_this_month = date('t', current_time('timestamp'));
948
+			$_where['REG_date'] = array('BETWEEN',
949 949
 				array(
950
-					EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $this_year_r . '-' . $this_month_r . '-01' . ' ' . $time_start, 'Y-m-d H:i:s' ),
951
-					EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $this_year_r . '-' . $this_month_r . '-' . $days_this_month . ' ' . $time_end, 'Y-m-d H:i:s' )
950
+					EEM_Registration::instance()->convert_datetime_for_query('REG_date', $this_year_r.'-'.$this_month_r.'-01'.' '.$time_start, 'Y-m-d H:i:s'),
951
+					EEM_Registration::instance()->convert_datetime_for_query('REG_date', $this_year_r.'-'.$this_month_r.'-'.$days_this_month.' '.$time_end, 'Y-m-d H:i:s')
952 952
 			));
953
-		}elseif($month_range){
953
+		}elseif ($month_range) {
954 954
 			$pieces = explode(' ', $this->_req_data['month_range'], 3);
955
-			$month_r = !empty($pieces[0]) ? date('m', strtotime($pieces[0])) : '';
956
-			$year_r = !empty($pieces[1]) ? $pieces[1] : '';
957
-			$days_in_month = date('t', strtotime($year_r .  '-' . $month_r . '-' . '01') );
958
-			$_where['REG_date']= array('BETWEEN',
959
-				array(  EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $year_r . '-' . $month_r . '-01 00:00:00', 'Y-m-d H:i:s'), EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $year_r . '-' . $month_r . '-' . $days_in_month .  ' 23:59:59', 'Y-m-d H:i:s' ) ) );
960
-		}elseif($start_date && $end_date){
955
+			$month_r = ! empty($pieces[0]) ? date('m', strtotime($pieces[0])) : '';
956
+			$year_r = ! empty($pieces[1]) ? $pieces[1] : '';
957
+			$days_in_month = date('t', strtotime($year_r.'-'.$month_r.'-'.'01'));
958
+			$_where['REG_date'] = array('BETWEEN',
959
+				array(EEM_Registration::instance()->convert_datetime_for_query('REG_date', $year_r.'-'.$month_r.'-01 00:00:00', 'Y-m-d H:i:s'), EEM_Registration::instance()->convert_datetime_for_query('REG_date', $year_r.'-'.$month_r.'-'.$days_in_month.' 23:59:59', 'Y-m-d H:i:s')));
960
+		}elseif ($start_date && $end_date) {
961 961
 			throw new EE_Error("not yet supported");
962
-		}elseif($start_date){
962
+		}elseif ($start_date) {
963 963
 			throw new EE_Error("not yet supported");
964
-		}elseif($end_date){
964
+		}elseif ($end_date) {
965 965
 			throw new EE_Error("not yet supported");
966 966
 		}
967 967
 
968
-		if ( ! empty( $this->_req_data['s'] ) ) {
969
-			$sstr = '%' . $this->_req_data['s'] . '%';
968
+		if ( ! empty($this->_req_data['s'])) {
969
+			$sstr = '%'.$this->_req_data['s'].'%';
970 970
 			$_where['OR'] = array(
971
-				'Event.EVT_name' => array( 'LIKE', $sstr),
972
-				'Event.EVT_desc' => array( 'LIKE', $sstr ),
973
-				'Event.EVT_short_desc' => array( 'LIKE' , $sstr ),
974
-				'Attendee.ATT_full_name' => array( 'LIKE', $sstr ),
975
-				'Attendee.ATT_fname' => array( 'LIKE', $sstr ),
976
-				'Attendee.ATT_lname' => array( 'LIKE', $sstr ),
977
-				'Attendee.ATT_short_bio' => array( 'LIKE', $sstr ),
978
-				'Attendee.ATT_email' => array('LIKE', $sstr ),
979
-				'Attendee.ATT_address' => array( 'LIKE', $sstr ),
980
-				'Attendee.ATT_address2' => array( 'LIKE', $sstr ),
981
-				'Attendee.ATT_city' => array( 'LIKE', $sstr ),
982
-				'REG_final_price' => array( 'LIKE', $sstr ),
983
-				'REG_code' => array( 'LIKE', $sstr ),
984
-				'REG_count' => array( 'LIKE' , $sstr ),
985
-				'REG_group_size' => array( 'LIKE' , $sstr ),
986
-				'Ticket.TKT_name' => array( 'LIKE', $sstr ),
987
-				'Ticket.TKT_description' => array( 'LIKE', $sstr ),
988
-				'Transaction.Payment.PAY_txn_id_chq_nmbr' => array( 'LIKE', $sstr )
971
+				'Event.EVT_name' => array('LIKE', $sstr),
972
+				'Event.EVT_desc' => array('LIKE', $sstr),
973
+				'Event.EVT_short_desc' => array('LIKE', $sstr),
974
+				'Attendee.ATT_full_name' => array('LIKE', $sstr),
975
+				'Attendee.ATT_fname' => array('LIKE', $sstr),
976
+				'Attendee.ATT_lname' => array('LIKE', $sstr),
977
+				'Attendee.ATT_short_bio' => array('LIKE', $sstr),
978
+				'Attendee.ATT_email' => array('LIKE', $sstr),
979
+				'Attendee.ATT_address' => array('LIKE', $sstr),
980
+				'Attendee.ATT_address2' => array('LIKE', $sstr),
981
+				'Attendee.ATT_city' => array('LIKE', $sstr),
982
+				'REG_final_price' => array('LIKE', $sstr),
983
+				'REG_code' => array('LIKE', $sstr),
984
+				'REG_count' => array('LIKE', $sstr),
985
+				'REG_group_size' => array('LIKE', $sstr),
986
+				'Ticket.TKT_name' => array('LIKE', $sstr),
987
+				'Ticket.TKT_description' => array('LIKE', $sstr),
988
+				'Transaction.Payment.PAY_txn_id_chq_nmbr' => array('LIKE', $sstr)
989 989
 				);
990 990
 		}
991 991
 
992 992
 		//capability checks
993
-		if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_registrations', 'get_registrations' ) ) {
993
+		if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_registrations', 'get_registrations')) {
994 994
 			$_where['AND'] = array(
995 995
 				'Event.EVT_wp_user' => get_current_user_id()
996 996
 				);
997 997
 		}
998 998
 
999 999
 
1000
-		if( $count ){
1001
-			if ( $trash ) {
1002
-				return EEM_Registration::instance()->count_deleted( array( $_where ));
1003
-			} else if ( $incomplete ) {
1004
-				return EEM_Registration::instance()->count( array( $_where ));
1000
+		if ($count) {
1001
+			if ($trash) {
1002
+				return EEM_Registration::instance()->count_deleted(array($_where));
1003
+			} else if ($incomplete) {
1004
+				return EEM_Registration::instance()->count(array($_where));
1005 1005
 			} else {
1006
-				return EEM_Registration::instance()->count( array( $_where, 'default_where_conditions' => 'this_model_only' ));
1006
+				return EEM_Registration::instance()->count(array($_where, 'default_where_conditions' => 'this_model_only'));
1007 1007
 			}
1008 1008
 		} else {
1009 1009
 			//make sure we remove default where conditions cause all registrations matching query are returned
1010
-			$query_params = array( $_where, 'order_by' => array( $orderby => $sort ), 'default_where_conditions' => 'this_model_only' );
1011
-			if ( $per_page !== -1 ) {
1010
+			$query_params = array($_where, 'order_by' => array($orderby => $sort), 'default_where_conditions' => 'this_model_only');
1011
+			if ($per_page !== -1) {
1012 1012
 				$query_params['limit'] = $limit;
1013 1013
 			}
1014
-			$registrations =  $trash ? EEM_Registration::instance()->get_all_deleted($query_params) : EEM_Registration::instance()->get_all($query_params);
1014
+			$registrations = $trash ? EEM_Registration::instance()->get_all_deleted($query_params) : EEM_Registration::instance()->get_all($query_params);
1015 1015
 
1016 1016
 
1017
-			if ( $EVT_ID && isset( $registrations[0] ) && $registrations[0] instanceof EE_Registration &&  $registrations[0]->event_obj()) {
1017
+			if ($EVT_ID && isset($registrations[0]) && $registrations[0] instanceof EE_Registration && $registrations[0]->event_obj()) {
1018 1018
 				$first_registration = $registrations[0];
1019 1019
 				//EEH_Debug_Tools::printr( $registrations[0], '$registrations  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
1020 1020
 				$event_name = $first_registration->event_obj()->name();
1021
-				$event_date = $first_registration->date_obj()->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 ) : '';
1021
+				$event_date = $first_registration->date_obj()->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 ) : '';
1022 1022
 				// edit event link
1023
-				if ( $event_name != '' ) {
1024
-					$edit_event_url = self::add_query_args_and_nonce( array( 'action'=>'edit_event', 'EVT_ID'=>$EVT_ID ), EVENTS_ADMIN_URL );
1025
-					$edit_event_lnk = '<a href="'.$edit_event_url.'" title="' . esc_attr__( 'Edit ', 'event_espresso' ) . $event_name . '">' . __( 'Edit Event', 'event_espresso' ) . '</a>';
1026
-					$event_name .= ' <span class="admin-page-header-edit-lnk not-bold">' . $edit_event_lnk . '</span>' ;
1023
+				if ($event_name != '') {
1024
+					$edit_event_url = self::add_query_args_and_nonce(array('action'=>'edit_event', 'EVT_ID'=>$EVT_ID), EVENTS_ADMIN_URL);
1025
+					$edit_event_lnk = '<a href="'.$edit_event_url.'" title="'.esc_attr__('Edit ', 'event_espresso').$event_name.'">'.__('Edit Event', 'event_espresso').'</a>';
1026
+					$event_name .= ' <span class="admin-page-header-edit-lnk not-bold">'.$edit_event_lnk.'</span>';
1027 1027
 				}
1028 1028
 
1029
-				$back_2_reg_url = self::add_query_args_and_nonce( array( 'action'=>'default' ), REG_ADMIN_URL );
1030
-				$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>';
1029
+				$back_2_reg_url = self::add_query_args_and_nonce(array('action'=>'default'), REG_ADMIN_URL);
1030
+				$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>';
1031 1031
 
1032 1032
 				$this->_template_args['before_admin_page_content'] = '
1033 1033
 			<div id="admin-page-header">
1034
-				<h1><span class="small-text not-bold">'.__( 'Event: ', 'event_espresso' ).'</span>'. $event_name .'</h1>
1035
-				<h3><span class="small-text not-bold">'.__( 'Date: ', 'event_espresso' ). '</span>'. $event_date .'</h3>
1036
-				<span class="admin-page-header-go-back-lnk not-bold">' . $back_2_reg_lnk . '</span>
1034
+				<h1><span class="small-text not-bold">'.__('Event: ', 'event_espresso').'</span>'.$event_name.'</h1>
1035
+				<h3><span class="small-text not-bold">'.__('Date: ', 'event_espresso').'</span>'.$event_date.'</h3>
1036
+				<span class="admin-page-header-go-back-lnk not-bold">' . $back_2_reg_lnk.'</span>
1037 1037
 			</div>
1038 1038
 			';
1039 1039
 
@@ -1071,7 +1071,7 @@  discard block
 block discarded – undo
1071 1071
 
1072 1072
 		$this->_set_registration_object();
1073 1073
 
1074
-		if ( is_object( $this->_registration )) {
1074
+		if (is_object($this->_registration)) {
1075 1075
 			$transaction = $this->_registration->transaction() ? $this->_registration->transaction() : EE_Transaction::new_instance();
1076 1076
 			$this->_session = $transaction->session_data();
1077 1077
 
@@ -1079,10 +1079,10 @@  discard block
 block discarded – undo
1079 1079
 
1080 1080
 
1081 1081
 			$this->_template_args['reg_nmbr']['value'] = $this->_registration->ID();
1082
-			$this->_template_args['reg_nmbr']['label'] = __( 'Registration Number', 'event_espresso' );
1082
+			$this->_template_args['reg_nmbr']['label'] = __('Registration Number', 'event_espresso');
1083 1083
 
1084
-			$this->_template_args['reg_datetime']['value'] =  $this->_registration->pretty_date('l F j, Y','g:i:s a') ;
1085
-			$this->_template_args['reg_datetime']['label'] = __( 'Date', 'event_espresso' );
1084
+			$this->_template_args['reg_datetime']['value'] = $this->_registration->pretty_date('l F j, Y', 'g:i:s a');
1085
+			$this->_template_args['reg_datetime']['label'] = __('Date', 'event_espresso');
1086 1086
 
1087 1087
 			$this->_template_args['grand_total'] = $transaction->total();
1088 1088
 
@@ -1090,19 +1090,19 @@  discard block
 block discarded – undo
1090 1090
 			// link back to overview
1091 1091
 			$this->_template_args['reg_overview_url'] = REG_ADMIN_URL;
1092 1092
 			$this->_template_args['registration'] = $this->_registration;
1093
-			$this->_template_args['filtered_registrations_link'] = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'default', 'event_id' => $event_id ), REG_ADMIN_URL );
1094
-			$this->_template_args['filtered_transactions_link'] = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'default', 'EVT_ID' => $event_id, 'page' => 'espresso_transactions' ), admin_url( 'admin.php' ) );
1095
-			$this->_template_args['event_link'] = EE_Admin_Page::add_query_args_and_nonce( array( 'page' => 'espresso_events', 'action' => 'edit', 'post' => $event_id ), admin_url( 'admin.php' ) );
1093
+			$this->_template_args['filtered_registrations_link'] = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'default', 'event_id' => $event_id), REG_ADMIN_URL);
1094
+			$this->_template_args['filtered_transactions_link'] = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'default', 'EVT_ID' => $event_id, 'page' => 'espresso_transactions'), admin_url('admin.php'));
1095
+			$this->_template_args['event_link'] = EE_Admin_Page::add_query_args_and_nonce(array('page' => 'espresso_events', 'action' => 'edit', 'post' => $event_id), admin_url('admin.php'));
1096 1096
 
1097 1097
 			//next and previous links
1098
-			$next_reg = $this->_registration->next(null, array(), 'REG_ID' );
1099
-			$this->_template_args['next_registration'] = $next_reg ? $this->_next_link( EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'view_registration', '_REG_ID' => $next_reg['REG_ID'] ), REG_ADMIN_URL ), 'dashicons dashicons-arrow-right ee-icon-size-22' ) : '';
1100
-			$previous_reg = $this->_registration->previous( null, array(), 'REG_ID' );
1101
-			$this->_template_args['previous_registration'] = $previous_reg ? $this->_previous_link( EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'view_registration', '_REG_ID' => $previous_reg['REG_ID'] ), REG_ADMIN_URL ), 'dashicons dashicons-arrow-left ee-icon-size-22' ) : '';
1098
+			$next_reg = $this->_registration->next(null, array(), 'REG_ID');
1099
+			$this->_template_args['next_registration'] = $next_reg ? $this->_next_link(EE_Admin_Page::add_query_args_and_nonce(array('action' => 'view_registration', '_REG_ID' => $next_reg['REG_ID']), REG_ADMIN_URL), 'dashicons dashicons-arrow-right ee-icon-size-22') : '';
1100
+			$previous_reg = $this->_registration->previous(null, array(), 'REG_ID');
1101
+			$this->_template_args['previous_registration'] = $previous_reg ? $this->_previous_link(EE_Admin_Page::add_query_args_and_nonce(array('action' => 'view_registration', '_REG_ID' => $previous_reg['REG_ID']), REG_ADMIN_URL), 'dashicons dashicons-arrow-left ee-icon-size-22') : '';
1102 1102
 
1103 1103
 			// grab header
1104
-			$template_path = REG_TEMPLATE_PATH . 'reg_admin_details_header.template.php';
1105
-			$this->_template_args['admin_page_header'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
1104
+			$template_path = REG_TEMPLATE_PATH.'reg_admin_details_header.template.php';
1105
+			$this->_template_args['admin_page_header'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE);
1106 1106
 
1107 1107
 		} else {
1108 1108
 
@@ -1123,14 +1123,14 @@  discard block
 block discarded – undo
1123 1123
 	protected function _registration_details_metaboxes() {
1124 1124
 		$this->_set_registration_object();
1125 1125
 		$attendee = $this->_registration instanceof EE_Registration ? $this->_registration->attendee() : null;
1126
-		add_meta_box( 'edit-reg-status-mbox', __( 'Registration Status', 'event_espresso' ), array( $this, 'set_reg_status_buttons_metabox' ), $this->wp_page_slug, 'normal', 'high' );
1127
-		add_meta_box( 'edit-reg-details-mbox', __( 'Registration Details', 'event_espresso' ), array( $this, '_reg_details_meta_box' ), $this->wp_page_slug, 'normal', 'high' );
1128
-		if ( $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can('ee_edit_registration', 'edit-reg-questions-mbox' ) ) {
1129
-			add_meta_box( 'edit-reg-questions-mbox', __( 'Registration Form Answers', 'event_espresso' ), array( $this, '_reg_questions_meta_box' ), $this->wp_page_slug, 'normal', 'high' );
1126
+		add_meta_box('edit-reg-status-mbox', __('Registration Status', 'event_espresso'), array($this, 'set_reg_status_buttons_metabox'), $this->wp_page_slug, 'normal', 'high');
1127
+		add_meta_box('edit-reg-details-mbox', __('Registration Details', 'event_espresso'), array($this, '_reg_details_meta_box'), $this->wp_page_slug, 'normal', 'high');
1128
+		if ($attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can('ee_edit_registration', 'edit-reg-questions-mbox')) {
1129
+			add_meta_box('edit-reg-questions-mbox', __('Registration Form Answers', 'event_espresso'), array($this, '_reg_questions_meta_box'), $this->wp_page_slug, 'normal', 'high');
1130 1130
 		}
1131
-		add_meta_box( 'edit-reg-registrant-mbox', __( 'Contact Details', 'event_espresso' ), array( $this, '_reg_registrant_side_meta_box' ), $this->wp_page_slug, 'side', 'high' );
1132
-		if ( $this->_registration->group_size() > 1 ) {
1133
-			add_meta_box( 'edit-reg-attendees-mbox', __( 'Other Registrations in this Transaction', 'event_espresso' ), array( $this, '_reg_attendees_meta_box' ), $this->wp_page_slug, 'normal', 'high' );
1131
+		add_meta_box('edit-reg-registrant-mbox', __('Contact Details', 'event_espresso'), array($this, '_reg_registrant_side_meta_box'), $this->wp_page_slug, 'side', 'high');
1132
+		if ($this->_registration->group_size() > 1) {
1133
+			add_meta_box('edit-reg-attendees-mbox', __('Other Registrations in this Transaction', 'event_espresso'), array($this, '_reg_attendees_meta_box'), $this->wp_page_slug, 'normal', 'high');
1134 1134
 		}
1135 1135
 	}
1136 1136
 
@@ -1151,23 +1151,23 @@  discard block
 block discarded – undo
1151 1151
 
1152 1152
 		//let's get an array of all possible buttons that we can just reference
1153 1153
 		$status_buttons = $this->_get_reg_status_buttons();
1154
-		$template_args[ 'reg_status_value' ] = $this->_registration->pretty_status();
1155
-		$template_args[ 'reg_status_class' ] = 'status-' . $this->_registration->status_ID();
1154
+		$template_args['reg_status_value'] = $this->_registration->pretty_status();
1155
+		$template_args['reg_status_class'] = 'status-'.$this->_registration->status_ID();
1156 1156
 		$template_args['attendee'] = $this->_registration->attendee();
1157
-		$template = REG_TEMPLATE_PATH . 'reg_status_change_buttons.template.php';
1158
-		if ( $this->_set_registration_object() ) {
1157
+		$template = REG_TEMPLATE_PATH.'reg_status_change_buttons.template.php';
1158
+		if ($this->_set_registration_object()) {
1159 1159
 			$current_status = $this->_registration->status_ID();
1160
-			unset( $status_buttons[$current_status] );
1161
-			if ( $current_status != EEM_Registration::status_id_pending_payment && $is_complete ) {
1162
-				unset( $status_buttons[EEM_Registration::status_id_pending_payment] );
1160
+			unset($status_buttons[$current_status]);
1161
+			if ($current_status != EEM_Registration::status_id_pending_payment && $is_complete) {
1162
+				unset($status_buttons[EEM_Registration::status_id_pending_payment]);
1163 1163
 			}
1164
-			$template_args['status_buttons'] = implode( "\n", $status_buttons );
1164
+			$template_args['status_buttons'] = implode("\n", $status_buttons);
1165 1165
 		}
1166 1166
 		$template_args['form_url'] = REG_ADMIN_URL;
1167 1167
 		$template_args['REG_ID'] = $this->_registration->ID();
1168
-		$template_args['nonce'] = wp_nonce_field( 'change_reg_status_nonce',  'change_reg_status_nonce', FALSE, FALSE );
1168
+		$template_args['nonce'] = wp_nonce_field('change_reg_status_nonce', 'change_reg_status_nonce', FALSE, FALSE);
1169 1169
 
1170
-		EEH_Template::display_template( $template, $template_args );
1170
+		EEH_Template::display_template($template, $template_args);
1171 1171
 
1172 1172
 	}
1173 1173
 
@@ -1181,11 +1181,11 @@  discard block
 block discarded – undo
1181 1181
 	private function _get_reg_status_buttons() {
1182 1182
 
1183 1183
 		$buttons = array(
1184
-			EEM_Registration::status_id_approved => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-' . EEM_Registration::status_id_approved . '" value="' . EEH_Template::pretty_status( EEM_Registration::status_id_approved, FALSE, 'sentence' ) . '">',
1185
-			EEM_Registration::status_id_pending_payment => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-' . EEM_Registration::status_id_pending_payment . '" value="' . EEH_Template::pretty_status( EEM_Registration::status_id_pending_payment, FALSE, 'sentence' ) . '">',
1186
-			EEM_Registration::status_id_not_approved => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-' . EEM_Registration::status_id_not_approved . '" value="' . EEH_Template::pretty_status( EEM_Registration::status_id_not_approved, FALSE, 'sentence' ) . '">',
1187
-			EEM_Registration::status_id_declined => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-' . EEM_Registration::status_id_declined . '" value="' . EEH_Template::pretty_status( EEM_Registration::status_id_declined, FALSE, 'sentence' ) . '">',
1188
-			EEM_Registration::status_id_cancelled =>'<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-' . EEM_Registration::status_id_cancelled . '" value="' . EEH_Template::pretty_status( EEM_Registration::status_id_cancelled, FALSE, 'sentence' ) . '">',
1184
+			EEM_Registration::status_id_approved => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-'.EEM_Registration::status_id_approved.'" value="'.EEH_Template::pretty_status(EEM_Registration::status_id_approved, FALSE, 'sentence').'">',
1185
+			EEM_Registration::status_id_pending_payment => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-'.EEM_Registration::status_id_pending_payment.'" value="'.EEH_Template::pretty_status(EEM_Registration::status_id_pending_payment, FALSE, 'sentence').'">',
1186
+			EEM_Registration::status_id_not_approved => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-'.EEM_Registration::status_id_not_approved.'" value="'.EEH_Template::pretty_status(EEM_Registration::status_id_not_approved, FALSE, 'sentence').'">',
1187
+			EEM_Registration::status_id_declined => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-'.EEM_Registration::status_id_declined.'" value="'.EEH_Template::pretty_status(EEM_Registration::status_id_declined, FALSE, 'sentence').'">',
1188
+			EEM_Registration::status_id_cancelled =>'<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-'.EEM_Registration::status_id_cancelled.'" value="'.EEH_Template::pretty_status(EEM_Registration::status_id_cancelled, FALSE, 'sentence').'">',
1189 1189
 			);
1190 1190
 		return $buttons;
1191 1191
 	}
@@ -1199,13 +1199,13 @@  discard block
 block discarded – undo
1199 1199
 	 *
1200 1200
 	 * @return array  (array with reg_id(s) updated and whether update was successful.
1201 1201
 	 */
1202
-	protected function _set_registration_status_from_request( $status = false, $notify = false ) {
1203
-		$REG_ID = isset( $this->_req_data['_REG_ID'] ) ? (array) $this->_req_data['_REG_ID'] : array();
1202
+	protected function _set_registration_status_from_request($status = false, $notify = false) {
1203
+		$REG_ID = isset($this->_req_data['_REG_ID']) ? (array) $this->_req_data['_REG_ID'] : array();
1204 1204
 
1205
-		$success = $this->_set_registration_status( $REG_ID, $status );
1205
+		$success = $this->_set_registration_status($REG_ID, $status);
1206 1206
 
1207 1207
 		//notify?
1208
-		if ( $success && $notify && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_registrations_resend_registration' ) ) {
1208
+		if ($success && $notify && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_registrations_resend_registration')) {
1209 1209
 			$this->_process_resend_registration();
1210 1210
 		}
1211 1211
 
@@ -1223,19 +1223,19 @@  discard block
 block discarded – undo
1223 1223
 	 * @param bool $status
1224 1224
 	 * @return array (an array with 'success' key representing whether status change was successful, and 'REG_ID' as the array of updated registrations).
1225 1225
 	 */
1226
-	protected function _set_registration_status( $REG_ID, $status = false ) {
1226
+	protected function _set_registration_status($REG_ID, $status = false) {
1227 1227
 		$success = true;
1228 1228
 		// set default status if none is passed
1229 1229
 		$status = $status ? $status : EEM_Registration::status_id_pending_payment;
1230 1230
 
1231 1231
 		//typecast and sanitize reg_id
1232
-		$reg_ids = array_filter( (array) $REG_ID, 'absint' );
1232
+		$reg_ids = array_filter((array) $REG_ID, 'absint');
1233 1233
 
1234 1234
 		//loop through REG_ID's and change status
1235
-		foreach ( $reg_ids as $r_id ) {
1236
-			$registration = EEM_Registration::instance()->get_one_by_ID( $r_id );
1237
-			if ( $registration instanceof EE_Registration ) {
1238
-				$registration->set_status( $status );
1235
+		foreach ($reg_ids as $r_id) {
1236
+			$registration = EEM_Registration::instance()->get_one_by_ID($r_id);
1237
+			if ($registration instanceof EE_Registration) {
1238
+				$registration->set_status($status);
1239 1239
 				$result = $registration->save();
1240 1240
 
1241 1241
 				//verifying explicit fails because update *may* just return 0 for 0 rows affected
@@ -1247,7 +1247,7 @@  discard block
 block discarded – undo
1247 1247
 		$this->_req_data['_REG_ID'] = $reg_ids;
1248 1248
 
1249 1249
 		//return $success and processed registrations
1250
-		return array( 'REG_ID' => $reg_ids, 'success' => $success );
1250
+		return array('REG_ID' => $reg_ids, 'success' => $success);
1251 1251
 	}
1252 1252
 
1253 1253
 
@@ -1259,37 +1259,37 @@  discard block
 block discarded – undo
1259 1259
 	 * @param   bool    $notify indicates whether the _set_registration_status_from_request does notifications or not.
1260 1260
 	 * @return void
1261 1261
 	 */
1262
-	protected function _reg_status_change_return( $STS_ID, $notify = false ) {
1262
+	protected function _reg_status_change_return($STS_ID, $notify = false) {
1263 1263
 
1264
-		$result = ! empty( $STS_ID ) ? $this->_set_registration_status_from_request( $STS_ID, $notify ) : array( 'success' => false );
1264
+		$result = ! empty($STS_ID) ? $this->_set_registration_status_from_request($STS_ID, $notify) : array('success' => false);
1265 1265
 
1266 1266
 
1267
-		$success = isset( $result['success'] ) && $result['success'];
1267
+		$success = isset($result['success']) && $result['success'];
1268 1268
 
1269 1269
 		//setup success message
1270
-		if ( $success ) {
1271
-			$msg = is_array( $result['REG_ID'] ) && count( $result['REG_ID'] ) > 1  ? sprintf( __('Registration status has been set to %s', 'event_espresso'), EEH_Template::pretty_status($STS_ID, false, 'lower' ) ) :  sprintf( __('Registrations have been set to %s.', 'event_espresso'), EEH_Template::pretty_status($STS_ID, false, 'lower' ) ) ;
1272
-			EE_Error::add_success( $msg );
1270
+		if ($success) {
1271
+			$msg = is_array($result['REG_ID']) && count($result['REG_ID']) > 1 ? sprintf(__('Registration status has been set to %s', 'event_espresso'), EEH_Template::pretty_status($STS_ID, false, 'lower')) : sprintf(__('Registrations have been set to %s.', 'event_espresso'), EEH_Template::pretty_status($STS_ID, false, 'lower'));
1272
+			EE_Error::add_success($msg);
1273 1273
 		} else {
1274
-			EE_Error::add_error( __('Something went wrong, and the status was not changed', 'event_espresso' ), __FILE__, __LINE__, __FUNCTION__ );
1274
+			EE_Error::add_error(__('Something went wrong, and the status was not changed', 'event_espresso'), __FILE__, __LINE__, __FUNCTION__);
1275 1275
 		}
1276 1276
 
1277
-		$route = isset( $this->_req_data['return'] ) && $this->_req_data['return'] == 'view_registration' ? array( 'action' => 'view_registration', '_REG_ID' => $result['REG_ID'][0] ) : array( 'action' => 'default' );
1277
+		$route = isset($this->_req_data['return']) && $this->_req_data['return'] == 'view_registration' ? array('action' => 'view_registration', '_REG_ID' => $result['REG_ID'][0]) : array('action' => 'default');
1278 1278
 		//unset nonces
1279
-		foreach ( $this->_req_data as $ref => $value ) {
1280
-			if ( strpos( $ref, 'nonce' ) !== false ) {
1281
-				unset( $this->_req_data[$ref] );
1279
+		foreach ($this->_req_data as $ref => $value) {
1280
+			if (strpos($ref, 'nonce') !== false) {
1281
+				unset($this->_req_data[$ref]);
1282 1282
 				continue;
1283 1283
 			}
1284 1284
 
1285
-			$value = is_array( $value ) ? array_map( 'urlencode', $value ) : urlencode( $value );
1285
+			$value = is_array($value) ? array_map('urlencode', $value) : urlencode($value);
1286 1286
 			$this->_req_data[$ref] = $value;
1287 1287
 		}
1288 1288
 
1289 1289
 		//merge request vars so that the reloaded list table contains any existing filter query params
1290
-		$route = array_merge( $this->_req_data, $route );
1290
+		$route = array_merge($this->_req_data, $route);
1291 1291
 
1292
-		$this->_redirect_after_action( $success, '', '', $route, true );
1292
+		$this->_redirect_after_action($success, '', '', $route, true);
1293 1293
 
1294 1294
 		}
1295 1295
 
@@ -1302,29 +1302,29 @@  discard block
 block discarded – undo
1302 1302
 	protected function _change_reg_status() {
1303 1303
 		$this->_req_data['return'] = 'view_registration';
1304 1304
 		//set notify based on whether the send notifications toggle is set or not
1305
-		$notify = ! empty( $this->_req_data['txn_reg_status_change']['send_notifications'] );
1306
-		$this->_req_data[ '_reg_status_id' ] = isset( $this->_req_data[ '_reg_status_id' ] ) ? $this->_req_data[ '_reg_status_id' ] : '';
1305
+		$notify = ! empty($this->_req_data['txn_reg_status_change']['send_notifications']);
1306
+		$this->_req_data['_reg_status_id'] = isset($this->_req_data['_reg_status_id']) ? $this->_req_data['_reg_status_id'] : '';
1307 1307
 
1308
-		switch ( $this->_req_data['_reg_status_id'] ) {
1309
-			case EEH_Template::pretty_status( EEM_Registration::status_id_approved, false, 'sentence' ) :
1310
-				$this->approve_registration( $notify );
1308
+		switch ($this->_req_data['_reg_status_id']) {
1309
+			case EEH_Template::pretty_status(EEM_Registration::status_id_approved, false, 'sentence') :
1310
+				$this->approve_registration($notify);
1311 1311
 				break;
1312
-			case EEH_Template::pretty_status( EEM_Registration::status_id_pending_payment, false, 'sentence' ) :
1313
-				$this->pending_registration( $notify );
1312
+			case EEH_Template::pretty_status(EEM_Registration::status_id_pending_payment, false, 'sentence') :
1313
+				$this->pending_registration($notify);
1314 1314
 				break;
1315
-			case EEH_Template::pretty_status( EEM_Registration::status_id_not_approved, false, 'sentence' ) :
1316
-				$this->not_approve_registration( $notify );
1315
+			case EEH_Template::pretty_status(EEM_Registration::status_id_not_approved, false, 'sentence') :
1316
+				$this->not_approve_registration($notify);
1317 1317
 				break;
1318
-			case EEH_Template::pretty_status( EEM_Registration::status_id_declined, false, 'sentence' ) :
1319
-				$this->decline_registration( $notify );
1318
+			case EEH_Template::pretty_status(EEM_Registration::status_id_declined, false, 'sentence') :
1319
+				$this->decline_registration($notify);
1320 1320
 				break;
1321
-			case EEH_Template::pretty_status( EEM_Registration::status_id_cancelled, false, 'sentence' ) :
1322
-				$this->cancel_registration( $notify );
1321
+			case EEH_Template::pretty_status(EEM_Registration::status_id_cancelled, false, 'sentence') :
1322
+				$this->cancel_registration($notify);
1323 1323
 				break;
1324 1324
 			default :
1325 1325
 				$result['success'] = false;
1326
-				unset( $this->_req_data['return'] );
1327
-				$this->_reg_status_change_return( '', false );
1326
+				unset($this->_req_data['return']);
1327
+				$this->_reg_status_change_return('', false);
1328 1328
 				break;
1329 1329
 		}
1330 1330
 	}
@@ -1337,8 +1337,8 @@  discard block
 block discarded – undo
1337 1337
 	*		@param bool $notify whether or not to notify the registrant about their approval.
1338 1338
 	*		@return void
1339 1339
 	*/
1340
-	protected function approve_registration( $notify = false ) {
1341
-		$this->_reg_status_change_return( EEM_Registration::status_id_approved, $notify );
1340
+	protected function approve_registration($notify = false) {
1341
+		$this->_reg_status_change_return(EEM_Registration::status_id_approved, $notify);
1342 1342
 	}
1343 1343
 
1344 1344
 
@@ -1350,8 +1350,8 @@  discard block
 block discarded – undo
1350 1350
 	*		@param bool $notify whether or not to notify the registrant about their approval.
1351 1351
 	*		@return void
1352 1352
 	*/
1353
-	protected function decline_registration( $notify = false ) {
1354
-		$this->_reg_status_change_return( EEM_Registration::status_id_declined, $notify );
1353
+	protected function decline_registration($notify = false) {
1354
+		$this->_reg_status_change_return(EEM_Registration::status_id_declined, $notify);
1355 1355
 	}
1356 1356
 
1357 1357
 
@@ -1363,8 +1363,8 @@  discard block
 block discarded – undo
1363 1363
 	*		@param bool $notify whether or not to notify the registrant about their approval.
1364 1364
 	*		@return void
1365 1365
 	*/
1366
-	protected function cancel_registration( $notify = false ) {
1367
-		$this->_reg_status_change_return( EEM_Registration::status_id_cancelled, $notify );
1366
+	protected function cancel_registration($notify = false) {
1367
+		$this->_reg_status_change_return(EEM_Registration::status_id_cancelled, $notify);
1368 1368
 	}
1369 1369
 
1370 1370
 
@@ -1377,8 +1377,8 @@  discard block
 block discarded – undo
1377 1377
 	*		@param bool $notify whether or not to notify the registrant about their approval.
1378 1378
 	*		@return void
1379 1379
 	*/
1380
-	protected function not_approve_registration( $notify = false ) {
1381
-		$this->_reg_status_change_return( EEM_Registration::status_id_not_approved, $notify );
1380
+	protected function not_approve_registration($notify = false) {
1381
+		$this->_reg_status_change_return(EEM_Registration::status_id_not_approved, $notify);
1382 1382
 	}
1383 1383
 
1384 1384
 
@@ -1389,8 +1389,8 @@  discard block
 block discarded – undo
1389 1389
 	*		@param bool $notify whether or not to notify the registrant about their approval.
1390 1390
 	*		@return void
1391 1391
 	*/
1392
-	protected function pending_registration( $notify = false ) {
1393
-		$this->_reg_status_change_return( EEM_Registration::status_id_pending_payment, $notify );
1392
+	protected function pending_registration($notify = false) {
1393
+		$this->_reg_status_change_return(EEM_Registration::status_id_pending_payment, $notify);
1394 1394
 	}
1395 1395
 
1396 1396
 
@@ -1404,75 +1404,75 @@  discard block
 block discarded – undo
1404 1404
 	public function _reg_details_meta_box() {
1405 1405
 		EEH_Autoloader::register_line_item_display_autoloaders();
1406 1406
 		EEH_Autoloader::register_line_item_filter_autoloaders();
1407
-		EE_Registry::instance()->load_Helper( 'Line_Item' );
1407
+		EE_Registry::instance()->load_Helper('Line_Item');
1408 1408
 		$transaction = $this->_registration->transaction() ? $this->_registration->transaction() : EE_Transaction::new_instance();
1409 1409
 		$this->_session = $transaction->session_data();
1410 1410
 
1411 1411
 		$filters = new EE_Line_Item_Filter_Collection();
1412
-		$filters->add( new EE_Single_Registration_Line_Item_Filter( $this->_registration ) );
1413
-		$filters->add( new EE_Non_Zero_Line_Item_Filter() );
1414
-		$line_item_filter_processor = new EE_Line_Item_Filter_Processor( $filters, $transaction->total_line_item() );
1412
+		$filters->add(new EE_Single_Registration_Line_Item_Filter($this->_registration));
1413
+		$filters->add(new EE_Non_Zero_Line_Item_Filter());
1414
+		$line_item_filter_processor = new EE_Line_Item_Filter_Processor($filters, $transaction->total_line_item());
1415 1415
 		$filtered_line_item_tree = $line_item_filter_processor->process();
1416 1416
 
1417 1417
 		$this->_template_args['REG_ID'] = $this->_registration->ID();
1418
-		$line_item_display = new EE_Line_Item_Display( 'reg_admin_table', 'EE_Admin_Table_Registration_Line_Item_Display_Strategy' );
1419
-		$this->_template_args['line_item_table'] = $line_item_display->display_line_item( $filtered_line_item_tree, array( 'EE_Registration' => $this->_registration ) );
1418
+		$line_item_display = new EE_Line_Item_Display('reg_admin_table', 'EE_Admin_Table_Registration_Line_Item_Display_Strategy');
1419
+		$this->_template_args['line_item_table'] = $line_item_display->display_line_item($filtered_line_item_tree, array('EE_Registration' => $this->_registration));
1420 1420
 
1421 1421
 
1422 1422
 		$attendee = $this->_registration->attendee();
1423 1423
 
1424 1424
 
1425
-		$this->_template_args['view_transaction_button'] = EE_Registry::instance()->CAP->current_user_can( 'ee_read_transaction', 'espresso_transactions_view_transaction' ) ?EEH_Template::get_button_or_link( EE_Admin_Page::add_query_args_and_nonce( array('action'=> 'view_transaction', 'TXN_ID' => $transaction->ID() ), TXN_ADMIN_URL ), __(' View Transaction'), 'button secondary-button right', 'dashicons dashicons-cart' ) : '';
1426
-		$this->_template_args['resend_registration_button'] = $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_registrations_resend_registration' ) ?EEH_Template::get_button_or_link( EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'resend_registration', '_REG_ID'=>$this->_registration->ID(), 'redirect_to' => 'view_registration' ), REG_ADMIN_URL ), __(' Resend Registration'), 'button secondary-button right', 'dashicons dashicons-email-alt' ) : '';
1425
+		$this->_template_args['view_transaction_button'] = EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction') ? EEH_Template::get_button_or_link(EE_Admin_Page::add_query_args_and_nonce(array('action'=> 'view_transaction', 'TXN_ID' => $transaction->ID()), TXN_ADMIN_URL), __(' View Transaction'), 'button secondary-button right', 'dashicons dashicons-cart') : '';
1426
+		$this->_template_args['resend_registration_button'] = $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_registrations_resend_registration') ? EEH_Template::get_button_or_link(EE_Admin_Page::add_query_args_and_nonce(array('action'=>'resend_registration', '_REG_ID'=>$this->_registration->ID(), 'redirect_to' => 'view_registration'), REG_ADMIN_URL), __(' Resend Registration'), 'button secondary-button right', 'dashicons dashicons-email-alt') : '';
1427 1427
 
1428 1428
 
1429 1429
 		$this->_template_args['currency_sign'] = EE_Registry::instance()->CFG->currency->sign;
1430
-		$payment = $transaction->get_first_related( 'Payment' );
1430
+		$payment = $transaction->get_first_related('Payment');
1431 1431
 		$payment = ! $payment instanceof EE_Payment ? EE_Payment::new_instance() : $payment;
1432
-		$payment_method = $payment->get_first_related( 'Payment_Method' );
1432
+		$payment_method = $payment->get_first_related('Payment_Method');
1433 1433
 		$payment_method = ! $payment_method instanceof EE_Payment_Method ? EE_Payment_Method::new_instance() : $payment_method;
1434
-		$reg_status_class = 'status-' . $this->_registration->status_ID();
1434
+		$reg_status_class = 'status-'.$this->_registration->status_ID();
1435 1435
 		$reg_details = array(
1436 1436
 			'payment_method' => $payment_method->name(),
1437 1437
 			'response_msg' => $payment->gateway_response(),
1438
-			'registration_id' => $this->_registration->get( 'REG_code' ),
1438
+			'registration_id' => $this->_registration->get('REG_code'),
1439 1439
 			'registration_session' => $this->_registration->session_ID(),
1440
-			'ip_address' => isset( $this->_session['ip_address'] ) ? $this->_session['ip_address'] : '',
1441
-			'user_agent' => isset( $this->_session['user_agent'] ) ? $this->_session['user_agent'] : '',
1440
+			'ip_address' => isset($this->_session['ip_address']) ? $this->_session['ip_address'] : '',
1441
+			'user_agent' => isset($this->_session['user_agent']) ? $this->_session['user_agent'] : '',
1442 1442
 			);
1443 1443
 
1444 1444
 
1445
-		if ( isset( $reg_details['registration_id'] )) {
1445
+		if (isset($reg_details['registration_id'])) {
1446 1446
 			$this->_template_args['reg_details']['registration_id']['value'] = $reg_details['registration_id'];
1447
-			$this->_template_args['reg_details']['registration_id']['label'] = __( 'Registration ID', 'event_espresso' );
1447
+			$this->_template_args['reg_details']['registration_id']['label'] = __('Registration ID', 'event_espresso');
1448 1448
 			$this->_template_args['reg_details']['registration_id']['class'] = 'regular-text';
1449 1449
 		}
1450 1450
 
1451
-		if ( isset( $reg_details['payment_method'] ) ) {
1451
+		if (isset($reg_details['payment_method'])) {
1452 1452
 			$this->_template_args['reg_details']['payment_method']['value'] = $reg_details['payment_method'];
1453
-			$this->_template_args['reg_details']['payment_method']['label'] = __( 'Most Recent Payment Method', 'event_espresso' );
1453
+			$this->_template_args['reg_details']['payment_method']['label'] = __('Most Recent Payment Method', 'event_espresso');
1454 1454
 			$this->_template_args['reg_details']['payment_method']['class'] = 'regular-text';
1455 1455
 			$this->_template_args['reg_details']['response_msg']['value'] = $reg_details['response_msg'];
1456
-			$this->_template_args['reg_details']['response_msg']['label'] = __( 'Payment method response', 'event_espresso' );
1456
+			$this->_template_args['reg_details']['response_msg']['label'] = __('Payment method response', 'event_espresso');
1457 1457
 			$this->_template_args['reg_details']['response_msg']['class'] = 'regular-text';
1458 1458
 		}
1459 1459
 
1460 1460
 		$this->_template_args['reg_details']['registration_session']['value'] = $reg_details['registration_session'];
1461
-		$this->_template_args['reg_details']['registration_session']['label'] = __( 'Registration Session', 'event_espresso' );
1461
+		$this->_template_args['reg_details']['registration_session']['label'] = __('Registration Session', 'event_espresso');
1462 1462
 		$this->_template_args['reg_details']['registration_session']['class'] = 'regular-text';
1463 1463
 
1464 1464
 		$this->_template_args['reg_details']['ip_address']['value'] = $reg_details['ip_address'];
1465
-		$this->_template_args['reg_details']['ip_address']['label'] = __( 'Registration placed from IP', 'event_espresso' );
1465
+		$this->_template_args['reg_details']['ip_address']['label'] = __('Registration placed from IP', 'event_espresso');
1466 1466
 		$this->_template_args['reg_details']['ip_address']['class'] = 'regular-text';
1467 1467
 
1468 1468
 		$this->_template_args['reg_details']['user_agent']['value'] = $reg_details['user_agent'];
1469
-		$this->_template_args['reg_details']['user_agent']['label'] = __( 'Registrant User Agent', 'event_espresso' );
1469
+		$this->_template_args['reg_details']['user_agent']['label'] = __('Registrant User Agent', 'event_espresso');
1470 1470
 		$this->_template_args['reg_details']['user_agent']['class'] = 'large-text';
1471 1471
 
1472
-		$this->_template_args['event_link'] = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'default', 'event_id' => $this->_registration->event_ID()), REG_ADMIN_URL );
1472
+		$this->_template_args['event_link'] = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'default', 'event_id' => $this->_registration->event_ID()), REG_ADMIN_URL);
1473 1473
 
1474
-		$template_path = REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_reg_details.template.php';
1475
-		echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
1474
+		$template_path = REG_TEMPLATE_PATH.'reg_admin_details_main_meta_box_reg_details.template.php';
1475
+		echo EEH_Template::display_template($template_path, $this->_template_args, TRUE);
1476 1476
 
1477 1477
 	}
1478 1478
 
@@ -1488,23 +1488,23 @@  discard block
 block discarded – undo
1488 1488
 	*/
1489 1489
 	public function _reg_questions_meta_box() {
1490 1490
 
1491
-		add_filter( 'FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions', array( $this, 'form_before_question_group' ), 10, 1 );
1492
-		add_filter( 'FHEE__EEH_Form_Fields__generate_question_groups_html__after_question_group_questions', array( $this, 'form_after_question_group' ), 10, 1 );
1493
-		add_filter( 'FHEE__EEH_Form_Fields__label_html', array( $this, 'form_form_field_label_wrap' ), 10, 1 );
1494
-		add_filter( 'FHEE__EEH_Form_Fields__input_html', array( $this, 'form_form_field_input__wrap' ), 10, 1 );
1491
+		add_filter('FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions', array($this, 'form_before_question_group'), 10, 1);
1492
+		add_filter('FHEE__EEH_Form_Fields__generate_question_groups_html__after_question_group_questions', array($this, 'form_after_question_group'), 10, 1);
1493
+		add_filter('FHEE__EEH_Form_Fields__label_html', array($this, 'form_form_field_label_wrap'), 10, 1);
1494
+		add_filter('FHEE__EEH_Form_Fields__input_html', array($this, 'form_form_field_input__wrap'), 10, 1);
1495 1495
 
1496
-		$question_groups = EEM_Event::instance()->assemble_array_of_groups_questions_and_options( $this->_registration, $this->_registration->get('EVT_ID') );
1496
+		$question_groups = EEM_Event::instance()->assemble_array_of_groups_questions_and_options($this->_registration, $this->_registration->get('EVT_ID'));
1497 1497
 
1498 1498
 		//EEH_Debug_Tools::printr( $question_groups, '$question_groups  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
1499 1499
 
1500
-		EE_Registry::instance()->load_helper( 'Form_Fields' );
1501
-		$this->_template_args['att_questions'] = EEH_Form_Fields::generate_question_groups_html( $question_groups );
1500
+		EE_Registry::instance()->load_helper('Form_Fields');
1501
+		$this->_template_args['att_questions'] = EEH_Form_Fields::generate_question_groups_html($question_groups);
1502 1502
 
1503 1503
 		$this->_template_args['reg_questions_form_action'] = 'update_attendee_registration_form';
1504 1504
 		$this->_template_args['REG_ID'] = $this->_registration->ID();
1505 1505
 
1506
-		$template_path = REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_reg_questions.template.php';
1507
-		echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
1506
+		$template_path = REG_TEMPLATE_PATH.'reg_admin_details_main_meta_box_reg_questions.template.php';
1507
+		echo EEH_Template::display_template($template_path, $this->_template_args, TRUE);
1508 1508
 
1509 1509
 	}
1510 1510
 
@@ -1519,7 +1519,7 @@  discard block
 block discarded – undo
1519 1519
 	 * 		@param 		string 		$output
1520 1520
 	 * 		@return 		string
1521 1521
 	 */
1522
-	public function form_before_question_group( $output ) {
1522
+	public function form_before_question_group($output) {
1523 1523
 		return '
1524 1524
 	<table class="form-table ee-width-100">
1525 1525
 		<tbody>
@@ -1536,13 +1536,13 @@  discard block
 block discarded – undo
1536 1536
 	 * 		@param 		string 		$output
1537 1537
 	 * 		@return 		string
1538 1538
 	 */
1539
-	public function form_after_question_group( $output ) {
1539
+	public function form_after_question_group($output) {
1540 1540
 		return  '
1541 1541
 			<tr class="hide-if-no-js">
1542 1542
 				<th> </th>
1543 1543
 				<td class="reg-admin-edit-attendee-question-td">
1544
-					<a class="reg-admin-edit-attendee-question-lnk" href="#" title="' . esc_attr__( 'click to edit question', 'event_espresso' ) . '">
1545
-						<span class="reg-admin-edit-question-group-spn lt-grey-txt">' . __( 'edit the above question group', 'event_espresso' ) . '</span>
1544
+					<a class="reg-admin-edit-attendee-question-lnk" href="#" title="' . esc_attr__('click to edit question', 'event_espresso').'">
1545
+						<span class="reg-admin-edit-question-group-spn lt-grey-txt">' . __('edit the above question group', 'event_espresso').'</span>
1546 1546
 						<div class="dashicons dashicons-edit"></div>
1547 1547
 					</a>
1548 1548
 				</td>
@@ -1562,11 +1562,11 @@  discard block
 block discarded – undo
1562 1562
 	 * 		@param 		string 		$label
1563 1563
 	 * 		@return 		string
1564 1564
 	 */
1565
-	public function form_form_field_label_wrap( $label ) {
1565
+	public function form_form_field_label_wrap($label) {
1566 1566
 		return '
1567 1567
 			<tr>
1568 1568
 				<th>
1569
-					' . $label  . '
1569
+					' . $label.'
1570 1570
 				</th>';
1571 1571
 	}
1572 1572
 
@@ -1580,10 +1580,10 @@  discard block
 block discarded – undo
1580 1580
 	 * 		@param 		string 		$label
1581 1581
 	 * 		@return 		string
1582 1582
 	 */
1583
-	public function form_form_field_input__wrap( $input ) {
1583
+	public function form_form_field_input__wrap($input) {
1584 1584
 		return '
1585 1585
 				<td class="reg-admin-attendee-questions-input-td disabled-input">
1586
-					' . $input . '
1586
+					' . $input.'
1587 1587
 				</td>
1588 1588
 			</tr>';
1589 1589
 	}
@@ -1597,13 +1597,13 @@  discard block
 block discarded – undo
1597 1597
 	*		@return void
1598 1598
 	*/
1599 1599
 	protected function _update_attendee_registration_form() {
1600
-		$qstns = isset( $this->_req_data['qstn'] ) ? $this->_req_data['qstn'] : FALSE;
1601
-		$REG_ID = isset( $this->_req_data['_REG_ID'] ) ? absint( $this->_req_data['_REG_ID'] ) : FALSE;
1602
-		$qstns = apply_filters( 'FHEE__Registrations_Admin_Page___update_attendee_registration_form__qstns', $qstns );
1603
-		$success = $this->_save_attendee_registration_form( $REG_ID, $qstns );
1600
+		$qstns = isset($this->_req_data['qstn']) ? $this->_req_data['qstn'] : FALSE;
1601
+		$REG_ID = isset($this->_req_data['_REG_ID']) ? absint($this->_req_data['_REG_ID']) : FALSE;
1602
+		$qstns = apply_filters('FHEE__Registrations_Admin_Page___update_attendee_registration_form__qstns', $qstns);
1603
+		$success = $this->_save_attendee_registration_form($REG_ID, $qstns);
1604 1604
 		$what = __('Registration Form', 'event_espresso');
1605
-		$route = $REG_ID ? array( 'action' => 'view_registration', '_REG_ID' => $REG_ID ) : array( 'action' => 'default' );
1606
-		$this->_redirect_after_action( $success, $what, __('updated', 'event_espresso'), $route );
1605
+		$route = $REG_ID ? array('action' => 'view_registration', '_REG_ID' => $REG_ID) : array('action' => 'default');
1606
+		$this->_redirect_after_action($success, $what, __('updated', 'event_espresso'), $route);
1607 1607
 
1608 1608
 	}
1609 1609
 
@@ -1616,26 +1616,26 @@  discard block
 block discarded – undo
1616 1616
 	 * @param bool $qstns
1617 1617
 	 * @return bool
1618 1618
 	 */
1619
-	private function _save_attendee_registration_form( $REG_ID = FALSE, $qstns = FALSE ) {
1619
+	private function _save_attendee_registration_form($REG_ID = FALSE, $qstns = FALSE) {
1620 1620
 
1621
-		if ( ! $REG_ID || ! $qstns ) {
1622
-			EE_Error::add_error( __('An error occurred. No registration ID and/or registration questions were received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
1621
+		if ( ! $REG_ID || ! $qstns) {
1622
+			EE_Error::add_error(__('An error occurred. No registration ID and/or registration questions were received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1623 1623
 		}
1624 1624
 		$success = TRUE;
1625 1625
 
1626 1626
 		// allow others to get in on this awesome fun   :D
1627
-		do_action( 'AHEE__Registrations_Admin_Page___save_attendee_registration_form__after_reg_and_attendee_save', $REG_ID, $qstns );
1627
+		do_action('AHEE__Registrations_Admin_Page___save_attendee_registration_form__after_reg_and_attendee_save', $REG_ID, $qstns);
1628 1628
 		// loop thru questions... FINALLY!!!
1629 1629
 
1630
-		foreach ( $qstns as $QST_ID => $qstn ) {
1630
+		foreach ($qstns as $QST_ID => $qstn) {
1631 1631
 			//if $qstn isn't an array then it doesn't already have an answer, so let's create the answer
1632
-			if ( !is_array($qstn) ) {
1633
-				$success = $this->_save_new_answer( $REG_ID, $QST_ID, $qstn);
1632
+			if ( ! is_array($qstn)) {
1633
+				$success = $this->_save_new_answer($REG_ID, $QST_ID, $qstn);
1634 1634
 				continue;
1635 1635
 			}
1636 1636
 
1637 1637
 
1638
-			foreach ( $qstn as $ANS_ID => $ANS_value ) {
1638
+			foreach ($qstn as $ANS_ID => $ANS_value) {
1639 1639
 				//get answer
1640 1640
 				$query_params = array(
1641 1641
 					0 => array(
@@ -1646,8 +1646,8 @@  discard block
 block discarded – undo
1646 1646
 					);
1647 1647
 				$answer = EEM_Answer::instance()->get_one($query_params);
1648 1648
 				//this MAY be an array but NOT have an answer because its multi select.  If so then we need to create the answer
1649
-				if ( ! $answer instanceof EE_Answer ) {
1650
-					$success = $this->_save_new_answer( $REG_ID, $QST_ID, $qstn);
1649
+				if ( ! $answer instanceof EE_Answer) {
1650
+					$success = $this->_save_new_answer($REG_ID, $QST_ID, $qstn);
1651 1651
 					continue 2;
1652 1652
 				}
1653 1653
 
@@ -1661,7 +1661,7 @@  discard block
 block discarded – undo
1661 1661
 
1662 1662
 
1663 1663
 	//TODO: try changing this to use the model directly... not indirectly through creating a default object...
1664
-	private function _save_new_answer( $REG_ID, $QST_ID, $ans ) {
1664
+	private function _save_new_answer($REG_ID, $QST_ID, $ans) {
1665 1665
 		$set_values = array(
1666 1666
 			'QST_ID' => $QST_ID,
1667 1667
 			'REG_ID' => $REG_ID,
@@ -1688,30 +1688,30 @@  discard block
 block discarded – undo
1688 1688
 		$registrations = $REG->get_all(array(
1689 1689
 			array(
1690 1690
 				'TXN_ID'=>$this->_registration->transaction_ID(),
1691
-				'REG_ID'=>array('!=',$this->_registration->ID())
1691
+				'REG_ID'=>array('!=', $this->_registration->ID())
1692 1692
 			),
1693 1693
 			'force_join'=>array('Attendee')));
1694 1694
 
1695 1695
 		$this->_template_args['attendees'] = array();
1696 1696
 		$this->_template_args['attendee_notice'] = '';
1697 1697
 		EE_Registry::instance()->load_helper('Array');
1698
-		if ( empty( $registrations)  || ( is_array($registrations) &&  ! EEH_Array::get_one_item_from_array($registrations) ) ) {
1699
-			EE_Error::add_error( __('There are no records attached to this registration. Something may have gone wrong with the registration', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
1698
+		if (empty($registrations) || (is_array($registrations) && ! EEH_Array::get_one_item_from_array($registrations))) {
1699
+			EE_Error::add_error(__('There are no records attached to this registration. Something may have gone wrong with the registration', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1700 1700
 			$this->_template_args['attendee_notice'] = EE_Error::get_notices();
1701 1701
 		} else {
1702 1702
 
1703 1703
 			$att_nmbr = 1;
1704
-			foreach ( $registrations as $registration ) {
1704
+			foreach ($registrations as $registration) {
1705 1705
 				/* @var $registration EE_Registration */
1706 1706
 				$attendee = $registration->attendee() ? $registration->attendee() : EEM_Attendee::instance()->create_default_object();
1707
-				$this->_template_args['attendees'][ $att_nmbr ]['fname'] = $attendee->fname();//( isset( $registration->ATT_fname ) & ! empty( $registration->ATT_fname ) ) ? $registration->ATT_fname : '';
1708
-				$this->_template_args['attendees'][ $att_nmbr ]['lname'] = $attendee->lname();//( isset( $registration->ATT_lname ) & ! empty( $registration->ATT_lname ) ) ? $registration->ATT_lname : '';
1709
-				$this->_template_args['attendees'][ $att_nmbr ]['email'] = $attendee->email();//( isset( $registration->ATT_email ) & ! empty( $registration->ATT_email ) ) ? $registration->ATT_email : '';
1710
-				$this->_template_args['attendees'][ $att_nmbr ]['final_price'] = $registration->final_price();//( isset( $registration->REG_final_price ) & ! empty( $registration->REG_final_price ) ) ? $registration->REG_final_price : '';
1707
+				$this->_template_args['attendees'][$att_nmbr]['fname'] = $attendee->fname(); //( isset( $registration->ATT_fname ) & ! empty( $registration->ATT_fname ) ) ? $registration->ATT_fname : '';
1708
+				$this->_template_args['attendees'][$att_nmbr]['lname'] = $attendee->lname(); //( isset( $registration->ATT_lname ) & ! empty( $registration->ATT_lname ) ) ? $registration->ATT_lname : '';
1709
+				$this->_template_args['attendees'][$att_nmbr]['email'] = $attendee->email(); //( isset( $registration->ATT_email ) & ! empty( $registration->ATT_email ) ) ? $registration->ATT_email : '';
1710
+				$this->_template_args['attendees'][$att_nmbr]['final_price'] = $registration->final_price(); //( isset( $registration->REG_final_price ) & ! empty( $registration->REG_final_price ) ) ? $registration->REG_final_price : '';
1711 1711
 
1712
-				$this->_template_args['attendees'][ $att_nmbr ]['address'] = implode( ', ', $attendee->full_address_as_array() );
1712
+				$this->_template_args['attendees'][$att_nmbr]['address'] = implode(', ', $attendee->full_address_as_array());
1713 1713
 
1714
-				$this->_template_args['attendees'][ $att_nmbr ]['att_link'] = self::add_query_args_and_nonce( array( 'action'=>'edit_attendee', 'post'=>$attendee->ID() ), REG_ADMIN_URL );
1714
+				$this->_template_args['attendees'][$att_nmbr]['att_link'] = self::add_query_args_and_nonce(array('action'=>'edit_attendee', 'post'=>$attendee->ID()), REG_ADMIN_URL);
1715 1715
 
1716 1716
 				$att_nmbr++;
1717 1717
 			}
@@ -1723,8 +1723,8 @@  discard block
 block discarded – undo
1723 1723
 
1724 1724
 	//			$this->_template_args['registration_form_url'] = add_query_arg( array( 'action' => 'edit_registration', 'process' => 'attendees'  ), REG_ADMIN_URL );
1725 1725
 		}
1726
-		$template_path = REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_attendees.template.php';
1727
-		echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
1726
+		$template_path = REG_TEMPLATE_PATH.'reg_admin_details_main_meta_box_attendees.template.php';
1727
+		echo EEH_Template::display_template($template_path, $this->_template_args, TRUE);
1728 1728
 
1729 1729
 	}
1730 1730
 
@@ -1745,11 +1745,11 @@  discard block
 block discarded – undo
1745 1745
 		$attendee = $att_check instanceof EE_Attendee ? $att_check : EEM_Attendee::instance()->create_default_object();
1746 1746
 
1747 1747
 		//now let's determine if this is not the primary registration.  If it isn't then we set the primary_registration object for reference BUT ONLY if the Attendee object loaded is not the same as the primary registration object (that way we know if we need to show cereate button or not)
1748
-		if ( ! $this->_registration->is_primary_registrant() ) {
1748
+		if ( ! $this->_registration->is_primary_registrant()) {
1749 1749
 			$primary_registration = $this->_registration->get_primary_registration();
1750 1750
 			$primary_attendee = $primary_registration->attendee();
1751 1751
 
1752
-			if ( ! $primary_attendee instanceof EE_Attendee || $attendee->ID() !== $primary_attendee->ID() ) {
1752
+			if ( ! $primary_attendee instanceof EE_Attendee || $attendee->ID() !== $primary_attendee->ID()) {
1753 1753
 				//in here?  This means the displayed registration is not the primary registrant but ALREADY HAS its own custom attendee object so let's not worry about the primary reg.
1754 1754
 				$primary_registration = NULL;
1755 1755
 			}
@@ -1758,28 +1758,28 @@  discard block
 block discarded – undo
1758 1758
 		}
1759 1759
 
1760 1760
 		$this->_template_args['ATT_ID'] = $attendee->ID();
1761
-		$this->_template_args['fname'] = $attendee->fname();//$this->_registration->ATT_fname;
1762
-		$this->_template_args['lname'] = $attendee->lname();//$this->_registration->ATT_lname;
1763
-		$this->_template_args['email'] = $attendee->email();//$this->_registration->ATT_email;
1761
+		$this->_template_args['fname'] = $attendee->fname(); //$this->_registration->ATT_fname;
1762
+		$this->_template_args['lname'] = $attendee->lname(); //$this->_registration->ATT_lname;
1763
+		$this->_template_args['email'] = $attendee->email(); //$this->_registration->ATT_email;
1764 1764
 		$this->_template_args['phone'] = $attendee->phone();
1765 1765
 
1766
-		EE_Registry::instance()->load_helper( 'Formatter' );
1767
-		$this->_template_args[ 'formatted_address' ] = EEH_Address::format( $attendee );
1766
+		EE_Registry::instance()->load_helper('Formatter');
1767
+		$this->_template_args['formatted_address'] = EEH_Address::format($attendee);
1768 1768
 
1769 1769
 
1770 1770
 		//edit link
1771
-		$this->_template_args['att_edit_link'] = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'edit_attendee', 'post'=>$attendee->ID() ), REG_ADMIN_URL );
1772
-		$this->_template_args['att_edit_label'] = __('View/Edit Contact' );
1771
+		$this->_template_args['att_edit_link'] = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'edit_attendee', 'post'=>$attendee->ID()), REG_ADMIN_URL);
1772
+		$this->_template_args['att_edit_label'] = __('View/Edit Contact');
1773 1773
 
1774 1774
 		//create link
1775
-		$this->_template_args['create_link'] = $primary_registration instanceof EE_Registration ? EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'duplicate_attendee',  '_REG_ID' => $this->_registration->ID() ), REG_ADMIN_URL ): '';
1775
+		$this->_template_args['create_link'] = $primary_registration instanceof EE_Registration ? EE_Admin_Page::add_query_args_and_nonce(array('action' => 'duplicate_attendee', '_REG_ID' => $this->_registration->ID()), REG_ADMIN_URL) : '';
1776 1776
 		$this->_template_args['create_label'] = __('Create Contact', 'event_espresso');
1777 1777
 
1778 1778
 		$this->_template_args['att_check'] = $att_check;
1779 1779
 
1780 1780
 
1781
-		$template_path = REG_TEMPLATE_PATH . 'reg_admin_details_side_meta_box_registrant.template.php';
1782
-		echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
1781
+		$template_path = REG_TEMPLATE_PATH.'reg_admin_details_side_meta_box_registrant.template.php';
1782
+		echo EEH_Template::display_template($template_path, $this->_template_args, TRUE);
1783 1783
 	}
1784 1784
 
1785 1785
 
@@ -1792,7 +1792,7 @@  discard block
 block discarded – undo
1792 1792
 	 * @access protected
1793 1793
 	 * @return void
1794 1794
 	 */
1795
-	protected function _trash_or_restore_registrations( $trash = TRUE ) {
1795
+	protected function _trash_or_restore_registrations($trash = TRUE) {
1796 1796
 		$REGM = EEM_Registration::instance();
1797 1797
 
1798 1798
 		$success = 1;
@@ -1802,26 +1802,26 @@  discard block
 block discarded – undo
1802 1802
 		$dtts = array();
1803 1803
 
1804 1804
 		//if empty _REG_ID then get out because there's nothing to do
1805
-		if ( empty( $this->_req_data['_REG_ID'] ) ) {
1805
+		if (empty($this->_req_data['_REG_ID'])) {
1806 1806
 			$msg = $trash ? __('In order to trash registrations you must select which ones you wish to trash by clicking the checkboxes.', 'event_espresso') : __('In order to restore registrations you must select which ones you wish to restore by clicking the checkboxes.', 'event_espresso');
1807
-			EE_Error::add_error( $msg, __FILE__, __LINE__, __FUNCTION__ );
1808
-			$this->_redirect_after_action(FALSE, '', '', array(), TRUE );
1807
+			EE_Error::add_error($msg, __FILE__, __LINE__, __FUNCTION__);
1808
+			$this->_redirect_after_action(FALSE, '', '', array(), TRUE);
1809 1809
 		}
1810 1810
 
1811 1811
 		//Checkboxes
1812
-		if (!empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) {
1812
+		if ( ! empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) {
1813 1813
 			// if array has more than one element than success message should be plural
1814
-			$success = count( $this->_req_data['_REG_ID'] ) > 1 ? 2 : 1;
1814
+			$success = count($this->_req_data['_REG_ID']) > 1 ? 2 : 1;
1815 1815
 			// cycle thru checkboxes
1816
-			while (list( $ind, $REG_ID ) = each($this->_req_data['_REG_ID'])) {
1816
+			while (list($ind, $REG_ID) = each($this->_req_data['_REG_ID'])) {
1817 1817
 
1818 1818
 				$REG = $REGM->get_one_by_ID($REG_ID);
1819 1819
 				$payment_count = $REG->get_first_related('Transaction')->count_related('Payment');
1820
-				if ( $payment_count > 0 ) {
1821
-					$name = $REG->attendee() instanceof EE_Attendee ? $REG->attendee()->full_name() : __( 'Unknown Attendee', 'event_espresso' );
1820
+				if ($payment_count > 0) {
1821
+					$name = $REG->attendee() instanceof EE_Attendee ? $REG->attendee()->full_name() : __('Unknown Attendee', 'event_espresso');
1822 1822
 					$error = 1;
1823 1823
 					$success = 0;
1824
-					EE_Error::add_error( sprintf( __('The registration for %s could not be trashed because it has payments attached to the related transaction.  If you wish to trash this registration you must first delete the payments on the related transaction.', 'event_espresso'), $name ), __FILE__, __FUNCTION__, __LINE__ );
1824
+					EE_Error::add_error(sprintf(__('The registration for %s could not be trashed because it has payments attached to the related transaction.  If you wish to trash this registration you must first delete the payments on the related transaction.', 'event_espresso'), $name), __FILE__, __FUNCTION__, __LINE__);
1825 1825
 					continue; //can't trash this registration because it has payments.
1826 1826
 				}
1827 1827
 				$ticket = $REG->get_first_related('Ticket');
@@ -1830,7 +1830,7 @@  discard block
 block discarded – undo
1830 1830
 				$dtts = array_merge($dtts, $dtt);
1831 1831
 
1832 1832
 				$updated = $trash ? $REG->delete() : $REG->restore();
1833
-				if ( !$updated ) {
1833
+				if ( ! $updated) {
1834 1834
 					$success = 0;
1835 1835
 				} else {
1836 1836
 					$success = 2;
@@ -1845,7 +1845,7 @@  discard block
 block discarded – undo
1845 1845
 			$tickets[$ticket->ID()] = $ticket;
1846 1846
 			$dtts = $ticket->get_many_related('Datetime');
1847 1847
 			$updated = $trash ? $REG->delete() : $REG->restore();
1848
-			if ( ! $updated ) {
1848
+			if ( ! $updated) {
1849 1849
 				$success = 0;
1850 1850
 			}
1851 1851
 
@@ -1855,10 +1855,10 @@  discard block
 block discarded – undo
1855 1855
 		EEM_Ticket::instance()->update_tickets_sold($tickets);
1856 1856
 		EEM_Datetime::instance()->update_sold($dtts);
1857 1857
 
1858
-		$what = $success > 1 ? __( 'Registrations', 'event_espresso' ) : __( 'Registration', 'event_espresso' );
1859
-		$action_desc = $trash ? __( 'moved to the trash', 'event_espresso' ) : __( 'restored', 'event_espresso' );
1858
+		$what = $success > 1 ? __('Registrations', 'event_espresso') : __('Registration', 'event_espresso');
1859
+		$action_desc = $trash ? __('moved to the trash', 'event_espresso') : __('restored', 'event_espresso');
1860 1860
 		$overwrite_msgs = $error ? TRUE : FALSE;
1861
-		$this->_redirect_after_action( $success, $what, $action_desc, array( 'action' => 'default' ), $overwrite_msgs );
1861
+		$this->_redirect_after_action($success, $what, $action_desc, array('action' => 'default'), $overwrite_msgs);
1862 1862
 	}
1863 1863
 
1864 1864
 
@@ -1882,16 +1882,16 @@  discard block
 block discarded – undo
1882 1882
 		$success = 1;
1883 1883
 
1884 1884
 		//Checkboxes
1885
-		if (!empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) {
1885
+		if ( ! empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) {
1886 1886
 			// if array has more than one element than success message should be plural
1887
-			$success = count( $this->_req_data['_REG_ID'] ) > 1 ? 2 : 1;
1887
+			$success = count($this->_req_data['_REG_ID']) > 1 ? 2 : 1;
1888 1888
 			// cycle thru checkboxes
1889
-			while (list( $ind, $REG_ID ) = each($this->_req_data['_REG_ID'])) {
1889
+			while (list($ind, $REG_ID) = each($this->_req_data['_REG_ID'])) {
1890 1890
 				$REG = $REG_MDL->get_one_by_ID($REG_ID);
1891
-				if ( ! $REG instanceof EE_Registration )
1891
+				if ( ! $REG instanceof EE_Registration)
1892 1892
 					continue;
1893 1893
 				$deleted = $this->_delete_registration($REG);
1894
-				if ( !$deleted ) {
1894
+				if ( ! $deleted) {
1895 1895
 					$success = 0;
1896 1896
 				}
1897 1897
 			}
@@ -1901,15 +1901,15 @@  discard block
 block discarded – undo
1901 1901
 			$REG_ID = $this->_req_data['_REG_ID'];
1902 1902
 			$REG = $REG_MDL->get_one_by_ID($REG_ID);
1903 1903
 			$deleted = $this->_delete_registration($REG);
1904
-			if ( ! $deleted ) {
1904
+			if ( ! $deleted) {
1905 1905
 				$success = 0;
1906 1906
 			}
1907 1907
 
1908 1908
 		}
1909 1909
 
1910
-		$what = $success > 1 ? __( 'Registrations', 'event_espresso' ) : __( 'Registration', 'event_espresso' );
1911
-		$action_desc = __( 'permanently deleted.', 'event_espresso' );
1912
-		$this->_redirect_after_action( $success, $what, $action_desc, array( 'action' => 'default' ), TRUE );
1910
+		$what = $success > 1 ? __('Registrations', 'event_espresso') : __('Registration', 'event_espresso');
1911
+		$action_desc = __('permanently deleted.', 'event_espresso');
1912
+		$this->_redirect_after_action($success, $what, $action_desc, array('action' => 'default'), TRUE);
1913 1913
 	}
1914 1914
 
1915 1915
 
@@ -1921,31 +1921,31 @@  discard block
 block discarded – undo
1921 1921
 	 * @param  EE_Registration $REG registration to be deleted permenantly
1922 1922
 	 * @return boolean              true = successful deletion, false = fail.
1923 1923
 	 */
1924
-	protected function _delete_registration( EE_Registration $REG ) {
1924
+	protected function _delete_registration(EE_Registration $REG) {
1925 1925
 		//first we start with the transaction... ultimately, we WILL not delete permanently if there are any related registrations on the transaction that are NOT trashed.
1926 1926
 		$TXN = $REG->get_first_related('Transaction');
1927 1927
 		$REGS = $TXN->get_many_related('Registration');
1928 1928
 
1929 1929
 		$all_trashed = TRUE;
1930
-		foreach ( $REGS as $registration ) {
1931
-			if ( ! $registration->get('REG_deleted') )
1930
+		foreach ($REGS as $registration) {
1931
+			if ( ! $registration->get('REG_deleted'))
1932 1932
 				$all_trashed = FALSE;
1933 1933
 		}
1934 1934
 
1935
-		if ( ! $all_trashed ) {
1936
-			EE_Error::add_error( __('Unable to permanently delete this registration. Before this registration can be permanently deleted, all registrations made in the same transaction must be trashed as well.  These registrations will be permanently deleted in the same action.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
1935
+		if ( ! $all_trashed) {
1936
+			EE_Error::add_error(__('Unable to permanently delete this registration. Before this registration can be permanently deleted, all registrations made in the same transaction must be trashed as well.  These registrations will be permanently deleted in the same action.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1937 1937
 			return false;
1938 1938
 		}
1939 1939
 
1940 1940
 		//k made it here so that means we can delete all the related transactions and their answers (but let's do them separately from THIS one).
1941
-		foreach ( $REGS as $registration ) {
1941
+		foreach ($REGS as $registration) {
1942 1942
 
1943 1943
 			//delete related answers
1944 1944
 			$registration->delete_related_permanently('Answer');
1945 1945
 
1946 1946
 			//remove relationship to EE_Attendee (but we ALWAYS leave the contact record intact)
1947 1947
 			$attendee = $registration->get_first_related('Attendee');
1948
-			if ( $attendee instanceof EE_Attendee ) {
1948
+			if ($attendee instanceof EE_Attendee) {
1949 1949
 				$registration->_remove_relation_to($attendee, 'Attendee');
1950 1950
 			}
1951 1951
 
@@ -1955,7 +1955,7 @@  discard block
 block discarded – undo
1955 1955
 			//now delete permanently the checkins related to this registration.
1956 1956
 			$registration->delete_related_permanently('Checkin');
1957 1957
 
1958
-			if ( $registration->ID() === $REG->ID() )
1958
+			if ($registration->ID() === $REG->ID())
1959 1959
 				continue; //we don't want to delete permanently the existing registration just yet.
1960 1960
 
1961 1961
 			//remove relation to transaction for these registrations if NOT the existing registrations
@@ -1988,34 +1988,34 @@  discard block
 block discarded – undo
1988 1988
 	 * @return void
1989 1989
 	 */
1990 1990
 	public function new_registration() {
1991
-		if ( ! $this->_set_reg_event() ) {
1992
-			throw new EE_Error(__('Unable to continue with registering because there is no Event ID in the request', 'event_espresso') );
1991
+		if ( ! $this->_set_reg_event()) {
1992
+			throw new EE_Error(__('Unable to continue with registering because there is no Event ID in the request', 'event_espresso'));
1993 1993
 		}
1994
-		EE_Registry::instance()->REQ->set_espresso_page( TRUE );
1994
+		EE_Registry::instance()->REQ->set_espresso_page(TRUE);
1995 1995
 
1996 1996
 		// gotta start with a clean slate if we're not coming here via ajax
1997
-		if ( ! defined('DOING_AJAX' ) && ( ! isset( $this->_req_data['processing_registration'] ) || isset( $this->_req_data['step_error'] ))) {
1998
-			EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ );
1997
+		if ( ! defined('DOING_AJAX') && ( ! isset($this->_req_data['processing_registration']) || isset($this->_req_data['step_error']))) {
1998
+			EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__);
1999 1999
 		}
2000 2000
 
2001
-		$this->_template_args['event_name'] = '' ;
2001
+		$this->_template_args['event_name'] = '';
2002 2002
 		// event name
2003
-		if ( $this->_reg_event ) {
2003
+		if ($this->_reg_event) {
2004 2004
 			$this->_template_args['event_name'] = $this->_reg_event->name();
2005
-			$edit_event_url = self::add_query_args_and_nonce( array( 'action'=>'edit', 'post'=>$this->_reg_event->ID() ), EVENTS_ADMIN_URL );
2006
-			$edit_event_lnk = '<a href="'.$edit_event_url.'" title="' . esc_attr__( 'Edit ', 'event_espresso' ) . $this->_reg_event->name() . '">' . __( 'Edit Event', 'event_espresso' ) . '</a>';
2007
-			$this->_template_args['event_name'] .= ' <span class="admin-page-header-edit-lnk not-bold">' . $edit_event_lnk . '</span>' ;
2005
+			$edit_event_url = self::add_query_args_and_nonce(array('action'=>'edit', 'post'=>$this->_reg_event->ID()), EVENTS_ADMIN_URL);
2006
+			$edit_event_lnk = '<a href="'.$edit_event_url.'" title="'.esc_attr__('Edit ', 'event_espresso').$this->_reg_event->name().'">'.__('Edit Event', 'event_espresso').'</a>';
2007
+			$this->_template_args['event_name'] .= ' <span class="admin-page-header-edit-lnk not-bold">'.$edit_event_lnk.'</span>';
2008 2008
 		}
2009 2009
 
2010 2010
 		$this->_template_args['step_content'] = $this->_get_registration_step_content();
2011 2011
 
2012
-		if ( defined('DOING_AJAX' ) )
2012
+		if (defined('DOING_AJAX'))
2013 2013
 			$this->_return_json();
2014 2014
 
2015 2015
 
2016 2016
 		// grab header
2017
-		$template_path = REG_TEMPLATE_PATH . 'reg_admin_register_new_attendee.template.php';
2018
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
2017
+		$template_path = REG_TEMPLATE_PATH.'reg_admin_register_new_attendee.template.php';
2018
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE);
2019 2019
 
2020 2020
 		//$this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE );
2021 2021
 		// the details template wrapper
@@ -2033,7 +2033,7 @@  discard block
 block discarded – undo
2033 2033
 	 */
2034 2034
 	protected function _get_registration_step_content() {
2035 2035
 
2036
-		$template_path = REG_TEMPLATE_PATH . 'reg_admin_register_new_attendee_step_content.template.php';
2036
+		$template_path = REG_TEMPLATE_PATH.'reg_admin_register_new_attendee_step_content.template.php';
2037 2037
 		$template_args = array(
2038 2038
 			'title' => '',
2039 2039
 			'content' => '',
@@ -2054,11 +2054,11 @@  discard block
 block discarded – undo
2054 2054
 
2055 2055
 		//if the cart is empty then we know we're at step one so we'll display ticket selector
2056 2056
 		$cart = EE_Registry::instance()->SSN->get_session_data('cart');
2057
-		$step = empty( $cart ) ? 'ticket' : 'questions';
2058
-		switch ( $step ) {
2057
+		$step = empty($cart) ? 'ticket' : 'questions';
2058
+		switch ($step) {
2059 2059
 			case 'ticket' :
2060 2060
 				$template_args['title'] = __('Step One: Select the Ticket for this registration', 'event_espresso');
2061
-				$template_args['content'] = EED_Ticket_Selector::instance()->display_ticket_selector( $this->_reg_event );
2061
+				$template_args['content'] = EED_Ticket_Selector::instance()->display_ticket_selector($this->_reg_event);
2062 2062
 				$template_args['step_button_text'] = __('Add Tickets and Continue to Registrant Details', 'event_espresso');
2063 2063
 				$template_args['show_notification_toggle'] = FALSE;
2064 2064
 				break;
@@ -2071,9 +2071,9 @@  discard block
 block discarded – undo
2071 2071
 				break;
2072 2072
 		}
2073 2073
 
2074
-		$this->_set_add_edit_form_tags( 'process_reg_step', $hidden_fields ); //we come back to the process_registration_step route.
2074
+		$this->_set_add_edit_form_tags('process_reg_step', $hidden_fields); //we come back to the process_registration_step route.
2075 2075
 
2076
-		return EEH_Template::display_template( $template_path, $template_args, TRUE );
2076
+		return EEH_Template::display_template($template_path, $template_args, TRUE);
2077 2077
 	}
2078 2078
 
2079 2079
 
@@ -2087,11 +2087,11 @@  discard block
 block discarded – undo
2087 2087
 	*		@return boolean
2088 2088
 	*/
2089 2089
 	private function _set_reg_event() {
2090
-		if ( is_object( $this->_reg_event )) {
2090
+		if (is_object($this->_reg_event)) {
2091 2091
 			return TRUE;
2092 2092
 		}
2093
-		$EVT_ID = ( ! empty( $this->_req_data['event_id'] )) ? absint( $this->_req_data['event_id'] ) : FALSE;
2094
-		if ( ! $EVT_ID ) {
2093
+		$EVT_ID = ( ! empty($this->_req_data['event_id'])) ? absint($this->_req_data['event_id']) : FALSE;
2094
+		if ( ! $EVT_ID) {
2095 2095
 			return FALSE;
2096 2096
 		}
2097 2097
 
@@ -2112,62 +2112,62 @@  discard block
 block discarded – undo
2112 2112
 	public function process_reg_step() {
2113 2113
 
2114 2114
 		$this->_set_reg_event();
2115
-		EE_Registry::instance()->REQ->set_espresso_page( TRUE );
2115
+		EE_Registry::instance()->REQ->set_espresso_page(TRUE);
2116 2116
 
2117 2117
 		//what step are we on?
2118
-		$cart = EE_Registry::instance()->SSN->get_session_data( 'cart' );
2119
-		$step = empty( $cart ) ? 'ticket' : 'questions';
2118
+		$cart = EE_Registry::instance()->SSN->get_session_data('cart');
2119
+		$step = empty($cart) ? 'ticket' : 'questions';
2120 2120
 
2121 2121
 		//if doing ajax then we need to verify the nonce
2122
-		if ( 'DOING_AJAX' ) {
2123
-			$nonce = isset( $this->_req_data[$this->_req_nonce] ) ? sanitize_text_field( $this->_req_data[$this->_req_nonce] ) : '';
2124
-			$this->_verify_nonce( $nonce, $this->_req_nonce );
2122
+		if ('DOING_AJAX') {
2123
+			$nonce = isset($this->_req_data[$this->_req_nonce]) ? sanitize_text_field($this->_req_data[$this->_req_nonce]) : '';
2124
+			$this->_verify_nonce($nonce, $this->_req_nonce);
2125 2125
 		}
2126 2126
 
2127
-		switch ( $step ) {
2127
+		switch ($step) {
2128 2128
 			case 'ticket' :
2129 2129
 				//process ticket selection
2130 2130
 				$success = EED_Ticket_Selector::instance()->process_ticket_selections();
2131
-				if ( $success ) {
2132
-					EE_Error::add_success( __('Tickets Selected. Now complete the registration.'), 'event_espresso');
2131
+				if ($success) {
2132
+					EE_Error::add_success(__('Tickets Selected. Now complete the registration.'), 'event_espresso');
2133 2133
 				} else {
2134 2134
 					$query_args['step_error'] = $this->_req_data['step_error'] = TRUE;
2135 2135
 				}
2136
-				if ( defined('DOING_AJAX') ) {
2136
+				if (defined('DOING_AJAX')) {
2137 2137
 					$this->new_registration(); //display next step
2138 2138
 				} else {
2139 2139
 					$query_args['action'] = 'new_registration';
2140 2140
 					$query_args['processing_registration'] = true;
2141 2141
 					$query_args['event_id'] = $this->_reg_event->ID();
2142
-					$this->_redirect_after_action( FALSE, '', '', $query_args, TRUE );
2142
+					$this->_redirect_after_action(FALSE, '', '', $query_args, TRUE);
2143 2143
 				}
2144 2144
 				break;
2145 2145
 			case 'questions' :
2146
-				if( ! isset( $this->_req_data[ 'txn_reg_status_change' ], $this->_req_data[ 'txn_reg_status_change' ][ 'send_notifications' ] ) ) {
2147
-					add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_false', 15 );
2146
+				if ( ! isset($this->_req_data['txn_reg_status_change'], $this->_req_data['txn_reg_status_change']['send_notifications'])) {
2147
+					add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_false', 15);
2148 2148
 				}
2149 2149
 				//process registration
2150 2150
 				$transaction = EED_Single_Page_Checkout::instance()->process_registration_from_admin();
2151
-				if ( ! $transaction instanceof EE_Transaction ) {
2151
+				if ( ! $transaction instanceof EE_Transaction) {
2152 2152
 					$query_args = array(
2153 2153
 						'action' => 'new_registration',
2154 2154
 						'processing_registration' => true,
2155 2155
 						'event_id' => $this->_reg_event->ID()
2156 2156
 					);
2157 2157
 
2158
-					if ( defined('DOING_AJAX' )) {
2158
+					if (defined('DOING_AJAX')) {
2159 2159
 						//display registration form again because there are errors (maybe validation?)
2160 2160
 						$this->new_registration();
2161 2161
 						return;
2162 2162
 					} else {
2163
-						$this->_redirect_after_action( FALSE, '', '', $query_args, TRUE );
2163
+						$this->_redirect_after_action(FALSE, '', '', $query_args, TRUE);
2164 2164
 						return;
2165 2165
 					}
2166 2166
 				}
2167 2167
 				/** @type EE_Transaction_Payments $transaction_payments */
2168
-				$transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' );
2168
+				$transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments');
2169 2169
 				// maybe update status, and make sure to save transaction if not done already
2170
-				if ( ! $transaction_payments->update_transaction_status_based_on_total_paid( $transaction )) {
2170
+				if ( ! $transaction_payments->update_transaction_status_based_on_total_paid($transaction)) {
2171 2171
 					$transaction->save();
2172 2172
 				}
2173 2173
 				$query_args = array(
@@ -2175,8 +2175,8 @@  discard block
 block discarded – undo
2175 2175
 					'TXN_ID' => $transaction->ID(),
2176 2176
 					'page' => 'espresso_transactions'
2177 2177
 				);
2178
-				EE_Error::add_success( __('Registration Created.  Please review the transaction and add any payments as necessary', 'event_espresso') );
2179
-				$this->_redirect_after_action( FALSE, '', '', $query_args, TRUE );
2178
+				EE_Error::add_success(__('Registration Created.  Please review the transaction and add any payments as necessary', 'event_espresso'));
2179
+				$this->_redirect_after_action(FALSE, '', '', $query_args, TRUE);
2180 2180
 				break;
2181 2181
 			}
2182 2182
 
@@ -2196,7 +2196,7 @@  discard block
 block discarded – undo
2196 2196
 	*		@return void
2197 2197
 	*/
2198 2198
 	protected function _attendee_contact_list_table() {
2199
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
2199
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2200 2200
 		$this->_search_btn_label = __('Contacts', 'event_espresso');
2201 2201
 		$this->display_admin_list_table_page_with_no_sidebar();
2202 2202
 	}
@@ -2211,10 +2211,10 @@  discard block
 block discarded – undo
2211 2211
 	*		@access public
2212 2212
 	*		@return array
2213 2213
 	*/
2214
-	public function get_attendees( $per_page, $count = FALSE, $trash = FALSE ) {
2214
+	public function get_attendees($per_page, $count = FALSE, $trash = FALSE) {
2215 2215
 
2216
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
2217
-		require_once( REG_ADMIN . 'EE_Attendee_Contact_List_Table.class.php' );
2216
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2217
+		require_once(REG_ADMIN.'EE_Attendee_Contact_List_Table.class.php');
2218 2218
 		$ATT_MDL = EEM_Attendee::instance();
2219 2219
 
2220 2220
 		$this->_req_data['orderby'] = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : '';
@@ -2242,47 +2242,47 @@  discard block
 block discarded – undo
2242 2242
 				$orderby = 'ATT_lname';
2243 2243
 		}
2244 2244
 
2245
-		$sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'ASC';
2245
+		$sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'ASC';
2246 2246
 
2247
-		$current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1;
2248
-		$per_page = isset( $per_page ) && !empty( $per_page ) ? $per_page : 10;
2249
-		$per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page;
2247
+		$current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1;
2248
+		$per_page = isset($per_page) && ! empty($per_page) ? $per_page : 10;
2249
+		$per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page;
2250 2250
 
2251 2251
 		$_where = array();
2252 2252
 
2253
-		if ( isset( $this->_req_data['s'] ) ) {
2254
-			$sstr = '%' . $this->_req_data['s'] . '%';
2253
+		if (isset($this->_req_data['s'])) {
2254
+			$sstr = '%'.$this->_req_data['s'].'%';
2255 2255
 			$_where['OR'] = array(
2256
-				'Registration.Event.EVT_name' => array( 'LIKE', $sstr),
2257
-				'Registration.Event.EVT_desc' => array( 'LIKE', $sstr ),
2258
-				'Registration.Event.EVT_short_desc' => array( 'LIKE' , $sstr ),
2259
-				'ATT_fname' => array( 'LIKE', $sstr ),
2260
-				'ATT_lname' => array( 'LIKE', $sstr ),
2261
-				'ATT_short_bio' => array( 'LIKE', $sstr ),
2262
-				'ATT_email' => array('LIKE', $sstr ),
2263
-				'ATT_address' => array( 'LIKE', $sstr ),
2264
-				'ATT_address2' => array( 'LIKE', $sstr ),
2265
-				'ATT_city' => array( 'LIKE', $sstr ),
2266
-				'Country.CNT_name' => array( 'LIKE', $sstr ),
2267
-				'State.STA_name' => array('LIKE', $sstr ),
2268
-				'ATT_phone' => array( 'LIKE', $sstr ),
2269
-				'Registration.REG_final_price' => array( 'LIKE', $sstr ),
2270
-				'Registration.REG_code' => array( 'LIKE', $sstr ),
2271
-				'Registration.REG_count' => array( 'LIKE' , $sstr ),
2272
-				'Registration.REG_group_size' => array( 'LIKE' , $sstr )
2256
+				'Registration.Event.EVT_name' => array('LIKE', $sstr),
2257
+				'Registration.Event.EVT_desc' => array('LIKE', $sstr),
2258
+				'Registration.Event.EVT_short_desc' => array('LIKE', $sstr),
2259
+				'ATT_fname' => array('LIKE', $sstr),
2260
+				'ATT_lname' => array('LIKE', $sstr),
2261
+				'ATT_short_bio' => array('LIKE', $sstr),
2262
+				'ATT_email' => array('LIKE', $sstr),
2263
+				'ATT_address' => array('LIKE', $sstr),
2264
+				'ATT_address2' => array('LIKE', $sstr),
2265
+				'ATT_city' => array('LIKE', $sstr),
2266
+				'Country.CNT_name' => array('LIKE', $sstr),
2267
+				'State.STA_name' => array('LIKE', $sstr),
2268
+				'ATT_phone' => array('LIKE', $sstr),
2269
+				'Registration.REG_final_price' => array('LIKE', $sstr),
2270
+				'Registration.REG_code' => array('LIKE', $sstr),
2271
+				'Registration.REG_count' => array('LIKE', $sstr),
2272
+				'Registration.REG_group_size' => array('LIKE', $sstr)
2273 2273
 				);
2274 2274
 		}
2275 2275
 
2276 2276
 
2277
-		$offset = ($current_page-1)*$per_page;
2278
-		$limit = $count ? NULL : array( $offset, $per_page );
2277
+		$offset = ($current_page - 1) * $per_page;
2278
+		$limit = $count ? NULL : array($offset, $per_page);
2279 2279
 
2280
-		if ( $trash ) {
2281
-			$_where['status'] = array( '!=', 'publish' );
2282
-			$all_attendees = $count ? $ATT_MDL->count( array($_where,'order_by'=>array($orderby=>$sort), 'limit'=>$limit)): $ATT_MDL->get_all( array($_where,'order_by'=>array($orderby=>$sort), 'limit'=>$limit));
2280
+		if ($trash) {
2281
+			$_where['status'] = array('!=', 'publish');
2282
+			$all_attendees = $count ? $ATT_MDL->count(array($_where, 'order_by'=>array($orderby=>$sort), 'limit'=>$limit)) : $ATT_MDL->get_all(array($_where, 'order_by'=>array($orderby=>$sort), 'limit'=>$limit));
2283 2283
 		} else {
2284
-			$_where['status'] = array( 'IN', array( 'publish' ) );
2285
-			$all_attendees = $count ? $ATT_MDL->count( array($_where, 'order_by'=>array($orderby=>$sort),'limit'=>$limit)) : $ATT_MDL->get_all( array($_where, 'order_by'=>array($orderby=>$sort), 'limit'=>$limit) );
2284
+			$_where['status'] = array('IN', array('publish'));
2285
+			$all_attendees = $count ? $ATT_MDL->count(array($_where, 'order_by'=>array($orderby=>$sort), 'limit'=>$limit)) : $ATT_MDL->get_all(array($_where, 'order_by'=>array($orderby=>$sort), 'limit'=>$limit));
2286 2286
 		}
2287 2287
 
2288 2288
 		return $all_attendees;
@@ -2299,10 +2299,10 @@  discard block
 block discarded – undo
2299 2299
 	 */
2300 2300
 	protected function _resend_registration() {
2301 2301
 		$this->_process_resend_registration();
2302
-		$query_args = isset($this->_req_data['redirect_to'] ) ? array('action' => $this->_req_data['redirect_to'], '_REG_ID' => $this->_req_data['_REG_ID'] ) : array(
2302
+		$query_args = isset($this->_req_data['redirect_to']) ? array('action' => $this->_req_data['redirect_to'], '_REG_ID' => $this->_req_data['_REG_ID']) : array(
2303 2303
 			'action' => 'default'
2304 2304
 		);
2305
-		$this->_redirect_after_action(FALSE, '', '', $query_args, TRUE );
2305
+		$this->_redirect_after_action(FALSE, '', '', $query_args, TRUE);
2306 2306
 	}
2307 2307
 
2308 2308
 
@@ -2310,17 +2310,17 @@  discard block
 block discarded – undo
2310 2310
 
2311 2311
 
2312 2312
 
2313
-	public function _registrations_report(){
2314
-		EE_Registry::instance()->load_helper( 'File' );
2313
+	public function _registrations_report() {
2314
+		EE_Registry::instance()->load_helper('File');
2315 2315
 		$new_request_args = array(
2316 2316
 			'export' => 'report',
2317 2317
 			'action' => 'registrations_report_for_event',
2318
-			'EVT_ID' => isset( $this->_req_data[ 'EVT_ID'] ) ? $this->_req_data[ 'EVT_ID' ] : NULL,
2318
+			'EVT_ID' => isset($this->_req_data['EVT_ID']) ? $this->_req_data['EVT_ID'] : NULL,
2319 2319
 		);
2320 2320
 		$this->_req_data = array_merge($this->_req_data, $new_request_args);
2321 2321
 
2322
-		if ( is_readable(EE_CLASSES . 'EE_Export.class.php')) {
2323
-			require_once(EE_CLASSES . 'EE_Export.class.php');
2322
+		if (is_readable(EE_CLASSES.'EE_Export.class.php')) {
2323
+			require_once(EE_CLASSES.'EE_Export.class.php');
2324 2324
 			$EE_Export = EE_Export::instance($this->_req_data);
2325 2325
 			$EE_Export->export();
2326 2326
 		}
@@ -2328,19 +2328,19 @@  discard block
 block discarded – undo
2328 2328
 
2329 2329
 
2330 2330
 
2331
-	public function _contact_list_export(){
2332
-		EE_Registry::instance()->load_helper( 'File' );
2333
-		if ( is_readable(EE_CLASSES . 'EE_Export.class.php')) {
2334
-			require_once(EE_CLASSES . 'EE_Export.class.php');
2331
+	public function _contact_list_export() {
2332
+		EE_Registry::instance()->load_helper('File');
2333
+		if (is_readable(EE_CLASSES.'EE_Export.class.php')) {
2334
+			require_once(EE_CLASSES.'EE_Export.class.php');
2335 2335
 			$EE_Export = EE_Export::instance($this->_req_data);
2336 2336
 			$EE_Export->export_attendees();
2337 2337
 		}
2338 2338
 	}
2339 2339
 
2340
-	public function _contact_list_report(){
2341
-		EE_Registry::instance()->load_helper( 'File' );
2342
-		if ( is_readable(EE_CLASSES . 'EE_Export.class.php')) {
2343
-			require_once(EE_CLASSES . 'EE_Export.class.php');
2340
+	public function _contact_list_report() {
2341
+		EE_Registry::instance()->load_helper('File');
2342
+		if (is_readable(EE_CLASSES.'EE_Export.class.php')) {
2343
+			require_once(EE_CLASSES.'EE_Export.class.php');
2344 2344
 			$EE_Export = EE_Export::instance($this->_req_data);
2345 2345
 			$EE_Export->report_attendees();
2346 2346
 		}
@@ -2359,73 +2359,73 @@  discard block
 block discarded – undo
2359 2359
 	 * @return void
2360 2360
 	 */
2361 2361
 	protected function _duplicate_attendee() {
2362
-		$action = !empty( $this->_req_data['return'] ) ? $this->_req_data['return'] : 'default';
2362
+		$action = ! empty($this->_req_data['return']) ? $this->_req_data['return'] : 'default';
2363 2363
 		//verify we have necessary info
2364
-		if ( empty($this->_req_data['_REG_ID'] )  ) {
2365
-			EE_Error::add_error( __('Unable to create the contact for the registration because the required paramaters are not present (_REG_ID )', 'event_espresso'),  __FILE__, __LINE__, __FUNCTION__ );
2366
-			$query_args = array( 'action' => $action );
2364
+		if (empty($this->_req_data['_REG_ID'])) {
2365
+			EE_Error::add_error(__('Unable to create the contact for the registration because the required paramaters are not present (_REG_ID )', 'event_espresso'), __FILE__, __LINE__, __FUNCTION__);
2366
+			$query_args = array('action' => $action);
2367 2367
 			$this->_redirect_after_action('', '', '', $query_args, TRUE);
2368 2368
 		}
2369 2369
 
2370 2370
 		//okay necessary deets present... let's dupe the incoming attendee and attach to incoming registration.
2371
-		$registration = EEM_Registration::instance()->get_one_by_ID( $this->_req_data['_REG_ID'] );
2371
+		$registration = EEM_Registration::instance()->get_one_by_ID($this->_req_data['_REG_ID']);
2372 2372
 		$attendee = $registration->attendee();
2373 2373
 
2374 2374
 		//remove relation of existing attendee on registration
2375
-		$registration->_remove_relation_to($attendee, 'Attendee' );
2375
+		$registration->_remove_relation_to($attendee, 'Attendee');
2376 2376
 		//new attendee
2377 2377
 		$new_attendee = clone $attendee;
2378
-		$new_attendee->set( 'ATT_ID', 0 );
2378
+		$new_attendee->set('ATT_ID', 0);
2379 2379
 		$new_attendee->save();
2380 2380
 
2381 2381
 		//add new attendee to reg
2382
-		$registration->_add_relation_to( $new_attendee, 'Attendee');
2382
+		$registration->_add_relation_to($new_attendee, 'Attendee');
2383 2383
 
2384
-		EE_Error::add_success( __('New Contact record created.  Now make any edits you wish to make for this contact.', 'event_espresso') );
2384
+		EE_Error::add_success(__('New Contact record created.  Now make any edits you wish to make for this contact.', 'event_espresso'));
2385 2385
 
2386 2386
 		//redirect to edit page for attendee
2387
-		$query_args = array( 'post' => $new_attendee->ID(), 'action' => 'edit_attendee' );
2387
+		$query_args = array('post' => $new_attendee->ID(), 'action' => 'edit_attendee');
2388 2388
 
2389
-		$this->_redirect_after_action( '', '', '', $query_args, TRUE );
2389
+		$this->_redirect_after_action('', '', '', $query_args, TRUE);
2390 2390
 	}
2391 2391
 
2392 2392
 
2393 2393
 	//related to cpt routes
2394 2394
 	protected function _insert_update_cpt_item($post_id, $post) {
2395 2395
 		$success = true;
2396
-		$attendee = EEM_Attendee::instance()->get_one_by_ID( $post_id );
2396
+		$attendee = EEM_Attendee::instance()->get_one_by_ID($post_id);
2397 2397
 		//for attendee updates
2398
-		if ( $post->post_type = 'espresso_attendees' && !empty( $attendee ) ) {
2398
+		if ($post->post_type = 'espresso_attendees' && ! empty($attendee)) {
2399 2399
 			//note we should only be UPDATING attendees at this point.
2400 2400
 			$updated_fields = array(
2401 2401
 				'ATT_fname' => $this->_req_data['ATT_fname'],
2402 2402
 				'ATT_lname' => $this->_req_data['ATT_lname'],
2403
-				'ATT_full_name'=> $this->_req_data['ATT_fname'] . ' ' . $this->_req_data['ATT_lname'],
2403
+				'ATT_full_name'=> $this->_req_data['ATT_fname'].' '.$this->_req_data['ATT_lname'],
2404 2404
 				'ATT_address' => isset($this->_req_data['ATT_address']) ? $this->_req_data['ATT_address'] : '',
2405 2405
 				'ATT_address2' => isset($this->_req_data['ATT_address2']) ? $this->_req_data['ATT_address2'] : '',
2406
-				'ATT_city' => isset( $this->_req_data['ATT_city'] ) ? $this->_req_data['ATT_city'] : '',
2407
-				'STA_ID' => isset( $this->_req_data['STA_ID'] ) ? $this->_req_data['STA_ID'] : '',
2408
-				'CNT_ISO' => isset( $this->_req_data['CNT_ISO'] ) ? $this->_req_data['CNT_ISO'] : '',
2409
-				'ATT_zip' => isset( $this->_req_data['ATT_zip'] ) ? $this->_req_data['ATT_zip'] : '',
2410
-				'ATT_email' => isset( $this->_req_data['ATT_email'] ) ? $this->_req_data['ATT_email'] : '',
2411
-				'ATT_phone' => isset( $this->_req_data['ATT_phone'] ) ? $this->_req_data['ATT_phone'] : ''
2406
+				'ATT_city' => isset($this->_req_data['ATT_city']) ? $this->_req_data['ATT_city'] : '',
2407
+				'STA_ID' => isset($this->_req_data['STA_ID']) ? $this->_req_data['STA_ID'] : '',
2408
+				'CNT_ISO' => isset($this->_req_data['CNT_ISO']) ? $this->_req_data['CNT_ISO'] : '',
2409
+				'ATT_zip' => isset($this->_req_data['ATT_zip']) ? $this->_req_data['ATT_zip'] : '',
2410
+				'ATT_email' => isset($this->_req_data['ATT_email']) ? $this->_req_data['ATT_email'] : '',
2411
+				'ATT_phone' => isset($this->_req_data['ATT_phone']) ? $this->_req_data['ATT_phone'] : ''
2412 2412
 				);
2413
-			foreach ( $updated_fields as $field => $value ) {
2413
+			foreach ($updated_fields as $field => $value) {
2414 2414
 				$attendee->set($field, $value);
2415 2415
 			}
2416 2416
 
2417 2417
 			$success = $attendee->save();
2418 2418
 
2419
-			$attendee_update_callbacks = apply_filters( 'FHEE__Registrations_Admin_Page__insert_update_cpt_item__attendee_update', array() );
2420
-			foreach ( $attendee_update_callbacks as $a_callback ) {
2421
-				if ( FALSE === call_user_func_array( $a_callback, array($attendee, $this->_req_data ) ) ) {
2422
-					throw new EE_Error( sprintf( __('The %s callback given for the "FHEE__Registrations_Admin_Page__insert_update_cpt_item__attendee_update" filter is not a valid callback.  Please check the spelling.', 'event_espresso'), $a_callback ) );
2419
+			$attendee_update_callbacks = apply_filters('FHEE__Registrations_Admin_Page__insert_update_cpt_item__attendee_update', array());
2420
+			foreach ($attendee_update_callbacks as $a_callback) {
2421
+				if (FALSE === call_user_func_array($a_callback, array($attendee, $this->_req_data))) {
2422
+					throw new EE_Error(sprintf(__('The %s callback given for the "FHEE__Registrations_Admin_Page__insert_update_cpt_item__attendee_update" filter is not a valid callback.  Please check the spelling.', 'event_espresso'), $a_callback));
2423 2423
 				}
2424 2424
 			}
2425 2425
 		}
2426 2426
 
2427
-		if ( $success === FALSE )
2428
-			EE_Error::add_error(__('Something went wrong with updating the meta table data for the registration.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
2427
+		if ($success === FALSE)
2428
+			EE_Error::add_error(__('Something went wrong with updating the meta table data for the registration.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
2429 2429
 
2430 2430
 	}
2431 2431
 
@@ -2445,17 +2445,17 @@  discard block
 block discarded – undo
2445 2445
 		remove_meta_box('postexcerpt', __('Excerpt'), 'post_excerpt_meta_box', $this->_cpt_routes[$this->_req_action], 'normal', 'core');
2446 2446
 		remove_meta_box('commentstatusdiv', $this->_cpt_routes[$this->_req_action], 'normal', 'core');
2447 2447
 
2448
-		if ( post_type_supports( 'espresso_attendees', 'excerpt') ) {
2449
-			add_meta_box('postexcerpt', __('Short Biography', 'event_espresso'), 'post_excerpt_meta_box', $this->_cpt_routes[$this->_req_action], 'normal' );
2448
+		if (post_type_supports('espresso_attendees', 'excerpt')) {
2449
+			add_meta_box('postexcerpt', __('Short Biography', 'event_espresso'), 'post_excerpt_meta_box', $this->_cpt_routes[$this->_req_action], 'normal');
2450 2450
 		}
2451 2451
 
2452
-		if ( post_type_supports( 'espresso_attendees', 'comments') ) {
2452
+		if (post_type_supports('espresso_attendees', 'comments')) {
2453 2453
 			add_meta_box('commentsdiv', __('Notes on the Contact', 'event_espresso'), 'post_comment_meta_box', $this->_cpt_routes[$this->_req_action], 'normal', 'core');
2454 2454
 		}
2455 2455
 
2456
-		add_meta_box('attendee_contact_info', __('Contact Info', 'event_espresso'), array( $this, 'attendee_contact_info'), $this->_cpt_routes[$this->_req_action], 'side', 'core' );
2457
-		add_meta_box('attendee_details_address', __('Address Details', 'event_espresso'), array($this, 'attendee_address_details'), $this->_cpt_routes[$this->_req_action], 'normal', 'core' );
2458
-		add_meta_box('attendee_registrations', __('Registrations for this Contact', 'event_espresso'), array( $this, 'attendee_registrations_meta_box'), $this->_cpt_routes[$this->_req_action], 'normal', 'high');
2456
+		add_meta_box('attendee_contact_info', __('Contact Info', 'event_espresso'), array($this, 'attendee_contact_info'), $this->_cpt_routes[$this->_req_action], 'side', 'core');
2457
+		add_meta_box('attendee_details_address', __('Address Details', 'event_espresso'), array($this, 'attendee_address_details'), $this->_cpt_routes[$this->_req_action], 'normal', 'core');
2458
+		add_meta_box('attendee_registrations', __('Registrations for this Contact', 'event_espresso'), array($this, 'attendee_registrations_meta_box'), $this->_cpt_routes[$this->_req_action], 'normal', 'high');
2459 2459
 	}
2460 2460
 
2461 2461
 
@@ -2464,10 +2464,10 @@  discard block
 block discarded – undo
2464 2464
 	 * @param  WP_Post $post wp post object
2465 2465
 	 * @return string        attendee contact info ( and form )
2466 2466
 	 */
2467
-	public function attendee_contact_info( $post ) {
2467
+	public function attendee_contact_info($post) {
2468 2468
 		//get attendee object ( should already have it )
2469 2469
 		$this->_template_args['attendee'] = $this->_cpt_model_obj;
2470
-		$template = REG_TEMPLATE_PATH . 'attendee_contact_info_metabox_content.template.php';
2470
+		$template = REG_TEMPLATE_PATH.'attendee_contact_info_metabox_content.template.php';
2471 2471
 		EEH_Template::display_template($template, $this->_template_args);
2472 2472
 	}
2473 2473
 
@@ -2483,12 +2483,12 @@  discard block
 block discarded – undo
2483 2483
 		$this->_template_args['attendee'] = $this->_cpt_model_obj;
2484 2484
 		$this->_template_args['state_html'] = EEH_Form_Fields::generate_form_input(
2485 2485
 				new EE_Question_Form_Input(
2486
-				EE_Question::new_instance( array(
2486
+				EE_Question::new_instance(array(
2487 2487
 					'QST_ID' => 0,
2488 2488
 					'QST_display_text' => __('State/Province', 'event_espresso'),
2489 2489
 					'QST_system' => 'admin-state'
2490 2490
 					)),
2491
-				EE_Answer::new_instance( array(
2491
+				EE_Answer::new_instance(array(
2492 2492
 					'ANS_ID' => 0,
2493 2493
 					'ANS_value' => $this->_cpt_model_obj->state_ID()
2494 2494
 					)),
@@ -2501,12 +2501,12 @@  discard block
 block discarded – undo
2501 2501
 			));
2502 2502
 		$this->_template_args['country_html'] = EEH_Form_Fields::generate_form_input(
2503 2503
 				new EE_Question_Form_Input(
2504
-				EE_Question::new_instance( array(
2504
+				EE_Question::new_instance(array(
2505 2505
 					'QST_ID' => 0,
2506 2506
 					'QST_display_text' => __('Country', 'event_espresso'),
2507 2507
 					'QST_system' => 'admin-country'
2508 2508
 					)),
2509
-				EE_Answer::new_instance( array(
2509
+				EE_Answer::new_instance(array(
2510 2510
 					'ANS_ID' => 0,
2511 2511
 					'ANS_value' => $this->_cpt_model_obj->country_ID()
2512 2512
 					)),
@@ -2517,8 +2517,8 @@  discard block
 block discarded – undo
2517 2517
 					'append_qstn_id' => FALSE
2518 2518
 					)
2519 2519
 				));
2520
-		$template = REG_TEMPLATE_PATH . 'attendee_address_details_metabox_content.template.php';
2521
-		EEH_Template::display_template($template, $this->_template_args );
2520
+		$template = REG_TEMPLATE_PATH.'attendee_address_details_metabox_content.template.php';
2521
+		EEH_Template::display_template($template, $this->_template_args);
2522 2522
 
2523 2523
 	}
2524 2524
 
@@ -2528,11 +2528,11 @@  discard block
 block discarded – undo
2528 2528
 	*		@access protected
2529 2529
 	*		@return void
2530 2530
 	*/
2531
-	public function attendee_registrations_meta_box( $post ) {
2531
+	public function attendee_registrations_meta_box($post) {
2532 2532
 
2533 2533
 		$this->_template_args['attendee'] = $this->_cpt_model_obj;
2534 2534
 		$this->_template_args['registrations'] = $this->_cpt_model_obj->get_many_related('Registration');
2535
-		$template = REG_TEMPLATE_PATH . 'attendee_registrations_main_meta_box.template.php';
2535
+		$template = REG_TEMPLATE_PATH.'attendee_registrations_main_meta_box.template.php';
2536 2536
 		EEH_Template::display_template($template, $this->_template_args);
2537 2537
 
2538 2538
 	}
@@ -2546,8 +2546,8 @@  discard block
 block discarded – undo
2546 2546
 	 * @return string        html for new form.
2547 2547
 	 */
2548 2548
 	public function after_title_form_fields($post) {
2549
-		if ( $post->post_type == 'espresso_attendees' ) {
2550
-			$template = REG_TEMPLATE_PATH . 'attendee_details_after_title_form_fields.template.php';
2549
+		if ($post->post_type == 'espresso_attendees') {
2550
+			$template = REG_TEMPLATE_PATH.'attendee_details_after_title_form_fields.template.php';
2551 2551
 			$template_args['attendee'] = $this->_cpt_model_obj;
2552 2552
 			EEH_Template::display_template($template, $template_args);
2553 2553
 		}
@@ -2564,21 +2564,21 @@  discard block
 block discarded – undo
2564 2564
 	*		@access protected
2565 2565
 	*		@return void
2566 2566
 	*/
2567
-	protected function _trash_or_restore_attendees( $trash = TRUE ) {
2567
+	protected function _trash_or_restore_attendees($trash = TRUE) {
2568 2568
 
2569
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
2569
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2570 2570
 
2571 2571
 		$ATT_MDL = EEM_Attendee::instance();
2572 2572
 
2573 2573
 		$success = 1;
2574 2574
 		//Checkboxes
2575
-		if (!empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
2575
+		if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
2576 2576
 			// if array has more than one element than success message should be plural
2577
-			$success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1;
2577
+			$success = count($this->_req_data['checkbox']) > 1 ? 2 : 1;
2578 2578
 			// cycle thru checkboxes
2579
-			while (list( $ATT_ID, $value ) = each($this->_req_data['checkbox'])) {
2580
-				$updated = $trash ? $ATT_MDL->update_by_ID(array( 'status' => 'trash' ), $ATT_ID) : $ATT_MDL->update_by_ID( array('status' => 'publish' ), $ATT_ID);
2581
-				if ( !$updated ) {
2579
+			while (list($ATT_ID, $value) = each($this->_req_data['checkbox'])) {
2580
+				$updated = $trash ? $ATT_MDL->update_by_ID(array('status' => 'trash'), $ATT_ID) : $ATT_MDL->update_by_ID(array('status' => 'publish'), $ATT_ID);
2581
+				if ( ! $updated) {
2582 2582
 					$success = 0;
2583 2583
 				}
2584 2584
 			}
@@ -2587,18 +2587,18 @@  discard block
 block discarded – undo
2587 2587
 			// grab single id and delete
2588 2588
 			$ATT_ID = absint($this->_req_data['ATT_ID']);
2589 2589
 			//get attendee
2590
-			$att = $ATT_MDL->get_one_by_ID( $ATT_ID );
2590
+			$att = $ATT_MDL->get_one_by_ID($ATT_ID);
2591 2591
 			$updated = $trash ? $att->set_status('trash') : $att->set_status('publish');
2592 2592
 			$updated = $att->save();
2593
-			if ( ! $updated ) {
2593
+			if ( ! $updated) {
2594 2594
 				$success = 0;
2595 2595
 			}
2596 2596
 
2597 2597
 		}
2598 2598
 
2599
-		$what = $success > 1 ? __( 'Contacts', 'event_espresso' ) : __( 'Contact', 'event_espresso' );
2600
-		$action_desc = $trash ? __( 'moved to the trash', 'event_espresso' ) : __( 'restored', 'event_espresso' );
2601
-		$this->_redirect_after_action( $success, $what, $action_desc, array( 'action' => 'contact_list' ) );
2599
+		$what = $success > 1 ? __('Contacts', 'event_espresso') : __('Contact', 'event_espresso');
2600
+		$action_desc = $trash ? __('moved to the trash', 'event_espresso') : __('restored', 'event_espresso');
2601
+		$this->_redirect_after_action($success, $what, $action_desc, array('action' => 'contact_list'));
2602 2602
 
2603 2603
 	}
2604 2604
 
Please login to merge, or discard this patch.
core/EE_Log.core.php 2 patches
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -1,18 +1,18 @@
 block discarded – undo
1 1
 <?php if (!defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
2 2
 /**
3
- *
4
- * Class EE_Log
5
- *
6
- * Singleton logging class. Can be called from anywhere in the plugin to log data to a log file.
7
- * Defaults to wp-content/uploads/espresso/logs/espresso_log.txt
8
- * Usage:
9
- * do_action( 'AHEE_log', __FILE__, __FUNCTION__, 'logging message' );
10
- *
11
- * @package 			Event Espresso
12
- * @subpackage 	core
13
- * @author 				Sidney Harrel, Brent Christensen
14
- *
15
- */
3
+	 *
4
+	 * Class EE_Log
5
+	 *
6
+	 * Singleton logging class. Can be called from anywhere in the plugin to log data to a log file.
7
+	 * Defaults to wp-content/uploads/espresso/logs/espresso_log.txt
8
+	 * Usage:
9
+	 * do_action( 'AHEE_log', __FILE__, __FUNCTION__, 'logging message' );
10
+	 *
11
+	 * @package 			Event Espresso
12
+	 * @subpackage 	core
13
+	 * @author 				Sidney Harrel, Brent Christensen
14
+	 *
15
+	 */
16 16
 class EE_Log {
17 17
 
18 18
 	/**
Please login to merge, or discard this patch.
Spacing   +56 added lines, -56 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@  discard block
 block discarded – undo
1
-<?php if (!defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
2 2
 /**
3 3
  *
4 4
  * Class EE_Log
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 	 * @return EE_Log
63 63
 	 */
64 64
 	public static function instance() {
65
-		if ( ! self::$_instance instanceof EE_Log ) {
65
+		if ( ! self::$_instance instanceof EE_Log) {
66 66
 			self::$_instance = new self();
67 67
 		}
68 68
 		return self::$_instance;
@@ -74,11 +74,11 @@  discard block
 block discarded – undo
74 74
 	 */
75 75
 	private function __construct() {
76 76
 
77
-		if ( ! EE_Registry::instance()->CFG->admin->use_full_logging && ! EE_Registry::instance()->CFG->admin->use_remote_logging ) {
77
+		if ( ! EE_Registry::instance()->CFG->admin->use_full_logging && ! EE_Registry::instance()->CFG->admin->use_remote_logging) {
78 78
 			return;
79 79
 		}
80 80
 
81
-		$this->_logs_folder = EVENT_ESPRESSO_UPLOAD_DIR . 'logs' . DS;
81
+		$this->_logs_folder = EVENT_ESPRESSO_UPLOAD_DIR.'logs'.DS;
82 82
 		$this->_log_file = EE_Registry::instance()->CFG->admin->log_file_name();
83 83
 		$this->_log = '';
84 84
 		$this->_debug_file = EE_Registry::instance()->CFG->admin->debug_file_name();
@@ -86,15 +86,15 @@  discard block
 block discarded – undo
86 86
 		$this->_remote_logging_url = EE_Registry::instance()->CFG->admin->remote_logging_url;
87 87
 		$this->_remote_log = '';
88 88
 
89
-		add_action( 'admin_init', array( $this, 'verify_filesystem' ), -10 );
90
-		add_action( 'AHEE_log', array( $this, 'log' ), 10, 4 );
91
-		if ( EE_Registry::instance()->CFG->admin->use_full_logging ) {
92
-			add_action( 'shutdown', array( $this, 'write_log' ), 9999 );
89
+		add_action('admin_init', array($this, 'verify_filesystem'), -10);
90
+		add_action('AHEE_log', array($this, 'log'), 10, 4);
91
+		if (EE_Registry::instance()->CFG->admin->use_full_logging) {
92
+			add_action('shutdown', array($this, 'write_log'), 9999);
93 93
 			// if WP_DEBUG
94
-			add_action( 'shutdown', array( $this, 'write_debug' ), 9999 );
94
+			add_action('shutdown', array($this, 'write_debug'), 9999);
95 95
 		}
96
-		if ( EE_Registry::instance()->CFG->admin->use_remote_logging ) {
97
-			add_action( 'shutdown', array( $this, 'send_log' ), 9999 );
96
+		if (EE_Registry::instance()->CFG->admin->use_remote_logging) {
97
+			add_action('shutdown', array($this, 'send_log'), 9999);
98 98
 		}
99 99
 
100 100
 	}
@@ -108,11 +108,11 @@  discard block
 block discarded – undo
108 108
 	 */
109 109
 	public function verify_filesystem() {
110 110
 		try {
111
-			EE_Registry::instance()->load_helper( 'File' );
112
-			EEH_File::ensure_file_exists_and_is_writable( $this->_logs_folder . $this->_log_file );
113
-			EEH_File::ensure_file_exists_and_is_writable( $this->_logs_folder . $this->_debug_file );
114
-		} catch( EE_Error $e ){
115
-			EE_Error::add_error( sprintf( __(  'Event Espresso logging could not be setup because: %s', 'event_espresso' ), ' &nbsp; &nbsp; ' . $e->getMessage() ), __FILE__, __FUNCTION__, __LINE__ );
111
+			EE_Registry::instance()->load_helper('File');
112
+			EEH_File::ensure_file_exists_and_is_writable($this->_logs_folder.$this->_log_file);
113
+			EEH_File::ensure_file_exists_and_is_writable($this->_logs_folder.$this->_debug_file);
114
+		} catch (EE_Error $e) {
115
+			EE_Error::add_error(sprintf(__('Event Espresso logging could not be setup because: %s', 'event_espresso'), ' &nbsp; &nbsp; '.$e->getMessage()), __FILE__, __FUNCTION__, __LINE__);
116 116
 			return;
117 117
 		}
118 118
 	}
@@ -129,15 +129,15 @@  discard block
 block discarded – undo
129 129
 	 * @param string $type
130 130
 	 * @return string
131 131
 	 */
132
-	private function _format_message( $file = '', $function = '', $message = '', $type = '' ) {
133
-		$msg = '----------------------------------------------------------------------------------------' . PHP_EOL;
134
-		$msg .= '[' . current_time( 'mysql' ) . '] ';
135
-		$msg .= ! empty( $file ) ? basename( $file ) : '';
136
-		$msg .= ! empty( $file ) && ! empty( $function ) ? ' -> ' : '';
137
-		$msg .= ! empty( $function ) ? $function . '()' : '';
132
+	private function _format_message($file = '', $function = '', $message = '', $type = '') {
133
+		$msg = '----------------------------------------------------------------------------------------'.PHP_EOL;
134
+		$msg .= '['.current_time('mysql').'] ';
135
+		$msg .= ! empty($file) ? basename($file) : '';
136
+		$msg .= ! empty($file) && ! empty($function) ? ' -> ' : '';
137
+		$msg .= ! empty($function) ? $function.'()' : '';
138 138
 		$msg .= PHP_EOL;
139
-		$type = ! empty( $type ) ? $type : 'log message';
140
-		$msg .= ! empty( $message ) ? "\t" . '[' . $type . '] ' . $message . PHP_EOL : '';
139
+		$type = ! empty($type) ? $type : 'log message';
140
+		$msg .= ! empty($message) ? "\t".'['.$type.'] '.$message.PHP_EOL : '';
141 141
 		return $msg;
142 142
 	}
143 143
 
@@ -152,8 +152,8 @@  discard block
 block discarded – undo
152 152
 	 * @param string $message
153 153
 	 * @param string $type
154 154
 	 */
155
-	public function log( $file = '', $function = '', $message = '', $type = '' ) {
156
-		$this->_log .= $this->_format_message( $file, $function, $message, $type );
155
+	public function log($file = '', $function = '', $message = '', $type = '') {
156
+		$this->_log .= $this->_format_message($file, $function, $message, $type);
157 157
 	}
158 158
 
159 159
 
@@ -165,10 +165,10 @@  discard block
 block discarded – undo
165 165
 	public function write_log() {
166 166
 		try {
167 167
 			//get existing log file and append new log info
168
-			$this->_log = EEH_File::get_file_contents( $this->_logs_folder . $this->_log_file ) . $this->_log;
169
-			EEH_File::write_to_file( $this->_logs_folder . $this->_log_file, $this->_log, 'Event Espresso Log' );
170
-		} catch( EE_Error $e ){
171
-			EE_Error::add_error( sprintf( __(  'Could not write to the Event Espresso log file because: %s', 'event_espresso' ), ' &nbsp; &nbsp; ' . $e->getMessage() ), __FILE__, __FUNCTION__, __LINE__ );
168
+			$this->_log = EEH_File::get_file_contents($this->_logs_folder.$this->_log_file).$this->_log;
169
+			EEH_File::write_to_file($this->_logs_folder.$this->_log_file, $this->_log, 'Event Espresso Log');
170
+		} catch (EE_Error $e) {
171
+			EE_Error::add_error(sprintf(__('Could not write to the Event Espresso log file because: %s', 'event_espresso'), ' &nbsp; &nbsp; '.$e->getMessage()), __FILE__, __FUNCTION__, __LINE__);
172 172
 			return;
173 173
 		}
174 174
 	}
@@ -181,31 +181,31 @@  discard block
 block discarded – undo
181 181
 	 */
182 182
 	public function send_log() {
183 183
 
184
-		if ( empty( $this->_remote_logging_url )) {
184
+		if (empty($this->_remote_logging_url)) {
185 185
 			return;
186 186
 		}
187 187
 
188
-		$data = 'domain=' . $_SERVER['HTTP_HOST'];
189
-		$data .= '&ip=' . $_SERVER['SERVER_ADDR'];
190
-		$data .= '&server_type=' . $_SERVER['SERVER_SOFTWARE'];
191
-		$data .= '&time=' . time();
192
-		$data .= '&remote_log=' . $this->_log;
193
-		$data .= '&request_array=' . json_encode( $_REQUEST );
188
+		$data = 'domain='.$_SERVER['HTTP_HOST'];
189
+		$data .= '&ip='.$_SERVER['SERVER_ADDR'];
190
+		$data .= '&server_type='.$_SERVER['SERVER_SOFTWARE'];
191
+		$data .= '&time='.time();
192
+		$data .= '&remote_log='.$this->_log;
193
+		$data .= '&request_array='.json_encode($_REQUEST);
194 194
 		$data .= '&action=save';
195 195
 
196
-		if ( defined( 'EELOGGING_PASS' )) {
197
-			$data .= '&pass=' . EELOGGING_PASS;
196
+		if (defined('EELOGGING_PASS')) {
197
+			$data .= '&pass='.EELOGGING_PASS;
198 198
 		}
199
-		if ( defined( 'EELOGGING_KEY' )) {
200
-			$data .= '&key=' . EELOGGING_KEY;
199
+		if (defined('EELOGGING_KEY')) {
200
+			$data .= '&key='.EELOGGING_KEY;
201 201
 		}
202 202
 
203
-		$c = curl_init( $this->_remote_logging_url );
204
-		curl_setopt( $c, CURLOPT_POST, TRUE );
205
-		curl_setopt( $c, CURLOPT_POSTFIELDS, $data );
206
-		curl_setopt( $c, CURLOPT_RETURNTRANSFER, TRUE );
207
-		curl_exec( $c );
208
-		curl_close( $c );
203
+		$c = curl_init($this->_remote_logging_url);
204
+		curl_setopt($c, CURLOPT_POST, TRUE);
205
+		curl_setopt($c, CURLOPT_POSTFIELDS, $data);
206
+		curl_setopt($c, CURLOPT_RETURNTRANSFER, TRUE);
207
+		curl_exec($c);
208
+		curl_close($c);
209 209
 	}
210 210
 
211 211
 
@@ -216,18 +216,18 @@  discard block
 block discarded – undo
216 216
 	 * previous entries are overwritten
217 217
 	 */
218 218
 	public function write_debug() {
219
-		if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
219
+		if (defined('WP_DEBUG') && WP_DEBUG) {
220 220
 			$this->_debug_log = '';
221
-			foreach ( $_GET as $key => $value ) {
222
-				$this->_debug_log .= '$_GET["' . $key . '"] = "' . serialize($value) . '"' . PHP_EOL;
221
+			foreach ($_GET as $key => $value) {
222
+				$this->_debug_log .= '$_GET["'.$key.'"] = "'.serialize($value).'"'.PHP_EOL;
223 223
 			}
224
-			foreach ( $_POST as $key => $value ) {
225
-				$this->_debug_log .= '$_POST["' . $key . '"] = "' . serialize($value) . '"' . PHP_EOL;
224
+			foreach ($_POST as $key => $value) {
225
+				$this->_debug_log .= '$_POST["'.$key.'"] = "'.serialize($value).'"'.PHP_EOL;
226 226
 			}
227 227
 			try {
228
-				EEH_File::write_to_file( $this->_logs_folder . $this->_debug_file, $this->_debug_log, 'Event Espresso Debug Log' );
229
-			} catch( EE_Error $e ){
230
-				EE_Error::add_error( sprintf( __(  'Could not write to the Event Espresso debug log file because: %s', 'event_espresso' ), ' &nbsp; &nbsp; ' . $e->getMessage() ), __FILE__, __FUNCTION__, __LINE__ );
228
+				EEH_File::write_to_file($this->_logs_folder.$this->_debug_file, $this->_debug_log, 'Event Espresso Debug Log');
229
+			} catch (EE_Error $e) {
230
+				EE_Error::add_error(sprintf(__('Could not write to the Event Espresso debug log file because: %s', 'event_espresso'), ' &nbsp; &nbsp; '.$e->getMessage()), __FILE__, __FUNCTION__, __LINE__);
231 231
 				return;
232 232
 			}
233 233
 		}
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
 	 * __clone
240 240
 	 */
241 241
 	public function __clone() {
242
-		trigger_error( __( 'Clone is not allowed.', 'event_espresso' ), E_USER_ERROR );
242
+		trigger_error(__('Clone is not allowed.', 'event_espresso'), E_USER_ERROR);
243 243
 	}
244 244
 
245 245
 
Please login to merge, or discard this patch.
core/admin/EE_Admin_Page_CPT.core.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -78,8 +78,8 @@
 block discarded – undo
78 78
 
79 79
 
80 80
 	/**
81
-	* @var EE_CPT_Base
82
-	*/
81
+	 * @var EE_CPT_Base
82
+	 */
83 83
 	protected $_cpt_model_obj = FALSE;
84 84
 
85 85
 
Please login to merge, or discard this patch.
Spacing   +228 added lines, -228 removed lines patch added patch discarded remove patch
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 	 * @param  object $post    The post object of the cpt that was saved.
114 114
 	 * @return void
115 115
 	 */
116
-	abstract protected function _insert_update_cpt_item( $post_id, $post );
116
+	abstract protected function _insert_update_cpt_item($post_id, $post);
117 117
 
118 118
 
119 119
 
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 	 * @param  string $post_id The ID of the cpt that was trashed
127 127
 	 * @return void
128 128
 	 */
129
-	abstract public function trash_cpt_item( $post_id );
129
+	abstract public function trash_cpt_item($post_id);
130 130
 
131 131
 
132 132
 
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
 	 * @param  string $post_id theID of the cpt that was untrashed
138 138
 	 * @return void
139 139
 	 */
140
-	abstract public function restore_cpt_item( $post_id );
140
+	abstract public function restore_cpt_item($post_id);
141 141
 
142 142
 
143 143
 
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
 	 * @param  string $post_id the ID of the cpt that was deleted
149 149
 	 * @return void
150 150
 	 */
151
-	abstract public function delete_cpt_item( $post_id );
151
+	abstract public function delete_cpt_item($post_id);
152 152
 
153 153
 
154 154
 
@@ -161,32 +161,32 @@  discard block
 block discarded – undo
161 161
 	 */
162 162
 	protected function _before_page_setup() {
163 163
 
164
-		$page = isset( $this->_req_data['page'] ) ? $this->_req_data['page'] : $this->page_slug;
164
+		$page = isset($this->_req_data['page']) ? $this->_req_data['page'] : $this->page_slug;
165 165
 
166
-		$this->_cpt_routes = array_merge(array('create_new'=>$this->page_slug, 'edit' => $this->page_slug, 'trash' => $this->page_slug), $this->_cpt_routes );
166
+		$this->_cpt_routes = array_merge(array('create_new'=>$this->page_slug, 'edit' => $this->page_slug, 'trash' => $this->page_slug), $this->_cpt_routes);
167 167
 
168 168
 		//let's see if the current route has a value for cpt_object_slug if it does we use that instead of the page
169
-		$this->_cpt_object = isset($this->_req_data['action']) && isset( $this->_cpt_routes[$this->_req_data['action']] ) ? get_post_type_object($this->_cpt_routes[$this->_req_data['action']]) : get_post_type_object( $page );
169
+		$this->_cpt_object = isset($this->_req_data['action']) && isset($this->_cpt_routes[$this->_req_data['action']]) ? get_post_type_object($this->_cpt_routes[$this->_req_data['action']]) : get_post_type_object($page);
170 170
 
171 171
 		//tweak pagenow for page loading.
172
-		if( ! $this->_pagenow_map ) {
172
+		if ( ! $this->_pagenow_map) {
173 173
 			$this->_pagenow_map = array(
174 174
 				'create_new' => 'post-new.php',
175 175
 				'edit' => 'post.php',
176 176
 				'trash' => 'post.php'
177 177
 				);
178 178
 		}
179
-		add_action( 'current_screen', array( $this, 'modify_pagenow') );
179
+		add_action('current_screen', array($this, 'modify_pagenow'));
180 180
 
181 181
 
182 182
 		//TODO the below will need to be reworked to account for the cpt routes that are NOT based off of page but action param.
183 183
 		//get current page from autosave
184
-		$current_page = isset( $this->_req_data['ee_autosave_data']['ee-cpt-hidden-inputs']['current_page'] ) ? $this->_req_data['ee_autosave_data']['ee-cpt-hidden-inputs']['current_page'] : NULL;
185
-		$this->_current_page = isset( $this->_req_data['current_page'] ) ? $this->_req_data['current_page'] : $current_page;
184
+		$current_page = isset($this->_req_data['ee_autosave_data']['ee-cpt-hidden-inputs']['current_page']) ? $this->_req_data['ee_autosave_data']['ee-cpt-hidden-inputs']['current_page'] : NULL;
185
+		$this->_current_page = isset($this->_req_data['current_page']) ? $this->_req_data['current_page'] : $current_page;
186 186
 
187 187
 
188 188
 		//autosave... make sure its only for the correct page
189
-		if ( !empty($this->_current_page ) && $this->_current_page == $this->page_slug ) {
189
+		if ( ! empty($this->_current_page) && $this->_current_page == $this->page_slug) {
190 190
 			//setup autosave ajax hook
191 191
 			//add_action('wp_ajax_ee-autosave', array( $this, 'do_extra_autosave_stuff' ), 10 ); //TODO reactivate when 4.2 autosave is implemented
192 192
 		}
@@ -202,10 +202,10 @@  discard block
 block discarded – undo
202 202
 	 *
203 203
 	 * @return void
204 204
 	 */
205
-	public function modify_pagenow( $current_screen ) {
205
+	public function modify_pagenow($current_screen) {
206 206
 		global $pagenow;
207 207
 		//possibly reset pagenow.
208
-		if ( ! empty( $this->_req_data['page'] ) && $this->_req_data['page'] == $this->page_slug && !empty( $this->_req_data['action'] ) && isset( $this->_pagenow_map[$this->_req_data['action'] ] ) ) {
208
+		if ( ! empty($this->_req_data['page']) && $this->_req_data['page'] == $this->page_slug && ! empty($this->_req_data['action']) && isset($this->_pagenow_map[$this->_req_data['action']])) {
209 209
 			$pagenow = $this->_pagenow_map[$this->_req_data['action']];
210 210
 		}
211 211
 	}
@@ -220,8 +220,8 @@  discard block
 block discarded – undo
220 220
 	 * @param  array $ids an array of ids for containers that hold form inputs we want autosave to pickup.  Typically you would send along the id of a metabox container.
221 221
 	 * @return void
222 222
 	 */
223
-	protected function _register_autosave_containers( $ids ) {
224
-		$this->_autosave_containers = array_merge( $this->_autosave_fields, (array) $ids );
223
+	protected function _register_autosave_containers($ids) {
224
+		$this->_autosave_containers = array_merge($this->_autosave_fields, (array) $ids);
225 225
 	}
226 226
 
227 227
 
@@ -236,22 +236,22 @@  discard block
 block discarded – undo
236 236
 
237 237
 		$containers = array();
238 238
 
239
-		if ( empty( $wp_meta_boxes ) )
239
+		if (empty($wp_meta_boxes))
240 240
 			return;
241 241
 
242
-		$current_metaboxes = isset( $wp_meta_boxes[$this->page_slug] ) ? $wp_meta_boxes[$this->page_slug] : array();
242
+		$current_metaboxes = isset($wp_meta_boxes[$this->page_slug]) ? $wp_meta_boxes[$this->page_slug] : array();
243 243
 
244
-		foreach ( $current_metaboxes as $box_context ) {
245
-			foreach ( $box_context as $box_details ) {
246
-				foreach ( $box_details as $box ) {
247
-					if ( is_array( $box['callback'] ) && ( $box['callback'][0] instanceof EE_Admin_Page || $box['callback'][0] instanceof EE_Admin_Hooks ) ){
244
+		foreach ($current_metaboxes as $box_context) {
245
+			foreach ($box_context as $box_details) {
246
+				foreach ($box_details as $box) {
247
+					if (is_array($box['callback']) && ($box['callback'][0] instanceof EE_Admin_Page || $box['callback'][0] instanceof EE_Admin_Hooks)) {
248 248
 						$containers[] = $box['id'];
249 249
 					}
250 250
 				}
251 251
 			}
252 252
 		}
253 253
 
254
-		$this->_autosave_containers = array_merge( $this->_autosave_containers, $containers );
254
+		$this->_autosave_containers = array_merge($this->_autosave_containers, $containers);
255 255
 
256 256
 		//add hidden inputs container
257 257
 		$this->_autosave_containers[] = 'ee-cpt-hidden-inputs';
@@ -268,13 +268,13 @@  discard block
 block discarded – undo
268 268
 		wp_enqueue_script('cpt-autosave');/**/ //todo re-enable when we start doing autosave again in 4.2
269 269
 
270 270
 		//filter _autosave_containers
271
-		$containers = apply_filters( 'FHEE__EE_Admin_Page_CPT___load_autosave_scripts_styles__containers', $this->_autosave_containers, $this );
272
-		$containers = apply_filters( 'FHEE__EE_Admin_Page_CPT__' . get_class($this) . '___load_autosave_scripts_styles__containers', $containers, $this );
271
+		$containers = apply_filters('FHEE__EE_Admin_Page_CPT___load_autosave_scripts_styles__containers', $this->_autosave_containers, $this);
272
+		$containers = apply_filters('FHEE__EE_Admin_Page_CPT__'.get_class($this).'___load_autosave_scripts_styles__containers', $containers, $this);
273 273
 
274
-		wp_localize_script('event_editor_js', 'EE_AUTOSAVE_IDS', $containers ); //todo once we enable autosaves, this needs to be switched to localize with "cpt-autosave"
274
+		wp_localize_script('event_editor_js', 'EE_AUTOSAVE_IDS', $containers); //todo once we enable autosaves, this needs to be switched to localize with "cpt-autosave"
275 275
 
276 276
 		$unsaved_data_msg = array(
277
-			'eventmsg' => sprintf( __("The changes you made to this %s will be lost if you navigate away from this page.", 'event_espresso'), $this->_cpt_object->labels->singular_name),
277
+			'eventmsg' => sprintf(__("The changes you made to this %s will be lost if you navigate away from this page.", 'event_espresso'), $this->_cpt_object->labels->singular_name),
278 278
 			'inputChanged' => 0
279 279
 			);
280 280
 
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
 	public function load_page_dependencies() {
287 287
 		try {
288 288
 			$this->_load_page_dependencies();
289
-		} catch ( EE_Error $e ) {
289
+		} catch (EE_Error $e) {
290 290
 			$e->get_error();
291 291
 		}
292 292
 	}
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
 	protected function _load_page_dependencies() {
303 303
 
304 304
 		//we only add stuff if this is a cpt_route!
305
-		if ( !$this->_cpt_route ) {
305
+		if ( ! $this->_cpt_route) {
306 306
 			parent::_load_page_dependencies();
307 307
 			return;
308 308
 		}
@@ -312,72 +312,72 @@  discard block
 block discarded – undo
312 312
 
313 313
 		//the following filters are for setting all the redirects on DEFAULT WP custom post type actions
314 314
 		//let's add a hidden input to the post-edit form so we know when we have to trigger our custom redirects!  Otherwise the redirects will happen on ALL post saves which wouldn't be good of course!
315
-		add_action('edit_form_after_title', array( $this, 'cpt_post_form_hidden_input') );
315
+		add_action('edit_form_after_title', array($this, 'cpt_post_form_hidden_input'));
316 316
 
317 317
 		//inject our Admin page nav tabs...
318 318
 		//let's make sure the nav tabs are set if they aren't already
319 319
 		//if ( empty( $this->_nav_tabs ) ) $this->_set_nav_tabs();
320
-		add_action('post_edit_form_tag', array( $this, 'inject_nav_tabs' ) );
320
+		add_action('post_edit_form_tag', array($this, 'inject_nav_tabs'));
321 321
 
322 322
 		//modify the post_updated messages array
323
-		add_action('post_updated_messages', array( $this, 'post_update_messages' ), 10 );
323
+		add_action('post_updated_messages', array($this, 'post_update_messages'), 10);
324 324
 
325 325
 		//add shortlink button to cpt edit screens.  We can do this as a universal thing BECAUSE, cpts use the same format for shortlinks as posts!
326
-		add_filter( 'pre_get_shortlink', array( $this, 'add_shortlink_button_to_editor' ), 10, 4 );
326
+		add_filter('pre_get_shortlink', array($this, 'add_shortlink_button_to_editor'), 10, 4);
327 327
 
328 328
 		//This basically allows us to change the title of the "publish" metabox area on CPT pages by setting a 'publishbox' value in the $_labels property array in the child class.
329
-		if ( !empty($this->_labels['publishbox'] ) ) {
329
+		if ( ! empty($this->_labels['publishbox'])) {
330 330
 
331
-			$box_label = is_array( $this->_labels['publishbox'] ) && isset( $this->_labels['publishbox'][$this->_req_action]) ? $this->_labels['publishbox'][$this->_req_action] : $this->_labels['publishbox'];
331
+			$box_label = is_array($this->_labels['publishbox']) && isset($this->_labels['publishbox'][$this->_req_action]) ? $this->_labels['publishbox'][$this->_req_action] : $this->_labels['publishbox'];
332 332
 
333
-			remove_meta_box( 'submitdiv', __( 'Publish' ), 'post_submit_meta_box', $this->_cpt_routes[$this->_req_action], 'side', 'core' );
334
-			add_meta_box( 'submitdiv', $box_label, 'post_submit_meta_box', $this->_cpt_routes[$this->_req_action], 'side', 'core' );
333
+			remove_meta_box('submitdiv', __('Publish'), 'post_submit_meta_box', $this->_cpt_routes[$this->_req_action], 'side', 'core');
334
+			add_meta_box('submitdiv', $box_label, 'post_submit_meta_box', $this->_cpt_routes[$this->_req_action], 'side', 'core');
335 335
 		}
336 336
 
337 337
 		//let's add page_templates metabox if this cpt added support for it.
338
-		if ( $this->_supports_page_templates($this->_cpt_object->name) ) {
339
-			add_meta_box( 'page_templates', __('Page Template', 'event_espresso' ), array( $this, 'page_template_meta_box' ), $this->_cpt_routes[$this->_req_action], 'side', 'default' );
338
+		if ($this->_supports_page_templates($this->_cpt_object->name)) {
339
+			add_meta_box('page_templates', __('Page Template', 'event_espresso'), array($this, 'page_template_meta_box'), $this->_cpt_routes[$this->_req_action], 'side', 'default');
340 340
 		}/**/
341 341
 
342 342
 
343 343
 		//this is a filter that allows the addition of extra html after the permalink field on the wp post edit-form
344
-		if ( method_exists( $this, 'extra_permalink_field_buttons' ) )
345
-			add_filter('get_sample_permalink_html', array( $this, 'extra_permalink_field_buttons' ), 10, 4 );
344
+		if (method_exists($this, 'extra_permalink_field_buttons'))
345
+			add_filter('get_sample_permalink_html', array($this, 'extra_permalink_field_buttons'), 10, 4);
346 346
 
347 347
 		//add preview button
348
-		add_filter('get_sample_permalink_html', array($this, 'preview_button_html'), 5, 4 );
348
+		add_filter('get_sample_permalink_html', array($this, 'preview_button_html'), 5, 4);
349 349
 
350 350
 
351 351
 		//insert our own post_stati dropdown
352
-		add_action('post_submitbox_misc_actions', array($this, 'custom_post_stati_dropdown' ), 10 );
352
+		add_action('post_submitbox_misc_actions', array($this, 'custom_post_stati_dropdown'), 10);
353 353
 
354 354
 		//This allows adding additional information to the publish post submitbox on the wp post edit form
355
-		if ( method_exists( $this, 'extra_misc_actions_publish_box' ) )
356
-			add_action('post_submitbox_misc_actions', array( $this, 'extra_misc_actions_publish_box' ), 10 );
355
+		if (method_exists($this, 'extra_misc_actions_publish_box'))
356
+			add_action('post_submitbox_misc_actions', array($this, 'extra_misc_actions_publish_box'), 10);
357 357
 
358 358
 		//This allows for adding additional stuff after the title field on the wp post edit form.  This is also before the wp_editor for post description field.
359
-		if ( method_exists( $this, 'edit_form_after_title' ) )
360
-			add_action('edit_form_after_title', array( $this, 'edit_form_after_title' ), 10 );
359
+		if (method_exists($this, 'edit_form_after_title'))
360
+			add_action('edit_form_after_title', array($this, 'edit_form_after_title'), 10);
361 361
 
362 362
 
363 363
 		/**
364 364
 		 * Filtering WP's esc_url to capture urls pointing to core wp routes so they point to our route.
365 365
 		 */
366
-		add_filter( 'clean_url', array( $this, 'switch_core_wp_urls_with_ours' ), 10, 3 );
366
+		add_filter('clean_url', array($this, 'switch_core_wp_urls_with_ours'), 10, 3);
367 367
 
368 368
 
369 369
 		parent::_load_page_dependencies();
370 370
 
371 371
 		//notice we are ALSO going to load the pagenow hook set for this route (see _before_page_setup for the reset of the pagenow global ). This is for any plugins that are doing things properly and hooking into the load page hook for core wp cpt routes.
372 372
 		global $pagenow;
373
-		do_action( 'load-' . $pagenow );
373
+		do_action('load-'.$pagenow);
374 374
 
375 375
 		$this->modify_current_screen();
376
-		add_action( 'admin_enqueue_scripts', array( $this, 'setup_autosave_hooks'), 30 );
376
+		add_action('admin_enqueue_scripts', array($this, 'setup_autosave_hooks'), 30);
377 377
 		//we route REALLY early.
378 378
 		try {
379 379
 			$this->_route_admin_request();
380
-		} catch ( EE_Error $e ) {
380
+		} catch (EE_Error $e) {
381 381
 			$e->get_error();
382 382
 		}
383 383
 	}
@@ -396,21 +396,21 @@  discard block
 block discarded – undo
396 396
 	 *
397 397
 	 * @return string possibly a new url for our route.
398 398
 	 */
399
-	public function switch_core_wp_urls_with_ours( $good_protocol_url, $original_url, $_context ) {
399
+	public function switch_core_wp_urls_with_ours($good_protocol_url, $original_url, $_context) {
400 400
 		$routes_to_match = array(
401 401
 			0 => array(
402 402
 				'edit.php?post_type=espresso_attendees',
403 403
 				'admin.php?page=espresso_registrations&action=contact_list'
404 404
 				),
405 405
 			 1 => array(
406
-			 	'edit.php?post_type=' . $this->_cpt_object->name,
407
-			 	'admin.php?page=' . $this->_cpt_object->name
406
+			 	'edit.php?post_type='.$this->_cpt_object->name,
407
+			 	'admin.php?page='.$this->_cpt_object->name
408 408
 				)
409 409
 			);
410 410
 
411
-		foreach( $routes_to_match as $route_matches ) {
412
-			if ( strpos( $good_protocol_url, $route_matches[0] ) !== false ) {
413
-				return str_replace( $route_matches[0], $route_matches[1], $good_protocol_url );
411
+		foreach ($routes_to_match as $route_matches) {
412
+			if (strpos($good_protocol_url, $route_matches[0]) !== false) {
413
+				return str_replace($route_matches[0], $route_matches[1], $good_protocol_url);
414 414
 
415 415
 			}
416 416
 		}
@@ -426,10 +426,10 @@  discard block
 block discarded – undo
426 426
 	 * @param string $cpt_name The cpt slug we're checking on.
427 427
 	 * @return bool True supported, false not.
428 428
 	 */
429
-	private function _supports_page_templates( $cpt_name ) {
429
+	private function _supports_page_templates($cpt_name) {
430 430
 		$cpt_args = EE_Register_CPTs::get_CPTs();
431
-		$cpt_args = isset( $cpt_args[$cpt_name] ) ? $cpt_args[$cpt_name]['args'] : array();
432
-		return ! empty( $cpt_args['page_templates'] ) ? TRUE : FALSE;
431
+		$cpt_args = isset($cpt_args[$cpt_name]) ? $cpt_args[$cpt_name]['args'] : array();
432
+		return ! empty($cpt_args['page_templates']) ? TRUE : FALSE;
433 433
 	}
434 434
 
435 435
 
@@ -444,9 +444,9 @@  discard block
 block discarded – undo
444 444
 	public function page_template_meta_box() {
445 445
 		global $post;
446 446
 		$template = '';
447
-		if ( count( get_page_templates( $post ) ) != 0 ) {
448
-			$page_template = get_post_meta( $post->ID, '_wp_page_template', TRUE );
449
-			$template = !empty( $page_template ) ? $page_template : '';
447
+		if (count(get_page_templates($post)) != 0) {
448
+			$page_template = get_post_meta($post->ID, '_wp_page_template', TRUE);
449
+			$template = ! empty($page_template) ? $page_template : '';
450 450
 		}
451 451
 		?>
452 452
 		<p><strong><?php _e('Template') ?></strong></p>
@@ -470,10 +470,10 @@  discard block
 block discarded – undo
470 470
 	 * @param  string $new_slug  what the slug is
471 471
 	 * @return string            The new html string for the permalink area
472 472
 	 */
473
-	public function preview_button_html( $return, $id, $new_title, $new_slug ) {
474
-		$post = get_post( $id );
475
-		if ( 'publish' != get_post_status( $post ) ) {
476
-			$return .= '<span_id="view-post-btn"><a href="' . wp_get_shortlink($id, 'post') . '" class="button button-small">' . __('Preview', 'event_espresso') . '</a></span>' . "\n";
473
+	public function preview_button_html($return, $id, $new_title, $new_slug) {
474
+		$post = get_post($id);
475
+		if ('publish' != get_post_status($post)) {
476
+			$return .= '<span_id="view-post-btn"><a href="'.wp_get_shortlink($id, 'post').'" class="button button-small">'.__('Preview', 'event_espresso').'</a></span>'."\n";
477 477
 		}
478 478
 		return $return;
479 479
 	}
@@ -493,18 +493,18 @@  discard block
 block discarded – undo
493 493
 			'cur_status' =>  $this->_cpt_model_obj->status(),
494 494
 			'statuses' => $statuses,
495 495
 			'cur_status_label' => $cur_status_label,
496
-			'localized_status_save' => sprintf( __('Save %s', 'event_espresso'), $cur_status_label )
496
+			'localized_status_save' => sprintf(__('Save %s', 'event_espresso'), $cur_status_label)
497 497
 			);
498 498
 
499 499
 		//we'll add a trash post status (WP doesn't add one for some reason)
500
-		if ( $this->_cpt_model_obj->status() == 'trash' ) {
500
+		if ($this->_cpt_model_obj->status() == 'trash') {
501 501
 			$template_args['cur_status_label'] = __('Trashed', 'event_espresso');
502 502
 			$statuses['trash'] = __('Trashed', 'event_espresso');
503 503
 			$template_args['statuses'] = $statuses;
504 504
 		}
505 505
 
506
-		$template = EE_ADMIN_TEMPLATE . 'status_dropdown.template.php';
507
-		EEH_Template::display_template( $template, $template_args );
506
+		$template = EE_ADMIN_TEMPLATE.'status_dropdown.template.php';
507
+		EEH_Template::display_template($template, $template_args);
508 508
 	}
509 509
 
510 510
 
@@ -543,22 +543,22 @@  discard block
 block discarded – undo
543 543
 	public function do_extra_autosave_stuff() {
544 544
 
545 545
 		//next let's check for the autosave nonce (we'll use _verify_nonce )
546
-		$nonce = isset( $this->_req_data['autosavenonce'] ) ? $this->_req_data['autosavenonce'] : NULL;
547
-		$this->_verify_nonce( $nonce, 'autosave' );
546
+		$nonce = isset($this->_req_data['autosavenonce']) ? $this->_req_data['autosavenonce'] : NULL;
547
+		$this->_verify_nonce($nonce, 'autosave');
548 548
 
549 549
 
550 550
 		//make sure we define doing autosave (cause WP isn't triggering this we want to make sure we define it)
551
-		if ( !defined('DOING_AUTOSAVE') ) define('DOING_AUTOSAVE', true);
551
+		if ( ! defined('DOING_AUTOSAVE')) define('DOING_AUTOSAVE', true);
552 552
 
553 553
 		//if we made it here then the nonce checked out.  Let's run our methods and actions
554
-		if ( method_exists( $this, '_ee_autosave_' . $this->_current_view ) ) {
555
-			call_user_func( array( $this, '_ee_autosave_' . $this->_current_view ) );
554
+		if (method_exists($this, '_ee_autosave_'.$this->_current_view)) {
555
+			call_user_func(array($this, '_ee_autosave_'.$this->_current_view));
556 556
 		} else {
557 557
 			$this->_template_args['success'] = TRUE;
558 558
 		}
559 559
 
560
-		do_action( 'AHEE__EE_Admin_Page_CPT__do_extra_autosave_stuff__global_after', $this );
561
-		do_action( 'AHEE__EE_Admin_Page_CPT__do_extra_autosave_stuff__after_' . get_class( $this ), $this );
560
+		do_action('AHEE__EE_Admin_Page_CPT__do_extra_autosave_stuff__global_after', $this);
561
+		do_action('AHEE__EE_Admin_Page_CPT__do_extra_autosave_stuff__after_'.get_class($this), $this);
562 562
 
563 563
 		//now let's return json
564 564
 		$this->_return_json();
@@ -578,18 +578,18 @@  discard block
 block discarded – undo
578 578
 	protected function _extend_page_config_for_cpt() {
579 579
 
580 580
 		//before doing anything we need to make sure this runs ONLY when the loaded page matches the set page_slug
581
-		if ( ( isset( $this->_req_data['page'] ) && $this->_req_data['page'] != $this->page_slug ) )
581
+		if ((isset($this->_req_data['page']) && $this->_req_data['page'] != $this->page_slug))
582 582
 			return;
583 583
 
584 584
 		//set page routes and page config but ONLY if we're not viewing a custom setup cpt route as defined in _cpt_routes
585
-		if ( !empty( $this->_cpt_object ) ) {
586
-			$this->_page_routes = array_merge( array(
585
+		if ( ! empty($this->_cpt_object)) {
586
+			$this->_page_routes = array_merge(array(
587 587
 				'create_new' => '_create_new_cpt_item',
588 588
 				'edit' => '_edit_cpt_item'
589
-				), $this->_page_routes );
589
+				), $this->_page_routes);
590 590
 
591 591
 
592
-			$this->_page_config = array_merge( array(
592
+			$this->_page_config = array_merge(array(
593 593
 				'create_new' => array(
594 594
 					'nav' => array(
595 595
 						'label' => $this->_cpt_object->labels->add_new_item,
@@ -611,23 +611,23 @@  discard block
 block discarded – undo
611 611
 		}
612 612
 
613 613
 		//load the next section only if this is a matching cpt route as set in the cpt routes array.
614
-		if ( !isset( $this->_cpt_routes[$this->_req_action] ) )
614
+		if ( ! isset($this->_cpt_routes[$this->_req_action]))
615 615
 			return;
616 616
 
617 617
 
618
-		$this->_cpt_route = isset( $this->_cpt_routes[$this->_req_action] ) ? TRUE : FALSE;
618
+		$this->_cpt_route = isset($this->_cpt_routes[$this->_req_action]) ? TRUE : FALSE;
619 619
 		//add_action('FHEE__EE_Admin_Page___load_page_dependencies__after_load', array( $this, 'modify_current_screen') );
620 620
 
621 621
 
622
-		if ( empty( $this->_cpt_object ) ) {
623
-			$msg = sprintf( __('This page has been set as being related to a registered custom post type, however, the custom post type object could not be retrieved. There are two possible reasons for this:  1. The "%s" does not match a registered post type. or 2. The custom post type is not registered for the "%s" action as indexed in the "$_cpt_routes" property on this class (%s).'), $this->page_slug, $this->_req_action, get_class($this) );
624
-			throw new EE_Error( $msg );
622
+		if (empty($this->_cpt_object)) {
623
+			$msg = sprintf(__('This page has been set as being related to a registered custom post type, however, the custom post type object could not be retrieved. There are two possible reasons for this:  1. The "%s" does not match a registered post type. or 2. The custom post type is not registered for the "%s" action as indexed in the "$_cpt_routes" property on this class (%s).'), $this->page_slug, $this->_req_action, get_class($this));
624
+			throw new EE_Error($msg);
625 625
 		}
626 626
 
627 627
 
628
-		if ( $this->_cpt_route ) {
629
-			$id = isset( $this->_req_data['post'] ) ? $this->_req_data['post'] : NULL;
630
-			$this->_set_model_object( $id );
628
+		if ($this->_cpt_route) {
629
+			$id = isset($this->_req_data['post']) ? $this->_req_data['post'] : NULL;
630
+			$this->_set_model_object($id);
631 631
 		}
632 632
 
633 633
 	}
@@ -643,17 +643,17 @@  discard block
 block discarded – undo
643 643
 	 * @param int $id The id to retrieve the model object for. If empty we set a default object.
644 644
 	 * @return void
645 645
 	 */
646
-	protected function _set_model_object( $id = NULL ) {
646
+	protected function _set_model_object($id = NULL) {
647 647
 
648
-		if ( empty( $this->_cpt_model_names ) || ! isset( $this->_cpt_routes[ $this->_req_action ] ) || ( is_object( $this->_cpt_model_obj ) && $this->_cpt_model_obj->ID() == $id )) {
648
+		if (empty($this->_cpt_model_names) || ! isset($this->_cpt_routes[$this->_req_action]) || (is_object($this->_cpt_model_obj) && $this->_cpt_model_obj->ID() == $id)) {
649 649
 			//get out cuz we either don't have a model name OR the object has already been set and it has the same id as what has been sent.
650 650
 			return;
651 651
 		}
652 652
 		// load CPT object model
653
-		$model = EE_Registry::instance()->load_model( $this->_cpt_model_names[$this->_req_action] );
654
-		$this->_cpt_model_obj = ! empty( $id ) ? $model->get_one_by_ID( $id ) : $model->create_default_object();
653
+		$model = EE_Registry::instance()->load_model($this->_cpt_model_names[$this->_req_action]);
654
+		$this->_cpt_model_obj = ! empty($id) ? $model->get_one_by_ID($id) : $model->create_default_object();
655 655
 		//d( $this->_cpt_model_obj );
656
-		do_action( 'AHEE__EE_Admin_Page_CPT__set_model_object__after_set_object' );
656
+		do_action('AHEE__EE_Admin_Page_CPT__set_model_object__after_set_object');
657 657
 	}
658 658
 
659 659
 
@@ -667,47 +667,47 @@  discard block
 block discarded – undo
667 667
 	 */
668 668
 	public function admin_init_global() {
669 669
 
670
-		$post = isset( $this->_req_data['post'] ) ? get_post( $this->_req_data['post'] ) : NULL;
670
+		$post = isset($this->_req_data['post']) ? get_post($this->_req_data['post']) : NULL;
671 671
 
672 672
 		//its possible this is a new save so let's catch that instead
673
-		$post = isset( $this->_req_data['post_ID'] ) ? get_post( $this->_req_data['post_ID'] ) : $post;
673
+		$post = isset($this->_req_data['post_ID']) ? get_post($this->_req_data['post_ID']) : $post;
674 674
 		$post_type = $post ? $post->post_type : false;
675 675
 
676 676
 		$current_route = isset($this->_req_data['current_route']) ? $this->_req_data['current_route'] : 'shouldneverwork';
677 677
 
678
-		$route_to_check = $post_type && isset( $this->_cpt_routes[$current_route]) ? $this->_cpt_routes[$current_route] : '';
678
+		$route_to_check = $post_type && isset($this->_cpt_routes[$current_route]) ? $this->_cpt_routes[$current_route] : '';
679 679
 
680
-		add_filter( 'get_delete_post_link', array( $this, 'modify_delete_post_link'), 10, 3 );
681
-		add_filter( 'get_edit_post_link', array( $this, 'modify_edit_post_link'), 10, 3 );
680
+		add_filter('get_delete_post_link', array($this, 'modify_delete_post_link'), 10, 3);
681
+		add_filter('get_edit_post_link', array($this, 'modify_edit_post_link'), 10, 3);
682 682
 
683 683
 
684
-		if ( $post_type === $route_to_check ) {
685
-			add_filter('redirect_post_location', array( $this, 'cpt_post_location_redirect'), 10, 2 );
684
+		if ($post_type === $route_to_check) {
685
+			add_filter('redirect_post_location', array($this, 'cpt_post_location_redirect'), 10, 2);
686 686
 			//catch trashed wp redirect
687
-			add_filter('wp_redirect', array( $this, 'cpt_trash_post_location_redirect' ), 10, 2 );
687
+			add_filter('wp_redirect', array($this, 'cpt_trash_post_location_redirect'), 10, 2);
688 688
 		}
689 689
 
690 690
 		//now let's filter redirect if we're on a revision page and the revision is for an event CPT.
691
-		$revision = isset( $this->_req_data['revision'] ) ? $this->_req_data['revision'] : NULL;
691
+		$revision = isset($this->_req_data['revision']) ? $this->_req_data['revision'] : NULL;
692 692
 
693 693
 		/**var_dump($this->_req_data);
694 694
 		exit();/**/
695 695
 
696
-		if ( !empty( $revision ) ) {
697
-			$action = isset( $this->_req_data['action'] ) ? $this->_req_data['action'] : NULL;
696
+		if ( ! empty($revision)) {
697
+			$action = isset($this->_req_data['action']) ? $this->_req_data['action'] : NULL;
698 698
 
699 699
 			//doing a restore?
700
-			if ( !empty( $action ) && $action == 'restore' ) {
700
+			if ( ! empty($action) && $action == 'restore') {
701 701
 
702 702
 				//get post for revision
703
-				$rev_post = get_post( $revision );
704
-				$rev_parent = get_post( $rev_post->post_parent );
703
+				$rev_post = get_post($revision);
704
+				$rev_parent = get_post($rev_post->post_parent);
705 705
 
706 706
 				//only do our redirect filter AND our restore revision action if the post_type for the parent is one of our cpts.
707
-				if ( $rev_parent && $rev_parent->post_type == $this->page_slug ) {
708
-					add_filter('wp_redirect', array($this, 'revision_redirect'), 10, 2 );
707
+				if ($rev_parent && $rev_parent->post_type == $this->page_slug) {
708
+					add_filter('wp_redirect', array($this, 'revision_redirect'), 10, 2);
709 709
 					//restores of revisions
710
-					add_action('wp_restore_post_revision', array($this, 'restore_revision'), 10, 2 );
710
+					add_action('wp_restore_post_revision', array($this, 'restore_revision'), 10, 2);
711 711
 				}
712 712
 			}
713 713
 
@@ -716,15 +716,15 @@  discard block
 block discarded – undo
716 716
 		//NOTE we ONLY want to run these hooks if we're on the right class for the given post type.  Otherwise we could see some really freaky things happen!
717 717
 
718 718
 
719
-		if ( $post_type && $post_type === $route_to_check ) {
719
+		if ($post_type && $post_type === $route_to_check) {
720 720
 			//$post_id, $post
721
-			add_action('save_post', array( $this, 'insert_update'), 10, 2 );
721
+			add_action('save_post', array($this, 'insert_update'), 10, 2);
722 722
 
723 723
 			//$post_id
724
-			add_action('trashed_post', array( $this, 'trash_cpt_item' ), 10 );
725
-			add_action('trashed_post', array( $this, 'dont_permanently_delete_ee_cpts'), 10 );
726
-			add_action('untrashed_post', array( $this, 'restore_cpt_item'), 10 );
727
-			add_action('after_delete_post', array( $this, 'delete_cpt_item'), 10 );
724
+			add_action('trashed_post', array($this, 'trash_cpt_item'), 10);
725
+			add_action('trashed_post', array($this, 'dont_permanently_delete_ee_cpts'), 10);
726
+			add_action('untrashed_post', array($this, 'restore_cpt_item'), 10);
727
+			add_action('after_delete_post', array($this, 'delete_cpt_item'), 10);
728 728
 		}
729 729
 
730 730
 	}
@@ -739,15 +739,15 @@  discard block
 block discarded – undo
739 739
 	 * @return void
740 740
 	 */
741 741
 	public function verify_cpt_object() {
742
-		$label = !empty( $this->_cpt_object ) ? $this->_cpt_object->labels->singular_name : $this->page_label;
742
+		$label = ! empty($this->_cpt_object) ? $this->_cpt_object->labels->singular_name : $this->page_label;
743 743
 		// verify event object
744
-		if ( ! $this->_cpt_model_obj instanceof EE_CPT_Base ) {
745
-			throw new EE_Error( sprintf( __('Something has gone wrong with the page load because we are unable to set up the object for the %1$s.  This usually happens when the given id for the page route is NOT for the correct custom post type for this page', 'event_espresso' ), $label ) );
744
+		if ( ! $this->_cpt_model_obj instanceof EE_CPT_Base) {
745
+			throw new EE_Error(sprintf(__('Something has gone wrong with the page load because we are unable to set up the object for the %1$s.  This usually happens when the given id for the page route is NOT for the correct custom post type for this page', 'event_espresso'), $label));
746 746
 		}
747 747
 		//if auto-draft then throw an error
748
-		if ( $this->_cpt_model_obj->get('status') == 'auto-draft' ) {
748
+		if ($this->_cpt_model_obj->get('status') == 'auto-draft') {
749 749
 			EE_Error::overwrite_errors();
750
-			EE_Error::add_error( sprintf( __('This %1$s was saved without a title, description, or excerpt which means that none of the extra details you added were saved properly.  All autodrafts will show up in the "draft" view of your event list table.  You can delete them from there. Please click the "Add %1$s" button to refresh and restart.'), $label ), __FILE__, __FUNCTION__, __LINE__ );
750
+			EE_Error::add_error(sprintf(__('This %1$s was saved without a title, description, or excerpt which means that none of the extra details you added were saved properly.  All autodrafts will show up in the "draft" view of your event list table.  You can delete them from there. Please click the "Add %1$s" button to refresh and restart.'), $label), __FILE__, __FUNCTION__, __LINE__);
751 751
 		}
752 752
 	}
753 753
 
@@ -776,22 +776,22 @@  discard block
 block discarded – undo
776 776
 	public function load_global_scripts_styles() {
777 777
 		parent::load_global_scripts_styles();
778 778
 
779
-		if ( $this->_cpt_model_obj instanceof EE_CPT_Base ) {
779
+		if ($this->_cpt_model_obj instanceof EE_CPT_Base) {
780 780
 			//setup custom post status object for localize script but only if we've got a cpt object
781 781
 			$statuses = $this->_cpt_model_obj->get_custom_post_statuses();
782 782
 
783
-			if ( !empty($statuses) ) {
783
+			if ( ! empty($statuses)) {
784 784
 				//get ALL statuses!
785 785
 				$statuses = $this->_cpt_model_obj->get_all_post_statuses();
786 786
 				//setup object
787 787
 				$ee_cpt_statuses = array();
788
-				foreach ( $statuses as $status => $label ) {
788
+				foreach ($statuses as $status => $label) {
789 789
 					$ee_cpt_statuses[$status] = array(
790 790
 						'label' => $label,
791
-						'save_label' => sprintf( __('Save as %s', 'event_espresso'), $label )
791
+						'save_label' => sprintf(__('Save as %s', 'event_espresso'), $label)
792 792
 						);
793 793
 				}
794
-				wp_localize_script('ee_admin_js', 'eeCPTstatuses', $ee_cpt_statuses );
794
+				wp_localize_script('ee_admin_js', 'eeCPTstatuses', $ee_cpt_statuses);
795 795
 			}
796 796
 		}
797 797
 	}
@@ -805,10 +805,10 @@  discard block
 block discarded – undo
805 805
 	 * @param  WP_Post $post    Post object from WP
806 806
 	 * @return void
807 807
 	 */
808
-	public function insert_update( $post_id, $post ) {
808
+	public function insert_update($post_id, $post) {
809 809
 
810 810
 		//make sure that if this is a revision OR trash action that we don't do any updates!
811
-		if ( isset( $this->_req_data['action'] ) && ( $this->_req_data['action'] == 'restore' || $this->_req_data['action'] == 'trash' ) )
811
+		if (isset($this->_req_data['action']) && ($this->_req_data['action'] == 'restore' || $this->_req_data['action'] == 'trash'))
812 812
 			return;
813 813
 
814 814
 		//check for autosave and update our req_data property accordingly.
@@ -823,19 +823,19 @@  discard block
 block discarded – undo
823 823
 		}/**/ //TODO reactivate after autosave is implemented in 4.2
824 824
 
825 825
 		//take care of updating any selected page_template IF this cpt supports it.
826
-		if ( $this->_supports_page_templates($post->post_type ) && !empty( $this->_req_data['page_template'] ) ) {
826
+		if ($this->_supports_page_templates($post->post_type) && ! empty($this->_req_data['page_template'])) {
827 827
 			$post->page_template = $this->_req_data['page_template'];
828
-			$page_templates = wp_get_theme()->get_page_templates( $post );
829
-			if ( 'default' != $this->_req_data['page_template']  && ! isset( $page_templates[ $this->_req_data['page_template'] ] ) ) {
830
-				EE_Error::add_error( __('Invalid Page Template.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
828
+			$page_templates = wp_get_theme()->get_page_templates($post);
829
+			if ('default' != $this->_req_data['page_template'] && ! isset($page_templates[$this->_req_data['page_template']])) {
830
+				EE_Error::add_error(__('Invalid Page Template.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
831 831
 			} else {
832
-				update_post_meta( $post_id, '_wp_page_template', $this->_req_data['page_template'] );
832
+				update_post_meta($post_id, '_wp_page_template', $this->_req_data['page_template']);
833 833
 			}
834 834
 		}
835 835
 
836
-		if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )
836
+		if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE)
837 837
 			return; //TODO we'll remove this after reimplementing autosave in 4.2
838
-		$this->_insert_update_cpt_item( $post_id, $post );
838
+		$this->_insert_update_cpt_item($post_id, $post);
839 839
 	}
840 840
 
841 841
 
@@ -848,8 +848,8 @@  discard block
 block discarded – undo
848 848
 	 * @param  int    $post_id ID of the post
849 849
 	 * @return void
850 850
 	 */
851
-	public function dont_permanently_delete_ee_cpts( $post_id ) {
852
-		delete_post_meta( $post_id, '_wp_trash_meta_status' );
851
+	public function dont_permanently_delete_ee_cpts($post_id) {
852
+		delete_post_meta($post_id, '_wp_trash_meta_status');
853 853
 		delete_post_meta($post_id, '_wp_trash_meta_time');
854 854
 
855 855
 		//our cpts may have comments so let's take care of that too
@@ -868,14 +868,14 @@  discard block
 block discarded – undo
868 868
 	 * @param  int    $revision_id ID of revision being restored
869 869
 	 * @return void
870 870
 	 */
871
-	public function restore_revision( $post_id, $revision_id ) {
872
-		$this->_restore_cpt_item( $post_id, $revision_id );
871
+	public function restore_revision($post_id, $revision_id) {
872
+		$this->_restore_cpt_item($post_id, $revision_id);
873 873
 
874 874
 		//global action
875
-		do_action( 'AHEE_EE_Admin_Page_CPT__restore_revision', $post_id, $revision_id);
875
+		do_action('AHEE_EE_Admin_Page_CPT__restore_revision', $post_id, $revision_id);
876 876
 
877 877
 		//class specific action so you can limit hooking into a specific page.
878
-		do_action( 'AHEE_EE_Admin_Page_CPT_' . get_class($this) . '__restore_revision', $post_id, $revision_id );
878
+		do_action('AHEE_EE_Admin_Page_CPT_'.get_class($this).'__restore_revision', $post_id, $revision_id);
879 879
 	}
880 880
 
881 881
 
@@ -886,7 +886,7 @@  discard block
 block discarded – undo
886 886
 	 * @param  int $revision_id ID of revision for item
887 887
 	 * @return void
888 888
 	 */
889
-	abstract protected function _restore_cpt_item( $post_id, $revision_id );
889
+	abstract protected function _restore_cpt_item($post_id, $revision_id);
890 890
 
891 891
 
892 892
 
@@ -905,9 +905,9 @@  discard block
 block discarded – undo
905 905
 	 */
906 906
 	public function modify_current_screen() {
907 907
 		//ONLY do this if the current page_route IS a cpt route
908
-		if ( !$this->_cpt_route ) return;
908
+		if ( ! $this->_cpt_route) return;
909 909
 		//routing things REALLY early b/c this is a cpt admin page
910
-		set_current_screen( $this->_cpt_routes[$this->_req_action]);
910
+		set_current_screen($this->_cpt_routes[$this->_req_action]);
911 911
 		$this->_current_screen = get_current_screen();
912 912
 		$this->_current_screen->base = 'event-espresso';
913 913
 		$this->_add_help_tabs(); //we make sure we add any help tabs back in!
@@ -928,8 +928,8 @@  discard block
 block discarded – undo
928 928
 	 * @param string $title The new title (or existing if there is no editor_title defined)
929 929
 	 * @return string
930 930
 	 */
931
-	public function add_custom_editor_default_title( $title ) {
932
-		return isset( $this->_labels['editor_title'][$this->_cpt_routes[$this->_req_action]] ) ? $this->_labels['editor_title'][$this->_cpt_routes[$this->_req_action]] : $title;
931
+	public function add_custom_editor_default_title($title) {
932
+		return isset($this->_labels['editor_title'][$this->_cpt_routes[$this->_req_action]]) ? $this->_labels['editor_title'][$this->_cpt_routes[$this->_req_action]] : $title;
933 933
 	}
934 934
 
935 935
 
@@ -942,11 +942,11 @@  discard block
 block discarded – undo
942 942
 	 * @param bool   $allow_slugs Whether to allow post slugs in the shortlink.
943 943
 	 * @return string
944 944
 	 */
945
-	public function add_shortlink_button_to_editor( $shortlink, $id, $context, $allow_slugs ) {
946
-		if ( !empty( $id ) && '' != get_option('permalink_structure') ) {
947
-			$post = get_post( $id );
948
-			if ( isset($post->post_type) && $this->page_slug == $post->post_type )
949
-			$shortlink = home_url('?p=' . $post->ID);
945
+	public function add_shortlink_button_to_editor($shortlink, $id, $context, $allow_slugs) {
946
+		if ( ! empty($id) && '' != get_option('permalink_structure')) {
947
+			$post = get_post($id);
948
+			if (isset($post->post_type) && $this->page_slug == $post->post_type)
949
+			$shortlink = home_url('?p='.$post->ID);
950 950
 		}
951 951
 		return $shortlink;
952 952
 	}
@@ -959,10 +959,10 @@  discard block
 block discarded – undo
959 959
 	 * @return void
960 960
 	 */
961 961
 	public function route_admin_request() {
962
-		if ( $this->_cpt_route ) return;
962
+		if ($this->_cpt_route) return;
963 963
 		try {
964 964
 			$this->_route_admin_request();
965
-		} catch ( EE_Error $e ) {
965
+		} catch (EE_Error $e) {
966 966
 			$e->get_error();
967 967
 		}
968 968
 	}
@@ -975,12 +975,12 @@  discard block
 block discarded – undo
975 975
 	 * @return string html
976 976
 	 */
977 977
 	public function cpt_post_form_hidden_input() {
978
-		echo '<input type="hidden" name="ee_cpt_item_redirect_url" value="' . $this->_admin_base_url . '" />';
978
+		echo '<input type="hidden" name="ee_cpt_item_redirect_url" value="'.$this->_admin_base_url.'" />';
979 979
 
980 980
 		//we're also going to add the route value and the current page so we can direct autosave parsing correctly
981 981
 		echo '<div id="ee-cpt-hidden-inputs">';
982
-		echo '<input type="hidden" id="current_route" name="current_route" value="' . $this->_current_view . '" />';
983
-		echo '<input type="hidden" id="current_page" name="current_page" value="' . $this->page_slug . '" />';
982
+		echo '<input type="hidden" id="current_route" name="current_route" value="'.$this->_current_view.'" />';
983
+		echo '<input type="hidden" id="current_page" name="current_page" value="'.$this->page_slug.'" />';
984 984
 		echo '</div>';
985 985
 	}
986 986
 
@@ -993,12 +993,12 @@  discard block
 block discarded – undo
993 993
 	 * @param  int    $status   Status for http header
994 994
 	 * @return string           new (or original) url to redirect to.
995 995
 	 */
996
-	public function revision_redirect( $location, $status ) {
996
+	public function revision_redirect($location, $status) {
997 997
 		//get revision
998 998
 		$rev_id = isset($this->_req_data['revision']) ? $this->_req_data['revision'] : NULL;
999 999
 
1000 1000
 		//can't do anything without revision so let's get out if not present
1001
-		if ( empty( $rev_id ) )
1001
+		if (empty($rev_id))
1002 1002
 			return $location;
1003 1003
 
1004 1004
 		//get rev_post_data
@@ -1012,8 +1012,8 @@  discard block
 block discarded – undo
1012 1012
 				'message' => 5
1013 1013
 			);
1014 1014
 
1015
-		$this->_process_notices( $query_args, TRUE );
1016
-		return self::add_query_args_and_nonce( $query_args, $admin_url );
1015
+		$this->_process_notices($query_args, TRUE);
1016
+		return self::add_query_args_and_nonce($query_args, $admin_url);
1017 1017
 	}
1018 1018
 
1019 1019
 
@@ -1026,16 +1026,16 @@  discard block
 block discarded – undo
1026 1026
 	 * @param  string $context optional, defaults to display.  How to write the '&'
1027 1027
 	 * @return string          the link
1028 1028
 	 */
1029
-	public function modify_edit_post_link( $link, $id, $context ) {
1030
-		$post = get_post( $id );
1031
-		if ( !isset( $this->_req_data['action'] ) || !isset( $this->_cpt_routes[$this->_req_data['action']] ) || $post->post_type !== $this->_cpt_routes[$this->_req_data['action']] )
1029
+	public function modify_edit_post_link($link, $id, $context) {
1030
+		$post = get_post($id);
1031
+		if ( ! isset($this->_req_data['action']) || ! isset($this->_cpt_routes[$this->_req_data['action']]) || $post->post_type !== $this->_cpt_routes[$this->_req_data['action']])
1032 1032
 			return $link;
1033 1033
 		$query_args = array(
1034 1034
 			'action' => isset($this->_cpt_edit_routes[$post->post_type]) ? $this->_cpt_edit_routes[$post->post_type] : 'edit',
1035 1035
 			'post' => $id
1036 1036
 			);
1037 1037
 
1038
-		return self::add_query_args_and_nonce( $query_args, $this->_admin_base_url );
1038
+		return self::add_query_args_and_nonce($query_args, $this->_admin_base_url);
1039 1039
 	}
1040 1040
 
1041 1041
 
@@ -1047,12 +1047,12 @@  discard block
 block discarded – undo
1047 1047
 	 * @param  bool   $force_delete whether this is forcing a hard delete instead of trash
1048 1048
 	 * @return string               new delete link
1049 1049
 	 */
1050
-	public function modify_delete_post_link( $delete_link, $post_id, $force_delete ) {
1050
+	public function modify_delete_post_link($delete_link, $post_id, $force_delete) {
1051 1051
 		$post = get_post($post_id);
1052
-		if ( !isset( $this->_req_data['action'] ) || ( isset( $this->_cpt_routes[$this->_req_data['action']] ) && $post->post_type !== $this->_cpt_routes[$this->_req_data['action']] ) )
1052
+		if ( ! isset($this->_req_data['action']) || (isset($this->_cpt_routes[$this->_req_data['action']]) && $post->post_type !== $this->_cpt_routes[$this->_req_data['action']]))
1053 1053
 			return $delete_link;
1054 1054
 
1055
-		return add_query_arg( array('current_route' => 'trash' ), $delete_link );
1055
+		return add_query_arg(array('current_route' => 'trash'), $delete_link);
1056 1056
 	}
1057 1057
 
1058 1058
 
@@ -1063,16 +1063,16 @@  discard block
 block discarded – undo
1063 1063
 	 * @param  string $status   status
1064 1064
 	 * @return string           url to redirect to
1065 1065
 	 */
1066
-	public function cpt_trash_post_location_redirect( $location, $status ) {
1067
-		if ( isset( $this->_req_data['action'] ) && $this->_req_data['action'] !== 'trash' && empty( $this->_req_data['post'] ) )
1066
+	public function cpt_trash_post_location_redirect($location, $status) {
1067
+		if (isset($this->_req_data['action']) && $this->_req_data['action'] !== 'trash' && empty($this->_req_data['post']))
1068 1068
 			return $location;
1069 1069
 
1070
-		$post = get_post( $this->_req_data['post'] );
1071
-		$query_args = array( 'action' => 'default' );
1070
+		$post = get_post($this->_req_data['post']);
1071
+		$query_args = array('action' => 'default');
1072 1072
 		$this->_cpt_object = get_post_type_object($post->post_type);
1073
-		EE_Error::add_success( sprintf( __('%s trashed.', 'event_espresso'), $this->_cpt_object->labels->singular_name) );
1074
-		$this->_process_notices( $query_args, TRUE );
1075
-		return self::add_query_args_and_nonce( $query_args, $this->_admin_base_url );
1073
+		EE_Error::add_success(sprintf(__('%s trashed.', 'event_espresso'), $this->_cpt_object->labels->singular_name));
1074
+		$this->_process_notices($query_args, TRUE);
1075
+		return self::add_query_args_and_nonce($query_args, $this->_admin_base_url);
1076 1076
 	}
1077 1077
 
1078 1078
 
@@ -1087,7 +1087,7 @@  discard block
 block discarded – undo
1087 1087
 	 * @param  string $post_id  This is the 'ID' value of the wp_posts table
1088 1088
 	 * @return string           the new location to redirect to
1089 1089
 	 */
1090
-	public function cpt_post_location_redirect( $location, $post_id ) {
1090
+	public function cpt_post_location_redirect($location, $post_id) {
1091 1091
 		//we DO have a match so let's setup the url
1092 1092
 
1093 1093
 		//we have to get the post to determine our route
@@ -1095,14 +1095,14 @@  discard block
 block discarded – undo
1095 1095
 		$edit_route = $this->_cpt_edit_routes[$post->post_type];
1096 1096
 
1097 1097
 		//shared query_args
1098
-		$query_args = array( 'action' => $edit_route, 'post' => $post_id );
1098
+		$query_args = array('action' => $edit_route, 'post' => $post_id);
1099 1099
 		$admin_url = $this->_admin_base_url;
1100 1100
 //		$append = '';
1101 1101
 
1102
-		if ( isset( $this->_req_data['save'] ) || isset( $this->_req_data['publish'] ) ) {
1103
-			$status = get_post_status( $post_id );
1104
-			if ( isset( $this->_req_data['publish'] ) ) {
1105
-				switch ( $status ) {
1102
+		if (isset($this->_req_data['save']) || isset($this->_req_data['publish'])) {
1103
+			$status = get_post_status($post_id);
1104
+			if (isset($this->_req_data['publish'])) {
1105
+				switch ($status) {
1106 1106
 					case 'pending':
1107 1107
 						$message = 8;
1108 1108
 						break;
@@ -1115,13 +1115,13 @@  discard block
 block discarded – undo
1115 1115
 			} else {
1116 1116
 					$message = 'draft' == $status ? 10 : 1;
1117 1117
 			}
1118
-		} else if ( isset( $this->_req_data['addmeta']) && $this->_req_data['addmeta'] ) {
1118
+		} else if (isset($this->_req_data['addmeta']) && $this->_req_data['addmeta']) {
1119 1119
 			$message = 2;
1120 1120
 //			$append = '#postcustom';
1121
-		} else if ( isset( $this->_req_data['deletemeta']) && $this->_req_data['deletemeta'] ) {
1121
+		} else if (isset($this->_req_data['deletemeta']) && $this->_req_data['deletemeta']) {
1122 1122
 			$message = 3;
1123 1123
 //			$append = '#postcustom';
1124
-		} elseif ( $this->_req_data['action'] == 'post-quickpress-save-cont' ) {
1124
+		} elseif ($this->_req_data['action'] == 'post-quickpress-save-cont') {
1125 1125
 			$message = 7;
1126 1126
 		} else {
1127 1127
 			$message = 4;
@@ -1129,12 +1129,12 @@  discard block
 block discarded – undo
1129 1129
 
1130 1130
 		//change the message if the post type is not viewable on the frontend
1131 1131
 		$this->_cpt_object = get_post_type_object($post->post_type);
1132
-		$message = $message === 1 && !$this->_cpt_object->publicly_queryable ? 4 : $message;
1132
+		$message = $message === 1 && ! $this->_cpt_object->publicly_queryable ? 4 : $message;
1133 1133
 
1134
-		$query_args = array_merge( array( 'message' => $message ), $query_args );
1134
+		$query_args = array_merge(array('message' => $message), $query_args);
1135 1135
 
1136
-		$this->_process_notices( $query_args, TRUE );
1137
-		return self::add_query_args_and_nonce( $query_args, $admin_url );
1136
+		$this->_process_notices($query_args, TRUE);
1137
+		return self::add_query_args_and_nonce($query_args, $admin_url);
1138 1138
 	}
1139 1139
 
1140 1140
 
@@ -1166,10 +1166,10 @@  discard block
 block discarded – undo
1166 1166
 	 * @param  array $messages the original messages array
1167 1167
 	 * @return array           the new messages array
1168 1168
 	 */
1169
-	public function post_update_messages( $messages ) {
1169
+	public function post_update_messages($messages) {
1170 1170
 		global $post;
1171
-		$id = isset( $this->_req_data['post'] ) ? $this->_req_data['post'] : NULL;
1172
-		$id = empty( $id ) && is_object( $post ) ? $post->ID : NULL;
1171
+		$id = isset($this->_req_data['post']) ? $this->_req_data['post'] : NULL;
1172
+		$id = empty($id) && is_object($post) ? $post->ID : NULL;
1173 1173
 
1174 1174
 //		$post_type = $post ? $post->post_type : false;
1175 1175
 
@@ -1182,9 +1182,9 @@  discard block
 block discarded – undo
1182 1182
 			0 => '', //Unused. Messages start at index 1.
1183 1183
 
1184 1184
 			1 => sprintf(
1185
-				__( '%1$s updated. %2$sView %1$s%3$s', 'event_espresso'),
1185
+				__('%1$s updated. %2$sView %1$s%3$s', 'event_espresso'),
1186 1186
 				$this->_cpt_object->labels->singular_name,
1187
-				'<a href="' . esc_url( get_permalink( $id )) . '">',
1187
+				'<a href="'.esc_url(get_permalink($id)).'">',
1188 1188
 				'</a>'
1189 1189
 			),
1190 1190
 
@@ -1192,38 +1192,38 @@  discard block
 block discarded – undo
1192 1192
 
1193 1193
 			3 => __('Custom field deleted.'),
1194 1194
 
1195
-			4 => sprintf( __( '%1$s updated.', 'event_espresso'), $this->_cpt_object->labels->singular_name ),
1195
+			4 => sprintf(__('%1$s updated.', 'event_espresso'), $this->_cpt_object->labels->singular_name),
1196 1196
 
1197
-			5 => isset( $_GET['revision'] ) ? sprintf( __('%s restored to revision from %s', 'event_espresso'), $this->_cpt_object->labels->singular_name, wp_post_revision_title( (int) $_GET['revision'], FALSE ) ) : FALSE,
1197
+			5 => isset($_GET['revision']) ? sprintf(__('%s restored to revision from %s', 'event_espresso'), $this->_cpt_object->labels->singular_name, wp_post_revision_title((int) $_GET['revision'], FALSE)) : FALSE,
1198 1198
 
1199 1199
 			6 => sprintf(
1200
-					__( '%1$s published. %2$sView %1$s%3$s', 'event_espresso'),
1200
+					__('%1$s published. %2$sView %1$s%3$s', 'event_espresso'),
1201 1201
 					$this->_cpt_object->labels->singular_name,
1202
-					'<a href="' . esc_url( get_permalink( $id )) . '">',
1202
+					'<a href="'.esc_url(get_permalink($id)).'">',
1203 1203
 					'</a>'
1204 1204
 				),
1205 1205
 
1206
-			7 => sprintf( __( '%1$s saved.', 'event_espresso'), $this->_cpt_object->labels->singular_name ),
1206
+			7 => sprintf(__('%1$s saved.', 'event_espresso'), $this->_cpt_object->labels->singular_name),
1207 1207
 
1208 1208
 			8 => sprintf(
1209 1209
 				__('%1$s submitted. %2$sPreview %1$s%3$s', 'event_espresso'),
1210 1210
 				$this->_cpt_object->labels->singular_name,
1211
-				'<a target="_blank" href="' . esc_url( add_query_arg( 'preview', 'true', get_permalink( $id ))) . '">',
1211
+				'<a target="_blank" href="'.esc_url(add_query_arg('preview', 'true', get_permalink($id))).'">',
1212 1212
 				'</a>'
1213 1213
 			),
1214 1214
 
1215 1215
 			9 => sprintf(
1216
-				__( '%1$s scheduled for: %2$s. %3$s">Preview %1$s%3$s', 'event_espresso'),
1216
+				__('%1$s scheduled for: %2$s. %3$s">Preview %1$s%3$s', 'event_espresso'),
1217 1217
 				$this->_cpt_object->labels->singular_name,
1218
-				'<strong>' . date_i18n( __( 'M j, Y @ G:i' ), strtotime( $post->post_date )) . '</strong>',
1219
-				'<a target="_blank" href="' . esc_url( get_permalink( $id )),
1218
+				'<strong>'.date_i18n(__('M j, Y @ G:i'), strtotime($post->post_date)).'</strong>',
1219
+				'<a target="_blank" href="'.esc_url(get_permalink($id)),
1220 1220
 				'</a>'
1221 1221
 			),
1222 1222
 
1223 1223
 			10 => sprintf(
1224 1224
 				__('%1$s draft updated. %2$s">Preview page%3$s', 'event_espresso'),
1225 1225
 				$this->_cpt_object->labels->singular_name,
1226
-				'<a target="_blank" href="' . esc_url( add_query_arg( 'preview', 'true', get_permalink( $id ))) ,
1226
+				'<a target="_blank" href="'.esc_url(add_query_arg('preview', 'true', get_permalink($id))),
1227 1227
 				'</a>'
1228 1228
 			)
1229 1229
 		);
@@ -1250,24 +1250,24 @@  discard block
 block discarded – undo
1250 1250
 		$post_type_object = $this->_cpt_object;
1251 1251
 		$title = $post_type_object->labels->add_new_item;
1252 1252
 		$editing = TRUE;
1253
-		wp_enqueue_script( 'autosave' );
1254
-		$post = $post = get_default_post_to_edit( $this->_cpt_routes[$this->_req_action], TRUE );
1253
+		wp_enqueue_script('autosave');
1254
+		$post = $post = get_default_post_to_edit($this->_cpt_routes[$this->_req_action], TRUE);
1255 1255
 		$post_ID = $post->ID;
1256 1256
 		$is_IE = $is_IE;
1257 1257
 
1258
-		add_action( 'admin_print_styles', array( $this, 'add_new_admin_page_global' ) );
1258
+		add_action('admin_print_styles', array($this, 'add_new_admin_page_global'));
1259 1259
 
1260 1260
 		//modify the default editor title field with default title.
1261
-		add_filter('enter_title_here', array( $this, 'add_custom_editor_default_title' ), 10 );
1261
+		add_filter('enter_title_here', array($this, 'add_custom_editor_default_title'), 10);
1262 1262
 
1263
-		include_once WP_ADMIN_PATH . 'edit-form-advanced.php';
1263
+		include_once WP_ADMIN_PATH.'edit-form-advanced.php';
1264 1264
 	}
1265 1265
 
1266 1266
 
1267 1267
 
1268 1268
 
1269 1269
 	public function add_new_admin_page_global() {
1270
-		$admin_page = !empty( $this->_req_data['post'] ) ? 'post-php' : 'post-new-php';
1270
+		$admin_page = ! empty($this->_req_data['post']) ? 'post-php' : 'post-new-php';
1271 1271
 		?>
1272 1272
 		<script type="text/javascript">
1273 1273
 			adminpage = '<?php echo $admin_page; ?>';
@@ -1289,16 +1289,16 @@  discard block
 block discarded – undo
1289 1289
 	 */
1290 1290
 	protected function _edit_cpt_item() {
1291 1291
 		global $post, $title, $is_IE, $post_type, $post_type_object;
1292
-		$post_id = isset( $this->_req_data['post'] ) ? $this->_req_data['post'] : NULL;
1293
-		$post = !empty( $post_id ) ? get_post( $post_id, OBJECT, 'edit' ) : NULL;
1292
+		$post_id = isset($this->_req_data['post']) ? $this->_req_data['post'] : NULL;
1293
+		$post = ! empty($post_id) ? get_post($post_id, OBJECT, 'edit') : NULL;
1294 1294
 
1295
-		if ( empty ( $post ) ) {
1296
-			wp_die( __('You attempted to edit an item that doesn&#8217;t exist. Perhaps it was deleted?') );
1295
+		if (empty ($post)) {
1296
+			wp_die(__('You attempted to edit an item that doesn&#8217;t exist. Perhaps it was deleted?'));
1297 1297
 		}
1298 1298
 
1299
-		if ( ! empty( $_GET['get-post-lock'] ) ) {
1300
-			wp_set_post_lock( $post_id );
1301
-			wp_redirect( get_edit_post_link( $post_id, 'url' ) );
1299
+		if ( ! empty($_GET['get-post-lock'])) {
1300
+			wp_set_post_lock($post_id);
1301
+			wp_redirect(get_edit_post_link($post_id, 'url'));
1302 1302
 			exit();
1303 1303
 		}
1304 1304
 
@@ -1310,32 +1310,32 @@  discard block
 block discarded – undo
1310 1310
 		$post_type_object = $this->_cpt_object;
1311 1311
 		$is_IE = $is_IE;
1312 1312
 
1313
-		if ( ! wp_check_post_lock( $post->ID ) ) {
1314
-			$active_post_lock = wp_set_post_lock( $post->ID );
1313
+		if ( ! wp_check_post_lock($post->ID)) {
1314
+			$active_post_lock = wp_set_post_lock($post->ID);
1315 1315
 			//wp_enqueue_script('autosave');
1316 1316
 		}
1317 1317
 
1318 1318
 		$title = $this->_cpt_object->labels->edit_item;
1319 1319
 
1320
-		add_action('admin_footer', '_admin_notice_post_locked' );
1320
+		add_action('admin_footer', '_admin_notice_post_locked');
1321 1321
 
1322
-		if ( isset( $this->_cpt_routes[$this->_req_data['action']] ) && !isset( $this->_labels['hide_add_button_on_cpt_route'][$this->_req_data['action']] ) ) {
1323
-			$create_new_action = apply_filters( 'FHEE__EE_Admin_Page_CPT___edit_cpt_item__create_new_action', 'create_new', $this );
1322
+		if (isset($this->_cpt_routes[$this->_req_data['action']]) && ! isset($this->_labels['hide_add_button_on_cpt_route'][$this->_req_data['action']])) {
1323
+			$create_new_action = apply_filters('FHEE__EE_Admin_Page_CPT___edit_cpt_item__create_new_action', 'create_new', $this);
1324 1324
 
1325
-			$post_new_file = EE_Admin_Page::add_query_args_and_nonce( array('action' => $create_new_action, 'page' => $this->page_slug), 'admin.php' );
1325
+			$post_new_file = EE_Admin_Page::add_query_args_and_nonce(array('action' => $create_new_action, 'page' => $this->page_slug), 'admin.php');
1326 1326
 		}
1327 1327
 
1328
-		if ( post_type_supports($this->_cpt_routes[$this->_req_action], 'comments') ) {
1328
+		if (post_type_supports($this->_cpt_routes[$this->_req_action], 'comments')) {
1329 1329
 			wp_enqueue_script('admin-comments');
1330 1330
 			enqueue_comment_hotkeys_js();
1331 1331
 		}
1332 1332
 
1333
-		add_action( 'admin_print_styles', array( $this, 'add_new_admin_page_global' ) );
1333
+		add_action('admin_print_styles', array($this, 'add_new_admin_page_global'));
1334 1334
 
1335 1335
 		//modify the default editor title field with default title.
1336
-		add_filter('enter_title_here', array( $this, 'add_custom_editor_default_title' ), 10 );
1336
+		add_filter('enter_title_here', array($this, 'add_custom_editor_default_title'), 10);
1337 1337
 
1338
-		include_once WP_ADMIN_PATH . 'edit-form-advanced.php';
1338
+		include_once WP_ADMIN_PATH.'edit-form-advanced.php';
1339 1339
 
1340 1340
 	}
1341 1341
 
Please login to merge, or discard this patch.
core/db_models/EEM_Datetime.model.php 2 patches
Indentation   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -75,11 +75,11 @@  discard block
 block discarded – undo
75 75
 
76 76
 
77 77
 	/**
78
-	*		create new blank datetime
79
-	*
80
-	* 		@access		public
81
-	*		@return 		EE_Datetime[]		array on success, FALSE on fail
82
-	*/
78
+	 *		create new blank datetime
79
+	 *
80
+	 * 		@access		public
81
+	 *		@return 		EE_Datetime[]		array on success, FALSE on fail
82
+	 */
83 83
 	public function create_new_blank_datetime() {
84 84
 		$blank_datetime = EE_Datetime::new_instance(
85 85
 			array(
@@ -100,12 +100,12 @@  discard block
 block discarded – undo
100 100
 
101 101
 
102 102
 	/**
103
-	*		get event start date from db
104
-	*
105
-	* 		@access		public
106
-	* 		@param		int 			$EVT_ID
107
-	*		@return 		EE_Datetime[]		array on success, FALSE on fail
108
-	*/
103
+	 *		get event start date from db
104
+	 *
105
+	 * 		@access		public
106
+	 * 		@param		int 			$EVT_ID
107
+	 *		@return 		EE_Datetime[]		array on success, FALSE on fail
108
+	 */
109 109
 	public function get_all_event_dates( $EVT_ID = 0 ) {
110 110
 		if ( ! $EVT_ID ) { // on add_new_event event_id gets set to 0
111 111
 			return $this->create_new_blank_datetime();
@@ -250,14 +250,14 @@  discard block
 block discarded – undo
250 250
 	}
251 251
 
252 252
 		/**
253
-	 * Gets ALL the datetimes for an ticket (including trashed ones, for now), ordered
254
-	 * only by start date
255
-	 * @param int $TKT_ID
256
-	 * @param boolean $include_expired
257
-	 * @param boolean $include_deleted
258
-	 * @param int $limit
259
-	 * @return EE_Datetime[]
260
-	 */
253
+		 * Gets ALL the datetimes for an ticket (including trashed ones, for now), ordered
254
+		 * only by start date
255
+		 * @param int $TKT_ID
256
+		 * @param boolean $include_expired
257
+		 * @param boolean $include_deleted
258
+		 * @param int $limit
259
+		 * @return EE_Datetime[]
260
+		 */
261 261
 	public function get_datetimes_for_ticket_ordered_by_start_time($TKT_ID, $include_expired = true, $include_deleted= true, $limit = NULL){
262 262
 		//sanitize TKT_ID
263 263
 		$TKT_ID =  intval( $TKT_ID );
Please login to merge, or discard this patch.
Spacing   +118 added lines, -118 removed lines patch added patch discarded remove patch
@@ -21,8 +21,8 @@  discard block
 block discarded – undo
21 21
  *
22 22
  * ------------------------------------------------------------------------
23 23
  */
24
-require_once ( EE_MODELS . 'EEM_Soft_Delete_Base.model.php' );
25
-require_once ( EE_CLASSES . 'EE_Datetime.class.php' );
24
+require_once (EE_MODELS.'EEM_Soft_Delete_Base.model.php');
25
+require_once (EE_CLASSES.'EE_Datetime.class.php');
26 26
 
27 27
 class EEM_Datetime extends EEM_Soft_Delete_Base {
28 28
 
@@ -35,27 +35,27 @@  discard block
 block discarded – undo
35 35
 	 *		@access private
36 36
 	 *		@param string $timezone string representing the timezone we want to set for returned Date Time Strings (and any incoming timezone data that gets saved).  Note this just sends the timezone info to the date time model field objects.  Default is NULL (and will be assumed using the set timezone in the 'timezone_string' wp option)
37 37
 	 */
38
-	protected function __construct( $timezone ) {
39
-		$this->singular_item = __('Datetime','event_espresso');
40
-		$this->plural_item = __('Datetimes','event_espresso');
38
+	protected function __construct($timezone) {
39
+		$this->singular_item = __('Datetime', 'event_espresso');
40
+		$this->plural_item = __('Datetimes', 'event_espresso');
41 41
 
42 42
 		$this->_tables = array(
43 43
 			'Datetime'=> new EE_Primary_Table('esp_datetime', 'DTT_ID')
44 44
 		);
45 45
 		$this->_fields = array(
46 46
 			'Datetime'=>array(
47
-				'DTT_ID'=> new EE_Primary_Key_Int_Field('DTT_ID', __('Datetime ID','event_espresso')),
48
-				'EVT_ID'=>new EE_Foreign_Key_Int_Field('EVT_ID', __('Event ID','event_espresso'), false, 0, 'Event'),
47
+				'DTT_ID'=> new EE_Primary_Key_Int_Field('DTT_ID', __('Datetime ID', 'event_espresso')),
48
+				'EVT_ID'=>new EE_Foreign_Key_Int_Field('EVT_ID', __('Event ID', 'event_espresso'), false, 0, 'Event'),
49 49
 				'DTT_name' => new EE_Plain_Text_Field('DTT_name', __('Datetime Name', 'event_espresso'), false, ''),
50 50
 				'DTT_description' => new EE_Full_HTML_Field('DTT_description', __('Description for Datetime', 'event_espresso'), false, ''),
51
-				'DTT_EVT_start'=>new EE_Datetime_Field('DTT_EVT_start', __('Start time/date of Event','event_espresso'), false, time(), $timezone ),
52
-				'DTT_EVT_end'=>new EE_Datetime_Field('DTT_EVT_end', __('End time/date of Event','event_espresso'), false, time(), $timezone ),
53
-				'DTT_reg_limit'=>new EE_Infinite_Integer_Field('DTT_reg_limit', __('Registration Limit for this time','event_espresso'), true, EE_INF),
54
-				'DTT_sold'=>new EE_Integer_Field('DTT_sold', __('How many sales for this Datetime that have occurred', 'event_espresso'), true, 0 ),
55
-				'DTT_is_primary'=>new EE_Boolean_Field('DTT_is_primary', __("Flag indicating datetime is primary one for event", "event_espresso"), false,false),
51
+				'DTT_EVT_start'=>new EE_Datetime_Field('DTT_EVT_start', __('Start time/date of Event', 'event_espresso'), false, time(), $timezone),
52
+				'DTT_EVT_end'=>new EE_Datetime_Field('DTT_EVT_end', __('End time/date of Event', 'event_espresso'), false, time(), $timezone),
53
+				'DTT_reg_limit'=>new EE_Infinite_Integer_Field('DTT_reg_limit', __('Registration Limit for this time', 'event_espresso'), true, EE_INF),
54
+				'DTT_sold'=>new EE_Integer_Field('DTT_sold', __('How many sales for this Datetime that have occurred', 'event_espresso'), true, 0),
55
+				'DTT_is_primary'=>new EE_Boolean_Field('DTT_is_primary', __("Flag indicating datetime is primary one for event", "event_espresso"), false, false),
56 56
 				'DTT_order' => new EE_Integer_Field('DTT_order', __('The order in which the Datetime is displayed', 'event_espresso'), false, 0),
57
-				'DTT_parent' => new EE_Integer_Field('DTT_parent', __('Indicates what DTT_ID is the parent of this DTT_ID'), true, 0 ),
58
-				'DTT_deleted' => new EE_Trashed_Flag_Field('DTT_deleted', __('Flag indicating datetime is archived', 'event_espresso'), false, false ),
57
+				'DTT_parent' => new EE_Integer_Field('DTT_parent', __('Indicates what DTT_ID is the parent of this DTT_ID'), true, 0),
58
+				'DTT_deleted' => new EE_Trashed_Flag_Field('DTT_deleted', __('Flag indicating datetime is archived', 'event_espresso'), false, false),
59 59
 			));
60 60
 		$this->_model_relations = array(
61 61
 			'Ticket'=>new EE_HABTM_Relation('Datetime_Ticket'),
@@ -64,11 +64,11 @@  discard block
 block discarded – undo
64 64
 		);
65 65
 		$this->_model_chain_to_wp_user = 'Event';
66 66
 		//this model is generally available for reading
67
-		$this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Event_Related_Public( 'Event' );
68
-		$this->_cap_restriction_generators[ EEM_Base::caps_read_admin ] = new EE_Restriction_Generator_Event_Related_Protected( 'Event' );
69
-		$this->_cap_restriction_generators[ EEM_Base::caps_edit ] = new EE_Restriction_Generator_Event_Related_Protected( 'Event' );
70
-		$this->_cap_restriction_generators[ EEM_Base::caps_delete ] = new EE_Restriction_Generator_Event_Related_Protected( 'Event', EEM_Base::caps_edit );
71
-		parent::__construct( $timezone );
67
+		$this->_cap_restriction_generators[EEM_Base::caps_read] = new EE_Restriction_Generator_Event_Related_Public('Event');
68
+		$this->_cap_restriction_generators[EEM_Base::caps_read_admin] = new EE_Restriction_Generator_Event_Related_Protected('Event');
69
+		$this->_cap_restriction_generators[EEM_Base::caps_edit] = new EE_Restriction_Generator_Event_Related_Protected('Event');
70
+		$this->_cap_restriction_generators[EEM_Base::caps_delete] = new EE_Restriction_Generator_Event_Related_Protected('Event', EEM_Base::caps_edit);
71
+		parent::__construct($timezone);
72 72
 	}
73 73
 
74 74
 
@@ -83,16 +83,16 @@  discard block
 block discarded – undo
83 83
 	public function create_new_blank_datetime() {
84 84
 		$blank_datetime = EE_Datetime::new_instance(
85 85
 			array(
86
-				'DTT_EVT_start' => $this->current_time_for_query( 'DTT_EVT_start', true ) + (60 * 60 * 24 * 30),
87
-				'DTT_EVT_end' => $this->current_time_for_query( 'DTT_EVT_end', true ) + (60 * 60 * 24 * 30),
86
+				'DTT_EVT_start' => $this->current_time_for_query('DTT_EVT_start', true) + (60 * 60 * 24 * 30),
87
+				'DTT_EVT_end' => $this->current_time_for_query('DTT_EVT_end', true) + (60 * 60 * 24 * 30),
88 88
 				'DTT_order' => 1,
89 89
 				'DTT_reg_limit' => EE_INF
90 90
 			),
91 91
 			$this->_timezone
92 92
 		);
93
-		$blank_datetime->set_start_time( $this->convert_datetime_for_query( 'DTT_EVT_start', '8am', 'ga', $this->_timezone ) );
94
-		$blank_datetime->set_end_time( $this->convert_datetime_for_query( 'DTT_EVT_end', '5pm', 'ga', $this->_timezone ) );
95
-		return array( $blank_datetime );
93
+		$blank_datetime->set_start_time($this->convert_datetime_for_query('DTT_EVT_start', '8am', 'ga', $this->_timezone));
94
+		$blank_datetime->set_end_time($this->convert_datetime_for_query('DTT_EVT_end', '5pm', 'ga', $this->_timezone));
95
+		return array($blank_datetime);
96 96
 	}
97 97
 
98 98
 
@@ -106,13 +106,13 @@  discard block
 block discarded – undo
106 106
 	* 		@param		int 			$EVT_ID
107 107
 	*		@return 		EE_Datetime[]		array on success, FALSE on fail
108 108
 	*/
109
-	public function get_all_event_dates( $EVT_ID = 0 ) {
110
-		if ( ! $EVT_ID ) { // on add_new_event event_id gets set to 0
109
+	public function get_all_event_dates($EVT_ID = 0) {
110
+		if ( ! $EVT_ID) { // on add_new_event event_id gets set to 0
111 111
 			return $this->create_new_blank_datetime();
112 112
 		}
113
-		$results =  $this->get_datetimes_for_event_ordered_by_DTT_order($EVT_ID);
113
+		$results = $this->get_datetimes_for_event_ordered_by_DTT_order($EVT_ID);
114 114
 
115
-		if ( empty( $results ) ) {
115
+		if (empty($results)) {
116 116
 			return $this->create_new_blank_datetime();
117 117
 		}
118 118
 
@@ -133,26 +133,26 @@  discard block
 block discarded – undo
133 133
 	 *                        	the given number
134 134
 	 * @return EE_Datetime[]
135 135
 	 */
136
-	public function get_datetimes_for_event_ordered_by_DTT_order( $EVT_ID, $include_expired = TRUE, $include_deleted= TRUE, $limit = NULL  ) {
136
+	public function get_datetimes_for_event_ordered_by_DTT_order($EVT_ID, $include_expired = TRUE, $include_deleted = TRUE, $limit = NULL) {
137 137
 
138 138
 		//sanitize EVT_ID
139
-		$EVT_ID = intval( $EVT_ID );
139
+		$EVT_ID = intval($EVT_ID);
140 140
 
141 141
 		$old_assumption = $this->get_assumption_concerning_values_already_prepared_by_model_object();
142
-		$this->assume_values_already_prepared_by_model_object( EEM_Base::prepared_for_use_in_db );
143
-		$where_params = array( 'Event.EVT_ID' => $EVT_ID );
142
+		$this->assume_values_already_prepared_by_model_object(EEM_Base::prepared_for_use_in_db);
143
+		$where_params = array('Event.EVT_ID' => $EVT_ID);
144 144
 
145
-		$query_params = ! empty( $limit ) ? array( $where_params, 'limit' => $limit, 'order_by' => array( 'DTT_order' => 'ASC' ), 'default_where_conditions' => 'none' ) : array( $where_params, 'order_by' => array( 'DTT_order' => 'ASC' ), 'default_where_conditions' => 'none' );
145
+		$query_params = ! empty($limit) ? array($where_params, 'limit' => $limit, 'order_by' => array('DTT_order' => 'ASC'), 'default_where_conditions' => 'none') : array($where_params, 'order_by' => array('DTT_order' => 'ASC'), 'default_where_conditions' => 'none');
146 146
 
147
-		if( ! $include_expired){
148
-			$query_params[0]['DTT_EVT_end'] = array( '>=', current_time( 'mysql', TRUE ) );
147
+		if ( ! $include_expired) {
148
+			$query_params[0]['DTT_EVT_end'] = array('>=', current_time('mysql', TRUE));
149 149
 		}
150
-		if( $include_deleted){
151
-			$query_params[0]['DTT_deleted'] = array( 'IN', array( TRUE, FALSE ));
150
+		if ($include_deleted) {
151
+			$query_params[0]['DTT_deleted'] = array('IN', array(TRUE, FALSE));
152 152
 		}
153 153
 
154
-		$result = $this->get_all( $query_params );
155
-		$this->assume_values_already_prepared_by_model_object( $old_assumption );
154
+		$result = $this->get_all($query_params);
155
+		$this->assume_values_already_prepared_by_model_object($old_assumption);
156 156
 		return $result;
157 157
 	}
158 158
 
@@ -167,8 +167,8 @@  discard block
 block discarded – undo
167 167
 	 * @param int $limit
168 168
 	 * @return EE_Datetime[]
169 169
 	 */
170
-	public function get_datetimes_for_event_ordered_by_importance( $EVT_ID = 0, $limit = NULL){
171
-		return $this->get_all( array(array('Event.EVT_ID'=>$EVT_ID),
170
+	public function get_datetimes_for_event_ordered_by_importance($EVT_ID = 0, $limit = NULL) {
171
+		return $this->get_all(array(array('Event.EVT_ID'=>$EVT_ID),
172 172
 			'limit'=>$limit,
173 173
 			'order_by'=>array('DTT_EVT_start'=>'ASC'),
174 174
 			'default_where_conditions' => 'none'));
@@ -183,11 +183,11 @@  discard block
 block discarded – undo
183 183
 	 * @param boolean $include_deleted
184 184
 	 * @return EE_Datetime
185 185
 	 */
186
-	public function get_oldest_datetime_for_event($EVT_ID, $include_expired = false,$include_deleted = false){
187
-		$results =  $this->get_datetimes_for_event_ordered_by_start_time($EVT_ID, $include_expired, $include_deleted, 1);
188
-		if($results){
186
+	public function get_oldest_datetime_for_event($EVT_ID, $include_expired = false, $include_deleted = false) {
187
+		$results = $this->get_datetimes_for_event_ordered_by_start_time($EVT_ID, $include_expired, $include_deleted, 1);
188
+		if ($results) {
189 189
 			return array_shift($results);
190
-		}else{
190
+		} else {
191 191
 			return NULL;
192 192
 		}
193 193
 	}
@@ -201,16 +201,16 @@  discard block
 block discarded – undo
201 201
 	 * @param bool $try_to_exclude_deleted
202 202
 	 * @return \EE_Datetime
203 203
 	 */
204
-	public function get_primary_datetime_for_event($EVT_ID,$try_to_exclude_expired = true, $try_to_exclude_deleted = true){
205
-		if($try_to_exclude_expired){
206
-			$non_expired = $this->get_oldest_datetime_for_event($EVT_ID, false,false);
207
-			if($non_expired){
204
+	public function get_primary_datetime_for_event($EVT_ID, $try_to_exclude_expired = true, $try_to_exclude_deleted = true) {
205
+		if ($try_to_exclude_expired) {
206
+			$non_expired = $this->get_oldest_datetime_for_event($EVT_ID, false, false);
207
+			if ($non_expired) {
208 208
 				return $non_expired;
209 209
 			}
210 210
 		}
211
-		if($try_to_exclude_deleted){
211
+		if ($try_to_exclude_deleted) {
212 212
 			$expired_even = $this->get_oldest_datetime_for_event($EVT_ID, true);
213
-			if($expired_even){
213
+			if ($expired_even) {
214 214
 				return $expired_even;
215 215
 			}
216 216
 		}
@@ -229,23 +229,23 @@  discard block
 block discarded – undo
229 229
 	 * @param int $limit
230 230
 	 * @return EE_Datetime[]
231 231
 	 */
232
-	public function get_datetimes_for_event_ordered_by_start_time($EVT_ID, $include_expired = true, $include_deleted= true, $limit = NULL ){
232
+	public function get_datetimes_for_event_ordered_by_start_time($EVT_ID, $include_expired = true, $include_deleted = true, $limit = NULL) {
233 233
 		//sanitize EVT_ID
234
-		$EVT_ID = intval( $EVT_ID );
234
+		$EVT_ID = intval($EVT_ID);
235 235
 		$old_assumption = $this->get_assumption_concerning_values_already_prepared_by_model_object();
236
-		$this->assume_values_already_prepared_by_model_object( EEM_Base::prepared_for_use_in_db );
237
-		$query_params =array(array('Event.EVT_ID'=>$EVT_ID),'order_by'=>array('DTT_EVT_start'=>'asc'));
238
-		if( ! $include_expired){
239
-			$query_params[0]['DTT_EVT_end'] = array('>=',current_time('mysql', TRUE));
236
+		$this->assume_values_already_prepared_by_model_object(EEM_Base::prepared_for_use_in_db);
237
+		$query_params = array(array('Event.EVT_ID'=>$EVT_ID), 'order_by'=>array('DTT_EVT_start'=>'asc'));
238
+		if ( ! $include_expired) {
239
+			$query_params[0]['DTT_EVT_end'] = array('>=', current_time('mysql', TRUE));
240 240
 		}
241
-		if( $include_deleted){
242
-			$query_params[0]['DTT_deleted'] = array('IN',array(true,false));
241
+		if ($include_deleted) {
242
+			$query_params[0]['DTT_deleted'] = array('IN', array(true, false));
243 243
 		}
244
-		if($limit){
244
+		if ($limit) {
245 245
 			$query_params['limit'] = $limit;
246 246
 		}
247
-		$result = $this->get_all( $query_params );
248
-		$this->assume_values_already_prepared_by_model_object( $old_assumption );
247
+		$result = $this->get_all($query_params);
248
+		$this->assume_values_already_prepared_by_model_object($old_assumption);
249 249
 		return $result;
250 250
 	}
251 251
 
@@ -258,23 +258,23 @@  discard block
 block discarded – undo
258 258
 	 * @param int $limit
259 259
 	 * @return EE_Datetime[]
260 260
 	 */
261
-	public function get_datetimes_for_ticket_ordered_by_start_time($TKT_ID, $include_expired = true, $include_deleted= true, $limit = NULL){
261
+	public function get_datetimes_for_ticket_ordered_by_start_time($TKT_ID, $include_expired = true, $include_deleted = true, $limit = NULL) {
262 262
 		//sanitize TKT_ID
263
-		$TKT_ID =  intval( $TKT_ID );
263
+		$TKT_ID = intval($TKT_ID);
264 264
 		$old_assumption = $this->get_assumption_concerning_values_already_prepared_by_model_object();
265
-		$this->assume_values_already_prepared_by_model_object( EEM_Base::prepared_for_use_in_db );
266
-		$query_params =array(array('Ticket.TKT_ID'=>$TKT_ID),'order_by'=>array('DTT_EVT_start'=>'asc'));
267
-		if( ! $include_expired){
268
-			$query_params[0]['DTT_EVT_end'] = array('>=',current_time('mysql', TRUE));
265
+		$this->assume_values_already_prepared_by_model_object(EEM_Base::prepared_for_use_in_db);
266
+		$query_params = array(array('Ticket.TKT_ID'=>$TKT_ID), 'order_by'=>array('DTT_EVT_start'=>'asc'));
267
+		if ( ! $include_expired) {
268
+			$query_params[0]['DTT_EVT_end'] = array('>=', current_time('mysql', TRUE));
269 269
 		}
270
-		if( $include_deleted){
271
-			$query_params[0]['DTT_deleted'] = array('IN',array(true,false));
270
+		if ($include_deleted) {
271
+			$query_params[0]['DTT_deleted'] = array('IN', array(true, false));
272 272
 		}
273
-		if($limit){
273
+		if ($limit) {
274 274
 			$query_params['limit'] = $limit;
275 275
 		}
276
-		$result = $this->get_all( $query_params );
277
-		$this->assume_values_already_prepared_by_model_object( $old_assumption );
276
+		$result = $this->get_all($query_params);
277
+		$this->assume_values_already_prepared_by_model_object($old_assumption);
278 278
 		return $result;
279 279
 	}
280 280
 
@@ -290,24 +290,24 @@  discard block
 block discarded – undo
290 290
 	 *                                  that number
291 291
 	 * @return EE_Datetime[]
292 292
 	 */
293
-	public function get_datetimes_for_ticket_ordered_by_DTT_order( $TKT_ID, $include_expired = true, $include_deleted = true, $limit = NULL ) {
293
+	public function get_datetimes_for_ticket_ordered_by_DTT_order($TKT_ID, $include_expired = true, $include_deleted = true, $limit = NULL) {
294 294
 		//sanitize id.
295
-		$TKT_ID =  intval( $TKT_ID );
295
+		$TKT_ID = intval($TKT_ID);
296 296
 		$old_assumption = $this->get_assumption_concerning_values_already_prepared_by_model_object();
297
-		$this->assume_values_already_prepared_by_model_object( EEM_Base::prepared_for_use_in_db );
298
-		$where_params = array( 'Ticket.TKT_ID' => $TKT_ID );
299
-		$query_params = array( $where_params, 'order_by' => array( 'DTT_order' => 'ASC' ) );
300
-		if( ! $include_expired){
301
-			$query_params[0]['DTT_EVT_end'] = array('>=',current_time('mysql', TRUE));
297
+		$this->assume_values_already_prepared_by_model_object(EEM_Base::prepared_for_use_in_db);
298
+		$where_params = array('Ticket.TKT_ID' => $TKT_ID);
299
+		$query_params = array($where_params, 'order_by' => array('DTT_order' => 'ASC'));
300
+		if ( ! $include_expired) {
301
+			$query_params[0]['DTT_EVT_end'] = array('>=', current_time('mysql', TRUE));
302 302
 		}
303
-		if( $include_deleted){
304
-			$query_params[0]['DTT_deleted'] = array('IN',array(true,false));
303
+		if ($include_deleted) {
304
+			$query_params[0]['DTT_deleted'] = array('IN', array(true, false));
305 305
 		}
306
-		if($limit){
306
+		if ($limit) {
307 307
 			$query_params['limit'] = $limit;
308 308
 		}
309
-		$result = $this->get_all( $query_params );
310
-		$this->assume_values_already_prepared_by_model_object( $old_assumption );
309
+		$result = $this->get_all($query_params);
310
+		$this->assume_values_already_prepared_by_model_object($old_assumption);
311 311
 		return $result;
312 312
 	}
313 313
 
@@ -318,11 +318,11 @@  discard block
 block discarded – undo
318 318
 	 * @param int $EVT_ID
319 319
 	 * @return EE_Datetime
320 320
 	 */
321
-	public function get_most_important_datetime_for_event($EVT_ID){
321
+	public function get_most_important_datetime_for_event($EVT_ID) {
322 322
 		$results = $this->get_datetimes_for_event_ordered_by_importance($EVT_ID, 1);
323
-		if($results){
323
+		if ($results) {
324 324
 			return array_shift($results);
325
-		}else{
325
+		} else {
326 326
 			return null;
327 327
 		}
328 328
 	}
@@ -341,71 +341,71 @@  discard block
 block discarded – undo
341 341
 	 * 			- inactive = Events that are either not published.
342 342
 	 * @return wpdb results array
343 343
 	 */
344
-	public function get_dtt_months_and_years( $where_params, $evt_active_status = '' ) {
344
+	public function get_dtt_months_and_years($where_params, $evt_active_status = '') {
345 345
 
346
-		switch ( $evt_active_status ) {
346
+		switch ($evt_active_status) {
347 347
 			case 'upcoming' :
348 348
 					$where_params['Event.status'] = 'publish';
349 349
 					//if there are already query_params matching DTT_EVT_start then we need to modify that to add them.
350
-					if ( isset( $where_params['DTT_EVT_start'] ) ) {
350
+					if (isset($where_params['DTT_EVT_start'])) {
351 351
 						$where_params['DTT_EVT_start*****'] = $where_params['DTT_EVT_start'];
352 352
 					}
353
-					$where_params['DTT_EVT_start'] = array('>', $this->current_time_for_query( 'DTT_EVT_start' ) );
353
+					$where_params['DTT_EVT_start'] = array('>', $this->current_time_for_query('DTT_EVT_start'));
354 354
 					break;
355 355
 
356 356
 			case 'expired' :
357
-				if ( isset( $where_params['Event.status'] ) ) unset( $where_params['Event.status'] );
357
+				if (isset($where_params['Event.status'])) unset($where_params['Event.status']);
358 358
 				//get events to exclude
359
-				$exclude_query[0] = array_merge( $where_params, array( 'DTT_EVT_end' => array( '>', $this->current_time_for_query( 'DTT_EVT_end' ) ) ) );
359
+				$exclude_query[0] = array_merge($where_params, array('DTT_EVT_end' => array('>', $this->current_time_for_query('DTT_EVT_end'))));
360 360
 				//first get all events that have datetimes where its not expired.
361
-				$event_ids = $this->_get_all_wpdb_results( $exclude_query, OBJECT_K, 'Datetime.EVT_ID' );
362
-				$event_ids = array_keys( $event_ids );
361
+				$event_ids = $this->_get_all_wpdb_results($exclude_query, OBJECT_K, 'Datetime.EVT_ID');
362
+				$event_ids = array_keys($event_ids);
363 363
 
364
-				if ( isset( $where_params['DTT_EVT_end'] ) ) {
364
+				if (isset($where_params['DTT_EVT_end'])) {
365 365
 					$where_params['DTT_EVT_end****'] = $where_params['DTT_EVT_end'];
366 366
 				}
367
-				$where_params['DTT_EVT_end'] = array( '<', EEM_Datetime::instance()->current_time_for_query( 'DTT_EVT_end' ) );
368
-				$where_params['Event.EVT_ID'] = array( 'NOT IN', $event_ids );
367
+				$where_params['DTT_EVT_end'] = array('<', EEM_Datetime::instance()->current_time_for_query('DTT_EVT_end'));
368
+				$where_params['Event.EVT_ID'] = array('NOT IN', $event_ids);
369 369
 				break;
370 370
 
371 371
 			case 'active' :
372 372
 				$where_params['Event.status'] = 'publish';
373
-				if ( isset( $where_params['DTT_EVT_start'] ) ) {
373
+				if (isset($where_params['DTT_EVT_start'])) {
374 374
 					$where_params['Datetime.DTT_EVT_start******'] = $where_params['DTT_EVT_start'];
375 375
 				}
376
-				if ( isset( $where_params['Datetime.DTT_EVT_end'] ) ) {
376
+				if (isset($where_params['Datetime.DTT_EVT_end'])) {
377 377
 					$where_params['Datetime.DTT_EVT_end*****'] = $where_params['DTT_EVT_end'];
378 378
 				}
379
-				$where_params['DTT_EVT_start'] = array('<',  $this->current_time_for_query( 'DTT_EVT_start' ) );
380
-				$where_params['DTT_EVT_end'] = array('>', $this->current_time_for_query( 'DTT_EVT_end' ) );
379
+				$where_params['DTT_EVT_start'] = array('<', $this->current_time_for_query('DTT_EVT_start'));
380
+				$where_params['DTT_EVT_end'] = array('>', $this->current_time_for_query('DTT_EVT_end'));
381 381
 				break;
382 382
 
383 383
 			case 'inactive' :
384
-				if ( isset( $where_params['Event.status'] ) ) unset( $where_params['Event.status'] );
385
-				if ( isset( $where_params['OR'] ) ) {
384
+				if (isset($where_params['Event.status'])) unset($where_params['Event.status']);
385
+				if (isset($where_params['OR'])) {
386 386
 					$where_params['AND']['OR'] = $where_params['OR'];
387 387
 				}
388
-				if ( isset( $where_params['DTT_EVT_end'] ) ) {
388
+				if (isset($where_params['DTT_EVT_end'])) {
389 389
 					$where_params['AND']['DTT_EVT_end****'] = $where_params['DTT_EVT_end'];
390
-					unset( $where_params['DTT_EVT_end'] );
390
+					unset($where_params['DTT_EVT_end']);
391 391
 				}
392 392
 
393
-				if ( isset( $where_params['DTT_EVT_start'] ) ) {
393
+				if (isset($where_params['DTT_EVT_start'])) {
394 394
 					$where_params['AND']['DTT_EVT_start'] = $where_params['DTT_EVT_start'];
395
-					unset( $where_params['DTT_EVT_start'] );
395
+					unset($where_params['DTT_EVT_start']);
396 396
 				}
397
-				$where_params['AND']['Event.status'] = array( '!=', 'publish' );
397
+				$where_params['AND']['Event.status'] = array('!=', 'publish');
398 398
 				break;
399 399
 		}
400 400
 
401 401
 		$query_params[0] = $where_params;
402 402
 		$query_params['group_by'] = array('dtt_year', 'dtt_month');
403
-		$query_params['order_by'] = array( 'DTT_EVT_start' => 'DESC' );
403
+		$query_params['order_by'] = array('DTT_EVT_start' => 'DESC');
404 404
 		$columns_to_select = array(
405 405
 			'dtt_year' => array('YEAR(DTT_EVT_start)', '%s'),
406 406
 			'dtt_month' => array('MONTHNAME(DTT_EVT_start)', '%s')
407 407
 			);
408
-		return $this->_get_all_wpdb_results( $query_params, OBJECT, $columns_to_select );
408
+		return $this->_get_all_wpdb_results($query_params, OBJECT, $columns_to_select);
409 409
 	}
410 410
 
411 411
 	/**
@@ -413,8 +413,8 @@  discard block
 block discarded – undo
413 413
 	 * for the tickets for each datetime)
414 414
 	 * @param EE_Datetime[] $datetimes
415 415
 	 */
416
-	public function update_sold($datetimes){
417
-		foreach($datetimes as $datetime){
416
+	public function update_sold($datetimes) {
417
+		foreach ($datetimes as $datetime) {
418 418
 			$datetime->update_sold();
419 419
 		}
420 420
 	}
@@ -429,10 +429,10 @@  discard block
 block discarded – undo
429 429
 	 * @param array $query_params
430 430
 	 * @return int of tickets available. If sold out, return less than 1. If infinite, returns EE_INF,  IF there are NO tickets attached to datetime then FALSE is returned.
431 431
 	 */
432
-	public function sum_tickets_currently_available_at_datetime( $DTT_ID, $query_params = array() ) {
433
-		$datetime = $this->get_one_by_ID( $DTT_ID );
434
-		if ( $datetime instanceof EE_Datetime ) {
435
-			return $datetime->tickets_remaining( $query_params );
432
+	public function sum_tickets_currently_available_at_datetime($DTT_ID, $query_params = array()) {
433
+		$datetime = $this->get_one_by_ID($DTT_ID);
434
+		if ($datetime instanceof EE_Datetime) {
435
+			return $datetime->tickets_remaining($query_params);
436 436
 		}
437 437
 		return 0;
438 438
 	}
Please login to merge, or discard this patch.
core/helpers/EEH_Activation.helper.php 2 patches
Indentation   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -1,26 +1,26 @@  discard block
 block discarded – undo
1 1
 <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
2 2
 /**
3
- * Event Espresso
4
- *
5
- * Event Registration and Management Plugin for WordPress
6
- *
7
- * @ package			Event Espresso
8
- * @ author			Seth Shoultes
9
- * @ copyright		(c) 2008-2011 Event Espresso  All Rights Reserved.
10
- * @ license			http://eventespresso.com/support/terms-conditions/   * see Plugin Licensing *
11
- * @ link					http://www.eventespresso.com
12
- * @ version		 	4.0
13
- *
14
- * ------------------------------------------------------------------------
15
- *
16
- * EEH_Activation Helper
17
- *
18
- * @package			Event Espresso
19
- * @subpackage	/helpers/
20
- * @author				Brent Christensen
21
- *
22
- * ------------------------------------------------------------------------
23
- */
3
+	 * Event Espresso
4
+	 *
5
+	 * Event Registration and Management Plugin for WordPress
6
+	 *
7
+	 * @ package			Event Espresso
8
+	 * @ author			Seth Shoultes
9
+	 * @ copyright		(c) 2008-2011 Event Espresso  All Rights Reserved.
10
+	 * @ license			http://eventespresso.com/support/terms-conditions/   * see Plugin Licensing *
11
+	 * @ link					http://www.eventespresso.com
12
+	 * @ version		 	4.0
13
+	 *
14
+	 * ------------------------------------------------------------------------
15
+	 *
16
+	 * EEH_Activation Helper
17
+	 *
18
+	 * @package			Event Espresso
19
+	 * @subpackage	/helpers/
20
+	 * @author				Brent Christensen
21
+	 *
22
+	 * ------------------------------------------------------------------------
23
+	 */
24 24
 class EEH_Activation {
25 25
 
26 26
 	/**
@@ -1085,14 +1085,14 @@  discard block
 block discarded – undo
1085 1085
 							$QSG_ID = reset( $id_col );
1086 1086
 						} else {
1087 1087
 							//ok so we didn't find it in the db either?? that's weird because we should have inserted it at the start of this method
1088
-                                                        EE_Log::instance()->log( 
1089
-                                                                __FILE__, 
1090
-                                                                __FUNCTION__, 
1091
-                                                                sprintf( 
1092
-                                                                        __( 'Could not associate question %1$s to a question group because no system question group existed', 'event_espresso'), 
1093
-                                                                        $QST_ID ), 
1094
-                                                                'error' );
1095
-                                                        continue;
1088
+														EE_Log::instance()->log( 
1089
+																__FILE__, 
1090
+																__FUNCTION__, 
1091
+																sprintf( 
1092
+																		__( 'Could not associate question %1$s to a question group because no system question group existed', 'event_espresso'), 
1093
+																		$QST_ID ), 
1094
+																'error' );
1095
+														continue;
1096 1096
 						}
1097 1097
 					}
1098 1098
                                         
@@ -1605,8 +1605,8 @@  discard block
 block discarded – undo
1605 1605
 				}
1606 1606
 			}
1607 1607
 		}
1608
-                //also, let's make sure the "ee_config_option_names" wp option stays out by removing the action that adds it
1609
-                remove_action( 'shutdown', array( EE_Config::instance(), 'shutdown' ), 10 );
1608
+				//also, let's make sure the "ee_config_option_names" wp option stays out by removing the action that adds it
1609
+				remove_action( 'shutdown', array( EE_Config::instance(), 'shutdown' ), 10 );
1610 1610
 
1611 1611
 		if ( $remove_all && $espresso_db_update = get_option( 'espresso_db_update' )) {
1612 1612
 			$db_update_sans_ee4 = array();
Please login to merge, or discard this patch.
Spacing   +358 added lines, -358 removed lines patch added patch discarded remove patch
@@ -57,9 +57,9 @@  discard block
 block discarded – undo
57 57
 	 * @param $table_name
58 58
 	 * @return string
59 59
 	 */
60
-	public static function ensure_table_name_has_prefix( $table_name ) {
60
+	public static function ensure_table_name_has_prefix($table_name) {
61 61
 		global $wpdb;
62
-		return strpos( $table_name, $wpdb->prefix ) === 0 ? $table_name : $wpdb->prefix . $table_name;
62
+		return strpos($table_name, $wpdb->prefix) === 0 ? $table_name : $wpdb->prefix.$table_name;
63 63
 	}
64 64
 
65 65
 
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 	 * be called on plugin activation and reactivation
86 86
 	 * @return boolean success, whether the database and folders are setup properly
87 87
 	 */
88
-	public static function initialize_db_and_folders(){
88
+	public static function initialize_db_and_folders() {
89 89
 		$good_filesystem = EEH_Activation::create_upload_directories();
90 90
 		$good_db = EEH_Activation::create_database_tables();
91 91
 		return $good_filesystem && $good_db;
@@ -99,9 +99,9 @@  discard block
 block discarded – undo
99 99
 	 * upon activation of a new plugin, reactivation, and at the end
100 100
 	 * of running migration scripts
101 101
 	 */
102
-	public static function initialize_db_content(){
102
+	public static function initialize_db_content() {
103 103
 		//let's avoid doing all this logic repeatedly, especially when addons are requesting it
104
-		if( EEH_Activation::$_initialized_db_content_already_in_this_request ) {
104
+		if (EEH_Activation::$_initialized_db_content_already_in_this_request) {
105 105
 			return;
106 106
 		}
107 107
 		EEH_Activation::$_initialized_db_content_already_in_this_request = true;
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
 		EEH_Activation::remove_cron_tasks();
119 119
 		EEH_Activation::create_cron_tasks();
120 120
 		//also, check for CAF default db content
121
-		do_action( 'AHEE__EEH_Activation__initialize_db_content' );
121
+		do_action('AHEE__EEH_Activation__initialize_db_content');
122 122
 		//also: EEM_Gateways::load_all_gateways() outputs a lot of success messages
123 123
 		//which users really won't care about on initial activation
124 124
 		EE_Error::overwrite_success();
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
 	 * @return array
138 138
 	 * @throws \EE_Error
139 139
 	 */
140
-	public static function get_cron_tasks( $which_to_include ) {
140
+	public static function get_cron_tasks($which_to_include) {
141 141
 		$cron_tasks = apply_filters(
142 142
 			'FHEE__EEH_Activation__get_cron_tasks',
143 143
 			array(
@@ -146,17 +146,17 @@  discard block
 block discarded – undo
146 146
 				'AHEE__EE_Cron_Tasks__update_transaction_with_payment' => EEH_Activation::cron_task_no_longer_in_use, //there may have been a bug which prevented from these cron tasks from getting unscheduled, so we might want to remove these for a few updates
147 147
 			)
148 148
 		);
149
-		if( $which_to_include === 'all' ) {
149
+		if ($which_to_include === 'all') {
150 150
 			//leave as-is
151
-		}elseif( $which_to_include === 'old' ) {
152
-			$cron_tasks = array_filter( $cron_tasks, function ( $value ) {
151
+		}elseif ($which_to_include === 'old') {
152
+			$cron_tasks = array_filter($cron_tasks, function($value) {
153 153
 				return $value === EEH_Activation::cron_task_no_longer_in_use;
154 154
 			});
155
-		}elseif( $which_to_include === 'current' ) {
156
-			$cron_tasks = array_filter( $cron_tasks );
157
-		}elseif( WP_DEBUG ) {
158
-			throw new EE_Error( sprintf( __( 'Invalidate argument of "%1$s" passed to EEH_Activation::get_cron_tasks. Valid values are "all", "old" and "current".', 'event_espresso' ), $which_to_include ) );
159
-		}else{
155
+		}elseif ($which_to_include === 'current') {
156
+			$cron_tasks = array_filter($cron_tasks);
157
+		}elseif (WP_DEBUG) {
158
+			throw new EE_Error(sprintf(__('Invalidate argument of "%1$s" passed to EEH_Activation::get_cron_tasks. Valid values are "all", "old" and "current".', 'event_espresso'), $which_to_include));
159
+		} else {
160 160
 			//leave as-is
161 161
 		}
162 162
 		return $cron_tasks;
@@ -167,9 +167,9 @@  discard block
 block discarded – undo
167 167
 	 */
168 168
 	public static function create_cron_tasks() {
169 169
 
170
-		foreach( EEH_Activation::get_cron_tasks( 'current' ) as $hook_name => $frequency ) {
171
-			if( ! wp_next_scheduled( $hook_name ) ) {
172
-				wp_schedule_event( time(), $frequency, $hook_name );
170
+		foreach (EEH_Activation::get_cron_tasks('current') as $hook_name => $frequency) {
171
+			if ( ! wp_next_scheduled($hook_name)) {
172
+				wp_schedule_event(time(), $frequency, $hook_name);
173 173
 			}
174 174
 		}
175 175
 
@@ -179,10 +179,10 @@  discard block
 block discarded – undo
179 179
 	 * Remove the currently-existing and now-removed cron tasks.
180 180
 	 * @param boolean $remove_all whether to only remove the old ones, or remove absolutely ALL the EE ones
181 181
 	 */
182
-	public static function remove_cron_tasks( $remove_all = true ) {
182
+	public static function remove_cron_tasks($remove_all = true) {
183 183
 		$cron_tasks_to_remove = $remove_all ? 'all' : 'old';
184 184
 		$crons = _get_cron_array();
185
-		$crons = is_array( $crons ) ? $crons : array();
185
+		$crons = is_array($crons) ? $crons : array();
186 186
 		/* reminder that $crons looks like: top-level keys are timestamps,
187 187
 		 * and their values are arrays.
188 188
 		 * The 2nd level arrays have keys with each of the cron task hooknames to run at that time
@@ -200,14 +200,14 @@  discard block
 block discarded – undo
200 200
 		 *					...
201 201
 		 *      ...
202 202
 		 */
203
-		foreach( EEH_Activation::get_cron_tasks( $cron_tasks_to_remove ) as $hook_name => $frequency ) {
204
-			foreach( $crons as $timestamp => $hooks_to_fire_at_time ) {
205
-				if ( array_key_exists( $hook_name, $hooks_to_fire_at_time ) )  {
206
-					unset( $crons[ $timestamp ][ $hook_name ] );
203
+		foreach (EEH_Activation::get_cron_tasks($cron_tasks_to_remove) as $hook_name => $frequency) {
204
+			foreach ($crons as $timestamp => $hooks_to_fire_at_time) {
205
+				if (array_key_exists($hook_name, $hooks_to_fire_at_time)) {
206
+					unset($crons[$timestamp][$hook_name]);
207 207
 				}
208 208
 			}
209 209
 		}
210
-		_set_cron_array( $crons );
210
+		_set_cron_array($crons);
211 211
 	}
212 212
 
213 213
 
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
 	 */
223 223
 	public static function CPT_initialization() {
224 224
 		// register Custom Post Types
225
-		EE_Registry::instance()->load_core( 'Register_CPTs' );
225
+		EE_Registry::instance()->load_core('Register_CPTs');
226 226
 		flush_rewrite_rules();
227 227
 	}
228 228
 
@@ -240,8 +240,8 @@  discard block
 block discarded – undo
240 240
 	 * 	@return void
241 241
 	 */
242 242
 	public static function reset_and_update_config() {
243
-		do_action( 'AHEE__EE_Config___load_core_config__start', array( 'EEH_Activation', 'load_calendar_config' ) );
244
-		add_filter( 'FHEE__EE_Config___load_core_config__config_settings', array( 'EEH_Activation', 'migrate_old_config_data' ), 10, 3 );
243
+		do_action('AHEE__EE_Config___load_core_config__start', array('EEH_Activation', 'load_calendar_config'));
244
+		add_filter('FHEE__EE_Config___load_core_config__config_settings', array('EEH_Activation', 'migrate_old_config_data'), 10, 3);
245 245
 		//EE_Config::reset();
246 246
 	}
247 247
 
@@ -254,23 +254,23 @@  discard block
 block discarded – undo
254 254
 	 */
255 255
 	public static function load_calendar_config() {
256 256
 		// grab array of all plugin folders and loop thru it
257
-		$plugins = glob( WP_PLUGIN_DIR . DS . '*', GLOB_ONLYDIR );
258
-		if ( empty( $plugins ) ) {
257
+		$plugins = glob(WP_PLUGIN_DIR.DS.'*', GLOB_ONLYDIR);
258
+		if (empty($plugins)) {
259 259
 			return;
260 260
 		}
261
-		foreach ( $plugins as $plugin_path ) {
261
+		foreach ($plugins as $plugin_path) {
262 262
 			// grab plugin folder name from path
263
-			$plugin = basename( $plugin_path );
263
+			$plugin = basename($plugin_path);
264 264
 			// drill down to Espresso plugins
265
-			if ( strpos( $plugin, 'espresso' ) !== FALSE || strpos( $plugin, 'Espresso' ) !== FALSE || strpos( $plugin, 'ee4' ) !== FALSE || strpos( $plugin, 'EE4' ) !== FALSE ) {
265
+			if (strpos($plugin, 'espresso') !== FALSE || strpos($plugin, 'Espresso') !== FALSE || strpos($plugin, 'ee4') !== FALSE || strpos($plugin, 'EE4') !== FALSE) {
266 266
 				// then to calendar related plugins
267
-				if ( strpos( $plugin, 'calendar' ) !== FALSE ) {
267
+				if (strpos($plugin, 'calendar') !== FALSE) {
268 268
 					// this is what we are looking for
269
-					$calendar_config = $plugin_path . DS . 'EE_Calendar_Config.php';
269
+					$calendar_config = $plugin_path.DS.'EE_Calendar_Config.php';
270 270
 					// does it exist in this folder ?
271
-					if ( is_readable( $calendar_config )) {
271
+					if (is_readable($calendar_config)) {
272 272
 						// YEAH! let's load it
273
-						require_once( $calendar_config );
273
+						require_once($calendar_config);
274 274
 					}
275 275
 				}
276 276
 			}
@@ -287,21 +287,21 @@  discard block
 block discarded – undo
287 287
 	 * @param \EE_Config $EE_Config
288 288
 	 * @return \stdClass
289 289
 	 */
290
-	public static function migrate_old_config_data( $settings = array(), $config = '', EE_Config $EE_Config ) {
291
-		$convert_from_array = array( 'addons' );
290
+	public static function migrate_old_config_data($settings = array(), $config = '', EE_Config $EE_Config) {
291
+		$convert_from_array = array('addons');
292 292
 		// in case old settings were saved as an array
293
-		if ( is_array( $settings ) && in_array( $config, $convert_from_array )) {
293
+		if (is_array($settings) && in_array($config, $convert_from_array)) {
294 294
 			// convert existing settings to an object
295 295
 			$config_array = $settings;
296 296
 			$settings = new stdClass();
297
-			foreach ( $config_array as $key => $value ){
298
-				if ( $key == 'calendar' && class_exists( 'EE_Calendar_Config' )) {
299
-					$EE_Config->set_config( 'addons', 'EE_Calendar', 'EE_Calendar_Config', $value );
297
+			foreach ($config_array as $key => $value) {
298
+				if ($key == 'calendar' && class_exists('EE_Calendar_Config')) {
299
+					$EE_Config->set_config('addons', 'EE_Calendar', 'EE_Calendar_Config', $value);
300 300
 				} else {
301 301
 					$settings->$key = $value;
302 302
 				}
303 303
 			}
304
-			add_filter( 'FHEE__EE_Config___load_core_config__update_espresso_config', '__return_true' );
304
+			add_filter('FHEE__EE_Config___load_core_config__update_espresso_config', '__return_true');
305 305
 		}
306 306
 		return $settings;
307 307
 	}
@@ -317,8 +317,8 @@  discard block
 block discarded – undo
317 317
 	 */
318 318
 	public static function deactivate_event_espresso() {
319 319
 		// check permissions
320
-		if ( current_user_can( 'activate_plugins' )) {
321
-			deactivate_plugins( EE_PLUGIN_BASENAME, TRUE );
320
+		if (current_user_can('activate_plugins')) {
321
+			deactivate_plugins(EE_PLUGIN_BASENAME, TRUE);
322 322
 		}
323 323
 	}
324 324
 
@@ -340,79 +340,79 @@  discard block
 block discarded – undo
340 340
 		$critical_pages = array(
341 341
 			array(
342 342
 				'id' =>'reg_page_id',
343
-				'name' => __( 'Registration Checkout', 'event_espresso' ),
343
+				'name' => __('Registration Checkout', 'event_espresso'),
344 344
 				'post' => NULL,
345 345
 				'code' => 'ESPRESSO_CHECKOUT'
346 346
 			),
347 347
 			array(
348 348
 				'id' => 'txn_page_id',
349
-				'name' => __( 'Transactions', 'event_espresso' ),
349
+				'name' => __('Transactions', 'event_espresso'),
350 350
 				'post' => NULL,
351 351
 				'code' => 'ESPRESSO_TXN_PAGE'
352 352
 			),
353 353
 			array(
354 354
 				'id' => 'thank_you_page_id',
355
-				'name' => __( 'Thank You', 'event_espresso' ),
355
+				'name' => __('Thank You', 'event_espresso'),
356 356
 				'post' => NULL,
357 357
 				'code' => 'ESPRESSO_THANK_YOU'
358 358
 			),
359 359
 			array(
360 360
 				'id' => 'cancel_page_id',
361
-				'name' => __( 'Registration Cancelled', 'event_espresso' ),
361
+				'name' => __('Registration Cancelled', 'event_espresso'),
362 362
 				'post' => NULL,
363 363
 				'code' => 'ESPRESSO_CANCELLED'
364 364
 			),
365 365
 		);
366 366
 
367
-		foreach ( $critical_pages as $critical_page ) {
367
+		foreach ($critical_pages as $critical_page) {
368 368
 			// is critical page ID set in config ?
369
-			if ( EE_Registry::instance()->CFG->core->$critical_page['id'] !== FALSE ) {
369
+			if (EE_Registry::instance()->CFG->core->$critical_page['id'] !== FALSE) {
370 370
 				// attempt to find post by ID
371
-				$critical_page['post'] = get_post( EE_Registry::instance()->CFG->core->$critical_page['id'] );
371
+				$critical_page['post'] = get_post(EE_Registry::instance()->CFG->core->$critical_page['id']);
372 372
 			}
373 373
 			// no dice?
374
-			if ( $critical_page['post'] == NULL ) {
374
+			if ($critical_page['post'] == NULL) {
375 375
 				// attempt to find post by title
376
-				$critical_page['post'] = self::get_page_by_ee_shortcode( $critical_page['code'] );
376
+				$critical_page['post'] = self::get_page_by_ee_shortcode($critical_page['code']);
377 377
 				// still nothing?
378
-				if ( $critical_page['post'] == NULL ) {
379
-					$critical_page = EEH_Activation::create_critical_page( $critical_page );
378
+				if ($critical_page['post'] == NULL) {
379
+					$critical_page = EEH_Activation::create_critical_page($critical_page);
380 380
 					// REALLY? Still nothing ??!?!?
381
-					if ( $critical_page['post'] == NULL ) {
382
-						$msg = __( 'The Event Espresso critical page configuration settings could not be updated.', 'event_espresso' );
383
-						EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
381
+					if ($critical_page['post'] == NULL) {
382
+						$msg = __('The Event Espresso critical page configuration settings could not be updated.', 'event_espresso');
383
+						EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
384 384
 						break;
385 385
 					}
386 386
 				}
387 387
 			}
388 388
 			// track post_shortcodes
389
-			if ( $critical_page['post'] ) {
390
-				EEH_Activation::_track_critical_page_post_shortcodes( $critical_page );
389
+			if ($critical_page['post']) {
390
+				EEH_Activation::_track_critical_page_post_shortcodes($critical_page);
391 391
 			}
392 392
 			// check that Post ID matches critical page ID in config
393
-			if ( isset( $critical_page['post']->ID ) && $critical_page['post']->ID != EE_Registry::instance()->CFG->core->$critical_page['id'] ) {
393
+			if (isset($critical_page['post']->ID) && $critical_page['post']->ID != EE_Registry::instance()->CFG->core->$critical_page['id']) {
394 394
 				//update Config with post ID
395 395
 				EE_Registry::instance()->CFG->core->$critical_page['id'] = $critical_page['post']->ID;
396
-				if ( ! EE_Config::instance()->update_espresso_config( FALSE, FALSE ) ) {
397
-					$msg = __( 'The Event Espresso critical page configuration settings could not be updated.', 'event_espresso' );
398
-					EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
396
+				if ( ! EE_Config::instance()->update_espresso_config(FALSE, FALSE)) {
397
+					$msg = __('The Event Espresso critical page configuration settings could not be updated.', 'event_espresso');
398
+					EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
399 399
 				}
400 400
 			}
401 401
 
402
-			$critical_page_problem =  ! isset( $critical_page['post']->post_status ) || $critical_page['post']->post_status != 'publish' || strpos( $critical_page['post']->post_content, $critical_page['code'] ) === FALSE ? TRUE : $critical_page_problem;
402
+			$critical_page_problem = ! isset($critical_page['post']->post_status) || $critical_page['post']->post_status != 'publish' || strpos($critical_page['post']->post_content, $critical_page['code']) === FALSE ? TRUE : $critical_page_problem;
403 403
 
404 404
 		}
405 405
 
406
-		if ( $critical_page_problem ) {
406
+		if ($critical_page_problem) {
407 407
 			$msg = sprintf(
408
-				__('A potential issue has been detected with one or more of your Event Espresso pages. Go to %s to view your Event Espresso pages.', 'event_espresso' ),
409
-				'<a href="' . admin_url('admin.php?page=espresso_general_settings&action=critical_pages') . '">' . __('Event Espresso Critical Pages Settings', 'event_espresso') . '</a>'
408
+				__('A potential issue has been detected with one or more of your Event Espresso pages. Go to %s to view your Event Espresso pages.', 'event_espresso'),
409
+				'<a href="'.admin_url('admin.php?page=espresso_general_settings&action=critical_pages').'">'.__('Event Espresso Critical Pages Settings', 'event_espresso').'</a>'
410 410
 			);
411
-			EE_Error::add_persistent_admin_notice( 'critical_page_problem', $msg );
411
+			EE_Error::add_persistent_admin_notice('critical_page_problem', $msg);
412 412
 		}
413 413
 
414
-		if ( EE_Error::has_notices() ) {
415
-			EE_Error::get_notices( FALSE, TRUE, TRUE );
414
+		if (EE_Error::has_notices()) {
415
+			EE_Error::get_notices(FALSE, TRUE, TRUE);
416 416
 		}
417 417
 
418 418
 	}
@@ -425,13 +425,13 @@  discard block
 block discarded – undo
425 425
 	 * parameter to the shortcode
426 426
 	 * @return WP_Post or NULl
427 427
 	 */
428
-	public static function get_page_by_ee_shortcode($ee_shortcode){
428
+	public static function get_page_by_ee_shortcode($ee_shortcode) {
429 429
 		global $wpdb;
430 430
 		$shortcode_and_opening_bracket = '['.$ee_shortcode;
431 431
 		$post_id = $wpdb->get_var("SELECT ID FROM {$wpdb->posts} WHERE post_content LIKE '%$shortcode_and_opening_bracket%' LIMIT 1");
432
-		if($post_id){
432
+		if ($post_id) {
433 433
 			return get_post($post_id);
434
-		}else{
434
+		} else {
435 435
 			return NULL;
436 436
 		}
437 437
 
@@ -448,32 +448,32 @@  discard block
 block discarded – undo
448 448
 	 * @param array $critical_page
449 449
 	 * @return array
450 450
 	 */
451
-	public static function create_critical_page( $critical_page ) {
451
+	public static function create_critical_page($critical_page) {
452 452
 
453 453
 		$post_args = array(
454 454
 			'post_title' => $critical_page['name'],
455 455
 			'post_status' => 'publish',
456 456
 			'post_type' => 'page',
457 457
 			'comment_status' => 'closed',
458
-			'post_content' => '[' . $critical_page['code'] . ']'
458
+			'post_content' => '['.$critical_page['code'].']'
459 459
 		);
460 460
 
461
-		$post_id = wp_insert_post( $post_args );
462
-		if ( ! $post_id ) {
461
+		$post_id = wp_insert_post($post_args);
462
+		if ( ! $post_id) {
463 463
 			$msg = sprintf(
464
-				__( 'The Event Espresso  critical page entitled "%s" could not be created.', 'event_espresso' ),
464
+				__('The Event Espresso  critical page entitled "%s" could not be created.', 'event_espresso'),
465 465
 				$critical_page['name']
466 466
 			);
467
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
467
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
468 468
 			return $critical_page;
469 469
 		}
470 470
 		// get newly created post's details
471
-		if ( ! $critical_page['post'] = get_post( $post_id )) {
471
+		if ( ! $critical_page['post'] = get_post($post_id)) {
472 472
 			$msg = sprintf(
473
-				__( 'The Event Espresso critical page entitled "%s" could not be retrieved.', 'event_espresso' ),
473
+				__('The Event Espresso critical page entitled "%s" could not be retrieved.', 'event_espresso'),
474 474
 				$critical_page['name']
475 475
 			);
476
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
476
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
477 477
 		}
478 478
 
479 479
 		return $critical_page;
@@ -492,34 +492,34 @@  discard block
 block discarded – undo
492 492
 	 * @param array $critical_page
493 493
 	 * @return void
494 494
 	 */
495
-	private static function _track_critical_page_post_shortcodes( $critical_page = array() ) {
495
+	private static function _track_critical_page_post_shortcodes($critical_page = array()) {
496 496
 		// check the goods
497
-		if ( ! $critical_page['post'] instanceof WP_Post ) {
497
+		if ( ! $critical_page['post'] instanceof WP_Post) {
498 498
 			$msg = sprintf(
499
-				__( 'The Event Espresso critical page shortcode for the page %s can not be tracked because it is not a WP_Post object.', 'event_espresso' ),
499
+				__('The Event Espresso critical page shortcode for the page %s can not be tracked because it is not a WP_Post object.', 'event_espresso'),
500 500
 				$critical_page['name']
501 501
 			);
502
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
502
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
503 503
 			return;
504 504
 		}
505 505
 		// map shortcode to post
506
-		EE_Registry::instance()->CFG->core->post_shortcodes[ $critical_page['post']->post_name ][ $critical_page['code'] ] = $critical_page['post']->ID;
506
+		EE_Registry::instance()->CFG->core->post_shortcodes[$critical_page['post']->post_name][$critical_page['code']] = $critical_page['post']->ID;
507 507
 		// and make sure it's NOT added to the WP "Posts Page"
508 508
 		// name of the WP Posts Page
509 509
 		$posts_page = EE_Registry::instance()->CFG->get_page_for_posts();
510
-		if ( isset( EE_Registry::instance()->CFG->core->post_shortcodes[ $posts_page ] )) {
511
-			unset( EE_Registry::instance()->CFG->core->post_shortcodes[ $posts_page ][ $critical_page['code'] ] );
510
+		if (isset(EE_Registry::instance()->CFG->core->post_shortcodes[$posts_page])) {
511
+			unset(EE_Registry::instance()->CFG->core->post_shortcodes[$posts_page][$critical_page['code']]);
512 512
 		}
513
-		if ( $posts_page != 'posts' && isset( EE_Registry::instance()->CFG->core->post_shortcodes['posts'] )) {
514
-			unset( EE_Registry::instance()->CFG->core->post_shortcodes['posts'][ $critical_page['code'] ] );
513
+		if ($posts_page != 'posts' && isset(EE_Registry::instance()->CFG->core->post_shortcodes['posts'])) {
514
+			unset(EE_Registry::instance()->CFG->core->post_shortcodes['posts'][$critical_page['code']]);
515 515
 		}
516 516
 		// update post_shortcode CFG
517
-		if ( ! EE_Config::instance()->update_espresso_config( FALSE, FALSE )) {
517
+		if ( ! EE_Config::instance()->update_espresso_config(FALSE, FALSE)) {
518 518
 			$msg = sprintf(
519
-				__( 'The Event Espresso critical page shortcode for the %s page could not be configured properly.', 'event_espresso' ),
519
+				__('The Event Espresso critical page shortcode for the %s page could not be configured properly.', 'event_espresso'),
520 520
 				$critical_page['name']
521 521
 			);
522
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
522
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
523 523
 		}
524 524
 	}
525 525
 
@@ -537,24 +537,24 @@  discard block
 block discarded – undo
537 537
 	public static function get_default_creator_id() {
538 538
 		global $wpdb;
539 539
 
540
-		if ( ! empty( self::$_default_creator_id ) ) {
540
+		if ( ! empty(self::$_default_creator_id)) {
541 541
 			return self::$_default_creator_id;
542 542
 		}/**/
543 543
 
544
-		$role_to_check = apply_filters( 'FHEE__EEH_Activation__get_default_creator_id__role_to_check', 'administrator' );
544
+		$role_to_check = apply_filters('FHEE__EEH_Activation__get_default_creator_id__role_to_check', 'administrator');
545 545
 
546 546
 		//let's allow pre_filtering for early exits by alternative methods for getting id.  We check for truthy result and if so then exit early.
547
-		$pre_filtered_id = apply_filters( 'FHEE__EEH_Activation__get_default_creator_id__pre_filtered_id', false, $role_to_check );
548
-		if ( $pre_filtered_id !== false ) {
547
+		$pre_filtered_id = apply_filters('FHEE__EEH_Activation__get_default_creator_id__pre_filtered_id', false, $role_to_check);
548
+		if ($pre_filtered_id !== false) {
549 549
 			return (int) $pre_filtered_id;
550 550
 		}
551 551
 
552
-		$capabilities_key = EEH_Activation::ensure_table_name_has_prefix( 'capabilities' );
553
-		$query = $wpdb->prepare( "SELECT user_id FROM $wpdb->usermeta WHERE meta_key = '$capabilities_key' AND meta_value LIKE %s ORDER BY user_id ASC LIMIT 0,1", '%' . $role_to_check . '%' );
554
-		$user_id = $wpdb->get_var( $query );
555
-		 $user_id = apply_filters( 'FHEE__EEH_Activation_Helper__get_default_creator_id__user_id', $user_id );
556
-		 if ( $user_id && intval( $user_id ) ) {
557
-		 	self::$_default_creator_id =  intval( $user_id );
552
+		$capabilities_key = EEH_Activation::ensure_table_name_has_prefix('capabilities');
553
+		$query = $wpdb->prepare("SELECT user_id FROM $wpdb->usermeta WHERE meta_key = '$capabilities_key' AND meta_value LIKE %s ORDER BY user_id ASC LIMIT 0,1", '%'.$role_to_check.'%');
554
+		$user_id = $wpdb->get_var($query);
555
+		 $user_id = apply_filters('FHEE__EEH_Activation_Helper__get_default_creator_id__user_id', $user_id);
556
+		 if ($user_id && intval($user_id)) {
557
+		 	self::$_default_creator_id = intval($user_id);
558 558
 		 	return self::$_default_creator_id;
559 559
 		 } else {
560 560
 		 	return NULL;
@@ -581,29 +581,29 @@  discard block
 block discarded – undo
581 581
 	 * 	@return void
582 582
 	 * @throws EE_Error if there are database errors
583 583
 	 */
584
-	public static function create_table( $table_name, $sql, $engine = 'ENGINE=MyISAM ', $drop_pre_existing_table = false ) {
585
-		if( apply_filters( 'FHEE__EEH_Activation__create_table__short_circuit', FALSE, $table_name, $sql ) ){
584
+	public static function create_table($table_name, $sql, $engine = 'ENGINE=MyISAM ', $drop_pre_existing_table = false) {
585
+		if (apply_filters('FHEE__EEH_Activation__create_table__short_circuit', FALSE, $table_name, $sql)) {
586 586
 			return;
587 587
 		}
588
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
589
-		if ( ! function_exists( 'dbDelta' )) {
590
-			require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
588
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
589
+		if ( ! function_exists('dbDelta')) {
590
+			require_once(ABSPATH.'wp-admin/includes/upgrade.php');
591 591
 		}
592 592
 		/** @var WPDB $wpdb */
593 593
 		global $wpdb;
594
-		$wp_table_name = EEH_Activation::ensure_table_name_has_prefix( $table_name );
594
+		$wp_table_name = EEH_Activation::ensure_table_name_has_prefix($table_name);
595 595
 		// do we need to first delete an existing version of this table ?
596
-		if ( $drop_pre_existing_table && EEH_Activation::table_exists( $wp_table_name ) ){
596
+		if ($drop_pre_existing_table && EEH_Activation::table_exists($wp_table_name)) {
597 597
 			// ok, delete the table... but ONLY if it's empty
598
-			$deleted_safely = EEH_Activation::delete_db_table_if_empty( $wp_table_name );
598
+			$deleted_safely = EEH_Activation::delete_db_table_if_empty($wp_table_name);
599 599
 			// table is NOT empty, are you SURE you want to delete this table ???
600
-			if ( ! $deleted_safely && defined( 'EE_DROP_BAD_TABLES' ) && EE_DROP_BAD_TABLES ){
601
-				EEH_Activation::delete_unused_db_table( $wp_table_name );
602
-			} else if ( ! $deleted_safely ) {
600
+			if ( ! $deleted_safely && defined('EE_DROP_BAD_TABLES') && EE_DROP_BAD_TABLES) {
601
+				EEH_Activation::delete_unused_db_table($wp_table_name);
602
+			} else if ( ! $deleted_safely) {
603 603
 				// so we should be more cautious rather than just dropping tables so easily
604 604
 				EE_Error::add_persistent_admin_notice(
605
-						'bad_table_' . $wp_table_name . '_detected',
606
-						sprintf( __( 'Database table %1$s exists when it shouldn\'t, and may contain erroneous data. If you have previously restored your database from a backup that didn\'t remove the old tables, then we recommend adding %2$s to your %3$s file then restore to that backup again. This will clear out the invalid data from %1$s. Afterwards you should undo that change from your %3$s file. %4$sIf you cannot edit %3$s, you should remove the data from %1$s manually then restore to the backup again.', 'event_espresso' ),
605
+						'bad_table_'.$wp_table_name.'_detected',
606
+						sprintf(__('Database table %1$s exists when it shouldn\'t, and may contain erroneous data. If you have previously restored your database from a backup that didn\'t remove the old tables, then we recommend adding %2$s to your %3$s file then restore to that backup again. This will clear out the invalid data from %1$s. Afterwards you should undo that change from your %3$s file. %4$sIf you cannot edit %3$s, you should remove the data from %1$s manually then restore to the backup again.', 'event_espresso'),
607 607
 								$wp_table_name,
608 608
 								"<pre>define( 'EE_DROP_BAD_TABLES', TRUE );</pre>",
609 609
 								'<b>wp-config.php</b>',
@@ -612,25 +612,25 @@  discard block
 block discarded – undo
612 612
 			}
613 613
 		}
614 614
 		// does $sql contain valid column information? ( LPT: https://regex101.com/ is great for working out regex patterns )
615
-		if ( preg_match( '((((.*?))(,\s))+)', $sql, $valid_column_data ) ) {
615
+		if (preg_match('((((.*?))(,\s))+)', $sql, $valid_column_data)) {
616 616
 			$SQL = "CREATE TABLE $wp_table_name ( $sql ) $engine DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;";
617 617
 			//get $wpdb to echo errors, but buffer them. This way at least WE know an error
618 618
 			//happened. And then we can choose to tell the end user
619
-			$old_show_errors_policy = $wpdb->show_errors( TRUE );
620
-			$old_error_suppression_policy = $wpdb->suppress_errors( FALSE );
619
+			$old_show_errors_policy = $wpdb->show_errors(TRUE);
620
+			$old_error_suppression_policy = $wpdb->suppress_errors(FALSE);
621 621
 			ob_start();
622
-			dbDelta( $SQL );
622
+			dbDelta($SQL);
623 623
 			$output = ob_get_contents();
624 624
 			ob_end_clean();
625
-			$wpdb->show_errors( $old_show_errors_policy );
626
-			$wpdb->suppress_errors( $old_error_suppression_policy );
627
-			if( ! empty( $output ) ){
628
-				throw new EE_Error( $output	);
625
+			$wpdb->show_errors($old_show_errors_policy);
626
+			$wpdb->suppress_errors($old_error_suppression_policy);
627
+			if ( ! empty($output)) {
628
+				throw new EE_Error($output);
629 629
 			}
630 630
 		} else {
631 631
 			throw new EE_Error(
632 632
 				sprintf(
633
-					__( 'The following table creation SQL does not contain valid information about the table columns: %1$s %2$s', 'event_espresso' ),
633
+					__('The following table creation SQL does not contain valid information about the table columns: %1$s %2$s', 'event_espresso'),
634 634
 					'<br />',
635 635
 					$sql
636 636
 				)
@@ -652,15 +652,15 @@  discard block
 block discarded – undo
652 652
 	 * @param string $column_info if your SQL were 'ALTER TABLE table_name ADD price VARCHAR(10)', this would be 'VARCHAR(10)'
653 653
 	 * @return bool|int
654 654
 	 */
655
-	public static function add_column_if_it_doesnt_exist($table_name,$column_name,$column_info='INT UNSIGNED NOT NULL'){
656
-		if( apply_filters( 'FHEE__EEH_Activation__add_column_if_it_doesnt_exist__short_circuit', FALSE ) ){
655
+	public static function add_column_if_it_doesnt_exist($table_name, $column_name, $column_info = 'INT UNSIGNED NOT NULL') {
656
+		if (apply_filters('FHEE__EEH_Activation__add_column_if_it_doesnt_exist__short_circuit', FALSE)) {
657 657
 			return FALSE;
658 658
 		}
659 659
 		global $wpdb;
660
-		$full_table_name= EEH_Activation::ensure_table_name_has_prefix( $table_name );
660
+		$full_table_name = EEH_Activation::ensure_table_name_has_prefix($table_name);
661 661
 		$fields = self::get_fields_on_table($table_name);
662
-		if (!in_array($column_name, $fields)){
663
-			$alter_query="ALTER TABLE $full_table_name ADD $column_name $column_info";
662
+		if ( ! in_array($column_name, $fields)) {
663
+			$alter_query = "ALTER TABLE $full_table_name ADD $column_name $column_info";
664 664
 			//echo "alter query:$alter_query";
665 665
 			return $wpdb->query($alter_query);
666 666
 		}
@@ -679,15 +679,15 @@  discard block
 block discarded – undo
679 679
 	 * 	@param string $table_name, without prefixed $wpdb->prefix
680 680
 	 * 	@return array of database column names
681 681
 	 */
682
-	public static function get_fields_on_table( $table_name = NULL ) {
682
+	public static function get_fields_on_table($table_name = NULL) {
683 683
 		global $wpdb;
684
-		$table_name= EEH_Activation::ensure_table_name_has_prefix( $table_name );
685
-		if ( ! empty( $table_name )) {
684
+		$table_name = EEH_Activation::ensure_table_name_has_prefix($table_name);
685
+		if ( ! empty($table_name)) {
686 686
 			$columns = $wpdb->get_results("SHOW COLUMNS FROM $table_name ");
687 687
 			if ($columns !== FALSE) {
688 688
 				$field_array = array();
689
-				foreach($columns as $column ){
690
-					$field_array[] = $column->Field;;
689
+				foreach ($columns as $column) {
690
+					$field_array[] = $column->Field; ;
691 691
 				}
692 692
 				return $field_array;
693 693
 			}
@@ -705,12 +705,12 @@  discard block
 block discarded – undo
705 705
 	 * @param string $table_name
706 706
 	 * @return bool
707 707
 	 */
708
-	public static function db_table_is_empty( $table_name ) {
708
+	public static function db_table_is_empty($table_name) {
709 709
 		global $wpdb;
710
-		$table_name = EEH_Activation::ensure_table_name_has_prefix( $table_name );
711
-		if ( EEH_Activation::table_exists( $table_name ) ) {
712
-			$count = $wpdb->get_var( "SELECT COUNT(*) FROM $table_name" );
713
-			return absint( $count ) === 0 ? true : false;
710
+		$table_name = EEH_Activation::ensure_table_name_has_prefix($table_name);
711
+		if (EEH_Activation::table_exists($table_name)) {
712
+			$count = $wpdb->get_var("SELECT COUNT(*) FROM $table_name");
713
+			return absint($count) === 0 ? true : false;
714 714
 		}
715 715
 		return false;
716 716
 	}
@@ -725,9 +725,9 @@  discard block
 block discarded – undo
725 725
 	 * @param string $table_name
726 726
 	 * @return bool | int
727 727
 	 */
728
-	public static function delete_db_table_if_empty( $table_name ) {
729
-		if ( EEH_Activation::db_table_is_empty( $table_name ) ) {
730
-			return EEH_Activation::delete_unused_db_table( $table_name );
728
+	public static function delete_db_table_if_empty($table_name) {
729
+		if (EEH_Activation::db_table_is_empty($table_name)) {
730
+			return EEH_Activation::delete_unused_db_table($table_name);
731 731
 		}
732 732
 		return false;
733 733
 	}
@@ -742,11 +742,11 @@  discard block
 block discarded – undo
742 742
 	 * @param string $table_name
743 743
 	 * @return bool | int
744 744
 	 */
745
-	public static function delete_unused_db_table( $table_name ) {
745
+	public static function delete_unused_db_table($table_name) {
746 746
 		global $wpdb;
747
-		if ( EEH_Activation::table_exists( $table_name ) ) {
748
-			$table_name = EEH_Activation::ensure_table_name_has_prefix( $table_name );
749
-			return $wpdb->query( "DROP TABLE IF EXISTS $table_name" );
747
+		if (EEH_Activation::table_exists($table_name)) {
748
+			$table_name = EEH_Activation::ensure_table_name_has_prefix($table_name);
749
+			return $wpdb->query("DROP TABLE IF EXISTS $table_name");
750 750
 		}
751 751
 		return false;
752 752
 	}
@@ -762,18 +762,18 @@  discard block
 block discarded – undo
762 762
 	 * @param string $index_name
763 763
 	 * @return bool | int
764 764
 	 */
765
-	public static function drop_index( $table_name, $index_name ) {
766
-		if( apply_filters( 'FHEE__EEH_Activation__drop_index__short_circuit', FALSE ) ){
765
+	public static function drop_index($table_name, $index_name) {
766
+		if (apply_filters('FHEE__EEH_Activation__drop_index__short_circuit', FALSE)) {
767 767
 			return FALSE;
768 768
 		}
769 769
 		global $wpdb;
770
-		$table_name = EEH_Activation::ensure_table_name_has_prefix( $table_name );
770
+		$table_name = EEH_Activation::ensure_table_name_has_prefix($table_name);
771 771
 		$index_exists_query = "SHOW INDEX FROM $table_name WHERE Key_name = '$index_name'";
772 772
 		if (
773
-			$wpdb->get_var( "SHOW TABLES LIKE '$table_name'" ) == $table_name
774
-			&& $wpdb->get_var( $index_exists_query ) == $table_name //using get_var with the $index_exists_query returns the table's name
773
+			$wpdb->get_var("SHOW TABLES LIKE '$table_name'") == $table_name
774
+			&& $wpdb->get_var($index_exists_query) == $table_name //using get_var with the $index_exists_query returns the table's name
775 775
 		) {
776
-			return $wpdb->query( "ALTER TABLE $table_name DROP INDEX $index_name" );
776
+			return $wpdb->query("ALTER TABLE $table_name DROP INDEX $index_name");
777 777
 		}
778 778
 		return TRUE;
779 779
 	}
@@ -789,27 +789,27 @@  discard block
 block discarded – undo
789 789
 	 * @return boolean success (whether database is setup properly or not)
790 790
 	 */
791 791
 	public static function create_database_tables() {
792
-		EE_Registry::instance()->load_core( 'Data_Migration_Manager' );
792
+		EE_Registry::instance()->load_core('Data_Migration_Manager');
793 793
 		//find the migration script that sets the database to be compatible with the code
794 794
 		$dms_name = EE_Data_Migration_Manager::instance()->get_most_up_to_date_dms();
795
-		if( $dms_name ){
796
-			$current_data_migration_script = EE_Registry::instance()->load_dms( $dms_name );
797
-			$current_data_migration_script->set_migrating( false );
795
+		if ($dms_name) {
796
+			$current_data_migration_script = EE_Registry::instance()->load_dms($dms_name);
797
+			$current_data_migration_script->set_migrating(false);
798 798
 			$current_data_migration_script->schema_changes_before_migration();
799 799
 			$current_data_migration_script->schema_changes_after_migration();
800
-			if( $current_data_migration_script->get_errors() ){
801
-				if( WP_DEBUG ){
802
-					foreach( $current_data_migration_script->get_errors() as $error ){
803
-						EE_Error::add_error($error, __FILE__, __FUNCTION__, __LINE__ );
800
+			if ($current_data_migration_script->get_errors()) {
801
+				if (WP_DEBUG) {
802
+					foreach ($current_data_migration_script->get_errors() as $error) {
803
+						EE_Error::add_error($error, __FILE__, __FUNCTION__, __LINE__);
804 804
 					}
805
-				}else{
806
-					EE_Error::add_error( __( 'There were errors creating the Event Espresso database tables and Event Espresso has been deactivated. To view the errors, please enable WP_DEBUG in your wp-config.php file.', 'event_espresso' ) );
805
+				} else {
806
+					EE_Error::add_error(__('There were errors creating the Event Espresso database tables and Event Espresso has been deactivated. To view the errors, please enable WP_DEBUG in your wp-config.php file.', 'event_espresso'));
807 807
 				}
808 808
 				return false;
809 809
 			}
810 810
 			EE_Data_Migration_Manager::instance()->update_current_database_state_to();
811
-		}else{
812
-			EE_Error::add_error( __( 'Could not determine most up-to-date data migration script from which to pull database schema structure. So database is probably not setup properly', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__);
811
+		} else {
812
+			EE_Error::add_error(__('Could not determine most up-to-date data migration script from which to pull database schema structure. So database is probably not setup properly', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
813 813
 			return false;
814 814
 		}
815 815
 		return true;
@@ -829,27 +829,27 @@  discard block
 block discarded – undo
829 829
 	public static function initialize_system_questions() {
830 830
 		// QUESTION GROUPS
831 831
 		global $wpdb;
832
-		$table_name = EEH_Activation::ensure_table_name_has_prefix( 'esp_question_group' );
832
+		$table_name = EEH_Activation::ensure_table_name_has_prefix('esp_question_group');
833 833
 		$SQL = "SELECT QSG_system FROM $table_name WHERE QSG_system != 0";
834 834
 		// what we have
835
-		$question_groups = $wpdb->get_col( $SQL );
835
+		$question_groups = $wpdb->get_col($SQL);
836 836
 		// check the response
837
-		$question_groups = is_array( $question_groups ) ? $question_groups : array();
837
+		$question_groups = is_array($question_groups) ? $question_groups : array();
838 838
 		// what we should have
839
-		$QSG_systems = array( 1, 2 );
839
+		$QSG_systems = array(1, 2);
840 840
 		// loop thru what we should have and compare to what we have
841
-		foreach ( $QSG_systems as $QSG_system ) {
841
+		foreach ($QSG_systems as $QSG_system) {
842 842
 			// reset values array
843 843
 			$QSG_values = array();
844 844
 			// if we don't have what we should have (but use $QST_system as as string because that's what we got from the db)
845
-			if ( ! in_array( "$QSG_system", $question_groups )) {
845
+			if ( ! in_array("$QSG_system", $question_groups)) {
846 846
 				// add it
847
-				switch ( $QSG_system ) {
847
+				switch ($QSG_system) {
848 848
 
849 849
 					case 1:
850 850
 							$QSG_values = array(
851
-									'QSG_name' => __( 'Personal Information', 'event_espresso' ),
852
-									'QSG_identifier' => 'personal-information-' . time(),
851
+									'QSG_name' => __('Personal Information', 'event_espresso'),
852
+									'QSG_identifier' => 'personal-information-'.time(),
853 853
 									'QSG_desc' => '',
854 854
 									'QSG_order' => 1,
855 855
 									'QSG_show_group_name' => 1,
@@ -861,8 +861,8 @@  discard block
 block discarded – undo
861 861
 
862 862
 					case 2:
863 863
 							$QSG_values = array(
864
-									'QSG_name' => __( 'Address Information','event_espresso' ),
865
-									'QSG_identifier' => 'address-information-' . time(),
864
+									'QSG_name' => __('Address Information', 'event_espresso'),
865
+									'QSG_identifier' => 'address-information-'.time(),
866 866
 									'QSG_desc' => '',
867 867
 									'QSG_order' => 2,
868 868
 									'QSG_show_group_name' => 1,
@@ -874,14 +874,14 @@  discard block
 block discarded – undo
874 874
 
875 875
 				}
876 876
 				// make sure we have some values before inserting them
877
-				if ( ! empty( $QSG_values )) {
877
+				if ( ! empty($QSG_values)) {
878 878
 					// insert system question
879 879
 					$wpdb->insert(
880 880
 						$table_name,
881 881
 						$QSG_values,
882
-						array('%s', '%s', '%s', '%d', '%d', '%d', '%d', '%d' )
882
+						array('%s', '%s', '%s', '%d', '%d', '%d', '%d', '%d')
883 883
 					);
884
-					$QSG_IDs[ $QSG_system ] = $wpdb->insert_id;
884
+					$QSG_IDs[$QSG_system] = $wpdb->insert_id;
885 885
 				}
886 886
 			}
887 887
 		}
@@ -890,10 +890,10 @@  discard block
 block discarded – undo
890 890
 
891 891
 		// QUESTIONS
892 892
 		global $wpdb;
893
-		$table_name = EEH_Activation::ensure_table_name_has_prefix( 'esp_question' );
893
+		$table_name = EEH_Activation::ensure_table_name_has_prefix('esp_question');
894 894
 		$SQL = "SELECT QST_system FROM $table_name WHERE QST_system != ''";
895 895
 		// what we have
896
-		$questions = $wpdb->get_col( $SQL );
896
+		$questions = $wpdb->get_col($SQL);
897 897
 		// what we should have
898 898
 		$QST_systems = array(
899 899
 			'fname',
@@ -910,22 +910,22 @@  discard block
 block discarded – undo
910 910
 		$order_for_group_1 = 1;
911 911
 		$order_for_group_2 = 1;
912 912
 		// loop thru what we should have and compare to what we have
913
-		foreach ( $QST_systems as $QST_system ) {
913
+		foreach ($QST_systems as $QST_system) {
914 914
 			// reset values array
915 915
 			$QST_values = array();
916 916
 			// if we don't have what we should have
917
-			if ( ! in_array( $QST_system, $questions )) {
917
+			if ( ! in_array($QST_system, $questions)) {
918 918
 				// add it
919
-				switch ( $QST_system ) {
919
+				switch ($QST_system) {
920 920
 
921 921
 					case 'fname':
922 922
 							$QST_values = array(
923
-									'QST_display_text' => __( 'First Name', 'event_espresso' ),
924
-									'QST_admin_label' => __( 'First Name - System Question', 'event_espresso' ),
923
+									'QST_display_text' => __('First Name', 'event_espresso'),
924
+									'QST_admin_label' => __('First Name - System Question', 'event_espresso'),
925 925
 									'QST_system' => 'fname',
926 926
 									'QST_type' => 'TEXT',
927 927
 									'QST_required' => 1,
928
-									'QST_required_text' => __( 'This field is required', 'event_espresso' ),
928
+									'QST_required_text' => __('This field is required', 'event_espresso'),
929 929
 									'QST_order' => 1,
930 930
 									'QST_admin_only' => 0,
931 931
 									'QST_wp_user' => self::get_default_creator_id(),
@@ -935,12 +935,12 @@  discard block
 block discarded – undo
935 935
 
936 936
 					case 'lname':
937 937
 							$QST_values = array(
938
-									'QST_display_text' => __( 'Last Name', 'event_espresso' ),
939
-									'QST_admin_label' => __( 'Last Name - System Question', 'event_espresso' ),
938
+									'QST_display_text' => __('Last Name', 'event_espresso'),
939
+									'QST_admin_label' => __('Last Name - System Question', 'event_espresso'),
940 940
 									'QST_system' => 'lname',
941 941
 									'QST_type' => 'TEXT',
942 942
 									'QST_required' => 1,
943
-									'QST_required_text' => __( 'This field is required', 'event_espresso' ),
943
+									'QST_required_text' => __('This field is required', 'event_espresso'),
944 944
 									'QST_order' => 2,
945 945
 									'QST_admin_only' => 0,
946 946
 									'QST_wp_user' => self::get_default_creator_id(),
@@ -950,12 +950,12 @@  discard block
 block discarded – undo
950 950
 
951 951
 					case 'email':
952 952
 							$QST_values = array(
953
-									'QST_display_text' => __( 'Email Address', 'event_espresso' ),
954
-									'QST_admin_label' => __( 'Email Address - System Question', 'event_espresso' ),
953
+									'QST_display_text' => __('Email Address', 'event_espresso'),
954
+									'QST_admin_label' => __('Email Address - System Question', 'event_espresso'),
955 955
 									'QST_system' => 'email',
956 956
 									'QST_type' => 'TEXT',
957 957
 									'QST_required' => 1,
958
-									'QST_required_text' => __( 'This field is required', 'event_espresso' ),
958
+									'QST_required_text' => __('This field is required', 'event_espresso'),
959 959
 									'QST_order' => 3,
960 960
 									'QST_admin_only' => 0,
961 961
 									'QST_wp_user' => self::get_default_creator_id(),
@@ -965,12 +965,12 @@  discard block
 block discarded – undo
965 965
 
966 966
 					case 'address':
967 967
 							$QST_values = array(
968
-									'QST_display_text' => __( 'Address', 'event_espresso' ),
969
-									'QST_admin_label' => __( 'Address - System Question', 'event_espresso' ),
968
+									'QST_display_text' => __('Address', 'event_espresso'),
969
+									'QST_admin_label' => __('Address - System Question', 'event_espresso'),
970 970
 									'QST_system' => 'address',
971 971
 									'QST_type' => 'TEXT',
972 972
 									'QST_required' => 0,
973
-									'QST_required_text' => __( 'This field is required', 'event_espresso' ),
973
+									'QST_required_text' => __('This field is required', 'event_espresso'),
974 974
 									'QST_order' => 4,
975 975
 									'QST_admin_only' => 0,
976 976
 									'QST_wp_user' => self::get_default_creator_id(),
@@ -980,12 +980,12 @@  discard block
 block discarded – undo
980 980
 
981 981
 					case 'address2':
982 982
 							$QST_values = array(
983
-									'QST_display_text' => __( 'Address2', 'event_espresso' ),
984
-									'QST_admin_label' => __( 'Address2 - System Question', 'event_espresso' ),
983
+									'QST_display_text' => __('Address2', 'event_espresso'),
984
+									'QST_admin_label' => __('Address2 - System Question', 'event_espresso'),
985 985
 									'QST_system' => 'address2',
986 986
 									'QST_type' => 'TEXT',
987 987
 									'QST_required' => 0,
988
-									'QST_required_text' => __( 'This field is required', 'event_espresso' ),
988
+									'QST_required_text' => __('This field is required', 'event_espresso'),
989 989
 									'QST_order' => 5,
990 990
 									'QST_admin_only' => 0,
991 991
 									'QST_wp_user' => self::get_default_creator_id(),
@@ -995,12 +995,12 @@  discard block
 block discarded – undo
995 995
 
996 996
 					case 'city':
997 997
 							$QST_values = array(
998
-									'QST_display_text' => __( 'City', 'event_espresso' ),
999
-									'QST_admin_label' => __( 'City - System Question', 'event_espresso' ),
998
+									'QST_display_text' => __('City', 'event_espresso'),
999
+									'QST_admin_label' => __('City - System Question', 'event_espresso'),
1000 1000
 									'QST_system' => 'city',
1001 1001
 									'QST_type' => 'TEXT',
1002 1002
 									'QST_required' => 0,
1003
-									'QST_required_text' => __( 'This field is required', 'event_espresso' ),
1003
+									'QST_required_text' => __('This field is required', 'event_espresso'),
1004 1004
 									'QST_order' => 6,
1005 1005
 									'QST_admin_only' => 0,
1006 1006
 									'QST_wp_user' => self::get_default_creator_id(),
@@ -1010,12 +1010,12 @@  discard block
 block discarded – undo
1010 1010
 
1011 1011
 					case 'state':
1012 1012
 							$QST_values = array(
1013
-									'QST_display_text' => __( 'State/Province', 'event_espresso' ),
1014
-									'QST_admin_label' => __( 'State/Province - System Question', 'event_espresso' ),
1013
+									'QST_display_text' => __('State/Province', 'event_espresso'),
1014
+									'QST_admin_label' => __('State/Province - System Question', 'event_espresso'),
1015 1015
 									'QST_system' => 'state',
1016 1016
 									'QST_type' => 'STATE',
1017 1017
 									'QST_required' => 0,
1018
-									'QST_required_text' => __( 'This field is required', 'event_espresso' ),
1018
+									'QST_required_text' => __('This field is required', 'event_espresso'),
1019 1019
 									'QST_order' => 7,
1020 1020
 									'QST_admin_only' => 0,
1021 1021
 									'QST_wp_user' => self::get_default_creator_id(),
@@ -1025,12 +1025,12 @@  discard block
 block discarded – undo
1025 1025
 
1026 1026
 					case 'country' :
1027 1027
 							$QST_values = array(
1028
-									'QST_display_text' => __( 'Country', 'event_espresso' ),
1029
-									'QST_admin_label' => __( 'Country - System Question', 'event_espresso' ),
1028
+									'QST_display_text' => __('Country', 'event_espresso'),
1029
+									'QST_admin_label' => __('Country - System Question', 'event_espresso'),
1030 1030
 									'QST_system' => 'country',
1031 1031
 									'QST_type' => 'COUNTRY',
1032 1032
 									'QST_required' => 0,
1033
-									'QST_required_text' => __( 'This field is required', 'event_espresso' ),
1033
+									'QST_required_text' => __('This field is required', 'event_espresso'),
1034 1034
 									'QST_order' => 8,
1035 1035
 									'QST_admin_only' => 0,
1036 1036
 									'QST_wp_user' => self::get_default_creator_id(),
@@ -1040,12 +1040,12 @@  discard block
 block discarded – undo
1040 1040
 
1041 1041
 					case 'zip':
1042 1042
 							$QST_values = array(
1043
-									'QST_display_text' => __( 'Zip/Postal Code', 'event_espresso' ),
1044
-									'QST_admin_label' => __( 'Zip/Postal Code - System Question', 'event_espresso' ),
1043
+									'QST_display_text' => __('Zip/Postal Code', 'event_espresso'),
1044
+									'QST_admin_label' => __('Zip/Postal Code - System Question', 'event_espresso'),
1045 1045
 									'QST_system' => 'zip',
1046 1046
 									'QST_type' => 'TEXT',
1047 1047
 									'QST_required' => 0,
1048
-									'QST_required_text' => __( 'This field is required', 'event_espresso' ),
1048
+									'QST_required_text' => __('This field is required', 'event_espresso'),
1049 1049
 									'QST_order' => 9,
1050 1050
 									'QST_admin_only' => 0,
1051 1051
 									'QST_wp_user' => self::get_default_creator_id(),
@@ -1055,12 +1055,12 @@  discard block
 block discarded – undo
1055 1055
 
1056 1056
 					case 'phone':
1057 1057
 							$QST_values = array(
1058
-									'QST_display_text' => __( 'Phone Number', 'event_espresso' ),
1059
-									'QST_admin_label' => __( 'Phone Number - System Question', 'event_espresso' ),
1058
+									'QST_display_text' => __('Phone Number', 'event_espresso'),
1059
+									'QST_admin_label' => __('Phone Number - System Question', 'event_espresso'),
1060 1060
 									'QST_system' => 'phone',
1061 1061
 									'QST_type' => 'TEXT',
1062 1062
 									'QST_required' => 0,
1063
-									'QST_required_text' => __( 'This field is required', 'event_espresso' ),
1063
+									'QST_required_text' => __('This field is required', 'event_espresso'),
1064 1064
 									'QST_order' => 10,
1065 1065
 									'QST_admin_only' => 0,
1066 1066
 									'QST_wp_user' => self::get_default_creator_id(),
@@ -1069,34 +1069,34 @@  discard block
 block discarded – undo
1069 1069
 						break;
1070 1070
 
1071 1071
 				}
1072
-				if ( ! empty( $QST_values )) {
1072
+				if ( ! empty($QST_values)) {
1073 1073
 					// insert system question
1074 1074
 					$wpdb->insert(
1075 1075
 						$table_name,
1076 1076
 						$QST_values,
1077
-						array( '%s', '%s', '%s', '%s', '%d', '%s', '%d', '%d', '%d', '%d' )
1077
+						array('%s', '%s', '%s', '%s', '%d', '%s', '%d', '%d', '%d', '%d')
1078 1078
 					);
1079 1079
 					$QST_ID = $wpdb->insert_id;
1080 1080
 
1081 1081
 					// QUESTION GROUP QUESTIONS
1082
-					if(  in_array( $QST_system, array( 'fname', 'lname', 'email' ) ) ) {
1082
+					if (in_array($QST_system, array('fname', 'lname', 'email'))) {
1083 1083
 						$system_question_we_want = EEM_Question_Group::system_personal;
1084 1084
 					} else {
1085 1085
 						$system_question_we_want = EEM_Question_Group::system_address;
1086 1086
 					}
1087
-					if( isset( $QSG_IDs[ $system_question_we_want ] ) ) {
1088
-						$QSG_ID = $QSG_IDs[ $system_question_we_want ];
1087
+					if (isset($QSG_IDs[$system_question_we_want])) {
1088
+						$QSG_ID = $QSG_IDs[$system_question_we_want];
1089 1089
 					} else {
1090
-						$id_col = EEM_Question_Group::instance()->get_col( array( array( 'QSG_system' => $system_question_we_want ) ) );
1091
-						if( is_array( $id_col ) ) {
1092
-							$QSG_ID = reset( $id_col );
1090
+						$id_col = EEM_Question_Group::instance()->get_col(array(array('QSG_system' => $system_question_we_want)));
1091
+						if (is_array($id_col)) {
1092
+							$QSG_ID = reset($id_col);
1093 1093
 						} else {
1094 1094
 							//ok so we didn't find it in the db either?? that's weird because we should have inserted it at the start of this method
1095 1095
                                                         EE_Log::instance()->log( 
1096 1096
                                                                 __FILE__, 
1097 1097
                                                                 __FUNCTION__, 
1098 1098
                                                                 sprintf( 
1099
-                                                                        __( 'Could not associate question %1$s to a question group because no system question group existed', 'event_espresso'), 
1099
+                                                                        __('Could not associate question %1$s to a question group because no system question group existed', 'event_espresso'), 
1100 1100
                                                                         $QST_ID ), 
1101 1101
                                                                 'error' );
1102 1102
                                                         continue;
@@ -1105,9 +1105,9 @@  discard block
 block discarded – undo
1105 1105
                                         
1106 1106
 					// add system questions to groups
1107 1107
 					$wpdb->insert(
1108
-						EEH_Activation::ensure_table_name_has_prefix( 'esp_question_group_question' ),
1109
-						array( 'QSG_ID' => $QSG_ID , 'QST_ID' => $QST_ID, 'QGQ_order'=>($QSG_ID==1)? $order_for_group_1++ : $order_for_group_2++ ),
1110
-						array( '%d', '%d','%d' )
1108
+						EEH_Activation::ensure_table_name_has_prefix('esp_question_group_question'),
1109
+						array('QSG_ID' => $QSG_ID, 'QST_ID' => $QST_ID, 'QGQ_order'=>($QSG_ID == 1) ? $order_for_group_1++ : $order_for_group_2++),
1110
+						array('%d', '%d', '%d')
1111 1111
 					);
1112 1112
 				}
1113 1113
 			}
@@ -1119,11 +1119,11 @@  discard block
 block discarded – undo
1119 1119
 	 * Makes sure the default payment method (Invoice) is active.
1120 1120
 	 * This used to be done automatically as part of constructing the old gateways config
1121 1121
 	 */
1122
-	public static function insert_default_payment_methods(){
1123
-		if( ! EEM_Payment_Method::instance()->count_active( EEM_Payment_Method::scope_cart ) ){
1124
-			EE_Registry::instance()->load_lib( 'Payment_Method_Manager' );
1125
-			EE_Payment_Method_Manager::instance()->activate_a_payment_method_of_type( 'Invoice' );
1126
-		}else{
1122
+	public static function insert_default_payment_methods() {
1123
+		if ( ! EEM_Payment_Method::instance()->count_active(EEM_Payment_Method::scope_cart)) {
1124
+			EE_Registry::instance()->load_lib('Payment_Method_Manager');
1125
+			EE_Payment_Method_Manager::instance()->activate_a_payment_method_of_type('Invoice');
1126
+		} else {
1127 1127
 			EEM_Payment_Method::instance()->verify_button_urls();
1128 1128
 		}
1129 1129
 	}
@@ -1139,7 +1139,7 @@  discard block
 block discarded – undo
1139 1139
 
1140 1140
 		global $wpdb;
1141 1141
 
1142
-		if ( EEH_Activation::table_exists( EEM_Status::instance()->table() ) ) {
1142
+		if (EEH_Activation::table_exists(EEM_Status::instance()->table())) {
1143 1143
 
1144 1144
 			$table_name = EEM_Status::instance()->table();
1145 1145
 
@@ -1205,35 +1205,35 @@  discard block
 block discarded – undo
1205 1205
 	 * 	@return boolean success of verifying upload directories exist
1206 1206
 	 */
1207 1207
 	public static function create_upload_directories() {
1208
-		EE_Registry::instance()->load_helper( 'File' );
1208
+		EE_Registry::instance()->load_helper('File');
1209 1209
 		// Create the required folders
1210 1210
 		$folders = array(
1211 1211
 				EVENT_ESPRESSO_TEMPLATE_DIR,
1212 1212
 				EVENT_ESPRESSO_GATEWAY_DIR,
1213
-				EVENT_ESPRESSO_UPLOAD_DIR . 'logs/',
1214
-				EVENT_ESPRESSO_UPLOAD_DIR . 'css/',
1215
-				EVENT_ESPRESSO_UPLOAD_DIR . 'tickets/'
1213
+				EVENT_ESPRESSO_UPLOAD_DIR.'logs/',
1214
+				EVENT_ESPRESSO_UPLOAD_DIR.'css/',
1215
+				EVENT_ESPRESSO_UPLOAD_DIR.'tickets/'
1216 1216
 		);
1217
-		foreach ( $folders as $folder ) {
1217
+		foreach ($folders as $folder) {
1218 1218
 			try {
1219
-				EEH_File::ensure_folder_exists_and_is_writable( $folder );
1220
-				@ chmod( $folder, 0755 );
1221
-			} catch( EE_Error $e ){
1219
+				EEH_File::ensure_folder_exists_and_is_writable($folder);
1220
+				@ chmod($folder, 0755);
1221
+			} catch (EE_Error $e) {
1222 1222
 				EE_Error::add_error(
1223 1223
 					sprintf(
1224
-						__(  'Could not create the folder at "%1$s" because: %2$s', 'event_espresso' ),
1224
+						__('Could not create the folder at "%1$s" because: %2$s', 'event_espresso'),
1225 1225
 						$folder,
1226
-						'<br />' . $e->getMessage()
1226
+						'<br />'.$e->getMessage()
1227 1227
 					),
1228 1228
 					__FILE__, __FUNCTION__, __LINE__
1229 1229
 				);
1230 1230
 				//indicate we'll need to fix this later
1231
-				update_option( EEH_Activation::upload_directories_incomplete_option_name, true );
1231
+				update_option(EEH_Activation::upload_directories_incomplete_option_name, true);
1232 1232
 				return FALSE;
1233 1233
 			}
1234 1234
 		}
1235 1235
 		//remember EE's folders are all good
1236
-		delete_option( EEH_Activation::upload_directories_incomplete_option_name );
1236
+		delete_option(EEH_Activation::upload_directories_incomplete_option_name);
1237 1237
 		return TRUE;
1238 1238
 	}
1239 1239
 	
@@ -1246,7 +1246,7 @@  discard block
 block discarded – undo
1246 1246
 	 * @return boolean
1247 1247
 	 */
1248 1248
 	public static function upload_directories_incomplete() {
1249
-		return get_option( EEH_Activation::upload_directories_incomplete_option_name, false );
1249
+		return get_option(EEH_Activation::upload_directories_incomplete_option_name, false);
1250 1250
 	}
1251 1251
 
1252 1252
 
@@ -1265,16 +1265,16 @@  discard block
 block discarded – undo
1265 1265
 		$installed_messengers = $default_messengers = array();
1266 1266
 
1267 1267
 		//include our helper
1268
-		EE_Registry::instance()->load_helper( 'MSG_Template' );
1268
+		EE_Registry::instance()->load_helper('MSG_Template');
1269 1269
 
1270 1270
 		//get all installed messenger objects
1271 1271
 		$installed = EEH_MSG_Template::get_installed_message_objects();
1272 1272
 
1273 1273
 		//let's setup the $installed messengers in an array AND the messengers that are set to be activated on install.
1274
-		foreach ( $installed['messengers'] as $msgr ) {
1275
-			if ( $msgr instanceof EE_messenger ) {
1274
+		foreach ($installed['messengers'] as $msgr) {
1275
+			if ($msgr instanceof EE_messenger) {
1276 1276
 				$installed_messengers[$msgr->name] = $msgr;
1277
-				if ( $msgr->activate_on_install ) {
1277
+				if ($msgr->activate_on_install) {
1278 1278
 					$default_messengers[] = $msgr->name;
1279 1279
 				}
1280 1280
 			}
@@ -1284,36 +1284,36 @@  discard block
 block discarded – undo
1284 1284
 		$active_messengers = EEH_MSG_Template::get_active_messengers_in_db();
1285 1285
 
1286 1286
 		//things that have already been activated before
1287
-		$has_activated = get_option( 'ee_has_activated_messenger' );
1287
+		$has_activated = get_option('ee_has_activated_messenger');
1288 1288
 
1289 1289
 		//do an initial loop to determine if we need to continue
1290 1290
 		$def_ms = array();
1291
-		foreach ( $default_messengers as $msgr ) {
1292
-			if ( isset($active_messengers[$msgr] ) || isset( $has_activated[$msgr] ) ) continue;
1291
+		foreach ($default_messengers as $msgr) {
1292
+			if (isset($active_messengers[$msgr]) || isset($has_activated[$msgr])) continue;
1293 1293
 			$def_ms[] = $msgr;
1294 1294
 		}
1295 1295
 
1296 1296
 		//setup the $installed_mts in an array
1297
-		foreach ( $installed['message_types'] as $imt ) {
1298
-			if ( $imt instanceof EE_message_type ) {
1297
+		foreach ($installed['message_types'] as $imt) {
1298
+			if ($imt instanceof EE_message_type) {
1299 1299
 				$installed_mts[$imt->name] = $imt;
1300 1300
 			}
1301 1301
 		}
1302 1302
 
1303 1303
 		//loop through default array for default messengers (if present)
1304
-		if ( ! empty( $def_ms ) ) {
1305
-			foreach ( $def_ms as $messenger ) {
1304
+		if ( ! empty($def_ms)) {
1305
+			foreach ($def_ms as $messenger) {
1306 1306
 				//all is good so let's setup the default stuff. We need to use the given messenger object (if exists) to get the default message type for the messenger.
1307
-				if ( ! isset( $installed_messengers[$messenger] )) {
1307
+				if ( ! isset($installed_messengers[$messenger])) {
1308 1308
 					continue;
1309 1309
 				}
1310 1310
 				/** @var EE_messenger[] $installed_messengers  */
1311 1311
 				$default_mts = $installed_messengers[$messenger]->get_default_message_types();
1312 1312
 				$active_messengers[$messenger]['obj'] = $installed_messengers[$messenger];
1313
-				foreach ( $default_mts as $index => $mt ) {
1313
+				foreach ($default_mts as $index => $mt) {
1314 1314
 					//is there an installed_mt matching the default string?  If not then nothing to do here.
1315
-					if ( ! isset( $installed_mts[$mt] ) ) {
1316
-						unset( $default_mts[$index] );
1315
+					if ( ! isset($installed_mts[$mt])) {
1316
+						unset($default_mts[$index]);
1317 1317
 						continue;
1318 1318
 					}
1319 1319
 
@@ -1322,41 +1322,41 @@  discard block
 block discarded – undo
1322 1322
 					/** @var EE_message_type[] $installed_mts */
1323 1323
 					$settings_fields = $installed_mts[$mt]->get_admin_settings_fields();
1324 1324
 					$settings = array();
1325
-					if ( is_array( $settings_fields ) ) {
1326
-						foreach ( $settings_fields as $field => $values ) {
1327
-							if ( isset( $values['default'] ) ) {
1325
+					if (is_array($settings_fields)) {
1326
+						foreach ($settings_fields as $field => $values) {
1327
+							if (isset($values['default'])) {
1328 1328
 								$settings[$field] = $values['default'];
1329 1329
 							}
1330 1330
 						}
1331 1331
 					}
1332 1332
 
1333
-					$active_messengers[$messenger]['settings'][$messenger . '-message_types'][$mt]['settings'] = $settings;
1333
+					$active_messengers[$messenger]['settings'][$messenger.'-message_types'][$mt]['settings'] = $settings;
1334 1334
 					$has_activated[$messenger][] = $mt;
1335 1335
 				}
1336 1336
 
1337 1337
 				//setup any initial settings for the messenger
1338 1338
 				$msgr_settings = $installed_messengers[$messenger]->get_admin_settings_fields();
1339 1339
 
1340
-				if ( !empty( $msgr_settings ) ) {
1341
-					foreach ( $msgr_settings as $field => $value ) {
1340
+				if ( ! empty($msgr_settings)) {
1341
+					foreach ($msgr_settings as $field => $value) {
1342 1342
 						$active_messengers[$messenger]['settings'][$field] = $value;
1343 1343
 					}
1344 1344
 				}
1345 1345
 
1346 1346
 				//now let's save the settings for this messenger! Must do now because the validator checks the db for active messengers to validate.
1347
-				EEH_MSG_Template::update_active_messengers_in_db( $active_messengers );
1347
+				EEH_MSG_Template::update_active_messengers_in_db($active_messengers);
1348 1348
 
1349 1349
 				//let's generate all the templates but only if the messenger has default_mts (otherwise its just activated).
1350
-				if ( !empty( $default_mts ) ) {
1351
-					$success = EEH_MSG_Template::generate_new_templates( $messenger, $default_mts, '', TRUE );
1350
+				if ( ! empty($default_mts)) {
1351
+					$success = EEH_MSG_Template::generate_new_templates($messenger, $default_mts, '', TRUE);
1352 1352
 				}
1353 1353
 			}
1354 1354
 		} //end check for empty( $def_ms )
1355 1355
 
1356 1356
 		//still need to see if there are any message types to activate for active messengers
1357
-		foreach ( $active_messengers as $messenger => $settings ) {
1357
+		foreach ($active_messengers as $messenger => $settings) {
1358 1358
 			$msg_obj = $settings['obj'];
1359
-			if ( ! $msg_obj instanceof EE_messenger ) {
1359
+			if ( ! $msg_obj instanceof EE_messenger) {
1360 1360
 				continue;
1361 1361
 			}
1362 1362
 
@@ -1364,45 +1364,45 @@  discard block
 block discarded – undo
1364 1364
 			$new_default_mts = array();
1365 1365
 
1366 1366
 			//loop through each default mt reported by the messenger and make sure its set in its active db entry.
1367
-			foreach( $all_default_mts as $index => $mt ) {
1367
+			foreach ($all_default_mts as $index => $mt) {
1368 1368
 				//already active? already has generated templates? || has already been activated before (we dont' want to reactivate things users intentionally deactivated).
1369
-				if ( ( isset( $has_activated[$messenger] ) && in_array($mt, $has_activated[$messenger]) ) || isset( $active_messengers[$messenger]['settings'][$messenger . '-message_types'][$mt] ) ||  EEH_MSG_Template::already_generated( $messenger, $mt, 0, FALSE ) ) {
1369
+				if ((isset($has_activated[$messenger]) && in_array($mt, $has_activated[$messenger])) || isset($active_messengers[$messenger]['settings'][$messenger.'-message_types'][$mt]) || EEH_MSG_Template::already_generated($messenger, $mt, 0, FALSE)) {
1370 1370
 					continue;
1371 1371
 				}
1372 1372
 
1373 1373
 				//is there an installed_mt matching the default string?  If not then nothing to do here.
1374
-				if ( ! isset( $installed_mts[$mt] ) ) {
1375
-					unset( $all_default_mts[$mt] );
1374
+				if ( ! isset($installed_mts[$mt])) {
1375
+					unset($all_default_mts[$mt]);
1376 1376
 					continue;
1377 1377
 				}
1378 1378
 
1379 1379
 				$settings_fields = $installed_mts[$mt]->get_admin_settings_fields();
1380 1380
 				$settings = array();
1381
-				if ( is_array( $settings_fields ) ) {
1382
-					foreach ( $settings_fields as $field => $values ) {
1383
-						if ( isset( $values['default'] ) ) {
1381
+				if (is_array($settings_fields)) {
1382
+					foreach ($settings_fields as $field => $values) {
1383
+						if (isset($values['default'])) {
1384 1384
 							$settings[$field] = $values['default'];
1385 1385
 						}
1386 1386
 					}
1387 1387
 				}
1388 1388
 
1389
-				$active_messengers[$messenger]['settings'][$messenger . '-message_types'][$mt]['settings'] = $settings;
1389
+				$active_messengers[$messenger]['settings'][$messenger.'-message_types'][$mt]['settings'] = $settings;
1390 1390
 				$new_default_mts[] = $mt;
1391 1391
 				$has_activated[$messenger][] = $mt;
1392 1392
 			}
1393 1393
 
1394 1394
 
1395
-			if ( ! empty( $new_default_mts ) ) {
1396
-				$success = EEH_MSG_Template::generate_new_templates( $messenger, $new_default_mts, '', TRUE );
1395
+			if ( ! empty($new_default_mts)) {
1396
+				$success = EEH_MSG_Template::generate_new_templates($messenger, $new_default_mts, '', TRUE);
1397 1397
 			}
1398 1398
 
1399 1399
 		}
1400 1400
 
1401 1401
 		//now let's save the settings for this messenger!
1402
-		EEH_MSG_Template::update_active_messengers_in_db( $active_messengers );
1402
+		EEH_MSG_Template::update_active_messengers_in_db($active_messengers);
1403 1403
 
1404 1404
 		//update $has_activated record
1405
-		update_option( 'ee_has_activated_messenger', $has_activated );
1405
+		update_option('ee_has_activated_messenger', $has_activated);
1406 1406
 
1407 1407
 		//that's it!
1408 1408
 		return $success;
@@ -1422,47 +1422,47 @@  discard block
 block discarded – undo
1422 1422
 	 */
1423 1423
 	public static function validate_messages_system() {
1424 1424
 		//include our helper
1425
-		EE_Registry::instance()->load_helper( 'MSG_Template' );
1425
+		EE_Registry::instance()->load_helper('MSG_Template');
1426 1426
 
1427 1427
 		//get active and installed  messengers/message types.
1428 1428
 		$active_messengers = EEH_MSG_Template::get_active_messengers_in_db();
1429 1429
 		$installed = EEH_MSG_Template::get_installed_message_objects();
1430 1430
 		$installed_messengers = $installed_mts = array();
1431 1431
 		//set up the arrays so they can be handled easier.
1432
-		foreach( $installed['messengers'] as $im ) {
1433
-			if ( $im instanceof EE_messenger ) {
1432
+		foreach ($installed['messengers'] as $im) {
1433
+			if ($im instanceof EE_messenger) {
1434 1434
 				$installed_messengers[$im->name] = $im;
1435 1435
 			}
1436 1436
 		}
1437
-		foreach( $installed['message_types'] as $imt ) {
1438
-			if ( $imt instanceof EE_message_type ) {
1437
+		foreach ($installed['message_types'] as $imt) {
1438
+			if ($imt instanceof EE_message_type) {
1439 1439
 				$installed_mts[$imt->name] = $imt;
1440 1440
 			}
1441 1441
 		}
1442 1442
 
1443 1443
 		//now let's loop through the active array and validate
1444
-		foreach( $active_messengers as $messenger => $active_details ) {
1444
+		foreach ($active_messengers as $messenger => $active_details) {
1445 1445
 			//first let's see if this messenger is installed.
1446
-			if ( ! isset( $installed_messengers[$messenger] ) ) {
1446
+			if ( ! isset($installed_messengers[$messenger])) {
1447 1447
 				//not set so let's just remove from actives and make sure templates are inactive.
1448
-				unset( $active_messengers[$messenger] );
1449
-				EEH_MSG_Template::update_to_inactive( $messenger );
1448
+				unset($active_messengers[$messenger]);
1449
+				EEH_MSG_Template::update_to_inactive($messenger);
1450 1450
 				continue;
1451 1451
 			}
1452 1452
 
1453 1453
 			//messenger is active, so let's just make sure that any active message types not installed are deactivated.
1454
-			$mts = ! empty( $active_details['settings'][$messenger . '-message_types'] ) ? $active_details['settings'][$messenger . '-message_types'] : array();
1455
-			foreach ( $mts as $mt_name => $mt ) {
1456
-				if ( ! isset( $installed_mts[$mt_name] )  ) {
1457
-					unset( $active_messengers[$messenger]['settings'][$messenger . '-message_types'][$mt_name] );
1458
-					EEH_MSG_Template::update_to_inactive( $messenger, $mt_name );
1454
+			$mts = ! empty($active_details['settings'][$messenger.'-message_types']) ? $active_details['settings'][$messenger.'-message_types'] : array();
1455
+			foreach ($mts as $mt_name => $mt) {
1456
+				if ( ! isset($installed_mts[$mt_name])) {
1457
+					unset($active_messengers[$messenger]['settings'][$messenger.'-message_types'][$mt_name]);
1458
+					EEH_MSG_Template::update_to_inactive($messenger, $mt_name);
1459 1459
 				}
1460 1460
 			}
1461 1461
 		}
1462 1462
 
1463 1463
 		//all done! let's update the active_messengers.
1464
-		EEH_MSG_Template::update_active_messengers_in_db( $active_messengers );
1465
-		do_action( 'AHEE__EEH_Activation__validate_messages_system' );
1464
+		EEH_MSG_Template::update_active_messengers_in_db($active_messengers);
1465
+		do_action('AHEE__EEH_Activation__validate_messages_system');
1466 1466
 		return;
1467 1467
 	}
1468 1468
 
@@ -1476,12 +1476,12 @@  discard block
 block discarded – undo
1476 1476
 	 * 	@static
1477 1477
 	 * 	@return void
1478 1478
 	 */
1479
-	public static function create_no_ticket_prices_array(){
1479
+	public static function create_no_ticket_prices_array() {
1480 1480
 		// this creates an array for tracking events that have no active ticket prices created
1481 1481
 		// this allows us to warn admins of the situation so that it can be corrected
1482
-		$espresso_no_ticket_prices = get_option( 'ee_no_ticket_prices', FALSE );
1483
-		if ( ! $espresso_no_ticket_prices ) {
1484
-			add_option( 'ee_no_ticket_prices', array(), '', FALSE );
1482
+		$espresso_no_ticket_prices = get_option('ee_no_ticket_prices', FALSE);
1483
+		if ( ! $espresso_no_ticket_prices) {
1484
+			add_option('ee_no_ticket_prices', array(), '', FALSE);
1485 1485
 		}
1486 1486
 	}
1487 1487
 
@@ -1503,24 +1503,24 @@  discard block
 block discarded – undo
1503 1503
 	 * Finds all our EE4 custom post types, and deletes them and their associated data (like post meta or term relations)/
1504 1504
 	 * @global wpdb $wpdb
1505 1505
 	 */
1506
-	public static function delete_all_espresso_cpt_data(){
1506
+	public static function delete_all_espresso_cpt_data() {
1507 1507
 		global $wpdb;
1508 1508
 		//get all the CPT post_types
1509 1509
 		$ee_post_types = array();
1510
-		foreach(EE_Registry::instance()->non_abstract_db_models as $model_name){
1511
-			if ( method_exists( $model_name, 'instance' )) {
1512
-				$model_obj = call_user_func( array( $model_name, 'instance' ));
1513
-				if ( $model_obj instanceof EEM_CPT_Base ) {
1514
-					$ee_post_types[] = $wpdb->prepare("%s",$model_obj->post_type());
1510
+		foreach (EE_Registry::instance()->non_abstract_db_models as $model_name) {
1511
+			if (method_exists($model_name, 'instance')) {
1512
+				$model_obj = call_user_func(array($model_name, 'instance'));
1513
+				if ($model_obj instanceof EEM_CPT_Base) {
1514
+					$ee_post_types[] = $wpdb->prepare("%s", $model_obj->post_type());
1515 1515
 				}
1516 1516
 			}
1517 1517
 		}
1518 1518
 		//get all our CPTs
1519
-		$query = "SELECT ID FROM {$wpdb->posts} WHERE post_type IN (".implode(",",$ee_post_types).")";
1519
+		$query = "SELECT ID FROM {$wpdb->posts} WHERE post_type IN (".implode(",", $ee_post_types).")";
1520 1520
 		$cpt_ids = $wpdb->get_col($query);
1521 1521
 		//delete each post meta and term relations too
1522
-		foreach($cpt_ids as $post_id){
1523
-			wp_delete_post($post_id,true);
1522
+		foreach ($cpt_ids as $post_id) {
1523
+			wp_delete_post($post_id, true);
1524 1524
 		}
1525 1525
 	}
1526 1526
 
@@ -1534,18 +1534,18 @@  discard block
 block discarded – undo
1534 1534
 	 * @param bool $remove_all
1535 1535
 	 * @return void
1536 1536
 	 */
1537
-	public static function delete_all_espresso_tables_and_data( $remove_all = true ) {
1537
+	public static function delete_all_espresso_tables_and_data($remove_all = true) {
1538 1538
 		global $wpdb;
1539 1539
 		$undeleted_tables = array();
1540 1540
 
1541 1541
 		// load registry
1542
-		foreach( EE_Registry::instance()->non_abstract_db_models as $model_name ){
1543
-			if ( method_exists( $model_name, 'instance' )) {
1544
-				$model_obj = call_user_func( array( $model_name, 'instance' ));
1545
-				if ( $model_obj instanceof EEM_Base ) {
1546
-					foreach ( $model_obj->get_tables() as $table ) {
1547
-						if ( strpos( $table->get_table_name(), 'esp_' )) {
1548
-							switch ( EEH_Activation::delete_unused_db_table( $table->get_table_name() )) {
1542
+		foreach (EE_Registry::instance()->non_abstract_db_models as $model_name) {
1543
+			if (method_exists($model_name, 'instance')) {
1544
+				$model_obj = call_user_func(array($model_name, 'instance'));
1545
+				if ($model_obj instanceof EEM_Base) {
1546
+					foreach ($model_obj->get_tables() as $table) {
1547
+						if (strpos($table->get_table_name(), 'esp_')) {
1548
+							switch (EEH_Activation::delete_unused_db_table($table->get_table_name())) {
1549 1549
 								case false :
1550 1550
 									$undeleted_tables[] = $table->get_table_name();
1551 1551
 								break;
@@ -1570,8 +1570,8 @@  discard block
 block discarded – undo
1570 1570
 			'esp_promotion_rule',
1571 1571
 			'esp_rule'
1572 1572
 		);
1573
-		foreach( $tables_without_models as $table ){
1574
-			EEH_Activation::delete_db_table_if_empty( $table );
1573
+		foreach ($tables_without_models as $table) {
1574
+			EEH_Activation::delete_db_table_if_empty($table);
1575 1575
 		}
1576 1576
 
1577 1577
 
@@ -1608,58 +1608,58 @@  discard block
 block discarded – undo
1608 1608
 			'ee_pers_admin_notices' => true,
1609 1609
 			'ee_upload_directories_incomplete' => true,
1610 1610
 		);
1611
-		if( is_main_site() ) {
1612
-			$wp_options_to_delete[ 'ee_network_config' ] = true;
1611
+		if (is_main_site()) {
1612
+			$wp_options_to_delete['ee_network_config'] = true;
1613 1613
 		}
1614 1614
 
1615 1615
 		$undeleted_options = array();
1616
-		foreach ( $wp_options_to_delete as $option_name => $no_wildcard ) {
1616
+		foreach ($wp_options_to_delete as $option_name => $no_wildcard) {
1617 1617
 
1618
-			if( $no_wildcard ){
1619
-				if( ! delete_option( $option_name ) ){
1618
+			if ($no_wildcard) {
1619
+				if ( ! delete_option($option_name)) {
1620 1620
 					$undeleted_options[] = $option_name;
1621 1621
 				}
1622
-			}else{
1623
-				$option_names_to_delete_from_wildcard = $wpdb->get_col( "SELECT option_name FROM $wpdb->options WHERE option_name LIKE '%$option_name%'" );
1624
-				foreach($option_names_to_delete_from_wildcard as $option_name_from_wildcard ){
1625
-					if( ! delete_option( $option_name_from_wildcard ) ){
1622
+			} else {
1623
+				$option_names_to_delete_from_wildcard = $wpdb->get_col("SELECT option_name FROM $wpdb->options WHERE option_name LIKE '%$option_name%'");
1624
+				foreach ($option_names_to_delete_from_wildcard as $option_name_from_wildcard) {
1625
+					if ( ! delete_option($option_name_from_wildcard)) {
1626 1626
 						$undeleted_options[] = $option_name_from_wildcard;
1627 1627
 					}
1628 1628
 				}
1629 1629
 			}
1630 1630
 		}
1631 1631
                 //also, let's make sure the "ee_config_option_names" wp option stays out by removing the action that adds it
1632
-                remove_action( 'shutdown', array( EE_Config::instance(), 'shutdown' ), 10 );
1632
+                remove_action('shutdown', array(EE_Config::instance(), 'shutdown'), 10);
1633 1633
 
1634
-		if ( $remove_all && $espresso_db_update = get_option( 'espresso_db_update' )) {
1634
+		if ($remove_all && $espresso_db_update = get_option('espresso_db_update')) {
1635 1635
 			$db_update_sans_ee4 = array();
1636
-			foreach($espresso_db_update as $version => $times_activated){
1637
-				if( $version[0] =='3'){//if its NON EE4
1636
+			foreach ($espresso_db_update as $version => $times_activated) {
1637
+				if ($version[0] == '3') {//if its NON EE4
1638 1638
 					$db_update_sans_ee4[$version] = $times_activated;
1639 1639
 				}
1640 1640
 			}
1641
-			update_option( 'espresso_db_update', $db_update_sans_ee4 );
1641
+			update_option('espresso_db_update', $db_update_sans_ee4);
1642 1642
 		}
1643 1643
 
1644 1644
 		$errors = '';
1645
-		if ( ! empty( $undeleted_tables )) {
1645
+		if ( ! empty($undeleted_tables)) {
1646 1646
 			$errors .= sprintf(
1647
-				__( 'The following tables could not be deleted: %s%s', 'event_espresso' ),
1647
+				__('The following tables could not be deleted: %s%s', 'event_espresso'),
1648 1648
 				'<br/>',
1649
-				implode( ',<br/>', $undeleted_tables )
1649
+				implode(',<br/>', $undeleted_tables)
1650 1650
 			);
1651 1651
 		}
1652
-		if ( ! empty( $undeleted_options )) {
1653
-			$errors .= ! empty( $undeleted_tables ) ? '<br/>' : '';
1652
+		if ( ! empty($undeleted_options)) {
1653
+			$errors .= ! empty($undeleted_tables) ? '<br/>' : '';
1654 1654
 			$errors .= sprintf(
1655
-				__( 'The following wp-options could not be deleted: %s%s', 'event_espresso' ),
1655
+				__('The following wp-options could not be deleted: %s%s', 'event_espresso'),
1656 1656
 				'<br/>',
1657
-				implode( ',<br/>', $undeleted_options )
1657
+				implode(',<br/>', $undeleted_options)
1658 1658
 			);
1659 1659
 
1660 1660
 		}
1661
-		if ( $errors != '' ) {
1662
-			EE_Error::add_attention( $errors, __FILE__, __FUNCTION__, __LINE__ );
1661
+		if ($errors != '') {
1662
+			EE_Error::add_attention($errors, __FILE__, __FUNCTION__, __LINE__);
1663 1663
 		}
1664 1664
 	}
1665 1665
 
@@ -1669,23 +1669,23 @@  discard block
 block discarded – undo
1669 1669
 	 * @param string $table_name with or without $wpdb->prefix
1670 1670
 	 * @return boolean
1671 1671
 	 */
1672
-	public static function table_exists( $table_name ){
1672
+	public static function table_exists($table_name) {
1673 1673
 		global $wpdb, $EZSQL_ERROR;
1674
-		$table_name = EEH_Activation::ensure_table_name_has_prefix( $table_name );
1674
+		$table_name = EEH_Activation::ensure_table_name_has_prefix($table_name);
1675 1675
 		//ignore if this causes an sql error
1676 1676
 		$old_error = $wpdb->last_error;
1677 1677
 		$old_suppress_errors = $wpdb->suppress_errors();
1678
-		$old_show_errors_value = $wpdb->show_errors( FALSE );
1678
+		$old_show_errors_value = $wpdb->show_errors(FALSE);
1679 1679
 		$ezsql_error_cache = $EZSQL_ERROR;
1680
-		$wpdb->get_results( "SELECT * from $table_name LIMIT 1");
1681
-		$wpdb->show_errors( $old_show_errors_value );
1682
-		$wpdb->suppress_errors( $old_suppress_errors );
1680
+		$wpdb->get_results("SELECT * from $table_name LIMIT 1");
1681
+		$wpdb->show_errors($old_show_errors_value);
1682
+		$wpdb->suppress_errors($old_suppress_errors);
1683 1683
 		$new_error = $wpdb->last_error;
1684 1684
 		$wpdb->last_error = $old_error;
1685 1685
 		$EZSQL_ERROR = $ezsql_error_cache;
1686
-		if( empty( $new_error ) ){
1686
+		if (empty($new_error)) {
1687 1687
 			return TRUE;
1688
-		}else{
1688
+		} else {
1689 1689
 			return FALSE;
1690 1690
 		}
1691 1691
 	}
@@ -1693,7 +1693,7 @@  discard block
 block discarded – undo
1693 1693
 	/**
1694 1694
 	 * Resets the cache on EEH_Activation
1695 1695
 	 */
1696
-	public static function reset(){
1696
+	public static function reset() {
1697 1697
 		self::$_default_creator_id = NULL;
1698 1698
 		self::$_initialized_db_content_already_in_this_request = false;
1699 1699
 	}
Please login to merge, or discard this patch.
admin_pages/events/Events_Admin_Page.core.php 1 patch
Spacing   +402 added lines, -402 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
 /**
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 			'espresso_events' => 'edit'
68 68
 			);
69 69
 
70
-		add_action('AHEE__EE_Admin_Page_CPT__set_model_object__after_set_object', array( $this, 'verify_event_edit' ) );
70
+		add_action('AHEE__EE_Admin_Page_CPT__set_model_object__after_set_object', array($this, 'verify_event_edit'));
71 71
 	}
72 72
 
73 73
 	protected function _ajax_hooks() {
@@ -93,20 +93,20 @@  discard block
 block discarded – undo
93 93
 				'edit' => __('Update Event', 'event_espresso'),
94 94
 				'add_category' => __('Save New Category', 'event_espresso'),
95 95
 				'edit_category' => __('Update Category', 'event_espresso'),
96
-				'template_settings' => __( 'Update Settings', 'event_espresso' )
96
+				'template_settings' => __('Update Settings', 'event_espresso')
97 97
 				)
98 98
 		);
99 99
 	}
100 100
 
101 101
 	protected function _set_page_routes() {
102 102
 		//load formatter helper
103
-		EE_Registry::instance()->load_helper( 'Formatter' );
103
+		EE_Registry::instance()->load_helper('Formatter');
104 104
 		//load field generator helper
105
-		EE_Registry::instance()->load_helper( 'Form_Fields' );
105
+		EE_Registry::instance()->load_helper('Form_Fields');
106 106
 
107 107
 		//is there a evt_id in the request?
108
-		$evt_id = ! empty( $this->_req_data['EVT_ID'] ) && ! is_array( $this->_req_data['EVT_ID'] ) ? $this->_req_data['EVT_ID'] : 0;
109
-		$evt_id = ! empty( $this->_req_data['post'] ) ? $this->_req_data['post'] : $evt_id;
108
+		$evt_id = ! empty($this->_req_data['EVT_ID']) && ! is_array($this->_req_data['EVT_ID']) ? $this->_req_data['EVT_ID'] : 0;
109
+		$evt_id = ! empty($this->_req_data['post']) ? $this->_req_data['post'] : $evt_id;
110 110
 
111 111
 
112 112
 		$this->_page_routes = array(
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
 				'help_tour' => array(
321 321
 					'Event_Editor_Help_Tour'
322 322
 					),
323
-				'qtips' => array( 'EE_Event_Editor_Decaf_Tips' ),
323
+				'qtips' => array('EE_Event_Editor_Decaf_Tips'),
324 324
 				'require_nonce' => FALSE
325 325
 			),
326 326
 			'edit' => array(
@@ -376,7 +376,7 @@  discard block
 block discarded – undo
376 376
 				'help_tour' => array(
377 377
 					'Event_Edit_Help_Tour'
378 378
 				),
379
-				'qtips' => array( 'EE_Event_Editor_Decaf_Tips' ),
379
+				'qtips' => array('EE_Event_Editor_Decaf_Tips'),
380 380
 				'require_nonce' => FALSE
381 381
 			),
382 382
 			'default_event_settings' => array(
@@ -398,7 +398,7 @@  discard block
 block discarded – undo
398 398
 						'filename' => 'events_default_settings_status'
399 399
 					)
400 400
 				),
401
-				'help_tour' => array( 'Event_Default_Settings_Help_Tour'),
401
+				'help_tour' => array('Event_Default_Settings_Help_Tour'),
402 402
 				'require_nonce' => FALSE
403 403
 			),
404 404
 			//template settings
@@ -414,7 +414,7 @@  discard block
 block discarded – undo
414 414
 						'filename' => 'general_settings_templates'
415 415
 					)
416 416
 				),
417
-				'help_tour' => array( 'Templates_Help_Tour' ),
417
+				'help_tour' => array('Templates_Help_Tour'),
418 418
 				'require_nonce' => FALSE
419 419
 			),
420 420
 			//event category stuff
@@ -438,7 +438,7 @@  discard block
 block discarded – undo
438 438
 					'label' => __('Edit Category', 'event_espresso'),
439 439
 					'order' => 15,
440 440
 					'persistent' => FALSE,
441
-					'url' => isset($this->_req_data['EVT_CAT_ID']) ? add_query_arg(array('EVT_CAT_ID' => $this->_req_data['EVT_CAT_ID'] ), $this->_current_page_view_url )  : $this->_admin_base_url
441
+					'url' => isset($this->_req_data['EVT_CAT_ID']) ? add_query_arg(array('EVT_CAT_ID' => $this->_req_data['EVT_CAT_ID']), $this->_current_page_view_url) : $this->_admin_base_url
442 442
 					),
443 443
 				'help_tabs' => array(
444 444
 					'edit_category_help_tab' => array(
@@ -508,14 +508,14 @@  discard block
 block discarded – undo
508 508
 
509 509
 	public function load_scripts_styles() {
510 510
 
511
-		wp_register_style('events-admin-css', EVENTS_ASSETS_URL . 'events-admin-page.css', array(), EVENT_ESPRESSO_VERSION);
512
-		wp_register_style('ee-cat-admin', EVENTS_ASSETS_URL . 'ee-cat-admin.css', array(), EVENT_ESPRESSO_VERSION );
511
+		wp_register_style('events-admin-css', EVENTS_ASSETS_URL.'events-admin-page.css', array(), EVENT_ESPRESSO_VERSION);
512
+		wp_register_style('ee-cat-admin', EVENTS_ASSETS_URL.'ee-cat-admin.css', array(), EVENT_ESPRESSO_VERSION);
513 513
 		wp_enqueue_style('events-admin-css');
514 514
 		wp_enqueue_style('ee-cat-admin');
515 515
 		//todo note: we also need to load_scripts_styles per view (i.e. default/view_report/event_details
516 516
 		//registers for all views
517 517
 		//scripts
518
-		wp_register_script('event_editor_js', EVENTS_ASSETS_URL . 'event_editor.js', array('ee_admin_js', 'jquery-ui-slider', 'jquery-ui-timepicker-addon'), EVENT_ESPRESSO_VERSION, TRUE);
518
+		wp_register_script('event_editor_js', EVENTS_ASSETS_URL.'event_editor.js', array('ee_admin_js', 'jquery-ui-slider', 'jquery-ui-timepicker-addon'), EVENT_ESPRESSO_VERSION, TRUE);
519 519
 	}
520 520
 
521 521
 	/**
@@ -533,11 +533,11 @@  discard block
 block discarded – undo
533 533
 	public function load_scripts_styles_edit() {
534 534
 		//styles
535 535
 		wp_enqueue_style('espresso-ui-theme');
536
-		wp_register_style('event-editor-css', EVENTS_ASSETS_URL . 'event-editor.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION );
536
+		wp_register_style('event-editor-css', EVENTS_ASSETS_URL.'event-editor.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION);
537 537
 		wp_enqueue_style('event-editor-css');
538 538
 
539 539
 		//scripts
540
-		wp_register_script('event-datetime-metabox', EVENTS_ASSETS_URL . 'event-datetime-metabox.js', array('event_editor_js', 'ee-datepicker'), EVENT_ESPRESSO_VERSION );
540
+		wp_register_script('event-datetime-metabox', EVENTS_ASSETS_URL.'event-datetime-metabox.js', array('event_editor_js', 'ee-datepicker'), EVENT_ESPRESSO_VERSION);
541 541
 		wp_enqueue_script('event-datetime-metabox');
542 542
 
543 543
 	}
@@ -572,7 +572,7 @@  discard block
 block discarded – undo
572 572
 
573 573
 
574 574
 	public function admin_init() {
575
-		EE_Registry::$i18n_js_strings[ 'image_confirm' ] = __( 'Do you really want to delete this image? Please remember to update your event to complete the removal.', 'event_espresso' );
575
+		EE_Registry::$i18n_js_strings['image_confirm'] = __('Do you really want to delete this image? Please remember to update your event to complete the removal.', 'event_espresso');
576 576
 	}
577 577
 
578 578
 
@@ -593,35 +593,35 @@  discard block
 block discarded – undo
593 593
 	 */
594 594
 	public function verify_event_edit($event = NULL) {
595 595
 		// no event?
596
-		if ( empty( $event )) {
596
+		if (empty($event)) {
597 597
 			// set event
598 598
 			$event = $this->_cpt_model_obj;
599 599
 		}
600 600
 		// STILL no event?
601
-		if ( empty ( $event )) {
601
+		if (empty ($event)) {
602 602
 			return;
603 603
 		}
604 604
 		// first check if event is active.
605
-		if ( $event->is_expired() || $event->is_inactive() || $event->status() == EEM_Event::cancelled || $event->status() == EEM_Event::postponed ) {
605
+		if ($event->is_expired() || $event->is_inactive() || $event->status() == EEM_Event::cancelled || $event->status() == EEM_Event::postponed) {
606 606
 			return;
607 607
 		}
608 608
 		$orig_status = $event->status();
609 609
 		//made it here so it IS active... next check that any of the tickets are sold.
610
-		if ( $event->is_sold_out() || $event->is_sold_out(TRUE ) ) {
611
-			if ( $event->status() !== $orig_status && $orig_status !== EEM_Event::sold_out  ) {
612
-				EE_Error::add_attention( sprintf(
613
-					__( 'Please note that the Event Status has automatically been changed to %s because there are no more spaces available for this event.  However, this change is not permanent until you update the event.  You can change the status back to something else before updating if you wish.', 'event_espresso' ),
614
-					EEH_Template::pretty_status( EEM_Event::sold_out, FALSE, 'sentence' )
610
+		if ($event->is_sold_out() || $event->is_sold_out(TRUE)) {
611
+			if ($event->status() !== $orig_status && $orig_status !== EEM_Event::sold_out) {
612
+				EE_Error::add_attention(sprintf(
613
+					__('Please note that the Event Status has automatically been changed to %s because there are no more spaces available for this event.  However, this change is not permanent until you update the event.  You can change the status back to something else before updating if you wish.', 'event_espresso'),
614
+					EEH_Template::pretty_status(EEM_Event::sold_out, FALSE, 'sentence')
615 615
 				));
616 616
 			}
617 617
 			return;
618 618
 		}
619 619
 		//now we need to determine if the event has any tickets on sale.  If not then we dont' show the error
620
-		if ( ! $event->tickets_on_sale() ) {
620
+		if ( ! $event->tickets_on_sale()) {
621 621
 			return;
622 622
 		}
623 623
 		//made it here so show warning
624
-		EE_Error::add_attention( $this->_edit_event_warning() );
624
+		EE_Error::add_attention($this->_edit_event_warning());
625 625
 	}
626 626
 
627 627
 
@@ -661,7 +661,7 @@  discard block
 block discarded – undo
661 661
 			),
662 662
 		);
663 663
 
664
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_events', 'espresso_events_trash_events' ) ) {
664
+		if (EE_Registry::instance()->CAP->current_user_can('ee_delete_events', 'espresso_events_trash_events')) {
665 665
 			$this->_views['trash'] = array(
666 666
 				'slug' => 'trash',
667 667
 				'label' => __('Trash', 'event_espresso'),
@@ -691,39 +691,39 @@  discard block
 block discarded – undo
691 691
 				'desc' => __('View Registrations for Event', 'event_espresso')
692 692
 			)
693 693
 		);
694
-		$items  = apply_filters( 'FHEE__Events_Admin_Page___event_legend_items__items', $items );
694
+		$items = apply_filters('FHEE__Events_Admin_Page___event_legend_items__items', $items);
695 695
 		$statuses = array(
696 696
 			'sold_out_status' => array(
697
-				'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::sold_out,
698
-				'desc' => EEH_Template::pretty_status( EE_Datetime::sold_out, FALSE, 'sentence' )
697
+				'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::sold_out,
698
+				'desc' => EEH_Template::pretty_status(EE_Datetime::sold_out, FALSE, 'sentence')
699 699
 			),
700 700
 			'active_status' => array(
701
-				'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::active,
702
-				'desc' => EEH_Template::pretty_status( EE_Datetime::active, FALSE, 'sentence' )
701
+				'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::active,
702
+				'desc' => EEH_Template::pretty_status(EE_Datetime::active, FALSE, 'sentence')
703 703
 			),
704 704
 			'upcoming_status' => array(
705
-				'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::upcoming,
706
-				'desc' => EEH_Template::pretty_status( EE_Datetime::upcoming, FALSE, 'sentence' )
705
+				'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::upcoming,
706
+				'desc' => EEH_Template::pretty_status(EE_Datetime::upcoming, FALSE, 'sentence')
707 707
 			),
708 708
 			'postponed_status' => array(
709
-				'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::postponed,
710
-				'desc' => EEH_Template::pretty_status( EE_Datetime::postponed, FALSE, 'sentence' )
709
+				'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::postponed,
710
+				'desc' => EEH_Template::pretty_status(EE_Datetime::postponed, FALSE, 'sentence')
711 711
 			),
712 712
 			'cancelled_status' => array(
713
-				'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::cancelled,
714
-				'desc' => EEH_Template::pretty_status( EE_Datetime::cancelled, FALSE, 'sentence' )
713
+				'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::cancelled,
714
+				'desc' => EEH_Template::pretty_status(EE_Datetime::cancelled, FALSE, 'sentence')
715 715
 			),
716 716
 			'expired_status' => array(
717
-				'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::expired,
718
-				'desc' => EEH_Template::pretty_status( EE_Datetime::expired, FALSE, 'sentence' )
717
+				'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::expired,
718
+				'desc' => EEH_Template::pretty_status(EE_Datetime::expired, FALSE, 'sentence')
719 719
 			),
720 720
 			'inactive_status' => array(
721
-				'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::inactive,
722
-				'desc' => EEH_Template::pretty_status( EE_Datetime::inactive, FALSE, 'sentence' )
721
+				'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::inactive,
722
+				'desc' => EEH_Template::pretty_status(EE_Datetime::inactive, FALSE, 'sentence')
723 723
 			)
724 724
 		);
725
-		$statuses = apply_filters( 'FHEE__Events_Admin_Page__event_legend_items__statuses', $statuses );
726
-		return array_merge( $items, $statuses );
725
+		$statuses = apply_filters('FHEE__Events_Admin_Page__event_legend_items__statuses', $statuses);
726
+		return array_merge($items, $statuses);
727 727
 	}
728 728
 
729 729
 
@@ -735,8 +735,8 @@  discard block
 block discarded – undo
735 735
 	 * @return EEM_Event
736 736
 	 */
737 737
 	private function _event_model() {
738
-		if ( ! $this->_event_model instanceof EEM_Event ) {
739
-			$this->_event_model = EE_Registry::instance()->load_model( 'Event' );
738
+		if ( ! $this->_event_model instanceof EEM_Event) {
739
+			$this->_event_model = EE_Registry::instance()->load_model('Event');
740 740
 		}
741 741
 		return $this->_event_model;
742 742
 	}
@@ -755,12 +755,12 @@  discard block
 block discarded – undo
755 755
 	 * @param  string $new_slug  what the slug is
756 756
 	 * @return string            The new html string for the permalink area
757 757
 	 */
758
-	public function extra_permalink_field_buttons( $return, $id, $new_title, $new_slug ) {
758
+	public function extra_permalink_field_buttons($return, $id, $new_title, $new_slug) {
759 759
 		//make sure this is only when editing
760
-		if ( !empty( $id ) ) {
761
-			$post = get_post( $id );
762
-			$return .= '<a class="button button-small" onclick="prompt(\'Shortcode:\', jQuery(\'#shortcode\').val()); return false;" href="#"  tabindex="-1">' . __('Shortcode', 'event_espresso') . '</a> ';
763
-			$return .= '<input id="shortcode" type="hidden" value="[ESPRESSO_TICKET_SELECTOR event_id=\'' . $post->ID . '\']"">';
760
+		if ( ! empty($id)) {
761
+			$post = get_post($id);
762
+			$return .= '<a class="button button-small" onclick="prompt(\'Shortcode:\', jQuery(\'#shortcode\').val()); return false;" href="#"  tabindex="-1">'.__('Shortcode', 'event_espresso').'</a> ';
763
+			$return .= '<input id="shortcode" type="hidden" value="[ESPRESSO_TICKET_SELECTOR event_id=\''.$post->ID.'\']"">';
764 764
 		}
765 765
 		return $return;
766 766
 	}
@@ -776,8 +776,8 @@  discard block
 block discarded – undo
776 776
 	 * @return string html for generated table
777 777
 	 */
778 778
 	protected function _events_overview_list_table() {
779
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
780
-		$this->_template_args['after_list_table'] = EEH_Template::get_button_or_link( get_post_type_archive_link('espresso_events'), __("View Event Archive Page", "event_espresso"), 'button' ) .
779
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
780
+		$this->_template_args['after_list_table'] = EEH_Template::get_button_or_link(get_post_type_archive_link('espresso_events'), __("View Event Archive Page", "event_espresso"), 'button').
781 781
 		$this->_display_legend($this->_event_legend_items());
782 782
 		$this->_admin_page_title .= $this->get_action_link_or_button('create_new', 'add', array(), 'add-new-h2');
783 783
 		$this->display_admin_list_table_page_with_no_sidebar();
@@ -795,51 +795,51 @@  discard block
 block discarded – undo
795 795
 
796 796
 
797 797
 
798
-	protected function _insert_update_cpt_item( $post_id, $post ) {
798
+	protected function _insert_update_cpt_item($post_id, $post) {
799 799
 
800
-		if ( $post instanceof WP_Post && $post->post_type !== 'espresso_events' ) {
800
+		if ($post instanceof WP_Post && $post->post_type !== 'espresso_events') {
801 801
 			//getout we're not processing an event save.
802 802
 			return;
803 803
 		}
804 804
 
805 805
 		$event_values = array(
806
-			'EVT_display_desc' => !empty( $this->_req_data['display_desc'] ) ? 1 : 0,
807
-			'EVT_display_ticket_selector' => !empty( $this->_req_data['display_ticket_selector'] ) ? 1 : 0,
806
+			'EVT_display_desc' => ! empty($this->_req_data['display_desc']) ? 1 : 0,
807
+			'EVT_display_ticket_selector' => ! empty($this->_req_data['display_ticket_selector']) ? 1 : 0,
808 808
 			'EVT_additional_limit' => min(
809
-					apply_filters( 'FHEE__EE_Events_Admin__insert_update_cpt_item__EVT_additional_limit_max', 255 ),
810
-					!empty( $this->_req_data['additional_limit'] ) ? $this->_req_data['additional_limit'] : NULL ),
811
-			'EVT_default_registration_status' => !empty( $this->_req_data['EVT_default_registration_status'] ) ? $this->_req_data['EVT_default_registration_status'] : EE_Registry::instance()->CFG->registration->default_STS_ID,
812
-			'EVT_member_only' => !empty( $this->_req_data['member_only'] ) ? 1 : 0,
813
-			'EVT_allow_overflow' => !empty( $this->_req_data['EVT_allow_overflow'] ) ? 1 : 0,
814
-			'EVT_timezone_string' => !empty( $this->_req_data['timezone_string'] ) ? $this->_req_data['timezone_string'] : NULL,
815
-			'EVT_external_URL' => !empty( $this->_req_data['externalURL'] ) ? $this->_req_data['externalURL'] : NULL,
816
-			'EVT_phone' => !empty( $this->_req_data['event_phone'] ) ? $this->_req_data['event_phone'] : NULL
809
+					apply_filters('FHEE__EE_Events_Admin__insert_update_cpt_item__EVT_additional_limit_max', 255),
810
+					! empty($this->_req_data['additional_limit']) ? $this->_req_data['additional_limit'] : NULL ),
811
+			'EVT_default_registration_status' => ! empty($this->_req_data['EVT_default_registration_status']) ? $this->_req_data['EVT_default_registration_status'] : EE_Registry::instance()->CFG->registration->default_STS_ID,
812
+			'EVT_member_only' => ! empty($this->_req_data['member_only']) ? 1 : 0,
813
+			'EVT_allow_overflow' => ! empty($this->_req_data['EVT_allow_overflow']) ? 1 : 0,
814
+			'EVT_timezone_string' => ! empty($this->_req_data['timezone_string']) ? $this->_req_data['timezone_string'] : NULL,
815
+			'EVT_external_URL' => ! empty($this->_req_data['externalURL']) ? $this->_req_data['externalURL'] : NULL,
816
+			'EVT_phone' => ! empty($this->_req_data['event_phone']) ? $this->_req_data['event_phone'] : NULL
817 817
 			);
818 818
 
819 819
 		//update event
820
-		$success = $this->_event_model()->update_by_ID( $event_values, $post_id );
820
+		$success = $this->_event_model()->update_by_ID($event_values, $post_id);
821 821
 
822 822
 
823 823
 		//get event_object for other metaboxes... though it would seem to make sense to just use $this->_event_model()->get_one_by_ID( $post_id ).. i have to setup where conditions to override the filters in the model that filter out autodraft and inherit statuses so we GET the inherit id!
824
-		$get_one_where = array( $this->_event_model()->primary_key_name() => $post_id, 'status' => $post->post_status );
825
-		$event = $this->_event_model()->get_one( array($get_one_where) );
824
+		$get_one_where = array($this->_event_model()->primary_key_name() => $post_id, 'status' => $post->post_status);
825
+		$event = $this->_event_model()->get_one(array($get_one_where));
826 826
 
827 827
 
828 828
 		//the following are default callbacks for event attachment updates that can be overridden by caffeinated functionality and/or addons.
829
-		$event_update_callbacks = apply_filters( 'FHEE__Events_Admin_Page___insert_update_cpt_item__event_update_callbacks', array( array($this, '_default_venue_update' ), array( $this, '_default_tickets_update') ) );
829
+		$event_update_callbacks = apply_filters('FHEE__Events_Admin_Page___insert_update_cpt_item__event_update_callbacks', array(array($this, '_default_venue_update'), array($this, '_default_tickets_update')));
830 830
 
831 831
 		$att_success = TRUE;
832 832
 
833
-		foreach ( $event_update_callbacks as $e_callback ) {
834
-			$_succ = call_user_func_array( $e_callback, array( $event,  $this->_req_data ) );
835
-			$att_success = !$att_success ? $att_success : $_succ; //if ANY of these updates fail then we want the appropriate global error message
833
+		foreach ($event_update_callbacks as $e_callback) {
834
+			$_succ = call_user_func_array($e_callback, array($event, $this->_req_data));
835
+			$att_success = ! $att_success ? $att_success : $_succ; //if ANY of these updates fail then we want the appropriate global error message
836 836
 		}
837 837
 
838 838
 		//any errors?
839
-		if ( $success && FALSE === $att_success ) {
840
-			EE_Error::add_error( __('Event Details saved successfully but something went wrong with saving attachments.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
841
-		} else if ( $success === FALSE ) {
842
-			EE_Error::add_error( __('Event Details did not save successfully.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
839
+		if ($success && FALSE === $att_success) {
840
+			EE_Error::add_error(__('Event Details saved successfully but something went wrong with saving attachments.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
841
+		} else if ($success === FALSE) {
842
+			EE_Error::add_error(__('Event Details did not save successfully.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
843 843
 		}
844 844
 	}
845 845
 
@@ -849,14 +849,14 @@  discard block
 block discarded – undo
849 849
 	/**
850 850
 	 * @see parent::restore_item()
851 851
 	 */
852
-	protected function _restore_cpt_item( $post_id, $revision_id ) {
852
+	protected function _restore_cpt_item($post_id, $revision_id) {
853 853
 		//copy existing event meta to new post
854 854
 		$post_evt = $this->_event_model()->get_one_by_ID($post_id);
855
-		if ( $post_evt instanceof EE_Event ) {
855
+		if ($post_evt instanceof EE_Event) {
856 856
 			//meta revision restore
857
-			$post_evt->restore_revision( $revision_id );
857
+			$post_evt->restore_revision($revision_id);
858 858
 			//related objs restore
859
-			$post_evt->restore_revision( $revision_id, array( 'Venue', 'Datetime', 'Price' ) );
859
+			$post_evt->restore_revision($revision_id, array('Venue', 'Datetime', 'Price'));
860 860
 		}
861 861
 	}
862 862
 
@@ -869,52 +869,52 @@  discard block
 block discarded – undo
869 869
 	 * @param  array  $data   The request data from the form
870 870
 	 * @return bool           Success or fail.
871 871
 	 */
872
-	protected function _default_venue_update( $evtobj, $data ) {
873
-		require_once( EE_MODELS . 'EEM_Venue.model.php' );
872
+	protected function _default_venue_update($evtobj, $data) {
873
+		require_once(EE_MODELS.'EEM_Venue.model.php');
874 874
 		$venue_model = EE_Registry::instance()->load_model('Venue');
875 875
 		$rows_affected = NULL;
876
-		$venue_id = !empty( $data['venue_id'] ) ? $data['venue_id'] : NULL;
876
+		$venue_id = ! empty($data['venue_id']) ? $data['venue_id'] : NULL;
877 877
 
878 878
 		// very important.  If we don't have a venue name...
879 879
 		// then we'll get out because not necessary to create empty venue
880
-		if ( empty( $data['venue_title'] ) ) {
880
+		if (empty($data['venue_title'])) {
881 881
 			return false;
882 882
 		}
883 883
 
884 884
 		$venue_array = array(
885 885
 				'VNU_wp_user' => $evtobj->get('EVT_wp_user'),
886
-				'VNU_name' => !empty( $data['venue_title'] ) ? $data['venue_title'] : NULL,
887
-				'VNU_desc' => !empty( $data['venue_description'] ) ? $data['venue_description'] : NULL,
888
-				'VNU_identifier' => !empty( $data['venue_identifier'] ) ? $data['venue_identifier'] : NULL,
889
-				'VNU_short_desc' => !empty( $data['venue_short_description'] ) ? $data['venue_short_description'] : NULL,
890
-				'VNU_address' => !empty( $data['address'] ) ? $data['address'] : NULL,
891
-				'VNU_address2' => !empty( $data['address2'] ) ? $data['address2'] : NULL,
892
-				'VNU_city' => !empty( $data['city'] ) ? $data['city'] : NULL,
893
-				'STA_ID' => !empty( $data['state'] ) ? $data['state'] : NULL,
894
-				'CNT_ISO' => !empty( $data['countries'] ) ? $data['countries'] : NULL,
895
-				'VNU_zip' => !empty( $data['zip'] ) ? $data['zip'] : NULL,
896
-				'VNU_phone' => !empty( $data['venue_phone'] ) ? $data['venue_phone'] : NULL,
897
-				'VNU_capacity' => !empty( $data['venue_capacity'] ) ? $data['venue_capacity'] : NULL,
898
-				'VNU_url' => !empty($data['venue_url'] ) ? $data['venue_url'] : NULL,
899
-				'VNU_virtual_phone' => !empty($data['virtual_phone']) ? $data['virtual_phone'] : NULL,
900
-				'VNU_virtual_url' => !empty( $data['virtual_url'] ) ? $data['virtual_url'] : NULL,
901
-				'VNU_enable_for_gmap' => isset( $data['enable_for_gmap'] ) ? 1 : 0,
886
+				'VNU_name' => ! empty($data['venue_title']) ? $data['venue_title'] : NULL,
887
+				'VNU_desc' => ! empty($data['venue_description']) ? $data['venue_description'] : NULL,
888
+				'VNU_identifier' => ! empty($data['venue_identifier']) ? $data['venue_identifier'] : NULL,
889
+				'VNU_short_desc' => ! empty($data['venue_short_description']) ? $data['venue_short_description'] : NULL,
890
+				'VNU_address' => ! empty($data['address']) ? $data['address'] : NULL,
891
+				'VNU_address2' => ! empty($data['address2']) ? $data['address2'] : NULL,
892
+				'VNU_city' => ! empty($data['city']) ? $data['city'] : NULL,
893
+				'STA_ID' => ! empty($data['state']) ? $data['state'] : NULL,
894
+				'CNT_ISO' => ! empty($data['countries']) ? $data['countries'] : NULL,
895
+				'VNU_zip' => ! empty($data['zip']) ? $data['zip'] : NULL,
896
+				'VNU_phone' => ! empty($data['venue_phone']) ? $data['venue_phone'] : NULL,
897
+				'VNU_capacity' => ! empty($data['venue_capacity']) ? $data['venue_capacity'] : NULL,
898
+				'VNU_url' => ! empty($data['venue_url']) ? $data['venue_url'] : NULL,
899
+				'VNU_virtual_phone' => ! empty($data['virtual_phone']) ? $data['virtual_phone'] : NULL,
900
+				'VNU_virtual_url' => ! empty($data['virtual_url']) ? $data['virtual_url'] : NULL,
901
+				'VNU_enable_for_gmap' => isset($data['enable_for_gmap']) ? 1 : 0,
902 902
 				'status' => 'publish'
903 903
 			);
904 904
 
905 905
 
906 906
 		//if we've got the venue_id then we're just updating the existing venue so let's do that and then get out.
907
-		if ( !empty( $venue_id ) ) {
908
-			$update_where = array( $venue_model->primary_key_name() => $venue_id );
909
-			$rows_affected = $venue_model->update( $venue_array, array( $update_where ) );
907
+		if ( ! empty($venue_id)) {
908
+			$update_where = array($venue_model->primary_key_name() => $venue_id);
909
+			$rows_affected = $venue_model->update($venue_array, array($update_where));
910 910
 			//we've gotta make sure that the venue is always attached to a revision.. add_relation_to should take care of making sure that the relation is already present.
911
-			$evtobj->_add_relation_to( $venue_id, 'Venue' );
911
+			$evtobj->_add_relation_to($venue_id, 'Venue');
912 912
 			return $rows_affected > 0 ? TRUE : FALSE;
913 913
 		} else {
914 914
 			//we insert the venue
915
-			$venue_id = $venue_model->insert( $venue_array );
916
-			$evtobj->_add_relation_to( $venue_id, 'Venue' );
917
-			return !empty( $venue_id ) ? TRUE : FALSE;
915
+			$venue_id = $venue_model->insert($venue_array);
916
+			$evtobj->_add_relation_to($venue_id, 'Venue');
917
+			return ! empty($venue_id) ? TRUE : FALSE;
918 918
 		}
919 919
 		//when we have the ancestor come in it's already been handled by the revision save.
920 920
 	}
@@ -928,55 +928,55 @@  discard block
 block discarded – undo
928 928
 	 * @param  array    $data   The request data from the form
929 929
 	 * @return bool             success or fail
930 930
 	 */
931
-	protected function _default_tickets_update( EE_Event $evtobj, $data ) {
931
+	protected function _default_tickets_update(EE_Event $evtobj, $data) {
932 932
 		$success = true;
933 933
 		$saved_dtt = null;
934 934
 		$saved_tickets = array();
935
-		$incoming_date_formats = array( 'Y-m-d', 'h:i a' );
935
+		$incoming_date_formats = array('Y-m-d', 'h:i a');
936 936
 
937
-		foreach ( $data['edit_event_datetimes'] as $row => $dtt ) {
937
+		foreach ($data['edit_event_datetimes'] as $row => $dtt) {
938 938
 			//trim all values to ensure any excess whitespace is removed.
939
-			$dtt =  array_map( 'trim', $dtt );
940
-			$dtt['DTT_EVT_end'] = isset($dtt['DTT_EVT_end']) && ! empty( $dtt['DTT_EVT_end'] ) ? $dtt['DTT_EVT_end'] : $dtt['DTT_EVT_start'];
939
+			$dtt = array_map('trim', $dtt);
940
+			$dtt['DTT_EVT_end'] = isset($dtt['DTT_EVT_end']) && ! empty($dtt['DTT_EVT_end']) ? $dtt['DTT_EVT_end'] : $dtt['DTT_EVT_start'];
941 941
 			$datetime_values = array(
942
-				'DTT_ID' 		=> ! empty( $dtt['DTT_ID'] ) ? $dtt['DTT_ID'] : NULL,
942
+				'DTT_ID' 		=> ! empty($dtt['DTT_ID']) ? $dtt['DTT_ID'] : NULL,
943 943
 				'DTT_EVT_start' => $dtt['DTT_EVT_start'],
944 944
 				'DTT_EVT_end' 	=> $dtt['DTT_EVT_end'],
945
-				'DTT_reg_limit' => empty( $dtt['DTT_reg_limit'] ) ? EE_INF : $dtt['DTT_reg_limit'],
945
+				'DTT_reg_limit' => empty($dtt['DTT_reg_limit']) ? EE_INF : $dtt['DTT_reg_limit'],
946 946
 				'DTT_order' 	=> $row,
947 947
 			);
948 948
 
949 949
 			//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.
950 950
 
951
-			if ( !empty( $dtt['DTT_ID'] ) ) {
952
-				$DTM = EE_Registry::instance()->load_model('Datetime', array( $evtobj->get_timezone() ) )->get_one_by_ID($dtt['DTT_ID'] );
953
-				$DTM->set_date_format( $incoming_date_formats[0] );
954
-				$DTM->set_time_format( $incoming_date_formats[1] );
955
-				foreach ( $datetime_values as $field => $value ) {
956
-					$DTM->set( $field, $value );
951
+			if ( ! empty($dtt['DTT_ID'])) {
952
+				$DTM = EE_Registry::instance()->load_model('Datetime', array($evtobj->get_timezone()))->get_one_by_ID($dtt['DTT_ID']);
953
+				$DTM->set_date_format($incoming_date_formats[0]);
954
+				$DTM->set_time_format($incoming_date_formats[1]);
955
+				foreach ($datetime_values as $field => $value) {
956
+					$DTM->set($field, $value);
957 957
 				}
958 958
 
959 959
 				//make sure the $dtt_id here is saved just in case after the add_relation_to() the autosave replaces it.  We need to do this so we dont' TRASH the parent DTT.
960 960
 				$saved_dtts[$DTM->ID()] = $DTM;
961 961
 			} else {
962
-				$DTM = EE_Registry::instance()->load_class('Datetime', array( $datetime_values ), FALSE, FALSE );
963
-				$DTM->set_date_format( $incoming_date_formats[0] );
964
-				$DTM->set_time_format( $incoming_date_formats[1] );
965
-				$DTM->set_timezone( $evtobj->get_timezone() );
966
-				foreach ( $datetime_values as $field => $value ) {
967
-					$DTM->set( $field, $value );
962
+				$DTM = EE_Registry::instance()->load_class('Datetime', array($datetime_values), FALSE, FALSE);
963
+				$DTM->set_date_format($incoming_date_formats[0]);
964
+				$DTM->set_time_format($incoming_date_formats[1]);
965
+				$DTM->set_timezone($evtobj->get_timezone());
966
+				foreach ($datetime_values as $field => $value) {
967
+					$DTM->set($field, $value);
968 968
 				}
969 969
 			}
970 970
 			$DTM->save();
971 971
 
972
-			$DTT = $evtobj->_add_relation_to( $DTM, 'Datetime' );
972
+			$DTT = $evtobj->_add_relation_to($DTM, 'Datetime');
973 973
 
974 974
 			//load DTT helper
975 975
 			EE_Registry::instance()->load_helper('DTT_Helper');
976 976
 
977 977
 			//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.
978
-			if( $DTT->get_raw('DTT_EVT_start') > $DTT->get_raw('DTT_EVT_end') ) {
979
-				$DTT->set('DTT_EVT_end', $DTT->get('DTT_EVT_start') );
978
+			if ($DTT->get_raw('DTT_EVT_start') > $DTT->get_raw('DTT_EVT_end')) {
979
+				$DTT->set('DTT_EVT_end', $DTT->get('DTT_EVT_start'));
980 980
 				$DTT = EEH_DTT_Helper::date_time_add($DTT, 'DTT_EVT_end', 'days');
981 981
 				$DTT->save();
982 982
 			}
@@ -984,45 +984,45 @@  discard block
 block discarded – undo
984 984
 			//now we got to make sure we add the new DTT_ID to the $saved_dtts array  because it is possible there was a new one created for the autosave.
985 985
 			$saved_dtt = $DTT;
986 986
 
987
-			$success = !$success ? $success : $DTT; //if ANY of these updates fail then we want the appropriate global error message. //todod this is actually sucky we need a better error message but this is what it is for now.
987
+			$success = ! $success ? $success : $DTT; //if ANY of these updates fail then we want the appropriate global error message. //todod this is actually sucky we need a better error message but this is what it is for now.
988 988
 		}
989 989
 
990 990
 		//no dtts get deleted so we don't do any of that logic here.
991 991
 		//update tickets next
992
-		$old_tickets = isset( $data['ticket_IDs'] ) ? explode(',', $data['ticket_IDs'] ) : array();
993
-		foreach ( $data['edit_tickets'] as $row => $tkt ) {
994
-			$incoming_date_formats = array( 'Y-m-d', 'h:i a' );
992
+		$old_tickets = isset($data['ticket_IDs']) ? explode(',', $data['ticket_IDs']) : array();
993
+		foreach ($data['edit_tickets'] as $row => $tkt) {
994
+			$incoming_date_formats = array('Y-m-d', 'h:i a');
995 995
 			$update_prices = false;
996
-			$ticket_price = isset( $data['edit_prices'][$row][1]['PRC_amount'] ) ? $data['edit_prices'][$row][1]['PRC_amount'] : 0;
996
+			$ticket_price = isset($data['edit_prices'][$row][1]['PRC_amount']) ? $data['edit_prices'][$row][1]['PRC_amount'] : 0;
997 997
 
998 998
 			// trim inputs to ensure any excess whitespace is removed.
999
-			$tkt = array_map( 'trim', $tkt );
999
+			$tkt = array_map('trim', $tkt);
1000 1000
 
1001
-			if ( empty( $tkt['TKT_start_date'] ) ) {
1001
+			if (empty($tkt['TKT_start_date'])) {
1002 1002
 				//let's use now in the set timezone.
1003
-				$now = new DateTime( 'now', new DateTimeZone( $evtobj->get_timezone() ) );
1004
-				$tkt['TKT_start_date'] = $now->format( $incoming_date_formats[0] . ' ' . $incoming_date_formats[1] );
1003
+				$now = new DateTime('now', new DateTimeZone($evtobj->get_timezone()));
1004
+				$tkt['TKT_start_date'] = $now->format($incoming_date_formats[0].' '.$incoming_date_formats[1]);
1005 1005
 			}
1006 1006
 
1007
-			if ( empty( $tkt['TKT_end_date'] ) ) {
1007
+			if (empty($tkt['TKT_end_date'])) {
1008 1008
 				//use the start date of the first datetime
1009 1009
 				$dtt = $evtobj->first_datetime();
1010
-				$tkt['TKT_end_date'] = $dtt->start_date_and_time( $incoming_date_formats[0], $incoming_date_formats[1] );
1010
+				$tkt['TKT_end_date'] = $dtt->start_date_and_time($incoming_date_formats[0], $incoming_date_formats[1]);
1011 1011
 			}
1012 1012
 
1013 1013
 			$TKT_values = array(
1014
-				'TKT_ID' 			=> !empty( $tkt['TKT_ID'] ) ? $tkt['TKT_ID'] : NULL,
1015
-				'TTM_ID' 			=> !empty( $tkt['TTM_ID'] ) ? $tkt['TTM_ID'] : 0,
1016
-				'TKT_name' 			=> !empty( $tkt['TKT_name'] ) ? $tkt['TKT_name'] : '',
1017
-				'TKT_description' 	=> !empty( $tkt['TKT_description'] ) ? $tkt['TKT_description'] : '',
1014
+				'TKT_ID' 			=> ! empty($tkt['TKT_ID']) ? $tkt['TKT_ID'] : NULL,
1015
+				'TTM_ID' 			=> ! empty($tkt['TTM_ID']) ? $tkt['TTM_ID'] : 0,
1016
+				'TKT_name' 			=> ! empty($tkt['TKT_name']) ? $tkt['TKT_name'] : '',
1017
+				'TKT_description' 	=> ! empty($tkt['TKT_description']) ? $tkt['TKT_description'] : '',
1018 1018
 				'TKT_start_date' 	=> $tkt['TKT_start_date'],
1019 1019
 				'TKT_end_date' 		=> $tkt['TKT_end_date'],
1020
-				'TKT_qty' 			=> ! isset( $tkt[ 'TKT_qty' ] ) || $tkt[ 'TKT_qty' ] === '' ? EE_INF : $tkt['TKT_qty'],
1021
-				'TKT_uses' 			=> ! isset( $tkt[ 'TKT_uses' ] ) || $tkt[ 'TKT_uses' ] === '' ? EE_INF : $tkt[ 'TKT_uses' ],
1022
-				'TKT_min' 			=> empty( $tkt['TKT_min'] ) ? 0 : $tkt['TKT_min'],
1023
-				'TKT_max' 			=> empty( $tkt['TKT_max'] ) ? EE_INF : $tkt['TKT_max'],
1020
+				'TKT_qty' 			=> ! isset($tkt['TKT_qty']) || $tkt['TKT_qty'] === '' ? EE_INF : $tkt['TKT_qty'],
1021
+				'TKT_uses' 			=> ! isset($tkt['TKT_uses']) || $tkt['TKT_uses'] === '' ? EE_INF : $tkt['TKT_uses'],
1022
+				'TKT_min' 			=> empty($tkt['TKT_min']) ? 0 : $tkt['TKT_min'],
1023
+				'TKT_max' 			=> empty($tkt['TKT_max']) ? EE_INF : $tkt['TKT_max'],
1024 1024
 				'TKT_row' 			=> $row,
1025
-				'TKT_order' 		=> isset( $tkt['TKT_order'] ) ? $tkt['TKT_order'] : $row,
1025
+				'TKT_order' 		=> isset($tkt['TKT_order']) ? $tkt['TKT_order'] : $row,
1026 1026
 				'TKT_price' 		=> $ticket_price
1027 1027
 			);
1028 1028
 
@@ -1030,7 +1030,7 @@  discard block
 block discarded – undo
1030 1030
 
1031 1031
 
1032 1032
 			//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.
1033
-			if ( isset( $tkt['TKT_is_default'] ) && $tkt['TKT_is_default'] ) {
1033
+			if (isset($tkt['TKT_is_default']) && $tkt['TKT_is_default']) {
1034 1034
 				$TKT_values['TKT_ID'] = 0;
1035 1035
 				$TKT_values['TKT_is_default'] = 0;
1036 1036
 				$TKT_values['TKT_price'] = $ticket_price;
@@ -1041,58 +1041,58 @@  discard block
 block discarded – undo
1041 1041
 			//we actually do our saves a head of doing any add_relations to because its entirely possible that this ticket didn't removed or added to any datetime in the session but DID have it's items modified.
1042 1042
 			//keep in mind that if the TKT has been sold (and we have changed pricing information), then we won't be updating the tkt but instead a new tkt will be created and the old one archived.
1043 1043
 
1044
-			if ( !empty( $tkt['TKT_ID'] ) ) {
1045
-				$TKT = EE_Registry::instance()->load_model( 'Ticket', array( $evtobj->get_timezone() ) )->get_one_by_ID( $tkt['TKT_ID'] );
1046
-				if ( $TKT instanceof EE_Ticket ) {
1047
-					$ticket_sold = $TKT->count_related( 'Registration', array( array( 'STS_ID' => array( 'NOT IN', array( EEM_Registration::status_id_incomplete ) ) ) ) ) > 0 ? true : false;
1044
+			if ( ! empty($tkt['TKT_ID'])) {
1045
+				$TKT = EE_Registry::instance()->load_model('Ticket', array($evtobj->get_timezone()))->get_one_by_ID($tkt['TKT_ID']);
1046
+				if ($TKT instanceof EE_Ticket) {
1047
+					$ticket_sold = $TKT->count_related('Registration', array(array('STS_ID' => array('NOT IN', array(EEM_Registration::status_id_incomplete))))) > 0 ? true : false;
1048 1048
 					//let's just check the total price for the existing ticket and determine if it matches the new total price.  if they are different then we create a new ticket (if tkts sold) if they aren't different then we go ahead and modify existing ticket.
1049
-					$create_new_TKT = $ticket_sold && $ticket_price != $TKT->get( 'TKT_price' ) && ! $TKT->get( 'TKT_deleted' ) ? true : false;
1050
-					$TKT->set_date_format( $incoming_date_formats[ 0 ] );
1051
-					$TKT->set_time_format( $incoming_date_formats[ 1 ] );
1049
+					$create_new_TKT = $ticket_sold && $ticket_price != $TKT->get('TKT_price') && ! $TKT->get('TKT_deleted') ? true : false;
1050
+					$TKT->set_date_format($incoming_date_formats[0]);
1051
+					$TKT->set_time_format($incoming_date_formats[1]);
1052 1052
 					//set new values
1053
-					foreach ( $TKT_values as $field => $value ) {
1054
-						if ( $field == 'TKT_qty' ) {
1055
-							$TKT->set_qty( $value );
1053
+					foreach ($TKT_values as $field => $value) {
1054
+						if ($field == 'TKT_qty') {
1055
+							$TKT->set_qty($value);
1056 1056
 						} else {
1057
-							$TKT->set( $field, $value );
1057
+							$TKT->set($field, $value);
1058 1058
 						}
1059 1059
 					}
1060 1060
 					//if $create_new_TKT is false then we can safely update the existing ticket.  Otherwise we have to create a new ticket.
1061
-					if ( $create_new_TKT ) {
1061
+					if ($create_new_TKT) {
1062 1062
 						//archive the old ticket first
1063
-						$TKT->set( 'TKT_deleted', 1 );
1063
+						$TKT->set('TKT_deleted', 1);
1064 1064
 						$TKT->save();
1065 1065
 						//make sure this ticket is still recorded in our saved_tkts so we don't run it through the regular trash routine.
1066
-						$saved_tickets[ $TKT->ID() ] = $TKT;
1066
+						$saved_tickets[$TKT->ID()] = $TKT;
1067 1067
 						//create new ticket that's a copy of the existing except a new id of course (and not archived) AND has the new TKT_price associated with it.
1068 1068
 						$TKT = clone $TKT;
1069
-						$TKT->set( 'TKT_ID', 0 );
1070
-						$TKT->set( 'TKT_deleted', 0 );
1071
-						$TKT->set( 'TKT_price', $ticket_price );
1072
-						$TKT->set( 'TKT_sold', 0 );
1069
+						$TKT->set('TKT_ID', 0);
1070
+						$TKT->set('TKT_deleted', 0);
1071
+						$TKT->set('TKT_price', $ticket_price);
1072
+						$TKT->set('TKT_sold', 0);
1073 1073
 						//now we need to make sure that $new prices are created as well and attached to new ticket.
1074 1074
 						$update_prices = true;
1075 1075
 					}
1076 1076
 					//make sure price is set if it hasn't been already
1077
-					$TKT->set( 'TKT_price', $ticket_price );
1077
+					$TKT->set('TKT_price', $ticket_price);
1078 1078
 				}
1079 1079
 
1080 1080
 			} else {
1081 1081
 				//no TKT_id so a new TKT
1082 1082
 				$TKT_values['TKT_price'] = $ticket_price;
1083
-				$TKT = EE_Registry::instance()->load_class('Ticket', array( $TKT_values ), FALSE, FALSE );
1084
-				if ( $TKT instanceof EE_Ticket ) {
1083
+				$TKT = EE_Registry::instance()->load_class('Ticket', array($TKT_values), FALSE, FALSE);
1084
+				if ($TKT instanceof EE_Ticket) {
1085 1085
 					//need to reset values to properly account for the date formats
1086
-					$TKT->set_date_format( $incoming_date_formats[0] );
1087
-					$TKT->set_time_format( $incoming_date_formats[1] );
1088
-					$TKT->set_timezone( $evtobj->get_timezone() );
1086
+					$TKT->set_date_format($incoming_date_formats[0]);
1087
+					$TKT->set_time_format($incoming_date_formats[1]);
1088
+					$TKT->set_timezone($evtobj->get_timezone());
1089 1089
 
1090 1090
 					//set new values
1091
-					foreach ( $TKT_values as $field => $value ) {
1092
-						if ( $field == 'TKT_qty' ) {
1093
-							$TKT->set_qty( $value );
1091
+					foreach ($TKT_values as $field => $value) {
1092
+						if ($field == 'TKT_qty') {
1093
+							$TKT->set_qty($value);
1094 1094
 						} else {
1095
-							$TKT->set( $field, $value );
1095
+							$TKT->set($field, $value);
1096 1096
 						}
1097 1097
 					}
1098 1098
 
@@ -1100,32 +1100,32 @@  discard block
 block discarded – undo
1100 1100
 				}
1101 1101
 			}
1102 1102
 			// cap ticket qty by datetime reg limits
1103
-			$TKT->set_qty( min( $TKT->qty(), $TKT->qty( 'reg_limit' ) ) );
1103
+			$TKT->set_qty(min($TKT->qty(), $TKT->qty('reg_limit')));
1104 1104
 			//update ticket.
1105 1105
 			$TKT->save();
1106 1106
 
1107 1107
 			//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.
1108
-			if( $TKT->get_raw('TKT_start_date') > $TKT->get_raw('TKT_end_date') ) {
1109
-				$TKT->set('TKT_end_date', $TKT->get('TKT_start_date') );
1108
+			if ($TKT->get_raw('TKT_start_date') > $TKT->get_raw('TKT_end_date')) {
1109
+				$TKT->set('TKT_end_date', $TKT->get('TKT_start_date'));
1110 1110
 				EE_Registry::instance()->load_helper('DTT_Helper');
1111 1111
 				$TKT = EEH_DTT_Helper::date_time_add($TKT, 'TKT_end_date', 'days');
1112 1112
 				$TKT->save();
1113 1113
 			}
1114 1114
 
1115 1115
 			//initially let's add the ticket to the dtt
1116
-			$saved_dtt->_add_relation_to( $TKT, 'Ticket' );
1116
+			$saved_dtt->_add_relation_to($TKT, 'Ticket');
1117 1117
 
1118 1118
 			$saved_tickets[$TKT->ID()] = $TKT;
1119 1119
 
1120 1120
 			//add prices to ticket
1121
-			$this->_add_prices_to_ticket( $data['edit_prices'][$row], $TKT, $update_prices );
1121
+			$this->_add_prices_to_ticket($data['edit_prices'][$row], $TKT, $update_prices);
1122 1122
 		}
1123 1123
 		//however now we need to handle permanently deleting tickets via the ui.  Keep in mind that the ui does not allow deleting/archiving tickets that have ticket sold.  However, it does allow for deleting tickets that have no tickets sold, in which case we want to get rid of permanently because there is no need to save in db.
1124
-		$old_tickets = isset( $old_tickets[0] ) && $old_tickets[0] == '' ? array() : $old_tickets;
1125
-		$tickets_removed = array_diff( $old_tickets, array_keys( $saved_tickets ) );
1124
+		$old_tickets = isset($old_tickets[0]) && $old_tickets[0] == '' ? array() : $old_tickets;
1125
+		$tickets_removed = array_diff($old_tickets, array_keys($saved_tickets));
1126 1126
 
1127
-		foreach ( $tickets_removed as $id ) {
1128
-			$id = absint( $id );
1127
+		foreach ($tickets_removed as $id) {
1128
+			$id = absint($id);
1129 1129
 
1130 1130
 			//get the ticket for this id
1131 1131
 			$tkt_to_remove = EE_Registry::instance()->load_model('Ticket')->get_one_by_ID($id);
@@ -1133,7 +1133,7 @@  discard block
 block discarded – undo
1133 1133
 			//need to get all the related datetimes on this ticket and remove from every single one of them (remember this process can ONLY kick off if there are NO tkts_sold)
1134 1134
 			$dtts = $tkt_to_remove->get_many_related('Datetime');
1135 1135
 
1136
-			foreach( $dtts as $dtt ) {
1136
+			foreach ($dtts as $dtt) {
1137 1137
 				$tkt_to_remove->_remove_relation_to($dtt, 'Datetime');
1138 1138
 			}
1139 1139
 
@@ -1144,7 +1144,7 @@  discard block
 block discarded – undo
1144 1144
 			//finally let's delete this ticket (which should not be blocked at this point b/c we've removed all our relationships)
1145 1145
 			$tkt_to_remove->delete_permanently();
1146 1146
 		}
1147
-		return array( $saved_dtt, $saved_tickets );
1147
+		return array($saved_dtt, $saved_tickets);
1148 1148
 	}
1149 1149
 
1150 1150
 
@@ -1159,31 +1159,31 @@  discard block
 block discarded – undo
1159 1159
 	 * @param bool 		$new_prices Whether attach existing incoming prices or create new ones.
1160 1160
 	 * @return  void
1161 1161
 	 */
1162
-	private function  _add_prices_to_ticket( $prices, EE_Ticket $ticket, $new_prices = FALSE ) {
1163
-		foreach ( $prices as $row => $prc ) {
1162
+	private function  _add_prices_to_ticket($prices, EE_Ticket $ticket, $new_prices = FALSE) {
1163
+		foreach ($prices as $row => $prc) {
1164 1164
 			$PRC_values = array(
1165
-				'PRC_ID' => !empty( $prc['PRC_ID'] ) ? $prc['PRC_ID'] : NULL,
1166
-				'PRT_ID' => !empty( $prc['PRT_ID'] ) ? $prc['PRT_ID'] : NULL,
1167
-				'PRC_amount' => !empty( $prc['PRC_amount'] ) ? $prc['PRC_amount'] : 0,
1168
-				'PRC_name' => !empty( $prc['PRC_name'] ) ? $prc['PRC_name'] : '',
1169
-				'PRC_desc' => !empty( $prc['PRC_desc'] ) ? $prc['PRC_desc'] : '',
1165
+				'PRC_ID' => ! empty($prc['PRC_ID']) ? $prc['PRC_ID'] : NULL,
1166
+				'PRT_ID' => ! empty($prc['PRT_ID']) ? $prc['PRT_ID'] : NULL,
1167
+				'PRC_amount' => ! empty($prc['PRC_amount']) ? $prc['PRC_amount'] : 0,
1168
+				'PRC_name' => ! empty($prc['PRC_name']) ? $prc['PRC_name'] : '',
1169
+				'PRC_desc' => ! empty($prc['PRC_desc']) ? $prc['PRC_desc'] : '',
1170 1170
 				'PRC_is_default' => 0, //make sure prices are NOT set as default from this context
1171 1171
 				'PRC_order' => $row
1172 1172
 			);
1173 1173
 
1174
-			if ( $new_prices || empty( $PRC_values['PRC_ID'] ) ) {
1174
+			if ($new_prices || empty($PRC_values['PRC_ID'])) {
1175 1175
 				$PRC_values['PRC_ID'] = 0;
1176
-				$PRC = EE_Registry::instance()->load_class('Price', array( $PRC_values ), FALSE, FALSE);
1176
+				$PRC = EE_Registry::instance()->load_class('Price', array($PRC_values), FALSE, FALSE);
1177 1177
 			} else {
1178
-				$PRC = EE_Registry::instance()->load_model( 'Price' )->get_one_by_ID( $prc['PRC_ID'] );
1178
+				$PRC = EE_Registry::instance()->load_model('Price')->get_one_by_ID($prc['PRC_ID']);
1179 1179
 				//update this price with new values
1180
-				foreach ( $PRC_values as $field => $newprc ) {
1181
-					$PRC->set( $field, $newprc );
1180
+				foreach ($PRC_values as $field => $newprc) {
1181
+					$PRC->set($field, $newprc);
1182 1182
 				}
1183 1183
 				$PRC->save();
1184 1184
 			}
1185 1185
 
1186
-			$ticket->_add_relation_to( $PRC, 'Price' );
1186
+			$ticket->_add_relation_to($PRC, 'Price');
1187 1187
 		}
1188 1188
 	}
1189 1189
 
@@ -1206,33 +1206,33 @@  discard block
 block discarded – undo
1206 1206
 
1207 1207
 		return; //TEMPORARILY EXITING CAUSE THIS IS A TODO
1208 1208
 
1209
-		$postid = isset( $this->_req_data['post_ID'] ) ? $this->_req_data['post_ID'] : NULL;
1209
+		$postid = isset($this->_req_data['post_ID']) ? $this->_req_data['post_ID'] : NULL;
1210 1210
 
1211 1211
 
1212 1212
 		//if no postid then get out cause we need it for stuff in here
1213
-		if ( empty( $postid ) ) return;
1213
+		if (empty($postid)) return;
1214 1214
 
1215 1215
 
1216 1216
 		//handle datetime saves
1217 1217
 		$items = array();
1218 1218
 
1219
-		$get_one_where = array( $this->_event_model()->primary_key_name() => $postid );
1220
-		$event = $this->_event_model()->get_one( array($get_one_where) );
1219
+		$get_one_where = array($this->_event_model()->primary_key_name() => $postid);
1220
+		$event = $this->_event_model()->get_one(array($get_one_where));
1221 1221
 
1222 1222
 		//now let's get the attached datetimes from the most recent autosave
1223 1223
 		$dtts = $event->get_many_related('Datetime');
1224 1224
 
1225 1225
 		$dtt_ids = array();
1226
-		foreach( $dtts as $dtt ) {
1226
+		foreach ($dtts as $dtt) {
1227 1227
 			$dtt_ids[] = $dtt->ID();
1228 1228
 			$order = $dtt->order();
1229 1229
 			$this->_template_args['data']['items']['ID-'.$order] = $dtt->ID();
1230 1230
 		}
1231
-		$this->_template_args['data']['items']['datetime_IDS'] = serialize( $dtt_ids );
1231
+		$this->_template_args['data']['items']['datetime_IDS'] = serialize($dtt_ids);
1232 1232
 
1233 1233
 		//handle DECAF venues
1234 1234
 		//we need to make sure that the venue_id gets updated in the form so that future autosaves will properly conntect that venue to the event.
1235
-		if ( $do_venue_autosaves = apply_filters( 'FHEE__Events_Admin_Page__ee_autosave_edit_do_decaf_venue_save', TRUE ) ) {
1235
+		if ($do_venue_autosaves = apply_filters('FHEE__Events_Admin_Page__ee_autosave_edit_do_decaf_venue_save', TRUE)) {
1236 1236
 			$venue = $event->get_first_related('Venue');
1237 1237
 			$this->_template_args['data']['items']['venue-id'] = $venue->ID();
1238 1238
 		}
@@ -1243,23 +1243,23 @@  discard block
 block discarded – undo
1243 1243
 
1244 1244
 		$ticket_ids = array();
1245 1245
 		$price_ids = array();
1246
-		foreach ( $tickets as $ticket ) {
1246
+		foreach ($tickets as $ticket) {
1247 1247
 			$ticket_ids[] = $price->ID();
1248 1248
 			$ticket_order = $price->get('TKT_order');
1249
-			$this->_template_args['data']['items']['edit-ticket-id-' . $ticket_order] = $ticket->ID();
1250
-			$this->_template_args['data']['items']['edit-ticket-event-id-' . $order] = $event->ID();
1249
+			$this->_template_args['data']['items']['edit-ticket-id-'.$ticket_order] = $ticket->ID();
1250
+			$this->_template_args['data']['items']['edit-ticket-event-id-'.$order] = $event->ID();
1251 1251
 
1252 1252
 			//now we have to make sure the prices are updated appropriately
1253 1253
 			$prices = $ticket->get_many_related('Prices');
1254 1254
 
1255
-			foreach ( $prices as $price ) {
1255
+			foreach ($prices as $price) {
1256 1256
 				$price_ids[] = $price->ID();
1257 1257
 				$price_order = $price->get('PRC_order');
1258
-				$this->_template_args['data']['items']['quick-edit-ticket-price-id-ticketrow-' . $ticket_order . '-' . $price_order] = $price->ID();
1259
-				$this->_template_args['data']['items']['edit-ticket-price-id-ticketrow-' . $ticket_row . '-' . $price_row] = $price->ID();
1260
-				$this->_template_args['data']['items']['edit-ticket-price-is-default-ticketrow-' . $ticket_row . '-' . $price_row] = $price->get('PRC_is_default');
1258
+				$this->_template_args['data']['items']['quick-edit-ticket-price-id-ticketrow-'.$ticket_order.'-'.$price_order] = $price->ID();
1259
+				$this->_template_args['data']['items']['edit-ticket-price-id-ticketrow-'.$ticket_row.'-'.$price_row] = $price->ID();
1260
+				$this->_template_args['data']['items']['edit-ticket-price-is-default-ticketrow-'.$ticket_row.'-'.$price_row] = $price->get('PRC_is_default');
1261 1261
 			}
1262
-			$this->_template_args['data']['items']['price-IDs-ticketrow-' . $ticket_row] = implode(',', $price_ids);
1262
+			$this->_template_args['data']['items']['price-IDs-ticketrow-'.$ticket_row] = implode(',', $price_ids);
1263 1263
 		}
1264 1264
 		$this->_template_args['data']['items']['ticket-IDs'] = implode(',', $ticket_ids);
1265 1265
 	}
@@ -1277,12 +1277,12 @@  discard block
 block discarded – undo
1277 1277
 	private function _generate_publish_box_extra_content() {
1278 1278
 
1279 1279
 		//load formatter helper
1280
-  		EE_Registry::instance()->load_helper( 'Formatter' );
1280
+  		EE_Registry::instance()->load_helper('Formatter');
1281 1281
 
1282 1282
   		//args for getting related registrations
1283
-  		$approved_query_args = array( array( 'REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_approved ) );
1284
-  		$not_approved_query_args = array( array( 'REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_not_approved ) );
1285
-  		$pending_payment_query_args = array( array( 'REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_pending_payment ) );
1283
+  		$approved_query_args = array(array('REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_approved));
1284
+  		$not_approved_query_args = array(array('REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_not_approved));
1285
+  		$pending_payment_query_args = array(array('REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_pending_payment));
1286 1286
 
1287 1287
 
1288 1288
 		// publish box
@@ -1311,9 +1311,9 @@  discard block
 block discarded – undo
1311 1311
 				),
1312 1312
 				REG_ADMIN_URL
1313 1313
 			),
1314
-			'approved_regs' => $this->_cpt_model_obj->count_related( 'Registration', $approved_query_args ),
1315
-			'not_approved_regs' => $this->_cpt_model_obj->count_related( 'Registration', $not_approved_query_args ),
1316
-			'pending_payment_regs' => $this->_cpt_model_obj->count_related( 'Registration', $pending_payment_query_args ),
1314
+			'approved_regs' => $this->_cpt_model_obj->count_related('Registration', $approved_query_args),
1315
+			'not_approved_regs' => $this->_cpt_model_obj->count_related('Registration', $not_approved_query_args),
1316
+			'pending_payment_regs' => $this->_cpt_model_obj->count_related('Registration', $pending_payment_query_args),
1317 1317
 			'misc_pub_section_class' => apply_filters(
1318 1318
 				'FHEE_Events_Admin_Page___generate_publish_box_extra_content__misc_pub_section_class',
1319 1319
 				'misc-pub-section'
@@ -1332,9 +1332,9 @@  discard block
 block discarded – undo
1332 1332
 			'AHEE__Events_Admin_Page___generate_publish_box_extra_content__event_editor_overview_add',
1333 1333
 			$this->_cpt_model_obj
1334 1334
 		);
1335
-		$publish_box_extra_args[ 'event_editor_overview_add' ] = ob_get_clean();
1335
+		$publish_box_extra_args['event_editor_overview_add'] = ob_get_clean();
1336 1336
 		// load template
1337
-		EEH_Template::display_template( EVENTS_TEMPLATE_PATH . 'event_publish_box_extras.template.php', $publish_box_extra_args );
1337
+		EEH_Template::display_template(EVENTS_TEMPLATE_PATH.'event_publish_box_extras.template.php', $publish_box_extra_args);
1338 1338
 	}
1339 1339
 
1340 1340
 
@@ -1366,16 +1366,16 @@  discard block
 block discarded – undo
1366 1366
 		$this->verify_cpt_object();
1367 1367
 		add_meta_box(
1368 1368
 			'espresso_event_editor_tickets',
1369
-			__( 'Event Datetime & Ticket', 'event_espresso' ),
1370
-			array( $this, 'ticket_metabox' ),
1369
+			__('Event Datetime & Ticket', 'event_espresso'),
1370
+			array($this, 'ticket_metabox'),
1371 1371
 			$this->page_slug,
1372 1372
 			'normal',
1373 1373
 			'high'
1374 1374
 		);
1375 1375
 		add_meta_box(
1376 1376
 			'espresso_event_editor_event_options',
1377
-			__( 'Event Registration Options', 'event_espresso' ),
1378
-			array( $this, 'registration_options_meta_box' ),
1377
+			__('Event Registration Options', 'event_espresso'),
1378
+			array($this, 'registration_options_meta_box'),
1379 1379
 			$this->page_slug,
1380 1380
 			'side',
1381 1381
 			'default'
@@ -1405,38 +1405,38 @@  discard block
 block discarded – undo
1405 1405
 			'disabled' => ''
1406 1406
 			);
1407 1407
 
1408
-		$event_id = is_object( $this->_cpt_model_obj ) ? $this->_cpt_model_obj->ID() : NULL;
1408
+		$event_id = is_object($this->_cpt_model_obj) ? $this->_cpt_model_obj->ID() : NULL;
1409 1409
 
1410
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
1410
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1411 1411
 
1412 1412
 		/**
1413 1413
 		 * 1. Start with retrieving Datetimes
1414 1414
 		 * 2. Fore each datetime get related tickets
1415 1415
 		 * 3. For each ticket get related prices
1416 1416
 		 */
1417
-		$times = EE_Registry::instance()->load_model('Datetime' )->get_all_event_dates( $event_id );
1418
-		EE_Registry::instance()->load_helper('DTT_Helper' );
1417
+		$times = EE_Registry::instance()->load_model('Datetime')->get_all_event_dates($event_id);
1418
+		EE_Registry::instance()->load_helper('DTT_Helper');
1419 1419
 		/** @type EE_Datetime $first_datetime */
1420
-		$first_datetime = array_slice( $times, 0, 1 );
1420
+		$first_datetime = array_slice($times, 0, 1);
1421 1421
 		//do we get related tickets?
1422
-		if ( $first_datetime[ 0 ]->get( 'DTT_ID' ) !== 0 ) {
1423
-			foreach ( $times as $time ) {
1424
-				if ( $time instanceof EE_Datetime ) {
1422
+		if ($first_datetime[0]->get('DTT_ID') !== 0) {
1423
+			foreach ($times as $time) {
1424
+				if ($time instanceof EE_Datetime) {
1425 1425
 					$existing_datetime_ids[] = $time->get('DTT_ID');
1426 1426
 					$template_args['time'] = $time;
1427 1427
 					$related_tickets = $time->tickets(
1428 1428
 						array(
1429
-							array( 'OR' => array( 'TKT_deleted' => 1, 'TKT_deleted*' => 0 ) ),
1429
+							array('OR' => array('TKT_deleted' => 1, 'TKT_deleted*' => 0)),
1430 1430
 							'default_where_conditions' => 'none'
1431 1431
 						)
1432 1432
 					);
1433 1433
 
1434
-					if ( !empty($related_tickets) ) {
1434
+					if ( ! empty($related_tickets)) {
1435 1435
 						$template_args['total_ticket_rows'] = count($related_tickets);
1436 1436
 						$row = 0;
1437
-						foreach ( $related_tickets as $ticket ) {
1437
+						foreach ($related_tickets as $ticket) {
1438 1438
 							$existing_ticket_ids[] = $ticket->get('TKT_ID');
1439
-							$template_args['ticket_rows'] .= $this->_get_ticket_row($ticket, FALSE, $row );
1439
+							$template_args['ticket_rows'] .= $this->_get_ticket_row($ticket, FALSE, $row);
1440 1440
 
1441 1441
 							$row++;
1442 1442
 						}
@@ -1444,7 +1444,7 @@  discard block
 block discarded – undo
1444 1444
 						$template_args['total_ticket_rows'] = 1;
1445 1445
 						/** @type EE_Ticket $ticket */
1446 1446
 						$ticket = EE_Registry::instance()->load_model('Ticket')->create_default_object();
1447
-						$template_args['ticket_rows'] .= $this->_get_ticket_row( $ticket );
1447
+						$template_args['ticket_rows'] .= $this->_get_ticket_row($ticket);
1448 1448
 					}
1449 1449
 				}
1450 1450
 			}
@@ -1452,7 +1452,7 @@  discard block
 block discarded – undo
1452 1452
 			$template_args['time'] = $times[0];
1453 1453
 			/** @type EE_Ticket $ticket */
1454 1454
 			$ticket = EE_Registry::instance()->load_model('Ticket')->get_all_default_tickets();
1455
-			$template_args['ticket_rows'] .= $this->_get_ticket_row( $ticket[1] );
1455
+			$template_args['ticket_rows'] .= $this->_get_ticket_row($ticket[1]);
1456 1456
 			// NOTE: we're just sending the first default row
1457 1457
 			// (decaf can't manage default tickets so this should be sufficient);
1458 1458
 		}
@@ -1461,8 +1461,8 @@  discard block
 block discarded – undo
1461 1461
 		$template_args['ticket_options_help_link'] = $this->_get_help_tab_link('ticket_options_info');
1462 1462
 		$template_args['existing_datetime_ids'] = implode(',', $existing_datetime_ids);
1463 1463
 		$template_args['existing_ticket_ids'] = implode(',', $existing_ticket_ids);
1464
-		$template_args['ticket_js_structure'] = $this->_get_ticket_row( EE_Registry::instance()->load_model('Ticket')->create_default_object(), TRUE );
1465
-		$template = apply_filters( 'FHEE__Events_Admin_Page__ticket_metabox__template', EVENTS_TEMPLATE_PATH . 'event_tickets_metabox_main.template.php' );
1464
+		$template_args['ticket_js_structure'] = $this->_get_ticket_row(EE_Registry::instance()->load_model('Ticket')->create_default_object(), TRUE);
1465
+		$template = apply_filters('FHEE__Events_Admin_Page__ticket_metabox__template', EVENTS_TEMPLATE_PATH.'event_tickets_metabox_main.template.php');
1466 1466
 		EEH_Template::display_template($template, $template_args);
1467 1467
 	}
1468 1468
 
@@ -1477,21 +1477,21 @@  discard block
 block discarded – undo
1477 1477
 	 * @param int        $row
1478 1478
 	 * @return string generated html for the ticket row.
1479 1479
 	 */
1480
-	private function _get_ticket_row( $ticket, $skeleton = FALSE, $row = 0 ) {
1480
+	private function _get_ticket_row($ticket, $skeleton = FALSE, $row = 0) {
1481 1481
 		$template_args = array(
1482
-			'tkt_status_class' => ' tkt-status-' . $ticket->ticket_status(),
1483
-			'tkt_archive_class' => $ticket->ticket_status() === EE_Ticket::archived && !$skeleton ? ' tkt-archived' : '',
1482
+			'tkt_status_class' => ' tkt-status-'.$ticket->ticket_status(),
1483
+			'tkt_archive_class' => $ticket->ticket_status() === EE_Ticket::archived && ! $skeleton ? ' tkt-archived' : '',
1484 1484
 			'ticketrow' => $skeleton ? 'TICKETNUM' : $row,
1485 1485
 			'TKT_ID' => $ticket->get('TKT_ID'),
1486 1486
 			'TKT_name' => $ticket->get('TKT_name'),
1487 1487
 			'TKT_start_date' => $skeleton ? '' : $ticket->get_date('TKT_start_date', 'Y-m-d h:i a'),
1488 1488
 			'TKT_end_date' => $skeleton ? '' : $ticket->get_date('TKT_end_date', 'Y-m-d h:i a'),
1489 1489
 			'TKT_is_default' => $ticket->get('TKT_is_default'),
1490
-			'TKT_qty' => $ticket->get_pretty('TKT_qty','input'),
1490
+			'TKT_qty' => $ticket->get_pretty('TKT_qty', 'input'),
1491 1491
 			'edit_ticketrow_name' => $skeleton ? 'TICKETNAMEATTR' : 'edit_tickets',
1492 1492
 			'TKT_sold' => $skeleton ? 0 : $ticket->get('TKT_sold'),
1493
-			'trash_icon' => ( $skeleton || ( !empty( $ticket ) && ! $ticket->get('TKT_deleted') ) ) && ( !empty( $ticket ) && $ticket->get('TKT_sold') === 0 ) ? 'trash-icon dashicons dashicons-post-trash clickable' : 'ee-lock-icon',
1494
-			'disabled' => $skeleton || ( !empty( $ticket ) && ! $ticket->get('TKT_deleted' ) ) ? '' : ' disabled=disabled'
1493
+			'trash_icon' => ($skeleton || ( ! empty($ticket) && ! $ticket->get('TKT_deleted'))) && ( ! empty($ticket) && $ticket->get('TKT_sold') === 0) ? 'trash-icon dashicons dashicons-post-trash clickable' : 'ee-lock-icon',
1494
+			'disabled' => $skeleton || ( ! empty($ticket) && ! $ticket->get('TKT_deleted')) ? '' : ' disabled=disabled'
1495 1495
 			);
1496 1496
 
1497 1497
 		$price = $ticket->ID() !== 0 ? $ticket->get_first_related('Price', array('default_where_conditions' => 'none')) : EE_Registry::instance()->load_model('Price')->create_default_object();
@@ -1507,23 +1507,23 @@  discard block
 block discarded – undo
1507 1507
 
1508 1508
 		//make sure we have default start and end dates if skeleton
1509 1509
 		//handle rows that should NOT be empty
1510
-		if ( empty( $template_args['TKT_start_date'] ) ) {
1510
+		if (empty($template_args['TKT_start_date'])) {
1511 1511
 			//if empty then the start date will be now.
1512 1512
 			$template_args['TKT_start_date'] = date('Y-m-d h:i a', current_time('timestamp'));
1513 1513
 		}
1514 1514
 
1515
-		if ( empty( $template_args['TKT_end_date'] ) ) {
1515
+		if (empty($template_args['TKT_end_date'])) {
1516 1516
 			//get the earliest datetime (if present);
1517
-			$earliest_dtt = $this->_cpt_model_obj->ID() > 0 ? $this->_cpt_model_obj->get_first_related('Datetime', array('order_by'=> array('DTT_EVT_start' => 'ASC' ) ) ) : NULL;
1517
+			$earliest_dtt = $this->_cpt_model_obj->ID() > 0 ? $this->_cpt_model_obj->get_first_related('Datetime', array('order_by'=> array('DTT_EVT_start' => 'ASC'))) : NULL;
1518 1518
 
1519
-			if ( !empty( $earliest_dtt ) )
1519
+			if ( ! empty($earliest_dtt))
1520 1520
 				$template_args['TKT_end_date'] = $earliest_dtt->get_datetime('DTT_EVT_start', 'Y-m-d', 'h:i a');
1521 1521
 			else
1522
-				$template_args['TKT_end_date'] = date('Y-m-d h:i a', mktime(0, 0, 0, date("m"), date("d")+7, date("Y") ) );
1522
+				$template_args['TKT_end_date'] = date('Y-m-d h:i a', mktime(0, 0, 0, date("m"), date("d") + 7, date("Y")));
1523 1523
 		}
1524 1524
 
1525
-		$template_args = array_merge( $template_args, $price_args );
1526
-		$template = apply_filters( 'FHEE__Events_Admin_Page__get_ticket_row__template', EVENTS_TEMPLATE_PATH . 'event_tickets_metabox_ticket_row.template.php', $ticket);
1525
+		$template_args = array_merge($template_args, $price_args);
1526
+		$template = apply_filters('FHEE__Events_Admin_Page__get_ticket_row__template', EVENTS_TEMPLATE_PATH.'event_tickets_metabox_ticket_row.template.php', $ticket);
1527 1527
 		return EEH_Template::display_template($template, $template_args, TRUE);
1528 1528
 	}
1529 1529
 
@@ -1552,8 +1552,8 @@  discard block
 block discarded – undo
1552 1552
 		$template_args['default_registration_status'] = EEH_Form_Fields::select_input('default_reg_status', $default_reg_status_values, $this->_cpt_model_obj->default_registration_status());
1553 1553
 		$template_args['display_description'] = EEH_Form_Fields::select_input('display_desc', $yes_no_values, $this->_cpt_model_obj->display_description());
1554 1554
 		$template_args['display_ticket_selector'] = EEH_Form_Fields::select_input('display_ticket_selector', $yes_no_values, $this->_cpt_model_obj->display_ticket_selector(), '', '', false);
1555
-		$template_args['additional_registration_options'] = apply_filters( 'FHEE__Events_Admin_Page__registration_options_meta_box__additional_registration_options', '', $template_args, $yes_no_values, $default_reg_status_values );
1556
-		$templatepath = EVENTS_TEMPLATE_PATH . 'event_registration_options.template.php';
1555
+		$template_args['additional_registration_options'] = apply_filters('FHEE__Events_Admin_Page__registration_options_meta_box__additional_registration_options', '', $template_args, $yes_no_values, $default_reg_status_values);
1556
+		$templatepath = EVENTS_TEMPLATE_PATH.'event_registration_options.template.php';
1557 1557
 		EEH_Template::display_template($templatepath, $template_args);
1558 1558
 	}
1559 1559
 
@@ -1581,21 +1581,21 @@  discard block
 block discarded – undo
1581 1581
 		$EEME = $this->_event_model();
1582 1582
 
1583 1583
 		$offset = ($current_page - 1) * $per_page;
1584
-		$limit = $count ? NULL : $offset . ',' . $per_page;
1584
+		$limit = $count ? NULL : $offset.','.$per_page;
1585 1585
 		$orderby = isset($this->_req_data['orderby']) ? $this->_req_data['orderby'] : 'EVT_ID';
1586 1586
 		$order = isset($this->_req_data['order']) ? $this->_req_data['order'] : "DESC";
1587 1587
 
1588 1588
 		if (isset($this->_req_data['month_range'])) {
1589 1589
 			$pieces = explode(' ', $this->_req_data['month_range'], 3);
1590
-			$month_r = !empty($pieces[0]) ? date('m', strtotime($pieces[0])) : '';
1591
-			$year_r = !empty($pieces[1]) ? $pieces[1] : '';
1590
+			$month_r = ! empty($pieces[0]) ? date('m', strtotime($pieces[0])) : '';
1591
+			$year_r = ! empty($pieces[1]) ? $pieces[1] : '';
1592 1592
 		}
1593 1593
 
1594 1594
 		$where = array();
1595 1595
 
1596
-		$status = isset( $this->_req_data['status'] ) ? $this->_req_data['status'] : NULL;
1596
+		$status = isset($this->_req_data['status']) ? $this->_req_data['status'] : NULL;
1597 1597
 		//determine what post_status our condition will have for the query.
1598
-		switch ( $status ) {
1598
+		switch ($status) {
1599 1599
 			case 'month' :
1600 1600
 			case 'today' :
1601 1601
 			case NULL :
@@ -1603,7 +1603,7 @@  discard block
 block discarded – undo
1603 1603
 				break;
1604 1604
 
1605 1605
 			case 'draft' :
1606
-				$where['status'] = array( 'IN', array('draft', 'auto-draft') );
1606
+				$where['status'] = array('IN', array('draft', 'auto-draft'));
1607 1607
 				break;
1608 1608
 
1609 1609
 			default :
@@ -1611,43 +1611,43 @@  discard block
 block discarded – undo
1611 1611
 		}
1612 1612
 
1613 1613
 		//categories?
1614
-		$category = isset( $this->_req_data['EVT_CAT'] ) && $this->_req_data['EVT_CAT'] > 0 ? $this->_req_data['EVT_CAT'] : NULL;
1614
+		$category = isset($this->_req_data['EVT_CAT']) && $this->_req_data['EVT_CAT'] > 0 ? $this->_req_data['EVT_CAT'] : NULL;
1615 1615
 
1616
-		if ( !empty ( $category ) ) {
1616
+		if ( ! empty ($category)) {
1617 1617
 			$where['Term_Taxonomy.taxonomy'] = 'espresso_event_categories';
1618 1618
 			$where['Term_Taxonomy.term_id'] = $category;
1619 1619
 		}
1620 1620
 
1621 1621
 		//date where conditions
1622
-		$start_formats = EEM_Datetime::instance()->get_formats_for( 'DTT_EVT_start' );
1622
+		$start_formats = EEM_Datetime::instance()->get_formats_for('DTT_EVT_start');
1623 1623
 		if (isset($this->_req_data['month_range']) && $this->_req_data['month_range'] != '') {
1624
-			$DateTime = new DateTime( $year_r . '-' . $month_r . '-01 00:00:00', new DateTimeZone( EEM_Datetime::instance()->get_timezone() ) );
1625
-			$start = $DateTime->format( implode( ' ', $start_formats  ) );
1626
-			$end = $DateTime->setDate( $year_r, $month_r, $DateTime->format('t') )->setTime(23,59,59)->format( implode( ' ', $start_formats ) );
1627
-			$where['Datetime.DTT_EVT_start'] = array('BETWEEN', array( $start, $end ) );
1624
+			$DateTime = new DateTime($year_r.'-'.$month_r.'-01 00:00:00', new DateTimeZone(EEM_Datetime::instance()->get_timezone()));
1625
+			$start = $DateTime->format(implode(' ', $start_formats));
1626
+			$end = $DateTime->setDate($year_r, $month_r, $DateTime->format('t'))->setTime(23, 59, 59)->format(implode(' ', $start_formats));
1627
+			$where['Datetime.DTT_EVT_start'] = array('BETWEEN', array($start, $end));
1628 1628
 		} else if (isset($this->_req_data['status']) && $this->_req_data['status'] == 'today') {
1629
-			$DateTime = new DateTime( 'now', new DateTimeZone( EEM_Event::instance()->get_timezone() ) );
1630
-			$start = $DateTime->setTime( 0,0,0 )->format( implode( ' ', $start_formats ) );
1631
-			$end = $DateTime->setTime( 23, 59, 59 )->format( implode( ' ', $start_formats ) );
1632
-			$where['Datetime.DTT_EVT_start'] = array( 'BETWEEN', array( $start, $end ) );
1633
-		} else if ( isset($this->_req_data['status']) && $this->_req_data['status'] == 'month' ) {
1634
-			$now = date( 'Y-m-01' );
1635
-			$DateTime = new DateTime( $now, new DateTimeZone( EEM_Event::instance()->get_timezone() ) );
1636
-			$start = $DateTime->setTime( 0, 0, 0 )->format( implode( ' ', $start_formats ) );
1637
-			$end = $DateTime->setDate( date('Y'), date('m'), $DateTime->format('t' ) )->setTime( 23, 59, 59 )->format( implode( ' ', $start_formats ) );
1638
-			$where['Datetime.DTT_EVT_start'] = array( 'BETWEEN', array( $start, $end ) );
1629
+			$DateTime = new DateTime('now', new DateTimeZone(EEM_Event::instance()->get_timezone()));
1630
+			$start = $DateTime->setTime(0, 0, 0)->format(implode(' ', $start_formats));
1631
+			$end = $DateTime->setTime(23, 59, 59)->format(implode(' ', $start_formats));
1632
+			$where['Datetime.DTT_EVT_start'] = array('BETWEEN', array($start, $end));
1633
+		} else if (isset($this->_req_data['status']) && $this->_req_data['status'] == 'month') {
1634
+			$now = date('Y-m-01');
1635
+			$DateTime = new DateTime($now, new DateTimeZone(EEM_Event::instance()->get_timezone()));
1636
+			$start = $DateTime->setTime(0, 0, 0)->format(implode(' ', $start_formats));
1637
+			$end = $DateTime->setDate(date('Y'), date('m'), $DateTime->format('t'))->setTime(23, 59, 59)->format(implode(' ', $start_formats));
1638
+			$where['Datetime.DTT_EVT_start'] = array('BETWEEN', array($start, $end));
1639 1639
 		}
1640 1640
 
1641 1641
 
1642
-		if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_events', 'get_events' ) ) {
1643
-			$where['EVT_wp_user'] =  get_current_user_id();
1642
+		if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_events', 'get_events')) {
1643
+			$where['EVT_wp_user'] = get_current_user_id();
1644 1644
 		} else {
1645
-			if ( ! isset( $where['status'] ) ) {
1646
-				if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_private_events', 'get_events' ) ) {
1645
+			if ( ! isset($where['status'])) {
1646
+				if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_private_events', 'get_events')) {
1647 1647
 					$where['OR'] = array(
1648
-						'status*restrict_private' => array( '!=', 'private' ),
1648
+						'status*restrict_private' => array('!=', 'private'),
1649 1649
 						'AND' => array(
1650
-							'status*inclusive' => array( '=', 'private' ),
1650
+							'status*inclusive' => array('=', 'private'),
1651 1651
 							'EVT_wp_user' => get_current_user_id()
1652 1652
 						)
1653 1653
 					);
@@ -1655,16 +1655,16 @@  discard block
 block discarded – undo
1655 1655
 			}
1656 1656
 		}
1657 1657
 
1658
-		if ( isset( $this->_req_data['EVT_wp_user'] ) ) {
1659
-			if ( $this->_req_data['EVT_wp_user'] != get_current_user_id() && EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_events', 'get_events' ) ) {
1658
+		if (isset($this->_req_data['EVT_wp_user'])) {
1659
+			if ($this->_req_data['EVT_wp_user'] != get_current_user_id() && EE_Registry::instance()->CAP->current_user_can('ee_read_others_events', 'get_events')) {
1660 1660
 				$where['EVT_wp_user'] = $this->_req_data['EVT_wp_user'];
1661 1661
 			}
1662 1662
 		}
1663 1663
 
1664 1664
 
1665 1665
 		//search query handling
1666
-		if ( isset( $this->_req_data['s'] ) ) {
1667
-			$search_string = '%' . $this->_req_data['s'] . '%';
1666
+		if (isset($this->_req_data['s'])) {
1667
+			$search_string = '%'.$this->_req_data['s'].'%';
1668 1668
 			$where['OR'] = array(
1669 1669
 				'EVT_name' => array('LIKE', $search_string),
1670 1670
 				'EVT_desc' => array('LIKE', $search_string),
@@ -1673,32 +1673,32 @@  discard block
 block discarded – undo
1673 1673
 		}
1674 1674
 
1675 1675
 
1676
-		$where = apply_filters( 'FHEE__Events_Admin_Page__get_events__where', $where, $this->_req_data );
1677
-		$query_params = apply_filters( 'FHEE__Events_Admin_Page__get_events__query_params', array($where, 'limit' => $limit, 'order_by' => $orderby, 'order' => $order, 'group_by' => 'EVT_ID' ), $this->_req_data );
1676
+		$where = apply_filters('FHEE__Events_Admin_Page__get_events__where', $where, $this->_req_data);
1677
+		$query_params = apply_filters('FHEE__Events_Admin_Page__get_events__query_params', array($where, 'limit' => $limit, 'order_by' => $orderby, 'order' => $order, 'group_by' => 'EVT_ID'), $this->_req_data);
1678 1678
 
1679 1679
 
1680 1680
 		//let's first check if we have special requests coming in.
1681
-		if ( isset( $this->_req_data['active_status'] ) ) {
1682
-			switch ( $this->_req_data['active_status'] ) {
1681
+		if (isset($this->_req_data['active_status'])) {
1682
+			switch ($this->_req_data['active_status']) {
1683 1683
 				case 'upcoming' :
1684
-					return $EEME->get_upcoming_events( $query_params, $count );
1684
+					return $EEME->get_upcoming_events($query_params, $count);
1685 1685
 					break;
1686 1686
 
1687 1687
 				case 'expired' :
1688
-					return $EEME->get_expired_events( $query_params, $count );
1688
+					return $EEME->get_expired_events($query_params, $count);
1689 1689
 					break;
1690 1690
 
1691 1691
 				case 'active' :
1692
-					return $EEME->get_active_events( $query_params, $count );
1692
+					return $EEME->get_active_events($query_params, $count);
1693 1693
 					break;
1694 1694
 
1695 1695
 				case 'inactive' :
1696
-					return $EEME->get_inactive_events( $query_params, $count );
1696
+					return $EEME->get_inactive_events($query_params, $count);
1697 1697
 					break;
1698 1698
 			}
1699 1699
 		}
1700 1700
 
1701
-		$events = $count ? $EEME->count( array( $where ), 'EVT_ID', true ) : $EEME->get_all( $query_params );
1701
+		$events = $count ? $EEME->count(array($where), 'EVT_ID', true) : $EEME->get_all($query_params);
1702 1702
 
1703 1703
 		return $events;
1704 1704
 	}
@@ -1707,23 +1707,23 @@  discard block
 block discarded – undo
1707 1707
 
1708 1708
 
1709 1709
 	//handling for WordPress CPT actions (trash, restore, delete)
1710
-	public function trash_cpt_item( $post_id ) {
1710
+	public function trash_cpt_item($post_id) {
1711 1711
 		$this->_req_data['EVT_ID'] = $post_id;
1712
-		$this->_trash_or_restore_event( 'trash', FALSE );
1712
+		$this->_trash_or_restore_event('trash', FALSE);
1713 1713
 	}
1714 1714
 
1715 1715
 
1716 1716
 
1717 1717
 
1718
-	public function restore_cpt_item( $post_id ) {
1718
+	public function restore_cpt_item($post_id) {
1719 1719
 		$this->_req_data['EVT_ID'] = $post_id;
1720
-		$this->_trash_or_restore_event( 'draft', FALSE );
1720
+		$this->_trash_or_restore_event('draft', FALSE);
1721 1721
 	}
1722 1722
 
1723 1723
 
1724
-	public function delete_cpt_item( $post_id ) {
1724
+	public function delete_cpt_item($post_id) {
1725 1725
 		$this->_req_data['EVT_ID'] = $post_id;
1726
-		$this->_delete_event( FALSE );
1726
+		$this->_delete_event(FALSE);
1727 1727
 	}
1728 1728
 
1729 1729
 
@@ -1735,7 +1735,7 @@  discard block
 block discarded – undo
1735 1735
 	 * @param  string $event_status
1736 1736
 	 * @return void
1737 1737
 	 */
1738
-	protected function _trash_or_restore_event($event_status = 'trash', $redirect_after = TRUE ) {
1738
+	protected function _trash_or_restore_event($event_status = 'trash', $redirect_after = TRUE) {
1739 1739
 		//determine the event id and set to array.
1740 1740
 		$EVT_ID = isset($this->_req_data['EVT_ID']) ? absint($this->_req_data['EVT_ID']) : FALSE;
1741 1741
 		// loop thru events
@@ -1743,7 +1743,7 @@  discard block
 block discarded – undo
1743 1743
 			// clean status
1744 1744
 			$event_status = sanitize_key($event_status);
1745 1745
 			// grab status
1746
-			if (!empty($event_status)) {
1746
+			if ( ! empty($event_status)) {
1747 1747
 				$success = $this->_change_event_status($EVT_ID, $event_status);
1748 1748
 			} else {
1749 1749
 				$success = FALSE;
@@ -1757,7 +1757,7 @@  discard block
 block discarded – undo
1757 1757
 		}
1758 1758
 		$action = $event_status == 'trash' ? 'moved to the trash' : 'restored from the trash';
1759 1759
 
1760
-		if ( $redirect_after )
1760
+		if ($redirect_after)
1761 1761
 			$this->_redirect_after_action($success, 'Event', $action, array('action' => 'default'));
1762 1762
 	}
1763 1763
 
@@ -1772,7 +1772,7 @@  discard block
 block discarded – undo
1772 1772
 		// clean status
1773 1773
 		$event_status = sanitize_key($event_status);
1774 1774
 		// grab status
1775
-		if (!empty($event_status)) {
1775
+		if ( ! empty($event_status)) {
1776 1776
 			$success = TRUE;
1777 1777
 			//determine the event id and set to array.
1778 1778
 			$EVT_IDs = isset($this->_req_data['EVT_IDs']) ? (array) $this->_req_data['EVT_IDs'] : array();
@@ -1807,15 +1807,15 @@  discard block
 block discarded – undo
1807 1807
 	 * @param  string $event_status
1808 1808
 	 * @return bool
1809 1809
 	 */
1810
-	private function _change_event_status( $EVT_ID = 0, $event_status = '') {
1810
+	private function _change_event_status($EVT_ID = 0, $event_status = '') {
1811 1811
 		// grab event id
1812
-		if (!$EVT_ID) {
1812
+		if ( ! $EVT_ID) {
1813 1813
 			$msg = __('An error occurred. No Event ID or an invalid Event ID was received.', 'event_espresso');
1814 1814
 			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1815 1815
 			return FALSE;
1816 1816
 		}
1817 1817
 
1818
-		$this->_cpt_model_obj = EEM_Event::instance()->get_one_by_ID( $EVT_ID );
1818
+		$this->_cpt_model_obj = EEM_Event::instance()->get_one_by_ID($EVT_ID);
1819 1819
 
1820 1820
 		// clean status
1821 1821
 		$event_status = sanitize_key($event_status);
@@ -1841,7 +1841,7 @@  discard block
 block discarded – undo
1841 1841
 				$hook = FALSE;
1842 1842
 		}
1843 1843
 		//use class to change status
1844
-		$this->_cpt_model_obj->set_status( $event_status );
1844
+		$this->_cpt_model_obj->set_status($event_status);
1845 1845
 		$success = $this->_cpt_model_obj->save();
1846 1846
 
1847 1847
 		if ($success === FALSE) {
@@ -1863,15 +1863,15 @@  discard block
 block discarded – undo
1863 1863
 	 * @access protected
1864 1864
 	 * @param bool $redirect_after
1865 1865
 	 */
1866
-	protected function _delete_event( $redirect_after = TRUE ) {
1866
+	protected function _delete_event($redirect_after = TRUE) {
1867 1867
 		//determine the event id and set to array.
1868 1868
 		$EVT_ID = isset($this->_req_data['EVT_ID']) ? absint($this->_req_data['EVT_ID']) : NULL;
1869
-		$EVT_ID = isset( $this->_req_data['post'] ) ? absint( $this->_req_data['post'] ) : $EVT_ID;
1869
+		$EVT_ID = isset($this->_req_data['post']) ? absint($this->_req_data['post']) : $EVT_ID;
1870 1870
 
1871 1871
 
1872 1872
 		// loop thru events
1873 1873
 		if ($EVT_ID) {
1874
-			$success = $this->_permanently_delete_event( $EVT_ID );
1874
+			$success = $this->_permanently_delete_event($EVT_ID);
1875 1875
 			// get list of events with no prices
1876 1876
 			$espresso_no_ticket_prices = get_option('ee_no_ticket_prices', array());
1877 1877
 			// remove this event from the list of events with no prices
@@ -1885,7 +1885,7 @@  discard block
 block discarded – undo
1885 1885
 			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1886 1886
 		}
1887 1887
 
1888
-		if ( $redirect_after )
1888
+		if ($redirect_after)
1889 1889
 			$this->_redirect_after_action($success, 'Event', 'deleted', array('action' => 'default', 'status' => 'trash'));
1890 1890
 	}
1891 1891
 
@@ -1903,12 +1903,12 @@  discard block
 block discarded – undo
1903 1903
 		$EVT_IDs = isset($this->_req_data['EVT_IDs']) ? (array) $this->_req_data['EVT_IDs'] : array();
1904 1904
 		// loop thru events
1905 1905
 		foreach ($EVT_IDs as $EVT_ID) {
1906
-			$EVT_ID = absint( $EVT_ID );
1907
-			if ( $EVT_ID ) {
1908
-				$results = $this->_permanently_delete_event( $EVT_ID );
1906
+			$EVT_ID = absint($EVT_ID);
1907
+			if ($EVT_ID) {
1908
+				$results = $this->_permanently_delete_event($EVT_ID);
1909 1909
 				$success = $results !== FALSE ? $success : FALSE;
1910 1910
 				// remove this event from the list of events with no prices
1911
-				unset( $espresso_no_ticket_prices[ $EVT_ID ] );
1911
+				unset($espresso_no_ticket_prices[$EVT_ID]);
1912 1912
 			} else {
1913 1913
 				$success = FALSE;
1914 1914
 				$msg = __('An error occurred. An event could not be deleted because a valid event ID was not not supplied.', 'event_espresso');
@@ -1928,21 +1928,21 @@  discard block
 block discarded – undo
1928 1928
 	 * @param  int $EVT_ID
1929 1929
 	 * @return bool
1930 1930
 	 */
1931
-	private function _permanently_delete_event( $EVT_ID = 0 ) {
1931
+	private function _permanently_delete_event($EVT_ID = 0) {
1932 1932
 		// grab event id
1933
-		if ( ! $EVT_ID ) {
1933
+		if ( ! $EVT_ID) {
1934 1934
 			$msg = __('An error occurred. No Event ID or an invalid Event ID was received.', 'event_espresso');
1935 1935
 			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1936 1936
 			return FALSE;
1937 1937
 		}
1938
-		$this->_cpt_model_obj = EEM_Event::instance()->get_one_by_ID( $EVT_ID );
1938
+		$this->_cpt_model_obj = EEM_Event::instance()->get_one_by_ID($EVT_ID);
1939 1939
 
1940 1940
 		//need to delete related tickets and prices first.
1941 1941
 		$datetimes = $this->_cpt_model_obj->get_many_related('Datetime');
1942
-		foreach ( $datetimes as $datetime ) {
1942
+		foreach ($datetimes as $datetime) {
1943 1943
 			$this->_cpt_model_obj->_remove_relation_to($datetime, 'Datetime');
1944 1944
 			$tickets = $datetime->get_many_related('Ticket');
1945
-			foreach ( $tickets as $ticket ) {
1945
+			foreach ($tickets as $ticket) {
1946 1946
 				$ticket->_remove_relation_to($datetime, 'Datetime');
1947 1947
 				$ticket->delete_related_permanently('Price');
1948 1948
 				$ticket->delete_permanently();
@@ -1952,14 +1952,14 @@  discard block
 block discarded – undo
1952 1952
 
1953 1953
 		//what about related venues or terms?
1954 1954
 		$venues = $this->_cpt_model_obj->get_many_related('Venue');
1955
-		foreach ( $venues as $venue ) {
1955
+		foreach ($venues as $venue) {
1956 1956
 			$this->_cpt_model_obj->_remove_relation_to($venue, 'Venue');
1957 1957
 		}
1958 1958
 
1959 1959
 		//any attached question groups?
1960 1960
 		$question_groups = $this->_cpt_model_obj->get_many_related('Question_Group');
1961
-		if ( !empty( $question_groups ) ) {
1962
-			foreach ( $question_groups as $question_group ) {
1961
+		if ( ! empty($question_groups)) {
1962
+			foreach ($question_groups as $question_group) {
1963 1963
 				$this->_cpt_model_obj->_remove_relation_to($question_group, 'Question_Group');
1964 1964
 			}
1965 1965
 		}
@@ -1968,12 +1968,12 @@  discard block
 block discarded – undo
1968 1968
 
1969 1969
 
1970 1970
 		//Message Template Groups
1971
-		$this->_cpt_model_obj->_remove_relations( 'Message_Template_Group' );
1971
+		$this->_cpt_model_obj->_remove_relations('Message_Template_Group');
1972 1972
 
1973 1973
 		/** @type EE_Term_Taxonomy[] $term_taxonomies */
1974 1974
 		$term_taxonomies = $this->_cpt_model_obj->term_taxonomies();
1975 1975
 
1976
-		foreach ( $term_taxonomies as $term_taxonomy ) {
1976
+		foreach ($term_taxonomies as $term_taxonomy) {
1977 1977
 			$this->_cpt_model_obj->remove_relation_to_term_taxonomy($term_taxonomy);
1978 1978
 		}
1979 1979
 
@@ -1987,7 +1987,7 @@  discard block
 block discarded – undo
1987 1987
 			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1988 1988
 			return FALSE;
1989 1989
 		}
1990
-		do_action( 'AHEE__Events_Admin_Page___permanently_delete_event__after_event_deleted' );
1990
+		do_action('AHEE__Events_Admin_Page___permanently_delete_event__after_event_deleted');
1991 1991
 		return TRUE;
1992 1992
 	}
1993 1993
 
@@ -2004,7 +2004,7 @@  discard block
 block discarded – undo
2004 2004
 	 */
2005 2005
 	public function total_events() {
2006 2006
 
2007
-		$count = EEM_Event::instance()->count( array( 'caps' => 'read_admin' ), 'EVT_ID', true );
2007
+		$count = EEM_Event::instance()->count(array('caps' => 'read_admin'), 'EVT_ID', true);
2008 2008
 		return $count;
2009 2009
 	}
2010 2010
 
@@ -2019,10 +2019,10 @@  discard block
 block discarded – undo
2019 2019
 	 */
2020 2020
 	public function total_events_draft() {
2021 2021
 		$where = array(
2022
-			'status' => array( 'IN', array('draft', 'auto-draft' ) )
2022
+			'status' => array('IN', array('draft', 'auto-draft'))
2023 2023
 			);
2024 2024
 
2025
-		$count = EEM_Event::instance()->count( array( $where, 'caps' => 'read_admin' ), 'EVT_ID', true );
2025
+		$count = EEM_Event::instance()->count(array($where, 'caps' => 'read_admin'), 'EVT_ID', true);
2026 2026
 		return $count;
2027 2027
 	}
2028 2028
 
@@ -2041,7 +2041,7 @@  discard block
 block discarded – undo
2041 2041
 			'status' => 'trash'
2042 2042
 			);
2043 2043
 
2044
-		$count = EEM_Event::instance()->count( array( $where, 'caps' => 'read_admin' ), 'EVT_ID', true );
2044
+		$count = EEM_Event::instance()->count(array($where, 'caps' => 'read_admin'), 'EVT_ID', true);
2045 2045
 		return $count;
2046 2046
 	}
2047 2047
 
@@ -2069,11 +2069,11 @@  discard block
 block discarded – undo
2069 2069
 			// translated
2070 2070
 			TRUE
2071 2071
 		);
2072
-		$this->_template_args['default_reg_status'] = isset( EE_Registry::instance()->CFG->registration->default_STS_ID ) ? sanitize_text_field( EE_Registry::instance()->CFG->registration->default_STS_ID ) : EEM_Registration::status_id_pending_payment;
2072
+		$this->_template_args['default_reg_status'] = isset(EE_Registry::instance()->CFG->registration->default_STS_ID) ? sanitize_text_field(EE_Registry::instance()->CFG->registration->default_STS_ID) : EEM_Registration::status_id_pending_payment;
2073 2073
 
2074 2074
 		$this->_set_add_edit_form_tags('update_default_event_settings');
2075 2075
 		$this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE);
2076
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template(EVENTS_TEMPLATE_PATH . 'event_settings.template.php', $this->_template_args, TRUE);
2076
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template(EVENTS_TEMPLATE_PATH.'event_settings.template.php', $this->_template_args, TRUE);
2077 2077
 		$this->display_admin_page_with_sidebar();
2078 2078
 	}
2079 2079
 
@@ -2099,9 +2099,9 @@  discard block
 block discarded – undo
2099 2099
 
2100 2100
 	protected function _template_settings() {
2101 2101
 		$this->_admin_page_title = __('Template Settings (Preview)', 'event_espresso');
2102
-		$this->_template_args['preview_img'] = '<img src="' . EVENTS_ASSETS_URL . DS . 'images' . DS . 'caffeinated_template_features.jpg" alt="' . esc_attr__( 'Template Settings Preview screenshot', 'event_espresso' ) . '" />';
2103
-		$this->_template_args['preview_text'] = '<strong>'.__( 'Template Settings is a feature that is only available in the Caffeinated version of Event Espresso. Template Settings allow you to configure some of the appearance options for both the Event List and Event Details pages.', 'event_espresso' ).'</strong>';
2104
-		$this->display_admin_caf_preview_page( 'template_settings_tab' );
2102
+		$this->_template_args['preview_img'] = '<img src="'.EVENTS_ASSETS_URL.DS.'images'.DS.'caffeinated_template_features.jpg" alt="'.esc_attr__('Template Settings Preview screenshot', 'event_espresso').'" />';
2103
+		$this->_template_args['preview_text'] = '<strong>'.__('Template Settings is a feature that is only available in the Caffeinated version of Event Espresso. Template Settings allow you to configure some of the appearance options for both the Event List and Event Details pages.', 'event_espresso').'</strong>';
2104
+		$this->display_admin_caf_preview_page('template_settings_tab');
2105 2105
 	}
2106 2106
 
2107 2107
 
@@ -2114,22 +2114,22 @@  discard block
 block discarded – undo
2114 2114
 	 * @return void
2115 2115
 	 */
2116 2116
 	private function _set_category_object() {
2117
-		if ( isset( $this->_category->id ) && !empty( $this->_category->id ) )
2117
+		if (isset($this->_category->id) && ! empty($this->_category->id))
2118 2118
 			return; //already have the category object so get out.
2119 2119
 
2120 2120
 		//set default category object
2121 2121
 		$this->_set_empty_category_object();
2122 2122
 
2123 2123
 		//only set if we've got an id
2124
-		if ( !isset($this->_req_data['EVT_CAT_ID'] ) ) {
2124
+		if ( ! isset($this->_req_data['EVT_CAT_ID'])) {
2125 2125
 			return;
2126 2126
 		}
2127 2127
 
2128 2128
 		$category_id = absint($this->_req_data['EVT_CAT_ID']);
2129 2129
 
2130
-		$term = get_term( $category_id, 'espresso_event_categories' );
2130
+		$term = get_term($category_id, 'espresso_event_categories');
2131 2131
 
2132
-		if ( !empty( $term ) ) {
2132
+		if ( ! empty($term)) {
2133 2133
 			$this->_category->category_name = $term->name;
2134 2134
 			$this->_category->category_identifier = $term->slug;
2135 2135
 			$this->_category->category_desc = $term->description;
@@ -2143,13 +2143,13 @@  discard block
 block discarded – undo
2143 2143
 
2144 2144
 	private function _set_empty_category_object() {
2145 2145
 		$this->_category = new stdClass();
2146
-		$this->_category->category_name = $this->_category->category_identifier = $this->_category->category_desc  = '';
2146
+		$this->_category->category_name = $this->_category->category_identifier = $this->_category->category_desc = '';
2147 2147
 		$this->_category->id = $this->_category->parent = 0;
2148 2148
 	}
2149 2149
 
2150 2150
 
2151 2151
 	protected function _category_list_table() {
2152
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
2152
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2153 2153
 		$this->_search_btn_label = __('Categories', 'event_espresso');
2154 2154
 		$this->_admin_page_title .= $this->get_action_link_or_button('add_category', 'add_category', array(), 'add-new-h2');
2155 2155
 		$this->display_admin_list_table_page_with_sidebar();
@@ -2159,22 +2159,22 @@  discard block
 block discarded – undo
2159 2159
 	protected function _category_details($view) {
2160 2160
 
2161 2161
 		//load formatter helper
2162
-		EE_Registry::instance()->load_helper( 'Formatter' );
2162
+		EE_Registry::instance()->load_helper('Formatter');
2163 2163
 		//load field generator helper
2164
-		EE_Registry::instance()->load_helper( 'Form_Fields' );
2164
+		EE_Registry::instance()->load_helper('Form_Fields');
2165 2165
 
2166 2166
 		$route = $view == 'edit' ? 'update_category' : 'insert_category';
2167 2167
 		$this->_set_add_edit_form_tags($route);
2168 2168
 
2169 2169
 		$this->_set_category_object();
2170
-		$id = !empty($this->_category->id) ? $this->_category->id : '';
2170
+		$id = ! empty($this->_category->id) ? $this->_category->id : '';
2171 2171
 
2172 2172
 		$delete_action = 'delete_category';
2173 2173
 
2174 2174
 		//custom redirect
2175
-		$redirect = EE_Admin_Page::add_query_args_and_nonce( array('action' => 'category_list'), $this->_admin_base_url );
2175
+		$redirect = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'category_list'), $this->_admin_base_url);
2176 2176
 
2177
-		$this->_set_publish_post_box_vars( 'EVT_CAT_ID', $id, $delete_action, $redirect );
2177
+		$this->_set_publish_post_box_vars('EVT_CAT_ID', $id, $delete_action, $redirect);
2178 2178
 
2179 2179
 		//take care of contents
2180 2180
 		$this->_template_args['admin_page_content'] = $this->_category_details_content();
@@ -2188,25 +2188,25 @@  discard block
 block discarded – undo
2188 2188
 			'type' => 'wp_editor',
2189 2189
 			'value' => EEH_Formatter::admin_format_content($this->_category->category_desc),
2190 2190
 			'class' => 'my_editor_custom',
2191
-			'wpeditor_args' => array('media_buttons' => FALSE )
2191
+			'wpeditor_args' => array('media_buttons' => FALSE)
2192 2192
 		);
2193
-		$_wp_editor = $this->_generate_admin_form_fields( $editor_args, 'array' );
2193
+		$_wp_editor = $this->_generate_admin_form_fields($editor_args, 'array');
2194 2194
 
2195
-		$all_terms = get_terms( array('espresso_event_categories' ), array( 'hide_empty' => 0, 'exclude' => array( $this->_category->id ) ) );
2195
+		$all_terms = get_terms(array('espresso_event_categories'), array('hide_empty' => 0, 'exclude' => array($this->_category->id)));
2196 2196
 
2197 2197
 		//setup category select for term parents.
2198 2198
 		$category_select_values[] = array(
2199 2199
 			'text' => __('No Parent', 'event_espresso'),
2200 2200
 			'id' => 0
2201 2201
 			);
2202
-		foreach ( $all_terms as $term ) {
2202
+		foreach ($all_terms as $term) {
2203 2203
 			$category_select_values[] = array(
2204 2204
 				'text' => $term->name,
2205 2205
 				'id' => $term->term_id
2206 2206
 				);
2207 2207
 		}
2208 2208
 
2209
-		$category_select = EEH_Form_Fields::select_input( 'category_parent', $category_select_values, $this->_category->parent );
2209
+		$category_select = EEH_Form_Fields::select_input('category_parent', $category_select_values, $this->_category->parent);
2210 2210
 
2211 2211
 		$template_args = array(
2212 2212
 			'category' => $this->_category,
@@ -2216,15 +2216,15 @@  discard block
 block discarded – undo
2216 2216
 			'disable' => '',
2217 2217
 			'disabled_message' => FALSE
2218 2218
 			);
2219
-		$template = EVENTS_TEMPLATE_PATH . 'event_category_details.template.php';
2220
-		return EEH_Template::display_template($template, $template_args, TRUE );
2219
+		$template = EVENTS_TEMPLATE_PATH.'event_category_details.template.php';
2220
+		return EEH_Template::display_template($template, $template_args, TRUE);
2221 2221
 	}
2222 2222
 
2223 2223
 
2224 2224
 	protected function _delete_categories() {
2225
-		$cat_ids = isset( $this->_req_data['EVT_CAT_ID'] ) ? (array) $this->_req_data['EVT_CAT_ID'] : (array) $this->_req_data['category_id'];
2225
+		$cat_ids = isset($this->_req_data['EVT_CAT_ID']) ? (array) $this->_req_data['EVT_CAT_ID'] : (array) $this->_req_data['category_id'];
2226 2226
 
2227
-		foreach ( $cat_ids as $cat_id ) {
2227
+		foreach ($cat_ids as $cat_id) {
2228 2228
 			$this->_delete_category($cat_id);
2229 2229
 		}
2230 2230
 
@@ -2232,7 +2232,7 @@  discard block
 block discarded – undo
2232 2232
 		$query_args = array(
2233 2233
 			'action' => 'category_list'
2234 2234
 			);
2235
-		$this->_redirect_after_action(0,'','',$query_args);
2235
+		$this->_redirect_after_action(0, '', '', $query_args);
2236 2236
 
2237 2237
 	}
2238 2238
 
@@ -2242,61 +2242,61 @@  discard block
 block discarded – undo
2242 2242
 
2243 2243
 	protected function _delete_category($cat_id) {
2244 2244
 		global $wpdb;
2245
-		$cat_id = absint( $cat_id );
2246
-		wp_delete_term( $cat_id, 'espresso_event_categories' );
2245
+		$cat_id = absint($cat_id);
2246
+		wp_delete_term($cat_id, 'espresso_event_categories');
2247 2247
 	}
2248 2248
 
2249 2249
 
2250 2250
 
2251 2251
 	protected function _insert_or_update_category($new_category) {
2252 2252
 
2253
-		$cat_id = $new_category ? $this->_insert_category() : $this->_insert_category( TRUE );
2253
+		$cat_id = $new_category ? $this->_insert_category() : $this->_insert_category(TRUE);
2254 2254
 		$success = 0; //we already have a success message so lets not send another.
2255 2255
 
2256
-		if ( $cat_id ) {
2256
+		if ($cat_id) {
2257 2257
 			$query_args = array(
2258 2258
 				'action'     => 'edit_category',
2259 2259
 				'EVT_CAT_ID' => $cat_id
2260 2260
 			);
2261 2261
 		} else {
2262
-			$query_args = array( 'action' => 'add_category' );
2262
+			$query_args = array('action' => 'add_category');
2263 2263
 		}
2264
-		$this->_redirect_after_action( $success, '','', $query_args, TRUE );
2264
+		$this->_redirect_after_action($success, '', '', $query_args, TRUE);
2265 2265
 
2266 2266
 	}
2267 2267
 
2268 2268
 
2269 2269
 
2270
-	private function _insert_category( $update = FALSE ) {
2270
+	private function _insert_category($update = FALSE) {
2271 2271
 		$cat_id = $update ? $this->_req_data['EVT_CAT_ID'] : '';
2272
-		$category_name= isset( $this->_req_data['category_name'] ) ? $this->_req_data['category_name'] : '';
2273
-		$category_desc= isset( $this->_req_data['category_desc'] ) ? $this->_req_data['category_desc'] : '';
2274
-		$category_parent = isset( $this->_req_data['category_parent'] ) ? $this->_req_data['category_parent'] : 0;
2272
+		$category_name = isset($this->_req_data['category_name']) ? $this->_req_data['category_name'] : '';
2273
+		$category_desc = isset($this->_req_data['category_desc']) ? $this->_req_data['category_desc'] : '';
2274
+		$category_parent = isset($this->_req_data['category_parent']) ? $this->_req_data['category_parent'] : 0;
2275 2275
 
2276
-		if ( empty( $category_name ) ) {
2277
-			$msg = __( 'You must add a name for the category.', 'event_espresso' );
2278
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
2276
+		if (empty($category_name)) {
2277
+			$msg = __('You must add a name for the category.', 'event_espresso');
2278
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
2279 2279
 			return false;
2280 2280
 		}
2281 2281
 
2282
-		$term_args=array(
2282
+		$term_args = array(
2283 2283
 			'name'=>$category_name,
2284 2284
 			'description'=>$category_desc,
2285 2285
 			'parent'=>$category_parent
2286 2286
 		);
2287 2287
 		//was the category_identifier input disabled?
2288
-		if(isset($this->_req_data['category_identifier'])){
2288
+		if (isset($this->_req_data['category_identifier'])) {
2289 2289
 			$term_args['slug'] = $this->_req_data['category_identifier'];
2290 2290
 		}
2291
-		$insert_ids = $update ? wp_update_term( $cat_id, 'espresso_event_categories', $term_args ) :wp_insert_term( $category_name, 'espresso_event_categories', $term_args );
2291
+		$insert_ids = $update ? wp_update_term($cat_id, 'espresso_event_categories', $term_args) : wp_insert_term($category_name, 'espresso_event_categories', $term_args);
2292 2292
 
2293
-		if ( !is_array( $insert_ids ) ) {
2294
-			$msg = __( 'An error occurred and the category has not been saved to the database.', 'event_espresso' );
2295
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
2293
+		if ( ! is_array($insert_ids)) {
2294
+			$msg = __('An error occurred and the category has not been saved to the database.', 'event_espresso');
2295
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
2296 2296
 		} else {
2297 2297
 			$cat_id = $insert_ids['term_id'];
2298
-			$msg = sprintf ( __('The category %s was successfuly saved', 'event_espresso'), $category_name );
2299
-			EE_Error::add_success( $msg );
2298
+			$msg = sprintf(__('The category %s was successfuly saved', 'event_espresso'), $category_name);
2299
+			EE_Error::add_success($msg);
2300 2300
 		}
2301 2301
 
2302 2302
 		return $cat_id;
@@ -2305,32 +2305,32 @@  discard block
 block discarded – undo
2305 2305
 
2306 2306
 
2307 2307
 
2308
-	public function get_categories( $per_page = 10, $current_page = 1, $count = FALSE ) {
2308
+	public function get_categories($per_page = 10, $current_page = 1, $count = FALSE) {
2309 2309
 		global $wpdb;
2310 2310
 
2311 2311
 		//testing term stuff
2312
-		$orderby = isset( $this->_req_data['orderby'] ) ? $this->_req_data['orderby'] : 'Term.term_id';
2313
-		$order = isset( $this->_req_data['order'] ) ? $this->_req_data['order'] : 'DESC';
2314
-		$limit = ($current_page-1)*$per_page;
2312
+		$orderby = isset($this->_req_data['orderby']) ? $this->_req_data['orderby'] : 'Term.term_id';
2313
+		$order = isset($this->_req_data['order']) ? $this->_req_data['order'] : 'DESC';
2314
+		$limit = ($current_page - 1) * $per_page;
2315 2315
 
2316
-		$where = array( 'taxonomy' => 'espresso_event_categories' );
2316
+		$where = array('taxonomy' => 'espresso_event_categories');
2317 2317
 
2318
-		if ( isset( $this->_req_data['s'] ) ) {
2319
-			$sstr = '%' . $this->_req_data['s'] . '%';
2318
+		if (isset($this->_req_data['s'])) {
2319
+			$sstr = '%'.$this->_req_data['s'].'%';
2320 2320
 			$where['OR'] = array(
2321
-				'Term.name' => array( 'LIKE', $sstr),
2322
-				'description' => array( 'LIKE', $sstr )
2321
+				'Term.name' => array('LIKE', $sstr),
2322
+				'description' => array('LIKE', $sstr)
2323 2323
 				);
2324 2324
 		}
2325 2325
 
2326 2326
 		$query_params = array(
2327
-			$where ,
2328
-			'order_by' => array( $orderby => $order ),
2329
-			'limit' => $limit . ',' . $per_page,
2327
+			$where,
2328
+			'order_by' => array($orderby => $order),
2329
+			'limit' => $limit.','.$per_page,
2330 2330
 			'force_join' => array('Term')
2331 2331
 			);
2332 2332
 
2333
-		$categories = $count ? EEM_Term_Taxonomy::instance()->count( $query_params, 'term_id' ) :EEM_Term_Taxonomy::instance()->get_all( $query_params );
2333
+		$categories = $count ? EEM_Term_Taxonomy::instance()->count($query_params, 'term_id') : EEM_Term_Taxonomy::instance()->get_all($query_params);
2334 2334
 
2335 2335
 		return $categories;
2336 2336
 	}
Please login to merge, or discard this patch.
admin_pages/venues/Venues_Admin_Page.core.php 1 patch
Spacing   +245 added lines, -245 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
 /**
@@ -62,10 +62,10 @@  discard block
 block discarded – undo
62 62
 
63 63
 
64 64
 	protected function _init_page_props() {
65
-		require_once( EE_MODELS . 'EEM_Venue.model.php' );
65
+		require_once(EE_MODELS.'EEM_Venue.model.php');
66 66
 		$this->page_slug = EE_VENUES_PG_SLUG;
67 67
 		$this->_admin_base_url = EE_VENUES_ADMIN_URL;
68
-		$this->_admin_base_path = EE_ADMIN_PAGES . 'venues';
68
+		$this->_admin_base_path = EE_ADMIN_PAGES.'venues';
69 69
 		$this->page_label = __('Event Venues', 'event_espresso');
70 70
 		$this->_cpt_model_names = array(
71 71
 			'create_new' => 'EEM_Venue',
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 				'edit' => __('Update Venue', 'event_espresso'),
109 109
 				'add_category' => __('Save New Category', 'event_espresso'),
110 110
 				'edit_category' => __('Update Category', 'event_espresso'),
111
-				'google_map_settings' => __( 'Update Settings', 'event_espresso' )
111
+				'google_map_settings' => __('Update Settings', 'event_espresso')
112 112
 				)
113 113
 		);
114 114
 	}
@@ -120,13 +120,13 @@  discard block
 block discarded – undo
120 120
 	protected function _set_page_routes() {
121 121
 
122 122
 		//load formatter helper
123
-		EE_Registry::instance()->load_helper( 'Formatter' );
123
+		EE_Registry::instance()->load_helper('Formatter');
124 124
 		//load field generator helper
125
-		EE_Registry::instance()->load_helper( 'Form_Fields' );
125
+		EE_Registry::instance()->load_helper('Form_Fields');
126 126
 
127 127
 		//is there a vnu_id in the request?
128
-		$vnu_id = ! empty( $this->_req_data['VNU_ID'] ) && ! is_array( $this->_req_data['VNU_ID'] ) ? $this->_req_data['VNU_ID'] : 0;
129
-		$vnu_id = ! empty( $this->_req_data['post'] ) ? $this->_req_data['post'] : $vnu_id;
128
+		$vnu_id = ! empty($this->_req_data['VNU_ID']) && ! is_array($this->_req_data['VNU_ID']) ? $this->_req_data['VNU_ID'] : 0;
129
+		$vnu_id = ! empty($this->_req_data['post']) ? $this->_req_data['post'] : $vnu_id;
130 130
 
131 131
 		$this->_page_routes = array(
132 132
 			'default' => array(
@@ -144,27 +144,27 @@  discard block
 block discarded – undo
144 144
 				),
145 145
 			'trash_venue' => array(
146 146
 				'func' => '_trash_or_restore_venue',
147
-				'args' => array( 'venue_status' => 'trash' ),
147
+				'args' => array('venue_status' => 'trash'),
148 148
 				'noheader' => TRUE,
149 149
 				'capability' => 'ee_delete_venue',
150 150
 				'obj_id' => $vnu_id
151 151
 				),
152 152
 			'trash_venues' => array(
153 153
 				'func' => '_trash_or_restore_venues',
154
-				'args' => array( 'venue_status' => 'trash' ),
154
+				'args' => array('venue_status' => 'trash'),
155 155
 				'noheader' => TRUE,
156 156
 				'capability' => 'ee_delete_venues'
157 157
 				),
158 158
 			'restore_venue' => array(
159 159
 				'func' => '_trash_or_restore_venue',
160
-				'args' => array( 'venue_status' => 'draft' ),
160
+				'args' => array('venue_status' => 'draft'),
161 161
 				'noheader' => TRUE,
162 162
 				'capability' => 'ee_delete_venue',
163 163
 				'obj_id' => $vnu_id
164 164
 				),
165 165
 			'restore_venues' => array(
166 166
 				'func' => '_trash_or_restore_venues',
167
-				'args' => array( 'venue_status' => 'draft' ),
167
+				'args' => array('venue_status' => 'draft'),
168 168
 				'noheader' => TRUE,
169 169
 				'capability' => 'ee_delete_venues'
170 170
 				),
@@ -266,7 +266,7 @@  discard block
 block discarded – undo
266 266
 						'filename' => 'venues_overview_views_bulk_actions_search'
267 267
 					)
268 268
 				),
269
-				'help_tour' => array( 'Venues_Overview_Help_Tour' ),
269
+				'help_tour' => array('Venues_Overview_Help_Tour'),
270 270
 				'metaboxes' => array('_espresso_news_post_box', '_espresso_links_post_box'),
271 271
 				'require_nonce' => FALSE
272 272
 			),
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
 						'filename' => 'venues_editor_other'
303 303
 					)
304 304
 				),
305
-				'help_tour' => array( 'Venues_Add_Venue_Help_Tour' ),
305
+				'help_tour' => array('Venues_Add_Venue_Help_Tour'),
306 306
 				'metaboxes' => array('_venue_editor_metaboxes'),
307 307
 				'require_nonce' => FALSE
308 308
 				),
@@ -311,7 +311,7 @@  discard block
 block discarded – undo
311 311
 					'label' => __('Edit Venue', 'event_espresso'),
312 312
 					'order' => 5,
313 313
 					'persistent' => FALSE,
314
-					'url' => isset($this->_req_data['post']) ? add_query_arg(array('post' => $this->_req_data['post'] ), $this->_current_page_view_url )  : $this->_admin_base_url
314
+					'url' => isset($this->_req_data['post']) ? add_query_arg(array('post' => $this->_req_data['post']), $this->_current_page_view_url) : $this->_admin_base_url
315 315
 				),
316 316
 				'help_tabs' => array(
317 317
 					'venues_editor_help_tab' => array(
@@ -339,7 +339,7 @@  discard block
 block discarded – undo
339 339
 						'filename' => 'venues_editor_other'
340 340
 					)
341 341
 				),
342
-				'help_tour' => array( 'Venues_Edit_Venue_Help_Tour' ),
342
+				'help_tour' => array('Venues_Edit_Venue_Help_Tour'),
343 343
 				'metaboxes' => array('_venue_editor_metaboxes'),
344 344
 				'require_nonce' => FALSE
345 345
 			),
@@ -348,14 +348,14 @@  discard block
 block discarded – undo
348 348
 					'label' => __('Google Maps'),
349 349
 					'order' => 40
350 350
 				),
351
-				'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array('_publish_post_box' ) ),
351
+				'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')),
352 352
 				'help_tabs' => array(
353 353
 					'general_settings_google_maps_help_tab' => array(
354 354
 						'title' => __('Google Maps', 'event_espresso'),
355 355
 						'filename' => 'general_settings_google_maps'
356 356
 					)
357 357
 				),
358
-				'help_tour' => array( 'Google_Maps_Help_Tour' ),
358
+				'help_tour' => array('Google_Maps_Help_Tour'),
359 359
 				'require_nonce' => FALSE
360 360
 			),
361 361
 			//venue category stuff
@@ -371,7 +371,7 @@  discard block
 block discarded – undo
371 371
 						'filename' => 'venues_add_category'
372 372
 					)
373 373
 				),
374
-				'help_tour' => array( 'Venues_Add_Category_Help_Tour' ),
374
+				'help_tour' => array('Venues_Add_Category_Help_Tour'),
375 375
 				'require_nonce' => FALSE
376 376
 				),
377 377
 			'edit_category' => array(
@@ -379,7 +379,7 @@  discard block
 block discarded – undo
379 379
 					'label' => __('Edit Category', 'event_espresso'),
380 380
 					'order' => 15,
381 381
 					'persistent' => FALSE,
382
-					'url' => isset($this->_req_data['EVT_CAT_ID']) ? add_query_arg(array('EVT_CAT_ID' => $this->_req_data['EVT_CAT_ID'] ), $this->_current_page_view_url )  : $this->_admin_base_url
382
+					'url' => isset($this->_req_data['EVT_CAT_ID']) ? add_query_arg(array('EVT_CAT_ID' => $this->_req_data['EVT_CAT_ID']), $this->_current_page_view_url) : $this->_admin_base_url
383 383
 					),
384 384
 				'metaboxes' => array('_publish_post_box'),
385 385
 				'help_tabs' => array(
@@ -388,7 +388,7 @@  discard block
 block discarded – undo
388 388
 						'filename' => 'venues_edit_category'
389 389
 					)
390 390
 				),
391
-				'help_tour' => array( 'Venues_Edit_Category_Help_Tour' ),
391
+				'help_tour' => array('Venues_Edit_Category_Help_Tour'),
392 392
 				'require_nonce' => FALSE
393 393
 				),
394 394
 			'category_list' => array(
@@ -415,7 +415,7 @@  discard block
 block discarded – undo
415 415
 						'filename' => 'venues_categories_other'
416 416
 					)
417 417
 				),
418
-				'help_tour' => array( 'Venues_Categories_Help_Tour' ),
418
+				'help_tour' => array('Venues_Categories_Help_Tour'),
419 419
 				'metaboxes' => $this->_default_espresso_metaboxes,
420 420
 				'require_nonce' => FALSE
421 421
 				)
@@ -472,7 +472,7 @@  discard block
 block discarded – undo
472 472
 
473 473
 
474 474
 	public function load_scripts_styles() {
475
-		wp_register_style('ee-cat-admin', EVENTS_ASSETS_URL . 'ee-cat-admin.css', array(), EVENT_ESPRESSO_VERSION );
475
+		wp_register_style('ee-cat-admin', EVENTS_ASSETS_URL.'ee-cat-admin.css', array(), EVENT_ESPRESSO_VERSION);
476 476
 		wp_enqueue_style('ee-cat-admin');
477 477
 	}
478 478
 
@@ -495,7 +495,7 @@  discard block
 block discarded – undo
495 495
 	public function load_scripts_styles_edit() {
496 496
 		//styles
497 497
 		wp_enqueue_style('espresso-ui-theme');
498
-		wp_register_style( 'espresso_venues', EE_VENUES_ASSETS_URL . 'ee-venues-admin.css', array(), EVENT_ESPRESSO_VERSION );
498
+		wp_register_style('espresso_venues', EE_VENUES_ASSETS_URL.'ee-venues-admin.css', array(), EVENT_ESPRESSO_VERSION);
499 499
 		wp_enqueue_style('espresso_venues');
500 500
 	}
501 501
 
@@ -514,13 +514,13 @@  discard block
 block discarded – undo
514 514
 				)
515 515
 		);
516 516
 
517
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_venues', 'espresso_venues_trash_venues' ) ) {
517
+		if (EE_Registry::instance()->CAP->current_user_can('ee_delete_venues', 'espresso_venues_trash_venues')) {
518 518
 			$this->_views['all']['bulk_action'] = array(
519 519
 				'trash_venues' => __('Move to Trash', 'event_espresso')
520 520
 			);
521 521
 			$this->_views['trash'] = array(
522 522
 				'slug' => 'trash',
523
-				'label' => __( 'Trash', 'event_espresso' ),
523
+				'label' => __('Trash', 'event_espresso'),
524 524
 				'count' => 0,
525 525
 				'bulk_action' => array(
526 526
 					'restore_venues' => __('Restore from Trash', 'event_espresso'),
@@ -553,8 +553,8 @@  discard block
 block discarded – undo
553 553
 
554 554
 
555 555
 	protected function _overview_list_table() {
556
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
557
-		$this->_template_args['after_list_table'] = EEH_Template::get_button_or_link( get_post_type_archive_link('espresso_venues'), __("View Venue Archive Page", "event_espresso"), 'button' );
556
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
557
+		$this->_template_args['after_list_table'] = EEH_Template::get_button_or_link(get_post_type_archive_link('espresso_venues'), __("View Venue Archive Page", "event_espresso"), 'button');
558 558
 		$this->_admin_page_title .= $this->get_action_link_or_button('create_new', 'add', array(), 'add-new-h2');
559 559
 		$this->_search_btn_label = __('Venues', 'event_espresso');
560 560
 		$this->display_admin_list_table_page_with_sidebar();
@@ -568,8 +568,8 @@  discard block
 block discarded – undo
568 568
 			'vnu_url' => $this->_cpt_model_obj->venue_url(),
569 569
 			'vnu_phone' => $this->_cpt_model_obj->phone()
570 570
 			);
571
-		$template = EE_VENUES_TEMPLATE_PATH . 'venue_publish_box_extras.template.php';
572
-		EEH_Template::display_template( $template, $extra_rows );
571
+		$template = EE_VENUES_TEMPLATE_PATH.'venue_publish_box_extras.template.php';
572
+		EEH_Template::display_template($template, $extra_rows);
573 573
 	}
574 574
 
575 575
 
@@ -584,115 +584,115 @@  discard block
 block discarded – undo
584 584
 		$default_map_settings = new stdClass();
585 585
 		$default_map_settings->use_google_maps = TRUE;
586 586
 		// for event details pages (reg page)
587
-		$default_map_settings->event_details_map_width = 585; 			// ee_map_width_single
588
-		$default_map_settings->event_details_map_height = 362; 			// ee_map_height_single
589
-		$default_map_settings->event_details_map_zoom = 14; 			// ee_map_zoom_single
590
-		$default_map_settings->event_details_display_nav = TRUE; 			// ee_map_nav_display_single
591
-		$default_map_settings->event_details_nav_size = FALSE; 			// ee_map_nav_size_single
592
-		$default_map_settings->event_details_control_type = 'default'; 		// ee_map_type_control_single
593
-		$default_map_settings->event_details_map_align = 'center'; 			// ee_map_align_single
587
+		$default_map_settings->event_details_map_width = 585; // ee_map_width_single
588
+		$default_map_settings->event_details_map_height = 362; // ee_map_height_single
589
+		$default_map_settings->event_details_map_zoom = 14; // ee_map_zoom_single
590
+		$default_map_settings->event_details_display_nav = TRUE; // ee_map_nav_display_single
591
+		$default_map_settings->event_details_nav_size = FALSE; // ee_map_nav_size_single
592
+		$default_map_settings->event_details_control_type = 'default'; // ee_map_type_control_single
593
+		$default_map_settings->event_details_map_align = 'center'; // ee_map_align_single
594 594
 		// for event list pages
595
-		$default_map_settings->event_list_map_width = 300; 			// ee_map_width
596
-		$default_map_settings->event_list_map_height = 185; 		// ee_map_height
597
-		$default_map_settings->event_list_map_zoom = 12; 			// ee_map_zoom
598
-		$default_map_settings->event_list_display_nav = FALSE; 		// ee_map_nav_display
599
-		$default_map_settings->event_list_nav_size = TRUE; 			// ee_map_nav_size
600
-		$default_map_settings->event_list_control_type = 'dropdown'; 		// ee_map_type_control
601
-		$default_map_settings->event_list_map_align = 'center'; 			// ee_map_align
595
+		$default_map_settings->event_list_map_width = 300; // ee_map_width
596
+		$default_map_settings->event_list_map_height = 185; // ee_map_height
597
+		$default_map_settings->event_list_map_zoom = 12; // ee_map_zoom
598
+		$default_map_settings->event_list_display_nav = FALSE; // ee_map_nav_display
599
+		$default_map_settings->event_list_nav_size = TRUE; // ee_map_nav_size
600
+		$default_map_settings->event_list_control_type = 'dropdown'; // ee_map_type_control
601
+		$default_map_settings->event_list_map_align = 'center'; // ee_map_align
602 602
 
603 603
 		$this->_template_args['map_settings'] =
604
-			isset( EE_Registry::instance()->CFG->map_settings ) && ! empty( EE_Registry::instance()->CFG->map_settings )
605
-				? (object)array_merge( (array)$default_map_settings, (array)EE_Registry::instance()->CFG->map_settings )
604
+			isset(EE_Registry::instance()->CFG->map_settings) && ! empty(EE_Registry::instance()->CFG->map_settings)
605
+				? (object) array_merge((array) $default_map_settings, (array) EE_Registry::instance()->CFG->map_settings)
606 606
 				: $default_map_settings;
607 607
 
608
-		$this->_set_add_edit_form_tags( 'update_google_map_settings' );
609
-		$this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE );
610
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( EE_VENUES_TEMPLATE_PATH . 'google_map.template.php', $this->_template_args, TRUE );
608
+		$this->_set_add_edit_form_tags('update_google_map_settings');
609
+		$this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE);
610
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template(EE_VENUES_TEMPLATE_PATH.'google_map.template.php', $this->_template_args, TRUE);
611 611
 		$this->display_admin_page_with_sidebar();
612 612
 	}
613 613
 
614 614
 	protected function _update_google_map_settings() {
615 615
 
616 616
 		EE_Registry::instance()->CFG->map_settings->use_google_maps =
617
-			isset( $this->_req_data['use_google_maps'] )
618
-				? absint( $this->_req_data['use_google_maps'] )
617
+			isset($this->_req_data['use_google_maps'])
618
+				? absint($this->_req_data['use_google_maps'])
619 619
 				: EE_Registry::instance()->CFG->map_settings->use_google_maps;
620 620
 
621 621
 		EE_Registry::instance()->CFG->map_settings->event_details_map_width =
622
-			isset( $this->_req_data['event_details_map_width'] )
623
-				? absint( $this->_req_data['event_details_map_width'] )
622
+			isset($this->_req_data['event_details_map_width'])
623
+				? absint($this->_req_data['event_details_map_width'])
624 624
 				: EE_Registry::instance()->CFG->map_settings->event_details_map_width;
625 625
 
626 626
 		EE_Registry::instance()->CFG->map_settings->event_details_map_height =
627
-			isset( $this->_req_data['event_details_map_height'] )
628
-				? absint( $this->_req_data['event_details_map_height'] )
627
+			isset($this->_req_data['event_details_map_height'])
628
+				? absint($this->_req_data['event_details_map_height'])
629 629
 				: EE_Registry::instance()->CFG->map_settings->event_details_map_height;
630 630
 
631 631
 		EE_Registry::instance()->CFG->map_settings->event_details_map_zoom =
632
-			isset( $this->_req_data['event_details_map_zoom'] )
633
-				? absint( $this->_req_data['event_details_map_zoom'] )
632
+			isset($this->_req_data['event_details_map_zoom'])
633
+				? absint($this->_req_data['event_details_map_zoom'])
634 634
 				: EE_Registry::instance()->CFG->map_settings->event_details_map_zoom;
635 635
 
636 636
 		EE_Registry::instance()->CFG->map_settings->event_details_display_nav =
637
-			isset( $this->_req_data['event_details_display_nav'] )
638
-				? absint( $this->_req_data['event_details_display_nav'] )
637
+			isset($this->_req_data['event_details_display_nav'])
638
+				? absint($this->_req_data['event_details_display_nav'])
639 639
 				: EE_Registry::instance()->CFG->map_settings->event_details_display_nav;
640 640
 
641 641
 		EE_Registry::instance()->CFG->map_settings->event_details_nav_size =
642
-			isset( $this->_req_data['event_details_nav_size'] )
643
-				? absint( $this->_req_data['event_details_nav_size'] )
642
+			isset($this->_req_data['event_details_nav_size'])
643
+				? absint($this->_req_data['event_details_nav_size'])
644 644
 				: EE_Registry::instance()->CFG->map_settings->event_details_nav_size;
645 645
 
646 646
 		EE_Registry::instance()->CFG->map_settings->event_details_control_type =
647
-			isset( $this->_req_data['event_details_control_type'] )
648
-				? sanitize_text_field( $this->_req_data['event_details_control_type'] )
647
+			isset($this->_req_data['event_details_control_type'])
648
+				? sanitize_text_field($this->_req_data['event_details_control_type'])
649 649
 				: EE_Registry::instance()->CFG->map_settings->event_details_control_type;
650 650
 
651 651
 		EE_Registry::instance()->CFG->map_settings->event_details_map_align =
652
-			isset( $this->_req_data['event_details_map_align'] )
653
-				? sanitize_text_field( $this->_req_data['event_details_map_align'] )
652
+			isset($this->_req_data['event_details_map_align'])
653
+				? sanitize_text_field($this->_req_data['event_details_map_align'])
654 654
 				: EE_Registry::instance()->CFG->map_settings->event_details_map_align;
655 655
 
656 656
 		EE_Registry::instance()->CFG->map_settings->event_list_map_width =
657
-			isset( $this->_req_data['event_list_map_width'] )
658
-				? absint( $this->_req_data['event_list_map_width'] )
657
+			isset($this->_req_data['event_list_map_width'])
658
+				? absint($this->_req_data['event_list_map_width'])
659 659
 				: EE_Registry::instance()->CFG->map_settings->event_list_map_width;
660 660
 
661 661
 		EE_Registry::instance()->CFG->map_settings->event_list_map_height =
662
-			isset( $this->_req_data['event_list_map_height'] )
663
-				? absint( $this->_req_data['event_list_map_height'] )
662
+			isset($this->_req_data['event_list_map_height'])
663
+				? absint($this->_req_data['event_list_map_height'])
664 664
 				: EE_Registry::instance()->CFG->map_settings->event_list_map_height;
665 665
 
666 666
 		EE_Registry::instance()->CFG->map_settings->event_list_map_zoom =
667
-			isset( $this->_req_data['event_list_map_zoom'] )
668
-				? absint( $this->_req_data['event_list_map_zoom'] )
667
+			isset($this->_req_data['event_list_map_zoom'])
668
+				? absint($this->_req_data['event_list_map_zoom'])
669 669
 				: EE_Registry::instance()->CFG->map_settings->event_list_map_zoom;
670 670
 
671 671
 		EE_Registry::instance()->CFG->map_settings->event_list_display_nav =
672
-			isset( $this->_req_data['event_list_display_nav'] )
673
-				? absint( $this->_req_data['event_list_display_nav'] )
672
+			isset($this->_req_data['event_list_display_nav'])
673
+				? absint($this->_req_data['event_list_display_nav'])
674 674
 				: EE_Registry::instance()->CFG->map_settings->event_list_display_nav;
675 675
 
676 676
 		EE_Registry::instance()->CFG->map_settings->event_list_nav_size =
677
-			isset( $this->_req_data['event_list_nav_size'] )
678
-				? absint( $this->_req_data['event_list_nav_size'] )
677
+			isset($this->_req_data['event_list_nav_size'])
678
+				? absint($this->_req_data['event_list_nav_size'])
679 679
 				: EE_Registry::instance()->CFG->map_settings->event_list_nav_size;
680 680
 
681 681
 		EE_Registry::instance()->CFG->map_settings->event_list_control_type =
682
-			isset( $this->_req_data['event_list_control_type'] )
683
-				? sanitize_text_field( $this->_req_data['event_list_control_type'] )
682
+			isset($this->_req_data['event_list_control_type'])
683
+				? sanitize_text_field($this->_req_data['event_list_control_type'])
684 684
 				: EE_Registry::instance()->CFG->map_settings->event_list_control_type;
685 685
 
686 686
 		EE_Registry::instance()->CFG->map_settings->event_list_map_align =
687
-			isset( $this->_req_data['event_list_map_align'] )
688
-				? sanitize_text_field( $this->_req_data['event_list_map_align'] )
687
+			isset($this->_req_data['event_list_map_align'])
688
+				? sanitize_text_field($this->_req_data['event_list_map_align'])
689 689
 				: EE_Registry::instance()->CFG->map_settings->event_list_map_align;
690 690
 
691
-		EE_Registry::instance()->CFG->map_settings = apply_filters( 'FHEE__Extend_General_Settings_Admin_Page___update_google_map_settings__CFG_map_settings', EE_Registry::instance()->CFG->map_settings );
691
+		EE_Registry::instance()->CFG->map_settings = apply_filters('FHEE__Extend_General_Settings_Admin_Page___update_google_map_settings__CFG_map_settings', EE_Registry::instance()->CFG->map_settings);
692 692
 
693 693
 		$what = 'Google Map Settings';
694
-		$success = $this->_update_espresso_configuration( $what, EE_Registry::instance()->CFG->map_settings, __FILE__, __FUNCTION__, __LINE__ );
695
-		$this->_redirect_after_action( $success, $what, 'updated', array( 'action' => 'google_map_settings' ) );
694
+		$success = $this->_update_espresso_configuration($what, EE_Registry::instance()->CFG->map_settings, __FILE__, __FUNCTION__, __LINE__);
695
+		$this->_redirect_after_action($success, $what, 'updated', array('action' => 'google_map_settings'));
696 696
 
697 697
 	}
698 698
 
@@ -701,9 +701,9 @@  discard block
 block discarded – undo
701 701
 	protected function _venue_editor_metaboxes() {
702 702
 		$this->verify_cpt_object();
703 703
 
704
-		add_meta_box( 'espresso_venue_address_options', __('Physical Location', 'event_espresso'), array( $this, 'venue_address_metabox'), $this->page_slug, 'side', 'default' );
705
-		add_meta_box( 'espresso_venue_gmap_options', __('Google Map', 'event_espresso'), array( $this, 'venue_gmap_metabox'), $this->page_slug, 'side', 'default' );
706
-		add_meta_box( 'espresso_venue_virtual_loc_options', __('Virtual Location', 'event_espresso'), array( $this, 'venue_virtual_loc_metabox'), $this->page_slug, 'side', 'default' );
704
+		add_meta_box('espresso_venue_address_options', __('Physical Location', 'event_espresso'), array($this, 'venue_address_metabox'), $this->page_slug, 'side', 'default');
705
+		add_meta_box('espresso_venue_gmap_options', __('Google Map', 'event_espresso'), array($this, 'venue_gmap_metabox'), $this->page_slug, 'side', 'default');
706
+		add_meta_box('espresso_venue_virtual_loc_options', __('Virtual Location', 'event_espresso'), array($this, 'venue_virtual_loc_metabox'), $this->page_slug, 'side', 'default');
707 707
 
708 708
 	}
709 709
 
@@ -711,23 +711,23 @@  discard block
 block discarded – undo
711 711
 
712 712
 	public function venue_gmap_metabox() {
713 713
 		$template_args = array(
714
-			'vnu_enable_for_gmap' => EEH_Form_Fields::select_input('vnu_enable_for_gmap', $this->get_yes_no_values(), $this->_cpt_model_obj->enable_for_gmap() ),
714
+			'vnu_enable_for_gmap' => EEH_Form_Fields::select_input('vnu_enable_for_gmap', $this->get_yes_no_values(), $this->_cpt_model_obj->enable_for_gmap()),
715 715
 			'vnu_google_map_link' => $this->_cpt_model_obj->google_map_link(),
716 716
 			);
717
-		$template = EE_VENUES_TEMPLATE_PATH . 'venue_gmap_metabox_content.template.php';
718
-		EEH_Template::display_template( $template, $template_args );
717
+		$template = EE_VENUES_TEMPLATE_PATH.'venue_gmap_metabox_content.template.php';
718
+		EEH_Template::display_template($template, $template_args);
719 719
 	}
720 720
 
721 721
 
722 722
 
723 723
 	public function venue_address_metabox() {
724 724
 
725
-		$template_args['_venue'] =$this->_cpt_model_obj;
725
+		$template_args['_venue'] = $this->_cpt_model_obj;
726 726
 
727 727
 		$template_args['states_dropdown'] = EEH_Form_Fields::generate_form_input(
728 728
 			$QFI = new EE_Question_Form_Input(
729
-				EE_Question::new_instance( array( 'QST_display_text' => 'State', 'QST_system' => 'state' )),
730
-				EE_Answer::new_instance( array(  'ANS_value'=> $this->_cpt_model_obj->state_ID() )),
729
+				EE_Question::new_instance(array('QST_display_text' => 'State', 'QST_system' => 'state')),
730
+				EE_Answer::new_instance(array('ANS_value'=> $this->_cpt_model_obj->state_ID())),
731 731
 				array(
732 732
 					'input_name' =>  'sta_id',
733 733
 					'input_id' => 'sta_id',
@@ -739,8 +739,8 @@  discard block
 block discarded – undo
739 739
 		);
740 740
 		$template_args['countries_dropdown'] = EEH_Form_Fields::generate_form_input(
741 741
 			$QFI = new EE_Question_Form_Input(
742
-				EE_Question::new_instance( array( 'QST_display_text' => 'Country', 'QST_system' => 'country' )),
743
-				EE_Answer::new_instance( array(  'ANS_value'=> $this->_cpt_model_obj->country_ID() )),
742
+				EE_Question::new_instance(array('QST_display_text' => 'Country', 'QST_system' => 'country')),
743
+				EE_Answer::new_instance(array('ANS_value'=> $this->_cpt_model_obj->country_ID())),
744 744
 				array(
745 745
 					'input_name' =>  'cnt_iso',
746 746
 					'input_id' => 'cnt_iso',
@@ -751,8 +751,8 @@  discard block
 block discarded – undo
751 751
 			)
752 752
 		);
753 753
 
754
-		$template = EE_VENUES_TEMPLATE_PATH . 'venue_address_metabox_content.template.php';
755
-		EEH_Template::display_template( $template, $template_args );
754
+		$template = EE_VENUES_TEMPLATE_PATH.'venue_address_metabox_content.template.php';
755
+		EEH_Template::display_template($template, $template_args);
756 756
 	}
757 757
 
758 758
 
@@ -764,8 +764,8 @@  discard block
 block discarded – undo
764 764
 		$template_args = array(
765 765
 			'_venue' => $this->_cpt_model_obj
766 766
 			);
767
-		$template = EE_VENUES_TEMPLATE_PATH . 'venue_virtual_location_metabox_content.template.php';
768
-		EEH_Template::display_template( $template, $template_args );
767
+		$template = EE_VENUES_TEMPLATE_PATH.'venue_virtual_location_metabox_content.template.php';
768
+		EEH_Template::display_template($template, $template_args);
769 769
 	}
770 770
 
771 771
 
@@ -788,52 +788,52 @@  discard block
 block discarded – undo
788 788
 	 * @param  object $post    Post object (with "blessed" WP properties)
789 789
 	 * @return void
790 790
 	 */
791
-	protected function _insert_update_cpt_item( $post_id, $post ) {
791
+	protected function _insert_update_cpt_item($post_id, $post) {
792 792
 
793
-		if ( $post instanceof WP_Post && $post->post_type !== 'espresso_venues' ) {
794
-			return;// get out we're not processing the saving of venues.
793
+		if ($post instanceof WP_Post && $post->post_type !== 'espresso_venues') {
794
+			return; // get out we're not processing the saving of venues.
795 795
 		}
796 796
 
797
-		$wheres = array( $this->_venue_model->primary_key_name() => $post_id );
797
+		$wheres = array($this->_venue_model->primary_key_name() => $post_id);
798 798
 
799 799
 		$venue_values = array(
800
-			'VNU_address' => !empty( $this->_req_data['vnu_address'] ) ? $this->_req_data['vnu_address'] : NULL,
801
-			'VNU_address2' => !empty( $this->_req_data['vnu_address2'] ) ? $this->_req_data['vnu_address2'] : NULL,
802
-			'VNU_city' => !empty( $this->_req_data['vnu_city'] ) ? $this->_req_data['vnu_city'] : NULL,
803
-			'STA_ID' => !empty( $this->_req_data['sta_id'] ) ? $this->_req_data['sta_id'] : NULL,
804
-			'CNT_ISO' => !empty( $this->_req_data['cnt_iso'] ) ? $this->_req_data['cnt_iso'] : NULL,
805
-			'VNU_zip' => !empty( $this->_req_data['vnu_zip'] ) ? $this->_req_data['vnu_zip'] : NULL,
806
-			'VNU_phone' => !empty( $this->_req_data['vnu_phone'] ) ? $this->_req_data['vnu_phone'] : NULL,
807
-			'VNU_capacity' => !empty( $this->_req_data['vnu_capacity'] ) ? str_replace( ',', '', $this->_req_data['vnu_capacity'] ) : EE_INF,
808
-			'VNU_url' => !empty( $this->_req_data['vnu_url'] ) ? $this->_req_data['vnu_url'] : NULL,
809
-			'VNU_virtual_phone' => !empty( $this->_req_data['vnu_virtual_phone'] ) ? $this->_req_data['vnu_virtual_phone'] : NULL,
810
-			'VNU_virtual_url' => !empty( $this->_req_data['vnu_virtual_url'] ) ? $this->_req_data['vnu_virtual_url'] : NULL,
811
-			'VNU_enable_for_gmap' => !empty( $this->_req_data['vnu_enable_for_gmap'] ) ? TRUE : FALSE,
812
-			'VNU_google_map_link' => !empty( $this->_req_data['vnu_google_map_link'] ) ? $this->_req_data['vnu_google_map_link'] : NULL
800
+			'VNU_address' => ! empty($this->_req_data['vnu_address']) ? $this->_req_data['vnu_address'] : NULL,
801
+			'VNU_address2' => ! empty($this->_req_data['vnu_address2']) ? $this->_req_data['vnu_address2'] : NULL,
802
+			'VNU_city' => ! empty($this->_req_data['vnu_city']) ? $this->_req_data['vnu_city'] : NULL,
803
+			'STA_ID' => ! empty($this->_req_data['sta_id']) ? $this->_req_data['sta_id'] : NULL,
804
+			'CNT_ISO' => ! empty($this->_req_data['cnt_iso']) ? $this->_req_data['cnt_iso'] : NULL,
805
+			'VNU_zip' => ! empty($this->_req_data['vnu_zip']) ? $this->_req_data['vnu_zip'] : NULL,
806
+			'VNU_phone' => ! empty($this->_req_data['vnu_phone']) ? $this->_req_data['vnu_phone'] : NULL,
807
+			'VNU_capacity' => ! empty($this->_req_data['vnu_capacity']) ? str_replace(',', '', $this->_req_data['vnu_capacity']) : EE_INF,
808
+			'VNU_url' => ! empty($this->_req_data['vnu_url']) ? $this->_req_data['vnu_url'] : NULL,
809
+			'VNU_virtual_phone' => ! empty($this->_req_data['vnu_virtual_phone']) ? $this->_req_data['vnu_virtual_phone'] : NULL,
810
+			'VNU_virtual_url' => ! empty($this->_req_data['vnu_virtual_url']) ? $this->_req_data['vnu_virtual_url'] : NULL,
811
+			'VNU_enable_for_gmap' => ! empty($this->_req_data['vnu_enable_for_gmap']) ? TRUE : FALSE,
812
+			'VNU_google_map_link' => ! empty($this->_req_data['vnu_google_map_link']) ? $this->_req_data['vnu_google_map_link'] : NULL
813 813
 			);
814 814
 
815 815
 		//update venue
816
-		$success = $this->_venue_model->update( $venue_values, array( $wheres ) );
816
+		$success = $this->_venue_model->update($venue_values, array($wheres));
817 817
 
818 818
 		//get venue_object for other metaboxes that might be added via the filter... though it would seem to make sense to just use $this->_venue_model->get_one_by_ID( $post_id ).. i have to setup where conditions to override the filters in the model that filter out autodraft and inherit statuses so we GET the inherit id!
819
-		$get_one_where = array( $this->_venue_model->primary_key_name() => $post_id, 'status' => $post->post_status  );
820
-		$venue = $this->_venue_model->get_one( array( $get_one_where ) );
819
+		$get_one_where = array($this->_venue_model->primary_key_name() => $post_id, 'status' => $post->post_status);
820
+		$venue = $this->_venue_model->get_one(array($get_one_where));
821 821
 
822 822
 		//notice we've applied a filter for venue metabox callbacks but we don't actually have any default venue metaboxes in use.  So this is just here for addons to more easily hook into venue saves.
823
-		$venue_update_callbacks = apply_filters( 'FHEE__Venues_Admin_Page___insert_update_cpt_item__venue_update_callbacks', array() );
823
+		$venue_update_callbacks = apply_filters('FHEE__Venues_Admin_Page___insert_update_cpt_item__venue_update_callbacks', array());
824 824
 
825 825
 		$att_success = TRUE;
826 826
 
827
-		foreach ( $venue_update_callbacks as $v_callback ) {
828
-			$_succ = call_user_func_array( $v_callback, array( $venue,  $this->_req_data ) );
829
-			$att_success = !$att_success ? $att_success : $_succ; //if ANY of these updates fail then we want the appropriate global error message
827
+		foreach ($venue_update_callbacks as $v_callback) {
828
+			$_succ = call_user_func_array($v_callback, array($venue, $this->_req_data));
829
+			$att_success = ! $att_success ? $att_success : $_succ; //if ANY of these updates fail then we want the appropriate global error message
830 830
 		}
831 831
 
832 832
 		//any errors?
833
-		if ( $success && !$att_success ) {
834
-			EE_Error::add_error( __('Venue Details saved successfully but something went wrong with saving attachments.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
835
-		} else if ( $success === FALSE ) {
836
-			EE_Error::add_error( __('Venue Details did not save successfully.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
833
+		if ($success && ! $att_success) {
834
+			EE_Error::add_error(__('Venue Details saved successfully but something went wrong with saving attachments.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
835
+		} else if ($success === FALSE) {
836
+			EE_Error::add_error(__('Venue Details did not save successfully.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
837 837
 		}
838 838
 	}
839 839
 
@@ -841,9 +841,9 @@  discard block
 block discarded – undo
841 841
 
842 842
 
843 843
 
844
-	public function trash_cpt_item( $post_id ) {
844
+	public function trash_cpt_item($post_id) {
845 845
 		$this->_req_data['VNU_ID'] = $post_id;
846
-		$this->_trash_or_restore_venue( 'trash', FALSE );
846
+		$this->_trash_or_restore_venue('trash', FALSE);
847 847
 	}
848 848
 
849 849
 
@@ -851,18 +851,18 @@  discard block
 block discarded – undo
851 851
 
852 852
 
853 853
 
854
-	public function restore_cpt_item( $post_id ) {
854
+	public function restore_cpt_item($post_id) {
855 855
 		$this->_req_data['VNU_ID'] = $post_id;
856
-		$this->_trash_or_restore_venue( 'draft', FALSE );
856
+		$this->_trash_or_restore_venue('draft', FALSE);
857 857
 	}
858 858
 
859 859
 
860 860
 
861 861
 
862 862
 
863
-	public function delete_cpt_item( $post_id ) {
863
+	public function delete_cpt_item($post_id) {
864 864
 		$this->_req_data['VNU_ID'] = $post_id;
865
-		$this->_delete_venue( FALSE );
865
+		$this->_delete_venue(FALSE);
866 866
 	}
867 867
 
868 868
 
@@ -877,15 +877,15 @@  discard block
 block discarded – undo
877 877
 
878 878
 
879 879
 
880
-	protected function _trash_or_restore_venue( $venue_status = 'trash', $redirect_after = TRUE ) {
881
-		$VNU_ID = isset( $this->_req_data['VNU_ID'] ) ? absint( $this->_req_data['VNU_ID'] ) : FALSE;
880
+	protected function _trash_or_restore_venue($venue_status = 'trash', $redirect_after = TRUE) {
881
+		$VNU_ID = isset($this->_req_data['VNU_ID']) ? absint($this->_req_data['VNU_ID']) : FALSE;
882 882
 
883 883
 		//loop thru venues
884
-		if ( $VNU_ID ) {
884
+		if ($VNU_ID) {
885 885
 			//clean status
886
-			$venue_status = sanitize_key( $venue_status );
886
+			$venue_status = sanitize_key($venue_status);
887 887
 			// grab status
888
-			if (!empty($venue_status)) {
888
+			if ( ! empty($venue_status)) {
889 889
 				$success = $this->_change_venue_status($VNU_ID, $venue_status);
890 890
 			} else {
891 891
 				$success = FALSE;
@@ -899,7 +899,7 @@  discard block
 block discarded – undo
899 899
 		}
900 900
 		$action = $venue_status == 'trash' ? 'moved to the trash' : 'restored from the trash';
901 901
 
902
-		if ( $redirect_after )
902
+		if ($redirect_after)
903 903
 			$this->_redirect_after_action($success, 'Venue', $action, array('action' => 'default'));
904 904
 
905 905
 	}
@@ -908,11 +908,11 @@  discard block
 block discarded – undo
908 908
 
909 909
 
910 910
 
911
-	protected function _trash_or_restore_venues( $venue_status = 'trash' ) {
911
+	protected function _trash_or_restore_venues($venue_status = 'trash') {
912 912
 		// clean status
913 913
 		$venue_status = sanitize_key($venue_status);
914 914
 		// grab status
915
-		if (!empty($venue_status)) {
915
+		if ( ! empty($venue_status)) {
916 916
 			$success = TRUE;
917 917
 			//determine the event id and set to array.
918 918
 			$VNU_IDs = isset($this->_req_data['venue_id']) ? (array) $this->_req_data['venue_id'] : array();
@@ -952,20 +952,20 @@  discard block
 block discarded – undo
952 952
 	 * @param  string $venue_status
953 953
 	 * @return void
954 954
 	 */
955
-	private function _change_venue_status( $VNU_ID = 0, $venue_status = '' ) {
955
+	private function _change_venue_status($VNU_ID = 0, $venue_status = '') {
956 956
 		// grab venue id
957
-		if (! $VNU_ID) {
957
+		if ( ! $VNU_ID) {
958 958
 			$msg = __('An error occurred. No Venue ID or an invalid Venue ID was received.', 'event_espresso');
959 959
 			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
960 960
 			return FALSE;
961 961
 		}
962 962
 
963
-		$this->_cpt_model_obj = EEM_Venue::instance()->get_one_by_ID( $VNU_ID );
963
+		$this->_cpt_model_obj = EEM_Venue::instance()->get_one_by_ID($VNU_ID);
964 964
 
965 965
 		// clean status
966 966
 		$venue_status = sanitize_key($venue_status);
967 967
 		// grab status
968
-		if ( ! $venue_status ) {
968
+		if ( ! $venue_status) {
969 969
 			$msg = __('An error occurred. No Venue Status or an invalid Venue Status was received.', 'event_espresso');
970 970
 			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
971 971
 			return FALSE;
@@ -986,7 +986,7 @@  discard block
 block discarded – undo
986 986
 				$hook = FALSE;
987 987
 		}
988 988
 		//use class to change status
989
-		$this->_cpt_model_obj->set_status( $venue_status );
989
+		$this->_cpt_model_obj->set_status($venue_status);
990 990
 		$success = $this->_cpt_model_obj->save();
991 991
 
992 992
 		if ($success === FALSE) {
@@ -1005,21 +1005,21 @@  discard block
 block discarded – undo
1005 1005
 	 * @param  bool $redirect_after
1006 1006
 	 * @return void
1007 1007
 	 */
1008
-	protected function _delete_venue( $redirect_after = true ) {
1008
+	protected function _delete_venue($redirect_after = true) {
1009 1009
 		//determine the venue id and set to array.
1010 1010
 		$VNU_ID = isset($this->_req_data['VNU_ID']) ? absint($this->_req_data['VNU_ID']) : NULL;
1011
-		$VNU_ID = isset( $this->_req_data['post'] ) ? absint( $this->_req_data['post'] ) : $VNU_ID;
1011
+		$VNU_ID = isset($this->_req_data['post']) ? absint($this->_req_data['post']) : $VNU_ID;
1012 1012
 
1013 1013
 
1014 1014
 		// loop thru venues
1015 1015
 		if ($VNU_ID) {
1016
-			$success = $this->_delete_or_trash_venue( $VNU_ID );
1016
+			$success = $this->_delete_or_trash_venue($VNU_ID);
1017 1017
 		} else {
1018 1018
 			$success = FALSE;
1019 1019
 			$msg = __('An error occurred. An venue could not be deleted because a valid venue ID was not not supplied.', 'event_espresso');
1020 1020
 			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1021 1021
 		}
1022
-		if ( $redirect_after )
1022
+		if ($redirect_after)
1023 1023
 			$this->_redirect_after_action($success, 'Venue', 'deleted', array('action' => 'default'));
1024 1024
 	}
1025 1025
 
@@ -1051,7 +1051,7 @@  discard block
 block discarded – undo
1051 1051
 	//todo: put in parent
1052 1052
 	private function _delete_or_trash_venue($VNU_ID = FALSE) {
1053 1053
 		// grab event id
1054
-		if (!$VNU_ID = absint($VNU_ID)) {
1054
+		if ( ! $VNU_ID = absint($VNU_ID)) {
1055 1055
 			$msg = __('An error occurred. No Venue ID or an invalid Venue ID was received.', 'event_espresso');
1056 1056
 			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1057 1057
 			return FALSE;
@@ -1071,7 +1071,7 @@  discard block
 block discarded – undo
1071 1071
 			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1072 1072
 			return FALSE;
1073 1073
 		}
1074
-		do_action( 'AHEE__Venues_Admin_Page___delete_or_trash_venue__after_venue_deleted' );
1074
+		do_action('AHEE__Venues_Admin_Page___delete_or_trash_venue__after_venue_deleted');
1075 1075
 		return TRUE;
1076 1076
 	}
1077 1077
 
@@ -1082,11 +1082,11 @@  discard block
 block discarded – undo
1082 1082
 	/* QUERIES */
1083 1083
 
1084 1084
 
1085
-	public function get_venues( $per_page = 10, $count = FALSE ) {
1085
+	public function get_venues($per_page = 10, $count = FALSE) {
1086 1086
 
1087
-		$_orderby = !empty( $this->_req_data['orderby'] ) ? $this->_req_data['orderby'] : '';
1087
+		$_orderby = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : '';
1088 1088
 
1089
-		switch ( $_orderby ) {
1089
+		switch ($_orderby) {
1090 1090
 			case 'id':
1091 1091
 				$orderby = 'VNU_ID';
1092 1092
 				break;
@@ -1104,43 +1104,43 @@  discard block
 block discarded – undo
1104 1104
 		}
1105 1105
 
1106 1106
 
1107
-		$sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'ASC';
1107
+		$sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'ASC';
1108 1108
 
1109
-		$current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1;
1110
-		$per_page = isset( $per_page ) && !empty( $per_page ) ? $per_page : 10;
1111
-		$per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page;
1109
+		$current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1;
1110
+		$per_page = isset($per_page) && ! empty($per_page) ? $per_page : 10;
1111
+		$per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page;
1112 1112
 
1113 1113
 
1114
-		$offset = ($current_page-1)*$per_page;
1114
+		$offset = ($current_page - 1) * $per_page;
1115 1115
 		$limit = array($offset, $per_page);
1116 1116
 
1117
-		$category = isset( $this->_req_data['category'] ) && $this->_req_data['category'] > 0 ? $this->_req_data['category'] : NULL;
1117
+		$category = isset($this->_req_data['category']) && $this->_req_data['category'] > 0 ? $this->_req_data['category'] : NULL;
1118 1118
 		$where = array();
1119 1119
 
1120 1120
 		//only set initial status if it is in the incoming request.  Otherwise the "all" view display's all statuses.
1121
-		if ( isset( $this->_req_data['status'] ) && $this->_req_data['status'] != 'all' ) {
1121
+		if (isset($this->_req_data['status']) && $this->_req_data['status'] != 'all') {
1122 1122
 			$where['status'] = $this->_req_data['status'];
1123 1123
 		}
1124 1124
 
1125
-		if ( isset( $this->_req_data['venue_status'] ) ) {
1125
+		if (isset($this->_req_data['venue_status'])) {
1126 1126
 			$where['status'] = $this->_req_data['venue_status'];
1127 1127
 		}
1128 1128
 
1129 1129
 
1130
-		if ( $category ) {
1130
+		if ($category) {
1131 1131
 			$where['Term_Taxonomy.taxonomy'] = 'espresso_venue_categories';
1132 1132
 			$where['Term_Taxonomy.term_id'] = $category;
1133 1133
 		}
1134 1134
 
1135 1135
 
1136
-		if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_venues', 'get_venues' ) ) {
1137
-			$where['VNU_wp_user'] =  get_current_user_id();
1136
+		if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_venues', 'get_venues')) {
1137
+			$where['VNU_wp_user'] = get_current_user_id();
1138 1138
 		} else {
1139
-				if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_private_venues', 'get_venues' ) ) {
1139
+				if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_private_venues', 'get_venues')) {
1140 1140
 					$where['OR'] = array(
1141
-						'status*restrict_private' => array( '!=', 'private' ),
1141
+						'status*restrict_private' => array('!=', 'private'),
1142 1142
 						'AND'                     => array(
1143
-							'status*inclusive' => array( '=', 'private' ),
1143
+							'status*inclusive' => array('=', 'private'),
1144 1144
 							'VNU_wp_user'      => get_current_user_id()
1145 1145
 						)
1146 1146
 					);
@@ -1150,30 +1150,30 @@  discard block
 block discarded – undo
1150 1150
 
1151 1151
 
1152 1152
 
1153
-		if ( isset( $this->_req_data['s'] ) ) {
1154
-			$sstr = '%' . $this->_req_data['s'] . '%';
1153
+		if (isset($this->_req_data['s'])) {
1154
+			$sstr = '%'.$this->_req_data['s'].'%';
1155 1155
 			$where['OR'] = array(
1156
-				'VNU_name' => array('LIKE',$sstr ),
1157
-				'VNU_desc' => array('LIKE',$sstr ),
1158
-				'VNU_short_desc' => array( 'LIKE',$sstr ),
1159
-				'VNU_address' => array( 'LIKE', $sstr ),
1160
-				'VNU_address2' => array( 'LIKE', $sstr ),
1161
-				'VNU_city' => array( 'LIKE', $sstr ),
1162
-				'VNU_zip' => array( 'LIKE', $sstr ),
1163
-				'VNU_phone' => array( 'LIKE', $sstr ),
1164
-				'VNU_url' => array( 'LIKE', $sstr ),
1165
-				'VNU_virtual_phone' => array( 'LIKE', $sstr ),
1166
-				'VNU_virtual_url' => array( 'LIKE', $sstr ),
1167
-				'VNU_google_map_link' => array( 'LIKE', $sstr ),
1168
-				'Event.EVT_name' => array('LIKE', $sstr ),
1169
-				'Event.EVT_desc' => array('LIKE', $sstr ),
1170
-				'Event.EVT_phone' => array('LIKE', $sstr ),
1171
-				'Event.EVT_external_URL' => array('LIKE', $sstr ),
1156
+				'VNU_name' => array('LIKE', $sstr),
1157
+				'VNU_desc' => array('LIKE', $sstr),
1158
+				'VNU_short_desc' => array('LIKE', $sstr),
1159
+				'VNU_address' => array('LIKE', $sstr),
1160
+				'VNU_address2' => array('LIKE', $sstr),
1161
+				'VNU_city' => array('LIKE', $sstr),
1162
+				'VNU_zip' => array('LIKE', $sstr),
1163
+				'VNU_phone' => array('LIKE', $sstr),
1164
+				'VNU_url' => array('LIKE', $sstr),
1165
+				'VNU_virtual_phone' => array('LIKE', $sstr),
1166
+				'VNU_virtual_url' => array('LIKE', $sstr),
1167
+				'VNU_google_map_link' => array('LIKE', $sstr),
1168
+				'Event.EVT_name' => array('LIKE', $sstr),
1169
+				'Event.EVT_desc' => array('LIKE', $sstr),
1170
+				'Event.EVT_phone' => array('LIKE', $sstr),
1171
+				'Event.EVT_external_URL' => array('LIKE', $sstr),
1172 1172
 				);
1173 1173
 		}
1174 1174
 
1175 1175
 
1176
-		$venues = $count ? $this->_venue_model->count( array($where), 'VNU_ID' ) : $this->_venue_model->get_all( array( $where, 'limit' => $limit, 'order_by' => $orderby, 'order' => $sort ) );
1176
+		$venues = $count ? $this->_venue_model->count(array($where), 'VNU_ID') : $this->_venue_model->get_all(array($where, 'limit' => $limit, 'order_by' => $orderby, 'order' => $sort));
1177 1177
 
1178 1178
 		return $venues;
1179 1179
 
@@ -1191,22 +1191,22 @@  discard block
 block discarded – undo
1191 1191
 	 * @return void
1192 1192
 	 */
1193 1193
 	private function _set_category_object() {
1194
-		if ( isset( $this->_category->id ) && !empty( $this->_category->id ) )
1194
+		if (isset($this->_category->id) && ! empty($this->_category->id))
1195 1195
 			return; //already have the category object so get out.
1196 1196
 
1197 1197
 		//set default category object
1198 1198
 		$this->_set_empty_category_object();
1199 1199
 
1200 1200
 		//only set if we've got an id
1201
-		if ( !isset($this->_req_data['VEN_CAT_ID'] ) ) {
1201
+		if ( ! isset($this->_req_data['VEN_CAT_ID'])) {
1202 1202
 			return;
1203 1203
 		}
1204 1204
 
1205 1205
 		$category_id = absint($this->_req_data['VEN_CAT_ID']);
1206
-		$term = get_term( $category_id, 'espresso_venue_categories' );
1206
+		$term = get_term($category_id, 'espresso_venue_categories');
1207 1207
 
1208 1208
 
1209
-		if ( !empty( $term ) ) {
1209
+		if ( ! empty($term)) {
1210 1210
 			$this->_category->category_name = $term->name;
1211 1211
 			$this->_category->category_identifier = $term->slug;
1212 1212
 			$this->_category->category_desc = $term->description;
@@ -1220,14 +1220,14 @@  discard block
 block discarded – undo
1220 1220
 
1221 1221
 	private function _set_empty_category_object() {
1222 1222
 		$this->_category = new stdClass();
1223
-		$this->_category->category_name = $this->_category->category_identifier = $this->_category->category_desc  = '';
1223
+		$this->_category->category_name = $this->_category->category_identifier = $this->_category->category_desc = '';
1224 1224
 		$this->_category->id = $this->_category->parent = 0;
1225 1225
 	}
1226 1226
 
1227 1227
 
1228 1228
 
1229 1229
 	protected function _category_list_table() {
1230
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
1230
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1231 1231
 		$this->_admin_page_title .= $this->get_action_link_or_button('add_category', 'add_category', array(), 'add-new-h2');
1232 1232
 		$this->_search_btn_label = __('Venue Categories', 'event_espresso');
1233 1233
 		$this->display_admin_list_table_page_with_sidebar();
@@ -1237,21 +1237,21 @@  discard block
 block discarded – undo
1237 1237
 	protected function _category_details($view) {
1238 1238
 
1239 1239
 		//load formatter helper
1240
-		EE_Registry::instance()->load_helper( 'Formatter' );
1240
+		EE_Registry::instance()->load_helper('Formatter');
1241 1241
 		//load field generator helper
1242
-		EE_Registry::instance()->load_helper( 'Form_Fields' );
1242
+		EE_Registry::instance()->load_helper('Form_Fields');
1243 1243
 
1244 1244
 		$route = $view == 'edit' ? 'update_category' : 'insert_category';
1245 1245
 		$this->_set_add_edit_form_tags($route);
1246 1246
 
1247 1247
 		$this->_set_category_object();
1248
-		$id = !empty($this->_category->id) ? $this->_category->id : '';
1248
+		$id = ! empty($this->_category->id) ? $this->_category->id : '';
1249 1249
 
1250 1250
 		$delete_action = 'delete_category';
1251 1251
 
1252
-		$redirect = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'category_list' ), $this->_admin_base_url );
1252
+		$redirect = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'category_list'), $this->_admin_base_url);
1253 1253
 
1254
-		$this->_set_publish_post_box_vars( 'VEN_CAT_ID', $id, $delete_action, $redirect );
1254
+		$this->_set_publish_post_box_vars('VEN_CAT_ID', $id, $delete_action, $redirect);
1255 1255
 
1256 1256
 		//take care of contents
1257 1257
 		$this->_template_args['admin_page_content'] = $this->_category_details_content();
@@ -1265,25 +1265,25 @@  discard block
 block discarded – undo
1265 1265
 			'type' => 'wp_editor',
1266 1266
 			'value' => EEH_Formatter::admin_format_content($this->_category->category_desc),
1267 1267
 			'class' => 'my_editor_custom',
1268
-			'wpeditor_args' => array( 'media_buttons' => FALSE )
1268
+			'wpeditor_args' => array('media_buttons' => FALSE)
1269 1269
 		);
1270
-		$_wp_editor = $this->_generate_admin_form_fields( $editor_args, 'array' );
1270
+		$_wp_editor = $this->_generate_admin_form_fields($editor_args, 'array');
1271 1271
 
1272
-		$all_terms = get_terms( array('espresso_venue_categories' ), array( 'hide_empty' => 0, 'exclude' => array( $this->_category->id ) ) );
1272
+		$all_terms = get_terms(array('espresso_venue_categories'), array('hide_empty' => 0, 'exclude' => array($this->_category->id)));
1273 1273
 
1274 1274
 		//setup category select for term parents.
1275 1275
 		$category_select_values[] = array(
1276 1276
 			'text' => __('No Parent', 'event_espresso'),
1277 1277
 			'id' => 0
1278 1278
 			);
1279
-		foreach ( $all_terms as $term ) {
1279
+		foreach ($all_terms as $term) {
1280 1280
 			$category_select_values[] = array(
1281 1281
 				'text' => $term->name,
1282 1282
 				'id' => $term->term_id
1283 1283
 				);
1284 1284
 		}
1285 1285
 
1286
-		$category_select = EEH_Form_Fields::select_input( 'category_parent', $category_select_values, $this->_category->parent );
1286
+		$category_select = EEH_Form_Fields::select_input('category_parent', $category_select_values, $this->_category->parent);
1287 1287
 		$template_args = array(
1288 1288
 			'category' => $this->_category,
1289 1289
 			'category_select' => $category_select,
@@ -1292,15 +1292,15 @@  discard block
 block discarded – undo
1292 1292
 			'disable' => '',
1293 1293
 			'disabled_message' =>FALSE
1294 1294
 			);
1295
-		$template = EVENTS_TEMPLATE_PATH . 'event_category_details.template.php';
1296
-		return EEH_Template::display_template($template, $template_args, TRUE );
1295
+		$template = EVENTS_TEMPLATE_PATH.'event_category_details.template.php';
1296
+		return EEH_Template::display_template($template, $template_args, TRUE);
1297 1297
 	}
1298 1298
 
1299 1299
 
1300 1300
 	protected function _delete_categories() {
1301
-		$cat_ids = isset( $this->_req_data['VEN_CAT_ID'] ) ? (array) $this->_req_data['VEN_CAT_ID'] : (array) $this->_req_data['category_id'];
1301
+		$cat_ids = isset($this->_req_data['VEN_CAT_ID']) ? (array) $this->_req_data['VEN_CAT_ID'] : (array) $this->_req_data['category_id'];
1302 1302
 
1303
-		foreach ( $cat_ids as $cat_id ) {
1303
+		foreach ($cat_ids as $cat_id) {
1304 1304
 			$this->_delete_category($cat_id);
1305 1305
 		}
1306 1306
 
@@ -1308,7 +1308,7 @@  discard block
 block discarded – undo
1308 1308
 		$query_args = array(
1309 1309
 			'action' => 'category_list'
1310 1310
 			);
1311
-		$this->_redirect_after_action(0,'','',$query_args);
1311
+		$this->_redirect_after_action(0, '', '', $query_args);
1312 1312
 
1313 1313
 	}
1314 1314
 
@@ -1317,58 +1317,58 @@  discard block
 block discarded – undo
1317 1317
 
1318 1318
 
1319 1319
 	protected function _delete_category($cat_id) {
1320
-		$cat_id = absint( $cat_id );
1321
-		wp_delete_term( $cat_id, 'espresso_venue_categories' );
1320
+		$cat_id = absint($cat_id);
1321
+		wp_delete_term($cat_id, 'espresso_venue_categories');
1322 1322
 	}
1323 1323
 
1324 1324
 
1325 1325
 
1326 1326
 	protected function _insert_or_update_category($new_category) {
1327 1327
 
1328
-		$cat_id = $new_category ? $this->_insert_category() : $this->_insert_category( TRUE );
1328
+		$cat_id = $new_category ? $this->_insert_category() : $this->_insert_category(TRUE);
1329 1329
 		$success = 0; //we already have a success message so lets not send another.
1330
-		if ( $cat_id ) {
1330
+		if ($cat_id) {
1331 1331
 			$query_args = array(
1332 1332
 				'action'     => 'edit_category',
1333 1333
 				'VEN_CAT_ID' => $cat_id
1334 1334
 			);
1335 1335
 		} else {
1336
-			$query_args = array( 'action' => 'add_category' );
1336
+			$query_args = array('action' => 'add_category');
1337 1337
 		}
1338
-		$this->_redirect_after_action( $success, '','', $query_args, TRUE );
1338
+		$this->_redirect_after_action($success, '', '', $query_args, TRUE);
1339 1339
 
1340 1340
 	}
1341 1341
 
1342 1342
 
1343 1343
 
1344
-	private function _insert_category( $update = FALSE ) {
1344
+	private function _insert_category($update = FALSE) {
1345 1345
 		$cat_id = $update ? $this->_req_data['VEN_CAT_ID'] : '';
1346
-		$category_name= isset( $this->_req_data['category_name'] ) ? $this->_req_data['category_name'] : '';
1347
-		$category_desc= isset( $this->_req_data['category_desc'] ) ? $this->_req_data['category_desc'] : '';
1348
-		$category_parent = isset( $this->_req_data['category_parent'] ) ? $this->_req_data['category_parent'] : 0;
1346
+		$category_name = isset($this->_req_data['category_name']) ? $this->_req_data['category_name'] : '';
1347
+		$category_desc = isset($this->_req_data['category_desc']) ? $this->_req_data['category_desc'] : '';
1348
+		$category_parent = isset($this->_req_data['category_parent']) ? $this->_req_data['category_parent'] : 0;
1349 1349
 
1350
-		if ( empty( $category_name ) ) {
1351
-			$msg = __( 'You must add a name for the category.', 'event_espresso' );
1352
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
1350
+		if (empty($category_name)) {
1351
+			$msg = __('You must add a name for the category.', 'event_espresso');
1352
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1353 1353
 			return false;
1354 1354
 		}
1355 1355
 
1356 1356
 
1357
-		$term_args=array(
1357
+		$term_args = array(
1358 1358
 			'name'=>$category_name,
1359 1359
 			'description'=>$category_desc,
1360 1360
 			'parent'=>$category_parent
1361 1361
 		);
1362 1362
 
1363
-		$insert_ids = $update ? wp_update_term( $cat_id, 'espresso_venue_categories', $term_args ) :wp_insert_term( $category_name, 'espresso_venue_categories', $term_args );
1363
+		$insert_ids = $update ? wp_update_term($cat_id, 'espresso_venue_categories', $term_args) : wp_insert_term($category_name, 'espresso_venue_categories', $term_args);
1364 1364
 
1365
-		if ( !is_array( $insert_ids ) ) {
1366
-			$msg = __( 'An error occurred and the category has not been saved to the database.', 'event_espresso' );
1367
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
1365
+		if ( ! is_array($insert_ids)) {
1366
+			$msg = __('An error occurred and the category has not been saved to the database.', 'event_espresso');
1367
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1368 1368
 		} else {
1369 1369
 			$cat_id = $insert_ids['term_id'];
1370
-			$msg = sprintf ( __('The category %s was successfuly created', 'event_espresso'), $category_name );
1371
-			EE_Error::add_success( $msg );
1370
+			$msg = sprintf(__('The category %s was successfuly created', 'event_espresso'), $category_name);
1371
+			EE_Error::add_success($msg);
1372 1372
 		}
1373 1373
 
1374 1374
 		return $cat_id;
@@ -1388,12 +1388,12 @@  discard block
 block discarded – undo
1388 1388
 			'category_ids' => $this->_req_data['VEN_CAT_ID']
1389 1389
 			);
1390 1390
 
1391
-		$this->_req_data = array_merge( $this->_req_data, $new_request_args );
1391
+		$this->_req_data = array_merge($this->_req_data, $new_request_args);
1392 1392
 
1393
-		EE_Registry::instance()->load_helper( 'File' );
1394
-		if ( is_readable( EE_CLASSES . 'EE_Export.class.php') ) {
1395
-			require_once( EE_CLASSES . 'EE_Export.class.php');
1396
-			$EE_Export = EE_Export::instance( $this->_req_data );
1393
+		EE_Registry::instance()->load_helper('File');
1394
+		if (is_readable(EE_CLASSES.'EE_Export.class.php')) {
1395
+			require_once(EE_CLASSES.'EE_Export.class.php');
1396
+			$EE_Export = EE_Export::instance($this->_req_data);
1397 1397
 			$EE_Export->export();
1398 1398
 		}
1399 1399
 
@@ -1405,7 +1405,7 @@  discard block
 block discarded – undo
1405 1405
 
1406 1406
 	protected function _import_categories() {
1407 1407
 
1408
-		require_once(EE_CLASSES . 'EE_Import.class.php');
1408
+		require_once(EE_CLASSES.'EE_Import.class.php');
1409 1409
 		EE_Import::instance()->import();
1410 1410
 
1411 1411
 	}
@@ -1413,29 +1413,29 @@  discard block
 block discarded – undo
1413 1413
 
1414 1414
 
1415 1415
 
1416
-	public function get_categories( $per_page = 10, $current_page = 1, $count = FALSE ) {
1416
+	public function get_categories($per_page = 10, $current_page = 1, $count = FALSE) {
1417 1417
 
1418 1418
 		//testing term stuff
1419
-		$orderby = isset( $this->_req_data['orderby'] ) ? $this->_req_data['orderby'] : 'Term.term_id';
1420
-		$order = isset( $this->_req_data['order'] ) ? $this->_req_data['order'] : 'DESC';
1421
-		$limit = ($current_page-1)*$per_page;
1422
-		$where = array( 'taxonomy' => 'espresso_venue_categories' );
1423
-		if ( isset( $this->_req_data['s'] ) ) {
1424
-			$sstr = '%' . $this->_req_data['s'] . '%';
1419
+		$orderby = isset($this->_req_data['orderby']) ? $this->_req_data['orderby'] : 'Term.term_id';
1420
+		$order = isset($this->_req_data['order']) ? $this->_req_data['order'] : 'DESC';
1421
+		$limit = ($current_page - 1) * $per_page;
1422
+		$where = array('taxonomy' => 'espresso_venue_categories');
1423
+		if (isset($this->_req_data['s'])) {
1424
+			$sstr = '%'.$this->_req_data['s'].'%';
1425 1425
 			$where['OR'] = array(
1426
-				'Term.name' => array( 'LIKE', $sstr),
1427
-				'description' => array( 'LIKE', $sstr )
1426
+				'Term.name' => array('LIKE', $sstr),
1427
+				'description' => array('LIKE', $sstr)
1428 1428
 				);
1429 1429
 		}
1430 1430
 
1431 1431
 		$query_params = array(
1432 1432
 			$where,
1433
-			'order_by' => array( $orderby => $order ),
1434
-			'limit' => $limit . ',' . $per_page,
1433
+			'order_by' => array($orderby => $order),
1434
+			'limit' => $limit.','.$per_page,
1435 1435
 			'force_join' => array('Term')
1436 1436
 			);
1437 1437
 
1438
-		$categories = $count ? EEM_Term_Taxonomy::instance()->count( $query_params, 'term_id' ) :EEM_Term_Taxonomy::instance()->get_all( $query_params );
1438
+		$categories = $count ? EEM_Term_Taxonomy::instance()->count($query_params, 'term_id') : EEM_Term_Taxonomy::instance()->get_all($query_params);
1439 1439
 
1440 1440
 		return $categories;
1441 1441
 	}
Please login to merge, or discard this patch.
caffeinated/admin/new/pricing/espresso_events_Pricing_Hooks.class.php 1 patch
Spacing   +374 added lines, -374 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,23 +54,23 @@  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
 
61
-		EE_Registry::instance()->load_helper( 'DTT_Helper' );
61
+		EE_Registry::instance()->load_helper('DTT_Helper');
62 62
 
63 63
 		//if we were going to add our own metaboxes we'd use the below.
64 64
 		$this->_metaboxes = array(
65 65
 			0 => array(
66
-				'page_route' => array('edit','create_new'),
66
+				'page_route' => array('edit', 'create_new'),
67 67
 				'func' => 'pricing_metabox',
68 68
 				'label' => __('Event Tickets & Datetimes', 'event_espresso'),
69 69
 				'priority' => 'high',
70 70
 				'context' => 'normal'
71 71
 				),
72 72
 
73
-			);/**/
73
+			); /**/
74 74
 
75 75
 		$this->_remove_metaboxes = array(
76 76
 			0 => array(
@@ -89,24 +89,24 @@  discard block
 block discarded – undo
89 89
 		 *
90 90
 		 * @var array  Expected an array returned with 'date' and 'time' keys.
91 91
 		 */
92
-		$this->_date_format_strings = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___set_hooks_properties__date_format_strings', array(
92
+		$this->_date_format_strings = apply_filters('FHEE__espresso_events_Pricing_Hooks___set_hooks_properties__date_format_strings', array(
93 93
 				'date' => 'Y-m-d',
94 94
 				'time' => 'h:i a'
95 95
 			));
96 96
 
97 97
 		//validate
98
-		$this->_date_format_strings['date'] = isset( $this->_date_format_strings['date'] ) ? $this->_date_format_strings['date'] : null;
99
-		$this->_date_format_strings['time'] = isset( $this->_date_format_strings['time'] ) ? $this->_date_format_strings['time'] : null;
98
+		$this->_date_format_strings['date'] = isset($this->_date_format_strings['date']) ? $this->_date_format_strings['date'] : null;
99
+		$this->_date_format_strings['time'] = isset($this->_date_format_strings['time']) ? $this->_date_format_strings['time'] : null;
100 100
 
101 101
 		//validate format strings
102
-		$format_validation = EEH_DTT_Helper::validate_format_string( $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] );
103
-		if ( is_array( $format_validation ) ) {
104
-			$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>';
105
-			foreach ( $format_validation as $error ) {
106
-				$msg .= '<li>' . $error . '</li>';
102
+		$format_validation = EEH_DTT_Helper::validate_format_string($this->_date_format_strings['date'].' '.$this->_date_format_strings['time']);
103
+		if (is_array($format_validation)) {
104
+			$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>';
105
+			foreach ($format_validation as $error) {
106
+				$msg .= '<li>'.$error.'</li>';
107 107
 			}
108
-			$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>';
109
-			EE_Error::add_attention( $msg, __FILE__, __FUNCTION__, __LINE__ );
108
+			$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>';
109
+			EE_Error::add_attention($msg, __FILE__, __FUNCTION__, __LINE__);
110 110
 			$this->_date_format_strings = array(
111 111
 				'date' => 'Y-m-d',
112 112
 				'time' => 'h:i a'
@@ -117,60 +117,60 @@  discard block
 block discarded – undo
117 117
 		$this->_scripts_styles = array(
118 118
 			'registers' => array(
119 119
 				'ee-tickets-datetimes-css' => array(
120
-					'url' => PRICING_ASSETS_URL . 'event-tickets-datetimes.css',
120
+					'url' => PRICING_ASSETS_URL.'event-tickets-datetimes.css',
121 121
 					'type' => 'css'
122 122
 					),
123 123
 				'ee-dtt-ticket-metabox' => array(
124
-					'url' => PRICING_ASSETS_URL . 'ee-datetime-ticket-metabox.js',
124
+					'url' => PRICING_ASSETS_URL.'ee-datetime-ticket-metabox.js',
125 125
 					'depends' => array('ee-datepicker', 'ee-dialog', 'underscore')
126 126
 					)
127 127
 				),
128 128
 			'deregisters' => array(
129
-				'event-editor-css' => array('type' => 'css' ),
129
+				'event-editor-css' => array('type' => 'css'),
130 130
 				'event-datetime-metabox' => array('type' => 'js')
131 131
 				),
132 132
 			'enqueues' => array(
133
-				'ee-tickets-datetimes-css' => array( 'edit', 'create_new' ),
134
-				'ee-dtt-ticket-metabox' => array( 'edit', 'create_new' )
133
+				'ee-tickets-datetimes-css' => array('edit', 'create_new'),
134
+				'ee-dtt-ticket-metabox' => array('edit', 'create_new')
135 135
 				),
136 136
 			'localize' => array(
137 137
 				'ee-dtt-ticket-metabox' => array(
138 138
 					'DTT_TRASH_BLOCK' => array(
139 139
 						'main_warning' => __('The Datetime you are attempting to trash is the only datetime selected for the following ticket(s):', 'event_espresso'),
140 140
 						'after_warning' => __('In order to trash this datetime you must first make sure the above ticket(s) are assigned to other datetimes.', 'event_espresso'),
141
-						'cancel_button' => '<button class="button-secondary ee-modal-cancel">' . __('Cancel', 'event_espresso') . '</button>',
141
+						'cancel_button' => '<button class="button-secondary ee-modal-cancel">'.__('Cancel', 'event_espresso').'</button>',
142 142
 						'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'),
143 143
 						'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'),
144
-						'dismiss_button' => '<button class="button-secondary ee-modal-cancel">' . __('Dismiss', 'event_espresso') . '</button>'
144
+						'dismiss_button' => '<button class="button-secondary ee-modal-cancel">'.__('Dismiss', 'event_espresso').'</button>'
145 145
 						),
146 146
 					'DTT_ERROR_MSG' => array(
147 147
 						'no_ticket_name' => __('General Admission', 'event_espresso'),
148
-						'dismiss_button' => '<div class="save-cancel-button-container"><button class="button-secondary ee-modal-cancel">' . __('Dismiss', 'event_espresso') . '</button></div>'
148
+						'dismiss_button' => '<div class="save-cancel-button-container"><button class="button-secondary ee-modal-cancel">'.__('Dismiss', 'event_espresso').'</button></div>'
149 149
 						),
150 150
 					'DTT_OVERSELL_WARNING' => array(
151 151
 						'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'),
152 152
 						'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')
153 153
 						),
154
-					'DTT_CONVERTED_FORMATS' => EEH_DTT_Helper::convert_php_to_js_and_moment_date_formats( $this->_date_format_strings['date'], $this->_date_format_strings['time'] ),
155
-					'DTT_START_OF_WEEK' => array( 'dayValue' => (int) get_option( 'start_of_week' ) )
154
+					'DTT_CONVERTED_FORMATS' => EEH_DTT_Helper::convert_php_to_js_and_moment_date_formats($this->_date_format_strings['date'], $this->_date_format_strings['time']),
155
+					'DTT_START_OF_WEEK' => array('dayValue' => (int) get_option('start_of_week'))
156 156
 					)
157 157
 				)
158 158
 			);
159 159
 
160 160
 
161
-		add_action('AHEE__EE_Admin_Page_CPT__do_extra_autosave_stuff__after_Extend_Events_Admin_Page', array( $this, 'autosave_handling' ), 10 );
162
-		add_filter('FHEE__Events_Admin_Page___insert_update_cpt_item__event_update_callbacks', array( $this, 'caf_updates' ), 10 );
161
+		add_action('AHEE__EE_Admin_Page_CPT__do_extra_autosave_stuff__after_Extend_Events_Admin_Page', array($this, 'autosave_handling'), 10);
162
+		add_filter('FHEE__Events_Admin_Page___insert_update_cpt_item__event_update_callbacks', array($this, 'caf_updates'), 10);
163 163
 	}
164 164
 
165 165
 
166 166
 
167
-	public function caf_updates( $update_callbacks ) {
168
-		foreach ( $update_callbacks as $key => $callback ) {
169
-			if ( $callback[1] == '_default_tickets_update' )
170
-				unset( $update_callbacks[$key] );
167
+	public function caf_updates($update_callbacks) {
168
+		foreach ($update_callbacks as $key => $callback) {
169
+			if ($callback[1] == '_default_tickets_update')
170
+				unset($update_callbacks[$key]);
171 171
 		}
172 172
 
173
-		$update_callbacks[] = array( $this, 'dtt_and_tickets_caf_update' );
173
+		$update_callbacks[] = array($this, 'dtt_and_tickets_caf_update');
174 174
 		return $update_callbacks;
175 175
 	}
176 176
 
@@ -183,11 +183,11 @@  discard block
 block discarded – undo
183 183
 	 * @param  array    $data   The request data from the form
184 184
 	 * @return bool             success or fail
185 185
 	 */
186
-	public function dtt_and_tickets_caf_update( $evtobj, $data ) {
186
+	public function dtt_and_tickets_caf_update($evtobj, $data) {
187 187
 		//first we need to start with datetimes cause they are the "root" items attached to events.
188
-		$saved_dtts = $this->_update_dtts( $evtobj, $data );
188
+		$saved_dtts = $this->_update_dtts($evtobj, $data);
189 189
 		//next tackle the tickets (and prices?)
190
-		$this->_update_tkts( $evtobj, $saved_dtts, $data );
190
+		$this->_update_tkts($evtobj, $saved_dtts, $data);
191 191
 	}
192 192
 
193 193
 
@@ -198,36 +198,36 @@  discard block
 block discarded – undo
198 198
 	 * @param  array    	$data    the request data from the form
199 199
 	 * @return EE_Datetime[]
200 200
 	 */
201
-	protected function _update_dtts( $evt_obj, $data ) {
202
-		$timezone = isset( $data['timezone_string'] ) ? $data['timezone_string'] : NULL;
201
+	protected function _update_dtts($evt_obj, $data) {
202
+		$timezone = isset($data['timezone_string']) ? $data['timezone_string'] : NULL;
203 203
 		$saved_dtt_ids = array();
204 204
 		$saved_dtt_objs = array();
205 205
 
206
-		foreach ( $data['edit_event_datetimes'] as $row => $dtt ) {
206
+		foreach ($data['edit_event_datetimes'] as $row => $dtt) {
207 207
 			//trim all values to ensure any excess whitespace is removed.
208
-			$dtt =  array_map( 'trim', $dtt );
209
-			$dtt['DTT_EVT_end'] = isset($dtt['DTT_EVT_end']) && ! empty( $dtt['DTT_EVT_end'] ) ? $dtt['DTT_EVT_end'] : $dtt['DTT_EVT_start'];
208
+			$dtt = array_map('trim', $dtt);
209
+			$dtt['DTT_EVT_end'] = isset($dtt['DTT_EVT_end']) && ! empty($dtt['DTT_EVT_end']) ? $dtt['DTT_EVT_end'] : $dtt['DTT_EVT_start'];
210 210
 			$datetime_values = array(
211
-				'DTT_ID' 			=> ! empty( $dtt['DTT_ID'] ) ? $dtt['DTT_ID'] : NULL,
212
-				'DTT_name' 			=> ! empty( $dtt['DTT_name'] ) ? $dtt['DTT_name'] : '',
213
-				'DTT_description' 	=> ! empty( $dtt['DTT_description'] ) ? $dtt['DTT_description'] : '',
211
+				'DTT_ID' 			=> ! empty($dtt['DTT_ID']) ? $dtt['DTT_ID'] : NULL,
212
+				'DTT_name' 			=> ! empty($dtt['DTT_name']) ? $dtt['DTT_name'] : '',
213
+				'DTT_description' 	=> ! empty($dtt['DTT_description']) ? $dtt['DTT_description'] : '',
214 214
 				'DTT_EVT_start' 	=> $dtt['DTT_EVT_start'],
215 215
 				'DTT_EVT_end' 		=> $dtt['DTT_EVT_end'],
216
-				'DTT_reg_limit' 	=> empty( $dtt['DTT_reg_limit'] ) ? EE_INF : $dtt[ 'DTT_reg_limit' ],
217
-				'DTT_order' 		=> ! isset( $dtt['DTT_order'] ) ? $row : $dtt['DTT_order'],
216
+				'DTT_reg_limit' 	=> empty($dtt['DTT_reg_limit']) ? EE_INF : $dtt['DTT_reg_limit'],
217
+				'DTT_order' 		=> ! isset($dtt['DTT_order']) ? $row : $dtt['DTT_order'],
218 218
 			);
219 219
 
220 220
 			//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.
221 221
 
222
-			if ( !empty( $dtt['DTT_ID'] ) ) {
223
-				$DTM = EE_Registry::instance()->load_model('Datetime', array($timezone) )->get_one_by_ID($dtt['DTT_ID'] );
222
+			if ( ! empty($dtt['DTT_ID'])) {
223
+				$DTM = EE_Registry::instance()->load_model('Datetime', array($timezone))->get_one_by_ID($dtt['DTT_ID']);
224 224
 
225 225
 				//set date and time format according to what is set in this class.
226
-				$DTM->set_date_format( $this->_date_format_strings['date'] );
227
-				$DTM->set_time_format( $this->_date_format_strings['time'] );
226
+				$DTM->set_date_format($this->_date_format_strings['date']);
227
+				$DTM->set_time_format($this->_date_format_strings['time']);
228 228
 
229
-				foreach ( $datetime_values as $field => $value ) {
230
-					$DTM->set( $field, $value );
229
+				foreach ($datetime_values as $field => $value) {
230
+					$DTM->set($field, $value);
231 231
 				}
232 232
 
233 233
 				// make sure the $dtt_id here is saved just in case after the add_relation_to() the autosave replaces it.
@@ -235,24 +235,24 @@  discard block
 block discarded – undo
235 235
 				$saved_dtt_ids[$DTM->ID()] = $DTM->ID();
236 236
 
237 237
 			} else {
238
-				$DTM = EE_Registry::instance()->load_class('Datetime', array( $datetime_values, $timezone ), FALSE, FALSE );
238
+				$DTM = EE_Registry::instance()->load_class('Datetime', array($datetime_values, $timezone), FALSE, FALSE);
239 239
 
240 240
 				//reset date and times to match the format
241
-				$DTM->set_date_format( $this->_date_format_strings['date'] );
242
-				$DTM->set_time_format( $this->_date_format_strings['time'] );
243
-				foreach( $datetime_values as $field => $value ) {
244
-					$DTM->set( $field, $value );
241
+				$DTM->set_date_format($this->_date_format_strings['date']);
242
+				$DTM->set_time_format($this->_date_format_strings['time']);
243
+				foreach ($datetime_values as $field => $value) {
244
+					$DTM->set($field, $value);
245 245
 				}
246 246
 			}
247 247
 
248 248
 
249 249
 			$DTM->save();
250
-			$DTM = $evt_obj->_add_relation_to( $DTM, 'Datetime' );
250
+			$DTM = $evt_obj->_add_relation_to($DTM, 'Datetime');
251 251
 			$evt_obj->save();
252 252
 
253 253
 			//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.
254
-			if( $DTM->get_raw('DTT_EVT_start') > $DTM->get_raw('DTT_EVT_end') ) {
255
-				$DTM->set('DTT_EVT_end', $DTM->get('DTT_EVT_start') );
254
+			if ($DTM->get_raw('DTT_EVT_start') > $DTM->get_raw('DTT_EVT_end')) {
255
+				$DTM->set('DTT_EVT_end', $DTM->get('DTT_EVT_start'));
256 256
 				EE_Registry::instance()->load_helper('DTT_Helper');
257 257
 				$DTM = EEH_DTT_Helper::date_time_add($DTM, 'DTT_EVT_end', 'days');
258 258
 				$DTM->save();
@@ -268,25 +268,25 @@  discard block
 block discarded – undo
268 268
 		}
269 269
 
270 270
 		//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.
271
-		$old_datetimes = explode(',', $data['datetime_IDs'] );
271
+		$old_datetimes = explode(',', $data['datetime_IDs']);
272 272
 		$old_datetimes = $old_datetimes[0] == '' ? array() : $old_datetimes;
273 273
 
274
-		if ( is_array( $old_datetimes ) ) {
275
-			$dtts_to_delete = array_diff( $old_datetimes, $saved_dtt_ids );
276
-			foreach ( $dtts_to_delete as $id ) {
277
-				$id = absint( $id );
278
-				if ( empty( $id ) )
274
+		if (is_array($old_datetimes)) {
275
+			$dtts_to_delete = array_diff($old_datetimes, $saved_dtt_ids);
276
+			foreach ($dtts_to_delete as $id) {
277
+				$id = absint($id);
278
+				if (empty($id))
279 279
 					continue;
280 280
 
281 281
 				$dtt_to_remove = EE_Registry::instance()->load_model('Datetime')->get_one_by_ID($id);
282 282
 
283 283
 				//remove tkt relationships.
284 284
 				$related_tickets = $dtt_to_remove->get_many_related('Ticket');
285
-				foreach ( $related_tickets as $tkt ) {
285
+				foreach ($related_tickets as $tkt) {
286 286
 					$dtt_to_remove->_remove_relation_to($tkt, 'Ticket');
287 287
 				}
288 288
 
289
-				$evt_obj->_remove_relation_to( $id, 'Datetime' );
289
+				$evt_obj->_remove_relation_to($id, 'Datetime');
290 290
 				$dtt_to_remove->refresh_cache_of_related_objects();
291 291
 
292 292
 			}
@@ -307,81 +307,81 @@  discard block
 block discarded – undo
307 307
 	 * @param  array            $data       incoming request data
308 308
 	 * @return EE_Ticket[]
309 309
 	 */
310
-	protected function _update_tkts( $evtobj, $saved_dtts, $data ) {
310
+	protected function _update_tkts($evtobj, $saved_dtts, $data) {
311 311
 
312 312
 		$new_tkt = null;
313 313
 		$new_default = null;
314 314
 		//stripslashes because WP filtered the $_POST ($data) array to add slashes
315 315
 		$data = stripslashes_deep($data);
316
-		$timezone = isset( $data['timezone_string'] ) ? $data['timezone_string'] : NULL;
316
+		$timezone = isset($data['timezone_string']) ? $data['timezone_string'] : NULL;
317 317
 		$saved_tickets = $dtts_on_existing = array();
318
-		$old_tickets = isset( $data['ticket_IDs'] ) ? explode(',', $data['ticket_IDs'] ) : array();
318
+		$old_tickets = isset($data['ticket_IDs']) ? explode(',', $data['ticket_IDs']) : array();
319 319
 
320 320
 		//load money helper
321
-		EE_Registry::instance()->load_helper( 'Money' );
321
+		EE_Registry::instance()->load_helper('Money');
322 322
 
323
-		foreach ( $data['edit_tickets'] as $row => $tkt ) {
323
+		foreach ($data['edit_tickets'] as $row => $tkt) {
324 324
 
325 325
 			$update_prices = $create_new_TKT = FALSE;
326 326
 
327 327
 			//figure out what dtts were added to the ticket and what dtts were removed from the ticket in the session.
328 328
 
329
-			$starting_tkt_dtt_rows = explode(',',$data['starting_ticket_datetime_rows'][$row]);
330
-			$tkt_dtt_rows = explode(',', $data['ticket_datetime_rows'][$row] );
329
+			$starting_tkt_dtt_rows = explode(',', $data['starting_ticket_datetime_rows'][$row]);
330
+			$tkt_dtt_rows = explode(',', $data['ticket_datetime_rows'][$row]);
331 331
 			$dtts_added = array_diff($tkt_dtt_rows, $starting_tkt_dtt_rows);
332 332
 			$dtts_removed = array_diff($starting_tkt_dtt_rows, $tkt_dtt_rows);
333 333
 
334 334
 			// trim inputs to ensure any excess whitespace is removed.
335
-			$tkt = array_map( 'trim', $tkt );
335
+			$tkt = array_map('trim', $tkt);
336 336
 
337 337
 			//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.
338 338
 			//note incoming ['TKT_price'] value is already in standard notation (via js).
339
-			$ticket_price = isset( $tkt['TKT_price'] ) ?  round ( (float) $tkt['TKT_price'], 3 ) : 0;
339
+			$ticket_price = isset($tkt['TKT_price']) ? round((float) $tkt['TKT_price'], 3) : 0;
340 340
 
341 341
 			//note incoming base price needs converted from localized value.
342
-			$base_price = isset( $tkt['TKT_base_price'] ) ? EEH_Money::convert_to_float_from_localized_money( $tkt['TKT_base_price'] ) : 0;
342
+			$base_price = isset($tkt['TKT_base_price']) ? EEH_Money::convert_to_float_from_localized_money($tkt['TKT_base_price']) : 0;
343 343
 			//if ticket price == 0 and $base_price != 0 then ticket price == base_price
344 344
 			$ticket_price = $ticket_price === 0 && $base_price !== 0 ? $base_price : $ticket_price;
345
-			$base_price_id = isset( $tkt['TKT_base_price_ID'] ) ? $tkt['TKT_base_price_ID'] : 0;
345
+			$base_price_id = isset($tkt['TKT_base_price_ID']) ? $tkt['TKT_base_price_ID'] : 0;
346 346
 
347 347
 			$price_rows = is_array($data['edit_prices']) && isset($data['edit_prices'][$row]) ? $data['edit_prices'][$row] : array();
348 348
 
349 349
 			$now = null;
350
-			if ( empty( $tkt['TKT_start_date'] ) ) {
350
+			if (empty($tkt['TKT_start_date'])) {
351 351
 				//lets' use now in the set timezone.
352
-				$now = new DateTime( 'now', new DateTimeZone( $evtobj->get_timezone() ) );
353
-				$tkt['TKT_start_date'] = $now->format( $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] );
352
+				$now = new DateTime('now', new DateTimeZone($evtobj->get_timezone()));
353
+				$tkt['TKT_start_date'] = $now->format($this->_date_format_strings['date'].' '.$this->_date_format_strings['time']);
354 354
 			}
355 355
 
356
-			if ( empty( $tkt['TKT_end_date'] ) ) {
356
+			if (empty($tkt['TKT_end_date'])) {
357 357
 				/**
358 358
 				 * set the TKT_end_date to the first datetime attached to the ticket.
359 359
 				 */
360
-				$first_dtt = $saved_dtts[reset( $tkt_dtt_rows )];
361
-				$tkt['TKT_end_date'] = $first_dtt->start_date_and_time( $this->_date_format_strings['date'] . ' ' . $this->_date_format_string['time'] );
360
+				$first_dtt = $saved_dtts[reset($tkt_dtt_rows)];
361
+				$tkt['TKT_end_date'] = $first_dtt->start_date_and_time($this->_date_format_strings['date'].' '.$this->_date_format_string['time']);
362 362
 			}
363 363
 
364 364
 			$TKT_values = array(
365
-				'TKT_ID' 			=> ! empty( $tkt['TKT_ID'] ) ? $tkt['TKT_ID'] : NULL,
366
-				'TTM_ID' 			=> ! empty( $tkt['TTM_ID'] ) ? $tkt['TTM_ID'] : 0,
367
-				'TKT_name' 			=> ! empty( $tkt['TKT_name'] ) ? $tkt['TKT_name'] : '',
368
-				'TKT_description' 	=> ! empty( $tkt['TKT_description'] ) && $tkt['TKT_description'] != __('You can modify this description', 'event_espresso') ? $tkt['TKT_description'] : '',
365
+				'TKT_ID' 			=> ! empty($tkt['TKT_ID']) ? $tkt['TKT_ID'] : NULL,
366
+				'TTM_ID' 			=> ! empty($tkt['TTM_ID']) ? $tkt['TTM_ID'] : 0,
367
+				'TKT_name' 			=> ! empty($tkt['TKT_name']) ? $tkt['TKT_name'] : '',
368
+				'TKT_description' 	=> ! empty($tkt['TKT_description']) && $tkt['TKT_description'] != __('You can modify this description', 'event_espresso') ? $tkt['TKT_description'] : '',
369 369
 				'TKT_start_date' 	=> $tkt['TKT_start_date'],
370 370
 				'TKT_end_date' 		=> $tkt['TKT_end_date'],
371
-				'TKT_qty' 			=> ! isset( $tkt[ 'TKT_qty' ] ) || $tkt[ 'TKT_qty' ] === '' ? EE_INF : $tkt[ 'TKT_qty' ],
372
-				'TKT_uses' 			=> ! isset( $tkt[ 'TKT_uses' ] ) || $tkt[ 'TKT_uses' ] === '' ? EE_INF : $tkt['TKT_uses'],
373
-				'TKT_min' 			=> empty( $tkt['TKT_min'] ) ? 0 : $tkt['TKT_min'],
374
-				'TKT_max' 			=> empty( $tkt['TKT_max'] ) ? EE_INF : $tkt['TKT_max'],
371
+				'TKT_qty' 			=> ! isset($tkt['TKT_qty']) || $tkt['TKT_qty'] === '' ? EE_INF : $tkt['TKT_qty'],
372
+				'TKT_uses' 			=> ! isset($tkt['TKT_uses']) || $tkt['TKT_uses'] === '' ? EE_INF : $tkt['TKT_uses'],
373
+				'TKT_min' 			=> empty($tkt['TKT_min']) ? 0 : $tkt['TKT_min'],
374
+				'TKT_max' 			=> empty($tkt['TKT_max']) ? EE_INF : $tkt['TKT_max'],
375 375
 				'TKT_row' 			=> $row,
376
-				'TKT_order' 		=> isset( $tkt['TKT_order'] ) ? $tkt['TKT_order'] : 0,
377
-				'TKT_taxable' 		=> ! empty( $tkt['TKT_taxable'] ) ? 1 : 0,
378
-				'TKT_required' 		=> ! empty( $tkt['TKT_required'] ) ? 1 : 0,
376
+				'TKT_order' 		=> isset($tkt['TKT_order']) ? $tkt['TKT_order'] : 0,
377
+				'TKT_taxable' 		=> ! empty($tkt['TKT_taxable']) ? 1 : 0,
378
+				'TKT_required' 		=> ! empty($tkt['TKT_required']) ? 1 : 0,
379 379
 				'TKT_price' 		=> $ticket_price
380 380
 			);
381 381
 
382 382
 
383 383
 			//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.
384
-			if ( isset( $tkt['TKT_is_default'] ) && $tkt['TKT_is_default'] ) {
384
+			if (isset($tkt['TKT_is_default']) && $tkt['TKT_is_default']) {
385 385
 				$TKT_values['TKT_ID'] = 0;
386 386
 				$TKT_values['TKT_is_default'] = 0;
387 387
 				$update_prices = TRUE;
@@ -393,21 +393,21 @@  discard block
 block discarded – undo
393 393
 			// but DID have it's items modified.
394 394
 			// keep in mind that if the TKT has been sold (and we have changed pricing information),
395 395
 			// then we won't be updating the tkt but instead a new tkt will be created and the old one archived.
396
-			if ( absint( $TKT_values['TKT_ID'] ) ) {
397
-				$TKT = EE_Registry::instance()->load_model( 'Ticket', array( $timezone ) )->get_one_by_ID( $tkt['TKT_ID'] );
398
-				if ( $TKT instanceof EE_Ticket ) {
396
+			if (absint($TKT_values['TKT_ID'])) {
397
+				$TKT = EE_Registry::instance()->load_model('Ticket', array($timezone))->get_one_by_ID($tkt['TKT_ID']);
398
+				if ($TKT instanceof EE_Ticket) {
399 399
 
400
-					$TKT = $this->_update_ticket_datetimes( $TKT, $saved_dtts, $dtts_added, $dtts_removed );
400
+					$TKT = $this->_update_ticket_datetimes($TKT, $saved_dtts, $dtts_added, $dtts_removed);
401 401
 					// are there any registrations using this ticket ?
402 402
 					$tickets_sold = $TKT->count_related(
403 403
 						'Registration',
404
-						array( array(
405
-								'STS_ID' => array( 'NOT IN', array( EEM_Registration::status_id_incomplete ) )
406
-						) )
404
+						array(array(
405
+								'STS_ID' => array('NOT IN', array(EEM_Registration::status_id_incomplete))
406
+						))
407 407
 					);
408 408
 					//set ticket formats
409
-					$TKT->set_date_format( $this->_date_format_strings['date'] );
410
-					$TKT->set_time_format( $this->_date_format_strings['time'] );
409
+					$TKT->set_date_format($this->_date_format_strings['date']);
410
+					$TKT->set_time_format($this->_date_format_strings['time']);
411 411
 
412 412
 					// let's just check the total price for the existing ticket
413 413
 					// and determine if it matches the new total price.
@@ -417,17 +417,17 @@  discard block
 block discarded – undo
417 417
 							? TRUE : FALSE;
418 418
 
419 419
 					//set new values
420
-					foreach ( $TKT_values as $field => $value ) {
421
-						if ( $field === 'TKT_qty' ) {
422
-							$TKT->set_qty( $value );
420
+					foreach ($TKT_values as $field => $value) {
421
+						if ($field === 'TKT_qty') {
422
+							$TKT->set_qty($value);
423 423
 						} else {
424
-							$TKT->set( $field, $value );
424
+							$TKT->set($field, $value);
425 425
 						}
426 426
 					}
427 427
 
428 428
 					//if $create_new_TKT is false then we can safely update the existing ticket.  Otherwise we have to create a new ticket.
429
-					if ( $create_new_TKT ) {
430
-						$new_tkt = $this->_duplicate_ticket( $TKT, $price_rows, $ticket_price, $base_price, $base_price_id );
429
+					if ($create_new_TKT) {
430
+						$new_tkt = $this->_duplicate_ticket($TKT, $price_rows, $ticket_price, $base_price, $base_price_id);
431 431
 					}
432 432
 				}
433 433
 
@@ -436,12 +436,12 @@  discard block
 block discarded – undo
436 436
 				$TKT = EE_Ticket::new_instance(
437 437
 					$TKT_values,
438 438
 					$timezone,
439
-					array( $this->_date_format_strings[ 'date' ], $this->_date_format_strings[ 'time' ]  )
439
+					array($this->_date_format_strings['date'], $this->_date_format_strings['time'])
440 440
 				);
441
-				if ( $TKT instanceof EE_Ticket ) {
441
+				if ($TKT instanceof EE_Ticket) {
442 442
 					// make sure ticket has an ID of setting relations won't work
443 443
 					$TKT->save();
444
-					$TKT = $this->_update_ticket_datetimes( $TKT, $saved_dtts, $dtts_added, $dtts_removed );
444
+					$TKT = $this->_update_ticket_datetimes($TKT, $saved_dtts, $dtts_added, $dtts_removed);
445 445
 					$update_prices = TRUE;
446 446
 				}
447 447
 			}
@@ -449,38 +449,38 @@  discard block
 block discarded – undo
449 449
 			//$TKT->save();
450 450
 
451 451
 			//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.
452
-			if( $TKT->get_raw('TKT_start_date') > $TKT->get_raw('TKT_end_date') ) {
453
-				$TKT->set('TKT_end_date', $TKT->get('TKT_start_date') );
452
+			if ($TKT->get_raw('TKT_start_date') > $TKT->get_raw('TKT_end_date')) {
453
+				$TKT->set('TKT_end_date', $TKT->get('TKT_start_date'));
454 454
 				EE_Registry::instance()->load_helper('DTT_Helper');
455 455
 				$TKT = EEH_DTT_Helper::date_time_add($TKT, 'TKT_end_date', 'days');
456 456
 			}
457 457
 
458 458
 			//let's make sure the base price is handled
459
-			$TKT = ! $create_new_TKT ? $this->_add_prices_to_ticket( array(), $TKT, $update_prices, $base_price, $base_price_id ) : $TKT;
459
+			$TKT = ! $create_new_TKT ? $this->_add_prices_to_ticket(array(), $TKT, $update_prices, $base_price, $base_price_id) : $TKT;
460 460
 
461 461
 			//add/update price_modifiers
462
-			$TKT = ! $create_new_TKT ? $this->_add_prices_to_ticket( $price_rows, $TKT, $update_prices ) : $TKT;
462
+			$TKT = ! $create_new_TKT ? $this->_add_prices_to_ticket($price_rows, $TKT, $update_prices) : $TKT;
463 463
 
464 464
 			//need to make sue that the TKT_price is accurate after saving the prices.
465 465
 			$TKT->ensure_TKT_Price_correct();
466 466
 
467 467
 			//handle CREATING a default tkt from the incoming tkt but ONLY if this isn't an autosave.
468
-			if ( ! defined('DOING_AUTOSAVE' ) ) {
469
-				if ( !empty($tkt['TKT_is_default_selector'] ) ) {
468
+			if ( ! defined('DOING_AUTOSAVE')) {
469
+				if ( ! empty($tkt['TKT_is_default_selector'])) {
470 470
 					$update_prices = TRUE;
471 471
 					$new_default = clone $TKT;
472
-					$new_default->set( 'TKT_ID', 0 );
473
-					$new_default->set( 'TKT_is_default', 1 );
474
-					$new_default->set( 'TKT_row', 1 );
475
-					$new_default->set( 'TKT_price', $ticket_price );
472
+					$new_default->set('TKT_ID', 0);
473
+					$new_default->set('TKT_is_default', 1);
474
+					$new_default->set('TKT_row', 1);
475
+					$new_default->set('TKT_price', $ticket_price);
476 476
 					//remove any dtt relations cause we DON'T want dtt relations attached (note this is just removing the cached relations in the object)
477 477
 					$new_default->_remove_relations('Datetime');
478 478
 					//todo we need to add the current attached prices as new prices to the new default ticket.
479
-					$new_default = $this->_add_prices_to_ticket( $price_rows, $new_default, $update_prices );
479
+					$new_default = $this->_add_prices_to_ticket($price_rows, $new_default, $update_prices);
480 480
 					//don't forget the base price!
481
-					$new_default = $this->_add_prices_to_ticket( array(), $new_default, $update_prices, $base_price, $base_price_id );
481
+					$new_default = $this->_add_prices_to_ticket(array(), $new_default, $update_prices, $base_price, $base_price_id);
482 482
 					$new_default->save();
483
-					do_action( 'AHEE__espresso_events_Pricing_Hooks___update_tkts_new_default_ticket', $new_default, $row, $TKT, $data );
483
+					do_action('AHEE__espresso_events_Pricing_Hooks___update_tkts_new_default_ticket', $new_default, $row, $TKT, $data);
484 484
 				}
485 485
 			}
486 486
 
@@ -491,19 +491,19 @@  discard block
 block discarded – undo
491 491
 			//let's assign any tickets that have been setup to the saved_tickets tracker
492 492
 			//save existing TKT
493 493
 			$TKT->save();
494
-			if ( $create_new_TKT && $new_tkt instanceof EE_Ticket ) {
494
+			if ($create_new_TKT && $new_tkt instanceof EE_Ticket) {
495 495
 				//save new TKT
496 496
 				$new_tkt->save();
497 497
 				//add new ticket to array
498
-				$saved_tickets[ $new_tkt->ID() ] = $new_tkt;
498
+				$saved_tickets[$new_tkt->ID()] = $new_tkt;
499 499
 
500
-				do_action( 'AHEE__espresso_events_Pricing_Hooks___update_tkts_new_ticket', $new_tkt, $row, $tkt, $data );
500
+				do_action('AHEE__espresso_events_Pricing_Hooks___update_tkts_new_ticket', $new_tkt, $row, $tkt, $data);
501 501
 
502 502
 			} else {
503 503
 				//add tkt to saved tkts
504
-				$saved_tickets[ $TKT->ID() ] = $TKT;
504
+				$saved_tickets[$TKT->ID()] = $TKT;
505 505
 
506
-				do_action( 'AHEE__espresso_events_Pricing_Hooks___update_tkts_update_ticket', $TKT, $row, $tkt, $data );
506
+				do_action('AHEE__espresso_events_Pricing_Hooks___update_tkts_update_ticket', $TKT, $row, $tkt, $data);
507 507
 			}
508 508
 
509 509
 		}
@@ -513,22 +513,22 @@  discard block
 block discarded – undo
513 513
 		// (i.e. autosaves are happening and then in between autosaves the user trashes a ticket).
514 514
 		// Or a draft event was saved and in the process of editing a ticket is trashed.
515 515
 		// No sense in keeping all the related data in the db!
516
-		$old_tickets = isset( $old_tickets[0] ) && $old_tickets[0] == '' ? array() : $old_tickets;
517
-		$tickets_removed = array_diff( $old_tickets, array_keys($saved_tickets) );
516
+		$old_tickets = isset($old_tickets[0]) && $old_tickets[0] == '' ? array() : $old_tickets;
517
+		$tickets_removed = array_diff($old_tickets, array_keys($saved_tickets));
518 518
 
519
-		foreach ( $tickets_removed as $id ) {
520
-			$id = absint( $id );
519
+		foreach ($tickets_removed as $id) {
520
+			$id = absint($id);
521 521
 
522 522
 			//get the ticket for this id
523 523
 			$tkt_to_remove = EE_Registry::instance()->load_model('Ticket')->get_one_by_ID($id);
524 524
 
525 525
 			//if this tkt is a default tkt we leave it alone cause it won't be attached to the datetime
526
-			if ( $tkt_to_remove->get('TKT_is_default') )
526
+			if ($tkt_to_remove->get('TKT_is_default'))
527 527
 				continue;
528 528
 
529 529
 			// if this tkt has any registrations attached so then we just ARCHIVE
530 530
 			// because we don't actually permanently delete these tickets.
531
-			if ( $tkt_to_remove->count_related('Registration') > 0 ) {
531
+			if ($tkt_to_remove->count_related('Registration') > 0) {
532 532
 				$tkt_to_remove->delete();
533 533
 				continue;
534 534
 			}
@@ -537,7 +537,7 @@  discard block
 block discarded – undo
537 537
 			// (remember this process can ONLY kick off if there are NO tkts_sold)
538 538
 			$dtts = $tkt_to_remove->get_many_related('Datetime');
539 539
 
540
-			foreach( $dtts as $dtt ) {
540
+			foreach ($dtts as $dtt) {
541 541
 				$tkt_to_remove->_remove_relation_to($dtt, 'Datetime');
542 542
 			}
543 543
 
@@ -545,7 +545,7 @@  discard block
 block discarded – undo
545 545
 			// tickets can only be trashed if they don't have any TKTs sold (otherwise they are just archived))
546 546
 			$tkt_to_remove->delete_related_permanently('Price');
547 547
 
548
-			do_action( 'AHEE__espresso_events_Pricing_Hooks___update_tkts_delete_ticket', $tkt_to_remove );
548
+			do_action('AHEE__espresso_events_Pricing_Hooks___update_tkts_delete_ticket', $tkt_to_remove);
549 549
 
550 550
 			// finally let's delete this ticket
551 551
 			// (which should not be blocked at this point b/c we've removed all our relationships)
@@ -577,39 +577,39 @@  discard block
 block discarded – undo
577 577
 		// and removing the ticket from datetimes it got removed from.
578 578
 
579 579
 		// first let's add datetimes
580
-		if ( ! empty( $added_datetimes ) && is_array( $added_datetimes ) ) {
581
-			foreach ( $added_datetimes as $row_id ) {
582
-				$row_id = (int)$row_id;
583
-				if ( isset( $saved_datetimes[ $row_id ] ) && $saved_datetimes[ $row_id ] instanceof EE_Datetime ) {
584
-					$ticket->_add_relation_to( $saved_datetimes[ $row_id ], 'Datetime' );
580
+		if ( ! empty($added_datetimes) && is_array($added_datetimes)) {
581
+			foreach ($added_datetimes as $row_id) {
582
+				$row_id = (int) $row_id;
583
+				if (isset($saved_datetimes[$row_id]) && $saved_datetimes[$row_id] instanceof EE_Datetime) {
584
+					$ticket->_add_relation_to($saved_datetimes[$row_id], 'Datetime');
585 585
 					// Is this an existing ticket (has an ID) and does it have any sold?
586 586
 					// If so, then we need to add that to the DTT sold because this DTT is getting added.
587
-					if ( $ticket->ID() && $ticket->sold() > 0 ) {
588
-						$saved_datetimes[ $row_id ]->increase_sold( $ticket->sold() );
589
-						$saved_datetimes[ $row_id ]->save();
587
+					if ($ticket->ID() && $ticket->sold() > 0) {
588
+						$saved_datetimes[$row_id]->increase_sold($ticket->sold());
589
+						$saved_datetimes[$row_id]->save();
590 590
 					}
591 591
 				}
592 592
 			}
593 593
 		}
594 594
 		// then remove datetimes
595
-		if ( ! empty( $removed_datetimes ) && is_array( $removed_datetimes ) ) {
596
-			foreach ( $removed_datetimes as $row_id ) {
597
-				$row_id = (int)$row_id;
595
+		if ( ! empty($removed_datetimes) && is_array($removed_datetimes)) {
596
+			foreach ($removed_datetimes as $row_id) {
597
+				$row_id = (int) $row_id;
598 598
 				// its entirely possible that a datetime got deleted (instead of just removed from relationship.
599 599
 				// So make sure we skip over this if the dtt isn't in the $saved_datetimes array)
600
-				if ( isset( $saved_datetimes[ $row_id ] ) && $saved_datetimes[ $row_id ] instanceof EE_Datetime ) {
601
-					$ticket->_remove_relation_to( $saved_datetimes[ $row_id ], 'Datetime' );
600
+				if (isset($saved_datetimes[$row_id]) && $saved_datetimes[$row_id] instanceof EE_Datetime) {
601
+					$ticket->_remove_relation_to($saved_datetimes[$row_id], 'Datetime');
602 602
 					// Is this an existing ticket (has an ID) and does it have any sold?
603 603
 					// If so, then we need to remove it's sold from the DTT_sold.
604
-					if ( $ticket->ID() && $ticket->sold() > 0 ) {
605
-						$saved_datetimes[ $row_id ]->decrease_sold( $ticket->sold() );
606
-						$saved_datetimes[ $row_id ]->save();
604
+					if ($ticket->ID() && $ticket->sold() > 0) {
605
+						$saved_datetimes[$row_id]->decrease_sold($ticket->sold());
606
+						$saved_datetimes[$row_id]->save();
607 607
 					}
608 608
 				}
609 609
 			}
610 610
 		}
611 611
 		// cap ticket qty by datetime reg limits
612
-		$ticket->set_qty( min( $ticket->qty(), $ticket->qty( 'reg_limit' ) ) );
612
+		$ticket->set_qty(min($ticket->qty(), $ticket->qty('reg_limit')));
613 613
 		return $ticket;
614 614
 	}
615 615
 
@@ -630,39 +630,39 @@  discard block
 block discarded – undo
630 630
 		EE_Ticket $ticket,
631 631
 		$price_rows = array(),
632 632
 		$ticket_price = 0,
633
-		$base_price = 0 ,
633
+		$base_price = 0,
634 634
 		$base_price_id = 0
635 635
 	) {
636 636
 
637 637
 		// create new ticket that's a copy of the existing
638 638
 		// except a new id of course (and not archived)
639 639
 		// AND has the new TKT_price associated with it.
640
-		$new_ticket = clone( $ticket );
641
-		$new_ticket->set( 'TKT_ID', 0 );
642
-		$new_ticket->set( 'TKT_deleted', 0 );
643
-		$new_ticket->set( 'TKT_price', $ticket_price );
644
-		$new_ticket->set( 'TKT_sold', 0 );
640
+		$new_ticket = clone($ticket);
641
+		$new_ticket->set('TKT_ID', 0);
642
+		$new_ticket->set('TKT_deleted', 0);
643
+		$new_ticket->set('TKT_price', $ticket_price);
644
+		$new_ticket->set('TKT_sold', 0);
645 645
 		// let's get a new ID for this ticket
646 646
 		$new_ticket->save();
647 647
 		// we also need to make sure this new ticket gets the same datetime attachments as the archived ticket
648
-		$datetimes_on_existing = $ticket->get_many_related( 'Datetime' );
648
+		$datetimes_on_existing = $ticket->get_many_related('Datetime');
649 649
 		$new_ticket = $this->_update_ticket_datetimes(
650 650
 			$new_ticket,
651 651
 			$datetimes_on_existing,
652
-			array_keys( $datetimes_on_existing )
652
+			array_keys($datetimes_on_existing)
653 653
 		);
654 654
 
655 655
 		// $ticket will get archived later b/c we are NOT adding it to the saved_tickets array.
656 656
 		// if existing $ticket has sold amount, then we need to adjust the qty for the new TKT to = the remaining
657 657
 		// available.
658
-		if ( $ticket->sold() > 0 ) {
658
+		if ($ticket->sold() > 0) {
659 659
 			$new_qty = $ticket->qty() - $ticket->sold();
660
-			$new_ticket->set_qty( $new_qty );
660
+			$new_ticket->set_qty($new_qty);
661 661
 		}
662 662
 		//now we update the prices just for this ticket
663
-		$new_ticket = $this->_add_prices_to_ticket( $price_rows, $new_ticket, true );
663
+		$new_ticket = $this->_add_prices_to_ticket($price_rows, $new_ticket, true);
664 664
 		//and we update the base price
665
-		$new_ticket = $this->_add_prices_to_ticket( array(), $new_ticket, true, $base_price, $base_price_id );
665
+		$new_ticket = $this->_add_prices_to_ticket(array(), $new_ticket, true, $base_price, $base_price_id);
666 666
 		return $new_ticket;
667 667
 	}
668 668
 
@@ -682,7 +682,7 @@  discard block
 block discarded – undo
682 682
 	 * @param int|bool 		$base_price_id  if present then this is the base_price_id being updated.
683 683
 	 * @return EE_Ticket
684 684
 	 */
685
-	protected function  _add_prices_to_ticket( $prices = array(), EE_Ticket $ticket, $new_prices = FALSE, $base_price = FALSE, $base_price_id = FALSE ) {
685
+	protected function  _add_prices_to_ticket($prices = array(), EE_Ticket $ticket, $new_prices = FALSE, $base_price = FALSE, $base_price_id = FALSE) {
686 686
 
687 687
 		//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.
688 688
 		$current_prices_on_ticket = $base_price !== FALSE ? $ticket->base_price(TRUE) : $ticket->price_modifiers();
@@ -690,7 +690,7 @@  discard block
 block discarded – undo
690 690
 		$updated_prices = array();
691 691
 
692 692
 		// if $base_price ! FALSE then updating a base price.
693
-		if ( $base_price !== FALSE ) {
693
+		if ($base_price !== FALSE) {
694 694
 			$prices[1] = array(
695 695
 				'PRC_ID' => $new_prices || $base_price_id === 1 ? NULL : $base_price_id,
696 696
 				'PRT_ID' => 1,
@@ -701,47 +701,47 @@  discard block
 block discarded – undo
701 701
 		}
702 702
 
703 703
 		//possibly need to save tkt
704
-		if ( ! $ticket->ID() )
704
+		if ( ! $ticket->ID())
705 705
 			$ticket->save();
706 706
 
707
-		foreach ( $prices as $row => $prc ) {
708
-			$prt_id = !empty( $prc['PRT_ID'] ) ? $prc['PRT_ID'] : NULL;
709
-			if ( empty($prt_id) )
707
+		foreach ($prices as $row => $prc) {
708
+			$prt_id = ! empty($prc['PRT_ID']) ? $prc['PRT_ID'] : NULL;
709
+			if (empty($prt_id))
710 710
 				continue; //prices MUST have a price type id.
711 711
 			$PRC_values = array(
712
-				'PRC_ID' => !empty( $prc['PRC_ID'] ) ? $prc['PRC_ID'] : NULL,
712
+				'PRC_ID' => ! empty($prc['PRC_ID']) ? $prc['PRC_ID'] : NULL,
713 713
 				'PRT_ID' => $prt_id,
714
-				'PRC_amount' => !empty( $prc['PRC_amount'] ) ? $prc['PRC_amount'] : 0,
715
-				'PRC_name' => !empty( $prc['PRC_name'] ) ? $prc['PRC_name'] : '',
716
-				'PRC_desc' => !empty( $prc['PRC_desc'] ) ? $prc['PRC_desc'] : '',
714
+				'PRC_amount' => ! empty($prc['PRC_amount']) ? $prc['PRC_amount'] : 0,
715
+				'PRC_name' => ! empty($prc['PRC_name']) ? $prc['PRC_name'] : '',
716
+				'PRC_desc' => ! empty($prc['PRC_desc']) ? $prc['PRC_desc'] : '',
717 717
 				'PRC_is_default' => false, //make sure we set PRC_is_default to false for all ticket saves from event_editor
718 718
 				'PRC_order' => $row
719 719
 				);
720
-			if ( $new_prices || empty( $PRC_values['PRC_ID'] ) ) {
720
+			if ($new_prices || empty($PRC_values['PRC_ID'])) {
721 721
 				$PRC_values['PRC_ID'] = 0;
722
-				$PRC = EE_Registry::instance()->load_class('Price', array( $PRC_values ), FALSE, FALSE);
722
+				$PRC = EE_Registry::instance()->load_class('Price', array($PRC_values), FALSE, FALSE);
723 723
 			} else {
724
-				$PRC = EE_Registry::instance()->load_model( 'Price' )->get_one_by_ID( $prc['PRC_ID'] );
724
+				$PRC = EE_Registry::instance()->load_model('Price')->get_one_by_ID($prc['PRC_ID']);
725 725
 				//update this price with new values
726
-				foreach ( $PRC_values as $field => $newprc ) {
727
-					$PRC->set( $field, $newprc );
726
+				foreach ($PRC_values as $field => $newprc) {
727
+					$PRC->set($field, $newprc);
728 728
 				}
729 729
 			}
730 730
 			$PRC->save();
731 731
 			$prcid = $PRC->ID();
732 732
 			$updated_prices[$prcid] = $PRC;
733
-			$ticket->_add_relation_to( $PRC, 'Price' );
733
+			$ticket->_add_relation_to($PRC, 'Price');
734 734
 		}
735 735
 
736 736
 		//now let's remove any prices that got removed from the ticket
737
-		if ( !empty ( $current_prices_on_ticket ) ) {
737
+		if ( ! empty ($current_prices_on_ticket)) {
738 738
 			$current = array_keys($current_prices_on_ticket);
739 739
 			$updated = array_keys($updated_prices);
740 740
 			$prices_to_remove = array_diff($current, $updated);
741
-			if ( !empty( $prices_to_remove ) ) {
742
-				foreach ( $prices_to_remove as $prc_id ) {
741
+			if ( ! empty($prices_to_remove)) {
742
+				foreach ($prices_to_remove as $prc_id) {
743 743
 					$p = $current_prices_on_ticket[$prc_id];
744
-					$ticket->_remove_relation_to( $p, 'Price' );
744
+					$ticket->_remove_relation_to($p, 'Price');
745 745
 
746 746
 					//delete permanently the price
747 747
 					$p->delete_permanently();
@@ -754,7 +754,7 @@  discard block
 block discarded – undo
754 754
 
755 755
 
756 756
 
757
-	public function autosave_handling( $event_admin_obj ) {
757
+	public function autosave_handling($event_admin_obj) {
758 758
 		return $event_admin_obj; //doing nothing for the moment.
759 759
 		//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)
760 760
 
@@ -788,12 +788,12 @@  discard block
 block discarded – undo
788 788
 
789 789
 		//default main template args
790 790
 		$main_template_args = array(
791
-			'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
791
+			'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
792 792
 			'existing_datetime_ids' => '',
793 793
 			'total_dtt_rows' => 1,
794
-			'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.
794
+			'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.
795 795
 			'datetime_rows' => '',
796
-			'show_tickets_container' => '',//$this->_adminpage_obj->get_cpt_model_obj()->ID() > 1 ? ' style="display:none;"' : '',
796
+			'show_tickets_container' => '', //$this->_adminpage_obj->get_cpt_model_obj()->ID() > 1 ? ' style="display:none;"' : '',
797 797
 			'ticket_rows' => '',
798 798
 			'existing_ticket_ids' => '',
799 799
 			'total_ticket_rows' => 1,
@@ -803,7 +803,7 @@  discard block
 block discarded – undo
803 803
 
804 804
 		$timezone = $evtobj instanceof EE_Event ? $evtobj->timezone_string() : NULL;
805 805
 
806
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
806
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
807 807
 
808 808
 		/**
809 809
 		 * 1. Start with retrieving Datetimes
@@ -811,25 +811,25 @@  discard block
 block discarded – undo
811 811
 		 * 3. For each ticket get related prices
812 812
 		 */
813 813
 
814
-		$DTM = EE_Registry::instance()->load_model('Datetime', array($timezone) );
815
-		$times = $DTM->get_all_event_dates( $evtID );
814
+		$DTM = EE_Registry::instance()->load_model('Datetime', array($timezone));
815
+		$times = $DTM->get_all_event_dates($evtID);
816 816
 
817 817
 
818 818
 
819 819
 		$main_template_args['total_dtt_rows'] = count($times);
820
-		foreach ( $times as $time ) {
820
+		foreach ($times as $time) {
821 821
 			$dttid = $time->get('DTT_ID');
822 822
 			$dttrow = $time->get('DTT_order');
823 823
 			$existing_datetime_ids[] = $dttid;
824 824
 
825 825
 			//tickets attached
826
-			$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();
826
+			$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();
827 827
 
828 828
 			//if there are no related tickets this is likely a new event OR autodraft
829 829
 			// event so we need to generate the default tickets because dtts
830 830
 			// ALWAYS have at least one related ticket!!.  EXCEPT, we dont' do this if there is already more than one
831 831
 			// datetime on the event.
832
-			if ( empty ( $related_tickets ) && count( $times ) < 2 ) {
832
+			if (empty ($related_tickets) && count($times) < 2) {
833 833
 				$related_tickets = EE_Registry::instance()->load_model('Ticket')->get_all_default_tickets();
834 834
 			}
835 835
 
@@ -838,11 +838,11 @@  discard block
 block discarded – undo
838 838
 
839 839
 			//loop through and setup the ticket rows and make sure the order is set.
840 840
 			$order = 0;
841
-			foreach ( $related_tickets as $ticket ) {
841
+			foreach ($related_tickets as $ticket) {
842 842
 				$tktid = $ticket->get('TKT_ID');
843 843
 				$tktrow = $ticket->get('TKT_row');
844 844
 				//we only want unique tickets in our final display!!
845
-				if ( !in_array( $tktid, $existing_ticket_ids ) ) {
845
+				if ( ! in_array($tktid, $existing_ticket_ids)) {
846 846
 					$existing_ticket_ids[] = $tktid;
847 847
 					$all_tickets[] = $ticket;
848 848
 				}
@@ -851,56 +851,56 @@  discard block
 block discarded – undo
851 851
 				$datetime_tickets[$dttid][] = $tktrow;
852 852
 
853 853
 				//temporary cache of this datetime info for this ticket for later processing of ticket rows.
854
-				if ( !isset( $ticket_datetimes[$tktid] ) || ! in_array( $dttrow, $ticket_datetimes[$tktid] ) )
854
+				if ( ! isset($ticket_datetimes[$tktid]) || ! in_array($dttrow, $ticket_datetimes[$tktid]))
855 855
 					$ticket_datetimes[$tktid][] = $dttrow;
856 856
 			}
857 857
 		}
858 858
 
859
-		$main_template_args['total_ticket_rows'] = count( $existing_ticket_ids );
860
-		$main_template_args['existing_ticket_ids'] = implode( ',', $existing_ticket_ids );
861
-		$main_template_args['existing_datetime_ids'] = implode( ',', $existing_datetime_ids );
859
+		$main_template_args['total_ticket_rows'] = count($existing_ticket_ids);
860
+		$main_template_args['existing_ticket_ids'] = implode(',', $existing_ticket_ids);
861
+		$main_template_args['existing_datetime_ids'] = implode(',', $existing_datetime_ids);
862 862
 
863 863
 		//sort $all_tickets by order
864
-		usort( $all_tickets, function( $a, $b ) {
864
+		usort($all_tickets, function($a, $b) {
865 865
 			$a_order = (int) $a->get('TKT_order');
866 866
 			$b_order = (int) $b->get('TKT_order');
867
-			if ( $a_order == $b_order ) {
867
+			if ($a_order == $b_order) {
868 868
 				return 0;
869 869
 			}
870
-			return ( $a_order < $b_order ) ? -1 : 1;
870
+			return ($a_order < $b_order) ? -1 : 1;
871 871
 		});
872 872
 
873 873
 		//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.
874 874
 		$dttrow = 1;
875
-		foreach ( $times as $time ) {
876
-			$main_template_args['datetime_rows'] .= $this->_get_datetime_row( $dttrow, $time, $datetime_tickets, $all_tickets, FALSE, $times );
875
+		foreach ($times as $time) {
876
+			$main_template_args['datetime_rows'] .= $this->_get_datetime_row($dttrow, $time, $datetime_tickets, $all_tickets, FALSE, $times);
877 877
 			$dttrow++;
878 878
 		}
879 879
 
880 880
 		//then loop through all tickets for the ticket rows.
881 881
 		$tktrow = 1;
882
-		foreach ( $all_tickets as $ticket ) {
883
-			$main_template_args['ticket_rows'] .= $this->_get_ticket_row( $tktrow, $ticket, $ticket_datetimes, $times, FALSE, $all_tickets );
882
+		foreach ($all_tickets as $ticket) {
883
+			$main_template_args['ticket_rows'] .= $this->_get_ticket_row($tktrow, $ticket, $ticket_datetimes, $times, FALSE, $all_tickets);
884 884
 			$tktrow++;
885 885
 		}
886 886
 
887 887
 		$main_template_args['ticket_js_structure'] = $this->_get_ticket_js_structure($times, $all_tickets);
888
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_metabox_main.template.php';
889
-		EEH_Template::display_template( $template, $main_template_args );
888
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_metabox_main.template.php';
889
+		EEH_Template::display_template($template, $main_template_args);
890 890
 		return;
891 891
 	}
892 892
 
893 893
 
894 894
 
895
-	protected function _get_datetime_row( $dttrow, EE_Datetime $dtt, $datetime_tickets, $all_tickets, $default = FALSE, $all_dtts = array() ) {
895
+	protected function _get_datetime_row($dttrow, EE_Datetime $dtt, $datetime_tickets, $all_tickets, $default = FALSE, $all_dtts = array()) {
896 896
 
897 897
 		$dtt_display_template_args = array(
898
-			'dtt_edit_row' => $this->_get_dtt_edit_row( $dttrow, $dtt, $default, $all_dtts ),
899
-			'dtt_attached_tickets_row' => $this->_get_dtt_attached_tickets_row( $dttrow, $dtt, $datetime_tickets, $all_tickets, $default ),
898
+			'dtt_edit_row' => $this->_get_dtt_edit_row($dttrow, $dtt, $default, $all_dtts),
899
+			'dtt_attached_tickets_row' => $this->_get_dtt_attached_tickets_row($dttrow, $dtt, $datetime_tickets, $all_tickets, $default),
900 900
 			'dtt_row' => $default ? 'DTTNUM' : $dttrow
901 901
 			);
902
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_row_wrapper.template.php';
903
-		return EEH_Template::display_template( $template, $dtt_display_template_args, TRUE);
902
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_row_wrapper.template.php';
903
+		return EEH_Template::display_template($template, $dtt_display_template_args, TRUE);
904 904
 	}
905 905
 
906 906
 
@@ -918,7 +918,7 @@  discard block
 block discarded – undo
918 918
 	 *
919 919
 	 * @return string Generated edit row.
920 920
 	 */
921
-	protected function _get_dtt_edit_row( $dttrow, $dtt, $default, $all_dtts ) {
921
+	protected function _get_dtt_edit_row($dttrow, $dtt, $default, $all_dtts) {
922 922
 
923 923
 		// if the incomign $dtt object is NOT an instance of EE_Datetime then force default to true.
924 924
 		$default = ! $dtt instanceof EE_Datetime ? true : false;
@@ -926,30 +926,30 @@  discard block
 block discarded – undo
926 926
 		$template_args = array(
927 927
 			'dtt_row' => $default ? 'DTTNUM' : $dttrow,
928 928
 			'event_datetimes_name' => $default ? 'DTTNAMEATTR' : 'edit_event_datetimes',
929
-			'edit_dtt_expanded' => '',//$this->_adminpage_obj->get_cpt_model_obj()->ID() > 0 ? '' : ' ee-edit-editing',
929
+			'edit_dtt_expanded' => '', //$this->_adminpage_obj->get_cpt_model_obj()->ID() > 0 ? '' : ' ee-edit-editing',
930 930
 			'DTT_ID' => $default ? '' : $dtt->ID(),
931 931
 			'DTT_name' => $default ? '' : $dtt->name(),
932 932
 			'DTT_description' => $default ? '' : $dtt->description(),
933
-			'DTT_EVT_start' => $default ? '' : $dtt->start_date( $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] ),
934
-			'DTT_EVT_end' => $default ? '' : $dtt->end_date( $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] ),
935
-			'DTT_reg_limit' => $default ? '' : $dtt->get_pretty('DTT_reg_limit','input'),
933
+			'DTT_EVT_start' => $default ? '' : $dtt->start_date($this->_date_format_strings['date'].' '.$this->_date_format_strings['time']),
934
+			'DTT_EVT_end' => $default ? '' : $dtt->end_date($this->_date_format_strings['date'].' '.$this->_date_format_strings['time']),
935
+			'DTT_reg_limit' => $default ? '' : $dtt->get_pretty('DTT_reg_limit', 'input'),
936 936
 			'DTT_order' => $default ? 'DTTNUM' : $dttrow,
937 937
 			'dtt_sold' => $default ? '0' : $dtt->get('DTT_sold'),
938
-			'clone_icon' => !empty( $dtt ) && $dtt->get('DTT_sold') > 0 ? '' : 'clone-icon ee-icon ee-icon-clone clickable',
939
-			'trash_icon' => !empty( $dtt ) && $dtt->get('DTT_sold') > 0  ? 'ee-lock-icon' : 'trash-icon dashicons dashicons-post-trash clickable'
938
+			'clone_icon' => ! empty($dtt) && $dtt->get('DTT_sold') > 0 ? '' : 'clone-icon ee-icon ee-icon-clone clickable',
939
+			'trash_icon' => ! empty($dtt) && $dtt->get('DTT_sold') > 0 ? 'ee-lock-icon' : 'trash-icon dashicons dashicons-post-trash clickable'
940 940
 			);
941 941
 
942
-		$template_args['show_trash'] = count( $all_dtts ) === 1 && $template_args['trash_icon'] !== 'ee-lock-icon' ? ' style="display:none"' : '';
942
+		$template_args['show_trash'] = count($all_dtts) === 1 && $template_args['trash_icon'] !== 'ee-lock-icon' ? ' style="display:none"' : '';
943 943
 
944 944
 		//allow filtering of template args at this point.
945
-		$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 );
945
+		$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);
946 946
 
947
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_edit_row.template.php';
948
-		return EEH_Template::display_template( $template, $template_args, TRUE );
947
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_edit_row.template.php';
948
+		return EEH_Template::display_template($template, $template_args, TRUE);
949 949
 	}
950 950
 
951 951
 
952
-	protected function _get_dtt_attached_tickets_row( $dttrow, $dtt, $datetime_tickets, $all_tickets, $default ) {
952
+	protected function _get_dtt_attached_tickets_row($dttrow, $dtt, $datetime_tickets, $all_tickets, $default) {
953 953
 
954 954
 		$template_args = array(
955 955
 			'dtt_row' => $default ? 'DTTNUM' : $dttrow,
@@ -957,47 +957,47 @@  discard block
 block discarded – undo
957 957
 			'DTT_description' => $default ? '' : $dtt->description(),
958 958
 			'datetime_tickets_list' => $default ? '<li class="hidden"></li>' : '',
959 959
 			'show_tickets_row' => ' style="display:none;"', //$default || $this->_adminpage_obj->get_cpt_model_obj()->ID() > 0 ? ' style="display:none;"' : '',
960
-			'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.
960
+			'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.
961 961
 			'DTT_ID' => $default ? '' : $dtt->ID()
962 962
 			);
963 963
 
964 964
 		//need to setup the list items (but only if this isnt' a default skeleton setup)
965
-		if ( !$default ) {
965
+		if ( ! $default) {
966 966
 			$tktrow = 1;
967
-			foreach ( $all_tickets as $ticket ) {
968
-				$template_args['datetime_tickets_list'] .= $this->_get_datetime_tickets_list_item( $dttrow, $tktrow, $dtt, $ticket, $datetime_tickets, $default );
967
+			foreach ($all_tickets as $ticket) {
968
+				$template_args['datetime_tickets_list'] .= $this->_get_datetime_tickets_list_item($dttrow, $tktrow, $dtt, $ticket, $datetime_tickets, $default);
969 969
 				$tktrow++;
970 970
 			}
971 971
 		}
972 972
 
973 973
 		//filter template args at this point
974
-		$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 );
974
+		$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);
975 975
 
976
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_attached_tickets_row.template.php';
977
-		return EEH_Template::display_template( $template, $template_args, TRUE );
976
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_attached_tickets_row.template.php';
977
+		return EEH_Template::display_template($template, $template_args, TRUE);
978 978
 	}
979 979
 
980 980
 
981 981
 
982
-	protected function _get_datetime_tickets_list_item( $dttrow, $tktrow, $dtt, $ticket, $datetime_tickets, $default ) {
983
-		$tktid = !empty( $ticket ) ? $ticket->ID() : 0;
984
-		$dtt_tkts = $dtt instanceof EE_Datetime && isset( $datetime_tickets[$dtt->ID()] ) ? $datetime_tickets[$dtt->ID()] : array();
982
+	protected function _get_datetime_tickets_list_item($dttrow, $tktrow, $dtt, $ticket, $datetime_tickets, $default) {
983
+		$tktid = ! empty($ticket) ? $ticket->ID() : 0;
984
+		$dtt_tkts = $dtt instanceof EE_Datetime && isset($datetime_tickets[$dtt->ID()]) ? $datetime_tickets[$dtt->ID()] : array();
985 985
 
986
-		$displayrow = !empty( $ticket ) ? $ticket->get('TKT_row') : 0;
986
+		$displayrow = ! empty($ticket) ? $ticket->get('TKT_row') : 0;
987 987
 		$template_args = array(
988 988
 			'dtt_row' => $default ? 'DTTNUM' : $dttrow,
989
-			'tkt_row' => $default && empty( $ticket ) ? 'TICKETNUM' : $tktrow,
989
+			'tkt_row' => $default && empty($ticket) ? 'TICKETNUM' : $tktrow,
990 990
 			'datetime_ticket_checked' => in_array($displayrow, $dtt_tkts) ? ' checked="checked"' : '',
991 991
 			'ticket_selected' => in_array($displayrow, $dtt_tkts) ? ' ticket-selected' : '',
992
-			'TKT_name' => $default && empty( $ticket ) ? 'TKTNAME' : $ticket->get('TKT_name'),
993
-			'tkt_status_class' => ( $default && empty( $ticket ) ) || $this->_is_creating_event ? ' tkt-status-' . EE_Ticket::onsale : ' tkt-status-' . $ticket->ticket_status(),
992
+			'TKT_name' => $default && empty($ticket) ? 'TKTNAME' : $ticket->get('TKT_name'),
993
+			'tkt_status_class' => ($default && empty($ticket)) || $this->_is_creating_event ? ' tkt-status-'.EE_Ticket::onsale : ' tkt-status-'.$ticket->ticket_status(),
994 994
 			);
995 995
 
996 996
 		//filter template args
997
-		$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 );
997
+		$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);
998 998
 
999
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_dtt_tickets_list.template.php';
1000
-		return EEH_Template::display_template( $template, $template_args, TRUE );
999
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_dtt_tickets_list.template.php';
1000
+		return EEH_Template::display_template($template, $template_args, TRUE);
1001 1001
 	}
1002 1002
 
1003 1003
 
@@ -1019,32 +1019,32 @@  discard block
 block discarded – undo
1019 1019
 	 *
1020 1020
 	 * @return [type] [description]
1021 1021
 	 */
1022
-	protected function _get_ticket_row( $tktrow, $ticket, $ticket_datetimes, $all_dtts, $default = FALSE, $all_tickets = array() ) {
1022
+	protected function _get_ticket_row($tktrow, $ticket, $ticket_datetimes, $all_dtts, $default = FALSE, $all_tickets = array()) {
1023 1023
 
1024 1024
 		//if $ticket is not an instance of EE_Ticket then force default to true.
1025
-		$default =  ! $ticket instanceof EE_Ticket ? true : false;
1025
+		$default = ! $ticket instanceof EE_Ticket ? true : false;
1026 1026
 
1027 1027
 
1028
-		$prices = !empty($ticket) && !$default ? $ticket->get_many_related('Price', array('default_where_conditions' => 'none', 'order_by' => array('PRC_order' => 'ASC') ) ) : array();
1028
+		$prices = ! empty($ticket) && ! $default ? $ticket->get_many_related('Price', array('default_where_conditions' => 'none', 'order_by' => array('PRC_order' => 'ASC'))) : array();
1029 1029
 
1030 1030
 		// 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.
1031
-		$default_dtt = $default || ($ticket instanceof EE_Ticket && $ticket->get('TKT_is_default') ) ? TRUE : FALSE;
1031
+		$default_dtt = $default || ($ticket instanceof EE_Ticket && $ticket->get('TKT_is_default')) ? TRUE : FALSE;
1032 1032
 
1033
-		$tkt_dtts = $ticket instanceof EE_Ticket && isset( $ticket_datetimes[$ticket->ID()] ) ? $ticket_datetimes[$ticket->ID()] : array();
1033
+		$tkt_dtts = $ticket instanceof EE_Ticket && isset($ticket_datetimes[$ticket->ID()]) ? $ticket_datetimes[$ticket->ID()] : array();
1034 1034
 
1035 1035
 		$ticket_subtotal = $default ? 0 : $ticket->get_ticket_subtotal();
1036
-		$base_price = $default ? NULL :  $ticket->base_price();
1036
+		$base_price = $default ? NULL : $ticket->base_price();
1037 1037
 		$count_price_mods = EEM_Price::instance()->get_all_default_prices(TRUE);
1038 1038
 
1039 1039
 		//breaking out complicated condition for ticket_status
1040
-		if ( $default ) {
1041
-			$ticket_status_class = ' tkt-status-' . EE_Ticket::onsale;
1040
+		if ($default) {
1041
+			$ticket_status_class = ' tkt-status-'.EE_Ticket::onsale;
1042 1042
 		} else {
1043
-			$ticket_status_class =  $ticket->is_default() ? ' tkt-status-' . EE_Ticket::onsale : ' tkt-status-' . $ticket->ticket_status();
1043
+			$ticket_status_class = $ticket->is_default() ? ' tkt-status-'.EE_Ticket::onsale : ' tkt-status-'.$ticket->ticket_status();
1044 1044
 		}
1045 1045
 
1046 1046
 		//breaking out complicated condition for TKT_taxable
1047
-		if ( $default ) {
1047
+		if ($default) {
1048 1048
 			$TKT_taxable = '';
1049 1049
 		} else {
1050 1050
 			$TKT_taxable = $ticket->get('TKT_taxable') ? ' checked="checked"' : '';
@@ -1059,19 +1059,19 @@  discard block
 block discarded – undo
1059 1059
 			'edit_tkt_expanded' => '',
1060 1060
 			'edit_tickets_name' => $default ? 'TICKETNAMEATTR' : 'edit_tickets',
1061 1061
 			'TKT_name' => $default ? '' : $ticket->get('TKT_name'),
1062
-			'TKT_start_date' => $default ? '' : $ticket->get_date('TKT_start_date', $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] ),
1063
-			'TKT_end_date' => $default ? '' : $ticket->get_date('TKT_end_date', $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time']  ),
1064
-			'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),
1062
+			'TKT_start_date' => $default ? '' : $ticket->get_date('TKT_start_date', $this->_date_format_strings['date'].' '.$this->_date_format_strings['time']),
1063
+			'TKT_end_date' => $default ? '' : $ticket->get_date('TKT_end_date', $this->_date_format_strings['date'].' '.$this->_date_format_strings['time']),
1064
+			'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),
1065 1065
 			'TKT_price' => $default ? '' : EEH_Template::format_currency($ticket->get_ticket_total_with_taxes(), FALSE, FALSE),
1066 1066
 			'TKT_price_code' => EE_Registry::instance()->CFG->currency->code,
1067 1067
 			'TKT_price_amount' => $default ? 0 : $ticket_subtotal,
1068
-			'TKT_qty' => $default ? '' : $ticket->get_pretty('TKT_qty','symbol'),
1069
-			'TKT_qty_for_input'=> $default ? '' : $ticket->get_pretty('TKT_qty','input'),
1070
-			'TKT_uses' => $default ? '' : $ticket->get_pretty('TKT_uses','input'),
1071
-			'TKT_min' => $default ? '' : ( $ticket->get('TKT_min') === -1 || $ticket->get('TKT_min') === 0 ? '' : $ticket->get('TKT_min') ),
1072
-			'TKT_max' => $default ? '' :  $ticket->get_pretty('TKT_max','input'),
1068
+			'TKT_qty' => $default ? '' : $ticket->get_pretty('TKT_qty', 'symbol'),
1069
+			'TKT_qty_for_input'=> $default ? '' : $ticket->get_pretty('TKT_qty', 'input'),
1070
+			'TKT_uses' => $default ? '' : $ticket->get_pretty('TKT_uses', 'input'),
1071
+			'TKT_min' => $default ? '' : ($ticket->get('TKT_min') === -1 || $ticket->get('TKT_min') === 0 ? '' : $ticket->get('TKT_min')),
1072
+			'TKT_max' => $default ? '' : $ticket->get_pretty('TKT_max', 'input'),
1073 1073
 			'TKT_sold' => $default ? 0 : $ticket->tickets_sold('ticket'),
1074
-			'TKT_registrations' => $default ? 0 : $ticket->count_registrations( array( array( 'STS_ID' => array( '!=', EEM_Registration::status_id_incomplete ) ) ) ),
1074
+			'TKT_registrations' => $default ? 0 : $ticket->count_registrations(array(array('STS_ID' => array('!=', EEM_Registration::status_id_incomplete)))),
1075 1075
 			'TKT_ID' => $default ? 0 : $ticket->get('TKT_ID'),
1076 1076
 			'TKT_description' => $default ? '' : $ticket->get('TKT_description'),
1077 1077
 			'TKT_is_default' => $default ? 0 : $ticket->get('TKT_is_default'),
@@ -1080,99 +1080,99 @@  discard block
 block discarded – undo
1080 1080
 			'ticket_price_rows' => '',
1081 1081
 			'TKT_base_price' => $default || ! $base_price instanceof EE_Price ? '' : $base_price->get_pretty('PRC_amount', 'localized_float'),
1082 1082
 			'TKT_base_price_ID' => $default || ! $base_price instanceof EE_Price ? 0 : $base_price->ID(),
1083
-			'show_price_modifier' => count($prices) > 1 || ( $default && $count_price_mods > 0 ) ? '' : ' style="display:none;"',
1084
-			'show_price_mod_button' => count($prices) > 1 || ( $default && $count_price_mods > 0 ) || ( !$default && $ticket->get('TKT_deleted') ) ? ' style="display:none;"' : '',
1083
+			'show_price_modifier' => count($prices) > 1 || ($default && $count_price_mods > 0) ? '' : ' style="display:none;"',
1084
+			'show_price_mod_button' => count($prices) > 1 || ($default && $count_price_mods > 0) || ( ! $default && $ticket->get('TKT_deleted')) ? ' style="display:none;"' : '',
1085 1085
 			'total_price_rows' => count($prices) > 1 ? count($prices) : 1,
1086 1086
 			'ticket_datetimes_list' => $default ? '<li class="hidden"></li>' : '',
1087 1087
 			'starting_ticket_datetime_rows' => $default || $default_dtt ? '' : implode(',', $tkt_dtts),
1088 1088
 			'ticket_datetime_rows' => $default ? '' : implode(',', $tkt_dtts),
1089
-			'existing_ticket_price_ids' => $default, '', implode(',', array_keys( $prices) ),
1089
+			'existing_ticket_price_ids' => $default, '', implode(',', array_keys($prices)),
1090 1090
 			'ticket_template_id' => $default ? 0 : $ticket->get('TTM_ID'),
1091 1091
 			'TKT_taxable' => $TKT_taxable,
1092 1092
 			'display_subtotal' => $ticket instanceof EE_Ticket && $ticket->get('TKT_taxable') ? '' : ' style="display:none"',
1093 1093
 			'price_currency_symbol' => EE_Registry::instance()->CFG->currency->sign,
1094
-			'TKT_subtotal_amount_display' => EEH_Template::format_currency($ticket_subtotal, FALSE, FALSE ),
1094
+			'TKT_subtotal_amount_display' => EEH_Template::format_currency($ticket_subtotal, FALSE, FALSE),
1095 1095
 			'TKT_subtotal_amount' => $ticket_subtotal,
1096
-			'tax_rows' => $this->_get_tax_rows( $tktrow, $ticket ),
1097
-			'disabled' => $ticket instanceof EE_Ticket && $ticket->get('TKT_deleted') ? TRUE: FALSE,
1096
+			'tax_rows' => $this->_get_tax_rows($tktrow, $ticket),
1097
+			'disabled' => $ticket instanceof EE_Ticket && $ticket->get('TKT_deleted') ? TRUE : FALSE,
1098 1098
 			'ticket_archive_class' => $ticket instanceof EE_Ticket && $ticket->get('TKT_deleted') ? ' ticket-archived' : '',
1099 1099
 			'trash_icon' => $ticket instanceof EE_Ticket && $ticket->get('TKT_deleted') ? 'ee-lock-icon ' : 'trash-icon dashicons dashicons-post-trash clickable',
1100 1100
 			'clone_icon' => $ticket instanceof EE_Ticket && $ticket->get('TKT_deleted') ? '' : 'clone-icon ee-icon ee-icon-clone clickable'
1101 1101
 			);
1102 1102
 
1103
-		$template_args['trash_hidden'] = count( $all_tickets ) === 1 && $template_args['trash_icon'] != 'ee-lock-icon' ? ' style="display:none"' : '';
1103
+		$template_args['trash_hidden'] = count($all_tickets) === 1 && $template_args['trash_icon'] != 'ee-lock-icon' ? ' style="display:none"' : '';
1104 1104
 
1105 1105
 		//handle rows that should NOT be empty
1106
-		if ( empty( $template_args['TKT_start_date'] ) ) {
1106
+		if (empty($template_args['TKT_start_date'])) {
1107 1107
 			//if empty then the start date will be now.
1108
-			$template_args['TKT_start_date'] = date( $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] , current_time('timestamp'));
1109
-			$template_args['tkt_status_class'] = ' tkt-status-' . EE_Ticket::onsale;
1108
+			$template_args['TKT_start_date'] = date($this->_date_format_strings['date'].' '.$this->_date_format_strings['time'], current_time('timestamp'));
1109
+			$template_args['tkt_status_class'] = ' tkt-status-'.EE_Ticket::onsale;
1110 1110
 		}
1111 1111
 
1112
-		if ( empty( $template_args['TKT_end_date'] ) ) {
1112
+		if (empty($template_args['TKT_end_date'])) {
1113 1113
 
1114 1114
 			//get the earliest datetime (if present);
1115
-			$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;
1115
+			$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;
1116 1116
 
1117
-			if ( !empty( $earliest_dtt ) ) {
1118
-				$template_args['TKT_end_date'] = $earliest_dtt->get_datetime('DTT_EVT_start', $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] );
1117
+			if ( ! empty($earliest_dtt)) {
1118
+				$template_args['TKT_end_date'] = $earliest_dtt->get_datetime('DTT_EVT_start', $this->_date_format_strings['date'].' '.$this->_date_format_strings['time']);
1119 1119
 			} else {
1120 1120
 				//default so let's just use what's been set for the default date-time which is 30 days from now.
1121
-				$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") )  );
1121
+				$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")));
1122 1122
 			}
1123
-			$template_args['tkt_status_class'] = ' tkt-status-' . EE_Ticket::onsale;
1123
+			$template_args['tkt_status_class'] = ' tkt-status-'.EE_Ticket::onsale;
1124 1124
 		}
1125 1125
 
1126 1126
 		//generate ticket_datetime items
1127
-		if ( ! $default ) {
1127
+		if ( ! $default) {
1128 1128
 			$dttrow = 1;
1129
-			foreach ( $all_dtts as $dtt ) {
1130
-				$template_args['ticket_datetimes_list'] .= $this->_get_ticket_datetime_list_item( $dttrow, $tktrow, $dtt, $ticket, $ticket_datetimes, $default );
1129
+			foreach ($all_dtts as $dtt) {
1130
+				$template_args['ticket_datetimes_list'] .= $this->_get_ticket_datetime_list_item($dttrow, $tktrow, $dtt, $ticket, $ticket_datetimes, $default);
1131 1131
 				$dttrow++;
1132 1132
 			}
1133 1133
 		}
1134 1134
 
1135 1135
 		$prcrow = 1;
1136
-		foreach ( $prices as $price ) {
1137
-			if ( $price->is_base_price() ) {
1136
+		foreach ($prices as $price) {
1137
+			if ($price->is_base_price()) {
1138 1138
 				$prcrow++;
1139 1139
 				continue;
1140 1140
 			}
1141
-			$show_trash = ( count( $prices ) > 1 && $prcrow === 1 ) || count( $prices ) === 1  ? FALSE : TRUE;
1142
-			$show_create = count( $prices ) > 1 && count( $prices ) !== $prcrow ? FALSE : TRUE;
1143
-			$template_args['ticket_price_rows'] .= $this->_get_ticket_price_row( $tktrow, $prcrow, $price, $default, $ticket, $show_trash, $show_create );
1141
+			$show_trash = (count($prices) > 1 && $prcrow === 1) || count($prices) === 1 ? FALSE : TRUE;
1142
+			$show_create = count($prices) > 1 && count($prices) !== $prcrow ? FALSE : TRUE;
1143
+			$template_args['ticket_price_rows'] .= $this->_get_ticket_price_row($tktrow, $prcrow, $price, $default, $ticket, $show_trash, $show_create);
1144 1144
 			$prcrow++;
1145 1145
 		}
1146 1146
 
1147 1147
 		//filter $template_args
1148
-		$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 );
1148
+		$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);
1149 1149
 
1150
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_ticket_row.template.php';
1151
-		return EEH_Template::display_template( $template, $template_args, TRUE );
1150
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_ticket_row.template.php';
1151
+		return EEH_Template::display_template($template, $template_args, TRUE);
1152 1152
 	}
1153 1153
 
1154 1154
 
1155 1155
 
1156 1156
 
1157 1157
 
1158
-	protected function _get_tax_rows( $tktrow, $ticket ) {
1158
+	protected function _get_tax_rows($tktrow, $ticket) {
1159 1159
 		$tax_rows = '';
1160
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_ticket_tax_row.template.php';
1160
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_ticket_tax_row.template.php';
1161 1161
 		$template_args = array();
1162
-		$taxes = empty( $ticket ) ? EE_Taxes::get_taxes_for_admin() : $ticket->get_ticket_taxes_for_admin();
1163
-		foreach ( $taxes as $tax ) {
1164
-			$tax_added = $this->_get_tax_added( $tax, $ticket );
1162
+		$taxes = empty($ticket) ? EE_Taxes::get_taxes_for_admin() : $ticket->get_ticket_taxes_for_admin();
1163
+		foreach ($taxes as $tax) {
1164
+			$tax_added = $this->_get_tax_added($tax, $ticket);
1165 1165
 			$template_args = array(
1166
-				'display_tax' => !empty( $ticket ) && $ticket->get('TKT_taxable') ? '' : ' style="display:none;"',
1166
+				'display_tax' => ! empty($ticket) && $ticket->get('TKT_taxable') ? '' : ' style="display:none;"',
1167 1167
 				'tax_id' => $tax->ID(),
1168 1168
 				'tkt_row' => $tktrow,
1169 1169
 				'tax_label' => $tax->get('PRC_name'),
1170 1170
 				'tax_added' => $tax_added,
1171
-				'tax_added_display' => EEH_Template::format_currency($tax_added, FALSE, FALSE ),
1171
+				'tax_added_display' => EEH_Template::format_currency($tax_added, FALSE, FALSE),
1172 1172
 				'tax_amount' => $tax->get('PRC_amount')
1173 1173
 				);
1174
-			$template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_tax_rows__template_args', $template_args, $tktrow, $ticket, $this->_is_creating_event  );
1175
-			$tax_rows .= EEH_Template::display_template( $template, $template_args, TRUE );
1174
+			$template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_tax_rows__template_args', $template_args, $tktrow, $ticket, $this->_is_creating_event);
1175
+			$tax_rows .= EEH_Template::display_template($template, $template_args, TRUE);
1176 1176
 		}
1177 1177
 
1178 1178
 
@@ -1180,81 +1180,81 @@  discard block
 block discarded – undo
1180 1180
 	}
1181 1181
 
1182 1182
 
1183
-	protected function _get_tax_added( EE_Price $tax, $ticket ) {
1184
-		$subtotal = empty( $ticket ) ? 0 : $ticket->get_ticket_subtotal();
1183
+	protected function _get_tax_added(EE_Price $tax, $ticket) {
1184
+		$subtotal = empty($ticket) ? 0 : $ticket->get_ticket_subtotal();
1185 1185
 		return $subtotal * $tax->get('PRC_amount') / 100;
1186 1186
 	}
1187 1187
 
1188 1188
 
1189 1189
 
1190 1190
 
1191
-	protected function _get_ticket_price_row( $tktrow, $prcrow, $price, $default, $ticket, $show_trash = TRUE, $show_create = TRUE ) {
1192
-		$send_disabled = !empty( $ticket ) && $ticket->get('TKT_deleted') ? TRUE : FALSE;
1191
+	protected function _get_ticket_price_row($tktrow, $prcrow, $price, $default, $ticket, $show_trash = TRUE, $show_create = TRUE) {
1192
+		$send_disabled = ! empty($ticket) && $ticket->get('TKT_deleted') ? TRUE : FALSE;
1193 1193
 		$template_args = array(
1194 1194
 			'tkt_row' => $default && empty($ticket) ? 'TICKETNUM' : $tktrow,
1195 1195
 			'PRC_order' => $default && empty($price) ? 'PRICENUM' : $prcrow,
1196 1196
 			'edit_prices_name' => $default && empty($price) ? 'PRICENAMEATTR' : 'edit_prices',
1197
-			'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 ),
1197
+			'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),
1198 1198
 			'PRC_ID' => $default && empty($price) ? 0 : $price->ID(),
1199 1199
 			'PRC_is_default' => $default && empty($price) ? 0 : $price->get('PRC_is_default'),
1200 1200
 			'PRC_name' => $default && empty($price) ? '' : $price->get('PRC_name'),
1201 1201
 			'price_currency_symbol' => EE_Registry::instance()->CFG->currency->sign,
1202 1202
 			'show_plus_or_minus' => $default && empty($price) ? '' : ' style="display:none;"',
1203
-			'show_plus' => $default && empty( $price ) ? ' style="display:none;"' : ( $price->is_discount() || $price->is_base_price() ? ' style="display:none;"' : ''),
1204
-			'show_minus' => $default && empty( $price ) ? ' style="display:none;"' : ($price->is_discount() ? '' : ' style="display:none;"'),
1205
-			'show_currency_symbol' => $default && empty( $price ) ? ' style="display:none"' : ($price->is_percent() ? ' style="display:none"' : '' ),
1206
-			'PRC_amount' => $default && empty( $price ) ? 0 : $price->get_pretty('PRC_amount', 'localized_float'),
1207
-			'show_percentage' => $default && empty( $price ) ? ' style="display:none;"' : ( $price->is_percent() ? '' : ' style="display:none;"' ),
1203
+			'show_plus' => $default && empty($price) ? ' style="display:none;"' : ($price->is_discount() || $price->is_base_price() ? ' style="display:none;"' : ''),
1204
+			'show_minus' => $default && empty($price) ? ' style="display:none;"' : ($price->is_discount() ? '' : ' style="display:none;"'),
1205
+			'show_currency_symbol' => $default && empty($price) ? ' style="display:none"' : ($price->is_percent() ? ' style="display:none"' : ''),
1206
+			'PRC_amount' => $default && empty($price) ? 0 : $price->get_pretty('PRC_amount', 'localized_float'),
1207
+			'show_percentage' => $default && empty($price) ? ' style="display:none;"' : ($price->is_percent() ? '' : ' style="display:none;"'),
1208 1208
 			'show_trash_icon' => $show_trash ? '' : ' style="display:none;"',
1209 1209
 			'show_create_button' => $show_create ? '' : ' style="display:none;"',
1210
-			'PRC_desc' => $default && empty( $price ) ? '' : $price->get('PRC_desc'),
1211
-			'disabled' => !empty( $ticket ) && $ticket->get('TKT_deleted') ? TRUE : FALSE
1210
+			'PRC_desc' => $default && empty($price) ? '' : $price->get('PRC_desc'),
1211
+			'disabled' => ! empty($ticket) && $ticket->get('TKT_deleted') ? TRUE : FALSE
1212 1212
 			);
1213 1213
 
1214
-	$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 );
1214
+	$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);
1215 1215
 
1216
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_ticket_price_row.template.php';
1217
-		return EEH_Template::display_template( $template, $template_args, TRUE );
1216
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_ticket_price_row.template.php';
1217
+		return EEH_Template::display_template($template, $template_args, TRUE);
1218 1218
 	}
1219 1219
 
1220 1220
 
1221
-	protected function _get_price_type_selector( $tktrow, $prcrow, $price, $default, $disabled = FALSE ) {
1222
-		if ( $price->is_base_price() ) {
1223
-			return $this->_get_base_price_template( $tktrow, $prcrow, $price, $default );
1221
+	protected function _get_price_type_selector($tktrow, $prcrow, $price, $default, $disabled = FALSE) {
1222
+		if ($price->is_base_price()) {
1223
+			return $this->_get_base_price_template($tktrow, $prcrow, $price, $default);
1224 1224
 		} else {
1225
-			return $this->_get_price_modifier_template( $tktrow, $prcrow, $price, $default, $disabled );
1225
+			return $this->_get_price_modifier_template($tktrow, $prcrow, $price, $default, $disabled);
1226 1226
 		}
1227 1227
 
1228 1228
 	}
1229 1229
 
1230 1230
 
1231
-	protected function _get_base_price_template( $tktrow, $prcrow, $price, $default ) {
1231
+	protected function _get_base_price_template($tktrow, $prcrow, $price, $default) {
1232 1232
 		$template_args = array(
1233 1233
 				'tkt_row' => $default ? 'TICKETNUM' : $tktrow,
1234
-				'PRC_order' => $default && empty( $price ) ? 'PRICENUM' : $prcrow,
1235
-				'PRT_ID' => $default && empty( $price ) ? 1 : $price->get('PRT_ID'),
1234
+				'PRC_order' => $default && empty($price) ? 'PRICENUM' : $prcrow,
1235
+				'PRT_ID' => $default && empty($price) ? 1 : $price->get('PRT_ID'),
1236 1236
 				'PRT_name' => __('Price', 'event_espresso'),
1237 1237
 				'price_selected_operator' => '+',
1238 1238
 				'price_selected_is_percent' => 0
1239 1239
 			);
1240
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_price_type_base.template.php';
1240
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_price_type_base.template.php';
1241 1241
 
1242
-		$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 );
1242
+		$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);
1243 1243
 
1244
-		return EEH_Template::display_template( $template, $template_args, TRUE );
1244
+		return EEH_Template::display_template($template, $template_args, TRUE);
1245 1245
 	}
1246 1246
 
1247 1247
 
1248 1248
 
1249
-	protected function _get_price_modifier_template( $tktrow, $prcrow, $price, $default, $disabled = FALSE ) {
1250
-		$select_name = $default && empty( $price ) ? 'edit_prices[TICKETNUM][PRICENUM][PRT_ID]' : 'edit_prices[' . $tktrow . '][' . $prcrow . '][PRT_ID]';
1251
-		$price_types = EE_Registry::instance()->load_model('Price_Type')->get_all(array( array('OR' => array('PBT_ID' => '2', 'PBT_ID*' => '3' ) ) ) );
1252
-		$price_option_span_template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_price_option_span.template.php';
1253
-		$all_price_types = $default && empty( $price ) ? array(array('id' => 0, 'text' => __('Select Modifier', 'event_espresso')) ) : array();
1254
-		$selected_price_type_id = $default && empty( $price ) ? 0 : $price->type();
1249
+	protected function _get_price_modifier_template($tktrow, $prcrow, $price, $default, $disabled = FALSE) {
1250
+		$select_name = $default && empty($price) ? 'edit_prices[TICKETNUM][PRICENUM][PRT_ID]' : 'edit_prices['.$tktrow.']['.$prcrow.'][PRT_ID]';
1251
+		$price_types = EE_Registry::instance()->load_model('Price_Type')->get_all(array(array('OR' => array('PBT_ID' => '2', 'PBT_ID*' => '3'))));
1252
+		$price_option_span_template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_price_option_span.template.php';
1253
+		$all_price_types = $default && empty($price) ? array(array('id' => 0, 'text' => __('Select Modifier', 'event_espresso'))) : array();
1254
+		$selected_price_type_id = $default && empty($price) ? 0 : $price->type();
1255 1255
 		$price_option_spans = '';
1256 1256
 		//setup pricetypes for selector
1257
-		foreach ( $price_types as $price_type ) {
1257
+		foreach ($price_types as $price_type) {
1258 1258
 			$all_price_types[] = array(
1259 1259
 				'id' => $price_type->ID(),
1260 1260
 				'text' => $price_type->get('PRT_name'),
@@ -1266,50 +1266,50 @@  discard block
 block discarded – undo
1266 1266
 				'PRT_operator' => $price_type->is_discount() ? '-' : '+',
1267 1267
 				'PRT_is_percent' => $price_type->get('PRT_is_percent') ? 1 : 0
1268 1268
 				);
1269
-			$price_option_spans .= EEH_Template::display_template($price_option_span_template, $spanargs, TRUE );
1269
+			$price_option_spans .= EEH_Template::display_template($price_option_span_template, $spanargs, TRUE);
1270 1270
 		}
1271 1271
 
1272
-		$select_params = $disabled ? 'style="width:auto;" disabled'  : 'style="width:auto;"';
1272
+		$select_params = $disabled ? 'style="width:auto;" disabled' : 'style="width:auto;"';
1273 1273
 		$main_name = $select_name;
1274
-		$select_name = $disabled ? 'archive_price[' . $tktrow . '][' . $prcrow . '][PRT_ID]' : $main_name;
1274
+		$select_name = $disabled ? 'archive_price['.$tktrow.']['.$prcrow.'][PRT_ID]' : $main_name;
1275 1275
 
1276 1276
 		$template_args = array(
1277 1277
 			'tkt_row' => $default ? 'TICKETNUM' : $tktrow,
1278
-			'PRC_order' => $default && empty( $price ) ? 'PRICENUM' : $prcrow,
1279
-			'price_modifier_selector' => EEH_Form_Fields::select_input( $select_name, $all_price_types, $selected_price_type_id, $select_params, 'edit-price-PRT_ID' ),
1278
+			'PRC_order' => $default && empty($price) ? 'PRICENUM' : $prcrow,
1279
+			'price_modifier_selector' => EEH_Form_Fields::select_input($select_name, $all_price_types, $selected_price_type_id, $select_params, 'edit-price-PRT_ID'),
1280 1280
 			'main_name' => $main_name,
1281 1281
 			'selected_price_type_id' => $selected_price_type_id,
1282 1282
 			'price_option_spans' => $price_option_spans,
1283
-			'price_selected_operator' => $default && empty( $price ) ? '' : ( $price->is_discount() ? '-' : '+' ),
1284
-			'price_selected_is_percent' => $default && empty( $price ) ? '' : ( $price->is_percent() ? 1 : 0 ),
1283
+			'price_selected_operator' => $default && empty($price) ? '' : ($price->is_discount() ? '-' : '+'),
1284
+			'price_selected_is_percent' => $default && empty($price) ? '' : ($price->is_percent() ? 1 : 0),
1285 1285
 			'disabled' => $disabled
1286 1286
 			);
1287 1287
 
1288
-		$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 );
1288
+		$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);
1289 1289
 
1290
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_price_modifier_selector.template.php';
1290
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_price_modifier_selector.template.php';
1291 1291
 
1292
-		return EEH_Template::display_template( $template, $template_args, TRUE );
1292
+		return EEH_Template::display_template($template, $template_args, TRUE);
1293 1293
 	}
1294 1294
 
1295 1295
 
1296 1296
 
1297
-	protected function _get_ticket_datetime_list_item( $dttrow, $tktrow, $dtt, $ticket, $ticket_datetimes, $default ) {
1298
-		$dttid = !empty($dtt) ? $dtt->ID() : 0;
1299
-		$displayrow = !empty($dtt) ? $dtt->get('DTT_order') : 0;
1300
-		$tkt_dtts = $ticket instanceof EE_Ticket && isset( $ticket_datetimes[$ticket->ID()] ) ? $ticket_datetimes[$ticket->ID()] : array();
1297
+	protected function _get_ticket_datetime_list_item($dttrow, $tktrow, $dtt, $ticket, $ticket_datetimes, $default) {
1298
+		$dttid = ! empty($dtt) ? $dtt->ID() : 0;
1299
+		$displayrow = ! empty($dtt) ? $dtt->get('DTT_order') : 0;
1300
+		$tkt_dtts = $ticket instanceof EE_Ticket && isset($ticket_datetimes[$ticket->ID()]) ? $ticket_datetimes[$ticket->ID()] : array();
1301 1301
 		$template_args = array(
1302
-			'dtt_row' => $default && empty( $dtt ) ? 'DTTNUM' : $dttrow,
1302
+			'dtt_row' => $default && empty($dtt) ? 'DTTNUM' : $dttrow,
1303 1303
 			'tkt_row' => $default ? 'TICKETNUM' : $tktrow,
1304
-			'ticket_datetime_selected' => in_array( $displayrow, $tkt_dtts ) ? ' ticket-selected' : '',
1305
-			'ticket_datetime_checked' => in_array( $displayrow, $tkt_dtts ) ? ' checked="checked"' : '',
1306
-			'DTT_name' => $default && empty( $dtt ) ? 'DTTNAME' : $dtt->get_dtt_display_name( TRUE ),
1304
+			'ticket_datetime_selected' => in_array($displayrow, $tkt_dtts) ? ' ticket-selected' : '',
1305
+			'ticket_datetime_checked' => in_array($displayrow, $tkt_dtts) ? ' checked="checked"' : '',
1306
+			'DTT_name' => $default && empty($dtt) ? 'DTTNAME' : $dtt->get_dtt_display_name(TRUE),
1307 1307
 			'tkt_status_class' => '',
1308 1308
 			);
1309 1309
 
1310
-		$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 );
1311
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_ticket_datetimes_list_item.template.php';
1312
-		return EEH_Template::display_template( $template, $template_args, TRUE );
1310
+		$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);
1311
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_ticket_datetimes_list_item.template.php';
1312
+		return EEH_Template::display_template($template, $template_args, TRUE);
1313 1313
 	}
1314 1314
 
1315 1315
 
@@ -1317,53 +1317,53 @@  discard block
 block discarded – undo
1317 1317
 	protected function _get_ticket_js_structure($all_dtts, $all_tickets) {
1318 1318
 		$template_args = array(
1319 1319
 			'default_datetime_edit_row' => $this->_get_dtt_edit_row('DTTNUM', NULL, TRUE, $all_dtts),
1320
-			'default_ticket_row' => $this->_get_ticket_row( 'TICKETNUM', NULL, array(), array(), TRUE),
1321
-			'default_price_row' => $this->_get_ticket_price_row( 'TICKETNUM', 'PRICENUM', NULL, TRUE, NULL ),
1320
+			'default_ticket_row' => $this->_get_ticket_row('TICKETNUM', NULL, array(), array(), TRUE),
1321
+			'default_price_row' => $this->_get_ticket_price_row('TICKETNUM', 'PRICENUM', NULL, TRUE, NULL),
1322 1322
 			'default_price_rows' => '',
1323 1323
 			'default_base_price_amount' => 0,
1324 1324
 			'default_base_price_name' => '',
1325 1325
 			'default_base_price_description' => '',
1326
-			'default_price_modifier_selector_row' => $this->_get_price_modifier_template( 'TICKETNUM', 'PRICENUM', NULL, TRUE ),
1327
-			'default_available_tickets_for_datetime' => $this->_get_dtt_attached_tickets_row( 'DTTNUM', NULL, array(), array(), TRUE ),
1326
+			'default_price_modifier_selector_row' => $this->_get_price_modifier_template('TICKETNUM', 'PRICENUM', NULL, TRUE),
1327
+			'default_available_tickets_for_datetime' => $this->_get_dtt_attached_tickets_row('DTTNUM', NULL, array(), array(), TRUE),
1328 1328
 			'existing_available_datetime_tickets_list' => '',
1329 1329
 			'existing_available_ticket_datetimes_list' => '',
1330
-			'new_available_datetime_ticket_list_item' => $this->_get_datetime_tickets_list_item( 'DTTNUM', 'TICKETNUM', NULL, NULL, array(), TRUE ),
1331
-			'new_available_ticket_datetime_list_item' => $this->_get_ticket_datetime_list_item( 'DTTNUM', 'TICKETNUM', NULL, NULL, array(), TRUE )
1330
+			'new_available_datetime_ticket_list_item' => $this->_get_datetime_tickets_list_item('DTTNUM', 'TICKETNUM', NULL, NULL, array(), TRUE),
1331
+			'new_available_ticket_datetime_list_item' => $this->_get_ticket_datetime_list_item('DTTNUM', 'TICKETNUM', NULL, NULL, array(), TRUE)
1332 1332
 			);
1333 1333
 
1334 1334
 		$tktrow = 1;
1335
-		foreach ( $all_tickets as $ticket ) {
1336
-			$template_args['existing_available_datetime_tickets_list'] .= $this->_get_datetime_tickets_list_item( 'DTTNUM', $tktrow, NULL, $ticket, array(), TRUE );
1335
+		foreach ($all_tickets as $ticket) {
1336
+			$template_args['existing_available_datetime_tickets_list'] .= $this->_get_datetime_tickets_list_item('DTTNUM', $tktrow, NULL, $ticket, array(), TRUE);
1337 1337
 			$tktrow++;
1338 1338
 		}
1339 1339
 
1340 1340
 
1341 1341
 		$dttrow = 1;
1342
-		foreach ( $all_dtts as $dtt ) {
1343
-			$template_args['existing_available_ticket_datetimes_list'] .= $this->_get_ticket_datetime_list_item( $dttrow, 'TICKETNUM', $dtt, NULL, array(), TRUE );
1342
+		foreach ($all_dtts as $dtt) {
1343
+			$template_args['existing_available_ticket_datetimes_list'] .= $this->_get_ticket_datetime_list_item($dttrow, 'TICKETNUM', $dtt, NULL, array(), TRUE);
1344 1344
 			$dttrow++;
1345 1345
 		}
1346 1346
 
1347 1347
 		$default_prices = EE_Registry::instance()->load_model('Price')->get_all_default_prices();
1348 1348
 		$prcrow = 1;
1349
-		foreach ( $default_prices as $price ) {
1350
-			if ( $price->is_base_price() ) {
1349
+		foreach ($default_prices as $price) {
1350
+			if ($price->is_base_price()) {
1351 1351
 				$template_args['default_base_price_amount'] = $price->get_pretty('PRC_amount', 'localized_float');
1352 1352
 				$template_args['default_base_price_name'] = $price->get('PRC_name');
1353 1353
 				$template_args['default_base_price_description'] = $price->get('PRC_desc');
1354 1354
 				$prcrow++;
1355 1355
 				continue;
1356 1356
 			}
1357
-			$show_trash = ( count( $default_prices ) > 1 && $prcrow === 1 ) || count( $default_prices ) === 1  ? FALSE : TRUE;
1358
-			$show_create = count( $default_prices ) > 1 && count( $default_prices ) !== $prcrow ? FALSE : TRUE;
1359
-			$template_args['default_price_rows'] .= $this->_get_ticket_price_row( 'TICKETNUM', $prcrow, $price, TRUE, NULL, $show_trash, $show_create );
1357
+			$show_trash = (count($default_prices) > 1 && $prcrow === 1) || count($default_prices) === 1 ? FALSE : TRUE;
1358
+			$show_create = count($default_prices) > 1 && count($default_prices) !== $prcrow ? FALSE : TRUE;
1359
+			$template_args['default_price_rows'] .= $this->_get_ticket_price_row('TICKETNUM', $prcrow, $price, TRUE, NULL, $show_trash, $show_create);
1360 1360
 			$prcrow++;
1361 1361
 		}
1362 1362
 
1363
-		$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 );
1363
+		$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);
1364 1364
 
1365
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_ticket_js_structure.template.php';
1366
-		return EEH_Template::display_template( $template, $template_args, TRUE );
1365
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_ticket_js_structure.template.php';
1366
+		return EEH_Template::display_template($template, $template_args, TRUE);
1367 1367
 	}
1368 1368
 
1369 1369
 
Please login to merge, or discard this patch.
payment_methods/Aim/help_tabs/payment_methods_overview_aim.help_tab.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@  discard block
 block discarded – undo
3 3
 <?php _e('Adjust the settings for the Authorize.net AIM payment gateway.', 'event_espresso'); ?>
4 4
 </p>
5 5
 <p>
6
-<?php printf( __( 'See %1$shere%2$s for list of currencies supported by Authorize.net AIM.', 'event_espresso' ), "<a href='http://www.authorize.net/international/'  target='_blank'>","</a>" ); ?>
6
+<?php printf(__('See %1$shere%2$s for list of currencies supported by Authorize.net AIM.', 'event_espresso'), "<a href='http://www.authorize.net/international/'  target='_blank'>", "</a>"); ?>
7 7
 </p>
8 8
 <h3><?php _e('Authorize.net AIM Settings', 'event_espresso'); ?></h3>
9 9
 <ul>
@@ -28,12 +28,12 @@  discard block
 block discarded – undo
28 28
 <?php _e('By logging into Authorize.net, you can change which payment fields are required by Authorize.net when processing payments. These settings affect both the Advanced Integration Method (AIM, this) and the Simple Integration Method (SIM, different). The payment method settings "Excluded Payment Form Fields" and "Required Payment Form Fields" allow you to change the billing form in Event Espresso to reflect your payment form settings in Authorize.net.', 'event_espresso'); ?>
29 29
 <br>
30 30
 <?php printf( 
31
-		__( 'To change your payment form settings in Authorize.net, %1$slog in to authorize.net%2$s, go to %3$sAccount then Payment Form%2$s, then %4$sForm Fields%2$s. It will look similar to %5$sthis%2$s. If you make a field required in Authorize.net, you should also make it required in Event Espresso. If it isn\'t required in Authorize.net, and you want to simplify the billing form in Event Espresso, you can exclude it from the Event Espresso Form too.'),
31
+		__('To change your payment form settings in Authorize.net, %1$slog in to authorize.net%2$s, go to %3$sAccount then Payment Form%2$s, then %4$sForm Fields%2$s. It will look similar to %5$sthis%2$s. If you make a field required in Authorize.net, you should also make it required in Event Espresso. If it isn\'t required in Authorize.net, and you want to simplify the billing form in Event Espresso, you can exclude it from the Event Espresso Form too.'),
32 32
 		'<a href="http://authorize.net" target="_blank">',
33 33
 		'</a>',
34 34
 		'<a href="https://monosnap.com/file/nebVteOkEXcdDIos88SojStWOifP23" target="_blank">',
35 35
 		'<a href="https://monosnap.com/file/WyxGJtev87TcDmdGBEZ2oi1xaBIQAm" target="_blank">',
36
-		'<a href="https://monosnap.com/image/DbCJNfEesWXeSNUs1wLIpGYODFw52m" target="_blank">');?>
36
+		'<a href="https://monosnap.com/image/DbCJNfEesWXeSNUs1wLIpGYODFw52m" target="_blank">'); ?>
37 37
 </li>
38 38
 <li>
39 39
 <strong><?php _e('Button Image URL', 'event_espresso'); ?></strong><br />
Please login to merge, or discard this patch.