Completed
Branch BUG-9680-compress-dompdf-files... (43e183)
by
unknown
78:18 queued 66:20
created
admin_pages/transactions/Transactions_Admin_Page.core.php 2 patches
Indentation   +59 added lines, -59 removed lines patch added patch discarded remove patch
@@ -106,9 +106,9 @@  discard block
 block discarded – undo
106 106
 
107 107
 	/**
108 108
 	 * 		grab url requests and route them
109
-	*		@access private
110
-	*		@return void
111
-	*/
109
+	 *		@access private
110
+	 *		@return void
111
+	 */
112 112
 	public function _set_page_routes() {
113 113
 
114 114
 		$this->_set_transaction_status_array();
@@ -263,10 +263,10 @@  discard block
 block discarded – undo
263 263
 	/**
264 264
 	 * _set_transaction_status_array
265 265
 	 * sets list of transaction statuses
266
-	*
266
+	 *
267 267
 	 * @access private
268
-	*	@return void
269
-	*/
268
+	 *	@return void
269
+	 */
270 270
 	private function _set_transaction_status_array() {
271 271
 		self::$_txn_status = EEM_Transaction::instance()->status_array(TRUE);
272 272
 	}
@@ -288,10 +288,10 @@  discard block
 block discarded – undo
288 288
 
289 289
 	/**
290 290
 	 * 	get list of payment statuses
291
-	*
291
+	 *
292 292
 	 * @access private
293
-	*	@return void
294
-	*/
293
+	 *	@return void
294
+	 */
295 295
 	private function _get_payment_status_array() {
296 296
 		self::$_pay_status = EEM_Payment::instance()->status_array(TRUE);
297 297
 		$this->_template_args['payment_status'] = self::$_pay_status;
@@ -399,18 +399,18 @@  discard block
 block discarded – undo
399 399
 		if ( is_object( $this->_transaction) )
400 400
 			return; //get out we've already set the object
401 401
 
402
-	    $TXN = EEM_Transaction::instance();
402
+		$TXN = EEM_Transaction::instance();
403 403
 
404
-	    $TXN_ID = ( ! empty( $this->_req_data['TXN_ID'] )) ? absint( $this->_req_data['TXN_ID'] ) : FALSE;
404
+		$TXN_ID = ( ! empty( $this->_req_data['TXN_ID'] )) ? absint( $this->_req_data['TXN_ID'] ) : FALSE;
405 405
 
406
-	    //get transaction object
407
-	    $this->_transaction = $TXN->get_one_by_ID($TXN_ID);
408
-	    $this->_session = !empty( $this->_transaction ) ? $this->_transaction->get('TXN_session_data') : NULL;
406
+		//get transaction object
407
+		$this->_transaction = $TXN->get_one_by_ID($TXN_ID);
408
+		$this->_session = !empty( $this->_transaction ) ? $this->_transaction->get('TXN_session_data') : NULL;
409 409
 
410 410
 	 	if ( empty( $this->_transaction ) ) {
411
-	    	$error_msg = esc_html__('An error occurred and the details for Transaction ID #', 'event_espresso') . $TXN_ID .  esc_html__(' could not be retrieved.', 'event_espresso');
411
+			$error_msg = esc_html__('An error occurred and the details for Transaction ID #', 'event_espresso') . $TXN_ID .  esc_html__(' could not be retrieved.', 'event_espresso');
412 412
 			EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ );
413
-	    }
413
+		}
414 414
 	}
415 415
 
416 416
 
@@ -525,12 +525,12 @@  discard block
 block discarded – undo
525 525
 
526 526
 
527 527
 	/**
528
-	* 	_transaction_details
528
+	 * 	_transaction_details
529 529
 	 * generates HTML for the View Transaction Details Admin page
530
-	*
530
+	 *
531 531
 	 * @access protected
532
-	*	@return void
533
-	*/
532
+	 *	@return void
533
+	 */
534 534
 	protected function _transaction_details() {
535 535
 		do_action( 'AHEE__Transactions_Admin_Page__transaction_details__start', $this->_transaction );
536 536
 
@@ -581,7 +581,7 @@  discard block
 block discarded – undo
581 581
 						'button secondary-button right',
582 582
 						'dashicons dashicons-email-alt'
583 583
 					)
584
-				    : '';
584
+					: '';
585 585
 		} else {
586 586
 			$this->_template_args['send_payment_reminder_button'] = '';
587 587
 		}
@@ -735,10 +735,10 @@  discard block
 block discarded – undo
735 735
 	/**
736 736
 	 * txn_details_meta_box
737 737
 	 * generates HTML for the Transaction main meta box
738
-	*
738
+	 *
739 739
 	 * @access public
740
-	*	@return void
741
-	*/
740
+	 *	@return void
741
+	 */
742 742
 	public function txn_details_meta_box() {
743 743
 
744 744
 		$this->_set_transaction_object();
@@ -1078,10 +1078,10 @@  discard block
 block discarded – undo
1078 1078
 	/**
1079 1079
 	 * txn_billing_info_side_meta_box
1080 1080
 	 * 	generates HTML for the Edit Transaction side meta box
1081
-	*
1081
+	 *
1082 1082
 	 * @access public
1083
-	*	@return void
1084
-	*/
1083
+	 *	@return void
1084
+	 */
1085 1085
 	public function txn_billing_info_side_meta_box() {
1086 1086
 
1087 1087
 		$this->_template_args['billing_form'] = $this->_transaction->billing_info();
@@ -1099,10 +1099,10 @@  discard block
 block discarded – undo
1099 1099
 	/**
1100 1100
 	 * apply_payments_or_refunds
1101 1101
 	 * 	registers a payment or refund made towards a transaction
1102
-	*
1102
+	 *
1103 1103
 	 * @access public
1104
-	*	@return void
1105
-	*/
1104
+	 *	@return void
1105
+	 */
1106 1106
 	public function apply_payments_or_refunds() {
1107 1107
 		$json_response_data = array( 'return_data' => FALSE );
1108 1108
 		$valid_data = $this->_validate_payment_request_data();
@@ -1256,9 +1256,9 @@  discard block
 block discarded – undo
1256 1256
 							'default' => '',
1257 1257
 							'required' => false,
1258 1258
 							'html_label_text' => esc_html__( 'Transaction or Cheque Number', 'event_espresso' ),
1259
-                                                        'validation_strategies' => array(
1260
-                                                            new EE_Max_Length_Validation_Strategy( esc_html__('Input too long', 'event_espresso'), 100 ),
1261
-                                                        )
1259
+														'validation_strategies' => array(
1260
+															new EE_Max_Length_Validation_Strategy( esc_html__('Input too long', 'event_espresso'), 100 ),
1261
+														)
1262 1262
 						)
1263 1263
 					),
1264 1264
 					'po_number' => new EE_Text_Input(
@@ -1266,9 +1266,9 @@  discard block
 block discarded – undo
1266 1266
 							'default' => '',
1267 1267
 							'required' => false,
1268 1268
 							'html_label_text' => esc_html__( 'Purchase Order Number', 'event_espresso' ),
1269
-                                                        'validation_strategies' => array(
1270
-                                                            new EE_Max_Length_Validation_Strategy( esc_html__('Input too long', 'event_espresso'), 100 ),
1271
-                                                        )
1269
+														'validation_strategies' => array(
1270
+															new EE_Max_Length_Validation_Strategy( esc_html__('Input too long', 'event_espresso'), 100 ),
1271
+														)
1272 1272
 						)
1273 1273
 					),
1274 1274
 					'accounting' => new EE_Text_Input(
@@ -1276,9 +1276,9 @@  discard block
 block discarded – undo
1276 1276
 							'default' => '',
1277 1277
 							'required' => false,
1278 1278
 							'html_label_text' => esc_html__( 'Extra Field for Accounting', 'event_espresso' ),
1279
-                                                        'validation_strategies' => array(
1280
-                                                            new EE_Max_Length_Validation_Strategy( esc_html__('Input too long', 'event_espresso'), 100 ),
1281
-                                                        )
1279
+														'validation_strategies' => array(
1280
+															new EE_Max_Length_Validation_Strategy( esc_html__('Input too long', 'event_espresso'), 100 ),
1281
+														)
1282 1282
 						)
1283 1283
 					),
1284 1284
 				)
@@ -1573,10 +1573,10 @@  discard block
 block discarded – undo
1573 1573
 	/**
1574 1574
 	 * delete_payment
1575 1575
 	 * 	delete a payment or refund made towards a transaction
1576
-	*
1576
+	 *
1577 1577
 	 * @access public
1578
-	*	@return void
1579
-	*/
1578
+	 *	@return void
1579
+	 */
1580 1580
 	public function delete_payment() {
1581 1581
 		$json_response_data = array( 'return_data' => FALSE );
1582 1582
 		$PAY_ID = isset( $this->_req_data['delete_txn_admin_payment'], $this->_req_data['delete_txn_admin_payment']['PAY_ID'] ) ? absint( $this->_req_data['delete_txn_admin_payment']['PAY_ID'] ) : 0;
@@ -1693,12 +1693,12 @@  discard block
 block discarded – undo
1693 1693
 	/**
1694 1694
 	 * _send_payment_reminder
1695 1695
 	 * 	generates HTML for the View Transaction Details Admin page
1696
-	*
1696
+	 *
1697 1697
 	 * @access protected
1698
-	*	@return void
1699
-	*/
1698
+	 *	@return void
1699
+	 */
1700 1700
 	protected function _send_payment_reminder() {
1701
-	    $TXN_ID = ( ! empty( $this->_req_data['TXN_ID'] )) ? absint( $this->_req_data['TXN_ID'] ) : FALSE;
1701
+		$TXN_ID = ( ! empty( $this->_req_data['TXN_ID'] )) ? absint( $this->_req_data['TXN_ID'] ) : FALSE;
1702 1702
 		$transaction = EEM_Transaction::instance()->get_one_by_ID( $TXN_ID );
1703 1703
 		$query_args = isset($this->_req_data['redirect_to'] ) ? array('action' => $this->_req_data['redirect_to'], 'TXN_ID' => $this->_req_data['TXN_ID'] ) : array();
1704 1704
 		do_action( 'AHEE__Transactions_Admin_Page___send_payment_reminder__process_admin_payment_reminder', $transaction );
@@ -1720,29 +1720,29 @@  discard block
 block discarded – undo
1720 1720
 
1721 1721
 		$TXN = EEM_Transaction::instance();
1722 1722
 
1723
-	    $start_date = isset( $this->_req_data['txn-filter-start-date'] ) ? wp_strip_all_tags( $this->_req_data['txn-filter-start-date'] ) : date( 'm/d/Y', strtotime( '-10 year' ));
1724
-	    $end_date = isset( $this->_req_data['txn-filter-end-date'] ) ? wp_strip_all_tags( $this->_req_data['txn-filter-end-date'] ) : date( 'm/d/Y' );
1723
+		$start_date = isset( $this->_req_data['txn-filter-start-date'] ) ? wp_strip_all_tags( $this->_req_data['txn-filter-start-date'] ) : date( 'm/d/Y', strtotime( '-10 year' ));
1724
+		$end_date = isset( $this->_req_data['txn-filter-end-date'] ) ? wp_strip_all_tags( $this->_req_data['txn-filter-end-date'] ) : date( 'm/d/Y' );
1725 1725
 
1726
-	    //make sure our timestamps start and end right at the boundaries for each day
1727
-	    $start_date = date( 'Y-m-d', strtotime( $start_date ) ) . ' 00:00:00';
1728
-	    $end_date = date( 'Y-m-d', strtotime( $end_date ) ) . ' 23:59:59';
1726
+		//make sure our timestamps start and end right at the boundaries for each day
1727
+		$start_date = date( 'Y-m-d', strtotime( $start_date ) ) . ' 00:00:00';
1728
+		$end_date = date( 'Y-m-d', strtotime( $end_date ) ) . ' 23:59:59';
1729 1729
 
1730 1730
 
1731
-	    //convert to timestamps
1732
-	    $start_date = strtotime( $start_date );
1733
-	    $end_date = strtotime( $end_date );
1731
+		//convert to timestamps
1732
+		$start_date = strtotime( $start_date );
1733
+		$end_date = strtotime( $end_date );
1734 1734
 
1735
-	    //makes sure start date is the lowest value and vice versa
1736
-	    $start_date = min( $start_date, $end_date );
1737
-	    $end_date = max( $start_date, $end_date );
1735
+		//makes sure start date is the lowest value and vice versa
1736
+		$start_date = min( $start_date, $end_date );
1737
+		$end_date = max( $start_date, $end_date );
1738 1738
 
1739
-	    //convert to correct format for query
1739
+		//convert to correct format for query
1740 1740
 	$start_date = EEM_Transaction::instance()->convert_datetime_for_query( 'TXN_timestamp', date( 'Y-m-d H:i:s', $start_date ), 'Y-m-d H:i:s' );
1741 1741
 	$end_date = EEM_Transaction::instance()->convert_datetime_for_query( 'TXN_timestamp', date( 'Y-m-d H:i:s', $end_date ), 'Y-m-d H:i:s' );
1742 1742
 
1743 1743
 
1744 1744
 
1745
-	    //set orderby
1745
+		//set orderby
1746 1746
 		$this->_req_data['orderby'] = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : '';
1747 1747
 
1748 1748
 		switch ( $this->_req_data['orderby'] ) {
Please login to merge, or discard this patch.
Spacing   +405 added lines, -405 removed lines patch added patch discarded remove patch
@@ -56,8 +56,8 @@  discard block
 block discarded – undo
56 56
 	 * @param bool $routing
57 57
 	 * @return Transactions_Admin_Page
58 58
 	 */
59
-	public function __construct( $routing = TRUE ) {
60
-		parent::__construct( $routing );
59
+	public function __construct($routing = TRUE) {
60
+		parent::__construct($routing);
61 61
 	}
62 62
 
63 63
 
@@ -80,9 +80,9 @@  discard block
 block discarded – undo
80 80
 	 * @return void
81 81
 	 */
82 82
 	protected function _ajax_hooks() {
83
-		add_action('wp_ajax_espresso_apply_payment', array( $this, 'apply_payments_or_refunds'));
84
-		add_action('wp_ajax_espresso_apply_refund', array( $this, 'apply_payments_or_refunds'));
85
-		add_action('wp_ajax_espresso_delete_payment', array( $this, 'delete_payment'));
83
+		add_action('wp_ajax_espresso_apply_payment', array($this, 'apply_payments_or_refunds'));
84
+		add_action('wp_ajax_espresso_apply_refund', array($this, 'apply_payments_or_refunds'));
85
+		add_action('wp_ajax_espresso_delete_payment', array($this, 'delete_payment'));
86 86
 	}
87 87
 
88 88
 
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 			'buttons' => array(
98 98
 				'add' => esc_html__('Add New Transaction', 'event_espresso'),
99 99
 				'edit' => esc_html__('Edit Transaction', 'event_espresso'),
100
-				'delete' => esc_html__('Delete Transaction','event_espresso'),
100
+				'delete' => esc_html__('Delete Transaction', 'event_espresso'),
101 101
 			)
102 102
 		);
103 103
 	}
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 
114 114
 		$this->_set_transaction_status_array();
115 115
 
116
-		$txn_id = ! empty( $this->_req_data['TXN_ID'] ) && ! is_array( $this->_req_data['TXN_ID'] ) ? $this->_req_data['TXN_ID'] : 0;
116
+		$txn_id = ! empty($this->_req_data['TXN_ID']) && ! is_array($this->_req_data['TXN_ID']) ? $this->_req_data['TXN_ID'] : 0;
117 117
 
118 118
 		$this->_page_routes = array(
119 119
 
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
 						'filename' => 'transactions_overview_views_filters_search'
186 186
 					),
187 187
 				),
188
-				'help_tour' => array( 'Transactions_Overview_Help_Tour' ),
188
+				'help_tour' => array('Transactions_Overview_Help_Tour'),
189 189
 				/**
190 190
 				 * commented out because currently we are not displaying tips for transaction list table status but this
191 191
 				 * may change in a later iteration so want to keep the code for then.
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
 				'nav' => array(
198 198
 					'label' => esc_html__('View Transaction', 'event_espresso'),
199 199
 					'order' => 5,
200
-					'url' => isset($this->_req_data['TXN_ID']) ? add_query_arg(array('TXN_ID' => $this->_req_data['TXN_ID'] ), $this->_current_page_view_url )  : $this->_admin_base_url,
200
+					'url' => isset($this->_req_data['TXN_ID']) ? add_query_arg(array('TXN_ID' => $this->_req_data['TXN_ID']), $this->_current_page_view_url) : $this->_admin_base_url,
201 201
 					'persistent' => FALSE
202 202
 					),
203 203
 				'help_tabs' => array(
@@ -218,8 +218,8 @@  discard block
 block discarded – undo
218 218
 						'filename' => 'transactions_view_transaction_primary_registrant_billing_information'
219 219
 					),
220 220
 				),
221
-				'qtips' => array( 'Transaction_Details_Tips' ),
222
-				'help_tour' => array( 'Transaction_Details_Help_Tour' ),
221
+				'qtips' => array('Transaction_Details_Tips'),
222
+				'help_tour' => array('Transaction_Details_Help_Tour'),
223 223
 				'metaboxes' => array('_transaction_details_metaboxes'),
224 224
 
225 225
 				'require_nonce' => FALSE
@@ -237,23 +237,23 @@  discard block
 block discarded – undo
237 237
 		// IF a registration was JUST added via the admin...
238 238
 		if (
239 239
 		isset(
240
-			$this->_req_data[ 'redirect_from' ],
241
-			$this->_req_data[ 'EVT_ID' ],
242
-			$this->_req_data[ 'event_name' ]
240
+			$this->_req_data['redirect_from'],
241
+			$this->_req_data['EVT_ID'],
242
+			$this->_req_data['event_name']
243 243
 		)
244 244
 		) {
245 245
 			// then set a cookie so that we can block any attempts to use
246 246
 			// the back button as a way to enter another registration.
247
-			setcookie( 'ee_registration_added', $this->_req_data[ 'EVT_ID' ], time() + WEEK_IN_SECONDS, '/' );
247
+			setcookie('ee_registration_added', $this->_req_data['EVT_ID'], time() + WEEK_IN_SECONDS, '/');
248 248
 			// and update the global
249
-			$_COOKIE[ 'ee_registration_added' ] = $this->_req_data[ 'EVT_ID' ];
249
+			$_COOKIE['ee_registration_added'] = $this->_req_data['EVT_ID'];
250 250
 		}
251
-		EE_Registry::$i18n_js_strings[ 'invalid_server_response' ] = esc_html__( 'An error occurred! Your request may have been processed, but a valid response from the server was not received. Please refresh the page and try again.', 'event_espresso' );
252
-		EE_Registry::$i18n_js_strings[ 'error_occurred' ] = esc_html__( 'An error occurred! Please refresh the page and try again.', 'event_espresso' );
253
-		EE_Registry::$i18n_js_strings[ 'txn_status_array' ] = self::$_txn_status;
254
-		EE_Registry::$i18n_js_strings[ 'pay_status_array' ] = self::$_pay_status;
255
-		EE_Registry::$i18n_js_strings[ 'payments_total' ] = esc_html__( 'Payments Total', 'event_espresso' );
256
-		EE_Registry::$i18n_js_strings[ 'transaction_overpaid' ] = esc_html__( 'This transaction has been overpaid ! Payments Total', 'event_espresso' );
251
+		EE_Registry::$i18n_js_strings['invalid_server_response'] = esc_html__('An error occurred! Your request may have been processed, but a valid response from the server was not received. Please refresh the page and try again.', 'event_espresso');
252
+		EE_Registry::$i18n_js_strings['error_occurred'] = esc_html__('An error occurred! Please refresh the page and try again.', 'event_espresso');
253
+		EE_Registry::$i18n_js_strings['txn_status_array'] = self::$_txn_status;
254
+		EE_Registry::$i18n_js_strings['pay_status_array'] = self::$_pay_status;
255
+		EE_Registry::$i18n_js_strings['payments_total'] = esc_html__('Payments Total', 'event_espresso');
256
+		EE_Registry::$i18n_js_strings['transaction_overpaid'] = esc_html__('This transaction has been overpaid ! Payments Total', 'event_espresso');
257 257
 	}
258 258
 	public function admin_notices() {}
259 259
 	public function admin_footer_scripts() {}
@@ -320,14 +320,14 @@  discard block
 block discarded – undo
320 320
 	 */
321 321
 	public function load_scripts_styles() {
322 322
 		//enqueue style
323
-		wp_register_style( 'espresso_txn', TXN_ASSETS_URL . 'espresso_transactions_admin.css', array(), EVENT_ESPRESSO_VERSION );
323
+		wp_register_style('espresso_txn', TXN_ASSETS_URL.'espresso_transactions_admin.css', array(), EVENT_ESPRESSO_VERSION);
324 324
 		wp_enqueue_style('espresso_txn');
325 325
 
326 326
 		//scripts
327 327
 		add_filter('FHEE_load_accounting_js', '__return_true');
328 328
 
329 329
 		//scripts
330
-		wp_register_script('espresso_txn', TXN_ASSETS_URL . 'espresso_transactions_admin.js', array('ee_admin_js', 'ee-datepicker', 'jquery-ui-datepicker', 'jquery-ui-draggable', 'ee-dialog', 'ee-accounting', 'ee-serialize-full-array'), EVENT_ESPRESSO_VERSION, TRUE);
330
+		wp_register_script('espresso_txn', TXN_ASSETS_URL.'espresso_transactions_admin.js', array('ee_admin_js', 'ee-datepicker', 'jquery-ui-datepicker', 'jquery-ui-draggable', 'ee-dialog', 'ee-accounting', 'ee-serialize-full-array'), EVENT_ESPRESSO_VERSION, TRUE);
331 331
 		wp_enqueue_script('espresso_txn');
332 332
 
333 333
 	}
@@ -367,8 +367,8 @@  discard block
 block discarded – undo
367 367
 	 *	@return void
368 368
 	 */
369 369
 	protected function _set_list_table_views_default() {
370
-		$this->_views = array (
371
-			'all' => array (
370
+		$this->_views = array(
371
+			'all' => array(
372 372
 				'slug' 		=> 'all',
373 373
 				'label' 		=> esc_html__('View All Transactions', 'event_espresso'),
374 374
 				'count' 	=> 0
@@ -396,20 +396,20 @@  discard block
 block discarded – undo
396 396
 	 *	@return void
397 397
 	 */
398 398
 	private function _set_transaction_object() {
399
-		if ( is_object( $this->_transaction) )
399
+		if (is_object($this->_transaction))
400 400
 			return; //get out we've already set the object
401 401
 
402 402
 	    $TXN = EEM_Transaction::instance();
403 403
 
404
-	    $TXN_ID = ( ! empty( $this->_req_data['TXN_ID'] )) ? absint( $this->_req_data['TXN_ID'] ) : FALSE;
404
+	    $TXN_ID = ( ! empty($this->_req_data['TXN_ID'])) ? absint($this->_req_data['TXN_ID']) : FALSE;
405 405
 
406 406
 	    //get transaction object
407 407
 	    $this->_transaction = $TXN->get_one_by_ID($TXN_ID);
408
-	    $this->_session = !empty( $this->_transaction ) ? $this->_transaction->get('TXN_session_data') : NULL;
408
+	    $this->_session = ! empty($this->_transaction) ? $this->_transaction->get('TXN_session_data') : NULL;
409 409
 
410
-	 	if ( empty( $this->_transaction ) ) {
411
-	    	$error_msg = esc_html__('An error occurred and the details for Transaction ID #', 'event_espresso') . $TXN_ID .  esc_html__(' could not be retrieved.', 'event_espresso');
412
-			EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ );
410
+	 	if (empty($this->_transaction)) {
411
+	    	$error_msg = esc_html__('An error occurred and the details for Transaction ID #', 'event_espresso').$TXN_ID.esc_html__(' could not be retrieved.', 'event_espresso');
412
+			EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__);
413 413
 	    }
414 414
 	}
415 415
 
@@ -422,12 +422,12 @@  discard block
 block discarded – undo
422 422
 	 *	@return array
423 423
 	 */
424 424
 	protected function _transaction_legend_items() {
425
-		EE_Registry::instance()->load_helper( 'MSG_Template' );
425
+		EE_Registry::instance()->load_helper('MSG_Template');
426 426
 		$items = array();
427 427
 
428
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_global_messages', 'view_filtered_messages' ) ) {
429
-			$related_for_icon = EEH_MSG_Template::get_message_action_icon( 'see_notifications_for' );
430
-			if ( isset( $related_for_icon['css_class']) && isset( $related_for_icon['label'] ) ) {
428
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_global_messages', 'view_filtered_messages')) {
429
+			$related_for_icon = EEH_MSG_Template::get_message_action_icon('see_notifications_for');
430
+			if (isset($related_for_icon['css_class']) && isset($related_for_icon['label'])) {
431 431
 				$items['view_related_messages'] = array(
432 432
 					'class' => $related_for_icon['css_class'],
433 433
 					'desc' => $related_for_icon['label'],
@@ -437,7 +437,7 @@  discard block
 block discarded – undo
437 437
 
438 438
 		$items = apply_filters(
439 439
 			'FHEE__Transactions_Admin_Page___transaction_legend_items__items',
440
-			array_merge( $items,
440
+			array_merge($items,
441 441
 				array(
442 442
 					'view_details' => array(
443 443
 						'class' => 'dashicons dashicons-cart',
@@ -449,7 +449,7 @@  discard block
 block discarded – undo
449 449
 					),
450 450
 					'view_receipt' => array(
451 451
 						'class' => 'dashicons dashicons-media-default',
452
-						'desc' => esc_html__('View Transaction Receipt', 'event_espresso' )
452
+						'desc' => esc_html__('View Transaction Receipt', 'event_espresso')
453 453
 					),
454 454
 					'view_registration' => array(
455 455
 						'class' => 'dashicons dashicons-clipboard',
@@ -459,8 +459,8 @@  discard block
 block discarded – undo
459 459
 			)
460 460
 		);
461 461
 
462
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_transactions_send_payment_reminder' ) ) {
463
-			if ( EEH_MSG_Template::is_mt_active( 'payment_reminder' ) ) {
462
+		if (EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_transactions_send_payment_reminder')) {
463
+			if (EEH_MSG_Template::is_mt_active('payment_reminder')) {
464 464
 				$items['send_payment_reminder'] = array(
465 465
 					'class' => 'dashicons dashicons-email-alt',
466 466
 					'desc' => esc_html__('Send Payment Reminder', 'event_espresso')
@@ -481,29 +481,29 @@  discard block
 block discarded – undo
481 481
 			'FHEE__Transactions_Admin_Page___transaction_legend_items__more_items',
482 482
 			array(
483 483
 				'overpaid'   => array(
484
-					'class' => 'ee-status-legend ee-status-legend-' . EEM_Transaction::overpaid_status_code,
485
-					'desc'  => EEH_Template::pretty_status( EEM_Transaction::overpaid_status_code, FALSE, 'sentence' )
484
+					'class' => 'ee-status-legend ee-status-legend-'.EEM_Transaction::overpaid_status_code,
485
+					'desc'  => EEH_Template::pretty_status(EEM_Transaction::overpaid_status_code, FALSE, 'sentence')
486 486
 				),
487 487
 				'complete'   => array(
488
-					'class' => 'ee-status-legend ee-status-legend-' . EEM_Transaction::complete_status_code,
489
-					'desc'  => EEH_Template::pretty_status( EEM_Transaction::complete_status_code, FALSE, 'sentence' )
488
+					'class' => 'ee-status-legend ee-status-legend-'.EEM_Transaction::complete_status_code,
489
+					'desc'  => EEH_Template::pretty_status(EEM_Transaction::complete_status_code, FALSE, 'sentence')
490 490
 				),
491 491
 				'incomplete' => array(
492
-					'class' => 'ee-status-legend ee-status-legend-' . EEM_Transaction::incomplete_status_code,
493
-					'desc'  => EEH_Template::pretty_status( EEM_Transaction::incomplete_status_code, FALSE, 'sentence' )
492
+					'class' => 'ee-status-legend ee-status-legend-'.EEM_Transaction::incomplete_status_code,
493
+					'desc'  => EEH_Template::pretty_status(EEM_Transaction::incomplete_status_code, FALSE, 'sentence')
494 494
 				),
495 495
 				'abandoned'  => array(
496
-					'class' => 'ee-status-legend ee-status-legend-' . EEM_Transaction::abandoned_status_code,
497
-					'desc'  => EEH_Template::pretty_status( EEM_Transaction::abandoned_status_code, FALSE, 'sentence' )
496
+					'class' => 'ee-status-legend ee-status-legend-'.EEM_Transaction::abandoned_status_code,
497
+					'desc'  => EEH_Template::pretty_status(EEM_Transaction::abandoned_status_code, FALSE, 'sentence')
498 498
 				),
499 499
 				'failed'     => array(
500
-					'class' => 'ee-status-legend ee-status-legend-' . EEM_Transaction::failed_status_code,
501
-					'desc'  => EEH_Template::pretty_status( EEM_Transaction::failed_status_code, FALSE, 'sentence' )
500
+					'class' => 'ee-status-legend ee-status-legend-'.EEM_Transaction::failed_status_code,
501
+					'desc'  => EEH_Template::pretty_status(EEM_Transaction::failed_status_code, FALSE, 'sentence')
502 502
 				)
503 503
 			)
504 504
 		);
505 505
 
506
-		return array_merge( $items, $more_items);
506
+		return array_merge($items, $more_items);
507 507
 	}
508 508
 
509 509
 
@@ -516,9 +516,9 @@  discard block
 block discarded – undo
516 516
 	 */
517 517
 	protected function _transactions_overview_list_table() {
518 518
 		$this->_admin_page_title = esc_html__('Transactions', 'event_espresso');
519
-		$event = isset($this->_req_data['EVT_ID']) ? EEM_Event::instance()->get_one_by_ID($this->_req_data['EVT_ID'] ) : NULL;
520
-		$this->_template_args['admin_page_header'] = $event instanceof EE_Event ? sprintf( esc_html__('%sViewing Transactions for the Event: %s%s', 'event_espresso'), '<h3>', '<a href="' . EE_Admin_Page::add_query_args_and_nonce(array('action' => 'edit', 'post' => $event->ID()), EVENTS_ADMIN_URL ) . '" title="' . esc_attr__('Click to Edit event', 'event_espresso') . '">' . $event->get('EVT_name') . '</a>', '</h3>' ) : '';
521
-		$this->_template_args['after_list_table'] = $this->_display_legend( $this->_transaction_legend_items() );
519
+		$event = isset($this->_req_data['EVT_ID']) ? EEM_Event::instance()->get_one_by_ID($this->_req_data['EVT_ID']) : NULL;
520
+		$this->_template_args['admin_page_header'] = $event instanceof EE_Event ? sprintf(esc_html__('%sViewing Transactions for the Event: %s%s', 'event_espresso'), '<h3>', '<a href="'.EE_Admin_Page::add_query_args_and_nonce(array('action' => 'edit', 'post' => $event->ID()), EVENTS_ADMIN_URL).'" title="'.esc_attr__('Click to Edit event', 'event_espresso').'">'.$event->get('EVT_name').'</a>', '</h3>') : '';
521
+		$this->_template_args['after_list_table'] = $this->_display_legend($this->_transaction_legend_items());
522 522
 		$this->display_admin_list_table_page_with_no_sidebar();
523 523
 	}
524 524
 
@@ -532,7 +532,7 @@  discard block
 block discarded – undo
532 532
 	*	@return void
533 533
 	*/
534 534
 	protected function _transaction_details() {
535
-		do_action( 'AHEE__Transactions_Admin_Page__transaction_details__start', $this->_transaction );
535
+		do_action('AHEE__Transactions_Admin_Page__transaction_details__start', $this->_transaction);
536 536
 
537 537
 		$this->_set_transaction_status_array();
538 538
 
@@ -545,14 +545,14 @@  discard block
 block discarded – undo
545 545
 		$attendee = $primary_registration instanceof EE_Registration ? $primary_registration->attendee() : NULL;
546 546
 
547 547
 		$this->_template_args['txn_nmbr']['value'] = $this->_transaction->ID();
548
-		$this->_template_args['txn_nmbr']['label'] = esc_html__( 'Transaction Number', 'event_espresso' );
548
+		$this->_template_args['txn_nmbr']['label'] = esc_html__('Transaction Number', 'event_espresso');
549 549
 
550 550
 		$this->_template_args['txn_datetime']['value'] = $this->_transaction->get_i18n_datetime('TXN_timestamp');
551
-		$this->_template_args['txn_datetime']['label'] = esc_html__( 'Date', 'event_espresso' );
551
+		$this->_template_args['txn_datetime']['label'] = esc_html__('Date', 'event_espresso');
552 552
 
553
-		$this->_template_args['txn_status']['value'] = self::$_txn_status[ $this->_transaction->get('STS_ID') ];
554
-		$this->_template_args['txn_status']['label'] = esc_html__( 'Transaction Status', 'event_espresso' );
555
-		$this->_template_args['txn_status']['class'] = 'status-' . $this->_transaction->get('STS_ID');
553
+		$this->_template_args['txn_status']['value'] = self::$_txn_status[$this->_transaction->get('STS_ID')];
554
+		$this->_template_args['txn_status']['label'] = esc_html__('Transaction Status', 'event_espresso');
555
+		$this->_template_args['txn_status']['class'] = 'status-'.$this->_transaction->get('STS_ID');
556 556
 
557 557
 		$this->_template_args['grand_total'] = $this->_transaction->get('TXN_total');
558 558
 		$this->_template_args['total_paid'] = $this->_transaction->get('TXN_paid');
@@ -565,7 +565,7 @@  discard block
 block discarded – undo
565 565
 			)
566 566
 		) {
567 567
 			$this->_template_args['send_payment_reminder_button'] =
568
-				EEH_MSG_Template::is_mt_active( 'payment_reminder' )
568
+				EEH_MSG_Template::is_mt_active('payment_reminder')
569 569
 				&& $this->_transaction->get('STS_ID') != EEM_Transaction::complete_status_code
570 570
 				&& $this->_transaction->get('STS_ID') != EEM_Transaction::overpaid_status_code
571 571
 					? EEH_Template::get_button_or_link(
@@ -587,40 +587,40 @@  discard block
 block discarded – undo
587 587
 		}
588 588
 
589 589
 		$amount_due = $this->_transaction->get('TXN_total') - $this->_transaction->get('TXN_paid');
590
-		$this->_template_args['amount_due'] = EEH_Template::format_currency( $amount_due, TRUE );
591
-		if ( EE_Registry::instance()->CFG->currency->sign_b4 ) {
592
-			$this->_template_args['amount_due'] = EE_Registry::instance()->CFG->currency->sign . $this->_template_args['amount_due'];
590
+		$this->_template_args['amount_due'] = EEH_Template::format_currency($amount_due, TRUE);
591
+		if (EE_Registry::instance()->CFG->currency->sign_b4) {
592
+			$this->_template_args['amount_due'] = EE_Registry::instance()->CFG->currency->sign.$this->_template_args['amount_due'];
593 593
 		} else {
594
-			$this->_template_args['amount_due'] = $this->_template_args['amount_due'] . EE_Registry::instance()->CFG->currency->sign;
594
+			$this->_template_args['amount_due'] = $this->_template_args['amount_due'].EE_Registry::instance()->CFG->currency->sign;
595 595
 		}
596
-		$this->_template_args['amount_due_class'] =  '';
596
+		$this->_template_args['amount_due_class'] = '';
597 597
 
598
-		if ( $this->_transaction->get('TXN_paid') == $this->_transaction->get('TXN_total') ) {
598
+		if ($this->_transaction->get('TXN_paid') == $this->_transaction->get('TXN_total')) {
599 599
 			// paid in full
600
-			$this->_template_args['amount_due'] =  FALSE;
601
-		} elseif ( $this->_transaction->get('TXN_paid') > $this->_transaction->get('TXN_total') ) {
600
+			$this->_template_args['amount_due'] = FALSE;
601
+		} elseif ($this->_transaction->get('TXN_paid') > $this->_transaction->get('TXN_total')) {
602 602
 			// overpaid
603
-			$this->_template_args['amount_due_class'] =  'txn-overview-no-payment-spn';
604
-		} elseif (( $this->_transaction->get('TXN_total') > 0 ) && ( $this->_transaction->get('TXN_paid') > 0 )) {
603
+			$this->_template_args['amount_due_class'] = 'txn-overview-no-payment-spn';
604
+		} elseif (($this->_transaction->get('TXN_total') > 0) && ($this->_transaction->get('TXN_paid') > 0)) {
605 605
 			// monies owing
606
-			$this->_template_args['amount_due_class'] =  'txn-overview-part-payment-spn';
607
-		} elseif (( $this->_transaction->get('TXN_total') > 0 ) && ( $this->_transaction->get('TXN_paid') == 0 )) {
606
+			$this->_template_args['amount_due_class'] = 'txn-overview-part-payment-spn';
607
+		} elseif (($this->_transaction->get('TXN_total') > 0) && ($this->_transaction->get('TXN_paid') == 0)) {
608 608
 			// no payments made yet
609
-			$this->_template_args['amount_due_class'] =  'txn-overview-no-payment-spn';
610
-		} elseif ( $this->_transaction->get('TXN_total') == 0 ) {
609
+			$this->_template_args['amount_due_class'] = 'txn-overview-no-payment-spn';
610
+		} elseif ($this->_transaction->get('TXN_total') == 0) {
611 611
 			// free event
612
-			$this->_template_args['amount_due'] =  FALSE;
612
+			$this->_template_args['amount_due'] = FALSE;
613 613
 		}
614 614
 
615 615
 		$payment_method = $this->_transaction->payment_method();
616 616
 
617 617
 		$this->_template_args['method_of_payment_name'] = $payment_method instanceof EE_Payment_Method
618 618
 			? $payment_method->admin_name()
619
-			: esc_html__( 'Unknown', 'event_espresso' );
619
+			: esc_html__('Unknown', 'event_espresso');
620 620
 
621 621
 		$this->_template_args['currency_sign'] = EE_Registry::instance()->CFG->currency->sign;
622 622
 		// link back to overview
623
-		$this->_template_args['txn_overview_url'] = ! empty ( $_SERVER['HTTP_REFERER'] )
623
+		$this->_template_args['txn_overview_url'] = ! empty ($_SERVER['HTTP_REFERER'])
624 624
 			? $_SERVER['HTTP_REFERER']
625 625
 			: TXN_ADMIN_URL;
626 626
 
@@ -628,13 +628,13 @@  discard block
 block discarded – undo
628 628
 		// next link
629 629
 		$next_txn = $this->_transaction->next(
630 630
 			null,
631
-			array( array( 'STS_ID' => array( '!=', EEM_Transaction::failed_status_code ) ) ),
631
+			array(array('STS_ID' => array('!=', EEM_Transaction::failed_status_code))),
632 632
 			'TXN_ID'
633 633
 		);
634 634
 		$this->_template_args['next_transaction'] = $next_txn
635 635
 			? $this->_next_link(
636 636
 				EE_Admin_Page::add_query_args_and_nonce(
637
-					array( 'action' => 'view_transaction', 'TXN_ID' => $next_txn['TXN_ID'] ),
637
+					array('action' => 'view_transaction', 'TXN_ID' => $next_txn['TXN_ID']),
638 638
 					TXN_ADMIN_URL
639 639
 				),
640 640
 				'dashicons dashicons-arrow-right ee-icon-size-22'
@@ -643,13 +643,13 @@  discard block
 block discarded – undo
643 643
 		// previous link
644 644
 		$previous_txn = $this->_transaction->previous(
645 645
 			null,
646
-			array( array( 'STS_ID' => array( '!=', EEM_Transaction::failed_status_code ) ) ),
646
+			array(array('STS_ID' => array('!=', EEM_Transaction::failed_status_code))),
647 647
 			'TXN_ID'
648 648
 		);
649 649
 		$this->_template_args['previous_transaction'] = $previous_txn
650 650
 			? $this->_previous_link(
651 651
 				EE_Admin_Page::add_query_args_and_nonce(
652
-					array( 'action' => 'view_transaction', 'TXN_ID' => $previous_txn['TXN_ID'] ),
652
+					array('action' => 'view_transaction', 'TXN_ID' => $previous_txn['TXN_ID']),
653 653
 					TXN_ADMIN_URL
654 654
 				),
655 655
 				'dashicons dashicons-arrow-left ee-icon-size-22'
@@ -659,16 +659,16 @@  discard block
 block discarded – undo
659 659
 		// were we just redirected here after adding a new registration ???
660 660
 		if (
661 661
 			isset(
662
-				$this->_req_data[ 'redirect_from' ],
663
-				$this->_req_data[ 'EVT_ID' ],
664
-				$this->_req_data[ 'event_name' ]
662
+				$this->_req_data['redirect_from'],
663
+				$this->_req_data['EVT_ID'],
664
+				$this->_req_data['event_name']
665 665
 			)
666 666
 		) {
667 667
 			if (
668 668
 				EE_Registry::instance()->CAP->current_user_can(
669 669
 					'ee_edit_registrations',
670 670
 					'espresso_registrations_new_registration',
671
-					$this->_req_data[ 'EVT_ID' ]
671
+					$this->_req_data['EVT_ID']
672 672
 				)
673 673
 			) {
674 674
 				$this->_admin_page_title .= '<a id="add-new-registration" class="add-new-h2 button-primary" href="';
@@ -678,25 +678,25 @@  discard block
 block discarded – undo
678 678
 						'action'   => 'new_registration',
679 679
 						'return'   => 'default',
680 680
 						'TXN_ID'   => $this->_transaction->ID(),
681
-						'event_id' => $this->_req_data[ 'EVT_ID' ],
681
+						'event_id' => $this->_req_data['EVT_ID'],
682 682
 					),
683 683
 					REG_ADMIN_URL
684 684
 				);
685 685
 				$this->_admin_page_title .= '">';
686 686
 
687 687
 				$this->_admin_page_title .= sprintf(
688
-					esc_html__('Add Another New Registration to Event: "%1$s" ?', 'event_espresso' ),
689
-					htmlentities( urldecode( $this->_req_data[ 'event_name' ] ), ENT_QUOTES, 'UTF-8' )
688
+					esc_html__('Add Another New Registration to Event: "%1$s" ?', 'event_espresso'),
689
+					htmlentities(urldecode($this->_req_data['event_name']), ENT_QUOTES, 'UTF-8')
690 690
 				);
691 691
 				$this->_admin_page_title .= '</a>';
692 692
 			}
693
-			EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ );
693
+			EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__);
694 694
 		}
695 695
 		// grab messages at the last second
696 696
 		$this->_template_args['notices'] = EE_Error::get_notices();
697 697
 		// path to template
698
-		$template_path = TXN_TEMPLATE_PATH . 'txn_admin_details_header.template.php';
699
-		$this->_template_args['admin_page_header'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
698
+		$template_path = TXN_TEMPLATE_PATH.'txn_admin_details_header.template.php';
699
+		$this->_template_args['admin_page_header'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE);
700 700
 
701 701
 		// the details template wrapper
702 702
 		$this->display_admin_page_with_sidebar();
@@ -715,18 +715,18 @@  discard block
 block discarded – undo
715 715
 
716 716
 		$this->_set_transaction_object();
717 717
 
718
-		add_meta_box( 'edit-txn-details-mbox', esc_html__( 'Transaction Details', 'event_espresso' ), array( $this, 'txn_details_meta_box' ), $this->_wp_page_slug, 'normal', 'high' );
718
+		add_meta_box('edit-txn-details-mbox', esc_html__('Transaction Details', 'event_espresso'), array($this, 'txn_details_meta_box'), $this->_wp_page_slug, 'normal', 'high');
719 719
 		add_meta_box(
720 720
 			'edit-txn-attendees-mbox',
721
-			esc_html__( 'Attendees Registered in this Transaction', 'event_espresso' ),
722
-			array( $this, 'txn_attendees_meta_box' ),
721
+			esc_html__('Attendees Registered in this Transaction', 'event_espresso'),
722
+			array($this, 'txn_attendees_meta_box'),
723 723
 			$this->_wp_page_slug,
724 724
 			'normal',
725 725
 			'high',
726
-			array( 'TXN_ID' => $this->_transaction->ID() )
726
+			array('TXN_ID' => $this->_transaction->ID())
727 727
 		);
728
-		add_meta_box( 'edit-txn-registrant-mbox', esc_html__( 'Primary Contact', 'event_espresso' ), array( $this, 'txn_registrant_side_meta_box' ), $this->_wp_page_slug, 'side', 'high' );
729
-		add_meta_box( 'edit-txn-billing-info-mbox', esc_html__( 'Billing Information', 'event_espresso' ), array( $this, 'txn_billing_info_side_meta_box' ), $this->_wp_page_slug, 'side', 'high' );
728
+		add_meta_box('edit-txn-registrant-mbox', esc_html__('Primary Contact', 'event_espresso'), array($this, 'txn_registrant_side_meta_box'), $this->_wp_page_slug, 'side', 'high');
729
+		add_meta_box('edit-txn-billing-info-mbox', esc_html__('Billing Information', 'event_espresso'), array($this, 'txn_billing_info_side_meta_box'), $this->_wp_page_slug, 'side', 'high');
730 730
 
731 731
 	}
732 732
 
@@ -747,15 +747,15 @@  discard block
 block discarded – undo
747 747
 
748 748
 		//get line table
749 749
 		EEH_Autoloader::register_line_item_display_autoloaders();
750
-		$Line_Item_Display = new EE_Line_Item_Display( 'admin_table', 'EE_Admin_Table_Line_Item_Display_Strategy' );
751
-		$this->_template_args['line_item_table'] = $Line_Item_Display->display_line_item( $this->_transaction->total_line_item() );
750
+		$Line_Item_Display = new EE_Line_Item_Display('admin_table', 'EE_Admin_Table_Line_Item_Display_Strategy');
751
+		$this->_template_args['line_item_table'] = $Line_Item_Display->display_line_item($this->_transaction->total_line_item());
752 752
 		$this->_template_args['REG_code'] = $this->_transaction->get_first_related('Registration')->get('REG_code');
753 753
 
754 754
 		// process taxes
755
-		$taxes = $this->_transaction->get_many_related( 'Line_Item', array( array( 'LIN_type' => EEM_Line_Item::type_tax )));
756
-		$this->_template_args['taxes'] = ! empty( $taxes ) ? $taxes : FALSE;
755
+		$taxes = $this->_transaction->get_many_related('Line_Item', array(array('LIN_type' => EEM_Line_Item::type_tax)));
756
+		$this->_template_args['taxes'] = ! empty($taxes) ? $taxes : FALSE;
757 757
 
758
-		$this->_template_args['grand_total'] = EEH_Template::format_currency($this->_transaction->get('TXN_total'), FALSE, FALSE );
758
+		$this->_template_args['grand_total'] = EEH_Template::format_currency($this->_transaction->get('TXN_total'), FALSE, FALSE);
759 759
 		$this->_template_args['grand_raw_total'] = $this->_transaction->get('TXN_total');
760 760
 		$this->_template_args['TXN_status'] = $this->_transaction->get('STS_ID');
761 761
 
@@ -763,63 +763,63 @@  discard block
 block discarded – undo
763 763
 
764 764
 		// process payment details
765 765
 		$payments = $this->_transaction->get_many_related('Payment');
766
-		if( ! empty(  $payments ) ) {
767
-			$this->_template_args[ 'payments' ] = $payments;
768
-			$this->_template_args[ 'existing_reg_payments' ] = $this->_get_registration_payment_IDs( $payments );
766
+		if ( ! empty($payments)) {
767
+			$this->_template_args['payments'] = $payments;
768
+			$this->_template_args['existing_reg_payments'] = $this->_get_registration_payment_IDs($payments);
769 769
 		} else {
770
-			$this->_template_args[ 'payments' ] = false;
771
-			$this->_template_args[ 'existing_reg_payments' ] = array();
770
+			$this->_template_args['payments'] = false;
771
+			$this->_template_args['existing_reg_payments'] = array();
772 772
 		}
773 773
 
774
-		$this->_template_args['edit_payment_url'] = add_query_arg( array( 'action' => 'edit_payment'  ), TXN_ADMIN_URL );
775
-		$this->_template_args['delete_payment_url'] = add_query_arg( array( 'action' => 'espresso_delete_payment' ), TXN_ADMIN_URL );
774
+		$this->_template_args['edit_payment_url'] = add_query_arg(array('action' => 'edit_payment'), TXN_ADMIN_URL);
775
+		$this->_template_args['delete_payment_url'] = add_query_arg(array('action' => 'espresso_delete_payment'), TXN_ADMIN_URL);
776 776
 
777
-		if ( isset( $txn_details['invoice_number'] )) {
777
+		if (isset($txn_details['invoice_number'])) {
778 778
 			$this->_template_args['txn_details']['invoice_number']['value'] = $this->_template_args['REG_code'];
779
-			$this->_template_args['txn_details']['invoice_number']['label'] = esc_html__( 'Invoice Number', 'event_espresso' );
779
+			$this->_template_args['txn_details']['invoice_number']['label'] = esc_html__('Invoice Number', 'event_espresso');
780 780
 		}
781 781
 
782 782
 		$this->_template_args['txn_details']['registration_session']['value'] = $this->_transaction->get_first_related('Registration')->get('REG_session');
783
-		$this->_template_args['txn_details']['registration_session']['label'] = esc_html__( 'Registration Session', 'event_espresso' );
783
+		$this->_template_args['txn_details']['registration_session']['label'] = esc_html__('Registration Session', 'event_espresso');
784 784
 
785
-		$this->_template_args['txn_details']['ip_address']['value'] = isset( $this->_session['ip_address'] ) ? $this->_session['ip_address'] : '';
786
-		$this->_template_args['txn_details']['ip_address']['label'] = esc_html__( 'Transaction placed from IP', 'event_espresso' );
785
+		$this->_template_args['txn_details']['ip_address']['value'] = isset($this->_session['ip_address']) ? $this->_session['ip_address'] : '';
786
+		$this->_template_args['txn_details']['ip_address']['label'] = esc_html__('Transaction placed from IP', 'event_espresso');
787 787
 
788
-		$this->_template_args['txn_details']['user_agent']['value'] = isset( $this->_session['user_agent'] ) ? $this->_session['user_agent'] : '';
789
-		$this->_template_args['txn_details']['user_agent']['label'] = esc_html__( 'Registrant User Agent', 'event_espresso' );
788
+		$this->_template_args['txn_details']['user_agent']['value'] = isset($this->_session['user_agent']) ? $this->_session['user_agent'] : '';
789
+		$this->_template_args['txn_details']['user_agent']['label'] = esc_html__('Registrant User Agent', 'event_espresso');
790 790
 
791 791
 		$reg_steps = '<ul>';
792
-		foreach ( $this->_transaction->reg_steps() as $reg_step => $reg_step_status ) {
793
-			if ( $reg_step_status === true ) {
794
-				$reg_steps .= '<li style="color:#70cc50">' . sprintf( esc_html__( '%1$s : Completed', 'event_espresso' ), ucwords( str_replace( '_', ' ', $reg_step ) ) ) . '</li>';
795
-			} else if ( is_numeric( $reg_step_status ) && $reg_step_status !== false ) {
796
-					$reg_steps .= '<li style="color:#2EA2CC">' . sprintf(
797
-							esc_html__( '%1$s : Initiated %2$s', 'event_espresso' ),
798
-							ucwords( str_replace( '_', ' ', $reg_step ) ),
799
-							gmdate( get_option( 'date_format' ) . ' ' . get_option( 'time_format' ), ( $reg_step_status + ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS ) ) )
800
-						) . '</li>';
792
+		foreach ($this->_transaction->reg_steps() as $reg_step => $reg_step_status) {
793
+			if ($reg_step_status === true) {
794
+				$reg_steps .= '<li style="color:#70cc50">'.sprintf(esc_html__('%1$s : Completed', 'event_espresso'), ucwords(str_replace('_', ' ', $reg_step))).'</li>';
795
+			} else if (is_numeric($reg_step_status) && $reg_step_status !== false) {
796
+					$reg_steps .= '<li style="color:#2EA2CC">'.sprintf(
797
+							esc_html__('%1$s : Initiated %2$s', 'event_espresso'),
798
+							ucwords(str_replace('_', ' ', $reg_step)),
799
+							gmdate(get_option('date_format').' '.get_option('time_format'), ($reg_step_status + (get_option('gmt_offset') * HOUR_IN_SECONDS)))
800
+						).'</li>';
801 801
 				} else {
802
-				$reg_steps .= '<li style="color:#E76700">' . sprintf( esc_html__( '%1$s : Never Initiated', 'event_espresso' ), ucwords( str_replace( '_', ' ', $reg_step ) ) ) . '</li>';
802
+				$reg_steps .= '<li style="color:#E76700">'.sprintf(esc_html__('%1$s : Never Initiated', 'event_espresso'), ucwords(str_replace('_', ' ', $reg_step))).'</li>';
803 803
 			}
804 804
 		}
805 805
 		$reg_steps .= '</ul>';
806 806
 		$this->_template_args['txn_details']['reg_steps']['value'] = $reg_steps;
807
-		$this->_template_args['txn_details']['reg_steps']['label'] = esc_html__( 'Registration Step Progress', 'event_espresso' );
807
+		$this->_template_args['txn_details']['reg_steps']['label'] = esc_html__('Registration Step Progress', 'event_espresso');
808 808
 
809 809
 
810 810
 		$this->_get_registrations_to_apply_payment_to();
811
-		$this->_get_payment_methods( $payments );
811
+		$this->_get_payment_methods($payments);
812 812
 		$this->_get_payment_status_array();
813 813
 		$this->_get_reg_status_selection(); //sets up the template args for the reg status array for the transaction.
814 814
 
815
-		$this->_template_args['transaction_form_url'] = add_query_arg( array( 'action' => 'edit_transaction', 'process' => 'transaction'  ), TXN_ADMIN_URL );
816
-		$this->_template_args['apply_payment_form_url'] = add_query_arg( array( 'page' => 'espresso_transactions', 'action' => 'espresso_apply_payment' ), WP_AJAX_URL );
817
-		$this->_template_args['delete_payment_form_url'] = add_query_arg( array( 'page' => 'espresso_transactions', 'action' => 'espresso_delete_payment' ), WP_AJAX_URL );
815
+		$this->_template_args['transaction_form_url'] = add_query_arg(array('action' => 'edit_transaction', 'process' => 'transaction'), TXN_ADMIN_URL);
816
+		$this->_template_args['apply_payment_form_url'] = add_query_arg(array('page' => 'espresso_transactions', 'action' => 'espresso_apply_payment'), WP_AJAX_URL);
817
+		$this->_template_args['delete_payment_form_url'] = add_query_arg(array('page' => 'espresso_transactions', 'action' => 'espresso_delete_payment'), WP_AJAX_URL);
818 818
 
819 819
 		// 'espresso_delete_payment_nonce'
820 820
 
821
-		$template_path = TXN_TEMPLATE_PATH . 'txn_admin_details_main_meta_box_txn_details.template.php';
822
-		echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
821
+		$template_path = TXN_TEMPLATE_PATH.'txn_admin_details_main_meta_box_txn_details.template.php';
822
+		echo EEH_Template::display_template($template_path, $this->_template_args, TRUE);
823 823
 
824 824
 	}
825 825
 
@@ -834,27 +834,27 @@  discard block
 block discarded – undo
834 834
 	 * @param EE_Payment[] $payments
835 835
 	 * @return array
836 836
 	 */
837
-	protected function _get_registration_payment_IDs( $payments = array() ) {
837
+	protected function _get_registration_payment_IDs($payments = array()) {
838 838
 		$existing_reg_payments = array();
839 839
 		// get all reg payments for these payments
840
-		$reg_payments = EEM_Registration_Payment::instance()->get_all( array(
840
+		$reg_payments = EEM_Registration_Payment::instance()->get_all(array(
841 841
 			array(
842 842
 				'PAY_ID' => array(
843 843
 					'IN',
844
-					array_keys( $payments )
844
+					array_keys($payments)
845 845
 				)
846 846
 			)
847
-		) );
848
-		if ( ! empty( $reg_payments ) ) {
849
-			foreach ( $payments as $payment ) {
850
-				if ( ! $payment instanceof EE_Payment ) {
847
+		));
848
+		if ( ! empty($reg_payments)) {
849
+			foreach ($payments as $payment) {
850
+				if ( ! $payment instanceof EE_Payment) {
851 851
 					continue;
852
-				} else if ( ! isset( $existing_reg_payments[ $payment->ID() ] ) ) {
853
-					$existing_reg_payments[ $payment->ID() ] = array();
852
+				} else if ( ! isset($existing_reg_payments[$payment->ID()])) {
853
+					$existing_reg_payments[$payment->ID()] = array();
854 854
 				}
855
-				foreach ( $reg_payments as $reg_payment ) {
856
-					if ( $reg_payment instanceof EE_Registration_Payment && $reg_payment->payment_ID() === $payment->ID() ) {
857
-						$existing_reg_payments[ $payment->ID() ][ ] = $reg_payment->registration_ID();
855
+				foreach ($reg_payments as $reg_payment) {
856
+					if ($reg_payment instanceof EE_Registration_Payment && $reg_payment->payment_ID() === $payment->ID()) {
857
+						$existing_reg_payments[$payment->ID()][] = $reg_payment->registration_ID();
858 858
 					}
859 859
 				}
860 860
 			}
@@ -891,39 +891,39 @@  discard block
 block discarded – undo
891 891
 		$registrations_to_apply_payment_to .= '<br /><div class="admin-primary-mbox-tbl-wrap">';
892 892
 		$registrations_to_apply_payment_to .= '<table class="admin-primary-mbox-tbl">';
893 893
 		$registrations_to_apply_payment_to .= '<thead><tr>';
894
-		$registrations_to_apply_payment_to .= '<td>' . esc_html__( 'ID', 'event_espresso' ) . '</td>';
895
-		$registrations_to_apply_payment_to .= '<td>' . esc_html__( 'Registrant', 'event_espresso' ) . '</td>';
896
-		$registrations_to_apply_payment_to .= '<td>' . esc_html__( 'Ticket', 'event_espresso' ) . '</td>';
897
-		$registrations_to_apply_payment_to .= '<td>' . esc_html__( 'Event', 'event_espresso' ) . '</td>';
898
-		$registrations_to_apply_payment_to .= '<td class="txn-admin-payment-paid-td jst-cntr">' . esc_html__( 'Paid', 'event_espresso' ) . '</td>';
899
-		$registrations_to_apply_payment_to .= '<td class="txn-admin-payment-owing-td jst-cntr">' . esc_html__( 'Owing', 'event_espresso' ) . '</td>';
900
-		$registrations_to_apply_payment_to .= '<td class="jst-cntr">' . esc_html__( 'Apply', 'event_espresso' ) . '</td>';
894
+		$registrations_to_apply_payment_to .= '<td>'.esc_html__('ID', 'event_espresso').'</td>';
895
+		$registrations_to_apply_payment_to .= '<td>'.esc_html__('Registrant', 'event_espresso').'</td>';
896
+		$registrations_to_apply_payment_to .= '<td>'.esc_html__('Ticket', 'event_espresso').'</td>';
897
+		$registrations_to_apply_payment_to .= '<td>'.esc_html__('Event', 'event_espresso').'</td>';
898
+		$registrations_to_apply_payment_to .= '<td class="txn-admin-payment-paid-td jst-cntr">'.esc_html__('Paid', 'event_espresso').'</td>';
899
+		$registrations_to_apply_payment_to .= '<td class="txn-admin-payment-owing-td jst-cntr">'.esc_html__('Owing', 'event_espresso').'</td>';
900
+		$registrations_to_apply_payment_to .= '<td class="jst-cntr">'.esc_html__('Apply', 'event_espresso').'</td>';
901 901
 		$registrations_to_apply_payment_to .= '</tr></thead><tbody>';
902 902
 		// get registrations for TXN
903
-		$registrations = $this->_transaction->registrations( $query_params );
904
-		foreach ( $registrations as $registration ) {
905
-			if ( $registration instanceof EE_Registration ) {
903
+		$registrations = $this->_transaction->registrations($query_params);
904
+		foreach ($registrations as $registration) {
905
+			if ($registration instanceof EE_Registration) {
906 906
 				$owing = $registration->final_price() - $registration->paid();
907
-				$taxable = $registration->ticket()->taxable() ? ' <span class="smaller-text lt-grey-text"> ' . esc_html__( '+ tax', 'event_espresso' ) . '</span>' : '';
908
-				$checked = empty( $existing_reg_payments ) || in_array( $registration->ID(), $existing_reg_payments ) ? ' checked="checked"' : '';
909
-				$registrations_to_apply_payment_to .= '<tr id="apply-payment-registration-row-' . $registration->ID() . '">';
907
+				$taxable = $registration->ticket()->taxable() ? ' <span class="smaller-text lt-grey-text"> '.esc_html__('+ tax', 'event_espresso').'</span>' : '';
908
+				$checked = empty($existing_reg_payments) || in_array($registration->ID(), $existing_reg_payments) ? ' checked="checked"' : '';
909
+				$registrations_to_apply_payment_to .= '<tr id="apply-payment-registration-row-'.$registration->ID().'">';
910 910
 				// add html for checkbox input and label
911
-				$registrations_to_apply_payment_to .= '<td>' . $registration->ID() . '</td>';
912
-				$registrations_to_apply_payment_to .= '<td>' . $registration->attendee() instanceof EE_Attendee ? $registration->attendee()->full_name() : esc_html__( 'Unknown Attendee', 'event_espresso' ) . '</td>';
913
-				$registrations_to_apply_payment_to .= '<td>' . $registration->ticket()->name() . ' : ' . $registration->ticket()->pretty_price() . $taxable . '</td>';
914
-				$registrations_to_apply_payment_to .= '<td>' . $registration->event_name() . '</td>';
915
-				$registrations_to_apply_payment_to .= '<td class="txn-admin-payment-paid-td jst-rght">' . $registration->pretty_paid() . '</td>';
916
-				$registrations_to_apply_payment_to .= '<td class="txn-admin-payment-owing-td jst-rght">' . EEH_Template::format_currency( $owing ) . '</td>';
911
+				$registrations_to_apply_payment_to .= '<td>'.$registration->ID().'</td>';
912
+				$registrations_to_apply_payment_to .= '<td>'.$registration->attendee() instanceof EE_Attendee ? $registration->attendee()->full_name() : esc_html__('Unknown Attendee', 'event_espresso').'</td>';
913
+				$registrations_to_apply_payment_to .= '<td>'.$registration->ticket()->name().' : '.$registration->ticket()->pretty_price().$taxable.'</td>';
914
+				$registrations_to_apply_payment_to .= '<td>'.$registration->event_name().'</td>';
915
+				$registrations_to_apply_payment_to .= '<td class="txn-admin-payment-paid-td jst-rght">'.$registration->pretty_paid().'</td>';
916
+				$registrations_to_apply_payment_to .= '<td class="txn-admin-payment-owing-td jst-rght">'.EEH_Template::format_currency($owing).'</td>';
917 917
 				$registrations_to_apply_payment_to .= '<td class="jst-cntr">';
918 918
 				$disabled = $registration->final_price() > 0 ? '' : ' disabled';
919
-				$registrations_to_apply_payment_to .= '<input type="checkbox" value="' . $registration->ID() . '" name="txn_admin_payment[registrations]"' . $checked . $disabled . '>';
919
+				$registrations_to_apply_payment_to .= '<input type="checkbox" value="'.$registration->ID().'" name="txn_admin_payment[registrations]"'.$checked.$disabled.'>';
920 920
 				$registrations_to_apply_payment_to .= '</td>';
921 921
 				$registrations_to_apply_payment_to .= '</tr>';
922 922
 			}
923 923
 		}
924 924
 		$registrations_to_apply_payment_to .= '</tbody></table></div>';
925
-		$registrations_to_apply_payment_to .= '<p class="clear description">' . esc_html__( 'The payment will only be applied to the registrations that have a check mark in their corresponding check box. Checkboxes for free registrations have been disabled.', 'event_espresso' ) . '</p></div>';
926
-		$this->_template_args[ 'registrations_to_apply_payment_to' ] = $registrations_to_apply_payment_to;
925
+		$registrations_to_apply_payment_to .= '<p class="clear description">'.esc_html__('The payment will only be applied to the registrations that have a check mark in their corresponding check box. Checkboxes for free registrations have been disabled.', 'event_espresso').'</p></div>';
926
+		$this->_template_args['registrations_to_apply_payment_to'] = $registrations_to_apply_payment_to;
927 927
 	}
928 928
 
929 929
 
@@ -940,9 +940,9 @@  discard block
 block discarded – undo
940 940
 		$statuses = EEM_Registration::reg_status_array(array(), TRUE);
941 941
 		//let's add a "don't change" option.
942 942
 		$status_array['NAN'] = esc_html__('Leave the Same', 'event_espresso');
943
-		$status_array = array_merge( $status_array, $statuses );
944
-		$this->_template_args['status_change_select'] = EEH_Form_Fields::select_input( 'txn_reg_status_change[reg_status]', $status_array, 'NAN', 'id="txn-admin-payment-reg-status-inp"', 'txn-reg-status-change-reg-status' );
945
-		$this->_template_args['delete_status_change_select'] = EEH_Form_Fields::select_input( 'delete_txn_reg_status_change[reg_status]', $status_array, 'NAN', 'delete-txn-admin-payment-reg-status-inp', 'delete-txn-reg-status-change-reg-status' );
943
+		$status_array = array_merge($status_array, $statuses);
944
+		$this->_template_args['status_change_select'] = EEH_Form_Fields::select_input('txn_reg_status_change[reg_status]', $status_array, 'NAN', 'id="txn-admin-payment-reg-status-inp"', 'txn-reg-status-change-reg-status');
945
+		$this->_template_args['delete_status_change_select'] = EEH_Form_Fields::select_input('delete_txn_reg_status_change[reg_status]', $status_array, 'NAN', 'delete-txn-admin-payment-reg-status-inp', 'delete-txn-reg-status-change-reg-status');
946 946
 
947 947
 	}
948 948
 
@@ -957,21 +957,21 @@  discard block
 block discarded – undo
957 957
 	 * @param EE_Payment[] to show on this page
958 958
 	 *	@return void
959 959
 	 */
960
-	private function _get_payment_methods( $payments = array() ) {
960
+	private function _get_payment_methods($payments = array()) {
961 961
 		$payment_methods_of_payments = array();
962
-		foreach( $payments as $payment ){
963
-			if( $payment instanceof EE_Payment ){
964
-				$payment_methods_of_payments[] = $payment->get( 'PMD_ID' );
962
+		foreach ($payments as $payment) {
963
+			if ($payment instanceof EE_Payment) {
964
+				$payment_methods_of_payments[] = $payment->get('PMD_ID');
965 965
 			}
966 966
 		}
967
-		if( $payment_methods_of_payments ){
968
-			$query_args = array( array( 'OR*payment_method_for_payment' => array(
969
-					'PMD_ID' => array( 'IN', $payment_methods_of_payments ),
970
-					'PMD_scope' => array( 'LIKE', '%' . EEM_Payment_Method::scope_admin . '%' ) ) ) );
971
-		}else{
972
-			$query_args = array( array( 'PMD_scope' => array( 'LIKE', '%' . EEM_Payment_Method::scope_admin . '%' ) ) );
967
+		if ($payment_methods_of_payments) {
968
+			$query_args = array(array('OR*payment_method_for_payment' => array(
969
+					'PMD_ID' => array('IN', $payment_methods_of_payments),
970
+					'PMD_scope' => array('LIKE', '%'.EEM_Payment_Method::scope_admin.'%') )));
971
+		} else {
972
+			$query_args = array(array('PMD_scope' => array('LIKE', '%'.EEM_Payment_Method::scope_admin.'%')));
973 973
 		}
974
-		$this->_template_args['payment_methods'] = EEM_Payment_Method::instance()->get_all( $query_args );
974
+		$this->_template_args['payment_methods'] = EEM_Payment_Method::instance()->get_all($query_args);
975 975
 	}
976 976
 
977 977
 
@@ -985,46 +985,46 @@  discard block
 block discarded – undo
985 985
 	 * @param array $metabox
986 986
 	 * @return void
987 987
 	 */
988
-	public function txn_attendees_meta_box( $post, $metabox = array( 'args' => array() )) {
988
+	public function txn_attendees_meta_box($post, $metabox = array('args' => array())) {
989 989
 
990
-		extract( $metabox['args'] );
990
+		extract($metabox['args']);
991 991
 		$this->_template_args['post'] = $post;
992 992
 		$this->_template_args['event_attendees'] = array();
993 993
 		// process items in cart
994
-		$line_items = $this->_transaction->get_many_related('Line_Item', array( array( 'LIN_type' => 'line-item' ) ) );
995
-		if ( ! empty( $line_items )) {
996
-			foreach ( $line_items as $item ) {
997
-				if ( $item instanceof EE_Line_Item ) {
998
-					switch( $item->OBJ_type() ) {
994
+		$line_items = $this->_transaction->get_many_related('Line_Item', array(array('LIN_type' => 'line-item')));
995
+		if ( ! empty($line_items)) {
996
+			foreach ($line_items as $item) {
997
+				if ($item instanceof EE_Line_Item) {
998
+					switch ($item->OBJ_type()) {
999 999
 
1000 1000
 						case 'Event' :
1001 1001
 							break;
1002 1002
 
1003 1003
 						case 'Ticket' :
1004 1004
 							$ticket = $item->ticket();
1005
-							if ( empty( $ticket )) {
1005
+							if (empty($ticket)) {
1006 1006
 								continue; //right now we're only handling tickets here.  Cause its expected that only tickets will have attendees right?
1007 1007
 							}
1008
-							$ticket_price = EEH_Template::format_currency( $item->get( 'LIN_unit_price' ));
1008
+							$ticket_price = EEH_Template::format_currency($item->get('LIN_unit_price'));
1009 1009
 							$event = $ticket->get_first_related('Registration')->get_first_related('Event');
1010
-							$event_name = $event instanceof EE_Event ? $event->get('EVT_name') . ' - ' . $item->get('LIN_name') : '';
1010
+							$event_name = $event instanceof EE_Event ? $event->get('EVT_name').' - '.$item->get('LIN_name') : '';
1011 1011
 
1012
-							$registrations = $ticket->get_many_related('Registration', array( array('TXN_ID' => $this->_transaction->ID() )));
1013
-							foreach( $registrations as $registration ) {
1014
-								$this->_template_args['event_attendees'][$registration->ID()]['att_num'] 						= $registration->get('REG_count');
1015
-								$this->_template_args['event_attendees'][$registration->ID()]['event_ticket_name'] 	= $event_name;
1016
-								$this->_template_args['event_attendees'][$registration->ID()]['ticket_price'] 				= $ticket_price;
1012
+							$registrations = $ticket->get_many_related('Registration', array(array('TXN_ID' => $this->_transaction->ID())));
1013
+							foreach ($registrations as $registration) {
1014
+								$this->_template_args['event_attendees'][$registration->ID()]['att_num'] = $registration->get('REG_count');
1015
+								$this->_template_args['event_attendees'][$registration->ID()]['event_ticket_name'] = $event_name;
1016
+								$this->_template_args['event_attendees'][$registration->ID()]['ticket_price'] = $ticket_price;
1017 1017
 								// attendee info
1018 1018
 								$attendee = $registration->get_first_related('Attendee');
1019
-								if ( $attendee instanceof EE_Attendee ) {
1019
+								if ($attendee instanceof EE_Attendee) {
1020 1020
 									$this->_template_args['event_attendees'][$registration->ID()]['att_id'] 			= $attendee->ID();
1021 1021
 									$this->_template_args['event_attendees'][$registration->ID()]['attendee'] 	= $attendee->full_name();
1022
-									$this->_template_args['event_attendees'][$registration->ID()]['email'] 			= '<a href="mailto:' . $attendee->email() . '?subject=' . $event->get('EVT_name') . esc_html__(' Event', 'event_espresso') . '">' . $attendee->email() . '</a>';
1023
-									$this->_template_args['event_attendees'][$registration->ID()]['address'] 		=  implode(',<br>', $attendee->full_address_as_array() );
1022
+									$this->_template_args['event_attendees'][$registration->ID()]['email'] = '<a href="mailto:'.$attendee->email().'?subject='.$event->get('EVT_name').esc_html__(' Event', 'event_espresso').'">'.$attendee->email().'</a>';
1023
+									$this->_template_args['event_attendees'][$registration->ID()]['address'] 		= implode(',<br>', $attendee->full_address_as_array());
1024 1024
 								} else {
1025 1025
 									$this->_template_args['event_attendees'][$registration->ID()]['att_id'] 			= '';
1026 1026
 									$this->_template_args['event_attendees'][$registration->ID()]['attendee'] 	= '';
1027
-									$this->_template_args['event_attendees'][$registration->ID()]['email'] 			= '';
1027
+									$this->_template_args['event_attendees'][$registration->ID()]['email'] = '';
1028 1028
 									$this->_template_args['event_attendees'][$registration->ID()]['address'] 		= '';
1029 1029
 								}
1030 1030
 							}
@@ -1034,12 +1034,12 @@  discard block
 block discarded – undo
1034 1034
 				}
1035 1035
 			}
1036 1036
 
1037
-			$this->_template_args['transaction_form_url'] = add_query_arg( array( 'action' => 'edit_transaction', 'process' => 'attendees'  ), TXN_ADMIN_URL );
1038
-			echo EEH_Template::display_template( TXN_TEMPLATE_PATH . 'txn_admin_details_main_meta_box_attendees.template.php', $this->_template_args, TRUE );
1037
+			$this->_template_args['transaction_form_url'] = add_query_arg(array('action' => 'edit_transaction', 'process' => 'attendees'), TXN_ADMIN_URL);
1038
+			echo EEH_Template::display_template(TXN_TEMPLATE_PATH.'txn_admin_details_main_meta_box_attendees.template.php', $this->_template_args, TRUE);
1039 1039
 
1040 1040
 		} else {
1041 1041
 			echo sprintf(
1042
-				esc_html__( '%1$sFor some reason, there are no attendees registered for this transaction. Likely the registration was abandoned in process.%2$s', 'event_espresso' ),
1042
+				esc_html__('%1$sFor some reason, there are no attendees registered for this transaction. Likely the registration was abandoned in process.%2$s', 'event_espresso'),
1043 1043
 				'<p class="important-notice">',
1044 1044
 				'</p>'
1045 1045
 			);
@@ -1058,19 +1058,19 @@  discard block
 block discarded – undo
1058 1058
 	 */
1059 1059
 	public function txn_registrant_side_meta_box() {
1060 1060
 		$primary_att = $this->_transaction->primary_registration() instanceof EE_Registration ? $this->_transaction->primary_registration()->get_first_related('Attendee') : null;
1061
-		if ( ! $primary_att instanceof EE_Attendee ) {
1061
+		if ( ! $primary_att instanceof EE_Attendee) {
1062 1062
 			$this->_template_args['no_attendee_message'] = esc_html__('There is no attached contact for this transaction.  The transaction either failed due to an error or was abandoned.', 'event_espresso');
1063 1063
 			$primary_att = EEM_Attendee::instance()->create_default_object();
1064 1064
 		}
1065
-		$this->_template_args['ATT_ID'] 						= $primary_att->ID();
1065
+		$this->_template_args['ATT_ID'] = $primary_att->ID();
1066 1066
 		$this->_template_args['prime_reg_fname']		= $primary_att->fname();
1067 1067
 		$this->_template_args['prime_reg_lname']		= $primary_att->lname();
1068
-		$this->_template_args['prime_reg_email'] 		= $primary_att->email();
1068
+		$this->_template_args['prime_reg_email'] = $primary_att->email();
1069 1069
 		$this->_template_args['prime_reg_phone'] 	= $primary_att->phone();
1070
-		$this->_template_args['edit_attendee_url'] 	= EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'edit_attendee', 'post' => $primary_att->ID()  ), REG_ADMIN_URL );
1070
+		$this->_template_args['edit_attendee_url'] = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'edit_attendee', 'post' => $primary_att->ID()), REG_ADMIN_URL);
1071 1071
 		// get formatted address for registrant
1072
-		$this->_template_args[ 'formatted_address' ] = EEH_Address::format( $primary_att );
1073
-		echo EEH_Template::display_template( TXN_TEMPLATE_PATH . 'txn_admin_details_side_meta_box_registrant.template.php', $this->_template_args, TRUE );
1072
+		$this->_template_args['formatted_address'] = EEH_Address::format($primary_att);
1073
+		echo EEH_Template::display_template(TXN_TEMPLATE_PATH.'txn_admin_details_side_meta_box_registrant.template.php', $this->_template_args, TRUE);
1074 1074
 	}
1075 1075
 
1076 1076
 
@@ -1086,12 +1086,12 @@  discard block
 block discarded – undo
1086 1086
 
1087 1087
 		$this->_template_args['billing_form'] = $this->_transaction->billing_info();
1088 1088
 		$this->_template_args['billing_form_url'] = add_query_arg(
1089
-			array( 'action' => 'edit_transaction', 'process' => 'billing'  ),
1089
+			array('action' => 'edit_transaction', 'process' => 'billing'),
1090 1090
 			TXN_ADMIN_URL
1091 1091
 		);
1092 1092
 
1093
-		$template_path = TXN_TEMPLATE_PATH . 'txn_admin_details_side_meta_box_billing_info.template.php';
1094
-		echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE );/**/
1093
+		$template_path = TXN_TEMPLATE_PATH.'txn_admin_details_side_meta_box_billing_info.template.php';
1094
+		echo EEH_Template::display_template($template_path, $this->_template_args, TRUE); /**/
1095 1095
 	}
1096 1096
 
1097 1097
 
@@ -1104,42 +1104,42 @@  discard block
 block discarded – undo
1104 1104
 	*	@return void
1105 1105
 	*/
1106 1106
 	public function apply_payments_or_refunds() {
1107
-		$json_response_data = array( 'return_data' => FALSE );
1107
+		$json_response_data = array('return_data' => FALSE);
1108 1108
 		$valid_data = $this->_validate_payment_request_data();
1109
-		if ( ! empty( $valid_data ) ) {
1110
-			$PAY_ID = $valid_data[ 'PAY_ID' ];
1109
+		if ( ! empty($valid_data)) {
1110
+			$PAY_ID = $valid_data['PAY_ID'];
1111 1111
 			//save  the new payment
1112
-			$payment = $this->_create_payment_from_request_data( $valid_data );
1112
+			$payment = $this->_create_payment_from_request_data($valid_data);
1113 1113
 			// get the TXN for this payment
1114 1114
 			$transaction = $payment->transaction();
1115 1115
 			// verify transaction
1116
-			if ( $transaction instanceof EE_Transaction ) {
1116
+			if ($transaction instanceof EE_Transaction) {
1117 1117
 				// calculate_total_payments_and_update_status
1118
-				$this->_process_transaction_payments( $transaction );
1119
-				$REG_IDs = $this->_get_REG_IDs_to_apply_payment_to( $payment );
1120
-				$this->_remove_existing_registration_payments( $payment, $PAY_ID );
1118
+				$this->_process_transaction_payments($transaction);
1119
+				$REG_IDs = $this->_get_REG_IDs_to_apply_payment_to($payment);
1120
+				$this->_remove_existing_registration_payments($payment, $PAY_ID);
1121 1121
 				// apply payment to registrations (if applicable)
1122
-				if ( ! empty( $REG_IDs ) ) {
1123
-					$this->_update_registration_payments( $transaction, $payment, $REG_IDs );
1122
+				if ( ! empty($REG_IDs)) {
1123
+					$this->_update_registration_payments($transaction, $payment, $REG_IDs);
1124 1124
 					$this->_maybe_send_notifications();
1125 1125
 					// now process status changes for the same registrations
1126
-					$this->_process_registration_status_change( $transaction, $REG_IDs );
1126
+					$this->_process_registration_status_change($transaction, $REG_IDs);
1127 1127
 				}
1128
-				$this->_maybe_send_notifications( $payment );
1128
+				$this->_maybe_send_notifications($payment);
1129 1129
 				//prepare to render page
1130
-				$json_response_data[ 'return_data' ] = $this->_build_payment_json_response( $payment, $REG_IDs );
1131
-				do_action( 'AHEE__Transactions_Admin_Page__apply_payments_or_refund__after_recording', $transaction, $payment );
1130
+				$json_response_data['return_data'] = $this->_build_payment_json_response($payment, $REG_IDs);
1131
+				do_action('AHEE__Transactions_Admin_Page__apply_payments_or_refund__after_recording', $transaction, $payment);
1132 1132
 			} else {
1133 1133
 				EE_Error::add_error(
1134
-					esc_html__( 'A valid Transaction for this payment could not be retrieved.', 'event_espresso' ),
1134
+					esc_html__('A valid Transaction for this payment could not be retrieved.', 'event_espresso'),
1135 1135
 					__FILE__, __FUNCTION__, __LINE__
1136 1136
 				);
1137 1137
 			}
1138 1138
 		} else {
1139
-			EE_Error::add_error( esc_html__( 'The payment form data could not be processed. Please try again.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
1139
+			EE_Error::add_error(esc_html__('The payment form data could not be processed. Please try again.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1140 1140
 		}
1141 1141
 
1142
-		$notices = EE_Error::get_notices( false, false, false );
1142
+		$notices = EE_Error::get_notices(false, false, false);
1143 1143
 		$this->_template_args = array(
1144 1144
 			'data' => $json_response_data,
1145 1145
 			'error' => $notices['errors'],
@@ -1156,30 +1156,30 @@  discard block
 block discarded – undo
1156 1156
 	 * @return array
1157 1157
 	 */
1158 1158
 	protected function _validate_payment_request_data() {
1159
-		if ( ! isset( $this->_req_data[ 'txn_admin_payment' ] ) ) {
1159
+		if ( ! isset($this->_req_data['txn_admin_payment'])) {
1160 1160
 			return false;
1161 1161
 		}
1162 1162
 		$payment_form = $this->_generate_payment_form_section();
1163 1163
 		try {
1164
-			if ( $payment_form->was_submitted() ) {
1164
+			if ($payment_form->was_submitted()) {
1165 1165
 				$payment_form->receive_form_submission();
1166
-				if ( ! $payment_form->is_valid() ) {
1166
+				if ( ! $payment_form->is_valid()) {
1167 1167
 					$submission_error_messages = array();
1168
-					foreach ( $payment_form->get_validation_errors_accumulated() as $validation_error ) {
1169
-						if ( $validation_error instanceof EE_Validation_Error ) {
1168
+					foreach ($payment_form->get_validation_errors_accumulated() as $validation_error) {
1169
+						if ($validation_error instanceof EE_Validation_Error) {
1170 1170
 							$submission_error_messages[] = sprintf(
1171
-								_x( '%s : %s', 'Form Section Name : Form Validation Error', 'event_espresso' ),
1171
+								_x('%s : %s', 'Form Section Name : Form Validation Error', 'event_espresso'),
1172 1172
 								$validation_error->get_form_section()->html_label_text(),
1173 1173
 								$validation_error->getMessage()
1174 1174
 							);
1175 1175
 						}
1176 1176
 					}
1177
-					EE_Error::add_error( join( '<br />', $submission_error_messages ), __FILE__, __FUNCTION__, __LINE__ );
1177
+					EE_Error::add_error(join('<br />', $submission_error_messages), __FILE__, __FUNCTION__, __LINE__);
1178 1178
 					return array();
1179 1179
 				}
1180 1180
 			}
1181
-		} catch ( EE_Error $e ) {
1182
-			EE_Error::add_error( $e->getMessage(), __FILE__, __FUNCTION__, __LINE__ );
1181
+		} catch (EE_Error $e) {
1182
+			EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__);
1183 1183
 			return array();
1184 1184
 		}
1185 1185
 		return $payment_form->valid_data();
@@ -1201,63 +1201,63 @@  discard block
 block discarded – undo
1201 1201
 						array(
1202 1202
 							'default' => 0,
1203 1203
 							'required' => false,
1204
-							'html_label_text' => esc_html__( 'Payment ID', 'event_espresso' ),
1205
-							'validation_strategies' => array( new EE_Int_Normalization() )
1204
+							'html_label_text' => esc_html__('Payment ID', 'event_espresso'),
1205
+							'validation_strategies' => array(new EE_Int_Normalization())
1206 1206
 						)
1207 1207
 					),
1208 1208
 					'TXN_ID' => new EE_Text_Input(
1209 1209
 						array(
1210 1210
 							'default' => 0,
1211 1211
 							'required' => true,
1212
-							'html_label_text' => esc_html__( 'Transaction ID', 'event_espresso' ),
1213
-							'validation_strategies' => array( new EE_Int_Normalization() )
1212
+							'html_label_text' => esc_html__('Transaction ID', 'event_espresso'),
1213
+							'validation_strategies' => array(new EE_Int_Normalization())
1214 1214
 						)
1215 1215
 					),
1216 1216
 					'type' => new EE_Text_Input(
1217 1217
 						array(
1218 1218
 							'default' => 1,
1219 1219
 							'required' => true,
1220
-							'html_label_text' => esc_html__( 'Payment or Refund', 'event_espresso' ),
1221
-							'validation_strategies' => array( new EE_Int_Normalization() )
1220
+							'html_label_text' => esc_html__('Payment or Refund', 'event_espresso'),
1221
+							'validation_strategies' => array(new EE_Int_Normalization())
1222 1222
 						)
1223 1223
 					),
1224 1224
 					'amount' => new EE_Text_Input(
1225 1225
 						array(
1226 1226
 							'default' => 0,
1227 1227
 							'required' => true,
1228
-							'html_label_text' => esc_html__( 'Payment amount', 'event_espresso' ),
1229
-							'validation_strategies' => array( new EE_Float_Normalization() )
1228
+							'html_label_text' => esc_html__('Payment amount', 'event_espresso'),
1229
+							'validation_strategies' => array(new EE_Float_Normalization())
1230 1230
 						)
1231 1231
 					),
1232 1232
 					'status' => new EE_Text_Input(
1233 1233
 						array(
1234 1234
 							'default' => EEM_Payment::status_id_approved,
1235 1235
 							'required' => true,
1236
-							'html_label_text' => esc_html__( 'Payment status', 'event_espresso' ),
1236
+							'html_label_text' => esc_html__('Payment status', 'event_espresso'),
1237 1237
 						)
1238 1238
 					),
1239 1239
 					'PMD_ID' => new EE_Text_Input(
1240 1240
 						array(
1241 1241
 							'default' => 2,
1242 1242
 							'required' => true,
1243
-							'html_label_text' => esc_html__( 'Payment Method', 'event_espresso' ),
1244
-							'validation_strategies' => array( new EE_Int_Normalization() )
1243
+							'html_label_text' => esc_html__('Payment Method', 'event_espresso'),
1244
+							'validation_strategies' => array(new EE_Int_Normalization())
1245 1245
 						)
1246 1246
 					),
1247 1247
 					'date' => new EE_Text_Input(
1248 1248
 						array(
1249 1249
 							'default' => time(),
1250 1250
 							'required' => true,
1251
-							'html_label_text' => esc_html__( 'Payment date', 'event_espresso' ),
1251
+							'html_label_text' => esc_html__('Payment date', 'event_espresso'),
1252 1252
 						)
1253 1253
 					),
1254 1254
 					'txn_id_chq_nmbr' => new EE_Text_Input(
1255 1255
 						array(
1256 1256
 							'default' => '',
1257 1257
 							'required' => false,
1258
-							'html_label_text' => esc_html__( 'Transaction or Cheque Number', 'event_espresso' ),
1258
+							'html_label_text' => esc_html__('Transaction or Cheque Number', 'event_espresso'),
1259 1259
                                                         'validation_strategies' => array(
1260
-                                                            new EE_Max_Length_Validation_Strategy( esc_html__('Input too long', 'event_espresso'), 100 ),
1260
+                                                            new EE_Max_Length_Validation_Strategy(esc_html__('Input too long', 'event_espresso'), 100),
1261 1261
                                                         )
1262 1262
 						)
1263 1263
 					),
@@ -1265,9 +1265,9 @@  discard block
 block discarded – undo
1265 1265
 						array(
1266 1266
 							'default' => '',
1267 1267
 							'required' => false,
1268
-							'html_label_text' => esc_html__( 'Purchase Order Number', 'event_espresso' ),
1268
+							'html_label_text' => esc_html__('Purchase Order Number', 'event_espresso'),
1269 1269
                                                         'validation_strategies' => array(
1270
-                                                            new EE_Max_Length_Validation_Strategy( esc_html__('Input too long', 'event_espresso'), 100 ),
1270
+                                                            new EE_Max_Length_Validation_Strategy(esc_html__('Input too long', 'event_espresso'), 100),
1271 1271
                                                         )
1272 1272
 						)
1273 1273
 					),
@@ -1275,9 +1275,9 @@  discard block
 block discarded – undo
1275 1275
 						array(
1276 1276
 							'default' => '',
1277 1277
 							'required' => false,
1278
-							'html_label_text' => esc_html__( 'Extra Field for Accounting', 'event_espresso' ),
1278
+							'html_label_text' => esc_html__('Extra Field for Accounting', 'event_espresso'),
1279 1279
                                                         'validation_strategies' => array(
1280
-                                                            new EE_Max_Length_Validation_Strategy( esc_html__('Input too long', 'event_espresso'), 100 ),
1280
+                                                            new EE_Max_Length_Validation_Strategy(esc_html__('Input too long', 'event_espresso'), 100),
1281 1281
                                                         )
1282 1282
 						)
1283 1283
 					),
@@ -1294,37 +1294,37 @@  discard block
 block discarded – undo
1294 1294
 	 * @param array $valid_data
1295 1295
 	 * @return EE_Payment
1296 1296
 	 */
1297
-	protected function _create_payment_from_request_data( $valid_data ) {
1298
-		$PAY_ID = $valid_data[ 'PAY_ID' ];
1297
+	protected function _create_payment_from_request_data($valid_data) {
1298
+		$PAY_ID = $valid_data['PAY_ID'];
1299 1299
 		// get payment amount
1300
-		$amount = $valid_data[ 'amount' ] ? abs( $valid_data[ 'amount' ] ) : 0;
1300
+		$amount = $valid_data['amount'] ? abs($valid_data['amount']) : 0;
1301 1301
 		// payments have a type value of 1 and refunds have a type value of -1
1302 1302
 		// so multiplying amount by type will give a positive value for payments, and negative values for refunds
1303
-		$amount = $valid_data[ 'type' ] < 0 ? $amount * -1 : $amount;
1303
+		$amount = $valid_data['type'] < 0 ? $amount * -1 : $amount;
1304 1304
 		// for some reason the date string coming in has extra spaces between the date and time.  This fixes that.
1305
-		$date = $valid_data['date'] ? preg_replace( '/\s+/', ' ', $valid_data['date'] ) : date( 'Y-m-d g:i a', current_time( 'timestamp' ) );
1305
+		$date = $valid_data['date'] ? preg_replace('/\s+/', ' ', $valid_data['date']) : date('Y-m-d g:i a', current_time('timestamp'));
1306 1306
 		$payment = EE_Payment::new_instance(
1307 1307
 			array(
1308
-				'TXN_ID' 								=> $valid_data[ 'TXN_ID' ],
1309
-				'STS_ID' 								=> $valid_data[ 'status' ],
1308
+				'TXN_ID' 								=> $valid_data['TXN_ID'],
1309
+				'STS_ID' 								=> $valid_data['status'],
1310 1310
 				'PAY_timestamp' 				=> $date,
1311 1311
 				'PAY_source'           			=> EEM_Payment_Method::scope_admin,
1312
-				'PMD_ID'               				=> $valid_data[ 'PMD_ID' ],
1312
+				'PMD_ID'               				=> $valid_data['PMD_ID'],
1313 1313
 				'PAY_amount'           			=> $amount,
1314
-				'PAY_txn_id_chq_nmbr'  	=> $valid_data[ 'txn_id_chq_nmbr' ],
1315
-				'PAY_po_number'        		=> $valid_data[ 'po_number' ],
1316
-				'PAY_extra_accntng'    		=> $valid_data[ 'accounting' ],
1314
+				'PAY_txn_id_chq_nmbr'  	=> $valid_data['txn_id_chq_nmbr'],
1315
+				'PAY_po_number'        		=> $valid_data['po_number'],
1316
+				'PAY_extra_accntng'    		=> $valid_data['accounting'],
1317 1317
 				'PAY_details'          				=> $valid_data,
1318 1318
 				'PAY_ID'               				=> $PAY_ID
1319 1319
 			),
1320 1320
 			'',
1321
-			array( 'Y-m-d', 'g:i a' )
1321
+			array('Y-m-d', 'g:i a')
1322 1322
 		);
1323 1323
 
1324
-		if ( ! $payment->save() ) {
1324
+		if ( ! $payment->save()) {
1325 1325
 			EE_Error::add_error(
1326 1326
 				sprintf(
1327
-					esc_html__( 'Payment %1$d has not been successfully saved to the database.', 'event_espresso' ),
1327
+					esc_html__('Payment %1$d has not been successfully saved to the database.', 'event_espresso'),
1328 1328
 					$payment->ID()
1329 1329
 				),
1330 1330
 				__FILE__, __FUNCTION__, __LINE__
@@ -1341,15 +1341,15 @@  discard block
 block discarded – undo
1341 1341
 	 * @param \EE_Transaction $transaction
1342 1342
 	 * @return array
1343 1343
 	 */
1344
-	protected function _process_transaction_payments( EE_Transaction $transaction ) {
1344
+	protected function _process_transaction_payments(EE_Transaction $transaction) {
1345 1345
 		/** @type EE_Transaction_Payments $transaction_payments */
1346
-		$transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' );
1346
+		$transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments');
1347 1347
 		//update the transaction with this payment
1348
-		if ( $transaction_payments->calculate_total_payments_and_update_status( $transaction ) ) {
1349
-			EE_Error::add_success( esc_html__( 'The payment has been processed successfully.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
1348
+		if ($transaction_payments->calculate_total_payments_and_update_status($transaction)) {
1349
+			EE_Error::add_success(esc_html__('The payment has been processed successfully.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1350 1350
 		} else {
1351 1351
 			EE_Error::add_error(
1352
-				esc_html__( 'The payment was processed successfully but the amount paid for the transaction was not updated.', 'event_espresso' )
1352
+				esc_html__('The payment was processed successfully but the amount paid for the transaction was not updated.', 'event_espresso')
1353 1353
 				, __FILE__, __FUNCTION__, __LINE__
1354 1354
 			);
1355 1355
 		}
@@ -1365,19 +1365,19 @@  discard block
 block discarded – undo
1365 1365
 	 * @param \EE_Payment $payment
1366 1366
 	 * @return array
1367 1367
 	 */
1368
-	protected function _get_REG_IDs_to_apply_payment_to( EE_Payment $payment ) {
1368
+	protected function _get_REG_IDs_to_apply_payment_to(EE_Payment $payment) {
1369 1369
 		$REG_IDs = array();
1370 1370
 		// grab array of IDs for specific registrations to apply changes to
1371
-		if ( isset( $this->_req_data[ 'txn_admin_payment' ][ 'registrations' ] ) ) {
1372
-			$REG_IDs = (array)$this->_req_data[ 'txn_admin_payment' ][ 'registrations' ];
1371
+		if (isset($this->_req_data['txn_admin_payment']['registrations'])) {
1372
+			$REG_IDs = (array) $this->_req_data['txn_admin_payment']['registrations'];
1373 1373
 		}
1374 1374
 		//nothing specified ? then get all reg IDs
1375
-		if ( empty( $REG_IDs ) ) {
1375
+		if (empty($REG_IDs)) {
1376 1376
 			$registrations = $payment->transaction()->registrations();
1377
-			$REG_IDs = ! empty( $registrations ) ? array_keys( $registrations ) : $this->_get_existing_reg_payment_REG_IDs( $payment );
1377
+			$REG_IDs = ! empty($registrations) ? array_keys($registrations) : $this->_get_existing_reg_payment_REG_IDs($payment);
1378 1378
 		}
1379 1379
 		// ensure that REG_IDs are integers and NOT strings
1380
-		return array_map( 'intval', $REG_IDs );
1380
+		return array_map('intval', $REG_IDs);
1381 1381
 	}
1382 1382
 
1383 1383
 
@@ -1394,7 +1394,7 @@  discard block
 block discarded – undo
1394 1394
 	/**
1395 1395
 	 * @param array $existing_reg_payment_REG_IDs
1396 1396
 	 */
1397
-	public function set_existing_reg_payment_REG_IDs( $existing_reg_payment_REG_IDs = null ) {
1397
+	public function set_existing_reg_payment_REG_IDs($existing_reg_payment_REG_IDs = null) {
1398 1398
 		$this->_existing_reg_payment_REG_IDs = $existing_reg_payment_REG_IDs;
1399 1399
 	}
1400 1400
 
@@ -1409,13 +1409,13 @@  discard block
 block discarded – undo
1409 1409
 	 * @param \EE_Payment $payment
1410 1410
 	 * @return array
1411 1411
 	 */
1412
-	protected function _get_existing_reg_payment_REG_IDs( EE_Payment $payment ) {
1413
-		if ( $this->existing_reg_payment_REG_IDs() === null ) {
1412
+	protected function _get_existing_reg_payment_REG_IDs(EE_Payment $payment) {
1413
+		if ($this->existing_reg_payment_REG_IDs() === null) {
1414 1414
 			// let's get any existing reg payment records for this payment
1415
-			$existing_reg_payment_REG_IDs = $payment->get_many_related( 'Registration' );
1415
+			$existing_reg_payment_REG_IDs = $payment->get_many_related('Registration');
1416 1416
 			// but we only want the REG IDs, so grab the array keys
1417
-			$existing_reg_payment_REG_IDs = ! empty( $existing_reg_payment_REG_IDs ) ? array_keys( $existing_reg_payment_REG_IDs ) : array();
1418
-			$this->set_existing_reg_payment_REG_IDs( $existing_reg_payment_REG_IDs );
1417
+			$existing_reg_payment_REG_IDs = ! empty($existing_reg_payment_REG_IDs) ? array_keys($existing_reg_payment_REG_IDs) : array();
1418
+			$this->set_existing_reg_payment_REG_IDs($existing_reg_payment_REG_IDs);
1419 1419
 		}
1420 1420
 		return $this->existing_reg_payment_REG_IDs();
1421 1421
 	}
@@ -1434,23 +1434,23 @@  discard block
 block discarded – undo
1434 1434
 	 * @param int         $PAY_ID
1435 1435
 	 * @return bool;
1436 1436
 	 */
1437
-	protected function _remove_existing_registration_payments( EE_Payment $payment, $PAY_ID = 0 ) {
1437
+	protected function _remove_existing_registration_payments(EE_Payment $payment, $PAY_ID = 0) {
1438 1438
 		// newly created payments will have nothing recorded for $PAY_ID
1439
-		if ( $PAY_ID == 0 ) {
1439
+		if ($PAY_ID == 0) {
1440 1440
 			return false;
1441 1441
 		}
1442
-		$existing_reg_payment_REG_IDs = $this->_get_existing_reg_payment_REG_IDs( $payment );
1443
-		if ( empty( $existing_reg_payment_REG_IDs )) {
1442
+		$existing_reg_payment_REG_IDs = $this->_get_existing_reg_payment_REG_IDs($payment);
1443
+		if (empty($existing_reg_payment_REG_IDs)) {
1444 1444
 			return false;
1445 1445
 		}
1446 1446
 		/** @type EE_Transaction_Payments $transaction_payments */
1447
-		$transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' );
1447
+		$transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments');
1448 1448
 		return $transaction_payments->delete_registration_payments_and_update_registrations(
1449 1449
 			$payment,
1450 1450
 			array(
1451 1451
 				array(
1452 1452
 					'PAY_ID' => $payment->ID(),
1453
-					'REG_ID' => array( 'IN', $existing_reg_payment_REG_IDs ),
1453
+					'REG_ID' => array('IN', $existing_reg_payment_REG_IDs),
1454 1454
 				)
1455 1455
 			)
1456 1456
 		);
@@ -1469,25 +1469,25 @@  discard block
 block discarded – undo
1469 1469
 	 * @param array $REG_IDs
1470 1470
 	 * @return bool
1471 1471
 	 */
1472
-	protected function _update_registration_payments( EE_Transaction $transaction, EE_Payment $payment, $REG_IDs = array() ) {
1472
+	protected function _update_registration_payments(EE_Transaction $transaction, EE_Payment $payment, $REG_IDs = array()) {
1473 1473
 		// we can pass our own custom set of registrations to EE_Payment_Processor::process_registration_payments()
1474 1474
 		// so let's do that using our set of REG_IDs from the form
1475 1475
 		$registration_query_where_params = array(
1476
-			'REG_ID' => array( 'IN', $REG_IDs )
1476
+			'REG_ID' => array('IN', $REG_IDs)
1477 1477
 		);
1478 1478
 		// but add in some conditions regarding payment,
1479 1479
 		// so that we don't apply payments to registrations that are free or have already been paid for
1480 1480
 		// but ONLY if the payment is NOT a refund ( ie: the payment amount is not negative )
1481
-		if ( ! $payment->is_a_refund() ) {
1482
-			$registration_query_where_params[ 'REG_final_price' ]  = array( '!=', 0 );
1483
-			$registration_query_where_params[ 'REG_final_price*' ]  = array( '!=', 'REG_paid', true );
1481
+		if ( ! $payment->is_a_refund()) {
1482
+			$registration_query_where_params['REG_final_price'] = array('!=', 0);
1483
+			$registration_query_where_params['REG_final_price*'] = array('!=', 'REG_paid', true);
1484 1484
 		}
1485 1485
 		//EEH_Debug_Tools::printr( $registration_query_where_params, '$registration_query_where_params', __FILE__, __LINE__ );
1486
-		$registrations = $transaction->registrations( array( $registration_query_where_params ) );
1487
-		if ( ! empty( $registrations ) ) {
1486
+		$registrations = $transaction->registrations(array($registration_query_where_params));
1487
+		if ( ! empty($registrations)) {
1488 1488
 			/** @type EE_Payment_Processor $payment_processor */
1489
-			$payment_processor = EE_Registry::instance()->load_core( 'Payment_Processor' );
1490
-			$payment_processor->process_registration_payments( $transaction, $payment, $registrations );
1489
+			$payment_processor = EE_Registry::instance()->load_core('Payment_Processor');
1490
+			$payment_processor->process_registration_payments($transaction, $payment, $registrations);
1491 1491
 		}
1492 1492
 	}
1493 1493
 
@@ -1503,22 +1503,22 @@  discard block
 block discarded – undo
1503 1503
 	 * @param array $REG_IDs
1504 1504
 	 * @return bool
1505 1505
 	 */
1506
-	protected function _process_registration_status_change( EE_Transaction $transaction, $REG_IDs = array() ) {
1506
+	protected function _process_registration_status_change(EE_Transaction $transaction, $REG_IDs = array()) {
1507 1507
 		// first if there is no change in status then we get out.
1508 1508
 		if (
1509
-			! isset( $this->_req_data['txn_reg_status_change'], $this->_req_data[ 'txn_reg_status_change' ][ 'reg_status' ] )
1509
+			! isset($this->_req_data['txn_reg_status_change'], $this->_req_data['txn_reg_status_change']['reg_status'])
1510 1510
 			|| $this->_req_data['txn_reg_status_change']['reg_status'] == 'NAN'
1511 1511
 		) {
1512 1512
 			//no error message, no change requested, just nothing to do man.
1513 1513
 			return FALSE;
1514 1514
 		}
1515 1515
 		/** @type EE_Transaction_Processor $transaction_processor */
1516
-		$transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' );
1516
+		$transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor');
1517 1517
 		// made it here dude?  Oh WOW.  K, let's take care of changing the statuses
1518 1518
 		return $transaction_processor->manually_update_registration_statuses(
1519 1519
 			$transaction,
1520
-			sanitize_text_field( $this->_req_data[ 'txn_reg_status_change' ][ 'reg_status' ] ),
1521
-			array( array( 'REG_ID' => array( 'IN', $REG_IDs ) ) )
1520
+			sanitize_text_field($this->_req_data['txn_reg_status_change']['reg_status']),
1521
+			array(array('REG_ID' => array('IN', $REG_IDs)))
1522 1522
 		);
1523 1523
 	}
1524 1524
 
@@ -1533,16 +1533,16 @@  discard block
 block discarded – undo
1533 1533
 	 * @param bool | null        $delete_txn_reg_status_change
1534 1534
 	 * @return array
1535 1535
 	 */
1536
-	protected function _build_payment_json_response( EE_Payment $payment, $REG_IDs = array(), $delete_txn_reg_status_change = null ) {
1536
+	protected function _build_payment_json_response(EE_Payment $payment, $REG_IDs = array(), $delete_txn_reg_status_change = null) {
1537 1537
 		// was the payment deleted ?
1538
-		if ( is_bool( $delete_txn_reg_status_change )) {
1538
+		if (is_bool($delete_txn_reg_status_change)) {
1539 1539
 			return array(
1540 1540
 				'PAY_ID' 				=> $payment->ID(),
1541 1541
 				'amount' 			=> $payment->amount(),
1542 1542
 				'total_paid' 			=> $payment->transaction()->paid(),
1543 1543
 				'txn_status' 			=> $payment->transaction()->status_ID(),
1544 1544
 				'pay_status' 		=> $payment->STS_ID(),
1545
-				'registrations' 	=> $this->_registration_payment_data_array( $REG_IDs ),
1545
+				'registrations' 	=> $this->_registration_payment_data_array($REG_IDs),
1546 1546
 				'delete_txn_reg_status_change' => $delete_txn_reg_status_change,
1547 1547
 			);
1548 1548
 		} else {
@@ -1554,16 +1554,16 @@  discard block
 block discarded – undo
1554 1554
 				'pay_status' 	=> $payment->STS_ID(),
1555 1555
 				'PAY_ID'           => $payment->ID(),
1556 1556
 				'STS_ID' 			=> $payment->STS_ID(),
1557
-				'status' 			=> self::$_pay_status[ $payment->STS_ID() ],
1558
-				'date' 				=> $payment->timestamp( 'Y-m-d', 'h:i a' ),
1559
-				'method' 		=> strtoupper( $payment->source() ),
1557
+				'status' 			=> self::$_pay_status[$payment->STS_ID()],
1558
+				'date' 				=> $payment->timestamp('Y-m-d', 'h:i a'),
1559
+				'method' 		=> strtoupper($payment->source()),
1560 1560
 				'PM_ID' 			=> $payment->payment_method() ? $payment->payment_method()->ID() : 1,
1561
-				'gateway' 		=> $payment->payment_method() ? $payment->payment_method()->admin_name() : esc_html__( "Unknown", 'event_espresso' ),
1561
+				'gateway' 		=> $payment->payment_method() ? $payment->payment_method()->admin_name() : esc_html__("Unknown", 'event_espresso'),
1562 1562
 				'gateway_response' 	=> $payment->gateway_response(),
1563 1563
 				'txn_id_chq_nmbr'  	=> $payment->txn_id_chq_nmbr(),
1564 1564
 				'po_number'        		=> $payment->po_number(),
1565 1565
 				'extra_accntng'    		=> $payment->extra_accntng(),
1566
-				'registrations'    			=> $this->_registration_payment_data_array( $REG_IDs ),
1566
+				'registrations'    			=> $this->_registration_payment_data_array($REG_IDs),
1567 1567
 			);
1568 1568
 		}
1569 1569
 	}
@@ -1578,39 +1578,39 @@  discard block
 block discarded – undo
1578 1578
 	*	@return void
1579 1579
 	*/
1580 1580
 	public function delete_payment() {
1581
-		$json_response_data = array( 'return_data' => FALSE );
1582
-		$PAY_ID = isset( $this->_req_data['delete_txn_admin_payment'], $this->_req_data['delete_txn_admin_payment']['PAY_ID'] ) ? absint( $this->_req_data['delete_txn_admin_payment']['PAY_ID'] ) : 0;
1583
-		if ( $PAY_ID ) {
1584
-			$delete_txn_reg_status_change = isset( $this->_req_data[ 'delete_txn_reg_status_change' ] ) ? $this->_req_data[ 'delete_txn_reg_status_change' ] : false;
1585
-			$payment = EEM_Payment::instance()->get_one_by_ID( $PAY_ID );
1586
-			if ( $payment instanceof EE_Payment ) {
1587
-				$REG_IDs = $this->_get_existing_reg_payment_REG_IDs( $payment );
1581
+		$json_response_data = array('return_data' => FALSE);
1582
+		$PAY_ID = isset($this->_req_data['delete_txn_admin_payment'], $this->_req_data['delete_txn_admin_payment']['PAY_ID']) ? absint($this->_req_data['delete_txn_admin_payment']['PAY_ID']) : 0;
1583
+		if ($PAY_ID) {
1584
+			$delete_txn_reg_status_change = isset($this->_req_data['delete_txn_reg_status_change']) ? $this->_req_data['delete_txn_reg_status_change'] : false;
1585
+			$payment = EEM_Payment::instance()->get_one_by_ID($PAY_ID);
1586
+			if ($payment instanceof EE_Payment) {
1587
+				$REG_IDs = $this->_get_existing_reg_payment_REG_IDs($payment);
1588 1588
 				/** @type EE_Transaction_Payments $transaction_payments */
1589
-				$transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' );
1590
-				if ( $transaction_payments->delete_payment_and_update_transaction( $payment )) {
1591
-					$json_response_data['return_data'] = $this->_build_payment_json_response( $payment, $REG_IDs, $delete_txn_reg_status_change );
1592
-					if ( $delete_txn_reg_status_change ) {
1589
+				$transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments');
1590
+				if ($transaction_payments->delete_payment_and_update_transaction($payment)) {
1591
+					$json_response_data['return_data'] = $this->_build_payment_json_response($payment, $REG_IDs, $delete_txn_reg_status_change);
1592
+					if ($delete_txn_reg_status_change) {
1593 1593
 						$this->_req_data['txn_reg_status_change'] = $delete_txn_reg_status_change;
1594 1594
 						//MAKE sure we also add the delete_txn_req_status_change to the
1595 1595
 						//$_REQUEST global because that's how messages will be looking for it.
1596 1596
 						$_REQUEST['txn_reg_status_change'] = $delete_txn_reg_status_change;
1597 1597
 						$this->_maybe_send_notifications();
1598
-						$this->_process_registration_status_change( $payment->transaction(), $REG_IDs );
1598
+						$this->_process_registration_status_change($payment->transaction(), $REG_IDs);
1599 1599
 					}
1600 1600
 				}
1601 1601
 			} else {
1602 1602
 				EE_Error::add_error(
1603
-					esc_html__( 'Valid Payment data could not be retrieved from the database.', 'event_espresso' ),
1603
+					esc_html__('Valid Payment data could not be retrieved from the database.', 'event_espresso'),
1604 1604
 					__FILE__, __FUNCTION__, __LINE__
1605 1605
 				);
1606 1606
 			}
1607 1607
 		} else {
1608 1608
 			EE_Error::add_error(
1609
-				esc_html__( 'A valid Payment ID was not received, therefore payment form data could not be loaded.', 'event_espresso' ),
1609
+				esc_html__('A valid Payment ID was not received, therefore payment form data could not be loaded.', 'event_espresso'),
1610 1610
 				__FILE__, __FUNCTION__, __LINE__
1611 1611
 			);
1612 1612
 		}
1613
-		$notices = EE_Error::get_notices( false, false, false);
1613
+		$notices = EE_Error::get_notices(false, false, false);
1614 1614
 		$this->_template_args = array(
1615 1615
 			'data' => $json_response_data,
1616 1616
 			'success' => $notices['success'],
@@ -1630,16 +1630,16 @@  discard block
 block discarded – undo
1630 1630
 	 * @param array $REG_IDs
1631 1631
 	 * @return array
1632 1632
 	 */
1633
-	protected function _registration_payment_data_array( $REG_IDs ) {
1633
+	protected function _registration_payment_data_array($REG_IDs) {
1634 1634
 		$registration_payment_data = array();
1635 1635
 		//if non empty reg_ids lets get an array of registrations and update the values for the apply_payment/refund rows.
1636
-		if ( ! empty( $REG_IDs ) ) {
1637
-			$registrations = EEM_Registration::instance()->get_all( array( array( 'REG_ID' => array( 'IN', $REG_IDs ) ) ) );
1638
-			foreach ( $registrations as $registration ) {
1639
-				if ( $registration instanceof EE_Registration ) {
1640
-					$registration_payment_data[ $registration->ID() ] = array(
1636
+		if ( ! empty($REG_IDs)) {
1637
+			$registrations = EEM_Registration::instance()->get_all(array(array('REG_ID' => array('IN', $REG_IDs))));
1638
+			foreach ($registrations as $registration) {
1639
+				if ($registration instanceof EE_Registration) {
1640
+					$registration_payment_data[$registration->ID()] = array(
1641 1641
 						'paid' => $registration->pretty_paid(),
1642
-						'owing' => EEH_Template::format_currency( $registration->final_price() - $registration->paid() ),
1642
+						'owing' => EEH_Template::format_currency($registration->final_price() - $registration->paid()),
1643 1643
 					);
1644 1644
 				}
1645 1645
 			}
@@ -1659,30 +1659,30 @@  discard block
 block discarded – undo
1659 1659
 	 * @access protected
1660 1660
 	 * @param \EE_Payment | null $payment
1661 1661
 	 */
1662
-	protected function _maybe_send_notifications( $payment = null ) {
1663
-		switch ( $payment instanceof EE_Payment ) {
1662
+	protected function _maybe_send_notifications($payment = null) {
1663
+		switch ($payment instanceof EE_Payment) {
1664 1664
 			// payment notifications
1665 1665
 			case true :
1666 1666
 				if (
1667 1667
 					isset(
1668
-						$this->_req_data[ 'txn_payments' ],
1669
-						$this->_req_data[ 'txn_payments' ][ 'send_notifications' ]
1668
+						$this->_req_data['txn_payments'],
1669
+						$this->_req_data['txn_payments']['send_notifications']
1670 1670
 					) &&
1671
-					filter_var( $this->_req_data[ 'txn_payments' ][ 'send_notifications' ], FILTER_VALIDATE_BOOLEAN )
1671
+					filter_var($this->_req_data['txn_payments']['send_notifications'], FILTER_VALIDATE_BOOLEAN)
1672 1672
 				) {
1673
-					$this->_process_payment_notification( $payment );
1673
+					$this->_process_payment_notification($payment);
1674 1674
 				}
1675 1675
 				break;
1676 1676
 			// registration notifications
1677 1677
 			case false :
1678 1678
 				if (
1679 1679
 					isset(
1680
-						$this->_req_data[ 'txn_reg_status_change' ],
1681
-						$this->_req_data[ 'txn_reg_status_change' ][ 'send_notifications' ]
1680
+						$this->_req_data['txn_reg_status_change'],
1681
+						$this->_req_data['txn_reg_status_change']['send_notifications']
1682 1682
 					) &&
1683
-					filter_var( $this->_req_data[ 'txn_reg_status_change' ][ 'send_notifications' ], FILTER_VALIDATE_BOOLEAN )
1683
+					filter_var($this->_req_data['txn_reg_status_change']['send_notifications'], FILTER_VALIDATE_BOOLEAN)
1684 1684
 				) {
1685
-					add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true' );
1685
+					add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true');
1686 1686
 				}
1687 1687
 				break;
1688 1688
 		}
@@ -1698,11 +1698,11 @@  discard block
 block discarded – undo
1698 1698
 	*	@return void
1699 1699
 	*/
1700 1700
 	protected function _send_payment_reminder() {
1701
-	    $TXN_ID = ( ! empty( $this->_req_data['TXN_ID'] )) ? absint( $this->_req_data['TXN_ID'] ) : FALSE;
1702
-		$transaction = EEM_Transaction::instance()->get_one_by_ID( $TXN_ID );
1703
-		$query_args = isset($this->_req_data['redirect_to'] ) ? array('action' => $this->_req_data['redirect_to'], 'TXN_ID' => $this->_req_data['TXN_ID'] ) : array();
1704
-		do_action( 'AHEE__Transactions_Admin_Page___send_payment_reminder__process_admin_payment_reminder', $transaction );
1705
-		$this->_redirect_after_action( FALSE, esc_html__('payment reminder', 'event_espresso'), esc_html__('sent', 'event_espresso'), $query_args, TRUE );
1701
+	    $TXN_ID = ( ! empty($this->_req_data['TXN_ID'])) ? absint($this->_req_data['TXN_ID']) : FALSE;
1702
+		$transaction = EEM_Transaction::instance()->get_one_by_ID($TXN_ID);
1703
+		$query_args = isset($this->_req_data['redirect_to']) ? array('action' => $this->_req_data['redirect_to'], 'TXN_ID' => $this->_req_data['TXN_ID']) : array();
1704
+		do_action('AHEE__Transactions_Admin_Page___send_payment_reminder__process_admin_payment_reminder', $transaction);
1705
+		$this->_redirect_after_action(FALSE, esc_html__('payment reminder', 'event_espresso'), esc_html__('sent', 'event_espresso'), $query_args, TRUE);
1706 1706
 	}
1707 1707
 
1708 1708
 
@@ -1716,36 +1716,36 @@  discard block
 block discarded – undo
1716 1716
 	 * @param string   $view
1717 1717
 	 * @return mixed int = count || array of transaction objects
1718 1718
 	 */
1719
-	public function get_transactions( $perpage, $count = FALSE, $view = '' ) {
1719
+	public function get_transactions($perpage, $count = FALSE, $view = '') {
1720 1720
 
1721 1721
 		$TXN = EEM_Transaction::instance();
1722 1722
 
1723
-	    $start_date = isset( $this->_req_data['txn-filter-start-date'] ) ? wp_strip_all_tags( $this->_req_data['txn-filter-start-date'] ) : date( 'm/d/Y', strtotime( '-10 year' ));
1724
-	    $end_date = isset( $this->_req_data['txn-filter-end-date'] ) ? wp_strip_all_tags( $this->_req_data['txn-filter-end-date'] ) : date( 'm/d/Y' );
1723
+	    $start_date = isset($this->_req_data['txn-filter-start-date']) ? wp_strip_all_tags($this->_req_data['txn-filter-start-date']) : date('m/d/Y', strtotime('-10 year'));
1724
+	    $end_date = isset($this->_req_data['txn-filter-end-date']) ? wp_strip_all_tags($this->_req_data['txn-filter-end-date']) : date('m/d/Y');
1725 1725
 
1726 1726
 	    //make sure our timestamps start and end right at the boundaries for each day
1727
-	    $start_date = date( 'Y-m-d', strtotime( $start_date ) ) . ' 00:00:00';
1728
-	    $end_date = date( 'Y-m-d', strtotime( $end_date ) ) . ' 23:59:59';
1727
+	    $start_date = date('Y-m-d', strtotime($start_date)).' 00:00:00';
1728
+	    $end_date = date('Y-m-d', strtotime($end_date)).' 23:59:59';
1729 1729
 
1730 1730
 
1731 1731
 	    //convert to timestamps
1732
-	    $start_date = strtotime( $start_date );
1733
-	    $end_date = strtotime( $end_date );
1732
+	    $start_date = strtotime($start_date);
1733
+	    $end_date = strtotime($end_date);
1734 1734
 
1735 1735
 	    //makes sure start date is the lowest value and vice versa
1736
-	    $start_date = min( $start_date, $end_date );
1737
-	    $end_date = max( $start_date, $end_date );
1736
+	    $start_date = min($start_date, $end_date);
1737
+	    $end_date = max($start_date, $end_date);
1738 1738
 
1739 1739
 	    //convert to correct format for query
1740
-	$start_date = EEM_Transaction::instance()->convert_datetime_for_query( 'TXN_timestamp', date( 'Y-m-d H:i:s', $start_date ), 'Y-m-d H:i:s' );
1741
-	$end_date = EEM_Transaction::instance()->convert_datetime_for_query( 'TXN_timestamp', date( 'Y-m-d H:i:s', $end_date ), 'Y-m-d H:i:s' );
1740
+	$start_date = EEM_Transaction::instance()->convert_datetime_for_query('TXN_timestamp', date('Y-m-d H:i:s', $start_date), 'Y-m-d H:i:s');
1741
+	$end_date = EEM_Transaction::instance()->convert_datetime_for_query('TXN_timestamp', date('Y-m-d H:i:s', $end_date), 'Y-m-d H:i:s');
1742 1742
 
1743 1743
 
1744 1744
 
1745 1745
 	    //set orderby
1746 1746
 		$this->_req_data['orderby'] = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : '';
1747 1747
 
1748
-		switch ( $this->_req_data['orderby'] ) {
1748
+		switch ($this->_req_data['orderby']) {
1749 1749
 			case 'TXN_ID':
1750 1750
 				$orderby = 'TXN_ID';
1751 1751
 				break;
@@ -1759,66 +1759,66 @@  discard block
 block discarded – undo
1759 1759
 				$orderby = 'TXN_timestamp';
1760 1760
 		}
1761 1761
 
1762
-		$sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'DESC';
1763
-		$current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1;
1764
-		$per_page = isset( $perpage ) && !empty( $perpage ) ? $perpage : 10;
1765
-		$per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page;
1762
+		$sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'DESC';
1763
+		$current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1;
1764
+		$per_page = isset($perpage) && ! empty($perpage) ? $perpage : 10;
1765
+		$per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page;
1766 1766
 
1767
-		$offset = ($current_page-1)*$per_page;
1768
-		$limit = array( $offset, $per_page );
1767
+		$offset = ($current_page - 1) * $per_page;
1768
+		$limit = array($offset, $per_page);
1769 1769
 
1770 1770
 		$_where = array(
1771
-			'TXN_timestamp' => array('BETWEEN', array($start_date, $end_date) ),
1771
+			'TXN_timestamp' => array('BETWEEN', array($start_date, $end_date)),
1772 1772
 			'Registration.REG_count' => 1
1773 1773
 		);
1774 1774
 
1775
-		if ( isset( $this->_req_data['EVT_ID'] ) ) {
1775
+		if (isset($this->_req_data['EVT_ID'])) {
1776 1776
 			$_where['Registration.EVT_ID'] = $this->_req_data['EVT_ID'];
1777 1777
 		}
1778 1778
 
1779
-		if ( isset( $this->_req_data['s'] ) ) {
1780
-			$search_string = '%' . $this->_req_data['s'] . '%';
1779
+		if (isset($this->_req_data['s'])) {
1780
+			$search_string = '%'.$this->_req_data['s'].'%';
1781 1781
 			$_where['OR'] = array(
1782
-				'Registration.Event.EVT_name' => array( 'LIKE', $search_string ),
1783
-				'Registration.Event.EVT_desc' => array( 'LIKE', $search_string ),
1784
-				'Registration.Event.EVT_short_desc' => array( 'LIKE' , $search_string ),
1785
-				'Registration.Attendee.ATT_full_name' => array( 'LIKE', $search_string ),
1786
-				'Registration.Attendee.ATT_fname' => array( 'LIKE', $search_string ),
1787
-				'Registration.Attendee.ATT_lname' => array( 'LIKE', $search_string ),
1788
-				'Registration.Attendee.ATT_short_bio' => array( 'LIKE', $search_string ),
1789
-				'Registration.Attendee.ATT_email' => array('LIKE', $search_string ),
1790
-				'Registration.Attendee.ATT_address' => array( 'LIKE', $search_string ),
1791
-				'Registration.Attendee.ATT_address2' => array( 'LIKE', $search_string ),
1792
-				'Registration.Attendee.ATT_city' => array( 'LIKE', $search_string ),
1793
-				'Registration.REG_final_price' => array( 'LIKE', $search_string ),
1794
-				'Registration.REG_code' => array( 'LIKE', $search_string ),
1795
-				'Registration.REG_count' => array( 'LIKE' , $search_string ),
1796
-				'Registration.REG_group_size' => array( 'LIKE' , $search_string ),
1797
-				'Registration.Ticket.TKT_name' => array( 'LIKE', $search_string ),
1798
-				'Registration.Ticket.TKT_description' => array( 'LIKE', $search_string ),
1799
-				'Payment.PAY_source' => array('LIKE', $search_string ),
1800
-				'Payment.Payment_Method.PMD_name' => array('LIKE', $search_string ),
1801
-				'TXN_session_data' => array( 'LIKE', $search_string ),
1802
-				'Payment.PAY_txn_id_chq_nmbr' => array( 'LIKE', $search_string )
1782
+				'Registration.Event.EVT_name' => array('LIKE', $search_string),
1783
+				'Registration.Event.EVT_desc' => array('LIKE', $search_string),
1784
+				'Registration.Event.EVT_short_desc' => array('LIKE', $search_string),
1785
+				'Registration.Attendee.ATT_full_name' => array('LIKE', $search_string),
1786
+				'Registration.Attendee.ATT_fname' => array('LIKE', $search_string),
1787
+				'Registration.Attendee.ATT_lname' => array('LIKE', $search_string),
1788
+				'Registration.Attendee.ATT_short_bio' => array('LIKE', $search_string),
1789
+				'Registration.Attendee.ATT_email' => array('LIKE', $search_string),
1790
+				'Registration.Attendee.ATT_address' => array('LIKE', $search_string),
1791
+				'Registration.Attendee.ATT_address2' => array('LIKE', $search_string),
1792
+				'Registration.Attendee.ATT_city' => array('LIKE', $search_string),
1793
+				'Registration.REG_final_price' => array('LIKE', $search_string),
1794
+				'Registration.REG_code' => array('LIKE', $search_string),
1795
+				'Registration.REG_count' => array('LIKE', $search_string),
1796
+				'Registration.REG_group_size' => array('LIKE', $search_string),
1797
+				'Registration.Ticket.TKT_name' => array('LIKE', $search_string),
1798
+				'Registration.Ticket.TKT_description' => array('LIKE', $search_string),
1799
+				'Payment.PAY_source' => array('LIKE', $search_string),
1800
+				'Payment.Payment_Method.PMD_name' => array('LIKE', $search_string),
1801
+				'TXN_session_data' => array('LIKE', $search_string),
1802
+				'Payment.PAY_txn_id_chq_nmbr' => array('LIKE', $search_string)
1803 1803
 				);
1804 1804
 		}
1805 1805
 
1806 1806
 		//failed transactions
1807
-		$failed = ( ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] == 'failed' && ! $count ) || ( $count && $view == 'failed' ) ? TRUE: FALSE;
1808
-		$abandoned = ( ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] == 'abandoned' && ! $count ) || ( $count && $view == 'abandoned' ) ? TRUE: FALSE;
1807
+		$failed = ( ! empty($this->_req_data['status']) && $this->_req_data['status'] == 'failed' && ! $count) || ($count && $view == 'failed') ? TRUE: FALSE;
1808
+		$abandoned = ( ! empty($this->_req_data['status']) && $this->_req_data['status'] == 'abandoned' && ! $count) || ($count && $view == 'abandoned') ? TRUE: FALSE;
1809 1809
 
1810
-		if ( $failed ) {
1811
-			$_where[ 'STS_ID' ] = EEM_Transaction::failed_status_code;
1812
-		} else if ( $abandoned ) {
1810
+		if ($failed) {
1811
+			$_where['STS_ID'] = EEM_Transaction::failed_status_code;
1812
+		} else if ($abandoned) {
1813 1813
 				$_where['STS_ID'] = EEM_Transaction::abandoned_status_code;
1814 1814
 		} else {
1815
-				$_where['STS_ID'] = array( '!=', EEM_Transaction::failed_status_code );
1816
-				$_where['STS_ID*'] = array( '!=', EEM_Transaction::abandoned_status_code );
1815
+				$_where['STS_ID'] = array('!=', EEM_Transaction::failed_status_code);
1816
+				$_where['STS_ID*'] = array('!=', EEM_Transaction::abandoned_status_code);
1817 1817
 		}
1818 1818
 
1819
-		$query_params = array( $_where, 'order_by' => array( $orderby => $sort ), 'limit' => $limit );
1819
+		$query_params = array($_where, 'order_by' => array($orderby => $sort), 'limit' => $limit);
1820 1820
 
1821
-		$transactions = $count ? $TXN->count( array($_where), 'TXN_ID', TRUE ) : $TXN->get_all($query_params);
1821
+		$transactions = $count ? $TXN->count(array($_where), 'TXN_ID', TRUE) : $TXN->get_all($query_params);
1822 1822
 
1823 1823
 
1824 1824
 		return $transactions;
Please login to merge, or discard this patch.
admin_pages/venues/Venues_Admin_Page.core.php 1 patch
Spacing   +239 added lines, -239 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
 	}
@@ -123,8 +123,8 @@  discard block
 block discarded – undo
123 123
 		//load field generator helper
124 124
 
125 125
 		//is there a vnu_id in the request?
126
-		$vnu_id = ! empty( $this->_req_data['VNU_ID'] ) && ! is_array( $this->_req_data['VNU_ID'] ) ? $this->_req_data['VNU_ID'] : 0;
127
-		$vnu_id = ! empty( $this->_req_data['post'] ) ? $this->_req_data['post'] : $vnu_id;
126
+		$vnu_id = ! empty($this->_req_data['VNU_ID']) && ! is_array($this->_req_data['VNU_ID']) ? $this->_req_data['VNU_ID'] : 0;
127
+		$vnu_id = ! empty($this->_req_data['post']) ? $this->_req_data['post'] : $vnu_id;
128 128
 
129 129
 		$this->_page_routes = array(
130 130
 			'default' => array(
@@ -142,27 +142,27 @@  discard block
 block discarded – undo
142 142
 				),
143 143
 			'trash_venue' => array(
144 144
 				'func' => '_trash_or_restore_venue',
145
-				'args' => array( 'venue_status' => 'trash' ),
145
+				'args' => array('venue_status' => 'trash'),
146 146
 				'noheader' => TRUE,
147 147
 				'capability' => 'ee_delete_venue',
148 148
 				'obj_id' => $vnu_id
149 149
 				),
150 150
 			'trash_venues' => array(
151 151
 				'func' => '_trash_or_restore_venues',
152
-				'args' => array( 'venue_status' => 'trash' ),
152
+				'args' => array('venue_status' => 'trash'),
153 153
 				'noheader' => TRUE,
154 154
 				'capability' => 'ee_delete_venues'
155 155
 				),
156 156
 			'restore_venue' => array(
157 157
 				'func' => '_trash_or_restore_venue',
158
-				'args' => array( 'venue_status' => 'draft' ),
158
+				'args' => array('venue_status' => 'draft'),
159 159
 				'noheader' => TRUE,
160 160
 				'capability' => 'ee_delete_venue',
161 161
 				'obj_id' => $vnu_id
162 162
 				),
163 163
 			'restore_venues' => array(
164 164
 				'func' => '_trash_or_restore_venues',
165
-				'args' => array( 'venue_status' => 'draft' ),
165
+				'args' => array('venue_status' => 'draft'),
166 166
 				'noheader' => TRUE,
167 167
 				'capability' => 'ee_delete_venues'
168 168
 				),
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
 						'filename' => 'venues_overview_views_bulk_actions_search'
265 265
 					)
266 266
 				),
267
-				'help_tour' => array( 'Venues_Overview_Help_Tour' ),
267
+				'help_tour' => array('Venues_Overview_Help_Tour'),
268 268
 				'metaboxes' => array('_espresso_news_post_box', '_espresso_links_post_box'),
269 269
 				'require_nonce' => FALSE
270 270
 			),
@@ -300,7 +300,7 @@  discard block
 block discarded – undo
300 300
 						'filename' => 'venues_editor_other'
301 301
 					)
302 302
 				),
303
-				'help_tour' => array( 'Venues_Add_Venue_Help_Tour' ),
303
+				'help_tour' => array('Venues_Add_Venue_Help_Tour'),
304 304
 				'metaboxes' => array('_venue_editor_metaboxes'),
305 305
 				'require_nonce' => FALSE
306 306
 				),
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
 					'label' => __('Edit Venue', 'event_espresso'),
310 310
 					'order' => 5,
311 311
 					'persistent' => FALSE,
312
-					'url' => isset($this->_req_data['post']) ? add_query_arg(array('post' => $this->_req_data['post'] ), $this->_current_page_view_url )  : $this->_admin_base_url
312
+					'url' => isset($this->_req_data['post']) ? add_query_arg(array('post' => $this->_req_data['post']), $this->_current_page_view_url) : $this->_admin_base_url
313 313
 				),
314 314
 				'help_tabs' => array(
315 315
 					'venues_editor_help_tab' => array(
@@ -343,17 +343,17 @@  discard block
 block discarded – undo
343 343
 			),
344 344
 			'google_map_settings' => array(
345 345
 				'nav' => array(
346
-					'label' => esc_html__('Google Maps', 'event_espresso' ),
346
+					'label' => esc_html__('Google Maps', 'event_espresso'),
347 347
 					'order' => 40
348 348
 				),
349
-				'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array('_publish_post_box' ) ),
349
+				'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')),
350 350
 				'help_tabs' => array(
351 351
 					'general_settings_google_maps_help_tab' => array(
352 352
 						'title' => __('Google Maps', 'event_espresso'),
353 353
 						'filename' => 'general_settings_google_maps'
354 354
 					)
355 355
 				),
356
-				'help_tour' => array( 'Google_Maps_Help_Tour' ),
356
+				'help_tour' => array('Google_Maps_Help_Tour'),
357 357
 				'require_nonce' => FALSE
358 358
 			),
359 359
 			//venue category stuff
@@ -369,7 +369,7 @@  discard block
 block discarded – undo
369 369
 						'filename' => 'venues_add_category'
370 370
 					)
371 371
 				),
372
-				'help_tour' => array( 'Venues_Add_Category_Help_Tour' ),
372
+				'help_tour' => array('Venues_Add_Category_Help_Tour'),
373 373
 				'require_nonce' => FALSE
374 374
 				),
375 375
 			'edit_category' => array(
@@ -377,7 +377,7 @@  discard block
 block discarded – undo
377 377
 					'label' => __('Edit Category', 'event_espresso'),
378 378
 					'order' => 15,
379 379
 					'persistent' => FALSE,
380
-					'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
380
+					'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
381 381
 					),
382 382
 				'metaboxes' => array('_publish_post_box'),
383 383
 				'help_tabs' => array(
@@ -413,7 +413,7 @@  discard block
 block discarded – undo
413 413
 						'filename' => 'venues_categories_other'
414 414
 					)
415 415
 				),
416
-				'help_tour' => array( 'Venues_Categories_Help_Tour' ),
416
+				'help_tour' => array('Venues_Categories_Help_Tour'),
417 417
 				'metaboxes' => $this->_default_espresso_metaboxes,
418 418
 				'require_nonce' => FALSE
419 419
 				)
@@ -470,7 +470,7 @@  discard block
 block discarded – undo
470 470
 
471 471
 
472 472
 	public function load_scripts_styles() {
473
-		wp_register_style('ee-cat-admin', EVENTS_ASSETS_URL . 'ee-cat-admin.css', array(), EVENT_ESPRESSO_VERSION );
473
+		wp_register_style('ee-cat-admin', EVENTS_ASSETS_URL.'ee-cat-admin.css', array(), EVENT_ESPRESSO_VERSION);
474 474
 		wp_enqueue_style('ee-cat-admin');
475 475
 	}
476 476
 
@@ -493,7 +493,7 @@  discard block
 block discarded – undo
493 493
 	public function load_scripts_styles_edit() {
494 494
 		//styles
495 495
 		wp_enqueue_style('espresso-ui-theme');
496
-		wp_register_style( 'espresso_venues', EE_VENUES_ASSETS_URL . 'ee-venues-admin.css', array(), EVENT_ESPRESSO_VERSION );
496
+		wp_register_style('espresso_venues', EE_VENUES_ASSETS_URL.'ee-venues-admin.css', array(), EVENT_ESPRESSO_VERSION);
497 497
 		wp_enqueue_style('espresso_venues');
498 498
 	}
499 499
 
@@ -512,13 +512,13 @@  discard block
 block discarded – undo
512 512
 				)
513 513
 		);
514 514
 
515
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_venues', 'espresso_venues_trash_venues' ) ) {
515
+		if (EE_Registry::instance()->CAP->current_user_can('ee_delete_venues', 'espresso_venues_trash_venues')) {
516 516
 			$this->_views['all']['bulk_action'] = array(
517 517
 				'trash_venues' => __('Move to Trash', 'event_espresso')
518 518
 			);
519 519
 			$this->_views['trash'] = array(
520 520
 				'slug' => 'trash',
521
-				'label' => __( 'Trash', 'event_espresso' ),
521
+				'label' => __('Trash', 'event_espresso'),
522 522
 				'count' => 0,
523 523
 				'bulk_action' => array(
524 524
 					'restore_venues' => __('Restore from Trash', 'event_espresso'),
@@ -551,8 +551,8 @@  discard block
 block discarded – undo
551 551
 
552 552
 
553 553
 	protected function _overview_list_table() {
554
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
555
-		$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' );
554
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
555
+		$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 556
 		$this->_admin_page_title .= $this->get_action_link_or_button('create_new', 'add', array(), 'add-new-h2');
557 557
 		$this->_search_btn_label = __('Venues', 'event_espresso');
558 558
 		$this->display_admin_list_table_page_with_sidebar();
@@ -566,8 +566,8 @@  discard block
 block discarded – undo
566 566
 			'vnu_url' => $this->_cpt_model_obj->venue_url(),
567 567
 			'vnu_phone' => $this->_cpt_model_obj->phone()
568 568
 			);
569
-		$template = EE_VENUES_TEMPLATE_PATH . 'venue_publish_box_extras.template.php';
570
-		EEH_Template::display_template( $template, $extra_rows );
569
+		$template = EE_VENUES_TEMPLATE_PATH.'venue_publish_box_extras.template.php';
570
+		EEH_Template::display_template($template, $extra_rows);
571 571
 	}
572 572
 
573 573
 
@@ -583,31 +583,31 @@  discard block
 block discarded – undo
583 583
 		$default_map_settings->use_google_maps = TRUE;
584 584
 		$default_map_settings->google_map_api_key = '';
585 585
 		// for event details pages (reg page)
586
-		$default_map_settings->event_details_map_width = 585; 			// ee_map_width_single
587
-		$default_map_settings->event_details_map_height = 362; 			// ee_map_height_single
588
-		$default_map_settings->event_details_map_zoom = 14; 			// ee_map_zoom_single
589
-		$default_map_settings->event_details_display_nav = TRUE; 			// ee_map_nav_display_single
590
-		$default_map_settings->event_details_nav_size = FALSE; 			// ee_map_nav_size_single
591
-		$default_map_settings->event_details_control_type = 'default'; 		// ee_map_type_control_single
592
-		$default_map_settings->event_details_map_align = 'center'; 			// ee_map_align_single
586
+		$default_map_settings->event_details_map_width = 585; // ee_map_width_single
587
+		$default_map_settings->event_details_map_height = 362; // ee_map_height_single
588
+		$default_map_settings->event_details_map_zoom = 14; // ee_map_zoom_single
589
+		$default_map_settings->event_details_display_nav = TRUE; // ee_map_nav_display_single
590
+		$default_map_settings->event_details_nav_size = FALSE; // ee_map_nav_size_single
591
+		$default_map_settings->event_details_control_type = 'default'; // ee_map_type_control_single
592
+		$default_map_settings->event_details_map_align = 'center'; // ee_map_align_single
593 593
 		// for event list pages
594
-		$default_map_settings->event_list_map_width = 300; 			// ee_map_width
595
-		$default_map_settings->event_list_map_height = 185; 		// ee_map_height
596
-		$default_map_settings->event_list_map_zoom = 12; 			// ee_map_zoom
597
-		$default_map_settings->event_list_display_nav = FALSE; 		// ee_map_nav_display
598
-		$default_map_settings->event_list_nav_size = TRUE; 			// ee_map_nav_size
599
-		$default_map_settings->event_list_control_type = 'dropdown'; 		// ee_map_type_control
600
-		$default_map_settings->event_list_map_align = 'center'; 			// ee_map_align
594
+		$default_map_settings->event_list_map_width = 300; // ee_map_width
595
+		$default_map_settings->event_list_map_height = 185; // ee_map_height
596
+		$default_map_settings->event_list_map_zoom = 12; // ee_map_zoom
597
+		$default_map_settings->event_list_display_nav = FALSE; // ee_map_nav_display
598
+		$default_map_settings->event_list_nav_size = TRUE; // ee_map_nav_size
599
+		$default_map_settings->event_list_control_type = 'dropdown'; // ee_map_type_control
600
+		$default_map_settings->event_list_map_align = 'center'; // ee_map_align
601 601
 
602 602
 		$this->_template_args['map_settings'] =
603
-			isset( EE_Registry::instance()->CFG->map_settings ) && ! empty( EE_Registry::instance()->CFG->map_settings )
604
-				? (object)array_merge( (array)$default_map_settings, (array)EE_Registry::instance()->CFG->map_settings )
603
+			isset(EE_Registry::instance()->CFG->map_settings) && ! empty(EE_Registry::instance()->CFG->map_settings)
604
+				? (object) array_merge((array) $default_map_settings, (array) EE_Registry::instance()->CFG->map_settings)
605 605
 				: $default_map_settings;
606 606
 
607
-		$this->_set_add_edit_form_tags( 'update_google_map_settings' );
608
-		$this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE );
607
+		$this->_set_add_edit_form_tags('update_google_map_settings');
608
+		$this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE);
609 609
 		$this->_template_args['admin_page_content'] = EEH_Template::display_template(
610
-			EE_VENUES_TEMPLATE_PATH . 'google_map.template.php',
610
+			EE_VENUES_TEMPLATE_PATH.'google_map.template.php',
611 611
 			$this->_template_args,
612 612
 			true
613 613
 		);
@@ -617,83 +617,83 @@  discard block
 block discarded – undo
617 617
 	protected function _update_google_map_settings() {
618 618
 
619 619
 		EE_Registry::instance()->CFG->map_settings->use_google_maps =
620
-			isset( $this->_req_data['use_google_maps'] )
621
-				? absint( $this->_req_data['use_google_maps'] )
620
+			isset($this->_req_data['use_google_maps'])
621
+				? absint($this->_req_data['use_google_maps'])
622 622
 				: EE_Registry::instance()->CFG->map_settings->use_google_maps;
623 623
 
624 624
 		EE_Registry::instance()->CFG->map_settings->google_map_api_key =
625
-			isset( $this->_req_data['google_map_api_key'] )
626
-				? sanitize_text_field( $this->_req_data['google_map_api_key'] )
625
+			isset($this->_req_data['google_map_api_key'])
626
+				? sanitize_text_field($this->_req_data['google_map_api_key'])
627 627
 				: EE_Registry::instance()->CFG->map_settings->google_map_api_key;
628 628
 
629 629
 		EE_Registry::instance()->CFG->map_settings->event_details_map_width =
630
-			isset( $this->_req_data['event_details_map_width'] )
631
-				? absint( $this->_req_data['event_details_map_width'] )
630
+			isset($this->_req_data['event_details_map_width'])
631
+				? absint($this->_req_data['event_details_map_width'])
632 632
 				: EE_Registry::instance()->CFG->map_settings->event_details_map_width;
633 633
 
634 634
 		EE_Registry::instance()->CFG->map_settings->event_details_map_height =
635
-			isset( $this->_req_data['event_details_map_height'] )
636
-				? absint( $this->_req_data['event_details_map_height'] )
635
+			isset($this->_req_data['event_details_map_height'])
636
+				? absint($this->_req_data['event_details_map_height'])
637 637
 				: EE_Registry::instance()->CFG->map_settings->event_details_map_height;
638 638
 
639 639
 		EE_Registry::instance()->CFG->map_settings->event_details_map_zoom =
640
-			isset( $this->_req_data['event_details_map_zoom'] )
641
-				? absint( $this->_req_data['event_details_map_zoom'] )
640
+			isset($this->_req_data['event_details_map_zoom'])
641
+				? absint($this->_req_data['event_details_map_zoom'])
642 642
 				: EE_Registry::instance()->CFG->map_settings->event_details_map_zoom;
643 643
 
644 644
 		EE_Registry::instance()->CFG->map_settings->event_details_display_nav =
645
-			isset( $this->_req_data['event_details_display_nav'] )
646
-				? absint( $this->_req_data['event_details_display_nav'] )
645
+			isset($this->_req_data['event_details_display_nav'])
646
+				? absint($this->_req_data['event_details_display_nav'])
647 647
 				: EE_Registry::instance()->CFG->map_settings->event_details_display_nav;
648 648
 
649 649
 		EE_Registry::instance()->CFG->map_settings->event_details_nav_size =
650
-			isset( $this->_req_data['event_details_nav_size'] )
651
-				? absint( $this->_req_data['event_details_nav_size'] )
650
+			isset($this->_req_data['event_details_nav_size'])
651
+				? absint($this->_req_data['event_details_nav_size'])
652 652
 				: EE_Registry::instance()->CFG->map_settings->event_details_nav_size;
653 653
 
654 654
 		EE_Registry::instance()->CFG->map_settings->event_details_control_type =
655
-			isset( $this->_req_data['event_details_control_type'] )
656
-				? sanitize_text_field( $this->_req_data['event_details_control_type'] )
655
+			isset($this->_req_data['event_details_control_type'])
656
+				? sanitize_text_field($this->_req_data['event_details_control_type'])
657 657
 				: EE_Registry::instance()->CFG->map_settings->event_details_control_type;
658 658
 
659 659
 		EE_Registry::instance()->CFG->map_settings->event_details_map_align =
660
-			isset( $this->_req_data['event_details_map_align'] )
661
-				? sanitize_text_field( $this->_req_data['event_details_map_align'] )
660
+			isset($this->_req_data['event_details_map_align'])
661
+				? sanitize_text_field($this->_req_data['event_details_map_align'])
662 662
 				: EE_Registry::instance()->CFG->map_settings->event_details_map_align;
663 663
 
664 664
 		EE_Registry::instance()->CFG->map_settings->event_list_map_width =
665
-			isset( $this->_req_data['event_list_map_width'] )
666
-				? absint( $this->_req_data['event_list_map_width'] )
665
+			isset($this->_req_data['event_list_map_width'])
666
+				? absint($this->_req_data['event_list_map_width'])
667 667
 				: EE_Registry::instance()->CFG->map_settings->event_list_map_width;
668 668
 
669 669
 		EE_Registry::instance()->CFG->map_settings->event_list_map_height =
670
-			isset( $this->_req_data['event_list_map_height'] )
671
-				? absint( $this->_req_data['event_list_map_height'] )
670
+			isset($this->_req_data['event_list_map_height'])
671
+				? absint($this->_req_data['event_list_map_height'])
672 672
 				: EE_Registry::instance()->CFG->map_settings->event_list_map_height;
673 673
 
674 674
 		EE_Registry::instance()->CFG->map_settings->event_list_map_zoom =
675
-			isset( $this->_req_data['event_list_map_zoom'] )
676
-				? absint( $this->_req_data['event_list_map_zoom'] )
675
+			isset($this->_req_data['event_list_map_zoom'])
676
+				? absint($this->_req_data['event_list_map_zoom'])
677 677
 				: EE_Registry::instance()->CFG->map_settings->event_list_map_zoom;
678 678
 
679 679
 		EE_Registry::instance()->CFG->map_settings->event_list_display_nav =
680
-			isset( $this->_req_data['event_list_display_nav'] )
681
-				? absint( $this->_req_data['event_list_display_nav'] )
680
+			isset($this->_req_data['event_list_display_nav'])
681
+				? absint($this->_req_data['event_list_display_nav'])
682 682
 				: EE_Registry::instance()->CFG->map_settings->event_list_display_nav;
683 683
 
684 684
 		EE_Registry::instance()->CFG->map_settings->event_list_nav_size =
685
-			isset( $this->_req_data['event_list_nav_size'] )
686
-				? absint( $this->_req_data['event_list_nav_size'] )
685
+			isset($this->_req_data['event_list_nav_size'])
686
+				? absint($this->_req_data['event_list_nav_size'])
687 687
 				: EE_Registry::instance()->CFG->map_settings->event_list_nav_size;
688 688
 
689 689
 		EE_Registry::instance()->CFG->map_settings->event_list_control_type =
690
-			isset( $this->_req_data['event_list_control_type'] )
691
-				? sanitize_text_field( $this->_req_data['event_list_control_type'] )
690
+			isset($this->_req_data['event_list_control_type'])
691
+				? sanitize_text_field($this->_req_data['event_list_control_type'])
692 692
 				: EE_Registry::instance()->CFG->map_settings->event_list_control_type;
693 693
 
694 694
 		EE_Registry::instance()->CFG->map_settings->event_list_map_align =
695
-			isset( $this->_req_data['event_list_map_align'] )
696
-				? sanitize_text_field( $this->_req_data['event_list_map_align'] )
695
+			isset($this->_req_data['event_list_map_align'])
696
+				? sanitize_text_field($this->_req_data['event_list_map_align'])
697 697
 				: EE_Registry::instance()->CFG->map_settings->event_list_map_align;
698 698
 
699 699
 		EE_Registry::instance()->CFG->map_settings = apply_filters(
@@ -707,7 +707,7 @@  discard block
 block discarded – undo
707 707
 			EE_Registry::instance()->CFG->map_settings,
708 708
 			__FILE__, __FUNCTION__, __LINE__
709 709
 		);
710
-		$this->_redirect_after_action( $success, $what, 'updated', array( 'action' => 'google_map_settings' ) );
710
+		$this->_redirect_after_action($success, $what, 'updated', array('action' => 'google_map_settings'));
711 711
 
712 712
 	}
713 713
 
@@ -716,9 +716,9 @@  discard block
 block discarded – undo
716 716
 	protected function _venue_editor_metaboxes() {
717 717
 		$this->verify_cpt_object();
718 718
 
719
-		add_meta_box( 'espresso_venue_address_options', __('Physical Location', 'event_espresso'), array( $this, 'venue_address_metabox'), $this->page_slug, 'side', 'default' );
720
-		add_meta_box( 'espresso_venue_gmap_options', __('Google Map', 'event_espresso'), array( $this, 'venue_gmap_metabox'), $this->page_slug, 'side', 'default' );
721
-		add_meta_box( 'espresso_venue_virtual_loc_options', __('Virtual Location', 'event_espresso'), array( $this, 'venue_virtual_loc_metabox'), $this->page_slug, 'side', 'default' );
719
+		add_meta_box('espresso_venue_address_options', __('Physical Location', 'event_espresso'), array($this, 'venue_address_metabox'), $this->page_slug, 'side', 'default');
720
+		add_meta_box('espresso_venue_gmap_options', __('Google Map', 'event_espresso'), array($this, 'venue_gmap_metabox'), $this->page_slug, 'side', 'default');
721
+		add_meta_box('espresso_venue_virtual_loc_options', __('Virtual Location', 'event_espresso'), array($this, 'venue_virtual_loc_metabox'), $this->page_slug, 'side', 'default');
722 722
 
723 723
 	}
724 724
 
@@ -726,23 +726,23 @@  discard block
 block discarded – undo
726 726
 
727 727
 	public function venue_gmap_metabox() {
728 728
 		$template_args = array(
729
-			'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() ),
729
+			'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()),
730 730
 			'vnu_google_map_link' => $this->_cpt_model_obj->google_map_link(),
731 731
 			);
732
-		$template = EE_VENUES_TEMPLATE_PATH . 'venue_gmap_metabox_content.template.php';
733
-		EEH_Template::display_template( $template, $template_args );
732
+		$template = EE_VENUES_TEMPLATE_PATH.'venue_gmap_metabox_content.template.php';
733
+		EEH_Template::display_template($template, $template_args);
734 734
 	}
735 735
 
736 736
 
737 737
 
738 738
 	public function venue_address_metabox() {
739 739
 
740
-		$template_args['_venue'] =$this->_cpt_model_obj;
740
+		$template_args['_venue'] = $this->_cpt_model_obj;
741 741
 
742 742
 		$template_args['states_dropdown'] = EEH_Form_Fields::generate_form_input(
743 743
 			$QFI = new EE_Question_Form_Input(
744
-				EE_Question::new_instance( array( 'QST_display_text' => 'State', 'QST_system' => 'state' )),
745
-				EE_Answer::new_instance( array(  'ANS_value'=> $this->_cpt_model_obj->state_ID() )),
744
+				EE_Question::new_instance(array('QST_display_text' => 'State', 'QST_system' => 'state')),
745
+				EE_Answer::new_instance(array('ANS_value'=> $this->_cpt_model_obj->state_ID())),
746 746
 				array(
747 747
 					'input_name' =>  'sta_id',
748 748
 					'input_id' => 'sta_id',
@@ -754,8 +754,8 @@  discard block
 block discarded – undo
754 754
 		);
755 755
 		$template_args['countries_dropdown'] = EEH_Form_Fields::generate_form_input(
756 756
 			$QFI = new EE_Question_Form_Input(
757
-				EE_Question::new_instance( array( 'QST_display_text' => 'Country', 'QST_system' => 'country' )),
758
-				EE_Answer::new_instance( array(  'ANS_value'=> $this->_cpt_model_obj->country_ID() )),
757
+				EE_Question::new_instance(array('QST_display_text' => 'Country', 'QST_system' => 'country')),
758
+				EE_Answer::new_instance(array('ANS_value'=> $this->_cpt_model_obj->country_ID())),
759 759
 				array(
760 760
 					'input_name' =>  'cnt_iso',
761 761
 					'input_id' => 'cnt_iso',
@@ -766,8 +766,8 @@  discard block
 block discarded – undo
766 766
 			)
767 767
 		);
768 768
 
769
-		$template = EE_VENUES_TEMPLATE_PATH . 'venue_address_metabox_content.template.php';
770
-		EEH_Template::display_template( $template, $template_args );
769
+		$template = EE_VENUES_TEMPLATE_PATH.'venue_address_metabox_content.template.php';
770
+		EEH_Template::display_template($template, $template_args);
771 771
 	}
772 772
 
773 773
 
@@ -779,8 +779,8 @@  discard block
 block discarded – undo
779 779
 		$template_args = array(
780 780
 			'_venue' => $this->_cpt_model_obj
781 781
 			);
782
-		$template = EE_VENUES_TEMPLATE_PATH . 'venue_virtual_location_metabox_content.template.php';
783
-		EEH_Template::display_template( $template, $template_args );
782
+		$template = EE_VENUES_TEMPLATE_PATH.'venue_virtual_location_metabox_content.template.php';
783
+		EEH_Template::display_template($template, $template_args);
784 784
 	}
785 785
 
786 786
 
@@ -803,52 +803,52 @@  discard block
 block discarded – undo
803 803
 	 * @param  object $post    Post object (with "blessed" WP properties)
804 804
 	 * @return void
805 805
 	 */
806
-	protected function _insert_update_cpt_item( $post_id, $post ) {
806
+	protected function _insert_update_cpt_item($post_id, $post) {
807 807
 
808
-		if ( $post instanceof WP_Post && $post->post_type !== 'espresso_venues' ) {
809
-			return;// get out we're not processing the saving of venues.
808
+		if ($post instanceof WP_Post && $post->post_type !== 'espresso_venues') {
809
+			return; // get out we're not processing the saving of venues.
810 810
 		}
811 811
 
812
-		$wheres = array( $this->_venue_model->primary_key_name() => $post_id );
812
+		$wheres = array($this->_venue_model->primary_key_name() => $post_id);
813 813
 
814 814
 		$venue_values = array(
815
-			'VNU_address' => !empty( $this->_req_data['vnu_address'] ) ? $this->_req_data['vnu_address'] : NULL,
816
-			'VNU_address2' => !empty( $this->_req_data['vnu_address2'] ) ? $this->_req_data['vnu_address2'] : NULL,
817
-			'VNU_city' => !empty( $this->_req_data['vnu_city'] ) ? $this->_req_data['vnu_city'] : NULL,
818
-			'STA_ID' => !empty( $this->_req_data['sta_id'] ) ? $this->_req_data['sta_id'] : NULL,
819
-			'CNT_ISO' => !empty( $this->_req_data['cnt_iso'] ) ? $this->_req_data['cnt_iso'] : NULL,
820
-			'VNU_zip' => !empty( $this->_req_data['vnu_zip'] ) ? $this->_req_data['vnu_zip'] : NULL,
821
-			'VNU_phone' => !empty( $this->_req_data['vnu_phone'] ) ? $this->_req_data['vnu_phone'] : NULL,
822
-			'VNU_capacity' => !empty( $this->_req_data['vnu_capacity'] ) ? str_replace( ',', '', $this->_req_data['vnu_capacity'] ) : EE_INF,
823
-			'VNU_url' => !empty( $this->_req_data['vnu_url'] ) ? $this->_req_data['vnu_url'] : NULL,
824
-			'VNU_virtual_phone' => !empty( $this->_req_data['vnu_virtual_phone'] ) ? $this->_req_data['vnu_virtual_phone'] : NULL,
825
-			'VNU_virtual_url' => !empty( $this->_req_data['vnu_virtual_url'] ) ? $this->_req_data['vnu_virtual_url'] : NULL,
826
-			'VNU_enable_for_gmap' => !empty( $this->_req_data['vnu_enable_for_gmap'] ) ? TRUE : FALSE,
827
-			'VNU_google_map_link' => !empty( $this->_req_data['vnu_google_map_link'] ) ? $this->_req_data['vnu_google_map_link'] : NULL
815
+			'VNU_address' => ! empty($this->_req_data['vnu_address']) ? $this->_req_data['vnu_address'] : NULL,
816
+			'VNU_address2' => ! empty($this->_req_data['vnu_address2']) ? $this->_req_data['vnu_address2'] : NULL,
817
+			'VNU_city' => ! empty($this->_req_data['vnu_city']) ? $this->_req_data['vnu_city'] : NULL,
818
+			'STA_ID' => ! empty($this->_req_data['sta_id']) ? $this->_req_data['sta_id'] : NULL,
819
+			'CNT_ISO' => ! empty($this->_req_data['cnt_iso']) ? $this->_req_data['cnt_iso'] : NULL,
820
+			'VNU_zip' => ! empty($this->_req_data['vnu_zip']) ? $this->_req_data['vnu_zip'] : NULL,
821
+			'VNU_phone' => ! empty($this->_req_data['vnu_phone']) ? $this->_req_data['vnu_phone'] : NULL,
822
+			'VNU_capacity' => ! empty($this->_req_data['vnu_capacity']) ? str_replace(',', '', $this->_req_data['vnu_capacity']) : EE_INF,
823
+			'VNU_url' => ! empty($this->_req_data['vnu_url']) ? $this->_req_data['vnu_url'] : NULL,
824
+			'VNU_virtual_phone' => ! empty($this->_req_data['vnu_virtual_phone']) ? $this->_req_data['vnu_virtual_phone'] : NULL,
825
+			'VNU_virtual_url' => ! empty($this->_req_data['vnu_virtual_url']) ? $this->_req_data['vnu_virtual_url'] : NULL,
826
+			'VNU_enable_for_gmap' => ! empty($this->_req_data['vnu_enable_for_gmap']) ? TRUE : FALSE,
827
+			'VNU_google_map_link' => ! empty($this->_req_data['vnu_google_map_link']) ? $this->_req_data['vnu_google_map_link'] : NULL
828 828
 			);
829 829
 
830 830
 		//update venue
831
-		$success = $this->_venue_model->update( $venue_values, array( $wheres ) );
831
+		$success = $this->_venue_model->update($venue_values, array($wheres));
832 832
 
833 833
 		//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!
834
-		$get_one_where = array( $this->_venue_model->primary_key_name() => $post_id, 'status' => $post->post_status  );
835
-		$venue = $this->_venue_model->get_one( array( $get_one_where ) );
834
+		$get_one_where = array($this->_venue_model->primary_key_name() => $post_id, 'status' => $post->post_status);
835
+		$venue = $this->_venue_model->get_one(array($get_one_where));
836 836
 
837 837
 		//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.
838
-		$venue_update_callbacks = apply_filters( 'FHEE__Venues_Admin_Page___insert_update_cpt_item__venue_update_callbacks', array() );
838
+		$venue_update_callbacks = apply_filters('FHEE__Venues_Admin_Page___insert_update_cpt_item__venue_update_callbacks', array());
839 839
 
840 840
 		$att_success = TRUE;
841 841
 
842
-		foreach ( $venue_update_callbacks as $v_callback ) {
843
-			$_succ = call_user_func_array( $v_callback, array( $venue,  $this->_req_data ) );
844
-			$att_success = !$att_success ? $att_success : $_succ; //if ANY of these updates fail then we want the appropriate global error message
842
+		foreach ($venue_update_callbacks as $v_callback) {
843
+			$_succ = call_user_func_array($v_callback, array($venue, $this->_req_data));
844
+			$att_success = ! $att_success ? $att_success : $_succ; //if ANY of these updates fail then we want the appropriate global error message
845 845
 		}
846 846
 
847 847
 		//any errors?
848
-		if ( $success && !$att_success ) {
849
-			EE_Error::add_error( __('Venue Details saved successfully but something went wrong with saving attachments.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
850
-		} else if ( $success === FALSE ) {
851
-			EE_Error::add_error( __('Venue Details did not save successfully.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
848
+		if ($success && ! $att_success) {
849
+			EE_Error::add_error(__('Venue Details saved successfully but something went wrong with saving attachments.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
850
+		} else if ($success === FALSE) {
851
+			EE_Error::add_error(__('Venue Details did not save successfully.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
852 852
 		}
853 853
 	}
854 854
 
@@ -856,9 +856,9 @@  discard block
 block discarded – undo
856 856
 
857 857
 
858 858
 
859
-	public function trash_cpt_item( $post_id ) {
859
+	public function trash_cpt_item($post_id) {
860 860
 		$this->_req_data['VNU_ID'] = $post_id;
861
-		$this->_trash_or_restore_venue( 'trash', FALSE );
861
+		$this->_trash_or_restore_venue('trash', FALSE);
862 862
 	}
863 863
 
864 864
 
@@ -866,18 +866,18 @@  discard block
 block discarded – undo
866 866
 
867 867
 
868 868
 
869
-	public function restore_cpt_item( $post_id ) {
869
+	public function restore_cpt_item($post_id) {
870 870
 		$this->_req_data['VNU_ID'] = $post_id;
871
-		$this->_trash_or_restore_venue( 'draft', FALSE );
871
+		$this->_trash_or_restore_venue('draft', FALSE);
872 872
 	}
873 873
 
874 874
 
875 875
 
876 876
 
877 877
 
878
-	public function delete_cpt_item( $post_id ) {
878
+	public function delete_cpt_item($post_id) {
879 879
 		$this->_req_data['VNU_ID'] = $post_id;
880
-		$this->_delete_venue( FALSE );
880
+		$this->_delete_venue(FALSE);
881 881
 	}
882 882
 
883 883
 
@@ -892,15 +892,15 @@  discard block
 block discarded – undo
892 892
 
893 893
 
894 894
 
895
-	protected function _trash_or_restore_venue( $venue_status = 'trash', $redirect_after = TRUE ) {
896
-		$VNU_ID = isset( $this->_req_data['VNU_ID'] ) ? absint( $this->_req_data['VNU_ID'] ) : FALSE;
895
+	protected function _trash_or_restore_venue($venue_status = 'trash', $redirect_after = TRUE) {
896
+		$VNU_ID = isset($this->_req_data['VNU_ID']) ? absint($this->_req_data['VNU_ID']) : FALSE;
897 897
 
898 898
 		//loop thru venues
899
-		if ( $VNU_ID ) {
899
+		if ($VNU_ID) {
900 900
 			//clean status
901
-			$venue_status = sanitize_key( $venue_status );
901
+			$venue_status = sanitize_key($venue_status);
902 902
 			// grab status
903
-			if (!empty($venue_status)) {
903
+			if ( ! empty($venue_status)) {
904 904
 				$success = $this->_change_venue_status($VNU_ID, $venue_status);
905 905
 			} else {
906 906
 				$success = FALSE;
@@ -914,7 +914,7 @@  discard block
 block discarded – undo
914 914
 		}
915 915
 		$action = $venue_status == 'trash' ? 'moved to the trash' : 'restored from the trash';
916 916
 
917
-		if ( $redirect_after )
917
+		if ($redirect_after)
918 918
 			$this->_redirect_after_action($success, 'Venue', $action, array('action' => 'default'));
919 919
 
920 920
 	}
@@ -923,11 +923,11 @@  discard block
 block discarded – undo
923 923
 
924 924
 
925 925
 
926
-	protected function _trash_or_restore_venues( $venue_status = 'trash' ) {
926
+	protected function _trash_or_restore_venues($venue_status = 'trash') {
927 927
 		// clean status
928 928
 		$venue_status = sanitize_key($venue_status);
929 929
 		// grab status
930
-		if (!empty($venue_status)) {
930
+		if ( ! empty($venue_status)) {
931 931
 			$success = TRUE;
932 932
 			//determine the event id and set to array.
933 933
 			$VNU_IDs = isset($this->_req_data['venue_id']) ? (array) $this->_req_data['venue_id'] : array();
@@ -967,20 +967,20 @@  discard block
 block discarded – undo
967 967
 	 * @param  string $venue_status
968 968
 	 * @return void
969 969
 	 */
970
-	private function _change_venue_status( $VNU_ID = 0, $venue_status = '' ) {
970
+	private function _change_venue_status($VNU_ID = 0, $venue_status = '') {
971 971
 		// grab venue id
972
-		if (! $VNU_ID) {
972
+		if ( ! $VNU_ID) {
973 973
 			$msg = __('An error occurred. No Venue ID or an invalid Venue ID was received.', 'event_espresso');
974 974
 			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
975 975
 			return FALSE;
976 976
 		}
977 977
 
978
-		$this->_cpt_model_obj = EEM_Venue::instance()->get_one_by_ID( $VNU_ID );
978
+		$this->_cpt_model_obj = EEM_Venue::instance()->get_one_by_ID($VNU_ID);
979 979
 
980 980
 		// clean status
981 981
 		$venue_status = sanitize_key($venue_status);
982 982
 		// grab status
983
-		if ( ! $venue_status ) {
983
+		if ( ! $venue_status) {
984 984
 			$msg = __('An error occurred. No Venue Status or an invalid Venue Status was received.', 'event_espresso');
985 985
 			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
986 986
 			return FALSE;
@@ -1001,7 +1001,7 @@  discard block
 block discarded – undo
1001 1001
 				$hook = FALSE;
1002 1002
 		}
1003 1003
 		//use class to change status
1004
-		$this->_cpt_model_obj->set_status( $venue_status );
1004
+		$this->_cpt_model_obj->set_status($venue_status);
1005 1005
 		$success = $this->_cpt_model_obj->save();
1006 1006
 
1007 1007
 		if ($success === FALSE) {
@@ -1020,21 +1020,21 @@  discard block
 block discarded – undo
1020 1020
 	 * @param  bool $redirect_after
1021 1021
 	 * @return void
1022 1022
 	 */
1023
-	protected function _delete_venue( $redirect_after = true ) {
1023
+	protected function _delete_venue($redirect_after = true) {
1024 1024
 		//determine the venue id and set to array.
1025 1025
 		$VNU_ID = isset($this->_req_data['VNU_ID']) ? absint($this->_req_data['VNU_ID']) : NULL;
1026
-		$VNU_ID = isset( $this->_req_data['post'] ) ? absint( $this->_req_data['post'] ) : $VNU_ID;
1026
+		$VNU_ID = isset($this->_req_data['post']) ? absint($this->_req_data['post']) : $VNU_ID;
1027 1027
 
1028 1028
 
1029 1029
 		// loop thru venues
1030 1030
 		if ($VNU_ID) {
1031
-			$success = $this->_delete_or_trash_venue( $VNU_ID );
1031
+			$success = $this->_delete_or_trash_venue($VNU_ID);
1032 1032
 		} else {
1033 1033
 			$success = FALSE;
1034 1034
 			$msg = __('An error occurred. An venue could not be deleted because a valid venue ID was not not supplied.', 'event_espresso');
1035 1035
 			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1036 1036
 		}
1037
-		if ( $redirect_after )
1037
+		if ($redirect_after)
1038 1038
 			$this->_redirect_after_action($success, 'Venue', 'deleted', array('action' => 'default'));
1039 1039
 	}
1040 1040
 
@@ -1066,7 +1066,7 @@  discard block
 block discarded – undo
1066 1066
 	//todo: put in parent
1067 1067
 	private function _delete_or_trash_venue($VNU_ID = FALSE) {
1068 1068
 		// grab event id
1069
-		if (!$VNU_ID = absint($VNU_ID)) {
1069
+		if ( ! $VNU_ID = absint($VNU_ID)) {
1070 1070
 			$msg = __('An error occurred. No Venue ID or an invalid Venue ID was received.', 'event_espresso');
1071 1071
 			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1072 1072
 			return FALSE;
@@ -1086,7 +1086,7 @@  discard block
 block discarded – undo
1086 1086
 			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1087 1087
 			return FALSE;
1088 1088
 		}
1089
-		do_action( 'AHEE__Venues_Admin_Page___delete_or_trash_venue__after_venue_deleted' );
1089
+		do_action('AHEE__Venues_Admin_Page___delete_or_trash_venue__after_venue_deleted');
1090 1090
 		return TRUE;
1091 1091
 	}
1092 1092
 
@@ -1097,11 +1097,11 @@  discard block
 block discarded – undo
1097 1097
 	/* QUERIES */
1098 1098
 
1099 1099
 
1100
-	public function get_venues( $per_page = 10, $count = FALSE ) {
1100
+	public function get_venues($per_page = 10, $count = FALSE) {
1101 1101
 
1102
-		$_orderby = !empty( $this->_req_data['orderby'] ) ? $this->_req_data['orderby'] : '';
1102
+		$_orderby = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : '';
1103 1103
 
1104
-		switch ( $_orderby ) {
1104
+		switch ($_orderby) {
1105 1105
 			case 'id':
1106 1106
 				$orderby = 'VNU_ID';
1107 1107
 				break;
@@ -1119,43 +1119,43 @@  discard block
 block discarded – undo
1119 1119
 		}
1120 1120
 
1121 1121
 
1122
-		$sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'ASC';
1122
+		$sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'ASC';
1123 1123
 
1124
-		$current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1;
1125
-		$per_page = isset( $per_page ) && !empty( $per_page ) ? $per_page : 10;
1126
-		$per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page;
1124
+		$current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1;
1125
+		$per_page = isset($per_page) && ! empty($per_page) ? $per_page : 10;
1126
+		$per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page;
1127 1127
 
1128 1128
 
1129
-		$offset = ($current_page-1)*$per_page;
1129
+		$offset = ($current_page - 1) * $per_page;
1130 1130
 		$limit = array($offset, $per_page);
1131 1131
 
1132
-		$category = isset( $this->_req_data['category'] ) && $this->_req_data['category'] > 0 ? $this->_req_data['category'] : NULL;
1132
+		$category = isset($this->_req_data['category']) && $this->_req_data['category'] > 0 ? $this->_req_data['category'] : NULL;
1133 1133
 		$where = array();
1134 1134
 
1135 1135
 		//only set initial status if it is in the incoming request.  Otherwise the "all" view display's all statuses.
1136
-		if ( isset( $this->_req_data['status'] ) && $this->_req_data['status'] != 'all' ) {
1136
+		if (isset($this->_req_data['status']) && $this->_req_data['status'] != 'all') {
1137 1137
 			$where['status'] = $this->_req_data['status'];
1138 1138
 		}
1139 1139
 
1140
-		if ( isset( $this->_req_data['venue_status'] ) ) {
1140
+		if (isset($this->_req_data['venue_status'])) {
1141 1141
 			$where['status'] = $this->_req_data['venue_status'];
1142 1142
 		}
1143 1143
 
1144 1144
 
1145
-		if ( $category ) {
1145
+		if ($category) {
1146 1146
 			$where['Term_Taxonomy.taxonomy'] = 'espresso_venue_categories';
1147 1147
 			$where['Term_Taxonomy.term_id'] = $category;
1148 1148
 		}
1149 1149
 
1150 1150
 
1151
-		if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_venues', 'get_venues' ) ) {
1152
-			$where['VNU_wp_user'] =  get_current_user_id();
1151
+		if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_venues', 'get_venues')) {
1152
+			$where['VNU_wp_user'] = get_current_user_id();
1153 1153
 		} else {
1154
-				if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_private_venues', 'get_venues' ) ) {
1154
+				if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_private_venues', 'get_venues')) {
1155 1155
 					$where['OR'] = array(
1156
-						'status*restrict_private' => array( '!=', 'private' ),
1156
+						'status*restrict_private' => array('!=', 'private'),
1157 1157
 						'AND'                     => array(
1158
-							'status*inclusive' => array( '=', 'private' ),
1158
+							'status*inclusive' => array('=', 'private'),
1159 1159
 							'VNU_wp_user'      => get_current_user_id()
1160 1160
 						)
1161 1161
 					);
@@ -1165,30 +1165,30 @@  discard block
 block discarded – undo
1165 1165
 
1166 1166
 
1167 1167
 
1168
-		if ( isset( $this->_req_data['s'] ) ) {
1169
-			$sstr = '%' . $this->_req_data['s'] . '%';
1168
+		if (isset($this->_req_data['s'])) {
1169
+			$sstr = '%'.$this->_req_data['s'].'%';
1170 1170
 			$where['OR'] = array(
1171
-				'VNU_name' => array('LIKE',$sstr ),
1172
-				'VNU_desc' => array('LIKE',$sstr ),
1173
-				'VNU_short_desc' => array( 'LIKE',$sstr ),
1174
-				'VNU_address' => array( 'LIKE', $sstr ),
1175
-				'VNU_address2' => array( 'LIKE', $sstr ),
1176
-				'VNU_city' => array( 'LIKE', $sstr ),
1177
-				'VNU_zip' => array( 'LIKE', $sstr ),
1178
-				'VNU_phone' => array( 'LIKE', $sstr ),
1179
-				'VNU_url' => array( 'LIKE', $sstr ),
1180
-				'VNU_virtual_phone' => array( 'LIKE', $sstr ),
1181
-				'VNU_virtual_url' => array( 'LIKE', $sstr ),
1182
-				'VNU_google_map_link' => array( 'LIKE', $sstr ),
1183
-				'Event.EVT_name' => array('LIKE', $sstr ),
1184
-				'Event.EVT_desc' => array('LIKE', $sstr ),
1185
-				'Event.EVT_phone' => array('LIKE', $sstr ),
1186
-				'Event.EVT_external_URL' => array('LIKE', $sstr ),
1171
+				'VNU_name' => array('LIKE', $sstr),
1172
+				'VNU_desc' => array('LIKE', $sstr),
1173
+				'VNU_short_desc' => array('LIKE', $sstr),
1174
+				'VNU_address' => array('LIKE', $sstr),
1175
+				'VNU_address2' => array('LIKE', $sstr),
1176
+				'VNU_city' => array('LIKE', $sstr),
1177
+				'VNU_zip' => array('LIKE', $sstr),
1178
+				'VNU_phone' => array('LIKE', $sstr),
1179
+				'VNU_url' => array('LIKE', $sstr),
1180
+				'VNU_virtual_phone' => array('LIKE', $sstr),
1181
+				'VNU_virtual_url' => array('LIKE', $sstr),
1182
+				'VNU_google_map_link' => array('LIKE', $sstr),
1183
+				'Event.EVT_name' => array('LIKE', $sstr),
1184
+				'Event.EVT_desc' => array('LIKE', $sstr),
1185
+				'Event.EVT_phone' => array('LIKE', $sstr),
1186
+				'Event.EVT_external_URL' => array('LIKE', $sstr),
1187 1187
 				);
1188 1188
 		}
1189 1189
 
1190 1190
 
1191
-		$venues = $count ? $this->_venue_model->count( array($where), 'VNU_ID' ) : $this->_venue_model->get_all( array( $where, 'limit' => $limit, 'order_by' => $orderby, 'order' => $sort ) );
1191
+		$venues = $count ? $this->_venue_model->count(array($where), 'VNU_ID') : $this->_venue_model->get_all(array($where, 'limit' => $limit, 'order_by' => $orderby, 'order' => $sort));
1192 1192
 
1193 1193
 		return $venues;
1194 1194
 
@@ -1206,22 +1206,22 @@  discard block
 block discarded – undo
1206 1206
 	 * @return void
1207 1207
 	 */
1208 1208
 	private function _set_category_object() {
1209
-		if ( isset( $this->_category->id ) && !empty( $this->_category->id ) )
1209
+		if (isset($this->_category->id) && ! empty($this->_category->id))
1210 1210
 			return; //already have the category object so get out.
1211 1211
 
1212 1212
 		//set default category object
1213 1213
 		$this->_set_empty_category_object();
1214 1214
 
1215 1215
 		//only set if we've got an id
1216
-		if ( !isset($this->_req_data['VEN_CAT_ID'] ) ) {
1216
+		if ( ! isset($this->_req_data['VEN_CAT_ID'])) {
1217 1217
 			return;
1218 1218
 		}
1219 1219
 
1220 1220
 		$category_id = absint($this->_req_data['VEN_CAT_ID']);
1221
-		$term = get_term( $category_id, 'espresso_venue_categories' );
1221
+		$term = get_term($category_id, 'espresso_venue_categories');
1222 1222
 
1223 1223
 
1224
-		if ( !empty( $term ) ) {
1224
+		if ( ! empty($term)) {
1225 1225
 			$this->_category->category_name = $term->name;
1226 1226
 			$this->_category->category_identifier = $term->slug;
1227 1227
 			$this->_category->category_desc = $term->description;
@@ -1235,14 +1235,14 @@  discard block
 block discarded – undo
1235 1235
 
1236 1236
 	private function _set_empty_category_object() {
1237 1237
 		$this->_category = new stdClass();
1238
-		$this->_category->category_name = $this->_category->category_identifier = $this->_category->category_desc  = '';
1238
+		$this->_category->category_name = $this->_category->category_identifier = $this->_category->category_desc = '';
1239 1239
 		$this->_category->id = $this->_category->parent = 0;
1240 1240
 	}
1241 1241
 
1242 1242
 
1243 1243
 
1244 1244
 	protected function _category_list_table() {
1245
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
1245
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1246 1246
 		$this->_admin_page_title .= $this->get_action_link_or_button('add_category', 'add_category', array(), 'add-new-h2');
1247 1247
 		$this->_search_btn_label = __('Venue Categories', 'event_espresso');
1248 1248
 		$this->display_admin_list_table_page_with_sidebar();
@@ -1258,13 +1258,13 @@  discard block
 block discarded – undo
1258 1258
 		$this->_set_add_edit_form_tags($route);
1259 1259
 
1260 1260
 		$this->_set_category_object();
1261
-		$id = !empty($this->_category->id) ? $this->_category->id : '';
1261
+		$id = ! empty($this->_category->id) ? $this->_category->id : '';
1262 1262
 
1263 1263
 		$delete_action = 'delete_category';
1264 1264
 
1265
-		$redirect = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'category_list' ), $this->_admin_base_url );
1265
+		$redirect = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'category_list'), $this->_admin_base_url);
1266 1266
 
1267
-		$this->_set_publish_post_box_vars( 'VEN_CAT_ID', $id, $delete_action, $redirect );
1267
+		$this->_set_publish_post_box_vars('VEN_CAT_ID', $id, $delete_action, $redirect);
1268 1268
 
1269 1269
 		//take care of contents
1270 1270
 		$this->_template_args['admin_page_content'] = $this->_category_details_content();
@@ -1278,25 +1278,25 @@  discard block
 block discarded – undo
1278 1278
 			'type' => 'wp_editor',
1279 1279
 			'value' => EEH_Formatter::admin_format_content($this->_category->category_desc),
1280 1280
 			'class' => 'my_editor_custom',
1281
-			'wpeditor_args' => array( 'media_buttons' => FALSE )
1281
+			'wpeditor_args' => array('media_buttons' => FALSE)
1282 1282
 		);
1283
-		$_wp_editor = $this->_generate_admin_form_fields( $editor_args, 'array' );
1283
+		$_wp_editor = $this->_generate_admin_form_fields($editor_args, 'array');
1284 1284
 
1285
-		$all_terms = get_terms( array('espresso_venue_categories' ), array( 'hide_empty' => 0, 'exclude' => array( $this->_category->id ) ) );
1285
+		$all_terms = get_terms(array('espresso_venue_categories'), array('hide_empty' => 0, 'exclude' => array($this->_category->id)));
1286 1286
 
1287 1287
 		//setup category select for term parents.
1288 1288
 		$category_select_values[] = array(
1289 1289
 			'text' => __('No Parent', 'event_espresso'),
1290 1290
 			'id' => 0
1291 1291
 			);
1292
-		foreach ( $all_terms as $term ) {
1292
+		foreach ($all_terms as $term) {
1293 1293
 			$category_select_values[] = array(
1294 1294
 				'text' => $term->name,
1295 1295
 				'id' => $term->term_id
1296 1296
 				);
1297 1297
 		}
1298 1298
 
1299
-		$category_select = EEH_Form_Fields::select_input( 'category_parent', $category_select_values, $this->_category->parent );
1299
+		$category_select = EEH_Form_Fields::select_input('category_parent', $category_select_values, $this->_category->parent);
1300 1300
 		$template_args = array(
1301 1301
 			'category' => $this->_category,
1302 1302
 			'category_select' => $category_select,
@@ -1305,15 +1305,15 @@  discard block
 block discarded – undo
1305 1305
 			'disable' => '',
1306 1306
 			'disabled_message' =>FALSE
1307 1307
 			);
1308
-		$template = EVENTS_TEMPLATE_PATH . 'event_category_details.template.php';
1309
-		return EEH_Template::display_template($template, $template_args, TRUE );
1308
+		$template = EVENTS_TEMPLATE_PATH.'event_category_details.template.php';
1309
+		return EEH_Template::display_template($template, $template_args, TRUE);
1310 1310
 	}
1311 1311
 
1312 1312
 
1313 1313
 	protected function _delete_categories() {
1314
-		$cat_ids = isset( $this->_req_data['VEN_CAT_ID'] ) ? (array) $this->_req_data['VEN_CAT_ID'] : (array) $this->_req_data['category_id'];
1314
+		$cat_ids = isset($this->_req_data['VEN_CAT_ID']) ? (array) $this->_req_data['VEN_CAT_ID'] : (array) $this->_req_data['category_id'];
1315 1315
 
1316
-		foreach ( $cat_ids as $cat_id ) {
1316
+		foreach ($cat_ids as $cat_id) {
1317 1317
 			$this->_delete_category($cat_id);
1318 1318
 		}
1319 1319
 
@@ -1321,7 +1321,7 @@  discard block
 block discarded – undo
1321 1321
 		$query_args = array(
1322 1322
 			'action' => 'category_list'
1323 1323
 			);
1324
-		$this->_redirect_after_action(0,'','',$query_args);
1324
+		$this->_redirect_after_action(0, '', '', $query_args);
1325 1325
 
1326 1326
 	}
1327 1327
 
@@ -1330,58 +1330,58 @@  discard block
 block discarded – undo
1330 1330
 
1331 1331
 
1332 1332
 	protected function _delete_category($cat_id) {
1333
-		$cat_id = absint( $cat_id );
1334
-		wp_delete_term( $cat_id, 'espresso_venue_categories' );
1333
+		$cat_id = absint($cat_id);
1334
+		wp_delete_term($cat_id, 'espresso_venue_categories');
1335 1335
 	}
1336 1336
 
1337 1337
 
1338 1338
 
1339 1339
 	protected function _insert_or_update_category($new_category) {
1340 1340
 
1341
-		$cat_id = $new_category ? $this->_insert_category() : $this->_insert_category( TRUE );
1341
+		$cat_id = $new_category ? $this->_insert_category() : $this->_insert_category(TRUE);
1342 1342
 		$success = 0; //we already have a success message so lets not send another.
1343
-		if ( $cat_id ) {
1343
+		if ($cat_id) {
1344 1344
 			$query_args = array(
1345 1345
 				'action'     => 'edit_category',
1346 1346
 				'VEN_CAT_ID' => $cat_id
1347 1347
 			);
1348 1348
 		} else {
1349
-			$query_args = array( 'action' => 'add_category' );
1349
+			$query_args = array('action' => 'add_category');
1350 1350
 		}
1351
-		$this->_redirect_after_action( $success, '','', $query_args, TRUE );
1351
+		$this->_redirect_after_action($success, '', '', $query_args, TRUE);
1352 1352
 
1353 1353
 	}
1354 1354
 
1355 1355
 
1356 1356
 
1357
-	private function _insert_category( $update = FALSE ) {
1357
+	private function _insert_category($update = FALSE) {
1358 1358
 		$cat_id = $update ? $this->_req_data['VEN_CAT_ID'] : '';
1359
-		$category_name= isset( $this->_req_data['category_name'] ) ? $this->_req_data['category_name'] : '';
1360
-		$category_desc= isset( $this->_req_data['category_desc'] ) ? $this->_req_data['category_desc'] : '';
1361
-		$category_parent = isset( $this->_req_data['category_parent'] ) ? $this->_req_data['category_parent'] : 0;
1359
+		$category_name = isset($this->_req_data['category_name']) ? $this->_req_data['category_name'] : '';
1360
+		$category_desc = isset($this->_req_data['category_desc']) ? $this->_req_data['category_desc'] : '';
1361
+		$category_parent = isset($this->_req_data['category_parent']) ? $this->_req_data['category_parent'] : 0;
1362 1362
 
1363
-		if ( empty( $category_name ) ) {
1364
-			$msg = __( 'You must add a name for the category.', 'event_espresso' );
1365
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
1363
+		if (empty($category_name)) {
1364
+			$msg = __('You must add a name for the category.', 'event_espresso');
1365
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1366 1366
 			return false;
1367 1367
 		}
1368 1368
 
1369 1369
 
1370
-		$term_args=array(
1370
+		$term_args = array(
1371 1371
 			'name'=>$category_name,
1372 1372
 			'description'=>$category_desc,
1373 1373
 			'parent'=>$category_parent
1374 1374
 		);
1375 1375
 
1376
-		$insert_ids = $update ? wp_update_term( $cat_id, 'espresso_venue_categories', $term_args ) :wp_insert_term( $category_name, 'espresso_venue_categories', $term_args );
1376
+		$insert_ids = $update ? wp_update_term($cat_id, 'espresso_venue_categories', $term_args) : wp_insert_term($category_name, 'espresso_venue_categories', $term_args);
1377 1377
 
1378
-		if ( !is_array( $insert_ids ) ) {
1379
-			$msg = __( 'An error occurred and the category has not been saved to the database.', 'event_espresso' );
1380
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
1378
+		if ( ! is_array($insert_ids)) {
1379
+			$msg = __('An error occurred and the category has not been saved to the database.', 'event_espresso');
1380
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1381 1381
 		} else {
1382 1382
 			$cat_id = $insert_ids['term_id'];
1383
-			$msg = sprintf ( __('The category %s was successfully created', 'event_espresso'), $category_name );
1384
-			EE_Error::add_success( $msg );
1383
+			$msg = sprintf(__('The category %s was successfully created', 'event_espresso'), $category_name);
1384
+			EE_Error::add_success($msg);
1385 1385
 		}
1386 1386
 
1387 1387
 		return $cat_id;
@@ -1401,11 +1401,11 @@  discard block
 block discarded – undo
1401 1401
 			'category_ids' => $this->_req_data['VEN_CAT_ID']
1402 1402
 			);
1403 1403
 
1404
-		$this->_req_data = array_merge( $this->_req_data, $new_request_args );
1404
+		$this->_req_data = array_merge($this->_req_data, $new_request_args);
1405 1405
 
1406
-		if ( is_readable( EE_CLASSES . 'EE_Export.class.php') ) {
1407
-			require_once( EE_CLASSES . 'EE_Export.class.php');
1408
-			$EE_Export = EE_Export::instance( $this->_req_data );
1406
+		if (is_readable(EE_CLASSES.'EE_Export.class.php')) {
1407
+			require_once(EE_CLASSES.'EE_Export.class.php');
1408
+			$EE_Export = EE_Export::instance($this->_req_data);
1409 1409
 			$EE_Export->export();
1410 1410
 		}
1411 1411
 
@@ -1417,7 +1417,7 @@  discard block
 block discarded – undo
1417 1417
 
1418 1418
 	protected function _import_categories() {
1419 1419
 
1420
-		require_once(EE_CLASSES . 'EE_Import.class.php');
1420
+		require_once(EE_CLASSES.'EE_Import.class.php');
1421 1421
 		EE_Import::instance()->import();
1422 1422
 
1423 1423
 	}
@@ -1425,29 +1425,29 @@  discard block
 block discarded – undo
1425 1425
 
1426 1426
 
1427 1427
 
1428
-	public function get_categories( $per_page = 10, $current_page = 1, $count = FALSE ) {
1428
+	public function get_categories($per_page = 10, $current_page = 1, $count = FALSE) {
1429 1429
 
1430 1430
 		//testing term stuff
1431
-		$orderby = isset( $this->_req_data['orderby'] ) ? $this->_req_data['orderby'] : 'Term.term_id';
1432
-		$order = isset( $this->_req_data['order'] ) ? $this->_req_data['order'] : 'DESC';
1433
-		$limit = ($current_page-1)*$per_page;
1434
-		$where = array( 'taxonomy' => 'espresso_venue_categories' );
1435
-		if ( isset( $this->_req_data['s'] ) ) {
1436
-			$sstr = '%' . $this->_req_data['s'] . '%';
1431
+		$orderby = isset($this->_req_data['orderby']) ? $this->_req_data['orderby'] : 'Term.term_id';
1432
+		$order = isset($this->_req_data['order']) ? $this->_req_data['order'] : 'DESC';
1433
+		$limit = ($current_page - 1) * $per_page;
1434
+		$where = array('taxonomy' => 'espresso_venue_categories');
1435
+		if (isset($this->_req_data['s'])) {
1436
+			$sstr = '%'.$this->_req_data['s'].'%';
1437 1437
 			$where['OR'] = array(
1438
-				'Term.name' => array( 'LIKE', $sstr),
1439
-				'description' => array( 'LIKE', $sstr )
1438
+				'Term.name' => array('LIKE', $sstr),
1439
+				'description' => array('LIKE', $sstr)
1440 1440
 				);
1441 1441
 		}
1442 1442
 
1443 1443
 		$query_params = array(
1444 1444
 			$where,
1445
-			'order_by' => array( $orderby => $order ),
1446
-			'limit' => $limit . ',' . $per_page,
1445
+			'order_by' => array($orderby => $order),
1446
+			'limit' => $limit.','.$per_page,
1447 1447
 			'force_join' => array('Term')
1448 1448
 			);
1449 1449
 
1450
-		$categories = $count ? EEM_Term_Taxonomy::instance()->count( $query_params, 'term_id' ) :EEM_Term_Taxonomy::instance()->get_all( $query_params );
1450
+		$categories = $count ? EEM_Term_Taxonomy::instance()->count($query_params, 'term_id') : EEM_Term_Taxonomy::instance()->get_all($query_params);
1451 1451
 
1452 1452
 		return $categories;
1453 1453
 	}
Please login to merge, or discard this patch.
admin_pages/events/Events_Admin_Page.core.php 1 patch
Spacing   +387 added lines, -387 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
 /**
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 		$this->_cpt_edit_routes = array(
67 67
 			'espresso_events' => 'edit'
68 68
 		);
69
-		add_action('AHEE__EE_Admin_Page_CPT__set_model_object__after_set_object', array( $this, 'verify_event_edit' ) );
69
+		add_action('AHEE__EE_Admin_Page_CPT__set_model_object__after_set_object', array($this, 'verify_event_edit'));
70 70
 	}
71 71
 
72 72
 	protected function _ajax_hooks() {
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 				'edit' => esc_html__('Update Event', 'event_espresso'),
93 93
 				'add_category' => esc_html__('Save New Category', 'event_espresso'),
94 94
 				'edit_category' => esc_html__('Update Category', 'event_espresso'),
95
-				'template_settings' => esc_html__( 'Update Settings', 'event_espresso' )
95
+				'template_settings' => esc_html__('Update Settings', 'event_espresso')
96 96
 				)
97 97
 		);
98 98
 	}
@@ -102,8 +102,8 @@  discard block
 block discarded – undo
102 102
 		//load field generator helper
103 103
 
104 104
 		//is there a evt_id in the request?
105
-		$evt_id = ! empty( $this->_req_data['EVT_ID'] ) && ! is_array( $this->_req_data['EVT_ID'] ) ? $this->_req_data['EVT_ID'] : 0;
106
-		$evt_id = ! empty( $this->_req_data['post'] ) ? $this->_req_data['post'] : $evt_id;
105
+		$evt_id = ! empty($this->_req_data['EVT_ID']) && ! is_array($this->_req_data['EVT_ID']) ? $this->_req_data['EVT_ID'] : 0;
106
+		$evt_id = ! empty($this->_req_data['post']) ? $this->_req_data['post'] : $evt_id;
107 107
 
108 108
 
109 109
 		$this->_page_routes = array(
@@ -317,7 +317,7 @@  discard block
 block discarded – undo
317 317
 				'help_tour' => array(
318 318
 					'Event_Editor_Help_Tour'
319 319
 					),
320
-				'qtips' => array( 'EE_Event_Editor_Decaf_Tips' ),
320
+				'qtips' => array('EE_Event_Editor_Decaf_Tips'),
321 321
 				'require_nonce' => FALSE
322 322
 			),
323 323
 			'edit' => array(
@@ -373,7 +373,7 @@  discard block
 block discarded – undo
373 373
 				/*'help_tour' => array(
374 374
 					'Event_Edit_Help_Tour'
375 375
 				),*/
376
-				'qtips' => array( 'EE_Event_Editor_Decaf_Tips' ),
376
+				'qtips' => array('EE_Event_Editor_Decaf_Tips'),
377 377
 				'require_nonce' => FALSE
378 378
 			),
379 379
 			'default_event_settings' => array(
@@ -395,7 +395,7 @@  discard block
 block discarded – undo
395 395
 						'filename' => 'events_default_settings_status'
396 396
 					)
397 397
 				),
398
-				'help_tour' => array( 'Event_Default_Settings_Help_Tour'),
398
+				'help_tour' => array('Event_Default_Settings_Help_Tour'),
399 399
 				'require_nonce' => FALSE
400 400
 			),
401 401
 			//template settings
@@ -411,7 +411,7 @@  discard block
 block discarded – undo
411 411
 						'filename' => 'general_settings_templates'
412 412
 					)
413 413
 				),
414
-				'help_tour' => array( 'Templates_Help_Tour' ),
414
+				'help_tour' => array('Templates_Help_Tour'),
415 415
 				'require_nonce' => FALSE
416 416
 			),
417 417
 			//event category stuff
@@ -435,7 +435,7 @@  discard block
 block discarded – undo
435 435
 					'label' => esc_html__('Edit Category', 'event_espresso'),
436 436
 					'order' => 15,
437 437
 					'persistent' => FALSE,
438
-					'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
438
+					'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
439 439
 					),
440 440
 				'help_tabs' => array(
441 441
 					'edit_category_help_tab' => array(
@@ -505,14 +505,14 @@  discard block
 block discarded – undo
505 505
 
506 506
 	public function load_scripts_styles() {
507 507
 
508
-		wp_register_style('events-admin-css', EVENTS_ASSETS_URL . 'events-admin-page.css', array(), EVENT_ESPRESSO_VERSION);
509
-		wp_register_style('ee-cat-admin', EVENTS_ASSETS_URL . 'ee-cat-admin.css', array(), EVENT_ESPRESSO_VERSION );
508
+		wp_register_style('events-admin-css', EVENTS_ASSETS_URL.'events-admin-page.css', array(), EVENT_ESPRESSO_VERSION);
509
+		wp_register_style('ee-cat-admin', EVENTS_ASSETS_URL.'ee-cat-admin.css', array(), EVENT_ESPRESSO_VERSION);
510 510
 		wp_enqueue_style('events-admin-css');
511 511
 		wp_enqueue_style('ee-cat-admin');
512 512
 		//todo note: we also need to load_scripts_styles per view (i.e. default/view_report/event_details
513 513
 		//registers for all views
514 514
 		//scripts
515
-		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);
515
+		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);
516 516
 	}
517 517
 
518 518
 	/**
@@ -530,11 +530,11 @@  discard block
 block discarded – undo
530 530
 	public function load_scripts_styles_edit() {
531 531
 		//styles
532 532
 		wp_enqueue_style('espresso-ui-theme');
533
-		wp_register_style('event-editor-css', EVENTS_ASSETS_URL . 'event-editor.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION );
533
+		wp_register_style('event-editor-css', EVENTS_ASSETS_URL.'event-editor.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION);
534 534
 		wp_enqueue_style('event-editor-css');
535 535
 
536 536
 		//scripts
537
-		wp_register_script('event-datetime-metabox', EVENTS_ASSETS_URL . 'event-datetime-metabox.js', array('event_editor_js', 'ee-datepicker'), EVENT_ESPRESSO_VERSION );
537
+		wp_register_script('event-datetime-metabox', EVENTS_ASSETS_URL.'event-datetime-metabox.js', array('event_editor_js', 'ee-datepicker'), EVENT_ESPRESSO_VERSION);
538 538
 		wp_enqueue_script('event-datetime-metabox');
539 539
 
540 540
 	}
@@ -569,7 +569,7 @@  discard block
 block discarded – undo
569 569
 
570 570
 
571 571
 	public function admin_init() {
572
-		EE_Registry::$i18n_js_strings[ 'image_confirm' ] = esc_html__( 'Do you really want to delete this image? Please remember to update your event to complete the removal.', 'event_espresso' );
572
+		EE_Registry::$i18n_js_strings['image_confirm'] = esc_html__('Do you really want to delete this image? Please remember to update your event to complete the removal.', 'event_espresso');
573 573
 	}
574 574
 
575 575
 
@@ -590,12 +590,12 @@  discard block
 block discarded – undo
590 590
 	 */
591 591
 	public function verify_event_edit($event = NULL) {
592 592
 		// no event?
593
-		if ( empty( $event )) {
593
+		if (empty($event)) {
594 594
 			// set event
595 595
 			$event = $this->_cpt_model_obj;
596 596
 		}
597 597
 		// STILL no event?
598
-		if ( empty ( $event )) {
598
+		if (empty ($event)) {
599 599
 			return;
600 600
 		}
601 601
 		$orig_status = $event->status();
@@ -609,27 +609,27 @@  discard block
 block discarded – undo
609 609
 			return;
610 610
 		}
611 611
 		//made it here so it IS active... next check that any of the tickets are sold.
612
-		if ( $event->is_sold_out( true ) ) {
613
-			if ( $orig_status !== EEM_Event::sold_out && $event->status() !== $orig_status ) {
612
+		if ($event->is_sold_out(true)) {
613
+			if ($orig_status !== EEM_Event::sold_out && $event->status() !== $orig_status) {
614 614
 				EE_Error::add_attention(
615 615
 					sprintf(
616
-						esc_html__( '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' ),
617
-						EEH_Template::pretty_status( EEM_Event::sold_out, FALSE, 'sentence' )
616
+						esc_html__('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'),
617
+						EEH_Template::pretty_status(EEM_Event::sold_out, FALSE, 'sentence')
618 618
 					)
619 619
 				);
620 620
 			}
621 621
 			return;
622
-		} else if ( $orig_status === EEM_Event::sold_out ) {
622
+		} else if ($orig_status === EEM_Event::sold_out) {
623 623
 			EE_Error::add_attention(
624 624
 				sprintf(
625
-					esc_html__( 'Please note that the Event Status has automatically been changed to %s because more spaces have become available for this event, most likely due to abandoned transactions freeing up reserved tickets.  However, this change is not permanent until you update the event. If you wish, you can change the status back to something else before updating.',
626
-						'event_espresso' ),
627
-					EEH_Template::pretty_status( $event->status(), false, 'sentence' )
625
+					esc_html__('Please note that the Event Status has automatically been changed to %s because more spaces have become available for this event, most likely due to abandoned transactions freeing up reserved tickets.  However, this change is not permanent until you update the event. If you wish, you can change the status back to something else before updating.',
626
+						'event_espresso'),
627
+					EEH_Template::pretty_status($event->status(), false, 'sentence')
628 628
 				)
629 629
 			);
630 630
 		}
631 631
 		//now we need to determine if the event has any tickets on sale.  If not then we dont' show the error
632
-		if ( ! $event->tickets_on_sale() ) {
632
+		if ( ! $event->tickets_on_sale()) {
633 633
 			return;
634 634
 		}
635 635
 		//made it here so show warning
@@ -648,7 +648,7 @@  discard block
 block discarded – undo
648 648
 	 */
649 649
 	protected function _edit_event_warning() {
650 650
 		// we don't want to add warnings during these requests
651
-		if ( isset( $this->_req_data['action'] ) && $this->_req_data['action'] === 'editpost' ) {
651
+		if (isset($this->_req_data['action']) && $this->_req_data['action'] === 'editpost') {
652 652
 			return;
653 653
 		}
654 654
 		EE_Error::add_attention(
@@ -679,7 +679,7 @@  discard block
 block discarded – undo
679 679
 			),
680 680
 		);
681 681
 
682
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_events', 'espresso_events_trash_events' ) ) {
682
+		if (EE_Registry::instance()->CAP->current_user_can('ee_delete_events', 'espresso_events_trash_events')) {
683 683
 			$this->_views['trash'] = array(
684 684
 				'slug' => 'trash',
685 685
 				'label' => esc_html__('Trash', 'event_espresso'),
@@ -709,39 +709,39 @@  discard block
 block discarded – undo
709 709
 				'desc' => esc_html__('View Registrations for Event', 'event_espresso')
710 710
 			)
711 711
 		);
712
-		$items  = apply_filters( 'FHEE__Events_Admin_Page___event_legend_items__items', $items );
712
+		$items = apply_filters('FHEE__Events_Admin_Page___event_legend_items__items', $items);
713 713
 		$statuses = array(
714 714
 			'sold_out_status' => array(
715
-				'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::sold_out,
716
-				'desc' => EEH_Template::pretty_status( EE_Datetime::sold_out, FALSE, 'sentence' )
715
+				'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::sold_out,
716
+				'desc' => EEH_Template::pretty_status(EE_Datetime::sold_out, FALSE, 'sentence')
717 717
 			),
718 718
 			'active_status' => array(
719
-				'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::active,
720
-				'desc' => EEH_Template::pretty_status( EE_Datetime::active, FALSE, 'sentence' )
719
+				'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::active,
720
+				'desc' => EEH_Template::pretty_status(EE_Datetime::active, FALSE, 'sentence')
721 721
 			),
722 722
 			'upcoming_status' => array(
723
-				'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::upcoming,
724
-				'desc' => EEH_Template::pretty_status( EE_Datetime::upcoming, FALSE, 'sentence' )
723
+				'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::upcoming,
724
+				'desc' => EEH_Template::pretty_status(EE_Datetime::upcoming, FALSE, 'sentence')
725 725
 			),
726 726
 			'postponed_status' => array(
727
-				'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::postponed,
728
-				'desc' => EEH_Template::pretty_status( EE_Datetime::postponed, FALSE, 'sentence' )
727
+				'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::postponed,
728
+				'desc' => EEH_Template::pretty_status(EE_Datetime::postponed, FALSE, 'sentence')
729 729
 			),
730 730
 			'cancelled_status' => array(
731
-				'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::cancelled,
732
-				'desc' => EEH_Template::pretty_status( EE_Datetime::cancelled, FALSE, 'sentence' )
731
+				'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::cancelled,
732
+				'desc' => EEH_Template::pretty_status(EE_Datetime::cancelled, FALSE, 'sentence')
733 733
 			),
734 734
 			'expired_status' => array(
735
-				'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::expired,
736
-				'desc' => EEH_Template::pretty_status( EE_Datetime::expired, FALSE, 'sentence' )
735
+				'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::expired,
736
+				'desc' => EEH_Template::pretty_status(EE_Datetime::expired, FALSE, 'sentence')
737 737
 			),
738 738
 			'inactive_status' => array(
739
-				'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::inactive,
740
-				'desc' => EEH_Template::pretty_status( EE_Datetime::inactive, FALSE, 'sentence' )
739
+				'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::inactive,
740
+				'desc' => EEH_Template::pretty_status(EE_Datetime::inactive, FALSE, 'sentence')
741 741
 			)
742 742
 		);
743
-		$statuses = apply_filters( 'FHEE__Events_Admin_Page__event_legend_items__statuses', $statuses );
744
-		return array_merge( $items, $statuses );
743
+		$statuses = apply_filters('FHEE__Events_Admin_Page__event_legend_items__statuses', $statuses);
744
+		return array_merge($items, $statuses);
745 745
 	}
746 746
 
747 747
 
@@ -753,8 +753,8 @@  discard block
 block discarded – undo
753 753
 	 * @return EEM_Event
754 754
 	 */
755 755
 	private function _event_model() {
756
-		if ( ! $this->_event_model instanceof EEM_Event ) {
757
-			$this->_event_model = EE_Registry::instance()->load_model( 'Event' );
756
+		if ( ! $this->_event_model instanceof EEM_Event) {
757
+			$this->_event_model = EE_Registry::instance()->load_model('Event');
758 758
 		}
759 759
 		return $this->_event_model;
760 760
 	}
@@ -773,12 +773,12 @@  discard block
 block discarded – undo
773 773
 	 * @param  string $new_slug  what the slug is
774 774
 	 * @return string            The new html string for the permalink area
775 775
 	 */
776
-	public function extra_permalink_field_buttons( $return, $id, $new_title, $new_slug ) {
776
+	public function extra_permalink_field_buttons($return, $id, $new_title, $new_slug) {
777 777
 		//make sure this is only when editing
778
-		if ( !empty( $id ) ) {
779
-			$post = get_post( $id );
780
-			$return .= '<a class="button button-small" onclick="prompt(\'Shortcode:\', jQuery(\'#shortcode\').val()); return false;" href="#"  tabindex="-1">' . esc_html__('Shortcode', 'event_espresso') . '</a> ';
781
-			$return .= '<input id="shortcode" type="hidden" value="[ESPRESSO_TICKET_SELECTOR event_id=' . $post->ID . ']">';
778
+		if ( ! empty($id)) {
779
+			$post = get_post($id);
780
+			$return .= '<a class="button button-small" onclick="prompt(\'Shortcode:\', jQuery(\'#shortcode\').val()); return false;" href="#"  tabindex="-1">'.esc_html__('Shortcode', 'event_espresso').'</a> ';
781
+			$return .= '<input id="shortcode" type="hidden" value="[ESPRESSO_TICKET_SELECTOR event_id='.$post->ID.']">';
782 782
 		}
783 783
 		return $return;
784 784
 	}
@@ -794,8 +794,8 @@  discard block
 block discarded – undo
794 794
 	 * @return string html for generated table
795 795
 	 */
796 796
 	protected function _events_overview_list_table() {
797
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
798
-		$this->_template_args['after_list_table'] = EEH_Template::get_button_or_link( get_post_type_archive_link('espresso_events'), esc_html__("View Event Archive Page", "event_espresso"), 'button' ) .
797
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
798
+		$this->_template_args['after_list_table'] = EEH_Template::get_button_or_link(get_post_type_archive_link('espresso_events'), esc_html__("View Event Archive Page", "event_espresso"), 'button').
799 799
 		$this->_display_legend($this->_event_legend_items());
800 800
 		$this->_admin_page_title .= $this->get_action_link_or_button('create_new', 'add', array(), 'add-new-h2');
801 801
 		$this->display_admin_list_table_page_with_no_sidebar();
@@ -813,51 +813,51 @@  discard block
 block discarded – undo
813 813
 
814 814
 
815 815
 
816
-	protected function _insert_update_cpt_item( $post_id, $post ) {
816
+	protected function _insert_update_cpt_item($post_id, $post) {
817 817
 
818
-		if ( $post instanceof WP_Post && $post->post_type !== 'espresso_events' ) {
818
+		if ($post instanceof WP_Post && $post->post_type !== 'espresso_events') {
819 819
 			//getout we're not processing an event save.
820 820
 			return;
821 821
 		}
822 822
 
823 823
 		$event_values = array(
824
-			'EVT_display_desc' => !empty( $this->_req_data['display_desc'] ) ? 1 : 0,
825
-			'EVT_display_ticket_selector' => !empty( $this->_req_data['display_ticket_selector'] ) ? 1 : 0,
824
+			'EVT_display_desc' => ! empty($this->_req_data['display_desc']) ? 1 : 0,
825
+			'EVT_display_ticket_selector' => ! empty($this->_req_data['display_ticket_selector']) ? 1 : 0,
826 826
 			'EVT_additional_limit' => min(
827
-					apply_filters( 'FHEE__EE_Events_Admin__insert_update_cpt_item__EVT_additional_limit_max', 255 ),
828
-					!empty( $this->_req_data['additional_limit'] ) ? $this->_req_data['additional_limit'] : NULL ),
829
-			'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,
830
-			'EVT_member_only' => !empty( $this->_req_data['member_only'] ) ? 1 : 0,
831
-			'EVT_allow_overflow' => !empty( $this->_req_data['EVT_allow_overflow'] ) ? 1 : 0,
832
-			'EVT_timezone_string' => !empty( $this->_req_data['timezone_string'] ) ? $this->_req_data['timezone_string'] : NULL,
833
-			'EVT_external_URL' => !empty( $this->_req_data['externalURL'] ) ? $this->_req_data['externalURL'] : NULL,
834
-			'EVT_phone' => !empty( $this->_req_data['event_phone'] ) ? $this->_req_data['event_phone'] : NULL
827
+					apply_filters('FHEE__EE_Events_Admin__insert_update_cpt_item__EVT_additional_limit_max', 255),
828
+					! empty($this->_req_data['additional_limit']) ? $this->_req_data['additional_limit'] : NULL ),
829
+			'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,
830
+			'EVT_member_only' => ! empty($this->_req_data['member_only']) ? 1 : 0,
831
+			'EVT_allow_overflow' => ! empty($this->_req_data['EVT_allow_overflow']) ? 1 : 0,
832
+			'EVT_timezone_string' => ! empty($this->_req_data['timezone_string']) ? $this->_req_data['timezone_string'] : NULL,
833
+			'EVT_external_URL' => ! empty($this->_req_data['externalURL']) ? $this->_req_data['externalURL'] : NULL,
834
+			'EVT_phone' => ! empty($this->_req_data['event_phone']) ? $this->_req_data['event_phone'] : NULL
835 835
 			);
836 836
 
837 837
 		//update event
838
-		$success = $this->_event_model()->update_by_ID( $event_values, $post_id );
838
+		$success = $this->_event_model()->update_by_ID($event_values, $post_id);
839 839
 
840 840
 
841 841
 		//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!
842
-		$get_one_where = array( $this->_event_model()->primary_key_name() => $post_id, 'status' => $post->post_status );
843
-		$event = $this->_event_model()->get_one( array($get_one_where) );
842
+		$get_one_where = array($this->_event_model()->primary_key_name() => $post_id, 'status' => $post->post_status);
843
+		$event = $this->_event_model()->get_one(array($get_one_where));
844 844
 
845 845
 
846 846
 		//the following are default callbacks for event attachment updates that can be overridden by caffeinated functionality and/or addons.
847
-		$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') ) );
847
+		$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')));
848 848
 
849 849
 		$att_success = TRUE;
850 850
 
851
-		foreach ( $event_update_callbacks as $e_callback ) {
852
-			$_succ = call_user_func_array( $e_callback, array( $event,  $this->_req_data ) );
853
-			$att_success = !$att_success ? $att_success : $_succ; //if ANY of these updates fail then we want the appropriate global error message
851
+		foreach ($event_update_callbacks as $e_callback) {
852
+			$_succ = call_user_func_array($e_callback, array($event, $this->_req_data));
853
+			$att_success = ! $att_success ? $att_success : $_succ; //if ANY of these updates fail then we want the appropriate global error message
854 854
 		}
855 855
 
856 856
 		//any errors?
857
-		if ( $success && FALSE === $att_success ) {
858
-			EE_Error::add_error( esc_html__('Event Details saved successfully but something went wrong with saving attachments.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
859
-		} else if ( $success === FALSE ) {
860
-			EE_Error::add_error( esc_html__('Event Details did not save successfully.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
857
+		if ($success && FALSE === $att_success) {
858
+			EE_Error::add_error(esc_html__('Event Details saved successfully but something went wrong with saving attachments.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
859
+		} else if ($success === FALSE) {
860
+			EE_Error::add_error(esc_html__('Event Details did not save successfully.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
861 861
 		}
862 862
 	}
863 863
 
@@ -867,14 +867,14 @@  discard block
 block discarded – undo
867 867
 	/**
868 868
 	 * @see parent::restore_item()
869 869
 	 */
870
-	protected function _restore_cpt_item( $post_id, $revision_id ) {
870
+	protected function _restore_cpt_item($post_id, $revision_id) {
871 871
 		//copy existing event meta to new post
872 872
 		$post_evt = $this->_event_model()->get_one_by_ID($post_id);
873
-		if ( $post_evt instanceof EE_Event ) {
873
+		if ($post_evt instanceof EE_Event) {
874 874
 			//meta revision restore
875
-			$post_evt->restore_revision( $revision_id );
875
+			$post_evt->restore_revision($revision_id);
876 876
 			//related objs restore
877
-			$post_evt->restore_revision( $revision_id, array( 'Venue', 'Datetime', 'Price' ) );
877
+			$post_evt->restore_revision($revision_id, array('Venue', 'Datetime', 'Price'));
878 878
 		}
879 879
 	}
880 880
 
@@ -887,52 +887,52 @@  discard block
 block discarded – undo
887 887
 	 * @param  array  $data   The request data from the form
888 888
 	 * @return bool           Success or fail.
889 889
 	 */
890
-	protected function _default_venue_update( $evtobj, $data ) {
891
-		require_once( EE_MODELS . 'EEM_Venue.model.php' );
890
+	protected function _default_venue_update($evtobj, $data) {
891
+		require_once(EE_MODELS.'EEM_Venue.model.php');
892 892
 		$venue_model = EE_Registry::instance()->load_model('Venue');
893 893
 		$rows_affected = NULL;
894
-		$venue_id = !empty( $data['venue_id'] ) ? $data['venue_id'] : NULL;
894
+		$venue_id = ! empty($data['venue_id']) ? $data['venue_id'] : NULL;
895 895
 
896 896
 		// very important.  If we don't have a venue name...
897 897
 		// then we'll get out because not necessary to create empty venue
898
-		if ( empty( $data['venue_title'] ) ) {
898
+		if (empty($data['venue_title'])) {
899 899
 			return false;
900 900
 		}
901 901
 
902 902
 		$venue_array = array(
903 903
 				'VNU_wp_user' => $evtobj->get('EVT_wp_user'),
904
-				'VNU_name' => !empty( $data['venue_title'] ) ? $data['venue_title'] : NULL,
905
-				'VNU_desc' => !empty( $data['venue_description'] ) ? $data['venue_description'] : NULL,
906
-				'VNU_identifier' => !empty( $data['venue_identifier'] ) ? $data['venue_identifier'] : NULL,
907
-				'VNU_short_desc' => !empty( $data['venue_short_description'] ) ? $data['venue_short_description'] : NULL,
908
-				'VNU_address' => !empty( $data['address'] ) ? $data['address'] : NULL,
909
-				'VNU_address2' => !empty( $data['address2'] ) ? $data['address2'] : NULL,
910
-				'VNU_city' => !empty( $data['city'] ) ? $data['city'] : NULL,
911
-				'STA_ID' => !empty( $data['state'] ) ? $data['state'] : NULL,
912
-				'CNT_ISO' => !empty( $data['countries'] ) ? $data['countries'] : NULL,
913
-				'VNU_zip' => !empty( $data['zip'] ) ? $data['zip'] : NULL,
914
-				'VNU_phone' => !empty( $data['venue_phone'] ) ? $data['venue_phone'] : NULL,
915
-				'VNU_capacity' => !empty( $data['venue_capacity'] ) ? $data['venue_capacity'] : NULL,
916
-				'VNU_url' => !empty($data['venue_url'] ) ? $data['venue_url'] : NULL,
917
-				'VNU_virtual_phone' => !empty($data['virtual_phone']) ? $data['virtual_phone'] : NULL,
918
-				'VNU_virtual_url' => !empty( $data['virtual_url'] ) ? $data['virtual_url'] : NULL,
919
-				'VNU_enable_for_gmap' => isset( $data['enable_for_gmap'] ) ? 1 : 0,
904
+				'VNU_name' => ! empty($data['venue_title']) ? $data['venue_title'] : NULL,
905
+				'VNU_desc' => ! empty($data['venue_description']) ? $data['venue_description'] : NULL,
906
+				'VNU_identifier' => ! empty($data['venue_identifier']) ? $data['venue_identifier'] : NULL,
907
+				'VNU_short_desc' => ! empty($data['venue_short_description']) ? $data['venue_short_description'] : NULL,
908
+				'VNU_address' => ! empty($data['address']) ? $data['address'] : NULL,
909
+				'VNU_address2' => ! empty($data['address2']) ? $data['address2'] : NULL,
910
+				'VNU_city' => ! empty($data['city']) ? $data['city'] : NULL,
911
+				'STA_ID' => ! empty($data['state']) ? $data['state'] : NULL,
912
+				'CNT_ISO' => ! empty($data['countries']) ? $data['countries'] : NULL,
913
+				'VNU_zip' => ! empty($data['zip']) ? $data['zip'] : NULL,
914
+				'VNU_phone' => ! empty($data['venue_phone']) ? $data['venue_phone'] : NULL,
915
+				'VNU_capacity' => ! empty($data['venue_capacity']) ? $data['venue_capacity'] : NULL,
916
+				'VNU_url' => ! empty($data['venue_url']) ? $data['venue_url'] : NULL,
917
+				'VNU_virtual_phone' => ! empty($data['virtual_phone']) ? $data['virtual_phone'] : NULL,
918
+				'VNU_virtual_url' => ! empty($data['virtual_url']) ? $data['virtual_url'] : NULL,
919
+				'VNU_enable_for_gmap' => isset($data['enable_for_gmap']) ? 1 : 0,
920 920
 				'status' => 'publish'
921 921
 			);
922 922
 
923 923
 
924 924
 		//if we've got the venue_id then we're just updating the existing venue so let's do that and then get out.
925
-		if ( !empty( $venue_id ) ) {
926
-			$update_where = array( $venue_model->primary_key_name() => $venue_id );
927
-			$rows_affected = $venue_model->update( $venue_array, array( $update_where ) );
925
+		if ( ! empty($venue_id)) {
926
+			$update_where = array($venue_model->primary_key_name() => $venue_id);
927
+			$rows_affected = $venue_model->update($venue_array, array($update_where));
928 928
 			//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.
929
-			$evtobj->_add_relation_to( $venue_id, 'Venue' );
929
+			$evtobj->_add_relation_to($venue_id, 'Venue');
930 930
 			return $rows_affected > 0 ? TRUE : FALSE;
931 931
 		} else {
932 932
 			//we insert the venue
933
-			$venue_id = $venue_model->insert( $venue_array );
934
-			$evtobj->_add_relation_to( $venue_id, 'Venue' );
935
-			return !empty( $venue_id ) ? TRUE : FALSE;
933
+			$venue_id = $venue_model->insert($venue_array);
934
+			$evtobj->_add_relation_to($venue_id, 'Venue');
935
+			return ! empty($venue_id) ? TRUE : FALSE;
936 936
 		}
937 937
 		//when we have the ancestor come in it's already been handled by the revision save.
938 938
 	}
@@ -946,54 +946,54 @@  discard block
 block discarded – undo
946 946
 	 * @param  array    $data   The request data from the form
947 947
 	 * @return bool             success or fail
948 948
 	 */
949
-	protected function _default_tickets_update( EE_Event $evtobj, $data ) {
949
+	protected function _default_tickets_update(EE_Event $evtobj, $data) {
950 950
 		$success = true;
951 951
 		$saved_dtt = null;
952 952
 		$saved_tickets = array();
953
-		$incoming_date_formats = array( 'Y-m-d', 'h:i a' );
953
+		$incoming_date_formats = array('Y-m-d', 'h:i a');
954 954
 
955
-		foreach ( $data['edit_event_datetimes'] as $row => $dtt ) {
955
+		foreach ($data['edit_event_datetimes'] as $row => $dtt) {
956 956
 			//trim all values to ensure any excess whitespace is removed.
957
-			$dtt =  array_map( 'trim', $dtt );
958
-			$dtt['DTT_EVT_end'] = isset($dtt['DTT_EVT_end']) && ! empty( $dtt['DTT_EVT_end'] ) ? $dtt['DTT_EVT_end'] : $dtt['DTT_EVT_start'];
957
+			$dtt = array_map('trim', $dtt);
958
+			$dtt['DTT_EVT_end'] = isset($dtt['DTT_EVT_end']) && ! empty($dtt['DTT_EVT_end']) ? $dtt['DTT_EVT_end'] : $dtt['DTT_EVT_start'];
959 959
 			$datetime_values = array(
960
-				'DTT_ID' 		=> ! empty( $dtt['DTT_ID'] ) ? $dtt['DTT_ID'] : NULL,
960
+				'DTT_ID' 		=> ! empty($dtt['DTT_ID']) ? $dtt['DTT_ID'] : NULL,
961 961
 				'DTT_EVT_start' => $dtt['DTT_EVT_start'],
962 962
 				'DTT_EVT_end' 	=> $dtt['DTT_EVT_end'],
963
-				'DTT_reg_limit' => empty( $dtt['DTT_reg_limit'] ) ? EE_INF : $dtt['DTT_reg_limit'],
963
+				'DTT_reg_limit' => empty($dtt['DTT_reg_limit']) ? EE_INF : $dtt['DTT_reg_limit'],
964 964
 				'DTT_order' 	=> $row,
965 965
 			);
966 966
 
967 967
 			//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.
968 968
 
969
-			if ( !empty( $dtt['DTT_ID'] ) ) {
970
-				$DTM = EE_Registry::instance()->load_model('Datetime', array( $evtobj->get_timezone() ) )->get_one_by_ID($dtt['DTT_ID'] );
971
-				$DTM->set_date_format( $incoming_date_formats[0] );
972
-				$DTM->set_time_format( $incoming_date_formats[1] );
973
-				foreach ( $datetime_values as $field => $value ) {
974
-					$DTM->set( $field, $value );
969
+			if ( ! empty($dtt['DTT_ID'])) {
970
+				$DTM = EE_Registry::instance()->load_model('Datetime', array($evtobj->get_timezone()))->get_one_by_ID($dtt['DTT_ID']);
971
+				$DTM->set_date_format($incoming_date_formats[0]);
972
+				$DTM->set_time_format($incoming_date_formats[1]);
973
+				foreach ($datetime_values as $field => $value) {
974
+					$DTM->set($field, $value);
975 975
 				}
976 976
 
977 977
 				//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.
978 978
 				$saved_dtts[$DTM->ID()] = $DTM;
979 979
 			} else {
980
-				$DTM = EE_Registry::instance()->load_class('Datetime', array( $datetime_values ), FALSE, FALSE );
981
-				$DTM->set_date_format( $incoming_date_formats[0] );
982
-				$DTM->set_time_format( $incoming_date_formats[1] );
983
-				$DTM->set_timezone( $evtobj->get_timezone() );
984
-				foreach ( $datetime_values as $field => $value ) {
985
-					$DTM->set( $field, $value );
980
+				$DTM = EE_Registry::instance()->load_class('Datetime', array($datetime_values), FALSE, FALSE);
981
+				$DTM->set_date_format($incoming_date_formats[0]);
982
+				$DTM->set_time_format($incoming_date_formats[1]);
983
+				$DTM->set_timezone($evtobj->get_timezone());
984
+				foreach ($datetime_values as $field => $value) {
985
+					$DTM->set($field, $value);
986 986
 				}
987 987
 			}
988 988
 			$DTM->save();
989 989
 
990
-			$DTT = $evtobj->_add_relation_to( $DTM, 'Datetime' );
990
+			$DTT = $evtobj->_add_relation_to($DTM, 'Datetime');
991 991
 
992 992
 			//load DTT helper
993 993
 
994 994
 			//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.
995
-			if( $DTT->get_raw('DTT_EVT_start') > $DTT->get_raw('DTT_EVT_end') ) {
996
-				$DTT->set('DTT_EVT_end', $DTT->get('DTT_EVT_start') );
995
+			if ($DTT->get_raw('DTT_EVT_start') > $DTT->get_raw('DTT_EVT_end')) {
996
+				$DTT->set('DTT_EVT_end', $DTT->get('DTT_EVT_start'));
997 997
 				$DTT = EEH_DTT_Helper::date_time_add($DTT, 'DTT_EVT_end', 'days');
998 998
 				$DTT->save();
999 999
 			}
@@ -1001,45 +1001,45 @@  discard block
 block discarded – undo
1001 1001
 			//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.
1002 1002
 			$saved_dtt = $DTT;
1003 1003
 
1004
-			$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.
1004
+			$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.
1005 1005
 		}
1006 1006
 
1007 1007
 		//no dtts get deleted so we don't do any of that logic here.
1008 1008
 		//update tickets next
1009
-		$old_tickets = isset( $data['ticket_IDs'] ) ? explode(',', $data['ticket_IDs'] ) : array();
1010
-		foreach ( $data['edit_tickets'] as $row => $tkt ) {
1011
-			$incoming_date_formats = array( 'Y-m-d', 'h:i a' );
1009
+		$old_tickets = isset($data['ticket_IDs']) ? explode(',', $data['ticket_IDs']) : array();
1010
+		foreach ($data['edit_tickets'] as $row => $tkt) {
1011
+			$incoming_date_formats = array('Y-m-d', 'h:i a');
1012 1012
 			$update_prices = false;
1013
-			$ticket_price = isset( $data['edit_prices'][$row][1]['PRC_amount'] ) ? $data['edit_prices'][$row][1]['PRC_amount'] : 0;
1013
+			$ticket_price = isset($data['edit_prices'][$row][1]['PRC_amount']) ? $data['edit_prices'][$row][1]['PRC_amount'] : 0;
1014 1014
 
1015 1015
 			// trim inputs to ensure any excess whitespace is removed.
1016
-			$tkt = array_map( 'trim', $tkt );
1016
+			$tkt = array_map('trim', $tkt);
1017 1017
 
1018
-			if ( empty( $tkt['TKT_start_date'] ) ) {
1018
+			if (empty($tkt['TKT_start_date'])) {
1019 1019
 				//let's use now in the set timezone.
1020
-				$now = new DateTime( 'now', new DateTimeZone( $evtobj->get_timezone() ) );
1021
-				$tkt['TKT_start_date'] = $now->format( $incoming_date_formats[0] . ' ' . $incoming_date_formats[1] );
1020
+				$now = new DateTime('now', new DateTimeZone($evtobj->get_timezone()));
1021
+				$tkt['TKT_start_date'] = $now->format($incoming_date_formats[0].' '.$incoming_date_formats[1]);
1022 1022
 			}
1023 1023
 
1024
-			if ( empty( $tkt['TKT_end_date'] ) ) {
1024
+			if (empty($tkt['TKT_end_date'])) {
1025 1025
 				//use the start date of the first datetime
1026 1026
 				$dtt = $evtobj->first_datetime();
1027
-				$tkt['TKT_end_date'] = $dtt->start_date_and_time( $incoming_date_formats[0], $incoming_date_formats[1] );
1027
+				$tkt['TKT_end_date'] = $dtt->start_date_and_time($incoming_date_formats[0], $incoming_date_formats[1]);
1028 1028
 			}
1029 1029
 
1030 1030
 			$TKT_values = array(
1031
-				'TKT_ID' 			=> !empty( $tkt['TKT_ID'] ) ? $tkt['TKT_ID'] : NULL,
1032
-				'TTM_ID' 			=> !empty( $tkt['TTM_ID'] ) ? $tkt['TTM_ID'] : 0,
1033
-				'TKT_name' 			=> !empty( $tkt['TKT_name'] ) ? $tkt['TKT_name'] : '',
1034
-				'TKT_description' 	=> !empty( $tkt['TKT_description'] ) ? $tkt['TKT_description'] : '',
1031
+				'TKT_ID' 			=> ! empty($tkt['TKT_ID']) ? $tkt['TKT_ID'] : NULL,
1032
+				'TTM_ID' 			=> ! empty($tkt['TTM_ID']) ? $tkt['TTM_ID'] : 0,
1033
+				'TKT_name' 			=> ! empty($tkt['TKT_name']) ? $tkt['TKT_name'] : '',
1034
+				'TKT_description' 	=> ! empty($tkt['TKT_description']) ? $tkt['TKT_description'] : '',
1035 1035
 				'TKT_start_date' 	=> $tkt['TKT_start_date'],
1036 1036
 				'TKT_end_date' 		=> $tkt['TKT_end_date'],
1037
-				'TKT_qty' 			=> ! isset( $tkt[ 'TKT_qty' ] ) || $tkt[ 'TKT_qty' ] === '' ? EE_INF : $tkt['TKT_qty'],
1038
-				'TKT_uses' 			=> ! isset( $tkt[ 'TKT_uses' ] ) || $tkt[ 'TKT_uses' ] === '' ? EE_INF : $tkt[ 'TKT_uses' ],
1039
-				'TKT_min' 			=> empty( $tkt['TKT_min'] ) ? 0 : $tkt['TKT_min'],
1040
-				'TKT_max' 			=> empty( $tkt['TKT_max'] ) ? EE_INF : $tkt['TKT_max'],
1037
+				'TKT_qty' 			=> ! isset($tkt['TKT_qty']) || $tkt['TKT_qty'] === '' ? EE_INF : $tkt['TKT_qty'],
1038
+				'TKT_uses' 			=> ! isset($tkt['TKT_uses']) || $tkt['TKT_uses'] === '' ? EE_INF : $tkt['TKT_uses'],
1039
+				'TKT_min' 			=> empty($tkt['TKT_min']) ? 0 : $tkt['TKT_min'],
1040
+				'TKT_max' 			=> empty($tkt['TKT_max']) ? EE_INF : $tkt['TKT_max'],
1041 1041
 				'TKT_row' 			=> $row,
1042
-				'TKT_order' 		=> isset( $tkt['TKT_order'] ) ? $tkt['TKT_order'] : $row,
1042
+				'TKT_order' 		=> isset($tkt['TKT_order']) ? $tkt['TKT_order'] : $row,
1043 1043
 				'TKT_price' 		=> $ticket_price
1044 1044
 			);
1045 1045
 
@@ -1047,7 +1047,7 @@  discard block
 block discarded – undo
1047 1047
 
1048 1048
 
1049 1049
 			//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.
1050
-			if ( isset( $tkt['TKT_is_default'] ) && $tkt['TKT_is_default'] ) {
1050
+			if (isset($tkt['TKT_is_default']) && $tkt['TKT_is_default']) {
1051 1051
 				$TKT_values['TKT_ID'] = 0;
1052 1052
 				$TKT_values['TKT_is_default'] = 0;
1053 1053
 				$TKT_values['TKT_price'] = $ticket_price;
@@ -1058,58 +1058,58 @@  discard block
 block discarded – undo
1058 1058
 			//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.
1059 1059
 			//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.
1060 1060
 
1061
-			if ( !empty( $tkt['TKT_ID'] ) ) {
1062
-				$TKT = EE_Registry::instance()->load_model( 'Ticket', array( $evtobj->get_timezone() ) )->get_one_by_ID( $tkt['TKT_ID'] );
1063
-				if ( $TKT instanceof EE_Ticket ) {
1064
-					$ticket_sold = $TKT->count_related( 'Registration', array( array( 'STS_ID' => array( 'NOT IN', array( EEM_Registration::status_id_incomplete ) ) ) ) ) > 0 ? true : false;
1061
+			if ( ! empty($tkt['TKT_ID'])) {
1062
+				$TKT = EE_Registry::instance()->load_model('Ticket', array($evtobj->get_timezone()))->get_one_by_ID($tkt['TKT_ID']);
1063
+				if ($TKT instanceof EE_Ticket) {
1064
+					$ticket_sold = $TKT->count_related('Registration', array(array('STS_ID' => array('NOT IN', array(EEM_Registration::status_id_incomplete))))) > 0 ? true : false;
1065 1065
 					//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.
1066
-					$create_new_TKT = $ticket_sold && $ticket_price != $TKT->get( 'TKT_price' ) && ! $TKT->get( 'TKT_deleted' ) ? true : false;
1067
-					$TKT->set_date_format( $incoming_date_formats[ 0 ] );
1068
-					$TKT->set_time_format( $incoming_date_formats[ 1 ] );
1066
+					$create_new_TKT = $ticket_sold && $ticket_price != $TKT->get('TKT_price') && ! $TKT->get('TKT_deleted') ? true : false;
1067
+					$TKT->set_date_format($incoming_date_formats[0]);
1068
+					$TKT->set_time_format($incoming_date_formats[1]);
1069 1069
 					//set new values
1070
-					foreach ( $TKT_values as $field => $value ) {
1071
-						if ( $field == 'TKT_qty' ) {
1072
-							$TKT->set_qty( $value );
1070
+					foreach ($TKT_values as $field => $value) {
1071
+						if ($field == 'TKT_qty') {
1072
+							$TKT->set_qty($value);
1073 1073
 						} else {
1074
-							$TKT->set( $field, $value );
1074
+							$TKT->set($field, $value);
1075 1075
 						}
1076 1076
 					}
1077 1077
 					//if $create_new_TKT is false then we can safely update the existing ticket.  Otherwise we have to create a new ticket.
1078
-					if ( $create_new_TKT ) {
1078
+					if ($create_new_TKT) {
1079 1079
 						//archive the old ticket first
1080
-						$TKT->set( 'TKT_deleted', 1 );
1080
+						$TKT->set('TKT_deleted', 1);
1081 1081
 						$TKT->save();
1082 1082
 						//make sure this ticket is still recorded in our saved_tkts so we don't run it through the regular trash routine.
1083
-						$saved_tickets[ $TKT->ID() ] = $TKT;
1083
+						$saved_tickets[$TKT->ID()] = $TKT;
1084 1084
 						//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.
1085 1085
 						$TKT = clone $TKT;
1086
-						$TKT->set( 'TKT_ID', 0 );
1087
-						$TKT->set( 'TKT_deleted', 0 );
1088
-						$TKT->set( 'TKT_price', $ticket_price );
1089
-						$TKT->set( 'TKT_sold', 0 );
1086
+						$TKT->set('TKT_ID', 0);
1087
+						$TKT->set('TKT_deleted', 0);
1088
+						$TKT->set('TKT_price', $ticket_price);
1089
+						$TKT->set('TKT_sold', 0);
1090 1090
 						//now we need to make sure that $new prices are created as well and attached to new ticket.
1091 1091
 						$update_prices = true;
1092 1092
 					}
1093 1093
 					//make sure price is set if it hasn't been already
1094
-					$TKT->set( 'TKT_price', $ticket_price );
1094
+					$TKT->set('TKT_price', $ticket_price);
1095 1095
 				}
1096 1096
 
1097 1097
 			} else {
1098 1098
 				//no TKT_id so a new TKT
1099 1099
 				$TKT_values['TKT_price'] = $ticket_price;
1100
-				$TKT = EE_Registry::instance()->load_class('Ticket', array( $TKT_values ), FALSE, FALSE );
1101
-				if ( $TKT instanceof EE_Ticket ) {
1100
+				$TKT = EE_Registry::instance()->load_class('Ticket', array($TKT_values), FALSE, FALSE);
1101
+				if ($TKT instanceof EE_Ticket) {
1102 1102
 					//need to reset values to properly account for the date formats
1103
-					$TKT->set_date_format( $incoming_date_formats[0] );
1104
-					$TKT->set_time_format( $incoming_date_formats[1] );
1105
-					$TKT->set_timezone( $evtobj->get_timezone() );
1103
+					$TKT->set_date_format($incoming_date_formats[0]);
1104
+					$TKT->set_time_format($incoming_date_formats[1]);
1105
+					$TKT->set_timezone($evtobj->get_timezone());
1106 1106
 
1107 1107
 					//set new values
1108
-					foreach ( $TKT_values as $field => $value ) {
1109
-						if ( $field == 'TKT_qty' ) {
1110
-							$TKT->set_qty( $value );
1108
+					foreach ($TKT_values as $field => $value) {
1109
+						if ($field == 'TKT_qty') {
1110
+							$TKT->set_qty($value);
1111 1111
 						} else {
1112
-							$TKT->set( $field, $value );
1112
+							$TKT->set($field, $value);
1113 1113
 						}
1114 1114
 					}
1115 1115
 
@@ -1117,31 +1117,31 @@  discard block
 block discarded – undo
1117 1117
 				}
1118 1118
 			}
1119 1119
 			// cap ticket qty by datetime reg limits
1120
-			$TKT->set_qty( min( $TKT->qty(), $TKT->qty( 'reg_limit' ) ) );
1120
+			$TKT->set_qty(min($TKT->qty(), $TKT->qty('reg_limit')));
1121 1121
 			//update ticket.
1122 1122
 			$TKT->save();
1123 1123
 
1124 1124
 			//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.
1125
-			if( $TKT->get_raw('TKT_start_date') > $TKT->get_raw('TKT_end_date') ) {
1126
-				$TKT->set('TKT_end_date', $TKT->get('TKT_start_date') );
1125
+			if ($TKT->get_raw('TKT_start_date') > $TKT->get_raw('TKT_end_date')) {
1126
+				$TKT->set('TKT_end_date', $TKT->get('TKT_start_date'));
1127 1127
 				$TKT = EEH_DTT_Helper::date_time_add($TKT, 'TKT_end_date', 'days');
1128 1128
 				$TKT->save();
1129 1129
 			}
1130 1130
 
1131 1131
 			//initially let's add the ticket to the dtt
1132
-			$saved_dtt->_add_relation_to( $TKT, 'Ticket' );
1132
+			$saved_dtt->_add_relation_to($TKT, 'Ticket');
1133 1133
 
1134 1134
 			$saved_tickets[$TKT->ID()] = $TKT;
1135 1135
 
1136 1136
 			//add prices to ticket
1137
-			$this->_add_prices_to_ticket( $data['edit_prices'][$row], $TKT, $update_prices );
1137
+			$this->_add_prices_to_ticket($data['edit_prices'][$row], $TKT, $update_prices);
1138 1138
 		}
1139 1139
 		//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.
1140
-		$old_tickets = isset( $old_tickets[0] ) && $old_tickets[0] == '' ? array() : $old_tickets;
1141
-		$tickets_removed = array_diff( $old_tickets, array_keys( $saved_tickets ) );
1140
+		$old_tickets = isset($old_tickets[0]) && $old_tickets[0] == '' ? array() : $old_tickets;
1141
+		$tickets_removed = array_diff($old_tickets, array_keys($saved_tickets));
1142 1142
 
1143
-		foreach ( $tickets_removed as $id ) {
1144
-			$id = absint( $id );
1143
+		foreach ($tickets_removed as $id) {
1144
+			$id = absint($id);
1145 1145
 
1146 1146
 			//get the ticket for this id
1147 1147
 			$tkt_to_remove = EE_Registry::instance()->load_model('Ticket')->get_one_by_ID($id);
@@ -1149,7 +1149,7 @@  discard block
 block discarded – undo
1149 1149
 			//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)
1150 1150
 			$dtts = $tkt_to_remove->get_many_related('Datetime');
1151 1151
 
1152
-			foreach( $dtts as $dtt ) {
1152
+			foreach ($dtts as $dtt) {
1153 1153
 				$tkt_to_remove->_remove_relation_to($dtt, 'Datetime');
1154 1154
 			}
1155 1155
 
@@ -1160,7 +1160,7 @@  discard block
 block discarded – undo
1160 1160
 			//finally let's delete this ticket (which should not be blocked at this point b/c we've removed all our relationships)
1161 1161
 			$tkt_to_remove->delete_permanently();
1162 1162
 		}
1163
-		return array( $saved_dtt, $saved_tickets );
1163
+		return array($saved_dtt, $saved_tickets);
1164 1164
 	}
1165 1165
 
1166 1166
 
@@ -1175,31 +1175,31 @@  discard block
 block discarded – undo
1175 1175
 	 * @param bool 		$new_prices Whether attach existing incoming prices or create new ones.
1176 1176
 	 * @return  void
1177 1177
 	 */
1178
-	private function  _add_prices_to_ticket( $prices, EE_Ticket $ticket, $new_prices = FALSE ) {
1179
-		foreach ( $prices as $row => $prc ) {
1178
+	private function  _add_prices_to_ticket($prices, EE_Ticket $ticket, $new_prices = FALSE) {
1179
+		foreach ($prices as $row => $prc) {
1180 1180
 			$PRC_values = array(
1181
-				'PRC_ID' => !empty( $prc['PRC_ID'] ) ? $prc['PRC_ID'] : NULL,
1182
-				'PRT_ID' => !empty( $prc['PRT_ID'] ) ? $prc['PRT_ID'] : NULL,
1183
-				'PRC_amount' => !empty( $prc['PRC_amount'] ) ? $prc['PRC_amount'] : 0,
1184
-				'PRC_name' => !empty( $prc['PRC_name'] ) ? $prc['PRC_name'] : '',
1185
-				'PRC_desc' => !empty( $prc['PRC_desc'] ) ? $prc['PRC_desc'] : '',
1181
+				'PRC_ID' => ! empty($prc['PRC_ID']) ? $prc['PRC_ID'] : NULL,
1182
+				'PRT_ID' => ! empty($prc['PRT_ID']) ? $prc['PRT_ID'] : NULL,
1183
+				'PRC_amount' => ! empty($prc['PRC_amount']) ? $prc['PRC_amount'] : 0,
1184
+				'PRC_name' => ! empty($prc['PRC_name']) ? $prc['PRC_name'] : '',
1185
+				'PRC_desc' => ! empty($prc['PRC_desc']) ? $prc['PRC_desc'] : '',
1186 1186
 				'PRC_is_default' => 0, //make sure prices are NOT set as default from this context
1187 1187
 				'PRC_order' => $row
1188 1188
 			);
1189 1189
 
1190
-			if ( $new_prices || empty( $PRC_values['PRC_ID'] ) ) {
1190
+			if ($new_prices || empty($PRC_values['PRC_ID'])) {
1191 1191
 				$PRC_values['PRC_ID'] = 0;
1192
-				$PRC = EE_Registry::instance()->load_class('Price', array( $PRC_values ), FALSE, FALSE);
1192
+				$PRC = EE_Registry::instance()->load_class('Price', array($PRC_values), FALSE, FALSE);
1193 1193
 			} else {
1194
-				$PRC = EE_Registry::instance()->load_model( 'Price' )->get_one_by_ID( $prc['PRC_ID'] );
1194
+				$PRC = EE_Registry::instance()->load_model('Price')->get_one_by_ID($prc['PRC_ID']);
1195 1195
 				//update this price with new values
1196
-				foreach ( $PRC_values as $field => $newprc ) {
1197
-					$PRC->set( $field, $newprc );
1196
+				foreach ($PRC_values as $field => $newprc) {
1197
+					$PRC->set($field, $newprc);
1198 1198
 				}
1199 1199
 				$PRC->save();
1200 1200
 			}
1201 1201
 
1202
-			$ticket->_add_relation_to( $PRC, 'Price' );
1202
+			$ticket->_add_relation_to($PRC, 'Price');
1203 1203
 		}
1204 1204
 	}
1205 1205
 
@@ -1237,9 +1237,9 @@  discard block
 block discarded – undo
1237 1237
 		//load formatter helper
1238 1238
 
1239 1239
   		//args for getting related registrations
1240
-  		$approved_query_args = array( array( 'REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_approved ) );
1241
-  		$not_approved_query_args = array( array( 'REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_not_approved ) );
1242
-  		$pending_payment_query_args = array( array( 'REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_pending_payment ) );
1240
+  		$approved_query_args = array(array('REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_approved));
1241
+  		$not_approved_query_args = array(array('REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_not_approved));
1242
+  		$pending_payment_query_args = array(array('REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_pending_payment));
1243 1243
 
1244 1244
 
1245 1245
 		// publish box
@@ -1268,9 +1268,9 @@  discard block
 block discarded – undo
1268 1268
 				),
1269 1269
 				REG_ADMIN_URL
1270 1270
 			),
1271
-			'approved_regs' => $this->_cpt_model_obj->count_related( 'Registration', $approved_query_args ),
1272
-			'not_approved_regs' => $this->_cpt_model_obj->count_related( 'Registration', $not_approved_query_args ),
1273
-			'pending_payment_regs' => $this->_cpt_model_obj->count_related( 'Registration', $pending_payment_query_args ),
1271
+			'approved_regs' => $this->_cpt_model_obj->count_related('Registration', $approved_query_args),
1272
+			'not_approved_regs' => $this->_cpt_model_obj->count_related('Registration', $not_approved_query_args),
1273
+			'pending_payment_regs' => $this->_cpt_model_obj->count_related('Registration', $pending_payment_query_args),
1274 1274
 			'misc_pub_section_class' => apply_filters(
1275 1275
 				'FHEE_Events_Admin_Page___generate_publish_box_extra_content__misc_pub_section_class',
1276 1276
 				'misc-pub-section'
@@ -1289,9 +1289,9 @@  discard block
 block discarded – undo
1289 1289
 			'AHEE__Events_Admin_Page___generate_publish_box_extra_content__event_editor_overview_add',
1290 1290
 			$this->_cpt_model_obj
1291 1291
 		);
1292
-		$publish_box_extra_args[ 'event_editor_overview_add' ] = ob_get_clean();
1292
+		$publish_box_extra_args['event_editor_overview_add'] = ob_get_clean();
1293 1293
 		// load template
1294
-		EEH_Template::display_template( EVENTS_TEMPLATE_PATH . 'event_publish_box_extras.template.php', $publish_box_extra_args );
1294
+		EEH_Template::display_template(EVENTS_TEMPLATE_PATH.'event_publish_box_extras.template.php', $publish_box_extra_args);
1295 1295
 	}
1296 1296
 
1297 1297
 
@@ -1323,16 +1323,16 @@  discard block
 block discarded – undo
1323 1323
 		$this->verify_cpt_object();
1324 1324
 		add_meta_box(
1325 1325
 			'espresso_event_editor_tickets',
1326
-			esc_html__( 'Event Datetime & Ticket', 'event_espresso' ),
1327
-			array( $this, 'ticket_metabox' ),
1326
+			esc_html__('Event Datetime & Ticket', 'event_espresso'),
1327
+			array($this, 'ticket_metabox'),
1328 1328
 			$this->page_slug,
1329 1329
 			'normal',
1330 1330
 			'high'
1331 1331
 		);
1332 1332
 		add_meta_box(
1333 1333
 			'espresso_event_editor_event_options',
1334
-			esc_html__( 'Event Registration Options', 'event_espresso' ),
1335
-			array( $this, 'registration_options_meta_box' ),
1334
+			esc_html__('Event Registration Options', 'event_espresso'),
1335
+			array($this, 'registration_options_meta_box'),
1336 1336
 			$this->page_slug,
1337 1337
 			'side',
1338 1338
 			'default'
@@ -1362,36 +1362,36 @@  discard block
 block discarded – undo
1362 1362
 			'disabled' => ''
1363 1363
 			);
1364 1364
 
1365
-		$event_id = is_object( $this->_cpt_model_obj ) ? $this->_cpt_model_obj->ID() : NULL;
1365
+		$event_id = is_object($this->_cpt_model_obj) ? $this->_cpt_model_obj->ID() : NULL;
1366 1366
 
1367
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
1367
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1368 1368
 
1369 1369
 		/**
1370 1370
 		 * 1. Start with retrieving Datetimes
1371 1371
 		 * 2. Fore each datetime get related tickets
1372 1372
 		 * 3. For each ticket get related prices
1373 1373
 		 */
1374
-		$times = EE_Registry::instance()->load_model('Datetime' )->get_all_event_dates( $event_id );
1374
+		$times = EE_Registry::instance()->load_model('Datetime')->get_all_event_dates($event_id);
1375 1375
 		/** @type EE_Datetime $first_datetime */
1376
-		$first_datetime = reset( $times );
1376
+		$first_datetime = reset($times);
1377 1377
 		//do we get related tickets?
1378
-		if ( $first_datetime instanceof EE_Datetime
1379
-			&& $first_datetime->ID() !== 0 ) {
1378
+		if ($first_datetime instanceof EE_Datetime
1379
+			&& $first_datetime->ID() !== 0) {
1380 1380
 			$existing_datetime_ids[] = $first_datetime->get('DTT_ID');
1381 1381
 			$template_args['time'] = $first_datetime;
1382 1382
 			$related_tickets = $first_datetime->tickets(
1383 1383
 				array(
1384
-					array( 'OR' => array( 'TKT_deleted' => 1, 'TKT_deleted*' => 0 ) ),
1384
+					array('OR' => array('TKT_deleted' => 1, 'TKT_deleted*' => 0)),
1385 1385
 					'default_where_conditions' => 'none'
1386 1386
 				)
1387 1387
 			);
1388 1388
 
1389
-			if ( !empty($related_tickets) ) {
1389
+			if ( ! empty($related_tickets)) {
1390 1390
 				$template_args['total_ticket_rows'] = count($related_tickets);
1391 1391
 				$row = 0;
1392
-				foreach ( $related_tickets as $ticket ) {
1392
+				foreach ($related_tickets as $ticket) {
1393 1393
 					$existing_ticket_ids[] = $ticket->get('TKT_ID');
1394
-					$template_args['ticket_rows'] .= $this->_get_ticket_row($ticket, FALSE, $row );
1394
+					$template_args['ticket_rows'] .= $this->_get_ticket_row($ticket, FALSE, $row);
1395 1395
 
1396 1396
 					$row++;
1397 1397
 				}
@@ -1399,13 +1399,13 @@  discard block
 block discarded – undo
1399 1399
 				$template_args['total_ticket_rows'] = 1;
1400 1400
 				/** @type EE_Ticket $ticket */
1401 1401
 				$ticket = EE_Registry::instance()->load_model('Ticket')->create_default_object();
1402
-				$template_args['ticket_rows'] .= $this->_get_ticket_row( $ticket );
1402
+				$template_args['ticket_rows'] .= $this->_get_ticket_row($ticket);
1403 1403
 			}
1404 1404
 		} else {
1405 1405
 			$template_args['time'] = $times[0];
1406 1406
 			/** @type EE_Ticket $ticket */
1407 1407
 			$ticket = EE_Registry::instance()->load_model('Ticket')->get_all_default_tickets();
1408
-			$template_args['ticket_rows'] .= $this->_get_ticket_row( $ticket[1] );
1408
+			$template_args['ticket_rows'] .= $this->_get_ticket_row($ticket[1]);
1409 1409
 			// NOTE: we're just sending the first default row
1410 1410
 			// (decaf can't manage default tickets so this should be sufficient);
1411 1411
 		}
@@ -1414,8 +1414,8 @@  discard block
 block discarded – undo
1414 1414
 		$template_args['ticket_options_help_link'] = $this->_get_help_tab_link('ticket_options_info');
1415 1415
 		$template_args['existing_datetime_ids'] = implode(',', $existing_datetime_ids);
1416 1416
 		$template_args['existing_ticket_ids'] = implode(',', $existing_ticket_ids);
1417
-		$template_args['ticket_js_structure'] = $this->_get_ticket_row( EE_Registry::instance()->load_model('Ticket')->create_default_object(), TRUE );
1418
-		$template = apply_filters( 'FHEE__Events_Admin_Page__ticket_metabox__template', EVENTS_TEMPLATE_PATH . 'event_tickets_metabox_main.template.php' );
1417
+		$template_args['ticket_js_structure'] = $this->_get_ticket_row(EE_Registry::instance()->load_model('Ticket')->create_default_object(), TRUE);
1418
+		$template = apply_filters('FHEE__Events_Admin_Page__ticket_metabox__template', EVENTS_TEMPLATE_PATH.'event_tickets_metabox_main.template.php');
1419 1419
 		EEH_Template::display_template($template, $template_args);
1420 1420
 	}
1421 1421
 
@@ -1430,21 +1430,21 @@  discard block
 block discarded – undo
1430 1430
 	 * @param int        $row
1431 1431
 	 * @return string generated html for the ticket row.
1432 1432
 	 */
1433
-	private function _get_ticket_row( $ticket, $skeleton = FALSE, $row = 0 ) {
1433
+	private function _get_ticket_row($ticket, $skeleton = FALSE, $row = 0) {
1434 1434
 		$template_args = array(
1435
-			'tkt_status_class' => ' tkt-status-' . $ticket->ticket_status(),
1436
-			'tkt_archive_class' => $ticket->ticket_status() === EE_Ticket::archived && !$skeleton ? ' tkt-archived' : '',
1435
+			'tkt_status_class' => ' tkt-status-'.$ticket->ticket_status(),
1436
+			'tkt_archive_class' => $ticket->ticket_status() === EE_Ticket::archived && ! $skeleton ? ' tkt-archived' : '',
1437 1437
 			'ticketrow' => $skeleton ? 'TICKETNUM' : $row,
1438 1438
 			'TKT_ID' => $ticket->get('TKT_ID'),
1439 1439
 			'TKT_name' => $ticket->get('TKT_name'),
1440 1440
 			'TKT_start_date' => $skeleton ? '' : $ticket->get_date('TKT_start_date', 'Y-m-d h:i a'),
1441 1441
 			'TKT_end_date' => $skeleton ? '' : $ticket->get_date('TKT_end_date', 'Y-m-d h:i a'),
1442 1442
 			'TKT_is_default' => $ticket->get('TKT_is_default'),
1443
-			'TKT_qty' => $ticket->get_pretty('TKT_qty','input'),
1443
+			'TKT_qty' => $ticket->get_pretty('TKT_qty', 'input'),
1444 1444
 			'edit_ticketrow_name' => $skeleton ? 'TICKETNAMEATTR' : 'edit_tickets',
1445 1445
 			'TKT_sold' => $skeleton ? 0 : $ticket->get('TKT_sold'),
1446
-			'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',
1447
-			'disabled' => $skeleton || ( !empty( $ticket ) && ! $ticket->get('TKT_deleted' ) ) ? '' : ' disabled=disabled'
1446
+			'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',
1447
+			'disabled' => $skeleton || ( ! empty($ticket) && ! $ticket->get('TKT_deleted')) ? '' : ' disabled=disabled'
1448 1448
 			);
1449 1449
 
1450 1450
 		$price = $ticket->ID() !== 0 ? $ticket->get_first_related('Price', array('default_where_conditions' => 'none')) : EE_Registry::instance()->load_model('Price')->create_default_object();
@@ -1460,23 +1460,23 @@  discard block
 block discarded – undo
1460 1460
 
1461 1461
 		//make sure we have default start and end dates if skeleton
1462 1462
 		//handle rows that should NOT be empty
1463
-		if ( empty( $template_args['TKT_start_date'] ) ) {
1463
+		if (empty($template_args['TKT_start_date'])) {
1464 1464
 			//if empty then the start date will be now.
1465 1465
 			$template_args['TKT_start_date'] = date('Y-m-d h:i a', current_time('timestamp'));
1466 1466
 		}
1467 1467
 
1468
-		if ( empty( $template_args['TKT_end_date'] ) ) {
1468
+		if (empty($template_args['TKT_end_date'])) {
1469 1469
 			//get the earliest datetime (if present);
1470
-			$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;
1470
+			$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;
1471 1471
 
1472
-			if ( !empty( $earliest_dtt ) )
1472
+			if ( ! empty($earliest_dtt))
1473 1473
 				$template_args['TKT_end_date'] = $earliest_dtt->get_datetime('DTT_EVT_start', 'Y-m-d', 'h:i a');
1474 1474
 			else
1475
-				$template_args['TKT_end_date'] = date('Y-m-d h:i a', mktime(0, 0, 0, date("m"), date("d")+7, date("Y") ) );
1475
+				$template_args['TKT_end_date'] = date('Y-m-d h:i a', mktime(0, 0, 0, date("m"), date("d") + 7, date("Y")));
1476 1476
 		}
1477 1477
 
1478
-		$template_args = array_merge( $template_args, $price_args );
1479
-		$template = apply_filters( 'FHEE__Events_Admin_Page__get_ticket_row__template', EVENTS_TEMPLATE_PATH . 'event_tickets_metabox_ticket_row.template.php', $ticket);
1478
+		$template_args = array_merge($template_args, $price_args);
1479
+		$template = apply_filters('FHEE__Events_Admin_Page__get_ticket_row__template', EVENTS_TEMPLATE_PATH.'event_tickets_metabox_ticket_row.template.php', $ticket);
1480 1480
 		return EEH_Template::display_template($template, $template_args, TRUE);
1481 1481
 	}
1482 1482
 
@@ -1505,8 +1505,8 @@  discard block
 block discarded – undo
1505 1505
 		$template_args['default_registration_status'] = EEH_Form_Fields::select_input('default_reg_status', $default_reg_status_values, $this->_cpt_model_obj->default_registration_status());
1506 1506
 		$template_args['display_description'] = EEH_Form_Fields::select_input('display_desc', $yes_no_values, $this->_cpt_model_obj->display_description());
1507 1507
 		$template_args['display_ticket_selector'] = EEH_Form_Fields::select_input('display_ticket_selector', $yes_no_values, $this->_cpt_model_obj->display_ticket_selector(), '', '', false);
1508
-		$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 );
1509
-		$templatepath = EVENTS_TEMPLATE_PATH . 'event_registration_options.template.php';
1508
+		$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);
1509
+		$templatepath = EVENTS_TEMPLATE_PATH.'event_registration_options.template.php';
1510 1510
 		EEH_Template::display_template($templatepath, $template_args);
1511 1511
 	}
1512 1512
 
@@ -1534,21 +1534,21 @@  discard block
 block discarded – undo
1534 1534
 		$EEME = $this->_event_model();
1535 1535
 
1536 1536
 		$offset = ($current_page - 1) * $per_page;
1537
-		$limit = $count ? NULL : $offset . ',' . $per_page;
1537
+		$limit = $count ? NULL : $offset.','.$per_page;
1538 1538
 		$orderby = isset($this->_req_data['orderby']) ? $this->_req_data['orderby'] : 'EVT_ID';
1539 1539
 		$order = isset($this->_req_data['order']) ? $this->_req_data['order'] : "DESC";
1540 1540
 
1541 1541
 		if (isset($this->_req_data['month_range'])) {
1542 1542
 			$pieces = explode(' ', $this->_req_data['month_range'], 3);
1543
-			$month_r = !empty($pieces[0]) ? date('m', strtotime($pieces[0])) : '';
1544
-			$year_r = !empty($pieces[1]) ? $pieces[1] : '';
1543
+			$month_r = ! empty($pieces[0]) ? date('m', strtotime($pieces[0])) : '';
1544
+			$year_r = ! empty($pieces[1]) ? $pieces[1] : '';
1545 1545
 		}
1546 1546
 
1547 1547
 		$where = array();
1548 1548
 
1549
-		$status = isset( $this->_req_data['status'] ) ? $this->_req_data['status'] : NULL;
1549
+		$status = isset($this->_req_data['status']) ? $this->_req_data['status'] : NULL;
1550 1550
 		//determine what post_status our condition will have for the query.
1551
-		switch ( $status ) {
1551
+		switch ($status) {
1552 1552
 			case 'month' :
1553 1553
 			case 'today' :
1554 1554
 			case NULL :
@@ -1556,7 +1556,7 @@  discard block
 block discarded – undo
1556 1556
 				break;
1557 1557
 
1558 1558
 			case 'draft' :
1559
-				$where['status'] = array( 'IN', array('draft', 'auto-draft') );
1559
+				$where['status'] = array('IN', array('draft', 'auto-draft'));
1560 1560
 				break;
1561 1561
 
1562 1562
 			default :
@@ -1564,43 +1564,43 @@  discard block
 block discarded – undo
1564 1564
 		}
1565 1565
 
1566 1566
 		//categories?
1567
-		$category = isset( $this->_req_data['EVT_CAT'] ) && $this->_req_data['EVT_CAT'] > 0 ? $this->_req_data['EVT_CAT'] : NULL;
1567
+		$category = isset($this->_req_data['EVT_CAT']) && $this->_req_data['EVT_CAT'] > 0 ? $this->_req_data['EVT_CAT'] : NULL;
1568 1568
 
1569
-		if ( !empty ( $category ) ) {
1569
+		if ( ! empty ($category)) {
1570 1570
 			$where['Term_Taxonomy.taxonomy'] = 'espresso_event_categories';
1571 1571
 			$where['Term_Taxonomy.term_id'] = $category;
1572 1572
 		}
1573 1573
 
1574 1574
 		//date where conditions
1575
-		$start_formats = EEM_Datetime::instance()->get_formats_for( 'DTT_EVT_start' );
1575
+		$start_formats = EEM_Datetime::instance()->get_formats_for('DTT_EVT_start');
1576 1576
 		if (isset($this->_req_data['month_range']) && $this->_req_data['month_range'] != '') {
1577
-			$DateTime = new DateTime( $year_r . '-' . $month_r . '-01 00:00:00', new DateTimeZone( EEM_Datetime::instance()->get_timezone() ) );
1578
-			$start = $DateTime->format( implode( ' ', $start_formats  ) );
1579
-			$end = $DateTime->setDate( $year_r, $month_r, $DateTime->format('t') )->setTime(23,59,59)->format( implode( ' ', $start_formats ) );
1580
-			$where['Datetime.DTT_EVT_start'] = array('BETWEEN', array( $start, $end ) );
1577
+			$DateTime = new DateTime($year_r.'-'.$month_r.'-01 00:00:00', new DateTimeZone(EEM_Datetime::instance()->get_timezone()));
1578
+			$start = $DateTime->format(implode(' ', $start_formats));
1579
+			$end = $DateTime->setDate($year_r, $month_r, $DateTime->format('t'))->setTime(23, 59, 59)->format(implode(' ', $start_formats));
1580
+			$where['Datetime.DTT_EVT_start'] = array('BETWEEN', array($start, $end));
1581 1581
 		} else if (isset($this->_req_data['status']) && $this->_req_data['status'] == 'today') {
1582
-			$DateTime = new DateTime( 'now', new DateTimeZone( EEM_Event::instance()->get_timezone() ) );
1583
-			$start = $DateTime->setTime( 0,0,0 )->format( implode( ' ', $start_formats ) );
1584
-			$end = $DateTime->setTime( 23, 59, 59 )->format( implode( ' ', $start_formats ) );
1585
-			$where['Datetime.DTT_EVT_start'] = array( 'BETWEEN', array( $start, $end ) );
1586
-		} else if ( isset($this->_req_data['status']) && $this->_req_data['status'] == 'month' ) {
1587
-			$now = date( 'Y-m-01' );
1588
-			$DateTime = new DateTime( $now, new DateTimeZone( EEM_Event::instance()->get_timezone() ) );
1589
-			$start = $DateTime->setTime( 0, 0, 0 )->format( implode( ' ', $start_formats ) );
1590
-			$end = $DateTime->setDate( date('Y'), date('m'), $DateTime->format('t' ) )->setTime( 23, 59, 59 )->format( implode( ' ', $start_formats ) );
1591
-			$where['Datetime.DTT_EVT_start'] = array( 'BETWEEN', array( $start, $end ) );
1582
+			$DateTime = new DateTime('now', new DateTimeZone(EEM_Event::instance()->get_timezone()));
1583
+			$start = $DateTime->setTime(0, 0, 0)->format(implode(' ', $start_formats));
1584
+			$end = $DateTime->setTime(23, 59, 59)->format(implode(' ', $start_formats));
1585
+			$where['Datetime.DTT_EVT_start'] = array('BETWEEN', array($start, $end));
1586
+		} else if (isset($this->_req_data['status']) && $this->_req_data['status'] == 'month') {
1587
+			$now = date('Y-m-01');
1588
+			$DateTime = new DateTime($now, new DateTimeZone(EEM_Event::instance()->get_timezone()));
1589
+			$start = $DateTime->setTime(0, 0, 0)->format(implode(' ', $start_formats));
1590
+			$end = $DateTime->setDate(date('Y'), date('m'), $DateTime->format('t'))->setTime(23, 59, 59)->format(implode(' ', $start_formats));
1591
+			$where['Datetime.DTT_EVT_start'] = array('BETWEEN', array($start, $end));
1592 1592
 		}
1593 1593
 
1594 1594
 
1595
-		if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_events', 'get_events' ) ) {
1596
-			$where['EVT_wp_user'] =  get_current_user_id();
1595
+		if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_events', 'get_events')) {
1596
+			$where['EVT_wp_user'] = get_current_user_id();
1597 1597
 		} else {
1598
-			if ( ! isset( $where['status'] ) ) {
1599
-				if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_private_events', 'get_events' ) ) {
1598
+			if ( ! isset($where['status'])) {
1599
+				if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_private_events', 'get_events')) {
1600 1600
 					$where['OR'] = array(
1601
-						'status*restrict_private' => array( '!=', 'private' ),
1601
+						'status*restrict_private' => array('!=', 'private'),
1602 1602
 						'AND' => array(
1603
-							'status*inclusive' => array( '=', 'private' ),
1603
+							'status*inclusive' => array('=', 'private'),
1604 1604
 							'EVT_wp_user' => get_current_user_id()
1605 1605
 						)
1606 1606
 					);
@@ -1608,16 +1608,16 @@  discard block
 block discarded – undo
1608 1608
 			}
1609 1609
 		}
1610 1610
 
1611
-		if ( isset( $this->_req_data['EVT_wp_user'] ) ) {
1612
-			if ( $this->_req_data['EVT_wp_user'] != get_current_user_id() && EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_events', 'get_events' ) ) {
1611
+		if (isset($this->_req_data['EVT_wp_user'])) {
1612
+			if ($this->_req_data['EVT_wp_user'] != get_current_user_id() && EE_Registry::instance()->CAP->current_user_can('ee_read_others_events', 'get_events')) {
1613 1613
 				$where['EVT_wp_user'] = $this->_req_data['EVT_wp_user'];
1614 1614
 			}
1615 1615
 		}
1616 1616
 
1617 1617
 
1618 1618
 		//search query handling
1619
-		if ( isset( $this->_req_data['s'] ) ) {
1620
-			$search_string = '%' . $this->_req_data['s'] . '%';
1619
+		if (isset($this->_req_data['s'])) {
1620
+			$search_string = '%'.$this->_req_data['s'].'%';
1621 1621
 			$where['OR'] = array(
1622 1622
 				'EVT_name' => array('LIKE', $search_string),
1623 1623
 				'EVT_desc' => array('LIKE', $search_string),
@@ -1626,32 +1626,32 @@  discard block
 block discarded – undo
1626 1626
 		}
1627 1627
 
1628 1628
 
1629
-		$where = apply_filters( 'FHEE__Events_Admin_Page__get_events__where', $where, $this->_req_data );
1630
-		$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 );
1629
+		$where = apply_filters('FHEE__Events_Admin_Page__get_events__where', $where, $this->_req_data);
1630
+		$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);
1631 1631
 
1632 1632
 
1633 1633
 		//let's first check if we have special requests coming in.
1634
-		if ( isset( $this->_req_data['active_status'] ) ) {
1635
-			switch ( $this->_req_data['active_status'] ) {
1634
+		if (isset($this->_req_data['active_status'])) {
1635
+			switch ($this->_req_data['active_status']) {
1636 1636
 				case 'upcoming' :
1637
-					return $EEME->get_upcoming_events( $query_params, $count );
1637
+					return $EEME->get_upcoming_events($query_params, $count);
1638 1638
 					break;
1639 1639
 
1640 1640
 				case 'expired' :
1641
-					return $EEME->get_expired_events( $query_params, $count );
1641
+					return $EEME->get_expired_events($query_params, $count);
1642 1642
 					break;
1643 1643
 
1644 1644
 				case 'active' :
1645
-					return $EEME->get_active_events( $query_params, $count );
1645
+					return $EEME->get_active_events($query_params, $count);
1646 1646
 					break;
1647 1647
 
1648 1648
 				case 'inactive' :
1649
-					return $EEME->get_inactive_events( $query_params, $count );
1649
+					return $EEME->get_inactive_events($query_params, $count);
1650 1650
 					break;
1651 1651
 			}
1652 1652
 		}
1653 1653
 
1654
-		$events = $count ? $EEME->count( array( $where ), 'EVT_ID', true ) : $EEME->get_all( $query_params );
1654
+		$events = $count ? $EEME->count(array($where), 'EVT_ID', true) : $EEME->get_all($query_params);
1655 1655
 
1656 1656
 		return $events;
1657 1657
 	}
@@ -1660,23 +1660,23 @@  discard block
 block discarded – undo
1660 1660
 
1661 1661
 
1662 1662
 	//handling for WordPress CPT actions (trash, restore, delete)
1663
-	public function trash_cpt_item( $post_id ) {
1663
+	public function trash_cpt_item($post_id) {
1664 1664
 		$this->_req_data['EVT_ID'] = $post_id;
1665
-		$this->_trash_or_restore_event( 'trash', FALSE );
1665
+		$this->_trash_or_restore_event('trash', FALSE);
1666 1666
 	}
1667 1667
 
1668 1668
 
1669 1669
 
1670 1670
 
1671
-	public function restore_cpt_item( $post_id ) {
1671
+	public function restore_cpt_item($post_id) {
1672 1672
 		$this->_req_data['EVT_ID'] = $post_id;
1673
-		$this->_trash_or_restore_event( 'draft', FALSE );
1673
+		$this->_trash_or_restore_event('draft', FALSE);
1674 1674
 	}
1675 1675
 
1676 1676
 
1677
-	public function delete_cpt_item( $post_id ) {
1677
+	public function delete_cpt_item($post_id) {
1678 1678
 		$this->_req_data['EVT_ID'] = $post_id;
1679
-		$this->_delete_event( FALSE );
1679
+		$this->_delete_event(FALSE);
1680 1680
 	}
1681 1681
 
1682 1682
 
@@ -1688,7 +1688,7 @@  discard block
 block discarded – undo
1688 1688
 	 * @param  string $event_status
1689 1689
 	 * @return void
1690 1690
 	 */
1691
-	protected function _trash_or_restore_event($event_status = 'trash', $redirect_after = TRUE ) {
1691
+	protected function _trash_or_restore_event($event_status = 'trash', $redirect_after = TRUE) {
1692 1692
 		//determine the event id and set to array.
1693 1693
 		$EVT_ID = isset($this->_req_data['EVT_ID']) ? absint($this->_req_data['EVT_ID']) : FALSE;
1694 1694
 		// loop thru events
@@ -1696,7 +1696,7 @@  discard block
 block discarded – undo
1696 1696
 			// clean status
1697 1697
 			$event_status = sanitize_key($event_status);
1698 1698
 			// grab status
1699
-			if (!empty($event_status)) {
1699
+			if ( ! empty($event_status)) {
1700 1700
 				$success = $this->_change_event_status($EVT_ID, $event_status);
1701 1701
 			} else {
1702 1702
 				$success = FALSE;
@@ -1710,7 +1710,7 @@  discard block
 block discarded – undo
1710 1710
 		}
1711 1711
 		$action = $event_status == 'trash' ? 'moved to the trash' : 'restored from the trash';
1712 1712
 
1713
-		if ( $redirect_after )
1713
+		if ($redirect_after)
1714 1714
 			$this->_redirect_after_action($success, 'Event', $action, array('action' => 'default'));
1715 1715
 	}
1716 1716
 
@@ -1725,7 +1725,7 @@  discard block
 block discarded – undo
1725 1725
 		// clean status
1726 1726
 		$event_status = sanitize_key($event_status);
1727 1727
 		// grab status
1728
-		if (!empty($event_status)) {
1728
+		if ( ! empty($event_status)) {
1729 1729
 			$success = TRUE;
1730 1730
 			//determine the event id and set to array.
1731 1731
 			$EVT_IDs = isset($this->_req_data['EVT_IDs']) ? (array) $this->_req_data['EVT_IDs'] : array();
@@ -1735,7 +1735,7 @@  discard block
 block discarded – undo
1735 1735
 					$results = $this->_change_event_status($EVT_ID, $event_status);
1736 1736
 					$success = $results !== FALSE ? $success : FALSE;
1737 1737
 				} else {
1738
-					$msg = sprintf( esc_html__('An error occurred. Event #%d could not be moved to the trash because a valid event ID was not not supplied.', 'event_espresso'), $EVT_ID);
1738
+					$msg = sprintf(esc_html__('An error occurred. Event #%d could not be moved to the trash because a valid event ID was not not supplied.', 'event_espresso'), $EVT_ID);
1739 1739
 					EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1740 1740
 					$success = FALSE;
1741 1741
 				}
@@ -1760,15 +1760,15 @@  discard block
 block discarded – undo
1760 1760
 	 * @param  string $event_status
1761 1761
 	 * @return bool
1762 1762
 	 */
1763
-	private function _change_event_status( $EVT_ID = 0, $event_status = '') {
1763
+	private function _change_event_status($EVT_ID = 0, $event_status = '') {
1764 1764
 		// grab event id
1765
-		if (!$EVT_ID) {
1765
+		if ( ! $EVT_ID) {
1766 1766
 			$msg = esc_html__('An error occurred. No Event ID or an invalid Event ID was received.', 'event_espresso');
1767 1767
 			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1768 1768
 			return FALSE;
1769 1769
 		}
1770 1770
 
1771
-		$this->_cpt_model_obj = EEM_Event::instance()->get_one_by_ID( $EVT_ID );
1771
+		$this->_cpt_model_obj = EEM_Event::instance()->get_one_by_ID($EVT_ID);
1772 1772
 
1773 1773
 		// clean status
1774 1774
 		$event_status = sanitize_key($event_status);
@@ -1794,11 +1794,11 @@  discard block
 block discarded – undo
1794 1794
 				$hook = FALSE;
1795 1795
 		}
1796 1796
 		//use class to change status
1797
-		$this->_cpt_model_obj->set_status( $event_status );
1797
+		$this->_cpt_model_obj->set_status($event_status);
1798 1798
 		$success = $this->_cpt_model_obj->save();
1799 1799
 
1800 1800
 		if ($success === FALSE) {
1801
-			$msg = sprintf( esc_html__('An error occurred. The event could not be %s.', 'event_espresso'), $action);
1801
+			$msg = sprintf(esc_html__('An error occurred. The event could not be %s.', 'event_espresso'), $action);
1802 1802
 			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1803 1803
 			return FALSE;
1804 1804
 		}
@@ -1816,15 +1816,15 @@  discard block
 block discarded – undo
1816 1816
 	 * @access protected
1817 1817
 	 * @param bool $redirect_after
1818 1818
 	 */
1819
-	protected function _delete_event( $redirect_after = TRUE ) {
1819
+	protected function _delete_event($redirect_after = TRUE) {
1820 1820
 		//determine the event id and set to array.
1821 1821
 		$EVT_ID = isset($this->_req_data['EVT_ID']) ? absint($this->_req_data['EVT_ID']) : NULL;
1822
-		$EVT_ID = isset( $this->_req_data['post'] ) ? absint( $this->_req_data['post'] ) : $EVT_ID;
1822
+		$EVT_ID = isset($this->_req_data['post']) ? absint($this->_req_data['post']) : $EVT_ID;
1823 1823
 
1824 1824
 
1825 1825
 		// loop thru events
1826 1826
 		if ($EVT_ID) {
1827
-			$success = $this->_permanently_delete_event( $EVT_ID );
1827
+			$success = $this->_permanently_delete_event($EVT_ID);
1828 1828
 			// get list of events with no prices
1829 1829
 			$espresso_no_ticket_prices = get_option('ee_no_ticket_prices', array());
1830 1830
 			// remove this event from the list of events with no prices
@@ -1838,7 +1838,7 @@  discard block
 block discarded – undo
1838 1838
 			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1839 1839
 		}
1840 1840
 
1841
-		if ( $redirect_after )
1841
+		if ($redirect_after)
1842 1842
 			$this->_redirect_after_action($success, 'Event', 'deleted', array('action' => 'default', 'status' => 'trash'));
1843 1843
 	}
1844 1844
 
@@ -1856,12 +1856,12 @@  discard block
 block discarded – undo
1856 1856
 		$EVT_IDs = isset($this->_req_data['EVT_IDs']) ? (array) $this->_req_data['EVT_IDs'] : array();
1857 1857
 		// loop thru events
1858 1858
 		foreach ($EVT_IDs as $EVT_ID) {
1859
-			$EVT_ID = absint( $EVT_ID );
1860
-			if ( $EVT_ID ) {
1861
-				$results = $this->_permanently_delete_event( $EVT_ID );
1859
+			$EVT_ID = absint($EVT_ID);
1860
+			if ($EVT_ID) {
1861
+				$results = $this->_permanently_delete_event($EVT_ID);
1862 1862
 				$success = $results !== FALSE ? $success : FALSE;
1863 1863
 				// remove this event from the list of events with no prices
1864
-				unset( $espresso_no_ticket_prices[ $EVT_ID ] );
1864
+				unset($espresso_no_ticket_prices[$EVT_ID]);
1865 1865
 			} else {
1866 1866
 				$success = FALSE;
1867 1867
 				$msg = esc_html__('An error occurred. An event could not be deleted because a valid event ID was not not supplied.', 'event_espresso');
@@ -1881,9 +1881,9 @@  discard block
 block discarded – undo
1881 1881
 	 * @param  int $EVT_ID
1882 1882
 	 * @return bool
1883 1883
 	 */
1884
-	private function _permanently_delete_event( $EVT_ID = 0 ) {
1884
+	private function _permanently_delete_event($EVT_ID = 0) {
1885 1885
 		// grab event id
1886
-		if ( ! $EVT_ID ) {
1886
+		if ( ! $EVT_ID) {
1887 1887
 			$msg = esc_html__('An error occurred. No Event ID or an invalid Event ID was received.', 'event_espresso');
1888 1888
 			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1889 1889
 			return FALSE;
@@ -1892,19 +1892,19 @@  discard block
 block discarded – undo
1892 1892
 			! $this->_cpt_model_obj instanceof EE_Event
1893 1893
 			|| $this->_cpt_model_obj->ID() !== $EVT_ID
1894 1894
 		) {
1895
-			$this->_cpt_model_obj = EEM_Event::instance()->get_one_by_ID( $EVT_ID );
1895
+			$this->_cpt_model_obj = EEM_Event::instance()->get_one_by_ID($EVT_ID);
1896 1896
 		}
1897 1897
 
1898
-		if ( ! $this->_cpt_model_obj instanceof EE_Event ) {
1898
+		if ( ! $this->_cpt_model_obj instanceof EE_Event) {
1899 1899
 			return false;
1900 1900
 		}
1901 1901
 
1902 1902
 		//need to delete related tickets and prices first.
1903 1903
 		$datetimes = $this->_cpt_model_obj->get_many_related('Datetime');
1904
-		foreach ( $datetimes as $datetime ) {
1904
+		foreach ($datetimes as $datetime) {
1905 1905
 			$this->_cpt_model_obj->_remove_relation_to($datetime, 'Datetime');
1906 1906
 			$tickets = $datetime->get_many_related('Ticket');
1907
-			foreach ( $tickets as $ticket ) {
1907
+			foreach ($tickets as $ticket) {
1908 1908
 				$ticket->_remove_relation_to($datetime, 'Datetime');
1909 1909
 				$ticket->delete_related_permanently('Price');
1910 1910
 				$ticket->delete_permanently();
@@ -1914,14 +1914,14 @@  discard block
 block discarded – undo
1914 1914
 
1915 1915
 		//what about related venues or terms?
1916 1916
 		$venues = $this->_cpt_model_obj->get_many_related('Venue');
1917
-		foreach ( $venues as $venue ) {
1917
+		foreach ($venues as $venue) {
1918 1918
 			$this->_cpt_model_obj->_remove_relation_to($venue, 'Venue');
1919 1919
 		}
1920 1920
 
1921 1921
 		//any attached question groups?
1922 1922
 		$question_groups = $this->_cpt_model_obj->get_many_related('Question_Group');
1923
-		if ( !empty( $question_groups ) ) {
1924
-			foreach ( $question_groups as $question_group ) {
1923
+		if ( ! empty($question_groups)) {
1924
+			foreach ($question_groups as $question_group) {
1925 1925
 				$this->_cpt_model_obj->_remove_relation_to($question_group, 'Question_Group');
1926 1926
 			}
1927 1927
 		}
@@ -1930,26 +1930,26 @@  discard block
 block discarded – undo
1930 1930
 
1931 1931
 
1932 1932
 		//Message Template Groups
1933
-		$this->_cpt_model_obj->_remove_relations( 'Message_Template_Group' );
1933
+		$this->_cpt_model_obj->_remove_relations('Message_Template_Group');
1934 1934
 
1935 1935
 		/** @type EE_Term_Taxonomy[] $term_taxonomies */
1936 1936
 		$term_taxonomies = $this->_cpt_model_obj->term_taxonomies();
1937 1937
 
1938
-		foreach ( $term_taxonomies as $term_taxonomy ) {
1938
+		foreach ($term_taxonomies as $term_taxonomy) {
1939 1939
 			$this->_cpt_model_obj->remove_relation_to_term_taxonomy($term_taxonomy);
1940 1940
 		}
1941 1941
 
1942 1942
 		$success = $this->_cpt_model_obj->delete_permanently();
1943 1943
 		// did it all go as planned ?
1944 1944
 		if ($success) {
1945
-			$msg = sprintf( esc_html__('Event ID # %d has been deleted.', 'event_espresso'), $EVT_ID);
1945
+			$msg = sprintf(esc_html__('Event ID # %d has been deleted.', 'event_espresso'), $EVT_ID);
1946 1946
 			EE_Error::add_success($msg);
1947 1947
 		} else {
1948
-			$msg = sprintf( esc_html__('An error occurred. Event ID # %d could not be deleted.', 'event_espresso'), $EVT_ID);
1948
+			$msg = sprintf(esc_html__('An error occurred. Event ID # %d could not be deleted.', 'event_espresso'), $EVT_ID);
1949 1949
 			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1950 1950
 			return FALSE;
1951 1951
 		}
1952
-		do_action( 'AHEE__Events_Admin_Page___permanently_delete_event__after_event_deleted', $EVT_ID );
1952
+		do_action('AHEE__Events_Admin_Page___permanently_delete_event__after_event_deleted', $EVT_ID);
1953 1953
 		return TRUE;
1954 1954
 	}
1955 1955
 
@@ -1966,7 +1966,7 @@  discard block
 block discarded – undo
1966 1966
 	 */
1967 1967
 	public function total_events() {
1968 1968
 
1969
-		$count = EEM_Event::instance()->count( array( 'caps' => 'read_admin' ), 'EVT_ID', true );
1969
+		$count = EEM_Event::instance()->count(array('caps' => 'read_admin'), 'EVT_ID', true);
1970 1970
 		return $count;
1971 1971
 	}
1972 1972
 
@@ -1981,10 +1981,10 @@  discard block
 block discarded – undo
1981 1981
 	 */
1982 1982
 	public function total_events_draft() {
1983 1983
 		$where = array(
1984
-			'status' => array( 'IN', array('draft', 'auto-draft' ) )
1984
+			'status' => array('IN', array('draft', 'auto-draft'))
1985 1985
 			);
1986 1986
 
1987
-		$count = EEM_Event::instance()->count( array( $where, 'caps' => 'read_admin' ), 'EVT_ID', true );
1987
+		$count = EEM_Event::instance()->count(array($where, 'caps' => 'read_admin'), 'EVT_ID', true);
1988 1988
 		return $count;
1989 1989
 	}
1990 1990
 
@@ -2003,7 +2003,7 @@  discard block
 block discarded – undo
2003 2003
 			'status' => 'trash'
2004 2004
 			);
2005 2005
 
2006
-		$count = EEM_Event::instance()->count( array( $where, 'caps' => 'read_admin' ), 'EVT_ID', true );
2006
+		$count = EEM_Event::instance()->count(array($where, 'caps' => 'read_admin'), 'EVT_ID', true);
2007 2007
 		return $count;
2008 2008
 	}
2009 2009
 
@@ -2031,11 +2031,11 @@  discard block
 block discarded – undo
2031 2031
 			// translated
2032 2032
 			TRUE
2033 2033
 		);
2034
-		$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;
2034
+		$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;
2035 2035
 
2036 2036
 		$this->_set_add_edit_form_tags('update_default_event_settings');
2037 2037
 		$this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE);
2038
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template(EVENTS_TEMPLATE_PATH . 'event_settings.template.php', $this->_template_args, TRUE);
2038
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template(EVENTS_TEMPLATE_PATH.'event_settings.template.php', $this->_template_args, TRUE);
2039 2039
 		$this->display_admin_page_with_sidebar();
2040 2040
 	}
2041 2041
 
@@ -2061,9 +2061,9 @@  discard block
 block discarded – undo
2061 2061
 
2062 2062
 	protected function _template_settings() {
2063 2063
 		$this->_admin_page_title = esc_html__('Template Settings (Preview)', 'event_espresso');
2064
-		$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' ) . '" />';
2065
-		$this->_template_args['preview_text'] = '<strong>'.esc_html__( '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>';
2066
-		$this->display_admin_caf_preview_page( 'template_settings_tab' );
2064
+		$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').'" />';
2065
+		$this->_template_args['preview_text'] = '<strong>'.esc_html__('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>';
2066
+		$this->display_admin_caf_preview_page('template_settings_tab');
2067 2067
 	}
2068 2068
 
2069 2069
 
@@ -2076,22 +2076,22 @@  discard block
 block discarded – undo
2076 2076
 	 * @return void
2077 2077
 	 */
2078 2078
 	private function _set_category_object() {
2079
-		if ( isset( $this->_category->id ) && !empty( $this->_category->id ) )
2079
+		if (isset($this->_category->id) && ! empty($this->_category->id))
2080 2080
 			return; //already have the category object so get out.
2081 2081
 
2082 2082
 		//set default category object
2083 2083
 		$this->_set_empty_category_object();
2084 2084
 
2085 2085
 		//only set if we've got an id
2086
-		if ( !isset($this->_req_data['EVT_CAT_ID'] ) ) {
2086
+		if ( ! isset($this->_req_data['EVT_CAT_ID'])) {
2087 2087
 			return;
2088 2088
 		}
2089 2089
 
2090 2090
 		$category_id = absint($this->_req_data['EVT_CAT_ID']);
2091 2091
 
2092
-		$term = get_term( $category_id, 'espresso_event_categories' );
2092
+		$term = get_term($category_id, 'espresso_event_categories');
2093 2093
 
2094
-		if ( !empty( $term ) ) {
2094
+		if ( ! empty($term)) {
2095 2095
 			$this->_category->category_name = $term->name;
2096 2096
 			$this->_category->category_identifier = $term->slug;
2097 2097
 			$this->_category->category_desc = $term->description;
@@ -2105,13 +2105,13 @@  discard block
 block discarded – undo
2105 2105
 
2106 2106
 	private function _set_empty_category_object() {
2107 2107
 		$this->_category = new stdClass();
2108
-		$this->_category->category_name = $this->_category->category_identifier = $this->_category->category_desc  = '';
2108
+		$this->_category->category_name = $this->_category->category_identifier = $this->_category->category_desc = '';
2109 2109
 		$this->_category->id = $this->_category->parent = 0;
2110 2110
 	}
2111 2111
 
2112 2112
 
2113 2113
 	protected function _category_list_table() {
2114
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
2114
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2115 2115
 		$this->_search_btn_label = esc_html__('Categories', 'event_espresso');
2116 2116
 		$this->_admin_page_title .= $this->get_action_link_or_button('add_category', 'add_category', array(), 'add-new-h2');
2117 2117
 		$this->display_admin_list_table_page_with_sidebar();
@@ -2127,14 +2127,14 @@  discard block
 block discarded – undo
2127 2127
 		$this->_set_add_edit_form_tags($route);
2128 2128
 
2129 2129
 		$this->_set_category_object();
2130
-		$id = !empty($this->_category->id) ? $this->_category->id : '';
2130
+		$id = ! empty($this->_category->id) ? $this->_category->id : '';
2131 2131
 
2132 2132
 		$delete_action = 'delete_category';
2133 2133
 
2134 2134
 		//custom redirect
2135
-		$redirect = EE_Admin_Page::add_query_args_and_nonce( array('action' => 'category_list'), $this->_admin_base_url );
2135
+		$redirect = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'category_list'), $this->_admin_base_url);
2136 2136
 
2137
-		$this->_set_publish_post_box_vars( 'EVT_CAT_ID', $id, $delete_action, $redirect );
2137
+		$this->_set_publish_post_box_vars('EVT_CAT_ID', $id, $delete_action, $redirect);
2138 2138
 
2139 2139
 		//take care of contents
2140 2140
 		$this->_template_args['admin_page_content'] = $this->_category_details_content();
@@ -2148,25 +2148,25 @@  discard block
 block discarded – undo
2148 2148
 			'type' => 'wp_editor',
2149 2149
 			'value' => EEH_Formatter::admin_format_content($this->_category->category_desc),
2150 2150
 			'class' => 'my_editor_custom',
2151
-			'wpeditor_args' => array('media_buttons' => FALSE )
2151
+			'wpeditor_args' => array('media_buttons' => FALSE)
2152 2152
 		);
2153
-		$_wp_editor = $this->_generate_admin_form_fields( $editor_args, 'array' );
2153
+		$_wp_editor = $this->_generate_admin_form_fields($editor_args, 'array');
2154 2154
 
2155
-		$all_terms = get_terms( array('espresso_event_categories' ), array( 'hide_empty' => 0, 'exclude' => array( $this->_category->id ) ) );
2155
+		$all_terms = get_terms(array('espresso_event_categories'), array('hide_empty' => 0, 'exclude' => array($this->_category->id)));
2156 2156
 
2157 2157
 		//setup category select for term parents.
2158 2158
 		$category_select_values[] = array(
2159 2159
 			'text' => esc_html__('No Parent', 'event_espresso'),
2160 2160
 			'id' => 0
2161 2161
 			);
2162
-		foreach ( $all_terms as $term ) {
2162
+		foreach ($all_terms as $term) {
2163 2163
 			$category_select_values[] = array(
2164 2164
 				'text' => $term->name,
2165 2165
 				'id' => $term->term_id
2166 2166
 				);
2167 2167
 		}
2168 2168
 
2169
-		$category_select = EEH_Form_Fields::select_input( 'category_parent', $category_select_values, $this->_category->parent );
2169
+		$category_select = EEH_Form_Fields::select_input('category_parent', $category_select_values, $this->_category->parent);
2170 2170
 
2171 2171
 		$template_args = array(
2172 2172
 			'category' => $this->_category,
@@ -2176,15 +2176,15 @@  discard block
 block discarded – undo
2176 2176
 			'disable' => '',
2177 2177
 			'disabled_message' => FALSE
2178 2178
 			);
2179
-		$template = EVENTS_TEMPLATE_PATH . 'event_category_details.template.php';
2180
-		return EEH_Template::display_template($template, $template_args, TRUE );
2179
+		$template = EVENTS_TEMPLATE_PATH.'event_category_details.template.php';
2180
+		return EEH_Template::display_template($template, $template_args, TRUE);
2181 2181
 	}
2182 2182
 
2183 2183
 
2184 2184
 	protected function _delete_categories() {
2185
-		$cat_ids = isset( $this->_req_data['EVT_CAT_ID'] ) ? (array) $this->_req_data['EVT_CAT_ID'] : (array) $this->_req_data['category_id'];
2185
+		$cat_ids = isset($this->_req_data['EVT_CAT_ID']) ? (array) $this->_req_data['EVT_CAT_ID'] : (array) $this->_req_data['category_id'];
2186 2186
 
2187
-		foreach ( $cat_ids as $cat_id ) {
2187
+		foreach ($cat_ids as $cat_id) {
2188 2188
 			$this->_delete_category($cat_id);
2189 2189
 		}
2190 2190
 
@@ -2192,7 +2192,7 @@  discard block
 block discarded – undo
2192 2192
 		$query_args = array(
2193 2193
 			'action' => 'category_list'
2194 2194
 			);
2195
-		$this->_redirect_after_action(0,'','',$query_args);
2195
+		$this->_redirect_after_action(0, '', '', $query_args);
2196 2196
 
2197 2197
 	}
2198 2198
 
@@ -2202,61 +2202,61 @@  discard block
 block discarded – undo
2202 2202
 
2203 2203
 	protected function _delete_category($cat_id) {
2204 2204
 		global $wpdb;
2205
-		$cat_id = absint( $cat_id );
2206
-		wp_delete_term( $cat_id, 'espresso_event_categories' );
2205
+		$cat_id = absint($cat_id);
2206
+		wp_delete_term($cat_id, 'espresso_event_categories');
2207 2207
 	}
2208 2208
 
2209 2209
 
2210 2210
 
2211 2211
 	protected function _insert_or_update_category($new_category) {
2212 2212
 
2213
-		$cat_id = $new_category ? $this->_insert_category() : $this->_insert_category( TRUE );
2213
+		$cat_id = $new_category ? $this->_insert_category() : $this->_insert_category(TRUE);
2214 2214
 		$success = 0; //we already have a success message so lets not send another.
2215 2215
 
2216
-		if ( $cat_id ) {
2216
+		if ($cat_id) {
2217 2217
 			$query_args = array(
2218 2218
 				'action'     => 'edit_category',
2219 2219
 				'EVT_CAT_ID' => $cat_id
2220 2220
 			);
2221 2221
 		} else {
2222
-			$query_args = array( 'action' => 'add_category' );
2222
+			$query_args = array('action' => 'add_category');
2223 2223
 		}
2224
-		$this->_redirect_after_action( $success, '','', $query_args, TRUE );
2224
+		$this->_redirect_after_action($success, '', '', $query_args, TRUE);
2225 2225
 
2226 2226
 	}
2227 2227
 
2228 2228
 
2229 2229
 
2230
-	private function _insert_category( $update = FALSE ) {
2230
+	private function _insert_category($update = FALSE) {
2231 2231
 		$cat_id = $update ? $this->_req_data['EVT_CAT_ID'] : '';
2232
-		$category_name= isset( $this->_req_data['category_name'] ) ? $this->_req_data['category_name'] : '';
2233
-		$category_desc= isset( $this->_req_data['category_desc'] ) ? $this->_req_data['category_desc'] : '';
2234
-		$category_parent = isset( $this->_req_data['category_parent'] ) ? $this->_req_data['category_parent'] : 0;
2232
+		$category_name = isset($this->_req_data['category_name']) ? $this->_req_data['category_name'] : '';
2233
+		$category_desc = isset($this->_req_data['category_desc']) ? $this->_req_data['category_desc'] : '';
2234
+		$category_parent = isset($this->_req_data['category_parent']) ? $this->_req_data['category_parent'] : 0;
2235 2235
 
2236
-		if ( empty( $category_name ) ) {
2237
-			$msg = esc_html__( 'You must add a name for the category.', 'event_espresso' );
2238
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
2236
+		if (empty($category_name)) {
2237
+			$msg = esc_html__('You must add a name for the category.', 'event_espresso');
2238
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
2239 2239
 			return false;
2240 2240
 		}
2241 2241
 
2242
-		$term_args=array(
2242
+		$term_args = array(
2243 2243
 			'name'=>$category_name,
2244 2244
 			'description'=>$category_desc,
2245 2245
 			'parent'=>$category_parent
2246 2246
 		);
2247 2247
 		//was the category_identifier input disabled?
2248
-		if(isset($this->_req_data['category_identifier'])){
2248
+		if (isset($this->_req_data['category_identifier'])) {
2249 2249
 			$term_args['slug'] = $this->_req_data['category_identifier'];
2250 2250
 		}
2251
-		$insert_ids = $update ? wp_update_term( $cat_id, 'espresso_event_categories', $term_args ) :wp_insert_term( $category_name, 'espresso_event_categories', $term_args );
2251
+		$insert_ids = $update ? wp_update_term($cat_id, 'espresso_event_categories', $term_args) : wp_insert_term($category_name, 'espresso_event_categories', $term_args);
2252 2252
 
2253
-		if ( !is_array( $insert_ids ) ) {
2254
-			$msg = esc_html__( 'An error occurred and the category has not been saved to the database.', 'event_espresso' );
2255
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
2253
+		if ( ! is_array($insert_ids)) {
2254
+			$msg = esc_html__('An error occurred and the category has not been saved to the database.', 'event_espresso');
2255
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
2256 2256
 		} else {
2257 2257
 			$cat_id = $insert_ids['term_id'];
2258
-			$msg = sprintf ( esc_html__('The category %s was successfully saved', 'event_espresso'), $category_name );
2259
-			EE_Error::add_success( $msg );
2258
+			$msg = sprintf(esc_html__('The category %s was successfully saved', 'event_espresso'), $category_name);
2259
+			EE_Error::add_success($msg);
2260 2260
 		}
2261 2261
 
2262 2262
 		return $cat_id;
@@ -2265,32 +2265,32 @@  discard block
 block discarded – undo
2265 2265
 
2266 2266
 
2267 2267
 
2268
-	public function get_categories( $per_page = 10, $current_page = 1, $count = FALSE ) {
2268
+	public function get_categories($per_page = 10, $current_page = 1, $count = FALSE) {
2269 2269
 		global $wpdb;
2270 2270
 
2271 2271
 		//testing term stuff
2272
-		$orderby = isset( $this->_req_data['orderby'] ) ? $this->_req_data['orderby'] : 'Term.term_id';
2273
-		$order = isset( $this->_req_data['order'] ) ? $this->_req_data['order'] : 'DESC';
2274
-		$limit = ($current_page-1)*$per_page;
2272
+		$orderby = isset($this->_req_data['orderby']) ? $this->_req_data['orderby'] : 'Term.term_id';
2273
+		$order = isset($this->_req_data['order']) ? $this->_req_data['order'] : 'DESC';
2274
+		$limit = ($current_page - 1) * $per_page;
2275 2275
 
2276
-		$where = array( 'taxonomy' => 'espresso_event_categories' );
2276
+		$where = array('taxonomy' => 'espresso_event_categories');
2277 2277
 
2278
-		if ( isset( $this->_req_data['s'] ) ) {
2279
-			$sstr = '%' . $this->_req_data['s'] . '%';
2278
+		if (isset($this->_req_data['s'])) {
2279
+			$sstr = '%'.$this->_req_data['s'].'%';
2280 2280
 			$where['OR'] = array(
2281
-				'Term.name' => array( 'LIKE', $sstr),
2282
-				'description' => array( 'LIKE', $sstr )
2281
+				'Term.name' => array('LIKE', $sstr),
2282
+				'description' => array('LIKE', $sstr)
2283 2283
 				);
2284 2284
 		}
2285 2285
 
2286 2286
 		$query_params = array(
2287
-			$where ,
2288
-			'order_by' => array( $orderby => $order ),
2289
-			'limit' => $limit . ',' . $per_page,
2287
+			$where,
2288
+			'order_by' => array($orderby => $order),
2289
+			'limit' => $limit.','.$per_page,
2290 2290
 			'force_join' => array('Term')
2291 2291
 			);
2292 2292
 
2293
-		$categories = $count ? EEM_Term_Taxonomy::instance()->count( $query_params, 'term_id' ) :EEM_Term_Taxonomy::instance()->get_all( $query_params );
2293
+		$categories = $count ? EEM_Term_Taxonomy::instance()->count($query_params, 'term_id') : EEM_Term_Taxonomy::instance()->get_all($query_params);
2294 2294
 
2295 2295
 		return $categories;
2296 2296
 	}
Please login to merge, or discard this patch.
general_settings/templates/your_organization_settings.template.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <div class="padding">
2 2
 	<?php
3 3
 		//we'll only show site-license keys if this is main_site() (which works for both multi-site and single-site wp installations)
4
-		if ( is_main_site() ) { ?>
4
+		if (is_main_site()) { ?>
5 5
 		<h2 class="ee-admin-settings-hdr" style="width:300px;">
6 6
 			<?php _e('Your Event Espresso License Key', 'event_espresso'); ?>
7 7
 		</h2>
@@ -11,13 +11,13 @@  discard block
 block discarded – undo
11 11
 				<tr <?php echo isset($_REQUEST['license_key']) && $_REQUEST['license_key'] == true ? 'class="yellow_alert"' : '' ?>>
12 12
 					<th>
13 13
 						<label for="site_license_key">
14
-							<?php _e('Support License Key', 'event_espresso'); ?> <?php echo EEH_Template::get_help_tab_link('site_license_key_info');?>
14
+							<?php _e('Support License Key', 'event_espresso'); ?> <?php echo EEH_Template::get_help_tab_link('site_license_key_info'); ?>
15 15
 						</label>
16 16
 					</th>
17 17
 					<td>
18 18
 						<input name="site_license_key" id="site_license_key" size="10" class="regular-text" type="text" value="<?php echo $site_license_key; ?>" /><?php echo $site_license_key_verified; ?><br/>
19 19
 						<p class="description">
20
-							<?php printf( __('Adding a valid Support License Key will enable automatic update notifications and backend updates for Event Espresso Core and any installed add-ons. If this is a Development or Test site, %sDO NOT%s enter your Support License Key.', 'event_espresso'), '<strong>', '</strong>' ); ?>
20
+							<?php printf(__('Adding a valid Support License Key will enable automatic update notifications and backend updates for Event Espresso Core and any installed add-ons. If this is a Development or Test site, %sDO NOT%s enter your Support License Key.', 'event_espresso'), '<strong>', '</strong>'); ?>
21 21
 						</p>
22 22
 					</td>
23 23
 				</tr>
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 
31 31
 
32 32
 	<h2 id="contact_info_h4" class="ee-admin-settings-hdr">
33
-		<?php _e('Contact Information', 'event_espresso'); ?> <?php echo EEH_Template::get_help_tab_link('contact_info_info');?>
33
+		<?php _e('Contact Information', 'event_espresso'); ?> <?php echo EEH_Template::get_help_tab_link('contact_info_info'); ?>
34 34
 	</h2>
35 35
 
36 36
 	<table class="form-table">
@@ -78,8 +78,8 @@  discard block
 block discarded – undo
78 78
 					<input id="organization_city" class="regular-text" type="text" name="organization_city" value="<?php echo $organization_city; ?>" />
79 79
 				</td>
80 80
 			</tr>
81
-			<?php echo EEH_Form_Fields::generate_form_input( $states ); ?>
82
-			<?php echo EEH_Form_Fields::generate_form_input( $countries ); ?>
81
+			<?php echo EEH_Form_Fields::generate_form_input($states); ?>
82
+			<?php echo EEH_Form_Fields::generate_form_input($countries); ?>
83 83
 			<tr>
84 84
 				<th>
85 85
 					<label for="organization_zip">
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 				<td>
100 100
 					<input class="regular-text" type="text" name="organization_email" value="<?php echo $organization_email; ?>" />
101 101
 					<p class="description">
102
-						<?php echo sprintf( esc_html__('This is where notifications go to when you use the %1$s and %2$s shortcodes in the message templates.', 'event_espresso'), '<code>[CO_FORMATTED_EMAIL]</code>', '<code>[CO_EMAIL]</code>' ); ?>
102
+						<?php echo sprintf(esc_html__('This is where notifications go to when you use the %1$s and %2$s shortcodes in the message templates.', 'event_espresso'), '<code>[CO_FORMATTED_EMAIL]</code>', '<code>[CO_EMAIL]</code>'); ?>
103 103
 					</p>
104 104
 				</td>
105 105
 			</tr>
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 	</table>
134 134
 
135 135
 	<h2 class="ee-admin-settings-hdr">
136
-		<?php _e('Company Logo', 'event_espresso'); ?> <?php echo EEH_Template::get_help_tab_link('organization_logo_info');?>
136
+		<?php _e('Company Logo', 'event_espresso'); ?> <?php echo EEH_Template::get_help_tab_link('organization_logo_info'); ?>
137 137
 	</h2>
138 138
 
139 139
 	<table class="form-table">
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
 				</th>
162 162
 				<td>
163 163
 					<?php
164
-					if ( $organization_logo_url ) {
164
+					if ($organization_logo_url) {
165 165
 						?>
166 166
 						<p id="default-logo-thumb">
167 167
 							<img id="current-image-thumb" src="<?php echo $organization_logo_url ?>" alt="" /><br />
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
 	<br/><br/>
180 180
 
181 181
 	<h2 class="ee-admin-settings-hdr">
182
-		<?php _e('Social Links', 'event_espresso'); ?> <?php echo EEH_Template::get_help_tab_link('social_links_info');?>
182
+		<?php _e('Social Links', 'event_espresso'); ?> <?php echo EEH_Template::get_help_tab_link('social_links_info'); ?>
183 183
 	</h2>
184 184
 	<p class="description"><?php _e('Enter any links to social accounts for your organization here', 'event_espresso'); ?></p>
185 185
 
@@ -256,9 +256,9 @@  discard block
 block discarded – undo
256 256
 	<br/><br/>
257 257
 
258 258
 
259
-	<?php if ( is_main_site() ) : ?>
259
+	<?php if (is_main_site()) : ?>
260 260
 		<p>
261
-			<?php echo  EE_PUE::espresso_data_collection_optin_text( FALSE ); ?>
261
+			<?php echo  EE_PUE::espresso_data_collection_optin_text(FALSE); ?>
262 262
 		</p>
263 263
 
264 264
 		<table class="form-table">
@@ -272,11 +272,11 @@  discard block
 block discarded – undo
272 272
 					</th>
273 273
 					<td>
274 274
 						<?php
275
-							$values=array(
276
-								array('id'=>'yes','text'=> __('Yes! I want to help improve Event Espresso!','event_espresso')),
277
-								array('id'=>'no','text'=> __('Not at this time. Maybe later.','event_espresso'))
275
+							$values = array(
276
+								array('id'=>'yes', 'text'=> __('Yes! I want to help improve Event Espresso!', 'event_espresso')),
277
+								array('id'=>'no', 'text'=> __('Not at this time. Maybe later.', 'event_espresso'))
278 278
 							);
279
-							echo EEH_Form_Fields::select_input('ueip_optin', $values, !empty($ee_ueip_optin) ? $ee_ueip_optin : 'yes');
279
+							echo EEH_Form_Fields::select_input('ueip_optin', $values, ! empty($ee_ueip_optin) ? $ee_ueip_optin : 'yes');
280 280
 						?>
281 281
 					</td>
282 282
 				</tr>
Please login to merge, or discard this patch.
EE_Admin_Table_Registration_Line_Item_Display_Strategy.strategy.php 1 patch
Spacing   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  *
11 11
  */
12 12
 
13
-class EE_Admin_Table_Registration_Line_Item_Display_Strategy extends EE_Admin_Table_Line_Item_Display_Strategy  {
13
+class EE_Admin_Table_Registration_Line_Item_Display_Strategy extends EE_Admin_Table_Line_Item_Display_Strategy {
14 14
 
15 15
 	/**
16 16
 	 * Table header for display.
@@ -18,14 +18,14 @@  discard block
 block discarded – undo
18 18
 	 * @param array $options
19 19
 	 * @return string
20 20
 	 */
21
-	protected function _table_header( $options ) {
22
-		$html = EEH_HTML::table( '','', $options['table_css_class'] );
21
+	protected function _table_header($options) {
22
+		$html = EEH_HTML::table('', '', $options['table_css_class']);
23 23
 		$html .= EEH_HTML::thead();
24 24
 		$html .= EEH_HTML::tr();
25
-		$html .= EEH_HTML::th( __( 'Name', 'event_espresso' ), '', 'jst-left' );
26
-		$html .= EEH_HTML::th( __( 'Type', 'event_espresso'), '', 'jst-left' );
27
-		$html .= EEH_HTML::th( __( 'Date(s)', 'event_espresso' ), '', 'jst-left' );
28
-		$html .= EEH_HTML::th( __( 'Amount', 'event_espresso' ), '', 'jst-cntr' );
25
+		$html .= EEH_HTML::th(__('Name', 'event_espresso'), '', 'jst-left');
26
+		$html .= EEH_HTML::th(__('Type', 'event_espresso'), '', 'jst-left');
27
+		$html .= EEH_HTML::th(__('Date(s)', 'event_espresso'), '', 'jst-left');
28
+		$html .= EEH_HTML::th(__('Amount', 'event_espresso'), '', 'jst-cntr');
29 29
 		$html .= EEH_HTML::tbody();
30 30
 		return $html;
31 31
 	}
@@ -41,12 +41,12 @@  discard block
 block discarded – undo
41 41
 	 * @param array        $options
42 42
 	 * @return mixed
43 43
 	 */
44
-	protected function _item_row( EE_Line_Item $line_item, $options = array() ) {
44
+	protected function _item_row(EE_Line_Item $line_item, $options = array()) {
45 45
 		$line_item_related_object = $line_item->get_object();
46 46
 		$parent_line_item_related_object = $line_item->parent() instanceof EE_Line_Item ? $line_item->parent()->get_object() : null;
47 47
 		// start of row
48 48
 		$row_class = $options['odd'] ? 'item odd' : 'item';
49
-		$html = EEH_HTML::tr( '', '', $row_class );
49
+		$html = EEH_HTML::tr('', '', $row_class);
50 50
 
51 51
 
52 52
 		//Name Column
@@ -54,48 +54,48 @@  discard block
 block discarded – undo
54 54
 
55 55
 		//related object scope.
56 56
 		$parent_related_object_name = $parent_line_item_related_object instanceof EEI_Line_Item_Object ? $parent_line_item_related_object->name() : '';
57
-		$parent_related_object_name = empty( $parent_related_object_name ) && $line_item->parent() instanceof EE_Line_Item ? $line_item->parent()->name() : $parent_related_object_name;
57
+		$parent_related_object_name = empty($parent_related_object_name) && $line_item->parent() instanceof EE_Line_Item ? $line_item->parent()->name() : $parent_related_object_name;
58 58
 		$parent_related_object_link = $parent_line_item_related_object instanceof EEI_Admin_Links ? $parent_line_item_related_object->get_admin_details_link() : '';
59 59
 
60 60
 
61 61
 		$name_html = $line_item_related_object instanceof EEI_Line_Item_Object ? $line_item_related_object->name() : $line_item->name();
62
-		$name_html = $name_link ? '<a href="' . $name_link . '">' . $name_html . '</a>' : $name_html;
62
+		$name_html = $name_link ? '<a href="'.$name_link.'">'.$name_html.'</a>' : $name_html;
63 63
 		$name_html .= $line_item->is_taxable() ? ' *' : '';
64 64
 		//maybe preface with icon?
65
-		$name_html = $line_item_related_object instanceof EEI_Has_Icon ? $line_item_related_object->get_icon() . $name_html : $name_html;
66
-		$name_html = '<span class="ee-line-item-name linked">' . $name_html . '</span><br>';
67
-		$name_html .=  sprintf(
68
-			_x( '%1$sfor the %2$s: %3$s%4$s', 'eg. "for the Event: My Cool Event"', 'event_espresso'),
65
+		$name_html = $line_item_related_object instanceof EEI_Has_Icon ? $line_item_related_object->get_icon().$name_html : $name_html;
66
+		$name_html = '<span class="ee-line-item-name linked">'.$name_html.'</span><br>';
67
+		$name_html .= sprintf(
68
+			_x('%1$sfor the %2$s: %3$s%4$s', 'eg. "for the Event: My Cool Event"', 'event_espresso'),
69 69
 			'<span class="ee-line-item-related-parent-object">',
70
-			$line_item->parent() instanceof EE_Line_Item ? $line_item->parent()->OBJ_type_i18n() : __( 'Item:', 'event_espresso' ),
71
-			$parent_related_object_link ? '<a href="' . $parent_related_object_link . '">' . $parent_related_object_name . '</a>' : $parent_related_object_name,
70
+			$line_item->parent() instanceof EE_Line_Item ? $line_item->parent()->OBJ_type_i18n() : __('Item:', 'event_espresso'),
71
+			$parent_related_object_link ? '<a href="'.$parent_related_object_link.'">'.$parent_related_object_name.'</a>' : $parent_related_object_name,
72 72
 			'</span>'
73 73
 		);
74
-		$html .= EEH_HTML::td( $name_html, '', 'jst-left' );
74
+		$html .= EEH_HTML::td($name_html, '', 'jst-left');
75 75
 
76 76
 		//Type Column
77
-		$type_html = $line_item->OBJ_type() ? $line_item->OBJ_type_i18n() . '<br />' : '';
77
+		$type_html = $line_item->OBJ_type() ? $line_item->OBJ_type_i18n().'<br />' : '';
78 78
 		$code = $line_item_related_object instanceof EEI_Has_Code ? $line_item_related_object->code() : '';
79
-		$type_html .= ! empty( $code ) ? '<span class="ee-line-item-id">' . sprintf( __( 'Code: %s', 'event_espresso' ), $code ) . '</span>' : '';
80
-		$html .= EEH_HTML::td( $type_html, '', 'jst-left' );
79
+		$type_html .= ! empty($code) ? '<span class="ee-line-item-id">'.sprintf(__('Code: %s', 'event_espresso'), $code).'</span>' : '';
80
+		$html .= EEH_HTML::td($type_html, '', 'jst-left');
81 81
 
82 82
 		//Date column
83 83
 		$datetime_content = '';
84
-		if ( $line_item_related_object instanceof EE_Ticket ) {
84
+		if ($line_item_related_object instanceof EE_Ticket) {
85 85
 			$datetimes = $line_item_related_object->datetimes();
86
-			foreach ( $datetimes as $datetime ) {
87
-				if ( $datetime instanceof EE_Datetime ) {
88
-					$datetime_content .= $datetime->get_dtt_display_name() . '<br>';
86
+			foreach ($datetimes as $datetime) {
87
+				if ($datetime instanceof EE_Datetime) {
88
+					$datetime_content .= $datetime->get_dtt_display_name().'<br>';
89 89
 				}
90 90
 			}
91 91
 		}
92
-		$html .= EEH_HTML::td( $datetime_content, '', 'jst-left' );
92
+		$html .= EEH_HTML::td($datetime_content, '', 'jst-left');
93 93
 
94 94
 		//Amount Column
95
-		if ( $line_item->is_percent() ) {
96
-			$html .= EEH_HTML::td( $line_item->percent() . '%', '', 'jst-rght' );
95
+		if ($line_item->is_percent()) {
96
+			$html .= EEH_HTML::td($line_item->percent().'%', '', 'jst-rght');
97 97
 		} else {
98
-			$html .= EEH_HTML::td( $line_item->unit_price_no_code(), '', 'jst-rght' );
98
+			$html .= EEH_HTML::td($line_item->unit_price_no_code(), '', 'jst-rght');
99 99
 		}
100 100
 
101 101
 
@@ -113,13 +113,13 @@  discard block
 block discarded – undo
113 113
 	 * @param array        $options
114 114
 	 * @return mixed
115 115
 	 */
116
-	protected function _tax_row( EE_Line_Item $line_item, $options = array() ) {
116
+	protected function _tax_row(EE_Line_Item $line_item, $options = array()) {
117 117
 		// start of row
118
-		$html = EEH_HTML::tr( '', 'admin-primary-mbox-taxes-tr' );
118
+		$html = EEH_HTML::tr('', 'admin-primary-mbox-taxes-tr');
119 119
 		// name th
120
-		$html .= EEH_HTML::th(  $line_item->name() . '(' . $line_item->get_pretty( 'LIN_percent' ) . '%)', '',  'jst-rght', '', ' colspan="3"' );
120
+		$html .= EEH_HTML::th($line_item->name().'('.$line_item->get_pretty('LIN_percent').'%)', '', 'jst-rght', '', ' colspan="3"');
121 121
 		// total th
122
-		$html .= EEH_HTML::th( EEH_Template::format_currency( $line_item->total(), false, false ), '', 'jst-rght' );
122
+		$html .= EEH_HTML::th(EEH_Template::format_currency($line_item->total(), false, false), '', 'jst-rght');
123 123
 		// end of row
124 124
 		$html .= EEH_HTML::trx();
125 125
 		return $html;
@@ -136,9 +136,9 @@  discard block
 block discarded – undo
136 136
 	 * @param array        $options
137 137
 	 * @return mixed
138 138
 	 */
139
-	protected function _total_row( EE_Line_Item $line_item, $options = array() ) {
139
+	protected function _total_row(EE_Line_Item $line_item, $options = array()) {
140 140
 
141
-		$registration = isset( $options['EE_Registration'] ) ? $options['EE_Registration'] : null;
141
+		$registration = isset($options['EE_Registration']) ? $options['EE_Registration'] : null;
142 142
 		$registration_total = $registration instanceof EE_Registration ? $registration->pretty_final_price() : 0;
143 143
 		//if no valid registration object then we're not going to show the approximate text.
144 144
 		$total_match = $registration instanceof EE_Registration ? $registration->final_price() == $line_item->total() : true;
@@ -146,26 +146,26 @@  discard block
 block discarded – undo
146 146
 
147 147
 
148 148
 		// start of row
149
-		$html = EEH_HTML::tr( '', '', 'admin-primary-mbox-total-tr' );
149
+		$html = EEH_HTML::tr('', '', 'admin-primary-mbox-total-tr');
150 150
 		// Total th label
151
-		if ( $total_match ) {
152
-			$total_label = sprintf( __( 'This registration\'s total %s:', 'event_espresso' ), '(' . EE_Registry::instance()->CFG->currency->code . ')' );
151
+		if ($total_match) {
152
+			$total_label = sprintf(__('This registration\'s total %s:', 'event_espresso'), '('.EE_Registry::instance()->CFG->currency->code.')');
153 153
 		} else {
154
-			$total_label = sprintf( __( 'This registration\'s approximate total %s', 'event_espresso' ), '(' . EE_Registry::instance()->CFG->currency->code . ')' );
154
+			$total_label = sprintf(__('This registration\'s approximate total %s', 'event_espresso'), '('.EE_Registry::instance()->CFG->currency->code.')');
155 155
 			$total_label .= '<br>';
156 156
 			$total_label .= '<p class="ee-footnote-text">'
157 157
 			                . sprintf(
158
-				                __( 'The registrations\' share of the transaction total is approximate because it might not be possible to evenly divide the transaction total among each registration, and so some registrations may need to pay a penny more than others.  This registration\'s final share is actually %1$s%2$s%3$s.', 'event_espresso' ),
158
+				                __('The registrations\' share of the transaction total is approximate because it might not be possible to evenly divide the transaction total among each registration, and so some registrations may need to pay a penny more than others.  This registration\'s final share is actually %1$s%2$s%3$s.', 'event_espresso'),
159 159
 				                '<strong>',
160 160
 				                $registration_total,
161 161
 				                '</strong>'
162 162
 			                )
163 163
 			                . '</p>';
164 164
 		}
165
-		$html .= EEH_HTML::th( $total_label, '',  'jst-rght',  '',  ' colspan="3"' );
165
+		$html .= EEH_HTML::th($total_label, '', 'jst-rght', '', ' colspan="3"');
166 166
 		// total th
167 167
 
168
-		$html .= EEH_HTML::th( EEH_Template::format_currency( $line_item->total(), false, false ), '',  'jst-rght' );
168
+		$html .= EEH_HTML::th(EEH_Template::format_currency($line_item->total(), false, false), '', 'jst-rght');
169 169
 		// end of row
170 170
 		$html .= EEH_HTML::trx();
171 171
 		return $html;
Please login to merge, or discard this patch.
libraries/line_item_display/EE_SPCO_Line_Item_Display_Strategy.strategy.php 2 patches
Spacing   +118 added lines, -118 removed lines patch added patch discarded remove patch
@@ -69,101 +69,101 @@  discard block
 block discarded – undo
69 69
 	 * @param array        $options
70 70
 	 * @return mixed
71 71
 	 */
72
-	public function display_line_item( EE_Line_Item $line_item, $options = array() ) {
72
+	public function display_line_item(EE_Line_Item $line_item, $options = array()) {
73 73
 
74 74
 		$html = '';
75 75
 		// set some default options and merge with incoming
76 76
 		$default_options = array(
77
-			'show_desc' => true,  // 	true 		false
77
+			'show_desc' => true, // 	true 		false
78 78
 			'odd' => false
79 79
 		);
80
-		$options = array_merge( $default_options, (array)$options );
80
+		$options = array_merge($default_options, (array) $options);
81 81
 
82
-		switch( $line_item->type() ) {
82
+		switch ($line_item->type()) {
83 83
 
84 84
 			case EEM_Line_Item::type_line_item:
85 85
 				$this->_show_taxes = $line_item->is_taxable() ? true : $this->_show_taxes;
86
-				if ( $line_item->OBJ_type() == 'Ticket' ) {
86
+				if ($line_item->OBJ_type() == 'Ticket') {
87 87
 					// item row
88
-					$html .= $this->_ticket_row( $line_item, $options );
88
+					$html .= $this->_ticket_row($line_item, $options);
89 89
 					// got any kids?
90
-					foreach ( $line_item->children() as $child_line_item ) {
91
-						$this->display_line_item( $child_line_item, $options );
90
+					foreach ($line_item->children() as $child_line_item) {
91
+						$this->display_line_item($child_line_item, $options);
92 92
 					}
93 93
 				} else {
94 94
 					// item row
95
-					$html .= $this->_item_row( $line_item, $options );
95
+					$html .= $this->_item_row($line_item, $options);
96 96
 					// got any kids?
97
-					foreach ( $line_item->children() as $child_line_item ) {
98
-						$this->display_line_item( $child_line_item, $options );
97
+					foreach ($line_item->children() as $child_line_item) {
98
+						$this->display_line_item($child_line_item, $options);
99 99
 					}
100 100
 				}
101 101
 				break;
102 102
 
103 103
 			case EEM_Line_Item::type_sub_line_item:
104
-				$html .= $this->_sub_item_row( $line_item, $options );
104
+				$html .= $this->_sub_item_row($line_item, $options);
105 105
 				break;
106 106
 
107 107
 			case EEM_Line_Item::type_sub_total:
108 108
 				static $sub_total = 0;
109 109
 				$event_sub_total = 0;
110
-				$text = __( 'Sub-Total', 'event_espresso' );
111
-				if ( $line_item->OBJ_type() == 'Event' ) {
112
-					$options[ 'event_id' ] = $event_id = $line_item->OBJ_ID();
113
-					if ( ! isset( $this->_events[ $options[ 'event_id' ] ] ) ) {
114
-						$event = EEM_Event::instance()->get_one_by_ID( $options[ 'event_id' ] );
115
-						if ( $event instanceof EE_Event ) {
116
-							if ( $event->default_registration_status() == EEM_Registration::status_id_not_approved ) {
110
+				$text = __('Sub-Total', 'event_espresso');
111
+				if ($line_item->OBJ_type() == 'Event') {
112
+					$options['event_id'] = $event_id = $line_item->OBJ_ID();
113
+					if ( ! isset($this->_events[$options['event_id']])) {
114
+						$event = EEM_Event::instance()->get_one_by_ID($options['event_id']);
115
+						if ($event instanceof EE_Event) {
116
+							if ($event->default_registration_status() == EEM_Registration::status_id_not_approved) {
117 117
 								return '';
118 118
 							}
119 119
 						}
120
-						$this->_events[ $options[ 'event_id' ] ] = 0;
121
-						$html .= $this->_event_row( $line_item );
122
-						$text = __( 'Event Sub-Total', 'event_espresso' );
120
+						$this->_events[$options['event_id']] = 0;
121
+						$html .= $this->_event_row($line_item);
122
+						$text = __('Event Sub-Total', 'event_espresso');
123 123
 					}
124 124
 				}
125 125
 				$child_line_items = $line_item->children();
126 126
 				// loop thru children
127
-				foreach( $child_line_items as $child_line_item ) {
127
+				foreach ($child_line_items as $child_line_item) {
128 128
 					// recursively feed children back into this method
129
-					$html .= $this->display_line_item( $child_line_item, $options );
129
+					$html .= $this->display_line_item($child_line_item, $options);
130 130
 				}
131
-				$event_sub_total += isset( $options[ 'event_id' ] ) ? $this->_events[ $options[ 'event_id' ] ] : 0;
131
+				$event_sub_total += isset($options['event_id']) ? $this->_events[$options['event_id']] : 0;
132 132
 				$sub_total += $event_sub_total;
133 133
 				if (
134 134
 					(
135 135
 						// event subtotals
136 136
 						$line_item->code() != 'pre-tax-subtotal' &&
137
-						count( $child_line_items ) > 1
137
+						count($child_line_items) > 1
138 138
 					)
139 139
 					||
140 140
 					(
141 141
 						// pre-tax subtotals
142 142
 						$line_item->code() == 'pre-tax-subtotal' &&
143
-						count( $this->_events ) > 1
143
+						count($this->_events) > 1
144 144
 					)
145 145
 				) {
146 146
 					$options['sub_total'] = $line_item->OBJ_type() == 'Event' ? $event_sub_total : $sub_total;
147
-					$html .= $this->_sub_total_row( $line_item, $text, $options );
147
+					$html .= $this->_sub_total_row($line_item, $text, $options);
148 148
 				}
149 149
 				break;
150 150
 
151 151
 			case EEM_Line_Item::type_tax:
152
-				if ( $this->_show_taxes ) {
153
-					$this->_taxes_html .= $this->_tax_row( $line_item, $options );
152
+				if ($this->_show_taxes) {
153
+					$this->_taxes_html .= $this->_tax_row($line_item, $options);
154 154
 				}
155 155
 				break;
156 156
 
157 157
 			case EEM_Line_Item::type_tax_sub_total:
158
-				if ( $this->_show_taxes ) {
158
+				if ($this->_show_taxes) {
159 159
 					$child_line_items = $line_item->children();
160 160
 					// loop thru children
161
-					foreach( $child_line_items as $child_line_item ) {
161
+					foreach ($child_line_items as $child_line_item) {
162 162
 						// recursively feed children back into this method
163
-						$html .= $this->display_line_item( $child_line_item, $options );
163
+						$html .= $this->display_line_item($child_line_item, $options);
164 164
 					}
165
-					if ( count( $child_line_items ) > 1 ) {
166
-						$this->_taxes_html .= $this->_total_tax_row( $line_item, __( 'Tax Total', 'event_espresso' ) );
165
+					if (count($child_line_items) > 1) {
166
+						$this->_taxes_html .= $this->_total_tax_row($line_item, __('Tax Total', 'event_espresso'));
167 167
 					}
168 168
 				}
169 169
 				break;
@@ -172,25 +172,25 @@  discard block
 block discarded – undo
172 172
 				// get all child line items
173 173
 				$children = $line_item->children();
174 174
 				// loop thru all non-tax child line items
175
-				foreach( $children as $child_line_item ) {
176
-					if ( $child_line_item->type() != EEM_Line_Item::type_tax_sub_total ) {
175
+				foreach ($children as $child_line_item) {
176
+					if ($child_line_item->type() != EEM_Line_Item::type_tax_sub_total) {
177 177
 						// recursively feed children back into this method
178
-						$html .= $this->display_line_item( $child_line_item, $options );
178
+						$html .= $this->display_line_item($child_line_item, $options);
179 179
 					}
180 180
 				}
181 181
 
182 182
 				// now loop thru  tax child line items
183
-				foreach( $children as $child_line_item ) {
184
-					if ( $child_line_item->type() == EEM_Line_Item::type_tax_sub_total ) {
183
+				foreach ($children as $child_line_item) {
184
+					if ($child_line_item->type() == EEM_Line_Item::type_tax_sub_total) {
185 185
 						// recursively feed children back into this method
186
-						$html .= $this->display_line_item( $child_line_item, $options );
186
+						$html .= $this->display_line_item($child_line_item, $options);
187 187
 					}
188 188
 				}
189 189
 				$html .= $this->_taxes_html;
190
-				$html .= $this->_total_row( $line_item, __('Total', 'event_espresso') );
190
+				$html .= $this->_total_row($line_item, __('Total', 'event_espresso'));
191 191
 
192 192
 
193
-				$html .= $this->_payments_and_amount_owing_rows( $line_item, $options );
193
+				$html .= $this->_payments_and_amount_owing_rows($line_item, $options);
194 194
 				break;
195 195
 
196 196
 		}
@@ -205,11 +205,11 @@  discard block
 block discarded – undo
205 205
 	 * @param EE_Line_Item $line_item
206 206
 	 * @return mixed
207 207
 	 */
208
-	private function _event_row( EE_Line_Item $line_item ) {
208
+	private function _event_row(EE_Line_Item $line_item) {
209 209
 		// start of row
210
-		$html = EEH_HTML::tr( '', 'event-cart-total-row', 'total_tr odd' );
210
+		$html = EEH_HTML::tr('', 'event-cart-total-row', 'total_tr odd');
211 211
 		// event name td
212
-		$html .= EEH_HTML::td( EEH_HTML::strong( $line_item->name() ), '', 'event-header', '', ' colspan="4"' );
212
+		$html .= EEH_HTML::td(EEH_HTML::strong($line_item->name()), '', 'event-header', '', ' colspan="4"');
213 213
 		// end of row
214 214
 		$html .= EEH_HTML::trx();
215 215
 		return $html;
@@ -224,10 +224,10 @@  discard block
 block discarded – undo
224 224
 	 * @param array        $options
225 225
 	 * @return mixed
226 226
 	 */
227
-	private function _ticket_row( EE_Line_Item $line_item, $options = array() ) {
227
+	private function _ticket_row(EE_Line_Item $line_item, $options = array()) {
228 228
 		// start of row
229 229
 		$row_class = $options['odd'] ? 'item odd' : 'item';
230
-		$html = EEH_HTML::tr( '', '', $row_class );
230
+		$html = EEH_HTML::tr('', '', $row_class);
231 231
 		// name && desc
232 232
 		$name_and_desc = apply_filters(
233 233
 			'FHEE__EE_SPCO_Line_Item_Display_Strategy__item_row__name',
@@ -236,23 +236,23 @@  discard block
 block discarded – undo
236 236
 		);
237 237
 		$name_and_desc .= apply_filters(
238 238
 			'FHEE__EE_SPCO_Line_Item_Display_Strategy__item_row__desc',
239
-			( $options['show_desc'] ? '<span class="line-item-desc-spn smaller-text">: ' . $line_item->desc() . '</span>' : '' ),
239
+			($options['show_desc'] ? '<span class="line-item-desc-spn smaller-text">: '.$line_item->desc().'</span>' : ''),
240 240
 			$line_item,
241 241
 			$options
242 242
 		);
243 243
 		$name_and_desc .= $line_item->is_taxable() ? ' * ' : '';
244 244
 		// name td
245
-		$html .= EEH_HTML::td( /*__FUNCTION__ .*/ $name_and_desc, '',  'item_l' );
245
+		$html .= EEH_HTML::td( /*__FUNCTION__ .*/ $name_and_desc, '', 'item_l' );
246 246
 		// price td
247
-		$html .= EEH_HTML::td( $line_item->unit_price_no_code(), '',  'item_c jst-rght' );
247
+		$html .= EEH_HTML::td($line_item->unit_price_no_code(), '', 'item_c jst-rght');
248 248
 		// quantity td
249
-		$html .= EEH_HTML::td( $line_item->quantity(), '', 'item_l jst-rght' );
249
+		$html .= EEH_HTML::td($line_item->quantity(), '', 'item_l jst-rght');
250 250
 		$this->_total_items += $line_item->quantity();
251 251
 		// determine total for line item
252 252
 		$total = $line_item->total();
253
-		$this->_events[ $options[ 'event_id' ] ] += $total;
253
+		$this->_events[$options['event_id']] += $total;
254 254
 		// total td
255
-		$html .= EEH_HTML::td( EEH_Template::format_currency( $total, false, false ), '',  'item_r jst-rght' );
255
+		$html .= EEH_HTML::td(EEH_Template::format_currency($total, false, false), '', 'item_r jst-rght');
256 256
 		// end of row
257 257
 		$html .= EEH_HTML::trx();
258 258
 		return $html;
@@ -267,41 +267,41 @@  discard block
 block discarded – undo
267 267
 	 * @param array        $options
268 268
 	 * @return mixed
269 269
 	 */
270
-	private function _item_row( EE_Line_Item $line_item, $options = array() ) {
270
+	private function _item_row(EE_Line_Item $line_item, $options = array()) {
271 271
 		// start of row
272 272
 		$row_class = $options['odd'] ? 'item odd' : 'item';
273
-		$html = EEH_HTML::tr( '', '', $row_class );
274
-		$obj_name = $line_item->OBJ_type() ? $line_item->OBJ_type_i18n() . ': ' : '';
273
+		$html = EEH_HTML::tr('', '', $row_class);
274
+		$obj_name = $line_item->OBJ_type() ? $line_item->OBJ_type_i18n().': ' : '';
275 275
 		// name && desc
276 276
 		$name_and_desc = apply_filters(
277 277
 			'FHEE__EE_SPCO_Line_Item_Display_Strategy__item_row__name',
278
-			 $obj_name . $line_item->name(),
278
+			 $obj_name.$line_item->name(),
279 279
 			$line_item
280 280
 		);
281 281
 		$name_and_desc .= apply_filters(
282 282
 			'FHEE__EE_SPCO_Line_Item_Display_Strategy__item_row__desc',
283
-			( $options['show_desc'] ? '<span class="line-item-desc-spn smaller-text">: ' . $line_item->desc() . '</span>' : '' ),
283
+			($options['show_desc'] ? '<span class="line-item-desc-spn smaller-text">: '.$line_item->desc().'</span>' : ''),
284 284
 			$line_item,
285 285
 			$options
286 286
 		);
287 287
 		$name_and_desc .= $line_item->is_taxable() ? ' * ' : '';
288 288
 		// name td
289
-		$html .= EEH_HTML::td( $name_and_desc, '',  'item_l' );
289
+		$html .= EEH_HTML::td($name_and_desc, '', 'item_l');
290 290
 		// price td
291
-		if ( $line_item->is_percent() ) {
292
-			$html .= EEH_HTML::td( $line_item->percent() . '%', '', 'item_c jst-rght' );
291
+		if ($line_item->is_percent()) {
292
+			$html .= EEH_HTML::td($line_item->percent().'%', '', 'item_c jst-rght');
293 293
 		} else {
294
-			$html .= EEH_HTML::td( $line_item->unit_price_no_code(), '', 'item_c jst-rght' );
294
+			$html .= EEH_HTML::td($line_item->unit_price_no_code(), '', 'item_c jst-rght');
295 295
 		}
296 296
 		// quantity td
297
-		$html .= EEH_HTML::td( $line_item->quantity(), '', 'item_l jst-rght' );
297
+		$html .= EEH_HTML::td($line_item->quantity(), '', 'item_l jst-rght');
298 298
 		//$total = $line_item->total() * $line_item->quantity();
299 299
 		$total = $line_item->total();
300
-		if( isset( $options[ 'event_id' ] ) && isset( $this->_events[ $options[ 'event_id' ] ] ) ) {
301
-			$this->_events[ $options[ 'event_id' ] ] += $total;
300
+		if (isset($options['event_id']) && isset($this->_events[$options['event_id']])) {
301
+			$this->_events[$options['event_id']] += $total;
302 302
 		}
303 303
 		// total td
304
-		$html .= EEH_HTML::td( EEH_Template::format_currency( $total, false, false ), '',  'item_r jst-rght' );
304
+		$html .= EEH_HTML::td(EEH_Template::format_currency($total, false, false), '', 'item_r jst-rght');
305 305
 		// end of row
306 306
 		$html .= EEH_HTML::trx();
307 307
 		return $html;
@@ -316,22 +316,22 @@  discard block
 block discarded – undo
316 316
 	 * @param array        $options
317 317
 	 * @return mixed
318 318
 	 */
319
-	private function _sub_item_row( EE_Line_Item $line_item, $options = array() ) {
319
+	private function _sub_item_row(EE_Line_Item $line_item, $options = array()) {
320 320
 		// start of row
321
-		$html = EEH_HTML::tr( '', 'item sub-item-row' );
321
+		$html = EEH_HTML::tr('', 'item sub-item-row');
322 322
 		// name && desc
323 323
 		$name_and_desc = $line_item->name();
324
-		$name_and_desc .= $options['show_desc'] ? '<span class="line-sub-item-desc-spn smaller-text">: ' . $line_item->desc() . '</span>' : '';
324
+		$name_and_desc .= $options['show_desc'] ? '<span class="line-sub-item-desc-spn smaller-text">: '.$line_item->desc().'</span>' : '';
325 325
 		// name td
326
-		$html .= EEH_HTML::td( /*__FUNCTION__ .*/ $name_and_desc, '',  'item_l sub-item' );
326
+		$html .= EEH_HTML::td( /*__FUNCTION__ .*/ $name_and_desc, '', 'item_l sub-item' );
327 327
 		// discount/surcharge td
328
-		if ( $line_item->is_percent() ) {
329
-			$html .= EEH_HTML::td( $line_item->percent() . '%', '',  'item_c' );
328
+		if ($line_item->is_percent()) {
329
+			$html .= EEH_HTML::td($line_item->percent().'%', '', 'item_c');
330 330
 		} else {
331
-			$html .= EEH_HTML::td( $line_item->unit_price_no_code(), '',  'item_c jst-rght' );
331
+			$html .= EEH_HTML::td($line_item->unit_price_no_code(), '', 'item_c jst-rght');
332 332
 		}
333 333
 		// total td
334
-		$html .= EEH_HTML::td( EEH_Template::format_currency( $line_item->total(), false, false ), '',  'item_r jst-rght' );
334
+		$html .= EEH_HTML::td(EEH_Template::format_currency($line_item->total(), false, false), '', 'item_r jst-rght');
335 335
 		// end of row
336 336
 		$html .= EEH_HTML::trx();
337 337
 		return $html;
@@ -346,21 +346,21 @@  discard block
 block discarded – undo
346 346
 	 * @param array        $options
347 347
 	 * @return mixed
348 348
 	 */
349
-	private function _tax_row( EE_Line_Item $line_item, $options = array() ) {
349
+	private function _tax_row(EE_Line_Item $line_item, $options = array()) {
350 350
 		// start of row
351
-		$html = EEH_HTML::tr( '', 'item sub-item tax-total' );
351
+		$html = EEH_HTML::tr('', 'item sub-item tax-total');
352 352
 		// name && desc
353 353
 		$name_and_desc = $line_item->name();
354
-		$name_and_desc .= '<span class="smaller-text lt-grey-text" style="margin:0 0 0 2em;">' . __( ' * taxable items', 'event_espresso' ) . '</span>';
355
-		$name_and_desc .= $options[ 'show_desc' ] ? '<br/>' . $line_item->desc() : '';
354
+		$name_and_desc .= '<span class="smaller-text lt-grey-text" style="margin:0 0 0 2em;">'.__(' * taxable items', 'event_espresso').'</span>';
355
+		$name_and_desc .= $options['show_desc'] ? '<br/>'.$line_item->desc() : '';
356 356
 		// name td
357
-		$html .= EEH_HTML::td( /*__FUNCTION__ .*/ $name_and_desc, '',  'item_l sub-item' );
357
+		$html .= EEH_HTML::td( /*__FUNCTION__ .*/ $name_and_desc, '', 'item_l sub-item' );
358 358
 		// percent td
359
-		$html .= EEH_HTML::td( $line_item->percent() . '%', '',  ' jst-rght', '' );
359
+		$html .= EEH_HTML::td($line_item->percent().'%', '', ' jst-rght', '');
360 360
 		// empty td (price)
361
-		$html .= EEH_HTML::td( EEH_HTML::nbsp() );
361
+		$html .= EEH_HTML::td(EEH_HTML::nbsp());
362 362
 		// total td
363
-		$html .= EEH_HTML::td( EEH_Template::format_currency( $line_item->total(), false, false ), '',  'item_r jst-rght' );
363
+		$html .= EEH_HTML::td(EEH_Template::format_currency($line_item->total(), false, false), '', 'item_r jst-rght');
364 364
 		// end of row
365 365
 		$html .= EEH_HTML::trx();
366 366
 		return $html;
@@ -375,17 +375,17 @@  discard block
 block discarded – undo
375 375
 	 * @param string $text
376 376
 	 * @return mixed
377 377
 	 */
378
-	private function _total_tax_row( EE_Line_Item $line_item, $text = '' ) {
378
+	private function _total_tax_row(EE_Line_Item $line_item, $text = '') {
379 379
 		$html = '';
380
-		if ( $line_item->total() ) {
380
+		if ($line_item->total()) {
381 381
 			// start of row
382
-			$html = EEH_HTML::tr( '', '', 'total_tr odd' );
382
+			$html = EEH_HTML::tr('', '', 'total_tr odd');
383 383
 			// total td
384
-			$html .= EEH_HTML::td( $text, '', 'total_currency total jst-rght', '', ' colspan="2"' );
384
+			$html .= EEH_HTML::td($text, '', 'total_currency total jst-rght', '', ' colspan="2"');
385 385
 			// empty td (price)
386
-			$html .= EEH_HTML::td( EEH_HTML::nbsp() );
386
+			$html .= EEH_HTML::td(EEH_HTML::nbsp());
387 387
 			// total td
388
-			$html .= EEH_HTML::td( EEH_Template::format_currency( $line_item->total(), false, false ), '', 'total jst-rght' );
388
+			$html .= EEH_HTML::td(EEH_Template::format_currency($line_item->total(), false, false), '', 'total jst-rght');
389 389
 			// end of row
390 390
 			$html .= EEH_HTML::trx();
391 391
 		}
@@ -402,15 +402,15 @@  discard block
 block discarded – undo
402 402
 	 * @param array        $options
403 403
 	 * @return mixed
404 404
 	 */
405
-	private function _sub_total_row( EE_Line_Item $line_item, $text = '', $options = array() ) {
405
+	private function _sub_total_row(EE_Line_Item $line_item, $text = '', $options = array()) {
406 406
 		$html = '';
407
-		if ( $line_item->total() ) {
407
+		if ($line_item->total()) {
408 408
 			// start of row
409
-			$html = EEH_HTML::tr( '', '', 'total_tr odd' );
409
+			$html = EEH_HTML::tr('', '', 'total_tr odd');
410 410
 			// total td
411
-			$html .= EEH_HTML::td( $text, '', 'total_currency total jst-rght', '', ' colspan="3"' );
411
+			$html .= EEH_HTML::td($text, '', 'total_currency total jst-rght', '', ' colspan="3"');
412 412
 			// total td
413
-			$html .= EEH_HTML::td( EEH_Template::format_currency( $options[ 'sub_total' ], false, false ), '', 'total jst-rght' );
413
+			$html .= EEH_HTML::td(EEH_Template::format_currency($options['sub_total'], false, false), '', 'total jst-rght');
414 414
 			// end of row
415 415
 			$html .= EEH_HTML::trx();
416 416
 		}
@@ -427,13 +427,13 @@  discard block
 block discarded – undo
427 427
 	 * @param string       $text
428 428
 	 * @return mixed
429 429
 	 */
430
-	private function _total_row( EE_Line_Item $line_item, $text = '' ) {
430
+	private function _total_row(EE_Line_Item $line_item, $text = '') {
431 431
 		// start of row
432
-		$html = EEH_HTML::tr( '', '', 'spco-grand-total total_tr odd' );
432
+		$html = EEH_HTML::tr('', '', 'spco-grand-total total_tr odd');
433 433
 		// total td
434
-		$html .= EEH_HTML::td( $text, '',  'total_currency total jst-rght',  '',  ' colspan="3"' );
434
+		$html .= EEH_HTML::td($text, '', 'total_currency total jst-rght', '', ' colspan="3"');
435 435
 		// total td
436
-		$html .= EEH_HTML::td( EEH_Template::format_currency( $line_item->total(), false, false ), '',  'total jst-rght' );
436
+		$html .= EEH_HTML::td(EEH_Template::format_currency($line_item->total(), false, false), '', 'total jst-rght');
437 437
 		// end of row
438 438
 		$html .= EEH_HTML::trx();
439 439
 		return $html;
@@ -448,30 +448,30 @@  discard block
 block discarded – undo
448 448
 	 * @param array        $options
449 449
 	 * @return mixed
450 450
 	 */
451
-	private function _payments_and_amount_owing_rows( EE_Line_Item $line_item, $options = array() ) {
451
+	private function _payments_and_amount_owing_rows(EE_Line_Item $line_item, $options = array()) {
452 452
 		$html = '';
453 453
 		$owing = $line_item->total();
454
-		$transaction = EEM_Transaction::instance()->get_one_by_ID( $line_item->TXN_ID() );
455
-		if ( $transaction instanceof EE_Transaction ) {
454
+		$transaction = EEM_Transaction::instance()->get_one_by_ID($line_item->TXN_ID());
455
+		if ($transaction instanceof EE_Transaction) {
456 456
 			$registration_payments = array();
457
-			$registrations = ! empty( $options['registrations'] )
458
-				? $options[ 'registrations' ]
457
+			$registrations = ! empty($options['registrations'])
458
+				? $options['registrations']
459 459
 				: $transaction->registrations();
460
-			foreach ( $registrations as $registration ) {
461
-				if ( $registration instanceof EE_Registration && $registration->owes_monies_and_can_pay() ) {
460
+			foreach ($registrations as $registration) {
461
+				if ($registration instanceof EE_Registration && $registration->owes_monies_and_can_pay()) {
462 462
 					$registration_payments = $registration_payments + $registration->registration_payments();
463 463
 				}
464 464
 			}
465
-			if ( ! empty( $registration_payments )) {
466
-				foreach ( $registration_payments as $registration_payment ) {
467
-					if ( $registration_payment instanceof EE_Registration_Payment ) {
465
+			if ( ! empty($registration_payments)) {
466
+				foreach ($registration_payments as $registration_payment) {
467
+					if ($registration_payment instanceof EE_Registration_Payment) {
468 468
 						$owing = $owing - $registration_payment->amount();
469 469
 						$payment = $registration_payment->payment();
470
-						if ( $payment instanceof EE_Payment ) {
470
+						if ($payment instanceof EE_Payment) {
471 471
 							$payment_desc = sprintf(
472
-								__( 'Payment%1$s Received: %2$s', 'event_espresso' ),
472
+								__('Payment%1$s Received: %2$s', 'event_espresso'),
473 473
 								$payment->txn_id_chq_nmbr() != ''
474
-									? ' <span class="small-text">(#' . $payment->txn_id_chq_nmbr() . ')</span> '
474
+									? ' <span class="small-text">(#'.$payment->txn_id_chq_nmbr().')</span> '
475 475
 									: '',
476 476
 								$payment->timestamp()
477 477
 							);
@@ -479,12 +479,12 @@  discard block
 block discarded – undo
479 479
 							$payment_desc = '';
480 480
 						}
481 481
 						// start of row
482
-						$html .= EEH_HTML::tr( '', '', 'total_tr odd' );
482
+						$html .= EEH_HTML::tr('', '', 'total_tr odd');
483 483
 						// payment desc
484
-						$html .= EEH_HTML::td( $payment_desc, '', '', '', ' colspan="3"' );
484
+						$html .= EEH_HTML::td($payment_desc, '', '', '', ' colspan="3"');
485 485
 						// total td
486 486
 						$html .= EEH_HTML::td(
487
-							EEH_Template::format_currency( $registration_payment->amount(), false, false ),
487
+							EEH_Template::format_currency($registration_payment->amount(), false, false),
488 488
 							'',
489 489
 							'total jst-rght'
490 490
 						);
@@ -492,17 +492,17 @@  discard block
 block discarded – undo
492 492
 						$html .= EEH_HTML::trx();
493 493
 					}
494 494
 				}
495
-				if ( $line_item->total() ) {
495
+				if ($line_item->total()) {
496 496
 					// start of row
497
-					$html .= EEH_HTML::tr( '', '', 'total_tr odd' );
497
+					$html .= EEH_HTML::tr('', '', 'total_tr odd');
498 498
 					// total td
499 499
 					$html .= EEH_HTML::td(
500 500
 						__('Amount Owing', 'event_espresso'),
501
-						'',  'total_currency total jst-rght',  '',  ' colspan="3"'
501
+						'', 'total_currency total jst-rght', '', ' colspan="3"'
502 502
 					);
503 503
 					// total td
504 504
 					$html .= EEH_HTML::td(
505
-						EEH_Template::format_currency( $owing, false, false ), '',  'total jst-rght'
505
+						EEH_Template::format_currency($owing, false, false), '', 'total jst-rght'
506 506
 					);
507 507
 					// end of row
508 508
 					$html .= EEH_HTML::trx();
Please login to merge, or discard this patch.
Doc Comments   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 	/**
68 68
 	 * @param EE_Line_Item $line_item
69 69
 	 * @param array        $options
70
-	 * @return mixed
70
+	 * @return string
71 71
 	 */
72 72
 	public function display_line_item( EE_Line_Item $line_item, $options = array() ) {
73 73
 
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
 	 *    _event_row - basically a Heading row displayed once above each event's ticket rows
204 204
 	 *
205 205
 	 * @param EE_Line_Item $line_item
206
-	 * @return mixed
206
+	 * @return string
207 207
 	 */
208 208
 	private function _event_row( EE_Line_Item $line_item ) {
209 209
 		// start of row
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
 	 *
223 223
 	 * @param EE_Line_Item $line_item
224 224
 	 * @param array        $options
225
-	 * @return mixed
225
+	 * @return string
226 226
 	 */
227 227
 	private function _ticket_row( EE_Line_Item $line_item, $options = array() ) {
228 228
 		// start of row
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
 	 *
266 266
 	 * @param EE_Line_Item $line_item
267 267
 	 * @param array        $options
268
-	 * @return mixed
268
+	 * @return string
269 269
 	 */
270 270
 	private function _item_row( EE_Line_Item $line_item, $options = array() ) {
271 271
 		// start of row
@@ -314,7 +314,7 @@  discard block
 block discarded – undo
314 314
 	 *
315 315
 	 * @param EE_Line_Item $line_item
316 316
 	 * @param array        $options
317
-	 * @return mixed
317
+	 * @return string
318 318
 	 */
319 319
 	private function _sub_item_row( EE_Line_Item $line_item, $options = array() ) {
320 320
 		// start of row
@@ -344,7 +344,7 @@  discard block
 block discarded – undo
344 344
 	 *
345 345
 	 * @param EE_Line_Item $line_item
346 346
 	 * @param array        $options
347
-	 * @return mixed
347
+	 * @return string
348 348
 	 */
349 349
 	private function _tax_row( EE_Line_Item $line_item, $options = array() ) {
350 350
 		// start of row
@@ -373,7 +373,7 @@  discard block
 block discarded – undo
373 373
 	 *
374 374
 	 * @param EE_Line_Item $line_item
375 375
 	 * @param string $text
376
-	 * @return mixed
376
+	 * @return string
377 377
 	 */
378 378
 	private function _total_tax_row( EE_Line_Item $line_item, $text = '' ) {
379 379
 		$html = '';
@@ -400,7 +400,7 @@  discard block
 block discarded – undo
400 400
 	 * @param EE_Line_Item $line_item
401 401
 	 * @param string       $text
402 402
 	 * @param array        $options
403
-	 * @return mixed
403
+	 * @return string
404 404
 	 */
405 405
 	private function _sub_total_row( EE_Line_Item $line_item, $text = '', $options = array() ) {
406 406
 		$html = '';
@@ -425,7 +425,7 @@  discard block
 block discarded – undo
425 425
 	 *
426 426
 	 * @param EE_Line_Item $line_item
427 427
 	 * @param string       $text
428
-	 * @return mixed
428
+	 * @return string
429 429
 	 */
430 430
 	private function _total_row( EE_Line_Item $line_item, $text = '' ) {
431 431
 		// start of row
@@ -446,7 +446,7 @@  discard block
 block discarded – undo
446 446
 	 *
447 447
 	 * @param EE_Line_Item $line_item
448 448
 	 * @param array        $options
449
-	 * @return mixed
449
+	 * @return string
450 450
 	 */
451 451
 	private function _payments_and_amount_owing_rows( EE_Line_Item $line_item, $options = array() ) {
452 452
 		$html = '';
Please login to merge, or discard this patch.
core/db_classes/EE_Payment.class.php 2 patches
Spacing   +103 added lines, -103 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1
-<?php if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
2
-	exit( 'No direct script access allowed' );
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3 3
 }
4 4
 
5 5
 /**
@@ -20,9 +20,9 @@  discard block
 block discarded – undo
20 20
 	 * @return EE_Payment
21 21
 	 * @throws \EE_Error
22 22
 	 */
23
-	public static function new_instance( $props_n_values = array(), $timezone = null, $date_formats = array() ) {
24
-		$has_object = parent::_check_for_object( $props_n_values, __CLASS__, $timezone, $date_formats );
25
-		return $has_object ? $has_object : new self( $props_n_values, false, $timezone, $date_formats );
23
+	public static function new_instance($props_n_values = array(), $timezone = null, $date_formats = array()) {
24
+		$has_object = parent::_check_for_object($props_n_values, __CLASS__, $timezone, $date_formats);
25
+		return $has_object ? $has_object : new self($props_n_values, false, $timezone, $date_formats);
26 26
 	}
27 27
 
28 28
 
@@ -34,8 +34,8 @@  discard block
 block discarded – undo
34 34
 	 * @return EE_Payment
35 35
 	 * @throws \EE_Error
36 36
 	 */
37
-	public static function new_instance_from_db( $props_n_values = array(), $timezone = null ) {
38
-		return new self( $props_n_values, true, $timezone );
37
+	public static function new_instance_from_db($props_n_values = array(), $timezone = null) {
38
+		return new self($props_n_values, true, $timezone);
39 39
 	}
40 40
 
41 41
 
@@ -47,8 +47,8 @@  discard block
 block discarded – undo
47 47
 	 * @param int $TXN_ID
48 48
 	 * @throws \EE_Error
49 49
 	 */
50
-	public function set_transaction_id( $TXN_ID = 0 ) {
51
-		$this->set( 'TXN_ID', $TXN_ID );
50
+	public function set_transaction_id($TXN_ID = 0) {
51
+		$this->set('TXN_ID', $TXN_ID);
52 52
 	}
53 53
 
54 54
 
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 	 * @throws \EE_Error
61 61
 	 */
62 62
 	public function transaction() {
63
-		return $this->get_first_related( 'Transaction' );
63
+		return $this->get_first_related('Transaction');
64 64
 	}
65 65
 
66 66
 
@@ -72,8 +72,8 @@  discard block
 block discarded – undo
72 72
 	 * @param string $STS_ID
73 73
 	 * @throws \EE_Error
74 74
 	 */
75
-	public function set_status( $STS_ID = '' ) {
76
-		$this->set( 'STS_ID', $STS_ID );
75
+	public function set_status($STS_ID = '') {
76
+		$this->set('STS_ID', $STS_ID);
77 77
 	}
78 78
 
79 79
 
@@ -85,8 +85,8 @@  discard block
 block discarded – undo
85 85
 	 * @param int $timestamp
86 86
 	 * @throws \EE_Error
87 87
 	 */
88
-	public function set_timestamp( $timestamp = 0 ) {
89
-		$this->set( 'PAY_timestamp', $timestamp );
88
+	public function set_timestamp($timestamp = 0) {
89
+		$this->set('PAY_timestamp', $timestamp);
90 90
 	}
91 91
 
92 92
 
@@ -98,8 +98,8 @@  discard block
 block discarded – undo
98 98
 	 * @param string $PAY_source
99 99
 	 * @throws \EE_Error
100 100
 	 */
101
-	public function set_source( $PAY_source = '' ) {
102
-		$this->set( 'PAY_source', $PAY_source );
101
+	public function set_source($PAY_source = '') {
102
+		$this->set('PAY_source', $PAY_source);
103 103
 	}
104 104
 
105 105
 
@@ -111,8 +111,8 @@  discard block
 block discarded – undo
111 111
 	 * @param float $amount
112 112
 	 * @throws \EE_Error
113 113
 	 */
114
-	public function set_amount( $amount = 0.00 ) {
115
-		$this->set( 'PAY_amount', (float)$amount );
114
+	public function set_amount($amount = 0.00) {
115
+		$this->set('PAY_amount', (float) $amount);
116 116
 	}
117 117
 
118 118
 
@@ -124,8 +124,8 @@  discard block
 block discarded – undo
124 124
 	 * @param string $gateway_response
125 125
 	 * @throws \EE_Error
126 126
 	 */
127
-	public function set_gateway_response( $gateway_response = '' ) {
128
-		$this->set( 'PAY_gateway_response', $gateway_response );
127
+	public function set_gateway_response($gateway_response = '') {
128
+		$this->set('PAY_gateway_response', $gateway_response);
129 129
 	}
130 130
 
131 131
 
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
 			),
149 149
 			'4.6.0'
150 150
 		);
151
-		return $this->payment_method() ? $this->payment_method()->name() : __( 'Unknown', 'event_espresso' );
151
+		return $this->payment_method() ? $this->payment_method()->name() : __('Unknown', 'event_espresso');
152 152
 	}
153 153
 
154 154
 
@@ -160,8 +160,8 @@  discard block
 block discarded – undo
160 160
 	 * @param string $txn_id_chq_nmbr
161 161
 	 * @throws \EE_Error
162 162
 	 */
163
-	public function set_txn_id_chq_nmbr( $txn_id_chq_nmbr = '' ) {
164
-		$this->set( 'PAY_txn_id_chq_nmbr', $txn_id_chq_nmbr );
163
+	public function set_txn_id_chq_nmbr($txn_id_chq_nmbr = '') {
164
+		$this->set('PAY_txn_id_chq_nmbr', $txn_id_chq_nmbr);
165 165
 	}
166 166
 
167 167
 
@@ -173,8 +173,8 @@  discard block
 block discarded – undo
173 173
 	 * @param string $po_number
174 174
 	 * @throws \EE_Error
175 175
 	 */
176
-	public function set_po_number( $po_number = '' ) {
177
-		$this->set( 'PAY_po_number', $po_number );
176
+	public function set_po_number($po_number = '') {
177
+		$this->set('PAY_po_number', $po_number);
178 178
 	}
179 179
 
180 180
 
@@ -186,8 +186,8 @@  discard block
 block discarded – undo
186 186
 	 * @param string $extra_accntng
187 187
 	 * @throws \EE_Error
188 188
 	 */
189
-	public function set_extra_accntng( $extra_accntng = '' ) {
190
-		$this->set( 'PAY_extra_accntng', $extra_accntng );
189
+	public function set_extra_accntng($extra_accntng = '') {
190
+		$this->set('PAY_extra_accntng', $extra_accntng);
191 191
 	}
192 192
 
193 193
 
@@ -199,11 +199,11 @@  discard block
 block discarded – undo
199 199
 	 * @param bool $via_admin
200 200
 	 * @throws \EE_Error
201 201
 	 */
202
-	public function set_payment_made_via_admin( $via_admin = false ) {
203
-		if ( $via_admin ) {
204
-			$this->set( 'PAY_source', EEM_Payment_Method::scope_admin );
202
+	public function set_payment_made_via_admin($via_admin = false) {
203
+		if ($via_admin) {
204
+			$this->set('PAY_source', EEM_Payment_Method::scope_admin);
205 205
 		} else {
206
-			$this->set( 'PAY_source', EEM_Payment_Method::scope_cart );
206
+			$this->set('PAY_source', EEM_Payment_Method::scope_cart);
207 207
 		}
208 208
 	}
209 209
 
@@ -216,13 +216,13 @@  discard block
 block discarded – undo
216 216
 	 * @param string|array $details
217 217
 	 * @throws \EE_Error
218 218
 	 */
219
-	public function set_details( $details = '' ) {
220
-		if ( is_array( $details ) ) {
221
-			array_walk_recursive( $details, array( $this, '_strip_all_tags_within_array' ) );
219
+	public function set_details($details = '') {
220
+		if (is_array($details)) {
221
+			array_walk_recursive($details, array($this, '_strip_all_tags_within_array'));
222 222
 		} else {
223
-			$details = wp_strip_all_tags( $details );
223
+			$details = wp_strip_all_tags($details);
224 224
 		}
225
-		$this->set( 'PAY_details', $details );
225
+		$this->set('PAY_details', $details);
226 226
 	}
227 227
 
228 228
 
@@ -233,8 +233,8 @@  discard block
 block discarded – undo
233 233
 	 * @param string $redirect_url
234 234
 	 * @throws \EE_Error
235 235
 	 */
236
-	public function set_redirect_url( $redirect_url ) {
237
-		$this->set( 'PAY_redirect_url', $redirect_url );
236
+	public function set_redirect_url($redirect_url) {
237
+		$this->set('PAY_redirect_url', $redirect_url);
238 238
 	}
239 239
 
240 240
 
@@ -245,8 +245,8 @@  discard block
 block discarded – undo
245 245
 	 * @param array $redirect_args
246 246
 	 * @throws \EE_Error
247 247
 	 */
248
-	public function set_redirect_args( $redirect_args ) {
249
-		$this->set( 'PAY_redirect_args', $redirect_args );
248
+	public function set_redirect_args($redirect_args) {
249
+		$this->set('PAY_redirect_args', $redirect_args);
250 250
 	}
251 251
 
252 252
 
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
 	 * @throws \EE_Error
259 259
 	 */
260 260
 	public function TXN_ID() {
261
-		return $this->get( 'TXN_ID' );
261
+		return $this->get('TXN_ID');
262 262
 	}
263 263
 
264 264
 
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
 	 * @throws \EE_Error
271 271
 	 */
272 272
 	public function status() {
273
-		return $this->get( 'STS_ID' );
273
+		return $this->get('STS_ID');
274 274
 	}
275 275
 
276 276
 
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
 	 * @throws \EE_Error
283 283
 	 */
284 284
 	public function STS_ID() {
285
-		return $this->get( 'STS_ID' );
285
+		return $this->get('STS_ID');
286 286
 	}
287 287
 
288 288
 
@@ -296,8 +296,8 @@  discard block
 block discarded – undo
296 296
 	 * @return string
297 297
 	 * @throws \EE_Error
298 298
 	 */
299
-	public function timestamp( $dt_frmt = '', $tm_frmt = '' ) {
300
-		return $this->get_i18n_datetime( 'PAY_timestamp', trim( $dt_frmt . ' ' . $tm_frmt) );
299
+	public function timestamp($dt_frmt = '', $tm_frmt = '') {
300
+		return $this->get_i18n_datetime('PAY_timestamp', trim($dt_frmt.' '.$tm_frmt));
301 301
 	}
302 302
 
303 303
 
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
 	 * @throws \EE_Error
310 310
 	 */
311 311
 	public function source() {
312
-		return $this->get( 'PAY_source' );
312
+		return $this->get('PAY_source');
313 313
 	}
314 314
 
315 315
 
@@ -322,7 +322,7 @@  discard block
 block discarded – undo
322 322
 	 * @throws \EE_Error
323 323
 	 */
324 324
 	public function amount() {
325
-		return (float)$this->get( 'PAY_amount' );
325
+		return (float) $this->get('PAY_amount');
326 326
 	}
327 327
 
328 328
 
@@ -332,7 +332,7 @@  discard block
 block discarded – undo
332 332
 	 * @throws \EE_Error
333 333
 	 */
334 334
 	public function amount_no_code() {
335
-		return $this->get_pretty( 'PAY_amount', 'no_currency_code' );
335
+		return $this->get_pretty('PAY_amount', 'no_currency_code');
336 336
 	}
337 337
 
338 338
 
@@ -344,7 +344,7 @@  discard block
 block discarded – undo
344 344
 	 * @throws \EE_Error
345 345
 	 */
346 346
 	public function gateway_response() {
347
-		return $this->get( 'PAY_gateway_response' );
347
+		return $this->get('PAY_gateway_response');
348 348
 	}
349 349
 
350 350
 
@@ -356,7 +356,7 @@  discard block
 block discarded – undo
356 356
 	 * @throws \EE_Error
357 357
 	 */
358 358
 	public function txn_id_chq_nmbr() {
359
-		return $this->get( 'PAY_txn_id_chq_nmbr' );
359
+		return $this->get('PAY_txn_id_chq_nmbr');
360 360
 	}
361 361
 
362 362
 
@@ -368,7 +368,7 @@  discard block
 block discarded – undo
368 368
 	 * @throws \EE_Error
369 369
 	 */
370 370
 	public function po_number() {
371
-		return $this->get( 'PAY_po_number' );
371
+		return $this->get('PAY_po_number');
372 372
 	}
373 373
 
374 374
 
@@ -380,7 +380,7 @@  discard block
 block discarded – undo
380 380
 	 * @throws \EE_Error
381 381
 	 */
382 382
 	public function extra_accntng() {
383
-		return $this->get( 'PAY_extra_accntng' );
383
+		return $this->get('PAY_extra_accntng');
384 384
 	}
385 385
 
386 386
 
@@ -392,7 +392,7 @@  discard block
 block discarded – undo
392 392
 	 * @throws \EE_Error
393 393
 	 */
394 394
 	public function payment_made_via_admin() {
395
-		return ( $this->get( 'PAY_source' ) === EEM_Payment_Method::scope_admin );
395
+		return ($this->get('PAY_source') === EEM_Payment_Method::scope_admin);
396 396
 	}
397 397
 
398 398
 
@@ -404,7 +404,7 @@  discard block
 block discarded – undo
404 404
 	 * @throws \EE_Error
405 405
 	 */
406 406
 	public function details() {
407
-		return $this->get( 'PAY_details' );
407
+		return $this->get('PAY_details');
408 408
 	}
409 409
 
410 410
 
@@ -416,7 +416,7 @@  discard block
 block discarded – undo
416 416
 	 * @throws \EE_Error
417 417
 	 */
418 418
 	public function redirect_url() {
419
-		return $this->get( 'PAY_redirect_url' );
419
+		return $this->get('PAY_redirect_url');
420 420
 	}
421 421
 
422 422
 
@@ -428,7 +428,7 @@  discard block
 block discarded – undo
428 428
 	 * @throws \EE_Error
429 429
 	 */
430 430
 	public function redirect_args() {
431
-		return $this->get( 'PAY_redirect_args' );
431
+		return $this->get('PAY_redirect_args');
432 432
 	}
433 433
 
434 434
 
@@ -440,8 +440,8 @@  discard block
 block discarded – undo
440 440
 	 * @return void
441 441
 	 * @throws \EE_Error
442 442
 	 */
443
-	public function e_pretty_status( $show_icons = false ) {
444
-		echo $this->pretty_status( $show_icons );
443
+	public function e_pretty_status($show_icons = false) {
444
+		echo $this->pretty_status($show_icons);
445 445
 	}
446 446
 
447 447
 
@@ -453,14 +453,14 @@  discard block
 block discarded – undo
453 453
 	 * @return string
454 454
 	 * @throws \EE_Error
455 455
 	 */
456
-	public function pretty_status( $show_icons = false ) {
456
+	public function pretty_status($show_icons = false) {
457 457
 		$status = EEM_Status::instance()->localized_status(
458
-			array( $this->STS_ID() => __( 'unknown', 'event_espresso' ) ),
458
+			array($this->STS_ID() => __('unknown', 'event_espresso')),
459 459
 			false,
460 460
 			'sentence'
461 461
 		);
462 462
 		$icon = '';
463
-		switch ( $this->STS_ID() ) {
463
+		switch ($this->STS_ID()) {
464 464
 			case EEM_Payment::status_id_approved:
465 465
 				$icon = $show_icons
466 466
 					? '<span class="dashicons dashicons-yes ee-icon-size-24 green-text"></span>'
@@ -482,7 +482,7 @@  discard block
 block discarded – undo
482 482
 					: '';
483 483
 				break;
484 484
 		}
485
-		return $icon . $status[ $this->STS_ID() ];
485
+		return $icon.$status[$this->STS_ID()];
486 486
 	}
487 487
 
488 488
 
@@ -494,7 +494,7 @@  discard block
 block discarded – undo
494 494
 	 * @throws \EE_Error
495 495
 	 */
496 496
 	public function is_approved() {
497
-		return $this->status_is( EEM_Payment::status_id_approved );
497
+		return $this->status_is(EEM_Payment::status_id_approved);
498 498
 	}
499 499
 
500 500
 
@@ -508,7 +508,7 @@  discard block
 block discarded – undo
508 508
 	 * @return boolean whether the status of this payment equals the status id
509 509
 	 * @throws \EE_Error
510 510
 	 */
511
-	protected function status_is( $STS_ID ) {
511
+	protected function status_is($STS_ID) {
512 512
 		return $STS_ID === $this->STS_ID() ? true : false;
513 513
 	}
514 514
 
@@ -521,7 +521,7 @@  discard block
 block discarded – undo
521 521
 	 * @throws \EE_Error
522 522
 	 */
523 523
 	public function is_pending() {
524
-		return $this->status_is( EEM_Payment::status_id_pending );
524
+		return $this->status_is(EEM_Payment::status_id_pending);
525 525
 	}
526 526
 
527 527
 
@@ -533,7 +533,7 @@  discard block
 block discarded – undo
533 533
 	 * @throws \EE_Error
534 534
 	 */
535 535
 	public function is_cancelled() {
536
-		return $this->status_is( EEM_Payment::status_id_cancelled );
536
+		return $this->status_is(EEM_Payment::status_id_cancelled);
537 537
 	}
538 538
 
539 539
 
@@ -545,7 +545,7 @@  discard block
 block discarded – undo
545 545
 	 * @throws \EE_Error
546 546
 	 */
547 547
 	public function is_declined() {
548
-		return $this->status_is( EEM_Payment::status_id_declined );
548
+		return $this->status_is(EEM_Payment::status_id_declined);
549 549
 	}
550 550
 
551 551
 
@@ -557,7 +557,7 @@  discard block
 block discarded – undo
557 557
 	 * @throws \EE_Error
558 558
 	 */
559 559
 	public function is_failed() {
560
-		return $this->status_is( EEM_Payment::status_id_failed );
560
+		return $this->status_is(EEM_Payment::status_id_failed);
561 561
 	}
562 562
 
563 563
 
@@ -581,7 +581,7 @@  discard block
 block discarded – undo
581 581
 	 * @throws \EE_Error
582 582
 	 */
583 583
 	public function status_obj() {
584
-		return $this->get_first_related( 'Status' );
584
+		return $this->get_first_related('Status');
585 585
 	}
586 586
 
587 587
 
@@ -593,8 +593,8 @@  discard block
 block discarded – undo
593 593
 	 * @return EE_Extra_Meta
594 594
 	 * @throws \EE_Error
595 595
 	 */
596
-	public function extra_meta( $query_params = array() ) {
597
-		return $this->get_many_related( 'Extra_Meta', $query_params );
596
+	public function extra_meta($query_params = array()) {
597
+		return $this->get_many_related('Extra_Meta', $query_params);
598 598
 	}
599 599
 
600 600
 
@@ -608,7 +608,7 @@  discard block
 block discarded – undo
608 608
 	 * @throws \EE_Error
609 609
 	 */
610 610
 	public function payment_method() {
611
-		return $this->get_first_related( 'Payment_Method' );
611
+		return $this->get_first_related('Payment_Method');
612 612
 	}
613 613
 
614 614
 
@@ -626,18 +626,18 @@  discard block
 block discarded – undo
626 626
 	 * @return string html
627 627
 	 * @throws \EE_Error
628 628
 	 */
629
-	public function redirect_form( $inside_form_html = null ) {
629
+	public function redirect_form($inside_form_html = null) {
630 630
 		$redirect_url = $this->redirect_url();
631
-		if ( ! empty( $redirect_url ) ) {
631
+		if ( ! empty($redirect_url)) {
632 632
 			// what ? no inner form content?
633
-			if ( $inside_form_html === null ) {
633
+			if ($inside_form_html === null) {
634 634
 				$inside_form_html = EEH_HTML::p(
635 635
 					sprintf(
636 636
 						__(
637 637
 							'If you are not automatically redirected to the payment website within 10 seconds... %1$s %2$s Click Here %3$s',
638 638
 							'event_espresso'
639 639
 						),
640
-						EEH_HTML::br( 2 ),
640
+						EEH_HTML::br(2),
641 641
 						'<input type="submit" value="',
642 642
 						'">'
643 643
 					),
@@ -653,22 +653,22 @@  discard block
 block discarded – undo
653 653
 			);
654 654
 			//if it's a GET request, we need to remove all the GET params in the querystring
655 655
 			//and put them into the form instead
656
-			if ( $method === 'GET' ) {
657
-				$querystring = parse_url( $redirect_url, PHP_URL_QUERY );
656
+			if ($method === 'GET') {
657
+				$querystring = parse_url($redirect_url, PHP_URL_QUERY);
658 658
 				$get_params = null;
659
-				parse_str( $querystring, $get_params );
660
-				$inside_form_html .= $this->_args_as_inputs( $get_params );
661
-				$redirect_url = str_replace( '?' . $querystring, '', $redirect_url );
659
+				parse_str($querystring, $get_params);
660
+				$inside_form_html .= $this->_args_as_inputs($get_params);
661
+				$redirect_url = str_replace('?'.$querystring, '', $redirect_url);
662 662
 			}
663
-			$form = EEH_HTML::nl( 1 )
663
+			$form = EEH_HTML::nl(1)
664 664
 			        . '<form method="'
665 665
 			        . $method
666 666
 			        . '" name="gateway_form" action="'
667 667
 			        . $redirect_url
668 668
 			        . '">';
669
-			$form .= EEH_HTML::nl( 1 ) . $this->redirect_args_as_inputs();
669
+			$form .= EEH_HTML::nl(1).$this->redirect_args_as_inputs();
670 670
 			$form .= $inside_form_html;
671
-			$form .= EEH_HTML::nl( -1 ) . '</form>' . EEH_HTML::nl( -1 );
671
+			$form .= EEH_HTML::nl( -1 ).'</form>'.EEH_HTML::nl( -1 );
672 672
 			return $form;
673 673
 		} else {
674 674
 			return null;
@@ -685,7 +685,7 @@  discard block
 block discarded – undo
685 685
 	 * @throws \EE_Error
686 686
 	 */
687 687
 	public function redirect_args_as_inputs() {
688
-		return $this->_args_as_inputs( $this->redirect_args() );
688
+		return $this->_args_as_inputs($this->redirect_args());
689 689
 	}
690 690
 
691 691
 
@@ -697,15 +697,15 @@  discard block
 block discarded – undo
697 697
 	 * @param array $args key-value pairs
698 698
 	 * @return string
699 699
 	 */
700
-	protected function _args_as_inputs( $args ) {
700
+	protected function _args_as_inputs($args) {
701 701
 		$html = '';
702
-		if ( $args !== null && is_array( $args ) ) {
703
-			foreach ( $args as $name => $value ) {
704
-				$html .= EEH_HTML::nl( 0 )
702
+		if ($args !== null && is_array($args)) {
703
+			foreach ($args as $name => $value) {
704
+				$html .= EEH_HTML::nl(0)
705 705
 				         . '<input type="hidden" name="'
706 706
 				         . $name
707 707
 				         . '" value="'
708
-				         . esc_attr( $value )
708
+				         . esc_attr($value)
709 709
 				         . '"/>';
710 710
 			}
711 711
 		}
@@ -734,14 +734,14 @@  discard block
 block discarded – undo
734 734
 	 * @access private
735 735
 	 * @param mixed $item
736 736
 	 */
737
-	private function _strip_all_tags_within_array( &$item ) {
738
-		if ( is_object( $item ) ) {
739
-			$item = (array)$item;
737
+	private function _strip_all_tags_within_array(&$item) {
738
+		if (is_object($item)) {
739
+			$item = (array) $item;
740 740
 		}
741
-		if ( is_array( $item ) ) {
742
-			array_walk_recursive( $item, array( $this, '_strip_all_tags_within_array' ) );
741
+		if (is_array($item)) {
742
+			array_walk_recursive($item, array($this, '_strip_all_tags_within_array'));
743 743
 		} else {
744
-			$item = wp_strip_all_tags( $item );
744
+			$item = wp_strip_all_tags($item);
745 745
 		}
746 746
 	}
747 747
 
@@ -758,7 +758,7 @@  discard block
 block discarded – undo
758 758
 		$original_status = EEH_Array::is_set(
759 759
 			$this->_props_n_values_provided_in_constructor,
760 760
 			'STS_ID',
761
-			$this->get_model()->field_settings_for( 'STS_ID' )->get_default_value()
761
+			$this->get_model()->field_settings_for('STS_ID')->get_default_value()
762 762
 		);
763 763
 		$current_status = $this->status();
764 764
 		if (
@@ -784,11 +784,11 @@  discard block
 block discarded – undo
784 784
 	 * @return mixed
785 785
 	 * @throws \EE_Error
786 786
 	 */
787
-	public function get_pretty( $field_name, $extra_cache_ref = null ) {
788
-		if ( $field_name === 'PAY_gateway' ) {
789
-			return $this->payment_method() ? $this->payment_method()->name() : __( 'Unknown', 'event_espresso' );
787
+	public function get_pretty($field_name, $extra_cache_ref = null) {
788
+		if ($field_name === 'PAY_gateway') {
789
+			return $this->payment_method() ? $this->payment_method()->name() : __('Unknown', 'event_espresso');
790 790
 		}
791
-		return $this->_get_cached_property( $field_name, true, $extra_cache_ref );
791
+		return $this->_get_cached_property($field_name, true, $extra_cache_ref);
792 792
 	}
793 793
 
794 794
 
@@ -800,8 +800,8 @@  discard block
 block discarded – undo
800 800
 	 * @return EE_Registration_Payment[]
801 801
 	 * @throws \EE_Error
802 802
 	 */
803
-	public function registration_payments( $query_params = array() ) {
804
-		return $this->get_many_related( 'Registration_Payment', $query_params );
803
+	public function registration_payments($query_params = array()) {
804
+		return $this->get_many_related('Registration_Payment', $query_params);
805 805
 	}
806 806
 
807 807
 
Please login to merge, or discard this patch.
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -661,11 +661,11 @@  discard block
 block discarded – undo
661 661
 				$redirect_url = str_replace( '?' . $querystring, '', $redirect_url );
662 662
 			}
663 663
 			$form = EEH_HTML::nl( 1 )
664
-			        . '<form method="'
665
-			        . $method
666
-			        . '" name="gateway_form" action="'
667
-			        . $redirect_url
668
-			        . '">';
664
+					. '<form method="'
665
+					. $method
666
+					. '" name="gateway_form" action="'
667
+					. $redirect_url
668
+					. '">';
669 669
 			$form .= EEH_HTML::nl( 1 ) . $this->redirect_args_as_inputs();
670 670
 			$form .= $inside_form_html;
671 671
 			$form .= EEH_HTML::nl( -1 ) . '</form>' . EEH_HTML::nl( -1 );
@@ -702,11 +702,11 @@  discard block
 block discarded – undo
702 702
 		if ( $args !== null && is_array( $args ) ) {
703 703
 			foreach ( $args as $name => $value ) {
704 704
 				$html .= EEH_HTML::nl( 0 )
705
-				         . '<input type="hidden" name="'
706
-				         . $name
707
-				         . '" value="'
708
-				         . esc_attr( $value )
709
-				         . '"/>';
705
+						 . '<input type="hidden" name="'
706
+						 . $name
707
+						 . '" value="'
708
+						 . esc_attr( $value )
709
+						 . '"/>';
710 710
 			}
711 711
 		}
712 712
 		return $html;
Please login to merge, or discard this patch.
core/db_classes/EE_Line_Item.class.php 1 patch
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -218,24 +218,24 @@
 block discarded – undo
218 218
 	 * @return string
219 219
 	 */
220 220
 	function OBJ_type_i18n() {
221
-	    $obj_type = $this->OBJ_type();
222
-        switch ($obj_type) {
223
-            case 'Event':
224
-                $obj_type = __('Event', 'event_espresso');
225
-                break;
226
-            case 'Price':
227
-                $obj_type = __('Price', 'event_espresso');
228
-                break;
229
-            case 'Promotion':
230
-                $obj_type = __('Promotion', 'event_espresso');
231
-                break;
232
-            case 'Ticket':
233
-                $obj_type = __('Ticket', 'event_espresso');
234
-                break;
235
-            case 'Transaction':
236
-                $obj_type = __('Transaction', 'event_espresso');
237
-                break;
238
-        }
221
+		$obj_type = $this->OBJ_type();
222
+		switch ($obj_type) {
223
+			case 'Event':
224
+				$obj_type = __('Event', 'event_espresso');
225
+				break;
226
+			case 'Price':
227
+				$obj_type = __('Price', 'event_espresso');
228
+				break;
229
+			case 'Promotion':
230
+				$obj_type = __('Promotion', 'event_espresso');
231
+				break;
232
+			case 'Ticket':
233
+				$obj_type = __('Ticket', 'event_espresso');
234
+				break;
235
+			case 'Transaction':
236
+				$obj_type = __('Transaction', 'event_espresso');
237
+				break;
238
+		}
239 239
 		return apply_filters('FHEE__EE_Line_Item__OBJ_type_i18n', $obj_type, $this);
240 240
 	}
241 241
 
Please login to merge, or discard this patch.
admin/extend/registration_form/Extend_Registration_Form_Admin_Page.core.php 4 patches
Spacing   +185 added lines, -185 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
 /**
@@ -36,13 +36,13 @@  discard block
 block discarded – undo
36 36
 	 * 		@param bool $routing indicate whether we want to just load the object and handle routing or just load the object.
37 37
 	 * 		@access public
38 38
 	 */
39
-	public function __construct( $routing = TRUE ) {
40
-		define( 'REGISTRATION_FORM_CAF_ADMIN', EE_CORE_CAF_ADMIN_EXTEND . 'registration_form' . DS );
41
-		define( 'REGISTRATION_FORM_CAF_ASSETS_PATH', REGISTRATION_FORM_CAF_ADMIN . 'assets' . DS );
42
-		define( 'REGISTRATION_FORM_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL . 'registration_form/assets/' );
43
-		define( 'REGISTRATION_FORM_CAF_TEMPLATE_PATH', REGISTRATION_FORM_CAF_ADMIN . 'templates' . DS );
44
-		define( 'REGISTRATION_FORM_CAF_TEMPLATE_URL', EE_CORE_CAF_ADMIN_EXTEND_URL . 'registration_form/templates/' );
45
-		parent::__construct( $routing );
39
+	public function __construct($routing = TRUE) {
40
+		define('REGISTRATION_FORM_CAF_ADMIN', EE_CORE_CAF_ADMIN_EXTEND.'registration_form'.DS);
41
+		define('REGISTRATION_FORM_CAF_ASSETS_PATH', REGISTRATION_FORM_CAF_ADMIN.'assets'.DS);
42
+		define('REGISTRATION_FORM_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL.'registration_form/assets/');
43
+		define('REGISTRATION_FORM_CAF_TEMPLATE_PATH', REGISTRATION_FORM_CAF_ADMIN.'templates'.DS);
44
+		define('REGISTRATION_FORM_CAF_TEMPLATE_URL', EE_CORE_CAF_ADMIN_EXTEND_URL.'registration_form/templates/');
45
+		parent::__construct($routing);
46 46
 	}
47 47
 
48 48
 
@@ -52,8 +52,8 @@  discard block
 block discarded – undo
52 52
 
53 53
 	protected function _extend_page_config() {
54 54
 		$this->_admin_base_path = REGISTRATION_FORM_CAF_ADMIN;
55
-		$qst_id = ! empty( $this->_req_data['QST_ID'] ) && ! is_array( $this->_req_data['QST_ID'] ) ? $this->_req_data['QST_ID'] : 0;
56
-		$qsg_id = ! empty( $this->_req_data['QSG_ID'] ) && ! is_array( $this->_req_data['QSG_ID'] ) ? $this->_req_data['QSG_ID'] : 0;
55
+		$qst_id = ! empty($this->_req_data['QST_ID']) && ! is_array($this->_req_data['QST_ID']) ? $this->_req_data['QST_ID'] : 0;
56
+		$qsg_id = ! empty($this->_req_data['QSG_ID']) && ! is_array($this->_req_data['QSG_ID']) ? $this->_req_data['QSG_ID'] : 0;
57 57
 
58 58
 		$new_page_routes = array(
59 59
 			'question_groups' => array(
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 				'func' => '_trash_or_restore_questions',
87 87
 				'capability' => 'ee_delete_question',
88 88
 				'obj_id' => $qst_id,
89
-				'args' => array( 'trash' => FALSE ),
89
+				'args' => array('trash' => FALSE),
90 90
 				'noheader' => TRUE
91 91
 				),
92 92
 
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 
146 146
 			'trash_question_group' => array(
147 147
 				'func' => '_trash_or_restore_question_groups',
148
-				'args' => array( 'trash' => TRUE ),
148
+				'args' => array('trash' => TRUE),
149 149
 				'capability' => 'ee_delete_question_group',
150 150
 				'obj_id' => $qsg_id,
151 151
 				'noheader' => TRUE
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
 
154 154
 			'restore_question_group' => array(
155 155
 				'func' => '_trash_or_restore_question_groups',
156
-				'args' => array( 'trash' => FALSE ),
156
+				'args' => array('trash' => FALSE),
157 157
 				'capability' => 'ee_delete_question_group',
158 158
 				'obj_id' => $qsg_id,
159 159
 				'noheader' => TRUE
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
 
169 169
 			'update_question_group' => array(
170 170
 				'func' => '_insert_or_update_question_group',
171
-				'args' => array('new_question_group' => FALSE ),
171
+				'args' => array('new_question_group' => FALSE),
172 172
 				'capability' => 'ee_edit_question_group',
173 173
 				'obj_id' => $qsg_id,
174 174
 				'noheader' => TRUE,
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
 					'noheader' => TRUE
207 207
 				),
208 208
 			);
209
-		$this->_page_routes = array_merge( $this->_page_routes, $new_page_routes );
209
+		$this->_page_routes = array_merge($this->_page_routes, $new_page_routes);
210 210
 
211 211
 		$new_page_config = array(
212 212
 
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
 						'filename' => 'registration_form_question_groups_views_bulk_actions_search'
231 231
 						),
232 232
 					),
233
-				'help_tour' => array( 'Registration_Form_Question_Groups_Help_Tour'),
233
+				'help_tour' => array('Registration_Form_Question_Groups_Help_Tour'),
234 234
 				'metaboxes' => $this->_default_espresso_metaboxes,
235 235
 				'require_nonce' => FALSE,
236 236
 				'qtips' => array(
@@ -244,14 +244,14 @@  discard block
 block discarded – undo
244 244
 					'order' => 5,
245 245
 					'persistent' => FALSE
246 246
 					),
247
-				'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array('_publish_post_box' ) ),
247
+				'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')),
248 248
                 'help_tabs' => array(
249 249
 					'registration_form_add_question_help_tab' => array(
250 250
 						'title' => esc_html__('Add Question', 'event_espresso'),
251 251
 						'filename' => 'registration_form_add_question'
252 252
 						),
253 253
 					),
254
-                'help_tour' => array( 'Registration_Form_Add_Question_Help_Tour'),
254
+                'help_tour' => array('Registration_Form_Add_Question_Help_Tour'),
255 255
 				'require_nonce' => FALSE
256 256
 				),
257 257
 
@@ -261,14 +261,14 @@  discard block
 block discarded – undo
261 261
 					'order' => 5,
262 262
 					'persistent' => FALSE
263 263
 					),
264
-				'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array('_publish_post_box' ) ),
264
+				'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')),
265 265
 				'help_tabs' => array(
266 266
 					'registration_form_add_question_group_help_tab' => array(
267 267
 						'title' => esc_html__('Add Question Group', 'event_espresso'),
268 268
 						'filename' => 'registration_form_add_question_group'
269 269
 						),
270 270
 					),
271
-                'help_tour' => array( 'Registration_Form_Add_Question_Group_Help_Tour'),
271
+                'help_tour' => array('Registration_Form_Add_Question_Group_Help_Tour'),
272 272
 				'require_nonce' => FALSE
273 273
 				),
274 274
 
@@ -277,16 +277,16 @@  discard block
 block discarded – undo
277 277
 					'label' => esc_html__('Edit Question Group', 'event_espresso'),
278 278
 					'order' => 5,
279 279
 					'persistent' => FALSE,
280
-					'url' => isset($this->_req_data['question_group_id']) ? add_query_arg(array('question_group_id' => $this->_req_data['question_group_id'] ), $this->_current_page_view_url )  : $this->_admin_base_url
280
+					'url' => isset($this->_req_data['question_group_id']) ? add_query_arg(array('question_group_id' => $this->_req_data['question_group_id']), $this->_current_page_view_url) : $this->_admin_base_url
281 281
 					),
282
-				'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array('_publish_post_box' ) ),
282
+				'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')),
283 283
 				'help_tabs' => array(
284 284
 					'registration_form_edit_question_group_help_tab' => array(
285 285
 						'title' => esc_html__('Edit Question Group', 'event_espresso'),
286 286
 						'filename' => 'registration_form_edit_question_group'
287 287
 						),
288 288
 					),
289
-                'help_tour' => array( 'Registration_Form_Edit_Question_Group_Help_Tour'),
289
+                'help_tour' => array('Registration_Form_Edit_Question_Group_Help_Tour'),
290 290
 				'require_nonce' => FALSE
291 291
 				),
292 292
 
@@ -298,19 +298,19 @@  discard block
 block discarded – undo
298 298
 				'labels' => array(
299 299
 					'publishbox' => esc_html__('Update Settings', 'event_espresso')
300 300
 					),
301
-				'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array( '_publish_post_box' ) ),
301
+				'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')),
302 302
 				'help_tabs' => array(
303 303
 					'registration_form_reg_form_settings_help_tab' => array(
304 304
 						'title' => esc_html__('Registration Form Settings', 'event_espresso'),
305 305
 						'filename' => 'registration_form_reg_form_settings'
306 306
 						),
307 307
 					),
308
-                'help_tour' => array( 'Registration_Form_Settings_Help_Tour'),
308
+                'help_tour' => array('Registration_Form_Settings_Help_Tour'),
309 309
 				'require_nonce' => FALSE
310 310
 				)
311 311
 
312 312
 			);
313
-		$this->_page_config = array_merge( $this->_page_config, $new_page_config );
313
+		$this->_page_config = array_merge($this->_page_config, $new_page_config);
314 314
 
315 315
 		//change the list table we're going to use so it's the NEW list table!
316 316
 		$this->_page_config['default']['list_table'] = 'Extend_Registration_Form_Questions_Admin_List_Table';
@@ -324,7 +324,7 @@  discard block
 block discarded – undo
324 324
 			'edit_question_group' => esc_html__('Edit Question Group', 'event_espresso'),
325 325
 			'delete_question_group' => esc_html__('Delete Question Group', 'event_espresso'),
326 326
 			);
327
-		$this->_labels['buttons'] = array_merge( $this->_labels['buttons'], $new_labels );
327
+		$this->_labels['buttons'] = array_merge($this->_labels['buttons'], $new_labels);
328 328
 
329 329
 	}
330 330
 
@@ -333,14 +333,14 @@  discard block
 block discarded – undo
333 333
 
334 334
 
335 335
 	protected function _ajax_hooks() {
336
-		add_action('wp_ajax_espresso_update_question_group_order', array( $this, 'update_question_group_order' ));
336
+		add_action('wp_ajax_espresso_update_question_group_order', array($this, 'update_question_group_order'));
337 337
 	}
338 338
 
339 339
 
340 340
 
341 341
 
342 342
 	public function load_scripts_styles_question_groups() {
343
-		wp_enqueue_script( 'espresso_ajax_table_sorting' );
343
+		wp_enqueue_script('espresso_ajax_table_sorting');
344 344
 	}
345 345
 
346 346
 
@@ -361,7 +361,7 @@  discard block
 block discarded – undo
361 361
 	 * @return void
362 362
 	 */
363 363
 	public function load_sortable_question_script() {
364
-		wp_register_script('ee-question-sortable', REGISTRATION_FORM_CAF_ASSETS_URL . 'ee_question_order.js', array('jquery-ui-sortable'), EVENT_ESPRESSO_VERSION, true);
364
+		wp_register_script('ee-question-sortable', REGISTRATION_FORM_CAF_ASSETS_URL.'ee_question_order.js', array('jquery-ui-sortable'), EVENT_ESPRESSO_VERSION, true);
365 365
 		wp_enqueue_script('ee-question-sortable');
366 366
 	}
367 367
 
@@ -380,7 +380,7 @@  discard block
 block discarded – undo
380 380
 				)
381 381
 		);
382 382
 
383
-		if ( EE_Registry::instance()->CAP->current_user_can('ee_delete_questions', 'espresso_registration_form_trash_questions' ) ) {
383
+		if (EE_Registry::instance()->CAP->current_user_can('ee_delete_questions', 'espresso_registration_form_trash_questions')) {
384 384
 			$this->_views['trash'] = array(
385 385
 				'slug' => 'trash',
386 386
 				'label' => esc_html__('Trash', 'event_espresso'),
@@ -410,7 +410,7 @@  discard block
 block discarded – undo
410 410
 				)
411 411
 		);
412 412
 
413
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_question_groups', 'espresso_registration_form_trash_question_groups' ) ) {
413
+		if (EE_Registry::instance()->CAP->current_user_can('ee_delete_question_groups', 'espresso_registration_form_trash_question_groups')) {
414 414
 			$this->_views['trash'] = array(
415 415
 				'slug' => 'trash',
416 416
 				'label' => esc_html__('Trash', 'event_espresso'),
@@ -446,24 +446,24 @@  discard block
 block discarded – undo
446 446
 
447 447
 
448 448
 
449
-	protected function _delete_question(){
450
-		$success = $this->_delete_items( $this->_question_model );
449
+	protected function _delete_question() {
450
+		$success = $this->_delete_items($this->_question_model);
451 451
 		$this->_redirect_after_action(
452 452
 			$success,
453
-			$this->_question_model->item_name( $success ),
453
+			$this->_question_model->item_name($success),
454 454
 			'deleted',
455
-			array( 'action' => 'default', 'status' => 'all' )
455
+			array('action' => 'default', 'status' => 'all')
456 456
 		);
457 457
 	}
458 458
 
459 459
 
460 460
 	protected function _delete_questions() {
461
-		$success = $this->_delete_items( $this->_question_model );
461
+		$success = $this->_delete_items($this->_question_model);
462 462
 		$this->_redirect_after_action(
463 463
 			$success,
464
-			$this->_question_model->item_name( $success ),
464
+			$this->_question_model->item_name($success),
465 465
 			'deleted permanently',
466
-			array( 'action' => 'default', 'status' => 'trash' )
466
+			array('action' => 'default', 'status' => 'trash')
467 467
 		);
468 468
 	}
469 469
 
@@ -474,26 +474,26 @@  discard block
 block discarded – undo
474 474
  * @param EEM_Soft_Delete_Base $model
475 475
  * @return int number of items deleted permanently
476 476
  */
477
-	private function _delete_items(EEM_Soft_Delete_Base $model){
477
+	private function _delete_items(EEM_Soft_Delete_Base $model) {
478 478
 		$success = 0;
479
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
480
-		if (!empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
479
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
480
+		if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
481 481
 			// if array has more than one element than success message should be plural
482
-			$success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1;
482
+			$success = count($this->_req_data['checkbox']) > 1 ? 2 : 1;
483 483
 			// cycle thru bulk action checkboxes
484
-			while (list( $ID, $value ) = each($this->_req_data['checkbox'])) {
485
-				if ( ! $this->_delete_item( $ID, $model ) ) {
484
+			while (list($ID, $value) = each($this->_req_data['checkbox'])) {
485
+				if ( ! $this->_delete_item($ID, $model)) {
486 486
 					$success = 0;
487 487
 				}
488 488
 			}
489 489
 
490
-		}elseif( !empty($this->_req_data['QSG_ID'])){
491
-			$success = $this->_delete_item( $this->_req_data['QSG_ID'], $model );
490
+		}elseif ( ! empty($this->_req_data['QSG_ID'])) {
491
+			$success = $this->_delete_item($this->_req_data['QSG_ID'], $model);
492 492
 
493
-		}elseif( !empty($this->_req_data['QST_ID'])){
494
-			$success = $this->_delete_item( $this->_req_data['QST_ID'], $model );
495
-		}else{
496
-			EE_Error::add_error( sprintf(esc_html__("No Questions or Question Groups were selected for deleting. This error usually shows when you've attempted to delete via bulk action but there were no selections.", "event_espresso")), __FILE__, __FUNCTION__, __LINE__ );
493
+		}elseif ( ! empty($this->_req_data['QST_ID'])) {
494
+			$success = $this->_delete_item($this->_req_data['QST_ID'], $model);
495
+		} else {
496
+			EE_Error::add_error(sprintf(esc_html__("No Questions or Question Groups were selected for deleting. This error usually shows when you've attempted to delete via bulk action but there were no selections.", "event_espresso")), __FILE__, __FUNCTION__, __LINE__);
497 497
 		}
498 498
 		return $success;
499 499
 	}
@@ -504,11 +504,11 @@  discard block
 block discarded – undo
504 504
 	 * @param EEM_Soft_Delete_Base $model
505 505
 	 * @return boolean
506 506
 	 */
507
-	protected function _delete_item( $id, $model ) {
508
-		if( $model instanceof EEM_Question ) {
509
-			EEM_Question_Option::instance()->delete_permanently( array( array( 'QST_ID' => absint( $id ) ) ) );
507
+	protected function _delete_item($id, $model) {
508
+		if ($model instanceof EEM_Question) {
509
+			EEM_Question_Option::instance()->delete_permanently(array(array('QST_ID' => absint($id))));
510 510
 		}
511
-		return $model->delete_permanently_by_ID( absint( $id ) );
511
+		return $model->delete_permanently_by_ID(absint($id));
512 512
 	}
513 513
 
514 514
 
@@ -520,41 +520,41 @@  discard block
 block discarded – undo
520 520
 
521 521
 
522 522
 
523
-	protected function _edit_question_group( $type = 'add' ) {
524
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
525
-		$ID=isset( $this->_req_data['QSG_ID'] ) && ! empty( $this->_req_data['QSG_ID'] ) ? absint( $this->_req_data['QSG_ID'] ) : FALSE;
523
+	protected function _edit_question_group($type = 'add') {
524
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
525
+		$ID = isset($this->_req_data['QSG_ID']) && ! empty($this->_req_data['QSG_ID']) ? absint($this->_req_data['QSG_ID']) : FALSE;
526 526
 		
527
-		switch( $this->_req_action ) {
527
+		switch ($this->_req_action) {
528 528
 			case 'add_question_group' :
529
-				$this->_admin_page_title = esc_html__( 'Add Question Group', 'event_espresso' );
529
+				$this->_admin_page_title = esc_html__('Add Question Group', 'event_espresso');
530 530
 				break;
531 531
 			case 'edit_question_group' :
532
-				$this->_admin_page_title = esc_html__( 'Edit Question Group', 'event_espresso' );
532
+				$this->_admin_page_title = esc_html__('Edit Question Group', 'event_espresso');
533 533
 				break;
534 534
 			default :
535
-				$this->_admin_page_title = ucwords( str_replace( '_', ' ', $this->_req_action ));
535
+				$this->_admin_page_title = ucwords(str_replace('_', ' ', $this->_req_action));
536 536
 		}
537 537
 		// add ID to title if editing
538
-		$this->_admin_page_title = $ID ? $this->_admin_page_title . ' # ' . $ID : $this->_admin_page_title;
539
-		if($ID){
538
+		$this->_admin_page_title = $ID ? $this->_admin_page_title.' # '.$ID : $this->_admin_page_title;
539
+		if ($ID) {
540 540
 			/** @var EE_Question_Group $questionGroup */
541
-			$questionGroup=$this->_question_group_model->get_one_by_ID( $ID);
542
-			$additional_hidden_fields=array('QSG_ID'=>array('type'=>'hidden','value'=>$ID));
541
+			$questionGroup = $this->_question_group_model->get_one_by_ID($ID);
542
+			$additional_hidden_fields = array('QSG_ID'=>array('type'=>'hidden', 'value'=>$ID));
543 543
 			$this->_set_add_edit_form_tags('update_question_group', $additional_hidden_fields);
544
-		}else{
544
+		} else {
545 545
 			/** @var EE_Question_Group $questionGroup */
546 546
 			$questionGroup = EEM_Question_Group::instance()->create_default_object();
547 547
 			$questionGroup->set_order_to_latest();
548 548
 			$this->_set_add_edit_form_tags('insert_question_group');
549 549
 		}
550 550
 		$this->_template_args['values'] = $this->_yes_no_values;
551
-		$this->_template_args['all_questions']=$questionGroup->questions_in_and_not_in_group();
552
-		$this->_template_args['QSG_ID']=$ID ? $ID : TRUE;
553
-		$this->_template_args['question_group']=$questionGroup;
551
+		$this->_template_args['all_questions'] = $questionGroup->questions_in_and_not_in_group();
552
+		$this->_template_args['QSG_ID'] = $ID ? $ID : TRUE;
553
+		$this->_template_args['question_group'] = $questionGroup;
554 554
 
555
-		$redirect_URL = add_query_arg( array( 'action' => 'question_groups'), $this->_admin_base_url );
556
-		$this->_set_publish_post_box_vars( 'id', $ID, FALSE, $redirect_URL  );
557
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( REGISTRATION_FORM_CAF_TEMPLATE_PATH . 'question_groups_main_meta_box.template.php', $this->_template_args, TRUE );
555
+		$redirect_URL = add_query_arg(array('action' => 'question_groups'), $this->_admin_base_url);
556
+		$this->_set_publish_post_box_vars('id', $ID, FALSE, $redirect_URL);
557
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template(REGISTRATION_FORM_CAF_TEMPLATE_PATH.'question_groups_main_meta_box.template.php', $this->_template_args, TRUE);
558 558
 
559 559
 		// the details template wrapper
560 560
 		$this->display_admin_page_with_sidebar();
@@ -565,7 +565,7 @@  discard block
 block discarded – undo
565 565
 
566 566
 	protected function _delete_question_groups() {
567 567
 		$success = $this->_delete_items($this->_question_group_model);
568
-		$this->_redirect_after_action( $success, $this->_question_group_model->item_name($success), 'deleted permanently', array( 'action'=>'question_groups', 'status'=>'trash' ));
568
+		$this->_redirect_after_action($success, $this->_question_group_model->item_name($success), 'deleted permanently', array('action'=>'question_groups', 'status'=>'trash'));
569 569
 	}
570 570
 
571 571
 
@@ -573,71 +573,71 @@  discard block
 block discarded – undo
573 573
 	/**
574 574
 	 * @param bool $new_question_group
575 575
 	 */
576
-	protected function _insert_or_update_question_group( $new_question_group = TRUE) {
577
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
578
-		$set_column_values=$this->_set_column_values_for($this->_question_group_model);
579
-		if ( $new_question_group ){
576
+	protected function _insert_or_update_question_group($new_question_group = TRUE) {
577
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
578
+		$set_column_values = $this->_set_column_values_for($this->_question_group_model);
579
+		if ($new_question_group) {
580 580
 			$QSG_ID = $this->_question_group_model->insert($set_column_values);
581 581
 			$success = $QSG_ID ? 1 : 0;
582 582
 		} else {
583 583
 			$QSG_ID = absint($this->_req_data['QSG_ID']);
584
-			unset( $set_column_values[ 'QSG_ID' ] );
585
-			$success= $this->_question_group_model->update( $set_column_values, array( array( 'QSG_ID' => $QSG_ID )));
584
+			unset($set_column_values['QSG_ID']);
585
+			$success = $this->_question_group_model->update($set_column_values, array(array('QSG_ID' => $QSG_ID)));
586 586
 		}
587
-		$phone_question_id = EEM_Question::instance()->get_Question_ID_from_system_string( EEM_Attendee::system_question_phone );
587
+		$phone_question_id = EEM_Question::instance()->get_Question_ID_from_system_string(EEM_Attendee::system_question_phone);
588 588
 		// update the existing related questions
589 589
 		// BUT FIRST...  delete the phone question from the Question_Group_Question if it is being added to this question group (therefore removed from the existing group)
590
-		if ( isset( $this->_req_data['questions'], $this->_req_data['questions'][ $phone_question_id ] )) {
590
+		if (isset($this->_req_data['questions'], $this->_req_data['questions'][$phone_question_id])) {
591 591
 			// delete where QST ID = system phone question ID and Question Group ID is NOT this group
592
-			EEM_Question_Group_Question::instance()->delete( array( array( 'QST_ID' => $phone_question_id, 'QSG_ID' => array( '!=', $QSG_ID ))));
592
+			EEM_Question_Group_Question::instance()->delete(array(array('QST_ID' => $phone_question_id, 'QSG_ID' => array('!=', $QSG_ID))));
593 593
 		}
594 594
 		/** @type EE_Question_Group $question_group */
595
-		$question_group=$this->_question_group_model->get_one_by_ID( $QSG_ID );
595
+		$question_group = $this->_question_group_model->get_one_by_ID($QSG_ID);
596 596
 		$questions = $question_group->questions();
597 597
 		// make sure system phone question is added to list of questions for this group
598
-		if ( ! isset( $questions[$phone_question_id ] )) {
599
-			$questions[ $phone_question_id ] = EEM_Question::instance()->get_one_by_ID( $phone_question_id );
598
+		if ( ! isset($questions[$phone_question_id])) {
599
+			$questions[$phone_question_id] = EEM_Question::instance()->get_one_by_ID($phone_question_id);
600 600
 		}
601 601
 
602
-		foreach( $questions as $question_ID => $question ){
602
+		foreach ($questions as $question_ID => $question) {
603 603
 			// first we always check for order.
604
-			if ( ! empty( $this->_req_data['question_orders'][ $question_ID ] ) ){
604
+			if ( ! empty($this->_req_data['question_orders'][$question_ID])) {
605 605
 				//update question order
606
-				$question_group->update_question_order( $question_ID, $this->_req_data['question_orders'][ $question_ID ] );
606
+				$question_group->update_question_order($question_ID, $this->_req_data['question_orders'][$question_ID]);
607 607
 			}
608 608
 
609 609
 			// then we always check if adding or removing.
610
-			if ( isset( $this->_req_data['questions'], $this->_req_data['questions'][ $question_ID ] )) {
611
-				$question_group->add_question( $question_ID );
610
+			if (isset($this->_req_data['questions'], $this->_req_data['questions'][$question_ID])) {
611
+				$question_group->add_question($question_ID);
612 612
 			} else {
613 613
 				// not found, remove it (but only if not a system question for the personal group with the exception of lname system question - we allow removal of it)
614 614
 				if (
615 615
 					in_array(
616 616
 						$question->system_ID(),
617
-						EEM_Question::instance()->required_system_questions_in_system_question_group( $question_group->system_group() )
617
+						EEM_Question::instance()->required_system_questions_in_system_question_group($question_group->system_group())
618 618
 					)
619 619
 				) {
620 620
 					continue;
621 621
 				} else {
622
-					$question_group->remove_question( $question_ID );
622
+					$question_group->remove_question($question_ID);
623 623
 				}
624 624
 			}
625 625
 		}
626 626
 		// save new related questions
627
-		if ( isset( $this->_req_data['questions'] )) {
628
-			foreach( $this->_req_data['questions'] as $QST_ID ){
629
-				$question_group->add_question( $QST_ID );
630
-				if ( isset( $this->_req_data['question_orders'][ $QST_ID ] )) {
631
-					$question_group->update_question_order( $QST_ID, $this->_req_data['question_orders'][ $QST_ID ] );
627
+		if (isset($this->_req_data['questions'])) {
628
+			foreach ($this->_req_data['questions'] as $QST_ID) {
629
+				$question_group->add_question($QST_ID);
630
+				if (isset($this->_req_data['question_orders'][$QST_ID])) {
631
+					$question_group->update_question_order($QST_ID, $this->_req_data['question_orders'][$QST_ID]);
632 632
 				}
633 633
 			}
634 634
 		}
635 635
 
636
-		if ( $success !== FALSE ) {
637
-			$msg = $new_question_group ? sprintf( esc_html__('The %s has been created', 'event_espresso'), $this->_question_group_model->item_name() ) : sprintf( esc_html__('The %s has been updated', 'event_espresso' ), $this->_question_group_model->item_name() );
638
-			EE_Error::add_success( $msg );
636
+		if ($success !== FALSE) {
637
+			$msg = $new_question_group ? sprintf(esc_html__('The %s has been created', 'event_espresso'), $this->_question_group_model->item_name()) : sprintf(esc_html__('The %s has been updated', 'event_espresso'), $this->_question_group_model->item_name());
638
+			EE_Error::add_success($msg);
639 639
 		}
640
-		$this->_redirect_after_action(FALSE, '', '', array('action'=>'edit_question_group','QSG_ID'=>$QSG_ID), TRUE);
640
+		$this->_redirect_after_action(FALSE, '', '', array('action'=>'edit_question_group', 'QSG_ID'=>$QSG_ID), TRUE);
641 641
 
642 642
 	}
643 643
 
@@ -645,20 +645,20 @@  discard block
 block discarded – undo
645 645
 	 * duplicates a question and all its question options and redirects to the new question.
646 646
 	 */
647 647
 	public function _duplicate_question() {
648
-		$question_ID = (int)$this->_req_data[ 'QST_ID' ];
649
-		$question = EEM_Question::instance()->get_one_by_ID( $question_ID );
650
-		if( $question instanceof EE_Question ) {
648
+		$question_ID = (int) $this->_req_data['QST_ID'];
649
+		$question = EEM_Question::instance()->get_one_by_ID($question_ID);
650
+		if ($question instanceof EE_Question) {
651 651
 			$new_question = $question->duplicate();
652
-			if( $new_question instanceof EE_Question ) {
653
-				$this->_redirect_after_action( true, esc_html__( 'Question', 'event_espresso' ), esc_html__( 'Duplicated', 'event_espresso' ), array('action'=>'edit_question', 'QST_ID' => $new_question->ID() ), TRUE);
652
+			if ($new_question instanceof EE_Question) {
653
+				$this->_redirect_after_action(true, esc_html__('Question', 'event_espresso'), esc_html__('Duplicated', 'event_espresso'), array('action'=>'edit_question', 'QST_ID' => $new_question->ID()), TRUE);
654 654
 			} else {
655 655
 				global $wpdb;
656
-				EE_Error::add_error( sprintf( esc_html__( 'Could not duplicate question with ID %1$d because: %2$s', 'event_espresso' ), $question_ID, $wpdb->last_error ), __FILE__, __FUNCTION__, __LINE__ );
657
-			$this->_redirect_after_action(false, '', '', array('action'=>'default'), false );
656
+				EE_Error::add_error(sprintf(esc_html__('Could not duplicate question with ID %1$d because: %2$s', 'event_espresso'), $question_ID, $wpdb->last_error), __FILE__, __FUNCTION__, __LINE__);
657
+			$this->_redirect_after_action(false, '', '', array('action'=>'default'), false);
658 658
 			}
659 659
 		} else {
660
-			EE_Error::add_error( sprintf( esc_html__( 'Could not duplicate question with ID %d because it didn\'t exist!', 'event_espresso' ), $question_ID ), __FILE__, __FUNCTION__, __LINE__ );
661
-			$this->_redirect_after_action( false, '', '', array( 'action' => 'default' ), false );
660
+			EE_Error::add_error(sprintf(esc_html__('Could not duplicate question with ID %d because it didn\'t exist!', 'event_espresso'), $question_ID), __FILE__, __FUNCTION__, __LINE__);
661
+			$this->_redirect_after_action(false, '', '', array('action' => 'default'), false);
662 662
 		}
663 663
 	}
664 664
 
@@ -667,8 +667,8 @@  discard block
 block discarded – undo
667 667
 	/**
668 668
 	 * @param bool $trash
669 669
 	 */
670
-	protected function _trash_or_restore_question_groups( $trash = TRUE) {
671
-		$this->_trash_or_restore_items( $this->_question_group_model, $trash );
670
+	protected function _trash_or_restore_question_groups($trash = TRUE) {
671
+		$this->_trash_or_restore_items($this->_question_group_model, $trash);
672 672
 	}
673 673
 
674 674
 
@@ -676,9 +676,9 @@  discard block
 block discarded – undo
676 676
 	/**
677 677
 	 *_trash_question
678 678
 	 */
679
-	protected function _trash_question(){
680
-		$success=$this->_question_model->delete_by_ID( (int)$this->_req_data['QST_ID'] );
681
-		$query_args=array('action'=>'default','status'=>'all');
679
+	protected function _trash_question() {
680
+		$success = $this->_question_model->delete_by_ID((int) $this->_req_data['QST_ID']);
681
+		$query_args = array('action'=>'default', 'status'=>'all');
682 682
 		$this->_redirect_after_action($success, $this->_question_model->item_name($success), 'trashed', $query_args);
683 683
 	}
684 684
 
@@ -687,8 +687,8 @@  discard block
 block discarded – undo
687 687
 	/**
688 688
 	 * @param bool $trash
689 689
 	 */
690
-	protected function _trash_or_restore_questions( $trash=TRUE){
691
-		$this->_trash_or_restore_items( $this->_question_model, $trash );
690
+	protected function _trash_or_restore_questions($trash = TRUE) {
691
+		$this->_trash_or_restore_items($this->_question_model, $trash);
692 692
 	}
693 693
 
694 694
 
@@ -700,21 +700,21 @@  discard block
 block discarded – undo
700 700
 *@param EEM_Soft_Delete_Base $model
701 701
 	 * @param boolean $trash whether to trash or restore
702 702
 	 */
703
-	private function _trash_or_restore_items( EEM_Soft_Delete_Base $model, $trash = TRUE ) {
703
+	private function _trash_or_restore_items(EEM_Soft_Delete_Base $model, $trash = TRUE) {
704 704
 
705
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
705
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
706 706
 
707 707
 		$success = 1;
708 708
 		//Checkboxes
709 709
 		//echo "trash $trash";
710 710
 		//var_dump($this->_req_data['checkbox']);die;
711
-		if ( isset( $this->_req_data['checkbox'] )) {
712
-			if ( ! empty( $this->_req_data['checkbox'] ) && is_array( $this->_req_data['checkbox'] )) {
711
+		if (isset($this->_req_data['checkbox'])) {
712
+			if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
713 713
 				// if array has more than one element than success message should be plural
714
-				$success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1;
714
+				$success = count($this->_req_data['checkbox']) > 1 ? 2 : 1;
715 715
 				// cycle thru bulk action checkboxes
716
-				while (list( $ID, $value ) = each($this->_req_data['checkbox'])) {
717
-					if ( ! $model->delete_or_restore_by_ID($trash,absint($ID))) {
716
+				while (list($ID, $value) = each($this->_req_data['checkbox'])) {
717
+					if ( ! $model->delete_or_restore_by_ID($trash, absint($ID))) {
718 718
 						$success = 0;
719 719
 					}
720 720
 				}
@@ -722,7 +722,7 @@  discard block
 block discarded – undo
722 722
 			} else {
723 723
 				// grab single id and delete
724 724
 				$ID = absint($this->_req_data['checkbox']);
725
-				if ( ! $model->delete_or_restore_by_ID($trash,$ID)) {
725
+				if ( ! $model->delete_or_restore_by_ID($trash, $ID)) {
726 726
 					$success = 0;
727 727
 				}
728 728
 			}
@@ -730,25 +730,25 @@  discard block
 block discarded – undo
730 730
 		} else {
731 731
 			// delete via trash link
732 732
 			// grab single id and delete
733
-			$ID = absint($this->_req_data[ $model->primary_key_name() ]);
734
-			if ( ! $model->delete_or_restore_by_ID($trash,$ID)) {
733
+			$ID = absint($this->_req_data[$model->primary_key_name()]);
734
+			if ( ! $model->delete_or_restore_by_ID($trash, $ID)) {
735 735
 				$success = 0;
736 736
 			}
737 737
 
738 738
 		}
739 739
 
740 740
 
741
-		$action = $model instanceof EEM_Question ? 'default' : 'question_groups';//strtolower( $model->item_name(2) );
741
+		$action = $model instanceof EEM_Question ? 'default' : 'question_groups'; //strtolower( $model->item_name(2) );
742 742
 		//echo "action :$action";
743 743
 		//$action = 'questions' ? 'default' : $action;
744
-		if($trash){
744
+		if ($trash) {
745 745
 			$action_desc = 'trashed';
746 746
 			$status = 'trash';
747
-		}else{
747
+		} else {
748 748
 			$action_desc = 'restored';
749 749
 			$status = 'all';
750 750
 		}
751
-		$this->_redirect_after_action( $success, $model->item_name($success), $action_desc, array( 'action' => $action, 'status'=>$status ) );
751
+		$this->_redirect_after_action($success, $model->item_name($success), $action_desc, array('action' => $action, 'status'=>$status));
752 752
 	}
753 753
 
754 754
 
@@ -759,16 +759,16 @@  discard block
 block discarded – undo
759 759
 	 * @param bool|false $count
760 760
 	 * @return \EE_Soft_Delete_Base_Class[]|int
761 761
 	 */
762
-	public function get_trashed_questions( $per_page, $current_page = 1, $count = FALSE ) {
762
+	public function get_trashed_questions($per_page, $current_page = 1, $count = FALSE) {
763 763
 		$query_params = $this->get_query_params(EEM_Question::instance(), $per_page, $current_page);
764 764
 
765
-		if( $count ){
765
+		if ($count) {
766 766
 			//note: this a subclass of EEM_Soft_Delete_Base, so this is actually only getting non-trashed items
767
-			$where = isset( $query_params[0] ) ? array( $query_params[0] ) : array();
768
-			$results=$this->_question_model->count_deleted($where);
769
-		}else{
767
+			$where = isset($query_params[0]) ? array($query_params[0]) : array();
768
+			$results = $this->_question_model->count_deleted($where);
769
+		} else {
770 770
 			//note: this a subclass of EEM_Soft_Delete_Base, so this is actually only getting non-trashed items
771
-			$results=$this->_question_model->get_all_deleted($query_params);
771
+			$results = $this->_question_model->get_all_deleted($query_params);
772 772
 		}
773 773
 		return $results;
774 774
 	}
@@ -781,13 +781,13 @@  discard block
 block discarded – undo
781 781
 	 * @param bool|false $count
782 782
 	 * @return \EE_Soft_Delete_Base_Class[]
783 783
 	 */
784
-	public function get_question_groups( $per_page, $current_page = 1, $count = FALSE ) {
785
-		$questionGroupModel=EEM_Question_Group::instance();
786
-		$query_params=$this->get_query_params($questionGroupModel,$per_page,$current_page);
787
-		if ($count){
788
-			$where = isset( $query_params[0] ) ? array( $query_params[0] ) : array();
784
+	public function get_question_groups($per_page, $current_page = 1, $count = FALSE) {
785
+		$questionGroupModel = EEM_Question_Group::instance();
786
+		$query_params = $this->get_query_params($questionGroupModel, $per_page, $current_page);
787
+		if ($count) {
788
+			$where = isset($query_params[0]) ? array($query_params[0]) : array();
789 789
 			$results = $questionGroupModel->count($where);
790
-		}else{
790
+		} else {
791 791
 			$results = $questionGroupModel->get_all($query_params);
792 792
 		}
793 793
 		return $results;
@@ -801,14 +801,14 @@  discard block
 block discarded – undo
801 801
 	 * @param bool $count
802 802
 	 * @return \EE_Soft_Delete_Base_Class[]|int
803 803
 	 */
804
-	public function get_trashed_question_groups( $per_page, $current_page = 1, $count = FALSE ) {
805
-		$questionGroupModel=EEM_Question_Group::instance();
806
-		$query_params=$this->get_query_params($questionGroupModel,$per_page,$current_page);
807
-		if($count){
808
-			$where = isset( $query_params[0] ) ? array($query_params[0]) : array();
804
+	public function get_trashed_question_groups($per_page, $current_page = 1, $count = FALSE) {
805
+		$questionGroupModel = EEM_Question_Group::instance();
806
+		$query_params = $this->get_query_params($questionGroupModel, $per_page, $current_page);
807
+		if ($count) {
808
+			$where = isset($query_params[0]) ? array($query_params[0]) : array();
809 809
 			$query_params['limit'] = NULL;
810 810
 			$results = $questionGroupModel->count_deleted($where);
811
-		}else{
811
+		} else {
812 812
 			$results = $questionGroupModel->get_all_deleted($query_params);
813 813
 		}
814 814
 		return $results;
@@ -821,32 +821,32 @@  discard block
 block discarded – undo
821 821
 	 */
822 822
 	public function update_question_group_order() {
823 823
 
824
-		$success = esc_html__( 'Question group order was updated successfully.', 'event_espresso' );
824
+		$success = esc_html__('Question group order was updated successfully.', 'event_espresso');
825 825
 
826 826
 		// grab our row IDs
827
-		$row_ids = isset( $this->_req_data['row_ids'] ) && ! empty( $this->_req_data['row_ids'] )
828
-			? explode( ',', rtrim( $this->_req_data['row_ids'], ',' ))
827
+		$row_ids = isset($this->_req_data['row_ids']) && ! empty($this->_req_data['row_ids'])
828
+			? explode(',', rtrim($this->_req_data['row_ids'], ','))
829 829
 			: array();
830 830
 
831
-		$perpage = !empty( $this->_req_data['perpage'] )
831
+		$perpage = ! empty($this->_req_data['perpage'])
832 832
 			? (int) $this->_req_data['perpage']
833 833
 			: NULL;
834
-		$curpage = !empty( $this->_req_data['curpage'] )
834
+		$curpage = ! empty($this->_req_data['curpage'])
835 835
 			? (int) $this->_req_data['curpage']
836 836
 			: NULL;
837 837
 
838
-		if ( ! empty( $row_ids ) ) {
838
+		if ( ! empty($row_ids)) {
839 839
 			//figure out where we start the row_id count at for the current page.
840
-			$qsgcount = empty( $curpage ) ? 0 : ($curpage - 1 ) * $perpage;
840
+			$qsgcount = empty($curpage) ? 0 : ($curpage - 1) * $perpage;
841 841
 
842
-			$row_count = count( $row_ids );
843
-			for( $i = 0; $i < $row_count; $i++ ) {
842
+			$row_count = count($row_ids);
843
+			for ($i = 0; $i < $row_count; $i++) {
844 844
 				//Update the questions when re-ordering
845 845
 				$updated = EEM_Question_Group::instance()->update(
846
-					array( 'QSG_order' => $qsgcount ),
847
-					array( array( 'QSG_ID' => $row_ids[ $i ] ) )
846
+					array('QSG_order' => $qsgcount),
847
+					array(array('QSG_ID' => $row_ids[$i]))
848 848
 				);
849
-				if ( $updated === false ) {
849
+				if ($updated === false) {
850 850
 					$success = false;
851 851
 				}
852 852
 				$qsgcount++;
@@ -856,10 +856,10 @@  discard block
 block discarded – undo
856 856
 		}
857 857
 
858 858
 		$errors = ! $success
859
-			? esc_html__( 'An error occurred. The question group order was not updated.', 'event_espresso' )
859
+			? esc_html__('An error occurred. The question group order was not updated.', 'event_espresso')
860 860
 			: false;
861 861
 
862
-		echo json_encode( array( 'return_data' => false, 'success' => $success, 'errors' => $errors ));
862
+		echo json_encode(array('return_data' => false, 'success' => $success, 'errors' => $errors));
863 863
 		die();
864 864
 
865 865
 	}
@@ -878,17 +878,17 @@  discard block
 block discarded – undo
878 878
 		$this->_template_args['values'] = $this->_yes_no_values;
879 879
 		add_action(
880 880
 			'AHEE__Extend_Registration_Form_Admin_Page___reg_form_settings_template',
881
-			array( $this, 'email_validation_settings_form' ),
881
+			array($this, 'email_validation_settings_form'),
882 882
 			2
883 883
 		);
884
-		$this->_template_args = (array)apply_filters(
884
+		$this->_template_args = (array) apply_filters(
885 885
 			'FHEE__Extend_Registration_Form_Admin_Page___reg_form_settings___template_args',
886 886
 			$this->_template_args
887 887
 		);
888
-		$this->_set_add_edit_form_tags( 'update_reg_form_settings' );
889
-		$this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE );
888
+		$this->_set_add_edit_form_tags('update_reg_form_settings');
889
+		$this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE);
890 890
 		$this->_template_args['admin_page_content'] = EEH_Template::display_template(
891
-			REGISTRATION_FORM_CAF_TEMPLATE_PATH . 'reg_form_settings.template.php',
891
+			REGISTRATION_FORM_CAF_TEMPLATE_PATH.'reg_form_settings.template.php',
892 892
 			$this->_template_args,
893 893
 			TRUE
894 894
 		);
@@ -909,7 +909,7 @@  discard block
 block discarded – undo
909 909
 			EE_Registry::instance()->CFG,
910 910
 			__FILE__, __FUNCTION__, __LINE__
911 911
 		);
912
-		$this->_redirect_after_action( $success, esc_html__('Registration Form Options', 'event_espresso'), 'updated', array( 'action' => 'view_reg_form_settings' ) );
912
+		$this->_redirect_after_action($success, esc_html__('Registration Form Options', 'event_espresso'), 'updated', array('action' => 'view_reg_form_settings'));
913 913
 	}
914 914
 
915 915
 
@@ -940,20 +940,20 @@  discard block
 block discarded – undo
940 940
 				'layout_strategy' => new EE_Admin_Two_Column_Layout(),
941 941
 				'subsections'     => array(
942 942
 					'email_validation_hdr'           => new EE_Form_Section_HTML(
943
-						EEH_HTML::h2( esc_html__( 'Email Validation Settings', 'event_espresso' ) )
943
+						EEH_HTML::h2(esc_html__('Email Validation Settings', 'event_espresso'))
944 944
 					),
945 945
 					'email_validation_level' => new EE_Select_Input(
946 946
 						array(
947
-							'basic'      => esc_html__( 'Basic', 'event_espresso' ),
948
-							'wp_default' => esc_html__( 'WordPress Default', 'event_espresso' ),
949
-							'i18n'       => esc_html__( 'International', 'event_espresso' ),
950
-							'i18n_dns'   => esc_html__( 'International + DNS Check', 'event_espresso' ),
947
+							'basic'      => esc_html__('Basic', 'event_espresso'),
948
+							'wp_default' => esc_html__('WordPress Default', 'event_espresso'),
949
+							'i18n'       => esc_html__('International', 'event_espresso'),
950
+							'i18n_dns'   => esc_html__('International + DNS Check', 'event_espresso'),
951 951
 						),
952 952
 						array(
953
-							'html_label_text' => esc_html__( 'Email Validation Level', 'event_espresso' )
954
-							                     . EEH_Template::get_help_tab_link( 'email_validation_info' ),
955
-							'html_help_text'  => esc_html__( 'These levels range from basic validation ( ie: [email protected] ) to more advanced checks against international email addresses (ie: üñîçøðé@example.com ) with additional MX and A record checks to confirm the domain actually exists. More information on on each level can be found within the help section.', 'event_espresso'),
956
-							'default' => isset( EE_Registry::instance()->CFG->registration->email_validation_level )
953
+							'html_label_text' => esc_html__('Email Validation Level', 'event_espresso')
954
+							                     . EEH_Template::get_help_tab_link('email_validation_info'),
955
+							'html_help_text'  => esc_html__('These levels range from basic validation ( ie: [email protected] ) to more advanced checks against international email addresses (ie: üñîçøðé@example.com ) with additional MX and A record checks to confirm the domain actually exists. More information on on each level can be found within the help section.', 'event_espresso'),
956
+							'default' => isset(EE_Registry::instance()->CFG->registration->email_validation_level)
957 957
 								? EE_Registry::instance()->CFG->registration->email_validation_level
958 958
 								: 'wp_default',
959 959
 							'required'        => false
@@ -972,18 +972,18 @@  discard block
 block discarded – undo
972 972
 	 * @param \EE_Registration_Config $EE_Registration_Config
973 973
 	 * @return \EE_Registration_Config
974 974
 	 */
975
-	public function update_email_validation_settings_form( EE_Registration_Config $EE_Registration_Config ) {
975
+	public function update_email_validation_settings_form(EE_Registration_Config $EE_Registration_Config) {
976 976
 		try {
977 977
 			$email_validation_settings_form = $this->_email_validation_settings_form();
978 978
 			// if not displaying a form, then check for form submission
979
-			if ( $email_validation_settings_form->was_submitted() ) {
979
+			if ($email_validation_settings_form->was_submitted()) {
980 980
 				// capture form data
981 981
 				$email_validation_settings_form->receive_form_submission();
982 982
 				// validate form data
983
-				if ( $email_validation_settings_form->is_valid() ) {
983
+				if ($email_validation_settings_form->is_valid()) {
984 984
 					// grab validated data from form
985 985
 					$valid_data = $email_validation_settings_form->valid_data();
986
-					if ( isset( $valid_data['email_validation_level'] ) ) {
986
+					if (isset($valid_data['email_validation_level'])) {
987 987
 						$EE_Registration_Config->email_validation_level = $valid_data['email_validation_level'];
988 988
 					} else {
989 989
 						EE_Error::add_error(
@@ -997,7 +997,7 @@  discard block
 block discarded – undo
997 997
 						);
998 998
 					}
999 999
 				} else {
1000
-					if ( $email_validation_settings_form->submission_error_message() !== '' ) {
1000
+					if ($email_validation_settings_form->submission_error_message() !== '') {
1001 1001
 						EE_Error::add_error(
1002 1002
 							$email_validation_settings_form->submission_error_message(),
1003 1003
 							__FILE__,
@@ -1007,7 +1007,7 @@  discard block
 block discarded – undo
1007 1007
 					}
1008 1008
 				}
1009 1009
 			}
1010
-		} catch ( EE_Error $e ) {
1010
+		} catch (EE_Error $e) {
1011 1011
 			$e->get_error();
1012 1012
 		}
1013 1013
 		return $EE_Registration_Config;
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -512,7 +512,7 @@
 block discarded – undo
512 512
 	 * Deletes the specified question (and its associated question options) or question group
513 513
 	 * @param int $id
514 514
 	 * @param EEM_Soft_Delete_Base $model
515
-	 * @return boolean
515
+	 * @return integer
516 516
 	 */
517 517
 	protected function _delete_item( $id, $model ) {
518 518
 		if( $model instanceof EEM_Question ) {
Please login to merge, or discard this patch.
Braces   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -497,12 +497,12 @@  discard block
 block discarded – undo
497 497
 				}
498 498
 			}
499 499
 
500
-		}elseif( !empty($this->_req_data['QSG_ID'])){
500
+		} elseif( !empty($this->_req_data['QSG_ID'])){
501 501
 			$success = $this->_delete_item( $this->_req_data['QSG_ID'], $model );
502 502
 
503
-		}elseif( !empty($this->_req_data['QST_ID'])){
503
+		} elseif( !empty($this->_req_data['QST_ID'])){
504 504
 			$success = $this->_delete_item( $this->_req_data['QST_ID'], $model );
505
-		}else{
505
+		} else{
506 506
 			EE_Error::add_error( sprintf(esc_html__("No Questions or Question Groups were selected for deleting. This error usually shows when you've attempted to delete via bulk action but there were no selections.", "event_espresso")), __FILE__, __FUNCTION__, __LINE__ );
507 507
 		}
508 508
 		return $success;
@@ -551,7 +551,7 @@  discard block
 block discarded – undo
551 551
 			$questionGroup=$this->_question_group_model->get_one_by_ID( $ID);
552 552
 			$additional_hidden_fields=array('QSG_ID'=>array('type'=>'hidden','value'=>$ID));
553 553
 			$this->_set_add_edit_form_tags('update_question_group', $additional_hidden_fields);
554
-		}else{
554
+		} else{
555 555
 			/** @var EE_Question_Group $questionGroup */
556 556
 			$questionGroup = EEM_Question_Group::instance()->create_default_object();
557 557
 			$questionGroup->set_order_to_latest();
@@ -754,7 +754,7 @@  discard block
 block discarded – undo
754 754
 		if($trash){
755 755
 			$action_desc = 'trashed';
756 756
 			$status = 'trash';
757
-		}else{
757
+		} else{
758 758
 			$action_desc = 'restored';
759 759
 			$status = 'all';
760 760
 		}
@@ -776,7 +776,7 @@  discard block
 block discarded – undo
776 776
 			//note: this a subclass of EEM_Soft_Delete_Base, so this is actually only getting non-trashed items
777 777
 			$where = isset( $query_params[0] ) ? array( $query_params[0] ) : array();
778 778
 			$results=$this->_question_model->count_deleted($where);
779
-		}else{
779
+		} else{
780 780
 			//note: this a subclass of EEM_Soft_Delete_Base, so this is actually only getting non-trashed items
781 781
 			$results=$this->_question_model->get_all_deleted($query_params);
782 782
 		}
@@ -797,7 +797,7 @@  discard block
 block discarded – undo
797 797
 		if ($count){
798 798
 			$where = isset( $query_params[0] ) ? array( $query_params[0] ) : array();
799 799
 			$results = $questionGroupModel->count($where);
800
-		}else{
800
+		} else{
801 801
 			$results = $questionGroupModel->get_all($query_params);
802 802
 		}
803 803
 		return $results;
@@ -818,7 +818,7 @@  discard block
 block discarded – undo
818 818
 			$where = isset( $query_params[0] ) ? array($query_params[0]) : array();
819 819
 			$query_params['limit'] = NULL;
820 820
 			$results = $questionGroupModel->count_deleted($where);
821
-		}else{
821
+		} else{
822 822
 			$results = $questionGroupModel->get_all_deleted($query_params);
823 823
 		}
824 824
 		return $results;
Please login to merge, or discard this patch.
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -245,13 +245,13 @@  discard block
 block discarded – undo
245 245
 					'persistent' => FALSE
246 246
 					),
247 247
 				'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array('_publish_post_box' ) ),
248
-                'help_tabs' => array(
248
+				'help_tabs' => array(
249 249
 					'registration_form_add_question_help_tab' => array(
250 250
 						'title' => esc_html__('Add Question', 'event_espresso'),
251 251
 						'filename' => 'registration_form_add_question'
252 252
 						),
253 253
 					),
254
-                'help_tour' => array( 'Registration_Form_Add_Question_Help_Tour'),
254
+				'help_tour' => array( 'Registration_Form_Add_Question_Help_Tour'),
255 255
 				'require_nonce' => FALSE
256 256
 				),
257 257
 
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
 						'filename' => 'registration_form_add_question_group'
269 269
 						),
270 270
 					),
271
-                'help_tour' => array( 'Registration_Form_Add_Question_Group_Help_Tour'),
271
+				'help_tour' => array( 'Registration_Form_Add_Question_Group_Help_Tour'),
272 272
 				'require_nonce' => FALSE
273 273
 				),
274 274
 
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
 						'filename' => 'registration_form_edit_question_group'
287 287
 						),
288 288
 					),
289
-                'help_tour' => array( 'Registration_Form_Edit_Question_Group_Help_Tour'),
289
+				'help_tour' => array( 'Registration_Form_Edit_Question_Group_Help_Tour'),
290 290
 				'require_nonce' => FALSE
291 291
 				),
292 292
 
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
 						'filename' => 'registration_form_reg_form_settings'
306 306
 						),
307 307
 					),
308
-                'help_tour' => array( 'Registration_Form_Settings_Help_Tour'),
308
+				'help_tour' => array( 'Registration_Form_Settings_Help_Tour'),
309 309
 				'require_nonce' => FALSE
310 310
 				)
311 311
 
@@ -951,7 +951,7 @@  discard block
 block discarded – undo
951 951
 						),
952 952
 						array(
953 953
 							'html_label_text' => esc_html__( 'Email Validation Level', 'event_espresso' )
954
-							                     . EEH_Template::get_help_tab_link( 'email_validation_info' ),
954
+												 . EEH_Template::get_help_tab_link( 'email_validation_info' ),
955 955
 							'html_help_text'  => esc_html__( 'These levels range from basic validation ( ie: [email protected] ) to more advanced checks against international email addresses (ie: üñîçøðé@example.com ) with additional MX and A record checks to confirm the domain actually exists. More information on on each level can be found within the help section.', 'event_espresso'),
956 956
 							'default' => isset( EE_Registry::instance()->CFG->registration->email_validation_level )
957 957
 								? EE_Registry::instance()->CFG->registration->email_validation_level
Please login to merge, or discard this patch.