Completed
Branch BUG-8698-ticket-sellouts (195489)
by
unknown
119:57 queued 101:29
created
core/db_models/EEM_Registration.model.php 2 patches
Indentation   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -219,11 +219,11 @@  discard block
 block discarded – undo
219 219
 
220 220
 
221 221
 	/**
222
-	*		retrieve ALL registrations for a particular Attendee from db
223
-	* 		@access		public
224
-	* 		@param		int		$ATT_ID
225
-	*		@return 	EE_Registration[]
226
-	*/
222
+	 *		retrieve ALL registrations for a particular Attendee from db
223
+	 * 		@access		public
224
+	 * 		@param		int		$ATT_ID
225
+	 *		@return 	EE_Registration[]
226
+	 */
227 227
 	public function get_all_registrations_for_attendee( $ATT_ID = 0 ) {
228 228
 		if ( ! $ATT_ID ) {
229 229
 			return FALSE;
@@ -250,14 +250,14 @@  discard block
 block discarded – undo
250 250
 
251 251
 
252 252
 	/**
253
-	*		retrieve registration for a specific transaction attendee from db
254
-	*
255
-	* 		@access		public
256
-	* 		@param	int	$TXN_ID
257
-	* 		@param    int		$ATT_ID
258
-	* 		@param    int		$att_nmbr 	in case the ATT_ID is the same for multiple registrations (same details used) then the attendee number is required
259
-	*		@return 		mixed		array on success, FALSE on fail
260
-	*/
253
+	 *		retrieve registration for a specific transaction attendee from db
254
+	 *
255
+	 * 		@access		public
256
+	 * 		@param	int	$TXN_ID
257
+	 * 		@param    int		$ATT_ID
258
+	 * 		@param    int		$att_nmbr 	in case the ATT_ID is the same for multiple registrations (same details used) then the attendee number is required
259
+	 *		@return 		mixed		array on success, FALSE on fail
260
+	 */
261 261
 	public function get_registration_for_transaction_attendee( $TXN_ID = 0, $ATT_ID = 0, $att_nmbr = 0 ) {
262 262
 		return $this->get_one(array(
263 263
 			array(
@@ -270,12 +270,12 @@  discard block
 block discarded – undo
270 270
 
271 271
 
272 272
 	/**
273
-	*		get the number of registrations per day  for the Registration Admin page Reports Tab.
273
+	 *		get the number of registrations per day  for the Registration Admin page Reports Tab.
274 274
 	 *		(doesn't utilize models because it's a fairly specialized query)
275
-	* 		@access		public
275
+	 * 		@access		public
276 276
 	 *		@param $period string which can be passed to php's strtotime function (eg "-1 month")
277 277
 	 *		@return stdClass[] with properties regDate and total
278
-	*/
278
+	 */
279 279
 	public function get_registrations_per_day_report( $period = '-1 month' ) {
280 280
 
281 281
 		$sql_date = $this->convert_datetime_for_query( 'REG_date', date("Y-m-d H:i:s", strtotime($period) ), 'Y-m-d H:i:s', 'UTC' );
@@ -304,11 +304,11 @@  discard block
 block discarded – undo
304 304
 
305 305
 
306 306
 	/**
307
-	*		get the number of registrations per event  for the Registration Admin page Reports Tab
308
-	* 		@access		public
307
+	 *		get the number of registrations per event  for the Registration Admin page Reports Tab
308
+	 * 		@access		public
309 309
 	 * @param $period string which can be passed to php's strtotime function (eg "-1 month")
310 310
 	 *		@return stdClass[] each with properties event_name, reg_limit, and total
311
-	*/
311
+	 */
312 312
 	public function get_registrations_per_event_report( $period = '-1 month' ) {
313 313
 
314 314
 		$date_sql = $this->convert_datetime_for_query( 'REG_date', date( "Y-m-d H:i:s", strtotime( $period )), 'Y-m-d H:i:s', 'UTC' );
Please login to merge, or discard this patch.
Spacing   +92 added lines, -92 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
2
-require_once ( EE_MODELS . 'EEM_Soft_Delete_Base.model.php' );
3
-require_once ( EE_CLASSES . 'EE_Registration.class.php' );
2
+require_once (EE_MODELS.'EEM_Soft_Delete_Base.model.php');
3
+require_once (EE_CLASSES.'EE_Registration.class.php');
4 4
 /**
5 5
  *
6 6
  * Registration Model
@@ -92,31 +92,31 @@  discard block
 block discarded – undo
92 92
 	 *    Note this just sends the timezone info to the date time model field objects.  Default is NULL (and will be assumed using the set timezone in the 'timezone_string' wp option)
93 93
 	 * @return \EEM_Registration
94 94
 	 */
95
-	protected function __construct( $timezone ) {
96
-		$this->singular_item = __('Registration','event_espresso');
97
-		$this->plural_item = __('Registrations','event_espresso');
95
+	protected function __construct($timezone) {
96
+		$this->singular_item = __('Registration', 'event_espresso');
97
+		$this->plural_item = __('Registrations', 'event_espresso');
98 98
 
99 99
 		$this->_tables = array(
100
-			'Registration'=>new EE_Primary_Table('esp_registration','REG_ID')
100
+			'Registration'=>new EE_Primary_Table('esp_registration', 'REG_ID')
101 101
 		);
102 102
 		$this->_fields = array(
103 103
 			'Registration'=>array(
104
-				'REG_ID'=>new EE_Primary_Key_Int_Field('REG_ID', __('Registration ID','event_espresso')),
105
-				'EVT_ID'=>new EE_Foreign_Key_Int_Field('EVT_ID', __('Event ID','event_espresso'), false, 0, 'Event'),
106
-				'ATT_ID'=>new EE_Foreign_Key_Int_Field('ATT_ID', __('Attendee ID','event_espresso'), false, 0, 'Attendee'),
107
-				'TXN_ID'=>new EE_Foreign_Key_Int_Field('TXN_ID', __('Transaction ID','event_espresso'), false, 0, 'Transaction'),
108
-				'TKT_ID'=>new EE_Foreign_Key_Int_Field('TKT_ID', __('Ticket ID','event_espresso'), false, 0, 'Ticket'),
109
-				'STS_ID'=>new EE_Foreign_Key_String_Field('STS_ID', __('Status ID','event_espresso'), false, EEM_Registration::status_id_incomplete, 'Status'),
110
-				'REG_date'=>new EE_Datetime_Field('REG_date', __('Time registration occurred','event_espresso'), false, time(), $timezone ),
111
-				'REG_final_price'=>new EE_Money_Field('REG_final_price', __('Registration\'s share of the transaction total','event_espresso'), false, 0),
112
-				'REG_paid'=>new EE_Money_Field('REG_paid', __('Amount paid to date towards registration','event_espresso'), false, 0),
113
-				'REG_session'=>new EE_Plain_Text_Field('REG_session', __('Session ID of registration','event_espresso'), false, ''),
114
-				'REG_code'=>new EE_Plain_Text_Field('REG_code', __('Unique Code for this registration','event_espresso'), false, ''),
115
-				'REG_url_link'=>new EE_Plain_Text_Field('REG_url_link', __('String to be used in URL for identifying registration','event_espresso'), false, ''),
116
-				'REG_count'=>new EE_Integer_Field('REG_count', __('Count of this registration in the group registration ','event_espresso'), true, 1),
117
-				'REG_group_size'=>new EE_Integer_Field('REG_group_size', __('Number of registrations on this group','event_espresso'), false, 1),
118
-				'REG_att_is_going'=>new EE_Boolean_Field('REG_att_is_going', __('Flag indicating the registrant plans on attending','event_espresso'), false, false),
119
-				'REG_deleted' => new EE_Trashed_Flag_Field('REG_deleted', __('Flag indicating if registration has been archived or not.', 'event_espresso'), false, false )
104
+				'REG_ID'=>new EE_Primary_Key_Int_Field('REG_ID', __('Registration ID', 'event_espresso')),
105
+				'EVT_ID'=>new EE_Foreign_Key_Int_Field('EVT_ID', __('Event ID', 'event_espresso'), false, 0, 'Event'),
106
+				'ATT_ID'=>new EE_Foreign_Key_Int_Field('ATT_ID', __('Attendee ID', 'event_espresso'), false, 0, 'Attendee'),
107
+				'TXN_ID'=>new EE_Foreign_Key_Int_Field('TXN_ID', __('Transaction ID', 'event_espresso'), false, 0, 'Transaction'),
108
+				'TKT_ID'=>new EE_Foreign_Key_Int_Field('TKT_ID', __('Ticket ID', 'event_espresso'), false, 0, 'Ticket'),
109
+				'STS_ID'=>new EE_Foreign_Key_String_Field('STS_ID', __('Status ID', 'event_espresso'), false, EEM_Registration::status_id_incomplete, 'Status'),
110
+				'REG_date'=>new EE_Datetime_Field('REG_date', __('Time registration occurred', 'event_espresso'), false, time(), $timezone),
111
+				'REG_final_price'=>new EE_Money_Field('REG_final_price', __('Registration\'s share of the transaction total', 'event_espresso'), false, 0),
112
+				'REG_paid'=>new EE_Money_Field('REG_paid', __('Amount paid to date towards registration', 'event_espresso'), false, 0),
113
+				'REG_session'=>new EE_Plain_Text_Field('REG_session', __('Session ID of registration', 'event_espresso'), false, ''),
114
+				'REG_code'=>new EE_Plain_Text_Field('REG_code', __('Unique Code for this registration', 'event_espresso'), false, ''),
115
+				'REG_url_link'=>new EE_Plain_Text_Field('REG_url_link', __('String to be used in URL for identifying registration', 'event_espresso'), false, ''),
116
+				'REG_count'=>new EE_Integer_Field('REG_count', __('Count of this registration in the group registration ', 'event_espresso'), true, 1),
117
+				'REG_group_size'=>new EE_Integer_Field('REG_group_size', __('Number of registrations on this group', 'event_espresso'), false, 1),
118
+				'REG_att_is_going'=>new EE_Boolean_Field('REG_att_is_going', __('Flag indicating the registrant plans on attending', 'event_espresso'), false, false),
119
+				'REG_deleted' => new EE_Trashed_Flag_Field('REG_deleted', __('Flag indicating if registration has been archived or not.', 'event_espresso'), false, false)
120 120
 			)
121 121
 		);
122 122
 		$this->_model_relations = array(
@@ -128,11 +128,11 @@  discard block
 block discarded – undo
128 128
 			'Answer'=>new EE_Has_Many_Relation(),
129 129
 			'Checkin'=>new EE_Has_Many_Relation(),
130 130
 			'Registration_Payment' => new EE_Has_Many_Relation(),
131
-			'Payment'=>new EE_HABTM_Relation( 'Registration_Payment' ),
131
+			'Payment'=>new EE_HABTM_Relation('Registration_Payment'),
132 132
 		);
133 133
 		$this->_model_chain_to_wp_user = 'Event';
134 134
 
135
-		parent::__construct( $timezone );
135
+		parent::__construct($timezone);
136 136
 	}
137 137
 
138 138
 
@@ -165,9 +165,9 @@  discard block
 block discarded – undo
165 165
 	 *		@param bool  $translated If true will return the values as singular localized strings
166 166
 	 *		@return array
167 167
 	 */
168
-	public static function reg_status_array( $exclude = array(), $translated = FALSE ) {
169
-		EEM_Registration::instance()->_get_registration_status_array( $exclude );
170
-		return $translated ? EEM_Status::instance()->localized_status( self::$_reg_status, FALSE, 'sentence') : self::$_reg_status;
168
+	public static function reg_status_array($exclude = array(), $translated = FALSE) {
169
+		EEM_Registration::instance()->_get_registration_status_array($exclude);
170
+		return $translated ? EEM_Status::instance()->localized_status(self::$_reg_status, FALSE, 'sentence') : self::$_reg_status;
171 171
 	}
172 172
 
173 173
 
@@ -178,19 +178,19 @@  discard block
 block discarded – undo
178 178
 	 * @param array $exclude
179 179
 	 * @return array
180 180
 	 */
181
-	private function _get_registration_status_array( $exclude = array() ) {
181
+	private function _get_registration_status_array($exclude = array()) {
182 182
 		//in the very rare circumstance that we are deleting a model's table's data
183 183
 		//and the table hasn't actually been created, this could have an error
184 184
 		/** @type WPDB $wpdb */
185 185
 		global $wpdb;
186
-		EE_Registry::instance()->load_helper( 'Activation' );
187
-		if( EEH_Activation::table_exists( $wpdb->prefix . 'esp_status' ) ){
188
-			$SQL = 'SELECT STS_ID, STS_code FROM '. $wpdb->prefix . 'esp_status WHERE STS_type = "registration"';
189
-			$results = $wpdb->get_results( $SQL );
186
+		EE_Registry::instance()->load_helper('Activation');
187
+		if (EEH_Activation::table_exists($wpdb->prefix.'esp_status')) {
188
+			$SQL = 'SELECT STS_ID, STS_code FROM '.$wpdb->prefix.'esp_status WHERE STS_type = "registration"';
189
+			$results = $wpdb->get_results($SQL);
190 190
 			self::$_reg_status = array();
191
-			foreach ( $results as $status ) {
192
-				if ( ! in_array( $status->STS_ID, $exclude )) {
193
-					self::$_reg_status[ $status->STS_ID ] = $status->STS_code;
191
+			foreach ($results as $status) {
192
+				if ( ! in_array($status->STS_ID, $exclude)) {
193
+					self::$_reg_status[$status->STS_ID] = $status->STS_code;
194 194
 				}
195 195
 			}
196 196
 		}
@@ -205,15 +205,15 @@  discard block
 block discarded – undo
205 205
 	 * @param  array  $where_params Array of query_params as described in the comments for EEM_Base::get_all()
206 206
 	 * @return wpdb results array
207 207
 	 */
208
-	public function get_reg_months_and_years( $where_params ) {
208
+	public function get_reg_months_and_years($where_params) {
209 209
 		$query_params[0] = $where_params;
210 210
 		$query_params['group_by'] = array('reg_year', 'reg_month');
211
-		$query_params['order_by'] = array( 'REG_date' => 'DESC' );
211
+		$query_params['order_by'] = array('REG_date' => 'DESC');
212 212
 		$columns_to_select = array(
213 213
 			'reg_year' => array('YEAR(REG_date)', '%s'),
214 214
 			'reg_month' => array('MONTHNAME(REG_date)', '%s')
215 215
 			);
216
-		return $this->_get_all_wpdb_results( $query_params, OBJECT, $columns_to_select );
216
+		return $this->_get_all_wpdb_results($query_params, OBJECT, $columns_to_select);
217 217
 	}
218 218
 
219 219
 
@@ -225,11 +225,11 @@  discard block
 block discarded – undo
225 225
 	* 		@param		int		$ATT_ID
226 226
 	*		@return 	EE_Registration[]
227 227
 	*/
228
-	public function get_all_registrations_for_attendee( $ATT_ID = 0 ) {
229
-		if ( ! $ATT_ID ) {
228
+	public function get_all_registrations_for_attendee($ATT_ID = 0) {
229
+		if ( ! $ATT_ID) {
230 230
 			return FALSE;
231 231
 		}
232
-		return $this->get_all( array( array( 'ATT_ID' => $ATT_ID )));
232
+		return $this->get_all(array(array('ATT_ID' => $ATT_ID)));
233 233
 	}
234 234
 
235 235
 
@@ -240,8 +240,8 @@  discard block
 block discarded – undo
240 240
 	 * @param string $REG_url_link
241 241
 	 * @return EE_Registration
242 242
 	 */
243
-	public function get_registration_for_reg_url_link($REG_url_link){
244
-		if(!$REG_url_link){
243
+	public function get_registration_for_reg_url_link($REG_url_link) {
244
+		if ( ! $REG_url_link) {
245 245
 			return false;
246 246
 		}
247 247
 		return $this->get_one(array(array('REG_url_link'=>$REG_url_link)));
@@ -259,13 +259,13 @@  discard block
 block discarded – undo
259 259
 	* 		@param    int		$att_nmbr 	in case the ATT_ID is the same for multiple registrations (same details used) then the attendee number is required
260 260
 	*		@return 		mixed		array on success, FALSE on fail
261 261
 	*/
262
-	public function get_registration_for_transaction_attendee( $TXN_ID = 0, $ATT_ID = 0, $att_nmbr = 0 ) {
262
+	public function get_registration_for_transaction_attendee($TXN_ID = 0, $ATT_ID = 0, $att_nmbr = 0) {
263 263
 		return $this->get_one(array(
264 264
 			array(
265 265
 				'TXN_ID'=>$TXN_ID,
266 266
 				'ATT_ID'=>$ATT_ID
267 267
 			),
268
-			'limit'=>array( min( ( $att_nmbr-1 ), 0 ), 1 )
268
+			'limit'=>array(min(($att_nmbr - 1), 0), 1)
269 269
 		));
270 270
 	}
271 271
 
@@ -277,17 +277,17 @@  discard block
 block discarded – undo
277 277
 	 *		@param $period string which can be passed to php's strtotime function (eg "-1 month")
278 278
 	 *		@return stdClass[] with properties regDate and total
279 279
 	*/
280
-	public function get_registrations_per_day_report( $period = '-1 month' ) {
280
+	public function get_registrations_per_day_report($period = '-1 month') {
281 281
 
282
-		$sql_date = $this->convert_datetime_for_query( 'REG_date', date("Y-m-d H:i:s", strtotime($period) ), 'Y-m-d H:i:s', 'UTC' );
283
-		$where = array( 'REG_date' => array( '>=', $sql_date ), 'STS_ID' => array( '!=', EEM_Registration::status_id_incomplete ) );
282
+		$sql_date = $this->convert_datetime_for_query('REG_date', date("Y-m-d H:i:s", strtotime($period)), 'Y-m-d H:i:s', 'UTC');
283
+		$where = array('REG_date' => array('>=', $sql_date), 'STS_ID' => array('!=', EEM_Registration::status_id_incomplete));
284 284
 
285
-		if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_registrations', 'reg_per_day_report' ) ) {
285
+		if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_registrations', 'reg_per_day_report')) {
286 286
 			$where['Event.EVT_wp_user'] = get_current_user_id();
287 287
 		}
288 288
 
289
-		EE_Registry::instance()->load_helper( 'DTT_Helper' );
290
-		$query_interval = EEH_DTT_Helper::get_sql_query_interval_for_offset( $this->get_timezone(), 'REG_date' );
289
+		EE_Registry::instance()->load_helper('DTT_Helper');
290
+		$query_interval = EEH_DTT_Helper::get_sql_query_interval_for_offset($this->get_timezone(), 'REG_date');
291 291
 
292 292
 		$results = $this->_get_all_wpdb_results(
293 293
 				array(
@@ -297,8 +297,8 @@  discard block
 block discarded – undo
297 297
 				),
298 298
 				OBJECT,
299 299
 				array(
300
-					'regDate'=>array( 'DATE(' . $query_interval . ')','%s'),
301
-					'total'=>array('count(REG_ID)','%d')
300
+					'regDate'=>array('DATE('.$query_interval.')', '%s'),
301
+					'total'=>array('count(REG_ID)', '%d')
302 302
 				));
303 303
 		return $results;
304 304
 	}
@@ -313,23 +313,23 @@  discard block
 block discarded – undo
313 313
 	 * @return stdClass[] with properties Registration_REG_date and a column for each registration status as the STS_ID
314 314
 	 *                    (i.e. RAP)
315 315
 	 */
316
-	public function get_registrations_per_day_and_per_status_report( $period = '-1 month' ) {
316
+	public function get_registrations_per_day_and_per_status_report($period = '-1 month') {
317 317
 		global $wpdb;
318
-		$registration_table = $wpdb->prefix . 'esp_registration';
318
+		$registration_table = $wpdb->prefix.'esp_registration';
319 319
 		$event_table = $wpdb->posts;
320
-		$sql_date = date("Y-m-d H:i:s", strtotime($period) );
320
+		$sql_date = date("Y-m-d H:i:s", strtotime($period));
321 321
 
322 322
 		//prepare the query interval for displaying offset
323
-		EE_Registry::instance()->load_helper( 'DTT_Helper' );
324
-		$query_interval = EEH_DTT_Helper::get_sql_query_interval_for_offset( $this->get_timezone(), 'dates.REG_date' );
323
+		EE_Registry::instance()->load_helper('DTT_Helper');
324
+		$query_interval = EEH_DTT_Helper::get_sql_query_interval_for_offset($this->get_timezone(), 'dates.REG_date');
325 325
 
326 326
 		//inner date query
327 327
 		$inner_date_query = "SELECT DISTINCT REG_date from $registration_table ";
328 328
 		$inner_where = " WHERE";
329 329
 		//exclude events not authored by user if permissions in effect
330
-		if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_registrations', 'reg_per_event_report' ) ) {
330
+		if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_registrations', 'reg_per_event_report')) {
331 331
 			$inner_date_query .= "LEFT JOIN $event_table ON ID = EVT_ID";
332
-			$inner_where .= " post_author = " . get_current_user_id() . " AND";
332
+			$inner_where .= " post_author = ".get_current_user_id()." AND";
333 333
 		}
334 334
 		$inner_where .= " REG_date >= '$sql_date'";
335 335
 		$inner_date_query .= $inner_where;
@@ -341,8 +341,8 @@  discard block
 block discarded – undo
341 341
 		$select_parts = array();
342 342
 
343 343
 		//loop through registration stati to do parts for each status.
344
-		foreach ( EEM_Registration::reg_status_array() as $STS_ID => $STS_code ) {
345
-			if ( $STS_ID === EEM_Registration::status_id_incomplete ) {
344
+		foreach (EEM_Registration::reg_status_array() as $STS_ID => $STS_code) {
345
+			if ($STS_ID === EEM_Registration::status_id_incomplete) {
346 346
 				continue;
347 347
 			}
348 348
 			$select_parts[] = "COUNT($STS_code.REG_ID) as $STS_ID";
@@ -350,14 +350,14 @@  discard block
 block discarded – undo
350 350
 		}
351 351
 
352 352
 		//setup the selects
353
-		$select .= implode(', ', $select_parts );
353
+		$select .= implode(', ', $select_parts);
354 354
 		$select .= " FROM ($inner_date_query) AS dates LEFT JOIN ";
355 355
 
356 356
 		//setup the joins
357
-		$join .= implode( " LEFT JOIN ", $join_parts );
357
+		$join .= implode(" LEFT JOIN ", $join_parts);
358 358
 
359 359
 		//now let's put it all together
360
-		$query = $select . $join . ' GROUP BY Registration_REG_date';
360
+		$query = $select.$join.' GROUP BY Registration_REG_date';
361 361
 
362 362
 		//and execute it
363 363
 		$results = $wpdb->get_results(
@@ -378,23 +378,23 @@  discard block
 block discarded – undo
378 378
 	 * @param $period string which can be passed to php's strtotime function (eg "-1 month")
379 379
 	 *		@return stdClass[] each with properties event_name, reg_limit, and total
380 380
 	*/
381
-	public function get_registrations_per_event_report( $period = '-1 month' ) {
381
+	public function get_registrations_per_event_report($period = '-1 month') {
382 382
 
383
-		$date_sql = $this->convert_datetime_for_query( 'REG_date', date( "Y-m-d H:i:s", strtotime( $period )), 'Y-m-d H:i:s', 'UTC' );
384
-		$where = array( 'REG_date' => array( '>=', $date_sql ), 'STS_ID' => array( '!=', EEM_Registration::status_id_incomplete ) );
383
+		$date_sql = $this->convert_datetime_for_query('REG_date', date("Y-m-d H:i:s", strtotime($period)), 'Y-m-d H:i:s', 'UTC');
384
+		$where = array('REG_date' => array('>=', $date_sql), 'STS_ID' => array('!=', EEM_Registration::status_id_incomplete));
385 385
 
386
-		if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_registrations', 'reg_per_event_report' ) ) {
386
+		if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_registrations', 'reg_per_event_report')) {
387 387
 			$where['Event.EVT_wp_user'] = get_current_user_id();
388 388
 		}
389 389
 		$results = $this->_get_all_wpdb_results(array(
390 390
 			$where,
391 391
 			'group_by'=>'Event.EVT_name',
392 392
 			'order_by'=>'Event.EVT_name',
393
-			'limit'=>array(0,24)),
393
+			'limit'=>array(0, 24)),
394 394
 			OBJECT,
395 395
 			array(
396
-				'event_name'=>array('Event_CPT.post_title','%s'),
397
-				'total'=>array('COUNT(REG_ID)','%s')
396
+				'event_name'=>array('Event_CPT.post_title', '%s'),
397
+				'total'=>array('COUNT(REG_ID)', '%s')
398 398
 			)
399 399
 		);
400 400
 
@@ -412,19 +412,19 @@  discard block
 block discarded – undo
412 412
 	 * @return stdClass[] with properties `Registration_Event` and a column for each registration status as the STS_ID
413 413
 	 *                    (i.e. RAP)
414 414
 	 */
415
-	public function get_registrations_per_event_and_per_status_report( $period = '-1 month' ) {
415
+	public function get_registrations_per_event_and_per_status_report($period = '-1 month') {
416 416
 		global $wpdb;
417
-		$registration_table = $wpdb->prefix . 'esp_registration';
417
+		$registration_table = $wpdb->prefix.'esp_registration';
418 418
 		$event_table = $wpdb->posts;
419
-		$sql_date = date("Y-m-d H:i:s", strtotime($period) );
419
+		$sql_date = date("Y-m-d H:i:s", strtotime($period));
420 420
 
421 421
 		//inner date query
422 422
 		$inner_date_query = "SELECT DISTINCT EVT_ID, REG_date from $registration_table ";
423 423
 		$inner_where = " WHERE";
424 424
 		//exclude events not authored by user if permissions in effect
425
-		if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_registrations', 'reg_per_event_report' ) ) {
425
+		if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_registrations', 'reg_per_event_report')) {
426 426
 			$inner_date_query .= "LEFT JOIN $event_table ON ID = EVT_ID";
427
-			$inner_where .= " post_author = " . get_current_user_id() . " AND";
427
+			$inner_where .= " post_author = ".get_current_user_id()." AND";
428 428
 		}
429 429
 		$inner_where .= " REG_date >= '$sql_date'";
430 430
 		$inner_date_query .= $inner_where;
@@ -436,8 +436,8 @@  discard block
 block discarded – undo
436 436
 		$select_parts = array();
437 437
 
438 438
 		//loop through registration stati to do parts for each status.
439
-		foreach ( EEM_Registration::reg_status_array() as $STS_ID => $STS_code ) {
440
-			if ( $STS_ID === EEM_Registration::status_id_incomplete ) {
439
+		foreach (EEM_Registration::reg_status_array() as $STS_ID => $STS_code) {
440
+			if ($STS_ID === EEM_Registration::status_id_incomplete) {
441 441
 				continue;
442 442
 			}
443 443
 			$select_parts[] = "COUNT($STS_code.REG_ID) as $STS_ID";
@@ -445,14 +445,14 @@  discard block
 block discarded – undo
445 445
 		}
446 446
 
447 447
 		//setup the selects
448
-		$select .= implode( ', ', $select_parts );
448
+		$select .= implode(', ', $select_parts);
449 449
 		$select .= " FROM ($inner_date_query) AS dates LEFT JOIN $event_table as Event ON Event.ID = dates.EVT_ID LEFT JOIN ";
450 450
 
451 451
 		//setup remaining joins
452
-		$join .= implode( " LEFT JOIN ", $join_parts );
452
+		$join .= implode(" LEFT JOIN ", $join_parts);
453 453
 
454 454
 		//now put it all together
455
-		$query = $select . $join . ' GROUP BY Registration_Event';
455
+		$query = $select.$join.' GROUP BY Registration_Event';
456 456
 
457 457
 		//and execute
458 458
 		$results = $wpdb->get_results(
@@ -468,11 +468,11 @@  discard block
 block discarded – undo
468 468
 	 * @param int $TXN_ID
469 469
 	 * @return EE_Registration
470 470
 	 */
471
-	public function get_primary_registration_for_transaction_ID( $TXN_ID = 0){
472
-		if( ! $TXN_ID ){
471
+	public function get_primary_registration_for_transaction_ID($TXN_ID = 0) {
472
+		if ( ! $TXN_ID) {
473 473
 			return false;
474 474
 		}
475
-		return $this->get_one(array(array('TXN_ID'=>$TXN_ID,'REG_count'=>  EEM_Registration::PRIMARY_REGISTRANT_COUNT)));
475
+		return $this->get_one(array(array('TXN_ID'=>$TXN_ID, 'REG_count'=>  EEM_Registration::PRIMARY_REGISTRANT_COUNT)));
476 476
 	}
477 477
 
478 478
 
@@ -484,11 +484,11 @@  discard block
 block discarded – undo
484 484
 	 *		@param boolean $for_incomplete_payments
485 485
 	 *		@return int
486 486
 	 */
487
-	public function get_event_registration_count ( $EVT_ID, $for_incomplete_payments = FALSE ) {
487
+	public function get_event_registration_count($EVT_ID, $for_incomplete_payments = FALSE) {
488 488
 		// we only count approved registrations towards registration limits
489
-		$query_params = array( array( 'EVT_ID' => $EVT_ID, 'STS_ID' => self::status_id_approved ) );
490
-		if( $for_incomplete_payments ){
491
-			$query_params[0]['Transaction.STS_ID']=array('!=',  EEM_Transaction::complete_status_code);
489
+		$query_params = array(array('EVT_ID' => $EVT_ID, 'STS_ID' => self::status_id_approved));
490
+		if ($for_incomplete_payments) {
491
+			$query_params[0]['Transaction.STS_ID'] = array('!=', EEM_Transaction::complete_status_code);
492 492
 		}
493 493
 
494 494
 		return $this->count($query_params);
@@ -504,7 +504,7 @@  discard block
 block discarded – undo
504 504
 		/** @type WPDB $wpdb */
505 505
 		global $wpdb;
506 506
 		return $wpdb->query(
507
-				'DELETE r FROM ' . $this->table() . ' r LEFT JOIN ' . EEM_Transaction::instance()->table() . ' t ON r.TXN_ID = t.TXN_ID WHERE t.TXN_ID IS NULL' );
507
+				'DELETE r FROM '.$this->table().' r LEFT JOIN '.EEM_Transaction::instance()->table().' t ON r.TXN_ID = t.TXN_ID WHERE t.TXN_ID IS NULL' );
508 508
 	}
509 509
 
510 510
 	/**
@@ -514,7 +514,7 @@  discard block
 block discarded – undo
514 514
 	 * @param boolean $checked_in whether to count registrations checked IN or OUT
515 515
 	 * @return int
516 516
 	 */
517
-	public function count_registrations_checked_into_datetime( $DTT_ID, $checked_in = true) {
517
+	public function count_registrations_checked_into_datetime($DTT_ID, $checked_in = true) {
518 518
 		return $this->count(
519 519
 			array(
520 520
 				array(
@@ -532,7 +532,7 @@  discard block
 block discarded – undo
532 532
 	 * @param boolean $checked_in whether to count registrations checked IN or OUT
533 533
 	 * @return int
534 534
 	 */
535
-	public function count_registrations_checked_into_event( $EVT_ID, $checked_in = true ) {
535
+	public function count_registrations_checked_into_event($EVT_ID, $checked_in = true) {
536 536
 		return $this->count(
537 537
 			array(
538 538
 				array(
Please login to merge, or discard this patch.
core/libraries/form_sections/inputs/EE_Form_Input_Base.input.php 2 patches
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,13 +1,13 @@
 block discarded – undo
1 1
 <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); }
2 2
 /**
3
- * EE_Form_Input_Base
4
- * For representing a single form input. Extends EE_Form_Section_Base because
5
- * it is a part of a form and shares a surprisingly large amount of functionality
6
- *
7
- * @package			Event Espresso
8
- * @subpackage
9
- * @author				Mike Nelson
10
- */
3
+	 * EE_Form_Input_Base
4
+	 * For representing a single form input. Extends EE_Form_Section_Base because
5
+	 * it is a part of a form and shares a surprisingly large amount of functionality
6
+	 *
7
+	 * @package			Event Espresso
8
+	 * @subpackage
9
+	 * @author				Mike Nelson
10
+	 */
11 11
 abstract class EE_Form_Input_Base extends EE_Form_Section_Validatable{
12 12
 
13 13
 	/**
Please login to merge, or discard this patch.
Spacing   +133 added lines, -133 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
  * @subpackage
9 9
  * @author				Mike Nelson
10 10
  */
11
-abstract class EE_Form_Input_Base extends EE_Form_Section_Validatable{
11
+abstract class EE_Form_Input_Base extends EE_Form_Section_Validatable {
12 12
 
13 13
 	/**
14 14
 	 * the input's name attribute
@@ -141,66 +141,66 @@  discard block
 block discarded – undo
141 141
 	 *		@type EE_Validation_Strategy_Base[] $validation_strategies
142 142
 	 * }
143 143
 	 */
144
-	public function __construct( $input_args = array() ){
145
-		$input_args = apply_filters( 'FHEE__EE_Form_Input_Base___construct__input_args', $input_args, $this );
144
+	public function __construct($input_args = array()) {
145
+		$input_args = apply_filters('FHEE__EE_Form_Input_Base___construct__input_args', $input_args, $this);
146 146
 		// the following properties must be cast as arrays
147 147
 		$set_as_array = array(
148 148
 			'validation_strategies' => true
149 149
 		);
150 150
 		// loop thru incoming options
151
-		foreach( $input_args as $key => $value ) {
151
+		foreach ($input_args as $key => $value) {
152 152
 			// add underscore to $key to match property names
153
-			$_key = '_' . $key;
154
-			if ( property_exists( $this, $_key )) {
153
+			$_key = '_'.$key;
154
+			if (property_exists($this, $_key)) {
155 155
 				// first check if this property needs to be set as an array
156
-				if ( isset( $set_as_array[ $key ] )) {
156
+				if (isset($set_as_array[$key])) {
157 157
 					// ensure value is an array
158
-					$value = is_array( $value ) ? $value : array( get_class( $value ), $value );
158
+					$value = is_array($value) ? $value : array(get_class($value), $value);
159 159
 					// and merge with existing values
160
-					$this->{$_key} = array_merge( $this->{$_key}, $value );
160
+					$this->{$_key} = array_merge($this->{$_key}, $value);
161 161
 				} else {
162 162
 					$this->{$_key} = $value;
163 163
 				}
164 164
 			}
165 165
 		}
166 166
 		// ensure that "required" is set correctly
167
-		$this->set_required( $this->_required, isset( $input_args[ 'required_validation_error_message' ] ) ? $input_args[ 'required_validation_error_message' ] : NULL );
167
+		$this->set_required($this->_required, isset($input_args['required_validation_error_message']) ? $input_args['required_validation_error_message'] : NULL);
168 168
 
169 169
 		//$this->_html_name_specified = isset( $input_args['html_name'] ) ? TRUE : FALSE;
170 170
 
171 171
 		$this->_display_strategy->_construct_finalize($this);
172
-		if ( $this->_validation_strategies ){
173
-			foreach( $this->_validation_strategies as $validation_strategy ){
172
+		if ($this->_validation_strategies) {
173
+			foreach ($this->_validation_strategies as $validation_strategy) {
174 174
 				$validation_strategy->_construct_finalize($this);
175 175
 			}
176 176
 		}
177 177
 
178
-		if( ! $this->_normalization_strategy){
178
+		if ( ! $this->_normalization_strategy) {
179 179
 			$this->_normalization_strategy = new EE_Text_Normalization();
180 180
 		}
181 181
 		$this->_normalization_strategy->_construct_finalize($this);
182 182
 
183 183
 		//at least we can use the normalization strategy to populate the default
184
-		if( isset( $input_args[ 'default' ] ) ) {
185
-			$this->set_default( $input_args[ 'default' ] );
184
+		if (isset($input_args['default'])) {
185
+			$this->set_default($input_args['default']);
186 186
 		}
187 187
 
188
-		if( ! $this->_sensitive_data_removal_strategy){
188
+		if ( ! $this->_sensitive_data_removal_strategy) {
189 189
 			$this->_sensitive_data_removal_strategy = new EE_No_Sensitive_Data_Removal();
190 190
 		}
191 191
 		$this->_sensitive_data_removal_strategy->_construct_finalize($this);
192
-		parent::__construct( $input_args );
192
+		parent::__construct($input_args);
193 193
 	}
194 194
 
195 195
 	/**
196 196
 	 * Sets the html_name to its default value, if none was specified in teh constructor.
197 197
 	 * Calculation involves using the name and the parent's html_name
198 198
 	 */
199
-	protected function _set_default_html_name_if_empty(){
200
-		if( ! $this->_html_name){
201
-			if( $this->_parent_section && $this->_parent_section instanceof EE_Form_Section_Proper){
202
-				$this->_html_name = $this->_parent_section->html_name_prefix() . "[{$this->name()}]";
203
-			}else{
199
+	protected function _set_default_html_name_if_empty() {
200
+		if ( ! $this->_html_name) {
201
+			if ($this->_parent_section && $this->_parent_section instanceof EE_Form_Section_Proper) {
202
+				$this->_html_name = $this->_parent_section->html_name_prefix()."[{$this->name()}]";
203
+			} else {
204 204
 				$this->_html_name = $this->name();
205 205
 			}
206 206
 		}
@@ -215,12 +215,12 @@  discard block
 block discarded – undo
215 215
 	function _construct_finalize($parent_form_section, $name) {
216 216
 		parent::_construct_finalize($parent_form_section, $name);
217 217
 		$this->_set_default_html_name_if_empty();
218
-		if( ! $this->_html_label ){
219
-			if( ! $this->_html_label_text){
220
-				$this->_html_label_text = ucwords( str_replace("_"," ",$name));
218
+		if ( ! $this->_html_label) {
219
+			if ( ! $this->_html_label_text) {
220
+				$this->_html_label_text = ucwords(str_replace("_", " ", $name));
221 221
 			}
222 222
 		}
223
-		do_action( 'AHEE__EE_Form_Input_Base___construct_finalize__end', $this, $parent_form_section, $name );
223
+		do_action('AHEE__EE_Form_Input_Base___construct_finalize__end', $this, $parent_form_section, $name);
224 224
 	}
225 225
 
226 226
 	 /**
@@ -228,10 +228,10 @@  discard block
 block discarded – undo
228 228
 	  * @return EE_Display_Strategy_Base
229 229
 	  * @throws EE_Error
230 230
 	  */
231
-	protected function _get_display_strategy(){
232
-		if( ! $this->_display_strategy || ! $this->_display_strategy instanceof EE_Display_Strategy_Base){
233
-			throw new EE_Error(sprintf(__("Cannot get display strategy for form input with name %s and id %s, because it has not been set in the constructor", "event_espresso"),$this->html_name(),$this->html_id()));
234
-		}else{
231
+	protected function _get_display_strategy() {
232
+		if ( ! $this->_display_strategy || ! $this->_display_strategy instanceof EE_Display_Strategy_Base) {
233
+			throw new EE_Error(sprintf(__("Cannot get display strategy for form input with name %s and id %s, because it has not been set in the constructor", "event_espresso"), $this->html_name(), $this->html_id()));
234
+		} else {
235 235
 			return $this->_display_strategy;
236 236
 		}
237 237
 	}
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
 	 * Sets the display strategy.
240 240
 	 * @param EE_Display_Strategy_Base $strategy
241 241
 	 */
242
-	protected function _set_display_strategy(EE_Display_Strategy_Base $strategy){
242
+	protected function _set_display_strategy(EE_Display_Strategy_Base $strategy) {
243 243
 		$this->_display_strategy = $strategy;
244 244
 	}
245 245
 
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
 	 * Sets the sanitization strategy
248 248
 	 * @param EE_Normalization_Strategy_Base $strategy
249 249
 	 */
250
-	protected function _set_normalization_strategy(EE_Normalization_Strategy_Base $strategy){
250
+	protected function _set_normalization_strategy(EE_Normalization_Strategy_Base $strategy) {
251 251
 		$this->_normalization_strategy = $strategy;
252 252
 	}
253 253
 
@@ -273,14 +273,14 @@  discard block
 block discarded – undo
273 273
 	 * Gets the display strategy for this input
274 274
 	 * @return EE_Display_Strategy_Base
275 275
 	 */
276
-	public function get_display_strategy(){
276
+	public function get_display_strategy() {
277 277
 		return $this->_display_strategy;
278 278
 	}
279 279
 	/**
280 280
 	 * Overwrites the display strategy
281 281
 	 * @param EE_Display_Strategy_Base $display_strategy
282 282
 	 */
283
-	public function set_display_strategy($display_strategy){
283
+	public function set_display_strategy($display_strategy) {
284 284
 		$this->_display_strategy = $display_strategy;
285 285
 		$this->_display_strategy->_construct_finalize($this);
286 286
 	}
@@ -288,14 +288,14 @@  discard block
 block discarded – undo
288 288
 	 * Gets the normalization strategy set on this input
289 289
 	 * @return EE_Normalization_Strategy_Base
290 290
 	 */
291
-	public function get_normalization_strategy(){
291
+	public function get_normalization_strategy() {
292 292
 		return $this->_normalization_strategy;
293 293
 	}
294 294
 	/**
295 295
 	 * Overwrites the normalization strategy
296 296
 	 * @param EE_Normalization_Strategy_Base $normalization_strategy
297 297
 	 */
298
-	public function set_normalization_strategy($normalization_strategy){
298
+	public function set_normalization_strategy($normalization_strategy) {
299 299
 		$this->_normalization_strategy = $normalization_strategy;
300 300
 		$this->_normalization_strategy->_construct_finalize($this);
301 301
 	}
@@ -304,10 +304,10 @@  discard block
 block discarded – undo
304 304
 	 * Returns all teh validation strategies which apply to this field, numerically indexed
305 305
 	 * @return EE_Validation_Strategy_Base[]
306 306
 	 */
307
-	public function get_validation_strategies(){
308
-		if(is_array($this->_validation_strategies)){
307
+	public function get_validation_strategies() {
308
+		if (is_array($this->_validation_strategies)) {
309 309
 			return $this->_validation_strategies;
310
-		}else{
310
+		} else {
311 311
 			return array();
312 312
 		}
313 313
 
@@ -317,9 +317,9 @@  discard block
 block discarded – undo
317 317
 	 * @param EE_Validation_Strategy_Base $validation_strategy
318 318
 	 * @return void
319 319
 	 */
320
-	protected function _add_validation_strategy( EE_Validation_Strategy_Base $validation_strategy ){
321
-		$validation_strategy->_construct_finalize( $this );
322
-		$this->_validation_strategies[ get_class($validation_strategy) ] = $validation_strategy;
320
+	protected function _add_validation_strategy(EE_Validation_Strategy_Base $validation_strategy) {
321
+		$validation_strategy->_construct_finalize($this);
322
+		$this->_validation_strategies[get_class($validation_strategy)] = $validation_strategy;
323 323
 	}
324 324
 
325 325
 	/**
@@ -327,18 +327,18 @@  discard block
 block discarded – undo
327 327
 	 * @param EE_Validation_Strategy_Base $validation_strategy
328 328
 	 * @return void
329 329
 	 */
330
-	public function add_validation_strategy( EE_Validation_Strategy_Base $validation_strategy ) {
331
-		$this->_add_validation_strategy( $validation_strategy );
330
+	public function add_validation_strategy(EE_Validation_Strategy_Base $validation_strategy) {
331
+		$this->_add_validation_strategy($validation_strategy);
332 332
 	}
333 333
 
334 334
 	/**
335 335
 	 * The classname of the validation strategy to remove
336 336
 	 * @param string $validation_strategy_classname
337 337
 	 */
338
-	public function remove_validation_strategy( $validation_strategy_classname ) {
339
-		foreach( $this->_validation_strategies as $key => $validation_strategy ){
340
-			if( is_subclass_of( $validation_strategy, $validation_strategy_classname ) ){
341
-				unset( $this->_validation_strategies[ $key ] );
338
+	public function remove_validation_strategy($validation_strategy_classname) {
339
+		foreach ($this->_validation_strategies as $key => $validation_strategy) {
340
+			if (is_subclass_of($validation_strategy, $validation_strategy_classname)) {
341
+				unset($this->_validation_strategies[$key]);
342 342
 			}
343 343
 		}
344 344
 	}
@@ -347,7 +347,7 @@  discard block
 block discarded – undo
347 347
 	 * to the parent form's layout strategy
348 348
 	 * @return string
349 349
 	 */
350
-	public function get_html_and_js(){
350
+	public function get_html_and_js() {
351 351
 		return $this->_parent_section->get_html_for_input($this);
352 352
 	}
353 353
 	/**
@@ -356,7 +356,7 @@  discard block
 block discarded – undo
356 356
 	 * Makes sure the JS and CSS are enqueued for it
357 357
 	 * @return string
358 358
 	 */
359
-	public function get_html_for_input(){
359
+	public function get_html_for_input() {
360 360
 		return  $this->_get_display_strategy()->display();
361 361
 	}
362 362
 
@@ -366,7 +366,7 @@  discard block
 block discarded – undo
366 366
 	 * @return string
367 367
 	 */
368 368
 	public function html_other_attributes() {
369
-		return ! empty( $this->_html_other_attributes ) ? ' ' . $this->_html_other_attributes : '';
369
+		return ! empty($this->_html_other_attributes) ? ' '.$this->_html_other_attributes : '';
370 370
 	}
371 371
 
372 372
 
@@ -374,7 +374,7 @@  discard block
 block discarded – undo
374 374
 	/**
375 375
 	 * @param string $html_other_attributes
376 376
 	 */
377
-	public function set_html_other_attributes( $html_other_attributes ) {
377
+	public function set_html_other_attributes($html_other_attributes) {
378 378
 		$this->_html_other_attributes = $html_other_attributes;
379 379
 	}
380 380
 
@@ -383,7 +383,7 @@  discard block
 block discarded – undo
383 383
 	 * according to the form section's layout strategy
384 384
 	 * @return string
385 385
 	 */
386
-	public function get_html_for_label(){
386
+	public function get_html_for_label() {
387 387
 		return $this->_parent_section->get_layout_strategy()->display_label($this);
388 388
 	}
389 389
 	/**
@@ -391,7 +391,7 @@  discard block
 block discarded – undo
391 391
 	 * according to the form section's layout strategy
392 392
 	 * @return string
393 393
 	 */
394
-	public function get_html_for_errors(){
394
+	public function get_html_for_errors() {
395 395
 		return $this->_parent_section->get_layout_strategy()->display_errors($this);
396 396
 	}
397 397
 	/**
@@ -399,7 +399,7 @@  discard block
 block discarded – undo
399 399
 	 * according to the form section's layout strategy
400 400
 	 * @return string
401 401
 	 */
402
-	public function get_html_for_help(){
402
+	public function get_html_for_help() {
403 403
 		return $this->_parent_section->get_layout_strategy()->display_help_text($this);
404 404
 	}
405 405
 	/**
@@ -408,20 +408,20 @@  discard block
 block discarded – undo
408 408
 	 * @return boolean
409 409
 	 */
410 410
 	protected function _validate() {
411
-		if(is_array($this->_validation_strategies)){
412
-			foreach($this->_validation_strategies as $validation_strategy){
413
-				if ( $validation_strategy instanceof EE_Validation_Strategy_Base ) {
414
-					try{
411
+		if (is_array($this->_validation_strategies)) {
412
+			foreach ($this->_validation_strategies as $validation_strategy) {
413
+				if ($validation_strategy instanceof EE_Validation_Strategy_Base) {
414
+					try {
415 415
 						$validation_strategy->validate($this->normalized_value());
416
-					}catch(EE_Validation_Error $e){
416
+					} catch (EE_Validation_Error $e) {
417 417
 						$this->add_validation_error($e);
418 418
 					}
419 419
 				}
420 420
 			}
421 421
 		}
422
-		if( $this->get_validation_errors()){
422
+		if ($this->get_validation_errors()) {
423 423
 			return false;
424
-		}else{
424
+		} else {
425 425
 			return true;
426 426
 		}
427 427
 	}
@@ -434,8 +434,8 @@  discard block
 block discarded – undo
434 434
 	 * @param string $value
435 435
 	 * @return null|string
436 436
 	 */
437
-	private function _sanitize($value){
438
-		return $value !== NULL ?stripslashes(html_entity_decode($value)) : NULL;//don't sanitize_text_field
437
+	private function _sanitize($value) {
438
+		return $value !== NULL ? stripslashes(html_entity_decode($value)) : NULL; //don't sanitize_text_field
439 439
 	}
440 440
 
441 441
 
@@ -447,24 +447,24 @@  discard block
 block discarded – undo
447 447
 	 * @param array $req_data like $_POST
448 448
 	 * @return boolean whether or not there was an error
449 449
 	 */
450
-	protected function _normalize( $req_data ) {
450
+	protected function _normalize($req_data) {
451 451
 		//any existing validation errors don't apply so clear them
452 452
 		$this->_validation_errors = array();
453 453
 		try {
454
-			$raw_input = $this->find_form_data_for_this_section( $req_data );
454
+			$raw_input = $this->find_form_data_for_this_section($req_data);
455 455
 			//super simple sanitization for now
456
-			if ( is_array( $raw_input )) {
456
+			if (is_array($raw_input)) {
457 457
 				$this->_raw_value = array();
458
-				foreach( $raw_input as $key => $value ) {
459
-					$this->_raw_value[ $key ] = $this->_sanitize( $value );
458
+				foreach ($raw_input as $key => $value) {
459
+					$this->_raw_value[$key] = $this->_sanitize($value);
460 460
 				}
461 461
 			} else {
462
-				$this->_raw_value = $this->_sanitize( $raw_input );
462
+				$this->_raw_value = $this->_sanitize($raw_input);
463 463
 			}
464 464
 			//we want ot mostly leave the input alone in case we need to re-display it to the user
465
-			$this->_normalized_value = $this->_normalization_strategy->normalize( $this->raw_value() );
466
-		} catch ( EE_Validation_Error $e ) {
467
-			$this->add_validation_error( $e );
465
+			$this->_normalized_value = $this->_normalization_strategy->normalize($this->raw_value());
466
+		} catch (EE_Validation_Error $e) {
467
+			$this->add_validation_error($e);
468 468
 		}
469 469
 	}
470 470
 
@@ -473,7 +473,7 @@  discard block
 block discarded – undo
473 473
 	/**
474 474
 	 * @return string
475 475
 	 */
476
-	public function html_name(){
476
+	public function html_name() {
477 477
 		return $this->_html_name;
478 478
 	}
479 479
 
@@ -482,8 +482,8 @@  discard block
 block discarded – undo
482 482
 	/**
483 483
 	 * @return string
484 484
 	 */
485
-	function html_label_id(){
486
-		return ! empty( $this->_html_label_id ) ? $this->_html_label_id : $this->_html_id . '-lbl';
485
+	function html_label_id() {
486
+		return ! empty($this->_html_label_id) ? $this->_html_label_id : $this->_html_id.'-lbl';
487 487
 	}
488 488
 
489 489
 
@@ -491,7 +491,7 @@  discard block
 block discarded – undo
491 491
 	/**
492 492
 	 * @return string
493 493
 	 */
494
-	function html_label_class(){
494
+	function html_label_class() {
495 495
 		return $this->_html_label_class;
496 496
 	}
497 497
 
@@ -500,7 +500,7 @@  discard block
 block discarded – undo
500 500
 	/**
501 501
 	 * @return string
502 502
 	 */
503
-	function html_label_style(){
503
+	function html_label_style() {
504 504
 		return $this->_html_label_style;
505 505
 	}
506 506
 
@@ -509,7 +509,7 @@  discard block
 block discarded – undo
509 509
 	/**
510 510
 	 * @return string
511 511
 	 */
512
-	function html_label_text(){
512
+	function html_label_text() {
513 513
 		return $this->_html_label_text;
514 514
 	}
515 515
 
@@ -518,7 +518,7 @@  discard block
 block discarded – undo
518 518
 	/**
519 519
 	 * @return string
520 520
 	 */
521
-	function html_help_text(){
521
+	function html_help_text() {
522 522
 		return $this->_html_help_text;
523 523
 	}
524 524
 
@@ -527,7 +527,7 @@  discard block
 block discarded – undo
527 527
 	/**
528 528
 	 * @return string
529 529
 	 */
530
-	function html_help_class(){
530
+	function html_help_class() {
531 531
 		return $this->_html_help_class;
532 532
 	}
533 533
 
@@ -536,7 +536,7 @@  discard block
 block discarded – undo
536 536
 	/**
537 537
 	 * @return string
538 538
 	 */
539
-	function html_help_style(){
539
+	function html_help_style() {
540 540
 		return $this->_html_style;
541 541
 	}
542 542
 	/**
@@ -549,7 +549,7 @@  discard block
 block discarded – undo
549 549
 	 * in which case, we would have stored the malicious content to our database.
550 550
 	 * @return string
551 551
 	 */
552
-	function raw_value(){
552
+	function raw_value() {
553 553
 		return $this->_raw_value;
554 554
 	}
555 555
 	/**
@@ -557,15 +557,15 @@  discard block
 block discarded – undo
557 557
 	 * it escapes all html entities
558 558
 	 * @return string
559 559
 	 */
560
-	function raw_value_in_form(){
561
-		return htmlentities($this->raw_value(),ENT_QUOTES, 'UTF-8');
560
+	function raw_value_in_form() {
561
+		return htmlentities($this->raw_value(), ENT_QUOTES, 'UTF-8');
562 562
 	}
563 563
 	/**
564 564
 	 * returns the value after it's been sanitized, and then converted into it's proper type
565 565
 	 * in PHP. Eg, a string, an int, an array,
566 566
 	 * @return mixed
567 567
 	 */
568
-	function normalized_value(){
568
+	function normalized_value() {
569 569
 		return $this->_normalized_value;
570 570
 	}
571 571
 
@@ -575,7 +575,7 @@  discard block
 block discarded – undo
575 575
 	 * the best thing to display
576 576
 	 * @return string
577 577
 	 */
578
-	function pretty_value(){
578
+	function pretty_value() {
579 579
 		return $this->_normalized_value;
580 580
 	}
581 581
 	/**
@@ -594,19 +594,19 @@  discard block
 block discarded – undo
594 594
 		  }</code>
595 595
 	 * @return array
596 596
 	 */
597
-	function get_jquery_validation_rules(){
597
+	function get_jquery_validation_rules() {
598 598
 
599 599
 		$jquery_validation_rules = array();
600
-		foreach($this->get_validation_strategies() as $validation_strategy){
600
+		foreach ($this->get_validation_strategies() as $validation_strategy) {
601 601
 			$jquery_validation_rules = array_replace_recursive(
602 602
 				$jquery_validation_rules,
603 603
 				$validation_strategy->get_jquery_validation_rule_array()
604 604
 			);
605 605
 		}
606 606
 
607
-		if(! empty($jquery_validation_rules)){
608
-			$jquery_validation_js[ $this->html_id( TRUE ) ] = $jquery_validation_rules;
609
-		}else{
607
+		if ( ! empty($jquery_validation_rules)) {
608
+			$jquery_validation_js[$this->html_id(TRUE)] = $jquery_validation_rules;
609
+		} else {
610 610
 			return array();
611 611
 		}
612 612
 		return $jquery_validation_js;
@@ -618,9 +618,9 @@  discard block
 block discarded – undo
618 618
 	 * @param mixed $value
619 619
 	 * @return void
620 620
 	 */
621
-	function set_default($value){
621
+	function set_default($value) {
622 622
 		$this->_normalized_value = $value;
623
-		$this->_raw_value = $this->_normalization_strategy->unnormalize( $value );
623
+		$this->_raw_value = $this->_normalization_strategy->unnormalize($value);
624 624
 	}
625 625
 
626 626
 	/**
@@ -628,7 +628,7 @@  discard block
 block discarded – undo
628 628
 	 * @param string $label
629 629
 	 * @return void
630 630
 	 */
631
-	function set_html_label_text($label){
631
+	function set_html_label_text($label) {
632 632
 		$this->_html_label_text = $label;
633 633
 	}
634 634
 
@@ -640,12 +640,12 @@  discard block
 block discarded – undo
640 640
 	 * @param boolean $required
641 641
 	 * @param null    $required_text
642 642
 	 */
643
-	function set_required($required = true, $required_text = NULL ){
644
-		$required = filter_var( $required, FILTER_VALIDATE_BOOLEAN );
645
-		if ( $required ) {
646
-			$this->_add_validation_strategy( new EE_Required_Validation_Strategy( $required_text ) );
643
+	function set_required($required = true, $required_text = NULL) {
644
+		$required = filter_var($required, FILTER_VALIDATE_BOOLEAN);
645
+		if ($required) {
646
+			$this->_add_validation_strategy(new EE_Required_Validation_Strategy($required_text));
647 647
 		} else {
648
-			unset( $this->_validation_strategies[ 'EE_Required_Validation_Strategy' ] );
648
+			unset($this->_validation_strategies['EE_Required_Validation_Strategy']);
649 649
 		}
650 650
 		$this->_required = $required;
651 651
 	}
@@ -653,7 +653,7 @@  discard block
 block discarded – undo
653 653
 	 * Returns whether or not this field is required
654 654
 	 * @return boolean
655 655
 	 */
656
-	public function required(){
656
+	public function required() {
657 657
 		return $this->_required;
658 658
 	}
659 659
 
@@ -662,7 +662,7 @@  discard block
 block discarded – undo
662 662
 	/**
663 663
 	 * @param string $required_css_class
664 664
 	 */
665
-	public function set_required_css_class( $required_css_class ) {
665
+	public function set_required_css_class($required_css_class) {
666 666
 		$this->_required_css_class = $required_css_class;
667 667
 	}
668 668
 
@@ -681,7 +681,7 @@  discard block
 block discarded – undo
681 681
 	 * Sets the help text, in case
682 682
 	 * @param string $text
683 683
 	 */
684
-	public function set_html_help_text($text){
684
+	public function set_html_help_text($text) {
685 685
 		$this->_html_help_text = $text;
686 686
 	}
687 687
 	/**
@@ -693,8 +693,8 @@  discard block
 block discarded – undo
693 693
 	public function clean_sensitive_data() {
694 694
 		//if we do ANY kind of sensitive data removal on this, then just clear out the raw value
695 695
 		//if we need more logic than this we'll make a strategy for it
696
-		if( $this->_sensitive_data_removal_strategy &&
697
-				! $this->_sensitive_data_removal_strategy instanceof EE_No_Sensitive_Data_Removal ){
696
+		if ($this->_sensitive_data_removal_strategy &&
697
+				! $this->_sensitive_data_removal_strategy instanceof EE_No_Sensitive_Data_Removal) {
698 698
 			$this->_raw_value = NULL;
699 699
 		}
700 700
 		//and clean the normalized value according to the appropriate strategy
@@ -708,10 +708,10 @@  discard block
 block discarded – undo
708 708
 	 * @param string $button_size
709 709
 	 * @param string $other_attributes
710 710
 	 */
711
-	public function set_button_css_attributes( $primary = TRUE, $button_size = '', $other_attributes = '' ) {
711
+	public function set_button_css_attributes($primary = TRUE, $button_size = '', $other_attributes = '') {
712 712
 		$button_css_attributes = 'button';
713 713
 		$button_css_attributes .= $primary === TRUE ? ' button-primary' : ' button-secondary';
714
-		switch ( $button_size ) {
714
+		switch ($button_size) {
715 715
 			case 'xs' :
716 716
 			case 'extra-small' :
717 717
 				$button_css_attributes .= ' button-xs';
@@ -732,7 +732,7 @@  discard block
 block discarded – undo
732 732
 			default :
733 733
 				$button_css_attributes .= '';
734 734
 		}
735
-		$this->_button_css_attributes .= ! empty( $other_attributes ) ? $button_css_attributes . ' ' . $other_attributes : $button_css_attributes;
735
+		$this->_button_css_attributes .= ! empty($other_attributes) ? $button_css_attributes.' '.$other_attributes : $button_css_attributes;
736 736
 	}
737 737
 
738 738
 
@@ -741,7 +741,7 @@  discard block
 block discarded – undo
741 741
 	 * @return string
742 742
 	 */
743 743
 	public function button_css_attributes() {
744
-		if ( empty( $this->_button_css_attributes )) {
744
+		if (empty($this->_button_css_attributes)) {
745 745
 			$this->set_button_css_attributes();
746 746
 		}
747 747
 		return $this->_button_css_attributes;
@@ -761,27 +761,27 @@  discard block
 block discarded – undo
761 761
 	 * @param array $req_data
762 762
 	 * @return mixed whatever the raw value of this form section is in the request data
763 763
 	 */
764
-	public function find_form_data_for_this_section( $req_data ){
764
+	public function find_form_data_for_this_section($req_data) {
765 765
 		// break up the html name by "[]"
766
-		if ( strpos( $this->html_name(), '[' ) !== FALSE ) {
767
-			$before_any_brackets = substr( $this->html_name(), 0, strpos($this->html_name(), '[') );
766
+		if (strpos($this->html_name(), '[') !== FALSE) {
767
+			$before_any_brackets = substr($this->html_name(), 0, strpos($this->html_name(), '['));
768 768
 		} else {
769 769
 			$before_any_brackets = $this->html_name();
770 770
 		}
771 771
 		// grab all of the segments
772
-		preg_match_all('~\[([^]]*)\]~',$this->html_name(), $matches);
773
-		if( isset( $matches[ 1 ] ) && is_array( $matches[ 1 ] ) ){
774
-			$name_parts = $matches[ 1 ];
772
+		preg_match_all('~\[([^]]*)\]~', $this->html_name(), $matches);
773
+		if (isset($matches[1]) && is_array($matches[1])) {
774
+			$name_parts = $matches[1];
775 775
 			array_unshift($name_parts, $before_any_brackets);
776
-		}else{
777
-			$name_parts = array( $before_any_brackets );
776
+		} else {
777
+			$name_parts = array($before_any_brackets);
778 778
 		}
779 779
 		// now get the value for the input
780 780
 		$value = $this->_find_form_data_for_this_section_using_name_parts($name_parts, $req_data);
781
-		if( $value === NULL ){
781
+		if ($value === NULL) {
782 782
 			//check if this thing's name is at the TOP level of the request data
783
-			if( isset( $req_data[ $this->name() ] ) ){
784
-				$value = $req_data[ $this->name() ];
783
+			if (isset($req_data[$this->name()])) {
784
+				$value = $req_data[$this->name()];
785 785
 			}
786 786
 		}
787 787
 		return $value;
@@ -795,15 +795,15 @@  discard block
 block discarded – undo
795 795
 	 * @param array $req_data
796 796
 	 * @return array | NULL
797 797
 	 */
798
-	public function _find_form_data_for_this_section_using_name_parts($html_name_parts, $req_data){
799
-		$first_part_to_consider = array_shift( $html_name_parts );
800
-		if( isset( $req_data[ $first_part_to_consider ] ) ){
801
-			if( empty($html_name_parts ) ){
802
-				return $req_data[ $first_part_to_consider ];
803
-			}else{
804
-				return $this->_find_form_data_for_this_section_using_name_parts($html_name_parts, $req_data[ $first_part_to_consider ] );
798
+	public function _find_form_data_for_this_section_using_name_parts($html_name_parts, $req_data) {
799
+		$first_part_to_consider = array_shift($html_name_parts);
800
+		if (isset($req_data[$first_part_to_consider])) {
801
+			if (empty($html_name_parts)) {
802
+				return $req_data[$first_part_to_consider];
803
+			} else {
804
+				return $this->_find_form_data_for_this_section_using_name_parts($html_name_parts, $req_data[$first_part_to_consider]);
805 805
 			}
806
-		}else{
806
+		} else {
807 807
 			return NULL;
808 808
 		}
809 809
 	}
@@ -815,14 +815,14 @@  discard block
 block discarded – undo
815 815
 	 * @param array $req_data like $_POST
816 816
 	 * @return boolean
817 817
 	 */
818
-	public function form_data_present_in($req_data = NULL){
819
-		if( $req_data === NULL ){
818
+	public function form_data_present_in($req_data = NULL) {
819
+		if ($req_data === NULL) {
820 820
 			$req_data = $_POST;
821 821
 		}
822
-		$checked_value = $this->find_form_data_for_this_section( $req_data );
823
-		if( $checked_value !== null ){
822
+		$checked_value = $this->find_form_data_for_this_section($req_data);
823
+		if ($checked_value !== null) {
824 824
 			return TRUE;
825
-		}else{
825
+		} else {
826 826
 			return FALSE;
827 827
 		}
828 828
 	}
Please login to merge, or discard this patch.
core/libraries/form_sections/inputs/EE_Email_Input.input.php 2 patches
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,11 +1,11 @@
 block discarded – undo
1 1
 <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); }
2 2
 /**
3
- * EE_Email_Input
4
- *
5
- * @package			Event Espresso
6
- * @subpackage
7
- * @author				Mike Nelson
8
- */
3
+	 * EE_Email_Input
4
+	 *
5
+	 * @package			Event Espresso
6
+	 * @subpackage
7
+	 * @author				Mike Nelson
8
+	 */
9 9
 class EE_Email_Input extends EE_Form_Input_Base{
10 10
 
11 11
 	/**
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -6,22 +6,22 @@
 block discarded – undo
6 6
  * @subpackage
7 7
  * @author				Mike Nelson
8 8
  */
9
-class EE_Email_Input extends EE_Form_Input_Base{
9
+class EE_Email_Input extends EE_Form_Input_Base {
10 10
 
11 11
 	/**
12 12
 	 * @param array $input_settings
13 13
 	 */
14
-	function __construct( $input_settings = array() ){
15
-		$this->_set_display_strategy( new EE_Text_Input_Display_Strategy('email') );
16
-		$this->_set_normalization_strategy( new EE_Text_Normalization() );
14
+	function __construct($input_settings = array()) {
15
+		$this->_set_display_strategy(new EE_Text_Input_Display_Strategy('email'));
16
+		$this->_set_normalization_strategy(new EE_Text_Normalization());
17 17
 		$this->_add_validation_strategy(
18 18
 			new EE_Email_Validation_Strategy(
19
-				isset( $input_settings[ 'validation_error_message' ] )
20
-					? $input_settings[ 'validation_error_message' ]
19
+				isset($input_settings['validation_error_message'])
20
+					? $input_settings['validation_error_message']
21 21
 					: NULL
22 22
 			)
23 23
 		);
24
-		parent::__construct( $input_settings );
25
-		$this->set_html_class( $this->html_class() . ' email' );
24
+		parent::__construct($input_settings);
25
+		$this->set_html_class($this->html_class().' email');
26 26
 	}
27 27
 }
28 28
\ No newline at end of file
Please login to merge, or discard this patch.
core/EE_Maintenance_Mode.core.php 2 patches
Indentation   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -1,29 +1,29 @@  discard block
 block discarded – undo
1 1
 <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); }
2 2
 /**
3
- *
4
- * Event Espresso
5
- *
6
- * Event Registration and Ticketing Management Plugin for WordPress
7
- *
8
- * @ package			Event Espresso
9
- * @ author			Seth Shoultes
10
- * @ copyright		(c) 2008-2011 Event Espresso  All Rights Reserved.
11
- * @ license			http://eventespresso.com/support/terms-conditions/   * see Plugin Licensing *
12
- * @ link					http://www.eventespresso.com
13
- * @ version		 	$VID:$
14
- *
15
- * ------------------------------------------------------------------------
16
- *
17
- * EE_Maintenance_Mode Class
18
- *
19
- * Super Duper Class Description
20
- *
21
- * @package			Event Espresso
22
- * @subpackage		core
23
- * @author				Michael Nelson
24
- *
25
- * ------------------------------------------------------------------------
26
- */
3
+	 *
4
+	 * Event Espresso
5
+	 *
6
+	 * Event Registration and Ticketing Management Plugin for WordPress
7
+	 *
8
+	 * @ package			Event Espresso
9
+	 * @ author			Seth Shoultes
10
+	 * @ copyright		(c) 2008-2011 Event Espresso  All Rights Reserved.
11
+	 * @ license			http://eventespresso.com/support/terms-conditions/   * see Plugin Licensing *
12
+	 * @ link					http://www.eventespresso.com
13
+	 * @ version		 	$VID:$
14
+	 *
15
+	 * ------------------------------------------------------------------------
16
+	 *
17
+	 * EE_Maintenance_Mode Class
18
+	 *
19
+	 * Super Duper Class Description
20
+	 *
21
+	 * @package			Event Espresso
22
+	 * @subpackage		core
23
+	 * @author				Michael Nelson
24
+	 *
25
+	 * ------------------------------------------------------------------------
26
+	 */
27 27
 class EE_Maintenance_Mode {
28 28
 
29 29
 	/**
@@ -48,10 +48,10 @@  discard block
 block discarded – undo
48 48
 	 */
49 49
 	const option_name_maintenance_mode = 'ee_maintenance_mode';
50 50
    /**
51
-     * 	EE_Maintenance_Mode Object
52
-     * 	@var EE_Maintenance_Mode $_instance
53
-	 * 	@access 	private
54
-     */
51
+    * 	EE_Maintenance_Mode Object
52
+    * 	@var EE_Maintenance_Mode $_instance
53
+    * 	@access 	private
54
+    */
55 55
 	private static $_instance = NULL;
56 56
 
57 57
 	/**
Please login to merge, or discard this patch.
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 	 */
74 74
 	public static function instance() {
75 75
 		// check if class object is instantiated
76
-		if ( self::$_instance === NULL  or ! is_object( self::$_instance ) or ! ( self::$_instance instanceof EE_Maintenance_Mode )) {
76
+		if (self::$_instance === NULL or ! is_object(self::$_instance) or ! (self::$_instance instanceof EE_Maintenance_Mode)) {
77 77
 			self::$_instance = new self();
78 78
 		}
79 79
 		return self::$_instance;
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 	 * Resets maintenance mode (mostly just re-checks whether or not we should be in maintenance mode)
84 84
 	 * @return EE_Maintenance_Mode
85 85
 	 */
86
-	public static function reset(){
86
+	public static function reset() {
87 87
 		self::instance()->set_maintenance_mode_if_db_old();
88 88
 		return self::instance();
89 89
 	}
@@ -98,11 +98,11 @@  discard block
 block discarded – undo
98 98
 	 */
99 99
 	private function __construct() {
100 100
 		// if M-Mode level 2 is engaged, we still need basic assets loaded
101
-		add_action( 'wp_enqueue_scripts', array( $this, 'load_assets_required_for_m_mode' ));
101
+		add_action('wp_enqueue_scripts', array($this, 'load_assets_required_for_m_mode'));
102 102
 		// shut 'er down down for maintenance ?
103
-		add_filter( 'the_content', array( $this, 'the_content' ), 2 );
103
+		add_filter('the_content', array($this, 'the_content'), 2);
104 104
 		// add powered by EE msg
105
-		add_action( 'shutdown', array( $this, 'display_maintenance_mode_notice' ), 10 );
105
+		add_action('shutdown', array($this, 'display_maintenance_mode_notice'), 10);
106 106
 	}
107 107
 
108 108
 
@@ -112,8 +112,8 @@  discard block
 block discarded – undo
112 112
 	 * retrieves the maintenance mode option value from the db
113 113
 	 * @return int
114 114
 	 */
115
-	public function real_level(){
116
-		return get_option( self::option_name_maintenance_mode, EE_Maintenance_Mode::level_0_not_in_maintenance );
115
+	public function real_level() {
116
+		return get_option(self::option_name_maintenance_mode, EE_Maintenance_Mode::level_0_not_in_maintenance);
117 117
 	}
118 118
 
119 119
 	/**
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 	 * thinks their tables are present and up-to-date).
122 122
 	 * @return boolean
123 123
 	 */
124
-	public function models_can_query(){
124
+	public function models_can_query() {
125 125
 		return $this->real_level() != EE_Maintenance_Mode::level_2_complete_maintenance;
126 126
 	}
127 127
 
@@ -134,14 +134,14 @@  discard block
 block discarded – undo
134 134
 	 * EE_Maintenance_Mode::level_2_complete_maintenance => frontend and backend maintenance mode
135 135
 	 * @return int
136 136
 	 */
137
-	public function level(){
137
+	public function level() {
138 138
 		$real_maintenance_mode_level = $this->real_level();
139 139
 		//if this is an admin request, we'll be honest... except if it's ajax, because that might be from the frontend
140
-		if( ( ! is_admin() || (defined('DOING_AJAX') && DOING_AJAX)) && //only on frontend or ajax requests
140
+		if (( ! is_admin() || (defined('DOING_AJAX') && DOING_AJAX)) && //only on frontend or ajax requests
141 141
 			current_user_can('administrator') && //when the user is an admin
142
-			$real_maintenance_mode_level == EE_Maintenance_Mode::level_1_frontend_only_maintenance){//and we're in level 1
142
+			$real_maintenance_mode_level == EE_Maintenance_Mode::level_1_frontend_only_maintenance) {//and we're in level 1
143 143
 			$maintenance_mode_level = EE_Maintenance_Mode::level_0_not_in_maintenance;
144
-		}else{
144
+		} else {
145 145
 			$maintenance_mode_level = $real_maintenance_mode_level;
146 146
 		}
147 147
 		return $maintenance_mode_level;
@@ -151,17 +151,17 @@  discard block
 block discarded – undo
151 151
 	 * Determines if we need to put EE in maintenance mode because the database needs updating
152 152
 	 * @return boolean true if DB is old and maintenance mode was triggered; false otherwise
153 153
 	 */
154
-	public function set_maintenance_mode_if_db_old(){
155
-		EE_Registry::instance()->load_core( 'Data_Migration_Manager' );
156
-		if( EE_Data_Migration_Manager::instance()->check_for_applicable_data_migration_scripts()){
154
+	public function set_maintenance_mode_if_db_old() {
155
+		EE_Registry::instance()->load_core('Data_Migration_Manager');
156
+		if (EE_Data_Migration_Manager::instance()->check_for_applicable_data_migration_scripts()) {
157 157
 			update_option(self::option_name_maintenance_mode, self::level_2_complete_maintenance);
158 158
 			return true;
159
-		}elseif( $this->level() == self::level_2_complete_maintenance ){
159
+		}elseif ($this->level() == self::level_2_complete_maintenance) {
160 160
 			//we also want to handle the opposite: if the site is mm2, but there aren't any migrations to run
161 161
 			//then we shouldn't be in mm2. (Maybe an addon got deactivated?)
162
-			update_option( self::option_name_maintenance_mode, self::level_0_not_in_maintenance );
162
+			update_option(self::option_name_maintenance_mode, self::level_0_not_in_maintenance);
163 163
 			return false;
164
-		}else{
164
+		} else {
165 165
 			return false;
166 166
 		}
167 167
 	}
@@ -171,8 +171,8 @@  discard block
 block discarded – undo
171 171
 	 * @param int $level
172 172
 	 * @return void
173 173
 	 */
174
-	public function set_maintenance_level($level){
175
-		do_action( 'AHEE__EE_Maintenance_Mode__set_maintenance_level', $level );
174
+	public function set_maintenance_level($level) {
175
+		do_action('AHEE__EE_Maintenance_Mode__set_maintenance_level', $level);
176 176
 		update_option(self::option_name_maintenance_mode, intval($level));
177 177
 	}
178 178
 
@@ -199,11 +199,11 @@  discard block
 block discarded – undo
199 199
 	 *  @return 	string
200 200
 	 */
201 201
 	public function load_assets_required_for_m_mode() {
202
-		if ( $this->real_level() == EE_Maintenance_Mode::level_2_complete_maintenance && ! wp_script_is( 'espresso_core', 'enqueued' )) {
203
-			wp_register_style( 'espresso_default', EE_GLOBAL_ASSETS_URL . 'css/espresso_default.css', array( 'dashicons' ), EVENT_ESPRESSO_VERSION );
202
+		if ($this->real_level() == EE_Maintenance_Mode::level_2_complete_maintenance && ! wp_script_is('espresso_core', 'enqueued')) {
203
+			wp_register_style('espresso_default', EE_GLOBAL_ASSETS_URL.'css/espresso_default.css', array('dashicons'), EVENT_ESPRESSO_VERSION);
204 204
 			wp_enqueue_style('espresso_default');
205
-			wp_register_script( 'espresso_core', EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE );
206
-			wp_enqueue_script( 'espresso_core' );
205
+			wp_register_script('espresso_core', EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE);
206
+			wp_enqueue_script('espresso_core');
207 207
 		}
208 208
 	}
209 209
 
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
 	 */
222 222
 	public static function template_include() {
223 223
 		// shut 'er down down for maintenance ? then don't use any of our templates for our endpoints
224
-		return get_template_directory() . '/index.php';
224
+		return get_template_directory().'/index.php';
225 225
 	}
226 226
 
227 227
 
@@ -235,12 +235,12 @@  discard block
 block discarded – undo
235 235
 	 * @param    string $the_content
236 236
 	 * @return    string
237 237
 	 */
238
-	public function the_content( $the_content ) {
238
+	public function the_content($the_content) {
239 239
 		// check if M-mode is engaged and for EE shortcode
240
-		if ( $this->level() && strpos( $the_content, '[ESPRESSO_' ) !== false ) {
240
+		if ($this->level() && strpos($the_content, '[ESPRESSO_') !== false) {
241 241
 			// this can eventually be moved to a template, or edited via admin. But for now...
242 242
 			$the_content = sprintf(
243
-				__( '%sMaintenance Mode%sEvent Registration has been temporarily closed while system maintenance is being performed. We\'re sorry for any inconveniences this may have caused. Please try back again later.%s', 'event_espresso' ),
243
+				__('%sMaintenance Mode%sEvent Registration has been temporarily closed while system maintenance is being performed. We\'re sorry for any inconveniences this may have caused. Please try back again later.%s', 'event_espresso'),
244 244
 				'<h3>',
245 245
 				'</h3><p>',
246 246
 				'</p>'
@@ -264,16 +264,16 @@  discard block
 block discarded – undo
264 264
 		// check if M-mode is engaged and for EE shortcode
265 265
 		if (
266 266
 			$this->real_level() &&
267
-			current_user_can( 'administrator' ) &&
267
+			current_user_can('administrator') &&
268 268
 			! is_admin() &&
269
-			! ( defined( 'DOING_AJAX' ) && DOING_AJAX )
269
+			! (defined('DOING_AJAX') && DOING_AJAX)
270 270
 			&& EE_Registry::instance()->REQ->is_espresso_page()
271 271
 		) {
272 272
 			printf(
273
-				__( '%sclose%sEvent Registration is currently disabled because Event Espresso has been placed into Maintenance Mode. To change Maintenance Mode settings, click here %sEE Maintenance Mode Admin Page%s', 'event_espresso' ),
273
+				__('%sclose%sEvent Registration is currently disabled because Event Espresso has been placed into Maintenance Mode. To change Maintenance Mode settings, click here %sEE Maintenance Mode Admin Page%s', 'event_espresso'),
274 274
 				'<div id="ee-m-mode-admin-notice-dv" class="ee-really-important-notice-dv"><a class="close-espresso-notice" title="',
275 275
 				'">&times;</a><p>',
276
-				' &raquo; <a href="' . add_query_arg( array( 'page' => 'espresso_maintenance_settings' ), admin_url( 'admin.php' )) . '">',
276
+				' &raquo; <a href="'.add_query_arg(array('page' => 'espresso_maintenance_settings'), admin_url('admin.php')).'">',
277 277
 				'</a></p></div>'
278 278
 			);
279 279
 		}
@@ -291,9 +291,9 @@  discard block
 block discarded – undo
291 291
 	 *		@ return void
292 292
 	 */
293 293
 	final function __destruct() {}
294
-	final function __call($a,$b) {}
294
+	final function __call($a, $b) {}
295 295
 	final function __get($a) {}
296
-	final function __set($a,$b) {}
296
+	final function __set($a, $b) {}
297 297
 	final function __isset($a) {}
298 298
 	final function __unset($a) {}
299 299
 	final function __sleep() {
@@ -304,7 +304,7 @@  discard block
 block discarded – undo
304 304
 	final function __invoke() {}
305 305
 	final function __set_state() {}
306 306
 	final function __clone() {}
307
-	final static function __callStatic($a,$b) {}
307
+	final static function __callStatic($a, $b) {}
308 308
 
309 309
 }
310 310
 // End of file EE_Maintenance_Mode.core.php
Please login to merge, or discard this patch.
core/helpers/EEH_Debug_Tools.helper.php 2 patches
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,13 +1,13 @@
 block discarded – undo
1 1
 <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
2 2
 /**
3
- * Class EEH_Debug_Tools
4
- *
5
- * @package 			Event Espresso
6
- * @subpackage 	core
7
- * @author 				Brent Christensen, Michael Nelson
8
- * @since 				4.0
9
- *
10
- */
3
+	 * Class EEH_Debug_Tools
4
+	 *
5
+	 * @package 			Event Espresso
6
+	 * @subpackage 	core
7
+	 * @author 				Brent Christensen, Michael Nelson
8
+	 * @since 				4.0
9
+	 *
10
+	 */
11 11
 class EEH_Debug_Tools{
12 12
 
13 13
 	/**
Please login to merge, or discard this patch.
Spacing   +137 added lines, -137 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
  * @since 				4.0
9 9
  *
10 10
  */
11
-class EEH_Debug_Tools{
11
+class EEH_Debug_Tools {
12 12
 
13 13
 	/**
14 14
 	 * 	instance of the EEH_Autoloader object
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 	 */
42 42
 	public static function instance() {
43 43
 		// check if class object is instantiated, and instantiated properly
44
-		if ( ! self::$_instance instanceof EEH_Debug_Tools ) {
44
+		if ( ! self::$_instance instanceof EEH_Debug_Tools) {
45 45
 			self::$_instance = new self();
46 46
 		}
47 47
 		return self::$_instance;
@@ -57,21 +57,21 @@  discard block
 block discarded – undo
57 57
 	 */
58 58
 	private function __construct() {
59 59
 		// load Kint PHP debugging library
60
-		if ( ! class_exists( 'Kint' ) &&  file_exists( EE_PLUGIN_DIR_PATH . 'tests' . DS . 'kint' . DS . 'Kint.class.php' )){
60
+		if ( ! class_exists('Kint') && file_exists(EE_PLUGIN_DIR_PATH.'tests'.DS.'kint'.DS.'Kint.class.php')) {
61 61
 			// despite EE4 having a check for an existing copy of the Kint debugging class,
62 62
 			// if another plugin was loaded AFTER EE4 and they did NOT perform a similar check,
63 63
 			// then hilarity would ensue as PHP throws a "Cannot redeclare class Kint" error
64 64
 			// so we've moved it to our test folder so that it is not included with production releases
65 65
 			// plz use https://wordpress.org/plugins/kint-debugger/  if testing production versions of EE
66
-			require_once( EE_PLUGIN_DIR_PATH . 'tests' . DS . 'kint' . DS . 'Kint.class.php' );
66
+			require_once(EE_PLUGIN_DIR_PATH.'tests'.DS.'kint'.DS.'Kint.class.php');
67 67
 		}
68
-		if ( ! defined('DOING_AJAX') || ! isset( $_REQUEST['noheader'] ) || $_REQUEST['noheader'] != 'true' || ! isset( $_REQUEST['TB_iframe'] )) {
68
+		if ( ! defined('DOING_AJAX') || ! isset($_REQUEST['noheader']) || $_REQUEST['noheader'] != 'true' || ! isset($_REQUEST['TB_iframe'])) {
69 69
 			//add_action( 'shutdown', array($this,'espresso_session_footer_dump') );
70 70
 		}
71
-		$plugin = basename( EE_PLUGIN_DIR_PATH );
72
-		add_action( "activate_{$plugin}", array( 'EEH_Debug_Tools', 'ee_plugin_activation_errors' ));
73
-		add_action( 'activated_plugin', array( 'EEH_Debug_Tools', 'ee_plugin_activation_errors' ));
74
-		add_action( 'shutdown', array( 'EEH_Debug_Tools', 'show_db_name' ));
71
+		$plugin = basename(EE_PLUGIN_DIR_PATH);
72
+		add_action("activate_{$plugin}", array('EEH_Debug_Tools', 'ee_plugin_activation_errors'));
73
+		add_action('activated_plugin', array('EEH_Debug_Tools', 'ee_plugin_activation_errors'));
74
+		add_action('shutdown', array('EEH_Debug_Tools', 'show_db_name'));
75 75
 	}
76 76
 
77 77
 
@@ -82,8 +82,8 @@  discard block
 block discarded – undo
82 82
 	 * 	@return void
83 83
 	 */
84 84
 	public static function show_db_name() {
85
-		if ( ! defined( 'DOING_AJAX' ) && ( defined( 'EE_ERROR_EMAILS' ) && EE_ERROR_EMAILS )) {
86
-			echo '<p style="font-size:10px;font-weight:normal;color:#E76700;margin: 1em 2em; text-align: right;">DB_NAME: '. DB_NAME .'</p>';
85
+		if ( ! defined('DOING_AJAX') && (defined('EE_ERROR_EMAILS') && EE_ERROR_EMAILS)) {
86
+			echo '<p style="font-size:10px;font-weight:normal;color:#E76700;margin: 1em 2em; text-align: right;">DB_NAME: '.DB_NAME.'</p>';
87 87
 		}
88 88
 	}
89 89
 
@@ -95,9 +95,9 @@  discard block
 block discarded – undo
95 95
 	 * 	@return void
96 96
 	 */
97 97
 	public function espresso_session_footer_dump() {
98
-		if ( class_exists('Kint') && function_exists( 'wp_get_current_user' ) && current_user_can('update_core') && ( defined('WP_DEBUG') && WP_DEBUG ) &&  ! defined('DOING_AJAX') && class_exists( 'EE_Registry' )) {
99
-			Kint::dump(  EE_Registry::instance()->SSN->id() );
100
-			Kint::dump( EE_Registry::instance()->SSN );
98
+		if (class_exists('Kint') && function_exists('wp_get_current_user') && current_user_can('update_core') && (defined('WP_DEBUG') && WP_DEBUG) && ! defined('DOING_AJAX') && class_exists('EE_Registry')) {
99
+			Kint::dump(EE_Registry::instance()->SSN->id());
100
+			Kint::dump(EE_Registry::instance()->SSN);
101 101
 			//			Kint::dump( EE_Registry::instance()->SSN->get_session_data('cart')->get_tickets() );
102 102
 			$this->espresso_list_hooked_functions();
103 103
 			$this->show_times();
@@ -114,27 +114,27 @@  discard block
 block discarded – undo
114 114
 	 * @param bool $tag
115 115
 	 * @return void
116 116
 	 */
117
-	public function espresso_list_hooked_functions( $tag=FALSE ){
117
+	public function espresso_list_hooked_functions($tag = FALSE) {
118 118
 		global $wp_filter;
119 119
 		echo '<br/><br/><br/><h3>Hooked Functions</h3>';
120
-		if ( $tag ) {
121
-			$hook[$tag]=$wp_filter[$tag];
122
-			if ( ! is_array( $hook[$tag] )) {
123
-				trigger_error( "Nothing found for '$tag' hook", E_USER_WARNING );
120
+		if ($tag) {
121
+			$hook[$tag] = $wp_filter[$tag];
122
+			if ( ! is_array($hook[$tag])) {
123
+				trigger_error("Nothing found for '$tag' hook", E_USER_WARNING);
124 124
 				return;
125 125
 			}
126
-			echo '<h5>For Tag: '. $tag .'</h5>';
126
+			echo '<h5>For Tag: '.$tag.'</h5>';
127 127
 		}
128 128
 		else {
129
-			$hook=$wp_filter;
130
-			ksort( $hook );
129
+			$hook = $wp_filter;
130
+			ksort($hook);
131 131
 		}
132
-		foreach( $hook as $tag => $priorities ) {
132
+		foreach ($hook as $tag => $priorities) {
133 133
 			echo "<br />&gt;&gt;&gt;&gt;&gt;\t<strong>$tag</strong><br />";
134
-			ksort( $priorities );
135
-			foreach( $priorities as $priority => $function ){
134
+			ksort($priorities);
135
+			foreach ($priorities as $priority => $function) {
136 136
 				echo $priority;
137
-				foreach( $function as $name => $properties ) {
137
+				foreach ($function as $name => $properties) {
138 138
 					echo "\t$name<br />";
139 139
 				}
140 140
 			}
@@ -150,15 +150,15 @@  discard block
 block discarded – undo
150 150
 	 * @param string $hook_name
151 151
 	 * @return array
152 152
 	 */
153
-	public static function registered_filter_callbacks( $hook_name = '' ) {
153
+	public static function registered_filter_callbacks($hook_name = '') {
154 154
 		$filters = array();
155 155
 		global $wp_filter;
156
-		if ( isset( $wp_filter[ $hook_name ] ) ) {
157
-			$filters[ $hook_name ] = array();
158
-			foreach ( $wp_filter[ $hook_name ] as $priority => $callbacks ) {
159
-				$filters[ $hook_name ][ $priority ] = array();
160
-				foreach ( $callbacks as $callback ) {
161
-					$filters[ $hook_name ][ $priority ][] = $callback['function'];
156
+		if (isset($wp_filter[$hook_name])) {
157
+			$filters[$hook_name] = array();
158
+			foreach ($wp_filter[$hook_name] as $priority => $callbacks) {
159
+				$filters[$hook_name][$priority] = array();
160
+				foreach ($callbacks as $callback) {
161
+					$filters[$hook_name][$priority][] = $callback['function'];
162 162
 				}
163 163
 			}
164 164
 		}
@@ -171,8 +171,8 @@  discard block
 block discarded – undo
171 171
 	 * 	start_timer
172 172
 	 * @param null $timer_name
173 173
 	 */
174
-	public function start_timer( $timer_name = NULL ){
175
-		$this->_start_times[$timer_name] = microtime( TRUE );
174
+	public function start_timer($timer_name = NULL) {
175
+		$this->_start_times[$timer_name] = microtime(TRUE);
176 176
 	}
177 177
 
178 178
 
@@ -181,15 +181,15 @@  discard block
 block discarded – undo
181 181
 	 * stop_timer
182 182
 	 * @param string $timer_name
183 183
 	 */
184
-	public function stop_timer($timer_name = 'default'){
185
-		if( isset( $this->_start_times[ $timer_name ] ) ){
186
-			$start_time = $this->_start_times[ $timer_name ];
187
-			unset( $this->_start_times[ $timer_name ] );
188
-		}else{
189
-			$start_time = array_pop( $this->_start_times );
184
+	public function stop_timer($timer_name = 'default') {
185
+		if (isset($this->_start_times[$timer_name])) {
186
+			$start_time = $this->_start_times[$timer_name];
187
+			unset($this->_start_times[$timer_name]);
188
+		} else {
189
+			$start_time = array_pop($this->_start_times);
190 190
 		}
191
-		$total_time = microtime( TRUE ) - $start_time;
192
-		switch ( $total_time ) {
191
+		$total_time = microtime(TRUE) - $start_time;
192
+		switch ($total_time) {
193 193
 			case $total_time < 0.00001 :
194 194
 				$color = '#8A549A';
195 195
 				$bold = 'normal';
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
 				$bold = 'bold';
216 216
 				break;
217 217
 		}
218
-		$this->_times[] = '<hr /><div style="display: inline-block; min-width: 10px; margin:0 1em; color:'.$color.'; font-weight:'.$bold.'; font-size:1.2em;">' . number_format( $total_time, 8 ) . '</div> ' . $timer_name;
218
+		$this->_times[] = '<hr /><div style="display: inline-block; min-width: 10px; margin:0 1em; color:'.$color.'; font-weight:'.$bold.'; font-size:1.2em;">'.number_format($total_time, 8).'</div> '.$timer_name;
219 219
 	}
220 220
 	/**
221 221
 	 * Measure the memory usage by PHP so far.
@@ -223,10 +223,10 @@  discard block
 block discarded – undo
223 223
 	 * @param boolean $output_now whether to echo now, or wait until EEH_Debug_Tools::show_times() is called
224 224
 	 * @return void
225 225
 	 */
226
-	public function measure_memory( $label, $output_now = false ) {
227
-		$memory_used = $this->convert( memory_get_peak_usage( true ) );
228
-		$this->_memory_usage_points[ $label ] = $memory_used;
229
-		if( $output_now ) {
226
+	public function measure_memory($label, $output_now = false) {
227
+		$memory_used = $this->convert(memory_get_peak_usage(true));
228
+		$this->_memory_usage_points[$label] = $memory_used;
229
+		if ($output_now) {
230 230
 			echo "\r\n<br>$label : $memory_used";
231 231
 		}
232 232
 	}
@@ -236,9 +236,9 @@  discard block
 block discarded – undo
236 236
 	 * @param int $size
237 237
 	 * @return string
238 238
 	 */
239
-	public function convert( $size ) {
240
-		$unit=array('b','kb','mb','gb','tb','pb');
241
-		return @round($size/pow(1024,($i=floor(log($size,1024)))),2).' '.$unit[ absint( $i ) ];
239
+	public function convert($size) {
240
+		$unit = array('b', 'kb', 'mb', 'gb', 'tb', 'pb');
241
+		return @round($size / pow(1024, ($i = floor(log($size, 1024)))), 2).' '.$unit[absint($i)];
242 242
 	}
243 243
 
244 244
 
@@ -248,9 +248,9 @@  discard block
 block discarded – undo
248 248
 	 * @param bool $output_now
249 249
 	 * @return string
250 250
 	 */
251
-	public function show_times($output_now=true){
252
-		$output = '<h2>Times:</h2>' . implode("<br>",$this->_times) . '<h2>Memory</h2>' . implode('<br>', $this->_memory_usage_points );
253
-		if($output_now){
251
+	public function show_times($output_now = true) {
252
+		$output = '<h2>Times:</h2>'.implode("<br>", $this->_times).'<h2>Memory</h2>'.implode('<br>', $this->_memory_usage_points);
253
+		if ($output_now) {
254 254
 			echo $output;
255 255
 			return '';
256 256
 		}
@@ -265,25 +265,25 @@  discard block
 block discarded – undo
265 265
 	 * 	@return void
266 266
 	 */
267 267
 	public static function ee_plugin_activation_errors() {
268
-		if ( WP_DEBUG ) {
268
+		if (WP_DEBUG) {
269 269
 			$activation_errors = ob_get_contents();
270
-			if ( ! empty( $activation_errors ) ) {
271
-				$activation_errors = date( 'Y-m-d H:i:s' ) . "\n" . $activation_errors;
270
+			if ( ! empty($activation_errors)) {
271
+				$activation_errors = date('Y-m-d H:i:s')."\n".$activation_errors;
272 272
 			}
273
-			espresso_load_required( 'EEH_File', EE_HELPERS . 'EEH_File.helper.php' );
274
-			if ( class_exists( 'EEH_File' )) {
273
+			espresso_load_required('EEH_File', EE_HELPERS.'EEH_File.helper.php');
274
+			if (class_exists('EEH_File')) {
275 275
 				try {
276
-					EEH_File::ensure_file_exists_and_is_writable( EVENT_ESPRESSO_UPLOAD_DIR . 'logs' . DS . 'espresso_plugin_activation_errors.html' );
277
-					EEH_File::write_to_file( EVENT_ESPRESSO_UPLOAD_DIR . 'logs' . DS . 'espresso_plugin_activation_errors.html', $activation_errors );
278
-				} catch( EE_Error $e ){
279
-					EE_Error::add_error( sprintf( __(  'The Event Espresso activation errors file could not be setup because: %s', 'event_espresso' ), $e->getMessage() ), __FILE__, __FUNCTION__, __LINE__ );
276
+					EEH_File::ensure_file_exists_and_is_writable(EVENT_ESPRESSO_UPLOAD_DIR.'logs'.DS.'espresso_plugin_activation_errors.html');
277
+					EEH_File::write_to_file(EVENT_ESPRESSO_UPLOAD_DIR.'logs'.DS.'espresso_plugin_activation_errors.html', $activation_errors);
278
+				} catch (EE_Error $e) {
279
+					EE_Error::add_error(sprintf(__('The Event Espresso activation errors file could not be setup because: %s', 'event_espresso'), $e->getMessage()), __FILE__, __FUNCTION__, __LINE__);
280 280
 				}
281 281
 			} else {
282 282
 				// old school attempt
283
-				file_put_contents( EVENT_ESPRESSO_UPLOAD_DIR . 'logs' . DS . 'espresso_plugin_activation_errors.html', $activation_errors );
283
+				file_put_contents(EVENT_ESPRESSO_UPLOAD_DIR.'logs'.DS.'espresso_plugin_activation_errors.html', $activation_errors);
284 284
 			}
285
-			$activation_errors = get_option( 'ee_plugin_activation_errors', '' ) . $activation_errors;
286
-			update_option( 'ee_plugin_activation_errors', $activation_errors );
285
+			$activation_errors = get_option('ee_plugin_activation_errors', '').$activation_errors;
286
+			update_option('ee_plugin_activation_errors', $activation_errors);
287 287
 		}
288 288
 	}
289 289
 
@@ -299,22 +299,22 @@  discard block
 block discarded – undo
299 299
 	 * @param int     $error_type
300 300
 	 * @uses trigger_error()
301 301
 	 */
302
-	public function doing_it_wrong( $function, $message, $version, $error_type = E_USER_NOTICE ) {
303
-		do_action( 'AHEE__EEH_Debug_Tools__doing_it_wrong_run', $function, $message, $version);
304
-		$version = is_null( $version ) ? '' : sprintf( __('(This message was added in version %s of Event Espresso.', 'event_espresso' ), $version );
305
-		$error_message = sprintf( esc_html__('%1$s was called %2$sincorrectly%3$s. %4$s %5$s','event_espresso' ), $function, '<strong>', '</strong>', $message, $version );
302
+	public function doing_it_wrong($function, $message, $version, $error_type = E_USER_NOTICE) {
303
+		do_action('AHEE__EEH_Debug_Tools__doing_it_wrong_run', $function, $message, $version);
304
+		$version = is_null($version) ? '' : sprintf(__('(This message was added in version %s of Event Espresso.', 'event_espresso'), $version);
305
+		$error_message = sprintf(esc_html__('%1$s was called %2$sincorrectly%3$s. %4$s %5$s', 'event_espresso'), $function, '<strong>', '</strong>', $message, $version);
306 306
 
307 307
 		//don't trigger error if doing ajax, instead we'll add a transient EE_Error notice that in theory should show on the next request.
308
-		if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
309
-			$error_message .= esc_html__( 'This is a doing_it_wrong message that was triggered during an ajax request.  The request params on this request were: ', 'event_espresso' );
308
+		if (defined('DOING_AJAX') && DOING_AJAX) {
309
+			$error_message .= esc_html__('This is a doing_it_wrong message that was triggered during an ajax request.  The request params on this request were: ', 'event_espresso');
310 310
 			$error_message .= '<ul><li>';
311
-			$error_message .= implode( '</li><li>', EE_Registry::instance()->REQ->params() );
311
+			$error_message .= implode('</li><li>', EE_Registry::instance()->REQ->params());
312 312
 			$error_message .= '</ul>';
313
-			EE_Error::add_error( $error_message, 'debug::doing_it_wrong', $function, '42' );
313
+			EE_Error::add_error($error_message, 'debug::doing_it_wrong', $function, '42');
314 314
 			//now we set this on the transient so it shows up on the next request.
315
-			EE_Error::get_notices( is_admin(), true );
315
+			EE_Error::get_notices(is_admin(), true);
316 316
 		} else {
317
-			trigger_error( $error_message, $error_type );
317
+			trigger_error($error_message, $error_type);
318 318
 		}
319 319
 	}
320 320
 
@@ -336,22 +336,22 @@  discard block
 block discarded – undo
336 336
 	 * @param string $debug_index
337 337
 	 * @param string $debug_key
338 338
 	 */
339
-	public static function log( $class='', $func = '', $line = '', $info = array(), $display_request = false,  $debug_index = '', $debug_key = 'EE_DEBUG_SPCO' ) {
340
-		if ( WP_DEBUG /*&& false*/ ) {
341
-			$debug_key = $debug_key . '_' . EE_Session::instance()->id();
342
-			$debug_data = get_option( $debug_key, array() );
339
+	public static function log($class = '', $func = '', $line = '', $info = array(), $display_request = false, $debug_index = '', $debug_key = 'EE_DEBUG_SPCO') {
340
+		if (WP_DEBUG /*&& false*/) {
341
+			$debug_key = $debug_key.'_'.EE_Session::instance()->id();
342
+			$debug_data = get_option($debug_key, array());
343 343
 			$default_data = array(
344
-				$class => $func . '() : ' . $line,
344
+				$class => $func.'() : '.$line,
345 345
 				'REQ'  => $display_request ? $_REQUEST : '',
346 346
 			);
347 347
 			// don't serialize objects
348
-			$info = self::strip_objects( $info );
349
-			$index = ! empty( $debug_index ) ? $debug_index : 0;
350
-			if ( ! isset( $debug_data[$index] ) ) {
348
+			$info = self::strip_objects($info);
349
+			$index = ! empty($debug_index) ? $debug_index : 0;
350
+			if ( ! isset($debug_data[$index])) {
351 351
 				$debug_data[$index] = array();
352 352
 			}
353
-			$debug_data[$index][microtime()] = array_merge( $default_data, $info );
354
-			update_option( $debug_key, $debug_data );
353
+			$debug_data[$index][microtime()] = array_merge($default_data, $info);
354
+			update_option($debug_key, $debug_data);
355 355
 		}
356 356
 	}
357 357
 
@@ -363,26 +363,26 @@  discard block
 block discarded – undo
363 363
 	 * @param array $info
364 364
 	 * @return array
365 365
 	 */
366
-	public static function strip_objects( $info = array() ) {
367
-		foreach ( $info as $key => $value ) {
368
-			if ( is_array( $value ) ) {
369
-				$info[ $key ] = self::strip_objects( $value );
370
-			} else if ( is_object( $value ) ) {
371
-				$object_class = get_class( $value );
372
-				$info[ $object_class ] = array();
373
-				$info[ $object_class ][ 'ID' ] = method_exists( $value, 'ID' ) ? $value->ID() : spl_object_hash( $value );
374
-				if ( method_exists( $value, 'ID' ) ) {
375
-					$info[ $object_class ][ 'ID' ] = $value->ID();
366
+	public static function strip_objects($info = array()) {
367
+		foreach ($info as $key => $value) {
368
+			if (is_array($value)) {
369
+				$info[$key] = self::strip_objects($value);
370
+			} else if (is_object($value)) {
371
+				$object_class = get_class($value);
372
+				$info[$object_class] = array();
373
+				$info[$object_class]['ID'] = method_exists($value, 'ID') ? $value->ID() : spl_object_hash($value);
374
+				if (method_exists($value, 'ID')) {
375
+					$info[$object_class]['ID'] = $value->ID();
376 376
 				}
377
-				if ( method_exists( $value, 'status' ) ) {
378
-					$info[ $object_class ][ 'status' ] = $value->status();
379
-				} else if ( method_exists( $value, 'status_ID' ) ) {
380
-					$info[ $object_class ][ 'status' ] = $value->status_ID();
377
+				if (method_exists($value, 'status')) {
378
+					$info[$object_class]['status'] = $value->status();
379
+				} else if (method_exists($value, 'status_ID')) {
380
+					$info[$object_class]['status'] = $value->status_ID();
381 381
 				}
382
-				unset( $info[ $key ] );
382
+				unset($info[$key]);
383 383
 			}
384 384
 		}
385
-		return (array)$info;
385
+		return (array) $info;
386 386
 	}
387 387
 
388 388
 
@@ -399,24 +399,24 @@  discard block
 block discarded – undo
399 399
 	 * @param int $header
400 400
 	 * @param bool $die
401 401
 	 */
402
-	public static function printv( $var, $var_name = false, $file = __FILE__, $line = __LINE__, $header = 5, $die = false ) {
402
+	public static function printv($var, $var_name = false, $file = __FILE__, $line = __LINE__, $header = 5, $die = false) {
403 403
 		$var_name = ! $var_name ? 'string' : $var_name;
404 404
 		$heading_tag = 'h';
405
-		$heading_tag .= is_int( $header ) ? $header : 5;
406
-		$var_name = ucwords( str_replace( '$', '', $var_name ) );
407
-		$is_method = method_exists( $var_name, $var );
408
-		$var_name = ucwords( str_replace( '_', ' ', $var_name ) );
405
+		$heading_tag .= is_int($header) ? $header : 5;
406
+		$var_name = ucwords(str_replace('$', '', $var_name));
407
+		$is_method = method_exists($var_name, $var);
408
+		$var_name = ucwords(str_replace('_', ' ', $var_name));
409 409
 		ob_start();
410
-		echo '<' . $heading_tag . ' style="color:#2EA2CC; margin:25px 0 0;"><b>' . $var_name . '</b>';
410
+		echo '<'.$heading_tag.' style="color:#2EA2CC; margin:25px 0 0;"><b>'.$var_name.'</b>';
411 411
 		echo $is_method
412
-			? '<span style="color:#999">::</span><span style="color:#E76700">' . $var . '()</span><br />'
413
-			: '<span style="color:#999"> : </span><span style="color:#E76700">' . $var . '</span><br />';
414
-		echo '<span style="font-size:9px;font-weight:normal;color:#666;line-height: 12px;">' . $file;
415
-		echo '<br />line no: ' . $line . '</span>';
416
-		echo '</' . $heading_tag . '>';
412
+			? '<span style="color:#999">::</span><span style="color:#E76700">'.$var.'()</span><br />'
413
+			: '<span style="color:#999"> : </span><span style="color:#E76700">'.$var.'</span><br />';
414
+		echo '<span style="font-size:9px;font-weight:normal;color:#666;line-height: 12px;">'.$file;
415
+		echo '<br />line no: '.$line.'</span>';
416
+		echo '</'.$heading_tag.'>';
417 417
 		$result = ob_get_clean();
418
-		if ( $die ) {
419
-			die( $result );
418
+		if ($die) {
419
+			die($result);
420 420
 		} else {
421 421
 			echo $result;
422 422
 		}
@@ -435,36 +435,36 @@  discard block
 block discarded – undo
435 435
 	 * @param int $header
436 436
 	 * @param bool $die
437 437
 	 */
438
-	public static function printr( $var, $var_name = false, $file = __FILE__, $line = __LINE__, $header = 5, $die = false ) {
439
-		$file = str_replace( rtrim( ABSPATH, '\\/' ), '', $file );
438
+	public static function printr($var, $var_name = false, $file = __FILE__, $line = __LINE__, $header = 5, $die = false) {
439
+		$file = str_replace(rtrim(ABSPATH, '\\/'), '', $file);
440 440
 		//$print_r = false;
441
-		if ( is_string( $var ) ) {
442
-			EEH_Debug_Tools::printv( $var, $var_name, $file, $line, $header, $die );
441
+		if (is_string($var)) {
442
+			EEH_Debug_Tools::printv($var, $var_name, $file, $line, $header, $die);
443 443
 			return;
444
-		} else if ( is_object( $var ) ) {
444
+		} else if (is_object($var)) {
445 445
 			$var_name = ! $var_name ? 'object' : $var_name;
446 446
 			//$print_r = true;
447
-		} else if ( is_array( $var ) ) {
447
+		} else if (is_array($var)) {
448 448
 			$var_name = ! $var_name ? 'array' : $var_name;
449 449
 			//$print_r = true;
450
-		} else if ( is_numeric( $var ) ) {
450
+		} else if (is_numeric($var)) {
451 451
 			$var_name = ! $var_name ? 'numeric' : $var_name;
452
-		} else if ( is_null( $var ) ) {
452
+		} else if (is_null($var)) {
453 453
 			$var_name = ! $var_name ? 'null' : $var_name;
454 454
 		}
455 455
 		$heading_tag = 'h';
456
-		$heading_tag .= is_int( $header ) ? $header : 5;
457
-		$var_name = ucwords( str_replace( array( '$', '_' ), array( '', ' ' ), $var_name ) );
456
+		$heading_tag .= is_int($header) ? $header : 5;
457
+		$var_name = ucwords(str_replace(array('$', '_'), array('', ' '), $var_name));
458 458
 		ob_start();
459
-		echo '<' . $heading_tag . ' style="color:#2EA2CC; margin:25px 0 0;"><b>' . $var_name . '</b>';
459
+		echo '<'.$heading_tag.' style="color:#2EA2CC; margin:25px 0 0;"><b>'.$var_name.'</b>';
460 460
 		echo '<span style="color:#999;"> : </span><span style="color:#E76700;">';
461 461
 		echo '<pre style="color:#999; padding:1em; background: #fff">';
462
-		var_dump( $var );
463
-		echo '</pre></span><br /><span style="font-size:9px;font-weight:normal;color:#666;line-height: 12px;">' . $file;
464
-		echo '<br />line no: ' . $line . '</span></' . $heading_tag . '>';
462
+		var_dump($var);
463
+		echo '</pre></span><br /><span style="font-size:9px;font-weight:normal;color:#666;line-height: 12px;">'.$file;
464
+		echo '<br />line no: '.$line.'</span></'.$heading_tag.'>';
465 465
 		$result = ob_get_clean();
466
-		if ( $die ) {
467
-			die( $result );
466
+		if ($die) {
467
+			die($result);
468 468
 		} else {
469 469
 			echo $result;
470 470
 		}
@@ -481,8 +481,8 @@  discard block
 block discarded – undo
481 481
  * borrowed from Kint Debugger
482 482
  * Plugin URI: http://upthemes.com/plugins/kint-debugger/
483 483
  */
484
-if ( class_exists('Kint') && ! function_exists( 'dump_wp_query' ) ) {
485
-	function dump_wp_query(){
484
+if (class_exists('Kint') && ! function_exists('dump_wp_query')) {
485
+	function dump_wp_query() {
486 486
 		global $wp_query;
487 487
 		d($wp_query);
488 488
 	}
@@ -492,8 +492,8 @@  discard block
 block discarded – undo
492 492
  * borrowed from Kint Debugger
493 493
  * Plugin URI: http://upthemes.com/plugins/kint-debugger/
494 494
  */
495
-if ( class_exists('Kint') && ! function_exists( 'dump_wp' ) ) {
496
-	function dump_wp(){
495
+if (class_exists('Kint') && ! function_exists('dump_wp')) {
496
+	function dump_wp() {
497 497
 		global $wp;
498 498
 		d($wp);
499 499
 	}
@@ -503,8 +503,8 @@  discard block
 block discarded – undo
503 503
  * borrowed from Kint Debugger
504 504
  * Plugin URI: http://upthemes.com/plugins/kint-debugger/
505 505
  */
506
-if ( class_exists('Kint') && ! function_exists( 'dump_post' ) ) {
507
-	function dump_post(){
506
+if (class_exists('Kint') && ! function_exists('dump_post')) {
507
+	function dump_post() {
508 508
 		global $post;
509 509
 		d($post);
510 510
 	}
Please login to merge, or discard this patch.
core/admin/EE_Admin.core.php 2 patches
Indentation   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -1,33 +1,33 @@  discard block
 block discarded – undo
1 1
 <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
2 2
 /**
3
- * Event Espresso
4
- *
5
- * Event Registration and Management Plugin for WordPress
6
- *
7
- * @ package			Event Espresso
8
- * @ author			Seth Shoultes
9
- * @ copyright		(c) 2008-2011 Event Espresso  All Rights Reserved.
10
- * @ license			http://eventespresso.com/support/terms-conditions/   * see Plugin Licensing *
11
- * @ link					http://www.eventespresso.com
12
- * @ version		 	4.0
13
- *
14
- * ------------------------------------------------------------------------
15
- *
16
- * EE_Admin
17
- *
18
- * @package			Event Espresso
19
- * @subpackage	/core/admin/
20
- * @author				Brent Christensen
21
- *
22
- * ------------------------------------------------------------------------
23
- */
3
+	 * Event Espresso
4
+	 *
5
+	 * Event Registration and Management Plugin for WordPress
6
+	 *
7
+	 * @ package			Event Espresso
8
+	 * @ author			Seth Shoultes
9
+	 * @ copyright		(c) 2008-2011 Event Espresso  All Rights Reserved.
10
+	 * @ license			http://eventespresso.com/support/terms-conditions/   * see Plugin Licensing *
11
+	 * @ link					http://www.eventespresso.com
12
+	 * @ version		 	4.0
13
+	 *
14
+	 * ------------------------------------------------------------------------
15
+	 *
16
+	 * EE_Admin
17
+	 *
18
+	 * @package			Event Espresso
19
+	 * @subpackage	/core/admin/
20
+	 * @author				Brent Christensen
21
+	 *
22
+	 * ------------------------------------------------------------------------
23
+	 */
24 24
 final class EE_Admin {
25 25
 
26 26
    /**
27
-     * 	EE_Admin Object
28
-     * 	@private _instance
29
-	 * 	@private 	protected
30
-     */
27
+    * 	EE_Admin Object
28
+    * 	@private _instance
29
+    * 	@private 	protected
30
+    */
31 31
 	private static $_instance = NULL;
32 32
 
33 33
 	/**
@@ -56,8 +56,8 @@  discard block
 block discarded – undo
56 56
 
57 57
 
58 58
    /**
59
-     * class constructor
60
-     */
59
+    * class constructor
60
+    */
61 61
 	protected function __construct() {
62 62
 		// define global EE_Admin constants
63 63
 		$this->_define_all_constants();
@@ -168,11 +168,11 @@  discard block
 block discarded – undo
168 168
 
169 169
 
170 170
 	/**
171
-	* init- should fire after shortcode, module,  addon, other plugin (default priority), and even EE_Front_Controller's init phases have run
172
-	*
173
-	* @access public
174
-	* @return void
175
-	*/
171
+	 * init- should fire after shortcode, module,  addon, other plugin (default priority), and even EE_Front_Controller's init phases have run
172
+	 *
173
+	 * @access public
174
+	 * @return void
175
+	 */
176 176
 	public function init() {
177 177
 
178 178
 		//only enable most of the EE_Admin IF we're not in full maintenance mode
@@ -463,11 +463,11 @@  discard block
 block discarded – undo
463 463
 
464 464
 
465 465
 	/**
466
-	* admin_init
467
-	*
468
-	* @access public
469
-	* @return void
470
-	*/
466
+	 * admin_init
467
+	 *
468
+	 * @access public
469
+	 * @return void
470
+	 */
471 471
 	public function admin_init() {
472 472
 
473 473
 		/**
@@ -624,11 +624,11 @@  discard block
 block discarded – undo
624 624
 
625 625
 
626 626
 	/**
627
-	* 	dismiss_persistent_admin_notice
628
-	*
629
-	*	@access 	public
630
-	* 	@return 		void
631
-	*/
627
+	 * 	dismiss_persistent_admin_notice
628
+	 *
629
+	 *	@access 	public
630
+	 * 	@return 		void
631
+	 */
632 632
 	public function dismiss_ee_nag_notice_callback() {
633 633
 		EE_Error::dismiss_persistent_admin_notice();
634 634
 	}
Please login to merge, or discard this patch.
Spacing   +174 added lines, -174 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 	 */
48 48
 	public static function instance() {
49 49
 		// check if class object is instantiated
50
-		if (  ! self::$_instance instanceof EE_Admin ) {
50
+		if ( ! self::$_instance instanceof EE_Admin) {
51 51
 			self::$_instance = new self();
52 52
 		}
53 53
 		return self::$_instance;
@@ -62,25 +62,25 @@  discard block
 block discarded – undo
62 62
 		// define global EE_Admin constants
63 63
 		$this->_define_all_constants();
64 64
 		// set autoloaders for our admin page classes based on included path information
65
-		EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder( EE_ADMIN );
65
+		EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder(EE_ADMIN);
66 66
 		// admin hooks
67
-		add_filter( 'plugin_action_links', array( $this, 'filter_plugin_actions' ), 10, 2 );
67
+		add_filter('plugin_action_links', array($this, 'filter_plugin_actions'), 10, 2);
68 68
 		// load EE_Request_Handler early
69
-		add_action( 'AHEE__EE_System__core_loaded_and_ready', array( $this, 'get_request' ));
70
-		add_action( 'AHEE__EE_System__initialize_last', array( $this, 'init' ));
71
-		add_action( 'AHEE__EE_Admin_Page__route_admin_request', array( $this, 'route_admin_request' ), 100, 2 );
72
-		add_action( 'wp_loaded', array( $this, 'wp_loaded' ), 100 );
73
-		add_action( 'admin_init', array( $this, 'admin_init' ), 100 );
74
-		add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_scripts' ), 20 );
75
-		add_action( 'admin_notices', array( $this, 'display_admin_notices' ), 10 );
76
-		add_action( 'network_admin_notices', array( $this, 'display_admin_notices' ), 10 );
77
-		add_filter( 'pre_update_option', array( $this, 'check_for_invalid_datetime_formats' ), 100, 2 );
78
-		add_filter('admin_footer_text', array( $this, 'espresso_admin_footer' ));
69
+		add_action('AHEE__EE_System__core_loaded_and_ready', array($this, 'get_request'));
70
+		add_action('AHEE__EE_System__initialize_last', array($this, 'init'));
71
+		add_action('AHEE__EE_Admin_Page__route_admin_request', array($this, 'route_admin_request'), 100, 2);
72
+		add_action('wp_loaded', array($this, 'wp_loaded'), 100);
73
+		add_action('admin_init', array($this, 'admin_init'), 100);
74
+		add_action('admin_enqueue_scripts', array($this, 'enqueue_admin_scripts'), 20);
75
+		add_action('admin_notices', array($this, 'display_admin_notices'), 10);
76
+		add_action('network_admin_notices', array($this, 'display_admin_notices'), 10);
77
+		add_filter('pre_update_option', array($this, 'check_for_invalid_datetime_formats'), 100, 2);
78
+		add_filter('admin_footer_text', array($this, 'espresso_admin_footer'));
79 79
 
80 80
 		//reset Environment config (we only do this on admin page loads);
81 81
 		EE_Registry::instance()->CFG->environment->recheck_values();
82 82
 
83
-		do_action( 'AHEE__EE_Admin__loaded' );
83
+		do_action('AHEE__EE_Admin__loaded');
84 84
 	}
85 85
 
86 86
 
@@ -95,11 +95,11 @@  discard block
 block discarded – undo
95 95
 	 * @return void
96 96
 	 */
97 97
 	private function _define_all_constants() {
98
-		define( 'EE_ADMIN_URL', EE_PLUGIN_DIR_URL . 'core/admin/' );
99
-		define( 'EE_ADMIN_PAGES_URL', EE_PLUGIN_DIR_URL . 'admin_pages/' );
100
-		define( 'EE_ADMIN_TEMPLATE', EE_ADMIN . 'templates' . DS );
101
-		define( 'WP_ADMIN_PATH', ABSPATH . 'wp-admin/' );
102
-		define( 'WP_AJAX_URL', admin_url( 'admin-ajax.php' ));
98
+		define('EE_ADMIN_URL', EE_PLUGIN_DIR_URL.'core/admin/');
99
+		define('EE_ADMIN_PAGES_URL', EE_PLUGIN_DIR_URL.'admin_pages/');
100
+		define('EE_ADMIN_TEMPLATE', EE_ADMIN.'templates'.DS);
101
+		define('WP_ADMIN_PATH', ABSPATH.'wp-admin/');
102
+		define('WP_AJAX_URL', admin_url('admin-ajax.php'));
103 103
 	}
104 104
 
105 105
 
@@ -112,23 +112,23 @@  discard block
 block discarded – undo
112 112
 	 * @param 	string 	$plugin
113 113
 	 * @return 	array
114 114
 	 */
115
-	public function filter_plugin_actions( $links, $plugin ) {
115
+	public function filter_plugin_actions($links, $plugin) {
116 116
 		// set $main_file in stone
117 117
 		static $main_file;
118 118
 		// if $main_file is not set yet
119
-		if ( ! $main_file ) {
120
-			$main_file = plugin_basename( EVENT_ESPRESSO_MAIN_FILE );
119
+		if ( ! $main_file) {
120
+			$main_file = plugin_basename(EVENT_ESPRESSO_MAIN_FILE);
121 121
 		}
122
-		 if ( $plugin == $main_file ) {
122
+		 if ($plugin == $main_file) {
123 123
 		 	// compare current plugin to this one
124
-			if ( EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance ) {
125
-				$maintenance_link = '<a href="admin.php?page=espresso_maintenance_settings" title="Event Espresso is in maintenance mode.  Click this link to learn why.">' . __('Maintenance Mode Active', 'event_espresso' ) . '</a>';
126
-				array_unshift( $links, $maintenance_link );
124
+			if (EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance) {
125
+				$maintenance_link = '<a href="admin.php?page=espresso_maintenance_settings" title="Event Espresso is in maintenance mode.  Click this link to learn why.">'.__('Maintenance Mode Active', 'event_espresso').'</a>';
126
+				array_unshift($links, $maintenance_link);
127 127
 			} else {
128
-				$org_settings_link = '<a href="admin.php?page=espresso_general_settings">' . __( 'Settings', 'event_espresso' ) . '</a>';
129
-				$events_link = '<a href="admin.php?page=espresso_events">' . __( 'Events', 'event_espresso' ) . '</a>';
128
+				$org_settings_link = '<a href="admin.php?page=espresso_general_settings">'.__('Settings', 'event_espresso').'</a>';
129
+				$events_link = '<a href="admin.php?page=espresso_events">'.__('Events', 'event_espresso').'</a>';
130 130
 				// add before other links
131
-				array_unshift( $links, $org_settings_link, $events_link );
131
+				array_unshift($links, $org_settings_link, $events_link);
132 132
 			}
133 133
 		}
134 134
 		return $links;
@@ -143,8 +143,8 @@  discard block
 block discarded – undo
143 143
 	 *	@return void
144 144
 	 */
145 145
 	public function get_request() {
146
-		EE_Registry::instance()->load_core( 'Request_Handler' );
147
-		EE_Registry::instance()->load_core( 'CPT_Strategy' );
146
+		EE_Registry::instance()->load_core('Request_Handler');
147
+		EE_Registry::instance()->load_core('CPT_Strategy');
148 148
 	}
149 149
 
150 150
 
@@ -156,11 +156,11 @@  discard block
 block discarded – undo
156 156
 	 * @param array $admin_page_folder_names
157 157
 	 * @return array
158 158
 	 */
159
-	public function hide_admin_pages_except_maintenance_mode( $admin_page_folder_names = array() ){
159
+	public function hide_admin_pages_except_maintenance_mode($admin_page_folder_names = array()) {
160 160
 		return array(
161
-			'maintenance' => EE_ADMIN_PAGES . 'maintenance' . DS,
162
-			'about' => EE_ADMIN_PAGES . 'about' . DS,
163
-			'support' => EE_ADMIN_PAGES . 'support' . DS
161
+			'maintenance' => EE_ADMIN_PAGES.'maintenance'.DS,
162
+			'about' => EE_ADMIN_PAGES.'about'.DS,
163
+			'support' => EE_ADMIN_PAGES.'support'.DS
164 164
 		);
165 165
 	}
166 166
 
@@ -175,36 +175,36 @@  discard block
 block discarded – undo
175 175
 	public function init() {
176 176
 
177 177
 		//only enable most of the EE_Admin IF we're not in full maintenance mode
178
-		if ( EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance ){
178
+		if (EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance) {
179 179
 			//ok so we want to enable the entire admin
180
-			add_action( 'wp_ajax_dismiss_ee_nag_notice', array( $this, 'dismiss_ee_nag_notice_callback' ));
181
-			add_action( 'save_post', array( 'EE_Admin', 'parse_post_content_on_save' ), 100, 2 );
182
-			add_action( 'update_option', array( $this, 'reset_page_for_posts_on_change' ), 100, 3 );
183
-			add_filter( 'content_save_pre', array( $this, 'its_eSpresso' ), 10, 1 );
184
-			add_action( 'admin_notices', array( $this, 'get_persistent_admin_notices' ), 9 );
185
-			add_action( 'network_admin_notices', array( $this, 'get_persistent_admin_notices' ), 9 );
180
+			add_action('wp_ajax_dismiss_ee_nag_notice', array($this, 'dismiss_ee_nag_notice_callback'));
181
+			add_action('save_post', array('EE_Admin', 'parse_post_content_on_save'), 100, 2);
182
+			add_action('update_option', array($this, 'reset_page_for_posts_on_change'), 100, 3);
183
+			add_filter('content_save_pre', array($this, 'its_eSpresso'), 10, 1);
184
+			add_action('admin_notices', array($this, 'get_persistent_admin_notices'), 9);
185
+			add_action('network_admin_notices', array($this, 'get_persistent_admin_notices'), 9);
186 186
 			//at a glance dashboard widget
187
-			add_filter( 'dashboard_glance_items', array( $this, 'dashboard_glance_items'), 10 );
187
+			add_filter('dashboard_glance_items', array($this, 'dashboard_glance_items'), 10);
188 188
 			//filter for get_edit_post_link used on comments for custom post types
189
-			add_filter('get_edit_post_link', array( $this, 'modify_edit_post_link' ), 10, 3 );
189
+			add_filter('get_edit_post_link', array($this, 'modify_edit_post_link'), 10, 3);
190 190
 		}
191 191
 
192 192
 		// run the admin page factory but ONLY if we are doing an ee admin ajax request
193
-		if ( !defined('DOING_AJAX') || EE_ADMIN_AJAX ) {
193
+		if ( ! defined('DOING_AJAX') || EE_ADMIN_AJAX) {
194 194
 			try {
195 195
 				//this loads the controller for the admin pages which will setup routing etc
196
-				EE_Registry::instance()->load_core( 'Admin_Page_Loader' );
197
-			} catch ( EE_Error $e ) {
196
+				EE_Registry::instance()->load_core('Admin_Page_Loader');
197
+			} catch (EE_Error $e) {
198 198
 				$e->get_error();
199 199
 			}
200 200
 		}
201 201
 
202 202
 		//make sure our CPTs and custom taxonomy metaboxes get shown for first time users
203
-		add_action('admin_head', array($this, 'enable_hidden_ee_nav_menu_metaboxes' ), 10 );
204
-		add_action('admin_head', array( $this, 'register_custom_nav_menu_boxes' ), 10 );
203
+		add_action('admin_head', array($this, 'enable_hidden_ee_nav_menu_metaboxes'), 10);
204
+		add_action('admin_head', array($this, 'register_custom_nav_menu_boxes'), 10);
205 205
 
206 206
 		//exclude EE critical pages from all nav menus and wp_list_pages
207
-		add_filter('nav_menu_meta_box_object', array( $this, 'remove_pages_from_nav_menu'), 10 );
207
+		add_filter('nav_menu_meta_box_object', array($this, 'remove_pages_from_nav_menu'), 10);
208 208
 	}
209 209
 
210 210
 
@@ -217,9 +217,9 @@  discard block
 block discarded – undo
217 217
 	 * @param  object $post_type WP post type object
218 218
 	 * @return object            WP post type object
219 219
 	 */
220
-	public function remove_pages_from_nav_menu( $post_type ) {
220
+	public function remove_pages_from_nav_menu($post_type) {
221 221
 		//if this isn't the "pages" post type let's get out
222
-		if ( $post_type->name !== 'page' )
222
+		if ($post_type->name !== 'page')
223 223
 			return $post_type;
224 224
 
225 225
 		$critical_pages = EE_Registry::instance()->CFG->core->get_critical_pages_array();
@@ -239,28 +239,28 @@  discard block
 block discarded – undo
239 239
 	 */
240 240
 	public function enable_hidden_ee_nav_menu_metaboxes() {
241 241
 		global $wp_meta_boxes, $pagenow;
242
-		if ( ! is_array($wp_meta_boxes) || $pagenow !== 'nav-menus.php' ) {
242
+		if ( ! is_array($wp_meta_boxes) || $pagenow !== 'nav-menus.php') {
243 243
 			return;
244 244
 		}
245 245
 		$user = wp_get_current_user();
246 246
 		//has this been done yet?
247
-		if ( get_user_option( 'ee_nav_menu_initialized', $user->ID ) ) {
247
+		if (get_user_option('ee_nav_menu_initialized', $user->ID)) {
248 248
 			return;
249 249
 		}
250 250
 
251
-		$hidden_meta_boxes = get_user_option( 'metaboxhidden_nav-menus', $user->ID );
252
-		$initial_meta_boxes = apply_filters( 'FHEE__EE_Admin__enable_hidden_ee_nav_menu_boxes__initial_meta_boxes', array( 'nav-menu-theme-locations', 'add-page', 'add-custom-links', 'add-category', 'add-espresso_events', 'add-espresso_venues', 'add-espresso_event_categories', 'add-espresso_venue_categories', 'add-post-type-post', 'add-post-type-page' ) );
251
+		$hidden_meta_boxes = get_user_option('metaboxhidden_nav-menus', $user->ID);
252
+		$initial_meta_boxes = apply_filters('FHEE__EE_Admin__enable_hidden_ee_nav_menu_boxes__initial_meta_boxes', array('nav-menu-theme-locations', 'add-page', 'add-custom-links', 'add-category', 'add-espresso_events', 'add-espresso_venues', 'add-espresso_event_categories', 'add-espresso_venue_categories', 'add-post-type-post', 'add-post-type-page'));
253 253
 
254
-		if ( is_array( $hidden_meta_boxes ) ) {
255
-			foreach ( $hidden_meta_boxes as $key => $meta_box_id ) {
256
-				if ( in_array( $meta_box_id, $initial_meta_boxes ) ) {
257
-					unset( $hidden_meta_boxes[ $key ] );
254
+		if (is_array($hidden_meta_boxes)) {
255
+			foreach ($hidden_meta_boxes as $key => $meta_box_id) {
256
+				if (in_array($meta_box_id, $initial_meta_boxes)) {
257
+					unset($hidden_meta_boxes[$key]);
258 258
 				}
259 259
 			}
260 260
 		}
261 261
 
262
-		update_user_option( $user->ID, 'metaboxhidden_nav-menus', $hidden_meta_boxes, true );
263
-		update_user_option( $user->ID, 'ee_nav_menu_initialized', 1, true );
262
+		update_user_option($user->ID, 'metaboxhidden_nav-menus', $hidden_meta_boxes, true);
263
+		update_user_option($user->ID, 'ee_nav_menu_initialized', 1, true);
264 264
 	}
265 265
 
266 266
 
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
 	 * @return void
280 280
 	 */
281 281
 	public function register_custom_nav_menu_boxes() {
282
-		add_meta_box( 'add-extra-nav-menu-pages', __('Event Espresso Pages', 'event_espresso'), array( $this, 'ee_cpt_archive_pages' ), 'nav-menus', 'side', 'core' );
282
+		add_meta_box('add-extra-nav-menu-pages', __('Event Espresso Pages', 'event_espresso'), array($this, 'ee_cpt_archive_pages'), 'nav-menus', 'side', 'core');
283 283
 	}
284 284
 
285 285
 
@@ -296,17 +296,17 @@  discard block
 block discarded – undo
296 296
 	 *
297 297
 	 * @return string  the (maybe) modified link
298 298
 	 */
299
-	public function modify_edit_post_link( $link, $id, $context ) {
300
-		if ( ! $post = get_post( $id ) )
299
+	public function modify_edit_post_link($link, $id, $context) {
300
+		if ( ! $post = get_post($id))
301 301
 			return $link;
302 302
 
303
-		if ( $post->post_type == 'espresso_attendees' ) {
303
+		if ($post->post_type == 'espresso_attendees') {
304 304
 			$query_args = array(
305 305
 				'action' => 'edit_attendee',
306 306
 				'post' => $id
307 307
 				);
308 308
 			EE_Registry::instance()->load_helper('URL');
309
-			return EEH_URL::add_query_args_and_nonce( $query_args, admin_url('admin.php?page=espresso_registrations') );
309
+			return EEH_URL::add_query_args_and_nonce($query_args, admin_url('admin.php?page=espresso_registrations'));
310 310
 		}
311 311
 		return $link;
312 312
 	}
@@ -318,7 +318,7 @@  discard block
 block discarded – undo
318 318
 		global $nav_menu_selected_id;
319 319
 
320 320
 		$db_fields = false;
321
-		$walker = new Walker_Nav_Menu_Checklist( $db_fields );
321
+		$walker = new Walker_Nav_Menu_Checklist($db_fields);
322 322
 		$current_tab = 'event-archives';
323 323
 
324 324
 		/*if ( ! empty( $_REQUEST['quick-search-posttype-' . $post_type_name] ) ) {
@@ -337,9 +337,9 @@  discard block
 block discarded – undo
337 337
 		?>
338 338
 		<div id="posttype-extra-nav-menu-pages" class="posttypediv">
339 339
 			<ul id="posttype-extra-nav-menu-pages-tabs" class="posttype-tabs add-menu-item-tabs">
340
-				<li <?php echo ( 'event-archives' == $current_tab ? ' class="tabs"' : '' ); ?>>
341
-					<a class="nav-tab-link" data-type="tabs-panel-posttype-extra-nav-menu-pages-event-archives" href="<?php if ( $nav_menu_selected_id ) echo esc_url(add_query_arg('extra-nav-menu-pages-tab', 'event-archives', remove_query_arg($removed_args))); ?>#tabs-panel-posttype-extra-nav-menu-pages-event-archives">
342
-						<?php _e( 'Event Archive Pages', 'event_espresso' ); ?>
340
+				<li <?php echo ('event-archives' == $current_tab ? ' class="tabs"' : ''); ?>>
341
+					<a class="nav-tab-link" data-type="tabs-panel-posttype-extra-nav-menu-pages-event-archives" href="<?php if ($nav_menu_selected_id) echo esc_url(add_query_arg('extra-nav-menu-pages-tab', 'event-archives', remove_query_arg($removed_args))); ?>#tabs-panel-posttype-extra-nav-menu-pages-event-archives">
342
+						<?php _e('Event Archive Pages', 'event_espresso'); ?>
343 343
 					</a>
344 344
 				</li>
345 345
 			<?php /* // temporarily removing but leaving skeleton in place in case we ever decide to add more tabs.
@@ -357,13 +357,13 @@  discard block
 block discarded – undo
357 357
  			<?php */ ?>
358 358
 
359 359
 			<div id="tabs-panel-posttype-extra-nav-menu-pages-event-archives" class="tabs-panel <?php
360
-			echo ( 'event-archives' == $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive' );
360
+			echo ('event-archives' == $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive');
361 361
 			?>">
362 362
 				<ul id="extra-nav-menu-pageschecklist-event-archives" class="categorychecklist form-no-clear">
363 363
 					<?php
364 364
 					$pages = $this->_get_extra_nav_menu_pages_items();
365 365
 					$args['walker'] = $walker;
366
-					echo walk_nav_menu_tree( array_map( array( $this, '_setup_extra_nav_menu_pages_items' ), $pages), 0, (object) $args );
366
+					echo walk_nav_menu_tree(array_map(array($this, '_setup_extra_nav_menu_pages_items'), $pages), 0, (object) $args);
367 367
 					?>
368 368
 				</ul>
369 369
 			</div><!-- /.tabs-panel -->
@@ -371,18 +371,18 @@  discard block
 block discarded – undo
371 371
 			<p class="button-controls">
372 372
 				<span class="list-controls">
373 373
 					<a href="<?php
374
-						echo esc_url( add_query_arg(
374
+						echo esc_url(add_query_arg(
375 375
 							array(
376 376
 								'extra-nav-menu-pages-tab' => 'event-archives',
377 377
 								'selectall' => 1,
378 378
 							),
379
-							remove_query_arg( $removed_args )
379
+							remove_query_arg($removed_args)
380 380
 						));
381 381
 					?>#posttype-extra-nav-menu-pages>" class="select-all"><?php _e('Select All'); ?></a>
382 382
 				</span>
383 383
 
384 384
 				<span class="add-to-menu">
385
-					<input type="submit"<?php wp_nav_menu_disabled_check( $nav_menu_selected_id ); ?> class="button-secondary submit-add-to-menu right" value="<?php esc_attr_e( __( 'Add to Menu' ) ); ?>" name="add-post-type-menu-item" id="<?php esc_attr_e( 'submit-posttype-extra-nav-menu-pages' ); ?>" />
385
+					<input type="submit"<?php wp_nav_menu_disabled_check($nav_menu_selected_id); ?> class="button-secondary submit-add-to-menu right" value="<?php esc_attr_e(__('Add to Menu')); ?>" name="add-post-type-menu-item" id="<?php esc_attr_e('submit-posttype-extra-nav-menu-pages'); ?>" />
386 386
 					<span class="spinner"></span>
387 387
 				</span>
388 388
 			</p>
@@ -403,10 +403,10 @@  discard block
 block discarded – undo
403 403
 	private function _get_extra_nav_menu_pages_items() {
404 404
 		$menuitems[] = array(
405 405
 			'title' => __('Event List', 'event_espresso'),
406
-			'url' => get_post_type_archive_link( 'espresso_events' ),
406
+			'url' => get_post_type_archive_link('espresso_events'),
407 407
 			'description' => __('Archive page for all events.', 'event_espresso')
408 408
 		);
409
-		return apply_filters( 'FHEE__EE_Admin__get_extra_nav_menu_pages_items', $menuitems );
409
+		return apply_filters('FHEE__EE_Admin__get_extra_nav_menu_pages_items', $menuitems);
410 410
 	}
411 411
 
412 412
 
@@ -418,7 +418,7 @@  discard block
 block discarded – undo
418 418
 	 * @param $menu_item_values
419 419
 	 * @return stdClass
420 420
 	 */
421
-	private function _setup_extra_nav_menu_pages_items( $menu_item_values ) {
421
+	private function _setup_extra_nav_menu_pages_items($menu_item_values) {
422 422
 		$menu_item = new stdClass();
423 423
 		$keys = array(
424 424
 			'ID' => 0,
@@ -438,8 +438,8 @@  discard block
 block discarded – undo
438 438
 			'xfn' => ''
439 439
 		);
440 440
 
441
-		foreach ( $keys as $key => $value) {
442
-			$menu_item->{$key} = isset( $menu_item_values[ $key]) ? $menu_item_values[ $key] : $value;
441
+		foreach ($keys as $key => $value) {
442
+			$menu_item->{$key} = isset($menu_item_values[$key]) ? $menu_item_values[$key] : $value;
443 443
 		}
444 444
 		return $menu_item;
445 445
 	}
@@ -478,10 +478,10 @@  discard block
 block discarded – undo
478 478
 		 * - check if doing post processing of one of EE CPTs
479 479
 		 * - instantiate the corresponding EE CPT model for the post_type being processed.
480 480
 		 */
481
-		if ( isset( $_POST['action'] ) && $_POST['action'] == 'editpost' ) {
482
-			if ( isset( $_POST['post_type'] ) ) {
483
-				EE_Registry::instance()->load_core( 'Register_CPTs' );
484
-				EE_Register_CPTs::instantiate_cpt_models( $_POST['post_type'] );
481
+		if (isset($_POST['action']) && $_POST['action'] == 'editpost') {
482
+			if (isset($_POST['post_type'])) {
483
+				EE_Registry::instance()->load_core('Register_CPTs');
484
+				EE_Register_CPTs::instantiate_cpt_models($_POST['post_type']);
485 485
 			}
486 486
 		}
487 487
 
@@ -491,8 +491,8 @@  discard block
 block discarded – undo
491 491
 		 * 'options-reading.php' core WordPress admin settings page.  This is for user-proofing.
492 492
 		 */
493 493
 		global $pagenow;
494
-		if ( $pagenow == 'options-reading.php' ) {
495
-			add_filter( 'wp_dropdown_pages', array( $this, 'modify_dropdown_pages' ) );
494
+		if ($pagenow == 'options-reading.php') {
495
+			add_filter('wp_dropdown_pages', array($this, 'modify_dropdown_pages'));
496 496
 		}
497 497
 
498 498
 	}
@@ -504,25 +504,25 @@  discard block
 block discarded – undo
504 504
 	 * @param string $output  Current output.
505 505
 	 * @return string
506 506
 	 */
507
-	public function modify_dropdown_pages( $output ) {
507
+	public function modify_dropdown_pages($output) {
508 508
 		//get critical pages
509 509
 		$critical_pages = EE_Registry::instance()->CFG->core->get_critical_pages_array();
510 510
 
511 511
 		//split current output by line break for easier parsing.
512
-		$split_output = explode( "\n", $output );
512
+		$split_output = explode("\n", $output);
513 513
 
514 514
 		//loop through to remove any critical pages from the array.
515
-		foreach ( $critical_pages as $page_id ) {
516
-			$needle = 'value="' . $page_id . '"';
517
-			foreach( $split_output as $key => $haystack ) {
518
-				if( strpos( $haystack, $needle ) !== false ) {
519
-					unset( $split_output[$key] );
515
+		foreach ($critical_pages as $page_id) {
516
+			$needle = 'value="'.$page_id.'"';
517
+			foreach ($split_output as $key => $haystack) {
518
+				if (strpos($haystack, $needle) !== false) {
519
+					unset($split_output[$key]);
520 520
 				}
521 521
 			}
522 522
 		}
523 523
 
524 524
 		//replace output with the new contents
525
-		$output = implode( "\n", $split_output );
525
+		$output = implode("\n", $split_output);
526 526
 
527 527
 		return $output;
528 528
 	}
@@ -538,37 +538,37 @@  discard block
 block discarded – undo
538 538
 	public function enqueue_admin_scripts() {
539 539
 		// this javascript is loaded on every admin page to catch any injections ee needs to add to wp run js.
540 540
 		// Note: the intention of this script is to only do TARGETED injections.  I.E, only injecting on certain script calls.
541
-		wp_enqueue_script('ee-inject-wp', EE_ADMIN_URL . 'assets/ee-cpt-wp-injects.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE);
541
+		wp_enqueue_script('ee-inject-wp', EE_ADMIN_URL.'assets/ee-cpt-wp-injects.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE);
542 542
 		// register cookie script for future dependencies
543
-		wp_register_script('jquery-cookie', EE_THIRD_PARTY_URL . 'joyride/jquery.cookie.js', array('jquery'), '2.1', TRUE );
543
+		wp_register_script('jquery-cookie', EE_THIRD_PARTY_URL.'joyride/jquery.cookie.js', array('jquery'), '2.1', TRUE);
544 544
 		// jquery_validate loading is turned OFF by default, but prior to the admin_enqueue_scripts hook, can be turned back on again via:  add_filter( 'FHEE_load_jquery_validate', '__return_true' );
545
-		if ( apply_filters( 'FHEE_load_jquery_validate', FALSE ) ) {
545
+		if (apply_filters('FHEE_load_jquery_validate', FALSE)) {
546 546
 			// register jQuery Validate
547
-			wp_register_script('jquery-validate', EE_GLOBAL_ASSETS_URL . 'scripts/jquery.validate.min.js', array('jquery'), '1.15.0', TRUE);
547
+			wp_register_script('jquery-validate', EE_GLOBAL_ASSETS_URL.'scripts/jquery.validate.min.js', array('jquery'), '1.15.0', TRUE);
548 548
 		}
549 549
 		//joyride is turned OFF by default, but prior to the admin_enqueue_scripts hook, can be turned back on again vai: add_filter('FHEE_load_joyride', '__return_true' );
550
-		if ( apply_filters( 'FHEE_load_joyride', FALSE ) ) {
550
+		if (apply_filters('FHEE_load_joyride', FALSE)) {
551 551
 			//joyride style
552
-			wp_register_style('joyride-css', EE_THIRD_PARTY_URL . 'joyride/joyride-2.1.css', array(), '2.1');
553
-			wp_register_style('ee-joyride-css', EE_GLOBAL_ASSETS_URL . 'css/ee-joyride-styles.css', array('joyride-css'), EVENT_ESPRESSO_VERSION );
554
-			wp_register_script('joyride-modernizr', EE_THIRD_PARTY_URL . 'joyride/modernizr.mq.js', array(), '2.1', TRUE );
552
+			wp_register_style('joyride-css', EE_THIRD_PARTY_URL.'joyride/joyride-2.1.css', array(), '2.1');
553
+			wp_register_style('ee-joyride-css', EE_GLOBAL_ASSETS_URL.'css/ee-joyride-styles.css', array('joyride-css'), EVENT_ESPRESSO_VERSION);
554
+			wp_register_script('joyride-modernizr', EE_THIRD_PARTY_URL.'joyride/modernizr.mq.js', array(), '2.1', TRUE);
555 555
 			//joyride JS
556
-			wp_register_script('jquery-joyride', EE_THIRD_PARTY_URL . 'joyride/jquery.joyride-2.1.js', array('jquery-cookie', 'joyride-modernizr'), '2.1', TRUE );
556
+			wp_register_script('jquery-joyride', EE_THIRD_PARTY_URL.'joyride/jquery.joyride-2.1.js', array('jquery-cookie', 'joyride-modernizr'), '2.1', TRUE);
557 557
 			// wanna go for a joyride?
558 558
 			wp_enqueue_style('ee-joyride-css');
559 559
 			wp_enqueue_script('jquery-joyride');
560 560
 		}
561 561
 		//qtip is turned OFF by default, but prior to the admin_enqueue_scripts hook, can be turned back on again via: add_filter('FHEE_load_qtips', '__return_true' );
562
-		if ( apply_filters( 'FHEE_load_qtip', FALSE ) ) {
562
+		if (apply_filters('FHEE_load_qtip', FALSE)) {
563 563
 			EE_Registry::instance()->load_helper('Qtip_Loader');
564 564
 			EEH_Qtip_Loader::instance()->register_and_enqueue();
565 565
 		}
566 566
 		//accounting.js library
567 567
 		// @link http://josscrowcroft.github.io/accounting.js/
568
-		if ( apply_filters( 'FHEE_load_accounting_js', FALSE ) ) {
569
-			wp_register_script( 'ee-accounting', EE_GLOBAL_ASSETS_URL . 'scripts/ee-accounting-config.js', array('ee-accounting-core'), EVENT_ESPRESSO_VERSION, TRUE );
570
-			wp_register_script( 'ee-accounting-core', EE_THIRD_PARTY_URL . 'accounting/accounting.js', array('underscore'), '0.3.2', TRUE );
571
-			wp_enqueue_script( 'ee-accounting' );
568
+		if (apply_filters('FHEE_load_accounting_js', FALSE)) {
569
+			wp_register_script('ee-accounting', EE_GLOBAL_ASSETS_URL.'scripts/ee-accounting-config.js', array('ee-accounting-core'), EVENT_ESPRESSO_VERSION, TRUE);
570
+			wp_register_script('ee-accounting-core', EE_THIRD_PARTY_URL.'accounting/accounting.js', array('underscore'), '0.3.2', TRUE);
571
+			wp_enqueue_script('ee-accounting');
572 572
 			// array of settings to get converted to JSON array via wp_localize_script
573 573
 			$currency_config = array(
574 574
 				'currency' => array(
@@ -615,11 +615,11 @@  discard block
 block discarded – undo
615 615
 	public function get_persistent_admin_notices() {
616 616
 		// http://www.example.com/wp-admin/admin.php?page=espresso_general_settings&action=critical_pages&critical_pages_nonce=2831ce0f30
617 617
 		$args = array(
618
-			'page' => EE_Registry::instance()->REQ->is_set( 'page' ) ? EE_Registry::instance()->REQ->get( 'page' ) : '',
619
-			'action' => EE_Registry::instance()->REQ->is_set( 'action' ) ? EE_Registry::instance()->REQ->get( 'action' ) : '',
618
+			'page' => EE_Registry::instance()->REQ->is_set('page') ? EE_Registry::instance()->REQ->get('page') : '',
619
+			'action' => EE_Registry::instance()->REQ->is_set('action') ? EE_Registry::instance()->REQ->get('action') : '',
620 620
 		);
621
-		$return_url = EE_Admin_Page::add_query_args_and_nonce( $args, EE_ADMIN_URL );
622
-		echo EE_Error::get_persistent_admin_notices( $return_url );
621
+		$return_url = EE_Admin_Page::add_query_args_and_nonce($args, EE_ADMIN_URL);
622
+		echo EE_Error::get_persistent_admin_notices($return_url);
623 623
 	}
624 624
 
625 625
 
@@ -640,26 +640,26 @@  discard block
 block discarded – undo
640 640
 	 * @param $elements
641 641
 	 * @return array
642 642
 	 */
643
-	public function dashboard_glance_items( $elements ) {
643
+	public function dashboard_glance_items($elements) {
644 644
 		$events = EEM_Event::instance()->count();
645
-		$items['events']['url'] = EE_Admin_Page::add_query_args_and_nonce( array('page' => 'espresso_events'), admin_url('admin.php') );
646
-		$items['events']['text'] = sprintf( _n( '%s Event', '%s Events', $events ), number_format_i18n( $events ) );
645
+		$items['events']['url'] = EE_Admin_Page::add_query_args_and_nonce(array('page' => 'espresso_events'), admin_url('admin.php'));
646
+		$items['events']['text'] = sprintf(_n('%s Event', '%s Events', $events), number_format_i18n($events));
647 647
 		$items['events']['title'] = __('Click to view all Events', 'event_espresso');
648 648
 		$registrations = EEM_Registration::instance()->count(
649 649
 			array(
650 650
 				array(
651
-					'STS_ID' => array( '!=', EEM_Registration::status_id_incomplete )
651
+					'STS_ID' => array('!=', EEM_Registration::status_id_incomplete)
652 652
 				)
653 653
 			)
654 654
 		);
655
-		$items['registrations']['url'] = EE_Admin_Page::add_query_args_and_nonce( array('page' => 'espresso_registrations' ), admin_url('admin.php') );
656
-		$items['registrations']['text'] = sprintf( _n( '%s Registration', '%s Registrations', $registrations ), number_format_i18n($registrations) );
655
+		$items['registrations']['url'] = EE_Admin_Page::add_query_args_and_nonce(array('page' => 'espresso_registrations'), admin_url('admin.php'));
656
+		$items['registrations']['text'] = sprintf(_n('%s Registration', '%s Registrations', $registrations), number_format_i18n($registrations));
657 657
 		$items['registrations']['title'] = __('Click to view all registrations', 'event_espresso');
658 658
 
659
-		$items = apply_filters( 'FHEE__EE_Admin__dashboard_glance_items__items', $items );
659
+		$items = apply_filters('FHEE__EE_Admin__dashboard_glance_items__items', $items);
660 660
 
661
-		foreach ( $items as $type => $item_properties ) {
662
-			$elements[] = sprintf( '<a class="ee-dashboard-link-' . $type . '" href="%s" title="%s">%s</a>', $item_properties['url'], $item_properties['title'], $item_properties['text'] );
661
+		foreach ($items as $type => $item_properties) {
662
+			$elements[] = sprintf('<a class="ee-dashboard-link-'.$type.'" href="%s" title="%s">%s</a>', $item_properties['url'], $item_properties['title'], $item_properties['text']);
663 663
 		}
664 664
 		return $elements;
665 665
 	}
@@ -678,63 +678,63 @@  discard block
 block discarded – undo
678 678
 	 * @param $post
679 679
 	 * @return    void
680 680
 	 */
681
-	public static function parse_post_content_on_save( $post_ID, $post ) {
681
+	public static function parse_post_content_on_save($post_ID, $post) {
682 682
 		// default post types
683
-		$post_types = array( 'post' => 0, 'page' => 1 );
683
+		$post_types = array('post' => 0, 'page' => 1);
684 684
 		// add CPTs
685 685
 		$CPTs = EE_Register_CPTs::get_CPTs();
686
-		$post_types = array_merge( $post_types, $CPTs );
686
+		$post_types = array_merge($post_types, $CPTs);
687 687
 		// for default or CPT posts...
688
-		if ( isset( $post_types[ $post->post_type ] )) {
688
+		if (isset($post_types[$post->post_type])) {
689 689
 			// post on frontpage ?
690 690
 			$page_for_posts = EE_Config::get_page_for_posts();
691 691
 			$maybe_remove_from_posts = array();
692 692
 			// critical page shortcodes that we do NOT want added to the Posts page (blog)
693 693
 			$critical_shortcodes = EE_Registry::instance()->CFG->core->get_critical_pages_shortcodes_array();
694 694
 			// array of shortcodes indexed by post name
695
-			EE_Registry::instance()->CFG->core->post_shortcodes = isset( EE_Registry::instance()->CFG->core->post_shortcodes ) ? EE_Registry::instance()->CFG->core->post_shortcodes : array();
695
+			EE_Registry::instance()->CFG->core->post_shortcodes = isset(EE_Registry::instance()->CFG->core->post_shortcodes) ? EE_Registry::instance()->CFG->core->post_shortcodes : array();
696 696
 			// whether to proceed with update, if an entry already exists for this post, then we want to update
697
-			$update_post_shortcodes = isset( EE_Registry::instance()->CFG->core->post_shortcodes[ $post->post_name ] ) ? true : false;
697
+			$update_post_shortcodes = isset(EE_Registry::instance()->CFG->core->post_shortcodes[$post->post_name]) ? true : false;
698 698
 			// empty both arrays
699
-			EE_Registry::instance()->CFG->core->post_shortcodes[ $post->post_name ] = array();
699
+			EE_Registry::instance()->CFG->core->post_shortcodes[$post->post_name] = array();
700 700
 			// check that posts page is already being tracked
701
-			if ( ! isset( EE_Registry::instance()->CFG->core->post_shortcodes[ $page_for_posts ] ) ) {
701
+			if ( ! isset(EE_Registry::instance()->CFG->core->post_shortcodes[$page_for_posts])) {
702 702
 				// if not, then ensure that it is properly added
703
-				EE_Registry::instance()->CFG->core->post_shortcodes[ $page_for_posts ] = array();
703
+				EE_Registry::instance()->CFG->core->post_shortcodes[$page_for_posts] = array();
704 704
 			}
705 705
 			// loop thru shortcodes
706
-			foreach ( EE_Registry::instance()->shortcodes as $EES_Shortcode => $shortcode_dir ) {
706
+			foreach (EE_Registry::instance()->shortcodes as $EES_Shortcode => $shortcode_dir) {
707 707
 				// convert to UPPERCASE to get actual shortcode
708
-				$EES_Shortcode = strtoupper( $EES_Shortcode );
708
+				$EES_Shortcode = strtoupper($EES_Shortcode);
709 709
 				// is the shortcode in the post_content ?
710
-				if ( strpos( $post->post_content, $EES_Shortcode ) !== FALSE ) {
710
+				if (strpos($post->post_content, $EES_Shortcode) !== FALSE) {
711 711
 					// map shortcode to post names and post IDs
712
-					EE_Registry::instance()->CFG->core->post_shortcodes[ $post->post_name ][ $EES_Shortcode ] = $post_ID;
712
+					EE_Registry::instance()->CFG->core->post_shortcodes[$post->post_name][$EES_Shortcode] = $post_ID;
713 713
 					// if the shortcode is NOT one of the critical page shortcodes like ESPRESSO_TXN_PAGE
714
-					if ( ! in_array( $EES_Shortcode, $critical_shortcodes )) {
714
+					if ( ! in_array($EES_Shortcode, $critical_shortcodes)) {
715 715
 						// add shortcode to "Posts page" tracking
716
-						EE_Registry::instance()->CFG->core->post_shortcodes[ $page_for_posts ][ $EES_Shortcode ] = $post_ID;
716
+						EE_Registry::instance()->CFG->core->post_shortcodes[$page_for_posts][$EES_Shortcode] = $post_ID;
717 717
 					}
718 718
 					$update_post_shortcodes = TRUE;
719
-					unset( $maybe_remove_from_posts[ $EES_Shortcode ] );
719
+					unset($maybe_remove_from_posts[$EES_Shortcode]);
720 720
 				} else {
721
-					$maybe_remove_from_posts[ $EES_Shortcode ] = $post_ID;
721
+					$maybe_remove_from_posts[$EES_Shortcode] = $post_ID;
722 722
 				}
723 723
 			}
724
-			if ( $update_post_shortcodes ) {
724
+			if ($update_post_shortcodes) {
725 725
 				// remove shortcodes from $maybe_remove_from_posts that are still being used
726
-				foreach ( EE_Registry::instance()->CFG->core->post_shortcodes as $post_name => $shortcodes ) {
727
-					if ( $post_name == $page_for_posts ) {
726
+				foreach (EE_Registry::instance()->CFG->core->post_shortcodes as $post_name => $shortcodes) {
727
+					if ($post_name == $page_for_posts) {
728 728
 						continue;
729 729
 					}
730 730
 					// compute difference between active post_shortcodes array and $maybe_remove_from_posts array
731
-					$maybe_remove_from_posts = array_diff_key( $maybe_remove_from_posts, $shortcodes );
731
+					$maybe_remove_from_posts = array_diff_key($maybe_remove_from_posts, $shortcodes);
732 732
 				}
733 733
 				// now unset unused shortcodes from the $page_for_posts post_shortcodes
734
-				foreach ( $maybe_remove_from_posts as $shortcode => $post_ID ) {
735
-					unset( EE_Registry::instance()->CFG->core->post_shortcodes[ $page_for_posts ][ $shortcode ] );
734
+				foreach ($maybe_remove_from_posts as $shortcode => $post_ID) {
735
+					unset(EE_Registry::instance()->CFG->core->post_shortcodes[$page_for_posts][$shortcode]);
736 736
 				}
737
-				EE_Registry::instance()->CFG->update_post_shortcodes( $page_for_posts );
737
+				EE_Registry::instance()->CFG->update_post_shortcodes($page_for_posts);
738 738
 			}
739 739
 		}
740 740
 	}
@@ -752,32 +752,32 @@  discard block
 block discarded – undo
752 752
 	 * @throws EE_Error
753 753
 	 * @return    string
754 754
 	 */
755
-	public function check_for_invalid_datetime_formats( $value, $option ) {
756
-		EE_Registry::instance()->load_helper( 'DTT_Helper' );
755
+	public function check_for_invalid_datetime_formats($value, $option) {
756
+		EE_Registry::instance()->load_helper('DTT_Helper');
757 757
 		// check for date_format or time_format
758
-		switch ( $option ) {
758
+		switch ($option) {
759 759
 			case 'date_format' :
760
-				$date_time_format = $value . ' ' . get_option('time_format');
760
+				$date_time_format = $value.' '.get_option('time_format');
761 761
 				break;
762 762
 			case 'time_format' :
763
-				$date_time_format = get_option('date_format') . ' ' . $value;
763
+				$date_time_format = get_option('date_format').' '.$value;
764 764
 				break;
765 765
 			default :
766 766
 				$date_time_format = FALSE;
767 767
 		}
768 768
 		// do we have a date_time format to check ?
769
-		if ( $date_time_format ) {
770
-			$error_msg = EEH_DTT_Helper::validate_format_string( $date_time_format );
769
+		if ($date_time_format) {
770
+			$error_msg = EEH_DTT_Helper::validate_format_string($date_time_format);
771 771
 
772
-			if ( is_array( $error_msg ) ) {
773
-				$msg = '<p>' . sprintf( __( 'The following date time "%s" ( %s ) is difficult to be properly parsed by PHP for the following reasons:', 'event_espresso' ), date( $date_time_format ) , $date_time_format  ) . '</p><p><ul>';
772
+			if (is_array($error_msg)) {
773
+				$msg = '<p>'.sprintf(__('The following date time "%s" ( %s ) is difficult to be properly parsed by PHP for the following reasons:', 'event_espresso'), date($date_time_format), $date_time_format).'</p><p><ul>';
774 774
 
775 775
 
776
-				foreach ( $error_msg as $error ) {
777
-					$msg .= '<li>' . $error . '</li>';
776
+				foreach ($error_msg as $error) {
777
+					$msg .= '<li>'.$error.'</li>';
778 778
 				}
779 779
 
780
-				$msg .= '</ul></p><p>' . sprintf( __( '%sPlease note that your date and time formats have been reset to "F j, Y" and "g:i a" respectively.%s', 'event_espresso' ), '<span style="color:#D54E21;">', '</span>' ) . '</p>';
780
+				$msg .= '</ul></p><p>'.sprintf(__('%sPlease note that your date and time formats have been reset to "F j, Y" and "g:i a" respectively.%s', 'event_espresso'), '<span style="color:#D54E21;">', '</span>').'</p>';
781 781
 
782 782
 				// trigger WP settings error
783 783
 				add_settings_error(
@@ -787,7 +787,7 @@  discard block
 block discarded – undo
787 787
 				);
788 788
 
789 789
 				// set format to something valid
790
-				switch ( $option ) {
790
+				switch ($option) {
791 791
 					case 'date_format' :
792 792
 						$value = 'F j, Y';
793 793
 						break;
@@ -813,14 +813,14 @@  discard block
 block discarded – undo
813 813
 	 * @param 	$value
814 814
 	 * @return 	void
815 815
 	 */
816
-	public function reset_page_for_posts_on_change( $option, $old_value, $value ) {
817
-		if ( $option == 'page_for_posts' ) {
816
+	public function reset_page_for_posts_on_change($option, $old_value, $value) {
817
+		if ($option == 'page_for_posts') {
818 818
 			global $wpdb;
819
-			$SQL = 'SELECT post_name from ' . $wpdb->posts . ' WHERE post_type="posts" OR post_type="page" AND post_status="publish" AND ID=%s';
820
-			$old_page_for_posts = $old_value ? $wpdb->get_var( $wpdb->prepare( $SQL, $old_value )) : 'posts';
821
-			$new_page_for_posts = $value ? $wpdb->get_var( $wpdb->prepare( $SQL, $value )) : 'posts';
822
-			EE_Registry::instance()->CFG->core->post_shortcodes[ $new_page_for_posts ] = EE_Registry::instance()->CFG->core->post_shortcodes[ $old_page_for_posts ];
823
-			EE_Registry::instance()->CFG->update_post_shortcodes( $new_page_for_posts );
819
+			$SQL = 'SELECT post_name from '.$wpdb->posts.' WHERE post_type="posts" OR post_type="page" AND post_status="publish" AND ID=%s';
820
+			$old_page_for_posts = $old_value ? $wpdb->get_var($wpdb->prepare($SQL, $old_value)) : 'posts';
821
+			$new_page_for_posts = $value ? $wpdb->get_var($wpdb->prepare($SQL, $value)) : 'posts';
822
+			EE_Registry::instance()->CFG->core->post_shortcodes[$new_page_for_posts] = EE_Registry::instance()->CFG->core->post_shortcodes[$old_page_for_posts];
823
+			EE_Registry::instance()->CFG->update_post_shortcodes($new_page_for_posts);
824 824
 		}
825 825
 	}
826 826
 
@@ -833,8 +833,8 @@  discard block
 block discarded – undo
833 833
 	 * @param $content
834 834
 	 * @return    string
835 835
 	 */
836
-	public function its_eSpresso( $content ) {
837
-		return str_replace( '[EXPRESSO_', '[ESPRESSO_', $content );
836
+	public function its_eSpresso($content) {
837
+		return str_replace('[EXPRESSO_', '[ESPRESSO_', $content);
838 838
 	}
839 839
 
840 840
 
@@ -847,9 +847,9 @@  discard block
 block discarded – undo
847 847
 	 */
848 848
 	public function espresso_admin_footer() {
849 849
 		return sprintf(
850
-			__( 'Event Registration and Ticketing Powered by %sEvent Registration Powered by Event Espresso%s', 'event_espresso' ),
850
+			__('Event Registration and Ticketing Powered by %sEvent Registration Powered by Event Espresso%s', 'event_espresso'),
851 851
 			'<a href="https://eventespresso.com/" title="',
852
-			'">' . EVENT_ESPRESSO_POWERED_BY . '</a>'
852
+			'">'.EVENT_ESPRESSO_POWERED_BY.'</a>'
853 853
 		);
854 854
 	}
855 855
 
@@ -869,11 +869,11 @@  discard block
 block discarded – undo
869 869
 	 * @param array $config
870 870
 	 * @return void
871 871
 	 */
872
-	public static function register_ee_admin_page( $page_basename, $page_path, $config = array() ) {
873
-		EE_Error::doing_it_wrong( __METHOD__, sprintf( __('Usage is deprecated.  Use EE_Register_Admin_Page::register() for registering the %s admin page.', 'event_espresso'), $page_basename), '4.3' );
874
-		if ( class_exists( 'EE_Register_Admin_Page' ) )
872
+	public static function register_ee_admin_page($page_basename, $page_path, $config = array()) {
873
+		EE_Error::doing_it_wrong(__METHOD__, sprintf(__('Usage is deprecated.  Use EE_Register_Admin_Page::register() for registering the %s admin page.', 'event_espresso'), $page_basename), '4.3');
874
+		if (class_exists('EE_Register_Admin_Page'))
875 875
 			$config['page_path'] = $page_path;
876
-			EE_Register_Admin_Page::register( $page_basename, $config );
876
+			EE_Register_Admin_Page::register($page_basename, $config);
877 877
 	}
878 878
 
879 879
 
Please login to merge, or discard this patch.
core/db_classes/EE_Checkin.class.php 2 patches
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -1,18 +1,18 @@
 block discarded – undo
1 1
 <?php if (!defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
2 2
 do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
3 3
 /**
4
- * Event Espresso
5
- *
6
- * Event Registration and Management Plugin for WordPress
7
- *
8
- * @ package			Event Espresso
9
- * @ author				Seth Shoultes
10
- * @ copyright		(c) 2008-2011 Event Espresso  All Rights Reserved.
11
- * @ license			{@link http://eventespresso.com/support/terms-conditions/}   * see Plugin Licensing *
12
- * @ link					{@link http://www.eventespresso.com}
13
- * @ since		 		4.0
14
- *
15
- */
4
+	 * Event Espresso
5
+	 *
6
+	 * Event Registration and Management Plugin for WordPress
7
+	 *
8
+	 * @ package			Event Espresso
9
+	 * @ author				Seth Shoultes
10
+	 * @ copyright		(c) 2008-2011 Event Espresso  All Rights Reserved.
11
+	 * @ license			{@link http://eventespresso.com/support/terms-conditions/}   * see Plugin Licensing *
12
+	 * @ link					{@link http://www.eventespresso.com}
13
+	 * @ since		 		4.0
14
+	 *
15
+	 */
16 16
 
17 17
 
18 18
 
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1
-<?php if (!defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
2
-do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
2
+do_action('AHEE_log', __FILE__, __FUNCTION__, '');
3 3
 /**
4 4
  * Event Espresso
5 5
  *
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
  * @subpackage		includes/classes/EE_Checkin.class.php
24 24
  * @author				Darren Ethier
25 25
  */
26
-class EE_Checkin extends EE_Base_Class{
26
+class EE_Checkin extends EE_Base_Class {
27 27
 
28 28
 	/**
29 29
 	 *
@@ -34,9 +34,9 @@  discard block
 block discarded – undo
34 34
 	 *                             		    date_format and the second value is the time format
35 35
 	 * @return EE_Checkin
36 36
 	 */
37
-	public static function new_instance( $props_n_values = array(), $timezone = null, $date_formats = array() ) {
38
-		$has_object = parent::_check_for_object( $props_n_values, __CLASS__, $timezone, $date_formats );
39
-		return $has_object ? $has_object : new self( $props_n_values, false, $timezone, $date_formats );
37
+	public static function new_instance($props_n_values = array(), $timezone = null, $date_formats = array()) {
38
+		$has_object = parent::_check_for_object($props_n_values, __CLASS__, $timezone, $date_formats);
39
+		return $has_object ? $has_object : new self($props_n_values, false, $timezone, $date_formats);
40 40
 	}
41 41
 
42 42
 
@@ -47,8 +47,8 @@  discard block
 block discarded – undo
47 47
 	 *                          		the website will be used.
48 48
 	 * @return EE_Checkin
49 49
 	 */
50
-	public static function new_instance_from_db( $props_n_values = array(), $timezone = null ) {
51
-		return new self( $props_n_values, TRUE, $timezone );
50
+	public static function new_instance_from_db($props_n_values = array(), $timezone = null) {
51
+		return new self($props_n_values, TRUE, $timezone);
52 52
 	}
53 53
 
54 54
 
Please login to merge, or discard this patch.
admin_pages/events/Events_Admin_List_Table.class.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -503,7 +503,7 @@
 block discarded – undo
503 503
 	/**
504 504
 	 * @param $message_types
505 505
 	 * @param array $extra
506
-	 * @return mixed|string
506
+	 * @return string
507 507
 	 */
508 508
 	protected function _get_admin_content_events_edit( $message_types, $extra ) {
509 509
 		//defaults
Please login to merge, or discard this patch.
Spacing   +77 added lines, -77 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
 /**
@@ -43,9 +43,9 @@  discard block
 block discarded – undo
43 43
 	 *
44 44
 	 * @param EE_Admin_Page $admin_page
45 45
 	 */
46
-	public function __construct( $admin_page ) {
46
+	public function __construct($admin_page) {
47 47
 		parent::__construct($admin_page);
48
-		require_once( EE_HELPERS . 'EEH_DTT_Helper.helper.php' );
48
+		require_once(EE_HELPERS.'EEH_DTT_Helper.helper.php');
49 49
 	}
50 50
 
51 51
 
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 	 */
55 55
 	protected function _setup_data() {
56 56
 		$this->_data = $this->_admin_page->get_events($this->_per_page, $this->_current_page);
57
- 		$this->_all_data_count = $this->_admin_page->get_events(0,0, TRUE);
57
+ 		$this->_all_data_count = $this->_admin_page->get_events(0, 0, TRUE);
58 58
 	}
59 59
 
60 60
 
@@ -85,17 +85,17 @@  discard block
 block discarded – undo
85 85
 
86 86
 
87 87
 		$this->_sortable_columns = array(
88
-			'id' => array( 'EVT_ID' => true ),
89
-			'name' => array( 'EVT_name' => false ),
90
-			'author' => array( 'EVT_wp_user' => false ),
91
-			'venue' => array( 'Venue.VNU_name' => false ),
88
+			'id' => array('EVT_ID' => true),
89
+			'name' => array('EVT_name' => false),
90
+			'author' => array('EVT_wp_user' => false),
91
+			'venue' => array('Venue.VNU_name' => false),
92 92
 			'start_date_time' => array('Datetime.DTT_EVT_start' => false),
93 93
 			'reg_begins' => array('Datetime.Ticket.TKT_start_date' => false),
94 94
 			);
95 95
 
96 96
 		$this->_primary_column = 'id';
97 97
 
98
-		$this->_hidden_columns = array( 'author' );
98
+		$this->_hidden_columns = array('author');
99 99
 	}
100 100
 
101 101
 
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 	protected function _add_view_counts() {
114 114
 		$this->_views['all']['count'] = $this->_admin_page->total_events();
115 115
 		$this->_views['draft']['count'] = $this->_admin_page->total_events_draft();
116
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_events', 'espresso_events_trash_events' ) ) {
116
+		if (EE_Registry::instance()->CAP->current_user_can('ee_delete_events', 'espresso_events_trash_events')) {
117 117
 			$this->_views['trash']['count'] = $this->_admin_page->total_trashed_events();
118 118
 		}
119 119
 	}
@@ -124,11 +124,11 @@  discard block
 block discarded – undo
124 124
 	 *
125 125
 	 * @return string
126 126
 	 */
127
-	protected function _get_row_class( $item ) {
128
-		$class = parent::_get_row_class( $item );
127
+	protected function _get_row_class($item) {
128
+		$class = parent::_get_row_class($item);
129 129
 		//add status class
130
-		$class .= $item instanceof EE_Event ? ' ee-status-strip event-status-' . $item->get_active_status() : '';
131
-		if ( $this->_has_checkbox_column ) {
130
+		$class .= $item instanceof EE_Event ? ' ee-status-strip event-status-'.$item->get_active_status() : '';
131
+		if ($this->_has_checkbox_column) {
132 132
 			$class .= ' has-checkbox-column';
133 133
 		}
134 134
 		return $class;
@@ -140,8 +140,8 @@  discard block
 block discarded – undo
140 140
 	 *
141 141
 	 * @return string
142 142
 	 */
143
-	public function column_status( EE_Event $item ) {
144
-		return '<span class="ee-status-strip ee-status-strip-td event-status-' . $item->get_active_status() . '"></span>';
143
+	public function column_status(EE_Event $item) {
144
+		return '<span class="ee-status-strip ee-status-strip-td event-status-'.$item->get_active_status().'"></span>';
145 145
 	}/**/
146 146
 
147 147
 
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
 	 *
151 151
 	 * @return string
152 152
 	 */
153
-	public function column_cb( $item ) {
153
+	public function column_cb($item) {
154 154
 		$this->_dtt = $item->primary_datetime(); //set this for use in other columns
155 155
 
156 156
 		//does event have any attached registrations?
@@ -166,9 +166,9 @@  discard block
 block discarded – undo
166 166
 	 *
167 167
 	 * @return mixed|string
168 168
 	 */
169
-	public function column_id( EE_Event $item ) {
169
+	public function column_id(EE_Event $item) {
170 170
 		$content = $item->ID();
171
-		$content .= '  <span class="show-on-mobile-view-only">' . $item->name() . '</span>';
171
+		$content .= '  <span class="show-on-mobile-view-only">'.$item->name().'</span>';
172 172
 		return $content;
173 173
 	}
174 174
 
@@ -178,16 +178,16 @@  discard block
 block discarded – undo
178 178
 	 *
179 179
 	 * @return string
180 180
 	 */
181
-	public function column_name( EE_Event $item ) {
181
+	public function column_name(EE_Event $item) {
182 182
 		$edit_query_args = array(
183 183
 				'action' => 'edit',
184 184
 				'post' => $item->ID()
185 185
 			);
186
-		$edit_link = EE_Admin_Page::add_query_args_and_nonce( $edit_query_args, EVENTS_ADMIN_URL );
187
-		$actions = $this->_column_name_action_setup( $item );
186
+		$edit_link = EE_Admin_Page::add_query_args_and_nonce($edit_query_args, EVENTS_ADMIN_URL);
187
+		$actions = $this->_column_name_action_setup($item);
188 188
 		$status = ''; //$item->status() !== 'publish' ? ' (' . $item->status() . ')' : '';
189
-		$content = '<strong><a class="row-title" href="' . $edit_link . '">' . $item->name() . '</a></strong>' . $status;
190
-		$content .= '<br><span class="ee-status-text-small">' . EEH_Template::pretty_status( $item->get_active_status(), false, 'sentence' ) . '</span>';
189
+		$content = '<strong><a class="row-title" href="'.$edit_link.'">'.$item->name().'</a></strong>'.$status;
190
+		$content .= '<br><span class="ee-status-text-small">'.EEH_Template::pretty_status($item->get_active_status(), false, 'sentence').'</span>';
191 191
 		$content .= $this->row_actions($actions);
192 192
 		return $content;
193 193
 
@@ -204,72 +204,72 @@  discard block
 block discarded – undo
204 204
 	 *
205 205
 	 * @return array array of actions
206 206
 	 */
207
-	protected function _column_name_action_setup( EE_Event $item ) {
207
+	protected function _column_name_action_setup(EE_Event $item) {
208 208
 		//todo: remove when attendees is active
209
-		if ( !defined('REG_ADMIN_URL') )
209
+		if ( ! defined('REG_ADMIN_URL'))
210 210
 			define('REG_ADMIN_URL', EVENTS_ADMIN_URL);
211 211
 
212 212
 		$actions = array();
213 213
 
214
-		if ( EE_Registry::instance()->CAP->current_user_can('ee_edit_event', 'espresso_events_edit', $item->ID() ) ) {
214
+		if (EE_Registry::instance()->CAP->current_user_can('ee_edit_event', 'espresso_events_edit', $item->ID())) {
215 215
 			$edit_query_args = array(
216 216
 					'action' => 'edit',
217 217
 					'post' => $item->ID()
218 218
 				);
219
-			$edit_link = EE_Admin_Page::add_query_args_and_nonce( $edit_query_args, EVENTS_ADMIN_URL );
220
-			$actions['edit'] = '<a href="' . $edit_link . '" title="' . esc_attr__('Edit Event', 'event_espresso') . '">' . __('Edit', 'event_espresso') . '</a>';
219
+			$edit_link = EE_Admin_Page::add_query_args_and_nonce($edit_query_args, EVENTS_ADMIN_URL);
220
+			$actions['edit'] = '<a href="'.$edit_link.'" title="'.esc_attr__('Edit Event', 'event_espresso').'">'.__('Edit', 'event_espresso').'</a>';
221 221
 
222 222
 		}
223 223
 
224
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registration', 'espresso_registrations_view_registration', $item->ID() ) ) {
224
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_registration', 'espresso_registrations_view_registration', $item->ID())) {
225 225
 			$attendees_query_args = array(
226 226
 					'action' => 'default',
227 227
 					'event_id' => $item->ID()
228 228
 				);
229
-			$attendees_link = EE_Admin_Page::add_query_args_and_nonce( $attendees_query_args, REG_ADMIN_URL );
230
-			$actions['attendees'] = '<a href="' . $attendees_link . '" title="' . esc_attr__('View Registrations', 'event_espresso') . '">' . __('Registrations', 'event_espresso') . '</a>';
229
+			$attendees_link = EE_Admin_Page::add_query_args_and_nonce($attendees_query_args, REG_ADMIN_URL);
230
+			$actions['attendees'] = '<a href="'.$attendees_link.'" title="'.esc_attr__('View Registrations', 'event_espresso').'">'.__('Registrations', 'event_espresso').'</a>';
231 231
 		}
232 232
 
233
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_event', 'espresso_events_trash_event', $item->ID() ) ) {
233
+		if (EE_Registry::instance()->CAP->current_user_can('ee_delete_event', 'espresso_events_trash_event', $item->ID())) {
234 234
 			$trash_event_query_args = array(
235 235
 					'action' => 'trash_event',
236 236
 					'EVT_ID' => $item->ID()
237 237
 				);
238
-			$trash_event_link = EE_Admin_Page::add_query_args_and_nonce( $trash_event_query_args, EVENTS_ADMIN_URL );
238
+			$trash_event_link = EE_Admin_Page::add_query_args_and_nonce($trash_event_query_args, EVENTS_ADMIN_URL);
239 239
 		}
240 240
 
241
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_event', 'espresso_events_restore_event', $item->ID() ) ) {
241
+		if (EE_Registry::instance()->CAP->current_user_can('ee_delete_event', 'espresso_events_restore_event', $item->ID())) {
242 242
 			$restore_event_query_args = array(
243 243
 					'action' => 'restore_event',
244 244
 					'EVT_ID' => $item->ID()
245 245
 				);
246
-			$restore_event_link = EE_Admin_Page::add_query_args_and_nonce( $restore_event_query_args, EVENTS_ADMIN_URL );
246
+			$restore_event_link = EE_Admin_Page::add_query_args_and_nonce($restore_event_query_args, EVENTS_ADMIN_URL);
247 247
 		}
248 248
 
249
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_event', 'espresso_events_delete_event', $item->ID() ) ) {
249
+		if (EE_Registry::instance()->CAP->current_user_can('ee_delete_event', 'espresso_events_delete_event', $item->ID())) {
250 250
 			$delete_event_query_args = array(
251 251
 					'action' => 'delete_event',
252 252
 					'EVT_ID' => $item->ID()
253 253
 				);
254
-			$delete_event_link = EE_Admin_Page::add_query_args_and_nonce( $delete_event_query_args, EVENTS_ADMIN_URL );
254
+			$delete_event_link = EE_Admin_Page::add_query_args_and_nonce($delete_event_query_args, EVENTS_ADMIN_URL);
255 255
 		}
256 256
 
257 257
 		$view_link = get_permalink($item->ID());
258 258
 
259
-		$actions['view'] = '<a href="' . $view_link . '" title="' . esc_attr__('View Event', 'event_espresso') . '">' . __('View', 'event_espresso') . '</a>';
259
+		$actions['view'] = '<a href="'.$view_link.'" title="'.esc_attr__('View Event', 'event_espresso').'">'.__('View', 'event_espresso').'</a>';
260 260
 
261
-		switch ( $item->get( 'status' ) ) {
261
+		switch ($item->get('status')) {
262 262
 			case 'trash' :
263
-					if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_event', 'espresso_events_restore_event', $item->ID() ) ) {
264
-						$actions['restore_from_trash'] = '<a href="' . $restore_event_link . '" title="' . esc_attr__('Restore from Trash', 'event_espresso') . '">' . __('Restore from Trash', 'event_espresso') . '</a>';
263
+					if (EE_Registry::instance()->CAP->current_user_can('ee_delete_event', 'espresso_events_restore_event', $item->ID())) {
264
+						$actions['restore_from_trash'] = '<a href="'.$restore_event_link.'" title="'.esc_attr__('Restore from Trash', 'event_espresso').'">'.__('Restore from Trash', 'event_espresso').'</a>';
265 265
 					}
266
-					if ( $item->count_related('Registration') === 0 && EE_Registry::instance()->CAP->current_user_can( 'ee_delete_event', 'espresso_events_delete_event', $item->ID() ) ) {
267
-						$actions['delete'] = '<a href="' . $delete_event_link . '" title="' . esc_attr__('Delete Permanently', 'event_espresso') . '">' . __('Delete Permanently', 'event_espresso') . '</a>';
266
+					if ($item->count_related('Registration') === 0 && EE_Registry::instance()->CAP->current_user_can('ee_delete_event', 'espresso_events_delete_event', $item->ID())) {
267
+						$actions['delete'] = '<a href="'.$delete_event_link.'" title="'.esc_attr__('Delete Permanently', 'event_espresso').'">'.__('Delete Permanently', 'event_espresso').'</a>';
268 268
 					}
269 269
 				break;
270 270
 			default :
271
-					if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_event', 'espresso_events_trash_event', $item->ID() ) ) {
272
-						$actions['move to trash'] = '<a href="' . $trash_event_link . '" title="' . esc_attr__('Trash Event', 'event_espresso') . '">' . __('Trash', 'event_espresso') . '</a>';
271
+					if (EE_Registry::instance()->CAP->current_user_can('ee_delete_event', 'espresso_events_trash_event', $item->ID())) {
272
+						$actions['move to trash'] = '<a href="'.$trash_event_link.'" title="'.esc_attr__('Trash Event', 'event_espresso').'">'.__('Trash', 'event_espresso').'</a>';
273 273
 					}
274 274
 		}
275 275
 		return $actions;
@@ -281,17 +281,17 @@  discard block
 block discarded – undo
281 281
 	 *
282 282
 	 * @return string
283 283
 	 */
284
-	public function column_author( EE_Event $item ) {
284
+	public function column_author(EE_Event $item) {
285 285
 		//user author info
286
-		$event_author = get_userdata( $item->wp_user() );
287
-		$gravatar = get_avatar( $item->wp_user(), '15' );
286
+		$event_author = get_userdata($item->wp_user());
287
+		$gravatar = get_avatar($item->wp_user(), '15');
288 288
 		//filter link
289 289
 		$query_args = array(
290 290
 			'action' => 'default',
291 291
 			'EVT_wp_user' => $item->wp_user()
292 292
 			);
293
-		$filter_url = EE_Admin_Page::add_query_args_and_nonce( $query_args, EVENTS_ADMIN_URL );
294
-		return $gravatar . '  <a href="' . $filter_url . '" title="' . esc_attr__('Click to filter events by this author.', 'event_espresso') . '">' . $event_author->display_name . '</a>';
293
+		$filter_url = EE_Admin_Page::add_query_args_and_nonce($query_args, EVENTS_ADMIN_URL);
294
+		return $gravatar.'  <a href="'.$filter_url.'" title="'.esc_attr__('Click to filter events by this author.', 'event_espresso').'">'.$event_author->display_name.'</a>';
295 295
 	}
296 296
 
297 297
 
@@ -300,9 +300,9 @@  discard block
 block discarded – undo
300 300
 	 *
301 301
 	 * @return string
302 302
 	 */
303
-	public function column_venue( EE_Event $item ) {
304
-		$venue = $item->get_first_related( 'Venue' );
305
-		return !empty( $venue ) ? $venue->name() : '';
303
+	public function column_venue(EE_Event $item) {
304
+		$venue = $item->get_first_related('Venue');
305
+		return ! empty($venue) ? $venue->name() : '';
306 306
 	}
307 307
 
308 308
 
@@ -311,10 +311,10 @@  discard block
 block discarded – undo
311 311
 	 *
312 312
 	 * @throws EE_Error
313 313
 	 */
314
-	public function column_start_date_time( EE_Event $item ) {
315
-		echo !empty( $this->_dtt ) ?  $this->_dtt->get_i18n_datetime('DTT_EVT_start') : __('No Date was saved for this Event', 'event_espresso');
314
+	public function column_start_date_time(EE_Event $item) {
315
+		echo ! empty($this->_dtt) ? $this->_dtt->get_i18n_datetime('DTT_EVT_start') : __('No Date was saved for this Event', 'event_espresso');
316 316
 		//display in user's timezone?
317
-		echo !empty( $this->_dtt ) ? $this->_dtt->display_in_my_timezone('DTT_EVT_start', 'get_i18n_datetime', '', 'My Timezone: ' ) : '';
317
+		echo ! empty($this->_dtt) ? $this->_dtt->display_in_my_timezone('DTT_EVT_start', 'get_i18n_datetime', '', 'My Timezone: ') : '';
318 318
 
319 319
 	}
320 320
 
@@ -324,11 +324,11 @@  discard block
 block discarded – undo
324 324
 	 *
325 325
 	 * @throws EE_Error
326 326
 	 */
327
-	public function column_reg_begins( EE_Event $item ) {
327
+	public function column_reg_begins(EE_Event $item) {
328 328
 		$reg_start = $item->get_ticket_with_earliest_start_time();
329
-		echo !empty( $reg_start ) ? $reg_start->get_i18n_datetime('TKT_start_date') : __('No Tickets have been setup for this Event', 'event_espresso');
329
+		echo ! empty($reg_start) ? $reg_start->get_i18n_datetime('TKT_start_date') : __('No Tickets have been setup for this Event', 'event_espresso');
330 330
 		//display in user's timezone?
331
-		echo !empty( $reg_start ) ? $reg_start->display_in_my_timezone('TKT_start_date', 'get_i18n_datetime', '', 'My Timezone: ' ) : '';/**/
331
+		echo ! empty($reg_start) ? $reg_start->display_in_my_timezone('TKT_start_date', 'get_i18n_datetime', '', 'My Timezone: ') : ''; /**/
332 332
 	}
333 333
 
334 334
 
@@ -337,14 +337,14 @@  discard block
 block discarded – undo
337 337
 	 *
338 338
 	 * @return int|string
339 339
 	 */
340
-	public function column_attendees( EE_Event $item ) {
340
+	public function column_attendees(EE_Event $item) {
341 341
 		$attendees_query_args = array(
342 342
 				'action' => 'default',
343 343
 				'event_id' => $item->ID()
344 344
 			);
345
-		$attendees_link = EE_Admin_Page::add_query_args_and_nonce( $attendees_query_args, REG_ADMIN_URL );
346
-		$registered_attendees = EEM_Registration::instance()->get_event_registration_count( $item->ID() );
347
-		return  EE_Registry::instance()->CAP->current_user_can( 'ee_read_registration', 'espresso_registrations_view_registration', $item->ID() ) ? '<a href="' . $attendees_link . '">' . $registered_attendees . '</a>' : $registered_attendees;
345
+		$attendees_link = EE_Admin_Page::add_query_args_and_nonce($attendees_query_args, REG_ADMIN_URL);
346
+		$registered_attendees = EEM_Registration::instance()->get_event_registration_count($item->ID());
347
+		return  EE_Registry::instance()->CAP->current_user_can('ee_read_registration', 'espresso_registrations_view_registration', $item->ID()) ? '<a href="'.$attendees_link.'">'.$registered_attendees.'</a>' : $registered_attendees;
348 348
 	}
349 349
 
350 350
 
@@ -353,8 +353,8 @@  discard block
 block discarded – undo
353 353
 	 *
354 354
 	 * @return float
355 355
 	 */
356
-	public function column_tkts_sold( EE_Event $item ) {
357
-		return EEM_Ticket::instance()->sum(array( array('Datetime.EVT_ID' => $item->ID() )), 'TKT_sold' );
356
+	public function column_tkts_sold(EE_Event $item) {
357
+		return EEM_Ticket::instance()->sum(array(array('Datetime.EVT_ID' => $item->ID())), 'TKT_sold');
358 358
 	}
359 359
 
360 360
 
@@ -363,38 +363,38 @@  discard block
 block discarded – undo
363 363
 	 *
364 364
 	 * @return string
365 365
 	 */
366
-	public function column_actions( EE_Event $item ) {
366
+	public function column_actions(EE_Event $item) {
367 367
 		//todo: remove when attendees is active
368
-		if ( !defined('REG_ADMIN_URL') )
368
+		if ( ! defined('REG_ADMIN_URL'))
369 369
 			define('REG_ADMIN_URL', EVENTS_ADMIN_URL);
370 370
 		$actionlinks = array();
371 371
 
372 372
 		$view_link = get_permalink($item->ID());
373 373
 
374
-		$actionlinks[] = '<a href="' .  $view_link . '" title="' . esc_attr__('View Event', 'event_espresso') . '" target="_blank">';
374
+		$actionlinks[] = '<a href="'.$view_link.'" title="'.esc_attr__('View Event', 'event_espresso').'" target="_blank">';
375 375
 		$actionlinks[] = '<div class="dashicons dashicons-search"></div></a>';
376 376
 
377
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_edit_event', 'espresso_events_edit', $item->ID() ) ) {
377
+		if (EE_Registry::instance()->CAP->current_user_can('ee_edit_event', 'espresso_events_edit', $item->ID())) {
378 378
 			$edit_query_args = array(
379 379
 					'action' => 'edit',
380 380
 					'post' => $item->ID()
381 381
 				);
382
-			$edit_link = EE_Admin_Page::add_query_args_and_nonce( $edit_query_args, EVENTS_ADMIN_URL );
383
-			$actionlinks[] = '<a href="' . $edit_link . '" title="' . esc_attr__('Edit Event', 'event_espresso') . '"><div class="ee-icon ee-icon-calendar-edit"></div></a>';
382
+			$edit_link = EE_Admin_Page::add_query_args_and_nonce($edit_query_args, EVENTS_ADMIN_URL);
383
+			$actionlinks[] = '<a href="'.$edit_link.'" title="'.esc_attr__('Edit Event', 'event_espresso').'"><div class="ee-icon ee-icon-calendar-edit"></div></a>';
384 384
 		}
385 385
 
386
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registration', 'espresso_registrations_view_registration', $item->ID() ) ) {
386
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_registration', 'espresso_registrations_view_registration', $item->ID())) {
387 387
 			$attendees_query_args = array(
388 388
 				'action' => 'default',
389 389
 				'event_id' => $item->ID()
390 390
 			);
391
-			$attendees_link = EE_Admin_Page::add_query_args_and_nonce( $attendees_query_args, REG_ADMIN_URL );
392
-			$actionlinks[] = '<a href="' . $attendees_link . '" title="' . esc_attr__('View Registrants', 'event_espresso') . '"><div class="dashicons dashicons-groups"></div></a>';
391
+			$attendees_link = EE_Admin_Page::add_query_args_and_nonce($attendees_query_args, REG_ADMIN_URL);
392
+			$actionlinks[] = '<a href="'.$attendees_link.'" title="'.esc_attr__('View Registrants', 'event_espresso').'"><div class="dashicons dashicons-groups"></div></a>';
393 393
 		}
394 394
 
395
-		$actionlinks = apply_filters( 'FHEE__Events_Admin_List_Table__column_actions__action_links', $actionlinks, $item );
395
+		$actionlinks = apply_filters('FHEE__Events_Admin_List_Table__column_actions__action_links', $actionlinks, $item);
396 396
 
397
-		return $this->_action_string( implode( "\n\t", $actionlinks ), $item, 'div' );
397
+		return $this->_action_string(implode("\n\t", $actionlinks), $item, 'div');
398 398
 	}
399 399
 
400 400
 
Please login to merge, or discard this patch.
admin_pages/transactions/Transactions_Admin_Page.core.php 3 patches
Doc Comments   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1455,7 +1455,7 @@  discard block
 block discarded – undo
1455 1455
 	 * @param  EE_Transaction $transaction
1456 1456
 	 * @param \EE_Payment $payment
1457 1457
 	 * @param array $REG_IDs
1458
-	 * @return bool
1458
+	 * @return boolean|null
1459 1459
 	 */
1460 1460
 	protected function _update_registration_payments( EE_Transaction $transaction, EE_Payment $payment, $REG_IDs = array() ) {
1461 1461
 		// we can pass our own custom set of registrations to EE_Payment_Processor::process_registration_payments()
@@ -1647,6 +1647,7 @@  discard block
 block discarded – undo
1647 1647
 	 *
1648 1648
 	 * @access protected
1649 1649
 	 * @param \EE_Payment | null $payment
1650
+	 * @param EE_Payment $payment
1650 1651
 	 */
1651 1652
 	protected function _maybe_send_notifications( $payment = null ) {
1652 1653
 		switch ( $payment instanceof EE_Payment ) {
Please login to merge, or discard this patch.
Spacing   +403 added lines, -403 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' => __('Add New Transaction', 'event_espresso'),
99 99
 				'edit' => __('Edit Transaction', 'event_espresso'),
100
-				'delete' => __('Delete Transaction','event_espresso'),
100
+				'delete' => __('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' => __('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,21 +237,21 @@  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' ] = __( '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' ] = __( '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;
251
+		EE_Registry::$i18n_js_strings['invalid_server_response'] = __('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'] = __('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 255
 	}
256 256
 	public function admin_notices() {}
257 257
 	public function admin_footer_scripts() {}
@@ -318,14 +318,14 @@  discard block
 block discarded – undo
318 318
 	 */
319 319
 	public function load_scripts_styles() {
320 320
 		//enqueue style
321
-		wp_register_style( 'espresso_txn', TXN_ASSETS_URL . 'espresso_transactions_admin.css', array(), EVENT_ESPRESSO_VERSION );
321
+		wp_register_style('espresso_txn', TXN_ASSETS_URL.'espresso_transactions_admin.css', array(), EVENT_ESPRESSO_VERSION);
322 322
 		wp_enqueue_style('espresso_txn');
323 323
 
324 324
 		//scripts
325 325
 		add_filter('FHEE_load_accounting_js', '__return_true');
326 326
 
327 327
 		//scripts
328
-		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);
328
+		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);
329 329
 		wp_enqueue_script('espresso_txn');
330 330
 
331 331
 	}
@@ -365,8 +365,8 @@  discard block
 block discarded – undo
365 365
 	 *	@return void
366 366
 	 */
367 367
 	protected function _set_list_table_views_default() {
368
-		$this->_views = array (
369
-			'all' => array (
368
+		$this->_views = array(
369
+			'all' => array(
370 370
 				'slug' 		=> 'all',
371 371
 				'label' 		=> __('View All Transactions', 'event_espresso'),
372 372
 				'count' 	=> 0
@@ -394,20 +394,20 @@  discard block
 block discarded – undo
394 394
 	 *	@return void
395 395
 	 */
396 396
 	private function _set_transaction_object() {
397
-		if ( is_object( $this->_transaction) )
397
+		if (is_object($this->_transaction))
398 398
 			return; //get out we've already set the object
399 399
 
400 400
 	    $TXN = EEM_Transaction::instance();
401 401
 
402
-	    $TXN_ID = ( ! empty( $this->_req_data['TXN_ID'] )) ? absint( $this->_req_data['TXN_ID'] ) : FALSE;
402
+	    $TXN_ID = ( ! empty($this->_req_data['TXN_ID'])) ? absint($this->_req_data['TXN_ID']) : FALSE;
403 403
 
404 404
 	    //get transaction object
405 405
 	    $this->_transaction = $TXN->get_one_by_ID($TXN_ID);
406
-	    $this->_session = !empty( $this->_transaction ) ? $this->_transaction->get('TXN_session_data') : NULL;
406
+	    $this->_session = ! empty($this->_transaction) ? $this->_transaction->get('TXN_session_data') : NULL;
407 407
 
408
-	 	if ( empty( $this->_transaction ) ) {
409
-	    	$error_msg = __('An error occurred and the details for Transaction ID #', 'event_espresso') . $TXN_ID .  __(' could not be retrieved.', 'event_espresso');
410
-			EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ );
408
+	 	if (empty($this->_transaction)) {
409
+	    	$error_msg = __('An error occurred and the details for Transaction ID #', 'event_espresso').$TXN_ID.__(' could not be retrieved.', 'event_espresso');
410
+			EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__);
411 411
 	    }
412 412
 	}
413 413
 
@@ -433,7 +433,7 @@  discard block
 block discarded – undo
433 433
 				),
434 434
 				'view_receipt' => array(
435 435
 					'class' => 'dashicons dashicons-media-default',
436
-					'desc' => __('View Transaction Receipt', 'event_espresso' )
436
+					'desc' => __('View Transaction Receipt', 'event_espresso')
437 437
 				),
438 438
 				'view_registration' => array(
439 439
 					'class' => 'dashicons dashicons-clipboard',
@@ -442,10 +442,10 @@  discard block
 block discarded – undo
442 442
 			)
443 443
 		);
444 444
 
445
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_transactions_send_payment_reminder' ) ) {
445
+		if (EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_transactions_send_payment_reminder')) {
446 446
 
447
-			EE_Registry::instance()->load_helper( 'MSG_Template' );
448
-			if ( EEH_MSG_Template::is_mt_active( 'payment_reminder' ) ) {
447
+			EE_Registry::instance()->load_helper('MSG_Template');
448
+			if (EEH_MSG_Template::is_mt_active('payment_reminder')) {
449 449
 				$items['send_payment_reminder'] = array(
450 450
 					'class' => 'dashicons dashicons-email-alt',
451 451
 					'desc' => __('Send Payment Reminder', 'event_espresso')
@@ -466,29 +466,29 @@  discard block
 block discarded – undo
466 466
 			'FHEE__Transactions_Admin_Page___transaction_legend_items__more_items',
467 467
 			array(
468 468
 				'overpaid'   => array(
469
-					'class' => 'ee-status-legend ee-status-legend-' . EEM_Transaction::overpaid_status_code,
470
-					'desc'  => EEH_Template::pretty_status( EEM_Transaction::overpaid_status_code, FALSE, 'sentence' )
469
+					'class' => 'ee-status-legend ee-status-legend-'.EEM_Transaction::overpaid_status_code,
470
+					'desc'  => EEH_Template::pretty_status(EEM_Transaction::overpaid_status_code, FALSE, 'sentence')
471 471
 				),
472 472
 				'complete'   => array(
473
-					'class' => 'ee-status-legend ee-status-legend-' . EEM_Transaction::complete_status_code,
474
-					'desc'  => EEH_Template::pretty_status( EEM_Transaction::complete_status_code, FALSE, 'sentence' )
473
+					'class' => 'ee-status-legend ee-status-legend-'.EEM_Transaction::complete_status_code,
474
+					'desc'  => EEH_Template::pretty_status(EEM_Transaction::complete_status_code, FALSE, 'sentence')
475 475
 				),
476 476
 				'incomplete' => array(
477
-					'class' => 'ee-status-legend ee-status-legend-' . EEM_Transaction::incomplete_status_code,
478
-					'desc'  => EEH_Template::pretty_status( EEM_Transaction::incomplete_status_code, FALSE, 'sentence' )
477
+					'class' => 'ee-status-legend ee-status-legend-'.EEM_Transaction::incomplete_status_code,
478
+					'desc'  => EEH_Template::pretty_status(EEM_Transaction::incomplete_status_code, FALSE, 'sentence')
479 479
 				),
480 480
 				'abandoned'  => array(
481
-					'class' => 'ee-status-legend ee-status-legend-' . EEM_Transaction::abandoned_status_code,
482
-					'desc'  => EEH_Template::pretty_status( EEM_Transaction::abandoned_status_code, FALSE, 'sentence' )
481
+					'class' => 'ee-status-legend ee-status-legend-'.EEM_Transaction::abandoned_status_code,
482
+					'desc'  => EEH_Template::pretty_status(EEM_Transaction::abandoned_status_code, FALSE, 'sentence')
483 483
 				),
484 484
 				'failed'     => array(
485
-					'class' => 'ee-status-legend ee-status-legend-' . EEM_Transaction::failed_status_code,
486
-					'desc'  => EEH_Template::pretty_status( EEM_Transaction::failed_status_code, FALSE, 'sentence' )
485
+					'class' => 'ee-status-legend ee-status-legend-'.EEM_Transaction::failed_status_code,
486
+					'desc'  => EEH_Template::pretty_status(EEM_Transaction::failed_status_code, FALSE, 'sentence')
487 487
 				)
488 488
 			)
489 489
 		);
490 490
 
491
-		return array_merge( $items, $more_items);
491
+		return array_merge($items, $more_items);
492 492
 	}
493 493
 
494 494
 
@@ -501,9 +501,9 @@  discard block
 block discarded – undo
501 501
 	 */
502 502
 	protected function _transactions_overview_list_table() {
503 503
 		$this->_admin_page_title = __('Transactions', 'event_espresso');
504
-		$event = isset($this->_req_data['EVT_ID']) ? EEM_Event::instance()->get_one_by_ID($this->_req_data['EVT_ID'] ) : NULL;
505
-		$this->_template_args['admin_page_header'] = $event instanceof EE_Event ? sprintf( __('%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>' ) : '';
506
-		$this->_template_args['after_list_table'] = $this->_display_legend( $this->_transaction_legend_items() );
504
+		$event = isset($this->_req_data['EVT_ID']) ? EEM_Event::instance()->get_one_by_ID($this->_req_data['EVT_ID']) : NULL;
505
+		$this->_template_args['admin_page_header'] = $event instanceof EE_Event ? sprintf(__('%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>') : '';
506
+		$this->_template_args['after_list_table'] = $this->_display_legend($this->_transaction_legend_items());
507 507
 		$this->display_admin_list_table_page_with_no_sidebar();
508 508
 	}
509 509
 
@@ -517,8 +517,8 @@  discard block
 block discarded – undo
517 517
 	*	@return void
518 518
 	*/
519 519
 	protected function _transaction_details() {
520
-		do_action( 'AHEE__Transactions_Admin_Page__transaction_details__start', $this->_transaction );
521
-		EE_Registry::instance()->load_helper( 'MSG_Template' );
520
+		do_action('AHEE__Transactions_Admin_Page__transaction_details__start', $this->_transaction);
521
+		EE_Registry::instance()->load_helper('MSG_Template');
522 522
 
523 523
 		$this->_set_transaction_status_array();
524 524
 
@@ -531,14 +531,14 @@  discard block
 block discarded – undo
531 531
 		$attendee = $primary_registration instanceof EE_Registration ? $primary_registration->attendee() : NULL;
532 532
 
533 533
 		$this->_template_args['txn_nmbr']['value'] = $this->_transaction->ID();
534
-		$this->_template_args['txn_nmbr']['label'] = __( 'Transaction Number', 'event_espresso' );
534
+		$this->_template_args['txn_nmbr']['label'] = __('Transaction Number', 'event_espresso');
535 535
 
536
-		$this->_template_args['txn_datetime']['value'] = $this->_transaction->get_datetime('TXN_timestamp', 'l F j, Y', 'g:i:s a' );
537
-		$this->_template_args['txn_datetime']['label'] = __( 'Date', 'event_espresso' );
536
+		$this->_template_args['txn_datetime']['value'] = $this->_transaction->get_datetime('TXN_timestamp', 'l F j, Y', 'g:i:s a');
537
+		$this->_template_args['txn_datetime']['label'] = __('Date', 'event_espresso');
538 538
 
539
-		$this->_template_args['txn_status']['value'] = self::$_txn_status[ $this->_transaction->get('STS_ID') ];
540
-		$this->_template_args['txn_status']['label'] = __( 'Transaction Status', 'event_espresso' );
541
-		$this->_template_args['txn_status']['class'] = 'status-' . $this->_transaction->get('STS_ID');
539
+		$this->_template_args['txn_status']['value'] = self::$_txn_status[$this->_transaction->get('STS_ID')];
540
+		$this->_template_args['txn_status']['label'] = __('Transaction Status', 'event_espresso');
541
+		$this->_template_args['txn_status']['class'] = 'status-'.$this->_transaction->get('STS_ID');
542 542
 
543 543
 		$this->_template_args['grand_total'] = $this->_transaction->get('TXN_total');
544 544
 		$this->_template_args['total_paid'] = $this->_transaction->get('TXN_paid');
@@ -550,9 +550,9 @@  discard block
 block discarded – undo
550 550
 				'espresso_transactions_send_payment_reminder'
551 551
 			)
552 552
 		) {
553
-			EE_Registry::instance()->load_helper( 'MSG_Template' );
553
+			EE_Registry::instance()->load_helper('MSG_Template');
554 554
 			$this->_template_args['send_payment_reminder_button'] =
555
-				EEH_MSG_Template::is_mt_active( 'payment_reminder' )
555
+				EEH_MSG_Template::is_mt_active('payment_reminder')
556 556
 				&& $this->_transaction->get('STS_ID') != EEM_Transaction::complete_status_code
557 557
 				&& $this->_transaction->get('STS_ID') != EEM_Transaction::overpaid_status_code
558 558
 					? EEH_Template::get_button_or_link(
@@ -574,40 +574,40 @@  discard block
 block discarded – undo
574 574
 		}
575 575
 
576 576
 		$amount_due = $this->_transaction->get('TXN_total') - $this->_transaction->get('TXN_paid');
577
-		$this->_template_args['amount_due'] = EEH_Template::format_currency( $amount_due, TRUE );
578
-		if ( EE_Registry::instance()->CFG->currency->sign_b4 ) {
579
-			$this->_template_args['amount_due'] = EE_Registry::instance()->CFG->currency->sign . $this->_template_args['amount_due'];
577
+		$this->_template_args['amount_due'] = EEH_Template::format_currency($amount_due, TRUE);
578
+		if (EE_Registry::instance()->CFG->currency->sign_b4) {
579
+			$this->_template_args['amount_due'] = EE_Registry::instance()->CFG->currency->sign.$this->_template_args['amount_due'];
580 580
 		} else {
581
-			$this->_template_args['amount_due'] = $this->_template_args['amount_due'] . EE_Registry::instance()->CFG->currency->sign;
581
+			$this->_template_args['amount_due'] = $this->_template_args['amount_due'].EE_Registry::instance()->CFG->currency->sign;
582 582
 		}
583
-		$this->_template_args['amount_due_class'] =  '';
583
+		$this->_template_args['amount_due_class'] = '';
584 584
 
585
-		if ( $this->_transaction->get('TXN_paid') == $this->_transaction->get('TXN_total') ) {
585
+		if ($this->_transaction->get('TXN_paid') == $this->_transaction->get('TXN_total')) {
586 586
 			// paid in full
587
-			$this->_template_args['amount_due'] =  FALSE;
588
-		} elseif ( $this->_transaction->get('TXN_paid') > $this->_transaction->get('TXN_total') ) {
587
+			$this->_template_args['amount_due'] = FALSE;
588
+		} elseif ($this->_transaction->get('TXN_paid') > $this->_transaction->get('TXN_total')) {
589 589
 			// overpaid
590
-			$this->_template_args['amount_due_class'] =  'txn-overview-no-payment-spn';
591
-		} elseif (( $this->_transaction->get('TXN_total') > 0 ) && ( $this->_transaction->get('TXN_paid') > 0 )) {
590
+			$this->_template_args['amount_due_class'] = 'txn-overview-no-payment-spn';
591
+		} elseif (($this->_transaction->get('TXN_total') > 0) && ($this->_transaction->get('TXN_paid') > 0)) {
592 592
 			// monies owing
593
-			$this->_template_args['amount_due_class'] =  'txn-overview-part-payment-spn';
594
-		} elseif (( $this->_transaction->get('TXN_total') > 0 ) && ( $this->_transaction->get('TXN_paid') == 0 )) {
593
+			$this->_template_args['amount_due_class'] = 'txn-overview-part-payment-spn';
594
+		} elseif (($this->_transaction->get('TXN_total') > 0) && ($this->_transaction->get('TXN_paid') == 0)) {
595 595
 			// no payments made yet
596
-			$this->_template_args['amount_due_class'] =  'txn-overview-no-payment-spn';
597
-		} elseif ( $this->_transaction->get('TXN_total') == 0 ) {
596
+			$this->_template_args['amount_due_class'] = 'txn-overview-no-payment-spn';
597
+		} elseif ($this->_transaction->get('TXN_total') == 0) {
598 598
 			// free event
599
-			$this->_template_args['amount_due'] =  FALSE;
599
+			$this->_template_args['amount_due'] = FALSE;
600 600
 		}
601 601
 
602 602
 		$payment_method = $this->_transaction->payment_method();
603 603
 
604 604
 		$this->_template_args['method_of_payment_name'] = $payment_method instanceof EE_Payment_Method
605 605
 			? $payment_method->admin_name()
606
-			: __( 'Unknown', 'event_espresso' );
606
+			: __('Unknown', 'event_espresso');
607 607
 
608 608
 		$this->_template_args['currency_sign'] = EE_Registry::instance()->CFG->currency->sign;
609 609
 		// link back to overview
610
-		$this->_template_args['txn_overview_url'] = ! empty ( $_SERVER['HTTP_REFERER'] )
610
+		$this->_template_args['txn_overview_url'] = ! empty ($_SERVER['HTTP_REFERER'])
611 611
 			? $_SERVER['HTTP_REFERER']
612 612
 			: TXN_ADMIN_URL;
613 613
 
@@ -615,13 +615,13 @@  discard block
 block discarded – undo
615 615
 		// next link
616 616
 		$next_txn = $this->_transaction->next(
617 617
 			null,
618
-			array( array( 'STS_ID' => array( '!=', EEM_Transaction::failed_status_code ) ) ),
618
+			array(array('STS_ID' => array('!=', EEM_Transaction::failed_status_code))),
619 619
 			'TXN_ID'
620 620
 		);
621 621
 		$this->_template_args['next_transaction'] = $next_txn
622 622
 			? $this->_next_link(
623 623
 				EE_Admin_Page::add_query_args_and_nonce(
624
-					array( 'action' => 'view_transaction', 'TXN_ID' => $next_txn['TXN_ID'] ),
624
+					array('action' => 'view_transaction', 'TXN_ID' => $next_txn['TXN_ID']),
625 625
 					TXN_ADMIN_URL
626 626
 				),
627 627
 				'dashicons dashicons-arrow-right ee-icon-size-22'
@@ -630,13 +630,13 @@  discard block
 block discarded – undo
630 630
 		// previous link
631 631
 		$previous_txn = $this->_transaction->previous(
632 632
 			null,
633
-			array( array( 'STS_ID' => array( '!=', EEM_Transaction::failed_status_code ) ) ),
633
+			array(array('STS_ID' => array('!=', EEM_Transaction::failed_status_code))),
634 634
 			'TXN_ID'
635 635
 		);
636 636
 		$this->_template_args['previous_transaction'] = $previous_txn
637 637
 			? $this->_previous_link(
638 638
 				EE_Admin_Page::add_query_args_and_nonce(
639
-					array( 'action' => 'view_transaction', 'TXN_ID' => $previous_txn['TXN_ID'] ),
639
+					array('action' => 'view_transaction', 'TXN_ID' => $previous_txn['TXN_ID']),
640 640
 					TXN_ADMIN_URL
641 641
 				),
642 642
 				'dashicons dashicons-arrow-left ee-icon-size-22'
@@ -646,16 +646,16 @@  discard block
 block discarded – undo
646 646
 		// were we just redirected here after adding a new registration ???
647 647
 		if (
648 648
 			isset(
649
-				$this->_req_data[ 'redirect_from' ],
650
-				$this->_req_data[ 'EVT_ID' ],
651
-				$this->_req_data[ 'event_name' ]
649
+				$this->_req_data['redirect_from'],
650
+				$this->_req_data['EVT_ID'],
651
+				$this->_req_data['event_name']
652 652
 			)
653 653
 		) {
654 654
 			if (
655 655
 				EE_Registry::instance()->CAP->current_user_can(
656 656
 					'ee_edit_registrations',
657 657
 					'espresso_registrations_new_registration',
658
-					$this->_req_data[ 'EVT_ID' ]
658
+					$this->_req_data['EVT_ID']
659 659
 				)
660 660
 			) {
661 661
 				$this->_admin_page_title .= '<a id="add-new-registration" class="add-new-h2 button-primary" href="';
@@ -665,7 +665,7 @@  discard block
 block discarded – undo
665 665
 						'action'   => 'new_registration',
666 666
 						'return'   => 'default',
667 667
 						'TXN_ID'   => $this->_transaction->ID(),
668
-						'event_id' => $this->_req_data[ 'EVT_ID' ],
668
+						'event_id' => $this->_req_data['EVT_ID'],
669 669
 					),
670 670
 					REG_ADMIN_URL
671 671
 				);
@@ -673,17 +673,17 @@  discard block
 block discarded – undo
673 673
 
674 674
 				$this->_admin_page_title .= sprintf(
675 675
 					__('Add Another New Registration to Event: "%1$s" ?'),
676
-					htmlentities( urldecode( $this->_req_data[ 'event_name' ] ), ENT_QUOTES, 'UTF-8' )
676
+					htmlentities(urldecode($this->_req_data['event_name']), ENT_QUOTES, 'UTF-8')
677 677
 				);
678 678
 				$this->_admin_page_title .= '</a>';
679 679
 			}
680
-			EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ );
680
+			EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__);
681 681
 		}
682 682
 		// grab messages at the last second
683 683
 		$this->_template_args['notices'] = EE_Error::get_notices();
684 684
 		// path to template
685
-		$template_path = TXN_TEMPLATE_PATH . 'txn_admin_details_header.template.php';
686
-		$this->_template_args['admin_page_header'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
685
+		$template_path = TXN_TEMPLATE_PATH.'txn_admin_details_header.template.php';
686
+		$this->_template_args['admin_page_header'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE);
687 687
 
688 688
 		// the details template wrapper
689 689
 		$this->display_admin_page_with_sidebar();
@@ -702,18 +702,18 @@  discard block
 block discarded – undo
702 702
 
703 703
 		$this->_set_transaction_object();
704 704
 
705
-		add_meta_box( 'edit-txn-details-mbox', __( 'Transaction Details', 'event_espresso' ), array( $this, 'txn_details_meta_box' ), $this->_wp_page_slug, 'normal', 'high' );
705
+		add_meta_box('edit-txn-details-mbox', __('Transaction Details', 'event_espresso'), array($this, 'txn_details_meta_box'), $this->_wp_page_slug, 'normal', 'high');
706 706
 		add_meta_box(
707 707
 			'edit-txn-attendees-mbox',
708
-			__( 'Attendees Registered in this Transaction', 'event_espresso' ),
709
-			array( $this, 'txn_attendees_meta_box' ),
708
+			__('Attendees Registered in this Transaction', 'event_espresso'),
709
+			array($this, 'txn_attendees_meta_box'),
710 710
 			$this->_wp_page_slug,
711 711
 			'normal',
712 712
 			'high',
713
-			array( 'TXN_ID' => $this->_transaction->ID() )
713
+			array('TXN_ID' => $this->_transaction->ID())
714 714
 		);
715
-		add_meta_box( 'edit-txn-registrant-mbox', __( 'Primary Contact', 'event_espresso' ), array( $this, 'txn_registrant_side_meta_box' ), $this->_wp_page_slug, 'side', 'high' );
716
-		add_meta_box( 'edit-txn-billing-info-mbox', __( 'Billing Information', 'event_espresso' ), array( $this, 'txn_billing_info_side_meta_box' ), $this->_wp_page_slug, 'side', 'high' );
715
+		add_meta_box('edit-txn-registrant-mbox', __('Primary Contact', 'event_espresso'), array($this, 'txn_registrant_side_meta_box'), $this->_wp_page_slug, 'side', 'high');
716
+		add_meta_box('edit-txn-billing-info-mbox', __('Billing Information', 'event_espresso'), array($this, 'txn_billing_info_side_meta_box'), $this->_wp_page_slug, 'side', 'high');
717 717
 
718 718
 	}
719 719
 
@@ -734,15 +734,15 @@  discard block
 block discarded – undo
734 734
 
735 735
 		//get line table
736 736
 		EEH_Autoloader::register_line_item_display_autoloaders();
737
-		$Line_Item_Display = new EE_Line_Item_Display( 'admin_table', 'EE_Admin_Table_Line_Item_Display_Strategy' );
738
-		$this->_template_args['line_item_table'] = $Line_Item_Display->display_line_item( $this->_transaction->total_line_item() );
737
+		$Line_Item_Display = new EE_Line_Item_Display('admin_table', 'EE_Admin_Table_Line_Item_Display_Strategy');
738
+		$this->_template_args['line_item_table'] = $Line_Item_Display->display_line_item($this->_transaction->total_line_item());
739 739
 		$this->_template_args['REG_code'] = $this->_transaction->get_first_related('Registration')->get('REG_code');
740 740
 
741 741
 		// process taxes
742
-		$taxes = $this->_transaction->get_many_related( 'Line_Item', array( array( 'LIN_type' => EEM_Line_Item::type_tax )));
743
-		$this->_template_args['taxes'] = ! empty( $taxes ) ? $taxes : FALSE;
742
+		$taxes = $this->_transaction->get_many_related('Line_Item', array(array('LIN_type' => EEM_Line_Item::type_tax)));
743
+		$this->_template_args['taxes'] = ! empty($taxes) ? $taxes : FALSE;
744 744
 
745
-		$this->_template_args['grand_total'] = EEH_Template::format_currency($this->_transaction->get('TXN_total'), FALSE, FALSE );
745
+		$this->_template_args['grand_total'] = EEH_Template::format_currency($this->_transaction->get('TXN_total'), FALSE, FALSE);
746 746
 		$this->_template_args['grand_raw_total'] = $this->_transaction->get('TXN_total');
747 747
 		$this->_template_args['TXN_status'] = $this->_transaction->get('STS_ID');
748 748
 
@@ -750,63 +750,63 @@  discard block
 block discarded – undo
750 750
 
751 751
 		// process payment details
752 752
 		$payments = $this->_transaction->get_many_related('Payment');
753
-		if( ! empty(  $payments ) ) {
754
-			$this->_template_args[ 'payments' ] = $payments;
755
-			$this->_template_args[ 'existing_reg_payments' ] = $this->_get_registration_payment_IDs( $payments );
753
+		if ( ! empty($payments)) {
754
+			$this->_template_args['payments'] = $payments;
755
+			$this->_template_args['existing_reg_payments'] = $this->_get_registration_payment_IDs($payments);
756 756
 		} else {
757
-			$this->_template_args[ 'payments' ] = false;
758
-			$this->_template_args[ 'existing_reg_payments' ] = array();
757
+			$this->_template_args['payments'] = false;
758
+			$this->_template_args['existing_reg_payments'] = array();
759 759
 		}
760 760
 
761
-		$this->_template_args['edit_payment_url'] = add_query_arg( array( 'action' => 'edit_payment'  ), TXN_ADMIN_URL );
762
-		$this->_template_args['delete_payment_url'] = add_query_arg( array( 'action' => 'espresso_delete_payment' ), TXN_ADMIN_URL );
761
+		$this->_template_args['edit_payment_url'] = add_query_arg(array('action' => 'edit_payment'), TXN_ADMIN_URL);
762
+		$this->_template_args['delete_payment_url'] = add_query_arg(array('action' => 'espresso_delete_payment'), TXN_ADMIN_URL);
763 763
 
764
-		if ( isset( $txn_details['invoice_number'] )) {
764
+		if (isset($txn_details['invoice_number'])) {
765 765
 			$this->_template_args['txn_details']['invoice_number']['value'] = $this->_template_args['REG_code'];
766
-			$this->_template_args['txn_details']['invoice_number']['label'] = __( 'Invoice Number', 'event_espresso' );
766
+			$this->_template_args['txn_details']['invoice_number']['label'] = __('Invoice Number', 'event_espresso');
767 767
 		}
768 768
 
769 769
 		$this->_template_args['txn_details']['registration_session']['value'] = $this->_transaction->get_first_related('Registration')->get('REG_session');
770
-		$this->_template_args['txn_details']['registration_session']['label'] = __( 'Registration Session', 'event_espresso' );
770
+		$this->_template_args['txn_details']['registration_session']['label'] = __('Registration Session', 'event_espresso');
771 771
 
772
-		$this->_template_args['txn_details']['ip_address']['value'] = isset( $this->_session['ip_address'] ) ? $this->_session['ip_address'] : '';
773
-		$this->_template_args['txn_details']['ip_address']['label'] = __( 'Transaction placed from IP', 'event_espresso' );
772
+		$this->_template_args['txn_details']['ip_address']['value'] = isset($this->_session['ip_address']) ? $this->_session['ip_address'] : '';
773
+		$this->_template_args['txn_details']['ip_address']['label'] = __('Transaction placed from IP', 'event_espresso');
774 774
 
775
-		$this->_template_args['txn_details']['user_agent']['value'] = isset( $this->_session['user_agent'] ) ? $this->_session['user_agent'] : '';
776
-		$this->_template_args['txn_details']['user_agent']['label'] = __( 'Registrant User Agent', 'event_espresso' );
775
+		$this->_template_args['txn_details']['user_agent']['value'] = isset($this->_session['user_agent']) ? $this->_session['user_agent'] : '';
776
+		$this->_template_args['txn_details']['user_agent']['label'] = __('Registrant User Agent', 'event_espresso');
777 777
 
778 778
 		$reg_steps = '<ul>';
779
-		foreach ( $this->_transaction->reg_steps() as $reg_step => $reg_step_status ) {
780
-			if ( $reg_step_status === true ) {
781
-				$reg_steps .= '<li style="color:#70cc50">' . sprintf( __( '%1$s : Completed', 'event_espresso' ), ucwords( str_replace( '_', ' ', $reg_step ) ) ) . '</li>';
782
-			} else if ( is_numeric( $reg_step_status ) && $reg_step_status !== false ) {
783
-					$reg_steps .= '<li style="color:#2EA2CC">' . sprintf(
784
-							__( '%1$s : Initiated %2$s', 'event_espresso' ),
785
-							ucwords( str_replace( '_', ' ', $reg_step ) ),
786
-							gmdate( get_option( 'date_format' ) . ' ' . get_option( 'time_format' ), ( $reg_step_status + ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS ) ) )
787
-						) . '</li>';
779
+		foreach ($this->_transaction->reg_steps() as $reg_step => $reg_step_status) {
780
+			if ($reg_step_status === true) {
781
+				$reg_steps .= '<li style="color:#70cc50">'.sprintf(__('%1$s : Completed', 'event_espresso'), ucwords(str_replace('_', ' ', $reg_step))).'</li>';
782
+			} else if (is_numeric($reg_step_status) && $reg_step_status !== false) {
783
+					$reg_steps .= '<li style="color:#2EA2CC">'.sprintf(
784
+							__('%1$s : Initiated %2$s', 'event_espresso'),
785
+							ucwords(str_replace('_', ' ', $reg_step)),
786
+							gmdate(get_option('date_format').' '.get_option('time_format'), ($reg_step_status + (get_option('gmt_offset') * HOUR_IN_SECONDS)))
787
+						).'</li>';
788 788
 				} else {
789
-				$reg_steps .= '<li style="color:#E76700">' . sprintf( __( '%1$s : Never Initiated', 'event_espresso' ), ucwords( str_replace( '_', ' ', $reg_step ) ) ) . '</li>';
789
+				$reg_steps .= '<li style="color:#E76700">'.sprintf(__('%1$s : Never Initiated', 'event_espresso'), ucwords(str_replace('_', ' ', $reg_step))).'</li>';
790 790
 			}
791 791
 		}
792 792
 		$reg_steps .= '</ul>';
793 793
 		$this->_template_args['txn_details']['reg_steps']['value'] = $reg_steps;
794
-		$this->_template_args['txn_details']['reg_steps']['label'] = __( 'Registration Step Progress', 'event_espresso' );
794
+		$this->_template_args['txn_details']['reg_steps']['label'] = __('Registration Step Progress', 'event_espresso');
795 795
 
796 796
 
797 797
 		$this->_get_registrations_to_apply_payment_to();
798
-		$this->_get_payment_methods( $payments );
798
+		$this->_get_payment_methods($payments);
799 799
 		$this->_get_payment_status_array();
800 800
 		$this->_get_reg_status_selection(); //sets up the template args for the reg status array for the transaction.
801 801
 
802
-		$this->_template_args['transaction_form_url'] = add_query_arg( array( 'action' => 'edit_transaction', 'process' => 'transaction'  ), TXN_ADMIN_URL );
803
-		$this->_template_args['apply_payment_form_url'] = add_query_arg( array( 'page' => 'espresso_transactions', 'action' => 'espresso_apply_payment' ), WP_AJAX_URL );
804
-		$this->_template_args['delete_payment_form_url'] = add_query_arg( array( 'page' => 'espresso_transactions', 'action' => 'espresso_delete_payment' ), WP_AJAX_URL );
802
+		$this->_template_args['transaction_form_url'] = add_query_arg(array('action' => 'edit_transaction', 'process' => 'transaction'), TXN_ADMIN_URL);
803
+		$this->_template_args['apply_payment_form_url'] = add_query_arg(array('page' => 'espresso_transactions', 'action' => 'espresso_apply_payment'), WP_AJAX_URL);
804
+		$this->_template_args['delete_payment_form_url'] = add_query_arg(array('page' => 'espresso_transactions', 'action' => 'espresso_delete_payment'), WP_AJAX_URL);
805 805
 
806 806
 		// 'espresso_delete_payment_nonce'
807 807
 
808
-		$template_path = TXN_TEMPLATE_PATH . 'txn_admin_details_main_meta_box_txn_details.template.php';
809
-		echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
808
+		$template_path = TXN_TEMPLATE_PATH.'txn_admin_details_main_meta_box_txn_details.template.php';
809
+		echo EEH_Template::display_template($template_path, $this->_template_args, TRUE);
810 810
 
811 811
 	}
812 812
 
@@ -821,27 +821,27 @@  discard block
 block discarded – undo
821 821
 	 * @param EE_Payment[] $payments
822 822
 	 * @return array
823 823
 	 */
824
-	protected function _get_registration_payment_IDs( $payments = array() ) {
824
+	protected function _get_registration_payment_IDs($payments = array()) {
825 825
 		$existing_reg_payments = array();
826 826
 		// get all reg payments for these payments
827
-		$reg_payments = EEM_Registration_Payment::instance()->get_all( array(
827
+		$reg_payments = EEM_Registration_Payment::instance()->get_all(array(
828 828
 			array(
829 829
 				'PAY_ID' => array(
830 830
 					'IN',
831
-					array_keys( $payments )
831
+					array_keys($payments)
832 832
 				)
833 833
 			)
834
-		) );
835
-		if ( ! empty( $reg_payments ) ) {
836
-			foreach ( $payments as $payment ) {
837
-				if ( ! $payment instanceof EE_Payment ) {
834
+		));
835
+		if ( ! empty($reg_payments)) {
836
+			foreach ($payments as $payment) {
837
+				if ( ! $payment instanceof EE_Payment) {
838 838
 					continue;
839
-				} else if ( ! isset( $existing_reg_payments[ $payment->ID() ] ) ) {
840
-					$existing_reg_payments[ $payment->ID() ] = array();
839
+				} else if ( ! isset($existing_reg_payments[$payment->ID()])) {
840
+					$existing_reg_payments[$payment->ID()] = array();
841 841
 				}
842
-				foreach ( $reg_payments as $reg_payment ) {
843
-					if ( $reg_payment instanceof EE_Registration_Payment && $reg_payment->payment_ID() === $payment->ID() ) {
844
-						$existing_reg_payments[ $payment->ID() ][ ] = $reg_payment->registration_ID();
842
+				foreach ($reg_payments as $reg_payment) {
843
+					if ($reg_payment instanceof EE_Registration_Payment && $reg_payment->payment_ID() === $payment->ID()) {
844
+						$existing_reg_payments[$payment->ID()][] = $reg_payment->registration_ID();
845 845
 					}
846 846
 				}
847 847
 			}
@@ -878,39 +878,39 @@  discard block
 block discarded – undo
878 878
 		$registrations_to_apply_payment_to .= '<br /><div class="admin-primary-mbox-tbl-wrap">';
879 879
 		$registrations_to_apply_payment_to .= '<table class="admin-primary-mbox-tbl">';
880 880
 		$registrations_to_apply_payment_to .= '<thead><tr>';
881
-		$registrations_to_apply_payment_to .= '<td>' . __( 'ID', 'event_espresso' ) . '</td>';
882
-		$registrations_to_apply_payment_to .= '<td>' . __( 'Registrant', 'event_espresso' ) . '</td>';
883
-		$registrations_to_apply_payment_to .= '<td>' . __( 'Ticket', 'event_espresso' ) . '</td>';
884
-		$registrations_to_apply_payment_to .= '<td>' . __( 'Event', 'event_espresso' ) . '</td>';
885
-		$registrations_to_apply_payment_to .= '<td class="txn-admin-payment-paid-td jst-cntr">' . __( 'Paid', 'event_espresso' ) . '</td>';
886
-		$registrations_to_apply_payment_to .= '<td class="txn-admin-payment-owing-td jst-cntr">' . __( 'Owing', 'event_espresso' ) . '</td>';
887
-		$registrations_to_apply_payment_to .= '<td class="jst-cntr">' . __( 'Apply', 'event_espresso' ) . '</td>';
881
+		$registrations_to_apply_payment_to .= '<td>'.__('ID', 'event_espresso').'</td>';
882
+		$registrations_to_apply_payment_to .= '<td>'.__('Registrant', 'event_espresso').'</td>';
883
+		$registrations_to_apply_payment_to .= '<td>'.__('Ticket', 'event_espresso').'</td>';
884
+		$registrations_to_apply_payment_to .= '<td>'.__('Event', 'event_espresso').'</td>';
885
+		$registrations_to_apply_payment_to .= '<td class="txn-admin-payment-paid-td jst-cntr">'.__('Paid', 'event_espresso').'</td>';
886
+		$registrations_to_apply_payment_to .= '<td class="txn-admin-payment-owing-td jst-cntr">'.__('Owing', 'event_espresso').'</td>';
887
+		$registrations_to_apply_payment_to .= '<td class="jst-cntr">'.__('Apply', 'event_espresso').'</td>';
888 888
 		$registrations_to_apply_payment_to .= '</tr></thead><tbody>';
889 889
 		// get registrations for TXN
890
-		$registrations = $this->_transaction->registrations( $query_params );
891
-		foreach ( $registrations as $registration ) {
892
-			if ( $registration instanceof EE_Registration ) {
890
+		$registrations = $this->_transaction->registrations($query_params);
891
+		foreach ($registrations as $registration) {
892
+			if ($registration instanceof EE_Registration) {
893 893
 				$owing = $registration->final_price() - $registration->paid();
894
-				$taxable = $registration->ticket()->taxable() ? ' <span class="smaller-text lt-grey-text"> ' . __( '+ tax', 'event_espresso' ) . '</span>' : '';
895
-				$checked = empty( $existing_reg_payments ) || in_array( $registration->ID(), $existing_reg_payments ) ? ' checked="checked"' : '';
896
-				$registrations_to_apply_payment_to .= '<tr id="apply-payment-registration-row-' . $registration->ID() . '">';
894
+				$taxable = $registration->ticket()->taxable() ? ' <span class="smaller-text lt-grey-text"> '.__('+ tax', 'event_espresso').'</span>' : '';
895
+				$checked = empty($existing_reg_payments) || in_array($registration->ID(), $existing_reg_payments) ? ' checked="checked"' : '';
896
+				$registrations_to_apply_payment_to .= '<tr id="apply-payment-registration-row-'.$registration->ID().'">';
897 897
 				// add html for checkbox input and label
898
-				$registrations_to_apply_payment_to .= '<td>' . $registration->ID() . '</td>';
899
-				$registrations_to_apply_payment_to .= '<td>' . $registration->attendee() instanceof EE_Attendee ? $registration->attendee()->full_name() : __( 'Unknown Attendee', 'event_espresso' ) . '</td>';
900
-				$registrations_to_apply_payment_to .= '<td>' . $registration->ticket()->name() . ' : ' . $registration->ticket()->pretty_price() . $taxable . '</td>';
901
-				$registrations_to_apply_payment_to .= '<td>' . $registration->event_name() . '</td>';
902
-				$registrations_to_apply_payment_to .= '<td class="txn-admin-payment-paid-td jst-rght">' . $registration->pretty_paid() . '</td>';
903
-				$registrations_to_apply_payment_to .= '<td class="txn-admin-payment-owing-td jst-rght">' . EEH_Template::format_currency( $owing ) . '</td>';
898
+				$registrations_to_apply_payment_to .= '<td>'.$registration->ID().'</td>';
899
+				$registrations_to_apply_payment_to .= '<td>'.$registration->attendee() instanceof EE_Attendee ? $registration->attendee()->full_name() : __('Unknown Attendee', 'event_espresso').'</td>';
900
+				$registrations_to_apply_payment_to .= '<td>'.$registration->ticket()->name().' : '.$registration->ticket()->pretty_price().$taxable.'</td>';
901
+				$registrations_to_apply_payment_to .= '<td>'.$registration->event_name().'</td>';
902
+				$registrations_to_apply_payment_to .= '<td class="txn-admin-payment-paid-td jst-rght">'.$registration->pretty_paid().'</td>';
903
+				$registrations_to_apply_payment_to .= '<td class="txn-admin-payment-owing-td jst-rght">'.EEH_Template::format_currency($owing).'</td>';
904 904
 				$registrations_to_apply_payment_to .= '<td class="jst-cntr">';
905 905
 				$disabled = $registration->final_price() > 0 ? '' : ' disabled';
906
-				$registrations_to_apply_payment_to .= '<input type="checkbox" value="' . $registration->ID() . '" name="txn_admin_payment[registrations]"' . $checked . $disabled . '>';
906
+				$registrations_to_apply_payment_to .= '<input type="checkbox" value="'.$registration->ID().'" name="txn_admin_payment[registrations]"'.$checked.$disabled.'>';
907 907
 				$registrations_to_apply_payment_to .= '</td>';
908 908
 				$registrations_to_apply_payment_to .= '</tr>';
909 909
 			}
910 910
 		}
911 911
 		$registrations_to_apply_payment_to .= '</tbody></table></div>';
912
-		$registrations_to_apply_payment_to .= '<p class="clear description">' . __( '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>';
913
-		$this->_template_args[ 'registrations_to_apply_payment_to' ] = $registrations_to_apply_payment_to;
912
+		$registrations_to_apply_payment_to .= '<p class="clear description">'.__('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>';
913
+		$this->_template_args['registrations_to_apply_payment_to'] = $registrations_to_apply_payment_to;
914 914
 	}
915 915
 
916 916
 
@@ -927,9 +927,9 @@  discard block
 block discarded – undo
927 927
 		$statuses = EEM_Registration::reg_status_array(array(), TRUE);
928 928
 		//let's add a "don't change" option.
929 929
 		$status_array['NAN'] = __('Leave the Same', 'event_espresso');
930
-		$status_array = array_merge( $status_array, $statuses );
931
-		$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' );
932
-		$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' );
930
+		$status_array = array_merge($status_array, $statuses);
931
+		$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');
932
+		$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');
933 933
 
934 934
 	}
935 935
 
@@ -944,21 +944,21 @@  discard block
 block discarded – undo
944 944
 	 * @param EE_Payment[] to show on this page
945 945
 	 *	@return void
946 946
 	 */
947
-	private function _get_payment_methods( $payments = array() ) {
947
+	private function _get_payment_methods($payments = array()) {
948 948
 		$payment_methods_of_payments = array();
949
-		foreach( $payments as $payment ){
950
-			if( $payment instanceof EE_Payment ){
951
-				$payment_methods_of_payments[] = $payment->get( 'PMD_ID' );
949
+		foreach ($payments as $payment) {
950
+			if ($payment instanceof EE_Payment) {
951
+				$payment_methods_of_payments[] = $payment->get('PMD_ID');
952 952
 			}
953 953
 		}
954
-		if( $payment_methods_of_payments ){
955
-			$query_args = array( array( 'OR*payment_method_for_payment' => array(
956
-					'PMD_ID' => array( 'IN', $payment_methods_of_payments ),
957
-					'PMD_scope' => array( 'LIKE', '%' . EEM_Payment_Method::scope_admin . '%' ) ) ) );
958
-		}else{
959
-			$query_args = array( array( 'PMD_scope' => array( 'LIKE', '%' . EEM_Payment_Method::scope_admin . '%' ) ) );
954
+		if ($payment_methods_of_payments) {
955
+			$query_args = array(array('OR*payment_method_for_payment' => array(
956
+					'PMD_ID' => array('IN', $payment_methods_of_payments),
957
+					'PMD_scope' => array('LIKE', '%'.EEM_Payment_Method::scope_admin.'%') )));
958
+		} else {
959
+			$query_args = array(array('PMD_scope' => array('LIKE', '%'.EEM_Payment_Method::scope_admin.'%')));
960 960
 		}
961
-		$this->_template_args['payment_methods'] = EEM_Payment_Method::instance()->get_all( $query_args );
961
+		$this->_template_args['payment_methods'] = EEM_Payment_Method::instance()->get_all($query_args);
962 962
 	}
963 963
 
964 964
 
@@ -972,46 +972,46 @@  discard block
 block discarded – undo
972 972
 	 * @param array $metabox
973 973
 	 * @return void
974 974
 	 */
975
-	public function txn_attendees_meta_box( $post, $metabox = array( 'args' => array() )) {
975
+	public function txn_attendees_meta_box($post, $metabox = array('args' => array())) {
976 976
 
977
-		extract( $metabox['args'] );
977
+		extract($metabox['args']);
978 978
 		$this->_template_args['post'] = $post;
979 979
 		$this->_template_args['event_attendees'] = array();
980 980
 		// process items in cart
981
-		$line_items = $this->_transaction->get_many_related('Line_Item', array( array( 'LIN_type' => 'line-item' ) ) );
982
-		if ( ! empty( $line_items )) {
983
-			foreach ( $line_items as $item ) {
984
-				if ( $item instanceof EE_Line_Item ) {
985
-					switch( $item->OBJ_type() ) {
981
+		$line_items = $this->_transaction->get_many_related('Line_Item', array(array('LIN_type' => 'line-item')));
982
+		if ( ! empty($line_items)) {
983
+			foreach ($line_items as $item) {
984
+				if ($item instanceof EE_Line_Item) {
985
+					switch ($item->OBJ_type()) {
986 986
 
987 987
 						case 'Event' :
988 988
 							break;
989 989
 
990 990
 						case 'Ticket' :
991 991
 							$ticket = $item->ticket();
992
-							if ( empty( $ticket )) {
992
+							if (empty($ticket)) {
993 993
 								continue; //right now we're only handling tickets here.  Cause its expected that only tickets will have attendees right?
994 994
 							}
995
-							$ticket_price = EEH_Template::format_currency( $item->get( 'LIN_unit_price' ));
995
+							$ticket_price = EEH_Template::format_currency($item->get('LIN_unit_price'));
996 996
 							$event = $ticket->get_first_related('Registration')->get_first_related('Event');
997
-							$event_name = $event instanceof EE_Event ? $event->get('EVT_name') . ' - ' . $item->get('LIN_name') : '';
997
+							$event_name = $event instanceof EE_Event ? $event->get('EVT_name').' - '.$item->get('LIN_name') : '';
998 998
 
999
-							$registrations = $ticket->get_many_related('Registration', array( array('TXN_ID' => $this->_transaction->ID() )));
1000
-							foreach( $registrations as $registration ) {
1001
-								$this->_template_args['event_attendees'][$registration->ID()]['att_num'] 						= $registration->get('REG_count');
1002
-								$this->_template_args['event_attendees'][$registration->ID()]['event_ticket_name'] 	= $event_name;
1003
-								$this->_template_args['event_attendees'][$registration->ID()]['ticket_price'] 				= $ticket_price;
999
+							$registrations = $ticket->get_many_related('Registration', array(array('TXN_ID' => $this->_transaction->ID())));
1000
+							foreach ($registrations as $registration) {
1001
+								$this->_template_args['event_attendees'][$registration->ID()]['att_num'] = $registration->get('REG_count');
1002
+								$this->_template_args['event_attendees'][$registration->ID()]['event_ticket_name'] = $event_name;
1003
+								$this->_template_args['event_attendees'][$registration->ID()]['ticket_price'] = $ticket_price;
1004 1004
 								// attendee info
1005 1005
 								$attendee = $registration->get_first_related('Attendee');
1006
-								if ( $attendee instanceof EE_Attendee ) {
1006
+								if ($attendee instanceof EE_Attendee) {
1007 1007
 									$this->_template_args['event_attendees'][$registration->ID()]['att_id'] 			= $attendee->ID();
1008 1008
 									$this->_template_args['event_attendees'][$registration->ID()]['attendee'] 	= $attendee->full_name();
1009
-									$this->_template_args['event_attendees'][$registration->ID()]['email'] 			= '<a href="mailto:' . $attendee->email() . '?subject=' . $event->get('EVT_name') . __(' Event', 'event_espresso') . '">' . $attendee->email() . '</a>';
1010
-									$this->_template_args['event_attendees'][$registration->ID()]['address'] 		=  implode(',<br>', $attendee->full_address_as_array() );
1009
+									$this->_template_args['event_attendees'][$registration->ID()]['email'] = '<a href="mailto:'.$attendee->email().'?subject='.$event->get('EVT_name').__(' Event', 'event_espresso').'">'.$attendee->email().'</a>';
1010
+									$this->_template_args['event_attendees'][$registration->ID()]['address'] 		= implode(',<br>', $attendee->full_address_as_array());
1011 1011
 								} else {
1012 1012
 									$this->_template_args['event_attendees'][$registration->ID()]['att_id'] 			= '';
1013 1013
 									$this->_template_args['event_attendees'][$registration->ID()]['attendee'] 	= '';
1014
-									$this->_template_args['event_attendees'][$registration->ID()]['email'] 			= '';
1014
+									$this->_template_args['event_attendees'][$registration->ID()]['email'] = '';
1015 1015
 									$this->_template_args['event_attendees'][$registration->ID()]['address'] 		= '';
1016 1016
 								}
1017 1017
 							}
@@ -1021,12 +1021,12 @@  discard block
 block discarded – undo
1021 1021
 				}
1022 1022
 			}
1023 1023
 
1024
-			$this->_template_args['transaction_form_url'] = add_query_arg( array( 'action' => 'edit_transaction', 'process' => 'attendees'  ), TXN_ADMIN_URL );
1025
-			echo EEH_Template::display_template( TXN_TEMPLATE_PATH . 'txn_admin_details_main_meta_box_attendees.template.php', $this->_template_args, TRUE );
1024
+			$this->_template_args['transaction_form_url'] = add_query_arg(array('action' => 'edit_transaction', 'process' => 'attendees'), TXN_ADMIN_URL);
1025
+			echo EEH_Template::display_template(TXN_TEMPLATE_PATH.'txn_admin_details_main_meta_box_attendees.template.php', $this->_template_args, TRUE);
1026 1026
 
1027 1027
 		} else {
1028 1028
 			echo sprintf(
1029
-				__( '%1$sFor some reason, there are no attendees registered for this transaction. Likely the registration was abandoned in process.%2$s', 'event_espresso' ),
1029
+				__('%1$sFor some reason, there are no attendees registered for this transaction. Likely the registration was abandoned in process.%2$s', 'event_espresso'),
1030 1030
 				'<p class="important-notice">',
1031 1031
 				'</p>'
1032 1032
 			);
@@ -1045,20 +1045,20 @@  discard block
 block discarded – undo
1045 1045
 	 */
1046 1046
 	public function txn_registrant_side_meta_box() {
1047 1047
 		$primary_att = $this->_transaction->primary_registration() instanceof EE_Registration ? $this->_transaction->primary_registration()->get_first_related('Attendee') : null;
1048
-		if ( ! $primary_att instanceof EE_Attendee ) {
1048
+		if ( ! $primary_att instanceof EE_Attendee) {
1049 1049
 			$this->_template_args['no_attendee_message'] = __('There is no attached contact for this transaction.  The transaction either failed due to an error or was abandoned.', 'event_espresso');
1050 1050
 			$primary_att = EEM_Attendee::instance()->create_default_object();
1051 1051
 		}
1052
-		$this->_template_args['ATT_ID'] 						= $primary_att->ID();
1052
+		$this->_template_args['ATT_ID'] = $primary_att->ID();
1053 1053
 		$this->_template_args['prime_reg_fname']		= $primary_att->fname();
1054 1054
 		$this->_template_args['prime_reg_lname']		= $primary_att->lname();
1055
-		$this->_template_args['prime_reg_email'] 		= $primary_att->email();
1055
+		$this->_template_args['prime_reg_email'] = $primary_att->email();
1056 1056
 		$this->_template_args['prime_reg_phone'] 	= $primary_att->phone();
1057
-		$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 );
1057
+		$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);
1058 1058
 		// get formatted address for registrant
1059
-		EE_Registry::instance()->load_helper( 'Formatter' );
1060
-		$this->_template_args[ 'formatted_address' ] = EEH_Address::format( $primary_att );
1061
-		echo EEH_Template::display_template( TXN_TEMPLATE_PATH . 'txn_admin_details_side_meta_box_registrant.template.php', $this->_template_args, TRUE );
1059
+		EE_Registry::instance()->load_helper('Formatter');
1060
+		$this->_template_args['formatted_address'] = EEH_Address::format($primary_att);
1061
+		echo EEH_Template::display_template(TXN_TEMPLATE_PATH.'txn_admin_details_side_meta_box_registrant.template.php', $this->_template_args, TRUE);
1062 1062
 	}
1063 1063
 
1064 1064
 
@@ -1074,12 +1074,12 @@  discard block
 block discarded – undo
1074 1074
 
1075 1075
 		$this->_template_args['billing_form'] = $this->_transaction->billing_info();
1076 1076
 		$this->_template_args['billing_form_url'] = add_query_arg(
1077
-			array( 'action' => 'edit_transaction', 'process' => 'billing'  ),
1077
+			array('action' => 'edit_transaction', 'process' => 'billing'),
1078 1078
 			TXN_ADMIN_URL
1079 1079
 		);
1080 1080
 
1081
-		$template_path = TXN_TEMPLATE_PATH . 'txn_admin_details_side_meta_box_billing_info.template.php';
1082
-		echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE );/**/
1081
+		$template_path = TXN_TEMPLATE_PATH.'txn_admin_details_side_meta_box_billing_info.template.php';
1082
+		echo EEH_Template::display_template($template_path, $this->_template_args, TRUE); /**/
1083 1083
 	}
1084 1084
 
1085 1085
 
@@ -1092,42 +1092,42 @@  discard block
 block discarded – undo
1092 1092
 	*	@return void
1093 1093
 	*/
1094 1094
 	public function apply_payments_or_refunds() {
1095
-		$json_response_data = array( 'return_data' => FALSE );
1095
+		$json_response_data = array('return_data' => FALSE);
1096 1096
 		$valid_data = $this->_validate_payment_request_data();
1097
-		if ( ! empty( $valid_data ) ) {
1098
-			$PAY_ID = $valid_data[ 'PAY_ID' ];
1097
+		if ( ! empty($valid_data)) {
1098
+			$PAY_ID = $valid_data['PAY_ID'];
1099 1099
 			//save  the new payment
1100
-			$payment = $this->_create_payment_from_request_data( $valid_data );
1100
+			$payment = $this->_create_payment_from_request_data($valid_data);
1101 1101
 			// get the TXN for this payment
1102 1102
 			$transaction = $payment->transaction();
1103 1103
 			// verify transaction
1104
-			if ( $transaction instanceof EE_Transaction ) {
1104
+			if ($transaction instanceof EE_Transaction) {
1105 1105
 				// calculate_total_payments_and_update_status
1106
-				$this->_process_transaction_payments( $transaction );
1107
-				$REG_IDs = $this->_get_REG_IDs_to_apply_payment_to( $payment );
1108
-				$this->_remove_existing_registration_payments( $payment, $PAY_ID );
1106
+				$this->_process_transaction_payments($transaction);
1107
+				$REG_IDs = $this->_get_REG_IDs_to_apply_payment_to($payment);
1108
+				$this->_remove_existing_registration_payments($payment, $PAY_ID);
1109 1109
 				// apply payment to registrations (if applicable)
1110
-				if ( ! empty( $REG_IDs ) ) {
1111
-					$this->_update_registration_payments( $transaction, $payment, $REG_IDs );
1110
+				if ( ! empty($REG_IDs)) {
1111
+					$this->_update_registration_payments($transaction, $payment, $REG_IDs);
1112 1112
 					$this->_maybe_send_notifications();
1113 1113
 					// now process status changes for the same registrations
1114
-					$this->_process_registration_status_change( $transaction, $REG_IDs );
1114
+					$this->_process_registration_status_change($transaction, $REG_IDs);
1115 1115
 				}
1116
-				$this->_maybe_send_notifications( $payment );
1116
+				$this->_maybe_send_notifications($payment);
1117 1117
 				//prepare to render page
1118
-				$json_response_data[ 'return_data' ] = $this->_build_payment_json_response( $payment, $REG_IDs );
1119
-				do_action( 'AHEE__Transactions_Admin_Page__apply_payments_or_refund__after_recording', $transaction, $payment );
1118
+				$json_response_data['return_data'] = $this->_build_payment_json_response($payment, $REG_IDs);
1119
+				do_action('AHEE__Transactions_Admin_Page__apply_payments_or_refund__after_recording', $transaction, $payment);
1120 1120
 			} else {
1121 1121
 				EE_Error::add_error(
1122
-					__( 'A valid Transaction for this payment could not be retrieved.', 'event_espresso' ),
1122
+					__('A valid Transaction for this payment could not be retrieved.', 'event_espresso'),
1123 1123
 					__FILE__, __FUNCTION__, __LINE__
1124 1124
 				);
1125 1125
 			}
1126 1126
 		} else {
1127
-			EE_Error::add_error( __( 'The payment form data could not be processed. Please try again.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
1127
+			EE_Error::add_error(__('The payment form data could not be processed. Please try again.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1128 1128
 		}
1129 1129
 
1130
-		$notices = EE_Error::get_notices( false, false, false );
1130
+		$notices = EE_Error::get_notices(false, false, false);
1131 1131
 		$this->_template_args = array(
1132 1132
 			'data' => $json_response_data,
1133 1133
 			'error' => $notices['errors'],
@@ -1144,30 +1144,30 @@  discard block
 block discarded – undo
1144 1144
 	 * @return array
1145 1145
 	 */
1146 1146
 	protected function _validate_payment_request_data() {
1147
-		if ( ! isset( $this->_req_data[ 'txn_admin_payment' ] ) ) {
1147
+		if ( ! isset($this->_req_data['txn_admin_payment'])) {
1148 1148
 			return false;
1149 1149
 		}
1150 1150
 		$payment_form = $this->_generate_payment_form_section();
1151 1151
 		try {
1152
-			if ( $payment_form->was_submitted() ) {
1152
+			if ($payment_form->was_submitted()) {
1153 1153
 				$payment_form->receive_form_submission();
1154
-				if ( ! $payment_form->is_valid() ) {
1154
+				if ( ! $payment_form->is_valid()) {
1155 1155
 					$submission_error_messages = array();
1156
-					foreach ( $payment_form->get_validation_errors_accumulated() as $validation_error ) {
1157
-						if ( $validation_error instanceof EE_Validation_Error ) {
1156
+					foreach ($payment_form->get_validation_errors_accumulated() as $validation_error) {
1157
+						if ($validation_error instanceof EE_Validation_Error) {
1158 1158
 							$submission_error_messages[] = sprintf(
1159
-								_x( '%s : %s', 'Form Section Name : Form Validation Error', 'event_espresso' ),
1159
+								_x('%s : %s', 'Form Section Name : Form Validation Error', 'event_espresso'),
1160 1160
 								$validation_error->get_form_section()->html_label_text(),
1161 1161
 								$validation_error->getMessage()
1162 1162
 							);
1163 1163
 						}
1164 1164
 					}
1165
-					EE_Error::add_error( join( '<br />', $submission_error_messages ), __FILE__, __FUNCTION__, __LINE__ );
1165
+					EE_Error::add_error(join('<br />', $submission_error_messages), __FILE__, __FUNCTION__, __LINE__);
1166 1166
 					return array();
1167 1167
 				}
1168 1168
 			}
1169
-		} catch ( EE_Error $e ) {
1170
-			EE_Error::add_error( $e->getMessage(), __FILE__, __FUNCTION__, __LINE__ );
1169
+		} catch (EE_Error $e) {
1170
+			EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__);
1171 1171
 			return array();
1172 1172
 		}
1173 1173
 		return $payment_form->valid_data();
@@ -1189,63 +1189,63 @@  discard block
 block discarded – undo
1189 1189
 						array(
1190 1190
 							'default' => 0,
1191 1191
 							'required' => false,
1192
-							'html_label_text' => __( 'Payment ID', 'event_espresso' ),
1193
-							'validation_strategies' => array( new EE_Int_Normalization() )
1192
+							'html_label_text' => __('Payment ID', 'event_espresso'),
1193
+							'validation_strategies' => array(new EE_Int_Normalization())
1194 1194
 						)
1195 1195
 					),
1196 1196
 					'TXN_ID' => new EE_Text_Input(
1197 1197
 						array(
1198 1198
 							'default' => 0,
1199 1199
 							'required' => true,
1200
-							'html_label_text' => __( 'Transaction ID', 'event_espresso' ),
1201
-							'validation_strategies' => array( new EE_Int_Normalization() )
1200
+							'html_label_text' => __('Transaction ID', 'event_espresso'),
1201
+							'validation_strategies' => array(new EE_Int_Normalization())
1202 1202
 						)
1203 1203
 					),
1204 1204
 					'type' => new EE_Text_Input(
1205 1205
 						array(
1206 1206
 							'default' => 1,
1207 1207
 							'required' => true,
1208
-							'html_label_text' => __( 'Payment or Refund', 'event_espresso' ),
1209
-							'validation_strategies' => array( new EE_Int_Normalization() )
1208
+							'html_label_text' => __('Payment or Refund', 'event_espresso'),
1209
+							'validation_strategies' => array(new EE_Int_Normalization())
1210 1210
 						)
1211 1211
 					),
1212 1212
 					'amount' => new EE_Text_Input(
1213 1213
 						array(
1214 1214
 							'default' => 0,
1215 1215
 							'required' => true,
1216
-							'html_label_text' => __( 'Payment amount', 'event_espresso' ),
1217
-							'validation_strategies' => array( new EE_Float_Normalization() )
1216
+							'html_label_text' => __('Payment amount', 'event_espresso'),
1217
+							'validation_strategies' => array(new EE_Float_Normalization())
1218 1218
 						)
1219 1219
 					),
1220 1220
 					'status' => new EE_Text_Input(
1221 1221
 						array(
1222 1222
 							'default' => EEM_Payment::status_id_approved,
1223 1223
 							'required' => true,
1224
-							'html_label_text' => __( 'Payment status', 'event_espresso' ),
1224
+							'html_label_text' => __('Payment status', 'event_espresso'),
1225 1225
 						)
1226 1226
 					),
1227 1227
 					'PMD_ID' => new EE_Text_Input(
1228 1228
 						array(
1229 1229
 							'default' => 2,
1230 1230
 							'required' => true,
1231
-							'html_label_text' => __( 'Payment Method', 'event_espresso' ),
1232
-							'validation_strategies' => array( new EE_Int_Normalization() )
1231
+							'html_label_text' => __('Payment Method', 'event_espresso'),
1232
+							'validation_strategies' => array(new EE_Int_Normalization())
1233 1233
 						)
1234 1234
 					),
1235 1235
 					'date' => new EE_Text_Input(
1236 1236
 						array(
1237 1237
 							'default' => time(),
1238 1238
 							'required' => true,
1239
-							'html_label_text' => __( 'Payment date', 'event_espresso' ),
1239
+							'html_label_text' => __('Payment date', 'event_espresso'),
1240 1240
 						)
1241 1241
 					),
1242 1242
 					'txn_id_chq_nmbr' => new EE_Text_Input(
1243 1243
 						array(
1244 1244
 							'default' => '',
1245 1245
 							'required' => false,
1246
-							'html_label_text' => __( 'Transaction or Cheque Number', 'event_espresso' ),
1246
+							'html_label_text' => __('Transaction or Cheque Number', 'event_espresso'),
1247 1247
                                                         'validation_strategies' => array(
1248
-                                                            new EE_Max_Length_Validation_Strategy( __('Input too long', 'event_espresso'), 100 ),
1248
+                                                            new EE_Max_Length_Validation_Strategy(__('Input too long', 'event_espresso'), 100),
1249 1249
                                                         )
1250 1250
 						)
1251 1251
 					),
@@ -1253,9 +1253,9 @@  discard block
 block discarded – undo
1253 1253
 						array(
1254 1254
 							'default' => '',
1255 1255
 							'required' => false,
1256
-							'html_label_text' => __( 'Purchase Order Number', 'event_espresso' ),
1256
+							'html_label_text' => __('Purchase Order Number', 'event_espresso'),
1257 1257
                                                         'validation_strategies' => array(
1258
-                                                            new EE_Max_Length_Validation_Strategy( __('Input too long', 'event_espresso'), 100 ),
1258
+                                                            new EE_Max_Length_Validation_Strategy(__('Input too long', 'event_espresso'), 100),
1259 1259
                                                         )
1260 1260
 						)
1261 1261
 					),
@@ -1263,9 +1263,9 @@  discard block
 block discarded – undo
1263 1263
 						array(
1264 1264
 							'default' => '',
1265 1265
 							'required' => false,
1266
-							'html_label_text' => __( 'Extra Field for Accounting', 'event_espresso' ),
1266
+							'html_label_text' => __('Extra Field for Accounting', 'event_espresso'),
1267 1267
                                                         'validation_strategies' => array(
1268
-                                                            new EE_Max_Length_Validation_Strategy( __('Input too long', 'event_espresso'), 100 ),
1268
+                                                            new EE_Max_Length_Validation_Strategy(__('Input too long', 'event_espresso'), 100),
1269 1269
                                                         )
1270 1270
 						)
1271 1271
 					),
@@ -1282,37 +1282,37 @@  discard block
 block discarded – undo
1282 1282
 	 * @param array $valid_data
1283 1283
 	 * @return EE_Payment
1284 1284
 	 */
1285
-	protected function _create_payment_from_request_data( $valid_data ) {
1286
-		$PAY_ID = $valid_data[ 'PAY_ID' ];
1285
+	protected function _create_payment_from_request_data($valid_data) {
1286
+		$PAY_ID = $valid_data['PAY_ID'];
1287 1287
 		// get payment amount
1288
-		$amount = $valid_data[ 'amount' ] ? abs( $valid_data[ 'amount' ] ) : 0;
1288
+		$amount = $valid_data['amount'] ? abs($valid_data['amount']) : 0;
1289 1289
 		// payments have a type value of 1 and refunds have a type value of -1
1290 1290
 		// so multiplying amount by type will give a positive value for payments, and negative values for refunds
1291
-		$amount = $valid_data[ 'type' ] < 0 ? $amount * -1 : $amount;
1291
+		$amount = $valid_data['type'] < 0 ? $amount * -1 : $amount;
1292 1292
 		// for some reason the date string coming in has extra spaces between the date and time.  This fixes that.
1293
-		$date = $valid_data['date'] ? preg_replace( '/\s+/', ' ', $valid_data['date'] ) : date( 'Y-m-d g:i a', current_time( 'timestamp' ) );
1293
+		$date = $valid_data['date'] ? preg_replace('/\s+/', ' ', $valid_data['date']) : date('Y-m-d g:i a', current_time('timestamp'));
1294 1294
 		$payment = EE_Payment::new_instance(
1295 1295
 			array(
1296
-				'TXN_ID' 								=> $valid_data[ 'TXN_ID' ],
1297
-				'STS_ID' 								=> $valid_data[ 'status' ],
1296
+				'TXN_ID' 								=> $valid_data['TXN_ID'],
1297
+				'STS_ID' 								=> $valid_data['status'],
1298 1298
 				'PAY_timestamp' 				=> $date,
1299 1299
 				'PAY_source'           			=> EEM_Payment_Method::scope_admin,
1300
-				'PMD_ID'               				=> $valid_data[ 'PMD_ID' ],
1300
+				'PMD_ID'               				=> $valid_data['PMD_ID'],
1301 1301
 				'PAY_amount'           			=> $amount,
1302
-				'PAY_txn_id_chq_nmbr'  	=> $valid_data[ 'txn_id_chq_nmbr' ],
1303
-				'PAY_po_number'        		=> $valid_data[ 'po_number' ],
1304
-				'PAY_extra_accntng'    		=> $valid_data[ 'accounting' ],
1302
+				'PAY_txn_id_chq_nmbr'  	=> $valid_data['txn_id_chq_nmbr'],
1303
+				'PAY_po_number'        		=> $valid_data['po_number'],
1304
+				'PAY_extra_accntng'    		=> $valid_data['accounting'],
1305 1305
 				'PAY_details'          				=> $valid_data,
1306 1306
 				'PAY_ID'               				=> $PAY_ID
1307 1307
 			),
1308 1308
 			'',
1309
-			array( 'Y-m-d', 'g:i a' )
1309
+			array('Y-m-d', 'g:i a')
1310 1310
 		);
1311 1311
 
1312
-		if ( ! $payment->save() ) {
1312
+		if ( ! $payment->save()) {
1313 1313
 			EE_Error::add_error(
1314 1314
 				sprintf(
1315
-					__( 'Payment %1$d has not been successfully saved to the database.', 'event_espresso' ),
1315
+					__('Payment %1$d has not been successfully saved to the database.', 'event_espresso'),
1316 1316
 					$payment->ID()
1317 1317
 				),
1318 1318
 				__FILE__, __FUNCTION__, __LINE__
@@ -1329,15 +1329,15 @@  discard block
 block discarded – undo
1329 1329
 	 * @param \EE_Transaction $transaction
1330 1330
 	 * @return array
1331 1331
 	 */
1332
-	protected function _process_transaction_payments( EE_Transaction $transaction ) {
1332
+	protected function _process_transaction_payments(EE_Transaction $transaction) {
1333 1333
 		/** @type EE_Transaction_Payments $transaction_payments */
1334
-		$transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' );
1334
+		$transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments');
1335 1335
 		//update the transaction with this payment
1336
-		if ( $transaction_payments->calculate_total_payments_and_update_status( $transaction ) ) {
1337
-			EE_Error::add_success( __( 'The payment has been processed successfully.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
1336
+		if ($transaction_payments->calculate_total_payments_and_update_status($transaction)) {
1337
+			EE_Error::add_success(__('The payment has been processed successfully.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1338 1338
 		} else {
1339 1339
 			EE_Error::add_error(
1340
-				__( 'The payment was processed successfully but the amount paid for the transaction was not updated.', 'event_espresso' )
1340
+				__('The payment was processed successfully but the amount paid for the transaction was not updated.', 'event_espresso')
1341 1341
 				, __FILE__, __FUNCTION__, __LINE__
1342 1342
 			);
1343 1343
 		}
@@ -1353,19 +1353,19 @@  discard block
 block discarded – undo
1353 1353
 	 * @param \EE_Payment $payment
1354 1354
 	 * @return array
1355 1355
 	 */
1356
-	protected function _get_REG_IDs_to_apply_payment_to( EE_Payment $payment ) {
1356
+	protected function _get_REG_IDs_to_apply_payment_to(EE_Payment $payment) {
1357 1357
 		$REG_IDs = array();
1358 1358
 		// grab array of IDs for specific registrations to apply changes to
1359
-		if ( isset( $this->_req_data[ 'txn_admin_payment' ][ 'registrations' ] ) ) {
1360
-			$REG_IDs = (array)$this->_req_data[ 'txn_admin_payment' ][ 'registrations' ];
1359
+		if (isset($this->_req_data['txn_admin_payment']['registrations'])) {
1360
+			$REG_IDs = (array) $this->_req_data['txn_admin_payment']['registrations'];
1361 1361
 		}
1362 1362
 		//nothing specified ? then get all reg IDs
1363
-		if ( empty( $REG_IDs ) ) {
1363
+		if (empty($REG_IDs)) {
1364 1364
 			$registrations = $payment->transaction()->registrations();
1365
-			$REG_IDs = ! empty( $registrations ) ? array_keys( $registrations ) : $this->_get_existing_reg_payment_REG_IDs( $payment );
1365
+			$REG_IDs = ! empty($registrations) ? array_keys($registrations) : $this->_get_existing_reg_payment_REG_IDs($payment);
1366 1366
 		}
1367 1367
 		// ensure that REG_IDs are integers and NOT strings
1368
-		return array_map( 'intval', $REG_IDs );
1368
+		return array_map('intval', $REG_IDs);
1369 1369
 	}
1370 1370
 
1371 1371
 
@@ -1382,7 +1382,7 @@  discard block
 block discarded – undo
1382 1382
 	/**
1383 1383
 	 * @param array $existing_reg_payment_REG_IDs
1384 1384
 	 */
1385
-	public function set_existing_reg_payment_REG_IDs( $existing_reg_payment_REG_IDs = null ) {
1385
+	public function set_existing_reg_payment_REG_IDs($existing_reg_payment_REG_IDs = null) {
1386 1386
 		$this->_existing_reg_payment_REG_IDs = $existing_reg_payment_REG_IDs;
1387 1387
 	}
1388 1388
 
@@ -1397,13 +1397,13 @@  discard block
 block discarded – undo
1397 1397
 	 * @param \EE_Payment $payment
1398 1398
 	 * @return array
1399 1399
 	 */
1400
-	protected function _get_existing_reg_payment_REG_IDs( EE_Payment $payment ) {
1401
-		if ( $this->existing_reg_payment_REG_IDs() === null ) {
1400
+	protected function _get_existing_reg_payment_REG_IDs(EE_Payment $payment) {
1401
+		if ($this->existing_reg_payment_REG_IDs() === null) {
1402 1402
 			// let's get any existing reg payment records for this payment
1403
-			$existing_reg_payment_REG_IDs = $payment->get_many_related( 'Registration' );
1403
+			$existing_reg_payment_REG_IDs = $payment->get_many_related('Registration');
1404 1404
 			// but we only want the REG IDs, so grab the array keys
1405
-			$existing_reg_payment_REG_IDs = ! empty( $existing_reg_payment_REG_IDs ) ? array_keys( $existing_reg_payment_REG_IDs ) : array();
1406
-			$this->set_existing_reg_payment_REG_IDs( $existing_reg_payment_REG_IDs );
1405
+			$existing_reg_payment_REG_IDs = ! empty($existing_reg_payment_REG_IDs) ? array_keys($existing_reg_payment_REG_IDs) : array();
1406
+			$this->set_existing_reg_payment_REG_IDs($existing_reg_payment_REG_IDs);
1407 1407
 		}
1408 1408
 		return $this->existing_reg_payment_REG_IDs();
1409 1409
 	}
@@ -1422,23 +1422,23 @@  discard block
 block discarded – undo
1422 1422
 	 * @param int         $PAY_ID
1423 1423
 	 * @return bool;
1424 1424
 	 */
1425
-	protected function _remove_existing_registration_payments( EE_Payment $payment, $PAY_ID = 0 ) {
1425
+	protected function _remove_existing_registration_payments(EE_Payment $payment, $PAY_ID = 0) {
1426 1426
 		// newly created payments will have nothing recorded for $PAY_ID
1427
-		if ( $PAY_ID == 0 ) {
1427
+		if ($PAY_ID == 0) {
1428 1428
 			return false;
1429 1429
 		}
1430
-		$existing_reg_payment_REG_IDs = $this->_get_existing_reg_payment_REG_IDs( $payment );
1431
-		if ( empty( $existing_reg_payment_REG_IDs )) {
1430
+		$existing_reg_payment_REG_IDs = $this->_get_existing_reg_payment_REG_IDs($payment);
1431
+		if (empty($existing_reg_payment_REG_IDs)) {
1432 1432
 			return false;
1433 1433
 		}
1434 1434
 		/** @type EE_Transaction_Payments $transaction_payments */
1435
-		$transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' );
1435
+		$transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments');
1436 1436
 		return $transaction_payments->delete_registration_payments_and_update_registrations(
1437 1437
 			$payment,
1438 1438
 			array(
1439 1439
 				array(
1440 1440
 					'PAY_ID' => $payment->ID(),
1441
-					'REG_ID' => array( 'IN', $existing_reg_payment_REG_IDs ),
1441
+					'REG_ID' => array('IN', $existing_reg_payment_REG_IDs),
1442 1442
 				)
1443 1443
 			)
1444 1444
 		);
@@ -1457,25 +1457,25 @@  discard block
 block discarded – undo
1457 1457
 	 * @param array $REG_IDs
1458 1458
 	 * @return bool
1459 1459
 	 */
1460
-	protected function _update_registration_payments( EE_Transaction $transaction, EE_Payment $payment, $REG_IDs = array() ) {
1460
+	protected function _update_registration_payments(EE_Transaction $transaction, EE_Payment $payment, $REG_IDs = array()) {
1461 1461
 		// we can pass our own custom set of registrations to EE_Payment_Processor::process_registration_payments()
1462 1462
 		// so let's do that using our set of REG_IDs from the form
1463 1463
 		$registration_query_where_params = array(
1464
-			'REG_ID' => array( 'IN', $REG_IDs )
1464
+			'REG_ID' => array('IN', $REG_IDs)
1465 1465
 		);
1466 1466
 		// but add in some conditions regarding payment,
1467 1467
 		// so that we don't apply payments to registrations that are free or have already been paid for
1468 1468
 		// but ONLY if the payment is NOT a refund ( ie: the payment amount is not negative )
1469
-		if ( ! $payment->is_a_refund() ) {
1470
-			$registration_query_where_params[ 'REG_final_price' ]  = array( '!=', 0 );
1471
-			$registration_query_where_params[ 'REG_final_price*' ]  = array( '!=', 'REG_paid', true );
1469
+		if ( ! $payment->is_a_refund()) {
1470
+			$registration_query_where_params['REG_final_price'] = array('!=', 0);
1471
+			$registration_query_where_params['REG_final_price*'] = array('!=', 'REG_paid', true);
1472 1472
 		}
1473 1473
 		//EEH_Debug_Tools::printr( $registration_query_where_params, '$registration_query_where_params', __FILE__, __LINE__ );
1474
-		$registrations = $transaction->registrations( array( $registration_query_where_params ) );
1475
-		if ( ! empty( $registrations ) ) {
1474
+		$registrations = $transaction->registrations(array($registration_query_where_params));
1475
+		if ( ! empty($registrations)) {
1476 1476
 			/** @type EE_Payment_Processor $payment_processor */
1477
-			$payment_processor = EE_Registry::instance()->load_core( 'Payment_Processor' );
1478
-			$payment_processor->process_registration_payments( $transaction, $payment, $registrations );
1477
+			$payment_processor = EE_Registry::instance()->load_core('Payment_Processor');
1478
+			$payment_processor->process_registration_payments($transaction, $payment, $registrations);
1479 1479
 		}
1480 1480
 	}
1481 1481
 
@@ -1491,22 +1491,22 @@  discard block
 block discarded – undo
1491 1491
 	 * @param array $REG_IDs
1492 1492
 	 * @return bool
1493 1493
 	 */
1494
-	protected function _process_registration_status_change( EE_Transaction $transaction, $REG_IDs = array() ) {
1494
+	protected function _process_registration_status_change(EE_Transaction $transaction, $REG_IDs = array()) {
1495 1495
 		// first if there is no change in status then we get out.
1496 1496
 		if (
1497
-			! isset( $this->_req_data['txn_reg_status_change'], $this->_req_data[ 'txn_reg_status_change' ][ 'reg_status' ] )
1497
+			! isset($this->_req_data['txn_reg_status_change'], $this->_req_data['txn_reg_status_change']['reg_status'])
1498 1498
 			|| $this->_req_data['txn_reg_status_change']['reg_status'] == 'NAN'
1499 1499
 		) {
1500 1500
 			//no error message, no change requested, just nothing to do man.
1501 1501
 			return FALSE;
1502 1502
 		}
1503 1503
 		/** @type EE_Transaction_Processor $transaction_processor */
1504
-		$transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' );
1504
+		$transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor');
1505 1505
 		// made it here dude?  Oh WOW.  K, let's take care of changing the statuses
1506 1506
 		return $transaction_processor->manually_update_registration_statuses(
1507 1507
 			$transaction,
1508
-			sanitize_text_field( $this->_req_data[ 'txn_reg_status_change' ][ 'reg_status' ] ),
1509
-			array( array( 'REG_ID' => array( 'IN', $REG_IDs ) ) )
1508
+			sanitize_text_field($this->_req_data['txn_reg_status_change']['reg_status']),
1509
+			array(array('REG_ID' => array('IN', $REG_IDs)))
1510 1510
 		);
1511 1511
 	}
1512 1512
 
@@ -1521,16 +1521,16 @@  discard block
 block discarded – undo
1521 1521
 	 * @param bool | null        $delete_txn_reg_status_change
1522 1522
 	 * @return array
1523 1523
 	 */
1524
-	protected function _build_payment_json_response( EE_Payment $payment, $REG_IDs = array(), $delete_txn_reg_status_change = null ) {
1524
+	protected function _build_payment_json_response(EE_Payment $payment, $REG_IDs = array(), $delete_txn_reg_status_change = null) {
1525 1525
 		// was the payment deleted ?
1526
-		if ( is_bool( $delete_txn_reg_status_change )) {
1526
+		if (is_bool($delete_txn_reg_status_change)) {
1527 1527
 			return array(
1528 1528
 				'PAY_ID' 				=> $payment->ID(),
1529 1529
 				'amount' 			=> $payment->amount(),
1530 1530
 				'total_paid' 			=> $payment->transaction()->paid(),
1531 1531
 				'txn_status' 			=> $payment->transaction()->status_ID(),
1532 1532
 				'pay_status' 		=> $payment->STS_ID(),
1533
-				'registrations' 	=> $this->_registration_payment_data_array( $REG_IDs ),
1533
+				'registrations' 	=> $this->_registration_payment_data_array($REG_IDs),
1534 1534
 				'delete_txn_reg_status_change' => $delete_txn_reg_status_change,
1535 1535
 			);
1536 1536
 		} else {
@@ -1542,16 +1542,16 @@  discard block
 block discarded – undo
1542 1542
 				'pay_status' 	=> $payment->STS_ID(),
1543 1543
 				'PAY_ID'           => $payment->ID(),
1544 1544
 				'STS_ID' 			=> $payment->STS_ID(),
1545
-				'status' 			=> self::$_pay_status[ $payment->STS_ID() ],
1546
-				'date' 				=> $payment->timestamp( 'Y-m-d', 'h:i a' ),
1547
-				'method' 		=> strtoupper( $payment->source() ),
1545
+				'status' 			=> self::$_pay_status[$payment->STS_ID()],
1546
+				'date' 				=> $payment->timestamp('Y-m-d', 'h:i a'),
1547
+				'method' 		=> strtoupper($payment->source()),
1548 1548
 				'PM_ID' 			=> $payment->payment_method() ? $payment->payment_method()->ID() : 1,
1549
-				'gateway' 		=> $payment->payment_method() ? $payment->payment_method()->admin_name() : __( "Unknown", 'event_espresso' ),
1549
+				'gateway' 		=> $payment->payment_method() ? $payment->payment_method()->admin_name() : __("Unknown", 'event_espresso'),
1550 1550
 				'gateway_response' 	=> $payment->gateway_response(),
1551 1551
 				'txn_id_chq_nmbr'  	=> $payment->txn_id_chq_nmbr(),
1552 1552
 				'po_number'        		=> $payment->po_number(),
1553 1553
 				'extra_accntng'    		=> $payment->extra_accntng(),
1554
-				'registrations'    			=> $this->_registration_payment_data_array( $REG_IDs ),
1554
+				'registrations'    			=> $this->_registration_payment_data_array($REG_IDs),
1555 1555
 			);
1556 1556
 		}
1557 1557
 	}
@@ -1566,39 +1566,39 @@  discard block
 block discarded – undo
1566 1566
 	*	@return void
1567 1567
 	*/
1568 1568
 	public function delete_payment() {
1569
-		$json_response_data = array( 'return_data' => FALSE );
1570
-		$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;
1571
-		if ( $PAY_ID ) {
1572
-			$delete_txn_reg_status_change = isset( $this->_req_data[ 'delete_txn_reg_status_change' ] ) ? $this->_req_data[ 'delete_txn_reg_status_change' ] : false;
1573
-			$payment = EEM_Payment::instance()->get_one_by_ID( $PAY_ID );
1574
-			if ( $payment instanceof EE_Payment ) {
1575
-				$REG_IDs = $this->_get_existing_reg_payment_REG_IDs( $payment );
1569
+		$json_response_data = array('return_data' => FALSE);
1570
+		$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;
1571
+		if ($PAY_ID) {
1572
+			$delete_txn_reg_status_change = isset($this->_req_data['delete_txn_reg_status_change']) ? $this->_req_data['delete_txn_reg_status_change'] : false;
1573
+			$payment = EEM_Payment::instance()->get_one_by_ID($PAY_ID);
1574
+			if ($payment instanceof EE_Payment) {
1575
+				$REG_IDs = $this->_get_existing_reg_payment_REG_IDs($payment);
1576 1576
 				/** @type EE_Transaction_Payments $transaction_payments */
1577
-				$transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' );
1578
-				if ( $transaction_payments->delete_payment_and_update_transaction( $payment )) {
1579
-					$json_response_data['return_data'] = $this->_build_payment_json_response( $payment, $REG_IDs, $delete_txn_reg_status_change );
1580
-					if ( $delete_txn_reg_status_change ) {
1577
+				$transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments');
1578
+				if ($transaction_payments->delete_payment_and_update_transaction($payment)) {
1579
+					$json_response_data['return_data'] = $this->_build_payment_json_response($payment, $REG_IDs, $delete_txn_reg_status_change);
1580
+					if ($delete_txn_reg_status_change) {
1581 1581
 						$this->_req_data['txn_reg_status_change'] = $delete_txn_reg_status_change;
1582 1582
 						//MAKE sure we also add the delete_txn_req_status_change to the
1583 1583
 						//$_REQUEST global because that's how messages will be looking for it.
1584 1584
 						$_REQUEST['txn_reg_status_change'] = $delete_txn_reg_status_change;
1585 1585
 						$this->_maybe_send_notifications();
1586
-						$this->_process_registration_status_change( $payment->transaction(), $REG_IDs );
1586
+						$this->_process_registration_status_change($payment->transaction(), $REG_IDs);
1587 1587
 					}
1588 1588
 				}
1589 1589
 			} else {
1590 1590
 				EE_Error::add_error(
1591
-					__( 'Valid Payment data could not be retrieved from the database.', 'event_espresso' ),
1591
+					__('Valid Payment data could not be retrieved from the database.', 'event_espresso'),
1592 1592
 					__FILE__, __FUNCTION__, __LINE__
1593 1593
 				);
1594 1594
 			}
1595 1595
 		} else {
1596 1596
 			EE_Error::add_error(
1597
-				__( 'A valid Payment ID was not received, therefore payment form data could not be loaded.', 'event_espresso' ),
1597
+				__('A valid Payment ID was not received, therefore payment form data could not be loaded.', 'event_espresso'),
1598 1598
 				__FILE__, __FUNCTION__, __LINE__
1599 1599
 			);
1600 1600
 		}
1601
-		$notices = EE_Error::get_notices( false, false, false);
1601
+		$notices = EE_Error::get_notices(false, false, false);
1602 1602
 		$this->_template_args = array(
1603 1603
 			'data' => $json_response_data,
1604 1604
 			'success' => $notices['success'],
@@ -1618,17 +1618,17 @@  discard block
 block discarded – undo
1618 1618
 	 * @param array $REG_IDs
1619 1619
 	 * @return array
1620 1620
 	 */
1621
-	protected function _registration_payment_data_array( $REG_IDs ) {
1621
+	protected function _registration_payment_data_array($REG_IDs) {
1622 1622
 		$registration_payment_data = array();
1623 1623
 		//if non empty reg_ids lets get an array of registrations and update the values for the apply_payment/refund rows.
1624
-		if ( ! empty( $REG_IDs ) ) {
1625
-			EE_Registry::instance()->load_helper( 'Template' );
1626
-			$registrations = EEM_Registration::instance()->get_all( array( array( 'REG_ID' => array( 'IN', $REG_IDs ) ) ) );
1627
-			foreach ( $registrations as $registration ) {
1628
-				if ( $registration instanceof EE_Registration ) {
1629
-					$registration_payment_data[ $registration->ID() ] = array(
1624
+		if ( ! empty($REG_IDs)) {
1625
+			EE_Registry::instance()->load_helper('Template');
1626
+			$registrations = EEM_Registration::instance()->get_all(array(array('REG_ID' => array('IN', $REG_IDs))));
1627
+			foreach ($registrations as $registration) {
1628
+				if ($registration instanceof EE_Registration) {
1629
+					$registration_payment_data[$registration->ID()] = array(
1630 1630
 						'paid' => $registration->pretty_paid(),
1631
-						'owing' => EEH_Template::format_currency( $registration->final_price() - $registration->paid() ),
1631
+						'owing' => EEH_Template::format_currency($registration->final_price() - $registration->paid()),
1632 1632
 					);
1633 1633
 				}
1634 1634
 			}
@@ -1648,30 +1648,30 @@  discard block
 block discarded – undo
1648 1648
 	 * @access protected
1649 1649
 	 * @param \EE_Payment | null $payment
1650 1650
 	 */
1651
-	protected function _maybe_send_notifications( $payment = null ) {
1652
-		switch ( $payment instanceof EE_Payment ) {
1651
+	protected function _maybe_send_notifications($payment = null) {
1652
+		switch ($payment instanceof EE_Payment) {
1653 1653
 			// payment notifications
1654 1654
 			case true :
1655 1655
 				if (
1656 1656
 					isset(
1657
-						$this->_req_data[ 'txn_payments' ],
1658
-						$this->_req_data[ 'txn_payments' ][ 'send_notifications' ]
1657
+						$this->_req_data['txn_payments'],
1658
+						$this->_req_data['txn_payments']['send_notifications']
1659 1659
 					) &&
1660
-					filter_var( $this->_req_data[ 'txn_payments' ][ 'send_notifications' ], FILTER_VALIDATE_BOOLEAN )
1660
+					filter_var($this->_req_data['txn_payments']['send_notifications'], FILTER_VALIDATE_BOOLEAN)
1661 1661
 				) {
1662
-					$this->_process_payment_notification( $payment );
1662
+					$this->_process_payment_notification($payment);
1663 1663
 				}
1664 1664
 				break;
1665 1665
 			// registration notifications
1666 1666
 			case false :
1667 1667
 				if (
1668 1668
 					isset(
1669
-						$this->_req_data[ 'txn_reg_status_change' ],
1670
-						$this->_req_data[ 'txn_reg_status_change' ][ 'send_notifications' ]
1669
+						$this->_req_data['txn_reg_status_change'],
1670
+						$this->_req_data['txn_reg_status_change']['send_notifications']
1671 1671
 					) &&
1672
-					filter_var( $this->_req_data[ 'txn_reg_status_change' ][ 'send_notifications' ], FILTER_VALIDATE_BOOLEAN )
1672
+					filter_var($this->_req_data['txn_reg_status_change']['send_notifications'], FILTER_VALIDATE_BOOLEAN)
1673 1673
 				) {
1674
-					add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true' );
1674
+					add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true');
1675 1675
 				}
1676 1676
 				break;
1677 1677
 		}
@@ -1687,11 +1687,11 @@  discard block
 block discarded – undo
1687 1687
 	*	@return void
1688 1688
 	*/
1689 1689
 	protected function _send_payment_reminder() {
1690
-	    $TXN_ID = ( ! empty( $this->_req_data['TXN_ID'] )) ? absint( $this->_req_data['TXN_ID'] ) : FALSE;
1691
-		$transaction = EEM_Transaction::instance()->get_one_by_ID( $TXN_ID );
1692
-		$query_args = isset($this->_req_data['redirect_to'] ) ? array('action' => $this->_req_data['redirect_to'], 'TXN_ID' => $this->_req_data['TXN_ID'] ) : array();
1693
-		do_action( 'AHEE__Transactions_Admin_Page___send_payment_reminder__process_admin_payment_reminder', $transaction );
1694
-		$this->_redirect_after_action( FALSE, __('payment reminder', 'event_espresso'), __('sent', 'event_espresso'), $query_args, TRUE );
1690
+	    $TXN_ID = ( ! empty($this->_req_data['TXN_ID'])) ? absint($this->_req_data['TXN_ID']) : FALSE;
1691
+		$transaction = EEM_Transaction::instance()->get_one_by_ID($TXN_ID);
1692
+		$query_args = isset($this->_req_data['redirect_to']) ? array('action' => $this->_req_data['redirect_to'], 'TXN_ID' => $this->_req_data['TXN_ID']) : array();
1693
+		do_action('AHEE__Transactions_Admin_Page___send_payment_reminder__process_admin_payment_reminder', $transaction);
1694
+		$this->_redirect_after_action(FALSE, __('payment reminder', 'event_espresso'), __('sent', 'event_espresso'), $query_args, TRUE);
1695 1695
 	}
1696 1696
 
1697 1697
 
@@ -1705,36 +1705,36 @@  discard block
 block discarded – undo
1705 1705
 	 * @param string   $view
1706 1706
 	 * @return mixed int = count || array of transaction objects
1707 1707
 	 */
1708
-	public function get_transactions( $perpage, $count = FALSE, $view = '' ) {
1708
+	public function get_transactions($perpage, $count = FALSE, $view = '') {
1709 1709
 
1710 1710
 		$TXN = EEM_Transaction::instance();
1711 1711
 
1712
-	    $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' ));
1713
-	    $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' );
1712
+	    $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'));
1713
+	    $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');
1714 1714
 
1715 1715
 	    //make sure our timestamps start and end right at the boundaries for each day
1716
-	    $start_date = date( 'Y-m-d', strtotime( $start_date ) ) . ' 00:00:00';
1717
-	    $end_date = date( 'Y-m-d', strtotime( $end_date ) ) . ' 23:59:59';
1716
+	    $start_date = date('Y-m-d', strtotime($start_date)).' 00:00:00';
1717
+	    $end_date = date('Y-m-d', strtotime($end_date)).' 23:59:59';
1718 1718
 
1719 1719
 
1720 1720
 	    //convert to timestamps
1721
-	    $start_date = strtotime( $start_date );
1722
-	    $end_date = strtotime( $end_date );
1721
+	    $start_date = strtotime($start_date);
1722
+	    $end_date = strtotime($end_date);
1723 1723
 
1724 1724
 	    //makes sure start date is the lowest value and vice versa
1725
-	    $start_date = min( $start_date, $end_date );
1726
-	    $end_date = max( $start_date, $end_date );
1725
+	    $start_date = min($start_date, $end_date);
1726
+	    $end_date = max($start_date, $end_date);
1727 1727
 
1728 1728
 	    //convert to correct format for query
1729
-	$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' );
1730
-	$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' );
1729
+	$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');
1730
+	$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');
1731 1731
 
1732 1732
 
1733 1733
 
1734 1734
 	    //set orderby
1735 1735
 		$this->_req_data['orderby'] = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : '';
1736 1736
 
1737
-		switch ( $this->_req_data['orderby'] ) {
1737
+		switch ($this->_req_data['orderby']) {
1738 1738
 			case 'TXN_ID':
1739 1739
 				$orderby = 'TXN_ID';
1740 1740
 				break;
@@ -1748,66 +1748,66 @@  discard block
 block discarded – undo
1748 1748
 				$orderby = 'TXN_timestamp';
1749 1749
 		}
1750 1750
 
1751
-		$sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'DESC';
1752
-		$current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1;
1753
-		$per_page = isset( $perpage ) && !empty( $perpage ) ? $perpage : 10;
1754
-		$per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page;
1751
+		$sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'DESC';
1752
+		$current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1;
1753
+		$per_page = isset($perpage) && ! empty($perpage) ? $perpage : 10;
1754
+		$per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page;
1755 1755
 
1756
-		$offset = ($current_page-1)*$per_page;
1757
-		$limit = array( $offset, $per_page );
1756
+		$offset = ($current_page - 1) * $per_page;
1757
+		$limit = array($offset, $per_page);
1758 1758
 
1759 1759
 		$_where = array(
1760
-			'TXN_timestamp' => array('BETWEEN', array($start_date, $end_date) ),
1760
+			'TXN_timestamp' => array('BETWEEN', array($start_date, $end_date)),
1761 1761
 			'Registration.REG_count' => 1
1762 1762
 		);
1763 1763
 
1764
-		if ( isset( $this->_req_data['EVT_ID'] ) ) {
1764
+		if (isset($this->_req_data['EVT_ID'])) {
1765 1765
 			$_where['Registration.EVT_ID'] = $this->_req_data['EVT_ID'];
1766 1766
 		}
1767 1767
 
1768
-		if ( isset( $this->_req_data['s'] ) ) {
1769
-			$search_string = '%' . $this->_req_data['s'] . '%';
1768
+		if (isset($this->_req_data['s'])) {
1769
+			$search_string = '%'.$this->_req_data['s'].'%';
1770 1770
 			$_where['OR'] = array(
1771
-				'Registration.Event.EVT_name' => array( 'LIKE', $search_string ),
1772
-				'Registration.Event.EVT_desc' => array( 'LIKE', $search_string ),
1773
-				'Registration.Event.EVT_short_desc' => array( 'LIKE' , $search_string ),
1774
-				'Registration.Attendee.ATT_full_name' => array( 'LIKE', $search_string ),
1775
-				'Registration.Attendee.ATT_fname' => array( 'LIKE', $search_string ),
1776
-				'Registration.Attendee.ATT_lname' => array( 'LIKE', $search_string ),
1777
-				'Registration.Attendee.ATT_short_bio' => array( 'LIKE', $search_string ),
1778
-				'Registration.Attendee.ATT_email' => array('LIKE', $search_string ),
1779
-				'Registration.Attendee.ATT_address' => array( 'LIKE', $search_string ),
1780
-				'Registration.Attendee.ATT_address2' => array( 'LIKE', $search_string ),
1781
-				'Registration.Attendee.ATT_city' => array( 'LIKE', $search_string ),
1782
-				'Registration.REG_final_price' => array( 'LIKE', $search_string ),
1783
-				'Registration.REG_code' => array( 'LIKE', $search_string ),
1784
-				'Registration.REG_count' => array( 'LIKE' , $search_string ),
1785
-				'Registration.REG_group_size' => array( 'LIKE' , $search_string ),
1786
-				'Registration.Ticket.TKT_name' => array( 'LIKE', $search_string ),
1787
-				'Registration.Ticket.TKT_description' => array( 'LIKE', $search_string ),
1788
-				'Payment.PAY_source' => array('LIKE', $search_string ),
1789
-				'Payment.Payment_Method.PMD_name' => array('LIKE', $search_string ),
1790
-				'TXN_session_data' => array( 'LIKE', $search_string ),
1791
-				'Payment.PAY_txn_id_chq_nmbr' => array( 'LIKE', $search_string )
1771
+				'Registration.Event.EVT_name' => array('LIKE', $search_string),
1772
+				'Registration.Event.EVT_desc' => array('LIKE', $search_string),
1773
+				'Registration.Event.EVT_short_desc' => array('LIKE', $search_string),
1774
+				'Registration.Attendee.ATT_full_name' => array('LIKE', $search_string),
1775
+				'Registration.Attendee.ATT_fname' => array('LIKE', $search_string),
1776
+				'Registration.Attendee.ATT_lname' => array('LIKE', $search_string),
1777
+				'Registration.Attendee.ATT_short_bio' => array('LIKE', $search_string),
1778
+				'Registration.Attendee.ATT_email' => array('LIKE', $search_string),
1779
+				'Registration.Attendee.ATT_address' => array('LIKE', $search_string),
1780
+				'Registration.Attendee.ATT_address2' => array('LIKE', $search_string),
1781
+				'Registration.Attendee.ATT_city' => array('LIKE', $search_string),
1782
+				'Registration.REG_final_price' => array('LIKE', $search_string),
1783
+				'Registration.REG_code' => array('LIKE', $search_string),
1784
+				'Registration.REG_count' => array('LIKE', $search_string),
1785
+				'Registration.REG_group_size' => array('LIKE', $search_string),
1786
+				'Registration.Ticket.TKT_name' => array('LIKE', $search_string),
1787
+				'Registration.Ticket.TKT_description' => array('LIKE', $search_string),
1788
+				'Payment.PAY_source' => array('LIKE', $search_string),
1789
+				'Payment.Payment_Method.PMD_name' => array('LIKE', $search_string),
1790
+				'TXN_session_data' => array('LIKE', $search_string),
1791
+				'Payment.PAY_txn_id_chq_nmbr' => array('LIKE', $search_string)
1792 1792
 				);
1793 1793
 		}
1794 1794
 
1795 1795
 		//failed transactions
1796
-		$failed = ( ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] == 'failed' && ! $count ) || ( $count && $view == 'failed' ) ? TRUE: FALSE;
1797
-		$abandoned = ( ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] == 'abandoned' && ! $count ) || ( $count && $view == 'abandoned' ) ? TRUE: FALSE;
1796
+		$failed = ( ! empty($this->_req_data['status']) && $this->_req_data['status'] == 'failed' && ! $count) || ($count && $view == 'failed') ? TRUE : FALSE;
1797
+		$abandoned = ( ! empty($this->_req_data['status']) && $this->_req_data['status'] == 'abandoned' && ! $count) || ($count && $view == 'abandoned') ? TRUE : FALSE;
1798 1798
 
1799
-		if ( $failed ) {
1800
-			$_where[ 'STS_ID' ] = EEM_Transaction::failed_status_code;
1801
-		} else if ( $abandoned ) {
1799
+		if ($failed) {
1800
+			$_where['STS_ID'] = EEM_Transaction::failed_status_code;
1801
+		} else if ($abandoned) {
1802 1802
 				$_where['STS_ID'] = EEM_Transaction::abandoned_status_code;
1803 1803
 		} else {
1804
-				$_where['STS_ID'] = array( '!=', EEM_Transaction::failed_status_code );
1805
-				$_where['STS_ID*'] = array( '!=', EEM_Transaction::abandoned_status_code );
1804
+				$_where['STS_ID'] = array('!=', EEM_Transaction::failed_status_code);
1805
+				$_where['STS_ID*'] = array('!=', EEM_Transaction::abandoned_status_code);
1806 1806
 		}
1807 1807
 
1808
-		$query_params = array( $_where, 'order_by' => array( $orderby => $sort ), 'limit' => $limit );
1808
+		$query_params = array($_where, 'order_by' => array($orderby => $sort), 'limit' => $limit);
1809 1809
 
1810
-		$transactions = $count ? $TXN->count( array($_where), 'TXN_ID', TRUE ) : $TXN->get_all($query_params);
1810
+		$transactions = $count ? $TXN->count(array($_where), 'TXN_ID', TRUE) : $TXN->get_all($query_params);
1811 1811
 
1812 1812
 
1813 1813
 		return $transactions;
Please login to merge, or discard this patch.
Indentation   +80 added lines, -80 removed lines patch added patch discarded remove patch
@@ -1,26 +1,26 @@  discard block
 block discarded – undo
1 1
 <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
2 2
 /**
3
- * Event Espresso
4
- *
5
- * Event Registration and Management Plugin for WordPress
6
- *
7
- * @ package			Event Espresso
8
- * @ author				Seth Shoultes
9
- * @ copyright		(c) 2008-2011 Event Espresso  All Rights Reserved.
10
- * @ license			{@link http://eventespresso.com/support/terms-conditions/}   * see Plugin Licensing *
11
- * @ link					{@link http://www.eventespresso.com}
12
- * @ since		 		4.0
13
- *
14
- * ------------------------------------------------------------------------
15
- *
16
- * EE_Admin_Transactions class
17
- *
18
- * @package			Event Espresso
19
- * @subpackage	includes/core/admin/transactions/Transactions_Admin_Page.core.php
20
- * @author				Brent Christensen
21
- *
22
- * ------------------------------------------------------------------------
23
- */
3
+	 * Event Espresso
4
+	 *
5
+	 * Event Registration and Management Plugin for WordPress
6
+	 *
7
+	 * @ package			Event Espresso
8
+	 * @ author				Seth Shoultes
9
+	 * @ copyright		(c) 2008-2011 Event Espresso  All Rights Reserved.
10
+	 * @ license			{@link http://eventespresso.com/support/terms-conditions/}   * see Plugin Licensing *
11
+	 * @ link					{@link http://www.eventespresso.com}
12
+	 * @ since		 		4.0
13
+	 *
14
+	 * ------------------------------------------------------------------------
15
+	 *
16
+	 * EE_Admin_Transactions class
17
+	 *
18
+	 * @package			Event Espresso
19
+	 * @subpackage	includes/core/admin/transactions/Transactions_Admin_Page.core.php
20
+	 * @author				Brent Christensen
21
+	 *
22
+	 * ------------------------------------------------------------------------
23
+	 */
24 24
 class Transactions_Admin_Page extends EE_Admin_Page {
25 25
 
26 26
 	/**
@@ -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();
@@ -261,10 +261,10 @@  discard block
 block discarded – undo
261 261
 	/**
262 262
 	 * _set_transaction_status_array
263 263
 	 * sets list of transaction statuses
264
-	*
264
+	 *
265 265
 	 * @access private
266
-	*	@return void
267
-	*/
266
+	 *	@return void
267
+	 */
268 268
 	private function _set_transaction_status_array() {
269 269
 		self::$_txn_status = EEM_Transaction::instance()->status_array(TRUE);
270 270
 	}
@@ -286,10 +286,10 @@  discard block
 block discarded – undo
286 286
 
287 287
 	/**
288 288
 	 * 	get list of payment statuses
289
-	*
289
+	 *
290 290
 	 * @access private
291
-	*	@return void
292
-	*/
291
+	 *	@return void
292
+	 */
293 293
 	private function _get_payment_status_array() {
294 294
 		self::$_pay_status = EEM_Payment::instance()->status_array(TRUE);
295 295
 		$this->_template_args['payment_status'] = self::$_pay_status;
@@ -397,18 +397,18 @@  discard block
 block discarded – undo
397 397
 		if ( is_object( $this->_transaction) )
398 398
 			return; //get out we've already set the object
399 399
 
400
-	    $TXN = EEM_Transaction::instance();
400
+		$TXN = EEM_Transaction::instance();
401 401
 
402
-	    $TXN_ID = ( ! empty( $this->_req_data['TXN_ID'] )) ? absint( $this->_req_data['TXN_ID'] ) : FALSE;
402
+		$TXN_ID = ( ! empty( $this->_req_data['TXN_ID'] )) ? absint( $this->_req_data['TXN_ID'] ) : FALSE;
403 403
 
404
-	    //get transaction object
405
-	    $this->_transaction = $TXN->get_one_by_ID($TXN_ID);
406
-	    $this->_session = !empty( $this->_transaction ) ? $this->_transaction->get('TXN_session_data') : NULL;
404
+		//get transaction object
405
+		$this->_transaction = $TXN->get_one_by_ID($TXN_ID);
406
+		$this->_session = !empty( $this->_transaction ) ? $this->_transaction->get('TXN_session_data') : NULL;
407 407
 
408 408
 	 	if ( empty( $this->_transaction ) ) {
409
-	    	$error_msg = __('An error occurred and the details for Transaction ID #', 'event_espresso') . $TXN_ID .  __(' could not be retrieved.', 'event_espresso');
409
+			$error_msg = __('An error occurred and the details for Transaction ID #', 'event_espresso') . $TXN_ID .  __(' could not be retrieved.', 'event_espresso');
410 410
 			EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ );
411
-	    }
411
+		}
412 412
 	}
413 413
 
414 414
 
@@ -510,12 +510,12 @@  discard block
 block discarded – undo
510 510
 
511 511
 
512 512
 	/**
513
-	* 	_transaction_details
513
+	 * 	_transaction_details
514 514
 	 * generates HTML for the View Transaction Details Admin page
515
-	*
515
+	 *
516 516
 	 * @access protected
517
-	*	@return void
518
-	*/
517
+	 *	@return void
518
+	 */
519 519
 	protected function _transaction_details() {
520 520
 		do_action( 'AHEE__Transactions_Admin_Page__transaction_details__start', $this->_transaction );
521 521
 		EE_Registry::instance()->load_helper( 'MSG_Template' );
@@ -568,7 +568,7 @@  discard block
 block discarded – undo
568 568
 						'button secondary-button right',
569 569
 						'dashicons dashicons-email-alt'
570 570
 					)
571
-				    : '';
571
+					: '';
572 572
 		} else {
573 573
 			$this->_template_args['send_payment_reminder_button'] = '';
574 574
 		}
@@ -722,10 +722,10 @@  discard block
 block discarded – undo
722 722
 	/**
723 723
 	 * txn_details_meta_box
724 724
 	 * generates HTML for the Transaction main meta box
725
-	*
725
+	 *
726 726
 	 * @access public
727
-	*	@return void
728
-	*/
727
+	 *	@return void
728
+	 */
729 729
 	public function txn_details_meta_box() {
730 730
 
731 731
 		$this->_set_transaction_object();
@@ -1066,10 +1066,10 @@  discard block
 block discarded – undo
1066 1066
 	/**
1067 1067
 	 * txn_billing_info_side_meta_box
1068 1068
 	 * 	generates HTML for the Edit Transaction side meta box
1069
-	*
1069
+	 *
1070 1070
 	 * @access public
1071
-	*	@return void
1072
-	*/
1071
+	 *	@return void
1072
+	 */
1073 1073
 	public function txn_billing_info_side_meta_box() {
1074 1074
 
1075 1075
 		$this->_template_args['billing_form'] = $this->_transaction->billing_info();
@@ -1087,10 +1087,10 @@  discard block
 block discarded – undo
1087 1087
 	/**
1088 1088
 	 * apply_payments_or_refunds
1089 1089
 	 * 	registers a payment or refund made towards a transaction
1090
-	*
1090
+	 *
1091 1091
 	 * @access public
1092
-	*	@return void
1093
-	*/
1092
+	 *	@return void
1093
+	 */
1094 1094
 	public function apply_payments_or_refunds() {
1095 1095
 		$json_response_data = array( 'return_data' => FALSE );
1096 1096
 		$valid_data = $this->_validate_payment_request_data();
@@ -1244,9 +1244,9 @@  discard block
 block discarded – undo
1244 1244
 							'default' => '',
1245 1245
 							'required' => false,
1246 1246
 							'html_label_text' => __( 'Transaction or Cheque Number', 'event_espresso' ),
1247
-                                                        'validation_strategies' => array(
1248
-                                                            new EE_Max_Length_Validation_Strategy( __('Input too long', 'event_espresso'), 100 ),
1249
-                                                        )
1247
+														'validation_strategies' => array(
1248
+															new EE_Max_Length_Validation_Strategy( __('Input too long', 'event_espresso'), 100 ),
1249
+														)
1250 1250
 						)
1251 1251
 					),
1252 1252
 					'po_number' => new EE_Text_Input(
@@ -1254,9 +1254,9 @@  discard block
 block discarded – undo
1254 1254
 							'default' => '',
1255 1255
 							'required' => false,
1256 1256
 							'html_label_text' => __( 'Purchase Order Number', 'event_espresso' ),
1257
-                                                        'validation_strategies' => array(
1258
-                                                            new EE_Max_Length_Validation_Strategy( __('Input too long', 'event_espresso'), 100 ),
1259
-                                                        )
1257
+														'validation_strategies' => array(
1258
+															new EE_Max_Length_Validation_Strategy( __('Input too long', 'event_espresso'), 100 ),
1259
+														)
1260 1260
 						)
1261 1261
 					),
1262 1262
 					'accounting' => new EE_Text_Input(
@@ -1264,9 +1264,9 @@  discard block
 block discarded – undo
1264 1264
 							'default' => '',
1265 1265
 							'required' => false,
1266 1266
 							'html_label_text' => __( 'Extra Field for Accounting', 'event_espresso' ),
1267
-                                                        'validation_strategies' => array(
1268
-                                                            new EE_Max_Length_Validation_Strategy( __('Input too long', 'event_espresso'), 100 ),
1269
-                                                        )
1267
+														'validation_strategies' => array(
1268
+															new EE_Max_Length_Validation_Strategy( __('Input too long', 'event_espresso'), 100 ),
1269
+														)
1270 1270
 						)
1271 1271
 					),
1272 1272
 				)
@@ -1561,10 +1561,10 @@  discard block
 block discarded – undo
1561 1561
 	/**
1562 1562
 	 * delete_payment
1563 1563
 	 * 	delete a payment or refund made towards a transaction
1564
-	*
1564
+	 *
1565 1565
 	 * @access public
1566
-	*	@return void
1567
-	*/
1566
+	 *	@return void
1567
+	 */
1568 1568
 	public function delete_payment() {
1569 1569
 		$json_response_data = array( 'return_data' => FALSE );
1570 1570
 		$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;
@@ -1682,12 +1682,12 @@  discard block
 block discarded – undo
1682 1682
 	/**
1683 1683
 	 * _send_payment_reminder
1684 1684
 	 * 	generates HTML for the View Transaction Details Admin page
1685
-	*
1685
+	 *
1686 1686
 	 * @access protected
1687
-	*	@return void
1688
-	*/
1687
+	 *	@return void
1688
+	 */
1689 1689
 	protected function _send_payment_reminder() {
1690
-	    $TXN_ID = ( ! empty( $this->_req_data['TXN_ID'] )) ? absint( $this->_req_data['TXN_ID'] ) : FALSE;
1690
+		$TXN_ID = ( ! empty( $this->_req_data['TXN_ID'] )) ? absint( $this->_req_data['TXN_ID'] ) : FALSE;
1691 1691
 		$transaction = EEM_Transaction::instance()->get_one_by_ID( $TXN_ID );
1692 1692
 		$query_args = isset($this->_req_data['redirect_to'] ) ? array('action' => $this->_req_data['redirect_to'], 'TXN_ID' => $this->_req_data['TXN_ID'] ) : array();
1693 1693
 		do_action( 'AHEE__Transactions_Admin_Page___send_payment_reminder__process_admin_payment_reminder', $transaction );
@@ -1709,29 +1709,29 @@  discard block
 block discarded – undo
1709 1709
 
1710 1710
 		$TXN = EEM_Transaction::instance();
1711 1711
 
1712
-	    $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' ));
1713
-	    $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' );
1712
+		$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' ));
1713
+		$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' );
1714 1714
 
1715
-	    //make sure our timestamps start and end right at the boundaries for each day
1716
-	    $start_date = date( 'Y-m-d', strtotime( $start_date ) ) . ' 00:00:00';
1717
-	    $end_date = date( 'Y-m-d', strtotime( $end_date ) ) . ' 23:59:59';
1715
+		//make sure our timestamps start and end right at the boundaries for each day
1716
+		$start_date = date( 'Y-m-d', strtotime( $start_date ) ) . ' 00:00:00';
1717
+		$end_date = date( 'Y-m-d', strtotime( $end_date ) ) . ' 23:59:59';
1718 1718
 
1719 1719
 
1720
-	    //convert to timestamps
1721
-	    $start_date = strtotime( $start_date );
1722
-	    $end_date = strtotime( $end_date );
1720
+		//convert to timestamps
1721
+		$start_date = strtotime( $start_date );
1722
+		$end_date = strtotime( $end_date );
1723 1723
 
1724
-	    //makes sure start date is the lowest value and vice versa
1725
-	    $start_date = min( $start_date, $end_date );
1726
-	    $end_date = max( $start_date, $end_date );
1724
+		//makes sure start date is the lowest value and vice versa
1725
+		$start_date = min( $start_date, $end_date );
1726
+		$end_date = max( $start_date, $end_date );
1727 1727
 
1728
-	    //convert to correct format for query
1728
+		//convert to correct format for query
1729 1729
 	$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' );
1730 1730
 	$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' );
1731 1731
 
1732 1732
 
1733 1733
 
1734
-	    //set orderby
1734
+		//set orderby
1735 1735
 		$this->_req_data['orderby'] = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : '';
1736 1736
 
1737 1737
 		switch ( $this->_req_data['orderby'] ) {
Please login to merge, or discard this patch.