Completed
Branch BETA-4.9-message-activity (c2a8e0)
by
unknown
18:28 queued 10s
created
core/db_models/EEM_Registration.model.php 1 patch
Spacing   +101 added lines, -101 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,12 +128,12 @@  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' ),
132
-			'Message' => new EE_Has_Many_Any_Relation( false ) //allow deletes even if there are messages in the queue related
131
+			'Payment'=>new EE_HABTM_Relation('Registration_Payment'),
132
+			'Message' => new EE_Has_Many_Any_Relation(false) //allow deletes even if there are messages in the queue related
133 133
 		);
134 134
 		$this->_model_chain_to_wp_user = 'Event';
135 135
 
136
-		parent::__construct( $timezone );
136
+		parent::__construct($timezone);
137 137
 	}
138 138
 
139 139
 
@@ -166,9 +166,9 @@  discard block
 block discarded – undo
166 166
 	 *		@param bool  $translated If true will return the values as singular localized strings
167 167
 	 *		@return array
168 168
 	 */
169
-	public static function reg_status_array( $exclude = array(), $translated = FALSE ) {
170
-		EEM_Registration::instance()->_get_registration_status_array( $exclude );
171
-		return $translated ? EEM_Status::instance()->localized_status( self::$_reg_status, FALSE, 'sentence') : self::$_reg_status;
169
+	public static function reg_status_array($exclude = array(), $translated = FALSE) {
170
+		EEM_Registration::instance()->_get_registration_status_array($exclude);
171
+		return $translated ? EEM_Status::instance()->localized_status(self::$_reg_status, FALSE, 'sentence') : self::$_reg_status;
172 172
 	}
173 173
 
174 174
 
@@ -179,18 +179,18 @@  discard block
 block discarded – undo
179 179
 	 * @param array $exclude
180 180
 	 * @return array
181 181
 	 */
182
-	private function _get_registration_status_array( $exclude = array() ) {
182
+	private function _get_registration_status_array($exclude = array()) {
183 183
 		//in the very rare circumstance that we are deleting a model's table's data
184 184
 		//and the table hasn't actually been created, this could have an error
185 185
 		/** @type WPDB $wpdb */
186 186
 		global $wpdb;
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 );
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,16 +277,16 @@  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
-		$query_interval = EEH_DTT_Helper::get_sql_query_interval_for_offset( $this->get_timezone(), 'REG_date' );
289
+		$query_interval = EEH_DTT_Helper::get_sql_query_interval_for_offset($this->get_timezone(), 'REG_date');
290 290
 
291 291
 		$results = $this->_get_all_wpdb_results(
292 292
 				array(
@@ -296,8 +296,8 @@  discard block
 block discarded – undo
296 296
 				),
297 297
 				OBJECT,
298 298
 				array(
299
-					'regDate'=>array( 'DATE(' . $query_interval . ')','%s'),
300
-					'total'=>array('count(REG_ID)','%d')
299
+					'regDate'=>array('DATE('.$query_interval.')', '%s'),
300
+					'total'=>array('count(REG_ID)', '%d')
301 301
 				));
302 302
 		return $results;
303 303
 	}
@@ -312,22 +312,22 @@  discard block
 block discarded – undo
312 312
 	 * @return stdClass[] with properties Registration_REG_date and a column for each registration status as the STS_ID
313 313
 	 *                    (i.e. RAP)
314 314
 	 */
315
-	public function get_registrations_per_day_and_per_status_report( $period = '-1 month' ) {
315
+	public function get_registrations_per_day_and_per_status_report($period = '-1 month') {
316 316
 		global $wpdb;
317
-		$registration_table = $wpdb->prefix . 'esp_registration';
317
+		$registration_table = $wpdb->prefix.'esp_registration';
318 318
 		$event_table = $wpdb->posts;
319
-		$sql_date = date("Y-m-d H:i:s", strtotime($period) );
319
+		$sql_date = date("Y-m-d H:i:s", strtotime($period));
320 320
 
321 321
 		//prepare the query interval for displaying offset
322
-		$query_interval = EEH_DTT_Helper::get_sql_query_interval_for_offset( $this->get_timezone(), 'dates.REG_date' );
322
+		$query_interval = EEH_DTT_Helper::get_sql_query_interval_for_offset($this->get_timezone(), 'dates.REG_date');
323 323
 
324 324
 		//inner date query
325 325
 		$inner_date_query = "SELECT DISTINCT REG_date from $registration_table ";
326 326
 		$inner_where = " WHERE";
327 327
 		//exclude events not authored by user if permissions in effect
328
-		if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_registrations', 'reg_per_event_report' ) ) {
328
+		if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_registrations', 'reg_per_event_report')) {
329 329
 			$inner_date_query .= "LEFT JOIN $event_table ON ID = EVT_ID";
330
-			$inner_where .= " post_author = " . get_current_user_id() . " AND";
330
+			$inner_where .= " post_author = ".get_current_user_id()." AND";
331 331
 		}
332 332
 		$inner_where .= " REG_date >= '$sql_date'";
333 333
 		$inner_date_query .= $inner_where;
@@ -339,8 +339,8 @@  discard block
 block discarded – undo
339 339
 		$select_parts = array();
340 340
 
341 341
 		//loop through registration stati to do parts for each status.
342
-		foreach ( EEM_Registration::reg_status_array() as $STS_ID => $STS_code ) {
343
-			if ( $STS_ID === EEM_Registration::status_id_incomplete ) {
342
+		foreach (EEM_Registration::reg_status_array() as $STS_ID => $STS_code) {
343
+			if ($STS_ID === EEM_Registration::status_id_incomplete) {
344 344
 				continue;
345 345
 			}
346 346
 			$select_parts[] = "COUNT($STS_code.REG_ID) as $STS_ID";
@@ -348,14 +348,14 @@  discard block
 block discarded – undo
348 348
 		}
349 349
 
350 350
 		//setup the selects
351
-		$select .= implode(', ', $select_parts );
351
+		$select .= implode(', ', $select_parts);
352 352
 		$select .= " FROM ($inner_date_query) AS dates LEFT JOIN ";
353 353
 
354 354
 		//setup the joins
355
-		$join .= implode( " LEFT JOIN ", $join_parts );
355
+		$join .= implode(" LEFT JOIN ", $join_parts);
356 356
 
357 357
 		//now let's put it all together
358
-		$query = $select . $join . ' GROUP BY Registration_REG_date';
358
+		$query = $select.$join.' GROUP BY Registration_REG_date';
359 359
 
360 360
 		//and execute it
361 361
 		$results = $wpdb->get_results(
@@ -376,23 +376,23 @@  discard block
 block discarded – undo
376 376
 	 * @param $period string which can be passed to php's strtotime function (eg "-1 month")
377 377
 	 *		@return stdClass[] each with properties event_name, reg_limit, and total
378 378
 	*/
379
-	public function get_registrations_per_event_report( $period = '-1 month' ) {
379
+	public function get_registrations_per_event_report($period = '-1 month') {
380 380
 
381
-		$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' );
382
-		$where = array( 'REG_date' => array( '>=', $date_sql ), 'STS_ID' => array( '!=', EEM_Registration::status_id_incomplete ) );
381
+		$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');
382
+		$where = array('REG_date' => array('>=', $date_sql), 'STS_ID' => array('!=', EEM_Registration::status_id_incomplete));
383 383
 
384
-		if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_registrations', 'reg_per_event_report' ) ) {
384
+		if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_registrations', 'reg_per_event_report')) {
385 385
 			$where['Event.EVT_wp_user'] = get_current_user_id();
386 386
 		}
387 387
 		$results = $this->_get_all_wpdb_results(array(
388 388
 			$where,
389 389
 			'group_by'=>'Event.EVT_name',
390 390
 			'order_by'=>'Event.EVT_name',
391
-			'limit'=>array(0,24)),
391
+			'limit'=>array(0, 24)),
392 392
 			OBJECT,
393 393
 			array(
394
-				'event_name'=>array('Event_CPT.post_title','%s'),
395
-				'total'=>array('COUNT(REG_ID)','%s')
394
+				'event_name'=>array('Event_CPT.post_title', '%s'),
395
+				'total'=>array('COUNT(REG_ID)', '%s')
396 396
 			)
397 397
 		);
398 398
 
@@ -410,19 +410,19 @@  discard block
 block discarded – undo
410 410
 	 * @return stdClass[] with properties `Registration_Event` and a column for each registration status as the STS_ID
411 411
 	 *                    (i.e. RAP)
412 412
 	 */
413
-	public function get_registrations_per_event_and_per_status_report( $period = '-1 month' ) {
413
+	public function get_registrations_per_event_and_per_status_report($period = '-1 month') {
414 414
 		global $wpdb;
415
-		$registration_table = $wpdb->prefix . 'esp_registration';
415
+		$registration_table = $wpdb->prefix.'esp_registration';
416 416
 		$event_table = $wpdb->posts;
417
-		$sql_date = date("Y-m-d H:i:s", strtotime($period) );
417
+		$sql_date = date("Y-m-d H:i:s", strtotime($period));
418 418
 
419 419
 		//inner date query
420 420
 		$inner_date_query = "SELECT DISTINCT EVT_ID, REG_date from $registration_table ";
421 421
 		$inner_where = " WHERE";
422 422
 		//exclude events not authored by user if permissions in effect
423
-		if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_registrations', 'reg_per_event_report' ) ) {
423
+		if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_registrations', 'reg_per_event_report')) {
424 424
 			$inner_date_query .= "LEFT JOIN $event_table ON ID = EVT_ID";
425
-			$inner_where .= " post_author = " . get_current_user_id() . " AND";
425
+			$inner_where .= " post_author = ".get_current_user_id()." AND";
426 426
 		}
427 427
 		$inner_where .= " REG_date >= '$sql_date'";
428 428
 		$inner_date_query .= $inner_where;
@@ -434,8 +434,8 @@  discard block
 block discarded – undo
434 434
 		$select_parts = array();
435 435
 
436 436
 		//loop through registration stati to do parts for each status.
437
-		foreach ( EEM_Registration::reg_status_array() as $STS_ID => $STS_code ) {
438
-			if ( $STS_ID === EEM_Registration::status_id_incomplete ) {
437
+		foreach (EEM_Registration::reg_status_array() as $STS_ID => $STS_code) {
438
+			if ($STS_ID === EEM_Registration::status_id_incomplete) {
439 439
 				continue;
440 440
 			}
441 441
 			$select_parts[] = "COUNT($STS_code.REG_ID) as $STS_ID";
@@ -443,14 +443,14 @@  discard block
 block discarded – undo
443 443
 		}
444 444
 
445 445
 		//setup the selects
446
-		$select .= implode( ', ', $select_parts );
446
+		$select .= implode(', ', $select_parts);
447 447
 		$select .= " FROM ($inner_date_query) AS dates LEFT JOIN $event_table as Event ON Event.ID = dates.EVT_ID LEFT JOIN ";
448 448
 
449 449
 		//setup remaining joins
450
-		$join .= implode( " LEFT JOIN ", $join_parts );
450
+		$join .= implode(" LEFT JOIN ", $join_parts);
451 451
 
452 452
 		//now put it all together
453
-		$query = $select . $join . ' GROUP BY Registration_Event';
453
+		$query = $select.$join.' GROUP BY Registration_Event';
454 454
 
455 455
 		//and execute
456 456
 		$results = $wpdb->get_results(
@@ -466,11 +466,11 @@  discard block
 block discarded – undo
466 466
 	 * @param int $TXN_ID
467 467
 	 * @return EE_Registration
468 468
 	 */
469
-	public function get_primary_registration_for_transaction_ID( $TXN_ID = 0){
470
-		if( ! $TXN_ID ){
469
+	public function get_primary_registration_for_transaction_ID($TXN_ID = 0) {
470
+		if ( ! $TXN_ID) {
471 471
 			return false;
472 472
 		}
473
-		return $this->get_one(array(array('TXN_ID'=>$TXN_ID,'REG_count'=>  EEM_Registration::PRIMARY_REGISTRANT_COUNT)));
473
+		return $this->get_one(array(array('TXN_ID'=>$TXN_ID, 'REG_count'=>  EEM_Registration::PRIMARY_REGISTRANT_COUNT)));
474 474
 	}
475 475
 
476 476
 
@@ -482,11 +482,11 @@  discard block
 block discarded – undo
482 482
 	 *		@param boolean $for_incomplete_payments
483 483
 	 *		@return int
484 484
 	 */
485
-	public function get_event_registration_count ( $EVT_ID, $for_incomplete_payments = FALSE ) {
485
+	public function get_event_registration_count($EVT_ID, $for_incomplete_payments = FALSE) {
486 486
 		// we only count approved registrations towards registration limits
487
-		$query_params = array( array( 'EVT_ID' => $EVT_ID, 'STS_ID' => self::status_id_approved ) );
488
-		if( $for_incomplete_payments ){
489
-			$query_params[0]['Transaction.STS_ID']=array('!=',  EEM_Transaction::complete_status_code);
487
+		$query_params = array(array('EVT_ID' => $EVT_ID, 'STS_ID' => self::status_id_approved));
488
+		if ($for_incomplete_payments) {
489
+			$query_params[0]['Transaction.STS_ID'] = array('!=', EEM_Transaction::complete_status_code);
490 490
 		}
491 491
 
492 492
 		return $this->count($query_params);
@@ -502,7 +502,7 @@  discard block
 block discarded – undo
502 502
 		/** @type WPDB $wpdb */
503 503
 		global $wpdb;
504 504
 		return $wpdb->query(
505
-				'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' );
505
+				'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' );
506 506
 	}
507 507
 
508 508
 	/**
@@ -512,7 +512,7 @@  discard block
 block discarded – undo
512 512
 	 * @param boolean $checked_in whether to count registrations checked IN or OUT
513 513
 	 * @return int
514 514
 	 */
515
-	public function count_registrations_checked_into_datetime( $DTT_ID, $checked_in = true) {
515
+	public function count_registrations_checked_into_datetime($DTT_ID, $checked_in = true) {
516 516
 		return $this->count(
517 517
 			array(
518 518
 				array(
@@ -530,7 +530,7 @@  discard block
 block discarded – undo
530 530
 	 * @param boolean $checked_in whether to count registrations checked IN or OUT
531 531
 	 * @return int
532 532
 	 */
533
-	public function count_registrations_checked_into_event( $EVT_ID, $checked_in = true ) {
533
+	public function count_registrations_checked_into_event($EVT_ID, $checked_in = true) {
534 534
 		return $this->count(
535 535
 			array(
536 536
 				array(
@@ -553,15 +553,15 @@  discard block
 block discarded – undo
553 553
 	 * @param array $attendee_ids
554 554
 	 * @return EE_Registration[]
555 555
 	 */
556
-	public function get_latest_registration_for_each_of_given_contacts( $attendee_ids = array() ) {
556
+	public function get_latest_registration_for_each_of_given_contacts($attendee_ids = array()) {
557 557
 		//first do a native wp_query to get the latest REG_ID's matching these attendees.
558 558
 		global $wpdb;
559
-		$registration_table = $wpdb->prefix . 'esp_registration';
559
+		$registration_table = $wpdb->prefix.'esp_registration';
560 560
 		$attendee_table = $wpdb->posts;
561
-		$attendee_ids = is_array( $attendee_ids )
562
-			? array_map( 'absint', $attendee_ids )
563
-			: array( (int) $attendee_ids );
564
-		$attendee_ids = implode( ',', $attendee_ids );
561
+		$attendee_ids = is_array($attendee_ids)
562
+			? array_map('absint', $attendee_ids)
563
+			: array((int) $attendee_ids);
564
+		$attendee_ids = implode(',', $attendee_ids);
565 565
 
566 566
 
567 567
 		//first we do a query to get the registration ids
@@ -586,24 +586,24 @@  discard block
 block discarded – undo
586 586
 			ARRAY_A
587 587
 		);
588 588
 
589
-		if ( empty( $registration_ids ) ) {
589
+		if (empty($registration_ids)) {
590 590
 			return array();
591 591
 		}
592 592
 
593 593
 		$ids_for_model_query = array();
594 594
 		//let's flatten the ids so they can be used in the model query.
595
-		foreach ( $registration_ids as $registration_id ) {
596
-			if ( isset( $registration_id['registration_id'] ) ) {
595
+		foreach ($registration_ids as $registration_id) {
596
+			if (isset($registration_id['registration_id'])) {
597 597
 				$ids_for_model_query[] = $registration_id['registration_id'];
598 598
 			}
599 599
 		}
600 600
 
601 601
 		//construct query
602 602
 		$_where = array(
603
-			'REG_ID' => array( 'IN', $ids_for_model_query )
603
+			'REG_ID' => array('IN', $ids_for_model_query)
604 604
 		);
605 605
 
606
-		return $this->get_all( array( $_where ) );
606
+		return $this->get_all(array($_where));
607 607
 	}
608 608
 
609 609
 
Please login to merge, or discard this patch.
core/EE_System.core.php 1 patch
Spacing   +267 added lines, -267 removed lines patch added patch discarded remove patch
@@ -88,10 +88,10 @@  discard block
 block discarded – undo
88 88
 	 * @param  \EE_Registry        $Registry
89 89
 	 * @return \EE_System
90 90
 	 */
91
-	public static function instance( EE_Registry $Registry = null ) {
91
+	public static function instance(EE_Registry $Registry = null) {
92 92
 		// check if class object is instantiated
93
-		if ( ! self::$_instance instanceof EE_System ) {
94
-			self::$_instance = new self( $Registry );
93
+		if ( ! self::$_instance instanceof EE_System) {
94
+			self::$_instance = new self($Registry);
95 95
 		}
96 96
 		return self::$_instance;
97 97
 	}
@@ -101,12 +101,12 @@  discard block
 block discarded – undo
101 101
 	 * resets the instance and returns it
102 102
 	 * @return EE_System
103 103
 	 */
104
-	public static function reset(){
104
+	public static function reset() {
105 105
 		self::$_instance->_req_type = NULL;
106 106
 		//we need to reset the migration manager in order for it to detect DMSs properly
107 107
 		EE_Data_Migration_Manager::reset();
108 108
 		//make sure none of the old hooks are left hanging around
109
-		remove_all_actions( 'AHEE__EE_System__perform_activations_upgrades_and_migrations');
109
+		remove_all_actions('AHEE__EE_System__perform_activations_upgrades_and_migrations');
110 110
 		self::instance()->detect_activations_or_upgrades();
111 111
 		self::instance()->perform_activations_upgrades_and_migrations();
112 112
 		return self::instance();
@@ -122,28 +122,28 @@  discard block
 block discarded – undo
122 122
 	 * @access private
123 123
 	 * @param  \EE_Registry        $Registry
124 124
 	 */
125
-	private function __construct( EE_Registry $Registry ) {
125
+	private function __construct(EE_Registry $Registry) {
126 126
 		$this->registry = $Registry;
127
-		do_action( 'AHEE__EE_System__construct__begin', $this );
127
+		do_action('AHEE__EE_System__construct__begin', $this);
128 128
 		// allow addons to load first so that they can register autoloaders, set hooks for running DMS's, etc
129
-		add_action( 'AHEE__EE_Bootstrap__load_espresso_addons', array( $this, 'load_espresso_addons' ) );
129
+		add_action('AHEE__EE_Bootstrap__load_espresso_addons', array($this, 'load_espresso_addons'));
130 130
 		// when an ee addon is activated, we want to call the core hook(s) again
131 131
 		// because the newly-activated addon didn't get a chance to run at all
132
-		add_action( 'activate_plugin', array( $this, 'load_espresso_addons' ), 1 );
132
+		add_action('activate_plugin', array($this, 'load_espresso_addons'), 1);
133 133
 		// detect whether install or upgrade
134
-		add_action( 'AHEE__EE_Bootstrap__detect_activations_or_upgrades', array( $this, 'detect_activations_or_upgrades' ), 3 );
134
+		add_action('AHEE__EE_Bootstrap__detect_activations_or_upgrades', array($this, 'detect_activations_or_upgrades'), 3);
135 135
 		// load EE_Config, EE_Textdomain, etc
136
-		add_action( 'AHEE__EE_Bootstrap__load_core_configuration', array( $this, 'load_core_configuration' ), 5 );
136
+		add_action('AHEE__EE_Bootstrap__load_core_configuration', array($this, 'load_core_configuration'), 5);
137 137
 		// load EE_Config, EE_Textdomain, etc
138
-		add_action( 'AHEE__EE_Bootstrap__register_shortcodes_modules_and_widgets', array( $this, 'register_shortcodes_modules_and_widgets' ), 7 );
138
+		add_action('AHEE__EE_Bootstrap__register_shortcodes_modules_and_widgets', array($this, 'register_shortcodes_modules_and_widgets'), 7);
139 139
 		// you wanna get going? I wanna get going... let's get going!
140
-		add_action( 'AHEE__EE_Bootstrap__brew_espresso', array( $this, 'brew_espresso' ), 9 );
140
+		add_action('AHEE__EE_Bootstrap__brew_espresso', array($this, 'brew_espresso'), 9);
141 141
 		//other housekeeping
142 142
 		//exclude EE critical pages from wp_list_pages
143
-		add_filter( 'wp_list_pages_excludes', array( $this, 'remove_pages_from_wp_list_pages' ), 10 );
143
+		add_filter('wp_list_pages_excludes', array($this, 'remove_pages_from_wp_list_pages'), 10);
144 144
 		// ALL EE Addons should use the following hook point to attach their initial setup too
145 145
 		// it's extremely important for EE Addons to register any class autoloaders so that they can be available when the EE_Config loads
146
-		do_action( 'AHEE__EE_System__construct__complete', $this );
146
+		do_action('AHEE__EE_System__construct__complete', $this);
147 147
 	}
148 148
 
149 149
 
@@ -163,30 +163,30 @@  discard block
 block discarded – undo
163 163
 	public function load_espresso_addons() {
164 164
 		// set autoloaders for all of the classes implementing EEI_Plugin_API
165 165
 		// which provide helpers for EE plugin authors to more easily register certain components with EE.
166
-		EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder( EE_LIBRARIES . 'plugin_api' );
166
+		EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder(EE_LIBRARIES.'plugin_api');
167 167
 		//load and setup EE_Capabilities
168
-		$this->registry->load_core( 'Capabilities' );
168
+		$this->registry->load_core('Capabilities');
169 169
 		//caps need to be initialized on every request so that capability maps are set.
170 170
 		//@see https://events.codebasehq.com/projects/event-espresso/tickets/8674
171 171
 		$this->registry->CAP->init_caps();
172
-		do_action( 'AHEE__EE_System__load_espresso_addons' );
172
+		do_action('AHEE__EE_System__load_espresso_addons');
173 173
 		//if the WP API basic auth plugin isn't already loaded, load it now.
174 174
 		//We want it for mobile apps. Just include the entire plugin
175 175
 		//also, don't load the basic auth when a plugin is getting activated, because
176 176
 		//it could be the basic auth plugin, and it doesn't check if its methods are already defined
177 177
 		//and causes a fatal error
178
-		if( !function_exists( 'json_basic_auth_handler' )
179
-			&& ! function_exists( 'json_basic_auth_error' )
178
+		if ( ! function_exists('json_basic_auth_handler')
179
+			&& ! function_exists('json_basic_auth_error')
180 180
 			&& ! (
181
-				isset( $_GET[ 'action'] )
182
-				&& in_array( $_GET[ 'action' ], array( 'activate', 'activate-selected' ) )
181
+				isset($_GET['action'])
182
+				&& in_array($_GET['action'], array('activate', 'activate-selected'))
183 183
 			)
184 184
 			&& ! (
185
-				isset( $_GET['activate' ] )
186
-				&& $_GET['activate' ] === 'true'
185
+				isset($_GET['activate'])
186
+				&& $_GET['activate'] === 'true'
187 187
 			)
188 188
 		) {
189
-			include_once EE_THIRD_PARTY . 'wp-api-basic-auth' . DS . 'basic-auth.php';
189
+			include_once EE_THIRD_PARTY.'wp-api-basic-auth'.DS.'basic-auth.php';
190 190
 		}
191 191
 	}
192 192
 
@@ -202,10 +202,10 @@  discard block
 block discarded – undo
202 202
 	 * @access public
203 203
 	 * @return void
204 204
 	 */
205
-	public function detect_activations_or_upgrades(){
205
+	public function detect_activations_or_upgrades() {
206 206
 		//first off: let's make sure to handle core
207 207
 		$this->detect_if_activation_or_upgrade();
208
-		foreach($this->registry->addons as $addon){
208
+		foreach ($this->registry->addons as $addon) {
209 209
 			//detect teh request type for that addon
210 210
 			$addon->detect_activation_or_upgrade();
211 211
 		}
@@ -226,41 +226,41 @@  discard block
 block discarded – undo
226 226
 		do_action('AHEE__EE_System___detect_if_activation_or_upgrade__begin');
227 227
 
228 228
 		// load M-Mode class
229
-		$this->registry->load_core( 'Maintenance_Mode' );
229
+		$this->registry->load_core('Maintenance_Mode');
230 230
 		// check if db has been updated, or if its a brand-new installation
231 231
 
232 232
 		$espresso_db_update = $this->fix_espresso_db_upgrade_option();
233
-		$request_type =  $this->detect_req_type($espresso_db_update);
233
+		$request_type = $this->detect_req_type($espresso_db_update);
234 234
 		//EEH_Debug_Tools::printr( $request_type, '$request_type', __FILE__, __LINE__ );
235 235
 
236
-		switch($request_type){
236
+		switch ($request_type) {
237 237
 			case EE_System::req_type_new_activation:
238
-				do_action( 'AHEE__EE_System__detect_if_activation_or_upgrade__new_activation' );
239
-				$this->_handle_core_version_change( $espresso_db_update );
238
+				do_action('AHEE__EE_System__detect_if_activation_or_upgrade__new_activation');
239
+				$this->_handle_core_version_change($espresso_db_update);
240 240
 				break;
241 241
 			case EE_System::req_type_reactivation:
242
-				do_action( 'AHEE__EE_System__detect_if_activation_or_upgrade__reactivation' );
243
-				$this->_handle_core_version_change( $espresso_db_update );
242
+				do_action('AHEE__EE_System__detect_if_activation_or_upgrade__reactivation');
243
+				$this->_handle_core_version_change($espresso_db_update);
244 244
 				break;
245 245
 			case EE_System::req_type_upgrade:
246
-				do_action( 'AHEE__EE_System__detect_if_activation_or_upgrade__upgrade' );
246
+				do_action('AHEE__EE_System__detect_if_activation_or_upgrade__upgrade');
247 247
 				//migrations may be required now that we've upgraded
248 248
 				EE_Maintenance_Mode::instance()->set_maintenance_mode_if_db_old();
249
-				$this->_handle_core_version_change( $espresso_db_update );
249
+				$this->_handle_core_version_change($espresso_db_update);
250 250
 //				echo "done upgrade";die;
251 251
 				break;
252 252
 			case EE_System::req_type_downgrade:
253
-				do_action( 'AHEE__EE_System__detect_if_activation_or_upgrade__downgrade' );
253
+				do_action('AHEE__EE_System__detect_if_activation_or_upgrade__downgrade');
254 254
 				//its possible migrations are no longer required
255 255
 				EE_Maintenance_Mode::instance()->set_maintenance_mode_if_db_old();
256
-				$this->_handle_core_version_change( $espresso_db_update );
256
+				$this->_handle_core_version_change($espresso_db_update);
257 257
 				break;
258 258
 			case EE_System::req_type_normal:
259 259
 			default:
260 260
 //				$this->_maybe_redirect_to_ee_about();
261 261
 				break;
262 262
 		}
263
-		do_action( 'AHEE__EE_System__detect_if_activation_or_upgrade__complete' );
263
+		do_action('AHEE__EE_System__detect_if_activation_or_upgrade__complete');
264 264
 	}
265 265
 
266 266
 	/**
@@ -268,10 +268,10 @@  discard block
 block discarded – undo
268 268
 	 * initializing the database later during the request
269 269
 	 * @param array $espresso_db_update
270 270
 	 */
271
-	protected function _handle_core_version_change( $espresso_db_update ){
272
-		$this->update_list_of_installed_versions( $espresso_db_update );
271
+	protected function _handle_core_version_change($espresso_db_update) {
272
+		$this->update_list_of_installed_versions($espresso_db_update);
273 273
 		//get ready to verify the DB is ok (provided we aren't in maintenance mode, of course)
274
-		add_action( 'AHEE__EE_System__perform_activations_upgrades_and_migrations', array( $this, 'initialize_db_if_no_migrations_required' ));
274
+		add_action('AHEE__EE_System__perform_activations_upgrades_and_migrations', array($this, 'initialize_db_if_no_migrations_required'));
275 275
 	}
276 276
 
277 277
 
@@ -286,44 +286,44 @@  discard block
 block discarded – undo
286 286
 	 * @internal param array $espresso_db_update_value the value of the WordPress option. If not supplied, fetches it from the options table
287 287
 	 * @return array the correct value of 'espresso_db_upgrade', after saving it, if it needed correction
288 288
 	 */
289
-	private function fix_espresso_db_upgrade_option($espresso_db_update = null){
290
-		do_action( 'FHEE__EE_System__manage_fix_espresso_db_upgrade_option__begin', $espresso_db_update );
291
-		if( ! $espresso_db_update){
292
-			$espresso_db_update = get_option( 'espresso_db_update' );
289
+	private function fix_espresso_db_upgrade_option($espresso_db_update = null) {
290
+		do_action('FHEE__EE_System__manage_fix_espresso_db_upgrade_option__begin', $espresso_db_update);
291
+		if ( ! $espresso_db_update) {
292
+			$espresso_db_update = get_option('espresso_db_update');
293 293
 		}
294 294
 		// check that option is an array
295
-		if( ! is_array( $espresso_db_update )) {
295
+		if ( ! is_array($espresso_db_update)) {
296 296
 			// if option is FALSE, then it never existed
297
-			if ( $espresso_db_update === FALSE ) {
297
+			if ($espresso_db_update === FALSE) {
298 298
 				// make $espresso_db_update an array and save option with autoload OFF
299
-				$espresso_db_update =  array();
300
-				add_option( 'espresso_db_update', $espresso_db_update, '', 'no' );
299
+				$espresso_db_update = array();
300
+				add_option('espresso_db_update', $espresso_db_update, '', 'no');
301 301
 			} else {
302 302
 				// option is NOT FALSE but also is NOT an array, so make it an array and save it
303
-				$espresso_db_update =  array( $espresso_db_update=>array() );
304
-				update_option( 'espresso_db_update', $espresso_db_update );
303
+				$espresso_db_update = array($espresso_db_update=>array());
304
+				update_option('espresso_db_update', $espresso_db_update);
305 305
 			}
306
-		}else{
306
+		} else {
307 307
 			$corrected_db_update = array();
308 308
 			//if IS an array, but is it an array where KEYS are version numbers, and values are arrays?
309
-			foreach($espresso_db_update as $should_be_version_string => $should_be_array){
310
-				if(is_int($should_be_version_string) && ! is_array($should_be_array)){
309
+			foreach ($espresso_db_update as $should_be_version_string => $should_be_array) {
310
+				if (is_int($should_be_version_string) && ! is_array($should_be_array)) {
311 311
 					//the key is an int, and the value IS NOT an array
312 312
 					//so it must be numerically-indexed, where values are versions installed...
313 313
 					//fix it!
314 314
 					$version_string = $should_be_array;
315 315
 					$corrected_db_update[$version_string] = array('unknown-date');
316
-				}else{
316
+				} else {
317 317
 					//ok it checks out
318 318
 					$corrected_db_update[$should_be_version_string] = $should_be_array;
319 319
 				}
320 320
 			}
321 321
 			$espresso_db_update = $corrected_db_update;
322
-			update_option( 'espresso_db_update', $espresso_db_update );
322
+			update_option('espresso_db_update', $espresso_db_update);
323 323
 
324 324
 		}
325 325
 
326
-		do_action( 'FHEE__EE_System__manage_fix_espresso_db_upgrade_option__complete', $espresso_db_update );
326
+		do_action('FHEE__EE_System__manage_fix_espresso_db_upgrade_option__complete', $espresso_db_update);
327 327
 		return $espresso_db_update;
328 328
 	}
329 329
 
@@ -343,34 +343,34 @@  discard block
 block discarded – undo
343 343
 	 * so we prefer to only do it when necessary
344 344
 	 * @return void
345 345
 	 */
346
-	public function initialize_db_if_no_migrations_required( $initialize_addons_too = FALSE, $verify_schema = true ){
346
+	public function initialize_db_if_no_migrations_required($initialize_addons_too = FALSE, $verify_schema = true) {
347 347
 		$request_type = $this->detect_req_type();
348 348
 		//only initialize system if we're not in maintenance mode.
349
-		if( EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance ){
350
-			update_option( 'ee_flush_rewrite_rules', TRUE );
349
+		if (EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance) {
350
+			update_option('ee_flush_rewrite_rules', TRUE);
351 351
 
352
-			if( $verify_schema ) {
352
+			if ($verify_schema) {
353 353
 				EEH_Activation::initialize_db_and_folders();
354 354
 			}
355 355
 			EEH_Activation::initialize_db_content();
356 356
 			EEH_Activation::system_initialization();
357
-			if( $initialize_addons_too ) {
357
+			if ($initialize_addons_too) {
358 358
 				$this->initialize_addons();
359 359
 			}
360
-		}else{
361
-			EE_Data_Migration_Manager::instance()->enqueue_db_initialization_for( 'Core' );
360
+		} else {
361
+			EE_Data_Migration_Manager::instance()->enqueue_db_initialization_for('Core');
362 362
 		}
363
-		if ( $request_type == EE_System::req_type_new_activation || $request_type == EE_System::req_type_reactivation || $request_type == EE_System::req_type_upgrade ) {
364
-			add_action( 'AHEE__EE_System__load_CPTs_and_session__start', array( $this, 'redirect_to_about_ee' ), 9 );
363
+		if ($request_type == EE_System::req_type_new_activation || $request_type == EE_System::req_type_reactivation || $request_type == EE_System::req_type_upgrade) {
364
+			add_action('AHEE__EE_System__load_CPTs_and_session__start', array($this, 'redirect_to_about_ee'), 9);
365 365
 		}
366 366
 	}
367 367
 
368 368
 	/**
369 369
 	 * Initializes the db for all registered addons
370 370
 	 */
371
-	public function initialize_addons(){
371
+	public function initialize_addons() {
372 372
 		//foreach registered addon, make sure its db is up-to-date too
373
-		foreach($this->registry->addons as $addon){
373
+		foreach ($this->registry->addons as $addon) {
374 374
 			$addon->initialize_db_if_no_migrations_required();
375 375
 		}
376 376
 	}
@@ -382,16 +382,16 @@  discard block
 block discarded – undo
382 382
 	 * @param 	string 	$current_version_to_add 	version to be added to the version history
383 383
 	 * @return 	boolean success as to whether or not this option was changed
384 384
 	 */
385
-	public function update_list_of_installed_versions($version_history = NULL,$current_version_to_add = NULL) {
386
-		if( ! $version_history ) {
385
+	public function update_list_of_installed_versions($version_history = NULL, $current_version_to_add = NULL) {
386
+		if ( ! $version_history) {
387 387
 			$version_history = $this->fix_espresso_db_upgrade_option($version_history);
388 388
 		}
389
-		if( $current_version_to_add == NULL){
389
+		if ($current_version_to_add == NULL) {
390 390
 			$current_version_to_add = espresso_version();
391 391
 		}
392
-		$version_history[ $current_version_to_add ][] = date( 'Y-m-d H:i:s',time() );
392
+		$version_history[$current_version_to_add][] = date('Y-m-d H:i:s', time());
393 393
 		// re-save
394
-		return update_option( 'espresso_db_update', $version_history );
394
+		return update_option('espresso_db_update', $version_history);
395 395
 	}
396 396
 
397 397
 
@@ -408,10 +408,10 @@  discard block
 block discarded – undo
408 408
 	 *                            but still know if this is a new install or not
409 409
 	 * @return int one of the constants on EE_System::req_type_
410 410
 	 */
411
-	public function detect_req_type( $espresso_db_update = NULL ){
412
-		if ( $this->_req_type === NULL ){
413
-			$espresso_db_update = ! empty( $espresso_db_update ) ? $espresso_db_update : $this->fix_espresso_db_upgrade_option();
414
-			$this->_req_type = $this->detect_req_type_given_activation_history( $espresso_db_update, 'ee_espresso_activation', espresso_version() );
411
+	public function detect_req_type($espresso_db_update = NULL) {
412
+		if ($this->_req_type === NULL) {
413
+			$espresso_db_update = ! empty($espresso_db_update) ? $espresso_db_update : $this->fix_espresso_db_upgrade_option();
414
+			$this->_req_type = $this->detect_req_type_given_activation_history($espresso_db_update, 'ee_espresso_activation', espresso_version());
415 415
 		}
416 416
 		return $this->_req_type;
417 417
 	}
@@ -427,39 +427,39 @@  discard block
 block discarded – undo
427 427
 	 * @param string $version_to_upgrade_to the version that was just upgraded to (for core that will be espresso_version())
428 428
 	 * @return int one of the constants on EE_System::req_type_*
429 429
 	 */
430
-	public static function detect_req_type_given_activation_history( $activation_history_for_addon, $activation_indicator_option_name, $version_to_upgrade_to ){
431
-		$version_is_higher = self::_new_version_is_higher( $activation_history_for_addon, $version_to_upgrade_to );
432
-		if( $activation_history_for_addon ){
430
+	public static function detect_req_type_given_activation_history($activation_history_for_addon, $activation_indicator_option_name, $version_to_upgrade_to) {
431
+		$version_is_higher = self::_new_version_is_higher($activation_history_for_addon, $version_to_upgrade_to);
432
+		if ($activation_history_for_addon) {
433 433
 			//it exists, so this isn't a completely new install
434 434
 			//check if this version already in that list of previously installed versions
435
-			if ( ! isset( $activation_history_for_addon[ $version_to_upgrade_to ] )) {
435
+			if ( ! isset($activation_history_for_addon[$version_to_upgrade_to])) {
436 436
 				//it a version we haven't seen before
437
-				if( $version_is_higher === 1 ){
437
+				if ($version_is_higher === 1) {
438 438
 					$req_type = EE_System::req_type_upgrade;
439
-				}else{
439
+				} else {
440 440
 					$req_type = EE_System::req_type_downgrade;
441 441
 				}
442
-				delete_option( $activation_indicator_option_name );
442
+				delete_option($activation_indicator_option_name);
443 443
 			} else {
444 444
 				// its not an update. maybe a reactivation?
445
-				if( get_option( $activation_indicator_option_name, FALSE ) ){
446
-					if ( $version_is_higher === -1 ){
445
+				if (get_option($activation_indicator_option_name, FALSE)) {
446
+					if ($version_is_higher === -1) {
447 447
 						$req_type = EE_System::req_type_downgrade;
448
-					}elseif( $version_is_higher === 0 ){
448
+					}elseif ($version_is_higher === 0) {
449 449
 						//we've seen this version before, but it's an activation. must be a reactivation
450 450
 						$req_type = EE_System::req_type_reactivation;
451
-					}else{//$version_is_higher === 1
451
+					} else {//$version_is_higher === 1
452 452
 						$req_type = EE_System::req_type_upgrade;
453 453
 					}
454
-					delete_option( $activation_indicator_option_name );
454
+					delete_option($activation_indicator_option_name);
455 455
 				} else {
456 456
 					//we've seen this version before and the activation indicate doesn't show it was just activated
457
-					if ( $version_is_higher === -1 ){
457
+					if ($version_is_higher === -1) {
458 458
 						$req_type = EE_System::req_type_downgrade;
459
-					}elseif( $version_is_higher === 0 ){
459
+					}elseif ($version_is_higher === 0) {
460 460
 						//we've seen this version before and it's not an activation. its normal request
461 461
 						$req_type = EE_System::req_type_normal;
462
-					}else{//$version_is_higher === 1
462
+					} else {//$version_is_higher === 1
463 463
 						$req_type = EE_System::req_type_upgrade;
464 464
 					}
465 465
 				}
@@ -467,7 +467,7 @@  discard block
 block discarded – undo
467 467
 		} else {
468 468
 			//brand new install
469 469
 			$req_type = EE_System::req_type_new_activation;
470
-			delete_option( $activation_indicator_option_name );
470
+			delete_option($activation_indicator_option_name);
471 471
 		}
472 472
 		return $req_type;
473 473
 	}
@@ -485,30 +485,30 @@  discard block
 block discarded – undo
485 485
 	 *		0 if $version_to_upgrade_to MATCHES (reactivation or normal request);
486 486
 	 *		1 if $version_to_upgrade_to is HIGHER (upgrade) ;
487 487
 	 */
488
-	protected static function _new_version_is_higher( $activation_history_for_addon, $version_to_upgrade_to ){
488
+	protected static function _new_version_is_higher($activation_history_for_addon, $version_to_upgrade_to) {
489 489
 		//find the most recently-activated version
490 490
 		$most_recently_active_version_activation = '1970-01-01 00:00:00';
491 491
 		$most_recently_active_version = '0.0.0.dev.000';
492
-		if( is_array( $activation_history_for_addon ) ){
493
-			foreach( $activation_history_for_addon as $version => $times_activated ){
492
+		if (is_array($activation_history_for_addon)) {
493
+			foreach ($activation_history_for_addon as $version => $times_activated) {
494 494
 				//check there is a record of when this version was activated. Otherwise,
495 495
 				//mark it as unknown
496
-				if( ! $times_activated ){
497
-					$times_activated = array( 'unknown-date');
496
+				if ( ! $times_activated) {
497
+					$times_activated = array('unknown-date');
498 498
 				}
499
-				if( is_string( $times_activated ) ){
500
-					$times_activated = array( $times_activated );
499
+				if (is_string($times_activated)) {
500
+					$times_activated = array($times_activated);
501 501
 				}
502
-				foreach( $times_activated as $an_activation ){
503
-					if( $an_activation != 'unknown-date' &&
504
-							$an_activation > $most_recently_active_version_activation  ){
502
+				foreach ($times_activated as $an_activation) {
503
+					if ($an_activation != 'unknown-date' &&
504
+							$an_activation > $most_recently_active_version_activation) {
505 505
 						$most_recently_active_version = $version;
506 506
 						$most_recently_active_version_activation = $an_activation == 'unknown-date' ? '1970-01-01 00:00:00' : $an_activation;
507 507
 					}
508 508
 				}
509 509
 			}
510 510
 		}
511
-		return version_compare( $version_to_upgrade_to, $most_recently_active_version );
511
+		return version_compare($version_to_upgrade_to, $most_recently_active_version);
512 512
 	}
513 513
 
514 514
 
@@ -518,24 +518,24 @@  discard block
 block discarded – undo
518 518
 	 * @return void
519 519
 	 */
520 520
 	public function redirect_to_about_ee() {
521
-		$notices = EE_Error::get_notices( FALSE );
521
+		$notices = EE_Error::get_notices(FALSE);
522 522
 		//if current user is an admin and it's not an ajax request
523 523
 		if (
524
-			$this->registry->CAP->current_user_can( 'manage_options', 'espresso_about_default' )
525
-			&& ! ( defined( 'DOING_AJAX' ) && DOING_AJAX )
526
-			&& ! isset( $notices[ 'errors' ] )
524
+			$this->registry->CAP->current_user_can('manage_options', 'espresso_about_default')
525
+			&& ! (defined('DOING_AJAX') && DOING_AJAX)
526
+			&& ! isset($notices['errors'])
527 527
 		) {
528
-			$query_params =  array( 'page' => 'espresso_about' );
528
+			$query_params = array('page' => 'espresso_about');
529 529
 
530
-			if ( EE_System::instance()->detect_req_type() == EE_System::req_type_new_activation ) {
530
+			if (EE_System::instance()->detect_req_type() == EE_System::req_type_new_activation) {
531 531
 			    $query_params['new_activation'] = TRUE;
532 532
 			}
533 533
 
534
-			if ( EE_System::instance()->detect_req_type() == EE_System::req_type_reactivation ) {
534
+			if (EE_System::instance()->detect_req_type() == EE_System::req_type_reactivation) {
535 535
 			    $query_params['reactivation'] = TRUE;
536 536
 			}
537
-			$url = add_query_arg( $query_params, admin_url( 'admin.php' ) );
538
-			wp_safe_redirect( $url );
537
+			$url = add_query_arg($query_params, admin_url('admin.php'));
538
+			wp_safe_redirect($url);
539 539
 			exit();
540 540
 		}
541 541
 	}
@@ -549,31 +549,31 @@  discard block
 block discarded – undo
549 549
 	 *
550 550
 	 * @return void
551 551
 	 */
552
-	public function load_core_configuration(){
553
-		do_action( 'AHEE__EE_System__load_core_configuration__begin', $this );
554
-		$this->registry->load_core( 'EE_Load_Textdomain' );
552
+	public function load_core_configuration() {
553
+		do_action('AHEE__EE_System__load_core_configuration__begin', $this);
554
+		$this->registry->load_core('EE_Load_Textdomain');
555 555
 		//load textdomain
556 556
 		EE_Load_Textdomain::load_textdomain();
557 557
 		// load and setup EE_Config and EE_Network_Config
558
-		$this->registry->load_core( 'Config' );
559
-		$this->registry->load_core( 'Network_Config' );
558
+		$this->registry->load_core('Config');
559
+		$this->registry->load_core('Network_Config');
560 560
 		// setup autoloaders
561 561
 		// enable logging?
562
-		if ( $this->registry->CFG->admin->use_full_logging ) {
563
-			$this->registry->load_core( 'Log' );
562
+		if ($this->registry->CFG->admin->use_full_logging) {
563
+			$this->registry->load_core('Log');
564 564
 		}
565 565
 		// check for activation errors
566
-		$activation_errors = get_option( 'ee_plugin_activation_errors', FALSE );
567
-		if ( $activation_errors ) {
568
-			EE_Error::add_error( $activation_errors, __FILE__, __FUNCTION__, __LINE__ );
569
-			update_option( 'ee_plugin_activation_errors', FALSE );
566
+		$activation_errors = get_option('ee_plugin_activation_errors', FALSE);
567
+		if ($activation_errors) {
568
+			EE_Error::add_error($activation_errors, __FILE__, __FUNCTION__, __LINE__);
569
+			update_option('ee_plugin_activation_errors', FALSE);
570 570
 		}
571 571
 		// get model names
572 572
 		$this->_parse_model_names();
573 573
 
574 574
 		//load caf stuff a chance to play during the activation process too.
575 575
 		$this->_maybe_brew_regular();
576
-		do_action( 'AHEE__EE_System__load_core_configuration__complete', $this );
576
+		do_action('AHEE__EE_System__load_core_configuration__complete', $this);
577 577
 	}
578 578
 
579 579
 
@@ -582,23 +582,23 @@  discard block
 block discarded – undo
582 582
 	 *
583 583
 	 * @return void
584 584
 	 */
585
-	private function _parse_model_names(){
585
+	private function _parse_model_names() {
586 586
 		//get all the files in the EE_MODELS folder that end in .model.php
587
-		$models = glob( EE_MODELS.'*.model.php');
587
+		$models = glob(EE_MODELS.'*.model.php');
588 588
 		$model_names = array();
589 589
 		$non_abstract_db_models = array();
590
-		foreach( $models as $model ){
590
+		foreach ($models as $model) {
591 591
 			// get model classname
592
-			$classname = EEH_File::get_classname_from_filepath_with_standard_filename( $model );
593
-			$short_name = str_replace( 'EEM_', '', $classname );
592
+			$classname = EEH_File::get_classname_from_filepath_with_standard_filename($model);
593
+			$short_name = str_replace('EEM_', '', $classname);
594 594
 			$reflectionClass = new ReflectionClass($classname);
595
-			if( $reflectionClass->isSubclassOf('EEM_Base') && ! $reflectionClass->isAbstract()){
596
-				$non_abstract_db_models[ $short_name ] = $classname;
595
+			if ($reflectionClass->isSubclassOf('EEM_Base') && ! $reflectionClass->isAbstract()) {
596
+				$non_abstract_db_models[$short_name] = $classname;
597 597
 			}
598
-			$model_names[ $short_name ] = $classname;
598
+			$model_names[$short_name] = $classname;
599 599
 		}
600
-		$this->registry->models = apply_filters( 'FHEE__EE_System__parse_model_names', $model_names );
601
-		$this->registry->non_abstract_db_models = apply_filters( 'FHEE__EE_System__parse_implemented_model_names', $non_abstract_db_models );
600
+		$this->registry->models = apply_filters('FHEE__EE_System__parse_model_names', $model_names);
601
+		$this->registry->non_abstract_db_models = apply_filters('FHEE__EE_System__parse_implemented_model_names', $non_abstract_db_models);
602 602
 	}
603 603
 
604 604
 
@@ -608,8 +608,8 @@  discard block
 block discarded – undo
608 608
 	 * @return void
609 609
 	 */
610 610
 	private function _maybe_brew_regular() {
611
-		if (( ! defined( 'EE_DECAF' ) ||  EE_DECAF !== TRUE ) && is_readable( EE_CAFF_PATH . 'brewing_regular.php' )) {
612
-			require_once EE_CAFF_PATH . 'brewing_regular.php';
611
+		if (( ! defined('EE_DECAF') || EE_DECAF !== TRUE) && is_readable(EE_CAFF_PATH.'brewing_regular.php')) {
612
+			require_once EE_CAFF_PATH.'brewing_regular.php';
613 613
 		}
614 614
 	}
615 615
 
@@ -626,9 +626,9 @@  discard block
 block discarded – undo
626 626
 	 * @return void
627 627
 	 */
628 628
 	public function register_shortcodes_modules_and_widgets() {
629
-		do_action( 'AHEE__EE_System__register_shortcodes_modules_and_widgets' );
629
+		do_action('AHEE__EE_System__register_shortcodes_modules_and_widgets');
630 630
 		// check for addons using old hookpoint
631
-		if ( has_action( 'AHEE__EE_System__register_shortcodes_modules_and_addons' )) {
631
+		if (has_action('AHEE__EE_System__register_shortcodes_modules_and_addons')) {
632 632
 			$this->_incompatible_addon_error();
633 633
 		}
634 634
 	}
@@ -642,19 +642,19 @@  discard block
 block discarded – undo
642 642
 	*/
643 643
 	private function _incompatible_addon_error() {
644 644
 		// get array of classes hooking into here
645
-		$class_names = EEH_Class_Tools::get_class_names_for_all_callbacks_on_hook( 'AHEE__EE_System__register_shortcodes_modules_and_addons' );
646
-		if ( ! empty( $class_names )) {
647
-			$msg = __( 'The following plugins, addons, or modules appear to be incompatible with this version of Event Espresso and were automatically deactivated to avoid fatal errors:', 'event_espresso' );
645
+		$class_names = EEH_Class_Tools::get_class_names_for_all_callbacks_on_hook('AHEE__EE_System__register_shortcodes_modules_and_addons');
646
+		if ( ! empty($class_names)) {
647
+			$msg = __('The following plugins, addons, or modules appear to be incompatible with this version of Event Espresso and were automatically deactivated to avoid fatal errors:', 'event_espresso');
648 648
 			$msg .= '<ul>';
649
-			foreach ( $class_names as $class_name ) {
650
-				$msg .= '<li><b>Event Espresso - ' . str_replace( array( 'EE_', 'EEM_', 'EED_', 'EES_', 'EEW_' ), '', $class_name ) . '</b></li>';
649
+			foreach ($class_names as $class_name) {
650
+				$msg .= '<li><b>Event Espresso - '.str_replace(array('EE_', 'EEM_', 'EED_', 'EES_', 'EEW_'), '', $class_name).'</b></li>';
651 651
 			}
652 652
 			$msg .= '</ul>';
653
-			$msg .= __( 'Compatibility issues can be avoided and/or resolved by keeping addons and plugins updated to the latest version.', 'event_espresso' );
653
+			$msg .= __('Compatibility issues can be avoided and/or resolved by keeping addons and plugins updated to the latest version.', 'event_espresso');
654 654
 			// save list of incompatible addons to wp-options for later use
655
-			add_option( 'ee_incompatible_addons', $class_names, '', 'no' );
656
-			if ( is_admin() ) {
657
-				EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
655
+			add_option('ee_incompatible_addons', $class_names, '', 'no');
656
+			if (is_admin()) {
657
+				EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
658 658
 			}
659 659
 		}
660 660
 	}
@@ -671,25 +671,25 @@  discard block
 block discarded – undo
671 671
 	 *
672 672
 	 * @return void
673 673
 	 */
674
-	public function brew_espresso(){
675
-		do_action( 'AHEE__EE_System__brew_espresso__begin', $this );
674
+	public function brew_espresso() {
675
+		do_action('AHEE__EE_System__brew_espresso__begin', $this);
676 676
 		// load some final core systems
677
-		add_action( 'init', array( $this, 'set_hooks_for_core' ), 1 );
678
-		add_action( 'init', array( $this, 'perform_activations_upgrades_and_migrations' ), 3 );
679
-		add_action( 'init', array( $this, 'load_CPTs_and_session' ), 5 );
680
-		add_action( 'init', array( $this, 'load_controllers' ), 7 );
681
-		add_action( 'init', array( $this, 'core_loaded_and_ready' ), 9 );
682
-		add_action( 'init', array( $this, 'initialize' ), 10 );
683
-		add_action( 'init', array( $this, 'initialize_last' ), 100 );
684
-		add_action('wp_enqueue_scripts', array( $this, 'wp_enqueue_scripts' ), 25 );
685
-		add_action( 'admin_bar_menu', array( $this, 'espresso_toolbar_items' ), 100 );
686
-
687
-		if ( is_admin() && apply_filters( 'FHEE__EE_System__brew_espresso__load_pue', TRUE )  ) {
677
+		add_action('init', array($this, 'set_hooks_for_core'), 1);
678
+		add_action('init', array($this, 'perform_activations_upgrades_and_migrations'), 3);
679
+		add_action('init', array($this, 'load_CPTs_and_session'), 5);
680
+		add_action('init', array($this, 'load_controllers'), 7);
681
+		add_action('init', array($this, 'core_loaded_and_ready'), 9);
682
+		add_action('init', array($this, 'initialize'), 10);
683
+		add_action('init', array($this, 'initialize_last'), 100);
684
+		add_action('wp_enqueue_scripts', array($this, 'wp_enqueue_scripts'), 25);
685
+		add_action('admin_bar_menu', array($this, 'espresso_toolbar_items'), 100);
686
+
687
+		if (is_admin() && apply_filters('FHEE__EE_System__brew_espresso__load_pue', TRUE)) {
688 688
 			// pew pew pew
689
-			$this->registry->load_core( 'PUE' );
690
-			do_action( 'AHEE__EE_System__brew_espresso__after_pue_init' );
689
+			$this->registry->load_core('PUE');
690
+			do_action('AHEE__EE_System__brew_espresso__after_pue_init');
691 691
 		}
692
-		do_action( 'AHEE__EE_System__brew_espresso__complete', $this );
692
+		do_action('AHEE__EE_System__brew_espresso__complete', $this);
693 693
 	}
694 694
 
695 695
 
@@ -703,7 +703,7 @@  discard block
 block discarded – undo
703 703
 	 */
704 704
 	public function set_hooks_for_core() {
705 705
 		$this->_deactivate_incompatible_addons();
706
-		do_action( 'AHEE__EE_System__set_hooks_for_core' );
706
+		do_action('AHEE__EE_System__set_hooks_for_core');
707 707
 	}
708 708
 
709 709
 
@@ -712,15 +712,15 @@  discard block
 block discarded – undo
712 712
 	 * Using the information gathered in EE_System::_incompatible_addon_error,
713 713
 	 * deactivates any addons considered incompatible with the current version of EE
714 714
 	 */
715
-	private function _deactivate_incompatible_addons(){
716
-		$incompatible_addons = get_option( 'ee_incompatible_addons', array() );
717
-		if ( ! empty( $incompatible_addons )) {
718
-			$active_plugins = get_option( 'active_plugins', array() );
719
-			foreach ( $active_plugins as $active_plugin ) {
720
-				foreach ( $incompatible_addons as $incompatible_addon ) {
721
-					if ( strpos( $active_plugin,  $incompatible_addon ) !== FALSE ) {
722
-						unset( $_GET['activate'] );
723
-						espresso_deactivate_plugin( $active_plugin );
715
+	private function _deactivate_incompatible_addons() {
716
+		$incompatible_addons = get_option('ee_incompatible_addons', array());
717
+		if ( ! empty($incompatible_addons)) {
718
+			$active_plugins = get_option('active_plugins', array());
719
+			foreach ($active_plugins as $active_plugin) {
720
+				foreach ($incompatible_addons as $incompatible_addon) {
721
+					if (strpos($active_plugin, $incompatible_addon) !== FALSE) {
722
+						unset($_GET['activate']);
723
+						espresso_deactivate_plugin($active_plugin);
724 724
 					}
725 725
 				}
726 726
 			}
@@ -737,10 +737,10 @@  discard block
 block discarded – undo
737 737
 	 */
738 738
 	public function perform_activations_upgrades_and_migrations() {
739 739
 		//first check if we had previously attempted to setup EE's directories but failed
740
-		if( EEH_Activation::upload_directories_incomplete() ) {
740
+		if (EEH_Activation::upload_directories_incomplete()) {
741 741
 			EEH_Activation::create_upload_directories();
742 742
 		}
743
-		do_action( 'AHEE__EE_System__perform_activations_upgrades_and_migrations' );
743
+		do_action('AHEE__EE_System__perform_activations_upgrades_and_migrations');
744 744
 	}
745 745
 
746 746
 
@@ -752,10 +752,10 @@  discard block
 block discarded – undo
752 752
 	 *  	@return 	void
753 753
 	 */
754 754
 	public function load_CPTs_and_session() {
755
-		do_action( 'AHEE__EE_System__load_CPTs_and_session__start' );
755
+		do_action('AHEE__EE_System__load_CPTs_and_session__start');
756 756
 		// register Custom Post Types
757
-		$this->registry->load_core( 'Register_CPTs' );
758
-		do_action( 'AHEE__EE_System__load_CPTs_and_session__complete' );
757
+		$this->registry->load_core('Register_CPTs');
758
+		do_action('AHEE__EE_System__load_CPTs_and_session__complete');
759 759
 	}
760 760
 
761 761
 
@@ -770,16 +770,16 @@  discard block
 block discarded – undo
770 770
 	* @return void
771 771
 	*/
772 772
 	public function load_controllers() {
773
-		do_action( 'AHEE__EE_System__load_controllers__start' );
773
+		do_action('AHEE__EE_System__load_controllers__start');
774 774
 		// let's get it started
775
-		if ( ! is_admin() && ! EE_Maintenance_Mode::instance()->level() ) {
776
-			do_action( 'AHEE__EE_System__load_controllers__load_front_controllers' );
777
-			$this->registry->load_core( 'Front_Controller', array(), false, true );
778
-		} else if ( ! EE_FRONT_AJAX ) {
779
-			do_action( 'AHEE__EE_System__load_controllers__load_admin_controllers' );
780
-			EE_Registry::instance()->load_core( 'Admin' );
775
+		if ( ! is_admin() && ! EE_Maintenance_Mode::instance()->level()) {
776
+			do_action('AHEE__EE_System__load_controllers__load_front_controllers');
777
+			$this->registry->load_core('Front_Controller', array(), false, true);
778
+		} else if ( ! EE_FRONT_AJAX) {
779
+			do_action('AHEE__EE_System__load_controllers__load_admin_controllers');
780
+			EE_Registry::instance()->load_core('Admin');
781 781
 		}
782
-		do_action( 'AHEE__EE_System__load_controllers__complete' );
782
+		do_action('AHEE__EE_System__load_controllers__complete');
783 783
 	}
784 784
 
785 785
 
@@ -793,9 +793,9 @@  discard block
 block discarded – undo
793 793
 	* @return void
794 794
 	*/
795 795
 	public function core_loaded_and_ready() {
796
-		do_action( 'AHEE__EE_System__core_loaded_and_ready' );
797
-		do_action( 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons' );
798
-		$this->registry->load_core( 'Session' );
796
+		do_action('AHEE__EE_System__core_loaded_and_ready');
797
+		do_action('AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons');
798
+		$this->registry->load_core('Session');
799 799
 		//		add_action( 'wp_loaded', array( $this, 'set_hooks_for_shortcodes_modules_and_addons' ), 1 );
800 800
 	}
801 801
 
@@ -810,7 +810,7 @@  discard block
 block discarded – undo
810 810
 	* @return void
811 811
 	*/
812 812
 	public function initialize() {
813
-		do_action( 'AHEE__EE_System__initialize' );
813
+		do_action('AHEE__EE_System__initialize');
814 814
 	}
815 815
 
816 816
 
@@ -824,7 +824,7 @@  discard block
 block discarded – undo
824 824
 	* @return void
825 825
 	*/
826 826
 	public function initialize_last() {
827
-		do_action( 'AHEE__EE_System__initialize_last' );
827
+		do_action('AHEE__EE_System__initialize_last');
828 828
 	}
829 829
 
830 830
 
@@ -856,21 +856,21 @@  discard block
 block discarded – undo
856 856
 	*/
857 857
 	public static function do_not_cache() {
858 858
 		// set no cache constants
859
-		if ( ! defined( 'DONOTCACHEPAGE' ) ) {
860
-			define( 'DONOTCACHEPAGE', true );
859
+		if ( ! defined('DONOTCACHEPAGE')) {
860
+			define('DONOTCACHEPAGE', true);
861 861
 		}
862
-		if ( ! defined( 'DONOTCACHCEOBJECT' ) ) {
863
-			define( 'DONOTCACHCEOBJECT', true );
862
+		if ( ! defined('DONOTCACHCEOBJECT')) {
863
+			define('DONOTCACHCEOBJECT', true);
864 864
 		}
865
-		if ( ! defined( 'DONOTCACHEDB' ) ) {
866
-			define( 'DONOTCACHEDB', true );
865
+		if ( ! defined('DONOTCACHEDB')) {
866
+			define('DONOTCACHEDB', true);
867 867
 		}
868 868
 		// add no cache headers
869
-		add_action( 'send_headers' , array( 'EE_System', 'nocache_headers' ), 10 );
869
+		add_action('send_headers', array('EE_System', 'nocache_headers'), 10);
870 870
 		// plus a little extra for nginx and Google Chrome
871
-		add_filter( 'nocache_headers', array( 'EE_System', 'extra_nocache_headers' ), 10, 1 );
871
+		add_filter('nocache_headers', array('EE_System', 'extra_nocache_headers'), 10, 1);
872 872
 		// prevent browsers from prefetching of the rel='next' link, because it may contain content that interferes with the registration process
873
-		remove_action( 'wp_head', 'adjacent_posts_rel_link_wp_head' );
873
+		remove_action('wp_head', 'adjacent_posts_rel_link_wp_head');
874 874
 	}
875 875
 
876 876
 
@@ -882,7 +882,7 @@  discard block
 block discarded – undo
882 882
 	 * @param $headers
883 883
 	 * @return    array
884 884
 	 */
885
-	public static function extra_nocache_headers ( $headers ) {
885
+	public static function extra_nocache_headers($headers) {
886 886
 		// for NGINX
887 887
 		$headers['X-Accel-Expires'] = 0;
888 888
 		// plus extra for Google Chrome since it doesn't seem to respect "no-cache", but WILL respect "no-store"
@@ -911,14 +911,14 @@  discard block
 block discarded – undo
911 911
 	 * @param  WP_Admin_Bar $admin_bar
912 912
 	 * @return void
913 913
 	 */
914
-	public function espresso_toolbar_items( WP_Admin_Bar $admin_bar ) {
914
+	public function espresso_toolbar_items(WP_Admin_Bar $admin_bar) {
915 915
 
916 916
 		// if in full M-Mode, or its an AJAX request, or user is NOT an admin
917
-		if ( EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance || defined( 'DOING_AJAX' ) || ! $this->registry->CAP->current_user_can( 'ee_read_ee', 'ee_admin_bar_menu_top_level' )) {
917
+		if (EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance || defined('DOING_AJAX') || ! $this->registry->CAP->current_user_can('ee_read_ee', 'ee_admin_bar_menu_top_level')) {
918 918
 			return;
919 919
 		}
920 920
 
921
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
921
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
922 922
 		$menu_class = 'espresso_menu_item_class';
923 923
 		//we don't use the constants EVENTS_ADMIN_URL or REG_ADMIN_URL
924 924
 		//because they're only defined in each of their respective constructors
@@ -930,20 +930,20 @@  discard block
 block discarded – undo
930 930
 		//Top Level
931 931
 		$admin_bar->add_menu(array(
932 932
 				'id' => 'espresso-toolbar',
933
-				'title' => '<span class="ee-icon ee-icon-ee-cup-thick ee-icon-size-20"></span><span class="ab-label">' . _x('Event Espresso', 'admin bar menu group label', 'event_espresso') . '</span>',
933
+				'title' => '<span class="ee-icon ee-icon-ee-cup-thick ee-icon-size-20"></span><span class="ab-label">'._x('Event Espresso', 'admin bar menu group label', 'event_espresso').'</span>',
934 934
 				'href' => $events_admin_url,
935 935
 				'meta' => array(
936 936
 						'title' => __('Event Espresso', 'event_espresso'),
937
-						'class' => $menu_class . 'first'
937
+						'class' => $menu_class.'first'
938 938
 				),
939 939
 		));
940 940
 
941 941
 		//Events
942
-		if ( $this->registry->CAP->current_user_can( 'ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events' ) ) {
942
+		if ($this->registry->CAP->current_user_can('ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events')) {
943 943
 			$admin_bar->add_menu(array(
944 944
 					'id' => 'espresso-toolbar-events',
945 945
 					'parent' => 'espresso-toolbar',
946
-					'title' => __( 'Events', 'event_espresso' ),
946
+					'title' => __('Events', 'event_espresso'),
947 947
 					'href' => $events_admin_url,
948 948
 					'meta' => array(
949 949
 							'title' => __('Events', 'event_espresso'),
@@ -954,13 +954,13 @@  discard block
 block discarded – undo
954 954
 		}
955 955
 
956 956
 
957
-		if ( $this->registry->CAP->current_user_can( 'ee_edit_events', 'ee_admin_bar_menu_espresso-toolbar-events-new' ) ) {
957
+		if ($this->registry->CAP->current_user_can('ee_edit_events', 'ee_admin_bar_menu_espresso-toolbar-events-new')) {
958 958
 			//Events Add New
959 959
 			$admin_bar->add_menu(array(
960 960
 					'id' => 'espresso-toolbar-events-new',
961 961
 					'parent' => 'espresso-toolbar-events',
962 962
 					'title' => __('Add New', 'event_espresso'),
963
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'create_new' ), $events_admin_url ),
963
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'create_new'), $events_admin_url),
964 964
 					'meta' => array(
965 965
 							'title' => __('Add New', 'event_espresso'),
966 966
 							'target' => '',
@@ -969,18 +969,18 @@  discard block
 block discarded – undo
969 969
 			));
970 970
 		}
971 971
 
972
-		if ( is_single() && ( get_post_type() == 'espresso_events' ) ) {
972
+		if (is_single() && (get_post_type() == 'espresso_events')) {
973 973
 
974 974
 			//Current post
975 975
 			global $post;
976 976
 
977
-	    	if ( $this->registry->CAP->current_user_can( 'ee_edit_event', 'ee_admin_bar_menu_espresso-toolbar-events-edit', $post->ID ) ) {
977
+	    	if ($this->registry->CAP->current_user_can('ee_edit_event', 'ee_admin_bar_menu_espresso-toolbar-events-edit', $post->ID)) {
978 978
 				//Events Edit Current Event
979 979
 				$admin_bar->add_menu(array(
980 980
 						'id' => 'espresso-toolbar-events-edit',
981 981
 						'parent' => 'espresso-toolbar-events',
982 982
 						'title' => __('Edit Event', 'event_espresso'),
983
-						'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'edit', 'post'=>$post->ID ), $events_admin_url ),
983
+						'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'edit', 'post'=>$post->ID), $events_admin_url),
984 984
 						'meta' => array(
985 985
 								'title' => __('Edit Event', 'event_espresso'),
986 986
 								'target' => '',
@@ -992,11 +992,11 @@  discard block
 block discarded – undo
992 992
 		}
993 993
 
994 994
 		//Events View
995
-		if ( $this->registry->CAP->current_user_can( 'ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-view' ) ) {
995
+		if ($this->registry->CAP->current_user_can('ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-view')) {
996 996
 			$admin_bar->add_menu(array(
997 997
 					'id' => 'espresso-toolbar-events-view',
998 998
 					'parent' => 'espresso-toolbar-events',
999
-					'title' => __( 'View', 'event_espresso' ),
999
+					'title' => __('View', 'event_espresso'),
1000 1000
 					'href' => $events_admin_url,
1001 1001
 					'meta' => array(
1002 1002
 							'title' => __('View', 'event_espresso'),
@@ -1006,12 +1006,12 @@  discard block
 block discarded – undo
1006 1006
 			));
1007 1007
 		}
1008 1008
 
1009
-		if ( $this->registry->CAP->current_user_can( 'ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-all' ) ) {
1009
+		if ($this->registry->CAP->current_user_can('ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-all')) {
1010 1010
 			//Events View All
1011 1011
 			$admin_bar->add_menu(array(
1012 1012
 					'id' => 'espresso-toolbar-events-all',
1013 1013
 					'parent' => 'espresso-toolbar-events-view',
1014
-					'title' => __( 'All', 'event_espresso' ),
1014
+					'title' => __('All', 'event_espresso'),
1015 1015
 					'href' => $events_admin_url,
1016 1016
 					'meta' => array(
1017 1017
 							'title' => __('All', 'event_espresso'),
@@ -1022,13 +1022,13 @@  discard block
 block discarded – undo
1022 1022
 		}
1023 1023
 
1024 1024
 
1025
-		if ( $this->registry->CAP->current_user_can( 'ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-today' ) ) {
1025
+		if ($this->registry->CAP->current_user_can('ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-today')) {
1026 1026
 			//Events View Today
1027 1027
 			$admin_bar->add_menu(array(
1028 1028
 					'id' => 'espresso-toolbar-events-today',
1029 1029
 					'parent' => 'espresso-toolbar-events-view',
1030 1030
 					'title' => __('Today', 'event_espresso'),
1031
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today' ), $events_admin_url ),
1031
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today'), $events_admin_url),
1032 1032
 					'meta' => array(
1033 1033
 							'title' => __('Today', 'event_espresso'),
1034 1034
 							'target' => '',
@@ -1038,13 +1038,13 @@  discard block
 block discarded – undo
1038 1038
 		}
1039 1039
 
1040 1040
 
1041
-		if ( $this->registry->CAP->current_user_can( 'ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-month' ) ) {
1041
+		if ($this->registry->CAP->current_user_can('ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-month')) {
1042 1042
 			//Events View This Month
1043 1043
 			$admin_bar->add_menu(array(
1044 1044
 					'id' => 'espresso-toolbar-events-month',
1045 1045
 					'parent' => 'espresso-toolbar-events-view',
1046
-					'title' => __( 'This Month', 'event_espresso'),
1047
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month' ), $events_admin_url ),
1046
+					'title' => __('This Month', 'event_espresso'),
1047
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month'), $events_admin_url),
1048 1048
 					'meta' => array(
1049 1049
 							'title' => __('This Month', 'event_espresso'),
1050 1050
 							'target' => '',
@@ -1054,11 +1054,11 @@  discard block
 block discarded – undo
1054 1054
 		}
1055 1055
 
1056 1056
 		//Registration Overview
1057
-		if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations' ) ) {
1057
+		if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations')) {
1058 1058
 			$admin_bar->add_menu(array(
1059 1059
 					'id' => 'espresso-toolbar-registrations',
1060 1060
 					'parent' => 'espresso-toolbar',
1061
-					'title' => __( 'Registrations', 'event_espresso' ),
1061
+					'title' => __('Registrations', 'event_espresso'),
1062 1062
 					'href' => $reg_admin_url,
1063 1063
 					'meta' => array(
1064 1064
 							'title' => __('Registrations', 'event_espresso'),
@@ -1069,12 +1069,12 @@  discard block
 block discarded – undo
1069 1069
 		}
1070 1070
 
1071 1071
 		//Registration Overview Today
1072
-		if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today' ) ) {
1072
+		if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today')) {
1073 1073
 			$admin_bar->add_menu(array(
1074 1074
 					'id' => 'espresso-toolbar-registrations-today',
1075 1075
 					'parent' => 'espresso-toolbar-registrations',
1076
-					'title' => __( 'Today', 'event_espresso'),
1077
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today' ), $reg_admin_url ),
1076
+					'title' => __('Today', 'event_espresso'),
1077
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today'), $reg_admin_url),
1078 1078
 					'meta' => array(
1079 1079
 							'title' => __('Today', 'event_espresso'),
1080 1080
 							'target' => '',
@@ -1084,14 +1084,14 @@  discard block
 block discarded – undo
1084 1084
 		}
1085 1085
 
1086 1086
 		//Registration Overview Today Completed
1087
-		if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-approved' ) ) {
1087
+		if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-approved')) {
1088 1088
 			$admin_bar->add_menu(array(
1089 1089
 					'id' => 'espresso-toolbar-registrations-today-approved',
1090 1090
 					'parent' => 'espresso-toolbar-registrations-today',
1091
-					'title' => __( 'Approved', 'event_espresso' ),
1092
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_approved ), $reg_admin_url ),
1091
+					'title' => __('Approved', 'event_espresso'),
1092
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_approved), $reg_admin_url),
1093 1093
 					'meta' => array(
1094
-							'title' => __('Approved', 'event_espresso' ),
1094
+							'title' => __('Approved', 'event_espresso'),
1095 1095
 							'target' => '',
1096 1096
 							'class' => $menu_class
1097 1097
 					),
@@ -1099,14 +1099,14 @@  discard block
 block discarded – undo
1099 1099
 		}
1100 1100
 
1101 1101
 		//Registration Overview Today Pending\
1102
-		if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-pending' ) ) {
1102
+		if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-pending')) {
1103 1103
 			$admin_bar->add_menu(array(
1104 1104
 					'id' => 'espresso-toolbar-registrations-today-pending',
1105 1105
 					'parent' => 'espresso-toolbar-registrations-today',
1106
-					'title' => __( 'Pending', 'event_espresso' ),
1107
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today', 'reg_status'=>EEM_Registration::status_id_pending_payment ), $reg_admin_url ),
1106
+					'title' => __('Pending', 'event_espresso'),
1107
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today', 'reg_status'=>EEM_Registration::status_id_pending_payment), $reg_admin_url),
1108 1108
 					'meta' => array(
1109
-							'title' => __('Pending Payment', 'event_espresso' ),
1109
+							'title' => __('Pending Payment', 'event_espresso'),
1110 1110
 							'target' => '',
1111 1111
 							'class' => $menu_class
1112 1112
 					),
@@ -1114,14 +1114,14 @@  discard block
 block discarded – undo
1114 1114
 		}
1115 1115
 
1116 1116
 		//Registration Overview Today Incomplete
1117
-		if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-not-approved' ) ) {
1117
+		if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-not-approved')) {
1118 1118
 			$admin_bar->add_menu(array(
1119 1119
 					'id' => 'espresso-toolbar-registrations-today-not-approved',
1120 1120
 					'parent' => 'espresso-toolbar-registrations-today',
1121
-					'title' => __( 'Not Approved', 'event_espresso' ),
1122
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_not_approved ), $reg_admin_url ),
1121
+					'title' => __('Not Approved', 'event_espresso'),
1122
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_not_approved), $reg_admin_url),
1123 1123
 					'meta' => array(
1124
-							'title' => __('Not Approved', 'event_espresso' ),
1124
+							'title' => __('Not Approved', 'event_espresso'),
1125 1125
 							'target' => '',
1126 1126
 							'class' => $menu_class
1127 1127
 					),
@@ -1129,12 +1129,12 @@  discard block
 block discarded – undo
1129 1129
 		}
1130 1130
 
1131 1131
 		//Registration Overview Today Incomplete
1132
-		if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-cancelled' ) ) {
1132
+		if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-cancelled')) {
1133 1133
 			$admin_bar->add_menu(array(
1134 1134
 					'id' => 'espresso-toolbar-registrations-today-cancelled',
1135 1135
 					'parent' => 'espresso-toolbar-registrations-today',
1136
-					'title' => __( 'Cancelled', 'event_espresso'),
1137
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_cancelled ), $reg_admin_url ),
1136
+					'title' => __('Cancelled', 'event_espresso'),
1137
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_cancelled), $reg_admin_url),
1138 1138
 					'meta' => array(
1139 1139
 							'title' => __('Cancelled', 'event_espresso'),
1140 1140
 							'target' => '',
@@ -1144,12 +1144,12 @@  discard block
 block discarded – undo
1144 1144
 		}
1145 1145
 
1146 1146
 		//Registration Overview This Month
1147
-		if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month' ) ) {
1147
+		if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month')) {
1148 1148
 			$admin_bar->add_menu(array(
1149 1149
 					'id' => 'espresso-toolbar-registrations-month',
1150 1150
 					'parent' => 'espresso-toolbar-registrations',
1151
-					'title' => __( 'This Month', 'event_espresso' ),
1152
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month' ), $reg_admin_url ),
1151
+					'title' => __('This Month', 'event_espresso'),
1152
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month'), $reg_admin_url),
1153 1153
 					'meta' => array(
1154 1154
 							'title' => __('This Month', 'event_espresso'),
1155 1155
 							'target' => '',
@@ -1159,12 +1159,12 @@  discard block
 block discarded – undo
1159 1159
 		}
1160 1160
 
1161 1161
 		//Registration Overview This Month Approved
1162
-		if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-approved' ) ) {
1162
+		if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-approved')) {
1163 1163
 			$admin_bar->add_menu(array(
1164 1164
 					'id' => 'espresso-toolbar-registrations-month-approved',
1165 1165
 					'parent' => 'espresso-toolbar-registrations-month',
1166
-					'title' => __( 'Approved', 'event_espresso' ),
1167
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_approved ), $reg_admin_url ),
1166
+					'title' => __('Approved', 'event_espresso'),
1167
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_approved), $reg_admin_url),
1168 1168
 					'meta' => array(
1169 1169
 							'title' => __('Approved', 'event_espresso'),
1170 1170
 							'target' => '',
@@ -1174,12 +1174,12 @@  discard block
 block discarded – undo
1174 1174
 		}
1175 1175
 
1176 1176
 		//Registration Overview This Month Pending
1177
-		if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-pending' ) ) {
1177
+		if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-pending')) {
1178 1178
 			$admin_bar->add_menu(array(
1179 1179
 					'id' => 'espresso-toolbar-registrations-month-pending',
1180 1180
 					'parent' => 'espresso-toolbar-registrations-month',
1181
-					'title' => __( 'Pending', 'event_espresso'),
1182
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_pending_payment ), $reg_admin_url ),
1181
+					'title' => __('Pending', 'event_espresso'),
1182
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_pending_payment), $reg_admin_url),
1183 1183
 					'meta' => array(
1184 1184
 							'title' => __('Pending', 'event_espresso'),
1185 1185
 							'target' => '',
@@ -1189,14 +1189,14 @@  discard block
 block discarded – undo
1189 1189
 		}
1190 1190
 
1191 1191
 		//Registration Overview This Month Not Approved
1192
-		if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-not-approved' ) ) {
1192
+		if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-not-approved')) {
1193 1193
 			$admin_bar->add_menu(array(
1194 1194
 					'id' => 'espresso-toolbar-registrations-month-not-approved',
1195 1195
 					'parent' => 'espresso-toolbar-registrations-month',
1196
-					'title' => __( 'Not Approved', 'event_espresso'),
1197
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_not_approved ), $reg_admin_url ),
1196
+					'title' => __('Not Approved', 'event_espresso'),
1197
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_not_approved), $reg_admin_url),
1198 1198
 					'meta' => array(
1199
-							'title' => __('Not Approved', 'event_espresso' ),
1199
+							'title' => __('Not Approved', 'event_espresso'),
1200 1200
 							'target' => '',
1201 1201
 							'class' => $menu_class
1202 1202
 					),
@@ -1205,12 +1205,12 @@  discard block
 block discarded – undo
1205 1205
 
1206 1206
 
1207 1207
 		//Registration Overview This Month Cancelled
1208
-		if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-cancelled' ) ) {
1208
+		if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-cancelled')) {
1209 1209
 			$admin_bar->add_menu(array(
1210 1210
 					'id' => 'espresso-toolbar-registrations-month-cancelled',
1211 1211
 					'parent' => 'espresso-toolbar-registrations-month',
1212 1212
 					'title' => __('Cancelled', 'event_espresso'),
1213
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_cancelled ), $reg_admin_url ),
1213
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_cancelled), $reg_admin_url),
1214 1214
 					'meta' => array(
1215 1215
 							'title' => __('Cancelled', 'event_espresso'),
1216 1216
 							'target' => '',
@@ -1220,11 +1220,11 @@  discard block
 block discarded – undo
1220 1220
 		}
1221 1221
 
1222 1222
 		//Extensions & Services
1223
-		if ( $this->registry->CAP->current_user_can( 'ee_read_ee', 'ee_admin_bar_menu_espresso-toolbar-extensions-and-services' ) ) {
1223
+		if ($this->registry->CAP->current_user_can('ee_read_ee', 'ee_admin_bar_menu_espresso-toolbar-extensions-and-services')) {
1224 1224
 			$admin_bar->add_menu(array(
1225 1225
 					'id' => 'espresso-toolbar-extensions-and-services',
1226 1226
 					'parent' => 'espresso-toolbar',
1227
-					'title' => __( 'Extensions & Services', 'event_espresso' ),
1227
+					'title' => __('Extensions & Services', 'event_espresso'),
1228 1228
 					'href' => $extensions_admin_url,
1229 1229
 					'meta' => array(
1230 1230
 							'title' => __('Extensions & Services', 'event_espresso'),
@@ -1246,8 +1246,8 @@  discard block
 block discarded – undo
1246 1246
 	 * @param  array  $exclude_array any existing pages being excluded are in this array.
1247 1247
 	 * @return array
1248 1248
 	 */
1249
-	public function remove_pages_from_wp_list_pages( $exclude_array ) {
1250
-		return  array_merge( $exclude_array, $this->registry->CFG->core->get_critical_pages_array() );
1249
+	public function remove_pages_from_wp_list_pages($exclude_array) {
1250
+		return  array_merge($exclude_array, $this->registry->CFG->core->get_critical_pages_array());
1251 1251
 	}
1252 1252
 
1253 1253
 
@@ -1267,12 +1267,12 @@  discard block
 block discarded – undo
1267 1267
 	 */
1268 1268
 	public function wp_enqueue_scripts() {
1269 1269
 		// unlike other systems, EE_System_scripts loading is turned ON by default, but prior to the init hook, can be turned off via: add_filter( 'FHEE_load_EE_System_scripts', '__return_false' );
1270
-		if ( apply_filters( 'FHEE_load_EE_System_scripts', TRUE ) ) {
1270
+		if (apply_filters('FHEE_load_EE_System_scripts', TRUE)) {
1271 1271
 			// jquery_validate loading is turned OFF by default, but prior to the wp_enqueue_scripts hook, can be turned back on again via:  add_filter( 'FHEE_load_jquery_validate', '__return_true' );
1272
-			if ( apply_filters( 'FHEE_load_jquery_validate', FALSE ) ) {
1272
+			if (apply_filters('FHEE_load_jquery_validate', FALSE)) {
1273 1273
 				// register jQuery Validate and additional methods
1274
-				wp_register_script( 'jquery-validate', EE_GLOBAL_ASSETS_URL . 'scripts/jquery.validate.min.js', array('jquery' ), '1.15.0', TRUE );
1275
-				wp_register_script( 'jquery-validate-extra-methods', EE_GLOBAL_ASSETS_URL . 'scripts/jquery.validate.additional-methods.min.js', array( 'jquery', 'jquery-validate' ), '1.15.0', TRUE );
1274
+				wp_register_script('jquery-validate', EE_GLOBAL_ASSETS_URL.'scripts/jquery.validate.min.js', array('jquery'), '1.15.0', TRUE);
1275
+				wp_register_script('jquery-validate-extra-methods', EE_GLOBAL_ASSETS_URL.'scripts/jquery.validate.additional-methods.min.js', array('jquery', 'jquery-validate'), '1.15.0', TRUE);
1276 1276
 			}
1277 1277
 		}
1278 1278
 	}
Please login to merge, or discard this patch.
admin_pages/messages/Messages_Admin_Page.core.php 1 patch
Spacing   +598 added lines, -598 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1
-<?php if (!defined('EVENT_ESPRESSO_VERSION') )
2
-	{exit('NO direct script access allowed');}
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION'))
2
+	{exit('NO direct script access allowed'); }
3 3
 
4 4
 /**
5 5
  *
@@ -72,10 +72,10 @@  discard block
 block discarded – undo
72 72
 	/**
73 73
 	 * @param bool $routing
74 74
 	 */
75
-	public function __construct( $routing = true ) {
75
+	public function __construct($routing = true) {
76 76
 		//make sure messages autoloader is running
77 77
 		EED_Messages::set_autoloaders();
78
-		parent::__construct( $routing );
78
+		parent::__construct($routing);
79 79
 	}
80 80
 
81 81
 
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
 
90 90
 		$this->_activate_state = isset($this->_req_data['activate_state']) ? (array) $this->_req_data['activate_state'] : array();
91 91
 
92
-		$this->_active_messenger = isset( $this->_req_data['messenger'] ) ? $this->_req_data['messenger'] : null;
92
+		$this->_active_messenger = isset($this->_req_data['messenger']) ? $this->_req_data['messenger'] : null;
93 93
 		$this->_load_message_resource_manager();
94 94
 	}
95 95
 
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
 	 * @throws EE_Error
104 104
 	*/
105 105
 	protected function _load_message_resource_manager() {
106
-		$this->_message_resource_manager = EE_Registry::instance()->load_lib( 'Message_Resource_Manager' );
106
+		$this->_message_resource_manager = EE_Registry::instance()->load_lib('Message_Resource_Manager');
107 107
 	}
108 108
 
109 109
 
@@ -119,10 +119,10 @@  discard block
 block discarded – undo
119 119
 		$messengers = $this->_message_resource_manager->active_messengers();
120 120
 		//setup messengers for selects
121 121
 		$i = 1;
122
-		foreach ( $messengers as $messenger_name => $messenger ) {
123
-			if ( $messenger instanceof EE_messenger ) {
124
-				$m_values[ $i ][ 'id' ] = $messenger_name;
125
-				$m_values[ $i ][ 'text' ] = ucwords( $messenger->label[ 'singular' ] );
122
+		foreach ($messengers as $messenger_name => $messenger) {
123
+			if ($messenger instanceof EE_messenger) {
124
+				$m_values[$i]['id'] = $messenger_name;
125
+				$m_values[$i]['text'] = ucwords($messenger->label['singular']);
126 126
 				$i++;
127 127
 			}
128 128
 		}
@@ -141,10 +141,10 @@  discard block
 block discarded – undo
141 141
 		$mt_values = array();
142 142
 		$message_types = $this->_message_resource_manager->installed_message_types();
143 143
 		$i = 1;
144
-		foreach ( $message_types as $message_type_name => $message_type ) {
145
-			if ( $message_type instanceof EE_message_type ) {
146
-				$mt_values[ $i ][ 'id' ] = $message_type_name;
147
-				$mt_values[ $i ][ 'text' ] = ucwords( $message_type->label[ 'singular' ] );
144
+		foreach ($message_types as $message_type_name => $message_type) {
145
+			if ($message_type instanceof EE_message_type) {
146
+				$mt_values[$i]['id'] = $message_type_name;
147
+				$mt_values[$i]['text'] = ucwords($message_type->label['singular']);
148 148
 				$i++;
149 149
 			}
150 150
 		}
@@ -154,11 +154,11 @@  discard block
 block discarded – undo
154 154
 
155 155
 
156 156
 	protected function _ajax_hooks() {
157
-		add_action('wp_ajax_activate_messenger', array($this, 'activate_messenger_toggle' ) );
158
-		add_action('wp_ajax_activate_mt', array( $this, 'activate_mt_toggle') );
159
-		add_action('wp_ajax_ee_msgs_save_settings', array( $this, 'save_settings') );
160
-		add_action('wp_ajax_ee_msgs_update_mt_form', array( $this, 'update_mt_form' ) );
161
-		add_action('wp_ajax_switch_template_pack', array( $this, 'switch_template_pack' ) );
157
+		add_action('wp_ajax_activate_messenger', array($this, 'activate_messenger_toggle'));
158
+		add_action('wp_ajax_activate_mt', array($this, 'activate_mt_toggle'));
159
+		add_action('wp_ajax_ee_msgs_save_settings', array($this, 'save_settings'));
160
+		add_action('wp_ajax_ee_msgs_update_mt_form', array($this, 'update_mt_form'));
161
+		add_action('wp_ajax_switch_template_pack', array($this, 'switch_template_pack'));
162 162
 	}
163 163
 
164 164
 
@@ -190,13 +190,13 @@  discard block
 block discarded – undo
190 190
 	*		@return void
191 191
 	*/
192 192
 	protected function _set_page_routes() {
193
-		$grp_id = ! empty( $this->_req_data['GRP_ID'] ) && ! is_array( $this->_req_data['GRP_ID'] )
193
+		$grp_id = ! empty($this->_req_data['GRP_ID']) && ! is_array($this->_req_data['GRP_ID'])
194 194
 			? $this->_req_data['GRP_ID']
195 195
 			: 0;
196
-		$grp_id = empty( $grp_id ) && !empty( $this->_req_data['id'] )
196
+		$grp_id = empty($grp_id) && ! empty($this->_req_data['id'])
197 197
 			? $this->_req_data['id']
198 198
 			: $grp_id;
199
-		$msg_id = ! empty( $this->_req_data['MSG_ID'] ) && ! is_array( $this->_req_data['MSG_ID'] )
199
+		$msg_id = ! empty($this->_req_data['MSG_ID']) && ! is_array($this->_req_data['MSG_ID'])
200 200
 			? $this->_req_data['MSG_ID']
201 201
 			: 0;
202 202
 
@@ -238,35 +238,35 @@  discard block
 block discarded – undo
238 238
 			'insert_message_template' => array(
239 239
 				'func' => '_insert_or_update_message_template',
240 240
 				'capability' => 'ee_edit_messages',
241
-				'args' => array( 'new_template' => true ),
241
+				'args' => array('new_template' => true),
242 242
 				'noheader' => true
243 243
 			 ),
244 244
 			'update_message_template' => array(
245 245
 				'func' => '_insert_or_update_message_template',
246 246
 				'capability' => 'ee_edit_message',
247 247
 				'obj_id' => $grp_id,
248
-				'args' => array( 'new_template' => false ),
248
+				'args' => array('new_template' => false),
249 249
 				'noheader' => true
250 250
 			),
251 251
 			'trash_message_template' => array(
252 252
 				'func' => '_trash_or_restore_message_template',
253 253
 				'capability' => 'ee_delete_message',
254 254
 				'obj_id' => $grp_id,
255
-				'args' => array( 'trash' => true, 'all' => true ),
255
+				'args' => array('trash' => true, 'all' => true),
256 256
 				'noheader' => true
257 257
 			),
258 258
 			'trash_message_template_context' => array(
259 259
 				'func' => '_trash_or_restore_message_template',
260 260
 				'capability' => 'ee_delete_message',
261 261
 				'obj_id' => $grp_id,
262
-				'args' => array( 'trash' => true ),
262
+				'args' => array('trash' => true),
263 263
 				'noheader' => true
264 264
 			),
265 265
 			'restore_message_template' => array(
266 266
 				'func' => '_trash_or_restore_message_template',
267 267
 				'capability' => 'ee_delete_message',
268 268
 				'obj_id' => $grp_id,
269
-				'args' => array( 'trash' => false, 'all' => true ),
269
+				'args' => array('trash' => false, 'all' => true),
270 270
 				'noheader' => true
271 271
 			),
272 272
 			'restore_message_template_context' => array(
@@ -341,7 +341,7 @@  discard block
 block discarded – undo
341 341
 					'order' => 10
342 342
 				),
343 343
 				'list_table' => 'EE_Message_List_Table',
344
-				'qtips' => array( 'EE_Message_List_Table_Tips' ),
344
+				'qtips' => array('EE_Message_List_Table_Tips'),
345 345
 				'require_nonce' => false
346 346
 			),
347 347
 			'global_mtps' => array(
@@ -380,7 +380,7 @@  discard block
 block discarded – undo
380 380
 						'filename' => 'messages_overview_other',
381 381
 					),
382 382
 				),
383
-				'help_tour' => array( 'Messages_Overview_Help_Tour' ),
383
+				'help_tour' => array('Messages_Overview_Help_Tour'),
384 384
 				'require_nonce' => false
385 385
 			),
386 386
 			'custom_mtps' => array(
@@ -415,7 +415,7 @@  discard block
 block discarded – undo
415 415
 				),
416 416
 				'metaboxes' => array('_publish_post_box', '_register_edit_meta_boxes'),
417 417
 				'has_metaboxes' => true,
418
-				'help_tour' => array( 'Message_Templates_Edit_Help_Tour' ),
418
+				'help_tour' => array('Message_Templates_Edit_Help_Tour'),
419 419
 				'help_tabs' => array(
420 420
 					'edit_message_template' => array(
421 421
 						'title' => __('Message Template Editor', 'event_espresso'),
@@ -471,7 +471,7 @@  discard block
 block discarded – undo
471 471
 						'filename' => 'messages_settings_messengers'
472 472
 					),
473 473
 				),
474
-				'help_tour' => array( 'Messages_Settings_Help_Tour' ),
474
+				'help_tour' => array('Messages_Settings_Help_Tour'),
475 475
 				'require_nonce' => false
476 476
 			)
477 477
 		);
@@ -504,7 +504,7 @@  discard block
 block discarded – undo
504 504
 
505 505
 
506 506
 	protected function _add_screen_options_default() {
507
-		$this->_admin_page_title = __( 'Message Activity', 'event_espresso' );
507
+		$this->_admin_page_title = __('Message Activity', 'event_espresso');
508 508
 		$this->_per_page_screen_option();
509 509
 	}
510 510
 
@@ -526,37 +526,37 @@  discard block
 block discarded – undo
526 526
 
527 527
 
528 528
 	public function messages_help_tab() {
529
-		EEH_Template::display_template( EE_MSG_TEMPLATE_PATH . 'ee_msg_messages_help_tab.template.php' );
529
+		EEH_Template::display_template(EE_MSG_TEMPLATE_PATH.'ee_msg_messages_help_tab.template.php');
530 530
 	}
531 531
 
532 532
 
533 533
 	public function messengers_help_tab() {
534
-		EEH_Template::display_template( EE_MSG_TEMPLATE_PATH . 'ee_msg_messenger_help_tab.template.php' );
534
+		EEH_Template::display_template(EE_MSG_TEMPLATE_PATH.'ee_msg_messenger_help_tab.template.php');
535 535
 	}
536 536
 
537 537
 
538 538
 	public function message_types_help_tab() {
539
-		EEH_Template::display_template( EE_MSG_TEMPLATE_PATH . 'ee_msg_message_type_help_tab.template.php' );
539
+		EEH_Template::display_template(EE_MSG_TEMPLATE_PATH.'ee_msg_message_type_help_tab.template.php');
540 540
 	}
541 541
 
542 542
 
543 543
 	public function messages_overview_help_tab() {
544
-		EEH_Template::display_template( EE_MSG_TEMPLATE_PATH . 'ee_msg_overview_help_tab.template.php' );
544
+		EEH_Template::display_template(EE_MSG_TEMPLATE_PATH.'ee_msg_overview_help_tab.template.php');
545 545
 	}
546 546
 
547 547
 
548 548
 	public function message_templates_help_tab() {
549
-		EEH_Template::display_template( EE_MSG_TEMPLATE_PATH . 'ee_msg_message_templates_help_tab.template.php' );
549
+		EEH_Template::display_template(EE_MSG_TEMPLATE_PATH.'ee_msg_message_templates_help_tab.template.php');
550 550
 	}
551 551
 
552 552
 
553 553
 	public function edit_message_template_help_tab() {
554
-		$args['img1'] = '<img src="' . EE_MSG_ASSETS_URL . 'images/editor.png' . '" alt="' . esc_attr__('Editor Title', 'event_espresso') . '" />';
555
-		$args['img2'] = '<img src="' . EE_MSG_ASSETS_URL . 'images/switch-context.png' . '" alt="' . esc_attr__('Context Switcher and Preview', 'event_espresso') . '" />';
556
-		$args['img3'] = '<img class="left" src="' . EE_MSG_ASSETS_URL . 'images/form-fields.png' . '" alt="' . esc_attr__('Message Template Form Fields', 'event_espresso') . '" />';
557
-		$args['img4'] = '<img class="right" src="' . EE_MSG_ASSETS_URL . 'images/shortcodes-metabox.png' . '" alt="' . esc_attr__('Shortcodes Metabox', 'event_espresso') . '" />';
558
-		$args['img5'] = '<img class="right" src="' . EE_MSG_ASSETS_URL . 'images/publish-meta-box.png' . '" alt="' . esc_attr__('Publish Metabox', 'event_espresso') . '" />';
559
-		EEH_Template::display_template( EE_MSG_TEMPLATE_PATH . 'ee_msg_messages_templates_editor_help_tab.template.php', $args);
554
+		$args['img1'] = '<img src="'.EE_MSG_ASSETS_URL.'images/editor.png'.'" alt="'.esc_attr__('Editor Title', 'event_espresso').'" />';
555
+		$args['img2'] = '<img src="'.EE_MSG_ASSETS_URL.'images/switch-context.png'.'" alt="'.esc_attr__('Context Switcher and Preview', 'event_espresso').'" />';
556
+		$args['img3'] = '<img class="left" src="'.EE_MSG_ASSETS_URL.'images/form-fields.png'.'" alt="'.esc_attr__('Message Template Form Fields', 'event_espresso').'" />';
557
+		$args['img4'] = '<img class="right" src="'.EE_MSG_ASSETS_URL.'images/shortcodes-metabox.png'.'" alt="'.esc_attr__('Shortcodes Metabox', 'event_espresso').'" />';
558
+		$args['img5'] = '<img class="right" src="'.EE_MSG_ASSETS_URL.'images/publish-meta-box.png'.'" alt="'.esc_attr__('Publish Metabox', 'event_espresso').'" />';
559
+		EEH_Template::display_template(EE_MSG_TEMPLATE_PATH.'ee_msg_messages_templates_editor_help_tab.template.php', $args);
560 560
 	}
561 561
 
562 562
 
@@ -564,22 +564,22 @@  discard block
 block discarded – undo
564 564
 	public function message_template_shortcodes_help_tab() {
565 565
 		$this->_set_shortcodes();
566 566
 		$args['shortcodes'] = $this->_shortcodes;
567
-		EEH_Template::display_template( EE_MSG_TEMPLATE_PATH . 'ee_msg_messages_shortcodes_help_tab.template.php', $args );
567
+		EEH_Template::display_template(EE_MSG_TEMPLATE_PATH.'ee_msg_messages_shortcodes_help_tab.template.php', $args);
568 568
 	}
569 569
 
570 570
 
571 571
 
572 572
 	public function preview_message_help_tab() {
573
-		EEH_Template::display_template( EE_MSG_TEMPLATE_PATH . 'ee_msg_preview_help_tab.template.php' );
573
+		EEH_Template::display_template(EE_MSG_TEMPLATE_PATH.'ee_msg_preview_help_tab.template.php');
574 574
 	}
575 575
 
576 576
 
577 577
 	public function settings_help_tab() {
578
-		$args['img1'] = '<img class="inline-text" src="' . EE_MSG_ASSETS_URL . 'images/email-tab-active.png' . '" alt="' . esc_attr__('Active Email Tab', 'event_espresso') . '" />';
579
-		$args['img2'] = '<img class="inline-text" src="' . EE_MSG_ASSETS_URL . 'images/email-tab-inactive.png' . '" alt="' . esc_attr__('Inactive Email Tab', 'event_espresso') . '" />';
578
+		$args['img1'] = '<img class="inline-text" src="'.EE_MSG_ASSETS_URL.'images/email-tab-active.png'.'" alt="'.esc_attr__('Active Email Tab', 'event_espresso').'" />';
579
+		$args['img2'] = '<img class="inline-text" src="'.EE_MSG_ASSETS_URL.'images/email-tab-inactive.png'.'" alt="'.esc_attr__('Inactive Email Tab', 'event_espresso').'" />';
580 580
 		$args['img3'] = '<div class="switch"><input id="ee-on-off-toggle-on" class="ee-on-off-toggle ee-toggle-round-flat" type="checkbox" checked="checked"><label for="ee-on-off-toggle-on"></label>';
581 581
 		$args['img4'] = '<div class="switch"><input id="ee-on-off-toggle-on" class="ee-on-off-toggle ee-toggle-round-flat" type="checkbox"><label for="ee-on-off-toggle-on"></label>';
582
-		EEH_Template::display_template( EE_MSG_TEMPLATE_PATH . 'ee_msg_messages_settings_help_tab.template.php', $args);
582
+		EEH_Template::display_template(EE_MSG_TEMPLATE_PATH.'ee_msg_messages_settings_help_tab.template.php', $args);
583 583
 	}
584 584
 
585 585
 
@@ -587,31 +587,31 @@  discard block
 block discarded – undo
587 587
 
588 588
 
589 589
 	public function load_scripts_styles() {
590
-		wp_register_style('espresso_ee_msg', EE_MSG_ASSETS_URL . 'ee_message_admin.css', EVENT_ESPRESSO_VERSION );
590
+		wp_register_style('espresso_ee_msg', EE_MSG_ASSETS_URL.'ee_message_admin.css', EVENT_ESPRESSO_VERSION);
591 591
 		wp_enqueue_style('espresso_ee_msg');
592 592
 
593
-		wp_register_script('ee-messages-settings', EE_MSG_ASSETS_URL . 'ee-messages-settings.js', array('jquery-ui-droppable', 'ee-serialize-full-array'), EVENT_ESPRESSO_VERSION, true );
594
-		wp_register_script( 'ee-msg-list-table-js', EE_MSG_ASSETS_URL. 'ee_message_admin_list_table.js', array( 'ee-dialog' ), EVENT_ESPRESSO_VERSION );
593
+		wp_register_script('ee-messages-settings', EE_MSG_ASSETS_URL.'ee-messages-settings.js', array('jquery-ui-droppable', 'ee-serialize-full-array'), EVENT_ESPRESSO_VERSION, true);
594
+		wp_register_script('ee-msg-list-table-js', EE_MSG_ASSETS_URL.'ee_message_admin_list_table.js', array('ee-dialog'), EVENT_ESPRESSO_VERSION);
595 595
 	}
596 596
 
597 597
 
598 598
 
599 599
 	public function load_scripts_styles_default() {
600
-		wp_enqueue_script( 'ee-msg-list-table-js' );
600
+		wp_enqueue_script('ee-msg-list-table-js');
601 601
 	}
602 602
 
603 603
 
604 604
 
605 605
 
606 606
 
607
-	public function wp_editor_css( $mce_css ) {
607
+	public function wp_editor_css($mce_css) {
608 608
 		//if we're on the edit_message_template route
609
-		if ( $this->_req_action == 'edit_message_template' && $this->_active_messenger instanceof EE_messenger  ) {
609
+		if ($this->_req_action == 'edit_message_template' && $this->_active_messenger instanceof EE_messenger) {
610 610
 			$message_type_name = $this->_active_message_type_name;
611 611
 
612 612
 			//we're going to REPLACE the existing mce css
613 613
 			//we need to get the css file location from the active messenger
614
-			$mce_css = $this->_active_messenger->get_variation($this->_template_pack, $message_type_name, true, 'wpeditor', $this->_variation );
614
+			$mce_css = $this->_active_messenger->get_variation($this->_template_pack, $message_type_name, true, 'wpeditor', $this->_variation);
615 615
 		}
616 616
 
617 617
 		return $mce_css;
@@ -629,15 +629,15 @@  discard block
 block discarded – undo
629 629
 			$this->_message_template_group->messenger_obj()->label['singular'],
630 630
 			$this->_message_template_group->message_type_obj()->label['singular']
631 631
 		);
632
-		EE_Registry::$i18n_js_strings['confirm_switch_template_pack'] = __('Switching the template pack for a messages template will reset the content for the template so the new layout is loaded.  Any custom content in the existing template will be lost. Are you sure you wish to do this?', 'event_espresso' );
632
+		EE_Registry::$i18n_js_strings['confirm_switch_template_pack'] = __('Switching the template pack for a messages template will reset the content for the template so the new layout is loaded.  Any custom content in the existing template will be lost. Are you sure you wish to do this?', 'event_espresso');
633 633
 
634
-		wp_register_script('ee_msgs_edit_js', EE_MSG_ASSETS_URL . 'ee_message_editor.js', array('jquery'), EVENT_ESPRESSO_VERSION );
634
+		wp_register_script('ee_msgs_edit_js', EE_MSG_ASSETS_URL.'ee_message_editor.js', array('jquery'), EVENT_ESPRESSO_VERSION);
635 635
 
636 636
 		wp_enqueue_script('ee_admin_js');
637 637
 		wp_enqueue_script('ee_msgs_edit_js');
638 638
 
639 639
 		//add in special css for tiny_mce
640
-		add_filter( 'mce_css', array( $this, 'wp_editor_css' ) );
640
+		add_filter('mce_css', array($this, 'wp_editor_css'));
641 641
 	}
642 642
 
643 643
 
@@ -646,22 +646,22 @@  discard block
 block discarded – undo
646 646
 
647 647
 		$this->_set_message_template_group();
648 648
 
649
-		if ( isset( $this->_req_data['messenger'] ) ) {
650
-			$this->_active_messenger = $this->_message_resource_manager->get_active_messenger( $this->_req_data['messenger'] );
649
+		if (isset($this->_req_data['messenger'])) {
650
+			$this->_active_messenger = $this->_message_resource_manager->get_active_messenger($this->_req_data['messenger']);
651 651
 		}
652 652
 
653
-		$message_type_name = isset( $this->_req_data['message_type'] ) ? $this->_req_data['message_type'] : '';
653
+		$message_type_name = isset($this->_req_data['message_type']) ? $this->_req_data['message_type'] : '';
654 654
 
655 655
 
656
-		wp_enqueue_style('espresso_preview_css', $this->_active_messenger->get_variation( $this->_template_pack, $message_type_name, true, 'preview', $this->_variation ) );
656
+		wp_enqueue_style('espresso_preview_css', $this->_active_messenger->get_variation($this->_template_pack, $message_type_name, true, 'preview', $this->_variation));
657 657
 	}
658 658
 
659 659
 
660 660
 
661 661
 	public function load_scripts_styles_settings() {
662
-		wp_register_style( 'ee-message-settings', EE_MSG_ASSETS_URL . 'ee_message_settings.css', array(), EVENT_ESPRESSO_VERSION );
663
-		wp_enqueue_style( 'ee-text-links' );
664
-		wp_enqueue_style( 'ee-message-settings' );
662
+		wp_register_style('ee-message-settings', EE_MSG_ASSETS_URL.'ee_message_settings.css', array(), EVENT_ESPRESSO_VERSION);
663
+		wp_enqueue_style('ee-text-links');
664
+		wp_enqueue_style('ee-message-settings');
665 665
 
666 666
 		wp_enqueue_script('ee-messages-settings');
667 667
 	}
@@ -691,40 +691,40 @@  discard block
 block discarded – undo
691 691
 	 * set views array for message queue list table
692 692
 	 */
693 693
 	public function _set_list_table_views_default() {
694
-		EE_Registry::instance()->load_helper( 'Template' );
694
+		EE_Registry::instance()->load_helper('Template');
695 695
 
696
-		$common_bulk_actions = EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'message_list_table_bulk_actions' )
696
+		$common_bulk_actions = EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'message_list_table_bulk_actions')
697 697
 			? array(
698
-				'generate_now' => __( 'Generate Now', 'event_espresso' ),
699
-		        'generate_and_send_now' => __( 'Generate and Send Now', 'event_espresso' ),
700
-		        'queue_for_resending' => __( 'Queue for Resending', 'event_espresso' ),
701
-		        'send_now' => __( 'Send Now', 'event_espresso' )
698
+				'generate_now' => __('Generate Now', 'event_espresso'),
699
+		        'generate_and_send_now' => __('Generate and Send Now', 'event_espresso'),
700
+		        'queue_for_resending' => __('Queue for Resending', 'event_espresso'),
701
+		        'send_now' => __('Send Now', 'event_espresso')
702 702
 				)
703 703
 			: array();
704 704
 
705
-		$delete_bulk_action = EE_Registry::instance()->CAP->current_user_can( 'ee_delete_messages', 'message_list_table_bulk_actions' )
706
-			? array( 'delete_ee_messages' => __( 'Delete Messages', 'event_espresso' ) )
705
+		$delete_bulk_action = EE_Registry::instance()->CAP->current_user_can('ee_delete_messages', 'message_list_table_bulk_actions')
706
+			? array('delete_ee_messages' => __('Delete Messages', 'event_espresso'))
707 707
 			: array();
708 708
 
709 709
 
710 710
 		$this->_views = array(
711 711
 			 'all' => array(
712 712
 			    'slug' => 'all',
713
-			    'label' => __( 'All', 'event_espresso' ),
713
+			    'label' => __('All', 'event_espresso'),
714 714
 			    'count' => 0,
715
-			    'bulk_action' => array_merge( $common_bulk_actions, $delete_bulk_action )
715
+			    'bulk_action' => array_merge($common_bulk_actions, $delete_bulk_action)
716 716
 			 )
717 717
 		);
718 718
 
719 719
 
720
-		foreach ( EEM_Message::instance()->all_statuses() as $status ) {
721
-			if ( $status === EEM_Message::status_debug_only && ( ! defined( 'WP_DEBUG' ) || ! WP_DEBUG ) ) {
720
+		foreach (EEM_Message::instance()->all_statuses() as $status) {
721
+			if ($status === EEM_Message::status_debug_only && ( ! defined('WP_DEBUG') || ! WP_DEBUG)) {
722 722
 				continue;
723 723
 			}
724 724
 			$status_bulk_actions = $common_bulk_actions;
725 725
 			//unset bulk actions not applying to status
726
-			if ( ! empty( $status_bulk_actions ) ) {
727
-				switch ( $status ) {
726
+			if ( ! empty($status_bulk_actions)) {
727
+				switch ($status) {
728 728
 					case EEM_Message::status_idle :
729 729
 					case EEM_Message::status_resend :
730 730
 						$status_bulk_actions['send_now'] = $common_bulk_actions['send_now'];
@@ -736,21 +736,21 @@  discard block
 block discarded – undo
736 736
 						break;
737 737
 
738 738
 					case EEM_Message::status_incomplete :
739
-						unset( $status_bulk_actions['queue_for_resending'], $status_bulk_actions['send_now'] );
739
+						unset($status_bulk_actions['queue_for_resending'], $status_bulk_actions['send_now']);
740 740
 						break;
741 741
 
742 742
 					case EEM_Message::status_retry :
743 743
 					case EEM_Message::status_sent :
744
-						unset( $status_bulk_actions['generate_now'], $status_bulk_actions['generate_and_send_now'] );
744
+						unset($status_bulk_actions['generate_now'], $status_bulk_actions['generate_and_send_now']);
745 745
 						break;
746 746
 				}
747 747
 			}
748 748
 
749
-			$this->_views[ strtolower( $status ) ] = array(
750
-				'slug' => strtolower( $status ),
751
-				'label' => EEH_Template::pretty_status( $status, false, 'sentence' ),
749
+			$this->_views[strtolower($status)] = array(
750
+				'slug' => strtolower($status),
751
+				'label' => EEH_Template::pretty_status($status, false, 'sentence'),
752 752
 				'count' => 0,
753
-				'bulk_action' => array_merge( $status_bulk_actions, $delete_bulk_action )
753
+				'bulk_action' => array_merge($status_bulk_actions, $delete_bulk_action)
754 754
 			);
755 755
 		}
756 756
 	}
@@ -769,8 +769,8 @@  discard block
 block discarded – undo
769 769
 	protected function _message_queue_list_table() {
770 770
 		$this->_search_btn_label = __('Message Activity', 'event_espresso');
771 771
 		$this->_template_args['per_column'] = 6;
772
-		$this->_template_args['after_list_table'] = $this->_display_legend( $this->_message_legend_items() );
773
-		$this->_template_args['before_list_table'] = '<h3>' . EEM_Message::instance()->get_pretty_label_for_results() . '</h3>';
772
+		$this->_template_args['after_list_table'] = $this->_display_legend($this->_message_legend_items());
773
+		$this->_template_args['before_list_table'] = '<h3>'.EEM_Message::instance()->get_pretty_label_for_results().'</h3>';
774 774
 		$this->display_admin_list_table_page_with_no_sidebar();
775 775
 	}
776 776
 
@@ -783,8 +783,8 @@  discard block
 block discarded – undo
783 783
 		$action_css_classes = EEH_MSG_Template::get_message_action_icons();
784 784
 		$action_items = array();
785 785
 
786
-		foreach( $action_css_classes as $action_item => $action_details ) {
787
-			if ( $action_item === 'see_notifications_for' ) {
786
+		foreach ($action_css_classes as $action_item => $action_details) {
787
+			if ($action_item === 'see_notifications_for') {
788 788
 				continue;
789 789
 			}
790 790
 			$action_items[$action_item] = array(
@@ -796,37 +796,37 @@  discard block
 block discarded – undo
796 796
 		/** @type array $status_items status legend setup*/
797 797
 		$status_items = array(
798 798
 			'sent_status' => array(
799
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Message::status_sent,
800
-				'desc' => EEH_Template::pretty_status( EEM_Message::status_sent, false, 'sentence' )
799
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Message::status_sent,
800
+				'desc' => EEH_Template::pretty_status(EEM_Message::status_sent, false, 'sentence')
801 801
 				),
802 802
 			'idle_status' => array(
803
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Message::status_idle,
804
-				'desc' => EEH_Template::pretty_status( EEM_Message::status_idle, false, 'sentence' )
803
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Message::status_idle,
804
+				'desc' => EEH_Template::pretty_status(EEM_Message::status_idle, false, 'sentence')
805 805
 				),
806 806
 			'failed_status' => array(
807
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Message::status_failed,
808
-				'desc' => EEH_Template::pretty_status( EEM_Message::status_failed, false, 'sentence' )
807
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Message::status_failed,
808
+				'desc' => EEH_Template::pretty_status(EEM_Message::status_failed, false, 'sentence')
809 809
 			),
810 810
 			'resend_status' => array(
811
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Message::status_resend,
812
-				'desc' => EEH_Template::pretty_status( EEM_Message::status_resend, false, 'sentence' )
811
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Message::status_resend,
812
+				'desc' => EEH_Template::pretty_status(EEM_Message::status_resend, false, 'sentence')
813 813
 				),
814 814
 			'incomplete_status' => array(
815
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Message::status_incomplete,
816
-				'desc' => EEH_Template::pretty_status( EEM_Message::status_incomplete, false, 'sentence' )
815
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Message::status_incomplete,
816
+				'desc' => EEH_Template::pretty_status(EEM_Message::status_incomplete, false, 'sentence')
817 817
 				),
818 818
 			'retry_status' => array(
819
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Message::status_retry,
820
-				'desc' => EEH_Template::pretty_status( EEM_Message::status_retry, false, 'sentence' )
819
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Message::status_retry,
820
+				'desc' => EEH_Template::pretty_status(EEM_Message::status_retry, false, 'sentence')
821 821
 				)
822 822
 		);
823
-		if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
823
+		if (defined('WP_DEBUG') && WP_DEBUG) {
824 824
 			$status_items['debug_only_status'] = array(
825
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Message::status_debug_only,
826
-				'desc' => EEH_Template::pretty_status( EEM_Message::status_debug_only, false, 'sentence' )
825
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Message::status_debug_only,
826
+				'desc' => EEH_Template::pretty_status(EEM_Message::status_debug_only, false, 'sentence')
827 827
 			);
828 828
 		}
829
-		return array_merge( $action_items, $status_items );
829
+		return array_merge($action_items, $status_items);
830 830
 	}
831 831
 
832 832
 
@@ -836,9 +836,9 @@  discard block
 block discarded – undo
836 836
 
837 837
 	protected function _custom_mtps_preview() {
838 838
 		$this->_admin_page_title = __('Custom Message Templates (Preview)', 'event_espresso');
839
-		$this->_template_args['preview_img'] = '<img src="' . EE_MSG_ASSETS_URL . 'images/custom_mtps_preview.png" alt="' . esc_attr__('Preview Custom Message Templates screenshot', 'event_espresso' ) . '" />';
839
+		$this->_template_args['preview_img'] = '<img src="'.EE_MSG_ASSETS_URL.'images/custom_mtps_preview.png" alt="'.esc_attr__('Preview Custom Message Templates screenshot', 'event_espresso').'" />';
840 840
 		$this->_template_args['preview_text'] = '<strong>'.__('Custom Message Templates is a feature that is only available in the caffeinated version of Event Espresso.  With the Custom Message Templates feature, you are able to create custom templates and set them per event.', 'event_espresso').'</strong>';
841
-		$this->display_admin_caf_preview_page( 'custom_message_types', false );
841
+		$this->display_admin_caf_preview_page('custom_message_types', false);
842 842
 	}
843 843
 
844 844
 
@@ -862,31 +862,31 @@  discard block
 block discarded – undo
862 862
 	 *
863 863
 	 * @return array
864 864
 	 */
865
-	public function get_message_templates( $perpage = 10, $type = 'in_use', $count = false, $all = false, $global = true ) {
865
+	public function get_message_templates($perpage = 10, $type = 'in_use', $count = false, $all = false, $global = true) {
866 866
 
867 867
 		$MTP = EEM_Message_Template_Group::instance();
868 868
 
869 869
 		$this->_req_data['orderby'] = empty($this->_req_data['orderby']) ? 'GRP_ID' : $this->_req_data['orderby'];
870 870
 		$orderby = $this->_req_data['orderby'];
871 871
 
872
-		$order = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] ) ) ? $this->_req_data['order'] : 'ASC';
872
+		$order = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'ASC';
873 873
 
874
-		$current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1;
875
-		$per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $perpage;
874
+		$current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1;
875
+		$per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $perpage;
876 876
 
877
-		$offset = ($current_page-1)*$per_page;
878
-		$limit = $all ? null : array( $offset, $per_page );
877
+		$offset = ($current_page - 1) * $per_page;
878
+		$limit = $all ? null : array($offset, $per_page);
879 879
 
880 880
 
881 881
 		//options will match what is in the _views array property
882
-		switch( $type ) {
882
+		switch ($type) {
883 883
 
884 884
 			case 'in_use':
885
-				$templates = $MTP->get_all_active_message_templates($orderby, $order, $limit, $count, $global, true );
885
+				$templates = $MTP->get_all_active_message_templates($orderby, $order, $limit, $count, $global, true);
886 886
 				break;
887 887
 
888 888
 			default:
889
-				$templates = $MTP->get_all_trashed_grouped_message_templates($orderby, $order, $limit, $count, $global );
889
+				$templates = $MTP->get_all_trashed_grouped_message_templates($orderby, $order, $limit, $count, $global);
890 890
 
891 891
 		}
892 892
 
@@ -905,8 +905,8 @@  discard block
 block discarded – undo
905 905
 		$installed_message_types = $this->_message_resource_manager->installed_message_types();
906 906
 		$installed = array();
907 907
 
908
-		foreach ( $installed_message_types as $message_type ) {
909
-			$installed[ $message_type->name ] = $message_type;
908
+		foreach ($installed_message_types as $message_type) {
909
+			$installed[$message_type->name] = $message_type;
910 910
 		}
911 911
 
912 912
 		return $installed;
@@ -925,24 +925,24 @@  discard block
 block discarded – undo
925 925
 	 *
926 926
 	 * @throws EE_error
927 927
 	 */
928
-	protected function _add_message_template(  $message_type = '', $messenger='', $GRP_ID = '' ) {
928
+	protected function _add_message_template($message_type = '', $messenger = '', $GRP_ID = '') {
929 929
 		//set values override any request data
930
-		$message_type = !empty( $message_type ) ? $message_type : '';
931
-		$message_type = empty( $message_type ) && !empty( $this->_req_data['message_type'] ) ? $this->_req_data['message_type'] : $message_type;
930
+		$message_type = ! empty($message_type) ? $message_type : '';
931
+		$message_type = empty($message_type) && ! empty($this->_req_data['message_type']) ? $this->_req_data['message_type'] : $message_type;
932 932
 
933
-		$messenger = !empty( $messenger ) ? $messenger : '';
934
-		$messenger = empty( $messenger ) && !empty( $this->_req_data['messenger'] ) ? $this->_req_data['messenger'] : $messenger;
933
+		$messenger = ! empty($messenger) ? $messenger : '';
934
+		$messenger = empty($messenger) && ! empty($this->_req_data['messenger']) ? $this->_req_data['messenger'] : $messenger;
935 935
 
936
-		$GRP_ID = !empty( $GRP_ID ) ? $GRP_ID : '';
937
-		$GRP_ID = empty( $GRP_ID ) && !empty( $this->_req_data['GRP_ID'] ) ? $this->_req_data['GRP_ID'] : $GRP_ID;
936
+		$GRP_ID = ! empty($GRP_ID) ? $GRP_ID : '';
937
+		$GRP_ID = empty($GRP_ID) && ! empty($this->_req_data['GRP_ID']) ? $this->_req_data['GRP_ID'] : $GRP_ID;
938 938
 
939 939
 		//we need messenger and message type.  They should be coming from the event editor. If not here then return error
940
-		if ( empty( $message_type ) || empty( $messenger )  )
941
-			{throw new EE_error(__('Sorry, but we can\'t create new templates because we\'re missing the messenger or message type', 'event_espresso'));}
940
+		if (empty($message_type) || empty($messenger))
941
+			{throw new EE_error(__('Sorry, but we can\'t create new templates because we\'re missing the messenger or message type', 'event_espresso')); }
942 942
 
943 943
 		//we need the GRP_ID for the template being used as the base for the new template
944
-		if ( empty( $GRP_ID ) )
945
-			{throw new EE_Error( __('In order to create a custom message template the GRP_ID of the template being used as a base is needed', 'event_espresso' ) );}
944
+		if (empty($GRP_ID))
945
+			{throw new EE_Error(__('In order to create a custom message template the GRP_ID of the template being used as a base is needed', 'event_espresso')); }
946 946
 
947 947
 		//let's just make sure the template gets generated!
948 948
 
@@ -963,8 +963,8 @@  discard block
 block discarded – undo
963 963
 	 * @param int      $GRP_ID         GRP_ID for the related message template group this new template will be based
964 964
 	 *                                 off of.
965 965
 	 */
966
-	public function add_message_template( $message_type, $messenger, $GRP_ID ) {
967
-		$this->_add_message_template( $message_type, $messenger, $GRP_ID );
966
+	public function add_message_template($message_type, $messenger, $GRP_ID) {
967
+		$this->_add_message_template($message_type, $messenger, $GRP_ID);
968 968
 	}
969 969
 
970 970
 
@@ -975,14 +975,14 @@  discard block
 block discarded – undo
975 975
 	 * @return void
976 976
 	 */
977 977
 	protected function _edit_message_template() {
978
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '');
978
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
979 979
 		$template_fields = '';
980 980
 		$sidebar_fields = '';
981 981
 		//we filter the tinyMCE settings to remove the validation since message templates by their nature will not have valid html in the templates.
982
-		add_filter( 'tiny_mce_before_init', array( $this, 'filter_tinymce_init'), 10, 2 );
982
+		add_filter('tiny_mce_before_init', array($this, 'filter_tinymce_init'), 10, 2);
983 983
 
984
-		$GRP_ID = isset( $this->_req_data['id'] ) && !empty( $this->_req_data['id'] )
985
-			? absint( $this->_req_data['id'] )
984
+		$GRP_ID = isset($this->_req_data['id']) && ! empty($this->_req_data['id'])
985
+			? absint($this->_req_data['id'])
986 986
 			: false;
987 987
 
988 988
 		$this->_set_shortcodes(); //this also sets the _message_template property.
@@ -990,20 +990,20 @@  discard block
 block discarded – undo
990 990
 		$c_label = $message_template_group->context_label();
991 991
 		$c_config = $message_template_group->contexts_config();
992 992
 
993
-		reset( $c_config );
994
-		$context = isset( $this->_req_data['context']) && !empty($this->_req_data['context'] )
993
+		reset($c_config);
994
+		$context = isset($this->_req_data['context']) && ! empty($this->_req_data['context'])
995 995
 			? strtolower($this->_req_data['context'])
996 996
 			: key($c_config);
997 997
 
998 998
 
999
-		if ( empty($GRP_ID) ) {
999
+		if (empty($GRP_ID)) {
1000 1000
 			$action = 'insert_message_template';
1001 1001
 			//$button_both = false;
1002 1002
 			//$button_text = array( __( 'Save','event_espresso') );
1003 1003
 			//$button_actions = array('something_different');
1004 1004
 			//$referrer = false;
1005 1005
 			$edit_message_template_form_url = add_query_arg(
1006
-				array( 'action' => $action, 'noheader' => true ),
1006
+				array('action' => $action, 'noheader' => true),
1007 1007
 				EE_MSG_ADMIN_URL
1008 1008
 			);
1009 1009
 		} else {
@@ -1013,7 +1013,7 @@  discard block
 block discarded – undo
1013 1013
 			//$button_actions = array();
1014 1014
 			//$referrer = $this->_admin_base_url;
1015 1015
 			$edit_message_template_form_url = add_query_arg(
1016
-				array( 'action' => $action, 'noheader' => true ),
1016
+				array('action' => $action, 'noheader' => true),
1017 1017
 				EE_MSG_ADMIN_URL
1018 1018
 			);
1019 1019
 		}
@@ -1027,14 +1027,14 @@  discard block
 block discarded – undo
1027 1027
 
1028 1028
 		//Do we have any validation errors?
1029 1029
 		$validators = $this->_get_transient();
1030
-		$v_fields = !empty($validators) ? array_keys($validators) : array();
1030
+		$v_fields = ! empty($validators) ? array_keys($validators) : array();
1031 1031
 
1032 1032
 
1033 1033
 		//we need to assemble the title from Various details
1034 1034
 		$context_label = sprintf(
1035 1035
 			__('(%s %s)', 'event_espresso'),
1036 1036
 			$c_config[$context]['label'],
1037
-			ucwords($c_label['label'] )
1037
+			ucwords($c_label['label'])
1038 1038
 		);
1039 1039
 
1040 1040
 		$title = sprintf(
@@ -1055,7 +1055,7 @@  discard block
 block discarded – undo
1055 1055
 			$message_template_group->message_type()
1056 1056
 		);
1057 1057
 
1058
-		if ( !$template_field_structure ) {
1058
+		if ( ! $template_field_structure) {
1059 1059
 			$template_field_structure = false;
1060 1060
 			$template_fields = __('There was an error in assembling the fields for this display (you should see an error message)', 'event_espresso');
1061 1061
 		}
@@ -1065,51 +1065,51 @@  discard block
 block discarded – undo
1065 1065
 
1066 1066
 
1067 1067
 		//if we have the extra key.. then we need to remove the content index from the template_field_structure as it will get handled in the "extra" array.
1068
-		if ( is_array($template_field_structure[$context]) && isset( $template_field_structure[$context]['extra']) ) {
1069
-			foreach ( $template_field_structure[$context]['extra'] as $reference_field => $new_fields ) {
1070
-				unset( $template_field_structure[$context][$reference_field] );
1068
+		if (is_array($template_field_structure[$context]) && isset($template_field_structure[$context]['extra'])) {
1069
+			foreach ($template_field_structure[$context]['extra'] as $reference_field => $new_fields) {
1070
+				unset($template_field_structure[$context][$reference_field]);
1071 1071
 			}
1072 1072
 		}
1073 1073
 
1074 1074
 		//let's loop through the template_field_structure and actually assemble the input fields!
1075
-		if ( !empty($template_field_structure) ) {
1076
-			foreach ( $template_field_structure[$context] as $template_field => $field_setup_array ) {
1075
+		if ( ! empty($template_field_structure)) {
1076
+			foreach ($template_field_structure[$context] as $template_field => $field_setup_array) {
1077 1077
 				//if this is an 'extra' template field then we need to remove any existing fields that are keyed up in the extra array and reset them.
1078
-				if ( $template_field == 'extra' ) {
1078
+				if ($template_field == 'extra') {
1079 1079
 					$this->_template_args['is_extra_fields'] = true;
1080
-					foreach ( $field_setup_array as $reference_field => $new_fields_array ) {
1081
-						$message_template = $message_templates[ $context ][ $reference_field ];
1080
+					foreach ($field_setup_array as $reference_field => $new_fields_array) {
1081
+						$message_template = $message_templates[$context][$reference_field];
1082 1082
 						$content = $message_template instanceof EE_Message_Template
1083
-							? $message_template->get( 'MTP_content' )
1083
+							? $message_template->get('MTP_content')
1084 1084
 							: '';
1085
-						foreach ( $new_fields_array as $extra_field =>  $extra_array ) {
1085
+						foreach ($new_fields_array as $extra_field =>  $extra_array) {
1086 1086
 							//let's verify if we need this extra field via the shortcodes parameter.
1087 1087
 							$continue = false;
1088
-							if ( isset( $extra_array['shortcodes_required'] ) ) {
1089
-								foreach ( (array) $extra_array['shortcodes_required'] as $shortcode ) {
1090
-									if ( !array_key_exists( $shortcode, $this->_shortcodes ) )
1091
-										{$continue = true;}
1088
+							if (isset($extra_array['shortcodes_required'])) {
1089
+								foreach ((array) $extra_array['shortcodes_required'] as $shortcode) {
1090
+									if ( ! array_key_exists($shortcode, $this->_shortcodes))
1091
+										{$continue = true; }
1092 1092
 								}
1093
-								if ( $continue ) {continue;}
1093
+								if ($continue) {continue; }
1094 1094
 							}
1095 1095
 
1096
-							$field_id = $reference_field . '-' . $extra_field . '-content';
1096
+							$field_id = $reference_field.'-'.$extra_field.'-content';
1097 1097
 							$template_form_fields[$field_id] = $extra_array;
1098
-							$template_form_fields[$field_id]['name'] = 'MTP_template_fields[' . $reference_field . '][content][' . $extra_field . ']';
1099
-							$css_class = isset( $extra_array['css_class'] ) ? $extra_array['css_class'] : '';
1098
+							$template_form_fields[$field_id]['name'] = 'MTP_template_fields['.$reference_field.'][content]['.$extra_field.']';
1099
+							$css_class = isset($extra_array['css_class']) ? $extra_array['css_class'] : '';
1100 1100
 
1101
-							$template_form_fields[$field_id]['css_class'] = ! empty( $v_fields )
1101
+							$template_form_fields[$field_id]['css_class'] = ! empty($v_fields)
1102 1102
 																			&& in_array($extra_field, $v_fields)
1103 1103
 																			&&
1104 1104
 																			(
1105
-								                                                is_array($validators[$extra_field] )
1106
-																				&& isset( $validators[$extra_field]['msg'] )
1105
+								                                                is_array($validators[$extra_field])
1106
+																				&& isset($validators[$extra_field]['msg'])
1107 1107
 							                                                )
1108
-								? 'validate-error ' . $css_class
1108
+								? 'validate-error '.$css_class
1109 1109
 								: $css_class;
1110 1110
 
1111
-							$template_form_fields[$field_id]['value'] = !empty($message_templates) && isset($content[$extra_field])
1112
-								? stripslashes( html_entity_decode( $content[$extra_field], ENT_QUOTES, "UTF-8") )
1111
+							$template_form_fields[$field_id]['value'] = ! empty($message_templates) && isset($content[$extra_field])
1112
+								? stripslashes(html_entity_decode($content[$extra_field], ENT_QUOTES, "UTF-8"))
1113 1113
 								: '';
1114 1114
 
1115 1115
 							//do we have a validation error?  if we do then let's use that value instead
@@ -1125,32 +1125,32 @@  discard block
 block discarded – undo
1125 1125
 								$field_id
1126 1126
 							);
1127 1127
 
1128
-							if ( isset( $extra_array['input'] ) && $extra_array['input'] == 'wp_editor' ) {
1128
+							if (isset($extra_array['input']) && $extra_array['input'] == 'wp_editor') {
1129 1129
 								//we want to decode the entities
1130 1130
 								$template_form_fields[$field_id]['value'] = stripslashes(
1131
-									html_entity_decode( $template_form_fields[$field_id]['value'], ENT_QUOTES, "UTF-8")
1131
+									html_entity_decode($template_form_fields[$field_id]['value'], ENT_QUOTES, "UTF-8")
1132 1132
 								);
1133 1133
 
1134 1134
 							}/**/
1135 1135
 						}
1136
-						$templatefield_MTP_id = $reference_field . '-MTP_ID';
1137
-						$templatefield_templatename_id = $reference_field . '-name';
1136
+						$templatefield_MTP_id = $reference_field.'-MTP_ID';
1137
+						$templatefield_templatename_id = $reference_field.'-name';
1138 1138
 
1139 1139
 						$template_form_fields[$templatefield_MTP_id] = array(
1140
-							'name' => 'MTP_template_fields[' . $reference_field . '][MTP_ID]',
1140
+							'name' => 'MTP_template_fields['.$reference_field.'][MTP_ID]',
1141 1141
 							'label' => null,
1142 1142
 							'input' => 'hidden',
1143 1143
 							'type' => 'int',
1144 1144
 							'required' => false,
1145 1145
 							'validation' => false,
1146
-							'value' => !empty($message_templates) ? $message_template->ID() : '',
1146
+							'value' => ! empty($message_templates) ? $message_template->ID() : '',
1147 1147
 							'css_class' => '',
1148 1148
 							'format' => '%d',
1149 1149
 							'db-col' => 'MTP_ID'
1150 1150
 						);
1151 1151
 
1152 1152
 						$template_form_fields[$templatefield_templatename_id] = array(
1153
-							'name' => 'MTP_template_fields[' . $reference_field . '][name]',
1153
+							'name' => 'MTP_template_fields['.$reference_field.'][name]',
1154 1154
 							'label' => null,
1155 1155
 							'input' => 'hidden',
1156 1156
 							'type' => 'string',
@@ -1164,14 +1164,14 @@  discard block
 block discarded – undo
1164 1164
 					}
1165 1165
 					continue; //skip the next stuff, we got the necessary fields here for this dataset.
1166 1166
 				} else {
1167
-					$field_id = $template_field . '-content';
1167
+					$field_id = $template_field.'-content';
1168 1168
 					$template_form_fields[$field_id] = $field_setup_array;
1169
-					$template_form_fields[$field_id]['name'] = 'MTP_template_fields[' . $template_field . '][content]';
1170
-					$message_template = isset( $message_templates[ $context ][ $template_field ] )
1171
-						? $message_templates[ $context ][ $template_field ]
1169
+					$template_form_fields[$field_id]['name'] = 'MTP_template_fields['.$template_field.'][content]';
1170
+					$message_template = isset($message_templates[$context][$template_field])
1171
+						? $message_templates[$context][$template_field]
1172 1172
 						: null;
1173
-					$template_form_fields[$field_id]['value'] = ! empty( $message_templates )
1174
-																&& is_array( $message_templates[$context] )
1173
+					$template_form_fields[$field_id]['value'] = ! empty($message_templates)
1174
+																&& is_array($message_templates[$context])
1175 1175
 																&& $message_template instanceof EE_Message_Template
1176 1176
 						? $message_template->get('MTP_content')
1177 1177
 						: '';
@@ -1184,10 +1184,10 @@  discard block
 block discarded – undo
1184 1184
 
1185 1185
 					$template_form_fields[$field_id]['db-col'] = 'MTP_content';
1186 1186
 					$css_class = isset($field_setup_array['css_class']) ? $field_setup_array['css_class'] : '';
1187
-					$template_form_fields[$field_id]['css_class'] =  ! empty( $v_fields )
1188
-																	 && in_array( $template_field, $v_fields )
1189
-																	 && isset( $validators[$template_field]['msg'] )
1190
-						? 'validate-error ' . $css_class
1187
+					$template_form_fields[$field_id]['css_class'] = ! empty($v_fields)
1188
+																	 && in_array($template_field, $v_fields)
1189
+																	 && isset($validators[$template_field]['msg'])
1190
+						? 'validate-error '.$css_class
1191 1191
 						: $css_class;
1192 1192
 
1193 1193
 					//shortcode selector
@@ -1198,12 +1198,12 @@  discard block
 block discarded – undo
1198 1198
 
1199 1199
 				//k took care of content field(s) now let's take care of others.
1200 1200
 
1201
-				$templatefield_MTP_id = $template_field . '-MTP_ID';
1202
-				$templatefield_field_templatename_id = $template_field . '-name';
1201
+				$templatefield_MTP_id = $template_field.'-MTP_ID';
1202
+				$templatefield_field_templatename_id = $template_field.'-name';
1203 1203
 
1204 1204
 				//foreach template field there are actually two form fields created
1205 1205
 				$template_form_fields[$templatefield_MTP_id] = array(
1206
-					'name' => 'MTP_template_fields[' . $template_field . '][MTP_ID]',
1206
+					'name' => 'MTP_template_fields['.$template_field.'][MTP_ID]',
1207 1207
 					'label' => null,
1208 1208
 					'input' => 'hidden',
1209 1209
 					'type' => 'int',
@@ -1216,7 +1216,7 @@  discard block
 block discarded – undo
1216 1216
 				);
1217 1217
 
1218 1218
 				$template_form_fields[$templatefield_field_templatename_id] = array(
1219
-					'name' => 'MTP_template_fields[' . $template_field . '][name]',
1219
+					'name' => 'MTP_template_fields['.$template_field.'][name]',
1220 1220
 					'label' => null,
1221 1221
 					'input' => 'hidden',
1222 1222
 					'type' => 'string',
@@ -1360,13 +1360,13 @@  discard block
 block discarded – undo
1360 1360
 				'value' => $GRP_ID
1361 1361
 				);
1362 1362
 			$sidebar_form_fields['ee-msg-evt-nonce'] = array(
1363
-				'name' => $action . '_nonce',
1363
+				'name' => $action.'_nonce',
1364 1364
 				'input' => 'hidden',
1365 1365
 				'type' => 'string',
1366
-				'value' => wp_create_nonce( $action . '_nonce')
1366
+				'value' => wp_create_nonce($action.'_nonce')
1367 1367
 				);
1368 1368
 
1369
-			if ( isset($this->_req_data['template_switch']) && $this->_req_data['template_switch'] ) {
1369
+			if (isset($this->_req_data['template_switch']) && $this->_req_data['template_switch']) {
1370 1370
 				$sidebar_form_fields['ee-msg-template-switch'] = array(
1371 1371
 					'name' => 'template_switch',
1372 1372
 					'input' => 'hidden',
@@ -1376,8 +1376,8 @@  discard block
 block discarded – undo
1376 1376
 			}
1377 1377
 
1378 1378
 
1379
-			$template_fields = $this->_generate_admin_form_fields( $template_form_fields );
1380
-			$sidebar_fields = $this->_generate_admin_form_fields( $sidebar_form_fields );
1379
+			$template_fields = $this->_generate_admin_form_fields($template_form_fields);
1380
+			$sidebar_fields = $this->_generate_admin_form_fields($sidebar_form_fields);
1381 1381
 
1382 1382
 
1383 1383
 		} //end if ( !empty($template_field_structure) )
@@ -1389,7 +1389,7 @@  discard block
 block discarded – undo
1389 1389
 			 $GRP_ID,
1390 1390
 			 false,
1391 1391
 			 add_query_arg(
1392
-			    array( 'action' => 'global_mtps' ),
1392
+			    array('action' => 'global_mtps'),
1393 1393
 			    $this->_admin_base_url
1394 1394
 			 )
1395 1395
 		);
@@ -1405,7 +1405,7 @@  discard block
 block discarded – undo
1405 1405
 			),
1406 1406
 			$this->_admin_base_url
1407 1407
 		);
1408
-		$preview_button = '<a href="' . $preview_url . '" class="button-secondary messages-preview-button">' . __('Preview', 'event_espresso') . '</a>';
1408
+		$preview_button = '<a href="'.$preview_url.'" class="button-secondary messages-preview-button">'.__('Preview', 'event_espresso').'</a>';
1409 1409
 
1410 1410
 
1411 1411
 		//setup context switcher
@@ -1433,17 +1433,17 @@  discard block
 block discarded – undo
1433 1433
 		$this->_template_args['after_admin_page_content'] = $this->_add_form_element_after();
1434 1434
 
1435 1435
 		$this->_template_path = $this->_template_args['GRP_ID']
1436
-			? EE_MSG_TEMPLATE_PATH . 'ee_msg_details_main_edit_meta_box.template.php'
1437
-			: EE_MSG_TEMPLATE_PATH . 'ee_msg_details_main_add_meta_box.template.php';
1436
+			? EE_MSG_TEMPLATE_PATH.'ee_msg_details_main_edit_meta_box.template.php'
1437
+			: EE_MSG_TEMPLATE_PATH.'ee_msg_details_main_add_meta_box.template.php';
1438 1438
 
1439 1439
 		//send along EE_Message_Template_Group object for further template use.
1440 1440
 		$this->_template_args['MTP'] = $message_template_group;
1441 1441
 
1442
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( $this->_template_path, $this->_template_args, true );
1442
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template($this->_template_path, $this->_template_args, true);
1443 1443
 
1444 1444
 
1445 1445
 		//finally, let's set the admin_page title
1446
-		$this->_admin_page_title = sprintf( __('Editing %s', 'event_espresso'), $title );
1446
+		$this->_admin_page_title = sprintf(__('Editing %s', 'event_espresso'), $title);
1447 1447
 
1448 1448
 
1449 1449
 		//we need to take care of setting the shortcodes property for use elsewhere.
@@ -1456,7 +1456,7 @@  discard block
 block discarded – undo
1456 1456
 	}
1457 1457
 
1458 1458
 
1459
-	public function filter_tinymce_init( $mceInit, $editor_id ) {
1459
+	public function filter_tinymce_init($mceInit, $editor_id) {
1460 1460
 		return $mceInit;
1461 1461
 	}
1462 1462
 
@@ -1467,7 +1467,7 @@  discard block
 block discarded – undo
1467 1467
 	}
1468 1468
 
1469 1469
 	public function _add_form_element_before() {
1470
-		return '<form method="post" action="' . $this->_template_args["edit_message_template_form_url"] . '" id="ee-msg-edit-frm">';
1470
+		return '<form method="post" action="'.$this->_template_args["edit_message_template_form_url"].'" id="ee-msg-edit-frm">';
1471 1471
 	}
1472 1472
 
1473 1473
 	public function _add_form_element_after() {
@@ -1484,25 +1484,25 @@  discard block
 block discarded – undo
1484 1484
 	 *
1485 1485
 	 */
1486 1486
 	public function switch_template_pack() {
1487
-		$GRP_ID = ! empty( $this->_req_data['GRP_ID'] ) ? $this->_req_data['GRP_ID'] : 0;
1488
-		$template_pack = ! empty( $this->_req_data['template_pack'] ) ? $this->_req_data['template_pack'] : '';
1487
+		$GRP_ID = ! empty($this->_req_data['GRP_ID']) ? $this->_req_data['GRP_ID'] : 0;
1488
+		$template_pack = ! empty($this->_req_data['template_pack']) ? $this->_req_data['template_pack'] : '';
1489 1489
 
1490 1490
 		//verify we have needed values.
1491
-		if ( empty( $GRP_ID ) || empty( $template_pack ) ) {
1491
+		if (empty($GRP_ID) || empty($template_pack)) {
1492 1492
 			$this->_template_args['error'] = true;
1493
-			EE_Error::add_error( __('The required date for switching templates is not available.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__  );
1493
+			EE_Error::add_error(__('The required date for switching templates is not available.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1494 1494
 		} else {
1495 1495
 			//get template, set the new template_pack and then reset to default
1496 1496
 			/** @type EE_Message_Template_Group $message_template_group */
1497
-			$message_template_group = EEM_Message_Template_Group::instance()->get_one_by_ID( $GRP_ID );
1497
+			$message_template_group = EEM_Message_Template_Group::instance()->get_one_by_ID($GRP_ID);
1498 1498
 
1499
-			$message_template_group->set_template_pack_name( $template_pack );
1499
+			$message_template_group->set_template_pack_name($template_pack);
1500 1500
 			$this->_req_data['msgr'] = $message_template_group->messenger();
1501 1501
 			$this->_req_data['mt'] = $message_template_group->message_type();
1502 1502
 
1503 1503
 			$query_args = $this->_reset_to_default_template();
1504 1504
 
1505
-			if ( empty( $query_args['id'] ) ) {
1505
+			if (empty($query_args['id'])) {
1506 1506
 				EE_Error::add_error(
1507 1507
 					__(
1508 1508
 						'Something went wrong with switching the template pack. Please try again or contact EE support',
@@ -1512,7 +1512,7 @@  discard block
 block discarded – undo
1512 1512
 				);
1513 1513
 				$this->_template_args['error'] = true;
1514 1514
 			} else {
1515
-				$template_label =$message_template_group->get_template_pack()->label;
1515
+				$template_label = $message_template_group->get_template_pack()->label;
1516 1516
 				$template_pack_labels = $message_template_group->messenger_obj()->get_supports_labels();
1517 1517
 				EE_Error::add_success(
1518 1518
 					sprintf(
@@ -1525,7 +1525,7 @@  discard block
 block discarded – undo
1525 1525
 					)
1526 1526
 				);
1527 1527
 				//generate the redirect url for js.
1528
-				$url = self::add_query_args_and_nonce( $query_args, $this->_admin_base_url );
1528
+				$url = self::add_query_args_and_nonce($query_args, $this->_admin_base_url);
1529 1529
 				$this->_template_args['data']['redirect_url'] = $url;
1530 1530
 				$this->_template_args['success'] = true;
1531 1531
 			}
@@ -1547,9 +1547,9 @@  discard block
 block discarded – undo
1547 1547
 	protected function _reset_to_default_template() {
1548 1548
 
1549 1549
 		$templates = array();
1550
-		$GRP_ID = !empty( $this->_req_data['GRP_ID'] ) ? $this->_req_data['GRP_ID'] : 0;
1550
+		$GRP_ID = ! empty($this->_req_data['GRP_ID']) ? $this->_req_data['GRP_ID'] : 0;
1551 1551
 		//we need to make sure we've got the info we need.
1552
-		if ( ! isset( $this->_req_data['msgr'], $this->_req_data['mt'], $this->_req_data['GRP_ID'] ) ) {
1552
+		if ( ! isset($this->_req_data['msgr'], $this->_req_data['mt'], $this->_req_data['GRP_ID'])) {
1553 1553
 			EE_Error::add_error(
1554 1554
 				__(
1555 1555
 					'In order to reset the template to its default we require the messenger, message type, and message template GRP_ID to know what is being reset.  At least one of these is missing.',
@@ -1561,9 +1561,9 @@  discard block
 block discarded – undo
1561 1561
 
1562 1562
 		// all templates will be reset to whatever the defaults are
1563 1563
 		// for the global template matching the messenger and message type.
1564
-		$success = !empty( $GRP_ID ) ? true : false;
1564
+		$success = ! empty($GRP_ID) ? true : false;
1565 1565
 
1566
-		if ( $success ) {
1566
+		if ($success) {
1567 1567
 
1568 1568
 			//let's first determine if the incoming template is a global template,
1569 1569
 			// if it isn't then we need to get the global template matching messenger and message type.
@@ -1571,9 +1571,9 @@  discard block
 block discarded – undo
1571 1571
 
1572 1572
 
1573 1573
 			//note this is ONLY deleting the template fields (Message Template rows) NOT the message template group.
1574
-			$success = $this->_delete_mtp_permanently( $GRP_ID, false );
1574
+			$success = $this->_delete_mtp_permanently($GRP_ID, false);
1575 1575
 
1576
-			if ( $success ) {
1576
+			if ($success) {
1577 1577
 				// if successfully deleted, lets generate the new ones.
1578 1578
 				// Note. We set GLOBAL to true, because resets on ANY template
1579 1579
 				// will use the related global template defaults for regeneration.
@@ -1591,32 +1591,32 @@  discard block
 block discarded – undo
1591 1591
 		}
1592 1592
 
1593 1593
 		//any error messages?
1594
-		if ( !$success ) {
1594
+		if ( ! $success) {
1595 1595
 			EE_Error::add_error(
1596
-				__( 'Something went wrong with deleting existing templates. Unable to reset to default', 'event_espresso' ),
1596
+				__('Something went wrong with deleting existing templates. Unable to reset to default', 'event_espresso'),
1597 1597
 				__FILE__, __FUNCTION__, __LINE__
1598 1598
 			);
1599 1599
 		}
1600 1600
 
1601 1601
 		//all good, let's add a success message!
1602
-		if ( $success && ! empty( $templates ) ) {
1602
+		if ($success && ! empty($templates)) {
1603 1603
 			$templates = $templates[0]; //the info for the template we generated is the first element in the returned array.
1604 1604
 			EE_Error::overwrite_success();
1605
-			EE_Error::add_success( __('Templates have been reset to defaults.', 'event_espresso') );
1605
+			EE_Error::add_success(__('Templates have been reset to defaults.', 'event_espresso'));
1606 1606
 		}
1607 1607
 
1608 1608
 
1609 1609
 		$query_args = array(
1610
-			'id' => isset( $templates['GRP_ID'] ) ? $templates['GRP_ID'] : null,
1611
-			'context' => isset( $templates['MTP_context'] ) ? $templates['MTP_context'] : null,
1612
-			'action' => isset( $templates['GRP_ID'] ) ? 'edit_message_template' : 'global_mtps'
1610
+			'id' => isset($templates['GRP_ID']) ? $templates['GRP_ID'] : null,
1611
+			'context' => isset($templates['MTP_context']) ? $templates['MTP_context'] : null,
1612
+			'action' => isset($templates['GRP_ID']) ? 'edit_message_template' : 'global_mtps'
1613 1613
 			);
1614 1614
 
1615 1615
 		//if called via ajax then we return query args otherwise redirect
1616
-		if ( defined('DOING_AJAX') && DOING_AJAX ) {
1616
+		if (defined('DOING_AJAX') && DOING_AJAX) {
1617 1617
 			return $query_args;
1618 1618
 		} else {
1619
-			$this->_redirect_after_action( false, '', '', $query_args, true );
1619
+			$this->_redirect_after_action(false, '', '', $query_args, true);
1620 1620
 			return null;
1621 1621
 		}
1622 1622
 	}
@@ -1629,7 +1629,7 @@  discard block
 block discarded – undo
1629 1629
 	 * @param bool $send if TRUE then we are doing an actual TEST send with the results of the preview.
1630 1630
 	 * @return string
1631 1631
 	 */
1632
-	public function _preview_message( $send = false ) {
1632
+	public function _preview_message($send = false) {
1633 1633
 		//first make sure we've got the necessary parameters
1634 1634
 		if (
1635 1635
 			! isset(
@@ -1645,13 +1645,13 @@  discard block
 block discarded – undo
1645 1645
 			);
1646 1646
 		}
1647 1647
 
1648
-		EE_Registry::instance()->REQ->set( 'GRP_ID', $this->_req_data['GRP_ID'] );
1648
+		EE_Registry::instance()->REQ->set('GRP_ID', $this->_req_data['GRP_ID']);
1649 1649
 
1650 1650
 
1651 1651
 		//get the preview!
1652
-		$preview = EED_Messages::preview_message( $this->_req_data['message_type'], $this->_req_data['context'], $this->_req_data['messenger'], $send );
1652
+		$preview = EED_Messages::preview_message($this->_req_data['message_type'], $this->_req_data['context'], $this->_req_data['messenger'], $send);
1653 1653
 
1654
-		if ( $send ) {
1654
+		if ($send) {
1655 1655
 			return $preview;
1656 1656
 		}
1657 1657
 
@@ -1661,22 +1661,22 @@  discard block
 block discarded – undo
1661 1661
 			'context' => $this->_req_data['context'],
1662 1662
 			'action' => 'edit_message_template'
1663 1663
 			);
1664
-		$go_back_url = parent::add_query_args_and_nonce( $query_args, $this->_admin_base_url );
1665
-		$preview_button = '<a href="' . $go_back_url . '" class="button-secondary messages-preview-go-back-button">' . __('Go Back to Edit', 'event_espresso') . '</a>';
1664
+		$go_back_url = parent::add_query_args_and_nonce($query_args, $this->_admin_base_url);
1665
+		$preview_button = '<a href="'.$go_back_url.'" class="button-secondary messages-preview-go-back-button">'.__('Go Back to Edit', 'event_espresso').'</a>';
1666 1666
 		$message_types = $this->get_installed_message_types();
1667
-		$active_messenger = $this->_message_resource_manager->get_active_messenger( $this->_req_data['messenger'] );
1667
+		$active_messenger = $this->_message_resource_manager->get_active_messenger($this->_req_data['messenger']);
1668 1668
 		$active_messenger_label = $active_messenger instanceof EE_messenger
1669
-			? ucwords( $active_messenger->label['singular'] )
1670
-			: esc_html__( 'Unknown Messenger', 'event_espresso' );
1669
+			? ucwords($active_messenger->label['singular'])
1670
+			: esc_html__('Unknown Messenger', 'event_espresso');
1671 1671
 		//let's provide a helpful title for context
1672 1672
 		$preview_title = sprintf(
1673
-			__( 'Viewing Preview for %s %s Message Template', 'event_espresso' ),
1673
+			__('Viewing Preview for %s %s Message Template', 'event_espresso'),
1674 1674
 			$active_messenger_label,
1675
-			ucwords( $message_types[ $this->_req_data[ 'message_type' ] ]->label[ 'singular' ] )
1675
+			ucwords($message_types[$this->_req_data['message_type']]->label['singular'])
1676 1676
 		);
1677 1677
 		//setup display of preview.
1678 1678
 		$this->_admin_page_title = $preview_title;
1679
-		$this->_template_args['admin_page_content'] = $preview_button . '<br />' .stripslashes($preview);
1679
+		$this->_template_args['admin_page_content'] = $preview_button.'<br />'.stripslashes($preview);
1680 1680
 		$this->_template_args['data']['force_json'] = true;
1681 1681
 		return '';
1682 1682
 	}
@@ -1706,9 +1706,9 @@  discard block
 block discarded – undo
1706 1706
 	 * @return void
1707 1707
 	 */
1708 1708
 	protected function _register_edit_meta_boxes() {
1709
-		add_meta_box( 'mtp_valid_shortcodes', __('Valid Shortcodes', 'event_espresso'), array( $this, 'shortcode_meta_box' ), $this->_current_screen->id, 'side', 'default' );
1710
-		add_meta_box( 'mtp_extra_actions', __('Extra Actions', 'event_espresso'), array( $this, 'extra_actions_meta_box' ), $this->_current_screen->id, 'side', 'high' );
1711
-		add_meta_box( 'mtp_templates', __('Template Styles', 'event_espresso'), array( $this, 'template_pack_meta_box' ), $this->_current_screen->id, 'side', 'high' );
1709
+		add_meta_box('mtp_valid_shortcodes', __('Valid Shortcodes', 'event_espresso'), array($this, 'shortcode_meta_box'), $this->_current_screen->id, 'side', 'default');
1710
+		add_meta_box('mtp_extra_actions', __('Extra Actions', 'event_espresso'), array($this, 'extra_actions_meta_box'), $this->_current_screen->id, 'side', 'high');
1711
+		add_meta_box('mtp_templates', __('Template Styles', 'event_espresso'), array($this, 'template_pack_meta_box'), $this->_current_screen->id, 'side', 'high');
1712 1712
 	}
1713 1713
 
1714 1714
 
@@ -1727,14 +1727,14 @@  discard block
 block discarded – undo
1727 1727
 
1728 1728
 		$tp_select_values = array();
1729 1729
 
1730
-		foreach ( $tp_collection as $tp ) {
1730
+		foreach ($tp_collection as $tp) {
1731 1731
 			//only include template packs that support this messenger and message type!
1732 1732
 			$supports = $tp->get_supports();
1733 1733
 			if (
1734
-				! isset( $supports[ $this->_message_template_group->messenger() ] )
1734
+				! isset($supports[$this->_message_template_group->messenger()])
1735 1735
 				|| ! in_array(
1736 1736
 					$this->_message_template_group->message_type(),
1737
-					$supports[ $this->_message_template_group->messenger() ]
1737
+					$supports[$this->_message_template_group->messenger()]
1738 1738
 				)
1739 1739
 			) {
1740 1740
 				//not supported
@@ -1748,7 +1748,7 @@  discard block
 block discarded – undo
1748 1748
 		}
1749 1749
 
1750 1750
 		//if empty $tp_select_values then we make sure default is set because EVERY message type should be supported by the default template pack.  This still allows for the odd template pack to override.
1751
-		if ( empty( $tp_select_values ) ) {
1751
+		if (empty($tp_select_values)) {
1752 1752
 			$tp_select_values[] = array(
1753 1753
 				'text' => __('Default', 'event_espresso'),
1754 1754
 				'id' => 'default'
@@ -1761,14 +1761,14 @@  discard block
 block discarded – undo
1761 1761
 			$this->_message_template_group->message_type()
1762 1762
 		);
1763 1763
 		$variations_select_values = array();
1764
-		foreach ( $variations as $variation => $label ) {
1764
+		foreach ($variations as $variation => $label) {
1765 1765
 			$variations_select_values[] = array(
1766 1766
 				'text' => $label,
1767 1767
 				'id' => $variation
1768 1768
 			);
1769 1769
 		}
1770 1770
 
1771
-		$template_pack_labels= $this->_message_template_group->messenger_obj()->get_supports_labels();
1771
+		$template_pack_labels = $this->_message_template_group->messenger_obj()->get_supports_labels();
1772 1772
 
1773 1773
 		$template_args['template_packs_selector'] = EEH_Form_Fields::select_input(
1774 1774
 			'MTP_template_pack',
@@ -1785,9 +1785,9 @@  discard block
 block discarded – undo
1785 1785
 		$template_args['template_pack_description'] = $template_pack_labels->template_pack_description;
1786 1786
 		$template_args['template_variation_description'] = $template_pack_labels->template_variation_description;
1787 1787
 
1788
-		$template = EE_MSG_TEMPLATE_PATH . 'template_pack_and_variations_metabox.template.php';
1788
+		$template = EE_MSG_TEMPLATE_PATH.'template_pack_and_variations_metabox.template.php';
1789 1789
 
1790
-		EEH_Template::display_template( $template, $template_args );
1790
+		EEH_Template::display_template($template, $template_args);
1791 1791
 	}
1792 1792
 
1793 1793
 
@@ -1818,47 +1818,47 @@  discard block
 block discarded – undo
1818 1818
 		//first we need to see if there are any fields
1819 1819
 		$fields = $this->_message_template_group->messenger_obj()->get_test_settings_fields();
1820 1820
 
1821
-		if ( !empty( $fields ) ) {
1821
+		if ( ! empty($fields)) {
1822 1822
 			//yup there be fields
1823
-			foreach ( $fields as $field => $config ) {
1824
-				$field_id = $this->_message_template_group->messenger() . '_' . $field;
1823
+			foreach ($fields as $field => $config) {
1824
+				$field_id = $this->_message_template_group->messenger().'_'.$field;
1825 1825
 				$existing = $this->_message_template_group->messenger_obj()->get_existing_test_settings();
1826
-				$default = isset( $config['default'] ) ? $config['default'] : '';
1827
-				$default = isset( $config['value'] ) ? $config['value'] : $default;
1826
+				$default = isset($config['default']) ? $config['default'] : '';
1827
+				$default = isset($config['value']) ? $config['value'] : $default;
1828 1828
 
1829 1829
 				//if type is hidden and the value is empty something may have gone wrong so let's correct with the defaults
1830 1830
 				$fix = $config['input'] == 'hidden' && isset($existing[$field]) && empty($existing[$field]) ? $default : '';
1831
-				$existing[$field] = isset( $existing[$field] ) && empty( $fix ) ? $existing[$field] : $fix;
1831
+				$existing[$field] = isset($existing[$field]) && empty($fix) ? $existing[$field] : $fix;
1832 1832
 
1833 1833
 				$template_form_fields[$field_id] = array(
1834
-					'name' => 'test_settings_fld[' . $field . ']',
1834
+					'name' => 'test_settings_fld['.$field.']',
1835 1835
 					'label' => $config['label'],
1836 1836
 					'input' => $config['input'],
1837 1837
 					'type' => $config['type'],
1838 1838
 					'required' => $config['required'],
1839 1839
 					'validation' => $config['validation'],
1840
-					'value' => isset( $existing[$field] ) ? $existing[$field] : $default,
1840
+					'value' => isset($existing[$field]) ? $existing[$field] : $default,
1841 1841
 					'css_class' => $config['css_class'],
1842
-					'options' => isset( $config['options'] ) ? $config['options'] : array(),
1842
+					'options' => isset($config['options']) ? $config['options'] : array(),
1843 1843
 					'default' => $default,
1844 1844
 					'format' => $config['format']
1845 1845
 					);
1846 1846
 			}
1847 1847
 		}
1848 1848
 
1849
-		$test_settings_fields = !empty( $template_form_fields)
1850
-			? $this->_generate_admin_form_fields( $template_form_fields, 'string', 'ee_tst_settings_flds' )
1849
+		$test_settings_fields = ! empty($template_form_fields)
1850
+			? $this->_generate_admin_form_fields($template_form_fields, 'string', 'ee_tst_settings_flds')
1851 1851
 			: '';
1852 1852
 
1853 1853
 		$test_settings_html = '';
1854 1854
 		//print out $test_settings_fields
1855
-		if ( !empty( $test_settings_fields ) ) {
1855
+		if ( ! empty($test_settings_fields)) {
1856 1856
 			echo $test_settings_fields;
1857
-			$test_settings_html = '<input type="submit" class="button-primary mtp-test-button alignright" name="test_button" value="' . __('Test Send', 'event_espresso') . '" /><div style="clear:both"></div>';
1857
+			$test_settings_html = '<input type="submit" class="button-primary mtp-test-button alignright" name="test_button" value="'.__('Test Send', 'event_espresso').'" /><div style="clear:both"></div>';
1858 1858
 		}
1859 1859
 
1860 1860
 		//and button
1861
-		echo $test_settings_html . '<p>' . __('Need to reset this message type and start over?', 'event_espresso') . '</p>' . '<div class="publishing-action alignright resetbutton">' . $button . '</div><div style="clear:both"></div>';
1861
+		echo $test_settings_html.'<p>'.__('Need to reset this message type and start over?', 'event_espresso').'</p>'.'<div class="publishing-action alignright resetbutton">'.$button.'</div><div style="clear:both"></div>';
1862 1862
 	}
1863 1863
 
1864 1864
 
@@ -1873,13 +1873,13 @@  discard block
 block discarded – undo
1873 1873
      * @param string $linked_input_id The css id of the input that the shortcodes get added to.
1874 1874
      * @return string
1875 1875
     */
1876
-	protected function _get_shortcode_selector( $field, $linked_input_id ) {
1876
+	protected function _get_shortcode_selector($field, $linked_input_id) {
1877 1877
 		$template_args = array(
1878
-			'shortcodes' => $this->_get_shortcodes( array( $field ), true ),
1878
+			'shortcodes' => $this->_get_shortcodes(array($field), true),
1879 1879
 			'fieldname' => $field,
1880 1880
 			'linked_input_id' => $linked_input_id
1881 1881
 		);
1882
-		return EEH_Template::display_template( EE_MSG_TEMPLATE_PATH . 'shortcode_selector_skeleton.template.php', $template_args, true );
1882
+		return EEH_Template::display_template(EE_MSG_TEMPLATE_PATH.'shortcode_selector_skeleton.template.php', $template_args, true);
1883 1883
 	}
1884 1884
 
1885 1885
 
@@ -1894,13 +1894,13 @@  discard block
 block discarded – undo
1894 1894
 		$shortcodes = $this->_get_shortcodes(array(), false); //just make sure shortcodes property is set
1895 1895
 		//$messenger = $this->_message_template_group->messenger_obj();
1896 1896
 		//now let's set the content depending on the status of the shortcodes array
1897
-		if ( empty( $shortcodes ) ) {
1898
-			$content = '<p>' . __('There are no valid shortcodes available', 'event_espresso') . '</p>';
1897
+		if (empty($shortcodes)) {
1898
+			$content = '<p>'.__('There are no valid shortcodes available', 'event_espresso').'</p>';
1899 1899
 			echo $content;
1900 1900
 		} else {
1901 1901
 			//$alt = 0;
1902 1902
 			?>
1903
-			<div style="float:right; margin-top:10px"><?php echo $this->_get_help_tab_link('message_template_shortcodes'); ?></div><p class="small-text"><?php printf( __('You can view the shortcodes usable in your template by clicking the %s icon next to each field.', 'event_espresso' ), '<span class="dashicons dashicons-menu"></span>' ); ?></p>
1903
+			<div style="float:right; margin-top:10px"><?php echo $this->_get_help_tab_link('message_template_shortcodes'); ?></div><p class="small-text"><?php printf(__('You can view the shortcodes usable in your template by clicking the %s icon next to each field.', 'event_espresso'), '<span class="dashicons dashicons-menu"></span>'); ?></p>
1904 1904
 			<?php
1905 1905
 		}
1906 1906
 
@@ -1917,7 +1917,7 @@  discard block
 block discarded – undo
1917 1917
 	protected function _set_shortcodes() {
1918 1918
 
1919 1919
 		//no need to run this if the property is already set
1920
-		if ( !empty($this->_shortcodes ) ) {return;}
1920
+		if ( ! empty($this->_shortcodes)) {return; }
1921 1921
 
1922 1922
 		$this->_shortcodes = $this->_get_shortcodes();
1923 1923
 	}
@@ -1939,14 +1939,14 @@  discard block
 block discarded – undo
1939 1939
 	 * @return array          Shortcodes indexed by fieldname and the an array of shortcode/label pairs OR if merged is true
1940 1940
 	 *                       just an array of shortcode/label pairs.
1941 1941
 	 */
1942
-	protected function _get_shortcodes( $fields = array(), $merged = true ) {
1942
+	protected function _get_shortcodes($fields = array(), $merged = true) {
1943 1943
 		$this->_set_message_template_group();
1944 1944
 
1945 1945
 		//we need the messenger and message template to retrieve the valid shortcodes array.
1946
-		$GRP_ID = isset( $this->_req_data['id'] ) && !empty( $this->_req_data['id'] ) ? absint( $this->_req_data['id'] ) : false;
1947
-		$context = isset( $this->_req_data['context'] ) ? $this->_req_data['context'] : key( $this->_message_template_group->contexts_config() );
1946
+		$GRP_ID = isset($this->_req_data['id']) && ! empty($this->_req_data['id']) ? absint($this->_req_data['id']) : false;
1947
+		$context = isset($this->_req_data['context']) ? $this->_req_data['context'] : key($this->_message_template_group->contexts_config());
1948 1948
 
1949
-		return !empty($GRP_ID) ? $this->_message_template_group->get_shortcodes( $context, $fields, $merged ) : array();
1949
+		return ! empty($GRP_ID) ? $this->_message_template_group->get_shortcodes($context, $fields, $merged) : array();
1950 1950
 	}
1951 1951
 
1952 1952
 
@@ -1959,19 +1959,19 @@  discard block
 block discarded – undo
1959 1959
 	 */
1960 1960
 	protected function _set_message_template_group() {
1961 1961
 
1962
-		if ( !empty( $this->_message_template_group ) )
1963
-			{return;} //get out if this is already set.
1962
+		if ( ! empty($this->_message_template_group))
1963
+			{return; } //get out if this is already set.
1964 1964
 
1965
-		$GRP_ID =  ! empty( $this->_req_data['GRP_ID'] ) ? absint( $this->_req_data['GRP_ID'] ) : false;
1966
-		$GRP_ID = empty( $GRP_ID ) && ! empty( $this->_req_data['id'] ) ? $this->_req_data['id'] : $GRP_ID;
1965
+		$GRP_ID = ! empty($this->_req_data['GRP_ID']) ? absint($this->_req_data['GRP_ID']) : false;
1966
+		$GRP_ID = empty($GRP_ID) && ! empty($this->_req_data['id']) ? $this->_req_data['id'] : $GRP_ID;
1967 1967
 
1968 1968
 		//let's get the message templates
1969 1969
 		$MTP = EEM_Message_Template_Group::instance();
1970 1970
 
1971
-		if ( empty($GRP_ID) )
1972
-			{$this->_message_template_group = $MTP->create_default_object();}
1971
+		if (empty($GRP_ID))
1972
+			{$this->_message_template_group = $MTP->create_default_object(); }
1973 1973
 		else
1974
-			{$this->_message_template_group = $MTP->get_one_by_ID( $GRP_ID );}
1974
+			{$this->_message_template_group = $MTP->get_one_by_ID($GRP_ID); }
1975 1975
 
1976 1976
 		$this->_template_pack = $this->_message_template_group->get_template_pack();
1977 1977
 		$this->_variation = $this->_message_template_group->get_template_pack_variation();
@@ -1990,7 +1990,7 @@  discard block
 block discarded – undo
1990 1990
 	 * @param array $args various things the context switcher needs.
1991 1991
 	 *
1992 1992
 	 */
1993
-	protected function _set_context_switcher( EE_Message_Template_Group $template_group_object, $args) {
1993
+	protected function _set_context_switcher(EE_Message_Template_Group $template_group_object, $args) {
1994 1994
 		$context_details = $template_group_object->contexts_config();
1995 1995
 		$context_label = $template_group_object->context_label();
1996 1996
 		ob_start();
@@ -1998,20 +1998,20 @@  discard block
 block discarded – undo
1998 1998
 		<div class="ee-msg-switcher-container">
1999 1999
 			<form method="get" action="<?php echo EE_MSG_ADMIN_URL; ?>" id="ee-msg-context-switcher-frm">
2000 2000
 				<?php
2001
-					foreach ( $args as $name => $value ) {
2002
-						if ( $name == 'context' || empty($value) || $name == 'extra' ) {continue;}
2001
+					foreach ($args as $name => $value) {
2002
+						if ($name == 'context' || empty($value) || $name == 'extra') {continue; }
2003 2003
 						?>
2004 2004
 						<input type="hidden" name="<?php echo $name; ?>" value = "<?php echo $value; ?>" />
2005 2005
 						<?php
2006 2006
 					}
2007 2007
 					//setup nonce_url
2008
-					wp_nonce_field($args['action'] . '_nonce', $args['action'] . '_nonce', false);
2008
+					wp_nonce_field($args['action'].'_nonce', $args['action'].'_nonce', false);
2009 2009
 				?>
2010 2010
 				<select name="context">
2011 2011
 					<?php
2012 2012
 					$context_templates = $template_group_object->context_templates();
2013
-					if ( is_array($context_templates) ) :
2014
-							foreach ( $context_templates as $context => $template_fields ) :
2013
+					if (is_array($context_templates)) :
2014
+							foreach ($context_templates as $context => $template_fields) :
2015 2015
 								$checked = ($context == $args['context']) ? 'selected="selected"' : '';
2016 2016
 					?>
2017 2017
 					<option value="<?php echo $context; ?>" <?php echo $checked; ?>>
@@ -2019,7 +2019,7 @@  discard block
 block discarded – undo
2019 2019
 					</option>
2020 2020
 					<?php endforeach; endif; ?>
2021 2021
 				</select>
2022
-				<?php $button_text = sprintf( __('Switch %s', 'event_espresso'), ucwords($context_label['label']) ); ?>
2022
+				<?php $button_text = sprintf(__('Switch %s', 'event_espresso'), ucwords($context_label['label'])); ?>
2023 2023
 				<input id="submit-msg-context-switcher-sbmt" class="button-secondary" type="submit" value="<?php echo $button_text; ?>">
2024 2024
 			</form>
2025 2025
 			<?php echo $args['extra']; ?>
@@ -2046,8 +2046,8 @@  discard block
 block discarded – undo
2046 2046
 	 * @return array
2047 2047
 	 */
2048 2048
 	protected function _set_message_template_column_values($index) {
2049
-		if ( is_array($this->_req_data['MTP_template_fields'][$index]['content'] ) ) {
2050
-			foreach ( $this->_req_data['MTP_template_fields'][$index]['content'] as $field => $value ) {
2049
+		if (is_array($this->_req_data['MTP_template_fields'][$index]['content'])) {
2050
+			foreach ($this->_req_data['MTP_template_fields'][$index]['content'] as $field => $value) {
2051 2051
 				$this->_req_data['MTP_template_fields'][$index]['content'][$field] = $value;
2052 2052
 			}
2053 2053
 		} /*else {
@@ -2056,22 +2056,22 @@  discard block
 block discarded – undo
2056 2056
 
2057 2057
 
2058 2058
 		$set_column_values = array(
2059
-			'MTP_ID'             => absint( $this->_req_data[ 'MTP_template_fields' ][ $index ][ 'MTP_ID' ] ),
2060
-			'GRP_ID'             => absint( $this->_req_data[ 'GRP_ID' ] ),
2061
-			'MTP_user_id'        => absint( $this->_req_data[ 'MTP_user_id' ] ),
2062
-			'MTP_messenger'      => strtolower( $this->_req_data[ 'MTP_messenger' ] ),
2063
-			'MTP_message_type'   => strtolower( $this->_req_data[ 'MTP_message_type' ] ),
2064
-			'MTP_template_field' => strtolower( $this->_req_data[ 'MTP_template_fields' ][ $index ][ 'name' ] ),
2065
-			'MTP_context'        => strtolower( $this->_req_data[ 'MTP_context' ] ),
2066
-			'MTP_content'        => $this->_req_data[ 'MTP_template_fields' ][ $index ][ 'content' ],
2067
-			'MTP_is_global'      => isset( $this->_req_data[ 'MTP_is_global' ] )
2068
-				? absint( $this->_req_data[ 'MTP_is_global' ] )
2059
+			'MTP_ID'             => absint($this->_req_data['MTP_template_fields'][$index]['MTP_ID']),
2060
+			'GRP_ID'             => absint($this->_req_data['GRP_ID']),
2061
+			'MTP_user_id'        => absint($this->_req_data['MTP_user_id']),
2062
+			'MTP_messenger'      => strtolower($this->_req_data['MTP_messenger']),
2063
+			'MTP_message_type'   => strtolower($this->_req_data['MTP_message_type']),
2064
+			'MTP_template_field' => strtolower($this->_req_data['MTP_template_fields'][$index]['name']),
2065
+			'MTP_context'        => strtolower($this->_req_data['MTP_context']),
2066
+			'MTP_content'        => $this->_req_data['MTP_template_fields'][$index]['content'],
2067
+			'MTP_is_global'      => isset($this->_req_data['MTP_is_global'])
2068
+				? absint($this->_req_data['MTP_is_global'])
2069 2069
 				: 0,
2070
-			'MTP_is_override'    => isset( $this->_req_data[ 'MTP_is_override' ] )
2071
-				? absint( $this->_req_data[ 'MTP_is_override' ] )
2070
+			'MTP_is_override'    => isset($this->_req_data['MTP_is_override'])
2071
+				? absint($this->_req_data['MTP_is_override'])
2072 2072
 				: 0,
2073
-			'MTP_deleted'        => absint( $this->_req_data[ 'MTP_deleted' ] ),
2074
-			'MTP_is_active'      => absint( $this->_req_data[ 'MTP_is_active' ] )
2073
+			'MTP_deleted'        => absint($this->_req_data['MTP_deleted']),
2074
+			'MTP_is_active'      => absint($this->_req_data['MTP_is_active'])
2075 2075
 		);
2076 2076
 
2077 2077
 
@@ -2083,36 +2083,36 @@  discard block
 block discarded – undo
2083 2083
 
2084 2084
 
2085 2085
 
2086
-	protected function _insert_or_update_message_template($new = false ) {
2086
+	protected function _insert_or_update_message_template($new = false) {
2087 2087
 
2088
-		do_action ( 'AHEE_log', __FILE__, __FUNCTION__, '');
2088
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2089 2089
 		$success = 0;
2090 2090
 		$override = false;
2091 2091
 
2092 2092
 		//setup notices description
2093
-		$messenger = ! empty( $this->_req_data['MTP_messenger'] )
2094
-			? ucwords( str_replace( '_', ' ', $this->_req_data['MTP_messenger'] ) )
2093
+		$messenger = ! empty($this->_req_data['MTP_messenger'])
2094
+			? ucwords(str_replace('_', ' ', $this->_req_data['MTP_messenger']))
2095 2095
 			: false;
2096 2096
 
2097
-		$message_type = ! empty( $this->_req_data['MTP_message_type'] )
2098
-			? ucwords( str_replace( '_', ' ', $this->_req_data['MTP_message_type'] ) )
2097
+		$message_type = ! empty($this->_req_data['MTP_message_type'])
2098
+			? ucwords(str_replace('_', ' ', $this->_req_data['MTP_message_type']))
2099 2099
 			: false;
2100 2100
 
2101
-		$context = ! empty( $this->_req_data['MTP_context'] )
2102
-			? ucwords( str_replace( '_', ' ', $this->_req_data['MTP_context'] ) )
2101
+		$context = ! empty($this->_req_data['MTP_context'])
2102
+			? ucwords(str_replace('_', ' ', $this->_req_data['MTP_context']))
2103 2103
 			: false;
2104 2104
 
2105
-		$item_desc = $messenger ? $messenger . ' ' . $message_type . ' ' . $context . ' ' : '';
2105
+		$item_desc = $messenger ? $messenger.' '.$message_type.' '.$context.' ' : '';
2106 2106
 		$item_desc .= 'Message Template';
2107 2107
 		$query_args = array();
2108 2108
 		$edit_array = array();
2109 2109
 		$action_desc = '';
2110 2110
 
2111 2111
 		//if this is "new" then we need to generate the default contexts for the selected messenger/message_type for user to edit.
2112
-		if ( $new ) {
2113
-			$GRP_ID = !empty( $this->_req_data['GRP_ID'] ) ? $this->_req_data['GRP_ID'] : 0;
2114
-			if ( $edit_array = $this->_generate_new_templates($messenger, $message_type, $GRP_ID ) ) {
2115
-				if ( empty($edit_array) ) {
2112
+		if ($new) {
2113
+			$GRP_ID = ! empty($this->_req_data['GRP_ID']) ? $this->_req_data['GRP_ID'] : 0;
2114
+			if ($edit_array = $this->_generate_new_templates($messenger, $message_type, $GRP_ID)) {
2115
+				if (empty($edit_array)) {
2116 2116
 					$success = 0;
2117 2117
 				} else {
2118 2118
 					$success = 1;
@@ -2131,7 +2131,7 @@  discard block
 block discarded – undo
2131 2131
 
2132 2132
 
2133 2133
 			//run update for each template field in displayed context
2134
-			if ( !isset($this->_req_data['MTP_template_fields']) && empty($this->_req_data['MTP_template_fields'] ) ) {
2134
+			if ( ! isset($this->_req_data['MTP_template_fields']) && empty($this->_req_data['MTP_template_fields'])) {
2135 2135
 				EE_Error::add_error(
2136 2136
 					__('There was a problem saving the template fields from the form because I didn\'t receive any actual template field data.', 'event_espresso'),
2137 2137
 					__FILE__, __FUNCTION__, __LINE__
@@ -2140,25 +2140,25 @@  discard block
 block discarded – undo
2140 2140
 
2141 2141
 			} else {
2142 2142
 				//first validate all fields!
2143
-				$validates = $MTPG->validate($this->_req_data['MTP_template_fields'], $this->_req_data['MTP_context'],  $this->_req_data['MTP_messenger'], $this->_req_data['MTP_message_type']);
2143
+				$validates = $MTPG->validate($this->_req_data['MTP_template_fields'], $this->_req_data['MTP_context'], $this->_req_data['MTP_messenger'], $this->_req_data['MTP_message_type']);
2144 2144
 
2145 2145
 				//if $validate returned error messages (i.e. is_array()) then we need to process them and setup an appropriate response. HMM, dang this isn't correct, $validates will ALWAYS be an array.  WE need to make sure there is no actual error messages in validates.
2146
-				if ( is_array($validates) && !empty($validates) ) {
2146
+				if (is_array($validates) && ! empty($validates)) {
2147 2147
 					//add the transient so when the form loads we know which fields to highlight
2148
-					$this->_add_transient( 'edit_message_template', $validates );
2148
+					$this->_add_transient('edit_message_template', $validates);
2149 2149
 
2150 2150
 					$success = 0;
2151 2151
 
2152 2152
 					//setup notices
2153
-					foreach ( $validates as $field => $error ) {
2154
-						if ( isset($error['msg'] ) ) {
2155
-							EE_Error::add_error( $error['msg'], __FILE__, __FUNCTION__, __LINE__ );
2153
+					foreach ($validates as $field => $error) {
2154
+						if (isset($error['msg'])) {
2155
+							EE_Error::add_error($error['msg'], __FILE__, __FUNCTION__, __LINE__);
2156 2156
 						}
2157 2157
 					}
2158 2158
 
2159 2159
 				} else {
2160 2160
 					$set_column_values = array();
2161
-					foreach ( $this->_req_data['MTP_template_fields'] as $template_field => $content ) {
2161
+					foreach ($this->_req_data['MTP_template_fields'] as $template_field => $content) {
2162 2162
 						$set_column_values = $this->_set_message_template_column_values($template_field);
2163 2163
 
2164 2164
 						$where_cols_n_values = array(
@@ -2171,11 +2171,11 @@  discard block
 block discarded – undo
2171 2171
 							'MTP_context' => $set_column_values['MTP_context'],
2172 2172
 							'MTP_content' => $set_column_values['MTP_content']
2173 2173
 						);
2174
-						if ( $updated = $MTP->update( $message_template_fields, array( $where_cols_n_values ) ) ) {
2175
-							if ( $updated === false ) {
2174
+						if ($updated = $MTP->update($message_template_fields, array($where_cols_n_values))) {
2175
+							if ($updated === false) {
2176 2176
 								EE_Error::add_error(
2177 2177
 									sprintf(
2178
-										__( '%s field was NOT updated for some reason', 'event_espresso' ),
2178
+										__('%s field was NOT updated for some reason', 'event_espresso'),
2179 2179
 										$template_field
2180 2180
 									),
2181 2181
 									__FILE__, __FUNCTION__, __LINE__
@@ -2189,46 +2189,46 @@  discard block
 block discarded – undo
2189 2189
 
2190 2190
 					//we can use the last set_column_values for the MTPG update (because its the same for all of these specific MTPs)
2191 2191
 					$mtpg_fields = array(
2192
-						'MTP_user_id'      => $set_column_values[ 'MTP_user_id' ],
2193
-						'MTP_messenger'    => $set_column_values[ 'MTP_messenger' ],
2194
-						'MTP_message_type' => $set_column_values[ 'MTP_message_type' ],
2195
-						'MTP_is_global'    => $set_column_values[ 'MTP_is_global' ],
2196
-						'MTP_is_override'  => $set_column_values[ 'MTP_is_override' ],
2197
-						'MTP_deleted'      => $set_column_values[ 'MTP_deleted' ],
2198
-						'MTP_is_active'    => $set_column_values[ 'MTP_is_active' ],
2199
-						'MTP_name'         => ! empty( $this->_req_data[ 'ee_msg_non_global_fields' ][ 'MTP_name' ] )
2200
-							? $this->_req_data[ 'ee_msg_non_global_fields' ][ 'MTP_name' ]
2192
+						'MTP_user_id'      => $set_column_values['MTP_user_id'],
2193
+						'MTP_messenger'    => $set_column_values['MTP_messenger'],
2194
+						'MTP_message_type' => $set_column_values['MTP_message_type'],
2195
+						'MTP_is_global'    => $set_column_values['MTP_is_global'],
2196
+						'MTP_is_override'  => $set_column_values['MTP_is_override'],
2197
+						'MTP_deleted'      => $set_column_values['MTP_deleted'],
2198
+						'MTP_is_active'    => $set_column_values['MTP_is_active'],
2199
+						'MTP_name'         => ! empty($this->_req_data['ee_msg_non_global_fields']['MTP_name'])
2200
+							? $this->_req_data['ee_msg_non_global_fields']['MTP_name']
2201 2201
 							: '',
2202
-						'MTP_description'  => ! empty( $this->_req_data[ 'ee_msg_non_global_fields' ][ 'MTP_description' ] )
2203
-							? $this->_req_data[ 'ee_msg_non_global_fields' ][ 'MTP_description' ]
2202
+						'MTP_description'  => ! empty($this->_req_data['ee_msg_non_global_fields']['MTP_description'])
2203
+							? $this->_req_data['ee_msg_non_global_fields']['MTP_description']
2204 2204
 							: ''
2205 2205
 					);
2206 2206
 
2207
-					$mtpg_where = array('GRP_ID' => $set_column_values['GRP_ID'] );
2208
-					$updated = $MTPG->update( $mtpg_fields, array($mtpg_where) );
2207
+					$mtpg_where = array('GRP_ID' => $set_column_values['GRP_ID']);
2208
+					$updated = $MTPG->update($mtpg_fields, array($mtpg_where));
2209 2209
 
2210
-					if ( $updated === false ) {
2210
+					if ($updated === false) {
2211 2211
 						EE_Error::add_error(
2212 2212
 							sprintf(
2213
-								__( 'The Message Template Group (%d) was NOT updated for some reason', 'event_espresso' ),
2214
-								$set_column_values[ 'GRP_ID' ]
2213
+								__('The Message Template Group (%d) was NOT updated for some reason', 'event_espresso'),
2214
+								$set_column_values['GRP_ID']
2215 2215
 							),
2216 2216
 							__FILE__, __FUNCTION__, __LINE__
2217 2217
 						);
2218 2218
 					} else {
2219 2219
 						//k now we need to ensure the template_pack and template_variation fields are set.
2220
-						$template_pack = ! empty( $this->_req_data['MTP_template_pack' ] )
2220
+						$template_pack = ! empty($this->_req_data['MTP_template_pack'])
2221 2221
 							? $this->_req_data['MTP_template_pack']
2222 2222
 							: 'default';
2223 2223
 
2224
-						$template_variation = ! empty( $this->_req_data['MTP_template_variation'] )
2224
+						$template_variation = ! empty($this->_req_data['MTP_template_variation'])
2225 2225
 							? $this->_req_data['MTP_template_variation']
2226 2226
 							: 'default';
2227 2227
 
2228
-						$mtpg_obj = $MTPG->get_one_by_ID( $set_column_values['GRP_ID'] );
2229
-						if ( $mtpg_obj instanceof EE_Message_Template_Group ) {
2230
-							$mtpg_obj->set_template_pack_name( $template_pack );
2231
-							$mtpg_obj->set_template_pack_variation( $template_variation );
2228
+						$mtpg_obj = $MTPG->get_one_by_ID($set_column_values['GRP_ID']);
2229
+						if ($mtpg_obj instanceof EE_Message_Template_Group) {
2230
+							$mtpg_obj->set_template_pack_name($template_pack);
2231
+							$mtpg_obj->set_template_pack_variation($template_variation);
2232 2232
 						}
2233 2233
 						$success = 1;
2234 2234
 					}
@@ -2238,7 +2238,7 @@  discard block
 block discarded – undo
2238 2238
 		}
2239 2239
 
2240 2240
 		//we return things differently if doing ajax
2241
-		if ( defined('DOING_AJAX') && DOING_AJAX ) {
2241
+		if (defined('DOING_AJAX') && DOING_AJAX) {
2242 2242
 			$this->_template_args['success'] = $success;
2243 2243
 			$this->_template_args['error'] = ! $success ? true : false;
2244 2244
 			$this->_template_args['content'] = '';
@@ -2246,9 +2246,9 @@  discard block
 block discarded – undo
2246 2246
 				'grpID' => $edit_array['GRP_ID'],
2247 2247
 				'templateName' => $edit_array['template_name']
2248 2248
 				);
2249
-			if ( $success ) {
2249
+			if ($success) {
2250 2250
 				EE_Error::overwrite_success();
2251
-				EE_Error::add_success( __('The new template has been created and automatically selected for this event.  You can edit the new template by clicking the edit button.  Note before this template is assigned to this event, the event must be saved.', 'event_espresso') );
2251
+				EE_Error::add_success(__('The new template has been created and automatically selected for this event.  You can edit the new template by clicking the edit button.  Note before this template is assigned to this event, the event must be saved.', 'event_espresso'));
2252 2252
 			}
2253 2253
 
2254 2254
 			$this->_return_json();
@@ -2256,13 +2256,13 @@  discard block
 block discarded – undo
2256 2256
 
2257 2257
 
2258 2258
 		//was a test send triggered?
2259
-		if ( isset( $this->_req_data['test_button'] ) ) {
2259
+		if (isset($this->_req_data['test_button'])) {
2260 2260
 			EE_Error::overwrite_success();
2261
-			$this->_do_test_send( $this->_req_data['MTP_context'],  $this->_req_data['MTP_messenger'], $this->_req_data['MTP_message_type'] );
2261
+			$this->_do_test_send($this->_req_data['MTP_context'], $this->_req_data['MTP_messenger'], $this->_req_data['MTP_message_type']);
2262 2262
 			$override = true;
2263 2263
 		}
2264 2264
 
2265
-		if ( empty( $query_args ) ) {
2265
+		if (empty($query_args)) {
2266 2266
 			$query_args = array(
2267 2267
 				'id' => $this->_req_data['GRP_ID'],
2268 2268
 				'context' => $this->_req_data['MTP_context'],
@@ -2270,7 +2270,7 @@  discard block
 block discarded – undo
2270 2270
 				);
2271 2271
 		}
2272 2272
 
2273
-		$this->_redirect_after_action( $success, $item_desc, $action_desc, $query_args, $override );
2273
+		$this->_redirect_after_action($success, $item_desc, $action_desc, $query_args, $override);
2274 2274
 	}
2275 2275
 
2276 2276
 
@@ -2284,28 +2284,28 @@  discard block
 block discarded – undo
2284 2284
 	 * @param  string $message_type message type being tested
2285 2285
 	 *
2286 2286
 	 */
2287
-	protected function _do_test_send( $context, $messenger, $message_type ) {
2287
+	protected function _do_test_send($context, $messenger, $message_type) {
2288 2288
 		//set things up for preview
2289 2289
 		$this->_req_data['messenger'] = $messenger;
2290 2290
 		$this->_req_data['message_type'] = $message_type;
2291 2291
 		$this->_req_data['context'] = $context;
2292
-		$this->_req_data['GRP_ID'] = isset($this->_req_data['GRP_ID'] ) ? $this->_req_data['GRP_ID'] : '';
2293
-		$active_messenger = $this->_message_resource_manager->get_active_messenger( $messenger );
2292
+		$this->_req_data['GRP_ID'] = isset($this->_req_data['GRP_ID']) ? $this->_req_data['GRP_ID'] : '';
2293
+		$active_messenger = $this->_message_resource_manager->get_active_messenger($messenger);
2294 2294
 
2295 2295
 		//let's save any existing fields that might be required by the messenger
2296 2296
 		if (
2297
-			isset( $this->_req_data['test_settings_fld'] )
2297
+			isset($this->_req_data['test_settings_fld'])
2298 2298
 			&& $active_messenger instanceof EE_messenger
2299 2299
 		) {
2300
-			$active_messenger->set_existing_test_settings( $this->_req_data['test_settings_fld'] );
2300
+			$active_messenger->set_existing_test_settings($this->_req_data['test_settings_fld']);
2301 2301
 		}
2302 2302
 
2303 2303
 		$success = $this->_preview_message(true);
2304 2304
 
2305
-		if ( $success ) {
2306
-			EE_Error::add_success( __('Test message sent', 'event_espresso') );
2305
+		if ($success) {
2306
+			EE_Error::add_success(__('Test message sent', 'event_espresso'));
2307 2307
 		} else {
2308
-			EE_Error::add_error( __('The test message was not sent', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
2308
+			EE_Error::add_error(__('The test message was not sent', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
2309 2309
 		}
2310 2310
 	}
2311 2311
 
@@ -2331,11 +2331,11 @@  discard block
 block discarded – undo
2331 2331
 	protected function _generate_new_templates($messenger, $message_types, $GRP_ID = 0, $global = false) {
2332 2332
 
2333 2333
 		//if no $message_types are given then that's okay... this may be a messenger that just adds shortcodes, so we just don't generate any templates.
2334
-		if ( empty( $message_types ) ) {
2334
+		if (empty($message_types)) {
2335 2335
 			return true;
2336 2336
 		}
2337 2337
 
2338
-		return EEH_MSG_Template::generate_new_templates( $messenger, $message_types, $GRP_ID, $global );
2338
+		return EEH_MSG_Template::generate_new_templates($messenger, $message_types, $GRP_ID, $global);
2339 2339
 	}
2340 2340
 
2341 2341
 
@@ -2351,33 +2351,33 @@  discard block
 block discarded – undo
2351 2351
 	 *
2352 2352
 	 * @return void
2353 2353
 	 */
2354
-	protected function _trash_or_restore_message_template($trash = true, $all = false ) {
2355
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
2354
+	protected function _trash_or_restore_message_template($trash = true, $all = false) {
2355
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2356 2356
 		$MTP = EEM_Message_Template_Group::instance();
2357 2357
 
2358 2358
 		$success = 1;
2359 2359
 
2360 2360
 		//incoming GRP_IDs
2361
-		if ( $all ) {
2361
+		if ($all) {
2362 2362
 			//Checkboxes
2363
-			if ( !empty( $this->_req_data['checkbox'] ) && is_array($this->_req_data['checkbox'] ) ) {
2363
+			if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
2364 2364
 				//if array has more than one element then success message should be plural.
2365 2365
 				//todo: what about nonce?
2366
-				$success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1;
2366
+				$success = count($this->_req_data['checkbox']) > 1 ? 2 : 1;
2367 2367
 
2368 2368
 				//cycle through checkboxes
2369
-				while ( list( $GRP_ID, $value ) = each ($this->_req_data['checkbox']) ) {
2370
-					$trashed_or_restored = $trash ? $MTP->delete_by_ID( $GRP_ID ) : $MTP->restore_by_ID( $GRP_ID );
2371
-					if ( ! $trashed_or_restored ) {
2369
+				while (list($GRP_ID, $value) = each($this->_req_data['checkbox'])) {
2370
+					$trashed_or_restored = $trash ? $MTP->delete_by_ID($GRP_ID) : $MTP->restore_by_ID($GRP_ID);
2371
+					if ( ! $trashed_or_restored) {
2372 2372
 						$success = 0;
2373 2373
 					}
2374 2374
 				}
2375 2375
 			} else {
2376 2376
 				//grab single GRP_ID and handle
2377
-				$GRP_ID = isset( $this->_req_data['id'] ) ? absint($this->_req_data['id']) : 0;
2378
-				if ( ! empty( $GRP_ID ) ) {
2379
-					$trashed_or_restored = $trash ? $MTP->delete_by_ID( $GRP_ID ) : $MTP->restore_by_ID( $GRP_ID );
2380
-					if ( ! $trashed_or_restored ) {
2377
+				$GRP_ID = isset($this->_req_data['id']) ? absint($this->_req_data['id']) : 0;
2378
+				if ( ! empty($GRP_ID)) {
2379
+					$trashed_or_restored = $trash ? $MTP->delete_by_ID($GRP_ID) : $MTP->restore_by_ID($GRP_ID);
2380
+					if ( ! $trashed_or_restored) {
2381 2381
 						$success = 0;
2382 2382
 					}
2383 2383
 				} else {
@@ -2389,13 +2389,13 @@  discard block
 block discarded – undo
2389 2389
 
2390 2390
 		$action_desc = $trash ? __('moved to the trash', 'event_espresso') : __('restored', 'event_espresso');
2391 2391
 
2392
-		$action_desc = !empty( $this->_req_data['template_switch'] ) ? __('switched') : $action_desc;
2392
+		$action_desc = ! empty($this->_req_data['template_switch']) ? __('switched') : $action_desc;
2393 2393
 
2394 2394
 		$item_desc = $all ? _n('Message Template Group', 'Message Template Groups', $success, 'event_espresso') : _n('Message Template Context', 'Message Template Contexts', $success, 'event_espresso');
2395 2395
 
2396
-		$item_desc = !empty( $this->_req_data['template_switch'] ) ? _n('template', 'templates', $success, 'event_espresso') : $item_desc;
2396
+		$item_desc = ! empty($this->_req_data['template_switch']) ? _n('template', 'templates', $success, 'event_espresso') : $item_desc;
2397 2397
 
2398
-		$this->_redirect_after_action( $success, $item_desc, $action_desc, array() );
2398
+		$this->_redirect_after_action($success, $item_desc, $action_desc, array());
2399 2399
 
2400 2400
 	}
2401 2401
 
@@ -2411,24 +2411,24 @@  discard block
 block discarded – undo
2411 2411
 	 * @return void
2412 2412
 	 */
2413 2413
 	protected function _delete_message_template() {
2414
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
2414
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2415 2415
 
2416 2416
 		//checkboxes
2417
-		if ( !empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'] ) ) {
2417
+		if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
2418 2418
 			//if array has more than one element then success message should be plural
2419
-			$success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1;
2419
+			$success = count($this->_req_data['checkbox']) > 1 ? 2 : 1;
2420 2420
 
2421 2421
 			//cycle through bulk action checkboxes
2422
-			while ( list( $GRP_ID, $value ) = each($this->_req_data['checkbox'] ) ) {
2423
-				$success = $this->_delete_mtp_permanently( $GRP_ID );
2422
+			while (list($GRP_ID, $value) = each($this->_req_data['checkbox'])) {
2423
+				$success = $this->_delete_mtp_permanently($GRP_ID);
2424 2424
 			}
2425 2425
 		} else {
2426 2426
 			//grab single grp_id and delete
2427
-			$GRP_ID = absint($this->_req_data['id'] );
2428
-			$success = $this->_delete_mtp_permanently( $GRP_ID );
2427
+			$GRP_ID = absint($this->_req_data['id']);
2428
+			$success = $this->_delete_mtp_permanently($GRP_ID);
2429 2429
 		}
2430 2430
 
2431
-		$this->_redirect_after_action( $success, 'Message Templates', 'deleted', array() );
2431
+		$this->_redirect_after_action($success, 'Message Templates', 'deleted', array());
2432 2432
 
2433 2433
 	}
2434 2434
 
@@ -2443,20 +2443,20 @@  discard block
 block discarded – undo
2443 2443
 	 *
2444 2444
 	 * @return bool        boolean to indicate the success of the deletes or not.
2445 2445
 	 */
2446
-	private function _delete_mtp_permanently( $GRP_ID, $include_group = true ) {
2446
+	private function _delete_mtp_permanently($GRP_ID, $include_group = true) {
2447 2447
 		$success = 1;
2448 2448
 		$MTPG = EEM_Message_Template_Group::instance();
2449 2449
 		//first let's GET this group
2450
-		$MTG = $MTPG->get_one_by_ID( $GRP_ID );
2450
+		$MTG = $MTPG->get_one_by_ID($GRP_ID);
2451 2451
 		//then delete permanently all the related Message Templates
2452
-		$deleted = $MTG->delete_related_permanently( 'Message_Template' );
2452
+		$deleted = $MTG->delete_related_permanently('Message_Template');
2453 2453
 
2454
-		if ( $deleted === 0 )
2455
-			{$success = 0;}
2454
+		if ($deleted === 0)
2455
+			{$success = 0; }
2456 2456
 
2457 2457
 		//now delete permanently this particular group
2458 2458
 
2459
-		if ( $include_group && ! $MTG->delete_permanently() ) {
2459
+		if ($include_group && ! $MTG->delete_permanently()) {
2460 2460
 			$success = 0;
2461 2461
 		}
2462 2462
 		return $success;
@@ -2474,7 +2474,7 @@  discard block
 block discarded – undo
2474 2474
 	*	@return string
2475 2475
 	*/
2476 2476
 	protected function _learn_more_about_message_templates_link() {
2477
-		return '<a class="hidden" style="margin:0 20px; cursor:pointer; font-size:12px;" >' . __('learn more about how message templates works', 'event_espresso') . '</a>';
2477
+		return '<a class="hidden" style="margin:0 20px; cursor:pointer; font-size:12px;" >'.__('learn more about how message templates works', 'event_espresso').'</a>';
2478 2478
 	}
2479 2479
 
2480 2480
 
@@ -2492,10 +2492,10 @@  discard block
 block discarded – undo
2492 2492
 
2493 2493
 		$this->_set_m_mt_settings();
2494 2494
 
2495
-		$selected_messenger = isset( $this->_req_data['selected_messenger'] ) ? $this->_req_data['selected_messenger'] : 'email';
2495
+		$selected_messenger = isset($this->_req_data['selected_messenger']) ? $this->_req_data['selected_messenger'] : 'email';
2496 2496
 
2497 2497
 		//let's setup the messenger tabs
2498
-		$this->_template_args['admin_page_header'] = EEH_Tabbed_Content::tab_text_links( $this->_m_mt_settings['messenger_tabs'], 'messenger_links', '|', $selected_messenger );
2498
+		$this->_template_args['admin_page_header'] = EEH_Tabbed_Content::tab_text_links($this->_m_mt_settings['messenger_tabs'], 'messenger_links', '|', $selected_messenger);
2499 2499
 		$this->_template_args['before_admin_page_content'] = '<div class="ui-widget ui-helper-clearfix">';
2500 2500
 		$this->_template_args['after_admin_page_content'] = '</div><!-- end .ui-widget -->';
2501 2501
 
@@ -2514,7 +2514,7 @@  discard block
 block discarded – undo
2514 2514
 	 */
2515 2515
 	protected function _set_m_mt_settings() {
2516 2516
 		//first if this is already set then lets get out no need to regenerate data.
2517
-		if ( !empty($this->_m_mt_settings) ) {
2517
+		if ( ! empty($this->_m_mt_settings)) {
2518 2518
 			return;
2519 2519
 		}
2520 2520
 
@@ -2529,10 +2529,10 @@  discard block
 block discarded – undo
2529 2529
 
2530 2530
 		//assemble the array for the _tab_text_links helper
2531 2531
 
2532
-		foreach ( $messengers as $messenger ) {
2532
+		foreach ($messengers as $messenger) {
2533 2533
 			$this->_m_mt_settings['messenger_tabs'][$messenger->name] = array(
2534 2534
 				'label' => ucwords($messenger->label['singular']),
2535
-				'class' => $this->_message_resource_manager->is_messenger_active( $messenger->name ) ? 'messenger-active' : '',
2535
+				'class' => $this->_message_resource_manager->is_messenger_active($messenger->name) ? 'messenger-active' : '',
2536 2536
 				'href' => $messenger->name,
2537 2537
 				'title' => __('Modify this Messenger', 'event_espresso'),
2538 2538
 				'slug' => $messenger->name,
@@ -2542,26 +2542,26 @@  discard block
 block discarded – undo
2542 2542
 
2543 2543
 			$message_types_for_messenger = $messenger->get_valid_message_types();
2544 2544
 
2545
-			foreach ( $message_types as $message_type ) {
2545
+			foreach ($message_types as $message_type) {
2546 2546
 				//first we need to verify that this message type is valid with this messenger. Cause if it isn't then it shouldn't show in either the inactive OR active metabox.
2547
-				if ( ! in_array( $message_type->name, $message_types_for_messenger ) ) {
2547
+				if ( ! in_array($message_type->name, $message_types_for_messenger)) {
2548 2548
 					continue;
2549 2549
 				}
2550 2550
 
2551
-				$a_or_i = $this->_message_resource_manager->is_message_type_active_for_messenger( $messenger->name, $message_type->name ) ? 'active' : 'inactive';
2551
+				$a_or_i = $this->_message_resource_manager->is_message_type_active_for_messenger($messenger->name, $message_type->name) ? 'active' : 'inactive';
2552 2552
 
2553 2553
 				$this->_m_mt_settings['message_type_tabs'][$messenger->name][$a_or_i][$message_type->name] = array(
2554
-					'label'    => ucwords( $message_type->label[ 'singular' ] ),
2555
-					'class'    => 'message-type-' . $a_or_i,
2556
-					'slug_id'  => $message_type->name . '-messagetype-' . $messenger->name,
2557
-					'mt_nonce' => wp_create_nonce( $message_type->name . '_nonce' ),
2558
-					'href'     => 'espresso_' . $message_type->name . '_message_type_settings',
2554
+					'label'    => ucwords($message_type->label['singular']),
2555
+					'class'    => 'message-type-'.$a_or_i,
2556
+					'slug_id'  => $message_type->name.'-messagetype-'.$messenger->name,
2557
+					'mt_nonce' => wp_create_nonce($message_type->name.'_nonce'),
2558
+					'href'     => 'espresso_'.$message_type->name.'_message_type_settings',
2559 2559
 					'title'    => $a_or_i == 'active'
2560
-						? __( 'Drag this message type to the Inactive window to deactivate', 'event_espresso' )
2561
-						: __( 'Drag this message type to the messenger to activate', 'event_espresso' ),
2560
+						? __('Drag this message type to the Inactive window to deactivate', 'event_espresso')
2561
+						: __('Drag this message type to the messenger to activate', 'event_espresso'),
2562 2562
 					'content'  => $a_or_i == 'active'
2563
-						? $this->_message_type_settings_content( $message_type, $messenger, true )
2564
-						: $this->_message_type_settings_content( $message_type, $messenger ),
2563
+						? $this->_message_type_settings_content($message_type, $messenger, true)
2564
+						: $this->_message_type_settings_content($message_type, $messenger),
2565 2565
 					'slug'     => $message_type->name,
2566 2566
 					'active'   => $a_or_i == 'active' ? true : false,
2567 2567
 					'obj'      => $message_type
@@ -2580,34 +2580,34 @@  discard block
 block discarded – undo
2580 2580
 	 *
2581 2581
 	 * @return string                html output for the content
2582 2582
 	 */
2583
-	protected function _message_type_settings_content( $message_type, $messenger, $active = false ) {
2583
+	protected function _message_type_settings_content($message_type, $messenger, $active = false) {
2584 2584
 		//get message type fields
2585 2585
 		$fields = $message_type->get_admin_settings_fields();
2586
-		$settings_template_args['template_form_fields']= '';
2586
+		$settings_template_args['template_form_fields'] = '';
2587 2587
 
2588
-		if ( !empty( $fields ) && $active ) {
2588
+		if ( ! empty($fields) && $active) {
2589 2589
 
2590
-			$existing_settings = $message_type->get_existing_admin_settings( $messenger->name );
2590
+			$existing_settings = $message_type->get_existing_admin_settings($messenger->name);
2591 2591
 
2592
-			foreach( $fields as $fldname => $fldprops ) {
2593
-				$field_id = $messenger->name . '-' . $message_type->name . '-' . $fldname;
2592
+			foreach ($fields as $fldname => $fldprops) {
2593
+				$field_id = $messenger->name.'-'.$message_type->name.'-'.$fldname;
2594 2594
 				$template_form_field[$field_id] = array(
2595
-					'name' => 'message_type_settings[' . $fldname . ']',
2595
+					'name' => 'message_type_settings['.$fldname.']',
2596 2596
 					'label' => $fldprops['label'],
2597 2597
 					'input' => $fldprops['field_type'],
2598 2598
 					'type' => $fldprops['value_type'],
2599 2599
 					'required' => $fldprops['required'],
2600 2600
 					'validation' => $fldprops['validation'],
2601
-					'value' => isset( $existing_settings[$fldname]) ? $existing_settings[$fldname] : $fldprops['default'],
2602
-					'options' => isset( $fldprops['options'] ) ? $fldprops['options'] : array(),
2603
-					'default' => isset( $existing_settings[$fldname] ) ? $existing_settings[$fldname] : $fldprops['default'],
2601
+					'value' => isset($existing_settings[$fldname]) ? $existing_settings[$fldname] : $fldprops['default'],
2602
+					'options' => isset($fldprops['options']) ? $fldprops['options'] : array(),
2603
+					'default' => isset($existing_settings[$fldname]) ? $existing_settings[$fldname] : $fldprops['default'],
2604 2604
 					'css_class' => 'no-drag',
2605 2605
 					'format' => $fldprops['format']
2606 2606
 				);
2607 2607
 			}
2608 2608
 
2609 2609
 
2610
-			$settings_template_args['template_form_fields'] = !empty($template_form_field) ? $this->_generate_admin_form_fields( $template_form_field, 'string', 'ee_mt_activate_form' ) : '';
2610
+			$settings_template_args['template_form_fields'] = ! empty($template_form_field) ? $this->_generate_admin_form_fields($template_form_field, 'string', 'ee_mt_activate_form') : '';
2611 2611
 		}
2612 2612
 
2613 2613
 		$settings_template_args['description'] = $message_type->description;
@@ -2627,13 +2627,13 @@  discard block
 block discarded – undo
2627 2627
 					)
2628 2628
 				);
2629 2629
 
2630
-		$settings_template_args['hidden_fields'] = $this->_generate_admin_form_fields( $settings_template_args['hidden_fields'], 'array' );
2631
-		$settings_template_args['show_form'] = empty( $settings_template_args['template_form_fields'] ) ? ' hidden' : '';
2630
+		$settings_template_args['hidden_fields'] = $this->_generate_admin_form_fields($settings_template_args['hidden_fields'], 'array');
2631
+		$settings_template_args['show_form'] = empty($settings_template_args['template_form_fields']) ? ' hidden' : '';
2632 2632
 
2633 2633
 
2634 2634
 
2635
-		$template = EE_MSG_TEMPLATE_PATH . 'ee_msg_mt_settings_content.template.php';
2636
-		$content = EEH_Template::display_template( $template, $settings_template_args, true );
2635
+		$template = EE_MSG_TEMPLATE_PATH.'ee_msg_mt_settings_content.template.php';
2636
+		$content = EEH_Template::display_template($template, $settings_template_args, true);
2637 2637
 		return $content;
2638 2638
 	}
2639 2639
 
@@ -2650,27 +2650,27 @@  discard block
 block discarded – undo
2650 2650
 		$m_boxes = $mt_boxes = array();
2651 2651
 		$m_template_args = $mt_template_args = array();
2652 2652
 
2653
-		$selected_messenger = isset( $this->_req_data['selected_messenger'] ) ? $this->_req_data['selected_messenger'] : 'email';
2653
+		$selected_messenger = isset($this->_req_data['selected_messenger']) ? $this->_req_data['selected_messenger'] : 'email';
2654 2654
 
2655
-		if ( isset( $this->_m_mt_settings[ 'messenger_tabs' ] ) ) {
2656
-			foreach ( $this->_m_mt_settings[ 'messenger_tabs' ] as $messenger => $tab_array ) {
2657
-				$hide_on_message = $this->_message_resource_manager->is_messenger_active( $messenger ) ? '' : 'hidden';
2658
-				$hide_off_message = $this->_message_resource_manager->is_messenger_active( $messenger ) ? 'hidden' : '';
2655
+		if (isset($this->_m_mt_settings['messenger_tabs'])) {
2656
+			foreach ($this->_m_mt_settings['messenger_tabs'] as $messenger => $tab_array) {
2657
+				$hide_on_message = $this->_message_resource_manager->is_messenger_active($messenger) ? '' : 'hidden';
2658
+				$hide_off_message = $this->_message_resource_manager->is_messenger_active($messenger) ? 'hidden' : '';
2659 2659
 				//messenger meta boxes
2660 2660
 				$active = $selected_messenger == $messenger ? true : false;
2661
-				$active_mt_tabs = isset( $this->_m_mt_settings[ 'message_type_tabs' ][ $messenger ][ 'active' ] )
2662
-				? $this->_m_mt_settings[ 'message_type_tabs' ][ $messenger ][ 'active' ]
2661
+				$active_mt_tabs = isset($this->_m_mt_settings['message_type_tabs'][$messenger]['active'])
2662
+				? $this->_m_mt_settings['message_type_tabs'][$messenger]['active']
2663 2663
 				: '';
2664
-				$m_boxes[ $messenger . '_a_box' ] = sprintf(
2665
-				__( '%s Settings', 'event_espresso' ),
2666
-				$tab_array[ 'label' ]
2664
+				$m_boxes[$messenger.'_a_box'] = sprintf(
2665
+				__('%s Settings', 'event_espresso'),
2666
+				$tab_array['label']
2667 2667
 				);
2668
-				$m_template_args[ $messenger . '_a_box' ] = array(
2669
-				'active_message_types'   => ! empty( $active_mt_tabs ) ? $this->_get_mt_tabs( $active_mt_tabs ) : '',
2670
-				'inactive_message_types' => isset( $this->_m_mt_settings[ 'message_type_tabs' ][ $messenger ][ 'inactive' ] )
2671
-				? $this->_get_mt_tabs( $this->_m_mt_settings[ 'message_type_tabs' ][ $messenger ][ 'inactive' ] )
2668
+				$m_template_args[$messenger.'_a_box'] = array(
2669
+				'active_message_types'   => ! empty($active_mt_tabs) ? $this->_get_mt_tabs($active_mt_tabs) : '',
2670
+				'inactive_message_types' => isset($this->_m_mt_settings['message_type_tabs'][$messenger]['inactive'])
2671
+				? $this->_get_mt_tabs($this->_m_mt_settings['message_type_tabs'][$messenger]['inactive'])
2672 2672
 				: '',
2673
-				'content'                => $this->_get_messenger_box_content( $tab_array[ 'obj' ] ),
2673
+				'content'                => $this->_get_messenger_box_content($tab_array['obj']),
2674 2674
 				'hidden'                 => $active ? '' : ' hidden',
2675 2675
 				'hide_on_message'        => $hide_on_message,
2676 2676
 				'messenger'              => $messenger,
@@ -2679,11 +2679,11 @@  discard block
 block discarded – undo
2679 2679
 				// message type meta boxes
2680 2680
 				// (which is really just the inactive container for each messenger
2681 2681
 				// showing inactive message types for that messenger)
2682
-				$mt_boxes[ $messenger . '_i_box' ] = __( 'Inactive Message Types', 'event_espresso' );
2683
-				$mt_template_args[ $messenger . '_i_box' ] = array(
2684
-				'active_message_types'   => ! empty( $active_mt_tabs ) ? $this->_get_mt_tabs( $active_mt_tabs ) : '',
2685
-				'inactive_message_types' => isset( $this->_m_mt_settings[ 'message_type_tabs' ][ $messenger ][ 'inactive' ] )
2686
-				? $this->_get_mt_tabs( $this->_m_mt_settings[ 'message_type_tabs' ][ $messenger ][ 'inactive' ] )
2682
+				$mt_boxes[$messenger.'_i_box'] = __('Inactive Message Types', 'event_espresso');
2683
+				$mt_template_args[$messenger.'_i_box'] = array(
2684
+				'active_message_types'   => ! empty($active_mt_tabs) ? $this->_get_mt_tabs($active_mt_tabs) : '',
2685
+				'inactive_message_types' => isset($this->_m_mt_settings['message_type_tabs'][$messenger]['inactive'])
2686
+				? $this->_get_mt_tabs($this->_m_mt_settings['message_type_tabs'][$messenger]['inactive'])
2687 2687
 				: '',
2688 2688
 				'hidden'                 => $active ? '' : ' hidden',
2689 2689
 				'hide_on_message'        => $hide_on_message,
@@ -2696,12 +2696,12 @@  discard block
 block discarded – undo
2696 2696
 
2697 2697
 
2698 2698
 		//register messenger metaboxes
2699
-		$m_template_path = EE_MSG_TEMPLATE_PATH . 'ee_msg_details_messenger_mt_meta_box.template.php';
2700
-		foreach ( $m_boxes as $box => $label ) {
2701
-			$callback_args = array( 'template_path' => $m_template_path, 'template_args' => $m_template_args[$box] );
2702
-			$msgr = str_replace( '_a_box', '', $box );
2699
+		$m_template_path = EE_MSG_TEMPLATE_PATH.'ee_msg_details_messenger_mt_meta_box.template.php';
2700
+		foreach ($m_boxes as $box => $label) {
2701
+			$callback_args = array('template_path' => $m_template_path, 'template_args' => $m_template_args[$box]);
2702
+			$msgr = str_replace('_a_box', '', $box);
2703 2703
 			add_meta_box(
2704
-				'espresso_' . $msgr . '_settings',
2704
+				'espresso_'.$msgr.'_settings',
2705 2705
 				$label,
2706 2706
 				create_function(
2707 2707
 					'$post, $metabox',
@@ -2715,14 +2715,14 @@  discard block
 block discarded – undo
2715 2715
 		}
2716 2716
 
2717 2717
 		//register message type metaboxes
2718
-		$mt_template_path = EE_MSG_TEMPLATE_PATH . 'ee_msg_details_messenger_meta_box.template.php';
2719
-		foreach ( $mt_boxes as $box => $label ) {
2718
+		$mt_template_path = EE_MSG_TEMPLATE_PATH.'ee_msg_details_messenger_meta_box.template.php';
2719
+		foreach ($mt_boxes as $box => $label) {
2720 2720
 			$callback_args = array(
2721
-				'template_path' => $mt_template_path, 'template_args' => $mt_template_args[ $box ]
2721
+				'template_path' => $mt_template_path, 'template_args' => $mt_template_args[$box]
2722 2722
 			);
2723
-			$mt = str_replace( '_i_box', '', $box );
2723
+			$mt = str_replace('_i_box', '', $box);
2724 2724
 			add_meta_box(
2725
-				'espresso_' . $mt . '_inactive_mts',
2725
+				'espresso_'.$mt.'_inactive_mts',
2726 2726
 				$label,
2727 2727
 				create_function(
2728 2728
 					'$post, $metabox',
@@ -2745,13 +2745,13 @@  discard block
 block discarded – undo
2745 2745
 	 *
2746 2746
 	 * @return string            html formatted tabs
2747 2747
 	 */
2748
-	protected function _get_mt_tabs( $tab_array ) {
2748
+	protected function _get_mt_tabs($tab_array) {
2749 2749
 		$tab_array = (array) $tab_array;
2750
-		$template = EE_MSG_TEMPLATE_PATH . 'ee_msg_details_mt_settings_tab_item.template.php';
2750
+		$template = EE_MSG_TEMPLATE_PATH.'ee_msg_details_mt_settings_tab_item.template.php';
2751 2751
 		$tabs = '';
2752 2752
 
2753
-		foreach ( $tab_array as $tab ) {
2754
-			$tabs .=  EEH_Template::display_template( $template, $tab, true );
2753
+		foreach ($tab_array as $tab) {
2754
+			$tabs .= EEH_Template::display_template($template, $tab, true);
2755 2755
 		}
2756 2756
 
2757 2757
 		return $tabs;
@@ -2767,29 +2767,29 @@  discard block
 block discarded – undo
2767 2767
 	 *
2768 2768
 	 * @return string            html formatted content
2769 2769
 	 */
2770
-	protected function _get_messenger_box_content( EE_messenger $messenger ) {
2770
+	protected function _get_messenger_box_content(EE_messenger $messenger) {
2771 2771
 
2772 2772
 		$fields = $messenger->get_admin_settings_fields();
2773 2773
 		$settings_template_args['template_form_fields'] = '';
2774 2774
 
2775 2775
 		//is $messenger active?
2776
-		$settings_template_args['active'] = $this->_message_resource_manager->is_messenger_active( $messenger->name );
2776
+		$settings_template_args['active'] = $this->_message_resource_manager->is_messenger_active($messenger->name);
2777 2777
 
2778 2778
 
2779
-		if ( ! empty( $fields ) ) {
2779
+		if ( ! empty($fields)) {
2780 2780
 
2781 2781
 			$existing_settings = $messenger->get_existing_admin_settings();
2782 2782
 
2783
-			foreach( $fields as $fldname => $fldprops ) {
2784
-				$field_id = $messenger->name . '-' . $fldname;
2783
+			foreach ($fields as $fldname => $fldprops) {
2784
+				$field_id = $messenger->name.'-'.$fldname;
2785 2785
 				$template_form_field[$field_id] = array(
2786
-					'name' => 'messenger_settings[' . $field_id . ']',
2786
+					'name' => 'messenger_settings['.$field_id.']',
2787 2787
 					'label' => $fldprops['label'],
2788 2788
 					'input' => $fldprops['field_type'],
2789 2789
 					'type' => $fldprops['value_type'],
2790 2790
 					'required' => $fldprops['required'],
2791 2791
 					'validation' => $fldprops['validation'],
2792
-					'value' => isset( $existing_settings[$field_id])
2792
+					'value' => isset($existing_settings[$field_id])
2793 2793
 						? $existing_settings[$field_id]
2794 2794
 						: $fldprops['default'],
2795 2795
 					'css_class' => '',
@@ -2798,8 +2798,8 @@  discard block
 block discarded – undo
2798 2798
 			}
2799 2799
 
2800 2800
 
2801
-			$settings_template_args['template_form_fields'] = !empty($template_form_field)
2802
-				? $this->_generate_admin_form_fields( $template_form_field, 'string', 'ee_m_activate_form' )
2801
+			$settings_template_args['template_form_fields'] = ! empty($template_form_field)
2802
+				? $this->_generate_admin_form_fields($template_form_field, 'string', 'ee_m_activate_form')
2803 2803
 				: '';
2804 2804
 		}
2805 2805
 
@@ -2816,39 +2816,39 @@  discard block
 block discarded – undo
2816 2816
 			);
2817 2817
 
2818 2818
 		//make sure any active message types that are existing are included in the hidden fields
2819
-		if ( isset( $this->_m_mt_settings['message_type_tabs'][$messenger->name]['active'] ) ) {
2820
-			foreach ( $this->_m_mt_settings['message_type_tabs'][$messenger->name]['active'] as $mt => $values ) {
2819
+		if (isset($this->_m_mt_settings['message_type_tabs'][$messenger->name]['active'])) {
2820
+			foreach ($this->_m_mt_settings['message_type_tabs'][$messenger->name]['active'] as $mt => $values) {
2821 2821
 				$settings_template_args['hidden_fields']['messenger_settings[message_types]['.$mt.']'] = array(
2822 2822
 						'type' => 'hidden',
2823 2823
 						'value' => $mt
2824 2824
 					);
2825 2825
 			}
2826 2826
 		}
2827
-		$settings_template_args[ 'hidden_fields' ] = $this->_generate_admin_form_fields(
2828
-			$settings_template_args[ 'hidden_fields' ],
2827
+		$settings_template_args['hidden_fields'] = $this->_generate_admin_form_fields(
2828
+			$settings_template_args['hidden_fields'],
2829 2829
 			'array'
2830 2830
 		);
2831
-		$active = $this->_message_resource_manager->is_messenger_active( $messenger->name );
2831
+		$active = $this->_message_resource_manager->is_messenger_active($messenger->name);
2832 2832
 
2833 2833
 		$settings_template_args['messenger'] = $messenger->name;
2834 2834
 		$settings_template_args['description'] = $messenger->description;
2835 2835
 		$settings_template_args['show_hide_edit_form'] = $active ? '' : ' hidden';
2836 2836
 
2837 2837
 
2838
-		$settings_template_args['show_hide_edit_form'] = $this->_message_resource_manager->is_messenger_active( $messenger->name )
2838
+		$settings_template_args['show_hide_edit_form'] = $this->_message_resource_manager->is_messenger_active($messenger->name)
2839 2839
 			? $settings_template_args['show_hide_edit_form']
2840 2840
 			: ' hidden';
2841 2841
 
2842
-		$settings_template_args['show_hide_edit_form'] = empty( $settings_template_args['template_form_fields'] )
2842
+		$settings_template_args['show_hide_edit_form'] = empty($settings_template_args['template_form_fields'])
2843 2843
 			? ' hidden'
2844 2844
 			: $settings_template_args['show_hide_edit_form'];
2845 2845
 
2846 2846
 
2847 2847
 		$settings_template_args['on_off_action'] = $active ? 'messenger-off' : 'messenger-on';
2848
-		$settings_template_args['nonce'] = wp_create_nonce('activate_' . $messenger->name . '_toggle_nonce');
2848
+		$settings_template_args['nonce'] = wp_create_nonce('activate_'.$messenger->name.'_toggle_nonce');
2849 2849
 		$settings_template_args['on_off_status'] = $active ? true : false;
2850
-		$template = EE_MSG_TEMPLATE_PATH . 'ee_msg_m_settings_content.template.php';
2851
-		$content = EEH_Template::display_template( $template, $settings_template_args, true);
2850
+		$template = EE_MSG_TEMPLATE_PATH.'ee_msg_m_settings_content.template.php';
2851
+		$content = EEH_Template::display_template($template, $settings_template_args, true);
2852 2852
 		return $content;
2853 2853
 	}
2854 2854
 
@@ -2862,9 +2862,9 @@  discard block
 block discarded – undo
2862 2862
 		$success = true;
2863 2863
 		$this->_prep_default_response_for_messenger_or_message_type_toggle();
2864 2864
 		//let's check that we have required data
2865
-		if ( !isset( $this->_req_data[ 'messenger' ] ) ) {
2865
+		if ( ! isset($this->_req_data['messenger'])) {
2866 2866
 			EE_Error::add_error(
2867
-				__( 'Messenger name needed to toggle activation. None given', 'event_espresso' ),
2867
+				__('Messenger name needed to toggle activation. None given', 'event_espresso'),
2868 2868
 				__FILE__,
2869 2869
 				__FUNCTION__,
2870 2870
 				__LINE__
@@ -2873,14 +2873,14 @@  discard block
 block discarded – undo
2873 2873
 		}
2874 2874
 
2875 2875
 		//do a nonce check here since we're not arriving via a normal route
2876
-		$nonce = isset($this->_req_data[ 'activate_nonce' ]) ? sanitize_text_field( $this->_req_data[ 'activate_nonce'] ) : '';
2877
-		$nonce_ref = 'activate_' . $this->_req_data['messenger'] . '_toggle_nonce';
2876
+		$nonce = isset($this->_req_data['activate_nonce']) ? sanitize_text_field($this->_req_data['activate_nonce']) : '';
2877
+		$nonce_ref = 'activate_'.$this->_req_data['messenger'].'_toggle_nonce';
2878 2878
 
2879
-		$this->_verify_nonce( $nonce, $nonce_ref );
2879
+		$this->_verify_nonce($nonce, $nonce_ref);
2880 2880
 
2881 2881
 
2882 2882
 
2883
-		if ( !isset( $this->_req_data[ 'status' ])) {
2883
+		if ( ! isset($this->_req_data['status'])) {
2884 2884
 			EE_Error::add_error(
2885 2885
 				__(
2886 2886
 					'Messenger status needed to know whether activation or deactivation is happening. No status is given',
@@ -2896,11 +2896,11 @@  discard block
 block discarded – undo
2896 2896
 		//do check to verify we have a valid status.
2897 2897
 		$status = $this->_req_data['status'];
2898 2898
 
2899
-		if ( $status != 'off' && $status != 'on' ) {
2899
+		if ($status != 'off' && $status != 'on') {
2900 2900
 			EE_Error::add_error(
2901 2901
 				sprintf(
2902
-					__( 'The given status (%s) is not valid. Must be "off" or "on"', 'event_espresso' ),
2903
-					$this->_req_data[ 'status' ]
2902
+					__('The given status (%s) is not valid. Must be "off" or "on"', 'event_espresso'),
2903
+					$this->_req_data['status']
2904 2904
 				),
2905 2905
 				__FILE__,
2906 2906
 				__FUNCTION__,
@@ -2909,11 +2909,11 @@  discard block
 block discarded – undo
2909 2909
 			$success = false;
2910 2910
 		}
2911 2911
 
2912
-		if ( $success ) {
2912
+		if ($success) {
2913 2913
 			//made it here?  Stop dawdling then!!
2914 2914
 			$success = $status == 'off'
2915
-				? $this->_deactivate_messenger( $this->_req_data['messenger'] )
2916
-				: $this->_activate_messenger( $this->_req_data['messenger'] );
2915
+				? $this->_deactivate_messenger($this->_req_data['messenger'])
2916
+				: $this->_activate_messenger($this->_req_data['messenger']);
2917 2917
 		}
2918 2918
 
2919 2919
 		$this->_template_args['success'] = $success;
@@ -2936,7 +2936,7 @@  discard block
 block discarded – undo
2936 2936
 		$this->_prep_default_response_for_messenger_or_message_type_toggle();
2937 2937
 
2938 2938
 		//let's make sure we have the necessary data
2939
-		if ( ! isset( $this->_req_data[ 'message_type' ] ) ) {
2939
+		if ( ! isset($this->_req_data['message_type'])) {
2940 2940
 			EE_Error::add_error(
2941 2941
 				__('Message Type name needed to toggle activation. None given', 'event_espresso'),
2942 2942
 				__FILE__, __FUNCTION__, __LINE__
@@ -2944,7 +2944,7 @@  discard block
 block discarded – undo
2944 2944
 			$success = false;
2945 2945
 		}
2946 2946
 
2947
-		if ( ! isset( $this->_req_data[ 'messenger' ] ) ) {
2947
+		if ( ! isset($this->_req_data['messenger'])) {
2948 2948
 			EE_Error::add_error(
2949 2949
 				__('Messenger name needed to toggle activation. None given', 'event_espresso'),
2950 2950
 				__FILE__, __FUNCTION__, __LINE__
@@ -2952,7 +2952,7 @@  discard block
 block discarded – undo
2952 2952
 			$success = false;
2953 2953
 		}
2954 2954
 
2955
-		if ( ! isset( $this->_req_data[ 'status' ])) {
2955
+		if ( ! isset($this->_req_data['status'])) {
2956 2956
 			EE_Error::add_error(
2957 2957
 				__('Messenger status needed to know whether activation or deactivation is happening. No status is given', 'event_espresso'),
2958 2958
 				__FILE__, __FUNCTION__, __LINE__
@@ -2964,7 +2964,7 @@  discard block
 block discarded – undo
2964 2964
 		//do check to verify we have a valid status.
2965 2965
 		$status = $this->_req_data['status'];
2966 2966
 
2967
-		if ( $status != 'activate' && $status != 'deactivate' ) {
2967
+		if ($status != 'activate' && $status != 'deactivate') {
2968 2968
 			EE_Error::add_error(
2969 2969
 				sprintf(
2970 2970
 					__('The given status (%s) is not valid. Must be "active" or "inactive"', 'event_espresso'),
@@ -2977,16 +2977,16 @@  discard block
 block discarded – undo
2977 2977
 
2978 2978
 
2979 2979
 		//do a nonce check here since we're not arriving via a normal route
2980
-		$nonce = isset( $this->_req_data['mt_nonce'] ) ? sanitize_text_field( $this->_req_data['mt_nonce'] ) : '';
2981
-		$nonce_ref = $this->_req_data['message_type'] . '_nonce';
2980
+		$nonce = isset($this->_req_data['mt_nonce']) ? sanitize_text_field($this->_req_data['mt_nonce']) : '';
2981
+		$nonce_ref = $this->_req_data['message_type'].'_nonce';
2982 2982
 
2983
-		$this->_verify_nonce( $nonce, $nonce_ref );
2983
+		$this->_verify_nonce($nonce, $nonce_ref);
2984 2984
 
2985
-		if ( $success ) {
2985
+		if ($success) {
2986 2986
 			//made it here? um, what are you waiting for then?
2987 2987
 			$success = $status == 'deactivate'
2988
-				? $this->_deactivate_message_type_for_messenger( $this->_req_data['messenger'], $this->_req_data['message_type'] )
2989
-				: $this->_activate_message_type_for_messenger( $this->_req_data['messenger'], $this->_req_data['message_type'] );
2988
+				? $this->_deactivate_message_type_for_messenger($this->_req_data['messenger'], $this->_req_data['message_type'])
2989
+				: $this->_activate_message_type_for_messenger($this->_req_data['messenger'], $this->_req_data['message_type']);
2990 2990
 		}
2991 2991
 
2992 2992
 		$this->_template_args['success'] = $success;
@@ -3000,30 +3000,30 @@  discard block
 block discarded – undo
3000 3000
 	 * @param string $messenger_name The name of the messenger being activated
3001 3001
 	 * @return bool
3002 3002
 	 */
3003
-	protected function _activate_messenger( $messenger_name ) {
3003
+	protected function _activate_messenger($messenger_name) {
3004 3004
 		/** @var EE_messenger $active_messenger  This will be present because it can't be toggled if it isn't*/
3005
-		$active_messenger = $this->_message_resource_manager->get_messenger( $messenger_name );
3005
+		$active_messenger = $this->_message_resource_manager->get_messenger($messenger_name);
3006 3006
 		$message_types_to_activate = $active_messenger instanceof EE_Messenger ? $active_messenger->get_default_message_types() : array();
3007 3007
 
3008 3008
 		//ensure is active
3009
-		$this->_message_resource_manager->activate_messenger( $messenger_name, $message_types_to_activate );
3009
+		$this->_message_resource_manager->activate_messenger($messenger_name, $message_types_to_activate);
3010 3010
 
3011 3011
 		//set response_data for reload
3012
-		foreach( $message_types_to_activate as $message_type_name ) {
3012
+		foreach ($message_types_to_activate as $message_type_name) {
3013 3013
 			/** @var EE_message_type $message_type */
3014
-			$message_type = $this->_message_resource_manager->get_message_type( $message_type_name );
3015
-			if ( $this->_message_resource_manager->is_message_type_active_for_messenger( $messenger_name, $message_type_name )
3014
+			$message_type = $this->_message_resource_manager->get_message_type($message_type_name);
3015
+			if ($this->_message_resource_manager->is_message_type_active_for_messenger($messenger_name, $message_type_name)
3016 3016
 			     && $message_type instanceof EE_message_type
3017 3017
 			) {
3018 3018
 				$this->_template_args['data']['active_mts'][] = $message_type_name;
3019
-				if ( $message_type->get_admin_settings_fields() ) {
3019
+				if ($message_type->get_admin_settings_fields()) {
3020 3020
 					$this->_template_args['data']['mt_reload'][] = $message_type_name;
3021 3021
 				}
3022 3022
 			}
3023 3023
 		}
3024 3024
 
3025 3025
 		//add success message for activating messenger
3026
-		return $this->_setup_response_message_for_activating_messenger_with_message_types( $active_messenger );
3026
+		return $this->_setup_response_message_for_activating_messenger_with_message_types($active_messenger);
3027 3027
 
3028 3028
 	}
3029 3029
 
@@ -3034,11 +3034,11 @@  discard block
 block discarded – undo
3034 3034
 	 * @param string $messenger_name The name of the messenger being activated
3035 3035
 	 * @return bool
3036 3036
 	 */
3037
-	protected function _deactivate_messenger( $messenger_name ) {
3037
+	protected function _deactivate_messenger($messenger_name) {
3038 3038
 		/** @var EE_messenger $active_messenger  This will be present because it can't be toggled if it isn't*/
3039
-		$active_messenger = $this->_message_resource_manager->get_messenger( $messenger_name );
3040
-		$this->_message_resource_manager->deactivate_messenger( $messenger_name );
3041
-		return $this->_setup_response_message_for_deactivating_messenger_with_message_types( $active_messenger );
3039
+		$active_messenger = $this->_message_resource_manager->get_messenger($messenger_name);
3040
+		$this->_message_resource_manager->deactivate_messenger($messenger_name);
3041
+		return $this->_setup_response_message_for_deactivating_messenger_with_message_types($active_messenger);
3042 3042
 	}
3043 3043
 
3044 3044
 
@@ -3049,23 +3049,23 @@  discard block
 block discarded – undo
3049 3049
 	 * @param string $message_type_name  The name of the message type being activated for the messenger
3050 3050
 	 * @return bool
3051 3051
 	 */
3052
-	protected function _activate_message_type_for_messenger( $messenger_name, $message_type_name ) {
3052
+	protected function _activate_message_type_for_messenger($messenger_name, $message_type_name) {
3053 3053
 		/** @var EE_messenger $active_messenger  This will be present because it can't be toggled if it isn't*/
3054
-		$active_messenger = $this->_message_resource_manager->get_messenger( $messenger_name );
3054
+		$active_messenger = $this->_message_resource_manager->get_messenger($messenger_name);
3055 3055
 		/** @var EE_message_type $message_type_to_activate This will be present because it can't be toggled if it isn't*/
3056
-		$message_type_to_activate = $this->_message_resource_manager->get_message_type( $message_type_name );
3056
+		$message_type_to_activate = $this->_message_resource_manager->get_message_type($message_type_name);
3057 3057
 
3058 3058
 		//ensure is active
3059
-		$this->_message_resource_manager->activate_messenger( $messenger_name, $message_type_name );
3059
+		$this->_message_resource_manager->activate_messenger($messenger_name, $message_type_name);
3060 3060
 
3061 3061
 		//set response for load
3062
-		if ( $this->_message_resource_manager->is_message_type_active_for_messenger( $messenger_name, $message_type_name ) ) {
3062
+		if ($this->_message_resource_manager->is_message_type_active_for_messenger($messenger_name, $message_type_name)) {
3063 3063
 			$this->_template_args['data']['active_mts'][] = $message_type_name;
3064
-			if ( $message_type_to_activate->get_admin_settings_fields() ) {
3064
+			if ($message_type_to_activate->get_admin_settings_fields()) {
3065 3065
 				$this->_template_args['data']['mt_reload'][] = $message_type_name;
3066 3066
 			}
3067 3067
 		}
3068
-		return $this->_setup_response_message_for_activating_messenger_with_message_types( $active_messenger, $message_type_to_activate );
3068
+		return $this->_setup_response_message_for_activating_messenger_with_message_types($active_messenger, $message_type_to_activate);
3069 3069
 	}
3070 3070
 
3071 3071
 
@@ -3077,13 +3077,13 @@  discard block
 block discarded – undo
3077 3077
 	 * @param string $message_type_name  The name of the message type being deactivated for the messenger
3078 3078
 	 * @return bool
3079 3079
 	 */
3080
-	protected function _deactivate_message_type_for_messenger( $messenger_name, $message_type_name ) {
3080
+	protected function _deactivate_message_type_for_messenger($messenger_name, $message_type_name) {
3081 3081
 		/** @var EE_messenger $active_messenger  This will be present because it can't be toggled if it isn't*/
3082
-		$active_messenger = $this->_message_resource_manager->get_messenger( $messenger_name );
3082
+		$active_messenger = $this->_message_resource_manager->get_messenger($messenger_name);
3083 3083
 		/** @var EE_message_type $message_type_to_activate This will be present because it can't be toggled if it isn't*/
3084
-		$message_type_to_deactivate = $this->_message_resource_manager->get_message_type( $message_type_name );
3085
-		$this->_message_resource_manager->deactivate_message_type_for_messenger( $message_type_name, $messenger_name );
3086
-		return $this->_setup_response_message_for_deactivating_messenger_with_message_types( $active_messenger, $message_type_to_deactivate );
3084
+		$message_type_to_deactivate = $this->_message_resource_manager->get_message_type($message_type_name);
3085
+		$this->_message_resource_manager->deactivate_message_type_for_messenger($message_type_name, $messenger_name);
3086
+		return $this->_setup_response_message_for_deactivating_messenger_with_message_types($active_messenger, $message_type_to_deactivate);
3087 3087
 	}
3088 3088
 
3089 3089
 
@@ -3114,9 +3114,9 @@  discard block
 block discarded – undo
3114 3114
 		EE_Message_Type $message_type = null
3115 3115
 	) {
3116 3116
 		//if $messenger isn't a valid messenger object then get out.
3117
-		if ( ! $messenger instanceof EE_Messenger ) {
3117
+		if ( ! $messenger instanceof EE_Messenger) {
3118 3118
 			EE_Error::add_error(
3119
-				__( 'The messenger being activated is not a valid messenger', 'event_espresso' ),
3119
+				__('The messenger being activated is not a valid messenger', 'event_espresso'),
3120 3120
 				__FILE__,
3121 3121
 				__FUNCTION__,
3122 3122
 				__LINE__
@@ -3124,32 +3124,32 @@  discard block
 block discarded – undo
3124 3124
 			return false;
3125 3125
 		}
3126 3126
 		//activated
3127
-		if ( $this->_template_args['data']['active_mts'] ) {
3127
+		if ($this->_template_args['data']['active_mts']) {
3128 3128
 			EE_Error::overwrite_success();
3129 3129
 			//activated a message type with the messenger
3130
-			if ( $message_type instanceof EE_message_type ) {
3130
+			if ($message_type instanceof EE_message_type) {
3131 3131
 				EE_Error::add_success(
3132 3132
 					sprintf(
3133 3133
 						__('%s message type has been successfully activated with the %s messenger', 'event_espresso'),
3134
-						ucwords( $message_type->label['singular'] ),
3135
-						ucwords( $messenger->label['singular'] )
3134
+						ucwords($message_type->label['singular']),
3135
+						ucwords($messenger->label['singular'])
3136 3136
 					)
3137 3137
 				);
3138 3138
 
3139 3139
 				//if message type was invoice then let's make sure we activate the invoice payment method.
3140
-				if ( $message_type->name == 'invoice' ) {
3141
-					EE_Registry::instance()->load_lib( 'Payment_Method_Manager' );
3142
-					$pm = EE_Payment_Method_Manager::instance()->activate_a_payment_method_of_type( 'Invoice' );
3143
-					if ( $pm instanceof EE_Payment_Method ) {
3144
-						EE_Error::add_attention( __('Activating the invoice message type also automatically activates the invoice payment method.  If you do not wish the invoice payment method to be active, or to change its settings, visit the payment method admin page.', 'event_espresso' ) );
3140
+				if ($message_type->name == 'invoice') {
3141
+					EE_Registry::instance()->load_lib('Payment_Method_Manager');
3142
+					$pm = EE_Payment_Method_Manager::instance()->activate_a_payment_method_of_type('Invoice');
3143
+					if ($pm instanceof EE_Payment_Method) {
3144
+						EE_Error::add_attention(__('Activating the invoice message type also automatically activates the invoice payment method.  If you do not wish the invoice payment method to be active, or to change its settings, visit the payment method admin page.', 'event_espresso'));
3145 3145
 					}
3146 3146
 				}
3147 3147
 			//just toggles the entire messenger
3148 3148
 			} else {
3149 3149
 				EE_Error::add_success(
3150 3150
 					sprintf(
3151
-						__( '%s messenger has been successfully activated', 'event_espresso' ),
3152
-						ucwords( $messenger->label[ 'singular' ] )
3151
+						__('%s messenger has been successfully activated', 'event_espresso'),
3152
+						ucwords($messenger->label['singular'])
3153 3153
 					)
3154 3154
 				);
3155 3155
 			}
@@ -3159,12 +3159,12 @@  discard block
 block discarded – undo
3159 3159
 		//message types after the activation process.  However its possible some messengers don't HAVE any default_message_types
3160 3160
 		//in which case we just give a success message for the messenger being successfully activated.
3161 3161
 		} else {
3162
-			if ( ! $messenger->get_default_message_types() ) {
3162
+			if ( ! $messenger->get_default_message_types()) {
3163 3163
 				//messenger doesn't have any default message types so still a success.
3164 3164
 				EE_Error::add_success(
3165 3165
 					sprintf(
3166
-						__('%s messenger was successfully activated.', 'event_espresso' ),
3167
-						ucwords( $messenger->label['singular'] )
3166
+						__('%s messenger was successfully activated.', 'event_espresso'),
3167
+						ucwords($messenger->label['singular'])
3168 3168
 						)
3169 3169
 				);
3170 3170
 				return true;
@@ -3172,13 +3172,13 @@  discard block
 block discarded – undo
3172 3172
 				EE_Error::add_error(
3173 3173
 					$message_type instanceof EE_message_type
3174 3174
 						? sprintf(
3175
-						__( '%s message type was not successfully activated with the %s messenger', 'event_espresso' ),
3176
-						ucwords( $message_type->label['singular'] ),
3177
-						ucwords( $messenger->label['singular'] )
3175
+						__('%s message type was not successfully activated with the %s messenger', 'event_espresso'),
3176
+						ucwords($message_type->label['singular']),
3177
+						ucwords($messenger->label['singular'])
3178 3178
 					)
3179 3179
 						: sprintf(
3180
-						__( '%s messenger was not successfully activated', 'event_espresso' ),
3181
-						ucwords( $messenger->label['singular'] )
3180
+						__('%s messenger was not successfully activated', 'event_espresso'),
3181
+						ucwords($messenger->label['singular'])
3182 3182
 					),
3183 3183
 					__FILE__,
3184 3184
 					__FUNCTION__,
@@ -3206,9 +3206,9 @@  discard block
 block discarded – undo
3206 3206
 		EE_Error::overwrite_success();
3207 3207
 
3208 3208
 		//if $messenger isn't a valid messenger object then get out.
3209
-		if ( ! $messenger instanceof EE_Messenger ) {
3209
+		if ( ! $messenger instanceof EE_Messenger) {
3210 3210
 			EE_Error::add_error(
3211
-				__( 'The messenger being deactivated is not a valid messenger', 'event_espresso' ),
3211
+				__('The messenger being deactivated is not a valid messenger', 'event_espresso'),
3212 3212
 				__FILE__,
3213 3213
 				__FUNCTION__,
3214 3214
 				__LINE__
@@ -3216,13 +3216,13 @@  discard block
 block discarded – undo
3216 3216
 			return false;
3217 3217
 		}
3218 3218
 
3219
-		if ( $message_type instanceof EE_message_type ) {
3219
+		if ($message_type instanceof EE_message_type) {
3220 3220
 			$message_type_name = $message_type->name;
3221 3221
 			EE_Error::add_success(
3222 3222
 				sprintf(
3223 3223
 					__('%s message type has been successfully deactivated for the %s messenger.', 'event_espresso'),
3224
-					ucwords( $message_type->label['singular'] ),
3225
-					ucwords ( $messenger->label['singular'] )
3224
+					ucwords($message_type->label['singular']),
3225
+					ucwords($messenger->label['singular'])
3226 3226
 				)
3227 3227
 			);
3228 3228
 		} else {
@@ -3230,20 +3230,20 @@  discard block
 block discarded – undo
3230 3230
 			EE_Error::add_success(
3231 3231
 				sprintf(
3232 3232
 					__('%s messenger has been successfully deactivated.', 'event_espresso'),
3233
-					ucwords( $messenger->label['singular'] )
3233
+					ucwords($messenger->label['singular'])
3234 3234
 				)
3235 3235
 			);
3236 3236
 		}
3237 3237
 
3238 3238
 		//if messenger was html or message type was invoice then let's make sure we deactivate invoice payment method.
3239
-		if ( $messenger->name == 'html'  || $message_type_name == 'invoice') {
3240
-			EE_Registry::instance()->load_lib( 'Payment_Method_Manager' );
3241
-			$count_updated = EE_Payment_Method_Manager::instance()->deactivate_payment_method( 'invoice' );
3242
-			if ( $count_updated > 0 ) {
3239
+		if ($messenger->name == 'html' || $message_type_name == 'invoice') {
3240
+			EE_Registry::instance()->load_lib('Payment_Method_Manager');
3241
+			$count_updated = EE_Payment_Method_Manager::instance()->deactivate_payment_method('invoice');
3242
+			if ($count_updated > 0) {
3243 3243
 				$msg = $message_type_name == 'invoice'
3244
-					? __('Deactivating the invoice message type also automatically deactivates the invoice payment method. In order for invoices to be generated the invoice message type must be active. If you completed this action by mistake, simply reactivate the invoice message type and then visit the payment methods admin page to reactivate the invoice payment method.', 'event_espresso' )
3245
-					: __('Deactivating the html messenger also automatically deactivates the invoice payment method.  In order for invoices to be generated the html messenger must be be active.  If you completed this action by mistake, simply reactivate the html messenger, then visit the payment methods admin page to reactivate the invoice payment method.', 'event_espresso' );
3246
-				EE_Error::add_attention( $msg );
3244
+					? __('Deactivating the invoice message type also automatically deactivates the invoice payment method. In order for invoices to be generated the invoice message type must be active. If you completed this action by mistake, simply reactivate the invoice message type and then visit the payment methods admin page to reactivate the invoice payment method.', 'event_espresso')
3245
+					: __('Deactivating the html messenger also automatically deactivates the invoice payment method.  In order for invoices to be generated the html messenger must be be active.  If you completed this action by mistake, simply reactivate the html messenger, then visit the payment methods admin page to reactivate the invoice payment method.', 'event_espresso');
3246
+				EE_Error::add_attention($msg);
3247 3247
 			}
3248 3248
 		}
3249 3249
 		return true;
@@ -3254,17 +3254,17 @@  discard block
 block discarded – undo
3254 3254
 	 * handles updating a message type form on messenger activation IF the message type has settings fields. (via ajax)
3255 3255
 	 */
3256 3256
 	public function update_mt_form() {
3257
-		if ( !isset( $this->_req_data['messenger'] ) || !isset( $this->_req_data['message_type'] ) ) {
3258
-			EE_Error::add_error( __('Require message type or messenger to send an updated form'), __FILE__, __FUNCTION__, __LINE__ );
3257
+		if ( ! isset($this->_req_data['messenger']) || ! isset($this->_req_data['message_type'])) {
3258
+			EE_Error::add_error(__('Require message type or messenger to send an updated form'), __FILE__, __FUNCTION__, __LINE__);
3259 3259
 			$this->_return_json();
3260 3260
 		}
3261 3261
 
3262 3262
 		$message_types = $this->get_installed_message_types();
3263 3263
 
3264
-		$message_type = $message_types[ $this->_req_data['message_type'] ];
3265
-		$messenger = $this->_message_resource_manager->get_active_messenger( $this->_req_data['messenger'] );
3264
+		$message_type = $message_types[$this->_req_data['message_type']];
3265
+		$messenger = $this->_message_resource_manager->get_active_messenger($this->_req_data['messenger']);
3266 3266
 
3267
-		$content = $this->_message_type_settings_content ( $message_type, $messenger, true );
3267
+		$content = $this->_message_type_settings_content($message_type, $messenger, true);
3268 3268
 		$this->_template_args['success'] = true;
3269 3269
 		$this->_template_args['content'] = $content;
3270 3270
 		$this->_return_json();
@@ -3278,45 +3278,45 @@  discard block
 block discarded – undo
3278 3278
 	 *
3279 3279
 	 */
3280 3280
 	public function save_settings() {
3281
-		if ( !isset( $this->_req_data['type'] ) ) {
3282
-			EE_Error::add_error(__('Cannot save settings because type is unknown (messenger settings or messsage type settings?)', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
3281
+		if ( ! isset($this->_req_data['type'])) {
3282
+			EE_Error::add_error(__('Cannot save settings because type is unknown (messenger settings or messsage type settings?)', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
3283 3283
 			$this->_template_args['error'] = true;
3284 3284
 			$this->_return_json();
3285 3285
 		}
3286 3286
 
3287 3287
 
3288
-		if ( $this->_req_data['type'] == 'messenger' ) {
3288
+		if ($this->_req_data['type'] == 'messenger') {
3289 3289
 			$settings = $this->_req_data['messenger_settings']; //this should be an array.
3290 3290
 			$messenger = $settings['messenger'];
3291 3291
 			//let's setup the settings data
3292
-			foreach ( $settings as $key => $value ) {
3293
-				switch ( $key ) {
3292
+			foreach ($settings as $key => $value) {
3293
+				switch ($key) {
3294 3294
 					case 'messenger' :
3295
-						unset( $settings['messenger'] );
3295
+						unset($settings['messenger']);
3296 3296
 						break;
3297 3297
 					case 'message_types' :
3298
-						unset( $settings['message_types'] );
3298
+						unset($settings['message_types']);
3299 3299
 						break;
3300 3300
 					default :
3301 3301
 						$settings[$key] = $value;
3302 3302
 						break;
3303 3303
 				}
3304 3304
 			}
3305
-			$this->_message_resource_manager->add_settings_for_messenger( $messenger, $settings );
3305
+			$this->_message_resource_manager->add_settings_for_messenger($messenger, $settings);
3306 3306
 		}
3307 3307
 
3308
-		else if ( $this->_req_data['type'] == 'message_type' ) {
3308
+		else if ($this->_req_data['type'] == 'message_type') {
3309 3309
 			$settings = $this->_req_data['message_type_settings'];
3310 3310
 			$messenger = $settings['messenger'];
3311 3311
 			$message_type = $settings['message_type'];
3312 3312
 
3313
-			foreach ( $settings as $key => $value ) {
3314
-				switch ( $key ) {
3313
+			foreach ($settings as $key => $value) {
3314
+				switch ($key) {
3315 3315
 					case 'messenger' :
3316
-						unset( $settings['messenger'] );
3316
+						unset($settings['messenger']);
3317 3317
 						break;
3318 3318
 					case 'message_type' :
3319
-						unset( $settings['message_type'] );
3319
+						unset($settings['message_type']);
3320 3320
 						break;
3321 3321
 					default :
3322 3322
 						$settings[$key] = $value;
@@ -3324,16 +3324,16 @@  discard block
 block discarded – undo
3324 3324
 				}
3325 3325
 			}
3326 3326
 
3327
-			$this->_message_resource_manager->add_settings_for_message_type( $messenger, $message_type, $settings );
3327
+			$this->_message_resource_manager->add_settings_for_message_type($messenger, $message_type, $settings);
3328 3328
 		}
3329 3329
 
3330 3330
 		//okay we should have the data all setup.  Now we just update!
3331 3331
 		$success = $this->_message_resource_manager->update_active_messengers_option();
3332 3332
 
3333
-		if ( $success ) {
3334
-			EE_Error::add_success( __('Settings updated', 'event_espresso') );
3333
+		if ($success) {
3334
+			EE_Error::add_success(__('Settings updated', 'event_espresso'));
3335 3335
 		} else {
3336
-			EE_Error::add_error( __('Settings did not get updated', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
3336
+			EE_Error::add_error(__('Settings did not get updated', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
3337 3337
 		}
3338 3338
 
3339 3339
 		$this->_template_args['success'] = $success;
@@ -3355,8 +3355,8 @@  discard block
 block discarded – undo
3355 3355
      */
3356 3356
 	protected function _generate_now() {
3357 3357
 		$msg_ids = $this->_get_msg_ids_from_request();
3358
-		EED_Messages::generate_now( $msg_ids );
3359
-		$this->_redirect_after_action( false, '', '', array(), true );
3358
+		EED_Messages::generate_now($msg_ids);
3359
+		$this->_redirect_after_action(false, '', '', array(), true);
3360 3360
 	}
3361 3361
 
3362 3362
 
@@ -3371,7 +3371,7 @@  discard block
 block discarded – undo
3371 3371
 	protected function _generate_and_send_now() {
3372 3372
 		$this->_generate_now();
3373 3373
 		$this->_send_now();
3374
-		$this->_redirect_after_action( false, '', '', array(), true );
3374
+		$this->_redirect_after_action(false, '', '', array(), true);
3375 3375
 	}
3376 3376
 
3377 3377
 
@@ -3385,8 +3385,8 @@  discard block
 block discarded – undo
3385 3385
      */
3386 3386
 	protected function _queue_for_resending() {
3387 3387
 		$msg_ids = $this->_get_msg_ids_from_request();
3388
-		EED_Messages::queue_for_resending( $msg_ids );
3389
-		$this->_redirect_after_action( false, '', '', array(), true );
3388
+		EED_Messages::queue_for_resending($msg_ids);
3389
+		$this->_redirect_after_action(false, '', '', array(), true);
3390 3390
 	}
3391 3391
 
3392 3392
 
@@ -3399,8 +3399,8 @@  discard block
 block discarded – undo
3399 3399
      */
3400 3400
 	protected function _send_now() {
3401 3401
 		$msg_ids = $this->_get_msg_ids_from_request();
3402
-		EED_Messages::send_now( $msg_ids );
3403
-		$this->_redirect_after_action( false, '', '', array(), true );
3402
+		EED_Messages::send_now($msg_ids);
3403
+		$this->_redirect_after_action(false, '', '', array(), true);
3404 3404
 	}
3405 3405
 
3406 3406
 
@@ -3414,23 +3414,23 @@  discard block
 block discarded – undo
3414 3414
 	protected function _delete_ee_messages() {
3415 3415
 		$msg_ids = $this->_get_msg_ids_from_request();
3416 3416
 		$deleted_count = 0;
3417
-		foreach ( $msg_ids as $msg_id ) {
3418
-			if ( EEM_Message::instance()->delete_by_ID( $msg_id ) ) {
3417
+		foreach ($msg_ids as $msg_id) {
3418
+			if (EEM_Message::instance()->delete_by_ID($msg_id)) {
3419 3419
 				$deleted_count++;
3420 3420
 			}
3421 3421
 		}
3422
-		if ( $deleted_count ) {
3422
+		if ($deleted_count) {
3423 3423
 			$this->_redirect_after_action(
3424 3424
 				true,
3425
-				_n( 'message', 'messages', $deleted_count, 'event_espresso' ),
3425
+				_n('message', 'messages', $deleted_count, 'event_espresso'),
3426 3426
 				__('deleted', 'event_espresso')
3427 3427
 			);
3428 3428
 		} else {
3429 3429
 			EE_Error::add_error(
3430
-				_n( 'The message was not deleted.', 'The messages were not deleted', count( $msg_ids ), 'event_espresso' ),
3430
+				_n('The message was not deleted.', 'The messages were not deleted', count($msg_ids), 'event_espresso'),
3431 3431
 				__FILE__, __FUNCTION__, __LINE__
3432 3432
 			);
3433
-			$this->_redirect_after_action( false, '', '', array(), true );
3433
+			$this->_redirect_after_action(false, '', '', array(), true);
3434 3434
 		}
3435 3435
 	}
3436 3436
 
@@ -3443,10 +3443,10 @@  discard block
 block discarded – undo
3443 3443
      *  @return array
3444 3444
      */
3445 3445
 	protected function _get_msg_ids_from_request() {
3446
-		if ( ! isset( $this->_req_data['MSG_ID'] ) ) {
3446
+		if ( ! isset($this->_req_data['MSG_ID'])) {
3447 3447
 			return array();
3448 3448
 		}
3449
-		return is_array( $this->_req_data['MSG_ID'] ) ? array_keys( $this->_req_data['MSG_ID'] ) : array( $this->_req_data['MSG_ID'] );
3449
+		return is_array($this->_req_data['MSG_ID']) ? array_keys($this->_req_data['MSG_ID']) : array($this->_req_data['MSG_ID']);
3450 3450
 	}
3451 3451
 
3452 3452
 
Please login to merge, or discard this patch.
admin_pages/messages/EE_Message_List_Table.class.php 1 patch
Spacing   +105 added lines, -105 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
 /**
@@ -26,8 +26,8 @@  discard block
 block discarded – undo
26 26
 
27 27
 
28 28
 	protected function _setup_data() {
29
-		$this->_data = $this->_get_messages( $this->_per_page, $this->_view );
30
-		$this->_all_data_count = $this->_get_messages( $this->_per_page, $this->_view, true );
29
+		$this->_data = $this->_get_messages($this->_per_page, $this->_view);
30
+		$this->_all_data_count = $this->_get_messages($this->_per_page, $this->_view, true);
31 31
 	}
32 32
 
33 33
 
@@ -35,8 +35,8 @@  discard block
 block discarded – undo
35 35
 
36 36
 	protected function _set_properties() {
37 37
 		$this->_wp_list_args = array(
38
-			'singular' => __( 'Message', 'event_espresso' ),
39
-			'plural' => __( 'Messages', 'event_espresso' ),
38
+			'singular' => __('Message', 'event_espresso'),
39
+			'plural' => __('Messages', 'event_espresso'),
40 40
 			'ajax' => true,
41 41
 			'screen' => $this->get_admin_page()->get_current_screen()->id
42 42
 		);
@@ -44,24 +44,24 @@  discard block
 block discarded – undo
44 44
 		$this->_columns = array(
45 45
 			'msg_status' => '',
46 46
 			'cb' => '<input type="checkbox" />',
47
-			'msg_id' => __( 'ID', 'event_espresso' ),
48
-			'to' => __( 'To', 'event_espresso' ),
49
-			'from' => __( 'From', 'event_espresso' ),
50
-			'messenger' => __( 'Messenger', 'event_espresso' ),
51
-			'message_type' => __( 'Message Type', 'event_espresso' ),
52
-			'context' => __( 'Context', 'event_espresso' ),
53
-			'modified' => __( 'Modified', 'event_espresso' ),
54
-			'action' => __( 'Actions', 'event_espresso' )
47
+			'msg_id' => __('ID', 'event_espresso'),
48
+			'to' => __('To', 'event_espresso'),
49
+			'from' => __('From', 'event_espresso'),
50
+			'messenger' => __('Messenger', 'event_espresso'),
51
+			'message_type' => __('Message Type', 'event_espresso'),
52
+			'context' => __('Context', 'event_espresso'),
53
+			'modified' => __('Modified', 'event_espresso'),
54
+			'action' => __('Actions', 'event_espresso')
55 55
 		);
56 56
 
57 57
 		$this->_sortable_columns = array(
58
-			'modified' => array( 'MSG_modified' => true ),
59
-			'msg_id' => array( 'MSG_ID', false ),
60
-			'message_type' => array( 'MSG_message_type' => false ),
61
-			'messenger' => array( 'MSG_messenger' => false ),
62
-			'to' => array( 'MSG_to' => false ),
63
-			'from' => array( 'MSG_from' => false ),
64
-			'context' => array( 'MSG_context' => false )
58
+			'modified' => array('MSG_modified' => true),
59
+			'msg_id' => array('MSG_ID', false),
60
+			'message_type' => array('MSG_message_type' => false),
61
+			'messenger' => array('MSG_messenger' => false),
62
+			'to' => array('MSG_to' => false),
63
+			'from' => array('MSG_from' => false),
64
+			'context' => array('MSG_context' => false)
65 65
 		);
66 66
 
67 67
 		$this->_hidden_columns = array(
@@ -73,9 +73,9 @@  discard block
 block discarded – undo
73 73
 
74 74
 	protected function _get_table_filters() {
75 75
 		$filters = array();
76
-		EE_Registry::instance()->load_helper( 'Form_Fields' );
76
+		EE_Registry::instance()->load_helper('Form_Fields');
77 77
 		/** @type EE_Message_Resource_Manager $message_resource_manager */
78
-		$message_resource_manager = EE_Registry::instance()->load_lib( 'Message_Resource_Manager' );
78
+		$message_resource_manager = EE_Registry::instance()->load_lib('Message_Resource_Manager');
79 79
 		$contexts = $message_resource_manager->get_all_contexts();
80 80
 		//setup messengers for selects
81 81
 		$m_values = $this->get_admin_page()->get_messengers_for_list_table();
@@ -84,70 +84,70 @@  discard block
 block discarded – undo
84 84
 		//and the same for contexts
85 85
 		$i = 1;
86 86
 		$labels = $c_values = array();
87
-		foreach ( $contexts as $context => $label ) {
87
+		foreach ($contexts as $context => $label) {
88 88
 			//some message types may have the same label for a different context, so we're grouping these together so the end user
89 89
 			//doesn't get confused.
90
-			if ( isset( $labels[ $label ] ) ) {
91
-				$c_values[ $labels[ $label ] ]['id'] .= ',' . $context;
90
+			if (isset($labels[$label])) {
91
+				$c_values[$labels[$label]]['id'] .= ','.$context;
92 92
 				continue;
93 93
 			}
94
-			$c_values[ $i ]['id'] = $context;
95
-			$c_values[ $i ]['text'] = $label;
96
-			$labels[ $label ] = $i;
94
+			$c_values[$i]['id'] = $context;
95
+			$c_values[$i]['text'] = $label;
96
+			$labels[$label] = $i;
97 97
 			$i++;
98 98
 		}
99 99
 
100 100
 		$msgr_default[0] = array(
101 101
 			'id' => 'none_selected',
102
-			'text' => __( 'All Messengers', 'event_espresso' )
102
+			'text' => __('All Messengers', 'event_espresso')
103 103
 		);
104 104
 
105 105
 		$mt_default[0] = array(
106 106
 			'id' => 'none_selected',
107
-			'text' => __( 'All Message Types', 'event_espresso' )
107
+			'text' => __('All Message Types', 'event_espresso')
108 108
 		);
109 109
 
110 110
 		$c_default[0] = array(
111 111
 			'id' => 'none_selected',
112
-			'text' => __( 'All Contexts', 'event_espresso ' )
112
+			'text' => __('All Contexts', 'event_espresso ')
113 113
 		);
114 114
 
115
-		$msgr_filters = ! empty( $m_values ) ? array_merge( $msgr_default, $m_values ) : array();
116
-		$mt_filters = ! empty( $mt_values ) ? array_merge( $mt_default, $mt_values ) : array();
117
-		$c_filters = ! empty( $c_values ) ? array_merge( $c_default, $c_values ): array();
115
+		$msgr_filters = ! empty($m_values) ? array_merge($msgr_default, $m_values) : array();
116
+		$mt_filters = ! empty($mt_values) ? array_merge($mt_default, $mt_values) : array();
117
+		$c_filters = ! empty($c_values) ? array_merge($c_default, $c_values) : array();
118 118
 
119
-		if ( empty( $m_values ) ) {
119
+		if (empty($m_values)) {
120 120
 			$msgr_filters[0] = array(
121 121
 				'id'   => 'none_selected',
122
-				'text' => __( 'No Messengers active', 'event_espresso' )
122
+				'text' => __('No Messengers active', 'event_espresso')
123 123
 			);
124 124
 		}
125 125
 
126
-		if ( empty( $mt_values ) ) {
126
+		if (empty($mt_values)) {
127 127
 			$mt_filters[0] = array(
128 128
 				'id'   => 'none_selected',
129
-				'text' => __( 'No Message Types active', 'event_espresso' )
129
+				'text' => __('No Message Types active', 'event_espresso')
130 130
 			);
131 131
 		}
132 132
 
133
-		if ( empty( $c_values ) ) {
133
+		if (empty($c_values)) {
134 134
 			$c_filters[0] = array(
135 135
 				'id'   => 'none_selected',
136
-				'text' => __( 'No Contexts (because no message types active)', 'event_espresso' )
136
+				'text' => __('No Contexts (because no message types active)', 'event_espresso')
137 137
 			);
138 138
 		}
139 139
 
140
-		$filters[] = EEH_Form_Fields::select_input( 'ee_messenger_filter_by', $msgr_filters, isset( $this->_req_data['ee_messenger_filter_by'] ) ? sanitize_title( $this->_req_data['ee_messenger_filter_by'] ) : '' );
141
-		$filters[] = EEH_Form_Fields::select_input( 'ee_message_type_filter_by', $mt_filters, isset( $this->_req_data['ee_message_type_filter_by'] ) ? sanitize_title( $this->_req_data['ee_message_type_filter_by'] ) : '' );
142
-		$filters[] = EEH_Form_Fields::select_input( 'ee_context_filter_by', $c_filters, isset( $this->_req_data['ee_context_filter_by'] ) ? sanitize_text_field( $this->_req_data['ee_context_filter_by'] ) : '' );
140
+		$filters[] = EEH_Form_Fields::select_input('ee_messenger_filter_by', $msgr_filters, isset($this->_req_data['ee_messenger_filter_by']) ? sanitize_title($this->_req_data['ee_messenger_filter_by']) : '');
141
+		$filters[] = EEH_Form_Fields::select_input('ee_message_type_filter_by', $mt_filters, isset($this->_req_data['ee_message_type_filter_by']) ? sanitize_title($this->_req_data['ee_message_type_filter_by']) : '');
142
+		$filters[] = EEH_Form_Fields::select_input('ee_context_filter_by', $c_filters, isset($this->_req_data['ee_context_filter_by']) ? sanitize_text_field($this->_req_data['ee_context_filter_by']) : '');
143 143
 		return $filters;
144 144
 	}
145 145
 
146 146
 
147 147
 
148 148
 	protected function _add_view_counts() {
149
-		foreach ( $this->_views as $view => $args ) {
150
-			$this->_views[ $view ]['count'] = $this->_get_messages( $this->_per_page, $view, true, true );
149
+		foreach ($this->_views as $view => $args) {
150
+			$this->_views[$view]['count'] = $this->_get_messages($this->_per_page, $view, true, true);
151 151
 		}
152 152
 	}
153 153
 
@@ -157,8 +157,8 @@  discard block
 block discarded – undo
157 157
 	 *
158 158
 	 * @return string    EE_Message status.
159 159
 	 */
160
-	public function column_msg_status( EE_Message $message ) {
161
-		return '<span class="ee-status-strip ee-status-strip-td msg-status-' . $message->STS_ID() . '"></span>';
160
+	public function column_msg_status(EE_Message $message) {
161
+		return '<span class="ee-status-strip ee-status-strip-td msg-status-'.$message->STS_ID().'"></span>';
162 162
 	}
163 163
 
164 164
 
@@ -167,8 +167,8 @@  discard block
 block discarded – undo
167 167
 	 *
168 168
 	 * @return string   checkbox
169 169
 	 */
170
-	public function column_cb( $message ) {
171
-		return sprintf( '<input type="checkbox" name="MSG_ID[%s]" value="1" />', $message->ID() );
170
+	public function column_cb($message) {
171
+		return sprintf('<input type="checkbox" name="MSG_ID[%s]" value="1" />', $message->ID());
172 172
 	}
173 173
 
174 174
 
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
 	 * @param EE_Message $message
178 178
 	 * @return string
179 179
 	 */
180
-	public function column_msg_id( EE_Message $message ) {
180
+	public function column_msg_id(EE_Message $message) {
181 181
 		return $message->ID();
182 182
 	}
183 183
 
@@ -187,8 +187,8 @@  discard block
 block discarded – undo
187 187
 	 * @param EE_Message $message
188 188
 	 * @return string    The recipient of the message
189 189
 	 */
190
-	public function column_to( EE_Message $message ) {
191
-		EE_Registry::instance()->load_helper( 'URL' );
190
+	public function column_to(EE_Message $message) {
191
+		EE_Registry::instance()->load_helper('URL');
192 192
 		$actions = array();
193 193
 		$actions['delete'] = '<a href="'
194 194
 			. EEH_URL::add_query_args_and_nonce(
@@ -197,10 +197,10 @@  discard block
 block discarded – undo
197 197
 					'action' => 'delete_ee_message',
198 198
 					'MSG_ID' => $message->ID()
199 199
 				),
200
-				admin_url( 'admin.php' )
200
+				admin_url('admin.php')
201 201
 			)
202
-			. '">' . __( 'Delete', 'event_espresso' ) . '</a>';
203
-		return $message->to() . $this->row_actions( $actions );
202
+			. '">'.__('Delete', 'event_espresso').'</a>';
203
+		return $message->to().$this->row_actions($actions);
204 204
 	}
205 205
 
206 206
 
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
 	 * @param EE_Message $message
209 209
 	 * @return string   The sender of the message
210 210
 	 */
211
-	public function column_from( EE_Message $message ) {
211
+	public function column_from(EE_Message $message) {
212 212
 		return $message->from();
213 213
 	}
214 214
 
@@ -218,8 +218,8 @@  discard block
 block discarded – undo
218 218
 	 * @param EE_Message $message
219 219
 	 * @return string  The messenger used to send the message.
220 220
 	 */
221
-	public function column_messenger( EE_Message $message ) {
222
-		return ucwords( $message->messenger_label() );
221
+	public function column_messenger(EE_Message $message) {
222
+		return ucwords($message->messenger_label());
223 223
 	}
224 224
 
225 225
 
@@ -227,8 +227,8 @@  discard block
 block discarded – undo
227 227
 	 * @param EE_Message $message
228 228
 	 * @return string  The message type used to generate the message.
229 229
 	 */
230
-	public function column_message_type( EE_Message $message ) {
231
-		return ucwords( $message->message_type_label() );
230
+	public function column_message_type(EE_Message $message) {
231
+		return ucwords($message->message_type_label());
232 232
 	}
233 233
 
234 234
 
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
 	 * @param EE_Message $message
237 237
 	 * @return string  The context the message was generated for.
238 238
 	 */
239
-	public function column_context( EE_Message $message ) {
239
+	public function column_context(EE_Message $message) {
240 240
 		return $message->context_label();
241 241
 	}
242 242
 
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
 	 * @param EE_Message $message
246 246
 	 * @return string    The timestamp when this message was last modified.
247 247
 	 */
248
-	public function column_modified( EE_Message $message ) {
248
+	public function column_modified(EE_Message $message) {
249 249
 		return $message->modified();
250 250
 	}
251 251
 
@@ -254,36 +254,36 @@  discard block
 block discarded – undo
254 254
 	 * @param EE_Message $message
255 255
 	 * @return string   Actions that can be done on the current message.
256 256
 	 */
257
-	public function column_action( EE_Message $message ) {
258
-		EE_Registry::instance()->load_helper( 'MSG_Template' );
257
+	public function column_action(EE_Message $message) {
258
+		EE_Registry::instance()->load_helper('MSG_Template');
259 259
 		$action_links = array(
260
-			'view' => EEH_MSG_Template::get_message_action_link( 'view', $message ),
261
-			'error' => EEH_MSG_Template::get_message_action_link( 'error', $message ),
262
-			'generate_now' => EEH_MSG_Template::get_message_action_link( 'generate_now', $message ),
263
-			'send_now' => EEH_MSG_Template::get_message_action_link( 'send_now', $message ),
264
-			'queue_for_resending' => EEH_MSG_Template::get_message_action_link( 'queue_for_resending', $message ),
265
-			'view_transaction' => EEH_MSG_Template::get_message_action_link( 'view_transaction', $message ),
260
+			'view' => EEH_MSG_Template::get_message_action_link('view', $message),
261
+			'error' => EEH_MSG_Template::get_message_action_link('error', $message),
262
+			'generate_now' => EEH_MSG_Template::get_message_action_link('generate_now', $message),
263
+			'send_now' => EEH_MSG_Template::get_message_action_link('send_now', $message),
264
+			'queue_for_resending' => EEH_MSG_Template::get_message_action_link('queue_for_resending', $message),
265
+			'view_transaction' => EEH_MSG_Template::get_message_action_link('view_transaction', $message),
266 266
 		);
267 267
 		$content = '';
268
-		switch ( $message->STS_ID() ) {
268
+		switch ($message->STS_ID()) {
269 269
 			case EEM_Message::status_sent :
270
-				$content = $action_links['view'] . $action_links['queue_for_resending'] . $action_links['view_transaction'];
270
+				$content = $action_links['view'].$action_links['queue_for_resending'].$action_links['view_transaction'];
271 271
 				break;
272 272
 			case EEM_Message::status_resend :
273
-				$content = $action_links['view'] . $action_links['send_now'] . $action_links['view_transaction'];
273
+				$content = $action_links['view'].$action_links['send_now'].$action_links['view_transaction'];
274 274
 				break;
275 275
 			case EEM_Message::status_retry :
276
-				$content = $action_links['view'] . $action_links['send_now'] . $action_links['error'] . $action_links['view_transaction'];
276
+				$content = $action_links['view'].$action_links['send_now'].$action_links['error'].$action_links['view_transaction'];
277 277
 				break;
278 278
 			case EEM_Message::status_failed :
279 279
 			case EEM_Message::status_debug_only :
280
-				$content = $action_links['error'] . $action_links['view_transaction'];
280
+				$content = $action_links['error'].$action_links['view_transaction'];
281 281
 				break;
282 282
 			case EEM_Message::status_idle :
283
-				$content = $action_links['view'] . $action_links['send_now'] . $action_links['view_transaction'];
283
+				$content = $action_links['view'].$action_links['send_now'].$action_links['view_transaction'];
284 284
 				break;
285 285
 			case EEM_Message::status_incomplete;
286
-				$content = $action_links['generate_now'] . $action_links['view_transaction'];
286
+				$content = $action_links['generate_now'].$action_links['view_transaction'];
287 287
 				break;
288 288
 		}
289 289
 		return $content;
@@ -298,69 +298,69 @@  discard block
 block discarded – undo
298 298
 	 * @param bool       $all       Disregard any paging info (no limit on data returned).
299 299
 	 * @return int | EE_Message[]
300 300
 	 */
301
-	protected function _get_messages( $perpage = 10, $view = 'all', $count = false, $all = false ) {
301
+	protected function _get_messages($perpage = 10, $view = 'all', $count = false, $all = false) {
302 302
 
303
-		$current_page = isset( $this->_req_data['paged'] ) && ! empty( $this->_req_data['paged'] )
303
+		$current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged'])
304 304
 			? $this->_req_data['paged']
305 305
 			: 1;
306 306
 
307
-		$per_page = isset( $this->_req_data['perpage'] ) && ! empty( $this->_req_data['perpage'] )
307
+		$per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage'])
308 308
 			? $this->_req_data['perpage']
309 309
 			: $perpage;
310 310
 
311
-		$offset = ( $current_page - 1 ) * $per_page;
312
-		$limit = $all || $count ? null : array( $offset, $per_page );
311
+		$offset = ($current_page - 1) * $per_page;
312
+		$limit = $all || $count ? null : array($offset, $per_page);
313 313
 		$query_params = array(
314
-			'order_by' => empty( $this->_req_data[ 'orderby' ] ) ? 'MSG_modified' : $this->_req_data[ 'orderby' ],
315
-			'order'    => empty( $this->_req_data[ 'order' ] ) ? 'DESC' : $this->_req_data[ 'order' ],
314
+			'order_by' => empty($this->_req_data['orderby']) ? 'MSG_modified' : $this->_req_data['orderby'],
315
+			'order'    => empty($this->_req_data['order']) ? 'DESC' : $this->_req_data['order'],
316 316
 			'limit'    => $limit,
317 317
 		);
318 318
 
319 319
 		/**
320 320
 		 * Any filters coming in from other routes?
321 321
 		 */
322
-		if ( isset( $this->_req_data['filterby'] ) ) {
323
-			$query_params = array_merge( $query_params, EEM_Message::instance()->filter_by_query_params() );
324
-			if ( ! $count ) {
322
+		if (isset($this->_req_data['filterby'])) {
323
+			$query_params = array_merge($query_params, EEM_Message::instance()->filter_by_query_params());
324
+			if ( ! $count) {
325 325
 				$query_params['group_by'] = 'MSG_ID';
326 326
 			}
327 327
 		}
328 328
 
329 329
 		//view conditionals
330
-		if ( $view !== 'all' && $count && $all ) {
330
+		if ($view !== 'all' && $count && $all) {
331 331
 			$query_params[0]['AND*view_conditional'] = array(
332
-				'STS_ID' => strtoupper( $view ),
332
+				'STS_ID' => strtoupper($view),
333 333
 			);
334 334
 		}
335 335
 
336
-		if ( ! empty( $this->_req_data['status'] )  && ! $all && $this->_req_data['status'] !== 'all' ) {
336
+		if ( ! empty($this->_req_data['status']) && ! $all && $this->_req_data['status'] !== 'all') {
337 337
 			$query_params[0]['AND*view_conditional'] = array(
338
-				'STS_ID' => strtoupper( $this->_req_data['status'] ),
338
+				'STS_ID' => strtoupper($this->_req_data['status']),
339 339
 			);
340 340
 		}
341 341
 
342
-		if ( ! $all && ! empty( $this->_req_data['s'] ) ) {
343
-			$search_string = '%' . $this->_req_data['s'] . '%';
342
+		if ( ! $all && ! empty($this->_req_data['s'])) {
343
+			$search_string = '%'.$this->_req_data['s'].'%';
344 344
 			$query_params[0]['OR'] = array(
345
-				'MSG_to' => array( 'LIKE', $search_string ),
346
-				'MSG_from' => array( 'LIKE', $search_string ),
347
-				'MSG_subject' => array( 'LIKE', $search_string ),
348
-				'MSG_content' => array( 'LIKE', $search_string ),
345
+				'MSG_to' => array('LIKE', $search_string),
346
+				'MSG_from' => array('LIKE', $search_string),
347
+				'MSG_subject' => array('LIKE', $search_string),
348
+				'MSG_content' => array('LIKE', $search_string),
349 349
 			);
350 350
 		}
351 351
 
352 352
 		//account for debug only status.  We don't show Messages with the EEM_Message::status_debug_only to clients when
353 353
 		//`WP_DEBUG` is false.
354
-		if ( ! defined( 'WP_DEBUG' ) || ! WP_DEBUG ) {
354
+		if ( ! defined('WP_DEBUG') || ! WP_DEBUG) {
355 355
 			$query_params[0]['AND*debug_only_conditional'] = array(
356
-				'STS_ID' => array( '!=', EEM_Message::status_debug_only )
356
+				'STS_ID' => array('!=', EEM_Message::status_debug_only)
357 357
 			);
358 358
 		}
359 359
 
360 360
 		//account for filters
361 361
 		if (
362 362
 			! $all
363
-			&& isset( $this->_req_data['ee_messenger_filter_by'] )
363
+			&& isset($this->_req_data['ee_messenger_filter_by'])
364 364
 			&& $this->_req_data['ee_messenger_filter_by'] !== 'none_selected'
365 365
 		) {
366 366
 			$query_params[0]['AND*messenger_filter'] = array(
@@ -369,7 +369,7 @@  discard block
 block discarded – undo
369 369
 		}
370 370
 		if (
371 371
 			! $all
372
-			&& ! empty( $this->_req_data['ee_message_type_filter_by'] )
372
+			&& ! empty($this->_req_data['ee_message_type_filter_by'])
373 373
 			&& $this->_req_data['ee_message_type_filter_by'] !== 'none_selected'
374 374
 		) {
375 375
 			$query_params[0]['AND*message_type_filter'] = array(
@@ -379,17 +379,17 @@  discard block
 block discarded – undo
379 379
 
380 380
 		if (
381 381
 			! $all
382
-			&& ! empty( $this->_req_data['ee_context_filter_by'] )
382
+			&& ! empty($this->_req_data['ee_context_filter_by'])
383 383
 			&& $this->_req_data['ee_context_filter_by'] !== 'none_selected'
384 384
 		) {
385 385
 			$query_params[0]['AND*context_filter'] = array(
386
-				'MSG_context' => array( 'IN', explode( ',', $this->_req_data['ee_context_filter_by'] ) )
386
+				'MSG_context' => array('IN', explode(',', $this->_req_data['ee_context_filter_by']))
387 387
 			);
388 388
 		}
389 389
 
390 390
 		return $count
391
-			? EEM_Message::instance()->count( $query_params, null, true )
392
-			: EEM_Message::instance()->get_all( $query_params );
391
+			? EEM_Message::instance()->count($query_params, null, true)
392
+			: EEM_Message::instance()->get_all($query_params);
393 393
 
394 394
 	}
395 395
 } //end EE_Message_List_Table class
396 396
\ No newline at end of file
Please login to merge, or discard this patch.
admin_pages/messages/Messages_Template_List_Table.class.php 1 patch
Spacing   +39 added lines, -39 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
 /**
@@ -41,8 +41,8 @@  discard block
 block discarded – undo
41 41
 
42 42
 
43 43
 	protected function _setup_data() {
44
-		$this->_data = $this->get_admin_page()->get_message_templates( $this->_per_page, $this->_view, FALSE);
45
-		$this->_all_data_count = $this->get_admin_page()->get_message_templates( $this->_per_page, $this->_view, TRUE, TRUE );
44
+		$this->_data = $this->get_admin_page()->get_message_templates($this->_per_page, $this->_view, FALSE);
45
+		$this->_all_data_count = $this->get_admin_page()->get_message_templates($this->_per_page, $this->_view, TRUE, TRUE);
46 46
 	}
47 47
 
48 48
 
@@ -51,21 +51,21 @@  discard block
 block discarded – undo
51 51
 
52 52
 	protected function _set_properties() {
53 53
 		$this->_wp_list_args = array(
54
-			'singular' => __('Message Template Group', 'event_espresso' ),
55
-			'plural' => __('Message Template', 'event_espresso' ),
54
+			'singular' => __('Message Template Group', 'event_espresso'),
55
+			'plural' => __('Message Template', 'event_espresso'),
56 56
 			'ajax' => TRUE, //for now,
57 57
 			'screen' => $this->get_admin_page()->get_current_screen()->id
58 58
 			);
59 59
 		$this->_columns = array(
60 60
 			//'cb' => '<input type="checkbox" />', //no deleting default (global) templates!
61 61
 			'message_type' => __('Message Type', 'event_espresso'),
62
-			'messenger' => __( 'Messenger', 'event_espresso'),
63
-			'description' => __( 'Description', 'event_espresso' ),
62
+			'messenger' => __('Messenger', 'event_espresso'),
63
+			'description' => __('Description', 'event_espresso'),
64 64
 			//'messages_sent' => __( 'Total Sent', 'event_espresso' ) //todo this will come later when we've got message tracking in place.
65 65
 			);
66 66
 
67 67
 		$this->_sortable_columns = array(
68
-			'messenger' => array( 'MTP_messenger' => TRUE ),
68
+			'messenger' => array('MTP_messenger' => TRUE),
69 69
 			//'message_type' => array( 'MTP_message_type' => FALSE )
70 70
 			);
71 71
 
@@ -84,16 +84,16 @@  discard block
 block discarded – undo
84 84
 	 *
85 85
 	 * @return string
86 86
 	 */
87
-	public function single_row( $item ) {
87
+	public function single_row($item) {
88 88
 		$message_type = $item->message_type_obj();
89 89
 		$messenger = $item->messenger_obj();
90 90
 
91
-		if ( ! $message_type instanceof EE_message_type || ! $messenger instanceof EE_messenger ) {
91
+		if ( ! $message_type instanceof EE_message_type || ! $messenger instanceof EE_messenger) {
92 92
 			echo '';
93 93
 			return;
94 94
 		}
95 95
 
96
-		parent::single_row( $item );
96
+		parent::single_row($item);
97 97
 	}
98 98
 
99 99
 
@@ -109,33 +109,33 @@  discard block
 block discarded – undo
109 109
 
110 110
 		$msgr_default[0] = array(
111 111
 			'id' => 'none_selected',
112
-			'text' => __( 'Show All Messengers', 'event_espresso' )
112
+			'text' => __('Show All Messengers', 'event_espresso')
113 113
 			);
114 114
 
115 115
 		$mt_default[0] = array(
116 116
 			'id' => 'none_selected',
117
-			'text' => __( 'Show All Message Types', 'event_espresso' )
117
+			'text' => __('Show All Message Types', 'event_espresso')
118 118
 			);
119 119
 
120
-		$msgr_filters = ! empty( $m_values ) ? array_merge( $msgr_default, $m_values ) : array();
121
-		$mt_filters = ! empty( $mt_values ) ? array_merge( $mt_default, $mt_values ) : array();
120
+		$msgr_filters = ! empty($m_values) ? array_merge($msgr_default, $m_values) : array();
121
+		$mt_filters = ! empty($mt_values) ? array_merge($mt_default, $mt_values) : array();
122 122
 
123
-		if ( empty( $m_values ) ) {
123
+		if (empty($m_values)) {
124 124
 			$msgr_filters[0] = array(
125 125
 				'id'   => 'no_messenger_options',
126
-				'text' => __( 'No Messengers active', 'event_espresso' )
126
+				'text' => __('No Messengers active', 'event_espresso')
127 127
 			);
128 128
 		}
129 129
 
130
-		if ( empty( $mt_values ) ) {
130
+		if (empty($mt_values)) {
131 131
 			$mt_filters[0] = array(
132 132
 				'id'   => 'no_message_type_options',
133
-				'text' => __( 'No Message Types active', 'event_espresso' )
133
+				'text' => __('No Message Types active', 'event_espresso')
134 134
 			);
135 135
 		}
136 136
 
137
-		$filters[] = EEH_Form_Fields::select_input( 'ee_messenger_filter_by', $msgr_filters, isset( $this->_req_data['ee_messenger_filter_by'] ) ? sanitize_key( $this->_req_data['ee_messenger_filter_by'] ) : '' );
138
-		$filters[] = EEH_Form_Fields::select_input( 'ee_message_type_filter_by', $mt_filters, isset( $this->_req_data['ee_message_type_filter_by'] ) ? sanitize_key( $this->_req_data['ee_message_type_filter_by'] ) : '' );
137
+		$filters[] = EEH_Form_Fields::select_input('ee_messenger_filter_by', $msgr_filters, isset($this->_req_data['ee_messenger_filter_by']) ? sanitize_key($this->_req_data['ee_messenger_filter_by']) : '');
138
+		$filters[] = EEH_Form_Fields::select_input('ee_message_type_filter_by', $mt_filters, isset($this->_req_data['ee_message_type_filter_by']) ? sanitize_key($this->_req_data['ee_message_type_filter_by']) : '');
139 139
 		return $filters;
140 140
 	}
141 141
 
@@ -143,20 +143,20 @@  discard block
 block discarded – undo
143 143
 	 * we're just removing the search box for message templates, not needed.
144 144
 	 * @return string (empty);
145 145
 	 */
146
-	function search_box( $text, $input_id ) {
146
+	function search_box($text, $input_id) {
147 147
 		return '';
148 148
 	}
149 149
 
150 150
 
151 151
 	protected function _add_view_counts() {
152
-		foreach ( $this->_views as $view => $args )  {
153
-			$this->_views[$view]['count'] = $this->get_admin_page()->get_message_templates( $this->_per_page, $view, TRUE, TRUE );
152
+		foreach ($this->_views as $view => $args) {
153
+			$this->_views[$view]['count'] = $this->get_admin_page()->get_message_templates($this->_per_page, $view, TRUE, TRUE);
154 154
 		}
155 155
 	}
156 156
 
157 157
 
158 158
 
159
-	public function column_cb( $item ) {
159
+	public function column_cb($item) {
160 160
 		return '';
161 161
 	}
162 162
 
@@ -164,8 +164,8 @@  discard block
 block discarded – undo
164 164
 
165 165
 
166 166
 
167
-	function column_description( $item ) {
168
-		return '<p>' . $item->message_type_obj()->description . '</p>';
167
+	function column_description($item) {
168
+		return '<p>'.$item->message_type_obj()->description.'</p>';
169 169
 	}
170 170
 
171 171
 
@@ -180,27 +180,27 @@  discard block
 block discarded – undo
180 180
 		$actions = array();
181 181
 
182 182
 		// edit link but only if item isn't trashed.
183
-		if ( !$item->get('MTP_deleted') && EE_Registry::instance()->CAP->current_user_can( 'ee_edit_message', 'espresso_messages_edit_message_template', $item->ID() ) ) {
184
-			$edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'edit_message_template', 'id'=>$item->GRP_ID() ), EE_MSG_ADMIN_URL );
185
-			$actions['edit'] = '<a href="'.$edit_lnk_url.'" title="' . esc_attr__( 'Edit Template Group', 'event_espresso' ) . '">' . __( 'Edit', 'event_espresso' ) . '</a>';
183
+		if ( ! $item->get('MTP_deleted') && EE_Registry::instance()->CAP->current_user_can('ee_edit_message', 'espresso_messages_edit_message_template', $item->ID())) {
184
+			$edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'edit_message_template', 'id'=>$item->GRP_ID()), EE_MSG_ADMIN_URL);
185
+			$actions['edit'] = '<a href="'.$edit_lnk_url.'" title="'.esc_attr__('Edit Template Group', 'event_espresso').'">'.__('Edit', 'event_espresso').'</a>';
186 186
 		}
187 187
 
188
-		$name_link = ! $item->get('MTP_deleted') && EE_Registry::instance()->CAP->current_user_can( 'ee_edit_message', 'espresso_messages_edit_message_template', $item->ID() ) ? '<a href="'.$edit_lnk_url.'" title="' . esc_attr__( 'Edit Template Group', 'event_espresso' ) . '">' . ucwords( $item->messenger_obj()->label['singular'] ) . '</a>' : ucwords( $item->messenger_obj()->label['singular'] );
188
+		$name_link = ! $item->get('MTP_deleted') && EE_Registry::instance()->CAP->current_user_can('ee_edit_message', 'espresso_messages_edit_message_template', $item->ID()) ? '<a href="'.$edit_lnk_url.'" title="'.esc_attr__('Edit Template Group', 'event_espresso').'">'.ucwords($item->messenger_obj()->label['singular']).'</a>' : ucwords($item->messenger_obj()->label['singular']);
189 189
 
190 190
 		//we want to display the contexts in here so we need to set them up
191 191
 		$c_label = $item->context_label();
192 192
 		$c_configs = $item->contexts_config();
193 193
 		$ctxt = array();
194 194
 		$context_templates = $item->context_templates();
195
-		foreach ( $context_templates as $context => $template_fields ) {
196
-			$mtp_to = !empty( $context_templates[$context]['to'] ) && $context_templates[$context]['to'] instanceof EE_Message_Template ? $context_templates[$context]['to']->get('MTP_content') : NULL;
197
-			$inactive = empty( $mtp_to ) && !empty( $context_templates[$context]['to'] ) ? ' class="mtp-inactive"' : '';
195
+		foreach ($context_templates as $context => $template_fields) {
196
+			$mtp_to = ! empty($context_templates[$context]['to']) && $context_templates[$context]['to'] instanceof EE_Message_Template ? $context_templates[$context]['to']->get('MTP_content') : NULL;
197
+			$inactive = empty($mtp_to) && ! empty($context_templates[$context]['to']) ? ' class="mtp-inactive"' : '';
198 198
 			$context_title = ucwords($c_configs[$context]['label']);
199
-			$edit_link = EE_Admin_Page::add_query_args_and_nonce( array('action'=>'edit_message_template', 'id'=>$item->GRP_ID(), 'context' => $context), EE_MSG_ADMIN_URL );
200
-			$ctxt[] = EE_Registry::instance()->CAP->current_user_can( 'ee_edit_message', 'espresso_messages_edit_message_template', $item->ID() ) ? '<a' . $inactive . ' href="'. $edit_link . '" title="' . esc_attr__('Edit Context', 'event_espresso') . '">' . $context_title . '</a>' : $context_title;
199
+			$edit_link = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'edit_message_template', 'id'=>$item->GRP_ID(), 'context' => $context), EE_MSG_ADMIN_URL);
200
+			$ctxt[] = EE_Registry::instance()->CAP->current_user_can('ee_edit_message', 'espresso_messages_edit_message_template', $item->ID()) ? '<a'.$inactive.' href="'.$edit_link.'" title="'.esc_attr__('Edit Context', 'event_espresso').'">'.$context_title.'</a>' : $context_title;
201 201
 		}
202 202
 
203
-		$ctx_content = !$item->get('MTP_deleted') && EE_Registry::instance()->CAP->current_user_can( 'ee_edit_message', 'espresso_messages_edit_message_template', $item->ID() ) ? sprintf( __('<strong>%s:</strong> ', 'event_espresso'), ucwords($c_label['plural']) ) . implode(' | ', $ctxt) : '';
203
+		$ctx_content = ! $item->get('MTP_deleted') && EE_Registry::instance()->CAP->current_user_can('ee_edit_message', 'espresso_messages_edit_message_template', $item->ID()) ? sprintf(__('<strong>%s:</strong> ', 'event_espresso'), ucwords($c_label['plural'])).implode(' | ', $ctxt) : '';
204 204
 
205 205
 
206 206
 		//Return the name contents
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
 										/* $1%s */ $name_link,
209 209
 										/* $2%s */ $item->GRP_ID(),
210 210
 										/* %4$s */ $ctx_content,
211
-										/* $3%s */ $this->row_actions( $actions )
211
+										/* $3%s */ $this->row_actions($actions)
212 212
 		);
213 213
 	}
214 214
 
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
 	 * @return string       message_type name
219 219
 	 */
220 220
 	function column_message_type($item) {
221
-		return ucwords($item->message_type_obj()->label['singular'] );
221
+		return ucwords($item->message_type_obj()->label['singular']);
222 222
 	}
223 223
 
224 224
 
Please login to merge, or discard this patch.
admin_pages/transactions/EE_Admin_Transactions_List_Table.class.php 1 patch
Spacing   +86 added lines, -86 removed lines patch added patch discarded remove patch
@@ -33,8 +33,8 @@  discard block
 block discarded – undo
33 33
 	 * @param \EE_Admin_Page $admin_page
34 34
 	 * @return EE_Admin_Transactions_List_Table
35 35
 	 */
36
-	function __construct( EE_Admin_Page $admin_page ){
37
-   		parent::__construct( $admin_page );
36
+	function __construct(EE_Admin_Page $admin_page) {
37
+   		parent::__construct($admin_page);
38 38
    		$this->_status = $this->_admin_page->get_transaction_status_array();
39 39
 
40 40
 	}
@@ -44,9 +44,9 @@  discard block
 block discarded – undo
44 44
 
45 45
 
46 46
 	protected function _setup_data() {
47
-		$this->_data = $this->_admin_page->get_transactions( $this->_per_page );
48
-		$status = ! empty( $this->_req_data['status'] )? $this->_req_data['status'] : 'all';
49
-		$this->_all_data_count = $this->_admin_page->get_transactions( $this->_per_page, TRUE, $status );
47
+		$this->_data = $this->_admin_page->get_transactions($this->_per_page);
48
+		$status = ! empty($this->_req_data['status']) ? $this->_req_data['status'] : 'all';
49
+		$this->_all_data_count = $this->_admin_page->get_transactions($this->_per_page, TRUE, $status);
50 50
 	}
51 51
 
52 52
 
@@ -65,20 +65,20 @@  discard block
 block discarded – undo
65 65
 			);
66 66
 
67 67
 		$this->_columns = array(
68
-			'TXN_ID' => __( 'ID', 'event_espresso' ),
69
-			'TXN_timestamp'	=> __( 'Transaction Date', 'event_espresso' ),
70
-			'TXN_total' => __( 'Total', 'event_espresso' ),
71
-			'TXN_paid' => __( 'Paid', 'event_espresso' ),
72
-			'ATT_fname' => __( 'Primary Registrant', 'event_espresso' ),
73
-			'event_name' => __( 'Event', 'event_espresso' ),
74
-			'actions' => __( 'Actions', 'event_espresso' )
68
+			'TXN_ID' => __('ID', 'event_espresso'),
69
+			'TXN_timestamp'	=> __('Transaction Date', 'event_espresso'),
70
+			'TXN_total' => __('Total', 'event_espresso'),
71
+			'TXN_paid' => __('Paid', 'event_espresso'),
72
+			'ATT_fname' => __('Primary Registrant', 'event_espresso'),
73
+			'event_name' => __('Event', 'event_espresso'),
74
+			'actions' => __('Actions', 'event_espresso')
75 75
 		);
76 76
 
77 77
 		$this->_sortable_columns = array(
78
-			'TXN_ID' => array( 'TXN_ID' => FALSE ),
79
-			'event_name' => array( 'event_name'=> FALSE ),
80
-			'ATT_fname'	=> array( 'ATT_fname'=> FALSE ),
81
-			'TXN_timestamp'	=> array( 'TXN_timestamp'=> TRUE ) //true means its already sorted
78
+			'TXN_ID' => array('TXN_ID' => FALSE),
79
+			'event_name' => array('event_name'=> FALSE),
80
+			'ATT_fname'	=> array('ATT_fname'=> FALSE),
81
+			'TXN_timestamp'	=> array('TXN_timestamp'=> TRUE) //true means its already sorted
82 82
 		);
83 83
 
84 84
 		$this->_primary_column = 'TXN_ID';
@@ -88,11 +88,11 @@  discard block
 block discarded – undo
88 88
 
89 89
 
90 90
 
91
-	protected function _get_row_class( $item ) {
92
-		$class = parent::_get_row_class( $item );
91
+	protected function _get_row_class($item) {
92
+		$class = parent::_get_row_class($item);
93 93
 		//add status class
94
-		$class .= ' ee-status-strip txn-status-' . $item->status_ID();
95
-		if ( $this->_has_checkbox_column ) {
94
+		$class .= ' ee-status-strip txn-status-'.$item->status_ID();
95
+		if ($this->_has_checkbox_column) {
96 96
 			$class .= ' has-checkbox-column';
97 97
 		}
98 98
 		return $class;
@@ -109,8 +109,8 @@  discard block
 block discarded – undo
109 109
 	 */
110 110
 	protected function _get_table_filters() {
111 111
 		$filters = array();
112
-		$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' ));
113
-		$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' );
112
+		$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'));
113
+		$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');
114 114
 		ob_start();
115 115
 		?>
116 116
 		<label for="txn-filter-start-date">Display Transactions from </label>
@@ -128,9 +128,9 @@  discard block
 block discarded – undo
128 128
 
129 129
 
130 130
 	protected function _add_view_counts() {
131
-		$this->_views['all']['count'] = $this->_admin_page->get_transactions( $this->_per_page, TRUE, 'all' );
132
-		$this->_views['abandoned']['count'] = $this->_admin_page->get_transactions( $this->_per_page, TRUE, 'abandoned' );
133
-		$this->_views['failed']['count'] = $this->_admin_page->get_transactions( $this->_per_page, TRUE, 'failed' );
131
+		$this->_views['all']['count'] = $this->_admin_page->get_transactions($this->_per_page, TRUE, 'all');
132
+		$this->_views['abandoned']['count'] = $this->_admin_page->get_transactions($this->_per_page, TRUE, 'abandoned');
133
+		$this->_views['failed']['count'] = $this->_admin_page->get_transactions($this->_per_page, TRUE, 'failed');
134 134
 	}
135 135
 
136 136
 
@@ -139,29 +139,29 @@  discard block
 block discarded – undo
139 139
 	 * @param \EE_Transaction $item
140 140
 	 * @return string
141 141
 	 */
142
-   function column_TXN_ID( EE_Transaction $item ){
143
-    	$view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->ID() ), TXN_ADMIN_URL );
144
-	   $content = '<a href="' . $view_lnk_url . '" title="' . esc_attr__( 'Go to Transaction Details', 'event_espresso' ) . '">' . $item->ID() . '</a>';
142
+   function column_TXN_ID(EE_Transaction $item) {
143
+    	$view_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$item->ID()), TXN_ADMIN_URL);
144
+	   $content = '<a href="'.$view_lnk_url.'" title="'.esc_attr__('Go to Transaction Details', 'event_espresso').'">'.$item->ID().'</a>';
145 145
 
146 146
 	   //txn timestamp
147
-	   $content .= '  <span class="show-on-mobile-view-only">' . $this->_get_txn_timestamp( $item ) . '</span>';
147
+	   $content .= '  <span class="show-on-mobile-view-only">'.$this->_get_txn_timestamp($item).'</span>';
148 148
 	   return $content;
149 149
 	}
150 150
 
151 151
 
152 152
 
153
-	protected function _get_txn_timestamp( EE_Transaction $item ) {
153
+	protected function _get_txn_timestamp(EE_Transaction $item) {
154 154
 		//txn timestamp
155 155
 		// is TXN less than 2 hours old ?
156 156
 		if (
157
-			( ( time() - EE_Registry::instance()->SSN->lifespan() )
158
-			< $item->datetime( false, true )
157
+			((time() - EE_Registry::instance()->SSN->lifespan())
158
+			< $item->datetime(false, true)
159 159
 			)
160
-		&& ( $item->failed() || $item->is_abandoned() )
160
+		&& ($item->failed() || $item->is_abandoned())
161 161
 		) {
162
-			$timestamp = __( 'TXN in progress...', 'event_espresso' );
162
+			$timestamp = __('TXN in progress...', 'event_espresso');
163 163
 	   } else {
164
-			$timestamp = $item->get_i18n_datetime( 'TXN_timestamp' );
164
+			$timestamp = $item->get_i18n_datetime('TXN_timestamp');
165 165
 		}
166 166
 		return $timestamp;
167 167
 	}
@@ -173,8 +173,8 @@  discard block
 block discarded – undo
173 173
 	 * @param \EE_Transaction $item
174 174
 	 * @return string
175 175
 	 */
176
-	function column_cb($item ){
177
-		return sprintf( '<input type="checkbox" name="%1$s[]" value="%2$s" />', $this->_wp_list_args['singular'],  $item->ID());
176
+	function column_cb($item) {
177
+		return sprintf('<input type="checkbox" name="%1$s[]" value="%2$s" />', $this->_wp_list_args['singular'], $item->ID());
178 178
 	}
179 179
 
180 180
 
@@ -185,11 +185,11 @@  discard block
 block discarded – undo
185 185
 	 * @param \EE_Transaction $item
186 186
 	 * @return string
187 187
 	 */
188
-	function column_TXN_timestamp( EE_Transaction $item ){
189
-		$view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->ID() ), TXN_ADMIN_URL );
190
-		$txn_date = '<a href="'.$view_lnk_url.'" title="' . esc_attr__( 'View Transaction Details for TXN #', 'event_espresso' ) . $item->ID() . '">' . $this->_get_txn_timestamp( $item ) . '</a>';
188
+	function column_TXN_timestamp(EE_Transaction $item) {
189
+		$view_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$item->ID()), TXN_ADMIN_URL);
190
+		$txn_date = '<a href="'.$view_lnk_url.'" title="'.esc_attr__('View Transaction Details for TXN #', 'event_espresso').$item->ID().'">'.$this->_get_txn_timestamp($item).'</a>';
191 191
 		//status
192
-		$txn_date .= '<br><span class="ee-status-text-small">' . EEH_Template::pretty_status( $item->status_ID(), false, 'sentence' ) . '</span>';
192
+		$txn_date .= '<br><span class="ee-status-text-small">'.EEH_Template::pretty_status($item->status_ID(), false, 'sentence').'</span>';
193 193
 		return $txn_date;
194 194
 	}
195 195
 
@@ -199,11 +199,11 @@  discard block
 block discarded – undo
199 199
 	 * @param \EE_Transaction $item
200 200
 	 * @return string
201 201
 	 */
202
-	function column_TXN_total( EE_Transaction $item ){
203
-		if ( $item->get('TXN_total') > 0 ) {
204
-			return '<span class="txn-pad-rght">' . apply_filters( 'FHEE__EE_Admin_Transactions_List_Table__column_TXN_total__TXN_total', $item->get_pretty('TXN_total'), $item ) . '</span>';
202
+	function column_TXN_total(EE_Transaction $item) {
203
+		if ($item->get('TXN_total') > 0) {
204
+			return '<span class="txn-pad-rght">'.apply_filters('FHEE__EE_Admin_Transactions_List_Table__column_TXN_total__TXN_total', $item->get_pretty('TXN_total'), $item).'</span>';
205 205
 		} else {
206
-			return '<span class="txn-overview-free-event-spn">' . __( 'free', 'event_espresso' ) . '</span>';
206
+			return '<span class="txn-overview-free-event-spn">'.__('free', 'event_espresso').'</span>';
207 207
 		}
208 208
 	}
209 209
 
@@ -213,19 +213,19 @@  discard block
 block discarded – undo
213 213
 	 * @param \EE_Transaction $item
214 214
 	 * @return mixed|string
215 215
 	 */
216
-	function column_TXN_paid( EE_Transaction $item ){
216
+	function column_TXN_paid(EE_Transaction $item) {
217 217
 		$transaction_total = $item->get('TXN_total');
218 218
 		$transaction_paid = $item->get('TXN_paid');
219 219
 
220
-		if (( $transaction_total > 0 ) && ( $transaction_paid >= $transaction_total )) {
220
+		if (($transaction_total > 0) && ($transaction_paid >= $transaction_total)) {
221 221
 			// paid in full
222 222
 			$span_class = 'txn-overview-full-payment-spn';
223 223
 
224
-		} elseif (( $transaction_total > 0 ) && ( $transaction_paid > 0 )) {
224
+		} elseif (($transaction_total > 0) && ($transaction_paid > 0)) {
225 225
 			// monies owing
226 226
 			$span_class = 'txn-overview-part-payment-spn';
227 227
 
228
-		} elseif (( $transaction_total > 0 ) && ( $transaction_paid == 0 )) {
228
+		} elseif (($transaction_total > 0) && ($transaction_paid == 0)) {
229 229
 			// no payments made
230 230
 			$span_class = 'txn-overview-no-payment-spn';
231 231
 
@@ -235,11 +235,11 @@  discard block
 block discarded – undo
235 235
 		}
236 236
 
237 237
 		$payment_method = $item->payment_method();
238
-		$payment_method_name = $payment_method instanceof EE_Payment_Method ? $payment_method->admin_name() : __( 'Unknown', 'event_espresso' );
238
+		$payment_method_name = $payment_method instanceof EE_Payment_Method ? $payment_method->admin_name() : __('Unknown', 'event_espresso');
239 239
 
240
-		$content = '<span class="' . $span_class . ' txn-pad-rght">' . $transaction_paid !== 0 ? $item->get_pretty('TXN_paid') : $transaction_paid . '</span>';
241
-		if ( $transaction_paid > 0 ) {
242
-			$content .= '<br><span class="ee-status-text-small">' . sprintf( __( '...via %s', 'event_espresso' ), $payment_method_name ) . '</span>';
240
+		$content = '<span class="'.$span_class.' txn-pad-rght">'.$transaction_paid !== 0 ? $item->get_pretty('TXN_paid') : $transaction_paid.'</span>';
241
+		if ($transaction_paid > 0) {
242
+			$content .= '<br><span class="ee-status-text-small">'.sprintf(__('...via %s', 'event_espresso'), $payment_method_name).'</span>';
243 243
 		}
244 244
 		return $content;
245 245
 	}
@@ -250,13 +250,13 @@  discard block
 block discarded – undo
250 250
 	 * @param \EE_Transaction $item
251 251
 	 * @return string|void
252 252
 	 */
253
-	function column_ATT_fname( EE_Transaction $item ){
253
+	function column_ATT_fname(EE_Transaction $item) {
254 254
 		$primary_reg = $item->primary_registration();
255 255
 		$attendee = $primary_reg->get_first_related('Attendee');
256
-		if ( $attendee instanceof EE_Attendee ) {
257
-			$edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_registration', '_REG_ID'=>$primary_reg->ID() ), REG_ADMIN_URL );
258
-			$content = EE_Registry::instance()->CAP->current_user_can( 'ee_read_registration', 'espresso_registrations_view_registration', $primary_reg->ID() ) ? '<a href="'.$edit_lnk_url.'" title="' . esc_attr__( 'View Registration Details', 'event_espresso' ) . '">' . $attendee->full_name() . '</a>' : $attendee->full_name();
259
-			$content .= '<br>' . $attendee->email();
256
+		if ($attendee instanceof EE_Attendee) {
257
+			$edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_registration', '_REG_ID'=>$primary_reg->ID()), REG_ADMIN_URL);
258
+			$content = EE_Registry::instance()->CAP->current_user_can('ee_read_registration', 'espresso_registrations_view_registration', $primary_reg->ID()) ? '<a href="'.$edit_lnk_url.'" title="'.esc_attr__('View Registration Details', 'event_espresso').'">'.$attendee->full_name().'</a>' : $attendee->full_name();
259
+			$content .= '<br>'.$attendee->email();
260 260
 			return $content;
261 261
 		}
262 262
 		return $item->failed() || $item->is_abandoned() ? __('no contact record.', 'event_espresso') : __('No contact record, because the transaction was abandoned or the registration process failed.', 'event_espresso');
@@ -268,10 +268,10 @@  discard block
 block discarded – undo
268 268
 	 * @param \EE_Transaction $item
269 269
 	 * @return string|void
270 270
 	 */
271
-	function column_ATT_email( EE_Transaction $item ){
271
+	function column_ATT_email(EE_Transaction $item) {
272 272
 		$attendee = $item->primary_registration()->get_first_related('Attendee');
273
-		if ( !empty( $attendee ) )
274
-			return '<a href="mailto:' . $attendee->get('ATT_email') . '">' . $attendee->get('ATT_email') . '</a>';
273
+		if ( ! empty($attendee))
274
+			return '<a href="mailto:'.$attendee->get('ATT_email').'">'.$attendee->get('ATT_email').'</a>';
275 275
 		else
276 276
 			return $item->failed() || $item->is_abandoned() ? __('no contact record.', 'event_espresso') : __('No contact record, because the transaction was abandoned or the registration process failed.', 'event_espresso');
277 277
 		;
@@ -283,20 +283,20 @@  discard block
 block discarded – undo
283 283
 	 * @param \EE_Transaction $item
284 284
 	 * @return string|void
285 285
 	 */
286
-    function column_event_name( EE_Transaction $item ){
286
+    function column_event_name(EE_Transaction $item) {
287 287
     	$actions = array();
288 288
 		$event = $item->primary_registration()->get_first_related('Event');
289
-		if ( !empty( $event ) ) {
290
-			$edit_event_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'edit', 'post'=>$event->ID() ), EVENTS_ADMIN_URL );
289
+		if ( ! empty($event)) {
290
+			$edit_event_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'edit', 'post'=>$event->ID()), EVENTS_ADMIN_URL);
291 291
 			$event_name = $event->get('EVT_name');
292 292
 
293 293
 			//filter this view by transactions for this event
294
-			$txn_by_event_lnk = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'default', 'EVT_ID' => $event->ID() ) );
295
-			if ( EE_Registry::instance()->CAP->current_user_can( 'ee_edit_event', 'espresso_events_edit', $event->ID() ) ) {
296
-				$actions['filter_by_event'] = '<a href="' . $txn_by_event_lnk . '" title="' . esc_attr__('Filter transactions by this event', 'event_espresso') . '">' . __('View Transactions for this event', 'event_espresso') . '</a>';
294
+			$txn_by_event_lnk = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'default', 'EVT_ID' => $event->ID()));
295
+			if (EE_Registry::instance()->CAP->current_user_can('ee_edit_event', 'espresso_events_edit', $event->ID())) {
296
+				$actions['filter_by_event'] = '<a href="'.$txn_by_event_lnk.'" title="'.esc_attr__('Filter transactions by this event', 'event_espresso').'">'.__('View Transactions for this event', 'event_espresso').'</a>';
297 297
 			}
298 298
 
299
-			return sprintf('%1$s %2$s', EE_Registry::instance()->CAP->current_user_can( 'ee_edit_event', 'espresso_events_edit', $event->ID() ) ? '<a href="' . $edit_event_url . '" title="' . sprintf( esc_attr__( 'Edit Event: %s', 'event_espresso' ), $event->get('EVT_name') ) .'">' .  wp_trim_words( $event_name, 30, '...' ) . '</a>' : wp_trim_words( $event_name, 30, '...' ), $this->row_actions($actions) );
299
+			return sprintf('%1$s %2$s', EE_Registry::instance()->CAP->current_user_can('ee_edit_event', 'espresso_events_edit', $event->ID()) ? '<a href="'.$edit_event_url.'" title="'.sprintf(esc_attr__('Edit Event: %s', 'event_espresso'), $event->get('EVT_name')).'">'.wp_trim_words($event_name, 30, '...').'</a>' : wp_trim_words($event_name, 30, '...'), $this->row_actions($actions));
300 300
 		} else {
301 301
 			return __('The event associated with this transaction via the primary registration cannot be retrieved.', 'event_espresso');
302 302
 		}
@@ -308,35 +308,35 @@  discard block
 block discarded – undo
308 308
 	 * @param \EE_Transaction $item
309 309
 	 * @return string
310 310
 	 */
311
-    function column_actions( EE_Transaction $item ){
311
+    function column_actions(EE_Transaction $item) {
312 312
 
313 313
     	$registration = $item->primary_registration();
314 314
     	$attendee = $registration->attendee();
315 315
 
316 316
         //Build row actions
317
-		$view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->ID() ), TXN_ADMIN_URL );
317
+		$view_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$item->ID()), TXN_ADMIN_URL);
318 318
 		$dl_invoice_lnk_url = $registration->invoice_url();
319 319
 		$dl_receipt_lnk_url = $registration->receipt_url();
320
-		$view_reg_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_registration', '_REG_ID'=>$registration->ID() ), REG_ADMIN_URL );
321
-		$send_pay_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'send_payment_reminder', 'TXN_ID'=>$item->ID() ), TXN_ADMIN_URL );
322
-	    $related_messages_link = EEH_MSG_Template::get_message_action_link( 'see_notifications_for', null, array(
320
+		$view_reg_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_registration', '_REG_ID'=>$registration->ID()), REG_ADMIN_URL);
321
+		$send_pay_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'send_payment_reminder', 'TXN_ID'=>$item->ID()), TXN_ADMIN_URL);
322
+	    $related_messages_link = EEH_MSG_Template::get_message_action_link('see_notifications_for', null, array(
323 323
 		    'TXN_ID' => $item->ID()
324 324
 	    ));
325 325
 
326 326
 		//Build row actions
327 327
 		$view_lnk = '
328 328
 			<li>
329
-				<a href="'.$view_lnk_url.'" title="' . esc_attr__( 'View Transaction Details', 'event_espresso' ) . '" class="tiny-text">
329
+				<a href="'.$view_lnk_url.'" title="'.esc_attr__('View Transaction Details', 'event_espresso').'" class="tiny-text">
330 330
 					<span class="dashicons dashicons-cart"></span>
331 331
 				</a>
332 332
 			</li>';
333 333
 
334 334
 
335 335
 		//only show invoice link if message type is active.
336
-		if ( $attendee instanceof EE_Attendee && EEH_MSG_Template::is_mt_active( 'invoice' ) ) {
336
+		if ($attendee instanceof EE_Attendee && EEH_MSG_Template::is_mt_active('invoice')) {
337 337
 			$dl_invoice_lnk = '
338 338
 			<li>
339
-				<a title="' . esc_attr__( 'View Transaction Invoice', 'event_espresso' ) . '" target="_blank" href="'.$dl_invoice_lnk_url.'" class="tiny-text">
339
+				<a title="' . esc_attr__('View Transaction Invoice', 'event_espresso').'" target="_blank" href="'.$dl_invoice_lnk_url.'" class="tiny-text">
340 340
 					<span class="dashicons dashicons-media-spreadsheet ee-icon-size-18"></span>
341 341
 				</a>
342 342
 			</li>';
@@ -345,10 +345,10 @@  discard block
 block discarded – undo
345 345
 		}
346 346
 
347 347
 		//only show receipt link if message type is active.
348
-		if ( $attendee instanceof EE_Attendee && EEH_MSG_Template::is_mt_active( 'receipt' ) ) {
348
+		if ($attendee instanceof EE_Attendee && EEH_MSG_Template::is_mt_active('receipt')) {
349 349
 			$dl_receipt_lnk = '
350 350
 			<li>
351
-				<a title="' . esc_attr__( 'View Transaction Receipt', 'event_espresso' ) . '" target="_blank" href="'.$dl_receipt_lnk_url.'" class="tiny-text">
351
+				<a title="' . esc_attr__('View Transaction Receipt', 'event_espresso').'" target="_blank" href="'.$dl_receipt_lnk_url.'" class="tiny-text">
352 352
 					<span class="dashicons dashicons-media-default ee-icon-size-18"></span>
353 353
 				</a>
354 354
 			</li>';
@@ -357,10 +357,10 @@  discard block
 block discarded – undo
357 357
 		}
358 358
 
359 359
       		//only show payment reminder link if the message type is active.
360
-      		if ( EEH_MSG_Template::is_mt_active( 'payment_reminder' ) ) {
361
-		$send_pay_lnk = $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_transactions_send_payment_reminder' ) ? '
360
+      		if (EEH_MSG_Template::is_mt_active('payment_reminder')) {
361
+		$send_pay_lnk = $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_transactions_send_payment_reminder') ? '
362 362
 			<li>
363
-				<a href="'.$send_pay_lnk_url.'" title="' . esc_attr__( 'Send Payment Reminder', 'event_espresso' ) . '" class="tiny-text">
363
+				<a href="'.$send_pay_lnk_url.'" title="'.esc_attr__('Send Payment Reminder', 'event_espresso').'" class="tiny-text">
364 364
 					<span class="dashicons dashicons-email-alt"></span>
365 365
 				</a>
366 366
 			</li>' : '';
@@ -369,20 +369,20 @@  discard block
 block discarded – undo
369 369
 			$send_pay_lnk = '';
370 370
 		}
371 371
 
372
-		$view_reg_lnk = EE_Registry::instance()->CAP->current_user_can( 'ee_read_registration', 'espresso_registrations_view_registration', $registration->ID() ) ? '
372
+		$view_reg_lnk = EE_Registry::instance()->CAP->current_user_can('ee_read_registration', 'espresso_registrations_view_registration', $registration->ID()) ? '
373 373
 			<li>
374
-				<a href="'.$view_reg_lnk_url.'" title="' . esc_attr__( 'View Registration Details', 'event_espresso' ) . '" class="tiny-text">
374
+				<a href="'.$view_reg_lnk_url.'" title="'.esc_attr__('View Registration Details', 'event_espresso').'" class="tiny-text">
375 375
 					<span class="dashicons dashicons-clipboard"></span>
376 376
 				</a>
377 377
 			</li>' : '';
378 378
 
379
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_messages', 'view_filtered_messages' ) ) {
380
-			$view_related_messages_lnk = '<li>' . $related_messages_link . '</li>';
379
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_messages', 'view_filtered_messages')) {
380
+			$view_related_messages_lnk = '<li>'.$related_messages_link.'</li>';
381 381
 		} else {
382 382
 			$view_related_messages_lnk = '';
383 383
 		}
384 384
 
385
-		return $this->_action_string( $view_lnk . $dl_invoice_lnk . $dl_receipt_lnk . $view_reg_lnk . $send_pay_lnk . $view_related_messages_lnk, $item, 'ul', 'txn-overview-actions-ul' );
385
+		return $this->_action_string($view_lnk.$dl_invoice_lnk.$dl_receipt_lnk.$view_reg_lnk.$send_pay_lnk.$view_related_messages_lnk, $item, 'ul', 'txn-overview-actions-ul');
386 386
     }
387 387
 
388 388
 
Please login to merge, or discard this patch.
admin_pages/transactions/Transactions_Admin_Page.core.php 1 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
 
@@ -420,11 +420,11 @@  discard block
 block discarded – undo
420 420
 	 *	@return array
421 421
 	 */
422 422
 	protected function _transaction_legend_items() {
423
-		EE_Registry::instance()->load_helper( 'MSG_Template' );
423
+		EE_Registry::instance()->load_helper('MSG_Template');
424 424
 
425
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_messages', 'view_filtered_messages' ) ) {
426
-			$related_for_icon = EEH_MSG_Template::get_message_action_icon( 'see_notifications_for' );
427
-			if ( isset( $related_for_icon['css_class']) && isset( $related_for_icon['label'] ) ) {
425
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_messages', 'view_filtered_messages')) {
426
+			$related_for_icon = EEH_MSG_Template::get_message_action_icon('see_notifications_for');
427
+			if (isset($related_for_icon['css_class']) && isset($related_for_icon['label'])) {
428 428
 				$items['view_related_messages'] = array(
429 429
 					'class' => $related_for_icon['css_class'],
430 430
 					'desc' => $related_for_icon['label'],
@@ -434,7 +434,7 @@  discard block
 block discarded – undo
434 434
 
435 435
 		$items = apply_filters(
436 436
 			'FHEE__Transactions_Admin_Page___transaction_legend_items__items',
437
-			array_merge( $items,
437
+			array_merge($items,
438 438
 				array(
439 439
 					'view_details' => array(
440 440
 						'class' => 'dashicons dashicons-cart',
@@ -446,7 +446,7 @@  discard block
 block discarded – undo
446 446
 					),
447 447
 					'view_receipt' => array(
448 448
 						'class' => 'dashicons dashicons-media-default',
449
-						'desc' => __('View Transaction Receipt', 'event_espresso' )
449
+						'desc' => __('View Transaction Receipt', 'event_espresso')
450 450
 					),
451 451
 					'view_registration' => array(
452 452
 						'class' => 'dashicons dashicons-clipboard',
@@ -456,8 +456,8 @@  discard block
 block discarded – undo
456 456
 			)
457 457
 		);
458 458
 
459
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_transactions_send_payment_reminder' ) ) {
460
-			if ( EEH_MSG_Template::is_mt_active( 'payment_reminder' ) ) {
459
+		if (EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_transactions_send_payment_reminder')) {
460
+			if (EEH_MSG_Template::is_mt_active('payment_reminder')) {
461 461
 				$items['send_payment_reminder'] = array(
462 462
 					'class' => 'dashicons dashicons-email-alt',
463 463
 					'desc' => __('Send Payment Reminder', 'event_espresso')
@@ -478,29 +478,29 @@  discard block
 block discarded – undo
478 478
 			'FHEE__Transactions_Admin_Page___transaction_legend_items__more_items',
479 479
 			array(
480 480
 				'overpaid'   => array(
481
-					'class' => 'ee-status-legend ee-status-legend-' . EEM_Transaction::overpaid_status_code,
482
-					'desc'  => EEH_Template::pretty_status( EEM_Transaction::overpaid_status_code, FALSE, 'sentence' )
481
+					'class' => 'ee-status-legend ee-status-legend-'.EEM_Transaction::overpaid_status_code,
482
+					'desc'  => EEH_Template::pretty_status(EEM_Transaction::overpaid_status_code, FALSE, 'sentence')
483 483
 				),
484 484
 				'complete'   => array(
485
-					'class' => 'ee-status-legend ee-status-legend-' . EEM_Transaction::complete_status_code,
486
-					'desc'  => EEH_Template::pretty_status( EEM_Transaction::complete_status_code, FALSE, 'sentence' )
485
+					'class' => 'ee-status-legend ee-status-legend-'.EEM_Transaction::complete_status_code,
486
+					'desc'  => EEH_Template::pretty_status(EEM_Transaction::complete_status_code, FALSE, 'sentence')
487 487
 				),
488 488
 				'incomplete' => array(
489
-					'class' => 'ee-status-legend ee-status-legend-' . EEM_Transaction::incomplete_status_code,
490
-					'desc'  => EEH_Template::pretty_status( EEM_Transaction::incomplete_status_code, FALSE, 'sentence' )
489
+					'class' => 'ee-status-legend ee-status-legend-'.EEM_Transaction::incomplete_status_code,
490
+					'desc'  => EEH_Template::pretty_status(EEM_Transaction::incomplete_status_code, FALSE, 'sentence')
491 491
 				),
492 492
 				'abandoned'  => array(
493
-					'class' => 'ee-status-legend ee-status-legend-' . EEM_Transaction::abandoned_status_code,
494
-					'desc'  => EEH_Template::pretty_status( EEM_Transaction::abandoned_status_code, FALSE, 'sentence' )
493
+					'class' => 'ee-status-legend ee-status-legend-'.EEM_Transaction::abandoned_status_code,
494
+					'desc'  => EEH_Template::pretty_status(EEM_Transaction::abandoned_status_code, FALSE, 'sentence')
495 495
 				),
496 496
 				'failed'     => array(
497
-					'class' => 'ee-status-legend ee-status-legend-' . EEM_Transaction::failed_status_code,
498
-					'desc'  => EEH_Template::pretty_status( EEM_Transaction::failed_status_code, FALSE, 'sentence' )
497
+					'class' => 'ee-status-legend ee-status-legend-'.EEM_Transaction::failed_status_code,
498
+					'desc'  => EEH_Template::pretty_status(EEM_Transaction::failed_status_code, FALSE, 'sentence')
499 499
 				)
500 500
 			)
501 501
 		);
502 502
 
503
-		return array_merge( $items, $more_items);
503
+		return array_merge($items, $more_items);
504 504
 	}
505 505
 
506 506
 
@@ -513,9 +513,9 @@  discard block
 block discarded – undo
513 513
 	 */
514 514
 	protected function _transactions_overview_list_table() {
515 515
 		$this->_admin_page_title = __('Transactions', 'event_espresso');
516
-		$event = isset($this->_req_data['EVT_ID']) ? EEM_Event::instance()->get_one_by_ID($this->_req_data['EVT_ID'] ) : NULL;
517
-		$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>' ) : '';
518
-		$this->_template_args['after_list_table'] = $this->_display_legend( $this->_transaction_legend_items() );
516
+		$event = isset($this->_req_data['EVT_ID']) ? EEM_Event::instance()->get_one_by_ID($this->_req_data['EVT_ID']) : NULL;
517
+		$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>') : '';
518
+		$this->_template_args['after_list_table'] = $this->_display_legend($this->_transaction_legend_items());
519 519
 		$this->display_admin_list_table_page_with_no_sidebar();
520 520
 	}
521 521
 
@@ -529,7 +529,7 @@  discard block
 block discarded – undo
529 529
 	*	@return void
530 530
 	*/
531 531
 	protected function _transaction_details() {
532
-		do_action( 'AHEE__Transactions_Admin_Page__transaction_details__start', $this->_transaction );
532
+		do_action('AHEE__Transactions_Admin_Page__transaction_details__start', $this->_transaction);
533 533
 
534 534
 		$this->_set_transaction_status_array();
535 535
 
@@ -542,14 +542,14 @@  discard block
 block discarded – undo
542 542
 		$attendee = $primary_registration instanceof EE_Registration ? $primary_registration->attendee() : NULL;
543 543
 
544 544
 		$this->_template_args['txn_nmbr']['value'] = $this->_transaction->ID();
545
-		$this->_template_args['txn_nmbr']['label'] = __( 'Transaction Number', 'event_espresso' );
545
+		$this->_template_args['txn_nmbr']['label'] = __('Transaction Number', 'event_espresso');
546 546
 
547
-		$this->_template_args['txn_datetime']['value'] = $this->_transaction->get_datetime('TXN_timestamp', 'l F j, Y', 'g:i:s a' );
548
-		$this->_template_args['txn_datetime']['label'] = __( 'Date', 'event_espresso' );
547
+		$this->_template_args['txn_datetime']['value'] = $this->_transaction->get_datetime('TXN_timestamp', 'l F j, Y', 'g:i:s a');
548
+		$this->_template_args['txn_datetime']['label'] = __('Date', 'event_espresso');
549 549
 
550
-		$this->_template_args['txn_status']['value'] = self::$_txn_status[ $this->_transaction->get('STS_ID') ];
551
-		$this->_template_args['txn_status']['label'] = __( 'Transaction Status', 'event_espresso' );
552
-		$this->_template_args['txn_status']['class'] = 'status-' . $this->_transaction->get('STS_ID');
550
+		$this->_template_args['txn_status']['value'] = self::$_txn_status[$this->_transaction->get('STS_ID')];
551
+		$this->_template_args['txn_status']['label'] = __('Transaction Status', 'event_espresso');
552
+		$this->_template_args['txn_status']['class'] = 'status-'.$this->_transaction->get('STS_ID');
553 553
 
554 554
 		$this->_template_args['grand_total'] = $this->_transaction->get('TXN_total');
555 555
 		$this->_template_args['total_paid'] = $this->_transaction->get('TXN_paid');
@@ -562,7 +562,7 @@  discard block
 block discarded – undo
562 562
 			)
563 563
 		) {
564 564
 			$this->_template_args['send_payment_reminder_button'] =
565
-				EEH_MSG_Template::is_mt_active( 'payment_reminder' )
565
+				EEH_MSG_Template::is_mt_active('payment_reminder')
566 566
 				&& $this->_transaction->get('STS_ID') != EEM_Transaction::complete_status_code
567 567
 				&& $this->_transaction->get('STS_ID') != EEM_Transaction::overpaid_status_code
568 568
 					? EEH_Template::get_button_or_link(
@@ -584,40 +584,40 @@  discard block
 block discarded – undo
584 584
 		}
585 585
 
586 586
 		$amount_due = $this->_transaction->get('TXN_total') - $this->_transaction->get('TXN_paid');
587
-		$this->_template_args['amount_due'] = EEH_Template::format_currency( $amount_due, TRUE );
588
-		if ( EE_Registry::instance()->CFG->currency->sign_b4 ) {
589
-			$this->_template_args['amount_due'] = EE_Registry::instance()->CFG->currency->sign . $this->_template_args['amount_due'];
587
+		$this->_template_args['amount_due'] = EEH_Template::format_currency($amount_due, TRUE);
588
+		if (EE_Registry::instance()->CFG->currency->sign_b4) {
589
+			$this->_template_args['amount_due'] = EE_Registry::instance()->CFG->currency->sign.$this->_template_args['amount_due'];
590 590
 		} else {
591
-			$this->_template_args['amount_due'] = $this->_template_args['amount_due'] . EE_Registry::instance()->CFG->currency->sign;
591
+			$this->_template_args['amount_due'] = $this->_template_args['amount_due'].EE_Registry::instance()->CFG->currency->sign;
592 592
 		}
593
-		$this->_template_args['amount_due_class'] =  '';
593
+		$this->_template_args['amount_due_class'] = '';
594 594
 
595
-		if ( $this->_transaction->get('TXN_paid') == $this->_transaction->get('TXN_total') ) {
595
+		if ($this->_transaction->get('TXN_paid') == $this->_transaction->get('TXN_total')) {
596 596
 			// paid in full
597
-			$this->_template_args['amount_due'] =  FALSE;
598
-		} elseif ( $this->_transaction->get('TXN_paid') > $this->_transaction->get('TXN_total') ) {
597
+			$this->_template_args['amount_due'] = FALSE;
598
+		} elseif ($this->_transaction->get('TXN_paid') > $this->_transaction->get('TXN_total')) {
599 599
 			// overpaid
600
-			$this->_template_args['amount_due_class'] =  'txn-overview-no-payment-spn';
601
-		} elseif (( $this->_transaction->get('TXN_total') > 0 ) && ( $this->_transaction->get('TXN_paid') > 0 )) {
600
+			$this->_template_args['amount_due_class'] = 'txn-overview-no-payment-spn';
601
+		} elseif (($this->_transaction->get('TXN_total') > 0) && ($this->_transaction->get('TXN_paid') > 0)) {
602 602
 			// monies owing
603
-			$this->_template_args['amount_due_class'] =  'txn-overview-part-payment-spn';
604
-		} elseif (( $this->_transaction->get('TXN_total') > 0 ) && ( $this->_transaction->get('TXN_paid') == 0 )) {
603
+			$this->_template_args['amount_due_class'] = 'txn-overview-part-payment-spn';
604
+		} elseif (($this->_transaction->get('TXN_total') > 0) && ($this->_transaction->get('TXN_paid') == 0)) {
605 605
 			// no payments made yet
606
-			$this->_template_args['amount_due_class'] =  'txn-overview-no-payment-spn';
607
-		} elseif ( $this->_transaction->get('TXN_total') == 0 ) {
606
+			$this->_template_args['amount_due_class'] = 'txn-overview-no-payment-spn';
607
+		} elseif ($this->_transaction->get('TXN_total') == 0) {
608 608
 			// free event
609
-			$this->_template_args['amount_due'] =  FALSE;
609
+			$this->_template_args['amount_due'] = FALSE;
610 610
 		}
611 611
 
612 612
 		$payment_method = $this->_transaction->payment_method();
613 613
 
614 614
 		$this->_template_args['method_of_payment_name'] = $payment_method instanceof EE_Payment_Method
615 615
 			? $payment_method->admin_name()
616
-			: __( 'Unknown', 'event_espresso' );
616
+			: __('Unknown', 'event_espresso');
617 617
 
618 618
 		$this->_template_args['currency_sign'] = EE_Registry::instance()->CFG->currency->sign;
619 619
 		// link back to overview
620
-		$this->_template_args['txn_overview_url'] = ! empty ( $_SERVER['HTTP_REFERER'] )
620
+		$this->_template_args['txn_overview_url'] = ! empty ($_SERVER['HTTP_REFERER'])
621 621
 			? $_SERVER['HTTP_REFERER']
622 622
 			: TXN_ADMIN_URL;
623 623
 
@@ -625,13 +625,13 @@  discard block
 block discarded – undo
625 625
 		// next link
626 626
 		$next_txn = $this->_transaction->next(
627 627
 			null,
628
-			array( array( 'STS_ID' => array( '!=', EEM_Transaction::failed_status_code ) ) ),
628
+			array(array('STS_ID' => array('!=', EEM_Transaction::failed_status_code))),
629 629
 			'TXN_ID'
630 630
 		);
631 631
 		$this->_template_args['next_transaction'] = $next_txn
632 632
 			? $this->_next_link(
633 633
 				EE_Admin_Page::add_query_args_and_nonce(
634
-					array( 'action' => 'view_transaction', 'TXN_ID' => $next_txn['TXN_ID'] ),
634
+					array('action' => 'view_transaction', 'TXN_ID' => $next_txn['TXN_ID']),
635 635
 					TXN_ADMIN_URL
636 636
 				),
637 637
 				'dashicons dashicons-arrow-right ee-icon-size-22'
@@ -640,13 +640,13 @@  discard block
 block discarded – undo
640 640
 		// previous link
641 641
 		$previous_txn = $this->_transaction->previous(
642 642
 			null,
643
-			array( array( 'STS_ID' => array( '!=', EEM_Transaction::failed_status_code ) ) ),
643
+			array(array('STS_ID' => array('!=', EEM_Transaction::failed_status_code))),
644 644
 			'TXN_ID'
645 645
 		);
646 646
 		$this->_template_args['previous_transaction'] = $previous_txn
647 647
 			? $this->_previous_link(
648 648
 				EE_Admin_Page::add_query_args_and_nonce(
649
-					array( 'action' => 'view_transaction', 'TXN_ID' => $previous_txn['TXN_ID'] ),
649
+					array('action' => 'view_transaction', 'TXN_ID' => $previous_txn['TXN_ID']),
650 650
 					TXN_ADMIN_URL
651 651
 				),
652 652
 				'dashicons dashicons-arrow-left ee-icon-size-22'
@@ -656,16 +656,16 @@  discard block
 block discarded – undo
656 656
 		// were we just redirected here after adding a new registration ???
657 657
 		if (
658 658
 			isset(
659
-				$this->_req_data[ 'redirect_from' ],
660
-				$this->_req_data[ 'EVT_ID' ],
661
-				$this->_req_data[ 'event_name' ]
659
+				$this->_req_data['redirect_from'],
660
+				$this->_req_data['EVT_ID'],
661
+				$this->_req_data['event_name']
662 662
 			)
663 663
 		) {
664 664
 			if (
665 665
 				EE_Registry::instance()->CAP->current_user_can(
666 666
 					'ee_edit_registrations',
667 667
 					'espresso_registrations_new_registration',
668
-					$this->_req_data[ 'EVT_ID' ]
668
+					$this->_req_data['EVT_ID']
669 669
 				)
670 670
 			) {
671 671
 				$this->_admin_page_title .= '<a id="add-new-registration" class="add-new-h2 button-primary" href="';
@@ -675,7 +675,7 @@  discard block
 block discarded – undo
675 675
 						'action'   => 'new_registration',
676 676
 						'return'   => 'default',
677 677
 						'TXN_ID'   => $this->_transaction->ID(),
678
-						'event_id' => $this->_req_data[ 'EVT_ID' ],
678
+						'event_id' => $this->_req_data['EVT_ID'],
679 679
 					),
680 680
 					REG_ADMIN_URL
681 681
 				);
@@ -683,17 +683,17 @@  discard block
 block discarded – undo
683 683
 
684 684
 				$this->_admin_page_title .= sprintf(
685 685
 					__('Add Another New Registration to Event: "%1$s" ?'),
686
-					htmlentities( urldecode( $this->_req_data[ 'event_name' ] ), ENT_QUOTES, 'UTF-8' )
686
+					htmlentities(urldecode($this->_req_data['event_name']), ENT_QUOTES, 'UTF-8')
687 687
 				);
688 688
 				$this->_admin_page_title .= '</a>';
689 689
 			}
690
-			EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ );
690
+			EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__);
691 691
 		}
692 692
 		// grab messages at the last second
693 693
 		$this->_template_args['notices'] = EE_Error::get_notices();
694 694
 		// path to template
695
-		$template_path = TXN_TEMPLATE_PATH . 'txn_admin_details_header.template.php';
696
-		$this->_template_args['admin_page_header'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
695
+		$template_path = TXN_TEMPLATE_PATH.'txn_admin_details_header.template.php';
696
+		$this->_template_args['admin_page_header'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE);
697 697
 
698 698
 		// the details template wrapper
699 699
 		$this->display_admin_page_with_sidebar();
@@ -712,18 +712,18 @@  discard block
 block discarded – undo
712 712
 
713 713
 		$this->_set_transaction_object();
714 714
 
715
-		add_meta_box( 'edit-txn-details-mbox', __( 'Transaction Details', 'event_espresso' ), array( $this, 'txn_details_meta_box' ), $this->_wp_page_slug, 'normal', 'high' );
715
+		add_meta_box('edit-txn-details-mbox', __('Transaction Details', 'event_espresso'), array($this, 'txn_details_meta_box'), $this->_wp_page_slug, 'normal', 'high');
716 716
 		add_meta_box(
717 717
 			'edit-txn-attendees-mbox',
718
-			__( 'Attendees Registered in this Transaction', 'event_espresso' ),
719
-			array( $this, 'txn_attendees_meta_box' ),
718
+			__('Attendees Registered in this Transaction', 'event_espresso'),
719
+			array($this, 'txn_attendees_meta_box'),
720 720
 			$this->_wp_page_slug,
721 721
 			'normal',
722 722
 			'high',
723
-			array( 'TXN_ID' => $this->_transaction->ID() )
723
+			array('TXN_ID' => $this->_transaction->ID())
724 724
 		);
725
-		add_meta_box( 'edit-txn-registrant-mbox', __( 'Primary Contact', 'event_espresso' ), array( $this, 'txn_registrant_side_meta_box' ), $this->_wp_page_slug, 'side', 'high' );
726
-		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' );
725
+		add_meta_box('edit-txn-registrant-mbox', __('Primary Contact', 'event_espresso'), array($this, 'txn_registrant_side_meta_box'), $this->_wp_page_slug, 'side', 'high');
726
+		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');
727 727
 
728 728
 	}
729 729
 
@@ -744,15 +744,15 @@  discard block
 block discarded – undo
744 744
 
745 745
 		//get line table
746 746
 		EEH_Autoloader::register_line_item_display_autoloaders();
747
-		$Line_Item_Display = new EE_Line_Item_Display( 'admin_table', 'EE_Admin_Table_Line_Item_Display_Strategy' );
748
-		$this->_template_args['line_item_table'] = $Line_Item_Display->display_line_item( $this->_transaction->total_line_item() );
747
+		$Line_Item_Display = new EE_Line_Item_Display('admin_table', 'EE_Admin_Table_Line_Item_Display_Strategy');
748
+		$this->_template_args['line_item_table'] = $Line_Item_Display->display_line_item($this->_transaction->total_line_item());
749 749
 		$this->_template_args['REG_code'] = $this->_transaction->get_first_related('Registration')->get('REG_code');
750 750
 
751 751
 		// process taxes
752
-		$taxes = $this->_transaction->get_many_related( 'Line_Item', array( array( 'LIN_type' => EEM_Line_Item::type_tax )));
753
-		$this->_template_args['taxes'] = ! empty( $taxes ) ? $taxes : FALSE;
752
+		$taxes = $this->_transaction->get_many_related('Line_Item', array(array('LIN_type' => EEM_Line_Item::type_tax)));
753
+		$this->_template_args['taxes'] = ! empty($taxes) ? $taxes : FALSE;
754 754
 
755
-		$this->_template_args['grand_total'] = EEH_Template::format_currency($this->_transaction->get('TXN_total'), FALSE, FALSE );
755
+		$this->_template_args['grand_total'] = EEH_Template::format_currency($this->_transaction->get('TXN_total'), FALSE, FALSE);
756 756
 		$this->_template_args['grand_raw_total'] = $this->_transaction->get('TXN_total');
757 757
 		$this->_template_args['TXN_status'] = $this->_transaction->get('STS_ID');
758 758
 
@@ -760,63 +760,63 @@  discard block
 block discarded – undo
760 760
 
761 761
 		// process payment details
762 762
 		$payments = $this->_transaction->get_many_related('Payment');
763
-		if( ! empty(  $payments ) ) {
764
-			$this->_template_args[ 'payments' ] = $payments;
765
-			$this->_template_args[ 'existing_reg_payments' ] = $this->_get_registration_payment_IDs( $payments );
763
+		if ( ! empty($payments)) {
764
+			$this->_template_args['payments'] = $payments;
765
+			$this->_template_args['existing_reg_payments'] = $this->_get_registration_payment_IDs($payments);
766 766
 		} else {
767
-			$this->_template_args[ 'payments' ] = false;
768
-			$this->_template_args[ 'existing_reg_payments' ] = array();
767
+			$this->_template_args['payments'] = false;
768
+			$this->_template_args['existing_reg_payments'] = array();
769 769
 		}
770 770
 
771
-		$this->_template_args['edit_payment_url'] = add_query_arg( array( 'action' => 'edit_payment'  ), TXN_ADMIN_URL );
772
-		$this->_template_args['delete_payment_url'] = add_query_arg( array( 'action' => 'espresso_delete_payment' ), TXN_ADMIN_URL );
771
+		$this->_template_args['edit_payment_url'] = add_query_arg(array('action' => 'edit_payment'), TXN_ADMIN_URL);
772
+		$this->_template_args['delete_payment_url'] = add_query_arg(array('action' => 'espresso_delete_payment'), TXN_ADMIN_URL);
773 773
 
774
-		if ( isset( $txn_details['invoice_number'] )) {
774
+		if (isset($txn_details['invoice_number'])) {
775 775
 			$this->_template_args['txn_details']['invoice_number']['value'] = $this->_template_args['REG_code'];
776
-			$this->_template_args['txn_details']['invoice_number']['label'] = __( 'Invoice Number', 'event_espresso' );
776
+			$this->_template_args['txn_details']['invoice_number']['label'] = __('Invoice Number', 'event_espresso');
777 777
 		}
778 778
 
779 779
 		$this->_template_args['txn_details']['registration_session']['value'] = $this->_transaction->get_first_related('Registration')->get('REG_session');
780
-		$this->_template_args['txn_details']['registration_session']['label'] = __( 'Registration Session', 'event_espresso' );
780
+		$this->_template_args['txn_details']['registration_session']['label'] = __('Registration Session', 'event_espresso');
781 781
 
782
-		$this->_template_args['txn_details']['ip_address']['value'] = isset( $this->_session['ip_address'] ) ? $this->_session['ip_address'] : '';
783
-		$this->_template_args['txn_details']['ip_address']['label'] = __( 'Transaction placed from IP', 'event_espresso' );
782
+		$this->_template_args['txn_details']['ip_address']['value'] = isset($this->_session['ip_address']) ? $this->_session['ip_address'] : '';
783
+		$this->_template_args['txn_details']['ip_address']['label'] = __('Transaction placed from IP', 'event_espresso');
784 784
 
785
-		$this->_template_args['txn_details']['user_agent']['value'] = isset( $this->_session['user_agent'] ) ? $this->_session['user_agent'] : '';
786
-		$this->_template_args['txn_details']['user_agent']['label'] = __( 'Registrant User Agent', 'event_espresso' );
785
+		$this->_template_args['txn_details']['user_agent']['value'] = isset($this->_session['user_agent']) ? $this->_session['user_agent'] : '';
786
+		$this->_template_args['txn_details']['user_agent']['label'] = __('Registrant User Agent', 'event_espresso');
787 787
 
788 788
 		$reg_steps = '<ul>';
789
-		foreach ( $this->_transaction->reg_steps() as $reg_step => $reg_step_status ) {
790
-			if ( $reg_step_status === true ) {
791
-				$reg_steps .= '<li style="color:#70cc50">' . sprintf( __( '%1$s : Completed', 'event_espresso' ), ucwords( str_replace( '_', ' ', $reg_step ) ) ) . '</li>';
792
-			} else if ( is_numeric( $reg_step_status ) && $reg_step_status !== false ) {
793
-					$reg_steps .= '<li style="color:#2EA2CC">' . sprintf(
794
-							__( '%1$s : Initiated %2$s', 'event_espresso' ),
795
-							ucwords( str_replace( '_', ' ', $reg_step ) ),
796
-							gmdate( get_option( 'date_format' ) . ' ' . get_option( 'time_format' ), ( $reg_step_status + ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS ) ) )
797
-						) . '</li>';
789
+		foreach ($this->_transaction->reg_steps() as $reg_step => $reg_step_status) {
790
+			if ($reg_step_status === true) {
791
+				$reg_steps .= '<li style="color:#70cc50">'.sprintf(__('%1$s : Completed', 'event_espresso'), ucwords(str_replace('_', ' ', $reg_step))).'</li>';
792
+			} else if (is_numeric($reg_step_status) && $reg_step_status !== false) {
793
+					$reg_steps .= '<li style="color:#2EA2CC">'.sprintf(
794
+							__('%1$s : Initiated %2$s', 'event_espresso'),
795
+							ucwords(str_replace('_', ' ', $reg_step)),
796
+							gmdate(get_option('date_format').' '.get_option('time_format'), ($reg_step_status + (get_option('gmt_offset') * HOUR_IN_SECONDS)))
797
+						).'</li>';
798 798
 				} else {
799
-				$reg_steps .= '<li style="color:#E76700">' . sprintf( __( '%1$s : Never Initiated', 'event_espresso' ), ucwords( str_replace( '_', ' ', $reg_step ) ) ) . '</li>';
799
+				$reg_steps .= '<li style="color:#E76700">'.sprintf(__('%1$s : Never Initiated', 'event_espresso'), ucwords(str_replace('_', ' ', $reg_step))).'</li>';
800 800
 			}
801 801
 		}
802 802
 		$reg_steps .= '</ul>';
803 803
 		$this->_template_args['txn_details']['reg_steps']['value'] = $reg_steps;
804
-		$this->_template_args['txn_details']['reg_steps']['label'] = __( 'Registration Step Progress', 'event_espresso' );
804
+		$this->_template_args['txn_details']['reg_steps']['label'] = __('Registration Step Progress', 'event_espresso');
805 805
 
806 806
 
807 807
 		$this->_get_registrations_to_apply_payment_to();
808
-		$this->_get_payment_methods( $payments );
808
+		$this->_get_payment_methods($payments);
809 809
 		$this->_get_payment_status_array();
810 810
 		$this->_get_reg_status_selection(); //sets up the template args for the reg status array for the transaction.
811 811
 
812
-		$this->_template_args['transaction_form_url'] = add_query_arg( array( 'action' => 'edit_transaction', 'process' => 'transaction'  ), TXN_ADMIN_URL );
813
-		$this->_template_args['apply_payment_form_url'] = add_query_arg( array( 'page' => 'espresso_transactions', 'action' => 'espresso_apply_payment' ), WP_AJAX_URL );
814
-		$this->_template_args['delete_payment_form_url'] = add_query_arg( array( 'page' => 'espresso_transactions', 'action' => 'espresso_delete_payment' ), WP_AJAX_URL );
812
+		$this->_template_args['transaction_form_url'] = add_query_arg(array('action' => 'edit_transaction', 'process' => 'transaction'), TXN_ADMIN_URL);
813
+		$this->_template_args['apply_payment_form_url'] = add_query_arg(array('page' => 'espresso_transactions', 'action' => 'espresso_apply_payment'), WP_AJAX_URL);
814
+		$this->_template_args['delete_payment_form_url'] = add_query_arg(array('page' => 'espresso_transactions', 'action' => 'espresso_delete_payment'), WP_AJAX_URL);
815 815
 
816 816
 		// 'espresso_delete_payment_nonce'
817 817
 
818
-		$template_path = TXN_TEMPLATE_PATH . 'txn_admin_details_main_meta_box_txn_details.template.php';
819
-		echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
818
+		$template_path = TXN_TEMPLATE_PATH.'txn_admin_details_main_meta_box_txn_details.template.php';
819
+		echo EEH_Template::display_template($template_path, $this->_template_args, TRUE);
820 820
 
821 821
 	}
822 822
 
@@ -831,27 +831,27 @@  discard block
 block discarded – undo
831 831
 	 * @param EE_Payment[] $payments
832 832
 	 * @return array
833 833
 	 */
834
-	protected function _get_registration_payment_IDs( $payments = array() ) {
834
+	protected function _get_registration_payment_IDs($payments = array()) {
835 835
 		$existing_reg_payments = array();
836 836
 		// get all reg payments for these payments
837
-		$reg_payments = EEM_Registration_Payment::instance()->get_all( array(
837
+		$reg_payments = EEM_Registration_Payment::instance()->get_all(array(
838 838
 			array(
839 839
 				'PAY_ID' => array(
840 840
 					'IN',
841
-					array_keys( $payments )
841
+					array_keys($payments)
842 842
 				)
843 843
 			)
844
-		) );
845
-		if ( ! empty( $reg_payments ) ) {
846
-			foreach ( $payments as $payment ) {
847
-				if ( ! $payment instanceof EE_Payment ) {
844
+		));
845
+		if ( ! empty($reg_payments)) {
846
+			foreach ($payments as $payment) {
847
+				if ( ! $payment instanceof EE_Payment) {
848 848
 					continue;
849
-				} else if ( ! isset( $existing_reg_payments[ $payment->ID() ] ) ) {
850
-					$existing_reg_payments[ $payment->ID() ] = array();
849
+				} else if ( ! isset($existing_reg_payments[$payment->ID()])) {
850
+					$existing_reg_payments[$payment->ID()] = array();
851 851
 				}
852
-				foreach ( $reg_payments as $reg_payment ) {
853
-					if ( $reg_payment instanceof EE_Registration_Payment && $reg_payment->payment_ID() === $payment->ID() ) {
854
-						$existing_reg_payments[ $payment->ID() ][ ] = $reg_payment->registration_ID();
852
+				foreach ($reg_payments as $reg_payment) {
853
+					if ($reg_payment instanceof EE_Registration_Payment && $reg_payment->payment_ID() === $payment->ID()) {
854
+						$existing_reg_payments[$payment->ID()][] = $reg_payment->registration_ID();
855 855
 					}
856 856
 				}
857 857
 			}
@@ -888,39 +888,39 @@  discard block
 block discarded – undo
888 888
 		$registrations_to_apply_payment_to .= '<br /><div class="admin-primary-mbox-tbl-wrap">';
889 889
 		$registrations_to_apply_payment_to .= '<table class="admin-primary-mbox-tbl">';
890 890
 		$registrations_to_apply_payment_to .= '<thead><tr>';
891
-		$registrations_to_apply_payment_to .= '<td>' . __( 'ID', 'event_espresso' ) . '</td>';
892
-		$registrations_to_apply_payment_to .= '<td>' . __( 'Registrant', 'event_espresso' ) . '</td>';
893
-		$registrations_to_apply_payment_to .= '<td>' . __( 'Ticket', 'event_espresso' ) . '</td>';
894
-		$registrations_to_apply_payment_to .= '<td>' . __( 'Event', 'event_espresso' ) . '</td>';
895
-		$registrations_to_apply_payment_to .= '<td class="txn-admin-payment-paid-td jst-cntr">' . __( 'Paid', 'event_espresso' ) . '</td>';
896
-		$registrations_to_apply_payment_to .= '<td class="txn-admin-payment-owing-td jst-cntr">' . __( 'Owing', 'event_espresso' ) . '</td>';
897
-		$registrations_to_apply_payment_to .= '<td class="jst-cntr">' . __( 'Apply', 'event_espresso' ) . '</td>';
891
+		$registrations_to_apply_payment_to .= '<td>'.__('ID', 'event_espresso').'</td>';
892
+		$registrations_to_apply_payment_to .= '<td>'.__('Registrant', 'event_espresso').'</td>';
893
+		$registrations_to_apply_payment_to .= '<td>'.__('Ticket', 'event_espresso').'</td>';
894
+		$registrations_to_apply_payment_to .= '<td>'.__('Event', 'event_espresso').'</td>';
895
+		$registrations_to_apply_payment_to .= '<td class="txn-admin-payment-paid-td jst-cntr">'.__('Paid', 'event_espresso').'</td>';
896
+		$registrations_to_apply_payment_to .= '<td class="txn-admin-payment-owing-td jst-cntr">'.__('Owing', 'event_espresso').'</td>';
897
+		$registrations_to_apply_payment_to .= '<td class="jst-cntr">'.__('Apply', 'event_espresso').'</td>';
898 898
 		$registrations_to_apply_payment_to .= '</tr></thead><tbody>';
899 899
 		// get registrations for TXN
900
-		$registrations = $this->_transaction->registrations( $query_params );
901
-		foreach ( $registrations as $registration ) {
902
-			if ( $registration instanceof EE_Registration ) {
900
+		$registrations = $this->_transaction->registrations($query_params);
901
+		foreach ($registrations as $registration) {
902
+			if ($registration instanceof EE_Registration) {
903 903
 				$owing = $registration->final_price() - $registration->paid();
904
-				$taxable = $registration->ticket()->taxable() ? ' <span class="smaller-text lt-grey-text"> ' . __( '+ tax', 'event_espresso' ) . '</span>' : '';
905
-				$checked = empty( $existing_reg_payments ) || in_array( $registration->ID(), $existing_reg_payments ) ? ' checked="checked"' : '';
906
-				$registrations_to_apply_payment_to .= '<tr id="apply-payment-registration-row-' . $registration->ID() . '">';
904
+				$taxable = $registration->ticket()->taxable() ? ' <span class="smaller-text lt-grey-text"> '.__('+ tax', 'event_espresso').'</span>' : '';
905
+				$checked = empty($existing_reg_payments) || in_array($registration->ID(), $existing_reg_payments) ? ' checked="checked"' : '';
906
+				$registrations_to_apply_payment_to .= '<tr id="apply-payment-registration-row-'.$registration->ID().'">';
907 907
 				// add html for checkbox input and label
908
-				$registrations_to_apply_payment_to .= '<td>' . $registration->ID() . '</td>';
909
-				$registrations_to_apply_payment_to .= '<td>' . $registration->attendee() instanceof EE_Attendee ? $registration->attendee()->full_name() : __( 'Unknown Attendee', 'event_espresso' ) . '</td>';
910
-				$registrations_to_apply_payment_to .= '<td>' . $registration->ticket()->name() . ' : ' . $registration->ticket()->pretty_price() . $taxable . '</td>';
911
-				$registrations_to_apply_payment_to .= '<td>' . $registration->event_name() . '</td>';
912
-				$registrations_to_apply_payment_to .= '<td class="txn-admin-payment-paid-td jst-rght">' . $registration->pretty_paid() . '</td>';
913
-				$registrations_to_apply_payment_to .= '<td class="txn-admin-payment-owing-td jst-rght">' . EEH_Template::format_currency( $owing ) . '</td>';
908
+				$registrations_to_apply_payment_to .= '<td>'.$registration->ID().'</td>';
909
+				$registrations_to_apply_payment_to .= '<td>'.$registration->attendee() instanceof EE_Attendee ? $registration->attendee()->full_name() : __('Unknown Attendee', 'event_espresso').'</td>';
910
+				$registrations_to_apply_payment_to .= '<td>'.$registration->ticket()->name().' : '.$registration->ticket()->pretty_price().$taxable.'</td>';
911
+				$registrations_to_apply_payment_to .= '<td>'.$registration->event_name().'</td>';
912
+				$registrations_to_apply_payment_to .= '<td class="txn-admin-payment-paid-td jst-rght">'.$registration->pretty_paid().'</td>';
913
+				$registrations_to_apply_payment_to .= '<td class="txn-admin-payment-owing-td jst-rght">'.EEH_Template::format_currency($owing).'</td>';
914 914
 				$registrations_to_apply_payment_to .= '<td class="jst-cntr">';
915 915
 				$disabled = $registration->final_price() > 0 ? '' : ' disabled';
916
-				$registrations_to_apply_payment_to .= '<input type="checkbox" value="' . $registration->ID() . '" name="txn_admin_payment[registrations]"' . $checked . $disabled . '>';
916
+				$registrations_to_apply_payment_to .= '<input type="checkbox" value="'.$registration->ID().'" name="txn_admin_payment[registrations]"'.$checked.$disabled.'>';
917 917
 				$registrations_to_apply_payment_to .= '</td>';
918 918
 				$registrations_to_apply_payment_to .= '</tr>';
919 919
 			}
920 920
 		}
921 921
 		$registrations_to_apply_payment_to .= '</tbody></table></div>';
922
-		$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>';
923
-		$this->_template_args[ 'registrations_to_apply_payment_to' ] = $registrations_to_apply_payment_to;
922
+		$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>';
923
+		$this->_template_args['registrations_to_apply_payment_to'] = $registrations_to_apply_payment_to;
924 924
 	}
925 925
 
926 926
 
@@ -937,9 +937,9 @@  discard block
 block discarded – undo
937 937
 		$statuses = EEM_Registration::reg_status_array(array(), TRUE);
938 938
 		//let's add a "don't change" option.
939 939
 		$status_array['NAN'] = __('Leave the Same', 'event_espresso');
940
-		$status_array = array_merge( $status_array, $statuses );
941
-		$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' );
942
-		$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' );
940
+		$status_array = array_merge($status_array, $statuses);
941
+		$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');
942
+		$this->_template_args['delete_status_change_select'] = EEH_Form_Fields::select_input('delete_txn_reg_status_change[reg_status]', $status_array, 'NAN', 'delete-txn-admin-payment-reg-status-inp', 'delete-txn-reg-status-change-reg-status');
943 943
 
944 944
 	}
945 945
 
@@ -954,21 +954,21 @@  discard block
 block discarded – undo
954 954
 	 * @param EE_Payment[] to show on this page
955 955
 	 *	@return void
956 956
 	 */
957
-	private function _get_payment_methods( $payments = array() ) {
957
+	private function _get_payment_methods($payments = array()) {
958 958
 		$payment_methods_of_payments = array();
959
-		foreach( $payments as $payment ){
960
-			if( $payment instanceof EE_Payment ){
961
-				$payment_methods_of_payments[] = $payment->get( 'PMD_ID' );
959
+		foreach ($payments as $payment) {
960
+			if ($payment instanceof EE_Payment) {
961
+				$payment_methods_of_payments[] = $payment->get('PMD_ID');
962 962
 			}
963 963
 		}
964
-		if( $payment_methods_of_payments ){
965
-			$query_args = array( array( 'OR*payment_method_for_payment' => array(
966
-					'PMD_ID' => array( 'IN', $payment_methods_of_payments ),
967
-					'PMD_scope' => array( 'LIKE', '%' . EEM_Payment_Method::scope_admin . '%' ) ) ) );
968
-		}else{
969
-			$query_args = array( array( 'PMD_scope' => array( 'LIKE', '%' . EEM_Payment_Method::scope_admin . '%' ) ) );
964
+		if ($payment_methods_of_payments) {
965
+			$query_args = array(array('OR*payment_method_for_payment' => array(
966
+					'PMD_ID' => array('IN', $payment_methods_of_payments),
967
+					'PMD_scope' => array('LIKE', '%'.EEM_Payment_Method::scope_admin.'%') )));
968
+		} else {
969
+			$query_args = array(array('PMD_scope' => array('LIKE', '%'.EEM_Payment_Method::scope_admin.'%')));
970 970
 		}
971
-		$this->_template_args['payment_methods'] = EEM_Payment_Method::instance()->get_all( $query_args );
971
+		$this->_template_args['payment_methods'] = EEM_Payment_Method::instance()->get_all($query_args);
972 972
 	}
973 973
 
974 974
 
@@ -982,46 +982,46 @@  discard block
 block discarded – undo
982 982
 	 * @param array $metabox
983 983
 	 * @return void
984 984
 	 */
985
-	public function txn_attendees_meta_box( $post, $metabox = array( 'args' => array() )) {
985
+	public function txn_attendees_meta_box($post, $metabox = array('args' => array())) {
986 986
 
987
-		extract( $metabox['args'] );
987
+		extract($metabox['args']);
988 988
 		$this->_template_args['post'] = $post;
989 989
 		$this->_template_args['event_attendees'] = array();
990 990
 		// process items in cart
991
-		$line_items = $this->_transaction->get_many_related('Line_Item', array( array( 'LIN_type' => 'line-item' ) ) );
992
-		if ( ! empty( $line_items )) {
993
-			foreach ( $line_items as $item ) {
994
-				if ( $item instanceof EE_Line_Item ) {
995
-					switch( $item->OBJ_type() ) {
991
+		$line_items = $this->_transaction->get_many_related('Line_Item', array(array('LIN_type' => 'line-item')));
992
+		if ( ! empty($line_items)) {
993
+			foreach ($line_items as $item) {
994
+				if ($item instanceof EE_Line_Item) {
995
+					switch ($item->OBJ_type()) {
996 996
 
997 997
 						case 'Event' :
998 998
 							break;
999 999
 
1000 1000
 						case 'Ticket' :
1001 1001
 							$ticket = $item->ticket();
1002
-							if ( empty( $ticket )) {
1002
+							if (empty($ticket)) {
1003 1003
 								continue; //right now we're only handling tickets here.  Cause its expected that only tickets will have attendees right?
1004 1004
 							}
1005
-							$ticket_price = EEH_Template::format_currency( $item->get( 'LIN_unit_price' ));
1005
+							$ticket_price = EEH_Template::format_currency($item->get('LIN_unit_price'));
1006 1006
 							$event = $ticket->get_first_related('Registration')->get_first_related('Event');
1007
-							$event_name = $event instanceof EE_Event ? $event->get('EVT_name') . ' - ' . $item->get('LIN_name') : '';
1007
+							$event_name = $event instanceof EE_Event ? $event->get('EVT_name').' - '.$item->get('LIN_name') : '';
1008 1008
 
1009
-							$registrations = $ticket->get_many_related('Registration', array( array('TXN_ID' => $this->_transaction->ID() )));
1010
-							foreach( $registrations as $registration ) {
1011
-								$this->_template_args['event_attendees'][$registration->ID()]['att_num'] 						= $registration->get('REG_count');
1012
-								$this->_template_args['event_attendees'][$registration->ID()]['event_ticket_name'] 	= $event_name;
1013
-								$this->_template_args['event_attendees'][$registration->ID()]['ticket_price'] 				= $ticket_price;
1009
+							$registrations = $ticket->get_many_related('Registration', array(array('TXN_ID' => $this->_transaction->ID())));
1010
+							foreach ($registrations as $registration) {
1011
+								$this->_template_args['event_attendees'][$registration->ID()]['att_num'] = $registration->get('REG_count');
1012
+								$this->_template_args['event_attendees'][$registration->ID()]['event_ticket_name'] = $event_name;
1013
+								$this->_template_args['event_attendees'][$registration->ID()]['ticket_price'] = $ticket_price;
1014 1014
 								// attendee info
1015 1015
 								$attendee = $registration->get_first_related('Attendee');
1016
-								if ( $attendee instanceof EE_Attendee ) {
1016
+								if ($attendee instanceof EE_Attendee) {
1017 1017
 									$this->_template_args['event_attendees'][$registration->ID()]['att_id'] 			= $attendee->ID();
1018 1018
 									$this->_template_args['event_attendees'][$registration->ID()]['attendee'] 	= $attendee->full_name();
1019
-									$this->_template_args['event_attendees'][$registration->ID()]['email'] 			= '<a href="mailto:' . $attendee->email() . '?subject=' . $event->get('EVT_name') . __(' Event', 'event_espresso') . '">' . $attendee->email() . '</a>';
1020
-									$this->_template_args['event_attendees'][$registration->ID()]['address'] 		=  implode(',<br>', $attendee->full_address_as_array() );
1019
+									$this->_template_args['event_attendees'][$registration->ID()]['email'] = '<a href="mailto:'.$attendee->email().'?subject='.$event->get('EVT_name').__(' Event', 'event_espresso').'">'.$attendee->email().'</a>';
1020
+									$this->_template_args['event_attendees'][$registration->ID()]['address'] 		= implode(',<br>', $attendee->full_address_as_array());
1021 1021
 								} else {
1022 1022
 									$this->_template_args['event_attendees'][$registration->ID()]['att_id'] 			= '';
1023 1023
 									$this->_template_args['event_attendees'][$registration->ID()]['attendee'] 	= '';
1024
-									$this->_template_args['event_attendees'][$registration->ID()]['email'] 			= '';
1024
+									$this->_template_args['event_attendees'][$registration->ID()]['email'] = '';
1025 1025
 									$this->_template_args['event_attendees'][$registration->ID()]['address'] 		= '';
1026 1026
 								}
1027 1027
 							}
@@ -1031,12 +1031,12 @@  discard block
 block discarded – undo
1031 1031
 				}
1032 1032
 			}
1033 1033
 
1034
-			$this->_template_args['transaction_form_url'] = add_query_arg( array( 'action' => 'edit_transaction', 'process' => 'attendees'  ), TXN_ADMIN_URL );
1035
-			echo EEH_Template::display_template( TXN_TEMPLATE_PATH . 'txn_admin_details_main_meta_box_attendees.template.php', $this->_template_args, TRUE );
1034
+			$this->_template_args['transaction_form_url'] = add_query_arg(array('action' => 'edit_transaction', 'process' => 'attendees'), TXN_ADMIN_URL);
1035
+			echo EEH_Template::display_template(TXN_TEMPLATE_PATH.'txn_admin_details_main_meta_box_attendees.template.php', $this->_template_args, TRUE);
1036 1036
 
1037 1037
 		} else {
1038 1038
 			echo sprintf(
1039
-				__( '%1$sFor some reason, there are no attendees registered for this transaction. Likely the registration was abandoned in process.%2$s', 'event_espresso' ),
1039
+				__('%1$sFor some reason, there are no attendees registered for this transaction. Likely the registration was abandoned in process.%2$s', 'event_espresso'),
1040 1040
 				'<p class="important-notice">',
1041 1041
 				'</p>'
1042 1042
 			);
@@ -1055,19 +1055,19 @@  discard block
 block discarded – undo
1055 1055
 	 */
1056 1056
 	public function txn_registrant_side_meta_box() {
1057 1057
 		$primary_att = $this->_transaction->primary_registration() instanceof EE_Registration ? $this->_transaction->primary_registration()->get_first_related('Attendee') : null;
1058
-		if ( ! $primary_att instanceof EE_Attendee ) {
1058
+		if ( ! $primary_att instanceof EE_Attendee) {
1059 1059
 			$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');
1060 1060
 			$primary_att = EEM_Attendee::instance()->create_default_object();
1061 1061
 		}
1062
-		$this->_template_args['ATT_ID'] 						= $primary_att->ID();
1062
+		$this->_template_args['ATT_ID'] = $primary_att->ID();
1063 1063
 		$this->_template_args['prime_reg_fname']		= $primary_att->fname();
1064 1064
 		$this->_template_args['prime_reg_lname']		= $primary_att->lname();
1065
-		$this->_template_args['prime_reg_email'] 		= $primary_att->email();
1065
+		$this->_template_args['prime_reg_email'] = $primary_att->email();
1066 1066
 		$this->_template_args['prime_reg_phone'] 	= $primary_att->phone();
1067
-		$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 );
1067
+		$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);
1068 1068
 		// get formatted address for registrant
1069
-		$this->_template_args[ 'formatted_address' ] = EEH_Address::format( $primary_att );
1070
-		echo EEH_Template::display_template( TXN_TEMPLATE_PATH . 'txn_admin_details_side_meta_box_registrant.template.php', $this->_template_args, TRUE );
1069
+		$this->_template_args['formatted_address'] = EEH_Address::format($primary_att);
1070
+		echo EEH_Template::display_template(TXN_TEMPLATE_PATH.'txn_admin_details_side_meta_box_registrant.template.php', $this->_template_args, TRUE);
1071 1071
 	}
1072 1072
 
1073 1073
 
@@ -1083,12 +1083,12 @@  discard block
 block discarded – undo
1083 1083
 
1084 1084
 		$this->_template_args['billing_form'] = $this->_transaction->billing_info();
1085 1085
 		$this->_template_args['billing_form_url'] = add_query_arg(
1086
-			array( 'action' => 'edit_transaction', 'process' => 'billing'  ),
1086
+			array('action' => 'edit_transaction', 'process' => 'billing'),
1087 1087
 			TXN_ADMIN_URL
1088 1088
 		);
1089 1089
 
1090
-		$template_path = TXN_TEMPLATE_PATH . 'txn_admin_details_side_meta_box_billing_info.template.php';
1091
-		echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE );/**/
1090
+		$template_path = TXN_TEMPLATE_PATH.'txn_admin_details_side_meta_box_billing_info.template.php';
1091
+		echo EEH_Template::display_template($template_path, $this->_template_args, TRUE); /**/
1092 1092
 	}
1093 1093
 
1094 1094
 
@@ -1101,42 +1101,42 @@  discard block
 block discarded – undo
1101 1101
 	*	@return void
1102 1102
 	*/
1103 1103
 	public function apply_payments_or_refunds() {
1104
-		$json_response_data = array( 'return_data' => FALSE );
1104
+		$json_response_data = array('return_data' => FALSE);
1105 1105
 		$valid_data = $this->_validate_payment_request_data();
1106
-		if ( ! empty( $valid_data ) ) {
1107
-			$PAY_ID = $valid_data[ 'PAY_ID' ];
1106
+		if ( ! empty($valid_data)) {
1107
+			$PAY_ID = $valid_data['PAY_ID'];
1108 1108
 			//save  the new payment
1109
-			$payment = $this->_create_payment_from_request_data( $valid_data );
1109
+			$payment = $this->_create_payment_from_request_data($valid_data);
1110 1110
 			// get the TXN for this payment
1111 1111
 			$transaction = $payment->transaction();
1112 1112
 			// verify transaction
1113
-			if ( $transaction instanceof EE_Transaction ) {
1113
+			if ($transaction instanceof EE_Transaction) {
1114 1114
 				// calculate_total_payments_and_update_status
1115
-				$this->_process_transaction_payments( $transaction );
1116
-				$REG_IDs = $this->_get_REG_IDs_to_apply_payment_to( $payment );
1117
-				$this->_remove_existing_registration_payments( $payment, $PAY_ID );
1115
+				$this->_process_transaction_payments($transaction);
1116
+				$REG_IDs = $this->_get_REG_IDs_to_apply_payment_to($payment);
1117
+				$this->_remove_existing_registration_payments($payment, $PAY_ID);
1118 1118
 				// apply payment to registrations (if applicable)
1119
-				if ( ! empty( $REG_IDs ) ) {
1120
-					$this->_update_registration_payments( $transaction, $payment, $REG_IDs );
1119
+				if ( ! empty($REG_IDs)) {
1120
+					$this->_update_registration_payments($transaction, $payment, $REG_IDs);
1121 1121
 					$this->_maybe_send_notifications();
1122 1122
 					// now process status changes for the same registrations
1123
-					$this->_process_registration_status_change( $transaction, $REG_IDs );
1123
+					$this->_process_registration_status_change($transaction, $REG_IDs);
1124 1124
 				}
1125
-				$this->_maybe_send_notifications( $payment );
1125
+				$this->_maybe_send_notifications($payment);
1126 1126
 				//prepare to render page
1127
-				$json_response_data[ 'return_data' ] = $this->_build_payment_json_response( $payment, $REG_IDs );
1128
-				do_action( 'AHEE__Transactions_Admin_Page__apply_payments_or_refund__after_recording', $transaction, $payment );
1127
+				$json_response_data['return_data'] = $this->_build_payment_json_response($payment, $REG_IDs);
1128
+				do_action('AHEE__Transactions_Admin_Page__apply_payments_or_refund__after_recording', $transaction, $payment);
1129 1129
 			} else {
1130 1130
 				EE_Error::add_error(
1131
-					__( 'A valid Transaction for this payment could not be retrieved.', 'event_espresso' ),
1131
+					__('A valid Transaction for this payment could not be retrieved.', 'event_espresso'),
1132 1132
 					__FILE__, __FUNCTION__, __LINE__
1133 1133
 				);
1134 1134
 			}
1135 1135
 		} else {
1136
-			EE_Error::add_error( __( 'The payment form data could not be processed. Please try again.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
1136
+			EE_Error::add_error(__('The payment form data could not be processed. Please try again.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1137 1137
 		}
1138 1138
 
1139
-		$notices = EE_Error::get_notices( false, false, false );
1139
+		$notices = EE_Error::get_notices(false, false, false);
1140 1140
 		$this->_template_args = array(
1141 1141
 			'data' => $json_response_data,
1142 1142
 			'error' => $notices['errors'],
@@ -1153,30 +1153,30 @@  discard block
 block discarded – undo
1153 1153
 	 * @return array
1154 1154
 	 */
1155 1155
 	protected function _validate_payment_request_data() {
1156
-		if ( ! isset( $this->_req_data[ 'txn_admin_payment' ] ) ) {
1156
+		if ( ! isset($this->_req_data['txn_admin_payment'])) {
1157 1157
 			return false;
1158 1158
 		}
1159 1159
 		$payment_form = $this->_generate_payment_form_section();
1160 1160
 		try {
1161
-			if ( $payment_form->was_submitted() ) {
1161
+			if ($payment_form->was_submitted()) {
1162 1162
 				$payment_form->receive_form_submission();
1163
-				if ( ! $payment_form->is_valid() ) {
1163
+				if ( ! $payment_form->is_valid()) {
1164 1164
 					$submission_error_messages = array();
1165
-					foreach ( $payment_form->get_validation_errors_accumulated() as $validation_error ) {
1166
-						if ( $validation_error instanceof EE_Validation_Error ) {
1165
+					foreach ($payment_form->get_validation_errors_accumulated() as $validation_error) {
1166
+						if ($validation_error instanceof EE_Validation_Error) {
1167 1167
 							$submission_error_messages[] = sprintf(
1168
-								_x( '%s : %s', 'Form Section Name : Form Validation Error', 'event_espresso' ),
1168
+								_x('%s : %s', 'Form Section Name : Form Validation Error', 'event_espresso'),
1169 1169
 								$validation_error->get_form_section()->html_label_text(),
1170 1170
 								$validation_error->getMessage()
1171 1171
 							);
1172 1172
 						}
1173 1173
 					}
1174
-					EE_Error::add_error( join( '<br />', $submission_error_messages ), __FILE__, __FUNCTION__, __LINE__ );
1174
+					EE_Error::add_error(join('<br />', $submission_error_messages), __FILE__, __FUNCTION__, __LINE__);
1175 1175
 					return array();
1176 1176
 				}
1177 1177
 			}
1178
-		} catch ( EE_Error $e ) {
1179
-			EE_Error::add_error( $e->getMessage(), __FILE__, __FUNCTION__, __LINE__ );
1178
+		} catch (EE_Error $e) {
1179
+			EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__);
1180 1180
 			return array();
1181 1181
 		}
1182 1182
 		return $payment_form->valid_data();
@@ -1198,63 +1198,63 @@  discard block
 block discarded – undo
1198 1198
 						array(
1199 1199
 							'default' => 0,
1200 1200
 							'required' => false,
1201
-							'html_label_text' => __( 'Payment ID', 'event_espresso' ),
1202
-							'validation_strategies' => array( new EE_Int_Normalization() )
1201
+							'html_label_text' => __('Payment ID', 'event_espresso'),
1202
+							'validation_strategies' => array(new EE_Int_Normalization())
1203 1203
 						)
1204 1204
 					),
1205 1205
 					'TXN_ID' => new EE_Text_Input(
1206 1206
 						array(
1207 1207
 							'default' => 0,
1208 1208
 							'required' => true,
1209
-							'html_label_text' => __( 'Transaction ID', 'event_espresso' ),
1210
-							'validation_strategies' => array( new EE_Int_Normalization() )
1209
+							'html_label_text' => __('Transaction ID', 'event_espresso'),
1210
+							'validation_strategies' => array(new EE_Int_Normalization())
1211 1211
 						)
1212 1212
 					),
1213 1213
 					'type' => new EE_Text_Input(
1214 1214
 						array(
1215 1215
 							'default' => 1,
1216 1216
 							'required' => true,
1217
-							'html_label_text' => __( 'Payment or Refund', 'event_espresso' ),
1218
-							'validation_strategies' => array( new EE_Int_Normalization() )
1217
+							'html_label_text' => __('Payment or Refund', 'event_espresso'),
1218
+							'validation_strategies' => array(new EE_Int_Normalization())
1219 1219
 						)
1220 1220
 					),
1221 1221
 					'amount' => new EE_Text_Input(
1222 1222
 						array(
1223 1223
 							'default' => 0,
1224 1224
 							'required' => true,
1225
-							'html_label_text' => __( 'Payment amount', 'event_espresso' ),
1226
-							'validation_strategies' => array( new EE_Float_Normalization() )
1225
+							'html_label_text' => __('Payment amount', 'event_espresso'),
1226
+							'validation_strategies' => array(new EE_Float_Normalization())
1227 1227
 						)
1228 1228
 					),
1229 1229
 					'status' => new EE_Text_Input(
1230 1230
 						array(
1231 1231
 							'default' => EEM_Payment::status_id_approved,
1232 1232
 							'required' => true,
1233
-							'html_label_text' => __( 'Payment status', 'event_espresso' ),
1233
+							'html_label_text' => __('Payment status', 'event_espresso'),
1234 1234
 						)
1235 1235
 					),
1236 1236
 					'PMD_ID' => new EE_Text_Input(
1237 1237
 						array(
1238 1238
 							'default' => 2,
1239 1239
 							'required' => true,
1240
-							'html_label_text' => __( 'Payment Method', 'event_espresso' ),
1241
-							'validation_strategies' => array( new EE_Int_Normalization() )
1240
+							'html_label_text' => __('Payment Method', 'event_espresso'),
1241
+							'validation_strategies' => array(new EE_Int_Normalization())
1242 1242
 						)
1243 1243
 					),
1244 1244
 					'date' => new EE_Text_Input(
1245 1245
 						array(
1246 1246
 							'default' => time(),
1247 1247
 							'required' => true,
1248
-							'html_label_text' => __( 'Payment date', 'event_espresso' ),
1248
+							'html_label_text' => __('Payment date', 'event_espresso'),
1249 1249
 						)
1250 1250
 					),
1251 1251
 					'txn_id_chq_nmbr' => new EE_Text_Input(
1252 1252
 						array(
1253 1253
 							'default' => '',
1254 1254
 							'required' => false,
1255
-							'html_label_text' => __( 'Transaction or Cheque Number', 'event_espresso' ),
1255
+							'html_label_text' => __('Transaction or Cheque Number', 'event_espresso'),
1256 1256
                                                         'validation_strategies' => array(
1257
-                                                            new EE_Max_Length_Validation_Strategy( __('Input too long', 'event_espresso'), 100 ),
1257
+                                                            new EE_Max_Length_Validation_Strategy(__('Input too long', 'event_espresso'), 100),
1258 1258
                                                         )
1259 1259
 						)
1260 1260
 					),
@@ -1262,9 +1262,9 @@  discard block
 block discarded – undo
1262 1262
 						array(
1263 1263
 							'default' => '',
1264 1264
 							'required' => false,
1265
-							'html_label_text' => __( 'Purchase Order Number', 'event_espresso' ),
1265
+							'html_label_text' => __('Purchase Order Number', 'event_espresso'),
1266 1266
                                                         'validation_strategies' => array(
1267
-                                                            new EE_Max_Length_Validation_Strategy( __('Input too long', 'event_espresso'), 100 ),
1267
+                                                            new EE_Max_Length_Validation_Strategy(__('Input too long', 'event_espresso'), 100),
1268 1268
                                                         )
1269 1269
 						)
1270 1270
 					),
@@ -1272,9 +1272,9 @@  discard block
 block discarded – undo
1272 1272
 						array(
1273 1273
 							'default' => '',
1274 1274
 							'required' => false,
1275
-							'html_label_text' => __( 'Extra Field for Accounting', 'event_espresso' ),
1275
+							'html_label_text' => __('Extra Field for Accounting', 'event_espresso'),
1276 1276
                                                         'validation_strategies' => array(
1277
-                                                            new EE_Max_Length_Validation_Strategy( __('Input too long', 'event_espresso'), 100 ),
1277
+                                                            new EE_Max_Length_Validation_Strategy(__('Input too long', 'event_espresso'), 100),
1278 1278
                                                         )
1279 1279
 						)
1280 1280
 					),
@@ -1291,37 +1291,37 @@  discard block
 block discarded – undo
1291 1291
 	 * @param array $valid_data
1292 1292
 	 * @return EE_Payment
1293 1293
 	 */
1294
-	protected function _create_payment_from_request_data( $valid_data ) {
1295
-		$PAY_ID = $valid_data[ 'PAY_ID' ];
1294
+	protected function _create_payment_from_request_data($valid_data) {
1295
+		$PAY_ID = $valid_data['PAY_ID'];
1296 1296
 		// get payment amount
1297
-		$amount = $valid_data[ 'amount' ] ? abs( $valid_data[ 'amount' ] ) : 0;
1297
+		$amount = $valid_data['amount'] ? abs($valid_data['amount']) : 0;
1298 1298
 		// payments have a type value of 1 and refunds have a type value of -1
1299 1299
 		// so multiplying amount by type will give a positive value for payments, and negative values for refunds
1300
-		$amount = $valid_data[ 'type' ] < 0 ? $amount * -1 : $amount;
1300
+		$amount = $valid_data['type'] < 0 ? $amount * -1 : $amount;
1301 1301
 		// for some reason the date string coming in has extra spaces between the date and time.  This fixes that.
1302
-		$date = $valid_data['date'] ? preg_replace( '/\s+/', ' ', $valid_data['date'] ) : date( 'Y-m-d g:i a', current_time( 'timestamp' ) );
1302
+		$date = $valid_data['date'] ? preg_replace('/\s+/', ' ', $valid_data['date']) : date('Y-m-d g:i a', current_time('timestamp'));
1303 1303
 		$payment = EE_Payment::new_instance(
1304 1304
 			array(
1305
-				'TXN_ID' 								=> $valid_data[ 'TXN_ID' ],
1306
-				'STS_ID' 								=> $valid_data[ 'status' ],
1305
+				'TXN_ID' 								=> $valid_data['TXN_ID'],
1306
+				'STS_ID' 								=> $valid_data['status'],
1307 1307
 				'PAY_timestamp' 				=> $date,
1308 1308
 				'PAY_source'           			=> EEM_Payment_Method::scope_admin,
1309
-				'PMD_ID'               				=> $valid_data[ 'PMD_ID' ],
1309
+				'PMD_ID'               				=> $valid_data['PMD_ID'],
1310 1310
 				'PAY_amount'           			=> $amount,
1311
-				'PAY_txn_id_chq_nmbr'  	=> $valid_data[ 'txn_id_chq_nmbr' ],
1312
-				'PAY_po_number'        		=> $valid_data[ 'po_number' ],
1313
-				'PAY_extra_accntng'    		=> $valid_data[ 'accounting' ],
1311
+				'PAY_txn_id_chq_nmbr'  	=> $valid_data['txn_id_chq_nmbr'],
1312
+				'PAY_po_number'        		=> $valid_data['po_number'],
1313
+				'PAY_extra_accntng'    		=> $valid_data['accounting'],
1314 1314
 				'PAY_details'          				=> $valid_data,
1315 1315
 				'PAY_ID'               				=> $PAY_ID
1316 1316
 			),
1317 1317
 			'',
1318
-			array( 'Y-m-d', 'g:i a' )
1318
+			array('Y-m-d', 'g:i a')
1319 1319
 		);
1320 1320
 
1321
-		if ( ! $payment->save() ) {
1321
+		if ( ! $payment->save()) {
1322 1322
 			EE_Error::add_error(
1323 1323
 				sprintf(
1324
-					__( 'Payment %1$d has not been successfully saved to the database.', 'event_espresso' ),
1324
+					__('Payment %1$d has not been successfully saved to the database.', 'event_espresso'),
1325 1325
 					$payment->ID()
1326 1326
 				),
1327 1327
 				__FILE__, __FUNCTION__, __LINE__
@@ -1338,15 +1338,15 @@  discard block
 block discarded – undo
1338 1338
 	 * @param \EE_Transaction $transaction
1339 1339
 	 * @return array
1340 1340
 	 */
1341
-	protected function _process_transaction_payments( EE_Transaction $transaction ) {
1341
+	protected function _process_transaction_payments(EE_Transaction $transaction) {
1342 1342
 		/** @type EE_Transaction_Payments $transaction_payments */
1343
-		$transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' );
1343
+		$transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments');
1344 1344
 		//update the transaction with this payment
1345
-		if ( $transaction_payments->calculate_total_payments_and_update_status( $transaction ) ) {
1346
-			EE_Error::add_success( __( 'The payment has been processed successfully.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
1345
+		if ($transaction_payments->calculate_total_payments_and_update_status($transaction)) {
1346
+			EE_Error::add_success(__('The payment has been processed successfully.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1347 1347
 		} else {
1348 1348
 			EE_Error::add_error(
1349
-				__( 'The payment was processed successfully but the amount paid for the transaction was not updated.', 'event_espresso' )
1349
+				__('The payment was processed successfully but the amount paid for the transaction was not updated.', 'event_espresso')
1350 1350
 				, __FILE__, __FUNCTION__, __LINE__
1351 1351
 			);
1352 1352
 		}
@@ -1362,19 +1362,19 @@  discard block
 block discarded – undo
1362 1362
 	 * @param \EE_Payment $payment
1363 1363
 	 * @return array
1364 1364
 	 */
1365
-	protected function _get_REG_IDs_to_apply_payment_to( EE_Payment $payment ) {
1365
+	protected function _get_REG_IDs_to_apply_payment_to(EE_Payment $payment) {
1366 1366
 		$REG_IDs = array();
1367 1367
 		// grab array of IDs for specific registrations to apply changes to
1368
-		if ( isset( $this->_req_data[ 'txn_admin_payment' ][ 'registrations' ] ) ) {
1369
-			$REG_IDs = (array)$this->_req_data[ 'txn_admin_payment' ][ 'registrations' ];
1368
+		if (isset($this->_req_data['txn_admin_payment']['registrations'])) {
1369
+			$REG_IDs = (array) $this->_req_data['txn_admin_payment']['registrations'];
1370 1370
 		}
1371 1371
 		//nothing specified ? then get all reg IDs
1372
-		if ( empty( $REG_IDs ) ) {
1372
+		if (empty($REG_IDs)) {
1373 1373
 			$registrations = $payment->transaction()->registrations();
1374
-			$REG_IDs = ! empty( $registrations ) ? array_keys( $registrations ) : $this->_get_existing_reg_payment_REG_IDs( $payment );
1374
+			$REG_IDs = ! empty($registrations) ? array_keys($registrations) : $this->_get_existing_reg_payment_REG_IDs($payment);
1375 1375
 		}
1376 1376
 		// ensure that REG_IDs are integers and NOT strings
1377
-		return array_map( 'intval', $REG_IDs );
1377
+		return array_map('intval', $REG_IDs);
1378 1378
 	}
1379 1379
 
1380 1380
 
@@ -1391,7 +1391,7 @@  discard block
 block discarded – undo
1391 1391
 	/**
1392 1392
 	 * @param array $existing_reg_payment_REG_IDs
1393 1393
 	 */
1394
-	public function set_existing_reg_payment_REG_IDs( $existing_reg_payment_REG_IDs = null ) {
1394
+	public function set_existing_reg_payment_REG_IDs($existing_reg_payment_REG_IDs = null) {
1395 1395
 		$this->_existing_reg_payment_REG_IDs = $existing_reg_payment_REG_IDs;
1396 1396
 	}
1397 1397
 
@@ -1406,13 +1406,13 @@  discard block
 block discarded – undo
1406 1406
 	 * @param \EE_Payment $payment
1407 1407
 	 * @return array
1408 1408
 	 */
1409
-	protected function _get_existing_reg_payment_REG_IDs( EE_Payment $payment ) {
1410
-		if ( $this->existing_reg_payment_REG_IDs() === null ) {
1409
+	protected function _get_existing_reg_payment_REG_IDs(EE_Payment $payment) {
1410
+		if ($this->existing_reg_payment_REG_IDs() === null) {
1411 1411
 			// let's get any existing reg payment records for this payment
1412
-			$existing_reg_payment_REG_IDs = $payment->get_many_related( 'Registration' );
1412
+			$existing_reg_payment_REG_IDs = $payment->get_many_related('Registration');
1413 1413
 			// but we only want the REG IDs, so grab the array keys
1414
-			$existing_reg_payment_REG_IDs = ! empty( $existing_reg_payment_REG_IDs ) ? array_keys( $existing_reg_payment_REG_IDs ) : array();
1415
-			$this->set_existing_reg_payment_REG_IDs( $existing_reg_payment_REG_IDs );
1414
+			$existing_reg_payment_REG_IDs = ! empty($existing_reg_payment_REG_IDs) ? array_keys($existing_reg_payment_REG_IDs) : array();
1415
+			$this->set_existing_reg_payment_REG_IDs($existing_reg_payment_REG_IDs);
1416 1416
 		}
1417 1417
 		return $this->existing_reg_payment_REG_IDs();
1418 1418
 	}
@@ -1431,23 +1431,23 @@  discard block
 block discarded – undo
1431 1431
 	 * @param int         $PAY_ID
1432 1432
 	 * @return bool;
1433 1433
 	 */
1434
-	protected function _remove_existing_registration_payments( EE_Payment $payment, $PAY_ID = 0 ) {
1434
+	protected function _remove_existing_registration_payments(EE_Payment $payment, $PAY_ID = 0) {
1435 1435
 		// newly created payments will have nothing recorded for $PAY_ID
1436
-		if ( $PAY_ID == 0 ) {
1436
+		if ($PAY_ID == 0) {
1437 1437
 			return false;
1438 1438
 		}
1439
-		$existing_reg_payment_REG_IDs = $this->_get_existing_reg_payment_REG_IDs( $payment );
1440
-		if ( empty( $existing_reg_payment_REG_IDs )) {
1439
+		$existing_reg_payment_REG_IDs = $this->_get_existing_reg_payment_REG_IDs($payment);
1440
+		if (empty($existing_reg_payment_REG_IDs)) {
1441 1441
 			return false;
1442 1442
 		}
1443 1443
 		/** @type EE_Transaction_Payments $transaction_payments */
1444
-		$transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' );
1444
+		$transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments');
1445 1445
 		return $transaction_payments->delete_registration_payments_and_update_registrations(
1446 1446
 			$payment,
1447 1447
 			array(
1448 1448
 				array(
1449 1449
 					'PAY_ID' => $payment->ID(),
1450
-					'REG_ID' => array( 'IN', $existing_reg_payment_REG_IDs ),
1450
+					'REG_ID' => array('IN', $existing_reg_payment_REG_IDs),
1451 1451
 				)
1452 1452
 			)
1453 1453
 		);
@@ -1466,25 +1466,25 @@  discard block
 block discarded – undo
1466 1466
 	 * @param array $REG_IDs
1467 1467
 	 * @return bool
1468 1468
 	 */
1469
-	protected function _update_registration_payments( EE_Transaction $transaction, EE_Payment $payment, $REG_IDs = array() ) {
1469
+	protected function _update_registration_payments(EE_Transaction $transaction, EE_Payment $payment, $REG_IDs = array()) {
1470 1470
 		// we can pass our own custom set of registrations to EE_Payment_Processor::process_registration_payments()
1471 1471
 		// so let's do that using our set of REG_IDs from the form
1472 1472
 		$registration_query_where_params = array(
1473
-			'REG_ID' => array( 'IN', $REG_IDs )
1473
+			'REG_ID' => array('IN', $REG_IDs)
1474 1474
 		);
1475 1475
 		// but add in some conditions regarding payment,
1476 1476
 		// so that we don't apply payments to registrations that are free or have already been paid for
1477 1477
 		// but ONLY if the payment is NOT a refund ( ie: the payment amount is not negative )
1478
-		if ( ! $payment->is_a_refund() ) {
1479
-			$registration_query_where_params[ 'REG_final_price' ]  = array( '!=', 0 );
1480
-			$registration_query_where_params[ 'REG_final_price*' ]  = array( '!=', 'REG_paid', true );
1478
+		if ( ! $payment->is_a_refund()) {
1479
+			$registration_query_where_params['REG_final_price'] = array('!=', 0);
1480
+			$registration_query_where_params['REG_final_price*'] = array('!=', 'REG_paid', true);
1481 1481
 		}
1482 1482
 		//EEH_Debug_Tools::printr( $registration_query_where_params, '$registration_query_where_params', __FILE__, __LINE__ );
1483
-		$registrations = $transaction->registrations( array( $registration_query_where_params ) );
1484
-		if ( ! empty( $registrations ) ) {
1483
+		$registrations = $transaction->registrations(array($registration_query_where_params));
1484
+		if ( ! empty($registrations)) {
1485 1485
 			/** @type EE_Payment_Processor $payment_processor */
1486
-			$payment_processor = EE_Registry::instance()->load_core( 'Payment_Processor' );
1487
-			$payment_processor->process_registration_payments( $transaction, $payment, $registrations );
1486
+			$payment_processor = EE_Registry::instance()->load_core('Payment_Processor');
1487
+			$payment_processor->process_registration_payments($transaction, $payment, $registrations);
1488 1488
 		}
1489 1489
 	}
1490 1490
 
@@ -1500,22 +1500,22 @@  discard block
 block discarded – undo
1500 1500
 	 * @param array $REG_IDs
1501 1501
 	 * @return bool
1502 1502
 	 */
1503
-	protected function _process_registration_status_change( EE_Transaction $transaction, $REG_IDs = array() ) {
1503
+	protected function _process_registration_status_change(EE_Transaction $transaction, $REG_IDs = array()) {
1504 1504
 		// first if there is no change in status then we get out.
1505 1505
 		if (
1506
-			! isset( $this->_req_data['txn_reg_status_change'], $this->_req_data[ 'txn_reg_status_change' ][ 'reg_status' ] )
1506
+			! isset($this->_req_data['txn_reg_status_change'], $this->_req_data['txn_reg_status_change']['reg_status'])
1507 1507
 			|| $this->_req_data['txn_reg_status_change']['reg_status'] == 'NAN'
1508 1508
 		) {
1509 1509
 			//no error message, no change requested, just nothing to do man.
1510 1510
 			return FALSE;
1511 1511
 		}
1512 1512
 		/** @type EE_Transaction_Processor $transaction_processor */
1513
-		$transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' );
1513
+		$transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor');
1514 1514
 		// made it here dude?  Oh WOW.  K, let's take care of changing the statuses
1515 1515
 		return $transaction_processor->manually_update_registration_statuses(
1516 1516
 			$transaction,
1517
-			sanitize_text_field( $this->_req_data[ 'txn_reg_status_change' ][ 'reg_status' ] ),
1518
-			array( array( 'REG_ID' => array( 'IN', $REG_IDs ) ) )
1517
+			sanitize_text_field($this->_req_data['txn_reg_status_change']['reg_status']),
1518
+			array(array('REG_ID' => array('IN', $REG_IDs)))
1519 1519
 		);
1520 1520
 	}
1521 1521
 
@@ -1530,16 +1530,16 @@  discard block
 block discarded – undo
1530 1530
 	 * @param bool | null        $delete_txn_reg_status_change
1531 1531
 	 * @return array
1532 1532
 	 */
1533
-	protected function _build_payment_json_response( EE_Payment $payment, $REG_IDs = array(), $delete_txn_reg_status_change = null ) {
1533
+	protected function _build_payment_json_response(EE_Payment $payment, $REG_IDs = array(), $delete_txn_reg_status_change = null) {
1534 1534
 		// was the payment deleted ?
1535
-		if ( is_bool( $delete_txn_reg_status_change )) {
1535
+		if (is_bool($delete_txn_reg_status_change)) {
1536 1536
 			return array(
1537 1537
 				'PAY_ID' 				=> $payment->ID(),
1538 1538
 				'amount' 			=> $payment->amount(),
1539 1539
 				'total_paid' 			=> $payment->transaction()->paid(),
1540 1540
 				'txn_status' 			=> $payment->transaction()->status_ID(),
1541 1541
 				'pay_status' 		=> $payment->STS_ID(),
1542
-				'registrations' 	=> $this->_registration_payment_data_array( $REG_IDs ),
1542
+				'registrations' 	=> $this->_registration_payment_data_array($REG_IDs),
1543 1543
 				'delete_txn_reg_status_change' => $delete_txn_reg_status_change,
1544 1544
 			);
1545 1545
 		} else {
@@ -1551,16 +1551,16 @@  discard block
 block discarded – undo
1551 1551
 				'pay_status' 	=> $payment->STS_ID(),
1552 1552
 				'PAY_ID'           => $payment->ID(),
1553 1553
 				'STS_ID' 			=> $payment->STS_ID(),
1554
-				'status' 			=> self::$_pay_status[ $payment->STS_ID() ],
1555
-				'date' 				=> $payment->timestamp( 'Y-m-d', 'h:i a' ),
1556
-				'method' 		=> strtoupper( $payment->source() ),
1554
+				'status' 			=> self::$_pay_status[$payment->STS_ID()],
1555
+				'date' 				=> $payment->timestamp('Y-m-d', 'h:i a'),
1556
+				'method' 		=> strtoupper($payment->source()),
1557 1557
 				'PM_ID' 			=> $payment->payment_method() ? $payment->payment_method()->ID() : 1,
1558
-				'gateway' 		=> $payment->payment_method() ? $payment->payment_method()->admin_name() : __( "Unknown", 'event_espresso' ),
1558
+				'gateway' 		=> $payment->payment_method() ? $payment->payment_method()->admin_name() : __("Unknown", 'event_espresso'),
1559 1559
 				'gateway_response' 	=> $payment->gateway_response(),
1560 1560
 				'txn_id_chq_nmbr'  	=> $payment->txn_id_chq_nmbr(),
1561 1561
 				'po_number'        		=> $payment->po_number(),
1562 1562
 				'extra_accntng'    		=> $payment->extra_accntng(),
1563
-				'registrations'    			=> $this->_registration_payment_data_array( $REG_IDs ),
1563
+				'registrations'    			=> $this->_registration_payment_data_array($REG_IDs),
1564 1564
 			);
1565 1565
 		}
1566 1566
 	}
@@ -1575,39 +1575,39 @@  discard block
 block discarded – undo
1575 1575
 	*	@return void
1576 1576
 	*/
1577 1577
 	public function delete_payment() {
1578
-		$json_response_data = array( 'return_data' => FALSE );
1579
-		$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;
1580
-		if ( $PAY_ID ) {
1581
-			$delete_txn_reg_status_change = isset( $this->_req_data[ 'delete_txn_reg_status_change' ] ) ? $this->_req_data[ 'delete_txn_reg_status_change' ] : false;
1582
-			$payment = EEM_Payment::instance()->get_one_by_ID( $PAY_ID );
1583
-			if ( $payment instanceof EE_Payment ) {
1584
-				$REG_IDs = $this->_get_existing_reg_payment_REG_IDs( $payment );
1578
+		$json_response_data = array('return_data' => FALSE);
1579
+		$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;
1580
+		if ($PAY_ID) {
1581
+			$delete_txn_reg_status_change = isset($this->_req_data['delete_txn_reg_status_change']) ? $this->_req_data['delete_txn_reg_status_change'] : false;
1582
+			$payment = EEM_Payment::instance()->get_one_by_ID($PAY_ID);
1583
+			if ($payment instanceof EE_Payment) {
1584
+				$REG_IDs = $this->_get_existing_reg_payment_REG_IDs($payment);
1585 1585
 				/** @type EE_Transaction_Payments $transaction_payments */
1586
-				$transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' );
1587
-				if ( $transaction_payments->delete_payment_and_update_transaction( $payment )) {
1588
-					$json_response_data['return_data'] = $this->_build_payment_json_response( $payment, $REG_IDs, $delete_txn_reg_status_change );
1589
-					if ( $delete_txn_reg_status_change ) {
1586
+				$transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments');
1587
+				if ($transaction_payments->delete_payment_and_update_transaction($payment)) {
1588
+					$json_response_data['return_data'] = $this->_build_payment_json_response($payment, $REG_IDs, $delete_txn_reg_status_change);
1589
+					if ($delete_txn_reg_status_change) {
1590 1590
 						$this->_req_data['txn_reg_status_change'] = $delete_txn_reg_status_change;
1591 1591
 						//MAKE sure we also add the delete_txn_req_status_change to the
1592 1592
 						//$_REQUEST global because that's how messages will be looking for it.
1593 1593
 						$_REQUEST['txn_reg_status_change'] = $delete_txn_reg_status_change;
1594 1594
 						$this->_maybe_send_notifications();
1595
-						$this->_process_registration_status_change( $payment->transaction(), $REG_IDs );
1595
+						$this->_process_registration_status_change($payment->transaction(), $REG_IDs);
1596 1596
 					}
1597 1597
 				}
1598 1598
 			} else {
1599 1599
 				EE_Error::add_error(
1600
-					__( 'Valid Payment data could not be retrieved from the database.', 'event_espresso' ),
1600
+					__('Valid Payment data could not be retrieved from the database.', 'event_espresso'),
1601 1601
 					__FILE__, __FUNCTION__, __LINE__
1602 1602
 				);
1603 1603
 			}
1604 1604
 		} else {
1605 1605
 			EE_Error::add_error(
1606
-				__( 'A valid Payment ID was not received, therefore payment form data could not be loaded.', 'event_espresso' ),
1606
+				__('A valid Payment ID was not received, therefore payment form data could not be loaded.', 'event_espresso'),
1607 1607
 				__FILE__, __FUNCTION__, __LINE__
1608 1608
 			);
1609 1609
 		}
1610
-		$notices = EE_Error::get_notices( false, false, false);
1610
+		$notices = EE_Error::get_notices(false, false, false);
1611 1611
 		$this->_template_args = array(
1612 1612
 			'data' => $json_response_data,
1613 1613
 			'success' => $notices['success'],
@@ -1627,16 +1627,16 @@  discard block
 block discarded – undo
1627 1627
 	 * @param array $REG_IDs
1628 1628
 	 * @return array
1629 1629
 	 */
1630
-	protected function _registration_payment_data_array( $REG_IDs ) {
1630
+	protected function _registration_payment_data_array($REG_IDs) {
1631 1631
 		$registration_payment_data = array();
1632 1632
 		//if non empty reg_ids lets get an array of registrations and update the values for the apply_payment/refund rows.
1633
-		if ( ! empty( $REG_IDs ) ) {
1634
-			$registrations = EEM_Registration::instance()->get_all( array( array( 'REG_ID' => array( 'IN', $REG_IDs ) ) ) );
1635
-			foreach ( $registrations as $registration ) {
1636
-				if ( $registration instanceof EE_Registration ) {
1637
-					$registration_payment_data[ $registration->ID() ] = array(
1633
+		if ( ! empty($REG_IDs)) {
1634
+			$registrations = EEM_Registration::instance()->get_all(array(array('REG_ID' => array('IN', $REG_IDs))));
1635
+			foreach ($registrations as $registration) {
1636
+				if ($registration instanceof EE_Registration) {
1637
+					$registration_payment_data[$registration->ID()] = array(
1638 1638
 						'paid' => $registration->pretty_paid(),
1639
-						'owing' => EEH_Template::format_currency( $registration->final_price() - $registration->paid() ),
1639
+						'owing' => EEH_Template::format_currency($registration->final_price() - $registration->paid()),
1640 1640
 					);
1641 1641
 				}
1642 1642
 			}
@@ -1656,30 +1656,30 @@  discard block
 block discarded – undo
1656 1656
 	 * @access protected
1657 1657
 	 * @param \EE_Payment | null $payment
1658 1658
 	 */
1659
-	protected function _maybe_send_notifications( $payment = null ) {
1660
-		switch ( $payment instanceof EE_Payment ) {
1659
+	protected function _maybe_send_notifications($payment = null) {
1660
+		switch ($payment instanceof EE_Payment) {
1661 1661
 			// payment notifications
1662 1662
 			case true :
1663 1663
 				if (
1664 1664
 					isset(
1665
-						$this->_req_data[ 'txn_payments' ],
1666
-						$this->_req_data[ 'txn_payments' ][ 'send_notifications' ]
1665
+						$this->_req_data['txn_payments'],
1666
+						$this->_req_data['txn_payments']['send_notifications']
1667 1667
 					) &&
1668
-					filter_var( $this->_req_data[ 'txn_payments' ][ 'send_notifications' ], FILTER_VALIDATE_BOOLEAN )
1668
+					filter_var($this->_req_data['txn_payments']['send_notifications'], FILTER_VALIDATE_BOOLEAN)
1669 1669
 				) {
1670
-					$this->_process_payment_notification( $payment );
1670
+					$this->_process_payment_notification($payment);
1671 1671
 				}
1672 1672
 				break;
1673 1673
 			// registration notifications
1674 1674
 			case false :
1675 1675
 				if (
1676 1676
 					isset(
1677
-						$this->_req_data[ 'txn_reg_status_change' ],
1678
-						$this->_req_data[ 'txn_reg_status_change' ][ 'send_notifications' ]
1677
+						$this->_req_data['txn_reg_status_change'],
1678
+						$this->_req_data['txn_reg_status_change']['send_notifications']
1679 1679
 					) &&
1680
-					filter_var( $this->_req_data[ 'txn_reg_status_change' ][ 'send_notifications' ], FILTER_VALIDATE_BOOLEAN )
1680
+					filter_var($this->_req_data['txn_reg_status_change']['send_notifications'], FILTER_VALIDATE_BOOLEAN)
1681 1681
 				) {
1682
-					add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true' );
1682
+					add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true');
1683 1683
 				}
1684 1684
 				break;
1685 1685
 		}
@@ -1695,11 +1695,11 @@  discard block
 block discarded – undo
1695 1695
 	*	@return void
1696 1696
 	*/
1697 1697
 	protected function _send_payment_reminder() {
1698
-	    $TXN_ID = ( ! empty( $this->_req_data['TXN_ID'] )) ? absint( $this->_req_data['TXN_ID'] ) : FALSE;
1699
-		$transaction = EEM_Transaction::instance()->get_one_by_ID( $TXN_ID );
1700
-		$query_args = isset($this->_req_data['redirect_to'] ) ? array('action' => $this->_req_data['redirect_to'], 'TXN_ID' => $this->_req_data['TXN_ID'] ) : array();
1701
-		do_action( 'AHEE__Transactions_Admin_Page___send_payment_reminder__process_admin_payment_reminder', $transaction );
1702
-		$this->_redirect_after_action( FALSE, __('payment reminder', 'event_espresso'), __('sent', 'event_espresso'), $query_args, TRUE );
1698
+	    $TXN_ID = ( ! empty($this->_req_data['TXN_ID'])) ? absint($this->_req_data['TXN_ID']) : FALSE;
1699
+		$transaction = EEM_Transaction::instance()->get_one_by_ID($TXN_ID);
1700
+		$query_args = isset($this->_req_data['redirect_to']) ? array('action' => $this->_req_data['redirect_to'], 'TXN_ID' => $this->_req_data['TXN_ID']) : array();
1701
+		do_action('AHEE__Transactions_Admin_Page___send_payment_reminder__process_admin_payment_reminder', $transaction);
1702
+		$this->_redirect_after_action(FALSE, __('payment reminder', 'event_espresso'), __('sent', 'event_espresso'), $query_args, TRUE);
1703 1703
 	}
1704 1704
 
1705 1705
 
@@ -1713,36 +1713,36 @@  discard block
 block discarded – undo
1713 1713
 	 * @param string   $view
1714 1714
 	 * @return mixed int = count || array of transaction objects
1715 1715
 	 */
1716
-	public function get_transactions( $perpage, $count = FALSE, $view = '' ) {
1716
+	public function get_transactions($perpage, $count = FALSE, $view = '') {
1717 1717
 
1718 1718
 		$TXN = EEM_Transaction::instance();
1719 1719
 
1720
-	    $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' ));
1721
-	    $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' );
1720
+	    $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'));
1721
+	    $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');
1722 1722
 
1723 1723
 	    //make sure our timestamps start and end right at the boundaries for each day
1724
-	    $start_date = date( 'Y-m-d', strtotime( $start_date ) ) . ' 00:00:00';
1725
-	    $end_date = date( 'Y-m-d', strtotime( $end_date ) ) . ' 23:59:59';
1724
+	    $start_date = date('Y-m-d', strtotime($start_date)).' 00:00:00';
1725
+	    $end_date = date('Y-m-d', strtotime($end_date)).' 23:59:59';
1726 1726
 
1727 1727
 
1728 1728
 	    //convert to timestamps
1729
-	    $start_date = strtotime( $start_date );
1730
-	    $end_date = strtotime( $end_date );
1729
+	    $start_date = strtotime($start_date);
1730
+	    $end_date = strtotime($end_date);
1731 1731
 
1732 1732
 	    //makes sure start date is the lowest value and vice versa
1733
-	    $start_date = min( $start_date, $end_date );
1734
-	    $end_date = max( $start_date, $end_date );
1733
+	    $start_date = min($start_date, $end_date);
1734
+	    $end_date = max($start_date, $end_date);
1735 1735
 
1736 1736
 	    //convert to correct format for query
1737
-	$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' );
1738
-	$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' );
1737
+	$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');
1738
+	$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');
1739 1739
 
1740 1740
 
1741 1741
 
1742 1742
 	    //set orderby
1743 1743
 		$this->_req_data['orderby'] = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : '';
1744 1744
 
1745
-		switch ( $this->_req_data['orderby'] ) {
1745
+		switch ($this->_req_data['orderby']) {
1746 1746
 			case 'TXN_ID':
1747 1747
 				$orderby = 'TXN_ID';
1748 1748
 				break;
@@ -1756,66 +1756,66 @@  discard block
 block discarded – undo
1756 1756
 				$orderby = 'TXN_timestamp';
1757 1757
 		}
1758 1758
 
1759
-		$sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'DESC';
1760
-		$current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1;
1761
-		$per_page = isset( $perpage ) && !empty( $perpage ) ? $perpage : 10;
1762
-		$per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page;
1759
+		$sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'DESC';
1760
+		$current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1;
1761
+		$per_page = isset($perpage) && ! empty($perpage) ? $perpage : 10;
1762
+		$per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page;
1763 1763
 
1764
-		$offset = ($current_page-1)*$per_page;
1765
-		$limit = array( $offset, $per_page );
1764
+		$offset = ($current_page - 1) * $per_page;
1765
+		$limit = array($offset, $per_page);
1766 1766
 
1767 1767
 		$_where = array(
1768
-			'TXN_timestamp' => array('BETWEEN', array($start_date, $end_date) ),
1768
+			'TXN_timestamp' => array('BETWEEN', array($start_date, $end_date)),
1769 1769
 			'Registration.REG_count' => 1
1770 1770
 		);
1771 1771
 
1772
-		if ( isset( $this->_req_data['EVT_ID'] ) ) {
1772
+		if (isset($this->_req_data['EVT_ID'])) {
1773 1773
 			$_where['Registration.EVT_ID'] = $this->_req_data['EVT_ID'];
1774 1774
 		}
1775 1775
 
1776
-		if ( isset( $this->_req_data['s'] ) ) {
1777
-			$search_string = '%' . $this->_req_data['s'] . '%';
1776
+		if (isset($this->_req_data['s'])) {
1777
+			$search_string = '%'.$this->_req_data['s'].'%';
1778 1778
 			$_where['OR'] = array(
1779
-				'Registration.Event.EVT_name' => array( 'LIKE', $search_string ),
1780
-				'Registration.Event.EVT_desc' => array( 'LIKE', $search_string ),
1781
-				'Registration.Event.EVT_short_desc' => array( 'LIKE' , $search_string ),
1782
-				'Registration.Attendee.ATT_full_name' => array( 'LIKE', $search_string ),
1783
-				'Registration.Attendee.ATT_fname' => array( 'LIKE', $search_string ),
1784
-				'Registration.Attendee.ATT_lname' => array( 'LIKE', $search_string ),
1785
-				'Registration.Attendee.ATT_short_bio' => array( 'LIKE', $search_string ),
1786
-				'Registration.Attendee.ATT_email' => array('LIKE', $search_string ),
1787
-				'Registration.Attendee.ATT_address' => array( 'LIKE', $search_string ),
1788
-				'Registration.Attendee.ATT_address2' => array( 'LIKE', $search_string ),
1789
-				'Registration.Attendee.ATT_city' => array( 'LIKE', $search_string ),
1790
-				'Registration.REG_final_price' => array( 'LIKE', $search_string ),
1791
-				'Registration.REG_code' => array( 'LIKE', $search_string ),
1792
-				'Registration.REG_count' => array( 'LIKE' , $search_string ),
1793
-				'Registration.REG_group_size' => array( 'LIKE' , $search_string ),
1794
-				'Registration.Ticket.TKT_name' => array( 'LIKE', $search_string ),
1795
-				'Registration.Ticket.TKT_description' => array( 'LIKE', $search_string ),
1796
-				'Payment.PAY_source' => array('LIKE', $search_string ),
1797
-				'Payment.Payment_Method.PMD_name' => array('LIKE', $search_string ),
1798
-				'TXN_session_data' => array( 'LIKE', $search_string ),
1799
-				'Payment.PAY_txn_id_chq_nmbr' => array( 'LIKE', $search_string )
1779
+				'Registration.Event.EVT_name' => array('LIKE', $search_string),
1780
+				'Registration.Event.EVT_desc' => array('LIKE', $search_string),
1781
+				'Registration.Event.EVT_short_desc' => array('LIKE', $search_string),
1782
+				'Registration.Attendee.ATT_full_name' => array('LIKE', $search_string),
1783
+				'Registration.Attendee.ATT_fname' => array('LIKE', $search_string),
1784
+				'Registration.Attendee.ATT_lname' => array('LIKE', $search_string),
1785
+				'Registration.Attendee.ATT_short_bio' => array('LIKE', $search_string),
1786
+				'Registration.Attendee.ATT_email' => array('LIKE', $search_string),
1787
+				'Registration.Attendee.ATT_address' => array('LIKE', $search_string),
1788
+				'Registration.Attendee.ATT_address2' => array('LIKE', $search_string),
1789
+				'Registration.Attendee.ATT_city' => array('LIKE', $search_string),
1790
+				'Registration.REG_final_price' => array('LIKE', $search_string),
1791
+				'Registration.REG_code' => array('LIKE', $search_string),
1792
+				'Registration.REG_count' => array('LIKE', $search_string),
1793
+				'Registration.REG_group_size' => array('LIKE', $search_string),
1794
+				'Registration.Ticket.TKT_name' => array('LIKE', $search_string),
1795
+				'Registration.Ticket.TKT_description' => array('LIKE', $search_string),
1796
+				'Payment.PAY_source' => array('LIKE', $search_string),
1797
+				'Payment.Payment_Method.PMD_name' => array('LIKE', $search_string),
1798
+				'TXN_session_data' => array('LIKE', $search_string),
1799
+				'Payment.PAY_txn_id_chq_nmbr' => array('LIKE', $search_string)
1800 1800
 				);
1801 1801
 		}
1802 1802
 
1803 1803
 		//failed transactions
1804
-		$failed = ( ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] == 'failed' && ! $count ) || ( $count && $view == 'failed' ) ? TRUE: FALSE;
1805
-		$abandoned = ( ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] == 'abandoned' && ! $count ) || ( $count && $view == 'abandoned' ) ? TRUE: FALSE;
1804
+		$failed = ( ! empty($this->_req_data['status']) && $this->_req_data['status'] == 'failed' && ! $count) || ($count && $view == 'failed') ? TRUE : FALSE;
1805
+		$abandoned = ( ! empty($this->_req_data['status']) && $this->_req_data['status'] == 'abandoned' && ! $count) || ($count && $view == 'abandoned') ? TRUE : FALSE;
1806 1806
 
1807
-		if ( $failed ) {
1808
-			$_where[ 'STS_ID' ] = EEM_Transaction::failed_status_code;
1809
-		} else if ( $abandoned ) {
1807
+		if ($failed) {
1808
+			$_where['STS_ID'] = EEM_Transaction::failed_status_code;
1809
+		} else if ($abandoned) {
1810 1810
 				$_where['STS_ID'] = EEM_Transaction::abandoned_status_code;
1811 1811
 		} else {
1812
-				$_where['STS_ID'] = array( '!=', EEM_Transaction::failed_status_code );
1813
-				$_where['STS_ID*'] = array( '!=', EEM_Transaction::abandoned_status_code );
1812
+				$_where['STS_ID'] = array('!=', EEM_Transaction::failed_status_code);
1813
+				$_where['STS_ID*'] = array('!=', EEM_Transaction::abandoned_status_code);
1814 1814
 		}
1815 1815
 
1816
-		$query_params = array( $_where, 'order_by' => array( $orderby => $sort ), 'limit' => $limit );
1816
+		$query_params = array($_where, 'order_by' => array($orderby => $sort), 'limit' => $limit);
1817 1817
 
1818
-		$transactions = $count ? $TXN->count( array($_where), 'TXN_ID', TRUE ) : $TXN->get_all($query_params);
1818
+		$transactions = $count ? $TXN->count(array($_where), 'TXN_ID', TRUE) : $TXN->get_all($query_params);
1819 1819
 
1820 1820
 
1821 1821
 		return $transactions;
Please login to merge, or discard this patch.
admin_pages/registrations/Registrations_Admin_Page.core.php 1 patch
Spacing   +544 added lines, -544 removed lines patch added patch discarded remove patch
@@ -56,26 +56,26 @@  discard block
 block discarded – undo
56 56
 	 * @param bool $routing
57 57
 	 * @return Registrations_Admin_Page
58 58
 	 */
59
-	public function __construct( $routing = TRUE ) {
60
-		parent::__construct( $routing );
61
-		add_action( 'wp_loaded', array( $this, 'wp_loaded' ));
59
+	public function __construct($routing = TRUE) {
60
+		parent::__construct($routing);
61
+		add_action('wp_loaded', array($this, 'wp_loaded'));
62 62
 	}
63 63
 
64 64
 
65 65
 
66 66
 	public function wp_loaded() {
67 67
 		// when adding a new registration...
68
-		if ( isset( $this->_req_data[ 'action' ] ) && $this->_req_data[ 'action' ] == 'new_registration' ) {
68
+		if (isset($this->_req_data['action']) && $this->_req_data['action'] == 'new_registration') {
69 69
 			EE_System::do_not_cache();
70 70
 			if (
71
-				! isset( $this->_req_data[ 'processing_registration' ] )
72
-				|| absint( $this->_req_data[ 'processing_registration' ] ) !== 1
71
+				! isset($this->_req_data['processing_registration'])
72
+				|| absint($this->_req_data['processing_registration']) !== 1
73 73
 			) {
74 74
 				// and it's NOT the attendee information reg step
75 75
 				// force cookie expiration by setting time to last week
76
-				setcookie( 'ee_registration_added', 0, time() - WEEK_IN_SECONDS, '/' );
76
+				setcookie('ee_registration_added', 0, time() - WEEK_IN_SECONDS, '/');
77 77
 				// and update the global
78
-				$_COOKIE[ 'ee_registration_added' ] = 0;
78
+				$_COOKIE['ee_registration_added'] = 0;
79 79
 			}
80 80
 		}
81 81
 	}
@@ -109,16 +109,16 @@  discard block
 block discarded – undo
109 109
 				'trash' => 'post.php'
110 110
 			);
111 111
 
112
-		add_action('edit_form_after_title', array($this, 'after_title_form_fields'), 10 );
112
+		add_action('edit_form_after_title', array($this, 'after_title_form_fields'), 10);
113 113
 		//add filters so that the comment urls don't take users to a confusing 404 page
114
-		add_filter('get_comment_link', array( $this, 'clear_comment_link' ), 10, 3 );
114
+		add_filter('get_comment_link', array($this, 'clear_comment_link'), 10, 3);
115 115
 	}
116 116
 
117 117
 
118
-	public function clear_comment_link( $link, $comment, $args ) {
118
+	public function clear_comment_link($link, $comment, $args) {
119 119
 		//gotta make sure this only happens on this route
120
-		$post_type = get_post_type( $comment->comment_post_ID);
121
-		if ( $post_type == 'espresso_attendees' )
120
+		$post_type = get_post_type($comment->comment_post_ID);
121
+		if ($post_type == 'espresso_attendees')
122 122
 			return '#commentsdiv';
123 123
 		return $link;
124 124
 	}
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 
127 127
 	protected function _ajax_hooks() {
128 128
 		//todo: all hooks for registrations ajax goes in here
129
-		add_action( 'wp_ajax_toggle_checkin_status', array( $this, 'toggle_checkin_status' ));
129
+		add_action('wp_ajax_toggle_checkin_status', array($this, 'toggle_checkin_status'));
130 130
 	}
131 131
 
132 132
 
@@ -141,8 +141,8 @@  discard block
 block discarded – undo
141 141
 				'add-attendee' => __('Add Contact', 'event_espresso'),
142 142
 				'edit' => __('Edit Contact', 'event_espresso'),
143 143
 				'report'=>  __("Event Registrations CSV Report", "event_espresso"),
144
-				'report_all' => __( 'All Registrations CSV Report', 'event_espresso' ),
145
-				'contact_list_report' => __( 'Contact List Report', 'event_espresso' ),
144
+				'report_all' => __('All Registrations CSV Report', 'event_espresso'),
145
+				'contact_list_report' => __('Contact List Report', 'event_espresso'),
146 146
 				'contact_list_export'=>  __("Export Data", "event_espresso"),
147 147
 			),
148 148
 			'publishbox' => array(
@@ -170,9 +170,9 @@  discard block
 block discarded – undo
170 170
 
171 171
 		$this->_get_registration_status_array();
172 172
 
173
-		$reg_id = ! empty( $this->_req_data['_REG_ID'] ) && ! is_array( $this->_req_data['_REG_ID'] ) ? $this->_req_data['_REG_ID'] : 0;
174
-		$att_id = ! empty( $this->_req_data[ 'ATT_ID' ] ) && ! is_array( $this->_req_data['ATT_ID'] ) ? $this->_req_data['ATT_ID'] : 0;
175
-		$att_id = ! empty( $this->_req_data['post'] ) && ! is_array( $this->_req_data['post'] ) ? $this->_req_data['post'] : $att_id;
173
+		$reg_id = ! empty($this->_req_data['_REG_ID']) && ! is_array($this->_req_data['_REG_ID']) ? $this->_req_data['_REG_ID'] : 0;
174
+		$att_id = ! empty($this->_req_data['ATT_ID']) && ! is_array($this->_req_data['ATT_ID']) ? $this->_req_data['ATT_ID'] : 0;
175
+		$att_id = ! empty($this->_req_data['post']) && ! is_array($this->_req_data['post']) ? $this->_req_data['post'] : $att_id;
176 176
 
177 177
 		$this->_page_routes = array(
178 178
 
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
 
206 206
 				'restore_registrations' => array(
207 207
 					'func' => '_trash_or_restore_registrations',
208
-					'args' => array( 'trash' => FALSE ),
208
+					'args' => array('trash' => FALSE),
209 209
 					'noheader' => TRUE,
210 210
 					'capability' => 'ee_delete_registrations'
211 211
 					),
@@ -438,7 +438,7 @@  discard block
 block discarded – undo
438 438
 						'filename' => 'registrations_overview_other'
439 439
 					)
440 440
                 ),
441
-				'help_tour' => array( 'Registration_Overview_Help_Tour' ),
441
+				'help_tour' => array('Registration_Overview_Help_Tour'),
442 442
 				'qtips' => array('Registration_List_Table_Tips'),
443 443
 				'list_table' => 'EE_Registrations_List_Table',
444 444
 				'require_nonce' => FALSE
@@ -448,7 +448,7 @@  discard block
 block discarded – undo
448 448
 				'nav' => array(
449 449
 					'label' => __('REG Details', 'event_espresso'),
450 450
 					'order' => 15,
451
-					'url' => isset($this->_req_data['_REG_ID']) ? add_query_arg(array('_REG_ID' => $this->_req_data['_REG_ID'] ), $this->_current_page_view_url )  : $this->_admin_base_url,
451
+					'url' => isset($this->_req_data['_REG_ID']) ? add_query_arg(array('_REG_ID' => $this->_req_data['_REG_ID']), $this->_current_page_view_url) : $this->_admin_base_url,
452 452
 					'persistent' => FALSE
453 453
 				),
454 454
                 'help_tabs' => array(
@@ -469,8 +469,8 @@  discard block
 block discarded – undo
469 469
 						'filename' => 'registrations_details_registrant_details'
470 470
 					)
471 471
 				),
472
-				'help_tour' => array( 'Registration_Details_Help_Tour' ),
473
-				'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array( '_registration_details_metaboxes' ) ),
472
+				'help_tour' => array('Registration_Details_Help_Tour'),
473
+				'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_registration_details_metaboxes')),
474 474
 				'require_nonce' => FALSE
475 475
 			),
476 476
 
@@ -494,7 +494,7 @@  discard block
 block discarded – undo
494 494
 					'order' => 15,
495 495
 					'persistent' => FALSE
496 496
 				),
497
-				'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array('_publish_post_box', 'attendee_editor_metaboxes' ) ),
497
+				'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box', 'attendee_editor_metaboxes')),
498 498
 				'require_nonce' => FALSE
499 499
 			),
500 500
 
@@ -503,7 +503,7 @@  discard block
 block discarded – undo
503 503
 					'label' => __('Edit Contact', 'event_espresso'),
504 504
 					'order' => 15,
505 505
 					'persistent' => FALSE,
506
-					'url' => isset($this->_req_data['ATT_ID']) ? add_query_arg(array('ATT_ID' => $this->_req_data['ATT_ID'] ), $this->_current_page_view_url )  : $this->_admin_base_url
506
+					'url' => isset($this->_req_data['ATT_ID']) ? add_query_arg(array('ATT_ID' => $this->_req_data['ATT_ID']), $this->_current_page_view_url) : $this->_admin_base_url
507 507
 				),
508 508
 				'metaboxes' => array('attendee_editor_metaboxes'),
509 509
 				'require_nonce' => FALSE
@@ -533,7 +533,7 @@  discard block
 block discarded – undo
533 533
 						'filename' => 'registrations_contact_list_other'
534 534
 					)
535 535
                 ),
536
-				'help_tour' => array( 'Contact_List_Help_Tour' ),
536
+				'help_tour' => array('Contact_List_Help_Tour'),
537 537
 				'metaboxes' => array(),
538 538
 				'require_nonce' => FALSE
539 539
 			),
@@ -552,7 +552,7 @@  discard block
 block discarded – undo
552 552
 	protected function _add_screen_options() {}
553 553
 	protected function _add_feature_pointers() {}
554 554
 	public function admin_init() {
555
-		EE_Registry::$i18n_js_strings[ 'update_att_qstns' ] = __( 'click "Update Registration Questions" to save your changes', 'event_espresso' );
555
+		EE_Registry::$i18n_js_strings['update_att_qstns'] = __('click "Update Registration Questions" to save your changes', 'event_espresso');
556 556
 	}
557 557
 	public function admin_notices() {}
558 558
 	public function admin_footer_scripts() {}
@@ -570,7 +570,7 @@  discard block
 block discarded – undo
570 570
 	*		@return void
571 571
 	*/
572 572
 	private function _get_registration_status_array() {
573
-		self::$_reg_status = EEM_Registration::reg_status_array( array(), TRUE);
573
+		self::$_reg_status = EEM_Registration::reg_status_array(array(), TRUE);
574 574
 	}
575 575
 
576 576
 
@@ -593,11 +593,11 @@  discard block
 block discarded – undo
593 593
 	public function load_scripts_styles() {
594 594
 		//style
595 595
 		//wp_register_style('espresso_attendees', ATT_ASSETS_URL . 'espresso_attendees_admin.css', array(), EVENT_ESPRESSO_VERSION );
596
-		wp_register_style('espresso_reg', REG_ASSETS_URL . 'espresso_registrations_admin.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION );
596
+		wp_register_style('espresso_reg', REG_ASSETS_URL.'espresso_registrations_admin.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION);
597 597
 		wp_enqueue_style('espresso_reg');
598 598
 
599 599
 		//script
600
-		wp_register_script('espresso_reg', REG_ASSETS_URL . 'espresso_registrations_admin.js', array('jquery-ui-datepicker', 'jquery-ui-draggable', 'ee_admin_js'), EVENT_ESPRESSO_VERSION, TRUE);
600
+		wp_register_script('espresso_reg', REG_ASSETS_URL.'espresso_registrations_admin.js', array('jquery-ui-datepicker', 'jquery-ui-draggable', 'ee_admin_js'), EVENT_ESPRESSO_VERSION, TRUE);
601 601
 		wp_enqueue_script('espresso_reg');
602 602
 	}
603 603
 
@@ -606,9 +606,9 @@  discard block
 block discarded – undo
606 606
 	public function load_scripts_styles_edit_attendee() {
607 607
 		//stuff to only show up on our attendee edit details page.
608 608
 		$attendee_details_translations = array(
609
-			'att_publish_text' => sprintf( __('Created on: <b>%1$s</b>', 'event_espresso'), $this->_cpt_model_obj->get_datetime('ATT_created') )
609
+			'att_publish_text' => sprintf(__('Created on: <b>%1$s</b>', 'event_espresso'), $this->_cpt_model_obj->get_datetime('ATT_created'))
610 610
 			);
611
-		wp_localize_script( 'espresso_reg', 'ATTENDEE_DETAILS', $attendee_details_translations );
611
+		wp_localize_script('espresso_reg', 'ATTENDEE_DETAILS', $attendee_details_translations);
612 612
 		wp_enqueue_script('jquery-validate');
613 613
 	}
614 614
 
@@ -617,8 +617,8 @@  discard block
 block discarded – undo
617 617
 		//styles
618 618
 		wp_enqueue_style('espresso-ui-theme');
619 619
 		//scripts
620
-		$this->_get_reg_custom_questions_form( $this->_registration->ID() );
621
-		$this->_reg_custom_questions_form->wp_enqueue_scripts( true );
620
+		$this->_get_reg_custom_questions_form($this->_registration->ID());
621
+		$this->_reg_custom_questions_form->wp_enqueue_scripts(true);
622 622
 	}
623 623
 
624 624
 
@@ -628,7 +628,7 @@  discard block
 block discarded – undo
628 628
 
629 629
 	public function load_scripts_styles_contact_list() {
630 630
 		wp_deregister_style('espresso_reg');
631
-		wp_register_style('espresso_att', REG_ASSETS_URL . 'espresso_attendees_admin.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION );
631
+		wp_register_style('espresso_att', REG_ASSETS_URL.'espresso_attendees_admin.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION);
632 632
 		wp_enqueue_style('espresso_att');
633 633
 	}
634 634
 
@@ -637,9 +637,9 @@  discard block
 block discarded – undo
637 637
 
638 638
 
639 639
 	public function load_scripts_styles_new_registration() {
640
-		wp_register_script( 'ee-spco-for-admin', REG_ASSETS_URL . 'spco_for_admin.js', array('underscore', 'jquery'), EVENT_ESPRESSO_VERSION, TRUE );
640
+		wp_register_script('ee-spco-for-admin', REG_ASSETS_URL.'spco_for_admin.js', array('underscore', 'jquery'), EVENT_ESPRESSO_VERSION, TRUE);
641 641
 		wp_enqueue_script('ee-spco-for-admin');
642
-		add_filter('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true' );
642
+		add_filter('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true');
643 643
 		EE_Form_Section_Proper::wp_enqueue_scripts();
644 644
 		EED_Ticket_Selector::load_tckt_slctr_assets();
645 645
 		EE_Datepicker_Input::enqueue_styles_and_scripts();
@@ -666,7 +666,7 @@  discard block
 block discarded – undo
666 666
 		//for notification related bulk actions we need to make sure only active messengers have an option.
667 667
 		EED_Messages::set_autoloaders();
668 668
 		/** @type EE_Message_Resource_Manager $message_resource_manager */
669
-		$message_resource_manager = EE_Registry::instance()->load_lib( 'Message_Resource_Manager' );
669
+		$message_resource_manager = EE_Registry::instance()->load_lib('Message_Resource_Manager');
670 670
 		$active_mts = $message_resource_manager->list_of_active_message_types();
671 671
 		//key= bulk_action_slug, value= message type.
672 672
 		$match_array = array(
@@ -679,23 +679,23 @@  discard block
 block discarded – undo
679 679
 
680 680
 		/** setup reg status bulk actions **/
681 681
 		$def_reg_status_actions['approve_registration'] = __('Approve Registrations', 'event_espresso');
682
-		if ( in_array( $match_array['approve_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) {
682
+		if (in_array($match_array['approve_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) {
683 683
 			$def_reg_status_actions['approve_and_notify_registration'] = __('Approve and Notify Registrations', 'event_espresso');
684 684
 		}
685 685
 		$def_reg_status_actions['decline_registration'] = __('Decline Registrations', 'event_espresso');
686
-		if ( in_array( $match_array['decline_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) {
686
+		if (in_array($match_array['decline_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) {
687 687
 			$def_reg_status_actions['decline_and_notify_registration'] = __('Decline and Notify Registrations', 'event_espresso');
688 688
 		}
689 689
 		$def_reg_status_actions['pending_registration'] = __('Set Registrations to Pending Payment', 'event_espresso');
690
-		if ( in_array( $match_array['pending_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) {
690
+		if (in_array($match_array['pending_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) {
691 691
 			$def_reg_status_actions['pending_and_notify_registration'] = __('Set Registrations to Pending Payment and Notify', 'event_espresso');
692 692
 		}
693 693
 		$def_reg_status_actions['no_approve_registration'] = __('Set Registrations to Not Approved', 'event_espresso');
694
-		if ( in_array( $match_array['no_approve_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) {
694
+		if (in_array($match_array['no_approve_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) {
695 695
 			$def_reg_status_actions['no_approve_and_notify_registration'] = __('Set Registrations to Not Approved and Notify', 'event_espresso');
696 696
 		}
697 697
 		$def_reg_status_actions['cancel_registration'] = __('Cancel Registrations', 'event_espresso');
698
-		if ( in_array( $match_array['cancel_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) {
698
+		if (in_array($match_array['cancel_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) {
699 699
 			$def_reg_status_actions['cancel_and_notify_registration'] = __('Cancel Registrations and Notify', 'event_espresso');
700 700
 		}
701 701
 
@@ -704,29 +704,29 @@  discard block
 block discarded – undo
704 704
 				'slug' => 'all',
705 705
 				'label' => __('View All Registrations', 'event_espresso'),
706 706
 				'count' => 0,
707
-				'bulk_action' => array_merge( $def_reg_status_actions, array(
707
+				'bulk_action' => array_merge($def_reg_status_actions, array(
708 708
 					'trash_registrations' => __('Trash Registrations', 'event_espresso')
709
-					) )
709
+					))
710 710
 				),
711 711
 			'month' => array(
712 712
 				'slug' => 'month',
713 713
 				'label' => __('This Month', 'event_espresso'),
714 714
 				'count' => 0,
715
-				'bulk_action' => array_merge( $def_reg_status_actions, array(
715
+				'bulk_action' => array_merge($def_reg_status_actions, array(
716 716
 					'trash_registrations' => __('Trash Registrations', 'event_espresso')
717 717
 					))
718 718
 				),
719 719
 			'today' => array(
720 720
 				'slug' => 'today',
721
-				'label' => sprintf( __('Today - %s', 'event_espresso'), date('M d, Y', current_time('timestamp' ) ) ),
721
+				'label' => sprintf(__('Today - %s', 'event_espresso'), date('M d, Y', current_time('timestamp'))),
722 722
 				'count' => 0,
723
-				'bulk_action' => array_merge( $def_reg_status_actions,  array(
723
+				'bulk_action' => array_merge($def_reg_status_actions, array(
724 724
 					'trash_registrations' => __('Trash Registrations', 'event_espresso')
725 725
 					))
726 726
 				)
727 727
 			);
728 728
 
729
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_registrations', 'espresso_registrations_delete_registration' ) ) {
729
+		if (EE_Registry::instance()->CAP->current_user_can('ee_delete_registrations', 'espresso_registrations_delete_registration')) {
730 730
 			$this->_views['incomplete'] = array(
731 731
 				'slug' => 'incomplete',
732 732
 				'label' => __('Incomplete', 'event_espresso'),
@@ -762,7 +762,7 @@  discard block
 block discarded – undo
762 762
 				)
763 763
 			);
764 764
 
765
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_contacts', 'espresso_registrations_trash_attendees' ) ) {
765
+		if (EE_Registry::instance()->CAP->current_user_can('ee_delete_contacts', 'espresso_registrations_trash_attendees')) {
766 766
 			$this->_views['trash'] = array(
767 767
 				'slug' => 'trash',
768 768
 				'label' => __('Trash', 'event_espresso'),
@@ -801,18 +801,18 @@  discard block
 block discarded – undo
801 801
 				'desc' => __('View Transaction Invoice', 'event_espresso')
802 802
 				),
803 803
  			);
804
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_registrations_resend_registration' ) ) {
804
+		if (EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_registrations_resend_registration')) {
805 805
 			$fc_items['resend_registration'] = array(
806 806
 				'class' => 'dashicons dashicons-email-alt',
807 807
 				'desc' => __('Resend Registration Details', 'event_espresso')
808 808
 				);
809 809
 		} else {
810
-			$fc_items['blank'] = array( 'class' => 'blank', 'desc' => '' );
810
+			$fc_items['blank'] = array('class' => 'blank', 'desc' => '');
811 811
 		}
812 812
 
813
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_messages', 'view_filtered_messages' ) ) {
814
-			$related_for_icon = EEH_MSG_Template::get_message_action_icon( 'see_notifications_for' );
815
-			if ( isset( $related_for_icon['css_class']) && isset( $related_for_icon['label'] ) ) {
813
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_messages', 'view_filtered_messages')) {
814
+			$related_for_icon = EEH_MSG_Template::get_message_action_icon('see_notifications_for');
815
+			if (isset($related_for_icon['css_class']) && isset($related_for_icon['label'])) {
816 816
 				$fc_items['view_related_messages'] = array(
817 817
 					'class' => $related_for_icon['css_class'],
818 818
 					'desc' => $related_for_icon['label'],
@@ -822,31 +822,31 @@  discard block
 block discarded – undo
822 822
 
823 823
 		$sc_items = array(
824 824
 			'approved_status' => array(
825
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_approved,
826
-				'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_approved, FALSE, 'sentence' )
825
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_approved,
826
+				'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_approved, FALSE, 'sentence')
827 827
 				),
828 828
 			'pending_status' => array(
829
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_pending_payment,
830
-				'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_pending_payment, FALSE, 'sentence' )
829
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_pending_payment,
830
+				'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_pending_payment, FALSE, 'sentence')
831 831
 				),
832 832
 			'incomplete_status' => array(
833
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_incomplete,
834
-				'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_incomplete, FALSE, 'sentence' )
833
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_incomplete,
834
+				'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_incomplete, FALSE, 'sentence')
835 835
 			),
836 836
 			'not_approved' => array(
837
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_not_approved,
838
-				'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_not_approved, FALSE, 'sentence' )
837
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_not_approved,
838
+				'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_not_approved, FALSE, 'sentence')
839 839
 				),
840 840
 			'declined_status' => array(
841
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_declined,
842
-				'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_declined, FALSE, 'sentence' )
841
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_declined,
842
+				'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_declined, FALSE, 'sentence')
843 843
 				),
844 844
 			'cancelled_status' => array(
845
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_cancelled,
846
-				'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_cancelled, FALSE, 'sentence' )
845
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_cancelled,
846
+				'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_cancelled, FALSE, 'sentence')
847 847
 				)
848 848
 			);
849
-		return array_merge( $fc_items, $sc_items );
849
+		return array_merge($fc_items, $sc_items);
850 850
 	}
851 851
 
852 852
 
@@ -859,15 +859,15 @@  discard block
 block discarded – undo
859 859
 
860 860
 
861 861
 	protected function _registrations_overview_list_table() {
862
-		$EVT_ID = ( ! empty( $this->_req_data['event_id'] )) ? absint( $this->_req_data['event_id'] ) : FALSE;
863
-		if ( $EVT_ID ) {
864
-			if ( EE_Registry::instance()->CAP->current_user_can( 'ee_edit_registrations', 'espresso_registrations_new_registration', $EVT_ID ) ) {
865
-				$this->_admin_page_title .= $this->get_action_link_or_button( 'new_registration', 'add-registrant', array( 'event_id' => $EVT_ID ), 'add-new-h2' );
862
+		$EVT_ID = ( ! empty($this->_req_data['event_id'])) ? absint($this->_req_data['event_id']) : FALSE;
863
+		if ($EVT_ID) {
864
+			if (EE_Registry::instance()->CAP->current_user_can('ee_edit_registrations', 'espresso_registrations_new_registration', $EVT_ID)) {
865
+				$this->_admin_page_title .= $this->get_action_link_or_button('new_registration', 'add-registrant', array('event_id' => $EVT_ID), 'add-new-h2');
866 866
 			}
867
-			$event = EEM_Event::instance()->get_one_by_ID( $EVT_ID );
868
-			$this->_template_args['admin_page_header'] = $event instanceof EE_Event ? sprintf( __('%s Viewing registrations for the event: %s%s', 'event_espresso'), '<h2>', '<a href="' . EE_Admin_Page::add_query_args_and_nonce( array('action' => 'edit', 'post' => $event->ID() ), EVENTS_ADMIN_URL ) . '">' . $event->get('EVT_name') . '</a>', '</h2>' ) : '';
867
+			$event = EEM_Event::instance()->get_one_by_ID($EVT_ID);
868
+			$this->_template_args['admin_page_header'] = $event instanceof EE_Event ? sprintf(__('%s Viewing registrations for the event: %s%s', 'event_espresso'), '<h2>', '<a href="'.EE_Admin_Page::add_query_args_and_nonce(array('action' => 'edit', 'post' => $event->ID()), EVENTS_ADMIN_URL).'">'.$event->get('EVT_name').'</a>', '</h2>') : '';
869 869
 		}
870
-		$this->_template_args['after_list_table'] = $this->_display_legend( $this->_registration_legend_items() );
870
+		$this->_template_args['after_list_table'] = $this->_display_legend($this->_registration_legend_items());
871 871
 		$this->display_admin_list_table_page_with_no_sidebar();
872 872
 	}
873 873
 
@@ -882,19 +882,19 @@  discard block
 block discarded – undo
882 882
 	 */
883 883
 	private function _set_registration_object() {
884 884
 		//get out if we've already set the object
885
-		if ( is_object( $this->_registration )) {
885
+		if (is_object($this->_registration)) {
886 886
 			return TRUE;
887 887
 		}
888 888
 
889 889
 	    $REG = EEM_Registration::instance();
890 890
 
891
-		$REG_ID = ( ! empty( $this->_req_data['_REG_ID'] )) ? absint( $this->_req_data['_REG_ID'] ) : FALSE;
891
+		$REG_ID = ( ! empty($this->_req_data['_REG_ID'])) ? absint($this->_req_data['_REG_ID']) : FALSE;
892 892
 
893
-		if ( $this->_registration = $REG->get_one_by_ID( $REG_ID ))
893
+		if ($this->_registration = $REG->get_one_by_ID($REG_ID))
894 894
 			return TRUE;
895 895
 		else {
896
-			$error_msg = sprintf( __('An error occurred and the details for Registration ID #%s could not be retrieved.', 'event_espresso'), $REG_ID );
897
-			EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ );
896
+			$error_msg = sprintf(__('An error occurred and the details for Registration ID #%s could not be retrieved.', 'event_espresso'), $REG_ID);
897
+			EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__);
898 898
 			$this->_registration = NULL;
899 899
 			return FALSE;
900 900
 		}
@@ -912,24 +912,24 @@  discard block
 block discarded – undo
912 912
 	 * @throws \EE_Error
913 913
 	 * @return mixed (int|array)  int = count || array of registration objects
914 914
 	 */
915
-	public function get_registrations( $per_page = 10, $count = FALSE, $this_month = FALSE, $today = FALSE ) {
916
-		$EVT_ID = ! empty( $this->_req_data['event_id'] ) && $this->_req_data['event_id'] > 0 ? absint( $this->_req_data['event_id'] ) : FALSE;
917
-		$CAT_ID = ! empty( $this->_req_data['EVT_CAT'] ) && (int) $this->_req_data['EVT_CAT'] > 0? absint( $this->_req_data['EVT_CAT'] ) : FALSE;
918
-		$reg_status = ! empty( $this->_req_data['_reg_status'] ) ? sanitize_text_field( $this->_req_data['_reg_status'] ) : FALSE;
919
-		$month_range = ! empty( $this->_req_data['month_range'] ) ? sanitize_text_field( $this->_req_data['month_range'] ) : FALSE;//should be like 2013-april
920
-		$today_a = ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] === 'today' ? TRUE : FALSE;
921
-		$this_month_a = ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] === 'month' ? TRUE  : FALSE;
915
+	public function get_registrations($per_page = 10, $count = FALSE, $this_month = FALSE, $today = FALSE) {
916
+		$EVT_ID = ! empty($this->_req_data['event_id']) && $this->_req_data['event_id'] > 0 ? absint($this->_req_data['event_id']) : FALSE;
917
+		$CAT_ID = ! empty($this->_req_data['EVT_CAT']) && (int) $this->_req_data['EVT_CAT'] > 0 ? absint($this->_req_data['EVT_CAT']) : FALSE;
918
+		$reg_status = ! empty($this->_req_data['_reg_status']) ? sanitize_text_field($this->_req_data['_reg_status']) : FALSE;
919
+		$month_range = ! empty($this->_req_data['month_range']) ? sanitize_text_field($this->_req_data['month_range']) : FALSE; //should be like 2013-april
920
+		$today_a = ! empty($this->_req_data['status']) && $this->_req_data['status'] === 'today' ? TRUE : FALSE;
921
+		$this_month_a = ! empty($this->_req_data['status']) && $this->_req_data['status'] === 'month' ? TRUE : FALSE;
922 922
 		$start_date = FALSE;
923 923
 		$end_date = FALSE;
924 924
 		$_where = array();
925
-		$trash = ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] === 'trash' ? TRUE : FALSE;
926
-		$incomplete = ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] === 'incomplete' ? TRUE : FALSE;
925
+		$trash = ! empty($this->_req_data['status']) && $this->_req_data['status'] === 'trash' ? TRUE : FALSE;
926
+		$incomplete = ! empty($this->_req_data['status']) && $this->_req_data['status'] === 'incomplete' ? TRUE : FALSE;
927 927
 
928 928
 		//set orderby
929 929
 		$this->_req_data['orderby'] = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : '';
930 930
 
931 931
 
932
-		switch ( $this->_req_data['orderby'] ) {
932
+		switch ($this->_req_data['orderby']) {
933 933
 			case '_REG_ID':
934 934
 				$orderby = 'REG_ID';
935 935
 				break;
@@ -949,26 +949,26 @@  discard block
 block discarded – undo
949 949
 				$orderby = 'REG_date';
950 950
 		}
951 951
 
952
-		$sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'DESC';
953
-		$current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1;
954
-		$per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page;
952
+		$sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'DESC';
953
+		$current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1;
954
+		$per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page;
955 955
 
956 956
 
957
-		$offset = ($current_page-1)*$per_page;
958
-		$limit = $count  ? NULL : array( $offset, $per_page );
957
+		$offset = ($current_page - 1) * $per_page;
958
+		$limit = $count ? NULL : array($offset, $per_page);
959 959
 
960
-		if($EVT_ID){
961
-			$_where['EVT_ID']=$EVT_ID;
960
+		if ($EVT_ID) {
961
+			$_where['EVT_ID'] = $EVT_ID;
962 962
 		}
963
-		if($CAT_ID){
963
+		if ($CAT_ID) {
964 964
 			$_where['Event.Term_Taxonomy.term_id'] = $CAT_ID;
965 965
 		}
966
-		if ( $incomplete ) {
966
+		if ($incomplete) {
967 967
 			$_where['STS_ID'] = EEM_Registration::status_id_incomplete;
968 968
 		} else if ( ! $trash) {
969
-			$_where['STS_ID'] = array( '!=', EEM_Registration::status_id_incomplete );
969
+			$_where['STS_ID'] = array('!=', EEM_Registration::status_id_incomplete);
970 970
 		}
971
-		if($reg_status){
971
+		if ($reg_status) {
972 972
 			$_where['STS_ID'] = $reg_status;
973 973
 		}
974 974
 
@@ -980,105 +980,105 @@  discard block
 block discarded – undo
980 980
 		$time_start = ' 00:00:00';
981 981
 		$time_end = ' 23:59:59';
982 982
 
983
-		if($today_a || $today ){
983
+		if ($today_a || $today) {
984 984
 			$curdate = date('Y-m-d', current_time('timestamp'));
985
-			$_where['REG_date']= array('BETWEEN',
985
+			$_where['REG_date'] = array('BETWEEN',
986 986
 				array(
987
-					EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $curdate . $time_start, 'Y-m-d H:i:s' ),
988
-					EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $curdate . $time_end, 'Y-m-d H:i:s' ),
987
+					EEM_Registration::instance()->convert_datetime_for_query('REG_date', $curdate.$time_start, 'Y-m-d H:i:s'),
988
+					EEM_Registration::instance()->convert_datetime_for_query('REG_date', $curdate.$time_end, 'Y-m-d H:i:s'),
989 989
 			));
990
-		}elseif($this_month_a || $this_month){
990
+		}elseif ($this_month_a || $this_month) {
991 991
 			$this_month_r = date('m', current_time('timestamp'));
992
-			$days_this_month = date( 't', current_time('timestamp') );
993
-			$_where['REG_date']= array('BETWEEN',
992
+			$days_this_month = date('t', current_time('timestamp'));
993
+			$_where['REG_date'] = array('BETWEEN',
994 994
 				array(
995
-					EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $this_year_r . '-' . $this_month_r . '-01' . ' ' . $time_start, 'Y-m-d H:i:s' ),
996
-					EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $this_year_r . '-' . $this_month_r . '-' . $days_this_month . ' ' . $time_end, 'Y-m-d H:i:s' )
995
+					EEM_Registration::instance()->convert_datetime_for_query('REG_date', $this_year_r.'-'.$this_month_r.'-01'.' '.$time_start, 'Y-m-d H:i:s'),
996
+					EEM_Registration::instance()->convert_datetime_for_query('REG_date', $this_year_r.'-'.$this_month_r.'-'.$days_this_month.' '.$time_end, 'Y-m-d H:i:s')
997 997
 			));
998
-		}elseif($month_range){
998
+		}elseif ($month_range) {
999 999
 			$pieces = explode(' ', $this->_req_data['month_range'], 3);
1000
-			$month_r = !empty($pieces[0]) ? date('m', strtotime( $month_range ) ) : '';
1001
-			$year_r = !empty($pieces[1]) ? $pieces[1] : '';
1002
-			$days_in_month = date('t', strtotime($year_r .  '-' . $month_r . '-' . '01') );
1003
-			$_where['REG_date']= array('BETWEEN',
1004
-				array(  EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $year_r . '-' . $month_r . '-01 00:00:00', 'Y-m-d H:i:s'), EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $year_r . '-' . $month_r . '-' . $days_in_month .  ' 23:59:59', 'Y-m-d H:i:s' ) ) );
1005
-		}elseif($start_date && $end_date){
1000
+			$month_r = ! empty($pieces[0]) ? date('m', strtotime($month_range)) : '';
1001
+			$year_r = ! empty($pieces[1]) ? $pieces[1] : '';
1002
+			$days_in_month = date('t', strtotime($year_r.'-'.$month_r.'-'.'01'));
1003
+			$_where['REG_date'] = array('BETWEEN',
1004
+				array(EEM_Registration::instance()->convert_datetime_for_query('REG_date', $year_r.'-'.$month_r.'-01 00:00:00', 'Y-m-d H:i:s'), EEM_Registration::instance()->convert_datetime_for_query('REG_date', $year_r.'-'.$month_r.'-'.$days_in_month.' 23:59:59', 'Y-m-d H:i:s')));
1005
+		}elseif ($start_date && $end_date) {
1006 1006
 			throw new EE_Error("not yet supported");
1007
-		}elseif($start_date){
1007
+		}elseif ($start_date) {
1008 1008
 			throw new EE_Error("not yet supported");
1009
-		}elseif($end_date){
1009
+		}elseif ($end_date) {
1010 1010
 			throw new EE_Error("not yet supported");
1011 1011
 		}
1012 1012
 
1013
-		if ( ! empty( $this->_req_data['s'] ) ) {
1014
-			$sstr = '%' . $this->_req_data['s'] . '%';
1013
+		if ( ! empty($this->_req_data['s'])) {
1014
+			$sstr = '%'.$this->_req_data['s'].'%';
1015 1015
 			$_where['OR'] = array(
1016
-				'Event.EVT_name' => array( 'LIKE', $sstr),
1017
-				'Event.EVT_desc' => array( 'LIKE', $sstr ),
1018
-				'Event.EVT_short_desc' => array( 'LIKE' , $sstr ),
1019
-				'Attendee.ATT_full_name' => array( 'LIKE', $sstr ),
1020
-				'Attendee.ATT_fname' => array( 'LIKE', $sstr ),
1021
-				'Attendee.ATT_lname' => array( 'LIKE', $sstr ),
1022
-				'Attendee.ATT_short_bio' => array( 'LIKE', $sstr ),
1023
-				'Attendee.ATT_email' => array('LIKE', $sstr ),
1024
-				'Attendee.ATT_address' => array( 'LIKE', $sstr ),
1025
-				'Attendee.ATT_address2' => array( 'LIKE', $sstr ),
1026
-				'Attendee.ATT_city' => array( 'LIKE', $sstr ),
1027
-				'REG_final_price' => array( 'LIKE', $sstr ),
1028
-				'REG_code' => array( 'LIKE', $sstr ),
1029
-				'REG_count' => array( 'LIKE' , $sstr ),
1030
-				'REG_group_size' => array( 'LIKE' , $sstr ),
1031
-				'Ticket.TKT_name' => array( 'LIKE', $sstr ),
1032
-				'Ticket.TKT_description' => array( 'LIKE', $sstr ),
1033
-				'Transaction.Payment.PAY_txn_id_chq_nmbr' => array( 'LIKE', $sstr )
1016
+				'Event.EVT_name' => array('LIKE', $sstr),
1017
+				'Event.EVT_desc' => array('LIKE', $sstr),
1018
+				'Event.EVT_short_desc' => array('LIKE', $sstr),
1019
+				'Attendee.ATT_full_name' => array('LIKE', $sstr),
1020
+				'Attendee.ATT_fname' => array('LIKE', $sstr),
1021
+				'Attendee.ATT_lname' => array('LIKE', $sstr),
1022
+				'Attendee.ATT_short_bio' => array('LIKE', $sstr),
1023
+				'Attendee.ATT_email' => array('LIKE', $sstr),
1024
+				'Attendee.ATT_address' => array('LIKE', $sstr),
1025
+				'Attendee.ATT_address2' => array('LIKE', $sstr),
1026
+				'Attendee.ATT_city' => array('LIKE', $sstr),
1027
+				'REG_final_price' => array('LIKE', $sstr),
1028
+				'REG_code' => array('LIKE', $sstr),
1029
+				'REG_count' => array('LIKE', $sstr),
1030
+				'REG_group_size' => array('LIKE', $sstr),
1031
+				'Ticket.TKT_name' => array('LIKE', $sstr),
1032
+				'Ticket.TKT_description' => array('LIKE', $sstr),
1033
+				'Transaction.Payment.PAY_txn_id_chq_nmbr' => array('LIKE', $sstr)
1034 1034
 				);
1035 1035
 		}
1036 1036
 
1037 1037
 		//capability checks
1038
-		if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_registrations', 'get_registrations' ) ) {
1038
+		if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_registrations', 'get_registrations')) {
1039 1039
 			$_where['AND'] = array(
1040 1040
 				'Event.EVT_wp_user' => get_current_user_id()
1041 1041
 				);
1042 1042
 		}
1043 1043
 
1044 1044
 
1045
-		if( $count ){
1046
-			if ( $trash ) {
1047
-				return EEM_Registration::instance()->count_deleted( array( $_where ));
1048
-			} else if ( $incomplete ) {
1049
-				return EEM_Registration::instance()->count( array( $_where ));
1045
+		if ($count) {
1046
+			if ($trash) {
1047
+				return EEM_Registration::instance()->count_deleted(array($_where));
1048
+			} else if ($incomplete) {
1049
+				return EEM_Registration::instance()->count(array($_where));
1050 1050
 			} else {
1051
-				return EEM_Registration::instance()->count( array( $_where, 'default_where_conditions' => 'this_model_only' ));
1051
+				return EEM_Registration::instance()->count(array($_where, 'default_where_conditions' => 'this_model_only'));
1052 1052
 			}
1053 1053
 		} else {
1054 1054
 			//make sure we remove default where conditions cause all registrations matching query are returned
1055
-			$query_params = array( $_where, 'order_by' => array( $orderby => $sort ), 'default_where_conditions' => 'this_model_only' );
1056
-			if ( $per_page !== -1 ) {
1055
+			$query_params = array($_where, 'order_by' => array($orderby => $sort), 'default_where_conditions' => 'this_model_only');
1056
+			if ($per_page !== -1) {
1057 1057
 				$query_params['limit'] = $limit;
1058 1058
 			}
1059
-			$registrations =  $trash ? EEM_Registration::instance()->get_all_deleted($query_params) : EEM_Registration::instance()->get_all($query_params);
1059
+			$registrations = $trash ? EEM_Registration::instance()->get_all_deleted($query_params) : EEM_Registration::instance()->get_all($query_params);
1060 1060
 
1061 1061
 
1062
-			if ( $EVT_ID && isset( $registrations[0] ) && $registrations[0] instanceof EE_Registration &&  $registrations[0]->event_obj()) {
1062
+			if ($EVT_ID && isset($registrations[0]) && $registrations[0] instanceof EE_Registration && $registrations[0]->event_obj()) {
1063 1063
 				$first_registration = $registrations[0];
1064 1064
 				//EEH_Debug_Tools::printr( $registrations[0], '$registrations  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
1065 1065
 				$event_name = $first_registration->event_obj()->name();
1066
-				$event_date = $first_registration->date_obj()->start_date_and_time('l F j, Y,', 'g:i:s a');// isset( $registrations[0]->DTT_EVT_start ) ? date( 'l F j, Y,    g:i:s a', $registrations[0]->DTT_EVT_start ) : '';
1066
+				$event_date = $first_registration->date_obj()->start_date_and_time('l F j, Y,', 'g:i:s a'); // isset( $registrations[0]->DTT_EVT_start ) ? date( 'l F j, Y,    g:i:s a', $registrations[0]->DTT_EVT_start ) : '';
1067 1067
 				// edit event link
1068
-				if ( $event_name != '' ) {
1069
-					$edit_event_url = self::add_query_args_and_nonce( array( 'action'=>'edit_event', 'EVT_ID'=>$EVT_ID ), EVENTS_ADMIN_URL );
1070
-					$edit_event_lnk = '<a href="'.$edit_event_url.'" title="' . esc_attr__( 'Edit ', 'event_espresso' ) . $event_name . '">' . __( 'Edit Event', 'event_espresso' ) . '</a>';
1071
-					$event_name .= ' <span class="admin-page-header-edit-lnk not-bold">' . $edit_event_lnk . '</span>' ;
1068
+				if ($event_name != '') {
1069
+					$edit_event_url = self::add_query_args_and_nonce(array('action'=>'edit_event', 'EVT_ID'=>$EVT_ID), EVENTS_ADMIN_URL);
1070
+					$edit_event_lnk = '<a href="'.$edit_event_url.'" title="'.esc_attr__('Edit ', 'event_espresso').$event_name.'">'.__('Edit Event', 'event_espresso').'</a>';
1071
+					$event_name .= ' <span class="admin-page-header-edit-lnk not-bold">'.$edit_event_lnk.'</span>';
1072 1072
 				}
1073 1073
 
1074
-				$back_2_reg_url = self::add_query_args_and_nonce( array( 'action'=>'default' ), REG_ADMIN_URL );
1075
-				$back_2_reg_lnk = '<a href="'.$back_2_reg_url.'" title="' . esc_attr__( 'click to return to viewing all registrations ', 'event_espresso' ) . '">&laquo; ' . __( 'Back to All Registrations', 'event_espresso' ) . '</a>';
1074
+				$back_2_reg_url = self::add_query_args_and_nonce(array('action'=>'default'), REG_ADMIN_URL);
1075
+				$back_2_reg_lnk = '<a href="'.$back_2_reg_url.'" title="'.esc_attr__('click to return to viewing all registrations ', 'event_espresso').'">&laquo; '.__('Back to All Registrations', 'event_espresso').'</a>';
1076 1076
 
1077 1077
 				$this->_template_args['before_admin_page_content'] = '
1078 1078
 			<div id="admin-page-header">
1079
-				<h1><span class="small-text not-bold">'.__( 'Event: ', 'event_espresso' ).'</span>'. $event_name .'</h1>
1080
-				<h3><span class="small-text not-bold">'.__( 'Date: ', 'event_espresso' ). '</span>'. $event_date .'</h3>
1081
-				<span class="admin-page-header-go-back-lnk not-bold">' . $back_2_reg_lnk . '</span>
1079
+				<h1><span class="small-text not-bold">'.__('Event: ', 'event_espresso').'</span>'.$event_name.'</h1>
1080
+				<h3><span class="small-text not-bold">'.__('Date: ', 'event_espresso').'</span>'.$event_date.'</h3>
1081
+				<span class="admin-page-header-go-back-lnk not-bold">' . $back_2_reg_lnk.'</span>
1082 1082
 			</div>
1083 1083
 			';
1084 1084
 
@@ -1116,7 +1116,7 @@  discard block
 block discarded – undo
1116 1116
 
1117 1117
 		$this->_set_registration_object();
1118 1118
 
1119
-		if ( is_object( $this->_registration )) {
1119
+		if (is_object($this->_registration)) {
1120 1120
 			$transaction = $this->_registration->transaction() ? $this->_registration->transaction() : EE_Transaction::new_instance();
1121 1121
 			$this->_session = $transaction->session_data();
1122 1122
 
@@ -1124,10 +1124,10 @@  discard block
 block discarded – undo
1124 1124
 
1125 1125
 
1126 1126
 			$this->_template_args['reg_nmbr']['value'] = $this->_registration->ID();
1127
-			$this->_template_args['reg_nmbr']['label'] = __( 'Registration Number', 'event_espresso' );
1127
+			$this->_template_args['reg_nmbr']['label'] = __('Registration Number', 'event_espresso');
1128 1128
 
1129
-			$this->_template_args['reg_datetime']['value'] =  $this->_registration->pretty_date('l F j, Y','g:i:s a') ;
1130
-			$this->_template_args['reg_datetime']['label'] = __( 'Date', 'event_espresso' );
1129
+			$this->_template_args['reg_datetime']['value'] = $this->_registration->pretty_date('l F j, Y', 'g:i:s a');
1130
+			$this->_template_args['reg_datetime']['label'] = __('Date', 'event_espresso');
1131 1131
 
1132 1132
 			$this->_template_args['grand_total'] = $transaction->total();
1133 1133
 
@@ -1135,19 +1135,19 @@  discard block
 block discarded – undo
1135 1135
 			// link back to overview
1136 1136
 			$this->_template_args['reg_overview_url'] = REG_ADMIN_URL;
1137 1137
 			$this->_template_args['registration'] = $this->_registration;
1138
-			$this->_template_args['filtered_registrations_link'] = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'default', 'event_id' => $event_id ), REG_ADMIN_URL );
1139
-			$this->_template_args['filtered_transactions_link'] = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'default', 'EVT_ID' => $event_id, 'page' => 'espresso_transactions' ), admin_url( 'admin.php' ) );
1140
-			$this->_template_args['event_link'] = EE_Admin_Page::add_query_args_and_nonce( array( 'page' => 'espresso_events', 'action' => 'edit', 'post' => $event_id ), admin_url( 'admin.php' ) );
1138
+			$this->_template_args['filtered_registrations_link'] = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'default', 'event_id' => $event_id), REG_ADMIN_URL);
1139
+			$this->_template_args['filtered_transactions_link'] = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'default', 'EVT_ID' => $event_id, 'page' => 'espresso_transactions'), admin_url('admin.php'));
1140
+			$this->_template_args['event_link'] = EE_Admin_Page::add_query_args_and_nonce(array('page' => 'espresso_events', 'action' => 'edit', 'post' => $event_id), admin_url('admin.php'));
1141 1141
 
1142 1142
 			//next and previous links
1143
-			$next_reg = $this->_registration->next(null, array(), 'REG_ID' );
1144
-			$this->_template_args['next_registration'] = $next_reg ? $this->_next_link( EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'view_registration', '_REG_ID' => $next_reg['REG_ID'] ), REG_ADMIN_URL ), 'dashicons dashicons-arrow-right ee-icon-size-22' ) : '';
1145
-			$previous_reg = $this->_registration->previous( null, array(), 'REG_ID' );
1146
-			$this->_template_args['previous_registration'] = $previous_reg ? $this->_previous_link( EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'view_registration', '_REG_ID' => $previous_reg['REG_ID'] ), REG_ADMIN_URL ), 'dashicons dashicons-arrow-left ee-icon-size-22' ) : '';
1143
+			$next_reg = $this->_registration->next(null, array(), 'REG_ID');
1144
+			$this->_template_args['next_registration'] = $next_reg ? $this->_next_link(EE_Admin_Page::add_query_args_and_nonce(array('action' => 'view_registration', '_REG_ID' => $next_reg['REG_ID']), REG_ADMIN_URL), 'dashicons dashicons-arrow-right ee-icon-size-22') : '';
1145
+			$previous_reg = $this->_registration->previous(null, array(), 'REG_ID');
1146
+			$this->_template_args['previous_registration'] = $previous_reg ? $this->_previous_link(EE_Admin_Page::add_query_args_and_nonce(array('action' => 'view_registration', '_REG_ID' => $previous_reg['REG_ID']), REG_ADMIN_URL), 'dashicons dashicons-arrow-left ee-icon-size-22') : '';
1147 1147
 
1148 1148
 			// grab header
1149
-			$template_path = REG_TEMPLATE_PATH . 'reg_admin_details_header.template.php';
1150
-			$this->_template_args['admin_page_header'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
1149
+			$template_path = REG_TEMPLATE_PATH.'reg_admin_details_header.template.php';
1150
+			$this->_template_args['admin_page_header'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE);
1151 1151
 
1152 1152
 		} else {
1153 1153
 
@@ -1166,17 +1166,17 @@  discard block
 block discarded – undo
1166 1166
 
1167 1167
 
1168 1168
 	protected function _registration_details_metaboxes() {
1169
-		do_action( 'AHEE__Registrations_Admin_Page___registration_details_metabox__start', $this );
1169
+		do_action('AHEE__Registrations_Admin_Page___registration_details_metabox__start', $this);
1170 1170
 		$this->_set_registration_object();
1171 1171
 		$attendee = $this->_registration instanceof EE_Registration ? $this->_registration->attendee() : null;
1172
-		add_meta_box( 'edit-reg-status-mbox', __( 'Registration Status', 'event_espresso' ), array( $this, 'set_reg_status_buttons_metabox' ), $this->wp_page_slug, 'normal', 'high' );
1173
-		add_meta_box( 'edit-reg-details-mbox', __( 'Registration Details', 'event_espresso' ), array( $this, '_reg_details_meta_box' ), $this->wp_page_slug, 'normal', 'high' );
1174
-		if ( $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can('ee_edit_registration', 'edit-reg-questions-mbox' ) ) {
1175
-			add_meta_box( 'edit-reg-questions-mbox', __( 'Registration Form Answers', 'event_espresso' ), array( $this, '_reg_questions_meta_box' ), $this->wp_page_slug, 'normal', 'high' );
1172
+		add_meta_box('edit-reg-status-mbox', __('Registration Status', 'event_espresso'), array($this, 'set_reg_status_buttons_metabox'), $this->wp_page_slug, 'normal', 'high');
1173
+		add_meta_box('edit-reg-details-mbox', __('Registration Details', 'event_espresso'), array($this, '_reg_details_meta_box'), $this->wp_page_slug, 'normal', 'high');
1174
+		if ($attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can('ee_edit_registration', 'edit-reg-questions-mbox')) {
1175
+			add_meta_box('edit-reg-questions-mbox', __('Registration Form Answers', 'event_espresso'), array($this, '_reg_questions_meta_box'), $this->wp_page_slug, 'normal', 'high');
1176 1176
 		}
1177
-		add_meta_box( 'edit-reg-registrant-mbox', __( 'Contact Details', 'event_espresso' ), array( $this, '_reg_registrant_side_meta_box' ), $this->wp_page_slug, 'side', 'high' );
1178
-		if ( $this->_registration->group_size() > 1 ) {
1179
-			add_meta_box( 'edit-reg-attendees-mbox', __( 'Other Registrations in this Transaction', 'event_espresso' ), array( $this, '_reg_attendees_meta_box' ), $this->wp_page_slug, 'normal', 'high' );
1177
+		add_meta_box('edit-reg-registrant-mbox', __('Contact Details', 'event_espresso'), array($this, '_reg_registrant_side_meta_box'), $this->wp_page_slug, 'side', 'high');
1178
+		if ($this->_registration->group_size() > 1) {
1179
+			add_meta_box('edit-reg-attendees-mbox', __('Other Registrations in this Transaction', 'event_espresso'), array($this, '_reg_attendees_meta_box'), $this->wp_page_slug, 'normal', 'high');
1180 1180
 		}
1181 1181
 	}
1182 1182
 
@@ -1197,23 +1197,23 @@  discard block
 block discarded – undo
1197 1197
 
1198 1198
 		//let's get an array of all possible buttons that we can just reference
1199 1199
 		$status_buttons = $this->_get_reg_status_buttons();
1200
-		$template_args[ 'reg_status_value' ] = $this->_registration->pretty_status();
1201
-		$template_args[ 'reg_status_class' ] = 'status-' . $this->_registration->status_ID();
1200
+		$template_args['reg_status_value'] = $this->_registration->pretty_status();
1201
+		$template_args['reg_status_class'] = 'status-'.$this->_registration->status_ID();
1202 1202
 		$template_args['attendee'] = $this->_registration->attendee();
1203
-		$template = REG_TEMPLATE_PATH . 'reg_status_change_buttons.template.php';
1204
-		if ( $this->_set_registration_object() ) {
1203
+		$template = REG_TEMPLATE_PATH.'reg_status_change_buttons.template.php';
1204
+		if ($this->_set_registration_object()) {
1205 1205
 			$current_status = $this->_registration->status_ID();
1206
-			unset( $status_buttons[$current_status] );
1207
-			if ( $current_status != EEM_Registration::status_id_pending_payment && $is_complete ) {
1208
-				unset( $status_buttons[EEM_Registration::status_id_pending_payment] );
1206
+			unset($status_buttons[$current_status]);
1207
+			if ($current_status != EEM_Registration::status_id_pending_payment && $is_complete) {
1208
+				unset($status_buttons[EEM_Registration::status_id_pending_payment]);
1209 1209
 			}
1210
-			$template_args['status_buttons'] = implode( "\n", $status_buttons );
1210
+			$template_args['status_buttons'] = implode("\n", $status_buttons);
1211 1211
 		}
1212 1212
 		$template_args['form_url'] = REG_ADMIN_URL;
1213 1213
 		$template_args['REG_ID'] = $this->_registration->ID();
1214
-		$template_args['nonce'] = wp_nonce_field( 'change_reg_status_nonce',  'change_reg_status_nonce', FALSE, FALSE );
1214
+		$template_args['nonce'] = wp_nonce_field('change_reg_status_nonce', 'change_reg_status_nonce', FALSE, FALSE);
1215 1215
 
1216
-		EEH_Template::display_template( $template, $template_args );
1216
+		EEH_Template::display_template($template, $template_args);
1217 1217
 
1218 1218
 	}
1219 1219
 
@@ -1227,11 +1227,11 @@  discard block
 block discarded – undo
1227 1227
 	private function _get_reg_status_buttons() {
1228 1228
 
1229 1229
 		$buttons = array(
1230
-			EEM_Registration::status_id_approved => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-' . EEM_Registration::status_id_approved . '" value="' . EEH_Template::pretty_status( EEM_Registration::status_id_approved, FALSE, 'sentence' ) . '">',
1231
-			EEM_Registration::status_id_pending_payment => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-' . EEM_Registration::status_id_pending_payment . '" value="' . EEH_Template::pretty_status( EEM_Registration::status_id_pending_payment, FALSE, 'sentence' ) . '">',
1232
-			EEM_Registration::status_id_not_approved => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-' . EEM_Registration::status_id_not_approved . '" value="' . EEH_Template::pretty_status( EEM_Registration::status_id_not_approved, FALSE, 'sentence' ) . '">',
1233
-			EEM_Registration::status_id_declined => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-' . EEM_Registration::status_id_declined . '" value="' . EEH_Template::pretty_status( EEM_Registration::status_id_declined, FALSE, 'sentence' ) . '">',
1234
-			EEM_Registration::status_id_cancelled =>'<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-' . EEM_Registration::status_id_cancelled . '" value="' . EEH_Template::pretty_status( EEM_Registration::status_id_cancelled, FALSE, 'sentence' ) . '">',
1230
+			EEM_Registration::status_id_approved => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-'.EEM_Registration::status_id_approved.'" value="'.EEH_Template::pretty_status(EEM_Registration::status_id_approved, FALSE, 'sentence').'">',
1231
+			EEM_Registration::status_id_pending_payment => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-'.EEM_Registration::status_id_pending_payment.'" value="'.EEH_Template::pretty_status(EEM_Registration::status_id_pending_payment, FALSE, 'sentence').'">',
1232
+			EEM_Registration::status_id_not_approved => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-'.EEM_Registration::status_id_not_approved.'" value="'.EEH_Template::pretty_status(EEM_Registration::status_id_not_approved, FALSE, 'sentence').'">',
1233
+			EEM_Registration::status_id_declined => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-'.EEM_Registration::status_id_declined.'" value="'.EEH_Template::pretty_status(EEM_Registration::status_id_declined, FALSE, 'sentence').'">',
1234
+			EEM_Registration::status_id_cancelled =>'<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-'.EEM_Registration::status_id_cancelled.'" value="'.EEH_Template::pretty_status(EEM_Registration::status_id_cancelled, FALSE, 'sentence').'">',
1235 1235
 			);
1236 1236
 		return $buttons;
1237 1237
 	}
@@ -1245,13 +1245,13 @@  discard block
 block discarded – undo
1245 1245
 	 *
1246 1246
 	 * @return array  (array with reg_id(s) updated and whether update was successful.
1247 1247
 	 */
1248
-	protected function _set_registration_status_from_request( $status = false, $notify = false ) {
1249
-		$REG_ID = isset( $this->_req_data['_REG_ID'] ) ? (array) $this->_req_data['_REG_ID'] : array();
1248
+	protected function _set_registration_status_from_request($status = false, $notify = false) {
1249
+		$REG_ID = isset($this->_req_data['_REG_ID']) ? (array) $this->_req_data['_REG_ID'] : array();
1250 1250
 
1251
-		$success = $this->_set_registration_status( $REG_ID, $status );
1251
+		$success = $this->_set_registration_status($REG_ID, $status);
1252 1252
 
1253 1253
 		//notify?
1254
-		if ( $success && $notify && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_registrations_resend_registration' ) ) {
1254
+		if ($success && $notify && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_registrations_resend_registration')) {
1255 1255
 			$this->_process_resend_registration();
1256 1256
 		}
1257 1257
 
@@ -1269,19 +1269,19 @@  discard block
 block discarded – undo
1269 1269
 	 * @param bool $status
1270 1270
 	 * @return array (an array with 'success' key representing whether status change was successful, and 'REG_ID' as the array of updated registrations).
1271 1271
 	 */
1272
-	protected function _set_registration_status( $REG_ID, $status = false ) {
1272
+	protected function _set_registration_status($REG_ID, $status = false) {
1273 1273
 		$success = true;
1274 1274
 		// set default status if none is passed
1275 1275
 		$status = $status ? $status : EEM_Registration::status_id_pending_payment;
1276 1276
 
1277 1277
 		//typecast and sanitize reg_id
1278
-		$reg_ids = array_filter( (array) $REG_ID, 'absint' );
1278
+		$reg_ids = array_filter((array) $REG_ID, 'absint');
1279 1279
 
1280 1280
 		//loop through REG_ID's and change status
1281
-		foreach ( $reg_ids as $r_id ) {
1282
-			$registration = EEM_Registration::instance()->get_one_by_ID( $r_id );
1283
-			if ( $registration instanceof EE_Registration ) {
1284
-				$registration->set_status( $status );
1281
+		foreach ($reg_ids as $r_id) {
1282
+			$registration = EEM_Registration::instance()->get_one_by_ID($r_id);
1283
+			if ($registration instanceof EE_Registration) {
1284
+				$registration->set_status($status);
1285 1285
 				$result = $registration->save();
1286 1286
 
1287 1287
 				//verifying explicit fails because update *may* just return 0 for 0 rows affected
@@ -1293,7 +1293,7 @@  discard block
 block discarded – undo
1293 1293
 		$this->_req_data['_REG_ID'] = $reg_ids;
1294 1294
 
1295 1295
 		//return $success and processed registrations
1296
-		return array( 'REG_ID' => $reg_ids, 'success' => $success );
1296
+		return array('REG_ID' => $reg_ids, 'success' => $success);
1297 1297
 	}
1298 1298
 
1299 1299
 
@@ -1305,37 +1305,37 @@  discard block
 block discarded – undo
1305 1305
 	 * @param   bool    $notify indicates whether the _set_registration_status_from_request does notifications or not.
1306 1306
 	 * @return void
1307 1307
 	 */
1308
-	protected function _reg_status_change_return( $STS_ID, $notify = false ) {
1308
+	protected function _reg_status_change_return($STS_ID, $notify = false) {
1309 1309
 
1310
-		$result = ! empty( $STS_ID ) ? $this->_set_registration_status_from_request( $STS_ID, $notify ) : array( 'success' => false );
1310
+		$result = ! empty($STS_ID) ? $this->_set_registration_status_from_request($STS_ID, $notify) : array('success' => false);
1311 1311
 
1312 1312
 
1313
-		$success = isset( $result['success'] ) && $result['success'];
1313
+		$success = isset($result['success']) && $result['success'];
1314 1314
 
1315 1315
 		//setup success message
1316
-		if ( $success ) {
1317
-			$msg = is_array( $result['REG_ID'] ) && count( $result['REG_ID'] ) > 1  ? sprintf( __('Registration status has been set to %s', 'event_espresso'), EEH_Template::pretty_status($STS_ID, false, 'lower' ) ) :  sprintf( __('Registrations have been set to %s.', 'event_espresso'), EEH_Template::pretty_status($STS_ID, false, 'lower' ) ) ;
1318
-			EE_Error::add_success( $msg );
1316
+		if ($success) {
1317
+			$msg = is_array($result['REG_ID']) && count($result['REG_ID']) > 1 ? sprintf(__('Registration status has been set to %s', 'event_espresso'), EEH_Template::pretty_status($STS_ID, false, 'lower')) : sprintf(__('Registrations have been set to %s.', 'event_espresso'), EEH_Template::pretty_status($STS_ID, false, 'lower'));
1318
+			EE_Error::add_success($msg);
1319 1319
 		} else {
1320
-			EE_Error::add_error( __('Something went wrong, and the status was not changed', 'event_espresso' ), __FILE__, __LINE__, __FUNCTION__ );
1320
+			EE_Error::add_error(__('Something went wrong, and the status was not changed', 'event_espresso'), __FILE__, __LINE__, __FUNCTION__);
1321 1321
 		}
1322 1322
 
1323
-		$route = isset( $this->_req_data['return'] ) && $this->_req_data['return'] == 'view_registration' ? array( 'action' => 'view_registration', '_REG_ID' => $result['REG_ID'][0] ) : array( 'action' => 'default' );
1323
+		$route = isset($this->_req_data['return']) && $this->_req_data['return'] == 'view_registration' ? array('action' => 'view_registration', '_REG_ID' => $result['REG_ID'][0]) : array('action' => 'default');
1324 1324
 		//unset nonces
1325
-		foreach ( $this->_req_data as $ref => $value ) {
1326
-			if ( strpos( $ref, 'nonce' ) !== false ) {
1327
-				unset( $this->_req_data[$ref] );
1325
+		foreach ($this->_req_data as $ref => $value) {
1326
+			if (strpos($ref, 'nonce') !== false) {
1327
+				unset($this->_req_data[$ref]);
1328 1328
 				continue;
1329 1329
 			}
1330 1330
 
1331
-			$value = is_array( $value ) ? array_map( 'urlencode', $value ) : urlencode( $value );
1331
+			$value = is_array($value) ? array_map('urlencode', $value) : urlencode($value);
1332 1332
 			$this->_req_data[$ref] = $value;
1333 1333
 		}
1334 1334
 
1335 1335
 		//merge request vars so that the reloaded list table contains any existing filter query params
1336
-		$route = array_merge( $this->_req_data, $route );
1336
+		$route = array_merge($this->_req_data, $route);
1337 1337
 
1338
-		$this->_redirect_after_action( false, '', '', $route, true );
1338
+		$this->_redirect_after_action(false, '', '', $route, true);
1339 1339
 	}
1340 1340
 
1341 1341
 
@@ -1347,29 +1347,29 @@  discard block
 block discarded – undo
1347 1347
 	protected function _change_reg_status() {
1348 1348
 		$this->_req_data['return'] = 'view_registration';
1349 1349
 		//set notify based on whether the send notifications toggle is set or not
1350
-		$notify = ! empty( $this->_req_data['txn_reg_status_change']['send_notifications'] );
1351
-		$this->_req_data[ '_reg_status_id' ] = isset( $this->_req_data[ '_reg_status_id' ] ) ? $this->_req_data[ '_reg_status_id' ] : '';
1350
+		$notify = ! empty($this->_req_data['txn_reg_status_change']['send_notifications']);
1351
+		$this->_req_data['_reg_status_id'] = isset($this->_req_data['_reg_status_id']) ? $this->_req_data['_reg_status_id'] : '';
1352 1352
 
1353
-		switch ( $this->_req_data['_reg_status_id'] ) {
1354
-			case EEH_Template::pretty_status( EEM_Registration::status_id_approved, false, 'sentence' ) :
1355
-				$this->approve_registration( $notify );
1353
+		switch ($this->_req_data['_reg_status_id']) {
1354
+			case EEH_Template::pretty_status(EEM_Registration::status_id_approved, false, 'sentence') :
1355
+				$this->approve_registration($notify);
1356 1356
 				break;
1357
-			case EEH_Template::pretty_status( EEM_Registration::status_id_pending_payment, false, 'sentence' ) :
1358
-				$this->pending_registration( $notify );
1357
+			case EEH_Template::pretty_status(EEM_Registration::status_id_pending_payment, false, 'sentence') :
1358
+				$this->pending_registration($notify);
1359 1359
 				break;
1360
-			case EEH_Template::pretty_status( EEM_Registration::status_id_not_approved, false, 'sentence' ) :
1361
-				$this->not_approve_registration( $notify );
1360
+			case EEH_Template::pretty_status(EEM_Registration::status_id_not_approved, false, 'sentence') :
1361
+				$this->not_approve_registration($notify);
1362 1362
 				break;
1363
-			case EEH_Template::pretty_status( EEM_Registration::status_id_declined, false, 'sentence' ) :
1364
-				$this->decline_registration( $notify );
1363
+			case EEH_Template::pretty_status(EEM_Registration::status_id_declined, false, 'sentence') :
1364
+				$this->decline_registration($notify);
1365 1365
 				break;
1366
-			case EEH_Template::pretty_status( EEM_Registration::status_id_cancelled, false, 'sentence' ) :
1367
-				$this->cancel_registration( $notify );
1366
+			case EEH_Template::pretty_status(EEM_Registration::status_id_cancelled, false, 'sentence') :
1367
+				$this->cancel_registration($notify);
1368 1368
 				break;
1369 1369
 			default :
1370 1370
 				$result['success'] = false;
1371
-				unset( $this->_req_data['return'] );
1372
-				$this->_reg_status_change_return( '', false );
1371
+				unset($this->_req_data['return']);
1372
+				$this->_reg_status_change_return('', false);
1373 1373
 				break;
1374 1374
 		}
1375 1375
 	}
@@ -1382,8 +1382,8 @@  discard block
 block discarded – undo
1382 1382
 	*		@param bool $notify whether or not to notify the registrant about their approval.
1383 1383
 	*		@return void
1384 1384
 	*/
1385
-	protected function approve_registration( $notify = false ) {
1386
-		$this->_reg_status_change_return( EEM_Registration::status_id_approved, $notify );
1385
+	protected function approve_registration($notify = false) {
1386
+		$this->_reg_status_change_return(EEM_Registration::status_id_approved, $notify);
1387 1387
 	}
1388 1388
 
1389 1389
 
@@ -1395,8 +1395,8 @@  discard block
 block discarded – undo
1395 1395
 	*		@param bool $notify whether or not to notify the registrant about their approval.
1396 1396
 	*		@return void
1397 1397
 	*/
1398
-	protected function decline_registration( $notify = false ) {
1399
-		$this->_reg_status_change_return( EEM_Registration::status_id_declined, $notify );
1398
+	protected function decline_registration($notify = false) {
1399
+		$this->_reg_status_change_return(EEM_Registration::status_id_declined, $notify);
1400 1400
 	}
1401 1401
 
1402 1402
 
@@ -1408,8 +1408,8 @@  discard block
 block discarded – undo
1408 1408
 	*		@param bool $notify whether or not to notify the registrant about their approval.
1409 1409
 	*		@return void
1410 1410
 	*/
1411
-	protected function cancel_registration( $notify = false ) {
1412
-		$this->_reg_status_change_return( EEM_Registration::status_id_cancelled, $notify );
1411
+	protected function cancel_registration($notify = false) {
1412
+		$this->_reg_status_change_return(EEM_Registration::status_id_cancelled, $notify);
1413 1413
 	}
1414 1414
 
1415 1415
 
@@ -1422,8 +1422,8 @@  discard block
 block discarded – undo
1422 1422
 	*		@param bool $notify whether or not to notify the registrant about their approval.
1423 1423
 	*		@return void
1424 1424
 	*/
1425
-	protected function not_approve_registration( $notify = false ) {
1426
-		$this->_reg_status_change_return( EEM_Registration::status_id_not_approved, $notify );
1425
+	protected function not_approve_registration($notify = false) {
1426
+		$this->_reg_status_change_return(EEM_Registration::status_id_not_approved, $notify);
1427 1427
 	}
1428 1428
 
1429 1429
 
@@ -1434,8 +1434,8 @@  discard block
 block discarded – undo
1434 1434
 	*		@param bool $notify whether or not to notify the registrant about their approval.
1435 1435
 	*		@return void
1436 1436
 	*/
1437
-	protected function pending_registration( $notify = false ) {
1438
-		$this->_reg_status_change_return( EEM_Registration::status_id_pending_payment, $notify );
1437
+	protected function pending_registration($notify = false) {
1438
+		$this->_reg_status_change_return(EEM_Registration::status_id_pending_payment, $notify);
1439 1439
 	}
1440 1440
 
1441 1441
 
@@ -1449,75 +1449,75 @@  discard block
 block discarded – undo
1449 1449
 	public function _reg_details_meta_box() {
1450 1450
 		EEH_Autoloader::register_line_item_display_autoloaders();
1451 1451
 		EEH_Autoloader::register_line_item_filter_autoloaders();
1452
-		EE_Registry::instance()->load_Helper( 'Line_Item' );
1452
+		EE_Registry::instance()->load_Helper('Line_Item');
1453 1453
 		$transaction = $this->_registration->transaction() ? $this->_registration->transaction() : EE_Transaction::new_instance();
1454 1454
 		$this->_session = $transaction->session_data();
1455 1455
 
1456 1456
 		$filters = new EE_Line_Item_Filter_Collection();
1457
-		$filters->add( new EE_Single_Registration_Line_Item_Filter( $this->_registration ) );
1458
-		$filters->add( new EE_Non_Zero_Line_Item_Filter() );
1459
-		$line_item_filter_processor = new EE_Line_Item_Filter_Processor( $filters, $transaction->total_line_item() );
1457
+		$filters->add(new EE_Single_Registration_Line_Item_Filter($this->_registration));
1458
+		$filters->add(new EE_Non_Zero_Line_Item_Filter());
1459
+		$line_item_filter_processor = new EE_Line_Item_Filter_Processor($filters, $transaction->total_line_item());
1460 1460
 		$filtered_line_item_tree = $line_item_filter_processor->process();
1461 1461
 
1462 1462
 		$this->_template_args['REG_ID'] = $this->_registration->ID();
1463
-		$line_item_display = new EE_Line_Item_Display( 'reg_admin_table', 'EE_Admin_Table_Registration_Line_Item_Display_Strategy' );
1464
-		$this->_template_args['line_item_table'] = $line_item_display->display_line_item( $filtered_line_item_tree, array( 'EE_Registration' => $this->_registration ) );
1463
+		$line_item_display = new EE_Line_Item_Display('reg_admin_table', 'EE_Admin_Table_Registration_Line_Item_Display_Strategy');
1464
+		$this->_template_args['line_item_table'] = $line_item_display->display_line_item($filtered_line_item_tree, array('EE_Registration' => $this->_registration));
1465 1465
 
1466 1466
 
1467 1467
 		$attendee = $this->_registration->attendee();
1468 1468
 
1469 1469
 
1470
-		$this->_template_args['view_transaction_button'] = EE_Registry::instance()->CAP->current_user_can( 'ee_read_transaction', 'espresso_transactions_view_transaction' ) ?EEH_Template::get_button_or_link( EE_Admin_Page::add_query_args_and_nonce( array('action'=> 'view_transaction', 'TXN_ID' => $transaction->ID() ), TXN_ADMIN_URL ), __(' View Transaction'), 'button secondary-button right', 'dashicons dashicons-cart' ) : '';
1471
-		$this->_template_args['resend_registration_button'] = $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_registrations_resend_registration' ) ?EEH_Template::get_button_or_link( EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'resend_registration', '_REG_ID'=>$this->_registration->ID(), 'redirect_to' => 'view_registration' ), REG_ADMIN_URL ), __(' Resend Registration'), 'button secondary-button right', 'dashicons dashicons-email-alt' ) : '';
1470
+		$this->_template_args['view_transaction_button'] = EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction') ? EEH_Template::get_button_or_link(EE_Admin_Page::add_query_args_and_nonce(array('action'=> 'view_transaction', 'TXN_ID' => $transaction->ID()), TXN_ADMIN_URL), __(' View Transaction'), 'button secondary-button right', 'dashicons dashicons-cart') : '';
1471
+		$this->_template_args['resend_registration_button'] = $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_registrations_resend_registration') ? EEH_Template::get_button_or_link(EE_Admin_Page::add_query_args_and_nonce(array('action'=>'resend_registration', '_REG_ID'=>$this->_registration->ID(), 'redirect_to' => 'view_registration'), REG_ADMIN_URL), __(' Resend Registration'), 'button secondary-button right', 'dashicons dashicons-email-alt') : '';
1472 1472
 
1473 1473
 
1474 1474
 		$this->_template_args['currency_sign'] = EE_Registry::instance()->CFG->currency->sign;
1475
-		$payment = $transaction->get_first_related( 'Payment' );
1475
+		$payment = $transaction->get_first_related('Payment');
1476 1476
 		$payment = ! $payment instanceof EE_Payment ? EE_Payment::new_instance() : $payment;
1477
-		$payment_method = $payment->get_first_related( 'Payment_Method' );
1477
+		$payment_method = $payment->get_first_related('Payment_Method');
1478 1478
 		$payment_method = ! $payment_method instanceof EE_Payment_Method ? EE_Payment_Method::new_instance() : $payment_method;
1479
-		$reg_status_class = 'status-' . $this->_registration->status_ID();
1479
+		$reg_status_class = 'status-'.$this->_registration->status_ID();
1480 1480
 		$reg_details = array(
1481 1481
 			'payment_method' => $payment_method->name(),
1482 1482
 			'response_msg' => $payment->gateway_response(),
1483
-			'registration_id' => $this->_registration->get( 'REG_code' ),
1483
+			'registration_id' => $this->_registration->get('REG_code'),
1484 1484
 			'registration_session' => $this->_registration->session_ID(),
1485
-			'ip_address' => isset( $this->_session['ip_address'] ) ? $this->_session['ip_address'] : '',
1486
-			'user_agent' => isset( $this->_session['user_agent'] ) ? $this->_session['user_agent'] : '',
1485
+			'ip_address' => isset($this->_session['ip_address']) ? $this->_session['ip_address'] : '',
1486
+			'user_agent' => isset($this->_session['user_agent']) ? $this->_session['user_agent'] : '',
1487 1487
 			);
1488 1488
 
1489 1489
 
1490
-		if ( isset( $reg_details['registration_id'] )) {
1490
+		if (isset($reg_details['registration_id'])) {
1491 1491
 			$this->_template_args['reg_details']['registration_id']['value'] = $reg_details['registration_id'];
1492
-			$this->_template_args['reg_details']['registration_id']['label'] = __( 'Registration ID', 'event_espresso' );
1492
+			$this->_template_args['reg_details']['registration_id']['label'] = __('Registration ID', 'event_espresso');
1493 1493
 			$this->_template_args['reg_details']['registration_id']['class'] = 'regular-text';
1494 1494
 		}
1495 1495
 
1496
-		if ( isset( $reg_details['payment_method'] ) ) {
1496
+		if (isset($reg_details['payment_method'])) {
1497 1497
 			$this->_template_args['reg_details']['payment_method']['value'] = $reg_details['payment_method'];
1498
-			$this->_template_args['reg_details']['payment_method']['label'] = __( 'Most Recent Payment Method', 'event_espresso' );
1498
+			$this->_template_args['reg_details']['payment_method']['label'] = __('Most Recent Payment Method', 'event_espresso');
1499 1499
 			$this->_template_args['reg_details']['payment_method']['class'] = 'regular-text';
1500 1500
 			$this->_template_args['reg_details']['response_msg']['value'] = $reg_details['response_msg'];
1501
-			$this->_template_args['reg_details']['response_msg']['label'] = __( 'Payment method response', 'event_espresso' );
1501
+			$this->_template_args['reg_details']['response_msg']['label'] = __('Payment method response', 'event_espresso');
1502 1502
 			$this->_template_args['reg_details']['response_msg']['class'] = 'regular-text';
1503 1503
 		}
1504 1504
 
1505 1505
 		$this->_template_args['reg_details']['registration_session']['value'] = $reg_details['registration_session'];
1506
-		$this->_template_args['reg_details']['registration_session']['label'] = __( 'Registration Session', 'event_espresso' );
1506
+		$this->_template_args['reg_details']['registration_session']['label'] = __('Registration Session', 'event_espresso');
1507 1507
 		$this->_template_args['reg_details']['registration_session']['class'] = 'regular-text';
1508 1508
 
1509 1509
 		$this->_template_args['reg_details']['ip_address']['value'] = $reg_details['ip_address'];
1510
-		$this->_template_args['reg_details']['ip_address']['label'] = __( 'Registration placed from IP', 'event_espresso' );
1510
+		$this->_template_args['reg_details']['ip_address']['label'] = __('Registration placed from IP', 'event_espresso');
1511 1511
 		$this->_template_args['reg_details']['ip_address']['class'] = 'regular-text';
1512 1512
 
1513 1513
 		$this->_template_args['reg_details']['user_agent']['value'] = $reg_details['user_agent'];
1514
-		$this->_template_args['reg_details']['user_agent']['label'] = __( 'Registrant User Agent', 'event_espresso' );
1514
+		$this->_template_args['reg_details']['user_agent']['label'] = __('Registrant User Agent', 'event_espresso');
1515 1515
 		$this->_template_args['reg_details']['user_agent']['class'] = 'large-text';
1516 1516
 
1517
-		$this->_template_args['event_link'] = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'default', 'event_id' => $this->_registration->event_ID()), REG_ADMIN_URL );
1517
+		$this->_template_args['event_link'] = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'default', 'event_id' => $this->_registration->event_ID()), REG_ADMIN_URL);
1518 1518
 
1519
-		$template_path = REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_reg_details.template.php';
1520
-		echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
1519
+		$template_path = REG_TEMPLATE_PATH.'reg_admin_details_main_meta_box_reg_details.template.php';
1520
+		echo EEH_Template::display_template($template_path, $this->_template_args, TRUE);
1521 1521
 
1522 1522
 	}
1523 1523
 
@@ -1531,14 +1531,14 @@  discard block
 block discarded – undo
1531 1531
 	*/
1532 1532
 	public function _reg_questions_meta_box() {
1533 1533
 		//allow someone to override this method entirely
1534
-		if( apply_filters( 'FHEE__Registrations_Admin_Page___reg_questions_meta_box__do_default', true, $this, $this->_registration ) ) {
1535
-			$form = $this->_get_reg_custom_questions_form( $this->_registration->ID() );
1536
-			$this->_template_args[ 'att_questions' ] = count( $form->subforms() ) > 0 ? $form->get_html_and_js() : '';
1534
+		if (apply_filters('FHEE__Registrations_Admin_Page___reg_questions_meta_box__do_default', true, $this, $this->_registration)) {
1535
+			$form = $this->_get_reg_custom_questions_form($this->_registration->ID());
1536
+			$this->_template_args['att_questions'] = count($form->subforms()) > 0 ? $form->get_html_and_js() : '';
1537 1537
 			$this->_template_args['reg_questions_form_action'] = 'edit_registration';
1538 1538
 			$this->_template_args['REG_ID'] = $this->_registration->ID();
1539 1539
 
1540
-			$template_path = REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_reg_questions.template.php';
1541
-			echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
1540
+			$template_path = REG_TEMPLATE_PATH.'reg_admin_details_main_meta_box_reg_questions.template.php';
1541
+			echo EEH_Template::display_template($template_path, $this->_template_args, TRUE);
1542 1542
 		}
1543 1543
 	}
1544 1544
 
@@ -1552,12 +1552,12 @@  discard block
 block discarded – undo
1552 1552
 	 * @param        string $output
1553 1553
 	 * @return        string
1554 1554
 	 */
1555
-	public function form_before_question_group( $output ) {
1555
+	public function form_before_question_group($output) {
1556 1556
 		EE_Error::doing_it_wrong(
1557
-			__CLASS__ . '::' . __FUNCTION__,
1558
-			__( 'This method would have been protected but was used on a filter callback'
1557
+			__CLASS__.'::'.__FUNCTION__,
1558
+			__('This method would have been protected but was used on a filter callback'
1559 1559
 				. 'so needed to be public. Please discontinue usage as it will be removed soon.',
1560
-				'event_espresso' ),
1560
+				'event_espresso'),
1561 1561
 			'4.8.32.rc.000'
1562 1562
 		);
1563 1563
 		return '
@@ -1576,20 +1576,20 @@  discard block
 block discarded – undo
1576 1576
 	 * @param        string $output
1577 1577
 	 * @return        string
1578 1578
 	 */
1579
-	public function form_after_question_group( $output ) {
1579
+	public function form_after_question_group($output) {
1580 1580
 		EE_Error::doing_it_wrong(
1581
-			__CLASS__ . '::' . __FUNCTION__,
1582
-			__( 'This method would have been protected but was used on a filter callback'
1581
+			__CLASS__.'::'.__FUNCTION__,
1582
+			__('This method would have been protected but was used on a filter callback'
1583 1583
 				. 'so needed to be public. Please discontinue usage as it will be removed soon.',
1584
-				'event_espresso' ),
1584
+				'event_espresso'),
1585 1585
 			'4.8.32.rc.000'
1586 1586
 		);
1587 1587
 		return  '
1588 1588
 			<tr class="hide-if-no-js">
1589 1589
 				<th> </th>
1590 1590
 				<td class="reg-admin-edit-attendee-question-td">
1591
-					<a class="reg-admin-edit-attendee-question-lnk" href="#" title="' . esc_attr__( 'click to edit question', 'event_espresso' ) . '">
1592
-						<span class="reg-admin-edit-question-group-spn lt-grey-txt">' . __( 'edit the above question group', 'event_espresso' ) . '</span>
1591
+					<a class="reg-admin-edit-attendee-question-lnk" href="#" title="' . esc_attr__('click to edit question', 'event_espresso').'">
1592
+						<span class="reg-admin-edit-question-group-spn lt-grey-txt">' . __('edit the above question group', 'event_espresso').'</span>
1593 1593
 						<div class="dashicons dashicons-edit"></div>
1594 1594
 					</a>
1595 1595
 				</td>
@@ -1609,18 +1609,18 @@  discard block
 block discarded – undo
1609 1609
 	 * @param        string $label
1610 1610
 	 * @return        string
1611 1611
 	 */
1612
-	public function form_form_field_label_wrap( $label ) {
1612
+	public function form_form_field_label_wrap($label) {
1613 1613
 		EE_Error::doing_it_wrong(
1614
-			__CLASS__ . '::' . __FUNCTION__,
1615
-			__( 'This method would have been protected but was used on a filter callback'
1614
+			__CLASS__.'::'.__FUNCTION__,
1615
+			__('This method would have been protected but was used on a filter callback'
1616 1616
 				. 'so needed to be public. Please discontinue usage as it will be removed soon.',
1617
-				'event_espresso' ),
1617
+				'event_espresso'),
1618 1618
 			'4.8.32.rc.000'
1619 1619
 		);
1620 1620
 		return '
1621 1621
 			<tr>
1622 1622
 				<th>
1623
-					' . $label  . '
1623
+					' . $label.'
1624 1624
 				</th>';
1625 1625
 	}
1626 1626
 
@@ -1634,17 +1634,17 @@  discard block
 block discarded – undo
1634 1634
 	 * @param        string $input
1635 1635
 	 * @return        string
1636 1636
 	 */
1637
-	public function form_form_field_input__wrap( $input ) {
1637
+	public function form_form_field_input__wrap($input) {
1638 1638
 		EE_Error::doing_it_wrong(
1639
-			__CLASS__ . '::' . __FUNCTION__,
1640
-			__( 'This method would have been protected but was used on a filter callback'
1639
+			__CLASS__.'::'.__FUNCTION__,
1640
+			__('This method would have been protected but was used on a filter callback'
1641 1641
 				. 'so needed to be public. Please discontinue usage as it will be removed soon.',
1642
-				'event_espresso' ),
1642
+				'event_espresso'),
1643 1643
 			'4.8.32.rc.000'
1644 1644
 		);
1645 1645
 		return '
1646 1646
 				<td class="reg-admin-attendee-questions-input-td disabled-input">
1647
-					' . $input . '
1647
+					' . $input.'
1648 1648
 				</td>
1649 1649
 			</tr>';
1650 1650
 	}
@@ -1658,14 +1658,14 @@  discard block
 block discarded – undo
1658 1658
 	 * @return void
1659 1659
 	 */
1660 1660
 	protected function _update_attendee_registration_form() {
1661
-		do_action( 'AHEE__Registrations_Admin_Page___update_attendee_registration_form__start', $this );
1662
-		if( $_SERVER['REQUEST_METHOD'] == 'POST'){
1663
-			$REG_ID = isset( $this->_req_data['_REG_ID'] ) ? absint( $this->_req_data['_REG_ID'] ) : FALSE;
1664
-			$success = $this->_save_reg_custom_questions_form( $REG_ID );
1665
-			if( $success ) {
1661
+		do_action('AHEE__Registrations_Admin_Page___update_attendee_registration_form__start', $this);
1662
+		if ($_SERVER['REQUEST_METHOD'] == 'POST') {
1663
+			$REG_ID = isset($this->_req_data['_REG_ID']) ? absint($this->_req_data['_REG_ID']) : FALSE;
1664
+			$success = $this->_save_reg_custom_questions_form($REG_ID);
1665
+			if ($success) {
1666 1666
 				$what = __('Registration Form', 'event_espresso');
1667
-				$route = $REG_ID ? array( 'action' => 'view_registration', '_REG_ID' => $REG_ID ) : array( 'action' => 'default' );
1668
-				$this->_redirect_after_action( $success, $what, __('updated', 'event_espresso'), $route );
1667
+				$route = $REG_ID ? array('action' => 'view_registration', '_REG_ID' => $REG_ID) : array('action' => 'default');
1668
+				$this->_redirect_after_action($success, $what, __('updated', 'event_espresso'), $route);
1669 1669
 			}
1670 1670
 		}
1671 1671
 	}
@@ -1676,11 +1676,11 @@  discard block
 block discarded – undo
1676 1676
 	 * @param int $REG_ID
1677 1677
 	 * @return EE_Registration_Custom_Questions_Form
1678 1678
 	 */
1679
-	protected function _get_reg_custom_questions_form( $REG_ID ) {
1680
-		if( ! $this->_reg_custom_questions_form ) {
1681
-			require_once( REG_ADMIN . 'form_sections' . DS . 'EE_Registration_Custom_Questions_Form.form.php' );
1682
-			$this->_reg_custom_questions_form = new EE_Registration_Custom_Questions_Form( EEM_Registration::instance()->get_one_by_ID( $REG_ID ) );
1683
-			$this->_reg_custom_questions_form->_construct_finalize( null, null );
1679
+	protected function _get_reg_custom_questions_form($REG_ID) {
1680
+		if ( ! $this->_reg_custom_questions_form) {
1681
+			require_once(REG_ADMIN.'form_sections'.DS.'EE_Registration_Custom_Questions_Form.form.php');
1682
+			$this->_reg_custom_questions_form = new EE_Registration_Custom_Questions_Form(EEM_Registration::instance()->get_one_by_ID($REG_ID));
1683
+			$this->_reg_custom_questions_form->_construct_finalize(null, null);
1684 1684
 		}
1685 1685
 		return $this->_reg_custom_questions_form;
1686 1686
 	}
@@ -1693,17 +1693,17 @@  discard block
 block discarded – undo
1693 1693
 	 * @param bool $REG_ID
1694 1694
 	 * @return bool
1695 1695
 	 */
1696
-	private function _save_reg_custom_questions_form( $REG_ID = FALSE ) {
1696
+	private function _save_reg_custom_questions_form($REG_ID = FALSE) {
1697 1697
 
1698 1698
 		if ( ! $REG_ID) {
1699
-			EE_Error::add_error( __('An error occurred. No registration ID was received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
1699
+			EE_Error::add_error(__('An error occurred. No registration ID was received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1700 1700
 		}
1701
-		$form = $this->_get_reg_custom_questions_form( $REG_ID );
1702
-		$form->receive_form_submission( $this->_req_data );
1701
+		$form = $this->_get_reg_custom_questions_form($REG_ID);
1702
+		$form->receive_form_submission($this->_req_data);
1703 1703
 		$success = false;
1704
-		if( $form->is_valid() ) {
1705
-			foreach( $form->subforms() as $question_group_id => $question_group_form ) {
1706
-				foreach( $question_group_form->inputs() as $question_id => $input ) {
1704
+		if ($form->is_valid()) {
1705
+			foreach ($form->subforms() as $question_group_id => $question_group_form) {
1706
+				foreach ($question_group_form->inputs() as $question_id => $input) {
1707 1707
 					$where_conditions = array(
1708 1708
 							'QST_ID' => $question_id,
1709 1709
 							'REG_ID' => $REG_ID
@@ -1711,19 +1711,19 @@  discard block
 block discarded – undo
1711 1711
 					$possibly_new_values = array(
1712 1712
 							'ANS_value' => $input->normalized_value()
1713 1713
 						);
1714
-					$answer = EEM_Answer::instance()->get_one( array( $where_conditions ) );
1715
-					if( $answer instanceof EE_Answer ) {
1716
-						$success = $answer->save( $possibly_new_values );
1714
+					$answer = EEM_Answer::instance()->get_one(array($where_conditions));
1715
+					if ($answer instanceof EE_Answer) {
1716
+						$success = $answer->save($possibly_new_values);
1717 1717
 					} else {
1718 1718
 						//insert it then
1719
-						$cols_n_vals = array_merge( $where_conditions, $possibly_new_values );
1720
-						$answer = EE_Answer::new_instance( $cols_n_vals );
1719
+						$cols_n_vals = array_merge($where_conditions, $possibly_new_values);
1720
+						$answer = EE_Answer::new_instance($cols_n_vals);
1721 1721
 						$success = $answer->save();
1722 1722
 					}
1723 1723
 				}
1724 1724
 			}
1725 1725
 		} else {
1726
-			EE_Error::add_error( $form->get_validation_error_string(), __FILE__, __FUNCTION__, __LINE__ );
1726
+			EE_Error::add_error($form->get_validation_error_string(), __FILE__, __FUNCTION__, __LINE__);
1727 1727
 		}
1728 1728
 		return $success;
1729 1729
 	}
@@ -1741,29 +1741,29 @@  discard block
 block discarded – undo
1741 1741
 		$registrations = $REG->get_all(array(
1742 1742
 			array(
1743 1743
 				'TXN_ID'=>$this->_registration->transaction_ID(),
1744
-				'REG_ID'=>array('!=',$this->_registration->ID())
1744
+				'REG_ID'=>array('!=', $this->_registration->ID())
1745 1745
 			),
1746 1746
 			'force_join'=>array('Attendee')));
1747 1747
 
1748 1748
 		$this->_template_args['attendees'] = array();
1749 1749
 		$this->_template_args['attendee_notice'] = '';
1750
-		if ( empty( $registrations)  || ( is_array($registrations) &&  ! EEH_Array::get_one_item_from_array($registrations) ) ) {
1751
-			EE_Error::add_error( __('There are no records attached to this registration. Something may have gone wrong with the registration', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
1750
+		if (empty($registrations) || (is_array($registrations) && ! EEH_Array::get_one_item_from_array($registrations))) {
1751
+			EE_Error::add_error(__('There are no records attached to this registration. Something may have gone wrong with the registration', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1752 1752
 			$this->_template_args['attendee_notice'] = EE_Error::get_notices();
1753 1753
 		} else {
1754 1754
 
1755 1755
 			$att_nmbr = 1;
1756
-			foreach ( $registrations as $registration ) {
1756
+			foreach ($registrations as $registration) {
1757 1757
 				/* @var $registration EE_Registration */
1758 1758
 				$attendee = $registration->attendee() ? $registration->attendee() : EEM_Attendee::instance()->create_default_object();
1759
-				$this->_template_args['attendees'][ $att_nmbr ]['fname'] = $attendee->fname();//( isset( $registration->ATT_fname ) & ! empty( $registration->ATT_fname ) ) ? $registration->ATT_fname : '';
1760
-				$this->_template_args['attendees'][ $att_nmbr ]['lname'] = $attendee->lname();//( isset( $registration->ATT_lname ) & ! empty( $registration->ATT_lname ) ) ? $registration->ATT_lname : '';
1761
-				$this->_template_args['attendees'][ $att_nmbr ]['email'] = $attendee->email();//( isset( $registration->ATT_email ) & ! empty( $registration->ATT_email ) ) ? $registration->ATT_email : '';
1762
-				$this->_template_args['attendees'][ $att_nmbr ]['final_price'] = $registration->final_price();//( isset( $registration->REG_final_price ) & ! empty( $registration->REG_final_price ) ) ? $registration->REG_final_price : '';
1759
+				$this->_template_args['attendees'][$att_nmbr]['fname'] = $attendee->fname(); //( isset( $registration->ATT_fname ) & ! empty( $registration->ATT_fname ) ) ? $registration->ATT_fname : '';
1760
+				$this->_template_args['attendees'][$att_nmbr]['lname'] = $attendee->lname(); //( isset( $registration->ATT_lname ) & ! empty( $registration->ATT_lname ) ) ? $registration->ATT_lname : '';
1761
+				$this->_template_args['attendees'][$att_nmbr]['email'] = $attendee->email(); //( isset( $registration->ATT_email ) & ! empty( $registration->ATT_email ) ) ? $registration->ATT_email : '';
1762
+				$this->_template_args['attendees'][$att_nmbr]['final_price'] = $registration->final_price(); //( isset( $registration->REG_final_price ) & ! empty( $registration->REG_final_price ) ) ? $registration->REG_final_price : '';
1763 1763
 
1764
-				$this->_template_args['attendees'][ $att_nmbr ]['address'] = implode( ', ', $attendee->full_address_as_array() );
1764
+				$this->_template_args['attendees'][$att_nmbr]['address'] = implode(', ', $attendee->full_address_as_array());
1765 1765
 
1766
-				$this->_template_args['attendees'][ $att_nmbr ]['att_link'] = self::add_query_args_and_nonce( array( 'action'=>'edit_attendee', 'post'=>$attendee->ID() ), REG_ADMIN_URL );
1766
+				$this->_template_args['attendees'][$att_nmbr]['att_link'] = self::add_query_args_and_nonce(array('action'=>'edit_attendee', 'post'=>$attendee->ID()), REG_ADMIN_URL);
1767 1767
 
1768 1768
 				$att_nmbr++;
1769 1769
 			}
@@ -1775,8 +1775,8 @@  discard block
 block discarded – undo
1775 1775
 
1776 1776
 	//			$this->_template_args['registration_form_url'] = add_query_arg( array( 'action' => 'edit_registration', 'process' => 'attendees'  ), REG_ADMIN_URL );
1777 1777
 		}
1778
-		$template_path = REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_attendees.template.php';
1779
-		echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
1778
+		$template_path = REG_TEMPLATE_PATH.'reg_admin_details_main_meta_box_attendees.template.php';
1779
+		echo EEH_Template::display_template($template_path, $this->_template_args, TRUE);
1780 1780
 
1781 1781
 	}
1782 1782
 
@@ -1797,11 +1797,11 @@  discard block
 block discarded – undo
1797 1797
 		$attendee = $att_check instanceof EE_Attendee ? $att_check : EEM_Attendee::instance()->create_default_object();
1798 1798
 
1799 1799
 		//now let's determine if this is not the primary registration.  If it isn't then we set the primary_registration object for reference BUT ONLY if the Attendee object loaded is not the same as the primary registration object (that way we know if we need to show cereate button or not)
1800
-		if ( ! $this->_registration->is_primary_registrant() ) {
1800
+		if ( ! $this->_registration->is_primary_registrant()) {
1801 1801
 			$primary_registration = $this->_registration->get_primary_registration();
1802 1802
 			$primary_attendee = $primary_registration->attendee();
1803 1803
 
1804
-			if ( ! $primary_attendee instanceof EE_Attendee || $attendee->ID() !== $primary_attendee->ID() ) {
1804
+			if ( ! $primary_attendee instanceof EE_Attendee || $attendee->ID() !== $primary_attendee->ID()) {
1805 1805
 				//in here?  This means the displayed registration is not the primary registrant but ALREADY HAS its own custom attendee object so let's not worry about the primary reg.
1806 1806
 				$primary_registration = NULL;
1807 1807
 			}
@@ -1810,27 +1810,27 @@  discard block
 block discarded – undo
1810 1810
 		}
1811 1811
 
1812 1812
 		$this->_template_args['ATT_ID'] = $attendee->ID();
1813
-		$this->_template_args['fname'] = $attendee->fname();//$this->_registration->ATT_fname;
1814
-		$this->_template_args['lname'] = $attendee->lname();//$this->_registration->ATT_lname;
1815
-		$this->_template_args['email'] = $attendee->email();//$this->_registration->ATT_email;
1813
+		$this->_template_args['fname'] = $attendee->fname(); //$this->_registration->ATT_fname;
1814
+		$this->_template_args['lname'] = $attendee->lname(); //$this->_registration->ATT_lname;
1815
+		$this->_template_args['email'] = $attendee->email(); //$this->_registration->ATT_email;
1816 1816
 		$this->_template_args['phone'] = $attendee->phone();
1817 1817
 
1818
-		$this->_template_args[ 'formatted_address' ] = EEH_Address::format( $attendee );
1818
+		$this->_template_args['formatted_address'] = EEH_Address::format($attendee);
1819 1819
 
1820 1820
 
1821 1821
 		//edit link
1822
-		$this->_template_args['att_edit_link'] = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'edit_attendee', 'post'=>$attendee->ID() ), REG_ADMIN_URL );
1823
-		$this->_template_args['att_edit_label'] = __('View/Edit Contact' );
1822
+		$this->_template_args['att_edit_link'] = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'edit_attendee', 'post'=>$attendee->ID()), REG_ADMIN_URL);
1823
+		$this->_template_args['att_edit_label'] = __('View/Edit Contact');
1824 1824
 
1825 1825
 		//create link
1826
-		$this->_template_args['create_link'] = $primary_registration instanceof EE_Registration ? EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'duplicate_attendee',  '_REG_ID' => $this->_registration->ID() ), REG_ADMIN_URL ): '';
1826
+		$this->_template_args['create_link'] = $primary_registration instanceof EE_Registration ? EE_Admin_Page::add_query_args_and_nonce(array('action' => 'duplicate_attendee', '_REG_ID' => $this->_registration->ID()), REG_ADMIN_URL) : '';
1827 1827
 		$this->_template_args['create_label'] = __('Create Contact', 'event_espresso');
1828 1828
 
1829 1829
 		$this->_template_args['att_check'] = $att_check;
1830 1830
 
1831 1831
 
1832
-		$template_path = REG_TEMPLATE_PATH . 'reg_admin_details_side_meta_box_registrant.template.php';
1833
-		echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
1832
+		$template_path = REG_TEMPLATE_PATH.'reg_admin_details_side_meta_box_registrant.template.php';
1833
+		echo EEH_Template::display_template($template_path, $this->_template_args, TRUE);
1834 1834
 	}
1835 1835
 
1836 1836
 
@@ -1843,7 +1843,7 @@  discard block
 block discarded – undo
1843 1843
 	 * @access protected
1844 1844
 	 * @return void
1845 1845
 	 */
1846
-	protected function _trash_or_restore_registrations( $trash = TRUE ) {
1846
+	protected function _trash_or_restore_registrations($trash = TRUE) {
1847 1847
 		$REGM = EEM_Registration::instance();
1848 1848
 
1849 1849
 		$success = 1;
@@ -1853,26 +1853,26 @@  discard block
 block discarded – undo
1853 1853
 		$dtts = array();
1854 1854
 
1855 1855
 		//if empty _REG_ID then get out because there's nothing to do
1856
-		if ( empty( $this->_req_data['_REG_ID'] ) ) {
1856
+		if (empty($this->_req_data['_REG_ID'])) {
1857 1857
 			$msg = $trash ? __('In order to trash registrations you must select which ones you wish to trash by clicking the checkboxes.', 'event_espresso') : __('In order to restore registrations you must select which ones you wish to restore by clicking the checkboxes.', 'event_espresso');
1858
-			EE_Error::add_error( $msg, __FILE__, __LINE__, __FUNCTION__ );
1859
-			$this->_redirect_after_action(FALSE, '', '', array(), TRUE );
1858
+			EE_Error::add_error($msg, __FILE__, __LINE__, __FUNCTION__);
1859
+			$this->_redirect_after_action(FALSE, '', '', array(), TRUE);
1860 1860
 		}
1861 1861
 
1862 1862
 		//Checkboxes
1863
-		if (!empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) {
1863
+		if ( ! empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) {
1864 1864
 			// if array has more than one element than success message should be plural
1865
-			$success = count( $this->_req_data['_REG_ID'] ) > 1 ? 2 : 1;
1865
+			$success = count($this->_req_data['_REG_ID']) > 1 ? 2 : 1;
1866 1866
 			// cycle thru checkboxes
1867
-			while (list( $ind, $REG_ID ) = each($this->_req_data['_REG_ID'])) {
1867
+			while (list($ind, $REG_ID) = each($this->_req_data['_REG_ID'])) {
1868 1868
 
1869 1869
 				$REG = $REGM->get_one_by_ID($REG_ID);
1870 1870
 				$payment_count = $REG->get_first_related('Transaction')->count_related('Payment');
1871
-				if ( $payment_count > 0 ) {
1872
-					$name = $REG->attendee() instanceof EE_Attendee ? $REG->attendee()->full_name() : __( 'Unknown Attendee', 'event_espresso' );
1871
+				if ($payment_count > 0) {
1872
+					$name = $REG->attendee() instanceof EE_Attendee ? $REG->attendee()->full_name() : __('Unknown Attendee', 'event_espresso');
1873 1873
 					$error = 1;
1874 1874
 					$success = 0;
1875
-					EE_Error::add_error( sprintf( __('The registration for %s could not be trashed because it has payments attached to the related transaction.  If you wish to trash this registration you must first delete the payments on the related transaction.', 'event_espresso'), $name ), __FILE__, __FUNCTION__, __LINE__ );
1875
+					EE_Error::add_error(sprintf(__('The registration for %s could not be trashed because it has payments attached to the related transaction.  If you wish to trash this registration you must first delete the payments on the related transaction.', 'event_espresso'), $name), __FILE__, __FUNCTION__, __LINE__);
1876 1876
 					continue; //can't trash this registration because it has payments.
1877 1877
 				}
1878 1878
 				$ticket = $REG->get_first_related('Ticket');
@@ -1881,7 +1881,7 @@  discard block
 block discarded – undo
1881 1881
 				$dtts = array_merge($dtts, $dtt);
1882 1882
 
1883 1883
 				$updated = $trash ? $REG->delete() : $REG->restore();
1884
-				if ( !$updated ) {
1884
+				if ( ! $updated) {
1885 1885
 					$success = 0;
1886 1886
 				} else {
1887 1887
 					$success = 2;
@@ -1896,7 +1896,7 @@  discard block
 block discarded – undo
1896 1896
 			$tickets[$ticket->ID()] = $ticket;
1897 1897
 			$dtts = $ticket->get_many_related('Datetime');
1898 1898
 			$updated = $trash ? $REG->delete() : $REG->restore();
1899
-			if ( ! $updated ) {
1899
+			if ( ! $updated) {
1900 1900
 				$success = 0;
1901 1901
 			}
1902 1902
 
@@ -1906,10 +1906,10 @@  discard block
 block discarded – undo
1906 1906
 		EEM_Ticket::instance()->update_tickets_sold($tickets);
1907 1907
 		EEM_Datetime::instance()->update_sold($dtts);
1908 1908
 
1909
-		$what = $success > 1 ? __( 'Registrations', 'event_espresso' ) : __( 'Registration', 'event_espresso' );
1910
-		$action_desc = $trash ? __( 'moved to the trash', 'event_espresso' ) : __( 'restored', 'event_espresso' );
1909
+		$what = $success > 1 ? __('Registrations', 'event_espresso') : __('Registration', 'event_espresso');
1910
+		$action_desc = $trash ? __('moved to the trash', 'event_espresso') : __('restored', 'event_espresso');
1911 1911
 		$overwrite_msgs = $error ? TRUE : FALSE;
1912
-		$this->_redirect_after_action( $success, $what, $action_desc, array( 'action' => 'default' ), $overwrite_msgs );
1912
+		$this->_redirect_after_action($success, $what, $action_desc, array('action' => 'default'), $overwrite_msgs);
1913 1913
 	}
1914 1914
 
1915 1915
 
@@ -1933,16 +1933,16 @@  discard block
 block discarded – undo
1933 1933
 		$success = 1;
1934 1934
 
1935 1935
 		//Checkboxes
1936
-		if (!empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) {
1936
+		if ( ! empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) {
1937 1937
 			// if array has more than one element than success message should be plural
1938
-			$success = count( $this->_req_data['_REG_ID'] ) > 1 ? 2 : 1;
1938
+			$success = count($this->_req_data['_REG_ID']) > 1 ? 2 : 1;
1939 1939
 			// cycle thru checkboxes
1940
-			while (list( $ind, $REG_ID ) = each($this->_req_data['_REG_ID'])) {
1940
+			while (list($ind, $REG_ID) = each($this->_req_data['_REG_ID'])) {
1941 1941
 				$REG = $REG_MDL->get_one_by_ID($REG_ID);
1942
-				if ( ! $REG instanceof EE_Registration )
1942
+				if ( ! $REG instanceof EE_Registration)
1943 1943
 					continue;
1944 1944
 				$deleted = $this->_delete_registration($REG);
1945
-				if ( !$deleted ) {
1945
+				if ( ! $deleted) {
1946 1946
 					$success = 0;
1947 1947
 				}
1948 1948
 			}
@@ -1952,15 +1952,15 @@  discard block
 block discarded – undo
1952 1952
 			$REG_ID = $this->_req_data['_REG_ID'];
1953 1953
 			$REG = $REG_MDL->get_one_by_ID($REG_ID);
1954 1954
 			$deleted = $this->_delete_registration($REG);
1955
-			if ( ! $deleted ) {
1955
+			if ( ! $deleted) {
1956 1956
 				$success = 0;
1957 1957
 			}
1958 1958
 
1959 1959
 		}
1960 1960
 
1961
-		$what = $success > 1 ? __( 'Registrations', 'event_espresso' ) : __( 'Registration', 'event_espresso' );
1962
-		$action_desc = __( 'permanently deleted.', 'event_espresso' );
1963
-		$this->_redirect_after_action( $success, $what, $action_desc, array( 'action' => 'default' ), TRUE );
1961
+		$what = $success > 1 ? __('Registrations', 'event_espresso') : __('Registration', 'event_espresso');
1962
+		$action_desc = __('permanently deleted.', 'event_espresso');
1963
+		$this->_redirect_after_action($success, $what, $action_desc, array('action' => 'default'), TRUE);
1964 1964
 	}
1965 1965
 
1966 1966
 
@@ -1972,31 +1972,31 @@  discard block
 block discarded – undo
1972 1972
 	 * @param  EE_Registration $REG registration to be deleted permenantly
1973 1973
 	 * @return boolean              true = successful deletion, false = fail.
1974 1974
 	 */
1975
-	protected function _delete_registration( EE_Registration $REG ) {
1975
+	protected function _delete_registration(EE_Registration $REG) {
1976 1976
 		//first we start with the transaction... ultimately, we WILL not delete permanently if there are any related registrations on the transaction that are NOT trashed.
1977 1977
 		$TXN = $REG->get_first_related('Transaction');
1978 1978
 		$REGS = $TXN->get_many_related('Registration');
1979 1979
 
1980 1980
 		$all_trashed = TRUE;
1981
-		foreach ( $REGS as $registration ) {
1982
-			if ( ! $registration->get('REG_deleted') )
1981
+		foreach ($REGS as $registration) {
1982
+			if ( ! $registration->get('REG_deleted'))
1983 1983
 				$all_trashed = FALSE;
1984 1984
 		}
1985 1985
 
1986
-		if ( ! $all_trashed ) {
1987
-			EE_Error::add_error( __('Unable to permanently delete this registration. Before this registration can be permanently deleted, all registrations made in the same transaction must be trashed as well.  These registrations will be permanently deleted in the same action.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
1986
+		if ( ! $all_trashed) {
1987
+			EE_Error::add_error(__('Unable to permanently delete this registration. Before this registration can be permanently deleted, all registrations made in the same transaction must be trashed as well.  These registrations will be permanently deleted in the same action.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1988 1988
 			return false;
1989 1989
 		}
1990 1990
 
1991 1991
 		//k made it here so that means we can delete all the related transactions and their answers (but let's do them separately from THIS one).
1992
-		foreach ( $REGS as $registration ) {
1992
+		foreach ($REGS as $registration) {
1993 1993
 
1994 1994
 			//delete related answers
1995 1995
 			$registration->delete_related_permanently('Answer');
1996 1996
 
1997 1997
 			//remove relationship to EE_Attendee (but we ALWAYS leave the contact record intact)
1998 1998
 			$attendee = $registration->get_first_related('Attendee');
1999
-			if ( $attendee instanceof EE_Attendee ) {
1999
+			if ($attendee instanceof EE_Attendee) {
2000 2000
 				$registration->_remove_relation_to($attendee, 'Attendee');
2001 2001
 			}
2002 2002
 
@@ -2006,7 +2006,7 @@  discard block
 block discarded – undo
2006 2006
 			//now delete permanently the checkins related to this registration.
2007 2007
 			$registration->delete_related_permanently('Checkin');
2008 2008
 
2009
-			if ( $registration->ID() === $REG->ID() )
2009
+			if ($registration->ID() === $REG->ID())
2010 2010
 				continue; //we don't want to delete permanently the existing registration just yet.
2011 2011
 
2012 2012
 			//remove relation to transaction for these registrations if NOT the existing registrations
@@ -2039,35 +2039,35 @@  discard block
 block discarded – undo
2039 2039
 	 * @return void
2040 2040
 	 */
2041 2041
 	public function new_registration() {
2042
-		if ( ! $this->_set_reg_event() ) {
2043
-			throw new EE_Error(__('Unable to continue with registering because there is no Event ID in the request', 'event_espresso') );
2042
+		if ( ! $this->_set_reg_event()) {
2043
+			throw new EE_Error(__('Unable to continue with registering because there is no Event ID in the request', 'event_espresso'));
2044 2044
 		}
2045
-		EE_Registry::instance()->REQ->set_espresso_page( TRUE );
2045
+		EE_Registry::instance()->REQ->set_espresso_page(TRUE);
2046 2046
 		// gotta start with a clean slate if we're not coming here via ajax
2047 2047
 		if (
2048
-			! defined('DOING_AJAX' )
2049
-			&& ( ! isset( $this->_req_data['processing_registration'] ) || isset( $this->_req_data['step_error'] ) )
2048
+			! defined('DOING_AJAX')
2049
+			&& ( ! isset($this->_req_data['processing_registration']) || isset($this->_req_data['step_error']))
2050 2050
 		) {
2051
-			EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ );
2051
+			EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__);
2052 2052
 		}
2053 2053
 
2054
-		$this->_template_args['event_name'] = '' ;
2054
+		$this->_template_args['event_name'] = '';
2055 2055
 		// event name
2056
-		if ( $this->_reg_event ) {
2056
+		if ($this->_reg_event) {
2057 2057
 			$this->_template_args['event_name'] = $this->_reg_event->name();
2058
-			$edit_event_url = self::add_query_args_and_nonce( array( 'action'=>'edit', 'post'=>$this->_reg_event->ID() ), EVENTS_ADMIN_URL );
2059
-			$edit_event_lnk = '<a href="'.$edit_event_url.'" title="' . esc_attr__( 'Edit ', 'event_espresso' ) . $this->_reg_event->name() . '">' . __( 'Edit Event', 'event_espresso' ) . '</a>';
2060
-			$this->_template_args['event_name'] .= ' <span class="admin-page-header-edit-lnk not-bold">' . $edit_event_lnk . '</span>' ;
2058
+			$edit_event_url = self::add_query_args_and_nonce(array('action'=>'edit', 'post'=>$this->_reg_event->ID()), EVENTS_ADMIN_URL);
2059
+			$edit_event_lnk = '<a href="'.$edit_event_url.'" title="'.esc_attr__('Edit ', 'event_espresso').$this->_reg_event->name().'">'.__('Edit Event', 'event_espresso').'</a>';
2060
+			$this->_template_args['event_name'] .= ' <span class="admin-page-header-edit-lnk not-bold">'.$edit_event_lnk.'</span>';
2061 2061
 		}
2062 2062
 
2063 2063
 		$this->_template_args['step_content'] = $this->_get_registration_step_content();
2064 2064
 
2065
-		if ( defined('DOING_AJAX' ) ) {
2065
+		if (defined('DOING_AJAX')) {
2066 2066
 			$this->_return_json();
2067 2067
 		}
2068 2068
 		// grab header
2069
-		$template_path = REG_TEMPLATE_PATH . 'reg_admin_register_new_attendee.template.php';
2070
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
2069
+		$template_path = REG_TEMPLATE_PATH.'reg_admin_register_new_attendee.template.php';
2070
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE);
2071 2071
 
2072 2072
 		//$this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE );
2073 2073
 		// the details template wrapper
@@ -2084,7 +2084,7 @@  discard block
 block discarded – undo
2084 2084
 	 * @return string html
2085 2085
 	 */
2086 2086
 	protected function _get_registration_step_content() {
2087
-		if ( isset( $_COOKIE[ 'ee_registration_added' ] ) && $_COOKIE[ 'ee_registration_added' ] ) {
2087
+		if (isset($_COOKIE['ee_registration_added']) && $_COOKIE['ee_registration_added']) {
2088 2088
 			$warning_msg = sprintf(
2089 2089
 				__(
2090 2090
 					'%2$sWARNING!!!%3$s%1$sPlease do not use the back button to return to this page for the purpose of adding another registration.%1$sThis can result in lost and/or corrupted data.%1$sIf you wish to add another registration, then please click the%1$s%7$s"Add Another New Registration to Event"%8$s button%1$son the Transaction details page, after you are redirected.%1$s%1$s%4$s redirecting in %5$s seconds %6$s',
@@ -2100,7 +2100,7 @@  discard block
 block discarded – undo
2100 2100
 				'</b>'
2101 2101
 			);
2102 2102
 			return '
2103
-	<div id="ee-add-reg-back-button-dv"><p>' . $warning_msg . '</p></div>
2103
+	<div id="ee-add-reg-back-button-dv"><p>' . $warning_msg.'</p></div>
2104 2104
 	<script >
2105 2105
 		// WHOAH !!! it appears that someone is using the back button from the Transaction admin page
2106 2106
 		// after just adding a new registration... we gotta try to put a stop to that !!!
@@ -2135,16 +2135,16 @@  discard block
 block discarded – undo
2135 2135
 		$cart = EE_Registry::instance()->SSN->cart();
2136 2136
 		$step = ! $cart instanceof EE_Cart ? 'ticket' : 'questions';
2137 2137
 
2138
-		switch ( $step ) {
2138
+		switch ($step) {
2139 2139
 			case 'ticket' :
2140 2140
 				$hidden_fields['processing_registration']['value'] = 1;
2141 2141
 				$template_args['title'] = __('Step One: Select the Ticket for this registration', 'event_espresso');
2142
-				$template_args['content'] = EED_Ticket_Selector::instance()->display_ticket_selector( $this->_reg_event );
2142
+				$template_args['content'] = EED_Ticket_Selector::instance()->display_ticket_selector($this->_reg_event);
2143 2143
 				$template_args['step_button_text'] = __('Add Tickets and Continue to Registrant Details', 'event_espresso');
2144 2144
 				$template_args['show_notification_toggle'] = FALSE;
2145 2145
 				break;
2146 2146
 			case 'questions' :
2147
-				$hidden_fields[ 'processing_registration' ][ 'value' ] = 2;
2147
+				$hidden_fields['processing_registration']['value'] = 2;
2148 2148
 				$template_args['title'] = __('Step Two: Add Registrant Details for this Registration', 'event_espresso');
2149 2149
 				//in theory we should be able to run EED_SPCO at this point because the cart should have been setup properly by the first process_reg_step run.
2150 2150
 				$template_args['content'] = EED_Single_Page_Checkout::registration_checkout_for_admin();
@@ -2153,10 +2153,10 @@  discard block
 block discarded – undo
2153 2153
 				break;
2154 2154
 		}
2155 2155
 
2156
-		$this->_set_add_edit_form_tags( 'process_reg_step', $hidden_fields ); //we come back to the process_registration_step route.
2156
+		$this->_set_add_edit_form_tags('process_reg_step', $hidden_fields); //we come back to the process_registration_step route.
2157 2157
 
2158 2158
 		return EEH_Template::display_template(
2159
-			REG_TEMPLATE_PATH . 'reg_admin_register_new_attendee_step_content.template.php', $template_args, TRUE
2159
+			REG_TEMPLATE_PATH.'reg_admin_register_new_attendee_step_content.template.php', $template_args, TRUE
2160 2160
 		);
2161 2161
 	}
2162 2162
 
@@ -2171,11 +2171,11 @@  discard block
 block discarded – undo
2171 2171
 	*		@return boolean
2172 2172
 	*/
2173 2173
 	private function _set_reg_event() {
2174
-		if ( is_object( $this->_reg_event )) {
2174
+		if (is_object($this->_reg_event)) {
2175 2175
 			return TRUE;
2176 2176
 		}
2177
-		$EVT_ID = ( ! empty( $this->_req_data['event_id'] )) ? absint( $this->_req_data['event_id'] ) : FALSE;
2178
-		if ( ! $EVT_ID ) {
2177
+		$EVT_ID = ( ! empty($this->_req_data['event_id'])) ? absint($this->_req_data['event_id']) : FALSE;
2178
+		if ( ! $EVT_ID) {
2179 2179
 			return FALSE;
2180 2180
 		}
2181 2181
 
@@ -2196,82 +2196,82 @@  discard block
 block discarded – undo
2196 2196
 	public function process_reg_step() {
2197 2197
 		EE_System::do_not_cache();
2198 2198
 		$this->_set_reg_event();
2199
-		EE_Registry::instance()->REQ->set_espresso_page( TRUE );
2199
+		EE_Registry::instance()->REQ->set_espresso_page(TRUE);
2200 2200
 
2201 2201
 		//what step are we on?
2202 2202
 		$cart = EE_Registry::instance()->SSN->cart();
2203 2203
 		$step = ! $cart instanceof EE_Cart ? 'ticket' : 'questions';
2204 2204
 
2205 2205
 		//if doing ajax then we need to verify the nonce
2206
-		if ( defined( 'DOING_AJAX' ) ) {
2207
-			$nonce = isset( $this->_req_data[$this->_req_nonce] ) ? sanitize_text_field( $this->_req_data[$this->_req_nonce] ) : '';
2208
-			$this->_verify_nonce( $nonce, $this->_req_nonce );
2206
+		if (defined('DOING_AJAX')) {
2207
+			$nonce = isset($this->_req_data[$this->_req_nonce]) ? sanitize_text_field($this->_req_data[$this->_req_nonce]) : '';
2208
+			$this->_verify_nonce($nonce, $this->_req_nonce);
2209 2209
 		}
2210 2210
 
2211
-		switch ( $step ) {
2211
+		switch ($step) {
2212 2212
 
2213 2213
 			case 'ticket' :
2214 2214
 				//process ticket selection
2215 2215
 				$success = EED_Ticket_Selector::instance()->process_ticket_selections();
2216
-				if ( $success ) {
2217
-					EE_Error::add_success( __('Tickets Selected. Now complete the registration.'), 'event_espresso');
2216
+				if ($success) {
2217
+					EE_Error::add_success(__('Tickets Selected. Now complete the registration.'), 'event_espresso');
2218 2218
 				} else {
2219 2219
 					$query_args['step_error'] = $this->_req_data['step_error'] = TRUE;
2220 2220
 				}
2221
-				if ( defined('DOING_AJAX') ) {
2221
+				if (defined('DOING_AJAX')) {
2222 2222
 					$this->new_registration(); //display next step
2223 2223
 				} else {
2224 2224
 					$query_args['action'] = 'new_registration';
2225 2225
 					$query_args['processing_registration'] = 1;
2226 2226
 					$query_args['event_id'] = $this->_reg_event->ID();
2227
-					$this->_redirect_after_action( FALSE, '', '', $query_args, TRUE );
2227
+					$this->_redirect_after_action(FALSE, '', '', $query_args, TRUE);
2228 2228
 				}
2229 2229
 				break;
2230 2230
 
2231 2231
 			case 'questions' :
2232
-				if( ! isset( $this->_req_data[ 'txn_reg_status_change' ], $this->_req_data[ 'txn_reg_status_change' ][ 'send_notifications' ] ) ) {
2233
-					add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_false', 15 );
2232
+				if ( ! isset($this->_req_data['txn_reg_status_change'], $this->_req_data['txn_reg_status_change']['send_notifications'])) {
2233
+					add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_false', 15);
2234 2234
 				}
2235 2235
 				//process registration
2236 2236
 				$transaction = EED_Single_Page_Checkout::instance()->process_registration_from_admin();
2237
-				if ( $cart instanceof EE_Cart ) {
2237
+				if ($cart instanceof EE_Cart) {
2238 2238
 					$grand_total = $cart->get_cart_grand_total();
2239
-					if ( $grand_total instanceof EE_Line_Item ) {
2239
+					if ($grand_total instanceof EE_Line_Item) {
2240 2240
 						$grand_total->save_this_and_descendants_to_txn();
2241 2241
 					}
2242 2242
 				}
2243
-				if ( ! $transaction instanceof EE_Transaction ) {
2243
+				if ( ! $transaction instanceof EE_Transaction) {
2244 2244
 					$query_args = array(
2245 2245
 						'action' => 'new_registration',
2246 2246
 						'processing_registration' => 2,
2247 2247
 						'event_id' => $this->_reg_event->ID()
2248 2248
 					);
2249 2249
 
2250
-					if ( defined('DOING_AJAX' )) {
2250
+					if (defined('DOING_AJAX')) {
2251 2251
 						//display registration form again because there are errors (maybe validation?)
2252 2252
 						$this->new_registration();
2253 2253
 						return;
2254 2254
 					} else {
2255
-						$this->_redirect_after_action( FALSE, '', '', $query_args, TRUE );
2255
+						$this->_redirect_after_action(FALSE, '', '', $query_args, TRUE);
2256 2256
 						return;
2257 2257
 					}
2258 2258
 				}
2259 2259
 				/** @type EE_Transaction_Payments $transaction_payments */
2260
-				$transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' );
2260
+				$transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments');
2261 2261
 				// maybe update status, and make sure to save transaction if not done already
2262
-				if ( ! $transaction_payments->update_transaction_status_based_on_total_paid( $transaction )) {
2262
+				if ( ! $transaction_payments->update_transaction_status_based_on_total_paid($transaction)) {
2263 2263
 					$transaction->save();
2264 2264
 				}
2265
-				EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ );
2265
+				EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__);
2266 2266
 				$this->_req_data = array();
2267 2267
 				$query_args = array(
2268 2268
 					'action'        => 'redirect_to_txn',
2269 2269
 					'TXN_ID'        => $transaction->ID(),
2270 2270
 					'EVT_ID'        => $this->_reg_event->ID(),
2271
-					'event_name'    => urlencode( $this->_reg_event->name() ),
2271
+					'event_name'    => urlencode($this->_reg_event->name()),
2272 2272
 					'redirect_from' => 'new_registration'
2273 2273
 				);
2274
-				$this->_redirect_after_action( false, '', '', $query_args, true );
2274
+				$this->_redirect_after_action(false, '', '', $query_args, true);
2275 2275
 				break;
2276 2276
 		}
2277 2277
 
@@ -2288,21 +2288,21 @@  discard block
 block discarded – undo
2288 2288
 	 */
2289 2289
 	public function redirect_to_txn() {
2290 2290
 		EE_System::do_not_cache();
2291
-		EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ );
2291
+		EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__);
2292 2292
 		$query_args = array(
2293 2293
 			'action' => 'view_transaction',
2294
-			'TXN_ID' => isset( $this->_req_data['TXN_ID'] ) ? absint( $this->_req_data[ 'TXN_ID' ] )  : 0,
2294
+			'TXN_ID' => isset($this->_req_data['TXN_ID']) ? absint($this->_req_data['TXN_ID']) : 0,
2295 2295
 			'page'   => 'espresso_transactions'
2296 2296
 		);
2297
-		if ( isset( $this->_req_data[ 'EVT_ID' ], $this->_req_data[ 'redirect_from' ] ) ) {
2298
-			$query_args['EVT_ID'] = $this->_req_data[ 'EVT_ID' ];
2299
-			$query_args['event_name'] = urlencode( $this->_req_data[ 'event_name' ] );
2300
-			$query_args['redirect_from'] = $this->_req_data[ 'redirect_from' ];
2297
+		if (isset($this->_req_data['EVT_ID'], $this->_req_data['redirect_from'])) {
2298
+			$query_args['EVT_ID'] = $this->_req_data['EVT_ID'];
2299
+			$query_args['event_name'] = urlencode($this->_req_data['event_name']);
2300
+			$query_args['redirect_from'] = $this->_req_data['redirect_from'];
2301 2301
 		}
2302 2302
 		EE_Error::add_success(
2303
-			__( 'Registration Created.  Please review the transaction and add any payments as necessary', 'event_espresso' )
2303
+			__('Registration Created.  Please review the transaction and add any payments as necessary', 'event_espresso')
2304 2304
 		);
2305
-		$this->_redirect_after_action( false, '', '', $query_args, true );
2305
+		$this->_redirect_after_action(false, '', '', $query_args, true);
2306 2306
 	}
2307 2307
 
2308 2308
 
@@ -2313,7 +2313,7 @@  discard block
 block discarded – undo
2313 2313
 	*		@return void
2314 2314
 	*/
2315 2315
 	protected function _attendee_contact_list_table() {
2316
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
2316
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2317 2317
 		$this->_search_btn_label = __('Contacts', 'event_espresso');
2318 2318
 		$this->display_admin_list_table_page_with_no_sidebar();
2319 2319
 	}
@@ -2328,10 +2328,10 @@  discard block
 block discarded – undo
2328 2328
 	*		@access public
2329 2329
 	*		@return array
2330 2330
 	*/
2331
-	public function get_attendees( $per_page, $count = FALSE, $trash = FALSE ) {
2331
+	public function get_attendees($per_page, $count = FALSE, $trash = FALSE) {
2332 2332
 
2333
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
2334
-		require_once( REG_ADMIN . 'EE_Attendee_Contact_List_Table.class.php' );
2333
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2334
+		require_once(REG_ADMIN.'EE_Attendee_Contact_List_Table.class.php');
2335 2335
 		$ATT_MDL = EEM_Attendee::instance();
2336 2336
 
2337 2337
 		$this->_req_data['orderby'] = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : '';
@@ -2359,47 +2359,47 @@  discard block
 block discarded – undo
2359 2359
 				$orderby = 'ATT_lname';
2360 2360
 		}
2361 2361
 
2362
-		$sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'ASC';
2362
+		$sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'ASC';
2363 2363
 
2364
-		$current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1;
2365
-		$per_page = isset( $per_page ) && !empty( $per_page ) ? $per_page : 10;
2366
-		$per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page;
2364
+		$current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1;
2365
+		$per_page = isset($per_page) && ! empty($per_page) ? $per_page : 10;
2366
+		$per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page;
2367 2367
 
2368 2368
 		$_where = array();
2369 2369
 
2370
-		if ( isset( $this->_req_data['s'] ) ) {
2371
-			$sstr = '%' . $this->_req_data['s'] . '%';
2370
+		if (isset($this->_req_data['s'])) {
2371
+			$sstr = '%'.$this->_req_data['s'].'%';
2372 2372
 			$_where['OR'] = array(
2373
-				'Registration.Event.EVT_name' => array( 'LIKE', $sstr),
2374
-				'Registration.Event.EVT_desc' => array( 'LIKE', $sstr ),
2375
-				'Registration.Event.EVT_short_desc' => array( 'LIKE' , $sstr ),
2376
-				'ATT_fname' => array( 'LIKE', $sstr ),
2377
-				'ATT_lname' => array( 'LIKE', $sstr ),
2378
-				'ATT_short_bio' => array( 'LIKE', $sstr ),
2379
-				'ATT_email' => array('LIKE', $sstr ),
2380
-				'ATT_address' => array( 'LIKE', $sstr ),
2381
-				'ATT_address2' => array( 'LIKE', $sstr ),
2382
-				'ATT_city' => array( 'LIKE', $sstr ),
2383
-				'Country.CNT_name' => array( 'LIKE', $sstr ),
2384
-				'State.STA_name' => array('LIKE', $sstr ),
2385
-				'ATT_phone' => array( 'LIKE', $sstr ),
2386
-				'Registration.REG_final_price' => array( 'LIKE', $sstr ),
2387
-				'Registration.REG_code' => array( 'LIKE', $sstr ),
2388
-				'Registration.REG_count' => array( 'LIKE' , $sstr ),
2389
-				'Registration.REG_group_size' => array( 'LIKE' , $sstr )
2373
+				'Registration.Event.EVT_name' => array('LIKE', $sstr),
2374
+				'Registration.Event.EVT_desc' => array('LIKE', $sstr),
2375
+				'Registration.Event.EVT_short_desc' => array('LIKE', $sstr),
2376
+				'ATT_fname' => array('LIKE', $sstr),
2377
+				'ATT_lname' => array('LIKE', $sstr),
2378
+				'ATT_short_bio' => array('LIKE', $sstr),
2379
+				'ATT_email' => array('LIKE', $sstr),
2380
+				'ATT_address' => array('LIKE', $sstr),
2381
+				'ATT_address2' => array('LIKE', $sstr),
2382
+				'ATT_city' => array('LIKE', $sstr),
2383
+				'Country.CNT_name' => array('LIKE', $sstr),
2384
+				'State.STA_name' => array('LIKE', $sstr),
2385
+				'ATT_phone' => array('LIKE', $sstr),
2386
+				'Registration.REG_final_price' => array('LIKE', $sstr),
2387
+				'Registration.REG_code' => array('LIKE', $sstr),
2388
+				'Registration.REG_count' => array('LIKE', $sstr),
2389
+				'Registration.REG_group_size' => array('LIKE', $sstr)
2390 2390
 				);
2391 2391
 		}
2392 2392
 
2393 2393
 
2394
-		$offset = ($current_page-1)*$per_page;
2395
-		$limit = $count ? NULL : array( $offset, $per_page );
2394
+		$offset = ($current_page - 1) * $per_page;
2395
+		$limit = $count ? NULL : array($offset, $per_page);
2396 2396
 
2397
-		if ( $trash ) {
2398
-			$_where['status'] = array( '!=', 'publish' );
2399
-			$all_attendees = $count ? $ATT_MDL->count( array($_where,'order_by'=>array($orderby=>$sort), 'limit'=>$limit)): $ATT_MDL->get_all( array($_where,'order_by'=>array($orderby=>$sort), 'limit'=>$limit));
2397
+		if ($trash) {
2398
+			$_where['status'] = array('!=', 'publish');
2399
+			$all_attendees = $count ? $ATT_MDL->count(array($_where, 'order_by'=>array($orderby=>$sort), 'limit'=>$limit)) : $ATT_MDL->get_all(array($_where, 'order_by'=>array($orderby=>$sort), 'limit'=>$limit));
2400 2400
 		} else {
2401
-			$_where['status'] = array( 'IN', array( 'publish' ) );
2402
-			$all_attendees = $count ? $ATT_MDL->count( array($_where, 'order_by'=>array($orderby=>$sort),'limit'=>$limit)) : $ATT_MDL->get_all( array($_where, 'order_by'=>array($orderby=>$sort), 'limit'=>$limit) );
2401
+			$_where['status'] = array('IN', array('publish'));
2402
+			$all_attendees = $count ? $ATT_MDL->count(array($_where, 'order_by'=>array($orderby=>$sort), 'limit'=>$limit)) : $ATT_MDL->get_all(array($_where, 'order_by'=>array($orderby=>$sort), 'limit'=>$limit));
2403 2403
 		}
2404 2404
 
2405 2405
 		return $all_attendees;
@@ -2416,10 +2416,10 @@  discard block
 block discarded – undo
2416 2416
 	 */
2417 2417
 	protected function _resend_registration() {
2418 2418
 		$this->_process_resend_registration();
2419
-		$query_args = isset($this->_req_data['redirect_to'] ) ? array('action' => $this->_req_data['redirect_to'], '_REG_ID' => $this->_req_data['_REG_ID'] ) : array(
2419
+		$query_args = isset($this->_req_data['redirect_to']) ? array('action' => $this->_req_data['redirect_to'], '_REG_ID' => $this->_req_data['_REG_ID']) : array(
2420 2420
 			'action' => 'default'
2421 2421
 		);
2422
-		$this->_redirect_after_action(FALSE, '', '', $query_args, TRUE );
2422
+		$this->_redirect_after_action(FALSE, '', '', $query_args, TRUE);
2423 2423
 	}
2424 2424
 
2425 2425
 
@@ -2427,26 +2427,26 @@  discard block
 block discarded – undo
2427 2427
 
2428 2428
 
2429 2429
 
2430
-	public function _registrations_report(){
2431
-		if( ! defined( 'EE_USE_OLD_CSV_REPORT_CLASS' ) ) {
2432
-			wp_redirect( EE_Admin_Page::add_query_args_and_nonce(
2430
+	public function _registrations_report() {
2431
+		if ( ! defined('EE_USE_OLD_CSV_REPORT_CLASS')) {
2432
+			wp_redirect(EE_Admin_Page::add_query_args_and_nonce(
2433 2433
 				array(
2434 2434
 					'page' => 'espresso_batch',
2435 2435
 					'batch' => 'file',
2436
-					'EVT_ID' => isset( $this->_req_data[ 'EVT_ID'] ) ? $this->_req_data[ 'EVT_ID' ] : NULL,
2437
-					'job_handler' => urlencode( 'EventEspressoBatchRequest\JobHandlers\RegistrationsReport' ),
2438
-					'return_url' => urlencode( $this->_req_data[ 'return_url' ] ),
2439
-				)) );
2436
+					'EVT_ID' => isset($this->_req_data['EVT_ID']) ? $this->_req_data['EVT_ID'] : NULL,
2437
+					'job_handler' => urlencode('EventEspressoBatchRequest\JobHandlers\RegistrationsReport'),
2438
+					'return_url' => urlencode($this->_req_data['return_url']),
2439
+				)));
2440 2440
 		} else {
2441 2441
 			$new_request_args = array(
2442 2442
 				'export' => 'report',
2443 2443
 				'action' => 'registrations_report_for_event',
2444
-				'EVT_ID' => isset( $this->_req_data[ 'EVT_ID'] ) ? $this->_req_data[ 'EVT_ID' ] : NULL,
2444
+				'EVT_ID' => isset($this->_req_data['EVT_ID']) ? $this->_req_data['EVT_ID'] : NULL,
2445 2445
 			);
2446 2446
 			$this->_req_data = array_merge($this->_req_data, $new_request_args);
2447 2447
 
2448
-			if ( is_readable(EE_CLASSES . 'EE_Export.class.php')) {
2449
-				require_once(EE_CLASSES . 'EE_Export.class.php');
2448
+			if (is_readable(EE_CLASSES.'EE_Export.class.php')) {
2449
+				require_once(EE_CLASSES.'EE_Export.class.php');
2450 2450
 				$EE_Export = EE_Export::instance($this->_req_data);
2451 2451
 				$EE_Export->export();
2452 2452
 			}
@@ -2455,26 +2455,26 @@  discard block
 block discarded – undo
2455 2455
 
2456 2456
 
2457 2457
 
2458
-	public function _contact_list_export(){
2459
-		if ( is_readable(EE_CLASSES . 'EE_Export.class.php')) {
2460
-			require_once(EE_CLASSES . 'EE_Export.class.php');
2458
+	public function _contact_list_export() {
2459
+		if (is_readable(EE_CLASSES.'EE_Export.class.php')) {
2460
+			require_once(EE_CLASSES.'EE_Export.class.php');
2461 2461
 			$EE_Export = EE_Export::instance($this->_req_data);
2462 2462
 			$EE_Export->export_attendees();
2463 2463
 		}
2464 2464
 	}
2465 2465
 
2466
-	public function _contact_list_report(){
2467
-		if( ! defined( 'EE_USE_OLD_CSV_REPORT_CLASS' ) ) {
2468
-			wp_redirect( EE_Admin_Page::add_query_args_and_nonce(
2466
+	public function _contact_list_report() {
2467
+		if ( ! defined('EE_USE_OLD_CSV_REPORT_CLASS')) {
2468
+			wp_redirect(EE_Admin_Page::add_query_args_and_nonce(
2469 2469
 				array(
2470 2470
 					'page' => 'espresso_batch',
2471 2471
 					'batch' => 'file',
2472
-					'job_handler' => urlencode( 'EventEspressoBatchRequest\JobHandlers\AttendeesReport' ),
2473
-					'return_url' => urlencode( $this->_req_data[ 'return_url' ] ),
2474
-				)) );
2472
+					'job_handler' => urlencode('EventEspressoBatchRequest\JobHandlers\AttendeesReport'),
2473
+					'return_url' => urlencode($this->_req_data['return_url']),
2474
+				)));
2475 2475
 		} else {
2476
-			if ( is_readable(EE_CLASSES . 'EE_Export.class.php')) {
2477
-				require_once(EE_CLASSES . 'EE_Export.class.php');
2476
+			if (is_readable(EE_CLASSES.'EE_Export.class.php')) {
2477
+				require_once(EE_CLASSES.'EE_Export.class.php');
2478 2478
 				$EE_Export = EE_Export::instance($this->_req_data);
2479 2479
 				$EE_Export->report_attendees();
2480 2480
 			}
@@ -2494,73 +2494,73 @@  discard block
 block discarded – undo
2494 2494
 	 * @return void
2495 2495
 	 */
2496 2496
 	protected function _duplicate_attendee() {
2497
-		$action = !empty( $this->_req_data['return'] ) ? $this->_req_data['return'] : 'default';
2497
+		$action = ! empty($this->_req_data['return']) ? $this->_req_data['return'] : 'default';
2498 2498
 		//verify we have necessary info
2499
-		if ( empty($this->_req_data['_REG_ID'] )  ) {
2500
-			EE_Error::add_error( __('Unable to create the contact for the registration because the required paramaters are not present (_REG_ID )', 'event_espresso'),  __FILE__, __LINE__, __FUNCTION__ );
2501
-			$query_args = array( 'action' => $action );
2499
+		if (empty($this->_req_data['_REG_ID'])) {
2500
+			EE_Error::add_error(__('Unable to create the contact for the registration because the required paramaters are not present (_REG_ID )', 'event_espresso'), __FILE__, __LINE__, __FUNCTION__);
2501
+			$query_args = array('action' => $action);
2502 2502
 			$this->_redirect_after_action('', '', '', $query_args, TRUE);
2503 2503
 		}
2504 2504
 
2505 2505
 		//okay necessary deets present... let's dupe the incoming attendee and attach to incoming registration.
2506
-		$registration = EEM_Registration::instance()->get_one_by_ID( $this->_req_data['_REG_ID'] );
2506
+		$registration = EEM_Registration::instance()->get_one_by_ID($this->_req_data['_REG_ID']);
2507 2507
 		$attendee = $registration->attendee();
2508 2508
 
2509 2509
 		//remove relation of existing attendee on registration
2510
-		$registration->_remove_relation_to($attendee, 'Attendee' );
2510
+		$registration->_remove_relation_to($attendee, 'Attendee');
2511 2511
 		//new attendee
2512 2512
 		$new_attendee = clone $attendee;
2513
-		$new_attendee->set( 'ATT_ID', 0 );
2513
+		$new_attendee->set('ATT_ID', 0);
2514 2514
 		$new_attendee->save();
2515 2515
 
2516 2516
 		//add new attendee to reg
2517
-		$registration->_add_relation_to( $new_attendee, 'Attendee');
2517
+		$registration->_add_relation_to($new_attendee, 'Attendee');
2518 2518
 
2519
-		EE_Error::add_success( __('New Contact record created.  Now make any edits you wish to make for this contact.', 'event_espresso') );
2519
+		EE_Error::add_success(__('New Contact record created.  Now make any edits you wish to make for this contact.', 'event_espresso'));
2520 2520
 
2521 2521
 		//redirect to edit page for attendee
2522
-		$query_args = array( 'post' => $new_attendee->ID(), 'action' => 'edit_attendee' );
2522
+		$query_args = array('post' => $new_attendee->ID(), 'action' => 'edit_attendee');
2523 2523
 
2524
-		$this->_redirect_after_action( '', '', '', $query_args, TRUE );
2524
+		$this->_redirect_after_action('', '', '', $query_args, TRUE);
2525 2525
 	}
2526 2526
 
2527 2527
 
2528 2528
 	//related to cpt routes
2529 2529
 	protected function _insert_update_cpt_item($post_id, $post) {
2530 2530
 		$success = true;
2531
-		$attendee = EEM_Attendee::instance()->get_one_by_ID( $post_id );
2531
+		$attendee = EEM_Attendee::instance()->get_one_by_ID($post_id);
2532 2532
 		//for attendee updates
2533
-		if ( $post->post_type = 'espresso_attendees' && !empty( $attendee ) ) {
2533
+		if ($post->post_type = 'espresso_attendees' && ! empty($attendee)) {
2534 2534
 			//note we should only be UPDATING attendees at this point.
2535 2535
 			$updated_fields = array(
2536 2536
 				'ATT_fname' => $this->_req_data['ATT_fname'],
2537 2537
 				'ATT_lname' => $this->_req_data['ATT_lname'],
2538
-				'ATT_full_name'=> $this->_req_data['ATT_fname'] . ' ' . $this->_req_data['ATT_lname'],
2538
+				'ATT_full_name'=> $this->_req_data['ATT_fname'].' '.$this->_req_data['ATT_lname'],
2539 2539
 				'ATT_address' => isset($this->_req_data['ATT_address']) ? $this->_req_data['ATT_address'] : '',
2540 2540
 				'ATT_address2' => isset($this->_req_data['ATT_address2']) ? $this->_req_data['ATT_address2'] : '',
2541
-				'ATT_city' => isset( $this->_req_data['ATT_city'] ) ? $this->_req_data['ATT_city'] : '',
2542
-				'STA_ID' => isset( $this->_req_data['STA_ID'] ) ? $this->_req_data['STA_ID'] : '',
2543
-				'CNT_ISO' => isset( $this->_req_data['CNT_ISO'] ) ? $this->_req_data['CNT_ISO'] : '',
2544
-				'ATT_zip' => isset( $this->_req_data['ATT_zip'] ) ? $this->_req_data['ATT_zip'] : '',
2545
-				'ATT_email' => isset( $this->_req_data['ATT_email'] ) ? $this->_req_data['ATT_email'] : '',
2546
-				'ATT_phone' => isset( $this->_req_data['ATT_phone'] ) ? $this->_req_data['ATT_phone'] : ''
2541
+				'ATT_city' => isset($this->_req_data['ATT_city']) ? $this->_req_data['ATT_city'] : '',
2542
+				'STA_ID' => isset($this->_req_data['STA_ID']) ? $this->_req_data['STA_ID'] : '',
2543
+				'CNT_ISO' => isset($this->_req_data['CNT_ISO']) ? $this->_req_data['CNT_ISO'] : '',
2544
+				'ATT_zip' => isset($this->_req_data['ATT_zip']) ? $this->_req_data['ATT_zip'] : '',
2545
+				'ATT_email' => isset($this->_req_data['ATT_email']) ? $this->_req_data['ATT_email'] : '',
2546
+				'ATT_phone' => isset($this->_req_data['ATT_phone']) ? $this->_req_data['ATT_phone'] : ''
2547 2547
 				);
2548
-			foreach ( $updated_fields as $field => $value ) {
2548
+			foreach ($updated_fields as $field => $value) {
2549 2549
 				$attendee->set($field, $value);
2550 2550
 			}
2551 2551
 
2552 2552
 			$success = $attendee->save();
2553 2553
 
2554
-			$attendee_update_callbacks = apply_filters( 'FHEE__Registrations_Admin_Page__insert_update_cpt_item__attendee_update', array() );
2555
-			foreach ( $attendee_update_callbacks as $a_callback ) {
2556
-				if ( FALSE === call_user_func_array( $a_callback, array($attendee, $this->_req_data ) ) ) {
2557
-					throw new EE_Error( sprintf( __('The %s callback given for the "FHEE__Registrations_Admin_Page__insert_update_cpt_item__attendee_update" filter is not a valid callback.  Please check the spelling.', 'event_espresso'), $a_callback ) );
2554
+			$attendee_update_callbacks = apply_filters('FHEE__Registrations_Admin_Page__insert_update_cpt_item__attendee_update', array());
2555
+			foreach ($attendee_update_callbacks as $a_callback) {
2556
+				if (FALSE === call_user_func_array($a_callback, array($attendee, $this->_req_data))) {
2557
+					throw new EE_Error(sprintf(__('The %s callback given for the "FHEE__Registrations_Admin_Page__insert_update_cpt_item__attendee_update" filter is not a valid callback.  Please check the spelling.', 'event_espresso'), $a_callback));
2558 2558
 				}
2559 2559
 			}
2560 2560
 		}
2561 2561
 
2562
-		if ( $success === FALSE )
2563
-			EE_Error::add_error(__('Something went wrong with updating the meta table data for the registration.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
2562
+		if ($success === FALSE)
2563
+			EE_Error::add_error(__('Something went wrong with updating the meta table data for the registration.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
2564 2564
 
2565 2565
 	}
2566 2566
 
@@ -2580,17 +2580,17 @@  discard block
 block discarded – undo
2580 2580
 		remove_meta_box('postexcerpt', __('Excerpt'), 'post_excerpt_meta_box', $this->_cpt_routes[$this->_req_action], 'normal', 'core');
2581 2581
 		remove_meta_box('commentstatusdiv', $this->_cpt_routes[$this->_req_action], 'normal', 'core');
2582 2582
 
2583
-		if ( post_type_supports( 'espresso_attendees', 'excerpt') ) {
2584
-			add_meta_box('postexcerpt', __('Short Biography', 'event_espresso'), 'post_excerpt_meta_box', $this->_cpt_routes[$this->_req_action], 'normal' );
2583
+		if (post_type_supports('espresso_attendees', 'excerpt')) {
2584
+			add_meta_box('postexcerpt', __('Short Biography', 'event_espresso'), 'post_excerpt_meta_box', $this->_cpt_routes[$this->_req_action], 'normal');
2585 2585
 		}
2586 2586
 
2587
-		if ( post_type_supports( 'espresso_attendees', 'comments') ) {
2587
+		if (post_type_supports('espresso_attendees', 'comments')) {
2588 2588
 			add_meta_box('commentsdiv', __('Notes on the Contact', 'event_espresso'), 'post_comment_meta_box', $this->_cpt_routes[$this->_req_action], 'normal', 'core');
2589 2589
 		}
2590 2590
 
2591
-		add_meta_box('attendee_contact_info', __('Contact Info', 'event_espresso'), array( $this, 'attendee_contact_info'), $this->_cpt_routes[$this->_req_action], 'side', 'core' );
2592
-		add_meta_box('attendee_details_address', __('Address Details', 'event_espresso'), array($this, 'attendee_address_details'), $this->_cpt_routes[$this->_req_action], 'normal', 'core' );
2593
-		add_meta_box('attendee_registrations', __('Registrations for this Contact', 'event_espresso'), array( $this, 'attendee_registrations_meta_box'), $this->_cpt_routes[$this->_req_action], 'normal', 'high');
2591
+		add_meta_box('attendee_contact_info', __('Contact Info', 'event_espresso'), array($this, 'attendee_contact_info'), $this->_cpt_routes[$this->_req_action], 'side', 'core');
2592
+		add_meta_box('attendee_details_address', __('Address Details', 'event_espresso'), array($this, 'attendee_address_details'), $this->_cpt_routes[$this->_req_action], 'normal', 'core');
2593
+		add_meta_box('attendee_registrations', __('Registrations for this Contact', 'event_espresso'), array($this, 'attendee_registrations_meta_box'), $this->_cpt_routes[$this->_req_action], 'normal', 'high');
2594 2594
 	}
2595 2595
 
2596 2596
 
@@ -2599,10 +2599,10 @@  discard block
 block discarded – undo
2599 2599
 	 * @param  WP_Post $post wp post object
2600 2600
 	 * @return string        attendee contact info ( and form )
2601 2601
 	 */
2602
-	public function attendee_contact_info( $post ) {
2602
+	public function attendee_contact_info($post) {
2603 2603
 		//get attendee object ( should already have it )
2604 2604
 		$this->_template_args['attendee'] = $this->_cpt_model_obj;
2605
-		$template = REG_TEMPLATE_PATH . 'attendee_contact_info_metabox_content.template.php';
2605
+		$template = REG_TEMPLATE_PATH.'attendee_contact_info_metabox_content.template.php';
2606 2606
 		EEH_Template::display_template($template, $this->_template_args);
2607 2607
 	}
2608 2608
 
@@ -2618,12 +2618,12 @@  discard block
 block discarded – undo
2618 2618
 		$this->_template_args['attendee'] = $this->_cpt_model_obj;
2619 2619
 		$this->_template_args['state_html'] = EEH_Form_Fields::generate_form_input(
2620 2620
 				new EE_Question_Form_Input(
2621
-				EE_Question::new_instance( array(
2621
+				EE_Question::new_instance(array(
2622 2622
 					'QST_ID' => 0,
2623 2623
 					'QST_display_text' => __('State/Province', 'event_espresso'),
2624 2624
 					'QST_system' => 'admin-state'
2625 2625
 					)),
2626
-				EE_Answer::new_instance( array(
2626
+				EE_Answer::new_instance(array(
2627 2627
 					'ANS_ID' => 0,
2628 2628
 					'ANS_value' => $this->_cpt_model_obj->state_ID()
2629 2629
 					)),
@@ -2636,12 +2636,12 @@  discard block
 block discarded – undo
2636 2636
 			));
2637 2637
 		$this->_template_args['country_html'] = EEH_Form_Fields::generate_form_input(
2638 2638
 				new EE_Question_Form_Input(
2639
-				EE_Question::new_instance( array(
2639
+				EE_Question::new_instance(array(
2640 2640
 					'QST_ID' => 0,
2641 2641
 					'QST_display_text' => __('Country', 'event_espresso'),
2642 2642
 					'QST_system' => 'admin-country'
2643 2643
 					)),
2644
-				EE_Answer::new_instance( array(
2644
+				EE_Answer::new_instance(array(
2645 2645
 					'ANS_ID' => 0,
2646 2646
 					'ANS_value' => $this->_cpt_model_obj->country_ID()
2647 2647
 					)),
@@ -2652,8 +2652,8 @@  discard block
 block discarded – undo
2652 2652
 					'append_qstn_id' => FALSE
2653 2653
 					)
2654 2654
 				));
2655
-		$template = REG_TEMPLATE_PATH . 'attendee_address_details_metabox_content.template.php';
2656
-		EEH_Template::display_template($template, $this->_template_args );
2655
+		$template = REG_TEMPLATE_PATH.'attendee_address_details_metabox_content.template.php';
2656
+		EEH_Template::display_template($template, $this->_template_args);
2657 2657
 
2658 2658
 	}
2659 2659
 
@@ -2663,11 +2663,11 @@  discard block
 block discarded – undo
2663 2663
 	*		@access protected
2664 2664
 	*		@return void
2665 2665
 	*/
2666
-	public function attendee_registrations_meta_box( $post ) {
2666
+	public function attendee_registrations_meta_box($post) {
2667 2667
 
2668 2668
 		$this->_template_args['attendee'] = $this->_cpt_model_obj;
2669 2669
 		$this->_template_args['registrations'] = $this->_cpt_model_obj->get_many_related('Registration');
2670
-		$template = REG_TEMPLATE_PATH . 'attendee_registrations_main_meta_box.template.php';
2670
+		$template = REG_TEMPLATE_PATH.'attendee_registrations_main_meta_box.template.php';
2671 2671
 		EEH_Template::display_template($template, $this->_template_args);
2672 2672
 
2673 2673
 	}
@@ -2681,8 +2681,8 @@  discard block
 block discarded – undo
2681 2681
 	 * @return string        html for new form.
2682 2682
 	 */
2683 2683
 	public function after_title_form_fields($post) {
2684
-		if ( $post->post_type == 'espresso_attendees' ) {
2685
-			$template = REG_TEMPLATE_PATH . 'attendee_details_after_title_form_fields.template.php';
2684
+		if ($post->post_type == 'espresso_attendees') {
2685
+			$template = REG_TEMPLATE_PATH.'attendee_details_after_title_form_fields.template.php';
2686 2686
 			$template_args['attendee'] = $this->_cpt_model_obj;
2687 2687
 			EEH_Template::display_template($template, $template_args);
2688 2688
 		}
@@ -2699,21 +2699,21 @@  discard block
 block discarded – undo
2699 2699
 	*		@access protected
2700 2700
 	*		@return void
2701 2701
 	*/
2702
-	protected function _trash_or_restore_attendees( $trash = TRUE ) {
2702
+	protected function _trash_or_restore_attendees($trash = TRUE) {
2703 2703
 
2704
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
2704
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2705 2705
 
2706 2706
 		$ATT_MDL = EEM_Attendee::instance();
2707 2707
 
2708 2708
 		$success = 1;
2709 2709
 		//Checkboxes
2710
-		if (!empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
2710
+		if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
2711 2711
 			// if array has more than one element than success message should be plural
2712
-			$success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1;
2712
+			$success = count($this->_req_data['checkbox']) > 1 ? 2 : 1;
2713 2713
 			// cycle thru checkboxes
2714
-			while (list( $ATT_ID, $value ) = each($this->_req_data['checkbox'])) {
2715
-				$updated = $trash ? $ATT_MDL->update_by_ID(array( 'status' => 'trash' ), $ATT_ID) : $ATT_MDL->update_by_ID( array('status' => 'publish' ), $ATT_ID);
2716
-				if ( !$updated ) {
2714
+			while (list($ATT_ID, $value) = each($this->_req_data['checkbox'])) {
2715
+				$updated = $trash ? $ATT_MDL->update_by_ID(array('status' => 'trash'), $ATT_ID) : $ATT_MDL->update_by_ID(array('status' => 'publish'), $ATT_ID);
2716
+				if ( ! $updated) {
2717 2717
 					$success = 0;
2718 2718
 				}
2719 2719
 			}
@@ -2722,18 +2722,18 @@  discard block
 block discarded – undo
2722 2722
 			// grab single id and delete
2723 2723
 			$ATT_ID = absint($this->_req_data['ATT_ID']);
2724 2724
 			//get attendee
2725
-			$att = $ATT_MDL->get_one_by_ID( $ATT_ID );
2725
+			$att = $ATT_MDL->get_one_by_ID($ATT_ID);
2726 2726
 			$updated = $trash ? $att->set_status('trash') : $att->set_status('publish');
2727 2727
 			$updated = $att->save();
2728
-			if ( ! $updated ) {
2728
+			if ( ! $updated) {
2729 2729
 				$success = 0;
2730 2730
 			}
2731 2731
 
2732 2732
 		}
2733 2733
 
2734
-		$what = $success > 1 ? __( 'Contacts', 'event_espresso' ) : __( 'Contact', 'event_espresso' );
2735
-		$action_desc = $trash ? __( 'moved to the trash', 'event_espresso' ) : __( 'restored', 'event_espresso' );
2736
-		$this->_redirect_after_action( $success, $what, $action_desc, array( 'action' => 'contact_list' ) );
2734
+		$what = $success > 1 ? __('Contacts', 'event_espresso') : __('Contact', 'event_espresso');
2735
+		$action_desc = $trash ? __('moved to the trash', 'event_espresso') : __('restored', 'event_espresso');
2736
+		$this->_redirect_after_action($success, $what, $action_desc, array('action' => 'contact_list'));
2737 2737
 
2738 2738
 	}
2739 2739
 
Please login to merge, or discard this patch.
admin_pages/registrations/EE_Registrations_List_Table.class.php 1 patch
Spacing   +163 added lines, -163 removed lines patch added patch discarded remove patch
@@ -57,14 +57,14 @@  discard block
 block discarded – undo
57 57
 	 * @param \EE_Admin_Page $admin_page
58 58
 	 * @return EE_Registrations_List_Table
59 59
 	 */
60
-	function __construct( $admin_page ){
60
+	function __construct($admin_page) {
61 61
 
62
-		if ( ! empty( $_GET['event_id'] ) ) {
62
+		if ( ! empty($_GET['event_id'])) {
63 63
 			$extra_query_args = array();
64
-			foreach ( $admin_page->get_views() as $key => $view_details ) {
65
-				$extra_query_args[$view_details['slug']] = array( 'event_id' => $_GET['event_id'] );
64
+			foreach ($admin_page->get_views() as $key => $view_details) {
65
+				$extra_query_args[$view_details['slug']] = array('event_id' => $_GET['event_id']);
66 66
 			}
67
-			$this->_views = $admin_page->get_list_table_view_RLs( $extra_query_args );
67
+			$this->_views = $admin_page->get_list_table_view_RLs($extra_query_args);
68 68
 		}
69 69
 
70 70
 		parent::__construct($admin_page);
@@ -80,8 +80,8 @@  discard block
 block discarded – undo
80 80
 	 * @return void
81 81
 	 */
82 82
 	protected function _setup_data() {
83
-		$this->_data = $this->_admin_page->get_registrations( $this->_per_page );
84
-		$this->_all_data_count = $this->_admin_page->get_registrations( $this->_per_page, TRUE, FALSE, FALSE );
83
+		$this->_data = $this->_admin_page->get_registrations($this->_per_page);
84
+		$this->_all_data_count = $this->_admin_page->get_registrations($this->_per_page, TRUE, FALSE, FALSE);
85 85
 	}
86 86
 
87 87
 
@@ -100,45 +100,45 @@  discard block
 block discarded – undo
100 100
 			);
101 101
 
102 102
 
103
-		if ( isset( $_GET['event_id'] )) {
103
+		if (isset($_GET['event_id'])) {
104 104
 			$this->_columns = array(
105 105
 				'cb' => '<input type="checkbox" />', //Render a checkbox instead of text
106
-				'_REG_ID' => __( 'ID', 'event_espresso' ),
107
-				'ATT_fname' => __( 'Name', 'event_espresso' ),
106
+				'_REG_ID' => __('ID', 'event_espresso'),
107
+				'ATT_fname' => __('Name', 'event_espresso'),
108 108
 				'ATT_email' =>  __('Email', 'event_espresso'),
109
-				'_REG_date' => __( 'Reg Date', 'event_espresso' ),
110
-				'PRC_amount' => __( 'TKT Price', 'event_espresso' ),
111
-				'_REG_final_price' => __( 'Final Price', 'event_espresso' ),
112
-				'TXN_total' => __( 'Total Txn', 'event_espresso' ),
109
+				'_REG_date' => __('Reg Date', 'event_espresso'),
110
+				'PRC_amount' => __('TKT Price', 'event_espresso'),
111
+				'_REG_final_price' => __('Final Price', 'event_espresso'),
112
+				'TXN_total' => __('Total Txn', 'event_espresso'),
113 113
 				'TXN_paid' => __('Paid', 'event_espresso'),
114
-				'actions' => __( 'Actions', 'event_espresso' )
114
+				'actions' => __('Actions', 'event_espresso')
115 115
 				);
116 116
 			$this->_bottom_buttons = array(
117 117
 					'report'=> array(
118 118
 					'route' => 'registrations_report',
119 119
 					'extra_request' =>
120 120
 						array(
121
-							'EVT_ID'=> isset( $this->_req_data['event_id'] ) ? $this->_req_data['event_id'] : null,
122
-							'return_url' => urlencode( "//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}" ) )
121
+							'EVT_ID'=> isset($this->_req_data['event_id']) ? $this->_req_data['event_id'] : null,
122
+							'return_url' => urlencode("//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}") )
123 123
 				),
124 124
 			);
125 125
 		} else {
126 126
 			$this->_columns = array(
127 127
 				'cb' => '<input type="checkbox" />', //Render a checkbox instead of text
128
-				'_REG_ID' => __( 'ID', 'event_espresso' ),
129
-				'ATT_fname' => __( 'Name', 'event_espresso' ),
130
-				'_REG_date' => __( 'TXN Date', 'event_espresso' ),
131
-				'event_name' => __( 'Event', 'event_espresso' ),
132
-					'DTT_EVT_start' => __( 'Event Date', 'event_espresso' ),
133
-				'_REG_final_price' => __( 'Price', 'event_espresso' ),
134
-				'_REG_paid' => __( 'Paid', 'event_espresso' ),
135
-				'actions' => __( 'Actions', 'event_espresso' )
128
+				'_REG_ID' => __('ID', 'event_espresso'),
129
+				'ATT_fname' => __('Name', 'event_espresso'),
130
+				'_REG_date' => __('TXN Date', 'event_espresso'),
131
+				'event_name' => __('Event', 'event_espresso'),
132
+					'DTT_EVT_start' => __('Event Date', 'event_espresso'),
133
+				'_REG_final_price' => __('Price', 'event_espresso'),
134
+				'_REG_paid' => __('Paid', 'event_espresso'),
135
+				'actions' => __('Actions', 'event_espresso')
136 136
 			);
137 137
 			$this->_bottom_buttons = array(
138 138
 				'report_all'=> array(
139 139
 				'route' => 'registrations_report',
140 140
 				'extra_request' => array(
141
-					'return_url' => urlencode( "//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}" ) )
141
+					'return_url' => urlencode("//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}") )
142 142
 				),
143 143
 			);
144 144
 		}
@@ -146,11 +146,11 @@  discard block
 block discarded – undo
146 146
 		$this->_primary_column = '_REG_ID';
147 147
 
148 148
 		$this->_sortable_columns = array(
149
-			'_REG_date' => array( '_REG_date' => TRUE ),   //true means its already sorted
150
-			'ATT_fname' => array( 'ATT_fname' => FALSE ),
151
-			'event_name' => array( 'event_name' => FALSE ),
152
-			'DTT_EVT_start'	=> array( 'DTT_EVT_start' => FALSE ),
153
-			'_REG_ID' => array( '_REG_ID' => FALSE ),
149
+			'_REG_date' => array('_REG_date' => TRUE), //true means its already sorted
150
+			'ATT_fname' => array('ATT_fname' => FALSE),
151
+			'event_name' => array('event_name' => FALSE),
152
+			'DTT_EVT_start'	=> array('DTT_EVT_start' => FALSE),
153
+			'_REG_ID' => array('_REG_ID' => FALSE),
154 154
 		);
155 155
 
156 156
 		$this->_hidden_columns = array();
@@ -159,11 +159,11 @@  discard block
 block discarded – undo
159 159
 
160 160
 
161 161
 
162
-	protected function _get_row_class( $item ) {
163
-		$class = parent::_get_row_class( $item );
162
+	protected function _get_row_class($item) {
163
+		$class = parent::_get_row_class($item);
164 164
 		//add status class
165
-		$class .= ' ee-status-strip reg-status-' . $item->status_ID();
166
-		if ( $this->_has_checkbox_column ) {
165
+		$class .= ' ee-status-strip reg-status-'.$item->status_ID();
166
+		if ($this->_has_checkbox_column) {
167 167
 			$class .= ' has-checkbox-column';
168 168
 		}
169 169
 		return $class;
@@ -176,15 +176,15 @@  discard block
 block discarded – undo
176 176
 	 *
177 177
 	 * @param EE_Registration $registration
178 178
 	 */
179
-	protected function _set_related_details( EE_Registration $registration ) {
179
+	protected function _set_related_details(EE_Registration $registration) {
180 180
 
181
-		$transaction = $registration->get_first_related( 'Transaction' );
181
+		$transaction = $registration->get_first_related('Transaction');
182 182
 		$status = $transaction instanceof EE_Transaction ? $transaction->status_ID() : EEM_Transaction::failed_status_code;
183 183
 		$this->_transaction_details = array(
184 184
 			'transaction' => $transaction,
185 185
 			'status' => $status,
186 186
 			'id' => $transaction instanceof EE_Transaction ? $transaction->ID() : 0,
187
-			'title_attr' => sprintf( __('View Transaction Details (%s)', 'event_espresso'), EEH_Template::pretty_status( $status, false, 'sentence' ) )
187
+			'title_attr' => sprintf(__('View Transaction Details (%s)', 'event_espresso'), EEH_Template::pretty_status($status, false, 'sentence'))
188 188
 			);
189 189
 
190 190
 		$event = $registration->event();
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
 			'event' => $event,
194 194
 			'status' => $status,
195 195
 			'id' => $event instanceof EE_Event ? $event->ID() : 0,
196
-			'title_attr' => sprintf( __('Edit Event (%s)', 'event_espresso'), EEH_Template::pretty_status( $status, false, 'sentence' ) )
196
+			'title_attr' => sprintf(__('Edit Event (%s)', 'event_espresso'), EEH_Template::pretty_status($status, false, 'sentence'))
197 197
 			);
198 198
 	}
199 199
 
@@ -209,24 +209,24 @@  discard block
 block discarded – undo
209 209
 
210 210
 		//todo we're currently using old functions here. We need to move things into the Events_Admin_Page() class as methods.
211 211
 
212
-		$cur_date = isset( $this->_req_data['month_range'] ) ? $this->_req_data['month_range'] : '';
213
-		$cur_category = isset( $this->_req_data['EVT_CAT'] ) ? $this->_req_data['EVT_CAT'] : -1;
214
-		$reg_status = isset( $this->_req_data['_reg_status'] ) ? $this->_req_data['_reg_status'] : '';
212
+		$cur_date = isset($this->_req_data['month_range']) ? $this->_req_data['month_range'] : '';
213
+		$cur_category = isset($this->_req_data['EVT_CAT']) ? $this->_req_data['EVT_CAT'] : -1;
214
+		$reg_status = isset($this->_req_data['_reg_status']) ? $this->_req_data['_reg_status'] : '';
215 215
 
216
-		$filters[] = EEH_Form_Fields::generate_registration_months_dropdown( $cur_date, $reg_status, $cur_category );
217
-		$filters[] = EEH_Form_Fields::generate_event_category_dropdown( $cur_category );
216
+		$filters[] = EEH_Form_Fields::generate_registration_months_dropdown($cur_date, $reg_status, $cur_category);
217
+		$filters[] = EEH_Form_Fields::generate_event_category_dropdown($cur_category);
218 218
 
219 219
 		$status = array();
220
-		$status[] = array( 'id' => 0, 'text' => __('Select Status', 'event_espresso') );
221
-		foreach ( $this->_status as $key => $value ) {
222
-			$status[] = array( 'id' => $key, 'text' => $value );
220
+		$status[] = array('id' => 0, 'text' => __('Select Status', 'event_espresso'));
221
+		foreach ($this->_status as $key => $value) {
222
+			$status[] = array('id' => $key, 'text' => $value);
223 223
 		}
224
-		if ( $this->_view != 'incomplete' ) {
225
-			$filters[] = EEH_Form_Fields::select_input('_reg_status', $status, isset( $this->_req_data['_reg_status'] ) ? strtoupper( sanitize_key( $this->_req_data['_reg_status'] )) : '' );
224
+		if ($this->_view != 'incomplete') {
225
+			$filters[] = EEH_Form_Fields::select_input('_reg_status', $status, isset($this->_req_data['_reg_status']) ? strtoupper(sanitize_key($this->_req_data['_reg_status'])) : '');
226 226
 		}
227 227
 
228
-		if ( isset( $this->_req_data['event_id'] ) ) {
229
-			$filters[] = EEH_Form_Fields::hidden_input( 'event_id',  $this->_req_data['event_id'], 'reg_event_id' );
228
+		if (isset($this->_req_data['event_id'])) {
229
+			$filters[] = EEH_Form_Fields::hidden_input('event_id', $this->_req_data['event_id'], 'reg_event_id');
230 230
 		}
231 231
 
232 232
 		return $filters;
@@ -243,9 +243,9 @@  discard block
 block discarded – undo
243 243
 		$this->_views['all']['count'] = $this->_total_registrations();
244 244
 		$this->_views['month']['count'] = $this->_total_registrations_this_month();
245 245
 		$this->_views['today']['count'] = $this->_total_registrations_today();
246
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_registrations', 'espresso_registrations_trash_registrations' ) ) {
247
-			$this->_views['incomplete']['count'] = $this->_total_registrations( 'incomplete' );
248
-			$this->_views['trash']['count'] = $this->_total_registrations( 'trash' );
246
+		if (EE_Registry::instance()->CAP->current_user_can('ee_delete_registrations', 'espresso_registrations_trash_registrations')) {
247
+			$this->_views['incomplete']['count'] = $this->_total_registrations('incomplete');
248
+			$this->_views['trash']['count'] = $this->_total_registrations('trash');
249 249
 		}
250 250
 	}
251 251
 
@@ -257,23 +257,23 @@  discard block
 block discarded – undo
257 257
 	 * @param string $view
258 258
 	 * @return int
259 259
 	 */
260
-	protected function _total_registrations( $view = '' ){
260
+	protected function _total_registrations($view = '') {
261 261
 		$_where = array();
262
-		$EVT_ID = isset( $this->_req_data['event_id'] ) ? absint( $this->_req_data['event_id'] ) : FALSE;
263
-		if( $EVT_ID ) {
262
+		$EVT_ID = isset($this->_req_data['event_id']) ? absint($this->_req_data['event_id']) : FALSE;
263
+		if ($EVT_ID) {
264 264
 			$_where['EVT_ID'] = $EVT_ID;
265 265
 		}
266
-		switch ( $view ) {
266
+		switch ($view) {
267 267
 			case 'trash' :
268
-				return EEM_Registration::instance()->count_deleted( array( $_where ));
268
+				return EEM_Registration::instance()->count_deleted(array($_where));
269 269
 				break;
270 270
 			case 'incomplete' :
271 271
 				$_where['STS_ID'] = EEM_Registration::status_id_incomplete;
272 272
 				break;
273 273
 			default :
274
-				$_where['STS_ID'] = array( '!=', EEM_Registration::status_id_incomplete );
274
+				$_where['STS_ID'] = array('!=', EEM_Registration::status_id_incomplete);
275 275
 		}
276
-		return EEM_Registration::instance()->count( array( $_where ));
276
+		return EEM_Registration::instance()->count(array($_where));
277 277
 	}
278 278
 
279 279
 
@@ -283,24 +283,24 @@  discard block
 block discarded – undo
283 283
 	 * @access protected
284 284
 	 * @return int
285 285
 	 */
286
-	protected function _total_registrations_this_month(){
287
-		$EVT_ID = isset( $this->_req_data['event_id'] ) ? absint( $this->_req_data['event_id'] ) : FALSE;
288
-		$_where = $EVT_ID ? array( 'EVT_ID' => $EVT_ID ) : array();
286
+	protected function _total_registrations_this_month() {
287
+		$EVT_ID = isset($this->_req_data['event_id']) ? absint($this->_req_data['event_id']) : FALSE;
288
+		$_where = $EVT_ID ? array('EVT_ID' => $EVT_ID) : array();
289 289
 		$this_year_r = date('Y', current_time('timestamp'));
290 290
 		$time_start = ' 00:00:00';
291 291
 		$time_end = ' 23:59:59';
292 292
 		$this_month_r = date('m', current_time('timestamp'));
293
-		$days_this_month = date( 't', current_time('timestamp') );
293
+		$days_this_month = date('t', current_time('timestamp'));
294 294
 		//setup date query.
295
-		$beginning_string = EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $this_year_r . '-' . $this_month_r . '-01' . ' ' . $time_start, 'Y-m-d H:i:s' );
296
-		$end_string = EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $this_year_r . '-' . $this_month_r . '-' . $days_this_month . ' ' . $time_end, 'Y-m-d H:i:s' );
297
-		$_where['REG_date']= array('BETWEEN',
295
+		$beginning_string = EEM_Registration::instance()->convert_datetime_for_query('REG_date', $this_year_r.'-'.$this_month_r.'-01'.' '.$time_start, 'Y-m-d H:i:s');
296
+		$end_string = EEM_Registration::instance()->convert_datetime_for_query('REG_date', $this_year_r.'-'.$this_month_r.'-'.$days_this_month.' '.$time_end, 'Y-m-d H:i:s');
297
+		$_where['REG_date'] = array('BETWEEN',
298 298
 			array(
299 299
 				$beginning_string,
300 300
 				$end_string
301 301
 		));
302
-		$_where['STS_ID'] = array( '!=', EEM_Registration::status_id_incomplete );
303
-		return EEM_Registration::instance()->count(array( $_where ) );
302
+		$_where['STS_ID'] = array('!=', EEM_Registration::status_id_incomplete);
303
+		return EEM_Registration::instance()->count(array($_where));
304 304
 	}
305 305
 
306 306
 
@@ -310,20 +310,20 @@  discard block
 block discarded – undo
310 310
 	 * @access protected
311 311
 	 * @return int
312 312
 	 */
313
-	protected function _total_registrations_today(){
313
+	protected function _total_registrations_today() {
314 314
 
315
-		$EVT_ID = isset( $this->_req_data['event_id'] ) ? absint( $this->_req_data['event_id'] ) : FALSE;
316
-		$_where = $EVT_ID ? array( 'EVT_ID' => $EVT_ID ) : array();
315
+		$EVT_ID = isset($this->_req_data['event_id']) ? absint($this->_req_data['event_id']) : FALSE;
316
+		$_where = $EVT_ID ? array('EVT_ID' => $EVT_ID) : array();
317 317
 		$current_date = date('Y-m-d', current_time('timestamp'));
318 318
 		$time_start = ' 00:00:00';
319 319
 		$time_end = ' 23:59:59';
320
-		$_where['REG_date']= array('BETWEEN',
320
+		$_where['REG_date'] = array('BETWEEN',
321 321
 			array(
322
-				EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $current_date . $time_start, 'Y-m-d H:i:s' ),
323
-				EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $current_date . $time_end, 'Y-m-d H:i:s' )
322
+				EEM_Registration::instance()->convert_datetime_for_query('REG_date', $current_date.$time_start, 'Y-m-d H:i:s'),
323
+				EEM_Registration::instance()->convert_datetime_for_query('REG_date', $current_date.$time_end, 'Y-m-d H:i:s')
324 324
 		));
325
-		$_where['STS_ID'] = array( '!=', EEM_Registration::status_id_incomplete );
326
-		return EEM_Registration::instance()->count(array( $_where ) );
325
+		$_where['STS_ID'] = array('!=', EEM_Registration::status_id_incomplete);
326
+		return EEM_Registration::instance()->count(array($_where));
327 327
 	}
328 328
 
329 329
 
@@ -335,11 +335,11 @@  discard block
 block discarded – undo
335 335
 	 * @param \EE_Registration $item
336 336
 	 * @return string
337 337
 	 */
338
-    function column_cb($item){
338
+    function column_cb($item) {
339 339
 	/** checkbox/lock **/
340
-	$transaction = $item->get_first_related( 'Transaction' );
341
-	$payment_count = $transaction instanceof EE_Transaction ? $transaction->count_related( 'Payment' ) : 0;
342
-	return $payment_count > 0 ? sprintf( '<input type="checkbox" name="_REG_ID[]" value="%1$s" />', $item->ID() ) . '<span class="ee-lock-icon"></span>' : sprintf( '<input type="checkbox" name="_REG_ID[]" value="%1$s" />', $item->ID() );
340
+	$transaction = $item->get_first_related('Transaction');
341
+	$payment_count = $transaction instanceof EE_Transaction ? $transaction->count_related('Payment') : 0;
342
+	return $payment_count > 0 ? sprintf('<input type="checkbox" name="_REG_ID[]" value="%1$s" />', $item->ID()).'<span class="ee-lock-icon"></span>' : sprintf('<input type="checkbox" name="_REG_ID[]" value="%1$s" />', $item->ID());
343 343
     }
344 344
 
345 345
 
@@ -351,14 +351,14 @@  discard block
 block discarded – undo
351 351
 	 * @param \EE_Registration $item
352 352
 	 * @return string
353 353
 	 */
354
-	function column__REG_ID(EE_Registration $item){
354
+	function column__REG_ID(EE_Registration $item) {
355 355
 		$attendee = $item->attendee();
356 356
 		$content = $item->ID();
357 357
 		$content .= '<div class="show-on-mobile-view-only">';
358 358
 		$content .= '<br>';
359 359
 		$content .= $attendee instanceof EE_Attendee ? $attendee->full_name() : '';
360
-		$content .= '&nbsp;' . sprintf(__( '(%1$s / %2$s)', 'event_espresso' ), $item->count(), $item->group_size());
361
-		$content .= '<br>' . sprintf( __( 'Reg Code: %s', 'event_espresso' ), $item->get('REG_code') );
360
+		$content .= '&nbsp;'.sprintf(__('(%1$s / %2$s)', 'event_espresso'), $item->count(), $item->group_size());
361
+		$content .= '<br>'.sprintf(__('Reg Code: %s', 'event_espresso'), $item->get('REG_code'));
362 362
 		$content .= '</div>';
363 363
 		return $content;
364 364
 	}
@@ -372,12 +372,12 @@  discard block
 block discarded – undo
372 372
 	 * @param \EE_Registration $item
373 373
 	 * @return string
374 374
 	 */
375
-	function column__REG_date(EE_Registration $item){
375
+	function column__REG_date(EE_Registration $item) {
376 376
 		$this->_set_related_details($item);
377 377
        		 //Build row actions
378
-		$view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=> $this->_transaction_details['id'] ), TXN_ADMIN_URL );
379
-		$view_link = EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction') ? '<a class="ee-status-color-' . $this->_transaction_details['status'] . '" href="'.$view_lnk_url.'" title="' . esc_attr( $this->_transaction_details['title_attr'] ) . '">' . $item->get_i18n_datetime( 'REG_date' ) . '</a>' : $item->get_i18n_datetime( 'REG_date' );
380
-		$view_link .= '<br><span class="ee-status-text-small">' . EEH_Template::pretty_status( $this->_transaction_details['status'], false, 'sentence' ) . '</span>';
378
+		$view_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=> $this->_transaction_details['id']), TXN_ADMIN_URL);
379
+		$view_link = EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction') ? '<a class="ee-status-color-'.$this->_transaction_details['status'].'" href="'.$view_lnk_url.'" title="'.esc_attr($this->_transaction_details['title_attr']).'">'.$item->get_i18n_datetime('REG_date').'</a>' : $item->get_i18n_datetime('REG_date');
380
+		$view_link .= '<br><span class="ee-status-text-small">'.EEH_Template::pretty_status($this->_transaction_details['status'], false, 'sentence').'</span>';
381 381
 		return $view_link;
382 382
 	}
383 383
 
@@ -390,18 +390,18 @@  discard block
 block discarded – undo
390 390
 	 * @param \EE_Registration $item
391 391
 	 * @return string
392 392
 	 */
393
-	function column_event_name(EE_Registration $item){
394
-		$this->_set_related_details( $item );
393
+	function column_event_name(EE_Registration $item) {
394
+		$this->_set_related_details($item);
395 395
 		// page=espresso_events&action=edit_event&EVT_ID=2&edit_event_nonce=cf3a7e5b62
396
-		$edit_event_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'edit', 'post'=>$item->event_ID() ), EVENTS_ADMIN_URL );
396
+		$edit_event_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'edit', 'post'=>$item->event_ID()), EVENTS_ADMIN_URL);
397 397
 		$event_name = $item->event_name();
398 398
 		$event_name = $event_name ? $event_name : __("No Associated Event", 'event_espresso');
399
-		$edit_event = EE_Registry::instance()->CAP->current_user_can('ee_edit_event', 'edit_event', $item->event_ID() ) ? '<a class="ee-status-color-' . $this->_event_details['status'] . '" href="' . $edit_event_url . '" title="' . esc_attr( $this->_event_details['title_attr'] ) .'">' .  wp_trim_words( $event_name, 30, '...' ) . '</a>' : wp_trim_words( $event_name, 30, '...' ) ;
399
+		$edit_event = EE_Registry::instance()->CAP->current_user_can('ee_edit_event', 'edit_event', $item->event_ID()) ? '<a class="ee-status-color-'.$this->_event_details['status'].'" href="'.$edit_event_url.'" title="'.esc_attr($this->_event_details['title_attr']).'">'.wp_trim_words($event_name, 30, '...').'</a>' : wp_trim_words($event_name, 30, '...');
400 400
 
401
-		$edit_event_url = EE_Admin_Page::add_query_args_and_nonce( array( 'event_id'=>$item->event_ID() ), REG_ADMIN_URL );
402
-		$actions['event_filter'] = '<a href="' . $edit_event_url . '" title="' . sprintf( esc_attr__( 'Filter this list to only show registrations for %s', 'event_espresso' ), $event_name ) .'">' .  __( 'View Registrations', 'event_espresso' ) . '</a>';
401
+		$edit_event_url = EE_Admin_Page::add_query_args_and_nonce(array('event_id'=>$item->event_ID()), REG_ADMIN_URL);
402
+		$actions['event_filter'] = '<a href="'.$edit_event_url.'" title="'.sprintf(esc_attr__('Filter this list to only show registrations for %s', 'event_espresso'), $event_name).'">'.__('View Registrations', 'event_espresso').'</a>';
403 403
 
404
-		return sprintf('%1$s %2$s', $edit_event, $this->row_actions($actions) );
404
+		return sprintf('%1$s %2$s', $edit_event, $this->row_actions($actions));
405 405
 	}
406 406
 
407 407
 
@@ -413,18 +413,18 @@  discard block
 block discarded – undo
413 413
 	 * @param \EE_Registration $item
414 414
 	 * @return string
415 415
 	 */
416
-   	function column_DTT_EVT_start(EE_Registration $item){
416
+   	function column_DTT_EVT_start(EE_Registration $item) {
417 417
 		$datetime_strings = array();
418
-		$ticket = $item->ticket( TRUE );
419
-		if ( $ticket instanceof EE_Ticket ) {
418
+		$ticket = $item->ticket(TRUE);
419
+		if ($ticket instanceof EE_Ticket) {
420 420
 			$remove_defaults = array('default_where_conditions' => 'none');
421 421
 			$datetimes = $ticket->datetimes($remove_defaults);
422
-			foreach($datetimes as $datetime){
423
-				$datetime_strings[] = $datetime->get_i18n_datetime( 'DTT_EVT_start' );
422
+			foreach ($datetimes as $datetime) {
423
+				$datetime_strings[] = $datetime->get_i18n_datetime('DTT_EVT_start');
424 424
 			}
425
-			return implode("<br />",$datetime_strings);
425
+			return implode("<br />", $datetime_strings);
426 426
 		} else {
427
-			return __( 'There is no ticket on this registration', 'event_espresso' );
427
+			return __('There is no ticket on this registration', 'event_espresso');
428 428
 		}
429 429
     }
430 430
 
@@ -437,45 +437,45 @@  discard block
 block discarded – undo
437 437
 	 * @param \EE_Registration $item
438 438
 	 * @return string
439 439
 	 */
440
-   	function column_ATT_fname(EE_Registration $item){
440
+   	function column_ATT_fname(EE_Registration $item) {
441 441
    		$attendee = $item->attendee();
442 442
 
443
-		$edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_registration', '_REG_ID'=>$item->ID() ), REG_ADMIN_URL );
443
+		$edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_registration', '_REG_ID'=>$item->ID()), REG_ADMIN_URL);
444 444
 		$attendee_name = $attendee instanceof EE_Attendee ? $attendee->full_name() : '';
445
-		$link = EE_Registry::instance()->CAP->current_user_can('ee_read_registration', 'espresso_registrations_view_registration', $item->ID() ) ? '<a href="'.$edit_lnk_url.'" title="' . esc_attr__( 'View Registration Details', 'event_espresso' ) . '">' . $attendee_name . '</a>' : $attendee_name;
445
+		$link = EE_Registry::instance()->CAP->current_user_can('ee_read_registration', 'espresso_registrations_view_registration', $item->ID()) ? '<a href="'.$edit_lnk_url.'" title="'.esc_attr__('View Registration Details', 'event_espresso').'">'.$attendee_name.'</a>' : $attendee_name;
446 446
 		$link .= $item->count() == 1 ? '&nbsp;<sup><div class="dashicons dashicons-star-filled lt-blue-icon ee-icon-size-8"></div></sup>' : '';
447 447
 
448 448
 		$t = $item->get_first_related('Transaction');
449 449
 		$payment_count = $t instanceof EE_Transaction ? $t->count_related('Payment') : 0;
450 450
 
451 451
 	    //append group count to name
452
-	    $link .= '&nbsp;' . sprintf(__( '(%1$s / %2$s)', 'event_espresso' ), $item->count(), $item->group_size());
452
+	    $link .= '&nbsp;'.sprintf(__('(%1$s / %2$s)', 'event_espresso'), $item->count(), $item->group_size());
453 453
 
454 454
 	    //append reg_code
455
-	    $link .= '<br>' . sprintf( __( 'Reg Code: %s', 'event_espresso' ), $item->get('REG_code') );
455
+	    $link .= '<br>'.sprintf(__('Reg Code: %s', 'event_espresso'), $item->get('REG_code'));
456 456
 
457 457
 	    //reg status text for accessibility
458
-	    $link .= '<br><span class="ee-status-text-small">' . EEH_Template::pretty_status( $item->status_ID(), false, 'sentence' ) . '</span>';
458
+	    $link .= '<br><span class="ee-status-text-small">'.EEH_Template::pretty_status($item->status_ID(), false, 'sentence').'</span>';
459 459
 
460 460
 		//trash/restore/delete actions
461 461
 		$actions = array();
462
-		if ( $this->_view != 'trash' && $payment_count === 0 && EE_Registry::instance()->CAP->current_user_can( 'ee_delete_registration', 'espresso_registrations_trash_registrations', $item->ID() ) ) {
463
-			$trash_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'trash_registrations', '_REG_ID'=>$item->ID() ), REG_ADMIN_URL );
464
-			$actions['trash'] = '<a href="'.$trash_lnk_url.'" title="' . esc_attr__( 'Trash Registration', 'event_espresso' ) . '">' . __( 'Trash', 'event_espresso' ) . '</a>';
465
-		} elseif ( $this->_view == 'trash' ) {
462
+		if ($this->_view != 'trash' && $payment_count === 0 && EE_Registry::instance()->CAP->current_user_can('ee_delete_registration', 'espresso_registrations_trash_registrations', $item->ID())) {
463
+			$trash_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'trash_registrations', '_REG_ID'=>$item->ID()), REG_ADMIN_URL);
464
+			$actions['trash'] = '<a href="'.$trash_lnk_url.'" title="'.esc_attr__('Trash Registration', 'event_espresso').'">'.__('Trash', 'event_espresso').'</a>';
465
+		} elseif ($this->_view == 'trash') {
466 466
 			// restore registration link
467
-			if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_registration', 'espresso_registrations_restore_registrations', $item->ID() ) ) {
468
-				$restore_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'restore_registrations', '_REG_ID'=>$item->ID() ), REG_ADMIN_URL );
469
-				$actions['restore'] = '<a href="'.$restore_lnk_url.'" title="' . esc_attr__( 'Restore Registration', 'event_espresso' ) . '">' . __( 'Restore', 'event_espresso' ) . '</a>';
467
+			if (EE_Registry::instance()->CAP->current_user_can('ee_delete_registration', 'espresso_registrations_restore_registrations', $item->ID())) {
468
+				$restore_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'restore_registrations', '_REG_ID'=>$item->ID()), REG_ADMIN_URL);
469
+				$actions['restore'] = '<a href="'.$restore_lnk_url.'" title="'.esc_attr__('Restore Registration', 'event_espresso').'">'.__('Restore', 'event_espresso').'</a>';
470 470
 			}
471
-			if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_registration', 'espresso_registrations_ee_delete_registrations', $item->ID() ) ) {
472
-				$delete_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'delete_registrations', '_REG_ID'=>$item->ID() ), REG_ADMIN_URL );
471
+			if (EE_Registry::instance()->CAP->current_user_can('ee_delete_registration', 'espresso_registrations_ee_delete_registrations', $item->ID())) {
472
+				$delete_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'delete_registrations', '_REG_ID'=>$item->ID()), REG_ADMIN_URL);
473 473
 
474
-				$actions['delete'] = '<a href="'.$delete_lnk_url.'" title="' . esc_attr__( 'Delete Registration Permanently', 'event_espresso' ). '">' . __( 'Delete', 'event_espresso' ) . '</a>';
474
+				$actions['delete'] = '<a href="'.$delete_lnk_url.'" title="'.esc_attr__('Delete Registration Permanently', 'event_espresso').'">'.__('Delete', 'event_espresso').'</a>';
475 475
 			}
476 476
 		}
477 477
 
478
-		return sprintf('%1$s %2$s', $link, $this->row_actions($actions) );
478
+		return sprintf('%1$s %2$s', $link, $this->row_actions($actions));
479 479
 	}
480 480
 
481 481
 
@@ -487,7 +487,7 @@  discard block
 block discarded – undo
487 487
 	 * @param \EE_Registration $item
488 488
 	 * @return string
489 489
 	 */
490
-	function column_ATT_email( EE_Registration $item ) {
490
+	function column_ATT_email(EE_Registration $item) {
491 491
 		$attendee = $item->get_first_related('Attendee');
492 492
 		return ! $attendee instanceof EE_Attendee ? __('No attached contact record.', 'event_espresso') : $attendee->email();
493 493
 	}
@@ -501,8 +501,8 @@  discard block
 block discarded – undo
501 501
 	 * @param \EE_Registration $item
502 502
 	 * @return string
503 503
 	 */
504
-	function column__REG_count(EE_Registration $item){
505
-		return  sprintf(__( '%1$s / %2$s', 'event_espresso' ), $item->count(), $item->group_size());
504
+	function column__REG_count(EE_Registration $item) {
505
+		return  sprintf(__('%1$s / %2$s', 'event_espresso'), $item->count(), $item->group_size());
506 506
 	}
507 507
 
508 508
 
@@ -514,16 +514,16 @@  discard block
 block discarded – undo
514 514
 	 * @param \EE_Registration $item
515 515
 	 * @return string
516 516
 	 */
517
-	function column_PRC_amount(EE_Registration $item){
517
+	function column_PRC_amount(EE_Registration $item) {
518 518
 		$ticket = $item->ticket();
519 519
 
520
-		$content = isset( $_GET['event_id'] ) && $ticket instanceof EE_Ticket ? '<span class="TKT_name">' . $ticket->name() . '</span><br />' : '';
520
+		$content = isset($_GET['event_id']) && $ticket instanceof EE_Ticket ? '<span class="TKT_name">'.$ticket->name().'</span><br />' : '';
521 521
 
522
-		if ( $item->final_price() > 0 ) {
523
-			$content .= '<span class="reg-pad-rght">' . $item->pretty_final_price() . '</span>';
522
+		if ($item->final_price() > 0) {
523
+			$content .= '<span class="reg-pad-rght">'.$item->pretty_final_price().'</span>';
524 524
 		} else {
525 525
 			// free event
526
-			$content .= '<span class="reg-overview-free-event-spn reg-pad-rght">' . __( 'free', 'event_espresso' ) . '</span>';
526
+			$content .= '<span class="reg-overview-free-event-spn reg-pad-rght">'.__('free', 'event_espresso').'</span>';
527 527
 		}
528 528
 
529 529
 		return $content;
@@ -539,11 +539,11 @@  discard block
 block discarded – undo
539 539
 	 * @param \EE_Registration $item
540 540
 	 * @return string
541 541
 	 */
542
-	function column__REG_final_price(EE_Registration $item){
542
+	function column__REG_final_price(EE_Registration $item) {
543 543
 		$ticket = $item->ticket();
544
-		$content = isset( $_GET['event_id'] ) || ! $ticket instanceof EE_Ticket ? '' : '<span class="TKT_name">' . $ticket->name() . '</span><br />';
544
+		$content = isset($_GET['event_id']) || ! $ticket instanceof EE_Ticket ? '' : '<span class="TKT_name">'.$ticket->name().'</span><br />';
545 545
 
546
-		$content .= '<span class="reg-pad-rght">' .  $item->pretty_final_price() . '</span>';
546
+		$content .= '<span class="reg-pad-rght">'.$item->pretty_final_price().'</span>';
547 547
 		return $content;
548 548
 
549 549
 	}
@@ -557,13 +557,13 @@  discard block
 block discarded – undo
557 557
 	 * @param \EE_Registration $item
558 558
 	 * @return string
559 559
 	 */
560
-	function column__REG_paid(EE_Registration $item){
560
+	function column__REG_paid(EE_Registration $item) {
561 561
 		$payment_method = $item->payment_method();
562
-		$payment_method_name = $payment_method instanceof EE_Payment_Method ? $payment_method->admin_name() : __( 'Unknown', 'event_espresso' );
562
+		$payment_method_name = $payment_method instanceof EE_Payment_Method ? $payment_method->admin_name() : __('Unknown', 'event_espresso');
563 563
 
564
-		$content = '<span class="reg-pad-rght">' .  $item->pretty_paid() . '</span>';
565
-		if ( $item->paid() > 0 ) {
566
-			$content .= '<br><span class="ee-status-text-small">' . sprintf( __( '...via %s', 'event_espresso' ), $payment_method_name ) . '</span>';
564
+		$content = '<span class="reg-pad-rght">'.$item->pretty_paid().'</span>';
565
+		if ($item->paid() > 0) {
566
+			$content .= '<br><span class="ee-status-text-small">'.sprintf(__('...via %s', 'event_espresso'), $payment_method_name).'</span>';
567 567
 		}
568 568
 		return $content;
569 569
 	}
@@ -577,11 +577,11 @@  discard block
 block discarded – undo
577 577
 	 * @param \EE_Registration $item
578 578
 	 * @return string
579 579
 	 */
580
-	function column_TXN_total(EE_Registration $item){
581
-		if($item->transaction()){
582
-			$view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->transaction_ID() ), TXN_ADMIN_URL );
583
-			return EE_Registry::instance()->CAP->current_user_can( 'ee_read_transaction', 'espresso_transactions_view_transaction', $item->transaction_ID() ) ? '<span class="reg-pad-rght"><a class="status-'. $item->transaction()->status_ID() .'" href="'.$view_txn_lnk_url.'"  title="' . esc_attr__( 'View Transaction', 'event_espresso' ) . '">'  . $item->transaction()->pretty_total() . '</a></span>' : '<span class="reg-pad-rght">' . $item->transaction()->pretty_total() . '</span>';
584
-		}else{
580
+	function column_TXN_total(EE_Registration $item) {
581
+		if ($item->transaction()) {
582
+			$view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$item->transaction_ID()), TXN_ADMIN_URL);
583
+			return EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction', $item->transaction_ID()) ? '<span class="reg-pad-rght"><a class="status-'.$item->transaction()->status_ID().'" href="'.$view_txn_lnk_url.'"  title="'.esc_attr__('View Transaction', 'event_espresso').'">'.$item->transaction()->pretty_total().'</a></span>' : '<span class="reg-pad-rght">'.$item->transaction()->pretty_total().'</span>';
584
+		} else {
585 585
 			return __("None", "event_espresso");
586 586
 		}
587 587
 	}
@@ -595,15 +595,15 @@  discard block
 block discarded – undo
595 595
 	 * @param \EE_Registration $item
596 596
 	 * @return string
597 597
 	 */
598
-	function column_TXN_paid(EE_Registration $item){
598
+	function column_TXN_paid(EE_Registration $item) {
599 599
 
600
-		if ( $item->count() == 1 ) {
600
+		if ($item->count() == 1) {
601 601
 			$transaction = $item->transaction() ? $item->transaction() : EE_Transaction::new_instance();
602
-			if ( $transaction->paid() >= $transaction->total() ) {
602
+			if ($transaction->paid() >= $transaction->total()) {
603 603
 				return '<span class="reg-pad-rght"><div class="dashicons dashicons-yes green-icon"></div></span>';
604 604
 			} else {
605
-				$view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->transaction_ID() ), TXN_ADMIN_URL );
606
-				return EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction', $item->transaction_ID() ) ? '<span class="reg-pad-rght"><a class="status-'. $transaction->status_ID() .'" href="'.$view_txn_lnk_url.'"  title="' . esc_attr__( 'View Transaction', 'event_espresso' ) . '">' . $item->transaction()->pretty_paid() . '</a><span>' : '<span class="reg-pad-rght">' . $item->transaction()->pretty_paid() . '</span>';
605
+				$view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$item->transaction_ID()), TXN_ADMIN_URL);
606
+				return EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction', $item->transaction_ID()) ? '<span class="reg-pad-rght"><a class="status-'.$transaction->status_ID().'" href="'.$view_txn_lnk_url.'"  title="'.esc_attr__('View Transaction', 'event_espresso').'">'.$item->transaction()->pretty_paid().'</a><span>' : '<span class="reg-pad-rght">'.$item->transaction()->pretty_paid().'</span>';
607 607
 			}
608 608
 		}
609 609
 
@@ -622,44 +622,44 @@  discard block
 block discarded – undo
622 622
 	 */
623 623
 	function column_actions(EE_Registration $item) {
624 624
 		$attendee = $item->attendee();
625
-		$this->_set_related_details( $item );
625
+		$this->_set_related_details($item);
626 626
 
627 627
 		//Build row actions
628
-		$view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_registration', '_REG_ID'=>$item->ID() ), REG_ADMIN_URL );
629
-		$edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'edit_attendee', 'post'=>$item->attendee_ID() ), REG_ADMIN_URL );
628
+		$view_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_registration', '_REG_ID'=>$item->ID()), REG_ADMIN_URL);
629
+		$edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'edit_attendee', 'post'=>$item->attendee_ID()), REG_ADMIN_URL);
630 630
 
631 631
 		// page=attendees&event_admin_reports=resend_email&registration_id=43653465634&event_id=2&form_action=resend_email
632 632
 		//$resend_reg_lnk_url_params = array( 'action'=>'resend_registration', '_REG_ID'=>$item->REG_ID );
633
-		$resend_reg_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'resend_registration', '_REG_ID'=>$item->ID() ), REG_ADMIN_URL, true );
633
+		$resend_reg_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'resend_registration', '_REG_ID'=>$item->ID()), REG_ADMIN_URL, true);
634 634
 
635 635
 
636 636
 		//Build row actions
637
-		$view_lnk = EE_Registry::instance()->CAP->current_user_can('ee_read_registration', 'espresso_registrations_view_registration', $item->ID() ) ? '
637
+		$view_lnk = EE_Registry::instance()->CAP->current_user_can('ee_read_registration', 'espresso_registrations_view_registration', $item->ID()) ? '
638 638
 			<li>
639
-			<a href="'.$view_lnk_url.'" title="' . esc_attr__( 'View Registration Details', 'event_espresso' ) . '" class="tiny-text">
639
+			<a href="'.$view_lnk_url.'" title="'.esc_attr__('View Registration Details', 'event_espresso').'" class="tiny-text">
640 640
 				<div class="dashicons dashicons-clipboard"></div>
641 641
 			</a>
642 642
 			</li>' : '';
643 643
 
644
-		$edit_lnk = EE_Registry::instance()->CAP->current_user_can('ee_edit_contacts', 'espresso_registrations_edit_attendee' ) &&  $attendee instanceof EE_Attendee ?'
644
+		$edit_lnk = EE_Registry::instance()->CAP->current_user_can('ee_edit_contacts', 'espresso_registrations_edit_attendee') && $attendee instanceof EE_Attendee ? '
645 645
 			<li>
646
-			<a href="'.$edit_lnk_url.'" title="' . esc_attr__( 'Edit Contact Details', 'event_espresso' ) . '" class="tiny-text">
646
+			<a href="'.$edit_lnk_url.'" title="'.esc_attr__('Edit Contact Details', 'event_espresso').'" class="tiny-text">
647 647
 				<div class="ee-icon ee-icon-user-edit ee-icon-size-16"></div>
648 648
 			</a>
649 649
 			</li>' : '';
650 650
 
651
-		 $resend_reg_lnk = $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_registrations_resend_registration', $item->ID() ) ? '
651
+		 $resend_reg_lnk = $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_registrations_resend_registration', $item->ID()) ? '
652 652
 			<li>
653
-			<a href="'.$resend_reg_lnk_url.'" title="' . esc_attr__( 'Resend Registration Details', 'event_espresso' ) . '" class="tiny-text">
653
+			<a href="'.$resend_reg_lnk_url.'" title="'.esc_attr__('Resend Registration Details', 'event_espresso').'" class="tiny-text">
654 654
 				<div class="dashicons dashicons-email-alt"></div>
655 655
 			</a>
656 656
 			</li>' : '';
657 657
 
658 658
 		// page=transactions&action=view_transaction&txn=256&_wpnonce=6414da4dbb
659
-		$view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$this->_transaction_details['id'] ), TXN_ADMIN_URL );
660
-		$view_txn_lnk = EE_Registry::instance()->CAP->current_user_can( 'ee_read_transaction', 'espresso_transactions_view_transaction', $this->_transaction_details['id'] ) ? '
659
+		$view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$this->_transaction_details['id']), TXN_ADMIN_URL);
660
+		$view_txn_lnk = EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction', $this->_transaction_details['id']) ? '
661 661
 			<li>
662
-			<a class="ee-status-color-' . $this->_transaction_details['status'] . ' tiny-text" href="'.$view_txn_lnk_url.'"  title="' . $this->_transaction_details['title_attr'] . '">
662
+			<a class="ee-status-color-' . $this->_transaction_details['status'].' tiny-text" href="'.$view_txn_lnk_url.'"  title="'.$this->_transaction_details['title_attr'].'">
663 663
 				<div class="dashicons dashicons-cart"></div>
664 664
 			</a>
665 665
 			</li>' : '';
@@ -667,10 +667,10 @@  discard block
 block discarded – undo
667 667
 		//invoice link
668 668
 		$dl_invoice_lnk_url = $item->invoice_url();
669 669
 		//only show invoice link if message type is active.
670
-		if ( $item->is_primary_registrant() && $attendee instanceof EE_Attendee && EEH_MSG_Template::is_mt_active( 'invoice' ) ) {
670
+		if ($item->is_primary_registrant() && $attendee instanceof EE_Attendee && EEH_MSG_Template::is_mt_active('invoice')) {
671 671
 			$dl_invoice_lnk = '
672 672
 		<li>
673
-			<a title="' . esc_attr__( 'View Transaction Invoice', 'event_espresso' ) . '" target="_blank" href="'.$dl_invoice_lnk_url.'" class="tiny-text">
673
+			<a title="' . esc_attr__('View Transaction Invoice', 'event_espresso').'" target="_blank" href="'.$dl_invoice_lnk_url.'" class="tiny-text">
674 674
 				<span class="dashicons dashicons-media-spreadsheet ee-icon-size-18"></span>
675 675
 			</a>
676 676
 		</li>';
@@ -679,7 +679,7 @@  discard block
 block discarded – undo
679 679
 		}
680 680
 
681 681
 		//message list table link (filtered by REG_ID
682
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_messages', 'view_filtered_messages' ) ) {
682
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_messages', 'view_filtered_messages')) {
683 683
 			$filtered_messages_link = '<li>'
684 684
 			                          . EEH_MSG_Template::get_message_action_link(
685 685
 											'see_notifications_for',
@@ -693,7 +693,7 @@  discard block
 block discarded – undo
693 693
 			$filtered_messages_link = '';
694 694
 		}
695 695
 
696
-		return $this->_action_string( $view_lnk . $edit_lnk . $resend_reg_lnk . $view_txn_lnk . $dl_invoice_lnk . $filtered_messages_link, $item, 'ul', 'reg-overview-actions-ul' );
696
+		return $this->_action_string($view_lnk.$edit_lnk.$resend_reg_lnk.$view_txn_lnk.$dl_invoice_lnk.$filtered_messages_link, $item, 'ul', 'reg-overview-actions-ul');
697 697
 	}
698 698
 
699 699
 }
Please login to merge, or discard this patch.