Completed
Branch FET-7999-purchasing-agent (117637)
by
unknown
65:16 queued 55:09
created
caffeinated/admin/new/pricing/espresso_events_Pricing_Hooks.class.php 3 patches
Doc Comments   +19 added lines, -2 removed lines patch added patch discarded remove patch
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
 	 * Handles saving everything related to Tickets (datetimes, tickets, prices)
182 182
 	 * @param  EE_Event $evtobj The Event object we're attaching data to
183 183
 	 * @param  array    $data   The request data from the form
184
-	 * @return bool             success or fail
184
+	 * @return boolean|null             success or fail
185 185
 	 */
186 186
 	public function dtt_and_tickets_caf_update( $evtobj, $data ) {
187 187
 		//first we need to start with datetimes cause they are the "root" items attached to events.
@@ -613,7 +613,7 @@  discard block
 block discarded – undo
613 613
 	 * @param bool 		$new_prices Whether attach existing incoming prices or create new ones.
614 614
 	 * @param int|bool 		$base_price if FALSE then NOT doing a base price add.
615 615
 	 * @param int|bool 		$base_price_id  if present then this is the base_price_id being updated.
616
-	 * @return  void
616
+	 * @return  EE_Ticket
617 617
 	 */
618 618
 	protected function  _add_prices_to_ticket( $prices = array(), EE_Ticket $ticket, $new_prices = FALSE, $base_price = FALSE, $base_price_id = FALSE ) {
619 619
 
@@ -825,6 +825,9 @@  discard block
 block discarded – undo
825 825
 
826 826
 
827 827
 
828
+	/**
829
+	 * @param integer $dttrow
830
+	 */
828 831
 	protected function _get_datetime_row( $dttrow, EE_Datetime $dtt, $datetime_tickets, $all_tickets, $default = FALSE, $all_dtts = array() ) {
829 832
 
830 833
 		$dtt_display_template_args = array(
@@ -848,6 +851,7 @@  discard block
 block discarded – undo
848 851
 	 *                               				object.
849 852
 	 * @param bool   $default  		         Whether a default row is being generated or not.
850 853
 	 * @param EE_Datetime[] $all_dtts             This is the array of all datetimes used in the editor.
854
+	 * @param EE_Datetime|null $dtt
851 855
 	 *
852 856
 	 * @return string Generated edit row.
853 857
 	 */
@@ -882,6 +886,10 @@  discard block
 block discarded – undo
882 886
 	}
883 887
 
884 888
 
889
+	/**
890
+	 * @param EE_Datetime|null $dtt
891
+	 * @param boolean $default
892
+	 */
885 893
 	protected function _get_dtt_attached_tickets_row( $dttrow, $dtt, $datetime_tickets, $all_tickets, $default ) {
886 894
 
887 895
 		$template_args = array(
@@ -1088,6 +1096,9 @@  discard block
 block discarded – undo
1088 1096
 
1089 1097
 
1090 1098
 
1099
+	/**
1100
+	 * @param integer $tktrow
1101
+	 */
1091 1102
 	protected function _get_tax_rows( $tktrow, $ticket ) {
1092 1103
 		$tax_rows = '';
1093 1104
 		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_ticket_tax_row.template.php';
@@ -1121,6 +1132,9 @@  discard block
 block discarded – undo
1121 1132
 
1122 1133
 
1123 1134
 
1135
+	/**
1136
+	 * @param boolean $default
1137
+	 */
1124 1138
 	protected function _get_ticket_price_row( $tktrow, $prcrow, $price, $default, $ticket, $show_trash = TRUE, $show_create = TRUE ) {
1125 1139
 		$send_disabled = !empty( $ticket ) && $ticket->get('TKT_deleted') ? TRUE : FALSE;
1126 1140
 		$template_args = array(
@@ -1227,6 +1241,9 @@  discard block
 block discarded – undo
1227 1241
 
1228 1242
 
1229 1243
 
1244
+	/**
1245
+	 * @param boolean $default
1246
+	 */
1230 1247
 	protected function _get_ticket_datetime_list_item( $dttrow, $tktrow, $dtt, $ticket, $ticket_datetimes, $default ) {
1231 1248
 		$dttid = !empty($dtt) ? $dtt->ID() : 0;
1232 1249
 		$displayrow = !empty($dtt) ? $dtt->get('DTT_order') : 0;
Please login to merge, or discard this patch.
Braces   +30 added lines, -19 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
 
167 168
 	public function caf_updates( $update_callbacks ) {
168 169
 		foreach ( $update_callbacks as $key => $callback ) {
169
-			if ( $callback[1] == '_default_tickets_update' )
170
-				unset( $update_callbacks[$key] );
170
+			if ( $callback[1] == '_default_tickets_update' ) {
171
+							unset( $update_callbacks[$key] );
172
+			}
171 173
 		}
172 174
 
173 175
 		$update_callbacks[] = array( $this, 'dtt_and_tickets_caf_update' );
@@ -268,8 +270,9 @@  discard block
 block discarded – undo
268 270
 			$dtts_to_delete = array_diff( $old_datetimes, array_keys($saved_dtts) );
269 271
 			foreach ( $dtts_to_delete as $id ) {
270 272
 				$id = absint( $id );
271
-				if ( empty( $id ) )
272
-					continue;
273
+				if ( empty( $id ) ) {
274
+									continue;
275
+				}
273 276
 
274 277
 				$dtt_to_remove = EE_Registry::instance()->load_model('Datetime')->get_one_by_ID($id);
275 278
 
@@ -507,8 +510,9 @@  discard block
 block discarded – undo
507 510
 				}
508 511
 
509 512
 				//if we have a new_tkt... let's add to it as well
510
-				if ( !empty( $new_tkt ) )
511
-					$new_tkt->_add_relation_to($saved_dtts[$dttrow], 'Datetime' );
513
+				if ( !empty( $new_tkt ) ) {
514
+									$new_tkt->_add_relation_to($saved_dtts[$dttrow], 'Datetime' );
515
+				}
512 516
 			}
513 517
 
514 518
 
@@ -518,8 +522,9 @@  discard block
 block discarded – undo
518 522
 			foreach ( $dtts_removed as $dttrow ) {
519 523
 				$dttrow = (int) $dttrow;
520 524
 				//its entirely possible that a datetime got deleted (instead of just removed from relationship.  So make sure we skip over this if the dtt isn't in the saved_dtts array)
521
-				if ( empty($saved_dtts[$dttrow] ) || ! $saved_dtts[$dttrow] instanceof EE_Datetime )
522
-					continue;
525
+				if ( empty($saved_dtts[$dttrow] ) || ! $saved_dtts[$dttrow] instanceof EE_Datetime ) {
526
+									continue;
527
+				}
523 528
 
524 529
 				$TKT->_remove_relation_to($saved_dtts[$dttrow], 'Datetime');
525 530
 
@@ -529,8 +534,9 @@  discard block
 block discarded – undo
529 534
 					$saved_dtts[$dttrow]->save();
530 535
 				}
531 536
 
532
-				if ( !empty( $new_tkt ) )
533
-					$new_tkt->_remove_relation_to($saved_dtts[$dttrow], 'Datetime');
537
+				if ( !empty( $new_tkt ) ) {
538
+									$new_tkt->_remove_relation_to($saved_dtts[$dttrow], 'Datetime');
539
+				}
534 540
 			}
535 541
 
536 542
 
@@ -572,8 +578,9 @@  discard block
 block discarded – undo
572 578
 			$tkt_to_remove = EE_Registry::instance()->load_model('Ticket')->get_one_by_ID($id);
573 579
 
574 580
 			//if this tkt is a default tkt we leave it alone cause it won't be attached to the datetime
575
-			if ( $tkt_to_remove->get('TKT_is_default') )
576
-				continue;
581
+			if ( $tkt_to_remove->get('TKT_is_default') ) {
582
+							continue;
583
+			}
577 584
 
578 585
 			//if this tkt has any registrations attached so then we just ARCHIVE because we don't actually permanently delete these tickets.
579 586
 			if ( $tkt_to_remove->count_related('Registration') > 0 ) {
@@ -634,13 +641,16 @@  discard block
 block discarded – undo
634 641
 		}
635 642
 
636 643
 		//possibly need to save tkt
637
-		if ( ! $ticket->ID() )
638
-			$ticket->save();
644
+		if ( ! $ticket->ID() ) {
645
+					$ticket->save();
646
+		}
639 647
 
640 648
 		foreach ( $prices as $row => $prc ) {
641 649
 			$prt_id = !empty( $prc['PRT_ID'] ) ? $prc['PRT_ID'] : NULL;
642
-			if ( empty($prt_id) )
643
-				continue; //prices MUST have a price type id.
650
+			if ( empty($prt_id) ) {
651
+							continue;
652
+			}
653
+			//prices MUST have a price type id.
644 654
 			$PRC_values = array(
645 655
 				'PRC_ID' => !empty( $prc['PRC_ID'] ) ? $prc['PRC_ID'] : NULL,
646 656
 				'PRT_ID' => $prt_id,
@@ -784,8 +794,9 @@  discard block
 block discarded – undo
784 794
 				$datetime_tickets[$dttid][] = $tktrow;
785 795
 
786 796
 				//temporary cache of this datetime info for this ticket for later processing of ticket rows.
787
-				if ( !isset( $ticket_datetimes[$tktid] ) || ! in_array( $dttrow, $ticket_datetimes[$tktid] ) )
788
-					$ticket_datetimes[$tktid][] = $dttrow;
797
+				if ( !isset( $ticket_datetimes[$tktid] ) || ! in_array( $dttrow, $ticket_datetimes[$tktid] ) ) {
798
+									$ticket_datetimes[$tktid][] = $dttrow;
799
+				}
789 800
 			}
790 801
 		}
791 802
 
Please login to merge, or discard this patch.
Spacing   +359 added lines, -359 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
 /**
@@ -54,23 +54,23 @@  discard block
 block discarded – undo
54 54
 		$this->_name = 'pricing';
55 55
 
56 56
 		//capability check
57
-		if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_default_prices', 'advanced_ticket_datetime_metabox' ) ) {
57
+		if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_default_prices', 'advanced_ticket_datetime_metabox')) {
58 58
 			return;
59 59
 		}
60 60
 
61
-		EE_Registry::instance()->load_helper( 'DTT_Helper' );
61
+		EE_Registry::instance()->load_helper('DTT_Helper');
62 62
 
63 63
 		//if we were going to add our own metaboxes we'd use the below.
64 64
 		$this->_metaboxes = array(
65 65
 			0 => array(
66
-				'page_route' => array('edit','create_new'),
66
+				'page_route' => array('edit', 'create_new'),
67 67
 				'func' => 'pricing_metabox',
68 68
 				'label' => __('Event Tickets & Datetimes', 'event_espresso'),
69 69
 				'priority' => 'high',
70 70
 				'context' => 'normal'
71 71
 				),
72 72
 
73
-			);/**/
73
+			); /**/
74 74
 
75 75
 		$this->_remove_metaboxes = array(
76 76
 			0 => array(
@@ -89,24 +89,24 @@  discard block
 block discarded – undo
89 89
 		 *
90 90
 		 * @var array  Expected an array returned with 'date' and 'time' keys.
91 91
 		 */
92
-		$this->_date_format_strings = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___set_hooks_properties__date_format_strings', array(
92
+		$this->_date_format_strings = apply_filters('FHEE__espresso_events_Pricing_Hooks___set_hooks_properties__date_format_strings', array(
93 93
 				'date' => 'Y-m-d',
94 94
 				'time' => 'h:i a'
95 95
 			));
96 96
 
97 97
 		//validate
98
-		$this->_date_format_strings['date'] = isset( $this->_date_format_strings['date'] ) ? $this->_date_format_strings['date'] : null;
99
-		$this->_date_format_strings['time'] = isset( $this->_date_format_strings['time'] ) ? $this->_date_format_strings['time'] : null;
98
+		$this->_date_format_strings['date'] = isset($this->_date_format_strings['date']) ? $this->_date_format_strings['date'] : null;
99
+		$this->_date_format_strings['time'] = isset($this->_date_format_strings['time']) ? $this->_date_format_strings['time'] : null;
100 100
 
101 101
 		//validate format strings
102
-		$format_validation = EEH_DTT_Helper::validate_format_string( $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] );
103
-		if ( is_array( $format_validation ) ) {
104
-			$msg = '<p>' . sprintf( __( 'The format "%s" was likely added via a filter and is invalid for the following reasons:', 'event_espresso' ), $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] ) . '</p><ul>';
105
-			foreach ( $format_validation as $error ) {
106
-				$msg .= '<li>' . $error . '</li>';
102
+		$format_validation = EEH_DTT_Helper::validate_format_string($this->_date_format_strings['date'].' '.$this->_date_format_strings['time']);
103
+		if (is_array($format_validation)) {
104
+			$msg = '<p>'.sprintf(__('The format "%s" was likely added via a filter and is invalid for the following reasons:', 'event_espresso'), $this->_date_format_strings['date'].' '.$this->_date_format_strings['time']).'</p><ul>';
105
+			foreach ($format_validation as $error) {
106
+				$msg .= '<li>'.$error.'</li>';
107 107
 			}
108
-			$msg .= '</ul></p><p>' . sprintf( __( '%sPlease note that your date and time formats have been reset to "Y-m-d" and "h:i a" respectively.%s', 'event_espresso' ), '<span style="color:#D54E21;">', '</span>' ) . '</p>';
109
-			EE_Error::add_attention( $msg, __FILE__, __FUNCTION__, __LINE__ );
108
+			$msg .= '</ul></p><p>'.sprintf(__('%sPlease note that your date and time formats have been reset to "Y-m-d" and "h:i a" respectively.%s', 'event_espresso'), '<span style="color:#D54E21;">', '</span>').'</p>';
109
+			EE_Error::add_attention($msg, __FILE__, __FUNCTION__, __LINE__);
110 110
 			$this->_date_format_strings = array(
111 111
 				'date' => 'Y-m-d',
112 112
 				'time' => 'h:i a'
@@ -117,60 +117,60 @@  discard block
 block discarded – undo
117 117
 		$this->_scripts_styles = array(
118 118
 			'registers' => array(
119 119
 				'ee-tickets-datetimes-css' => array(
120
-					'url' => PRICING_ASSETS_URL . 'event-tickets-datetimes.css',
120
+					'url' => PRICING_ASSETS_URL.'event-tickets-datetimes.css',
121 121
 					'type' => 'css'
122 122
 					),
123 123
 				'ee-dtt-ticket-metabox' => array(
124
-					'url' => PRICING_ASSETS_URL . 'ee-datetime-ticket-metabox.js',
124
+					'url' => PRICING_ASSETS_URL.'ee-datetime-ticket-metabox.js',
125 125
 					'depends' => array('ee-datepicker', 'ee-dialog', 'underscore')
126 126
 					)
127 127
 				),
128 128
 			'deregisters' => array(
129
-				'event-editor-css' => array('type' => 'css' ),
129
+				'event-editor-css' => array('type' => 'css'),
130 130
 				'event-datetime-metabox' => array('type' => 'js')
131 131
 				),
132 132
 			'enqueues' => array(
133
-				'ee-tickets-datetimes-css' => array( 'edit', 'create_new' ),
134
-				'ee-dtt-ticket-metabox' => array( 'edit', 'create_new' )
133
+				'ee-tickets-datetimes-css' => array('edit', 'create_new'),
134
+				'ee-dtt-ticket-metabox' => array('edit', 'create_new')
135 135
 				),
136 136
 			'localize' => array(
137 137
 				'ee-dtt-ticket-metabox' => array(
138 138
 					'DTT_TRASH_BLOCK' => array(
139 139
 						'main_warning' => __('The Datetime you are attempting to trash is the only datetime selected for the following ticket(s):', 'event_espresso'),
140 140
 						'after_warning' => __('In order to trash this datetime you must first make sure the above ticket(s) are assigned to other datetimes.', 'event_espresso'),
141
-						'cancel_button' => '<button class="button-secondary ee-modal-cancel">' . __('Cancel', 'event_espresso') . '</button>',
141
+						'cancel_button' => '<button class="button-secondary ee-modal-cancel">'.__('Cancel', 'event_espresso').'</button>',
142 142
 						'single_warning_from_tkt' => __('The Datetime you are attempting to unassign from this ticket is the only remaining datetime for this ticket. Tickets must always have at least one datetime assigned to them.', 'event_espresso'),
143 143
 						'single_warning_from_dtt' => __('The ticket you are attempting to unassign from this datetime cannot be unassigned because the datetime is the only remaining datetime for the ticket.  Tickets must always have at least one datetime assigned to them.', 'event_espresso'),
144
-						'dismiss_button' => '<button class="button-secondary ee-modal-cancel">' . __('Dismiss', 'event_espresso') . '</button>'
144
+						'dismiss_button' => '<button class="button-secondary ee-modal-cancel">'.__('Dismiss', 'event_espresso').'</button>'
145 145
 						),
146 146
 					'DTT_ERROR_MSG' => array(
147 147
 						'no_ticket_name' => __('General Admission', 'event_espresso'),
148
-						'dismiss_button' => '<div class="save-cancel-button-container"><button class="button-secondary ee-modal-cancel">' . __('Dismiss', 'event_espresso') . '</button></div>'
148
+						'dismiss_button' => '<div class="save-cancel-button-container"><button class="button-secondary ee-modal-cancel">'.__('Dismiss', 'event_espresso').'</button></div>'
149 149
 						),
150 150
 					'DTT_OVERSELL_WARNING' => array(
151 151
 						'datetime_ticket' => __('You cannot add this ticket to this datetime because it has a sold amount that is greater than the amount of spots remaining for this datetime.', 'event_espresso'),
152 152
 						'ticket_datetime' => __('You cannot add this datetime to this ticket because the ticket has a sold amount that is greater than the amount of spots remaining on the datetime.', 'event_espresso')
153 153
 						),
154
-					'DTT_CONVERTED_FORMATS' => EEH_DTT_Helper::convert_php_to_js_and_moment_date_formats( $this->_date_format_strings['date'], $this->_date_format_strings['time'] ),
155
-					'DTT_START_OF_WEEK' => array( 'dayValue' => (int) get_option( 'start_of_week' ) )
154
+					'DTT_CONVERTED_FORMATS' => EEH_DTT_Helper::convert_php_to_js_and_moment_date_formats($this->_date_format_strings['date'], $this->_date_format_strings['time']),
155
+					'DTT_START_OF_WEEK' => array('dayValue' => (int) get_option('start_of_week'))
156 156
 					)
157 157
 				)
158 158
 			);
159 159
 
160 160
 
161
-		add_action('AHEE__EE_Admin_Page_CPT__do_extra_autosave_stuff__after_Extend_Events_Admin_Page', array( $this, 'autosave_handling' ), 10 );
162
-		add_filter('FHEE__Events_Admin_Page___insert_update_cpt_item__event_update_callbacks', array( $this, 'caf_updates' ), 10 );
161
+		add_action('AHEE__EE_Admin_Page_CPT__do_extra_autosave_stuff__after_Extend_Events_Admin_Page', array($this, 'autosave_handling'), 10);
162
+		add_filter('FHEE__Events_Admin_Page___insert_update_cpt_item__event_update_callbacks', array($this, 'caf_updates'), 10);
163 163
 	}
164 164
 
165 165
 
166 166
 
167
-	public function caf_updates( $update_callbacks ) {
168
-		foreach ( $update_callbacks as $key => $callback ) {
169
-			if ( $callback[1] == '_default_tickets_update' )
170
-				unset( $update_callbacks[$key] );
167
+	public function caf_updates($update_callbacks) {
168
+		foreach ($update_callbacks as $key => $callback) {
169
+			if ($callback[1] == '_default_tickets_update')
170
+				unset($update_callbacks[$key]);
171 171
 		}
172 172
 
173
-		$update_callbacks[] = array( $this, 'dtt_and_tickets_caf_update' );
173
+		$update_callbacks[] = array($this, 'dtt_and_tickets_caf_update');
174 174
 		return $update_callbacks;
175 175
 	}
176 176
 
@@ -183,11 +183,11 @@  discard block
 block discarded – undo
183 183
 	 * @param  array    $data   The request data from the form
184 184
 	 * @return bool             success or fail
185 185
 	 */
186
-	public function dtt_and_tickets_caf_update( $evtobj, $data ) {
186
+	public function dtt_and_tickets_caf_update($evtobj, $data) {
187 187
 		//first we need to start with datetimes cause they are the "root" items attached to events.
188
-		$saved_dtts = $this->_update_dtts( $evtobj, $data );
188
+		$saved_dtts = $this->_update_dtts($evtobj, $data);
189 189
 		//next tackle the tickets (and prices?)
190
-		$success = $this->_update_tkts( $evtobj, $saved_dtts, $data );
190
+		$success = $this->_update_tkts($evtobj, $saved_dtts, $data);
191 191
 	}
192 192
 
193 193
 
@@ -198,56 +198,56 @@  discard block
 block discarded – undo
198 198
 	 * @param  array    	$data    the request data from the form
199 199
 	 * @return EE_Datetime           array of EE_Datetime ids created/updated.
200 200
 	 */
201
-	protected function _update_dtts( $evt_obj, $data ) {
202
-		$timezone = isset( $data['timezone_string'] ) ? $data['timezone_string'] : NULL;
201
+	protected function _update_dtts($evt_obj, $data) {
202
+		$timezone = isset($data['timezone_string']) ? $data['timezone_string'] : NULL;
203 203
 		$success = TRUE;
204 204
 
205
-		foreach ( $data['edit_event_datetimes'] as $row => $dtt ) {
206
-			$dtt['DTT_EVT_end'] = isset($dtt['DTT_EVT_end']) && ! empty( $dtt['DTT_EVT_end'] ) ? $dtt['DTT_EVT_end'] : $dtt['DTT_EVT_start'];
205
+		foreach ($data['edit_event_datetimes'] as $row => $dtt) {
206
+			$dtt['DTT_EVT_end'] = isset($dtt['DTT_EVT_end']) && ! empty($dtt['DTT_EVT_end']) ? $dtt['DTT_EVT_end'] : $dtt['DTT_EVT_start'];
207 207
 			$datetime_values = array(
208
-				'DTT_ID' => !empty( $dtt['DTT_ID'] ) ? $dtt['DTT_ID'] : NULL,
209
-				'DTT_name' => !empty( $dtt['DTT_name'] ) ? $dtt['DTT_name'] : '',
210
-				'DTT_description' => !empty( $dtt['DTT_description'] ) ? $dtt['DTT_description'] : '',
208
+				'DTT_ID' => ! empty($dtt['DTT_ID']) ? $dtt['DTT_ID'] : NULL,
209
+				'DTT_name' => ! empty($dtt['DTT_name']) ? $dtt['DTT_name'] : '',
210
+				'DTT_description' => ! empty($dtt['DTT_description']) ? $dtt['DTT_description'] : '',
211 211
 				'DTT_EVT_start' => $dtt['DTT_EVT_start'],
212 212
 				'DTT_EVT_end' => $dtt['DTT_EVT_end'],
213
-				'DTT_reg_limit' => empty( $dtt['DTT_reg_limit'] ) ? INF : $dtt['DTT_reg_limit'],
214
-				'DTT_order' => !isset( $dtt['DTT_order'] ) ? $row : $dtt['DTT_order'],
213
+				'DTT_reg_limit' => empty($dtt['DTT_reg_limit']) ? INF : $dtt['DTT_reg_limit'],
214
+				'DTT_order' => ! isset($dtt['DTT_order']) ? $row : $dtt['DTT_order'],
215 215
 				);
216 216
 
217 217
 			//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.
218 218
 
219
-			if ( !empty( $dtt['DTT_ID'] ) ) {
220
-				$DTM = EE_Registry::instance()->load_model('Datetime', array($timezone) )->get_one_by_ID($dtt['DTT_ID'] );
219
+			if ( ! empty($dtt['DTT_ID'])) {
220
+				$DTM = EE_Registry::instance()->load_model('Datetime', array($timezone))->get_one_by_ID($dtt['DTT_ID']);
221 221
 
222 222
 				//set date and time format according to what is set in this class.
223
-				$DTM->set_date_format( $this->_date_format_strings['date'] );
224
-				$DTM->set_time_format( $this->_date_format_strings['time'] );
223
+				$DTM->set_date_format($this->_date_format_strings['date']);
224
+				$DTM->set_time_format($this->_date_format_strings['time']);
225 225
 
226
-				foreach ( $datetime_values as $field => $value ) {
227
-					$DTM->set( $field, $value );
226
+				foreach ($datetime_values as $field => $value) {
227
+					$DTM->set($field, $value);
228 228
 				}
229 229
 
230 230
 				//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.
231 231
 				$saved_dtts[$DTM->ID()] = $DTM;
232 232
 
233 233
 			} else {
234
-				$DTM = EE_Registry::instance()->load_class('Datetime', array( $datetime_values, $timezone ), FALSE, FALSE );
234
+				$DTM = EE_Registry::instance()->load_class('Datetime', array($datetime_values, $timezone), FALSE, FALSE);
235 235
 
236 236
 				//reset date and times to match the format
237
-				$DTM->set_date_format( $this->_date_format_strings['date'] );
238
-				$DTM->set_time_format( $this->_date_format_strings['time'] );
239
-				foreach( $datetime_values as $field => $value ) {
240
-					$DTM->set( $field, $value );
237
+				$DTM->set_date_format($this->_date_format_strings['date']);
238
+				$DTM->set_time_format($this->_date_format_strings['time']);
239
+				foreach ($datetime_values as $field => $value) {
240
+					$DTM->set($field, $value);
241 241
 				}
242 242
 			}
243 243
 
244 244
 
245 245
 			$DTM->save();
246
-			$DTT = $evt_obj->_add_relation_to( $DTM, 'Datetime' );
246
+			$DTT = $evt_obj->_add_relation_to($DTM, 'Datetime');
247 247
 
248 248
 			//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.
249
-			if( $DTT->get_raw('DTT_EVT_start') > $DTT->get_raw('DTT_EVT_end') ) {
250
-				$DTT->set('DTT_EVT_end', $DTT->get('DTT_EVT_start') );
249
+			if ($DTT->get_raw('DTT_EVT_start') > $DTT->get_raw('DTT_EVT_end')) {
250
+				$DTT->set('DTT_EVT_end', $DTT->get('DTT_EVT_start'));
251 251
 				EE_Registry::instance()->load_helper('DTT_Helper');
252 252
 				$DTT = EEH_DTT_Helper::date_time_add($DTT, 'DTT_EVT_end', 'days');
253 253
 				$DTT->save();
@@ -257,30 +257,30 @@  discard block
 block discarded – undo
257 257
 			$saved_dtts[$DTT->ID()] = $DTT;
258 258
 			$saved_dtt_objs[$row] = $DTT;
259 259
 
260
-			$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.
260
+			$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.
261 261
 		}
262 262
 
263 263
 		//now we need to REMOVE any dtts that got deleted.  Keep in mind that this process will only kick in for DTT's that don't have any DTT_sold on them. So its safe to permanently delete at this point.
264
-		$old_datetimes = explode(',', $data['datetime_IDs'] );
264
+		$old_datetimes = explode(',', $data['datetime_IDs']);
265 265
 		$old_datetimes = $old_datetimes[0] == '' ? array() : $old_datetimes;
266 266
 
267
-		if ( is_array( $old_datetimes ) ) {
268
-			$dtts_to_delete = array_diff( $old_datetimes, array_keys($saved_dtts) );
269
-			foreach ( $dtts_to_delete as $id ) {
270
-				$id = absint( $id );
271
-				if ( empty( $id ) )
267
+		if (is_array($old_datetimes)) {
268
+			$dtts_to_delete = array_diff($old_datetimes, array_keys($saved_dtts));
269
+			foreach ($dtts_to_delete as $id) {
270
+				$id = absint($id);
271
+				if (empty($id))
272 272
 					continue;
273 273
 
274 274
 				$dtt_to_remove = EE_Registry::instance()->load_model('Datetime')->get_one_by_ID($id);
275 275
 
276 276
 				//remove tkt relationships.
277 277
 				$related_tickets = $dtt_to_remove->get_many_related('Ticket');
278
-				foreach ( $related_tickets as $tkt ) {
278
+				foreach ($related_tickets as $tkt) {
279 279
 					$dtt_to_remove->_remove_relation_to($tkt, 'Ticket');
280 280
 				}
281 281
 
282 282
 
283
-				$evt_obj->_remove_relation_to( $id, 'Datetime' );
283
+				$evt_obj->_remove_relation_to($id, 'Datetime');
284 284
 			}
285 285
 		}
286 286
 
@@ -299,77 +299,77 @@  discard block
 block discarded – undo
299 299
 	 * @param  array            $data       incoming request data
300 300
 	 * @return EE_Ticket[]
301 301
 	 */
302
-	protected function _update_tkts( $evtobj, $saved_dtts, $data ) {
302
+	protected function _update_tkts($evtobj, $saved_dtts, $data) {
303 303
 		//stripslashes because WP filtered the $_POST ($data) array to add slashes
304 304
 		$data = stripslashes_deep($data);
305
-		$timezone = isset( $data['timezone_string'] ) ? $data['timezone_string'] : NULL;
305
+		$timezone = isset($data['timezone_string']) ? $data['timezone_string'] : NULL;
306 306
 		$saved_tickets = $dtts_on_existing = array();
307
-		$old_tickets = isset( $data['ticket_IDs'] ) ? explode(',', $data['ticket_IDs'] ) : array();
307
+		$old_tickets = isset($data['ticket_IDs']) ? explode(',', $data['ticket_IDs']) : array();
308 308
 
309 309
 		//load money helper
310
-		EE_Registry::instance()->load_helper( 'Money' );
310
+		EE_Registry::instance()->load_helper('Money');
311 311
 
312
-		foreach ( $data['edit_tickets'] as $row => $tkt ) {
312
+		foreach ($data['edit_tickets'] as $row => $tkt) {
313 313
 
314 314
 			$update_prices = $create_new_TKT = $ticket_sold = FALSE;
315 315
 			$new_default = $new_tkt = NULL;
316 316
 
317 317
 			//figure out what dtts were added to the ticket and what dtts were removed from the ticket in the session.
318 318
 
319
-			$starting_tkt_dtt_rows = explode(',',$data['starting_ticket_datetime_rows'][$row]);
320
-			$tkt_dtt_rows = explode(',', $data['ticket_datetime_rows'][$row] );
319
+			$starting_tkt_dtt_rows = explode(',', $data['starting_ticket_datetime_rows'][$row]);
320
+			$tkt_dtt_rows = explode(',', $data['ticket_datetime_rows'][$row]);
321 321
 			$dtts_added = array_diff($tkt_dtt_rows, $starting_tkt_dtt_rows);
322 322
 			$dtts_removed = array_diff($starting_tkt_dtt_rows, $tkt_dtt_rows);
323 323
 
324 324
 			//note we are doing conversions to floats here instead of allowing EE_Money_Field to handle because we're doing calcs prior to using the models.
325 325
 			//note incoming ['TKT_price'] value is already in standard notation (via js).
326
-			$ticket_price = isset( $tkt['TKT_price'] ) ?  round ( (float) $tkt['TKT_price'], 3 ) : 0;
326
+			$ticket_price = isset($tkt['TKT_price']) ? round((float) $tkt['TKT_price'], 3) : 0;
327 327
 
328 328
 			//note incoming base price needs converted from localized value.
329
-			$base_price = isset( $tkt['TKT_base_price'] ) ? EEH_Money::convert_to_float_from_localized_money( $tkt['TKT_base_price'] ) : 0;
329
+			$base_price = isset($tkt['TKT_base_price']) ? EEH_Money::convert_to_float_from_localized_money($tkt['TKT_base_price']) : 0;
330 330
 			//if ticket price == 0 and $base_price != 0 then ticket price == base_price
331 331
 			$ticket_price = $ticket_price === 0 && $base_price !== 0 ? $base_price : $ticket_price;
332
-			$base_price_id = isset( $tkt['TKT_base_price_ID'] ) ? $tkt['TKT_base_price_ID'] : 0;
332
+			$base_price_id = isset($tkt['TKT_base_price_ID']) ? $tkt['TKT_base_price_ID'] : 0;
333 333
 
334 334
 			$price_rows = is_array($data['edit_prices']) && isset($data['edit_prices'][$row]) ? $data['edit_prices'][$row] : array();
335 335
 
336 336
 			$now = null;
337
-			if ( empty( $tkt['TKT_start_date'] ) ) {
337
+			if (empty($tkt['TKT_start_date'])) {
338 338
 				//lets' use now in the set timezone.
339
-				$now = new DateTime( 'now', new DateTimeZone( $evtobj->get_timezone() ) );
340
-				$tkt['TKT_start_date'] = $now->format( $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] );
339
+				$now = new DateTime('now', new DateTimeZone($evtobj->get_timezone()));
340
+				$tkt['TKT_start_date'] = $now->format($this->_date_format_strings['date'].' '.$this->_date_format_strings['time']);
341 341
 			}
342 342
 
343
-			if ( empty( $tkt['TKT_end_date'] ) ) {
343
+			if (empty($tkt['TKT_end_date'])) {
344 344
 				/**
345 345
 				 * set the TKT_end_date to the first datetime attached to the ticket.
346 346
 				 */
347
-				$first_dtt = $saved_dtts[reset( $tkt_dtt_rows )];
348
-				$tkt['TKT_end_date'] = $first_dtt->start_date_and_time( $this->_date_format_strings['date'] . ' ' . $this->_date_format_string['time'] );
347
+				$first_dtt = $saved_dtts[reset($tkt_dtt_rows)];
348
+				$tkt['TKT_end_date'] = $first_dtt->start_date_and_time($this->_date_format_strings['date'].' '.$this->_date_format_string['time']);
349 349
 			}
350 350
 
351 351
 			$TKT_values = array(
352
-				'TKT_ID' => !empty( $tkt['TKT_ID'] ) ? $tkt['TKT_ID'] : NULL,
353
-				'TTM_ID' => !empty( $tkt['TTM_ID'] ) ? $tkt['TTM_ID'] : 0,
354
-				'TKT_name' => !empty( $tkt['TKT_name'] ) ? $tkt['TKT_name'] : '',
355
-				'TKT_description' => !empty( $tkt['TKT_description'] ) && $tkt['TKT_description'] != __('You can modify this description', 'event_espresso') ? $tkt['TKT_description'] : '',
352
+				'TKT_ID' => ! empty($tkt['TKT_ID']) ? $tkt['TKT_ID'] : NULL,
353
+				'TTM_ID' => ! empty($tkt['TTM_ID']) ? $tkt['TTM_ID'] : 0,
354
+				'TKT_name' => ! empty($tkt['TKT_name']) ? $tkt['TKT_name'] : '',
355
+				'TKT_description' => ! empty($tkt['TKT_description']) && $tkt['TKT_description'] != __('You can modify this description', 'event_espresso') ? $tkt['TKT_description'] : '',
356 356
 				'TKT_start_date' => $tkt['TKT_start_date'],
357 357
 				'TKT_end_date' => $tkt['TKT_end_date'],
358
-				'TKT_qty' => empty( $tkt['TKT_qty'] ) ? INF : $tkt['TKT_qty'],
359
-				'TKT_uses' => empty( $tkt['TKT_uses'] ) ? INF : $tkt['TKT_uses'],
360
-				'TKT_min' => empty( $tkt['TKT_min'] ) ? 0 : $tkt['TKT_min'],
361
-				'TKT_max' => empty( $tkt['TKT_max'] ) ? INF : $tkt['TKT_max'],
358
+				'TKT_qty' => empty($tkt['TKT_qty']) ? INF : $tkt['TKT_qty'],
359
+				'TKT_uses' => empty($tkt['TKT_uses']) ? INF : $tkt['TKT_uses'],
360
+				'TKT_min' => empty($tkt['TKT_min']) ? 0 : $tkt['TKT_min'],
361
+				'TKT_max' => empty($tkt['TKT_max']) ? INF : $tkt['TKT_max'],
362 362
 				'TKT_row' => $row,
363
-				'TKT_order' => isset( $tkt['TKT_order'] ) ? $tkt['TKT_order'] : 0,
364
-				'TKT_taxable' => !empty( $tkt['TKT_taxable'] ) ? 1 : 0,
365
-				'TKT_required' => !empty( $tkt['TKT_required'] ) ? 1 : 0,
363
+				'TKT_order' => isset($tkt['TKT_order']) ? $tkt['TKT_order'] : 0,
364
+				'TKT_taxable' => ! empty($tkt['TKT_taxable']) ? 1 : 0,
365
+				'TKT_required' => ! empty($tkt['TKT_required']) ? 1 : 0,
366 366
 				'TKT_price' => $ticket_price
367 367
 				);
368 368
 
369 369
 
370 370
 
371 371
 			//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.
372
-			if ( isset( $tkt['TKT_is_default'] ) && $tkt['TKT_is_default'] ) {
372
+			if (isset($tkt['TKT_is_default']) && $tkt['TKT_is_default']) {
373 373
 				$TKT_values['TKT_ID'] = 0;
374 374
 				$TKT_values['TKT_is_default'] = 0;
375 375
 				$update_prices = TRUE;
@@ -379,28 +379,28 @@  discard block
 block discarded – undo
379 379
 			//we actually do our saves ahead 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.
380 380
 			//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.
381 381
 
382
-			if ( !empty( $TKT_values['TKT_ID'] ) ) {
383
-				$TKT = EE_Registry::instance()->load_model( 'Ticket', array( $timezone ) )->get_one_by_ID( $tkt['TKT_ID'] );
382
+			if ( ! empty($TKT_values['TKT_ID'])) {
383
+				$TKT = EE_Registry::instance()->load_model('Ticket', array($timezone))->get_one_by_ID($tkt['TKT_ID']);
384 384
 
385 385
 				//set ticket formats
386
-				$ticket_sold = $TKT->count_related('Registration', array( array( 'STS_ID' => array( 'NOT IN', array( EEM_Registration::status_id_incomplete ) ) ) ) ) > 0 ? true : false;
387
-				$TKT->set_date_format( $this->_date_format_strings['date'] );
388
-				$TKT->set_time_format( $this->_date_format_strings['time'] );
386
+				$ticket_sold = $TKT->count_related('Registration', array(array('STS_ID' => array('NOT IN', array(EEM_Registration::status_id_incomplete))))) > 0 ? true : false;
387
+				$TKT->set_date_format($this->_date_format_strings['date']);
388
+				$TKT->set_time_format($this->_date_format_strings['time']);
389 389
 
390 390
 				//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.
391 391
 				$orig_price = $TKT->price();
392
-				$create_new_TKT = $ticket_sold && $ticket_price != $orig_price && !$TKT->get('TKT_deleted') ? TRUE : FALSE;
392
+				$create_new_TKT = $ticket_sold && $ticket_price != $orig_price && ! $TKT->get('TKT_deleted') ? TRUE : FALSE;
393 393
 
394 394
 				//set new values
395
-				foreach ( $TKT_values as $field => $value ) {
396
-					$TKT->set( $field, $value );
395
+				foreach ($TKT_values as $field => $value) {
396
+					$TKT->set($field, $value);
397 397
 				}
398 398
 
399 399
 				//make sure price is set if it hasn't been already
400
-				$TKT->set( 'TKT_price', $ticket_price );
400
+				$TKT->set('TKT_price', $ticket_price);
401 401
 
402 402
 				//if $create_new_TKT is false then we can safely update the existing ticket.  Otherwise we have to create a new ticket.
403
-				if ( $create_new_TKT ) {
403
+				if ($create_new_TKT) {
404 404
 					//@TODO need to move this logic into its own method that just receives the ticket object (and other necessary info)
405 405
 					$new_tkt = clone($TKT);
406 406
 
@@ -410,26 +410,26 @@  discard block
 block discarded – undo
410 410
 					//TKT will get archived later b/c we are NOT adding it to the saved_tickets array.
411 411
 
412 412
 					//if existing $TKT has sold amount, then we need to adjust the qty for the new TKT to = the remaining available.
413
-					if ( $TKT->get('TKT_sold') > 0 ) {
413
+					if ($TKT->get('TKT_sold') > 0) {
414 414
 						$new_qty = $TKT->get('TKT_qty') - $TKT->get('TKT_sold');
415 415
 						$new_tkt->set_qty($new_qty);
416 416
 					}
417 417
 
418 418
 
419 419
 					//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.
420
-					$new_tkt->set( 'TKT_ID', 0 );
421
-					$new_tkt->set( 'TKT_deleted', 0 );
422
-					$new_tkt->set( 'TKT_price', $ticket_price );
423
-					$new_tkt->set( 'TKT_sold', 0 );
420
+					$new_tkt->set('TKT_ID', 0);
421
+					$new_tkt->set('TKT_deleted', 0);
422
+					$new_tkt->set('TKT_price', $ticket_price);
423
+					$new_tkt->set('TKT_sold', 0);
424 424
 
425 425
 					//now we update the prices just for this ticket
426
-					$new_tkt = $this->_add_prices_to_ticket( $price_rows, $new_tkt, TRUE );
426
+					$new_tkt = $this->_add_prices_to_ticket($price_rows, $new_tkt, TRUE);
427 427
 
428 428
 					//and we update the base price
429
-					$new_tkt =  $this->_add_prices_to_ticket( array(), $new_tkt, TRUE, $base_price, $base_price_id );
429
+					$new_tkt = $this->_add_prices_to_ticket(array(), $new_tkt, TRUE, $base_price, $base_price_id);
430 430
 
431
-					foreach ( $dtts_on_existing as $adddtt ) {
432
-						$new_tkt->_add_relation_to( $adddtt, 'Datetime' );
431
+					foreach ($dtts_on_existing as $adddtt) {
432
+						$new_tkt->_add_relation_to($adddtt, 'Datetime');
433 433
 					}
434 434
 
435 435
 				}
@@ -437,15 +437,15 @@  discard block
 block discarded – undo
437 437
 			} else {
438 438
 				//no TKT_id so a new TKT
439 439
 				$TKT_values['TKT_price'] = $ticket_price;
440
-				$TKT = EE_Registry::instance()->load_class('Ticket', array( $TKT_values, $timezone ), FALSE, FALSE );
440
+				$TKT = EE_Registry::instance()->load_class('Ticket', array($TKT_values, $timezone), FALSE, FALSE);
441 441
 
442 442
 				//reset values so that new formats are correctly considered when converting date and time strings
443
-				$TKT->set_date_format( $this->_date_format_strings['date'] );
444
-				$TKT->set_time_format( $this->_date_format_strings['time'] );
443
+				$TKT->set_date_format($this->_date_format_strings['date']);
444
+				$TKT->set_time_format($this->_date_format_strings['time']);
445 445
 
446 446
 				//reset values
447
-				foreach ( $TKT_values as $field => $value ) {
448
-					$TKT->set( $field, $value );
447
+				foreach ($TKT_values as $field => $value) {
448
+					$TKT->set($field, $value);
449 449
 				}
450 450
 
451 451
 				$update_prices = TRUE;
@@ -454,31 +454,31 @@  discard block
 block discarded – undo
454 454
 			$TKT->save(); //make sure any current values have been saved.
455 455
 
456 456
 			//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.
457
-			if( $TKT->get_raw('TKT_start_date') > $TKT->get_raw('TKT_end_date') ) {
458
-				$TKT->set('TKT_end_date', $TKT->get('TKT_start_date') );
457
+			if ($TKT->get_raw('TKT_start_date') > $TKT->get_raw('TKT_end_date')) {
458
+				$TKT->set('TKT_end_date', $TKT->get('TKT_start_date'));
459 459
 				EE_Registry::instance()->load_helper('DTT_Helper');
460 460
 				$TKT = EEH_DTT_Helper::date_time_add($TKT, 'TKT_end_date', 'days');
461 461
 			}
462 462
 
463 463
 			//let's make sure the base price is handled
464
-			$TKT = ! $create_new_TKT ? $this->_add_prices_to_ticket( array(), $TKT, $update_prices, $base_price, $base_price_id ) : $TKT;
464
+			$TKT = ! $create_new_TKT ? $this->_add_prices_to_ticket(array(), $TKT, $update_prices, $base_price, $base_price_id) : $TKT;
465 465
 
466 466
 			//add/update price_modifiers
467
-			$TKT = ! $create_new_TKT ? $this->_add_prices_to_ticket( $price_rows, $TKT, $update_prices ) : $TKT;
467
+			$TKT = ! $create_new_TKT ? $this->_add_prices_to_ticket($price_rows, $TKT, $update_prices) : $TKT;
468 468
 
469 469
 			//need to make sue that the TKT_price is accurate after saving the prices.
470 470
 			$TKT->ensure_TKT_Price_correct();
471 471
 
472 472
 
473 473
 			//handle CREATING a default tkt from the incoming tkt but ONLY if this isn't an autosave.
474
-			if ( ! defined('DOING_AUTOSAVE' ) ) {
475
-				if ( !empty($tkt['TKT_is_default_selector'] ) ) {
474
+			if ( ! defined('DOING_AUTOSAVE')) {
475
+				if ( ! empty($tkt['TKT_is_default_selector'])) {
476 476
 					$update_prices = TRUE;
477 477
 					$new_default = clone $TKT;
478
-					$new_default->set( 'TKT_ID', 0 );
479
-					$new_default->set( 'TKT_is_default', 1 );
480
-					$new_default->set( 'TKT_row', 1 );
481
-					$new_default->set( 'TKT_price', $ticket_price );
478
+					$new_default->set('TKT_ID', 0);
479
+					$new_default->set('TKT_is_default', 1);
480
+					$new_default->set('TKT_row', 1);
481
+					$new_default->set('TKT_price', $ticket_price);
482 482
 					//remove any dtt relations cause we DON'T want dtt relations attached (note this is just removing the cached relations in the object)
483 483
 					$new_default->_remove_relations('Datetime');
484 484
 					$new_default->save();
@@ -486,9 +486,9 @@  discard block
 block discarded – undo
486 486
 					$new_default = $this->_add_prices_to_ticket($price_rows, $new_default, $update_prices);
487 487
 
488 488
 					//don't forget the base price!
489
-					$new_default = $this->_add_prices_to_ticket( array(), $new_default, $update_prices, $base_price, $base_price_id );
489
+					$new_default = $this->_add_prices_to_ticket(array(), $new_default, $update_prices, $base_price, $base_price_id);
490 490
 
491
-					do_action( 'AHEE__espresso_events_Pricing_Hooks___update_tkts_new_default_ticket', $new_default, $row, $TKT, $data );
491
+					do_action('AHEE__espresso_events_Pricing_Hooks___update_tkts_new_default_ticket', $new_default, $row, $TKT, $data);
492 492
 				}
493 493
 			}
494 494
 
@@ -496,42 +496,42 @@  discard block
 block discarded – undo
496 496
 
497 497
 
498 498
 			//first let's do the add_relation_to()
499
-			$dtts_added = empty( $dtts_added ) || ( is_array( $dtts_added ) && ( isset( $dtts_added[0] ) && $dtts_added[0] == '' ) ) ? array() : $dtts_added;
499
+			$dtts_added = empty($dtts_added) || (is_array($dtts_added) && (isset($dtts_added[0]) && $dtts_added[0] == '')) ? array() : $dtts_added;
500 500
 
501
-			foreach ( $dtts_added as $dttrow ) {
501
+			foreach ($dtts_added as $dttrow) {
502 502
 				$dttrow = (int) $dttrow;
503 503
 				$TKT->_add_relation_to($saved_dtts[$dttrow], 'Datetime');
504 504
 
505 505
 				//now wait a minute.  Does this tkt have any sold?  Cause if it does then we need to add that to the DTT sold because this DTT is getting added.
506
-				if ( $TKT->get('TKT_sold') > 0 ) {
507
-					$saved_dtts[$dttrow]->increase_sold($TKT->get('TKT_sold') );
506
+				if ($TKT->get('TKT_sold') > 0) {
507
+					$saved_dtts[$dttrow]->increase_sold($TKT->get('TKT_sold'));
508 508
 					$saved_dtts[$dttrow]->save();
509 509
 				}
510 510
 
511 511
 				//if we have a new_tkt... let's add to it as well
512
-				if ( !empty( $new_tkt ) )
513
-					$new_tkt->_add_relation_to($saved_dtts[$dttrow], 'Datetime' );
512
+				if ( ! empty($new_tkt))
513
+					$new_tkt->_add_relation_to($saved_dtts[$dttrow], 'Datetime');
514 514
 			}
515 515
 
516 516
 
517
-			$dtts_removed = empty( $dtts_removed ) || ( is_array( $dtts_removed ) && isset( $dtts_removed[0] ) && $dtts_removed[0] == '' ) ? array() : $dtts_removed;
517
+			$dtts_removed = empty($dtts_removed) || (is_array($dtts_removed) && isset($dtts_removed[0]) && $dtts_removed[0] == '') ? array() : $dtts_removed;
518 518
 
519 519
 			//now let's do the remove_relation_to()
520
-			foreach ( $dtts_removed as $dttrow ) {
520
+			foreach ($dtts_removed as $dttrow) {
521 521
 				$dttrow = (int) $dttrow;
522 522
 				//its entirely possible that a datetime got deleted (instead of just removed from relationship.  So make sure we skip over this if the dtt isn't in the saved_dtts array)
523
-				if ( empty($saved_dtts[$dttrow] ) || ! $saved_dtts[$dttrow] instanceof EE_Datetime )
523
+				if (empty($saved_dtts[$dttrow]) || ! $saved_dtts[$dttrow] instanceof EE_Datetime)
524 524
 					continue;
525 525
 
526 526
 				$TKT->_remove_relation_to($saved_dtts[$dttrow], 'Datetime');
527 527
 
528 528
 				//now wait a minute.  Does this tkt have any sold? Cause if it does then we need to remove it's sold from the DTT_sold.
529
-				if ( $TKT->get('TKT_sold') > 0 ) {
530
-					$saved_dtts[$dttrow]->decrease_sold($TKT->get('TKT_sold') );
529
+				if ($TKT->get('TKT_sold') > 0) {
530
+					$saved_dtts[$dttrow]->decrease_sold($TKT->get('TKT_sold'));
531 531
 					$saved_dtts[$dttrow]->save();
532 532
 				}
533 533
 
534
-				if ( !empty( $new_tkt ) )
534
+				if ( ! empty($new_tkt))
535 535
 					$new_tkt->_remove_relation_to($saved_dtts[$dttrow], 'Datetime');
536 536
 			}
537 537
 
@@ -542,43 +542,43 @@  discard block
 block discarded – undo
542 542
 			//let's assign any tickets that have been setup to the saved_tickets tracker
543 543
 			//save existing TKT
544 544
 			$TKT->save();
545
-			if ( $create_new_TKT ) {
545
+			if ($create_new_TKT) {
546 546
 				//save new TKT
547 547
 				$new_tkt->save();
548 548
 				//add new ticket to array
549 549
 				$saved_tickets[$new_tkt->ID()] = $new_tkt;
550 550
 
551
-				do_action( 'AHEE__espresso_events_Pricing_Hooks___update_tkts_new_ticket', $new_tkt, $row, $tkt, $data );
551
+				do_action('AHEE__espresso_events_Pricing_Hooks___update_tkts_new_ticket', $new_tkt, $row, $tkt, $data);
552 552
 
553 553
 			} else {
554 554
 				//add tkt to saved tkts
555 555
 				//save existing TKT
556 556
 				$saved_tickets[$TKT->ID()] = $TKT;
557 557
 
558
-				do_action( 'AHEE__espresso_events_Pricing_Hooks___update_tkts_update_ticket', $TKT, $row, $tkt, $data );
558
+				do_action('AHEE__espresso_events_Pricing_Hooks___update_tkts_update_ticket', $TKT, $row, $tkt, $data);
559 559
 			}
560 560
 
561 561
 		}
562 562
 
563 563
 		//now we need to handle tickets actually "deleted permanently".  There are cases where we'd want this to happen (i.e. autosaves are happening and then in between autosaves the user trashes a ticket).  Or a draft event was saved and in the process of editing a ticket is trashed.  No sense in keeping all the related data in the db!
564
-		$old_tickets = isset( $old_tickets[0] ) && $old_tickets[0] == '' ? array() : $old_tickets;
565
-		$tickets_removed = array_diff( $old_tickets, array_keys($saved_tickets) );
564
+		$old_tickets = isset($old_tickets[0]) && $old_tickets[0] == '' ? array() : $old_tickets;
565
+		$tickets_removed = array_diff($old_tickets, array_keys($saved_tickets));
566 566
 		/*var_dump($old_tickets);
567 567
 		var_dump($saved_tickets);
568 568
 		var_dump($tickets_removed);*/
569 569
 
570
-		foreach ( $tickets_removed as $id ) {
571
-			$id = absint( $id );
570
+		foreach ($tickets_removed as $id) {
571
+			$id = absint($id);
572 572
 
573 573
 			//get the ticket for this id
574 574
 			$tkt_to_remove = EE_Registry::instance()->load_model('Ticket')->get_one_by_ID($id);
575 575
 
576 576
 			//if this tkt is a default tkt we leave it alone cause it won't be attached to the datetime
577
-			if ( $tkt_to_remove->get('TKT_is_default') )
577
+			if ($tkt_to_remove->get('TKT_is_default'))
578 578
 				continue;
579 579
 
580 580
 			//if this tkt has any registrations attached so then we just ARCHIVE because we don't actually permanently delete these tickets.
581
-			if ( $tkt_to_remove->count_related('Registration') > 0 ) {
581
+			if ($tkt_to_remove->count_related('Registration') > 0) {
582 582
 				$tkt_to_remove->delete();
583 583
 				continue;
584 584
 			}
@@ -586,14 +586,14 @@  discard block
 block discarded – undo
586 586
 			//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)
587 587
 			$dtts = $tkt_to_remove->get_many_related('Datetime');
588 588
 
589
-			foreach( $dtts as $dtt ) {
589
+			foreach ($dtts as $dtt) {
590 590
 				$tkt_to_remove->_remove_relation_to($dtt, 'Datetime');
591 591
 			}
592 592
 
593 593
 			//need to do the same for prices (except these prices can also be deleted because again, tickets can only be trashed if they don't have any TKTs sold (otherwise they are just archived))
594 594
 			$tkt_to_remove->delete_related_permanently('Price');
595 595
 
596
-			do_action( 'AHEE__espresso_events_Pricing_Hooks___update_tkts_delete_ticket', $tkt_to_remove );
596
+			do_action('AHEE__espresso_events_Pricing_Hooks___update_tkts_delete_ticket', $tkt_to_remove);
597 597
 
598 598
 			//finally let's delete this ticket (which should not be blocked at this point b/c we've removed all our relationships)
599 599
 			$tkt_to_remove->delete_permanently();
@@ -617,7 +617,7 @@  discard block
 block discarded – undo
617 617
 	 * @param int|bool 		$base_price_id  if present then this is the base_price_id being updated.
618 618
 	 * @return  void
619 619
 	 */
620
-	protected function  _add_prices_to_ticket( $prices = array(), EE_Ticket $ticket, $new_prices = FALSE, $base_price = FALSE, $base_price_id = FALSE ) {
620
+	protected function  _add_prices_to_ticket($prices = array(), EE_Ticket $ticket, $new_prices = FALSE, $base_price = FALSE, $base_price_id = FALSE) {
621 621
 
622 622
 		//let's just get any current prices that may exist on the given ticket so we can remove any prices that got trashed in this session.
623 623
 		$current_prices_on_ticket = $base_price !== FALSE ? $ticket->base_price(TRUE) : $ticket->price_modifiers();
@@ -625,7 +625,7 @@  discard block
 block discarded – undo
625 625
 		$updated_prices = array();
626 626
 
627 627
 		// if $base_price ! FALSE then updating a base price.
628
-		if ( $base_price !== FALSE ) {
628
+		if ($base_price !== FALSE) {
629 629
 			$prices[1] = array(
630 630
 				'PRC_ID' => $new_prices || $base_price_id === 1 ? NULL : $base_price_id,
631 631
 				'PRT_ID' => 1,
@@ -636,47 +636,47 @@  discard block
 block discarded – undo
636 636
 		}
637 637
 
638 638
 		//possibly need to save tkt
639
-		if ( ! $ticket->ID() )
639
+		if ( ! $ticket->ID())
640 640
 			$ticket->save();
641 641
 
642
-		foreach ( $prices as $row => $prc ) {
643
-			$prt_id = !empty( $prc['PRT_ID'] ) ? $prc['PRT_ID'] : NULL;
644
-			if ( empty($prt_id) )
642
+		foreach ($prices as $row => $prc) {
643
+			$prt_id = ! empty($prc['PRT_ID']) ? $prc['PRT_ID'] : NULL;
644
+			if (empty($prt_id))
645 645
 				continue; //prices MUST have a price type id.
646 646
 			$PRC_values = array(
647
-				'PRC_ID' => !empty( $prc['PRC_ID'] ) ? $prc['PRC_ID'] : NULL,
647
+				'PRC_ID' => ! empty($prc['PRC_ID']) ? $prc['PRC_ID'] : NULL,
648 648
 				'PRT_ID' => $prt_id,
649
-				'PRC_amount' => !empty( $prc['PRC_amount'] ) ? $prc['PRC_amount'] : 0,
650
-				'PRC_name' => !empty( $prc['PRC_name'] ) ? $prc['PRC_name'] : '',
651
-				'PRC_desc' => !empty( $prc['PRC_desc'] ) ? $prc['PRC_desc'] : '',
649
+				'PRC_amount' => ! empty($prc['PRC_amount']) ? $prc['PRC_amount'] : 0,
650
+				'PRC_name' => ! empty($prc['PRC_name']) ? $prc['PRC_name'] : '',
651
+				'PRC_desc' => ! empty($prc['PRC_desc']) ? $prc['PRC_desc'] : '',
652 652
 				'PRC_is_default' => false, //make sure we set PRC_is_default to false for all ticket saves from event_editor
653 653
 				'PRC_order' => $row
654 654
 				);
655
-			if ( $new_prices || empty( $PRC_values['PRC_ID'] ) ) {
655
+			if ($new_prices || empty($PRC_values['PRC_ID'])) {
656 656
 				$PRC_values['PRC_ID'] = 0;
657
-				$PRC = EE_Registry::instance()->load_class('Price', array( $PRC_values ), FALSE, FALSE);
657
+				$PRC = EE_Registry::instance()->load_class('Price', array($PRC_values), FALSE, FALSE);
658 658
 			} else {
659
-				$PRC = EE_Registry::instance()->load_model( 'Price' )->get_one_by_ID( $prc['PRC_ID'] );
659
+				$PRC = EE_Registry::instance()->load_model('Price')->get_one_by_ID($prc['PRC_ID']);
660 660
 				//update this price with new values
661
-				foreach ( $PRC_values as $field => $newprc ) {
662
-					$PRC->set( $field, $newprc );
661
+				foreach ($PRC_values as $field => $newprc) {
662
+					$PRC->set($field, $newprc);
663 663
 				}
664 664
 			}
665 665
 			$PRC->save();
666 666
 			$prcid = $PRC->ID();
667 667
 			$updated_prices[$prcid] = $PRC;
668
-			$ticket->_add_relation_to( $PRC, 'Price' );
668
+			$ticket->_add_relation_to($PRC, 'Price');
669 669
 		}
670 670
 
671 671
 		//now let's remove any prices that got removed from the ticket
672
-		if ( !empty ( $current_prices_on_ticket ) ) {
672
+		if ( ! empty ($current_prices_on_ticket)) {
673 673
 			$current = array_keys($current_prices_on_ticket);
674 674
 			$updated = array_keys($updated_prices);
675 675
 			$prices_to_remove = array_diff($current, $updated);
676
-			if ( !empty( $prices_to_remove ) ) {
677
-				foreach ( $prices_to_remove as $prc_id ) {
676
+			if ( ! empty($prices_to_remove)) {
677
+				foreach ($prices_to_remove as $prc_id) {
678 678
 					$p = $current_prices_on_ticket[$prc_id];
679
-					$ticket->_remove_relation_to( $p, 'Price' );
679
+					$ticket->_remove_relation_to($p, 'Price');
680 680
 
681 681
 					//delete permanently the price
682 682
 					$p->delete_permanently();
@@ -689,7 +689,7 @@  discard block
 block discarded – undo
689 689
 
690 690
 
691 691
 
692
-	public function autosave_handling( $event_admin_obj ) {
692
+	public function autosave_handling($event_admin_obj) {
693 693
 		return $event_admin_obj; //doing nothing for the moment.
694 694
 		//todo when I get to this remember that I need to set the template args on the $event_admin_obj (use the set_template_args() method)
695 695
 
@@ -723,12 +723,12 @@  discard block
 block discarded – undo
723 723
 
724 724
 		//default main template args
725 725
 		$main_template_args = array(
726
-			'event_datetime_help_link' => EEH_Template::get_help_tab_link('event_editor_event_datetimes_help_tab', $this->_adminpage_obj->page_slug, $this->_adminpage_obj->get_req_action(), FALSE, FALSE ), //todo need to add a filter to the template for the help text in the Events_Admin_Page core file so we can add further help
726
+			'event_datetime_help_link' => EEH_Template::get_help_tab_link('event_editor_event_datetimes_help_tab', $this->_adminpage_obj->page_slug, $this->_adminpage_obj->get_req_action(), FALSE, FALSE), //todo need to add a filter to the template for the help text in the Events_Admin_Page core file so we can add further help
727 727
 			'existing_datetime_ids' => '',
728 728
 			'total_dtt_rows' => 1,
729
-			'add_new_dtt_help_link' => EEH_Template::get_help_tab_link('add_new_dtt_info', $this->_adminpage_obj->page_slug, $this->_adminpage_obj->get_req_action(), FALSE, FALSE ), //todo need to add this help info id to the Events_Admin_Page core file so we can access it here.
729
+			'add_new_dtt_help_link' => EEH_Template::get_help_tab_link('add_new_dtt_info', $this->_adminpage_obj->page_slug, $this->_adminpage_obj->get_req_action(), FALSE, FALSE), //todo need to add this help info id to the Events_Admin_Page core file so we can access it here.
730 730
 			'datetime_rows' => '',
731
-			'show_tickets_container' => '',//$this->_adminpage_obj->get_cpt_model_obj()->ID() > 1 ? ' style="display:none;"' : '',
731
+			'show_tickets_container' => '', //$this->_adminpage_obj->get_cpt_model_obj()->ID() > 1 ? ' style="display:none;"' : '',
732 732
 			'ticket_rows' => '',
733 733
 			'existing_ticket_ids' => '',
734 734
 			'total_ticket_rows' => 1,
@@ -738,7 +738,7 @@  discard block
 block discarded – undo
738 738
 
739 739
 		$timezone = $evtobj instanceof EE_Event ? $evtobj->timezone_string() : NULL;
740 740
 
741
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
741
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
742 742
 
743 743
 		/**
744 744
 		 * 1. Start with retrieving Datetimes
@@ -746,25 +746,25 @@  discard block
 block discarded – undo
746 746
 		 * 3. For each ticket get related prices
747 747
 		 */
748 748
 
749
-		$DTM = EE_Registry::instance()->load_model('Datetime', array($timezone) );
750
-		$times = $DTM->get_all_event_dates( $evtID );
749
+		$DTM = EE_Registry::instance()->load_model('Datetime', array($timezone));
750
+		$times = $DTM->get_all_event_dates($evtID);
751 751
 
752 752
 
753 753
 
754 754
 		$main_template_args['total_dtt_rows'] = count($times);
755
-		foreach ( $times as $time ) {
755
+		foreach ($times as $time) {
756 756
 			$dttid = $time->get('DTT_ID');
757 757
 			$dttrow = $time->get('DTT_order');
758 758
 			$existing_datetime_ids[] = $dttid;
759 759
 
760 760
 			//tickets attached
761
-			$related_tickets = $time->ID() > 0 ? $time->get_many_related('Ticket', array( array( 'OR' => array( 'TKT_deleted' => 1, 'TKT_deleted*' => 0 ) ), 'default_where_conditions' => 'none', 'order_by' => array('TKT_order' => 'ASC' ) ) ) : array();
761
+			$related_tickets = $time->ID() > 0 ? $time->get_many_related('Ticket', array(array('OR' => array('TKT_deleted' => 1, 'TKT_deleted*' => 0)), 'default_where_conditions' => 'none', 'order_by' => array('TKT_order' => 'ASC'))) : array();
762 762
 
763 763
 			//if there are no related tickets this is likely a new event OR autodraft
764 764
 			// event so we need to generate the default tickets because dtts
765 765
 			// ALWAYS have at least one related ticket!!.  EXCEPT, we dont' do this if there is already more than one
766 766
 			// datetime on the event.
767
-			if ( empty ( $related_tickets ) && count( $times ) < 2 ) {
767
+			if (empty ($related_tickets) && count($times) < 2) {
768 768
 				$related_tickets = EE_Registry::instance()->load_model('Ticket')->get_all_default_tickets();
769 769
 			}
770 770
 
@@ -773,11 +773,11 @@  discard block
 block discarded – undo
773 773
 
774 774
 			//loop through and setup the ticket rows and make sure the order is set.
775 775
 			$order = 0;
776
-			foreach ( $related_tickets as $ticket ) {
776
+			foreach ($related_tickets as $ticket) {
777 777
 				$tktid = $ticket->get('TKT_ID');
778 778
 				$tktrow = $ticket->get('TKT_row');
779 779
 				//we only want unique tickets in our final display!!
780
-				if ( !in_array( $tktid, $existing_ticket_ids ) ) {
780
+				if ( ! in_array($tktid, $existing_ticket_ids)) {
781 781
 					$existing_ticket_ids[] = $tktid;
782 782
 					$all_tickets[] = $ticket;
783 783
 				}
@@ -786,56 +786,56 @@  discard block
 block discarded – undo
786 786
 				$datetime_tickets[$dttid][] = $tktrow;
787 787
 
788 788
 				//temporary cache of this datetime info for this ticket for later processing of ticket rows.
789
-				if ( !isset( $ticket_datetimes[$tktid] ) || ! in_array( $dttrow, $ticket_datetimes[$tktid] ) )
789
+				if ( ! isset($ticket_datetimes[$tktid]) || ! in_array($dttrow, $ticket_datetimes[$tktid]))
790 790
 					$ticket_datetimes[$tktid][] = $dttrow;
791 791
 			}
792 792
 		}
793 793
 
794
-		$main_template_args['total_ticket_rows'] = count( $existing_ticket_ids );
795
-		$main_template_args['existing_ticket_ids'] = implode( ',', $existing_ticket_ids );
796
-		$main_template_args['existing_datetime_ids'] = implode( ',', $existing_datetime_ids );
794
+		$main_template_args['total_ticket_rows'] = count($existing_ticket_ids);
795
+		$main_template_args['existing_ticket_ids'] = implode(',', $existing_ticket_ids);
796
+		$main_template_args['existing_datetime_ids'] = implode(',', $existing_datetime_ids);
797 797
 
798 798
 		//sort $all_tickets by order
799
-		usort( $all_tickets, function( $a, $b ) {
799
+		usort($all_tickets, function($a, $b) {
800 800
 			$a_order = (int) $a->get('TKT_order');
801 801
 			$b_order = (int) $b->get('TKT_order');
802
-			if ( $a_order == $b_order ) {
802
+			if ($a_order == $b_order) {
803 803
 				return 0;
804 804
 			}
805
-			return ( $a_order < $b_order ) ? -1 : 1;
805
+			return ($a_order < $b_order) ? -1 : 1;
806 806
 		});
807 807
 
808 808
 		//k NOW we have all the data we need for setting up the dtt rows and ticket rows so we start our dtt loop again.
809 809
 		$dttrow = 1;
810
-		foreach ( $times as $time ) {
811
-			$main_template_args['datetime_rows'] .= $this->_get_datetime_row( $dttrow, $time, $datetime_tickets, $all_tickets, FALSE, $times );
810
+		foreach ($times as $time) {
811
+			$main_template_args['datetime_rows'] .= $this->_get_datetime_row($dttrow, $time, $datetime_tickets, $all_tickets, FALSE, $times);
812 812
 			$dttrow++;
813 813
 		}
814 814
 
815 815
 		//then loop through all tickets for the ticket rows.
816 816
 		$tktrow = 1;
817
-		foreach ( $all_tickets as $ticket ) {
818
-			$main_template_args['ticket_rows'] .= $this->_get_ticket_row( $tktrow, $ticket, $ticket_datetimes, $times, FALSE, $all_tickets );
817
+		foreach ($all_tickets as $ticket) {
818
+			$main_template_args['ticket_rows'] .= $this->_get_ticket_row($tktrow, $ticket, $ticket_datetimes, $times, FALSE, $all_tickets);
819 819
 			$tktrow++;
820 820
 		}
821 821
 
822 822
 		$main_template_args['ticket_js_structure'] = $this->_get_ticket_js_structure($times, $all_tickets);
823
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_metabox_main.template.php';
824
-		EEH_Template::display_template( $template, $main_template_args );
823
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_metabox_main.template.php';
824
+		EEH_Template::display_template($template, $main_template_args);
825 825
 		return;
826 826
 	}
827 827
 
828 828
 
829 829
 
830
-	protected function _get_datetime_row( $dttrow, EE_Datetime $dtt, $datetime_tickets, $all_tickets, $default = FALSE, $all_dtts = array() ) {
830
+	protected function _get_datetime_row($dttrow, EE_Datetime $dtt, $datetime_tickets, $all_tickets, $default = FALSE, $all_dtts = array()) {
831 831
 
832 832
 		$dtt_display_template_args = array(
833
-			'dtt_edit_row' => $this->_get_dtt_edit_row( $dttrow, $dtt, $default, $all_dtts ),
834
-			'dtt_attached_tickets_row' => $this->_get_dtt_attached_tickets_row( $dttrow, $dtt, $datetime_tickets, $all_tickets, $default ),
833
+			'dtt_edit_row' => $this->_get_dtt_edit_row($dttrow, $dtt, $default, $all_dtts),
834
+			'dtt_attached_tickets_row' => $this->_get_dtt_attached_tickets_row($dttrow, $dtt, $datetime_tickets, $all_tickets, $default),
835 835
 			'dtt_row' => $default ? 'DTTNUM' : $dttrow
836 836
 			);
837
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_row_wrapper.template.php';
838
-		return EEH_Template::display_template( $template, $dtt_display_template_args, TRUE);
837
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_row_wrapper.template.php';
838
+		return EEH_Template::display_template($template, $dtt_display_template_args, TRUE);
839 839
 	}
840 840
 
841 841
 
@@ -853,7 +853,7 @@  discard block
 block discarded – undo
853 853
 	 *
854 854
 	 * @return string Generated edit row.
855 855
 	 */
856
-	protected function _get_dtt_edit_row( $dttrow, $dtt, $default, $all_dtts ) {
856
+	protected function _get_dtt_edit_row($dttrow, $dtt, $default, $all_dtts) {
857 857
 
858 858
 		// if the incomign $dtt object is NOT an instance of EE_Datetime then force default to true.
859 859
 		$default = ! $dtt instanceof EE_Datetime ? true : false;
@@ -861,30 +861,30 @@  discard block
 block discarded – undo
861 861
 		$template_args = array(
862 862
 			'dtt_row' => $default ? 'DTTNUM' : $dttrow,
863 863
 			'event_datetimes_name' => $default ? 'DTTNAMEATTR' : 'edit_event_datetimes',
864
-			'edit_dtt_expanded' => '',//$this->_adminpage_obj->get_cpt_model_obj()->ID() > 0 ? '' : ' ee-edit-editing',
864
+			'edit_dtt_expanded' => '', //$this->_adminpage_obj->get_cpt_model_obj()->ID() > 0 ? '' : ' ee-edit-editing',
865 865
 			'DTT_ID' => $default ? '' : $dtt->ID(),
866 866
 			'DTT_name' => $default ? '' : $dtt->name(),
867 867
 			'DTT_description' => $default ? '' : $dtt->description(),
868
-			'DTT_EVT_start' => $default ? '' : $dtt->start_date( $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] ),
869
-			'DTT_EVT_end' => $default ? '' : $dtt->end_date( $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] ),
870
-			'DTT_reg_limit' => $default ? '' : $dtt->get_pretty('DTT_reg_limit','input'),
868
+			'DTT_EVT_start' => $default ? '' : $dtt->start_date($this->_date_format_strings['date'].' '.$this->_date_format_strings['time']),
869
+			'DTT_EVT_end' => $default ? '' : $dtt->end_date($this->_date_format_strings['date'].' '.$this->_date_format_strings['time']),
870
+			'DTT_reg_limit' => $default ? '' : $dtt->get_pretty('DTT_reg_limit', 'input'),
871 871
 			'DTT_order' => $default ? 'DTTNUM' : $dttrow,
872 872
 			'dtt_sold' => $default ? '0' : $dtt->get('DTT_sold'),
873
-			'clone_icon' => !empty( $dtt ) && $dtt->get('DTT_sold') > 0 ? '' : 'clone-icon ee-icon ee-icon-clone clickable',
874
-			'trash_icon' => !empty( $dtt ) && $dtt->get('DTT_sold') > 0  ? 'ee-lock-icon' : 'trash-icon dashicons dashicons-post-trash clickable'
873
+			'clone_icon' => ! empty($dtt) && $dtt->get('DTT_sold') > 0 ? '' : 'clone-icon ee-icon ee-icon-clone clickable',
874
+			'trash_icon' => ! empty($dtt) && $dtt->get('DTT_sold') > 0 ? 'ee-lock-icon' : 'trash-icon dashicons dashicons-post-trash clickable'
875 875
 			);
876 876
 
877
-		$template_args['show_trash'] = count( $all_dtts ) === 1 && $template_args['trash_icon'] !== 'ee-lock-icon' ? ' style="display:none"' : '';
877
+		$template_args['show_trash'] = count($all_dtts) === 1 && $template_args['trash_icon'] !== 'ee-lock-icon' ? ' style="display:none"' : '';
878 878
 
879 879
 		//allow filtering of template args at this point.
880
-		$template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_dtt_edit_row__template_args', $template_args, $dttrow, $dtt, $default, $all_dtts, $this->_is_creating_event );
880
+		$template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_dtt_edit_row__template_args', $template_args, $dttrow, $dtt, $default, $all_dtts, $this->_is_creating_event);
881 881
 
882
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_edit_row.template.php';
883
-		return EEH_Template::display_template( $template, $template_args, TRUE );
882
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_edit_row.template.php';
883
+		return EEH_Template::display_template($template, $template_args, TRUE);
884 884
 	}
885 885
 
886 886
 
887
-	protected function _get_dtt_attached_tickets_row( $dttrow, $dtt, $datetime_tickets, $all_tickets, $default ) {
887
+	protected function _get_dtt_attached_tickets_row($dttrow, $dtt, $datetime_tickets, $all_tickets, $default) {
888 888
 
889 889
 		$template_args = array(
890 890
 			'dtt_row' => $default ? 'DTTNUM' : $dttrow,
@@ -892,47 +892,47 @@  discard block
 block discarded – undo
892 892
 			'DTT_description' => $default ? '' : $dtt->description(),
893 893
 			'datetime_tickets_list' => $default ? '<li class="hidden"></li>' : '',
894 894
 			'show_tickets_row' => ' style="display:none;"', //$default || $this->_adminpage_obj->get_cpt_model_obj()->ID() > 0 ? ' style="display:none;"' : '',
895
-			'add_new_datetime_ticket_help_link' => EEH_Template::get_help_tab_link('add_new_ticket_via_datetime', $this->_adminpage_obj->page_slug, $this->_adminpage_obj->get_req_action(), FALSE, FALSE ), //todo need to add this help info id to the Events_Admin_Page core file so we can access it here.
895
+			'add_new_datetime_ticket_help_link' => EEH_Template::get_help_tab_link('add_new_ticket_via_datetime', $this->_adminpage_obj->page_slug, $this->_adminpage_obj->get_req_action(), FALSE, FALSE), //todo need to add this help info id to the Events_Admin_Page core file so we can access it here.
896 896
 			'DTT_ID' => $default ? '' : $dtt->ID()
897 897
 			);
898 898
 
899 899
 		//need to setup the list items (but only if this isnt' a default skeleton setup)
900
-		if ( !$default ) {
900
+		if ( ! $default) {
901 901
 			$tktrow = 1;
902
-			foreach ( $all_tickets as $ticket ) {
903
-				$template_args['datetime_tickets_list'] .= $this->_get_datetime_tickets_list_item( $dttrow, $tktrow, $dtt, $ticket, $datetime_tickets, $default );
902
+			foreach ($all_tickets as $ticket) {
903
+				$template_args['datetime_tickets_list'] .= $this->_get_datetime_tickets_list_item($dttrow, $tktrow, $dtt, $ticket, $datetime_tickets, $default);
904 904
 				$tktrow++;
905 905
 			}
906 906
 		}
907 907
 
908 908
 		//filter template args at this point
909
-		$template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_dtt_attached_ticket_row__template_args', $template_args, $dttrow, $dtt, $datetime_tickets, $all_tickets, $default, $this->_is_creating_event );
909
+		$template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_dtt_attached_ticket_row__template_args', $template_args, $dttrow, $dtt, $datetime_tickets, $all_tickets, $default, $this->_is_creating_event);
910 910
 
911
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_attached_tickets_row.template.php';
912
-		return EEH_Template::display_template( $template, $template_args, TRUE );
911
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_attached_tickets_row.template.php';
912
+		return EEH_Template::display_template($template, $template_args, TRUE);
913 913
 	}
914 914
 
915 915
 
916 916
 
917
-	protected function _get_datetime_tickets_list_item( $dttrow, $tktrow, $dtt, $ticket, $datetime_tickets, $default ) {
918
-		$tktid = !empty( $ticket ) ? $ticket->ID() : 0;
919
-		$dtt_tkts = $dtt instanceof EE_Datetime && isset( $datetime_tickets[$dtt->ID()] ) ? $datetime_tickets[$dtt->ID()] : array();
917
+	protected function _get_datetime_tickets_list_item($dttrow, $tktrow, $dtt, $ticket, $datetime_tickets, $default) {
918
+		$tktid = ! empty($ticket) ? $ticket->ID() : 0;
919
+		$dtt_tkts = $dtt instanceof EE_Datetime && isset($datetime_tickets[$dtt->ID()]) ? $datetime_tickets[$dtt->ID()] : array();
920 920
 
921
-		$displayrow = !empty( $ticket ) ? $ticket->get('TKT_row') : 0;
921
+		$displayrow = ! empty($ticket) ? $ticket->get('TKT_row') : 0;
922 922
 		$template_args = array(
923 923
 			'dtt_row' => $default ? 'DTTNUM' : $dttrow,
924
-			'tkt_row' => $default && empty( $ticket ) ? 'TICKETNUM' : $tktrow,
924
+			'tkt_row' => $default && empty($ticket) ? 'TICKETNUM' : $tktrow,
925 925
 			'datetime_ticket_checked' => in_array($displayrow, $dtt_tkts) ? ' checked="checked"' : '',
926 926
 			'ticket_selected' => in_array($displayrow, $dtt_tkts) ? ' ticket-selected' : '',
927
-			'TKT_name' => $default && empty( $ticket ) ? 'TKTNAME' : $ticket->get('TKT_name'),
928
-			'tkt_status_class' => ( $default && empty( $ticket ) ) || $this->_is_creating_event ? ' tkt-status-' . EE_Ticket::onsale : ' tkt-status-' . $ticket->ticket_status(),
927
+			'TKT_name' => $default && empty($ticket) ? 'TKTNAME' : $ticket->get('TKT_name'),
928
+			'tkt_status_class' => ($default && empty($ticket)) || $this->_is_creating_event ? ' tkt-status-'.EE_Ticket::onsale : ' tkt-status-'.$ticket->ticket_status(),
929 929
 			);
930 930
 
931 931
 		//filter template args
932
-		$template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_datetime_tickets_list_item__template_args', $template_args, $dttrow, $tktrow, $dtt, $ticket, $datetime_tickets, $default, $this->_is_creating_event );
932
+		$template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_datetime_tickets_list_item__template_args', $template_args, $dttrow, $tktrow, $dtt, $ticket, $datetime_tickets, $default, $this->_is_creating_event);
933 933
 
934
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_dtt_tickets_list.template.php';
935
-		return EEH_Template::display_template( $template, $template_args, TRUE );
934
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_dtt_tickets_list.template.php';
935
+		return EEH_Template::display_template($template, $template_args, TRUE);
936 936
 	}
937 937
 
938 938
 
@@ -954,32 +954,32 @@  discard block
 block discarded – undo
954 954
 	 *
955 955
 	 * @return [type] [description]
956 956
 	 */
957
-	protected function _get_ticket_row( $tktrow, $ticket, $ticket_datetimes, $all_dtts, $default = FALSE, $all_tickets = array() ) {
957
+	protected function _get_ticket_row($tktrow, $ticket, $ticket_datetimes, $all_dtts, $default = FALSE, $all_tickets = array()) {
958 958
 
959 959
 		//if $ticket is not an instance of EE_Ticket then force default to true.
960
-		$default =  ! $ticket instanceof EE_Ticket ? true : false;
960
+		$default = ! $ticket instanceof EE_Ticket ? true : false;
961 961
 
962 962
 
963
-		$prices = !empty($ticket) && !$default ? $ticket->get_many_related('Price', array('default_where_conditions' => 'none', 'order_by' => array('PRC_order' => 'ASC') ) ) : array();
963
+		$prices = ! empty($ticket) && ! $default ? $ticket->get_many_related('Price', array('default_where_conditions' => 'none', 'order_by' => array('PRC_order' => 'ASC'))) : array();
964 964
 
965 965
 		// check if we're dealing with a default ticket in which case we don't want any starting_ticket_datetime_row values set (otherwise there won't be any new relationships created for tickets based off of the default ticket).  This will future proof in case there is ever any behaviour change between what the primary_key defaults to.
966
-		$default_dtt = $default || ($ticket instanceof EE_Ticket && $ticket->get('TKT_is_default') ) ? TRUE : FALSE;
966
+		$default_dtt = $default || ($ticket instanceof EE_Ticket && $ticket->get('TKT_is_default')) ? TRUE : FALSE;
967 967
 
968
-		$tkt_dtts = $ticket instanceof EE_Ticket && isset( $ticket_datetimes[$ticket->ID()] ) ? $ticket_datetimes[$ticket->ID()] : array();
968
+		$tkt_dtts = $ticket instanceof EE_Ticket && isset($ticket_datetimes[$ticket->ID()]) ? $ticket_datetimes[$ticket->ID()] : array();
969 969
 
970 970
 		$ticket_subtotal = $default ? 0 : $ticket->get_ticket_subtotal();
971
-		$base_price = $default ? NULL :  $ticket->base_price();
971
+		$base_price = $default ? NULL : $ticket->base_price();
972 972
 		$count_price_mods = EEM_Price::instance()->get_all_default_prices(TRUE);
973 973
 
974 974
 		//breaking out complicated condition for ticket_status
975
-		if ( $default ) {
976
-			$ticket_status_class = ' tkt-status-' . EE_Ticket::onsale;
975
+		if ($default) {
976
+			$ticket_status_class = ' tkt-status-'.EE_Ticket::onsale;
977 977
 		} else {
978
-			$ticket_status_class =  $ticket->is_default() ? ' tkt-status-' . EE_Ticket::onsale : ' tkt-status-' . $ticket->ticket_status();
978
+			$ticket_status_class = $ticket->is_default() ? ' tkt-status-'.EE_Ticket::onsale : ' tkt-status-'.$ticket->ticket_status();
979 979
 		}
980 980
 
981 981
 		//breaking out complicated condition for TKT_taxable
982
-		if ( $default ) {
982
+		if ($default) {
983 983
 			$TKT_taxable = '';
984 984
 		} else {
985 985
 			$TKT_taxable = $ticket->get('TKT_taxable') ? ' checked="checked"' : '';
@@ -994,19 +994,19 @@  discard block
 block discarded – undo
994 994
 			'edit_tkt_expanded' => '',
995 995
 			'edit_tickets_name' => $default ? 'TICKETNAMEATTR' : 'edit_tickets',
996 996
 			'TKT_name' => $default ? '' : $ticket->get('TKT_name'),
997
-			'TKT_start_date' => $default ? '' : $ticket->get_date('TKT_start_date', $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] ),
998
-			'TKT_end_date' => $default ? '' : $ticket->get_date('TKT_end_date', $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time']  ),
999
-			'TKT_status' => $default ? EEH_Template::pretty_status(EE_Ticket::onsale, FALSE, 'sentence') : $ticket->is_default() ? EEH_Template::pretty_status( EE_Ticket::onsale, FALSE, 'sentence') : $ticket->ticket_status(TRUE),
997
+			'TKT_start_date' => $default ? '' : $ticket->get_date('TKT_start_date', $this->_date_format_strings['date'].' '.$this->_date_format_strings['time']),
998
+			'TKT_end_date' => $default ? '' : $ticket->get_date('TKT_end_date', $this->_date_format_strings['date'].' '.$this->_date_format_strings['time']),
999
+			'TKT_status' => $default ? EEH_Template::pretty_status(EE_Ticket::onsale, FALSE, 'sentence') : $ticket->is_default() ? EEH_Template::pretty_status(EE_Ticket::onsale, FALSE, 'sentence') : $ticket->ticket_status(TRUE),
1000 1000
 			'TKT_price' => $default ? '' : EEH_Template::format_currency($ticket->get_ticket_total_with_taxes(), FALSE, FALSE),
1001 1001
 			'TKT_price_code' => EE_Registry::instance()->CFG->currency->code,
1002 1002
 			'TKT_price_amount' => $default ? 0 : $ticket_subtotal,
1003
-			'TKT_qty' => $default ? '' : $ticket->get_pretty('TKT_qty','symbol'),
1004
-			'TKT_qty_for_input'=> $default ? '' : $ticket->get_pretty('TKT_qty','input'),
1005
-			'TKT_uses' => $default ? '' : $ticket->get_pretty('TKT_uses','input'),
1006
-			'TKT_min' => $default ? '' : ( $ticket->get('TKT_min') === -1 || $ticket->get('TKT_min') === 0 ? '' : $ticket->get('TKT_min') ),
1007
-			'TKT_max' => $default ? '' :  $ticket->get_pretty('TKT_max','input'),
1003
+			'TKT_qty' => $default ? '' : $ticket->get_pretty('TKT_qty', 'symbol'),
1004
+			'TKT_qty_for_input'=> $default ? '' : $ticket->get_pretty('TKT_qty', 'input'),
1005
+			'TKT_uses' => $default ? '' : $ticket->get_pretty('TKT_uses', 'input'),
1006
+			'TKT_min' => $default ? '' : ($ticket->get('TKT_min') === -1 || $ticket->get('TKT_min') === 0 ? '' : $ticket->get('TKT_min')),
1007
+			'TKT_max' => $default ? '' : $ticket->get_pretty('TKT_max', 'input'),
1008 1008
 			'TKT_sold' => $default ? 0 : $ticket->tickets_sold('ticket'),
1009
-			'TKT_registrations' => $default ? 0 : $ticket->count_registrations( array( array( 'STS_ID' => array( '!=', EEM_Registration::status_id_incomplete ) ) ) ),
1009
+			'TKT_registrations' => $default ? 0 : $ticket->count_registrations(array(array('STS_ID' => array('!=', EEM_Registration::status_id_incomplete)))),
1010 1010
 			'TKT_ID' => $default ? 0 : $ticket->get('TKT_ID'),
1011 1011
 			'TKT_description' => $default ? '' : $ticket->get('TKT_description'),
1012 1012
 			'TKT_is_default' => $default ? 0 : $ticket->get('TKT_is_default'),
@@ -1015,99 +1015,99 @@  discard block
 block discarded – undo
1015 1015
 			'ticket_price_rows' => '',
1016 1016
 			'TKT_base_price' => $default || ! $base_price instanceof EE_Price ? '' : $base_price->get_pretty('PRC_amount', 'localized_float'),
1017 1017
 			'TKT_base_price_ID' => $default || ! $base_price instanceof EE_Price ? 0 : $base_price->ID(),
1018
-			'show_price_modifier' => count($prices) > 1 || ( $default && $count_price_mods > 0 ) ? '' : ' style="display:none;"',
1019
-			'show_price_mod_button' => count($prices) > 1 || ( $default && $count_price_mods > 0 ) || ( !$default && $ticket->get('TKT_deleted') ) ? ' style="display:none;"' : '',
1018
+			'show_price_modifier' => count($prices) > 1 || ($default && $count_price_mods > 0) ? '' : ' style="display:none;"',
1019
+			'show_price_mod_button' => count($prices) > 1 || ($default && $count_price_mods > 0) || ( ! $default && $ticket->get('TKT_deleted')) ? ' style="display:none;"' : '',
1020 1020
 			'total_price_rows' => count($prices) > 1 ? count($prices) : 1,
1021 1021
 			'ticket_datetimes_list' => $default ? '<li class="hidden"></li>' : '',
1022 1022
 			'starting_ticket_datetime_rows' => $default || $default_dtt ? '' : implode(',', $tkt_dtts),
1023 1023
 			'ticket_datetime_rows' => $default ? '' : implode(',', $tkt_dtts),
1024
-			'existing_ticket_price_ids' => $default, '', implode(',', array_keys( $prices) ),
1024
+			'existing_ticket_price_ids' => $default, '', implode(',', array_keys($prices)),
1025 1025
 			'ticket_template_id' => $default ? 0 : $ticket->get('TTM_ID'),
1026 1026
 			'TKT_taxable' => $TKT_taxable,
1027 1027
 			'display_subtotal' => $ticket instanceof EE_Ticket && $ticket->get('TKT_taxable') ? '' : ' style="display:none"',
1028 1028
 			'price_currency_symbol' => EE_Registry::instance()->CFG->currency->sign,
1029
-			'TKT_subtotal_amount_display' => EEH_Template::format_currency($ticket_subtotal, FALSE, FALSE ),
1029
+			'TKT_subtotal_amount_display' => EEH_Template::format_currency($ticket_subtotal, FALSE, FALSE),
1030 1030
 			'TKT_subtotal_amount' => $ticket_subtotal,
1031
-			'tax_rows' => $this->_get_tax_rows( $tktrow, $ticket ),
1032
-			'disabled' => $ticket instanceof EE_Ticket && $ticket->get('TKT_deleted') ? TRUE: FALSE,
1031
+			'tax_rows' => $this->_get_tax_rows($tktrow, $ticket),
1032
+			'disabled' => $ticket instanceof EE_Ticket && $ticket->get('TKT_deleted') ? TRUE : FALSE,
1033 1033
 			'ticket_archive_class' => $ticket instanceof EE_Ticket && $ticket->get('TKT_deleted') ? ' ticket-archived' : '',
1034 1034
 			'trash_icon' => $ticket instanceof EE_Ticket && $ticket->get('TKT_deleted') ? 'ee-lock-icon ' : 'trash-icon dashicons dashicons-post-trash clickable',
1035 1035
 			'clone_icon' => $ticket instanceof EE_Ticket && $ticket->get('TKT_deleted') ? '' : 'clone-icon ee-icon ee-icon-clone clickable'
1036 1036
 			);
1037 1037
 
1038
-		$template_args['trash_hidden'] = count( $all_tickets ) === 1 && $template_args['trash_icon'] != 'ee-lock-icon' ? ' style="display:none"' : '';
1038
+		$template_args['trash_hidden'] = count($all_tickets) === 1 && $template_args['trash_icon'] != 'ee-lock-icon' ? ' style="display:none"' : '';
1039 1039
 
1040 1040
 		//handle rows that should NOT be empty
1041
-		if ( empty( $template_args['TKT_start_date'] ) ) {
1041
+		if (empty($template_args['TKT_start_date'])) {
1042 1042
 			//if empty then the start date will be now.
1043
-			$template_args['TKT_start_date'] = date( $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] , current_time('timestamp'));
1044
-			$template_args['tkt_status_class'] = ' tkt-status-' . EE_Ticket::onsale;
1043
+			$template_args['TKT_start_date'] = date($this->_date_format_strings['date'].' '.$this->_date_format_strings['time'], current_time('timestamp'));
1044
+			$template_args['tkt_status_class'] = ' tkt-status-'.EE_Ticket::onsale;
1045 1045
 		}
1046 1046
 
1047
-		if ( empty( $template_args['TKT_end_date'] ) ) {
1047
+		if (empty($template_args['TKT_end_date'])) {
1048 1048
 
1049 1049
 			//get the earliest datetime (if present);
1050
-			$earliest_dtt = $this->_adminpage_obj->get_cpt_model_obj()->ID() > 0 ? $this->_adminpage_obj->get_cpt_model_obj()->get_first_related('Datetime', array('order_by'=> array('DTT_EVT_start' => 'ASC' ) ) ) : NULL;
1050
+			$earliest_dtt = $this->_adminpage_obj->get_cpt_model_obj()->ID() > 0 ? $this->_adminpage_obj->get_cpt_model_obj()->get_first_related('Datetime', array('order_by'=> array('DTT_EVT_start' => 'ASC'))) : NULL;
1051 1051
 
1052
-			if ( !empty( $earliest_dtt ) ) {
1053
-				$template_args['TKT_end_date'] = $earliest_dtt->get_datetime('DTT_EVT_start', $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] );
1052
+			if ( ! empty($earliest_dtt)) {
1053
+				$template_args['TKT_end_date'] = $earliest_dtt->get_datetime('DTT_EVT_start', $this->_date_format_strings['date'].' '.$this->_date_format_strings['time']);
1054 1054
 			} else {
1055 1055
 				//default so let's just use what's been set for the default date-time which is 30 days from now.
1056
-				$template_args['TKT_end_date'] = date( $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] , mktime(24, 0, 0, date("m"), date("d") + 29, date("Y") )  );
1056
+				$template_args['TKT_end_date'] = date($this->_date_format_strings['date'].' '.$this->_date_format_strings['time'], mktime(24, 0, 0, date("m"), date("d") + 29, date("Y")));
1057 1057
 			}
1058
-			$template_args['tkt_status_class'] = ' tkt-status-' . EE_Ticket::onsale;
1058
+			$template_args['tkt_status_class'] = ' tkt-status-'.EE_Ticket::onsale;
1059 1059
 		}
1060 1060
 
1061 1061
 		//generate ticket_datetime items
1062
-		if ( ! $default ) {
1062
+		if ( ! $default) {
1063 1063
 			$dttrow = 1;
1064
-			foreach ( $all_dtts as $dtt ) {
1065
-				$template_args['ticket_datetimes_list'] .= $this->_get_ticket_datetime_list_item( $dttrow, $tktrow, $dtt, $ticket, $ticket_datetimes, $default );
1064
+			foreach ($all_dtts as $dtt) {
1065
+				$template_args['ticket_datetimes_list'] .= $this->_get_ticket_datetime_list_item($dttrow, $tktrow, $dtt, $ticket, $ticket_datetimes, $default);
1066 1066
 				$dttrow++;
1067 1067
 			}
1068 1068
 		}
1069 1069
 
1070 1070
 		$prcrow = 1;
1071
-		foreach ( $prices as $price ) {
1072
-			if ( $price->is_base_price() ) {
1071
+		foreach ($prices as $price) {
1072
+			if ($price->is_base_price()) {
1073 1073
 				$prcrow++;
1074 1074
 				continue;
1075 1075
 			}
1076
-			$show_trash = ( count( $prices ) > 1 && $prcrow === 1 ) || count( $prices ) === 1  ? FALSE : TRUE;
1077
-			$show_create = count( $prices ) > 1 && count( $prices ) !== $prcrow ? FALSE : TRUE;
1078
-			$template_args['ticket_price_rows'] .= $this->_get_ticket_price_row( $tktrow, $prcrow, $price, $default, $ticket, $show_trash, $show_create );
1076
+			$show_trash = (count($prices) > 1 && $prcrow === 1) || count($prices) === 1 ? FALSE : TRUE;
1077
+			$show_create = count($prices) > 1 && count($prices) !== $prcrow ? FALSE : TRUE;
1078
+			$template_args['ticket_price_rows'] .= $this->_get_ticket_price_row($tktrow, $prcrow, $price, $default, $ticket, $show_trash, $show_create);
1079 1079
 			$prcrow++;
1080 1080
 		}
1081 1081
 
1082 1082
 		//filter $template_args
1083
-		$template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_ticket_row__template_args', $template_args, $tktrow, $ticket, $ticket_datetimes, $all_dtts, $default, $all_tickets, $this->_is_creating_event );
1083
+		$template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_ticket_row__template_args', $template_args, $tktrow, $ticket, $ticket_datetimes, $all_dtts, $default, $all_tickets, $this->_is_creating_event);
1084 1084
 
1085
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_ticket_row.template.php';
1086
-		return EEH_Template::display_template( $template, $template_args, TRUE );
1085
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_ticket_row.template.php';
1086
+		return EEH_Template::display_template($template, $template_args, TRUE);
1087 1087
 	}
1088 1088
 
1089 1089
 
1090 1090
 
1091 1091
 
1092 1092
 
1093
-	protected function _get_tax_rows( $tktrow, $ticket ) {
1093
+	protected function _get_tax_rows($tktrow, $ticket) {
1094 1094
 		$tax_rows = '';
1095
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_ticket_tax_row.template.php';
1095
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_ticket_tax_row.template.php';
1096 1096
 		$template_args = array();
1097
-		$taxes = empty( $ticket ) ? EE_Taxes::get_taxes_for_admin() : $ticket->get_ticket_taxes_for_admin();
1098
-		foreach ( $taxes as $tax ) {
1099
-			$tax_added = $this->_get_tax_added( $tax, $ticket );
1097
+		$taxes = empty($ticket) ? EE_Taxes::get_taxes_for_admin() : $ticket->get_ticket_taxes_for_admin();
1098
+		foreach ($taxes as $tax) {
1099
+			$tax_added = $this->_get_tax_added($tax, $ticket);
1100 1100
 			$template_args = array(
1101
-				'display_tax' => !empty( $ticket ) && $ticket->get('TKT_taxable') ? '' : ' style="display:none;"',
1101
+				'display_tax' => ! empty($ticket) && $ticket->get('TKT_taxable') ? '' : ' style="display:none;"',
1102 1102
 				'tax_id' => $tax->ID(),
1103 1103
 				'tkt_row' => $tktrow,
1104 1104
 				'tax_label' => $tax->get('PRC_name'),
1105 1105
 				'tax_added' => $tax_added,
1106
-				'tax_added_display' => EEH_Template::format_currency($tax_added, FALSE, FALSE ),
1106
+				'tax_added_display' => EEH_Template::format_currency($tax_added, FALSE, FALSE),
1107 1107
 				'tax_amount' => $tax->get('PRC_amount')
1108 1108
 				);
1109
-			$template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_tax_rows__template_args', $template_args, $tktrow, $ticket, $this->_is_creating_event  );
1110
-			$tax_rows .= EEH_Template::display_template( $template, $template_args, TRUE );
1109
+			$template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_tax_rows__template_args', $template_args, $tktrow, $ticket, $this->_is_creating_event);
1110
+			$tax_rows .= EEH_Template::display_template($template, $template_args, TRUE);
1111 1111
 		}
1112 1112
 
1113 1113
 
@@ -1115,81 +1115,81 @@  discard block
 block discarded – undo
1115 1115
 	}
1116 1116
 
1117 1117
 
1118
-	protected function _get_tax_added( EE_Price $tax, $ticket ) {
1119
-		$subtotal = empty( $ticket ) ? 0 : $ticket->get_ticket_subtotal();
1118
+	protected function _get_tax_added(EE_Price $tax, $ticket) {
1119
+		$subtotal = empty($ticket) ? 0 : $ticket->get_ticket_subtotal();
1120 1120
 		return $subtotal * $tax->get('PRC_amount') / 100;
1121 1121
 	}
1122 1122
 
1123 1123
 
1124 1124
 
1125 1125
 
1126
-	protected function _get_ticket_price_row( $tktrow, $prcrow, $price, $default, $ticket, $show_trash = TRUE, $show_create = TRUE ) {
1127
-		$send_disabled = !empty( $ticket ) && $ticket->get('TKT_deleted') ? TRUE : FALSE;
1126
+	protected function _get_ticket_price_row($tktrow, $prcrow, $price, $default, $ticket, $show_trash = TRUE, $show_create = TRUE) {
1127
+		$send_disabled = ! empty($ticket) && $ticket->get('TKT_deleted') ? TRUE : FALSE;
1128 1128
 		$template_args = array(
1129 1129
 			'tkt_row' => $default && empty($ticket) ? 'TICKETNUM' : $tktrow,
1130 1130
 			'PRC_order' => $default && empty($price) ? 'PRICENUM' : $prcrow,
1131 1131
 			'edit_prices_name' => $default && empty($price) ? 'PRICENAMEATTR' : 'edit_prices',
1132
-			'price_type_selector' => $default && empty( $price ) ? $this->_get_base_price_template( $tktrow, $prcrow, $price, $default ) : $this->_get_price_type_selector( $tktrow, $prcrow, $price, $default, $send_disabled ),
1132
+			'price_type_selector' => $default && empty($price) ? $this->_get_base_price_template($tktrow, $prcrow, $price, $default) : $this->_get_price_type_selector($tktrow, $prcrow, $price, $default, $send_disabled),
1133 1133
 			'PRC_ID' => $default && empty($price) ? 0 : $price->ID(),
1134 1134
 			'PRC_is_default' => $default && empty($price) ? 0 : $price->get('PRC_is_default'),
1135 1135
 			'PRC_name' => $default && empty($price) ? '' : $price->get('PRC_name'),
1136 1136
 			'price_currency_symbol' => EE_Registry::instance()->CFG->currency->sign,
1137 1137
 			'show_plus_or_minus' => $default && empty($price) ? '' : ' style="display:none;"',
1138
-			'show_plus' => $default && empty( $price ) ? ' style="display:none;"' : ( $price->is_discount() || $price->is_base_price() ? ' style="display:none;"' : ''),
1139
-			'show_minus' => $default && empty( $price ) ? ' style="display:none;"' : ($price->is_discount() ? '' : ' style="display:none;"'),
1140
-			'show_currency_symbol' => $default && empty( $price ) ? ' style="display:none"' : ($price->is_percent() ? ' style="display:none"' : '' ),
1141
-			'PRC_amount' => $default && empty( $price ) ? 0 : $price->get_pretty('PRC_amount', 'localized_float'),
1142
-			'show_percentage' => $default && empty( $price ) ? ' style="display:none;"' : ( $price->is_percent() ? '' : ' style="display:none;"' ),
1138
+			'show_plus' => $default && empty($price) ? ' style="display:none;"' : ($price->is_discount() || $price->is_base_price() ? ' style="display:none;"' : ''),
1139
+			'show_minus' => $default && empty($price) ? ' style="display:none;"' : ($price->is_discount() ? '' : ' style="display:none;"'),
1140
+			'show_currency_symbol' => $default && empty($price) ? ' style="display:none"' : ($price->is_percent() ? ' style="display:none"' : ''),
1141
+			'PRC_amount' => $default && empty($price) ? 0 : $price->get_pretty('PRC_amount', 'localized_float'),
1142
+			'show_percentage' => $default && empty($price) ? ' style="display:none;"' : ($price->is_percent() ? '' : ' style="display:none;"'),
1143 1143
 			'show_trash_icon' => $show_trash ? '' : ' style="display:none;"',
1144 1144
 			'show_create_button' => $show_create ? '' : ' style="display:none;"',
1145
-			'PRC_desc' => $default && empty( $price ) ? '' : $price->get('PRC_desc'),
1146
-			'disabled' => !empty( $ticket ) && $ticket->get('TKT_deleted') ? TRUE : FALSE
1145
+			'PRC_desc' => $default && empty($price) ? '' : $price->get('PRC_desc'),
1146
+			'disabled' => ! empty($ticket) && $ticket->get('TKT_deleted') ? TRUE : FALSE
1147 1147
 			);
1148 1148
 
1149
-	$template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_ticket_price_row__template_args', $template_args, $tktrow, $prcrow, $price, $default, $ticket, $show_trash, $show_create, $this->_is_creating_event );
1149
+	$template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_ticket_price_row__template_args', $template_args, $tktrow, $prcrow, $price, $default, $ticket, $show_trash, $show_create, $this->_is_creating_event);
1150 1150
 
1151
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_ticket_price_row.template.php';
1152
-		return EEH_Template::display_template( $template, $template_args, TRUE );
1151
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_ticket_price_row.template.php';
1152
+		return EEH_Template::display_template($template, $template_args, TRUE);
1153 1153
 	}
1154 1154
 
1155 1155
 
1156
-	protected function _get_price_type_selector( $tktrow, $prcrow, $price, $default, $disabled = FALSE ) {
1157
-		if ( $price->is_base_price() ) {
1158
-			return $this->_get_base_price_template( $tktrow, $prcrow, $price, $default );
1156
+	protected function _get_price_type_selector($tktrow, $prcrow, $price, $default, $disabled = FALSE) {
1157
+		if ($price->is_base_price()) {
1158
+			return $this->_get_base_price_template($tktrow, $prcrow, $price, $default);
1159 1159
 		} else {
1160
-			return $this->_get_price_modifier_template( $tktrow, $prcrow, $price, $default, $disabled );
1160
+			return $this->_get_price_modifier_template($tktrow, $prcrow, $price, $default, $disabled);
1161 1161
 		}
1162 1162
 
1163 1163
 	}
1164 1164
 
1165 1165
 
1166
-	protected function _get_base_price_template( $tktrow, $prcrow, $price, $default ) {
1166
+	protected function _get_base_price_template($tktrow, $prcrow, $price, $default) {
1167 1167
 		$template_args = array(
1168 1168
 				'tkt_row' => $default ? 'TICKETNUM' : $tktrow,
1169
-				'PRC_order' => $default && empty( $price ) ? 'PRICENUM' : $prcrow,
1170
-				'PRT_ID' => $default && empty( $price ) ? 1 : $price->get('PRT_ID'),
1169
+				'PRC_order' => $default && empty($price) ? 'PRICENUM' : $prcrow,
1170
+				'PRT_ID' => $default && empty($price) ? 1 : $price->get('PRT_ID'),
1171 1171
 				'PRT_name' => __('Price', 'event_espresso'),
1172 1172
 				'price_selected_operator' => '+',
1173 1173
 				'price_selected_is_percent' => 0
1174 1174
 			);
1175
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_price_type_base.template.php';
1175
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_price_type_base.template.php';
1176 1176
 
1177
-		$template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_base_price_template__template_args', $template_args, $tktrow, $prcrow, $price, $default, $this->_is_creating_event );
1177
+		$template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_base_price_template__template_args', $template_args, $tktrow, $prcrow, $price, $default, $this->_is_creating_event);
1178 1178
 
1179
-		return EEH_Template::display_template( $template, $template_args, TRUE );
1179
+		return EEH_Template::display_template($template, $template_args, TRUE);
1180 1180
 	}
1181 1181
 
1182 1182
 
1183 1183
 
1184
-	protected function _get_price_modifier_template( $tktrow, $prcrow, $price, $default, $disabled = FALSE ) {
1185
-		$select_name = $default && empty( $price ) ? 'edit_prices[TICKETNUM][PRICENUM][PRT_ID]' : 'edit_prices[' . $tktrow . '][' . $prcrow . '][PRT_ID]';
1186
-		$price_types = EE_Registry::instance()->load_model('Price_Type')->get_all(array( array('OR' => array('PBT_ID' => '2', 'PBT_ID*' => '3' ) ) ) );
1187
-		$price_option_span_template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_price_option_span.template.php';
1188
-		$all_price_types = $default && empty( $price ) ? array(array('id' => 0, 'text' => __('Select Modifier', 'event_espresso')) ) : array();
1189
-		$selected_price_type_id = $default && empty( $price ) ? 0 : $price->type();
1184
+	protected function _get_price_modifier_template($tktrow, $prcrow, $price, $default, $disabled = FALSE) {
1185
+		$select_name = $default && empty($price) ? 'edit_prices[TICKETNUM][PRICENUM][PRT_ID]' : 'edit_prices['.$tktrow.']['.$prcrow.'][PRT_ID]';
1186
+		$price_types = EE_Registry::instance()->load_model('Price_Type')->get_all(array(array('OR' => array('PBT_ID' => '2', 'PBT_ID*' => '3'))));
1187
+		$price_option_span_template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_price_option_span.template.php';
1188
+		$all_price_types = $default && empty($price) ? array(array('id' => 0, 'text' => __('Select Modifier', 'event_espresso'))) : array();
1189
+		$selected_price_type_id = $default && empty($price) ? 0 : $price->type();
1190 1190
 		$price_option_spans = '';
1191 1191
 		//setup pricetypes for selector
1192
-		foreach ( $price_types as $price_type ) {
1192
+		foreach ($price_types as $price_type) {
1193 1193
 			$all_price_types[] = array(
1194 1194
 				'id' => $price_type->ID(),
1195 1195
 				'text' => $price_type->get('PRT_name'),
@@ -1201,50 +1201,50 @@  discard block
 block discarded – undo
1201 1201
 				'PRT_operator' => $price_type->is_discount() ? '-' : '+',
1202 1202
 				'PRT_is_percent' => $price_type->get('PRT_is_percent') ? 1 : 0
1203 1203
 				);
1204
-			$price_option_spans .= EEH_Template::display_template($price_option_span_template, $spanargs, TRUE );
1204
+			$price_option_spans .= EEH_Template::display_template($price_option_span_template, $spanargs, TRUE);
1205 1205
 		}
1206 1206
 
1207
-		$select_params = $disabled ? 'style="width:auto;" disabled'  : 'style="width:auto;"';
1207
+		$select_params = $disabled ? 'style="width:auto;" disabled' : 'style="width:auto;"';
1208 1208
 		$main_name = $select_name;
1209
-		$select_name = $disabled ? 'archive_price[' . $tktrow . '][' . $prcrow . '][PRT_ID]' : $main_name;
1209
+		$select_name = $disabled ? 'archive_price['.$tktrow.']['.$prcrow.'][PRT_ID]' : $main_name;
1210 1210
 
1211 1211
 		$template_args = array(
1212 1212
 			'tkt_row' => $default ? 'TICKETNUM' : $tktrow,
1213
-			'PRC_order' => $default && empty( $price ) ? 'PRICENUM' : $prcrow,
1214
-			'price_modifier_selector' => EEH_Form_Fields::select_input( $select_name, $all_price_types, $selected_price_type_id, $select_params, 'edit-price-PRT_ID' ),
1213
+			'PRC_order' => $default && empty($price) ? 'PRICENUM' : $prcrow,
1214
+			'price_modifier_selector' => EEH_Form_Fields::select_input($select_name, $all_price_types, $selected_price_type_id, $select_params, 'edit-price-PRT_ID'),
1215 1215
 			'main_name' => $main_name,
1216 1216
 			'selected_price_type_id' => $selected_price_type_id,
1217 1217
 			'price_option_spans' => $price_option_spans,
1218
-			'price_selected_operator' => $default && empty( $price ) ? '' : ( $price->is_discount() ? '-' : '+' ),
1219
-			'price_selected_is_percent' => $default && empty( $price ) ? '' : ( $price->is_percent() ? 1 : 0 ),
1218
+			'price_selected_operator' => $default && empty($price) ? '' : ($price->is_discount() ? '-' : '+'),
1219
+			'price_selected_is_percent' => $default && empty($price) ? '' : ($price->is_percent() ? 1 : 0),
1220 1220
 			'disabled' => $disabled
1221 1221
 			);
1222 1222
 
1223
-		$template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_price_modifier_template__template_args', $template_args, $tktrow, $prcrow, $price, $default, $disabled, $this->_is_creating_event );
1223
+		$template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_price_modifier_template__template_args', $template_args, $tktrow, $prcrow, $price, $default, $disabled, $this->_is_creating_event);
1224 1224
 
1225
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_price_modifier_selector.template.php';
1225
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_price_modifier_selector.template.php';
1226 1226
 
1227
-		return EEH_Template::display_template( $template, $template_args, TRUE );
1227
+		return EEH_Template::display_template($template, $template_args, TRUE);
1228 1228
 	}
1229 1229
 
1230 1230
 
1231 1231
 
1232
-	protected function _get_ticket_datetime_list_item( $dttrow, $tktrow, $dtt, $ticket, $ticket_datetimes, $default ) {
1233
-		$dttid = !empty($dtt) ? $dtt->ID() : 0;
1234
-		$displayrow = !empty($dtt) ? $dtt->get('DTT_order') : 0;
1235
-		$tkt_dtts = $ticket instanceof EE_Ticket && isset( $ticket_datetimes[$ticket->ID()] ) ? $ticket_datetimes[$ticket->ID()] : array();
1232
+	protected function _get_ticket_datetime_list_item($dttrow, $tktrow, $dtt, $ticket, $ticket_datetimes, $default) {
1233
+		$dttid = ! empty($dtt) ? $dtt->ID() : 0;
1234
+		$displayrow = ! empty($dtt) ? $dtt->get('DTT_order') : 0;
1235
+		$tkt_dtts = $ticket instanceof EE_Ticket && isset($ticket_datetimes[$ticket->ID()]) ? $ticket_datetimes[$ticket->ID()] : array();
1236 1236
 		$template_args = array(
1237
-			'dtt_row' => $default && empty( $dtt ) ? 'DTTNUM' : $dttrow,
1237
+			'dtt_row' => $default && empty($dtt) ? 'DTTNUM' : $dttrow,
1238 1238
 			'tkt_row' => $default ? 'TICKETNUM' : $tktrow,
1239
-			'ticket_datetime_selected' => in_array( $displayrow, $tkt_dtts ) ? ' ticket-selected' : '',
1240
-			'ticket_datetime_checked' => in_array( $displayrow, $tkt_dtts ) ? ' checked="checked"' : '',
1241
-			'DTT_name' => $default && empty( $dtt ) ? 'DTTNAME' : $dtt->get_dtt_display_name( TRUE ),
1239
+			'ticket_datetime_selected' => in_array($displayrow, $tkt_dtts) ? ' ticket-selected' : '',
1240
+			'ticket_datetime_checked' => in_array($displayrow, $tkt_dtts) ? ' checked="checked"' : '',
1241
+			'DTT_name' => $default && empty($dtt) ? 'DTTNAME' : $dtt->get_dtt_display_name(TRUE),
1242 1242
 			'tkt_status_class' => '',
1243 1243
 			);
1244 1244
 
1245
-		$template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_ticket_datetime_list_item__template_args', $template_args, $dttrow, $tktrow, $dtt, $ticket, $ticket_datetimes, $default, $this->_is_creating_event );
1246
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_ticket_datetimes_list_item.template.php';
1247
-		return EEH_Template::display_template( $template, $template_args, TRUE );
1245
+		$template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_ticket_datetime_list_item__template_args', $template_args, $dttrow, $tktrow, $dtt, $ticket, $ticket_datetimes, $default, $this->_is_creating_event);
1246
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_ticket_datetimes_list_item.template.php';
1247
+		return EEH_Template::display_template($template, $template_args, TRUE);
1248 1248
 	}
1249 1249
 
1250 1250
 
@@ -1252,53 +1252,53 @@  discard block
 block discarded – undo
1252 1252
 	protected function _get_ticket_js_structure($all_dtts, $all_tickets) {
1253 1253
 		$template_args = array(
1254 1254
 			'default_datetime_edit_row' => $this->_get_dtt_edit_row('DTTNUM', NULL, TRUE, $all_dtts),
1255
-			'default_ticket_row' => $this->_get_ticket_row( 'TICKETNUM', NULL, array(), array(), TRUE),
1256
-			'default_price_row' => $this->_get_ticket_price_row( 'TICKETNUM', 'PRICENUM', NULL, TRUE, NULL ),
1255
+			'default_ticket_row' => $this->_get_ticket_row('TICKETNUM', NULL, array(), array(), TRUE),
1256
+			'default_price_row' => $this->_get_ticket_price_row('TICKETNUM', 'PRICENUM', NULL, TRUE, NULL),
1257 1257
 			'default_price_rows' => '',
1258 1258
 			'default_base_price_amount' => 0,
1259 1259
 			'default_base_price_name' => '',
1260 1260
 			'default_base_price_description' => '',
1261
-			'default_price_modifier_selector_row' => $this->_get_price_modifier_template( 'TICKETNUM', 'PRICENUM', NULL, TRUE ),
1262
-			'default_available_tickets_for_datetime' => $this->_get_dtt_attached_tickets_row( 'DTTNUM', NULL, array(), array(), TRUE ),
1261
+			'default_price_modifier_selector_row' => $this->_get_price_modifier_template('TICKETNUM', 'PRICENUM', NULL, TRUE),
1262
+			'default_available_tickets_for_datetime' => $this->_get_dtt_attached_tickets_row('DTTNUM', NULL, array(), array(), TRUE),
1263 1263
 			'existing_available_datetime_tickets_list' => '',
1264 1264
 			'existing_available_ticket_datetimes_list' => '',
1265
-			'new_available_datetime_ticket_list_item' => $this->_get_datetime_tickets_list_item( 'DTTNUM', 'TICKETNUM', NULL, NULL, array(), TRUE ),
1266
-			'new_available_ticket_datetime_list_item' => $this->_get_ticket_datetime_list_item( 'DTTNUM', 'TICKETNUM', NULL, NULL, array(), TRUE )
1265
+			'new_available_datetime_ticket_list_item' => $this->_get_datetime_tickets_list_item('DTTNUM', 'TICKETNUM', NULL, NULL, array(), TRUE),
1266
+			'new_available_ticket_datetime_list_item' => $this->_get_ticket_datetime_list_item('DTTNUM', 'TICKETNUM', NULL, NULL, array(), TRUE)
1267 1267
 			);
1268 1268
 
1269 1269
 		$tktrow = 1;
1270
-		foreach ( $all_tickets as $ticket ) {
1271
-			$template_args['existing_available_datetime_tickets_list'] .= $this->_get_datetime_tickets_list_item( 'DTTNUM', $tktrow, NULL, $ticket, array(), TRUE );
1270
+		foreach ($all_tickets as $ticket) {
1271
+			$template_args['existing_available_datetime_tickets_list'] .= $this->_get_datetime_tickets_list_item('DTTNUM', $tktrow, NULL, $ticket, array(), TRUE);
1272 1272
 			$tktrow++;
1273 1273
 		}
1274 1274
 
1275 1275
 
1276 1276
 		$dttrow = 1;
1277
-		foreach ( $all_dtts as $dtt ) {
1278
-			$template_args['existing_available_ticket_datetimes_list'] .= $this->_get_ticket_datetime_list_item( $dttrow, 'TICKETNUM', $dtt, NULL, array(), TRUE );
1277
+		foreach ($all_dtts as $dtt) {
1278
+			$template_args['existing_available_ticket_datetimes_list'] .= $this->_get_ticket_datetime_list_item($dttrow, 'TICKETNUM', $dtt, NULL, array(), TRUE);
1279 1279
 			$dttrow++;
1280 1280
 		}
1281 1281
 
1282 1282
 		$default_prices = EE_Registry::instance()->load_model('Price')->get_all_default_prices();
1283 1283
 		$prcrow = 1;
1284
-		foreach ( $default_prices as $price ) {
1285
-			if ( $price->is_base_price() ) {
1284
+		foreach ($default_prices as $price) {
1285
+			if ($price->is_base_price()) {
1286 1286
 				$template_args['default_base_price_amount'] = $price->get_pretty('PRC_amount', 'localized_float');
1287 1287
 				$template_args['default_base_price_name'] = $price->get('PRC_name');
1288 1288
 				$template_args['default_base_price_description'] = $price->get('PRC_desc');
1289 1289
 				$prcrow++;
1290 1290
 				continue;
1291 1291
 			}
1292
-			$show_trash = ( count( $default_prices ) > 1 && $prcrow === 1 ) || count( $default_prices ) === 1  ? FALSE : TRUE;
1293
-			$show_create = count( $default_prices ) > 1 && count( $default_prices ) !== $prcrow ? FALSE : TRUE;
1294
-			$template_args['default_price_rows'] .= $this->_get_ticket_price_row( 'TICKETNUM', $prcrow, $price, TRUE, NULL, $show_trash, $show_create );
1292
+			$show_trash = (count($default_prices) > 1 && $prcrow === 1) || count($default_prices) === 1 ? FALSE : TRUE;
1293
+			$show_create = count($default_prices) > 1 && count($default_prices) !== $prcrow ? FALSE : TRUE;
1294
+			$template_args['default_price_rows'] .= $this->_get_ticket_price_row('TICKETNUM', $prcrow, $price, TRUE, NULL, $show_trash, $show_create);
1295 1295
 			$prcrow++;
1296 1296
 		}
1297 1297
 
1298
-		$template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_ticket_js_structure__template_args', $template_args, $all_dtts, $all_tickets, $this->_is_creating_event );
1298
+		$template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_ticket_js_structure__template_args', $template_args, $all_dtts, $all_tickets, $this->_is_creating_event);
1299 1299
 
1300
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_ticket_js_structure.template.php';
1301
-		return EEH_Template::display_template( $template, $template_args, TRUE );
1300
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_ticket_js_structure.template.php';
1301
+		return EEH_Template::display_template($template, $template_args, TRUE);
1302 1302
 	}
1303 1303
 
1304 1304
 
Please login to merge, or discard this patch.
caffeinated/brewing_regular.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@
 block discarded – undo
56 56
 	/**
57 57
 	 * callback for the FHEE__EE_Registry__load_helper__helper_paths filter to add the caffeinated paths
58 58
 	 * @param array  $paths original helper paths array
59
-	 * @return array             new array of paths
59
+	 * @return string[]             new array of paths
60 60
 	 */
61 61
 	public function caf_helper_paths( $paths ) {
62 62
 		$paths[] = EE_CAF_CORE . 'helpers' . DS;
Please login to merge, or discard this patch.
Spacing   +59 added lines, -59 removed lines patch added patch discarded remove patch
@@ -25,30 +25,30 @@  discard block
 block discarded – undo
25 25
  * ------------------------------------------------------------------------
26 26
  */
27 27
 // defined some new constants related to caffeinated folder
28
-define('EE_CAF_URL', EE_PLUGIN_DIR_URL . 'caffeinated/' );
29
-define('EE_CAF_CORE', EE_CAFF_PATH . 'core' . DS);
30
-define('EE_CAF_LIBRARIES', EE_CAF_CORE . 'libraries' . DS);
31
-define('EE_CAF_PAYMENT_METHODS', EE_CAFF_PATH . 'payment_methods' . DS );
28
+define('EE_CAF_URL', EE_PLUGIN_DIR_URL.'caffeinated/');
29
+define('EE_CAF_CORE', EE_CAFF_PATH.'core'.DS);
30
+define('EE_CAF_LIBRARIES', EE_CAF_CORE.'libraries'.DS);
31
+define('EE_CAF_PAYMENT_METHODS', EE_CAFF_PATH.'payment_methods'.DS);
32 32
 class EE_Brewing_Regular extends EE_Base {
33 33
 
34 34
 	public function __construct() {
35
-		if ( defined( 'EE_CAFF_PATH' )) {
35
+		if (defined('EE_CAFF_PATH')) {
36 36
 			// activation
37
-			add_action( 'AHEE__EEH_Activation__initialize_db_content', array( $this, 'initialize_caf_db_content' ));
37
+			add_action('AHEE__EEH_Activation__initialize_db_content', array($this, 'initialize_caf_db_content'));
38 38
 			// load caff init
39
-			add_action( 'AHEE__EE_System__set_hooks_for_core', array( $this, 'caffeinated_init' ));
39
+			add_action('AHEE__EE_System__set_hooks_for_core', array($this, 'caffeinated_init'));
40 40
 			// make it so the PDF receipt doesn't show our shameless plug
41
-			add_filter( 'FHEE_Invoice__send_invoice__shameless_plug', '__return_false' );
41
+			add_filter('FHEE_Invoice__send_invoice__shameless_plug', '__return_false');
42 42
 			// add caffeinated modules
43
-			add_filter( 'FHEE__EE_Config__register_modules__modules_to_register', array( $this, 'caffeinated_modules_to_register' ));
43
+			add_filter('FHEE__EE_Config__register_modules__modules_to_register', array($this, 'caffeinated_modules_to_register'));
44 44
 			// load caff scripts
45
-			add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_caffeinated_scripts'), 10 );
45
+			add_action('wp_enqueue_scripts', array($this, 'enqueue_caffeinated_scripts'), 10);
46 46
 
47
-			add_filter( 'FHEE__EE_Registry__load_helper__helper_paths', array( $this, 'caf_helper_paths' ), 10 );
47
+			add_filter('FHEE__EE_Registry__load_helper__helper_paths', array($this, 'caf_helper_paths'), 10);
48 48
 
49
-			add_filter( 'FHEE__EE_Payment_Method_Manager__register_payment_methods__payment_methods_to_register', array( $this, 'caf_payment_methods' ) );
49
+			add_filter('FHEE__EE_Payment_Method_Manager__register_payment_methods__payment_methods_to_register', array($this, 'caf_payment_methods'));
50 50
 			// caffeinated constructed
51
-			do_action( 'AHEE__EE_Brewing_Regular__construct__complete' );
51
+			do_action('AHEE__EE_Brewing_Regular__construct__complete');
52 52
 		}
53 53
 	}
54 54
 
@@ -58,8 +58,8 @@  discard block
 block discarded – undo
58 58
 	 * @param array  $paths original helper paths array
59 59
 	 * @return array             new array of paths
60 60
 	 */
61
-	public function caf_helper_paths( $paths ) {
62
-		$paths[] = EE_CAF_CORE . 'helpers' . DS;
61
+	public function caf_helper_paths($paths) {
62
+		$paths[] = EE_CAF_CORE.'helpers'.DS;
63 63
 		return $paths;
64 64
 	}
65 65
 
@@ -75,22 +75,22 @@  discard block
 block discarded – undo
75 75
 	 * Right now, we ASSUME the only price types in the system are default ones
76 76
 	 * @global type $wpdb
77 77
 	 */
78
-	function initialize_caf_db_content(){
78
+	function initialize_caf_db_content() {
79 79
 //		echo "initialize caf db content!";
80 80
 		global $wpdb;
81 81
 
82 82
 		//use same method of getting creator id as the version introducing the change
83
-		$default_creator_id = apply_filters('FHEE__EE_DMS_Core_4_5_0__get_default_creator_id',get_current_user_id());
83
+		$default_creator_id = apply_filters('FHEE__EE_DMS_Core_4_5_0__get_default_creator_id', get_current_user_id());
84 84
 
85 85
 		$price_type_table = $wpdb->prefix."esp_price_type";
86 86
 		$price_table = $wpdb->prefix."esp_price";
87 87
 
88 88
 		if ($wpdb->get_var("SHOW TABLES LIKE '$price_type_table'") == $price_type_table) {
89 89
 
90
-			$SQL = 'SELECT COUNT(PRT_ID) FROM ' . $price_type_table . ' WHERE PBT_ID=4';//include trashed price types
91
-			$tax_price_type_count = $wpdb->get_var( $SQL );
90
+			$SQL = 'SELECT COUNT(PRT_ID) FROM '.$price_type_table.' WHERE PBT_ID=4'; //include trashed price types
91
+			$tax_price_type_count = $wpdb->get_var($SQL);
92 92
 
93
-			if ( $tax_price_type_count <= 1) {
93
+			if ($tax_price_type_count <= 1) {
94 94
 				$result = $wpdb->insert($price_type_table,
95 95
 						array(
96 96
 							'PRT_name'=>  __("Regional Tax", "event_espresso"),
@@ -101,11 +101,11 @@  discard block
 block discarded – undo
101 101
 							'PRT_wp_user' => $default_creator_id
102 102
 						),
103 103
 						array(
104
-							'%s',//PRT_name
105
-							'%d',//PBT_id
106
-							'%d',//PRT_is_percent
107
-							'%d',//PRT_order
108
-							'%d',//PRT_deleted
104
+							'%s', //PRT_name
105
+							'%d', //PBT_id
106
+							'%d', //PRT_is_percent
107
+							'%d', //PRT_order
108
+							'%d', //PRT_deleted
109 109
 							'%d', //PRT_wp_user
110 110
 						));
111 111
 				//federal tax
@@ -119,14 +119,14 @@  discard block
 block discarded – undo
119 119
 							'PRT_wp_user' => $default_creator_id,
120 120
 						),
121 121
 						array(
122
-							'%s',//PRT_name
123
-							'%d',//PBT_id
124
-							'%d',//PRT_is_percent
125
-							'%d',//PRT_order
126
-							'%d',//PRT_deleted
122
+							'%s', //PRT_name
123
+							'%d', //PBT_id
124
+							'%d', //PRT_is_percent
125
+							'%d', //PRT_order
126
+							'%d', //PRT_deleted
127 127
 							'%d' //PRT_wp_user
128 128
 						));
129
-				if( $result){
129
+				if ($result) {
130 130
 					$wpdb->insert($price_table,
131 131
 							array(
132 132
 								'PRT_ID'=>$wpdb->insert_id,
@@ -141,15 +141,15 @@  discard block
 block discarded – undo
141 141
 								'PRC_wp_user' => $default_creator_id
142 142
 							),
143 143
 							array(
144
-								'%d',//PRT_id
145
-								'%f',//PRC_amount
146
-								'%s',//PRC_name
147
-								'%s',//PRC_desc
148
-								'%d',//PRC_is_default
149
-								'%d',//PRC_overrides
150
-								'%d',//PRC_deleted
151
-								'%d',//PRC_order
152
-								'%d',//PRC_parent
144
+								'%d', //PRT_id
145
+								'%f', //PRC_amount
146
+								'%s', //PRC_name
147
+								'%s', //PRC_desc
148
+								'%d', //PRC_is_default
149
+								'%d', //PRC_overrides
150
+								'%d', //PRC_deleted
151
+								'%d', //PRC_order
152
+								'%d', //PRC_parent
153 153
 								'%d' //PRC_wp_user
154 154
 							));
155 155
 				}
@@ -169,11 +169,11 @@  discard block
 block discarded – undo
169 169
 	 *  	@param array $modules_to_register
170 170
 	 *  	@return array
171 171
 	 */
172
-	public function caffeinated_modules_to_register( $modules_to_register = array() ){
173
-		if ( is_readable( EE_CAFF_PATH . 'modules' )) {
174
-			$caffeinated_modules_to_register = glob( EE_CAFF_PATH . 'modules' . DS . '*', GLOB_ONLYDIR );
175
-			if ( is_array( $caffeinated_modules_to_register ) && ! empty( $caffeinated_modules_to_register )) {
176
-				$modules_to_register = array_merge( $modules_to_register, $caffeinated_modules_to_register );
172
+	public function caffeinated_modules_to_register($modules_to_register = array()) {
173
+		if (is_readable(EE_CAFF_PATH.'modules')) {
174
+			$caffeinated_modules_to_register = glob(EE_CAFF_PATH.'modules'.DS.'*', GLOB_ONLYDIR);
175
+			if (is_array($caffeinated_modules_to_register) && ! empty($caffeinated_modules_to_register)) {
176
+				$modules_to_register = array_merge($modules_to_register, $caffeinated_modules_to_register);
177 177
 			}
178 178
 		}
179 179
 		return $modules_to_register;
@@ -181,19 +181,19 @@  discard block
 block discarded – undo
181 181
 
182 182
 
183 183
 
184
-	public function caffeinated_init(){
184
+	public function caffeinated_init() {
185 185
 		// EE_Register_CPTs hooks
186
-		add_filter('FHEE__EE_Register_CPTs__get_taxonomies__taxonomies', array( $this, 'filter_taxonomies' ), 10 );
187
-		add_filter('FHEE__EE_Register_CPTs__get_CPTs__cpts', array( $this, 'filter_cpts' ), 10 );
188
-		add_filter('FHEE__EE_Admin__get_extra_nav_menu_pages_items', array( $this, 'nav_metabox_items' ), 10 );
189
-		EE_Registry::instance()->load_file( EE_CAFF_PATH, 'EE_Caf_Messages', 'class', array(), FALSE );
186
+		add_filter('FHEE__EE_Register_CPTs__get_taxonomies__taxonomies', array($this, 'filter_taxonomies'), 10);
187
+		add_filter('FHEE__EE_Register_CPTs__get_CPTs__cpts', array($this, 'filter_cpts'), 10);
188
+		add_filter('FHEE__EE_Admin__get_extra_nav_menu_pages_items', array($this, 'nav_metabox_items'), 10);
189
+		EE_Registry::instance()->load_file(EE_CAFF_PATH, 'EE_Caf_Messages', 'class', array(), FALSE);
190 190
 		// caffeinated_init__complete hook
191
-		do_action( 'AHEE__EE_Brewing_Regular__caffeinated_init__complete' );
191
+		do_action('AHEE__EE_Brewing_Regular__caffeinated_init__complete');
192 192
 	}
193 193
 
194 194
 
195 195
 
196
-	public function enqueue_caffeinated_scripts(){
196
+	public function enqueue_caffeinated_scripts() {
197 197
 		// sound of crickets...
198 198
 	}
199 199
 
@@ -202,23 +202,23 @@  discard block
 block discarded – undo
202 202
 	 * callbacks below here
203 203
 	 */
204 204
 
205
-	public function filter_taxonomies( $taxonomy_array ) {
205
+	public function filter_taxonomies($taxonomy_array) {
206 206
 		$taxonomy_array['espresso_venue_categories']['args']['show_in_nav_menus'] = TRUE;
207 207
 		return $taxonomy_array;
208 208
 	}
209 209
 
210 210
 
211 211
 
212
-	public function filter_cpts( $cpt_array ) {
212
+	public function filter_cpts($cpt_array) {
213 213
 		$cpt_array['espresso_venues']['args']['show_in_nav_menus'] = TRUE;
214 214
 		return $cpt_array;
215 215
 	}
216 216
 
217 217
 
218
-	public function nav_metabox_items( $menuitems ) {
218
+	public function nav_metabox_items($menuitems) {
219 219
 		$menuitems[] = array(
220 220
 			'title' => __('Venue List', 'event_espresso'),
221
-			'url' => get_post_type_archive_link( 'espresso_venues' ),
221
+			'url' => get_post_type_archive_link('espresso_venues'),
222 222
 			'description' => __('Archive page for all venues.', 'event_espresso')
223 223
 			);
224 224
 		return $menuitems;
@@ -229,9 +229,9 @@  discard block
 block discarded – undo
229 229
 	 * @param array $payment_method_paths
230 230
 	 * @return array values are folder paths to payment method folders
231 231
 	 */
232
-	public function caf_payment_methods( $payment_method_paths ) {
233
-		$caf_payment_methods_paths = glob( EE_CAF_PAYMENT_METHODS . '*', GLOB_ONLYDIR );
234
-		$payment_method_paths = array_merge( $payment_method_paths, $caf_payment_methods_paths );
232
+	public function caf_payment_methods($payment_method_paths) {
233
+		$caf_payment_methods_paths = glob(EE_CAF_PAYMENT_METHODS.'*', GLOB_ONLYDIR);
234
+		$payment_method_paths = array_merge($payment_method_paths, $caf_payment_methods_paths);
235 235
 		return $payment_method_paths;
236 236
 	}
237 237
 }
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@
 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
  * the purpose of this file is to simply contain any action/filter hook callbacks etc for specific aspects of EE related to caffeinated (regular) use.  Before putting any code in here, First be certain that it isn't better to define and use the hook in a specific caffeinated/whatever class or file.
4 6
  */
Please login to merge, or discard this patch.
caffeinated/EE_Caf_Messages.class.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -72,7 +72,7 @@
 block discarded – undo
72 72
 	/**
73 73
 	 * This just allows us to add additional paths to the autoloader (EED_Messages::autoload_messages()) for the messages system.
74 74
 	 * @param  array  $dir_ref original array of paths
75
-	 * @return array           appended paths
75
+	 * @return string[]           appended paths
76 76
 	 */
77 77
 	public function messages_autoload_paths( $dir_ref ) {
78 78
 		$dir_ref[] = EE_CAF_LIBRARIES . 'shortcodes/';
Please login to merge, or discard this patch.
Spacing   +142 added lines, -142 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
  * @since            4.3.2
16 16
  * @author          Darren Ethier
17 17
  */
18
-class EE_Caf_Messages  {
18
+class EE_Caf_Messages {
19 19
 
20 20
 
21 21
 	/**
@@ -34,36 +34,36 @@  discard block
 block discarded – undo
34 34
 	 * @return void
35 35
 	 */
36 36
 	private function _caf_hooks() {
37
-		add_filter('FHEE__EED_Messages___set_messages_paths___MSG_PATHS', array( $this, 'messages_autoload_paths'), 5 );
38
-		add_filter('FHEE__EE_Email_messenger__get_validator_config', array( $this, 'email_messenger_validator_config'), 5, 2 );
39
-		add_filter('FHEE__EE_Email_messenger__get_template_fields', array( $this, 'email_messenger_template_fields'), 5, 2 );
40
-		add_filter( 'FHEE__EE_Html_messenger__get_template_fields', array( $this, 'html_messenger_template_fields' ), 5, 2 );
41
-		add_filter( 'FHEE__EE_Html_messenger__get_validator_config', array( $this, 'html_messenger_validator_config' ), 5, 2 );
42
-		add_filter( 'FHEE__EE_Pdf_messenger__get_template_fields', array( $this, 'pdf_messenger_template_fields' ), 5, 2 );
43
-		add_filter( 'FHEE__EE_Pdf_messenger__get_validator_config', array( $this, 'pdf_messenger_validator_config' ), 5, 2 );
44
-		add_filter('FHEE__EE_Messages_Template_Pack__get_specific_template__contents', array( $this, 'new_default_templates'), 5, 7 );
45
-		add_filter('FHEE__EE_Messages_Base__get_valid_shortcodes', array( $this, 'message_types_valid_shortcodes'), 5, 2 );
37
+		add_filter('FHEE__EED_Messages___set_messages_paths___MSG_PATHS', array($this, 'messages_autoload_paths'), 5);
38
+		add_filter('FHEE__EE_Email_messenger__get_validator_config', array($this, 'email_messenger_validator_config'), 5, 2);
39
+		add_filter('FHEE__EE_Email_messenger__get_template_fields', array($this, 'email_messenger_template_fields'), 5, 2);
40
+		add_filter('FHEE__EE_Html_messenger__get_template_fields', array($this, 'html_messenger_template_fields'), 5, 2);
41
+		add_filter('FHEE__EE_Html_messenger__get_validator_config', array($this, 'html_messenger_validator_config'), 5, 2);
42
+		add_filter('FHEE__EE_Pdf_messenger__get_template_fields', array($this, 'pdf_messenger_template_fields'), 5, 2);
43
+		add_filter('FHEE__EE_Pdf_messenger__get_validator_config', array($this, 'pdf_messenger_validator_config'), 5, 2);
44
+		add_filter('FHEE__EE_Messages_Template_Pack__get_specific_template__contents', array($this, 'new_default_templates'), 5, 7);
45
+		add_filter('FHEE__EE_Messages_Base__get_valid_shortcodes', array($this, 'message_types_valid_shortcodes'), 5, 2);
46 46
 
47 47
 		//shortcode parsers
48
-		add_filter('FHEE__EE_Attendee_Shortcodes__shortcodes', array( $this, 'additional_attendee_shortcodes'), 5, 2 );
49
-		add_filter('FHEE__EE_Attendee_Shortcodes__parser_after', array( $this, 'additional_attendee_parser'), 5, 5 );
50
-		add_filter('FHEE__EE_Recipient_List_Shortcodes__shortcodes', array( $this, 'additional_recipient_details_shortcodes'), 5, 2 );
51
-		add_filter('FHEE__EE_Recipient_List_Shortcodes__parser_after', array( $this, 'additional_recipient_details_parser'), 5, 5 );
52
-		add_filter('FHEE__EE_Primary_Registration_List_Shortcodes__shortcodes', array( $this, 'additional_primary_registration_details_shortcodes'), 5, 2 );
53
-		add_filter('FHEE__EE_Primary_Registration_List_Shortcodes__parser_after', array( $this, 'additional_primary_registration_details_parser'), 5, 5 );
48
+		add_filter('FHEE__EE_Attendee_Shortcodes__shortcodes', array($this, 'additional_attendee_shortcodes'), 5, 2);
49
+		add_filter('FHEE__EE_Attendee_Shortcodes__parser_after', array($this, 'additional_attendee_parser'), 5, 5);
50
+		add_filter('FHEE__EE_Recipient_List_Shortcodes__shortcodes', array($this, 'additional_recipient_details_shortcodes'), 5, 2);
51
+		add_filter('FHEE__EE_Recipient_List_Shortcodes__parser_after', array($this, 'additional_recipient_details_parser'), 5, 5);
52
+		add_filter('FHEE__EE_Primary_Registration_List_Shortcodes__shortcodes', array($this, 'additional_primary_registration_details_shortcodes'), 5, 2);
53
+		add_filter('FHEE__EE_Primary_Registration_List_Shortcodes__parser_after', array($this, 'additional_primary_registration_details_parser'), 5, 5);
54 54
 
55 55
 		/**
56 56
 		 * @since 4.2.0
57 57
 		 */
58
-		add_filter( 'FHEE__EE_Datetime_Shortcodes__shortcodes', array( $this, 'additional_datetime_shortcodes'), 10, 2 );
59
-		add_filter( 'FHEE__EE_Datetime_Shortcodes__parser_after', array( $this, 'additional_datetime_parser'), 10, 5 );
58
+		add_filter('FHEE__EE_Datetime_Shortcodes__shortcodes', array($this, 'additional_datetime_shortcodes'), 10, 2);
59
+		add_filter('FHEE__EE_Datetime_Shortcodes__parser_after', array($this, 'additional_datetime_parser'), 10, 5);
60 60
 
61 61
 		/**
62 62
 		 * @since 4.3.0
63 63
 		 */
64 64
 		//eat our own dog food!
65
-		add_action('EE_Brewing_Regular___messages_caf', array( $this, 'register_caf_message_types' ) );
66
-		add_action('EE_Brewing_Regular___messages_caf', array( $this, 'register_caf_shortcodes' ) );
65
+		add_action('EE_Brewing_Regular___messages_caf', array($this, 'register_caf_message_types'));
66
+		add_action('EE_Brewing_Regular___messages_caf', array($this, 'register_caf_shortcodes'));
67 67
 		do_action('EE_Brewing_Regular___messages_caf');
68 68
 	}
69 69
 
@@ -74,14 +74,14 @@  discard block
 block discarded – undo
74 74
 	 * @param  array  $dir_ref original array of paths
75 75
 	 * @return array           appended paths
76 76
 	 */
77
-	public function messages_autoload_paths( $dir_ref ) {
78
-		$dir_ref[] = EE_CAF_LIBRARIES . 'shortcodes/';
77
+	public function messages_autoload_paths($dir_ref) {
78
+		$dir_ref[] = EE_CAF_LIBRARIES.'shortcodes/';
79 79
 		return $dir_ref;
80 80
 	}
81 81
 
82 82
 
83 83
 
84
-	public function email_messenger_validator_config( $validator_config, EE_Email_messenger $messenger ) {
84
+	public function email_messenger_validator_config($validator_config, EE_Email_messenger $messenger) {
85 85
 		$validator_config['attendee_list'] = array(
86 86
 				'shortcodes' => array('attendee', 'event_list', 'ticket_list', 'question_list'),
87 87
 				'required' => array('[ATTENDEE_LIST]')
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 
96 96
 
97 97
 
98
-	public function html_messenger_validator_config( $validator_config, EE_Html_messenger $messenger ) {
98
+	public function html_messenger_validator_config($validator_config, EE_Html_messenger $messenger) {
99 99
 		$validator_config['attendee_list'] = array(
100 100
 			'shortcodes' => array('attendee', 'question_list'),
101 101
 			'required' => array('[ATTENDEE_LIST]')
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 
110 110
 
111 111
 
112
-	public function pdf_messenger_validator_config( $validator_config, EE_Pdf_messenger $messenger ) {
112
+	public function pdf_messenger_validator_config($validator_config, EE_Pdf_messenger $messenger) {
113 113
 		$validator_config['attendee_list'] = array(
114 114
 			'shortcodes' => array('attendee', 'event_list', 'ticket_list', 'question_list'),
115 115
 			'required' => array('[ATTENDEE_LIST]')
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 
125 125
 
126 126
 
127
-	public function email_messenger_template_fields( $template_fields, EE_Email_messenger $messenger ) {
127
+	public function email_messenger_template_fields($template_fields, EE_Email_messenger $messenger) {
128 128
 		$template_fields['extra']['content']['question_list'] = array(
129 129
 						'input' => 'textarea',
130 130
 						'label' => '[QUESTION_LIST]',
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
 	}
141 141
 
142 142
 
143
-	public function html_messenger_template_fields( $template_fields, EE_Html_messenger $messenger ) {
143
+	public function html_messenger_template_fields($template_fields, EE_Html_messenger $messenger) {
144 144
 		$template_fields['extra']['content']['question_list'] = array(
145 145
 			'input' => 'textarea',
146 146
 			'label' => '[QUESTION_LIST]',
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
 
158 158
 
159 159
 
160
-	public function pdf_messenger_template_fields( $template_fields, EE_Pdf_messenger $messenger ) {
160
+	public function pdf_messenger_template_fields($template_fields, EE_Pdf_messenger $messenger) {
161 161
 		$template_fields['extra']['content']['question_list'] = array(
162 162
 			'input' => 'textarea',
163 163
 			'label' => '[QUESTION_LIST]',
@@ -174,39 +174,39 @@  discard block
 block discarded – undo
174 174
 
175 175
 
176 176
 
177
-	public function new_default_templates( $contents, $actual_path, EE_messenger $messenger, EE_message_type $message_type, $field, $context, EE_Messages_Template_Pack $template_pack  ) {
177
+	public function new_default_templates($contents, $actual_path, EE_messenger $messenger, EE_message_type $message_type, $field, $context, EE_Messages_Template_Pack $template_pack) {
178 178
 
179 179
 		//we're only modifying templates for the default template pack
180
-		if ( ! $template_pack instanceof EE_Messages_Template_Pack_Default ) {
180
+		if ( ! $template_pack instanceof EE_Messages_Template_Pack_Default) {
181 181
 			return $contents;
182 182
 		}
183 183
 
184 184
 		//the template file name we're replacing contents for.
185
-		$template_file_prefix = $field . '_' . $context;
186
-		$msg_prefix = $messenger->name . '_' . $message_type->name . '_' ;
185
+		$template_file_prefix = $field.'_'.$context;
186
+		$msg_prefix = $messenger->name.'_'.$message_type->name.'_';
187 187
 
188
-		$base_path = EE_CAF_LIBRARIES . 'messages/defaults/default/';
188
+		$base_path = EE_CAF_LIBRARIES.'messages/defaults/default/';
189 189
 
190
-		if ( $messenger->name == 'email' && $message_type->name == 'registration' ) {
190
+		if ($messenger->name == 'email' && $message_type->name == 'registration') {
191 191
 
192
-			switch ( $template_file_prefix ) {
192
+			switch ($template_file_prefix) {
193 193
 
194 194
 				case 'question_list_admin' :
195 195
 				case 'question_list_attendee' :
196 196
 				case 'question_list_primary_attendee' :
197
-					$path = $base_path . $msg_prefix . 'question_list.template.php';
198
-					$contents = EEH_Template::display_template( $path, array(), true );
197
+					$path = $base_path.$msg_prefix.'question_list.template.php';
198
+					$contents = EEH_Template::display_template($path, array(), true);
199 199
 					break;
200 200
 
201 201
 				case 'attendee_list_primary_attendee' :
202
-					$path = $base_path . $msg_prefix . 'attendee_list.template.php';
203
-					$contents = EEH_Template::display_template( $path, array(), true );
202
+					$path = $base_path.$msg_prefix.'attendee_list.template.php';
203
+					$contents = EEH_Template::display_template($path, array(), true);
204 204
 					break;
205 205
 
206 206
 				case 'attendee_list_admin' :
207
-					$path = $base_path . $msg_prefix . 'attendee_list_admin.template.php';
208
-					$contents = EEH_Template::display_template( $path,
209
-						array(), true );
207
+					$path = $base_path.$msg_prefix.'attendee_list_admin.template.php';
208
+					$contents = EEH_Template::display_template($path,
209
+						array(), true);
210 210
 					break;
211 211
 
212 212
 				case 'attendee_list_attendee' :
@@ -214,33 +214,33 @@  discard block
 block discarded – undo
214 214
 					break;
215 215
 
216 216
 				case 'event_list_attendee' :
217
-					$path = $base_path . $msg_prefix . 'event_list_attendee.template.php';
218
-					$contents = EEH_Template::display_template( $path, array(), true );
217
+					$path = $base_path.$msg_prefix.'event_list_attendee.template.php';
218
+					$contents = EEH_Template::display_template($path, array(), true);
219 219
 					break;
220 220
 			}
221
-		} elseif ( $messenger->name == 'email' && $message_type->name == 'newsletter' ) {
222
-			switch( $template_file_prefix ) {
221
+		} elseif ($messenger->name == 'email' && $message_type->name == 'newsletter') {
222
+			switch ($template_file_prefix) {
223 223
 
224 224
 				case 'content_attendee' :
225
-					$path = $base_path . $msg_prefix . 'content.template.php';
226
-					$contents = EEH_Template::display_template( $path, array(), true );
225
+					$path = $base_path.$msg_prefix.'content.template.php';
226
+					$contents = EEH_Template::display_template($path, array(), true);
227 227
 					break;
228 228
 
229 229
 				case 'newsletter_content_attendee' :
230
-					$path = $base_path . $msg_prefix . 'newsletter_content.template.php';
231
-					$contents = EEH_Template::display_template( $path, array(), true );
230
+					$path = $base_path.$msg_prefix.'newsletter_content.template.php';
231
+					$contents = EEH_Template::display_template($path, array(), true);
232 232
 					break;
233 233
 
234 234
 				case 'newsletter_subject_attendee' :
235
-					$path = $base_path . $msg_prefix . 'subject.template.php';
236
-					$contents = EEH_Template::display_template( $path, array(), true );
235
+					$path = $base_path.$msg_prefix.'subject.template.php';
236
+					$contents = EEH_Template::display_template($path, array(), true);
237 237
 					break;
238 238
 			}
239
-		} elseif ( $messenger->name == 'html' && $message_type->name == 'receipt' ) {
240
-			switch  ( $template_file_prefix ) {
239
+		} elseif ($messenger->name == 'html' && $message_type->name == 'receipt') {
240
+			switch ($template_file_prefix) {
241 241
 				case 'attendee_list_purchaser' :
242
-					$path = $base_path . $msg_prefix . 'attendee_list.template.php';
243
-					$contents = EEH_Template::display_template( $path, array(), true );
242
+					$path = $base_path.$msg_prefix.'attendee_list.template.php';
243
+					$contents = EEH_Template::display_template($path, array(), true);
244 244
 					break;
245 245
 			}
246 246
 		}
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
 
252 252
 
253 253
 
254
-	public function message_types_valid_shortcodes( $valid_shortcodes, EE_Messages_Base $msg ) {
254
+	public function message_types_valid_shortcodes($valid_shortcodes, EE_Messages_Base $msg) {
255 255
 		//make sure question_list and question are ONLY added for the core message types.  Any other message types will have to explicitly set question_list as a valid shortcode.
256 256
 		$include_with = array(
257 257
 			'registration',
@@ -268,9 +268,9 @@  discard block
 block discarded – undo
268 268
 			'invoice',
269 269
 			'receipt'
270 270
 			);
271
-		if ( $msg instanceof EE_message_type && in_array( $msg->name, $include_with )) {
271
+		if ($msg instanceof EE_message_type && in_array($msg->name, $include_with)) {
272 272
 			$contexts = array_keys($msg->get_contexts());
273
-				foreach ( $contexts as $context ) {
273
+				foreach ($contexts as $context) {
274 274
 					$valid_shortcodes[$context][] = 'question_list';
275 275
 					$valid_shortcodes[$context][] = 'question';
276 276
 				}
@@ -282,35 +282,35 @@  discard block
 block discarded – undo
282 282
 
283 283
 
284 284
 
285
-	public function additional_attendee_shortcodes( $shortcodes, $shortcode_parser ) {
285
+	public function additional_attendee_shortcodes($shortcodes, $shortcode_parser) {
286 286
 		$shortcodes['[ANSWER_*]'] = __('This is a special dynamic shortcode. Right after the "*", add the exact text of a existing question, and if there is an answer for that question for this registrant, that will take the place of this shortcode.', 'event_espresso');
287 287
 		return $shortcodes;
288 288
 	}
289 289
 
290 290
 
291 291
 
292
-	public function additional_attendee_parser( $parsed, $shortcode, $data, $extra_data, $shortcode_parser ) {
292
+	public function additional_attendee_parser($parsed, $shortcode, $data, $extra_data, $shortcode_parser) {
293 293
 
294
-		if ( strpos( $shortcode, '[ANSWER_*' ) === FALSE || !isset( $extra_data['data']->questions) || !isset( $extra_data['data']->registrations) )
294
+		if (strpos($shortcode, '[ANSWER_*') === FALSE || ! isset($extra_data['data']->questions) || ! isset($extra_data['data']->registrations))
295 295
 			return $parsed;
296 296
 
297 297
 		//let's get the question from the code.
298 298
 		$shortcode = str_replace('[ANSWER_*', '', $shortcode);
299
-		$shortcode = trim( str_replace(']', '', $shortcode) );
299
+		$shortcode = trim(str_replace(']', '', $shortcode));
300 300
 
301 301
 		$registration = $data instanceof EE_Registration ? $data : null;
302
-		$registration = ! $registration instanceof EE_Registration && is_array( $extra_data ) && isset( $extra_data['data'] ) && $extra_data['data'] instanceof EE_Registration ? $extra_data['data'] : $registration;
302
+		$registration = ! $registration instanceof EE_Registration && is_array($extra_data) && isset($extra_data['data']) && $extra_data['data'] instanceof EE_Registration ? $extra_data['data'] : $registration;
303 303
 
304 304
 		$aee = $data instanceof EE_Messages_Addressee ? $data : null;
305
-		$aee = ! $aee instanceof EE_Messages_Addressee && is_array( $extra_data ) && isset( $extra_data['data'] ) ? $extra_data['data'] : $aee;
305
+		$aee = ! $aee instanceof EE_Messages_Addressee && is_array($extra_data) && isset($extra_data['data']) ? $extra_data['data'] : $aee;
306 306
 
307
-		if ( ! $registration instanceof EE_Registration || ! $aee instanceof EE_Messages_Addressee ) {
307
+		if ( ! $registration instanceof EE_Registration || ! $aee instanceof EE_Messages_Addressee) {
308 308
 			return $parsed;
309 309
 		}
310 310
 
311 311
 		//now let's figure out which question has this text.
312
-		foreach ( $aee->questions as $ansid => $question ) {
313
-			if ( $question instanceof EE_Question && $question->display_text() == $shortcode && isset($aee->registrations[$registration->ID()]['ans_objs'][$ansid]) ) {
312
+		foreach ($aee->questions as $ansid => $question) {
313
+			if ($question instanceof EE_Question && $question->display_text() == $shortcode && isset($aee->registrations[$registration->ID()]['ans_objs'][$ansid])) {
314 314
 				return $aee->registrations[$registration->ID()]['ans_objs'][$ansid]->get_pretty('ANS_value', 'no_wpautop');
315 315
 			}
316 316
 		}
@@ -332,7 +332,7 @@  discard block
 block discarded – undo
332 332
 	 * @return array                   						array of shortcodes and
333 333
 	 *                                             			descriptions
334 334
 	 */
335
-	public function additional_datetime_shortcodes( $shortcodes, $shortcode_parser ) {
335
+	public function additional_datetime_shortcodes($shortcodes, $shortcode_parser) {
336 336
 		$shortcodes['[DTT_NAME]'] = __('This will be parsed to the Title given for a Datetime', 'event_espresso');
337 337
 		$shortcodes['[DTT_DESCRIPTION]'] = __('This will be parsed to the description for a Datetime', 'event_espresso');
338 338
 		$shortcodes['[DTT_NAME_OR_DATES]'] = __('When parsed, if the Datetime has a name, it is used, otherwise a formatted string including the start date and end date will be used.', 'event_espresso');
@@ -354,13 +354,13 @@  discard block
 block discarded – undo
354 354
 	 * @param  EE_Datetime_Shortcodes $shortcode_parser
355 355
 	 * @return string                   The new parsed string.
356 356
 	 */
357
-	public function additional_datetime_parser( $parsed, $shortcode, $data, $extra_data, $shortcode_parser ) {
357
+	public function additional_datetime_parser($parsed, $shortcode, $data, $extra_data, $shortcode_parser) {
358 358
 
359
-		if ( ! $data instanceof EE_Datetime ) {
359
+		if ( ! $data instanceof EE_Datetime) {
360 360
 			return ''; //get out because we can only parse with the datetime object.
361 361
 		}
362 362
 
363
-		switch ( $shortcode ) {
363
+		switch ($shortcode) {
364 364
 			case '[DTT_NAME]' :
365 365
 				return $data->name();
366 366
 				break;
@@ -368,7 +368,7 @@  discard block
 block discarded – undo
368 368
 				return $data->description();
369 369
 				break;
370 370
 			case '[DTT_NAME_OR_DATES]' :
371
-				return $data->get_dtt_display_name( TRUE );
371
+				return $data->get_dtt_display_name(TRUE);
372 372
 				break;
373 373
 			default :
374 374
 				return $parsed;
@@ -380,40 +380,40 @@  discard block
 block discarded – undo
380 380
 
381 381
 
382 382
 
383
-	public function additional_recipient_details_shortcodes( $shortcodes, $shortcode_parser ) {
383
+	public function additional_recipient_details_shortcodes($shortcodes, $shortcode_parser) {
384 384
 		$shortcodes['[RECIPIENT_QUESTION_LIST]'] = __('This is used to indicate where you want the list of questions and answers to show for the person receiving the message.', 'event_espresso');
385 385
 		return $shortcodes;
386 386
 	}
387 387
 
388 388
 
389
-	public function additional_recipient_details_parser( $parsed, $shortcode, $data, $extra_data, $shortcode_parser ) {
389
+	public function additional_recipient_details_parser($parsed, $shortcode, $data, $extra_data, $shortcode_parser) {
390 390
 
391
-		if ( array($data) && ! isset( $data['data'] ) )
391
+		if (array($data) && ! isset($data['data']))
392 392
 			return $parsed;
393 393
 
394 394
 		$recipient = $data['data'] instanceof EE_Messages_Addressee ? $data['data'] : NULL;
395
-		$recipient = ! $recipient instanceof EE_Messages_Addressee && array($extra_data) && isset( $extra_data['data'] ) && $extra_data['data'] instanceof EE_Messages_Addressee ? $extra_data['data'] : $recipient;
395
+		$recipient = ! $recipient instanceof EE_Messages_Addressee && array($extra_data) && isset($extra_data['data']) && $extra_data['data'] instanceof EE_Messages_Addressee ? $extra_data['data'] : $recipient;
396 396
 
397
-		if ( ! $recipient instanceof EE_Messages_Addressee )
397
+		if ( ! $recipient instanceof EE_Messages_Addressee)
398 398
 			return $parsed;
399 399
 
400
-		switch ( $shortcode ) {
400
+		switch ($shortcode) {
401 401
 			case '[RECIPIENT_QUESTION_LIST]' :
402 402
 				$att = $recipient->att_obj;
403 403
 				$registrations_on_attendee = $att instanceof EE_Attendee ? $recipient->attendees[$att->ID()]['reg_objs'] : array();
404
-				$registrations_on_attendee = empty( $registrations_on_attendee ) && $recipient->reg_obj instanceof EE_Registration ? array( $recipient->reg_obj ) : $registrations_on_attendee;
404
+				$registrations_on_attendee = empty($registrations_on_attendee) && $recipient->reg_obj instanceof EE_Registration ? array($recipient->reg_obj) : $registrations_on_attendee;
405 405
 				$answers = array();
406 406
 
407
-				$template = is_array($data['template'] ) && isset($data['template']['question_list']) ? $data['template']['question_list'] : $extra_data['template']['question_list'];
407
+				$template = is_array($data['template']) && isset($data['template']['question_list']) ? $data['template']['question_list'] : $extra_data['template']['question_list'];
408 408
 				$valid_shortcodes = array('question');
409 409
 
410 410
 				//if the context is main_content then get all answers for all registrations on this attendee
411
-				if ( $data['data'] instanceof EE_Messages_Addressee ) {
412
-					foreach ( $registrations_on_attendee as $reg ) {
413
-						if ( $reg instanceof EE_Registration ) {
414
-							$anss = !empty($recipient->registrations[$reg->ID()]['ans_objs']) ? $recipient->registrations[$reg->ID()]['ans_objs'] : array();
415
-							foreach( $anss as $ans ) {
416
-								if ( $ans instanceof EE_Answer ) {
411
+				if ($data['data'] instanceof EE_Messages_Addressee) {
412
+					foreach ($registrations_on_attendee as $reg) {
413
+						if ($reg instanceof EE_Registration) {
414
+							$anss = ! empty($recipient->registrations[$reg->ID()]['ans_objs']) ? $recipient->registrations[$reg->ID()]['ans_objs'] : array();
415
+							foreach ($anss as $ans) {
416
+								if ($ans instanceof EE_Answer) {
417 417
 									$answers[$ans->ID()] = $ans;
418 418
 								}
419 419
 							}
@@ -422,13 +422,13 @@  discard block
 block discarded – undo
422 422
 				}
423 423
 
424 424
 				//if the context is the event list parser, then let's return just the answers for all registrations attached to the recipient for that event.
425
-				if ( $data['data'] instanceof EE_Event ) {
425
+				if ($data['data'] instanceof EE_Event) {
426 426
 					$event = $data['data'];
427
-					foreach( $registrations_on_attendee as $reg ) {
428
-						if ( $reg instanceof EE_Registration && $reg->event_ID() == $event->ID() ) {
429
-							$anss = !empty($recipient->registrations[$reg->ID()]['ans_objs']) ? $recipient->registrations[$reg->ID()]['ans_objs'] : array();
430
-							foreach( $anss as $ans ) {
431
-								if ( $ans instanceof EE_Answer ) {
427
+					foreach ($registrations_on_attendee as $reg) {
428
+						if ($reg instanceof EE_Registration && $reg->event_ID() == $event->ID()) {
429
+							$anss = ! empty($recipient->registrations[$reg->ID()]['ans_objs']) ? $recipient->registrations[$reg->ID()]['ans_objs'] : array();
430
+							foreach ($anss as $ans) {
431
+								if ($ans instanceof EE_Answer) {
432 432
 									$answers[$ans->ID()] = $ans;
433 433
 								}
434 434
 							}
@@ -438,13 +438,13 @@  discard block
 block discarded – undo
438 438
 
439 439
 				$question_list = '';
440 440
 				$shortcode_helper = $shortcode_parser->get_shortcode_helper();
441
-				foreach ( $answers as $answer ) {
442
-					if ( $answer instanceof EE_Answer ) {
441
+				foreach ($answers as $answer) {
442
+					if ($answer instanceof EE_Answer) {
443 443
 						$question = $answer->question();
444
-						if ( ! $question instanceof EE_Question || ( $question instanceof EE_Question && $question->admin_only() ) ) {
444
+						if ( ! $question instanceof EE_Question || ($question instanceof EE_Question && $question->admin_only())) {
445 445
 							continue;
446 446
 						}
447
-						$question_list .= $shortcode_helper->parse_question_list_template( $template, $answer, $valid_shortcodes, $extra_data);
447
+						$question_list .= $shortcode_helper->parse_question_list_template($template, $answer, $valid_shortcodes, $extra_data);
448 448
 					}
449 449
 				}
450 450
 				return $question_list;
@@ -457,41 +457,41 @@  discard block
 block discarded – undo
457 457
 	}
458 458
 
459 459
 
460
-	public function additional_primary_registration_details_shortcodes( $shortcodes, $shortcode_parser ) {
460
+	public function additional_primary_registration_details_shortcodes($shortcodes, $shortcode_parser) {
461 461
 		$shortcodes['[PRIMARY_REGISTRANT_QUESTION_LIST]'] = __('This is used to indicate the questions and answers for the primary_registrant. It should be placed in the "[attendee_list]" field', 'event_espresso');
462 462
 		return $shortcodes;
463 463
 	}
464 464
 
465 465
 
466
-	public function additional_primary_registration_details_parser( $parsed, $shortcode, $data, $extra_data, $shortcode_parser ) {
467
-		if ( array($data) && ! isset( $data['data'] ) )
466
+	public function additional_primary_registration_details_parser($parsed, $shortcode, $data, $extra_data, $shortcode_parser) {
467
+		if (array($data) && ! isset($data['data']))
468 468
 			return $parsed;
469 469
 
470 470
 		$recipient = $data['data'] instanceof EE_Messages_Addressee ? $data['data'] : NULL;
471
-		$recipient = ! $recipient instanceof EE_Messages_Addressee && array($extra_data) && isset( $extra_data['data'] ) && $extra_data['data'] instanceof EE_Messages_Addressee ? $extra_data['data'] : $recipient;
471
+		$recipient = ! $recipient instanceof EE_Messages_Addressee && array($extra_data) && isset($extra_data['data']) && $extra_data['data'] instanceof EE_Messages_Addressee ? $extra_data['data'] : $recipient;
472 472
 
473
-		if ( ! $recipient instanceof EE_Messages_Addressee )
473
+		if ( ! $recipient instanceof EE_Messages_Addressee)
474 474
 			return $parsed;
475 475
 
476 476
 		$send_data = ! $data['data'] instanceof EE_Messages_Addressee ? $extra_data : $data;
477 477
 
478
-		switch ( $shortcode ) {
478
+		switch ($shortcode) {
479 479
 			case '[RECIPIENT_QUESTION_LIST]' :
480
-				if ( ! $recipient->primary_att_obj instanceof EE_Attendee || ! $recipient->primary_reg_obj instanceof EE_Registration )
480
+				if ( ! $recipient->primary_att_obj instanceof EE_Attendee || ! $recipient->primary_reg_obj instanceof EE_Registration)
481 481
 					return '';
482 482
 				$registration = $recipient->primary_reg_obj;
483
-				$template = is_array($data['template'] ) && isset($data['template']['question_list']) ? $data['template']['question_list'] : $extra_data['template']['question_list'];
483
+				$template = is_array($data['template']) && isset($data['template']['question_list']) ? $data['template']['question_list'] : $extra_data['template']['question_list'];
484 484
 				$valid_shortcodes = array('question');
485 485
 				$shortcode_helper = $shortcode_parser->get_shortcode_helper();
486 486
 				$answers = $recipient->registrations[$registration->ID()]['ans_objs'];
487 487
 				$question_list = '';
488
-				foreach ( $answers as $answer ) {
489
-					if ( $answer instanceof EE_Answer ) {
488
+				foreach ($answers as $answer) {
489
+					if ($answer instanceof EE_Answer) {
490 490
 						$question = $answer->question();
491
-						if ( $question instanceof EE_Question and $question->admin_only() ) {
491
+						if ($question instanceof EE_Question and $question->admin_only()) {
492 492
 							continue;
493 493
 						}
494
-						$question_list .= $shortcode_helper->parse_question_list_template( $template, $answer, $valid_shortcodes, $send_data);
494
+						$question_list .= $shortcode_helper->parse_question_list_template($template, $answer, $valid_shortcodes, $send_data);
495 495
 					}
496 496
 				}
497 497
 				return $question_list;
@@ -517,67 +517,67 @@  discard block
 block discarded – undo
517 517
 		$setup_args = array(
518 518
 			'mtfilename' => 'EE_Newsletter_message_type.class.php',
519 519
 			'autoloadpaths' => array(
520
-				EE_CAF_LIBRARIES . 'messages/message_type/newsletter/'
520
+				EE_CAF_LIBRARIES.'messages/message_type/newsletter/'
521 521
 				),
522
-			'messengers_to_activate_with' => array( 'email' ),
523
-			'messengers_to_validate_with' => array( 'email' )
522
+			'messengers_to_activate_with' => array('email'),
523
+			'messengers_to_validate_with' => array('email')
524 524
 			);
525
-		EE_Register_Message_Type::register( 'newsletter', $setup_args );
525
+		EE_Register_Message_Type::register('newsletter', $setup_args);
526 526
 
527 527
 		//register payment reminder message type
528 528
 		$setup_args = array(
529 529
 			'mtfilename' => 'EE_Payment_Reminder_message_type.class.php',
530
-			'autoloadpaths' => array( EE_CAF_LIBRARIES . 'messages/message_type/payment_reminder/' ),
531
-			'messengers_to_activate_with' => array( 'email' ),
532
-			'messengers_to_validate_with' => array( 'email' )
530
+			'autoloadpaths' => array(EE_CAF_LIBRARIES.'messages/message_type/payment_reminder/'),
531
+			'messengers_to_activate_with' => array('email'),
532
+			'messengers_to_validate_with' => array('email')
533 533
 			);
534
-		EE_Register_Message_Type::register( 'payment_reminder', $setup_args );
534
+		EE_Register_Message_Type::register('payment_reminder', $setup_args);
535 535
 
536 536
 		//register payment declined message type
537 537
 		$setup_args = array(
538 538
 			'mtfilename' => 'EE_Payment_Declined_message_type.class.php',
539
-			'autoloadpaths' => array( EE_CAF_LIBRARIES . 'messages/message_type/payment_declined/' ),
540
-			'messengers_to_activate_with' => array( 'email' ),
541
-			'messengers_to_validate_with' => array( 'email' )
539
+			'autoloadpaths' => array(EE_CAF_LIBRARIES.'messages/message_type/payment_declined/'),
540
+			'messengers_to_activate_with' => array('email'),
541
+			'messengers_to_validate_with' => array('email')
542 542
 			);
543
-		EE_Register_Message_Type::register( 'payment_declined', $setup_args );
543
+		EE_Register_Message_Type::register('payment_declined', $setup_args);
544 544
 
545 545
 		//register registration declined message type
546 546
 		$setup_args = array(
547 547
 			'mtfilename' => 'EE_Declined_Registration_message_type.class.php',
548
-			'autoloadpaths' => array( EE_CAF_LIBRARIES . 'messages/message_type/declined_registration/' ),
549
-			'messengers_to_activate_with' => array( 'email' ),
550
-			'messengers_to_validate_with' => array( 'email' )
548
+			'autoloadpaths' => array(EE_CAF_LIBRARIES.'messages/message_type/declined_registration/'),
549
+			'messengers_to_activate_with' => array('email'),
550
+			'messengers_to_validate_with' => array('email')
551 551
 			);
552
-		EE_Register_Message_Type::register( 'declined_registration', $setup_args );
552
+		EE_Register_Message_Type::register('declined_registration', $setup_args);
553 553
 
554 554
 		//register registration cancelled message type
555 555
 		$setup_args = array(
556 556
 			'mtfilename' => 'EE_Cancelled_Registration_message_type.class.php',
557
-			'autoloadpaths' => array( EE_CAF_LIBRARIES . 'messages/message_type/cancelled_registration/' ),
558
-			'messengers_to_activate_with' => array( 'email' ),
559
-			'messengers_to_validate_with' => array( 'email' )
557
+			'autoloadpaths' => array(EE_CAF_LIBRARIES.'messages/message_type/cancelled_registration/'),
558
+			'messengers_to_activate_with' => array('email'),
559
+			'messengers_to_validate_with' => array('email')
560 560
 			);
561
-		EE_Register_Message_Type::register( 'cancelled_registration', $setup_args );
561
+		EE_Register_Message_Type::register('cancelled_registration', $setup_args);
562 562
 
563 563
 
564 564
 		//register payment failed message type
565 565
 		$setup_args = array(
566 566
 			'mtfilename' => 'EE_Payment_Failed_message_type.class.php',
567
-			'autoloadpaths' => array( EE_CAF_LIBRARIES . 'messages/message_type/payment_failed/' ),
568
-			'messengers_to_activate_with' => array( 'email' ),
569
-			'messengers_to_validate_with' => array( 'email' )
567
+			'autoloadpaths' => array(EE_CAF_LIBRARIES.'messages/message_type/payment_failed/'),
568
+			'messengers_to_activate_with' => array('email'),
569
+			'messengers_to_validate_with' => array('email')
570 570
 			);
571
-		EE_Register_Message_Type::register( 'payment_failed', $setup_args );
571
+		EE_Register_Message_Type::register('payment_failed', $setup_args);
572 572
 
573 573
 		//register payment declined message type
574 574
 		$setup_args = array(
575 575
 			'mtfilename' => 'EE_Payment_Cancelled_message_type.class.php',
576
-			'autoloadpaths' => array( EE_CAF_LIBRARIES . 'messages/message_type/payment_cancelled/' ),
577
-			'messengers_to_activate_with' => array( 'email' ),
578
-			'messengers_to_validate_with' => array( 'email' )
576
+			'autoloadpaths' => array(EE_CAF_LIBRARIES.'messages/message_type/payment_cancelled/'),
577
+			'messengers_to_activate_with' => array('email'),
578
+			'messengers_to_validate_with' => array('email')
579 579
 			);
580
-		EE_Register_Message_Type::register( 'payment_cancelled', $setup_args );
580
+		EE_Register_Message_Type::register('payment_cancelled', $setup_args);
581 581
 	}
582 582
 
583 583
 
@@ -593,12 +593,12 @@  discard block
 block discarded – undo
593 593
 	public function register_caf_shortcodes() {
594 594
 		$setup_args = array(
595 595
 			'autoloadpaths' => array(
596
-				EE_CAF_LIBRARIES . 'shortcodes/'
596
+				EE_CAF_LIBRARIES.'shortcodes/'
597 597
 				),
598
-			'msgr_validator_callback' => array( 'EE_Newsletter_Shortcodes', 'messenger_validator_config' ),
599
-			'msgr_template_fields_callback' => array( 'EE_Newsletter_Shortcodes', 'messenger_template_fields' ),
600
-			'list_type_shortcodes' => array( '[NEWSLETTER_CONTENT]' )
598
+			'msgr_validator_callback' => array('EE_Newsletter_Shortcodes', 'messenger_validator_config'),
599
+			'msgr_template_fields_callback' => array('EE_Newsletter_Shortcodes', 'messenger_template_fields'),
600
+			'list_type_shortcodes' => array('[NEWSLETTER_CONTENT]')
601 601
 			);
602
-		EE_Register_Messages_Shortcode_Library::register( 'newsletter', $setup_args );
602
+		EE_Register_Messages_Shortcode_Library::register('newsletter', $setup_args);
603 603
 	}
604 604
 }
Please login to merge, or discard this patch.
Braces   +21 added lines, -13 removed lines patch added patch discarded remove patch
@@ -5,7 +5,9 @@  discard block
 block discarded – undo
5 5
  * @subpackage plugin api, messages
6 6
  * @since           4.3.2
7 7
  */
8
-if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
8
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
9
+	exit('No direct script access allowed');
10
+}
9 11
 
10 12
 /**
11 13
  * Used to initialize all EE messages caffeinated functionality.
@@ -291,8 +293,9 @@  discard block
 block discarded – undo
291 293
 
292 294
 	public function additional_attendee_parser( $parsed, $shortcode, $data, $extra_data, $shortcode_parser ) {
293 295
 
294
-		if ( strpos( $shortcode, '[ANSWER_*' ) === FALSE || !isset( $extra_data['data']->questions) || !isset( $extra_data['data']->registrations) )
295
-			return $parsed;
296
+		if ( strpos( $shortcode, '[ANSWER_*' ) === FALSE || !isset( $extra_data['data']->questions) || !isset( $extra_data['data']->registrations) ) {
297
+					return $parsed;
298
+		}
296 299
 
297 300
 		//let's get the question from the code.
298 301
 		$shortcode = str_replace('[ANSWER_*', '', $shortcode);
@@ -388,14 +391,16 @@  discard block
 block discarded – undo
388 391
 
389 392
 	public function additional_recipient_details_parser( $parsed, $shortcode, $data, $extra_data, $shortcode_parser ) {
390 393
 
391
-		if ( array($data) && ! isset( $data['data'] ) )
392
-			return $parsed;
394
+		if ( array($data) && ! isset( $data['data'] ) ) {
395
+					return $parsed;
396
+		}
393 397
 
394 398
 		$recipient = $data['data'] instanceof EE_Messages_Addressee ? $data['data'] : NULL;
395 399
 		$recipient = ! $recipient instanceof EE_Messages_Addressee && array($extra_data) && isset( $extra_data['data'] ) && $extra_data['data'] instanceof EE_Messages_Addressee ? $extra_data['data'] : $recipient;
396 400
 
397
-		if ( ! $recipient instanceof EE_Messages_Addressee )
398
-			return $parsed;
401
+		if ( ! $recipient instanceof EE_Messages_Addressee ) {
402
+					return $parsed;
403
+		}
399 404
 
400 405
 		switch ( $shortcode ) {
401 406
 			case '[RECIPIENT_QUESTION_LIST]' :
@@ -464,21 +469,24 @@  discard block
 block discarded – undo
464 469
 
465 470
 
466 471
 	public function additional_primary_registration_details_parser( $parsed, $shortcode, $data, $extra_data, $shortcode_parser ) {
467
-		if ( array($data) && ! isset( $data['data'] ) )
468
-			return $parsed;
472
+		if ( array($data) && ! isset( $data['data'] ) ) {
473
+					return $parsed;
474
+		}
469 475
 
470 476
 		$recipient = $data['data'] instanceof EE_Messages_Addressee ? $data['data'] : NULL;
471 477
 		$recipient = ! $recipient instanceof EE_Messages_Addressee && array($extra_data) && isset( $extra_data['data'] ) && $extra_data['data'] instanceof EE_Messages_Addressee ? $extra_data['data'] : $recipient;
472 478
 
473
-		if ( ! $recipient instanceof EE_Messages_Addressee )
474
-			return $parsed;
479
+		if ( ! $recipient instanceof EE_Messages_Addressee ) {
480
+					return $parsed;
481
+		}
475 482
 
476 483
 		$send_data = ! $data['data'] instanceof EE_Messages_Addressee ? $extra_data : $data;
477 484
 
478 485
 		switch ( $shortcode ) {
479 486
 			case '[RECIPIENT_QUESTION_LIST]' :
480
-				if ( ! $recipient->primary_att_obj instanceof EE_Attendee || ! $recipient->primary_reg_obj instanceof EE_Registration )
481
-					return '';
487
+				if ( ! $recipient->primary_att_obj instanceof EE_Attendee || ! $recipient->primary_reg_obj instanceof EE_Registration ) {
488
+									return '';
489
+				}
482 490
 				$registration = $recipient->primary_reg_obj;
483 491
 				$template = is_array($data['template'] ) && isset($data['template']['question_list']) ? $data['template']['question_list'] : $extra_data['template']['question_list'];
484 492
 				$valid_shortcodes = array('question');
Please login to merge, or discard this patch.
caffeinated/modules/events_archive_caff/EED_Events_Archive_Caff.module.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -109,7 +109,7 @@
 block discarded – undo
109 109
 	 *  @access 	public
110 110
 	 *  @param 	EE_Events_Archive_Config $CFG
111 111
 	 *  @param 	EE_Request_Handler $REQ
112
-	 *  @return 	void
112
+	 *  @return 	EE_Events_Archive_Config
113 113
 	 */
114 114
 	public static function update_template_settings( $CFG, $REQ ) {
115 115
 		$CFG->EED_Events_Archive = new EE_Events_Archive_Config();
Please login to merge, or discard this patch.
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 	 * @return EED_Events_Archive_Caff
29 29
 	 */
30 30
 	public static function instance() {
31
-		return parent::get_instance( __CLASS__ );
31
+		return parent::get_instance(__CLASS__);
32 32
 	}
33 33
 
34 34
 
@@ -49,9 +49,9 @@  discard block
 block discarded – undo
49 49
 	 *  @return 	void
50 50
 	 */
51 51
 	public static function set_hooks_admin() {
52
-		define( 'EVENTS_ARCHIVE_CAFF_TEMPLATES_PATH', str_replace( '\\', DS, plugin_dir_path( __FILE__ )) . 'templates' . DS );
53
-		add_action( 'AHEE__template_settings__template__before_settings_form', array( 'EED_Events_Archive_Caff', 'template_settings_form' ), 10 );
54
-		add_filter( 'FHEE__General_Settings_Admin_Page__update_template_settings__data', array( 'EED_Events_Archive_Caff', 'update_template_settings' ), 10, 2 );
52
+		define('EVENTS_ARCHIVE_CAFF_TEMPLATES_PATH', str_replace('\\', DS, plugin_dir_path(__FILE__)).'templates'.DS);
53
+		add_action('AHEE__template_settings__template__before_settings_form', array('EED_Events_Archive_Caff', 'template_settings_form'), 10);
54
+		add_filter('FHEE__General_Settings_Admin_Page__update_template_settings__data', array('EED_Events_Archive_Caff', 'update_template_settings'), 10, 2);
55 55
 	}
56 56
 
57 57
 
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 	 * @param    WP $WP
65 65
 	 * @return    void
66 66
 	 */
67
-	public function run( $WP ) {
67
+	public function run($WP) {
68 68
 	}
69 69
 
70 70
 
@@ -79,13 +79,13 @@  discard block
 block discarded – undo
79 79
 	 */
80 80
 	public static function template_settings_form() {
81 81
 		// grab general settings admin page and remove the existing hook callback
82
-		$gen_set_admin = EE_Registry::instance()->LIB->EE_Admin_Page_Loader->get_admin_page_object( 'general_settings' );
83
-		if ( $gen_set_admin instanceof General_Settings_Admin_Page ) {
84
-			remove_action( 'AHEE__template_settings__template__before_settings_form', array( $gen_set_admin, 'template_settings_caff_features' ), 100 );
82
+		$gen_set_admin = EE_Registry::instance()->LIB->EE_Admin_Page_Loader->get_admin_page_object('general_settings');
83
+		if ($gen_set_admin instanceof General_Settings_Admin_Page) {
84
+			remove_action('AHEE__template_settings__template__before_settings_form', array($gen_set_admin, 'template_settings_caff_features'), 100);
85 85
 		}
86 86
 		$template_settings = EE_Registry::instance()->CFG->template_settings;
87
-		$template_settings->EED_Events_Archive = isset( $template_settings->EED_Events_Archive ) ? $template_settings->EED_Events_Archive : new EE_Events_Archive_Config();
88
-		$template_settings->EED_Events_Archive = apply_filters( 'FHEE__EED_Events_Archive__template_settings_form__event_list_config', $template_settings->EED_Events_Archive );
87
+		$template_settings->EED_Events_Archive = isset($template_settings->EED_Events_Archive) ? $template_settings->EED_Events_Archive : new EE_Events_Archive_Config();
88
+		$template_settings->EED_Events_Archive = apply_filters('FHEE__EED_Events_Archive__template_settings_form__event_list_config', $template_settings->EED_Events_Archive);
89 89
 		$events_archive_settings = array(
90 90
 			'display_status_banner' => 0,
91 91
 			'display_description' => 1,
@@ -94,8 +94,8 @@  discard block
 block discarded – undo
94 94
 			'display_venue' => 0,
95 95
 			'display_expired_events' => 0
96 96
 		);
97
-		$events_archive_settings = array_merge( $events_archive_settings, (array)$template_settings->EED_Events_Archive );
98
-		EEH_Template::display_template( EVENTS_ARCHIVE_CAFF_TEMPLATES_PATH . 'admin-event-list-settings.template.php', $events_archive_settings );
97
+		$events_archive_settings = array_merge($events_archive_settings, (array) $template_settings->EED_Events_Archive);
98
+		EEH_Template::display_template(EVENTS_ARCHIVE_CAFF_TEMPLATES_PATH.'admin-event-list-settings.template.php', $events_archive_settings);
99 99
 	}
100 100
 
101 101
 
@@ -111,16 +111,16 @@  discard block
 block discarded – undo
111 111
 	 *  @param 	EE_Request_Handler $REQ
112 112
 	 *  @return 	void
113 113
 	 */
114
-	public static function update_template_settings( $CFG, $REQ ) {
114
+	public static function update_template_settings($CFG, $REQ) {
115 115
 		$CFG->EED_Events_Archive = new EE_Events_Archive_Config();
116 116
 		// unless we are resetting the config...
117
-		if ( ! isset( $REQ['EED_Events_Archive_reset_event_list_settings'] ) || absint( $REQ['EED_Events_Archive_reset_event_list_settings'] ) !== 1 ) {
118
-			$CFG->EED_Events_Archive->display_status_banner = isset( $REQ['EED_Events_Archive_display_status_banner'] ) ? absint( $REQ['EED_Events_Archive_display_status_banner'] ) : 0;
119
-			$CFG->EED_Events_Archive->display_description = isset( $REQ['EED_Events_Archive_display_description'] ) ? absint( $REQ['EED_Events_Archive_display_description'] ) : 1;
120
-			$CFG->EED_Events_Archive->display_ticket_selector = isset( $REQ['EED_Events_Archive_display_ticket_selector'] ) ? absint( $REQ['EED_Events_Archive_display_ticket_selector'] ) : 0;
121
-			$CFG->EED_Events_Archive->display_datetimes = isset( $REQ['EED_Events_Archive_display_datetimes'] ) ? absint( $REQ['EED_Events_Archive_display_datetimes'] ) : 1;
122
-			$CFG->EED_Events_Archive->display_venue = isset( $REQ['EED_Events_Archive_display_venue'] ) ? absint( $REQ['EED_Events_Archive_display_venue'] ) : 0;
123
-			$CFG->EED_Events_Archive->display_expired_events = isset( $REQ['EED_Events_Archive_display_expired_events'] ) ? absint( $REQ['EED_Events_Archive_display_expired_events'] ) : 0;			}
117
+		if ( ! isset($REQ['EED_Events_Archive_reset_event_list_settings']) || absint($REQ['EED_Events_Archive_reset_event_list_settings']) !== 1) {
118
+			$CFG->EED_Events_Archive->display_status_banner = isset($REQ['EED_Events_Archive_display_status_banner']) ? absint($REQ['EED_Events_Archive_display_status_banner']) : 0;
119
+			$CFG->EED_Events_Archive->display_description = isset($REQ['EED_Events_Archive_display_description']) ? absint($REQ['EED_Events_Archive_display_description']) : 1;
120
+			$CFG->EED_Events_Archive->display_ticket_selector = isset($REQ['EED_Events_Archive_display_ticket_selector']) ? absint($REQ['EED_Events_Archive_display_ticket_selector']) : 0;
121
+			$CFG->EED_Events_Archive->display_datetimes = isset($REQ['EED_Events_Archive_display_datetimes']) ? absint($REQ['EED_Events_Archive_display_datetimes']) : 1;
122
+			$CFG->EED_Events_Archive->display_venue = isset($REQ['EED_Events_Archive_display_venue']) ? absint($REQ['EED_Events_Archive_display_venue']) : 0;
123
+			$CFG->EED_Events_Archive->display_expired_events = isset($REQ['EED_Events_Archive_display_expired_events']) ? absint($REQ['EED_Events_Archive_display_expired_events']) : 0; }
124 124
 		return $CFG;
125 125
 	}
126 126
 
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@
 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
  *
Please login to merge, or discard this patch.
caffeinated/modules/recaptcha/EED_Recaptcha.module.php 3 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
 	 * 	process_recaptcha
288 288
 	 *
289 289
 	 * 	@access private
290
-	 * 	@return 	boolean
290
+	 * 	@return 	boolean|null
291 291
 	 */
292 292
 	private static function _get_recaptcha_response() {
293 293
 		EED_Recaptcha::$_recaptcha_response = EE_Registry::instance()->REQ->get( 'g-recaptcha-response', false );
@@ -574,7 +574,7 @@  discard block
 block discarded – undo
574 574
 	 *
575 575
 	 * @access public
576 576
 	 * @param EE_Registration_Config $EE_Registration_Config
577
-	 * @return array
577
+	 * @return EE_Registration_Config
578 578
 	 */
579 579
 	public static function update_admin_settings( EE_Registration_Config $EE_Registration_Config ) {
580 580
 		try {
Please login to merge, or discard this patch.
Spacing   +131 added lines, -132 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 	 * @return EED_Recaptcha
44 44
 	 */
45 45
 	public static function instance() {
46
-		return parent::get_instance( __CLASS__ );
46
+		return parent::get_instance(__CLASS__);
47 47
 	}
48 48
 
49 49
 
@@ -56,15 +56,15 @@  discard block
 block discarded – undo
56 56
 	 */
57 57
 	public static function set_hooks() {
58 58
 		// use_captcha ?
59
-		if ( EE_Registry::instance()->CFG->registration->use_captcha ) {
59
+		if (EE_Registry::instance()->CFG->registration->use_captcha) {
60 60
 			EED_Recaptcha::set_definitions();
61 61
 			EED_Recaptcha::enqueue_styles_and_scripts();
62
-			add_action( 'wp', array( 'EED_Recaptcha', 'set_late_hooks' ), 1, 0 );
63
-			add_action( 'AHEE__before_spco_whats_next_buttons', array( 'EED_Recaptcha', 'display_recaptcha' ), 10, 0 );
64
-			add_filter( 'FHEE__EED_Single_Page_Checkout__init___continue_reg', array( 'EED_Recaptcha', 'not_a_robot' ), 10 );
65
-			add_filter( 'FHEE__EE_SPCO_Reg_Step__set_completed___completed', array( 'EED_Recaptcha', 'not_a_robot' ), 10 );
66
-			add_filter( 'FHEE__EE_SPCO_JSON_Response___toString__JSON_response', array( 'EED_Recaptcha', 'recaptcha_response' ), 10, 1 );
67
-			add_filter( 'FHEE__EED_Recaptcha___bypass_recaptcha__bypass_request_params_array', array( 'EED_Recaptcha', 'bypass_recaptcha_for_spco_load_payment_method' ), 10, 1 );
62
+			add_action('wp', array('EED_Recaptcha', 'set_late_hooks'), 1, 0);
63
+			add_action('AHEE__before_spco_whats_next_buttons', array('EED_Recaptcha', 'display_recaptcha'), 10, 0);
64
+			add_filter('FHEE__EED_Single_Page_Checkout__init___continue_reg', array('EED_Recaptcha', 'not_a_robot'), 10);
65
+			add_filter('FHEE__EE_SPCO_Reg_Step__set_completed___completed', array('EED_Recaptcha', 'not_a_robot'), 10);
66
+			add_filter('FHEE__EE_SPCO_JSON_Response___toString__JSON_response', array('EED_Recaptcha', 'recaptcha_response'), 10, 1);
67
+			add_filter('FHEE__EED_Recaptcha___bypass_recaptcha__bypass_request_params_array', array('EED_Recaptcha', 'bypass_recaptcha_for_spco_load_payment_method'), 10, 1);
68 68
 		}
69 69
 	}
70 70
 
@@ -79,15 +79,15 @@  discard block
 block discarded – undo
79 79
 	public static function set_hooks_admin() {
80 80
 		EED_Recaptcha::set_definitions();
81 81
 		// use_captcha ?
82
-		if ( EE_Registry::instance()->CFG->registration->use_captcha ) {
82
+		if (EE_Registry::instance()->CFG->registration->use_captcha) {
83 83
 			EED_Recaptcha::enqueue_styles_and_scripts();
84
-			add_filter( 'FHEE__EED_Single_Page_Checkout__init___continue_reg', array( 'EED_Recaptcha', 'not_a_robot' ), 10 );
85
-			add_filter( 'FHEE__EE_SPCO_Reg_Step__set_completed___completed', array( 'EED_Recaptcha', 'not_a_robot' ), 10 );
86
-			add_filter( 'FHEE__EE_SPCO_JSON_Response___toString__JSON_response', array( 'EED_Recaptcha', 'recaptcha_response' ), 10, 1 );
84
+			add_filter('FHEE__EED_Single_Page_Checkout__init___continue_reg', array('EED_Recaptcha', 'not_a_robot'), 10);
85
+			add_filter('FHEE__EE_SPCO_Reg_Step__set_completed___completed', array('EED_Recaptcha', 'not_a_robot'), 10);
86
+			add_filter('FHEE__EE_SPCO_JSON_Response___toString__JSON_response', array('EED_Recaptcha', 'recaptcha_response'), 10, 1);
87 87
 		}
88 88
 		// admin settings
89
-		add_action( 'AHEE__Extend_Registration_Form_Admin_Page___reg_form_settings_template', array( 'EED_Recaptcha', 'admin_settings' ), 10, 1 );
90
-		add_filter( 'FHEE__Extend_Registration_Form_Admin_Page___update_reg_form_settings__CFG_registration', array( 'EED_Recaptcha', 'update_admin_settings' ), 10, 1 );
89
+		add_action('AHEE__Extend_Registration_Form_Admin_Page___reg_form_settings_template', array('EED_Recaptcha', 'admin_settings'), 10, 1);
90
+		add_filter('FHEE__Extend_Registration_Form_Admin_Page___update_reg_form_settings__CFG_registration', array('EED_Recaptcha', 'update_admin_settings'), 10, 1);
91 91
 	}
92 92
 
93 93
 
@@ -99,11 +99,11 @@  discard block
 block discarded – undo
99 99
 	 *  @return 	void
100 100
 	 */
101 101
 	public static function set_definitions() {
102
-		if ( is_user_logged_in() ) {
102
+		if (is_user_logged_in()) {
103 103
 			EED_Recaptcha::$_not_a_robot = true;
104 104
 		}
105
-		define( 'RECAPTCHA_BASE_PATH', rtrim( str_replace( array( '\\', '/' ), DS, plugin_dir_path( __FILE__ )), DS ) . DS );
106
-		define( 'RECAPTCHA_BASE_URL', plugin_dir_url( __FILE__ ));
105
+		define('RECAPTCHA_BASE_PATH', rtrim(str_replace(array('\\', '/'), DS, plugin_dir_path(__FILE__)), DS).DS);
106
+		define('RECAPTCHA_BASE_URL', plugin_dir_url(__FILE__));
107 107
 	}
108 108
 
109 109
 
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
 	public static function set_late_hooks() {
118 118
 		add_filter(
119 119
 			'FHEE__Single_Page_Checkout__translate_js_strings__ajax_submit',
120
-			array( 'EED_Recaptcha', 'not_a_robot' )
120
+			array('EED_Recaptcha', 'not_a_robot')
121 121
 		);
122 122
 	}
123 123
 
@@ -130,11 +130,11 @@  discard block
 block discarded – undo
130 130
 	 *  @return 	void
131 131
 	 */
132 132
 	public static function enqueue_styles_and_scripts() {
133
-		wp_register_script( 'espresso_recaptcha', RECAPTCHA_BASE_URL . 'scripts' . DS . 'espresso_recaptcha.js', array( 'single_page_checkout' ), EVENT_ESPRESSO_VERSION, TRUE );
134
-		wp_register_script( 'google_recaptcha', 'https://www.google.com/recaptcha/api.js?hl=' . EE_Registry::instance()->CFG->registration->recaptcha_language, array( 'espresso_recaptcha' ), EVENT_ESPRESSO_VERSION, TRUE );
135
-		EE_Registry::$i18n_js_strings['no_SPCO_error'] = __( 'It appears the Single Page Checkout javascript was not loaded properly! Please refresh the page and try again or contact support.', 'event_espresso' );
136
-		EE_Registry::$i18n_js_strings['no_recaptcha_error'] = __( 'There appears to be a problem with the reCAPTCHA configuration! Please check the admin settings or contact support.', 'event_espresso' );
137
-		EE_Registry::$i18n_js_strings['recaptcha_fail'] = __( 'Please complete the anti-spam test before proceeding.', 'event_espresso' );
133
+		wp_register_script('espresso_recaptcha', RECAPTCHA_BASE_URL.'scripts'.DS.'espresso_recaptcha.js', array('single_page_checkout'), EVENT_ESPRESSO_VERSION, TRUE);
134
+		wp_register_script('google_recaptcha', 'https://www.google.com/recaptcha/api.js?hl='.EE_Registry::instance()->CFG->registration->recaptcha_language, array('espresso_recaptcha'), EVENT_ESPRESSO_VERSION, TRUE);
135
+		EE_Registry::$i18n_js_strings['no_SPCO_error'] = __('It appears the Single Page Checkout javascript was not loaded properly! Please refresh the page and try again or contact support.', 'event_espresso');
136
+		EE_Registry::$i18n_js_strings['no_recaptcha_error'] = __('There appears to be a problem with the reCAPTCHA configuration! Please check the admin settings or contact support.', 'event_espresso');
137
+		EE_Registry::$i18n_js_strings['recaptcha_fail'] = __('Please complete the anti-spam test before proceeding.', 'event_espresso');
138 138
 	}
139 139
 
140 140
 
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 	 * @access    public
146 146
 	 * @param \WP $WP
147 147
 	 */
148
-	public function run( $WP ) {
148
+	public function run($WP) {
149 149
 	}
150 150
 
151 151
 
@@ -155,8 +155,7 @@  discard block
 block discarded – undo
155 155
 	 *  @return boolean
156 156
 	 */
157 157
 	public static function not_a_robot() {
158
-		$not_a_robot = is_bool( EED_Recaptcha::$_not_a_robot ) ? EED_Recaptcha::$_not_a_robot :
159
-			EED_Recaptcha::recaptcha_passed();
158
+		$not_a_robot = is_bool(EED_Recaptcha::$_not_a_robot) ? EED_Recaptcha::$_not_a_robot : EED_Recaptcha::recaptcha_passed();
160 159
 		return $not_a_robot;
161 160
 	}
162 161
 
@@ -172,23 +171,23 @@  discard block
 block discarded – undo
172 171
 	 */
173 172
 	public static function display_recaptcha() {
174 173
 		// logged in means you have already passed a turing test of sorts
175
-		if ( is_user_logged_in() ) {
174
+		if (is_user_logged_in()) {
176 175
 			return;
177 176
 		}
178 177
 		// don't display if not using recaptcha or user is logged in
179
-		if ( EE_Registry::instance()->CFG->registration->use_captcha ) {
178
+		if (EE_Registry::instance()->CFG->registration->use_captcha) {
180 179
 			// only display if they have NOT passed the test yet
181
-			if ( ! EED_Recaptcha::$_not_a_robot ) {
182
-				EE_Registry::instance()->load_helper( 'Template' );
180
+			if ( ! EED_Recaptcha::$_not_a_robot) {
181
+				EE_Registry::instance()->load_helper('Template');
183 182
 				EEH_Template::display_template(
184
-					RECAPTCHA_BASE_PATH . DS . 'templates' . DS . 'recaptcha.template.php',
183
+					RECAPTCHA_BASE_PATH.DS.'templates'.DS.'recaptcha.template.php',
185 184
 					array(
186 185
 						'recaptcha_publickey' 	=> EE_Registry::instance()->CFG->registration->recaptcha_publickey,
187 186
 						'recaptcha_theme' 		=> EE_Registry::instance()->CFG->registration->recaptcha_theme,
188 187
 						'recaptcha_type' 			=> EE_Registry::instance()->CFG->registration->recaptcha_type
189 188
 					)
190 189
 				);
191
-				wp_enqueue_script( 'google_recaptcha' );
190
+				wp_enqueue_script('google_recaptcha');
192 191
 			}
193 192
 		}
194 193
 	}
@@ -219,17 +218,17 @@  discard block
 block discarded – undo
219 218
 	 */
220 219
 	public static function recaptcha_passed() {
221 220
 		// logged in means you have already passed a turing test of sorts
222
-		if ( is_user_logged_in() || EED_Recaptcha::_bypass_recaptcha() ) {
221
+		if (is_user_logged_in() || EED_Recaptcha::_bypass_recaptcha()) {
223 222
 			return TRUE;
224 223
 		}
225 224
 		// was test already passed?
226
-		$recaptcha_passed = EE_Registry::instance()->SSN->get_session_data( 'recaptcha_passed' );
227
-		$recaptcha_passed = filter_var( $recaptcha_passed, FILTER_VALIDATE_BOOLEAN );
225
+		$recaptcha_passed = EE_Registry::instance()->SSN->get_session_data('recaptcha_passed');
226
+		$recaptcha_passed = filter_var($recaptcha_passed, FILTER_VALIDATE_BOOLEAN);
228 227
 		// verify recaptcha
229 228
 		EED_Recaptcha::_get_recaptcha_response();
230
-		if ( ! $recaptcha_passed && EED_Recaptcha::$_recaptcha_response ) {
229
+		if ( ! $recaptcha_passed && EED_Recaptcha::$_recaptcha_response) {
231 230
 			$recaptcha_passed = EED_Recaptcha::_process_recaptcha_response();
232
-			EE_Registry::instance()->SSN->set_session_data( array( 'recaptcha_passed' => $recaptcha_passed ));
231
+			EE_Registry::instance()->SSN->set_session_data(array('recaptcha_passed' => $recaptcha_passed));
233 232
 			EE_Registry::instance()->SSN->update();
234 233
 		}
235 234
 		EED_Recaptcha::$_not_a_robot = $recaptcha_passed;
@@ -245,8 +244,8 @@  discard block
 block discarded – undo
245 244
 	 * @param array $recaptcha_response
246 245
 	 * @return boolean
247 246
 	 */
248
-	public static function recaptcha_response( $recaptcha_response = array() ) {
249
-		if ( EED_Recaptcha::_bypass_recaptcha() ) {
247
+	public static function recaptcha_response($recaptcha_response = array()) {
248
+		if (EED_Recaptcha::_bypass_recaptcha()) {
250 249
 			$recaptcha_response['bypass_recaptcha'] = TRUE;
251 250
 			$recaptcha_response['recaptcha_passed'] = TRUE;
252 251
 		} else {
@@ -266,16 +265,16 @@  discard block
 block discarded – undo
266 265
 	 */
267 266
 	private static function _bypass_recaptcha() {
268 267
 		// an array of key value pairs that must match exactly with the incoming request, in order to bypass recaptcha for the current request ONLY
269
-		$bypass_request_params_array = apply_filters( 'FHEE__EED_Recaptcha___bypass_recaptcha__bypass_request_params_array', array() );
268
+		$bypass_request_params_array = apply_filters('FHEE__EED_Recaptcha___bypass_recaptcha__bypass_request_params_array', array());
270 269
 		// does $bypass_request_params_array have any values ?
271
-		if ( empty( $bypass_request_params_array )) {
270
+		if (empty($bypass_request_params_array)) {
272 271
 			return FALSE;
273 272
 		}
274 273
 		// initially set bypass to TRUE
275 274
 		$bypass_recaptcha = TRUE;
276
-		foreach ( $bypass_request_params_array as $key => $value ) {
275
+		foreach ($bypass_request_params_array as $key => $value) {
277 276
 			// if $key is not found or value doesn't match exactly, then toggle bypass to FALSE, otherwise carry over it's value. This way, one missed setting results in no bypass
278
-			$bypass_recaptcha = isset( $_REQUEST[ $key ] ) && $_REQUEST[ $key ] === $value ? $bypass_recaptcha : FALSE;
277
+			$bypass_recaptcha = isset($_REQUEST[$key]) && $_REQUEST[$key] === $value ? $bypass_recaptcha : FALSE;
279 278
 		}
280 279
 		return $bypass_recaptcha;
281 280
 	}
@@ -290,7 +289,7 @@  discard block
 block discarded – undo
290 289
 	 * 	@return 	boolean
291 290
 	 */
292 291
 	private static function _get_recaptcha_response() {
293
-		EED_Recaptcha::$_recaptcha_response = EE_Registry::instance()->REQ->get( 'g-recaptcha-response', false );
292
+		EED_Recaptcha::$_recaptcha_response = EE_Registry::instance()->REQ->get('g-recaptcha-response', false);
294 293
 	}
295 294
 
296 295
 
@@ -304,26 +303,26 @@  discard block
 block discarded – undo
304 303
 	 */
305 304
 	private static function _process_recaptcha_response() {
306 305
 		// verify library is loaded
307
-		if ( ! class_exists( '\\ReCaptcha\\ReCaptcha' )) {
308
-			require_once( RECAPTCHA_BASE_PATH . DS . 'autoload.php' );
306
+		if ( ! class_exists('\\ReCaptcha\\ReCaptcha')) {
307
+			require_once(RECAPTCHA_BASE_PATH.DS.'autoload.php');
309 308
 		}
310 309
 		// The response from reCAPTCHA
311 310
 		EED_Recaptcha::_get_recaptcha_response();
312 311
 		$recaptcha_response = EED_Recaptcha::$_recaptcha_response;
313 312
 		// Was there a reCAPTCHA response?
314
-		if ( $recaptcha_response ) {
313
+		if ($recaptcha_response) {
315 314
 			// if allow_url_fopen is Off, then set a different request method
316
-			$request_method = ! ini_get( 'allow_url_fopen' ) ? new \ReCaptcha\RequestMethod\SocketPost() : null;
315
+			$request_method = ! ini_get('allow_url_fopen') ? new \ReCaptcha\RequestMethod\SocketPost() : null;
317 316
 			$recaptcha = new \ReCaptcha\ReCaptcha(
318 317
 				EE_Registry::instance()->CFG->registration->recaptcha_privatekey,
319 318
 				$request_method
320 319
 			);
321 320
 			$recaptcha_response = $recaptcha->verify(
322 321
 				EED_Recaptcha::$_recaptcha_response,
323
-				$_SERVER[ 'REMOTE_ADDR' ]
322
+				$_SERVER['REMOTE_ADDR']
324 323
 			);
325 324
 		}
326
-		if ( $recaptcha_response instanceof \ReCaptcha\Response && $recaptcha_response->isSuccess() ) {
325
+		if ($recaptcha_response instanceof \ReCaptcha\Response && $recaptcha_response->isSuccess()) {
327 326
 			return TRUE;
328 327
 		}
329 328
 		// sorry... it appears you can't don't know what soup or hamburgers are !!!
@@ -358,8 +357,8 @@  discard block
 block discarded – undo
358 357
 	 */
359 358
 	protected static function _recaptcha_settings_form() {
360 359
 
361
-		EE_Registry::instance()->load_helper( 'HTML' );
362
-		EE_Registry::instance()->load_helper( 'Template' );
360
+		EE_Registry::instance()->load_helper('HTML');
361
+		EE_Registry::instance()->load_helper('Template');
363 362
 
364 363
 		return new EE_Form_Section_Proper(
365 364
 			array(
@@ -369,12 +368,12 @@  discard block
 block discarded – undo
369 368
 				'subsections' 			=> apply_filters(
370 369
 					'FHEE__EED_Recaptcha___recaptcha_settings_form__form_subsections',
371 370
 					array(
372
-						'main_settings_hdr' 				=> new EE_Form_Section_HTML( EEH_HTML::h2( __( 'reCAPTCHA Anti-spam Settings', 'event_espresso' ) . EEH_Template::get_help_tab_link( 'recaptcha_info' ))),
371
+						'main_settings_hdr' 				=> new EE_Form_Section_HTML(EEH_HTML::h2(__('reCAPTCHA Anti-spam Settings', 'event_espresso').EEH_Template::get_help_tab_link('recaptcha_info'))),
373 372
 						'main_settings' 						=> EED_Recaptcha::_recaptcha_main_settings(),
374
-						'appearance_settings_hdr' 	=> new EE_Form_Section_HTML( EEH_HTML::h2( __( 'reCAPTCHA Appearance', 'event_espresso' ) )),
373
+						'appearance_settings_hdr' 	=> new EE_Form_Section_HTML(EEH_HTML::h2(__('reCAPTCHA Appearance', 'event_espresso'))),
375 374
 						'appearance_settings' 			=> EED_Recaptcha::_recaptcha_appearance_settings(),
376 375
 						// 'recaptcha_example' 				=> new EE_Form_Section_HTML( EED_Recaptcha::display_recaptcha() ),
377
-						'required_fields_note' 			=> new EE_Form_Section_HTML( EEH_HTML::p( __( 'All fields marked with a * are required fields', 'event_espresso' ), '', 'grey-text' ))
376
+						'required_fields_note' 			=> new EE_Form_Section_HTML(EEH_HTML::p(__('All fields marked with a * are required fields', 'event_espresso'), '', 'grey-text'))
378 377
 					)
379 378
 				)
380 379
 			)
@@ -401,28 +400,28 @@  discard block
 block discarded – undo
401 400
 					array(
402 401
 						'use_captcha' 				=> new EE_Yes_No_Input(
403 402
 							array(
404
-								'html_label_text'	 	=> __( 'Use reCAPTCHA', 'event_espresso' ),
403
+								'html_label_text'	 	=> __('Use reCAPTCHA', 'event_espresso'),
405 404
 								'html_help_text' 		=> sprintf(
406
-									__( 'reCAPTCHA is a free service that  protects your website from spam and abuse. It employs advanced risk analysis technology to separate humans from abusive actors. Sign up %1$shere%2$s to receive your Public and Private keys.', 'event_espresso' ),
405
+									__('reCAPTCHA is a free service that  protects your website from spam and abuse. It employs advanced risk analysis technology to separate humans from abusive actors. Sign up %1$shere%2$s to receive your Public and Private keys.', 'event_espresso'),
407 406
 									'<a href="https://www.google.com/recaptcha/intro/index.html">',
408 407
 									'</a>'
409 408
 								),
410
-								'default' 								=> isset( EE_Registry::instance()->CFG->registration->use_captcha ) ? EE_Registry::instance()->CFG->registration->use_captcha : FALSE,
409
+								'default' 								=> isset(EE_Registry::instance()->CFG->registration->use_captcha) ? EE_Registry::instance()->CFG->registration->use_captcha : FALSE,
411 410
 								'display_html_label_text' 	=> FALSE
412 411
 							)
413 412
 						),
414 413
 						'recaptcha_publickey' 		=> new EE_Text_Input(
415 414
 							array(
416
-								'html_label_text'	 	=> __( 'Site Key', 'event_espresso' ),
417
-								'html_help_text' 		=> __( 'The site key is used to display the widget on your site.', 'event_espresso' ),
418
-								'default' 					=> isset( EE_Registry::instance()->CFG->registration->recaptcha_publickey ) ? stripslashes( EE_Registry::instance()->CFG->registration->recaptcha_publickey ) : ''
415
+								'html_label_text'	 	=> __('Site Key', 'event_espresso'),
416
+								'html_help_text' 		=> __('The site key is used to display the widget on your site.', 'event_espresso'),
417
+								'default' 					=> isset(EE_Registry::instance()->CFG->registration->recaptcha_publickey) ? stripslashes(EE_Registry::instance()->CFG->registration->recaptcha_publickey) : ''
419 418
 							)
420 419
 						),
421 420
 						'recaptcha_privatekey' 		=> new EE_Text_Input(
422 421
 							array(
423
-								'html_label_text'	 	=> __( 'Secret Key', 'event_espresso' ),
424
-								'html_help_text' 		=> __( 'The secret key authorizes communication between your application backend and the reCAPTCHA server to verify the user\'s response. The secret key needs to be kept safe for security purposes.', 'event_espresso' ),
425
-								'default' 					=> isset( EE_Registry::instance()->CFG->registration->recaptcha_privatekey ) ? stripslashes( EE_Registry::instance()->CFG->registration->recaptcha_privatekey ) : ''
422
+								'html_label_text'	 	=> __('Secret Key', 'event_espresso'),
423
+								'html_help_text' 		=> __('The secret key authorizes communication between your application backend and the reCAPTCHA server to verify the user\'s response. The secret key needs to be kept safe for security purposes.', 'event_espresso'),
424
+								'default' 					=> isset(EE_Registry::instance()->CFG->registration->recaptcha_privatekey) ? stripslashes(EE_Registry::instance()->CFG->registration->recaptcha_privatekey) : ''
426 425
 							)
427 426
 						)
428 427
 					)
@@ -454,81 +453,81 @@  discard block
 block discarded – undo
454 453
 					array(
455 454
 						'recaptcha_theme' 		=> new EE_Radio_Button_Input(
456 455
 							array(
457
-								'light' => __( 'Light', 'event_espresso' ),
458
-								'dark' => __( 'Dark', 'event_espresso' )
456
+								'light' => __('Light', 'event_espresso'),
457
+								'dark' => __('Dark', 'event_espresso')
459 458
 							),
460 459
 							array(
461
-								'html_label_text'	 	=> __( 'Theme', 'event_espresso' ),
462
-								'html_help_text' 		=> __( 'The color theme of the widget.', 'event_espresso' ),
463
-								'default' 					=> isset( EE_Registry::instance()->CFG->registration->recaptcha_theme ) ? EE_Registry::instance()->CFG->registration->recaptcha_theme : 'light',
460
+								'html_label_text'	 	=> __('Theme', 'event_espresso'),
461
+								'html_help_text' 		=> __('The color theme of the widget.', 'event_espresso'),
462
+								'default' 					=> isset(EE_Registry::instance()->CFG->registration->recaptcha_theme) ? EE_Registry::instance()->CFG->registration->recaptcha_theme : 'light',
464 463
 								'display_html_label_text' => FALSE
465 464
 							)
466 465
 						),
467 466
 						'recaptcha_type' 		=> new EE_Radio_Button_Input(
468 467
 							array(
469
-								'image' => __( 'Image', 'event_espresso' ),
470
-								'audio' => __( 'Audio', 'event_espresso' )
468
+								'image' => __('Image', 'event_espresso'),
469
+								'audio' => __('Audio', 'event_espresso')
471 470
 							),
472 471
 							array(
473
-								'html_label_text'	 	=> __( 'Type', 'event_espresso' ),
474
-								'html_help_text' 		=> __( 'The type of CAPTCHA to serve.', 'event_espresso' ),
475
-								'default' 					=> isset( EE_Registry::instance()->CFG->registration->recaptcha_type ) ? EE_Registry::instance()->CFG->registration->recaptcha_type : 'image',
472
+								'html_label_text'	 	=> __('Type', 'event_espresso'),
473
+								'html_help_text' 		=> __('The type of CAPTCHA to serve.', 'event_espresso'),
474
+								'default' 					=> isset(EE_Registry::instance()->CFG->registration->recaptcha_type) ? EE_Registry::instance()->CFG->registration->recaptcha_type : 'image',
476 475
 								'display_html_label_text' =>FALSE
477 476
 							)
478 477
 						),
479 478
 						'recaptcha_language' 		=> new EE_Select_Input(
480 479
 							array(
481
-								 'ar' 			=> __( 'Arabic', 'event_espresso' ),
482
-								 'bg' 		=> __( 'Bulgarian', 'event_espresso' ),
483
-								 'ca' 			=> __( 'Catalan', 'event_espresso' ),
484
-								 'zh-CN' 	=>  __( 'Chinese (Simplified)', 'event_espresso' ),
485
-								 'zh-TW' 	=>  __( 'Chinese (Traditional)	', 'event_espresso' ),
486
-								 'hr' 			=> __( 'Croatian', 'event_espresso' ),
487
-								 'cs' 			=> __( 'Czech', 'event_espresso' ),
488
-								 'da' 			=> __( 'Danish', 'event_espresso' ),
489
-								 'nl' 			=> __( 'Dutch', 'event_espresso' ),
490
-								 'en-GB' 	=>  __( 'English (UK)', 'event_espresso' ),
491
-								 'en' 			=> __( 'English (US)', 'event_espresso' ),
492
-								 'fil' 			=> __( 'Filipino', 'event_espresso' ),
493
-								 'fi' 			=> __( 'Finnish', 'event_espresso' ),
494
-								 'fr' 			=> __( 'French', 'event_espresso' ),
495
-								 'fr-CA' 	=>  __( 'French (Canadian)', 'event_espresso' ),
496
-								 'de' 			=> __( 'German', 'event_espresso' ),
497
-								 'de-AT' 	=>  __( 'German (Austria)', 'event_espresso' ),
498
-								 'de-CH' 	=>  __( 'German (Switzerland)', 'event_espresso' ),
499
-								 'el' 			=> __( 'Greek', 'event_espresso' ),
500
-								 'iw' 			=> __( 'Hebrew', 'event_espresso' ),
501
-								 'hi' 			=> __( 'Hindi', 'event_espresso' ),
502
-								 'hu' 		=> __( 'Hungarian', 'event_espresso' ),
503
-								 'id' 			=> __( 'Indonesian', 'event_espresso' ),
504
-								 'it' 			=> __( 'Italian', 'event_espresso' ),
505
-								 'ja' 			=> __( 'Japanese', 'event_espresso' ),
506
-								 'ko' 			=> __( 'Korean', 'event_espresso' ),
507
-								 'lv' 			=> __( 'Latvian', 'event_espresso' ),
508
-								 'lt' 			=> __( 'Lithuanian', 'event_espresso' ),
509
-								 'no' 		=> __( 'Norwegian', 'event_espresso' ),
510
-								 'fa' 			=> __( 'Persian', 'event_espresso' ),
511
-								 'pl' 			=> __( 'Polish', 'event_espresso' ),
512
-								 'pt' 			=> __( 'Portuguese', 'event_espresso' ),
513
-								 'pt-BR' 	=>  __( 'Portuguese (Brazil)', 'event_espresso' ),
514
-								 'pt-PT' 	=>  __( 'Portuguese (Portugal)', 'event_espresso' ),
515
-								 'ro' 			=> __( 'Romanian', 'event_espresso' ),
516
-								 'ru' 			=> __( 'Russian', 'event_espresso' ),
517
-								 'sr' 			=> __( 'Serbian', 'event_espresso' ),
518
-								 'sk' 			=> __( 'Slovak', 'event_espresso' ),
519
-								 'sl' 			=> __( 'Slovenian', 'event_espresso' ),
520
-								 'es' 			=> __( 'Spanish', 'event_espresso' ),
521
-								 'es-419' 	=>  __( 'Spanish (Latin America)', 'event_espresso' ),
522
-								 'sv' 			=> __( 'Swedish', 'event_espresso' ),
523
-								 'th' 			=> __( 'Thai', 'event_espresso' ),
524
-								 'tr' 			=> __( 'Turkish', 'event_espresso' ),
525
-								 'uk' 			=> __( 'Ukrainian', 'event_espresso' ),
526
-								 'vi' 			=> __( 'Vietnamese', 'event_espresso')
480
+								 'ar' 			=> __('Arabic', 'event_espresso'),
481
+								 'bg' 		=> __('Bulgarian', 'event_espresso'),
482
+								 'ca' 			=> __('Catalan', 'event_espresso'),
483
+								 'zh-CN' 	=>  __('Chinese (Simplified)', 'event_espresso'),
484
+								 'zh-TW' 	=>  __('Chinese (Traditional)	', 'event_espresso'),
485
+								 'hr' 			=> __('Croatian', 'event_espresso'),
486
+								 'cs' 			=> __('Czech', 'event_espresso'),
487
+								 'da' 			=> __('Danish', 'event_espresso'),
488
+								 'nl' 			=> __('Dutch', 'event_espresso'),
489
+								 'en-GB' 	=>  __('English (UK)', 'event_espresso'),
490
+								 'en' 			=> __('English (US)', 'event_espresso'),
491
+								 'fil' 			=> __('Filipino', 'event_espresso'),
492
+								 'fi' 			=> __('Finnish', 'event_espresso'),
493
+								 'fr' 			=> __('French', 'event_espresso'),
494
+								 'fr-CA' 	=>  __('French (Canadian)', 'event_espresso'),
495
+								 'de' 			=> __('German', 'event_espresso'),
496
+								 'de-AT' 	=>  __('German (Austria)', 'event_espresso'),
497
+								 'de-CH' 	=>  __('German (Switzerland)', 'event_espresso'),
498
+								 'el' 			=> __('Greek', 'event_espresso'),
499
+								 'iw' 			=> __('Hebrew', 'event_espresso'),
500
+								 'hi' 			=> __('Hindi', 'event_espresso'),
501
+								 'hu' 		=> __('Hungarian', 'event_espresso'),
502
+								 'id' 			=> __('Indonesian', 'event_espresso'),
503
+								 'it' 			=> __('Italian', 'event_espresso'),
504
+								 'ja' 			=> __('Japanese', 'event_espresso'),
505
+								 'ko' 			=> __('Korean', 'event_espresso'),
506
+								 'lv' 			=> __('Latvian', 'event_espresso'),
507
+								 'lt' 			=> __('Lithuanian', 'event_espresso'),
508
+								 'no' 		=> __('Norwegian', 'event_espresso'),
509
+								 'fa' 			=> __('Persian', 'event_espresso'),
510
+								 'pl' 			=> __('Polish', 'event_espresso'),
511
+								 'pt' 			=> __('Portuguese', 'event_espresso'),
512
+								 'pt-BR' 	=>  __('Portuguese (Brazil)', 'event_espresso'),
513
+								 'pt-PT' 	=>  __('Portuguese (Portugal)', 'event_espresso'),
514
+								 'ro' 			=> __('Romanian', 'event_espresso'),
515
+								 'ru' 			=> __('Russian', 'event_espresso'),
516
+								 'sr' 			=> __('Serbian', 'event_espresso'),
517
+								 'sk' 			=> __('Slovak', 'event_espresso'),
518
+								 'sl' 			=> __('Slovenian', 'event_espresso'),
519
+								 'es' 			=> __('Spanish', 'event_espresso'),
520
+								 'es-419' 	=>  __('Spanish (Latin America)', 'event_espresso'),
521
+								 'sv' 			=> __('Swedish', 'event_espresso'),
522
+								 'th' 			=> __('Thai', 'event_espresso'),
523
+								 'tr' 			=> __('Turkish', 'event_espresso'),
524
+								 'uk' 			=> __('Ukrainian', 'event_espresso'),
525
+								 'vi' 			=> __('Vietnamese', 'event_espresso')
527 526
 							),
528 527
 							array(
529
-								'html_label_text'	 	=> __( 'Language', 'event_espresso' ),
530
-								'html_help_text' 		=> __( 'Forces the widget to render in a specific language.', 'event_espresso' ),
531
-								'default' 					=> isset( EE_Registry::instance()->CFG->registration->recaptcha_language ) ? EE_Registry::instance()->CFG->registration->recaptcha_language : 'en'
528
+								'html_label_text'	 	=> __('Language', 'event_espresso'),
529
+								'html_help_text' 		=> __('Forces the widget to render in a specific language.', 'event_espresso'),
530
+								'default' 					=> isset(EE_Registry::instance()->CFG->registration->recaptcha_language) ? EE_Registry::instance()->CFG->registration->recaptcha_language : 'en'
532 531
 							)
533 532
 						)
534 533
 					)
@@ -576,25 +575,25 @@  discard block
 block discarded – undo
576 575
 	 * @param EE_Registration_Config $EE_Registration_Config
577 576
 	 * @return array
578 577
 	 */
579
-	public static function update_admin_settings( EE_Registration_Config $EE_Registration_Config ) {
578
+	public static function update_admin_settings(EE_Registration_Config $EE_Registration_Config) {
580 579
 		try {
581 580
 			$recaptcha_settings_form = EED_Recaptcha::_recaptcha_settings_form();
582 581
 			// if not displaying a form, then check for form submission
583
-			if ( $recaptcha_settings_form->was_submitted() ) {
582
+			if ($recaptcha_settings_form->was_submitted()) {
584 583
 				// capture form data
585 584
 				$recaptcha_settings_form->receive_form_submission();
586 585
 				// validate form data
587
-				if ( $recaptcha_settings_form->is_valid() ) {
586
+				if ($recaptcha_settings_form->is_valid()) {
588 587
 					// grab validated data from form
589 588
 					$valid_data = $recaptcha_settings_form->valid_data();
590 589
 					// user proofing recaptcha:  If Use reCAPTCHA is set to yes but we dont' have site or secret keys then set Use reCAPTCHA to FALSE and give error message.
591 590
 					if (
592
-						apply_filters( 'FHEE__Extend_Registration_Form_Admin_Page__check_for_recaptcha_keys', TRUE, $EE_Registration_Config )
591
+						apply_filters('FHEE__Extend_Registration_Form_Admin_Page__check_for_recaptcha_keys', TRUE, $EE_Registration_Config)
593 592
 						&& $valid_data['main_settings']['use_captcha']
594
-						&& ( ! $EE_Registration_Config->use_captcha && ( empty( $valid_data['main_settings']['recaptcha_publickey'] ) || empty( $valid_data['main_settings']['recaptcha_privatekey'] )))
593
+						&& ( ! $EE_Registration_Config->use_captcha && (empty($valid_data['main_settings']['recaptcha_publickey']) || empty($valid_data['main_settings']['recaptcha_privatekey'])))
595 594
 					) {
596 595
 						$valid_data['main_settings']['use_captcha'] = FALSE;
597
-						EE_Error::add_error( __('The use reCAPTCHA setting has been reset to "no". In order to enable the reCAPTCHA service, you must enter a Site Key and Secret Key.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
596
+						EE_Error::add_error(__('The use reCAPTCHA setting has been reset to "no". In order to enable the reCAPTCHA service, you must enter a Site Key and Secret Key.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
598 597
 					}
599 598
 					$EE_Registration_Config->use_captcha = $valid_data['main_settings']['use_captcha'];
600 599
 					$EE_Registration_Config->recaptcha_publickey = $valid_data['main_settings']['recaptcha_publickey'];
@@ -603,12 +602,12 @@  discard block
 block discarded – undo
603 602
 					$EE_Registration_Config->recaptcha_theme = $valid_data['appearance_settings']['recaptcha_theme'];
604 603
 					$EE_Registration_Config->recaptcha_language = $valid_data['appearance_settings']['recaptcha_language'];
605 604
 				} else {
606
-					if ( $recaptcha_settings_form->submission_error_message() != '' ) {
607
-						EE_Error::add_error( $recaptcha_settings_form->submission_error_message(), __FILE__, __FUNCTION__, __LINE__ );
605
+					if ($recaptcha_settings_form->submission_error_message() != '') {
606
+						EE_Error::add_error($recaptcha_settings_form->submission_error_message(), __FILE__, __FUNCTION__, __LINE__);
608 607
 					}
609 608
 				}
610 609
 			}
611
-		} catch( EE_Error $e ) {
610
+		} catch (EE_Error $e) {
612 611
 			$e->get_error();
613 612
 		}
614 613
 
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@
 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
  *
Please login to merge, or discard this patch.
modules/ticket_selector_caff/EED_Ticket_Selector_Caff.module.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -150,7 +150,7 @@
 block discarded – undo
150 150
 	 * @param EE_Template_Config $CFG
151 151
 	 * @param array             $REQ incoming request
152 152
 	 *
153
-	 * @return void
153
+	 * @return EE_Template_Config
154 154
 	 */
155 155
 	public static function update_template_settings( EE_Template_Config $CFG, $REQ ) {
156 156
 		if ( ! isset( $CFG->EED_Ticket_Selector ) ) {
Please login to merge, or discard this patch.
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
 	 * @return EED_Ticket_Selector_Caff
17 17
 	 */
18 18
 	public static function instance() {
19
-		return parent::get_instance( __CLASS__ );
19
+		return parent::get_instance(__CLASS__);
20 20
 	}
21 21
 
22 22
 
@@ -37,24 +37,24 @@  discard block
 block discarded – undo
37 37
 	 *  @return 	void
38 38
 	 */
39 39
 	public static function set_hooks_admin() {
40
-		define( 'TICKET_SELECTOR_CAFF_TEMPLATES_PATH', str_replace( '\\', DS, plugin_dir_path( __FILE__ )) . 'templates' . DS );
41
-		add_action( 'AHEE__template_settings__template__before_settings_form', array( 'EED_Ticket_Selector_Caff', 'template_settings_form' ), 10 );
42
-		add_filter( 'FHEE__General_Settings_Admin_Page__update_template_settings__data', array( 'EED_Ticket_Selector_Caff', 'update_template_settings' ), 10, 2 );
40
+		define('TICKET_SELECTOR_CAFF_TEMPLATES_PATH', str_replace('\\', DS, plugin_dir_path(__FILE__)).'templates'.DS);
41
+		add_action('AHEE__template_settings__template__before_settings_form', array('EED_Ticket_Selector_Caff', 'template_settings_form'), 10);
42
+		add_filter('FHEE__General_Settings_Admin_Page__update_template_settings__data', array('EED_Ticket_Selector_Caff', 'update_template_settings'), 10, 2);
43 43
 	}
44 44
 
45 45
 
46 46
 	//just required because of abstract declaration
47
-	public function run( $WP ) {
47
+	public function run($WP) {
48 48
 		$this->set_config();
49 49
 	}
50 50
 
51 51
 
52 52
 
53 53
 
54
-	protected function set_config(){
55
-		$this->set_config_section( 'template_settings' );
56
-		$this->set_config_class( 'EE_Ticket_Selector_Config' );
57
-		$this->set_config_name( 'EED_Ticket_Selector' );
54
+	protected function set_config() {
55
+		$this->set_config_section('template_settings');
56
+		$this->set_config_class('EE_Ticket_Selector_Config');
57
+		$this->set_config_name('EED_Ticket_Selector');
58 58
 	}
59 59
 
60 60
 
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
 				'subsections' => apply_filters(
89 89
 					'FHEE__EED_Ticket_Selector_Caff___ticket_selector_settings_form__form_subsections',
90 90
 					array(
91
-						'appearance_settings_hdr' 				=> new EE_Form_Section_HTML( EEH_HTML::h3( __( 'Ticket Selector Template Settings', 'event_espresso' ))),
91
+						'appearance_settings_hdr' 				=> new EE_Form_Section_HTML(EEH_HTML::h3(__('Ticket Selector Template Settings', 'event_espresso'))),
92 92
 						'appearance_settings' 			=> EED_Ticket_Selector_Caff::_ticket_selector_appearance_settings()
93 93
 					)
94 94
 				)
@@ -111,25 +111,25 @@  discard block
 block discarded – undo
111 111
 					'FHEE__EED_Ticket_Selector_Caff___ticket_selector_appearance_settings__form_subsections', array(
112 112
 						'show_ticket_details' => new EE_Yes_No_Input(
113 113
 							array(
114
-								'html_label_text' => __('Show Ticket Details?', 'event_espresso' ),
115
-								'html_help_text' => __( 'This lets you choose whether the extra ticket details section is displayed with the ticket selector.', 'event_espresso'),
116
-								'default' => isset( EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_ticket_details ) ? EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_ticket_details : true,
114
+								'html_label_text' => __('Show Ticket Details?', 'event_espresso'),
115
+								'html_help_text' => __('This lets you choose whether the extra ticket details section is displayed with the ticket selector.', 'event_espresso'),
116
+								'default' => isset(EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_ticket_details) ? EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_ticket_details : true,
117 117
 								'display_html_label_text' => false
118 118
 								)
119 119
 							),
120 120
 						'show_ticket_sale_columns' => new EE_Yes_No_Input(
121 121
 							array(
122
-								'html_label_text' => __('Show Ticket Sale Info?', 'event_espresso' ),
123
-								'html_help_text' => __( 'This lets you indicate whether information about ticket sales is shown with ticket details in the ticket selector.', 'event_espresso'),
124
-								'default' => isset( EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_ticket_sale_columns ) ? EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_ticket_sale_columns : true,
122
+								'html_label_text' => __('Show Ticket Sale Info?', 'event_espresso'),
123
+								'html_help_text' => __('This lets you indicate whether information about ticket sales is shown with ticket details in the ticket selector.', 'event_espresso'),
124
+								'default' => isset(EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_ticket_sale_columns) ? EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_ticket_sale_columns : true,
125 125
 								'display_html_label_text' => false
126 126
 								)
127 127
 							),
128 128
 						'show_expired_tickets' => new EE_Yes_No_Input(
129 129
 							array(
130
-								'html_label_text' => __( 'Show Expired Tickets?', 'event_espresso' ),
131
-								'html_help_text' => __( 'Indicate whether to show expired tickets in the ticket selector', 'event_espresso' ),
132
-								'default' => isset( EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_expired_tickets ) ? EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_expired_tickets : true,
130
+								'html_label_text' => __('Show Expired Tickets?', 'event_espresso'),
131
+								'html_help_text' => __('Indicate whether to show expired tickets in the ticket selector', 'event_espresso'),
132
+								'default' => isset(EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_expired_tickets) ? EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_expired_tickets : true,
133 133
 								'display_html_label_text' => false
134 134
 							)
135 135
 						)
@@ -152,21 +152,21 @@  discard block
 block discarded – undo
152 152
 	 *
153 153
 	 * @return void
154 154
 	 */
155
-	public static function update_template_settings( EE_Template_Config $CFG, $REQ ) {
156
-		if ( ! isset( $CFG->EED_Ticket_Selector ) ) {
155
+	public static function update_template_settings(EE_Template_Config $CFG, $REQ) {
156
+		if ( ! isset($CFG->EED_Ticket_Selector)) {
157 157
 			$CFG->EED_Ticket_Selector = new EE_Ticket_Selector_Config();
158 158
 		}
159 159
 		try {
160 160
 			$ticket_selector_form = EED_Ticket_Selector_Caff::_ticket_selector_settings_form();
161 161
 
162 162
 			//check for form submission
163
-			if ( $ticket_selector_form->was_submitted() ) {
163
+			if ($ticket_selector_form->was_submitted()) {
164 164
 
165 165
 				//capture form data
166 166
 				$ticket_selector_form->receive_form_submission();
167 167
 
168 168
 				//validate form data
169
-				if ( $ticket_selector_form->is_valid() ) {
169
+				if ($ticket_selector_form->is_valid()) {
170 170
 
171 171
 					//grab validated data from form
172 172
 					$valid_data = $ticket_selector_form->valid_data();
@@ -176,13 +176,13 @@  discard block
 block discarded – undo
176 176
 					$CFG->EED_Ticket_Selector->show_ticket_details = $valid_data['appearance_settings']['show_ticket_details'];
177 177
 					$CFG->EED_Ticket_Selector->show_expired_tickets = $valid_data['appearance_settings']['show_expired_tickets'];
178 178
 				} else {
179
-					if ( $ticket_selector_form->submission_error_message() != '' ) {
180
-						EE_Error::add_error( $ticket_selector_form->submission_error_message(), __FILE__, __FUNCTION__, __LINE__ );
179
+					if ($ticket_selector_form->submission_error_message() != '') {
180
+						EE_Error::add_error($ticket_selector_form->submission_error_message(), __FILE__, __FUNCTION__, __LINE__);
181 181
 					}
182 182
 				}
183 183
 
184 184
 			}
185
-		} catch( EE_Error $e ) {
185
+		} catch (EE_Error $e) {
186 186
 			$e->get_error();
187 187
 		}
188 188
 
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@
 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
  *
4 6
  * EED_Ticket_Selector_Caff
Please login to merge, or discard this patch.
caffeinated/payment_methods/Aim/EEG_Aim.gateway.php 4 patches
Doc Comments   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -206,7 +206,8 @@  discard block
 block discarded – undo
206 206
 	/**
207 207
 	 * Posts the request to AuthorizeNet & returns response.
208 208
 	 *
209
-	 * @return AuthorizeNetARB_Response The response.
209
+	 * @param EEI_Payment $payment
210
+	 * @return EE_AuthorizeNetAIM_Response The response.
210 211
 	 */
211 212
 	private function _sendRequest($payment) {
212 213
 		$this->_x_post_fields['login'] = $this->_login_id;
@@ -353,9 +354,6 @@  discard block
 block discarded – undo
353 354
 	 * Constructor. Parses the AuthorizeNet response string.
354 355
 	 *
355 356
 	 * @param string $response	  The response from the AuthNet server.
356
-	 * @param string $delimiter	 The delimiter used (default is ",")
357
-	 * @param string $encap_char	The encap_char used (default is "|")
358
-	 * @param array  $custom_fields Any custom fields set in the request.
359 357
 	 */
360 358
 
361 359
 	public function __construct($response) {
Please login to merge, or discard this patch.
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -135,7 +135,7 @@
 block discarded – undo
135 135
 			//in which case, we need to generate teh invoice num per request right here...
136 136
 			$this->setField('invoice_num', wp_generate_password(12,false));//$billing_info['_reg-page-billing-invoice-'.$this->_gateway_name]['value']);
137 137
 			//tell AIM that any duplicates sent in the next 5 minutes are to be ignored
138
-            $this->setField('duplicate_window', 5 * MINUTE_IN_SECONDS );
138
+			$this->setField('duplicate_window', 5 * MINUTE_IN_SECONDS );
139 139
 
140 140
 
141 141
 			if ($this->_test_transactions) {
Please login to merge, or discard this patch.
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if (!defined('EVENT_ESPRESSO_VERSION'))
3
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
4 4
 	exit('No direct script access allowed');
5 5
 
6 6
 /**
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
  *
26 26
  * ------------------------------------------------------------------------
27 27
  */
28
-class EEG_Aim extends EE_Onsite_Gateway{
28
+class EEG_Aim extends EE_Onsite_Gateway {
29 29
 	protected $_login_id;
30 30
 	protected $_transaction_key;
31 31
 	protected $_currencies_supported = array(
@@ -98,17 +98,17 @@  discard block
 block discarded – undo
98 98
 			$primary_registrant = $transaction->primary_registration();
99 99
 			//if we're are charging for the full amount, show the normal line items
100 100
 			//and the itemized total adds up properly
101
-			if( $this->_can_easily_itemize_transaction_for( $payment ) ){
101
+			if ($this->_can_easily_itemize_transaction_for($payment)) {
102 102
 				$total_line_item = $transaction->total_line_item();
103 103
 				foreach ($total_line_item->get_items() as $line_item) {
104 104
 					$this->addLineItem($item_num++, $line_item->name(), $line_item->desc(), $line_item->quantity(), $line_item->unit_price(), 'N');
105 105
 					$order_description .= $line_item->desc().', ';
106 106
 				}
107
-				foreach($total_line_item->tax_descendants() as $tax_line_item){
107
+				foreach ($total_line_item->tax_descendants() as $tax_line_item) {
108 108
 					$this->addLineItem($item_num++, $tax_line_item->name(), $tax_line_item->desc(), 1, $tax_line_item->total(), 'N');
109 109
 				}
110
-			}else{//partial payment
111
-				$order_description = sprintf(__("Payment of %s for %s", "event_espresso"),$payment->amount(),$primary_registrant->reg_code());
110
+			} else {//partial payment
111
+				$order_description = sprintf(__("Payment of %s for %s", "event_espresso"), $payment->amount(), $primary_registrant->reg_code());
112 112
 			}
113 113
 
114 114
 
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
 
117 117
 			//start transaction
118 118
 			$this->setField('amount', $this->format_currency($payment->amount()));
119
-			$this->setField('description',substr(rtrim($order_description, ', '), 0, 255));
119
+			$this->setField('description', substr(rtrim($order_description, ', '), 0, 255));
120 120
 			$this->setField('card_num', $billing_info['credit_card']);
121 121
 			$this->setField('exp_date', $billing_info['exp_month'].$billing_info['exp_year']);
122 122
 			$this->setField('card_code', $billing_info['cvv']);
@@ -125,17 +125,17 @@  discard block
 block discarded – undo
125 125
 			$this->setField('email', $billing_info['email']);
126 126
 			$this->setField('address', $billing_info['address'].' '.$billing_info['address2']);
127 127
 			$this->setField('city', $billing_info['city']);
128
-			$this->setField('state', $billing_info['state'] );
129
-			$this->setField('country', $billing_info['country'] );
128
+			$this->setField('state', $billing_info['state']);
129
+			$this->setField('country', $billing_info['country']);
130 130
 			$this->setField('zip', $billing_info['zip']);
131 131
 			$this->setField('cust_id', $primary_registrant->ID());
132 132
 			$this->setField('phone', $billing_info['phone']);
133 133
 			//invoice_num would be nice to have itbe unique per SPCO page-load, taht way if users
134 134
 			//press back, they don't submit a duplicate. However, we may be keepin gthe user on teh same spco page
135 135
 			//in which case, we need to generate teh invoice num per request right here...
136
-			$this->setField('invoice_num', wp_generate_password(12,false));//$billing_info['_reg-page-billing-invoice-'.$this->_gateway_name]['value']);
136
+			$this->setField('invoice_num', wp_generate_password(12, false)); //$billing_info['_reg-page-billing-invoice-'.$this->_gateway_name]['value']);
137 137
 			//tell AIM that any duplicates sent in the next 5 minutes are to be ignored
138
-            $this->setField('duplicate_window', 5 * MINUTE_IN_SECONDS );
138
+            $this->setField('duplicate_window', 5 * MINUTE_IN_SECONDS);
139 139
 
140 140
 
141 141
 			if ($this->_test_transactions) {
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 			//Capture response
146 146
 			$this->type = "AUTH_CAPTURE";
147 147
 			$response = $this->_sendRequest($payment);
148
-			if (!empty($response)){
148
+			if ( ! empty($response)) {
149 149
 				if ($this->_debug_mode) {
150 150
 					$txn_id = $response->invoice_number;
151 151
 				} else {
@@ -154,15 +154,15 @@  discard block
 block discarded – undo
154 154
 				$payment_status = $response->approved ? $this->_pay_model->approved_status() : $this->_pay_model->declined_status();
155 155
 				$payment->set_status($payment_status);
156 156
 				//make sure we interpret the AMT as a float, not an international string (where periods are thousand seperators)
157
-				$payment->set_amount( floatval( $response->amount ) );
158
-				$payment->set_gateway_response(sprintf("%s (code: %s)",$response->response_reason_text,$response->response_reason_code));
159
-				$payment->set_txn_id_chq_nmbr( $txn_id );
157
+				$payment->set_amount(floatval($response->amount));
158
+				$payment->set_gateway_response(sprintf("%s (code: %s)", $response->response_reason_text, $response->response_reason_code));
159
+				$payment->set_txn_id_chq_nmbr($txn_id);
160 160
 				$payment->set_extra_accntng($primary_registrant->reg_code());
161
-				$payment->set_details(print_r($response,true));
161
+				$payment->set_details(print_r($response, true));
162 162
 			} else {
163 163
 				$payment->set_status($this->_pay_model->failed_status());
164 164
 				$payment->set_gateway_response(__("There was no response from Authorize.net", 'event_espresso'));
165
-				$payment->set_details(print_r($response,true));
165
+				$payment->set_details(print_r($response, true));
166 166
 			}
167 167
 		return $payment;
168 168
 	}
@@ -213,22 +213,22 @@  discard block
 block discarded – undo
213 213
 		$this->_x_post_fields['tran_key'] = $this->_transaction_key;
214 214
 		$x_keys = array();
215 215
 		foreach ($this->_x_post_fields as $key => $value) {
216
-			$x_keys[] = "x_$key=" . urlencode($value);
216
+			$x_keys[] = "x_$key=".urlencode($value);
217 217
 		}
218 218
 		// Add line items
219 219
 		foreach ($this->_additional_line_items as $key => $value) {
220
-			$x_keys[] =  "x_line_item=" . urlencode($value);
220
+			$x_keys[] = "x_line_item=".urlencode($value);
221 221
 		}
222 222
 		$this->_log_clean_request($x_keys, $payment);
223 223
 		$post_url = ($this->_debug_mode ? self::SANDBOX_URL : self::LIVE_URL);
224 224
 		$curl_request = curl_init($post_url);
225
-		curl_setopt($curl_request, CURLOPT_POSTFIELDS, implode("&",$x_keys));
225
+		curl_setopt($curl_request, CURLOPT_POSTFIELDS, implode("&", $x_keys));
226 226
 		curl_setopt($curl_request, CURLOPT_HEADER, 0);
227 227
 		curl_setopt($curl_request, CURLOPT_TIMEOUT, 45);
228 228
 		curl_setopt($curl_request, CURLOPT_RETURNTRANSFER, 1);
229 229
 		curl_setopt($curl_request, CURLOPT_SSL_VERIFYHOST, 2);
230 230
 		if ($this->VERIFY_PEER) {
231
-			curl_setopt($curl_request, CURLOPT_CAINFO, dirname(dirname(__FILE__)) . '/ssl/cert.pem');
231
+			curl_setopt($curl_request, CURLOPT_CAINFO, dirname(dirname(__FILE__)).'/ssl/cert.pem');
232 232
 		} else {
233 233
 			curl_setopt($curl_request, CURLOPT_SSL_VERIFYPEER, false);
234 234
 		}
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
 		$response = curl_exec($curl_request);
241 241
 
242 242
 		curl_close($curl_request);
243
-		$response_obj =  new EE_AuthorizeNetAIM_Response($response);
243
+		$response_obj = new EE_AuthorizeNetAIM_Response($response);
244 244
 
245 245
 		return $this->_log_and_clean_response($response_obj, $payment);
246 246
 	}
@@ -249,18 +249,18 @@  discard block
 block discarded – undo
249 249
 	 * @param array $request_array
250 250
 	 * @param EEI_Payment $payment
251 251
 	 */
252
-	private function _log_clean_request($request_array,$payment){
253
-		$keys_to_filter_out = array( 'x_card_num', 'x_card_code', 'x_exp_date' );
254
-		foreach($request_array as $index => $keyvaltogether ) {
255
-			foreach( $keys_to_filter_out as $key ) {
256
-				if( strpos( $keyvaltogether, $key ) === 0 ){
252
+	private function _log_clean_request($request_array, $payment) {
253
+		$keys_to_filter_out = array('x_card_num', 'x_card_code', 'x_exp_date');
254
+		foreach ($request_array as $index => $keyvaltogether) {
255
+			foreach ($keys_to_filter_out as $key) {
256
+				if (strpos($keyvaltogether, $key) === 0) {
257 257
 					//found it at the first character
258 258
 					//so its one of them
259
-					unset( $request_array[ $index ] );
259
+					unset($request_array[$index]);
260 260
 				}
261 261
 			}
262 262
 		}
263
-		$this->log(array('AIM Request sent:'=>$request_array),$payment);
263
+		$this->log(array('AIM Request sent:'=>$request_array), $payment);
264 264
 	}
265 265
 
266 266
 	/**
@@ -268,9 +268,9 @@  discard block
 block discarded – undo
268 268
 	 * @param EE_AuthorizeNetAIM_Response $response_obj
269 269
 	 * @param EE_Payment $payment
270 270
 	 */
271
-	private function _log_and_clean_response($response_obj,$payment){
271
+	private function _log_and_clean_response($response_obj, $payment) {
272 272
 		$response_obj->account_number = '';
273
-		$this->log(array('AIM Response received:'=>$response_obj),$payment);
273
+		$this->log(array('AIM Response received:'=>$response_obj), $payment);
274 274
 		return $response_obj;
275 275
 	}
276 276
 
@@ -366,7 +366,7 @@  discard block
 block discarded – undo
366 366
 			// Split Array
367 367
 			$this->response = $response;
368 368
 			if ($encap_char) {
369
-				$this->_response_array = explode($encap_char . $delimiter . $encap_char, substr($response, 1, -1));
369
+				$this->_response_array = explode($encap_char.$delimiter.$encap_char, substr($response, 1, -1));
370 370
 			} else {
371 371
 				$this->_response_array = explode($delimiter, $response);
372 372
 			}
@@ -436,7 +436,7 @@  discard block
 block discarded – undo
436 436
 			$this->held = ($this->response_code == self::HELD);
437 437
 
438 438
 			if ($this->error || $this->declined || $this->held) {
439
-				$this->error_message = '<p><strong class="credit_card_failure">Attention: your transaction was declined for the following reason(s):</strong><br />' . $this->response_reason_text . '<br /><span class="response_code">Response Code: ' . $this->response_code . '<br /></span><span class="response_subcode">Response Subcode: ' . $this->response_subcode . '</span></p><p>To try again, <a href="#payment_options">please click here</a>.</p> ';
439
+				$this->error_message = '<p><strong class="credit_card_failure">Attention: your transaction was declined for the following reason(s):</strong><br />'.$this->response_reason_text.'<br /><span class="response_code">Response Code: '.$this->response_code.'<br /></span><span class="response_subcode">Response Subcode: '.$this->response_subcode.'</span></p><p>To try again, <a href="#payment_options">please click here</a>.</p> ';
440 440
 
441 441
 
442 442
 				/* $this->error_message = "AuthorizeNet Error:
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,7 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if (!defined('EVENT_ESPRESSO_VERSION'))
3
+if (!defined('EVENT_ESPRESSO_VERSION')) {
4 4
 	exit('No direct script access allowed');
5
+}
5 6
 
6 7
 /**
7 8
  * Event Espresso
@@ -107,7 +108,7 @@  discard block
 block discarded – undo
107 108
 				foreach($total_line_item->tax_descendants() as $tax_line_item){
108 109
 					$this->addLineItem($item_num++, $tax_line_item->name(), $tax_line_item->desc(), 1, $tax_line_item->total(), 'N');
109 110
 				}
110
-			}else{//partial payment
111
+			} else{//partial payment
111 112
 				$order_description = sprintf(__("Payment of %s for %s", "event_espresso"),$payment->amount(),$primary_registrant->reg_code());
112 113
 			}
113 114
 
Please login to merge, or discard this patch.
caffeinated/payment_methods/Paypal_Pro/EEG_Paypal_Pro.gateway.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -392,7 +392,7 @@
 block discarded – undo
392 392
 
393 393
 
394 394
 	/**
395
-	 * @param $Request
395
+	 * @param string $Request
396 396
 	 * @return mixed
397 397
 	 */
398 398
 	private function _CURLRequest($Request) {
Please login to merge, or discard this patch.
Spacing   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if (!defined('EVENT_ESPRESSO_VERSION'))
3
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
4 4
 	exit('No direct script access allowed');
5 5
 
6 6
 /**
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
  *
26 26
  * ------------------------------------------------------------------------
27 27
  */
28
-class EEG_Paypal_Pro extends EE_Onsite_Gateway{
28
+class EEG_Paypal_Pro extends EE_Onsite_Gateway {
29 29
 	/**
30 30
 	 *
31 31
 	 * @var $_paypal_api_username string
@@ -88,21 +88,21 @@  discard block
 block discarded – undo
88 88
 	 * } @see parent::do_direct_payment for more info
89 89
 	 * @return \EE_Payment|\EEI_Payment
90 90
 	 */
91
-	public function do_direct_payment($payment,$billing_info = null){
91
+	public function do_direct_payment($payment, $billing_info = null) {
92 92
 		$transaction = $payment->transaction();
93 93
 		$primary_registrant = $transaction->primary_registration();
94
-		$order_description  = sprintf(__("'Event Registrations from %s", "event_espresso"),get_bloginfo('name'));
94
+		$order_description  = sprintf(__("'Event Registrations from %s", "event_espresso"), get_bloginfo('name'));
95 95
 		//charge for the full amount. Show itemized list
96
-		if( $this->_can_easily_itemize_transaction_for( $payment ) ){
96
+		if ($this->_can_easily_itemize_transaction_for($payment)) {
97 97
 			$item_num = 1;
98 98
 			$total_line_item = $transaction->total_line_item();
99 99
 			$order_items = array();
100 100
 			foreach ($total_line_item->get_items() as $line_item) {
101 101
 				$item = array(
102 102
 						// Item Name.  127 char max.
103
-						'l_name' => substr($line_item->name(),0,127),
103
+						'l_name' => substr($line_item->name(), 0, 127),
104 104
 						// Item description.  127 char max.
105
-						'l_desc' => substr($line_item->desc(),0,127),
105
+						'l_desc' => substr($line_item->desc(), 0, 127),
106 106
 						// Cost of individual item.
107 107
 						'l_amt' => $line_item->unit_price(),
108 108
 						// Item Number.  127 char max.
@@ -123,14 +123,14 @@  discard block
 block discarded – undo
123 123
 			}
124 124
 			$item_amount = $total_line_item->get_items_total();
125 125
 			$tax_amount = $total_line_item->get_total_tax();
126
-		}else{
126
+		} else {
127 127
 			$order_items = array();
128 128
 			$item_amount = $payment->amount();
129
-			$single_item_desc = sprintf(__("Partial payment of %s for %s", "event_espresso"),$payment->amount(),$primary_registrant->reg_code());
129
+			$single_item_desc = sprintf(__("Partial payment of %s for %s", "event_espresso"), $payment->amount(), $primary_registrant->reg_code());
130 130
 			$tax_amount = 0;
131
-			array_push($order_items,array(
131
+			array_push($order_items, array(
132 132
 				// Item Name.  127 char max.
133
-				'l_name' => sprintf(__("Partial payment for registration: %s", 'event_espresso'),$primary_registrant->reg_code()),
133
+				'l_name' => sprintf(__("Partial payment for registration: %s", 'event_espresso'), $primary_registrant->reg_code()),
134 134
 				// Item description.  127 char max.
135 135
 				'l_desc' => $single_item_desc,
136 136
 				// Cost of individual item.
@@ -177,11 +177,11 @@  discard block
 block discarded – undo
177 177
 			// Payer's salutation.  20 char max.
178 178
 			'salutation' => '',
179 179
 			// Payer's first name.  25 char max.
180
-			'firstname' => substr($billing_info['first_name'],0,25),
180
+			'firstname' => substr($billing_info['first_name'], 0, 25),
181 181
 			// Payer's middle name.  25 char max.
182 182
 			'middlename' => '',
183 183
 			// Payer's last name.  25 char max.
184
-			'lastname' => substr($billing_info['last_name'],0,25),
184
+			'lastname' => substr($billing_info['last_name'], 0, 25),
185 185
 			// Payer's suffix.  12 char max.
186 186
 			'suffix' => ''
187 187
 		);
@@ -194,13 +194,13 @@  discard block
 block discarded – undo
194 194
 			// Required.  Name of City.
195 195
 			'city' => $billing_info['city'],
196 196
 			// Required. Name of State or Province.
197
-			'state' => substr( $billing_info['state'], 0, 40 ),
197
+			'state' => substr($billing_info['state'], 0, 40),
198 198
 			// Required.  Country code.
199 199
 			'countrycode' => $billing_info['country'],
200 200
 			// Required.  Postal code of payer.
201 201
 			'zip' => $billing_info['zip'],
202 202
 			// Phone Number of payer.  20 char max.
203
-			'shiptophonenum' => substr($billing_info['phone'],0,20)
203
+			'shiptophonenum' => substr($billing_info['phone'], 0, 20)
204 204
 		);
205 205
 
206 206
 
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
 			// Required.  Three-letter currency code.  Default is USD.
211 211
 			'currencycode' => $payment->currency_code(),
212 212
 			// Required if you include itemized cart details. (L_AMTn, etc.)  Subtotal of items not including S&H, or tax.
213
-			'itemamt' => $this->format_currency($item_amount),//
213
+			'itemamt' => $this->format_currency($item_amount), //
214 214
 			// Total shipping costs for the order.  If you specify shippingamt, you must also specify itemamt.
215 215
 			'shippingamt' => '',
216 216
 			// Total handling costs for the order.  If you specify handlingamt, you must also specify itemamt.
@@ -222,10 +222,10 @@  discard block
 block discarded – undo
222 222
 			// Free-form field for your own use.  256 char max.
223 223
 			'custom' => $primary_registrant ? $primary_registrant->ID() : '',
224 224
 			// Your own invoice or tracking number
225
-			'invnum' => wp_generate_password(12,false),//$transaction->ID(),
225
+			'invnum' => wp_generate_password(12, false), //$transaction->ID(),
226 226
 			// URL for receiving Instant Payment Notifications.  This overrides what your profile is set to use.
227 227
 			'notifyurl' => '',
228
-			'buttonsource' => 'EventEspresso_SP',//EE will blow up if you change this
228
+			'buttonsource' => 'EventEspresso_SP', //EE will blow up if you change this
229 229
 		);
230 230
 		// Wrap all data arrays into a single, "master" array which will be passed into the class function.
231 231
 		$PayPalRequestData = array(
@@ -238,32 +238,32 @@  discard block
 block discarded – undo
238 238
 				'OrderItems' => $order_items,
239 239
 		);
240 240
 		$this->_log_clean_request($PayPalRequestData, $payment);
241
-		try{
241
+		try {
242 242
 			$PayPalResult = $this->prep_and_curl_request($PayPalRequestData);
243 243
 			//remove PCI-sensitive data so it doesn't get stored
244
-			$PayPalResult = $this->_log_clean_response($PayPalResult,$payment);
244
+			$PayPalResult = $this->_log_clean_response($PayPalResult, $payment);
245 245
 
246 246
 			$message = isset($PayPalResult['L_LONGMESSAGE0']) ? $PayPalResult['L_LONGMESSAGE0'] : $PayPalResult['ACK'];
247
-			if( empty($PayPalResult[ 'RAWRESPONSE' ] ) ) {
248
-				$payment->set_status( $this->_pay_model->failed_status() ) ;
249
-				$payment->set_gateway_response( __( 'No response received from Paypal Pro', 'event_espresso' ) );
247
+			if (empty($PayPalResult['RAWRESPONSE'])) {
248
+				$payment->set_status($this->_pay_model->failed_status());
249
+				$payment->set_gateway_response(__('No response received from Paypal Pro', 'event_espresso'));
250 250
 				$payment->set_details($PayPalResult);
251
-			}else{
252
-				if($this->_APICallSuccessful($PayPalResult)){
251
+			} else {
252
+				if ($this->_APICallSuccessful($PayPalResult)) {
253 253
 					$payment->set_status($this->_pay_model->approved_status());
254
-				}else{
254
+				} else {
255 255
 					$payment->set_status($this->_pay_model->declined_status());
256 256
 				}
257 257
 				//make sure we interpret the AMT as a float, not an international string (where periods are thousand separators)
258
-				$payment->set_amount(isset($PayPalResult['AMT']) ? floatval( $PayPalResult['AMT'] ) : 0);
258
+				$payment->set_amount(isset($PayPalResult['AMT']) ? floatval($PayPalResult['AMT']) : 0);
259 259
 				$payment->set_gateway_response($message);
260
-				$payment->set_txn_id_chq_nmbr(isset( $PayPalResult['TRANSACTIONID'] )? $PayPalResult['TRANSACTIONID'] : null);
260
+				$payment->set_txn_id_chq_nmbr(isset($PayPalResult['TRANSACTIONID']) ? $PayPalResult['TRANSACTIONID'] : null);
261 261
 
262 262
 				$primary_registration_code = $primary_registrant instanceof EE_Registration ? $primary_registrant->reg_code() : '';
263 263
 				$payment->set_extra_accntng($primary_registration_code);
264 264
 				$payment->set_details($PayPalResult);
265 265
 			}
266
-		}catch(Exception $e){
266
+		} catch (Exception $e) {
267 267
 			$payment->set_status($this->_pay_model->failed_status());
268 268
 			$payment->set_gateway_response($e->getMessage());
269 269
 		}
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
 	 * @param EEI_Payment $payment
281 281
 	 * @return array
282 282
 	 */
283
-	private function _log_clean_request($request,$payment){
283
+	private function _log_clean_request($request, $payment) {
284 284
 		$cleaned_request_data = $request;
285 285
 		unset($cleaned_request_data['CCDetails']['acct']);
286 286
 		unset($cleaned_request_data['CCDetails']['cvv2']);
@@ -295,13 +295,13 @@  discard block
 block discarded – undo
295 295
 	 * @param EEI_Payment $payment
296 296
 	 * @return array cleaned
297 297
 	 */
298
-	private function _log_clean_response($response,$payment){
298
+	private function _log_clean_response($response, $payment) {
299 299
 		unset($response['REQUESTDATA']['CREDITCARDTYPE']);
300 300
 		unset($response['REQUESTDATA']['ACCT']);
301 301
 		unset($response['REQUESTDATA']['EXPDATE']);
302 302
 		unset($response['REQUESTDATA']['CVV2']);
303 303
 		unset($response['RAWREQUEST']);
304
-		$this->log(array('Paypal Response'=>$response),$payment);
304
+		$this->log(array('Paypal Response'=>$response), $payment);
305 305
 		return $response;
306 306
 	}
307 307
 
@@ -326,32 +326,32 @@  discard block
 block discarded – undo
326 326
 		// DP Fields
327 327
 		$DPFields = isset($DataArray['DPFields']) ? $DataArray['DPFields'] : array();
328 328
 		foreach ($DPFields as $DPFieldsVar => $DPFieldsVal)
329
-			$DPFieldsNVP .= '&' . strtoupper($DPFieldsVar) . '=' . urlencode($DPFieldsVal);
329
+			$DPFieldsNVP .= '&'.strtoupper($DPFieldsVar).'='.urlencode($DPFieldsVal);
330 330
 
331 331
 		// CC Details Fields
332 332
 		$CCDetails = isset($DataArray['CCDetails']) ? $DataArray['CCDetails'] : array();
333 333
 		foreach ($CCDetails as $CCDetailsVar => $CCDetailsVal)
334
-			$CCDetailsNVP .= '&' . strtoupper($CCDetailsVar) . '=' . urlencode($CCDetailsVal);
334
+			$CCDetailsNVP .= '&'.strtoupper($CCDetailsVar).'='.urlencode($CCDetailsVal);
335 335
 
336 336
 		// PayerInfo Type Fields
337 337
 		$PayerInfo = isset($DataArray['PayerInfo']) ? $DataArray['PayerInfo'] : array();
338 338
 		foreach ($PayerInfo as $PayerInfoVar => $PayerInfoVal)
339
-			$PayerInfoNVP .= '&' . strtoupper($PayerInfoVar) . '=' . urlencode($PayerInfoVal);
339
+			$PayerInfoNVP .= '&'.strtoupper($PayerInfoVar).'='.urlencode($PayerInfoVal);
340 340
 
341 341
 		// Payer Name Fields
342 342
 		$PayerName = isset($DataArray['PayerName']) ? $DataArray['PayerName'] : array();
343 343
 		foreach ($PayerName as $PayerNameVar => $PayerNameVal)
344
-			$PayerNameNVP .= '&' . strtoupper($PayerNameVar) . '=' . urlencode($PayerNameVal);
344
+			$PayerNameNVP .= '&'.strtoupper($PayerNameVar).'='.urlencode($PayerNameVal);
345 345
 
346 346
 		// Address Fields (Billing)
347 347
 		$BillingAddress = isset($DataArray['BillingAddress']) ? $DataArray['BillingAddress'] : array();
348 348
 		foreach ($BillingAddress as $BillingAddressVar => $BillingAddressVal)
349
-			$BillingAddressNVP .= '&' . strtoupper($BillingAddressVar) . '=' . urlencode($BillingAddressVal);
349
+			$BillingAddressNVP .= '&'.strtoupper($BillingAddressVar).'='.urlencode($BillingAddressVal);
350 350
 
351 351
 		// Payment Details Type Fields
352 352
 		$PaymentDetails = isset($DataArray['PaymentDetails']) ? $DataArray['PaymentDetails'] : array();
353 353
 		foreach ($PaymentDetails as $PaymentDetailsVar => $PaymentDetailsVal)
354
-			$PaymentDetailsNVP .= '&' . strtoupper($PaymentDetailsVar) . '=' . urlencode($PaymentDetailsVal);
354
+			$PaymentDetailsNVP .= '&'.strtoupper($PaymentDetailsVar).'='.urlencode($PaymentDetailsVal);
355 355
 
356 356
 		// Payment Details Item Type Fields
357 357
 		$OrderItems = isset($DataArray['OrderItems']) ? $DataArray['OrderItems'] : array();
@@ -359,22 +359,22 @@  discard block
 block discarded – undo
359 359
 		foreach ($OrderItems as $OrderItemsVar => $OrderItemsVal) {
360 360
 			$CurrentItem = $OrderItems[$OrderItemsVar];
361 361
 			foreach ($CurrentItem as $CurrentItemVar => $CurrentItemVal)
362
-				$OrderItemsNVP .= '&' . strtoupper($CurrentItemVar) . $n . '=' . urlencode($CurrentItemVal);
362
+				$OrderItemsNVP .= '&'.strtoupper($CurrentItemVar).$n.'='.urlencode($CurrentItemVal);
363 363
 			$n++;
364 364
 		}
365 365
 
366 366
 		// Ship To Address Fields
367 367
 		$ShippingAddress = isset($DataArray['ShippingAddress']) ? $DataArray['ShippingAddress'] : array();
368 368
 		foreach ($ShippingAddress as $ShippingAddressVar => $ShippingAddressVal)
369
-			$ShippingAddressNVP .= '&' . strtoupper($ShippingAddressVar) . '=' . urlencode($ShippingAddressVal);
369
+			$ShippingAddressNVP .= '&'.strtoupper($ShippingAddressVar).'='.urlencode($ShippingAddressVal);
370 370
 
371 371
 		// 3D Secure Fields
372 372
 		$Secure3D = isset($DataArray['Secure3D']) ? $DataArray['Secure3D'] : array();
373 373
 		foreach ($Secure3D as $Secure3DVar => $Secure3DVal)
374
-			$Secure3DNVP .= '&' . strtoupper($Secure3DVar) . '=' . urlencode($Secure3DVal);
374
+			$Secure3DNVP .= '&'.strtoupper($Secure3DVar).'='.urlencode($Secure3DVal);
375 375
 
376 376
 		// Now that we have each chunk we need to go ahead and append them all together for our entire NVP string
377
-		$NVPRequest = 'USER=' . $this->_username . '&PWD=' . $this->_password . '&VERSION=64.0' . '&SIGNATURE=' . $this->_signature . $DPFieldsNVP . $CCDetailsNVP . $PayerInfoNVP . $PayerNameNVP . $BillingAddressNVP . $PaymentDetailsNVP . $OrderItemsNVP . $ShippingAddressNVP . $Secure3DNVP;
377
+		$NVPRequest = 'USER='.$this->_username.'&PWD='.$this->_password.'&VERSION=64.0'.'&SIGNATURE='.$this->_signature.$DPFieldsNVP.$CCDetailsNVP.$PayerInfoNVP.$PayerNameNVP.$BillingAddressNVP.$PaymentDetailsNVP.$OrderItemsNVP.$ShippingAddressNVP.$Secure3DNVP;
378 378
 		$NVPResponse = $this->_CURLRequest($NVPRequest);
379 379
 		$NVPRequestArray = $this->_NVPToArray($NVPRequest);
380 380
 		$NVPResponseArray = $this->_NVPToArray($NVPResponse);
@@ -398,7 +398,7 @@  discard block
 block discarded – undo
398 398
 	private function _CURLRequest($Request) {
399 399
 		$EndPointURL = $this->_debug_mode ? 'https://api-3t.sandbox.paypal.com/nvp' : 'https://api-3t.paypal.com/nvp';
400 400
 		$curl = curl_init();
401
-		curl_setopt($curl, CURLOPT_VERBOSE, apply_filters('FHEE__EEG_Paypal_Pro__CurlRequest__CURLOPT_VERBOSE', TRUE ) );
401
+		curl_setopt($curl, CURLOPT_VERBOSE, apply_filters('FHEE__EEG_Paypal_Pro__CurlRequest__CURLOPT_VERBOSE', TRUE));
402 402
 		curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
403 403
 		curl_setopt($curl, CURLOPT_TIMEOUT, 60);
404 404
 		curl_setopt($curl, CURLOPT_URL, $EndPointURL);
@@ -447,9 +447,9 @@  discard block
 block discarded – undo
447 447
 	private function _APICallSuccessful($PayPalResult) {
448 448
 		$approved = false;
449 449
 		// check main response message from PayPal
450
-		if (isset($PayPalResult['ACK']) && !empty($PayPalResult['ACK'])) {
450
+		if (isset($PayPalResult['ACK']) && ! empty($PayPalResult['ACK'])) {
451 451
 			$ack = strtoupper($PayPalResult['ACK']);
452
-			$approved = ( $ack == 'SUCCESS' || $ack == 'SUCCESSWITHWARNING' || $ack == 'PARTIALSUCCESS' ) ? true : false;
452
+			$approved = ($ack == 'SUCCESS' || $ack == 'SUCCESSWITHWARNING' || $ack == 'PARTIALSUCCESS') ? true : false;
453 453
 		}
454 454
 
455 455
 		return $approved;
@@ -465,11 +465,11 @@  discard block
 block discarded – undo
465 465
 
466 466
 		$Errors = array();
467 467
 		$n = 0;
468
-		while (isset($DataArray['L_ERRORCODE' . $n . ''])) {
469
-			$LErrorCode = isset($DataArray['L_ERRORCODE' . $n . '']) ? $DataArray['L_ERRORCODE' . $n . ''] : '';
470
-			$LShortMessage = isset($DataArray['L_SHORTMESSAGE' . $n . '']) ? $DataArray['L_SHORTMESSAGE' . $n . ''] : '';
471
-			$LLongMessage = isset($DataArray['L_LONGMESSAGE' . $n . '']) ? $DataArray['L_LONGMESSAGE' . $n . ''] : '';
472
-			$LSeverityCode = isset($DataArray['L_SEVERITYCODE' . $n . '']) ? $DataArray['L_SEVERITYCODE' . $n . ''] : '';
468
+		while (isset($DataArray['L_ERRORCODE'.$n.''])) {
469
+			$LErrorCode = isset($DataArray['L_ERRORCODE'.$n.'']) ? $DataArray['L_ERRORCODE'.$n.''] : '';
470
+			$LShortMessage = isset($DataArray['L_SHORTMESSAGE'.$n.'']) ? $DataArray['L_SHORTMESSAGE'.$n.''] : '';
471
+			$LLongMessage = isset($DataArray['L_LONGMESSAGE'.$n.'']) ? $DataArray['L_LONGMESSAGE'.$n.''] : '';
472
+			$LSeverityCode = isset($DataArray['L_SEVERITYCODE'.$n.'']) ? $DataArray['L_SEVERITYCODE'.$n.''] : '';
473 473
 
474 474
 			$CurrentItem = array(
475 475
 					'L_ERRORCODE' => $LErrorCode,
@@ -509,7 +509,7 @@  discard block
 block discarded – undo
509 509
 				elseif ($CurrentErrorVar == 'L_SEVERITYCODE')
510 510
 					$CurrentVarName = 'Severity Code';
511 511
 
512
-				$error .= '<br />' . $CurrentVarName . ': ' . $CurrentErrorVal;
512
+				$error .= '<br />'.$CurrentVarName.': '.$CurrentErrorVal;
513 513
 			}
514 514
 		}
515 515
 		return $error;
Please login to merge, or discard this patch.
Braces   +42 added lines, -31 removed lines patch added patch discarded remove patch
@@ -1,7 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if (!defined('EVENT_ESPRESSO_VERSION'))
3
+if (!defined('EVENT_ESPRESSO_VERSION')) {
4 4
 	exit('No direct script access allowed');
5
+}
5 6
 
6 7
 /**
7 8
  * Event Espresso
@@ -123,7 +124,7 @@  discard block
 block discarded – undo
123 124
 			}
124 125
 			$item_amount = $total_line_item->get_items_total();
125 126
 			$tax_amount = $total_line_item->get_total_tax();
126
-		}else{
127
+		} else{
127 128
 			$order_items = array();
128 129
 			$item_amount = $payment->amount();
129 130
 			$single_item_desc = sprintf(__("Partial payment of %s for %s", "event_espresso"),$payment->amount(),$primary_registrant->reg_code());
@@ -248,10 +249,10 @@  discard block
 block discarded – undo
248 249
 				$payment->set_status( $this->_pay_model->failed_status() ) ;
249 250
 				$payment->set_gateway_response( __( 'No response received from Paypal Pro', 'event_espresso' ) );
250 251
 				$payment->set_details($PayPalResult);
251
-			}else{
252
+			} else{
252 253
 				if($this->_APICallSuccessful($PayPalResult)){
253 254
 					$payment->set_status($this->_pay_model->approved_status());
254
-				}else{
255
+				} else{
255 256
 					$payment->set_status($this->_pay_model->declined_status());
256 257
 				}
257 258
 				//make sure we interpret the AMT as a float, not an international string (where periods are thousand separators)
@@ -263,7 +264,7 @@  discard block
 block discarded – undo
263 264
 				$payment->set_extra_accntng($primary_registration_code);
264 265
 				$payment->set_details($PayPalResult);
265 266
 			}
266
-		}catch(Exception $e){
267
+		} catch(Exception $e){
267 268
 			$payment->set_status($this->_pay_model->failed_status());
268 269
 			$payment->set_gateway_response($e->getMessage());
269 270
 		}
@@ -325,53 +326,62 @@  discard block
 block discarded – undo
325 326
 
326 327
 		// DP Fields
327 328
 		$DPFields = isset($DataArray['DPFields']) ? $DataArray['DPFields'] : array();
328
-		foreach ($DPFields as $DPFieldsVar => $DPFieldsVal)
329
-			$DPFieldsNVP .= '&' . strtoupper($DPFieldsVar) . '=' . urlencode($DPFieldsVal);
329
+		foreach ($DPFields as $DPFieldsVar => $DPFieldsVal) {
330
+					$DPFieldsNVP .= '&' . strtoupper($DPFieldsVar) . '=' . urlencode($DPFieldsVal);
331
+		}
330 332
 
331 333
 		// CC Details Fields
332 334
 		$CCDetails = isset($DataArray['CCDetails']) ? $DataArray['CCDetails'] : array();
333
-		foreach ($CCDetails as $CCDetailsVar => $CCDetailsVal)
334
-			$CCDetailsNVP .= '&' . strtoupper($CCDetailsVar) . '=' . urlencode($CCDetailsVal);
335
+		foreach ($CCDetails as $CCDetailsVar => $CCDetailsVal) {
336
+					$CCDetailsNVP .= '&' . strtoupper($CCDetailsVar) . '=' . urlencode($CCDetailsVal);
337
+		}
335 338
 
336 339
 		// PayerInfo Type Fields
337 340
 		$PayerInfo = isset($DataArray['PayerInfo']) ? $DataArray['PayerInfo'] : array();
338
-		foreach ($PayerInfo as $PayerInfoVar => $PayerInfoVal)
339
-			$PayerInfoNVP .= '&' . strtoupper($PayerInfoVar) . '=' . urlencode($PayerInfoVal);
341
+		foreach ($PayerInfo as $PayerInfoVar => $PayerInfoVal) {
342
+					$PayerInfoNVP .= '&' . strtoupper($PayerInfoVar) . '=' . urlencode($PayerInfoVal);
343
+		}
340 344
 
341 345
 		// Payer Name Fields
342 346
 		$PayerName = isset($DataArray['PayerName']) ? $DataArray['PayerName'] : array();
343
-		foreach ($PayerName as $PayerNameVar => $PayerNameVal)
344
-			$PayerNameNVP .= '&' . strtoupper($PayerNameVar) . '=' . urlencode($PayerNameVal);
347
+		foreach ($PayerName as $PayerNameVar => $PayerNameVal) {
348
+					$PayerNameNVP .= '&' . strtoupper($PayerNameVar) . '=' . urlencode($PayerNameVal);
349
+		}
345 350
 
346 351
 		// Address Fields (Billing)
347 352
 		$BillingAddress = isset($DataArray['BillingAddress']) ? $DataArray['BillingAddress'] : array();
348
-		foreach ($BillingAddress as $BillingAddressVar => $BillingAddressVal)
349
-			$BillingAddressNVP .= '&' . strtoupper($BillingAddressVar) . '=' . urlencode($BillingAddressVal);
353
+		foreach ($BillingAddress as $BillingAddressVar => $BillingAddressVal) {
354
+					$BillingAddressNVP .= '&' . strtoupper($BillingAddressVar) . '=' . urlencode($BillingAddressVal);
355
+		}
350 356
 
351 357
 		// Payment Details Type Fields
352 358
 		$PaymentDetails = isset($DataArray['PaymentDetails']) ? $DataArray['PaymentDetails'] : array();
353
-		foreach ($PaymentDetails as $PaymentDetailsVar => $PaymentDetailsVal)
354
-			$PaymentDetailsNVP .= '&' . strtoupper($PaymentDetailsVar) . '=' . urlencode($PaymentDetailsVal);
359
+		foreach ($PaymentDetails as $PaymentDetailsVar => $PaymentDetailsVal) {
360
+					$PaymentDetailsNVP .= '&' . strtoupper($PaymentDetailsVar) . '=' . urlencode($PaymentDetailsVal);
361
+		}
355 362
 
356 363
 		// Payment Details Item Type Fields
357 364
 		$OrderItems = isset($DataArray['OrderItems']) ? $DataArray['OrderItems'] : array();
358 365
 		$n = 0;
359 366
 		foreach ($OrderItems as $OrderItemsVar => $OrderItemsVal) {
360 367
 			$CurrentItem = $OrderItems[$OrderItemsVar];
361
-			foreach ($CurrentItem as $CurrentItemVar => $CurrentItemVal)
362
-				$OrderItemsNVP .= '&' . strtoupper($CurrentItemVar) . $n . '=' . urlencode($CurrentItemVal);
368
+			foreach ($CurrentItem as $CurrentItemVar => $CurrentItemVal) {
369
+							$OrderItemsNVP .= '&' . strtoupper($CurrentItemVar) . $n . '=' . urlencode($CurrentItemVal);
370
+			}
363 371
 			$n++;
364 372
 		}
365 373
 
366 374
 		// Ship To Address Fields
367 375
 		$ShippingAddress = isset($DataArray['ShippingAddress']) ? $DataArray['ShippingAddress'] : array();
368
-		foreach ($ShippingAddress as $ShippingAddressVar => $ShippingAddressVal)
369
-			$ShippingAddressNVP .= '&' . strtoupper($ShippingAddressVar) . '=' . urlencode($ShippingAddressVal);
376
+		foreach ($ShippingAddress as $ShippingAddressVar => $ShippingAddressVal) {
377
+					$ShippingAddressNVP .= '&' . strtoupper($ShippingAddressVar) . '=' . urlencode($ShippingAddressVal);
378
+		}
370 379
 
371 380
 		// 3D Secure Fields
372 381
 		$Secure3D = isset($DataArray['Secure3D']) ? $DataArray['Secure3D'] : array();
373
-		foreach ($Secure3D as $Secure3DVar => $Secure3DVal)
374
-			$Secure3DNVP .= '&' . strtoupper($Secure3DVar) . '=' . urlencode($Secure3DVal);
382
+		foreach ($Secure3D as $Secure3DVar => $Secure3DVal) {
383
+					$Secure3DNVP .= '&' . strtoupper($Secure3DVar) . '=' . urlencode($Secure3DVal);
384
+		}
375 385
 
376 386
 		// Now that we have each chunk we need to go ahead and append them all together for our entire NVP string
377 387
 		$NVPRequest = 'USER=' . $this->_username . '&PWD=' . $this->_password . '&VERSION=64.0' . '&SIGNATURE=' . $this->_signature . $DPFieldsNVP . $CCDetailsNVP . $PayerInfoNVP . $PayerNameNVP . $BillingAddressNVP . $PaymentDetailsNVP . $OrderItemsNVP . $ShippingAddressNVP . $Secure3DNVP;
@@ -500,14 +510,15 @@  discard block
 block discarded – undo
500 510
 			$CurrentError = $Errors[$ErrorVar];
501 511
 			foreach ($CurrentError as $CurrentErrorVar => $CurrentErrorVal) {
502 512
 				$CurrentVarName = '';
503
-				if ($CurrentErrorVar == 'L_ERRORCODE')
504
-					$CurrentVarName = 'Error Code';
505
-				elseif ($CurrentErrorVar == 'L_SHORTMESSAGE')
506
-					$CurrentVarName = 'Short Message';
507
-				elseif ($CurrentErrorVar == 'L_LONGMESSAGE')
508
-					$CurrentVarName = 'Long Message';
509
-				elseif ($CurrentErrorVar == 'L_SEVERITYCODE')
510
-					$CurrentVarName = 'Severity Code';
513
+				if ($CurrentErrorVar == 'L_ERRORCODE') {
514
+									$CurrentVarName = 'Error Code';
515
+				} elseif ($CurrentErrorVar == 'L_SHORTMESSAGE') {
516
+									$CurrentVarName = 'Short Message';
517
+				} elseif ($CurrentErrorVar == 'L_LONGMESSAGE') {
518
+									$CurrentVarName = 'Long Message';
519
+				} elseif ($CurrentErrorVar == 'L_SEVERITYCODE') {
520
+									$CurrentVarName = 'Severity Code';
521
+				}
511 522
 
512 523
 				$error .= '<br />' . $CurrentVarName . ': ' . $CurrentErrorVal;
513 524
 			}
Please login to merge, or discard this patch.
core/admin/EE_Admin_Hooks.core.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -207,7 +207,7 @@
 block discarded – undo
207 207
 
208 208
 	/**
209 209
 	 * constructor
210
-	 * @param EE_Admin_Page $admin_page the calling admin_page_object
210
+	 * @param EE_Admin_Page $adminpage the calling admin_page_object
211 211
 	 */
212 212
 	public function __construct( EE_Admin_Page $adminpage ) {
213 213
 
Please login to merge, or discard this patch.
Spacing   +106 added lines, -106 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
 /**
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
 	 * constructor
210 210
 	 * @param EE_Admin_Page $admin_page the calling admin_page_object
211 211
 	 */
212
-	public function __construct( EE_Admin_Page $adminpage ) {
212
+	public function __construct(EE_Admin_Page $adminpage) {
213 213
 
214 214
 		$this->_adminpage_obj = $adminpage;
215 215
 		$this->_req_data = array_merge($_GET, $_POST);
@@ -217,11 +217,11 @@  discard block
 block discarded – undo
217 217
 		$this->_set_hooks_properties();
218 218
 
219 219
 		//first let's verify we're on the right page
220
-		if ( !isset( $this->_req_data['page'] ) || ( isset( $this->_req_data['page'] ) && $this->_adminpage_obj->page_slug != $this->_req_data['page'] ) )
220
+		if ( ! isset($this->_req_data['page']) || (isset($this->_req_data['page']) && $this->_adminpage_obj->page_slug != $this->_req_data['page']))
221 221
 			return; //get out nothing more to be done here.
222 222
 
223 223
 		//allow for extends to modify properties
224
-		if ( method_exists( $this, '_extend_properties' ) )
224
+		if (method_exists($this, '_extend_properties'))
225 225
 			$this->_extend_properties();
226 226
 
227 227
 		$this->_set_page_object();
@@ -229,9 +229,9 @@  discard block
 block discarded – undo
229 229
 		$this->_load_custom_methods();
230 230
 		$this->_load_routed_hooks();
231 231
 
232
-		add_action( 'admin_enqueue_scripts', array($this, 'enqueue_scripts_styles' ) );
233
-		add_action( 'admin_enqueue_scripts', array($this, 'add_metaboxes'), 20 );
234
-		add_action( 'admin_enqueue_scripts', array($this, 'remove_metaboxes'), 15 );
232
+		add_action('admin_enqueue_scripts', array($this, 'enqueue_scripts_styles'));
233
+		add_action('admin_enqueue_scripts', array($this, 'add_metaboxes'), 20);
234
+		add_action('admin_enqueue_scripts', array($this, 'remove_metaboxes'), 15);
235 235
 
236 236
 		$this->_ajax_hooks();
237 237
 
@@ -272,15 +272,15 @@  discard block
 block discarded – undo
272 272
 	 */
273 273
 	public function enqueue_scripts_styles() {
274 274
 
275
-		if ( !empty( $this->_scripts_styles ) ) {
275
+		if ( ! empty($this->_scripts_styles)) {
276 276
 			//first let's do all the registrations
277
-			if ( !isset($this->_scripts_styles['registers'] ) ) {
277
+			if ( ! isset($this->_scripts_styles['registers'])) {
278 278
 				$msg[] = __('There is no "registers" index in the <code>$this->_scripts_styles</code> property.', 'event_espresso');
279
-				$msg[] = sprintf ( __('Make sure you read the phpdoc comments above the definition of the $_scripts_styles property in the <code>EE_Admin_Hooks</code> class and modify according in the %s child', 'event_espresso'), '<strong>' . $this->caller . '</strong>' );
280
-				throw new EE_Error( implode( '||', $msg ) );
279
+				$msg[] = sprintf(__('Make sure you read the phpdoc comments above the definition of the $_scripts_styles property in the <code>EE_Admin_Hooks</code> class and modify according in the %s child', 'event_espresso'), '<strong>'.$this->caller.'</strong>');
280
+				throw new EE_Error(implode('||', $msg));
281 281
 			}
282 282
 
283
-			foreach( $this->_scripts_styles['registers'] as $ref => $details ) {
283
+			foreach ($this->_scripts_styles['registers'] as $ref => $details) {
284 284
 				$defaults = array(
285 285
 					'type' => 'js',
286 286
 					'url' => '',
@@ -289,48 +289,48 @@  discard block
 block discarded – undo
289 289
 					'footer' => TRUE
290 290
 					);
291 291
 				$details = wp_parse_args($details, $defaults);
292
-				extract( $details );
292
+				extract($details);
293 293
 
294 294
 				//let's make sure that we set the 'registers' type if it's not set! We need it later to determine whhich enqueu we do
295 295
 				$this->_scripts_styles['registers'][$ref]['type'] = $type;
296 296
 
297 297
 				//let's make sure we're not missing any REQUIRED parameters
298
-				if ( empty($url) ) {
299
-					$msg[] = sprintf( __('Missing the url for the requested %s', 'event_espresso'), $type == 'js' ? 'script' : 'stylesheet' );
300
-					$msg[] = sprintf( __('Doublecheck your <code>$this->_scripts_styles</code> array in %s and make sure that there is a "url" set for the %s ref', 'event_espresso'), '<strong>' . $this->caller . '</strong>', $ref );
301
-					throw new EE_Error( implode( '||', $msg ) );
298
+				if (empty($url)) {
299
+					$msg[] = sprintf(__('Missing the url for the requested %s', 'event_espresso'), $type == 'js' ? 'script' : 'stylesheet');
300
+					$msg[] = sprintf(__('Doublecheck your <code>$this->_scripts_styles</code> array in %s and make sure that there is a "url" set for the %s ref', 'event_espresso'), '<strong>'.$this->caller.'</strong>', $ref);
301
+					throw new EE_Error(implode('||', $msg));
302 302
 				}
303 303
 				//made it here so let's do the appropriate registration
304
-				$type == 'js' ? wp_register_script( $ref, $url, $depends, $version, $footer ) : wp_register_style( $ref, $url, $depends, $version );
304
+				$type == 'js' ? wp_register_script($ref, $url, $depends, $version, $footer) : wp_register_style($ref, $url, $depends, $version);
305 305
 			}
306 306
 
307 307
 			//k now lets do the enqueues
308
-			if( !isset( $this->_scripts_styles['enqueues'] ) )
309
-				return;  //not sure if we should throw an error here or not.
310
-			foreach( $this->_scripts_styles['enqueues'] as $ref => $routes ) {
308
+			if ( ! isset($this->_scripts_styles['enqueues']))
309
+				return; //not sure if we should throw an error here or not.
310
+			foreach ($this->_scripts_styles['enqueues'] as $ref => $routes) {
311 311
 				//make sure $routes is an array
312 312
 				$routes = (array) $routes;
313 313
 
314
-				if ( in_array($this->_current_route, $routes ) ) {
314
+				if (in_array($this->_current_route, $routes)) {
315 315
 					$this->_scripts_styles['registers'][$ref]['type'] == 'js' ? wp_enqueue_script($ref) : wp_enqueue_style($ref);
316 316
 					//if we have a localization for the script let's do that too.
317
-					if ( isset( $this->_scripts_styles['localize'][$ref] ) ) {
318
-						foreach ( $this->_scripts_styles['localize'][$ref] as $object_name => $indexes ) {
319
-							wp_localize_script($ref, $object_name , $this->_scripts_styles['localize'][$ref][$object_name] );
317
+					if (isset($this->_scripts_styles['localize'][$ref])) {
318
+						foreach ($this->_scripts_styles['localize'][$ref] as $object_name => $indexes) {
319
+							wp_localize_script($ref, $object_name, $this->_scripts_styles['localize'][$ref][$object_name]);
320 320
 						}
321 321
 					}
322 322
 				}
323 323
 			}
324 324
 
325 325
 			//let's do the deregisters
326
-			if ( !isset( $this->_scripts_styles['deregisters'] ) )
326
+			if ( ! isset($this->_scripts_styles['deregisters']))
327 327
 				return;
328
-			foreach ( $this->_scripts_styles['deregisters'] as $ref => $details ) {
328
+			foreach ($this->_scripts_styles['deregisters'] as $ref => $details) {
329 329
 				$defaults = array(
330 330
 					'type' => 'js'
331 331
 					);
332
-				$details = wp_parse_args( $details, $defaults );
333
-				extract( $details );
332
+				$details = wp_parse_args($details, $defaults);
333
+				extract($details);
334 334
 
335 335
 				$type == 'js' ? wp_deregister_script($ref) : wp_deregister_style($ref);
336 336
 
@@ -349,7 +349,7 @@  discard block
 block discarded – undo
349 349
 	 */
350 350
 	private function _set_defaults() {
351 351
 		$this->_ajax_func = $this->_init_func = $this->_metaboxes = $this->_scripts = $this->_styles = $this->_wp_action_filters_priority = array();
352
-		$this->_current_route = isset( $_REQUEST['action'] ) ? $_REQUEST['action'] : 'default';
352
+		$this->_current_route = isset($_REQUEST['action']) ? $_REQUEST['action'] : 'default';
353 353
 		$this->caller = get_class($this);
354 354
 		$this->_extend = stripos($this->caller, 'Extend') ? TRUE : FALSE;
355 355
 	}
@@ -364,35 +364,35 @@  discard block
 block discarded – undo
364 364
 	 */
365 365
 	protected function _set_page_object() {
366 366
 		//first make sure $this->_name is set
367
-		if ( empty( $this->_name ) ) {
367
+		if (empty($this->_name)) {
368 368
 			$msg[] = __('We can\'t load the page object', 'event_espresso');
369
-			$msg[] = sprintf( __("This is because the %s child class has not set the
370
-				'_name' property", 'event_espresso'), $this->caller );
371
-			throw new EE_Error( implode( '||', $msg ) );
369
+			$msg[] = sprintf(__("This is because the %s child class has not set the
370
+				'_name' property", 'event_espresso'), $this->caller);
371
+			throw new EE_Error(implode('||', $msg));
372 372
 		}
373 373
 
374
-		$ref = str_replace('_' , ' ', $this->_name); //take the_message -> the message
375
-		$ref = str_replace(' ', '_', ucwords($ref) ) . '_Admin_Page'; //take the message -> The_Message
374
+		$ref = str_replace('_', ' ', $this->_name); //take the_message -> the message
375
+		$ref = str_replace(' ', '_', ucwords($ref)).'_Admin_Page'; //take the message -> The_Message
376 376
 
377 377
 		//first default file (if exists)
378
-		$decaf_file = EE_ADMIN_PAGES . $this->_name . DS . $ref . '.core.php';
379
-		if ( is_readable( $decaf_file ) )
380
-		require_once( $decaf_file );
378
+		$decaf_file = EE_ADMIN_PAGES.$this->_name.DS.$ref.'.core.php';
379
+		if (is_readable($decaf_file))
380
+		require_once($decaf_file);
381 381
 
382 382
 		//now we have to do require for extended file (if needed)
383
-		if ( $this->_extend ) {
384
-			require_once( EE_CORE_CAF_ADMIN_EXTEND . $this->_name . DS . 'Extend_' . $ref . '.core.php' );
383
+		if ($this->_extend) {
384
+			require_once(EE_CORE_CAF_ADMIN_EXTEND.$this->_name.DS.'Extend_'.$ref.'.core.php');
385 385
 		}
386 386
 
387 387
 
388 388
 		//if we've got an extended class we use that!
389
-		$ref = $this->_extend ? 'Extend_' . $ref : $ref;
389
+		$ref = $this->_extend ? 'Extend_'.$ref : $ref;
390 390
 
391 391
 		//let's make sure the class exists
392
-		if ( !class_exists( $ref ) ) {
392
+		if ( ! class_exists($ref)) {
393 393
 			$msg[] = __('We can\'t load the page object', 'event_espresso');
394
-			$msg[] = sprintf( __('The class name that was given is %s. Check the spelling and make sure its correct, also there needs to be an autoloader setup for the class', 'event_espresso'), $ref );
395
-			throw new EE_Error( implode( '||', $msg ) );
394
+			$msg[] = sprintf(__('The class name that was given is %s. Check the spelling and make sure its correct, also there needs to be an autoloader setup for the class', 'event_espresso'), $ref);
395
+			throw new EE_Error(implode('||', $msg));
396 396
 		}
397 397
 
398 398
 		$a = new ReflectionClass($ref);
@@ -417,27 +417,27 @@  discard block
 block discarded – undo
417 417
 		$method_callback = $this->_current_route == 'default' ? 'default_callback' : $this->_current_route;
418 418
 
419 419
 		//these run before the Admin_Page route executes.
420
-		if ( method_exists( $this, $method_callback ) ) {
421
-			call_user_func( array( $this, $method_callback) );
420
+		if (method_exists($this, $method_callback)) {
421
+			call_user_func(array($this, $method_callback));
422 422
 		}
423 423
 
424 424
 
425 425
 		//these run via the _redirect_after_action method in EE_Admin_Page which usually happens after non_UI methods in EE_Admin_Page classes.  There are two redirect actions, the first fires before $query_args might be manipulated by "save and close" actions and the seond fires right before the actual redirect happens.
426 426
 		//first the actions
427 427
 		//note that these action hooks will have the $query_args value available.
428
-		$admin_class_name = get_class( $this->_adminpage_obj );
428
+		$admin_class_name = get_class($this->_adminpage_obj);
429 429
 
430
-		if ( method_exists( $this, '_redirect_action_early_' . $this->_current_route ) ) {
431
-			add_action( 'AHEE__' . $admin_class_name . '___redirect_after_action__before_redirect_modification_' . $this->_current_route, array( $this, '_redirect_action_early_' . $this->_current_route ), 10 );
430
+		if (method_exists($this, '_redirect_action_early_'.$this->_current_route)) {
431
+			add_action('AHEE__'.$admin_class_name.'___redirect_after_action__before_redirect_modification_'.$this->_current_route, array($this, '_redirect_action_early_'.$this->_current_route), 10);
432 432
 		}
433 433
 
434
-		if ( method_exists( $this, '_redirect_action_' . $this->_current_route ) ) {
435
-			add_action( 'AHEE_redirect_' . $admin_class_name . $this->_current_route, array( $this, '_redirect_action_' . $this->_current_route ), 10 );
434
+		if (method_exists($this, '_redirect_action_'.$this->_current_route)) {
435
+			add_action('AHEE_redirect_'.$admin_class_name.$this->_current_route, array($this, '_redirect_action_'.$this->_current_route), 10);
436 436
 		}
437 437
 
438 438
 		//let's hook into the _redirect itself and allow for changing where the user goes after redirect.  This will have $query_args and $redirect_url available.
439
-		if ( method_exists( $this, '_redirect_filter_' . $this->_current_route ) ) {
440
-			add_filter( 'FHEE_redirect_' . $admin_class_name . $this->_current_route, array( $this, '_redirect_filter_' . $this->_current_route ), 10, 2 );
439
+		if (method_exists($this, '_redirect_filter_'.$this->_current_route)) {
440
+			add_filter('FHEE_redirect_'.$admin_class_name.$this->_current_route, array($this, '_redirect_filter_'.$this->_current_route), 10, 2);
441 441
 		}
442 442
 
443 443
 	}
@@ -460,12 +460,12 @@  discard block
 block discarded – undo
460 460
 				'argnum' => 1,
461 461
 				'priority' => 10
462 462
 				),
463
-			'FHEE_list_table_views_' . $this->_adminpage_obj->page_slug . '_' . $this->_current_route => array(
463
+			'FHEE_list_table_views_'.$this->_adminpage_obj->page_slug.'_'.$this->_current_route => array(
464 464
 				'type' => 'filter',
465 465
 				'argnum' => 1,
466 466
 				'priority' => 10
467 467
 				),
468
-			'FHEE_list_table_views_' . $this->_adminpage_obj->page_slug => array(
468
+			'FHEE_list_table_views_'.$this->_adminpage_obj->page_slug => array(
469 469
 				'type' => 'filter',
470 470
 				'argnum' => 1,
471 471
 				'priority' => 10
@@ -484,14 +484,14 @@  discard block
 block discarded – undo
484 484
 
485 485
 
486 486
 
487
-		foreach ( $hook_filter_array as $hook => $args ) {
488
-			if ( method_exists( $this, $this->_current_route . '_' . $hook ) ) {
489
-				if ( isset( $this->_wp_action_filters_priority[$hook] ) )
487
+		foreach ($hook_filter_array as $hook => $args) {
488
+			if (method_exists($this, $this->_current_route.'_'.$hook)) {
489
+				if (isset($this->_wp_action_filters_priority[$hook]))
490 490
 					$args['priority'] = $this->_wp_action_filters_priority[$hook];
491
-				if ( $args['type'] == 'action' )
492
-					add_action( $hook, array( $this, $this->_current_route . '_' . $hook ), $args['priority'], $args['argnum'] );
491
+				if ($args['type'] == 'action')
492
+					add_action($hook, array($this, $this->_current_route.'_'.$hook), $args['priority'], $args['argnum']);
493 493
 				else
494
-					add_filter( $hook, array( $this, $this->_current_route . '_' . $hook ), $args['priority'], $args['argnum'] );
494
+					add_filter($hook, array($this, $this->_current_route.'_'.$hook), $args['priority'], $args['argnum']);
495 495
 			}
496 496
 		}
497 497
 
@@ -504,18 +504,18 @@  discard block
 block discarded – undo
504 504
 	 */
505 505
 	private function _ajax_hooks() {
506 506
 
507
-		if ( empty( $this->_ajax_func) )
507
+		if (empty($this->_ajax_func))
508 508
 			return; //get out there's nothing to take care of.
509 509
 
510
-		foreach ( $this->_ajax_func as $action => $method ) {
510
+		foreach ($this->_ajax_func as $action => $method) {
511 511
 			//make sure method exists
512
-			if ( !method_exists($this, $method) ) {
513
-				$msg[] = __('There is no corresponding method for the hook labeled in the _ajax_func array', 'event_espresso') . '<br />';
514
-				$msg[] = sprintf( __('The method name given in the array is %s, check the spelling and make sure it exists in the %s class', 'event_espresso' ), $method, $this->caller );
515
-				throw new EE_Error( implode('||', $msg ) );
512
+			if ( ! method_exists($this, $method)) {
513
+				$msg[] = __('There is no corresponding method for the hook labeled in the _ajax_func array', 'event_espresso').'<br />';
514
+				$msg[] = sprintf(__('The method name given in the array is %s, check the spelling and make sure it exists in the %s class', 'event_espresso'), $method, $this->caller);
515
+				throw new EE_Error(implode('||', $msg));
516 516
 			}
517 517
 
518
-			add_action('wp_ajax_' . $action, array( $this, $method ) );
518
+			add_action('wp_ajax_'.$action, array($this, $method));
519 519
 		}
520 520
 
521 521
 	}
@@ -528,21 +528,21 @@  discard block
 block discarded – undo
528 528
 	 * @return void
529 529
 	 */
530 530
 	protected function _init_hooks() {
531
-		if ( empty( $this->_init_func) )
531
+		if (empty($this->_init_func))
532 532
 			return; //get out there's nothing to take care of.
533 533
 
534 534
 		//We need to determine what page_route we are on!
535
-		$current_route = isset ( $_REQUEST['action'] ) ? $_REQUEST['action'] : 'default';
535
+		$current_route = isset ($_REQUEST['action']) ? $_REQUEST['action'] : 'default';
536 536
 
537
-		foreach ( $this->_init_func as $route => $method ) {
537
+		foreach ($this->_init_func as $route => $method) {
538 538
 			//make sure method exists
539
-			if ( !method_exists($this, $method) ) {
540
-				$msg[] = __('There is no corresponding method for the hook labeled in the _init_func array', 'event_espresso') . '<br />';
541
-				$msg[] = sprintf( __('The method name given in the array is %s, check the spelling and make sure it exists in the %s class', 'event_espresso' ), $method, $this->caller );
542
-				throw new EE_Error( implode('||', $msg ) );
539
+			if ( ! method_exists($this, $method)) {
540
+				$msg[] = __('There is no corresponding method for the hook labeled in the _init_func array', 'event_espresso').'<br />';
541
+				$msg[] = sprintf(__('The method name given in the array is %s, check the spelling and make sure it exists in the %s class', 'event_espresso'), $method, $this->caller);
542
+				throw new EE_Error(implode('||', $msg));
543 543
 			}
544
-			if ( $route == $this->_current_route )
545
-				add_action('admin_init', array( $this, $method ) );
544
+			if ($route == $this->_current_route)
545
+				add_action('admin_init', array($this, $method));
546 546
 		}
547 547
 
548 548
 	}
@@ -557,28 +557,28 @@  discard block
 block discarded – undo
557 557
 	 * @return void
558 558
 	 */
559 559
 	public function add_metaboxes() {
560
-		if ( empty( $this->_metaboxes ) )
560
+		if (empty($this->_metaboxes))
561 561
 			return; //get out we don't have any metaboxes to set for this connection
562 562
 
563
-		$this->_handle_metabox_array( $this->_metaboxes );
563
+		$this->_handle_metabox_array($this->_metaboxes);
564 564
 
565 565
 	}
566 566
 
567 567
 
568 568
 
569
-	private function _handle_metabox_array( $boxes, $add = TRUE ) {
569
+	private function _handle_metabox_array($boxes, $add = TRUE) {
570 570
 
571
-		foreach ( $boxes as $box ) {
572
-			if ( !isset($box['page_route']) )
571
+		foreach ($boxes as $box) {
572
+			if ( ! isset($box['page_route']))
573 573
 				continue; //we dont' have a valid array
574 574
 
575 575
 			//let's make sure $box['page_route'] is an array so the "foreach" will work.
576 576
 			$box['page_route'] = (array) $box['page_route'];
577 577
 
578
-			foreach ( $box['page_route'] as $route ) {
579
-				if ( $route != $this->_current_route )
578
+			foreach ($box['page_route'] as $route) {
579
+				if ($route != $this->_current_route)
580 580
 					continue; //get out we only add metaboxes for set route.
581
-				if ( $add )
581
+				if ($add)
582 582
 					$this->_add_metabox($box);
583 583
 				else
584 584
 					$this->_remove_metabox($box);
@@ -596,10 +596,10 @@  discard block
 block discarded – undo
596 596
 	 */
597 597
 	public function remove_metaboxes() {
598 598
 
599
-		if ( empty( $this->_remove_metaboxes ) )
599
+		if (empty($this->_remove_metaboxes))
600 600
 			return; //get out there are no metaboxes to remove
601 601
 
602
-		$this->_handle_metabox_array( $this->_remove_metaboxes, FALSE );
602
+		$this->_handle_metabox_array($this->_remove_metaboxes, FALSE);
603 603
 	}
604 604
 
605 605
 
@@ -609,53 +609,53 @@  discard block
 block discarded – undo
609 609
 	 * @access private
610 610
 	 * @param array $args an array of args that have been set for this metabox by the child class
611 611
 	 */
612
-	private function _add_metabox( $args ) {
612
+	private function _add_metabox($args) {
613 613
 		$current_screen = get_current_screen();
614
-		$screen_id = is_object( $current_screen ) ? $current_screen->id : NULL;
615
-		$func = isset( $args['func'] ) ? $args['func'] : 'some_invalid_callback';
614
+		$screen_id = is_object($current_screen) ? $current_screen->id : NULL;
615
+		$func = isset($args['func']) ? $args['func'] : 'some_invalid_callback';
616 616
 
617 617
 		//set defaults
618 618
 		$defaults = array(
619 619
 			'func' => $func,
620
-			'id' => $this->caller . '_' . $func . '_metabox',
620
+			'id' => $this->caller.'_'.$func.'_metabox',
621 621
 			'priority' => 'default',
622 622
 			'label' => $this->caller,
623 623
 			'context' => 'advanced',
624 624
 			'callback_args' => array(),
625
-			'page' => isset( $args['page'] ) ? $args['page'] : $screen_id
625
+			'page' => isset($args['page']) ? $args['page'] : $screen_id
626 626
 			);
627 627
 
628
-		$args = wp_parse_args( $args, $defaults );
628
+		$args = wp_parse_args($args, $defaults);
629 629
 		extract($args);
630 630
 
631 631
 
632 632
 		//make sure method exists
633
-		if ( !method_exists($this, $func) ) {
634
-			$msg[] = __('There is no corresponding method to display the metabox content', 'event_espresso') . '<br />';
635
-			$msg[] = sprintf( __('The method name given in the array is %s, check the spelling and make sure it exists in the %s class', 'event_espresso' ), $func, $this->caller );
636
-			throw new EE_Error( implode('||', $msg ) );
633
+		if ( ! method_exists($this, $func)) {
634
+			$msg[] = __('There is no corresponding method to display the metabox content', 'event_espresso').'<br />';
635
+			$msg[] = sprintf(__('The method name given in the array is %s, check the spelling and make sure it exists in the %s class', 'event_espresso'), $func, $this->caller);
636
+			throw new EE_Error(implode('||', $msg));
637 637
 		}
638 638
 
639 639
 		//everything checks out so lets add the metabox
640
-		add_meta_box( $id, $label, array( $this, $func ), $page, $context, $priority, $callback_args);
640
+		add_meta_box($id, $label, array($this, $func), $page, $context, $priority, $callback_args);
641 641
 	}
642 642
 
643 643
 
644 644
 
645
-	private function _remove_metabox( $args ) {
645
+	private function _remove_metabox($args) {
646 646
 		$current_screen = get_current_screen();
647
-		$screen_id = is_object( $current_screen ) ? $current_screen->id : NULL;
648
-		$func = isset( $args['func'] ) ? $args['func'] : 'some_invalid_callback';
647
+		$screen_id = is_object($current_screen) ? $current_screen->id : NULL;
648
+		$func = isset($args['func']) ? $args['func'] : 'some_invalid_callback';
649 649
 
650 650
 		//set defaults
651 651
 		$defaults = array(
652
-			'id' => isset( $args['id'] ) ? $args['id'] : $this->_current_route . '_' . $this->caller . '_' . $func . '_metabox',
652
+			'id' => isset($args['id']) ? $args['id'] : $this->_current_route.'_'.$this->caller.'_'.$func.'_metabox',
653 653
 			'context' => 'default',
654
-			'screen' => isset( $args['screen'] ) ? $args['screen'] : $screen_id
654
+			'screen' => isset($args['screen']) ? $args['screen'] : $screen_id
655 655
 		);
656 656
 
657
-		$args = wp_parse_args( $args, $defaults );
658
-		extract( $args );
657
+		$args = wp_parse_args($args, $defaults);
658
+		extract($args);
659 659
 
660 660
 		//everything checks out so lets remove the box!
661 661
 		remove_meta_box($id, $screen, $context);
Please login to merge, or discard this patch.
Braces   +59 added lines, -35 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
@@ -217,12 +218,15 @@  discard block
 block discarded – undo
217 218
 		$this->_set_hooks_properties();
218 219
 
219 220
 		//first let's verify we're on the right page
220
-		if ( !isset( $this->_req_data['page'] ) || ( isset( $this->_req_data['page'] ) && $this->_adminpage_obj->page_slug != $this->_req_data['page'] ) )
221
-			return; //get out nothing more to be done here.
221
+		if ( !isset( $this->_req_data['page'] ) || ( isset( $this->_req_data['page'] ) && $this->_adminpage_obj->page_slug != $this->_req_data['page'] ) ) {
222
+					return;
223
+		}
224
+		//get out nothing more to be done here.
222 225
 
223 226
 		//allow for extends to modify properties
224
-		if ( method_exists( $this, '_extend_properties' ) )
225
-			$this->_extend_properties();
227
+		if ( method_exists( $this, '_extend_properties' ) ) {
228
+					$this->_extend_properties();
229
+		}
226 230
 
227 231
 		$this->_set_page_object();
228 232
 		$this->_init_hooks();
@@ -305,8 +309,10 @@  discard block
 block discarded – undo
305 309
 			}
306 310
 
307 311
 			//k now lets do the enqueues
308
-			if( !isset( $this->_scripts_styles['enqueues'] ) )
309
-				return;  //not sure if we should throw an error here or not.
312
+			if( !isset( $this->_scripts_styles['enqueues'] ) ) {
313
+							return;
314
+			}
315
+			//not sure if we should throw an error here or not.
310 316
 			foreach( $this->_scripts_styles['enqueues'] as $ref => $routes ) {
311 317
 				//make sure $routes is an array
312 318
 				$routes = (array) $routes;
@@ -323,8 +329,9 @@  discard block
 block discarded – undo
323 329
 			}
324 330
 
325 331
 			//let's do the deregisters
326
-			if ( !isset( $this->_scripts_styles['deregisters'] ) )
327
-				return;
332
+			if ( !isset( $this->_scripts_styles['deregisters'] ) ) {
333
+							return;
334
+			}
328 335
 			foreach ( $this->_scripts_styles['deregisters'] as $ref => $details ) {
329 336
 				$defaults = array(
330 337
 					'type' => 'js'
@@ -376,8 +383,9 @@  discard block
 block discarded – undo
376 383
 
377 384
 		//first default file (if exists)
378 385
 		$decaf_file = EE_ADMIN_PAGES . $this->_name . DS . $ref . '.core.php';
379
-		if ( is_readable( $decaf_file ) )
380
-		require_once( $decaf_file );
386
+		if ( is_readable( $decaf_file ) ) {
387
+				require_once( $decaf_file );
388
+		}
381 389
 
382 390
 		//now we have to do require for extended file (if needed)
383 391
 		if ( $this->_extend ) {
@@ -486,12 +494,14 @@  discard block
 block discarded – undo
486 494
 
487 495
 		foreach ( $hook_filter_array as $hook => $args ) {
488 496
 			if ( method_exists( $this, $this->_current_route . '_' . $hook ) ) {
489
-				if ( isset( $this->_wp_action_filters_priority[$hook] ) )
490
-					$args['priority'] = $this->_wp_action_filters_priority[$hook];
491
-				if ( $args['type'] == 'action' )
492
-					add_action( $hook, array( $this, $this->_current_route . '_' . $hook ), $args['priority'], $args['argnum'] );
493
-				else
494
-					add_filter( $hook, array( $this, $this->_current_route . '_' . $hook ), $args['priority'], $args['argnum'] );
497
+				if ( isset( $this->_wp_action_filters_priority[$hook] ) ) {
498
+									$args['priority'] = $this->_wp_action_filters_priority[$hook];
499
+				}
500
+				if ( $args['type'] == 'action' ) {
501
+									add_action( $hook, array( $this, $this->_current_route . '_' . $hook ), $args['priority'], $args['argnum'] );
502
+				} else {
503
+									add_filter( $hook, array( $this, $this->_current_route . '_' . $hook ), $args['priority'], $args['argnum'] );
504
+				}
495 505
 			}
496 506
 		}
497 507
 
@@ -504,8 +514,10 @@  discard block
 block discarded – undo
504 514
 	 */
505 515
 	private function _ajax_hooks() {
506 516
 
507
-		if ( empty( $this->_ajax_func) )
508
-			return; //get out there's nothing to take care of.
517
+		if ( empty( $this->_ajax_func) ) {
518
+					return;
519
+		}
520
+		//get out there's nothing to take care of.
509 521
 
510 522
 		foreach ( $this->_ajax_func as $action => $method ) {
511 523
 			//make sure method exists
@@ -528,8 +540,10 @@  discard block
 block discarded – undo
528 540
 	 * @return void
529 541
 	 */
530 542
 	protected function _init_hooks() {
531
-		if ( empty( $this->_init_func) )
532
-			return; //get out there's nothing to take care of.
543
+		if ( empty( $this->_init_func) ) {
544
+					return;
545
+		}
546
+		//get out there's nothing to take care of.
533 547
 
534 548
 		//We need to determine what page_route we are on!
535 549
 		$current_route = isset ( $_REQUEST['action'] ) ? $_REQUEST['action'] : 'default';
@@ -541,8 +555,9 @@  discard block
 block discarded – undo
541 555
 				$msg[] = sprintf( __('The method name given in the array is %s, check the spelling and make sure it exists in the %s class', 'event_espresso' ), $method, $this->caller );
542 556
 				throw new EE_Error( implode('||', $msg ) );
543 557
 			}
544
-			if ( $route == $this->_current_route )
545
-				add_action('admin_init', array( $this, $method ) );
558
+			if ( $route == $this->_current_route ) {
559
+							add_action('admin_init', array( $this, $method ) );
560
+			}
546 561
 		}
547 562
 
548 563
 	}
@@ -557,8 +572,10 @@  discard block
 block discarded – undo
557 572
 	 * @return void
558 573
 	 */
559 574
 	public function add_metaboxes() {
560
-		if ( empty( $this->_metaboxes ) )
561
-			return; //get out we don't have any metaboxes to set for this connection
575
+		if ( empty( $this->_metaboxes ) ) {
576
+					return;
577
+		}
578
+		//get out we don't have any metaboxes to set for this connection
562 579
 
563 580
 		$this->_handle_metabox_array( $this->_metaboxes );
564 581
 
@@ -569,19 +586,24 @@  discard block
 block discarded – undo
569 586
 	private function _handle_metabox_array( $boxes, $add = TRUE ) {
570 587
 
571 588
 		foreach ( $boxes as $box ) {
572
-			if ( !isset($box['page_route']) )
573
-				continue; //we dont' have a valid array
589
+			if ( !isset($box['page_route']) ) {
590
+							continue;
591
+			}
592
+			//we dont' have a valid array
574 593
 
575 594
 			//let's make sure $box['page_route'] is an array so the "foreach" will work.
576 595
 			$box['page_route'] = (array) $box['page_route'];
577 596
 
578 597
 			foreach ( $box['page_route'] as $route ) {
579
-				if ( $route != $this->_current_route )
580
-					continue; //get out we only add metaboxes for set route.
581
-				if ( $add )
582
-					$this->_add_metabox($box);
583
-				else
584
-					$this->_remove_metabox($box);
598
+				if ( $route != $this->_current_route ) {
599
+									continue;
600
+				}
601
+				//get out we only add metaboxes for set route.
602
+				if ( $add ) {
603
+									$this->_add_metabox($box);
604
+				} else {
605
+									$this->_remove_metabox($box);
606
+				}
585 607
 			}
586 608
 		}
587 609
 	}
@@ -596,8 +618,10 @@  discard block
 block discarded – undo
596 618
 	 */
597 619
 	public function remove_metaboxes() {
598 620
 
599
-		if ( empty( $this->_remove_metaboxes ) )
600
-			return; //get out there are no metaboxes to remove
621
+		if ( empty( $this->_remove_metaboxes ) ) {
622
+					return;
623
+		}
624
+		//get out there are no metaboxes to remove
601 625
 
602 626
 		$this->_handle_metabox_array( $this->_remove_metaboxes, FALSE );
603 627
 	}
Please login to merge, or discard this patch.