Completed
Branch BUG-7537 (8302bc)
by
unknown
60:48 queued 45:02
created
admin_pages/events/Events_Admin_Page.core.php 3 patches
Doc Comments   +3 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1291,7 +1291,7 @@  discard block
 block discarded – undo
1291 1291
 	 * This just returns whatever is set as the _event object property
1292 1292
 	 *
1293 1293
 	 * //todo this will become obsolete once the models are in place
1294
-	 * @return object
1294
+	 * @return EE_CPT_Base
1295 1295
 	 */
1296 1296
 	public function get_event_object() {
1297 1297
 		return $this->_cpt_model_obj;
@@ -1761,9 +1761,8 @@  discard block
 block discarded – undo
1761 1761
 	 * _trash_or_restore_events
1762 1762
 	 *
1763 1763
 	 * @access  private
1764
-	 * @param  int $event_id
1765 1764
 	 * @param  string $event_status
1766
-	 * @return void
1765
+	 * @return boolean
1767 1766
 	 */
1768 1767
 	private function _change_event_status($EVT_ID = FALSE, $event_status = FALSE) {
1769 1768
 		// grab event id
@@ -1883,7 +1882,7 @@  discard block
 block discarded – undo
1883 1882
 	 *
1884 1883
 	 * @access  private
1885 1884
 	 * @param  int $EVT_ID
1886
-	 * @return void
1885
+	 * @return boolean
1887 1886
 	 */
1888 1887
 	private function _permanently_delete_event($EVT_ID = FALSE) {
1889 1888
 		// grab event id
Please login to merge, or discard this 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
 /**
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 			'espresso_events' => 'edit'
68 68
 			);
69 69
 
70
-		add_action('AHEE__EE_Admin_Page_CPT__set_model_object__after_set_object', array( $this, 'verify_event_edit' ) );
70
+		add_action('AHEE__EE_Admin_Page_CPT__set_model_object__after_set_object', array($this, 'verify_event_edit'));
71 71
 	}
72 72
 
73 73
 	protected function _ajax_hooks() {
@@ -93,20 +93,20 @@  discard block
 block discarded – undo
93 93
 				'edit' => __('Update Event', 'event_espresso'),
94 94
 				'add_category' => __('Save New Category', 'event_espresso'),
95 95
 				'edit_category' => __('Update Category', 'event_espresso'),
96
-				'template_settings' => __( 'Update Settings', 'event_espresso' )
96
+				'template_settings' => __('Update Settings', 'event_espresso')
97 97
 				)
98 98
 		);
99 99
 	}
100 100
 
101 101
 	protected function _set_page_routes() {
102 102
 		//load formatter helper
103
-		EE_Registry::instance()->load_helper( 'Formatter' );
103
+		EE_Registry::instance()->load_helper('Formatter');
104 104
 		//load field generator helper
105
-		EE_Registry::instance()->load_helper( 'Form_Fields' );
105
+		EE_Registry::instance()->load_helper('Form_Fields');
106 106
 
107 107
 		//is there a evt_id in the request?
108
-		$evt_id = ! empty( $this->_req_data['EVT_ID'] ) && ! is_array( $this->_req_data['EVT_ID'] ) ? $this->_req_data['EVT_ID'] : 0;
109
-		$evt_id = ! empty( $this->_req_data['post'] ) ? $this->_req_data['post'] : $evt_id;
108
+		$evt_id = ! empty($this->_req_data['EVT_ID']) && ! is_array($this->_req_data['EVT_ID']) ? $this->_req_data['EVT_ID'] : 0;
109
+		$evt_id = ! empty($this->_req_data['post']) ? $this->_req_data['post'] : $evt_id;
110 110
 
111 111
 
112 112
 		$this->_page_routes = array(
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
 				'help_tour' => array(
321 321
 					'Event_Editor_Help_Tour'
322 322
 					),
323
-				'qtips' => array( 'EE_Event_Editor_Decaf_Tips' ),
323
+				'qtips' => array('EE_Event_Editor_Decaf_Tips'),
324 324
 				'require_nonce' => FALSE
325 325
 			),
326 326
 			'edit' => array(
@@ -376,7 +376,7 @@  discard block
 block discarded – undo
376 376
 				'help_tour' => array(
377 377
 					'Event_Edit_Help_Tour'
378 378
 				),
379
-				'qtips' => array( 'EE_Event_Editor_Decaf_Tips' ),
379
+				'qtips' => array('EE_Event_Editor_Decaf_Tips'),
380 380
 				'require_nonce' => FALSE
381 381
 			),
382 382
 			'default_event_settings' => array(
@@ -398,7 +398,7 @@  discard block
 block discarded – undo
398 398
 						'filename' => 'events_default_settings_status'
399 399
 					)
400 400
 				),
401
-				'help_tour' => array( 'Event_Default_Settings_Help_Tour'),
401
+				'help_tour' => array('Event_Default_Settings_Help_Tour'),
402 402
 				'require_nonce' => FALSE
403 403
 			),
404 404
 			//template settings
@@ -414,7 +414,7 @@  discard block
 block discarded – undo
414 414
 						'filename' => 'general_settings_templates'
415 415
 					)
416 416
 				),
417
-				'help_tour' => array( 'Templates_Help_Tour' ),
417
+				'help_tour' => array('Templates_Help_Tour'),
418 418
 				'require_nonce' => FALSE
419 419
 			),
420 420
 			//event category stuff
@@ -438,7 +438,7 @@  discard block
 block discarded – undo
438 438
 					'label' => __('Edit Category', 'event_espresso'),
439 439
 					'order' => 15,
440 440
 					'persistent' => FALSE,
441
-					'url' => isset($this->_req_data['EVT_CAT_ID']) ? add_query_arg(array('EVT_CAT_ID' => $this->_req_data['EVT_CAT_ID'] ), $this->_current_page_view_url )  : $this->_admin_base_url
441
+					'url' => isset($this->_req_data['EVT_CAT_ID']) ? add_query_arg(array('EVT_CAT_ID' => $this->_req_data['EVT_CAT_ID']), $this->_current_page_view_url) : $this->_admin_base_url
442 442
 					),
443 443
 				'help_tabs' => array(
444 444
 					'edit_category_help_tab' => array(
@@ -508,14 +508,14 @@  discard block
 block discarded – undo
508 508
 
509 509
 	public function load_scripts_styles() {
510 510
 
511
-		wp_register_style('events-admin-css', EVENTS_ASSETS_URL . 'events-admin-page.css', array(), EVENT_ESPRESSO_VERSION);
512
-		wp_register_style('ee-cat-admin', EVENTS_ASSETS_URL . 'ee-cat-admin.css', array(), EVENT_ESPRESSO_VERSION );
511
+		wp_register_style('events-admin-css', EVENTS_ASSETS_URL.'events-admin-page.css', array(), EVENT_ESPRESSO_VERSION);
512
+		wp_register_style('ee-cat-admin', EVENTS_ASSETS_URL.'ee-cat-admin.css', array(), EVENT_ESPRESSO_VERSION);
513 513
 		wp_enqueue_style('events-admin-css');
514 514
 		wp_enqueue_style('ee-cat-admin');
515 515
 		//todo note: we also need to load_scripts_styles per view (i.e. default/view_report/event_details
516 516
 		//registers for all views
517 517
 		//scripts
518
-		wp_register_script('event_editor_js', EVENTS_ASSETS_URL . 'event_editor.js', array('ee_admin_js', 'jquery-ui-slider', 'jquery-ui-timepicker-addon'), EVENT_ESPRESSO_VERSION, TRUE);
518
+		wp_register_script('event_editor_js', EVENTS_ASSETS_URL.'event_editor.js', array('ee_admin_js', 'jquery-ui-slider', 'jquery-ui-timepicker-addon'), EVENT_ESPRESSO_VERSION, TRUE);
519 519
 	}
520 520
 
521 521
 	/**
@@ -533,11 +533,11 @@  discard block
 block discarded – undo
533 533
 	public function load_scripts_styles_edit() {
534 534
 		//styles
535 535
 		wp_enqueue_style('espresso-ui-theme');
536
-		wp_register_style('event-editor-css', EVENTS_ASSETS_URL . 'event-editor.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION );
536
+		wp_register_style('event-editor-css', EVENTS_ASSETS_URL.'event-editor.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION);
537 537
 		wp_enqueue_style('event-editor-css');
538 538
 
539 539
 		//scripts
540
-		wp_register_script('event-datetime-metabox', EVENTS_ASSETS_URL . 'event-datetime-metabox.js', array('event_editor_js', 'ee-datepicker'), EVENT_ESPRESSO_VERSION );
540
+		wp_register_script('event-datetime-metabox', EVENTS_ASSETS_URL.'event-datetime-metabox.js', array('event_editor_js', 'ee-datepicker'), EVENT_ESPRESSO_VERSION);
541 541
 		wp_enqueue_script('event-datetime-metabox');
542 542
 
543 543
 	}
@@ -572,7 +572,7 @@  discard block
 block discarded – undo
572 572
 
573 573
 
574 574
 	public function admin_init() {
575
-		EE_Registry::$i18n_js_strings[ 'image_confirm' ] = __( 'Do you really want to delete this image? Please remember to update your event to complete the removal.', 'event_espresso' );
575
+		EE_Registry::$i18n_js_strings['image_confirm'] = __('Do you really want to delete this image? Please remember to update your event to complete the removal.', 'event_espresso');
576 576
 	}
577 577
 
578 578
 
@@ -593,35 +593,35 @@  discard block
 block discarded – undo
593 593
 	 */
594 594
 	public function verify_event_edit($event = NULL) {
595 595
 		// no event?
596
-		if ( empty( $event )) {
596
+		if (empty($event)) {
597 597
 			// set event
598 598
 			$event = $this->_cpt_model_obj;
599 599
 		}
600 600
 		// STILL no event?
601
-		if ( empty ( $event )) {
601
+		if (empty ($event)) {
602 602
 			return;
603 603
 		}
604 604
 		// first check if event is active.
605
-		if ( $event->is_expired() || $event->is_inactive() || $event->status() == EEM_Event::cancelled || $event->status() == EEM_Event::postponed ) {
605
+		if ($event->is_expired() || $event->is_inactive() || $event->status() == EEM_Event::cancelled || $event->status() == EEM_Event::postponed) {
606 606
 			return;
607 607
 		}
608 608
 		$orig_status = $event->status();
609 609
 		//made it here so it IS active... next check that any of the tickets are sold.
610
-		if ( $event->is_sold_out() || $event->is_sold_out(TRUE ) ) {
611
-			if ( $event->status() !== $orig_status && $orig_status !== EEM_Event::sold_out  ) {
612
-				EE_Error::add_attention( sprintf(
613
-					__( 'Please note that the Event Status has automaticallly 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 <em>can</em> change the status back to something else before updating if you wish.', 'event_espresso' ),
614
-					EEH_Template::pretty_status( EEM_Event::sold_out, FALSE, 'sentence' )
610
+		if ($event->is_sold_out() || $event->is_sold_out(TRUE)) {
611
+			if ($event->status() !== $orig_status && $orig_status !== EEM_Event::sold_out) {
612
+				EE_Error::add_attention(sprintf(
613
+					__('Please note that the Event Status has automaticallly 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 <em>can</em> change the status back to something else before updating if you wish.', 'event_espresso'),
614
+					EEH_Template::pretty_status(EEM_Event::sold_out, FALSE, 'sentence')
615 615
 				));
616 616
 			}
617 617
 			return;
618 618
 		}
619 619
 		//now we need to determine if the event has any tickets on sale.  If not then we dont' show the error
620
-		if ( ! $event->tickets_on_sale() ) {
620
+		if ( ! $event->tickets_on_sale()) {
621 621
 			return;
622 622
 		}
623 623
 		//made it here so show warning
624
-		EE_Error::add_attention( $this->_edit_event_warning() );
624
+		EE_Error::add_attention($this->_edit_event_warning());
625 625
 	}
626 626
 
627 627
 
@@ -661,7 +661,7 @@  discard block
 block discarded – undo
661 661
 			),
662 662
 		);
663 663
 
664
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_events', 'espresso_events_trash_events' ) ) {
664
+		if (EE_Registry::instance()->CAP->current_user_can('ee_delete_events', 'espresso_events_trash_events')) {
665 665
 			$this->_views['trash'] = array(
666 666
 				'slug' => 'trash',
667 667
 				'label' => __('Trash', 'event_espresso'),
@@ -691,39 +691,39 @@  discard block
 block discarded – undo
691 691
 				'desc' => __('View Registrations for Event', 'event_espresso')
692 692
 			)
693 693
 		);
694
-		$items  = apply_filters( 'FHEE__Events_Admin_Page___event_legend_items__items', $items );
694
+		$items = apply_filters('FHEE__Events_Admin_Page___event_legend_items__items', $items);
695 695
 		$statuses = array(
696 696
 			'sold_out_status' => array(
697
-				'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::sold_out,
698
-				'desc' => EEH_Template::pretty_status( EE_Datetime::sold_out, FALSE, 'sentence' )
697
+				'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::sold_out,
698
+				'desc' => EEH_Template::pretty_status(EE_Datetime::sold_out, FALSE, 'sentence')
699 699
 			),
700 700
 			'active_status' => array(
701
-				'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::active,
702
-				'desc' => EEH_Template::pretty_status( EE_Datetime::active, FALSE, 'sentence' )
701
+				'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::active,
702
+				'desc' => EEH_Template::pretty_status(EE_Datetime::active, FALSE, 'sentence')
703 703
 			),
704 704
 			'upcoming_status' => array(
705
-				'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::upcoming,
706
-				'desc' => EEH_Template::pretty_status( EE_Datetime::upcoming, FALSE, 'sentence' )
705
+				'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::upcoming,
706
+				'desc' => EEH_Template::pretty_status(EE_Datetime::upcoming, FALSE, 'sentence')
707 707
 			),
708 708
 			'postponed_status' => array(
709
-				'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::postponed,
710
-				'desc' => EEH_Template::pretty_status( EE_Datetime::postponed, FALSE, 'sentence' )
709
+				'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::postponed,
710
+				'desc' => EEH_Template::pretty_status(EE_Datetime::postponed, FALSE, 'sentence')
711 711
 			),
712 712
 			'cancelled_status' => array(
713
-				'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::cancelled,
714
-				'desc' => EEH_Template::pretty_status( EE_Datetime::cancelled, FALSE, 'sentence' )
713
+				'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::cancelled,
714
+				'desc' => EEH_Template::pretty_status(EE_Datetime::cancelled, FALSE, 'sentence')
715 715
 			),
716 716
 			'expired_status' => array(
717
-				'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::expired,
718
-				'desc' => EEH_Template::pretty_status( EE_Datetime::expired, FALSE, 'sentence' )
717
+				'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::expired,
718
+				'desc' => EEH_Template::pretty_status(EE_Datetime::expired, FALSE, 'sentence')
719 719
 			),
720 720
 			'inactive_status' => array(
721
-				'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::inactive,
722
-				'desc' => EEH_Template::pretty_status( EE_Datetime::inactive, FALSE, 'sentence' )
721
+				'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::inactive,
722
+				'desc' => EEH_Template::pretty_status(EE_Datetime::inactive, FALSE, 'sentence')
723 723
 			)
724 724
 		);
725
-		$statuses = apply_filters( 'FHEE__Events_Admin_Page__event_legend_items__statuses', $statuses );
726
-		return array_merge( $items, $statuses );
725
+		$statuses = apply_filters('FHEE__Events_Admin_Page__event_legend_items__statuses', $statuses);
726
+		return array_merge($items, $statuses);
727 727
 	}
728 728
 
729 729
 
@@ -735,8 +735,8 @@  discard block
 block discarded – undo
735 735
 	 * @return EEM_Event
736 736
 	 */
737 737
 	private function _event_model() {
738
-		if ( ! $this->_event_model instanceof EEM_Event ) {
739
-			$this->_event_model = EE_Registry::instance()->load_model( 'Event' );
738
+		if ( ! $this->_event_model instanceof EEM_Event) {
739
+			$this->_event_model = EE_Registry::instance()->load_model('Event');
740 740
 		}
741 741
 		return $this->_event_model;
742 742
 	}
@@ -755,12 +755,12 @@  discard block
 block discarded – undo
755 755
 	 * @param  string $new_slug  what the slug is
756 756
 	 * @return string            The new html string for the permalink area
757 757
 	 */
758
-	public function extra_permalink_field_buttons( $return, $id, $new_title, $new_slug ) {
758
+	public function extra_permalink_field_buttons($return, $id, $new_title, $new_slug) {
759 759
 		//make sure this is only when editing
760
-		if ( !empty( $id ) ) {
761
-			$post = get_post( $id );
762
-			$return .= '<a class="button button-small" onclick="prompt(\'Shortcode:\', jQuery(\'#shortcode\').val()); return false;" href="#"  tabindex="-1">' . __('Shortcode', 'event_espresso') . '</a> ';
763
-			$return .= '<input id="shortcode" type="hidden" value="[ESPRESSO_TICKET_SELECTOR event_id=\'' . $post->ID . '\']"">';
760
+		if ( ! empty($id)) {
761
+			$post = get_post($id);
762
+			$return .= '<a class="button button-small" onclick="prompt(\'Shortcode:\', jQuery(\'#shortcode\').val()); return false;" href="#"  tabindex="-1">'.__('Shortcode', 'event_espresso').'</a> ';
763
+			$return .= '<input id="shortcode" type="hidden" value="[ESPRESSO_TICKET_SELECTOR event_id=\''.$post->ID.'\']"">';
764 764
 		}
765 765
 		return $return;
766 766
 	}
@@ -776,8 +776,8 @@  discard block
 block discarded – undo
776 776
 	 * @return string html for generated table
777 777
 	 */
778 778
 	protected function _events_overview_list_table() {
779
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
780
-		$this->_template_args['after_list_table'] = EEH_Template::get_button_or_link( get_post_type_archive_link('espresso_events'), __("View Event Archive Page", "event_espresso"), 'button' ) .
779
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
780
+		$this->_template_args['after_list_table'] = EEH_Template::get_button_or_link(get_post_type_archive_link('espresso_events'), __("View Event Archive Page", "event_espresso"), 'button').
781 781
 		$this->_display_legend($this->_event_legend_items());
782 782
 		$this->_admin_page_title .= $this->get_action_link_or_button('create_new', 'add', array(), 'add-new-h2');
783 783
 		$this->display_admin_list_table_page_with_no_sidebar();
@@ -795,46 +795,46 @@  discard block
 block discarded – undo
795 795
 
796 796
 
797 797
 
798
-	protected function _insert_update_cpt_item( $post_id, $post ) {
798
+	protected function _insert_update_cpt_item($post_id, $post) {
799 799
 
800 800
 		$event_values = array(
801
-			'EVT_display_desc' => !empty( $this->_req_data['display_desc'] ) ? 1 : 0,
802
-			'EVT_display_ticket_selector' => !empty( $this->_req_data['display_ticket_selector'] ) ? 1 : 0,
801
+			'EVT_display_desc' => ! empty($this->_req_data['display_desc']) ? 1 : 0,
802
+			'EVT_display_ticket_selector' => ! empty($this->_req_data['display_ticket_selector']) ? 1 : 0,
803 803
 			'EVT_additional_limit' => min(
804
-					apply_filters( 'FHEE__EE_Events_Admin__insert_update_cpt_item__EVT_additional_limit_max', 255 ),
805
-					!empty( $this->_req_data['additional_limit'] ) ? $this->_req_data['additional_limit'] : NULL ),
806
-			'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,
807
-			'EVT_member_only' => !empty( $this->_req_data['member_only'] ) ? 1 : 0,
808
-			'EVT_allow_overflow' => !empty( $this->_req_data['EVT_allow_overflow'] ) ? 1 : 0,
809
-			'EVT_timezone_string' => !empty( $this->_req_data['timezone_string'] ) ? $this->_req_data['timezone_string'] : NULL,
810
-			'EVT_external_URL' => !empty( $this->_req_data['externalURL'] ) ? $this->_req_data['externalURL'] : NULL,
811
-			'EVT_phone' => !empty( $this->_req_data['event_phone'] ) ? $this->_req_data['event_phone'] : NULL
804
+					apply_filters('FHEE__EE_Events_Admin__insert_update_cpt_item__EVT_additional_limit_max', 255),
805
+					! empty($this->_req_data['additional_limit']) ? $this->_req_data['additional_limit'] : NULL ),
806
+			'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,
807
+			'EVT_member_only' => ! empty($this->_req_data['member_only']) ? 1 : 0,
808
+			'EVT_allow_overflow' => ! empty($this->_req_data['EVT_allow_overflow']) ? 1 : 0,
809
+			'EVT_timezone_string' => ! empty($this->_req_data['timezone_string']) ? $this->_req_data['timezone_string'] : NULL,
810
+			'EVT_external_URL' => ! empty($this->_req_data['externalURL']) ? $this->_req_data['externalURL'] : NULL,
811
+			'EVT_phone' => ! empty($this->_req_data['event_phone']) ? $this->_req_data['event_phone'] : NULL
812 812
 			);
813 813
 
814 814
 		//update event
815
-		$success = $this->_event_model()->update_by_ID( $event_values, $post_id );
815
+		$success = $this->_event_model()->update_by_ID($event_values, $post_id);
816 816
 
817 817
 
818 818
 		//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!
819
-		$get_one_where = array( $this->_event_model()->primary_key_name() => $post_id, 'status' => $post->post_status );
820
-		$event = $this->_event_model()->get_one( array($get_one_where) );
819
+		$get_one_where = array($this->_event_model()->primary_key_name() => $post_id, 'status' => $post->post_status);
820
+		$event = $this->_event_model()->get_one(array($get_one_where));
821 821
 
822 822
 
823 823
 		//the following are default callbacks for event attachment updates that can be overridden by caffeinated functionality and/or addons.
824
-		$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') ) );
824
+		$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')));
825 825
 
826 826
 		$att_success = TRUE;
827 827
 
828
-		foreach ( $event_update_callbacks as $e_callback ) {
829
-			$_succ = call_user_func_array( $e_callback, array( $event,  $this->_req_data ) );
830
-			$att_success = !$att_success ? $att_success : $_succ; //if ANY of these updates fail then we want the appropriate global error message
828
+		foreach ($event_update_callbacks as $e_callback) {
829
+			$_succ = call_user_func_array($e_callback, array($event, $this->_req_data));
830
+			$att_success = ! $att_success ? $att_success : $_succ; //if ANY of these updates fail then we want the appropriate global error message
831 831
 		}
832 832
 
833 833
 		//any errors?
834
-		if ( $success && FALSE === $att_success ) {
835
-			EE_Error::add_error( __('Event Details saved successfully but something went wrong with saving attachments.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
836
-		} else if ( $success === FALSE ) {
837
-			EE_Error::add_error( __('Event Details did not save successfully.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
834
+		if ($success && FALSE === $att_success) {
835
+			EE_Error::add_error(__('Event Details saved successfully but something went wrong with saving attachments.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
836
+		} else if ($success === FALSE) {
837
+			EE_Error::add_error(__('Event Details did not save successfully.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
838 838
 		}
839 839
 	}
840 840
 
@@ -844,7 +844,7 @@  discard block
 block discarded – undo
844 844
 	/**
845 845
 	 * @see parent::restore_item()
846 846
 	 */
847
-	protected function _restore_cpt_item( $post_id, $revision_id ) {
847
+	protected function _restore_cpt_item($post_id, $revision_id) {
848 848
 		//copy existing event meta to new post
849 849
 		$post_evt = $this->_event_model()->get_one_by_ID($post_id);
850 850
 
@@ -852,7 +852,7 @@  discard block
 block discarded – undo
852 852
 		$post_evt->restore_revision($revision_id);
853 853
 
854 854
 		//related objs restore
855
-		$post_evt->restore_revision($revision_id, array( 'Venue', 'Datetime', 'Price' ) );
855
+		$post_evt->restore_revision($revision_id, array('Venue', 'Datetime', 'Price'));
856 856
 	}
857 857
 
858 858
 
@@ -864,50 +864,50 @@  discard block
 block discarded – undo
864 864
 	 * @param  array  $data   The request data from the form
865 865
 	 * @return bool           Success or fail.
866 866
 	 */
867
-	protected function _default_venue_update( $evtobj, $data ) {
868
-		require_once( EE_MODELS . 'EEM_Venue.model.php' );
867
+	protected function _default_venue_update($evtobj, $data) {
868
+		require_once(EE_MODELS.'EEM_Venue.model.php');
869 869
 		$venue_model = EE_Registry::instance()->load_model('Venue');
870 870
 		$rows_affected = NULL;
871
-		$venue_id = !empty( $data['venue_id'] ) ? $data['venue_id'] : NULL;
871
+		$venue_id = ! empty($data['venue_id']) ? $data['venue_id'] : NULL;
872 872
 
873 873
 		//very important.  If we don't have a venue name then we'll get out because not necessary to create empty venue
874
-		if ( empty( $data['venue_title'] ) )
874
+		if (empty($data['venue_title']))
875 875
 			return;
876 876
 
877 877
 		$venue_array = array(
878 878
 				'VNU_wp_user' => $evtobj->get('EVT_wp_user'),
879
-				'VNU_name' => !empty( $data['venue_title'] ) ? $data['venue_title'] : NULL,
880
-				'VNU_desc' => !empty( $data['venue_description'] ) ? $data['venue_description'] : NULL,
881
-				'VNU_identifier' => !empty( $data['venue_identifier'] ) ? $data['venue_identifier'] : NULL,
882
-				'VNU_short_desc' => !empty( $data['venue_short_description'] ) ? $data['venue_short_description'] : NULL,
883
-				'VNU_address' => !empty( $data['address'] ) ? $data['address'] : NULL,
884
-				'VNU_address2' => !empty( $data['address2'] ) ? $data['address2'] : NULL,
885
-				'VNU_city' => !empty( $data['city'] ) ? $data['city'] : NULL,
886
-				'STA_ID' => !empty( $data['state'] ) ? $data['state'] : NULL,
887
-				'CNT_ISO' => !empty( $data['countries'] ) ? $data['countries'] : NULL,
888
-				'VNU_zip' => !empty( $data['zip'] ) ? $data['zip'] : NULL,
889
-				'VNU_phone' => !empty( $data['venue_phone'] ) ? $data['venue_phone'] : NULL,
890
-				'VNU_capacity' => !empty( $data['venue_capacity'] ) ? $data['venue_capacity'] : NULL,
891
-				'VNU_url' => !empty($data['venue_url'] ) ? $data['venue_url'] : NULL,
892
-				'VNU_virtual_phone' => !empty($data['virtual_phone']) ? $data['virtual_phone'] : NULL,
893
-				'VNU_virtual_url' => !empty( $data['virtual_url'] ) ? $data['virtual_url'] : NULL,
894
-				'VNU_enable_for_gmap' => isset( $data['enable_for_gmap'] ) ? 1 : 0,
879
+				'VNU_name' => ! empty($data['venue_title']) ? $data['venue_title'] : NULL,
880
+				'VNU_desc' => ! empty($data['venue_description']) ? $data['venue_description'] : NULL,
881
+				'VNU_identifier' => ! empty($data['venue_identifier']) ? $data['venue_identifier'] : NULL,
882
+				'VNU_short_desc' => ! empty($data['venue_short_description']) ? $data['venue_short_description'] : NULL,
883
+				'VNU_address' => ! empty($data['address']) ? $data['address'] : NULL,
884
+				'VNU_address2' => ! empty($data['address2']) ? $data['address2'] : NULL,
885
+				'VNU_city' => ! empty($data['city']) ? $data['city'] : NULL,
886
+				'STA_ID' => ! empty($data['state']) ? $data['state'] : NULL,
887
+				'CNT_ISO' => ! empty($data['countries']) ? $data['countries'] : NULL,
888
+				'VNU_zip' => ! empty($data['zip']) ? $data['zip'] : NULL,
889
+				'VNU_phone' => ! empty($data['venue_phone']) ? $data['venue_phone'] : NULL,
890
+				'VNU_capacity' => ! empty($data['venue_capacity']) ? $data['venue_capacity'] : NULL,
891
+				'VNU_url' => ! empty($data['venue_url']) ? $data['venue_url'] : NULL,
892
+				'VNU_virtual_phone' => ! empty($data['virtual_phone']) ? $data['virtual_phone'] : NULL,
893
+				'VNU_virtual_url' => ! empty($data['virtual_url']) ? $data['virtual_url'] : NULL,
894
+				'VNU_enable_for_gmap' => isset($data['enable_for_gmap']) ? 1 : 0,
895 895
 				'status' => 'publish'
896 896
 			);
897 897
 
898 898
 
899 899
 		//if we've got the venue_id then we're just updating the existing venue so let's do that and then get out.
900
-		if ( !empty( $venue_id ) ) {
901
-			$update_where = array( $venue_model->primary_key_name() => $venue_id );
902
-			$rows_affected = $venue_model->update( $venue_array, array( $update_where ) );
900
+		if ( ! empty($venue_id)) {
901
+			$update_where = array($venue_model->primary_key_name() => $venue_id);
902
+			$rows_affected = $venue_model->update($venue_array, array($update_where));
903 903
 			//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.
904
-			$evtobj->_add_relation_to( $venue_id, 'Venue' );
904
+			$evtobj->_add_relation_to($venue_id, 'Venue');
905 905
 			return $rows_affected > 0 ? TRUE : FALSE;
906 906
 		} else {
907 907
 			//we insert the venue
908
-			$venue_id = $venue_model->insert( $venue_array );
909
-			$evtobj->_add_relation_to( $venue_id, 'Venue' );
910
-			return !empty( $venue_id ) ? TRUE : FALSE;
908
+			$venue_id = $venue_model->insert($venue_array);
909
+			$evtobj->_add_relation_to($venue_id, 'Venue');
910
+			return ! empty($venue_id) ? TRUE : FALSE;
911 911
 		}
912 912
 		return TRUE; //when we have the ancestor come in it's already been handled by the revision save.
913 913
 	}
@@ -921,50 +921,50 @@  discard block
 block discarded – undo
921 921
 	 * @param  array    $data   The request data from the form
922 922
 	 * @return bool             success or fail
923 923
 	 */
924
-	protected function _default_tickets_update( $evtobj, $data ) {
924
+	protected function _default_tickets_update($evtobj, $data) {
925 925
 		$success = TRUE;
926
-		$incoming_date_formats = array( 'Y-m-d', 'h:i a' );
927
-		foreach ( $data['edit_event_datetimes'] as $row => $dtt ) {
928
-			$dtt['DTT_EVT_end'] = isset($dtt['DTT_EVT_end']) && ! empty( $dtt['DTT_EVT_end'] ) ? $dtt['DTT_EVT_end'] : $dtt['DTT_EVT_start'];
926
+		$incoming_date_formats = array('Y-m-d', 'h:i a');
927
+		foreach ($data['edit_event_datetimes'] as $row => $dtt) {
928
+			$dtt['DTT_EVT_end'] = isset($dtt['DTT_EVT_end']) && ! empty($dtt['DTT_EVT_end']) ? $dtt['DTT_EVT_end'] : $dtt['DTT_EVT_start'];
929 929
 			$datetime_values = array(
930
-				'DTT_ID' => !empty( $dtt['DTT_ID'] ) ? $dtt['DTT_ID'] : NULL,
930
+				'DTT_ID' => ! empty($dtt['DTT_ID']) ? $dtt['DTT_ID'] : NULL,
931 931
 				'DTT_EVT_start' => $dtt['DTT_EVT_start'],
932 932
 				'DTT_EVT_end' => $dtt['DTT_EVT_end'],
933
-				'DTT_reg_limit' => empty( $dtt['DTT_reg_limit'] ) ? INF : $dtt['DTT_reg_limit'],
933
+				'DTT_reg_limit' => empty($dtt['DTT_reg_limit']) ? INF : $dtt['DTT_reg_limit'],
934 934
 				'DTT_order' => $row,
935 935
 				);
936 936
 
937 937
 			//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.
938 938
 
939
-			if ( !empty( $dtt['DTT_ID'] ) ) {
940
-				$DTM = EE_Registry::instance()->load_model('Datetime', array( $evtobj->get_timezone() ) )->get_one_by_ID($dtt['DTT_ID'] );
941
-				$DTM->set_date_format( $incoming_date_formats[0] );
942
-				$DTM->set_time_format( $incoming_date_formats[1] );
943
-				foreach ( $datetime_values as $field => $value ) {
944
-					$DTM->set( $field, $value );
939
+			if ( ! empty($dtt['DTT_ID'])) {
940
+				$DTM = EE_Registry::instance()->load_model('Datetime', array($evtobj->get_timezone()))->get_one_by_ID($dtt['DTT_ID']);
941
+				$DTM->set_date_format($incoming_date_formats[0]);
942
+				$DTM->set_time_format($incoming_date_formats[1]);
943
+				foreach ($datetime_values as $field => $value) {
944
+					$DTM->set($field, $value);
945 945
 				}
946 946
 
947 947
 				//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.
948 948
 				$saved_dtts[$DTM->ID()] = $DTM;
949 949
 			} else {
950
-				$DTM = EE_Registry::instance()->load_class('Datetime', array( $datetime_values ), FALSE, FALSE );
951
-				$DTM->set_date_format( $incoming_date_formats[0] );
952
-				$DTM->set_time_format( $incoming_date_formats[1] );
953
-				$DTM->set_timezone( $evtobj->get_timezone() );
954
-				foreach ( $datetime_values as $field => $value ) {
955
-					$DTM->set( $field, $value );
950
+				$DTM = EE_Registry::instance()->load_class('Datetime', array($datetime_values), FALSE, FALSE);
951
+				$DTM->set_date_format($incoming_date_formats[0]);
952
+				$DTM->set_time_format($incoming_date_formats[1]);
953
+				$DTM->set_timezone($evtobj->get_timezone());
954
+				foreach ($datetime_values as $field => $value) {
955
+					$DTM->set($field, $value);
956 956
 				}
957 957
 			}
958 958
 			$DTM->save();
959 959
 
960
-			$DTT = $evtobj->_add_relation_to( $DTM, 'Datetime' );
960
+			$DTT = $evtobj->_add_relation_to($DTM, 'Datetime');
961 961
 
962 962
 			//load DTT helper
963 963
 			EE_Registry::instance()->load_helper('DTT_Helper');
964 964
 
965 965
 			//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.
966
-			if( $DTT->get_raw('DTT_EVT_start') > $DTT->get_raw('DTT_EVT_end') ) {
967
-				$DTT->set('DTT_EVT_end', $DTT->get('DTT_EVT_start') );
966
+			if ($DTT->get_raw('DTT_EVT_start') > $DTT->get_raw('DTT_EVT_end')) {
967
+				$DTT->set('DTT_EVT_end', $DTT->get('DTT_EVT_start'));
968 968
 				$DTT = EEH_DTT_Helper::date_time_add($DTT, 'DTT_EVT_end', 'days');
969 969
 				$DTT->save();
970 970
 			}
@@ -972,42 +972,42 @@  discard block
 block discarded – undo
972 972
 			//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.
973 973
 			$saved_dtt = $DTT;
974 974
 
975
-			$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.
975
+			$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.
976 976
 		}
977 977
 
978 978
 		//no dtts get deleted so we don't do any of that logic here.
979 979
 		//update tickets next
980
-		$old_tickets = isset( $data['ticket_IDs'] ) ? explode(',', $data['ticket_IDs'] ) : array();
981
-		foreach ( $data['edit_tickets'] as $row => $tkt ) {
982
-			$incoming_date_formats = array( 'Y-m-d', 'h:i a' );
980
+		$old_tickets = isset($data['ticket_IDs']) ? explode(',', $data['ticket_IDs']) : array();
981
+		foreach ($data['edit_tickets'] as $row => $tkt) {
982
+			$incoming_date_formats = array('Y-m-d', 'h:i a');
983 983
 			$update_prices = false;
984
-			$ticket_price = isset( $data['edit_prices'][$row][1]['PRC_amount'] ) ? $data['edit_prices'][$row][1]['PRC_amount'] : 0;
984
+			$ticket_price = isset($data['edit_prices'][$row][1]['PRC_amount']) ? $data['edit_prices'][$row][1]['PRC_amount'] : 0;
985 985
 
986
-			if ( empty( $tkt['TKT_start_date'] ) ) {
986
+			if (empty($tkt['TKT_start_date'])) {
987 987
 				//let's use now in the set timezone.
988
-				$now = new DateTime( 'now', new DateTimeZone( $evtobj->get_timezone() ) );
989
-				$tkt['TKT_start_date'] = $now->format( $incoming_date_formats[0] . ' ' . $incoming_date_formats[1] );
988
+				$now = new DateTime('now', new DateTimeZone($evtobj->get_timezone()));
989
+				$tkt['TKT_start_date'] = $now->format($incoming_date_formats[0].' '.$incoming_date_formats[1]);
990 990
 			}
991 991
 
992
-			if ( empty( $tkt['TKT_end_date'] ) ) {
992
+			if (empty($tkt['TKT_end_date'])) {
993 993
 				//use the start date of the first datetime
994
-				$dtt = $evtobj->get_first_related( 'Datetime' );
995
-				$tkt['TKT_end_date'] = $dtt->start_date_and_time( $incoming_date_formats[0], $incoming_date_formats[1] );
994
+				$dtt = $evtobj->get_first_related('Datetime');
995
+				$tkt['TKT_end_date'] = $dtt->start_date_and_time($incoming_date_formats[0], $incoming_date_formats[1]);
996 996
 			}
997 997
 
998 998
 			$TKT_values = array(
999
-				'TKT_ID' => !empty( $tkt['TKT_ID'] ) ? $tkt['TKT_ID'] : NULL,
1000
-				'TTM_ID' => !empty( $tkt['TTM_ID'] ) ? $tkt['TTM_ID'] : 0,
1001
-				'TKT_name' => !empty( $tkt['TKT_name'] ) ? $tkt['TKT_name'] : '',
1002
-				'TKT_description' => !empty( $tkt['TKT_description'] ) ? $tkt['TKT_description'] : '',
999
+				'TKT_ID' => ! empty($tkt['TKT_ID']) ? $tkt['TKT_ID'] : NULL,
1000
+				'TTM_ID' => ! empty($tkt['TTM_ID']) ? $tkt['TTM_ID'] : 0,
1001
+				'TKT_name' => ! empty($tkt['TKT_name']) ? $tkt['TKT_name'] : '',
1002
+				'TKT_description' => ! empty($tkt['TKT_description']) ? $tkt['TKT_description'] : '',
1003 1003
 				'TKT_start_date' => $tkt['TKT_start_date'],
1004 1004
 				'TKT_end_date' => $tkt['TKT_end_date'],
1005
-				'TKT_qty' => empty( $tkt['TKT_qty'] ) ? INF : $tkt['TKT_qty'],
1006
-				'TKT_uses' => empty( $tkt['TKT_uses'] ) ? INF : $tkt['TKT_uses'],
1007
-				'TKT_min' => empty( $tkt['TKT_min'] ) ? 0 : $tkt['TKT_min'],
1008
-				'TKT_max' => empty( $tkt['TKT_max'] ) ? INF : $tkt['TKT_max'],
1005
+				'TKT_qty' => empty($tkt['TKT_qty']) ? INF : $tkt['TKT_qty'],
1006
+				'TKT_uses' => empty($tkt['TKT_uses']) ? INF : $tkt['TKT_uses'],
1007
+				'TKT_min' => empty($tkt['TKT_min']) ? 0 : $tkt['TKT_min'],
1008
+				'TKT_max' => empty($tkt['TKT_max']) ? INF : $tkt['TKT_max'],
1009 1009
 				'TKT_row' => $row,
1010
-				'TKT_order' => isset( $tkt['TKT_order'] ) ? $tkt['TKT_order'] : $row,
1010
+				'TKT_order' => isset($tkt['TKT_order']) ? $tkt['TKT_order'] : $row,
1011 1011
 				'TKT_price' => $ticket_price
1012 1012
 				);
1013 1013
 
@@ -1015,7 +1015,7 @@  discard block
 block discarded – undo
1015 1015
 
1016 1016
 
1017 1017
 			//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.
1018
-			if ( isset( $tkt['TKT_is_default'] ) && $tkt['TKT_is_default'] ) {
1018
+			if (isset($tkt['TKT_is_default']) && $tkt['TKT_is_default']) {
1019 1019
 				$TKT_values['TKT_ID'] = 0;
1020 1020
 				$TKT_values['TKT_is_default'] = 0;
1021 1021
 				$TKT_values['TKT_price'] = $ticket_price;
@@ -1026,25 +1026,25 @@  discard block
 block discarded – undo
1026 1026
 			//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.
1027 1027
 			//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.
1028 1028
 
1029
-			if ( !empty( $tkt['TKT_ID'] ) ) {
1030
-				$TKT = EE_Registry::instance()->load_model( 'Ticket', array( $evtobj->get_timezone() ) )->get_one_by_ID( $tkt['TKT_ID'] );
1029
+			if ( ! empty($tkt['TKT_ID'])) {
1030
+				$TKT = EE_Registry::instance()->load_model('Ticket', array($evtobj->get_timezone()))->get_one_by_ID($tkt['TKT_ID']);
1031 1031
 
1032 1032
 
1033
-				$ticket_sold = $TKT->count_related('Registration', array( array( 'STS_ID' => array( 'NOT IN', array( EEM_Registration::status_id_incomplete ) ) ) ) ) > 0 ? true : false;
1033
+				$ticket_sold = $TKT->count_related('Registration', array(array('STS_ID' => array('NOT IN', array(EEM_Registration::status_id_incomplete))))) > 0 ? true : false;
1034 1034
 
1035 1035
 				//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.
1036
-				$create_new_TKT = $ticket_sold && $ticket_price != $TKT->get('TKT_price') && !$TKT->get('TKT_deleted') ? TRUE : FALSE;
1036
+				$create_new_TKT = $ticket_sold && $ticket_price != $TKT->get('TKT_price') && ! $TKT->get('TKT_deleted') ? TRUE : FALSE;
1037 1037
 
1038
-				$TKT->set_date_format( $incoming_date_formats[0] );
1039
-				$TKT->set_time_format( $incoming_date_formats[1] );
1038
+				$TKT->set_date_format($incoming_date_formats[0]);
1039
+				$TKT->set_time_format($incoming_date_formats[1]);
1040 1040
 
1041 1041
 				//set new values
1042
-				foreach ( $TKT_values as $field => $value ) {
1043
-					$TKT->set( $field, $value );
1042
+				foreach ($TKT_values as $field => $value) {
1043
+					$TKT->set($field, $value);
1044 1044
 				}
1045 1045
 
1046 1046
 				//if $create_new_TKT is false then we can safely update the existing ticket.  Otherwise we have to create a new ticket.
1047
-				if ( $create_new_TKT ) {
1047
+				if ($create_new_TKT) {
1048 1048
 					//archive the old ticket first
1049 1049
 					$TKT->set('TKT_deleted', 1);
1050 1050
 					$TKT->save();
@@ -1055,31 +1055,31 @@  discard block
 block discarded – undo
1055 1055
 
1056 1056
 					//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.
1057 1057
 					$TKT = clone $TKT;
1058
-					$TKT->set( 'TKT_ID', 0 );
1059
-					$TKT->set( 'TKT_deleted', 0 );
1060
-					$TKT->set( 'TKT_price', $ticket_price );
1061
-					$TKT->set( 'TKT_sold', 0 );
1058
+					$TKT->set('TKT_ID', 0);
1059
+					$TKT->set('TKT_deleted', 0);
1060
+					$TKT->set('TKT_price', $ticket_price);
1061
+					$TKT->set('TKT_sold', 0);
1062 1062
 
1063 1063
 					//now we need to make sure that $new prices are created as well and attached to new ticket.
1064 1064
 					$update_prices = TRUE;
1065 1065
 				}
1066 1066
 
1067 1067
 				//make sure price is set if it hasn't been already
1068
-				$TKT->set( 'TKT_price', $ticket_price );
1068
+				$TKT->set('TKT_price', $ticket_price);
1069 1069
 
1070 1070
 			} else {
1071 1071
 				//no TKT_id so a new TKT
1072 1072
 				$TKT_values['TKT_price'] = $ticket_price;
1073
-				$TKT = EE_Registry::instance()->load_class('Ticket', array( $TKT_values ), FALSE, FALSE );
1073
+				$TKT = EE_Registry::instance()->load_class('Ticket', array($TKT_values), FALSE, FALSE);
1074 1074
 
1075 1075
 				//need to reset values to properly account for the date formats
1076
-				$TKT->set_date_format( $incoming_date_formats[0] );
1077
-				$TKT->set_time_format( $incoming_date_formats[1] );
1078
-				$TKT->set_timezone( $evtobj->get_timezone() );
1076
+				$TKT->set_date_format($incoming_date_formats[0]);
1077
+				$TKT->set_time_format($incoming_date_formats[1]);
1078
+				$TKT->set_timezone($evtobj->get_timezone());
1079 1079
 
1080 1080
 				//set new values
1081
-				foreach ( $TKT_values as $field => $value ) {
1082
-					$TKT->set( $field, $value );
1081
+				foreach ($TKT_values as $field => $value) {
1082
+					$TKT->set($field, $value);
1083 1083
 				}
1084 1084
 
1085 1085
 				$update_prices = TRUE;
@@ -1089,27 +1089,27 @@  discard block
 block discarded – undo
1089 1089
 			$TKT->save();
1090 1090
 
1091 1091
 			//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.
1092
-			if( $TKT->get_raw('TKT_start_date') > $TKT->get_raw('TKT_end_date') ) {
1093
-				$TKT->set('TKT_end_date', $TKT->get('TKT_start_date') );
1092
+			if ($TKT->get_raw('TKT_start_date') > $TKT->get_raw('TKT_end_date')) {
1093
+				$TKT->set('TKT_end_date', $TKT->get('TKT_start_date'));
1094 1094
 				EE_Registry::instance()->load_helper('DTT_Helper');
1095 1095
 				$TKT = EEH_DTT_Helper::date_time_add($TKT, 'TKT_end_date', 'days');
1096 1096
 				$TKT->save();
1097 1097
 			}
1098 1098
 
1099 1099
 			//initially let's add the ticket to the dtt
1100
-			$saved_dtt->_add_relation_to( $TKT, 'Ticket' );
1100
+			$saved_dtt->_add_relation_to($TKT, 'Ticket');
1101 1101
 
1102 1102
 			$saved_tickets[$TKT->ID()] = $TKT;
1103 1103
 
1104 1104
 			//add prices to ticket
1105
-			$this->_add_prices_to_ticket( $data['edit_prices'][$row], $TKT, $update_prices );
1105
+			$this->_add_prices_to_ticket($data['edit_prices'][$row], $TKT, $update_prices);
1106 1106
 		}
1107 1107
 		//however now we need to handle permanantly 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 permanantely because there is no need to save in db.
1108
-		$old_tickets = isset( $old_tickets[0] ) && $old_tickets[0] == '' ? array() : $old_tickets;
1109
-		$tickets_removed = array_diff( $old_tickets, array_keys( $saved_tickets ) );
1108
+		$old_tickets = isset($old_tickets[0]) && $old_tickets[0] == '' ? array() : $old_tickets;
1109
+		$tickets_removed = array_diff($old_tickets, array_keys($saved_tickets));
1110 1110
 
1111
-		foreach ( $tickets_removed as $id ) {
1112
-			$id = absint( $id );
1111
+		foreach ($tickets_removed as $id) {
1112
+			$id = absint($id);
1113 1113
 
1114 1114
 			//get the ticket for this id
1115 1115
 			$tkt_to_remove = EE_Registry::instance()->load_model('Ticket')->get_one_by_ID($id);
@@ -1117,7 +1117,7 @@  discard block
 block discarded – undo
1117 1117
 			//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)
1118 1118
 			$dtts = $tkt_to_remove->get_many_related('Datetime');
1119 1119
 
1120
-			foreach( $dtts as $dtt ) {
1120
+			foreach ($dtts as $dtt) {
1121 1121
 				$tkt_to_remove->_remove_relation_to($dtt, 'Datetime');
1122 1122
 			}
1123 1123
 
@@ -1128,7 +1128,7 @@  discard block
 block discarded – undo
1128 1128
 			//finally let's delete this ticket (which should not be blocked at this point b/c we've removed all our relationships)
1129 1129
 			$tkt_to_remove->delete_permanently();
1130 1130
 		}/**/
1131
-		return array( $saved_dtt, $saved_tickets );
1131
+		return array($saved_dtt, $saved_tickets);
1132 1132
 	}
1133 1133
 
1134 1134
 
@@ -1143,31 +1143,31 @@  discard block
 block discarded – undo
1143 1143
 	 * @param bool 		$new_prices Whether attach existing incoming prices or create new ones.
1144 1144
 	 * @return  void
1145 1145
 	 */
1146
-	private function  _add_prices_to_ticket( $prices, EE_Ticket $ticket, $new_prices = FALSE ) {
1147
-		foreach ( $prices as $row => $prc ) {
1146
+	private function  _add_prices_to_ticket($prices, EE_Ticket $ticket, $new_prices = FALSE) {
1147
+		foreach ($prices as $row => $prc) {
1148 1148
 			$PRC_values = array(
1149
-				'PRC_ID' => !empty( $prc['PRC_ID'] ) ? $prc['PRC_ID'] : NULL,
1150
-				'PRT_ID' => !empty( $prc['PRT_ID'] ) ? $prc['PRT_ID'] : NULL,
1151
-				'PRC_amount' => !empty( $prc['PRC_amount'] ) ? $prc['PRC_amount'] : 0,
1152
-				'PRC_name' => !empty( $prc['PRC_name'] ) ? $prc['PRC_name'] : '',
1153
-				'PRC_desc' => !empty( $prc['PRC_desc'] ) ? $prc['PRC_desc'] : '',
1149
+				'PRC_ID' => ! empty($prc['PRC_ID']) ? $prc['PRC_ID'] : NULL,
1150
+				'PRT_ID' => ! empty($prc['PRT_ID']) ? $prc['PRT_ID'] : NULL,
1151
+				'PRC_amount' => ! empty($prc['PRC_amount']) ? $prc['PRC_amount'] : 0,
1152
+				'PRC_name' => ! empty($prc['PRC_name']) ? $prc['PRC_name'] : '',
1153
+				'PRC_desc' => ! empty($prc['PRC_desc']) ? $prc['PRC_desc'] : '',
1154 1154
 				'PRC_is_default' => 0, //make sure prices are NOT set as default from this context
1155 1155
 				'PRC_order' => $row
1156 1156
 				);
1157 1157
 
1158
-			if ( $new_prices || empty( $PRC_values['PRC_ID'] ) ) {
1158
+			if ($new_prices || empty($PRC_values['PRC_ID'])) {
1159 1159
 				$PRC_values['PRC_ID'] = 0;
1160
-				$PRC = EE_Registry::instance()->load_class('Price', array( $PRC_values ), FALSE, FALSE);
1160
+				$PRC = EE_Registry::instance()->load_class('Price', array($PRC_values), FALSE, FALSE);
1161 1161
 			} else {
1162
-				$PRC = EE_Registry::instance()->load_model( 'Price' )->get_one_by_ID( $prc['PRC_ID'] );
1162
+				$PRC = EE_Registry::instance()->load_model('Price')->get_one_by_ID($prc['PRC_ID']);
1163 1163
 				//update this price with new values
1164
-				foreach ( $PRC_values as $field => $newprc ) {
1165
-					$PRC->set( $field, $newprc );
1164
+				foreach ($PRC_values as $field => $newprc) {
1165
+					$PRC->set($field, $newprc);
1166 1166
 				}
1167 1167
 				$PRC->save();
1168 1168
 			}
1169 1169
 
1170
-			$PRC = $ticket->_add_relation_to( $PRC, 'Price' );
1170
+			$PRC = $ticket->_add_relation_to($PRC, 'Price');
1171 1171
 		}
1172 1172
 	}
1173 1173
 
@@ -1190,33 +1190,33 @@  discard block
 block discarded – undo
1190 1190
 
1191 1191
 		return; //TEMPORARILY EXITING CAUSE THIS IS A TODO
1192 1192
 
1193
-		$postid = isset( $this->_req_data['post_ID'] ) ? $this->_req_data['post_ID'] : NULL;
1193
+		$postid = isset($this->_req_data['post_ID']) ? $this->_req_data['post_ID'] : NULL;
1194 1194
 
1195 1195
 
1196 1196
 		//if no postid then get out cause we need it for stuff in here
1197
-		if ( empty( $postid ) ) return;
1197
+		if (empty($postid)) return;
1198 1198
 
1199 1199
 
1200 1200
 		//handle datetime saves
1201 1201
 		$items = array();
1202 1202
 
1203
-		$get_one_where = array( $this->_event_model()->primary_key_name() => $postid );
1204
-		$event = $this->_event_model()->get_one( array($get_one_where) );
1203
+		$get_one_where = array($this->_event_model()->primary_key_name() => $postid);
1204
+		$event = $this->_event_model()->get_one(array($get_one_where));
1205 1205
 
1206 1206
 		//now let's get the attached datetimes from the most recent autosave
1207 1207
 		$dtts = $event->get_many_related('Datetime');
1208 1208
 
1209 1209
 		$dtt_ids = array();
1210
-		foreach( $dtts as $dtt ) {
1210
+		foreach ($dtts as $dtt) {
1211 1211
 			$dtt_ids[] = $dtt->ID();
1212 1212
 			$order = $dtt->order();
1213 1213
 			$this->_template_args['data']['items']['ID-'.$order] = $dtt->ID();
1214 1214
 		}
1215
-		$this->_template_args['data']['items']['datetime_IDS'] = serialize( $dtt_ids );
1215
+		$this->_template_args['data']['items']['datetime_IDS'] = serialize($dtt_ids);
1216 1216
 
1217 1217
 		//handle DECAF venues
1218 1218
 		//we need to make sure that the venue_id gets updated in the form so that future autosaves will properly conntect that venue to the event.
1219
-		if ( $do_venue_autosaves = apply_filters( 'FHEE__Events_Admin_Page__ee_autosave_edit_do_decaf_venue_save', TRUE ) ) {
1219
+		if ($do_venue_autosaves = apply_filters('FHEE__Events_Admin_Page__ee_autosave_edit_do_decaf_venue_save', TRUE)) {
1220 1220
 			$venue = $event->get_first_related('Venue');
1221 1221
 			$this->_template_args['data']['items']['venue-id'] = $venue->ID();
1222 1222
 		}
@@ -1227,23 +1227,23 @@  discard block
 block discarded – undo
1227 1227
 
1228 1228
 		$ticket_ids = array();
1229 1229
 		$price_ids = array();
1230
-		foreach ( $tickets as $ticket ) {
1230
+		foreach ($tickets as $ticket) {
1231 1231
 			$ticket_ids[] = $price->ID();
1232 1232
 			$ticket_order = $price->get('TKT_order');
1233
-			$this->_template_args['data']['items']['edit-ticket-id-' . $ticket_order] = $ticket->ID();
1234
-			$this->_template_args['data']['items']['edit-ticket-event-id-' . $order] = $event->ID();
1233
+			$this->_template_args['data']['items']['edit-ticket-id-'.$ticket_order] = $ticket->ID();
1234
+			$this->_template_args['data']['items']['edit-ticket-event-id-'.$order] = $event->ID();
1235 1235
 
1236 1236
 			//now we have to make sure the prices are updated appropriately
1237 1237
 			$prices = $ticket->get_many_related('Prices');
1238 1238
 
1239
-			foreach ( $prices as $price ) {
1239
+			foreach ($prices as $price) {
1240 1240
 				$price_ids[] = $price->ID();
1241 1241
 				$price_order = $price->get('PRC_order');
1242
-				$this->_template_args['data']['items']['quick-edit-ticket-price-id-ticketrow-' . $ticket_order . '-' . $price_order] = $price->ID();
1243
-				$this->_template_args['data']['items']['edit-ticket-price-id-ticketrow-' . $ticket_row . '-' . $price_row] = $price->ID();
1244
-				$this->_template_args['data']['items']['edit-ticket-price-is-default-ticketrow-' . $ticket_row . '-' . $price_row] = $price->get('PRC_is_default');
1242
+				$this->_template_args['data']['items']['quick-edit-ticket-price-id-ticketrow-'.$ticket_order.'-'.$price_order] = $price->ID();
1243
+				$this->_template_args['data']['items']['edit-ticket-price-id-ticketrow-'.$ticket_row.'-'.$price_row] = $price->ID();
1244
+				$this->_template_args['data']['items']['edit-ticket-price-is-default-ticketrow-'.$ticket_row.'-'.$price_row] = $price->get('PRC_is_default');
1245 1245
 			}
1246
-			$this->_template_args['data']['items']['price-IDs-ticketrow-' . $ticket_row] = implode(',', $price_ids);
1246
+			$this->_template_args['data']['items']['price-IDs-ticketrow-'.$ticket_row] = implode(',', $price_ids);
1247 1247
 		}
1248 1248
 		$this->_template_args['data']['items']['ticket-IDs'] = implode(',', $ticket_ids);
1249 1249
 	}
@@ -1261,26 +1261,26 @@  discard block
 block discarded – undo
1261 1261
 	private function _generate_publish_box_extra_content() {
1262 1262
 
1263 1263
 		//load formatter helper
1264
-  		EE_Registry::instance()->load_helper( 'Formatter' );
1264
+  		EE_Registry::instance()->load_helper('Formatter');
1265 1265
 
1266 1266
   		//args for getting related registrations
1267
-  		$approved_query_args = array( array( 'REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_approved ) );
1268
-  		$not_approved_query_args = array( array( 'REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_not_approved ) );
1269
-  		$pending_payment_query_args = array( array( 'REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_pending_payment ) );
1267
+  		$approved_query_args = array(array('REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_approved));
1268
+  		$not_approved_query_args = array(array('REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_not_approved));
1269
+  		$pending_payment_query_args = array(array('REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_pending_payment));
1270 1270
 
1271 1271
 
1272 1272
 		// publish box
1273
-		$publish_box_extra_args['view_approved_reg_url'] = add_query_arg(array('action' => 'default', 'event_id' => $this->_cpt_model_obj->ID(), '_reg_status' => EEM_Registration::status_id_approved ), REG_ADMIN_URL);
1274
-		$publish_box_extra_args['view_not_approved_reg_url'] = add_query_arg(array('action' => 'default', 'event_id' => $this->_cpt_model_obj->ID(), '_reg_status' => EEM_Registration::status_id_not_approved ), REG_ADMIN_URL);
1275
-		$publish_box_extra_args['view_pending_payment_reg_url'] = add_query_arg(array('action' => 'default', 'event_id' => $this->_cpt_model_obj->ID(), '_reg_status' => EEM_Registration::status_id_pending_payment ), REG_ADMIN_URL);
1273
+		$publish_box_extra_args['view_approved_reg_url'] = add_query_arg(array('action' => 'default', 'event_id' => $this->_cpt_model_obj->ID(), '_reg_status' => EEM_Registration::status_id_approved), REG_ADMIN_URL);
1274
+		$publish_box_extra_args['view_not_approved_reg_url'] = add_query_arg(array('action' => 'default', 'event_id' => $this->_cpt_model_obj->ID(), '_reg_status' => EEM_Registration::status_id_not_approved), REG_ADMIN_URL);
1275
+		$publish_box_extra_args['view_pending_payment_reg_url'] = add_query_arg(array('action' => 'default', 'event_id' => $this->_cpt_model_obj->ID(), '_reg_status' => EEM_Registration::status_id_pending_payment), REG_ADMIN_URL);
1276 1276
 		$publish_box_extra_args['approved_regs'] = $this->_cpt_model_obj->count_related('Registration', $approved_query_args);
1277 1277
 		$publish_box_extra_args['not_approved_regs'] = $this->_cpt_model_obj->count_related('Registration', $not_approved_query_args);
1278 1278
 		$publish_box_extra_args['pending_payment_regs'] = $this->_cpt_model_obj->count_related('Registration', $pending_payment_query_args);
1279
-		$publish_box_extra_args['misc_pub_section_class'] = apply_filters( 'FHEE_Events_Admin_Page___generate_publish_box_extra_content__misc_pub_section_class', 'misc-pub-section');
1279
+		$publish_box_extra_args['misc_pub_section_class'] = apply_filters('FHEE_Events_Admin_Page___generate_publish_box_extra_content__misc_pub_section_class', 'misc-pub-section');
1280 1280
 		//$publish_box_extra_args['email_attendees_url'] = add_query_arg(array('event_admin_reports' => 'event_newsletter', 'event_id' => $this->_cpt_model_obj->id), 'admin.php?page=espresso_registrations');
1281
-		$publish_box_extra_args['event_editor_overview_add'] = do_action( 'AHEE__Events_Admin_Page___generate_publish_box_extra_content__event_editor_overview_add', $this->_cpt_model_obj );
1281
+		$publish_box_extra_args['event_editor_overview_add'] = do_action('AHEE__Events_Admin_Page___generate_publish_box_extra_content__event_editor_overview_add', $this->_cpt_model_obj);
1282 1282
 		// load template
1283
-		EEH_Template::display_template( EVENTS_TEMPLATE_PATH . 'event_publish_box_extras.template.php', $publish_box_extra_args );
1283
+		EEH_Template::display_template(EVENTS_TEMPLATE_PATH.'event_publish_box_extras.template.php', $publish_box_extra_args);
1284 1284
 	}
1285 1285
 
1286 1286
 
@@ -1312,7 +1312,7 @@  discard block
 block discarded – undo
1312 1312
 		$this->verify_cpt_object();
1313 1313
 		add_meta_box('espresso_event_editor_tickets', __('Event Datetime & Ticket', 'event_espresso'), array($this, 'ticket_metabox'), $this->page_slug, 'normal', 'high');
1314 1314
 		add_meta_box('espresso_event_editor_event_options', __('Event Registration Options', 'event_espresso'), array($this, 'registration_options_meta_box'), $this->page_slug, 'side', 'default');
1315
-		add_meta_box('espresso_event_editor_venue', __('Venue Details', 'event_espresso'), array( $this, 'venue_metabox' ), $this->page_slug, 'normal', 'core');
1315
+		add_meta_box('espresso_event_editor_venue', __('Venue Details', 'event_espresso'), array($this, 'venue_metabox'), $this->page_slug, 'normal', 'core');
1316 1316
 		//note if you're looking for other metaboxes in here, where a metabox has a related management page in the admin you will find it setup in the related management page's "_Hooks" file.  i.e. messages metabox is found in "espresso_events_Messages_Hooks.class.php".
1317 1317
 	}
1318 1318
 
@@ -1337,53 +1337,53 @@  discard block
 block discarded – undo
1337 1337
 			'disabled' => ''
1338 1338
 			);
1339 1339
 
1340
-		$event_id = is_object( $this->_cpt_model_obj ) ? $this->_cpt_model_obj->ID() : NULL;
1340
+		$event_id = is_object($this->_cpt_model_obj) ? $this->_cpt_model_obj->ID() : NULL;
1341 1341
 
1342
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
1342
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1343 1343
 
1344 1344
 		/**
1345 1345
 		 * 1. Start with retrieving Datetimes
1346 1346
 		 * 2. Fore each datetime get related tickets
1347 1347
 		 * 3. For each ticket get related prices
1348 1348
 		 */
1349
-		$times = EE_Registry::instance()->load_model('Datetime' )->get_all_event_dates( $event_id );
1350
-		EE_Registry::instance()->load_helper('DTT_Helper' );
1349
+		$times = EE_Registry::instance()->load_model('Datetime')->get_all_event_dates($event_id);
1350
+		EE_Registry::instance()->load_helper('DTT_Helper');
1351 1351
 
1352 1352
 		$firstdtt = array_slice($times, 0, 1);
1353 1353
 		//do we get related tickets?
1354
-		if ( $firstdtt[0]->get('DTT_ID') !== 0 ) {
1355
-			foreach ( $times as $time ) {
1354
+		if ($firstdtt[0]->get('DTT_ID') !== 0) {
1355
+			foreach ($times as $time) {
1356 1356
 				$existing_datetime_ids[] = $time->get('DTT_ID');
1357 1357
 				$template_args['time'] = $time;
1358
-				$related_tickets = $time->get_many_related('Ticket', array( array( 'OR' => array( 'TKT_deleted' => 1, 'TKT_deleted*' => 0 ) ), 'default_where_conditions' => 'none' ) );
1358
+				$related_tickets = $time->get_many_related('Ticket', array(array('OR' => array('TKT_deleted' => 1, 'TKT_deleted*' => 0)), 'default_where_conditions' => 'none'));
1359 1359
 
1360
-				if ( !empty($related_tickets) ) {
1360
+				if ( ! empty($related_tickets)) {
1361 1361
 					$template_args['total_ticket_rows'] = count($related_tickets);
1362 1362
 					$row = 0;
1363
-					foreach ( $related_tickets as $ticket ) {
1363
+					foreach ($related_tickets as $ticket) {
1364 1364
 						$existing_ticket_ids[] = $ticket->get('TKT_ID');
1365
-						$template_args['ticket_rows'] .= $this->_get_ticket_row($ticket, FALSE, $row );
1365
+						$template_args['ticket_rows'] .= $this->_get_ticket_row($ticket, FALSE, $row);
1366 1366
 
1367 1367
 						$row++;
1368 1368
 					}
1369 1369
 				} else {
1370 1370
 					$template_args['total_ticket_rows'] = 1;
1371 1371
 					$ticket = EE_Registry::instance()->load_model('Ticket')->create_default_object();
1372
-					$template_args['ticket_rows'] .= $this->_get_ticket_row( $ticket );
1372
+					$template_args['ticket_rows'] .= $this->_get_ticket_row($ticket);
1373 1373
 				}
1374 1374
 			}
1375 1375
 		} else {
1376 1376
 			$template_args['time'] = $times[0];
1377 1377
 			$ticket = EE_Registry::instance()->load_model('Ticket')->get_all_default_tickets();
1378
-			$template_args['ticket_rows'] .= $this->_get_ticket_row( $ticket[1] ); //note we're just sending the first default row (decaf can't manage default tickets so this should be sufficent);
1378
+			$template_args['ticket_rows'] .= $this->_get_ticket_row($ticket[1]); //note we're just sending the first default row (decaf can't manage default tickets so this should be sufficent);
1379 1379
 		}
1380 1380
 
1381 1381
 		$template_args['event_datetime_help_link'] = $this->_get_help_tab_link('event_editor_event_datetimes_help_tab');
1382 1382
 		$template_args['ticket_options_help_link'] = $this->_get_help_tab_link('ticket_options_info');
1383 1383
 		$template_args['existing_datetime_ids'] = implode(',', $existing_datetime_ids);
1384 1384
 		$template_args['existing_ticket_ids'] = implode(',', $existing_ticket_ids);
1385
-		$template_args['ticket_js_structure'] = $this->_get_ticket_row( EE_Registry::instance()->load_model('Ticket')->create_default_object(), TRUE );
1386
-		$template = apply_filters( 'FHEE__Events_Admin_Page__ticket_metabox__template', EVENTS_TEMPLATE_PATH . 'event_tickets_metabox_main.template.php' );
1385
+		$template_args['ticket_js_structure'] = $this->_get_ticket_row(EE_Registry::instance()->load_model('Ticket')->create_default_object(), TRUE);
1386
+		$template = apply_filters('FHEE__Events_Admin_Page__ticket_metabox__template', EVENTS_TEMPLATE_PATH.'event_tickets_metabox_main.template.php');
1387 1387
 		EEH_Template::display_template($template, $template_args);
1388 1388
 	}
1389 1389
 
@@ -1397,21 +1397,21 @@  discard block
 block discarded – undo
1397 1397
 	 * @param  boolean    $skeleton whether we're generating a skeleton for js manipulation
1398 1398
 	 * @return string               generated html for the ticket row.
1399 1399
 	 */
1400
-	private function _get_ticket_row( $ticket, $skeleton = FALSE, $row = 0 ) {
1400
+	private function _get_ticket_row($ticket, $skeleton = FALSE, $row = 0) {
1401 1401
 		$template_args = array(
1402
-			'tkt_status_class' => ' tkt-status-' . $ticket->ticket_status(),
1403
-			'tkt_archive_class' => $ticket->ticket_status() === EE_Ticket::archived && !$skeleton ? ' tkt-archived' : '',
1402
+			'tkt_status_class' => ' tkt-status-'.$ticket->ticket_status(),
1403
+			'tkt_archive_class' => $ticket->ticket_status() === EE_Ticket::archived && ! $skeleton ? ' tkt-archived' : '',
1404 1404
 			'ticketrow' => $skeleton ? 'TICKETNUM' : $row,
1405 1405
 			'TKT_ID' => $ticket->get('TKT_ID'),
1406 1406
 			'TKT_name' => $ticket->get('TKT_name'),
1407 1407
 			'TKT_start_date' => $skeleton ? '' : $ticket->get_date('TKT_start_date', 'Y-m-d h:i a'),
1408 1408
 			'TKT_end_date' => $skeleton ? '' : $ticket->get_date('TKT_end_date', 'Y-m-d h:i a'),
1409 1409
 			'TKT_is_default' => $ticket->get('TKT_is_default'),
1410
-			'TKT_qty' => $ticket->get_pretty('TKT_qty','input'),
1410
+			'TKT_qty' => $ticket->get_pretty('TKT_qty', 'input'),
1411 1411
 			'edit_ticketrow_name' => $skeleton ? 'TICKETNAMEATTR' : 'edit_tickets',
1412 1412
 			'TKT_sold' => $skeleton ? 0 : $ticket->get('TKT_sold'),
1413
-			'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',
1414
-			'disabled' => $skeleton || ( !empty( $ticket ) && ! $ticket->get('TKT_deleted' ) ) ? '' : ' disabled=disabled'
1413
+			'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',
1414
+			'disabled' => $skeleton || ( ! empty($ticket) && ! $ticket->get('TKT_deleted')) ? '' : ' disabled=disabled'
1415 1415
 			);
1416 1416
 
1417 1417
 		$price = $ticket->ID() !== 0 ? $ticket->get_first_related('Price', array('default_where_conditions' => 'none')) : EE_Registry::instance()->load_model('Price')->create_default_object();
@@ -1427,23 +1427,23 @@  discard block
 block discarded – undo
1427 1427
 
1428 1428
 		//make sure we have default start and end dates if skeleton
1429 1429
 		//handle rows that should NOT be empty
1430
-		if ( empty( $template_args['TKT_start_date'] ) ) {
1430
+		if (empty($template_args['TKT_start_date'])) {
1431 1431
 			//if empty then the start date will be now.
1432 1432
 			$template_args['TKT_start_date'] = date('Y-m-d h:i a', current_time('timestamp'));
1433 1433
 		}
1434 1434
 
1435
-		if ( empty( $template_args['TKT_end_date'] ) ) {
1435
+		if (empty($template_args['TKT_end_date'])) {
1436 1436
 			//get the earliest datetime (if present);
1437
-			$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;
1437
+			$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;
1438 1438
 
1439
-			if ( !empty( $earliest_dtt ) )
1439
+			if ( ! empty($earliest_dtt))
1440 1440
 				$template_args['TKT_end_date'] = $earliest_dtt->get_datetime('DTT_EVT_start', 'Y-m-d', 'h:i a');
1441 1441
 			else
1442
-				$template_args['TKT_end_date'] = date('Y-m-d h:i a', mktime(0, 0, 0, date("m"), date("d")+7, date("Y") ) );
1442
+				$template_args['TKT_end_date'] = date('Y-m-d h:i a', mktime(0, 0, 0, date("m"), date("d") + 7, date("Y")));
1443 1443
 		}
1444 1444
 
1445
-		$template_args = array_merge( $template_args, $price_args );
1446
-		$template = apply_filters( 'FHEE__Events_Admin_Page__get_ticket_row__template', EVENTS_TEMPLATE_PATH . 'event_tickets_metabox_ticket_row.template.php', $ticket);
1445
+		$template_args = array_merge($template_args, $price_args);
1446
+		$template = apply_filters('FHEE__Events_Admin_Page__get_ticket_row__template', EVENTS_TEMPLATE_PATH.'event_tickets_metabox_ticket_row.template.php', $ticket);
1447 1447
 		return EEH_Template::display_template($template, $template_args, TRUE);
1448 1448
 	}
1449 1449
 
@@ -1456,7 +1456,7 @@  discard block
 block discarded – undo
1456 1456
 			array('id' => false, 'text' => __('No', 'event_espresso'))
1457 1457
 		);
1458 1458
 
1459
-		$default_reg_status_values = EEM_Registration::reg_status_array(array(EEM_Registration::status_id_cancelled, EEM_Registration::status_id_declined, EEM_Registration::status_id_incomplete ), TRUE);
1459
+		$default_reg_status_values = EEM_Registration::reg_status_array(array(EEM_Registration::status_id_cancelled, EEM_Registration::status_id_declined, EEM_Registration::status_id_incomplete), TRUE);
1460 1460
 
1461 1461
 		//$template_args['is_active_select'] = EEH_Form_Fields::select_input('is_active', $yes_no_values, $this->_cpt_model_obj->is_active());
1462 1462
 		$template_args['_event'] = $this->_cpt_model_obj;
@@ -1465,8 +1465,8 @@  discard block
 block discarded – undo
1465 1465
 		$template_args['default_registration_status'] = EEH_Form_Fields::select_input('default_reg_status', $default_reg_status_values, $this->_cpt_model_obj->default_registration_status());
1466 1466
 		$template_args['display_description'] = EEH_Form_Fields::select_input('display_desc', $yes_no_values, $this->_cpt_model_obj->display_description());
1467 1467
 		$template_args['display_ticket_selector'] = EEH_Form_Fields::select_input('display_ticket_selector', $yes_no_values, $this->_cpt_model_obj->display_ticket_selector(), '', '', false);
1468
-		$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 );
1469
-		$templatepath = EVENTS_TEMPLATE_PATH . 'event_registration_options.template.php';
1468
+		$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);
1469
+		$templatepath = EVENTS_TEMPLATE_PATH.'event_registration_options.template.php';
1470 1470
 		EEH_Template::display_template($templatepath, $template_args);
1471 1471
 	}
1472 1472
 
@@ -1480,14 +1480,14 @@  discard block
 block discarded – undo
1480 1480
 
1481 1481
 		//first let's see if we have a venue already
1482 1482
 		$event_id = $this->_cpt_model_obj->ID();
1483
-		$venue = !empty( $event_id ) ? $this->_cpt_model_obj->venues() : NULL;
1484
-		$venue = empty( $venue ) ? EE_Registry::instance()->load_model('Venue')->create_default_object() : array_shift( $venue );
1483
+		$venue = ! empty($event_id) ? $this->_cpt_model_obj->venues() : NULL;
1484
+		$venue = empty($venue) ? EE_Registry::instance()->load_model('Venue')->create_default_object() : array_shift($venue);
1485 1485
 		$template_args['_venue'] = $venue;
1486 1486
 
1487 1487
 		$template_args['states_dropdown'] = EEH_Form_Fields::generate_form_input(
1488 1488
 			$QFI = new EE_Question_Form_Input(
1489
-				EE_Question::new_instance( array( 'QST_display_text' => 'State', 'QST_system' => 'state' )),
1490
-				EE_Answer::new_instance( array(  'ANS_value'=> $venue->state_ID() )),
1489
+				EE_Question::new_instance(array('QST_display_text' => 'State', 'QST_system' => 'state')),
1490
+				EE_Answer::new_instance(array('ANS_value'=> $venue->state_ID())),
1491 1491
 				array(
1492 1492
 					'input_name' =>  'state',
1493 1493
 					'input_id' => 'phys-state',
@@ -1499,8 +1499,8 @@  discard block
 block discarded – undo
1499 1499
 		);
1500 1500
 		$template_args['countries_dropdown'] = EEH_Form_Fields::generate_form_input(
1501 1501
 			$QFI = new EE_Question_Form_Input(
1502
-				EE_Question::new_instance( array( 'QST_display_text' => 'Country', 'QST_system' => 'country' )),
1503
-				EE_Answer::new_instance( array(  'ANS_value'=> $venue->country_ID() )),
1502
+				EE_Question::new_instance(array('QST_display_text' => 'Country', 'QST_system' => 'country')),
1503
+				EE_Answer::new_instance(array('ANS_value'=> $venue->country_ID())),
1504 1504
 				array(
1505 1505
 					'input_name' =>  'countries',
1506 1506
 					'input_id' => 'phys-country',
@@ -1511,8 +1511,8 @@  discard block
 block discarded – undo
1511 1511
 			)
1512 1512
 		);
1513 1513
 
1514
-		$template_path = EVENTS_TEMPLATE_PATH . 'event_venues_metabox_content.template.php';
1515
-		EEH_Template::display_template( $template_path, $template_args );
1514
+		$template_path = EVENTS_TEMPLATE_PATH.'event_venues_metabox_content.template.php';
1515
+		EEH_Template::display_template($template_path, $template_args);
1516 1516
 	}
1517 1517
 
1518 1518
 
@@ -1539,21 +1539,21 @@  discard block
 block discarded – undo
1539 1539
 		$EEME = $this->_event_model();
1540 1540
 
1541 1541
 		$offset = ($current_page - 1) * $per_page;
1542
-		$limit = $count ? NULL : $offset . ',' . $per_page;
1542
+		$limit = $count ? NULL : $offset.','.$per_page;
1543 1543
 		$orderby = isset($this->_req_data['orderby']) ? $this->_req_data['orderby'] : 'EVT_ID';
1544 1544
 		$order = isset($this->_req_data['order']) ? $this->_req_data['order'] : "DESC";
1545 1545
 
1546 1546
 		if (isset($this->_req_data['month_range'])) {
1547 1547
 			$pieces = explode(' ', $this->_req_data['month_range'], 3);
1548
-			$month_r = !empty($pieces[0]) ? date('m', strtotime($pieces[0])) : '';
1549
-			$year_r = !empty($pieces[1]) ? $pieces[1] : '';
1548
+			$month_r = ! empty($pieces[0]) ? date('m', strtotime($pieces[0])) : '';
1549
+			$year_r = ! empty($pieces[1]) ? $pieces[1] : '';
1550 1550
 		}
1551 1551
 
1552 1552
 		$where = array();
1553 1553
 
1554
-		$status = isset( $this->_req_data['status'] ) ? $this->_req_data['status'] : NULL;
1554
+		$status = isset($this->_req_data['status']) ? $this->_req_data['status'] : NULL;
1555 1555
 		//determine what post_status our condition will have for the query.
1556
-		switch ( $status ) {
1556
+		switch ($status) {
1557 1557
 			case 'month' :
1558 1558
 			case 'today' :
1559 1559
 			case NULL :
@@ -1561,7 +1561,7 @@  discard block
 block discarded – undo
1561 1561
 				break;
1562 1562
 
1563 1563
 			case 'draft' :
1564
-				$where['status'] = array( 'IN', array('draft', 'auto-draft') );
1564
+				$where['status'] = array('IN', array('draft', 'auto-draft'));
1565 1565
 				break;
1566 1566
 
1567 1567
 			default :
@@ -1569,43 +1569,43 @@  discard block
 block discarded – undo
1569 1569
 		}
1570 1570
 
1571 1571
 		//categories?
1572
-		$category = isset( $this->_req_data['EVT_CAT'] ) && $this->_req_data['EVT_CAT'] > 0 ? $this->_req_data['EVT_CAT'] : NULL;
1572
+		$category = isset($this->_req_data['EVT_CAT']) && $this->_req_data['EVT_CAT'] > 0 ? $this->_req_data['EVT_CAT'] : NULL;
1573 1573
 
1574
-		if ( !empty ( $category ) ) {
1574
+		if ( ! empty ($category)) {
1575 1575
 			$where['Term_Taxonomy.taxonomy'] = 'espresso_event_categories';
1576 1576
 			$where['Term_Taxonomy.term_id'] = $category;
1577 1577
 		}
1578 1578
 
1579 1579
 		//date where conditions
1580
-		$start_formats = EEM_Datetime::instance()->get_formats_for( 'DTT_EVT_start' );
1580
+		$start_formats = EEM_Datetime::instance()->get_formats_for('DTT_EVT_start');
1581 1581
 		if (isset($this->_req_data['month_range']) && $this->_req_data['month_range'] != '') {
1582
-			$DateTime = new DateTime( $year_r . '-' . $month_r . '-01 00:00:00', new DateTimeZone( EEM_Datetime::instance()->get_timezone() ) );
1583
-			$start = $DateTime->format( implode( ' ', $start_formats  ) );
1584
-			$end = $DateTime->setDate( $year_r, $month_r, $DateTime->format('t') )->setTime(23,59,59)->format( implode( ' ', $start_formats ) );
1585
-			$where['Datetime.DTT_EVT_start'] = array('BETWEEN', array( $start, $end ) );
1582
+			$DateTime = new DateTime($year_r.'-'.$month_r.'-01 00:00:00', new DateTimeZone(EEM_Datetime::instance()->get_timezone()));
1583
+			$start = $DateTime->format(implode(' ', $start_formats));
1584
+			$end = $DateTime->setDate($year_r, $month_r, $DateTime->format('t'))->setTime(23, 59, 59)->format(implode(' ', $start_formats));
1585
+			$where['Datetime.DTT_EVT_start'] = array('BETWEEN', array($start, $end));
1586 1586
 		} else if (isset($this->_req_data['status']) && $this->_req_data['status'] == 'today') {
1587
-			$DateTime = new DateTime( 'now', new DateTimeZone( EEM_Event::instance()->get_timezone() ) );
1588
-			$start = $DateTime->setTime( 0,0,0 )->format( implode( ' ', $start_formats ) );
1589
-			$end = $DateTime->setTime( 23, 59, 59 )->format( implode( ' ', $start_formats ) );
1590
-			$where['Datetime.DTT_EVT_start'] = array( 'BETWEEN', array( $start, $end ) );
1591
-		} else if ( isset($this->_req_data['status']) && $this->_req_data['status'] == 'month' ) {
1592
-			$now = date( 'Y-m-01' );
1593
-			$DateTime = new DateTime( $now, new DateTimeZone( EEM_Event::instance()->get_timezone() ) );
1594
-			$start = $DateTime->setTime( 0, 0, 0 )->format( implode( ' ', $start_formats ) );
1595
-			$end = $DateTime->setDate( date('Y'), date('m'), $DateTime->format('t' ) )->setTime( 23, 59, 59 )->format( implode( ' ', $start_formats ) );
1596
-			$where['Datetime.DTT_EVT_start'] = array( 'BETWEEN', array( $start, $end ) );
1587
+			$DateTime = new DateTime('now', new DateTimeZone(EEM_Event::instance()->get_timezone()));
1588
+			$start = $DateTime->setTime(0, 0, 0)->format(implode(' ', $start_formats));
1589
+			$end = $DateTime->setTime(23, 59, 59)->format(implode(' ', $start_formats));
1590
+			$where['Datetime.DTT_EVT_start'] = array('BETWEEN', array($start, $end));
1591
+		} else if (isset($this->_req_data['status']) && $this->_req_data['status'] == 'month') {
1592
+			$now = date('Y-m-01');
1593
+			$DateTime = new DateTime($now, new DateTimeZone(EEM_Event::instance()->get_timezone()));
1594
+			$start = $DateTime->setTime(0, 0, 0)->format(implode(' ', $start_formats));
1595
+			$end = $DateTime->setDate(date('Y'), date('m'), $DateTime->format('t'))->setTime(23, 59, 59)->format(implode(' ', $start_formats));
1596
+			$where['Datetime.DTT_EVT_start'] = array('BETWEEN', array($start, $end));
1597 1597
 		}
1598 1598
 
1599 1599
 
1600
-		if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_events', 'get_events' ) ) {
1601
-			$where['EVT_wp_user'] =  get_current_user_id();
1600
+		if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_events', 'get_events')) {
1601
+			$where['EVT_wp_user'] = get_current_user_id();
1602 1602
 		} else {
1603
-			if ( ! isset( $where['status'] ) ) {
1604
-				if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_private_events', 'get_events' ) ) {
1603
+			if ( ! isset($where['status'])) {
1604
+				if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_private_events', 'get_events')) {
1605 1605
 					$where['OR'] = array(
1606
-						'status*restrict_private' => array( '!=', 'private' ),
1606
+						'status*restrict_private' => array('!=', 'private'),
1607 1607
 						'AND' => array(
1608
-							'status*inclusive' => array( '=', 'private' ),
1608
+							'status*inclusive' => array('=', 'private'),
1609 1609
 							'EVT_wp_user' => get_current_user_id()
1610 1610
 						)
1611 1611
 					);
@@ -1613,16 +1613,16 @@  discard block
 block discarded – undo
1613 1613
 			}
1614 1614
 		}
1615 1615
 
1616
-		if ( isset( $this->_req_data['EVT_wp_user'] ) ) {
1617
-			if ( $this->_req_data['EVT_wp_user'] != get_current_user_id() && EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_events', 'get_events' ) ) {
1616
+		if (isset($this->_req_data['EVT_wp_user'])) {
1617
+			if ($this->_req_data['EVT_wp_user'] != get_current_user_id() && EE_Registry::instance()->CAP->current_user_can('ee_read_others_events', 'get_events')) {
1618 1618
 				$where['EVT_wp_user'] = $this->_req_data['EVT_wp_user'];
1619 1619
 			}
1620 1620
 		}
1621 1621
 
1622 1622
 
1623 1623
 		//search query handling
1624
-		if ( isset( $this->_req_data['s'] ) ) {
1625
-			$search_string = '%' . $this->_req_data['s'] . '%';
1624
+		if (isset($this->_req_data['s'])) {
1625
+			$search_string = '%'.$this->_req_data['s'].'%';
1626 1626
 			$where['OR'] = array(
1627 1627
 				'EVT_name' => array('LIKE', $search_string),
1628 1628
 				'EVT_desc' => array('LIKE', $search_string),
@@ -1631,32 +1631,32 @@  discard block
 block discarded – undo
1631 1631
 		}
1632 1632
 
1633 1633
 
1634
-		$where = apply_filters( 'FHEE__Events_Admin_Page__get_events__where', $where, $this->_req_data );
1635
-		$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 );
1634
+		$where = apply_filters('FHEE__Events_Admin_Page__get_events__where', $where, $this->_req_data);
1635
+		$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);
1636 1636
 
1637 1637
 
1638 1638
 		//let's first check if we have special requests coming in.
1639
-		if ( isset( $this->_req_data['active_status'] ) ) {
1640
-			switch ( $this->_req_data['active_status'] ) {
1639
+		if (isset($this->_req_data['active_status'])) {
1640
+			switch ($this->_req_data['active_status']) {
1641 1641
 				case 'upcoming' :
1642
-					return $EEME->get_upcoming_events( $query_params, $count );
1642
+					return $EEME->get_upcoming_events($query_params, $count);
1643 1643
 					break;
1644 1644
 
1645 1645
 				case 'expired' :
1646
-					return $EEME->get_expired_events( $query_params, $count );
1646
+					return $EEME->get_expired_events($query_params, $count);
1647 1647
 					break;
1648 1648
 
1649 1649
 				case 'active' :
1650
-					return $EEME->get_active_events( $query_params, $count );
1650
+					return $EEME->get_active_events($query_params, $count);
1651 1651
 					break;
1652 1652
 
1653 1653
 				case 'inactive' :
1654
-					return $EEME->get_inactive_events( $query_params, $count );
1654
+					return $EEME->get_inactive_events($query_params, $count);
1655 1655
 					break;
1656 1656
 			}
1657 1657
 		}
1658 1658
 
1659
-		$events = $count ? $EEME->count( array( $where ), 'EVT_ID', true ) : $EEME->get_all( $query_params );
1659
+		$events = $count ? $EEME->count(array($where), 'EVT_ID', true) : $EEME->get_all($query_params);
1660 1660
 
1661 1661
 		return $events;
1662 1662
 	}
@@ -1665,23 +1665,23 @@  discard block
 block discarded – undo
1665 1665
 
1666 1666
 
1667 1667
 	//handling for WordPress CPT actions (trash, restore, delete)
1668
-	public function trash_cpt_item( $post_id ) {
1668
+	public function trash_cpt_item($post_id) {
1669 1669
 		$this->_req_data['EVT_ID'] = $post_id;
1670
-		$this->_trash_or_restore_event( 'trash', FALSE );
1670
+		$this->_trash_or_restore_event('trash', FALSE);
1671 1671
 	}
1672 1672
 
1673 1673
 
1674 1674
 
1675 1675
 
1676
-	public function restore_cpt_item( $post_id ) {
1676
+	public function restore_cpt_item($post_id) {
1677 1677
 		$this->_req_data['EVT_ID'] = $post_id;
1678
-		$this->_trash_or_restore_event( 'draft', FALSE );
1678
+		$this->_trash_or_restore_event('draft', FALSE);
1679 1679
 	}
1680 1680
 
1681 1681
 
1682
-	public function delete_cpt_item( $post_id ) {
1682
+	public function delete_cpt_item($post_id) {
1683 1683
 		$this->_req_data['EVT_ID'] = $post_id;
1684
-		$this->_delete_event( FALSE );
1684
+		$this->_delete_event(FALSE);
1685 1685
 	}
1686 1686
 
1687 1687
 
@@ -1693,7 +1693,7 @@  discard block
 block discarded – undo
1693 1693
 	 * @param  string $event_status
1694 1694
 	 * @return void
1695 1695
 	 */
1696
-	protected function _trash_or_restore_event($event_status = 'trash', $redirect_after = TRUE ) {
1696
+	protected function _trash_or_restore_event($event_status = 'trash', $redirect_after = TRUE) {
1697 1697
 		//determine the event id and set to array.
1698 1698
 		$EVT_ID = isset($this->_req_data['EVT_ID']) ? absint($this->_req_data['EVT_ID']) : FALSE;
1699 1699
 		// loop thru events
@@ -1701,7 +1701,7 @@  discard block
 block discarded – undo
1701 1701
 			// clean status
1702 1702
 			$event_status = sanitize_key($event_status);
1703 1703
 			// grab status
1704
-			if (!empty($event_status)) {
1704
+			if ( ! empty($event_status)) {
1705 1705
 				$success = $this->_change_event_status($EVT_ID, $event_status);
1706 1706
 			} else {
1707 1707
 				$success = FALSE;
@@ -1715,7 +1715,7 @@  discard block
 block discarded – undo
1715 1715
 		}
1716 1716
 		$action = $event_status == 'trash' ? 'moved to the trash' : 'restored from the trash';
1717 1717
 
1718
-		if ( $redirect_after )
1718
+		if ($redirect_after)
1719 1719
 			$this->_redirect_after_action($success, 'Event', $action, array('action' => 'default'));
1720 1720
 	}
1721 1721
 
@@ -1730,7 +1730,7 @@  discard block
 block discarded – undo
1730 1730
 		// clean status
1731 1731
 		$event_status = sanitize_key($event_status);
1732 1732
 		// grab status
1733
-		if (!empty($event_status)) {
1733
+		if ( ! empty($event_status)) {
1734 1734
 			$success = TRUE;
1735 1735
 			//determine the event id and set to array.
1736 1736
 			$EVT_IDs = isset($this->_req_data['EVT_IDs']) ? (array) $this->_req_data['EVT_IDs'] : array();
@@ -1767,13 +1767,13 @@  discard block
 block discarded – undo
1767 1767
 	 */
1768 1768
 	private function _change_event_status($EVT_ID = FALSE, $event_status = FALSE) {
1769 1769
 		// grab event id
1770
-		if (!$EVT_ID) {
1770
+		if ( ! $EVT_ID) {
1771 1771
 			$msg = __('An error occurred. No Event ID or an invalid Event ID was received.', 'event_espresso');
1772 1772
 			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1773 1773
 			return FALSE;
1774 1774
 		}
1775 1775
 
1776
-		$this->_cpt_model_obj = EEM_Event::instance()->get_one_by_ID( $EVT_ID );
1776
+		$this->_cpt_model_obj = EEM_Event::instance()->get_one_by_ID($EVT_ID);
1777 1777
 
1778 1778
 		// clean status
1779 1779
 		$event_status = sanitize_key($event_status);
@@ -1799,7 +1799,7 @@  discard block
 block discarded – undo
1799 1799
 				$hook = FALSE;
1800 1800
 		}
1801 1801
 		//use class to change status
1802
-		$this->_cpt_model_obj->set_status( $event_status );
1802
+		$this->_cpt_model_obj->set_status($event_status);
1803 1803
 		$success = $this->_cpt_model_obj->save();
1804 1804
 
1805 1805
 		if ($success === FALSE) {
@@ -1819,15 +1819,15 @@  discard block
 block discarded – undo
1819 1819
 	 * @access protected
1820 1820
 	 * @return void
1821 1821
 	 */
1822
-	protected function _delete_event( $redirect_after = TRUE ) {
1822
+	protected function _delete_event($redirect_after = TRUE) {
1823 1823
 		//determine the event id and set to array.
1824 1824
 		$EVT_ID = isset($this->_req_data['EVT_ID']) ? absint($this->_req_data['EVT_ID']) : NULL;
1825
-		$EVT_ID = isset( $this->_req_data['post'] ) ? absint( $this->_req_data['post'] ) : $EVT_ID;
1825
+		$EVT_ID = isset($this->_req_data['post']) ? absint($this->_req_data['post']) : $EVT_ID;
1826 1826
 
1827 1827
 
1828 1828
 		// loop thru events
1829 1829
 		if ($EVT_ID) {
1830
-			$success = $this->_permanently_delete_event( $EVT_ID );
1830
+			$success = $this->_permanently_delete_event($EVT_ID);
1831 1831
 			// get list of events with no prices
1832 1832
 			$espresso_no_ticket_prices = get_option('ee_no_ticket_prices', array());
1833 1833
 			// remove this event from the list of events with no prices
@@ -1841,7 +1841,7 @@  discard block
 block discarded – undo
1841 1841
 			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1842 1842
 		}
1843 1843
 
1844
-		if ( $redirect_after )
1844
+		if ($redirect_after)
1845 1845
 			$this->_redirect_after_action($success, 'Event', 'deleted', array('action' => 'default', 'status' => 'trash'));
1846 1846
 	}
1847 1847
 
@@ -1887,7 +1887,7 @@  discard block
 block discarded – undo
1887 1887
 	 */
1888 1888
 	private function _permanently_delete_event($EVT_ID = FALSE) {
1889 1889
 		// grab event id
1890
-		if (!$EVT_ID = absint($EVT_ID)) {
1890
+		if ( ! $EVT_ID = absint($EVT_ID)) {
1891 1891
 			$msg = __('An error occurred. No Event ID or an invalid Event ID was received.', 'event_espresso');
1892 1892
 			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1893 1893
 			return FALSE;
@@ -1898,10 +1898,10 @@  discard block
 block discarded – undo
1898 1898
 
1899 1899
 		//need to delete related tickets and prices first.
1900 1900
 		$datetimes = $this->_cpt_model_obj->get_many_related('Datetime');
1901
-		foreach ( $datetimes as $datetime ) {
1901
+		foreach ($datetimes as $datetime) {
1902 1902
 			$this->_cpt_model_obj->_remove_relation_to($datetime, 'Datetime');
1903 1903
 			$tickets = $datetime->get_many_related('Ticket');
1904
-			foreach ( $tickets as $ticket ) {
1904
+			foreach ($tickets as $ticket) {
1905 1905
 				$ticket->_remove_relation_to($datetime, 'Datetime');
1906 1906
 				$ticket->delete_related_permanently('Price');
1907 1907
 				$ticket->delete_permanently();
@@ -1911,14 +1911,14 @@  discard block
 block discarded – undo
1911 1911
 
1912 1912
 		//what about related venues or terms?
1913 1913
 		$venues = $this->_cpt_model_obj->get_many_related('Venue');
1914
-		foreach ( $venues as $venue ) {
1914
+		foreach ($venues as $venue) {
1915 1915
 			$this->_cpt_model_obj->_remove_relation_to($venue, 'Venue');
1916 1916
 		}
1917 1917
 
1918 1918
 		//any attached question groups?
1919 1919
 		$question_groups = $this->_cpt_model_obj->get_many_related('Question_Group');
1920
-		if ( !empty( $question_groups ) ) {
1921
-			foreach ( $question_groups as $question_group ) {
1920
+		if ( ! empty($question_groups)) {
1921
+			foreach ($question_groups as $question_group) {
1922 1922
 				$this->_cpt_model_obj->_remove_relation_to($question_group, 'Question_Group');
1923 1923
 			}
1924 1924
 		}
@@ -1927,13 +1927,13 @@  discard block
 block discarded – undo
1927 1927
 
1928 1928
 
1929 1929
 		//Message Template Groups
1930
-		$this->_cpt_model_obj->_remove_relations( 'Message_Template_Group' );
1930
+		$this->_cpt_model_obj->_remove_relations('Message_Template_Group');
1931 1931
 
1932 1932
 
1933 1933
 		//term taxonomies
1934 1934
 		$term_taxonomies = $this->_cpt_model_obj->term_taxonomies();
1935 1935
 
1936
-		foreach ( $term_taxonomies as $term_taxonomy ) {
1936
+		foreach ($term_taxonomies as $term_taxonomy) {
1937 1937
 			$this->_cpt_model_obj->remove_relation_to_term_taxonomy($term_taxonomy);
1938 1938
 		}
1939 1939
 
@@ -1947,7 +1947,7 @@  discard block
 block discarded – undo
1947 1947
 			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1948 1948
 			return FALSE;
1949 1949
 		}
1950
-		do_action( 'AHEE__Events_Admin_Page___permanently_delete_event__after_event_deleted' );
1950
+		do_action('AHEE__Events_Admin_Page___permanently_delete_event__after_event_deleted');
1951 1951
 		return TRUE;
1952 1952
 	}
1953 1953
 
@@ -1964,7 +1964,7 @@  discard block
 block discarded – undo
1964 1964
 	 */
1965 1965
 	public function total_events() {
1966 1966
 
1967
-		$count = EEM_Event::instance()->count( array(), 'EVT_ID', true );
1967
+		$count = EEM_Event::instance()->count(array(), 'EVT_ID', true);
1968 1968
 		return $count;
1969 1969
 	}
1970 1970
 
@@ -1979,10 +1979,10 @@  discard block
 block discarded – undo
1979 1979
 	 */
1980 1980
 	public function total_events_draft() {
1981 1981
 		$where = array(
1982
-			'status' => array( 'IN', array('draft', 'auto-draft' ) )
1982
+			'status' => array('IN', array('draft', 'auto-draft'))
1983 1983
 			);
1984 1984
 
1985
-		$count = EEM_Event::instance()->count( array( $where ), 'EVT_ID', true );
1985
+		$count = EEM_Event::instance()->count(array($where), 'EVT_ID', true);
1986 1986
 		return $count;
1987 1987
 	}
1988 1988
 
@@ -2001,7 +2001,7 @@  discard block
 block discarded – undo
2001 2001
 			'status' => 'trash'
2002 2002
 			);
2003 2003
 
2004
-		$count = EEM_Event::instance()->count( array( $where ), 'EVT_ID', true );
2004
+		$count = EEM_Event::instance()->count(array($where), 'EVT_ID', true);
2005 2005
 		return $count;
2006 2006
 	}
2007 2007
 
@@ -2029,11 +2029,11 @@  discard block
 block discarded – undo
2029 2029
 			// translated
2030 2030
 			TRUE
2031 2031
 		);
2032
-		$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;
2032
+		$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;
2033 2033
 
2034 2034
 		$this->_set_add_edit_form_tags('update_default_event_settings');
2035 2035
 		$this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE);
2036
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template(EVENTS_TEMPLATE_PATH . 'event_settings.template.php', $this->_template_args, TRUE);
2036
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template(EVENTS_TEMPLATE_PATH.'event_settings.template.php', $this->_template_args, TRUE);
2037 2037
 		$this->display_admin_page_with_sidebar();
2038 2038
 	}
2039 2039
 
@@ -2059,9 +2059,9 @@  discard block
 block discarded – undo
2059 2059
 
2060 2060
 	protected function _template_settings() {
2061 2061
 		$this->_admin_page_title = __('Template Settings (Preview)', 'event_espresso');
2062
-		$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' ) . '" />';
2063
-		$this->_template_args['preview_text'] = '<strong>'.__( 'Template Settings is a feature that is only available in the Caffeinated version of Event Espresso. Template Settings allow you to configure some of the appearance options for both the Event List and Event Details pages.', 'event_espresso' ).'</strong>';
2064
-		$this->display_admin_caf_preview_page( 'template_settings_tab' );
2062
+		$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').'" />';
2063
+		$this->_template_args['preview_text'] = '<strong>'.__('Template Settings is a feature that is only available in the Caffeinated version of Event Espresso. Template Settings allow you to configure some of the appearance options for both the Event List and Event Details pages.', 'event_espresso').'</strong>';
2064
+		$this->display_admin_caf_preview_page('template_settings_tab');
2065 2065
 	}
2066 2066
 
2067 2067
 
@@ -2074,22 +2074,22 @@  discard block
 block discarded – undo
2074 2074
 	 * @return void
2075 2075
 	 */
2076 2076
 	private function _set_category_object() {
2077
-		if ( isset( $this->_category->id ) && !empty( $this->_category->id ) )
2077
+		if (isset($this->_category->id) && ! empty($this->_category->id))
2078 2078
 			return; //already have the category object so get out.
2079 2079
 
2080 2080
 		//set default category object
2081 2081
 		$this->_set_empty_category_object();
2082 2082
 
2083 2083
 		//only set if we've got an id
2084
-		if ( !isset($this->_req_data['EVT_CAT_ID'] ) ) {
2084
+		if ( ! isset($this->_req_data['EVT_CAT_ID'])) {
2085 2085
 			return;
2086 2086
 		}
2087 2087
 
2088 2088
 		$category_id = absint($this->_req_data['EVT_CAT_ID']);
2089 2089
 
2090
-		$term = get_term( $category_id, 'espresso_event_categories' );
2090
+		$term = get_term($category_id, 'espresso_event_categories');
2091 2091
 
2092
-		if ( !empty( $term ) ) {
2092
+		if ( ! empty($term)) {
2093 2093
 			$this->_category->category_name = $term->name;
2094 2094
 			$this->_category->category_identifier = $term->slug;
2095 2095
 			$this->_category->category_desc = $term->description;
@@ -2103,13 +2103,13 @@  discard block
 block discarded – undo
2103 2103
 
2104 2104
 	private function _set_empty_category_object() {
2105 2105
 		$this->_category = new stdClass();
2106
-		$this->_category->category_name = $this->_category->category_identifier = $this->_category->category_desc  = '';
2106
+		$this->_category->category_name = $this->_category->category_identifier = $this->_category->category_desc = '';
2107 2107
 		$this->_category->id = $this->_category->parent = 0;
2108 2108
 	}
2109 2109
 
2110 2110
 
2111 2111
 	protected function _category_list_table() {
2112
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
2112
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2113 2113
 		$this->_search_btn_label = __('Categories', 'event_espresso');
2114 2114
 		$this->_admin_page_title .= $this->get_action_link_or_button('add_category', 'add_category', array(), 'add-new-h2');
2115 2115
 		$this->display_admin_list_table_page_with_sidebar();
@@ -2119,22 +2119,22 @@  discard block
 block discarded – undo
2119 2119
 	protected function _category_details($view) {
2120 2120
 
2121 2121
 		//load formatter helper
2122
-		EE_Registry::instance()->load_helper( 'Formatter' );
2122
+		EE_Registry::instance()->load_helper('Formatter');
2123 2123
 		//load field generator helper
2124
-		EE_Registry::instance()->load_helper( 'Form_Fields' );
2124
+		EE_Registry::instance()->load_helper('Form_Fields');
2125 2125
 
2126 2126
 		$route = $view == 'edit' ? 'update_category' : 'insert_category';
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' => __('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 = __( '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 = __('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 = __( '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 = __('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 ( __('The category %s was successfuly saved', 'event_espresso'), $category_name );
2259
-			EE_Error::add_success( $msg );
2258
+			$msg = sprintf(__('The category %s was successfuly 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.
Braces   +23 added lines, -14 removed lines patch added patch discarded remove patch
@@ -1,6 +1,7 @@  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 6
 /**
6 7
  * Event Espresso
@@ -871,8 +872,9 @@  discard block
 block discarded – undo
871 872
 		$venue_id = !empty( $data['venue_id'] ) ? $data['venue_id'] : NULL;
872 873
 
873 874
 		//very important.  If we don't have a venue name then we'll get out because not necessary to create empty venue
874
-		if ( empty( $data['venue_title'] ) )
875
-			return;
875
+		if ( empty( $data['venue_title'] ) ) {
876
+					return;
877
+		}
876 878
 
877 879
 		$venue_array = array(
878 880
 				'VNU_wp_user' => $evtobj->get('EVT_wp_user'),
@@ -1194,7 +1196,9 @@  discard block
 block discarded – undo
1194 1196
 
1195 1197
 
1196 1198
 		//if no postid then get out cause we need it for stuff in here
1197
-		if ( empty( $postid ) ) return;
1199
+		if ( empty( $postid ) ) {
1200
+			return;
1201
+		}
1198 1202
 
1199 1203
 
1200 1204
 		//handle datetime saves
@@ -1436,10 +1440,11 @@  discard block
 block discarded – undo
1436 1440
 			//get the earliest datetime (if present);
1437 1441
 			$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;
1438 1442
 
1439
-			if ( !empty( $earliest_dtt ) )
1440
-				$template_args['TKT_end_date'] = $earliest_dtt->get_datetime('DTT_EVT_start', 'Y-m-d', 'h:i a');
1441
-			else
1442
-				$template_args['TKT_end_date'] = date('Y-m-d h:i a', mktime(0, 0, 0, date("m"), date("d")+7, date("Y") ) );
1443
+			if ( !empty( $earliest_dtt ) ) {
1444
+							$template_args['TKT_end_date'] = $earliest_dtt->get_datetime('DTT_EVT_start', 'Y-m-d', 'h:i a');
1445
+			} else {
1446
+							$template_args['TKT_end_date'] = date('Y-m-d h:i a', mktime(0, 0, 0, date("m"), date("d")+7, date("Y") ) );
1447
+			}
1443 1448
 		}
1444 1449
 
1445 1450
 		$template_args = array_merge( $template_args, $price_args );
@@ -1715,8 +1720,9 @@  discard block
 block discarded – undo
1715 1720
 		}
1716 1721
 		$action = $event_status == 'trash' ? 'moved to the trash' : 'restored from the trash';
1717 1722
 
1718
-		if ( $redirect_after )
1719
-			$this->_redirect_after_action($success, 'Event', $action, array('action' => 'default'));
1723
+		if ( $redirect_after ) {
1724
+					$this->_redirect_after_action($success, 'Event', $action, array('action' => 'default'));
1725
+		}
1720 1726
 	}
1721 1727
 
1722 1728
 	/**
@@ -1841,8 +1847,9 @@  discard block
 block discarded – undo
1841 1847
 			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1842 1848
 		}
1843 1849
 
1844
-		if ( $redirect_after )
1845
-			$this->_redirect_after_action($success, 'Event', 'deleted', array('action' => 'default', 'status' => 'trash'));
1850
+		if ( $redirect_after ) {
1851
+					$this->_redirect_after_action($success, 'Event', 'deleted', array('action' => 'default', 'status' => 'trash'));
1852
+		}
1846 1853
 	}
1847 1854
 
1848 1855
 	/**
@@ -2074,8 +2081,10 @@  discard block
 block discarded – undo
2074 2081
 	 * @return void
2075 2082
 	 */
2076 2083
 	private function _set_category_object() {
2077
-		if ( isset( $this->_category->id ) && !empty( $this->_category->id ) )
2078
-			return; //already have the category object so get out.
2084
+		if ( isset( $this->_category->id ) && !empty( $this->_category->id ) ) {
2085
+					return;
2086
+		}
2087
+		//already have the category object so get out.
2079 2088
 
2080 2089
 		//set default category object
2081 2090
 		$this->_set_empty_category_object();
Please login to merge, or discard this patch.
admin_pages/general_settings/General_Settings_Admin_Page.core.php 4 patches
Doc Comments   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -545,7 +545,7 @@  discard block
 block discarded – undo
545 545
 	 *
546 546
 	 * 		@access 	public
547 547
 	 * 		@param 	string 		$CNT_ISO
548
-	 * 		@return 		mixed		string | array
548
+	 * 		@return 		string|null		string | array
549 549
 	 */
550 550
 	public function display_country_settings( $CNT_ISO = '' ) {
551 551
 
@@ -708,7 +708,7 @@  discard block
 block discarded – undo
708 708
 	 * 		delete_state
709 709
 	 *
710 710
 	 * 		@access 	public
711
-	 * 		@return 		boolean | void
711
+	 * 		@return 		false|null | void
712 712
 	 */
713 713
 	public function delete_state() {
714 714
 		$CNT_ISO = isset( $this->_req_data['CNT_ISO'] ) ? strtoupper( sanitize_text_field( $this->_req_data['CNT_ISO'] )) : FALSE;
@@ -938,10 +938,10 @@  discard block
 block discarded – undo
938 938
 	/**
939 939
 	 * generates a dropdown of all parent pages - copied from WP core
940 940
 	 *
941
-	 * @param unknown_type $default
942
-	 * @param unknown_type $parent
943
-	 * @param unknown_type $level
944
-	 * @return unknown
941
+	 * @param integer $default
942
+	 * @param integer $parent
943
+	 * @param integer $level
944
+	 * @return null|false
945 945
 	 */
946 946
 	public static function page_settings_dropdown( $default = 0, $parent = 0, $level = 0 ) {
947 947
 		global $wpdb;
Please login to merge, or discard this patch.
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
 					'order' => 50
155 155
 					),
156 156
 				'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array( '_publish_post_box' ) ),
157
-               			'help_tabs' => array(
157
+			   			'help_tabs' => array(
158 158
 					'general_settings_critical_pages_help_tab' => array(
159 159
 						'title' => __('Critical Pages', 'event_espresso'),
160 160
 						'filename' => 'general_settings_critical_pages'
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
 					'label' => __('Your Organization', 'event_espresso'),
169 169
 					'order' => 20
170 170
 				),
171
-                			'help_tabs' => array(
171
+							'help_tabs' => array(
172 172
 					'general_settings_your_organization_help_tab' => array(
173 173
 						'title' => __('Your Organization', 'event_espresso'),
174 174
 						'filename' => 'general_settings_your_organization'
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
 					'order' => 60
185 185
 					),
186 186
 				'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array( '_publish_post_box' ) ),
187
-                			'help_tabs' => array(
187
+							'help_tabs' => array(
188 188
 					'general_settings_admin_options_help_tab' => array(
189 189
 						'title' => __('Admin Options', 'event_espresso'),
190 190
 						'filename' => 'general_settings_admin_options'
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
 					'label' => __('Countries', 'event_espresso'),
199 199
 					'order' => 70
200 200
 					),
201
-                'help_tabs' => array(
201
+				'help_tabs' => array(
202 202
 					'general_settings_countries_help_tab' => array(
203 203
 						'title' => __('Countries', 'event_espresso'),
204 204
 						'filename' => 'general_settings_countries'
Please login to merge, or discard this patch.
Braces   +10 added lines, -7 removed lines patch added patch discarded remove patch
@@ -1,6 +1,7 @@  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 6
 /**
6 7
  * Event Espresso
@@ -419,8 +420,9 @@  discard block
 block discarded – undo
419 420
 	}
420 421
 
421 422
 	protected function _update_your_organization_settings() {
422
-		if ( is_main_site() )
423
-			EE_Registry::instance()->NET_CFG->core->site_license_key = isset( $this->_req_data['site_license_key'] ) ? sanitize_text_field( $this->_req_data['site_license_key'] ) : EE_Registry::instance()->NET_CFG->core->site_license_key;
423
+		if ( is_main_site() ) {
424
+					EE_Registry::instance()->NET_CFG->core->site_license_key = isset( $this->_req_data['site_license_key'] ) ? sanitize_text_field( $this->_req_data['site_license_key'] ) : EE_Registry::instance()->NET_CFG->core->site_license_key;
425
+		}
424 426
 		EE_Registry::instance()->CFG->organization->name = isset( $this->_req_data['organization_name'] ) ? sanitize_text_field( $this->_req_data['organization_name'] ) : EE_Registry::instance()->CFG->organization->name;
425 427
 		EE_Registry::instance()->CFG->organization->address_1 = isset( $this->_req_data['organization_address_1'] ) ? sanitize_text_field( $this->_req_data['organization_address_1'] ) : EE_Registry::instance()->CFG->organization->address_1;
426 428
 		EE_Registry::instance()->CFG->organization->address_2 = isset( $this->_req_data['organization_address_2'] ) ? sanitize_text_field( $this->_req_data['organization_address_2'] ) : EE_Registry::instance()->CFG->organization->address_2;
@@ -950,10 +952,11 @@  discard block
 block discarded – undo
950 952
 		if ( $items ) {
951 953
 			foreach ( $items as $item ) {
952 954
 				$pad = str_repeat( '&nbsp;', $level * 3 );
953
-				if ( $item->ID == $default)
954
-					$current = ' selected="selected"';
955
-				else
956
-					$current = '';
955
+				if ( $item->ID == $default) {
956
+									$current = ' selected="selected"';
957
+				} else {
958
+									$current = '';
959
+				}
957 960
 
958 961
 				echo "\n\t<option class='level-$level' value='$item->ID'$current>$pad " . esc_html($item->post_title) . "</option>";
959 962
 				parent_dropdown( $default, $item->ID, $level +1 );
Please login to merge, or discard this patch.
Spacing   +285 added lines, -286 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
 /**
@@ -40,8 +40,8 @@  discard block
 block discarded – undo
40 40
 
41 41
 
42 42
 
43
-	public function __construct( $routing = TRUE ) {
44
-		parent::__construct( $routing );
43
+	public function __construct($routing = TRUE) {
44
+		parent::__construct($routing);
45 45
 	}
46 46
 
47 47
 
@@ -57,10 +57,10 @@  discard block
 block discarded – undo
57 57
 
58 58
 
59 59
 	protected function _ajax_hooks() {
60
-		add_action('wp_ajax_espresso_display_country_settings', array( $this, 'display_country_settings'));
61
-		add_action('wp_ajax_espresso_display_country_states', array( $this, 'display_country_states'));
62
-		add_action('wp_ajax_espresso_delete_state', array( $this, 'delete_state'), 10, 3 );
63
-		add_action('wp_ajax_espresso_add_new_state', array( $this, 'add_new_state'));
60
+		add_action('wp_ajax_espresso_display_country_settings', array($this, 'display_country_settings'));
61
+		add_action('wp_ajax_espresso_display_country_states', array($this, 'display_country_states'));
62
+		add_action('wp_ajax_espresso_delete_state', array($this, 'delete_state'), 10, 3);
63
+		add_action('wp_ajax_espresso_add_new_state', array($this, 'add_new_state'));
64 64
 	}
65 65
 
66 66
 
@@ -153,14 +153,14 @@  discard block
 block discarded – undo
153 153
 					'label' => __('Critical Pages', 'event_espresso'),
154 154
 					'order' => 50
155 155
 					),
156
-				'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array( '_publish_post_box' ) ),
156
+				'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')),
157 157
                			'help_tabs' => array(
158 158
 					'general_settings_critical_pages_help_tab' => array(
159 159
 						'title' => __('Critical Pages', 'event_espresso'),
160 160
 						'filename' => 'general_settings_critical_pages'
161 161
 						)
162 162
 					),
163
-				'help_tour' => array( 'Critical_Pages_Help_Tour' ),
163
+				'help_tour' => array('Critical_Pages_Help_Tour'),
164 164
 				'require_nonce' => FALSE
165 165
 				),
166 166
 			'default' => array(
@@ -174,8 +174,8 @@  discard block
 block discarded – undo
174 174
 						'filename' => 'general_settings_your_organization'
175 175
 						)
176 176
 					),
177
-				'help_tour' => array( 'Your_Organization_Help_Tour' ),
178
-				'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array( '_publish_post_box' ) ),
177
+				'help_tour' => array('Your_Organization_Help_Tour'),
178
+				'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')),
179 179
 				'require_nonce' => FALSE
180 180
 				),
181 181
 			'admin_option_settings' => array(
@@ -183,14 +183,14 @@  discard block
 block discarded – undo
183 183
 					'label' => __('Admin Options', 'event_espresso'),
184 184
 					'order' => 60
185 185
 					),
186
-				'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array( '_publish_post_box' ) ),
186
+				'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')),
187 187
                 			'help_tabs' => array(
188 188
 					'general_settings_admin_options_help_tab' => array(
189 189
 						'title' => __('Admin Options', 'event_espresso'),
190 190
 						'filename' => 'general_settings_admin_options'
191 191
 						)
192 192
 					),
193
-				'help_tour' => array( 'Admin_Options_Help_Tour' ),
193
+				'help_tour' => array('Admin_Options_Help_Tour'),
194 194
 				'require_nonce' => FALSE
195 195
 				),
196 196
 			'country_settings' => array(
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
 						'filename' => 'general_settings_countries'
205 205
 						)
206 206
 					),
207
-				'help_tour' => array( 'Countries_Help_Tour' ),
207
+				'help_tour' => array('Countries_Help_Tour'),
208 208
 				'require_nonce' => FALSE
209 209
 				)
210 210
 			);
@@ -222,11 +222,11 @@  discard block
 block discarded – undo
222 222
 	}
223 223
 
224 224
 	public function admin_init() {
225
-		EE_Registry::$i18n_js_strings[ 'invalid_server_response' ] = __( 'An error occurred! Your request may have been processed, but a valid response from the server was not received. Please refresh the page and try again.', 'event_espresso' );
226
-		EE_Registry::$i18n_js_strings[ 'error_occurred' ] = __( 'An error occurred! Please refresh the page and try again.', 'event_espresso' );
227
-		EE_Registry::$i18n_js_strings[ 'confirm_delete_state' ] = __( 'Are you sure you want to delete this State / Province?', 'event_espresso' );
228
-		$protocol = isset( $_SERVER[ 'HTTPS' ] ) ? 'https://' : 'http://';
229
-		EE_Registry::$i18n_js_strings[ 'ajax_url' ] = admin_url( 'admin-ajax.php?page=espresso_general_settings', $protocol );
225
+		EE_Registry::$i18n_js_strings['invalid_server_response'] = __('An error occurred! Your request may have been processed, but a valid response from the server was not received. Please refresh the page and try again.', 'event_espresso');
226
+		EE_Registry::$i18n_js_strings['error_occurred'] = __('An error occurred! Please refresh the page and try again.', 'event_espresso');
227
+		EE_Registry::$i18n_js_strings['confirm_delete_state'] = __('Are you sure you want to delete this State / Province?', 'event_espresso');
228
+		$protocol = isset($_SERVER['HTTPS']) ? 'https://' : 'http://';
229
+		EE_Registry::$i18n_js_strings['ajax_url'] = admin_url('admin-ajax.php?page=espresso_general_settings', $protocol);
230 230
 	}
231 231
 
232 232
 	public function admin_notices() {}
@@ -239,21 +239,21 @@  discard block
 block discarded – undo
239 239
 		//scripts
240 240
 		wp_enqueue_script('media-upload');
241 241
 		wp_enqueue_script('thickbox');
242
-		wp_register_script( 'organization_settings', GEN_SET_ASSETS_URL . 'your_organization_settings.js', array( 'jquery','media-upload','thickbox' ), EVENT_ESPRESSO_VERSION, TRUE );
243
-		wp_register_style( 'organization-css', GEN_SET_ASSETS_URL . 'organization.css', array(), EVENT_ESPRESSO_VERSION );
244
-		wp_enqueue_script( 'organization_settings' );
245
-		wp_enqueue_style( 'organization-css' );
246
-		$confirm_image_delete = array( 'text' => __('Do you really want to delete this image? Please remember to save your settings to complete the removal.', 'event_espresso'));
247
-		wp_localize_script( 'organization_settings', 'confirm_image_delete', $confirm_image_delete );
242
+		wp_register_script('organization_settings', GEN_SET_ASSETS_URL.'your_organization_settings.js', array('jquery', 'media-upload', 'thickbox'), EVENT_ESPRESSO_VERSION, TRUE);
243
+		wp_register_style('organization-css', GEN_SET_ASSETS_URL.'organization.css', array(), EVENT_ESPRESSO_VERSION);
244
+		wp_enqueue_script('organization_settings');
245
+		wp_enqueue_style('organization-css');
246
+		$confirm_image_delete = array('text' => __('Do you really want to delete this image? Please remember to save your settings to complete the removal.', 'event_espresso'));
247
+		wp_localize_script('organization_settings', 'confirm_image_delete', $confirm_image_delete);
248 248
 
249 249
 	}
250 250
 
251 251
 	public function load_scripts_styles_country_settings() {
252 252
 		//scripts
253
-		wp_register_script( 'gen_settings_countries', GEN_SET_ASSETS_URL . 'gen_settings_countries.js', array( 'ee_admin_js' ), EVENT_ESPRESSO_VERSION, TRUE );
254
-		wp_register_style( 'organization-css', GEN_SET_ASSETS_URL . 'organization.css', array(), EVENT_ESPRESSO_VERSION );
255
-		wp_enqueue_script( 'gen_settings_countries' );
256
-		wp_enqueue_style( 'organization-css' );
253
+		wp_register_script('gen_settings_countries', GEN_SET_ASSETS_URL.'gen_settings_countries.js', array('ee_admin_js'), EVENT_ESPRESSO_VERSION, TRUE);
254
+		wp_register_style('organization-css', GEN_SET_ASSETS_URL.'organization.css', array(), EVENT_ESPRESSO_VERSION);
255
+		wp_enqueue_script('gen_settings_countries');
256
+		wp_enqueue_style('organization-css');
257 257
 
258 258
 	}
259 259
 
@@ -265,37 +265,37 @@  discard block
 block discarded – undo
265 265
 
266 266
 		// Check to make sure all of the main pages are setup properly,
267 267
 		// if not create the default pages and display an admin notice
268
-		EE_Registry::instance()->load_helper( 'Activation' );
268
+		EE_Registry::instance()->load_helper('Activation');
269 269
 		EEH_Activation::verify_default_pages_exist();
270 270
 
271 271
 		$this->_transient_garbage_collection();
272 272
 		$this->_template_args['values'] = $this->_yes_no_values;
273 273
 
274
-		$this->_template_args['reg_page_id'] = isset(EE_Registry::instance()->CFG->core->reg_page_id ) ?EE_Registry::instance()->CFG->core->reg_page_id : NULL;
275
-		$this->_template_args['reg_page_obj'] = isset(EE_Registry::instance()->CFG->core->reg_page_id ) ? get_page(EE_Registry::instance()->CFG->core->reg_page_id ) : FALSE;
274
+		$this->_template_args['reg_page_id'] = isset(EE_Registry::instance()->CFG->core->reg_page_id) ? EE_Registry::instance()->CFG->core->reg_page_id : NULL;
275
+		$this->_template_args['reg_page_obj'] = isset(EE_Registry::instance()->CFG->core->reg_page_id) ? get_page(EE_Registry::instance()->CFG->core->reg_page_id) : FALSE;
276 276
 
277
-		$this->_template_args['txn_page_id'] = isset(EE_Registry::instance()->CFG->core->txn_page_id) ?EE_Registry::instance()->CFG->core->txn_page_id : NULL;
278
-		$this->_template_args['txn_page_obj'] = isset(EE_Registry::instance()->CFG->core->txn_page_id ) ? get_page(EE_Registry::instance()->CFG->core->txn_page_id ) : FALSE;
277
+		$this->_template_args['txn_page_id'] = isset(EE_Registry::instance()->CFG->core->txn_page_id) ? EE_Registry::instance()->CFG->core->txn_page_id : NULL;
278
+		$this->_template_args['txn_page_obj'] = isset(EE_Registry::instance()->CFG->core->txn_page_id) ? get_page(EE_Registry::instance()->CFG->core->txn_page_id) : FALSE;
279 279
 
280
-		$this->_template_args['thank_you_page_id'] = isset(EE_Registry::instance()->CFG->core->thank_you_page_id ) ?EE_Registry::instance()->CFG->core->thank_you_page_id : NULL;
281
-		$this->_template_args['thank_you_page_obj'] = isset(EE_Registry::instance()->CFG->core->thank_you_page_id ) ? get_page(EE_Registry::instance()->CFG->core->thank_you_page_id ) : FALSE;
280
+		$this->_template_args['thank_you_page_id'] = isset(EE_Registry::instance()->CFG->core->thank_you_page_id) ? EE_Registry::instance()->CFG->core->thank_you_page_id : NULL;
281
+		$this->_template_args['thank_you_page_obj'] = isset(EE_Registry::instance()->CFG->core->thank_you_page_id) ? get_page(EE_Registry::instance()->CFG->core->thank_you_page_id) : FALSE;
282 282
 
283
-		$this->_template_args['cancel_page_id'] = isset(EE_Registry::instance()->CFG->core->cancel_page_id ) ?EE_Registry::instance()->CFG->core->cancel_page_id : NULL;
284
-		$this->_template_args['cancel_page_obj'] = isset(EE_Registry::instance()->CFG->core->cancel_page_id ) ? get_page(EE_Registry::instance()->CFG->core->cancel_page_id ) : FALSE;
283
+		$this->_template_args['cancel_page_id'] = isset(EE_Registry::instance()->CFG->core->cancel_page_id) ? EE_Registry::instance()->CFG->core->cancel_page_id : NULL;
284
+		$this->_template_args['cancel_page_obj'] = isset(EE_Registry::instance()->CFG->core->cancel_page_id) ? get_page(EE_Registry::instance()->CFG->core->cancel_page_id) : FALSE;
285 285
 
286
-		$this->_set_add_edit_form_tags( 'update_espresso_page_settings' );
287
-		$this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE );
288
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( GEN_SET_TEMPLATE_PATH . 'espresso_page_settings.template.php', $this->_template_args, TRUE );
286
+		$this->_set_add_edit_form_tags('update_espresso_page_settings');
287
+		$this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE);
288
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template(GEN_SET_TEMPLATE_PATH.'espresso_page_settings.template.php', $this->_template_args, TRUE);
289 289
 		$this->display_admin_page_with_sidebar();
290 290
 
291 291
 	}
292 292
 
293 293
 	protected function _update_espresso_page_settings() {
294 294
 		// capture incoming request data
295
-		$reg_page_id = isset( $this->_req_data['reg_page_id'] ) ? absint( $this->_req_data['reg_page_id'] ) : EE_Registry::instance()->CFG->core->reg_page_id;
296
-		$txn_page_id = isset( $this->_req_data['txn_page_id'] ) ? absint( $this->_req_data['txn_page_id'] ) : EE_Registry::instance()->CFG->core->txn_page_id;
297
-		$thank_you_page_id = isset( $this->_req_data['thank_you_page_id'] ) ? absint( $this->_req_data['thank_you_page_id'] ) : EE_Registry::instance()->CFG->core->thank_you_page_id;
298
-		$cancel_page_id = isset( $this->_req_data['cancel_page_id'] ) ? absint( $this->_req_data['cancel_page_id'] ) : EE_Registry::instance()->CFG->core->cancel_page_id;
295
+		$reg_page_id = isset($this->_req_data['reg_page_id']) ? absint($this->_req_data['reg_page_id']) : EE_Registry::instance()->CFG->core->reg_page_id;
296
+		$txn_page_id = isset($this->_req_data['txn_page_id']) ? absint($this->_req_data['txn_page_id']) : EE_Registry::instance()->CFG->core->txn_page_id;
297
+		$thank_you_page_id = isset($this->_req_data['thank_you_page_id']) ? absint($this->_req_data['thank_you_page_id']) : EE_Registry::instance()->CFG->core->thank_you_page_id;
298
+		$cancel_page_id = isset($this->_req_data['cancel_page_id']) ? absint($this->_req_data['cancel_page_id']) : EE_Registry::instance()->CFG->core->cancel_page_id;
299 299
 		// pack critical_pages into an array
300 300
 		$critical_pages = array(
301 301
 			'reg_page_id' 				=> $reg_page_id,
@@ -303,17 +303,17 @@  discard block
 block discarded – undo
303 303
 			'thank_you_page_id' 	=> $thank_you_page_id,
304 304
 			'cancel_page_id' 		=> $cancel_page_id
305 305
 		);
306
-		foreach ( $critical_pages as $critical_page_name => $critical_page_id ) {
306
+		foreach ($critical_pages as $critical_page_name => $critical_page_id) {
307 307
 			// has the page changed ?
308
-			if ( EE_Registry::instance()->CFG->core->$critical_page_name != $critical_page_id ) {
308
+			if (EE_Registry::instance()->CFG->core->$critical_page_name != $critical_page_id) {
309 309
 				// grab post object for old page
310
-				$post = get_post( EE_Registry::instance()->CFG->core->$critical_page_name );
310
+				$post = get_post(EE_Registry::instance()->CFG->core->$critical_page_name);
311 311
 				// update post shortcodes for old page
312
-				EE_Admin::parse_post_content_on_save( $critical_page_id, $post );
312
+				EE_Admin::parse_post_content_on_save($critical_page_id, $post);
313 313
 				// grab post object for new page
314
-				$post = get_post( $critical_page_id );
314
+				$post = get_post($critical_page_id);
315 315
 				// update post shortcodes for new page
316
-				EE_Admin::parse_post_content_on_save( $critical_page_id, $post );
316
+				EE_Admin::parse_post_content_on_save($critical_page_id, $post);
317 317
 			}
318 318
 		}
319 319
 		// set page IDs
@@ -322,14 +322,14 @@  discard block
 block discarded – undo
322 322
 		EE_Registry::instance()->CFG->core->thank_you_page_id = $thank_you_page_id;
323 323
 		EE_Registry::instance()->CFG->core->cancel_page_id = $cancel_page_id;
324 324
 
325
-		EE_Registry::instance()->CFG->core = apply_filters( 'FHEE__General_Settings_Admin_Page___update_espresso_page_settings__CFG_core', EE_Registry::instance()->CFG->core, $this->_req_data );
325
+		EE_Registry::instance()->CFG->core = apply_filters('FHEE__General_Settings_Admin_Page___update_espresso_page_settings__CFG_core', EE_Registry::instance()->CFG->core, $this->_req_data);
326 326
 
327 327
 		$what = __('Critical Pages & Shortcodes', 'event_espresso');
328
-		$success = $this->_update_espresso_configuration( $what, EE_Registry::instance()->CFG->core, __FILE__, __FUNCTION__, __LINE__ );
328
+		$success = $this->_update_espresso_configuration($what, EE_Registry::instance()->CFG->core, __FILE__, __FUNCTION__, __LINE__);
329 329
 		$query_args = array(
330 330
 			'action' => 'critical_pages'
331 331
 			);
332
-		$this->_redirect_after_action( FALSE, '', '', $query_args, TRUE );
332
+		$this->_redirect_after_action(FALSE, '', '', $query_args, TRUE);
333 333
 
334 334
 	}
335 335
 
@@ -344,35 +344,35 @@  discard block
 block discarded – undo
344 344
 
345 345
 	protected function _your_organization_settings() {
346 346
 
347
-		$this->_template_args['site_license_key'] = isset( EE_Registry::instance()->NET_CFG->core->site_license_key ) ? EE_Registry::instance()->NET_CFG->core->get_pretty( 'site_license_key' ) : '';
348
-		$this->_template_args['organization_name'] = isset( EE_Registry::instance()->CFG->organization->name ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'name' ) : '';
349
-		$this->_template_args['organization_address_1'] = isset( EE_Registry::instance()->CFG->organization->address_1 ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'address_1' ) : '';
350
-		$this->_template_args['organization_address_2'] = isset( EE_Registry::instance()->CFG->organization->address_2 ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'address_2' ) : '';
351
-		$this->_template_args['organization_city'] = isset( EE_Registry::instance()->CFG->organization->city ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'city' ) : '';
352
-		$this->_template_args['organization_zip'] = isset( EE_Registry::instance()->CFG->organization->zip ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'zip' ) : '';
353
-		$this->_template_args['organization_email'] = isset( EE_Registry::instance()->CFG->organization->email ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) : '';
354
-		$this->_template_args['organization_phone'] = isset( EE_Registry::instance()->CFG->organization->phone ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'phone' ) : '';
355
-		$this->_template_args['organization_vat'] = isset( EE_Registry::instance()->CFG->organization->vat ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'vat' ) : '';
356
-		$this->_template_args['currency_sign'] = isset( EE_Registry::instance()->CFG->currency->sign ) ? EE_Registry::instance()->CFG->currency->get_pretty( 'sign' ) : '$';
357
-		$this->_template_args['organization_logo_url'] = isset( EE_Registry::instance()->CFG->organization->logo_url ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'logo_url' ) : FALSE;
358
-		$this->_template_args['organization_facebook'] = isset( EE_Registry::instance()->CFG->organization->facebook ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'facebook' ) : '';
359
-		$this->_template_args['organization_twitter'] = isset( EE_Registry::instance()->CFG->organization->twitter ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'twitter' ) : '';
360
-		$this->_template_args['organization_linkedin'] = isset( EE_Registry::instance()->CFG->organization->linkedin ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'linkedin' ) : '';
361
-		$this->_template_args['organization_pinterest'] = isset( EE_Registry::instance()->CFG->organization->pinterest ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'pinterest' ) : '';
362
-		$this->_template_args['organization_google'] = isset( EE_Registry::instance()->CFG->organization->google ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'google' ) : '';
363
-		$this->_template_args['organization_instagram'] = isset( EE_Registry::instance()->CFG->organization->instagram ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'instagram' ) : '';
347
+		$this->_template_args['site_license_key'] = isset(EE_Registry::instance()->NET_CFG->core->site_license_key) ? EE_Registry::instance()->NET_CFG->core->get_pretty('site_license_key') : '';
348
+		$this->_template_args['organization_name'] = isset(EE_Registry::instance()->CFG->organization->name) ? EE_Registry::instance()->CFG->organization->get_pretty('name') : '';
349
+		$this->_template_args['organization_address_1'] = isset(EE_Registry::instance()->CFG->organization->address_1) ? EE_Registry::instance()->CFG->organization->get_pretty('address_1') : '';
350
+		$this->_template_args['organization_address_2'] = isset(EE_Registry::instance()->CFG->organization->address_2) ? EE_Registry::instance()->CFG->organization->get_pretty('address_2') : '';
351
+		$this->_template_args['organization_city'] = isset(EE_Registry::instance()->CFG->organization->city) ? EE_Registry::instance()->CFG->organization->get_pretty('city') : '';
352
+		$this->_template_args['organization_zip'] = isset(EE_Registry::instance()->CFG->organization->zip) ? EE_Registry::instance()->CFG->organization->get_pretty('zip') : '';
353
+		$this->_template_args['organization_email'] = isset(EE_Registry::instance()->CFG->organization->email) ? EE_Registry::instance()->CFG->organization->get_pretty('email') : '';
354
+		$this->_template_args['organization_phone'] = isset(EE_Registry::instance()->CFG->organization->phone) ? EE_Registry::instance()->CFG->organization->get_pretty('phone') : '';
355
+		$this->_template_args['organization_vat'] = isset(EE_Registry::instance()->CFG->organization->vat) ? EE_Registry::instance()->CFG->organization->get_pretty('vat') : '';
356
+		$this->_template_args['currency_sign'] = isset(EE_Registry::instance()->CFG->currency->sign) ? EE_Registry::instance()->CFG->currency->get_pretty('sign') : '$';
357
+		$this->_template_args['organization_logo_url'] = isset(EE_Registry::instance()->CFG->organization->logo_url) ? EE_Registry::instance()->CFG->organization->get_pretty('logo_url') : FALSE;
358
+		$this->_template_args['organization_facebook'] = isset(EE_Registry::instance()->CFG->organization->facebook) ? EE_Registry::instance()->CFG->organization->get_pretty('facebook') : '';
359
+		$this->_template_args['organization_twitter'] = isset(EE_Registry::instance()->CFG->organization->twitter) ? EE_Registry::instance()->CFG->organization->get_pretty('twitter') : '';
360
+		$this->_template_args['organization_linkedin'] = isset(EE_Registry::instance()->CFG->organization->linkedin) ? EE_Registry::instance()->CFG->organization->get_pretty('linkedin') : '';
361
+		$this->_template_args['organization_pinterest'] = isset(EE_Registry::instance()->CFG->organization->pinterest) ? EE_Registry::instance()->CFG->organization->get_pretty('pinterest') : '';
362
+		$this->_template_args['organization_google'] = isset(EE_Registry::instance()->CFG->organization->google) ? EE_Registry::instance()->CFG->organization->get_pretty('google') : '';
363
+		$this->_template_args['organization_instagram'] = isset(EE_Registry::instance()->CFG->organization->instagram) ? EE_Registry::instance()->CFG->organization->get_pretty('instagram') : '';
364 364
 		//UXIP settings
365
-		$this->_template_args['ee_ueip_optin'] = isset( EE_Registry::instance()->CFG->core->ee_ueip_optin ) ? EE_Registry::instance()->CFG->core->get_pretty( 'ee_ueip_optin' ) : TRUE;
365
+		$this->_template_args['ee_ueip_optin'] = isset(EE_Registry::instance()->CFG->core->ee_ueip_optin) ? EE_Registry::instance()->CFG->core->get_pretty('ee_ueip_optin') : TRUE;
366 366
 
367
-		EE_Registry::instance()->load_helper( 'Form_Fields' );
368
-		$STA_ID = isset( EE_Registry::instance()->CFG->organization->STA_ID ) ? EE_Registry::instance()->CFG->organization->STA_ID : 4;
367
+		EE_Registry::instance()->load_helper('Form_Fields');
368
+		$STA_ID = isset(EE_Registry::instance()->CFG->organization->STA_ID) ? EE_Registry::instance()->CFG->organization->STA_ID : 4;
369 369
 		$this->_template_args['states'] = new EE_Question_Form_Input(
370
-				EE_Question::new_instance ( array(
370
+				EE_Question::new_instance(array(
371 371
 					'QST_ID'=> 0,
372 372
 					'QST_display_text'=> __('State/Province', 'event_espresso'),
373 373
 					'QST_system'=>'admin-state'
374 374
 				)),
375
-				EE_Answer::new_instance ( array(
375
+				EE_Answer::new_instance(array(
376 376
 					'ANS_ID' => 0,
377 377
 					'ANS_value' => $STA_ID
378 378
 				)),
@@ -384,14 +384,14 @@  discard block
 block discarded – undo
384 384
 				)
385 385
 			);
386 386
 
387
-		$CNT_ISO = isset( EE_Registry::instance()->CFG->organization->CNT_ISO ) ? EE_Registry::instance()->CFG->organization->CNT_ISO : 'US';
387
+		$CNT_ISO = isset(EE_Registry::instance()->CFG->organization->CNT_ISO) ? EE_Registry::instance()->CFG->organization->CNT_ISO : 'US';
388 388
 		$this->_template_args['countries'] = new EE_Question_Form_Input(
389
-				EE_Question::new_instance ( array(
389
+				EE_Question::new_instance(array(
390 390
 					'QST_ID'=> 0,
391 391
 					'QST_display_text'=> __('Country', 'event_espresso'),
392 392
 					'QST_system'=>'admin-country'
393 393
 				)),
394
-				EE_Answer::new_instance ( array(
394
+				EE_Answer::new_instance(array(
395 395
 					'ANS_ID' => 0,
396 396
 					'ANS_value' => $CNT_ISO
397 397
 				)),
@@ -403,51 +403,51 @@  discard block
 block discarded – undo
403 403
 				)
404 404
 			);
405 405
 
406
-		add_filter( 'FHEE__EEH_Form_Fields__label_html', array( $this, 'country_form_field_label_wrap' ), 10, 2 );
407
-		add_filter( 'FHEE__EEH_Form_Fields__input_html', array( $this, 'country_form_field_input__wrap' ), 10, 2 );
406
+		add_filter('FHEE__EEH_Form_Fields__label_html', array($this, 'country_form_field_label_wrap'), 10, 2);
407
+		add_filter('FHEE__EEH_Form_Fields__input_html', array($this, 'country_form_field_input__wrap'), 10, 2);
408 408
 
409 409
 		//PUE verification stuff
410
-		$ver_option_key = 'puvererr_' . basename( EE_PLUGIN_BASENAME );
411
-		$verify_fail = get_option( $ver_option_key );
412
-		$this->_template_args['site_license_key_verified'] = $verify_fail || !empty( $verify_fail ) || ( empty( $this->_template_args['site_license_key'] ) && empty( $verify_fail ) )? '<span class="dashicons dashicons-admin-network ee-icon-color-ee-red ee-icon-size-20"></span>' : '<span class="dashicons dashicons-admin-network ee-icon-color-ee-green ee-icon-size-20"></span>';
410
+		$ver_option_key = 'puvererr_'.basename(EE_PLUGIN_BASENAME);
411
+		$verify_fail = get_option($ver_option_key);
412
+		$this->_template_args['site_license_key_verified'] = $verify_fail || ! empty($verify_fail) || (empty($this->_template_args['site_license_key']) && empty($verify_fail)) ? '<span class="dashicons dashicons-admin-network ee-icon-color-ee-red ee-icon-size-20"></span>' : '<span class="dashicons dashicons-admin-network ee-icon-color-ee-green ee-icon-size-20"></span>';
413 413
 
414
-		$this->_set_add_edit_form_tags( 'update_your_organization_settings' );
415
-		$this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE );
416
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( GEN_SET_TEMPLATE_PATH . 'your_organization_settings.template.php', $this->_template_args, TRUE );
414
+		$this->_set_add_edit_form_tags('update_your_organization_settings');
415
+		$this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE);
416
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template(GEN_SET_TEMPLATE_PATH.'your_organization_settings.template.php', $this->_template_args, TRUE);
417 417
 
418 418
 		$this->display_admin_page_with_sidebar();
419 419
 	}
420 420
 
421 421
 	protected function _update_your_organization_settings() {
422
-		if ( is_main_site() )
423
-			EE_Registry::instance()->NET_CFG->core->site_license_key = isset( $this->_req_data['site_license_key'] ) ? sanitize_text_field( $this->_req_data['site_license_key'] ) : EE_Registry::instance()->NET_CFG->core->site_license_key;
424
-		EE_Registry::instance()->CFG->organization->name = isset( $this->_req_data['organization_name'] ) ? sanitize_text_field( $this->_req_data['organization_name'] ) : EE_Registry::instance()->CFG->organization->name;
425
-		EE_Registry::instance()->CFG->organization->address_1 = isset( $this->_req_data['organization_address_1'] ) ? sanitize_text_field( $this->_req_data['organization_address_1'] ) : EE_Registry::instance()->CFG->organization->address_1;
426
-		EE_Registry::instance()->CFG->organization->address_2 = isset( $this->_req_data['organization_address_2'] ) ? sanitize_text_field( $this->_req_data['organization_address_2'] ) : EE_Registry::instance()->CFG->organization->address_2;
427
-		EE_Registry::instance()->CFG->organization->city = isset( $this->_req_data['organization_city'] ) ? sanitize_text_field( $this->_req_data['organization_city'] ) : EE_Registry::instance()->CFG->organization->city;
428
-		EE_Registry::instance()->CFG->organization->STA_ID = isset( $this->_req_data['organization_state'] ) ? absint( $this->_req_data['organization_state'] ) : EE_Registry::instance()->CFG->organization->STA_ID;
429
-		EE_Registry::instance()->CFG->organization->CNT_ISO = isset( $this->_req_data['organization_country'] ) ? sanitize_text_field( $this->_req_data['organization_country'] ) : EE_Registry::instance()->CFG->organization->CNT_ISO;
430
-		EE_Registry::instance()->CFG->organization->zip = isset( $this->_req_data['organization_zip'] ) ? sanitize_text_field( $this->_req_data['organization_zip'] ) : EE_Registry::instance()->CFG->organization->zip;
431
-		EE_Registry::instance()->CFG->organization->email = isset( $this->_req_data['organization_email'] ) ? sanitize_email( $this->_req_data['organization_email'] ) : EE_Registry::instance()->CFG->organization->email;
432
-		EE_Registry::instance()->CFG->organization->vat = isset( $this->_req_data['organization_vat'] ) ? sanitize_text_field( $this->_req_data['organization_vat'] ) : EE_Registry::instance()->CFG->organization->vat;
433
-		EE_Registry::instance()->CFG->organization->phone = isset( $this->_req_data['organization_phone'] ) ? sanitize_text_field( $this->_req_data['organization_phone'] ) : EE_Registry::instance()->CFG->organization->phone;
434
-		EE_Registry::instance()->CFG->organization->logo_url = isset( $this->_req_data['organization_logo_url'] ) ? esc_url_raw( $this->_req_data['organization_logo_url'] ) : EE_Registry::instance()->CFG->organization->logo_url;
435
-		EE_Registry::instance()->CFG->organization->facebook = isset( $this->_req_data['organization_facebook'] ) ? esc_url_raw( $this->_req_data['organization_facebook'] ) : EE_Registry::instance()->CFG->organization->facebook;
436
-		EE_Registry::instance()->CFG->organization->twitter = isset( $this->_req_data['organization_twitter'] ) ? esc_url_raw( $this->_req_data['organization_twitter'] ) : EE_Registry::instance()->CFG->organization->twitter;
437
-		EE_Registry::instance()->CFG->organization->linkedin = isset( $this->_req_data['organization_linkedin'] ) ? esc_url_raw( $this->_req_data['organization_linkedin'] ) : EE_Registry::instance()->CFG->organization->linkedin;
438
-		EE_Registry::instance()->CFG->organization->pinterest = isset( $this->_req_data['organization_pinterest'] ) ? esc_url_raw( $this->_req_data['organization_pinterest'] ) : EE_Registry::instance()->CFG->organization->pinterest;
439
-		EE_Registry::instance()->CFG->organization->google = isset( $this->_req_data['organization_google'] ) ? esc_url_raw( $this->_req_data['organization_google'] ) : EE_Registry::instance()->CFG->organization->google;
440
-		EE_Registry::instance()->CFG->organization->instagram = isset( $this->_req_data['organization_instagram'] ) ? esc_url_raw( $this->_req_data['organization_instagram'] ) : EE_Registry::instance()->CFG->organization->instagram;
441
-		EE_Registry::instance()->CFG->core->ee_ueip_optin = isset( $this->_req_data['ueip_optin'] ) && !empty( $this->_req_data['ueip_optin'] ) ? $this->_req_data['ueip_optin'] : EE_Registry::instance()->CFG->core->ee_ueip_optin;
442
-
443
-		EE_Registry::instance()->CFG->currency = new EE_Currency_Config( EE_Registry::instance()->CFG->organization->CNT_ISO );
444
-
445
-		EE_Registry::instance()->CFG = apply_filters( 'FHEE__General_Settings_Admin_Page___update_your_organization_settings__CFG', EE_Registry::instance()->CFG );
422
+		if (is_main_site())
423
+			EE_Registry::instance()->NET_CFG->core->site_license_key = isset($this->_req_data['site_license_key']) ? sanitize_text_field($this->_req_data['site_license_key']) : EE_Registry::instance()->NET_CFG->core->site_license_key;
424
+		EE_Registry::instance()->CFG->organization->name = isset($this->_req_data['organization_name']) ? sanitize_text_field($this->_req_data['organization_name']) : EE_Registry::instance()->CFG->organization->name;
425
+		EE_Registry::instance()->CFG->organization->address_1 = isset($this->_req_data['organization_address_1']) ? sanitize_text_field($this->_req_data['organization_address_1']) : EE_Registry::instance()->CFG->organization->address_1;
426
+		EE_Registry::instance()->CFG->organization->address_2 = isset($this->_req_data['organization_address_2']) ? sanitize_text_field($this->_req_data['organization_address_2']) : EE_Registry::instance()->CFG->organization->address_2;
427
+		EE_Registry::instance()->CFG->organization->city = isset($this->_req_data['organization_city']) ? sanitize_text_field($this->_req_data['organization_city']) : EE_Registry::instance()->CFG->organization->city;
428
+		EE_Registry::instance()->CFG->organization->STA_ID = isset($this->_req_data['organization_state']) ? absint($this->_req_data['organization_state']) : EE_Registry::instance()->CFG->organization->STA_ID;
429
+		EE_Registry::instance()->CFG->organization->CNT_ISO = isset($this->_req_data['organization_country']) ? sanitize_text_field($this->_req_data['organization_country']) : EE_Registry::instance()->CFG->organization->CNT_ISO;
430
+		EE_Registry::instance()->CFG->organization->zip = isset($this->_req_data['organization_zip']) ? sanitize_text_field($this->_req_data['organization_zip']) : EE_Registry::instance()->CFG->organization->zip;
431
+		EE_Registry::instance()->CFG->organization->email = isset($this->_req_data['organization_email']) ? sanitize_email($this->_req_data['organization_email']) : EE_Registry::instance()->CFG->organization->email;
432
+		EE_Registry::instance()->CFG->organization->vat = isset($this->_req_data['organization_vat']) ? sanitize_text_field($this->_req_data['organization_vat']) : EE_Registry::instance()->CFG->organization->vat;
433
+		EE_Registry::instance()->CFG->organization->phone = isset($this->_req_data['organization_phone']) ? sanitize_text_field($this->_req_data['organization_phone']) : EE_Registry::instance()->CFG->organization->phone;
434
+		EE_Registry::instance()->CFG->organization->logo_url = isset($this->_req_data['organization_logo_url']) ? esc_url_raw($this->_req_data['organization_logo_url']) : EE_Registry::instance()->CFG->organization->logo_url;
435
+		EE_Registry::instance()->CFG->organization->facebook = isset($this->_req_data['organization_facebook']) ? esc_url_raw($this->_req_data['organization_facebook']) : EE_Registry::instance()->CFG->organization->facebook;
436
+		EE_Registry::instance()->CFG->organization->twitter = isset($this->_req_data['organization_twitter']) ? esc_url_raw($this->_req_data['organization_twitter']) : EE_Registry::instance()->CFG->organization->twitter;
437
+		EE_Registry::instance()->CFG->organization->linkedin = isset($this->_req_data['organization_linkedin']) ? esc_url_raw($this->_req_data['organization_linkedin']) : EE_Registry::instance()->CFG->organization->linkedin;
438
+		EE_Registry::instance()->CFG->organization->pinterest = isset($this->_req_data['organization_pinterest']) ? esc_url_raw($this->_req_data['organization_pinterest']) : EE_Registry::instance()->CFG->organization->pinterest;
439
+		EE_Registry::instance()->CFG->organization->google = isset($this->_req_data['organization_google']) ? esc_url_raw($this->_req_data['organization_google']) : EE_Registry::instance()->CFG->organization->google;
440
+		EE_Registry::instance()->CFG->organization->instagram = isset($this->_req_data['organization_instagram']) ? esc_url_raw($this->_req_data['organization_instagram']) : EE_Registry::instance()->CFG->organization->instagram;
441
+		EE_Registry::instance()->CFG->core->ee_ueip_optin = isset($this->_req_data['ueip_optin']) && ! empty($this->_req_data['ueip_optin']) ? $this->_req_data['ueip_optin'] : EE_Registry::instance()->CFG->core->ee_ueip_optin;
442
+
443
+		EE_Registry::instance()->CFG->currency = new EE_Currency_Config(EE_Registry::instance()->CFG->organization->CNT_ISO);
444
+
445
+		EE_Registry::instance()->CFG = apply_filters('FHEE__General_Settings_Admin_Page___update_your_organization_settings__CFG', EE_Registry::instance()->CFG);
446 446
 
447 447
 		$what = 'Your Organization Settings';
448
-		$success = $this->_update_espresso_configuration( $what, EE_Registry::instance()->CFG, __FILE__, __FUNCTION__, __LINE__ );
448
+		$success = $this->_update_espresso_configuration($what, EE_Registry::instance()->CFG, __FILE__, __FUNCTION__, __LINE__);
449 449
 
450
-		$this->_redirect_after_action( $success, $what, 'updated', array( 'action' => 'default' ) );
450
+		$this->_redirect_after_action($success, $what, 'updated', array('action' => 'default'));
451 451
 
452 452
 	}
453 453
 
@@ -458,36 +458,36 @@  discard block
 block discarded – undo
458 458
 	protected function _admin_option_settings() {
459 459
 
460 460
 		$this->_template_args['values'] = $this->_yes_no_values;
461
-		$this->_template_args['use_personnel_manager'] = isset( EE_Registry::instance()->CFG->admin->use_personnel_manager ) ? absint( EE_Registry::instance()->CFG->admin->use_personnel_manager ) : FALSE;
462
-		$this->_template_args['use_dashboard_widget'] = isset( EE_Registry::instance()->CFG->admin->use_dashboard_widget ) ? absint( EE_Registry::instance()->CFG->admin->use_dashboard_widget ) : TRUE;
463
-		$this->_template_args['events_in_dashboard'] = isset( EE_Registry::instance()->CFG->admin->events_in_dashboard ) ? absint( EE_Registry::instance()->CFG->admin->events_in_dashboard ) : 30;
464
-		$this->_template_args['use_event_timezones'] = isset( EE_Registry::instance()->CFG->admin->use_event_timezones ) ? absint( EE_Registry::instance()->CFG->admin->use_event_timezones ) : FALSE;
465
-		$this->_template_args['show_reg_footer'] = isset( EE_Registry::instance()->CFG->admin->show_reg_footer ) ? absint( EE_Registry::instance()->CFG->admin->show_reg_footer ) : TRUE;
466
-		$this->_template_args['affiliate_id'] = isset( EE_Registry::instance()->CFG->admin->affiliate_id ) ? EE_Registry::instance()->CFG->admin->get_pretty('affiliate_id') : '';
467
-		$this->_template_args['help_tour_activation'] = isset( EE_Registry::instance()->CFG->admin->help_tour_activation ) ? absint( EE_Registry::instance()->CFG->admin->help_tour_activation ): 1;
468
-
469
-		$this->_set_add_edit_form_tags( 'update_admin_option_settings' );
470
-		$this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE );
461
+		$this->_template_args['use_personnel_manager'] = isset(EE_Registry::instance()->CFG->admin->use_personnel_manager) ? absint(EE_Registry::instance()->CFG->admin->use_personnel_manager) : FALSE;
462
+		$this->_template_args['use_dashboard_widget'] = isset(EE_Registry::instance()->CFG->admin->use_dashboard_widget) ? absint(EE_Registry::instance()->CFG->admin->use_dashboard_widget) : TRUE;
463
+		$this->_template_args['events_in_dashboard'] = isset(EE_Registry::instance()->CFG->admin->events_in_dashboard) ? absint(EE_Registry::instance()->CFG->admin->events_in_dashboard) : 30;
464
+		$this->_template_args['use_event_timezones'] = isset(EE_Registry::instance()->CFG->admin->use_event_timezones) ? absint(EE_Registry::instance()->CFG->admin->use_event_timezones) : FALSE;
465
+		$this->_template_args['show_reg_footer'] = isset(EE_Registry::instance()->CFG->admin->show_reg_footer) ? absint(EE_Registry::instance()->CFG->admin->show_reg_footer) : TRUE;
466
+		$this->_template_args['affiliate_id'] = isset(EE_Registry::instance()->CFG->admin->affiliate_id) ? EE_Registry::instance()->CFG->admin->get_pretty('affiliate_id') : '';
467
+		$this->_template_args['help_tour_activation'] = isset(EE_Registry::instance()->CFG->admin->help_tour_activation) ? absint(EE_Registry::instance()->CFG->admin->help_tour_activation) : 1;
468
+
469
+		$this->_set_add_edit_form_tags('update_admin_option_settings');
470
+		$this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE);
471 471
 		$this->_template_args['template_args'] = $this->_template_args;
472
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( GEN_SET_TEMPLATE_PATH . 'admin_option_settings.template.php', $this->_template_args, TRUE );
472
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template(GEN_SET_TEMPLATE_PATH.'admin_option_settings.template.php', $this->_template_args, TRUE);
473 473
 		$this->display_admin_page_with_sidebar();
474 474
 	}
475 475
 
476 476
 	protected function _update_admin_option_settings() {
477
-		EE_Registry::instance()->CFG->admin->use_personnel_manager = isset( $this->_req_data['use_personnel_manager'] ) ? absint( $this->_req_data['use_personnel_manager'] ) : EE_Registry::instance()->CFG->admin->use_personnel_manager;
478
-		EE_Registry::instance()->CFG->admin->use_dashboard_widget = isset( $this->_req_data['use_dashboard_widget'] ) ? absint( $this->_req_data['use_dashboard_widget'] ) : EE_Registry::instance()->CFG->admin->use_dashboard_widget;
479
-		EE_Registry::instance()->CFG->admin->events_in_dashboard = isset( $this->_req_data['events_in_dashboard'] ) ? absint( $this->_req_data['events_in_dashboard'] ) : EE_Registry::instance()->CFG->admin->events_in_dashboard;
480
-		EE_Registry::instance()->CFG->admin->use_event_timezones = isset( $this->_req_data['use_event_timezones'] ) ? absint( $this->_req_data['use_event_timezones'] ) : EE_Registry::instance()->CFG->admin->use_event_timezones;
481
-		EE_Registry::instance()->CFG->admin->show_reg_footer = isset( $this->_req_data['show_reg_footer'] ) ? absint( $this->_req_data['show_reg_footer'] ) : EE_Registry::instance()->CFG->admin->show_reg_footer;
482
-		EE_Registry::instance()->CFG->admin->affiliate_id = isset( $this->_req_data['affiliate_id'] ) ? sanitize_text_field( $this->_req_data['affiliate_id'] ) : EE_Registry::instance()->CFG->admin->affiliate_id;
483
-		EE_Registry::instance()->CFG->admin->help_tour_activation = isset( $this->_req_data['help_tour_activation'] ) ? absint( $this->_req_data['help_tour_activation'] ) : EE_Registry::instance()->CFG->admin->help_tour_activation;
477
+		EE_Registry::instance()->CFG->admin->use_personnel_manager = isset($this->_req_data['use_personnel_manager']) ? absint($this->_req_data['use_personnel_manager']) : EE_Registry::instance()->CFG->admin->use_personnel_manager;
478
+		EE_Registry::instance()->CFG->admin->use_dashboard_widget = isset($this->_req_data['use_dashboard_widget']) ? absint($this->_req_data['use_dashboard_widget']) : EE_Registry::instance()->CFG->admin->use_dashboard_widget;
479
+		EE_Registry::instance()->CFG->admin->events_in_dashboard = isset($this->_req_data['events_in_dashboard']) ? absint($this->_req_data['events_in_dashboard']) : EE_Registry::instance()->CFG->admin->events_in_dashboard;
480
+		EE_Registry::instance()->CFG->admin->use_event_timezones = isset($this->_req_data['use_event_timezones']) ? absint($this->_req_data['use_event_timezones']) : EE_Registry::instance()->CFG->admin->use_event_timezones;
481
+		EE_Registry::instance()->CFG->admin->show_reg_footer = isset($this->_req_data['show_reg_footer']) ? absint($this->_req_data['show_reg_footer']) : EE_Registry::instance()->CFG->admin->show_reg_footer;
482
+		EE_Registry::instance()->CFG->admin->affiliate_id = isset($this->_req_data['affiliate_id']) ? sanitize_text_field($this->_req_data['affiliate_id']) : EE_Registry::instance()->CFG->admin->affiliate_id;
483
+		EE_Registry::instance()->CFG->admin->help_tour_activation = isset($this->_req_data['help_tour_activation']) ? absint($this->_req_data['help_tour_activation']) : EE_Registry::instance()->CFG->admin->help_tour_activation;
484 484
 
485
-		EE_Registry::instance()->CFG->admin = apply_filters( 'FHEE__General_Settings_Admin_Page___update_admin_option_settings__CFG_admin', EE_Registry::instance()->CFG->admin );
485
+		EE_Registry::instance()->CFG->admin = apply_filters('FHEE__General_Settings_Admin_Page___update_admin_option_settings__CFG_admin', EE_Registry::instance()->CFG->admin);
486 486
 
487 487
 		$what = 'Admin Options';
488
-		$success = $this->_update_espresso_configuration( $what, EE_Registry::instance()->CFG->admin, __FILE__, __FUNCTION__, __LINE__ );
489
-		$success = apply_filters( 'FHEE__General_Settings_Admin_Page___update_admin_option_settings__success', $success );
490
-		$this->_redirect_after_action( $success, $what, 'updated', array( 'action' => 'admin_option_settings' ) );
488
+		$success = $this->_update_espresso_configuration($what, EE_Registry::instance()->CFG->admin, __FILE__, __FUNCTION__, __LINE__);
489
+		$success = apply_filters('FHEE__General_Settings_Admin_Page___update_admin_option_settings__success', $success);
490
+		$this->_redirect_after_action($success, $what, 'updated', array('action' => 'admin_option_settings'));
491 491
 
492 492
 	}
493 493
 
@@ -500,21 +500,21 @@  discard block
 block discarded – undo
500 500
 
501 501
 	protected function _country_settings() {
502 502
 
503
-		$CNT_ISO = isset( EE_Registry::instance()->CFG->organization->CNT_ISO ) ? EE_Registry::instance()->CFG->organization->CNT_ISO : 'US';
504
-		$CNT_ISO = isset( $this->_req_data['country'] ) ? strtoupper( sanitize_text_field( $this->_req_data['country'] )) : $CNT_ISO;
503
+		$CNT_ISO = isset(EE_Registry::instance()->CFG->organization->CNT_ISO) ? EE_Registry::instance()->CFG->organization->CNT_ISO : 'US';
504
+		$CNT_ISO = isset($this->_req_data['country']) ? strtoupper(sanitize_text_field($this->_req_data['country'])) : $CNT_ISO;
505 505
 
506 506
 		//load field generator helper
507
-		EE_Registry::instance()->load_helper( 'Form_Fields' );
507
+		EE_Registry::instance()->load_helper('Form_Fields');
508 508
 
509 509
 		$this->_template_args['values'] = $this->_yes_no_values;
510 510
 
511 511
 		$this->_template_args['countries'] = new EE_Question_Form_Input(
512
-				EE_Question::new_instance ( array(
512
+				EE_Question::new_instance(array(
513 513
 					'QST_ID'=> 0,
514 514
 					'QST_display_text'=> __('Select Country', 'event_espresso'),
515 515
 					'QST_system'=>'admin-country'
516 516
 				)),
517
-				EE_Answer::new_instance ( array(
517
+				EE_Answer::new_instance(array(
518 518
 					'ANS_ID' => 0,
519 519
 					'ANS_value' => $CNT_ISO
520 520
 				)),
@@ -527,14 +527,14 @@  discard block
 block discarded – undo
527 527
 			);
528 528
 //		EEH_Debug_Tools::printr( $this->_template_args['countries'], 'countries  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
529 529
 
530
-		add_filter( 'FHEE__EEH_Form_Fields__label_html', array( $this, 'country_form_field_label_wrap' ), 10, 2 );
531
-		add_filter( 'FHEE__EEH_Form_Fields__input_html', array( $this, 'country_form_field_input__wrap' ), 10, 2 );
530
+		add_filter('FHEE__EEH_Form_Fields__label_html', array($this, 'country_form_field_label_wrap'), 10, 2);
531
+		add_filter('FHEE__EEH_Form_Fields__input_html', array($this, 'country_form_field_input__wrap'), 10, 2);
532 532
 		$this->_template_args['country_details_settings'] = $this->display_country_settings();
533 533
 		$this->_template_args['country_states_settings'] = $this->display_country_states();
534 534
 
535
-		$this->_set_add_edit_form_tags( 'update_country_settings' );
536
-		$this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE );
537
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( GEN_SET_TEMPLATE_PATH . 'countries_settings.template.php', $this->_template_args, TRUE );
535
+		$this->_set_add_edit_form_tags('update_country_settings');
536
+		$this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE);
537
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template(GEN_SET_TEMPLATE_PATH.'countries_settings.template.php', $this->_template_args, TRUE);
538 538
 		$this->display_admin_page_with_no_sidebar();
539 539
 	}
540 540
 
@@ -547,44 +547,44 @@  discard block
 block discarded – undo
547 547
 	 * 		@param 	string 		$CNT_ISO
548 548
 	 * 		@return 		mixed		string | array
549 549
 	 */
550
-	public function display_country_settings( $CNT_ISO = '' ) {
550
+	public function display_country_settings($CNT_ISO = '') {
551 551
 
552
-		$CNT_ISO = isset( $this->_req_data['country'] ) ? strtoupper( sanitize_text_field( $this->_req_data['country'] )) : $CNT_ISO;
553
-		if ( ! $CNT_ISO ) {
552
+		$CNT_ISO = isset($this->_req_data['country']) ? strtoupper(sanitize_text_field($this->_req_data['country'])) : $CNT_ISO;
553
+		if ( ! $CNT_ISO) {
554 554
 			return '';
555 555
 		}
556 556
 
557 557
 		// for ajax
558
-		EE_Registry::instance()->load_helper( 'Form_Fields' );
559
-		remove_all_filters( 'FHEE__EEH_Form_Fields__label_html' );
560
-		remove_all_filters( 'FHEE__EEH_Form_Fields__input_html' );
561
-		add_filter( 'FHEE__EEH_Form_Fields__label_html', array( $this, 'country_form_field_label_wrap' ), 10, 2 );
562
-		add_filter( 'FHEE__EEH_Form_Fields__input_html', array( $this, 'country_form_field_input__wrap' ), 10, 2 );
563
-		$country = EEM_Country::instance()->get_one_by_ID( $CNT_ISO );
558
+		EE_Registry::instance()->load_helper('Form_Fields');
559
+		remove_all_filters('FHEE__EEH_Form_Fields__label_html');
560
+		remove_all_filters('FHEE__EEH_Form_Fields__input_html');
561
+		add_filter('FHEE__EEH_Form_Fields__label_html', array($this, 'country_form_field_label_wrap'), 10, 2);
562
+		add_filter('FHEE__EEH_Form_Fields__input_html', array($this, 'country_form_field_input__wrap'), 10, 2);
563
+		$country = EEM_Country::instance()->get_one_by_ID($CNT_ISO);
564 564
 		//EEH_Debug_Tools::printr( $country, '$country  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
565 565
 		$country_input_types = array(
566
-			'CNT_active' => array( 'type' => 'RADIO_BTN', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => '', 'options' => $this->_yes_no_values, 'use_desc_4_label' => TRUE  ),
567
-			'CNT_ISO' => array( 'type' => 'TEXT', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => 'small-text' ),
568
-			'CNT_ISO3' => array( 'type' => 'TEXT', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => 'small-text' ),
569
-			'RGN_ID' => array( 'type' => 'TEXT', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => 'small-text' ),
570
-			'CNT_name' => array( 'type' => 'TEXT', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => 'regular-text' ),
571
-			'CNT_cur_code' => array( 'type' => 'TEXT', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => 'small-text' ),
572
-			'CNT_cur_single' => array( 'type' => 'TEXT', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => 'medium-text' ),
573
-			'CNT_cur_plural' => array( 'type' => 'TEXT', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => 'medium-text' ),
574
-			'CNT_cur_sign' => array( 'type' => 'TEXT', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => 'small-text', 'htmlentities' => FALSE ),
575
-			'CNT_cur_sign_b4' => array( 'type' => 'RADIO_BTN', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => '', 'options' => $this->_yes_no_values, 'use_desc_4_label' => TRUE ),
576
-			'CNT_cur_dec_plc' => array( 'type' => 'RADIO_BTN', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => '', 'options' => array( array( 'id' => 0, 'text' => '' ), array( 'id' => 1, 'text' => '' ), array( 'id' => 2, 'text' => '' ), array( 'id' => 3, 'text' => '' ))),
577
-			'CNT_cur_dec_mrk' => array( 'type' => 'RADIO_BTN', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => '', 'options' => array( array( 'id' => ',', 'text' => __(', (comma)', 'event_espresso')), array( 'id' => '.', 'text' => __('. (decimal)', 'event_espresso'))), 'use_desc_4_label' => TRUE ),
578
-			'CNT_cur_thsnds' => array( 'type' => 'RADIO_BTN', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => '', 'options' => array( array( 'id' => ',', 'text' => __(', (comma)', 'event_espresso')), array( 'id' => '.', 'text' => __('. (decimal)', 'event_espresso'))), 'use_desc_4_label' => TRUE ),
579
-			'CNT_tel_code' => array( 'type' => 'TEXT', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => 'small-text' ),
580
-			'CNT_is_EU' => array( 'type' => 'RADIO_BTN', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => '', 'options' => $this->_yes_no_values, 'use_desc_4_label' => TRUE  )
566
+			'CNT_active' => array('type' => 'RADIO_BTN', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => '', 'options' => $this->_yes_no_values, 'use_desc_4_label' => TRUE),
567
+			'CNT_ISO' => array('type' => 'TEXT', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => 'small-text'),
568
+			'CNT_ISO3' => array('type' => 'TEXT', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => 'small-text'),
569
+			'RGN_ID' => array('type' => 'TEXT', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => 'small-text'),
570
+			'CNT_name' => array('type' => 'TEXT', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => 'regular-text'),
571
+			'CNT_cur_code' => array('type' => 'TEXT', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => 'small-text'),
572
+			'CNT_cur_single' => array('type' => 'TEXT', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => 'medium-text'),
573
+			'CNT_cur_plural' => array('type' => 'TEXT', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => 'medium-text'),
574
+			'CNT_cur_sign' => array('type' => 'TEXT', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => 'small-text', 'htmlentities' => FALSE),
575
+			'CNT_cur_sign_b4' => array('type' => 'RADIO_BTN', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => '', 'options' => $this->_yes_no_values, 'use_desc_4_label' => TRUE),
576
+			'CNT_cur_dec_plc' => array('type' => 'RADIO_BTN', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => '', 'options' => array(array('id' => 0, 'text' => ''), array('id' => 1, 'text' => ''), array('id' => 2, 'text' => ''), array('id' => 3, 'text' => ''))),
577
+			'CNT_cur_dec_mrk' => array('type' => 'RADIO_BTN', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => '', 'options' => array(array('id' => ',', 'text' => __(', (comma)', 'event_espresso')), array('id' => '.', 'text' => __('. (decimal)', 'event_espresso'))), 'use_desc_4_label' => TRUE),
578
+			'CNT_cur_thsnds' => array('type' => 'RADIO_BTN', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => '', 'options' => array(array('id' => ',', 'text' => __(', (comma)', 'event_espresso')), array('id' => '.', 'text' => __('. (decimal)', 'event_espresso'))), 'use_desc_4_label' => TRUE),
579
+			'CNT_tel_code' => array('type' => 'TEXT', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => 'small-text'),
580
+			'CNT_is_EU' => array('type' => 'RADIO_BTN', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => '', 'options' => $this->_yes_no_values, 'use_desc_4_label' => TRUE)
581 581
 		);
582
-		$this->_template_args['inputs'] = EE_Question_Form_Input::generate_question_form_inputs_for_object( $country, $country_input_types );
583
-		$country_details_settings = EEH_Template::display_template( GEN_SET_TEMPLATE_PATH . 'country_details_settings.template.php', $this->_template_args, TRUE );
582
+		$this->_template_args['inputs'] = EE_Question_Form_Input::generate_question_form_inputs_for_object($country, $country_input_types);
583
+		$country_details_settings = EEH_Template::display_template(GEN_SET_TEMPLATE_PATH.'country_details_settings.template.php', $this->_template_args, TRUE);
584 584
 
585
-		if ( defined( 'DOING_AJAX' )) {
586
-			$notices = EE_Error::get_notices( FALSE, FALSE, FALSE );
587
-			echo json_encode( array( 'return_data' => $country_details_settings, 'success' => $notices['success'], 'errors' => $notices['errors'] ));
585
+		if (defined('DOING_AJAX')) {
586
+			$notices = EE_Error::get_notices(FALSE, FALSE, FALSE);
587
+			echo json_encode(array('return_data' => $country_details_settings, 'success' => $notices['success'], 'errors' => $notices['errors']));
588 588
 			die();
589 589
 		} else {
590 590
 			return $country_details_settings;
@@ -602,50 +602,50 @@  discard block
 block discarded – undo
602 602
 	 * 		@param 	string 		$CNT_ISO
603 603
 	 * 		@return 		string
604 604
 	 */
605
-	public function display_country_states( $CNT_ISO = '' ) {
605
+	public function display_country_states($CNT_ISO = '') {
606 606
 
607
-		$CNT_ISO = isset( $this->_req_data['country'] ) ? sanitize_text_field( $this->_req_data['country'] ) : $CNT_ISO;
607
+		$CNT_ISO = isset($this->_req_data['country']) ? sanitize_text_field($this->_req_data['country']) : $CNT_ISO;
608 608
 
609
-		if ( ! $CNT_ISO ) {
609
+		if ( ! $CNT_ISO) {
610 610
 			return '';
611 611
 		}
612 612
 		// for ajax
613
-		EE_Registry::instance()->load_helper( 'Form_Fields' );
614
-		remove_all_filters( 'FHEE__EEH_Form_Fields__label_html' );
615
-		remove_all_filters( 'FHEE__EEH_Form_Fields__input_html' );
616
-		add_filter( 'FHEE__EEH_Form_Fields__label_html', array( $this, 'state_form_field_label_wrap' ), 10, 2 );
617
-		add_filter( 'FHEE__EEH_Form_Fields__input_html', array( $this, 'state_form_field_input__wrap' ), 10, 2 );
618
-		$states = EEM_State::instance()->get_all_states_for_these_countries( array( $CNT_ISO => $CNT_ISO ));
613
+		EE_Registry::instance()->load_helper('Form_Fields');
614
+		remove_all_filters('FHEE__EEH_Form_Fields__label_html');
615
+		remove_all_filters('FHEE__EEH_Form_Fields__input_html');
616
+		add_filter('FHEE__EEH_Form_Fields__label_html', array($this, 'state_form_field_label_wrap'), 10, 2);
617
+		add_filter('FHEE__EEH_Form_Fields__input_html', array($this, 'state_form_field_input__wrap'), 10, 2);
618
+		$states = EEM_State::instance()->get_all_states_for_these_countries(array($CNT_ISO => $CNT_ISO));
619 619
 
620 620
 //			echo '<h4>$CNT_ISO : ' . $CNT_ISO . '  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>';
621 621
 //			global $wpdb;
622 622
 //			echo '<h4>' . $wpdb->last_query . '  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>';
623 623
 //			EEH_Debug_Tools::printr( $states, '$states  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
624
-		if ( $states ) {
625
-			foreach ( $states as $STA_ID => $state ) {
626
-				if ( $state instanceof EE_State ) {
624
+		if ($states) {
625
+			foreach ($states as $STA_ID => $state) {
626
+				if ($state instanceof EE_State) {
627 627
 					//STA_abbrev 	STA_name 	STA_active
628 628
 					$state_input_types = array(
629
-						'STA_abbrev' => array( 'type' => 'TEXT', 'input_name' => 'states[' . $STA_ID . ']', 'class' => 'mid-text' ),
630
-						'STA_name'   => array( 'type'       => 'TEXT', 'input_name' => 'states[' . $STA_ID . ']', 'class' => 'regular-text' ),
631
-						'STA_active' => array( 'type' => 'RADIO_BTN', 'input_name' => 'states[' . $STA_ID . ']', 'options' => $this->_yes_no_values, 'use_desc_4_label' => true )
629
+						'STA_abbrev' => array('type' => 'TEXT', 'input_name' => 'states['.$STA_ID.']', 'class' => 'mid-text'),
630
+						'STA_name'   => array('type'       => 'TEXT', 'input_name' => 'states['.$STA_ID.']', 'class' => 'regular-text'),
631
+						'STA_active' => array('type' => 'RADIO_BTN', 'input_name' => 'states['.$STA_ID.']', 'options' => $this->_yes_no_values, 'use_desc_4_label' => true)
632 632
 					);
633
-					$this->_template_args[ 'states' ][ $STA_ID ][ 'inputs' ] = EE_Question_Form_Input::generate_question_form_inputs_for_object( $state, $state_input_types );
634
-					$query_args = array( 'action'     => 'delete_state', 'STA_ID' => $STA_ID, 'CNT_ISO' => $CNT_ISO, 'STA_abbrev' => $state->abbrev() );
635
-					$this->_template_args[ 'states' ][ $STA_ID ][ 'delete_state_url' ] = EE_Admin_Page::add_query_args_and_nonce( $query_args, GEN_SET_ADMIN_URL );
633
+					$this->_template_args['states'][$STA_ID]['inputs'] = EE_Question_Form_Input::generate_question_form_inputs_for_object($state, $state_input_types);
634
+					$query_args = array('action'     => 'delete_state', 'STA_ID' => $STA_ID, 'CNT_ISO' => $CNT_ISO, 'STA_abbrev' => $state->abbrev());
635
+					$this->_template_args['states'][$STA_ID]['delete_state_url'] = EE_Admin_Page::add_query_args_and_nonce($query_args, GEN_SET_ADMIN_URL);
636 636
 				}
637 637
 			}
638 638
 		} else {
639 639
 			$this->_template_args['states'] = FALSE;
640 640
 		}
641 641
 //		EEH_Debug_Tools::printr( $this->_template_args['states'], 'states  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
642
-		$this->_template_args['add_new_state_url'] = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'add_new_state' ),  GEN_SET_ADMIN_URL );
642
+		$this->_template_args['add_new_state_url'] = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'add_new_state'), GEN_SET_ADMIN_URL);
643 643
 
644
-		$state_details_settings = EEH_Template::display_template( GEN_SET_TEMPLATE_PATH . 'state_details_settings.template.php', $this->_template_args, TRUE );
644
+		$state_details_settings = EEH_Template::display_template(GEN_SET_TEMPLATE_PATH.'state_details_settings.template.php', $this->_template_args, TRUE);
645 645
 
646
-		if ( defined( 'DOING_AJAX' )) {
647
-			$notices = EE_Error::get_notices( FALSE, FALSE, FALSE );
648
-			echo json_encode( array( 'return_data' => $state_details_settings, 'success' => $notices['success'], 'errors' => $notices['errors'] ));
646
+		if (defined('DOING_AJAX')) {
647
+			$notices = EE_Error::get_notices(FALSE, FALSE, FALSE);
648
+			echo json_encode(array('return_data' => $state_details_settings, 'success' => $notices['success'], 'errors' => $notices['errors']));
649 649
 			die();
650 650
 		} else {
651 651
 			return $state_details_settings;
@@ -666,40 +666,39 @@  discard block
 block discarded – undo
666 666
 
667 667
 		$success = TRUE;
668 668
 
669
-		$CNT_ISO = isset( $this->_req_data['CNT_ISO'] ) ? strtoupper( sanitize_text_field( $this->_req_data['CNT_ISO'] )) : FALSE;
670
-		if ( ! $CNT_ISO ) {
671
-			EE_Error::add_error( __( 'No Country ISO code or an invalid Country ISO code was received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
669
+		$CNT_ISO = isset($this->_req_data['CNT_ISO']) ? strtoupper(sanitize_text_field($this->_req_data['CNT_ISO'])) : FALSE;
670
+		if ( ! $CNT_ISO) {
671
+			EE_Error::add_error(__('No Country ISO code or an invalid Country ISO code was received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
672 672
 			$success = FALSE;
673 673
 		}
674
-		$STA_abbrev = isset( $this->_req_data['STA_abbrev'] ) ? sanitize_text_field( $this->_req_data['STA_abbrev'] ) : FALSE;
675
-		if ( ! $STA_abbrev ) {
676
-			EE_Error::add_error( __( 'No State ISO code or an invalid State ISO code was received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
674
+		$STA_abbrev = isset($this->_req_data['STA_abbrev']) ? sanitize_text_field($this->_req_data['STA_abbrev']) : FALSE;
675
+		if ( ! $STA_abbrev) {
676
+			EE_Error::add_error(__('No State ISO code or an invalid State ISO code was received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
677 677
 			$success = FALSE;
678 678
 		}
679
-		$STA_name = isset( $this->_req_data['STA_name'] ) ?  sanitize_text_field( $this->_req_data['STA_name'] ) :
680
-			FALSE;
681
-		if ( ! $STA_name ) {
682
-			EE_Error::add_error( __( 'No State name or an invalid State name was received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
679
+		$STA_name = isset($this->_req_data['STA_name']) ? sanitize_text_field($this->_req_data['STA_name']) : FALSE;
680
+		if ( ! $STA_name) {
681
+			EE_Error::add_error(__('No State name or an invalid State name was received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
683 682
 			$success = FALSE;
684 683
 		}
685 684
 
686
-		if ( $success ) {
685
+		if ($success) {
687 686
 			$cols_n_values = array(
688 687
 				'CNT_ISO' => $CNT_ISO,
689 688
 				'STA_abbrev' => $STA_abbrev,
690 689
 				'STA_name' => $STA_name,
691 690
 				'STA_active' => TRUE
692 691
 			);
693
-			$success = EEM_State::instance()->insert ( $cols_n_values );
694
-			EE_Error::add_success( __( 'The State was added successfully.', 'event_espresso' ) );
692
+			$success = EEM_State::instance()->insert($cols_n_values);
693
+			EE_Error::add_success(__('The State was added successfully.', 'event_espresso'));
695 694
 		}
696 695
 
697
-		if ( defined( 'DOING_AJAX' )) {
698
-			$notices = EE_Error::get_notices( FALSE, FALSE, FALSE );
699
-			echo json_encode( array_merge( $notices, array( 'return_data' => $CNT_ISO ) ) );
696
+		if (defined('DOING_AJAX')) {
697
+			$notices = EE_Error::get_notices(FALSE, FALSE, FALSE);
698
+			echo json_encode(array_merge($notices, array('return_data' => $CNT_ISO)));
700 699
 			die();
701 700
 		} else {
702
-			$this->_redirect_after_action( $success, 'State', 'added', array( 'action' => 'country_settings' ) );
701
+			$this->_redirect_after_action($success, 'State', 'added', array('action' => 'country_settings'));
703 702
 		}
704 703
 	}
705 704
 
@@ -712,25 +711,25 @@  discard block
 block discarded – undo
712 711
 	 * 		@return 		boolean | void
713 712
 	 */
714 713
 	public function delete_state() {
715
-		$CNT_ISO = isset( $this->_req_data['CNT_ISO'] ) ? strtoupper( sanitize_text_field( $this->_req_data['CNT_ISO'] )) : FALSE;
716
-		$STA_ID = isset( $this->_req_data['STA_ID'] ) ? sanitize_text_field( $this->_req_data['STA_ID'] ) : FALSE;
717
-		$STA_abbrev = isset( $this->_req_data['STA_abbrev'] ) ? sanitize_text_field( $this->_req_data['STA_abbrev'] ) : FALSE;
718
-		if ( ! $STA_ID ) {
719
-			EE_Error::add_error( __( 'No State ID or an invalid State ID was received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
714
+		$CNT_ISO = isset($this->_req_data['CNT_ISO']) ? strtoupper(sanitize_text_field($this->_req_data['CNT_ISO'])) : FALSE;
715
+		$STA_ID = isset($this->_req_data['STA_ID']) ? sanitize_text_field($this->_req_data['STA_ID']) : FALSE;
716
+		$STA_abbrev = isset($this->_req_data['STA_abbrev']) ? sanitize_text_field($this->_req_data['STA_abbrev']) : FALSE;
717
+		if ( ! $STA_ID) {
718
+			EE_Error::add_error(__('No State ID or an invalid State ID was received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
720 719
 			return FALSE;
721 720
 		}
722
-		$success = EEM_State::instance()->delete_by_ID( $STA_ID );
723
-		if ( $success !== FALSE ) {
724
-			do_action( 'AHEE__General_Settings_Admin_Page__delete_state__state_deleted', $CNT_ISO, $STA_ID, array( 'STA_abbrev' => $STA_abbrev ));
725
-			EE_Error::add_success( __( 'The State was deleted successfully.', 'event_espresso' ));
721
+		$success = EEM_State::instance()->delete_by_ID($STA_ID);
722
+		if ($success !== FALSE) {
723
+			do_action('AHEE__General_Settings_Admin_Page__delete_state__state_deleted', $CNT_ISO, $STA_ID, array('STA_abbrev' => $STA_abbrev));
724
+			EE_Error::add_success(__('The State was deleted successfully.', 'event_espresso'));
726 725
 		}
727
-		if ( defined( 'DOING_AJAX' )) {
728
-			$notices = EE_Error::get_notices( FALSE, FALSE );
726
+		if (defined('DOING_AJAX')) {
727
+			$notices = EE_Error::get_notices(FALSE, FALSE);
729 728
 			$notices['return_data'] = TRUE;
730
-			echo json_encode( $notices );
729
+			echo json_encode($notices);
731 730
 			die();
732 731
 		} else {
733
-			$this->_redirect_after_action( $success, 'State', 'deleted', array( 'action' => 'country_settings' ) );
732
+			$this->_redirect_after_action($success, 'State', 'deleted', array('action' => 'country_settings'));
734 733
 		}
735 734
 	}
736 735
 
@@ -746,63 +745,63 @@  discard block
 block discarded – undo
746 745
 	protected function _update_country_settings() {
747 746
 //		EEH_Debug_Tools::printr( $this->_req_data, '$this->_req_data  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
748 747
 		// grab the country ISO code
749
-		$CNT_ISO = isset( $this->_req_data['country'] ) ? strtoupper( sanitize_text_field( $this->_req_data['country'] )) : FALSE;
750
-		if ( ! $CNT_ISO ) {
751
-			EE_Error::add_error( __( 'No Country ISO code or an invalid Country ISO code was received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
748
+		$CNT_ISO = isset($this->_req_data['country']) ? strtoupper(sanitize_text_field($this->_req_data['country'])) : FALSE;
749
+		if ( ! $CNT_ISO) {
750
+			EE_Error::add_error(__('No Country ISO code or an invalid Country ISO code was received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
752 751
 			return;
753 752
 		}
754 753
 		$cols_n_values = array();
755
-		$cols_n_values['CNT_ISO3'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_ISO3'] ) ? strtoupper( sanitize_text_field( $this->_req_data['cntry'][$CNT_ISO]['CNT_ISO3'] )) : FALSE;
756
-		$cols_n_values['RGN_ID'] = isset( $this->_req_data['cntry'][$CNT_ISO]['RGN_ID'] ) ? absint( $this->_req_data['cntry'][$CNT_ISO]['RGN_ID'] ) : NULL;
757
-		$cols_n_values['CNT_name'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_name'] ) ? sanitize_text_field( $this->_req_data['cntry'][$CNT_ISO]['CNT_name'] ) : NULL;
758
-		$cols_n_values['CNT_cur_code'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_code'] ) ? strtoupper( sanitize_text_field( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_code'] )) : 'USD';
759
-		$cols_n_values['CNT_cur_single'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_single'] ) ? sanitize_text_field( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_single'] ) : 'dollar';
760
-		$cols_n_values['CNT_cur_plural'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_plural'] ) ? sanitize_text_field( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_plural'] ) : 'dollars';
761
-		$cols_n_values['CNT_cur_sign'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_sign'] ) ? sanitize_text_field( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_sign'] ) : '$';
762
-		$cols_n_values['CNT_cur_sign_b4'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_sign_b4'] ) ? absint( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_sign_b4'] ) : TRUE;
763
-		$cols_n_values['CNT_cur_dec_plc'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_dec_plc'] ) ? absint( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_dec_plc'] ) : 2;
764
-		$cols_n_values['CNT_cur_dec_mrk'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_dec_mrk'] ) ? sanitize_text_field( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_dec_mrk'] ) : '.';
765
-		$cols_n_values['CNT_cur_thsnds'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_thsnds'] ) ? sanitize_text_field( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_thsnds'] ) : ',';
766
-		$cols_n_values['CNT_tel_code'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_tel_code'] ) ? sanitize_text_field( $this->_req_data['cntry'][$CNT_ISO]['CNT_tel_code'] ) : NULL;
767
-		$cols_n_values['CNT_is_EU'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_is_EU'] ) ? absint( $this->_req_data['cntry'][$CNT_ISO]['CNT_is_EU'] ) : FALSE;
768
-		$cols_n_values['CNT_active'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_active'] ) ? absint( $this->_req_data['cntry'][$CNT_ISO]['CNT_active'] ) : FALSE;
754
+		$cols_n_values['CNT_ISO3'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_ISO3']) ? strtoupper(sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_ISO3'])) : FALSE;
755
+		$cols_n_values['RGN_ID'] = isset($this->_req_data['cntry'][$CNT_ISO]['RGN_ID']) ? absint($this->_req_data['cntry'][$CNT_ISO]['RGN_ID']) : NULL;
756
+		$cols_n_values['CNT_name'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_name']) ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_name']) : NULL;
757
+		$cols_n_values['CNT_cur_code'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_code']) ? strtoupper(sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_code'])) : 'USD';
758
+		$cols_n_values['CNT_cur_single'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_single']) ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_single']) : 'dollar';
759
+		$cols_n_values['CNT_cur_plural'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_plural']) ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_plural']) : 'dollars';
760
+		$cols_n_values['CNT_cur_sign'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_sign']) ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_sign']) : '$';
761
+		$cols_n_values['CNT_cur_sign_b4'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_sign_b4']) ? absint($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_sign_b4']) : TRUE;
762
+		$cols_n_values['CNT_cur_dec_plc'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_dec_plc']) ? absint($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_dec_plc']) : 2;
763
+		$cols_n_values['CNT_cur_dec_mrk'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_dec_mrk']) ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_dec_mrk']) : '.';
764
+		$cols_n_values['CNT_cur_thsnds'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_thsnds']) ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_thsnds']) : ',';
765
+		$cols_n_values['CNT_tel_code'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_tel_code']) ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_tel_code']) : NULL;
766
+		$cols_n_values['CNT_is_EU'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_is_EU']) ? absint($this->_req_data['cntry'][$CNT_ISO]['CNT_is_EU']) : FALSE;
767
+		$cols_n_values['CNT_active'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_active']) ? absint($this->_req_data['cntry'][$CNT_ISO]['CNT_active']) : FALSE;
769 768
 		// allow filtering of country data
770
-		$cols_n_values = apply_filters( 'FHEE__General_Settings_Admin_Page___update_country_settings__cols_n_values', $cols_n_values );
769
+		$cols_n_values = apply_filters('FHEE__General_Settings_Admin_Page___update_country_settings__cols_n_values', $cols_n_values);
771 770
 		//EEH_Debug_Tools::printr( $cols_n_values, '$cols_n_values  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
772 771
 		// where values
773
-		$where_cols_n_values = array( array( 'CNT_ISO' => $CNT_ISO ));
772
+		$where_cols_n_values = array(array('CNT_ISO' => $CNT_ISO));
774 773
 		// run the update
775
-		$success = EEM_Country::instance()->update( $cols_n_values, $where_cols_n_values );
774
+		$success = EEM_Country::instance()->update($cols_n_values, $where_cols_n_values);
776 775
 //		global $wpdb;
777 776
 //		echo '<h4>' . $wpdb->last_query . '  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>';
778 777
 //		echo '<h4>$success : ' . $success . '  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>';
779
-		if ( isset( $this->_req_data['states'] ) && is_array( $this->_req_data['states'] ) && $success !== FALSE ) {
778
+		if (isset($this->_req_data['states']) && is_array($this->_req_data['states']) && $success !== FALSE) {
780 779
 			// allow filtering of states data
781
-			$states = apply_filters( 'FHEE__General_Settings_Admin_Page___update_country_settings__states', $this->_req_data['states'] );
780
+			$states = apply_filters('FHEE__General_Settings_Admin_Page___update_country_settings__states', $this->_req_data['states']);
782 781
 //			EEH_Debug_Tools::printr( $states, '$states  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
783 782
 			// loop thru state data ( looks like : states[75][STA_name] )
784
-			foreach( $states as $STA_ID => $state ) {
783
+			foreach ($states as $STA_ID => $state) {
785 784
 				$cols_n_values = array(
786 785
 					'CNT_ISO' 		=> $CNT_ISO,
787
-					'STA_abbrev' => sanitize_text_field( $state['STA_abbrev'] ),
788
-					'STA_name' 	=> sanitize_text_field( $state['STA_name'] ),
789
-					'STA_active' 	=> (bool)absint( $state['STA_active'] )
786
+					'STA_abbrev' => sanitize_text_field($state['STA_abbrev']),
787
+					'STA_name' 	=> sanitize_text_field($state['STA_name']),
788
+					'STA_active' 	=> (bool) absint($state['STA_active'])
790 789
 				);
791 790
 				// where values
792
-				$where_cols_n_values = array( array( 'STA_ID' => $STA_ID ));
791
+				$where_cols_n_values = array(array('STA_ID' => $STA_ID));
793 792
 				// run the update
794
-				$success = EEM_State::instance()->update( $cols_n_values, $where_cols_n_values );
795
-				if ( $success !== FALSE ) {
796
-					do_action( 'AHEE__General_Settings_Admin_Page__update_country_settings__state_saved', $CNT_ISO, $STA_ID, $cols_n_values );
793
+				$success = EEM_State::instance()->update($cols_n_values, $where_cols_n_values);
794
+				if ($success !== FALSE) {
795
+					do_action('AHEE__General_Settings_Admin_Page__update_country_settings__state_saved', $CNT_ISO, $STA_ID, $cols_n_values);
797 796
 				}
798 797
 			}
799 798
 		}
800 799
 		// check if country being edited matches org option country, and if so, then  update EE_Config with new settings
801
-		if ( isset( EE_Registry::instance()->CFG->organization->CNT_ISO ) && $CNT_ISO == EE_Registry::instance()->CFG->organization->CNT_ISO ) {
802
-			EE_Registry::instance()->CFG->currency = new EE_Currency_Config( $CNT_ISO );
800
+		if (isset(EE_Registry::instance()->CFG->organization->CNT_ISO) && $CNT_ISO == EE_Registry::instance()->CFG->organization->CNT_ISO) {
801
+			EE_Registry::instance()->CFG->currency = new EE_Currency_Config($CNT_ISO);
803 802
 			EE_Registry::instance()->CFG->update_espresso_config();
804 803
 		}
805
-		$this->_redirect_after_action( $success, 'Countries', 'updated', array( 'action' => 'country_settings', 'country' => $CNT_ISO ));
804
+		$this->_redirect_after_action($success, 'Countries', 'updated', array('action' => 'country_settings', 'country' => $CNT_ISO));
806 805
 	}
807 806
 
808 807
 
@@ -816,11 +815,11 @@  discard block
 block discarded – undo
816 815
 	 * 		@param 		string 		$label
817 816
 	 * 		@return 		string
818 817
 	 */
819
-	public function country_form_field_label_wrap( $label, $required_text ) {
818
+	public function country_form_field_label_wrap($label, $required_text) {
820 819
 		return '
821 820
 			<tr>
822 821
 				<th>
823
-					' . $label  . '
822
+					' . $label.'
824 823
 				</th>';
825 824
 	}
826 825
 
@@ -834,10 +833,10 @@  discard block
 block discarded – undo
834 833
 	 * 		@param 		string 		$label
835 834
 	 * 		@return 		string
836 835
 	 */
837
-	public function country_form_field_input__wrap( $input, $label ) {
836
+	public function country_form_field_input__wrap($input, $label) {
838 837
 		return '
839 838
 				<td class="general-settings-country-input-td">
840
-					' . $input . '
839
+					' . $input.'
841 840
 				</td>
842 841
 			</tr>';
843 842
 	}
@@ -853,7 +852,7 @@  discard block
 block discarded – undo
853 852
 	 * 		@param 		string 		$required_text
854 853
 	 * 		@return 		string
855 854
 	 */
856
-	public function state_form_field_label_wrap( $label, $required_text  ) {
855
+	public function state_form_field_label_wrap($label, $required_text) {
857 856
 		return $required_text;
858 857
 	}
859 858
 
@@ -867,10 +866,10 @@  discard block
 block discarded – undo
867 866
 	 * 		@param 		string 		$label
868 867
 	 * 		@return 		string
869 868
 	 */
870
-	public function state_form_field_input__wrap( $input, $label ) {
869
+	public function state_form_field_input__wrap($input, $label) {
871 870
 		return '
872 871
 				<td class="general-settings-country-state-input-td">
873
-					' . $input . '
872
+					' . $input.'
874 873
 				</td>';
875 874
 
876 875
 	}
@@ -893,10 +892,10 @@  discard block
 block discarded – undo
893 892
 	 * @param int $ee_page_id
894 893
 	 * @return string
895 894
 	 */
896
-	public static function edit_view_links( $ee_page_id ) {
897
-		$links = '<a href="' . add_query_arg( array( 'post' => $ee_page_id, 'action' => 'edit' ),  admin_url( 'post.php' )) . '" >' . __('Edit', 'event_espresso') . '</a>';
895
+	public static function edit_view_links($ee_page_id) {
896
+		$links = '<a href="'.add_query_arg(array('post' => $ee_page_id, 'action' => 'edit'), admin_url('post.php')).'" >'.__('Edit', 'event_espresso').'</a>';
898 897
 		$links .= ' &nbsp;|&nbsp; ';
899
-		$links .= '<a href="' . get_permalink( $ee_page_id ) . '" >' . __('View', 'event_espresso') . '</a>';
898
+		$links .= '<a href="'.get_permalink($ee_page_id).'" >'.__('View', 'event_espresso').'</a>';
900 899
 		return $links;
901 900
 	}
902 901
 
@@ -909,27 +908,27 @@  discard block
 block discarded – undo
909 908
 	 * @param WP page object $ee_page
910 909
 	 * @return string
911 910
 	 */
912
-	public static function page_and_shortcode_status( $ee_page, $shortcode ) {
911
+	public static function page_and_shortcode_status($ee_page, $shortcode) {
913 912
 
914 913
 		// page status
915
-		if ( isset( $ee_page->post_status ) && $ee_page->post_status == 'publish') {
914
+		if (isset($ee_page->post_status) && $ee_page->post_status == 'publish') {
916 915
 			$pg_colour = 'green';
917
-			$pg_status = sprintf( __('Page%sStatus%sOK', 'event_espresso'), '&nbsp;' , '&nbsp;' );
916
+			$pg_status = sprintf(__('Page%sStatus%sOK', 'event_espresso'), '&nbsp;', '&nbsp;');
918 917
 		 } else {
919 918
 			$pg_colour = 'red';
920
-			$pg_status = sprintf( __('Page%sVisibility%sProblem', 'event_espresso'), '&nbsp;', '&nbsp;'  );
919
+			$pg_status = sprintf(__('Page%sVisibility%sProblem', 'event_espresso'), '&nbsp;', '&nbsp;');
921 920
 		}
922 921
 
923 922
 		// shortcode status
924
-		if ( isset( $ee_page->post_content ) && strpos( $ee_page->post_content, $shortcode ) !== FALSE ) {
923
+		if (isset($ee_page->post_content) && strpos($ee_page->post_content, $shortcode) !== FALSE) {
925 924
 			$sc_colour = 'green';
926
-			$sc_status = sprintf( __('Shortcode%sOK', 'event_espresso'), '&nbsp;' );
925
+			$sc_status = sprintf(__('Shortcode%sOK', 'event_espresso'), '&nbsp;');
927 926
 		 } else {
928 927
 			$sc_colour = 'red';
929
-			$sc_status = sprintf( __('Shortcode%sProblem', 'event_espresso'), '&nbsp;' );
928
+			$sc_status = sprintf(__('Shortcode%sProblem', 'event_espresso'), '&nbsp;');
930 929
 		}
931 930
 
932
-		return '<span style="color:' . $pg_colour . '; margin-right:2em;"><strong>' . $pg_status . '</strong></span><span style="color:' . $sc_colour . '"><strong>' . $sc_status . '</strong></span>';
931
+		return '<span style="color:'.$pg_colour.'; margin-right:2em;"><strong>'.$pg_status.'</strong></span><span style="color:'.$sc_colour.'"><strong>'.$sc_status.'</strong></span>';
933 932
 
934 933
 	}
935 934
 
@@ -944,20 +943,20 @@  discard block
 block discarded – undo
944 943
 	 * @param unknown_type $level
945 944
 	 * @return unknown
946 945
 	 */
947
-	public static function page_settings_dropdown( $default = 0, $parent = 0, $level = 0 ) {
946
+	public static function page_settings_dropdown($default = 0, $parent = 0, $level = 0) {
948 947
 		global $wpdb;
949
-		$items = $wpdb->get_results( $wpdb->prepare("SELECT ID, post_parent, post_title FROM $wpdb->posts WHERE post_parent = %d AND post_type = 'page' AND post_status != 'trash' ORDER BY menu_order", $parent) );
948
+		$items = $wpdb->get_results($wpdb->prepare("SELECT ID, post_parent, post_title FROM $wpdb->posts WHERE post_parent = %d AND post_type = 'page' AND post_status != 'trash' ORDER BY menu_order", $parent));
950 949
 
951
-		if ( $items ) {
952
-			foreach ( $items as $item ) {
953
-				$pad = str_repeat( '&nbsp;', $level * 3 );
954
-				if ( $item->ID == $default)
950
+		if ($items) {
951
+			foreach ($items as $item) {
952
+				$pad = str_repeat('&nbsp;', $level * 3);
953
+				if ($item->ID == $default)
955 954
 					$current = ' selected="selected"';
956 955
 				else
957 956
 					$current = '';
958 957
 
959
-				echo "\n\t<option class='level-$level' value='$item->ID'$current>$pad " . esc_html($item->post_title) . "</option>";
960
-				parent_dropdown( $default, $item->ID, $level +1 );
958
+				echo "\n\t<option class='level-$level' value='$item->ID'$current>$pad ".esc_html($item->post_title)."</option>";
959
+				parent_dropdown($default, $item->ID, $level + 1);
961 960
 			}
962 961
 		} else {
963 962
 			return false;
Please login to merge, or discard this patch.
admin_pages/messages/Messages_Admin_Page.core.php 4 patches
Doc Comments   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1356,7 +1356,7 @@  discard block
 block discarded – undo
1356 1356
 	 * Retrieve and set the message preview for display.
1357 1357
 	 *
1358 1358
 	 * @param bool $send if TRUE then we are doing an actual TEST send with the results of the preview.
1359
-	 * @return void
1359
+	 * @return string|null
1360 1360
 	 */
1361 1361
 	public function _preview_message( $send = FALSE ) {
1362 1362
 		//first make sure we've got the necessary parameters
@@ -1673,7 +1673,7 @@  discard block
 block discarded – undo
1673 1673
 	 * sets up a context switcher for edit forms
1674 1674
 	 *
1675 1675
 	 * @access  protected
1676
-	 * @param  EE_Message_Template_Group $template_object the template group object being displayed on the form
1676
+	 * @param  EE_Message_Template_Group $template_group_object the template group object being displayed on the form
1677 1677
 	 * @param array $args various things the context switcher needs.
1678 1678
 	 * @return void
1679 1679
 	 */
@@ -2077,7 +2077,7 @@  discard block
 block discarded – undo
2077 2077
 	 * helper for permanently deleting a mtP group and all related message_templates
2078 2078
 	 * @param  int    $GRP_ID The group being deleted
2079 2079
 	 * @param  bool $include_group whether to delete the Message Template Group as well.
2080
-	 * @return success        boolean to indicate the success of the deletes or not.
2080
+	 * @return integer        boolean to indicate the success of the deletes or not.
2081 2081
 	 */
2082 2082
 	private function _delete_mtp_permanently( $GRP_ID, $include_group = TRUE ) {
2083 2083
 		$success = 1;
@@ -2557,8 +2557,8 @@  discard block
 block discarded – undo
2557 2557
 	 *
2558 2558
 	 * @param  string  $messenger What messenger we're toggling
2559 2559
 	 * @param  boolean $deactivate if true then we deactivate
2560
-	 * @param  mixed   $message_type if present what message type we're toggling
2561
-	 * @return void
2560
+	 * @param  null|string   $message_type if present what message type we're toggling
2561
+	 * @return boolean
2562 2562
 	 */
2563 2563
 	protected function _activate_messenger($messenger, $deactivate = FALSE, $message_type = FALSE) {
2564 2564
 		global $espresso_wp_user;
Please login to merge, or discard this patch.
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -190,9 +190,9 @@  discard block
 block discarded – undo
190 190
 
191 191
 	/**
192 192
 	 * 		an array for storing key => value pairs of request actions and their corresponding methods
193
-	*		@access protected
194
-	*		@return void
195
-	*/
193
+	 *		@access protected
194
+	 *		@return void
195
+	 */
196 196
 	protected function _set_page_routes() {
197 197
 		$grp_id = ! empty( $this->_req_data['GRP_ID'] ) && ! is_array( $this->_req_data['GRP_ID'] ) ? $this->_req_data['GRP_ID'] : 0;
198 198
 		$grp_id = empty( $grp_id ) && !empty( $this->_req_data['id'] ) ? $this->_req_data['id'] : $grp_id;
@@ -379,18 +379,18 @@  discard block
 block discarded – undo
379 379
 							'title' => __('Message Template Editor', 'event_espresso'),
380 380
 							'callback' => 'edit_message_template_help_tab'
381 381
 							),
382
-                        'message_templates_help_tab' => array(
383
-                            'title' => __('Message Templates', 'event_espresso'),
384
-                            'filename' => 'messages_templates'
385
-                            ),
382
+						'message_templates_help_tab' => array(
383
+							'title' => __('Message Templates', 'event_espresso'),
384
+							'filename' => 'messages_templates'
385
+							),
386 386
 						'message_template_shortcodes' => array(
387 387
 							'title' => __('Message Shortcodes', 'event_espresso'),
388 388
 							'callback' => 'message_template_shortcodes_help_tab'
389 389
 							),
390
-                        'message_preview_help_tab' => array(
391
-                            'title' => __('Message Preview', 'event_espresso'),
392
-                            'filename' => 'messages_preview'
393
-                            ),
390
+						'message_preview_help_tab' => array(
391
+							'title' => __('Message Preview', 'event_espresso'),
392
+							'filename' => 'messages_preview'
393
+							),
394 394
 					),
395 395
 				'require_nonce' => FALSE
396 396
 				),
@@ -415,7 +415,7 @@  discard block
 block discarded – undo
415 415
 					'order' => 20
416 416
 					),
417 417
 				'metaboxes' => array('_messages_settings_metaboxes'),
418
-                'help_tabs' => array(
418
+				'help_tabs' => array(
419 419
 						'messages_settings_help_tab' => array(
420 420
 							'title' => __('Messages Settings', 'event_espresso'),
421 421
 							'filename' => 'messages_settings'
@@ -428,7 +428,7 @@  discard block
 block discarded – undo
428 428
 							'title' => __('Activating / Deactivating Messengers', 'event_espresso'),
429 429
 							'filename' => 'messages_settings_messengers'
430 430
 							),
431
-                    ),
431
+					),
432 432
 				'help_tour' => array( 'Messages_Settings_Help_Tour' ),
433 433
 				'require_nonce' => FALSE
434 434
 				)
@@ -2106,9 +2106,9 @@  discard block
 block discarded – undo
2106 2106
 
2107 2107
 	/**
2108 2108
 	 * 	_learn_more_about_message_templates_link
2109
-	*	@access protected
2110
-	*	@return string
2111
-	*/
2109
+	 *	@access protected
2110
+	 *	@return string
2111
+	 */
2112 2112
 	protected function _learn_more_about_message_templates_link() {
2113 2113
 		return '<a class="hidden" style="margin:0 20px; cursor:pointer; font-size:12px;" >' . __('learn more about how message templates works', 'event_espresso') . '</a>';
2114 2114
 	}
Please login to merge, or discard this patch.
Spacing   +503 added lines, -503 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@  discard block
 block discarded – undo
1
-<?php if (!defined('EVENT_ESPRESSO_VERSION') )
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION'))
2 2
 	exit('NO direct script access allowed');
3 3
 
4 4
 /**
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 	 * @access public
74 74
 	 * @return void
75 75
 	 */
76
-	public function __construct( $routing = TRUE ) {
76
+	public function __construct($routing = TRUE) {
77 77
 		//make sure MSG Template helper is loaded.
78 78
 		EE_Registry::instance()->load_helper('MSG_Template');
79 79
 		//make sure messages autoloader is running
@@ -94,13 +94,13 @@  discard block
 block discarded – undo
94 94
 
95 95
 		$this->_activate_state = isset($this->_req_data['activate_state']) ? (array) $this->_req_data['activate_state'] : array();
96 96
 
97
-		$this->_active_messenger = isset( $this->_req_data['messenger'] ) ? $this->_req_data['messenger'] : NULL;
97
+		$this->_active_messenger = isset($this->_req_data['messenger']) ? $this->_req_data['messenger'] : NULL;
98 98
 
99
-		EE_Registry::instance()->load_lib( 'messages' );
99
+		EE_Registry::instance()->load_lib('messages');
100 100
 		//we're also going to set the active messengers and active message types in here.
101 101
 		$this->_active_messengers = EEH_MSG_Template::get_active_messengers_in_db();
102
-		$this->_active_messengers = !empty($this->_active_messengers) ?  $this->_active_messengers : array();
103
-		$this->_active_message_types = !empty($this->_active_messenger) && !empty($this->_active_messengers[$this->_active_messenger]) && ! empty(  $this->_active_messengers[$this->_active_messenger]['settings'][$this->_active_messenger . '-message_types'] ) ? array_keys($this->_active_messengers[$this->_active_messenger]['settings'][$this->_active_messenger . '-message_types']) : array();
102
+		$this->_active_messengers = ! empty($this->_active_messengers) ? $this->_active_messengers : array();
103
+		$this->_active_message_types = ! empty($this->_active_messenger) && ! empty($this->_active_messengers[$this->_active_messenger]) && ! empty($this->_active_messengers[$this->_active_messenger]['settings'][$this->_active_messenger.'-message_types']) ? array_keys($this->_active_messengers[$this->_active_messenger]['settings'][$this->_active_messenger.'-message_types']) : array();
104 104
 
105 105
 
106 106
 		//what about saving the objects in the active_messengers and active_message_types?
@@ -118,15 +118,15 @@  discard block
 block discarded – undo
118 118
 	 * @return void
119 119
 	 */
120 120
 	protected function _load_active_messenger_objects() {
121
-		foreach ( $this->_active_messengers as $messenger => $values ) {
122
-			$ref = ucwords( str_replace( '_' , ' ', $messenger) );
123
-			$ref = str_replace( ' ', '_', $ref );
124
-			$classname = 'EE_' . $ref . '_messenger';
125
-			require_once( EE_LIBRARIES . 'messages'. DS .'messenger' . DS . $classname . '.class.php' );
126
-			if ( !class_exists($classname) )
127
-				throw new EE_Error( sprintf( __('There is no messenger for the given classname (%s)', 'event_espresso'), $classname ) );
128
-
129
-			$a = new ReflectionClass( $classname );
121
+		foreach ($this->_active_messengers as $messenger => $values) {
122
+			$ref = ucwords(str_replace('_', ' ', $messenger));
123
+			$ref = str_replace(' ', '_', $ref);
124
+			$classname = 'EE_'.$ref.'_messenger';
125
+			require_once(EE_LIBRARIES.'messages'.DS.'messenger'.DS.$classname.'.class.php');
126
+			if ( ! class_exists($classname))
127
+				throw new EE_Error(sprintf(__('There is no messenger for the given classname (%s)', 'event_espresso'), $classname));
128
+
129
+			$a = new ReflectionClass($classname);
130 130
 			$this->_active_messengers[$messenger]['obj'] = $a->newInstance();
131 131
 		}
132 132
 	}
@@ -141,16 +141,16 @@  discard block
 block discarded – undo
141 141
 	 * @return void
142 142
 	 */
143 143
 	protected function _load_active_message_type_objects() {
144
-		if ( empty($this->_active_message_types) ) return;
145
-		foreach ( $this->_active_message_types as $message_type ) {
146
-			$ref = ucwords( str_replace( '_' , ' ', $message_type) );
147
-			$ref = str_replace( ' ', '_', $ref );
148
-			$classname = 'EE_' . $ref . '_message_type';
144
+		if (empty($this->_active_message_types)) return;
145
+		foreach ($this->_active_message_types as $message_type) {
146
+			$ref = ucwords(str_replace('_', ' ', $message_type));
147
+			$ref = str_replace(' ', '_', $ref);
148
+			$classname = 'EE_'.$ref.'_message_type';
149 149
 
150
-			if ( !class_exists($classname) )
151
-				throw new EE_Error( sprintf( __('There is no message type for the given classname (%s)', 'event_espresso'), $classname ) );
150
+			if ( ! class_exists($classname))
151
+				throw new EE_Error(sprintf(__('There is no message type for the given classname (%s)', 'event_espresso'), $classname));
152 152
 
153
-			$a = new ReflectionClass( $classname );
153
+			$a = new ReflectionClass($classname);
154 154
 			$this->_active_message_types[$message_type]['obj'] = $a->newInstance();
155 155
 		}
156 156
 	}
@@ -158,11 +158,11 @@  discard block
 block discarded – undo
158 158
 
159 159
 
160 160
 	protected function _ajax_hooks() {
161
-		add_action('wp_ajax_activate_messenger', array($this, 'activate_messenger_toggle' ) );
162
-		add_action('wp_ajax_activate_mt', array( $this, 'activate_mt_toggle') );
163
-		add_action('wp_ajax_ee_msgs_save_settings', array( $this, 'save_settings') );
164
-		add_action('wp_ajax_ee_msgs_update_mt_form', array( $this, 'update_mt_form' ) );
165
-		add_action('wp_ajax_switch_template_pack', array( $this, 'switch_template_pack' ) );
161
+		add_action('wp_ajax_activate_messenger', array($this, 'activate_messenger_toggle'));
162
+		add_action('wp_ajax_activate_mt', array($this, 'activate_mt_toggle'));
163
+		add_action('wp_ajax_ee_msgs_save_settings', array($this, 'save_settings'));
164
+		add_action('wp_ajax_ee_msgs_update_mt_form', array($this, 'update_mt_form'));
165
+		add_action('wp_ajax_switch_template_pack', array($this, 'switch_template_pack'));
166 166
 	}
167 167
 
168 168
 
@@ -194,8 +194,8 @@  discard block
 block discarded – undo
194 194
 	*		@return void
195 195
 	*/
196 196
 	protected function _set_page_routes() {
197
-		$grp_id = ! empty( $this->_req_data['GRP_ID'] ) && ! is_array( $this->_req_data['GRP_ID'] ) ? $this->_req_data['GRP_ID'] : 0;
198
-		$grp_id = empty( $grp_id ) && !empty( $this->_req_data['id'] ) ? $this->_req_data['id'] : $grp_id;
197
+		$grp_id = ! empty($this->_req_data['GRP_ID']) && ! is_array($this->_req_data['GRP_ID']) ? $this->_req_data['GRP_ID'] : 0;
198
+		$grp_id = empty($grp_id) && ! empty($this->_req_data['id']) ? $this->_req_data['id'] : $grp_id;
199 199
 
200 200
 		$this->_page_routes = array(
201 201
 				'default'=> array(
@@ -231,35 +231,35 @@  discard block
 block discarded – undo
231 231
 				'insert_message_template' => array(
232 232
 					'func' => '_insert_or_update_message_template',
233 233
 					'capability' => 'ee_edit_messages',
234
-					'args' => array( 'new_template' => TRUE ),
234
+					'args' => array('new_template' => TRUE),
235 235
 					'noheader' => TRUE
236 236
 					 ),
237 237
 				'update_message_template' => array(
238 238
 					'func' => '_insert_or_update_message_template',
239 239
 					'capability' => 'ee_edit_message',
240 240
 					'obj_id' => $grp_id,
241
-					'args' => array( 'new_template' => FALSE ),
241
+					'args' => array('new_template' => FALSE),
242 242
 					'noheader' => TRUE
243 243
 					),
244 244
 				'trash_message_template' => array(
245 245
 					'func' => '_trash_or_restore_message_template',
246 246
 					'capability' => 'ee_delete_message',
247 247
 					'obj_id' => $grp_id,
248
-					'args' => array( 'trash' => TRUE, 'all' => TRUE ),
248
+					'args' => array('trash' => TRUE, 'all' => TRUE),
249 249
 					'noheader' => TRUE
250 250
 					),
251 251
 				'trash_message_template_context' => array(
252 252
 					'func' => '_trash_or_restore_message_template',
253 253
 					'capability' => 'ee_delete_message',
254 254
 					'obj_id' => $grp_id,
255
-					'args' => array( 'trash' => TRUE ),
255
+					'args' => array('trash' => TRUE),
256 256
 					'noheader' => TRUE
257 257
 					),
258 258
 				'restore_message_template' => array(
259 259
 					'func' => '_trash_or_restore_message_template',
260 260
 					'capability' => 'ee_delete_message',
261 261
 					'obj_id' => $grp_id,
262
-					'args' => array( 'trash' => FALSE, 'all' => TRUE ),
262
+					'args' => array('trash' => FALSE, 'all' => TRUE),
263 263
 					'noheader' => TRUE
264 264
 					),
265 265
 				'restore_message_template_context' => array(
@@ -338,7 +338,7 @@  discard block
 block discarded – undo
338 338
 						'filename' => 'messages_overview_other',
339 339
 					),
340 340
 				),
341
-				'help_tour' => array( 'Messages_Overview_Help_Tour' ),
341
+				'help_tour' => array('Messages_Overview_Help_Tour'),
342 342
 				'require_nonce' => FALSE
343 343
 				),
344 344
 			'custom_mtps' => array(
@@ -373,7 +373,7 @@  discard block
 block discarded – undo
373 373
 					),
374 374
 				'metaboxes' => array('_publish_post_box', '_register_edit_meta_boxes'),
375 375
 				'has_metaboxes' => TRUE,
376
-				'help_tour' => array( 'Message_Templates_Edit_Help_Tour' ),
376
+				'help_tour' => array('Message_Templates_Edit_Help_Tour'),
377 377
 				'help_tabs' => array(
378 378
 						'edit_message_template' => array(
379 379
 							'title' => __('Message Template Editor', 'event_espresso'),
@@ -429,7 +429,7 @@  discard block
 block discarded – undo
429 429
 							'filename' => 'messages_settings_messengers'
430 430
 							),
431 431
                     ),
432
-				'help_tour' => array( 'Messages_Settings_Help_Tour' ),
432
+				'help_tour' => array('Messages_Settings_Help_Tour'),
433 433
 				'require_nonce' => FALSE
434 434
 				)
435 435
 			/*'reports' => array(
@@ -479,43 +479,43 @@  discard block
 block discarded – undo
479 479
 
480 480
 
481 481
 	public function messages_help_tab() {
482
-		$templatepath = EE_MSG_TEMPLATE_PATH . 'ee_msg_messages_help_tab.template.php';
483
-		EEH_Template::display_template( $templatepath, array());
482
+		$templatepath = EE_MSG_TEMPLATE_PATH.'ee_msg_messages_help_tab.template.php';
483
+		EEH_Template::display_template($templatepath, array());
484 484
 	}
485 485
 
486 486
 
487 487
 	public function messengers_help_tab() {
488
-		$templatepath = EE_MSG_TEMPLATE_PATH . 'ee_msg_messenger_help_tab.template.php';
489
-		EEH_Template::display_template( $templatepath, array());
488
+		$templatepath = EE_MSG_TEMPLATE_PATH.'ee_msg_messenger_help_tab.template.php';
489
+		EEH_Template::display_template($templatepath, array());
490 490
 	}
491 491
 
492 492
 
493 493
 	public function message_types_help_tab() {
494
-		$templatepath = EE_MSG_TEMPLATE_PATH . 'ee_msg_message_type_help_tab.template.php';
495
-		EEH_Template::display_template( $templatepath, array());
494
+		$templatepath = EE_MSG_TEMPLATE_PATH.'ee_msg_message_type_help_tab.template.php';
495
+		EEH_Template::display_template($templatepath, array());
496 496
 	}
497 497
 
498 498
 
499 499
 	public function messages_overview_help_tab() {
500
-		$templatepath = EE_MSG_TEMPLATE_PATH . 'ee_msg_overview_help_tab.template.php';
501
-		EEH_Template::display_template( $templatepath, array());
500
+		$templatepath = EE_MSG_TEMPLATE_PATH.'ee_msg_overview_help_tab.template.php';
501
+		EEH_Template::display_template($templatepath, array());
502 502
 	}
503 503
 
504 504
 
505 505
 	public function message_templates_help_tab() {
506
-		$templatepath = EE_MSG_TEMPLATE_PATH . 'ee_msg_message_templates_help_tab.template.php';
507
-		EEH_Template::display_template( $templatepath, array());
506
+		$templatepath = EE_MSG_TEMPLATE_PATH.'ee_msg_message_templates_help_tab.template.php';
507
+		EEH_Template::display_template($templatepath, array());
508 508
 	}
509 509
 
510 510
 
511 511
 	public function edit_message_template_help_tab() {
512
-		$templatepath = EE_MSG_TEMPLATE_PATH . 'ee_msg_messages_templates_editor_help_tab.template.php';
513
-		$args['img1'] = '<img src="' . EE_MSG_ASSETS_URL . 'images/editor.png' . '" alt="' . esc_attr__('Editor Title', 'event_espresso') . '" />';
514
-		$args['img2'] = '<img src="' . EE_MSG_ASSETS_URL . 'images/switch-context.png' . '" alt="' . esc_attr__('Context Switcher and Preview', 'event_espresso') . '" />';
515
-		$args['img3'] = '<img class="left" src="' . EE_MSG_ASSETS_URL . 'images/form-fields.png' . '" alt="' . esc_attr__('Message Template Form Fields', 'event_espresso') . '" />';
516
-		$args['img4'] = '<img class="right" src="' . EE_MSG_ASSETS_URL . 'images/shortcodes-metabox.png' . '" alt="' . esc_attr__('Shortcodes Metabox', 'event_espresso') . '" />';
517
-		$args['img5'] = '<img class="right" src="' . EE_MSG_ASSETS_URL . 'images/publish-meta-box.png' . '" alt="' . esc_attr__('Publish Metabox', 'event_espresso') . '" />';
518
-		EEH_Template::display_template( $templatepath, $args);
512
+		$templatepath = EE_MSG_TEMPLATE_PATH.'ee_msg_messages_templates_editor_help_tab.template.php';
513
+		$args['img1'] = '<img src="'.EE_MSG_ASSETS_URL.'images/editor.png'.'" alt="'.esc_attr__('Editor Title', 'event_espresso').'" />';
514
+		$args['img2'] = '<img src="'.EE_MSG_ASSETS_URL.'images/switch-context.png'.'" alt="'.esc_attr__('Context Switcher and Preview', 'event_espresso').'" />';
515
+		$args['img3'] = '<img class="left" src="'.EE_MSG_ASSETS_URL.'images/form-fields.png'.'" alt="'.esc_attr__('Message Template Form Fields', 'event_espresso').'" />';
516
+		$args['img4'] = '<img class="right" src="'.EE_MSG_ASSETS_URL.'images/shortcodes-metabox.png'.'" alt="'.esc_attr__('Shortcodes Metabox', 'event_espresso').'" />';
517
+		$args['img5'] = '<img class="right" src="'.EE_MSG_ASSETS_URL.'images/publish-meta-box.png'.'" alt="'.esc_attr__('Publish Metabox', 'event_espresso').'" />';
518
+		EEH_Template::display_template($templatepath, $args);
519 519
 	}
520 520
 
521 521
 
@@ -523,25 +523,25 @@  discard block
 block discarded – undo
523 523
 	public function message_template_shortcodes_help_tab() {
524 524
 		$this->_set_shortcodes();
525 525
 		$args['shortcodes'] = $this->_shortcodes;
526
-		$template_path = EE_MSG_TEMPLATE_PATH . 'ee_msg_messages_shortcodes_help_tab.template.php';
527
-		EEH_Template::display_template( $template_path, $args );
526
+		$template_path = EE_MSG_TEMPLATE_PATH.'ee_msg_messages_shortcodes_help_tab.template.php';
527
+		EEH_Template::display_template($template_path, $args);
528 528
 	}
529 529
 
530 530
 
531 531
 
532 532
 	public function preview_message_help_tab() {
533
-		$templatepath = EE_MSG_TEMPLATE_PATH . 'ee_msg_preview_help_tab.template.php';
534
-		EEH_Template::display_template( $templatepath, array());
533
+		$templatepath = EE_MSG_TEMPLATE_PATH.'ee_msg_preview_help_tab.template.php';
534
+		EEH_Template::display_template($templatepath, array());
535 535
 	}
536 536
 
537 537
 
538 538
 	public function settings_help_tab() {
539
-		$templatepath = EE_MSG_TEMPLATE_PATH . 'ee_msg_messages_settings_help_tab.template.php';
540
-		$args['img1'] = '<img class="inline-text" src="' . EE_MSG_ASSETS_URL . 'images/email-tab-active.png' . '" alt="' . esc_attr__('Active Email Tab', 'event_espresso') . '" />';
541
-		$args['img2'] = '<img class="inline-text" src="' . EE_MSG_ASSETS_URL . 'images/email-tab-inactive.png' . '" alt="' . esc_attr__('Inactive Email Tab', 'event_espresso') . '" />';
539
+		$templatepath = EE_MSG_TEMPLATE_PATH.'ee_msg_messages_settings_help_tab.template.php';
540
+		$args['img1'] = '<img class="inline-text" src="'.EE_MSG_ASSETS_URL.'images/email-tab-active.png'.'" alt="'.esc_attr__('Active Email Tab', 'event_espresso').'" />';
541
+		$args['img2'] = '<img class="inline-text" src="'.EE_MSG_ASSETS_URL.'images/email-tab-inactive.png'.'" alt="'.esc_attr__('Inactive Email Tab', 'event_espresso').'" />';
542 542
 		$args['img3'] = '<div class="switch"><input id="ee-on-off-toggle-on" class="ee-on-off-toggle ee-toggle-round-flat" type="checkbox" checked="checked"><label for="ee-on-off-toggle-on"></label>';
543 543
 		$args['img4'] = '<div class="switch"><input id="ee-on-off-toggle-on" class="ee-on-off-toggle ee-toggle-round-flat" type="checkbox"><label for="ee-on-off-toggle-on"></label>';
544
-		EEH_Template::display_template( $templatepath, $args);
544
+		EEH_Template::display_template($templatepath, $args);
545 545
 	}
546 546
 
547 547
 
@@ -549,24 +549,24 @@  discard block
 block discarded – undo
549 549
 
550 550
 
551 551
 	public function load_scripts_styles() {
552
-		wp_register_style('espresso_ee_msg', EE_MSG_ASSETS_URL . 'ee_message_admin.css', EVENT_ESPRESSO_VERSION );
552
+		wp_register_style('espresso_ee_msg', EE_MSG_ASSETS_URL.'ee_message_admin.css', EVENT_ESPRESSO_VERSION);
553 553
 		wp_enqueue_style('espresso_ee_msg');
554 554
 
555
-		wp_register_script('ee-messages-settings', EE_MSG_ASSETS_URL . 'ee-messages-settings.js', array('jquery-ui-droppable', 'ee-serialize-full-array'), EVENT_ESPRESSO_VERSION, TRUE );
555
+		wp_register_script('ee-messages-settings', EE_MSG_ASSETS_URL.'ee-messages-settings.js', array('jquery-ui-droppable', 'ee-serialize-full-array'), EVENT_ESPRESSO_VERSION, TRUE);
556 556
 	}
557 557
 
558 558
 
559 559
 
560 560
 
561 561
 
562
-	public function wp_editor_css( $mce_css ) {
562
+	public function wp_editor_css($mce_css) {
563 563
 		//if we're on the edit_message_template route
564
-		if ( $this->_req_action == 'edit_message_template' && $this->_active_messenger instanceof EE_messenger  ) {
564
+		if ($this->_req_action == 'edit_message_template' && $this->_active_messenger instanceof EE_messenger) {
565 565
 			$message_type_name = $this->_active_message_type_name;
566 566
 
567 567
 			//we're going to REPLACE the existing mce css
568 568
 			//we need to get the css file location from the active messenger
569
-			$mce_css = $this->_active_messenger->get_variation($this->_template_pack, $message_type_name, TRUE, 'wpeditor', $this->_variation );
569
+			$mce_css = $this->_active_messenger->get_variation($this->_template_pack, $message_type_name, TRUE, 'wpeditor', $this->_variation);
570 570
 		}
571 571
 
572 572
 		return $mce_css;
@@ -584,37 +584,37 @@  discard block
 block discarded – undo
584 584
 			$this->_message_template_group->messenger_obj()->label['singular'],
585 585
 			$this->_message_template_group->message_type_obj()->label['singular']
586 586
 		);
587
-		EE_Registry::$i18n_js_strings['confirm_switch_template_pack'] = __('Switching the template pack for a messages template will reset the content for the template so the new layout is loaded.  Any custom content in the existing template will be lost. Are you sure you wish to do this?', 'event_espresso' );
587
+		EE_Registry::$i18n_js_strings['confirm_switch_template_pack'] = __('Switching the template pack for a messages template will reset the content for the template so the new layout is loaded.  Any custom content in the existing template will be lost. Are you sure you wish to do this?', 'event_espresso');
588 588
 
589
-		wp_register_script('ee_msgs_edit_js', EE_MSG_ASSETS_URL . 'ee_message_editor.js', array('jquery'), EVENT_ESPRESSO_VERSION );
589
+		wp_register_script('ee_msgs_edit_js', EE_MSG_ASSETS_URL.'ee_message_editor.js', array('jquery'), EVENT_ESPRESSO_VERSION);
590 590
 
591 591
 		wp_enqueue_script('ee_admin_js');
592 592
 		wp_enqueue_script('ee_msgs_edit_js');
593 593
 
594 594
 		//add in special css for tiny_mce
595
-		add_filter( 'mce_css', array( $this, 'wp_editor_css' ) );
595
+		add_filter('mce_css', array($this, 'wp_editor_css'));
596 596
 	}
597 597
 
598 598
 
599 599
 
600 600
 	public function load_scripts_styles_display_preview_message() {
601 601
 		$this->_set_message_template_group();
602
-		if ( isset( $this->_req_data['messenger'] ) ) {
602
+		if (isset($this->_req_data['messenger'])) {
603 603
 			$this->_active_messenger = $this->_active_messengers[$this->_req_data['messenger']]['obj'];
604 604
 		}
605 605
 
606
-		$message_type_name = isset( $this->_req_data['message_type'] ) ? $this->_req_data['message_type'] : '';
606
+		$message_type_name = isset($this->_req_data['message_type']) ? $this->_req_data['message_type'] : '';
607 607
 
608 608
 
609
-		wp_enqueue_style('espresso_preview_css', $this->_active_messenger->get_variation( $this->_template_pack, $message_type_name, TRUE, 'preview', $this->_variation ) );
609
+		wp_enqueue_style('espresso_preview_css', $this->_active_messenger->get_variation($this->_template_pack, $message_type_name, TRUE, 'preview', $this->_variation));
610 610
 	}
611 611
 
612 612
 
613 613
 
614 614
 	public function load_scripts_styles_settings() {
615
-		wp_register_style( 'ee-message-settings', EE_MSG_ASSETS_URL . 'ee_message_settings.css', array(), EVENT_ESPRESSO_VERSION );
616
-		wp_enqueue_style( 'ee-text-links' );
617
-		wp_enqueue_style( 'ee-message-settings' );
615
+		wp_register_style('ee-message-settings', EE_MSG_ASSETS_URL.'ee_message_settings.css', array(), EVENT_ESPRESSO_VERSION);
616
+		wp_enqueue_style('ee-text-links');
617
+		wp_enqueue_style('ee-message-settings');
618 618
 
619 619
 		wp_enqueue_script('ee-messages-settings');
620 620
 	}
@@ -650,9 +650,9 @@  discard block
 block discarded – undo
650 650
 
651 651
 	protected function _custom_mtps_preview() {
652 652
 		$this->_admin_page_title = __('Custom Message Templates (Preview)', 'event_espresso');
653
-		$this->_template_args['preview_img'] = '<img src="' . EE_MSG_ASSETS_URL . 'images/custom_mtps_preview.png" alt="' . esc_attr__('Preview Custom Message Templates screenshot', 'event_espresso' ) . '" />';
653
+		$this->_template_args['preview_img'] = '<img src="'.EE_MSG_ASSETS_URL.'images/custom_mtps_preview.png" alt="'.esc_attr__('Preview Custom Message Templates screenshot', 'event_espresso').'" />';
654 654
 		$this->_template_args['preview_text'] = '<strong>'.__('Custom Message Templates is a feature that is only available in the caffeinated version of Event Espresso.  With the Custom Message Templates feature, you are able to create custom templates and set them per event.', 'event_espresso').'</strong>';
655
-		$this->display_admin_caf_preview_page( 'custom_message_types', FALSE );
655
+		$this->display_admin_caf_preview_page('custom_message_types', FALSE);
656 656
 	}
657 657
 
658 658
 
@@ -674,7 +674,7 @@  discard block
 block discarded – undo
674 674
 	 * @param bool $global whether to return just global (true) or custom templates (false)
675 675
 	 * @return array|WP_Error object
676 676
 	 */
677
-	public function get_message_templates( $perpage = 10, $type = 'in_use', $count = FALSE, $all = FALSE, $global = TRUE ) {
677
+	public function get_message_templates($perpage = 10, $type = 'in_use', $count = FALSE, $all = FALSE, $global = TRUE) {
678 678
 		global $espresso_wp_user;
679 679
 		// start with an empty array
680 680
 		$message_templates = array();
@@ -684,24 +684,24 @@  discard block
 block discarded – undo
684 684
 		$this->_req_data['orderby'] = empty($this->_req_data['orderby']) ? 'GRP_ID' : $this->_req_data['orderby'];
685 685
 		$orderby = $this->_req_data['orderby'];
686 686
 
687
-		$order = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] ) ) ? $this->_req_data['order'] : 'ASC';
687
+		$order = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'ASC';
688 688
 
689
-		$current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1;
690
-		$per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $perpage;
689
+		$current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1;
690
+		$per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $perpage;
691 691
 
692
-		$offset = ($current_page-1)*$per_page;
693
-		$limit = $all ? NULL : array( $offset, $per_page );
692
+		$offset = ($current_page - 1) * $per_page;
693
+		$limit = $all ? NULL : array($offset, $per_page);
694 694
 
695 695
 
696 696
 		//options will match what is in the _views array property
697
-		switch( $type ) {
697
+		switch ($type) {
698 698
 
699 699
 			case 'in_use':
700
-				$templates = $MTP->get_all_active_message_templates($orderby, $order, $limit, $count, $global, TRUE );
700
+				$templates = $MTP->get_all_active_message_templates($orderby, $order, $limit, $count, $global, TRUE);
701 701
 				break;
702 702
 
703 703
 			default:
704
-				$templates = $MTP->get_all_trashed_grouped_message_templates($orderby, $order, $limit, $count, $global );
704
+				$templates = $MTP->get_all_trashed_grouped_message_templates($orderby, $order, $limit, $count, $global);
705 705
 
706 706
 		}
707 707
 
@@ -737,7 +737,7 @@  discard block
 block discarded – undo
737 737
 		$imts = $installed_objects['message_types'];
738 738
 		$installed = array();
739 739
 
740
-		foreach ( $imts as $message_type ) {
740
+		foreach ($imts as $message_type) {
741 741
 			$installed[$message_type->name]['obj'] = $message_type;
742 742
 		}
743 743
 
@@ -769,24 +769,24 @@  discard block
 block discarded – undo
769 769
 	 * @access  protected
770 770
 	 * @return void
771 771
 	 */
772
-	protected function _add_message_template(  $message_type = '', $messenger='', $GRP_ID = '' ) {
772
+	protected function _add_message_template($message_type = '', $messenger = '', $GRP_ID = '') {
773 773
 		//set values override any request data
774
-		$message_type = !empty( $message_type ) ? $message_type : '';
775
-		$message_type = empty( $message_type ) && !empty( $this->_req_data['message_type'] ) ? $this->_req_data['message_type'] : $message_type;
774
+		$message_type = ! empty($message_type) ? $message_type : '';
775
+		$message_type = empty($message_type) && ! empty($this->_req_data['message_type']) ? $this->_req_data['message_type'] : $message_type;
776 776
 
777
-		$messenger = !empty( $messenger ) ? $messenger : '';
778
-		$messenger = empty( $messenger ) && !empty( $this->_req_data['messenger'] ) ? $this->_req_data['messenger'] : $messenger;
777
+		$messenger = ! empty($messenger) ? $messenger : '';
778
+		$messenger = empty($messenger) && ! empty($this->_req_data['messenger']) ? $this->_req_data['messenger'] : $messenger;
779 779
 
780
-		$GRP_ID = !empty( $GRP_ID ) ? $GRP_ID : '';
781
-		$GRP_ID = empty( $GRP_ID ) && !empty( $this->_req_data['GRP_ID'] ) ? $this->_req_data['GRP_ID'] : $GRP_ID;
780
+		$GRP_ID = ! empty($GRP_ID) ? $GRP_ID : '';
781
+		$GRP_ID = empty($GRP_ID) && ! empty($this->_req_data['GRP_ID']) ? $this->_req_data['GRP_ID'] : $GRP_ID;
782 782
 
783 783
 		//we need messenger and message type.  They should be coming from the event editor. If not here then return error
784
-		if ( empty( $message_type ) || empty( $messenger )  )
784
+		if (empty($message_type) || empty($messenger))
785 785
 			throw new EE_error(__('Sorry, but we can\'t create new templates because we\'re missing the messenger or message type', 'event_espresso'));
786 786
 
787 787
 		//we need the GRP_ID for the template being used as the base for the new template
788
-		if ( empty( $GRP_ID ) )
789
-			throw new EE_Error( __('In order to create a custom message template the GRP_ID of the template being used as a base is needed', 'event_espresso' ) );
788
+		if (empty($GRP_ID))
789
+			throw new EE_Error(__('In order to create a custom message template the GRP_ID of the template being used as a base is needed', 'event_espresso'));
790 790
 
791 791
 		//let's just make sure the template gets generated!
792 792
 
@@ -805,8 +805,8 @@  discard block
 block discarded – undo
805 805
 	 * @param string $messenger    messenger slug
806 806
 	 * @param int      $GRP_ID         GRP_ID for the related message template group this new template will be based off of.
807 807
 	 */
808
-	public function add_message_template( $message_type, $messenger, $GRP_ID ) {
809
-		$this->_add_message_template( $message_type, $messenger, $GRP_ID );
808
+	public function add_message_template($message_type, $messenger, $GRP_ID) {
809
+		$this->_add_message_template($message_type, $messenger, $GRP_ID);
810 810
 	}
811 811
 
812 812
 
@@ -817,36 +817,36 @@  discard block
 block discarded – undo
817 817
 	 * @return void
818 818
 	 */
819 819
 	protected function _edit_message_template() {
820
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '');
820
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
821 821
 
822 822
 		//we filter the tinyMCE settings to remove the validation since message templates by their nature will not have valid html in the templates.
823
-		add_filter( 'tiny_mce_before_init', array( $this, 'filter_tinymce_init'), 10, 2 );
823
+		add_filter('tiny_mce_before_init', array($this, 'filter_tinymce_init'), 10, 2);
824 824
 
825
-		$GRP_ID = isset( $this->_req_data['id'] ) && !empty( $this->_req_data['id'] ) ? absint( $this->_req_data['id'] ) : FALSE;
825
+		$GRP_ID = isset($this->_req_data['id']) && ! empty($this->_req_data['id']) ? absint($this->_req_data['id']) : FALSE;
826 826
 
827 827
 		$this->_set_shortcodes(); //this also sets the _message_template property.
828 828
 		$message_template_group = $this->_message_template_group;
829 829
 		$c_label = $message_template_group->context_label();
830 830
 		$c_config = $message_template_group->contexts_config();
831 831
 
832
-		reset( $c_config );
833
-		$context = isset( $this->_req_data['context']) && !empty($this->_req_data['context'] ) ? strtolower($this->_req_data['context']) : key($c_config);
832
+		reset($c_config);
833
+		$context = isset($this->_req_data['context']) && ! empty($this->_req_data['context']) ? strtolower($this->_req_data['context']) : key($c_config);
834 834
 
835 835
 
836
-		if ( empty($GRP_ID) ) {
836
+		if (empty($GRP_ID)) {
837 837
 			$action = 'insert_message_template';
838 838
 			$button_both = FALSE;
839
-			$button_text = array( __( 'Save','event_espresso') );
839
+			$button_text = array(__('Save', 'event_espresso'));
840 840
 			$button_actions = array('something_different');
841 841
 			$referrer = FALSE;
842
-			$edit_message_template_form_url = add_query_arg( array( 'action' => $action, 'noheader' => TRUE ), EE_MSG_ADMIN_URL );
842
+			$edit_message_template_form_url = add_query_arg(array('action' => $action, 'noheader' => TRUE), EE_MSG_ADMIN_URL);
843 843
 		} else {
844 844
 			$action = 'update_message_template';
845 845
 			$button_both = TRUE;
846 846
 			$button_text = array();
847 847
 			$button_actions = array();
848 848
 			$referrer = $this->_admin_base_url;
849
-			$edit_message_template_form_url = add_query_arg( array( 'action' => $action, 'noheader' => TRUE ), EE_MSG_ADMIN_URL );
849
+			$edit_message_template_form_url = add_query_arg(array('action' => $action, 'noheader' => TRUE), EE_MSG_ADMIN_URL);
850 850
 		}
851 851
 
852 852
 		//set active messenger for this view
@@ -856,13 +856,13 @@  discard block
 block discarded – undo
856 856
 
857 857
 		//Do we have any validation errors?
858 858
 		$validators = $this->_get_transient();
859
-		$v_fields = !empty($validators) ? array_keys($validators) : array();
859
+		$v_fields = ! empty($validators) ? array_keys($validators) : array();
860 860
 
861 861
 
862 862
 		//we need to assemble the title from Various details
863
-		$context_label = sprintf( __('(%s %s)', 'event_espresso'), $c_config[$context]['label'], ucwords($c_label['label'] ));
863
+		$context_label = sprintf(__('(%s %s)', 'event_espresso'), $c_config[$context]['label'], ucwords($c_label['label']));
864 864
 
865
-		$title = sprintf( __(' %s %s Template %s', 'event_espresso'), ucwords($message_template_group->messenger_obj()->label['singular']), ucwords($message_template_group->message_type_obj()->label['singular']), $context_label );
865
+		$title = sprintf(__(' %s %s Template %s', 'event_espresso'), ucwords($message_template_group->messenger_obj()->label['singular']), ucwords($message_template_group->message_type_obj()->label['singular']), $context_label);
866 866
 
867 867
 		$this->_template_args['GRP_ID'] = $GRP_ID;
868 868
 		$this->_template_args['message_template'] = $message_template_group;
@@ -873,7 +873,7 @@  discard block
 block discarded – undo
873 873
 		$MSG = new EE_messages();
874 874
 		$template_field_structure = $MSG->get_fields($message_template_group->messenger(), $message_template_group->message_type());
875 875
 
876
-		if ( !$template_field_structure ) {
876
+		if ( ! $template_field_structure) {
877 877
 			$template_field_structure = FALSE;
878 878
 			$template_fields = __('There was an error in assembling the fields for this display (you should see an error message)', 'event_espresso');
879 879
 		}
@@ -883,38 +883,38 @@  discard block
 block discarded – undo
883 883
 
884 884
 
885 885
 		//if we have the extra key.. then we need to remove the content index from the template_field_structure as it will get handled in the "extra" array.
886
-		if ( is_array($template_field_structure[$context]) && isset( $template_field_structure[$context]['extra']) ) {
887
-			foreach ( $template_field_structure[$context]['extra'] as $reference_field => $new_fields ) {
888
-				unset( $template_field_structure[$context][$reference_field] );
886
+		if (is_array($template_field_structure[$context]) && isset($template_field_structure[$context]['extra'])) {
887
+			foreach ($template_field_structure[$context]['extra'] as $reference_field => $new_fields) {
888
+				unset($template_field_structure[$context][$reference_field]);
889 889
 			}
890 890
 		}
891 891
 
892 892
 		//let's loop through the template_field_structure and actually assemble the input fields!
893
-		if ( !empty($template_field_structure) ) {
894
-			$id_prefix= 'ee-msg-edit-template-fields-';
895
-			foreach ( $template_field_structure[$context] as $template_field => $field_setup_array ) {
893
+		if ( ! empty($template_field_structure)) {
894
+			$id_prefix = 'ee-msg-edit-template-fields-';
895
+			foreach ($template_field_structure[$context] as $template_field => $field_setup_array) {
896 896
 				//if this is an 'extra' template field then we need to remove any existing fields that are keyed up in the extra array and reset them.
897
-				if ( $template_field == 'extra' ) {
897
+				if ($template_field == 'extra') {
898 898
 					$this->_template_args['is_extra_fields'] = TRUE;
899
-					foreach ( $field_setup_array as $reference_field => $new_fields_array ) {
900
-						foreach ( $new_fields_array as $extra_field =>  $extra_array ) {
899
+					foreach ($field_setup_array as $reference_field => $new_fields_array) {
900
+						foreach ($new_fields_array as $extra_field =>  $extra_array) {
901 901
 							//let's verify if we need this extra field via the shortcodes parameter.
902 902
 							$continue = FALSE;
903
-							if ( isset( $extra_array['shortcodes_required'] ) ) {
904
-								foreach ( (array) $extra_array['shortcodes_required'] as $shortcode ) {
905
-									if ( !array_key_exists( $shortcode, $this->_shortcodes ) )
903
+							if (isset($extra_array['shortcodes_required'])) {
904
+								foreach ((array) $extra_array['shortcodes_required'] as $shortcode) {
905
+									if ( ! array_key_exists($shortcode, $this->_shortcodes))
906 906
 										$continue = TRUE;
907 907
 								}
908
-								if ( $continue ) continue;
908
+								if ($continue) continue;
909 909
 							}
910 910
 
911
-							$field_id = $reference_field . '-' . $extra_field . '-content';
911
+							$field_id = $reference_field.'-'.$extra_field.'-content';
912 912
 							$template_form_fields[$field_id] = $extra_array;
913
-							$template_form_fields[$field_id]['name'] = 'MTP_template_fields[' . $reference_field . '][content][' . $extra_field . ']';
914
-							$css_class = isset( $extra_array['css_class'] ) ? $extra_array['css_class'] : '';
915
-							$template_form_fields[$field_id]['css_class'] = !empty( $v_fields ) && in_array($extra_field, $v_fields) && ( is_array($validators[$extra_field] ) && isset( $validators[$extra_field]['msg'] ) ) ? 'validate-error ' . $css_class : $css_class;
913
+							$template_form_fields[$field_id]['name'] = 'MTP_template_fields['.$reference_field.'][content]['.$extra_field.']';
914
+							$css_class = isset($extra_array['css_class']) ? $extra_array['css_class'] : '';
915
+							$template_form_fields[$field_id]['css_class'] = ! empty($v_fields) && in_array($extra_field, $v_fields) && (is_array($validators[$extra_field]) && isset($validators[$extra_field]['msg'])) ? 'validate-error '.$css_class : $css_class;
916 916
 							$content = $message_templates[$context][$reference_field]->get('MTP_content');
917
-							$template_form_fields[$field_id]['value'] = !empty($message_templates) && isset($content[$extra_field]) ? stripslashes( html_entity_decode( $content[$extra_field], ENT_QUOTES, "UTF-8") ) : '';
917
+							$template_form_fields[$field_id]['value'] = ! empty($message_templates) && isset($content[$extra_field]) ? stripslashes(html_entity_decode($content[$extra_field], ENT_QUOTES, "UTF-8")) : '';
918 918
 
919 919
 							//do we have a validation error?  if we do then let's use that value instead
920 920
 							$template_form_fields[$field_id]['value'] = isset($validators[$extra_field]) ? $validators[$extra_field]['value'] : $template_form_fields[$field_id]['value'];
@@ -922,30 +922,30 @@  discard block
 block discarded – undo
922 922
 
923 923
 							$template_form_fields[$field_id]['db-col'] = 'MTP_content';
924 924
 
925
-							if ( isset( $extra_array['input'] ) && $extra_array['input'] == 'wp_editor' ) {
925
+							if (isset($extra_array['input']) && $extra_array['input'] == 'wp_editor') {
926 926
 								//we want to decode the entities
927
-								$template_form_fields[$field_id]['value'] = stripslashes( html_entity_decode( $template_form_fields[$field_id]['value'], ENT_QUOTES, "UTF-8") );
927
+								$template_form_fields[$field_id]['value'] = stripslashes(html_entity_decode($template_form_fields[$field_id]['value'], ENT_QUOTES, "UTF-8"));
928 928
 
929 929
 							}/**/
930 930
 						}
931
-						$templatefield_MTP_id = $reference_field . '-MTP_ID';
932
-						$templatefield_templatename_id = $reference_field . '-name';
931
+						$templatefield_MTP_id = $reference_field.'-MTP_ID';
932
+						$templatefield_templatename_id = $reference_field.'-name';
933 933
 
934 934
 						$template_form_fields[$templatefield_MTP_id] = array(
935
-							'name' => 'MTP_template_fields[' . $reference_field . '][MTP_ID]',
935
+							'name' => 'MTP_template_fields['.$reference_field.'][MTP_ID]',
936 936
 							'label' => NULL,
937 937
 							'input' => 'hidden',
938 938
 							'type' => 'int',
939 939
 							'required' => FALSE,
940 940
 							'validation' => FALSE,
941
-							'value' => !empty($message_templates) ? $message_templates[$context][$reference_field]->ID() : '',
941
+							'value' => ! empty($message_templates) ? $message_templates[$context][$reference_field]->ID() : '',
942 942
 							'css_class' => '',
943 943
 							'format' => '%d',
944 944
 							'db-col' => 'MTP_ID'
945 945
 						);
946 946
 
947 947
 						$template_form_fields[$templatefield_templatename_id] = array(
948
-							'name' => 'MTP_template_fields[' . $reference_field . '][name]',
948
+							'name' => 'MTP_template_fields['.$reference_field.'][name]',
949 949
 							'label' => NULL,
950 950
 							'input' => 'hidden',
951 951
 							'type' => 'string',
@@ -959,10 +959,10 @@  discard block
 block discarded – undo
959 959
 					}
960 960
 					continue; //skip the next stuff, we got the necessary fields here for this dataset.
961 961
 				} else {
962
-					$field_id = $template_field . '-content';
962
+					$field_id = $template_field.'-content';
963 963
 					$template_form_fields[$field_id] = $field_setup_array;
964
-					$template_form_fields[$field_id]['name'] = 'MTP_template_fields[' . $template_field . '][content]';
965
-					$template_form_fields[$field_id]['value'] = !empty($message_templates) && is_array($message_templates[$context]) && isset($message_templates[$context][$template_field]) ?$message_templates[$context][$template_field]->get('MTP_content') : '';
964
+					$template_form_fields[$field_id]['name'] = 'MTP_template_fields['.$template_field.'][content]';
965
+					$template_form_fields[$field_id]['value'] = ! empty($message_templates) && is_array($message_templates[$context]) && isset($message_templates[$context][$template_field]) ? $message_templates[$context][$template_field]->get('MTP_content') : '';
966 966
 
967 967
 					//do we have a validator error for this field?  if we do then we'll use that value instead
968 968
 					$template_form_fields[$field_id]['value'] = isset($validators[$template_field]) ? $validators[$template_field]['value'] : $template_form_fields[$field_id]['value'];
@@ -970,9 +970,9 @@  discard block
 block discarded – undo
970 970
 
971 971
 					$template_form_fields[$field_id]['db-col'] = 'MTP_content';
972 972
 					$css_class = isset($field_setup_array['css_class']) ? $field_setup_array['css_class'] : '';
973
-					$template_form_fields[$field_id]['css_class'] = !empty( $v_fields ) && in_array( $template_field, $v_fields ) && isset( $validators[$template_field]['msg'] ) ? 'validate-error ' . $css_class : $css_class;
973
+					$template_form_fields[$field_id]['css_class'] = ! empty($v_fields) && in_array($template_field, $v_fields) && isset($validators[$template_field]['msg']) ? 'validate-error '.$css_class : $css_class;
974 974
 
975
-					if ( isset( $field_setup_array['input'] ) && $field_setup_array['input'] == 'wp_editor' ) {
975
+					if (isset($field_setup_array['input']) && $field_setup_array['input'] == 'wp_editor') {
976 976
 						//we want to decode the entities
977 977
 						$template_form_fields[$field_id]['value'] = $template_form_fields[$field_id]['value'];
978 978
 					}/**/
@@ -980,25 +980,25 @@  discard block
 block discarded – undo
980 980
 
981 981
 				//k took care of content field(s) now let's take care of others.
982 982
 
983
-				$templatefield_MTP_id = $template_field . '-MTP_ID';
984
-				$templatefield_field_templatename_id = $template_field . '-name';
983
+				$templatefield_MTP_id = $template_field.'-MTP_ID';
984
+				$templatefield_field_templatename_id = $template_field.'-name';
985 985
 
986 986
 				//foreach template field there are actually two form fields created
987 987
 				$template_form_fields[$templatefield_MTP_id] = array(
988
-					'name' => 'MTP_template_fields[' . $template_field . '][MTP_ID]',
988
+					'name' => 'MTP_template_fields['.$template_field.'][MTP_ID]',
989 989
 					'label' => NULL,
990 990
 					'input' => 'hidden',
991 991
 					'type' => 'int',
992 992
 					'required' => FALSE,
993 993
 					'validation' => TRUE,
994
-					'value' => !empty($message_templates) ? $message_templates[$context][$template_field]->ID() : '',
994
+					'value' => ! empty($message_templates) ? $message_templates[$context][$template_field]->ID() : '',
995 995
 					'css_class' => '',
996 996
 					'format' => '%d',
997 997
 					'db-col' => 'MTP_ID'
998 998
 				);
999 999
 
1000 1000
 				$template_form_fields[$templatefield_field_templatename_id] = array(
1001
-					'name' => 'MTP_template_fields[' . $template_field . '][name]',
1001
+					'name' => 'MTP_template_fields['.$template_field.'][name]',
1002 1002
 					'label' => NULL,
1003 1003
 					'input' => 'hidden',
1004 1004
 					'type' => 'string',
@@ -1142,15 +1142,15 @@  discard block
 block discarded – undo
1142 1142
 				'value' => $GRP_ID
1143 1143
 				);
1144 1144
 			$sidebar_form_fields['ee-msg-evt-nonce'] = array(
1145
-				'name' => $action . '_nonce',
1145
+				'name' => $action.'_nonce',
1146 1146
 				'input' => 'hidden',
1147 1147
 				'type' => 'string',
1148
-				'value' => wp_create_nonce( $action . '_nonce')
1148
+				'value' => wp_create_nonce($action.'_nonce')
1149 1149
 				);
1150 1150
 
1151 1151
 			$sidebar_array = array('ee-msg-is-global', 'ee-msg-is-override', 'ee-msg-deleted', 'ee-msg-is-active');
1152 1152
 
1153
-			if ( isset($this->_req_data['template_switch']) && $this->_req_data['template_switch'] ) {
1153
+			if (isset($this->_req_data['template_switch']) && $this->_req_data['template_switch']) {
1154 1154
 				$sidebar_form_fields['ee-msg-template-switch'] = array(
1155 1155
 					'name' => 'template_switch',
1156 1156
 					'input' => 'hidden',
@@ -1161,19 +1161,19 @@  discard block
 block discarded – undo
1161 1161
 
1162 1162
 			//send to field generator
1163 1163
 
1164
-			$template_fields = $this->_generate_admin_form_fields( $template_form_fields );
1165
-			$sidebar_fields = $this->_generate_admin_form_fields( $sidebar_form_fields );
1164
+			$template_fields = $this->_generate_admin_form_fields($template_form_fields);
1165
+			$sidebar_fields = $this->_generate_admin_form_fields($sidebar_form_fields);
1166 1166
 
1167 1167
 
1168 1168
 		} //end if ( !empty($template_field_structure) )
1169 1169
 
1170 1170
 		//set extra content for publish box
1171 1171
 		$this->_template_args['publish_box_extra_content'] = $sidebar_fields;
1172
-		$this->_set_publish_post_box_vars( 'id', $GRP_ID );
1172
+		$this->_set_publish_post_box_vars('id', $GRP_ID);
1173 1173
 
1174 1174
 		//add preview button
1175
-		$preview_url = parent::add_query_args_and_nonce( array( 'message_type' => $message_template_group->message_type(), 'messenger' => $message_template_group->messenger(), 'context' => $context,'GRP_ID' => $GRP_ID, 'action' => 'preview_message' ), $this->_admin_base_url );
1176
-		$preview_button = '<a href="' . $preview_url . '" class="button-secondary messages-preview-button">' . __('Preview', 'event_espresso') . '</a>';
1175
+		$preview_url = parent::add_query_args_and_nonce(array('message_type' => $message_template_group->message_type(), 'messenger' => $message_template_group->messenger(), 'context' => $context, 'GRP_ID' => $GRP_ID, 'action' => 'preview_message'), $this->_admin_base_url);
1176
+		$preview_button = '<a href="'.$preview_url.'" class="button-secondary messages-preview-button">'.__('Preview', 'event_espresso').'</a>';
1177 1177
 
1178 1178
 
1179 1179
 		//setup context switcher
@@ -1199,16 +1199,16 @@  discard block
 block discarded – undo
1199 1199
 		$this->_template_args['before_admin_page_content'] .= $this->_add_form_element_before();
1200 1200
 		$this->_template_args['after_admin_page_content'] = $this->_add_form_element_after();
1201 1201
 
1202
-		$this->_template_path = $this->_template_args['GRP_ID'] ? EE_MSG_TEMPLATE_PATH . 'ee_msg_details_main_edit_meta_box.template.php' : EE_MSG_TEMPLATE_PATH . 'ee_msg_details_main_add_meta_box.template.php';
1202
+		$this->_template_path = $this->_template_args['GRP_ID'] ? EE_MSG_TEMPLATE_PATH.'ee_msg_details_main_edit_meta_box.template.php' : EE_MSG_TEMPLATE_PATH.'ee_msg_details_main_add_meta_box.template.php';
1203 1203
 
1204 1204
 		//send along EE_Message_Template_Group object for further template use.
1205 1205
 		$this->_template_args['MTP'] = $message_template_group;
1206 1206
 
1207
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( $this->_template_path, $this->_template_args, TRUE );
1207
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template($this->_template_path, $this->_template_args, TRUE);
1208 1208
 
1209 1209
 
1210 1210
 		//finally, let's set the admin_page title
1211
-		$this->_admin_page_title = sprintf( __('Editing %s', 'event_espresso'), $title );
1211
+		$this->_admin_page_title = sprintf(__('Editing %s', 'event_espresso'), $title);
1212 1212
 
1213 1213
 
1214 1214
 		//we need to take care of setting the shortcodes property for use elsewhere.
@@ -1221,7 +1221,7 @@  discard block
 block discarded – undo
1221 1221
 	}
1222 1222
 
1223 1223
 
1224
-	public function filter_tinymce_init( $mceInit, $editor_id ) {
1224
+	public function filter_tinymce_init($mceInit, $editor_id) {
1225 1225
 		return $mceInit;
1226 1226
 	}
1227 1227
 
@@ -1232,7 +1232,7 @@  discard block
 block discarded – undo
1232 1232
 	}
1233 1233
 
1234 1234
 	public function _add_form_element_before() {
1235
-		return '<form method="post" action="' . $this->_template_args["edit_message_template_form_url"] . '" id="ee-msg-edit-frm">';
1235
+		return '<form method="post" action="'.$this->_template_args["edit_message_template_form_url"].'" id="ee-msg-edit-frm">';
1236 1236
 	}
1237 1237
 
1238 1238
 	public function _add_form_element_after() {
@@ -1250,32 +1250,32 @@  discard block
 block discarded – undo
1250 1250
 	 * @return json json object
1251 1251
 	 */
1252 1252
 	public function switch_template_pack() {
1253
-		$GRP_ID = ! empty( $this->_req_data['GRP_ID'] ) ? $this->_req_data['GRP_ID'] : 0;
1254
-		$template_pack = ! empty( $this->_req_data['template_pack'] ) ? $this->_req_data['template_pack'] : '';
1253
+		$GRP_ID = ! empty($this->_req_data['GRP_ID']) ? $this->_req_data['GRP_ID'] : 0;
1254
+		$template_pack = ! empty($this->_req_data['template_pack']) ? $this->_req_data['template_pack'] : '';
1255 1255
 
1256 1256
 		//verify we have needed values.
1257
-		if ( empty( $GRP_ID ) || empty( $template_pack ) ) {
1257
+		if (empty($GRP_ID) || empty($template_pack)) {
1258 1258
 			$this->_template_args['error'] = TRUE;
1259
-			EE_Error::add_error( __('The required date for switching templates is not available.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__  );
1259
+			EE_Error::add_error(__('The required date for switching templates is not available.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1260 1260
 		} else {
1261 1261
 			//get template, set the new template_pack and then reset to default
1262
-			$mtpg = EEM_Message_Template_Group::instance()->get_one_by_ID( $GRP_ID );
1262
+			$mtpg = EEM_Message_Template_Group::instance()->get_one_by_ID($GRP_ID);
1263 1263
 
1264
-			$mtpg->set_template_pack_name( $template_pack );
1264
+			$mtpg->set_template_pack_name($template_pack);
1265 1265
 			$this->_req_data['msgr'] = $mtpg->messenger();
1266 1266
 			$this->_req_data['mt'] = $mtpg->message_type();
1267 1267
 
1268 1268
 			$query_args = $this->_reset_to_default_template();
1269 1269
 
1270
-			if ( empty( $query_args['id'] ) ) {
1271
-				EE_Error::add_error( __('Something went wrong with switching the template pack. Please try again or contact EE support', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
1270
+			if (empty($query_args['id'])) {
1271
+				EE_Error::add_error(__('Something went wrong with switching the template pack. Please try again or contact EE support', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1272 1272
 				$this->_template_args['error'] = TRUE;
1273 1273
 			} else {
1274
-				$template_label =$mtpg->get_template_pack()->label;
1274
+				$template_label = $mtpg->get_template_pack()->label;
1275 1275
 				$template_pack_labels = $mtpg->messenger_obj()->get_supports_labels();
1276
-				EE_Error::add_success( sprintf( __('This message template has been successfully switched to use the %s %s.  Please wait while the page reloads with your new template.', 'event_espresso'), $template_label, $template_pack_labels->template_pack ) );
1276
+				EE_Error::add_success(sprintf(__('This message template has been successfully switched to use the %s %s.  Please wait while the page reloads with your new template.', 'event_espresso'), $template_label, $template_pack_labels->template_pack));
1277 1277
 				//generate the redirect url for js.
1278
-				$url = self::add_query_args_and_nonce( $query_args, $this->_admin_base_url );
1278
+				$url = self::add_query_args_and_nonce($query_args, $this->_admin_base_url);
1279 1279
 				$this->_template_args['data']['redirect_url'] = $url;
1280 1280
 				$this->_template_args['success'] = true;
1281 1281
 			}
@@ -1296,56 +1296,56 @@  discard block
 block discarded – undo
1296 1296
 	protected function _reset_to_default_template() {
1297 1297
 		$success = TRUE;
1298 1298
 		$templates = array();
1299
-		$GRP_ID = !empty( $this->_req_data['GRP_ID'] ) ? $this->_req_data['GRP_ID'] : 0;
1299
+		$GRP_ID = ! empty($this->_req_data['GRP_ID']) ? $this->_req_data['GRP_ID'] : 0;
1300 1300
 		//we need to make sure we've got the info we need.
1301
-		if ( !isset( $this->_req_data['msgr'] ) && !isset( $this->_req_data['mt'] ) && !isset( $this->_req_data['GRP_ID'] ) ) {
1302
-			EE_Error::add_error( __('In order to reset the template to its default we require the messenger, message type, and message template GRP_ID to know what is being reset.  At least one of these is missing.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
1301
+		if ( ! isset($this->_req_data['msgr']) && ! isset($this->_req_data['mt']) && ! isset($this->_req_data['GRP_ID'])) {
1302
+			EE_Error::add_error(__('In order to reset the template to its default we require the messenger, message type, and message template GRP_ID to know what is being reset.  At least one of these is missing.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1303 1303
 			$success = FALSE;
1304 1304
 		}
1305 1305
 
1306 1306
 		//all templates will be reset to whatever the defaults are for the global template matching the messenger and message type.
1307
-		$success = !empty( $GRP_ID ) ? TRUE : FALSE;
1307
+		$success = ! empty($GRP_ID) ? TRUE : FALSE;
1308 1308
 
1309
-		if ( $success ) {
1309
+		if ($success) {
1310 1310
 
1311 1311
 			//let's first determine if the incoming template is a global template, if it isn't then we need to get the global template matching messenger and message type.
1312
-			$MTPG = EEM_Message_Template_Group::instance()->get_one_by_ID( $GRP_ID );
1312
+			$MTPG = EEM_Message_Template_Group::instance()->get_one_by_ID($GRP_ID);
1313 1313
 
1314 1314
 
1315 1315
 			//note this is ONLY deleteing the template fields (Message Template rows) NOT the message template group.
1316
-			$success = $this->_delete_mtp_permanently( $GRP_ID, FALSE );
1316
+			$success = $this->_delete_mtp_permanently($GRP_ID, FALSE);
1317 1317
 
1318
-			if ( $success ) {
1318
+			if ($success) {
1319 1319
 				//if successfully deleted, lets generate the new ones.  Note. We set GLOBAL to true, because resets on ANY template will use the related global template defaults for regeneration.  This means that if a custom template is reset it resets to whatever the related global template is.  HOWEVER, we DO keep the template pack and template variation set for the current custom template when resetting.
1320
-				$templates = $this->_generate_new_templates( $this->_req_data['msgr'], $this->_req_data['mt'], $GRP_ID, TRUE );
1320
+				$templates = $this->_generate_new_templates($this->_req_data['msgr'], $this->_req_data['mt'], $GRP_ID, TRUE);
1321 1321
 			}
1322 1322
 
1323 1323
 		}
1324 1324
 
1325 1325
 		//any error messages?
1326
-		if ( !$success ) {
1327
-			EE_Error::add_error( __('Something went wrong with deleting existing templates. Unable to reset to default', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
1326
+		if ( ! $success) {
1327
+			EE_Error::add_error(__('Something went wrong with deleting existing templates. Unable to reset to default', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1328 1328
 		}
1329 1329
 
1330 1330
 		//all good, let's add a success message!
1331
-		if ( $success && ! empty( $templates ) ) {
1331
+		if ($success && ! empty($templates)) {
1332 1332
 			$templates = $templates[0]; //the info for the template we generated is the first element in the returned array.
1333 1333
 			EE_Error::overwrite_success();
1334
-			EE_Error::add_success( __('Templates have been reset to defaults.', 'event_espresso') );
1334
+			EE_Error::add_success(__('Templates have been reset to defaults.', 'event_espresso'));
1335 1335
 		}
1336 1336
 
1337 1337
 
1338 1338
 		$query_args = array(
1339
-			'id' => isset( $templates['GRP_ID'] ) ? $templates['GRP_ID'] : NULL,
1340
-			'context' => isset( $templates['MTP_context'] ) ? $templates['MTP_context'] : NULL,
1341
-			'action' => isset( $templates['GRP_ID'] ) ? 'edit_message_template' : 'default'
1339
+			'id' => isset($templates['GRP_ID']) ? $templates['GRP_ID'] : NULL,
1340
+			'context' => isset($templates['MTP_context']) ? $templates['MTP_context'] : NULL,
1341
+			'action' => isset($templates['GRP_ID']) ? 'edit_message_template' : 'default'
1342 1342
 			);
1343 1343
 
1344 1344
 		//if called via ajax then we return query args otherwise redirect
1345
-		if ( defined('DOING_AJAX') && DOING_AJAX ) {
1345
+		if (defined('DOING_AJAX') && DOING_AJAX) {
1346 1346
 			return $query_args;
1347 1347
 		} else {
1348
-			$this->_redirect_after_action( FALSE, '', '', $query_args, TRUE );
1348
+			$this->_redirect_after_action(FALSE, '', '', $query_args, TRUE);
1349 1349
 		}
1350 1350
 
1351 1351
 	}
@@ -1358,20 +1358,20 @@  discard block
 block discarded – undo
1358 1358
 	 * @param bool $send if TRUE then we are doing an actual TEST send with the results of the preview.
1359 1359
 	 * @return void
1360 1360
 	 */
1361
-	public function _preview_message( $send = FALSE ) {
1361
+	public function _preview_message($send = FALSE) {
1362 1362
 		//first make sure we've got the necessary parameters
1363
-		if ( !isset( $this->_req_data['message_type'] ) || !isset( $this->_req_data['messenger'] ) || !isset( $this->_req_data['messenger'] ) || !isset( $this->_req_data['GRP_ID'] ) ) {
1364
-			EE_Error::add_error( __('Missing necessary parameters for displaying preview', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
1363
+		if ( ! isset($this->_req_data['message_type']) || ! isset($this->_req_data['messenger']) || ! isset($this->_req_data['messenger']) || ! isset($this->_req_data['GRP_ID'])) {
1364
+			EE_Error::add_error(__('Missing necessary parameters for displaying preview', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1365 1365
 		}
1366 1366
 
1367
-		EE_Registry::instance()->REQ->set( 'GRP_ID', $this->_req_data['GRP_ID'] );
1367
+		EE_Registry::instance()->REQ->set('GRP_ID', $this->_req_data['GRP_ID']);
1368 1368
 
1369 1369
 		$MSG = new EE_messages();
1370 1370
 
1371 1371
 		//get the preview!
1372
-		$preview = $MSG->preview_message( $this->_req_data['message_type'], $this->_req_data['context'], $this->_req_data['messenger'], $send );
1372
+		$preview = $MSG->preview_message($this->_req_data['message_type'], $this->_req_data['context'], $this->_req_data['messenger'], $send);
1373 1373
 
1374
-		if ( $send ) {
1374
+		if ($send) {
1375 1375
 			return $preview;
1376 1376
 		}
1377 1377
 
@@ -1381,16 +1381,16 @@  discard block
 block discarded – undo
1381 1381
 			'context' => $this->_req_data['context'],
1382 1382
 			'action' => 'edit_message_template'
1383 1383
 			);
1384
-		$go_back_url = parent::add_query_args_and_nonce( $query_args, $this->_admin_base_url );
1385
-		$preview_button = '<a href="' . $go_back_url . '" class="button-secondary messages-preview-go-back-button">' . __('Go Back to Edit', 'event_espresso') . '</a>';
1384
+		$go_back_url = parent::add_query_args_and_nonce($query_args, $this->_admin_base_url);
1385
+		$preview_button = '<a href="'.$go_back_url.'" class="button-secondary messages-preview-go-back-button">'.__('Go Back to Edit', 'event_espresso').'</a>';
1386 1386
 
1387 1387
 		//let's provide a helpful title for context
1388
-		$preview_title = sprintf( __('Viewing Preview for %s %s Message Template', 'event_espresso'), ucwords($this->_active_messengers[$this->_req_data['messenger']]['obj']->label['singular']), ucwords($this->_active_message_types[$this->_req_data['message_type']]['obj']->label['singular']) );
1388
+		$preview_title = sprintf(__('Viewing Preview for %s %s Message Template', 'event_espresso'), ucwords($this->_active_messengers[$this->_req_data['messenger']]['obj']->label['singular']), ucwords($this->_active_message_types[$this->_req_data['message_type']]['obj']->label['singular']));
1389 1389
 
1390 1390
 
1391 1391
 		//setup display of preview.
1392 1392
 		$this->_admin_page_title = $preview_title;
1393
-		$this->_template_args['admin_page_content'] = $preview_button . '<br />' .stripslashes($preview);
1393
+		$this->_template_args['admin_page_content'] = $preview_button.'<br />'.stripslashes($preview);
1394 1394
 		$this->_template_args['data']['force_json'] = TRUE;
1395 1395
 	}
1396 1396
 
@@ -1418,9 +1418,9 @@  discard block
 block discarded – undo
1418 1418
 	 * @return void
1419 1419
 	 */
1420 1420
 	protected function _register_edit_meta_boxes() {
1421
-		add_meta_box( 'mtp_valid_shortcodes', __('Valid Shortcodes', 'event_espresso'), array( $this, 'shortcode_meta_box' ), $this->_current_screen->id, 'side', 'default' );
1422
-		add_meta_box( 'mtp_extra_actions', __('Extra Actions', 'event_espresso'), array( $this, 'extra_actions_meta_box' ), $this->_current_screen->id, 'side', 'high' );
1423
-		add_meta_box( 'mtp_templates', __('Template Styles', 'event_espresso'), array( $this, 'template_pack_meta_box' ), $this->_current_screen->id, 'side', 'high' );
1421
+		add_meta_box('mtp_valid_shortcodes', __('Valid Shortcodes', 'event_espresso'), array($this, 'shortcode_meta_box'), $this->_current_screen->id, 'side', 'default');
1422
+		add_meta_box('mtp_extra_actions', __('Extra Actions', 'event_espresso'), array($this, 'extra_actions_meta_box'), $this->_current_screen->id, 'side', 'high');
1423
+		add_meta_box('mtp_templates', __('Template Styles', 'event_espresso'), array($this, 'template_pack_meta_box'), $this->_current_screen->id, 'side', 'high');
1424 1424
 	}
1425 1425
 
1426 1426
 
@@ -1441,10 +1441,10 @@  discard block
 block discarded – undo
1441 1441
 
1442 1442
 		$tp_select_values = array();
1443 1443
 
1444
-		foreach ( $template_packs as $tp ) {
1444
+		foreach ($template_packs as $tp) {
1445 1445
 			//only include template packs that support this messenger and message type!
1446 1446
 			$supports = $tp->get_supports();
1447
-			if ( ! isset( $supports[$this->_message_template_group->messenger()] ) || ! in_array( $this->_message_template_group->message_type(), $supports[$this->_message_template_group->messenger()] ) ) {
1447
+			if ( ! isset($supports[$this->_message_template_group->messenger()]) || ! in_array($this->_message_template_group->message_type(), $supports[$this->_message_template_group->messenger()])) {
1448 1448
 				//not supported
1449 1449
 				continue;
1450 1450
 			}
@@ -1456,7 +1456,7 @@  discard block
 block discarded – undo
1456 1456
 		}
1457 1457
 
1458 1458
 		//if empty $tp_select_values then we make sure default is set because EVERY message type should be supported by the default template pack.  This still allows for the odd template pack to override.
1459
-		if ( empty( $tp_select_values ) ) {
1459
+		if (empty($tp_select_values)) {
1460 1460
 			$tp_select_values[] = array(
1461 1461
 				'text' => __('Default', 'event_espresso'),
1462 1462
 				'id' => 'default'
@@ -1464,27 +1464,27 @@  discard block
 block discarded – undo
1464 1464
 		}
1465 1465
 
1466 1466
 		//setup variation select values for the currently selected template.
1467
-		$variations = $this->_message_template_group->get_template_pack()->get_variations( $this->_message_template_group->messenger(), $this->_message_template_group->message_type() );
1467
+		$variations = $this->_message_template_group->get_template_pack()->get_variations($this->_message_template_group->messenger(), $this->_message_template_group->message_type());
1468 1468
 		$variations_select_values = array();
1469
-		foreach ( $variations as $variation => $label ) {
1469
+		foreach ($variations as $variation => $label) {
1470 1470
 			$variations_select_values[] = array(
1471 1471
 				'text' => $label,
1472 1472
 				'id' => $variation
1473 1473
 				);
1474 1474
 		}
1475 1475
 
1476
-		$template_pack_labels= $this->_message_template_group->messenger_obj()->get_supports_labels();
1476
+		$template_pack_labels = $this->_message_template_group->messenger_obj()->get_supports_labels();
1477 1477
 
1478
-		$template_args['template_packs_selector'] = EEH_Form_Fields::select_input( 'MTP_template_pack', $tp_select_values, $this->_message_template_group->get_template_pack_name() );
1479
-		$template_args['variations_selector'] = EEH_Form_Fields::select_input( 'MTP_template_variation', $variations_select_values, $this->_message_template_group->get_template_pack_variation() );
1478
+		$template_args['template_packs_selector'] = EEH_Form_Fields::select_input('MTP_template_pack', $tp_select_values, $this->_message_template_group->get_template_pack_name());
1479
+		$template_args['variations_selector'] = EEH_Form_Fields::select_input('MTP_template_variation', $variations_select_values, $this->_message_template_group->get_template_pack_variation());
1480 1480
 		$template_args['template_pack_label'] = $template_pack_labels->template_pack;
1481 1481
 		$template_args['template_variation_label'] = $template_pack_labels->template_variation;
1482 1482
 		$template_args['template_pack_description'] = $template_pack_labels->template_pack_description;
1483 1483
 		$template_args['template_variation_description'] = $template_pack_labels->template_variation_description;
1484 1484
 
1485
-		$template = EE_MSG_TEMPLATE_PATH . 'template_pack_and_variations_metabox.template.php';
1485
+		$template = EE_MSG_TEMPLATE_PATH.'template_pack_and_variations_metabox.template.php';
1486 1486
 
1487
-		EEH_Template::display_template( $template, $template_args );
1487
+		EEH_Template::display_template($template, $template_args);
1488 1488
 	}
1489 1489
 
1490 1490
 
@@ -1505,52 +1505,52 @@  discard block
 block discarded – undo
1505 1505
 			'GRP_ID' => $this->_message_template_group->GRP_ID()
1506 1506
 			);
1507 1507
 
1508
-		$button = $this->get_action_link_or_button( 'reset_to_default', 'reset', $extra_args, 'button-primary reset-default-button' );
1508
+		$button = $this->get_action_link_or_button('reset_to_default', 'reset', $extra_args, 'button-primary reset-default-button');
1509 1509
 
1510 1510
 
1511 1511
 		//test button
1512 1512
 		//first we need to see if there are any fields
1513 1513
 		$fields = $this->_message_template_group->messenger_obj()->get_test_settings_fields();
1514 1514
 
1515
-		if ( !empty( $fields ) ) {
1515
+		if ( ! empty($fields)) {
1516 1516
 			//yup there be fields
1517
-			foreach ( $fields as $field => $config ) {
1518
-				$field_id = $this->_message_template_group->messenger() . '_' . $field;
1517
+			foreach ($fields as $field => $config) {
1518
+				$field_id = $this->_message_template_group->messenger().'_'.$field;
1519 1519
 				$existing = $this->_message_template_group->messenger_obj()->get_existing_test_settings();
1520
-				$default = isset( $config['default'] ) ? $config['default'] : '';
1521
-				$default = isset( $config['value'] ) ? $config['value'] : $default;
1520
+				$default = isset($config['default']) ? $config['default'] : '';
1521
+				$default = isset($config['value']) ? $config['value'] : $default;
1522 1522
 
1523 1523
 				//if type is hidden and the value is empty something may have gone wrong so let's correct with the defaults
1524 1524
 				$fix = $config['input'] == 'hidden' && isset($existing[$field]) && empty($existing[$field]) ? $default : '';
1525
-				$existing[$field] = isset( $existing[$field] ) && empty( $fix ) ? $existing[$field] : $fix;
1525
+				$existing[$field] = isset($existing[$field]) && empty($fix) ? $existing[$field] : $fix;
1526 1526
 
1527 1527
 				$template_form_fields[$field_id] = array(
1528
-					'name' => 'test_settings_fld[' . $field . ']',
1528
+					'name' => 'test_settings_fld['.$field.']',
1529 1529
 					'label' => $config['label'],
1530 1530
 					'input' => $config['input'],
1531 1531
 					'type' => $config['type'],
1532 1532
 					'required' => $config['required'],
1533 1533
 					'validation' => $config['validation'],
1534
-					'value' => isset( $existing[$field] ) ? $existing[$field] : $default,
1534
+					'value' => isset($existing[$field]) ? $existing[$field] : $default,
1535 1535
 					'css_class' => $config['css_class'],
1536
-					'options' => isset( $config['options'] ) ? $config['options'] : array(),
1536
+					'options' => isset($config['options']) ? $config['options'] : array(),
1537 1537
 					'default' => $default,
1538 1538
 					'format' => $config['format']
1539 1539
 					);
1540 1540
 			}
1541 1541
 		}
1542 1542
 
1543
-		$test_settings_fields = !empty( $template_form_fields) ? $this->_generate_admin_form_fields( $template_form_fields, 'string', 'ee_tst_settings_flds' ) : '';
1543
+		$test_settings_fields = ! empty($template_form_fields) ? $this->_generate_admin_form_fields($template_form_fields, 'string', 'ee_tst_settings_flds') : '';
1544 1544
 
1545 1545
 		$test_settings_html = '';
1546 1546
 		//print out $test_settings_fields
1547
-		if ( !empty( $test_settings_fields ) ) {
1547
+		if ( ! empty($test_settings_fields)) {
1548 1548
 			echo $test_settings_fields;
1549
-			$test_settings_html = '<input type="submit" class="button-primary mtp-test-button alignright" name="test_button" value="' . __('Test Send', 'event_espresso') . '" />';
1549
+			$test_settings_html = '<input type="submit" class="button-primary mtp-test-button alignright" name="test_button" value="'.__('Test Send', 'event_espresso').'" />';
1550 1550
 		}
1551 1551
 
1552 1552
 		//and button
1553
-		echo $test_settings_html . '<div class="publishing-action alignright resetbutton">' . $button . '</div><div style="clear:both"></div>';
1553
+		echo $test_settings_html.'<div class="publishing-action alignright resetbutton">'.$button.'</div><div style="clear:both"></div>';
1554 1554
 	}
1555 1555
 
1556 1556
 
@@ -1564,15 +1564,15 @@  discard block
 block discarded – undo
1564 1564
 		$shortcodes = $this->_get_shortcodes(array(), FALSE); //just make sure shortcodes property is set
1565 1565
 		$messenger = $this->_message_template_group->messenger_obj();
1566 1566
 		//now let's set the content depending on the status of the shortcodes array
1567
-		if ( empty( $shortcodes ) ) {
1568
-			$content = '<p>' . __('There are no valid shortcodes available', 'event_espresso') . '</p>';
1567
+		if (empty($shortcodes)) {
1568
+			$content = '<p>'.__('There are no valid shortcodes available', 'event_espresso').'</p>';
1569 1569
 			echo $content;
1570 1570
 		} else {
1571 1571
 			$alt = 0;
1572 1572
 			?>
1573
-			<div style="float:right; margin-top:10px"><?php echo $this->_get_help_tab_link('message_template_shortcodes'); ?></div><p class="small-text"><?php _e('This is a list of shortcodes that have been organized by content areas where they can be used: ', 'event_espresso' ); ?></p>
1573
+			<div style="float:right; margin-top:10px"><?php echo $this->_get_help_tab_link('message_template_shortcodes'); ?></div><p class="small-text"><?php _e('This is a list of shortcodes that have been organized by content areas where they can be used: ', 'event_espresso'); ?></p>
1574 1574
 
1575
-			<?php foreach ( $shortcodes as $field => $allshortcodes ) : ?>
1575
+			<?php foreach ($shortcodes as $field => $allshortcodes) : ?>
1576 1576
 				<?php
1577 1577
 				//get the field label
1578 1578
 				$field_label = $messenger->get_field_label($field);
@@ -1582,8 +1582,8 @@  discard block
 block discarded – undo
1582 1582
 					<div class="ee-shortcode-table-scroll">
1583 1583
 						<table class="widefat ee-shortcode-table">
1584 1584
 							<tbody>
1585
-					<?php foreach ( $allshortcodes as $code => $label ) : ?>
1586
-						<?php $alt_class = !($alt%2) ? 'class="alternate"' : ''; ?>
1585
+					<?php foreach ($allshortcodes as $code => $label) : ?>
1586
+						<?php $alt_class = ! ($alt % 2) ? 'class="alternate"' : ''; ?>
1587 1587
 						<tr <?php echo $alt_class; ?>>
1588 1588
 							<td><?php echo $code; ?></td>
1589 1589
 						</tr>
@@ -1610,7 +1610,7 @@  discard block
 block discarded – undo
1610 1610
 	protected function _set_shortcodes() {
1611 1611
 
1612 1612
 		//no need to run this if the property is already set
1613
-		if ( !empty($this->_shortcodes ) ) return;
1613
+		if ( ! empty($this->_shortcodes)) return;
1614 1614
 
1615 1615
 		$this->_shortcodes = $this->_get_shortcodes();
1616 1616
 	}
@@ -1627,14 +1627,14 @@  discard block
 block discarded – undo
1627 1627
 	 * @param  boolean $merged Whether to merge all the shortcodes into one list of unique shortcodes
1628 1628
 	 * @return array          Shortcodes indexed by fieldname and the an array of shortcode/label pairs OR if merged is true just an array of shortcode/label pairs.
1629 1629
 	 */
1630
-	protected function _get_shortcodes( $fields = array(), $merged = TRUE ) {
1630
+	protected function _get_shortcodes($fields = array(), $merged = TRUE) {
1631 1631
 		$this->_set_message_template_group();
1632 1632
 
1633 1633
 		//we need the messenger and message template to retrieve the valid shortcodes array.
1634
-		$GRP_ID = isset( $this->_req_data['id'] ) && !empty( $this->_req_data['id'] ) ? absint( $this->_req_data['id'] ) : FALSE;
1635
-		$context = isset( $this->_req_data['context'] ) ? $this->_req_data['context'] : key( $this->_message_template_group->contexts_config() );
1634
+		$GRP_ID = isset($this->_req_data['id']) && ! empty($this->_req_data['id']) ? absint($this->_req_data['id']) : FALSE;
1635
+		$context = isset($this->_req_data['context']) ? $this->_req_data['context'] : key($this->_message_template_group->contexts_config());
1636 1636
 
1637
-		return !empty($GRP_ID) ? $this->_message_template_group->get_shortcodes( $context, $fields, $merged ) : array();
1637
+		return ! empty($GRP_ID) ? $this->_message_template_group->get_shortcodes($context, $fields, $merged) : array();
1638 1638
 	}
1639 1639
 
1640 1640
 
@@ -1647,19 +1647,19 @@  discard block
 block discarded – undo
1647 1647
 	 */
1648 1648
 	protected function _set_message_template_group() {
1649 1649
 
1650
-		if ( !empty( $this->_message_template_group ) )
1650
+		if ( ! empty($this->_message_template_group))
1651 1651
 			return; //get out if this is already set.
1652 1652
 
1653
-		$GRP_ID =  ! empty( $this->_req_data['GRP_ID'] ) ? absint( $this->_req_data['GRP_ID'] ) : FALSE;
1654
-		$GRP_ID = empty( $GRP_ID ) && ! empty( $this->_req_data['id'] ) ? $this->_req_data['id'] : $GRP_ID;
1653
+		$GRP_ID = ! empty($this->_req_data['GRP_ID']) ? absint($this->_req_data['GRP_ID']) : FALSE;
1654
+		$GRP_ID = empty($GRP_ID) && ! empty($this->_req_data['id']) ? $this->_req_data['id'] : $GRP_ID;
1655 1655
 
1656 1656
 		//let's get the message templates
1657 1657
 		$MTP = EEM_Message_Template_Group::instance();
1658 1658
 
1659
-		if ( empty($GRP_ID) )
1659
+		if (empty($GRP_ID))
1660 1660
 			$this->_message_template_group = $MTP->create_default_object();
1661 1661
 		else
1662
-			$this->_message_template_group = $MTP->get_one_by_ID( $GRP_ID );
1662
+			$this->_message_template_group = $MTP->get_one_by_ID($GRP_ID);
1663 1663
 
1664 1664
 		$this->_template_pack = $this->_message_template_group->get_template_pack();
1665 1665
 		$this->_variation = $this->_message_template_group->get_template_pack_variation();
@@ -1685,26 +1685,26 @@  discard block
 block discarded – undo
1685 1685
 		<div class="ee-msg-switcher-container">
1686 1686
 			<form method="get" action="<?php echo EE_MSG_ADMIN_URL; ?>" id="ee-msg-context-switcher-frm">
1687 1687
 				<?php
1688
-					foreach ( $args as $name => $value ) {
1689
-						if ( $name == 'context' || empty($value) || $name == 'extra' ) continue;
1688
+					foreach ($args as $name => $value) {
1689
+						if ($name == 'context' || empty($value) || $name == 'extra') continue;
1690 1690
 						?>
1691 1691
 						<input type="hidden" name="<?php echo $name; ?>" value = "<?php echo $value; ?>" />
1692 1692
 						<?php
1693 1693
 					}
1694 1694
 					//setup nonce_url
1695
-					wp_nonce_field($args['action'] . '_nonce', $args['action'] . '_nonce', false);
1695
+					wp_nonce_field($args['action'].'_nonce', $args['action'].'_nonce', false);
1696 1696
 				?>
1697 1697
 				<select name="context">
1698 1698
 					<?php
1699 1699
 					$context_templates = $template_group_object->context_templates();
1700
-					if ( is_array($context_templates) ) :
1701
-							foreach ( $context_templates as $context => $template_fields ) :
1700
+					if (is_array($context_templates)) :
1701
+							foreach ($context_templates as $context => $template_fields) :
1702 1702
 								$checked = ($context == $args['context']) ? 'selected="selected"' : '';
1703 1703
 					?>
1704 1704
 					<option value="<?php echo $context; ?>" <?php echo $checked; ?>><?php echo $context_details[$context]['label']; ?></option>
1705 1705
 					<?php endforeach; endif; ?>
1706 1706
 				</select>
1707
-				<?php $button_text = sprintf( __('Switch %s', 'event_espresso'), ucwords($context_label['label']) ); ?>
1707
+				<?php $button_text = sprintf(__('Switch %s', 'event_espresso'), ucwords($context_label['label'])); ?>
1708 1708
 				<input id="submit-msg-context-switcher-sbmt" class="button-secondary" type="submit" value="<?php echo $button_text; ?>">
1709 1709
 			</form>
1710 1710
 			<?php echo $args['extra']; ?>
@@ -1728,8 +1728,8 @@  discard block
 block discarded – undo
1728 1728
 	 * @param int $index This helps us know which template field to select from the request array.
1729 1729
 	 */
1730 1730
 	protected function _set_message_template_column_values($index) {
1731
-		if ( is_array($this->_req_data['MTP_template_fields'][$index]['content'] ) ) {
1732
-			foreach ( $this->_req_data['MTP_template_fields'][$index]['content'] as $field => $value ) {
1731
+		if (is_array($this->_req_data['MTP_template_fields'][$index]['content'])) {
1732
+			foreach ($this->_req_data['MTP_template_fields'][$index]['content'] as $field => $value) {
1733 1733
 				$this->_req_data['MTP_template_fields'][$index]['content'][$field] = $value;
1734 1734
 			}
1735 1735
 		} else {
@@ -1761,27 +1761,27 @@  discard block
 block discarded – undo
1761 1761
 
1762 1762
 
1763 1763
 
1764
-	protected function _insert_or_update_message_template($new = FALSE ) {
1764
+	protected function _insert_or_update_message_template($new = FALSE) {
1765 1765
 
1766
-		do_action ( 'AHEE_log', __FILE__, __FUNCTION__, '');
1766
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1767 1767
 		$success = 0;
1768 1768
 		$override = FALSE;
1769 1769
 
1770 1770
 		//setup notices description
1771
-		$messenger = !empty($this->_req_data['MTP_messenger']) ? ucwords(str_replace('_', ' ', $this->_req_data['MTP_messenger'] ) ) : false;
1772
-		$message_type = !empty($this->_req_data['MTP_message_type']) ? ucwords(str_replace('_', ' ', $this->_req_data['MTP_message_type'] ) ) : false;
1773
-		$context = !empty($this->_req_data['MTP_context']) ? ucwords(str_replace('_', ' ', $this->_req_data['MTP_context'] ) ) : false;
1771
+		$messenger = ! empty($this->_req_data['MTP_messenger']) ? ucwords(str_replace('_', ' ', $this->_req_data['MTP_messenger'])) : false;
1772
+		$message_type = ! empty($this->_req_data['MTP_message_type']) ? ucwords(str_replace('_', ' ', $this->_req_data['MTP_message_type'])) : false;
1773
+		$context = ! empty($this->_req_data['MTP_context']) ? ucwords(str_replace('_', ' ', $this->_req_data['MTP_context'])) : false;
1774 1774
 
1775
-		$item_desc = $messenger ? $messenger . ' ' . $message_type . ' ' . $context . ' ' : '';
1775
+		$item_desc = $messenger ? $messenger.' '.$message_type.' '.$context.' ' : '';
1776 1776
 		$item_desc .= 'Message Template';
1777 1777
 		$query_args = array();
1778 1778
 		$validates = '';
1779 1779
 
1780 1780
 		//if this is "new" then we need to generate the default contexts for the selected messenger/message_type for user to edit.
1781
-		if ( $new ) {
1782
-			$GRP_ID = !empty( $this->_req_data['GRP_ID'] ) ? $this->_req_data['GRP_ID'] : 0;
1783
-			if ( $edit_array = $this->_generate_new_templates($messenger, $message_type, $GRP_ID ) ) {
1784
-				if ( empty($edit_array) ) {
1781
+		if ($new) {
1782
+			$GRP_ID = ! empty($this->_req_data['GRP_ID']) ? $this->_req_data['GRP_ID'] : 0;
1783
+			if ($edit_array = $this->_generate_new_templates($messenger, $message_type, $GRP_ID)) {
1784
+				if (empty($edit_array)) {
1785 1785
 					$success = 0;
1786 1786
 				} else {
1787 1787
 					$success = 1;
@@ -1800,34 +1800,34 @@  discard block
 block discarded – undo
1800 1800
 
1801 1801
 
1802 1802
 			//run update for each template field in displayed context
1803
-			if ( !isset($this->_req_data['MTP_template_fields']) && empty($this->_req_data['MTP_template_fields'] ) ) {
1804
-				EE_Error::add_error( __('There was a problem saving the template fields from the form because I didn\'t receive any actual template field data.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
1803
+			if ( ! isset($this->_req_data['MTP_template_fields']) && empty($this->_req_data['MTP_template_fields'])) {
1804
+				EE_Error::add_error(__('There was a problem saving the template fields from the form because I didn\'t receive any actual template field data.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1805 1805
 				$success = 0;
1806 1806
 				$action_desc = '';
1807 1807
 
1808 1808
 			} else {
1809 1809
 				//first validate all fields!
1810
-				$validates = $MTPG->validate($this->_req_data['MTP_template_fields'], $this->_req_data['MTP_context'],  $this->_req_data['MTP_messenger'], $this->_req_data['MTP_message_type']);
1810
+				$validates = $MTPG->validate($this->_req_data['MTP_template_fields'], $this->_req_data['MTP_context'], $this->_req_data['MTP_messenger'], $this->_req_data['MTP_message_type']);
1811 1811
 
1812 1812
 				//if $validate returned error messages (i.e. is_array()) then we need to process them and setup an appropriate response. HMM, dang this isn't correct, $validates will ALWAYS be an array.  WE need to make sure there is no actual error messages in validates.
1813
-				if ( is_array($validates) && !empty($validates) ) {
1813
+				if (is_array($validates) && ! empty($validates)) {
1814 1814
 					//add the transient so when the form loads we know which fields to highlight
1815
-					$this->_add_transient( 'edit_message_template', $validates );
1815
+					$this->_add_transient('edit_message_template', $validates);
1816 1816
 
1817 1817
 					$success = 0;
1818
-					$action_desc ='';
1818
+					$action_desc = '';
1819 1819
 
1820 1820
 					//setup notices
1821
-					foreach ( $validates as $field => $error ) {
1822
-						if ( isset($error['msg'] ) )
1823
-							EE_Error::add_error( $error['msg'], __FILE__, __FUNCTION__, __LINE__ );
1821
+					foreach ($validates as $field => $error) {
1822
+						if (isset($error['msg']))
1823
+							EE_Error::add_error($error['msg'], __FILE__, __FUNCTION__, __LINE__);
1824 1824
 					}
1825 1825
 
1826 1826
 				} else {
1827
-					foreach ( $this->_req_data['MTP_template_fields'] as $template_field => $content ) {
1827
+					foreach ($this->_req_data['MTP_template_fields'] as $template_field => $content) {
1828 1828
 						$set_column_values = $this->_set_message_template_column_values($template_field);
1829 1829
 
1830
-						$where_cols_n_values = array( 'MTP_ID' => $this->_req_data['MTP_template_fields'][$template_field]['MTP_ID']);
1830
+						$where_cols_n_values = array('MTP_ID' => $this->_req_data['MTP_template_fields'][$template_field]['MTP_ID']);
1831 1831
 
1832 1832
 						$message_template_fields = array(
1833 1833
 							'GRP_ID' => $set_column_values['GRP_ID'],
@@ -1835,10 +1835,10 @@  discard block
 block discarded – undo
1835 1835
 							'MTP_context' => $set_column_values['MTP_context'],
1836 1836
 							'MTP_content' => $set_column_values['MTP_content']
1837 1837
 							);
1838
-						if ( $updated = $MTP->update( $message_template_fields, array( $where_cols_n_values ) ) ) {
1839
-							if ( $updated === FALSE ) {
1840
-								$msg = sprintf( __('%s field was NOT updated for some reason', 'event_espresso'), $template_field );
1841
-								EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__ );
1838
+						if ($updated = $MTP->update($message_template_fields, array($where_cols_n_values))) {
1839
+							if ($updated === FALSE) {
1840
+								$msg = sprintf(__('%s field was NOT updated for some reason', 'event_espresso'), $template_field);
1841
+								EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1842 1842
 							} else {
1843 1843
 								$success = 1;
1844 1844
 							}
@@ -1855,24 +1855,24 @@  discard block
 block discarded – undo
1855 1855
 						'MTP_is_override' => $set_column_values['MTP_is_override'],
1856 1856
 						'MTP_deleted' => $set_column_values['MTP_deleted'],
1857 1857
 						'MTP_is_active' => $set_column_values['MTP_is_active'],
1858
-						'MTP_name' => !empty( $this->_req_data['ee_msg_non_global_fields']['MTP_name'] ) ? $this->_req_data['ee_msg_non_global_fields']['MTP_name'] : '',
1859
-						'MTP_description' => !empty( $this->_req_data['ee_msg_non_global_fields']['MTP_description'] ) ? $this->_req_data['ee_msg_non_global_fields']['MTP_description'] : ''
1858
+						'MTP_name' => ! empty($this->_req_data['ee_msg_non_global_fields']['MTP_name']) ? $this->_req_data['ee_msg_non_global_fields']['MTP_name'] : '',
1859
+						'MTP_description' => ! empty($this->_req_data['ee_msg_non_global_fields']['MTP_description']) ? $this->_req_data['ee_msg_non_global_fields']['MTP_description'] : ''
1860 1860
 						);
1861 1861
 
1862
-					$mtpg_where = array('GRP_ID' => $set_column_values['GRP_ID'] );
1863
-					$updated = $MTPG->update( $mtpg_fields, array($mtpg_where) );
1862
+					$mtpg_where = array('GRP_ID' => $set_column_values['GRP_ID']);
1863
+					$updated = $MTPG->update($mtpg_fields, array($mtpg_where));
1864 1864
 
1865
-					if ( $updated === FALSE ) {
1866
-						$msg = sprintf( __('The Message Template Group (%d) was NOT updated for some reason', 'event_espresso'), $set_column_values['GRP_ID'] );
1867
-						EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__ );
1865
+					if ($updated === FALSE) {
1866
+						$msg = sprintf(__('The Message Template Group (%d) was NOT updated for some reason', 'event_espresso'), $set_column_values['GRP_ID']);
1867
+						EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1868 1868
 					} else {
1869 1869
 						//k now we need to ensure the template_pack and template_variation fields are set.
1870
-						$template_pack = ! empty( $this->_req_data['MTP_template_pack' ] ) ? $this->_req_data['MTP_template_pack'] : 'default';
1871
-						$template_variation = ! empty( $this->_req_data['MTP_template_variation'] ) ? $this->_req_data['MTP_template_variation'] : 'default';
1872
-						$mtpg_obj = $MTPG->get_one_by_ID( $set_column_values['GRP_ID'] );
1873
-						if ( $mtpg_obj instanceof EE_Message_Template_Group ) {
1874
-							$mtpg_obj->set_template_pack_name( $template_pack );
1875
-							$mtpg_obj->set_template_pack_variation( $template_variation );
1870
+						$template_pack = ! empty($this->_req_data['MTP_template_pack']) ? $this->_req_data['MTP_template_pack'] : 'default';
1871
+						$template_variation = ! empty($this->_req_data['MTP_template_variation']) ? $this->_req_data['MTP_template_variation'] : 'default';
1872
+						$mtpg_obj = $MTPG->get_one_by_ID($set_column_values['GRP_ID']);
1873
+						if ($mtpg_obj instanceof EE_Message_Template_Group) {
1874
+							$mtpg_obj->set_template_pack_name($template_pack);
1875
+							$mtpg_obj->set_template_pack_variation($template_variation);
1876 1876
 						}
1877 1877
 						$success = 1;
1878 1878
 					}
@@ -1882,7 +1882,7 @@  discard block
 block discarded – undo
1882 1882
 		}
1883 1883
 
1884 1884
 		//we return things differently if doing ajax
1885
-		if ( defined('DOING_AJAX') && DOING_AJAX ) {
1885
+		if (defined('DOING_AJAX') && DOING_AJAX) {
1886 1886
 			$this->_template_args['success'] = $success;
1887 1887
 			$this->_template_args['error'] = ! $success ? TRUE : FALSE;
1888 1888
 			$this->_template_args['content'] = '';
@@ -1890,9 +1890,9 @@  discard block
 block discarded – undo
1890 1890
 				'grpID' => $edit_array['GRP_ID'],
1891 1891
 				'templateName' => $edit_array['template_name']
1892 1892
 				);
1893
-			if ( $success ) {
1893
+			if ($success) {
1894 1894
 				EE_Error::overwrite_success();
1895
-				EE_Error::add_success( __('The new template has been created and automatically selected for this event.  You can edit the new template by clicking the edit button.  Note before this template is assigned to this event, the event must be saved.', 'event_espresso') );
1895
+				EE_Error::add_success(__('The new template has been created and automatically selected for this event.  You can edit the new template by clicking the edit button.  Note before this template is assigned to this event, the event must be saved.', 'event_espresso'));
1896 1896
 			}
1897 1897
 
1898 1898
 			$this->_return_json();
@@ -1900,13 +1900,13 @@  discard block
 block discarded – undo
1900 1900
 
1901 1901
 
1902 1902
 		//was a test send triggered?
1903
-		if ( isset( $this->_req_data['test_button'] ) ) {
1903
+		if (isset($this->_req_data['test_button'])) {
1904 1904
 			EE_Error::overwrite_success();
1905
-			$this->_do_test_send( $this->_req_data['MTP_context'],  $this->_req_data['MTP_messenger'], $this->_req_data['MTP_message_type'] );
1905
+			$this->_do_test_send($this->_req_data['MTP_context'], $this->_req_data['MTP_messenger'], $this->_req_data['MTP_message_type']);
1906 1906
 			$override = TRUE;
1907 1907
 		}
1908 1908
 
1909
-		if ( empty( $query_args ) ) {
1909
+		if (empty($query_args)) {
1910 1910
 			$query_args = array(
1911 1911
 				'id' => $this->_req_data['GRP_ID'],
1912 1912
 				'context' => $this->_req_data['MTP_context'],
@@ -1914,7 +1914,7 @@  discard block
 block discarded – undo
1914 1914
 				);
1915 1915
 		}
1916 1916
 
1917
-		$this->_redirect_after_action( $success, $item_desc, $action_desc, $query_args, $override );
1917
+		$this->_redirect_after_action($success, $item_desc, $action_desc, $query_args, $override);
1918 1918
 	}
1919 1919
 
1920 1920
 
@@ -1927,24 +1927,24 @@  discard block
 block discarded – undo
1927 1927
 	 * @param  string $message_type message type being tested
1928 1928
 	 * @return void
1929 1929
 	 */
1930
-	protected function _do_test_send( $context, $messenger, $message_type ) {
1930
+	protected function _do_test_send($context, $messenger, $message_type) {
1931 1931
 		//set things up for preview
1932 1932
 		$this->_req_data['messenger'] = $messenger;
1933 1933
 		$this->_req_data['message_type'] = $message_type;
1934 1934
 		$this->_req_data['context'] = $context;
1935
-		$this->_req_data['GRP_ID'] = isset($this->_req_data['GRP_ID'] ) ? $this->_req_data['GRP_ID'] : '';
1935
+		$this->_req_data['GRP_ID'] = isset($this->_req_data['GRP_ID']) ? $this->_req_data['GRP_ID'] : '';
1936 1936
 
1937 1937
 		//let's save any existing fields that might be required by the messenger
1938
-		if ( isset( $this->_req_data['test_settings_fld'] ) ) {
1939
-			$this->_active_messengers[$messenger]['obj']->set_existing_test_settings( $this->_req_data['test_settings_fld'] );
1938
+		if (isset($this->_req_data['test_settings_fld'])) {
1939
+			$this->_active_messengers[$messenger]['obj']->set_existing_test_settings($this->_req_data['test_settings_fld']);
1940 1940
 		}
1941 1941
 
1942 1942
 		$success = $this->_preview_message(TRUE);
1943 1943
 
1944
-		if ( $success ) {
1945
-			EE_Error::add_success( __('Test message sent', 'event_espresso') );
1944
+		if ($success) {
1945
+			EE_Error::add_success(__('Test message sent', 'event_espresso'));
1946 1946
 		} else {
1947
-			EE_Error::add_error( __('The test message was not sent', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
1947
+			EE_Error::add_error(__('The test message was not sent', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1948 1948
 		}
1949 1949
 	}
1950 1950
 
@@ -1966,12 +1966,12 @@  discard block
 block discarded – undo
1966 1966
 	protected function _generate_new_templates($messenger, $message_types, $GRP_ID = 0, $global = FALSE) {
1967 1967
 
1968 1968
 		//if no $message_types are given then that's okay... this may be a messenger that just adds shortcodes, so we just don't generate any templates.
1969
-		if ( empty( $message_types ) )
1969
+		if (empty($message_types))
1970 1970
 			return true;
1971 1971
 
1972
-		EE_Registry::instance()->load_helper( 'MSG_Template' );
1972
+		EE_Registry::instance()->load_helper('MSG_Template');
1973 1973
 
1974
-		return EEH_MSG_Template::generate_new_templates($messenger, $message_types, $GRP_ID,  $global);
1974
+		return EEH_MSG_Template::generate_new_templates($messenger, $message_types, $GRP_ID, $global);
1975 1975
 
1976 1976
 	}
1977 1977
 
@@ -1987,33 +1987,33 @@  discard block
 block discarded – undo
1987 1987
 	 * @param boolean $all whether this is going to trash/restore all contexts within a template group (TRUE) OR just an individual context (FALSE).
1988 1988
 	 * @return void
1989 1989
 	 */
1990
-	protected function _trash_or_restore_message_template($trash = TRUE, $all = FALSE ) {
1991
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
1990
+	protected function _trash_or_restore_message_template($trash = TRUE, $all = FALSE) {
1991
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1992 1992
 		$MTP = EEM_Message_Template_Group::instance();
1993 1993
 
1994 1994
 		$success = 1;
1995 1995
 
1996 1996
 		//incoming GRP_IDs
1997
-		if ( $all ) {
1997
+		if ($all) {
1998 1998
 			//Checkboxes
1999
-			if ( !empty( $this->_req_data['checkbox'] ) && is_array($this->_req_data['checkbox'] ) ) {
1999
+			if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
2000 2000
 				//if array has more than one element then success message should be plural.
2001 2001
 				//todo: what about nonce?
2002
-				$success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1;
2002
+				$success = count($this->_req_data['checkbox']) > 1 ? 2 : 1;
2003 2003
 
2004 2004
 				//cycle through checkboxes
2005
-				while ( list( $GRP_ID, $value ) = each ($this->_req_data['checkbox']) ) {
2006
-					$trashed_or_restored = $trash ? $MTP->delete_by_ID( $GRP_ID ) : $MTP->restore_by_ID( $GRP_ID );
2007
-					if ( ! $trashed_or_restored ) {
2005
+				while (list($GRP_ID, $value) = each($this->_req_data['checkbox'])) {
2006
+					$trashed_or_restored = $trash ? $MTP->delete_by_ID($GRP_ID) : $MTP->restore_by_ID($GRP_ID);
2007
+					if ( ! $trashed_or_restored) {
2008 2008
 						$success = 0;
2009 2009
 					}
2010 2010
 				}
2011 2011
 			} else {
2012 2012
 				//grab single GRP_ID and handle
2013
-				$GRP_ID = isset( $this->_req_data['id'] ) ? absint($this->_req_data['id']) : 0;
2014
-				if ( ! empty( $GRP_ID ) ) {
2015
-					$trashed_or_restored = $trash ? $MTP->delete_by_ID( $GRP_ID ) : $MTP->restore_by_ID( $GRP_ID );
2016
-					if ( ! $trashed_or_restored ) {
2013
+				$GRP_ID = isset($this->_req_data['id']) ? absint($this->_req_data['id']) : 0;
2014
+				if ( ! empty($GRP_ID)) {
2015
+					$trashed_or_restored = $trash ? $MTP->delete_by_ID($GRP_ID) : $MTP->restore_by_ID($GRP_ID);
2016
+					if ( ! $trashed_or_restored) {
2017 2017
 						$success = 0;
2018 2018
 					}
2019 2019
 				} else {
@@ -2025,13 +2025,13 @@  discard block
 block discarded – undo
2025 2025
 
2026 2026
 		$action_desc = $trash ? __('moved to the trash', 'event_espresso') : __('restored', 'event_espresso');
2027 2027
 
2028
-		$action_desc = !empty( $this->_req_data['template_switch'] ) ? __('switched') : $action_desc;
2028
+		$action_desc = ! empty($this->_req_data['template_switch']) ? __('switched') : $action_desc;
2029 2029
 
2030 2030
 		$item_desc = $all ? _n('Message Template Group', 'Message Template Groups', $success, 'event_espresso') : _n('Message Template Context', 'Message Template Contexts', $success, 'event_espresso');
2031 2031
 
2032
-		$item_desc = !empty( $this->_req_data['template_switch'] ) ? _n('template', 'templates', $success, 'event_espresso') : $item_desc;
2032
+		$item_desc = ! empty($this->_req_data['template_switch']) ? _n('template', 'templates', $success, 'event_espresso') : $item_desc;
2033 2033
 
2034
-		$this->_redirect_after_action( $success, $item_desc, $action_desc, array() );
2034
+		$this->_redirect_after_action($success, $item_desc, $action_desc, array());
2035 2035
 
2036 2036
 	}
2037 2037
 
@@ -2047,26 +2047,26 @@  discard block
 block discarded – undo
2047 2047
 	 * @return void
2048 2048
 	 */
2049 2049
 	protected function _delete_message_template() {
2050
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
2050
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2051 2051
 
2052 2052
 		$success = 1;
2053 2053
 
2054 2054
 		//checkboxes
2055
-		if ( !empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'] ) ) {
2055
+		if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
2056 2056
 			//if array has more than one element then success message should be plural
2057
-			$success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1;
2057
+			$success = count($this->_req_data['checkbox']) > 1 ? 2 : 1;
2058 2058
 
2059 2059
 			//cycle through bulk action checkboxes
2060
-			while ( list( $GRP_ID, $value ) = each($this->_req_data['checkbox'] ) ) {
2061
-				$success = $this->_delete_mtp_permanently( $GRP_ID );
2060
+			while (list($GRP_ID, $value) = each($this->_req_data['checkbox'])) {
2061
+				$success = $this->_delete_mtp_permanently($GRP_ID);
2062 2062
 			}
2063 2063
 		} else {
2064 2064
 			//grab single grp_id and delete
2065
-			$GRP_ID = absint($this->_req_data['id'] );
2066
-			$success = $this->_delete_mtp_permanently( $GRP_ID );
2065
+			$GRP_ID = absint($this->_req_data['id']);
2066
+			$success = $this->_delete_mtp_permanently($GRP_ID);
2067 2067
 		}
2068 2068
 
2069
-		$this->_redirect_after_action( $success, 'Message Templates', 'deleted', array() );
2069
+		$this->_redirect_after_action($success, 'Message Templates', 'deleted', array());
2070 2070
 
2071 2071
 	}
2072 2072
 
@@ -2079,20 +2079,20 @@  discard block
 block discarded – undo
2079 2079
 	 * @param  bool $include_group whether to delete the Message Template Group as well.
2080 2080
 	 * @return success        boolean to indicate the success of the deletes or not.
2081 2081
 	 */
2082
-	private function _delete_mtp_permanently( $GRP_ID, $include_group = TRUE ) {
2082
+	private function _delete_mtp_permanently($GRP_ID, $include_group = TRUE) {
2083 2083
 		$success = 1;
2084 2084
 		$MTPG = EEM_Message_Template_Group::instance();
2085 2085
 		//first let's GET this group
2086
-		$MTG = $MTPG->get_one_by_ID( $GRP_ID );
2086
+		$MTG = $MTPG->get_one_by_ID($GRP_ID);
2087 2087
 		//then delete permanently all the related Message Templates
2088
-		$deleted = $MTG->delete_related_permanently( 'Message_Template' );
2088
+		$deleted = $MTG->delete_related_permanently('Message_Template');
2089 2089
 
2090
-		if ( $deleted === 0 )
2090
+		if ($deleted === 0)
2091 2091
 			$success = 0;
2092 2092
 
2093 2093
 		//now delete permanently this particular group
2094 2094
 
2095
-		if ( $include_group && ! $MTG->delete_permanently() ) {
2095
+		if ($include_group && ! $MTG->delete_permanently()) {
2096 2096
 			$success = 0;
2097 2097
 		}
2098 2098
 		return $success;
@@ -2110,7 +2110,7 @@  discard block
 block discarded – undo
2110 2110
 	*	@return string
2111 2111
 	*/
2112 2112
 	protected function _learn_more_about_message_templates_link() {
2113
-		return '<a class="hidden" style="margin:0 20px; cursor:pointer; font-size:12px;" >' . __('learn more about how message templates works', 'event_espresso') . '</a>';
2113
+		return '<a class="hidden" style="margin:0 20px; cursor:pointer; font-size:12px;" >'.__('learn more about how message templates works', 'event_espresso').'</a>';
2114 2114
 	}
2115 2115
 
2116 2116
 
@@ -2124,14 +2124,14 @@  discard block
 block discarded – undo
2124 2124
 	 */
2125 2125
 	protected function _settings() {
2126 2126
 
2127
-		EE_Registry::instance()->load_helper( 'Tabbed_Content' );
2127
+		EE_Registry::instance()->load_helper('Tabbed_Content');
2128 2128
 
2129 2129
 		$this->_set_m_mt_settings();
2130 2130
 
2131
-		$selected_messenger = isset( $this->_req_data['selected_messenger'] ) ? $this->_req_data['selected_messenger'] : 'email';
2131
+		$selected_messenger = isset($this->_req_data['selected_messenger']) ? $this->_req_data['selected_messenger'] : 'email';
2132 2132
 
2133 2133
 		//let's setup the messenger tabs
2134
-		$this->_template_args['admin_page_header'] = EEH_Tabbed_Content::tab_text_links( $this->_m_mt_settings['messenger_tabs'], 'messenger_links', '|', $selected_messenger );
2134
+		$this->_template_args['admin_page_header'] = EEH_Tabbed_Content::tab_text_links($this->_m_mt_settings['messenger_tabs'], 'messenger_links', '|', $selected_messenger);
2135 2135
 		$this->_template_args['before_admin_page_content'] = '<div class="ui-widget ui-helper-clearfix">';
2136 2136
 		$this->_template_args['after_admin_page_content'] = '</div><!-- end .ui-widget -->';
2137 2137
 
@@ -2150,10 +2150,10 @@  discard block
 block discarded – undo
2150 2150
 	 */
2151 2151
 	protected function _set_m_mt_settings() {
2152 2152
 		//first if this is already set then lets get out no need to regenerate data.
2153
-		if ( !empty($this->_m_mt_settings) )
2153
+		if ( ! empty($this->_m_mt_settings))
2154 2154
 			return;
2155 2155
 
2156
-		$selected_messenger = isset( $this->_req_data['selected_messenger'] ) ? $this->_req_data['selected_messenger'] : 'email';
2156
+		$selected_messenger = isset($this->_req_data['selected_messenger']) ? $this->_req_data['selected_messenger'] : 'email';
2157 2157
 
2158 2158
 		//get all installed messengers and message_types
2159 2159
 		$installed_message_objects = $this->_get_installed_message_objects();
@@ -2163,10 +2163,10 @@  discard block
 block discarded – undo
2163 2163
 
2164 2164
 		//assemble the array for the _tab_text_links helper
2165 2165
 
2166
-		foreach ( $messengers as $messenger ) {
2166
+		foreach ($messengers as $messenger) {
2167 2167
 			$this->_m_mt_settings['messenger_tabs'][$messenger->name] = array(
2168 2168
 				'label' => ucwords($messenger->label['singular']),
2169
-				'class' => isset( $this->_active_messengers[$messenger->name] ) ? 'messenger-active' : '',
2169
+				'class' => isset($this->_active_messengers[$messenger->name]) ? 'messenger-active' : '',
2170 2170
 				'href' => $messenger->name,
2171 2171
 				'title' => __('Modify this Messenger', 'event_espresso'),
2172 2172
 				'slug' => $messenger->name,
@@ -2176,23 +2176,23 @@  discard block
 block discarded – undo
2176 2176
 			$message_types_for_messenger = $messenger->get_valid_message_types();
2177 2177
 
2178 2178
 			//assemble the array for the ACTIVE and INACTIVE message types with the selected messenger //note that all message types will be in the inactive box if the messenger is NOT active.
2179
-			$selected_settings = isset( $this->_active_messengers[$messenger->name]['settings'] ) ? $this->_active_messengers[$messenger->name]['settings'] : array();
2180
-			foreach ( $message_types as $message_type ) {
2179
+			$selected_settings = isset($this->_active_messengers[$messenger->name]['settings']) ? $this->_active_messengers[$messenger->name]['settings'] : array();
2180
+			foreach ($message_types as $message_type) {
2181 2181
 				//first we need to verify that this message type is valid with this messenger. Cause if it isn't then it shouldn't show in either the inactive OR active metabox.
2182
-				if ( ! in_array( $message_type->name, $message_types_for_messenger ) ) {
2182
+				if ( ! in_array($message_type->name, $message_types_for_messenger)) {
2183 2183
 					continue;
2184 2184
 				}
2185 2185
 
2186
-				$a_or_i = isset( $selected_settings[$messenger->name . '-message_types'][$message_type->name] ) && $selected_settings[$messenger->name . '-message_types'][$message_type->name] ? 'active' : 'inactive';
2186
+				$a_or_i = isset($selected_settings[$messenger->name.'-message_types'][$message_type->name]) && $selected_settings[$messenger->name.'-message_types'][$message_type->name] ? 'active' : 'inactive';
2187 2187
 
2188 2188
 				$this->_m_mt_settings['message_type_tabs'][$messenger->name][$a_or_i][$message_type->name] = array(
2189 2189
 						'label' => ucwords($message_type->label['singular']),
2190
-						'class' => 'message-type-' . $a_or_i,
2191
-						'slug_id' => $message_type->name . '-messagetype-' . $messenger->name,
2192
-						'mt_nonce' => wp_create_nonce($message_type->name . '_nonce'),
2193
-						'href' => 'espresso_' . $message_type->name . '_message_type_settings',
2190
+						'class' => 'message-type-'.$a_or_i,
2191
+						'slug_id' => $message_type->name.'-messagetype-'.$messenger->name,
2192
+						'mt_nonce' => wp_create_nonce($message_type->name.'_nonce'),
2193
+						'href' => 'espresso_'.$message_type->name.'_message_type_settings',
2194 2194
 						'title' => $a_or_i == 'active' ? __('Drag this message type to the Inactive window to deactivate', 'event_espresso') : __('Drag this message type to the messenger to activate', 'event_espresso'),
2195
-						'content' => $a_or_i == 'active' ? $this->_message_type_settings_content( $message_type, $messenger, TRUE ) : $this->_message_type_settings_content( $message_type, $messenger ),
2195
+						'content' => $a_or_i == 'active' ? $this->_message_type_settings_content($message_type, $messenger, TRUE) : $this->_message_type_settings_content($message_type, $messenger),
2196 2196
 						'slug' => $message_type->name,
2197 2197
 						'active' => $a_or_i == 'active' ? TRUE : FALSE,
2198 2198
 						'obj' => $message_type
@@ -2209,34 +2209,34 @@  discard block
 block discarded – undo
2209 2209
 	 * @param  boolean $active       Whether the message type is active or not
2210 2210
 	 * @return string                html output for the content
2211 2211
 	 */
2212
-	protected function _message_type_settings_content( $message_type, $messenger, $active = FALSE ) {
2212
+	protected function _message_type_settings_content($message_type, $messenger, $active = FALSE) {
2213 2213
 		//get message type fields
2214 2214
 		$fields = $message_type->get_admin_settings_fields();
2215
-		$settings_template_args['template_form_fields']= '';
2215
+		$settings_template_args['template_form_fields'] = '';
2216 2216
 
2217
-		if ( !empty( $fields ) && $active ) {
2217
+		if ( ! empty($fields) && $active) {
2218 2218
 
2219
-			$existing_settings = $message_type->get_existing_admin_settings( $messenger->name );
2219
+			$existing_settings = $message_type->get_existing_admin_settings($messenger->name);
2220 2220
 
2221
-			foreach( $fields as $fldname => $fldprops ) {
2222
-				$field_id = $messenger->name . '-' . $message_type->name . '-' . $fldname;
2221
+			foreach ($fields as $fldname => $fldprops) {
2222
+				$field_id = $messenger->name.'-'.$message_type->name.'-'.$fldname;
2223 2223
 				$template_form_field[$field_id] = array(
2224
-					'name' => 'message_type_settings[' . $fldname . ']',
2224
+					'name' => 'message_type_settings['.$fldname.']',
2225 2225
 					'label' => $fldprops['label'],
2226 2226
 					'input' => $fldprops['field_type'],
2227 2227
 					'type' => $fldprops['value_type'],
2228 2228
 					'required' => $fldprops['required'],
2229 2229
 					'validation' => $fldprops['validation'],
2230
-					'value' => isset( $existing_settings[$fldname]) ? $existing_settings[$fldname] : $fldprops['default'],
2231
-					'options' => isset( $fldprops['options'] ) ? $fldprops['options'] : array(),
2232
-					'default' => isset( $existing_settings[$fldname] ) ? $existing_settings[$fldname] : $fldprops['default'],
2230
+					'value' => isset($existing_settings[$fldname]) ? $existing_settings[$fldname] : $fldprops['default'],
2231
+					'options' => isset($fldprops['options']) ? $fldprops['options'] : array(),
2232
+					'default' => isset($existing_settings[$fldname]) ? $existing_settings[$fldname] : $fldprops['default'],
2233 2233
 					'css_class' => 'no-drag',
2234 2234
 					'format' => $fldprops['format']
2235 2235
 					);
2236 2236
 			}
2237 2237
 
2238 2238
 
2239
-			$settings_template_args['template_form_fields'] = !empty($template_form_field) ? $this->_generate_admin_form_fields( $template_form_field, 'string', 'ee_mt_activate_form' ) : '';
2239
+			$settings_template_args['template_form_fields'] = ! empty($template_form_field) ? $this->_generate_admin_form_fields($template_form_field, 'string', 'ee_mt_activate_form') : '';
2240 2240
 		}
2241 2241
 
2242 2242
 		$settings_template_args['description'] = $message_type->description;
@@ -2256,13 +2256,13 @@  discard block
 block discarded – undo
2256 2256
 					)
2257 2257
 				);
2258 2258
 
2259
-		$settings_template_args['hidden_fields'] = $this->_generate_admin_form_fields( $settings_template_args['hidden_fields'], 'array' );
2260
-		$settings_template_args['show_form'] = empty( $settings_template_args['template_form_fields'] ) ? ' hidden' : '';
2259
+		$settings_template_args['hidden_fields'] = $this->_generate_admin_form_fields($settings_template_args['hidden_fields'], 'array');
2260
+		$settings_template_args['show_form'] = empty($settings_template_args['template_form_fields']) ? ' hidden' : '';
2261 2261
 
2262 2262
 
2263 2263
 
2264
-		$template = EE_MSG_TEMPLATE_PATH . 'ee_msg_mt_settings_content.template.php';
2265
-		$content = EEH_Template::display_template( $template, $settings_template_args, TRUE );
2264
+		$template = EE_MSG_TEMPLATE_PATH.'ee_msg_mt_settings_content.template.php';
2265
+		$content = EEH_Template::display_template($template, $settings_template_args, TRUE);
2266 2266
 		return $content;
2267 2267
 	}
2268 2268
 
@@ -2279,21 +2279,21 @@  discard block
 block discarded – undo
2279 2279
 		$m_boxes = $mt_boxes = array();
2280 2280
 		$m_template_args = $mt_template_args = array();
2281 2281
 
2282
-		$selected_messenger = isset( $this->_req_data['selected_messenger'] ) ? $this->_req_data['selected_messenger'] : 'email';
2282
+		$selected_messenger = isset($this->_req_data['selected_messenger']) ? $this->_req_data['selected_messenger'] : 'email';
2283 2283
 
2284
-		foreach ( $this->_m_mt_settings['messenger_tabs'] as $messenger => $tab_array ) {
2284
+		foreach ($this->_m_mt_settings['messenger_tabs'] as $messenger => $tab_array) {
2285 2285
 
2286
-			$hide_on_message = isset( $this->_active_messengers[$messenger] ) ? '' : 'hidden';
2287
-			$hide_off_message = isset( $this->_active_messengers[$messenger] ) ? 'hidden' : '';
2286
+			$hide_on_message = isset($this->_active_messengers[$messenger]) ? '' : 'hidden';
2287
+			$hide_off_message = isset($this->_active_messengers[$messenger]) ? 'hidden' : '';
2288 2288
 
2289 2289
 			//messenger meta boxes
2290 2290
 			$active = $selected_messenger == $messenger ? TRUE : FALSE;
2291
-			$active_mt_tabs = isset(  $this->_m_mt_settings['message_type_tabs'][$messenger]['active'] ) ?  $this->_m_mt_settings['message_type_tabs'][$messenger]['active'] : '';
2292
-			$m_boxes[$messenger . '_a_box'] = sprintf( __('%s Settings', 'event_espresso'), $tab_array['label'] );
2293
-			$m_template_args[$messenger . '_a_box'] = array(
2294
-					'active_message_types' => !empty( $active_mt_tabs ) ? $this->_get_mt_tabs( $active_mt_tabs ) : '',
2295
-					'inactive_message_types' => isset( $this->_m_mt_settings['message_type_tabs'][$messenger]['inactive'] ) ? $this->_get_mt_tabs( $this->_m_mt_settings['message_type_tabs'][$messenger]['inactive'] ) : '',
2296
-					'content' => $this->_get_messenger_box_content( $tab_array['obj'] ),
2291
+			$active_mt_tabs = isset($this->_m_mt_settings['message_type_tabs'][$messenger]['active']) ? $this->_m_mt_settings['message_type_tabs'][$messenger]['active'] : '';
2292
+			$m_boxes[$messenger.'_a_box'] = sprintf(__('%s Settings', 'event_espresso'), $tab_array['label']);
2293
+			$m_template_args[$messenger.'_a_box'] = array(
2294
+					'active_message_types' => ! empty($active_mt_tabs) ? $this->_get_mt_tabs($active_mt_tabs) : '',
2295
+					'inactive_message_types' => isset($this->_m_mt_settings['message_type_tabs'][$messenger]['inactive']) ? $this->_get_mt_tabs($this->_m_mt_settings['message_type_tabs'][$messenger]['inactive']) : '',
2296
+					'content' => $this->_get_messenger_box_content($tab_array['obj']),
2297 2297
 					'hidden' => $active ? '' : ' hidden',
2298 2298
 					'hide_on_message' => $hide_on_message,
2299 2299
 					'messenger' => $messenger,
@@ -2302,10 +2302,10 @@  discard block
 block discarded – undo
2302 2302
 
2303 2303
 
2304 2304
 			//message type meta boxes (which is really just the inactive container for each messenger showing inactive message types for that messenger)
2305
-			$mt_boxes[$messenger . '_i_box'] = __('Inactive Message Types', 'event_espresso');
2306
-			$mt_template_args[$messenger . '_i_box'] = array(
2307
-				'active_message_types' => !empty( $active_mt_tabs ) ? $this->_get_mt_tabs( $active_mt_tabs ) : '',
2308
-				'inactive_message_types' => isset( $this->_m_mt_settings['message_type_tabs'][$messenger]['inactive'] ) ? $this->_get_mt_tabs( $this->_m_mt_settings['message_type_tabs'][$messenger]['inactive'] ) : '',
2305
+			$mt_boxes[$messenger.'_i_box'] = __('Inactive Message Types', 'event_espresso');
2306
+			$mt_template_args[$messenger.'_i_box'] = array(
2307
+				'active_message_types' => ! empty($active_mt_tabs) ? $this->_get_mt_tabs($active_mt_tabs) : '',
2308
+				'inactive_message_types' => isset($this->_m_mt_settings['message_type_tabs'][$messenger]['inactive']) ? $this->_get_mt_tabs($this->_m_mt_settings['message_type_tabs'][$messenger]['inactive']) : '',
2309 2309
 				'hidden' => $active ? '' : ' hidden',
2310 2310
 				'hide_on_message' => $hide_on_message,
2311 2311
 				'hide_off_message' => $hide_off_message,
@@ -2315,19 +2315,19 @@  discard block
 block discarded – undo
2315 2315
 		}
2316 2316
 
2317 2317
 		//register messenger metaboxes
2318
-		$m_template_path = EE_MSG_TEMPLATE_PATH . 'ee_msg_details_messenger_mt_meta_box.template.php';
2319
-		foreach ( $m_boxes as $box => $label ) {
2320
-			$callback_args = array( 'template_path' => $m_template_path, 'template_args' => $m_template_args[$box] );
2321
-			$msgr = str_replace( '_a_box', '', $box );
2322
-			add_meta_box( 'espresso_' . $msgr . '_settings', $label, create_function('$post, $metabox', 'echo EEH_Template::display_template( $metabox["args"]["template_path"], $metabox["args"]["template_args"], TRUE );'), $this->_current_screen_id, 'normal', 'high', $callback_args );
2318
+		$m_template_path = EE_MSG_TEMPLATE_PATH.'ee_msg_details_messenger_mt_meta_box.template.php';
2319
+		foreach ($m_boxes as $box => $label) {
2320
+			$callback_args = array('template_path' => $m_template_path, 'template_args' => $m_template_args[$box]);
2321
+			$msgr = str_replace('_a_box', '', $box);
2322
+			add_meta_box('espresso_'.$msgr.'_settings', $label, create_function('$post, $metabox', 'echo EEH_Template::display_template( $metabox["args"]["template_path"], $metabox["args"]["template_args"], TRUE );'), $this->_current_screen_id, 'normal', 'high', $callback_args);
2323 2323
 		}
2324 2324
 
2325 2325
 		//register message type metaboxes
2326
-		$mt_template_path = EE_MSG_TEMPLATE_PATH . 'ee_msg_details_messenger_meta_box.template.php';
2327
-		foreach ( $mt_boxes as $box => $label ) {
2328
-			$callback_args = array( 'template_path' => $mt_template_path, 'template_args' => $mt_template_args[$box] );
2329
-			$mt = str_replace( '_i_box', '', $box );
2330
-			add_meta_box( 'espresso_' . $mt . '_inactive_mts', $label, create_function('$post, $metabox', 'echo EEH_Template::display_template( $metabox["args"]["template_path"], $metabox["args"]["template_args"], TRUE );'), $this->_current_screen_id, 'side', 'high', $callback_args );
2326
+		$mt_template_path = EE_MSG_TEMPLATE_PATH.'ee_msg_details_messenger_meta_box.template.php';
2327
+		foreach ($mt_boxes as $box => $label) {
2328
+			$callback_args = array('template_path' => $mt_template_path, 'template_args' => $mt_template_args[$box]);
2329
+			$mt = str_replace('_i_box', '', $box);
2330
+			add_meta_box('espresso_'.$mt.'_inactive_mts', $label, create_function('$post, $metabox', 'echo EEH_Template::display_template( $metabox["args"]["template_path"], $metabox["args"]["template_args"], TRUE );'), $this->_current_screen_id, 'side', 'high', $callback_args);
2331 2331
 		}
2332 2332
 
2333 2333
 	}
@@ -2338,13 +2338,13 @@  discard block
 block discarded – undo
2338 2338
 	 * @param  array $tab_array  This is an array of message type tab details used to generate the tabs
2339 2339
 	 * @return string            html formatted tabs
2340 2340
 	 */
2341
-	protected function _get_mt_tabs( $tab_array ) {
2341
+	protected function _get_mt_tabs($tab_array) {
2342 2342
 		$tab_array = (array) $tab_array;
2343
-		$template = EE_MSG_TEMPLATE_PATH . 'ee_msg_details_mt_settings_tab_item.template.php';
2343
+		$template = EE_MSG_TEMPLATE_PATH.'ee_msg_details_mt_settings_tab_item.template.php';
2344 2344
 		$tabs = '';
2345 2345
 
2346
-		foreach ( $tab_array as $tab ) {
2347
-			$tabs .=  EEH_Template::display_template( $template, $tab, TRUE );
2346
+		foreach ($tab_array as $tab) {
2347
+			$tabs .= EEH_Template::display_template($template, $tab, TRUE);
2348 2348
 		}
2349 2349
 
2350 2350
 		return $tabs;
@@ -2358,7 +2358,7 @@  discard block
 block discarded – undo
2358 2358
 	 * @param  object $messenger The messenger we're setting up content for
2359 2359
 	 * @return string            html formatted content
2360 2360
 	 */
2361
-	protected function _get_messenger_box_content( $messenger ) {
2361
+	protected function _get_messenger_box_content($messenger) {
2362 2362
 
2363 2363
 		$fields = $messenger->get_admin_settings_fields();
2364 2364
 		$settings_template_args['template_form_fields'] = '';
@@ -2367,27 +2367,27 @@  discard block
 block discarded – undo
2367 2367
 		$settings_template_args['active'] = isset($this->_active_messengers[$messenger->name]) ? TRUE : FALSE;
2368 2368
 
2369 2369
 
2370
-		if ( !empty( $fields ) ) {
2370
+		if ( ! empty($fields)) {
2371 2371
 
2372 2372
 			$existing_settings = $messenger->get_existing_admin_settings();
2373 2373
 
2374
-			foreach( $fields as $fldname => $fldprops ) {
2375
-				$field_id = $messenger->name . '-' . $fldname;
2374
+			foreach ($fields as $fldname => $fldprops) {
2375
+				$field_id = $messenger->name.'-'.$fldname;
2376 2376
 				$template_form_field[$field_id] = array(
2377
-					'name' => 'messenger_settings[' . $field_id . ']',
2377
+					'name' => 'messenger_settings['.$field_id.']',
2378 2378
 					'label' => $fldprops['label'],
2379 2379
 					'input' => $fldprops['field_type'],
2380 2380
 					'type' => $fldprops['value_type'],
2381 2381
 					'required' => $fldprops['required'],
2382 2382
 					'validation' => $fldprops['validation'],
2383
-					'value' => isset( $existing_settings[$field_id]) ? $existing_settings[$field_id] : $fldprops['default'],
2383
+					'value' => isset($existing_settings[$field_id]) ? $existing_settings[$field_id] : $fldprops['default'],
2384 2384
 					'css_class' => '',
2385 2385
 					'format' => $fldprops['format']
2386 2386
 					);
2387 2387
 			}
2388 2388
 
2389 2389
 
2390
-			$settings_template_args['template_form_fields'] = !empty($template_form_field) ? $this->_generate_admin_form_fields( $template_form_field, 'string', 'ee_m_activate_form' ) : '';
2390
+			$settings_template_args['template_form_fields'] = ! empty($template_form_field) ? $this->_generate_admin_form_fields($template_form_field, 'string', 'ee_m_activate_form') : '';
2391 2391
 		}
2392 2392
 
2393 2393
 		//we also need some hidden fields
@@ -2403,8 +2403,8 @@  discard block
 block discarded – undo
2403 2403
 			);
2404 2404
 
2405 2405
 		//make sure any active message types that are existing are included in the hidden fields
2406
-		if ( isset( $this->_m_mt_settings['message_type_tabs'][$messenger->name]['active'] ) ) {
2407
-			foreach ( $this->_m_mt_settings['message_type_tabs'][$messenger->name]['active'] as $mt => $values ) {
2406
+		if (isset($this->_m_mt_settings['message_type_tabs'][$messenger->name]['active'])) {
2407
+			foreach ($this->_m_mt_settings['message_type_tabs'][$messenger->name]['active'] as $mt => $values) {
2408 2408
 				$settings_template_args['hidden_fields']['messenger_settings[message_types]['.$mt.']'] = array(
2409 2409
 						'type' => 'hidden',
2410 2410
 						'value' => $mt
@@ -2412,25 +2412,25 @@  discard block
 block discarded – undo
2412 2412
 			}
2413 2413
 		}
2414 2414
 
2415
-		$settings_template_args['hidden_fields'] = $this->_generate_admin_form_fields( $settings_template_args['hidden_fields'], 'array' );
2415
+		$settings_template_args['hidden_fields'] = $this->_generate_admin_form_fields($settings_template_args['hidden_fields'], 'array');
2416 2416
 
2417
-		$active = isset( $this->_active_messengers[$messenger->name] ) ? TRUE : FALSE;
2417
+		$active = isset($this->_active_messengers[$messenger->name]) ? TRUE : FALSE;
2418 2418
 
2419 2419
 		$settings_template_args['messenger'] = $messenger->name;
2420 2420
 		$settings_template_args['description'] = $messenger->description;
2421 2421
 		$settings_template_args['show_hide_edit_form'] = $active ? '' : ' hidden';
2422 2422
 
2423 2423
 
2424
-		$settings_template_args['show_hide_edit_form'] = isset( $this->_active_messengers[$messenger->name] ) ? $settings_template_args['show_hide_edit_form'] : ' hidden';
2424
+		$settings_template_args['show_hide_edit_form'] = isset($this->_active_messengers[$messenger->name]) ? $settings_template_args['show_hide_edit_form'] : ' hidden';
2425 2425
 
2426
-		$settings_template_args['show_hide_edit_form'] = empty( $settings_template_args['template_form_fields'] ) ? ' hidden' : $settings_template_args['show_hide_edit_form'];
2426
+		$settings_template_args['show_hide_edit_form'] = empty($settings_template_args['template_form_fields']) ? ' hidden' : $settings_template_args['show_hide_edit_form'];
2427 2427
 
2428 2428
 
2429 2429
 		$settings_template_args['on_off_action'] = $active ? 'messenger-off' : 'messenger-on';
2430
-		$settings_template_args['nonce'] = wp_create_nonce('activate_' . $messenger->name . '_toggle_nonce');
2430
+		$settings_template_args['nonce'] = wp_create_nonce('activate_'.$messenger->name.'_toggle_nonce');
2431 2431
 		$settings_template_args['on_off_status'] = $active ? true : false;
2432
-		$template = EE_MSG_TEMPLATE_PATH . 'ee_msg_m_settings_content.template.php';
2433
-		$content = EEH_Template::display_template( $template, $settings_template_args, TRUE);
2432
+		$template = EE_MSG_TEMPLATE_PATH.'ee_msg_m_settings_content.template.php';
2433
+		$content = EEH_Template::display_template($template, $settings_template_args, TRUE);
2434 2434
 		return $content;
2435 2435
 	}
2436 2436
 
@@ -2444,39 +2444,39 @@  discard block
 block discarded – undo
2444 2444
 	public function activate_messenger_toggle() {
2445 2445
 		$success = TRUE;
2446 2446
 		//let's check that we have required data
2447
-		if ( !isset( $this->_req_data[ 'messenger' ] ) ) {
2448
-			EE_Error::add_error( __('Messenger name needed to toggle activation. None given', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
2447
+		if ( ! isset($this->_req_data['messenger'])) {
2448
+			EE_Error::add_error(__('Messenger name needed to toggle activation. None given', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
2449 2449
 			$success = FALSE;
2450 2450
 		}
2451 2451
 
2452 2452
 		//do a nonce check here since we're not arriving via a normal route
2453
-		$nonce = isset($this->_req_data[ 'activate_nonce' ]) ? sanitize_text_field( $this->_req_data[ 'activate_nonce'] ) : '';
2454
-		$nonce_ref = 'activate_' . $this->_req_data['messenger'] . '_toggle_nonce';
2453
+		$nonce = isset($this->_req_data['activate_nonce']) ? sanitize_text_field($this->_req_data['activate_nonce']) : '';
2454
+		$nonce_ref = 'activate_'.$this->_req_data['messenger'].'_toggle_nonce';
2455 2455
 
2456
-		$this->_verify_nonce( $nonce, $nonce_ref );
2456
+		$this->_verify_nonce($nonce, $nonce_ref);
2457 2457
 
2458 2458
 
2459 2459
 
2460
-		if ( !isset( $this->_req_data[ 'status' ])) {
2461
-			EE_Error::add_error( __('Messenger status needed to know whether activation or deactivation is happening. No status is given', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
2460
+		if ( ! isset($this->_req_data['status'])) {
2461
+			EE_Error::add_error(__('Messenger status needed to know whether activation or deactivation is happening. No status is given', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
2462 2462
 			$success = FALSE;
2463 2463
 		}
2464 2464
 
2465 2465
 		//do check to verify we have a valid status.
2466 2466
 		$status = $this->_req_data['status'];
2467 2467
 
2468
-		if ( $status != 'off' && $status != 'on' ) {
2469
-			EE_Error::add_error( sprintf( __('The given status (%s) is not valid. Must be "off" or "on"', 'event_espresso'), $this->_req_data['status'] ), __FILE__, __FUNCTION__, __LINE__ );
2468
+		if ($status != 'off' && $status != 'on') {
2469
+			EE_Error::add_error(sprintf(__('The given status (%s) is not valid. Must be "off" or "on"', 'event_espresso'), $this->_req_data['status']), __FILE__, __FUNCTION__, __LINE__);
2470 2470
 			$success = FALSE;
2471 2471
 		}
2472 2472
 
2473
-		if ( $success ) {
2473
+		if ($success) {
2474 2474
 			//made it here?  Stop dawdling then!!
2475
-			if ( $status == 'off' ) {
2475
+			if ($status == 'off') {
2476 2476
 				//off = deactivate.  get it?
2477
-				$success = $this->_activate_messenger( $this->_req_data['messenger'], TRUE );
2477
+				$success = $this->_activate_messenger($this->_req_data['messenger'], TRUE);
2478 2478
 			} else {
2479
-				$success = $this->_activate_messenger( $this->_req_data['messenger'] );
2479
+				$success = $this->_activate_messenger($this->_req_data['messenger']);
2480 2480
 			}
2481 2481
 		}
2482 2482
 
@@ -2502,26 +2502,26 @@  discard block
 block discarded – undo
2502 2502
 
2503 2503
 
2504 2504
 		//let's make sure we have the necessary data
2505
-		if ( !isset( $this->_req_data[ 'message_type' ] ) ) {
2506
-			EE_Error::add_error( __('Message Type name needed to toggle activation. None given', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
2505
+		if ( ! isset($this->_req_data['message_type'])) {
2506
+			EE_Error::add_error(__('Message Type name needed to toggle activation. None given', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
2507 2507
 			$success = FALSE;
2508 2508
 		}
2509 2509
 
2510 2510
 
2511 2511
 		//do a nonce check here since we're not arriving via a normal route
2512
-		$nonce = isset( $this->_req_data['mt_nonce'] ) ? sanitize_text_field( $this->_req_data['mt_nonce'] ) : '';
2513
-		$nonce_ref = $this->_req_data['message_type'] . '_nonce';
2512
+		$nonce = isset($this->_req_data['mt_nonce']) ? sanitize_text_field($this->_req_data['mt_nonce']) : '';
2513
+		$nonce_ref = $this->_req_data['message_type'].'_nonce';
2514 2514
 
2515
-		$this->_verify_nonce( $nonce, $nonce_ref );
2515
+		$this->_verify_nonce($nonce, $nonce_ref);
2516 2516
 
2517 2517
 
2518
-		if ( !isset( $this->_req_data[ 'messenger' ] ) ) {
2519
-			EE_Error::add_error( __('Messenger name needed to toggle activation. None given', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
2518
+		if ( ! isset($this->_req_data['messenger'])) {
2519
+			EE_Error::add_error(__('Messenger name needed to toggle activation. None given', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
2520 2520
 			$success = FALSE;
2521 2521
 		}
2522 2522
 
2523
-		if ( !isset( $this->_req_data[ 'status' ])) {
2524
-			EE_Error::add_error( __('Messenger status needed to know whether activation or deactivation is happening. No status is given', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
2523
+		if ( ! isset($this->_req_data['status'])) {
2524
+			EE_Error::add_error(__('Messenger status needed to know whether activation or deactivation is happening. No status is given', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
2525 2525
 			$success = FALSE;
2526 2526
 		}
2527 2527
 
@@ -2529,16 +2529,16 @@  discard block
 block discarded – undo
2529 2529
 		//do check to verify we have a valid status.
2530 2530
 		$status = $this->_req_data['status'];
2531 2531
 
2532
-		if ( $status != 'activate' && $status != 'deactivate' ) {
2533
-			EE_Error::add_error( sprintf( __('The given status (%s) is not valid. Must be "active" or "inactive"', 'event_espresso'), $this->_req_data['status'] ), __FILE__, __FUNCTION__, __LINE__ );
2532
+		if ($status != 'activate' && $status != 'deactivate') {
2533
+			EE_Error::add_error(sprintf(__('The given status (%s) is not valid. Must be "active" or "inactive"', 'event_espresso'), $this->_req_data['status']), __FILE__, __FUNCTION__, __LINE__);
2534 2534
 			$success = FALSE;
2535 2535
 		}
2536 2536
 
2537 2537
 
2538
-		if ( $success ) {
2538
+		if ($success) {
2539 2539
 			//made it here? um, what are you waiting for then?
2540 2540
 			$deactivate = $status == 'deactivate' ? TRUE : FALSE;
2541
-			$success = $this->_activate_messenger( $this->_req_data['messenger'], $deactivate, $this->_req_data['message_type'] );
2541
+			$success = $this->_activate_messenger($this->_req_data['messenger'], $deactivate, $this->_req_data['message_type']);
2542 2542
 		}
2543 2543
 
2544 2544
 		$this->_template_args['success'] = $success;
@@ -2565,28 +2565,28 @@  discard block
 block discarded – undo
2565 2565
 		$templates = TRUE;
2566 2566
 		$this->_set_m_mt_settings();
2567 2567
 
2568
-		if ( !$deactivate ) {
2568
+		if ( ! $deactivate) {
2569 2569
 
2570 2570
 
2571 2571
 			//we are activating.  we can use $this->_m_mt_settings to get all the installed messengers
2572
-			$this->_active_messengers[$messenger]['settings'] = !isset($this->_active_messengers[$messenger]['settings']) ? array() : $this->_active_messengers[$messenger]['settings'];
2572
+			$this->_active_messengers[$messenger]['settings'] = ! isset($this->_active_messengers[$messenger]['settings']) ? array() : $this->_active_messengers[$messenger]['settings'];
2573 2573
 			$this->_active_messengers[$messenger]['obj'] = $this->_m_mt_settings['messenger_tabs'][$messenger]['obj'];
2574 2574
 
2575 2575
 			//get has_active so we can sure its kept up to date.
2576
-			$has_activated = get_option( 'ee_has_activated_messages' );
2576
+			$has_activated = get_option('ee_has_activated_messages');
2577 2577
 
2578
-			if ( empty( $has_activated[$messenger] ) ) {
2578
+			if (empty($has_activated[$messenger])) {
2579 2579
 				$has_activated[$messenger] = array();
2580 2580
 			}
2581 2581
 
2582 2582
 			//k we need to get what default message types are to be associated with the messenger that's been activated.
2583 2583
 			$default_types = $message_type ? (array) $message_type : $this->_active_messengers[$messenger]['obj']->get_default_message_types();
2584 2584
 
2585
-			foreach ( $default_types as $type ) {
2585
+			foreach ($default_types as $type) {
2586 2586
 				$settings_fields = $this->_m_mt_settings['message_type_tabs'][$messenger]['inactive'][$type]['obj']->get_admin_settings_fields();
2587
-				if ( !empty( $settings_fields ) ) {
2587
+				if ( ! empty($settings_fields)) {
2588 2588
 					//we have fields for this message type so let's get the defaults for saving.
2589
-					foreach ( $settings_fields as $field => $values ) {
2589
+					foreach ($settings_fields as $field => $values) {
2590 2590
 						$settings[$field] = $values['default'];
2591 2591
 					}
2592 2592
 					//let's set the data for reloading this message type form in ajax
@@ -2594,9 +2594,9 @@  discard block
 block discarded – undo
2594 2594
 				} else {
2595 2595
 					$settings = array();
2596 2596
 				}
2597
-				$this->_active_messengers[$messenger]['settings'][$messenger . '-message_types'][$type]['settings'] =  $settings;
2597
+				$this->_active_messengers[$messenger]['settings'][$messenger.'-message_types'][$type]['settings'] = $settings;
2598 2598
 
2599
-				if ( ! in_array( $type, $has_activated[$messenger] ) ) {
2599
+				if ( ! in_array($type, $has_activated[$messenger])) {
2600 2600
 					$has_activated[$messenger][] = $type;
2601 2601
 				}
2602 2602
 			}
@@ -2604,41 +2604,41 @@  discard block
 block discarded – undo
2604 2604
 			//any default settings for the messenger?
2605 2605
 			$msgr_settings = $this->_active_messengers[$messenger]['obj']->get_admin_settings_fields();
2606 2606
 
2607
-			if ( !empty( $msgr_settings ) ) {
2608
-				foreach ( $msgr_settings as $field => $value ) {
2607
+			if ( ! empty($msgr_settings)) {
2608
+				foreach ($msgr_settings as $field => $value) {
2609 2609
 					$this->_active_messengers[$messenger]['settings'][$field] = $value;
2610 2610
 				}
2611 2611
 			}
2612 2612
 
2613 2613
 			//update settings in database
2614
-			EEH_MSG_Template::update_active_messengers_in_db( $this->_active_messengers );
2615
-			update_option( 'ee_has_activated_messages', $has_activated );
2614
+			EEH_MSG_Template::update_active_messengers_in_db($this->_active_messengers);
2615
+			update_option('ee_has_activated_messages', $has_activated);
2616 2616
 
2617 2617
 
2618 2618
 			//generate new templates (if necessary)
2619
-			$templates = $this->_generate_new_templates( $messenger, $default_types, 0, TRUE );
2619
+			$templates = $this->_generate_new_templates($messenger, $default_types, 0, TRUE);
2620 2620
 
2621 2621
 			EE_Error::overwrite_success();
2622 2622
 
2623 2623
 			//if generation failed then we need to remove the active messenger.
2624
-			if ( !$templates ) {
2624
+			if ( ! $templates) {
2625 2625
 				unset($this->_active_messengers[$messenger]);
2626
-				EEH_MSG_Template::update_active_messengers_in_db( $this->_active_messengers );
2626
+				EEH_MSG_Template::update_active_messengers_in_db($this->_active_messengers);
2627 2627
 			} else {
2628 2628
 				//all is good let's do a success message
2629
-				if ( $message_type ) {
2630
-					EE_Error::add_success( sprintf( __('%s message type has been successfully activated with the %s messenger', 'event_espresso'),ucwords($this->_m_mt_settings['message_type_tabs'][$messenger]['inactive'][$message_type]['obj']->label['singular']), ucwords( $this->_active_messengers[$messenger]['obj']->label['singular'] ) ) );
2629
+				if ($message_type) {
2630
+					EE_Error::add_success(sprintf(__('%s message type has been successfully activated with the %s messenger', 'event_espresso'), ucwords($this->_m_mt_settings['message_type_tabs'][$messenger]['inactive'][$message_type]['obj']->label['singular']), ucwords($this->_active_messengers[$messenger]['obj']->label['singular'])));
2631 2631
 
2632 2632
 					//if message type was invoice then let's make sure we activate the invoice payment method.
2633
-					if ( $message_type == 'invoice' ) {
2634
-						EE_Registry::instance()->load_lib( 'Payment_Method_Manager' );
2635
-						$pm = EE_Payment_Method_Manager::instance()->activate_a_payment_method_of_type( 'Invoice' );
2636
-						if ( $pm instanceof EE_Payment_Method ) {
2637
-							EE_Error::add_attention( __('Activating the invoice message type also automatically activates the invoice payment method.  If you do not wish the invoice payment method to be active, or to change its settings, visit the payment method admin page.', 'event_espresso' ) );
2633
+					if ($message_type == 'invoice') {
2634
+						EE_Registry::instance()->load_lib('Payment_Method_Manager');
2635
+						$pm = EE_Payment_Method_Manager::instance()->activate_a_payment_method_of_type('Invoice');
2636
+						if ($pm instanceof EE_Payment_Method) {
2637
+							EE_Error::add_attention(__('Activating the invoice message type also automatically activates the invoice payment method.  If you do not wish the invoice payment method to be active, or to change its settings, visit the payment method admin page.', 'event_espresso'));
2638 2638
 						}
2639 2639
 					}
2640 2640
 				} else {
2641
-					EE_Error::add_success( sprintf( __('%s messenger has been successfully activated', 'event_espresso'), ucwords( $this->_active_messengers[$messenger]['obj']->label['singular'] ) ) );
2641
+					EE_Error::add_success(sprintf(__('%s messenger has been successfully activated', 'event_espresso'), ucwords($this->_active_messengers[$messenger]['obj']->label['singular'])));
2642 2642
 				}
2643 2643
 			}
2644 2644
 
@@ -2654,36 +2654,36 @@  discard block
 block discarded – undo
2654 2654
 			$update_array = array(
2655 2655
 				'MTP_messenger' => $messenger);
2656 2656
 
2657
-			if ( $message_type ) {
2657
+			if ($message_type) {
2658 2658
 				$update_array['MTP_message_type'] = $message_type;
2659 2659
 			}
2660 2660
 
2661
-			$success = $MTP->update( array( 'MTP_is_active' => 0 ), array($update_array) );
2661
+			$success = $MTP->update(array('MTP_is_active' => 0), array($update_array));
2662 2662
 
2663 2663
 			$messenger_obj = $this->_active_messengers[$messenger]['obj'];
2664 2664
 
2665 2665
 			//if this is a message type deactivation then we're only unsetting the message type otherwise unset the messenger
2666
-			if ( $message_type ) {
2667
-				unset( $this->_active_messengers[$messenger]['settings'][$messenger . '-message_types'][$message_type] );
2666
+			if ($message_type) {
2667
+				unset($this->_active_messengers[$messenger]['settings'][$messenger.'-message_types'][$message_type]);
2668 2668
 			} else {
2669
-				unset( $this->_active_messengers[$messenger] );
2669
+				unset($this->_active_messengers[$messenger]);
2670 2670
 			}
2671 2671
 
2672
-			EEH_MSG_Template::update_active_messengers_in_db( $this->_active_messengers );
2672
+			EEH_MSG_Template::update_active_messengers_in_db($this->_active_messengers);
2673 2673
 			EE_Error::overwrite_success();
2674
-			if ( $message_type ) {
2675
-				EE_Error::add_success( sprintf( __('%s message type has been successfully deactivated', 'event_espresso'), ucwords($this->_m_mt_settings['message_type_tabs'][$messenger]['active'][$message_type]['obj']->label['singular']) ) );
2674
+			if ($message_type) {
2675
+				EE_Error::add_success(sprintf(__('%s message type has been successfully deactivated', 'event_espresso'), ucwords($this->_m_mt_settings['message_type_tabs'][$messenger]['active'][$message_type]['obj']->label['singular'])));
2676 2676
 			} else {
2677
-				EE_Error::add_success( sprintf( __('%s messenger has been successfully deactivated', 'event_espresso'), ucwords($messenger_obj->label['singular'] ) ) );
2677
+				EE_Error::add_success(sprintf(__('%s messenger has been successfully deactivated', 'event_espresso'), ucwords($messenger_obj->label['singular'])));
2678 2678
 			}
2679 2679
 
2680 2680
 			//if messenger was html or message type was invoice then let's make sure we deactivate invoice payment method.
2681
-			if ( $messenger == 'html'  || $message_type == 'invoice') {
2682
-				EE_Registry::instance()->load_lib( 'Payment_Method_Manager' );
2683
-				$count_updated = EE_Payment_Method_Manager::instance()->deactivate_payment_method( 'invoice' );
2684
-				if ( $count_updated > 0 ) {
2685
-					$msg = $message_type == 'invoice' ? __('Deactivating the invoice message type also automatically deactivates the invoice payment method. In order for invoices to be generated the invoice message type must be active. If you completed this action by mistake, simply reactivate the invoice message type and then vist the payment methods admin page to reactivate the invoice payment method.', 'event_espresso' ) : __('Deactivating the html messenger also automatically deactivates the invoice payment method.  In order for invoices to be generated the html messenger must be be active.  If you completed this action by mistake, simply reactivate the html messenger, then visit the payment methods admin page to reactivate the invoice payment method.', 'event_espresso' );
2686
-					EE_Error::add_attention( $msg );
2681
+			if ($messenger == 'html' || $message_type == 'invoice') {
2682
+				EE_Registry::instance()->load_lib('Payment_Method_Manager');
2683
+				$count_updated = EE_Payment_Method_Manager::instance()->deactivate_payment_method('invoice');
2684
+				if ($count_updated > 0) {
2685
+					$msg = $message_type == 'invoice' ? __('Deactivating the invoice message type also automatically deactivates the invoice payment method. In order for invoices to be generated the invoice message type must be active. If you completed this action by mistake, simply reactivate the invoice message type and then vist the payment methods admin page to reactivate the invoice payment method.', 'event_espresso') : __('Deactivating the html messenger also automatically deactivates the invoice payment method.  In order for invoices to be generated the html messenger must be be active.  If you completed this action by mistake, simply reactivate the html messenger, then visit the payment methods admin page to reactivate the invoice payment method.', 'event_espresso');
2686
+					EE_Error::add_attention($msg);
2687 2687
 				}
2688 2688
 			}
2689 2689
 
@@ -2700,8 +2700,8 @@  discard block
 block discarded – undo
2700 2700
 	 * @return string html data
2701 2701
 	 */
2702 2702
 	public function update_mt_form() {
2703
-		if ( !isset( $this->_req_data['messenger'] ) || !isset( $this->_req_data['message_type'] ) ) {
2704
-			EE_Error::add_error( __('Require message type or messenger to send an updated form'), __FILE__, __FUNCTION__, __LINE__ );
2703
+		if ( ! isset($this->_req_data['messenger']) || ! isset($this->_req_data['message_type'])) {
2704
+			EE_Error::add_error(__('Require message type or messenger to send an updated form'), __FILE__, __FUNCTION__, __LINE__);
2705 2705
 			$this->_return_json();
2706 2706
 		}
2707 2707
 
@@ -2710,7 +2710,7 @@  discard block
 block discarded – undo
2710 2710
 		$message_type = $message_types[$this->_req_data['message_type']]['obj'];
2711 2711
 		$messenger = $this->_active_messengers[$this->_req_data['messenger']]['obj'];
2712 2712
 
2713
-		$content = $this->_message_type_settings_content ( $message_type, $messenger, TRUE, TRUE );
2713
+		$content = $this->_message_type_settings_content($message_type, $messenger, TRUE, TRUE);
2714 2714
 		$this->_template_args['success'] = true;
2715 2715
 		$this->_template_args['content'] = $content;
2716 2716
 		$this->_return_json();
@@ -2724,36 +2724,36 @@  discard block
 block discarded – undo
2724 2724
 	 * @return json success or fail message
2725 2725
 	 */
2726 2726
 	public function save_settings() {
2727
-		if ( !isset( $this->_req_data['type'] ) ) {
2728
-			EE_Error::add_error(__('Cannot save settings because type is unknown (messenger settings or messsage type settings?)', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
2727
+		if ( ! isset($this->_req_data['type'])) {
2728
+			EE_Error::add_error(__('Cannot save settings because type is unknown (messenger settings or messsage type settings?)', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
2729 2729
 			$this->_template_args['error'] = TRUE;
2730 2730
 			$this->_return_json();
2731 2731
 		}
2732 2732
 
2733 2733
 
2734
-		if ( $this->_req_data['type'] == 'messenger' ) {
2734
+		if ($this->_req_data['type'] == 'messenger') {
2735 2735
 			$settings = $this->_req_data['messenger_settings']; //this should be an array.
2736 2736
 			$messenger = $settings['messenger'];
2737 2737
 			//let's setup the settings data
2738
-			foreach ( $settings as $key => $value ) {
2739
-				switch ( $key ) {
2738
+			foreach ($settings as $key => $value) {
2739
+				switch ($key) {
2740 2740
 					case 'messenger' :
2741
-						unset( $settings['messenger'] );
2741
+						unset($settings['messenger']);
2742 2742
 						break;
2743 2743
 					case 'message_types' :
2744
-						if ( isset( $this->_active_messengers[$messenger]['settings'][$messenger . '-message_types'] ) ) {
2745
-							foreach ( $this->_active_messengers[$messenger]['settings'][$messenger . '-message_types'] as $mt => $v ) {
2746
-								if ( isset( $settings['message_types'][$mt] ) )
2747
-									$settings[$messenger . '-message_types'][$mt]['settings'] = isset( $this->_active_messengers[$messenger]['settings'][$messenger . '-message_types'][$mt] ) ? $this->_active_messengers[$messenger]['settings'][$messenger . '-message_types'][$mt] : array();
2744
+						if (isset($this->_active_messengers[$messenger]['settings'][$messenger.'-message_types'])) {
2745
+							foreach ($this->_active_messengers[$messenger]['settings'][$messenger.'-message_types'] as $mt => $v) {
2746
+								if (isset($settings['message_types'][$mt]))
2747
+									$settings[$messenger.'-message_types'][$mt]['settings'] = isset($this->_active_messengers[$messenger]['settings'][$messenger.'-message_types'][$mt]) ? $this->_active_messengers[$messenger]['settings'][$messenger.'-message_types'][$mt] : array();
2748 2748
 							}
2749 2749
 						} else {
2750
-							foreach ( $value as $mt => $v ) {
2750
+							foreach ($value as $mt => $v) {
2751 2751
 								//let's see if this message type is already present and has settings.
2752
-								$settings[$messenger . '-message_types'][$mt]['settings'] = array();
2752
+								$settings[$messenger.'-message_types'][$mt]['settings'] = array();
2753 2753
 							}
2754 2754
 						}
2755 2755
 						//k settings are set let's get rid of the message types index
2756
-						unset( $settings['message_types'] );
2756
+						unset($settings['message_types']);
2757 2757
 						break;
2758 2758
 					default :
2759 2759
 						$settings[$key] = $value;
@@ -2763,36 +2763,36 @@  discard block
 block discarded – undo
2763 2763
 			$this->_active_messengers[$messenger]['settings'] = $settings;
2764 2764
 		}
2765 2765
 
2766
-		else if ( $this->_req_data['type'] == 'message_type' ) {
2766
+		else if ($this->_req_data['type'] == 'message_type') {
2767 2767
 			$settings = $this->_req_data['message_type_settings'];
2768 2768
 			$messenger = $settings['messenger'];
2769 2769
 			$message_type = $settings['message_type'];
2770 2770
 
2771
-			foreach ( $settings as $key => $value ) {
2772
-				switch ( $key ) {
2771
+			foreach ($settings as $key => $value) {
2772
+				switch ($key) {
2773 2773
 					case 'messenger' :
2774
-						unset( $settings['messenger'] );
2774
+						unset($settings['messenger']);
2775 2775
 						break;
2776 2776
 					case 'message_type' :
2777
-						unset( $settings['message_type'] );
2777
+						unset($settings['message_type']);
2778 2778
 						break;
2779 2779
 					default :
2780 2780
 						$settings['settings'][$key] = $value;
2781
-						unset( $settings[$key] );
2781
+						unset($settings[$key]);
2782 2782
 						break;
2783 2783
 				}
2784 2784
 			}
2785 2785
 
2786
-			$this->_active_messengers[$messenger]['settings'][$messenger . '-message_types'][$message_type] = $settings;
2786
+			$this->_active_messengers[$messenger]['settings'][$messenger.'-message_types'][$message_type] = $settings;
2787 2787
 		}
2788 2788
 
2789 2789
 		//okay we should have the data all setup.  Now we just update!
2790
-		$success = EEH_MSG_Template::update_active_messengers_in_db( $this->_active_messengers );
2790
+		$success = EEH_MSG_Template::update_active_messengers_in_db($this->_active_messengers);
2791 2791
 
2792
-		if ( $success ) {
2793
-			EE_Error::add_success( __('Settings updated', 'event_espresso') );
2792
+		if ($success) {
2793
+			EE_Error::add_success(__('Settings updated', 'event_espresso'));
2794 2794
 		} else {
2795
-			EE_Error::add_error( __('Settings did not get updated', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
2795
+			EE_Error::add_error(__('Settings did not get updated', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
2796 2796
 		}
2797 2797
 
2798 2798
 		$this->_template_args['success'] = $success;
Please login to merge, or discard this patch.
Braces   +54 added lines, -34 removed lines patch added patch discarded remove patch
@@ -1,5 +1,6 @@  discard block
 block discarded – undo
1
-<?php if (!defined('EVENT_ESPRESSO_VERSION') )
1
+<?php if (!defined('EVENT_ESPRESSO_VERSION') ) {
2 2
 	exit('NO direct script access allowed');
3
+}
3 4
 
4 5
 /**
5 6
  * Event Espresso
@@ -123,8 +124,9 @@  discard block
 block discarded – undo
123 124
 			$ref = str_replace( ' ', '_', $ref );
124 125
 			$classname = 'EE_' . $ref . '_messenger';
125 126
 			require_once( EE_LIBRARIES . 'messages'. DS .'messenger' . DS . $classname . '.class.php' );
126
-			if ( !class_exists($classname) )
127
-				throw new EE_Error( sprintf( __('There is no messenger for the given classname (%s)', 'event_espresso'), $classname ) );
127
+			if ( !class_exists($classname) ) {
128
+							throw new EE_Error( sprintf( __('There is no messenger for the given classname (%s)', 'event_espresso'), $classname ) );
129
+			}
128 130
 
129 131
 			$a = new ReflectionClass( $classname );
130 132
 			$this->_active_messengers[$messenger]['obj'] = $a->newInstance();
@@ -141,14 +143,17 @@  discard block
 block discarded – undo
141 143
 	 * @return void
142 144
 	 */
143 145
 	protected function _load_active_message_type_objects() {
144
-		if ( empty($this->_active_message_types) ) return;
146
+		if ( empty($this->_active_message_types) ) {
147
+			return;
148
+		}
145 149
 		foreach ( $this->_active_message_types as $message_type ) {
146 150
 			$ref = ucwords( str_replace( '_' , ' ', $message_type) );
147 151
 			$ref = str_replace( ' ', '_', $ref );
148 152
 			$classname = 'EE_' . $ref . '_message_type';
149 153
 
150
-			if ( !class_exists($classname) )
151
-				throw new EE_Error( sprintf( __('There is no message type for the given classname (%s)', 'event_espresso'), $classname ) );
154
+			if ( !class_exists($classname) ) {
155
+							throw new EE_Error( sprintf( __('There is no message type for the given classname (%s)', 'event_espresso'), $classname ) );
156
+			}
152 157
 
153 158
 			$a = new ReflectionClass( $classname );
154 159
 			$this->_active_message_types[$message_type]['obj'] = $a->newInstance();
@@ -781,12 +786,14 @@  discard block
 block discarded – undo
781 786
 		$GRP_ID = empty( $GRP_ID ) && !empty( $this->_req_data['GRP_ID'] ) ? $this->_req_data['GRP_ID'] : $GRP_ID;
782 787
 
783 788
 		//we need messenger and message type.  They should be coming from the event editor. If not here then return error
784
-		if ( empty( $message_type ) || empty( $messenger )  )
785
-			throw new EE_error(__('Sorry, but we can\'t create new templates because we\'re missing the messenger or message type', 'event_espresso'));
789
+		if ( empty( $message_type ) || empty( $messenger )  ) {
790
+					throw new EE_error(__('Sorry, but we can\'t create new templates because we\'re missing the messenger or message type', 'event_espresso'));
791
+		}
786 792
 
787 793
 		//we need the GRP_ID for the template being used as the base for the new template
788
-		if ( empty( $GRP_ID ) )
789
-			throw new EE_Error( __('In order to create a custom message template the GRP_ID of the template being used as a base is needed', 'event_espresso' ) );
794
+		if ( empty( $GRP_ID ) ) {
795
+					throw new EE_Error( __('In order to create a custom message template the GRP_ID of the template being used as a base is needed', 'event_espresso' ) );
796
+		}
790 797
 
791 798
 		//let's just make sure the template gets generated!
792 799
 
@@ -902,10 +909,13 @@  discard block
 block discarded – undo
902 909
 							$continue = FALSE;
903 910
 							if ( isset( $extra_array['shortcodes_required'] ) ) {
904 911
 								foreach ( (array) $extra_array['shortcodes_required'] as $shortcode ) {
905
-									if ( !array_key_exists( $shortcode, $this->_shortcodes ) )
906
-										$continue = TRUE;
912
+									if ( !array_key_exists( $shortcode, $this->_shortcodes ) ) {
913
+																			$continue = TRUE;
914
+									}
915
+								}
916
+								if ( $continue ) {
917
+									continue;
907 918
 								}
908
-								if ( $continue ) continue;
909 919
 							}
910 920
 
911 921
 							$field_id = $reference_field . '-' . $extra_field . '-content';
@@ -1610,7 +1620,9 @@  discard block
 block discarded – undo
1610 1620
 	protected function _set_shortcodes() {
1611 1621
 
1612 1622
 		//no need to run this if the property is already set
1613
-		if ( !empty($this->_shortcodes ) ) return;
1623
+		if ( !empty($this->_shortcodes ) ) {
1624
+			return;
1625
+		}
1614 1626
 
1615 1627
 		$this->_shortcodes = $this->_get_shortcodes();
1616 1628
 	}
@@ -1647,8 +1659,10 @@  discard block
 block discarded – undo
1647 1659
 	 */
1648 1660
 	protected function _set_message_template_group() {
1649 1661
 
1650
-		if ( !empty( $this->_message_template_group ) )
1651
-			return; //get out if this is already set.
1662
+		if ( !empty( $this->_message_template_group ) ) {
1663
+					return;
1664
+		}
1665
+		//get out if this is already set.
1652 1666
 
1653 1667
 		$GRP_ID =  ! empty( $this->_req_data['GRP_ID'] ) ? absint( $this->_req_data['GRP_ID'] ) : FALSE;
1654 1668
 		$GRP_ID = empty( $GRP_ID ) && ! empty( $this->_req_data['id'] ) ? $this->_req_data['id'] : $GRP_ID;
@@ -1656,10 +1670,11 @@  discard block
 block discarded – undo
1656 1670
 		//let's get the message templates
1657 1671
 		$MTP = EEM_Message_Template_Group::instance();
1658 1672
 
1659
-		if ( empty($GRP_ID) )
1660
-			$this->_message_template_group = $MTP->create_default_object();
1661
-		else
1662
-			$this->_message_template_group = $MTP->get_one_by_ID( $GRP_ID );
1673
+		if ( empty($GRP_ID) ) {
1674
+					$this->_message_template_group = $MTP->create_default_object();
1675
+		} else {
1676
+					$this->_message_template_group = $MTP->get_one_by_ID( $GRP_ID );
1677
+		}
1663 1678
 
1664 1679
 		$this->_template_pack = $this->_message_template_group->get_template_pack();
1665 1680
 		$this->_variation = $this->_message_template_group->get_template_pack_variation();
@@ -1686,7 +1701,9 @@  discard block
 block discarded – undo
1686 1701
 			<form method="get" action="<?php echo EE_MSG_ADMIN_URL; ?>" id="ee-msg-context-switcher-frm">
1687 1702
 				<?php
1688 1703
 					foreach ( $args as $name => $value ) {
1689
-						if ( $name == 'context' || empty($value) || $name == 'extra' ) continue;
1704
+						if ( $name == 'context' || empty($value) || $name == 'extra' ) {
1705
+							continue;
1706
+						}
1690 1707
 						?>
1691 1708
 						<input type="hidden" name="<?php echo $name; ?>" value = "<?php echo $value; ?>" />
1692 1709
 						<?php
@@ -1819,8 +1836,9 @@  discard block
 block discarded – undo
1819 1836
 
1820 1837
 					//setup notices
1821 1838
 					foreach ( $validates as $field => $error ) {
1822
-						if ( isset($error['msg'] ) )
1823
-							EE_Error::add_error( $error['msg'], __FILE__, __FUNCTION__, __LINE__ );
1839
+						if ( isset($error['msg'] ) ) {
1840
+													EE_Error::add_error( $error['msg'], __FILE__, __FUNCTION__, __LINE__ );
1841
+						}
1824 1842
 					}
1825 1843
 
1826 1844
 				} else {
@@ -1966,8 +1984,9 @@  discard block
 block discarded – undo
1966 1984
 	protected function _generate_new_templates($messenger, $message_types, $GRP_ID = 0, $global = FALSE) {
1967 1985
 
1968 1986
 		//if no $message_types are given then that's okay... this may be a messenger that just adds shortcodes, so we just don't generate any templates.
1969
-		if ( empty( $message_types ) )
1970
-			return true;
1987
+		if ( empty( $message_types ) ) {
1988
+					return true;
1989
+		}
1971 1990
 
1972 1991
 		EE_Registry::instance()->load_helper( 'MSG_Template' );
1973 1992
 
@@ -2087,8 +2106,9 @@  discard block
 block discarded – undo
2087 2106
 		//then delete permanently all the related Message Templates
2088 2107
 		$deleted = $MTG->delete_related_permanently( 'Message_Template' );
2089 2108
 
2090
-		if ( $deleted === 0 )
2091
-			$success = 0;
2109
+		if ( $deleted === 0 ) {
2110
+					$success = 0;
2111
+		}
2092 2112
 
2093 2113
 		//now delete permanently this particular group
2094 2114
 
@@ -2150,8 +2170,9 @@  discard block
 block discarded – undo
2150 2170
 	 */
2151 2171
 	protected function _set_m_mt_settings() {
2152 2172
 		//first if this is already set then lets get out no need to regenerate data.
2153
-		if ( !empty($this->_m_mt_settings) )
2154
-			return;
2173
+		if ( !empty($this->_m_mt_settings) ) {
2174
+					return;
2175
+		}
2155 2176
 
2156 2177
 		$selected_messenger = isset( $this->_req_data['selected_messenger'] ) ? $this->_req_data['selected_messenger'] : 'email';
2157 2178
 
@@ -2743,8 +2764,9 @@  discard block
 block discarded – undo
2743 2764
 					case 'message_types' :
2744 2765
 						if ( isset( $this->_active_messengers[$messenger]['settings'][$messenger . '-message_types'] ) ) {
2745 2766
 							foreach ( $this->_active_messengers[$messenger]['settings'][$messenger . '-message_types'] as $mt => $v ) {
2746
-								if ( isset( $settings['message_types'][$mt] ) )
2747
-									$settings[$messenger . '-message_types'][$mt]['settings'] = isset( $this->_active_messengers[$messenger]['settings'][$messenger . '-message_types'][$mt] ) ? $this->_active_messengers[$messenger]['settings'][$messenger . '-message_types'][$mt] : array();
2767
+								if ( isset( $settings['message_types'][$mt] ) ) {
2768
+																	$settings[$messenger . '-message_types'][$mt]['settings'] = isset( $this->_active_messengers[$messenger]['settings'][$messenger . '-message_types'][$mt] ) ? $this->_active_messengers[$messenger]['settings'][$messenger . '-message_types'][$mt] : array();
2769
+								}
2748 2770
 							}
2749 2771
 						} else {
2750 2772
 							foreach ( $value as $mt => $v ) {
@@ -2761,9 +2783,7 @@  discard block
 block discarded – undo
2761 2783
 				}
2762 2784
 			}
2763 2785
 			$this->_active_messengers[$messenger]['settings'] = $settings;
2764
-		}
2765
-
2766
-		else if ( $this->_req_data['type'] == 'message_type' ) {
2786
+		} else if ( $this->_req_data['type'] == 'message_type' ) {
2767 2787
 			$settings = $this->_req_data['message_type_settings'];
2768 2788
 			$messenger = $settings['messenger'];
2769 2789
 			$message_type = $settings['message_type'];
Please login to merge, or discard this patch.
admin_pages/payments/Payments_Admin_Page.core.php 4 patches
Doc Comments   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -421,7 +421,7 @@  discard block
 block discarded – undo
421 421
 	 *
422 422
 	 * @access protected
423 423
 	 * @param \EE_Payment_Method $payment_method
424
-	 * @return \EE_Form_Section_Proper
424
+	 * @return EE_Form_Section_HTML
425 425
 	 */
426 426
 	protected function _pci_dss_compliance( EE_Payment_Method $payment_method ) {
427 427
 		if ( $payment_method->type_obj()->requires_https() ) {
@@ -451,7 +451,7 @@  discard block
 block discarded – undo
451 451
 	 *
452 452
 	 * @access protected
453 453
 	 * @param \EE_Payment_Method $payment_method
454
-	 * @return \EE_Form_Section_Proper
454
+	 * @return EE_Form_Section_HTML
455 455
 	 */
456 456
 	protected function _currency_support( EE_Payment_Method $payment_method ) {
457 457
 		if ( ! $payment_method->usable_for_currency( EE_Config::instance()->currency->code )) {
@@ -483,7 +483,7 @@  discard block
 block discarded – undo
483 483
 	 *
484 484
 	 * @access protected
485 485
 	 * @param \EE_Payment_Method $payment_method
486
-	 * @return \EE_Form_Section_HTML
486
+	 * @return EE_Payment_Method_Form
487 487
 	 */
488 488
 	protected function _payment_method_settings( EE_Payment_Method $payment_method ) {
489 489
 		//modify the form so we only have/show fields that will be implemented for this version
@@ -551,7 +551,7 @@  discard block
 block discarded – undo
551 551
 	 *
552 552
 	 * @access protected
553 553
 	 * @param \EE_Payment_Method $payment_method
554
-	 * @return \EE_Form_Section_Proper
554
+	 * @return EE_Form_Section_HTML
555 555
 	 */
556 556
 	protected function _deactivate_payment_method_button( EE_Payment_Method $payment_method ) {
557 557
 		$link_text_and_title = sprintf( __( 'Deactivate %1$s Payments?', 'event_espresso'), $payment_method->admin_name() );
Please login to merge, or discard this patch.
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 		 *
84 84
 		 * When cap mapping is implemented, some routes will need to use the singular form of
85 85
 		 * capability method and also include the $id of the payment method for the route.
86
-		**/
86
+		 **/
87 87
 		$this->_page_routes = array(
88 88
 			'default' => array(
89 89
 				'func'=>'_payment_methods_list',
@@ -747,9 +747,9 @@  discard block
 block discarded – undo
747 747
 
748 748
 	/**
749 749
 	 * 		_update_payment_settings
750
-	*		@access protected
751
-	*		@return array
752
-	*/
750
+	 *		@access protected
751
+	 *		@return array
752
+	 */
753 753
 	protected function _update_payment_settings() {
754 754
 		EE_Registry::instance()->CFG->registration->show_pending_payment_options = isset( $this->_req_data['show_pending_payment_options'] ) ? $this->_req_data['show_pending_payment_options'] : FALSE;
755 755
 		EE_Registry::instance()->CFG = apply_filters( 'FHEE__Payments_Admin_Page___update_payment_settings__CFG', EE_Registry::instance()->CFG );
Please login to merge, or discard this patch.
Braces   +8 added lines, -7 removed lines patch added patch discarded remove patch
@@ -1,6 +1,7 @@  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 6
 /**
6 7
  * Event Espresso
@@ -655,7 +656,7 @@  discard block
 block discarded – undo
655 656
 			$payment_method = EE_Payment_Method_Manager::instance()->activate_a_payment_method_of_type( $payment_method_type );
656 657
 
657 658
 			$this->_redirect_after_action(1, 'Payment Method', 'activated', array('action' => 'default','payment_method'=>$payment_method->slug()));
658
-		}else{
659
+		} else{
659 660
 			$this->_redirect_after_action(FALSE, 'Payment Method', 'activated', array('action' => 'default'));
660 661
 		}
661 662
 	}
@@ -670,7 +671,7 @@  discard block
 block discarded – undo
670 671
 			EE_Registry::instance()->load_lib('Payment_Method_Manager');
671 672
 			$count_updated = EE_Payment_Method_Manager::instance()->deactivate_payment_method( $payment_method_slug );
672 673
 			$this->_redirect_after_action($count_updated, 'Payment Method', 'deactivated', array('action' => 'default','payment_method'=>$payment_method_slug));
673
-		}else{
674
+		} else{
674 675
 			$this->_redirect_after_action(FALSE, 'Payment Method', 'deactivated', array('action' => 'default'));
675 676
 		}
676 677
 	}
@@ -712,7 +713,7 @@  discard block
 block discarded – undo
712 713
 				$pm = $correct_pmt_form_to_use->get_model_object();
713 714
 				/** @var $pm EE_Payment_Method */
714 715
 				$this->_redirect_after_action(TRUE, 'Payment Method', 'updated', array('action' => 'default','payment_method'=>$pm->slug()));
715
-			}else{
716
+			} else{
716 717
 				EE_Error::add_error(
717 718
 					sprintf(
718 719
 						__('Payment method of type %s was not saved because there were validation errors. They have been marked in the form', 'event_espresso'),
@@ -838,7 +839,7 @@  discard block
 block discarded – undo
838 839
 		if(isset($this->_req_data['order'])){
839 840
 			$sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'DESC';
840 841
 			$query_params['order_by'] = array('LOG_time' => $sort);
841
-		}else{
842
+		} else{
842 843
 				$query_params['order_by'] = array('LOG_time' => 'DESC');
843 844
 		}
844 845
 		$offset = ($current_page-1)*$per_page;
@@ -881,7 +882,7 @@  discard block
 block discarded – undo
881 882
 		$comparison = $timeA < $timeB ? -1 : 1;
882 883
 		if(strtoupper($this->_sort_logs_again_direction) == 'DESC'){
883 884
 			return $comparison * -1;
884
-		}else{
885
+		} else{
885 886
 			return $comparison;
886 887
 		}
887 888
 	}
@@ -896,7 +897,7 @@  discard block
 block discarded – undo
896 897
 			if( $payment_log->object() instanceof EE_Payment ){
897 898
 				$payment_method = $payment_log->object()->payment_method();
898 899
 				$transaction = $payment_log->object()->transaction();
899
-			}elseif($payment_log->object() instanceof EE_Payment_Method){
900
+			} elseif($payment_log->object() instanceof EE_Payment_Method){
900 901
 				$payment_method = $payment_log->object();
901 902
 			}
902 903
 		}
Please login to merge, or discard this patch.
Spacing   +161 added lines, -161 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
 /**
@@ -44,8 +44,8 @@  discard block
 block discarded – undo
44 44
 	 * @param bool $routing indicate whether we want to just load the object and handle routing or just load the object.
45 45
 	 * @return \Payments_Admin_Page
46 46
 	 */
47
-	public function __construct( $routing = TRUE ) {
48
-		parent::__construct( $routing );
47
+	public function __construct($routing = TRUE) {
48
+		parent::__construct($routing);
49 49
 	}
50 50
 
51 51
 
@@ -130,19 +130,19 @@  discard block
 block discarded – undo
130 130
 	protected function _set_page_config() {
131 131
 		$payment_method_list_config = array(
132 132
 			'nav'           => array(
133
-				'label' => __( 'Payment Methods', 'event_espresso' ),
133
+				'label' => __('Payment Methods', 'event_espresso'),
134 134
 				'order' => 10
135 135
 			),
136 136
 			'metaboxes'     => $this->_default_espresso_metaboxes,
137 137
 			'help_tabs'     => array_merge(
138 138
 				array(
139 139
 					'payment_methods_overview_help_tab' => array(
140
-						'title'    => __( 'Payment Methods Overview', 'event_espresso' ),
140
+						'title'    => __('Payment Methods Overview', 'event_espresso'),
141 141
 						'filename' => 'payment_methods_overview'
142 142
 					)
143 143
 				),
144 144
 				$this->_add_payment_method_help_tabs() ),
145
-			'help_tour'     => array( 'Payment_Methods_Selection_Help_Tour' ),
145
+			'help_tour'     => array('Payment_Methods_Selection_Help_Tour'),
146 146
 			'require_nonce' => false
147 147
 		);
148 148
 
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
 					)
161 161
 				),
162 162
 				//'help_tour' => array( 'Payment_Methods_Settings_Help_Tour' ),
163
-				'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array( '_publish_post_box' ) ),
163
+				'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')),
164 164
 				'require_nonce' => FALSE
165 165
 			),
166 166
 			'payment_log'=>array(
@@ -179,18 +179,18 @@  discard block
 block discarded – undo
179 179
 	/**
180 180
 	 * @return array
181 181
 	 */
182
-	protected function _add_payment_method_help_tabs(){
182
+	protected function _add_payment_method_help_tabs() {
183 183
 		EE_Registry::instance()->load_lib('Payment_Method_Manager');
184 184
 		$payment_method_types = EE_Payment_Method_Manager::instance()->payment_method_types();
185 185
 		$all_pmt_help_tabs_config = array();
186
-		foreach( $payment_method_types as $payment_method_type ){
187
-			if ( ! EE_Registry::instance()->CAP->current_user_can( $payment_method_type->cap_name(), 'specific_payment_method_type_access' ) ) {
186
+		foreach ($payment_method_types as $payment_method_type) {
187
+			if ( ! EE_Registry::instance()->CAP->current_user_can($payment_method_type->cap_name(), 'specific_payment_method_type_access')) {
188 188
 				continue;
189 189
 			}
190
-			foreach( $payment_method_type->help_tabs_config() as $help_tab_name => $config ){
190
+			foreach ($payment_method_type->help_tabs_config() as $help_tab_name => $config) {
191 191
 				$all_pmt_help_tabs_config[$help_tab_name] = array(
192 192
 					'title'=>$config['title'],
193
-					'content'=>EEH_Template::display_template( $payment_method_type->file_folder().'help_tabs'.DS.$config['filename'].'.help_tab.php', array('admin_page_obj'=>$this), true)
193
+					'content'=>EEH_Template::display_template($payment_method_type->file_folder().'help_tabs'.DS.$config['filename'].'.help_tab.php', array('admin_page_obj'=>$this), true)
194 194
 				);
195 195
 			}
196 196
 		}
@@ -211,9 +211,9 @@  discard block
 block discarded – undo
211 211
 
212 212
 
213 213
 	public function load_scripts_styles() {
214
-		wp_enqueue_script( 'ee_admin_js' );
215
-		wp_enqueue_script( 'ee-text-links' );
216
-		wp_enqueue_script( 'espresso_payments', EE_PAYMENTS_ASSETS_URL . 'espresso_payments_admin.js', array( 'espresso-ui-theme', 'ee-datepicker' ), EVENT_ESPRESSO_VERSION, TRUE );
214
+		wp_enqueue_script('ee_admin_js');
215
+		wp_enqueue_script('ee-text-links');
216
+		wp_enqueue_script('espresso_payments', EE_PAYMENTS_ASSETS_URL.'espresso_payments_admin.js', array('espresso-ui-theme', 'ee-datepicker'), EVENT_ESPRESSO_VERSION, TRUE);
217 217
 	}
218 218
 
219 219
 
@@ -222,9 +222,9 @@  discard block
 block discarded – undo
222 222
 
223 223
 	public function load_scripts_styles_default() {
224 224
 		//styles
225
-		wp_register_style( 'espresso_payments', EE_PAYMENTS_ASSETS_URL . 'ee-payments.css', array(), EVENT_ESPRESSO_VERSION );
226
-		wp_enqueue_style( 'espresso_payments' );
227
-		wp_enqueue_style( 'ee-text-links' );
225
+		wp_register_style('espresso_payments', EE_PAYMENTS_ASSETS_URL.'ee-payments.css', array(), EVENT_ESPRESSO_VERSION);
226
+		wp_enqueue_style('espresso_payments');
227
+		wp_enqueue_style('ee-text-links');
228 228
 		//scripts
229 229
 	}
230 230
 
@@ -238,27 +238,27 @@  discard block
 block discarded – undo
238 238
 		 * to the loading process.  However, people MUST setup the details for the payment method so its safe to do a
239 239
 		 * recheck here.
240 240
 		 */
241
-		EE_Registry::instance()->load_lib( 'Payment_Method_Manager' );
241
+		EE_Registry::instance()->load_lib('Payment_Method_Manager');
242 242
 		EEM_Payment_Method::instance()->verify_button_urls();
243
-		EE_Registry::instance()->load_helper( 'Tabbed_Content' );
244
-		EE_Registry::instance()->load_helper( 'HTML' );
243
+		EE_Registry::instance()->load_helper('Tabbed_Content');
244
+		EE_Registry::instance()->load_helper('HTML');
245 245
 		//setup tabs, one for each payment method type
246 246
 		$tabs = array();
247
-		foreach( EE_Payment_Method_Manager::instance()->payment_method_types() as $pmt_obj ) {
247
+		foreach (EE_Payment_Method_Manager::instance()->payment_method_types() as $pmt_obj) {
248 248
 			// we don't want to show admin-only PMTs for now
249
-			if ( $pmt_obj instanceof EE_PMT_Admin_Only ) {
249
+			if ($pmt_obj instanceof EE_PMT_Admin_Only) {
250 250
 				continue;
251 251
 			}
252 252
 			//check access
253
-			if ( ! EE_Registry::instance()->CAP->current_user_can( $pmt_obj->cap_name(), 'specific_payment_method_type_access' ) ) {
253
+			if ( ! EE_Registry::instance()->CAP->current_user_can($pmt_obj->cap_name(), 'specific_payment_method_type_access')) {
254 254
 				continue;
255 255
 			}
256 256
 			//check for any active pms of that type
257
-			$payment_method = EEM_Payment_Method::instance()->get_one_of_type( $pmt_obj->system_name() );
258
-			if ( ! $payment_method instanceof EE_Payment_Method ) {
257
+			$payment_method = EEM_Payment_Method::instance()->get_one_of_type($pmt_obj->system_name());
258
+			if ( ! $payment_method instanceof EE_Payment_Method) {
259 259
 				$payment_method = EE_Payment_Method::new_instance(
260 260
 					array(
261
-						'PMD_slug'					=>sanitize_key( $pmt_obj->system_name() ),
261
+						'PMD_slug'					=>sanitize_key($pmt_obj->system_name()),
262 262
 						'PMD_type'					=>$pmt_obj->system_name(),
263 263
 						'PMD_name'				=>$pmt_obj->pretty_name(),
264 264
 						'PMD_admin_name'	=>$pmt_obj->pretty_name()
@@ -268,11 +268,11 @@  discard block
 block discarded – undo
268 268
 
269 269
 			add_meta_box(
270 270
 				//html id
271
-				'espresso_' . $payment_method->slug() . '_payment_settings',
271
+				'espresso_'.$payment_method->slug().'_payment_settings',
272 272
 				//title
273
-				sprintf( __('%s Settings', 'event_espresso'), $payment_method->admin_name() ),
273
+				sprintf(__('%s Settings', 'event_espresso'), $payment_method->admin_name()),
274 274
 				//callback
275
-				array( $this, 'payment_method_settings_meta_box' ),
275
+				array($this, 'payment_method_settings_meta_box'),
276 276
 				//post type
277 277
 				NULL,
278 278
 				//context
@@ -280,20 +280,20 @@  discard block
 block discarded – undo
280 280
 				//priority
281 281
 				'default',
282 282
 				//callback args
283
-				array( 'payment_method' => $payment_method )
283
+				array('payment_method' => $payment_method)
284 284
 			);
285 285
 
286 286
 			//setup for tabbed content
287 287
 			$tabs[$payment_method->slug()] = array(
288 288
 				'label' => $payment_method->admin_name(),
289 289
 				'class' =>  $payment_method->active() ? 'gateway-active' : '',
290
-				'href' => 'espresso_' . $payment_method->slug() . '_payment_settings',
290
+				'href' => 'espresso_'.$payment_method->slug().'_payment_settings',
291 291
 				'title' => __('Modify this Payment Method', 'event_espresso'),
292 292
 				'slug' => $payment_method->slug()
293 293
 			);
294 294
 		}
295 295
 
296
-		$this->_template_args['admin_page_header'] = EEH_Tabbed_Content::tab_text_links( $tabs, 'payment_method_links', '|', $this->_get_active_payment_method_slug() );
296
+		$this->_template_args['admin_page_header'] = EEH_Tabbed_Content::tab_text_links($tabs, 'payment_method_links', '|', $this->_get_active_payment_method_slug());
297 297
 		$this->display_admin_page_with_sidebar();
298 298
 
299 299
 	}
@@ -304,20 +304,20 @@  discard block
 block discarded – undo
304 304
 	 *   _get_active_payment_method_slug
305 305
 	 * 	@return string
306 306
 	 */
307
-	protected function _get_active_payment_method_slug(){
307
+	protected function _get_active_payment_method_slug() {
308 308
 		$payment_method_slug = FALSE;
309 309
 		//decide which payment method tab to open first, as dictated by the request's 'payment_method'
310
-		if ( isset( $this->_req_data['payment_method'] )) {
310
+		if (isset($this->_req_data['payment_method'])) {
311 311
 			// if they provided the current payment method, use it
312
-			$payment_method_slug = sanitize_key( $this->_req_data['payment_method'] );
312
+			$payment_method_slug = sanitize_key($this->_req_data['payment_method']);
313 313
 		}
314
-		$payment_method = EEM_Payment_Method::instance()->get_one( array( array( 'PMD_slug' => $payment_method_slug )));
314
+		$payment_method = EEM_Payment_Method::instance()->get_one(array(array('PMD_slug' => $payment_method_slug)));
315 315
 		// if that didn't work or wasn't provided, find another way to select the current pm
316
-		if ( ! $this->_verify_payment_method( $payment_method )) {
316
+		if ( ! $this->_verify_payment_method($payment_method)) {
317 317
 			// like, looking for an active one
318
-			$payment_method = EEM_Payment_Method::instance()->get_one_active( 'CART' );
318
+			$payment_method = EEM_Payment_Method::instance()->get_one_active('CART');
319 319
 			// test that one as well
320
-			if ( $this->_verify_payment_method( $payment_method )) {
320
+			if ($this->_verify_payment_method($payment_method)) {
321 321
 				$payment_method_slug = $payment_method->slug();
322 322
 			} else {
323 323
 				$payment_method_slug = 'paypal_standard';
@@ -335,11 +335,11 @@  discard block
 block discarded – undo
335 335
 	 * @param \EE_Payment_Method $payment_method
336 336
 	 * @return boolean
337 337
 	 */
338
-	protected function _verify_payment_method( $payment_method ){
338
+	protected function _verify_payment_method($payment_method) {
339 339
 		if (
340 340
 			$payment_method instanceof EE_Payment_Method &&
341 341
 			$payment_method->type_obj() instanceof EE_PMT_Base &&
342
-			EE_Registry::instance()->CAP->current_user_can( $payment_method->type_obj()->cap_name(), 'specific_payment_method_type_access' )
342
+			EE_Registry::instance()->CAP->current_user_can($payment_method->type_obj()->cap_name(), 'specific_payment_method_type_access')
343 343
 		) {
344 344
 			return TRUE;
345 345
 		}
@@ -356,21 +356,21 @@  discard block
 block discarded – undo
356 356
 	 * @return string
357 357
 	 * @throws EE_Error
358 358
 	 */
359
-	public function payment_method_settings_meta_box( $post_obj_which_is_null, $metabox ){
360
-		$payment_method = isset( $metabox['args'], $metabox['args']['payment_method'] ) ? $metabox['args']['payment_method'] : NULL;
361
-		if ( ! $payment_method instanceof EE_Payment_Method ){
362
-			throw new EE_Error( sprintf( __( 'Payment method metabox setup incorrectly. No Payment method object was supplied', 'event_espresso' )));
359
+	public function payment_method_settings_meta_box($post_obj_which_is_null, $metabox) {
360
+		$payment_method = isset($metabox['args'], $metabox['args']['payment_method']) ? $metabox['args']['payment_method'] : NULL;
361
+		if ( ! $payment_method instanceof EE_Payment_Method) {
362
+			throw new EE_Error(sprintf(__('Payment method metabox setup incorrectly. No Payment method object was supplied', 'event_espresso')));
363 363
 		}
364 364
 		$payment_method_scopes = $payment_method->active();
365 365
 		// if the payment method really exists show its form, otherwise the activation template
366
-		if ( $payment_method->ID() && ! empty( $payment_method_scopes )) {
367
-				$form = $this->_generate_payment_method_settings_form( $payment_method );
368
-				if ( $form->form_data_present_in( $this->_req_data )) {
369
-					$form->receive_form_submission( $this->_req_data );
366
+		if ($payment_method->ID() && ! empty($payment_method_scopes)) {
367
+				$form = $this->_generate_payment_method_settings_form($payment_method);
368
+				if ($form->form_data_present_in($this->_req_data)) {
369
+					$form->receive_form_submission($this->_req_data);
370 370
 				}
371
-				echo $form->form_open() . $form->get_html_and_js() . $form->form_close();
371
+				echo $form->form_open().$form->get_html_and_js().$form->form_close();
372 372
 		} else {
373
-			echo $this->_activate_payment_method_button( $payment_method )->get_html_and_js();
373
+			echo $this->_activate_payment_method_button($payment_method)->get_html_and_js();
374 374
 		}
375 375
 	}
376 376
 
@@ -383,14 +383,14 @@  discard block
 block discarded – undo
383 383
 	 * @param \EE_Payment_Method $payment_method
384 384
 	 * @return \EE_Form_Section_Proper
385 385
 	 */
386
-	protected function _generate_payment_method_settings_form( EE_Payment_Method $payment_method ) {
387
-		if ( ! $payment_method instanceof EE_Payment_Method ){
386
+	protected function _generate_payment_method_settings_form(EE_Payment_Method $payment_method) {
387
+		if ( ! $payment_method instanceof EE_Payment_Method) {
388 388
 			return new EE_Form_Section_Proper();
389 389
 		}
390 390
 		return new EE_Form_Section_Proper(
391 391
 			array(
392
-				'name' 	=> $payment_method->slug() . '_settings_form',
393
-				'html_id' 	=> $payment_method->slug() . '_settings_form',
392
+				'name' 	=> $payment_method->slug().'_settings_form',
393
+				'html_id' 	=> $payment_method->slug().'_settings_form',
394 394
 				'action' 	=> EE_Admin_Page::add_query_args_and_nonce(
395 395
 					array(
396 396
 						'action' 						=> 'update_payment_method',
@@ -402,12 +402,12 @@  discard block
 block discarded – undo
402 402
 				'subsections' 			=> apply_filters(
403 403
 					'FHEE__Payments_Admin_Page___generate_payment_method_settings_form__form_subsections',
404 404
 					array(
405
-						'pci_dss_compliance_' . $payment_method->slug() 				=> $this->_pci_dss_compliance( $payment_method ),
406
-						'currency_support_' . $payment_method->slug()					=> $this->_currency_support( $payment_method ),
407
-						'payment_method_settings_' . $payment_method->slug() 	=> $this->_payment_method_settings( $payment_method ),
408
-						'update_' . $payment_method->slug()										=> $this->_update_payment_method_button( $payment_method ),
409
-						'deactivate_' . $payment_method->slug()								=> $this->_deactivate_payment_method_button( $payment_method ),
410
-						'fine_print_' . $payment_method->slug()									=> $this->_fine_print()
405
+						'pci_dss_compliance_'.$payment_method->slug() 				=> $this->_pci_dss_compliance($payment_method),
406
+						'currency_support_'.$payment_method->slug()					=> $this->_currency_support($payment_method),
407
+						'payment_method_settings_'.$payment_method->slug() 	=> $this->_payment_method_settings($payment_method),
408
+						'update_'.$payment_method->slug()										=> $this->_update_payment_method_button($payment_method),
409
+						'deactivate_'.$payment_method->slug()								=> $this->_deactivate_payment_method_button($payment_method),
410
+						'fine_print_'.$payment_method->slug()									=> $this->_fine_print()
411 411
 					)
412 412
 				)
413 413
 			)
@@ -423,19 +423,19 @@  discard block
 block discarded – undo
423 423
 	 * @param \EE_Payment_Method $payment_method
424 424
 	 * @return \EE_Form_Section_Proper
425 425
 	 */
426
-	protected function _pci_dss_compliance( EE_Payment_Method $payment_method ) {
427
-		if ( $payment_method->type_obj()->requires_https() ) {
426
+	protected function _pci_dss_compliance(EE_Payment_Method $payment_method) {
427
+		if ($payment_method->type_obj()->requires_https()) {
428 428
 			return new EE_Form_Section_HTML(
429 429
 				EEH_HTML::tr(
430 430
 					EEH_HTML::th(
431 431
 						EEH_HTML::label(
432
-							EEH_HTML::strong( __( 'IMPORTANT', 'event_espresso' ), '', 'important-notice' )
432
+							EEH_HTML::strong(__('IMPORTANT', 'event_espresso'), '', 'important-notice')
433 433
 						)
434
-					) .
434
+					).
435 435
 					EEH_HTML::td(
436
-						EEH_HTML::strong( __( 'You are responsible for your own website security and Payment Card Industry Data Security Standards (PCI DSS) compliance.', 'event_espresso' )) .
437
-						EEH_HTML::br() .
438
-						__( 'Learn more about ', 'event_espresso' ) . EEH_HTML::link( 'https://www.pcisecuritystandards.org/merchants/index.php', __( 'PCI DSS compliance', 'event_espresso' ))
436
+						EEH_HTML::strong(__('You are responsible for your own website security and Payment Card Industry Data Security Standards (PCI DSS) compliance.', 'event_espresso')).
437
+						EEH_HTML::br().
438
+						__('Learn more about ', 'event_espresso').EEH_HTML::link('https://www.pcisecuritystandards.org/merchants/index.php', __('PCI DSS compliance', 'event_espresso'))
439 439
 					)
440 440
 				)
441 441
 			);
@@ -453,19 +453,19 @@  discard block
 block discarded – undo
453 453
 	 * @param \EE_Payment_Method $payment_method
454 454
 	 * @return \EE_Form_Section_Proper
455 455
 	 */
456
-	protected function _currency_support( EE_Payment_Method $payment_method ) {
457
-		if ( ! $payment_method->usable_for_currency( EE_Config::instance()->currency->code )) {
456
+	protected function _currency_support(EE_Payment_Method $payment_method) {
457
+		if ( ! $payment_method->usable_for_currency(EE_Config::instance()->currency->code)) {
458 458
 			return new EE_Form_Section_HTML(
459 459
 				EEH_HTML::tr(
460 460
 					EEH_HTML::th(
461 461
 						EEH_HTML::label(
462
-							EEH_HTML::strong( __( 'IMPORTANT', 'event_espresso' ), '', 'important-notice' )
462
+							EEH_HTML::strong(__('IMPORTANT', 'event_espresso'), '', 'important-notice')
463 463
 						)
464
-					) .
464
+					).
465 465
 					EEH_HTML::td(
466 466
 						EEH_HTML::strong(
467 467
 							sprintf(
468
-								__( 'This payment method does not support the currency set on your site (%1$s) and so will not appear as a payment option to registrants. Please activate a different payment method or change your site\'s country and associated currency.', 'event_espresso'),
468
+								__('This payment method does not support the currency set on your site (%1$s) and so will not appear as a payment option to registrants. Please activate a different payment method or change your site\'s country and associated currency.', 'event_espresso'),
469 469
 								EE_Config::instance()->currency->code
470 470
 							)
471 471
 						)
@@ -485,9 +485,9 @@  discard block
 block discarded – undo
485 485
 	 * @param \EE_Payment_Method $payment_method
486 486
 	 * @return \EE_Form_Section_HTML
487 487
 	 */
488
-	protected function _payment_method_settings( EE_Payment_Method $payment_method ) {
488
+	protected function _payment_method_settings(EE_Payment_Method $payment_method) {
489 489
 		//modify the form so we only have/show fields that will be implemented for this version
490
-		return $this->_simplify_form( $payment_method->type_obj()->settings_form(), $payment_method->name() );
490
+		return $this->_simplify_form($payment_method->type_obj()->settings_form(), $payment_method->name());
491 491
 	}
492 492
 
493 493
 
@@ -500,8 +500,8 @@  discard block
 block discarded – undo
500 500
 	 * @return \EE_Payment_Method_Form
501 501
 	 * @throws \EE_Error
502 502
 	 */
503
-	protected function _simplify_form( $form_section, $payment_method_name = '' ){
504
-		if ( $form_section instanceof EE_Payment_Method_Form ) {
503
+	protected function _simplify_form($form_section, $payment_method_name = '') {
504
+		if ($form_section instanceof EE_Payment_Method_Form) {
505 505
 			$form_section->exclude(
506 506
 				array(
507 507
 					'PMD_type', //dont want them changing the type
@@ -512,7 +512,7 @@  discard block
 block discarded – undo
512 512
 			);
513 513
 			return $form_section;
514 514
 		} else {
515
-			throw new EE_Error( sprintf( __( 'The EE_Payment_Method_Form for the "%1$s" payment method is missing or invalid.', 'event_espresso' ), $payment_method_name ));
515
+			throw new EE_Error(sprintf(__('The EE_Payment_Method_Form for the "%1$s" payment method is missing or invalid.', 'event_espresso'), $payment_method_name));
516 516
 		}
517 517
 	}
518 518
 
@@ -525,18 +525,18 @@  discard block
 block discarded – undo
525 525
 	 * @param \EE_Payment_Method $payment_method
526 526
 	 * @return \EE_Form_Section_HTML
527 527
 	 */
528
-	protected function _update_payment_method_button( EE_Payment_Method $payment_method ) {
528
+	protected function _update_payment_method_button(EE_Payment_Method $payment_method) {
529 529
 		$update_button = new EE_Submit_Input(
530 530
 			array(
531
-				'html_id' 		=> 'save_' . $payment_method->slug() . '_settings',
532
-				'default' 		=> sprintf( __( 'Update %s Payment Settings', 'event_espresso' ), $payment_method->admin_name() ),
531
+				'html_id' 		=> 'save_'.$payment_method->slug().'_settings',
532
+				'default' 		=> sprintf(__('Update %s Payment Settings', 'event_espresso'), $payment_method->admin_name()),
533 533
 				'html_label' => EEH_HTML::nbsp()
534 534
 			)
535 535
 		);
536 536
 		return new EE_Form_Section_HTML(
537
-			EEH_HTML::no_row( EEH_HTML::br(2) ) .
537
+			EEH_HTML::no_row(EEH_HTML::br(2)).
538 538
 			EEH_HTML::tr(
539
-				EEH_HTML::th( __( 'Update Settings', 'event_espresso') ) .
539
+				EEH_HTML::th(__('Update Settings', 'event_espresso')).
540 540
 				EEH_HTML::td(
541 541
 					$update_button->get_html_for_input()
542 542
 				)
@@ -553,11 +553,11 @@  discard block
 block discarded – undo
553 553
 	 * @param \EE_Payment_Method $payment_method
554 554
 	 * @return \EE_Form_Section_Proper
555 555
 	 */
556
-	protected function _deactivate_payment_method_button( EE_Payment_Method $payment_method ) {
557
-		$link_text_and_title = sprintf( __( 'Deactivate %1$s Payments?', 'event_espresso'), $payment_method->admin_name() );
556
+	protected function _deactivate_payment_method_button(EE_Payment_Method $payment_method) {
557
+		$link_text_and_title = sprintf(__('Deactivate %1$s Payments?', 'event_espresso'), $payment_method->admin_name());
558 558
 		return new EE_Form_Section_HTML(
559 559
 			EEH_HTML::tr(
560
-				EEH_HTML::th( __( 'Deactivate Payment Method', 'event_espresso') ) .
560
+				EEH_HTML::th(__('Deactivate Payment Method', 'event_espresso')).
561 561
 				EEH_HTML::td(
562 562
 					EEH_HTML::link(
563 563
 						EE_Admin_Page::add_query_args_and_nonce(
@@ -569,7 +569,7 @@  discard block
 block discarded – undo
569 569
 						),
570 570
 						$link_text_and_title,
571 571
 						$link_text_and_title,
572
-						'deactivate_' . $payment_method->slug(),
572
+						'deactivate_'.$payment_method->slug(),
573 573
 						'espresso-button button-secondary'
574 574
 					)
575 575
 				)
@@ -585,12 +585,12 @@  discard block
 block discarded – undo
585 585
 	 * @param \EE_Payment_Method $payment_method
586 586
 	 * @return \EE_Form_Section_Proper
587 587
 	 */
588
-	protected function _activate_payment_method_button( EE_Payment_Method $payment_method ) {
589
-		$link_text_and_title = sprintf( __( 'Activate %1$s Payment Method?', 'event_espresso'), $payment_method->admin_name() );
588
+	protected function _activate_payment_method_button(EE_Payment_Method $payment_method) {
589
+		$link_text_and_title = sprintf(__('Activate %1$s Payment Method?', 'event_espresso'), $payment_method->admin_name());
590 590
 		return new EE_Form_Section_Proper(
591 591
 			array(
592
-				'name' 	=> 'activate_' . $payment_method->slug() . '_settings_form',
593
-				'html_id' 	=> 'activate_' . $payment_method->slug() . '_settings_form',
592
+				'name' 	=> 'activate_'.$payment_method->slug().'_settings_form',
593
+				'html_id' 	=> 'activate_'.$payment_method->slug().'_settings_form',
594 594
 				'action' 	=> '#',
595 595
 				'layout_strategy'		=> new EE_Admin_Two_Column_Layout(),
596 596
 				'subsections' 			=> apply_filters(
@@ -599,8 +599,8 @@  discard block
 block discarded – undo
599 599
 						new EE_Form_Section_HTML(
600 600
 							EEH_HTML::tr(
601 601
 								EEH_HTML::th(
602
-									EEH_HTML::label( __( 'Click to Activate ', 'event_espresso' ))
603
-								) .
602
+									EEH_HTML::label(__('Click to Activate ', 'event_espresso'))
603
+								).
604 604
 								EEH_HTML::td(
605 605
 									EEH_HTML::link(
606 606
 										EE_Admin_Page::add_query_args_and_nonce(
@@ -612,7 +612,7 @@  discard block
 block discarded – undo
612 612
 										),
613 613
 										$link_text_and_title,
614 614
 										$link_text_and_title,
615
-										'activate_' . $payment_method->slug(),
615
+										'activate_'.$payment_method->slug(),
616 616
 										'espresso-button-green button-primary'
617 617
 									)
618 618
 								)
@@ -633,9 +633,9 @@  discard block
 block discarded – undo
633 633
 	protected function _fine_print() {
634 634
 		return new EE_Form_Section_HTML(
635 635
 			EEH_HTML::tr(
636
-				EEH_HTML::th() .
636
+				EEH_HTML::th().
637 637
 				EEH_HTML::td(
638
-					EEH_HTML::p( __( 'All fields marked with a * are required fields', 'event_espresso' ), '', 'grey-text' )
638
+					EEH_HTML::p(__('All fields marked with a * are required fields', 'event_espresso'), '', 'grey-text')
639 639
 				)
640 640
 			)
641 641
 		);
@@ -647,15 +647,15 @@  discard block
 block discarded – undo
647 647
 	 * Activates a payment method of that type. Mostly assuming there is only 1 of that type (or none so far)
648 648
 	 * @global WP_User $current_user
649 649
 	 */
650
-	protected function _activate_payment_method(){
651
-		if(isset($this->_req_data['payment_method_type'])){
650
+	protected function _activate_payment_method() {
651
+		if (isset($this->_req_data['payment_method_type'])) {
652 652
 			$payment_method_type = sanitize_text_field($this->_req_data['payment_method_type']);
653 653
 			//see if one exists
654
-			EE_Registry::instance()->load_lib( 'Payment_Method_Manager' );
655
-			$payment_method = EE_Payment_Method_Manager::instance()->activate_a_payment_method_of_type( $payment_method_type );
654
+			EE_Registry::instance()->load_lib('Payment_Method_Manager');
655
+			$payment_method = EE_Payment_Method_Manager::instance()->activate_a_payment_method_of_type($payment_method_type);
656 656
 
657
-			$this->_redirect_after_action(1, 'Payment Method', 'activated', array('action' => 'default','payment_method'=>$payment_method->slug()));
658
-		}else{
657
+			$this->_redirect_after_action(1, 'Payment Method', 'activated', array('action' => 'default', 'payment_method'=>$payment_method->slug()));
658
+		} else {
659 659
 			$this->_redirect_after_action(FALSE, 'Payment Method', 'activated', array('action' => 'default'));
660 660
 		}
661 661
 	}
@@ -663,14 +663,14 @@  discard block
 block discarded – undo
663 663
 	/**
664 664
 	 * Deactivates the payment method with the specified slug, and redirects.
665 665
 	 */
666
-	protected function _deactivate_payment_method(){
667
-		if(isset($this->_req_data['payment_method'])){
666
+	protected function _deactivate_payment_method() {
667
+		if (isset($this->_req_data['payment_method'])) {
668 668
 			$payment_method_slug = sanitize_key($this->_req_data['payment_method']);
669 669
 			//deactivate it
670 670
 			EE_Registry::instance()->load_lib('Payment_Method_Manager');
671
-			$count_updated = EE_Payment_Method_Manager::instance()->deactivate_payment_method( $payment_method_slug );
672
-			$this->_redirect_after_action($count_updated, 'Payment Method', 'deactivated', array('action' => 'default','payment_method'=>$payment_method_slug));
673
-		}else{
671
+			$count_updated = EE_Payment_Method_Manager::instance()->deactivate_payment_method($payment_method_slug);
672
+			$this->_redirect_after_action($count_updated, 'Payment Method', 'deactivated', array('action' => 'default', 'payment_method'=>$payment_method_slug));
673
+		} else {
674 674
 			$this->_redirect_after_action(FALSE, 'Payment Method', 'deactivated', array('action' => 'default'));
675 675
 		}
676 676
 	}
@@ -684,39 +684,39 @@  discard block
 block discarded – undo
684 684
 	 * subsequently called 'headers_sent_func' which is _payment_methods_list)
685 685
 	 * @return void
686 686
 	 */
687
-	protected function _update_payment_method(){
688
-		if( $_SERVER['REQUEST_METHOD'] == 'POST'){
687
+	protected function _update_payment_method() {
688
+		if ($_SERVER['REQUEST_METHOD'] == 'POST') {
689 689
 			//ok let's find which gateway form to use based on the form input
690 690
 			EE_Registry::instance()->load_lib('Payment_Method_Manager');
691 691
 			/** @var $correct_pmt_form_to_use EE_Payment_Method_Form */
692 692
 			$correct_pmt_form_to_use = NULL;
693 693
 			$pmt_obj = NULL;
694
-			foreach(EE_Payment_Method_Manager::instance()->payment_method_types() as $pmt_obj){
694
+			foreach (EE_Payment_Method_Manager::instance()->payment_method_types() as $pmt_obj) {
695 695
 				/** @var $pmt_obj EE_PMT_Base */
696 696
 				//get the form and simplify it, like what we do when we display it
697 697
 				$pmt_form = $pmt_obj->settings_form();
698 698
 				$this->_simplify_form($pmt_form);
699
-				if($pmt_form->form_data_present_in($this->_req_data)){
699
+				if ($pmt_form->form_data_present_in($this->_req_data)) {
700 700
 					$correct_pmt_form_to_use = $pmt_form;
701 701
 					break;
702 702
 				}
703 703
 			}
704 704
 			//if we couldn't find the correct payment method type...
705
-			if( ! $correct_pmt_form_to_use ){
705
+			if ( ! $correct_pmt_form_to_use) {
706 706
 				EE_Error::add_error(__("We could not find which payment method type your form submission related to. Please contact support", 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
707 707
 				$this->_redirect_after_action(FALSE, 'Payment Method', 'activated', array('action' => 'default'));
708 708
 			}
709 709
 			$correct_pmt_form_to_use->receive_form_submission($this->_req_data);
710
-			if($correct_pmt_form_to_use->is_valid()){
710
+			if ($correct_pmt_form_to_use->is_valid()) {
711 711
 				$correct_pmt_form_to_use->save();
712 712
 				$pm = $correct_pmt_form_to_use->get_model_object();
713 713
 				/** @var $pm EE_Payment_Method */
714
-				$this->_redirect_after_action(TRUE, 'Payment Method', 'updated', array('action' => 'default','payment_method'=>$pm->slug()));
715
-			}else{
714
+				$this->_redirect_after_action(TRUE, 'Payment Method', 'updated', array('action' => 'default', 'payment_method'=>$pm->slug()));
715
+			} else {
716 716
 				EE_Error::add_error(
717 717
 					sprintf(
718 718
 						__('Payment method of type %s was not saved because there were validation errors. They have been marked in the form', 'event_espresso'),
719
-						$pmt_obj instanceof EE_PMT_Base ? $pmt_obj->pretty_name() : __( '"(unknown)"', 'event_espresso' )
719
+						$pmt_obj instanceof EE_PMT_Base ? $pmt_obj->pretty_name() : __('"(unknown)"', 'event_espresso')
720 720
 					),
721 721
 					__FILE__,
722 722
 					__FUNCTION__,
@@ -733,11 +733,11 @@  discard block
 block discarded – undo
733 733
 	protected function _payment_settings() {
734 734
 
735 735
 		$this->_template_args['values'] = $this->_yes_no_values;
736
-		$this->_template_args['show_pending_payment_options'] = isset( EE_Registry::instance()->CFG->registration->show_pending_payment_options ) ? absint( EE_Registry::instance()->CFG->registration->show_pending_payment_options ) : FALSE;
736
+		$this->_template_args['show_pending_payment_options'] = isset(EE_Registry::instance()->CFG->registration->show_pending_payment_options) ? absint(EE_Registry::instance()->CFG->registration->show_pending_payment_options) : FALSE;
737 737
 
738
-		$this->_set_add_edit_form_tags( 'update_payment_settings' );
739
-		$this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE );
740
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( EE_PAYMENTS_TEMPLATE_PATH . 'payment_settings.template.php', $this->_template_args, TRUE );
738
+		$this->_set_add_edit_form_tags('update_payment_settings');
739
+		$this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE);
740
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template(EE_PAYMENTS_TEMPLATE_PATH.'payment_settings.template.php', $this->_template_args, TRUE);
741 741
 		$this->display_admin_page_with_sidebar();
742 742
 
743 743
 	}
@@ -751,13 +751,13 @@  discard block
 block discarded – undo
751 751
 	*		@return array
752 752
 	*/
753 753
 	protected function _update_payment_settings() {
754
-		EE_Registry::instance()->CFG->registration->show_pending_payment_options = isset( $this->_req_data['show_pending_payment_options'] ) ? $this->_req_data['show_pending_payment_options'] : FALSE;
755
-		EE_Registry::instance()->CFG = apply_filters( 'FHEE__Payments_Admin_Page___update_payment_settings__CFG', EE_Registry::instance()->CFG );
754
+		EE_Registry::instance()->CFG->registration->show_pending_payment_options = isset($this->_req_data['show_pending_payment_options']) ? $this->_req_data['show_pending_payment_options'] : FALSE;
755
+		EE_Registry::instance()->CFG = apply_filters('FHEE__Payments_Admin_Page___update_payment_settings__CFG', EE_Registry::instance()->CFG);
756 756
 
757 757
 
758
-		$what = __('Payment Settings','event_espresso');
759
-		$success = $this->_update_espresso_configuration( $what, EE_Registry::instance()->CFG, __FILE__, __FUNCTION__, __LINE__ );
760
-		$this->_redirect_after_action( $success, $what, __('updated','event_espresso'), array( 'action' => 'payment_settings' ) );
758
+		$what = __('Payment Settings', 'event_espresso');
759
+		$success = $this->_update_espresso_configuration($what, EE_Registry::instance()->CFG, __FILE__, __FUNCTION__, __LINE__);
760
+		$this->_redirect_after_action($success, $what, __('updated', 'event_espresso'), array('action' => 'payment_settings'));
761 761
 
762 762
 	}
763 763
 	protected function _payment_log_overview_list_table() {
@@ -783,18 +783,18 @@  discard block
 block discarded – undo
783 783
 	 * @param bool $count
784 784
 	 * @return array
785 785
 	 */
786
-	public function get_payment_logs($per_page = 50, $current_page = 0, $count = false){
787
-		EE_Registry::instance()->load_model( 'Change_Log' );
786
+	public function get_payment_logs($per_page = 50, $current_page = 0, $count = false) {
787
+		EE_Registry::instance()->load_model('Change_Log');
788 788
 		//we may need to do multiple queries (joining differently), so we actually wan tan array of query params
789
-		$query_params =  array(array('LOG_type'=>  EEM_Change_Log::type_gateway));
789
+		$query_params = array(array('LOG_type'=>  EEM_Change_Log::type_gateway));
790 790
 		//check if they've selected a specific payment method
791
-		if( isset($this->_req_data['_payment_method']) && $this->_req_data['_payment_method'] !== 'all'){
791
+		if (isset($this->_req_data['_payment_method']) && $this->_req_data['_payment_method'] !== 'all') {
792 792
 			$query_params[0]['OR*pm_or_pay_pm'] = array('Payment.Payment_Method.PMD_ID'=>$this->_req_data['_payment_method'],
793 793
 				'Payment_Method.PMD_ID'=>$this->_req_data['_payment_method']);
794 794
 		}
795 795
 		//take into account search
796
-		if(isset($this->_req_data['s']) && $this->_req_data['s']){
797
-			$similarity_string = array('LIKE','%'.str_replace("","%",$this->_req_data['s']) .'%');
796
+		if (isset($this->_req_data['s']) && $this->_req_data['s']) {
797
+			$similarity_string = array('LIKE', '%'.str_replace("", "%", $this->_req_data['s']).'%');
798 798
 			$query_params[0]['OR*s']['Payment.Transaction.Registration.Attendee.ATT_fname'] = $similarity_string;
799 799
 			$query_params[0]['OR*s']['Payment.Transaction.Registration.Attendee.ATT_lname'] = $similarity_string;
800 800
 			$query_params[0]['OR*s']['Payment.Transaction.Registration.Attendee.ATT_email'] = $similarity_string;
@@ -809,48 +809,48 @@  discard block
 block discarded – undo
809 809
 			$query_params[0]['OR*s']['LOG_message'] = $similarity_string;
810 810
 
811 811
 		}
812
-		if(isset( $this->_req_data['payment-filter-start-date'] ) && isset( $this->_req_data['payment-filter-end-date'] )){
812
+		if (isset($this->_req_data['payment-filter-start-date']) && isset($this->_req_data['payment-filter-end-date'])) {
813 813
 			//add date
814
-			$start_date =wp_strip_all_tags( $this->_req_data['payment-filter-start-date'] );
815
-			$end_date = wp_strip_all_tags( $this->_req_data['payment-filter-end-date'] );
814
+			$start_date = wp_strip_all_tags($this->_req_data['payment-filter-start-date']);
815
+			$end_date = wp_strip_all_tags($this->_req_data['payment-filter-end-date']);
816 816
 			//make sure our timestamps start and end right at the boundaries for each day
817
-			$start_date = date( 'Y-m-d', strtotime( $start_date ) ) . ' 00:00:00';
818
-			$end_date = date( 'Y-m-d', strtotime( $end_date ) ) . ' 23:59:59';
817
+			$start_date = date('Y-m-d', strtotime($start_date)).' 00:00:00';
818
+			$end_date = date('Y-m-d', strtotime($end_date)).' 23:59:59';
819 819
 
820 820
 			//convert to timestamps
821
-			$start_date = strtotime( $start_date );
822
-			$end_date = strtotime( $end_date );
821
+			$start_date = strtotime($start_date);
822
+			$end_date = strtotime($end_date);
823 823
 
824 824
 			//makes sure start date is the lowest value and vice versa
825
-			$start_date = min( $start_date, $end_date );
826
-			$end_date = max( $start_date, $end_date );
825
+			$start_date = min($start_date, $end_date);
826
+			$end_date = max($start_date, $end_date);
827 827
 
828 828
 			//convert for query
829
-			$start_date = EEM_Change_Log::instance()->convert_datetime_for_query( 'LOG_time', date( 'Y-m-d H:i:s', $start_date ), 'Y-m-d H:i:s' );
830
-			$end_date = EEM_Change_Log::instance()->convert_datetime_for_query( 'LOG_time', date( 'Y-m-d H:i:s', $end_date ), 'Y-m-d H:i:s' );
829
+			$start_date = EEM_Change_Log::instance()->convert_datetime_for_query('LOG_time', date('Y-m-d H:i:s', $start_date), 'Y-m-d H:i:s');
830
+			$end_date = EEM_Change_Log::instance()->convert_datetime_for_query('LOG_time', date('Y-m-d H:i:s', $end_date), 'Y-m-d H:i:s');
831 831
 
832
-			$query_params[0]['LOG_time'] = array('BETWEEN',array($start_date,$end_date));
832
+			$query_params[0]['LOG_time'] = array('BETWEEN', array($start_date, $end_date));
833 833
 
834 834
 		}
835
-		if($count){
835
+		if ($count) {
836 836
 			return EEM_Change_Log::instance()->count($query_params);
837 837
 		}
838
-		if(isset($this->_req_data['order'])){
839
-			$sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'DESC';
838
+		if (isset($this->_req_data['order'])) {
839
+			$sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'DESC';
840 840
 			$query_params['order_by'] = array('LOG_time' => $sort);
841
-		}else{
841
+		} else {
842 842
 				$query_params['order_by'] = array('LOG_time' => 'DESC');
843 843
 		}
844
-		$offset = ($current_page-1)*$per_page;
844
+		$offset = ($current_page - 1) * $per_page;
845 845
 
846
-		if( ! isset($this->_req_data['download_results'])){
847
-			$query_params['limit'] = array( $offset, $per_page );
846
+		if ( ! isset($this->_req_data['download_results'])) {
847
+			$query_params['limit'] = array($offset, $per_page);
848 848
 		}
849 849
 
850 850
 
851 851
 
852 852
 		//now they've requested to instead just download the file instead of viewing it.
853
-		if(isset($this->_req_data['download_results'])){
853
+		if (isset($this->_req_data['download_results'])) {
854 854
 			$wpdb_results = EEM_Change_Log::instance()->get_all_efficiently($query_params);
855 855
 			header('Content-Disposition: attachment');
856 856
 			header("Content-Disposition: attachment; filename=ee_payment_logs_for_".sanitize_key(site_url()));
@@ -872,36 +872,36 @@  discard block
 block discarded – undo
872 872
 	 * @param EE_Change_Log $logB
873 873
 	 * @return int
874 874
 	 */
875
-	protected function _sort_logs_again($logA,$logB){
875
+	protected function _sort_logs_again($logA, $logB) {
876 876
 		$timeA = $logA->get_raw('LOG_time');
877 877
 		$timeB = $logB->get_raw('LOG_time');
878
-		if($timeA == $timeB){
878
+		if ($timeA == $timeB) {
879 879
 			return 0;
880 880
 		}
881 881
 		$comparison = $timeA < $timeB ? -1 : 1;
882
-		if(strtoupper($this->_sort_logs_again_direction) == 'DESC'){
882
+		if (strtoupper($this->_sort_logs_again_direction) == 'DESC') {
883 883
 			return $comparison * -1;
884
-		}else{
884
+		} else {
885 885
 			return $comparison;
886 886
 		}
887 887
 	}
888 888
 
889 889
 	protected function _payment_log_details() {
890
-		EE_Registry::instance()->load_model( 'Change_Log' );
890
+		EE_Registry::instance()->load_model('Change_Log');
891 891
 		/** @var $payment_log EE_Change_Log */
892 892
 		$payment_log = EEM_Change_Log::instance()->get_one_by_ID($this->_req_data['ID']);
893 893
 		$payment_method = NULL;
894 894
 		$transaction = NULL;
895
-		if( $payment_log instanceof EE_Change_Log ){
896
-			if( $payment_log->object() instanceof EE_Payment ){
895
+		if ($payment_log instanceof EE_Change_Log) {
896
+			if ($payment_log->object() instanceof EE_Payment) {
897 897
 				$payment_method = $payment_log->object()->payment_method();
898 898
 				$transaction = $payment_log->object()->transaction();
899
-			}elseif($payment_log->object() instanceof EE_Payment_Method){
899
+			}elseif ($payment_log->object() instanceof EE_Payment_Method) {
900 900
 				$payment_method = $payment_log->object();
901 901
 			}
902 902
 		}
903 903
 		$this->_template_args['admin_page_content'] = EEH_Template::display_template(
904
-			EE_PAYMENTS_TEMPLATE_PATH . 'payment_log_details.template.php',
904
+			EE_PAYMENTS_TEMPLATE_PATH.'payment_log_details.template.php',
905 905
 			array(
906 906
 				'payment_log'=>$payment_log,
907 907
 				'payment_method'=>$payment_method,
Please login to merge, or discard this patch.
admin_pages/registrations/Registrations_Admin_Page.core.php 4 patches
Doc Comments   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1565,8 +1565,6 @@  discard block
 block discarded – undo
1565 1565
 	 * 		form_form_field_input__wrap
1566 1566
 	 *
1567 1567
 	 * 		@access 		public
1568
-	 * 		@param 		string 		$label
1569
-	 * 		@return 		string
1570 1568
 	 */
1571 1569
 	public function form_form_field_input__wrap( $input ) {
1572 1570
 		return '
@@ -1649,6 +1647,10 @@  discard block
 block discarded – undo
1649 1647
 
1650 1648
 
1651 1649
 	//TODO: try changing this to use the model directly... not indirectly through creating a default object...
1650
+
1651
+	/**
1652
+	 * @param boolean $REG_ID
1653
+	 */
1652 1654
 	private function _save_new_answer( $REG_ID, $QST_ID, $ans ) {
1653 1655
 		$set_values = array(
1654 1656
 			'QST_ID' => $QST_ID,
Please login to merge, or discard this patch.
Indentation   +69 added lines, -69 removed lines patch added patch discarded remove patch
@@ -124,9 +124,9 @@  discard block
 block discarded – undo
124 124
 
125 125
 	/**
126 126
 	 * 		grab url requests and route them
127
-	*		@access private
128
-	*		@return void
129
-	*/
127
+	 *		@access private
128
+	 *		@return void
129
+	 */
130 130
 	public function _set_page_routes() {
131 131
 
132 132
 		$this->_get_registration_status_array();
@@ -398,7 +398,7 @@  discard block
 block discarded – undo
398 398
 						'title' => __('Registrations Other', 'event_espresso'),
399 399
 						'filename' => 'registrations_overview_other'
400 400
 					)
401
-                ),
401
+				),
402 402
 				'help_tour' => array( 'Registration_Overview_Help_Tour' ),
403 403
 				'qtips' => array('Registration_List_Table_Tips'),
404 404
 				'list_table' => 'EE_Registrations_List_Table',
@@ -412,7 +412,7 @@  discard block
 block discarded – undo
412 412
 					'url' => isset($this->_req_data['_REG_ID']) ? add_query_arg(array('_REG_ID' => $this->_req_data['_REG_ID'] ), $this->_current_page_view_url )  : $this->_admin_base_url,
413 413
 					'persistent' => FALSE
414 414
 					),
415
-                'help_tabs' => array(
415
+				'help_tabs' => array(
416 416
 					'registrations_details_help_tab' => array(
417 417
 						'title' => __('Registration Details', 'event_espresso'),
418 418
 						'filename' => 'registrations_details'
@@ -476,7 +476,7 @@  discard block
 block discarded – undo
476 476
 					'order' => 20
477 477
 					),
478 478
 				'list_table' => 'EE_Attendee_Contact_List_Table',
479
-                'help_tabs' => array(
479
+				'help_tabs' => array(
480 480
 					'registrations_contact_list_help_tab' => array(
481 481
 						'title' => __('Registrations Contact List', 'event_espresso'),
482 482
 						'filename' => 'registrations_contact_list'
@@ -493,7 +493,7 @@  discard block
 block discarded – undo
493 493
 						'title' => __('Contact List Other', 'event_espresso'),
494 494
 						'filename' => 'registrations_contact_list_other'
495 495
 					)
496
-                ),
496
+				),
497 497
 				'help_tour' => array( 'Contact_List_Help_Tour' ),
498 498
 				'metaboxes' => array(),
499 499
 				'require_nonce' => FALSE
@@ -527,9 +527,9 @@  discard block
 block discarded – undo
527 527
 
528 528
 	/**
529 529
 	 * 		get list of registration statuses
530
-	*		@access private
531
-	*		@return void
532
-	*/
530
+	 *		@access private
531
+	 *		@return void
532
+	 */
533 533
 	private function _get_registration_status_array() {
534 534
 		self::$_reg_status = EEM_Registration::reg_status_array( array(), TRUE);
535 535
 	}
@@ -830,7 +830,7 @@  discard block
 block discarded – undo
830 830
 			return TRUE;
831 831
 		}
832 832
 
833
-	    $REG = EEM_Registration::instance();
833
+		$REG = EEM_Registration::instance();
834 834
 
835 835
 		$REG_ID = ( ! empty( $this->_req_data['_REG_ID'] )) ? absint( $this->_req_data['_REG_ID'] ) : FALSE;
836 836
 
@@ -1051,9 +1051,9 @@  discard block
 block discarded – undo
1051 1051
 
1052 1052
 	/**
1053 1053
 	 * 		generates HTML for the View Registration Details Admin page
1054
-	*		@access protected
1055
-	*		@return void
1056
-	*/
1054
+	 *		@access protected
1055
+	 *		@return void
1056
+	 */
1057 1057
 	protected function _registration_details() {
1058 1058
 
1059 1059
 		$this->_template_args = array();
@@ -1130,9 +1130,9 @@  discard block
 block discarded – undo
1130 1130
 
1131 1131
 	/**
1132 1132
 	 * 		_set_approve_or_decline_reg_status_buttons
1133
-	*		@access protected
1134
-	*		@return string
1135
-	*/
1133
+	 *		@access protected
1134
+	 *		@return string
1135
+	 */
1136 1136
 	public function set_reg_status_buttons_metabox() {
1137 1137
 
1138 1138
 		//is registration for free event OR for a completed transaction? This will determine whether the set to pending option is shown.
@@ -1321,10 +1321,10 @@  discard block
 block discarded – undo
1321 1321
 
1322 1322
 	/**
1323 1323
 	 * 		approve_registration
1324
-	*		@access protected
1325
-	*		@param bool $notify whether or not to notify the registrant about their approval.
1326
-	*		@return void
1327
-	*/
1324
+	 *		@access protected
1325
+	 *		@param bool $notify whether or not to notify the registrant about their approval.
1326
+	 *		@return void
1327
+	 */
1328 1328
 	protected function approve_registration( $notify = false ) {
1329 1329
 		$this->_reg_status_change_return( EEM_Registration::status_id_approved, $notify );
1330 1330
 	}
@@ -1334,10 +1334,10 @@  discard block
 block discarded – undo
1334 1334
 
1335 1335
 	/**
1336 1336
 	 * 		decline_registration
1337
-	*		@access protected
1338
-	*		@param bool $notify whether or not to notify the registrant about their approval.
1339
-	*		@return void
1340
-	*/
1337
+	 *		@access protected
1338
+	 *		@param bool $notify whether or not to notify the registrant about their approval.
1339
+	 *		@return void
1340
+	 */
1341 1341
 	protected function decline_registration( $notify = false ) {
1342 1342
 		$this->_reg_status_change_return( EEM_Registration::status_id_declined, $notify );
1343 1343
 	}
@@ -1347,10 +1347,10 @@  discard block
 block discarded – undo
1347 1347
 
1348 1348
 	/**
1349 1349
 	 * 		cancel_registration
1350
-	*		@access protected
1351
-	*		@param bool $notify whether or not to notify the registrant about their approval.
1352
-	*		@return void
1353
-	*/
1350
+	 *		@access protected
1351
+	 *		@param bool $notify whether or not to notify the registrant about their approval.
1352
+	 *		@return void
1353
+	 */
1354 1354
 	protected function cancel_registration( $notify = false ) {
1355 1355
 		$this->_reg_status_change_return( EEM_Registration::status_id_cancelled, $notify );
1356 1356
 	}
@@ -1361,10 +1361,10 @@  discard block
 block discarded – undo
1361 1361
 
1362 1362
 	/**
1363 1363
 	 * 		not_approve_registration
1364
-	*		@access protected
1365
-	*		@param bool $notify whether or not to notify the registrant about their approval.
1366
-	*		@return void
1367
-	*/
1364
+	 *		@access protected
1365
+	 *		@param bool $notify whether or not to notify the registrant about their approval.
1366
+	 *		@return void
1367
+	 */
1368 1368
 	protected function not_approve_registration( $notify = false ) {
1369 1369
 		$this->_reg_status_change_return( EEM_Registration::status_id_not_approved, $notify );
1370 1370
 	}
@@ -1373,10 +1373,10 @@  discard block
 block discarded – undo
1373 1373
 
1374 1374
 	/**
1375 1375
 	 * 		decline_registration
1376
-	*		@access protected
1377
-	*		@param bool $notify whether or not to notify the registrant about their approval.
1378
-	*		@return void
1379
-	*/
1376
+	 *		@access protected
1377
+	 *		@param bool $notify whether or not to notify the registrant about their approval.
1378
+	 *		@return void
1379
+	 */
1380 1380
 	protected function pending_registration( $notify = false ) {
1381 1381
 		$this->_reg_status_change_return( EEM_Registration::status_id_pending_payment, $notify );
1382 1382
 	}
@@ -1386,9 +1386,9 @@  discard block
 block discarded – undo
1386 1386
 
1387 1387
 	/**
1388 1388
 	 * 		generates HTML for the Registration main meta box
1389
-	*		@access public
1390
-	*		@return void
1391
-	*/
1389
+	 *		@access public
1390
+	 *		@return void
1391
+	 */
1392 1392
 	public function _reg_details_meta_box() {
1393 1393
 		EEH_Autoloader::register_line_item_display_autoloaders();
1394 1394
 		EEH_Autoloader::register_line_item_filter_autoloaders();
@@ -1471,9 +1471,9 @@  discard block
 block discarded – undo
1471 1471
 
1472 1472
 	/**
1473 1473
 	 * 		generates HTML for the Registration Questions meta box
1474
-	*		@access public
1475
-	*		@return void
1476
-	*/
1474
+	 *		@access public
1475
+	 *		@return void
1476
+	 */
1477 1477
 	public function _reg_questions_meta_box() {
1478 1478
 
1479 1479
 		add_filter( 'FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions', array( $this, 'form_before_question_group' ), 10, 1 );
@@ -1581,9 +1581,9 @@  discard block
 block discarded – undo
1581 1581
 
1582 1582
 	/**
1583 1583
 	 * 		generates HTML for the Registration main meta box
1584
-	*		@access protected
1585
-	*		@return void
1586
-	*/
1584
+	 *		@access protected
1585
+	 *		@return void
1586
+	 */
1587 1587
 	protected function _update_attendee_registration_form() {
1588 1588
 		$qstns = isset( $this->_req_data['qstn'] ) ? $this->_req_data['qstn'] : FALSE;
1589 1589
 		$REG_ID = isset( $this->_req_data['_REG_ID'] ) ? absint( $this->_req_data['_REG_ID'] ) : FALSE;
@@ -1665,12 +1665,12 @@  discard block
 block discarded – undo
1665 1665
 
1666 1666
 	/**
1667 1667
 	 * 		generates HTML for the Registration main meta box
1668
-	*		@access public
1669
-	*		@return void
1670
-	*/
1668
+	 *		@access public
1669
+	 *		@return void
1670
+	 */
1671 1671
 	public function _reg_attendees_meta_box() {
1672 1672
 
1673
-	    $REG = EEM_Registration::instance();
1673
+		$REG = EEM_Registration::instance();
1674 1674
 		//get all other registrations on this transaction, and cache
1675 1675
 		//the attendees for them so we don't have to run another query using force_join
1676 1676
 		$registrations = $REG->get_all(array(
@@ -1723,9 +1723,9 @@  discard block
 block discarded – undo
1723 1723
 
1724 1724
 	/**
1725 1725
 	 * 		generates HTML for the Edit Registration side meta box
1726
-	*		@access public
1727
-	*		@return void
1728
-	*/
1726
+	 *		@access public
1727
+	 *		@return void
1728
+	 */
1729 1729
 	public function _reg_registrant_side_meta_box() {
1730 1730
 
1731 1731
 		/*@var $attendee EE_Attendee */
@@ -2071,9 +2071,9 @@  discard block
 block discarded – undo
2071 2071
 
2072 2072
 	/**
2073 2073
 	 * 		set_reg_event
2074
-	*		@access private
2075
-	*		@return boolean
2076
-	*/
2074
+	 *		@access private
2075
+	 *		@return boolean
2076
+	 */
2077 2077
 	private function _set_reg_event() {
2078 2078
 		if ( is_object( $this->_reg_event )) {
2079 2079
 			return TRUE;
@@ -2177,9 +2177,9 @@  discard block
 block discarded – undo
2177 2177
 
2178 2178
 	/**
2179 2179
 	 * 		generates HTML for the Attendee Contact List
2180
-	*		@access protected
2181
-	*		@return void
2182
-	*/
2180
+	 *		@access protected
2181
+	 *		@return void
2182
+	 */
2183 2183
 	protected function _attendee_contact_list_table() {
2184 2184
 		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
2185 2185
 		$this->_search_btn_label = __('Contacts', 'event_espresso');
@@ -2193,9 +2193,9 @@  discard block
 block discarded – undo
2193 2193
 	/**
2194 2194
 	 * 		get_attendees
2195 2195
 	 * 		@param bool $count whether to return count or data.
2196
-	*		@access public
2197
-	*		@return array
2198
-	*/
2196
+	 *		@access public
2197
+	 *		@return array
2198
+	 */
2199 2199
 	public function get_attendees( $per_page, $count = FALSE, $trash = FALSE ) {
2200 2200
 
2201 2201
 		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
@@ -2513,9 +2513,9 @@  discard block
 block discarded – undo
2513 2513
 
2514 2514
 	/**
2515 2515
 	 * 		_attendee_details
2516
-	*		@access protected
2517
-	*		@return void
2518
-	*/
2516
+	 *		@access protected
2517
+	 *		@return void
2518
+	 */
2519 2519
 	public function attendee_registrations_meta_box( $post ) {
2520 2520
 
2521 2521
 		$this->_template_args['attendee'] = $this->_cpt_model_obj;
@@ -2548,10 +2548,10 @@  discard block
 block discarded – undo
2548 2548
 
2549 2549
 	/**
2550 2550
 	 * 		_trash_or_restore_attendee
2551
-	*		@param boolean 		$trash - whether to move item to trash (TRUE) or restore it (FALSE)
2552
-	*		@access protected
2553
-	*		@return void
2554
-	*/
2551
+	 *		@param boolean 		$trash - whether to move item to trash (TRUE) or restore it (FALSE)
2552
+	 *		@access protected
2553
+	 *		@return void
2554
+	 */
2555 2555
 	protected function _trash_or_restore_attendees( $trash = TRUE ) {
2556 2556
 
2557 2557
 		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
Please login to merge, or discard this patch.
Spacing   +493 added lines, -493 removed lines patch added patch discarded remove patch
@@ -42,8 +42,8 @@  discard block
 block discarded – undo
42 42
 	 * @param bool $routing
43 43
 	 * @return Registrations_Admin_Page
44 44
 	 */
45
-	public function __construct( $routing = TRUE ) {
46
-		parent::__construct( $routing );
45
+	public function __construct($routing = TRUE) {
46
+		parent::__construct($routing);
47 47
 	}
48 48
 
49 49
 
@@ -70,16 +70,16 @@  discard block
 block discarded – undo
70 70
 			'espresso_attendees' => 'edit_attendee'
71 71
 			);
72 72
 
73
-		add_action('edit_form_after_title', array($this, 'after_title_form_fields'), 10 );
73
+		add_action('edit_form_after_title', array($this, 'after_title_form_fields'), 10);
74 74
 		//add filters so that the comment urls don't take users to a confusing 404 page
75
-		add_filter('get_comment_link', array( $this, 'clear_comment_link' ), 10, 3 );
75
+		add_filter('get_comment_link', array($this, 'clear_comment_link'), 10, 3);
76 76
 	}
77 77
 
78 78
 
79
-	public function clear_comment_link( $link, $comment, $args ) {
79
+	public function clear_comment_link($link, $comment, $args) {
80 80
 		//gotta make sure this only happens on this route
81
-		$post_type = get_post_type( $comment->comment_post_ID);
82
-		if ( $post_type == 'espresso_attendees' )
81
+		$post_type = get_post_type($comment->comment_post_ID);
82
+		if ($post_type == 'espresso_attendees')
83 83
 			return '#commentsdiv';
84 84
 		return $link;
85 85
 	}
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 
88 88
 	protected function _ajax_hooks() {
89 89
 		//todo: all hooks for registrations ajax goes in here
90
-		add_action( 'wp_ajax_toggle_checkin_status', array( $this, 'toggle_checkin_status' ));
90
+		add_action('wp_ajax_toggle_checkin_status', array($this, 'toggle_checkin_status'));
91 91
 	}
92 92
 
93 93
 
@@ -102,8 +102,8 @@  discard block
 block discarded – undo
102 102
 					'add-attendee' => __('Add Contact', 'event_espresso'),
103 103
 					'edit' => __('Edit Contact', 'event_espresso'),
104 104
 					'report'=>  __("Event Registrations CSV Report", "event_espresso"),
105
-					'report_all' => __( 'All Registrations CSV Report', 'event_espresso' ),
106
-					'contact_list_report' => __( 'Contact List Report', 'event_espresso' ),
105
+					'report_all' => __('All Registrations CSV Report', 'event_espresso'),
106
+					'contact_list_report' => __('Contact List Report', 'event_espresso'),
107 107
 					'contact_list_export'=>  __("Export Data", "event_espresso"),
108 108
 				),
109 109
 			'publishbox' => array(
@@ -131,9 +131,9 @@  discard block
 block discarded – undo
131 131
 
132 132
 		$this->_get_registration_status_array();
133 133
 
134
-		$reg_id = ! empty( $this->_req_data['_REG_ID'] ) && ! is_array( $this->_req_data['_REG_ID'] ) ? $this->_req_data['_REG_ID'] : 0;
135
-		$att_id = ! empty( $this->_req_data[ 'ATT_ID' ] ) && ! is_array( $this->_req_data['ATT_ID'] ) ? $this->_req_data['ATT_ID'] : 0;
136
-		$att_id = ! empty( $this->_req_data['post'] ) && ! is_array( $this->_req_data['post'] ) ? $this->_req_data['post'] : $att_id;
134
+		$reg_id = ! empty($this->_req_data['_REG_ID']) && ! is_array($this->_req_data['_REG_ID']) ? $this->_req_data['_REG_ID'] : 0;
135
+		$att_id = ! empty($this->_req_data['ATT_ID']) && ! is_array($this->_req_data['ATT_ID']) ? $this->_req_data['ATT_ID'] : 0;
136
+		$att_id = ! empty($this->_req_data['post']) && ! is_array($this->_req_data['post']) ? $this->_req_data['post'] : $att_id;
137 137
 
138 138
 		$this->_page_routes = array(
139 139
 
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
 
151 151
 				'edit_registration'	=> array(
152 152
 						'func' => '_registration_details',
153
-						'args' => array( 'edit' ),
153
+						'args' => array('edit'),
154 154
 						'noheader' => TRUE,
155 155
 						'capability' => 'ee_edit_registration',
156 156
 						'obj_id' => $reg_id
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
 
166 166
 				'restore_registrations' => array(
167 167
 					'func' => '_trash_or_restore_registrations',
168
-					'args' => array( 'trash' => FALSE ),
168
+					'args' => array('trash' => FALSE),
169 169
 					'noheader' => TRUE,
170 170
 					'capability' => 'ee_delete_registrations'
171 171
 					),
@@ -399,7 +399,7 @@  discard block
 block discarded – undo
399 399
 						'filename' => 'registrations_overview_other'
400 400
 					)
401 401
                 ),
402
-				'help_tour' => array( 'Registration_Overview_Help_Tour' ),
402
+				'help_tour' => array('Registration_Overview_Help_Tour'),
403 403
 				'qtips' => array('Registration_List_Table_Tips'),
404 404
 				'list_table' => 'EE_Registrations_List_Table',
405 405
 				'require_nonce' => FALSE
@@ -409,7 +409,7 @@  discard block
 block discarded – undo
409 409
 				'nav' => array(
410 410
 					'label' => __('REG Details', 'event_espresso'),
411 411
 					'order' => 15,
412
-					'url' => isset($this->_req_data['_REG_ID']) ? add_query_arg(array('_REG_ID' => $this->_req_data['_REG_ID'] ), $this->_current_page_view_url )  : $this->_admin_base_url,
412
+					'url' => isset($this->_req_data['_REG_ID']) ? add_query_arg(array('_REG_ID' => $this->_req_data['_REG_ID']), $this->_current_page_view_url) : $this->_admin_base_url,
413 413
 					'persistent' => FALSE
414 414
 					),
415 415
                 'help_tabs' => array(
@@ -430,8 +430,8 @@  discard block
 block discarded – undo
430 430
 						'filename' => 'registrations_details_registrant_details'
431 431
 						)
432 432
 					),
433
-				'help_tour' => array( 'Registration_Details_Help_Tour' ),
434
-				'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array( '_registration_details_metaboxes' ) ),
433
+				'help_tour' => array('Registration_Details_Help_Tour'),
434
+				'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_registration_details_metaboxes')),
435 435
 				'require_nonce' => FALSE
436 436
 				),
437 437
 
@@ -455,7 +455,7 @@  discard block
 block discarded – undo
455 455
 					'order' => 15,
456 456
 					'persistent' => FALSE
457 457
 					),
458
-				'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array('_publish_post_box', 'attendee_editor_metaboxes' ) ),
458
+				'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box', 'attendee_editor_metaboxes')),
459 459
 				'require_nonce' => FALSE
460 460
 				),
461 461
 
@@ -464,7 +464,7 @@  discard block
 block discarded – undo
464 464
 					'label' => __('Edit Contact', 'event_espresso'),
465 465
 					'order' => 15,
466 466
 					'persistent' => FALSE,
467
-					'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
467
+					'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
468 468
 					),
469 469
 				'metaboxes' => array('attendee_editor_metaboxes'),
470 470
 				'require_nonce' => FALSE
@@ -494,7 +494,7 @@  discard block
 block discarded – undo
494 494
 						'filename' => 'registrations_contact_list_other'
495 495
 					)
496 496
                 ),
497
-				'help_tour' => array( 'Contact_List_Help_Tour' ),
497
+				'help_tour' => array('Contact_List_Help_Tour'),
498 498
 				'metaboxes' => array(),
499 499
 				'require_nonce' => FALSE
500 500
 				),
@@ -513,7 +513,7 @@  discard block
 block discarded – undo
513 513
 	protected function _add_screen_options() {}
514 514
 	protected function _add_feature_pointers() {}
515 515
 	public function admin_init() {
516
-		EE_Registry::$i18n_js_strings[ 'update_att_qstns' ] = __( 'click "Update Registration Questions" to save your changes', 'event_espresso' );
516
+		EE_Registry::$i18n_js_strings['update_att_qstns'] = __('click "Update Registration Questions" to save your changes', 'event_espresso');
517 517
 	}
518 518
 	public function admin_notices() {}
519 519
 	public function admin_footer_scripts() {}
@@ -531,7 +531,7 @@  discard block
 block discarded – undo
531 531
 	*		@return void
532 532
 	*/
533 533
 	private function _get_registration_status_array() {
534
-		self::$_reg_status = EEM_Registration::reg_status_array( array(), TRUE);
534
+		self::$_reg_status = EEM_Registration::reg_status_array(array(), TRUE);
535 535
 	}
536 536
 
537 537
 
@@ -554,11 +554,11 @@  discard block
 block discarded – undo
554 554
 	public function load_scripts_styles() {
555 555
 		//style
556 556
 		//wp_register_style('espresso_attendees', ATT_ASSETS_URL . 'espresso_attendees_admin.css', array(), EVENT_ESPRESSO_VERSION );
557
-		wp_register_style('espresso_reg', REG_ASSETS_URL . 'espresso_registrations_admin.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION );
557
+		wp_register_style('espresso_reg', REG_ASSETS_URL.'espresso_registrations_admin.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION);
558 558
 		wp_enqueue_style('espresso_reg');
559 559
 
560 560
 		//script
561
-		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);
561
+		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);
562 562
 		wp_enqueue_script('espresso_reg');
563 563
 	}
564 564
 
@@ -567,9 +567,9 @@  discard block
 block discarded – undo
567 567
 	public function load_scripts_styles_edit_attendee() {
568 568
 		//stuff to only show up on our attendee edit details page.
569 569
 		$attendee_details_translations = array(
570
-			'att_publish_text' => sprintf( __('Created on: <b>%1$s</b>', 'event_espresso'), $this->_cpt_model_obj->get_datetime('ATT_created') )
570
+			'att_publish_text' => sprintf(__('Created on: <b>%1$s</b>', 'event_espresso'), $this->_cpt_model_obj->get_datetime('ATT_created'))
571 571
 			);
572
-		wp_localize_script( 'espresso_reg', 'ATTENDEE_DETAILS', $attendee_details_translations );
572
+		wp_localize_script('espresso_reg', 'ATTENDEE_DETAILS', $attendee_details_translations);
573 573
 		wp_enqueue_script('jquery-validate');
574 574
 	}
575 575
 
@@ -587,7 +587,7 @@  discard block
 block discarded – undo
587 587
 
588 588
 	public function load_scripts_styles_contact_list() {
589 589
 		wp_deregister_style('espresso_reg');
590
-		wp_register_style('espresso_att', REG_ASSETS_URL . 'espresso_attendees_admin.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION );
590
+		wp_register_style('espresso_att', REG_ASSETS_URL.'espresso_attendees_admin.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION);
591 591
 		wp_enqueue_style('espresso_att');
592 592
 	}
593 593
 
@@ -596,9 +596,9 @@  discard block
 block discarded – undo
596 596
 
597 597
 
598 598
 	public function load_scripts_styles_new_registration() {
599
-		wp_register_script( 'ee-spco-for-admin', REG_ASSETS_URL . 'spco_for_admin.js', array('underscore', 'jquery'), EVENT_ESPRESSO_VERSION, TRUE );
599
+		wp_register_script('ee-spco-for-admin', REG_ASSETS_URL.'spco_for_admin.js', array('underscore', 'jquery'), EVENT_ESPRESSO_VERSION, TRUE);
600 600
 		wp_enqueue_script('ee-spco-for-admin');
601
-		add_filter('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true' );
601
+		add_filter('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true');
602 602
 		EE_Form_Section_Proper::wp_enqueue_scripts();
603 603
 		EED_Ticket_Selector::load_tckt_slctr_assets();
604 604
 		EE_Datepicker_Input::enqueue_styles_and_scripts();
@@ -637,23 +637,23 @@  discard block
 block discarded – undo
637 637
 
638 638
 		/** setup reg status bulk actions **/
639 639
 		$def_reg_status_actions['approve_registration'] = __('Approve Registrations', 'event_espresso');
640
-		if ( in_array( $match_array['approve_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) {
640
+		if (in_array($match_array['approve_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) {
641 641
 			$def_reg_status_actions['approve_and_notify_registration'] = __('Approve and Notify Registrations', 'event_espresso');
642 642
 		}
643 643
 		$def_reg_status_actions['decline_registration'] = __('Decline Registrations', 'event_espresso');
644
-		if ( in_array( $match_array['decline_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) {
644
+		if (in_array($match_array['decline_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) {
645 645
 			$def_reg_status_actions['decline_and_notify_registration'] = __('Decline and Notify Registrations', 'event_espresso');
646 646
 		}
647 647
 		$def_reg_status_actions['pending_registration'] = __('Set Registrations to Pending Payment', 'event_espresso');
648
-		if ( in_array( $match_array['pending_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) {
648
+		if (in_array($match_array['pending_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) {
649 649
 			$def_reg_status_actions['pending_and_notify_registration'] = __('Set Registrations to Pending Payment and Notify', 'event_espresso');
650 650
 		}
651 651
 		$def_reg_status_actions['no_approve_registration'] = __('Set Registrations to Not Approved', 'event_espresso');
652
-		if ( in_array( $match_array['no_approve_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) {
652
+		if (in_array($match_array['no_approve_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) {
653 653
 			$def_reg_status_actions['no_approve_and_notify_registration'] = __('Set Registrations to Not Approved and Notify', 'event_espresso');
654 654
 		}
655 655
 		$def_reg_status_actions['cancel_registration'] = __('Cancel Registrations', 'event_espresso');
656
-		if ( in_array( $match_array['cancel_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) {
656
+		if (in_array($match_array['cancel_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) {
657 657
 			$def_reg_status_actions['cancel_and_notify_registration'] = __('Cancel Registrations and Notify', 'event_espresso');
658 658
 		}
659 659
 
@@ -662,29 +662,29 @@  discard block
 block discarded – undo
662 662
 				'slug' => 'all',
663 663
 				'label' => __('View All Registrations', 'event_espresso'),
664 664
 				'count' => 0,
665
-				'bulk_action' => array_merge( $def_reg_status_actions, array(
665
+				'bulk_action' => array_merge($def_reg_status_actions, array(
666 666
 					'trash_registrations' => __('Trash Registrations', 'event_espresso')
667
-					) )
667
+					))
668 668
 				),
669 669
 			'month' => array(
670 670
 				'slug' => 'month',
671 671
 				'label' => __('This Month', 'event_espresso'),
672 672
 				'count' => 0,
673
-				'bulk_action' => array_merge( $def_reg_status_actions, array(
673
+				'bulk_action' => array_merge($def_reg_status_actions, array(
674 674
 					'trash_registrations' => __('Trash Registrations', 'event_espresso')
675 675
 					))
676 676
 				),
677 677
 			'today' => array(
678 678
 				'slug' => 'today',
679
-				'label' => sprintf( __('Today - %s', 'event_espresso'), date('M d, Y', current_time('timestamp' ) ) ),
679
+				'label' => sprintf(__('Today - %s', 'event_espresso'), date('M d, Y', current_time('timestamp'))),
680 680
 				'count' => 0,
681
-				'bulk_action' => array_merge( $def_reg_status_actions,  array(
681
+				'bulk_action' => array_merge($def_reg_status_actions, array(
682 682
 					'trash_registrations' => __('Trash Registrations', 'event_espresso')
683 683
 					))
684 684
 				)
685 685
 			);
686 686
 
687
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_registrations', 'espresso_registrations_delete_registration' ) ) {
687
+		if (EE_Registry::instance()->CAP->current_user_can('ee_delete_registrations', 'espresso_registrations_delete_registration')) {
688 688
 			$this->_views['incomplete'] = array(
689 689
 				'slug' => 'incomplete',
690 690
 				'label' => __('Incomplete', 'event_espresso'),
@@ -720,7 +720,7 @@  discard block
 block discarded – undo
720 720
 				)
721 721
 			);
722 722
 
723
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_contacts', 'espresso_registrations_trash_attendees' ) ) {
723
+		if (EE_Registry::instance()->CAP->current_user_can('ee_delete_contacts', 'espresso_registrations_trash_attendees')) {
724 724
 			$this->_views['trash'] = array(
725 725
 				'slug' => 'trash',
726 726
 				'label' => __('Trash', 'event_espresso'),
@@ -755,42 +755,42 @@  discard block
 block discarded – undo
755 755
 				'desc' => __('View Transaction Details', 'event_espresso')
756 756
 				)
757 757
  			);
758
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_registrations_resend_registration' ) ) {
758
+		if (EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_registrations_resend_registration')) {
759 759
 			$fc_items['resend_registration'] = array(
760 760
 				'class' => 'dashicons dashicons-email-alt',
761 761
 				'desc' => __('Resend Registration Details', 'event_espresso')
762 762
 				);
763 763
 		} else {
764
-			$fc_items['blank'] = array( 'class' => 'blank', 'desc' => '' );
764
+			$fc_items['blank'] = array('class' => 'blank', 'desc' => '');
765 765
 		}
766 766
 
767 767
 		$sc_items = array(
768 768
 			'approved_status' => array(
769
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_approved,
770
-				'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_approved, FALSE, 'sentence' )
769
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_approved,
770
+				'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_approved, FALSE, 'sentence')
771 771
 				),
772 772
 			'pending_status' => array(
773
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_pending_payment,
774
-				'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_pending_payment, FALSE, 'sentence' )
773
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_pending_payment,
774
+				'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_pending_payment, FALSE, 'sentence')
775 775
 				),
776 776
 			'incomplete_status' => array(
777
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_incomplete,
778
-				'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_incomplete, FALSE, 'sentence' )
777
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_incomplete,
778
+				'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_incomplete, FALSE, 'sentence')
779 779
 			),
780 780
 			'not_approved' => array(
781
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_not_approved,
782
-				'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_not_approved, FALSE, 'sentence' )
781
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_not_approved,
782
+				'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_not_approved, FALSE, 'sentence')
783 783
 				),
784 784
 			'declined_status' => array(
785
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_declined,
786
-				'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_declined, FALSE, 'sentence' )
785
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_declined,
786
+				'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_declined, FALSE, 'sentence')
787 787
 				),
788 788
 			'cancelled_status' => array(
789
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_cancelled,
790
-				'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_cancelled, FALSE, 'sentence' )
789
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_cancelled,
790
+				'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_cancelled, FALSE, 'sentence')
791 791
 				)
792 792
 			);
793
-		return array_merge( $fc_items, $sc_items );
793
+		return array_merge($fc_items, $sc_items);
794 794
 	}
795 795
 
796 796
 
@@ -803,15 +803,15 @@  discard block
 block discarded – undo
803 803
 
804 804
 
805 805
 	protected function _registrations_overview_list_table() {
806
-		$EVT_ID = ( ! empty( $this->_req_data['event_id'] )) ? absint( $this->_req_data['event_id'] ) : FALSE;
807
-		if ( $EVT_ID ) {
808
-			if ( EE_Registry::instance()->CAP->current_user_can( 'ee_edit_registrations', 'espresso_registrations_new_registration', $EVT_ID ) ) {
809
-				$this->_admin_page_title .= $this->get_action_link_or_button( 'new_registration', 'add-registrant', array( 'event_id' => $EVT_ID ), 'add-new-h2' );
806
+		$EVT_ID = ( ! empty($this->_req_data['event_id'])) ? absint($this->_req_data['event_id']) : FALSE;
807
+		if ($EVT_ID) {
808
+			if (EE_Registry::instance()->CAP->current_user_can('ee_edit_registrations', 'espresso_registrations_new_registration', $EVT_ID)) {
809
+				$this->_admin_page_title .= $this->get_action_link_or_button('new_registration', 'add-registrant', array('event_id' => $EVT_ID), 'add-new-h2');
810 810
 			}
811
-			$event = EEM_Event::instance()->get_one_by_ID( $EVT_ID );
812
-			$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>' ) : '';
811
+			$event = EEM_Event::instance()->get_one_by_ID($EVT_ID);
812
+			$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>') : '';
813 813
 		}
814
-		$this->_template_args['after_list_table'] = $this->_display_legend( $this->_registration_legend_items() );
814
+		$this->_template_args['after_list_table'] = $this->_display_legend($this->_registration_legend_items());
815 815
 		$this->display_admin_list_table_page_with_no_sidebar();
816 816
 	}
817 817
 
@@ -826,19 +826,19 @@  discard block
 block discarded – undo
826 826
 	 */
827 827
 	private function _set_registration_object() {
828 828
 		//get out if we've already set the object
829
-		if ( is_object( $this->_registration )) {
829
+		if (is_object($this->_registration)) {
830 830
 			return TRUE;
831 831
 		}
832 832
 
833 833
 	    $REG = EEM_Registration::instance();
834 834
 
835
-		$REG_ID = ( ! empty( $this->_req_data['_REG_ID'] )) ? absint( $this->_req_data['_REG_ID'] ) : FALSE;
835
+		$REG_ID = ( ! empty($this->_req_data['_REG_ID'])) ? absint($this->_req_data['_REG_ID']) : FALSE;
836 836
 
837
-		if ( $this->_registration = $REG->get_one_by_ID( $REG_ID ))
837
+		if ($this->_registration = $REG->get_one_by_ID($REG_ID))
838 838
 			return TRUE;
839 839
 		else {
840
-			$error_msg = sprintf( __('An error occurred and the details for Registration ID #%s could not be retrieved.', 'event_espresso'), $REG_ID );
841
-			EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ );
840
+			$error_msg = sprintf(__('An error occurred and the details for Registration ID #%s could not be retrieved.', 'event_espresso'), $REG_ID);
841
+			EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__);
842 842
 			$this->_registration = NULL;
843 843
 			return FALSE;
844 844
 		}
@@ -857,25 +857,25 @@  discard block
 block discarded – undo
857 857
 	 * @internal param bool $all whether to ignore all query params and just return ALL registrations (or count if count is set)
858 858
 	 * @return mixed (int|array)  int = count || array of registration objects
859 859
 	 */
860
-	public function get_registrations( $per_page = 10, $count = FALSE, $this_month = FALSE, $today = FALSE ) {
861
-
862
-		$EVT_ID = ! empty( $this->_req_data['event_id'] ) && $this->_req_data['event_id'] > 0 ? absint( $this->_req_data['event_id'] ) : FALSE;
863
-		$CAT_ID = ! empty( $this->_req_data['EVT_CAT'] ) && (int) $this->_req_data['EVT_CAT'] > 0? absint( $this->_req_data['EVT_CAT'] ) : FALSE;
864
-		$reg_status = ! empty( $this->_req_data['_reg_status'] ) ? sanitize_text_field( $this->_req_data['_reg_status'] ) : FALSE;
865
-		$month_range = ! empty( $this->_req_data['month_range'] ) ? sanitize_text_field( $this->_req_data['month_range'] ) : FALSE;//should be like 2013-april
866
-		$today_a = ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] == 'today' ? TRUE : FALSE;
867
-		$this_month_a = ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] == 'month' ? TRUE  : FALSE;
860
+	public function get_registrations($per_page = 10, $count = FALSE, $this_month = FALSE, $today = FALSE) {
861
+
862
+		$EVT_ID = ! empty($this->_req_data['event_id']) && $this->_req_data['event_id'] > 0 ? absint($this->_req_data['event_id']) : FALSE;
863
+		$CAT_ID = ! empty($this->_req_data['EVT_CAT']) && (int) $this->_req_data['EVT_CAT'] > 0 ? absint($this->_req_data['EVT_CAT']) : FALSE;
864
+		$reg_status = ! empty($this->_req_data['_reg_status']) ? sanitize_text_field($this->_req_data['_reg_status']) : FALSE;
865
+		$month_range = ! empty($this->_req_data['month_range']) ? sanitize_text_field($this->_req_data['month_range']) : FALSE; //should be like 2013-april
866
+		$today_a = ! empty($this->_req_data['status']) && $this->_req_data['status'] == 'today' ? TRUE : FALSE;
867
+		$this_month_a = ! empty($this->_req_data['status']) && $this->_req_data['status'] == 'month' ? TRUE : FALSE;
868 868
 		$start_date = FALSE;
869 869
 		$end_date = FALSE;
870 870
 		$_where = array();
871
-		$trash = ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] == 'trash' ? TRUE : FALSE;
872
-		$incomplete = ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] == 'incomplete' ? TRUE : FALSE;
871
+		$trash = ! empty($this->_req_data['status']) && $this->_req_data['status'] == 'trash' ? TRUE : FALSE;
872
+		$incomplete = ! empty($this->_req_data['status']) && $this->_req_data['status'] == 'incomplete' ? TRUE : FALSE;
873 873
 
874 874
 		//set orderby
875 875
 		$this->_req_data['orderby'] = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : '';
876 876
 
877 877
 
878
-		switch ( $this->_req_data['orderby'] ) {
878
+		switch ($this->_req_data['orderby']) {
879 879
 			case '_REG_ID':
880 880
 				$orderby = 'REG_ID';
881 881
 				break;
@@ -895,26 +895,26 @@  discard block
 block discarded – undo
895 895
 				$orderby = 'REG_date';
896 896
 		}
897 897
 
898
-		$sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'DESC';
899
-		$current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1;
900
-		$per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page;
898
+		$sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'DESC';
899
+		$current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1;
900
+		$per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page;
901 901
 
902 902
 
903
-		$offset = ($current_page-1)*$per_page;
904
-		$limit = $count  ? NULL : array( $offset, $per_page );
903
+		$offset = ($current_page - 1) * $per_page;
904
+		$limit = $count ? NULL : array($offset, $per_page);
905 905
 
906
-		if($EVT_ID){
907
-			$_where['EVT_ID']=$EVT_ID;
906
+		if ($EVT_ID) {
907
+			$_where['EVT_ID'] = $EVT_ID;
908 908
 		}
909
-		if($CAT_ID){
909
+		if ($CAT_ID) {
910 910
 			$_where['Event.Term_Taxonomy.term_id'] = $CAT_ID;
911 911
 		}
912
-		if ( $incomplete ) {
912
+		if ($incomplete) {
913 913
 			$_where['STS_ID'] = EEM_Registration::status_id_incomplete;
914 914
 		} else if ( ! $trash) {
915
-			$_where['STS_ID'] = array( '!=', EEM_Registration::status_id_incomplete );
915
+			$_where['STS_ID'] = array('!=', EEM_Registration::status_id_incomplete);
916 916
 		}
917
-		if($reg_status){
917
+		if ($reg_status) {
918 918
 			$_where['STS_ID'] = $reg_status;
919 919
 		}
920 920
 
@@ -926,103 +926,103 @@  discard block
 block discarded – undo
926 926
 		$time_start = ' 00:00:00';
927 927
 		$time_end = ' 23:59:59';
928 928
 
929
-		if($today_a || $today ){
929
+		if ($today_a || $today) {
930 930
 			$curdate = date('Y-m-d', current_time('timestamp'));
931
-			$_where['REG_date']= array('BETWEEN',
931
+			$_where['REG_date'] = array('BETWEEN',
932 932
 				array(
933
-					EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $curdate . $time_start, 'Y-m-d H:i:s' ),
934
-					EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $curdate . $time_end, 'Y-m-d H:i:s' ),
933
+					EEM_Registration::instance()->convert_datetime_for_query('REG_date', $curdate.$time_start, 'Y-m-d H:i:s'),
934
+					EEM_Registration::instance()->convert_datetime_for_query('REG_date', $curdate.$time_end, 'Y-m-d H:i:s'),
935 935
 			));
936
-		}elseif($this_month_a || $this_month){
936
+		}elseif ($this_month_a || $this_month) {
937 937
 			$this_month_r = date('m', current_time('timestamp'));
938
-			$days_this_month = date( 't', current_time('timestamp') );
939
-			$_where['REG_date']= array('BETWEEN',
938
+			$days_this_month = date('t', current_time('timestamp'));
939
+			$_where['REG_date'] = array('BETWEEN',
940 940
 				array(
941
-					EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $this_year_r . '-' . $this_month_r . '-01' . ' ' . $time_start, 'Y-m-d H:i:s' ),
942
-					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' )
941
+					EEM_Registration::instance()->convert_datetime_for_query('REG_date', $this_year_r.'-'.$this_month_r.'-01'.' '.$time_start, 'Y-m-d H:i:s'),
942
+					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')
943 943
 			));
944
-		}elseif($month_range){
944
+		}elseif ($month_range) {
945 945
 			$pieces = explode(' ', $this->_req_data['month_range'], 3);
946
-			$month_r = !empty($pieces[0]) ? date('m', strtotime($pieces[0])) : '';
947
-			$year_r = !empty($pieces[1]) ? $pieces[1] : '';
948
-			$days_in_month = date('t', strtotime($year_r .  '-' . $month_r . '-' . '01') );
949
-			$_where['REG_date']= array('BETWEEN',
950
-				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' ) ) );
951
-		}elseif($start_date && $end_date){
946
+			$month_r = ! empty($pieces[0]) ? date('m', strtotime($pieces[0])) : '';
947
+			$year_r = ! empty($pieces[1]) ? $pieces[1] : '';
948
+			$days_in_month = date('t', strtotime($year_r.'-'.$month_r.'-'.'01'));
949
+			$_where['REG_date'] = array('BETWEEN',
950
+				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')));
951
+		}elseif ($start_date && $end_date) {
952 952
 			throw new EE_Error("not yet supported");
953
-		}elseif($start_date){
953
+		}elseif ($start_date) {
954 954
 			throw new EE_Error("not yet supported");
955
-		}elseif($end_date){
955
+		}elseif ($end_date) {
956 956
 			throw new EE_Error("not yet supported");
957 957
 		}
958 958
 
959
-		if ( isset( $this->_req_data['s'] ) ) {
960
-			$sstr = '%' . $this->_req_data['s'] . '%';
959
+		if (isset($this->_req_data['s'])) {
960
+			$sstr = '%'.$this->_req_data['s'].'%';
961 961
 			$_where['OR'] = array(
962
-				'Event.EVT_name' => array( 'LIKE', $sstr),
963
-				'Event.EVT_desc' => array( 'LIKE', $sstr ),
964
-				'Event.EVT_short_desc' => array( 'LIKE' , $sstr ),
965
-				'Attendee.ATT_fname' => array( 'LIKE', $sstr ),
966
-				'Attendee.ATT_lname' => array( 'LIKE', $sstr ),
967
-				'Attendee.ATT_short_bio' => array( 'LIKE', $sstr ),
968
-				'Attendee.ATT_email' => array('LIKE', $sstr ),
969
-				'Attendee.ATT_address' => array( 'LIKE', $sstr ),
970
-				'Attendee.ATT_address2' => array( 'LIKE', $sstr ),
971
-				'Attendee.ATT_city' => array( 'LIKE', $sstr ),
972
-				'REG_final_price' => array( 'LIKE', $sstr ),
973
-				'REG_code' => array( 'LIKE', $sstr ),
974
-				'REG_count' => array( 'LIKE' , $sstr ),
975
-				'REG_group_size' => array( 'LIKE' , $sstr ),
976
-				'Ticket.TKT_name' => array( 'LIKE', $sstr ),
977
-				'Ticket.TKT_description' => array( 'LIKE', $sstr )
962
+				'Event.EVT_name' => array('LIKE', $sstr),
963
+				'Event.EVT_desc' => array('LIKE', $sstr),
964
+				'Event.EVT_short_desc' => array('LIKE', $sstr),
965
+				'Attendee.ATT_fname' => array('LIKE', $sstr),
966
+				'Attendee.ATT_lname' => array('LIKE', $sstr),
967
+				'Attendee.ATT_short_bio' => array('LIKE', $sstr),
968
+				'Attendee.ATT_email' => array('LIKE', $sstr),
969
+				'Attendee.ATT_address' => array('LIKE', $sstr),
970
+				'Attendee.ATT_address2' => array('LIKE', $sstr),
971
+				'Attendee.ATT_city' => array('LIKE', $sstr),
972
+				'REG_final_price' => array('LIKE', $sstr),
973
+				'REG_code' => array('LIKE', $sstr),
974
+				'REG_count' => array('LIKE', $sstr),
975
+				'REG_group_size' => array('LIKE', $sstr),
976
+				'Ticket.TKT_name' => array('LIKE', $sstr),
977
+				'Ticket.TKT_description' => array('LIKE', $sstr)
978 978
 				);
979 979
 		}
980 980
 
981 981
 		//capability checks
982
-		if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_registrations', 'get_registrations' ) ) {
982
+		if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_registrations', 'get_registrations')) {
983 983
 			$_where['AND'] = array(
984 984
 				'Event.EVT_wp_user' => get_current_user_id()
985 985
 				);
986 986
 		}
987 987
 
988 988
 
989
-		if( $count ){
990
-			if ( $trash ) {
991
-				return EEM_Registration::instance()->count_deleted( array( $_where ));
992
-			} else if ( $incomplete ) {
993
-				return EEM_Registration::instance()->count( array( $_where ));
989
+		if ($count) {
990
+			if ($trash) {
991
+				return EEM_Registration::instance()->count_deleted(array($_where));
992
+			} else if ($incomplete) {
993
+				return EEM_Registration::instance()->count(array($_where));
994 994
 			} else {
995
-				return EEM_Registration::instance()->count( array( $_where, 'default_where_conditions' => 'this_model_only' ));
995
+				return EEM_Registration::instance()->count(array($_where, 'default_where_conditions' => 'this_model_only'));
996 996
 			}
997 997
 		} else {
998 998
 			//make sure we remove default where conditions cause all registrations matching query are returned
999
-			$query_params = array( $_where, 'order_by' => array( $orderby => $sort ), 'default_where_conditions' => 'this_model_only' );
1000
-			if ( $per_page !== -1 ) {
999
+			$query_params = array($_where, 'order_by' => array($orderby => $sort), 'default_where_conditions' => 'this_model_only');
1000
+			if ($per_page !== -1) {
1001 1001
 				$query_params['limit'] = $limit;
1002 1002
 			}
1003
-			$registrations =  $trash ? EEM_Registration::instance()->get_all_deleted($query_params) : EEM_Registration::instance()->get_all($query_params);
1003
+			$registrations = $trash ? EEM_Registration::instance()->get_all_deleted($query_params) : EEM_Registration::instance()->get_all($query_params);
1004 1004
 
1005 1005
 
1006
-			if ( $EVT_ID && isset( $registrations[0] ) && $registrations[0] instanceof EE_Registration &&  $registrations[0]->event_obj()) {
1006
+			if ($EVT_ID && isset($registrations[0]) && $registrations[0] instanceof EE_Registration && $registrations[0]->event_obj()) {
1007 1007
 				$first_registration = $registrations[0];
1008 1008
 				//EEH_Debug_Tools::printr( $registrations[0], '$registrations  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
1009 1009
 				$event_name = $first_registration->event_obj()->name();
1010
-				$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 ) : '';
1010
+				$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 ) : '';
1011 1011
 				// edit event link
1012
-				if ( $event_name != '' ) {
1013
-					$edit_event_url = self::add_query_args_and_nonce( array( 'action'=>'edit_event', 'EVT_ID'=>$EVT_ID ), EVENTS_ADMIN_URL );
1014
-					$edit_event_lnk = '<a href="'.$edit_event_url.'" title="' . esc_attr__( 'Edit ', 'event_espresso' ) . $event_name . '">' . __( 'Edit Event', 'event_espresso' ) . '</a>';
1015
-					$event_name .= ' <span class="admin-page-header-edit-lnk not-bold">' . $edit_event_lnk . '</span>' ;
1012
+				if ($event_name != '') {
1013
+					$edit_event_url = self::add_query_args_and_nonce(array('action'=>'edit_event', 'EVT_ID'=>$EVT_ID), EVENTS_ADMIN_URL);
1014
+					$edit_event_lnk = '<a href="'.$edit_event_url.'" title="'.esc_attr__('Edit ', 'event_espresso').$event_name.'">'.__('Edit Event', 'event_espresso').'</a>';
1015
+					$event_name .= ' <span class="admin-page-header-edit-lnk not-bold">'.$edit_event_lnk.'</span>';
1016 1016
 				}
1017 1017
 
1018
-				$back_2_reg_url = self::add_query_args_and_nonce( array( 'action'=>'default' ), REG_ADMIN_URL );
1019
-				$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>';
1018
+				$back_2_reg_url = self::add_query_args_and_nonce(array('action'=>'default'), REG_ADMIN_URL);
1019
+				$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>';
1020 1020
 
1021 1021
 				$this->_template_args['before_admin_page_content'] = '
1022 1022
 			<div id="admin-page-header">
1023
-				<h1><span class="small-text not-bold">'.__( 'Event: ', 'event_espresso' ).'</span>'. $event_name .'</h1>
1024
-				<h3><span class="small-text not-bold">'.__( 'Date: ', 'event_espresso' ). '</span>'. $event_date .'</h3>
1025
-				<span class="admin-page-header-go-back-lnk not-bold">' . $back_2_reg_lnk . '</span>
1023
+				<h1><span class="small-text not-bold">'.__('Event: ', 'event_espresso').'</span>'.$event_name.'</h1>
1024
+				<h3><span class="small-text not-bold">'.__('Date: ', 'event_espresso').'</span>'.$event_date.'</h3>
1025
+				<span class="admin-page-header-go-back-lnk not-bold">' . $back_2_reg_lnk.'</span>
1026 1026
 			</div>
1027 1027
 			';
1028 1028
 
@@ -1060,7 +1060,7 @@  discard block
 block discarded – undo
1060 1060
 
1061 1061
 		$this->_set_registration_object();
1062 1062
 
1063
-		if ( is_object( $this->_registration )) {
1063
+		if (is_object($this->_registration)) {
1064 1064
 			$transaction = $this->_registration->transaction() ? $this->_registration->transaction() : EE_Transaction::new_instance();
1065 1065
 			$this->_session = $transaction->session_data();
1066 1066
 
@@ -1068,10 +1068,10 @@  discard block
 block discarded – undo
1068 1068
 
1069 1069
 
1070 1070
 			$this->_template_args['reg_nmbr']['value'] = $this->_registration->ID();
1071
-			$this->_template_args['reg_nmbr']['label'] = __( 'Registration Number', 'event_espresso' );
1071
+			$this->_template_args['reg_nmbr']['label'] = __('Registration Number', 'event_espresso');
1072 1072
 
1073
-			$this->_template_args['reg_datetime']['value'] =  $this->_registration->pretty_date('l F j, Y','g:i:s a') ;
1074
-			$this->_template_args['reg_datetime']['label'] = __( 'Date', 'event_espresso' );
1073
+			$this->_template_args['reg_datetime']['value'] = $this->_registration->pretty_date('l F j, Y', 'g:i:s a');
1074
+			$this->_template_args['reg_datetime']['label'] = __('Date', 'event_espresso');
1075 1075
 
1076 1076
 			$this->_template_args['grand_total'] = $transaction->total();
1077 1077
 
@@ -1079,19 +1079,19 @@  discard block
 block discarded – undo
1079 1079
 			// link back to overview
1080 1080
 			$this->_template_args['reg_overview_url'] = REG_ADMIN_URL;
1081 1081
 			$this->_template_args['registration'] = $this->_registration;
1082
-			$this->_template_args['filtered_registrations_link'] = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'default', 'event_id' => $event_id ), REG_ADMIN_URL );
1083
-			$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' ) );
1084
-			$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' ) );
1082
+			$this->_template_args['filtered_registrations_link'] = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'default', 'event_id' => $event_id), REG_ADMIN_URL);
1083
+			$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'));
1084
+			$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'));
1085 1085
 
1086 1086
 			//next and previous links
1087
-			$next_reg = $this->_registration->next(null, array(), 'REG_ID' );
1088
-			$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' ) : '';
1089
-			$previous_reg = $this->_registration->previous( null, array(), 'REG_ID' );
1090
-			$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' ) : '';
1087
+			$next_reg = $this->_registration->next(null, array(), 'REG_ID');
1088
+			$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') : '';
1089
+			$previous_reg = $this->_registration->previous(null, array(), 'REG_ID');
1090
+			$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') : '';
1091 1091
 
1092 1092
 			// grab header
1093
-			$template_path = REG_TEMPLATE_PATH . 'reg_admin_details_header.template.php';
1094
-			$this->_template_args['admin_page_header'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
1093
+			$template_path = REG_TEMPLATE_PATH.'reg_admin_details_header.template.php';
1094
+			$this->_template_args['admin_page_header'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE);
1095 1095
 
1096 1096
 		} else {
1097 1097
 
@@ -1112,14 +1112,14 @@  discard block
 block discarded – undo
1112 1112
 	protected function _registration_details_metaboxes() {
1113 1113
 		$this->_set_registration_object();
1114 1114
 		$attendee = $this->_registration instanceof EE_Registration ? $this->_registration->attendee() : null;
1115
-		add_meta_box( 'edit-reg-status-mbox', __( 'Registration Status', 'event_espresso' ), array( $this, 'set_reg_status_buttons_metabox' ), $this->wp_page_slug, 'normal', 'high' );
1116
-		add_meta_box( 'edit-reg-details-mbox', __( 'Registration Details', 'event_espresso' ), array( $this, '_reg_details_meta_box' ), $this->wp_page_slug, 'normal', 'high' );
1117
-		if ( $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can('ee_edit_registration', 'edit-reg-questions-mbox' ) ) {
1118
-			add_meta_box( 'edit-reg-questions-mbox', __( 'Registration Form Answers', 'event_espresso' ), array( $this, '_reg_questions_meta_box' ), $this->wp_page_slug, 'normal', 'high' );
1115
+		add_meta_box('edit-reg-status-mbox', __('Registration Status', 'event_espresso'), array($this, 'set_reg_status_buttons_metabox'), $this->wp_page_slug, 'normal', 'high');
1116
+		add_meta_box('edit-reg-details-mbox', __('Registration Details', 'event_espresso'), array($this, '_reg_details_meta_box'), $this->wp_page_slug, 'normal', 'high');
1117
+		if ($attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can('ee_edit_registration', 'edit-reg-questions-mbox')) {
1118
+			add_meta_box('edit-reg-questions-mbox', __('Registration Form Answers', 'event_espresso'), array($this, '_reg_questions_meta_box'), $this->wp_page_slug, 'normal', 'high');
1119 1119
 		}
1120
-		add_meta_box( 'edit-reg-registrant-mbox', __( 'Contact Details', 'event_espresso' ), array( $this, '_reg_registrant_side_meta_box' ), $this->wp_page_slug, 'side', 'high' );
1121
-		if ( $this->_registration->group_size() > 1 ) {
1122
-			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' );
1120
+		add_meta_box('edit-reg-registrant-mbox', __('Contact Details', 'event_espresso'), array($this, '_reg_registrant_side_meta_box'), $this->wp_page_slug, 'side', 'high');
1121
+		if ($this->_registration->group_size() > 1) {
1122
+			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');
1123 1123
 		}
1124 1124
 	}
1125 1125
 
@@ -1140,23 +1140,23 @@  discard block
 block discarded – undo
1140 1140
 
1141 1141
 		//let's get an array of all possible buttons that we can just reference
1142 1142
 		$status_buttons = $this->_get_reg_status_buttons();
1143
-		$template_args[ 'reg_status_value' ] = $this->_registration->pretty_status();
1144
-		$template_args[ 'reg_status_class' ] = 'status-' . $this->_registration->status_ID();
1143
+		$template_args['reg_status_value'] = $this->_registration->pretty_status();
1144
+		$template_args['reg_status_class'] = 'status-'.$this->_registration->status_ID();
1145 1145
 		$template_args['attendee'] = $this->_registration->attendee();
1146
-		$template = REG_TEMPLATE_PATH . 'reg_status_change_buttons.template.php';
1147
-		if ( $this->_set_registration_object() ) {
1146
+		$template = REG_TEMPLATE_PATH.'reg_status_change_buttons.template.php';
1147
+		if ($this->_set_registration_object()) {
1148 1148
 			$current_status = $this->_registration->status_ID();
1149
-			unset( $status_buttons[$current_status] );
1150
-			if ( $current_status != EEM_Registration::status_id_pending_payment && $is_complete ) {
1151
-				unset( $status_buttons[EEM_Registration::status_id_pending_payment] );
1149
+			unset($status_buttons[$current_status]);
1150
+			if ($current_status != EEM_Registration::status_id_pending_payment && $is_complete) {
1151
+				unset($status_buttons[EEM_Registration::status_id_pending_payment]);
1152 1152
 			}
1153
-			$template_args['status_buttons'] = implode( "\n", $status_buttons );
1153
+			$template_args['status_buttons'] = implode("\n", $status_buttons);
1154 1154
 		}
1155 1155
 		$template_args['form_url'] = REG_ADMIN_URL;
1156 1156
 		$template_args['REG_ID'] = $this->_registration->ID();
1157
-		$template_args['nonce'] = wp_nonce_field( 'change_reg_status_nonce',  'change_reg_status_nonce', FALSE, FALSE );
1157
+		$template_args['nonce'] = wp_nonce_field('change_reg_status_nonce', 'change_reg_status_nonce', FALSE, FALSE);
1158 1158
 
1159
-		EEH_Template::display_template( $template, $template_args );
1159
+		EEH_Template::display_template($template, $template_args);
1160 1160
 
1161 1161
 	}
1162 1162
 
@@ -1170,11 +1170,11 @@  discard block
 block discarded – undo
1170 1170
 	private function _get_reg_status_buttons() {
1171 1171
 
1172 1172
 		$buttons = array(
1173
-			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' ) . '">',
1174
-			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' ) . '">',
1175
-			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' ) . '">',
1176
-			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' ) . '">',
1177
-			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' ) . '">',
1173
+			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').'">',
1174
+			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').'">',
1175
+			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').'">',
1176
+			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').'">',
1177
+			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').'">',
1178 1178
 			);
1179 1179
 		return $buttons;
1180 1180
 	}
@@ -1188,13 +1188,13 @@  discard block
 block discarded – undo
1188 1188
 	 *
1189 1189
 	 * @return array  (array with reg_id(s) updated and whether update was successful.
1190 1190
 	 */
1191
-	protected function _set_registration_status_from_request( $status = false, $notify = false ) {
1192
-		$REG_ID = isset( $this->_req_data['_REG_ID'] ) ? (array) $this->_req_data['_REG_ID'] : array();
1191
+	protected function _set_registration_status_from_request($status = false, $notify = false) {
1192
+		$REG_ID = isset($this->_req_data['_REG_ID']) ? (array) $this->_req_data['_REG_ID'] : array();
1193 1193
 
1194
-		$success = $this->_set_registration_status( $REG_ID, $status );
1194
+		$success = $this->_set_registration_status($REG_ID, $status);
1195 1195
 
1196 1196
 		//notify?
1197
-		if ( $success && $notify && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_registrations_resend_registration' ) ) {
1197
+		if ($success && $notify && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_registrations_resend_registration')) {
1198 1198
 			$this->_process_resend_registration();
1199 1199
 		}
1200 1200
 
@@ -1212,19 +1212,19 @@  discard block
 block discarded – undo
1212 1212
 	 * @param bool $status
1213 1213
 	 * @return array (an array with 'success' key representing whether status change was successful, and 'REG_ID' as the array of updated registrations).
1214 1214
 	 */
1215
-	protected function _set_registration_status( $REG_ID, $status = false ) {
1215
+	protected function _set_registration_status($REG_ID, $status = false) {
1216 1216
 		$success = true;
1217 1217
 		// set default status if none is passed
1218 1218
 		$status = $status ? $status : EEM_Registration::status_id_pending_payment;
1219 1219
 
1220 1220
 		//typecast and sanitize reg_id
1221
-		$reg_ids = array_filter( (array) $REG_ID, 'absint' );
1221
+		$reg_ids = array_filter((array) $REG_ID, 'absint');
1222 1222
 
1223 1223
 		//loop through REG_ID's and change status
1224
-		foreach ( $reg_ids as $r_id ) {
1225
-			$registration = EEM_Registration::instance()->get_one_by_ID( $r_id );
1226
-			if ( $registration instanceof EE_Registration ) {
1227
-				$registration->set_status( $status );
1224
+		foreach ($reg_ids as $r_id) {
1225
+			$registration = EEM_Registration::instance()->get_one_by_ID($r_id);
1226
+			if ($registration instanceof EE_Registration) {
1227
+				$registration->set_status($status);
1228 1228
 				$result = $registration->save();
1229 1229
 
1230 1230
 				//verifying explicit fails because update *may* just return 0 for 0 rows affected
@@ -1236,7 +1236,7 @@  discard block
 block discarded – undo
1236 1236
 		$this->_req_data['_REG_ID'] = $reg_ids;
1237 1237
 
1238 1238
 		//return $success and processed registrations
1239
-		return array( 'REG_ID' => $reg_ids, 'success' => $success );
1239
+		return array('REG_ID' => $reg_ids, 'success' => $success);
1240 1240
 	}
1241 1241
 
1242 1242
 
@@ -1248,37 +1248,37 @@  discard block
 block discarded – undo
1248 1248
 	 * @param   bool    $notify indicates whether the _set_registration_status_from_request does notifications or not.
1249 1249
 	 * @return void
1250 1250
 	 */
1251
-	protected function _reg_status_change_return( $STS_ID, $notify = false ) {
1251
+	protected function _reg_status_change_return($STS_ID, $notify = false) {
1252 1252
 
1253
-		$result = ! empty( $STS_ID ) ? $this->_set_registration_status_from_request( $STS_ID, $notify ) : array( 'success' => false );
1253
+		$result = ! empty($STS_ID) ? $this->_set_registration_status_from_request($STS_ID, $notify) : array('success' => false);
1254 1254
 
1255 1255
 
1256
-		$success = isset( $result['success'] ) && $result['success'];
1256
+		$success = isset($result['success']) && $result['success'];
1257 1257
 
1258 1258
 		//setup success message
1259
-		if ( $success ) {
1260
-			$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' ) ) ;
1261
-			EE_Error::add_success( $msg );
1259
+		if ($success) {
1260
+			$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'));
1261
+			EE_Error::add_success($msg);
1262 1262
 		} else {
1263
-			EE_Error::add_error( __('Something went wrong, and the status was not changed', 'event_espresso' ), __FILE__, __LINE__, __FUNCTION__ );
1263
+			EE_Error::add_error(__('Something went wrong, and the status was not changed', 'event_espresso'), __FILE__, __LINE__, __FUNCTION__);
1264 1264
 		}
1265 1265
 
1266
-		$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' );
1266
+		$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');
1267 1267
 		//unset nonces
1268
-		foreach ( $this->_req_data as $ref => $value ) {
1269
-			if ( strpos( $ref, 'nonce' ) !== false ) {
1270
-				unset( $this->_req_data[$ref] );
1268
+		foreach ($this->_req_data as $ref => $value) {
1269
+			if (strpos($ref, 'nonce') !== false) {
1270
+				unset($this->_req_data[$ref]);
1271 1271
 				continue;
1272 1272
 			}
1273 1273
 
1274
-			$value = is_array( $value ) ? array_map( 'urlencode', $value ) : urlencode( $value );
1274
+			$value = is_array($value) ? array_map('urlencode', $value) : urlencode($value);
1275 1275
 			$this->_req_data[$ref] = $value;
1276 1276
 		}
1277 1277
 
1278 1278
 		//merge request vars so that the reloaded list table contains any existing filter query params
1279
-		$route = array_merge( $this->_req_data, $route );
1279
+		$route = array_merge($this->_req_data, $route);
1280 1280
 
1281
-		$this->_redirect_after_action( false, '', '', $route, true );
1281
+		$this->_redirect_after_action(false, '', '', $route, true);
1282 1282
 	}
1283 1283
 
1284 1284
 
@@ -1291,28 +1291,28 @@  discard block
 block discarded – undo
1291 1291
 		$this->_req_data['return'] = 'view_registration';
1292 1292
 
1293 1293
 		//set notify based on whether the send notifications toggle is set or not
1294
-		$notify = ! empty( $this->_req_data['txn_reg_status_change']['send_notifications'] );
1294
+		$notify = ! empty($this->_req_data['txn_reg_status_change']['send_notifications']);
1295 1295
 
1296
-		switch ( $this->_req_data['_reg_status_id'] ) {
1297
-			case EEH_Template::pretty_status( EEM_Registration::status_id_approved, false, 'sentence' ) :
1298
-				$this->approve_registration( $notify );
1296
+		switch ($this->_req_data['_reg_status_id']) {
1297
+			case EEH_Template::pretty_status(EEM_Registration::status_id_approved, false, 'sentence') :
1298
+				$this->approve_registration($notify);
1299 1299
 				break;
1300
-			case EEH_Template::pretty_status( EEM_Registration::status_id_pending_payment, false, 'sentence' ) :
1301
-				$this->pending_registration( $notify );
1300
+			case EEH_Template::pretty_status(EEM_Registration::status_id_pending_payment, false, 'sentence') :
1301
+				$this->pending_registration($notify);
1302 1302
 				break;
1303
-			case EEH_Template::pretty_status( EEM_Registration::status_id_not_approved, false, 'sentence' ) :
1304
-				$this->not_approve_registration( $notify );
1303
+			case EEH_Template::pretty_status(EEM_Registration::status_id_not_approved, false, 'sentence') :
1304
+				$this->not_approve_registration($notify);
1305 1305
 				break;
1306
-			case EEH_Template::pretty_status( EEM_Registration::status_id_declined, false, 'sentence' ) :
1307
-				$this->decline_registration( $notify );
1306
+			case EEH_Template::pretty_status(EEM_Registration::status_id_declined, false, 'sentence') :
1307
+				$this->decline_registration($notify);
1308 1308
 				break;
1309
-			case EEH_Template::pretty_status( EEM_Registration::status_id_cancelled, false, 'sentence' ) :
1310
-				$this->cancel_registration( $notify );
1309
+			case EEH_Template::pretty_status(EEM_Registration::status_id_cancelled, false, 'sentence') :
1310
+				$this->cancel_registration($notify);
1311 1311
 				break;
1312 1312
 			default :
1313 1313
 				$result['success'] = false;
1314
-				unset( $this->_req_data['return'] );
1315
-				$this->_reg_status_change_return( '', false );
1314
+				unset($this->_req_data['return']);
1315
+				$this->_reg_status_change_return('', false);
1316 1316
 				break;
1317 1317
 		}
1318 1318
 	}
@@ -1325,8 +1325,8 @@  discard block
 block discarded – undo
1325 1325
 	*		@param bool $notify whether or not to notify the registrant about their approval.
1326 1326
 	*		@return void
1327 1327
 	*/
1328
-	protected function approve_registration( $notify = false ) {
1329
-		$this->_reg_status_change_return( EEM_Registration::status_id_approved, $notify );
1328
+	protected function approve_registration($notify = false) {
1329
+		$this->_reg_status_change_return(EEM_Registration::status_id_approved, $notify);
1330 1330
 	}
1331 1331
 
1332 1332
 
@@ -1338,8 +1338,8 @@  discard block
 block discarded – undo
1338 1338
 	*		@param bool $notify whether or not to notify the registrant about their approval.
1339 1339
 	*		@return void
1340 1340
 	*/
1341
-	protected function decline_registration( $notify = false ) {
1342
-		$this->_reg_status_change_return( EEM_Registration::status_id_declined, $notify );
1341
+	protected function decline_registration($notify = false) {
1342
+		$this->_reg_status_change_return(EEM_Registration::status_id_declined, $notify);
1343 1343
 	}
1344 1344
 
1345 1345
 
@@ -1351,8 +1351,8 @@  discard block
 block discarded – undo
1351 1351
 	*		@param bool $notify whether or not to notify the registrant about their approval.
1352 1352
 	*		@return void
1353 1353
 	*/
1354
-	protected function cancel_registration( $notify = false ) {
1355
-		$this->_reg_status_change_return( EEM_Registration::status_id_cancelled, $notify );
1354
+	protected function cancel_registration($notify = false) {
1355
+		$this->_reg_status_change_return(EEM_Registration::status_id_cancelled, $notify);
1356 1356
 	}
1357 1357
 
1358 1358
 
@@ -1365,8 +1365,8 @@  discard block
 block discarded – undo
1365 1365
 	*		@param bool $notify whether or not to notify the registrant about their approval.
1366 1366
 	*		@return void
1367 1367
 	*/
1368
-	protected function not_approve_registration( $notify = false ) {
1369
-		$this->_reg_status_change_return( EEM_Registration::status_id_not_approved, $notify );
1368
+	protected function not_approve_registration($notify = false) {
1369
+		$this->_reg_status_change_return(EEM_Registration::status_id_not_approved, $notify);
1370 1370
 	}
1371 1371
 
1372 1372
 
@@ -1377,8 +1377,8 @@  discard block
 block discarded – undo
1377 1377
 	*		@param bool $notify whether or not to notify the registrant about their approval.
1378 1378
 	*		@return void
1379 1379
 	*/
1380
-	protected function pending_registration( $notify = false ) {
1381
-		$this->_reg_status_change_return( EEM_Registration::status_id_pending_payment, $notify );
1380
+	protected function pending_registration($notify = false) {
1381
+		$this->_reg_status_change_return(EEM_Registration::status_id_pending_payment, $notify);
1382 1382
 	}
1383 1383
 
1384 1384
 
@@ -1392,75 +1392,75 @@  discard block
 block discarded – undo
1392 1392
 	public function _reg_details_meta_box() {
1393 1393
 		EEH_Autoloader::register_line_item_display_autoloaders();
1394 1394
 		EEH_Autoloader::register_line_item_filter_autoloaders();
1395
-		EE_Registry::instance()->load_Helper( 'Line_Item' );
1395
+		EE_Registry::instance()->load_Helper('Line_Item');
1396 1396
 		$transaction = $this->_registration->transaction() ? $this->_registration->transaction() : EE_Transaction::new_instance();
1397 1397
 		$this->_session = $transaction->session_data();
1398 1398
 
1399 1399
 		$filters = new EE_Line_Item_Filter_Collection();
1400
-		$filters->add( new EE_Single_Registration_Line_Item_Filter( $this->_registration ) );
1401
-		$filters->add( new EE_Non_Zero_Line_Item_Filter() );
1402
-		$line_item_filter_processor = new EE_Line_Item_Filter_Processor( $filters, $transaction->total_line_item() );
1400
+		$filters->add(new EE_Single_Registration_Line_Item_Filter($this->_registration));
1401
+		$filters->add(new EE_Non_Zero_Line_Item_Filter());
1402
+		$line_item_filter_processor = new EE_Line_Item_Filter_Processor($filters, $transaction->total_line_item());
1403 1403
 		$filtered_line_item_tree = $line_item_filter_processor->process();
1404 1404
 
1405 1405
 		$this->_template_args['REG_ID'] = $this->_registration->ID();
1406
-		$line_item_display = new EE_Line_Item_Display( 'reg_admin_table', 'EE_Admin_Table_Registration_Line_Item_Display_Strategy' );
1407
-		$this->_template_args['line_item_table'] = $line_item_display->display_line_item( $filtered_line_item_tree, array( 'EE_Registration' => $this->_registration ) );
1406
+		$line_item_display = new EE_Line_Item_Display('reg_admin_table', 'EE_Admin_Table_Registration_Line_Item_Display_Strategy');
1407
+		$this->_template_args['line_item_table'] = $line_item_display->display_line_item($filtered_line_item_tree, array('EE_Registration' => $this->_registration));
1408 1408
 
1409 1409
 
1410 1410
 		$attendee = $this->_registration->attendee();
1411 1411
 
1412 1412
 
1413
-		$this->_template_args['view_transaction_button'] = EE_Registry::instance()->CAP->current_user_can( 'ee_read_transaction', 'espresso_transactions_view_transaction' ) ?EEH_Template::get_button_or_link( EE_Admin_Page::add_query_args_and_nonce( array('action'=> 'view_transaction', 'TXN_ID' => $transaction->ID() ), TXN_ADMIN_URL ), __(' View Transaction'), 'button secondary-button right', 'dashicons dashicons-cart' ) : '';
1414
-		$this->_template_args['resend_registration_button'] = $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_registrations_resend_registration' ) ?EEH_Template::get_button_or_link( EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'resend_registration', '_REG_ID'=>$this->_registration->ID(), 'redirect_to' => 'view_registration' ), REG_ADMIN_URL ), __(' Resend Registration'), 'button secondary-button right', 'dashicons dashicons-email-alt' ) : '';
1413
+		$this->_template_args['view_transaction_button'] = EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction') ? EEH_Template::get_button_or_link(EE_Admin_Page::add_query_args_and_nonce(array('action'=> 'view_transaction', 'TXN_ID' => $transaction->ID()), TXN_ADMIN_URL), __(' View Transaction'), 'button secondary-button right', 'dashicons dashicons-cart') : '';
1414
+		$this->_template_args['resend_registration_button'] = $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_registrations_resend_registration') ? EEH_Template::get_button_or_link(EE_Admin_Page::add_query_args_and_nonce(array('action'=>'resend_registration', '_REG_ID'=>$this->_registration->ID(), 'redirect_to' => 'view_registration'), REG_ADMIN_URL), __(' Resend Registration'), 'button secondary-button right', 'dashicons dashicons-email-alt') : '';
1415 1415
 
1416 1416
 
1417 1417
 		$this->_template_args['currency_sign'] = EE_Registry::instance()->CFG->currency->sign;
1418
-		$payment = $transaction->get_first_related( 'Payment' );
1418
+		$payment = $transaction->get_first_related('Payment');
1419 1419
 		$payment = ! $payment instanceof EE_Payment ? EE_Payment::new_instance() : $payment;
1420
-		$payment_method = $payment->get_first_related( 'Payment_Method' );
1420
+		$payment_method = $payment->get_first_related('Payment_Method');
1421 1421
 		$payment_method = ! $payment_method instanceof EE_Payment_Method ? EE_Payment_Method::new_instance() : $payment_method;
1422
-		$reg_status_class = 'status-' . $this->_registration->status_ID();
1422
+		$reg_status_class = 'status-'.$this->_registration->status_ID();
1423 1423
 		$reg_details = array(
1424 1424
 			'payment_method' => $payment_method->name(),
1425 1425
 			'response_msg' => $payment->gateway_response(),
1426
-			'registration_id' => $this->_registration->get( 'REG_code' ),
1426
+			'registration_id' => $this->_registration->get('REG_code'),
1427 1427
 			'registration_session' => $this->_registration->session_ID(),
1428
-			'ip_address' => isset( $this->_session['ip_address'] ) ? $this->_session['ip_address'] : '',
1429
-			'user_agent' => isset( $this->_session['user_agent'] ) ? $this->_session['user_agent'] : '',
1428
+			'ip_address' => isset($this->_session['ip_address']) ? $this->_session['ip_address'] : '',
1429
+			'user_agent' => isset($this->_session['user_agent']) ? $this->_session['user_agent'] : '',
1430 1430
 			);
1431 1431
 
1432 1432
 
1433
-		if ( isset( $reg_details['registration_id'] )) {
1433
+		if (isset($reg_details['registration_id'])) {
1434 1434
 			$this->_template_args['reg_details']['registration_id']['value'] = $reg_details['registration_id'];
1435
-			$this->_template_args['reg_details']['registration_id']['label'] = __( 'Registration ID', 'event_espresso' );
1435
+			$this->_template_args['reg_details']['registration_id']['label'] = __('Registration ID', 'event_espresso');
1436 1436
 			$this->_template_args['reg_details']['registration_id']['class'] = 'regular-text';
1437 1437
 		}
1438 1438
 
1439
-		if ( isset( $reg_details['payment_method'] ) ) {
1439
+		if (isset($reg_details['payment_method'])) {
1440 1440
 			$this->_template_args['reg_details']['payment_method']['value'] = $reg_details['payment_method'];
1441
-			$this->_template_args['reg_details']['payment_method']['label'] = __( 'Most Recent Payment Method', 'event_espresso' );
1441
+			$this->_template_args['reg_details']['payment_method']['label'] = __('Most Recent Payment Method', 'event_espresso');
1442 1442
 			$this->_template_args['reg_details']['payment_method']['class'] = 'regular-text';
1443 1443
 			$this->_template_args['reg_details']['response_msg']['value'] = $reg_details['response_msg'];
1444
-			$this->_template_args['reg_details']['response_msg']['label'] = __( 'Payment method response', 'event_espresso' );
1444
+			$this->_template_args['reg_details']['response_msg']['label'] = __('Payment method response', 'event_espresso');
1445 1445
 			$this->_template_args['reg_details']['response_msg']['class'] = 'regular-text';
1446 1446
 		}
1447 1447
 
1448 1448
 		$this->_template_args['reg_details']['registration_session']['value'] = $reg_details['registration_session'];
1449
-		$this->_template_args['reg_details']['registration_session']['label'] = __( 'Registration Session', 'event_espresso' );
1449
+		$this->_template_args['reg_details']['registration_session']['label'] = __('Registration Session', 'event_espresso');
1450 1450
 		$this->_template_args['reg_details']['registration_session']['class'] = 'regular-text';
1451 1451
 
1452 1452
 		$this->_template_args['reg_details']['ip_address']['value'] = $reg_details['ip_address'];
1453
-		$this->_template_args['reg_details']['ip_address']['label'] = __( 'Registration placed from IP', 'event_espresso' );
1453
+		$this->_template_args['reg_details']['ip_address']['label'] = __('Registration placed from IP', 'event_espresso');
1454 1454
 		$this->_template_args['reg_details']['ip_address']['class'] = 'regular-text';
1455 1455
 
1456 1456
 		$this->_template_args['reg_details']['user_agent']['value'] = $reg_details['user_agent'];
1457
-		$this->_template_args['reg_details']['user_agent']['label'] = __( 'Registrant User Agent', 'event_espresso' );
1457
+		$this->_template_args['reg_details']['user_agent']['label'] = __('Registrant User Agent', 'event_espresso');
1458 1458
 		$this->_template_args['reg_details']['user_agent']['class'] = 'large-text';
1459 1459
 
1460
-		$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 );
1460
+		$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);
1461 1461
 
1462
-		$template_path = REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_reg_details.template.php';
1463
-		echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
1462
+		$template_path = REG_TEMPLATE_PATH.'reg_admin_details_main_meta_box_reg_details.template.php';
1463
+		echo EEH_Template::display_template($template_path, $this->_template_args, TRUE);
1464 1464
 
1465 1465
 	}
1466 1466
 
@@ -1476,23 +1476,23 @@  discard block
 block discarded – undo
1476 1476
 	*/
1477 1477
 	public function _reg_questions_meta_box() {
1478 1478
 
1479
-		add_filter( 'FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions', array( $this, 'form_before_question_group' ), 10, 1 );
1480
-		add_filter( 'FHEE__EEH_Form_Fields__generate_question_groups_html__after_question_group_questions', array( $this, 'form_after_question_group' ), 10, 1 );
1481
-		add_filter( 'FHEE__EEH_Form_Fields__label_html', array( $this, 'form_form_field_label_wrap' ), 10, 1 );
1482
-		add_filter( 'FHEE__EEH_Form_Fields__input_html', array( $this, 'form_form_field_input__wrap' ), 10, 1 );
1479
+		add_filter('FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions', array($this, 'form_before_question_group'), 10, 1);
1480
+		add_filter('FHEE__EEH_Form_Fields__generate_question_groups_html__after_question_group_questions', array($this, 'form_after_question_group'), 10, 1);
1481
+		add_filter('FHEE__EEH_Form_Fields__label_html', array($this, 'form_form_field_label_wrap'), 10, 1);
1482
+		add_filter('FHEE__EEH_Form_Fields__input_html', array($this, 'form_form_field_input__wrap'), 10, 1);
1483 1483
 
1484
-		$question_groups = EEM_Event::instance()->assemble_array_of_groups_questions_and_options( $this->_registration, $this->_registration->get('EVT_ID') );
1484
+		$question_groups = EEM_Event::instance()->assemble_array_of_groups_questions_and_options($this->_registration, $this->_registration->get('EVT_ID'));
1485 1485
 
1486 1486
 		//EEH_Debug_Tools::printr( $question_groups, '$question_groups  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
1487 1487
 
1488
-		EE_Registry::instance()->load_helper( 'Form_Fields' );
1489
-		$this->_template_args['att_questions'] = EEH_Form_Fields::generate_question_groups_html( $question_groups );
1488
+		EE_Registry::instance()->load_helper('Form_Fields');
1489
+		$this->_template_args['att_questions'] = EEH_Form_Fields::generate_question_groups_html($question_groups);
1490 1490
 
1491 1491
 		$this->_template_args['reg_questions_form_action'] = 'update_attendee_registration_form';
1492 1492
 		$this->_template_args['REG_ID'] = $this->_registration->ID();
1493 1493
 
1494
-		$template_path = REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_reg_questions.template.php';
1495
-		echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
1494
+		$template_path = REG_TEMPLATE_PATH.'reg_admin_details_main_meta_box_reg_questions.template.php';
1495
+		echo EEH_Template::display_template($template_path, $this->_template_args, TRUE);
1496 1496
 
1497 1497
 	}
1498 1498
 
@@ -1507,7 +1507,7 @@  discard block
 block discarded – undo
1507 1507
 	 * 		@param 		string 		$output
1508 1508
 	 * 		@return 		string
1509 1509
 	 */
1510
-	public function form_before_question_group( $output ) {
1510
+	public function form_before_question_group($output) {
1511 1511
 		return '
1512 1512
 	<table class="form-table ee-width-100">
1513 1513
 		<tbody>
@@ -1524,13 +1524,13 @@  discard block
 block discarded – undo
1524 1524
 	 * 		@param 		string 		$output
1525 1525
 	 * 		@return 		string
1526 1526
 	 */
1527
-	public function form_after_question_group( $output ) {
1527
+	public function form_after_question_group($output) {
1528 1528
 		return  '
1529 1529
 			<tr class="hide-if-no-js">
1530 1530
 				<th> </th>
1531 1531
 				<td class="reg-admin-edit-attendee-question-td">
1532
-					<a class="reg-admin-edit-attendee-question-lnk" href="#" title="' . esc_attr__( 'click to edit question', 'event_espresso' ) . '">
1533
-						<span class="reg-admin-edit-question-group-spn lt-grey-txt">' . __( 'edit the above question group', 'event_espresso' ) . '</span>
1532
+					<a class="reg-admin-edit-attendee-question-lnk" href="#" title="' . esc_attr__('click to edit question', 'event_espresso').'">
1533
+						<span class="reg-admin-edit-question-group-spn lt-grey-txt">' . __('edit the above question group', 'event_espresso').'</span>
1534 1534
 						<div class="dashicons dashicons-edit"></div>
1535 1535
 					</a>
1536 1536
 				</td>
@@ -1550,11 +1550,11 @@  discard block
 block discarded – undo
1550 1550
 	 * 		@param 		string 		$label
1551 1551
 	 * 		@return 		string
1552 1552
 	 */
1553
-	public function form_form_field_label_wrap( $label ) {
1553
+	public function form_form_field_label_wrap($label) {
1554 1554
 		return '
1555 1555
 			<tr>
1556 1556
 				<th>
1557
-					' . $label  . '
1557
+					' . $label.'
1558 1558
 				</th>';
1559 1559
 	}
1560 1560
 
@@ -1568,10 +1568,10 @@  discard block
 block discarded – undo
1568 1568
 	 * 		@param 		string 		$label
1569 1569
 	 * 		@return 		string
1570 1570
 	 */
1571
-	public function form_form_field_input__wrap( $input ) {
1571
+	public function form_form_field_input__wrap($input) {
1572 1572
 		return '
1573 1573
 				<td class="reg-admin-attendee-questions-input-td disabled-input">
1574
-					' . $input . '
1574
+					' . $input.'
1575 1575
 				</td>
1576 1576
 			</tr>';
1577 1577
 	}
@@ -1585,13 +1585,13 @@  discard block
 block discarded – undo
1585 1585
 	*		@return void
1586 1586
 	*/
1587 1587
 	protected function _update_attendee_registration_form() {
1588
-		$qstns = isset( $this->_req_data['qstn'] ) ? $this->_req_data['qstn'] : FALSE;
1589
-		$REG_ID = isset( $this->_req_data['_REG_ID'] ) ? absint( $this->_req_data['_REG_ID'] ) : FALSE;
1590
-		$qstns = apply_filters( 'FHEE__Registrations_Admin_Page___update_attendee_registration_form__qstns', $qstns );
1591
-		$success = $this->_save_attendee_registration_form( $REG_ID, $qstns );
1588
+		$qstns = isset($this->_req_data['qstn']) ? $this->_req_data['qstn'] : FALSE;
1589
+		$REG_ID = isset($this->_req_data['_REG_ID']) ? absint($this->_req_data['_REG_ID']) : FALSE;
1590
+		$qstns = apply_filters('FHEE__Registrations_Admin_Page___update_attendee_registration_form__qstns', $qstns);
1591
+		$success = $this->_save_attendee_registration_form($REG_ID, $qstns);
1592 1592
 		$what = __('Registration Form', 'event_espresso');
1593
-		$route = $REG_ID ? array( 'action' => 'view_registration', '_REG_ID' => $REG_ID ) : array( 'action' => 'default' );
1594
-		$this->_redirect_after_action( $success, $what, __('updated', 'event_espresso'), $route );
1593
+		$route = $REG_ID ? array('action' => 'view_registration', '_REG_ID' => $REG_ID) : array('action' => 'default');
1594
+		$this->_redirect_after_action($success, $what, __('updated', 'event_espresso'), $route);
1595 1595
 
1596 1596
 	}
1597 1597
 
@@ -1604,26 +1604,26 @@  discard block
 block discarded – undo
1604 1604
 	 * @param bool $qstns
1605 1605
 	 * @return bool
1606 1606
 	 */
1607
-	private function _save_attendee_registration_form( $REG_ID = FALSE, $qstns = FALSE ) {
1607
+	private function _save_attendee_registration_form($REG_ID = FALSE, $qstns = FALSE) {
1608 1608
 
1609
-		if ( ! $REG_ID || ! $qstns ) {
1610
-			EE_Error::add_error( __('An error occurred. No registration ID and/or registration questions were received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
1609
+		if ( ! $REG_ID || ! $qstns) {
1610
+			EE_Error::add_error(__('An error occurred. No registration ID and/or registration questions were received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1611 1611
 		}
1612 1612
 		$success = TRUE;
1613 1613
 
1614 1614
 		// allow others to get in on this awesome fun   :D
1615
-		do_action( 'AHEE__Registrations_Admin_Page___save_attendee_registration_form__after_reg_and_attendee_save', $REG_ID, $qstns );
1615
+		do_action('AHEE__Registrations_Admin_Page___save_attendee_registration_form__after_reg_and_attendee_save', $REG_ID, $qstns);
1616 1616
 		// loop thru questions... FINALLY!!!
1617 1617
 
1618
-		foreach ( $qstns as $QST_ID => $qstn ) {
1618
+		foreach ($qstns as $QST_ID => $qstn) {
1619 1619
 			//if $qstn isn't an array then it doesn't already have an answer, so let's create the answer
1620
-			if ( !is_array($qstn) ) {
1621
-				$success = $this->_save_new_answer( $REG_ID, $QST_ID, $qstn);
1620
+			if ( ! is_array($qstn)) {
1621
+				$success = $this->_save_new_answer($REG_ID, $QST_ID, $qstn);
1622 1622
 				continue;
1623 1623
 			}
1624 1624
 
1625 1625
 
1626
-			foreach ( $qstn as $ANS_ID => $ANS_value ) {
1626
+			foreach ($qstn as $ANS_ID => $ANS_value) {
1627 1627
 				//get answer
1628 1628
 				$query_params = array(
1629 1629
 					0 => array(
@@ -1634,8 +1634,8 @@  discard block
 block discarded – undo
1634 1634
 					);
1635 1635
 				$answer = EEM_Answer::instance()->get_one($query_params);
1636 1636
 				//this MAY be an array but NOT have an answer because its multi select.  If so then we need to create the answer
1637
-				if ( ! $answer instanceof EE_Answer ) {
1638
-					$success = $this->_save_new_answer( $REG_ID, $QST_ID, $qstn);
1637
+				if ( ! $answer instanceof EE_Answer) {
1638
+					$success = $this->_save_new_answer($REG_ID, $QST_ID, $qstn);
1639 1639
 					continue 2;
1640 1640
 				}
1641 1641
 
@@ -1649,7 +1649,7 @@  discard block
 block discarded – undo
1649 1649
 
1650 1650
 
1651 1651
 	//TODO: try changing this to use the model directly... not indirectly through creating a default object...
1652
-	private function _save_new_answer( $REG_ID, $QST_ID, $ans ) {
1652
+	private function _save_new_answer($REG_ID, $QST_ID, $ans) {
1653 1653
 		$set_values = array(
1654 1654
 			'QST_ID' => $QST_ID,
1655 1655
 			'REG_ID' => $REG_ID,
@@ -1676,30 +1676,30 @@  discard block
 block discarded – undo
1676 1676
 		$registrations = $REG->get_all(array(
1677 1677
 			array(
1678 1678
 				'TXN_ID'=>$this->_registration->transaction_ID(),
1679
-				'REG_ID'=>array('!=',$this->_registration->ID())
1679
+				'REG_ID'=>array('!=', $this->_registration->ID())
1680 1680
 			),
1681 1681
 			'force_join'=>array('Attendee')));
1682 1682
 
1683 1683
 		$this->_template_args['attendees'] = array();
1684 1684
 		$this->_template_args['attendee_notice'] = '';
1685 1685
 		EE_Registry::instance()->load_helper('Array');
1686
-		if ( empty( $registrations)  || ( is_array($registrations) &&  ! EEH_Array::get_one_item_from_array($registrations) ) ) {
1687
-			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__ );
1686
+		if (empty($registrations) || (is_array($registrations) && ! EEH_Array::get_one_item_from_array($registrations))) {
1687
+			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__);
1688 1688
 			$this->_template_args['attendee_notice'] = EE_Error::get_notices();
1689 1689
 		} else {
1690 1690
 
1691 1691
 			$att_nmbr = 1;
1692
-			foreach ( $registrations as $registration ) {
1692
+			foreach ($registrations as $registration) {
1693 1693
 				/* @var $registration EE_Registration */
1694 1694
 				$attendee = $registration->attendee() ? $registration->attendee() : EEM_Attendee::instance()->create_default_object();
1695
-				$this->_template_args['attendees'][ $att_nmbr ]['fname'] = $attendee->fname();//( isset( $registration->ATT_fname ) & ! empty( $registration->ATT_fname ) ) ? $registration->ATT_fname : '';
1696
-				$this->_template_args['attendees'][ $att_nmbr ]['lname'] = $attendee->lname();//( isset( $registration->ATT_lname ) & ! empty( $registration->ATT_lname ) ) ? $registration->ATT_lname : '';
1697
-				$this->_template_args['attendees'][ $att_nmbr ]['email'] = $attendee->email();//( isset( $registration->ATT_email ) & ! empty( $registration->ATT_email ) ) ? $registration->ATT_email : '';
1698
-				$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 : '';
1695
+				$this->_template_args['attendees'][$att_nmbr]['fname'] = $attendee->fname(); //( isset( $registration->ATT_fname ) & ! empty( $registration->ATT_fname ) ) ? $registration->ATT_fname : '';
1696
+				$this->_template_args['attendees'][$att_nmbr]['lname'] = $attendee->lname(); //( isset( $registration->ATT_lname ) & ! empty( $registration->ATT_lname ) ) ? $registration->ATT_lname : '';
1697
+				$this->_template_args['attendees'][$att_nmbr]['email'] = $attendee->email(); //( isset( $registration->ATT_email ) & ! empty( $registration->ATT_email ) ) ? $registration->ATT_email : '';
1698
+				$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 : '';
1699 1699
 
1700
-				$this->_template_args['attendees'][ $att_nmbr ]['address'] = implode( ', ', $attendee->full_address_as_array() );
1700
+				$this->_template_args['attendees'][$att_nmbr]['address'] = implode(', ', $attendee->full_address_as_array());
1701 1701
 
1702
-				$this->_template_args['attendees'][ $att_nmbr ]['att_link'] = self::add_query_args_and_nonce( array( 'action'=>'edit_attendee', 'post'=>$attendee->ID() ), REG_ADMIN_URL );
1702
+				$this->_template_args['attendees'][$att_nmbr]['att_link'] = self::add_query_args_and_nonce(array('action'=>'edit_attendee', 'post'=>$attendee->ID()), REG_ADMIN_URL);
1703 1703
 
1704 1704
 				$att_nmbr++;
1705 1705
 			}
@@ -1711,8 +1711,8 @@  discard block
 block discarded – undo
1711 1711
 
1712 1712
 	//			$this->_template_args['registration_form_url'] = add_query_arg( array( 'action' => 'edit_registration', 'process' => 'attendees'  ), REG_ADMIN_URL );
1713 1713
 		}
1714
-		$template_path = REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_attendees.template.php';
1715
-		echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
1714
+		$template_path = REG_TEMPLATE_PATH.'reg_admin_details_main_meta_box_attendees.template.php';
1715
+		echo EEH_Template::display_template($template_path, $this->_template_args, TRUE);
1716 1716
 
1717 1717
 	}
1718 1718
 
@@ -1733,11 +1733,11 @@  discard block
 block discarded – undo
1733 1733
 		$attendee = $att_check instanceof EE_Attendee ? $att_check : EEM_Attendee::instance()->create_default_object();
1734 1734
 
1735 1735
 		//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)
1736
-		if ( ! $this->_registration->is_primary_registrant() ) {
1736
+		if ( ! $this->_registration->is_primary_registrant()) {
1737 1737
 			$primary_registration = $this->_registration->get_primary_registration();
1738 1738
 			$primary_attendee = $primary_registration->attendee();
1739 1739
 
1740
-			if ( ! $primary_attendee instanceof EE_Attendee || $attendee->ID() !== $primary_attendee->ID() ) {
1740
+			if ( ! $primary_attendee instanceof EE_Attendee || $attendee->ID() !== $primary_attendee->ID()) {
1741 1741
 				//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.
1742 1742
 				$primary_registration = NULL;
1743 1743
 			}
@@ -1746,28 +1746,28 @@  discard block
 block discarded – undo
1746 1746
 		}
1747 1747
 
1748 1748
 		$this->_template_args['ATT_ID'] = $attendee->ID();
1749
-		$this->_template_args['fname'] = $attendee->fname();//$this->_registration->ATT_fname;
1750
-		$this->_template_args['lname'] = $attendee->lname();//$this->_registration->ATT_lname;
1751
-		$this->_template_args['email'] = $attendee->email();//$this->_registration->ATT_email;
1749
+		$this->_template_args['fname'] = $attendee->fname(); //$this->_registration->ATT_fname;
1750
+		$this->_template_args['lname'] = $attendee->lname(); //$this->_registration->ATT_lname;
1751
+		$this->_template_args['email'] = $attendee->email(); //$this->_registration->ATT_email;
1752 1752
 		$this->_template_args['phone'] = $attendee->phone();
1753 1753
 
1754
-		EE_Registry::instance()->load_helper( 'Formatter' );
1755
-		$this->_template_args[ 'formatted_address' ] = EEH_Address::format( $attendee );
1754
+		EE_Registry::instance()->load_helper('Formatter');
1755
+		$this->_template_args['formatted_address'] = EEH_Address::format($attendee);
1756 1756
 
1757 1757
 
1758 1758
 		//edit link
1759
-		$this->_template_args['att_edit_link'] = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'edit_attendee', 'post'=>$attendee->ID() ), REG_ADMIN_URL );
1760
-		$this->_template_args['att_edit_label'] = __('View/Edit Contact' );
1759
+		$this->_template_args['att_edit_link'] = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'edit_attendee', 'post'=>$attendee->ID()), REG_ADMIN_URL);
1760
+		$this->_template_args['att_edit_label'] = __('View/Edit Contact');
1761 1761
 
1762 1762
 		//create link
1763
-		$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 ): '';
1763
+		$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) : '';
1764 1764
 		$this->_template_args['create_label'] = __('Create Contact', 'event_espresso');
1765 1765
 
1766 1766
 		$this->_template_args['att_check'] = $att_check;
1767 1767
 
1768 1768
 
1769
-		$template_path = REG_TEMPLATE_PATH . 'reg_admin_details_side_meta_box_registrant.template.php';
1770
-		echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
1769
+		$template_path = REG_TEMPLATE_PATH.'reg_admin_details_side_meta_box_registrant.template.php';
1770
+		echo EEH_Template::display_template($template_path, $this->_template_args, TRUE);
1771 1771
 	}
1772 1772
 
1773 1773
 
@@ -1780,7 +1780,7 @@  discard block
 block discarded – undo
1780 1780
 	 * @access protected
1781 1781
 	 * @return void
1782 1782
 	 */
1783
-	protected function _trash_or_restore_registrations( $trash = TRUE ) {
1783
+	protected function _trash_or_restore_registrations($trash = TRUE) {
1784 1784
 		$REGM = EEM_Registration::instance();
1785 1785
 
1786 1786
 		$success = 1;
@@ -1790,26 +1790,26 @@  discard block
 block discarded – undo
1790 1790
 		$dtts = array();
1791 1791
 
1792 1792
 		//if empty _REG_ID then get out because there's nothing to do
1793
-		if ( empty( $this->_req_data['_REG_ID'] ) ) {
1793
+		if (empty($this->_req_data['_REG_ID'])) {
1794 1794
 			$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');
1795
-			EE_Error::add_error( $msg, __FILE__, __LINE__, __FUNCTION__ );
1796
-			$this->_redirect_after_action(FALSE, '', '', array(), TRUE );
1795
+			EE_Error::add_error($msg, __FILE__, __LINE__, __FUNCTION__);
1796
+			$this->_redirect_after_action(FALSE, '', '', array(), TRUE);
1797 1797
 		}
1798 1798
 
1799 1799
 		//Checkboxes
1800
-		if (!empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) {
1800
+		if ( ! empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) {
1801 1801
 			// if array has more than one element than success message should be plural
1802
-			$success = count( $this->_req_data['_REG_ID'] ) > 1 ? 2 : 1;
1802
+			$success = count($this->_req_data['_REG_ID']) > 1 ? 2 : 1;
1803 1803
 			// cycle thru checkboxes
1804
-			while (list( $ind, $REG_ID ) = each($this->_req_data['_REG_ID'])) {
1804
+			while (list($ind, $REG_ID) = each($this->_req_data['_REG_ID'])) {
1805 1805
 
1806 1806
 				$REG = $REGM->get_one_by_ID($REG_ID);
1807 1807
 				$payment_count = $REG->get_first_related('Transaction')->count_related('Payment');
1808
-				if ( $payment_count > 0 ) {
1808
+				if ($payment_count > 0) {
1809 1809
 					$name = $REG->attendee()->full_name();
1810 1810
 					$error = 1;
1811 1811
 					$success = 0;
1812
-					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__ );
1812
+					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__);
1813 1813
 					continue; //can't trash this registration because it has payments.
1814 1814
 				}
1815 1815
 				$ticket = $REG->get_first_related('Ticket');
@@ -1818,7 +1818,7 @@  discard block
 block discarded – undo
1818 1818
 				$dtts = array_merge($dtts, $dtt);
1819 1819
 
1820 1820
 				$updated = $trash ? $REG->delete() : $REG->restore();
1821
-				if ( !$updated ) {
1821
+				if ( ! $updated) {
1822 1822
 					$success = 0;
1823 1823
 				} else {
1824 1824
 					$success = 2;
@@ -1833,7 +1833,7 @@  discard block
 block discarded – undo
1833 1833
 			$tickets[$ticket->ID()] = $ticket;
1834 1834
 			$dtts = $ticket->get_many_related('Datetime');
1835 1835
 			$updated = $trash ? $REG->delete() : $REG->restore();
1836
-			if ( ! $updated ) {
1836
+			if ( ! $updated) {
1837 1837
 				$success = 0;
1838 1838
 			}
1839 1839
 
@@ -1843,10 +1843,10 @@  discard block
 block discarded – undo
1843 1843
 		EEM_Ticket::instance()->update_tickets_sold($tickets);
1844 1844
 		EEM_Datetime::instance()->update_sold($dtts);
1845 1845
 
1846
-		$what = $success > 1 ? __( 'Registrations', 'event_espresso' ) : __( 'Registration', 'event_espresso' );
1847
-		$action_desc = $trash ? __( 'moved to the trash', 'event_espresso' ) : __( 'restored', 'event_espresso' );
1846
+		$what = $success > 1 ? __('Registrations', 'event_espresso') : __('Registration', 'event_espresso');
1847
+		$action_desc = $trash ? __('moved to the trash', 'event_espresso') : __('restored', 'event_espresso');
1848 1848
 		$overwrite_msgs = $error ? TRUE : FALSE;
1849
-		$this->_redirect_after_action( $success, $what, $action_desc, array( 'action' => 'default' ), $overwrite_msgs );
1849
+		$this->_redirect_after_action($success, $what, $action_desc, array('action' => 'default'), $overwrite_msgs);
1850 1850
 	}
1851 1851
 
1852 1852
 
@@ -1870,16 +1870,16 @@  discard block
 block discarded – undo
1870 1870
 		$success = 1;
1871 1871
 
1872 1872
 		//Checkboxes
1873
-		if (!empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) {
1873
+		if ( ! empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) {
1874 1874
 			// if array has more than one element than success message should be plural
1875
-			$success = count( $this->_req_data['_REG_ID'] ) > 1 ? 2 : 1;
1875
+			$success = count($this->_req_data['_REG_ID']) > 1 ? 2 : 1;
1876 1876
 			// cycle thru checkboxes
1877
-			while (list( $ind, $REG_ID ) = each($this->_req_data['_REG_ID'])) {
1877
+			while (list($ind, $REG_ID) = each($this->_req_data['_REG_ID'])) {
1878 1878
 				$REG = $REG_MDL->get_one_by_ID($REG_ID);
1879
-				if ( ! $REG instanceof EE_Registration )
1879
+				if ( ! $REG instanceof EE_Registration)
1880 1880
 					continue;
1881 1881
 				$deleted = $this->_delete_registration($REG);
1882
-				if ( !$deleted ) {
1882
+				if ( ! $deleted) {
1883 1883
 					$success = 0;
1884 1884
 				}
1885 1885
 			}
@@ -1889,15 +1889,15 @@  discard block
 block discarded – undo
1889 1889
 			$REG_ID = $this->_req_data['_REG_ID'];
1890 1890
 			$REG = $REG_MDL->get_one_by_ID($REG_ID);
1891 1891
 			$deleted = $this->_delete_registration($REG);
1892
-			if ( ! $deleted ) {
1892
+			if ( ! $deleted) {
1893 1893
 				$success = 0;
1894 1894
 			}
1895 1895
 
1896 1896
 		}
1897 1897
 
1898
-		$what = $success > 1 ? __( 'Registrations', 'event_espresso' ) : __( 'Registration', 'event_espresso' );
1899
-		$action_desc = __( 'permanently deleted.', 'event_espresso' );
1900
-		$this->_redirect_after_action( $success, $what, $action_desc, array( 'action' => 'default' ), TRUE );
1898
+		$what = $success > 1 ? __('Registrations', 'event_espresso') : __('Registration', 'event_espresso');
1899
+		$action_desc = __('permanently deleted.', 'event_espresso');
1900
+		$this->_redirect_after_action($success, $what, $action_desc, array('action' => 'default'), TRUE);
1901 1901
 	}
1902 1902
 
1903 1903
 
@@ -1909,31 +1909,31 @@  discard block
 block discarded – undo
1909 1909
 	 * @param  EE_Registration $REG registration to be deleted permenantly
1910 1910
 	 * @return boolean              true = successful deletion, false = fail.
1911 1911
 	 */
1912
-	protected function _delete_registration( EE_Registration $REG ) {
1912
+	protected function _delete_registration(EE_Registration $REG) {
1913 1913
 		//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.
1914 1914
 		$TXN = $REG->get_first_related('Transaction');
1915 1915
 		$REGS = $TXN->get_many_related('Registration');
1916 1916
 
1917 1917
 		$all_trashed = TRUE;
1918
-		foreach ( $REGS as $registration ) {
1919
-			if ( ! $registration->get('REG_deleted') )
1918
+		foreach ($REGS as $registration) {
1919
+			if ( ! $registration->get('REG_deleted'))
1920 1920
 				$all_trashed = FALSE;
1921 1921
 		}
1922 1922
 
1923
-		if ( ! $all_trashed ) {
1924
-			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__ );
1923
+		if ( ! $all_trashed) {
1924
+			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__);
1925 1925
 			return false;
1926 1926
 		}
1927 1927
 
1928 1928
 		//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).
1929
-		foreach ( $REGS as $registration ) {
1929
+		foreach ($REGS as $registration) {
1930 1930
 
1931 1931
 			//delete related answers
1932 1932
 			$registration->delete_related_permanently('Answer');
1933 1933
 
1934 1934
 			//remove relationship to EE_Attendee (but we ALWAYS leave the contact record intact)
1935 1935
 			$attendee = $registration->get_first_related('Attendee');
1936
-			if ( $attendee instanceof EE_Attendee ) {
1936
+			if ($attendee instanceof EE_Attendee) {
1937 1937
 				$registration->_remove_relation_to($attendee, 'Attendee');
1938 1938
 			}
1939 1939
 
@@ -1943,7 +1943,7 @@  discard block
 block discarded – undo
1943 1943
 			//now delete permanently the checkins related to this registration.
1944 1944
 			$registration->delete_related_permanently('Checkin');
1945 1945
 
1946
-			if ( $registration->ID() === $REG->ID() )
1946
+			if ($registration->ID() === $REG->ID())
1947 1947
 				continue; //we don't want to delete permanently the existing registration just yet.
1948 1948
 
1949 1949
 			//remove relation to transaction for these registrations if NOT the existing registrations
@@ -1976,34 +1976,34 @@  discard block
 block discarded – undo
1976 1976
 	 * @return void
1977 1977
 	 */
1978 1978
 	public function new_registration() {
1979
-		if ( ! $this->_set_reg_event() ) {
1980
-			throw new EE_Error(__('Unable to continue with registering because there is no Event ID in the request', 'event_espresso') );
1979
+		if ( ! $this->_set_reg_event()) {
1980
+			throw new EE_Error(__('Unable to continue with registering because there is no Event ID in the request', 'event_espresso'));
1981 1981
 		}
1982
-		EE_Registry::instance()->REQ->set_espresso_page( TRUE );
1982
+		EE_Registry::instance()->REQ->set_espresso_page(TRUE);
1983 1983
 
1984 1984
 		// gotta start with a clean slate if we're not coming here via ajax
1985
-		if ( ! defined('DOING_AJAX' ) && ( ! isset( $this->_req_data['processing_registration'] ) || isset( $this->_req_data['step_error'] ))) {
1986
-			EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ );
1985
+		if ( ! defined('DOING_AJAX') && ( ! isset($this->_req_data['processing_registration']) || isset($this->_req_data['step_error']))) {
1986
+			EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__);
1987 1987
 		}
1988 1988
 
1989
-		$this->_template_args['event_name'] = '' ;
1989
+		$this->_template_args['event_name'] = '';
1990 1990
 		// event name
1991
-		if ( $this->_reg_event ) {
1991
+		if ($this->_reg_event) {
1992 1992
 			$this->_template_args['event_name'] = $this->_reg_event->name();
1993
-			$edit_event_url = self::add_query_args_and_nonce( array( 'action'=>'edit', 'post'=>$this->_reg_event->ID() ), EVENTS_ADMIN_URL );
1994
-			$edit_event_lnk = '<a href="'.$edit_event_url.'" title="' . esc_attr__( 'Edit ', 'event_espresso' ) . $this->_reg_event->name() . '">' . __( 'Edit Event', 'event_espresso' ) . '</a>';
1995
-			$this->_template_args['event_name'] .= ' <span class="admin-page-header-edit-lnk not-bold">' . $edit_event_lnk . '</span>' ;
1993
+			$edit_event_url = self::add_query_args_and_nonce(array('action'=>'edit', 'post'=>$this->_reg_event->ID()), EVENTS_ADMIN_URL);
1994
+			$edit_event_lnk = '<a href="'.$edit_event_url.'" title="'.esc_attr__('Edit ', 'event_espresso').$this->_reg_event->name().'">'.__('Edit Event', 'event_espresso').'</a>';
1995
+			$this->_template_args['event_name'] .= ' <span class="admin-page-header-edit-lnk not-bold">'.$edit_event_lnk.'</span>';
1996 1996
 		}
1997 1997
 
1998 1998
 		$this->_template_args['step_content'] = $this->_get_registration_step_content();
1999 1999
 
2000
-		if ( defined('DOING_AJAX' ) )
2000
+		if (defined('DOING_AJAX'))
2001 2001
 			$this->_return_json();
2002 2002
 
2003 2003
 
2004 2004
 		// grab header
2005
-		$template_path = REG_TEMPLATE_PATH . 'reg_admin_register_new_attendee.template.php';
2006
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
2005
+		$template_path = REG_TEMPLATE_PATH.'reg_admin_register_new_attendee.template.php';
2006
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE);
2007 2007
 
2008 2008
 		//$this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE );
2009 2009
 		// the details template wrapper
@@ -2021,7 +2021,7 @@  discard block
 block discarded – undo
2021 2021
 	 */
2022 2022
 	protected function _get_registration_step_content() {
2023 2023
 
2024
-		$template_path = REG_TEMPLATE_PATH . 'reg_admin_register_new_attendee_step_content.template.php';
2024
+		$template_path = REG_TEMPLATE_PATH.'reg_admin_register_new_attendee_step_content.template.php';
2025 2025
 		$template_args = array(
2026 2026
 			'title' => '',
2027 2027
 			'content' => '',
@@ -2042,11 +2042,11 @@  discard block
 block discarded – undo
2042 2042
 
2043 2043
 		//if the cart is empty then we know we're at step one so we'll display ticket selector
2044 2044
 		$cart = EE_Registry::instance()->SSN->get_session_data('cart');
2045
-		$step = empty( $cart ) ? 'ticket' : 'questions';
2046
-		switch ( $step ) {
2045
+		$step = empty($cart) ? 'ticket' : 'questions';
2046
+		switch ($step) {
2047 2047
 			case 'ticket' :
2048 2048
 				$template_args['title'] = __('Step One: Select the Ticket for this registration', 'event_espresso');
2049
-				$template_args['content'] = EED_Ticket_Selector::instance()->display_ticket_selector( $this->_reg_event );
2049
+				$template_args['content'] = EED_Ticket_Selector::instance()->display_ticket_selector($this->_reg_event);
2050 2050
 				$template_args['step_button_text'] = __('Add Tickets and Continue to Registrant Details', 'event_espresso');
2051 2051
 				$template_args['show_notification_toggle'] = FALSE;
2052 2052
 				break;
@@ -2059,9 +2059,9 @@  discard block
 block discarded – undo
2059 2059
 				break;
2060 2060
 		}
2061 2061
 
2062
-		$this->_set_add_edit_form_tags( 'process_reg_step', $hidden_fields ); //we come back to the process_registration_step route.
2062
+		$this->_set_add_edit_form_tags('process_reg_step', $hidden_fields); //we come back to the process_registration_step route.
2063 2063
 
2064
-		return EEH_Template::display_template( $template_path, $template_args, TRUE );
2064
+		return EEH_Template::display_template($template_path, $template_args, TRUE);
2065 2065
 	}
2066 2066
 
2067 2067
 
@@ -2075,11 +2075,11 @@  discard block
 block discarded – undo
2075 2075
 	*		@return boolean
2076 2076
 	*/
2077 2077
 	private function _set_reg_event() {
2078
-		if ( is_object( $this->_reg_event )) {
2078
+		if (is_object($this->_reg_event)) {
2079 2079
 			return TRUE;
2080 2080
 		}
2081
-		$EVT_ID = ( ! empty( $this->_req_data['event_id'] )) ? absint( $this->_req_data['event_id'] ) : FALSE;
2082
-		if ( ! $EVT_ID ) {
2081
+		$EVT_ID = ( ! empty($this->_req_data['event_id'])) ? absint($this->_req_data['event_id']) : FALSE;
2082
+		if ( ! $EVT_ID) {
2083 2083
 			return FALSE;
2084 2084
 		}
2085 2085
 
@@ -2100,59 +2100,59 @@  discard block
 block discarded – undo
2100 2100
 	public function process_reg_step() {
2101 2101
 
2102 2102
 		$this->_set_reg_event();
2103
-		EE_Registry::instance()->REQ->set_espresso_page( TRUE );
2103
+		EE_Registry::instance()->REQ->set_espresso_page(TRUE);
2104 2104
 
2105 2105
 		//what step are we on?
2106
-		$cart = EE_Registry::instance()->SSN->get_session_data( 'cart' );
2107
-		$step = empty( $cart ) ? 'ticket' : 'questions';
2106
+		$cart = EE_Registry::instance()->SSN->get_session_data('cart');
2107
+		$step = empty($cart) ? 'ticket' : 'questions';
2108 2108
 
2109 2109
 		//if doing ajax then we need to verify the nonce
2110
-		if ( 'DOING_AJAX' ) {
2111
-			$nonce = isset( $this->_req_data[$this->_req_nonce] ) ? sanitize_text_field( $this->_req_data[$this->_req_nonce] ) : '';
2112
-			$this->_verify_nonce( $nonce, $this->_req_nonce );
2110
+		if ('DOING_AJAX') {
2111
+			$nonce = isset($this->_req_data[$this->_req_nonce]) ? sanitize_text_field($this->_req_data[$this->_req_nonce]) : '';
2112
+			$this->_verify_nonce($nonce, $this->_req_nonce);
2113 2113
 		}
2114 2114
 
2115
-		switch ( $step ) {
2115
+		switch ($step) {
2116 2116
 			case 'ticket' :
2117 2117
 				//process ticket selection
2118 2118
 				$success = EED_Ticket_Selector::instance()->process_ticket_selections();
2119
-				if ( $success ) {
2120
-					EE_Error::add_success( __('Tickets Selected. Now complete the registration.'), 'event_espresso');
2119
+				if ($success) {
2120
+					EE_Error::add_success(__('Tickets Selected. Now complete the registration.'), 'event_espresso');
2121 2121
 				} else {
2122 2122
 					$query_args['step_error'] = $this->_req_data['step_error'] = TRUE;
2123 2123
 				}
2124
-				if ( defined('DOING_AJAX') ) {
2124
+				if (defined('DOING_AJAX')) {
2125 2125
 					$this->new_registration(); //display next step
2126 2126
 				} else {
2127 2127
 					$query_args['action'] = 'new_registration';
2128 2128
 					$query_args['processing_registration'] = true;
2129 2129
 					$query_args['event_id'] = $this->_reg_event->ID();
2130
-					$this->_redirect_after_action( FALSE, '', '', $query_args, TRUE );
2130
+					$this->_redirect_after_action(FALSE, '', '', $query_args, TRUE);
2131 2131
 				}
2132 2132
 				break;
2133 2133
 			case 'questions' :
2134 2134
 				//process registration
2135 2135
 				$transaction = EED_Single_Page_Checkout::instance()->process_registration_from_admin();
2136
-				if ( ! $transaction instanceof EE_Transaction ) {
2136
+				if ( ! $transaction instanceof EE_Transaction) {
2137 2137
 					$query_args = array(
2138 2138
 						'action' => 'new_registration',
2139 2139
 						'processing_registration' => true,
2140 2140
 						'event_id' => $this->_reg_event->ID()
2141 2141
 					);
2142 2142
 
2143
-					if ( defined('DOING_AJAX' )) {
2143
+					if (defined('DOING_AJAX')) {
2144 2144
 						//display registration form again because there are errors (maybe validation?)
2145 2145
 						$this->new_registration();
2146 2146
 						return;
2147 2147
 					} else {
2148
-						$this->_redirect_after_action( FALSE, '', '', $query_args, TRUE );
2148
+						$this->_redirect_after_action(FALSE, '', '', $query_args, TRUE);
2149 2149
 						return;
2150 2150
 					}
2151 2151
 				}
2152 2152
 				/** @type EE_Transaction_Payments $transaction_payments */
2153
-				$transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' );
2153
+				$transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments');
2154 2154
 				// maybe update status, and make sure to save transaction if not done already
2155
-				if ( ! $transaction_payments->update_transaction_status_based_on_total_paid( $transaction )) {
2155
+				if ( ! $transaction_payments->update_transaction_status_based_on_total_paid($transaction)) {
2156 2156
 					$transaction->save();
2157 2157
 				}
2158 2158
 				$query_args = array(
@@ -2160,8 +2160,8 @@  discard block
 block discarded – undo
2160 2160
 					'TXN_ID' => $transaction->ID(),
2161 2161
 					'page' => 'espresso_transactions'
2162 2162
 				);
2163
-				EE_Error::add_success( __('Registration Created.  Please review the transaction and add any payments as necessary', 'event_espresso') );
2164
-				$this->_redirect_after_action( FALSE, '', '', $query_args, TRUE );
2163
+				EE_Error::add_success(__('Registration Created.  Please review the transaction and add any payments as necessary', 'event_espresso'));
2164
+				$this->_redirect_after_action(FALSE, '', '', $query_args, TRUE);
2165 2165
 				break;
2166 2166
 			}
2167 2167
 
@@ -2181,7 +2181,7 @@  discard block
 block discarded – undo
2181 2181
 	*		@return void
2182 2182
 	*/
2183 2183
 	protected function _attendee_contact_list_table() {
2184
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
2184
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2185 2185
 		$this->_search_btn_label = __('Contacts', 'event_espresso');
2186 2186
 		$this->display_admin_list_table_page_with_no_sidebar();
2187 2187
 	}
@@ -2196,13 +2196,13 @@  discard block
 block discarded – undo
2196 2196
 	*		@access public
2197 2197
 	*		@return array
2198 2198
 	*/
2199
-	public function get_attendees( $per_page, $count = FALSE, $trash = FALSE ) {
2199
+	public function get_attendees($per_page, $count = FALSE, $trash = FALSE) {
2200 2200
 
2201
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
2201
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2202 2202
 		// start with an empty array
2203 2203
 		$attendees = array();
2204 2204
 
2205
-		require_once( REG_ADMIN . 'EE_Attendee_Contact_List_Table.class.php' );
2205
+		require_once(REG_ADMIN.'EE_Attendee_Contact_List_Table.class.php');
2206 2206
 		$ATT_MDL = EEM_Attendee::instance();
2207 2207
 
2208 2208
 		$this->_req_data['orderby'] = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : '';
@@ -2230,47 +2230,47 @@  discard block
 block discarded – undo
2230 2230
 				$orderby = 'ATT_lname';
2231 2231
 		}
2232 2232
 
2233
-		$sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'ASC';
2233
+		$sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'ASC';
2234 2234
 
2235
-		$current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1;
2236
-		$per_page = isset( $per_page ) && !empty( $per_page ) ? $per_page : 10;
2237
-		$per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page;
2235
+		$current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1;
2236
+		$per_page = isset($per_page) && ! empty($per_page) ? $per_page : 10;
2237
+		$per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page;
2238 2238
 
2239 2239
 		$_where = array();
2240 2240
 
2241
-		if ( isset( $this->_req_data['s'] ) ) {
2242
-			$sstr = '%' . $this->_req_data['s'] . '%';
2241
+		if (isset($this->_req_data['s'])) {
2242
+			$sstr = '%'.$this->_req_data['s'].'%';
2243 2243
 			$_where['OR'] = array(
2244
-				'Registration.Event.EVT_name' => array( 'LIKE', $sstr),
2245
-				'Registration.Event.EVT_desc' => array( 'LIKE', $sstr ),
2246
-				'Registration.Event.EVT_short_desc' => array( 'LIKE' , $sstr ),
2247
-				'ATT_fname' => array( 'LIKE', $sstr ),
2248
-				'ATT_lname' => array( 'LIKE', $sstr ),
2249
-				'ATT_short_bio' => array( 'LIKE', $sstr ),
2250
-				'ATT_email' => array('LIKE', $sstr ),
2251
-				'ATT_address' => array( 'LIKE', $sstr ),
2252
-				'ATT_address2' => array( 'LIKE', $sstr ),
2253
-				'ATT_city' => array( 'LIKE', $sstr ),
2254
-				'Country.CNT_name' => array( 'LIKE', $sstr ),
2255
-				'State.STA_name' => array('LIKE', $sstr ),
2256
-				'ATT_phone' => array( 'LIKE', $sstr ),
2257
-				'Registration.REG_final_price' => array( 'LIKE', $sstr ),
2258
-				'Registration.REG_code' => array( 'LIKE', $sstr ),
2259
-				'Registration.REG_count' => array( 'LIKE' , $sstr ),
2260
-				'Registration.REG_group_size' => array( 'LIKE' , $sstr )
2244
+				'Registration.Event.EVT_name' => array('LIKE', $sstr),
2245
+				'Registration.Event.EVT_desc' => array('LIKE', $sstr),
2246
+				'Registration.Event.EVT_short_desc' => array('LIKE', $sstr),
2247
+				'ATT_fname' => array('LIKE', $sstr),
2248
+				'ATT_lname' => array('LIKE', $sstr),
2249
+				'ATT_short_bio' => array('LIKE', $sstr),
2250
+				'ATT_email' => array('LIKE', $sstr),
2251
+				'ATT_address' => array('LIKE', $sstr),
2252
+				'ATT_address2' => array('LIKE', $sstr),
2253
+				'ATT_city' => array('LIKE', $sstr),
2254
+				'Country.CNT_name' => array('LIKE', $sstr),
2255
+				'State.STA_name' => array('LIKE', $sstr),
2256
+				'ATT_phone' => array('LIKE', $sstr),
2257
+				'Registration.REG_final_price' => array('LIKE', $sstr),
2258
+				'Registration.REG_code' => array('LIKE', $sstr),
2259
+				'Registration.REG_count' => array('LIKE', $sstr),
2260
+				'Registration.REG_group_size' => array('LIKE', $sstr)
2261 2261
 				);
2262 2262
 		}
2263 2263
 
2264 2264
 
2265
-		$offset = ($current_page-1)*$per_page;
2266
-		$limit = $count ? NULL : array( $offset, $per_page );
2265
+		$offset = ($current_page - 1) * $per_page;
2266
+		$limit = $count ? NULL : array($offset, $per_page);
2267 2267
 
2268
-		if ( $trash ) {
2269
-			$_where['status'] = array( '!=', 'publish' );
2270
-			$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));
2268
+		if ($trash) {
2269
+			$_where['status'] = array('!=', 'publish');
2270
+			$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));
2271 2271
 		} else {
2272
-			$_where['status'] = array( 'IN', array( 'publish' ) );
2273
-			$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) );
2272
+			$_where['status'] = array('IN', array('publish'));
2273
+			$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));
2274 2274
 		}
2275 2275
 
2276 2276
 		return $all_attendees;
@@ -2287,10 +2287,10 @@  discard block
 block discarded – undo
2287 2287
 	 */
2288 2288
 	protected function _resend_registration() {
2289 2289
 		$this->_process_resend_registration();
2290
-		$query_args = isset($this->_req_data['redirect_to'] ) ? array('action' => $this->_req_data['redirect_to'], '_REG_ID' => $this->_req_data['_REG_ID'] ) : array(
2290
+		$query_args = isset($this->_req_data['redirect_to']) ? array('action' => $this->_req_data['redirect_to'], '_REG_ID' => $this->_req_data['_REG_ID']) : array(
2291 2291
 			'action' => 'default'
2292 2292
 		);
2293
-		$this->_redirect_after_action(FALSE, '', '', $query_args, TRUE );
2293
+		$this->_redirect_after_action(FALSE, '', '', $query_args, TRUE);
2294 2294
 	}
2295 2295
 
2296 2296
 
@@ -2298,17 +2298,17 @@  discard block
 block discarded – undo
2298 2298
 
2299 2299
 
2300 2300
 
2301
-	public function _registrations_report(){
2302
-		EE_Registry::instance()->load_helper( 'File' );
2301
+	public function _registrations_report() {
2302
+		EE_Registry::instance()->load_helper('File');
2303 2303
 		$new_request_args = array(
2304 2304
 			'export' => 'report',
2305 2305
 			'action' => 'registrations_report_for_event',
2306
-			'EVT_ID' => isset( $this->_req_data[ 'EVT_ID'] ) ? $this->_req_data[ 'EVT_ID' ] : NULL,
2306
+			'EVT_ID' => isset($this->_req_data['EVT_ID']) ? $this->_req_data['EVT_ID'] : NULL,
2307 2307
 		);
2308 2308
 		$this->_req_data = array_merge($this->_req_data, $new_request_args);
2309 2309
 
2310
-		if ( is_readable(EE_CLASSES . 'EE_Export.class.php')) {
2311
-			require_once(EE_CLASSES . 'EE_Export.class.php');
2310
+		if (is_readable(EE_CLASSES.'EE_Export.class.php')) {
2311
+			require_once(EE_CLASSES.'EE_Export.class.php');
2312 2312
 			$EE_Export = EE_Export::instance($this->_req_data);
2313 2313
 			$EE_Export->export();
2314 2314
 		}
@@ -2316,19 +2316,19 @@  discard block
 block discarded – undo
2316 2316
 
2317 2317
 
2318 2318
 
2319
-	public function _contact_list_export(){
2320
-		EE_Registry::instance()->load_helper( 'File' );
2321
-		if ( is_readable(EE_CLASSES . 'EE_Export.class.php')) {
2322
-			require_once(EE_CLASSES . 'EE_Export.class.php');
2319
+	public function _contact_list_export() {
2320
+		EE_Registry::instance()->load_helper('File');
2321
+		if (is_readable(EE_CLASSES.'EE_Export.class.php')) {
2322
+			require_once(EE_CLASSES.'EE_Export.class.php');
2323 2323
 			$EE_Export = EE_Export::instance($this->_req_data);
2324 2324
 			$EE_Export->export_attendees();
2325 2325
 		}
2326 2326
 	}
2327 2327
 
2328
-	public function _contact_list_report(){
2329
-		EE_Registry::instance()->load_helper( 'File' );
2330
-		if ( is_readable(EE_CLASSES . 'EE_Export.class.php')) {
2331
-			require_once(EE_CLASSES . 'EE_Export.class.php');
2328
+	public function _contact_list_report() {
2329
+		EE_Registry::instance()->load_helper('File');
2330
+		if (is_readable(EE_CLASSES.'EE_Export.class.php')) {
2331
+			require_once(EE_CLASSES.'EE_Export.class.php');
2332 2332
 			$EE_Export = EE_Export::instance($this->_req_data);
2333 2333
 			$EE_Export->report_attendees();
2334 2334
 		}
@@ -2347,73 +2347,73 @@  discard block
 block discarded – undo
2347 2347
 	 * @return void
2348 2348
 	 */
2349 2349
 	protected function _duplicate_attendee() {
2350
-		$action = !empty( $this->_req_data['return'] ) ? $this->_req_data['return'] : 'default';
2350
+		$action = ! empty($this->_req_data['return']) ? $this->_req_data['return'] : 'default';
2351 2351
 		//verify we have necessary info
2352
-		if ( empty($this->_req_data['_REG_ID'] )  ) {
2353
-			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__ );
2354
-			$query_args = array( 'action' => $action );
2352
+		if (empty($this->_req_data['_REG_ID'])) {
2353
+			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__);
2354
+			$query_args = array('action' => $action);
2355 2355
 			$this->_redirect_after_action('', '', '', $query_args, TRUE);
2356 2356
 		}
2357 2357
 
2358 2358
 		//okay necessary deets present... let's dupe the incoming attendee and attach to incoming registration.
2359
-		$registration = EEM_Registration::instance()->get_one_by_ID( $this->_req_data['_REG_ID'] );
2359
+		$registration = EEM_Registration::instance()->get_one_by_ID($this->_req_data['_REG_ID']);
2360 2360
 		$attendee = $registration->attendee();
2361 2361
 
2362 2362
 		//remove relation of existing attendee on registration
2363
-		$registration->_remove_relation_to($attendee, 'Attendee' );
2363
+		$registration->_remove_relation_to($attendee, 'Attendee');
2364 2364
 		//new attendee
2365 2365
 		$new_attendee = clone $attendee;
2366
-		$new_attendee->set( 'ATT_ID', 0 );
2366
+		$new_attendee->set('ATT_ID', 0);
2367 2367
 		$new_attendee->save();
2368 2368
 
2369 2369
 		//add new attendee to reg
2370
-		$registration->_add_relation_to( $new_attendee, 'Attendee');
2370
+		$registration->_add_relation_to($new_attendee, 'Attendee');
2371 2371
 
2372
-		EE_Error::add_success( __('New Contact record created.  Now make any edits you wish to make for this contact.', 'event_espresso') );
2372
+		EE_Error::add_success(__('New Contact record created.  Now make any edits you wish to make for this contact.', 'event_espresso'));
2373 2373
 
2374 2374
 		//redirect to edit page for attendee
2375
-		$query_args = array( 'post' => $new_attendee->ID(), 'action' => 'edit_attendee' );
2375
+		$query_args = array('post' => $new_attendee->ID(), 'action' => 'edit_attendee');
2376 2376
 
2377
-		$this->_redirect_after_action( '', '', '', $query_args, TRUE );
2377
+		$this->_redirect_after_action('', '', '', $query_args, TRUE);
2378 2378
 	}
2379 2379
 
2380 2380
 
2381 2381
 	//related to cpt routes
2382 2382
 	protected function _insert_update_cpt_item($post_id, $post) {
2383 2383
 		$success = true;
2384
-		$attendee = EEM_Attendee::instance()->get_one_by_ID( $post_id );
2384
+		$attendee = EEM_Attendee::instance()->get_one_by_ID($post_id);
2385 2385
 		//for attendee updates
2386
-		if ( $post->post_type = 'espresso_attendees' && !empty( $attendee ) ) {
2386
+		if ($post->post_type = 'espresso_attendees' && ! empty($attendee)) {
2387 2387
 			//note we should only be UPDATING attendees at this point.
2388 2388
 			$updated_fields = array(
2389 2389
 				'ATT_fname' => $this->_req_data['ATT_fname'],
2390 2390
 				'ATT_lname' => $this->_req_data['ATT_lname'],
2391
-				'ATT_full_name'=> $this->_req_data['ATT_fname'] . ' ' . $this->_req_data['ATT_lname'],
2391
+				'ATT_full_name'=> $this->_req_data['ATT_fname'].' '.$this->_req_data['ATT_lname'],
2392 2392
 				'ATT_address' => isset($this->_req_data['ATT_address']) ? $this->_req_data['ATT_address'] : '',
2393 2393
 				'ATT_address2' => isset($this->_req_data['ATT_address2']) ? $this->_req_data['ATT_address2'] : '',
2394
-				'ATT_city' => isset( $this->_req_data['ATT_city'] ) ? $this->_req_data['ATT_city'] : '',
2395
-				'STA_ID' => isset( $this->_req_data['STA_ID'] ) ? $this->_req_data['STA_ID'] : '',
2396
-				'CNT_ISO' => isset( $this->_req_data['CNT_ISO'] ) ? $this->_req_data['CNT_ISO'] : '',
2397
-				'ATT_zip' => isset( $this->_req_data['ATT_zip'] ) ? $this->_req_data['ATT_zip'] : '',
2398
-				'ATT_email' => isset( $this->_req_data['ATT_email'] ) ? $this->_req_data['ATT_email'] : '',
2399
-				'ATT_phone' => isset( $this->_req_data['ATT_phone'] ) ? $this->_req_data['ATT_phone'] : ''
2394
+				'ATT_city' => isset($this->_req_data['ATT_city']) ? $this->_req_data['ATT_city'] : '',
2395
+				'STA_ID' => isset($this->_req_data['STA_ID']) ? $this->_req_data['STA_ID'] : '',
2396
+				'CNT_ISO' => isset($this->_req_data['CNT_ISO']) ? $this->_req_data['CNT_ISO'] : '',
2397
+				'ATT_zip' => isset($this->_req_data['ATT_zip']) ? $this->_req_data['ATT_zip'] : '',
2398
+				'ATT_email' => isset($this->_req_data['ATT_email']) ? $this->_req_data['ATT_email'] : '',
2399
+				'ATT_phone' => isset($this->_req_data['ATT_phone']) ? $this->_req_data['ATT_phone'] : ''
2400 2400
 				);
2401
-			foreach ( $updated_fields as $field => $value ) {
2401
+			foreach ($updated_fields as $field => $value) {
2402 2402
 				$attendee->set($field, $value);
2403 2403
 			}
2404 2404
 
2405 2405
 			$success = $attendee->save();
2406 2406
 
2407
-			$attendee_update_callbacks = apply_filters( 'FHEE__Registrations_Admin_Page__insert_update_cpt_item__attendee_update', array() );
2408
-			foreach ( $attendee_update_callbacks as $a_callback ) {
2409
-				if ( FALSE === call_user_func_array( $a_callback, array($attendee, $this->_req_data ) ) ) {
2410
-					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 ) );
2407
+			$attendee_update_callbacks = apply_filters('FHEE__Registrations_Admin_Page__insert_update_cpt_item__attendee_update', array());
2408
+			foreach ($attendee_update_callbacks as $a_callback) {
2409
+				if (FALSE === call_user_func_array($a_callback, array($attendee, $this->_req_data))) {
2410
+					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));
2411 2411
 				}
2412 2412
 			}
2413 2413
 		}
2414 2414
 
2415
-		if ( $success === FALSE )
2416
-			EE_Error::add_error(__('Something went wrong with updating the meta table data for the registration.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
2415
+		if ($success === FALSE)
2416
+			EE_Error::add_error(__('Something went wrong with updating the meta table data for the registration.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
2417 2417
 
2418 2418
 	}
2419 2419
 
@@ -2433,17 +2433,17 @@  discard block
 block discarded – undo
2433 2433
 		remove_meta_box('postexcerpt', __('Excerpt'), 'post_excerpt_meta_box', $this->_cpt_routes[$this->_req_action], 'normal', 'core');
2434 2434
 		remove_meta_box('commentstatusdiv', $this->_cpt_routes[$this->_req_action], 'normal', 'core');
2435 2435
 
2436
-		if ( post_type_supports( 'espresso_attendees', 'excerpt') ) {
2437
-			add_meta_box('postexcerpt', __('Short Biography', 'event_espresso'), 'post_excerpt_meta_box', $this->_cpt_routes[$this->_req_action], 'normal' );
2436
+		if (post_type_supports('espresso_attendees', 'excerpt')) {
2437
+			add_meta_box('postexcerpt', __('Short Biography', 'event_espresso'), 'post_excerpt_meta_box', $this->_cpt_routes[$this->_req_action], 'normal');
2438 2438
 		}
2439 2439
 
2440
-		if ( post_type_supports( 'espresso_attendees', 'comments') ) {
2440
+		if (post_type_supports('espresso_attendees', 'comments')) {
2441 2441
 			add_meta_box('commentsdiv', __('Notes on the Contact', 'event_espresso'), 'post_comment_meta_box', $this->_cpt_routes[$this->_req_action], 'normal', 'core');
2442 2442
 		}
2443 2443
 
2444
-		add_meta_box('attendee_contact_info', __('Contact Info', 'event_espresso'), array( $this, 'attendee_contact_info'), $this->_cpt_routes[$this->_req_action], 'side', 'core' );
2445
-		add_meta_box('attendee_details_address', __('Address Details', 'event_espresso'), array($this, 'attendee_address_details'), $this->_cpt_routes[$this->_req_action], 'normal', 'core' );
2446
-		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');
2444
+		add_meta_box('attendee_contact_info', __('Contact Info', 'event_espresso'), array($this, 'attendee_contact_info'), $this->_cpt_routes[$this->_req_action], 'side', 'core');
2445
+		add_meta_box('attendee_details_address', __('Address Details', 'event_espresso'), array($this, 'attendee_address_details'), $this->_cpt_routes[$this->_req_action], 'normal', 'core');
2446
+		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');
2447 2447
 	}
2448 2448
 
2449 2449
 
@@ -2452,10 +2452,10 @@  discard block
 block discarded – undo
2452 2452
 	 * @param  WP_Post $post wp post object
2453 2453
 	 * @return string        attendee contact info ( and form )
2454 2454
 	 */
2455
-	public function attendee_contact_info( $post ) {
2455
+	public function attendee_contact_info($post) {
2456 2456
 		//get attendee object ( should already have it )
2457 2457
 		$this->_template_args['attendee'] = $this->_cpt_model_obj;
2458
-		$template = REG_TEMPLATE_PATH . 'attendee_contact_info_metabox_content.template.php';
2458
+		$template = REG_TEMPLATE_PATH.'attendee_contact_info_metabox_content.template.php';
2459 2459
 		EEH_Template::display_template($template, $this->_template_args);
2460 2460
 	}
2461 2461
 
@@ -2471,12 +2471,12 @@  discard block
 block discarded – undo
2471 2471
 		$this->_template_args['attendee'] = $this->_cpt_model_obj;
2472 2472
 		$this->_template_args['state_html'] = EEH_Form_Fields::generate_form_input(
2473 2473
 				new EE_Question_Form_Input(
2474
-				EE_Question::new_instance( array(
2474
+				EE_Question::new_instance(array(
2475 2475
 					'QST_ID' => 0,
2476 2476
 					'QST_display_text' => __('State/Province', 'event_espresso'),
2477 2477
 					'QST_system' => 'admin-state'
2478 2478
 					)),
2479
-				EE_Answer::new_instance( array(
2479
+				EE_Answer::new_instance(array(
2480 2480
 					'ANS_ID' => 0,
2481 2481
 					'ANS_value' => $this->_cpt_model_obj->state_ID()
2482 2482
 					)),
@@ -2489,12 +2489,12 @@  discard block
 block discarded – undo
2489 2489
 			));
2490 2490
 		$this->_template_args['country_html'] = EEH_Form_Fields::generate_form_input(
2491 2491
 				new EE_Question_Form_Input(
2492
-				EE_Question::new_instance( array(
2492
+				EE_Question::new_instance(array(
2493 2493
 					'QST_ID' => 0,
2494 2494
 					'QST_display_text' => __('Country', 'event_espresso'),
2495 2495
 					'QST_system' => 'admin-country'
2496 2496
 					)),
2497
-				EE_Answer::new_instance( array(
2497
+				EE_Answer::new_instance(array(
2498 2498
 					'ANS_ID' => 0,
2499 2499
 					'ANS_value' => $this->_cpt_model_obj->country_ID()
2500 2500
 					)),
@@ -2505,8 +2505,8 @@  discard block
 block discarded – undo
2505 2505
 					'append_qstn_id' => FALSE
2506 2506
 					)
2507 2507
 				));
2508
-		$template = REG_TEMPLATE_PATH . 'attendee_address_details_metabox_content.template.php';
2509
-		EEH_Template::display_template($template, $this->_template_args );
2508
+		$template = REG_TEMPLATE_PATH.'attendee_address_details_metabox_content.template.php';
2509
+		EEH_Template::display_template($template, $this->_template_args);
2510 2510
 
2511 2511
 	}
2512 2512
 
@@ -2516,11 +2516,11 @@  discard block
 block discarded – undo
2516 2516
 	*		@access protected
2517 2517
 	*		@return void
2518 2518
 	*/
2519
-	public function attendee_registrations_meta_box( $post ) {
2519
+	public function attendee_registrations_meta_box($post) {
2520 2520
 
2521 2521
 		$this->_template_args['attendee'] = $this->_cpt_model_obj;
2522 2522
 		$this->_template_args['registrations'] = $this->_cpt_model_obj->get_many_related('Registration');
2523
-		$template = REG_TEMPLATE_PATH . 'attendee_registrations_main_meta_box.template.php';
2523
+		$template = REG_TEMPLATE_PATH.'attendee_registrations_main_meta_box.template.php';
2524 2524
 		EEH_Template::display_template($template, $this->_template_args);
2525 2525
 
2526 2526
 	}
@@ -2534,8 +2534,8 @@  discard block
 block discarded – undo
2534 2534
 	 * @return string        html for new form.
2535 2535
 	 */
2536 2536
 	public function after_title_form_fields($post) {
2537
-		if ( $post->post_type == 'espresso_attendees' ) {
2538
-			$template = REG_TEMPLATE_PATH . 'attendee_details_after_title_form_fields.template.php';
2537
+		if ($post->post_type == 'espresso_attendees') {
2538
+			$template = REG_TEMPLATE_PATH.'attendee_details_after_title_form_fields.template.php';
2539 2539
 			$template_args['attendee'] = $this->_cpt_model_obj;
2540 2540
 			EEH_Template::display_template($template, $template_args);
2541 2541
 		}
@@ -2552,21 +2552,21 @@  discard block
 block discarded – undo
2552 2552
 	*		@access protected
2553 2553
 	*		@return void
2554 2554
 	*/
2555
-	protected function _trash_or_restore_attendees( $trash = TRUE ) {
2555
+	protected function _trash_or_restore_attendees($trash = TRUE) {
2556 2556
 
2557
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
2557
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2558 2558
 
2559 2559
 		$ATT_MDL = EEM_Attendee::instance();
2560 2560
 
2561 2561
 		$success = 1;
2562 2562
 		//Checkboxes
2563
-		if (!empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
2563
+		if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
2564 2564
 			// if array has more than one element than success message should be plural
2565
-			$success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1;
2565
+			$success = count($this->_req_data['checkbox']) > 1 ? 2 : 1;
2566 2566
 			// cycle thru checkboxes
2567
-			while (list( $ATT_ID, $value ) = each($this->_req_data['checkbox'])) {
2568
-				$updated = $trash ? $ATT_MDL->update_by_ID(array( 'status' => 'trash' ), $ATT_ID) : $ATT_MDL->update_by_ID( array('status' => 'publish' ), $ATT_ID);
2569
-				if ( !$updated ) {
2567
+			while (list($ATT_ID, $value) = each($this->_req_data['checkbox'])) {
2568
+				$updated = $trash ? $ATT_MDL->update_by_ID(array('status' => 'trash'), $ATT_ID) : $ATT_MDL->update_by_ID(array('status' => 'publish'), $ATT_ID);
2569
+				if ( ! $updated) {
2570 2570
 					$success = 0;
2571 2571
 				}
2572 2572
 			}
@@ -2575,18 +2575,18 @@  discard block
 block discarded – undo
2575 2575
 			// grab single id and delete
2576 2576
 			$ATT_ID = absint($this->_req_data['ATT_ID']);
2577 2577
 			//get attendee
2578
-			$att = $ATT_MDL->get_one_by_ID( $ATT_ID );
2578
+			$att = $ATT_MDL->get_one_by_ID($ATT_ID);
2579 2579
 			$updated = $trash ? $att->set_status('trash') : $att->set_status('publish');
2580 2580
 			$updated = $att->save();
2581
-			if ( ! $updated ) {
2581
+			if ( ! $updated) {
2582 2582
 				$success = 0;
2583 2583
 			}
2584 2584
 
2585 2585
 		}
2586 2586
 
2587
-		$what = $success > 1 ? __( 'Contacts', 'event_espresso' ) : __( 'Contact', 'event_espresso' );
2588
-		$action_desc = $trash ? __( 'moved to the trash', 'event_espresso' ) : __( 'restored', 'event_espresso' );
2589
-		$this->_redirect_after_action( $success, $what, $action_desc, array( 'action' => 'contact_list' ) );
2587
+		$what = $success > 1 ? __('Contacts', 'event_espresso') : __('Contact', 'event_espresso');
2588
+		$action_desc = $trash ? __('moved to the trash', 'event_espresso') : __('restored', 'event_espresso');
2589
+		$this->_redirect_after_action($success, $what, $action_desc, array('action' => 'contact_list'));
2590 2590
 
2591 2591
 	}
2592 2592
 
Please login to merge, or discard this patch.
Braces   +30 added lines, -21 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@  discard block
 block discarded – undo
1
-<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 /**
3 5
  * Event Espresso
4 6
  *
@@ -79,8 +81,9 @@  discard block
 block discarded – undo
79 81
 	public function clear_comment_link( $link, $comment, $args ) {
80 82
 		//gotta make sure this only happens on this route
81 83
 		$post_type = get_post_type( $comment->comment_post_ID);
82
-		if ( $post_type == 'espresso_attendees' )
83
-			return '#commentsdiv';
84
+		if ( $post_type == 'espresso_attendees' ) {
85
+					return '#commentsdiv';
86
+		}
84 87
 		return $link;
85 88
 	}
86 89
 
@@ -834,9 +837,9 @@  discard block
 block discarded – undo
834 837
 
835 838
 		$REG_ID = ( ! empty( $this->_req_data['_REG_ID'] )) ? absint( $this->_req_data['_REG_ID'] ) : FALSE;
836 839
 
837
-		if ( $this->_registration = $REG->get_one_by_ID( $REG_ID ))
838
-			return TRUE;
839
-		else {
840
+		if ( $this->_registration = $REG->get_one_by_ID( $REG_ID )) {
841
+					return TRUE;
842
+		} else {
840 843
 			$error_msg = sprintf( __('An error occurred and the details for Registration ID #%s could not be retrieved.', 'event_espresso'), $REG_ID );
841 844
 			EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ );
842 845
 			$this->_registration = NULL;
@@ -933,7 +936,7 @@  discard block
 block discarded – undo
933 936
 					EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $curdate . $time_start, 'Y-m-d H:i:s' ),
934 937
 					EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $curdate . $time_end, 'Y-m-d H:i:s' ),
935 938
 			));
936
-		}elseif($this_month_a || $this_month){
939
+		} elseif($this_month_a || $this_month){
937 940
 			$this_month_r = date('m', current_time('timestamp'));
938 941
 			$days_this_month = date( 't', current_time('timestamp') );
939 942
 			$_where['REG_date']= array('BETWEEN',
@@ -941,18 +944,18 @@  discard block
 block discarded – undo
941 944
 					EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $this_year_r . '-' . $this_month_r . '-01' . ' ' . $time_start, 'Y-m-d H:i:s' ),
942 945
 					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' )
943 946
 			));
944
-		}elseif($month_range){
947
+		} elseif($month_range){
945 948
 			$pieces = explode(' ', $this->_req_data['month_range'], 3);
946 949
 			$month_r = !empty($pieces[0]) ? date('m', strtotime($pieces[0])) : '';
947 950
 			$year_r = !empty($pieces[1]) ? $pieces[1] : '';
948 951
 			$days_in_month = date('t', strtotime($year_r .  '-' . $month_r . '-' . '01') );
949 952
 			$_where['REG_date']= array('BETWEEN',
950 953
 				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' ) ) );
951
-		}elseif($start_date && $end_date){
954
+		} elseif($start_date && $end_date){
952 955
 			throw new EE_Error("not yet supported");
953
-		}elseif($start_date){
956
+		} elseif($start_date){
954 957
 			throw new EE_Error("not yet supported");
955
-		}elseif($end_date){
958
+		} elseif($end_date){
956 959
 			throw new EE_Error("not yet supported");
957 960
 		}
958 961
 
@@ -1876,8 +1879,9 @@  discard block
 block discarded – undo
1876 1879
 			// cycle thru checkboxes
1877 1880
 			while (list( $ind, $REG_ID ) = each($this->_req_data['_REG_ID'])) {
1878 1881
 				$REG = $REG_MDL->get_one_by_ID($REG_ID);
1879
-				if ( ! $REG instanceof EE_Registration )
1880
-					continue;
1882
+				if ( ! $REG instanceof EE_Registration ) {
1883
+									continue;
1884
+				}
1881 1885
 				$deleted = $this->_delete_registration($REG);
1882 1886
 				if ( !$deleted ) {
1883 1887
 					$success = 0;
@@ -1916,8 +1920,9 @@  discard block
 block discarded – undo
1916 1920
 
1917 1921
 		$all_trashed = TRUE;
1918 1922
 		foreach ( $REGS as $registration ) {
1919
-			if ( ! $registration->get('REG_deleted') )
1920
-				$all_trashed = FALSE;
1923
+			if ( ! $registration->get('REG_deleted') ) {
1924
+							$all_trashed = FALSE;
1925
+			}
1921 1926
 		}
1922 1927
 
1923 1928
 		if ( ! $all_trashed ) {
@@ -1943,8 +1948,10 @@  discard block
 block discarded – undo
1943 1948
 			//now delete permanently the checkins related to this registration.
1944 1949
 			$registration->delete_related_permanently('Checkin');
1945 1950
 
1946
-			if ( $registration->ID() === $REG->ID() )
1947
-				continue; //we don't want to delete permanently the existing registration just yet.
1951
+			if ( $registration->ID() === $REG->ID() ) {
1952
+							continue;
1953
+			}
1954
+			//we don't want to delete permanently the existing registration just yet.
1948 1955
 
1949 1956
 			//remove relation to transaction for these registrations if NOT the existing registrations
1950 1957
 			$registration->_remove_relations('Transaction');
@@ -1997,8 +2004,9 @@  discard block
 block discarded – undo
1997 2004
 
1998 2005
 		$this->_template_args['step_content'] = $this->_get_registration_step_content();
1999 2006
 
2000
-		if ( defined('DOING_AJAX' ) )
2001
-			$this->_return_json();
2007
+		if ( defined('DOING_AJAX' ) ) {
2008
+					$this->_return_json();
2009
+		}
2002 2010
 
2003 2011
 
2004 2012
 		// grab header
@@ -2412,8 +2420,9 @@  discard block
 block discarded – undo
2412 2420
 			}
2413 2421
 		}
2414 2422
 
2415
-		if ( $success === FALSE )
2416
-			EE_Error::add_error(__('Something went wrong with updating the meta table data for the registration.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
2423
+		if ( $success === FALSE ) {
2424
+					EE_Error::add_error(__('Something went wrong with updating the meta table data for the registration.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
2425
+		}
2417 2426
 
2418 2427
 	}
2419 2428
 
Please login to merge, or discard this patch.
admin_pages/transactions/EE_Admin_Transactions_List_Table.class.php 4 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -93,7 +93,7 @@
 block discarded – undo
93 93
 	 *
94 94
 	 * @abstract
95 95
 	 * @access protected
96
-	 * @return array
96
+	 * @return string[]
97 97
 	 */
98 98
 	protected function _get_table_filters() {
99 99
 		$filters = array();
Please login to merge, or discard this patch.
Indentation   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -1,26 +1,26 @@  discard block
 block discarded – undo
1 1
 <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
2 2
 /**
3
- * Event Espresso
4
- *
5
- * Event Registration and Management Plugin for WordPress
6
- *
7
- * @ package	Event Espresso
8
- * @ author		Seth Shoultes
9
- * @ copyright	(c) 2008-2011 Event Espresso  All Rights Reserved.
10
- * @ license	{@link http://eventespresso.com/support/terms-conditions/}   * see Plugin Licensing *
11
- * @ link		{@link http://www.eventespresso.com}
12
- * @ since		4.0
13
- *
14
- * ------------------------------------------------------------------------
15
- *
16
- * Transactions Table class
17
- *
18
- * @package				Event Espresso
19
- * @subpackage			includes/admin_screens/Transactions_List_Table.class.php
20
- * @author					Brent Christensen
21
- *
22
- * ------------------------------------------------------------------------
23
- */
3
+					 * Event Espresso
4
+					 *
5
+					 * Event Registration and Management Plugin for WordPress
6
+					 *
7
+					 * @ package	Event Espresso
8
+					 * @ author		Seth Shoultes
9
+					 * @ copyright	(c) 2008-2011 Event Espresso  All Rights Reserved.
10
+					 * @ license	{@link http://eventespresso.com/support/terms-conditions/}   * see Plugin Licensing *
11
+					 * @ link		{@link http://www.eventespresso.com}
12
+					 * @ since		4.0
13
+					 *
14
+					 * ------------------------------------------------------------------------
15
+					 *
16
+					 * Transactions Table class
17
+					 *
18
+					 * @package				Event Espresso
19
+					 * @subpackage			includes/admin_screens/Transactions_List_Table.class.php
20
+					 * @author					Brent Christensen
21
+					 *
22
+					 * ------------------------------------------------------------------------
23
+					 */
24 24
 
25 25
 
26 26
 class EE_Admin_Transactions_List_Table extends EE_Admin_List_Table {
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
 	 * @return string
129 129
 	 */
130 130
    function column_TXN_ID( EE_Transaction $item ){
131
-    	$view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->ID() ), TXN_ADMIN_URL );
131
+		$view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->ID() ), TXN_ADMIN_URL );
132 132
 				return '<a href="' . $view_lnk_url . '" title="' . esc_attr__( 'Go to Transaction Details', 'event_espresso' ) . '">' . $item->ID() . '</a>';
133 133
 	}
134 134
 
@@ -257,8 +257,8 @@  discard block
 block discarded – undo
257 257
 	 * @param \EE_Transaction $item
258 258
 	 * @return string|void
259 259
 	 */
260
-    function column_event_name( EE_Transaction $item ){
261
-    	$actions = array();
260
+	function column_event_name( EE_Transaction $item ){
261
+		$actions = array();
262 262
 		$event = $item->primary_registration()->get_first_related('Event');
263 263
 		if ( !empty( $event ) ) {
264 264
 			$edit_event_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'edit', 'post'=>$event->ID() ), EVENTS_ADMIN_URL );
@@ -282,13 +282,13 @@  discard block
 block discarded – undo
282 282
 	 * @param \EE_Transaction $item
283 283
 	 * @return string
284 284
 	 */
285
-    function column_actions( EE_Transaction $item ){
285
+	function column_actions( EE_Transaction $item ){
286 286
 
287
-    	$registration = $item->primary_registration();
288
-    	$attendee = $registration->attendee();
287
+		$registration = $item->primary_registration();
288
+		$attendee = $registration->attendee();
289 289
 		EE_Registry::instance()->load_helper( 'MSG_Template' );
290 290
 
291
-        //Build row actions
291
+		//Build row actions
292 292
 		$view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->ID() ), TXN_ADMIN_URL );
293 293
 		$dl_invoice_lnk_url = $registration->invoice_url();
294 294
 		$dl_receipt_lnk_url = $registration->receipt_url();
@@ -328,8 +328,8 @@  discard block
 block discarded – undo
328 328
 		$dl_receipt_lnk = '';
329 329
 	}
330 330
 
331
-      		//only show payment reminder link if the message type is active.
332
-      		if ( EEH_MSG_Template::is_mt_active( 'payment_reminder' ) ) {
331
+	  		//only show payment reminder link if the message type is active.
332
+	  		if ( EEH_MSG_Template::is_mt_active( 'payment_reminder' ) ) {
333 333
 		$send_pay_lnk = $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_transactions_send_payment_reminder' ) ? '
334 334
 			<li>
335 335
 				<a href="'.$send_pay_lnk_url.'" title="' . esc_attr__( 'Send Payment Reminder', 'event_espresso' ) . '" class="tiny-text">
@@ -349,7 +349,7 @@  discard block
 block discarded – undo
349 349
 			</li>' : '';
350 350
 
351 351
 	return $this->_action_string( $view_lnk . $dl_invoice_lnk . $dl_receipt_lnk . $view_reg_lnk . $send_pay_lnk, $item, 'ul', 'txn-overview-actions-ul' );
352
-    }
352
+	}
353 353
 
354 354
 
355 355
 }
Please login to merge, or discard this patch.
Braces   +8 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@  discard block
 block discarded – undo
1
-<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 /**
3 5
  * Event Espresso
4 6
  *
@@ -244,10 +246,11 @@  discard block
 block discarded – undo
244 246
 	 */
245 247
 	function column_ATT_email( EE_Transaction $item ){
246 248
 		$attendee = $item->primary_registration()->get_first_related('Attendee');
247
-		if ( !empty( $attendee ) )
248
-			return '<a href="mailto:' . $attendee->get('ATT_email') . '">' . $attendee->get('ATT_email') . '</a>';
249
-		else
250
-			return $item->failed() || $item->is_abandoned() ? __('no contact record.', 'event_espresso') : __('No contact record, because the transaction was abandoned or the registration process failed.', 'event_espresso');
249
+		if ( !empty( $attendee ) ) {
250
+					return '<a href="mailto:' . $attendee->get('ATT_email') . '">' . $attendee->get('ATT_email') . '</a>';
251
+		} else {
252
+					return $item->failed() || $item->is_abandoned() ? __('no contact record.', 'event_espresso') : __('No contact record, because the transaction was abandoned or the registration process failed.', 'event_espresso');
253
+		}
251 254
 		;
252 255
 	}
253 256
 
Please login to merge, or discard this patch.
Spacing   +80 added lines, -80 removed lines patch added patch discarded remove patch
@@ -33,8 +33,8 @@  discard block
 block discarded – undo
33 33
 	 * @param \EE_Admin_Page $admin_page
34 34
 	 * @return EE_Admin_Transactions_List_Table
35 35
 	 */
36
-	function __construct( EE_Admin_Page $admin_page ){
37
-   		parent::__construct( $admin_page );
36
+	function __construct(EE_Admin_Page $admin_page) {
37
+   		parent::__construct($admin_page);
38 38
    		$this->_status = $this->_admin_page->get_transaction_status_array();
39 39
 
40 40
 	}
@@ -44,9 +44,9 @@  discard block
 block discarded – undo
44 44
 
45 45
 
46 46
 	protected function _setup_data() {
47
-		$this->_data = $this->_admin_page->get_transactions( $this->_per_page );
48
-		$status = ! empty( $this->_req_data['status'] )? $this->_req_data['status'] : 'all';
49
-		$this->_all_data_count = $this->_admin_page->get_transactions( $this->_per_page, TRUE, $status );
47
+		$this->_data = $this->_admin_page->get_transactions($this->_per_page);
48
+		$status = ! empty($this->_req_data['status']) ? $this->_req_data['status'] : 'all';
49
+		$this->_all_data_count = $this->_admin_page->get_transactions($this->_per_page, TRUE, $status);
50 50
 	}
51 51
 
52 52
 
@@ -65,20 +65,20 @@  discard block
 block discarded – undo
65 65
 			);
66 66
 
67 67
 		$this->_columns = array(
68
-			'TXN_ID' => __( 'ID', 'event_espresso' ),
69
-			'TXN_timestamp'	=> __( 'Transaction Date', 'event_espresso' ),
70
-			'TXN_total' => __( 'Total', 'event_espresso' ),
71
-			'TXN_paid' => __( 'Paid', 'event_espresso' ),
72
-			'ATT_fname' => __( 'Primary Registrant', 'event_espresso' ),
73
-			'event_name' => __( 'Event', 'event_espresso' ),
74
-			'actions' => __( 'Actions', 'event_espresso' )
68
+			'TXN_ID' => __('ID', 'event_espresso'),
69
+			'TXN_timestamp'	=> __('Transaction Date', 'event_espresso'),
70
+			'TXN_total' => __('Total', 'event_espresso'),
71
+			'TXN_paid' => __('Paid', 'event_espresso'),
72
+			'ATT_fname' => __('Primary Registrant', 'event_espresso'),
73
+			'event_name' => __('Event', 'event_espresso'),
74
+			'actions' => __('Actions', 'event_espresso')
75 75
 		);
76 76
 
77 77
 		$this->_sortable_columns = array(
78
-			'TXN_ID' => array( 'TXN_ID' => FALSE ),
79
-			'event_name' => array( 'event_name'=> FALSE ),
80
-			'ATT_fname'	=> array( 'ATT_fname'=> FALSE ),
81
-			'TXN_timestamp'	=> array( 'TXN_timestamp'=> TRUE ) //true means its already sorted
78
+			'TXN_ID' => array('TXN_ID' => FALSE),
79
+			'event_name' => array('event_name'=> FALSE),
80
+			'ATT_fname'	=> array('ATT_fname'=> FALSE),
81
+			'TXN_timestamp'	=> array('TXN_timestamp'=> TRUE) //true means its already sorted
82 82
 		);
83 83
 
84 84
 		$this->_primary_column = 'TXN_ID';
@@ -88,11 +88,11 @@  discard block
 block discarded – undo
88 88
 
89 89
 
90 90
 
91
-	protected function _get_row_class( $item ) {
92
-		$class = parent::_get_row_class( $item );
91
+	protected function _get_row_class($item) {
92
+		$class = parent::_get_row_class($item);
93 93
 		//add status class
94
-		$class .= ' ee-status-strip txn-status-' . $item->status_ID();
95
-		if ( $this->_has_checkbox_column ) {
94
+		$class .= ' ee-status-strip txn-status-'.$item->status_ID();
95
+		if ($this->_has_checkbox_column) {
96 96
 			$class .= ' has-checkbox-column';
97 97
 		}
98 98
 		return $class;
@@ -109,8 +109,8 @@  discard block
 block discarded – undo
109 109
 	 */
110 110
 	protected function _get_table_filters() {
111 111
 		$filters = array();
112
-		$start_date = isset( $this->_req_data['txn-filter-start-date'] ) ? wp_strip_all_tags( $this->_req_data['txn-filter-start-date'] ) : date( 'm/d/Y', strtotime( '-10 year' ));
113
-		$end_date = isset( $this->_req_data['txn-filter-end-date'] ) ? wp_strip_all_tags( $this->_req_data['txn-filter-end-date'] ) : date( 'm/d/Y' );
112
+		$start_date = isset($this->_req_data['txn-filter-start-date']) ? wp_strip_all_tags($this->_req_data['txn-filter-start-date']) : date('m/d/Y', strtotime('-10 year'));
113
+		$end_date = isset($this->_req_data['txn-filter-end-date']) ? wp_strip_all_tags($this->_req_data['txn-filter-end-date']) : date('m/d/Y');
114 114
 		ob_start();
115 115
 		?>
116 116
 		<label for="txn-filter-start-date">Display Transactions from </label>
@@ -128,9 +128,9 @@  discard block
 block discarded – undo
128 128
 
129 129
 
130 130
 	protected function _add_view_counts() {
131
-		$this->_views['all']['count'] = $this->_admin_page->get_transactions( $this->_per_page, TRUE, 'all' );
132
-		$this->_views['abandoned']['count'] = $this->_admin_page->get_transactions( $this->_per_page, TRUE, 'abandoned' );
133
-		$this->_views['failed']['count'] = $this->_admin_page->get_transactions( $this->_per_page, TRUE, 'failed' );
131
+		$this->_views['all']['count'] = $this->_admin_page->get_transactions($this->_per_page, TRUE, 'all');
132
+		$this->_views['abandoned']['count'] = $this->_admin_page->get_transactions($this->_per_page, TRUE, 'abandoned');
133
+		$this->_views['failed']['count'] = $this->_admin_page->get_transactions($this->_per_page, TRUE, 'failed');
134 134
 	}
135 135
 
136 136
 
@@ -139,29 +139,29 @@  discard block
 block discarded – undo
139 139
 	 * @param \EE_Transaction $item
140 140
 	 * @return string
141 141
 	 */
142
-   function column_TXN_ID( EE_Transaction $item ){
143
-    	$view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->ID() ), TXN_ADMIN_URL );
144
-	   $content = '<a href="' . $view_lnk_url . '" title="' . esc_attr__( 'Go to Transaction Details', 'event_espresso' ) . '">' . $item->ID() . '</a>';
142
+   function column_TXN_ID(EE_Transaction $item) {
143
+    	$view_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$item->ID()), TXN_ADMIN_URL);
144
+	   $content = '<a href="'.$view_lnk_url.'" title="'.esc_attr__('Go to Transaction Details', 'event_espresso').'">'.$item->ID().'</a>';
145 145
 
146 146
 	   //txn timestamp
147
-	   $content .= '  <span class="show-on-mobile-view-only">' . $this->_get_txn_timestamp( $item ) . '</span>';
147
+	   $content .= '  <span class="show-on-mobile-view-only">'.$this->_get_txn_timestamp($item).'</span>';
148 148
 	   return $content;
149 149
 	}
150 150
 
151 151
 
152 152
 
153
-	protected function _get_txn_timestamp( EE_Transaction $item ) {
153
+	protected function _get_txn_timestamp(EE_Transaction $item) {
154 154
 		//txn timestamp
155 155
 		// is TXN less than 2 hours old ?
156 156
 		if (
157
-			( ( time() - EE_Registry::instance()->SSN->lifespan() )
158
-			< $item->datetime( false, true )
157
+			((time() - EE_Registry::instance()->SSN->lifespan())
158
+			< $item->datetime(false, true)
159 159
 			)
160
-		&& ( $item->failed() || $item->is_abandoned() )
160
+		&& ($item->failed() || $item->is_abandoned())
161 161
 		) {
162
-			$timestamp = __( 'TXN in progress...', 'event_espresso' );
162
+			$timestamp = __('TXN in progress...', 'event_espresso');
163 163
 	   } else {
164
-			$timestamp = $item->get_i18n_datetime( 'TXN_timestamp' );
164
+			$timestamp = $item->get_i18n_datetime('TXN_timestamp');
165 165
 		}
166 166
 		return $timestamp;
167 167
 	}
@@ -173,8 +173,8 @@  discard block
 block discarded – undo
173 173
 	 * @param \EE_Transaction $item
174 174
 	 * @return string
175 175
 	 */
176
-	function column_cb($item ){
177
-		return sprintf( '<input type="checkbox" name="%1$s[]" value="%2$s" />', $this->_wp_list_args['singular'],  $item->ID());
176
+	function column_cb($item) {
177
+		return sprintf('<input type="checkbox" name="%1$s[]" value="%2$s" />', $this->_wp_list_args['singular'], $item->ID());
178 178
 	}
179 179
 
180 180
 
@@ -185,9 +185,9 @@  discard block
 block discarded – undo
185 185
 	 * @param \EE_Transaction $item
186 186
 	 * @return string
187 187
 	 */
188
-	function column_TXN_timestamp( EE_Transaction $item ){
189
-		$view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->ID() ), TXN_ADMIN_URL );
190
-		$txn_date = '<a href="'.$view_lnk_url.'" title="' . esc_attr__( 'View Transaction Details for TXN #', 'event_espresso' ) . $item->ID() . '">' . $this->_get_txn_timestamp( $item ) . '</a>';
188
+	function column_TXN_timestamp(EE_Transaction $item) {
189
+		$view_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$item->ID()), TXN_ADMIN_URL);
190
+		$txn_date = '<a href="'.$view_lnk_url.'" title="'.esc_attr__('View Transaction Details for TXN #', 'event_espresso').$item->ID().'">'.$this->_get_txn_timestamp($item).'</a>';
191 191
 		return $txn_date;
192 192
 	}
193 193
 
@@ -197,11 +197,11 @@  discard block
 block discarded – undo
197 197
 	 * @param \EE_Transaction $item
198 198
 	 * @return string
199 199
 	 */
200
-	function column_TXN_total( EE_Transaction $item ){
201
-		if ( $item->get('TXN_total') > 0 ) {
202
-			return '<span class="txn-pad-rght">' . apply_filters( 'FHEE__EE_Admin_Transactions_List_Table__column_TXN_total__TXN_total', $item->get_pretty('TXN_total'), $item ) . '</span>';
200
+	function column_TXN_total(EE_Transaction $item) {
201
+		if ($item->get('TXN_total') > 0) {
202
+			return '<span class="txn-pad-rght">'.apply_filters('FHEE__EE_Admin_Transactions_List_Table__column_TXN_total__TXN_total', $item->get_pretty('TXN_total'), $item).'</span>';
203 203
 		} else {
204
-			return '<span class="txn-overview-free-event-spn">' . __( 'free', 'event_espresso' ) . '</span>';
204
+			return '<span class="txn-overview-free-event-spn">'.__('free', 'event_espresso').'</span>';
205 205
 		}
206 206
 	}
207 207
 
@@ -211,19 +211,19 @@  discard block
 block discarded – undo
211 211
 	 * @param \EE_Transaction $item
212 212
 	 * @return mixed|string
213 213
 	 */
214
-	function column_TXN_paid( EE_Transaction $item ){
214
+	function column_TXN_paid(EE_Transaction $item) {
215 215
 		$transaction_total = $item->get('TXN_total');
216 216
 		$transaction_paid = $item->get('TXN_paid');
217 217
 
218
-		if (( $transaction_total > 0 ) && ( $transaction_paid >= $transaction_total )) {
218
+		if (($transaction_total > 0) && ($transaction_paid >= $transaction_total)) {
219 219
 			// paid in full
220 220
 			$span_class = 'txn-overview-full-payment-spn';
221 221
 
222
-		} elseif (( $transaction_total > 0 ) && ( $transaction_paid > 0 )) {
222
+		} elseif (($transaction_total > 0) && ($transaction_paid > 0)) {
223 223
 			// monies owing
224 224
 			$span_class = 'txn-overview-part-payment-spn';
225 225
 
226
-		} elseif (( $transaction_total > 0 ) && ( $transaction_paid == 0 )) {
226
+		} elseif (($transaction_total > 0) && ($transaction_paid == 0)) {
227 227
 			// no payments made
228 228
 			$span_class = 'txn-overview-no-payment-spn';
229 229
 
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
 			$transaction_paid = 0;
233 233
 		}
234 234
 
235
-		return '<span class="' . $span_class . ' txn-pad-rght">' . $transaction_paid !== 0 ? $item->get_pretty('TXN_paid') : $transaction_paid . '</span>';
235
+		return '<span class="'.$span_class.' txn-pad-rght">'.$transaction_paid !== 0 ? $item->get_pretty('TXN_paid') : $transaction_paid.'</span>';
236 236
 
237 237
 	}
238 238
 
@@ -242,13 +242,13 @@  discard block
 block discarded – undo
242 242
 	 * @param \EE_Transaction $item
243 243
 	 * @return string|void
244 244
 	 */
245
-	function column_ATT_fname( EE_Transaction $item ){
245
+	function column_ATT_fname(EE_Transaction $item) {
246 246
 		$primary_reg = $item->primary_registration();
247 247
 		$attendee = $primary_reg->get_first_related('Attendee');
248
-		if ( $attendee instanceof EE_Attendee ) {
249
-			$edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_registration', '_REG_ID'=>$primary_reg->ID() ), REG_ADMIN_URL );
250
-			$content = EE_Registry::instance()->CAP->current_user_can( 'ee_read_registration', 'espresso_registrations_view_registration', $primary_reg->ID() ) ? '<a href="'.$edit_lnk_url.'" title="' . esc_attr__( 'View Registration Details', 'event_espresso' ) . '">' . $attendee->full_name() . '</a>' : $attendee->full_name();
251
-			$content .= '<br>' . $attendee->email();
248
+		if ($attendee instanceof EE_Attendee) {
249
+			$edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_registration', '_REG_ID'=>$primary_reg->ID()), REG_ADMIN_URL);
250
+			$content = EE_Registry::instance()->CAP->current_user_can('ee_read_registration', 'espresso_registrations_view_registration', $primary_reg->ID()) ? '<a href="'.$edit_lnk_url.'" title="'.esc_attr__('View Registration Details', 'event_espresso').'">'.$attendee->full_name().'</a>' : $attendee->full_name();
251
+			$content .= '<br>'.$attendee->email();
252 252
 			return $content;
253 253
 		}
254 254
 		return $item->failed() || $item->is_abandoned() ? __('no contact record.', 'event_espresso') : __('No contact record, because the transaction was abandoned or the registration process failed.', 'event_espresso');
@@ -260,10 +260,10 @@  discard block
 block discarded – undo
260 260
 	 * @param \EE_Transaction $item
261 261
 	 * @return string|void
262 262
 	 */
263
-	function column_ATT_email( EE_Transaction $item ){
263
+	function column_ATT_email(EE_Transaction $item) {
264 264
 		$attendee = $item->primary_registration()->get_first_related('Attendee');
265
-		if ( !empty( $attendee ) )
266
-			return '<a href="mailto:' . $attendee->get('ATT_email') . '">' . $attendee->get('ATT_email') . '</a>';
265
+		if ( ! empty($attendee))
266
+			return '<a href="mailto:'.$attendee->get('ATT_email').'">'.$attendee->get('ATT_email').'</a>';
267 267
 		else
268 268
 			return $item->failed() || $item->is_abandoned() ? __('no contact record.', 'event_espresso') : __('No contact record, because the transaction was abandoned or the registration process failed.', 'event_espresso');
269 269
 		;
@@ -275,20 +275,20 @@  discard block
 block discarded – undo
275 275
 	 * @param \EE_Transaction $item
276 276
 	 * @return string|void
277 277
 	 */
278
-    function column_event_name( EE_Transaction $item ){
278
+    function column_event_name(EE_Transaction $item) {
279 279
     	$actions = array();
280 280
 		$event = $item->primary_registration()->get_first_related('Event');
281
-		if ( !empty( $event ) ) {
282
-			$edit_event_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'edit', 'post'=>$event->ID() ), EVENTS_ADMIN_URL );
281
+		if ( ! empty($event)) {
282
+			$edit_event_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'edit', 'post'=>$event->ID()), EVENTS_ADMIN_URL);
283 283
 			$event_name = $event->get('EVT_name');
284 284
 
285 285
 			//filter this view by transactions for this event
286
-			$txn_by_event_lnk = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'default', 'EVT_ID' => $event->ID() ) );
287
-			if ( EE_Registry::instance()->CAP->current_user_can( 'ee_edit_event', 'espresso_events_edit', $event->ID() ) ) {
288
-				$actions['filter_by_event'] = '<a href="' . $txn_by_event_lnk . '" title="' . esc_attr__('Filter transactions by this event', 'event_espresso') . '">' . __('View Transactions for this event', 'event_espresso') . '</a>';
286
+			$txn_by_event_lnk = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'default', 'EVT_ID' => $event->ID()));
287
+			if (EE_Registry::instance()->CAP->current_user_can('ee_edit_event', 'espresso_events_edit', $event->ID())) {
288
+				$actions['filter_by_event'] = '<a href="'.$txn_by_event_lnk.'" title="'.esc_attr__('Filter transactions by this event', 'event_espresso').'">'.__('View Transactions for this event', 'event_espresso').'</a>';
289 289
 			}
290 290
 
291
-			return sprintf('%1$s %2$s', EE_Registry::instance()->CAP->current_user_can( 'ee_edit_event', 'espresso_events_edit', $event->ID() ) ? '<a href="' . $edit_event_url . '" title="' . sprintf( esc_attr__( 'Edit Event: %s', 'event_espresso' ), $event->get('EVT_name') ) .'">' .  wp_trim_words( $event_name, 30, '...' ) . '</a>' : wp_trim_words( $event_name, 30, '...' ), $this->row_actions($actions) );
291
+			return sprintf('%1$s %2$s', EE_Registry::instance()->CAP->current_user_can('ee_edit_event', 'espresso_events_edit', $event->ID()) ? '<a href="'.$edit_event_url.'" title="'.sprintf(esc_attr__('Edit Event: %s', 'event_espresso'), $event->get('EVT_name')).'">'.wp_trim_words($event_name, 30, '...').'</a>' : wp_trim_words($event_name, 30, '...'), $this->row_actions($actions));
292 292
 		} else {
293 293
 			return __('The event associated with this transaction via the primary registration cannot be retrieved.', 'event_espresso');
294 294
 		}
@@ -300,33 +300,33 @@  discard block
 block discarded – undo
300 300
 	 * @param \EE_Transaction $item
301 301
 	 * @return string
302 302
 	 */
303
-    function column_actions( EE_Transaction $item ){
303
+    function column_actions(EE_Transaction $item) {
304 304
 
305 305
     	$registration = $item->primary_registration();
306 306
     	$attendee = $registration->attendee();
307
-		EE_Registry::instance()->load_helper( 'MSG_Template' );
307
+		EE_Registry::instance()->load_helper('MSG_Template');
308 308
 
309 309
         //Build row actions
310
-		$view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->ID() ), TXN_ADMIN_URL );
310
+		$view_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$item->ID()), TXN_ADMIN_URL);
311 311
 		$dl_invoice_lnk_url = $registration->invoice_url();
312 312
 		$dl_receipt_lnk_url = $registration->receipt_url();
313
-		$view_reg_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_registration', '_REG_ID'=>$registration->ID() ), REG_ADMIN_URL );
314
-		$send_pay_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'send_payment_reminder', 'TXN_ID'=>$item->ID() ), TXN_ADMIN_URL );
313
+		$view_reg_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_registration', '_REG_ID'=>$registration->ID()), REG_ADMIN_URL);
314
+		$send_pay_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'send_payment_reminder', 'TXN_ID'=>$item->ID()), TXN_ADMIN_URL);
315 315
 
316 316
 		//Build row actions
317 317
 		$view_lnk = '
318 318
 			<li>
319
-				<a href="'.$view_lnk_url.'" title="' . esc_attr__( 'View Transaction Details', 'event_espresso' ) . '" class="tiny-text">
319
+				<a href="'.$view_lnk_url.'" title="'.esc_attr__('View Transaction Details', 'event_espresso').'" class="tiny-text">
320 320
 					<span class="dashicons dashicons-cart"></span>
321 321
 				</a>
322 322
 			</li>';
323 323
 
324 324
 
325 325
 	//only show invoice link if message type is active.
326
-	if ( $attendee instanceof EE_Attendee && EEH_MSG_Template::is_mt_active( 'invoice' ) ) {
326
+	if ($attendee instanceof EE_Attendee && EEH_MSG_Template::is_mt_active('invoice')) {
327 327
 		$dl_invoice_lnk = '
328 328
 		<li>
329
-			<a title="' . esc_attr__( 'View Transaction Invoice', 'event_espresso' ) . '" target="_blank" href="'.$dl_invoice_lnk_url.'" class="tiny-text">
329
+			<a title="' . esc_attr__('View Transaction Invoice', 'event_espresso').'" target="_blank" href="'.$dl_invoice_lnk_url.'" class="tiny-text">
330 330
 				<span class="dashicons dashicons-media-spreadsheet ee-icon-size-18"></span>
331 331
 			</a>
332 332
 		</li>';
@@ -335,10 +335,10 @@  discard block
 block discarded – undo
335 335
 	}
336 336
 
337 337
 	//only show receipt link if message type is active.
338
-	if ( $attendee instanceof EE_Attendee && EEH_MSG_Template::is_mt_active( 'receipt' ) ) {
338
+	if ($attendee instanceof EE_Attendee && EEH_MSG_Template::is_mt_active('receipt')) {
339 339
 		$dl_receipt_lnk = '
340 340
 		<li>
341
-			<a title="' . esc_attr__( 'View Transaction Receipt', 'event_espresso' ) . '" target="_blank" href="'.$dl_receipt_lnk_url.'" class="tiny-text">
341
+			<a title="' . esc_attr__('View Transaction Receipt', 'event_espresso').'" target="_blank" href="'.$dl_receipt_lnk_url.'" class="tiny-text">
342 342
 				<span class="dashicons dashicons-media-default ee-icon-size-18"></span>
343 343
 			</a>
344 344
 		</li>';
@@ -347,10 +347,10 @@  discard block
 block discarded – undo
347 347
 	}
348 348
 
349 349
       		//only show payment reminder link if the message type is active.
350
-      		if ( EEH_MSG_Template::is_mt_active( 'payment_reminder' ) ) {
351
-		$send_pay_lnk = $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_transactions_send_payment_reminder' ) ? '
350
+      		if (EEH_MSG_Template::is_mt_active('payment_reminder')) {
351
+		$send_pay_lnk = $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_transactions_send_payment_reminder') ? '
352 352
 			<li>
353
-				<a href="'.$send_pay_lnk_url.'" title="' . esc_attr__( 'Send Payment Reminder', 'event_espresso' ) . '" class="tiny-text">
353
+				<a href="'.$send_pay_lnk_url.'" title="'.esc_attr__('Send Payment Reminder', 'event_espresso').'" class="tiny-text">
354 354
 					<span class="dashicons dashicons-email-alt"></span>
355 355
 				</a>
356 356
 			</li>' : '';
@@ -359,14 +359,14 @@  discard block
 block discarded – undo
359 359
 			$send_pay_lnk = '';
360 360
 		}
361 361
 
362
-		$view_reg_lnk = EE_Registry::instance()->CAP->current_user_can( 'ee_read_registration', 'espresso_registrations_view_registration', $registration->ID() ) ? '
362
+		$view_reg_lnk = EE_Registry::instance()->CAP->current_user_can('ee_read_registration', 'espresso_registrations_view_registration', $registration->ID()) ? '
363 363
 			<li>
364
-				<a href="'.$view_reg_lnk_url.'" title="' . esc_attr__( 'View Registration Details', 'event_espresso' ) . '" class="tiny-text">
364
+				<a href="'.$view_reg_lnk_url.'" title="'.esc_attr__('View Registration Details', 'event_espresso').'" class="tiny-text">
365 365
 					<span class="dashicons dashicons-clipboard"></span>
366 366
 				</a>
367 367
 			</li>' : '';
368 368
 
369
-	return $this->_action_string( $view_lnk . $dl_invoice_lnk . $dl_receipt_lnk . $view_reg_lnk . $send_pay_lnk, $item, 'ul', 'txn-overview-actions-ul' );
369
+	return $this->_action_string($view_lnk.$dl_invoice_lnk.$dl_receipt_lnk.$view_reg_lnk.$send_pay_lnk, $item, 'ul', 'txn-overview-actions-ul');
370 370
     }
371 371
 
372 372
 
Please login to merge, or discard this patch.
admin/extend/messages/espresso_events_Messages_Hooks_Extend.class.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -94,7 +94,7 @@
 block discarded – undo
94 94
 	 * Handles attaching Message Templates to the Event on save.
95 95
 	 * @param  EE_Event $evtobj EE event object
96 96
 	 * @param  array       $data   The request data from the form
97
-	 * @return bool         success or fail
97
+	 * @return integer         success or fail
98 98
 	 */
99 99
 	public function attach_evt_message_templates( $evtobj, $data ) {
100 100
 		//first we remove all existing relations on the Event for message types.
Please login to merge, or discard this patch.
Spacing   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (!defined('EVENT_ESPRESSO_VERSION') )
2
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
3 3
 	exit('NO direct script access allowed');
4 4
 
5 5
 /**
@@ -30,15 +30,15 @@  discard block
 block discarded – undo
30 30
 class espresso_events_Messages_Hooks_Extend extends espresso_events_Messages_Hooks {
31 31
 
32 32
 
33
-	public function __construct( EE_Admin_Page $adminpage ) {
33
+	public function __construct(EE_Admin_Page $adminpage) {
34 34
 		/**
35 35
 		 * Add cap restriction ... metaboxes should not show if user does not have the ability to edit_custom_messages
36 36
 		 */
37
-		if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_edit_messages', 'messages_events_editor_metabox' ) ) {
37
+		if ( ! EE_Registry::instance()->CAP->current_user_can('ee_edit_messages', 'messages_events_editor_metabox')) {
38 38
 			return;
39 39
 		}
40
-		add_filter('FHEE__Events_Admin_Page___insert_update_cpt_item__event_update_callbacks', array( $this, 'caf_updates' ), 10 );
41
-		parent::__construct( $adminpage );
40
+		add_filter('FHEE__Events_Admin_Page___insert_update_cpt_item__event_update_callbacks', array($this, 'caf_updates'), 10);
41
+		parent::__construct($adminpage);
42 42
 	}
43 43
 
44 44
 	/**
@@ -49,13 +49,13 @@  discard block
 block discarded – undo
49 49
 	 */
50 50
 	protected function _extend_properties() {
51 51
 
52
-		define( 'EE_MSGS_EXTEND_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL . 'messages/assets/' );
52
+		define('EE_MSGS_EXTEND_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL.'messages/assets/');
53 53
 		$this->_ajax_func = array(
54 54
 			'ee_msgs_create_new_custom' => 'create_new_custom'
55 55
 			);
56 56
 		$this->_metaboxes = array(
57 57
 			0 => array(
58
-				'page_route' => array('edit','create_new'),
58
+				'page_route' => array('edit', 'create_new'),
59 59
 				'func' => 'messages_metabox',
60 60
 				'label' => __('Notifications', 'event_espresso'),
61 61
 				'priority' => 'high'
@@ -66,11 +66,11 @@  discard block
 block discarded – undo
66 66
 		$this->_scripts_styles = array(
67 67
 			'registers' => array(
68 68
 				'events_msg_admin' => array(
69
-					'url' => EE_MSGS_EXTEND_ASSETS_URL . 'events_messages_admin.js',
69
+					'url' => EE_MSGS_EXTEND_ASSETS_URL.'events_messages_admin.js',
70 70
 					'depends' => array('ee-dialog', 'ee-parse-uri', 'ee-serialize-full-array')
71 71
 					),
72 72
 				'events_msg_admin_css' => array(
73
-					'url' => EE_MSGS_EXTEND_ASSETS_URL . 'ee_msg_events_admin.css',
73
+					'url' => EE_MSGS_EXTEND_ASSETS_URL.'ee_msg_events_admin.css',
74 74
 					'type' => 'css'
75 75
 					)
76 76
 				),
@@ -82,8 +82,8 @@  discard block
 block discarded – undo
82 82
 	}
83 83
 
84 84
 
85
-	public function caf_updates( $update_callbacks ) {
86
-		$update_callbacks[] = array( $this, 'attach_evt_message_templates' );
85
+	public function caf_updates($update_callbacks) {
86
+		$update_callbacks[] = array($this, 'attach_evt_message_templates');
87 87
 		return $update_callbacks;
88 88
 	}
89 89
 
@@ -96,13 +96,13 @@  discard block
 block discarded – undo
96 96
 	 * @param  array       $data   The request data from the form
97 97
 	 * @return bool         success or fail
98 98
 	 */
99
-	public function attach_evt_message_templates( $evtobj, $data ) {
99
+	public function attach_evt_message_templates($evtobj, $data) {
100 100
 		//first we remove all existing relations on the Event for message types.
101 101
 		$evtobj->_remove_relations('Message_Template_Group');
102 102
 
103 103
 		//now let's just loop throught the selected templates and add relations!
104
-		foreach( $data['event_message_templates_relation'] as $grp_ID ) {
105
-			$evtobj->_add_relation_to( $grp_ID, 'Message_Template_Group' );
104
+		foreach ($data['event_message_templates_relation'] as $grp_ID) {
105
+			$evtobj->_add_relation_to($grp_ID, 'Message_Template_Group');
106 106
 		}
107 107
 
108 108
 		//now save
@@ -115,10 +115,10 @@  discard block
 block discarded – undo
115 115
 
116 116
 		//let's get the active messengers (b/c messenger objects have the active message templates)
117 117
 		//convert 'evt_id' to 'EVT_ID'
118
-		$this->_req_data['EVT_ID'] = isset( $this->_req_data['EVT_ID'] ) ? $this->_req_data['EVT_ID'] : NULL;
119
-		$this->_req_data['EVT_ID'] = isset( $this->_req_data['post'] ) && empty( $this->_req_data['EVT_ID'] ) ? $this->_req_data['post'] : $this->_req_data['EVT_ID'];
118
+		$this->_req_data['EVT_ID'] = isset($this->_req_data['EVT_ID']) ? $this->_req_data['EVT_ID'] : NULL;
119
+		$this->_req_data['EVT_ID'] = isset($this->_req_data['post']) && empty($this->_req_data['EVT_ID']) ? $this->_req_data['post'] : $this->_req_data['EVT_ID'];
120 120
 
121
-		$this->_req_data['EVT_ID'] = empty($this->_req_data['EVT_ID'] ) && isset($this->_req_data['evt_id'] ) ? $this->_req_data['evt_id'] : $this->_req_data['EVT_ID'];
121
+		$this->_req_data['EVT_ID'] = empty($this->_req_data['EVT_ID']) && isset($this->_req_data['evt_id']) ? $this->_req_data['evt_id'] : $this->_req_data['EVT_ID'];
122 122
 
123 123
 
124 124
 		$EEM_controller = new EE_messages;
@@ -127,11 +127,11 @@  discard block
 block discarded – undo
127 127
 
128 128
 		//empty messengers?
129 129
 		//Note message types will always have at least one available because every messenger has a default message type associated with it (payment) if no other message types are selected.
130
-		if ( empty( $active_messengers ) ) {
131
-			$msg_activate_url = EE_Admin_Page::add_query_args_and_nonce( array('action' => 'settings'), EE_MSG_ADMIN_URL );
132
-			$error_msg = sprintf( __('There are no active messengers. So no notifications will go out for <strong>any</strong> events.  You will want to %sActivate a Messenger%s.', 'event_espresso'), '<a href="' . $msg_activate_url . '">', '</a>');
133
-			$error_content = '<div class="error"><p>' . $error_msg . '</p></div>';
134
-			$internal_content = '<div id="messages-error"><p>' . $error_msg . '</p></div>';
130
+		if (empty($active_messengers)) {
131
+			$msg_activate_url = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'settings'), EE_MSG_ADMIN_URL);
132
+			$error_msg = sprintf(__('There are no active messengers. So no notifications will go out for <strong>any</strong> events.  You will want to %sActivate a Messenger%s.', 'event_espresso'), '<a href="'.$msg_activate_url.'">', '</a>');
133
+			$error_content = '<div class="error"><p>'.$error_msg.'</p></div>';
134
+			$internal_content = '<div id="messages-error"><p>'.$error_msg.'</p></div>';
135 135
 
136 136
 			echo $error_content;
137 137
 			echo $internal_content;
@@ -140,36 +140,36 @@  discard block
 block discarded – undo
140 140
 
141 141
 		$event_id = isset($this->_req_data['EVT_ID']) ? $this->_req_data['EVT_ID'] : NULL;
142 142
 		//get content for active messengers
143
-		foreach ( $active_messengers as $name => $messenger ) {
143
+		foreach ($active_messengers as $name => $messenger) {
144 144
 			//first check if there are any active message types for this messenger.
145
-			$active_mts = $EEM_controller->get_active_message_types_per_messenger( $name );
146
-			if ( empty( $active_mts ) ) {
145
+			$active_mts = $EEM_controller->get_active_message_types_per_messenger($name);
146
+			if (empty($active_mts)) {
147 147
 				continue;
148 148
 			}
149 149
 
150
-			$tcont = $messenger->get_messenger_admin_page_content('events', 'edit', array('event' => $event_id) );
150
+			$tcont = $messenger->get_messenger_admin_page_content('events', 'edit', array('event' => $event_id));
151 151
 
152
-			if ( ! empty( $tcont ) ) {
152
+			if ( ! empty($tcont)) {
153 153
 				$tabs[$name] = $tcont;
154 154
 			}
155 155
 		}
156 156
 
157 157
 
158
-		EE_Registry::instance()->load_helper( 'Tabbed_Content' );
158
+		EE_Registry::instance()->load_helper('Tabbed_Content');
159 159
 		//we want this to be tabbed content so let's use the EEH_Tabbed_Content::display helper.
160 160
 		$tabbed_content = EEH_Tabbed_Content::display($tabs);
161
-		if ( is_wp_error($tabbed_content) ) {
161
+		if (is_wp_error($tabbed_content)) {
162 162
 			$tabbed_content = $tabbed_content->get_error_message();
163 163
 		}
164 164
 
165 165
 		$notices = '<div id="espresso-ajax-loading" class="ajax-loader-grey">
166
-				<span class="ee-spinner ee-spin"></span><span class="hidden">' . __('loading...', 'event_espresso') . '</span>
166
+				<span class="ee-spinner ee-spin"></span><span class="hidden">' . __('loading...', 'event_espresso').'</span>
167 167
 			</div><div class="ee-notices"></div>';
168 168
 
169
-		if ( defined('DOING_AJAX' ) )
169
+		if (defined('DOING_AJAX'))
170 170
 			return $tabbed_content;
171 171
 
172
-		echo $notices . '<div class="messages-tabs-content">' . $tabbed_content . '</div>';
172
+		echo $notices.'<div class="messages-tabs-content">'.$tabbed_content.'</div>';
173 173
 
174 174
 	}
175 175
 
@@ -183,22 +183,22 @@  discard block
 block discarded – undo
183 183
 	 */
184 184
 	public function create_new_custom() {
185 185
 
186
-		if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_edit_messages', 'create_new_custom_ajax' ) ) {
187
-			wp_die( __('You don\'t have privileges to do this action', 'event_espresso' ) );
186
+		if ( ! EE_Registry::instance()->CAP->current_user_can('ee_edit_messages', 'create_new_custom_ajax')) {
187
+			wp_die(__('You don\'t have privileges to do this action', 'event_espresso'));
188 188
 		}
189 189
 
190 190
 		//let's clean up the _POST global a bit for downstream usage of name and description.
191
-		$_POST['templateName'] = !empty( $this->_req_data['custom_template_args']['MTP_name'] ) ? $this->_req_data['custom_template_args']['MTP_name'] : '';
192
-		$_POST['templateDescription'] = !empty( $this->_req_data['custom_template_args']['MTP_description'] ) ? $this->_req_data['custom_template_args']['MTP_description'] : '';
191
+		$_POST['templateName'] = ! empty($this->_req_data['custom_template_args']['MTP_name']) ? $this->_req_data['custom_template_args']['MTP_name'] : '';
192
+		$_POST['templateDescription'] = ! empty($this->_req_data['custom_template_args']['MTP_description']) ? $this->_req_data['custom_template_args']['MTP_description'] : '';
193 193
 
194 194
 
195 195
 		//set EE_Admin_Page object (see method details in EE_Admin_Hooks parent
196 196
 		$this->_set_page_object();
197 197
 
198 198
 		//is this a template switch if so EE_Admin_Page child needs this object
199
-		$this->_page_object->set_hook_object( $this );
199
+		$this->_page_object->set_hook_object($this);
200 200
 
201
-		$this->_page_object->add_message_template( $this->_req_data['messageType'], $this->_req_data['messenger'], $this->_req_data['group_ID'] );
201
+		$this->_page_object->add_message_template($this->_req_data['messageType'], $this->_req_data['messenger'], $this->_req_data['group_ID']);
202 202
 	}
203 203
 
204 204
 
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
 	 * @return string (admin_footer contents)
214 214
 	 */
215 215
 	public function edit_admin_footer() {
216
-		$template_path = EE_CORE_CAF_ADMIN_EXTEND . 'messages/templates/create_custom_template_form.template.php';
216
+		$template_path = EE_CORE_CAF_ADMIN_EXTEND.'messages/templates/create_custom_template_form.template.php';
217 217
 		EEH_Template::display_template($template_path, array());
218 218
 	}
219 219
 
Please login to merge, or discard this patch.
Braces   +5 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,6 +1,7 @@  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 6
 /**
6 7
  * Event Espresso
@@ -166,8 +167,9 @@  discard block
 block discarded – undo
166 167
 				<span class="ee-spinner ee-spin"></span><span class="hidden">' . __('loading...', 'event_espresso') . '</span>
167 168
 			</div><div class="ee-notices"></div>';
168 169
 
169
-		if ( defined('DOING_AJAX' ) )
170
-			return $tabbed_content;
170
+		if ( defined('DOING_AJAX' ) ) {
171
+					return $tabbed_content;
172
+		}
171 173
 
172 174
 		echo $notices . '<div class="messages-tabs-content">' . $tabbed_content . '</div>';
173 175
 
Please login to merge, or discard this patch.
admin/extend/registrations/Extend_Registrations_Admin_Page.core.php 4 patches
Doc Comments   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -478,7 +478,7 @@  discard block
 block discarded – undo
478 478
 	/**
479 479
 	 * 		generates Business Report showing total registratiopns per day
480 480
 	*		@access private
481
-	*		@return void
481
+	*		@return string
482 482
 	*/
483 483
 	private function _registrations_per_day_report( $period = '-1 month' ) {
484 484
 
@@ -535,7 +535,7 @@  discard block
 block discarded – undo
535 535
 	/**
536 536
 	 * 		generates Business Report showing total registratiopns per event
537 537
 	*		@access private
538
-	*		@return void
538
+	*		@return string
539 539
 	*/
540 540
 	private function _get_registrations_per_event_report( $period = '-1 month' ) {
541 541
 
@@ -650,8 +650,6 @@  discard block
 block discarded – undo
650 650
 	/**
651 651
 	 * 		handles toggleing the checkin status for the registration,
652 652
 	*		@access protected
653
-	*		@param boolean 	$check_in
654
-	*		@return void
655 653
 	*/
656 654
 	protected function _toggle_checkin_status() {
657 655
 		//first let's get the query args out of the way for the redirect
Please login to merge, or discard this patch.
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -447,9 +447,9 @@  discard block
 block discarded – undo
447 447
 
448 448
 	/**
449 449
 	 * 		generates Business Reports regarding Registrations
450
-	*		@access protected
451
-	*		@return void
452
-	*/
450
+	 *		@access protected
451
+	 *		@return void
452
+	 */
453 453
 	protected function _registration_reports() {
454 454
 
455 455
 		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
@@ -477,9 +477,9 @@  discard block
 block discarded – undo
477 477
 
478 478
 	/**
479 479
 	 * 		generates Business Report showing total registratiopns per day
480
-	*		@access private
481
-	*		@return void
482
-	*/
480
+	 *		@access private
481
+	 *		@return void
482
+	 */
483 483
 	private function _registrations_per_day_report( $period = '-1 month' ) {
484 484
 
485 485
 		$report_ID = 'reg-admin-registrations-per-day-report-dv';
@@ -534,9 +534,9 @@  discard block
 block discarded – undo
534 534
 
535 535
 	/**
536 536
 	 * 		generates Business Report showing total registratiopns per event
537
-	*		@access private
538
-	*		@return void
539
-	*/
537
+	 *		@access private
538
+	 *		@return void
539
+	 */
540 540
 	private function _get_registrations_per_event_report( $period = '-1 month' ) {
541 541
 
542 542
 		$report_ID = 'reg-admin-registrations-per-event-report-dv';
@@ -649,10 +649,10 @@  discard block
 block discarded – undo
649 649
 
650 650
 	/**
651 651
 	 * 		handles toggleing the checkin status for the registration,
652
-	*		@access protected
653
-	*		@param boolean 	$check_in
654
-	*		@return void
655
-	*/
652
+	 *		@access protected
653
+	 *		@param boolean 	$check_in
654
+	 *		@return void
655
+	 */
656 656
 	protected function _toggle_checkin_status() {
657 657
 		//first let's get the query args out of the way for the redirect
658 658
 		$query_args = array(
@@ -773,9 +773,9 @@  discard block
 block discarded – undo
773 773
 
774 774
 	/**
775 775
 	 * 		generates HTML for the Event Registrations List Table
776
-	*		@access protected
777
-	*		@return void
778
-	*/
776
+	 *		@access protected
777
+	 *		@return void
778
+	 */
779 779
 	protected function _event_registrations_list_table() {
780 780
 		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
781 781
 		$this->_admin_page_title .= isset( $this->_req_data['event_id'] ) ? $this->get_action_link_or_button('new_registration', 'add-registrant', array('event_id' => $this->_req_data['event_id']), 'add-new-h2') : '';
@@ -805,11 +805,11 @@  discard block
 block discarded – undo
805 805
 				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_approved,
806 806
 				'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_approved, FALSE, 'sentence' )
807 807
 				),
808
-            'cancelled_status' => array(
808
+			'cancelled_status' => array(
809 809
 				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_cancelled,
810 810
 				'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_cancelled, FALSE, 'sentence' )
811 811
 				),
812
-            'declined_status' => array(
812
+			'declined_status' => array(
813 813
 				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_declined,
814 814
 				'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_declined, FALSE, 'sentence' )
815 815
 				),
@@ -837,9 +837,9 @@  discard block
 block discarded – undo
837 837
 	/**
838 838
 	 * 		get_attendees
839 839
 	 * 		@param bool $count whether to return count or data.
840
-	*		@access public
841
-	*		@return array
842
-	*/
840
+	 *		@access public
841
+	 *		@return array
842
+	 */
843 843
 	public function get_event_attendees( $per_page = 10, $count = FALSE, $trash = FALSE, $orderby = '' ) {
844 844
 
845 845
 		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
Please login to merge, or discard this patch.
Spacing   +216 added lines, -216 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
 /**
@@ -29,11 +29,11 @@  discard block
 block discarded – undo
29 29
  */
30 30
 class Extend_Registrations_Admin_Page extends Registrations_Admin_Page {
31 31
 
32
-	public function __construct( $routing = TRUE ) {
33
-		parent::__construct( $routing );
34
-		define( 'REG_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND . 'registrations/templates/');
35
-		define( 'REG_CAF_ASSETS', EE_CORE_CAF_ADMIN_EXTEND . 'registrations/assets/');
36
-		define( 'REG_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL . 'registrations/assets/');
32
+	public function __construct($routing = TRUE) {
33
+		parent::__construct($routing);
34
+		define('REG_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND.'registrations/templates/');
35
+		define('REG_CAF_ASSETS', EE_CORE_CAF_ADMIN_EXTEND.'registrations/assets/');
36
+		define('REG_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL.'registrations/assets/');
37 37
 	}
38 38
 
39 39
 
@@ -42,11 +42,11 @@  discard block
 block discarded – undo
42 42
 
43 43
 
44 44
 	protected function _extend_page_config() {
45
-		$this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND . 'registrations';
45
+		$this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND.'registrations';
46 46
 
47
-		$reg_id = ! empty( $this->_req_data['_REG_ID'] ) && ! is_array( $this->_req_data['_REG_ID'] ) ? $this->_req_data['_REG_ID'] : 0;
48
-		$att_id = ! empty( $this->_req_data[ 'ATT_ID' ] ) ? ! is_array( $this->_req_data['ATT_ID'] ) : 0;
49
-		$att_id = ! empty( $this->_req_data['post'] ) && ! is_array( $this->_req_data['post'] ) ? $this->_req_data['post'] : $att_id;
47
+		$reg_id = ! empty($this->_req_data['_REG_ID']) && ! is_array($this->_req_data['_REG_ID']) ? $this->_req_data['_REG_ID'] : 0;
48
+		$att_id = ! empty($this->_req_data['ATT_ID']) ? ! is_array($this->_req_data['ATT_ID']) : 0;
49
+		$att_id = ! empty($this->_req_data['post']) && ! is_array($this->_req_data['post']) ? $this->_req_data['post'] : $att_id;
50 50
 
51 51
 		$new_page_routes = array(
52 52
 			'reports' => array(
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 				)
86 86
 			);
87 87
 
88
-		$this->_page_routes = array_merge( $this->_page_routes, $new_page_routes );
88
+		$this->_page_routes = array_merge($this->_page_routes, $new_page_routes);
89 89
 
90 90
 		$new_page_config = array(
91 91
 			'reports' => array(
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 						'filename' => 'registrations_reports'
100 100
 						)
101 101
 					),
102
-				'help_tour' => array( 'Registration_Reports_Help_Tour' ),
102
+				'help_tour' => array('Registration_Reports_Help_Tour'),
103 103
 				'require_nonce' => FALSE
104 104
 				),
105 105
 			'event_registrations' => array(
@@ -130,8 +130,8 @@  discard block
 block discarded – undo
130 130
 						'filename' => 'registrations_event_checkin_other'
131 131
 					)
132 132
 				),
133
-				'help_tour' => array( 'Event_Checkin_Help_Tour' ),
134
-				'qtips' => array('Registration_List_Table_Tips' ),
133
+				'help_tour' => array('Event_Checkin_Help_Tour'),
134
+				'qtips' => array('Registration_List_Table_Tips'),
135 135
 				'list_table' => 'EE_Event_Registrations_List_Table',
136 136
 				'metaboxes' => array(),
137 137
 				'require_nonce' => FALSE
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
 		// var_dump($this->_req_data);
153 153
 		// exit();
154 154
 
155
-		$this->_page_config = array_merge( $this->_page_config, $new_page_config );
155
+		$this->_page_config = array_merge($this->_page_config, $new_page_config);
156 156
 		$this->_page_config['contact_list']['list_table'] = 'Extend_EE_Attendee_Contact_List_Table';
157 157
 		$this->_page_config['default']['list_table'] = 'Extend_EE_Registrations_List_Table';
158 158
 	}
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
 
162 162
 	protected function _ajax_hooks() {
163 163
 		parent::_ajax_hooks();
164
-		add_action('wp_ajax_get_newsletter_form_content', array( $this, 'get_newsletter_form_content') );
164
+		add_action('wp_ajax_get_newsletter_form_content', array($this, 'get_newsletter_form_content'));
165 165
 	}
166 166
 
167 167
 
@@ -171,12 +171,12 @@  discard block
 block discarded – undo
171 171
 
172 172
 		//if newsletter message type is active then let's add filter and load js for it.
173 173
 		EE_Registry::instance()->load_helper('MSG_Template');
174
-		if ( EEH_MSG_Template::is_mt_active('newsletter') ) {
174
+		if (EEH_MSG_Template::is_mt_active('newsletter')) {
175 175
 			//enqueue newsletter js
176
-			wp_enqueue_script( 'ee-newsletter-trigger', REG_CAF_ASSETS_URL . 'ee-newsletter-trigger.js', array( 'ee-dialog'), EVENT_ESPRESSO_VERSION, TRUE );
177
-			wp_enqueue_style( 'ee-newsletter-trigger-css', REG_CAF_ASSETS_URL . 'ee-newsletter-trigger.css', array(), EVENT_ESPRESSO_VERSION );
176
+			wp_enqueue_script('ee-newsletter-trigger', REG_CAF_ASSETS_URL.'ee-newsletter-trigger.js', array('ee-dialog'), EVENT_ESPRESSO_VERSION, TRUE);
177
+			wp_enqueue_style('ee-newsletter-trigger-css', REG_CAF_ASSETS_URL.'ee-newsletter-trigger.css', array(), EVENT_ESPRESSO_VERSION);
178 178
 			//hook in buttons for newsletter message type trigger.
179
-			add_action('AHEE__EE_Admin_List_Table__extra_tablenav__after_bottom_buttons', array( $this, 'add_newsletter_action_buttons'), 10 );
179
+			add_action('AHEE__EE_Admin_List_Table__extra_tablenav__after_bottom_buttons', array($this, 'add_newsletter_action_buttons'), 10);
180 180
 		}
181 181
 	}
182 182
 
@@ -188,12 +188,12 @@  discard block
 block discarded – undo
188 188
 
189 189
 		//scripts
190 190
 		global $is_IE;
191
-		if ( $is_IE ) {
192
-			wp_enqueue_script( 'excanvas' );
191
+		if ($is_IE) {
192
+			wp_enqueue_script('excanvas');
193 193
 		}
194 194
 
195
-		wp_register_script('espresso_reg_admin_regs_per_day', REG_CAF_ASSETS_URL  . 'espresso_reg_admin_regs_per_day_report.js', array('jqplot-all'), EVENT_ESPRESSO_VERSION, TRUE );
196
-		wp_register_script('espresso_reg_admin_regs_per_event', REG_CAF_ASSETS_URL . 'espresso_reg_admin_regs_per_event_report.js', array('jqplot-all'), EVENT_ESPRESSO_VERSION, TRUE );
195
+		wp_register_script('espresso_reg_admin_regs_per_day', REG_CAF_ASSETS_URL.'espresso_reg_admin_regs_per_day_report.js', array('jqplot-all'), EVENT_ESPRESSO_VERSION, TRUE);
196
+		wp_register_script('espresso_reg_admin_regs_per_event', REG_CAF_ASSETS_URL.'espresso_reg_admin_regs_per_event_report.js', array('jqplot-all'), EVENT_ESPRESSO_VERSION, TRUE);
197 197
 	}
198 198
 
199 199
 
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
 				'slug' => 'all',
225 225
 				'label' => __('All', 'event_espresso'),
226 226
 				'count' => 0,
227
-				'bulk_action' => !isset( $this->_req_data['event_id'] ) ? array() : array(
227
+				'bulk_action' => ! isset($this->_req_data['event_id']) ? array() : array(
228 228
 					'toggle_checkin_status' => __('Toggle Check-In', 'event_espresso'),
229 229
 					//'trash_registrations' => __('Trash Registrations', 'event_espresso')
230 230
 					)
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
 				'slug' => 'all',
243 243
 				'label' => __('All', 'event_espresso'),
244 244
 				'count' => 0,
245
-				'bulk_action' => array( 'delete_checkin_rows' => __('Delete Check-In Rows', 'event_espresso') )
245
+				'bulk_action' => array('delete_checkin_rows' => __('Delete Check-In Rows', 'event_espresso'))
246 246
 				),
247 247
 			);
248 248
 	}
@@ -258,20 +258,20 @@  discard block
 block discarded – undo
258 258
 	 */
259 259
 	public function get_newsletter_form_content() {
260 260
 		//do a nonce check cause we're not coming in from an normal route here.
261
-		$nonce = isset( $this->_req_data['get_newsletter_form_content_nonce'] ) ? sanitize_text_field( $this->_req_data['get_newsletter_form_content_nonce'] ) : '';
261
+		$nonce = isset($this->_req_data['get_newsletter_form_content_nonce']) ? sanitize_text_field($this->_req_data['get_newsletter_form_content_nonce']) : '';
262 262
 		$nonce_ref = 'get_newsletter_form_content_nonce';
263 263
 
264
-		$this->_verify_nonce( $nonce, $nonce_ref );
264
+		$this->_verify_nonce($nonce, $nonce_ref);
265 265
 		//let's get the mtp for the incoming MTP_ ID
266
-		if ( !isset( $this->_req_data['GRP_ID'] ) ) {
267
-			EE_Error::add_error( __('There must be something broken with the js or html structure because the required data for getting a message template group is not present (need an GRP_ID).', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
266
+		if ( ! isset($this->_req_data['GRP_ID'])) {
267
+			EE_Error::add_error(__('There must be something broken with the js or html structure because the required data for getting a message template group is not present (need an GRP_ID).', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
268 268
 			$this->_template_args['success'] = FALSE;
269 269
 			$this->_template_args['error'] = TRUE;
270 270
 			$this->_return_json();
271 271
 		}
272
-		$MTPG = EEM_Message_Template_Group::instance()->get_one_by_ID( $this->_req_data['GRP_ID'] );
273
-		if ( ! $MTPG instanceof EE_Message_Template_Group ) {
274
-			EE_Error::add_error( sprintf( __('The GRP_ID given (%d) does not appear to have a corresponding row in the database.', 'event_espresso'), $this->_req_data['GRP_ID'] ), __FILE__, __FUNCTION__, __LINE__  );
272
+		$MTPG = EEM_Message_Template_Group::instance()->get_one_by_ID($this->_req_data['GRP_ID']);
273
+		if ( ! $MTPG instanceof EE_Message_Template_Group) {
274
+			EE_Error::add_error(sprintf(__('The GRP_ID given (%d) does not appear to have a corresponding row in the database.', 'event_espresso'), $this->_req_data['GRP_ID']), __FILE__, __FUNCTION__, __LINE__);
275 275
 			$this->_template_args['success'] = FALSE;
276 276
 			$this->_template_args['error'] = TRUE;
277 277
 			$this->_return_json();
@@ -280,11 +280,11 @@  discard block
 block discarded – undo
280 280
 		$MTPs = $MTPG->context_templates();
281 281
 		$MTPs = $MTPs['attendee'];
282 282
 		$template_fields = array();
283
-		foreach ( $MTPs as $MTP ) {
283
+		foreach ($MTPs as $MTP) {
284 284
 			$field = $MTP->get('MTP_template_field');
285
-			if ( $field == 'content'  ) {
285
+			if ($field == 'content') {
286 286
 				$content = $MTP->get('MTP_content');
287
-				if ( !empty( $content['newsletter_content'] ) ) {
287
+				if ( ! empty($content['newsletter_content'])) {
288 288
 					$template_fields['newsletter_content'] = $content['newsletter_content'];
289 289
 					}
290 290
 				continue;
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
 		$this->_template_args['data'] = array(
298 298
 			'batch_message_from' => isset($template_fields['from']) ? $template_fields['from'] : '',
299 299
 			'batch_message_subject' => isset($template_fields['subject']) ? $template_fields['subject'] : '',
300
-			'batch_message_content' => isset( $template_fields['newsletter_content'] ) ? $template_fields['newsletter_content'] : ''
300
+			'batch_message_content' => isset($template_fields['newsletter_content']) ? $template_fields['newsletter_content'] : ''
301 301
 			);
302 302
 		$this->_return_json();
303 303
 	}
@@ -313,8 +313,8 @@  discard block
 block discarded – undo
313 313
 	 * @param EE_Admin_List_Table $list_table
314 314
 	 * @return string html string for extra buttons
315 315
 	 */
316
-	public function add_newsletter_action_buttons( EE_Admin_List_Table $list_table ) {
317
-		if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_registrations_newsletter_selected_send' ) ) {
316
+	public function add_newsletter_action_buttons(EE_Admin_List_Table $list_table) {
317
+		if ( ! EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_registrations_newsletter_selected_send')) {
318 318
 			return '';
319 319
 		}
320 320
 
@@ -323,13 +323,13 @@  discard block
 block discarded – undo
323 323
 			'event_registrations',
324 324
 			'default'
325 325
 			);
326
-		if ( $this->_current_page == 'espresso_registrations' && in_array( $this->_req_action, $routes_to_add_to )  ) {
327
-			if ( ( $this->_req_action == 'event_registrations' && empty( $this->_req_data['event_id'] ) ) || ( isset( $this->_req_data['status'] ) && $this->_req_data['status'] == 'trash' ) ) {
326
+		if ($this->_current_page == 'espresso_registrations' && in_array($this->_req_action, $routes_to_add_to)) {
327
+			if (($this->_req_action == 'event_registrations' && empty($this->_req_data['event_id'])) || (isset($this->_req_data['status']) && $this->_req_data['status'] == 'trash')) {
328 328
 				echo '';
329 329
 			} else {
330
-				$button_text = sprintf( __('Send Batch Message (%s selected)', 'event_espresso'), '<span class="send-selected-newsletter-count">0</span>' );
331
-				echo '<button id="selected-batch-send-trigger" class="button secondary-button"><span class="dashicons dashicons-email "></span>' . $button_text . '</button>';
332
-				add_action('admin_footer', array( $this, 'newsletter_send_form_skeleton') );
330
+				$button_text = sprintf(__('Send Batch Message (%s selected)', 'event_espresso'), '<span class="send-selected-newsletter-count">0</span>');
331
+				echo '<button id="selected-batch-send-trigger" class="button secondary-button"><span class="dashicons dashicons-email "></span>'.$button_text.'</button>';
332
+				add_action('admin_footer', array($this, 'newsletter_send_form_skeleton'));
333 333
 			}
334 334
 		}
335 335
 	}
@@ -341,38 +341,38 @@  discard block
 block discarded – undo
341 341
 		$list_table = $this->_list_table_object;
342 342
 		$codes = array();
343 343
 		//need to templates for the newsletter message type for the template selector.
344
-		$values[] = array( 'text' => __('Select Template to Use', 'event_espresso'), 'id' => 0 );
345
-		$mtps = EEM_Message_Template_Group::instance()->get_all( array( array( 'MTP_message_type' => 'newsletter', 'MTP_messenger' => 'email' ) ) );
346
-		foreach ( $mtps as $mtp ) {
344
+		$values[] = array('text' => __('Select Template to Use', 'event_espresso'), 'id' => 0);
345
+		$mtps = EEM_Message_Template_Group::instance()->get_all(array(array('MTP_message_type' => 'newsletter', 'MTP_messenger' => 'email')));
346
+		foreach ($mtps as $mtp) {
347 347
 			$name = $mtp->name();
348 348
 			$values[] = array(
349
-				'text' => empty( $name ) ? __('Global', 'event_espresso') : $name,
349
+				'text' => empty($name) ? __('Global', 'event_espresso') : $name,
350 350
 				'id' => $mtp->ID()
351 351
 				);
352 352
 		}
353 353
 
354 354
 		//need to get a list of shortcodes that are available for the newsletter message type.
355 355
 		EE_Registry::instance()->load_helper('MSG_Template');
356
-		$shortcodes = EEH_MSG_Template::get_shortcodes( 'newsletter', 'email', array(), 'attendee', FALSE );
357
-		foreach ( $shortcodes as $field => $shortcode_array ) {
358
-			$codes[$field] = implode(', ', array_keys($shortcode_array ) );
356
+		$shortcodes = EEH_MSG_Template::get_shortcodes('newsletter', 'email', array(), 'attendee', FALSE);
357
+		foreach ($shortcodes as $field => $shortcode_array) {
358
+			$codes[$field] = implode(', ', array_keys($shortcode_array));
359 359
 		}
360 360
 
361 361
 		$shortcodes = $codes;
362 362
 
363
-		$form_template = REG_CAF_TEMPLATE_PATH . 'newsletter-send-form.template.php';
363
+		$form_template = REG_CAF_TEMPLATE_PATH.'newsletter-send-form.template.php';
364 364
 		$form_template_args = array(
365 365
 			'form_action' => admin_url('admin.php?page=espresso_registrations'),
366 366
 			'form_route' => 'newsletter_selected_send',
367 367
 			'form_nonce_name' => 'newsletter_selected_send_nonce',
368
-			'form_nonce' => wp_create_nonce( 'newsletter_selected_send_nonce' ),
368
+			'form_nonce' => wp_create_nonce('newsletter_selected_send_nonce'),
369 369
 			'redirect_back_to' => $this->_req_action,
370
-			'ajax_nonce' => wp_create_nonce( 'get_newsletter_form_content_nonce'),
371
-			'template_selector' => EEH_Form_Fields::select_input('newsletter_mtp_selected', $values ),
370
+			'ajax_nonce' => wp_create_nonce('get_newsletter_form_content_nonce'),
371
+			'template_selector' => EEH_Form_Fields::select_input('newsletter_mtp_selected', $values),
372 372
 			'shortcodes' => $shortcodes,
373 373
 			'id_type' => $list_table instanceof EE_Attendee_Contact_List_Table ? 'contact' : 'registration'
374 374
 			);
375
-		EEH_Template::display_template( $form_template, $form_template_args );
375
+		EEH_Template::display_template($form_template, $form_template_args);
376 376
 	}
377 377
 
378 378
 
@@ -387,35 +387,35 @@  discard block
 block discarded – undo
387 387
 	protected function _newsletter_selected_send() {
388 388
 		$success = TRUE;
389 389
 		//first we need to make sure we have a GRP_ID so we know what template we're sending and updating!
390
-		if ( empty( $this->_req_data['newsletter_mtp_selected'] ) ) {
391
-			EE_Error::add_error( __('In order to send a message, a Message Template GRP_ID is needed. It was not provided so messages were not sent.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
390
+		if (empty($this->_req_data['newsletter_mtp_selected'])) {
391
+			EE_Error::add_error(__('In order to send a message, a Message Template GRP_ID is needed. It was not provided so messages were not sent.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
392 392
 			$success = FALSE;
393 393
 		}
394 394
 
395
-		if ( $success ) {
395
+		if ($success) {
396 396
 			//update Message template in case there are any changes
397
-			$MTPG = EEM_Message_Template_Group::instance()->get_one_by_ID( $this->_req_data['newsletter_mtp_selected'] );
397
+			$MTPG = EEM_Message_Template_Group::instance()->get_one_by_ID($this->_req_data['newsletter_mtp_selected']);
398 398
 			$MTPs = $MTPG instanceof EE_Message_Template_Group ? $MTPG->context_templates() : array();
399
-			if ( empty( $MTPs ) ) {
400
-				EE_Error::add_error( __('Unable to retrieve message template fields from the db. Messages not sent.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
399
+			if (empty($MTPs)) {
400
+				EE_Error::add_error(__('Unable to retrieve message template fields from the db. Messages not sent.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
401 401
 				$success = FALSE;
402 402
 			}
403 403
 
404 404
 			//let's just update the specific fields
405
-			foreach ( $MTPs['attendee'] as $MTP ) {
405
+			foreach ($MTPs['attendee'] as $MTP) {
406 406
 				$field = $MTP->get('MTP_template_field');
407 407
 				$content = $MTP->get('MTP_content');
408 408
 				$new_content = $content;
409
-				switch( $field ) {
409
+				switch ($field) {
410 410
 					case 'from' :
411
-						$new_content = !empty( $this->_req_data['batch_message']['from'] ) ? $this->_req_data['batch_message']['from'] : $content;
411
+						$new_content = ! empty($this->_req_data['batch_message']['from']) ? $this->_req_data['batch_message']['from'] : $content;
412 412
 						break;
413 413
 					case 'subject' :
414
-						$new_content = !empty( $this->_req_data['batch_message']['subject'] ) ? $this->_req_data['batch_message']['subject'] : $content;
414
+						$new_content = ! empty($this->_req_data['batch_message']['subject']) ? $this->_req_data['batch_message']['subject'] : $content;
415 415
 						break;
416 416
 					case 'content' :
417 417
 						$new_content = $content;
418
-						$new_content['newsletter_content'] = !empty( $this->_req_data['batch_message']['content'] ) ? $this->_req_data['batch_message']['content'] : $content['newsletter_content'];
418
+						$new_content['newsletter_content'] = ! empty($this->_req_data['batch_message']['content']) ? $this->_req_data['batch_message']['content'] : $content['newsletter_content'];
419 419
 						break;
420 420
 					default :
421 421
 						continue;
@@ -426,20 +426,20 @@  discard block
 block discarded – undo
426 426
 			}
427 427
 
428 428
 			//great fields are updated!  now let's make sure we just have contact objects (EE_Attendee).
429
-			$id_type = !empty( $this->_req_data['batch_message']['id_type'] ) ? $this->_req_data['batch_message']['id_type'] : 'registration';
429
+			$id_type = ! empty($this->_req_data['batch_message']['id_type']) ? $this->_req_data['batch_message']['id_type'] : 'registration';
430 430
 
431 431
 			//id_type will affect how we assemble the ids.
432
-			$ids = !empty( $this->_req_data['batch_message']['ids'] ) ? json_decode( stripslashes($this->_req_data['batch_message']['ids']) ) : array();
432
+			$ids = ! empty($this->_req_data['batch_message']['ids']) ? json_decode(stripslashes($this->_req_data['batch_message']['ids'])) : array();
433 433
 
434
-			$contacts = $id_type == 'registration' ? EEM_Attendee::instance()->get_array_of_contacts_from_reg_ids( $ids ) : EEM_Attendee::instance()->get_all( array( array( 'ATT_ID' => array('in', $ids ) ) ) );
434
+			$contacts = $id_type == 'registration' ? EEM_Attendee::instance()->get_array_of_contacts_from_reg_ids($ids) : EEM_Attendee::instance()->get_all(array(array('ATT_ID' => array('in', $ids))));
435 435
 
436 436
 			//we do _action because ALL triggers are handled in EED_Messages.
437
-			do_action('AHEE__Extend_Registrations_Admin_Page___newsletter_selected_send', $contacts, $MTPG->ID() );
437
+			do_action('AHEE__Extend_Registrations_Admin_Page___newsletter_selected_send', $contacts, $MTPG->ID());
438 438
 		}
439 439
 		$query_args = array(
440
-			'action' => !empty( $this->_req_data['redirect_back_to'] ) ? $this->_req_data['redirect_back_to'] : 'default'
440
+			'action' => ! empty($this->_req_data['redirect_back_to']) ? $this->_req_data['redirect_back_to'] : 'default'
441 441
 			);
442
-		$this->_redirect_after_action( FALSE, '', '', $query_args, TRUE );
442
+		$this->_redirect_after_action(FALSE, '', '', $query_args, TRUE);
443 443
 	}
444 444
 
445 445
 
@@ -452,16 +452,16 @@  discard block
 block discarded – undo
452 452
 	*/
453 453
 	protected function _registration_reports() {
454 454
 
455
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
455
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
456 456
 
457 457
 		$page_args = array();
458 458
 
459
-		$page_args['admin_reports'][] = $this->_registrations_per_day_report( '-1 month' );  //  option: '-1 week', '-2 weeks' defaults to '-1 month'
460
-		$page_args['admin_reports'][] = $this->_get_registrations_per_event_report( '-1 month' ); //  option: '-1 week', '-2 weeks' defaults to '-1 month'
459
+		$page_args['admin_reports'][] = $this->_registrations_per_day_report('-1 month'); //  option: '-1 week', '-2 weeks' defaults to '-1 month'
460
+		$page_args['admin_reports'][] = $this->_get_registrations_per_event_report('-1 month'); //  option: '-1 week', '-2 weeks' defaults to '-1 month'
461 461
 //		$page_args['admin_reports'][] = 'chart1';
462 462
 
463
-		$template_path = EE_ADMIN_TEMPLATE . 'admin_reports.template.php';
464
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, $page_args, TRUE );
463
+		$template_path = EE_ADMIN_TEMPLATE.'admin_reports.template.php';
464
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, $page_args, TRUE);
465 465
 
466 466
 //		EEH_Debug_Tools::printr( $page_args, '$page_args' );
467 467
 
@@ -480,36 +480,36 @@  discard block
 block discarded – undo
480 480
 	*		@access private
481 481
 	*		@return void
482 482
 	*/
483
-	private function _registrations_per_day_report( $period = '-1 month' ) {
483
+	private function _registrations_per_day_report($period = '-1 month') {
484 484
 
485 485
 		$report_ID = 'reg-admin-registrations-per-day-report-dv';
486 486
 		$report_JS = 'espresso_reg_admin_regs_per_day';
487 487
 
488
-		wp_enqueue_script( $report_JS );
488
+		wp_enqueue_script($report_JS);
489 489
 
490 490
 		$REG = EEM_Registration::instance();
491 491
 
492
-		$results = $REG->get_registrations_per_day_report( $period );
492
+		$results = $REG->get_registrations_per_day_report($period);
493 493
 
494 494
 		//EEH_Debug_Tools::printr( $results, '$registrations_per_day' );
495 495
 		$regs = array();
496
-		$xmin = date( 'Y-m-d', strtotime( '+1 year' ));
496
+		$xmin = date('Y-m-d', strtotime('+1 year'));
497 497
 		$xmax = 0;
498 498
 		$ymax = 0;
499 499
 		$results = (array) $results;
500
-		foreach ( $results as $result ) {
501
-			$regs[] = array( $result->regDate, (int)$result->total );
502
-			$xmin = strtotime( $result->regDate ) < strtotime( $xmin ) ? $result->regDate : $xmin;
503
-			$xmax = strtotime( $result->regDate ) > strtotime( $xmax ) ? $result->regDate : $xmax;
500
+		foreach ($results as $result) {
501
+			$regs[] = array($result->regDate, (int) $result->total);
502
+			$xmin = strtotime($result->regDate) < strtotime($xmin) ? $result->regDate : $xmin;
503
+			$xmax = strtotime($result->regDate) > strtotime($xmax) ? $result->regDate : $xmax;
504 504
 			$ymax = $result->total > $ymax ? $result->total : $ymax;
505 505
 		}
506 506
 
507
-		$xmin = date( 'Y-m-d', strtotime( date( 'Y-m-d', strtotime($xmin)) . ' -1 day' ));
508
-		$xmax = date( 'Y-m-d', strtotime( date( 'Y-m-d', strtotime($xmax)) . ' +1 day' ));
507
+		$xmin = date('Y-m-d', strtotime(date('Y-m-d', strtotime($xmin)).' -1 day'));
508
+		$xmax = date('Y-m-d', strtotime(date('Y-m-d', strtotime($xmax)).' +1 day'));
509 509
 		// calculate # days between our min and max dates
510
-		$span = floor( (strtotime($xmax) - strtotime($xmin)) / (60*60*24)) + 1;
510
+		$span = floor((strtotime($xmax) - strtotime($xmin)) / (60 * 60 * 24)) + 1;
511 511
 
512
-		$report_title = __( 'Total Registrations per Day', 'event_espresso' );
512
+		$report_title = __('Total Registrations per Day', 'event_espresso');
513 513
 
514 514
 		$report_params = array(
515 515
 				'title' 	=> $report_title,
@@ -520,9 +520,9 @@  discard block
 block discarded – undo
520 520
 				'ymax' 	=> ceil($ymax * 1.25),
521 521
 				'span' 	=> $span,
522 522
 				'width'	=> ceil(900 / $span),
523
-				'noRegsMsg' => sprintf( __('<h2>%s</h2><p>There are currently no registration records in the last month for this report.</p>', 'event_espresso'), $report_title )
523
+				'noRegsMsg' => sprintf(__('<h2>%s</h2><p>There are currently no registration records in the last month for this report.</p>', 'event_espresso'), $report_title)
524 524
 			);
525
-		wp_localize_script( $report_JS, 'regPerDay', $report_params );
525
+		wp_localize_script($report_JS, 'regPerDay', $report_params);
526 526
 
527 527
 		return $report_ID;
528 528
 	}
@@ -537,29 +537,29 @@  discard block
 block discarded – undo
537 537
 	*		@access private
538 538
 	*		@return void
539 539
 	*/
540
-	private function _get_registrations_per_event_report( $period = '-1 month' ) {
540
+	private function _get_registrations_per_event_report($period = '-1 month') {
541 541
 
542 542
 		$report_ID = 'reg-admin-registrations-per-event-report-dv';
543 543
 		$report_JS = 'espresso_reg_admin_regs_per_event';
544 544
 
545
-		wp_enqueue_script( $report_JS );
545
+		wp_enqueue_script($report_JS);
546 546
 
547
-		require_once ( EE_MODELS . 'EEM_Registration.model.php' );
547
+		require_once (EE_MODELS.'EEM_Registration.model.php');
548 548
 		$REG = EEM_Registration::instance();
549 549
 
550
-		$results = $REG->get_registrations_per_event_report( $period );
550
+		$results = $REG->get_registrations_per_event_report($period);
551 551
 		//EEH_Debug_Tools::printr( $results, '$registrations_per_event' );
552 552
 		$regs = array();
553 553
 		$ymax = 0;
554 554
 		$results = (array) $results;
555
-		foreach ( $results as $result ) {
556
-			$regs[] = array( wp_trim_words( $result->event_name, 4, '...' ), (int)$result->total );
555
+		foreach ($results as $result) {
556
+			$regs[] = array(wp_trim_words($result->event_name, 4, '...'), (int) $result->total);
557 557
 			$ymax = $result->total > $ymax ? $result->total : $ymax;
558 558
 		}
559 559
 
560 560
 		$span = $period == 'week' ? 9 : 33;
561 561
 
562
-		$report_title = __( 'Total Registrations per Event', 'event_espresso' );
562
+		$report_title = __('Total Registrations per Event', 'event_espresso');
563 563
 
564 564
 		$report_params = array(
565 565
 			'title' 	=> $report_title,
@@ -568,9 +568,9 @@  discard block
 block discarded – undo
568 568
 			'ymax' 	=> ceil($ymax * 1.25),
569 569
 			'span' 	=> $span,
570 570
 			'width'	=> ceil(900 / $span),
571
-			'noRegsMsg' => sprintf( __('<h2>%s</h2><p>There are currently no registration records in the last month for this report.</p>', 'event_espresso'), $report_title )
571
+			'noRegsMsg' => sprintf(__('<h2>%s</h2><p>There are currently no registration records in the last month for this report.</p>', 'event_espresso'), $report_title)
572 572
 		);
573
-		wp_localize_script( $report_JS, 'regPerEvent', $report_params );
573
+		wp_localize_script($report_JS, 'regPerEvent', $report_params);
574 574
 
575 575
 		return $report_ID;
576 576
 	}
@@ -584,8 +584,8 @@  discard block
 block discarded – undo
584 584
 	 * @return void
585 585
 	 */
586 586
 	protected function _registration_checkin_list_table() {
587
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
588
-		$reg_id = isset( $this->_req_data['_REGID'] ) ? $this->_req_data['_REGID'] : null;
587
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
588
+		$reg_id = isset($this->_req_data['_REGID']) ? $this->_req_data['_REGID'] : null;
589 589
 		$reg = EEM_Registration::instance()->get_one_by_ID($reg_id);
590 590
 		$this->_admin_page_title .= $this->get_action_link_or_button('new_registration', 'add-registrant', array('event_id' => $reg->event_ID()), 'add-new-h2');
591 591
 
@@ -599,15 +599,15 @@  discard block
 block discarded – undo
599 599
 				'desc' => __('This indicates the attendee has been checked out', 'event_espresso')
600 600
 				)
601 601
 			);
602
-		$this->_template_args['after_list_table'] = $this->_display_legend( $legend_items );
602
+		$this->_template_args['after_list_table'] = $this->_display_legend($legend_items);
603 603
 
604 604
 
605
-		$dtt_id = isset(  $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : NULL;
606
-		$go_back_url = !empty( $reg_id )  ? EE_Admin_Page::add_query_args_and_nonce(array('action' => 'event_registrations', 'event_id' => EEM_Registration::instance()->get_one_by_ID($reg_id)->get_first_related('Event')->ID(), 'DTT_ID' => $dtt_id ), $this->_admin_base_url ) : '';
605
+		$dtt_id = isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : NULL;
606
+		$go_back_url = ! empty($reg_id) ? EE_Admin_Page::add_query_args_and_nonce(array('action' => 'event_registrations', 'event_id' => EEM_Registration::instance()->get_one_by_ID($reg_id)->get_first_related('Event')->ID(), 'DTT_ID' => $dtt_id), $this->_admin_base_url) : '';
607 607
 
608
-		$this->_template_args['before_list_table'] = !empty( $reg_id ) && !empty( $dtt_id ) ? '<h2>' . sprintf(__("%s's check in records for %s at the event, %s", 'event_espresso'), '<span id="checkin-attendee-name">' . EEM_Registration::instance()->get_one_by_ID($reg_id)->get_first_related('Attendee')->full_name() . '</span>', '<span id="checkin-dtt"><a href="' . $go_back_url . '">' . EEM_Datetime::instance()->get_one_by_ID($dtt_id)->start_date_and_time() . ' - ' . EEM_Datetime::instance()->get_one_by_ID($dtt_id)->end_date_and_time() . '</a></span>', '<span id="checkin-event-name">' . EEM_Datetime::instance()->get_one_by_ID($dtt_id)->get_first_related('Event')->get('EVT_name') . '</span>' ) . '</h2>' : '';
609
-		$this->_template_args['list_table_hidden_fields'] = !empty( $reg_id ) ? '<input type="hidden" name="_REGID" value="' . $reg_id . '">' : '';
610
-		$this->_template_args['list_table_hidden_fields'] .= !empty( $dtt_id ) ? '<input type="hidden" name="DTT_ID" value="' . $dtt_id . '">' : '';
608
+		$this->_template_args['before_list_table'] = ! empty($reg_id) && ! empty($dtt_id) ? '<h2>'.sprintf(__("%s's check in records for %s at the event, %s", 'event_espresso'), '<span id="checkin-attendee-name">'.EEM_Registration::instance()->get_one_by_ID($reg_id)->get_first_related('Attendee')->full_name().'</span>', '<span id="checkin-dtt"><a href="'.$go_back_url.'">'.EEM_Datetime::instance()->get_one_by_ID($dtt_id)->start_date_and_time().' - '.EEM_Datetime::instance()->get_one_by_ID($dtt_id)->end_date_and_time().'</a></span>', '<span id="checkin-event-name">'.EEM_Datetime::instance()->get_one_by_ID($dtt_id)->get_first_related('Event')->get('EVT_name').'</span>').'</h2>' : '';
609
+		$this->_template_args['list_table_hidden_fields'] = ! empty($reg_id) ? '<input type="hidden" name="_REGID" value="'.$reg_id.'">' : '';
610
+		$this->_template_args['list_table_hidden_fields'] .= ! empty($dtt_id) ? '<input type="hidden" name="DTT_ID" value="'.$dtt_id.'">' : '';
611 611
 
612 612
 		$this->display_admin_list_table_page_with_no_sidebar();
613 613
 	}
@@ -620,24 +620,24 @@  discard block
 block discarded – undo
620 620
 	 */
621 621
 	public function toggle_checkin_status() {
622 622
 		//first make sure we have the necessary data
623
-		if ( !isset( $this->_req_data['_regid'] ) ) {
624
-			EE_Error::add_error( __('There must be something broken with the html structure because the required data for toggling the Check-in status is not being sent via ajax', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
623
+		if ( ! isset($this->_req_data['_regid'])) {
624
+			EE_Error::add_error(__('There must be something broken with the html structure because the required data for toggling the Check-in status is not being sent via ajax', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
625 625
 			$this->_template_args['success'] = FALSE;
626 626
 			$this->_template_args['error'] = TRUE;
627 627
 			$this->_return_json();
628 628
 		};
629 629
 
630 630
 		//do a nonce check cause we're not coming in from an normal route here.
631
-		$nonce = isset( $this->_req_data['checkinnonce'] ) ? sanitize_text_field( $this->_req_data['checkinnonce'] ) : '';
631
+		$nonce = isset($this->_req_data['checkinnonce']) ? sanitize_text_field($this->_req_data['checkinnonce']) : '';
632 632
 		$nonce_ref = 'checkin_nonce';
633 633
 
634
-		$this->_verify_nonce( $nonce, $nonce_ref );
634
+		$this->_verify_nonce($nonce, $nonce_ref);
635 635
 
636 636
 		//beautiful! Made it this far so let's get the status.
637 637
 		$new_status = $this->_toggle_checkin_status();
638 638
 
639 639
 		//setup new class to return via ajax
640
-		$this->_template_args['admin_page_content'] = 'clickable trigger-checkin checkin-icons checkedin-status-' . $new_status;
640
+		$this->_template_args['admin_page_content'] = 'clickable trigger-checkin checkin-icons checkedin-status-'.$new_status;
641 641
 		$this->_template_args['success'] = TRUE;
642 642
 		$this->_return_json();
643 643
 	}
@@ -657,32 +657,32 @@  discard block
 block discarded – undo
657 657
 		//first let's get the query args out of the way for the redirect
658 658
 		$query_args = array(
659 659
 			'action' => 'event_registrations',
660
-			'event_id' => isset( $this->_req_data['event_id'] ) ? $this->_req_data['event_id'] : NULL,
661
-			'DTT_ID' => isset( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : NULL
660
+			'event_id' => isset($this->_req_data['event_id']) ? $this->_req_data['event_id'] : NULL,
661
+			'DTT_ID' => isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : NULL
662 662
 			);
663 663
 		$new_status = FALSE;
664 664
 
665 665
 		// bulk action check in toggle
666
-		if ( ! empty( $this->_req_data['checkbox'] ) && is_array( $this->_req_data['checkbox'] )) {
666
+		if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
667 667
 			// cycle thru checkboxes
668
-			while ( list( $REG_ID, $value ) = each($this->_req_data['checkbox'])) {
669
-				$DTT_ID = isset( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : NULL;
668
+			while (list($REG_ID, $value) = each($this->_req_data['checkbox'])) {
669
+				$DTT_ID = isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : NULL;
670 670
 				$new_status = $this->_toggle_checkin($REG_ID, $DTT_ID);
671 671
 			}
672 672
 
673
-		} elseif ( isset( $this->_req_data['_regid'] ) ) {
673
+		} elseif (isset($this->_req_data['_regid'])) {
674 674
 			//coming from ajax request
675
-			$DTT_ID = isset( $this->_req_data['dttid'] ) ? $this->_req_data['dttid'] : NULL;
675
+			$DTT_ID = isset($this->_req_data['dttid']) ? $this->_req_data['dttid'] : NULL;
676 676
 			$query_args['DTT_ID'] = $DTT_ID;
677 677
 			$new_status = $this->_toggle_checkin($this->_req_data['_regid'], $DTT_ID);
678 678
 		} else {
679
-			EE_Error::add_error(__('Missing some required data to toggle the Check-in', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__  );
679
+			EE_Error::add_error(__('Missing some required data to toggle the Check-in', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
680 680
 		}
681 681
 
682
-		if ( defined('DOING_AJAX' ) )
682
+		if (defined('DOING_AJAX'))
683 683
 			return $new_status;
684 684
 
685
-		$this->_redirect_after_action( FALSE,'', '', $query_args, TRUE );
685
+		$this->_redirect_after_action(FALSE, '', '', $query_args, TRUE);
686 686
 
687 687
 	}
688 688
 
@@ -698,11 +698,11 @@  discard block
 block discarded – undo
698 698
 	 */
699 699
 	private function _toggle_checkin($REG_ID, $DTT_ID) {
700 700
 		$REG = EEM_Registration::instance()->get_one_by_ID($REG_ID);
701
-		$new_status = $REG->toggle_checkin_status( $DTT_ID );
702
-		if ( $new_status !== FALSE ) {
703
-			EE_Error::add_success($REG->get_checkin_msg($DTT_ID) );
701
+		$new_status = $REG->toggle_checkin_status($DTT_ID);
702
+		if ($new_status !== FALSE) {
703
+			EE_Error::add_success($REG->get_checkin_msg($DTT_ID));
704 704
 		} else {
705
-			EE_Error::add_error($REG->get_checkin_msg($DTT_ID, TRUE), __FILE__, __FUNCTION__, __LINE__ );
705
+			EE_Error::add_error($REG->get_checkin_msg($DTT_ID, TRUE), __FILE__, __FUNCTION__, __LINE__);
706 706
 			$new_status = FALSE;
707 707
 		}
708 708
 		return $new_status;
@@ -718,28 +718,28 @@  discard block
 block discarded – undo
718 718
 	protected function _delete_checkin_rows() {
719 719
 		$query_args = array(
720 720
 			'action' => 'registration_checkins',
721
-			'DTT_ID' => isset( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : 0,
722
-			'_REGID' => isset( $this->_req_data['_REGID'] ) ? $this->_req_data['_REGID'] : 0
721
+			'DTT_ID' => isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : 0,
722
+			'_REGID' => isset($this->_req_data['_REGID']) ? $this->_req_data['_REGID'] : 0
723 723
 			);
724
-		if ( !empty( $this->_req_data['checkbox'] ) && is_array( $this->_req_data['checkbox'] ) ) {
725
-			while ( list( $CHK_ID, $value ) = each( $this->_req_data['checkbox'] ) ) {
724
+		if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
725
+			while (list($CHK_ID, $value) = each($this->_req_data['checkbox'])) {
726 726
 				$errors = 0;
727
-				if ( ! EEM_Checkin::instance()->delete_by_ID($CHK_ID ) ) {
727
+				if ( ! EEM_Checkin::instance()->delete_by_ID($CHK_ID)) {
728 728
 					$errors++;
729 729
 				}
730 730
 			}
731 731
 		} else {
732
-			EE_Error::add_error(__('So, something went wrong with the bulk delete because there was no data received for instructions on WHAT to delete!', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
733
-			$this->_redirect_after_action( FALSE, '', '', $query_args, TRUE );
732
+			EE_Error::add_error(__('So, something went wrong with the bulk delete because there was no data received for instructions on WHAT to delete!', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
733
+			$this->_redirect_after_action(FALSE, '', '', $query_args, TRUE);
734 734
 		}
735 735
 
736
-		if ( $errors > 0 ) {
737
-			EE_Error::add_error( sprintf( __('There were %d records that did not delete successfully', 'event_espresso'), $errors ), __FILE__, __FUNCTION__, __LINE__ );
736
+		if ($errors > 0) {
737
+			EE_Error::add_error(sprintf(__('There were %d records that did not delete successfully', 'event_espresso'), $errors), __FILE__, __FUNCTION__, __LINE__);
738 738
 		} else {
739
-			EE_Error::add_success( __('Records were successfully deleted', 'event_espresso') );
739
+			EE_Error::add_success(__('Records were successfully deleted', 'event_espresso'));
740 740
 		}
741 741
 
742
-		$this->_redirect_after_action( FALSE, '', '', $query_args, TRUE );
742
+		$this->_redirect_after_action(FALSE, '', '', $query_args, TRUE);
743 743
 	}
744 744
 
745 745
 
@@ -751,20 +751,20 @@  discard block
 block discarded – undo
751 751
 	protected function _delete_checkin_row() {
752 752
 		$query_args = array(
753 753
 			'action' => 'registration_checkins',
754
-			'DTT_ID' => isset( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : 0,
755
-			'_REGID' => isset( $this->_req_data['_REGID'] ) ? $this->_req_data['_REGID'] : 0
754
+			'DTT_ID' => isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : 0,
755
+			'_REGID' => isset($this->_req_data['_REGID']) ? $this->_req_data['_REGID'] : 0
756 756
 			);
757 757
 
758
-		if ( !empty( $this->_req_data['CHK_ID'] ) ) {
759
-			if ( ! EEM_Checkin::instance()->delete_by_ID($this->_req_data['CHK_ID'] ) ) {
760
-				EE_Error::add_error(__('Something went wrong and this check-in record was not deleted', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
758
+		if ( ! empty($this->_req_data['CHK_ID'])) {
759
+			if ( ! EEM_Checkin::instance()->delete_by_ID($this->_req_data['CHK_ID'])) {
760
+				EE_Error::add_error(__('Something went wrong and this check-in record was not deleted', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
761 761
 			} else {
762
-				EE_Error::add_success( __('Check-In record successfully deleted', 'event_espresso') );
762
+				EE_Error::add_success(__('Check-In record successfully deleted', 'event_espresso'));
763 763
 			}
764 764
 		} else {
765
-			EE_Error::add_error(__('In order to delete a Check-in record, there must be a Check-In ID available. There is not. It is not your fault, there is just a gremlin living in the code', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
765
+			EE_Error::add_error(__('In order to delete a Check-in record, there must be a Check-In ID available. There is not. It is not your fault, there is just a gremlin living in the code', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
766 766
 		}
767
-		$this->_redirect_after_action( FALSE, '', '', $query_args, TRUE );
767
+		$this->_redirect_after_action(FALSE, '', '', $query_args, TRUE);
768 768
 	}
769 769
 
770 770
 
@@ -777,8 +777,8 @@  discard block
 block discarded – undo
777 777
 	*		@return void
778 778
 	*/
779 779
 	protected function _event_registrations_list_table() {
780
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
781
-		$this->_admin_page_title .= isset( $this->_req_data['event_id'] ) ? $this->get_action_link_or_button('new_registration', 'add-registrant', array('event_id' => $this->_req_data['event_id']), 'add-new-h2') : '';
780
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
781
+		$this->_admin_page_title .= isset($this->_req_data['event_id']) ? $this->get_action_link_or_button('new_registration', 'add-registrant', array('event_id' => $this->_req_data['event_id']), 'add-new-h2') : '';
782 782
 
783 783
 		$legend_items = array(
784 784
 			'star-icon' => array(
@@ -802,31 +802,31 @@  discard block
 block discarded – undo
802 802
 				'desc' => __('View All Check-in Records for this Registrant', 'event_espresso')
803 803
 				),
804 804
 			'approved_status' => array(
805
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_approved,
806
-				'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_approved, FALSE, 'sentence' )
805
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_approved,
806
+				'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_approved, FALSE, 'sentence')
807 807
 				),
808 808
             'cancelled_status' => array(
809
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_cancelled,
810
-				'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_cancelled, FALSE, 'sentence' )
809
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_cancelled,
810
+				'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_cancelled, FALSE, 'sentence')
811 811
 				),
812 812
             'declined_status' => array(
813
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_declined,
814
-				'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_declined, FALSE, 'sentence' )
813
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_declined,
814
+				'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_declined, FALSE, 'sentence')
815 815
 				),
816 816
 			'not_approved' => array(
817
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_not_approved,
818
-				'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_not_approved, FALSE, 'sentence' )
817
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_not_approved,
818
+				'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_not_approved, FALSE, 'sentence')
819 819
 				),
820 820
 			'pending_status' => array(
821
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_pending_payment,
822
-				'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_pending_payment, FALSE, 'sentence' )
821
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_pending_payment,
822
+				'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_pending_payment, FALSE, 'sentence')
823 823
 				)/**/
824 824
 			);
825
-		$this->_template_args['after_list_table'] = $this->_display_legend( $legend_items );
825
+		$this->_template_args['after_list_table'] = $this->_display_legend($legend_items);
826 826
 
827
-		$event_id = isset( $this->_req_data['event_id'] ) ? $this->_req_data['event_id'] : null;
828
-		$this->_template_args['before_list_table'] = !empty( $event_id ) ? '<h2>' . sprintf(__('Viewing Registrations for Event: %s', 'event_espresso'), EEM_Event::instance()->get_one_by_ID($event_id)->get('EVT_name') ) . '</h2>' : '';
829
-		$this->_template_args['list_table_hidden_fields'] = !empty( $event_id ) ? '<input type="hidden" name="event_id" value="' . $event_id . '">' : '';
827
+		$event_id = isset($this->_req_data['event_id']) ? $this->_req_data['event_id'] : null;
828
+		$this->_template_args['before_list_table'] = ! empty($event_id) ? '<h2>'.sprintf(__('Viewing Registrations for Event: %s', 'event_espresso'), EEM_Event::instance()->get_one_by_ID($event_id)->get('EVT_name')).'</h2>' : '';
829
+		$this->_template_args['list_table_hidden_fields'] = ! empty($event_id) ? '<input type="hidden" name="event_id" value="'.$event_id.'">' : '';
830 830
 
831 831
 		$this->display_admin_list_table_page_with_no_sidebar();
832 832
 	}
@@ -840,15 +840,15 @@  discard block
 block discarded – undo
840 840
 	*		@access public
841 841
 	*		@return array
842 842
 	*/
843
-	public function get_event_attendees( $per_page = 10, $count = FALSE, $trash = FALSE, $orderby = '' ) {
843
+	public function get_event_attendees($per_page = 10, $count = FALSE, $trash = FALSE, $orderby = '') {
844 844
 
845
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
846
-		require_once(EE_MODELS . 'EEM_Attendee.model.php');
845
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
846
+		require_once(EE_MODELS.'EEM_Attendee.model.php');
847 847
 		//$ATT_MDL = EEM_Attendee::instance();
848 848
 
849
-		$EVT_ID = isset($this->_req_data['event_id']) ? absint( $this->_req_data['event_id'] ) : FALSE;
850
-		$CAT_ID = isset($this->_req_data['category_id']) ? absint( $this->_req_data['category_id'] ) : FALSE;
851
-		$DTT_ID = isset( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : NULL;
849
+		$EVT_ID = isset($this->_req_data['event_id']) ? absint($this->_req_data['event_id']) : FALSE;
850
+		$CAT_ID = isset($this->_req_data['category_id']) ? absint($this->_req_data['category_id']) : FALSE;
851
+		$DTT_ID = isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : NULL;
852 852
 
853 853
 		$this->_req_data['orderby'] = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : $orderby;
854 854
 
@@ -861,92 +861,92 @@  discard block
 block discarded – undo
861 861
 //				$orderby = 'reg.REG_final_price';
862 862
 		}
863 863
 
864
-		$sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'ASC';
864
+		$sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'ASC';
865 865
 
866
-		$current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1;
867
-		$per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page;
866
+		$current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1;
867
+		$per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page;
868 868
 
869 869
 
870
-		$offset = ($current_page-1)*$per_page;
871
-		$limit = $count ? NULL : array( $offset, $per_page );
872
-		$query_params = array(array('Event.status'=>array('IN',  array_keys(EEM_Event::instance()->get_status_array()))));
873
-		if ($EVT_ID){
874
-			$query_params[0]['EVT_ID']=$EVT_ID;
870
+		$offset = ($current_page - 1) * $per_page;
871
+		$limit = $count ? NULL : array($offset, $per_page);
872
+		$query_params = array(array('Event.status'=>array('IN', array_keys(EEM_Event::instance()->get_status_array()))));
873
+		if ($EVT_ID) {
874
+			$query_params[0]['EVT_ID'] = $EVT_ID;
875 875
 		}
876
-		if($CAT_ID){
876
+		if ($CAT_ID) {
877 877
 			throw new EE_Error("You specified a Category Id for this query. Thats odd because we are now using terms and taxonomies. So did you mean the term taxonomy id o rthe term id?");
878 878
 		}
879 879
 
880 880
 		//if DTT is included we do multiple datetimes.
881
-		if ( $DTT_ID ) {
881
+		if ($DTT_ID) {
882 882
 			$query_params[0]['Ticket.Datetime.DTT_ID'] = $DTT_ID;
883 883
 			$query_params['default_where_conditions'] = 'this_model_only';
884 884
 		}
885 885
 
886
-		$status_ids_array = apply_filters( 'FHEE__Extend_Registrations_Admin_Page__get_event_attendees__status_ids_array', array( EEM_Registration::status_id_pending_payment, EEM_Registration::status_id_approved ) );
886
+		$status_ids_array = apply_filters('FHEE__Extend_Registrations_Admin_Page__get_event_attendees__status_ids_array', array(EEM_Registration::status_id_pending_payment, EEM_Registration::status_id_approved));
887 887
 
888
-		$query_params[0]['STS_ID']= array('IN', $status_ids_array );
888
+		$query_params[0]['STS_ID'] = array('IN', $status_ids_array);
889 889
 
890
-		if($trash){
891
-			$query_params[0]['Attendee.status']=  EEM_CPT_Base::post_status_trashed;
890
+		if ($trash) {
891
+			$query_params[0]['Attendee.status'] = EEM_CPT_Base::post_status_trashed;
892 892
 		}
893 893
 
894
-		if ( isset( $this->_req_data['s'] ) ) {
895
-			$sstr = '%' . $this->_req_data['s'] . '%';
894
+		if (isset($this->_req_data['s'])) {
895
+			$sstr = '%'.$this->_req_data['s'].'%';
896 896
 			$query_params[0]['OR'] = array(
897
-				'Event.EVT_name' => array( 'LIKE', $sstr),
898
-				'Event.EVT_desc' => array( 'LIKE', $sstr ),
899
-				'Event.EVT_short_desc' => array( 'LIKE' , $sstr ),
900
-				'Attendee.ATT_fname' => array( 'LIKE', $sstr ),
901
-				'Attendee.ATT_lname' => array( 'LIKE', $sstr ),
902
-				'Attendee.ATT_short_bio' => array( 'LIKE', $sstr ),
903
-				'Attendee.ATT_email' => array('LIKE', $sstr ),
904
-				'Attendee.ATT_address' => array( 'LIKE', $sstr ),
905
-				'Attendee.ATT_address2' => array( 'LIKE', $sstr ),
906
-				'Attendee.ATT_city' => array( 'LIKE', $sstr ),
907
-				'REG_final_price' => array( 'LIKE', $sstr ),
908
-				'REG_code' => array( 'LIKE', $sstr ),
909
-				'REG_count' => array( 'LIKE' , $sstr ),
910
-				'REG_group_size' => array( 'LIKE' , $sstr ),
911
-				'Ticket.TKT_name' => array( 'LIKE', $sstr ),
912
-				'Ticket.TKT_description' => array( 'LIKE', $sstr )
897
+				'Event.EVT_name' => array('LIKE', $sstr),
898
+				'Event.EVT_desc' => array('LIKE', $sstr),
899
+				'Event.EVT_short_desc' => array('LIKE', $sstr),
900
+				'Attendee.ATT_fname' => array('LIKE', $sstr),
901
+				'Attendee.ATT_lname' => array('LIKE', $sstr),
902
+				'Attendee.ATT_short_bio' => array('LIKE', $sstr),
903
+				'Attendee.ATT_email' => array('LIKE', $sstr),
904
+				'Attendee.ATT_address' => array('LIKE', $sstr),
905
+				'Attendee.ATT_address2' => array('LIKE', $sstr),
906
+				'Attendee.ATT_city' => array('LIKE', $sstr),
907
+				'REG_final_price' => array('LIKE', $sstr),
908
+				'REG_code' => array('LIKE', $sstr),
909
+				'REG_count' => array('LIKE', $sstr),
910
+				'REG_group_size' => array('LIKE', $sstr),
911
+				'Ticket.TKT_name' => array('LIKE', $sstr),
912
+				'Ticket.TKT_description' => array('LIKE', $sstr)
913 913
 				);
914 914
 		}
915 915
 
916 916
 		$query_params['order_by'][$orderby] = $sort;
917 917
 		$query_params['limit'] = $limit;
918
-		$query_params['force_join'] = array('Attendee');//force join to attendee model so that it gets cached, because we're going to need the attendee for each registration
919
-		if($count){
918
+		$query_params['force_join'] = array('Attendee'); //force join to attendee model so that it gets cached, because we're going to need the attendee for each registration
919
+		if ($count) {
920 920
 			$registrations = EEM_Registration::instance()->count(array($query_params[0]));
921
-		}else{
921
+		} else {
922 922
 			$registrations = EEM_Registration::instance()->get_all($query_params);
923 923
 
924 924
 
925 925
 	//		$registrations = EEM_Registration::instance();
926 926
 	//		$all_attendees = EEM_Attendee::instance()->get_event_attendees( $EVT_ID, $CAT_ID, $reg_status, $trash, $orderby, $sort, $limit, $output );
927
-			if ( isset( $registrations[0] ) && $registrations[0] instanceof EE_Registration ) {
927
+			if (isset($registrations[0]) && $registrations[0] instanceof EE_Registration) {
928 928
 				//EEH_Debug_Tools::printr( $all_attendees[0], '$all_attendees[0]  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
929 929
 				// name
930 930
 				$first_registration = $registrations[0];
931 931
 				$event_obj = $first_registration->event_obj();
932
-				if($event_obj){
932
+				if ($event_obj) {
933 933
 					$event_name = $first_registration->event_obj()->name();
934
-					$event_date = 'TODO: we need to get date from earliest price date or should this be the actual event date?';//$first_registration->date_obj()->reg_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 ) : '';
934
+					$event_date = 'TODO: we need to get date from earliest price date or should this be the actual event date?'; //$first_registration->date_obj()->reg_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 ) : '';
935 935
 					// edit event link
936
-					if ( $event_name != '' ) {
937
-						$edit_event_url = self::add_query_args_and_nonce( array( 'action'=>'edit_event', 'EVT_ID'=>$EVT_ID ), EVENTS_ADMIN_URL );
938
-						$edit_event_lnk = '<a href="'.$edit_event_url.'" title="' . esc_attr__( 'Edit ', 'event_espresso' ) . $event_name . '">' . __( 'Edit Event', 'event_espresso' ) . '</a>';
939
-						$event_name .= ' <span class="admin-page-header-edit-lnk not-bold">' . $edit_event_lnk . '</span>' ;
936
+					if ($event_name != '') {
937
+						$edit_event_url = self::add_query_args_and_nonce(array('action'=>'edit_event', 'EVT_ID'=>$EVT_ID), EVENTS_ADMIN_URL);
938
+						$edit_event_lnk = '<a href="'.$edit_event_url.'" title="'.esc_attr__('Edit ', 'event_espresso').$event_name.'">'.__('Edit Event', 'event_espresso').'</a>';
939
+						$event_name .= ' <span class="admin-page-header-edit-lnk not-bold">'.$edit_event_lnk.'</span>';
940 940
 					}
941 941
 
942
-					$back_2_reg_url = self::add_query_args_and_nonce( array( 'action'=>'default' ), REG_ADMIN_URL );
943
-					$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>';
942
+					$back_2_reg_url = self::add_query_args_and_nonce(array('action'=>'default'), REG_ADMIN_URL);
943
+					$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>';
944 944
 
945 945
 					$this->_template_args['before_admin_page_content'] = '
946 946
 				<div id="admin-page-header">
947
-					<h1><span class="small-text not-bold">'.__( 'Event: ', 'event_espresso' ).'</span>'. $event_name .'</h1>
948
-					<h3><span class="small-text not-bold">'.__( 'Date: ', 'event_espresso' ). '</span>'. $event_date .'</h3>
949
-					<span class="admin-page-header-go-back-lnk not-bold">' . $back_2_reg_lnk . '</span>
947
+					<h1><span class="small-text not-bold">'.__('Event: ', 'event_espresso').'</span>'.$event_name.'</h1>
948
+					<h3><span class="small-text not-bold">'.__('Date: ', 'event_espresso').'</span>'.$event_date.'</h3>
949
+					<span class="admin-page-header-go-back-lnk not-bold">' . $back_2_reg_lnk.'</span>
950 950
 				</div>
951 951
 				';
952 952
 				}
Please login to merge, or discard this patch.
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,6 +1,7 @@  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 6
 /**
6 7
  * Event Espresso
@@ -679,8 +680,9 @@  discard block
 block discarded – undo
679 680
 			EE_Error::add_error(__('Missing some required data to toggle the Check-in', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__  );
680 681
 		}
681 682
 
682
-		if ( defined('DOING_AJAX' ) )
683
-			return $new_status;
683
+		if ( defined('DOING_AJAX' ) ) {
684
+					return $new_status;
685
+		}
684 686
 
685 687
 		$this->_redirect_after_action( FALSE,'', '', $query_args, TRUE );
686 688
 
@@ -918,7 +920,7 @@  discard block
 block discarded – undo
918 920
 		$query_params['force_join'] = array('Attendee');//force join to attendee model so that it gets cached, because we're going to need the attendee for each registration
919 921
 		if($count){
920 922
 			$registrations = EEM_Registration::instance()->count(array($query_params[0]));
921
-		}else{
923
+		} else{
922 924
 			$registrations = EEM_Registration::instance()->get_all($query_params);
923 925
 
924 926
 
Please login to merge, or discard this patch.
admin/extend/transactions/Extend_Transactions_Admin_Page.core.php 4 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
 	 *
136 136
 	 * @access private
137 137
 	 * @param string $period
138
-	 * @return int
138
+	 * @return string
139 139
 	 */
140 140
 	private function _revenue_per_day_report( $period = '-1 month' ) {
141 141
 
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
 	 *
194 194
 	 * @access private
195 195
 	 * @param string $period
196
-	 * @return int
196
+	 * @return string
197 197
 	 */
198 198
 	private function _revenue_per_event_report( $period = '-1 month' ) {
199 199
 
Please login to merge, or discard this patch.
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -105,10 +105,10 @@
 block discarded – undo
105 105
 	/**
106 106
 	 * _transaction_reports
107 107
 	 * 	generates Business Reports regarding Transactions
108
-	*
108
+	 *
109 109
 	 * @access protected
110
-	*	@return void
111
-	*/
110
+	 *	@return void
111
+	 */
112 112
 	protected function _transaction_reports() {
113 113
 
114 114
 		$page_args = array();
Please login to merge, or discard this patch.
Spacing   +40 added lines, -40 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
 /**
@@ -35,11 +35,11 @@  discard block
 block discarded – undo
35 35
 	 * @param bool $routing
36 36
 	 * @return \Extend_Transactions_Admin_Page
37 37
 	 */
38
-	public function __construct( $routing = TRUE ) {
39
-		parent::__construct( $routing );
40
-		define( 'TXN_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND . 'transactions/templates/');
41
-		define( 'TXN_CAF_ASSETS', EE_CORE_CAF_ADMIN_EXTEND . 'transactions/assets/');
42
-		define( 'TXN_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL . 'transactions/assets/');
38
+	public function __construct($routing = TRUE) {
39
+		parent::__construct($routing);
40
+		define('TXN_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND.'transactions/templates/');
41
+		define('TXN_CAF_ASSETS', EE_CORE_CAF_ADMIN_EXTEND.'transactions/assets/');
42
+		define('TXN_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL.'transactions/assets/');
43 43
 	}
44 44
 
45 45
 
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 	 * @return void
52 52
 	 */
53 53
 	protected function _extend_page_config() {
54
-		$this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND . 'transactions';
54
+		$this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND.'transactions';
55 55
 
56 56
 		$new_page_routes = array(
57 57
 			'reports' => array(
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 			)
61 61
 		);
62 62
 
63
-		$this->_page_routes = array_merge( $this->_page_routes, $new_page_routes );
63
+		$this->_page_routes = array_merge($this->_page_routes, $new_page_routes);
64 64
 
65 65
 		$new_page_config = array(
66 66
 			'reports' => array(
@@ -74,11 +74,11 @@  discard block
 block discarded – undo
74 74
 						'filename' => 'transactions_reports'
75 75
 					)
76 76
 				),
77
-				'help_tour' => array( 'Transaction_Reports_Help_Tour' ),
77
+				'help_tour' => array('Transaction_Reports_Help_Tour'),
78 78
 				'require_nonce' => FALSE
79 79
 			)
80 80
 		);
81
-		$this->_page_config = array_merge( $this->_page_config, $new_page_config );
81
+		$this->_page_config = array_merge($this->_page_config, $new_page_config);
82 82
 	}
83 83
 
84 84
 
@@ -94,8 +94,8 @@  discard block
 block discarded – undo
94 94
 		wp_enqueue_style('jquery-jqplot-css');
95 95
 		//scripts
96 96
 		global $is_IE;
97
-		if ( $is_IE ) {
98
-			wp_enqueue_script( 'excanvas' );
97
+		if ($is_IE) {
98
+			wp_enqueue_script('excanvas');
99 99
 		}
100 100
 		wp_enqueue_script('jqplot-all');
101 101
 	}
@@ -113,13 +113,13 @@  discard block
 block discarded – undo
113 113
 
114 114
 		$page_args = array();
115 115
 
116
-		$page_args['admin_reports'][] = $this->_revenue_per_day_report( '-1 month' );  //  option: '-1 week', '-2 weeks' defaults to '-1 month'
117
-		$page_args['admin_reports'][] = $this->_revenue_per_event_report( '-1 month' ); //  option: '-1 week', '-2 weeks' defaults to '-1 month'
116
+		$page_args['admin_reports'][] = $this->_revenue_per_day_report('-1 month'); //  option: '-1 week', '-2 weeks' defaults to '-1 month'
117
+		$page_args['admin_reports'][] = $this->_revenue_per_event_report('-1 month'); //  option: '-1 week', '-2 weeks' defaults to '-1 month'
118 118
 //		$page_args['admin_reports'][] = 'chart1';
119 119
 
120
-		$template_path = EE_ADMIN_TEMPLATE . 'admin_reports.template.php';
120
+		$template_path = EE_ADMIN_TEMPLATE.'admin_reports.template.php';
121 121
 		$this->_admin_page_title = __('Transactions', 'event_espresso');
122
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, $page_args, TRUE );
122
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, $page_args, TRUE);
123 123
 
124 124
 
125 125
 		// the final template wrapper
@@ -137,37 +137,37 @@  discard block
 block discarded – undo
137 137
 	 * @param string $period
138 138
 	 * @return int
139 139
 	 */
140
-	private function _revenue_per_day_report( $period = '-1 month' ) {
140
+	private function _revenue_per_day_report($period = '-1 month') {
141 141
 
142 142
 		$report_ID = 'txn-admin-revenue-per-day-report-dv';
143 143
 		$report_JS = 'espresso_txn_admin_revenue_per_day';
144 144
 
145
-		wp_enqueue_script( $report_JS, TXN_CAF_ASSETS_URL . $report_JS . '_report.js', array('jqplot-all'), '1.0', TRUE);
145
+		wp_enqueue_script($report_JS, TXN_CAF_ASSETS_URL.$report_JS.'_report.js', array('jqplot-all'), '1.0', TRUE);
146 146
 
147 147
 		$TXN = EEM_Transaction::instance();
148 148
 
149
-		$results = $TXN->get_revenue_per_day_report( $period );
149
+		$results = $TXN->get_revenue_per_day_report($period);
150 150
 		//EEH_Debug_Tools::printr( $results, '$registrations_per_day' );
151 151
 		$revenue = array();
152
-		$xmin = date( 'Y-m-d', strtotime( '+1 year' ));
152
+		$xmin = date('Y-m-d', strtotime('+1 year'));
153 153
 		$xmax = 0;
154 154
 		$ymax = 0;
155 155
 
156 156
 		$results = (array) $results;
157 157
 
158
-		foreach ( $results as $result ) {
159
-			$revenue[] = array( $result->txnDate, (float)$result->revenue );
160
-			$xmin = strtotime( $result->txnDate ) < strtotime( $xmin ) ? $result->txnDate : $xmin;
161
-			$xmax = strtotime( $result->txnDate ) > strtotime( $xmax ) ? $result->txnDate : $xmax;
158
+		foreach ($results as $result) {
159
+			$revenue[] = array($result->txnDate, (float) $result->revenue);
160
+			$xmin = strtotime($result->txnDate) < strtotime($xmin) ? $result->txnDate : $xmin;
161
+			$xmax = strtotime($result->txnDate) > strtotime($xmax) ? $result->txnDate : $xmax;
162 162
 			$ymax = $result->revenue > $ymax ? $result->revenue : $ymax;
163 163
 		}
164 164
 
165
-		$xmin = date( 'Y-m-d', strtotime( date( 'Y-m-d', strtotime($xmin)) . ' -1 day' ));
166
-		$xmax = date( 'Y-m-d', strtotime( date( 'Y-m-d', strtotime($xmax)) . ' +1 day' ));
165
+		$xmin = date('Y-m-d', strtotime(date('Y-m-d', strtotime($xmin)).' -1 day'));
166
+		$xmax = date('Y-m-d', strtotime(date('Y-m-d', strtotime($xmax)).' +1 day'));
167 167
 		// calculate # days between our min and max dates
168
-		$span = floor( (strtotime($xmax) - strtotime($xmin)) / (60*60*24)) + 1;
168
+		$span = floor((strtotime($xmax) - strtotime($xmin)) / (60 * 60 * 24)) + 1;
169 169
 
170
-		$report_title = __( 'Total Revenue per Day' );
170
+		$report_title = __('Total Revenue per Day');
171 171
 
172 172
 		$report_params = array(
173 173
 			'title' 		=> $report_title,
@@ -178,9 +178,9 @@  discard block
 block discarded – undo
178 178
 			'ymax' 		=> ceil($ymax * 1.25),
179 179
 			'span' 		=> $span,
180 180
 			'width'		=> ceil(900 / $span),
181
-			'noTxnMsg'	=> sprintf( __('<h2>%s</h2><p>There are currently no transaction records in the last month for this report.</p>', 'event_espresso'), $report_title )
181
+			'noTxnMsg'	=> sprintf(__('<h2>%s</h2><p>There are currently no transaction records in the last month for this report.</p>', 'event_espresso'), $report_title)
182 182
 		);
183
-		wp_localize_script( $report_JS, 'txnRevPerDay', $report_params );
183
+		wp_localize_script($report_JS, 'txnRevPerDay', $report_params);
184 184
 
185 185
 		return $report_ID;
186 186
 	}
@@ -195,29 +195,29 @@  discard block
 block discarded – undo
195 195
 	 * @param string $period
196 196
 	 * @return int
197 197
 	 */
198
-	private function _revenue_per_event_report( $period = '-1 month' ) {
198
+	private function _revenue_per_event_report($period = '-1 month') {
199 199
 
200 200
 		$report_ID = 'txn-admin-revenue-per-event-report-dv';
201 201
 		$report_JS = 'espresso_txn_admin_revenue_per_event';
202 202
 
203
-		wp_enqueue_script( $report_JS, TXN_CAF_ASSETS_URL . $report_JS . '_report.js', array('jqplot-all'), '1.0', TRUE);
203
+		wp_enqueue_script($report_JS, TXN_CAF_ASSETS_URL.$report_JS.'_report.js', array('jqplot-all'), '1.0', TRUE);
204 204
 
205 205
 		$TXN = EEM_Transaction::instance();
206 206
 
207
-		$results = $TXN->get_revenue_per_event_report( $period );
207
+		$results = $TXN->get_revenue_per_event_report($period);
208 208
 
209 209
 		//EEH_Debug_Tools::printr( $results, '$registrations_per_event' );
210 210
 		$revenue = array();
211 211
 		$results = (array) $results;
212
-		foreach ( $results as $result ) {
213
-			$event_name = stripslashes( html_entity_decode( $result->event_name, ENT_QUOTES, 'UTF-8' ));
214
-			$event_name = wp_trim_words( $event_name, 5, '...' );
215
-			$revenue[] = array( $event_name, (float)$result->revenue );
212
+		foreach ($results as $result) {
213
+			$event_name = stripslashes(html_entity_decode($result->event_name, ENT_QUOTES, 'UTF-8'));
214
+			$event_name = wp_trim_words($event_name, 5, '...');
215
+			$revenue[] = array($event_name, (float) $result->revenue);
216 216
 		}
217 217
 
218 218
 		$span = $period == 'week' ? 9 : 33;
219 219
 
220
-		$report_title = __( 'Total Revenue per Event' );
220
+		$report_title = __('Total Revenue per Event');
221 221
 
222 222
 		$report_params = array(
223 223
 			'title' 		=> $report_title,
@@ -225,9 +225,9 @@  discard block
 block discarded – undo
225 225
 			'revenue'	=> $revenue,
226 226
 			'span' 		=> $span,
227 227
 			'width'		=> ceil(900 / $span),
228
-			'noTxnMsg'	=> sprintf( __('<h2>%s</h2><p>There are currently no transaction records in the last month for this report.</p>', 'event_espresso'), $report_title )
228
+			'noTxnMsg'	=> sprintf(__('<h2>%s</h2><p>There are currently no transaction records in the last month for this report.</p>', 'event_espresso'), $report_title)
229 229
 		);
230
-		wp_localize_script( $report_JS, 'revenuePerEvent', $report_params );
230
+		wp_localize_script($report_JS, 'revenuePerEvent', $report_params);
231 231
 
232 232
 		return $report_ID;
233 233
 	}
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,8 +6,9 @@
 block discarded – undo
6 6
  * @package Event Espresso
7 7
  * @subpackage messages
8 8
  */
9
-if (!defined('EVENT_ESPRESSO_VERSION') )
9
+if (!defined('EVENT_ESPRESSO_VERSION') ) {
10 10
 	exit('NO direct script access allowed');
11
+}
11 12
 
12 13
 /**
13 14
  *
Please login to merge, or discard this patch.