Completed
Branch BUG-9680-compress-dompdf-files... (43e183)
by
unknown
577:38 queued 559:24
created
core/libraries/messages/EE_Message_Resource_Manager.lib.php 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -880,8 +880,8 @@  discard block
 block discarded – undo
880 880
 	 * @return void
881 881
 	 */
882 882
 	public function deactivate_messenger( $messenger_name ) {
883
-        $this->_initialize_collections();
884
-        if ( $messenger_name instanceof EE_messenger ) {
883
+		$this->_initialize_collections();
884
+		if ( $messenger_name instanceof EE_messenger ) {
885 885
 			$messenger_name = $messenger_name->name;
886 886
 		}
887 887
 		unset( $this->_active_messengers[ $messenger_name ] );
@@ -897,7 +897,7 @@  discard block
 block discarded – undo
897 897
 	 * @param  string $message_type_name name of message type being deactivated
898 898
 	 */
899 899
 	public function deactivate_message_type( $message_type_name ) {
900
-        $this->_initialize_collections();
900
+		$this->_initialize_collections();
901 901
 		if ( $message_type_name instanceof EE_message_type ) {
902 902
 			$message_type_name = $message_type_name->name;
903 903
 		}
@@ -927,7 +927,7 @@  discard block
 block discarded – undo
927 927
 	 * @param string $messenger_name     Name of messenger the message type is being deactivated for.
928 928
 	 */
929 929
 	public function deactivate_message_type_for_messenger( $message_type_name, $messenger_name ) {
930
-        $this->_initialize_collections();
930
+		$this->_initialize_collections();
931 931
 		if ( $this->is_message_type_active_for_messenger( $messenger_name, $message_type_name ) ) {
932 932
 			unset( $this->_active_message_types[ $messenger_name ]['settings'][ $messenger_name . '-message_types' ][ $message_type_name ] );
933 933
 		}
Please login to merge, or discard this patch.
Spacing   +166 added lines, -166 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
4
-	exit( 'No direct script access allowed' );
3
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
4
+	exit('No direct script access allowed');
5 5
 }
6 6
 
7 7
 
@@ -134,13 +134,13 @@  discard block
 block discarded – undo
134 134
 	 * @return void
135 135
 	 */
136 136
 	protected function _initialize_collections() {
137
-		if ( $this->_initialized ) {
137
+		if ($this->_initialized) {
138 138
 			return;
139 139
 		}
140 140
 		$this->_initialized = true;
141 141
 		$this->_messenger_collection_loader->load_messengers_from_folder();
142 142
 		$this->_message_type_collection_loader->load_message_types_from_folder();
143
-		$this->get_has_activated_messengers_option( true );
143
+		$this->get_has_activated_messengers_option(true);
144 144
 		$this->_set_active_messengers_and_message_types();
145 145
 	}
146 146
 
@@ -170,8 +170,8 @@  discard block
 block discarded – undo
170 170
 	 * @param string $messenger_name
171 171
 	 * @return \EE_messenger
172 172
 	 */
173
-	public function get_messenger( $messenger_name ) {
174
-		return $this->messenger_collection()->get_by_info( $messenger_name );
173
+	public function get_messenger($messenger_name) {
174
+		return $this->messenger_collection()->get_by_info($messenger_name);
175 175
 	}
176 176
 
177 177
 
@@ -182,9 +182,9 @@  discard block
 block discarded – undo
182 182
 	 * @param string $messenger
183 183
 	 * @return EE_messenger | null
184 184
 	 */
185
-	public function get_active_messenger( $messenger ) {
185
+	public function get_active_messenger($messenger) {
186 186
 		$this->_initialize_collections();
187
-		return ! empty( $this->_active_messengers[ $messenger ] ) ? $this->_active_messengers[ $messenger ] : null;
187
+		return ! empty($this->_active_messengers[$messenger]) ? $this->_active_messengers[$messenger] : null;
188 188
 	}
189 189
 
190 190
 
@@ -193,11 +193,11 @@  discard block
 block discarded – undo
193 193
 	 * @return \EE_messenger[]
194 194
 	 */
195 195
 	public function installed_messengers() {
196
-		if ( empty( $this->_installed_messengers ) ) {
196
+		if (empty($this->_installed_messengers)) {
197 197
 			$this->_installed_messengers = array();
198 198
 			$this->messenger_collection()->rewind();
199
-			while ( $this->messenger_collection()->valid() ) {
200
-				$this->_installed_messengers[ $this->messenger_collection()->current()->name ] = $this->messenger_collection()->current();
199
+			while ($this->messenger_collection()->valid()) {
200
+				$this->_installed_messengers[$this->messenger_collection()->current()->name] = $this->messenger_collection()->current();
201 201
 				$this->messenger_collection()->next();
202 202
 			}
203 203
 		}
@@ -211,14 +211,14 @@  discard block
 block discarded – undo
211 211
 	 * @return \EE_messenger
212 212
 	 * @throws \EE_Error
213 213
 	 */
214
-	public function valid_messenger( $messenger_name ) {
215
-		$messenger = $this->get_messenger( $messenger_name );
216
-		if ( $messenger instanceof EE_messenger ) {
214
+	public function valid_messenger($messenger_name) {
215
+		$messenger = $this->get_messenger($messenger_name);
216
+		if ($messenger instanceof EE_messenger) {
217 217
 			return $messenger;
218 218
 		}
219 219
 		throw new EE_Error(
220 220
 			sprintf(
221
-				__( 'The "%1$s" messenger is either invalid or not installed', 'event_espresso' ),
221
+				__('The "%1$s" messenger is either invalid or not installed', 'event_espresso'),
222 222
 				$messenger_name
223 223
 			)
224 224
 		);
@@ -250,8 +250,8 @@  discard block
 block discarded – undo
250 250
 	 * @param string $message_type_name
251 251
 	 * @return \EE_message_type
252 252
 	 */
253
-	public function get_message_type( $message_type_name ) {
254
-		return $this->message_type_collection()->get_by_info( $message_type_name );
253
+	public function get_message_type($message_type_name) {
254
+		return $this->message_type_collection()->get_by_info($message_type_name);
255 255
 	}
256 256
 
257 257
 
@@ -263,9 +263,9 @@  discard block
 block discarded – undo
263 263
 	 * @param string $message_type_name
264 264
 	 * @return \EE_message_type|null
265 265
 	 */
266
-	public function get_active_message_type_for_messenger( $messenger_name, $message_type_name ) {
267
-		return $this->is_message_type_active_for_messenger( $messenger_name, $message_type_name )
268
-			? $this->get_message_type( $message_type_name )
266
+	public function get_active_message_type_for_messenger($messenger_name, $message_type_name) {
267
+		return $this->is_message_type_active_for_messenger($messenger_name, $message_type_name)
268
+			? $this->get_message_type($message_type_name)
269 269
 			: null;
270 270
 	}
271 271
 
@@ -279,9 +279,9 @@  discard block
 block discarded – undo
279 279
 	 *
280 280
 	 * @return bool
281 281
 	 */
282
-	public function is_message_type_active_for_messenger( $messenger_name, $message_type_name ) {
282
+	public function is_message_type_active_for_messenger($messenger_name, $message_type_name) {
283 283
 		$this->_initialize_collections();
284
-		return ! empty( $this->_active_message_types[ $messenger_name ]['settings'][ $messenger_name . '-message_types' ][ $message_type_name ] );
284
+		return ! empty($this->_active_message_types[$messenger_name]['settings'][$messenger_name.'-message_types'][$message_type_name]);
285 285
 	}
286 286
 
287 287
 
@@ -292,9 +292,9 @@  discard block
 block discarded – undo
292 292
 	 * @param string $messenger_name  the name of the messenger to check if active.
293 293
 	 * @return bool
294 294
 	 */
295
-	public function is_messenger_active( $messenger_name ) {
295
+	public function is_messenger_active($messenger_name) {
296 296
 		$this->_initialize_collections();
297
-		return ! empty( $this->_active_message_types[ $messenger_name ] );
297
+		return ! empty($this->_active_message_types[$messenger_name]);
298 298
 	}
299 299
 
300 300
 
@@ -305,11 +305,11 @@  discard block
 block discarded – undo
305 305
 	 * @param string $message_type_name  The slug of the message type getting the settings for.
306 306
 	 * @return array
307 307
 	 */
308
-	public function get_message_type_settings_for_messenger( $messenger_name, $message_type_name ) {
308
+	public function get_message_type_settings_for_messenger($messenger_name, $message_type_name) {
309 309
 		$settings = array();
310
-		if ( $this->is_message_type_active_for_messenger( $messenger_name, $message_type_name ) ) {
311
-			$settings =  isset( $this->_active_message_types[ $messenger_name ]['settings'][ $messenger_name . '-message_types' ][ $message_type_name ]['settings'] )
312
-				? $this->_active_message_types[ $messenger_name ]['settings'][ $messenger_name . '-message_types' ][ $message_type_name ]['settings']
310
+		if ($this->is_message_type_active_for_messenger($messenger_name, $message_type_name)) {
311
+			$settings = isset($this->_active_message_types[$messenger_name]['settings'][$messenger_name.'-message_types'][$message_type_name]['settings'])
312
+				? $this->_active_message_types[$messenger_name]['settings'][$messenger_name.'-message_types'][$message_type_name]['settings']
313 313
 				: array();
314 314
 		}
315 315
 		return $settings;
@@ -324,11 +324,11 @@  discard block
 block discarded – undo
324 324
 	 * @param string $messenger_name
325 325
 	 * @return bool
326 326
 	 */
327
-	public function messenger_has_active_message_types( $messenger_name ) {
327
+	public function messenger_has_active_message_types($messenger_name) {
328 328
 		$this->_initialize_collections();
329 329
 		return
330
-			! empty( $this->_active_message_types[ $messenger_name ] )
331
-			&& ! empty( $this->_active_message_types[ $messenger_name ]['settings'][ $messenger_name . '-message_types' ] );
330
+			! empty($this->_active_message_types[$messenger_name])
331
+			&& ! empty($this->_active_message_types[$messenger_name]['settings'][$messenger_name.'-message_types']);
332 332
 	}
333 333
 
334 334
 
@@ -341,15 +341,15 @@  discard block
 block discarded – undo
341 341
 	 * @param string $messenger_name The messenger being checked
342 342
 	 * @return EE_message_type[]|array    (empty array if no active_message_types)
343 343
 	 */
344
-	public function get_active_message_types_for_messenger( $messenger_name ) {
344
+	public function get_active_message_types_for_messenger($messenger_name) {
345 345
 		$message_types = array();
346
-		if ( ! $this->messenger_has_active_message_types( $messenger_name ) ) {
346
+		if ( ! $this->messenger_has_active_message_types($messenger_name)) {
347 347
 			return $message_types;
348 348
 		}
349 349
 		$installed_message_types = $this->installed_message_types();
350
-		foreach ( $installed_message_types as $message_type_name => $message_type ) {
351
-			if ( $this->is_message_type_active_for_messenger( $messenger_name, $message_type_name ) ) {
352
-				$message_types[ $message_type_name ] = $message_type;
350
+		foreach ($installed_message_types as $message_type_name => $message_type) {
351
+			if ($this->is_message_type_active_for_messenger($messenger_name, $message_type_name)) {
352
+				$message_types[$message_type_name] = $message_type;
353 353
 			}
354 354
 		}
355 355
 		return $message_types;
@@ -367,12 +367,12 @@  discard block
 block discarded – undo
367 367
 	public function list_of_active_message_types() {
368 368
 		$active_message_type_names = array();
369 369
 		$this->_initialize_collections();
370
-		foreach ( $this->_active_message_types as $messenger => $messenger_settings ) {
371
-			if ( ! isset( $messenger_settings['settings'][ $messenger . '-message_types' ] ) ) {
370
+		foreach ($this->_active_message_types as $messenger => $messenger_settings) {
371
+			if ( ! isset($messenger_settings['settings'][$messenger.'-message_types'])) {
372 372
 				continue;
373 373
 			}
374
-			foreach ( $messenger_settings['settings'][ $messenger . '-message_types' ] as $message_type_name => $message_type_config ) {
375
-				if ( ! in_array( $message_type_name, $active_message_type_names ) ) {
374
+			foreach ($messenger_settings['settings'][$messenger.'-message_types'] as $message_type_name => $message_type_config) {
375
+				if ( ! in_array($message_type_name, $active_message_type_names)) {
376 376
 					$active_message_type_names[] = $message_type_name;
377 377
 				}
378 378
 			}
@@ -392,9 +392,9 @@  discard block
 block discarded – undo
392 392
 		$active_message_types = array();
393 393
 		$installed_message_types = $this->installed_message_types();
394 394
 		$active_message_type_names = $this->list_of_active_message_types();
395
-		foreach ( $active_message_type_names as $active_message_type_name ) {
396
-			if ( isset( $installed_message_types[ $active_message_type_name ] ) ) {
397
-				$active_message_types[ $active_message_type_name ] = $installed_message_types[ $active_message_type_name ];
395
+		foreach ($active_message_type_names as $active_message_type_name) {
396
+			if (isset($installed_message_types[$active_message_type_name])) {
397
+				$active_message_types[$active_message_type_name] = $installed_message_types[$active_message_type_name];
398 398
 			}
399 399
 		}
400 400
 		return $active_message_types;
@@ -406,10 +406,10 @@  discard block
 block discarded – undo
406 406
 	 * @return \EE_message_type[]
407 407
 	 */
408 408
 	public function installed_message_types() {
409
-		if ( empty( $this->_installed_message_types ) ) {
409
+		if (empty($this->_installed_message_types)) {
410 410
 			$this->message_type_collection()->rewind();
411
-			while ( $this->message_type_collection()->valid() ) {
412
-				$this->_installed_message_types[ $this->message_type_collection()->current()->name ] = $this->message_type_collection()->current();
411
+			while ($this->message_type_collection()->valid()) {
412
+				$this->_installed_message_types[$this->message_type_collection()->current()->name] = $this->message_type_collection()->current();
413 413
 				$this->message_type_collection()->next();
414 414
 			}
415 415
 		}
@@ -422,14 +422,14 @@  discard block
 block discarded – undo
422 422
 	 * @return \EE_message_type
423 423
 	 * @throws \EE_Error
424 424
 	 */
425
-	public function valid_message_type( $message_type_name ) {
426
-		$message_type = $this->get_message_type( $message_type_name );
427
-		if ( $message_type instanceof EE_message_type ) {
425
+	public function valid_message_type($message_type_name) {
426
+		$message_type = $this->get_message_type($message_type_name);
427
+		if ($message_type instanceof EE_message_type) {
428 428
 			return $message_type;
429 429
 		}
430 430
 		throw new EE_Error(
431 431
 			sprintf(
432
-				__( 'The "%1$s" message type is either invalid or not installed', 'event_espresso' ),
432
+				__('The "%1$s" message type is either invalid or not installed', 'event_espresso'),
433 433
 				$message_type_name
434 434
 			)
435 435
 		);
@@ -445,9 +445,9 @@  discard block
 block discarded – undo
445 445
 	 * @return boolean
446 446
 	 * @throws \EE_Error
447 447
 	 */
448
-	public function valid_message_type_for_messenger( EE_messenger $messenger, $message_type_name ) {
448
+	public function valid_message_type_for_messenger(EE_messenger $messenger, $message_type_name) {
449 449
 		$valid_message_types = $messenger->get_valid_message_types();
450
-		if ( ! in_array( $message_type_name, $valid_message_types ) ) {
450
+		if ( ! in_array($message_type_name, $valid_message_types)) {
451 451
 			throw new EE_Error(
452 452
 				sprintf(
453 453
 					__(
@@ -474,9 +474,9 @@  discard block
 block discarded – undo
474 474
 	 *
475 475
 	 * @return array
476 476
 	 */
477
-	public function get_active_messengers_option( $reset = false) {
478
-		if ( $reset ) {
479
-			$this->_active_message_types = get_option( 'ee_active_messengers', array() );
477
+	public function get_active_messengers_option($reset = false) {
478
+		if ($reset) {
479
+			$this->_active_message_types = get_option('ee_active_messengers', array());
480 480
 		}
481 481
 		return $this->_active_message_types;
482 482
 	}
@@ -490,11 +490,11 @@  discard block
 block discarded – undo
490 490
 	 *                                 representing this data is used.
491 491
 	 * @return bool FALSE if not updated, TRUE if updated.
492 492
 	 */
493
-	public function update_active_messengers_option( $active_messenger_settings = array() ) {
494
-		$active_messenger_settings = empty( $active_messenger_settings ) ? $this->_active_message_types : $active_messenger_settings;
493
+	public function update_active_messengers_option($active_messenger_settings = array()) {
494
+		$active_messenger_settings = empty($active_messenger_settings) ? $this->_active_message_types : $active_messenger_settings;
495 495
 		//make sure _active_message_types is updated (this is the internal cache for the settings).
496 496
 		$this->_active_message_types = $active_messenger_settings;
497
-		return update_option( 'ee_active_messengers', $active_messenger_settings );
497
+		return update_option('ee_active_messengers', $active_messenger_settings);
498 498
 	}
499 499
 
500 500
 
@@ -509,9 +509,9 @@  discard block
 block discarded – undo
509 509
 	 *
510 510
 	 * @return array
511 511
 	 */
512
-	public function get_has_activated_messengers_option( $reset = false ) {
513
-		if ( $reset || empty( $this->_has_activated_messengers_and_message_types ) ) {
514
-			$this->_has_activated_messengers_and_message_types = get_option( 'ee_has_activated_messenger', array() );
512
+	public function get_has_activated_messengers_option($reset = false) {
513
+		if ($reset || empty($this->_has_activated_messengers_and_message_types)) {
514
+			$this->_has_activated_messengers_and_message_types = get_option('ee_has_activated_messenger', array());
515 515
 		}
516 516
 		return $this->_has_activated_messengers_and_message_types;
517 517
 	}
@@ -526,15 +526,15 @@  discard block
 block discarded – undo
526 526
 	 *
527 527
 	 * @return bool FALSE if not updated, TRUE if updated.
528 528
 	 */
529
-	public function update_has_activated_messengers_option( $has_activated_messengers = array() ) {
529
+	public function update_has_activated_messengers_option($has_activated_messengers = array()) {
530 530
 		//make sure the option has been retrieved from first so we don't overwrite it accidentally.
531
-		if ( empty( $has_activated_messengers ) && empty( $this->_has_activated_messengers_and_message_types ) ) {
531
+		if (empty($has_activated_messengers) && empty($this->_has_activated_messengers_and_message_types)) {
532 532
 			$this->get_has_activated_messengers_option();
533 533
 		}
534
-		$has_activated_messengers = empty( $has_activated_messengers )
534
+		$has_activated_messengers = empty($has_activated_messengers)
535 535
 			? $this->_has_activated_messengers_and_message_types
536 536
 			: $has_activated_messengers;
537
-		return update_option( 'ee_has_activated_messenger', $has_activated_messengers );
537
+		return update_option('ee_has_activated_messenger', $has_activated_messengers);
538 538
 	}
539 539
 
540 540
 
@@ -556,8 +556,8 @@  discard block
 block discarded – undo
556 556
 		//echo "\n\n " . __LINE__ . ") " . __METHOD__ . "() \n";
557 557
 		// list of activated messengers as set via the admin
558 558
 		// note calling `get_active_messengers_options` also initializes the _active_message_types property.
559
-		$this->get_active_messengers_option( true );
560
-		$this->ensure_messengers_are_active( array(), false, true );
559
+		$this->get_active_messengers_option(true);
560
+		$this->ensure_messengers_are_active(array(), false, true);
561 561
 		$this->update_active_messengers_option();
562 562
 		$this->update_has_activated_messengers_option();
563 563
 	}
@@ -575,11 +575,11 @@  discard block
 block discarded – undo
575 575
 	 * @param bool   $update_option  Whether to update the option in the db or not.
576 576
 	 * @return boolean true if either already active or successfully activated.
577 577
 	 */
578
-	public function ensure_messenger_is_active( $messenger_name, $update_option = true ) {
579
-		if ( ! isset( $this->_active_messengers[ $messenger_name ] ) ) {
578
+	public function ensure_messenger_is_active($messenger_name, $update_option = true) {
579
+		if ( ! isset($this->_active_messengers[$messenger_name])) {
580 580
 			try {
581
-				$this->activate_messenger( $messenger_name, array(), $update_option );
582
-			} catch( EE_Error $e ) {
581
+				$this->activate_messenger($messenger_name, array(), $update_option);
582
+			} catch (EE_Error $e) {
583 583
 				EE_Error::add_error(
584 584
 					$e->getMessage(),
585 585
 					__FILE__,
@@ -606,25 +606,25 @@  discard block
 block discarded – undo
606 606
 	 *                                and a messenger is indicated as active, but is NOT installed, then it will automatically be
607 607
 	 *                                deactivated.
608 608
 	 */
609
-	public function ensure_messengers_are_active( $messenger_names = array(), $update_option = true, $verify = false ) {
610
-		$messenger_names = empty( $messenger_names ) ? array_keys( $this->_active_message_types ) : $messenger_names;
609
+	public function ensure_messengers_are_active($messenger_names = array(), $update_option = true, $verify = false) {
610
+		$messenger_names = empty($messenger_names) ? array_keys($this->_active_message_types) : $messenger_names;
611 611
 
612 612
 		$not_installed = array();
613
-		foreach( $messenger_names as $messenger_name ) {
614
-			if ( $verify && ! $this->messenger_collection()->has_by_name( $messenger_name ) ) {
613
+		foreach ($messenger_names as $messenger_name) {
614
+			if ($verify && ! $this->messenger_collection()->has_by_name($messenger_name)) {
615 615
 				$not_installed[] = $messenger_name;
616
-				$this->deactivate_messenger( $messenger_name );
616
+				$this->deactivate_messenger($messenger_name);
617 617
 				continue;
618 618
 			}
619
-			$this->ensure_messenger_is_active( $messenger_name, $update_option );
619
+			$this->ensure_messenger_is_active($messenger_name, $update_option);
620 620
 		}
621 621
 
622
-		if ( ! empty( $not_installed_messenger ) ) {
622
+		if ( ! empty($not_installed_messenger)) {
623 623
 			EE_Error::add_error(
624 624
 				sprintf(
625
-					__( 'The following messengers are either not installed or are invalid:%1$s %2$s', 'event_espresso' ),
625
+					__('The following messengers are either not installed or are invalid:%1$s %2$s', 'event_espresso'),
626 626
 					'<br />',
627
-					implode( ', ', $not_installed_messenger )
627
+					implode(', ', $not_installed_messenger)
628 628
 				),
629 629
 				__FILE__, __FUNCTION__, __LINE__
630 630
 			);
@@ -643,18 +643,18 @@  discard block
 block discarded – undo
643 643
 	 * @return bool  Returns true if already is active or if was activated successfully.
644 644
 	 * @throws \EE_Error
645 645
 	 */
646
-	public function ensure_message_type_is_active( $message_type_name, $messenger_name, $update_option = true ) {
646
+	public function ensure_message_type_is_active($message_type_name, $messenger_name, $update_option = true) {
647 647
 		// grab the messenger to work with.
648
-		$messenger = $this->valid_messenger( $messenger_name );
649
-		if ( $this->valid_message_type_for_messenger( $messenger, $message_type_name ) ) {
648
+		$messenger = $this->valid_messenger($messenger_name);
649
+		if ($this->valid_message_type_for_messenger($messenger, $message_type_name)) {
650 650
 			//ensure messenger is active (that's an inherent coupling between active message types and the
651 651
 			//messenger they are being activated for.
652 652
 			try {
653
-				if ( ! $this->is_message_type_active_for_messenger( $messenger_name, $message_type_name ) ) {
653
+				if ( ! $this->is_message_type_active_for_messenger($messenger_name, $message_type_name)) {
654 654
 					//all is good so let's just get it active
655
-					$this->activate_messenger( $messenger_name, array( $message_type_name ), $update_option );
655
+					$this->activate_messenger($messenger_name, array($message_type_name), $update_option);
656 656
 				}
657
-			} catch( EE_Error $e ) {
657
+			} catch (EE_Error $e) {
658 658
 				EE_Error::add_error(
659 659
 					$e->getMessage(),
660 660
 					__FILE__,
@@ -678,14 +678,14 @@  discard block
 block discarded – undo
678 678
 	 * @param string $messenger_name      The name of the messenger that the message types are to be activated on.
679 679
 	 * @param bool   $update_option       Whether to persist the activation to the database or not (default true).
680 680
 	 */
681
-	public function ensure_message_types_are_active( $message_type_names, $messenger_name, $update_option = true ) {
681
+	public function ensure_message_types_are_active($message_type_names, $messenger_name, $update_option = true) {
682 682
 		$message_type_names = (array) $message_type_names;
683
-		foreach ( $message_type_names as $message_type_name ) {
683
+		foreach ($message_type_names as $message_type_name) {
684 684
 			// note, intentionally not updating option here because we're in a loop.
685 685
 			// We'll follow the instructions of the incoming $update_option argument after the loop.
686
-			$this->ensure_message_type_is_active( $message_type_name, $messenger_name, false );
686
+			$this->ensure_message_type_is_active($message_type_name, $messenger_name, false);
687 687
 		}
688
-		if ( $update_option ) {
688
+		if ($update_option) {
689 689
 			$this->update_active_messengers_option();
690 690
 			$this->update_has_activated_messengers_option();
691 691
 		}
@@ -712,24 +712,24 @@  discard block
 block discarded – undo
712 712
 	) {
713 713
 		$templates = array();
714 714
 		// grab the messenger to work with.
715
-		$messenger = $this->messenger_collection()->get_by_info( $messenger_name );
715
+		$messenger = $this->messenger_collection()->get_by_info($messenger_name);
716 716
 		// it's inactive. Activate it.
717
-		if ( $messenger instanceof EE_messenger ) {
718
-			$this->_active_messengers[ $messenger->name ] = $messenger;
717
+		if ($messenger instanceof EE_messenger) {
718
+			$this->_active_messengers[$messenger->name] = $messenger;
719 719
 			//activate incoming message types set to be activated with messenger.
720
-			$message_type_names = $this->_activate_message_types( $messenger, $message_type_names );
720
+			$message_type_names = $this->_activate_message_types($messenger, $message_type_names);
721 721
 			// setup any initial settings for the messenger if necessary.
722
-			$this->add_settings_for_messenger( $messenger->name );
723
-			if ( $update_active_messengers_option ) {
722
+			$this->add_settings_for_messenger($messenger->name);
723
+			if ($update_active_messengers_option) {
724 724
 				$this->update_active_messengers_option();
725 725
 				$this->update_has_activated_messengers_option();
726 726
 			}
727 727
 			//generate new templates if necessary and ensure all related templates that are already in the database are
728 728
 			//marked active.  Note, this will also deactivate a message type for a messenger if the template
729 729
 			//cannot be successfully created during its attempt (only happens for global template attempts).
730
-			if ( ! empty( $message_type_names ) ) {
731
-				$templates = EEH_MSG_Template::generate_new_templates( $messenger->name, $message_type_names, 0, true );
732
-				EEH_MSG_Template::update_to_active( array( $messenger->name ), $message_type_names );
730
+			if ( ! empty($message_type_names)) {
731
+				$templates = EEH_MSG_Template::generate_new_templates($messenger->name, $message_type_names, 0, true);
732
+				EEH_MSG_Template::update_to_active(array($messenger->name), $message_type_names);
733 733
 			}
734 734
 		}
735 735
 		return $templates;
@@ -748,29 +748,29 @@  discard block
 block discarded – undo
748 748
 	 *
749 749
 	 * @return array
750 750
 	 */
751
-	protected function _activate_message_types( EE_messenger $messenger, $message_type_names = array() ) {
751
+	protected function _activate_message_types(EE_messenger $messenger, $message_type_names = array()) {
752 752
 		//If $message_type_names is empty, AND $this->_active_message_types is empty, then that means
753 753
 		//things have never been initialized (which should happen on EEH_Activation::generate_message_templates).
754 754
 		//So ONLY then do we need to actually grab defaults and cycle through them.  Otherwise we
755 755
 		//only override _active_message_types when an explicit array of $message_type_names has been provided.
756
-		$message_type_names = empty( $message_type_names ) && ! isset( $this->_active_message_types[ $messenger->name ] )
756
+		$message_type_names = empty($message_type_names) && ! isset($this->_active_message_types[$messenger->name])
757 757
 			? $messenger->get_default_message_types()
758 758
 			: (array) $message_type_names;
759 759
 
760 760
 		//now we ALWAYS need to make sure that the messenger is active for the message types we're activating!
761
-		if ( ! isset( $this->_active_message_types[ $messenger->name ] ) ) {
762
-			$this->_active_message_types[ $messenger->name ]['settings'] = array();
761
+		if ( ! isset($this->_active_message_types[$messenger->name])) {
762
+			$this->_active_message_types[$messenger->name]['settings'] = array();
763 763
 		}
764 764
 
765
-		if ( $message_type_names ) {
765
+		if ($message_type_names) {
766 766
 			// cycle thru message types
767
-			foreach ( $message_type_names as $message_type_name ) {
767
+			foreach ($message_type_names as $message_type_name) {
768 768
 				//only register the message type as active IF it isn't already active
769 769
 				//and if its actually installed.
770 770
 				if (
771
-					! $this->is_message_type_active_for_messenger( $messenger->name, $message_type_name )
771
+					! $this->is_message_type_active_for_messenger($messenger->name, $message_type_name)
772 772
 				) {
773
-					$this->add_settings_for_message_type( $messenger->name, $message_type_name );
773
+					$this->add_settings_for_message_type($messenger->name, $message_type_name);
774 774
 					$this->_set_messenger_has_activated_message_type(
775 775
 						$messenger,
776 776
 						$message_type_name
@@ -793,24 +793,24 @@  discard block
 block discarded – undo
793 793
 	 * @param  string       $message_type_name The name of the message type adding the settings for
794 794
 	 * @param  array        $new_settings     Any new settings being set for the message type and messenger
795 795
 	 */
796
-	public function add_settings_for_message_type( $messenger_name, $message_type_name, $new_settings = array() ) {
796
+	public function add_settings_for_message_type($messenger_name, $message_type_name, $new_settings = array()) {
797 797
 		// get installed message type from collection
798
-		$message_type = $this->message_type_collection()->get_by_info( $message_type_name );
799
-		$existing_settings = $this->get_message_type_settings_for_messenger( $messenger_name, $message_type_name );
798
+		$message_type = $this->message_type_collection()->get_by_info($message_type_name);
799
+		$existing_settings = $this->get_message_type_settings_for_messenger($messenger_name, $message_type_name);
800 800
 		//we need to setup any initial settings for message types
801
-		if ( $message_type instanceof EE_message_type ) {
801
+		if ($message_type instanceof EE_message_type) {
802 802
 			$default_settings = $message_type->get_admin_settings_fields();
803
-			foreach ( $default_settings as $field => $values ) {
804
-				if ( isset( $new_settings[ $field ] ) ) {
805
-					$existing_settings[ $field ] = $new_settings[ $field ];
803
+			foreach ($default_settings as $field => $values) {
804
+				if (isset($new_settings[$field])) {
805
+					$existing_settings[$field] = $new_settings[$field];
806 806
 					continue;
807 807
 				}
808
-				if ( ! isset( $existing_settings[ $field ] ) ) {
809
-					$existing_settings[ $field ] = $values['default'];
808
+				if ( ! isset($existing_settings[$field])) {
809
+					$existing_settings[$field] = $values['default'];
810 810
 				}
811 811
 			}
812 812
 		}
813
-		$this->_active_message_types[ $messenger_name ]['settings'][ $messenger_name . '-message_types' ][ $message_type_name ]['settings'] = $existing_settings;
813
+		$this->_active_message_types[$messenger_name]['settings'][$messenger_name.'-message_types'][$message_type_name]['settings'] = $existing_settings;
814 814
 	}
815 815
 
816 816
 
@@ -823,20 +823,20 @@  discard block
 block discarded – undo
823 823
 	 * @param \EE_messenger $messenger
824 824
 	 * @param string        $message_type_name
825 825
 	 */
826
-	protected function _set_messenger_has_activated_message_type( EE_messenger $messenger, $message_type_name ) {
826
+	protected function _set_messenger_has_activated_message_type(EE_messenger $messenger, $message_type_name) {
827 827
 
828 828
 		//if _has_activated_messengers_and_message_types is empty then lets ensure its initialized
829
-		if ( empty( $this->_has_activated_messengers_and_message_types ) ) {
829
+		if (empty($this->_has_activated_messengers_and_message_types)) {
830 830
 			$this->get_has_activated_messengers_option();
831 831
 		}
832 832
 
833 833
 		// make sure this messenger has a record in the has_activated array
834
-		if ( ! isset( $this->_has_activated_messengers_and_message_types[ $messenger->name ] ) ) {
835
-			$this->_has_activated_messengers_and_message_types[ $messenger->name ] = array();
834
+		if ( ! isset($this->_has_activated_messengers_and_message_types[$messenger->name])) {
835
+			$this->_has_activated_messengers_and_message_types[$messenger->name] = array();
836 836
 		}
837 837
 		// check if message type has already been added
838
-		if ( ! in_array( $message_type_name, $this->_has_activated_messengers_and_message_types[ $messenger->name ] ) ) {
839
-			$this->_has_activated_messengers_and_message_types[ $messenger->name ][] = $message_type_name;
838
+		if ( ! in_array($message_type_name, $this->_has_activated_messengers_and_message_types[$messenger->name])) {
839
+			$this->_has_activated_messengers_and_message_types[$messenger->name][] = $message_type_name;
840 840
 		}
841 841
 	}
842 842
 
@@ -851,20 +851,20 @@  discard block
 block discarded – undo
851 851
 	 * @param string        $messenger_name The name of the messenger the settings is being added for.
852 852
 	 * @param array         $new_settings   An array of settings to update the existing settings.
853 853
 	 */
854
-	public function add_settings_for_messenger( $messenger_name, $new_settings = array() ) {
855
-		$messenger = $this->get_messenger( $messenger_name );
856
-		if ( $messenger instanceof EE_messenger ) {
854
+	public function add_settings_for_messenger($messenger_name, $new_settings = array()) {
855
+		$messenger = $this->get_messenger($messenger_name);
856
+		if ($messenger instanceof EE_messenger) {
857 857
 			$msgr_settings = $messenger->get_admin_settings_fields();
858
-			if ( ! empty( $msgr_settings ) ) {
859
-				foreach ( $msgr_settings as $field => $value ) {
858
+			if ( ! empty($msgr_settings)) {
859
+				foreach ($msgr_settings as $field => $value) {
860 860
 					//is there a new setting for this?
861
-					if ( isset( $new_settings[ $field ] ) ) {
862
-						$this->_active_message_types[ $messenger->name ]['settings'][ $field ] = $new_settings[ $field ];
861
+					if (isset($new_settings[$field])) {
862
+						$this->_active_message_types[$messenger->name]['settings'][$field] = $new_settings[$field];
863 863
 						continue;
864 864
 					}
865 865
 					//only set the default if it isn't already set.
866
-					if ( ! isset( $this->_active_message_types[ $messenger->name ]['settings'][ $field ] ) ) {
867
-						$this->_active_message_types[ $messenger->name ]['settings'][ $field ] = $value;
866
+					if ( ! isset($this->_active_message_types[$messenger->name]['settings'][$field])) {
867
+						$this->_active_message_types[$messenger->name]['settings'][$field] = $value;
868 868
 					}
869 869
 				}
870 870
 			}
@@ -879,14 +879,14 @@  discard block
 block discarded – undo
879 879
 	 * @param  string|EE_messenger $messenger_name name of messenger
880 880
 	 * @return void
881 881
 	 */
882
-	public function deactivate_messenger( $messenger_name ) {
882
+	public function deactivate_messenger($messenger_name) {
883 883
         $this->_initialize_collections();
884
-        if ( $messenger_name instanceof EE_messenger ) {
884
+        if ($messenger_name instanceof EE_messenger) {
885 885
 			$messenger_name = $messenger_name->name;
886 886
 		}
887
-		unset( $this->_active_messengers[ $messenger_name ] );
888
-		unset( $this->_active_message_types[ $messenger_name ] );
889
-		$this->_message_template_group_model->deactivate_message_template_groups_for( $messenger_name );
887
+		unset($this->_active_messengers[$messenger_name]);
888
+		unset($this->_active_message_types[$messenger_name]);
889
+		$this->_message_template_group_model->deactivate_message_template_groups_for($messenger_name);
890 890
 		$this->update_active_messengers_option();
891 891
 	}
892 892
 
@@ -896,22 +896,22 @@  discard block
 block discarded – undo
896 896
 	 *
897 897
 	 * @param  string $message_type_name name of message type being deactivated
898 898
 	 */
899
-	public function deactivate_message_type( $message_type_name ) {
899
+	public function deactivate_message_type($message_type_name) {
900 900
         $this->_initialize_collections();
901
-		if ( $message_type_name instanceof EE_message_type ) {
901
+		if ($message_type_name instanceof EE_message_type) {
902 902
 			$message_type_name = $message_type_name->name;
903 903
 		}
904
-		foreach ( $this->_active_message_types as $messenger_name => $settings ) {
904
+		foreach ($this->_active_message_types as $messenger_name => $settings) {
905 905
 			unset(
906
-				$this->_active_message_types[ $messenger_name ]['settings'][ $messenger_name . '-message_types' ][ $message_type_name ]
906
+				$this->_active_message_types[$messenger_name]['settings'][$messenger_name.'-message_types'][$message_type_name]
907 907
 			);
908 908
 
909 909
 			//we always record (even on deactivation) that a message type has been activated because there should at
910 910
 			//least be a record in the "has_activated" option that it WAS active at one point.
911
-			$messenger = $this->get_messenger( $messenger_name );
912
-			$this->_set_messenger_has_activated_message_type( $messenger, $message_type_name );
911
+			$messenger = $this->get_messenger($messenger_name);
912
+			$this->_set_messenger_has_activated_message_type($messenger, $message_type_name);
913 913
 		}
914
-		$this->_message_template_group_model->deactivate_message_template_groups_for( '', $message_type_name );
914
+		$this->_message_template_group_model->deactivate_message_template_groups_for('', $message_type_name);
915 915
 		$this->update_active_messengers_option();
916 916
 		$this->update_has_activated_messengers_option();
917 917
 	}
@@ -926,12 +926,12 @@  discard block
 block discarded – undo
926 926
 	 * @param string $message_type_name  Name of message type being deactivated.
927 927
 	 * @param string $messenger_name     Name of messenger the message type is being deactivated for.
928 928
 	 */
929
-	public function deactivate_message_type_for_messenger( $message_type_name, $messenger_name ) {
929
+	public function deactivate_message_type_for_messenger($message_type_name, $messenger_name) {
930 930
         $this->_initialize_collections();
931
-		if ( $this->is_message_type_active_for_messenger( $messenger_name, $message_type_name ) ) {
932
-			unset( $this->_active_message_types[ $messenger_name ]['settings'][ $messenger_name . '-message_types' ][ $message_type_name ] );
931
+		if ($this->is_message_type_active_for_messenger($messenger_name, $message_type_name)) {
932
+			unset($this->_active_message_types[$messenger_name]['settings'][$messenger_name.'-message_types'][$message_type_name]);
933 933
 		}
934
-		$this->_message_template_group_model->deactivate_message_template_groups_for( array( $messenger_name ), array( $message_type_name ) );
934
+		$this->_message_template_group_model->deactivate_message_template_groups_for(array($messenger_name), array($message_type_name));
935 935
 		$this->update_active_messengers_option();
936 936
 	}
937 937
 
@@ -948,12 +948,12 @@  discard block
 block discarded – undo
948 948
 	 *
949 949
 	 * @return bool true is a generating messenger and can be sent OR FALSE meaning cannot send.
950 950
 	 */
951
-	public function is_generating_messenger_and_active( EE_messenger $messenger, EE_message_type $message_type ) {
951
+	public function is_generating_messenger_and_active(EE_messenger $messenger, EE_message_type $message_type) {
952 952
 		//get the $messengers the message type says it can be used with.
953
-		foreach ( $message_type->with_messengers() as $generating_messenger => $secondary_messengers ) {
953
+		foreach ($message_type->with_messengers() as $generating_messenger => $secondary_messengers) {
954 954
 			if (
955 955
 				$messenger->name === $generating_messenger
956
-				&& $this->is_message_type_active_for_messenger( $messenger->name, $message_type->name )
956
+				&& $this->is_message_type_active_for_messenger($messenger->name, $message_type->name)
957 957
 			) {
958 958
 				return true;
959 959
 			}
@@ -990,25 +990,25 @@  discard block
 block discarded – undo
990 990
 	 *                           or all contexts indexed by message type.
991 991
 	 * @return array
992 992
 	 */
993
-	public function get_all_contexts( $slugs_only = true ) {
993
+	public function get_all_contexts($slugs_only = true) {
994 994
 		$key = $slugs_only ? 'slugs' : 'all';
995 995
 		// check if contexts has been setup yet.
996
-		if ( empty( $this->_contexts[ $key ] ) ) {
996
+		if (empty($this->_contexts[$key])) {
997 997
 			// So let's get all active message type objects and loop through to get all unique contexts
998
-			foreach ( $this->get_active_message_type_objects() as $message_type ) {
999
-				if ( $message_type instanceof EE_message_type ) {
998
+			foreach ($this->get_active_message_type_objects() as $message_type) {
999
+				if ($message_type instanceof EE_message_type) {
1000 1000
 					$message_type_contexts = $message_type->get_contexts();
1001
-					if ( $slugs_only ) {
1002
-						foreach ( $message_type_contexts as $context => $context_details ) {
1003
-							$this->_contexts[ $key ][ $context ] = $context_details[ 'label' ];
1001
+					if ($slugs_only) {
1002
+						foreach ($message_type_contexts as $context => $context_details) {
1003
+							$this->_contexts[$key][$context] = $context_details['label'];
1004 1004
 						}
1005 1005
 					} else {
1006
-						$this->_contexts[ $key ][ $message_type->name ] = $message_type_contexts;
1006
+						$this->_contexts[$key][$message_type->name] = $message_type_contexts;
1007 1007
 					}
1008 1008
 				}
1009 1009
 			}
1010 1010
 		}
1011
-		return ! empty( $this->_contexts[ $key ] ) ? $this->_contexts[ $key ] : array();
1011
+		return ! empty($this->_contexts[$key]) ? $this->_contexts[$key] : array();
1012 1012
 	}
1013 1013
 
1014 1014
 
@@ -1027,9 +1027,9 @@  discard block
 block discarded – undo
1027 1027
 		$installed_message_types = $this->installed_message_types();
1028 1028
 		$all_message_types_valid = true;
1029 1029
 		//loop through list of active message types and verify they are installed.
1030
-		foreach( $list_of_active_message_type_names as $message_type_name ) {
1031
-			if ( ! isset( $installed_message_types[$message_type_name] ) ) {
1032
-				$this->deactivate_message_type( $message_type_name );
1030
+		foreach ($list_of_active_message_type_names as $message_type_name) {
1031
+			if ( ! isset($installed_message_types[$message_type_name])) {
1032
+				$this->deactivate_message_type($message_type_name);
1033 1033
 				$all_message_types_valid = false;
1034 1034
 			}
1035 1035
 		}
@@ -1048,10 +1048,10 @@  discard block
 block discarded – undo
1048 1048
 	 * @param $messenger_name
1049 1049
 	 * @return bool
1050 1050
 	 */
1051
-	public function has_message_type_been_activated_for_messenger( $message_type_name, $messenger_name ) {
1051
+	public function has_message_type_been_activated_for_messenger($message_type_name, $messenger_name) {
1052 1052
 		$has_activated = $this->get_has_activated_messengers_option();
1053
-		return isset( $has_activated[ $messenger_name ] )
1054
-			&& in_array( $message_type_name, $has_activated[ $messenger_name ] );
1053
+		return isset($has_activated[$messenger_name])
1054
+			&& in_array($message_type_name, $has_activated[$messenger_name]);
1055 1055
 	}
1056 1056
 }
1057 1057
 // End of file EE_Message_Resource_Manager.lib.php
Please login to merge, or discard this patch.
core/libraries/shortcodes/EE_Attendee_Shortcodes.lib.php 2 patches
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -39,10 +39,10 @@  discard block
 block discarded – undo
39 39
 
40 40
 
41 41
 
42
-    /**
43
-     * EE_Attendee_Shortcodes constructor.
44
-     */
45
-    public function __construct() {
42
+	/**
43
+	 * EE_Attendee_Shortcodes constructor.
44
+	 */
45
+	public function __construct() {
46 46
 		parent::__construct();
47 47
 	}
48 48
 
@@ -72,15 +72,15 @@  discard block
 block discarded – undo
72 72
 
73 73
 
74 74
 
75
-    /**
76
-     * handles shortcode parsing
77
-     *
78
-     * @access protected
79
-     * @param  string $shortcode the shortcode to be parsed.
80
-     * @return string
81
-     * @throws \EE_Error
82
-     */
83
-    protected function _parser( $shortcode ) {
75
+	/**
76
+	 * handles shortcode parsing
77
+	 *
78
+	 * @access protected
79
+	 * @param  string $shortcode the shortcode to be parsed.
80
+	 * @return string
81
+	 * @throws \EE_Error
82
+	 */
83
+	protected function _parser( $shortcode ) {
84 84
 
85 85
 
86 86
 		$this->_xtra = !empty($this->_extra_data ) && $this->_extra_data['data'] instanceof EE_Messages_Addressee ? $this->_extra_data['data'] : NULL;
@@ -91,9 +91,9 @@  discard block
 block discarded – undo
91 91
 		if ( ! $registration instanceof EE_Registration ) {
92 92
 			//let's attempt to get the txn_id for the error message.
93 93
 			$txn_id = isset( $this->_xtra->txn ) && $this->_xtra->txn instanceof EE_Transaction ? $this->_xtra->txn->ID() : __('Unknown', 'event_espresso' );
94
-            $msg = __('There is no EE_Registration object in the data sent to the EE_Attendee Shortcode Parser for the messages system.',
95
-                    'event_espresso');
96
-            $dev_msg = sprintf(__('The transaction ID for this request is: %s', 'event_espresso'), $txn_id);
94
+			$msg = __('There is no EE_Registration object in the data sent to the EE_Attendee Shortcode Parser for the messages system.',
95
+					'event_espresso');
96
+			$dev_msg = sprintf(__('The transaction ID for this request is: %s', 'event_espresso'), $txn_id);
97 97
 			throw new EE_Error( "{$msg}||{$msg} {$dev_msg}" );
98 98
 		}
99 99
 
@@ -101,10 +101,10 @@  discard block
 block discarded – undo
101 101
 		$attendee = isset( $this->_xtra->registrations[$registration->ID()]['att_obj'] ) ?  $this->_xtra->registrations[$registration->ID()]['att_obj'] : null ;
102 102
 
103 103
 		if ( ! $attendee instanceof EE_Attendee ) {
104
-            $msg = __('There is no EE_Attendee object in the data sent to the EE_Attendee_Shortcode parser for the messages system.',
105
-                'event_espresso');
106
-            $dev_msg = sprintf(__('The registration ID for this request is: %s', 'event_espresso'),
107
-                $registration->ID());
104
+			$msg = __('There is no EE_Attendee object in the data sent to the EE_Attendee_Shortcode parser for the messages system.',
105
+				'event_espresso');
106
+			$dev_msg = sprintf(__('The registration ID for this request is: %s', 'event_espresso'),
107
+				$registration->ID());
108 108
 			throw new EE_Error("{$msg}||{$msg} {$dev_msg}");
109 109
 		}
110 110
 
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if (!defined('EVENT_ESPRESSO_VERSION') )
3
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
4 4
 	exit('NO direct script access allowed');
5 5
 
6 6
 /**
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 			'[ADDRESS2]' => __('Whatever was in the address 2 field for the registration.', 'event_espresso'),
66 66
 			'[CITY]' => __('The city for the registration.', 'event_espresso'),
67 67
 			'[ZIP_PC]' => __('The ZIP (or Postal) Code for the Registration.', 'event_espresso'),
68
-			'[ADDRESS_STATE]' => __('The state/province for the registration.', 'event_espresso' ),
68
+			'[ADDRESS_STATE]' => __('The state/province for the registration.', 'event_espresso'),
69 69
 			'[COUNTRY]' => __('The country for the registration.', 'event_espresso')
70 70
 			);
71 71
 	}
@@ -80,27 +80,27 @@  discard block
 block discarded – undo
80 80
      * @return string
81 81
      * @throws \EE_Error
82 82
      */
83
-    protected function _parser( $shortcode ) {
83
+    protected function _parser($shortcode) {
84 84
 
85 85
 
86
-		$this->_xtra = !empty($this->_extra_data ) && $this->_extra_data['data'] instanceof EE_Messages_Addressee ? $this->_extra_data['data'] : NULL;
86
+		$this->_xtra = ! empty($this->_extra_data) && $this->_extra_data['data'] instanceof EE_Messages_Addressee ? $this->_extra_data['data'] : NULL;
87 87
 
88 88
 		//incoming object should only be a registration object.
89 89
 		$registration = ! $this->_data instanceof EE_Registration ? NULL : $this->_data;
90 90
 
91
-		if ( ! $registration instanceof EE_Registration ) {
91
+		if ( ! $registration instanceof EE_Registration) {
92 92
 			//let's attempt to get the txn_id for the error message.
93
-			$txn_id = isset( $this->_xtra->txn ) && $this->_xtra->txn instanceof EE_Transaction ? $this->_xtra->txn->ID() : __('Unknown', 'event_espresso' );
93
+			$txn_id = isset($this->_xtra->txn) && $this->_xtra->txn instanceof EE_Transaction ? $this->_xtra->txn->ID() : __('Unknown', 'event_espresso');
94 94
             $msg = __('There is no EE_Registration object in the data sent to the EE_Attendee Shortcode Parser for the messages system.',
95 95
                     'event_espresso');
96 96
             $dev_msg = sprintf(__('The transaction ID for this request is: %s', 'event_espresso'), $txn_id);
97
-			throw new EE_Error( "{$msg}||{$msg} {$dev_msg}" );
97
+			throw new EE_Error("{$msg}||{$msg} {$dev_msg}");
98 98
 		}
99 99
 
100 100
 		//attendee obj for this registration
101
-		$attendee = isset( $this->_xtra->registrations[$registration->ID()]['att_obj'] ) ?  $this->_xtra->registrations[$registration->ID()]['att_obj'] : null ;
101
+		$attendee = isset($this->_xtra->registrations[$registration->ID()]['att_obj']) ? $this->_xtra->registrations[$registration->ID()]['att_obj'] : null;
102 102
 
103
-		if ( ! $attendee instanceof EE_Attendee ) {
103
+		if ( ! $attendee instanceof EE_Attendee) {
104 104
             $msg = __('There is no EE_Attendee object in the data sent to the EE_Attendee_Shortcode parser for the messages system.',
105 105
                 'event_espresso');
106 106
             $dev_msg = sprintf(__('The registration ID for this request is: %s', 'event_espresso'),
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 			throw new EE_Error("{$msg}||{$msg} {$dev_msg}");
109 109
 		}
110 110
 
111
-		switch ( $shortcode ) {
111
+		switch ($shortcode) {
112 112
 
113 113
 			case '[FNAME]' :
114 114
 				return $attendee->fname();
Please login to merge, or discard this patch.
templates/support_admin_details_shortcodes_event_listings.template.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,13 +1,13 @@
 block discarded – undo
1 1
 <div class="padding">
2 2
 	<p>
3
-        <?php esc_html_e('Displays a list of events based on a set of criteria on a WordPress page or post. Unless otherwise specified, events are sorted by start date.', 'event_espresso'); ?> <?php echo sprintf( esc_html__('For a full list of available shortcodes, please view the %sshortcode documentation%s on our website.', 'event_espresso'), '<a href="https://eventespresso.com/wiki/ee4-shortcodes-template-variables/">', '</a>' ); ?>
3
+        <?php esc_html_e('Displays a list of events based on a set of criteria on a WordPress page or post. Unless otherwise specified, events are sorted by start date.', 'event_espresso'); ?> <?php echo sprintf(esc_html__('For a full list of available shortcodes, please view the %sshortcode documentation%s on our website.', 'event_espresso'), '<a href="https://eventespresso.com/wiki/ee4-shortcodes-template-variables/">', '</a>'); ?>
4 4
     </p>
5 5
 		<ul>
6 6
 			<li><strong><?php esc_html_e('Show a list of all of your events', 'event_espresso'); ?></strong><br /> [ESPRESSO_EVENTS]</li>
7 7
 			<li><strong><?php esc_html_e('Set a custom title for the event list', 'event_espresso'); ?></strong><br /> [ESPRESSO_EVENTS title="My Super Event List"]</li>
8 8
 			<li><strong><?php esc_html_e('Limit (paginate) the number of events that are shown in the event list on a page or post', 'event_espresso'); ?></strong><br />[ESPRESSO_EVENTS limit=5]</li>
9 9
 			<li><strong><?php esc_html_e('Add a custom CSS class to each event post/article', 'event_espresso'); ?></strong><br /> [ESPRESSO_EVENTS css_class=my-custom-class]</li>
10
-			<li><strong><?php esc_html_e('Filter the event list by month and year', 'event_espresso'); ?></strong><br />[ESPRESSO_EVENTS month="<?php echo date( 'F Y' ); ?>"]</li>
10
+			<li><strong><?php esc_html_e('Filter the event list by month and year', 'event_espresso'); ?></strong><br />[ESPRESSO_EVENTS month="<?php echo date('F Y'); ?>"]</li>
11 11
 			<li><strong><?php esc_html_e('Show expired events in the event list', 'event_espresso'); ?></strong><br />[ESPRESSO_EVENTS show_expired=true]</li>
12 12
 			<li><strong><?php esc_html_e('Sorts the event list in ascending order', 'event_espresso'); ?></strong><br />[ESPRESSO_EVENTS sort=ASC]</li>
13 13
 			<li><strong><?php esc_html_e('Sorts the event list in descending order', 'event_espresso'); ?></strong><br />[ESPRESSO_EVENTS sort=DESC]</li>
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_global_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_global_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->get_i18n_datetime( 'REG_date' );
1130
-			$this->_template_args['reg_datetime']['label'] = __( 'Date', 'event_espresso' );
1129
+			$this->_template_args['reg_datetime']['value'] = $this->_registration->get_i18n_datetime('REG_date');
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 ), esc_html__( ' View Transaction', 'event_espresso' ), '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 ), esc_html__( ' Resend Registration', 'event_espresso' ), '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), esc_html__(' View Transaction', 'event_espresso'), '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), esc_html__(' Resend Registration', 'event_espresso'), '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,30 +1741,30 @@  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 );
1767
-				$this->_template_args['attendees'][ $att_nmbr ]['event_name'] = $registration->event_obj()->name();
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
+				$this->_template_args['attendees'][$att_nmbr]['event_name'] = $registration->event_obj()->name();
1768 1768
 
1769 1769
 				$att_nmbr++;
1770 1770
 			}
@@ -1774,8 +1774,8 @@  discard block
 block discarded – undo
1774 1774
 
1775 1775
 	//			$this->_template_args['registration_form_url'] = add_query_arg( array( 'action' => 'edit_registration', 'process' => 'attendees'  ), REG_ADMIN_URL );
1776 1776
 		}
1777
-		$template_path = REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_attendees.template.php';
1778
-		echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
1777
+		$template_path = REG_TEMPLATE_PATH.'reg_admin_details_main_meta_box_attendees.template.php';
1778
+		echo EEH_Template::display_template($template_path, $this->_template_args, TRUE);
1779 1779
 
1780 1780
 	}
1781 1781
 
@@ -1796,11 +1796,11 @@  discard block
 block discarded – undo
1796 1796
 		$attendee = $att_check instanceof EE_Attendee ? $att_check : EEM_Attendee::instance()->create_default_object();
1797 1797
 
1798 1798
 		//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)
1799
-		if ( ! $this->_registration->is_primary_registrant() ) {
1799
+		if ( ! $this->_registration->is_primary_registrant()) {
1800 1800
 			$primary_registration = $this->_registration->get_primary_registration();
1801 1801
 			$primary_attendee = $primary_registration->attendee();
1802 1802
 
1803
-			if ( ! $primary_attendee instanceof EE_Attendee || $attendee->ID() !== $primary_attendee->ID() ) {
1803
+			if ( ! $primary_attendee instanceof EE_Attendee || $attendee->ID() !== $primary_attendee->ID()) {
1804 1804
 				//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.
1805 1805
 				$primary_registration = NULL;
1806 1806
 			}
@@ -1809,27 +1809,27 @@  discard block
 block discarded – undo
1809 1809
 		}
1810 1810
 
1811 1811
 		$this->_template_args['ATT_ID'] = $attendee->ID();
1812
-		$this->_template_args['fname'] = $attendee->fname();//$this->_registration->ATT_fname;
1813
-		$this->_template_args['lname'] = $attendee->lname();//$this->_registration->ATT_lname;
1814
-		$this->_template_args['email'] = $attendee->email();//$this->_registration->ATT_email;
1812
+		$this->_template_args['fname'] = $attendee->fname(); //$this->_registration->ATT_fname;
1813
+		$this->_template_args['lname'] = $attendee->lname(); //$this->_registration->ATT_lname;
1814
+		$this->_template_args['email'] = $attendee->email(); //$this->_registration->ATT_email;
1815 1815
 		$this->_template_args['phone'] = $attendee->phone();
1816 1816
 
1817
-		$this->_template_args[ 'formatted_address' ] = EEH_Address::format( $attendee );
1817
+		$this->_template_args['formatted_address'] = EEH_Address::format($attendee);
1818 1818
 
1819 1819
 
1820 1820
 		//edit link
1821
-		$this->_template_args['att_edit_link'] = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'edit_attendee', 'post'=>$attendee->ID() ), REG_ADMIN_URL );
1821
+		$this->_template_args['att_edit_link'] = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'edit_attendee', 'post'=>$attendee->ID()), REG_ADMIN_URL);
1822 1822
 		$this->_template_args['att_edit_label'] = __('View/Edit Contact', 'event_espresso');
1823 1823
 
1824 1824
 		//create link
1825
-		$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 ): '';
1825
+		$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 1826
 		$this->_template_args['create_label'] = __('Create Contact', 'event_espresso');
1827 1827
 
1828 1828
 		$this->_template_args['att_check'] = $att_check;
1829 1829
 
1830 1830
 
1831
-		$template_path = REG_TEMPLATE_PATH . 'reg_admin_details_side_meta_box_registrant.template.php';
1832
-		echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
1831
+		$template_path = REG_TEMPLATE_PATH.'reg_admin_details_side_meta_box_registrant.template.php';
1832
+		echo EEH_Template::display_template($template_path, $this->_template_args, TRUE);
1833 1833
 	}
1834 1834
 
1835 1835
 
@@ -1842,7 +1842,7 @@  discard block
 block discarded – undo
1842 1842
 	 * @access protected
1843 1843
 	 * @return void
1844 1844
 	 */
1845
-	protected function _trash_or_restore_registrations( $trash = TRUE ) {
1845
+	protected function _trash_or_restore_registrations($trash = TRUE) {
1846 1846
 		$REGM = EEM_Registration::instance();
1847 1847
 
1848 1848
 		$success = 1;
@@ -1852,26 +1852,26 @@  discard block
 block discarded – undo
1852 1852
 		$dtts = array();
1853 1853
 
1854 1854
 		//if empty _REG_ID then get out because there's nothing to do
1855
-		if ( empty( $this->_req_data['_REG_ID'] ) ) {
1855
+		if (empty($this->_req_data['_REG_ID'])) {
1856 1856
 			$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');
1857
-			EE_Error::add_error( $msg, __FILE__, __LINE__, __FUNCTION__ );
1858
-			$this->_redirect_after_action(FALSE, '', '', array(), TRUE );
1857
+			EE_Error::add_error($msg, __FILE__, __LINE__, __FUNCTION__);
1858
+			$this->_redirect_after_action(FALSE, '', '', array(), TRUE);
1859 1859
 		}
1860 1860
 
1861 1861
 		//Checkboxes
1862
-		if (!empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) {
1862
+		if ( ! empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) {
1863 1863
 			// if array has more than one element than success message should be plural
1864
-			$success = count( $this->_req_data['_REG_ID'] ) > 1 ? 2 : 1;
1864
+			$success = count($this->_req_data['_REG_ID']) > 1 ? 2 : 1;
1865 1865
 			// cycle thru checkboxes
1866
-			while (list( $ind, $REG_ID ) = each($this->_req_data['_REG_ID'])) {
1866
+			while (list($ind, $REG_ID) = each($this->_req_data['_REG_ID'])) {
1867 1867
 
1868 1868
 				$REG = $REGM->get_one_by_ID($REG_ID);
1869 1869
 				$payment_count = $REG->get_first_related('Transaction')->count_related('Payment');
1870
-				if ( $payment_count > 0 ) {
1871
-					$name = $REG->attendee() instanceof EE_Attendee ? $REG->attendee()->full_name() : __( 'Unknown Attendee', 'event_espresso' );
1870
+				if ($payment_count > 0) {
1871
+					$name = $REG->attendee() instanceof EE_Attendee ? $REG->attendee()->full_name() : __('Unknown Attendee', 'event_espresso');
1872 1872
 					$error = 1;
1873 1873
 					$success = 0;
1874
-					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__ );
1874
+					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 1875
 					continue; //can't trash this registration because it has payments.
1876 1876
 				}
1877 1877
 				$ticket = $REG->get_first_related('Ticket');
@@ -1880,7 +1880,7 @@  discard block
 block discarded – undo
1880 1880
 				$dtts = array_merge($dtts, $dtt);
1881 1881
 
1882 1882
 				$updated = $trash ? $REG->delete() : $REG->restore();
1883
-				if ( !$updated ) {
1883
+				if ( ! $updated) {
1884 1884
 					$success = 0;
1885 1885
 				} else {
1886 1886
 					$success = 2;
@@ -1895,7 +1895,7 @@  discard block
 block discarded – undo
1895 1895
 			$tickets[$ticket->ID()] = $ticket;
1896 1896
 			$dtts = $ticket->get_many_related('Datetime');
1897 1897
 			$updated = $trash ? $REG->delete() : $REG->restore();
1898
-			if ( ! $updated ) {
1898
+			if ( ! $updated) {
1899 1899
 				$success = 0;
1900 1900
 			}
1901 1901
 
@@ -1905,10 +1905,10 @@  discard block
 block discarded – undo
1905 1905
 		EEM_Ticket::instance()->update_tickets_sold($tickets);
1906 1906
 		EEM_Datetime::instance()->update_sold($dtts);
1907 1907
 
1908
-		$what = $success > 1 ? __( 'Registrations', 'event_espresso' ) : __( 'Registration', 'event_espresso' );
1909
-		$action_desc = $trash ? __( 'moved to the trash', 'event_espresso' ) : __( 'restored', 'event_espresso' );
1908
+		$what = $success > 1 ? __('Registrations', 'event_espresso') : __('Registration', 'event_espresso');
1909
+		$action_desc = $trash ? __('moved to the trash', 'event_espresso') : __('restored', 'event_espresso');
1910 1910
 		$overwrite_msgs = $error ? TRUE : FALSE;
1911
-		$this->_redirect_after_action( $success, $what, $action_desc, array( 'action' => 'default' ), $overwrite_msgs );
1911
+		$this->_redirect_after_action($success, $what, $action_desc, array('action' => 'default'), $overwrite_msgs);
1912 1912
 	}
1913 1913
 
1914 1914
 
@@ -1932,16 +1932,16 @@  discard block
 block discarded – undo
1932 1932
 		$success = 1;
1933 1933
 
1934 1934
 		//Checkboxes
1935
-		if (!empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) {
1935
+		if ( ! empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) {
1936 1936
 			// if array has more than one element than success message should be plural
1937
-			$success = count( $this->_req_data['_REG_ID'] ) > 1 ? 2 : 1;
1937
+			$success = count($this->_req_data['_REG_ID']) > 1 ? 2 : 1;
1938 1938
 			// cycle thru checkboxes
1939
-			while (list( $ind, $REG_ID ) = each($this->_req_data['_REG_ID'])) {
1939
+			while (list($ind, $REG_ID) = each($this->_req_data['_REG_ID'])) {
1940 1940
 				$REG = $REG_MDL->get_one_by_ID($REG_ID);
1941
-				if ( ! $REG instanceof EE_Registration )
1941
+				if ( ! $REG instanceof EE_Registration)
1942 1942
 					continue;
1943 1943
 				$deleted = $this->_delete_registration($REG);
1944
-				if ( !$deleted ) {
1944
+				if ( ! $deleted) {
1945 1945
 					$success = 0;
1946 1946
 				}
1947 1947
 			}
@@ -1951,15 +1951,15 @@  discard block
 block discarded – undo
1951 1951
 			$REG_ID = $this->_req_data['_REG_ID'];
1952 1952
 			$REG = $REG_MDL->get_one_by_ID($REG_ID);
1953 1953
 			$deleted = $this->_delete_registration($REG);
1954
-			if ( ! $deleted ) {
1954
+			if ( ! $deleted) {
1955 1955
 				$success = 0;
1956 1956
 			}
1957 1957
 
1958 1958
 		}
1959 1959
 
1960
-		$what = $success > 1 ? __( 'Registrations', 'event_espresso' ) : __( 'Registration', 'event_espresso' );
1961
-		$action_desc = __( 'permanently deleted.', 'event_espresso' );
1962
-		$this->_redirect_after_action( $success, $what, $action_desc, array( 'action' => 'default' ), TRUE );
1960
+		$what = $success > 1 ? __('Registrations', 'event_espresso') : __('Registration', 'event_espresso');
1961
+		$action_desc = __('permanently deleted.', 'event_espresso');
1962
+		$this->_redirect_after_action($success, $what, $action_desc, array('action' => 'default'), TRUE);
1963 1963
 	}
1964 1964
 
1965 1965
 
@@ -1971,31 +1971,31 @@  discard block
 block discarded – undo
1971 1971
 	 * @param  EE_Registration $REG registration to be deleted permenantly
1972 1972
 	 * @return boolean              true = successful deletion, false = fail.
1973 1973
 	 */
1974
-	protected function _delete_registration( EE_Registration $REG ) {
1974
+	protected function _delete_registration(EE_Registration $REG) {
1975 1975
 		//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.
1976 1976
 		$TXN = $REG->get_first_related('Transaction');
1977 1977
 		$REGS = $TXN->get_many_related('Registration');
1978 1978
 
1979 1979
 		$all_trashed = TRUE;
1980
-		foreach ( $REGS as $registration ) {
1981
-			if ( ! $registration->get('REG_deleted') )
1980
+		foreach ($REGS as $registration) {
1981
+			if ( ! $registration->get('REG_deleted'))
1982 1982
 				$all_trashed = FALSE;
1983 1983
 		}
1984 1984
 
1985
-		if ( ! $all_trashed ) {
1986
-			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__ );
1985
+		if ( ! $all_trashed) {
1986
+			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__);
1987 1987
 			return false;
1988 1988
 		}
1989 1989
 
1990 1990
 		//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).
1991
-		foreach ( $REGS as $registration ) {
1991
+		foreach ($REGS as $registration) {
1992 1992
 
1993 1993
 			//delete related answers
1994 1994
 			$registration->delete_related_permanently('Answer');
1995 1995
 
1996 1996
 			//remove relationship to EE_Attendee (but we ALWAYS leave the contact record intact)
1997 1997
 			$attendee = $registration->get_first_related('Attendee');
1998
-			if ( $attendee instanceof EE_Attendee ) {
1998
+			if ($attendee instanceof EE_Attendee) {
1999 1999
 				$registration->_remove_relation_to($attendee, 'Attendee');
2000 2000
 			}
2001 2001
 
@@ -2005,7 +2005,7 @@  discard block
 block discarded – undo
2005 2005
 			//now delete permanently the checkins related to this registration.
2006 2006
 			$registration->delete_related_permanently('Checkin');
2007 2007
 
2008
-			if ( $registration->ID() === $REG->ID() )
2008
+			if ($registration->ID() === $REG->ID())
2009 2009
 				continue; //we don't want to delete permanently the existing registration just yet.
2010 2010
 
2011 2011
 			//remove relation to transaction for these registrations if NOT the existing registrations
@@ -2038,35 +2038,35 @@  discard block
 block discarded – undo
2038 2038
 	 * @return void
2039 2039
 	 */
2040 2040
 	public function new_registration() {
2041
-		if ( ! $this->_set_reg_event() ) {
2042
-			throw new EE_Error(__('Unable to continue with registering because there is no Event ID in the request', 'event_espresso') );
2041
+		if ( ! $this->_set_reg_event()) {
2042
+			throw new EE_Error(__('Unable to continue with registering because there is no Event ID in the request', 'event_espresso'));
2043 2043
 		}
2044
-		EE_Registry::instance()->REQ->set_espresso_page( TRUE );
2044
+		EE_Registry::instance()->REQ->set_espresso_page(TRUE);
2045 2045
 		// gotta start with a clean slate if we're not coming here via ajax
2046 2046
 		if (
2047
-			! defined('DOING_AJAX' )
2048
-			&& ( ! isset( $this->_req_data['processing_registration'] ) || isset( $this->_req_data['step_error'] ) )
2047
+			! defined('DOING_AJAX')
2048
+			&& ( ! isset($this->_req_data['processing_registration']) || isset($this->_req_data['step_error']))
2049 2049
 		) {
2050
-			EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ );
2050
+			EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__);
2051 2051
 		}
2052 2052
 
2053
-		$this->_template_args['event_name'] = '' ;
2053
+		$this->_template_args['event_name'] = '';
2054 2054
 		// event name
2055
-		if ( $this->_reg_event ) {
2055
+		if ($this->_reg_event) {
2056 2056
 			$this->_template_args['event_name'] = $this->_reg_event->name();
2057
-			$edit_event_url = self::add_query_args_and_nonce( array( 'action'=>'edit', 'post'=>$this->_reg_event->ID() ), EVENTS_ADMIN_URL );
2058
-			$edit_event_lnk = '<a href="'.$edit_event_url.'" title="' . esc_attr__( 'Edit ', 'event_espresso' ) . $this->_reg_event->name() . '">' . __( 'Edit Event', 'event_espresso' ) . '</a>';
2059
-			$this->_template_args['event_name'] .= ' <span class="admin-page-header-edit-lnk not-bold">' . $edit_event_lnk . '</span>' ;
2057
+			$edit_event_url = self::add_query_args_and_nonce(array('action'=>'edit', 'post'=>$this->_reg_event->ID()), EVENTS_ADMIN_URL);
2058
+			$edit_event_lnk = '<a href="'.$edit_event_url.'" title="'.esc_attr__('Edit ', 'event_espresso').$this->_reg_event->name().'">'.__('Edit Event', 'event_espresso').'</a>';
2059
+			$this->_template_args['event_name'] .= ' <span class="admin-page-header-edit-lnk not-bold">'.$edit_event_lnk.'</span>';
2060 2060
 		}
2061 2061
 
2062 2062
 		$this->_template_args['step_content'] = $this->_get_registration_step_content();
2063 2063
 
2064
-		if ( defined('DOING_AJAX' ) ) {
2064
+		if (defined('DOING_AJAX')) {
2065 2065
 			$this->_return_json();
2066 2066
 		}
2067 2067
 		// grab header
2068
-		$template_path = REG_TEMPLATE_PATH . 'reg_admin_register_new_attendee.template.php';
2069
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
2068
+		$template_path = REG_TEMPLATE_PATH.'reg_admin_register_new_attendee.template.php';
2069
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE);
2070 2070
 
2071 2071
 		//$this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE );
2072 2072
 		// the details template wrapper
@@ -2083,7 +2083,7 @@  discard block
 block discarded – undo
2083 2083
 	 * @return string html
2084 2084
 	 */
2085 2085
 	protected function _get_registration_step_content() {
2086
-		if ( isset( $_COOKIE[ 'ee_registration_added' ] ) && $_COOKIE[ 'ee_registration_added' ] ) {
2086
+		if (isset($_COOKIE['ee_registration_added']) && $_COOKIE['ee_registration_added']) {
2087 2087
 			$warning_msg = sprintf(
2088 2088
 				__(
2089 2089
 					'%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',
@@ -2099,7 +2099,7 @@  discard block
 block discarded – undo
2099 2099
 				'</b>'
2100 2100
 			);
2101 2101
 			return '
2102
-	<div id="ee-add-reg-back-button-dv"><p>' . $warning_msg . '</p></div>
2102
+	<div id="ee-add-reg-back-button-dv"><p>' . $warning_msg.'</p></div>
2103 2103
 	<script >
2104 2104
 		// WHOAH !!! it appears that someone is using the back button from the Transaction admin page
2105 2105
 		// after just adding a new registration... we gotta try to put a stop to that !!!
@@ -2134,16 +2134,16 @@  discard block
 block discarded – undo
2134 2134
 		$cart = EE_Registry::instance()->SSN->cart();
2135 2135
 		$step = ! $cart instanceof EE_Cart ? 'ticket' : 'questions';
2136 2136
 
2137
-		switch ( $step ) {
2137
+		switch ($step) {
2138 2138
 			case 'ticket' :
2139 2139
 				$hidden_fields['processing_registration']['value'] = 1;
2140 2140
 				$template_args['title'] = __('Step One: Select the Ticket for this registration', 'event_espresso');
2141
-				$template_args['content'] = EED_Ticket_Selector::instance()->display_ticket_selector( $this->_reg_event );
2141
+				$template_args['content'] = EED_Ticket_Selector::instance()->display_ticket_selector($this->_reg_event);
2142 2142
 				$template_args['step_button_text'] = __('Add Tickets and Continue to Registrant Details', 'event_espresso');
2143 2143
 				$template_args['show_notification_toggle'] = FALSE;
2144 2144
 				break;
2145 2145
 			case 'questions' :
2146
-				$hidden_fields[ 'processing_registration' ][ 'value' ] = 2;
2146
+				$hidden_fields['processing_registration']['value'] = 2;
2147 2147
 				$template_args['title'] = __('Step Two: Add Registrant Details for this Registration', 'event_espresso');
2148 2148
 				//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.
2149 2149
 				$template_args['content'] = EED_Single_Page_Checkout::registration_checkout_for_admin();
@@ -2152,10 +2152,10 @@  discard block
 block discarded – undo
2152 2152
 				break;
2153 2153
 		}
2154 2154
 
2155
-		$this->_set_add_edit_form_tags( 'process_reg_step', $hidden_fields ); //we come back to the process_registration_step route.
2155
+		$this->_set_add_edit_form_tags('process_reg_step', $hidden_fields); //we come back to the process_registration_step route.
2156 2156
 
2157 2157
 		return EEH_Template::display_template(
2158
-			REG_TEMPLATE_PATH . 'reg_admin_register_new_attendee_step_content.template.php', $template_args, TRUE
2158
+			REG_TEMPLATE_PATH.'reg_admin_register_new_attendee_step_content.template.php', $template_args, TRUE
2159 2159
 		);
2160 2160
 	}
2161 2161
 
@@ -2170,11 +2170,11 @@  discard block
 block discarded – undo
2170 2170
 	*		@return boolean
2171 2171
 	*/
2172 2172
 	private function _set_reg_event() {
2173
-		if ( is_object( $this->_reg_event )) {
2173
+		if (is_object($this->_reg_event)) {
2174 2174
 			return TRUE;
2175 2175
 		}
2176
-		$EVT_ID = ( ! empty( $this->_req_data['event_id'] )) ? absint( $this->_req_data['event_id'] ) : FALSE;
2177
-		if ( ! $EVT_ID ) {
2176
+		$EVT_ID = ( ! empty($this->_req_data['event_id'])) ? absint($this->_req_data['event_id']) : FALSE;
2177
+		if ( ! $EVT_ID) {
2178 2178
 			return FALSE;
2179 2179
 		}
2180 2180
 
@@ -2195,82 +2195,82 @@  discard block
 block discarded – undo
2195 2195
 	public function process_reg_step() {
2196 2196
 		EE_System::do_not_cache();
2197 2197
 		$this->_set_reg_event();
2198
-		EE_Registry::instance()->REQ->set_espresso_page( TRUE );
2198
+		EE_Registry::instance()->REQ->set_espresso_page(TRUE);
2199 2199
 
2200 2200
 		//what step are we on?
2201 2201
 		$cart = EE_Registry::instance()->SSN->cart();
2202 2202
 		$step = ! $cart instanceof EE_Cart ? 'ticket' : 'questions';
2203 2203
 
2204 2204
 		//if doing ajax then we need to verify the nonce
2205
-		if ( defined( 'DOING_AJAX' ) ) {
2206
-			$nonce = isset( $this->_req_data[$this->_req_nonce] ) ? sanitize_text_field( $this->_req_data[$this->_req_nonce] ) : '';
2207
-			$this->_verify_nonce( $nonce, $this->_req_nonce );
2205
+		if (defined('DOING_AJAX')) {
2206
+			$nonce = isset($this->_req_data[$this->_req_nonce]) ? sanitize_text_field($this->_req_data[$this->_req_nonce]) : '';
2207
+			$this->_verify_nonce($nonce, $this->_req_nonce);
2208 2208
 		}
2209 2209
 
2210
-		switch ( $step ) {
2210
+		switch ($step) {
2211 2211
 
2212 2212
 			case 'ticket' :
2213 2213
 				//process ticket selection
2214 2214
 				$success = EED_Ticket_Selector::instance()->process_ticket_selections();
2215
-				if ( $success ) {
2216
-					EE_Error::add_success( __('Tickets Selected. Now complete the registration.'), 'event_espresso');
2215
+				if ($success) {
2216
+					EE_Error::add_success(__('Tickets Selected. Now complete the registration.'), 'event_espresso');
2217 2217
 				} else {
2218 2218
 					$query_args['step_error'] = $this->_req_data['step_error'] = TRUE;
2219 2219
 				}
2220
-				if ( defined('DOING_AJAX') ) {
2220
+				if (defined('DOING_AJAX')) {
2221 2221
 					$this->new_registration(); //display next step
2222 2222
 				} else {
2223 2223
 					$query_args['action'] = 'new_registration';
2224 2224
 					$query_args['processing_registration'] = 1;
2225 2225
 					$query_args['event_id'] = $this->_reg_event->ID();
2226
-					$this->_redirect_after_action( FALSE, '', '', $query_args, TRUE );
2226
+					$this->_redirect_after_action(FALSE, '', '', $query_args, TRUE);
2227 2227
 				}
2228 2228
 				break;
2229 2229
 
2230 2230
 			case 'questions' :
2231
-				if( ! isset( $this->_req_data[ 'txn_reg_status_change' ], $this->_req_data[ 'txn_reg_status_change' ][ 'send_notifications' ] ) ) {
2232
-					add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_false', 15 );
2231
+				if ( ! isset($this->_req_data['txn_reg_status_change'], $this->_req_data['txn_reg_status_change']['send_notifications'])) {
2232
+					add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_false', 15);
2233 2233
 				}
2234 2234
 				//process registration
2235 2235
 				$transaction = EED_Single_Page_Checkout::instance()->process_registration_from_admin();
2236
-				if ( $cart instanceof EE_Cart ) {
2236
+				if ($cart instanceof EE_Cart) {
2237 2237
 					$grand_total = $cart->get_cart_grand_total();
2238
-					if ( $grand_total instanceof EE_Line_Item ) {
2238
+					if ($grand_total instanceof EE_Line_Item) {
2239 2239
 						$grand_total->save_this_and_descendants_to_txn();
2240 2240
 					}
2241 2241
 				}
2242
-				if ( ! $transaction instanceof EE_Transaction ) {
2242
+				if ( ! $transaction instanceof EE_Transaction) {
2243 2243
 					$query_args = array(
2244 2244
 						'action' => 'new_registration',
2245 2245
 						'processing_registration' => 2,
2246 2246
 						'event_id' => $this->_reg_event->ID()
2247 2247
 					);
2248 2248
 
2249
-					if ( defined('DOING_AJAX' )) {
2249
+					if (defined('DOING_AJAX')) {
2250 2250
 						//display registration form again because there are errors (maybe validation?)
2251 2251
 						$this->new_registration();
2252 2252
 						return;
2253 2253
 					} else {
2254
-						$this->_redirect_after_action( FALSE, '', '', $query_args, TRUE );
2254
+						$this->_redirect_after_action(FALSE, '', '', $query_args, TRUE);
2255 2255
 						return;
2256 2256
 					}
2257 2257
 				}
2258 2258
 				/** @type EE_Transaction_Payments $transaction_payments */
2259
-				$transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' );
2259
+				$transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments');
2260 2260
 				// maybe update status, and make sure to save transaction if not done already
2261
-				if ( ! $transaction_payments->update_transaction_status_based_on_total_paid( $transaction )) {
2261
+				if ( ! $transaction_payments->update_transaction_status_based_on_total_paid($transaction)) {
2262 2262
 					$transaction->save();
2263 2263
 				}
2264
-				EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ );
2264
+				EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__);
2265 2265
 				$this->_req_data = array();
2266 2266
 				$query_args = array(
2267 2267
 					'action'        => 'redirect_to_txn',
2268 2268
 					'TXN_ID'        => $transaction->ID(),
2269 2269
 					'EVT_ID'        => $this->_reg_event->ID(),
2270
-					'event_name'    => urlencode( $this->_reg_event->name() ),
2270
+					'event_name'    => urlencode($this->_reg_event->name()),
2271 2271
 					'redirect_from' => 'new_registration'
2272 2272
 				);
2273
-				$this->_redirect_after_action( false, '', '', $query_args, true );
2273
+				$this->_redirect_after_action(false, '', '', $query_args, true);
2274 2274
 				break;
2275 2275
 		}
2276 2276
 
@@ -2287,21 +2287,21 @@  discard block
 block discarded – undo
2287 2287
 	 */
2288 2288
 	public function redirect_to_txn() {
2289 2289
 		EE_System::do_not_cache();
2290
-		EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ );
2290
+		EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__);
2291 2291
 		$query_args = array(
2292 2292
 			'action' => 'view_transaction',
2293
-			'TXN_ID' => isset( $this->_req_data['TXN_ID'] ) ? absint( $this->_req_data[ 'TXN_ID' ] )  : 0,
2293
+			'TXN_ID' => isset($this->_req_data['TXN_ID']) ? absint($this->_req_data['TXN_ID']) : 0,
2294 2294
 			'page'   => 'espresso_transactions'
2295 2295
 		);
2296
-		if ( isset( $this->_req_data[ 'EVT_ID' ], $this->_req_data[ 'redirect_from' ] ) ) {
2297
-			$query_args['EVT_ID'] = $this->_req_data[ 'EVT_ID' ];
2298
-			$query_args['event_name'] = urlencode( $this->_req_data[ 'event_name' ] );
2299
-			$query_args['redirect_from'] = $this->_req_data[ 'redirect_from' ];
2296
+		if (isset($this->_req_data['EVT_ID'], $this->_req_data['redirect_from'])) {
2297
+			$query_args['EVT_ID'] = $this->_req_data['EVT_ID'];
2298
+			$query_args['event_name'] = urlencode($this->_req_data['event_name']);
2299
+			$query_args['redirect_from'] = $this->_req_data['redirect_from'];
2300 2300
 		}
2301 2301
 		EE_Error::add_success(
2302
-			__( 'Registration Created.  Please review the transaction and add any payments as necessary', 'event_espresso' )
2302
+			__('Registration Created.  Please review the transaction and add any payments as necessary', 'event_espresso')
2303 2303
 		);
2304
-		$this->_redirect_after_action( false, '', '', $query_args, true );
2304
+		$this->_redirect_after_action(false, '', '', $query_args, true);
2305 2305
 	}
2306 2306
 
2307 2307
 
@@ -2312,7 +2312,7 @@  discard block
 block discarded – undo
2312 2312
 	*		@return void
2313 2313
 	*/
2314 2314
 	protected function _attendee_contact_list_table() {
2315
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
2315
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2316 2316
 		$this->_search_btn_label = __('Contacts', 'event_espresso');
2317 2317
 		$this->display_admin_list_table_page_with_no_sidebar();
2318 2318
 	}
@@ -2327,10 +2327,10 @@  discard block
 block discarded – undo
2327 2327
 	*		@access public
2328 2328
 	*		@return array
2329 2329
 	*/
2330
-	public function get_attendees( $per_page, $count = FALSE, $trash = FALSE ) {
2330
+	public function get_attendees($per_page, $count = FALSE, $trash = FALSE) {
2331 2331
 
2332
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
2333
-		require_once( REG_ADMIN . 'EE_Attendee_Contact_List_Table.class.php' );
2332
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2333
+		require_once(REG_ADMIN.'EE_Attendee_Contact_List_Table.class.php');
2334 2334
 		$ATT_MDL = EEM_Attendee::instance();
2335 2335
 
2336 2336
 		$this->_req_data['orderby'] = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : '';
@@ -2358,47 +2358,47 @@  discard block
 block discarded – undo
2358 2358
 				$orderby = 'ATT_lname';
2359 2359
 		}
2360 2360
 
2361
-		$sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'ASC';
2361
+		$sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'ASC';
2362 2362
 
2363
-		$current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1;
2364
-		$per_page = isset( $per_page ) && !empty( $per_page ) ? $per_page : 10;
2365
-		$per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page;
2363
+		$current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1;
2364
+		$per_page = isset($per_page) && ! empty($per_page) ? $per_page : 10;
2365
+		$per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page;
2366 2366
 
2367 2367
 		$_where = array();
2368 2368
 
2369
-		if ( isset( $this->_req_data['s'] ) ) {
2370
-			$sstr = '%' . $this->_req_data['s'] . '%';
2369
+		if (isset($this->_req_data['s'])) {
2370
+			$sstr = '%'.$this->_req_data['s'].'%';
2371 2371
 			$_where['OR'] = array(
2372
-				'Registration.Event.EVT_name' => array( 'LIKE', $sstr),
2373
-				'Registration.Event.EVT_desc' => array( 'LIKE', $sstr ),
2374
-				'Registration.Event.EVT_short_desc' => array( 'LIKE' , $sstr ),
2375
-				'ATT_fname' => array( 'LIKE', $sstr ),
2376
-				'ATT_lname' => array( 'LIKE', $sstr ),
2377
-				'ATT_short_bio' => array( 'LIKE', $sstr ),
2378
-				'ATT_email' => array('LIKE', $sstr ),
2379
-				'ATT_address' => array( 'LIKE', $sstr ),
2380
-				'ATT_address2' => array( 'LIKE', $sstr ),
2381
-				'ATT_city' => array( 'LIKE', $sstr ),
2382
-				'Country.CNT_name' => array( 'LIKE', $sstr ),
2383
-				'State.STA_name' => array('LIKE', $sstr ),
2384
-				'ATT_phone' => array( 'LIKE', $sstr ),
2385
-				'Registration.REG_final_price' => array( 'LIKE', $sstr ),
2386
-				'Registration.REG_code' => array( 'LIKE', $sstr ),
2387
-				'Registration.REG_count' => array( 'LIKE' , $sstr ),
2388
-				'Registration.REG_group_size' => array( 'LIKE' , $sstr )
2372
+				'Registration.Event.EVT_name' => array('LIKE', $sstr),
2373
+				'Registration.Event.EVT_desc' => array('LIKE', $sstr),
2374
+				'Registration.Event.EVT_short_desc' => array('LIKE', $sstr),
2375
+				'ATT_fname' => array('LIKE', $sstr),
2376
+				'ATT_lname' => array('LIKE', $sstr),
2377
+				'ATT_short_bio' => array('LIKE', $sstr),
2378
+				'ATT_email' => array('LIKE', $sstr),
2379
+				'ATT_address' => array('LIKE', $sstr),
2380
+				'ATT_address2' => array('LIKE', $sstr),
2381
+				'ATT_city' => array('LIKE', $sstr),
2382
+				'Country.CNT_name' => array('LIKE', $sstr),
2383
+				'State.STA_name' => array('LIKE', $sstr),
2384
+				'ATT_phone' => array('LIKE', $sstr),
2385
+				'Registration.REG_final_price' => array('LIKE', $sstr),
2386
+				'Registration.REG_code' => array('LIKE', $sstr),
2387
+				'Registration.REG_count' => array('LIKE', $sstr),
2388
+				'Registration.REG_group_size' => array('LIKE', $sstr)
2389 2389
 				);
2390 2390
 		}
2391 2391
 
2392 2392
 
2393
-		$offset = ($current_page-1)*$per_page;
2394
-		$limit = $count ? NULL : array( $offset, $per_page );
2393
+		$offset = ($current_page - 1) * $per_page;
2394
+		$limit = $count ? NULL : array($offset, $per_page);
2395 2395
 
2396
-		if ( $trash ) {
2397
-			$_where['status'] = array( '!=', 'publish' );
2398
-			$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));
2396
+		if ($trash) {
2397
+			$_where['status'] = array('!=', 'publish');
2398
+			$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));
2399 2399
 		} else {
2400
-			$_where['status'] = array( 'IN', array( 'publish' ) );
2401
-			$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
+			$_where['status'] = array('IN', array('publish'));
2401
+			$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));
2402 2402
 		}
2403 2403
 
2404 2404
 		return $all_attendees;
@@ -2415,10 +2415,10 @@  discard block
 block discarded – undo
2415 2415
 	 */
2416 2416
 	protected function _resend_registration() {
2417 2417
 		$this->_process_resend_registration();
2418
-		$query_args = isset($this->_req_data['redirect_to'] ) ? array('action' => $this->_req_data['redirect_to'], '_REG_ID' => $this->_req_data['_REG_ID'] ) : array(
2418
+		$query_args = isset($this->_req_data['redirect_to']) ? array('action' => $this->_req_data['redirect_to'], '_REG_ID' => $this->_req_data['_REG_ID']) : array(
2419 2419
 			'action' => 'default'
2420 2420
 		);
2421
-		$this->_redirect_after_action(FALSE, '', '', $query_args, TRUE );
2421
+		$this->_redirect_after_action(FALSE, '', '', $query_args, TRUE);
2422 2422
 	}
2423 2423
 
2424 2424
 
@@ -2426,26 +2426,26 @@  discard block
 block discarded – undo
2426 2426
 
2427 2427
 
2428 2428
 
2429
-	public function _registrations_report(){
2430
-		if( ! defined( 'EE_USE_OLD_CSV_REPORT_CLASS' ) ) {
2431
-			wp_redirect( EE_Admin_Page::add_query_args_and_nonce(
2429
+	public function _registrations_report() {
2430
+		if ( ! defined('EE_USE_OLD_CSV_REPORT_CLASS')) {
2431
+			wp_redirect(EE_Admin_Page::add_query_args_and_nonce(
2432 2432
 				array(
2433 2433
 					'page' => 'espresso_batch',
2434 2434
 					'batch' => 'file',
2435
-					'EVT_ID' => isset( $this->_req_data[ 'EVT_ID'] ) ? $this->_req_data[ 'EVT_ID' ] : NULL,
2436
-					'job_handler' => urlencode( 'EventEspressoBatchRequest\JobHandlers\RegistrationsReport' ),
2437
-					'return_url' => urlencode( $this->_req_data[ 'return_url' ] ),
2438
-				)) );
2435
+					'EVT_ID' => isset($this->_req_data['EVT_ID']) ? $this->_req_data['EVT_ID'] : NULL,
2436
+					'job_handler' => urlencode('EventEspressoBatchRequest\JobHandlers\RegistrationsReport'),
2437
+					'return_url' => urlencode($this->_req_data['return_url']),
2438
+				)));
2439 2439
 		} else {
2440 2440
 			$new_request_args = array(
2441 2441
 				'export' => 'report',
2442 2442
 				'action' => 'registrations_report_for_event',
2443
-				'EVT_ID' => isset( $this->_req_data[ 'EVT_ID'] ) ? $this->_req_data[ 'EVT_ID' ] : NULL,
2443
+				'EVT_ID' => isset($this->_req_data['EVT_ID']) ? $this->_req_data['EVT_ID'] : NULL,
2444 2444
 			);
2445 2445
 			$this->_req_data = array_merge($this->_req_data, $new_request_args);
2446 2446
 
2447
-			if ( is_readable(EE_CLASSES . 'EE_Export.class.php')) {
2448
-				require_once(EE_CLASSES . 'EE_Export.class.php');
2447
+			if (is_readable(EE_CLASSES.'EE_Export.class.php')) {
2448
+				require_once(EE_CLASSES.'EE_Export.class.php');
2449 2449
 				$EE_Export = EE_Export::instance($this->_req_data);
2450 2450
 				$EE_Export->export();
2451 2451
 			}
@@ -2454,26 +2454,26 @@  discard block
 block discarded – undo
2454 2454
 
2455 2455
 
2456 2456
 
2457
-	public function _contact_list_export(){
2458
-		if ( is_readable(EE_CLASSES . 'EE_Export.class.php')) {
2459
-			require_once(EE_CLASSES . 'EE_Export.class.php');
2457
+	public function _contact_list_export() {
2458
+		if (is_readable(EE_CLASSES.'EE_Export.class.php')) {
2459
+			require_once(EE_CLASSES.'EE_Export.class.php');
2460 2460
 			$EE_Export = EE_Export::instance($this->_req_data);
2461 2461
 			$EE_Export->export_attendees();
2462 2462
 		}
2463 2463
 	}
2464 2464
 
2465
-	public function _contact_list_report(){
2466
-		if( ! defined( 'EE_USE_OLD_CSV_REPORT_CLASS' ) ) {
2467
-			wp_redirect( EE_Admin_Page::add_query_args_and_nonce(
2465
+	public function _contact_list_report() {
2466
+		if ( ! defined('EE_USE_OLD_CSV_REPORT_CLASS')) {
2467
+			wp_redirect(EE_Admin_Page::add_query_args_and_nonce(
2468 2468
 				array(
2469 2469
 					'page' => 'espresso_batch',
2470 2470
 					'batch' => 'file',
2471
-					'job_handler' => urlencode( 'EventEspressoBatchRequest\JobHandlers\AttendeesReport' ),
2472
-					'return_url' => urlencode( $this->_req_data[ 'return_url' ] ),
2473
-				)) );
2471
+					'job_handler' => urlencode('EventEspressoBatchRequest\JobHandlers\AttendeesReport'),
2472
+					'return_url' => urlencode($this->_req_data['return_url']),
2473
+				)));
2474 2474
 		} else {
2475
-			if ( is_readable(EE_CLASSES . 'EE_Export.class.php')) {
2476
-				require_once(EE_CLASSES . 'EE_Export.class.php');
2475
+			if (is_readable(EE_CLASSES.'EE_Export.class.php')) {
2476
+				require_once(EE_CLASSES.'EE_Export.class.php');
2477 2477
 				$EE_Export = EE_Export::instance($this->_req_data);
2478 2478
 				$EE_Export->report_attendees();
2479 2479
 			}
@@ -2493,73 +2493,73 @@  discard block
 block discarded – undo
2493 2493
 	 * @return void
2494 2494
 	 */
2495 2495
 	protected function _duplicate_attendee() {
2496
-		$action = !empty( $this->_req_data['return'] ) ? $this->_req_data['return'] : 'default';
2496
+		$action = ! empty($this->_req_data['return']) ? $this->_req_data['return'] : 'default';
2497 2497
 		//verify we have necessary info
2498
-		if ( empty($this->_req_data['_REG_ID'] )  ) {
2499
-			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__ );
2500
-			$query_args = array( 'action' => $action );
2498
+		if (empty($this->_req_data['_REG_ID'])) {
2499
+			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__);
2500
+			$query_args = array('action' => $action);
2501 2501
 			$this->_redirect_after_action('', '', '', $query_args, TRUE);
2502 2502
 		}
2503 2503
 
2504 2504
 		//okay necessary deets present... let's dupe the incoming attendee and attach to incoming registration.
2505
-		$registration = EEM_Registration::instance()->get_one_by_ID( $this->_req_data['_REG_ID'] );
2505
+		$registration = EEM_Registration::instance()->get_one_by_ID($this->_req_data['_REG_ID']);
2506 2506
 		$attendee = $registration->attendee();
2507 2507
 
2508 2508
 		//remove relation of existing attendee on registration
2509
-		$registration->_remove_relation_to($attendee, 'Attendee' );
2509
+		$registration->_remove_relation_to($attendee, 'Attendee');
2510 2510
 		//new attendee
2511 2511
 		$new_attendee = clone $attendee;
2512
-		$new_attendee->set( 'ATT_ID', 0 );
2512
+		$new_attendee->set('ATT_ID', 0);
2513 2513
 		$new_attendee->save();
2514 2514
 
2515 2515
 		//add new attendee to reg
2516
-		$registration->_add_relation_to( $new_attendee, 'Attendee');
2516
+		$registration->_add_relation_to($new_attendee, 'Attendee');
2517 2517
 
2518
-		EE_Error::add_success( __('New Contact record created.  Now make any edits you wish to make for this contact.', 'event_espresso') );
2518
+		EE_Error::add_success(__('New Contact record created.  Now make any edits you wish to make for this contact.', 'event_espresso'));
2519 2519
 
2520 2520
 		//redirect to edit page for attendee
2521
-		$query_args = array( 'post' => $new_attendee->ID(), 'action' => 'edit_attendee' );
2521
+		$query_args = array('post' => $new_attendee->ID(), 'action' => 'edit_attendee');
2522 2522
 
2523
-		$this->_redirect_after_action( '', '', '', $query_args, TRUE );
2523
+		$this->_redirect_after_action('', '', '', $query_args, TRUE);
2524 2524
 	}
2525 2525
 
2526 2526
 
2527 2527
 	//related to cpt routes
2528 2528
 	protected function _insert_update_cpt_item($post_id, $post) {
2529 2529
 		$success = true;
2530
-		$attendee = EEM_Attendee::instance()->get_one_by_ID( $post_id );
2530
+		$attendee = EEM_Attendee::instance()->get_one_by_ID($post_id);
2531 2531
 		//for attendee updates
2532
-		if ( $post->post_type = 'espresso_attendees' && !empty( $attendee ) ) {
2532
+		if ($post->post_type = 'espresso_attendees' && ! empty($attendee)) {
2533 2533
 			//note we should only be UPDATING attendees at this point.
2534 2534
 			$updated_fields = array(
2535 2535
 				'ATT_fname' => $this->_req_data['ATT_fname'],
2536 2536
 				'ATT_lname' => $this->_req_data['ATT_lname'],
2537
-				'ATT_full_name'=> $this->_req_data['ATT_fname'] . ' ' . $this->_req_data['ATT_lname'],
2537
+				'ATT_full_name'=> $this->_req_data['ATT_fname'].' '.$this->_req_data['ATT_lname'],
2538 2538
 				'ATT_address' => isset($this->_req_data['ATT_address']) ? $this->_req_data['ATT_address'] : '',
2539 2539
 				'ATT_address2' => isset($this->_req_data['ATT_address2']) ? $this->_req_data['ATT_address2'] : '',
2540
-				'ATT_city' => isset( $this->_req_data['ATT_city'] ) ? $this->_req_data['ATT_city'] : '',
2541
-				'STA_ID' => isset( $this->_req_data['STA_ID'] ) ? $this->_req_data['STA_ID'] : '',
2542
-				'CNT_ISO' => isset( $this->_req_data['CNT_ISO'] ) ? $this->_req_data['CNT_ISO'] : '',
2543
-				'ATT_zip' => isset( $this->_req_data['ATT_zip'] ) ? $this->_req_data['ATT_zip'] : '',
2544
-				'ATT_email' => isset( $this->_req_data['ATT_email'] ) ? $this->_req_data['ATT_email'] : '',
2545
-				'ATT_phone' => isset( $this->_req_data['ATT_phone'] ) ? $this->_req_data['ATT_phone'] : ''
2540
+				'ATT_city' => isset($this->_req_data['ATT_city']) ? $this->_req_data['ATT_city'] : '',
2541
+				'STA_ID' => isset($this->_req_data['STA_ID']) ? $this->_req_data['STA_ID'] : '',
2542
+				'CNT_ISO' => isset($this->_req_data['CNT_ISO']) ? $this->_req_data['CNT_ISO'] : '',
2543
+				'ATT_zip' => isset($this->_req_data['ATT_zip']) ? $this->_req_data['ATT_zip'] : '',
2544
+				'ATT_email' => isset($this->_req_data['ATT_email']) ? $this->_req_data['ATT_email'] : '',
2545
+				'ATT_phone' => isset($this->_req_data['ATT_phone']) ? $this->_req_data['ATT_phone'] : ''
2546 2546
 				);
2547
-			foreach ( $updated_fields as $field => $value ) {
2547
+			foreach ($updated_fields as $field => $value) {
2548 2548
 				$attendee->set($field, $value);
2549 2549
 			}
2550 2550
 
2551 2551
 			$success = $attendee->save();
2552 2552
 
2553
-			$attendee_update_callbacks = apply_filters( 'FHEE__Registrations_Admin_Page__insert_update_cpt_item__attendee_update', array() );
2554
-			foreach ( $attendee_update_callbacks as $a_callback ) {
2555
-				if ( FALSE === call_user_func_array( $a_callback, array($attendee, $this->_req_data ) ) ) {
2556
-					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 ) );
2553
+			$attendee_update_callbacks = apply_filters('FHEE__Registrations_Admin_Page__insert_update_cpt_item__attendee_update', array());
2554
+			foreach ($attendee_update_callbacks as $a_callback) {
2555
+				if (FALSE === call_user_func_array($a_callback, array($attendee, $this->_req_data))) {
2556
+					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));
2557 2557
 				}
2558 2558
 			}
2559 2559
 		}
2560 2560
 
2561
-		if ( $success === FALSE )
2562
-			EE_Error::add_error(__('Something went wrong with updating the meta table data for the registration.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
2561
+		if ($success === FALSE)
2562
+			EE_Error::add_error(__('Something went wrong with updating the meta table data for the registration.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
2563 2563
 
2564 2564
 	}
2565 2565
 
@@ -2579,17 +2579,17 @@  discard block
 block discarded – undo
2579 2579
 		remove_meta_box('postexcerpt', __('Excerpt'), 'post_excerpt_meta_box', $this->_cpt_routes[$this->_req_action], 'normal', 'core');
2580 2580
 		remove_meta_box('commentstatusdiv', $this->_cpt_routes[$this->_req_action], 'normal', 'core');
2581 2581
 
2582
-		if ( post_type_supports( 'espresso_attendees', 'excerpt') ) {
2583
-			add_meta_box('postexcerpt', __('Short Biography', 'event_espresso'), 'post_excerpt_meta_box', $this->_cpt_routes[$this->_req_action], 'normal' );
2582
+		if (post_type_supports('espresso_attendees', 'excerpt')) {
2583
+			add_meta_box('postexcerpt', __('Short Biography', 'event_espresso'), 'post_excerpt_meta_box', $this->_cpt_routes[$this->_req_action], 'normal');
2584 2584
 		}
2585 2585
 
2586
-		if ( post_type_supports( 'espresso_attendees', 'comments') ) {
2586
+		if (post_type_supports('espresso_attendees', 'comments')) {
2587 2587
 			add_meta_box('commentsdiv', __('Notes on the Contact', 'event_espresso'), 'post_comment_meta_box', $this->_cpt_routes[$this->_req_action], 'normal', 'core');
2588 2588
 		}
2589 2589
 
2590
-		add_meta_box('attendee_contact_info', __('Contact Info', 'event_espresso'), array( $this, 'attendee_contact_info'), $this->_cpt_routes[$this->_req_action], 'side', 'core' );
2591
-		add_meta_box('attendee_details_address', __('Address Details', 'event_espresso'), array($this, 'attendee_address_details'), $this->_cpt_routes[$this->_req_action], 'normal', 'core' );
2592
-		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');
2590
+		add_meta_box('attendee_contact_info', __('Contact Info', 'event_espresso'), array($this, 'attendee_contact_info'), $this->_cpt_routes[$this->_req_action], 'side', 'core');
2591
+		add_meta_box('attendee_details_address', __('Address Details', 'event_espresso'), array($this, 'attendee_address_details'), $this->_cpt_routes[$this->_req_action], 'normal', 'core');
2592
+		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');
2593 2593
 	}
2594 2594
 
2595 2595
 
@@ -2598,10 +2598,10 @@  discard block
 block discarded – undo
2598 2598
 	 * @param  WP_Post $post wp post object
2599 2599
 	 * @return string        attendee contact info ( and form )
2600 2600
 	 */
2601
-	public function attendee_contact_info( $post ) {
2601
+	public function attendee_contact_info($post) {
2602 2602
 		//get attendee object ( should already have it )
2603 2603
 		$this->_template_args['attendee'] = $this->_cpt_model_obj;
2604
-		$template = REG_TEMPLATE_PATH . 'attendee_contact_info_metabox_content.template.php';
2604
+		$template = REG_TEMPLATE_PATH.'attendee_contact_info_metabox_content.template.php';
2605 2605
 		EEH_Template::display_template($template, $this->_template_args);
2606 2606
 	}
2607 2607
 
@@ -2617,12 +2617,12 @@  discard block
 block discarded – undo
2617 2617
 		$this->_template_args['attendee'] = $this->_cpt_model_obj;
2618 2618
 		$this->_template_args['state_html'] = EEH_Form_Fields::generate_form_input(
2619 2619
 				new EE_Question_Form_Input(
2620
-				EE_Question::new_instance( array(
2620
+				EE_Question::new_instance(array(
2621 2621
 					'QST_ID' => 0,
2622 2622
 					'QST_display_text' => __('State/Province', 'event_espresso'),
2623 2623
 					'QST_system' => 'admin-state'
2624 2624
 					)),
2625
-				EE_Answer::new_instance( array(
2625
+				EE_Answer::new_instance(array(
2626 2626
 					'ANS_ID' => 0,
2627 2627
 					'ANS_value' => $this->_cpt_model_obj->state_ID()
2628 2628
 					)),
@@ -2635,12 +2635,12 @@  discard block
 block discarded – undo
2635 2635
 			));
2636 2636
 		$this->_template_args['country_html'] = EEH_Form_Fields::generate_form_input(
2637 2637
 				new EE_Question_Form_Input(
2638
-				EE_Question::new_instance( array(
2638
+				EE_Question::new_instance(array(
2639 2639
 					'QST_ID' => 0,
2640 2640
 					'QST_display_text' => __('Country', 'event_espresso'),
2641 2641
 					'QST_system' => 'admin-country'
2642 2642
 					)),
2643
-				EE_Answer::new_instance( array(
2643
+				EE_Answer::new_instance(array(
2644 2644
 					'ANS_ID' => 0,
2645 2645
 					'ANS_value' => $this->_cpt_model_obj->country_ID()
2646 2646
 					)),
@@ -2651,8 +2651,8 @@  discard block
 block discarded – undo
2651 2651
 					'append_qstn_id' => FALSE
2652 2652
 					)
2653 2653
 				));
2654
-		$template = REG_TEMPLATE_PATH . 'attendee_address_details_metabox_content.template.php';
2655
-		EEH_Template::display_template($template, $this->_template_args );
2654
+		$template = REG_TEMPLATE_PATH.'attendee_address_details_metabox_content.template.php';
2655
+		EEH_Template::display_template($template, $this->_template_args);
2656 2656
 
2657 2657
 	}
2658 2658
 
@@ -2662,11 +2662,11 @@  discard block
 block discarded – undo
2662 2662
 	*		@access protected
2663 2663
 	*		@return void
2664 2664
 	*/
2665
-	public function attendee_registrations_meta_box( $post ) {
2665
+	public function attendee_registrations_meta_box($post) {
2666 2666
 
2667 2667
 		$this->_template_args['attendee'] = $this->_cpt_model_obj;
2668 2668
 		$this->_template_args['registrations'] = $this->_cpt_model_obj->get_many_related('Registration');
2669
-		$template = REG_TEMPLATE_PATH . 'attendee_registrations_main_meta_box.template.php';
2669
+		$template = REG_TEMPLATE_PATH.'attendee_registrations_main_meta_box.template.php';
2670 2670
 		EEH_Template::display_template($template, $this->_template_args);
2671 2671
 
2672 2672
 	}
@@ -2680,8 +2680,8 @@  discard block
 block discarded – undo
2680 2680
 	 * @return string        html for new form.
2681 2681
 	 */
2682 2682
 	public function after_title_form_fields($post) {
2683
-		if ( $post->post_type == 'espresso_attendees' ) {
2684
-			$template = REG_TEMPLATE_PATH . 'attendee_details_after_title_form_fields.template.php';
2683
+		if ($post->post_type == 'espresso_attendees') {
2684
+			$template = REG_TEMPLATE_PATH.'attendee_details_after_title_form_fields.template.php';
2685 2685
 			$template_args['attendee'] = $this->_cpt_model_obj;
2686 2686
 			EEH_Template::display_template($template, $template_args);
2687 2687
 		}
@@ -2698,21 +2698,21 @@  discard block
 block discarded – undo
2698 2698
 	*		@access protected
2699 2699
 	*		@return void
2700 2700
 	*/
2701
-	protected function _trash_or_restore_attendees( $trash = TRUE ) {
2701
+	protected function _trash_or_restore_attendees($trash = TRUE) {
2702 2702
 
2703
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
2703
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2704 2704
 
2705 2705
 		$ATT_MDL = EEM_Attendee::instance();
2706 2706
 
2707 2707
 		$success = 1;
2708 2708
 		//Checkboxes
2709
-		if (!empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
2709
+		if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
2710 2710
 			// if array has more than one element than success message should be plural
2711
-			$success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1;
2711
+			$success = count($this->_req_data['checkbox']) > 1 ? 2 : 1;
2712 2712
 			// cycle thru checkboxes
2713
-			while (list( $ATT_ID, $value ) = each($this->_req_data['checkbox'])) {
2714
-				$updated = $trash ? $ATT_MDL->update_by_ID(array( 'status' => 'trash' ), $ATT_ID) : $ATT_MDL->update_by_ID( array('status' => 'publish' ), $ATT_ID);
2715
-				if ( !$updated ) {
2713
+			while (list($ATT_ID, $value) = each($this->_req_data['checkbox'])) {
2714
+				$updated = $trash ? $ATT_MDL->update_by_ID(array('status' => 'trash'), $ATT_ID) : $ATT_MDL->update_by_ID(array('status' => 'publish'), $ATT_ID);
2715
+				if ( ! $updated) {
2716 2716
 					$success = 0;
2717 2717
 				}
2718 2718
 			}
@@ -2721,18 +2721,18 @@  discard block
 block discarded – undo
2721 2721
 			// grab single id and delete
2722 2722
 			$ATT_ID = absint($this->_req_data['ATT_ID']);
2723 2723
 			//get attendee
2724
-			$att = $ATT_MDL->get_one_by_ID( $ATT_ID );
2724
+			$att = $ATT_MDL->get_one_by_ID($ATT_ID);
2725 2725
 			$updated = $trash ? $att->set_status('trash') : $att->set_status('publish');
2726 2726
 			$updated = $att->save();
2727
-			if ( ! $updated ) {
2727
+			if ( ! $updated) {
2728 2728
 				$success = 0;
2729 2729
 			}
2730 2730
 
2731 2731
 		}
2732 2732
 
2733
-		$what = $success > 1 ? __( 'Contacts', 'event_espresso' ) : __( 'Contact', 'event_espresso' );
2734
-		$action_desc = $trash ? __( 'moved to the trash', 'event_espresso' ) : __( 'restored', 'event_espresso' );
2735
-		$this->_redirect_after_action( $success, $what, $action_desc, array( 'action' => 'contact_list' ) );
2733
+		$what = $success > 1 ? __('Contacts', 'event_espresso') : __('Contact', 'event_espresso');
2734
+		$action_desc = $trash ? __('moved to the trash', 'event_espresso') : __('restored', 'event_espresso');
2735
+		$this->_redirect_after_action($success, $what, $action_desc, array('action' => 'contact_list'));
2736 2736
 
2737 2737
 	}
2738 2738
 
Please login to merge, or discard this patch.
admin_pages/registration_form/Registration_Form_Admin_Page.core.php 1 patch
Spacing   +149 added lines, -149 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
 /**
@@ -68,12 +68,12 @@  discard block
 block discarded – undo
68 68
 	 * 		@param bool $routing indicate whether we want to just load the object and handle routing or just load the object.
69 69
 	 * 		@access public
70 70
 	 */
71
-	public function __construct( $routing = TRUE ) {
72
-		require_once( EE_MODELS . 'EEM_Question.model.php' );
73
-		require_once( EE_MODELS . 'EEM_Question_Group.model.php' );
74
-		$this->_question_model=  EEM_Question::instance();
75
-		$this->_question_group_model=EEM_Question_Group::instance();
76
-		parent::__construct( $routing );
71
+	public function __construct($routing = TRUE) {
72
+		require_once(EE_MODELS.'EEM_Question.model.php');
73
+		require_once(EE_MODELS.'EEM_Question_Group.model.php');
74
+		$this->_question_model = EEM_Question::instance();
75
+		$this->_question_group_model = EEM_Question_Group::instance();
76
+		parent::__construct($routing);
77 77
 	}
78 78
 
79 79
 
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 	 *_set_page_routes
110 110
 	 */
111 111
 	protected function _set_page_routes() {
112
-		$qst_id = ! empty( $this->_req_data['QST_ID'] ) ? $this->_req_data['QST_ID'] : 0;
112
+		$qst_id = ! empty($this->_req_data['QST_ID']) ? $this->_req_data['QST_ID'] : 0;
113 113
 		$this->_page_routes = array(
114 114
 			'default' => array(
115 115
 				'func' => '_questions_overview_list_table',
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
 
131 131
 			'update_question' => array(
132 132
 				'func' => '_insert_or_update_question',
133
-				'args' => array('new_question' => FALSE ),
133
+				'args' => array('new_question' => FALSE),
134 134
 				'capability' => 'ee_edit_question',
135 135
 				'obj_id' => $qst_id,
136 136
 				'noheader' => TRUE,
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
 						'filename' => 'registration_form_questions_overview_views_bulk_actions_search'
166 166
 						)
167 167
 					),
168
-				'help_tour' => array( 'Registration_Form_Questions_Overview_Help_Tour'),
168
+				'help_tour' => array('Registration_Form_Questions_Overview_Help_Tour'),
169 169
 				'require_nonce' => FALSE,
170 170
 				'qtips' => array(
171 171
 					'EE_Registration_Form_Tips'
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
 						'filename' => 'registration_form_question_groups'
185 185
 						),
186 186
 					),
187
-				'help_tour' => array( 'Registration_Form_Question_Groups_Help_Tour'),
187
+				'help_tour' => array('Registration_Form_Question_Groups_Help_Tour'),
188 188
 				'require_nonce' => FALSE
189 189
 				),
190 190
 
@@ -193,16 +193,16 @@  discard block
 block discarded – undo
193 193
 					'label' => esc_html__('Edit Question', 'event_espresso'),
194 194
 					'order' => 15,
195 195
 					'persistent' => FALSE,
196
-					'url' => isset($this->_req_data['question_id']) ? add_query_arg(array('question_id' => $this->_req_data['question_id'] ), $this->_current_page_view_url )  : $this->_admin_base_url
196
+					'url' => isset($this->_req_data['question_id']) ? add_query_arg(array('question_id' => $this->_req_data['question_id']), $this->_current_page_view_url) : $this->_admin_base_url
197 197
 					),
198
-				'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array('_publish_post_box' ) ),
198
+				'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')),
199 199
 				'help_tabs' => array(
200 200
 					'registration_form_edit_question_group_help_tab' => array(
201 201
 						'title' => esc_html__('Edit Question', 'event_espresso'),
202 202
 						'filename' => 'registration_form_edit_question'
203 203
 						),
204 204
 					),
205
-                'help_tour' => array( 'Registration_Form_Edit_Question_Help_Tour'),
205
+                'help_tour' => array('Registration_Form_Edit_Question_Help_Tour'),
206 206
 				'require_nonce' => FALSE
207 207
 				),
208 208
 			);
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
 	//none of the below group are currently used for Event Categories
231 231
 	protected function _add_feature_pointers() {}
232 232
 	public function load_scripts_styles() {
233
-		wp_register_style( 'espresso_registration', REGISTRATION_FORM_ASSETS_URL . 'espresso_registration_form_admin.css', array(), EVENT_ESPRESSO_VERSION );
233
+		wp_register_style('espresso_registration', REGISTRATION_FORM_ASSETS_URL.'espresso_registration_form_admin.css', array(), EVENT_ESPRESSO_VERSION);
234 234
 		wp_enqueue_style('espresso_registration');
235 235
 	}
236 236
 	public function admin_init() {}
@@ -246,20 +246,20 @@  discard block
 block discarded – undo
246 246
 
247 247
 	public function load_scripts_styles_add_question() {
248 248
 		$this->load_scripts_styles_forms();
249
-		wp_register_script( 'espresso_registration_form_single', REGISTRATION_FORM_ASSETS_URL . 'espresso_registration_form_admin.js', array('jquery-ui-sortable'), EVENT_ESPRESSO_VERSION, TRUE );
250
-		wp_enqueue_script( 'espresso_registration_form_single' );
249
+		wp_register_script('espresso_registration_form_single', REGISTRATION_FORM_ASSETS_URL.'espresso_registration_form_admin.js', array('jquery-ui-sortable'), EVENT_ESPRESSO_VERSION, TRUE);
250
+		wp_enqueue_script('espresso_registration_form_single');
251 251
 	}
252 252
 	public function load_scripts_styles_edit_question() {
253 253
 		$this->load_scripts_styles_forms();
254
-		wp_register_script( 'espresso_registration_form_single', REGISTRATION_FORM_ASSETS_URL . 'espresso_registration_form_admin.js', array('jquery-ui-sortable'), EVENT_ESPRESSO_VERSION, TRUE );
255
-		wp_enqueue_script( 'espresso_registration_form_single' );
254
+		wp_register_script('espresso_registration_form_single', REGISTRATION_FORM_ASSETS_URL.'espresso_registration_form_admin.js', array('jquery-ui-sortable'), EVENT_ESPRESSO_VERSION, TRUE);
255
+		wp_enqueue_script('espresso_registration_form_single');
256 256
 	}
257 257
 
258 258
 
259 259
 
260 260
 
261 261
 	public function recaptcha_info_help_tab() {
262
-		$template = REGISTRATION_FORM_TEMPLATE_PATH . 'recaptcha_info_help_tab.template.php';
262
+		$template = REGISTRATION_FORM_TEMPLATE_PATH.'recaptcha_info_help_tab.template.php';
263 263
 		EEH_Template::display_template($template, array());
264 264
 	}
265 265
 
@@ -291,7 +291,7 @@  discard block
 block discarded – undo
291 291
 				)
292 292
 		);
293 293
 
294
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_questions', 'espresso_registration_form_trash_questions' ) ) {
294
+		if (EE_Registry::instance()->CAP->current_user_can('ee_delete_questions', 'espresso_registration_form_trash_questions')) {
295 295
 			$this->_views['trash'] = array(
296 296
 				'slug' => 'trash',
297 297
 				'label' => esc_html__('Trash', 'event_espresso'),
@@ -309,9 +309,9 @@  discard block
 block discarded – undo
309 309
 	 */
310 310
 	protected function _questions_groups_preview() {
311 311
 		$this->_admin_page_title = esc_html__('Question Groups (Preview)', 'event_espresso');
312
-		$this->_template_args['preview_img'] = '<img src="' . REGISTRATION_FORM_ASSETS_URL . 'caf_reg_form_preview.jpg" alt="' . esc_attr__( 'Preview Question Groups Overview List Table screenshot', 'event_espresso' ) . '" />';
313
-		$this->_template_args['preview_text'] = '<strong>'.esc_html__( 'Question Groups is a feature that is only available in the Caffeinated version of Event Espresso.  With the Question Groups feature you are able to: create new question groups, edit existing question groups, and also create and edit new questions and add them to question groups.', 'event_espresso' ).'</strong>';
314
-		$this->display_admin_caf_preview_page( 'question_groups_tab' );
312
+		$this->_template_args['preview_img'] = '<img src="'.REGISTRATION_FORM_ASSETS_URL.'caf_reg_form_preview.jpg" alt="'.esc_attr__('Preview Question Groups Overview List Table screenshot', 'event_espresso').'" />';
313
+		$this->_template_args['preview_text'] = '<strong>'.esc_html__('Question Groups is a feature that is only available in the Caffeinated version of Event Espresso.  With the Question Groups feature you are able to: create new question groups, edit existing question groups, and also create and edit new questions and add them to question groups.', 'event_espresso').'</strong>';
314
+		$this->display_admin_caf_preview_page('question_groups_tab');
315 315
 	}
316 316
 
317 317
 
@@ -322,58 +322,58 @@  discard block
 block discarded – undo
322 322
 	 * @param \EEM_Base $model
323 323
 	 * @return array where each key is the name of a model's field/db column, and each value is its value.
324 324
 	 */
325
-	protected function _set_column_values_for(EEM_Base $model){
326
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
327
-		$set_column_values=array();
325
+	protected function _set_column_values_for(EEM_Base $model) {
326
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
327
+		$set_column_values = array();
328 328
 
329 329
 		//some initial checks for proper values.
330 330
 		//if QST_admin_only, then no matter what QST_required is we disable.
331
-		if ( !empty( $this->_req_data['QST_admin_only'] ) ) {
331
+		if ( ! empty($this->_req_data['QST_admin_only'])) {
332 332
 			$this->_req_data['QST_required'] = 0;
333 333
 		}
334
-		foreach($model->field_settings() as $fieldName=>$settings){
334
+		foreach ($model->field_settings() as $fieldName=>$settings) {
335 335
 			// basically if QSG_identifier is empty or not set
336
-			if ( $fieldName === 'QSG_identifier' && ( isset( $this->_req_data['QSG_identifier'] ) && empty( $this->_req_data['QSG_identifier'] ) )) {
337
-				$QSG_name = isset( $this->_req_data['QSG_name'] ) ? $this->_req_data['QSG_name'] : '' ;
338
-				$set_column_values[$fieldName] = sanitize_title($QSG_name ) . '-' . uniqid( '', true );
336
+			if ($fieldName === 'QSG_identifier' && (isset($this->_req_data['QSG_identifier']) && empty($this->_req_data['QSG_identifier']))) {
337
+				$QSG_name = isset($this->_req_data['QSG_name']) ? $this->_req_data['QSG_name'] : '';
338
+				$set_column_values[$fieldName] = sanitize_title($QSG_name).'-'.uniqid('', true);
339 339
 //				dd($set_column_values);
340 340
 			}
341 341
 			//if the admin label is blank, use a slug version of the question text
342
-			else if ( $fieldName === 'QST_admin_label' && ( isset( $this->_req_data['QST_admin_label'] ) && empty( $this->_req_data['QST_admin_label'] )  )) {
343
-				$QST_text = isset( $this->_req_data['QST_display_text'] ) ? $this->_req_data['QST_display_text'] : '' ;
344
-				$set_column_values[$fieldName] = sanitize_title(wp_trim_words($QST_text,10));
342
+			else if ($fieldName === 'QST_admin_label' && (isset($this->_req_data['QST_admin_label']) && empty($this->_req_data['QST_admin_label']))) {
343
+				$QST_text = isset($this->_req_data['QST_display_text']) ? $this->_req_data['QST_display_text'] : '';
344
+				$set_column_values[$fieldName] = sanitize_title(wp_trim_words($QST_text, 10));
345 345
 			}
346 346
 
347 347
 
348
-			else if ( $fieldName === 'QST_admin_only' && ( !isset( $this->_req_data['QST_admin_only'] ) ) ) {
348
+			else if ($fieldName === 'QST_admin_only' && ( ! isset($this->_req_data['QST_admin_only']))) {
349 349
 				$set_column_values[$fieldName] = 0;
350 350
 			}
351 351
 
352
-			else if ( $fieldName === 'QST_max' ) {
352
+			else if ($fieldName === 'QST_max') {
353 353
 				$qst_system = EEM_Question::instance()->get_var(
354 354
 					array(
355 355
 						array(
356
-							'QST_ID' => isset( $this->_req_data[ 'QST_ID' ] ) ? $this->_req_data[ 'QST_ID' ] : 0
356
+							'QST_ID' => isset($this->_req_data['QST_ID']) ? $this->_req_data['QST_ID'] : 0
357 357
 						)
358 358
 					),
359 359
 					'QST_system' );
360
-				$max_max = EEM_Question::instance()->absolute_max_for_system_question( $qst_system );
361
-				if( empty( $this->_req_data[ 'QST_max' ] ) ||
362
-					 $this->_req_data[ 'QST_max' ] > $max_max ) {
363
-					$set_column_values[ $fieldName ] = $max_max;
360
+				$max_max = EEM_Question::instance()->absolute_max_for_system_question($qst_system);
361
+				if (empty($this->_req_data['QST_max']) ||
362
+					 $this->_req_data['QST_max'] > $max_max) {
363
+					$set_column_values[$fieldName] = $max_max;
364 364
 				}
365 365
 			}
366 366
 
367 367
 
368 368
 			//only add a property to the array if it's not null (otherwise the model should just use the default value)
369
-			if(
370
-				! isset( $set_column_values[ $fieldName ] ) &&
371
-				isset($this->_req_data[$fieldName] ) ){
372
-				$set_column_values[$fieldName]=$this->_req_data[$fieldName];
369
+			if (
370
+				! isset($set_column_values[$fieldName]) &&
371
+				isset($this->_req_data[$fieldName]) ) {
372
+				$set_column_values[$fieldName] = $this->_req_data[$fieldName];
373 373
 			}
374 374
 
375 375
 		}
376
-		return $set_column_values;//validation fo this data to be performed by the model before insertion.
376
+		return $set_column_values; //validation fo this data to be performed by the model before insertion.
377 377
 	}
378 378
 
379 379
 
@@ -392,39 +392,39 @@  discard block
 block discarded – undo
392 392
 	 * _edit_question
393 393
 	 */
394 394
 	protected function _edit_question() {
395
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
396
-		$ID=isset( $this->_req_data['QST_ID'] ) && ! empty( $this->_req_data['QST_ID'] ) ? absint( $this->_req_data['QST_ID'] ) : FALSE;
395
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
396
+		$ID = isset($this->_req_data['QST_ID']) && ! empty($this->_req_data['QST_ID']) ? absint($this->_req_data['QST_ID']) : FALSE;
397 397
 
398
-		switch( $this->_req_action ) {
398
+		switch ($this->_req_action) {
399 399
 			case 'add_question' :
400
-				$this->_admin_page_title = esc_html__( 'Add Question', 'event_espresso' );
400
+				$this->_admin_page_title = esc_html__('Add Question', 'event_espresso');
401 401
 				break;
402 402
 			case 'edit_question' :
403
-				$this->_admin_page_title = esc_html__( 'Edit Question', 'event_espresso' );
403
+				$this->_admin_page_title = esc_html__('Edit Question', 'event_espresso');
404 404
 				break;
405 405
 			default :
406
-				$this->_admin_page_title = ucwords( str_replace( '_', ' ', $this->_req_action ));
406
+				$this->_admin_page_title = ucwords(str_replace('_', ' ', $this->_req_action));
407 407
 		}
408 408
 
409 409
 		// add PRC_ID to title if editing
410
-		$this->_admin_page_title = $ID ? $this->_admin_page_title . ' # ' . $ID : $this->_admin_page_title;
411
-		if($ID){
412
-			$question=$this->_question_model->get_one_by_ID($ID);
413
-			$additional_hidden_fields=array('QST_ID'=>array('type'=>'hidden','value'=>$ID));
410
+		$this->_admin_page_title = $ID ? $this->_admin_page_title.' # '.$ID : $this->_admin_page_title;
411
+		if ($ID) {
412
+			$question = $this->_question_model->get_one_by_ID($ID);
413
+			$additional_hidden_fields = array('QST_ID'=>array('type'=>'hidden', 'value'=>$ID));
414 414
 			$this->_set_add_edit_form_tags('update_question', $additional_hidden_fields);
415
-		}else{
416
-			$question= EE_Question::new_instance();
415
+		} else {
416
+			$question = EE_Question::new_instance();
417 417
 			$question->set_order_to_latest();
418 418
 			$this->_set_add_edit_form_tags('insert_question');
419 419
 		}
420
-		$question_types = $question->has_answers() ?  $this->_question_model->question_types_in_same_category( $question->type() ) : $this->_question_model->allowed_question_types();
421
-		$this->_template_args['QST_ID']=$ID;
422
-		$this->_template_args['question']=$question;
423
-		$this->_template_args['question_types']= $question_types;
424
-		$this->_template_args['max_max'] = EEM_Question::instance()->absolute_max_for_system_question( $question->system_ID() );
420
+		$question_types = $question->has_answers() ? $this->_question_model->question_types_in_same_category($question->type()) : $this->_question_model->allowed_question_types();
421
+		$this->_template_args['QST_ID'] = $ID;
422
+		$this->_template_args['question'] = $question;
423
+		$this->_template_args['question_types'] = $question_types;
424
+		$this->_template_args['max_max'] = EEM_Question::instance()->absolute_max_for_system_question($question->system_ID());
425 425
 		$this->_template_args['question_type_descriptions'] = $this->_get_question_type_descriptions();
426
-		$this->_set_publish_post_box_vars( 'id', $ID );
427
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( REGISTRATION_FORM_TEMPLATE_PATH . 'questions_main_meta_box.template.php', $this->_template_args, TRUE );
426
+		$this->_set_publish_post_box_vars('id', $ID);
427
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template(REGISTRATION_FORM_TEMPLATE_PATH.'questions_main_meta_box.template.php', $this->_template_args, TRUE);
428 428
 
429 429
 		// the details template wrapper
430 430
 		$this->display_admin_page_with_sidebar();
@@ -439,18 +439,18 @@  discard block
 block discarded – undo
439 439
 		EE_Registry::instance()->load_helper('HTML');
440 440
 		$descriptions = '';
441 441
 		$question_type_descriptions = EEM_Question::instance()->question_descriptions();
442
-		foreach ( $question_type_descriptions as $type => $question_type_description ) {
443
-			if ( $type == 'HTML_TEXTAREA' ) {
442
+		foreach ($question_type_descriptions as $type => $question_type_description) {
443
+			if ($type == 'HTML_TEXTAREA') {
444 444
 				$html = new EE_Simple_HTML_Validation_Strategy();
445 445
 				$question_type_description .= sprintf(
446
-					esc_html__( '%1$s(allowed tags: %2$s)', 'event_espresso' ),
446
+					esc_html__('%1$s(allowed tags: %2$s)', 'event_espresso'),
447 447
 					'<br/>',
448 448
 					$html->get_list_of_allowed_tags()
449 449
 				);
450 450
 			}
451 451
 			$descriptions .= EEH_HTML::p(
452 452
 				$question_type_description,
453
-				'question_type_description-' . $type,
453
+				'question_type_description-'.$type,
454 454
 				'question_type_description description',
455 455
 				'display:none;'
456 456
 			);
@@ -464,58 +464,58 @@  discard block
 block discarded – undo
464 464
 	 * @param bool|true $new_question
465 465
 	 * @throws \EE_Error
466 466
 	 */
467
-	protected function _insert_or_update_question( $new_question = TRUE) {
468
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
469
-		$set_column_values=$this->_set_column_values_for($this->_question_model);
470
-		if($new_question){
471
-			$ID=$this->_question_model->insert($set_column_values);
467
+	protected function _insert_or_update_question($new_question = TRUE) {
468
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
469
+		$set_column_values = $this->_set_column_values_for($this->_question_model);
470
+		if ($new_question) {
471
+			$ID = $this->_question_model->insert($set_column_values);
472 472
 			$success = $ID ? true : false;
473 473
 			$action_desc = 'added';
474
-		}else{
475
-			$ID=absint($this->_req_data['QST_ID']);
476
-			$pk=$this->_question_model->primary_key_name();
477
-			$wheres=array($pk=>$ID);
474
+		} else {
475
+			$ID = absint($this->_req_data['QST_ID']);
476
+			$pk = $this->_question_model->primary_key_name();
477
+			$wheres = array($pk=>$ID);
478 478
 			unset($set_column_values[$pk]);
479
-			$success= $this->_question_model->update($set_column_values,array($wheres));
480
-			$action_desc='updated';
479
+			$success = $this->_question_model->update($set_column_values, array($wheres));
480
+			$action_desc = 'updated';
481 481
 		}
482 482
 
483
-		if ($ID){
483
+		if ($ID) {
484 484
 			//save the related options
485 485
 			//trash removed options, save old ones
486 486
 			//get list of all options
487 487
 			/** @type EE_Question $question */
488
-			$question=$this->_question_model->get_one_by_ID($ID);
489
-			$options=$question->options();
490
-			if(! empty($options)){
491
-				foreach($options as $option_ID=>$option){
492
-					$option_req_index=$this->_get_option_req_data_index($option_ID);
493
-					if($option_req_index!==FALSE){
488
+			$question = $this->_question_model->get_one_by_ID($ID);
489
+			$options = $question->options();
490
+			if ( ! empty($options)) {
491
+				foreach ($options as $option_ID=>$option) {
492
+					$option_req_index = $this->_get_option_req_data_index($option_ID);
493
+					if ($option_req_index !== FALSE) {
494 494
 						$option->save($this->_req_data['question_options'][$option_req_index]);
495
-					}else{
495
+					} else {
496 496
 						//not found, remove it
497 497
 						$option->delete();
498 498
 					}
499 499
 				}
500 500
 			}
501 501
 			//save new related options
502
-			foreach($this->_req_data['question_options'] as $index=>$option_req_data){
503
-				if( empty($option_req_data['QSO_ID'] ) && (  ( isset( $option_req_data['QSO_value'] ) && $option_req_data['QSO_value'] !== '' ) || ! empty( $option_req_data['QSO_desc'] ) ) ) {//no ID! save it!
504
-					if( ! isset( $option_req_data['QSO_value'] ) || $option_req_data['QSO_value'] === ''  ){
505
-						$option_req_data['QSO_value']=$option_req_data['QSO_desc'];
502
+			foreach ($this->_req_data['question_options'] as $index=>$option_req_data) {
503
+				if (empty($option_req_data['QSO_ID']) && ((isset($option_req_data['QSO_value']) && $option_req_data['QSO_value'] !== '') || ! empty($option_req_data['QSO_desc']))) {//no ID! save it!
504
+					if ( ! isset($option_req_data['QSO_value']) || $option_req_data['QSO_value'] === '') {
505
+						$option_req_data['QSO_value'] = $option_req_data['QSO_desc'];
506 506
 					}
507
-					$new_option=EE_Question_Option::new_instance( array( 'QSO_value' => $option_req_data['QSO_value'], 'QSO_desc' => $option_req_data['QSO_desc'], 'QSO_order' => $option_req_data['QSO_order'], 'QST_ID' => $question->ID()));
507
+					$new_option = EE_Question_Option::new_instance(array('QSO_value' => $option_req_data['QSO_value'], 'QSO_desc' => $option_req_data['QSO_desc'], 'QSO_order' => $option_req_data['QSO_order'], 'QST_ID' => $question->ID()));
508 508
 					$new_option->save();
509 509
 				}
510 510
 			}
511 511
 		}
512
-		$query_args = array( 'action' => 'edit_question', 'QST_ID' => $ID );
513
-		if ( $success !== FALSE ) {
514
-			$msg = $new_question ? sprintf( esc_html__('The %s has been created', 'event_espresso'), $this->_question_model->item_name() ) : sprintf( esc_html__('The %s has been updated', 'event_espresso' ), $this->_question_model->item_name() );
515
-			EE_Error::add_success( $msg );
512
+		$query_args = array('action' => 'edit_question', 'QST_ID' => $ID);
513
+		if ($success !== FALSE) {
514
+			$msg = $new_question ? sprintf(esc_html__('The %s has been created', 'event_espresso'), $this->_question_model->item_name()) : sprintf(esc_html__('The %s has been updated', 'event_espresso'), $this->_question_model->item_name());
515
+			EE_Error::add_success($msg);
516 516
 		}
517 517
 
518
-		$this->_redirect_after_action( FALSE, '', $action_desc, $query_args, TRUE);
518
+		$this->_redirect_after_action(FALSE, '', $action_desc, $query_args, TRUE);
519 519
 	}
520 520
 
521 521
 
@@ -528,10 +528,10 @@  discard block
 block discarded – undo
528 528
 	 * @param int $ID of the question option to find
529 529
 	 * @return int index in question_options array if successful, FALSE if unsuccessful
530 530
 	 */
531
-	protected function _get_option_req_data_index($ID){
532
-		$req_data_for_question_options=$this->_req_data['question_options'];
533
-		foreach($req_data_for_question_options as $num=>$option_data){
534
-			if( array_key_exists('QSO_ID',$option_data) && (int)$option_data['QSO_ID'] === $ID ){
531
+	protected function _get_option_req_data_index($ID) {
532
+		$req_data_for_question_options = $this->_req_data['question_options'];
533
+		foreach ($req_data_for_question_options as $num=>$option_data) {
534
+			if (array_key_exists('QSO_ID', $option_data) && (int) $option_data['QSO_ID'] === $ID) {
535 535
 				return $num;
536 536
 			}
537 537
 		}
@@ -553,25 +553,25 @@  discard block
 block discarded – undo
553 553
 	 * @param int      $current_page
554 554
 	 * @return array lik EEM_Base::get_all's $query_params parameter
555 555
 	 */
556
-	protected function get_query_params($model, $per_page=10,$current_page=10){
556
+	protected function get_query_params($model, $per_page = 10, $current_page = 10) {
557 557
 		$query_params = array();
558
-		$offset=($current_page-1)*$per_page;
559
-		$query_params['limit']=array($offset,$per_page);
560
-		$order = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'ASC';
558
+		$offset = ($current_page - 1) * $per_page;
559
+		$query_params['limit'] = array($offset, $per_page);
560
+		$order = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'ASC';
561 561
 		$orderby_field = $model instanceof EEM_Question ? 'QST_ID' : 'QSG_order';
562 562
 		$field_to_order_by = empty($this->_req_data['orderby']) ? $orderby_field : $this->_req_data['orderby'];
563
-		$query_params['order_by']=array( $field_to_order_by => $order );
564
-		$search_string = array_key_exists('s',$this->_req_data) ? $this->_req_data['s'] : null;
565
-		if(! empty($search_string)){
566
-			if($model instanceof EEM_Question_Group){
567
-				$query_params[0]=array(
563
+		$query_params['order_by'] = array($field_to_order_by => $order);
564
+		$search_string = array_key_exists('s', $this->_req_data) ? $this->_req_data['s'] : null;
565
+		if ( ! empty($search_string)) {
566
+			if ($model instanceof EEM_Question_Group) {
567
+				$query_params[0] = array(
568 568
 					'OR'=>array(
569
-						'QSG_name'=>array('LIKE',"%$search_string%"),
570
-						'QSG_desc'=>array('LIKE',"%$search_string%"))
569
+						'QSG_name'=>array('LIKE', "%$search_string%"),
570
+						'QSG_desc'=>array('LIKE', "%$search_string%"))
571 571
 					);
572
-			}else{
573
-				$query_params[0]=array(
574
-					'QST_display_text'=>array('LIKE',"%$search_string%")
572
+			} else {
573
+				$query_params[0] = array(
574
+					'QST_display_text'=>array('LIKE', "%$search_string%")
575 575
 					);
576 576
 			}
577 577
 		}
@@ -619,13 +619,13 @@  discard block
 block discarded – undo
619 619
 	 * @param bool|false $count
620 620
 	 * @return \EE_Soft_Delete_Base_Class[]|int
621 621
 	 */
622
-	public function get_questions( $per_page=10, $current_page = 1, $count = FALSE ) {
622
+	public function get_questions($per_page = 10, $current_page = 1, $count = FALSE) {
623 623
 		$QST = EEM_Question::instance();
624 624
 		$query_params = $this->get_query_params($QST, $per_page, $current_page);
625
-		if ($count){
626
-			$where = isset( $query_params[0] ) ? array( $query_params[0] ) : array();
625
+		if ($count) {
626
+			$where = isset($query_params[0]) ? array($query_params[0]) : array();
627 627
 			$results = $QST->count($where);
628
-		}else{
628
+		} else {
629 629
 			$results = $QST->get_all($query_params);
630 630
 		}
631 631
 		return $results;
@@ -640,10 +640,10 @@  discard block
 block discarded – undo
640 640
 	 * @param bool|false $count
641 641
 	 * @return \EE_Soft_Delete_Base_Class[]|int
642 642
 	 */
643
-	public function get_trashed_questions( $per_page, $current_page = 1, $count = FALSE ) {
644
-		$query_params =$this->get_query_params( EEM_Question::instance(), $per_page, $current_page);
645
-		$where        = isset( $query_params[0] ) ? array($query_params[0]) : array();
646
-		$questions    =$count ? EEM_Question::instance()->count_deleted($where) : EEM_Question::instance()->get_all_deleted($query_params);
643
+	public function get_trashed_questions($per_page, $current_page = 1, $count = FALSE) {
644
+		$query_params = $this->get_query_params(EEM_Question::instance(), $per_page, $current_page);
645
+		$where        = isset($query_params[0]) ? array($query_params[0]) : array();
646
+		$questions    = $count ? EEM_Question::instance()->count_deleted($where) : EEM_Question::instance()->get_all_deleted($query_params);
647 647
 		return $questions;
648 648
 	}
649 649
 
@@ -655,12 +655,12 @@  discard block
 block discarded – undo
655 655
 	 * @param bool|false $count
656 656
 	 * @return \EE_Soft_Delete_Base_Class[]
657 657
 	 */
658
-	public function get_question_groups( $per_page, $current_page = 1, $count = FALSE ) {
658
+	public function get_question_groups($per_page, $current_page = 1, $count = FALSE) {
659 659
 		/** @type EEM_Question_Group $questionGroupModel */
660 660
 		$questionGroupModel = EEM_Question_Group::instance();
661 661
 		//note: this a subclass of EEM_Soft_Delete_Base, so this is actually only getting non-trashed items
662 662
 		return $questionGroupModel->get_all(
663
-			$this->get_query_params( $questionGroupModel, $per_page, $current_page )
663
+			$this->get_query_params($questionGroupModel, $per_page, $current_page)
664 664
 		);
665 665
 	}
666 666
 
@@ -677,36 +677,36 @@  discard block
 block discarded – undo
677 677
 
678 678
 		$this->_template_args['values'] = $this->_yes_no_values;
679 679
 
680
-		$this->_template_args['use_captcha'] = isset( EE_Registry::instance()->CFG->registration->use_captcha ) ? EE_Registry::instance()->CFG->registration->use_captcha : FALSE;
681
-		$this->_template_args['show_captcha_settings'] = $this->_template_args['use_captcha'] ? 'style="display:table-row;"': '';
680
+		$this->_template_args['use_captcha'] = isset(EE_Registry::instance()->CFG->registration->use_captcha) ? EE_Registry::instance()->CFG->registration->use_captcha : FALSE;
681
+		$this->_template_args['show_captcha_settings'] = $this->_template_args['use_captcha'] ? 'style="display:table-row;"' : '';
682 682
 
683
-		$this->_template_args['recaptcha_publickey'] = isset( EE_Registry::instance()->CFG->registration->recaptcha_publickey ) ? stripslashes( EE_Registry::instance()->CFG->registration->recaptcha_publickey ) : '';
684
-		$this->_template_args['recaptcha_privatekey'] = isset( EE_Registry::instance()->CFG->registration->recaptcha_privatekey ) ? stripslashes( EE_Registry::instance()->CFG->registration->recaptcha_privatekey ) : '';
685
-		$this->_template_args['recaptcha_width'] = isset( EE_Registry::instance()->CFG->registration->recaptcha_width ) ? absint( EE_Registry::instance()->CFG->registration->recaptcha_width ) : 500;
683
+		$this->_template_args['recaptcha_publickey'] = isset(EE_Registry::instance()->CFG->registration->recaptcha_publickey) ? stripslashes(EE_Registry::instance()->CFG->registration->recaptcha_publickey) : '';
684
+		$this->_template_args['recaptcha_privatekey'] = isset(EE_Registry::instance()->CFG->registration->recaptcha_privatekey) ? stripslashes(EE_Registry::instance()->CFG->registration->recaptcha_privatekey) : '';
685
+		$this->_template_args['recaptcha_width'] = isset(EE_Registry::instance()->CFG->registration->recaptcha_width) ? absint(EE_Registry::instance()->CFG->registration->recaptcha_width) : 500;
686 686
 
687 687
 		$this->_template_args['recaptcha_theme_options'] = array(
688
-				array('id'  => 'red','text'=> esc_html__('Red', 'event_espresso')),
689
-				array('id'  => 'white','text'=> esc_html__('White', 'event_espresso')),
690
-				array('id'  => 'blackglass','text'=> esc_html__('Blackglass', 'event_espresso')),
691
-				array('id'  => 'clean','text'=> esc_html__('Clean', 'event_espresso'))
688
+				array('id'  => 'red', 'text'=> esc_html__('Red', 'event_espresso')),
689
+				array('id'  => 'white', 'text'=> esc_html__('White', 'event_espresso')),
690
+				array('id'  => 'blackglass', 'text'=> esc_html__('Blackglass', 'event_espresso')),
691
+				array('id'  => 'clean', 'text'=> esc_html__('Clean', 'event_espresso'))
692 692
 			);
693
-		$this->_template_args['recaptcha_theme'] = isset( EE_Registry::instance()->CFG->registration->recaptcha_theme ) ? EE_Registry::instance()->CFG->registration->get_pretty( 'recaptcha_theme' ) : 'clean';
693
+		$this->_template_args['recaptcha_theme'] = isset(EE_Registry::instance()->CFG->registration->recaptcha_theme) ? EE_Registry::instance()->CFG->registration->get_pretty('recaptcha_theme') : 'clean';
694 694
 
695 695
 		$this->_template_args['recaptcha_language_options'] = array(
696
-				array('id'  => 'en','text'=> esc_html__('English', 'event_espresso')),
697
-				array('id'  => 'es','text'=> esc_html__('Spanish', 'event_espresso')),
698
-				array('id'  => 'nl','text'=> esc_html__('Dutch', 'event_espresso')),
699
-				array('id'  => 'fr','text'=> esc_html__('French', 'event_espresso')),
700
-				array('id'  => 'de','text'=> esc_html__('German', 'event_espresso')),
701
-				array('id'  => 'pt','text'=> esc_html__('Portuguese', 'event_espresso')),
702
-				array('id'  => 'ru','text'=> esc_html__('Russian', 'event_espresso')),
703
-				array('id'  => 'tr','text'=> esc_html__('Turkish', 'event_espresso'))
696
+				array('id'  => 'en', 'text'=> esc_html__('English', 'event_espresso')),
697
+				array('id'  => 'es', 'text'=> esc_html__('Spanish', 'event_espresso')),
698
+				array('id'  => 'nl', 'text'=> esc_html__('Dutch', 'event_espresso')),
699
+				array('id'  => 'fr', 'text'=> esc_html__('French', 'event_espresso')),
700
+				array('id'  => 'de', 'text'=> esc_html__('German', 'event_espresso')),
701
+				array('id'  => 'pt', 'text'=> esc_html__('Portuguese', 'event_espresso')),
702
+				array('id'  => 'ru', 'text'=> esc_html__('Russian', 'event_espresso')),
703
+				array('id'  => 'tr', 'text'=> esc_html__('Turkish', 'event_espresso'))
704 704
 			);
705
-		$this->_template_args['recaptcha_language'] = isset( EE_Registry::instance()->CFG->registration->recaptcha_language ) ? EE_Registry::instance()->CFG->registration->recaptcha_language : 'en';
705
+		$this->_template_args['recaptcha_language'] = isset(EE_Registry::instance()->CFG->registration->recaptcha_language) ? EE_Registry::instance()->CFG->registration->recaptcha_language : 'en';
706 706
 
707
-		$this->_set_add_edit_form_tags( 'update_reg_form_settings' );
708
-		$this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE );
709
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( REGISTRATION_FORM_TEMPLATE_PATH . 'reg_form_settings.template.php', $this->_template_args, TRUE );
707
+		$this->_set_add_edit_form_tags('update_reg_form_settings');
708
+		$this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE);
709
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template(REGISTRATION_FORM_TEMPLATE_PATH.'reg_form_settings.template.php', $this->_template_args, TRUE);
710 710
 		$this->display_admin_page_with_sidebar();
711 711
 	}
712 712
 
Please login to merge, or discard this patch.
registration_form/templates/questions_main_meta_box.template.php 1 patch
Spacing   +54 added lines, -54 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 		<tbody>
22 22
 			<tr>
23 23
 				<th>
24
-					<label for="QST_display_text"><?php echo $fields['QST_display_text']->get_nicename();?></label> <?php echo EEH_Template::get_help_tab_link('question_text_info');?>
24
+					<label for="QST_display_text"><?php echo $fields['QST_display_text']->get_nicename(); ?></label> <?php echo EEH_Template::get_help_tab_link('question_text_info'); ?>
25 25
 				</th>
26 26
 				<td>
27 27
 					<input type="text" class="regular-text" id="QST_display_text" name="QST_display_text" value="<?php $question->f('QST_display_text')?>"/>
@@ -31,23 +31,23 @@  discard block
 block discarded – undo
31 31
 
32 32
 			<tr>
33 33
 				<th>
34
-					<label for="QST_admin_label"><?php echo $fields['QST_admin_label']->get_nicename();?></label> <?php echo EEH_Template::get_help_tab_link('question_label_info');?>
34
+					<label for="QST_admin_label"><?php echo $fields['QST_admin_label']->get_nicename(); ?></label> <?php echo EEH_Template::get_help_tab_link('question_label_info'); ?>
35 35
 				</th>
36 36
 				<td>
37 37
 					<?php
38
-						$disabled = ! empty( $QST_system ) ? ' disabled="disabled"' : '';
39
-						$id =  ! empty( $QST_system ) ? '_disabled' : '';
38
+						$disabled = ! empty($QST_system) ? ' disabled="disabled"' : '';
39
+						$id = ! empty($QST_system) ? '_disabled' : '';
40 40
 					?>
41 41
 					<input type="text" class="regular-text" id="QST_admin_label<?php echo $id?>" name="QST_admin_label<?php echo $id?>" value="<?php $question->f('QST_admin_label')?>"<?php echo $disabled?>/>
42 42
 					<input class="QST_order" type="hidden" id="QST_order<?php echo $id; ?>" name = "QST_order<?php echo $id; ?>" value="<?php echo $question->get('QST_order'); ?>" />
43
-					<?php if ( ! empty( $QST_system )) { ?>
43
+					<?php if ( ! empty($QST_system)) { ?>
44 44
 						<input type="hidden"  id="QST_admin_label" name="QST_admin_label" value="<?php echo $question->admin_label()?>"/>
45 45
 					<?php } ?>
46 46
 					<br/>
47 47
 					<p class="description">
48
-					<?php if ( ! empty( $QST_system )) { ?>
48
+					<?php if ( ! empty($QST_system)) { ?>
49 49
 					<span class="description" style="color:#D54E21;">
50
-						<?php esc_html_e('System question! This field cannot be changed.','event_espresso')?>
50
+						<?php esc_html_e('System question! This field cannot be changed.', 'event_espresso')?>
51 51
 					</span>
52 52
 					<?php } ?>
53 53
 
@@ -57,21 +57,21 @@  discard block
 block discarded – undo
57 57
 
58 58
 			<tr>
59 59
 				<th>
60
-					<label for="QST_admin_only"><?php echo $fields['QST_admin_only']->get_nicename();?></label> <?php echo EEH_Template::get_help_tab_link('question_admin_only_info');?>
60
+					<label for="QST_admin_only"><?php echo $fields['QST_admin_only']->get_nicename(); ?></label> <?php echo EEH_Template::get_help_tab_link('question_admin_only_info'); ?>
61 61
 				</th>
62 62
 				<td>
63 63
 					<?php
64
-						$disabled = ! empty( $QST_system ) ? ' disabled="disabled"' : '';
65
-						$id =  ! empty( $QST_system ) ? '_disabled' : '';
64
+						$disabled = ! empty($QST_system) ? ' disabled="disabled"' : '';
65
+						$id = ! empty($QST_system) ? '_disabled' : '';
66 66
 						$admin_only = $question->get('QST_admin_only');
67
-						$checked = !empty( $admin_only ) ? ' checked="checked"' : '';
67
+						$checked = ! empty($admin_only) ? ' checked="checked"' : '';
68 68
 					?>
69 69
 					<input class="QST_admin_only" type="checkbox" id="QST_admin_only<?php echo $id; ?>" name = "QST_admin_only<?php echo $id; ?>" value="1"<?php echo $disabled; echo $checked; ?>/>
70 70
 					<br/>
71 71
 					<p class="description">
72
-					<?php if ( ! empty( $QST_system )) { ?>
72
+					<?php if ( ! empty($QST_system)) { ?>
73 73
 					<span class="description" style="color:#D54E21;">
74
-						<?php esc_html_e('System question! This field cannot be changed.','event_espresso')?>
74
+						<?php esc_html_e('System question! This field cannot be changed.', 'event_espresso')?>
75 75
 					</span>
76 76
 					<?php } ?>
77 77
 
@@ -81,21 +81,21 @@  discard block
 block discarded – undo
81 81
 
82 82
 			<tr>
83 83
 				<th>
84
-					<label for="QST_type"><?php echo $fields['QST_type']->get_nicename();?></label> <?php echo EEH_Template::get_help_tab_link('question_type_info');?>
84
+					<label for="QST_type"><?php echo $fields['QST_type']->get_nicename(); ?></label> <?php echo EEH_Template::get_help_tab_link('question_type_info'); ?>
85 85
 				</th>
86 86
 				<td>
87 87
 					<?php
88
-						$disabled = ! empty( $QST_system ) ? ' disabled="disabled"' : '';
89
-						$id =  ! empty( $QST_system ) ? '_disabled' : '';
90
-						echo EEH_Form_Fields::select_input( 'QST_type' . $id, $question_types, $question->type(), 'id="QST_type' . $id . '"' . $disabled );
91
-						if( ! empty( $QST_system ) ) { ?>
88
+						$disabled = ! empty($QST_system) ? ' disabled="disabled"' : '';
89
+						$id = ! empty($QST_system) ? '_disabled' : '';
90
+						echo EEH_Form_Fields::select_input('QST_type'.$id, $question_types, $question->type(), 'id="QST_type'.$id.'"'.$disabled);
91
+						if ( ! empty($QST_system)) { ?>
92 92
 							<input type="hidden"  id="QST_type" name="QST_type" value="<?php echo $question->type()?>"/>
93 93
 						<?php
94
-							$explanatory_text = esc_html__('System question! This field cannot be changed.','event_espresso');
95
-						}else{
96
-							$explanatory_text = esc_html__('Because there are currently answers for this question in the database, your options to change the question type have been limited to similar question-types.','event_espresso');
94
+							$explanatory_text = esc_html__('System question! This field cannot be changed.', 'event_espresso');
95
+						} else {
96
+							$explanatory_text = esc_html__('Because there are currently answers for this question in the database, your options to change the question type have been limited to similar question-types.', 'event_espresso');
97 97
 						}
98
-						if ( ! empty( $QST_system ) || $has_answers ) { ?>
98
+						if ( ! empty($QST_system) || $has_answers) { ?>
99 99
 							<p><span class="description" style="color:#D54E21;">
100 100
 								<?php echo $explanatory_text; ?>
101 101
 							</span></p>
@@ -108,22 +108,22 @@  discard block
 block discarded – undo
108 108
 			<tr id="text_input_question_options">
109 109
 				<th>
110 110
 					<label>
111
-						<?php esc_html_e( 'Maximum Allowed Response Size', 'event_espresso' );?>
111
+						<?php esc_html_e('Maximum Allowed Response Size', 'event_espresso'); ?>
112 112
 					</label>
113 113
 				</th>
114 114
 				<td>
115
-					<input id="QST_max" name="QST_max" type="number" <?php echo $max_max === EE_INF ? '' : "max='$max_max'";?> value="<?php $question->f( 'QST_max' );?>" min="1">
115
+					<input id="QST_max" name="QST_max" type="number" <?php echo $max_max === EE_INF ? '' : "max='$max_max'"; ?> value="<?php $question->f('QST_max'); ?>" min="1">
116 116
 					<p>
117 117
 						<span class="description">
118
-							<?php esc_html_e( 'Maximum number of characters allowed when answering this question', 'event_espresso' );?>
118
+							<?php esc_html_e('Maximum number of characters allowed when answering this question', 'event_espresso'); ?>
119 119
 						</span>
120 120
 					</p>
121
-					<?php if ( $QST_system ) { ?>
121
+					<?php if ($QST_system) { ?>
122 122
 					<p>
123 123
 						<span class="description" style="color:#D54E21;">
124 124
 							<?php printf(
125
-									esc_html__( 'System question! The maximum number of characters that can be used for this question is %1$s', 'event_espresso' ),
126
-									$max_max );?>
125
+									esc_html__('System question! The maximum number of characters that can be used for this question is %1$s', 'event_espresso'),
126
+									$max_max ); ?>
127 127
 						</span>
128 128
 					</p>
129 129
 					<?php } ?>
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 			<tr id="question_options">
133 133
 				<th>
134 134
 					<label>
135
-						<?php esc_html_e('Answer Options','event_espresso')?>
135
+						<?php esc_html_e('Answer Options', 'event_espresso')?>
136 136
 					</label>
137 137
 				</th>
138 138
 				<td>
@@ -141,10 +141,10 @@  discard block
 block discarded – undo
141 141
 						<thead>
142 142
 							<tr>
143 143
 								<th class="option-value-header">
144
-									<?php esc_html_e('Value','event_espresso')?>
144
+									<?php esc_html_e('Value', 'event_espresso')?>
145 145
 								</th>
146 146
 								<th class="option-desc-header">
147
-									<?php esc_html_e('Description (optional, only shown on registration form)','event_espresso')?>
147
+									<?php esc_html_e('Description (optional, only shown on registration form)', 'event_espresso')?>
148 148
 								</th>
149 149
 								<th>
150 150
 								</th>
@@ -167,17 +167,17 @@  discard block
 block discarded – undo
167 167
 							</tr>
168 168
 
169 169
 							<?php
170
-							$count=0;
170
+							$count = 0;
171 171
 							$question_options = $question->options();
172
-							if ( ! empty( $question_options )) {
173
-								foreach( $question_options as $option_id => $option ) {
174
-									$disabled =  $has_answers || $option->get('QSO_system') ? ' disabled="disabled"'  : '';
172
+							if ( ! empty($question_options)) {
173
+								foreach ($question_options as $option_id => $option) {
174
+									$disabled = $has_answers || $option->get('QSO_system') ? ' disabled="disabled"' : '';
175 175
 							?>
176 176
 								<tr class="question-option ee-options-sortable">
177 177
 									<td class="option-value-cell">
178 178
 										<input type="hidden" class="QSO_order" name="question_options[<?php echo $count; ?>][QSO_order]" value="<?php echo $count; ?>">
179 179
 										<input type="text" class="option-value regular-text" name="question_options[<?php echo $count?>][QSO_value]" value="<?php  $option->f('QSO_value')?>"<?php echo $disabled; ?>>
180
-										<?php if ( $has_answers ) : ?>
180
+										<?php if ($has_answers) : ?>
181 181
 											<input type="hidden" name="question_options[<?php echo $count; ?>][QSO_value]" value="<?php echo $option->f('QSO_value'); ?>" >
182 182
 										<?php endif; ?>
183 183
 									</td>
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
 										<input type="text" class="option-desc regular-text" name="question_options[<?php echo $count?>][QSO_desc]" value="<?php $option->f('QSO_desc')?>">
186 186
 									</td>
187 187
 									<td>
188
-										<?php if ( ! $option->system() ) { ?>
188
+										<?php if ( ! $option->system()) { ?>
189 189
 											<span class="dashicons clickable dashicons-post-trash ee-icon-size-18 remove-option remove-item"></span>
190 190
 										<?php } ?>
191 191
 										<span class="dashicons dashicons-image-flip-vertical sortable-drag-handle ee-icon-size-18"></span>
@@ -224,13 +224,13 @@  discard block
 block discarded – undo
224 224
 					</table>
225 225
 
226 226
 					<a id="new-question-option" class="button" style="margin:0 0 1em 3px;">
227
-						<?php esc_html_e('Add Another Answer Option','event_espresso')?>
227
+						<?php esc_html_e('Add Another Answer Option', 'event_espresso')?>
228 228
 					</a><br/>
229 229
 
230 230
 					<p class="description">
231
-						<?php esc_html_e('Answer Options are the choices that you give people to select from for RADIO_BTN, CHECKBOX or DROPDOWN questions. The Value is a simple key that will be saved to the database and the description is optional. Note that values CANNOT contain any HTML, but descriptions can.','event_espresso')?>
231
+						<?php esc_html_e('Answer Options are the choices that you give people to select from for RADIO_BTN, CHECKBOX or DROPDOWN questions. The Value is a simple key that will be saved to the database and the description is optional. Note that values CANNOT contain any HTML, but descriptions can.', 'event_espresso')?>
232 232
 					</p>
233
-					<?php if ( $has_answers ) : ?>
233
+					<?php if ($has_answers) : ?>
234 234
 					<p class="description" style="color:#D54E21;">
235 235
 							<?php esc_html_e('Answer values that are uneditable are this way because there are registrations in the database that have answers for this question.  If you need to correct a mistake, or edit an existing option value, then trash the existing one and create a new option with the changes.  This will ensure that the existing registrations that chose the original answer will preserve that answer.', 'event_espresso'); ?>
236 236
 					</p>
@@ -241,32 +241,32 @@  discard block
 block discarded – undo
241 241
 
242 242
 			<tr>
243 243
 				<th>
244
-					<label for="QST_required"><?php echo $fields['QST_required']->get_nicename();?></label> <?php echo EEH_Template::get_help_tab_link('required_question_info');?>
244
+					<label for="QST_required"><?php echo $fields['QST_required']->get_nicename(); ?></label> <?php echo EEH_Template::get_help_tab_link('required_question_info'); ?>
245 245
 				</th>
246 246
 				<td>
247 247
 					<?php
248
-					$system_required = array( 'fname', 'email' );
249
-					$disabled = in_array( $QST_system, $system_required ) ? ' disabled="disabled"' : '';
248
+					$system_required = array('fname', 'email');
249
+					$disabled = in_array($QST_system, $system_required) ? ' disabled="disabled"' : '';
250 250
 					$required_on = $question->get('QST_admin_only');
251 251
 					$show_required_msg = $required_on ? '' : ' display:none;';
252
-					$disabled = $required_on || ! empty( $disabled ) ? ' disabled="disabled"' : '';
253
-					$id =  ! empty( $disabled ) && in_array( $QST_system, $system_required) ? '_disabled' : '';
254
-					$requiredOptions=array(
255
-						array( 'text'=> esc_html__( 'Optional', 'event_espresso' ), 'id'=>0 ),
256
-						array( 'text'=> esc_html__( 'Required', 'event_espresso' ), 'id'=>1 )
252
+					$disabled = $required_on || ! empty($disabled) ? ' disabled="disabled"' : '';
253
+					$id = ! empty($disabled) && in_array($QST_system, $system_required) ? '_disabled' : '';
254
+					$requiredOptions = array(
255
+						array('text'=> esc_html__('Optional', 'event_espresso'), 'id'=>0),
256
+						array('text'=> esc_html__('Required', 'event_espresso'), 'id'=>1)
257 257
 					);
258
-					echo EEH_Form_Fields::select_input('QST_required' . $id, $requiredOptions, $question->required(), 'id="QST_required' . $id . '"' . $disabled );
258
+					echo EEH_Form_Fields::select_input('QST_required'.$id, $requiredOptions, $question->required(), 'id="QST_required'.$id.'"'.$disabled);
259 259
 					?>
260 260
 						<p><span id="required_toggled_on" class="description" style="color:#D54E21;<?php echo $show_required_msg; ?>">
261
-						<?php esc_html_e('Required is set to optional, and this field is disabled, because the question is Admin-Only.','event_espresso')?>
261
+						<?php esc_html_e('Required is set to optional, and this field is disabled, because the question is Admin-Only.', 'event_espresso')?>
262 262
 						</span></p>
263 263
 						<p><span id="required_toggled_off" class="description" style="color:#D54E21; display: none;">
264
-							<?php esc_html_e('Required option field is no longer disabled because the question is not Admin-Only','event_espresso')?>
264
+							<?php esc_html_e('Required option field is no longer disabled because the question is not Admin-Only', 'event_espresso')?>
265 265
 						</span></p>
266
-					<?php if ( ! empty( $disabled ) && in_array( $QST_system, $system_required ) ) { ?>
266
+					<?php if ( ! empty($disabled) && in_array($QST_system, $system_required)) { ?>
267 267
 						<input type="hidden"  id="QST_required" name="QST_required" value="1"/>
268 268
 						<p><span class="description" style="color:#D54E21;">
269
-						<?php esc_html_e('System question! This field cannot be changed.','event_espresso')?>
269
+						<?php esc_html_e('System question! This field cannot be changed.', 'event_espresso')?>
270 270
 					</span></p>
271 271
 					<?php } ?>
272 272
 
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
 
276 276
 			<tr>
277 277
 				<th>
278
-					<label for="QST_required_text"><?php esc_html_e('Required Text', 'event_espresso'); ?></label> <?php echo EEH_Template::get_help_tab_link('required_text_info');?>
278
+					<label for="QST_required_text"><?php esc_html_e('Required Text', 'event_espresso'); ?></label> <?php echo EEH_Template::get_help_tab_link('required_text_info'); ?>
279 279
 				</th>
280 280
 				<td>
281 281
 					<input type="text" maxlength="100" class="regular-text" id="QST_required_text" name="QST_required_text" value="<?php  $question->f('QST_required_text')?>"/>
Please login to merge, or discard this patch.
admin_pages/transactions/Transactions_Admin_Page.core.php 2 patches
Indentation   +59 added lines, -59 removed lines patch added patch discarded remove patch
@@ -106,9 +106,9 @@  discard block
 block discarded – undo
106 106
 
107 107
 	/**
108 108
 	 * 		grab url requests and route them
109
-	*		@access private
110
-	*		@return void
111
-	*/
109
+	 *		@access private
110
+	 *		@return void
111
+	 */
112 112
 	public function _set_page_routes() {
113 113
 
114 114
 		$this->_set_transaction_status_array();
@@ -263,10 +263,10 @@  discard block
 block discarded – undo
263 263
 	/**
264 264
 	 * _set_transaction_status_array
265 265
 	 * sets list of transaction statuses
266
-	*
266
+	 *
267 267
 	 * @access private
268
-	*	@return void
269
-	*/
268
+	 *	@return void
269
+	 */
270 270
 	private function _set_transaction_status_array() {
271 271
 		self::$_txn_status = EEM_Transaction::instance()->status_array(TRUE);
272 272
 	}
@@ -288,10 +288,10 @@  discard block
 block discarded – undo
288 288
 
289 289
 	/**
290 290
 	 * 	get list of payment statuses
291
-	*
291
+	 *
292 292
 	 * @access private
293
-	*	@return void
294
-	*/
293
+	 *	@return void
294
+	 */
295 295
 	private function _get_payment_status_array() {
296 296
 		self::$_pay_status = EEM_Payment::instance()->status_array(TRUE);
297 297
 		$this->_template_args['payment_status'] = self::$_pay_status;
@@ -399,18 +399,18 @@  discard block
 block discarded – undo
399 399
 		if ( is_object( $this->_transaction) )
400 400
 			return; //get out we've already set the object
401 401
 
402
-	    $TXN = EEM_Transaction::instance();
402
+		$TXN = EEM_Transaction::instance();
403 403
 
404
-	    $TXN_ID = ( ! empty( $this->_req_data['TXN_ID'] )) ? absint( $this->_req_data['TXN_ID'] ) : FALSE;
404
+		$TXN_ID = ( ! empty( $this->_req_data['TXN_ID'] )) ? absint( $this->_req_data['TXN_ID'] ) : FALSE;
405 405
 
406
-	    //get transaction object
407
-	    $this->_transaction = $TXN->get_one_by_ID($TXN_ID);
408
-	    $this->_session = !empty( $this->_transaction ) ? $this->_transaction->get('TXN_session_data') : NULL;
406
+		//get transaction object
407
+		$this->_transaction = $TXN->get_one_by_ID($TXN_ID);
408
+		$this->_session = !empty( $this->_transaction ) ? $this->_transaction->get('TXN_session_data') : NULL;
409 409
 
410 410
 	 	if ( empty( $this->_transaction ) ) {
411
-	    	$error_msg = esc_html__('An error occurred and the details for Transaction ID #', 'event_espresso') . $TXN_ID .  esc_html__(' could not be retrieved.', 'event_espresso');
411
+			$error_msg = esc_html__('An error occurred and the details for Transaction ID #', 'event_espresso') . $TXN_ID .  esc_html__(' could not be retrieved.', 'event_espresso');
412 412
 			EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ );
413
-	    }
413
+		}
414 414
 	}
415 415
 
416 416
 
@@ -525,12 +525,12 @@  discard block
 block discarded – undo
525 525
 
526 526
 
527 527
 	/**
528
-	* 	_transaction_details
528
+	 * 	_transaction_details
529 529
 	 * generates HTML for the View Transaction Details Admin page
530
-	*
530
+	 *
531 531
 	 * @access protected
532
-	*	@return void
533
-	*/
532
+	 *	@return void
533
+	 */
534 534
 	protected function _transaction_details() {
535 535
 		do_action( 'AHEE__Transactions_Admin_Page__transaction_details__start', $this->_transaction );
536 536
 
@@ -581,7 +581,7 @@  discard block
 block discarded – undo
581 581
 						'button secondary-button right',
582 582
 						'dashicons dashicons-email-alt'
583 583
 					)
584
-				    : '';
584
+					: '';
585 585
 		} else {
586 586
 			$this->_template_args['send_payment_reminder_button'] = '';
587 587
 		}
@@ -735,10 +735,10 @@  discard block
 block discarded – undo
735 735
 	/**
736 736
 	 * txn_details_meta_box
737 737
 	 * generates HTML for the Transaction main meta box
738
-	*
738
+	 *
739 739
 	 * @access public
740
-	*	@return void
741
-	*/
740
+	 *	@return void
741
+	 */
742 742
 	public function txn_details_meta_box() {
743 743
 
744 744
 		$this->_set_transaction_object();
@@ -1078,10 +1078,10 @@  discard block
 block discarded – undo
1078 1078
 	/**
1079 1079
 	 * txn_billing_info_side_meta_box
1080 1080
 	 * 	generates HTML for the Edit Transaction side meta box
1081
-	*
1081
+	 *
1082 1082
 	 * @access public
1083
-	*	@return void
1084
-	*/
1083
+	 *	@return void
1084
+	 */
1085 1085
 	public function txn_billing_info_side_meta_box() {
1086 1086
 
1087 1087
 		$this->_template_args['billing_form'] = $this->_transaction->billing_info();
@@ -1099,10 +1099,10 @@  discard block
 block discarded – undo
1099 1099
 	/**
1100 1100
 	 * apply_payments_or_refunds
1101 1101
 	 * 	registers a payment or refund made towards a transaction
1102
-	*
1102
+	 *
1103 1103
 	 * @access public
1104
-	*	@return void
1105
-	*/
1104
+	 *	@return void
1105
+	 */
1106 1106
 	public function apply_payments_or_refunds() {
1107 1107
 		$json_response_data = array( 'return_data' => FALSE );
1108 1108
 		$valid_data = $this->_validate_payment_request_data();
@@ -1256,9 +1256,9 @@  discard block
 block discarded – undo
1256 1256
 							'default' => '',
1257 1257
 							'required' => false,
1258 1258
 							'html_label_text' => esc_html__( 'Transaction or Cheque Number', 'event_espresso' ),
1259
-                                                        'validation_strategies' => array(
1260
-                                                            new EE_Max_Length_Validation_Strategy( esc_html__('Input too long', 'event_espresso'), 100 ),
1261
-                                                        )
1259
+														'validation_strategies' => array(
1260
+															new EE_Max_Length_Validation_Strategy( esc_html__('Input too long', 'event_espresso'), 100 ),
1261
+														)
1262 1262
 						)
1263 1263
 					),
1264 1264
 					'po_number' => new EE_Text_Input(
@@ -1266,9 +1266,9 @@  discard block
 block discarded – undo
1266 1266
 							'default' => '',
1267 1267
 							'required' => false,
1268 1268
 							'html_label_text' => esc_html__( 'Purchase Order Number', 'event_espresso' ),
1269
-                                                        'validation_strategies' => array(
1270
-                                                            new EE_Max_Length_Validation_Strategy( esc_html__('Input too long', 'event_espresso'), 100 ),
1271
-                                                        )
1269
+														'validation_strategies' => array(
1270
+															new EE_Max_Length_Validation_Strategy( esc_html__('Input too long', 'event_espresso'), 100 ),
1271
+														)
1272 1272
 						)
1273 1273
 					),
1274 1274
 					'accounting' => new EE_Text_Input(
@@ -1276,9 +1276,9 @@  discard block
 block discarded – undo
1276 1276
 							'default' => '',
1277 1277
 							'required' => false,
1278 1278
 							'html_label_text' => esc_html__( 'Extra Field for Accounting', 'event_espresso' ),
1279
-                                                        'validation_strategies' => array(
1280
-                                                            new EE_Max_Length_Validation_Strategy( esc_html__('Input too long', 'event_espresso'), 100 ),
1281
-                                                        )
1279
+														'validation_strategies' => array(
1280
+															new EE_Max_Length_Validation_Strategy( esc_html__('Input too long', 'event_espresso'), 100 ),
1281
+														)
1282 1282
 						)
1283 1283
 					),
1284 1284
 				)
@@ -1573,10 +1573,10 @@  discard block
 block discarded – undo
1573 1573
 	/**
1574 1574
 	 * delete_payment
1575 1575
 	 * 	delete a payment or refund made towards a transaction
1576
-	*
1576
+	 *
1577 1577
 	 * @access public
1578
-	*	@return void
1579
-	*/
1578
+	 *	@return void
1579
+	 */
1580 1580
 	public function delete_payment() {
1581 1581
 		$json_response_data = array( 'return_data' => FALSE );
1582 1582
 		$PAY_ID = isset( $this->_req_data['delete_txn_admin_payment'], $this->_req_data['delete_txn_admin_payment']['PAY_ID'] ) ? absint( $this->_req_data['delete_txn_admin_payment']['PAY_ID'] ) : 0;
@@ -1693,12 +1693,12 @@  discard block
 block discarded – undo
1693 1693
 	/**
1694 1694
 	 * _send_payment_reminder
1695 1695
 	 * 	generates HTML for the View Transaction Details Admin page
1696
-	*
1696
+	 *
1697 1697
 	 * @access protected
1698
-	*	@return void
1699
-	*/
1698
+	 *	@return void
1699
+	 */
1700 1700
 	protected function _send_payment_reminder() {
1701
-	    $TXN_ID = ( ! empty( $this->_req_data['TXN_ID'] )) ? absint( $this->_req_data['TXN_ID'] ) : FALSE;
1701
+		$TXN_ID = ( ! empty( $this->_req_data['TXN_ID'] )) ? absint( $this->_req_data['TXN_ID'] ) : FALSE;
1702 1702
 		$transaction = EEM_Transaction::instance()->get_one_by_ID( $TXN_ID );
1703 1703
 		$query_args = isset($this->_req_data['redirect_to'] ) ? array('action' => $this->_req_data['redirect_to'], 'TXN_ID' => $this->_req_data['TXN_ID'] ) : array();
1704 1704
 		do_action( 'AHEE__Transactions_Admin_Page___send_payment_reminder__process_admin_payment_reminder', $transaction );
@@ -1720,29 +1720,29 @@  discard block
 block discarded – undo
1720 1720
 
1721 1721
 		$TXN = EEM_Transaction::instance();
1722 1722
 
1723
-	    $start_date = isset( $this->_req_data['txn-filter-start-date'] ) ? wp_strip_all_tags( $this->_req_data['txn-filter-start-date'] ) : date( 'm/d/Y', strtotime( '-10 year' ));
1724
-	    $end_date = isset( $this->_req_data['txn-filter-end-date'] ) ? wp_strip_all_tags( $this->_req_data['txn-filter-end-date'] ) : date( 'm/d/Y' );
1723
+		$start_date = isset( $this->_req_data['txn-filter-start-date'] ) ? wp_strip_all_tags( $this->_req_data['txn-filter-start-date'] ) : date( 'm/d/Y', strtotime( '-10 year' ));
1724
+		$end_date = isset( $this->_req_data['txn-filter-end-date'] ) ? wp_strip_all_tags( $this->_req_data['txn-filter-end-date'] ) : date( 'm/d/Y' );
1725 1725
 
1726
-	    //make sure our timestamps start and end right at the boundaries for each day
1727
-	    $start_date = date( 'Y-m-d', strtotime( $start_date ) ) . ' 00:00:00';
1728
-	    $end_date = date( 'Y-m-d', strtotime( $end_date ) ) . ' 23:59:59';
1726
+		//make sure our timestamps start and end right at the boundaries for each day
1727
+		$start_date = date( 'Y-m-d', strtotime( $start_date ) ) . ' 00:00:00';
1728
+		$end_date = date( 'Y-m-d', strtotime( $end_date ) ) . ' 23:59:59';
1729 1729
 
1730 1730
 
1731
-	    //convert to timestamps
1732
-	    $start_date = strtotime( $start_date );
1733
-	    $end_date = strtotime( $end_date );
1731
+		//convert to timestamps
1732
+		$start_date = strtotime( $start_date );
1733
+		$end_date = strtotime( $end_date );
1734 1734
 
1735
-	    //makes sure start date is the lowest value and vice versa
1736
-	    $start_date = min( $start_date, $end_date );
1737
-	    $end_date = max( $start_date, $end_date );
1735
+		//makes sure start date is the lowest value and vice versa
1736
+		$start_date = min( $start_date, $end_date );
1737
+		$end_date = max( $start_date, $end_date );
1738 1738
 
1739
-	    //convert to correct format for query
1739
+		//convert to correct format for query
1740 1740
 	$start_date = EEM_Transaction::instance()->convert_datetime_for_query( 'TXN_timestamp', date( 'Y-m-d H:i:s', $start_date ), 'Y-m-d H:i:s' );
1741 1741
 	$end_date = EEM_Transaction::instance()->convert_datetime_for_query( 'TXN_timestamp', date( 'Y-m-d H:i:s', $end_date ), 'Y-m-d H:i:s' );
1742 1742
 
1743 1743
 
1744 1744
 
1745
-	    //set orderby
1745
+		//set orderby
1746 1746
 		$this->_req_data['orderby'] = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : '';
1747 1747
 
1748 1748
 		switch ( $this->_req_data['orderby'] ) {
Please login to merge, or discard this patch.
Spacing   +405 added lines, -405 removed lines patch added patch discarded remove patch
@@ -56,8 +56,8 @@  discard block
 block discarded – undo
56 56
 	 * @param bool $routing
57 57
 	 * @return Transactions_Admin_Page
58 58
 	 */
59
-	public function __construct( $routing = TRUE ) {
60
-		parent::__construct( $routing );
59
+	public function __construct($routing = TRUE) {
60
+		parent::__construct($routing);
61 61
 	}
62 62
 
63 63
 
@@ -80,9 +80,9 @@  discard block
 block discarded – undo
80 80
 	 * @return void
81 81
 	 */
82 82
 	protected function _ajax_hooks() {
83
-		add_action('wp_ajax_espresso_apply_payment', array( $this, 'apply_payments_or_refunds'));
84
-		add_action('wp_ajax_espresso_apply_refund', array( $this, 'apply_payments_or_refunds'));
85
-		add_action('wp_ajax_espresso_delete_payment', array( $this, 'delete_payment'));
83
+		add_action('wp_ajax_espresso_apply_payment', array($this, 'apply_payments_or_refunds'));
84
+		add_action('wp_ajax_espresso_apply_refund', array($this, 'apply_payments_or_refunds'));
85
+		add_action('wp_ajax_espresso_delete_payment', array($this, 'delete_payment'));
86 86
 	}
87 87
 
88 88
 
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 			'buttons' => array(
98 98
 				'add' => esc_html__('Add New Transaction', 'event_espresso'),
99 99
 				'edit' => esc_html__('Edit Transaction', 'event_espresso'),
100
-				'delete' => esc_html__('Delete Transaction','event_espresso'),
100
+				'delete' => esc_html__('Delete Transaction', 'event_espresso'),
101 101
 			)
102 102
 		);
103 103
 	}
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 
114 114
 		$this->_set_transaction_status_array();
115 115
 
116
-		$txn_id = ! empty( $this->_req_data['TXN_ID'] ) && ! is_array( $this->_req_data['TXN_ID'] ) ? $this->_req_data['TXN_ID'] : 0;
116
+		$txn_id = ! empty($this->_req_data['TXN_ID']) && ! is_array($this->_req_data['TXN_ID']) ? $this->_req_data['TXN_ID'] : 0;
117 117
 
118 118
 		$this->_page_routes = array(
119 119
 
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
 						'filename' => 'transactions_overview_views_filters_search'
186 186
 					),
187 187
 				),
188
-				'help_tour' => array( 'Transactions_Overview_Help_Tour' ),
188
+				'help_tour' => array('Transactions_Overview_Help_Tour'),
189 189
 				/**
190 190
 				 * commented out because currently we are not displaying tips for transaction list table status but this
191 191
 				 * may change in a later iteration so want to keep the code for then.
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
 				'nav' => array(
198 198
 					'label' => esc_html__('View Transaction', 'event_espresso'),
199 199
 					'order' => 5,
200
-					'url' => isset($this->_req_data['TXN_ID']) ? add_query_arg(array('TXN_ID' => $this->_req_data['TXN_ID'] ), $this->_current_page_view_url )  : $this->_admin_base_url,
200
+					'url' => isset($this->_req_data['TXN_ID']) ? add_query_arg(array('TXN_ID' => $this->_req_data['TXN_ID']), $this->_current_page_view_url) : $this->_admin_base_url,
201 201
 					'persistent' => FALSE
202 202
 					),
203 203
 				'help_tabs' => array(
@@ -218,8 +218,8 @@  discard block
 block discarded – undo
218 218
 						'filename' => 'transactions_view_transaction_primary_registrant_billing_information'
219 219
 					),
220 220
 				),
221
-				'qtips' => array( 'Transaction_Details_Tips' ),
222
-				'help_tour' => array( 'Transaction_Details_Help_Tour' ),
221
+				'qtips' => array('Transaction_Details_Tips'),
222
+				'help_tour' => array('Transaction_Details_Help_Tour'),
223 223
 				'metaboxes' => array('_transaction_details_metaboxes'),
224 224
 
225 225
 				'require_nonce' => FALSE
@@ -237,23 +237,23 @@  discard block
 block discarded – undo
237 237
 		// IF a registration was JUST added via the admin...
238 238
 		if (
239 239
 		isset(
240
-			$this->_req_data[ 'redirect_from' ],
241
-			$this->_req_data[ 'EVT_ID' ],
242
-			$this->_req_data[ 'event_name' ]
240
+			$this->_req_data['redirect_from'],
241
+			$this->_req_data['EVT_ID'],
242
+			$this->_req_data['event_name']
243 243
 		)
244 244
 		) {
245 245
 			// then set a cookie so that we can block any attempts to use
246 246
 			// the back button as a way to enter another registration.
247
-			setcookie( 'ee_registration_added', $this->_req_data[ 'EVT_ID' ], time() + WEEK_IN_SECONDS, '/' );
247
+			setcookie('ee_registration_added', $this->_req_data['EVT_ID'], time() + WEEK_IN_SECONDS, '/');
248 248
 			// and update the global
249
-			$_COOKIE[ 'ee_registration_added' ] = $this->_req_data[ 'EVT_ID' ];
249
+			$_COOKIE['ee_registration_added'] = $this->_req_data['EVT_ID'];
250 250
 		}
251
-		EE_Registry::$i18n_js_strings[ 'invalid_server_response' ] = esc_html__( 'An error occurred! Your request may have been processed, but a valid response from the server was not received. Please refresh the page and try again.', 'event_espresso' );
252
-		EE_Registry::$i18n_js_strings[ 'error_occurred' ] = esc_html__( 'An error occurred! Please refresh the page and try again.', 'event_espresso' );
253
-		EE_Registry::$i18n_js_strings[ 'txn_status_array' ] = self::$_txn_status;
254
-		EE_Registry::$i18n_js_strings[ 'pay_status_array' ] = self::$_pay_status;
255
-		EE_Registry::$i18n_js_strings[ 'payments_total' ] = esc_html__( 'Payments Total', 'event_espresso' );
256
-		EE_Registry::$i18n_js_strings[ 'transaction_overpaid' ] = esc_html__( 'This transaction has been overpaid ! Payments Total', 'event_espresso' );
251
+		EE_Registry::$i18n_js_strings['invalid_server_response'] = esc_html__('An error occurred! Your request may have been processed, but a valid response from the server was not received. Please refresh the page and try again.', 'event_espresso');
252
+		EE_Registry::$i18n_js_strings['error_occurred'] = esc_html__('An error occurred! Please refresh the page and try again.', 'event_espresso');
253
+		EE_Registry::$i18n_js_strings['txn_status_array'] = self::$_txn_status;
254
+		EE_Registry::$i18n_js_strings['pay_status_array'] = self::$_pay_status;
255
+		EE_Registry::$i18n_js_strings['payments_total'] = esc_html__('Payments Total', 'event_espresso');
256
+		EE_Registry::$i18n_js_strings['transaction_overpaid'] = esc_html__('This transaction has been overpaid ! Payments Total', 'event_espresso');
257 257
 	}
258 258
 	public function admin_notices() {}
259 259
 	public function admin_footer_scripts() {}
@@ -320,14 +320,14 @@  discard block
 block discarded – undo
320 320
 	 */
321 321
 	public function load_scripts_styles() {
322 322
 		//enqueue style
323
-		wp_register_style( 'espresso_txn', TXN_ASSETS_URL . 'espresso_transactions_admin.css', array(), EVENT_ESPRESSO_VERSION );
323
+		wp_register_style('espresso_txn', TXN_ASSETS_URL.'espresso_transactions_admin.css', array(), EVENT_ESPRESSO_VERSION);
324 324
 		wp_enqueue_style('espresso_txn');
325 325
 
326 326
 		//scripts
327 327
 		add_filter('FHEE_load_accounting_js', '__return_true');
328 328
 
329 329
 		//scripts
330
-		wp_register_script('espresso_txn', TXN_ASSETS_URL . 'espresso_transactions_admin.js', array('ee_admin_js', 'ee-datepicker', 'jquery-ui-datepicker', 'jquery-ui-draggable', 'ee-dialog', 'ee-accounting', 'ee-serialize-full-array'), EVENT_ESPRESSO_VERSION, TRUE);
330
+		wp_register_script('espresso_txn', TXN_ASSETS_URL.'espresso_transactions_admin.js', array('ee_admin_js', 'ee-datepicker', 'jquery-ui-datepicker', 'jquery-ui-draggable', 'ee-dialog', 'ee-accounting', 'ee-serialize-full-array'), EVENT_ESPRESSO_VERSION, TRUE);
331 331
 		wp_enqueue_script('espresso_txn');
332 332
 
333 333
 	}
@@ -367,8 +367,8 @@  discard block
 block discarded – undo
367 367
 	 *	@return void
368 368
 	 */
369 369
 	protected function _set_list_table_views_default() {
370
-		$this->_views = array (
371
-			'all' => array (
370
+		$this->_views = array(
371
+			'all' => array(
372 372
 				'slug' 		=> 'all',
373 373
 				'label' 		=> esc_html__('View All Transactions', 'event_espresso'),
374 374
 				'count' 	=> 0
@@ -396,20 +396,20 @@  discard block
 block discarded – undo
396 396
 	 *	@return void
397 397
 	 */
398 398
 	private function _set_transaction_object() {
399
-		if ( is_object( $this->_transaction) )
399
+		if (is_object($this->_transaction))
400 400
 			return; //get out we've already set the object
401 401
 
402 402
 	    $TXN = EEM_Transaction::instance();
403 403
 
404
-	    $TXN_ID = ( ! empty( $this->_req_data['TXN_ID'] )) ? absint( $this->_req_data['TXN_ID'] ) : FALSE;
404
+	    $TXN_ID = ( ! empty($this->_req_data['TXN_ID'])) ? absint($this->_req_data['TXN_ID']) : FALSE;
405 405
 
406 406
 	    //get transaction object
407 407
 	    $this->_transaction = $TXN->get_one_by_ID($TXN_ID);
408
-	    $this->_session = !empty( $this->_transaction ) ? $this->_transaction->get('TXN_session_data') : NULL;
408
+	    $this->_session = ! empty($this->_transaction) ? $this->_transaction->get('TXN_session_data') : NULL;
409 409
 
410
-	 	if ( empty( $this->_transaction ) ) {
411
-	    	$error_msg = esc_html__('An error occurred and the details for Transaction ID #', 'event_espresso') . $TXN_ID .  esc_html__(' could not be retrieved.', 'event_espresso');
412
-			EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ );
410
+	 	if (empty($this->_transaction)) {
411
+	    	$error_msg = esc_html__('An error occurred and the details for Transaction ID #', 'event_espresso').$TXN_ID.esc_html__(' could not be retrieved.', 'event_espresso');
412
+			EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__);
413 413
 	    }
414 414
 	}
415 415
 
@@ -422,12 +422,12 @@  discard block
 block discarded – undo
422 422
 	 *	@return array
423 423
 	 */
424 424
 	protected function _transaction_legend_items() {
425
-		EE_Registry::instance()->load_helper( 'MSG_Template' );
425
+		EE_Registry::instance()->load_helper('MSG_Template');
426 426
 		$items = array();
427 427
 
428
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_global_messages', 'view_filtered_messages' ) ) {
429
-			$related_for_icon = EEH_MSG_Template::get_message_action_icon( 'see_notifications_for' );
430
-			if ( isset( $related_for_icon['css_class']) && isset( $related_for_icon['label'] ) ) {
428
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_global_messages', 'view_filtered_messages')) {
429
+			$related_for_icon = EEH_MSG_Template::get_message_action_icon('see_notifications_for');
430
+			if (isset($related_for_icon['css_class']) && isset($related_for_icon['label'])) {
431 431
 				$items['view_related_messages'] = array(
432 432
 					'class' => $related_for_icon['css_class'],
433 433
 					'desc' => $related_for_icon['label'],
@@ -437,7 +437,7 @@  discard block
 block discarded – undo
437 437
 
438 438
 		$items = apply_filters(
439 439
 			'FHEE__Transactions_Admin_Page___transaction_legend_items__items',
440
-			array_merge( $items,
440
+			array_merge($items,
441 441
 				array(
442 442
 					'view_details' => array(
443 443
 						'class' => 'dashicons dashicons-cart',
@@ -449,7 +449,7 @@  discard block
 block discarded – undo
449 449
 					),
450 450
 					'view_receipt' => array(
451 451
 						'class' => 'dashicons dashicons-media-default',
452
-						'desc' => esc_html__('View Transaction Receipt', 'event_espresso' )
452
+						'desc' => esc_html__('View Transaction Receipt', 'event_espresso')
453 453
 					),
454 454
 					'view_registration' => array(
455 455
 						'class' => 'dashicons dashicons-clipboard',
@@ -459,8 +459,8 @@  discard block
 block discarded – undo
459 459
 			)
460 460
 		);
461 461
 
462
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_transactions_send_payment_reminder' ) ) {
463
-			if ( EEH_MSG_Template::is_mt_active( 'payment_reminder' ) ) {
462
+		if (EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_transactions_send_payment_reminder')) {
463
+			if (EEH_MSG_Template::is_mt_active('payment_reminder')) {
464 464
 				$items['send_payment_reminder'] = array(
465 465
 					'class' => 'dashicons dashicons-email-alt',
466 466
 					'desc' => esc_html__('Send Payment Reminder', 'event_espresso')
@@ -481,29 +481,29 @@  discard block
 block discarded – undo
481 481
 			'FHEE__Transactions_Admin_Page___transaction_legend_items__more_items',
482 482
 			array(
483 483
 				'overpaid'   => array(
484
-					'class' => 'ee-status-legend ee-status-legend-' . EEM_Transaction::overpaid_status_code,
485
-					'desc'  => EEH_Template::pretty_status( EEM_Transaction::overpaid_status_code, FALSE, 'sentence' )
484
+					'class' => 'ee-status-legend ee-status-legend-'.EEM_Transaction::overpaid_status_code,
485
+					'desc'  => EEH_Template::pretty_status(EEM_Transaction::overpaid_status_code, FALSE, 'sentence')
486 486
 				),
487 487
 				'complete'   => array(
488
-					'class' => 'ee-status-legend ee-status-legend-' . EEM_Transaction::complete_status_code,
489
-					'desc'  => EEH_Template::pretty_status( EEM_Transaction::complete_status_code, FALSE, 'sentence' )
488
+					'class' => 'ee-status-legend ee-status-legend-'.EEM_Transaction::complete_status_code,
489
+					'desc'  => EEH_Template::pretty_status(EEM_Transaction::complete_status_code, FALSE, 'sentence')
490 490
 				),
491 491
 				'incomplete' => array(
492
-					'class' => 'ee-status-legend ee-status-legend-' . EEM_Transaction::incomplete_status_code,
493
-					'desc'  => EEH_Template::pretty_status( EEM_Transaction::incomplete_status_code, FALSE, 'sentence' )
492
+					'class' => 'ee-status-legend ee-status-legend-'.EEM_Transaction::incomplete_status_code,
493
+					'desc'  => EEH_Template::pretty_status(EEM_Transaction::incomplete_status_code, FALSE, 'sentence')
494 494
 				),
495 495
 				'abandoned'  => array(
496
-					'class' => 'ee-status-legend ee-status-legend-' . EEM_Transaction::abandoned_status_code,
497
-					'desc'  => EEH_Template::pretty_status( EEM_Transaction::abandoned_status_code, FALSE, 'sentence' )
496
+					'class' => 'ee-status-legend ee-status-legend-'.EEM_Transaction::abandoned_status_code,
497
+					'desc'  => EEH_Template::pretty_status(EEM_Transaction::abandoned_status_code, FALSE, 'sentence')
498 498
 				),
499 499
 				'failed'     => array(
500
-					'class' => 'ee-status-legend ee-status-legend-' . EEM_Transaction::failed_status_code,
501
-					'desc'  => EEH_Template::pretty_status( EEM_Transaction::failed_status_code, FALSE, 'sentence' )
500
+					'class' => 'ee-status-legend ee-status-legend-'.EEM_Transaction::failed_status_code,
501
+					'desc'  => EEH_Template::pretty_status(EEM_Transaction::failed_status_code, FALSE, 'sentence')
502 502
 				)
503 503
 			)
504 504
 		);
505 505
 
506
-		return array_merge( $items, $more_items);
506
+		return array_merge($items, $more_items);
507 507
 	}
508 508
 
509 509
 
@@ -516,9 +516,9 @@  discard block
 block discarded – undo
516 516
 	 */
517 517
 	protected function _transactions_overview_list_table() {
518 518
 		$this->_admin_page_title = esc_html__('Transactions', 'event_espresso');
519
-		$event = isset($this->_req_data['EVT_ID']) ? EEM_Event::instance()->get_one_by_ID($this->_req_data['EVT_ID'] ) : NULL;
520
-		$this->_template_args['admin_page_header'] = $event instanceof EE_Event ? sprintf( esc_html__('%sViewing Transactions for the Event: %s%s', 'event_espresso'), '<h3>', '<a href="' . EE_Admin_Page::add_query_args_and_nonce(array('action' => 'edit', 'post' => $event->ID()), EVENTS_ADMIN_URL ) . '" title="' . esc_attr__('Click to Edit event', 'event_espresso') . '">' . $event->get('EVT_name') . '</a>', '</h3>' ) : '';
521
-		$this->_template_args['after_list_table'] = $this->_display_legend( $this->_transaction_legend_items() );
519
+		$event = isset($this->_req_data['EVT_ID']) ? EEM_Event::instance()->get_one_by_ID($this->_req_data['EVT_ID']) : NULL;
520
+		$this->_template_args['admin_page_header'] = $event instanceof EE_Event ? sprintf(esc_html__('%sViewing Transactions for the Event: %s%s', 'event_espresso'), '<h3>', '<a href="'.EE_Admin_Page::add_query_args_and_nonce(array('action' => 'edit', 'post' => $event->ID()), EVENTS_ADMIN_URL).'" title="'.esc_attr__('Click to Edit event', 'event_espresso').'">'.$event->get('EVT_name').'</a>', '</h3>') : '';
521
+		$this->_template_args['after_list_table'] = $this->_display_legend($this->_transaction_legend_items());
522 522
 		$this->display_admin_list_table_page_with_no_sidebar();
523 523
 	}
524 524
 
@@ -532,7 +532,7 @@  discard block
 block discarded – undo
532 532
 	*	@return void
533 533
 	*/
534 534
 	protected function _transaction_details() {
535
-		do_action( 'AHEE__Transactions_Admin_Page__transaction_details__start', $this->_transaction );
535
+		do_action('AHEE__Transactions_Admin_Page__transaction_details__start', $this->_transaction);
536 536
 
537 537
 		$this->_set_transaction_status_array();
538 538
 
@@ -545,14 +545,14 @@  discard block
 block discarded – undo
545 545
 		$attendee = $primary_registration instanceof EE_Registration ? $primary_registration->attendee() : NULL;
546 546
 
547 547
 		$this->_template_args['txn_nmbr']['value'] = $this->_transaction->ID();
548
-		$this->_template_args['txn_nmbr']['label'] = esc_html__( 'Transaction Number', 'event_espresso' );
548
+		$this->_template_args['txn_nmbr']['label'] = esc_html__('Transaction Number', 'event_espresso');
549 549
 
550 550
 		$this->_template_args['txn_datetime']['value'] = $this->_transaction->get_i18n_datetime('TXN_timestamp');
551
-		$this->_template_args['txn_datetime']['label'] = esc_html__( 'Date', 'event_espresso' );
551
+		$this->_template_args['txn_datetime']['label'] = esc_html__('Date', 'event_espresso');
552 552
 
553
-		$this->_template_args['txn_status']['value'] = self::$_txn_status[ $this->_transaction->get('STS_ID') ];
554
-		$this->_template_args['txn_status']['label'] = esc_html__( 'Transaction Status', 'event_espresso' );
555
-		$this->_template_args['txn_status']['class'] = 'status-' . $this->_transaction->get('STS_ID');
553
+		$this->_template_args['txn_status']['value'] = self::$_txn_status[$this->_transaction->get('STS_ID')];
554
+		$this->_template_args['txn_status']['label'] = esc_html__('Transaction Status', 'event_espresso');
555
+		$this->_template_args['txn_status']['class'] = 'status-'.$this->_transaction->get('STS_ID');
556 556
 
557 557
 		$this->_template_args['grand_total'] = $this->_transaction->get('TXN_total');
558 558
 		$this->_template_args['total_paid'] = $this->_transaction->get('TXN_paid');
@@ -565,7 +565,7 @@  discard block
 block discarded – undo
565 565
 			)
566 566
 		) {
567 567
 			$this->_template_args['send_payment_reminder_button'] =
568
-				EEH_MSG_Template::is_mt_active( 'payment_reminder' )
568
+				EEH_MSG_Template::is_mt_active('payment_reminder')
569 569
 				&& $this->_transaction->get('STS_ID') != EEM_Transaction::complete_status_code
570 570
 				&& $this->_transaction->get('STS_ID') != EEM_Transaction::overpaid_status_code
571 571
 					? EEH_Template::get_button_or_link(
@@ -587,40 +587,40 @@  discard block
 block discarded – undo
587 587
 		}
588 588
 
589 589
 		$amount_due = $this->_transaction->get('TXN_total') - $this->_transaction->get('TXN_paid');
590
-		$this->_template_args['amount_due'] = EEH_Template::format_currency( $amount_due, TRUE );
591
-		if ( EE_Registry::instance()->CFG->currency->sign_b4 ) {
592
-			$this->_template_args['amount_due'] = EE_Registry::instance()->CFG->currency->sign . $this->_template_args['amount_due'];
590
+		$this->_template_args['amount_due'] = EEH_Template::format_currency($amount_due, TRUE);
591
+		if (EE_Registry::instance()->CFG->currency->sign_b4) {
592
+			$this->_template_args['amount_due'] = EE_Registry::instance()->CFG->currency->sign.$this->_template_args['amount_due'];
593 593
 		} else {
594
-			$this->_template_args['amount_due'] = $this->_template_args['amount_due'] . EE_Registry::instance()->CFG->currency->sign;
594
+			$this->_template_args['amount_due'] = $this->_template_args['amount_due'].EE_Registry::instance()->CFG->currency->sign;
595 595
 		}
596
-		$this->_template_args['amount_due_class'] =  '';
596
+		$this->_template_args['amount_due_class'] = '';
597 597
 
598
-		if ( $this->_transaction->get('TXN_paid') == $this->_transaction->get('TXN_total') ) {
598
+		if ($this->_transaction->get('TXN_paid') == $this->_transaction->get('TXN_total')) {
599 599
 			// paid in full
600
-			$this->_template_args['amount_due'] =  FALSE;
601
-		} elseif ( $this->_transaction->get('TXN_paid') > $this->_transaction->get('TXN_total') ) {
600
+			$this->_template_args['amount_due'] = FALSE;
601
+		} elseif ($this->_transaction->get('TXN_paid') > $this->_transaction->get('TXN_total')) {
602 602
 			// overpaid
603
-			$this->_template_args['amount_due_class'] =  'txn-overview-no-payment-spn';
604
-		} elseif (( $this->_transaction->get('TXN_total') > 0 ) && ( $this->_transaction->get('TXN_paid') > 0 )) {
603
+			$this->_template_args['amount_due_class'] = 'txn-overview-no-payment-spn';
604
+		} elseif (($this->_transaction->get('TXN_total') > 0) && ($this->_transaction->get('TXN_paid') > 0)) {
605 605
 			// monies owing
606
-			$this->_template_args['amount_due_class'] =  'txn-overview-part-payment-spn';
607
-		} elseif (( $this->_transaction->get('TXN_total') > 0 ) && ( $this->_transaction->get('TXN_paid') == 0 )) {
606
+			$this->_template_args['amount_due_class'] = 'txn-overview-part-payment-spn';
607
+		} elseif (($this->_transaction->get('TXN_total') > 0) && ($this->_transaction->get('TXN_paid') == 0)) {
608 608
 			// no payments made yet
609
-			$this->_template_args['amount_due_class'] =  'txn-overview-no-payment-spn';
610
-		} elseif ( $this->_transaction->get('TXN_total') == 0 ) {
609
+			$this->_template_args['amount_due_class'] = 'txn-overview-no-payment-spn';
610
+		} elseif ($this->_transaction->get('TXN_total') == 0) {
611 611
 			// free event
612
-			$this->_template_args['amount_due'] =  FALSE;
612
+			$this->_template_args['amount_due'] = FALSE;
613 613
 		}
614 614
 
615 615
 		$payment_method = $this->_transaction->payment_method();
616 616
 
617 617
 		$this->_template_args['method_of_payment_name'] = $payment_method instanceof EE_Payment_Method
618 618
 			? $payment_method->admin_name()
619
-			: esc_html__( 'Unknown', 'event_espresso' );
619
+			: esc_html__('Unknown', 'event_espresso');
620 620
 
621 621
 		$this->_template_args['currency_sign'] = EE_Registry::instance()->CFG->currency->sign;
622 622
 		// link back to overview
623
-		$this->_template_args['txn_overview_url'] = ! empty ( $_SERVER['HTTP_REFERER'] )
623
+		$this->_template_args['txn_overview_url'] = ! empty ($_SERVER['HTTP_REFERER'])
624 624
 			? $_SERVER['HTTP_REFERER']
625 625
 			: TXN_ADMIN_URL;
626 626
 
@@ -628,13 +628,13 @@  discard block
 block discarded – undo
628 628
 		// next link
629 629
 		$next_txn = $this->_transaction->next(
630 630
 			null,
631
-			array( array( 'STS_ID' => array( '!=', EEM_Transaction::failed_status_code ) ) ),
631
+			array(array('STS_ID' => array('!=', EEM_Transaction::failed_status_code))),
632 632
 			'TXN_ID'
633 633
 		);
634 634
 		$this->_template_args['next_transaction'] = $next_txn
635 635
 			? $this->_next_link(
636 636
 				EE_Admin_Page::add_query_args_and_nonce(
637
-					array( 'action' => 'view_transaction', 'TXN_ID' => $next_txn['TXN_ID'] ),
637
+					array('action' => 'view_transaction', 'TXN_ID' => $next_txn['TXN_ID']),
638 638
 					TXN_ADMIN_URL
639 639
 				),
640 640
 				'dashicons dashicons-arrow-right ee-icon-size-22'
@@ -643,13 +643,13 @@  discard block
 block discarded – undo
643 643
 		// previous link
644 644
 		$previous_txn = $this->_transaction->previous(
645 645
 			null,
646
-			array( array( 'STS_ID' => array( '!=', EEM_Transaction::failed_status_code ) ) ),
646
+			array(array('STS_ID' => array('!=', EEM_Transaction::failed_status_code))),
647 647
 			'TXN_ID'
648 648
 		);
649 649
 		$this->_template_args['previous_transaction'] = $previous_txn
650 650
 			? $this->_previous_link(
651 651
 				EE_Admin_Page::add_query_args_and_nonce(
652
-					array( 'action' => 'view_transaction', 'TXN_ID' => $previous_txn['TXN_ID'] ),
652
+					array('action' => 'view_transaction', 'TXN_ID' => $previous_txn['TXN_ID']),
653 653
 					TXN_ADMIN_URL
654 654
 				),
655 655
 				'dashicons dashicons-arrow-left ee-icon-size-22'
@@ -659,16 +659,16 @@  discard block
 block discarded – undo
659 659
 		// were we just redirected here after adding a new registration ???
660 660
 		if (
661 661
 			isset(
662
-				$this->_req_data[ 'redirect_from' ],
663
-				$this->_req_data[ 'EVT_ID' ],
664
-				$this->_req_data[ 'event_name' ]
662
+				$this->_req_data['redirect_from'],
663
+				$this->_req_data['EVT_ID'],
664
+				$this->_req_data['event_name']
665 665
 			)
666 666
 		) {
667 667
 			if (
668 668
 				EE_Registry::instance()->CAP->current_user_can(
669 669
 					'ee_edit_registrations',
670 670
 					'espresso_registrations_new_registration',
671
-					$this->_req_data[ 'EVT_ID' ]
671
+					$this->_req_data['EVT_ID']
672 672
 				)
673 673
 			) {
674 674
 				$this->_admin_page_title .= '<a id="add-new-registration" class="add-new-h2 button-primary" href="';
@@ -678,25 +678,25 @@  discard block
 block discarded – undo
678 678
 						'action'   => 'new_registration',
679 679
 						'return'   => 'default',
680 680
 						'TXN_ID'   => $this->_transaction->ID(),
681
-						'event_id' => $this->_req_data[ 'EVT_ID' ],
681
+						'event_id' => $this->_req_data['EVT_ID'],
682 682
 					),
683 683
 					REG_ADMIN_URL
684 684
 				);
685 685
 				$this->_admin_page_title .= '">';
686 686
 
687 687
 				$this->_admin_page_title .= sprintf(
688
-					esc_html__('Add Another New Registration to Event: "%1$s" ?', 'event_espresso' ),
689
-					htmlentities( urldecode( $this->_req_data[ 'event_name' ] ), ENT_QUOTES, 'UTF-8' )
688
+					esc_html__('Add Another New Registration to Event: "%1$s" ?', 'event_espresso'),
689
+					htmlentities(urldecode($this->_req_data['event_name']), ENT_QUOTES, 'UTF-8')
690 690
 				);
691 691
 				$this->_admin_page_title .= '</a>';
692 692
 			}
693
-			EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ );
693
+			EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__);
694 694
 		}
695 695
 		// grab messages at the last second
696 696
 		$this->_template_args['notices'] = EE_Error::get_notices();
697 697
 		// path to template
698
-		$template_path = TXN_TEMPLATE_PATH . 'txn_admin_details_header.template.php';
699
-		$this->_template_args['admin_page_header'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
698
+		$template_path = TXN_TEMPLATE_PATH.'txn_admin_details_header.template.php';
699
+		$this->_template_args['admin_page_header'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE);
700 700
 
701 701
 		// the details template wrapper
702 702
 		$this->display_admin_page_with_sidebar();
@@ -715,18 +715,18 @@  discard block
 block discarded – undo
715 715
 
716 716
 		$this->_set_transaction_object();
717 717
 
718
-		add_meta_box( 'edit-txn-details-mbox', esc_html__( 'Transaction Details', 'event_espresso' ), array( $this, 'txn_details_meta_box' ), $this->_wp_page_slug, 'normal', 'high' );
718
+		add_meta_box('edit-txn-details-mbox', esc_html__('Transaction Details', 'event_espresso'), array($this, 'txn_details_meta_box'), $this->_wp_page_slug, 'normal', 'high');
719 719
 		add_meta_box(
720 720
 			'edit-txn-attendees-mbox',
721
-			esc_html__( 'Attendees Registered in this Transaction', 'event_espresso' ),
722
-			array( $this, 'txn_attendees_meta_box' ),
721
+			esc_html__('Attendees Registered in this Transaction', 'event_espresso'),
722
+			array($this, 'txn_attendees_meta_box'),
723 723
 			$this->_wp_page_slug,
724 724
 			'normal',
725 725
 			'high',
726
-			array( 'TXN_ID' => $this->_transaction->ID() )
726
+			array('TXN_ID' => $this->_transaction->ID())
727 727
 		);
728
-		add_meta_box( 'edit-txn-registrant-mbox', esc_html__( 'Primary Contact', 'event_espresso' ), array( $this, 'txn_registrant_side_meta_box' ), $this->_wp_page_slug, 'side', 'high' );
729
-		add_meta_box( 'edit-txn-billing-info-mbox', esc_html__( 'Billing Information', 'event_espresso' ), array( $this, 'txn_billing_info_side_meta_box' ), $this->_wp_page_slug, 'side', 'high' );
728
+		add_meta_box('edit-txn-registrant-mbox', esc_html__('Primary Contact', 'event_espresso'), array($this, 'txn_registrant_side_meta_box'), $this->_wp_page_slug, 'side', 'high');
729
+		add_meta_box('edit-txn-billing-info-mbox', esc_html__('Billing Information', 'event_espresso'), array($this, 'txn_billing_info_side_meta_box'), $this->_wp_page_slug, 'side', 'high');
730 730
 
731 731
 	}
732 732
 
@@ -747,15 +747,15 @@  discard block
 block discarded – undo
747 747
 
748 748
 		//get line table
749 749
 		EEH_Autoloader::register_line_item_display_autoloaders();
750
-		$Line_Item_Display = new EE_Line_Item_Display( 'admin_table', 'EE_Admin_Table_Line_Item_Display_Strategy' );
751
-		$this->_template_args['line_item_table'] = $Line_Item_Display->display_line_item( $this->_transaction->total_line_item() );
750
+		$Line_Item_Display = new EE_Line_Item_Display('admin_table', 'EE_Admin_Table_Line_Item_Display_Strategy');
751
+		$this->_template_args['line_item_table'] = $Line_Item_Display->display_line_item($this->_transaction->total_line_item());
752 752
 		$this->_template_args['REG_code'] = $this->_transaction->get_first_related('Registration')->get('REG_code');
753 753
 
754 754
 		// process taxes
755
-		$taxes = $this->_transaction->get_many_related( 'Line_Item', array( array( 'LIN_type' => EEM_Line_Item::type_tax )));
756
-		$this->_template_args['taxes'] = ! empty( $taxes ) ? $taxes : FALSE;
755
+		$taxes = $this->_transaction->get_many_related('Line_Item', array(array('LIN_type' => EEM_Line_Item::type_tax)));
756
+		$this->_template_args['taxes'] = ! empty($taxes) ? $taxes : FALSE;
757 757
 
758
-		$this->_template_args['grand_total'] = EEH_Template::format_currency($this->_transaction->get('TXN_total'), FALSE, FALSE );
758
+		$this->_template_args['grand_total'] = EEH_Template::format_currency($this->_transaction->get('TXN_total'), FALSE, FALSE);
759 759
 		$this->_template_args['grand_raw_total'] = $this->_transaction->get('TXN_total');
760 760
 		$this->_template_args['TXN_status'] = $this->_transaction->get('STS_ID');
761 761
 
@@ -763,63 +763,63 @@  discard block
 block discarded – undo
763 763
 
764 764
 		// process payment details
765 765
 		$payments = $this->_transaction->get_many_related('Payment');
766
-		if( ! empty(  $payments ) ) {
767
-			$this->_template_args[ 'payments' ] = $payments;
768
-			$this->_template_args[ 'existing_reg_payments' ] = $this->_get_registration_payment_IDs( $payments );
766
+		if ( ! empty($payments)) {
767
+			$this->_template_args['payments'] = $payments;
768
+			$this->_template_args['existing_reg_payments'] = $this->_get_registration_payment_IDs($payments);
769 769
 		} else {
770
-			$this->_template_args[ 'payments' ] = false;
771
-			$this->_template_args[ 'existing_reg_payments' ] = array();
770
+			$this->_template_args['payments'] = false;
771
+			$this->_template_args['existing_reg_payments'] = array();
772 772
 		}
773 773
 
774
-		$this->_template_args['edit_payment_url'] = add_query_arg( array( 'action' => 'edit_payment'  ), TXN_ADMIN_URL );
775
-		$this->_template_args['delete_payment_url'] = add_query_arg( array( 'action' => 'espresso_delete_payment' ), TXN_ADMIN_URL );
774
+		$this->_template_args['edit_payment_url'] = add_query_arg(array('action' => 'edit_payment'), TXN_ADMIN_URL);
775
+		$this->_template_args['delete_payment_url'] = add_query_arg(array('action' => 'espresso_delete_payment'), TXN_ADMIN_URL);
776 776
 
777
-		if ( isset( $txn_details['invoice_number'] )) {
777
+		if (isset($txn_details['invoice_number'])) {
778 778
 			$this->_template_args['txn_details']['invoice_number']['value'] = $this->_template_args['REG_code'];
779
-			$this->_template_args['txn_details']['invoice_number']['label'] = esc_html__( 'Invoice Number', 'event_espresso' );
779
+			$this->_template_args['txn_details']['invoice_number']['label'] = esc_html__('Invoice Number', 'event_espresso');
780 780
 		}
781 781
 
782 782
 		$this->_template_args['txn_details']['registration_session']['value'] = $this->_transaction->get_first_related('Registration')->get('REG_session');
783
-		$this->_template_args['txn_details']['registration_session']['label'] = esc_html__( 'Registration Session', 'event_espresso' );
783
+		$this->_template_args['txn_details']['registration_session']['label'] = esc_html__('Registration Session', 'event_espresso');
784 784
 
785
-		$this->_template_args['txn_details']['ip_address']['value'] = isset( $this->_session['ip_address'] ) ? $this->_session['ip_address'] : '';
786
-		$this->_template_args['txn_details']['ip_address']['label'] = esc_html__( 'Transaction placed from IP', 'event_espresso' );
785
+		$this->_template_args['txn_details']['ip_address']['value'] = isset($this->_session['ip_address']) ? $this->_session['ip_address'] : '';
786
+		$this->_template_args['txn_details']['ip_address']['label'] = esc_html__('Transaction placed from IP', 'event_espresso');
787 787
 
788
-		$this->_template_args['txn_details']['user_agent']['value'] = isset( $this->_session['user_agent'] ) ? $this->_session['user_agent'] : '';
789
-		$this->_template_args['txn_details']['user_agent']['label'] = esc_html__( 'Registrant User Agent', 'event_espresso' );
788
+		$this->_template_args['txn_details']['user_agent']['value'] = isset($this->_session['user_agent']) ? $this->_session['user_agent'] : '';
789
+		$this->_template_args['txn_details']['user_agent']['label'] = esc_html__('Registrant User Agent', 'event_espresso');
790 790
 
791 791
 		$reg_steps = '<ul>';
792
-		foreach ( $this->_transaction->reg_steps() as $reg_step => $reg_step_status ) {
793
-			if ( $reg_step_status === true ) {
794
-				$reg_steps .= '<li style="color:#70cc50">' . sprintf( esc_html__( '%1$s : Completed', 'event_espresso' ), ucwords( str_replace( '_', ' ', $reg_step ) ) ) . '</li>';
795
-			} else if ( is_numeric( $reg_step_status ) && $reg_step_status !== false ) {
796
-					$reg_steps .= '<li style="color:#2EA2CC">' . sprintf(
797
-							esc_html__( '%1$s : Initiated %2$s', 'event_espresso' ),
798
-							ucwords( str_replace( '_', ' ', $reg_step ) ),
799
-							gmdate( get_option( 'date_format' ) . ' ' . get_option( 'time_format' ), ( $reg_step_status + ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS ) ) )
800
-						) . '</li>';
792
+		foreach ($this->_transaction->reg_steps() as $reg_step => $reg_step_status) {
793
+			if ($reg_step_status === true) {
794
+				$reg_steps .= '<li style="color:#70cc50">'.sprintf(esc_html__('%1$s : Completed', 'event_espresso'), ucwords(str_replace('_', ' ', $reg_step))).'</li>';
795
+			} else if (is_numeric($reg_step_status) && $reg_step_status !== false) {
796
+					$reg_steps .= '<li style="color:#2EA2CC">'.sprintf(
797
+							esc_html__('%1$s : Initiated %2$s', 'event_espresso'),
798
+							ucwords(str_replace('_', ' ', $reg_step)),
799
+							gmdate(get_option('date_format').' '.get_option('time_format'), ($reg_step_status + (get_option('gmt_offset') * HOUR_IN_SECONDS)))
800
+						).'</li>';
801 801
 				} else {
802
-				$reg_steps .= '<li style="color:#E76700">' . sprintf( esc_html__( '%1$s : Never Initiated', 'event_espresso' ), ucwords( str_replace( '_', ' ', $reg_step ) ) ) . '</li>';
802
+				$reg_steps .= '<li style="color:#E76700">'.sprintf(esc_html__('%1$s : Never Initiated', 'event_espresso'), ucwords(str_replace('_', ' ', $reg_step))).'</li>';
803 803
 			}
804 804
 		}
805 805
 		$reg_steps .= '</ul>';
806 806
 		$this->_template_args['txn_details']['reg_steps']['value'] = $reg_steps;
807
-		$this->_template_args['txn_details']['reg_steps']['label'] = esc_html__( 'Registration Step Progress', 'event_espresso' );
807
+		$this->_template_args['txn_details']['reg_steps']['label'] = esc_html__('Registration Step Progress', 'event_espresso');
808 808
 
809 809
 
810 810
 		$this->_get_registrations_to_apply_payment_to();
811
-		$this->_get_payment_methods( $payments );
811
+		$this->_get_payment_methods($payments);
812 812
 		$this->_get_payment_status_array();
813 813
 		$this->_get_reg_status_selection(); //sets up the template args for the reg status array for the transaction.
814 814
 
815
-		$this->_template_args['transaction_form_url'] = add_query_arg( array( 'action' => 'edit_transaction', 'process' => 'transaction'  ), TXN_ADMIN_URL );
816
-		$this->_template_args['apply_payment_form_url'] = add_query_arg( array( 'page' => 'espresso_transactions', 'action' => 'espresso_apply_payment' ), WP_AJAX_URL );
817
-		$this->_template_args['delete_payment_form_url'] = add_query_arg( array( 'page' => 'espresso_transactions', 'action' => 'espresso_delete_payment' ), WP_AJAX_URL );
815
+		$this->_template_args['transaction_form_url'] = add_query_arg(array('action' => 'edit_transaction', 'process' => 'transaction'), TXN_ADMIN_URL);
816
+		$this->_template_args['apply_payment_form_url'] = add_query_arg(array('page' => 'espresso_transactions', 'action' => 'espresso_apply_payment'), WP_AJAX_URL);
817
+		$this->_template_args['delete_payment_form_url'] = add_query_arg(array('page' => 'espresso_transactions', 'action' => 'espresso_delete_payment'), WP_AJAX_URL);
818 818
 
819 819
 		// 'espresso_delete_payment_nonce'
820 820
 
821
-		$template_path = TXN_TEMPLATE_PATH . 'txn_admin_details_main_meta_box_txn_details.template.php';
822
-		echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
821
+		$template_path = TXN_TEMPLATE_PATH.'txn_admin_details_main_meta_box_txn_details.template.php';
822
+		echo EEH_Template::display_template($template_path, $this->_template_args, TRUE);
823 823
 
824 824
 	}
825 825
 
@@ -834,27 +834,27 @@  discard block
 block discarded – undo
834 834
 	 * @param EE_Payment[] $payments
835 835
 	 * @return array
836 836
 	 */
837
-	protected function _get_registration_payment_IDs( $payments = array() ) {
837
+	protected function _get_registration_payment_IDs($payments = array()) {
838 838
 		$existing_reg_payments = array();
839 839
 		// get all reg payments for these payments
840
-		$reg_payments = EEM_Registration_Payment::instance()->get_all( array(
840
+		$reg_payments = EEM_Registration_Payment::instance()->get_all(array(
841 841
 			array(
842 842
 				'PAY_ID' => array(
843 843
 					'IN',
844
-					array_keys( $payments )
844
+					array_keys($payments)
845 845
 				)
846 846
 			)
847
-		) );
848
-		if ( ! empty( $reg_payments ) ) {
849
-			foreach ( $payments as $payment ) {
850
-				if ( ! $payment instanceof EE_Payment ) {
847
+		));
848
+		if ( ! empty($reg_payments)) {
849
+			foreach ($payments as $payment) {
850
+				if ( ! $payment instanceof EE_Payment) {
851 851
 					continue;
852
-				} else if ( ! isset( $existing_reg_payments[ $payment->ID() ] ) ) {
853
-					$existing_reg_payments[ $payment->ID() ] = array();
852
+				} else if ( ! isset($existing_reg_payments[$payment->ID()])) {
853
+					$existing_reg_payments[$payment->ID()] = array();
854 854
 				}
855
-				foreach ( $reg_payments as $reg_payment ) {
856
-					if ( $reg_payment instanceof EE_Registration_Payment && $reg_payment->payment_ID() === $payment->ID() ) {
857
-						$existing_reg_payments[ $payment->ID() ][ ] = $reg_payment->registration_ID();
855
+				foreach ($reg_payments as $reg_payment) {
856
+					if ($reg_payment instanceof EE_Registration_Payment && $reg_payment->payment_ID() === $payment->ID()) {
857
+						$existing_reg_payments[$payment->ID()][] = $reg_payment->registration_ID();
858 858
 					}
859 859
 				}
860 860
 			}
@@ -891,39 +891,39 @@  discard block
 block discarded – undo
891 891
 		$registrations_to_apply_payment_to .= '<br /><div class="admin-primary-mbox-tbl-wrap">';
892 892
 		$registrations_to_apply_payment_to .= '<table class="admin-primary-mbox-tbl">';
893 893
 		$registrations_to_apply_payment_to .= '<thead><tr>';
894
-		$registrations_to_apply_payment_to .= '<td>' . esc_html__( 'ID', 'event_espresso' ) . '</td>';
895
-		$registrations_to_apply_payment_to .= '<td>' . esc_html__( 'Registrant', 'event_espresso' ) . '</td>';
896
-		$registrations_to_apply_payment_to .= '<td>' . esc_html__( 'Ticket', 'event_espresso' ) . '</td>';
897
-		$registrations_to_apply_payment_to .= '<td>' . esc_html__( 'Event', 'event_espresso' ) . '</td>';
898
-		$registrations_to_apply_payment_to .= '<td class="txn-admin-payment-paid-td jst-cntr">' . esc_html__( 'Paid', 'event_espresso' ) . '</td>';
899
-		$registrations_to_apply_payment_to .= '<td class="txn-admin-payment-owing-td jst-cntr">' . esc_html__( 'Owing', 'event_espresso' ) . '</td>';
900
-		$registrations_to_apply_payment_to .= '<td class="jst-cntr">' . esc_html__( 'Apply', 'event_espresso' ) . '</td>';
894
+		$registrations_to_apply_payment_to .= '<td>'.esc_html__('ID', 'event_espresso').'</td>';
895
+		$registrations_to_apply_payment_to .= '<td>'.esc_html__('Registrant', 'event_espresso').'</td>';
896
+		$registrations_to_apply_payment_to .= '<td>'.esc_html__('Ticket', 'event_espresso').'</td>';
897
+		$registrations_to_apply_payment_to .= '<td>'.esc_html__('Event', 'event_espresso').'</td>';
898
+		$registrations_to_apply_payment_to .= '<td class="txn-admin-payment-paid-td jst-cntr">'.esc_html__('Paid', 'event_espresso').'</td>';
899
+		$registrations_to_apply_payment_to .= '<td class="txn-admin-payment-owing-td jst-cntr">'.esc_html__('Owing', 'event_espresso').'</td>';
900
+		$registrations_to_apply_payment_to .= '<td class="jst-cntr">'.esc_html__('Apply', 'event_espresso').'</td>';
901 901
 		$registrations_to_apply_payment_to .= '</tr></thead><tbody>';
902 902
 		// get registrations for TXN
903
-		$registrations = $this->_transaction->registrations( $query_params );
904
-		foreach ( $registrations as $registration ) {
905
-			if ( $registration instanceof EE_Registration ) {
903
+		$registrations = $this->_transaction->registrations($query_params);
904
+		foreach ($registrations as $registration) {
905
+			if ($registration instanceof EE_Registration) {
906 906
 				$owing = $registration->final_price() - $registration->paid();
907
-				$taxable = $registration->ticket()->taxable() ? ' <span class="smaller-text lt-grey-text"> ' . esc_html__( '+ tax', 'event_espresso' ) . '</span>' : '';
908
-				$checked = empty( $existing_reg_payments ) || in_array( $registration->ID(), $existing_reg_payments ) ? ' checked="checked"' : '';
909
-				$registrations_to_apply_payment_to .= '<tr id="apply-payment-registration-row-' . $registration->ID() . '">';
907
+				$taxable = $registration->ticket()->taxable() ? ' <span class="smaller-text lt-grey-text"> '.esc_html__('+ tax', 'event_espresso').'</span>' : '';
908
+				$checked = empty($existing_reg_payments) || in_array($registration->ID(), $existing_reg_payments) ? ' checked="checked"' : '';
909
+				$registrations_to_apply_payment_to .= '<tr id="apply-payment-registration-row-'.$registration->ID().'">';
910 910
 				// add html for checkbox input and label
911
-				$registrations_to_apply_payment_to .= '<td>' . $registration->ID() . '</td>';
912
-				$registrations_to_apply_payment_to .= '<td>' . $registration->attendee() instanceof EE_Attendee ? $registration->attendee()->full_name() : esc_html__( 'Unknown Attendee', 'event_espresso' ) . '</td>';
913
-				$registrations_to_apply_payment_to .= '<td>' . $registration->ticket()->name() . ' : ' . $registration->ticket()->pretty_price() . $taxable . '</td>';
914
-				$registrations_to_apply_payment_to .= '<td>' . $registration->event_name() . '</td>';
915
-				$registrations_to_apply_payment_to .= '<td class="txn-admin-payment-paid-td jst-rght">' . $registration->pretty_paid() . '</td>';
916
-				$registrations_to_apply_payment_to .= '<td class="txn-admin-payment-owing-td jst-rght">' . EEH_Template::format_currency( $owing ) . '</td>';
911
+				$registrations_to_apply_payment_to .= '<td>'.$registration->ID().'</td>';
912
+				$registrations_to_apply_payment_to .= '<td>'.$registration->attendee() instanceof EE_Attendee ? $registration->attendee()->full_name() : esc_html__('Unknown Attendee', 'event_espresso').'</td>';
913
+				$registrations_to_apply_payment_to .= '<td>'.$registration->ticket()->name().' : '.$registration->ticket()->pretty_price().$taxable.'</td>';
914
+				$registrations_to_apply_payment_to .= '<td>'.$registration->event_name().'</td>';
915
+				$registrations_to_apply_payment_to .= '<td class="txn-admin-payment-paid-td jst-rght">'.$registration->pretty_paid().'</td>';
916
+				$registrations_to_apply_payment_to .= '<td class="txn-admin-payment-owing-td jst-rght">'.EEH_Template::format_currency($owing).'</td>';
917 917
 				$registrations_to_apply_payment_to .= '<td class="jst-cntr">';
918 918
 				$disabled = $registration->final_price() > 0 ? '' : ' disabled';
919
-				$registrations_to_apply_payment_to .= '<input type="checkbox" value="' . $registration->ID() . '" name="txn_admin_payment[registrations]"' . $checked . $disabled . '>';
919
+				$registrations_to_apply_payment_to .= '<input type="checkbox" value="'.$registration->ID().'" name="txn_admin_payment[registrations]"'.$checked.$disabled.'>';
920 920
 				$registrations_to_apply_payment_to .= '</td>';
921 921
 				$registrations_to_apply_payment_to .= '</tr>';
922 922
 			}
923 923
 		}
924 924
 		$registrations_to_apply_payment_to .= '</tbody></table></div>';
925
-		$registrations_to_apply_payment_to .= '<p class="clear description">' . esc_html__( 'The payment will only be applied to the registrations that have a check mark in their corresponding check box. Checkboxes for free registrations have been disabled.', 'event_espresso' ) . '</p></div>';
926
-		$this->_template_args[ 'registrations_to_apply_payment_to' ] = $registrations_to_apply_payment_to;
925
+		$registrations_to_apply_payment_to .= '<p class="clear description">'.esc_html__('The payment will only be applied to the registrations that have a check mark in their corresponding check box. Checkboxes for free registrations have been disabled.', 'event_espresso').'</p></div>';
926
+		$this->_template_args['registrations_to_apply_payment_to'] = $registrations_to_apply_payment_to;
927 927
 	}
928 928
 
929 929
 
@@ -940,9 +940,9 @@  discard block
 block discarded – undo
940 940
 		$statuses = EEM_Registration::reg_status_array(array(), TRUE);
941 941
 		//let's add a "don't change" option.
942 942
 		$status_array['NAN'] = esc_html__('Leave the Same', 'event_espresso');
943
-		$status_array = array_merge( $status_array, $statuses );
944
-		$this->_template_args['status_change_select'] = EEH_Form_Fields::select_input( 'txn_reg_status_change[reg_status]', $status_array, 'NAN', 'id="txn-admin-payment-reg-status-inp"', 'txn-reg-status-change-reg-status' );
945
-		$this->_template_args['delete_status_change_select'] = EEH_Form_Fields::select_input( 'delete_txn_reg_status_change[reg_status]', $status_array, 'NAN', 'delete-txn-admin-payment-reg-status-inp', 'delete-txn-reg-status-change-reg-status' );
943
+		$status_array = array_merge($status_array, $statuses);
944
+		$this->_template_args['status_change_select'] = EEH_Form_Fields::select_input('txn_reg_status_change[reg_status]', $status_array, 'NAN', 'id="txn-admin-payment-reg-status-inp"', 'txn-reg-status-change-reg-status');
945
+		$this->_template_args['delete_status_change_select'] = EEH_Form_Fields::select_input('delete_txn_reg_status_change[reg_status]', $status_array, 'NAN', 'delete-txn-admin-payment-reg-status-inp', 'delete-txn-reg-status-change-reg-status');
946 946
 
947 947
 	}
948 948
 
@@ -957,21 +957,21 @@  discard block
 block discarded – undo
957 957
 	 * @param EE_Payment[] to show on this page
958 958
 	 *	@return void
959 959
 	 */
960
-	private function _get_payment_methods( $payments = array() ) {
960
+	private function _get_payment_methods($payments = array()) {
961 961
 		$payment_methods_of_payments = array();
962
-		foreach( $payments as $payment ){
963
-			if( $payment instanceof EE_Payment ){
964
-				$payment_methods_of_payments[] = $payment->get( 'PMD_ID' );
962
+		foreach ($payments as $payment) {
963
+			if ($payment instanceof EE_Payment) {
964
+				$payment_methods_of_payments[] = $payment->get('PMD_ID');
965 965
 			}
966 966
 		}
967
-		if( $payment_methods_of_payments ){
968
-			$query_args = array( array( 'OR*payment_method_for_payment' => array(
969
-					'PMD_ID' => array( 'IN', $payment_methods_of_payments ),
970
-					'PMD_scope' => array( 'LIKE', '%' . EEM_Payment_Method::scope_admin . '%' ) ) ) );
971
-		}else{
972
-			$query_args = array( array( 'PMD_scope' => array( 'LIKE', '%' . EEM_Payment_Method::scope_admin . '%' ) ) );
967
+		if ($payment_methods_of_payments) {
968
+			$query_args = array(array('OR*payment_method_for_payment' => array(
969
+					'PMD_ID' => array('IN', $payment_methods_of_payments),
970
+					'PMD_scope' => array('LIKE', '%'.EEM_Payment_Method::scope_admin.'%') )));
971
+		} else {
972
+			$query_args = array(array('PMD_scope' => array('LIKE', '%'.EEM_Payment_Method::scope_admin.'%')));
973 973
 		}
974
-		$this->_template_args['payment_methods'] = EEM_Payment_Method::instance()->get_all( $query_args );
974
+		$this->_template_args['payment_methods'] = EEM_Payment_Method::instance()->get_all($query_args);
975 975
 	}
976 976
 
977 977
 
@@ -985,46 +985,46 @@  discard block
 block discarded – undo
985 985
 	 * @param array $metabox
986 986
 	 * @return void
987 987
 	 */
988
-	public function txn_attendees_meta_box( $post, $metabox = array( 'args' => array() )) {
988
+	public function txn_attendees_meta_box($post, $metabox = array('args' => array())) {
989 989
 
990
-		extract( $metabox['args'] );
990
+		extract($metabox['args']);
991 991
 		$this->_template_args['post'] = $post;
992 992
 		$this->_template_args['event_attendees'] = array();
993 993
 		// process items in cart
994
-		$line_items = $this->_transaction->get_many_related('Line_Item', array( array( 'LIN_type' => 'line-item' ) ) );
995
-		if ( ! empty( $line_items )) {
996
-			foreach ( $line_items as $item ) {
997
-				if ( $item instanceof EE_Line_Item ) {
998
-					switch( $item->OBJ_type() ) {
994
+		$line_items = $this->_transaction->get_many_related('Line_Item', array(array('LIN_type' => 'line-item')));
995
+		if ( ! empty($line_items)) {
996
+			foreach ($line_items as $item) {
997
+				if ($item instanceof EE_Line_Item) {
998
+					switch ($item->OBJ_type()) {
999 999
 
1000 1000
 						case 'Event' :
1001 1001
 							break;
1002 1002
 
1003 1003
 						case 'Ticket' :
1004 1004
 							$ticket = $item->ticket();
1005
-							if ( empty( $ticket )) {
1005
+							if (empty($ticket)) {
1006 1006
 								continue; //right now we're only handling tickets here.  Cause its expected that only tickets will have attendees right?
1007 1007
 							}
1008
-							$ticket_price = EEH_Template::format_currency( $item->get( 'LIN_unit_price' ));
1008
+							$ticket_price = EEH_Template::format_currency($item->get('LIN_unit_price'));
1009 1009
 							$event = $ticket->get_first_related('Registration')->get_first_related('Event');
1010
-							$event_name = $event instanceof EE_Event ? $event->get('EVT_name') . ' - ' . $item->get('LIN_name') : '';
1010
+							$event_name = $event instanceof EE_Event ? $event->get('EVT_name').' - '.$item->get('LIN_name') : '';
1011 1011
 
1012
-							$registrations = $ticket->get_many_related('Registration', array( array('TXN_ID' => $this->_transaction->ID() )));
1013
-							foreach( $registrations as $registration ) {
1014
-								$this->_template_args['event_attendees'][$registration->ID()]['att_num'] 						= $registration->get('REG_count');
1015
-								$this->_template_args['event_attendees'][$registration->ID()]['event_ticket_name'] 	= $event_name;
1016
-								$this->_template_args['event_attendees'][$registration->ID()]['ticket_price'] 				= $ticket_price;
1012
+							$registrations = $ticket->get_many_related('Registration', array(array('TXN_ID' => $this->_transaction->ID())));
1013
+							foreach ($registrations as $registration) {
1014
+								$this->_template_args['event_attendees'][$registration->ID()]['att_num'] = $registration->get('REG_count');
1015
+								$this->_template_args['event_attendees'][$registration->ID()]['event_ticket_name'] = $event_name;
1016
+								$this->_template_args['event_attendees'][$registration->ID()]['ticket_price'] = $ticket_price;
1017 1017
 								// attendee info
1018 1018
 								$attendee = $registration->get_first_related('Attendee');
1019
-								if ( $attendee instanceof EE_Attendee ) {
1019
+								if ($attendee instanceof EE_Attendee) {
1020 1020
 									$this->_template_args['event_attendees'][$registration->ID()]['att_id'] 			= $attendee->ID();
1021 1021
 									$this->_template_args['event_attendees'][$registration->ID()]['attendee'] 	= $attendee->full_name();
1022
-									$this->_template_args['event_attendees'][$registration->ID()]['email'] 			= '<a href="mailto:' . $attendee->email() . '?subject=' . $event->get('EVT_name') . esc_html__(' Event', 'event_espresso') . '">' . $attendee->email() . '</a>';
1023
-									$this->_template_args['event_attendees'][$registration->ID()]['address'] 		=  implode(',<br>', $attendee->full_address_as_array() );
1022
+									$this->_template_args['event_attendees'][$registration->ID()]['email'] = '<a href="mailto:'.$attendee->email().'?subject='.$event->get('EVT_name').esc_html__(' Event', 'event_espresso').'">'.$attendee->email().'</a>';
1023
+									$this->_template_args['event_attendees'][$registration->ID()]['address'] 		= implode(',<br>', $attendee->full_address_as_array());
1024 1024
 								} else {
1025 1025
 									$this->_template_args['event_attendees'][$registration->ID()]['att_id'] 			= '';
1026 1026
 									$this->_template_args['event_attendees'][$registration->ID()]['attendee'] 	= '';
1027
-									$this->_template_args['event_attendees'][$registration->ID()]['email'] 			= '';
1027
+									$this->_template_args['event_attendees'][$registration->ID()]['email'] = '';
1028 1028
 									$this->_template_args['event_attendees'][$registration->ID()]['address'] 		= '';
1029 1029
 								}
1030 1030
 							}
@@ -1034,12 +1034,12 @@  discard block
 block discarded – undo
1034 1034
 				}
1035 1035
 			}
1036 1036
 
1037
-			$this->_template_args['transaction_form_url'] = add_query_arg( array( 'action' => 'edit_transaction', 'process' => 'attendees'  ), TXN_ADMIN_URL );
1038
-			echo EEH_Template::display_template( TXN_TEMPLATE_PATH . 'txn_admin_details_main_meta_box_attendees.template.php', $this->_template_args, TRUE );
1037
+			$this->_template_args['transaction_form_url'] = add_query_arg(array('action' => 'edit_transaction', 'process' => 'attendees'), TXN_ADMIN_URL);
1038
+			echo EEH_Template::display_template(TXN_TEMPLATE_PATH.'txn_admin_details_main_meta_box_attendees.template.php', $this->_template_args, TRUE);
1039 1039
 
1040 1040
 		} else {
1041 1041
 			echo sprintf(
1042
-				esc_html__( '%1$sFor some reason, there are no attendees registered for this transaction. Likely the registration was abandoned in process.%2$s', 'event_espresso' ),
1042
+				esc_html__('%1$sFor some reason, there are no attendees registered for this transaction. Likely the registration was abandoned in process.%2$s', 'event_espresso'),
1043 1043
 				'<p class="important-notice">',
1044 1044
 				'</p>'
1045 1045
 			);
@@ -1058,19 +1058,19 @@  discard block
 block discarded – undo
1058 1058
 	 */
1059 1059
 	public function txn_registrant_side_meta_box() {
1060 1060
 		$primary_att = $this->_transaction->primary_registration() instanceof EE_Registration ? $this->_transaction->primary_registration()->get_first_related('Attendee') : null;
1061
-		if ( ! $primary_att instanceof EE_Attendee ) {
1061
+		if ( ! $primary_att instanceof EE_Attendee) {
1062 1062
 			$this->_template_args['no_attendee_message'] = esc_html__('There is no attached contact for this transaction.  The transaction either failed due to an error or was abandoned.', 'event_espresso');
1063 1063
 			$primary_att = EEM_Attendee::instance()->create_default_object();
1064 1064
 		}
1065
-		$this->_template_args['ATT_ID'] 						= $primary_att->ID();
1065
+		$this->_template_args['ATT_ID'] = $primary_att->ID();
1066 1066
 		$this->_template_args['prime_reg_fname']		= $primary_att->fname();
1067 1067
 		$this->_template_args['prime_reg_lname']		= $primary_att->lname();
1068
-		$this->_template_args['prime_reg_email'] 		= $primary_att->email();
1068
+		$this->_template_args['prime_reg_email'] = $primary_att->email();
1069 1069
 		$this->_template_args['prime_reg_phone'] 	= $primary_att->phone();
1070
-		$this->_template_args['edit_attendee_url'] 	= EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'edit_attendee', 'post' => $primary_att->ID()  ), REG_ADMIN_URL );
1070
+		$this->_template_args['edit_attendee_url'] = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'edit_attendee', 'post' => $primary_att->ID()), REG_ADMIN_URL);
1071 1071
 		// get formatted address for registrant
1072
-		$this->_template_args[ 'formatted_address' ] = EEH_Address::format( $primary_att );
1073
-		echo EEH_Template::display_template( TXN_TEMPLATE_PATH . 'txn_admin_details_side_meta_box_registrant.template.php', $this->_template_args, TRUE );
1072
+		$this->_template_args['formatted_address'] = EEH_Address::format($primary_att);
1073
+		echo EEH_Template::display_template(TXN_TEMPLATE_PATH.'txn_admin_details_side_meta_box_registrant.template.php', $this->_template_args, TRUE);
1074 1074
 	}
1075 1075
 
1076 1076
 
@@ -1086,12 +1086,12 @@  discard block
 block discarded – undo
1086 1086
 
1087 1087
 		$this->_template_args['billing_form'] = $this->_transaction->billing_info();
1088 1088
 		$this->_template_args['billing_form_url'] = add_query_arg(
1089
-			array( 'action' => 'edit_transaction', 'process' => 'billing'  ),
1089
+			array('action' => 'edit_transaction', 'process' => 'billing'),
1090 1090
 			TXN_ADMIN_URL
1091 1091
 		);
1092 1092
 
1093
-		$template_path = TXN_TEMPLATE_PATH . 'txn_admin_details_side_meta_box_billing_info.template.php';
1094
-		echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE );/**/
1093
+		$template_path = TXN_TEMPLATE_PATH.'txn_admin_details_side_meta_box_billing_info.template.php';
1094
+		echo EEH_Template::display_template($template_path, $this->_template_args, TRUE); /**/
1095 1095
 	}
1096 1096
 
1097 1097
 
@@ -1104,42 +1104,42 @@  discard block
 block discarded – undo
1104 1104
 	*	@return void
1105 1105
 	*/
1106 1106
 	public function apply_payments_or_refunds() {
1107
-		$json_response_data = array( 'return_data' => FALSE );
1107
+		$json_response_data = array('return_data' => FALSE);
1108 1108
 		$valid_data = $this->_validate_payment_request_data();
1109
-		if ( ! empty( $valid_data ) ) {
1110
-			$PAY_ID = $valid_data[ 'PAY_ID' ];
1109
+		if ( ! empty($valid_data)) {
1110
+			$PAY_ID = $valid_data['PAY_ID'];
1111 1111
 			//save  the new payment
1112
-			$payment = $this->_create_payment_from_request_data( $valid_data );
1112
+			$payment = $this->_create_payment_from_request_data($valid_data);
1113 1113
 			// get the TXN for this payment
1114 1114
 			$transaction = $payment->transaction();
1115 1115
 			// verify transaction
1116
-			if ( $transaction instanceof EE_Transaction ) {
1116
+			if ($transaction instanceof EE_Transaction) {
1117 1117
 				// calculate_total_payments_and_update_status
1118
-				$this->_process_transaction_payments( $transaction );
1119
-				$REG_IDs = $this->_get_REG_IDs_to_apply_payment_to( $payment );
1120
-				$this->_remove_existing_registration_payments( $payment, $PAY_ID );
1118
+				$this->_process_transaction_payments($transaction);
1119
+				$REG_IDs = $this->_get_REG_IDs_to_apply_payment_to($payment);
1120
+				$this->_remove_existing_registration_payments($payment, $PAY_ID);
1121 1121
 				// apply payment to registrations (if applicable)
1122
-				if ( ! empty( $REG_IDs ) ) {
1123
-					$this->_update_registration_payments( $transaction, $payment, $REG_IDs );
1122
+				if ( ! empty($REG_IDs)) {
1123
+					$this->_update_registration_payments($transaction, $payment, $REG_IDs);
1124 1124
 					$this->_maybe_send_notifications();
1125 1125
 					// now process status changes for the same registrations
1126
-					$this->_process_registration_status_change( $transaction, $REG_IDs );
1126
+					$this->_process_registration_status_change($transaction, $REG_IDs);
1127 1127
 				}
1128
-				$this->_maybe_send_notifications( $payment );
1128
+				$this->_maybe_send_notifications($payment);
1129 1129
 				//prepare to render page
1130
-				$json_response_data[ 'return_data' ] = $this->_build_payment_json_response( $payment, $REG_IDs );
1131
-				do_action( 'AHEE__Transactions_Admin_Page__apply_payments_or_refund__after_recording', $transaction, $payment );
1130
+				$json_response_data['return_data'] = $this->_build_payment_json_response($payment, $REG_IDs);
1131
+				do_action('AHEE__Transactions_Admin_Page__apply_payments_or_refund__after_recording', $transaction, $payment);
1132 1132
 			} else {
1133 1133
 				EE_Error::add_error(
1134
-					esc_html__( 'A valid Transaction for this payment could not be retrieved.', 'event_espresso' ),
1134
+					esc_html__('A valid Transaction for this payment could not be retrieved.', 'event_espresso'),
1135 1135
 					__FILE__, __FUNCTION__, __LINE__
1136 1136
 				);
1137 1137
 			}
1138 1138
 		} else {
1139
-			EE_Error::add_error( esc_html__( 'The payment form data could not be processed. Please try again.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
1139
+			EE_Error::add_error(esc_html__('The payment form data could not be processed. Please try again.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1140 1140
 		}
1141 1141
 
1142
-		$notices = EE_Error::get_notices( false, false, false );
1142
+		$notices = EE_Error::get_notices(false, false, false);
1143 1143
 		$this->_template_args = array(
1144 1144
 			'data' => $json_response_data,
1145 1145
 			'error' => $notices['errors'],
@@ -1156,30 +1156,30 @@  discard block
 block discarded – undo
1156 1156
 	 * @return array
1157 1157
 	 */
1158 1158
 	protected function _validate_payment_request_data() {
1159
-		if ( ! isset( $this->_req_data[ 'txn_admin_payment' ] ) ) {
1159
+		if ( ! isset($this->_req_data['txn_admin_payment'])) {
1160 1160
 			return false;
1161 1161
 		}
1162 1162
 		$payment_form = $this->_generate_payment_form_section();
1163 1163
 		try {
1164
-			if ( $payment_form->was_submitted() ) {
1164
+			if ($payment_form->was_submitted()) {
1165 1165
 				$payment_form->receive_form_submission();
1166
-				if ( ! $payment_form->is_valid() ) {
1166
+				if ( ! $payment_form->is_valid()) {
1167 1167
 					$submission_error_messages = array();
1168
-					foreach ( $payment_form->get_validation_errors_accumulated() as $validation_error ) {
1169
-						if ( $validation_error instanceof EE_Validation_Error ) {
1168
+					foreach ($payment_form->get_validation_errors_accumulated() as $validation_error) {
1169
+						if ($validation_error instanceof EE_Validation_Error) {
1170 1170
 							$submission_error_messages[] = sprintf(
1171
-								_x( '%s : %s', 'Form Section Name : Form Validation Error', 'event_espresso' ),
1171
+								_x('%s : %s', 'Form Section Name : Form Validation Error', 'event_espresso'),
1172 1172
 								$validation_error->get_form_section()->html_label_text(),
1173 1173
 								$validation_error->getMessage()
1174 1174
 							);
1175 1175
 						}
1176 1176
 					}
1177
-					EE_Error::add_error( join( '<br />', $submission_error_messages ), __FILE__, __FUNCTION__, __LINE__ );
1177
+					EE_Error::add_error(join('<br />', $submission_error_messages), __FILE__, __FUNCTION__, __LINE__);
1178 1178
 					return array();
1179 1179
 				}
1180 1180
 			}
1181
-		} catch ( EE_Error $e ) {
1182
-			EE_Error::add_error( $e->getMessage(), __FILE__, __FUNCTION__, __LINE__ );
1181
+		} catch (EE_Error $e) {
1182
+			EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__);
1183 1183
 			return array();
1184 1184
 		}
1185 1185
 		return $payment_form->valid_data();
@@ -1201,63 +1201,63 @@  discard block
 block discarded – undo
1201 1201
 						array(
1202 1202
 							'default' => 0,
1203 1203
 							'required' => false,
1204
-							'html_label_text' => esc_html__( 'Payment ID', 'event_espresso' ),
1205
-							'validation_strategies' => array( new EE_Int_Normalization() )
1204
+							'html_label_text' => esc_html__('Payment ID', 'event_espresso'),
1205
+							'validation_strategies' => array(new EE_Int_Normalization())
1206 1206
 						)
1207 1207
 					),
1208 1208
 					'TXN_ID' => new EE_Text_Input(
1209 1209
 						array(
1210 1210
 							'default' => 0,
1211 1211
 							'required' => true,
1212
-							'html_label_text' => esc_html__( 'Transaction ID', 'event_espresso' ),
1213
-							'validation_strategies' => array( new EE_Int_Normalization() )
1212
+							'html_label_text' => esc_html__('Transaction ID', 'event_espresso'),
1213
+							'validation_strategies' => array(new EE_Int_Normalization())
1214 1214
 						)
1215 1215
 					),
1216 1216
 					'type' => new EE_Text_Input(
1217 1217
 						array(
1218 1218
 							'default' => 1,
1219 1219
 							'required' => true,
1220
-							'html_label_text' => esc_html__( 'Payment or Refund', 'event_espresso' ),
1221
-							'validation_strategies' => array( new EE_Int_Normalization() )
1220
+							'html_label_text' => esc_html__('Payment or Refund', 'event_espresso'),
1221
+							'validation_strategies' => array(new EE_Int_Normalization())
1222 1222
 						)
1223 1223
 					),
1224 1224
 					'amount' => new EE_Text_Input(
1225 1225
 						array(
1226 1226
 							'default' => 0,
1227 1227
 							'required' => true,
1228
-							'html_label_text' => esc_html__( 'Payment amount', 'event_espresso' ),
1229
-							'validation_strategies' => array( new EE_Float_Normalization() )
1228
+							'html_label_text' => esc_html__('Payment amount', 'event_espresso'),
1229
+							'validation_strategies' => array(new EE_Float_Normalization())
1230 1230
 						)
1231 1231
 					),
1232 1232
 					'status' => new EE_Text_Input(
1233 1233
 						array(
1234 1234
 							'default' => EEM_Payment::status_id_approved,
1235 1235
 							'required' => true,
1236
-							'html_label_text' => esc_html__( 'Payment status', 'event_espresso' ),
1236
+							'html_label_text' => esc_html__('Payment status', 'event_espresso'),
1237 1237
 						)
1238 1238
 					),
1239 1239
 					'PMD_ID' => new EE_Text_Input(
1240 1240
 						array(
1241 1241
 							'default' => 2,
1242 1242
 							'required' => true,
1243
-							'html_label_text' => esc_html__( 'Payment Method', 'event_espresso' ),
1244
-							'validation_strategies' => array( new EE_Int_Normalization() )
1243
+							'html_label_text' => esc_html__('Payment Method', 'event_espresso'),
1244
+							'validation_strategies' => array(new EE_Int_Normalization())
1245 1245
 						)
1246 1246
 					),
1247 1247
 					'date' => new EE_Text_Input(
1248 1248
 						array(
1249 1249
 							'default' => time(),
1250 1250
 							'required' => true,
1251
-							'html_label_text' => esc_html__( 'Payment date', 'event_espresso' ),
1251
+							'html_label_text' => esc_html__('Payment date', 'event_espresso'),
1252 1252
 						)
1253 1253
 					),
1254 1254
 					'txn_id_chq_nmbr' => new EE_Text_Input(
1255 1255
 						array(
1256 1256
 							'default' => '',
1257 1257
 							'required' => false,
1258
-							'html_label_text' => esc_html__( 'Transaction or Cheque Number', 'event_espresso' ),
1258
+							'html_label_text' => esc_html__('Transaction or Cheque Number', 'event_espresso'),
1259 1259
                                                         'validation_strategies' => array(
1260
-                                                            new EE_Max_Length_Validation_Strategy( esc_html__('Input too long', 'event_espresso'), 100 ),
1260
+                                                            new EE_Max_Length_Validation_Strategy(esc_html__('Input too long', 'event_espresso'), 100),
1261 1261
                                                         )
1262 1262
 						)
1263 1263
 					),
@@ -1265,9 +1265,9 @@  discard block
 block discarded – undo
1265 1265
 						array(
1266 1266
 							'default' => '',
1267 1267
 							'required' => false,
1268
-							'html_label_text' => esc_html__( 'Purchase Order Number', 'event_espresso' ),
1268
+							'html_label_text' => esc_html__('Purchase Order Number', 'event_espresso'),
1269 1269
                                                         'validation_strategies' => array(
1270
-                                                            new EE_Max_Length_Validation_Strategy( esc_html__('Input too long', 'event_espresso'), 100 ),
1270
+                                                            new EE_Max_Length_Validation_Strategy(esc_html__('Input too long', 'event_espresso'), 100),
1271 1271
                                                         )
1272 1272
 						)
1273 1273
 					),
@@ -1275,9 +1275,9 @@  discard block
 block discarded – undo
1275 1275
 						array(
1276 1276
 							'default' => '',
1277 1277
 							'required' => false,
1278
-							'html_label_text' => esc_html__( 'Extra Field for Accounting', 'event_espresso' ),
1278
+							'html_label_text' => esc_html__('Extra Field for Accounting', 'event_espresso'),
1279 1279
                                                         'validation_strategies' => array(
1280
-                                                            new EE_Max_Length_Validation_Strategy( esc_html__('Input too long', 'event_espresso'), 100 ),
1280
+                                                            new EE_Max_Length_Validation_Strategy(esc_html__('Input too long', 'event_espresso'), 100),
1281 1281
                                                         )
1282 1282
 						)
1283 1283
 					),
@@ -1294,37 +1294,37 @@  discard block
 block discarded – undo
1294 1294
 	 * @param array $valid_data
1295 1295
 	 * @return EE_Payment
1296 1296
 	 */
1297
-	protected function _create_payment_from_request_data( $valid_data ) {
1298
-		$PAY_ID = $valid_data[ 'PAY_ID' ];
1297
+	protected function _create_payment_from_request_data($valid_data) {
1298
+		$PAY_ID = $valid_data['PAY_ID'];
1299 1299
 		// get payment amount
1300
-		$amount = $valid_data[ 'amount' ] ? abs( $valid_data[ 'amount' ] ) : 0;
1300
+		$amount = $valid_data['amount'] ? abs($valid_data['amount']) : 0;
1301 1301
 		// payments have a type value of 1 and refunds have a type value of -1
1302 1302
 		// so multiplying amount by type will give a positive value for payments, and negative values for refunds
1303
-		$amount = $valid_data[ 'type' ] < 0 ? $amount * -1 : $amount;
1303
+		$amount = $valid_data['type'] < 0 ? $amount * -1 : $amount;
1304 1304
 		// for some reason the date string coming in has extra spaces between the date and time.  This fixes that.
1305
-		$date = $valid_data['date'] ? preg_replace( '/\s+/', ' ', $valid_data['date'] ) : date( 'Y-m-d g:i a', current_time( 'timestamp' ) );
1305
+		$date = $valid_data['date'] ? preg_replace('/\s+/', ' ', $valid_data['date']) : date('Y-m-d g:i a', current_time('timestamp'));
1306 1306
 		$payment = EE_Payment::new_instance(
1307 1307
 			array(
1308
-				'TXN_ID' 								=> $valid_data[ 'TXN_ID' ],
1309
-				'STS_ID' 								=> $valid_data[ 'status' ],
1308
+				'TXN_ID' 								=> $valid_data['TXN_ID'],
1309
+				'STS_ID' 								=> $valid_data['status'],
1310 1310
 				'PAY_timestamp' 				=> $date,
1311 1311
 				'PAY_source'           			=> EEM_Payment_Method::scope_admin,
1312
-				'PMD_ID'               				=> $valid_data[ 'PMD_ID' ],
1312
+				'PMD_ID'               				=> $valid_data['PMD_ID'],
1313 1313
 				'PAY_amount'           			=> $amount,
1314
-				'PAY_txn_id_chq_nmbr'  	=> $valid_data[ 'txn_id_chq_nmbr' ],
1315
-				'PAY_po_number'        		=> $valid_data[ 'po_number' ],
1316
-				'PAY_extra_accntng'    		=> $valid_data[ 'accounting' ],
1314
+				'PAY_txn_id_chq_nmbr'  	=> $valid_data['txn_id_chq_nmbr'],
1315
+				'PAY_po_number'        		=> $valid_data['po_number'],
1316
+				'PAY_extra_accntng'    		=> $valid_data['accounting'],
1317 1317
 				'PAY_details'          				=> $valid_data,
1318 1318
 				'PAY_ID'               				=> $PAY_ID
1319 1319
 			),
1320 1320
 			'',
1321
-			array( 'Y-m-d', 'g:i a' )
1321
+			array('Y-m-d', 'g:i a')
1322 1322
 		);
1323 1323
 
1324
-		if ( ! $payment->save() ) {
1324
+		if ( ! $payment->save()) {
1325 1325
 			EE_Error::add_error(
1326 1326
 				sprintf(
1327
-					esc_html__( 'Payment %1$d has not been successfully saved to the database.', 'event_espresso' ),
1327
+					esc_html__('Payment %1$d has not been successfully saved to the database.', 'event_espresso'),
1328 1328
 					$payment->ID()
1329 1329
 				),
1330 1330
 				__FILE__, __FUNCTION__, __LINE__
@@ -1341,15 +1341,15 @@  discard block
 block discarded – undo
1341 1341
 	 * @param \EE_Transaction $transaction
1342 1342
 	 * @return array
1343 1343
 	 */
1344
-	protected function _process_transaction_payments( EE_Transaction $transaction ) {
1344
+	protected function _process_transaction_payments(EE_Transaction $transaction) {
1345 1345
 		/** @type EE_Transaction_Payments $transaction_payments */
1346
-		$transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' );
1346
+		$transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments');
1347 1347
 		//update the transaction with this payment
1348
-		if ( $transaction_payments->calculate_total_payments_and_update_status( $transaction ) ) {
1349
-			EE_Error::add_success( esc_html__( 'The payment has been processed successfully.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
1348
+		if ($transaction_payments->calculate_total_payments_and_update_status($transaction)) {
1349
+			EE_Error::add_success(esc_html__('The payment has been processed successfully.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1350 1350
 		} else {
1351 1351
 			EE_Error::add_error(
1352
-				esc_html__( 'The payment was processed successfully but the amount paid for the transaction was not updated.', 'event_espresso' )
1352
+				esc_html__('The payment was processed successfully but the amount paid for the transaction was not updated.', 'event_espresso')
1353 1353
 				, __FILE__, __FUNCTION__, __LINE__
1354 1354
 			);
1355 1355
 		}
@@ -1365,19 +1365,19 @@  discard block
 block discarded – undo
1365 1365
 	 * @param \EE_Payment $payment
1366 1366
 	 * @return array
1367 1367
 	 */
1368
-	protected function _get_REG_IDs_to_apply_payment_to( EE_Payment $payment ) {
1368
+	protected function _get_REG_IDs_to_apply_payment_to(EE_Payment $payment) {
1369 1369
 		$REG_IDs = array();
1370 1370
 		// grab array of IDs for specific registrations to apply changes to
1371
-		if ( isset( $this->_req_data[ 'txn_admin_payment' ][ 'registrations' ] ) ) {
1372
-			$REG_IDs = (array)$this->_req_data[ 'txn_admin_payment' ][ 'registrations' ];
1371
+		if (isset($this->_req_data['txn_admin_payment']['registrations'])) {
1372
+			$REG_IDs = (array) $this->_req_data['txn_admin_payment']['registrations'];
1373 1373
 		}
1374 1374
 		//nothing specified ? then get all reg IDs
1375
-		if ( empty( $REG_IDs ) ) {
1375
+		if (empty($REG_IDs)) {
1376 1376
 			$registrations = $payment->transaction()->registrations();
1377
-			$REG_IDs = ! empty( $registrations ) ? array_keys( $registrations ) : $this->_get_existing_reg_payment_REG_IDs( $payment );
1377
+			$REG_IDs = ! empty($registrations) ? array_keys($registrations) : $this->_get_existing_reg_payment_REG_IDs($payment);
1378 1378
 		}
1379 1379
 		// ensure that REG_IDs are integers and NOT strings
1380
-		return array_map( 'intval', $REG_IDs );
1380
+		return array_map('intval', $REG_IDs);
1381 1381
 	}
1382 1382
 
1383 1383
 
@@ -1394,7 +1394,7 @@  discard block
 block discarded – undo
1394 1394
 	/**
1395 1395
 	 * @param array $existing_reg_payment_REG_IDs
1396 1396
 	 */
1397
-	public function set_existing_reg_payment_REG_IDs( $existing_reg_payment_REG_IDs = null ) {
1397
+	public function set_existing_reg_payment_REG_IDs($existing_reg_payment_REG_IDs = null) {
1398 1398
 		$this->_existing_reg_payment_REG_IDs = $existing_reg_payment_REG_IDs;
1399 1399
 	}
1400 1400
 
@@ -1409,13 +1409,13 @@  discard block
 block discarded – undo
1409 1409
 	 * @param \EE_Payment $payment
1410 1410
 	 * @return array
1411 1411
 	 */
1412
-	protected function _get_existing_reg_payment_REG_IDs( EE_Payment $payment ) {
1413
-		if ( $this->existing_reg_payment_REG_IDs() === null ) {
1412
+	protected function _get_existing_reg_payment_REG_IDs(EE_Payment $payment) {
1413
+		if ($this->existing_reg_payment_REG_IDs() === null) {
1414 1414
 			// let's get any existing reg payment records for this payment
1415
-			$existing_reg_payment_REG_IDs = $payment->get_many_related( 'Registration' );
1415
+			$existing_reg_payment_REG_IDs = $payment->get_many_related('Registration');
1416 1416
 			// but we only want the REG IDs, so grab the array keys
1417
-			$existing_reg_payment_REG_IDs = ! empty( $existing_reg_payment_REG_IDs ) ? array_keys( $existing_reg_payment_REG_IDs ) : array();
1418
-			$this->set_existing_reg_payment_REG_IDs( $existing_reg_payment_REG_IDs );
1417
+			$existing_reg_payment_REG_IDs = ! empty($existing_reg_payment_REG_IDs) ? array_keys($existing_reg_payment_REG_IDs) : array();
1418
+			$this->set_existing_reg_payment_REG_IDs($existing_reg_payment_REG_IDs);
1419 1419
 		}
1420 1420
 		return $this->existing_reg_payment_REG_IDs();
1421 1421
 	}
@@ -1434,23 +1434,23 @@  discard block
 block discarded – undo
1434 1434
 	 * @param int         $PAY_ID
1435 1435
 	 * @return bool;
1436 1436
 	 */
1437
-	protected function _remove_existing_registration_payments( EE_Payment $payment, $PAY_ID = 0 ) {
1437
+	protected function _remove_existing_registration_payments(EE_Payment $payment, $PAY_ID = 0) {
1438 1438
 		// newly created payments will have nothing recorded for $PAY_ID
1439
-		if ( $PAY_ID == 0 ) {
1439
+		if ($PAY_ID == 0) {
1440 1440
 			return false;
1441 1441
 		}
1442
-		$existing_reg_payment_REG_IDs = $this->_get_existing_reg_payment_REG_IDs( $payment );
1443
-		if ( empty( $existing_reg_payment_REG_IDs )) {
1442
+		$existing_reg_payment_REG_IDs = $this->_get_existing_reg_payment_REG_IDs($payment);
1443
+		if (empty($existing_reg_payment_REG_IDs)) {
1444 1444
 			return false;
1445 1445
 		}
1446 1446
 		/** @type EE_Transaction_Payments $transaction_payments */
1447
-		$transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' );
1447
+		$transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments');
1448 1448
 		return $transaction_payments->delete_registration_payments_and_update_registrations(
1449 1449
 			$payment,
1450 1450
 			array(
1451 1451
 				array(
1452 1452
 					'PAY_ID' => $payment->ID(),
1453
-					'REG_ID' => array( 'IN', $existing_reg_payment_REG_IDs ),
1453
+					'REG_ID' => array('IN', $existing_reg_payment_REG_IDs),
1454 1454
 				)
1455 1455
 			)
1456 1456
 		);
@@ -1469,25 +1469,25 @@  discard block
 block discarded – undo
1469 1469
 	 * @param array $REG_IDs
1470 1470
 	 * @return bool
1471 1471
 	 */
1472
-	protected function _update_registration_payments( EE_Transaction $transaction, EE_Payment $payment, $REG_IDs = array() ) {
1472
+	protected function _update_registration_payments(EE_Transaction $transaction, EE_Payment $payment, $REG_IDs = array()) {
1473 1473
 		// we can pass our own custom set of registrations to EE_Payment_Processor::process_registration_payments()
1474 1474
 		// so let's do that using our set of REG_IDs from the form
1475 1475
 		$registration_query_where_params = array(
1476
-			'REG_ID' => array( 'IN', $REG_IDs )
1476
+			'REG_ID' => array('IN', $REG_IDs)
1477 1477
 		);
1478 1478
 		// but add in some conditions regarding payment,
1479 1479
 		// so that we don't apply payments to registrations that are free or have already been paid for
1480 1480
 		// but ONLY if the payment is NOT a refund ( ie: the payment amount is not negative )
1481
-		if ( ! $payment->is_a_refund() ) {
1482
-			$registration_query_where_params[ 'REG_final_price' ]  = array( '!=', 0 );
1483
-			$registration_query_where_params[ 'REG_final_price*' ]  = array( '!=', 'REG_paid', true );
1481
+		if ( ! $payment->is_a_refund()) {
1482
+			$registration_query_where_params['REG_final_price'] = array('!=', 0);
1483
+			$registration_query_where_params['REG_final_price*'] = array('!=', 'REG_paid', true);
1484 1484
 		}
1485 1485
 		//EEH_Debug_Tools::printr( $registration_query_where_params, '$registration_query_where_params', __FILE__, __LINE__ );
1486
-		$registrations = $transaction->registrations( array( $registration_query_where_params ) );
1487
-		if ( ! empty( $registrations ) ) {
1486
+		$registrations = $transaction->registrations(array($registration_query_where_params));
1487
+		if ( ! empty($registrations)) {
1488 1488
 			/** @type EE_Payment_Processor $payment_processor */
1489
-			$payment_processor = EE_Registry::instance()->load_core( 'Payment_Processor' );
1490
-			$payment_processor->process_registration_payments( $transaction, $payment, $registrations );
1489
+			$payment_processor = EE_Registry::instance()->load_core('Payment_Processor');
1490
+			$payment_processor->process_registration_payments($transaction, $payment, $registrations);
1491 1491
 		}
1492 1492
 	}
1493 1493
 
@@ -1503,22 +1503,22 @@  discard block
 block discarded – undo
1503 1503
 	 * @param array $REG_IDs
1504 1504
 	 * @return bool
1505 1505
 	 */
1506
-	protected function _process_registration_status_change( EE_Transaction $transaction, $REG_IDs = array() ) {
1506
+	protected function _process_registration_status_change(EE_Transaction $transaction, $REG_IDs = array()) {
1507 1507
 		// first if there is no change in status then we get out.
1508 1508
 		if (
1509
-			! isset( $this->_req_data['txn_reg_status_change'], $this->_req_data[ 'txn_reg_status_change' ][ 'reg_status' ] )
1509
+			! isset($this->_req_data['txn_reg_status_change'], $this->_req_data['txn_reg_status_change']['reg_status'])
1510 1510
 			|| $this->_req_data['txn_reg_status_change']['reg_status'] == 'NAN'
1511 1511
 		) {
1512 1512
 			//no error message, no change requested, just nothing to do man.
1513 1513
 			return FALSE;
1514 1514
 		}
1515 1515
 		/** @type EE_Transaction_Processor $transaction_processor */
1516
-		$transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' );
1516
+		$transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor');
1517 1517
 		// made it here dude?  Oh WOW.  K, let's take care of changing the statuses
1518 1518
 		return $transaction_processor->manually_update_registration_statuses(
1519 1519
 			$transaction,
1520
-			sanitize_text_field( $this->_req_data[ 'txn_reg_status_change' ][ 'reg_status' ] ),
1521
-			array( array( 'REG_ID' => array( 'IN', $REG_IDs ) ) )
1520
+			sanitize_text_field($this->_req_data['txn_reg_status_change']['reg_status']),
1521
+			array(array('REG_ID' => array('IN', $REG_IDs)))
1522 1522
 		);
1523 1523
 	}
1524 1524
 
@@ -1533,16 +1533,16 @@  discard block
 block discarded – undo
1533 1533
 	 * @param bool | null        $delete_txn_reg_status_change
1534 1534
 	 * @return array
1535 1535
 	 */
1536
-	protected function _build_payment_json_response( EE_Payment $payment, $REG_IDs = array(), $delete_txn_reg_status_change = null ) {
1536
+	protected function _build_payment_json_response(EE_Payment $payment, $REG_IDs = array(), $delete_txn_reg_status_change = null) {
1537 1537
 		// was the payment deleted ?
1538
-		if ( is_bool( $delete_txn_reg_status_change )) {
1538
+		if (is_bool($delete_txn_reg_status_change)) {
1539 1539
 			return array(
1540 1540
 				'PAY_ID' 				=> $payment->ID(),
1541 1541
 				'amount' 			=> $payment->amount(),
1542 1542
 				'total_paid' 			=> $payment->transaction()->paid(),
1543 1543
 				'txn_status' 			=> $payment->transaction()->status_ID(),
1544 1544
 				'pay_status' 		=> $payment->STS_ID(),
1545
-				'registrations' 	=> $this->_registration_payment_data_array( $REG_IDs ),
1545
+				'registrations' 	=> $this->_registration_payment_data_array($REG_IDs),
1546 1546
 				'delete_txn_reg_status_change' => $delete_txn_reg_status_change,
1547 1547
 			);
1548 1548
 		} else {
@@ -1554,16 +1554,16 @@  discard block
 block discarded – undo
1554 1554
 				'pay_status' 	=> $payment->STS_ID(),
1555 1555
 				'PAY_ID'           => $payment->ID(),
1556 1556
 				'STS_ID' 			=> $payment->STS_ID(),
1557
-				'status' 			=> self::$_pay_status[ $payment->STS_ID() ],
1558
-				'date' 				=> $payment->timestamp( 'Y-m-d', 'h:i a' ),
1559
-				'method' 		=> strtoupper( $payment->source() ),
1557
+				'status' 			=> self::$_pay_status[$payment->STS_ID()],
1558
+				'date' 				=> $payment->timestamp('Y-m-d', 'h:i a'),
1559
+				'method' 		=> strtoupper($payment->source()),
1560 1560
 				'PM_ID' 			=> $payment->payment_method() ? $payment->payment_method()->ID() : 1,
1561
-				'gateway' 		=> $payment->payment_method() ? $payment->payment_method()->admin_name() : esc_html__( "Unknown", 'event_espresso' ),
1561
+				'gateway' 		=> $payment->payment_method() ? $payment->payment_method()->admin_name() : esc_html__("Unknown", 'event_espresso'),
1562 1562
 				'gateway_response' 	=> $payment->gateway_response(),
1563 1563
 				'txn_id_chq_nmbr'  	=> $payment->txn_id_chq_nmbr(),
1564 1564
 				'po_number'        		=> $payment->po_number(),
1565 1565
 				'extra_accntng'    		=> $payment->extra_accntng(),
1566
-				'registrations'    			=> $this->_registration_payment_data_array( $REG_IDs ),
1566
+				'registrations'    			=> $this->_registration_payment_data_array($REG_IDs),
1567 1567
 			);
1568 1568
 		}
1569 1569
 	}
@@ -1578,39 +1578,39 @@  discard block
 block discarded – undo
1578 1578
 	*	@return void
1579 1579
 	*/
1580 1580
 	public function delete_payment() {
1581
-		$json_response_data = array( 'return_data' => FALSE );
1582
-		$PAY_ID = isset( $this->_req_data['delete_txn_admin_payment'], $this->_req_data['delete_txn_admin_payment']['PAY_ID'] ) ? absint( $this->_req_data['delete_txn_admin_payment']['PAY_ID'] ) : 0;
1583
-		if ( $PAY_ID ) {
1584
-			$delete_txn_reg_status_change = isset( $this->_req_data[ 'delete_txn_reg_status_change' ] ) ? $this->_req_data[ 'delete_txn_reg_status_change' ] : false;
1585
-			$payment = EEM_Payment::instance()->get_one_by_ID( $PAY_ID );
1586
-			if ( $payment instanceof EE_Payment ) {
1587
-				$REG_IDs = $this->_get_existing_reg_payment_REG_IDs( $payment );
1581
+		$json_response_data = array('return_data' => FALSE);
1582
+		$PAY_ID = isset($this->_req_data['delete_txn_admin_payment'], $this->_req_data['delete_txn_admin_payment']['PAY_ID']) ? absint($this->_req_data['delete_txn_admin_payment']['PAY_ID']) : 0;
1583
+		if ($PAY_ID) {
1584
+			$delete_txn_reg_status_change = isset($this->_req_data['delete_txn_reg_status_change']) ? $this->_req_data['delete_txn_reg_status_change'] : false;
1585
+			$payment = EEM_Payment::instance()->get_one_by_ID($PAY_ID);
1586
+			if ($payment instanceof EE_Payment) {
1587
+				$REG_IDs = $this->_get_existing_reg_payment_REG_IDs($payment);
1588 1588
 				/** @type EE_Transaction_Payments $transaction_payments */
1589
-				$transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' );
1590
-				if ( $transaction_payments->delete_payment_and_update_transaction( $payment )) {
1591
-					$json_response_data['return_data'] = $this->_build_payment_json_response( $payment, $REG_IDs, $delete_txn_reg_status_change );
1592
-					if ( $delete_txn_reg_status_change ) {
1589
+				$transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments');
1590
+				if ($transaction_payments->delete_payment_and_update_transaction($payment)) {
1591
+					$json_response_data['return_data'] = $this->_build_payment_json_response($payment, $REG_IDs, $delete_txn_reg_status_change);
1592
+					if ($delete_txn_reg_status_change) {
1593 1593
 						$this->_req_data['txn_reg_status_change'] = $delete_txn_reg_status_change;
1594 1594
 						//MAKE sure we also add the delete_txn_req_status_change to the
1595 1595
 						//$_REQUEST global because that's how messages will be looking for it.
1596 1596
 						$_REQUEST['txn_reg_status_change'] = $delete_txn_reg_status_change;
1597 1597
 						$this->_maybe_send_notifications();
1598
-						$this->_process_registration_status_change( $payment->transaction(), $REG_IDs );
1598
+						$this->_process_registration_status_change($payment->transaction(), $REG_IDs);
1599 1599
 					}
1600 1600
 				}
1601 1601
 			} else {
1602 1602
 				EE_Error::add_error(
1603
-					esc_html__( 'Valid Payment data could not be retrieved from the database.', 'event_espresso' ),
1603
+					esc_html__('Valid Payment data could not be retrieved from the database.', 'event_espresso'),
1604 1604
 					__FILE__, __FUNCTION__, __LINE__
1605 1605
 				);
1606 1606
 			}
1607 1607
 		} else {
1608 1608
 			EE_Error::add_error(
1609
-				esc_html__( 'A valid Payment ID was not received, therefore payment form data could not be loaded.', 'event_espresso' ),
1609
+				esc_html__('A valid Payment ID was not received, therefore payment form data could not be loaded.', 'event_espresso'),
1610 1610
 				__FILE__, __FUNCTION__, __LINE__
1611 1611
 			);
1612 1612
 		}
1613
-		$notices = EE_Error::get_notices( false, false, false);
1613
+		$notices = EE_Error::get_notices(false, false, false);
1614 1614
 		$this->_template_args = array(
1615 1615
 			'data' => $json_response_data,
1616 1616
 			'success' => $notices['success'],
@@ -1630,16 +1630,16 @@  discard block
 block discarded – undo
1630 1630
 	 * @param array $REG_IDs
1631 1631
 	 * @return array
1632 1632
 	 */
1633
-	protected function _registration_payment_data_array( $REG_IDs ) {
1633
+	protected function _registration_payment_data_array($REG_IDs) {
1634 1634
 		$registration_payment_data = array();
1635 1635
 		//if non empty reg_ids lets get an array of registrations and update the values for the apply_payment/refund rows.
1636
-		if ( ! empty( $REG_IDs ) ) {
1637
-			$registrations = EEM_Registration::instance()->get_all( array( array( 'REG_ID' => array( 'IN', $REG_IDs ) ) ) );
1638
-			foreach ( $registrations as $registration ) {
1639
-				if ( $registration instanceof EE_Registration ) {
1640
-					$registration_payment_data[ $registration->ID() ] = array(
1636
+		if ( ! empty($REG_IDs)) {
1637
+			$registrations = EEM_Registration::instance()->get_all(array(array('REG_ID' => array('IN', $REG_IDs))));
1638
+			foreach ($registrations as $registration) {
1639
+				if ($registration instanceof EE_Registration) {
1640
+					$registration_payment_data[$registration->ID()] = array(
1641 1641
 						'paid' => $registration->pretty_paid(),
1642
-						'owing' => EEH_Template::format_currency( $registration->final_price() - $registration->paid() ),
1642
+						'owing' => EEH_Template::format_currency($registration->final_price() - $registration->paid()),
1643 1643
 					);
1644 1644
 				}
1645 1645
 			}
@@ -1659,30 +1659,30 @@  discard block
 block discarded – undo
1659 1659
 	 * @access protected
1660 1660
 	 * @param \EE_Payment | null $payment
1661 1661
 	 */
1662
-	protected function _maybe_send_notifications( $payment = null ) {
1663
-		switch ( $payment instanceof EE_Payment ) {
1662
+	protected function _maybe_send_notifications($payment = null) {
1663
+		switch ($payment instanceof EE_Payment) {
1664 1664
 			// payment notifications
1665 1665
 			case true :
1666 1666
 				if (
1667 1667
 					isset(
1668
-						$this->_req_data[ 'txn_payments' ],
1669
-						$this->_req_data[ 'txn_payments' ][ 'send_notifications' ]
1668
+						$this->_req_data['txn_payments'],
1669
+						$this->_req_data['txn_payments']['send_notifications']
1670 1670
 					) &&
1671
-					filter_var( $this->_req_data[ 'txn_payments' ][ 'send_notifications' ], FILTER_VALIDATE_BOOLEAN )
1671
+					filter_var($this->_req_data['txn_payments']['send_notifications'], FILTER_VALIDATE_BOOLEAN)
1672 1672
 				) {
1673
-					$this->_process_payment_notification( $payment );
1673
+					$this->_process_payment_notification($payment);
1674 1674
 				}
1675 1675
 				break;
1676 1676
 			// registration notifications
1677 1677
 			case false :
1678 1678
 				if (
1679 1679
 					isset(
1680
-						$this->_req_data[ 'txn_reg_status_change' ],
1681
-						$this->_req_data[ 'txn_reg_status_change' ][ 'send_notifications' ]
1680
+						$this->_req_data['txn_reg_status_change'],
1681
+						$this->_req_data['txn_reg_status_change']['send_notifications']
1682 1682
 					) &&
1683
-					filter_var( $this->_req_data[ 'txn_reg_status_change' ][ 'send_notifications' ], FILTER_VALIDATE_BOOLEAN )
1683
+					filter_var($this->_req_data['txn_reg_status_change']['send_notifications'], FILTER_VALIDATE_BOOLEAN)
1684 1684
 				) {
1685
-					add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true' );
1685
+					add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true');
1686 1686
 				}
1687 1687
 				break;
1688 1688
 		}
@@ -1698,11 +1698,11 @@  discard block
 block discarded – undo
1698 1698
 	*	@return void
1699 1699
 	*/
1700 1700
 	protected function _send_payment_reminder() {
1701
-	    $TXN_ID = ( ! empty( $this->_req_data['TXN_ID'] )) ? absint( $this->_req_data['TXN_ID'] ) : FALSE;
1702
-		$transaction = EEM_Transaction::instance()->get_one_by_ID( $TXN_ID );
1703
-		$query_args = isset($this->_req_data['redirect_to'] ) ? array('action' => $this->_req_data['redirect_to'], 'TXN_ID' => $this->_req_data['TXN_ID'] ) : array();
1704
-		do_action( 'AHEE__Transactions_Admin_Page___send_payment_reminder__process_admin_payment_reminder', $transaction );
1705
-		$this->_redirect_after_action( FALSE, esc_html__('payment reminder', 'event_espresso'), esc_html__('sent', 'event_espresso'), $query_args, TRUE );
1701
+	    $TXN_ID = ( ! empty($this->_req_data['TXN_ID'])) ? absint($this->_req_data['TXN_ID']) : FALSE;
1702
+		$transaction = EEM_Transaction::instance()->get_one_by_ID($TXN_ID);
1703
+		$query_args = isset($this->_req_data['redirect_to']) ? array('action' => $this->_req_data['redirect_to'], 'TXN_ID' => $this->_req_data['TXN_ID']) : array();
1704
+		do_action('AHEE__Transactions_Admin_Page___send_payment_reminder__process_admin_payment_reminder', $transaction);
1705
+		$this->_redirect_after_action(FALSE, esc_html__('payment reminder', 'event_espresso'), esc_html__('sent', 'event_espresso'), $query_args, TRUE);
1706 1706
 	}
1707 1707
 
1708 1708
 
@@ -1716,36 +1716,36 @@  discard block
 block discarded – undo
1716 1716
 	 * @param string   $view
1717 1717
 	 * @return mixed int = count || array of transaction objects
1718 1718
 	 */
1719
-	public function get_transactions( $perpage, $count = FALSE, $view = '' ) {
1719
+	public function get_transactions($perpage, $count = FALSE, $view = '') {
1720 1720
 
1721 1721
 		$TXN = EEM_Transaction::instance();
1722 1722
 
1723
-	    $start_date = isset( $this->_req_data['txn-filter-start-date'] ) ? wp_strip_all_tags( $this->_req_data['txn-filter-start-date'] ) : date( 'm/d/Y', strtotime( '-10 year' ));
1724
-	    $end_date = isset( $this->_req_data['txn-filter-end-date'] ) ? wp_strip_all_tags( $this->_req_data['txn-filter-end-date'] ) : date( 'm/d/Y' );
1723
+	    $start_date = isset($this->_req_data['txn-filter-start-date']) ? wp_strip_all_tags($this->_req_data['txn-filter-start-date']) : date('m/d/Y', strtotime('-10 year'));
1724
+	    $end_date = isset($this->_req_data['txn-filter-end-date']) ? wp_strip_all_tags($this->_req_data['txn-filter-end-date']) : date('m/d/Y');
1725 1725
 
1726 1726
 	    //make sure our timestamps start and end right at the boundaries for each day
1727
-	    $start_date = date( 'Y-m-d', strtotime( $start_date ) ) . ' 00:00:00';
1728
-	    $end_date = date( 'Y-m-d', strtotime( $end_date ) ) . ' 23:59:59';
1727
+	    $start_date = date('Y-m-d', strtotime($start_date)).' 00:00:00';
1728
+	    $end_date = date('Y-m-d', strtotime($end_date)).' 23:59:59';
1729 1729
 
1730 1730
 
1731 1731
 	    //convert to timestamps
1732
-	    $start_date = strtotime( $start_date );
1733
-	    $end_date = strtotime( $end_date );
1732
+	    $start_date = strtotime($start_date);
1733
+	    $end_date = strtotime($end_date);
1734 1734
 
1735 1735
 	    //makes sure start date is the lowest value and vice versa
1736
-	    $start_date = min( $start_date, $end_date );
1737
-	    $end_date = max( $start_date, $end_date );
1736
+	    $start_date = min($start_date, $end_date);
1737
+	    $end_date = max($start_date, $end_date);
1738 1738
 
1739 1739
 	    //convert to correct format for query
1740
-	$start_date = EEM_Transaction::instance()->convert_datetime_for_query( 'TXN_timestamp', date( 'Y-m-d H:i:s', $start_date ), 'Y-m-d H:i:s' );
1741
-	$end_date = EEM_Transaction::instance()->convert_datetime_for_query( 'TXN_timestamp', date( 'Y-m-d H:i:s', $end_date ), 'Y-m-d H:i:s' );
1740
+	$start_date = EEM_Transaction::instance()->convert_datetime_for_query('TXN_timestamp', date('Y-m-d H:i:s', $start_date), 'Y-m-d H:i:s');
1741
+	$end_date = EEM_Transaction::instance()->convert_datetime_for_query('TXN_timestamp', date('Y-m-d H:i:s', $end_date), 'Y-m-d H:i:s');
1742 1742
 
1743 1743
 
1744 1744
 
1745 1745
 	    //set orderby
1746 1746
 		$this->_req_data['orderby'] = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : '';
1747 1747
 
1748
-		switch ( $this->_req_data['orderby'] ) {
1748
+		switch ($this->_req_data['orderby']) {
1749 1749
 			case 'TXN_ID':
1750 1750
 				$orderby = 'TXN_ID';
1751 1751
 				break;
@@ -1759,66 +1759,66 @@  discard block
 block discarded – undo
1759 1759
 				$orderby = 'TXN_timestamp';
1760 1760
 		}
1761 1761
 
1762
-		$sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'DESC';
1763
-		$current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1;
1764
-		$per_page = isset( $perpage ) && !empty( $perpage ) ? $perpage : 10;
1765
-		$per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page;
1762
+		$sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'DESC';
1763
+		$current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1;
1764
+		$per_page = isset($perpage) && ! empty($perpage) ? $perpage : 10;
1765
+		$per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page;
1766 1766
 
1767
-		$offset = ($current_page-1)*$per_page;
1768
-		$limit = array( $offset, $per_page );
1767
+		$offset = ($current_page - 1) * $per_page;
1768
+		$limit = array($offset, $per_page);
1769 1769
 
1770 1770
 		$_where = array(
1771
-			'TXN_timestamp' => array('BETWEEN', array($start_date, $end_date) ),
1771
+			'TXN_timestamp' => array('BETWEEN', array($start_date, $end_date)),
1772 1772
 			'Registration.REG_count' => 1
1773 1773
 		);
1774 1774
 
1775
-		if ( isset( $this->_req_data['EVT_ID'] ) ) {
1775
+		if (isset($this->_req_data['EVT_ID'])) {
1776 1776
 			$_where['Registration.EVT_ID'] = $this->_req_data['EVT_ID'];
1777 1777
 		}
1778 1778
 
1779
-		if ( isset( $this->_req_data['s'] ) ) {
1780
-			$search_string = '%' . $this->_req_data['s'] . '%';
1779
+		if (isset($this->_req_data['s'])) {
1780
+			$search_string = '%'.$this->_req_data['s'].'%';
1781 1781
 			$_where['OR'] = array(
1782
-				'Registration.Event.EVT_name' => array( 'LIKE', $search_string ),
1783
-				'Registration.Event.EVT_desc' => array( 'LIKE', $search_string ),
1784
-				'Registration.Event.EVT_short_desc' => array( 'LIKE' , $search_string ),
1785
-				'Registration.Attendee.ATT_full_name' => array( 'LIKE', $search_string ),
1786
-				'Registration.Attendee.ATT_fname' => array( 'LIKE', $search_string ),
1787
-				'Registration.Attendee.ATT_lname' => array( 'LIKE', $search_string ),
1788
-				'Registration.Attendee.ATT_short_bio' => array( 'LIKE', $search_string ),
1789
-				'Registration.Attendee.ATT_email' => array('LIKE', $search_string ),
1790
-				'Registration.Attendee.ATT_address' => array( 'LIKE', $search_string ),
1791
-				'Registration.Attendee.ATT_address2' => array( 'LIKE', $search_string ),
1792
-				'Registration.Attendee.ATT_city' => array( 'LIKE', $search_string ),
1793
-				'Registration.REG_final_price' => array( 'LIKE', $search_string ),
1794
-				'Registration.REG_code' => array( 'LIKE', $search_string ),
1795
-				'Registration.REG_count' => array( 'LIKE' , $search_string ),
1796
-				'Registration.REG_group_size' => array( 'LIKE' , $search_string ),
1797
-				'Registration.Ticket.TKT_name' => array( 'LIKE', $search_string ),
1798
-				'Registration.Ticket.TKT_description' => array( 'LIKE', $search_string ),
1799
-				'Payment.PAY_source' => array('LIKE', $search_string ),
1800
-				'Payment.Payment_Method.PMD_name' => array('LIKE', $search_string ),
1801
-				'TXN_session_data' => array( 'LIKE', $search_string ),
1802
-				'Payment.PAY_txn_id_chq_nmbr' => array( 'LIKE', $search_string )
1782
+				'Registration.Event.EVT_name' => array('LIKE', $search_string),
1783
+				'Registration.Event.EVT_desc' => array('LIKE', $search_string),
1784
+				'Registration.Event.EVT_short_desc' => array('LIKE', $search_string),
1785
+				'Registration.Attendee.ATT_full_name' => array('LIKE', $search_string),
1786
+				'Registration.Attendee.ATT_fname' => array('LIKE', $search_string),
1787
+				'Registration.Attendee.ATT_lname' => array('LIKE', $search_string),
1788
+				'Registration.Attendee.ATT_short_bio' => array('LIKE', $search_string),
1789
+				'Registration.Attendee.ATT_email' => array('LIKE', $search_string),
1790
+				'Registration.Attendee.ATT_address' => array('LIKE', $search_string),
1791
+				'Registration.Attendee.ATT_address2' => array('LIKE', $search_string),
1792
+				'Registration.Attendee.ATT_city' => array('LIKE', $search_string),
1793
+				'Registration.REG_final_price' => array('LIKE', $search_string),
1794
+				'Registration.REG_code' => array('LIKE', $search_string),
1795
+				'Registration.REG_count' => array('LIKE', $search_string),
1796
+				'Registration.REG_group_size' => array('LIKE', $search_string),
1797
+				'Registration.Ticket.TKT_name' => array('LIKE', $search_string),
1798
+				'Registration.Ticket.TKT_description' => array('LIKE', $search_string),
1799
+				'Payment.PAY_source' => array('LIKE', $search_string),
1800
+				'Payment.Payment_Method.PMD_name' => array('LIKE', $search_string),
1801
+				'TXN_session_data' => array('LIKE', $search_string),
1802
+				'Payment.PAY_txn_id_chq_nmbr' => array('LIKE', $search_string)
1803 1803
 				);
1804 1804
 		}
1805 1805
 
1806 1806
 		//failed transactions
1807
-		$failed = ( ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] == 'failed' && ! $count ) || ( $count && $view == 'failed' ) ? TRUE: FALSE;
1808
-		$abandoned = ( ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] == 'abandoned' && ! $count ) || ( $count && $view == 'abandoned' ) ? TRUE: FALSE;
1807
+		$failed = ( ! empty($this->_req_data['status']) && $this->_req_data['status'] == 'failed' && ! $count) || ($count && $view == 'failed') ? TRUE : FALSE;
1808
+		$abandoned = ( ! empty($this->_req_data['status']) && $this->_req_data['status'] == 'abandoned' && ! $count) || ($count && $view == 'abandoned') ? TRUE : FALSE;
1809 1809
 
1810
-		if ( $failed ) {
1811
-			$_where[ 'STS_ID' ] = EEM_Transaction::failed_status_code;
1812
-		} else if ( $abandoned ) {
1810
+		if ($failed) {
1811
+			$_where['STS_ID'] = EEM_Transaction::failed_status_code;
1812
+		} else if ($abandoned) {
1813 1813
 				$_where['STS_ID'] = EEM_Transaction::abandoned_status_code;
1814 1814
 		} else {
1815
-				$_where['STS_ID'] = array( '!=', EEM_Transaction::failed_status_code );
1816
-				$_where['STS_ID*'] = array( '!=', EEM_Transaction::abandoned_status_code );
1815
+				$_where['STS_ID'] = array('!=', EEM_Transaction::failed_status_code);
1816
+				$_where['STS_ID*'] = array('!=', EEM_Transaction::abandoned_status_code);
1817 1817
 		}
1818 1818
 
1819
-		$query_params = array( $_where, 'order_by' => array( $orderby => $sort ), 'limit' => $limit );
1819
+		$query_params = array($_where, 'order_by' => array($orderby => $sort), 'limit' => $limit);
1820 1820
 
1821
-		$transactions = $count ? $TXN->count( array($_where), 'TXN_ID', TRUE ) : $TXN->get_all($query_params);
1821
+		$transactions = $count ? $TXN->count(array($_where), 'TXN_ID', TRUE) : $TXN->get_all($query_params);
1822 1822
 
1823 1823
 
1824 1824
 		return $transactions;
Please login to merge, or discard this patch.
admin_pages/venues/Venues_Admin_Page.core.php 1 patch
Spacing   +239 added lines, -239 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (!defined('EVENT_ESPRESSO_VERSION') )
2
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
3 3
 	exit('NO direct script access allowed');
4 4
 
5 5
 /**
@@ -62,10 +62,10 @@  discard block
 block discarded – undo
62 62
 
63 63
 
64 64
 	protected function _init_page_props() {
65
-		require_once( EE_MODELS . 'EEM_Venue.model.php' );
65
+		require_once(EE_MODELS.'EEM_Venue.model.php');
66 66
 		$this->page_slug = EE_VENUES_PG_SLUG;
67 67
 		$this->_admin_base_url = EE_VENUES_ADMIN_URL;
68
-		$this->_admin_base_path = EE_ADMIN_PAGES . 'venues';
68
+		$this->_admin_base_path = EE_ADMIN_PAGES.'venues';
69 69
 		$this->page_label = __('Event Venues', 'event_espresso');
70 70
 		$this->_cpt_model_names = array(
71 71
 			'create_new' => 'EEM_Venue',
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 				'edit' => __('Update Venue', 'event_espresso'),
109 109
 				'add_category' => __('Save New Category', 'event_espresso'),
110 110
 				'edit_category' => __('Update Category', 'event_espresso'),
111
-				'google_map_settings' => __( 'Update Settings', 'event_espresso' )
111
+				'google_map_settings' => __('Update Settings', 'event_espresso')
112 112
 				)
113 113
 		);
114 114
 	}
@@ -123,8 +123,8 @@  discard block
 block discarded – undo
123 123
 		//load field generator helper
124 124
 
125 125
 		//is there a vnu_id in the request?
126
-		$vnu_id = ! empty( $this->_req_data['VNU_ID'] ) && ! is_array( $this->_req_data['VNU_ID'] ) ? $this->_req_data['VNU_ID'] : 0;
127
-		$vnu_id = ! empty( $this->_req_data['post'] ) ? $this->_req_data['post'] : $vnu_id;
126
+		$vnu_id = ! empty($this->_req_data['VNU_ID']) && ! is_array($this->_req_data['VNU_ID']) ? $this->_req_data['VNU_ID'] : 0;
127
+		$vnu_id = ! empty($this->_req_data['post']) ? $this->_req_data['post'] : $vnu_id;
128 128
 
129 129
 		$this->_page_routes = array(
130 130
 			'default' => array(
@@ -142,27 +142,27 @@  discard block
 block discarded – undo
142 142
 				),
143 143
 			'trash_venue' => array(
144 144
 				'func' => '_trash_or_restore_venue',
145
-				'args' => array( 'venue_status' => 'trash' ),
145
+				'args' => array('venue_status' => 'trash'),
146 146
 				'noheader' => TRUE,
147 147
 				'capability' => 'ee_delete_venue',
148 148
 				'obj_id' => $vnu_id
149 149
 				),
150 150
 			'trash_venues' => array(
151 151
 				'func' => '_trash_or_restore_venues',
152
-				'args' => array( 'venue_status' => 'trash' ),
152
+				'args' => array('venue_status' => 'trash'),
153 153
 				'noheader' => TRUE,
154 154
 				'capability' => 'ee_delete_venues'
155 155
 				),
156 156
 			'restore_venue' => array(
157 157
 				'func' => '_trash_or_restore_venue',
158
-				'args' => array( 'venue_status' => 'draft' ),
158
+				'args' => array('venue_status' => 'draft'),
159 159
 				'noheader' => TRUE,
160 160
 				'capability' => 'ee_delete_venue',
161 161
 				'obj_id' => $vnu_id
162 162
 				),
163 163
 			'restore_venues' => array(
164 164
 				'func' => '_trash_or_restore_venues',
165
-				'args' => array( 'venue_status' => 'draft' ),
165
+				'args' => array('venue_status' => 'draft'),
166 166
 				'noheader' => TRUE,
167 167
 				'capability' => 'ee_delete_venues'
168 168
 				),
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
 						'filename' => 'venues_overview_views_bulk_actions_search'
265 265
 					)
266 266
 				),
267
-				'help_tour' => array( 'Venues_Overview_Help_Tour' ),
267
+				'help_tour' => array('Venues_Overview_Help_Tour'),
268 268
 				'metaboxes' => array('_espresso_news_post_box', '_espresso_links_post_box'),
269 269
 				'require_nonce' => FALSE
270 270
 			),
@@ -300,7 +300,7 @@  discard block
 block discarded – undo
300 300
 						'filename' => 'venues_editor_other'
301 301
 					)
302 302
 				),
303
-				'help_tour' => array( 'Venues_Add_Venue_Help_Tour' ),
303
+				'help_tour' => array('Venues_Add_Venue_Help_Tour'),
304 304
 				'metaboxes' => array('_venue_editor_metaboxes'),
305 305
 				'require_nonce' => FALSE
306 306
 				),
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
 					'label' => __('Edit Venue', 'event_espresso'),
310 310
 					'order' => 5,
311 311
 					'persistent' => FALSE,
312
-					'url' => isset($this->_req_data['post']) ? add_query_arg(array('post' => $this->_req_data['post'] ), $this->_current_page_view_url )  : $this->_admin_base_url
312
+					'url' => isset($this->_req_data['post']) ? add_query_arg(array('post' => $this->_req_data['post']), $this->_current_page_view_url) : $this->_admin_base_url
313 313
 				),
314 314
 				'help_tabs' => array(
315 315
 					'venues_editor_help_tab' => array(
@@ -343,17 +343,17 @@  discard block
 block discarded – undo
343 343
 			),
344 344
 			'google_map_settings' => array(
345 345
 				'nav' => array(
346
-					'label' => esc_html__('Google Maps', 'event_espresso' ),
346
+					'label' => esc_html__('Google Maps', 'event_espresso'),
347 347
 					'order' => 40
348 348
 				),
349
-				'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array('_publish_post_box' ) ),
349
+				'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')),
350 350
 				'help_tabs' => array(
351 351
 					'general_settings_google_maps_help_tab' => array(
352 352
 						'title' => __('Google Maps', 'event_espresso'),
353 353
 						'filename' => 'general_settings_google_maps'
354 354
 					)
355 355
 				),
356
-				'help_tour' => array( 'Google_Maps_Help_Tour' ),
356
+				'help_tour' => array('Google_Maps_Help_Tour'),
357 357
 				'require_nonce' => FALSE
358 358
 			),
359 359
 			//venue category stuff
@@ -369,7 +369,7 @@  discard block
 block discarded – undo
369 369
 						'filename' => 'venues_add_category'
370 370
 					)
371 371
 				),
372
-				'help_tour' => array( 'Venues_Add_Category_Help_Tour' ),
372
+				'help_tour' => array('Venues_Add_Category_Help_Tour'),
373 373
 				'require_nonce' => FALSE
374 374
 				),
375 375
 			'edit_category' => array(
@@ -377,7 +377,7 @@  discard block
 block discarded – undo
377 377
 					'label' => __('Edit Category', 'event_espresso'),
378 378
 					'order' => 15,
379 379
 					'persistent' => FALSE,
380
-					'url' => isset($this->_req_data['EVT_CAT_ID']) ? add_query_arg(array('EVT_CAT_ID' => $this->_req_data['EVT_CAT_ID'] ), $this->_current_page_view_url )  : $this->_admin_base_url
380
+					'url' => isset($this->_req_data['EVT_CAT_ID']) ? add_query_arg(array('EVT_CAT_ID' => $this->_req_data['EVT_CAT_ID']), $this->_current_page_view_url) : $this->_admin_base_url
381 381
 					),
382 382
 				'metaboxes' => array('_publish_post_box'),
383 383
 				'help_tabs' => array(
@@ -413,7 +413,7 @@  discard block
 block discarded – undo
413 413
 						'filename' => 'venues_categories_other'
414 414
 					)
415 415
 				),
416
-				'help_tour' => array( 'Venues_Categories_Help_Tour' ),
416
+				'help_tour' => array('Venues_Categories_Help_Tour'),
417 417
 				'metaboxes' => $this->_default_espresso_metaboxes,
418 418
 				'require_nonce' => FALSE
419 419
 				)
@@ -470,7 +470,7 @@  discard block
 block discarded – undo
470 470
 
471 471
 
472 472
 	public function load_scripts_styles() {
473
-		wp_register_style('ee-cat-admin', EVENTS_ASSETS_URL . 'ee-cat-admin.css', array(), EVENT_ESPRESSO_VERSION );
473
+		wp_register_style('ee-cat-admin', EVENTS_ASSETS_URL.'ee-cat-admin.css', array(), EVENT_ESPRESSO_VERSION);
474 474
 		wp_enqueue_style('ee-cat-admin');
475 475
 	}
476 476
 
@@ -493,7 +493,7 @@  discard block
 block discarded – undo
493 493
 	public function load_scripts_styles_edit() {
494 494
 		//styles
495 495
 		wp_enqueue_style('espresso-ui-theme');
496
-		wp_register_style( 'espresso_venues', EE_VENUES_ASSETS_URL . 'ee-venues-admin.css', array(), EVENT_ESPRESSO_VERSION );
496
+		wp_register_style('espresso_venues', EE_VENUES_ASSETS_URL.'ee-venues-admin.css', array(), EVENT_ESPRESSO_VERSION);
497 497
 		wp_enqueue_style('espresso_venues');
498 498
 	}
499 499
 
@@ -512,13 +512,13 @@  discard block
 block discarded – undo
512 512
 				)
513 513
 		);
514 514
 
515
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_venues', 'espresso_venues_trash_venues' ) ) {
515
+		if (EE_Registry::instance()->CAP->current_user_can('ee_delete_venues', 'espresso_venues_trash_venues')) {
516 516
 			$this->_views['all']['bulk_action'] = array(
517 517
 				'trash_venues' => __('Move to Trash', 'event_espresso')
518 518
 			);
519 519
 			$this->_views['trash'] = array(
520 520
 				'slug' => 'trash',
521
-				'label' => __( 'Trash', 'event_espresso' ),
521
+				'label' => __('Trash', 'event_espresso'),
522 522
 				'count' => 0,
523 523
 				'bulk_action' => array(
524 524
 					'restore_venues' => __('Restore from Trash', 'event_espresso'),
@@ -551,8 +551,8 @@  discard block
 block discarded – undo
551 551
 
552 552
 
553 553
 	protected function _overview_list_table() {
554
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
555
-		$this->_template_args['after_list_table'] = EEH_Template::get_button_or_link( get_post_type_archive_link('espresso_venues'), __("View Venue Archive Page", "event_espresso"), 'button' );
554
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
555
+		$this->_template_args['after_list_table'] = EEH_Template::get_button_or_link(get_post_type_archive_link('espresso_venues'), __("View Venue Archive Page", "event_espresso"), 'button');
556 556
 		$this->_admin_page_title .= $this->get_action_link_or_button('create_new', 'add', array(), 'add-new-h2');
557 557
 		$this->_search_btn_label = __('Venues', 'event_espresso');
558 558
 		$this->display_admin_list_table_page_with_sidebar();
@@ -566,8 +566,8 @@  discard block
 block discarded – undo
566 566
 			'vnu_url' => $this->_cpt_model_obj->venue_url(),
567 567
 			'vnu_phone' => $this->_cpt_model_obj->phone()
568 568
 			);
569
-		$template = EE_VENUES_TEMPLATE_PATH . 'venue_publish_box_extras.template.php';
570
-		EEH_Template::display_template( $template, $extra_rows );
569
+		$template = EE_VENUES_TEMPLATE_PATH.'venue_publish_box_extras.template.php';
570
+		EEH_Template::display_template($template, $extra_rows);
571 571
 	}
572 572
 
573 573
 
@@ -583,31 +583,31 @@  discard block
 block discarded – undo
583 583
 		$default_map_settings->use_google_maps = TRUE;
584 584
 		$default_map_settings->google_map_api_key = '';
585 585
 		// for event details pages (reg page)
586
-		$default_map_settings->event_details_map_width = 585; 			// ee_map_width_single
587
-		$default_map_settings->event_details_map_height = 362; 			// ee_map_height_single
588
-		$default_map_settings->event_details_map_zoom = 14; 			// ee_map_zoom_single
589
-		$default_map_settings->event_details_display_nav = TRUE; 			// ee_map_nav_display_single
590
-		$default_map_settings->event_details_nav_size = FALSE; 			// ee_map_nav_size_single
591
-		$default_map_settings->event_details_control_type = 'default'; 		// ee_map_type_control_single
592
-		$default_map_settings->event_details_map_align = 'center'; 			// ee_map_align_single
586
+		$default_map_settings->event_details_map_width = 585; // ee_map_width_single
587
+		$default_map_settings->event_details_map_height = 362; // ee_map_height_single
588
+		$default_map_settings->event_details_map_zoom = 14; // ee_map_zoom_single
589
+		$default_map_settings->event_details_display_nav = TRUE; // ee_map_nav_display_single
590
+		$default_map_settings->event_details_nav_size = FALSE; // ee_map_nav_size_single
591
+		$default_map_settings->event_details_control_type = 'default'; // ee_map_type_control_single
592
+		$default_map_settings->event_details_map_align = 'center'; // ee_map_align_single
593 593
 		// for event list pages
594
-		$default_map_settings->event_list_map_width = 300; 			// ee_map_width
595
-		$default_map_settings->event_list_map_height = 185; 		// ee_map_height
596
-		$default_map_settings->event_list_map_zoom = 12; 			// ee_map_zoom
597
-		$default_map_settings->event_list_display_nav = FALSE; 		// ee_map_nav_display
598
-		$default_map_settings->event_list_nav_size = TRUE; 			// ee_map_nav_size
599
-		$default_map_settings->event_list_control_type = 'dropdown'; 		// ee_map_type_control
600
-		$default_map_settings->event_list_map_align = 'center'; 			// ee_map_align
594
+		$default_map_settings->event_list_map_width = 300; // ee_map_width
595
+		$default_map_settings->event_list_map_height = 185; // ee_map_height
596
+		$default_map_settings->event_list_map_zoom = 12; // ee_map_zoom
597
+		$default_map_settings->event_list_display_nav = FALSE; // ee_map_nav_display
598
+		$default_map_settings->event_list_nav_size = TRUE; // ee_map_nav_size
599
+		$default_map_settings->event_list_control_type = 'dropdown'; // ee_map_type_control
600
+		$default_map_settings->event_list_map_align = 'center'; // ee_map_align
601 601
 
602 602
 		$this->_template_args['map_settings'] =
603
-			isset( EE_Registry::instance()->CFG->map_settings ) && ! empty( EE_Registry::instance()->CFG->map_settings )
604
-				? (object)array_merge( (array)$default_map_settings, (array)EE_Registry::instance()->CFG->map_settings )
603
+			isset(EE_Registry::instance()->CFG->map_settings) && ! empty(EE_Registry::instance()->CFG->map_settings)
604
+				? (object) array_merge((array) $default_map_settings, (array) EE_Registry::instance()->CFG->map_settings)
605 605
 				: $default_map_settings;
606 606
 
607
-		$this->_set_add_edit_form_tags( 'update_google_map_settings' );
608
-		$this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE );
607
+		$this->_set_add_edit_form_tags('update_google_map_settings');
608
+		$this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE);
609 609
 		$this->_template_args['admin_page_content'] = EEH_Template::display_template(
610
-			EE_VENUES_TEMPLATE_PATH . 'google_map.template.php',
610
+			EE_VENUES_TEMPLATE_PATH.'google_map.template.php',
611 611
 			$this->_template_args,
612 612
 			true
613 613
 		);
@@ -617,83 +617,83 @@  discard block
 block discarded – undo
617 617
 	protected function _update_google_map_settings() {
618 618
 
619 619
 		EE_Registry::instance()->CFG->map_settings->use_google_maps =
620
-			isset( $this->_req_data['use_google_maps'] )
621
-				? absint( $this->_req_data['use_google_maps'] )
620
+			isset($this->_req_data['use_google_maps'])
621
+				? absint($this->_req_data['use_google_maps'])
622 622
 				: EE_Registry::instance()->CFG->map_settings->use_google_maps;
623 623
 
624 624
 		EE_Registry::instance()->CFG->map_settings->google_map_api_key =
625
-			isset( $this->_req_data['google_map_api_key'] )
626
-				? sanitize_text_field( $this->_req_data['google_map_api_key'] )
625
+			isset($this->_req_data['google_map_api_key'])
626
+				? sanitize_text_field($this->_req_data['google_map_api_key'])
627 627
 				: EE_Registry::instance()->CFG->map_settings->google_map_api_key;
628 628
 
629 629
 		EE_Registry::instance()->CFG->map_settings->event_details_map_width =
630
-			isset( $this->_req_data['event_details_map_width'] )
631
-				? absint( $this->_req_data['event_details_map_width'] )
630
+			isset($this->_req_data['event_details_map_width'])
631
+				? absint($this->_req_data['event_details_map_width'])
632 632
 				: EE_Registry::instance()->CFG->map_settings->event_details_map_width;
633 633
 
634 634
 		EE_Registry::instance()->CFG->map_settings->event_details_map_height =
635
-			isset( $this->_req_data['event_details_map_height'] )
636
-				? absint( $this->_req_data['event_details_map_height'] )
635
+			isset($this->_req_data['event_details_map_height'])
636
+				? absint($this->_req_data['event_details_map_height'])
637 637
 				: EE_Registry::instance()->CFG->map_settings->event_details_map_height;
638 638
 
639 639
 		EE_Registry::instance()->CFG->map_settings->event_details_map_zoom =
640
-			isset( $this->_req_data['event_details_map_zoom'] )
641
-				? absint( $this->_req_data['event_details_map_zoom'] )
640
+			isset($this->_req_data['event_details_map_zoom'])
641
+				? absint($this->_req_data['event_details_map_zoom'])
642 642
 				: EE_Registry::instance()->CFG->map_settings->event_details_map_zoom;
643 643
 
644 644
 		EE_Registry::instance()->CFG->map_settings->event_details_display_nav =
645
-			isset( $this->_req_data['event_details_display_nav'] )
646
-				? absint( $this->_req_data['event_details_display_nav'] )
645
+			isset($this->_req_data['event_details_display_nav'])
646
+				? absint($this->_req_data['event_details_display_nav'])
647 647
 				: EE_Registry::instance()->CFG->map_settings->event_details_display_nav;
648 648
 
649 649
 		EE_Registry::instance()->CFG->map_settings->event_details_nav_size =
650
-			isset( $this->_req_data['event_details_nav_size'] )
651
-				? absint( $this->_req_data['event_details_nav_size'] )
650
+			isset($this->_req_data['event_details_nav_size'])
651
+				? absint($this->_req_data['event_details_nav_size'])
652 652
 				: EE_Registry::instance()->CFG->map_settings->event_details_nav_size;
653 653
 
654 654
 		EE_Registry::instance()->CFG->map_settings->event_details_control_type =
655
-			isset( $this->_req_data['event_details_control_type'] )
656
-				? sanitize_text_field( $this->_req_data['event_details_control_type'] )
655
+			isset($this->_req_data['event_details_control_type'])
656
+				? sanitize_text_field($this->_req_data['event_details_control_type'])
657 657
 				: EE_Registry::instance()->CFG->map_settings->event_details_control_type;
658 658
 
659 659
 		EE_Registry::instance()->CFG->map_settings->event_details_map_align =
660
-			isset( $this->_req_data['event_details_map_align'] )
661
-				? sanitize_text_field( $this->_req_data['event_details_map_align'] )
660
+			isset($this->_req_data['event_details_map_align'])
661
+				? sanitize_text_field($this->_req_data['event_details_map_align'])
662 662
 				: EE_Registry::instance()->CFG->map_settings->event_details_map_align;
663 663
 
664 664
 		EE_Registry::instance()->CFG->map_settings->event_list_map_width =
665
-			isset( $this->_req_data['event_list_map_width'] )
666
-				? absint( $this->_req_data['event_list_map_width'] )
665
+			isset($this->_req_data['event_list_map_width'])
666
+				? absint($this->_req_data['event_list_map_width'])
667 667
 				: EE_Registry::instance()->CFG->map_settings->event_list_map_width;
668 668
 
669 669
 		EE_Registry::instance()->CFG->map_settings->event_list_map_height =
670
-			isset( $this->_req_data['event_list_map_height'] )
671
-				? absint( $this->_req_data['event_list_map_height'] )
670
+			isset($this->_req_data['event_list_map_height'])
671
+				? absint($this->_req_data['event_list_map_height'])
672 672
 				: EE_Registry::instance()->CFG->map_settings->event_list_map_height;
673 673
 
674 674
 		EE_Registry::instance()->CFG->map_settings->event_list_map_zoom =
675
-			isset( $this->_req_data['event_list_map_zoom'] )
676
-				? absint( $this->_req_data['event_list_map_zoom'] )
675
+			isset($this->_req_data['event_list_map_zoom'])
676
+				? absint($this->_req_data['event_list_map_zoom'])
677 677
 				: EE_Registry::instance()->CFG->map_settings->event_list_map_zoom;
678 678
 
679 679
 		EE_Registry::instance()->CFG->map_settings->event_list_display_nav =
680
-			isset( $this->_req_data['event_list_display_nav'] )
681
-				? absint( $this->_req_data['event_list_display_nav'] )
680
+			isset($this->_req_data['event_list_display_nav'])
681
+				? absint($this->_req_data['event_list_display_nav'])
682 682
 				: EE_Registry::instance()->CFG->map_settings->event_list_display_nav;
683 683
 
684 684
 		EE_Registry::instance()->CFG->map_settings->event_list_nav_size =
685
-			isset( $this->_req_data['event_list_nav_size'] )
686
-				? absint( $this->_req_data['event_list_nav_size'] )
685
+			isset($this->_req_data['event_list_nav_size'])
686
+				? absint($this->_req_data['event_list_nav_size'])
687 687
 				: EE_Registry::instance()->CFG->map_settings->event_list_nav_size;
688 688
 
689 689
 		EE_Registry::instance()->CFG->map_settings->event_list_control_type =
690
-			isset( $this->_req_data['event_list_control_type'] )
691
-				? sanitize_text_field( $this->_req_data['event_list_control_type'] )
690
+			isset($this->_req_data['event_list_control_type'])
691
+				? sanitize_text_field($this->_req_data['event_list_control_type'])
692 692
 				: EE_Registry::instance()->CFG->map_settings->event_list_control_type;
693 693
 
694 694
 		EE_Registry::instance()->CFG->map_settings->event_list_map_align =
695
-			isset( $this->_req_data['event_list_map_align'] )
696
-				? sanitize_text_field( $this->_req_data['event_list_map_align'] )
695
+			isset($this->_req_data['event_list_map_align'])
696
+				? sanitize_text_field($this->_req_data['event_list_map_align'])
697 697
 				: EE_Registry::instance()->CFG->map_settings->event_list_map_align;
698 698
 
699 699
 		EE_Registry::instance()->CFG->map_settings = apply_filters(
@@ -707,7 +707,7 @@  discard block
 block discarded – undo
707 707
 			EE_Registry::instance()->CFG->map_settings,
708 708
 			__FILE__, __FUNCTION__, __LINE__
709 709
 		);
710
-		$this->_redirect_after_action( $success, $what, 'updated', array( 'action' => 'google_map_settings' ) );
710
+		$this->_redirect_after_action($success, $what, 'updated', array('action' => 'google_map_settings'));
711 711
 
712 712
 	}
713 713
 
@@ -716,9 +716,9 @@  discard block
 block discarded – undo
716 716
 	protected function _venue_editor_metaboxes() {
717 717
 		$this->verify_cpt_object();
718 718
 
719
-		add_meta_box( 'espresso_venue_address_options', __('Physical Location', 'event_espresso'), array( $this, 'venue_address_metabox'), $this->page_slug, 'side', 'default' );
720
-		add_meta_box( 'espresso_venue_gmap_options', __('Google Map', 'event_espresso'), array( $this, 'venue_gmap_metabox'), $this->page_slug, 'side', 'default' );
721
-		add_meta_box( 'espresso_venue_virtual_loc_options', __('Virtual Location', 'event_espresso'), array( $this, 'venue_virtual_loc_metabox'), $this->page_slug, 'side', 'default' );
719
+		add_meta_box('espresso_venue_address_options', __('Physical Location', 'event_espresso'), array($this, 'venue_address_metabox'), $this->page_slug, 'side', 'default');
720
+		add_meta_box('espresso_venue_gmap_options', __('Google Map', 'event_espresso'), array($this, 'venue_gmap_metabox'), $this->page_slug, 'side', 'default');
721
+		add_meta_box('espresso_venue_virtual_loc_options', __('Virtual Location', 'event_espresso'), array($this, 'venue_virtual_loc_metabox'), $this->page_slug, 'side', 'default');
722 722
 
723 723
 	}
724 724
 
@@ -726,23 +726,23 @@  discard block
 block discarded – undo
726 726
 
727 727
 	public function venue_gmap_metabox() {
728 728
 		$template_args = array(
729
-			'vnu_enable_for_gmap' => EEH_Form_Fields::select_input('vnu_enable_for_gmap', $this->get_yes_no_values(), $this->_cpt_model_obj->enable_for_gmap() ),
729
+			'vnu_enable_for_gmap' => EEH_Form_Fields::select_input('vnu_enable_for_gmap', $this->get_yes_no_values(), $this->_cpt_model_obj->enable_for_gmap()),
730 730
 			'vnu_google_map_link' => $this->_cpt_model_obj->google_map_link(),
731 731
 			);
732
-		$template = EE_VENUES_TEMPLATE_PATH . 'venue_gmap_metabox_content.template.php';
733
-		EEH_Template::display_template( $template, $template_args );
732
+		$template = EE_VENUES_TEMPLATE_PATH.'venue_gmap_metabox_content.template.php';
733
+		EEH_Template::display_template($template, $template_args);
734 734
 	}
735 735
 
736 736
 
737 737
 
738 738
 	public function venue_address_metabox() {
739 739
 
740
-		$template_args['_venue'] =$this->_cpt_model_obj;
740
+		$template_args['_venue'] = $this->_cpt_model_obj;
741 741
 
742 742
 		$template_args['states_dropdown'] = EEH_Form_Fields::generate_form_input(
743 743
 			$QFI = new EE_Question_Form_Input(
744
-				EE_Question::new_instance( array( 'QST_display_text' => 'State', 'QST_system' => 'state' )),
745
-				EE_Answer::new_instance( array(  'ANS_value'=> $this->_cpt_model_obj->state_ID() )),
744
+				EE_Question::new_instance(array('QST_display_text' => 'State', 'QST_system' => 'state')),
745
+				EE_Answer::new_instance(array('ANS_value'=> $this->_cpt_model_obj->state_ID())),
746 746
 				array(
747 747
 					'input_name' =>  'sta_id',
748 748
 					'input_id' => 'sta_id',
@@ -754,8 +754,8 @@  discard block
 block discarded – undo
754 754
 		);
755 755
 		$template_args['countries_dropdown'] = EEH_Form_Fields::generate_form_input(
756 756
 			$QFI = new EE_Question_Form_Input(
757
-				EE_Question::new_instance( array( 'QST_display_text' => 'Country', 'QST_system' => 'country' )),
758
-				EE_Answer::new_instance( array(  'ANS_value'=> $this->_cpt_model_obj->country_ID() )),
757
+				EE_Question::new_instance(array('QST_display_text' => 'Country', 'QST_system' => 'country')),
758
+				EE_Answer::new_instance(array('ANS_value'=> $this->_cpt_model_obj->country_ID())),
759 759
 				array(
760 760
 					'input_name' =>  'cnt_iso',
761 761
 					'input_id' => 'cnt_iso',
@@ -766,8 +766,8 @@  discard block
 block discarded – undo
766 766
 			)
767 767
 		);
768 768
 
769
-		$template = EE_VENUES_TEMPLATE_PATH . 'venue_address_metabox_content.template.php';
770
-		EEH_Template::display_template( $template, $template_args );
769
+		$template = EE_VENUES_TEMPLATE_PATH.'venue_address_metabox_content.template.php';
770
+		EEH_Template::display_template($template, $template_args);
771 771
 	}
772 772
 
773 773
 
@@ -779,8 +779,8 @@  discard block
 block discarded – undo
779 779
 		$template_args = array(
780 780
 			'_venue' => $this->_cpt_model_obj
781 781
 			);
782
-		$template = EE_VENUES_TEMPLATE_PATH . 'venue_virtual_location_metabox_content.template.php';
783
-		EEH_Template::display_template( $template, $template_args );
782
+		$template = EE_VENUES_TEMPLATE_PATH.'venue_virtual_location_metabox_content.template.php';
783
+		EEH_Template::display_template($template, $template_args);
784 784
 	}
785 785
 
786 786
 
@@ -803,52 +803,52 @@  discard block
 block discarded – undo
803 803
 	 * @param  object $post    Post object (with "blessed" WP properties)
804 804
 	 * @return void
805 805
 	 */
806
-	protected function _insert_update_cpt_item( $post_id, $post ) {
806
+	protected function _insert_update_cpt_item($post_id, $post) {
807 807
 
808
-		if ( $post instanceof WP_Post && $post->post_type !== 'espresso_venues' ) {
809
-			return;// get out we're not processing the saving of venues.
808
+		if ($post instanceof WP_Post && $post->post_type !== 'espresso_venues') {
809
+			return; // get out we're not processing the saving of venues.
810 810
 		}
811 811
 
812
-		$wheres = array( $this->_venue_model->primary_key_name() => $post_id );
812
+		$wheres = array($this->_venue_model->primary_key_name() => $post_id);
813 813
 
814 814
 		$venue_values = array(
815
-			'VNU_address' => !empty( $this->_req_data['vnu_address'] ) ? $this->_req_data['vnu_address'] : NULL,
816
-			'VNU_address2' => !empty( $this->_req_data['vnu_address2'] ) ? $this->_req_data['vnu_address2'] : NULL,
817
-			'VNU_city' => !empty( $this->_req_data['vnu_city'] ) ? $this->_req_data['vnu_city'] : NULL,
818
-			'STA_ID' => !empty( $this->_req_data['sta_id'] ) ? $this->_req_data['sta_id'] : NULL,
819
-			'CNT_ISO' => !empty( $this->_req_data['cnt_iso'] ) ? $this->_req_data['cnt_iso'] : NULL,
820
-			'VNU_zip' => !empty( $this->_req_data['vnu_zip'] ) ? $this->_req_data['vnu_zip'] : NULL,
821
-			'VNU_phone' => !empty( $this->_req_data['vnu_phone'] ) ? $this->_req_data['vnu_phone'] : NULL,
822
-			'VNU_capacity' => !empty( $this->_req_data['vnu_capacity'] ) ? str_replace( ',', '', $this->_req_data['vnu_capacity'] ) : EE_INF,
823
-			'VNU_url' => !empty( $this->_req_data['vnu_url'] ) ? $this->_req_data['vnu_url'] : NULL,
824
-			'VNU_virtual_phone' => !empty( $this->_req_data['vnu_virtual_phone'] ) ? $this->_req_data['vnu_virtual_phone'] : NULL,
825
-			'VNU_virtual_url' => !empty( $this->_req_data['vnu_virtual_url'] ) ? $this->_req_data['vnu_virtual_url'] : NULL,
826
-			'VNU_enable_for_gmap' => !empty( $this->_req_data['vnu_enable_for_gmap'] ) ? TRUE : FALSE,
827
-			'VNU_google_map_link' => !empty( $this->_req_data['vnu_google_map_link'] ) ? $this->_req_data['vnu_google_map_link'] : NULL
815
+			'VNU_address' => ! empty($this->_req_data['vnu_address']) ? $this->_req_data['vnu_address'] : NULL,
816
+			'VNU_address2' => ! empty($this->_req_data['vnu_address2']) ? $this->_req_data['vnu_address2'] : NULL,
817
+			'VNU_city' => ! empty($this->_req_data['vnu_city']) ? $this->_req_data['vnu_city'] : NULL,
818
+			'STA_ID' => ! empty($this->_req_data['sta_id']) ? $this->_req_data['sta_id'] : NULL,
819
+			'CNT_ISO' => ! empty($this->_req_data['cnt_iso']) ? $this->_req_data['cnt_iso'] : NULL,
820
+			'VNU_zip' => ! empty($this->_req_data['vnu_zip']) ? $this->_req_data['vnu_zip'] : NULL,
821
+			'VNU_phone' => ! empty($this->_req_data['vnu_phone']) ? $this->_req_data['vnu_phone'] : NULL,
822
+			'VNU_capacity' => ! empty($this->_req_data['vnu_capacity']) ? str_replace(',', '', $this->_req_data['vnu_capacity']) : EE_INF,
823
+			'VNU_url' => ! empty($this->_req_data['vnu_url']) ? $this->_req_data['vnu_url'] : NULL,
824
+			'VNU_virtual_phone' => ! empty($this->_req_data['vnu_virtual_phone']) ? $this->_req_data['vnu_virtual_phone'] : NULL,
825
+			'VNU_virtual_url' => ! empty($this->_req_data['vnu_virtual_url']) ? $this->_req_data['vnu_virtual_url'] : NULL,
826
+			'VNU_enable_for_gmap' => ! empty($this->_req_data['vnu_enable_for_gmap']) ? TRUE : FALSE,
827
+			'VNU_google_map_link' => ! empty($this->_req_data['vnu_google_map_link']) ? $this->_req_data['vnu_google_map_link'] : NULL
828 828
 			);
829 829
 
830 830
 		//update venue
831
-		$success = $this->_venue_model->update( $venue_values, array( $wheres ) );
831
+		$success = $this->_venue_model->update($venue_values, array($wheres));
832 832
 
833 833
 		//get venue_object for other metaboxes that might be added via the filter... though it would seem to make sense to just use $this->_venue_model->get_one_by_ID( $post_id ).. i have to setup where conditions to override the filters in the model that filter out autodraft and inherit statuses so we GET the inherit id!
834
-		$get_one_where = array( $this->_venue_model->primary_key_name() => $post_id, 'status' => $post->post_status  );
835
-		$venue = $this->_venue_model->get_one( array( $get_one_where ) );
834
+		$get_one_where = array($this->_venue_model->primary_key_name() => $post_id, 'status' => $post->post_status);
835
+		$venue = $this->_venue_model->get_one(array($get_one_where));
836 836
 
837 837
 		//notice we've applied a filter for venue metabox callbacks but we don't actually have any default venue metaboxes in use.  So this is just here for addons to more easily hook into venue saves.
838
-		$venue_update_callbacks = apply_filters( 'FHEE__Venues_Admin_Page___insert_update_cpt_item__venue_update_callbacks', array() );
838
+		$venue_update_callbacks = apply_filters('FHEE__Venues_Admin_Page___insert_update_cpt_item__venue_update_callbacks', array());
839 839
 
840 840
 		$att_success = TRUE;
841 841
 
842
-		foreach ( $venue_update_callbacks as $v_callback ) {
843
-			$_succ = call_user_func_array( $v_callback, array( $venue,  $this->_req_data ) );
844
-			$att_success = !$att_success ? $att_success : $_succ; //if ANY of these updates fail then we want the appropriate global error message
842
+		foreach ($venue_update_callbacks as $v_callback) {
843
+			$_succ = call_user_func_array($v_callback, array($venue, $this->_req_data));
844
+			$att_success = ! $att_success ? $att_success : $_succ; //if ANY of these updates fail then we want the appropriate global error message
845 845
 		}
846 846
 
847 847
 		//any errors?
848
-		if ( $success && !$att_success ) {
849
-			EE_Error::add_error( __('Venue Details saved successfully but something went wrong with saving attachments.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
850
-		} else if ( $success === FALSE ) {
851
-			EE_Error::add_error( __('Venue Details did not save successfully.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
848
+		if ($success && ! $att_success) {
849
+			EE_Error::add_error(__('Venue Details saved successfully but something went wrong with saving attachments.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
850
+		} else if ($success === FALSE) {
851
+			EE_Error::add_error(__('Venue Details did not save successfully.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
852 852
 		}
853 853
 	}
854 854
 
@@ -856,9 +856,9 @@  discard block
 block discarded – undo
856 856
 
857 857
 
858 858
 
859
-	public function trash_cpt_item( $post_id ) {
859
+	public function trash_cpt_item($post_id) {
860 860
 		$this->_req_data['VNU_ID'] = $post_id;
861
-		$this->_trash_or_restore_venue( 'trash', FALSE );
861
+		$this->_trash_or_restore_venue('trash', FALSE);
862 862
 	}
863 863
 
864 864
 
@@ -866,18 +866,18 @@  discard block
 block discarded – undo
866 866
 
867 867
 
868 868
 
869
-	public function restore_cpt_item( $post_id ) {
869
+	public function restore_cpt_item($post_id) {
870 870
 		$this->_req_data['VNU_ID'] = $post_id;
871
-		$this->_trash_or_restore_venue( 'draft', FALSE );
871
+		$this->_trash_or_restore_venue('draft', FALSE);
872 872
 	}
873 873
 
874 874
 
875 875
 
876 876
 
877 877
 
878
-	public function delete_cpt_item( $post_id ) {
878
+	public function delete_cpt_item($post_id) {
879 879
 		$this->_req_data['VNU_ID'] = $post_id;
880
-		$this->_delete_venue( FALSE );
880
+		$this->_delete_venue(FALSE);
881 881
 	}
882 882
 
883 883
 
@@ -892,15 +892,15 @@  discard block
 block discarded – undo
892 892
 
893 893
 
894 894
 
895
-	protected function _trash_or_restore_venue( $venue_status = 'trash', $redirect_after = TRUE ) {
896
-		$VNU_ID = isset( $this->_req_data['VNU_ID'] ) ? absint( $this->_req_data['VNU_ID'] ) : FALSE;
895
+	protected function _trash_or_restore_venue($venue_status = 'trash', $redirect_after = TRUE) {
896
+		$VNU_ID = isset($this->_req_data['VNU_ID']) ? absint($this->_req_data['VNU_ID']) : FALSE;
897 897
 
898 898
 		//loop thru venues
899
-		if ( $VNU_ID ) {
899
+		if ($VNU_ID) {
900 900
 			//clean status
901
-			$venue_status = sanitize_key( $venue_status );
901
+			$venue_status = sanitize_key($venue_status);
902 902
 			// grab status
903
-			if (!empty($venue_status)) {
903
+			if ( ! empty($venue_status)) {
904 904
 				$success = $this->_change_venue_status($VNU_ID, $venue_status);
905 905
 			} else {
906 906
 				$success = FALSE;
@@ -914,7 +914,7 @@  discard block
 block discarded – undo
914 914
 		}
915 915
 		$action = $venue_status == 'trash' ? 'moved to the trash' : 'restored from the trash';
916 916
 
917
-		if ( $redirect_after )
917
+		if ($redirect_after)
918 918
 			$this->_redirect_after_action($success, 'Venue', $action, array('action' => 'default'));
919 919
 
920 920
 	}
@@ -923,11 +923,11 @@  discard block
 block discarded – undo
923 923
 
924 924
 
925 925
 
926
-	protected function _trash_or_restore_venues( $venue_status = 'trash' ) {
926
+	protected function _trash_or_restore_venues($venue_status = 'trash') {
927 927
 		// clean status
928 928
 		$venue_status = sanitize_key($venue_status);
929 929
 		// grab status
930
-		if (!empty($venue_status)) {
930
+		if ( ! empty($venue_status)) {
931 931
 			$success = TRUE;
932 932
 			//determine the event id and set to array.
933 933
 			$VNU_IDs = isset($this->_req_data['venue_id']) ? (array) $this->_req_data['venue_id'] : array();
@@ -967,20 +967,20 @@  discard block
 block discarded – undo
967 967
 	 * @param  string $venue_status
968 968
 	 * @return void
969 969
 	 */
970
-	private function _change_venue_status( $VNU_ID = 0, $venue_status = '' ) {
970
+	private function _change_venue_status($VNU_ID = 0, $venue_status = '') {
971 971
 		// grab venue id
972
-		if (! $VNU_ID) {
972
+		if ( ! $VNU_ID) {
973 973
 			$msg = __('An error occurred. No Venue ID or an invalid Venue ID was received.', 'event_espresso');
974 974
 			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
975 975
 			return FALSE;
976 976
 		}
977 977
 
978
-		$this->_cpt_model_obj = EEM_Venue::instance()->get_one_by_ID( $VNU_ID );
978
+		$this->_cpt_model_obj = EEM_Venue::instance()->get_one_by_ID($VNU_ID);
979 979
 
980 980
 		// clean status
981 981
 		$venue_status = sanitize_key($venue_status);
982 982
 		// grab status
983
-		if ( ! $venue_status ) {
983
+		if ( ! $venue_status) {
984 984
 			$msg = __('An error occurred. No Venue Status or an invalid Venue Status was received.', 'event_espresso');
985 985
 			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
986 986
 			return FALSE;
@@ -1001,7 +1001,7 @@  discard block
 block discarded – undo
1001 1001
 				$hook = FALSE;
1002 1002
 		}
1003 1003
 		//use class to change status
1004
-		$this->_cpt_model_obj->set_status( $venue_status );
1004
+		$this->_cpt_model_obj->set_status($venue_status);
1005 1005
 		$success = $this->_cpt_model_obj->save();
1006 1006
 
1007 1007
 		if ($success === FALSE) {
@@ -1020,21 +1020,21 @@  discard block
 block discarded – undo
1020 1020
 	 * @param  bool $redirect_after
1021 1021
 	 * @return void
1022 1022
 	 */
1023
-	protected function _delete_venue( $redirect_after = true ) {
1023
+	protected function _delete_venue($redirect_after = true) {
1024 1024
 		//determine the venue id and set to array.
1025 1025
 		$VNU_ID = isset($this->_req_data['VNU_ID']) ? absint($this->_req_data['VNU_ID']) : NULL;
1026
-		$VNU_ID = isset( $this->_req_data['post'] ) ? absint( $this->_req_data['post'] ) : $VNU_ID;
1026
+		$VNU_ID = isset($this->_req_data['post']) ? absint($this->_req_data['post']) : $VNU_ID;
1027 1027
 
1028 1028
 
1029 1029
 		// loop thru venues
1030 1030
 		if ($VNU_ID) {
1031
-			$success = $this->_delete_or_trash_venue( $VNU_ID );
1031
+			$success = $this->_delete_or_trash_venue($VNU_ID);
1032 1032
 		} else {
1033 1033
 			$success = FALSE;
1034 1034
 			$msg = __('An error occurred. An venue could not be deleted because a valid venue ID was not not supplied.', 'event_espresso');
1035 1035
 			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1036 1036
 		}
1037
-		if ( $redirect_after )
1037
+		if ($redirect_after)
1038 1038
 			$this->_redirect_after_action($success, 'Venue', 'deleted', array('action' => 'default'));
1039 1039
 	}
1040 1040
 
@@ -1066,7 +1066,7 @@  discard block
 block discarded – undo
1066 1066
 	//todo: put in parent
1067 1067
 	private function _delete_or_trash_venue($VNU_ID = FALSE) {
1068 1068
 		// grab event id
1069
-		if (!$VNU_ID = absint($VNU_ID)) {
1069
+		if ( ! $VNU_ID = absint($VNU_ID)) {
1070 1070
 			$msg = __('An error occurred. No Venue ID or an invalid Venue ID was received.', 'event_espresso');
1071 1071
 			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1072 1072
 			return FALSE;
@@ -1086,7 +1086,7 @@  discard block
 block discarded – undo
1086 1086
 			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1087 1087
 			return FALSE;
1088 1088
 		}
1089
-		do_action( 'AHEE__Venues_Admin_Page___delete_or_trash_venue__after_venue_deleted' );
1089
+		do_action('AHEE__Venues_Admin_Page___delete_or_trash_venue__after_venue_deleted');
1090 1090
 		return TRUE;
1091 1091
 	}
1092 1092
 
@@ -1097,11 +1097,11 @@  discard block
 block discarded – undo
1097 1097
 	/* QUERIES */
1098 1098
 
1099 1099
 
1100
-	public function get_venues( $per_page = 10, $count = FALSE ) {
1100
+	public function get_venues($per_page = 10, $count = FALSE) {
1101 1101
 
1102
-		$_orderby = !empty( $this->_req_data['orderby'] ) ? $this->_req_data['orderby'] : '';
1102
+		$_orderby = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : '';
1103 1103
 
1104
-		switch ( $_orderby ) {
1104
+		switch ($_orderby) {
1105 1105
 			case 'id':
1106 1106
 				$orderby = 'VNU_ID';
1107 1107
 				break;
@@ -1119,43 +1119,43 @@  discard block
 block discarded – undo
1119 1119
 		}
1120 1120
 
1121 1121
 
1122
-		$sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'ASC';
1122
+		$sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'ASC';
1123 1123
 
1124
-		$current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1;
1125
-		$per_page = isset( $per_page ) && !empty( $per_page ) ? $per_page : 10;
1126
-		$per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page;
1124
+		$current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1;
1125
+		$per_page = isset($per_page) && ! empty($per_page) ? $per_page : 10;
1126
+		$per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page;
1127 1127
 
1128 1128
 
1129
-		$offset = ($current_page-1)*$per_page;
1129
+		$offset = ($current_page - 1) * $per_page;
1130 1130
 		$limit = array($offset, $per_page);
1131 1131
 
1132
-		$category = isset( $this->_req_data['category'] ) && $this->_req_data['category'] > 0 ? $this->_req_data['category'] : NULL;
1132
+		$category = isset($this->_req_data['category']) && $this->_req_data['category'] > 0 ? $this->_req_data['category'] : NULL;
1133 1133
 		$where = array();
1134 1134
 
1135 1135
 		//only set initial status if it is in the incoming request.  Otherwise the "all" view display's all statuses.
1136
-		if ( isset( $this->_req_data['status'] ) && $this->_req_data['status'] != 'all' ) {
1136
+		if (isset($this->_req_data['status']) && $this->_req_data['status'] != 'all') {
1137 1137
 			$where['status'] = $this->_req_data['status'];
1138 1138
 		}
1139 1139
 
1140
-		if ( isset( $this->_req_data['venue_status'] ) ) {
1140
+		if (isset($this->_req_data['venue_status'])) {
1141 1141
 			$where['status'] = $this->_req_data['venue_status'];
1142 1142
 		}
1143 1143
 
1144 1144
 
1145
-		if ( $category ) {
1145
+		if ($category) {
1146 1146
 			$where['Term_Taxonomy.taxonomy'] = 'espresso_venue_categories';
1147 1147
 			$where['Term_Taxonomy.term_id'] = $category;
1148 1148
 		}
1149 1149
 
1150 1150
 
1151
-		if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_venues', 'get_venues' ) ) {
1152
-			$where['VNU_wp_user'] =  get_current_user_id();
1151
+		if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_venues', 'get_venues')) {
1152
+			$where['VNU_wp_user'] = get_current_user_id();
1153 1153
 		} else {
1154
-				if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_private_venues', 'get_venues' ) ) {
1154
+				if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_private_venues', 'get_venues')) {
1155 1155
 					$where['OR'] = array(
1156
-						'status*restrict_private' => array( '!=', 'private' ),
1156
+						'status*restrict_private' => array('!=', 'private'),
1157 1157
 						'AND'                     => array(
1158
-							'status*inclusive' => array( '=', 'private' ),
1158
+							'status*inclusive' => array('=', 'private'),
1159 1159
 							'VNU_wp_user'      => get_current_user_id()
1160 1160
 						)
1161 1161
 					);
@@ -1165,30 +1165,30 @@  discard block
 block discarded – undo
1165 1165
 
1166 1166
 
1167 1167
 
1168
-		if ( isset( $this->_req_data['s'] ) ) {
1169
-			$sstr = '%' . $this->_req_data['s'] . '%';
1168
+		if (isset($this->_req_data['s'])) {
1169
+			$sstr = '%'.$this->_req_data['s'].'%';
1170 1170
 			$where['OR'] = array(
1171
-				'VNU_name' => array('LIKE',$sstr ),
1172
-				'VNU_desc' => array('LIKE',$sstr ),
1173
-				'VNU_short_desc' => array( 'LIKE',$sstr ),
1174
-				'VNU_address' => array( 'LIKE', $sstr ),
1175
-				'VNU_address2' => array( 'LIKE', $sstr ),
1176
-				'VNU_city' => array( 'LIKE', $sstr ),
1177
-				'VNU_zip' => array( 'LIKE', $sstr ),
1178
-				'VNU_phone' => array( 'LIKE', $sstr ),
1179
-				'VNU_url' => array( 'LIKE', $sstr ),
1180
-				'VNU_virtual_phone' => array( 'LIKE', $sstr ),
1181
-				'VNU_virtual_url' => array( 'LIKE', $sstr ),
1182
-				'VNU_google_map_link' => array( 'LIKE', $sstr ),
1183
-				'Event.EVT_name' => array('LIKE', $sstr ),
1184
-				'Event.EVT_desc' => array('LIKE', $sstr ),
1185
-				'Event.EVT_phone' => array('LIKE', $sstr ),
1186
-				'Event.EVT_external_URL' => array('LIKE', $sstr ),
1171
+				'VNU_name' => array('LIKE', $sstr),
1172
+				'VNU_desc' => array('LIKE', $sstr),
1173
+				'VNU_short_desc' => array('LIKE', $sstr),
1174
+				'VNU_address' => array('LIKE', $sstr),
1175
+				'VNU_address2' => array('LIKE', $sstr),
1176
+				'VNU_city' => array('LIKE', $sstr),
1177
+				'VNU_zip' => array('LIKE', $sstr),
1178
+				'VNU_phone' => array('LIKE', $sstr),
1179
+				'VNU_url' => array('LIKE', $sstr),
1180
+				'VNU_virtual_phone' => array('LIKE', $sstr),
1181
+				'VNU_virtual_url' => array('LIKE', $sstr),
1182
+				'VNU_google_map_link' => array('LIKE', $sstr),
1183
+				'Event.EVT_name' => array('LIKE', $sstr),
1184
+				'Event.EVT_desc' => array('LIKE', $sstr),
1185
+				'Event.EVT_phone' => array('LIKE', $sstr),
1186
+				'Event.EVT_external_URL' => array('LIKE', $sstr),
1187 1187
 				);
1188 1188
 		}
1189 1189
 
1190 1190
 
1191
-		$venues = $count ? $this->_venue_model->count( array($where), 'VNU_ID' ) : $this->_venue_model->get_all( array( $where, 'limit' => $limit, 'order_by' => $orderby, 'order' => $sort ) );
1191
+		$venues = $count ? $this->_venue_model->count(array($where), 'VNU_ID') : $this->_venue_model->get_all(array($where, 'limit' => $limit, 'order_by' => $orderby, 'order' => $sort));
1192 1192
 
1193 1193
 		return $venues;
1194 1194
 
@@ -1206,22 +1206,22 @@  discard block
 block discarded – undo
1206 1206
 	 * @return void
1207 1207
 	 */
1208 1208
 	private function _set_category_object() {
1209
-		if ( isset( $this->_category->id ) && !empty( $this->_category->id ) )
1209
+		if (isset($this->_category->id) && ! empty($this->_category->id))
1210 1210
 			return; //already have the category object so get out.
1211 1211
 
1212 1212
 		//set default category object
1213 1213
 		$this->_set_empty_category_object();
1214 1214
 
1215 1215
 		//only set if we've got an id
1216
-		if ( !isset($this->_req_data['VEN_CAT_ID'] ) ) {
1216
+		if ( ! isset($this->_req_data['VEN_CAT_ID'])) {
1217 1217
 			return;
1218 1218
 		}
1219 1219
 
1220 1220
 		$category_id = absint($this->_req_data['VEN_CAT_ID']);
1221
-		$term = get_term( $category_id, 'espresso_venue_categories' );
1221
+		$term = get_term($category_id, 'espresso_venue_categories');
1222 1222
 
1223 1223
 
1224
-		if ( !empty( $term ) ) {
1224
+		if ( ! empty($term)) {
1225 1225
 			$this->_category->category_name = $term->name;
1226 1226
 			$this->_category->category_identifier = $term->slug;
1227 1227
 			$this->_category->category_desc = $term->description;
@@ -1235,14 +1235,14 @@  discard block
 block discarded – undo
1235 1235
 
1236 1236
 	private function _set_empty_category_object() {
1237 1237
 		$this->_category = new stdClass();
1238
-		$this->_category->category_name = $this->_category->category_identifier = $this->_category->category_desc  = '';
1238
+		$this->_category->category_name = $this->_category->category_identifier = $this->_category->category_desc = '';
1239 1239
 		$this->_category->id = $this->_category->parent = 0;
1240 1240
 	}
1241 1241
 
1242 1242
 
1243 1243
 
1244 1244
 	protected function _category_list_table() {
1245
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
1245
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1246 1246
 		$this->_admin_page_title .= $this->get_action_link_or_button('add_category', 'add_category', array(), 'add-new-h2');
1247 1247
 		$this->_search_btn_label = __('Venue Categories', 'event_espresso');
1248 1248
 		$this->display_admin_list_table_page_with_sidebar();
@@ -1258,13 +1258,13 @@  discard block
 block discarded – undo
1258 1258
 		$this->_set_add_edit_form_tags($route);
1259 1259
 
1260 1260
 		$this->_set_category_object();
1261
-		$id = !empty($this->_category->id) ? $this->_category->id : '';
1261
+		$id = ! empty($this->_category->id) ? $this->_category->id : '';
1262 1262
 
1263 1263
 		$delete_action = 'delete_category';
1264 1264
 
1265
-		$redirect = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'category_list' ), $this->_admin_base_url );
1265
+		$redirect = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'category_list'), $this->_admin_base_url);
1266 1266
 
1267
-		$this->_set_publish_post_box_vars( 'VEN_CAT_ID', $id, $delete_action, $redirect );
1267
+		$this->_set_publish_post_box_vars('VEN_CAT_ID', $id, $delete_action, $redirect);
1268 1268
 
1269 1269
 		//take care of contents
1270 1270
 		$this->_template_args['admin_page_content'] = $this->_category_details_content();
@@ -1278,25 +1278,25 @@  discard block
 block discarded – undo
1278 1278
 			'type' => 'wp_editor',
1279 1279
 			'value' => EEH_Formatter::admin_format_content($this->_category->category_desc),
1280 1280
 			'class' => 'my_editor_custom',
1281
-			'wpeditor_args' => array( 'media_buttons' => FALSE )
1281
+			'wpeditor_args' => array('media_buttons' => FALSE)
1282 1282
 		);
1283
-		$_wp_editor = $this->_generate_admin_form_fields( $editor_args, 'array' );
1283
+		$_wp_editor = $this->_generate_admin_form_fields($editor_args, 'array');
1284 1284
 
1285
-		$all_terms = get_terms( array('espresso_venue_categories' ), array( 'hide_empty' => 0, 'exclude' => array( $this->_category->id ) ) );
1285
+		$all_terms = get_terms(array('espresso_venue_categories'), array('hide_empty' => 0, 'exclude' => array($this->_category->id)));
1286 1286
 
1287 1287
 		//setup category select for term parents.
1288 1288
 		$category_select_values[] = array(
1289 1289
 			'text' => __('No Parent', 'event_espresso'),
1290 1290
 			'id' => 0
1291 1291
 			);
1292
-		foreach ( $all_terms as $term ) {
1292
+		foreach ($all_terms as $term) {
1293 1293
 			$category_select_values[] = array(
1294 1294
 				'text' => $term->name,
1295 1295
 				'id' => $term->term_id
1296 1296
 				);
1297 1297
 		}
1298 1298
 
1299
-		$category_select = EEH_Form_Fields::select_input( 'category_parent', $category_select_values, $this->_category->parent );
1299
+		$category_select = EEH_Form_Fields::select_input('category_parent', $category_select_values, $this->_category->parent);
1300 1300
 		$template_args = array(
1301 1301
 			'category' => $this->_category,
1302 1302
 			'category_select' => $category_select,
@@ -1305,15 +1305,15 @@  discard block
 block discarded – undo
1305 1305
 			'disable' => '',
1306 1306
 			'disabled_message' =>FALSE
1307 1307
 			);
1308
-		$template = EVENTS_TEMPLATE_PATH . 'event_category_details.template.php';
1309
-		return EEH_Template::display_template($template, $template_args, TRUE );
1308
+		$template = EVENTS_TEMPLATE_PATH.'event_category_details.template.php';
1309
+		return EEH_Template::display_template($template, $template_args, TRUE);
1310 1310
 	}
1311 1311
 
1312 1312
 
1313 1313
 	protected function _delete_categories() {
1314
-		$cat_ids = isset( $this->_req_data['VEN_CAT_ID'] ) ? (array) $this->_req_data['VEN_CAT_ID'] : (array) $this->_req_data['category_id'];
1314
+		$cat_ids = isset($this->_req_data['VEN_CAT_ID']) ? (array) $this->_req_data['VEN_CAT_ID'] : (array) $this->_req_data['category_id'];
1315 1315
 
1316
-		foreach ( $cat_ids as $cat_id ) {
1316
+		foreach ($cat_ids as $cat_id) {
1317 1317
 			$this->_delete_category($cat_id);
1318 1318
 		}
1319 1319
 
@@ -1321,7 +1321,7 @@  discard block
 block discarded – undo
1321 1321
 		$query_args = array(
1322 1322
 			'action' => 'category_list'
1323 1323
 			);
1324
-		$this->_redirect_after_action(0,'','',$query_args);
1324
+		$this->_redirect_after_action(0, '', '', $query_args);
1325 1325
 
1326 1326
 	}
1327 1327
 
@@ -1330,58 +1330,58 @@  discard block
 block discarded – undo
1330 1330
 
1331 1331
 
1332 1332
 	protected function _delete_category($cat_id) {
1333
-		$cat_id = absint( $cat_id );
1334
-		wp_delete_term( $cat_id, 'espresso_venue_categories' );
1333
+		$cat_id = absint($cat_id);
1334
+		wp_delete_term($cat_id, 'espresso_venue_categories');
1335 1335
 	}
1336 1336
 
1337 1337
 
1338 1338
 
1339 1339
 	protected function _insert_or_update_category($new_category) {
1340 1340
 
1341
-		$cat_id = $new_category ? $this->_insert_category() : $this->_insert_category( TRUE );
1341
+		$cat_id = $new_category ? $this->_insert_category() : $this->_insert_category(TRUE);
1342 1342
 		$success = 0; //we already have a success message so lets not send another.
1343
-		if ( $cat_id ) {
1343
+		if ($cat_id) {
1344 1344
 			$query_args = array(
1345 1345
 				'action'     => 'edit_category',
1346 1346
 				'VEN_CAT_ID' => $cat_id
1347 1347
 			);
1348 1348
 		} else {
1349
-			$query_args = array( 'action' => 'add_category' );
1349
+			$query_args = array('action' => 'add_category');
1350 1350
 		}
1351
-		$this->_redirect_after_action( $success, '','', $query_args, TRUE );
1351
+		$this->_redirect_after_action($success, '', '', $query_args, TRUE);
1352 1352
 
1353 1353
 	}
1354 1354
 
1355 1355
 
1356 1356
 
1357
-	private function _insert_category( $update = FALSE ) {
1357
+	private function _insert_category($update = FALSE) {
1358 1358
 		$cat_id = $update ? $this->_req_data['VEN_CAT_ID'] : '';
1359
-		$category_name= isset( $this->_req_data['category_name'] ) ? $this->_req_data['category_name'] : '';
1360
-		$category_desc= isset( $this->_req_data['category_desc'] ) ? $this->_req_data['category_desc'] : '';
1361
-		$category_parent = isset( $this->_req_data['category_parent'] ) ? $this->_req_data['category_parent'] : 0;
1359
+		$category_name = isset($this->_req_data['category_name']) ? $this->_req_data['category_name'] : '';
1360
+		$category_desc = isset($this->_req_data['category_desc']) ? $this->_req_data['category_desc'] : '';
1361
+		$category_parent = isset($this->_req_data['category_parent']) ? $this->_req_data['category_parent'] : 0;
1362 1362
 
1363
-		if ( empty( $category_name ) ) {
1364
-			$msg = __( 'You must add a name for the category.', 'event_espresso' );
1365
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
1363
+		if (empty($category_name)) {
1364
+			$msg = __('You must add a name for the category.', 'event_espresso');
1365
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1366 1366
 			return false;
1367 1367
 		}
1368 1368
 
1369 1369
 
1370
-		$term_args=array(
1370
+		$term_args = array(
1371 1371
 			'name'=>$category_name,
1372 1372
 			'description'=>$category_desc,
1373 1373
 			'parent'=>$category_parent
1374 1374
 		);
1375 1375
 
1376
-		$insert_ids = $update ? wp_update_term( $cat_id, 'espresso_venue_categories', $term_args ) :wp_insert_term( $category_name, 'espresso_venue_categories', $term_args );
1376
+		$insert_ids = $update ? wp_update_term($cat_id, 'espresso_venue_categories', $term_args) : wp_insert_term($category_name, 'espresso_venue_categories', $term_args);
1377 1377
 
1378
-		if ( !is_array( $insert_ids ) ) {
1379
-			$msg = __( 'An error occurred and the category has not been saved to the database.', 'event_espresso' );
1380
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
1378
+		if ( ! is_array($insert_ids)) {
1379
+			$msg = __('An error occurred and the category has not been saved to the database.', 'event_espresso');
1380
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1381 1381
 		} else {
1382 1382
 			$cat_id = $insert_ids['term_id'];
1383
-			$msg = sprintf ( __('The category %s was successfully created', 'event_espresso'), $category_name );
1384
-			EE_Error::add_success( $msg );
1383
+			$msg = sprintf(__('The category %s was successfully created', 'event_espresso'), $category_name);
1384
+			EE_Error::add_success($msg);
1385 1385
 		}
1386 1386
 
1387 1387
 		return $cat_id;
@@ -1401,11 +1401,11 @@  discard block
 block discarded – undo
1401 1401
 			'category_ids' => $this->_req_data['VEN_CAT_ID']
1402 1402
 			);
1403 1403
 
1404
-		$this->_req_data = array_merge( $this->_req_data, $new_request_args );
1404
+		$this->_req_data = array_merge($this->_req_data, $new_request_args);
1405 1405
 
1406
-		if ( is_readable( EE_CLASSES . 'EE_Export.class.php') ) {
1407
-			require_once( EE_CLASSES . 'EE_Export.class.php');
1408
-			$EE_Export = EE_Export::instance( $this->_req_data );
1406
+		if (is_readable(EE_CLASSES.'EE_Export.class.php')) {
1407
+			require_once(EE_CLASSES.'EE_Export.class.php');
1408
+			$EE_Export = EE_Export::instance($this->_req_data);
1409 1409
 			$EE_Export->export();
1410 1410
 		}
1411 1411
 
@@ -1417,7 +1417,7 @@  discard block
 block discarded – undo
1417 1417
 
1418 1418
 	protected function _import_categories() {
1419 1419
 
1420
-		require_once(EE_CLASSES . 'EE_Import.class.php');
1420
+		require_once(EE_CLASSES.'EE_Import.class.php');
1421 1421
 		EE_Import::instance()->import();
1422 1422
 
1423 1423
 	}
@@ -1425,29 +1425,29 @@  discard block
 block discarded – undo
1425 1425
 
1426 1426
 
1427 1427
 
1428
-	public function get_categories( $per_page = 10, $current_page = 1, $count = FALSE ) {
1428
+	public function get_categories($per_page = 10, $current_page = 1, $count = FALSE) {
1429 1429
 
1430 1430
 		//testing term stuff
1431
-		$orderby = isset( $this->_req_data['orderby'] ) ? $this->_req_data['orderby'] : 'Term.term_id';
1432
-		$order = isset( $this->_req_data['order'] ) ? $this->_req_data['order'] : 'DESC';
1433
-		$limit = ($current_page-1)*$per_page;
1434
-		$where = array( 'taxonomy' => 'espresso_venue_categories' );
1435
-		if ( isset( $this->_req_data['s'] ) ) {
1436
-			$sstr = '%' . $this->_req_data['s'] . '%';
1431
+		$orderby = isset($this->_req_data['orderby']) ? $this->_req_data['orderby'] : 'Term.term_id';
1432
+		$order = isset($this->_req_data['order']) ? $this->_req_data['order'] : 'DESC';
1433
+		$limit = ($current_page - 1) * $per_page;
1434
+		$where = array('taxonomy' => 'espresso_venue_categories');
1435
+		if (isset($this->_req_data['s'])) {
1436
+			$sstr = '%'.$this->_req_data['s'].'%';
1437 1437
 			$where['OR'] = array(
1438
-				'Term.name' => array( 'LIKE', $sstr),
1439
-				'description' => array( 'LIKE', $sstr )
1438
+				'Term.name' => array('LIKE', $sstr),
1439
+				'description' => array('LIKE', $sstr)
1440 1440
 				);
1441 1441
 		}
1442 1442
 
1443 1443
 		$query_params = array(
1444 1444
 			$where,
1445
-			'order_by' => array( $orderby => $order ),
1446
-			'limit' => $limit . ',' . $per_page,
1445
+			'order_by' => array($orderby => $order),
1446
+			'limit' => $limit.','.$per_page,
1447 1447
 			'force_join' => array('Term')
1448 1448
 			);
1449 1449
 
1450
-		$categories = $count ? EEM_Term_Taxonomy::instance()->count( $query_params, 'term_id' ) :EEM_Term_Taxonomy::instance()->get_all( $query_params );
1450
+		$categories = $count ? EEM_Term_Taxonomy::instance()->count($query_params, 'term_id') : EEM_Term_Taxonomy::instance()->get_all($query_params);
1451 1451
 
1452 1452
 		return $categories;
1453 1453
 	}
Please login to merge, or discard this patch.
admin_pages/events/Events_Admin_Page.core.php 1 patch
Spacing   +387 added lines, -387 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (!defined('EVENT_ESPRESSO_VERSION'))
2
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
3 3
 	exit('NO direct script access allowed');
4 4
 
5 5
 /**
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 		$this->_cpt_edit_routes = array(
67 67
 			'espresso_events' => 'edit'
68 68
 		);
69
-		add_action('AHEE__EE_Admin_Page_CPT__set_model_object__after_set_object', array( $this, 'verify_event_edit' ) );
69
+		add_action('AHEE__EE_Admin_Page_CPT__set_model_object__after_set_object', array($this, 'verify_event_edit'));
70 70
 	}
71 71
 
72 72
 	protected function _ajax_hooks() {
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 				'edit' => esc_html__('Update Event', 'event_espresso'),
93 93
 				'add_category' => esc_html__('Save New Category', 'event_espresso'),
94 94
 				'edit_category' => esc_html__('Update Category', 'event_espresso'),
95
-				'template_settings' => esc_html__( 'Update Settings', 'event_espresso' )
95
+				'template_settings' => esc_html__('Update Settings', 'event_espresso')
96 96
 				)
97 97
 		);
98 98
 	}
@@ -102,8 +102,8 @@  discard block
 block discarded – undo
102 102
 		//load field generator helper
103 103
 
104 104
 		//is there a evt_id in the request?
105
-		$evt_id = ! empty( $this->_req_data['EVT_ID'] ) && ! is_array( $this->_req_data['EVT_ID'] ) ? $this->_req_data['EVT_ID'] : 0;
106
-		$evt_id = ! empty( $this->_req_data['post'] ) ? $this->_req_data['post'] : $evt_id;
105
+		$evt_id = ! empty($this->_req_data['EVT_ID']) && ! is_array($this->_req_data['EVT_ID']) ? $this->_req_data['EVT_ID'] : 0;
106
+		$evt_id = ! empty($this->_req_data['post']) ? $this->_req_data['post'] : $evt_id;
107 107
 
108 108
 
109 109
 		$this->_page_routes = array(
@@ -317,7 +317,7 @@  discard block
 block discarded – undo
317 317
 				'help_tour' => array(
318 318
 					'Event_Editor_Help_Tour'
319 319
 					),
320
-				'qtips' => array( 'EE_Event_Editor_Decaf_Tips' ),
320
+				'qtips' => array('EE_Event_Editor_Decaf_Tips'),
321 321
 				'require_nonce' => FALSE
322 322
 			),
323 323
 			'edit' => array(
@@ -373,7 +373,7 @@  discard block
 block discarded – undo
373 373
 				/*'help_tour' => array(
374 374
 					'Event_Edit_Help_Tour'
375 375
 				),*/
376
-				'qtips' => array( 'EE_Event_Editor_Decaf_Tips' ),
376
+				'qtips' => array('EE_Event_Editor_Decaf_Tips'),
377 377
 				'require_nonce' => FALSE
378 378
 			),
379 379
 			'default_event_settings' => array(
@@ -395,7 +395,7 @@  discard block
 block discarded – undo
395 395
 						'filename' => 'events_default_settings_status'
396 396
 					)
397 397
 				),
398
-				'help_tour' => array( 'Event_Default_Settings_Help_Tour'),
398
+				'help_tour' => array('Event_Default_Settings_Help_Tour'),
399 399
 				'require_nonce' => FALSE
400 400
 			),
401 401
 			//template settings
@@ -411,7 +411,7 @@  discard block
 block discarded – undo
411 411
 						'filename' => 'general_settings_templates'
412 412
 					)
413 413
 				),
414
-				'help_tour' => array( 'Templates_Help_Tour' ),
414
+				'help_tour' => array('Templates_Help_Tour'),
415 415
 				'require_nonce' => FALSE
416 416
 			),
417 417
 			//event category stuff
@@ -435,7 +435,7 @@  discard block
 block discarded – undo
435 435
 					'label' => esc_html__('Edit Category', 'event_espresso'),
436 436
 					'order' => 15,
437 437
 					'persistent' => FALSE,
438
-					'url' => isset($this->_req_data['EVT_CAT_ID']) ? add_query_arg(array('EVT_CAT_ID' => $this->_req_data['EVT_CAT_ID'] ), $this->_current_page_view_url )  : $this->_admin_base_url
438
+					'url' => isset($this->_req_data['EVT_CAT_ID']) ? add_query_arg(array('EVT_CAT_ID' => $this->_req_data['EVT_CAT_ID']), $this->_current_page_view_url) : $this->_admin_base_url
439 439
 					),
440 440
 				'help_tabs' => array(
441 441
 					'edit_category_help_tab' => array(
@@ -505,14 +505,14 @@  discard block
 block discarded – undo
505 505
 
506 506
 	public function load_scripts_styles() {
507 507
 
508
-		wp_register_style('events-admin-css', EVENTS_ASSETS_URL . 'events-admin-page.css', array(), EVENT_ESPRESSO_VERSION);
509
-		wp_register_style('ee-cat-admin', EVENTS_ASSETS_URL . 'ee-cat-admin.css', array(), EVENT_ESPRESSO_VERSION );
508
+		wp_register_style('events-admin-css', EVENTS_ASSETS_URL.'events-admin-page.css', array(), EVENT_ESPRESSO_VERSION);
509
+		wp_register_style('ee-cat-admin', EVENTS_ASSETS_URL.'ee-cat-admin.css', array(), EVENT_ESPRESSO_VERSION);
510 510
 		wp_enqueue_style('events-admin-css');
511 511
 		wp_enqueue_style('ee-cat-admin');
512 512
 		//todo note: we also need to load_scripts_styles per view (i.e. default/view_report/event_details
513 513
 		//registers for all views
514 514
 		//scripts
515
-		wp_register_script('event_editor_js', EVENTS_ASSETS_URL . 'event_editor.js', array('ee_admin_js', 'jquery-ui-slider', 'jquery-ui-timepicker-addon'), EVENT_ESPRESSO_VERSION, TRUE);
515
+		wp_register_script('event_editor_js', EVENTS_ASSETS_URL.'event_editor.js', array('ee_admin_js', 'jquery-ui-slider', 'jquery-ui-timepicker-addon'), EVENT_ESPRESSO_VERSION, TRUE);
516 516
 	}
517 517
 
518 518
 	/**
@@ -530,11 +530,11 @@  discard block
 block discarded – undo
530 530
 	public function load_scripts_styles_edit() {
531 531
 		//styles
532 532
 		wp_enqueue_style('espresso-ui-theme');
533
-		wp_register_style('event-editor-css', EVENTS_ASSETS_URL . 'event-editor.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION );
533
+		wp_register_style('event-editor-css', EVENTS_ASSETS_URL.'event-editor.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION);
534 534
 		wp_enqueue_style('event-editor-css');
535 535
 
536 536
 		//scripts
537
-		wp_register_script('event-datetime-metabox', EVENTS_ASSETS_URL . 'event-datetime-metabox.js', array('event_editor_js', 'ee-datepicker'), EVENT_ESPRESSO_VERSION );
537
+		wp_register_script('event-datetime-metabox', EVENTS_ASSETS_URL.'event-datetime-metabox.js', array('event_editor_js', 'ee-datepicker'), EVENT_ESPRESSO_VERSION);
538 538
 		wp_enqueue_script('event-datetime-metabox');
539 539
 
540 540
 	}
@@ -569,7 +569,7 @@  discard block
 block discarded – undo
569 569
 
570 570
 
571 571
 	public function admin_init() {
572
-		EE_Registry::$i18n_js_strings[ 'image_confirm' ] = esc_html__( 'Do you really want to delete this image? Please remember to update your event to complete the removal.', 'event_espresso' );
572
+		EE_Registry::$i18n_js_strings['image_confirm'] = esc_html__('Do you really want to delete this image? Please remember to update your event to complete the removal.', 'event_espresso');
573 573
 	}
574 574
 
575 575
 
@@ -590,12 +590,12 @@  discard block
 block discarded – undo
590 590
 	 */
591 591
 	public function verify_event_edit($event = NULL) {
592 592
 		// no event?
593
-		if ( empty( $event )) {
593
+		if (empty($event)) {
594 594
 			// set event
595 595
 			$event = $this->_cpt_model_obj;
596 596
 		}
597 597
 		// STILL no event?
598
-		if ( empty ( $event )) {
598
+		if (empty ($event)) {
599 599
 			return;
600 600
 		}
601 601
 		$orig_status = $event->status();
@@ -609,27 +609,27 @@  discard block
 block discarded – undo
609 609
 			return;
610 610
 		}
611 611
 		//made it here so it IS active... next check that any of the tickets are sold.
612
-		if ( $event->is_sold_out( true ) ) {
613
-			if ( $orig_status !== EEM_Event::sold_out && $event->status() !== $orig_status ) {
612
+		if ($event->is_sold_out(true)) {
613
+			if ($orig_status !== EEM_Event::sold_out && $event->status() !== $orig_status) {
614 614
 				EE_Error::add_attention(
615 615
 					sprintf(
616
-						esc_html__( 'Please note that the Event Status has automatically been changed to %s because there are no more spaces available for this event.  However, this change is not permanent until you update the event.  You can change the status back to something else before updating if you wish.', 'event_espresso' ),
617
-						EEH_Template::pretty_status( EEM_Event::sold_out, FALSE, 'sentence' )
616
+						esc_html__('Please note that the Event Status has automatically been changed to %s because there are no more spaces available for this event.  However, this change is not permanent until you update the event.  You can change the status back to something else before updating if you wish.', 'event_espresso'),
617
+						EEH_Template::pretty_status(EEM_Event::sold_out, FALSE, 'sentence')
618 618
 					)
619 619
 				);
620 620
 			}
621 621
 			return;
622
-		} else if ( $orig_status === EEM_Event::sold_out ) {
622
+		} else if ($orig_status === EEM_Event::sold_out) {
623 623
 			EE_Error::add_attention(
624 624
 				sprintf(
625
-					esc_html__( 'Please note that the Event Status has automatically been changed to %s because more spaces have become available for this event, most likely due to abandoned transactions freeing up reserved tickets.  However, this change is not permanent until you update the event. If you wish, you can change the status back to something else before updating.',
626
-						'event_espresso' ),
627
-					EEH_Template::pretty_status( $event->status(), false, 'sentence' )
625
+					esc_html__('Please note that the Event Status has automatically been changed to %s because more spaces have become available for this event, most likely due to abandoned transactions freeing up reserved tickets.  However, this change is not permanent until you update the event. If you wish, you can change the status back to something else before updating.',
626
+						'event_espresso'),
627
+					EEH_Template::pretty_status($event->status(), false, 'sentence')
628 628
 				)
629 629
 			);
630 630
 		}
631 631
 		//now we need to determine if the event has any tickets on sale.  If not then we dont' show the error
632
-		if ( ! $event->tickets_on_sale() ) {
632
+		if ( ! $event->tickets_on_sale()) {
633 633
 			return;
634 634
 		}
635 635
 		//made it here so show warning
@@ -648,7 +648,7 @@  discard block
 block discarded – undo
648 648
 	 */
649 649
 	protected function _edit_event_warning() {
650 650
 		// we don't want to add warnings during these requests
651
-		if ( isset( $this->_req_data['action'] ) && $this->_req_data['action'] === 'editpost' ) {
651
+		if (isset($this->_req_data['action']) && $this->_req_data['action'] === 'editpost') {
652 652
 			return;
653 653
 		}
654 654
 		EE_Error::add_attention(
@@ -679,7 +679,7 @@  discard block
 block discarded – undo
679 679
 			),
680 680
 		);
681 681
 
682
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_events', 'espresso_events_trash_events' ) ) {
682
+		if (EE_Registry::instance()->CAP->current_user_can('ee_delete_events', 'espresso_events_trash_events')) {
683 683
 			$this->_views['trash'] = array(
684 684
 				'slug' => 'trash',
685 685
 				'label' => esc_html__('Trash', 'event_espresso'),
@@ -709,39 +709,39 @@  discard block
 block discarded – undo
709 709
 				'desc' => esc_html__('View Registrations for Event', 'event_espresso')
710 710
 			)
711 711
 		);
712
-		$items  = apply_filters( 'FHEE__Events_Admin_Page___event_legend_items__items', $items );
712
+		$items = apply_filters('FHEE__Events_Admin_Page___event_legend_items__items', $items);
713 713
 		$statuses = array(
714 714
 			'sold_out_status' => array(
715
-				'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::sold_out,
716
-				'desc' => EEH_Template::pretty_status( EE_Datetime::sold_out, FALSE, 'sentence' )
715
+				'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::sold_out,
716
+				'desc' => EEH_Template::pretty_status(EE_Datetime::sold_out, FALSE, 'sentence')
717 717
 			),
718 718
 			'active_status' => array(
719
-				'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::active,
720
-				'desc' => EEH_Template::pretty_status( EE_Datetime::active, FALSE, 'sentence' )
719
+				'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::active,
720
+				'desc' => EEH_Template::pretty_status(EE_Datetime::active, FALSE, 'sentence')
721 721
 			),
722 722
 			'upcoming_status' => array(
723
-				'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::upcoming,
724
-				'desc' => EEH_Template::pretty_status( EE_Datetime::upcoming, FALSE, 'sentence' )
723
+				'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::upcoming,
724
+				'desc' => EEH_Template::pretty_status(EE_Datetime::upcoming, FALSE, 'sentence')
725 725
 			),
726 726
 			'postponed_status' => array(
727
-				'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::postponed,
728
-				'desc' => EEH_Template::pretty_status( EE_Datetime::postponed, FALSE, 'sentence' )
727
+				'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::postponed,
728
+				'desc' => EEH_Template::pretty_status(EE_Datetime::postponed, FALSE, 'sentence')
729 729
 			),
730 730
 			'cancelled_status' => array(
731
-				'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::cancelled,
732
-				'desc' => EEH_Template::pretty_status( EE_Datetime::cancelled, FALSE, 'sentence' )
731
+				'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::cancelled,
732
+				'desc' => EEH_Template::pretty_status(EE_Datetime::cancelled, FALSE, 'sentence')
733 733
 			),
734 734
 			'expired_status' => array(
735
-				'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::expired,
736
-				'desc' => EEH_Template::pretty_status( EE_Datetime::expired, FALSE, 'sentence' )
735
+				'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::expired,
736
+				'desc' => EEH_Template::pretty_status(EE_Datetime::expired, FALSE, 'sentence')
737 737
 			),
738 738
 			'inactive_status' => array(
739
-				'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::inactive,
740
-				'desc' => EEH_Template::pretty_status( EE_Datetime::inactive, FALSE, 'sentence' )
739
+				'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::inactive,
740
+				'desc' => EEH_Template::pretty_status(EE_Datetime::inactive, FALSE, 'sentence')
741 741
 			)
742 742
 		);
743
-		$statuses = apply_filters( 'FHEE__Events_Admin_Page__event_legend_items__statuses', $statuses );
744
-		return array_merge( $items, $statuses );
743
+		$statuses = apply_filters('FHEE__Events_Admin_Page__event_legend_items__statuses', $statuses);
744
+		return array_merge($items, $statuses);
745 745
 	}
746 746
 
747 747
 
@@ -753,8 +753,8 @@  discard block
 block discarded – undo
753 753
 	 * @return EEM_Event
754 754
 	 */
755 755
 	private function _event_model() {
756
-		if ( ! $this->_event_model instanceof EEM_Event ) {
757
-			$this->_event_model = EE_Registry::instance()->load_model( 'Event' );
756
+		if ( ! $this->_event_model instanceof EEM_Event) {
757
+			$this->_event_model = EE_Registry::instance()->load_model('Event');
758 758
 		}
759 759
 		return $this->_event_model;
760 760
 	}
@@ -773,12 +773,12 @@  discard block
 block discarded – undo
773 773
 	 * @param  string $new_slug  what the slug is
774 774
 	 * @return string            The new html string for the permalink area
775 775
 	 */
776
-	public function extra_permalink_field_buttons( $return, $id, $new_title, $new_slug ) {
776
+	public function extra_permalink_field_buttons($return, $id, $new_title, $new_slug) {
777 777
 		//make sure this is only when editing
778
-		if ( !empty( $id ) ) {
779
-			$post = get_post( $id );
780
-			$return .= '<a class="button button-small" onclick="prompt(\'Shortcode:\', jQuery(\'#shortcode\').val()); return false;" href="#"  tabindex="-1">' . esc_html__('Shortcode', 'event_espresso') . '</a> ';
781
-			$return .= '<input id="shortcode" type="hidden" value="[ESPRESSO_TICKET_SELECTOR event_id=' . $post->ID . ']">';
778
+		if ( ! empty($id)) {
779
+			$post = get_post($id);
780
+			$return .= '<a class="button button-small" onclick="prompt(\'Shortcode:\', jQuery(\'#shortcode\').val()); return false;" href="#"  tabindex="-1">'.esc_html__('Shortcode', 'event_espresso').'</a> ';
781
+			$return .= '<input id="shortcode" type="hidden" value="[ESPRESSO_TICKET_SELECTOR event_id='.$post->ID.']">';
782 782
 		}
783 783
 		return $return;
784 784
 	}
@@ -794,8 +794,8 @@  discard block
 block discarded – undo
794 794
 	 * @return string html for generated table
795 795
 	 */
796 796
 	protected function _events_overview_list_table() {
797
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
798
-		$this->_template_args['after_list_table'] = EEH_Template::get_button_or_link( get_post_type_archive_link('espresso_events'), esc_html__("View Event Archive Page", "event_espresso"), 'button' ) .
797
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
798
+		$this->_template_args['after_list_table'] = EEH_Template::get_button_or_link(get_post_type_archive_link('espresso_events'), esc_html__("View Event Archive Page", "event_espresso"), 'button').
799 799
 		$this->_display_legend($this->_event_legend_items());
800 800
 		$this->_admin_page_title .= $this->get_action_link_or_button('create_new', 'add', array(), 'add-new-h2');
801 801
 		$this->display_admin_list_table_page_with_no_sidebar();
@@ -813,51 +813,51 @@  discard block
 block discarded – undo
813 813
 
814 814
 
815 815
 
816
-	protected function _insert_update_cpt_item( $post_id, $post ) {
816
+	protected function _insert_update_cpt_item($post_id, $post) {
817 817
 
818
-		if ( $post instanceof WP_Post && $post->post_type !== 'espresso_events' ) {
818
+		if ($post instanceof WP_Post && $post->post_type !== 'espresso_events') {
819 819
 			//getout we're not processing an event save.
820 820
 			return;
821 821
 		}
822 822
 
823 823
 		$event_values = array(
824
-			'EVT_display_desc' => !empty( $this->_req_data['display_desc'] ) ? 1 : 0,
825
-			'EVT_display_ticket_selector' => !empty( $this->_req_data['display_ticket_selector'] ) ? 1 : 0,
824
+			'EVT_display_desc' => ! empty($this->_req_data['display_desc']) ? 1 : 0,
825
+			'EVT_display_ticket_selector' => ! empty($this->_req_data['display_ticket_selector']) ? 1 : 0,
826 826
 			'EVT_additional_limit' => min(
827
-					apply_filters( 'FHEE__EE_Events_Admin__insert_update_cpt_item__EVT_additional_limit_max', 255 ),
828
-					!empty( $this->_req_data['additional_limit'] ) ? $this->_req_data['additional_limit'] : NULL ),
829
-			'EVT_default_registration_status' => !empty( $this->_req_data['EVT_default_registration_status'] ) ? $this->_req_data['EVT_default_registration_status'] : EE_Registry::instance()->CFG->registration->default_STS_ID,
830
-			'EVT_member_only' => !empty( $this->_req_data['member_only'] ) ? 1 : 0,
831
-			'EVT_allow_overflow' => !empty( $this->_req_data['EVT_allow_overflow'] ) ? 1 : 0,
832
-			'EVT_timezone_string' => !empty( $this->_req_data['timezone_string'] ) ? $this->_req_data['timezone_string'] : NULL,
833
-			'EVT_external_URL' => !empty( $this->_req_data['externalURL'] ) ? $this->_req_data['externalURL'] : NULL,
834
-			'EVT_phone' => !empty( $this->_req_data['event_phone'] ) ? $this->_req_data['event_phone'] : NULL
827
+					apply_filters('FHEE__EE_Events_Admin__insert_update_cpt_item__EVT_additional_limit_max', 255),
828
+					! empty($this->_req_data['additional_limit']) ? $this->_req_data['additional_limit'] : NULL ),
829
+			'EVT_default_registration_status' => ! empty($this->_req_data['EVT_default_registration_status']) ? $this->_req_data['EVT_default_registration_status'] : EE_Registry::instance()->CFG->registration->default_STS_ID,
830
+			'EVT_member_only' => ! empty($this->_req_data['member_only']) ? 1 : 0,
831
+			'EVT_allow_overflow' => ! empty($this->_req_data['EVT_allow_overflow']) ? 1 : 0,
832
+			'EVT_timezone_string' => ! empty($this->_req_data['timezone_string']) ? $this->_req_data['timezone_string'] : NULL,
833
+			'EVT_external_URL' => ! empty($this->_req_data['externalURL']) ? $this->_req_data['externalURL'] : NULL,
834
+			'EVT_phone' => ! empty($this->_req_data['event_phone']) ? $this->_req_data['event_phone'] : NULL
835 835
 			);
836 836
 
837 837
 		//update event
838
-		$success = $this->_event_model()->update_by_ID( $event_values, $post_id );
838
+		$success = $this->_event_model()->update_by_ID($event_values, $post_id);
839 839
 
840 840
 
841 841
 		//get event_object for other metaboxes... though it would seem to make sense to just use $this->_event_model()->get_one_by_ID( $post_id ).. i have to setup where conditions to override the filters in the model that filter out autodraft and inherit statuses so we GET the inherit id!
842
-		$get_one_where = array( $this->_event_model()->primary_key_name() => $post_id, 'status' => $post->post_status );
843
-		$event = $this->_event_model()->get_one( array($get_one_where) );
842
+		$get_one_where = array($this->_event_model()->primary_key_name() => $post_id, 'status' => $post->post_status);
843
+		$event = $this->_event_model()->get_one(array($get_one_where));
844 844
 
845 845
 
846 846
 		//the following are default callbacks for event attachment updates that can be overridden by caffeinated functionality and/or addons.
847
-		$event_update_callbacks = apply_filters( 'FHEE__Events_Admin_Page___insert_update_cpt_item__event_update_callbacks', array( array($this, '_default_venue_update' ), array( $this, '_default_tickets_update') ) );
847
+		$event_update_callbacks = apply_filters('FHEE__Events_Admin_Page___insert_update_cpt_item__event_update_callbacks', array(array($this, '_default_venue_update'), array($this, '_default_tickets_update')));
848 848
 
849 849
 		$att_success = TRUE;
850 850
 
851
-		foreach ( $event_update_callbacks as $e_callback ) {
852
-			$_succ = call_user_func_array( $e_callback, array( $event,  $this->_req_data ) );
853
-			$att_success = !$att_success ? $att_success : $_succ; //if ANY of these updates fail then we want the appropriate global error message
851
+		foreach ($event_update_callbacks as $e_callback) {
852
+			$_succ = call_user_func_array($e_callback, array($event, $this->_req_data));
853
+			$att_success = ! $att_success ? $att_success : $_succ; //if ANY of these updates fail then we want the appropriate global error message
854 854
 		}
855 855
 
856 856
 		//any errors?
857
-		if ( $success && FALSE === $att_success ) {
858
-			EE_Error::add_error( esc_html__('Event Details saved successfully but something went wrong with saving attachments.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
859
-		} else if ( $success === FALSE ) {
860
-			EE_Error::add_error( esc_html__('Event Details did not save successfully.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
857
+		if ($success && FALSE === $att_success) {
858
+			EE_Error::add_error(esc_html__('Event Details saved successfully but something went wrong with saving attachments.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
859
+		} else if ($success === FALSE) {
860
+			EE_Error::add_error(esc_html__('Event Details did not save successfully.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
861 861
 		}
862 862
 	}
863 863
 
@@ -867,14 +867,14 @@  discard block
 block discarded – undo
867 867
 	/**
868 868
 	 * @see parent::restore_item()
869 869
 	 */
870
-	protected function _restore_cpt_item( $post_id, $revision_id ) {
870
+	protected function _restore_cpt_item($post_id, $revision_id) {
871 871
 		//copy existing event meta to new post
872 872
 		$post_evt = $this->_event_model()->get_one_by_ID($post_id);
873
-		if ( $post_evt instanceof EE_Event ) {
873
+		if ($post_evt instanceof EE_Event) {
874 874
 			//meta revision restore
875
-			$post_evt->restore_revision( $revision_id );
875
+			$post_evt->restore_revision($revision_id);
876 876
 			//related objs restore
877
-			$post_evt->restore_revision( $revision_id, array( 'Venue', 'Datetime', 'Price' ) );
877
+			$post_evt->restore_revision($revision_id, array('Venue', 'Datetime', 'Price'));
878 878
 		}
879 879
 	}
880 880
 
@@ -887,52 +887,52 @@  discard block
 block discarded – undo
887 887
 	 * @param  array  $data   The request data from the form
888 888
 	 * @return bool           Success or fail.
889 889
 	 */
890
-	protected function _default_venue_update( $evtobj, $data ) {
891
-		require_once( EE_MODELS . 'EEM_Venue.model.php' );
890
+	protected function _default_venue_update($evtobj, $data) {
891
+		require_once(EE_MODELS.'EEM_Venue.model.php');
892 892
 		$venue_model = EE_Registry::instance()->load_model('Venue');
893 893
 		$rows_affected = NULL;
894
-		$venue_id = !empty( $data['venue_id'] ) ? $data['venue_id'] : NULL;
894
+		$venue_id = ! empty($data['venue_id']) ? $data['venue_id'] : NULL;
895 895
 
896 896
 		// very important.  If we don't have a venue name...
897 897
 		// then we'll get out because not necessary to create empty venue
898
-		if ( empty( $data['venue_title'] ) ) {
898
+		if (empty($data['venue_title'])) {
899 899
 			return false;
900 900
 		}
901 901
 
902 902
 		$venue_array = array(
903 903
 				'VNU_wp_user' => $evtobj->get('EVT_wp_user'),
904
-				'VNU_name' => !empty( $data['venue_title'] ) ? $data['venue_title'] : NULL,
905
-				'VNU_desc' => !empty( $data['venue_description'] ) ? $data['venue_description'] : NULL,
906
-				'VNU_identifier' => !empty( $data['venue_identifier'] ) ? $data['venue_identifier'] : NULL,
907
-				'VNU_short_desc' => !empty( $data['venue_short_description'] ) ? $data['venue_short_description'] : NULL,
908
-				'VNU_address' => !empty( $data['address'] ) ? $data['address'] : NULL,
909
-				'VNU_address2' => !empty( $data['address2'] ) ? $data['address2'] : NULL,
910
-				'VNU_city' => !empty( $data['city'] ) ? $data['city'] : NULL,
911
-				'STA_ID' => !empty( $data['state'] ) ? $data['state'] : NULL,
912
-				'CNT_ISO' => !empty( $data['countries'] ) ? $data['countries'] : NULL,
913
-				'VNU_zip' => !empty( $data['zip'] ) ? $data['zip'] : NULL,
914
-				'VNU_phone' => !empty( $data['venue_phone'] ) ? $data['venue_phone'] : NULL,
915
-				'VNU_capacity' => !empty( $data['venue_capacity'] ) ? $data['venue_capacity'] : NULL,
916
-				'VNU_url' => !empty($data['venue_url'] ) ? $data['venue_url'] : NULL,
917
-				'VNU_virtual_phone' => !empty($data['virtual_phone']) ? $data['virtual_phone'] : NULL,
918
-				'VNU_virtual_url' => !empty( $data['virtual_url'] ) ? $data['virtual_url'] : NULL,
919
-				'VNU_enable_for_gmap' => isset( $data['enable_for_gmap'] ) ? 1 : 0,
904
+				'VNU_name' => ! empty($data['venue_title']) ? $data['venue_title'] : NULL,
905
+				'VNU_desc' => ! empty($data['venue_description']) ? $data['venue_description'] : NULL,
906
+				'VNU_identifier' => ! empty($data['venue_identifier']) ? $data['venue_identifier'] : NULL,
907
+				'VNU_short_desc' => ! empty($data['venue_short_description']) ? $data['venue_short_description'] : NULL,
908
+				'VNU_address' => ! empty($data['address']) ? $data['address'] : NULL,
909
+				'VNU_address2' => ! empty($data['address2']) ? $data['address2'] : NULL,
910
+				'VNU_city' => ! empty($data['city']) ? $data['city'] : NULL,
911
+				'STA_ID' => ! empty($data['state']) ? $data['state'] : NULL,
912
+				'CNT_ISO' => ! empty($data['countries']) ? $data['countries'] : NULL,
913
+				'VNU_zip' => ! empty($data['zip']) ? $data['zip'] : NULL,
914
+				'VNU_phone' => ! empty($data['venue_phone']) ? $data['venue_phone'] : NULL,
915
+				'VNU_capacity' => ! empty($data['venue_capacity']) ? $data['venue_capacity'] : NULL,
916
+				'VNU_url' => ! empty($data['venue_url']) ? $data['venue_url'] : NULL,
917
+				'VNU_virtual_phone' => ! empty($data['virtual_phone']) ? $data['virtual_phone'] : NULL,
918
+				'VNU_virtual_url' => ! empty($data['virtual_url']) ? $data['virtual_url'] : NULL,
919
+				'VNU_enable_for_gmap' => isset($data['enable_for_gmap']) ? 1 : 0,
920 920
 				'status' => 'publish'
921 921
 			);
922 922
 
923 923
 
924 924
 		//if we've got the venue_id then we're just updating the existing venue so let's do that and then get out.
925
-		if ( !empty( $venue_id ) ) {
926
-			$update_where = array( $venue_model->primary_key_name() => $venue_id );
927
-			$rows_affected = $venue_model->update( $venue_array, array( $update_where ) );
925
+		if ( ! empty($venue_id)) {
926
+			$update_where = array($venue_model->primary_key_name() => $venue_id);
927
+			$rows_affected = $venue_model->update($venue_array, array($update_where));
928 928
 			//we've gotta make sure that the venue is always attached to a revision.. add_relation_to should take care of making sure that the relation is already present.
929
-			$evtobj->_add_relation_to( $venue_id, 'Venue' );
929
+			$evtobj->_add_relation_to($venue_id, 'Venue');
930 930
 			return $rows_affected > 0 ? TRUE : FALSE;
931 931
 		} else {
932 932
 			//we insert the venue
933
-			$venue_id = $venue_model->insert( $venue_array );
934
-			$evtobj->_add_relation_to( $venue_id, 'Venue' );
935
-			return !empty( $venue_id ) ? TRUE : FALSE;
933
+			$venue_id = $venue_model->insert($venue_array);
934
+			$evtobj->_add_relation_to($venue_id, 'Venue');
935
+			return ! empty($venue_id) ? TRUE : FALSE;
936 936
 		}
937 937
 		//when we have the ancestor come in it's already been handled by the revision save.
938 938
 	}
@@ -946,54 +946,54 @@  discard block
 block discarded – undo
946 946
 	 * @param  array    $data   The request data from the form
947 947
 	 * @return bool             success or fail
948 948
 	 */
949
-	protected function _default_tickets_update( EE_Event $evtobj, $data ) {
949
+	protected function _default_tickets_update(EE_Event $evtobj, $data) {
950 950
 		$success = true;
951 951
 		$saved_dtt = null;
952 952
 		$saved_tickets = array();
953
-		$incoming_date_formats = array( 'Y-m-d', 'h:i a' );
953
+		$incoming_date_formats = array('Y-m-d', 'h:i a');
954 954
 
955
-		foreach ( $data['edit_event_datetimes'] as $row => $dtt ) {
955
+		foreach ($data['edit_event_datetimes'] as $row => $dtt) {
956 956
 			//trim all values to ensure any excess whitespace is removed.
957
-			$dtt =  array_map( 'trim', $dtt );
958
-			$dtt['DTT_EVT_end'] = isset($dtt['DTT_EVT_end']) && ! empty( $dtt['DTT_EVT_end'] ) ? $dtt['DTT_EVT_end'] : $dtt['DTT_EVT_start'];
957
+			$dtt = array_map('trim', $dtt);
958
+			$dtt['DTT_EVT_end'] = isset($dtt['DTT_EVT_end']) && ! empty($dtt['DTT_EVT_end']) ? $dtt['DTT_EVT_end'] : $dtt['DTT_EVT_start'];
959 959
 			$datetime_values = array(
960
-				'DTT_ID' 		=> ! empty( $dtt['DTT_ID'] ) ? $dtt['DTT_ID'] : NULL,
960
+				'DTT_ID' 		=> ! empty($dtt['DTT_ID']) ? $dtt['DTT_ID'] : NULL,
961 961
 				'DTT_EVT_start' => $dtt['DTT_EVT_start'],
962 962
 				'DTT_EVT_end' 	=> $dtt['DTT_EVT_end'],
963
-				'DTT_reg_limit' => empty( $dtt['DTT_reg_limit'] ) ? EE_INF : $dtt['DTT_reg_limit'],
963
+				'DTT_reg_limit' => empty($dtt['DTT_reg_limit']) ? EE_INF : $dtt['DTT_reg_limit'],
964 964
 				'DTT_order' 	=> $row,
965 965
 			);
966 966
 
967 967
 			//if we have an id then let's get existing object first and then set the new values.  Otherwise we instantiate a new object for save.
968 968
 
969
-			if ( !empty( $dtt['DTT_ID'] ) ) {
970
-				$DTM = EE_Registry::instance()->load_model('Datetime', array( $evtobj->get_timezone() ) )->get_one_by_ID($dtt['DTT_ID'] );
971
-				$DTM->set_date_format( $incoming_date_formats[0] );
972
-				$DTM->set_time_format( $incoming_date_formats[1] );
973
-				foreach ( $datetime_values as $field => $value ) {
974
-					$DTM->set( $field, $value );
969
+			if ( ! empty($dtt['DTT_ID'])) {
970
+				$DTM = EE_Registry::instance()->load_model('Datetime', array($evtobj->get_timezone()))->get_one_by_ID($dtt['DTT_ID']);
971
+				$DTM->set_date_format($incoming_date_formats[0]);
972
+				$DTM->set_time_format($incoming_date_formats[1]);
973
+				foreach ($datetime_values as $field => $value) {
974
+					$DTM->set($field, $value);
975 975
 				}
976 976
 
977 977
 				//make sure the $dtt_id here is saved just in case after the add_relation_to() the autosave replaces it.  We need to do this so we dont' TRASH the parent DTT.
978 978
 				$saved_dtts[$DTM->ID()] = $DTM;
979 979
 			} else {
980
-				$DTM = EE_Registry::instance()->load_class('Datetime', array( $datetime_values ), FALSE, FALSE );
981
-				$DTM->set_date_format( $incoming_date_formats[0] );
982
-				$DTM->set_time_format( $incoming_date_formats[1] );
983
-				$DTM->set_timezone( $evtobj->get_timezone() );
984
-				foreach ( $datetime_values as $field => $value ) {
985
-					$DTM->set( $field, $value );
980
+				$DTM = EE_Registry::instance()->load_class('Datetime', array($datetime_values), FALSE, FALSE);
981
+				$DTM->set_date_format($incoming_date_formats[0]);
982
+				$DTM->set_time_format($incoming_date_formats[1]);
983
+				$DTM->set_timezone($evtobj->get_timezone());
984
+				foreach ($datetime_values as $field => $value) {
985
+					$DTM->set($field, $value);
986 986
 				}
987 987
 			}
988 988
 			$DTM->save();
989 989
 
990
-			$DTT = $evtobj->_add_relation_to( $DTM, 'Datetime' );
990
+			$DTT = $evtobj->_add_relation_to($DTM, 'Datetime');
991 991
 
992 992
 			//load DTT helper
993 993
 
994 994
 			//before going any further make sure our dates are setup correctly so that the end date is always equal or greater than the start date.
995
-			if( $DTT->get_raw('DTT_EVT_start') > $DTT->get_raw('DTT_EVT_end') ) {
996
-				$DTT->set('DTT_EVT_end', $DTT->get('DTT_EVT_start') );
995
+			if ($DTT->get_raw('DTT_EVT_start') > $DTT->get_raw('DTT_EVT_end')) {
996
+				$DTT->set('DTT_EVT_end', $DTT->get('DTT_EVT_start'));
997 997
 				$DTT = EEH_DTT_Helper::date_time_add($DTT, 'DTT_EVT_end', 'days');
998 998
 				$DTT->save();
999 999
 			}
@@ -1001,45 +1001,45 @@  discard block
 block discarded – undo
1001 1001
 			//now we got to make sure we add the new DTT_ID to the $saved_dtts array  because it is possible there was a new one created for the autosave.
1002 1002
 			$saved_dtt = $DTT;
1003 1003
 
1004
-			$success = !$success ? $success : $DTT; //if ANY of these updates fail then we want the appropriate global error message. //todod this is actually sucky we need a better error message but this is what it is for now.
1004
+			$success = ! $success ? $success : $DTT; //if ANY of these updates fail then we want the appropriate global error message. //todod this is actually sucky we need a better error message but this is what it is for now.
1005 1005
 		}
1006 1006
 
1007 1007
 		//no dtts get deleted so we don't do any of that logic here.
1008 1008
 		//update tickets next
1009
-		$old_tickets = isset( $data['ticket_IDs'] ) ? explode(',', $data['ticket_IDs'] ) : array();
1010
-		foreach ( $data['edit_tickets'] as $row => $tkt ) {
1011
-			$incoming_date_formats = array( 'Y-m-d', 'h:i a' );
1009
+		$old_tickets = isset($data['ticket_IDs']) ? explode(',', $data['ticket_IDs']) : array();
1010
+		foreach ($data['edit_tickets'] as $row => $tkt) {
1011
+			$incoming_date_formats = array('Y-m-d', 'h:i a');
1012 1012
 			$update_prices = false;
1013
-			$ticket_price = isset( $data['edit_prices'][$row][1]['PRC_amount'] ) ? $data['edit_prices'][$row][1]['PRC_amount'] : 0;
1013
+			$ticket_price = isset($data['edit_prices'][$row][1]['PRC_amount']) ? $data['edit_prices'][$row][1]['PRC_amount'] : 0;
1014 1014
 
1015 1015
 			// trim inputs to ensure any excess whitespace is removed.
1016
-			$tkt = array_map( 'trim', $tkt );
1016
+			$tkt = array_map('trim', $tkt);
1017 1017
 
1018
-			if ( empty( $tkt['TKT_start_date'] ) ) {
1018
+			if (empty($tkt['TKT_start_date'])) {
1019 1019
 				//let's use now in the set timezone.
1020
-				$now = new DateTime( 'now', new DateTimeZone( $evtobj->get_timezone() ) );
1021
-				$tkt['TKT_start_date'] = $now->format( $incoming_date_formats[0] . ' ' . $incoming_date_formats[1] );
1020
+				$now = new DateTime('now', new DateTimeZone($evtobj->get_timezone()));
1021
+				$tkt['TKT_start_date'] = $now->format($incoming_date_formats[0].' '.$incoming_date_formats[1]);
1022 1022
 			}
1023 1023
 
1024
-			if ( empty( $tkt['TKT_end_date'] ) ) {
1024
+			if (empty($tkt['TKT_end_date'])) {
1025 1025
 				//use the start date of the first datetime
1026 1026
 				$dtt = $evtobj->first_datetime();
1027
-				$tkt['TKT_end_date'] = $dtt->start_date_and_time( $incoming_date_formats[0], $incoming_date_formats[1] );
1027
+				$tkt['TKT_end_date'] = $dtt->start_date_and_time($incoming_date_formats[0], $incoming_date_formats[1]);
1028 1028
 			}
1029 1029
 
1030 1030
 			$TKT_values = array(
1031
-				'TKT_ID' 			=> !empty( $tkt['TKT_ID'] ) ? $tkt['TKT_ID'] : NULL,
1032
-				'TTM_ID' 			=> !empty( $tkt['TTM_ID'] ) ? $tkt['TTM_ID'] : 0,
1033
-				'TKT_name' 			=> !empty( $tkt['TKT_name'] ) ? $tkt['TKT_name'] : '',
1034
-				'TKT_description' 	=> !empty( $tkt['TKT_description'] ) ? $tkt['TKT_description'] : '',
1031
+				'TKT_ID' 			=> ! empty($tkt['TKT_ID']) ? $tkt['TKT_ID'] : NULL,
1032
+				'TTM_ID' 			=> ! empty($tkt['TTM_ID']) ? $tkt['TTM_ID'] : 0,
1033
+				'TKT_name' 			=> ! empty($tkt['TKT_name']) ? $tkt['TKT_name'] : '',
1034
+				'TKT_description' 	=> ! empty($tkt['TKT_description']) ? $tkt['TKT_description'] : '',
1035 1035
 				'TKT_start_date' 	=> $tkt['TKT_start_date'],
1036 1036
 				'TKT_end_date' 		=> $tkt['TKT_end_date'],
1037
-				'TKT_qty' 			=> ! isset( $tkt[ 'TKT_qty' ] ) || $tkt[ 'TKT_qty' ] === '' ? EE_INF : $tkt['TKT_qty'],
1038
-				'TKT_uses' 			=> ! isset( $tkt[ 'TKT_uses' ] ) || $tkt[ 'TKT_uses' ] === '' ? EE_INF : $tkt[ 'TKT_uses' ],
1039
-				'TKT_min' 			=> empty( $tkt['TKT_min'] ) ? 0 : $tkt['TKT_min'],
1040
-				'TKT_max' 			=> empty( $tkt['TKT_max'] ) ? EE_INF : $tkt['TKT_max'],
1037
+				'TKT_qty' 			=> ! isset($tkt['TKT_qty']) || $tkt['TKT_qty'] === '' ? EE_INF : $tkt['TKT_qty'],
1038
+				'TKT_uses' 			=> ! isset($tkt['TKT_uses']) || $tkt['TKT_uses'] === '' ? EE_INF : $tkt['TKT_uses'],
1039
+				'TKT_min' 			=> empty($tkt['TKT_min']) ? 0 : $tkt['TKT_min'],
1040
+				'TKT_max' 			=> empty($tkt['TKT_max']) ? EE_INF : $tkt['TKT_max'],
1041 1041
 				'TKT_row' 			=> $row,
1042
-				'TKT_order' 		=> isset( $tkt['TKT_order'] ) ? $tkt['TKT_order'] : $row,
1042
+				'TKT_order' 		=> isset($tkt['TKT_order']) ? $tkt['TKT_order'] : $row,
1043 1043
 				'TKT_price' 		=> $ticket_price
1044 1044
 			);
1045 1045
 
@@ -1047,7 +1047,7 @@  discard block
 block discarded – undo
1047 1047
 
1048 1048
 
1049 1049
 			//if this is a default TKT, then we need to set the TKT_ID to 0 and update accordingly, which means in turn that the prices will become new prices as well.
1050
-			if ( isset( $tkt['TKT_is_default'] ) && $tkt['TKT_is_default'] ) {
1050
+			if (isset($tkt['TKT_is_default']) && $tkt['TKT_is_default']) {
1051 1051
 				$TKT_values['TKT_ID'] = 0;
1052 1052
 				$TKT_values['TKT_is_default'] = 0;
1053 1053
 				$TKT_values['TKT_price'] = $ticket_price;
@@ -1058,58 +1058,58 @@  discard block
 block discarded – undo
1058 1058
 			//we actually do our saves a head of doing any add_relations to because its entirely possible that this ticket didn't removed or added to any datetime in the session but DID have it's items modified.
1059 1059
 			//keep in mind that if the TKT has been sold (and we have changed pricing information), then we won't be updating the tkt but instead a new tkt will be created and the old one archived.
1060 1060
 
1061
-			if ( !empty( $tkt['TKT_ID'] ) ) {
1062
-				$TKT = EE_Registry::instance()->load_model( 'Ticket', array( $evtobj->get_timezone() ) )->get_one_by_ID( $tkt['TKT_ID'] );
1063
-				if ( $TKT instanceof EE_Ticket ) {
1064
-					$ticket_sold = $TKT->count_related( 'Registration', array( array( 'STS_ID' => array( 'NOT IN', array( EEM_Registration::status_id_incomplete ) ) ) ) ) > 0 ? true : false;
1061
+			if ( ! empty($tkt['TKT_ID'])) {
1062
+				$TKT = EE_Registry::instance()->load_model('Ticket', array($evtobj->get_timezone()))->get_one_by_ID($tkt['TKT_ID']);
1063
+				if ($TKT instanceof EE_Ticket) {
1064
+					$ticket_sold = $TKT->count_related('Registration', array(array('STS_ID' => array('NOT IN', array(EEM_Registration::status_id_incomplete))))) > 0 ? true : false;
1065 1065
 					//let's just check the total price for the existing ticket and determine if it matches the new total price.  if they are different then we create a new ticket (if tkts sold) if they aren't different then we go ahead and modify existing ticket.
1066
-					$create_new_TKT = $ticket_sold && $ticket_price != $TKT->get( 'TKT_price' ) && ! $TKT->get( 'TKT_deleted' ) ? true : false;
1067
-					$TKT->set_date_format( $incoming_date_formats[ 0 ] );
1068
-					$TKT->set_time_format( $incoming_date_formats[ 1 ] );
1066
+					$create_new_TKT = $ticket_sold && $ticket_price != $TKT->get('TKT_price') && ! $TKT->get('TKT_deleted') ? true : false;
1067
+					$TKT->set_date_format($incoming_date_formats[0]);
1068
+					$TKT->set_time_format($incoming_date_formats[1]);
1069 1069
 					//set new values
1070
-					foreach ( $TKT_values as $field => $value ) {
1071
-						if ( $field == 'TKT_qty' ) {
1072
-							$TKT->set_qty( $value );
1070
+					foreach ($TKT_values as $field => $value) {
1071
+						if ($field == 'TKT_qty') {
1072
+							$TKT->set_qty($value);
1073 1073
 						} else {
1074
-							$TKT->set( $field, $value );
1074
+							$TKT->set($field, $value);
1075 1075
 						}
1076 1076
 					}
1077 1077
 					//if $create_new_TKT is false then we can safely update the existing ticket.  Otherwise we have to create a new ticket.
1078
-					if ( $create_new_TKT ) {
1078
+					if ($create_new_TKT) {
1079 1079
 						//archive the old ticket first
1080
-						$TKT->set( 'TKT_deleted', 1 );
1080
+						$TKT->set('TKT_deleted', 1);
1081 1081
 						$TKT->save();
1082 1082
 						//make sure this ticket is still recorded in our saved_tkts so we don't run it through the regular trash routine.
1083
-						$saved_tickets[ $TKT->ID() ] = $TKT;
1083
+						$saved_tickets[$TKT->ID()] = $TKT;
1084 1084
 						//create new ticket that's a copy of the existing except a new id of course (and not archived) AND has the new TKT_price associated with it.
1085 1085
 						$TKT = clone $TKT;
1086
-						$TKT->set( 'TKT_ID', 0 );
1087
-						$TKT->set( 'TKT_deleted', 0 );
1088
-						$TKT->set( 'TKT_price', $ticket_price );
1089
-						$TKT->set( 'TKT_sold', 0 );
1086
+						$TKT->set('TKT_ID', 0);
1087
+						$TKT->set('TKT_deleted', 0);
1088
+						$TKT->set('TKT_price', $ticket_price);
1089
+						$TKT->set('TKT_sold', 0);
1090 1090
 						//now we need to make sure that $new prices are created as well and attached to new ticket.
1091 1091
 						$update_prices = true;
1092 1092
 					}
1093 1093
 					//make sure price is set if it hasn't been already
1094
-					$TKT->set( 'TKT_price', $ticket_price );
1094
+					$TKT->set('TKT_price', $ticket_price);
1095 1095
 				}
1096 1096
 
1097 1097
 			} else {
1098 1098
 				//no TKT_id so a new TKT
1099 1099
 				$TKT_values['TKT_price'] = $ticket_price;
1100
-				$TKT = EE_Registry::instance()->load_class('Ticket', array( $TKT_values ), FALSE, FALSE );
1101
-				if ( $TKT instanceof EE_Ticket ) {
1100
+				$TKT = EE_Registry::instance()->load_class('Ticket', array($TKT_values), FALSE, FALSE);
1101
+				if ($TKT instanceof EE_Ticket) {
1102 1102
 					//need to reset values to properly account for the date formats
1103
-					$TKT->set_date_format( $incoming_date_formats[0] );
1104
-					$TKT->set_time_format( $incoming_date_formats[1] );
1105
-					$TKT->set_timezone( $evtobj->get_timezone() );
1103
+					$TKT->set_date_format($incoming_date_formats[0]);
1104
+					$TKT->set_time_format($incoming_date_formats[1]);
1105
+					$TKT->set_timezone($evtobj->get_timezone());
1106 1106
 
1107 1107
 					//set new values
1108
-					foreach ( $TKT_values as $field => $value ) {
1109
-						if ( $field == 'TKT_qty' ) {
1110
-							$TKT->set_qty( $value );
1108
+					foreach ($TKT_values as $field => $value) {
1109
+						if ($field == 'TKT_qty') {
1110
+							$TKT->set_qty($value);
1111 1111
 						} else {
1112
-							$TKT->set( $field, $value );
1112
+							$TKT->set($field, $value);
1113 1113
 						}
1114 1114
 					}
1115 1115
 
@@ -1117,31 +1117,31 @@  discard block
 block discarded – undo
1117 1117
 				}
1118 1118
 			}
1119 1119
 			// cap ticket qty by datetime reg limits
1120
-			$TKT->set_qty( min( $TKT->qty(), $TKT->qty( 'reg_limit' ) ) );
1120
+			$TKT->set_qty(min($TKT->qty(), $TKT->qty('reg_limit')));
1121 1121
 			//update ticket.
1122 1122
 			$TKT->save();
1123 1123
 
1124 1124
 			//before going any further make sure our dates are setup correctly so that the end date is always equal or greater than the start date.
1125
-			if( $TKT->get_raw('TKT_start_date') > $TKT->get_raw('TKT_end_date') ) {
1126
-				$TKT->set('TKT_end_date', $TKT->get('TKT_start_date') );
1125
+			if ($TKT->get_raw('TKT_start_date') > $TKT->get_raw('TKT_end_date')) {
1126
+				$TKT->set('TKT_end_date', $TKT->get('TKT_start_date'));
1127 1127
 				$TKT = EEH_DTT_Helper::date_time_add($TKT, 'TKT_end_date', 'days');
1128 1128
 				$TKT->save();
1129 1129
 			}
1130 1130
 
1131 1131
 			//initially let's add the ticket to the dtt
1132
-			$saved_dtt->_add_relation_to( $TKT, 'Ticket' );
1132
+			$saved_dtt->_add_relation_to($TKT, 'Ticket');
1133 1133
 
1134 1134
 			$saved_tickets[$TKT->ID()] = $TKT;
1135 1135
 
1136 1136
 			//add prices to ticket
1137
-			$this->_add_prices_to_ticket( $data['edit_prices'][$row], $TKT, $update_prices );
1137
+			$this->_add_prices_to_ticket($data['edit_prices'][$row], $TKT, $update_prices);
1138 1138
 		}
1139 1139
 		//however now we need to handle permanently deleting tickets via the ui.  Keep in mind that the ui does not allow deleting/archiving tickets that have ticket sold.  However, it does allow for deleting tickets that have no tickets sold, in which case we want to get rid of permanently because there is no need to save in db.
1140
-		$old_tickets = isset( $old_tickets[0] ) && $old_tickets[0] == '' ? array() : $old_tickets;
1141
-		$tickets_removed = array_diff( $old_tickets, array_keys( $saved_tickets ) );
1140
+		$old_tickets = isset($old_tickets[0]) && $old_tickets[0] == '' ? array() : $old_tickets;
1141
+		$tickets_removed = array_diff($old_tickets, array_keys($saved_tickets));
1142 1142
 
1143
-		foreach ( $tickets_removed as $id ) {
1144
-			$id = absint( $id );
1143
+		foreach ($tickets_removed as $id) {
1144
+			$id = absint($id);
1145 1145
 
1146 1146
 			//get the ticket for this id
1147 1147
 			$tkt_to_remove = EE_Registry::instance()->load_model('Ticket')->get_one_by_ID($id);
@@ -1149,7 +1149,7 @@  discard block
 block discarded – undo
1149 1149
 			//need to get all the related datetimes on this ticket and remove from every single one of them (remember this process can ONLY kick off if there are NO tkts_sold)
1150 1150
 			$dtts = $tkt_to_remove->get_many_related('Datetime');
1151 1151
 
1152
-			foreach( $dtts as $dtt ) {
1152
+			foreach ($dtts as $dtt) {
1153 1153
 				$tkt_to_remove->_remove_relation_to($dtt, 'Datetime');
1154 1154
 			}
1155 1155
 
@@ -1160,7 +1160,7 @@  discard block
 block discarded – undo
1160 1160
 			//finally let's delete this ticket (which should not be blocked at this point b/c we've removed all our relationships)
1161 1161
 			$tkt_to_remove->delete_permanently();
1162 1162
 		}
1163
-		return array( $saved_dtt, $saved_tickets );
1163
+		return array($saved_dtt, $saved_tickets);
1164 1164
 	}
1165 1165
 
1166 1166
 
@@ -1175,31 +1175,31 @@  discard block
 block discarded – undo
1175 1175
 	 * @param bool 		$new_prices Whether attach existing incoming prices or create new ones.
1176 1176
 	 * @return  void
1177 1177
 	 */
1178
-	private function  _add_prices_to_ticket( $prices, EE_Ticket $ticket, $new_prices = FALSE ) {
1179
-		foreach ( $prices as $row => $prc ) {
1178
+	private function  _add_prices_to_ticket($prices, EE_Ticket $ticket, $new_prices = FALSE) {
1179
+		foreach ($prices as $row => $prc) {
1180 1180
 			$PRC_values = array(
1181
-				'PRC_ID' => !empty( $prc['PRC_ID'] ) ? $prc['PRC_ID'] : NULL,
1182
-				'PRT_ID' => !empty( $prc['PRT_ID'] ) ? $prc['PRT_ID'] : NULL,
1183
-				'PRC_amount' => !empty( $prc['PRC_amount'] ) ? $prc['PRC_amount'] : 0,
1184
-				'PRC_name' => !empty( $prc['PRC_name'] ) ? $prc['PRC_name'] : '',
1185
-				'PRC_desc' => !empty( $prc['PRC_desc'] ) ? $prc['PRC_desc'] : '',
1181
+				'PRC_ID' => ! empty($prc['PRC_ID']) ? $prc['PRC_ID'] : NULL,
1182
+				'PRT_ID' => ! empty($prc['PRT_ID']) ? $prc['PRT_ID'] : NULL,
1183
+				'PRC_amount' => ! empty($prc['PRC_amount']) ? $prc['PRC_amount'] : 0,
1184
+				'PRC_name' => ! empty($prc['PRC_name']) ? $prc['PRC_name'] : '',
1185
+				'PRC_desc' => ! empty($prc['PRC_desc']) ? $prc['PRC_desc'] : '',
1186 1186
 				'PRC_is_default' => 0, //make sure prices are NOT set as default from this context
1187 1187
 				'PRC_order' => $row
1188 1188
 			);
1189 1189
 
1190
-			if ( $new_prices || empty( $PRC_values['PRC_ID'] ) ) {
1190
+			if ($new_prices || empty($PRC_values['PRC_ID'])) {
1191 1191
 				$PRC_values['PRC_ID'] = 0;
1192
-				$PRC = EE_Registry::instance()->load_class('Price', array( $PRC_values ), FALSE, FALSE);
1192
+				$PRC = EE_Registry::instance()->load_class('Price', array($PRC_values), FALSE, FALSE);
1193 1193
 			} else {
1194
-				$PRC = EE_Registry::instance()->load_model( 'Price' )->get_one_by_ID( $prc['PRC_ID'] );
1194
+				$PRC = EE_Registry::instance()->load_model('Price')->get_one_by_ID($prc['PRC_ID']);
1195 1195
 				//update this price with new values
1196
-				foreach ( $PRC_values as $field => $newprc ) {
1197
-					$PRC->set( $field, $newprc );
1196
+				foreach ($PRC_values as $field => $newprc) {
1197
+					$PRC->set($field, $newprc);
1198 1198
 				}
1199 1199
 				$PRC->save();
1200 1200
 			}
1201 1201
 
1202
-			$ticket->_add_relation_to( $PRC, 'Price' );
1202
+			$ticket->_add_relation_to($PRC, 'Price');
1203 1203
 		}
1204 1204
 	}
1205 1205
 
@@ -1237,9 +1237,9 @@  discard block
 block discarded – undo
1237 1237
 		//load formatter helper
1238 1238
 
1239 1239
   		//args for getting related registrations
1240
-  		$approved_query_args = array( array( 'REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_approved ) );
1241
-  		$not_approved_query_args = array( array( 'REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_not_approved ) );
1242
-  		$pending_payment_query_args = array( array( 'REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_pending_payment ) );
1240
+  		$approved_query_args = array(array('REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_approved));
1241
+  		$not_approved_query_args = array(array('REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_not_approved));
1242
+  		$pending_payment_query_args = array(array('REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_pending_payment));
1243 1243
 
1244 1244
 
1245 1245
 		// publish box
@@ -1268,9 +1268,9 @@  discard block
 block discarded – undo
1268 1268
 				),
1269 1269
 				REG_ADMIN_URL
1270 1270
 			),
1271
-			'approved_regs' => $this->_cpt_model_obj->count_related( 'Registration', $approved_query_args ),
1272
-			'not_approved_regs' => $this->_cpt_model_obj->count_related( 'Registration', $not_approved_query_args ),
1273
-			'pending_payment_regs' => $this->_cpt_model_obj->count_related( 'Registration', $pending_payment_query_args ),
1271
+			'approved_regs' => $this->_cpt_model_obj->count_related('Registration', $approved_query_args),
1272
+			'not_approved_regs' => $this->_cpt_model_obj->count_related('Registration', $not_approved_query_args),
1273
+			'pending_payment_regs' => $this->_cpt_model_obj->count_related('Registration', $pending_payment_query_args),
1274 1274
 			'misc_pub_section_class' => apply_filters(
1275 1275
 				'FHEE_Events_Admin_Page___generate_publish_box_extra_content__misc_pub_section_class',
1276 1276
 				'misc-pub-section'
@@ -1289,9 +1289,9 @@  discard block
 block discarded – undo
1289 1289
 			'AHEE__Events_Admin_Page___generate_publish_box_extra_content__event_editor_overview_add',
1290 1290
 			$this->_cpt_model_obj
1291 1291
 		);
1292
-		$publish_box_extra_args[ 'event_editor_overview_add' ] = ob_get_clean();
1292
+		$publish_box_extra_args['event_editor_overview_add'] = ob_get_clean();
1293 1293
 		// load template
1294
-		EEH_Template::display_template( EVENTS_TEMPLATE_PATH . 'event_publish_box_extras.template.php', $publish_box_extra_args );
1294
+		EEH_Template::display_template(EVENTS_TEMPLATE_PATH.'event_publish_box_extras.template.php', $publish_box_extra_args);
1295 1295
 	}
1296 1296
 
1297 1297
 
@@ -1323,16 +1323,16 @@  discard block
 block discarded – undo
1323 1323
 		$this->verify_cpt_object();
1324 1324
 		add_meta_box(
1325 1325
 			'espresso_event_editor_tickets',
1326
-			esc_html__( 'Event Datetime & Ticket', 'event_espresso' ),
1327
-			array( $this, 'ticket_metabox' ),
1326
+			esc_html__('Event Datetime & Ticket', 'event_espresso'),
1327
+			array($this, 'ticket_metabox'),
1328 1328
 			$this->page_slug,
1329 1329
 			'normal',
1330 1330
 			'high'
1331 1331
 		);
1332 1332
 		add_meta_box(
1333 1333
 			'espresso_event_editor_event_options',
1334
-			esc_html__( 'Event Registration Options', 'event_espresso' ),
1335
-			array( $this, 'registration_options_meta_box' ),
1334
+			esc_html__('Event Registration Options', 'event_espresso'),
1335
+			array($this, 'registration_options_meta_box'),
1336 1336
 			$this->page_slug,
1337 1337
 			'side',
1338 1338
 			'default'
@@ -1362,36 +1362,36 @@  discard block
 block discarded – undo
1362 1362
 			'disabled' => ''
1363 1363
 			);
1364 1364
 
1365
-		$event_id = is_object( $this->_cpt_model_obj ) ? $this->_cpt_model_obj->ID() : NULL;
1365
+		$event_id = is_object($this->_cpt_model_obj) ? $this->_cpt_model_obj->ID() : NULL;
1366 1366
 
1367
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
1367
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1368 1368
 
1369 1369
 		/**
1370 1370
 		 * 1. Start with retrieving Datetimes
1371 1371
 		 * 2. Fore each datetime get related tickets
1372 1372
 		 * 3. For each ticket get related prices
1373 1373
 		 */
1374
-		$times = EE_Registry::instance()->load_model('Datetime' )->get_all_event_dates( $event_id );
1374
+		$times = EE_Registry::instance()->load_model('Datetime')->get_all_event_dates($event_id);
1375 1375
 		/** @type EE_Datetime $first_datetime */
1376
-		$first_datetime = reset( $times );
1376
+		$first_datetime = reset($times);
1377 1377
 		//do we get related tickets?
1378
-		if ( $first_datetime instanceof EE_Datetime
1379
-			&& $first_datetime->ID() !== 0 ) {
1378
+		if ($first_datetime instanceof EE_Datetime
1379
+			&& $first_datetime->ID() !== 0) {
1380 1380
 			$existing_datetime_ids[] = $first_datetime->get('DTT_ID');
1381 1381
 			$template_args['time'] = $first_datetime;
1382 1382
 			$related_tickets = $first_datetime->tickets(
1383 1383
 				array(
1384
-					array( 'OR' => array( 'TKT_deleted' => 1, 'TKT_deleted*' => 0 ) ),
1384
+					array('OR' => array('TKT_deleted' => 1, 'TKT_deleted*' => 0)),
1385 1385
 					'default_where_conditions' => 'none'
1386 1386
 				)
1387 1387
 			);
1388 1388
 
1389
-			if ( !empty($related_tickets) ) {
1389
+			if ( ! empty($related_tickets)) {
1390 1390
 				$template_args['total_ticket_rows'] = count($related_tickets);
1391 1391
 				$row = 0;
1392
-				foreach ( $related_tickets as $ticket ) {
1392
+				foreach ($related_tickets as $ticket) {
1393 1393
 					$existing_ticket_ids[] = $ticket->get('TKT_ID');
1394
-					$template_args['ticket_rows'] .= $this->_get_ticket_row($ticket, FALSE, $row );
1394
+					$template_args['ticket_rows'] .= $this->_get_ticket_row($ticket, FALSE, $row);
1395 1395
 
1396 1396
 					$row++;
1397 1397
 				}
@@ -1399,13 +1399,13 @@  discard block
 block discarded – undo
1399 1399
 				$template_args['total_ticket_rows'] = 1;
1400 1400
 				/** @type EE_Ticket $ticket */
1401 1401
 				$ticket = EE_Registry::instance()->load_model('Ticket')->create_default_object();
1402
-				$template_args['ticket_rows'] .= $this->_get_ticket_row( $ticket );
1402
+				$template_args['ticket_rows'] .= $this->_get_ticket_row($ticket);
1403 1403
 			}
1404 1404
 		} else {
1405 1405
 			$template_args['time'] = $times[0];
1406 1406
 			/** @type EE_Ticket $ticket */
1407 1407
 			$ticket = EE_Registry::instance()->load_model('Ticket')->get_all_default_tickets();
1408
-			$template_args['ticket_rows'] .= $this->_get_ticket_row( $ticket[1] );
1408
+			$template_args['ticket_rows'] .= $this->_get_ticket_row($ticket[1]);
1409 1409
 			// NOTE: we're just sending the first default row
1410 1410
 			// (decaf can't manage default tickets so this should be sufficient);
1411 1411
 		}
@@ -1414,8 +1414,8 @@  discard block
 block discarded – undo
1414 1414
 		$template_args['ticket_options_help_link'] = $this->_get_help_tab_link('ticket_options_info');
1415 1415
 		$template_args['existing_datetime_ids'] = implode(',', $existing_datetime_ids);
1416 1416
 		$template_args['existing_ticket_ids'] = implode(',', $existing_ticket_ids);
1417
-		$template_args['ticket_js_structure'] = $this->_get_ticket_row( EE_Registry::instance()->load_model('Ticket')->create_default_object(), TRUE );
1418
-		$template = apply_filters( 'FHEE__Events_Admin_Page__ticket_metabox__template', EVENTS_TEMPLATE_PATH . 'event_tickets_metabox_main.template.php' );
1417
+		$template_args['ticket_js_structure'] = $this->_get_ticket_row(EE_Registry::instance()->load_model('Ticket')->create_default_object(), TRUE);
1418
+		$template = apply_filters('FHEE__Events_Admin_Page__ticket_metabox__template', EVENTS_TEMPLATE_PATH.'event_tickets_metabox_main.template.php');
1419 1419
 		EEH_Template::display_template($template, $template_args);
1420 1420
 	}
1421 1421
 
@@ -1430,21 +1430,21 @@  discard block
 block discarded – undo
1430 1430
 	 * @param int        $row
1431 1431
 	 * @return string generated html for the ticket row.
1432 1432
 	 */
1433
-	private function _get_ticket_row( $ticket, $skeleton = FALSE, $row = 0 ) {
1433
+	private function _get_ticket_row($ticket, $skeleton = FALSE, $row = 0) {
1434 1434
 		$template_args = array(
1435
-			'tkt_status_class' => ' tkt-status-' . $ticket->ticket_status(),
1436
-			'tkt_archive_class' => $ticket->ticket_status() === EE_Ticket::archived && !$skeleton ? ' tkt-archived' : '',
1435
+			'tkt_status_class' => ' tkt-status-'.$ticket->ticket_status(),
1436
+			'tkt_archive_class' => $ticket->ticket_status() === EE_Ticket::archived && ! $skeleton ? ' tkt-archived' : '',
1437 1437
 			'ticketrow' => $skeleton ? 'TICKETNUM' : $row,
1438 1438
 			'TKT_ID' => $ticket->get('TKT_ID'),
1439 1439
 			'TKT_name' => $ticket->get('TKT_name'),
1440 1440
 			'TKT_start_date' => $skeleton ? '' : $ticket->get_date('TKT_start_date', 'Y-m-d h:i a'),
1441 1441
 			'TKT_end_date' => $skeleton ? '' : $ticket->get_date('TKT_end_date', 'Y-m-d h:i a'),
1442 1442
 			'TKT_is_default' => $ticket->get('TKT_is_default'),
1443
-			'TKT_qty' => $ticket->get_pretty('TKT_qty','input'),
1443
+			'TKT_qty' => $ticket->get_pretty('TKT_qty', 'input'),
1444 1444
 			'edit_ticketrow_name' => $skeleton ? 'TICKETNAMEATTR' : 'edit_tickets',
1445 1445
 			'TKT_sold' => $skeleton ? 0 : $ticket->get('TKT_sold'),
1446
-			'trash_icon' => ( $skeleton || ( !empty( $ticket ) && ! $ticket->get('TKT_deleted') ) ) && ( !empty( $ticket ) && $ticket->get('TKT_sold') === 0 ) ? 'trash-icon dashicons dashicons-post-trash clickable' : 'ee-lock-icon',
1447
-			'disabled' => $skeleton || ( !empty( $ticket ) && ! $ticket->get('TKT_deleted' ) ) ? '' : ' disabled=disabled'
1446
+			'trash_icon' => ($skeleton || ( ! empty($ticket) && ! $ticket->get('TKT_deleted'))) && ( ! empty($ticket) && $ticket->get('TKT_sold') === 0) ? 'trash-icon dashicons dashicons-post-trash clickable' : 'ee-lock-icon',
1447
+			'disabled' => $skeleton || ( ! empty($ticket) && ! $ticket->get('TKT_deleted')) ? '' : ' disabled=disabled'
1448 1448
 			);
1449 1449
 
1450 1450
 		$price = $ticket->ID() !== 0 ? $ticket->get_first_related('Price', array('default_where_conditions' => 'none')) : EE_Registry::instance()->load_model('Price')->create_default_object();
@@ -1460,23 +1460,23 @@  discard block
 block discarded – undo
1460 1460
 
1461 1461
 		//make sure we have default start and end dates if skeleton
1462 1462
 		//handle rows that should NOT be empty
1463
-		if ( empty( $template_args['TKT_start_date'] ) ) {
1463
+		if (empty($template_args['TKT_start_date'])) {
1464 1464
 			//if empty then the start date will be now.
1465 1465
 			$template_args['TKT_start_date'] = date('Y-m-d h:i a', current_time('timestamp'));
1466 1466
 		}
1467 1467
 
1468
-		if ( empty( $template_args['TKT_end_date'] ) ) {
1468
+		if (empty($template_args['TKT_end_date'])) {
1469 1469
 			//get the earliest datetime (if present);
1470
-			$earliest_dtt = $this->_cpt_model_obj->ID() > 0 ? $this->_cpt_model_obj->get_first_related('Datetime', array('order_by'=> array('DTT_EVT_start' => 'ASC' ) ) ) : NULL;
1470
+			$earliest_dtt = $this->_cpt_model_obj->ID() > 0 ? $this->_cpt_model_obj->get_first_related('Datetime', array('order_by'=> array('DTT_EVT_start' => 'ASC'))) : NULL;
1471 1471
 
1472
-			if ( !empty( $earliest_dtt ) )
1472
+			if ( ! empty($earliest_dtt))
1473 1473
 				$template_args['TKT_end_date'] = $earliest_dtt->get_datetime('DTT_EVT_start', 'Y-m-d', 'h:i a');
1474 1474
 			else
1475
-				$template_args['TKT_end_date'] = date('Y-m-d h:i a', mktime(0, 0, 0, date("m"), date("d")+7, date("Y") ) );
1475
+				$template_args['TKT_end_date'] = date('Y-m-d h:i a', mktime(0, 0, 0, date("m"), date("d") + 7, date("Y")));
1476 1476
 		}
1477 1477
 
1478
-		$template_args = array_merge( $template_args, $price_args );
1479
-		$template = apply_filters( 'FHEE__Events_Admin_Page__get_ticket_row__template', EVENTS_TEMPLATE_PATH . 'event_tickets_metabox_ticket_row.template.php', $ticket);
1478
+		$template_args = array_merge($template_args, $price_args);
1479
+		$template = apply_filters('FHEE__Events_Admin_Page__get_ticket_row__template', EVENTS_TEMPLATE_PATH.'event_tickets_metabox_ticket_row.template.php', $ticket);
1480 1480
 		return EEH_Template::display_template($template, $template_args, TRUE);
1481 1481
 	}
1482 1482
 
@@ -1505,8 +1505,8 @@  discard block
 block discarded – undo
1505 1505
 		$template_args['default_registration_status'] = EEH_Form_Fields::select_input('default_reg_status', $default_reg_status_values, $this->_cpt_model_obj->default_registration_status());
1506 1506
 		$template_args['display_description'] = EEH_Form_Fields::select_input('display_desc', $yes_no_values, $this->_cpt_model_obj->display_description());
1507 1507
 		$template_args['display_ticket_selector'] = EEH_Form_Fields::select_input('display_ticket_selector', $yes_no_values, $this->_cpt_model_obj->display_ticket_selector(), '', '', false);
1508
-		$template_args['additional_registration_options'] = apply_filters( 'FHEE__Events_Admin_Page__registration_options_meta_box__additional_registration_options', '', $template_args, $yes_no_values, $default_reg_status_values );
1509
-		$templatepath = EVENTS_TEMPLATE_PATH . 'event_registration_options.template.php';
1508
+		$template_args['additional_registration_options'] = apply_filters('FHEE__Events_Admin_Page__registration_options_meta_box__additional_registration_options', '', $template_args, $yes_no_values, $default_reg_status_values);
1509
+		$templatepath = EVENTS_TEMPLATE_PATH.'event_registration_options.template.php';
1510 1510
 		EEH_Template::display_template($templatepath, $template_args);
1511 1511
 	}
1512 1512
 
@@ -1534,21 +1534,21 @@  discard block
 block discarded – undo
1534 1534
 		$EEME = $this->_event_model();
1535 1535
 
1536 1536
 		$offset = ($current_page - 1) * $per_page;
1537
-		$limit = $count ? NULL : $offset . ',' . $per_page;
1537
+		$limit = $count ? NULL : $offset.','.$per_page;
1538 1538
 		$orderby = isset($this->_req_data['orderby']) ? $this->_req_data['orderby'] : 'EVT_ID';
1539 1539
 		$order = isset($this->_req_data['order']) ? $this->_req_data['order'] : "DESC";
1540 1540
 
1541 1541
 		if (isset($this->_req_data['month_range'])) {
1542 1542
 			$pieces = explode(' ', $this->_req_data['month_range'], 3);
1543
-			$month_r = !empty($pieces[0]) ? date('m', strtotime($pieces[0])) : '';
1544
-			$year_r = !empty($pieces[1]) ? $pieces[1] : '';
1543
+			$month_r = ! empty($pieces[0]) ? date('m', strtotime($pieces[0])) : '';
1544
+			$year_r = ! empty($pieces[1]) ? $pieces[1] : '';
1545 1545
 		}
1546 1546
 
1547 1547
 		$where = array();
1548 1548
 
1549
-		$status = isset( $this->_req_data['status'] ) ? $this->_req_data['status'] : NULL;
1549
+		$status = isset($this->_req_data['status']) ? $this->_req_data['status'] : NULL;
1550 1550
 		//determine what post_status our condition will have for the query.
1551
-		switch ( $status ) {
1551
+		switch ($status) {
1552 1552
 			case 'month' :
1553 1553
 			case 'today' :
1554 1554
 			case NULL :
@@ -1556,7 +1556,7 @@  discard block
 block discarded – undo
1556 1556
 				break;
1557 1557
 
1558 1558
 			case 'draft' :
1559
-				$where['status'] = array( 'IN', array('draft', 'auto-draft') );
1559
+				$where['status'] = array('IN', array('draft', 'auto-draft'));
1560 1560
 				break;
1561 1561
 
1562 1562
 			default :
@@ -1564,43 +1564,43 @@  discard block
 block discarded – undo
1564 1564
 		}
1565 1565
 
1566 1566
 		//categories?
1567
-		$category = isset( $this->_req_data['EVT_CAT'] ) && $this->_req_data['EVT_CAT'] > 0 ? $this->_req_data['EVT_CAT'] : NULL;
1567
+		$category = isset($this->_req_data['EVT_CAT']) && $this->_req_data['EVT_CAT'] > 0 ? $this->_req_data['EVT_CAT'] : NULL;
1568 1568
 
1569
-		if ( !empty ( $category ) ) {
1569
+		if ( ! empty ($category)) {
1570 1570
 			$where['Term_Taxonomy.taxonomy'] = 'espresso_event_categories';
1571 1571
 			$where['Term_Taxonomy.term_id'] = $category;
1572 1572
 		}
1573 1573
 
1574 1574
 		//date where conditions
1575
-		$start_formats = EEM_Datetime::instance()->get_formats_for( 'DTT_EVT_start' );
1575
+		$start_formats = EEM_Datetime::instance()->get_formats_for('DTT_EVT_start');
1576 1576
 		if (isset($this->_req_data['month_range']) && $this->_req_data['month_range'] != '') {
1577
-			$DateTime = new DateTime( $year_r . '-' . $month_r . '-01 00:00:00', new DateTimeZone( EEM_Datetime::instance()->get_timezone() ) );
1578
-			$start = $DateTime->format( implode( ' ', $start_formats  ) );
1579
-			$end = $DateTime->setDate( $year_r, $month_r, $DateTime->format('t') )->setTime(23,59,59)->format( implode( ' ', $start_formats ) );
1580
-			$where['Datetime.DTT_EVT_start'] = array('BETWEEN', array( $start, $end ) );
1577
+			$DateTime = new DateTime($year_r.'-'.$month_r.'-01 00:00:00', new DateTimeZone(EEM_Datetime::instance()->get_timezone()));
1578
+			$start = $DateTime->format(implode(' ', $start_formats));
1579
+			$end = $DateTime->setDate($year_r, $month_r, $DateTime->format('t'))->setTime(23, 59, 59)->format(implode(' ', $start_formats));
1580
+			$where['Datetime.DTT_EVT_start'] = array('BETWEEN', array($start, $end));
1581 1581
 		} else if (isset($this->_req_data['status']) && $this->_req_data['status'] == 'today') {
1582
-			$DateTime = new DateTime( 'now', new DateTimeZone( EEM_Event::instance()->get_timezone() ) );
1583
-			$start = $DateTime->setTime( 0,0,0 )->format( implode( ' ', $start_formats ) );
1584
-			$end = $DateTime->setTime( 23, 59, 59 )->format( implode( ' ', $start_formats ) );
1585
-			$where['Datetime.DTT_EVT_start'] = array( 'BETWEEN', array( $start, $end ) );
1586
-		} else if ( isset($this->_req_data['status']) && $this->_req_data['status'] == 'month' ) {
1587
-			$now = date( 'Y-m-01' );
1588
-			$DateTime = new DateTime( $now, new DateTimeZone( EEM_Event::instance()->get_timezone() ) );
1589
-			$start = $DateTime->setTime( 0, 0, 0 )->format( implode( ' ', $start_formats ) );
1590
-			$end = $DateTime->setDate( date('Y'), date('m'), $DateTime->format('t' ) )->setTime( 23, 59, 59 )->format( implode( ' ', $start_formats ) );
1591
-			$where['Datetime.DTT_EVT_start'] = array( 'BETWEEN', array( $start, $end ) );
1582
+			$DateTime = new DateTime('now', new DateTimeZone(EEM_Event::instance()->get_timezone()));
1583
+			$start = $DateTime->setTime(0, 0, 0)->format(implode(' ', $start_formats));
1584
+			$end = $DateTime->setTime(23, 59, 59)->format(implode(' ', $start_formats));
1585
+			$where['Datetime.DTT_EVT_start'] = array('BETWEEN', array($start, $end));
1586
+		} else if (isset($this->_req_data['status']) && $this->_req_data['status'] == 'month') {
1587
+			$now = date('Y-m-01');
1588
+			$DateTime = new DateTime($now, new DateTimeZone(EEM_Event::instance()->get_timezone()));
1589
+			$start = $DateTime->setTime(0, 0, 0)->format(implode(' ', $start_formats));
1590
+			$end = $DateTime->setDate(date('Y'), date('m'), $DateTime->format('t'))->setTime(23, 59, 59)->format(implode(' ', $start_formats));
1591
+			$where['Datetime.DTT_EVT_start'] = array('BETWEEN', array($start, $end));
1592 1592
 		}
1593 1593
 
1594 1594
 
1595
-		if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_events', 'get_events' ) ) {
1596
-			$where['EVT_wp_user'] =  get_current_user_id();
1595
+		if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_events', 'get_events')) {
1596
+			$where['EVT_wp_user'] = get_current_user_id();
1597 1597
 		} else {
1598
-			if ( ! isset( $where['status'] ) ) {
1599
-				if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_private_events', 'get_events' ) ) {
1598
+			if ( ! isset($where['status'])) {
1599
+				if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_private_events', 'get_events')) {
1600 1600
 					$where['OR'] = array(
1601
-						'status*restrict_private' => array( '!=', 'private' ),
1601
+						'status*restrict_private' => array('!=', 'private'),
1602 1602
 						'AND' => array(
1603
-							'status*inclusive' => array( '=', 'private' ),
1603
+							'status*inclusive' => array('=', 'private'),
1604 1604
 							'EVT_wp_user' => get_current_user_id()
1605 1605
 						)
1606 1606
 					);
@@ -1608,16 +1608,16 @@  discard block
 block discarded – undo
1608 1608
 			}
1609 1609
 		}
1610 1610
 
1611
-		if ( isset( $this->_req_data['EVT_wp_user'] ) ) {
1612
-			if ( $this->_req_data['EVT_wp_user'] != get_current_user_id() && EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_events', 'get_events' ) ) {
1611
+		if (isset($this->_req_data['EVT_wp_user'])) {
1612
+			if ($this->_req_data['EVT_wp_user'] != get_current_user_id() && EE_Registry::instance()->CAP->current_user_can('ee_read_others_events', 'get_events')) {
1613 1613
 				$where['EVT_wp_user'] = $this->_req_data['EVT_wp_user'];
1614 1614
 			}
1615 1615
 		}
1616 1616
 
1617 1617
 
1618 1618
 		//search query handling
1619
-		if ( isset( $this->_req_data['s'] ) ) {
1620
-			$search_string = '%' . $this->_req_data['s'] . '%';
1619
+		if (isset($this->_req_data['s'])) {
1620
+			$search_string = '%'.$this->_req_data['s'].'%';
1621 1621
 			$where['OR'] = array(
1622 1622
 				'EVT_name' => array('LIKE', $search_string),
1623 1623
 				'EVT_desc' => array('LIKE', $search_string),
@@ -1626,32 +1626,32 @@  discard block
 block discarded – undo
1626 1626
 		}
1627 1627
 
1628 1628
 
1629
-		$where = apply_filters( 'FHEE__Events_Admin_Page__get_events__where', $where, $this->_req_data );
1630
-		$query_params = apply_filters( 'FHEE__Events_Admin_Page__get_events__query_params', array($where, 'limit' => $limit, 'order_by' => $orderby, 'order' => $order, 'group_by' => 'EVT_ID' ), $this->_req_data );
1629
+		$where = apply_filters('FHEE__Events_Admin_Page__get_events__where', $where, $this->_req_data);
1630
+		$query_params = apply_filters('FHEE__Events_Admin_Page__get_events__query_params', array($where, 'limit' => $limit, 'order_by' => $orderby, 'order' => $order, 'group_by' => 'EVT_ID'), $this->_req_data);
1631 1631
 
1632 1632
 
1633 1633
 		//let's first check if we have special requests coming in.
1634
-		if ( isset( $this->_req_data['active_status'] ) ) {
1635
-			switch ( $this->_req_data['active_status'] ) {
1634
+		if (isset($this->_req_data['active_status'])) {
1635
+			switch ($this->_req_data['active_status']) {
1636 1636
 				case 'upcoming' :
1637
-					return $EEME->get_upcoming_events( $query_params, $count );
1637
+					return $EEME->get_upcoming_events($query_params, $count);
1638 1638
 					break;
1639 1639
 
1640 1640
 				case 'expired' :
1641
-					return $EEME->get_expired_events( $query_params, $count );
1641
+					return $EEME->get_expired_events($query_params, $count);
1642 1642
 					break;
1643 1643
 
1644 1644
 				case 'active' :
1645
-					return $EEME->get_active_events( $query_params, $count );
1645
+					return $EEME->get_active_events($query_params, $count);
1646 1646
 					break;
1647 1647
 
1648 1648
 				case 'inactive' :
1649
-					return $EEME->get_inactive_events( $query_params, $count );
1649
+					return $EEME->get_inactive_events($query_params, $count);
1650 1650
 					break;
1651 1651
 			}
1652 1652
 		}
1653 1653
 
1654
-		$events = $count ? $EEME->count( array( $where ), 'EVT_ID', true ) : $EEME->get_all( $query_params );
1654
+		$events = $count ? $EEME->count(array($where), 'EVT_ID', true) : $EEME->get_all($query_params);
1655 1655
 
1656 1656
 		return $events;
1657 1657
 	}
@@ -1660,23 +1660,23 @@  discard block
 block discarded – undo
1660 1660
 
1661 1661
 
1662 1662
 	//handling for WordPress CPT actions (trash, restore, delete)
1663
-	public function trash_cpt_item( $post_id ) {
1663
+	public function trash_cpt_item($post_id) {
1664 1664
 		$this->_req_data['EVT_ID'] = $post_id;
1665
-		$this->_trash_or_restore_event( 'trash', FALSE );
1665
+		$this->_trash_or_restore_event('trash', FALSE);
1666 1666
 	}
1667 1667
 
1668 1668
 
1669 1669
 
1670 1670
 
1671
-	public function restore_cpt_item( $post_id ) {
1671
+	public function restore_cpt_item($post_id) {
1672 1672
 		$this->_req_data['EVT_ID'] = $post_id;
1673
-		$this->_trash_or_restore_event( 'draft', FALSE );
1673
+		$this->_trash_or_restore_event('draft', FALSE);
1674 1674
 	}
1675 1675
 
1676 1676
 
1677
-	public function delete_cpt_item( $post_id ) {
1677
+	public function delete_cpt_item($post_id) {
1678 1678
 		$this->_req_data['EVT_ID'] = $post_id;
1679
-		$this->_delete_event( FALSE );
1679
+		$this->_delete_event(FALSE);
1680 1680
 	}
1681 1681
 
1682 1682
 
@@ -1688,7 +1688,7 @@  discard block
 block discarded – undo
1688 1688
 	 * @param  string $event_status
1689 1689
 	 * @return void
1690 1690
 	 */
1691
-	protected function _trash_or_restore_event($event_status = 'trash', $redirect_after = TRUE ) {
1691
+	protected function _trash_or_restore_event($event_status = 'trash', $redirect_after = TRUE) {
1692 1692
 		//determine the event id and set to array.
1693 1693
 		$EVT_ID = isset($this->_req_data['EVT_ID']) ? absint($this->_req_data['EVT_ID']) : FALSE;
1694 1694
 		// loop thru events
@@ -1696,7 +1696,7 @@  discard block
 block discarded – undo
1696 1696
 			// clean status
1697 1697
 			$event_status = sanitize_key($event_status);
1698 1698
 			// grab status
1699
-			if (!empty($event_status)) {
1699
+			if ( ! empty($event_status)) {
1700 1700
 				$success = $this->_change_event_status($EVT_ID, $event_status);
1701 1701
 			} else {
1702 1702
 				$success = FALSE;
@@ -1710,7 +1710,7 @@  discard block
 block discarded – undo
1710 1710
 		}
1711 1711
 		$action = $event_status == 'trash' ? 'moved to the trash' : 'restored from the trash';
1712 1712
 
1713
-		if ( $redirect_after )
1713
+		if ($redirect_after)
1714 1714
 			$this->_redirect_after_action($success, 'Event', $action, array('action' => 'default'));
1715 1715
 	}
1716 1716
 
@@ -1725,7 +1725,7 @@  discard block
 block discarded – undo
1725 1725
 		// clean status
1726 1726
 		$event_status = sanitize_key($event_status);
1727 1727
 		// grab status
1728
-		if (!empty($event_status)) {
1728
+		if ( ! empty($event_status)) {
1729 1729
 			$success = TRUE;
1730 1730
 			//determine the event id and set to array.
1731 1731
 			$EVT_IDs = isset($this->_req_data['EVT_IDs']) ? (array) $this->_req_data['EVT_IDs'] : array();
@@ -1735,7 +1735,7 @@  discard block
 block discarded – undo
1735 1735
 					$results = $this->_change_event_status($EVT_ID, $event_status);
1736 1736
 					$success = $results !== FALSE ? $success : FALSE;
1737 1737
 				} else {
1738
-					$msg = sprintf( esc_html__('An error occurred. Event #%d could not be moved to the trash because a valid event ID was not not supplied.', 'event_espresso'), $EVT_ID);
1738
+					$msg = sprintf(esc_html__('An error occurred. Event #%d could not be moved to the trash because a valid event ID was not not supplied.', 'event_espresso'), $EVT_ID);
1739 1739
 					EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1740 1740
 					$success = FALSE;
1741 1741
 				}
@@ -1760,15 +1760,15 @@  discard block
 block discarded – undo
1760 1760
 	 * @param  string $event_status
1761 1761
 	 * @return bool
1762 1762
 	 */
1763
-	private function _change_event_status( $EVT_ID = 0, $event_status = '') {
1763
+	private function _change_event_status($EVT_ID = 0, $event_status = '') {
1764 1764
 		// grab event id
1765
-		if (!$EVT_ID) {
1765
+		if ( ! $EVT_ID) {
1766 1766
 			$msg = esc_html__('An error occurred. No Event ID or an invalid Event ID was received.', 'event_espresso');
1767 1767
 			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1768 1768
 			return FALSE;
1769 1769
 		}
1770 1770
 
1771
-		$this->_cpt_model_obj = EEM_Event::instance()->get_one_by_ID( $EVT_ID );
1771
+		$this->_cpt_model_obj = EEM_Event::instance()->get_one_by_ID($EVT_ID);
1772 1772
 
1773 1773
 		// clean status
1774 1774
 		$event_status = sanitize_key($event_status);
@@ -1794,11 +1794,11 @@  discard block
 block discarded – undo
1794 1794
 				$hook = FALSE;
1795 1795
 		}
1796 1796
 		//use class to change status
1797
-		$this->_cpt_model_obj->set_status( $event_status );
1797
+		$this->_cpt_model_obj->set_status($event_status);
1798 1798
 		$success = $this->_cpt_model_obj->save();
1799 1799
 
1800 1800
 		if ($success === FALSE) {
1801
-			$msg = sprintf( esc_html__('An error occurred. The event could not be %s.', 'event_espresso'), $action);
1801
+			$msg = sprintf(esc_html__('An error occurred. The event could not be %s.', 'event_espresso'), $action);
1802 1802
 			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1803 1803
 			return FALSE;
1804 1804
 		}
@@ -1816,15 +1816,15 @@  discard block
 block discarded – undo
1816 1816
 	 * @access protected
1817 1817
 	 * @param bool $redirect_after
1818 1818
 	 */
1819
-	protected function _delete_event( $redirect_after = TRUE ) {
1819
+	protected function _delete_event($redirect_after = TRUE) {
1820 1820
 		//determine the event id and set to array.
1821 1821
 		$EVT_ID = isset($this->_req_data['EVT_ID']) ? absint($this->_req_data['EVT_ID']) : NULL;
1822
-		$EVT_ID = isset( $this->_req_data['post'] ) ? absint( $this->_req_data['post'] ) : $EVT_ID;
1822
+		$EVT_ID = isset($this->_req_data['post']) ? absint($this->_req_data['post']) : $EVT_ID;
1823 1823
 
1824 1824
 
1825 1825
 		// loop thru events
1826 1826
 		if ($EVT_ID) {
1827
-			$success = $this->_permanently_delete_event( $EVT_ID );
1827
+			$success = $this->_permanently_delete_event($EVT_ID);
1828 1828
 			// get list of events with no prices
1829 1829
 			$espresso_no_ticket_prices = get_option('ee_no_ticket_prices', array());
1830 1830
 			// remove this event from the list of events with no prices
@@ -1838,7 +1838,7 @@  discard block
 block discarded – undo
1838 1838
 			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1839 1839
 		}
1840 1840
 
1841
-		if ( $redirect_after )
1841
+		if ($redirect_after)
1842 1842
 			$this->_redirect_after_action($success, 'Event', 'deleted', array('action' => 'default', 'status' => 'trash'));
1843 1843
 	}
1844 1844
 
@@ -1856,12 +1856,12 @@  discard block
 block discarded – undo
1856 1856
 		$EVT_IDs = isset($this->_req_data['EVT_IDs']) ? (array) $this->_req_data['EVT_IDs'] : array();
1857 1857
 		// loop thru events
1858 1858
 		foreach ($EVT_IDs as $EVT_ID) {
1859
-			$EVT_ID = absint( $EVT_ID );
1860
-			if ( $EVT_ID ) {
1861
-				$results = $this->_permanently_delete_event( $EVT_ID );
1859
+			$EVT_ID = absint($EVT_ID);
1860
+			if ($EVT_ID) {
1861
+				$results = $this->_permanently_delete_event($EVT_ID);
1862 1862
 				$success = $results !== FALSE ? $success : FALSE;
1863 1863
 				// remove this event from the list of events with no prices
1864
-				unset( $espresso_no_ticket_prices[ $EVT_ID ] );
1864
+				unset($espresso_no_ticket_prices[$EVT_ID]);
1865 1865
 			} else {
1866 1866
 				$success = FALSE;
1867 1867
 				$msg = esc_html__('An error occurred. An event could not be deleted because a valid event ID was not not supplied.', 'event_espresso');
@@ -1881,9 +1881,9 @@  discard block
 block discarded – undo
1881 1881
 	 * @param  int $EVT_ID
1882 1882
 	 * @return bool
1883 1883
 	 */
1884
-	private function _permanently_delete_event( $EVT_ID = 0 ) {
1884
+	private function _permanently_delete_event($EVT_ID = 0) {
1885 1885
 		// grab event id
1886
-		if ( ! $EVT_ID ) {
1886
+		if ( ! $EVT_ID) {
1887 1887
 			$msg = esc_html__('An error occurred. No Event ID or an invalid Event ID was received.', 'event_espresso');
1888 1888
 			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1889 1889
 			return FALSE;
@@ -1892,19 +1892,19 @@  discard block
 block discarded – undo
1892 1892
 			! $this->_cpt_model_obj instanceof EE_Event
1893 1893
 			|| $this->_cpt_model_obj->ID() !== $EVT_ID
1894 1894
 		) {
1895
-			$this->_cpt_model_obj = EEM_Event::instance()->get_one_by_ID( $EVT_ID );
1895
+			$this->_cpt_model_obj = EEM_Event::instance()->get_one_by_ID($EVT_ID);
1896 1896
 		}
1897 1897
 
1898
-		if ( ! $this->_cpt_model_obj instanceof EE_Event ) {
1898
+		if ( ! $this->_cpt_model_obj instanceof EE_Event) {
1899 1899
 			return false;
1900 1900
 		}
1901 1901
 
1902 1902
 		//need to delete related tickets and prices first.
1903 1903
 		$datetimes = $this->_cpt_model_obj->get_many_related('Datetime');
1904
-		foreach ( $datetimes as $datetime ) {
1904
+		foreach ($datetimes as $datetime) {
1905 1905
 			$this->_cpt_model_obj->_remove_relation_to($datetime, 'Datetime');
1906 1906
 			$tickets = $datetime->get_many_related('Ticket');
1907
-			foreach ( $tickets as $ticket ) {
1907
+			foreach ($tickets as $ticket) {
1908 1908
 				$ticket->_remove_relation_to($datetime, 'Datetime');
1909 1909
 				$ticket->delete_related_permanently('Price');
1910 1910
 				$ticket->delete_permanently();
@@ -1914,14 +1914,14 @@  discard block
 block discarded – undo
1914 1914
 
1915 1915
 		//what about related venues or terms?
1916 1916
 		$venues = $this->_cpt_model_obj->get_many_related('Venue');
1917
-		foreach ( $venues as $venue ) {
1917
+		foreach ($venues as $venue) {
1918 1918
 			$this->_cpt_model_obj->_remove_relation_to($venue, 'Venue');
1919 1919
 		}
1920 1920
 
1921 1921
 		//any attached question groups?
1922 1922
 		$question_groups = $this->_cpt_model_obj->get_many_related('Question_Group');
1923
-		if ( !empty( $question_groups ) ) {
1924
-			foreach ( $question_groups as $question_group ) {
1923
+		if ( ! empty($question_groups)) {
1924
+			foreach ($question_groups as $question_group) {
1925 1925
 				$this->_cpt_model_obj->_remove_relation_to($question_group, 'Question_Group');
1926 1926
 			}
1927 1927
 		}
@@ -1930,26 +1930,26 @@  discard block
 block discarded – undo
1930 1930
 
1931 1931
 
1932 1932
 		//Message Template Groups
1933
-		$this->_cpt_model_obj->_remove_relations( 'Message_Template_Group' );
1933
+		$this->_cpt_model_obj->_remove_relations('Message_Template_Group');
1934 1934
 
1935 1935
 		/** @type EE_Term_Taxonomy[] $term_taxonomies */
1936 1936
 		$term_taxonomies = $this->_cpt_model_obj->term_taxonomies();
1937 1937
 
1938
-		foreach ( $term_taxonomies as $term_taxonomy ) {
1938
+		foreach ($term_taxonomies as $term_taxonomy) {
1939 1939
 			$this->_cpt_model_obj->remove_relation_to_term_taxonomy($term_taxonomy);
1940 1940
 		}
1941 1941
 
1942 1942
 		$success = $this->_cpt_model_obj->delete_permanently();
1943 1943
 		// did it all go as planned ?
1944 1944
 		if ($success) {
1945
-			$msg = sprintf( esc_html__('Event ID # %d has been deleted.', 'event_espresso'), $EVT_ID);
1945
+			$msg = sprintf(esc_html__('Event ID # %d has been deleted.', 'event_espresso'), $EVT_ID);
1946 1946
 			EE_Error::add_success($msg);
1947 1947
 		} else {
1948
-			$msg = sprintf( esc_html__('An error occurred. Event ID # %d could not be deleted.', 'event_espresso'), $EVT_ID);
1948
+			$msg = sprintf(esc_html__('An error occurred. Event ID # %d could not be deleted.', 'event_espresso'), $EVT_ID);
1949 1949
 			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1950 1950
 			return FALSE;
1951 1951
 		}
1952
-		do_action( 'AHEE__Events_Admin_Page___permanently_delete_event__after_event_deleted', $EVT_ID );
1952
+		do_action('AHEE__Events_Admin_Page___permanently_delete_event__after_event_deleted', $EVT_ID);
1953 1953
 		return TRUE;
1954 1954
 	}
1955 1955
 
@@ -1966,7 +1966,7 @@  discard block
 block discarded – undo
1966 1966
 	 */
1967 1967
 	public function total_events() {
1968 1968
 
1969
-		$count = EEM_Event::instance()->count( array( 'caps' => 'read_admin' ), 'EVT_ID', true );
1969
+		$count = EEM_Event::instance()->count(array('caps' => 'read_admin'), 'EVT_ID', true);
1970 1970
 		return $count;
1971 1971
 	}
1972 1972
 
@@ -1981,10 +1981,10 @@  discard block
 block discarded – undo
1981 1981
 	 */
1982 1982
 	public function total_events_draft() {
1983 1983
 		$where = array(
1984
-			'status' => array( 'IN', array('draft', 'auto-draft' ) )
1984
+			'status' => array('IN', array('draft', 'auto-draft'))
1985 1985
 			);
1986 1986
 
1987
-		$count = EEM_Event::instance()->count( array( $where, 'caps' => 'read_admin' ), 'EVT_ID', true );
1987
+		$count = EEM_Event::instance()->count(array($where, 'caps' => 'read_admin'), 'EVT_ID', true);
1988 1988
 		return $count;
1989 1989
 	}
1990 1990
 
@@ -2003,7 +2003,7 @@  discard block
 block discarded – undo
2003 2003
 			'status' => 'trash'
2004 2004
 			);
2005 2005
 
2006
-		$count = EEM_Event::instance()->count( array( $where, 'caps' => 'read_admin' ), 'EVT_ID', true );
2006
+		$count = EEM_Event::instance()->count(array($where, 'caps' => 'read_admin'), 'EVT_ID', true);
2007 2007
 		return $count;
2008 2008
 	}
2009 2009
 
@@ -2031,11 +2031,11 @@  discard block
 block discarded – undo
2031 2031
 			// translated
2032 2032
 			TRUE
2033 2033
 		);
2034
-		$this->_template_args['default_reg_status'] = isset( EE_Registry::instance()->CFG->registration->default_STS_ID ) ? sanitize_text_field( EE_Registry::instance()->CFG->registration->default_STS_ID ) : EEM_Registration::status_id_pending_payment;
2034
+		$this->_template_args['default_reg_status'] = isset(EE_Registry::instance()->CFG->registration->default_STS_ID) ? sanitize_text_field(EE_Registry::instance()->CFG->registration->default_STS_ID) : EEM_Registration::status_id_pending_payment;
2035 2035
 
2036 2036
 		$this->_set_add_edit_form_tags('update_default_event_settings');
2037 2037
 		$this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE);
2038
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template(EVENTS_TEMPLATE_PATH . 'event_settings.template.php', $this->_template_args, TRUE);
2038
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template(EVENTS_TEMPLATE_PATH.'event_settings.template.php', $this->_template_args, TRUE);
2039 2039
 		$this->display_admin_page_with_sidebar();
2040 2040
 	}
2041 2041
 
@@ -2061,9 +2061,9 @@  discard block
 block discarded – undo
2061 2061
 
2062 2062
 	protected function _template_settings() {
2063 2063
 		$this->_admin_page_title = esc_html__('Template Settings (Preview)', 'event_espresso');
2064
-		$this->_template_args['preview_img'] = '<img src="' . EVENTS_ASSETS_URL . DS . 'images' . DS . 'caffeinated_template_features.jpg" alt="' . esc_attr__( 'Template Settings Preview screenshot', 'event_espresso' ) . '" />';
2065
-		$this->_template_args['preview_text'] = '<strong>'.esc_html__( 'Template Settings is a feature that is only available in the Caffeinated version of Event Espresso. Template Settings allow you to configure some of the appearance options for both the Event List and Event Details pages.', 'event_espresso' ).'</strong>';
2066
-		$this->display_admin_caf_preview_page( 'template_settings_tab' );
2064
+		$this->_template_args['preview_img'] = '<img src="'.EVENTS_ASSETS_URL.DS.'images'.DS.'caffeinated_template_features.jpg" alt="'.esc_attr__('Template Settings Preview screenshot', 'event_espresso').'" />';
2065
+		$this->_template_args['preview_text'] = '<strong>'.esc_html__('Template Settings is a feature that is only available in the Caffeinated version of Event Espresso. Template Settings allow you to configure some of the appearance options for both the Event List and Event Details pages.', 'event_espresso').'</strong>';
2066
+		$this->display_admin_caf_preview_page('template_settings_tab');
2067 2067
 	}
2068 2068
 
2069 2069
 
@@ -2076,22 +2076,22 @@  discard block
 block discarded – undo
2076 2076
 	 * @return void
2077 2077
 	 */
2078 2078
 	private function _set_category_object() {
2079
-		if ( isset( $this->_category->id ) && !empty( $this->_category->id ) )
2079
+		if (isset($this->_category->id) && ! empty($this->_category->id))
2080 2080
 			return; //already have the category object so get out.
2081 2081
 
2082 2082
 		//set default category object
2083 2083
 		$this->_set_empty_category_object();
2084 2084
 
2085 2085
 		//only set if we've got an id
2086
-		if ( !isset($this->_req_data['EVT_CAT_ID'] ) ) {
2086
+		if ( ! isset($this->_req_data['EVT_CAT_ID'])) {
2087 2087
 			return;
2088 2088
 		}
2089 2089
 
2090 2090
 		$category_id = absint($this->_req_data['EVT_CAT_ID']);
2091 2091
 
2092
-		$term = get_term( $category_id, 'espresso_event_categories' );
2092
+		$term = get_term($category_id, 'espresso_event_categories');
2093 2093
 
2094
-		if ( !empty( $term ) ) {
2094
+		if ( ! empty($term)) {
2095 2095
 			$this->_category->category_name = $term->name;
2096 2096
 			$this->_category->category_identifier = $term->slug;
2097 2097
 			$this->_category->category_desc = $term->description;
@@ -2105,13 +2105,13 @@  discard block
 block discarded – undo
2105 2105
 
2106 2106
 	private function _set_empty_category_object() {
2107 2107
 		$this->_category = new stdClass();
2108
-		$this->_category->category_name = $this->_category->category_identifier = $this->_category->category_desc  = '';
2108
+		$this->_category->category_name = $this->_category->category_identifier = $this->_category->category_desc = '';
2109 2109
 		$this->_category->id = $this->_category->parent = 0;
2110 2110
 	}
2111 2111
 
2112 2112
 
2113 2113
 	protected function _category_list_table() {
2114
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
2114
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2115 2115
 		$this->_search_btn_label = esc_html__('Categories', 'event_espresso');
2116 2116
 		$this->_admin_page_title .= $this->get_action_link_or_button('add_category', 'add_category', array(), 'add-new-h2');
2117 2117
 		$this->display_admin_list_table_page_with_sidebar();
@@ -2127,14 +2127,14 @@  discard block
 block discarded – undo
2127 2127
 		$this->_set_add_edit_form_tags($route);
2128 2128
 
2129 2129
 		$this->_set_category_object();
2130
-		$id = !empty($this->_category->id) ? $this->_category->id : '';
2130
+		$id = ! empty($this->_category->id) ? $this->_category->id : '';
2131 2131
 
2132 2132
 		$delete_action = 'delete_category';
2133 2133
 
2134 2134
 		//custom redirect
2135
-		$redirect = EE_Admin_Page::add_query_args_and_nonce( array('action' => 'category_list'), $this->_admin_base_url );
2135
+		$redirect = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'category_list'), $this->_admin_base_url);
2136 2136
 
2137
-		$this->_set_publish_post_box_vars( 'EVT_CAT_ID', $id, $delete_action, $redirect );
2137
+		$this->_set_publish_post_box_vars('EVT_CAT_ID', $id, $delete_action, $redirect);
2138 2138
 
2139 2139
 		//take care of contents
2140 2140
 		$this->_template_args['admin_page_content'] = $this->_category_details_content();
@@ -2148,25 +2148,25 @@  discard block
 block discarded – undo
2148 2148
 			'type' => 'wp_editor',
2149 2149
 			'value' => EEH_Formatter::admin_format_content($this->_category->category_desc),
2150 2150
 			'class' => 'my_editor_custom',
2151
-			'wpeditor_args' => array('media_buttons' => FALSE )
2151
+			'wpeditor_args' => array('media_buttons' => FALSE)
2152 2152
 		);
2153
-		$_wp_editor = $this->_generate_admin_form_fields( $editor_args, 'array' );
2153
+		$_wp_editor = $this->_generate_admin_form_fields($editor_args, 'array');
2154 2154
 
2155
-		$all_terms = get_terms( array('espresso_event_categories' ), array( 'hide_empty' => 0, 'exclude' => array( $this->_category->id ) ) );
2155
+		$all_terms = get_terms(array('espresso_event_categories'), array('hide_empty' => 0, 'exclude' => array($this->_category->id)));
2156 2156
 
2157 2157
 		//setup category select for term parents.
2158 2158
 		$category_select_values[] = array(
2159 2159
 			'text' => esc_html__('No Parent', 'event_espresso'),
2160 2160
 			'id' => 0
2161 2161
 			);
2162
-		foreach ( $all_terms as $term ) {
2162
+		foreach ($all_terms as $term) {
2163 2163
 			$category_select_values[] = array(
2164 2164
 				'text' => $term->name,
2165 2165
 				'id' => $term->term_id
2166 2166
 				);
2167 2167
 		}
2168 2168
 
2169
-		$category_select = EEH_Form_Fields::select_input( 'category_parent', $category_select_values, $this->_category->parent );
2169
+		$category_select = EEH_Form_Fields::select_input('category_parent', $category_select_values, $this->_category->parent);
2170 2170
 
2171 2171
 		$template_args = array(
2172 2172
 			'category' => $this->_category,
@@ -2176,15 +2176,15 @@  discard block
 block discarded – undo
2176 2176
 			'disable' => '',
2177 2177
 			'disabled_message' => FALSE
2178 2178
 			);
2179
-		$template = EVENTS_TEMPLATE_PATH . 'event_category_details.template.php';
2180
-		return EEH_Template::display_template($template, $template_args, TRUE );
2179
+		$template = EVENTS_TEMPLATE_PATH.'event_category_details.template.php';
2180
+		return EEH_Template::display_template($template, $template_args, TRUE);
2181 2181
 	}
2182 2182
 
2183 2183
 
2184 2184
 	protected function _delete_categories() {
2185
-		$cat_ids = isset( $this->_req_data['EVT_CAT_ID'] ) ? (array) $this->_req_data['EVT_CAT_ID'] : (array) $this->_req_data['category_id'];
2185
+		$cat_ids = isset($this->_req_data['EVT_CAT_ID']) ? (array) $this->_req_data['EVT_CAT_ID'] : (array) $this->_req_data['category_id'];
2186 2186
 
2187
-		foreach ( $cat_ids as $cat_id ) {
2187
+		foreach ($cat_ids as $cat_id) {
2188 2188
 			$this->_delete_category($cat_id);
2189 2189
 		}
2190 2190
 
@@ -2192,7 +2192,7 @@  discard block
 block discarded – undo
2192 2192
 		$query_args = array(
2193 2193
 			'action' => 'category_list'
2194 2194
 			);
2195
-		$this->_redirect_after_action(0,'','',$query_args);
2195
+		$this->_redirect_after_action(0, '', '', $query_args);
2196 2196
 
2197 2197
 	}
2198 2198
 
@@ -2202,61 +2202,61 @@  discard block
 block discarded – undo
2202 2202
 
2203 2203
 	protected function _delete_category($cat_id) {
2204 2204
 		global $wpdb;
2205
-		$cat_id = absint( $cat_id );
2206
-		wp_delete_term( $cat_id, 'espresso_event_categories' );
2205
+		$cat_id = absint($cat_id);
2206
+		wp_delete_term($cat_id, 'espresso_event_categories');
2207 2207
 	}
2208 2208
 
2209 2209
 
2210 2210
 
2211 2211
 	protected function _insert_or_update_category($new_category) {
2212 2212
 
2213
-		$cat_id = $new_category ? $this->_insert_category() : $this->_insert_category( TRUE );
2213
+		$cat_id = $new_category ? $this->_insert_category() : $this->_insert_category(TRUE);
2214 2214
 		$success = 0; //we already have a success message so lets not send another.
2215 2215
 
2216
-		if ( $cat_id ) {
2216
+		if ($cat_id) {
2217 2217
 			$query_args = array(
2218 2218
 				'action'     => 'edit_category',
2219 2219
 				'EVT_CAT_ID' => $cat_id
2220 2220
 			);
2221 2221
 		} else {
2222
-			$query_args = array( 'action' => 'add_category' );
2222
+			$query_args = array('action' => 'add_category');
2223 2223
 		}
2224
-		$this->_redirect_after_action( $success, '','', $query_args, TRUE );
2224
+		$this->_redirect_after_action($success, '', '', $query_args, TRUE);
2225 2225
 
2226 2226
 	}
2227 2227
 
2228 2228
 
2229 2229
 
2230
-	private function _insert_category( $update = FALSE ) {
2230
+	private function _insert_category($update = FALSE) {
2231 2231
 		$cat_id = $update ? $this->_req_data['EVT_CAT_ID'] : '';
2232
-		$category_name= isset( $this->_req_data['category_name'] ) ? $this->_req_data['category_name'] : '';
2233
-		$category_desc= isset( $this->_req_data['category_desc'] ) ? $this->_req_data['category_desc'] : '';
2234
-		$category_parent = isset( $this->_req_data['category_parent'] ) ? $this->_req_data['category_parent'] : 0;
2232
+		$category_name = isset($this->_req_data['category_name']) ? $this->_req_data['category_name'] : '';
2233
+		$category_desc = isset($this->_req_data['category_desc']) ? $this->_req_data['category_desc'] : '';
2234
+		$category_parent = isset($this->_req_data['category_parent']) ? $this->_req_data['category_parent'] : 0;
2235 2235
 
2236
-		if ( empty( $category_name ) ) {
2237
-			$msg = esc_html__( 'You must add a name for the category.', 'event_espresso' );
2238
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
2236
+		if (empty($category_name)) {
2237
+			$msg = esc_html__('You must add a name for the category.', 'event_espresso');
2238
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
2239 2239
 			return false;
2240 2240
 		}
2241 2241
 
2242
-		$term_args=array(
2242
+		$term_args = array(
2243 2243
 			'name'=>$category_name,
2244 2244
 			'description'=>$category_desc,
2245 2245
 			'parent'=>$category_parent
2246 2246
 		);
2247 2247
 		//was the category_identifier input disabled?
2248
-		if(isset($this->_req_data['category_identifier'])){
2248
+		if (isset($this->_req_data['category_identifier'])) {
2249 2249
 			$term_args['slug'] = $this->_req_data['category_identifier'];
2250 2250
 		}
2251
-		$insert_ids = $update ? wp_update_term( $cat_id, 'espresso_event_categories', $term_args ) :wp_insert_term( $category_name, 'espresso_event_categories', $term_args );
2251
+		$insert_ids = $update ? wp_update_term($cat_id, 'espresso_event_categories', $term_args) : wp_insert_term($category_name, 'espresso_event_categories', $term_args);
2252 2252
 
2253
-		if ( !is_array( $insert_ids ) ) {
2254
-			$msg = esc_html__( 'An error occurred and the category has not been saved to the database.', 'event_espresso' );
2255
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
2253
+		if ( ! is_array($insert_ids)) {
2254
+			$msg = esc_html__('An error occurred and the category has not been saved to the database.', 'event_espresso');
2255
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
2256 2256
 		} else {
2257 2257
 			$cat_id = $insert_ids['term_id'];
2258
-			$msg = sprintf ( esc_html__('The category %s was successfully saved', 'event_espresso'), $category_name );
2259
-			EE_Error::add_success( $msg );
2258
+			$msg = sprintf(esc_html__('The category %s was successfully saved', 'event_espresso'), $category_name);
2259
+			EE_Error::add_success($msg);
2260 2260
 		}
2261 2261
 
2262 2262
 		return $cat_id;
@@ -2265,32 +2265,32 @@  discard block
 block discarded – undo
2265 2265
 
2266 2266
 
2267 2267
 
2268
-	public function get_categories( $per_page = 10, $current_page = 1, $count = FALSE ) {
2268
+	public function get_categories($per_page = 10, $current_page = 1, $count = FALSE) {
2269 2269
 		global $wpdb;
2270 2270
 
2271 2271
 		//testing term stuff
2272
-		$orderby = isset( $this->_req_data['orderby'] ) ? $this->_req_data['orderby'] : 'Term.term_id';
2273
-		$order = isset( $this->_req_data['order'] ) ? $this->_req_data['order'] : 'DESC';
2274
-		$limit = ($current_page-1)*$per_page;
2272
+		$orderby = isset($this->_req_data['orderby']) ? $this->_req_data['orderby'] : 'Term.term_id';
2273
+		$order = isset($this->_req_data['order']) ? $this->_req_data['order'] : 'DESC';
2274
+		$limit = ($current_page - 1) * $per_page;
2275 2275
 
2276
-		$where = array( 'taxonomy' => 'espresso_event_categories' );
2276
+		$where = array('taxonomy' => 'espresso_event_categories');
2277 2277
 
2278
-		if ( isset( $this->_req_data['s'] ) ) {
2279
-			$sstr = '%' . $this->_req_data['s'] . '%';
2278
+		if (isset($this->_req_data['s'])) {
2279
+			$sstr = '%'.$this->_req_data['s'].'%';
2280 2280
 			$where['OR'] = array(
2281
-				'Term.name' => array( 'LIKE', $sstr),
2282
-				'description' => array( 'LIKE', $sstr )
2281
+				'Term.name' => array('LIKE', $sstr),
2282
+				'description' => array('LIKE', $sstr)
2283 2283
 				);
2284 2284
 		}
2285 2285
 
2286 2286
 		$query_params = array(
2287
-			$where ,
2288
-			'order_by' => array( $orderby => $order ),
2289
-			'limit' => $limit . ',' . $per_page,
2287
+			$where,
2288
+			'order_by' => array($orderby => $order),
2289
+			'limit' => $limit.','.$per_page,
2290 2290
 			'force_join' => array('Term')
2291 2291
 			);
2292 2292
 
2293
-		$categories = $count ? EEM_Term_Taxonomy::instance()->count( $query_params, 'term_id' ) :EEM_Term_Taxonomy::instance()->get_all( $query_params );
2293
+		$categories = $count ? EEM_Term_Taxonomy::instance()->count($query_params, 'term_id') : EEM_Term_Taxonomy::instance()->get_all($query_params);
2294 2294
 
2295 2295
 		return $categories;
2296 2296
 	}
Please login to merge, or discard this patch.