Completed
Branch FET-8365-add-indexes (3fce8d)
by
unknown
512:51 queued 496:29
created
core/data_migration_scripts/EE_DMS_Core_4_8_0.dms.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,12 +1,12 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * meant to convert DBs from 4.6 (OR 4.7, which basically supports MER and wasn't clear if it was
4
- * going to be released before this version) to 4.8 (which basically supports promotions)
5
- * mostly just
6
- * -refactors line item trees, so that there are subtotals for EACH event purchased,
7
- * which is especially convenient for applying event-wide promotions
8
- * -does NOT actually make any database schema changes
9
- */
3
+	 * meant to convert DBs from 4.6 (OR 4.7, which basically supports MER and wasn't clear if it was
4
+	 * going to be released before this version) to 4.8 (which basically supports promotions)
5
+	 * mostly just
6
+	 * -refactors line item trees, so that there are subtotals for EACH event purchased,
7
+	 * which is especially convenient for applying event-wide promotions
8
+	 * -does NOT actually make any database schema changes
9
+	 */
10 10
 //make sure we have all the stages loaded too
11 11
 //unfortunately, this needs to be done upon INCLUSION of this file,
12 12
 //instead of construction, because it only gets constructed on first page load
@@ -715,7 +715,7 @@  discard block
 block discarded – undo
715 715
 				}
716 716
 			}
717 717
 		}
718
-        }
718
+		}
719 719
 	/**
720 720
 	 * addresses https://events.codebasehq.com/projects/event-espresso/tickets/8731
721 721
 	 * which should just be a temporary issue for folks who installed 4.8.0-4.8.5;
Please login to merge, or discard this patch.
core/db_models/EEM_Datetime.model.php 3 patches
Indentation   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -75,11 +75,11 @@  discard block
 block discarded – undo
75 75
 
76 76
 
77 77
 	/**
78
-	*		create new blank datetime
79
-	*
80
-	* 		@access		public
81
-	*		@return 		EE_Datetime[]		array on success, FALSE on fail
82
-	*/
78
+	 *		create new blank datetime
79
+	 *
80
+	 * 		@access		public
81
+	 *		@return 		EE_Datetime[]		array on success, FALSE on fail
82
+	 */
83 83
 	public function create_new_blank_datetime() {
84 84
 		$blank_datetime = EE_Datetime::new_instance(
85 85
 			array(
@@ -100,12 +100,12 @@  discard block
 block discarded – undo
100 100
 
101 101
 
102 102
 	/**
103
-	*		get event start date from db
104
-	*
105
-	* 		@access		public
106
-	* 		@param		int 			$EVT_ID
107
-	*		@return 		EE_Datetime[]		array on success, FALSE on fail
108
-	*/
103
+	 *		get event start date from db
104
+	 *
105
+	 * 		@access		public
106
+	 * 		@param		int 			$EVT_ID
107
+	 *		@return 		EE_Datetime[]		array on success, FALSE on fail
108
+	 */
109 109
 	public function get_all_event_dates( $EVT_ID = 0 ) {
110 110
 		if ( ! $EVT_ID ) { // on add_new_event event_id gets set to 0
111 111
 			return $this->create_new_blank_datetime();
@@ -250,14 +250,14 @@  discard block
 block discarded – undo
250 250
 	}
251 251
 
252 252
 		/**
253
-	 * Gets ALL the datetimes for an ticket (including trashed ones, for now), ordered
254
-	 * only by start date
255
-	 * @param int $TKT_ID
256
-	 * @param boolean $include_expired
257
-	 * @param boolean $include_deleted
258
-	 * @param int $limit
259
-	 * @return EE_Datetime[]
260
-	 */
253
+		 * Gets ALL the datetimes for an ticket (including trashed ones, for now), ordered
254
+		 * only by start date
255
+		 * @param int $TKT_ID
256
+		 * @param boolean $include_expired
257
+		 * @param boolean $include_deleted
258
+		 * @param int $limit
259
+		 * @return EE_Datetime[]
260
+		 */
261 261
 	public function get_datetimes_for_ticket_ordered_by_start_time($TKT_ID, $include_expired = true, $include_deleted= true, $limit = NULL){
262 262
 		//sanitize TKT_ID
263 263
 		$TKT_ID =  intval( $TKT_ID );
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -443,7 +443,7 @@
 block discarded – undo
443 443
 	/**
444 444
 	 * This returns an array of counts of datetimes in the database for each Datetime status that can be queried.
445 445
 	 *
446
-	 * @param  array $stati_to_include        If included you can restrict the statuses we return counts for by including the stati
446
+	 * @param  string[] $stati_to_include        If included you can restrict the statuses we return counts for by including the stati
447 447
 	 *                               you want counts for as values in the array.  An empty array returns counts for all valid
448 448
 	 *                               stati.
449 449
 	 * @param  array  $query_params  If included can be used to refine the conditions for returning the count (i.e. only for
Please login to merge, or discard this patch.
Spacing   +132 added lines, -132 removed lines patch added patch discarded remove patch
@@ -21,8 +21,8 @@  discard block
 block discarded – undo
21 21
  *
22 22
  * ------------------------------------------------------------------------
23 23
  */
24
-require_once ( EE_MODELS . 'EEM_Soft_Delete_Base.model.php' );
25
-require_once ( EE_CLASSES . 'EE_Datetime.class.php' );
24
+require_once (EE_MODELS.'EEM_Soft_Delete_Base.model.php');
25
+require_once (EE_CLASSES.'EE_Datetime.class.php');
26 26
 
27 27
 class EEM_Datetime extends EEM_Soft_Delete_Base {
28 28
 
@@ -35,27 +35,27 @@  discard block
 block discarded – undo
35 35
 	 *		@access private
36 36
 	 *		@param string $timezone string representing the timezone we want to set for returned Date Time Strings (and any incoming timezone data that gets saved).  Note this just sends the timezone info to the date time model field objects.  Default is NULL (and will be assumed using the set timezone in the 'timezone_string' wp option)
37 37
 	 */
38
-	protected function __construct( $timezone ) {
39
-		$this->singular_item = __('Datetime','event_espresso');
40
-		$this->plural_item = __('Datetimes','event_espresso');
38
+	protected function __construct($timezone) {
39
+		$this->singular_item = __('Datetime', 'event_espresso');
40
+		$this->plural_item = __('Datetimes', 'event_espresso');
41 41
 
42 42
 		$this->_tables = array(
43 43
 			'Datetime'=> new EE_Primary_Table('esp_datetime', 'DTT_ID')
44 44
 		);
45 45
 		$this->_fields = array(
46 46
 			'Datetime'=>array(
47
-				'DTT_ID'=> new EE_Primary_Key_Int_Field('DTT_ID', __('Datetime ID','event_espresso')),
48
-				'EVT_ID'=>new EE_Foreign_Key_Int_Field('EVT_ID', __('Event ID','event_espresso'), false, 0, 'Event'),
47
+				'DTT_ID'=> new EE_Primary_Key_Int_Field('DTT_ID', __('Datetime ID', 'event_espresso')),
48
+				'EVT_ID'=>new EE_Foreign_Key_Int_Field('EVT_ID', __('Event ID', 'event_espresso'), false, 0, 'Event'),
49 49
 				'DTT_name' => new EE_Plain_Text_Field('DTT_name', __('Datetime Name', 'event_espresso'), false, ''),
50 50
 				'DTT_description' => new EE_Full_HTML_Field('DTT_description', __('Description for Datetime', 'event_espresso'), false, ''),
51
-				'DTT_EVT_start'=>new EE_Datetime_Field('DTT_EVT_start', __('Start time/date of Event','event_espresso'), false, time(), $timezone ),
52
-				'DTT_EVT_end'=>new EE_Datetime_Field('DTT_EVT_end', __('End time/date of Event','event_espresso'), false, time(), $timezone ),
53
-				'DTT_reg_limit'=>new EE_Infinite_Integer_Field('DTT_reg_limit', __('Registration Limit for this time','event_espresso'), true, EE_INF),
54
-				'DTT_sold'=>new EE_Integer_Field('DTT_sold', __('How many sales for this Datetime that have occurred', 'event_espresso'), true, 0 ),
55
-				'DTT_is_primary'=>new EE_Boolean_Field('DTT_is_primary', __("Flag indicating datetime is primary one for event", "event_espresso"), false,false),
51
+				'DTT_EVT_start'=>new EE_Datetime_Field('DTT_EVT_start', __('Start time/date of Event', 'event_espresso'), false, time(), $timezone),
52
+				'DTT_EVT_end'=>new EE_Datetime_Field('DTT_EVT_end', __('End time/date of Event', 'event_espresso'), false, time(), $timezone),
53
+				'DTT_reg_limit'=>new EE_Infinite_Integer_Field('DTT_reg_limit', __('Registration Limit for this time', 'event_espresso'), true, EE_INF),
54
+				'DTT_sold'=>new EE_Integer_Field('DTT_sold', __('How many sales for this Datetime that have occurred', 'event_espresso'), true, 0),
55
+				'DTT_is_primary'=>new EE_Boolean_Field('DTT_is_primary', __("Flag indicating datetime is primary one for event", "event_espresso"), false, false),
56 56
 				'DTT_order' => new EE_Integer_Field('DTT_order', __('The order in which the Datetime is displayed', 'event_espresso'), false, 0),
57
-				'DTT_parent' => new EE_Integer_Field('DTT_parent', __('Indicates what DTT_ID is the parent of this DTT_ID'), true, 0 ),
58
-				'DTT_deleted' => new EE_Trashed_Flag_Field('DTT_deleted', __('Flag indicating datetime is archived', 'event_espresso'), false, false ),
57
+				'DTT_parent' => new EE_Integer_Field('DTT_parent', __('Indicates what DTT_ID is the parent of this DTT_ID'), true, 0),
58
+				'DTT_deleted' => new EE_Trashed_Flag_Field('DTT_deleted', __('Flag indicating datetime is archived', 'event_espresso'), false, false),
59 59
 			));
60 60
 		$this->_model_relations = array(
61 61
 			'Ticket'=>new EE_HABTM_Relation('Datetime_Ticket'),
@@ -64,11 +64,11 @@  discard block
 block discarded – undo
64 64
 		);
65 65
 		$this->_model_chain_to_wp_user = 'Event';
66 66
 		//this model is generally available for reading
67
-		$this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Event_Related_Public( 'Event' );
68
-		$this->_cap_restriction_generators[ EEM_Base::caps_read_admin ] = new EE_Restriction_Generator_Event_Related_Protected( 'Event' );
69
-		$this->_cap_restriction_generators[ EEM_Base::caps_edit ] = new EE_Restriction_Generator_Event_Related_Protected( 'Event' );
70
-		$this->_cap_restriction_generators[ EEM_Base::caps_delete ] = new EE_Restriction_Generator_Event_Related_Protected( 'Event', EEM_Base::caps_edit );
71
-		parent::__construct( $timezone );
67
+		$this->_cap_restriction_generators[EEM_Base::caps_read] = new EE_Restriction_Generator_Event_Related_Public('Event');
68
+		$this->_cap_restriction_generators[EEM_Base::caps_read_admin] = new EE_Restriction_Generator_Event_Related_Protected('Event');
69
+		$this->_cap_restriction_generators[EEM_Base::caps_edit] = new EE_Restriction_Generator_Event_Related_Protected('Event');
70
+		$this->_cap_restriction_generators[EEM_Base::caps_delete] = new EE_Restriction_Generator_Event_Related_Protected('Event', EEM_Base::caps_edit);
71
+		parent::__construct($timezone);
72 72
 	}
73 73
 
74 74
 
@@ -83,16 +83,16 @@  discard block
 block discarded – undo
83 83
 	public function create_new_blank_datetime() {
84 84
 		$blank_datetime = EE_Datetime::new_instance(
85 85
 			array(
86
-				'DTT_EVT_start' => $this->current_time_for_query( 'DTT_EVT_start', true ) + (60 * 60 * 24 * 30),
87
-				'DTT_EVT_end' => $this->current_time_for_query( 'DTT_EVT_end', true ) + (60 * 60 * 24 * 30),
86
+				'DTT_EVT_start' => $this->current_time_for_query('DTT_EVT_start', true) + (60 * 60 * 24 * 30),
87
+				'DTT_EVT_end' => $this->current_time_for_query('DTT_EVT_end', true) + (60 * 60 * 24 * 30),
88 88
 				'DTT_order' => 1,
89 89
 				'DTT_reg_limit' => EE_INF
90 90
 			),
91 91
 			$this->_timezone
92 92
 		);
93
-		$blank_datetime->set_start_time( $this->convert_datetime_for_query( 'DTT_EVT_start', '8am', 'ga', $this->_timezone ) );
94
-		$blank_datetime->set_end_time( $this->convert_datetime_for_query( 'DTT_EVT_end', '5pm', 'ga', $this->_timezone ) );
95
-		return array( $blank_datetime );
93
+		$blank_datetime->set_start_time($this->convert_datetime_for_query('DTT_EVT_start', '8am', 'ga', $this->_timezone));
94
+		$blank_datetime->set_end_time($this->convert_datetime_for_query('DTT_EVT_end', '5pm', 'ga', $this->_timezone));
95
+		return array($blank_datetime);
96 96
 	}
97 97
 
98 98
 
@@ -106,13 +106,13 @@  discard block
 block discarded – undo
106 106
 	* 		@param		int 			$EVT_ID
107 107
 	*		@return 		EE_Datetime[]		array on success, FALSE on fail
108 108
 	*/
109
-	public function get_all_event_dates( $EVT_ID = 0 ) {
110
-		if ( ! $EVT_ID ) { // on add_new_event event_id gets set to 0
109
+	public function get_all_event_dates($EVT_ID = 0) {
110
+		if ( ! $EVT_ID) { // on add_new_event event_id gets set to 0
111 111
 			return $this->create_new_blank_datetime();
112 112
 		}
113
-		$results =  $this->get_datetimes_for_event_ordered_by_DTT_order($EVT_ID);
113
+		$results = $this->get_datetimes_for_event_ordered_by_DTT_order($EVT_ID);
114 114
 
115
-		if ( empty( $results ) ) {
115
+		if (empty($results)) {
116 116
 			return $this->create_new_blank_datetime();
117 117
 		}
118 118
 
@@ -133,26 +133,26 @@  discard block
 block discarded – undo
133 133
 	 *                        	the given number
134 134
 	 * @return EE_Datetime[]
135 135
 	 */
136
-	public function get_datetimes_for_event_ordered_by_DTT_order( $EVT_ID, $include_expired = TRUE, $include_deleted= TRUE, $limit = NULL  ) {
136
+	public function get_datetimes_for_event_ordered_by_DTT_order($EVT_ID, $include_expired = TRUE, $include_deleted = TRUE, $limit = NULL) {
137 137
 
138 138
 		//sanitize EVT_ID
139
-		$EVT_ID = intval( $EVT_ID );
139
+		$EVT_ID = intval($EVT_ID);
140 140
 
141 141
 		$old_assumption = $this->get_assumption_concerning_values_already_prepared_by_model_object();
142
-		$this->assume_values_already_prepared_by_model_object( EEM_Base::prepared_for_use_in_db );
143
-		$where_params = array( 'Event.EVT_ID' => $EVT_ID );
142
+		$this->assume_values_already_prepared_by_model_object(EEM_Base::prepared_for_use_in_db);
143
+		$where_params = array('Event.EVT_ID' => $EVT_ID);
144 144
 
145
-		$query_params = ! empty( $limit ) ? array( $where_params, 'limit' => $limit, 'order_by' => array( 'DTT_order' => 'ASC' ), 'default_where_conditions' => 'none' ) : array( $where_params, 'order_by' => array( 'DTT_order' => 'ASC' ), 'default_where_conditions' => 'none' );
145
+		$query_params = ! empty($limit) ? array($where_params, 'limit' => $limit, 'order_by' => array('DTT_order' => 'ASC'), 'default_where_conditions' => 'none') : array($where_params, 'order_by' => array('DTT_order' => 'ASC'), 'default_where_conditions' => 'none');
146 146
 
147
-		if( ! $include_expired){
148
-			$query_params[0]['DTT_EVT_end'] = array( '>=', current_time( 'mysql', TRUE ) );
147
+		if ( ! $include_expired) {
148
+			$query_params[0]['DTT_EVT_end'] = array('>=', current_time('mysql', TRUE));
149 149
 		}
150
-		if( $include_deleted){
151
-			$query_params[0]['DTT_deleted'] = array( 'IN', array( TRUE, FALSE ));
150
+		if ($include_deleted) {
151
+			$query_params[0]['DTT_deleted'] = array('IN', array(TRUE, FALSE));
152 152
 		}
153 153
 
154
-		$result = $this->get_all( $query_params );
155
-		$this->assume_values_already_prepared_by_model_object( $old_assumption );
154
+		$result = $this->get_all($query_params);
155
+		$this->assume_values_already_prepared_by_model_object($old_assumption);
156 156
 		return $result;
157 157
 	}
158 158
 
@@ -167,8 +167,8 @@  discard block
 block discarded – undo
167 167
 	 * @param int $limit
168 168
 	 * @return EE_Datetime[]
169 169
 	 */
170
-	public function get_datetimes_for_event_ordered_by_importance( $EVT_ID = 0, $limit = NULL){
171
-		return $this->get_all( array(array('Event.EVT_ID'=>$EVT_ID),
170
+	public function get_datetimes_for_event_ordered_by_importance($EVT_ID = 0, $limit = NULL) {
171
+		return $this->get_all(array(array('Event.EVT_ID'=>$EVT_ID),
172 172
 			'limit'=>$limit,
173 173
 			'order_by'=>array('DTT_EVT_start'=>'ASC'),
174 174
 			'default_where_conditions' => 'none'));
@@ -183,11 +183,11 @@  discard block
 block discarded – undo
183 183
 	 * @param boolean $include_deleted
184 184
 	 * @return EE_Datetime
185 185
 	 */
186
-	public function get_oldest_datetime_for_event($EVT_ID, $include_expired = false,$include_deleted = false){
187
-		$results =  $this->get_datetimes_for_event_ordered_by_start_time($EVT_ID, $include_expired, $include_deleted, 1);
188
-		if($results){
186
+	public function get_oldest_datetime_for_event($EVT_ID, $include_expired = false, $include_deleted = false) {
187
+		$results = $this->get_datetimes_for_event_ordered_by_start_time($EVT_ID, $include_expired, $include_deleted, 1);
188
+		if ($results) {
189 189
 			return array_shift($results);
190
-		}else{
190
+		} else {
191 191
 			return NULL;
192 192
 		}
193 193
 	}
@@ -201,16 +201,16 @@  discard block
 block discarded – undo
201 201
 	 * @param bool $try_to_exclude_deleted
202 202
 	 * @return \EE_Datetime
203 203
 	 */
204
-	public function get_primary_datetime_for_event($EVT_ID,$try_to_exclude_expired = true, $try_to_exclude_deleted = true){
205
-		if($try_to_exclude_expired){
206
-			$non_expired = $this->get_oldest_datetime_for_event($EVT_ID, false,false);
207
-			if($non_expired){
204
+	public function get_primary_datetime_for_event($EVT_ID, $try_to_exclude_expired = true, $try_to_exclude_deleted = true) {
205
+		if ($try_to_exclude_expired) {
206
+			$non_expired = $this->get_oldest_datetime_for_event($EVT_ID, false, false);
207
+			if ($non_expired) {
208 208
 				return $non_expired;
209 209
 			}
210 210
 		}
211
-		if($try_to_exclude_deleted){
211
+		if ($try_to_exclude_deleted) {
212 212
 			$expired_even = $this->get_oldest_datetime_for_event($EVT_ID, true);
213
-			if($expired_even){
213
+			if ($expired_even) {
214 214
 				return $expired_even;
215 215
 			}
216 216
 		}
@@ -229,23 +229,23 @@  discard block
 block discarded – undo
229 229
 	 * @param int $limit
230 230
 	 * @return EE_Datetime[]
231 231
 	 */
232
-	public function get_datetimes_for_event_ordered_by_start_time($EVT_ID, $include_expired = true, $include_deleted= true, $limit = NULL ){
232
+	public function get_datetimes_for_event_ordered_by_start_time($EVT_ID, $include_expired = true, $include_deleted = true, $limit = NULL) {
233 233
 		//sanitize EVT_ID
234
-		$EVT_ID = intval( $EVT_ID );
234
+		$EVT_ID = intval($EVT_ID);
235 235
 		$old_assumption = $this->get_assumption_concerning_values_already_prepared_by_model_object();
236
-		$this->assume_values_already_prepared_by_model_object( EEM_Base::prepared_for_use_in_db );
237
-		$query_params =array(array('Event.EVT_ID'=>$EVT_ID),'order_by'=>array('DTT_EVT_start'=>'asc'));
238
-		if( ! $include_expired){
239
-			$query_params[0]['DTT_EVT_end'] = array('>=',current_time('mysql', TRUE));
236
+		$this->assume_values_already_prepared_by_model_object(EEM_Base::prepared_for_use_in_db);
237
+		$query_params = array(array('Event.EVT_ID'=>$EVT_ID), 'order_by'=>array('DTT_EVT_start'=>'asc'));
238
+		if ( ! $include_expired) {
239
+			$query_params[0]['DTT_EVT_end'] = array('>=', current_time('mysql', TRUE));
240 240
 		}
241
-		if( $include_deleted){
242
-			$query_params[0]['DTT_deleted'] = array('IN',array(true,false));
241
+		if ($include_deleted) {
242
+			$query_params[0]['DTT_deleted'] = array('IN', array(true, false));
243 243
 		}
244
-		if($limit){
244
+		if ($limit) {
245 245
 			$query_params['limit'] = $limit;
246 246
 		}
247
-		$result = $this->get_all( $query_params );
248
-		$this->assume_values_already_prepared_by_model_object( $old_assumption );
247
+		$result = $this->get_all($query_params);
248
+		$this->assume_values_already_prepared_by_model_object($old_assumption);
249 249
 		return $result;
250 250
 	}
251 251
 
@@ -258,23 +258,23 @@  discard block
 block discarded – undo
258 258
 	 * @param int $limit
259 259
 	 * @return EE_Datetime[]
260 260
 	 */
261
-	public function get_datetimes_for_ticket_ordered_by_start_time($TKT_ID, $include_expired = true, $include_deleted= true, $limit = NULL){
261
+	public function get_datetimes_for_ticket_ordered_by_start_time($TKT_ID, $include_expired = true, $include_deleted = true, $limit = NULL) {
262 262
 		//sanitize TKT_ID
263
-		$TKT_ID =  intval( $TKT_ID );
263
+		$TKT_ID = intval($TKT_ID);
264 264
 		$old_assumption = $this->get_assumption_concerning_values_already_prepared_by_model_object();
265
-		$this->assume_values_already_prepared_by_model_object( EEM_Base::prepared_for_use_in_db );
266
-		$query_params =array(array('Ticket.TKT_ID'=>$TKT_ID),'order_by'=>array('DTT_EVT_start'=>'asc'));
267
-		if( ! $include_expired){
268
-			$query_params[0]['DTT_EVT_end'] = array('>=',current_time('mysql', TRUE));
265
+		$this->assume_values_already_prepared_by_model_object(EEM_Base::prepared_for_use_in_db);
266
+		$query_params = array(array('Ticket.TKT_ID'=>$TKT_ID), 'order_by'=>array('DTT_EVT_start'=>'asc'));
267
+		if ( ! $include_expired) {
268
+			$query_params[0]['DTT_EVT_end'] = array('>=', current_time('mysql', TRUE));
269 269
 		}
270
-		if( $include_deleted){
271
-			$query_params[0]['DTT_deleted'] = array('IN',array(true,false));
270
+		if ($include_deleted) {
271
+			$query_params[0]['DTT_deleted'] = array('IN', array(true, false));
272 272
 		}
273
-		if($limit){
273
+		if ($limit) {
274 274
 			$query_params['limit'] = $limit;
275 275
 		}
276
-		$result = $this->get_all( $query_params );
277
-		$this->assume_values_already_prepared_by_model_object( $old_assumption );
276
+		$result = $this->get_all($query_params);
277
+		$this->assume_values_already_prepared_by_model_object($old_assumption);
278 278
 		return $result;
279 279
 	}
280 280
 
@@ -290,24 +290,24 @@  discard block
 block discarded – undo
290 290
 	 *                                  that number
291 291
 	 * @return EE_Datetime[]
292 292
 	 */
293
-	public function get_datetimes_for_ticket_ordered_by_DTT_order( $TKT_ID, $include_expired = true, $include_deleted = true, $limit = NULL ) {
293
+	public function get_datetimes_for_ticket_ordered_by_DTT_order($TKT_ID, $include_expired = true, $include_deleted = true, $limit = NULL) {
294 294
 		//sanitize id.
295
-		$TKT_ID =  intval( $TKT_ID );
295
+		$TKT_ID = intval($TKT_ID);
296 296
 		$old_assumption = $this->get_assumption_concerning_values_already_prepared_by_model_object();
297
-		$this->assume_values_already_prepared_by_model_object( EEM_Base::prepared_for_use_in_db );
298
-		$where_params = array( 'Ticket.TKT_ID' => $TKT_ID );
299
-		$query_params = array( $where_params, 'order_by' => array( 'DTT_order' => 'ASC' ) );
300
-		if( ! $include_expired){
301
-			$query_params[0]['DTT_EVT_end'] = array('>=',current_time('mysql', TRUE));
297
+		$this->assume_values_already_prepared_by_model_object(EEM_Base::prepared_for_use_in_db);
298
+		$where_params = array('Ticket.TKT_ID' => $TKT_ID);
299
+		$query_params = array($where_params, 'order_by' => array('DTT_order' => 'ASC'));
300
+		if ( ! $include_expired) {
301
+			$query_params[0]['DTT_EVT_end'] = array('>=', current_time('mysql', TRUE));
302 302
 		}
303
-		if( $include_deleted){
304
-			$query_params[0]['DTT_deleted'] = array('IN',array(true,false));
303
+		if ($include_deleted) {
304
+			$query_params[0]['DTT_deleted'] = array('IN', array(true, false));
305 305
 		}
306
-		if($limit){
306
+		if ($limit) {
307 307
 			$query_params['limit'] = $limit;
308 308
 		}
309
-		$result = $this->get_all( $query_params );
310
-		$this->assume_values_already_prepared_by_model_object( $old_assumption );
309
+		$result = $this->get_all($query_params);
310
+		$this->assume_values_already_prepared_by_model_object($old_assumption);
311 311
 		return $result;
312 312
 	}
313 313
 
@@ -318,11 +318,11 @@  discard block
 block discarded – undo
318 318
 	 * @param int $EVT_ID
319 319
 	 * @return EE_Datetime
320 320
 	 */
321
-	public function get_most_important_datetime_for_event($EVT_ID){
321
+	public function get_most_important_datetime_for_event($EVT_ID) {
322 322
 		$results = $this->get_datetimes_for_event_ordered_by_importance($EVT_ID, 1);
323
-		if($results){
323
+		if ($results) {
324 324
 			return array_shift($results);
325
-		}else{
325
+		} else {
326 326
 			return null;
327 327
 		}
328 328
 	}
@@ -341,71 +341,71 @@  discard block
 block discarded – undo
341 341
 	 * 			- inactive = Events that are either not published.
342 342
 	 * @return wpdb results array
343 343
 	 */
344
-	public function get_dtt_months_and_years( $where_params, $evt_active_status = '' ) {
344
+	public function get_dtt_months_and_years($where_params, $evt_active_status = '') {
345 345
 
346
-		switch ( $evt_active_status ) {
346
+		switch ($evt_active_status) {
347 347
 			case 'upcoming' :
348 348
 					$where_params['Event.status'] = 'publish';
349 349
 					//if there are already query_params matching DTT_EVT_start then we need to modify that to add them.
350
-					if ( isset( $where_params['DTT_EVT_start'] ) ) {
350
+					if (isset($where_params['DTT_EVT_start'])) {
351 351
 						$where_params['DTT_EVT_start*****'] = $where_params['DTT_EVT_start'];
352 352
 					}
353
-					$where_params['DTT_EVT_start'] = array('>', $this->current_time_for_query( 'DTT_EVT_start' ) );
353
+					$where_params['DTT_EVT_start'] = array('>', $this->current_time_for_query('DTT_EVT_start'));
354 354
 					break;
355 355
 
356 356
 			case 'expired' :
357
-				if ( isset( $where_params['Event.status'] ) ) unset( $where_params['Event.status'] );
357
+				if (isset($where_params['Event.status'])) unset($where_params['Event.status']);
358 358
 				//get events to exclude
359
-				$exclude_query[0] = array_merge( $where_params, array( 'DTT_EVT_end' => array( '>', $this->current_time_for_query( 'DTT_EVT_end' ) ) ) );
359
+				$exclude_query[0] = array_merge($where_params, array('DTT_EVT_end' => array('>', $this->current_time_for_query('DTT_EVT_end'))));
360 360
 				//first get all events that have datetimes where its not expired.
361
-				$event_ids = $this->_get_all_wpdb_results( $exclude_query, OBJECT_K, 'Datetime.EVT_ID' );
362
-				$event_ids = array_keys( $event_ids );
361
+				$event_ids = $this->_get_all_wpdb_results($exclude_query, OBJECT_K, 'Datetime.EVT_ID');
362
+				$event_ids = array_keys($event_ids);
363 363
 
364
-				if ( isset( $where_params['DTT_EVT_end'] ) ) {
364
+				if (isset($where_params['DTT_EVT_end'])) {
365 365
 					$where_params['DTT_EVT_end****'] = $where_params['DTT_EVT_end'];
366 366
 				}
367
-				$where_params['DTT_EVT_end'] = array( '<', EEM_Datetime::instance()->current_time_for_query( 'DTT_EVT_end' ) );
368
-				$where_params['Event.EVT_ID'] = array( 'NOT IN', $event_ids );
367
+				$where_params['DTT_EVT_end'] = array('<', EEM_Datetime::instance()->current_time_for_query('DTT_EVT_end'));
368
+				$where_params['Event.EVT_ID'] = array('NOT IN', $event_ids);
369 369
 				break;
370 370
 
371 371
 			case 'active' :
372 372
 				$where_params['Event.status'] = 'publish';
373
-				if ( isset( $where_params['DTT_EVT_start'] ) ) {
373
+				if (isset($where_params['DTT_EVT_start'])) {
374 374
 					$where_params['Datetime.DTT_EVT_start******'] = $where_params['DTT_EVT_start'];
375 375
 				}
376
-				if ( isset( $where_params['Datetime.DTT_EVT_end'] ) ) {
376
+				if (isset($where_params['Datetime.DTT_EVT_end'])) {
377 377
 					$where_params['Datetime.DTT_EVT_end*****'] = $where_params['DTT_EVT_end'];
378 378
 				}
379
-				$where_params['DTT_EVT_start'] = array('<',  $this->current_time_for_query( 'DTT_EVT_start' ) );
380
-				$where_params['DTT_EVT_end'] = array('>', $this->current_time_for_query( 'DTT_EVT_end' ) );
379
+				$where_params['DTT_EVT_start'] = array('<', $this->current_time_for_query('DTT_EVT_start'));
380
+				$where_params['DTT_EVT_end'] = array('>', $this->current_time_for_query('DTT_EVT_end'));
381 381
 				break;
382 382
 
383 383
 			case 'inactive' :
384
-				if ( isset( $where_params['Event.status'] ) ) unset( $where_params['Event.status'] );
385
-				if ( isset( $where_params['OR'] ) ) {
384
+				if (isset($where_params['Event.status'])) unset($where_params['Event.status']);
385
+				if (isset($where_params['OR'])) {
386 386
 					$where_params['AND']['OR'] = $where_params['OR'];
387 387
 				}
388
-				if ( isset( $where_params['DTT_EVT_end'] ) ) {
388
+				if (isset($where_params['DTT_EVT_end'])) {
389 389
 					$where_params['AND']['DTT_EVT_end****'] = $where_params['DTT_EVT_end'];
390
-					unset( $where_params['DTT_EVT_end'] );
390
+					unset($where_params['DTT_EVT_end']);
391 391
 				}
392 392
 
393
-				if ( isset( $where_params['DTT_EVT_start'] ) ) {
393
+				if (isset($where_params['DTT_EVT_start'])) {
394 394
 					$where_params['AND']['DTT_EVT_start'] = $where_params['DTT_EVT_start'];
395
-					unset( $where_params['DTT_EVT_start'] );
395
+					unset($where_params['DTT_EVT_start']);
396 396
 				}
397
-				$where_params['AND']['Event.status'] = array( '!=', 'publish' );
397
+				$where_params['AND']['Event.status'] = array('!=', 'publish');
398 398
 				break;
399 399
 		}
400 400
 
401 401
 		$query_params[0] = $where_params;
402 402
 		$query_params['group_by'] = array('dtt_year', 'dtt_month');
403
-		$query_params['order_by'] = array( 'DTT_EVT_start' => 'DESC' );
403
+		$query_params['order_by'] = array('DTT_EVT_start' => 'DESC');
404 404
 		$columns_to_select = array(
405 405
 			'dtt_year' => array('YEAR(DTT_EVT_start)', '%s'),
406 406
 			'dtt_month' => array('MONTHNAME(DTT_EVT_start)', '%s')
407 407
 			);
408
-		return $this->_get_all_wpdb_results( $query_params, OBJECT, $columns_to_select );
408
+		return $this->_get_all_wpdb_results($query_params, OBJECT, $columns_to_select);
409 409
 	}
410 410
 
411 411
 	/**
@@ -413,8 +413,8 @@  discard block
 block discarded – undo
413 413
 	 * for the tickets for each datetime)
414 414
 	 * @param EE_Datetime[] $datetimes
415 415
 	 */
416
-	public function update_sold($datetimes){
417
-		foreach($datetimes as $datetime){
416
+	public function update_sold($datetimes) {
417
+		foreach ($datetimes as $datetime) {
418 418
 			$datetime->update_sold();
419 419
 		}
420 420
 	}
@@ -429,10 +429,10 @@  discard block
 block discarded – undo
429 429
 	 * @param array $query_params
430 430
 	 * @return int of tickets available. If sold out, return less than 1. If infinite, returns EE_INF,  IF there are NO tickets attached to datetime then FALSE is returned.
431 431
 	 */
432
-	public function sum_tickets_currently_available_at_datetime( $DTT_ID, $query_params = array() ) {
433
-		$datetime = $this->get_one_by_ID( $DTT_ID );
434
-		if ( $datetime instanceof EE_Datetime ) {
435
-			return $datetime->tickets_remaining( $query_params );
432
+	public function sum_tickets_currently_available_at_datetime($DTT_ID, $query_params = array()) {
433
+		$datetime = $this->get_one_by_ID($DTT_ID);
434
+		if ($datetime instanceof EE_Datetime) {
435
+			return $datetime->tickets_remaining($query_params);
436 436
 		}
437 437
 		return 0;
438 438
 	}
@@ -454,36 +454,36 @@  discard block
 block discarded – undo
454 454
 	 *                EE_Datetime::upcoming
455 455
 	 *                EE_Datetime::expired
456 456
 	 */
457
-	public function get_datetime_counts_by_status( $stati_to_include = array(), $query_params = array() ) {
457
+	public function get_datetime_counts_by_status($stati_to_include = array(), $query_params = array()) {
458 458
 		//only accept where conditions for this query.
459
-		$_where = isset( $query_params[0] ) ? $query_params[0] : array();
459
+		$_where = isset($query_params[0]) ? $query_params[0] : array();
460 460
 		$status_query_args = array(
461 461
 				EE_Datetime::active => array_merge(
462 462
 						$_where,
463
-						array( 'DTT_EVT_start' => array( '<', time() ), 'DTT_EVT_end' => array( '>', time() ) )
463
+						array('DTT_EVT_start' => array('<', time()), 'DTT_EVT_end' => array('>', time()))
464 464
 				),
465 465
 				EE_Datetime::upcoming => array_merge(
466 466
 						$_where,
467
-						array( 'DTT_EVT_start' => array( '>', time() ) )
467
+						array('DTT_EVT_start' => array('>', time()))
468 468
 				),
469 469
 				EE_Datetime::expired => array_merge(
470 470
 						$_where,
471
-						array( 'DTT_EVT_end' => array('<', time() ) )
471
+						array('DTT_EVT_end' => array('<', time()))
472 472
 				)
473 473
 		);
474 474
 
475
-		if ( ! empty( $stati_to_include ) ) {
476
-			foreach( array_keys( $status_query_args ) as $status ) {
477
-				if ( ! in_array( $status, $stati_to_include ) ) {
478
-					unset( $status_query_args[$status] );
475
+		if ( ! empty($stati_to_include)) {
476
+			foreach (array_keys($status_query_args) as $status) {
477
+				if ( ! in_array($status, $stati_to_include)) {
478
+					unset($status_query_args[$status]);
479 479
 				}
480 480
 			}
481 481
 		}
482 482
 
483 483
 		//loop through and query counts for each stati.
484 484
 		$status_query_results = array();
485
-		foreach( $status_query_args as $status => $status_where_conditions ) {
486
-			$status_query_results[ $status ] = EEM_Datetime::count( array( $status_where_conditions ), 'DTT_ID', true );
485
+		foreach ($status_query_args as $status => $status_where_conditions) {
486
+			$status_query_results[$status] = EEM_Datetime::count(array($status_where_conditions), 'DTT_ID', true);
487 487
 		}
488 488
 
489 489
 		return $status_query_results;
@@ -497,9 +497,9 @@  discard block
 block discarded – undo
497 497
 	 * @param array $query_params
498 498
 	 * @return int
499 499
 	 */
500
-	public function get_datetime_count_for_status( $status = EE_Datetime::active, $query_params = array() ) {
501
-		$count = $this->get_datetime_counts_by_status( array( $status ), $query_params );
502
-		return ! empty( $count[$status] ) ? $count[$status] : 0;
500
+	public function get_datetime_count_for_status($status = EE_Datetime::active, $query_params = array()) {
501
+		$count = $this->get_datetime_counts_by_status(array($status), $query_params);
502
+		return ! empty($count[$status]) ? $count[$status] : 0;
503 503
 	}
504 504
 
505 505
 
Please login to merge, or discard this patch.
core/EE_Payment_Processor.core.php 1 patch
Spacing   +136 added lines, -136 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); }
2
-EE_Registry::instance()->load_class( 'Processor_Base' );
2
+EE_Registry::instance()->load_class('Processor_Base');
3 3
 /**
4 4
  *
5 5
  * EE_Payment_Processor
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 	 */
28 28
 	public static function instance() {
29 29
 		// check if class object is instantiated
30
-		if ( ! self::$_instance instanceof EE_Payment_Processor ) {
30
+		if ( ! self::$_instance instanceof EE_Payment_Processor) {
31 31
 			self::$_instance = new self();
32 32
 		}
33 33
 		return self::$_instance;
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 	 *@return EE_Payment_Processor
43 43
 	 */
44 44
 	private function __construct() {
45
-		do_action( 'AHEE__EE_Payment_Processor__construct' );
45
+		do_action('AHEE__EE_Payment_Processor__construct');
46 46
 	}
47 47
 
48 48
 
@@ -64,42 +64,42 @@  discard block
 block discarded – undo
64 64
 	 * @param string 	       						$cancel_url 	URL to return to if off-site payments are cancelled
65 65
 	 * @return EE_Payment
66 66
 	 */
67
-	public function process_payment( EE_Payment_Method $payment_method, EE_Transaction $transaction, $amount = NULL, $billing_form = NULL, $return_url = NULL, $method = 'CART', $by_admin = FALSE, $update_txn = TRUE, $cancel_url = '' ) {
68
-		if( $amount < 0 ) {
67
+	public function process_payment(EE_Payment_Method $payment_method, EE_Transaction $transaction, $amount = NULL, $billing_form = NULL, $return_url = NULL, $method = 'CART', $by_admin = FALSE, $update_txn = TRUE, $cancel_url = '') {
68
+		if ($amount < 0) {
69 69
 			throw new EE_Error( 
70 70
 					sprintf(
71
-							__( 'Attempting to make a payment for a negative amount of %1$d for transaction %2$d. That should be a refund', 'event_espresso' ),
71
+							__('Attempting to make a payment for a negative amount of %1$d for transaction %2$d. That should be a refund', 'event_espresso'),
72 72
 							$amount,
73 73
 							$transaction->ID() ) );
74 74
 		}
75 75
 		// verify payment method
76
-		$payment_method = EEM_Payment_Method::instance()->ensure_is_obj( $payment_method, TRUE );
76
+		$payment_method = EEM_Payment_Method::instance()->ensure_is_obj($payment_method, TRUE);
77 77
 		// verify transaction
78
-		EEM_Transaction::instance()->ensure_is_obj( $transaction );
79
-		$transaction->set_payment_method_ID( $payment_method->ID() );
78
+		EEM_Transaction::instance()->ensure_is_obj($transaction);
79
+		$transaction->set_payment_method_ID($payment_method->ID());
80 80
 		// verify payment method type
81
-		if ( $payment_method->type_obj() instanceof EE_PMT_Base ){
81
+		if ($payment_method->type_obj() instanceof EE_PMT_Base) {
82 82
 			$payment = $payment_method->type_obj()->process_payment(
83 83
 				$transaction,
84
-				min( $amount, $transaction->remaining() ),//make sure we don't overcharge
84
+				min($amount, $transaction->remaining()), //make sure we don't overcharge
85 85
 				$billing_form,
86 86
 				$return_url,
87
-				add_query_arg( array( 'ee_cancel_payment' => true ), $return_url ),
87
+				add_query_arg(array('ee_cancel_payment' => true), $return_url),
88 88
 				$method,
89 89
 				$by_admin
90 90
 			);
91 91
 			// check if payment method uses an off-site gateway
92
-			if ( $payment_method->type_obj()->payment_occurs() != EE_PMT_Base::offsite ) {
92
+			if ($payment_method->type_obj()->payment_occurs() != EE_PMT_Base::offsite) {
93 93
 				// don't process payments for off-site gateways yet because no payment has occurred yet
94
-				$this->update_txn_based_on_payment( $transaction, $payment, $update_txn );
94
+				$this->update_txn_based_on_payment($transaction, $payment, $update_txn);
95 95
 			}
96 96
 			return $payment;
97 97
 		} else {
98 98
 			EE_Error::add_error(
99 99
 				sprintf(
100
-					__( 'A valid payment method could not be determined due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso' ),
100
+					__('A valid payment method could not be determined due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso'),
101 101
 					'<br/>',
102
-					EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
102
+					EE_Registry::instance()->CFG->organization->get_pretty('email')
103 103
 				), __FILE__, __FUNCTION__, __LINE__
104 104
 			);
105 105
 			return NULL;
@@ -115,14 +115,14 @@  discard block
 block discarded – undo
115 115
 	 * @throws EE_Error
116 116
 	 * @return string
117 117
 	 */
118
-	public function get_ipn_url_for_payment_method( $transaction, $payment_method ){
118
+	public function get_ipn_url_for_payment_method($transaction, $payment_method) {
119 119
 		/** @type EE_Transaction $transaction */
120
-		$transaction = EEM_Transaction::instance()->ensure_is_obj( $transaction );
120
+		$transaction = EEM_Transaction::instance()->ensure_is_obj($transaction);
121 121
 		$primary_reg = $transaction->primary_registration();
122
-		if( ! $primary_reg instanceof EE_Registration ){
123
-			throw new EE_Error(sprintf(__("Cannot get IPN URL for transaction with ID %d because it has no primary registration", "event_espresso"),$transaction->ID()));
122
+		if ( ! $primary_reg instanceof EE_Registration) {
123
+			throw new EE_Error(sprintf(__("Cannot get IPN URL for transaction with ID %d because it has no primary registration", "event_espresso"), $transaction->ID()));
124 124
 		}
125
-		$payment_method = EEM_Payment_Method::instance()->ensure_is_obj($payment_method,true);
125
+		$payment_method = EEM_Payment_Method::instance()->ensure_is_obj($payment_method, true);
126 126
 		$url = add_query_arg(
127 127
 			array(
128 128
 				'e_reg_url_link'=>$primary_reg->reg_url_link(),
@@ -149,81 +149,81 @@  discard block
 block discarded – undo
149 149
 	 * @throws Exception
150 150
 	 * @return EE_Payment
151 151
 	 */
152
-	public function process_ipn( $_req_data, $transaction = NULL, $payment_method = NULL, $update_txn = true, $separate_IPN_request = true ){
153
-		$_req_data = $this->_remove_unusable_characters( $_req_data );
154
-		EE_Registry::instance()->load_model( 'Change_Log' );
155
-		EE_Processor_Base::set_IPN( $separate_IPN_request );
156
-		if( $transaction instanceof EE_Transaction && $payment_method instanceof EE_Payment_Method ){
157
-			$obj_for_log = EEM_Payment::instance()->get_one( array( array( 'TXN_ID' => $transaction->ID(), 'PMD_ID' => $payment_method->ID() ), 'order_by' => array( 'PAY_timestamp' => 'desc' ) ) );
158
-		}elseif( $payment_method instanceof EE_Payment ){
152
+	public function process_ipn($_req_data, $transaction = NULL, $payment_method = NULL, $update_txn = true, $separate_IPN_request = true) {
153
+		$_req_data = $this->_remove_unusable_characters($_req_data);
154
+		EE_Registry::instance()->load_model('Change_Log');
155
+		EE_Processor_Base::set_IPN($separate_IPN_request);
156
+		if ($transaction instanceof EE_Transaction && $payment_method instanceof EE_Payment_Method) {
157
+			$obj_for_log = EEM_Payment::instance()->get_one(array(array('TXN_ID' => $transaction->ID(), 'PMD_ID' => $payment_method->ID()), 'order_by' => array('PAY_timestamp' => 'desc')));
158
+		}elseif ($payment_method instanceof EE_Payment) {
159 159
 			$obj_for_log = $payment_method;
160
-		}elseif( $transaction instanceof EE_Transaction ){
160
+		}elseif ($transaction instanceof EE_Transaction) {
161 161
 			$obj_for_log = $transaction;
162
-		}else{
162
+		} else {
163 163
 			$obj_for_log = null;
164 164
 		}
165 165
 		$log = EEM_Change_Log::instance()->log(EEM_Change_Log::type_gateway, array('IPN data received'=>$_req_data), $obj_for_log);
166
-		try{
166
+		try {
167 167
 			/**
168 168
 			 * @var EE_Payment $payment
169 169
 			 */
170 170
 			$payment = NULL;
171
-			if($transaction && $payment_method){
171
+			if ($transaction && $payment_method) {
172 172
 				/** @type EE_Transaction $transaction */
173 173
 				$transaction = EEM_Transaction::instance()->ensure_is_obj($transaction);
174 174
 				/** @type EE_Payment_Method $payment_method */
175 175
 				$payment_method = EEM_Payment_Method::instance()->ensure_is_obj($payment_method);
176
-				if ( $payment_method->type_obj() instanceof EE_PMT_Base ) {
177
-						$payment = $payment_method->type_obj()->handle_ipn( $_req_data, $transaction );
176
+				if ($payment_method->type_obj() instanceof EE_PMT_Base) {
177
+						$payment = $payment_method->type_obj()->handle_ipn($_req_data, $transaction);
178 178
 						$log->set_object($payment);
179 179
 				} else {
180 180
 					// not a payment
181 181
 					EE_Error::add_error(
182 182
 						sprintf(
183
-							__( 'A valid payment method could not be determined due to a technical issue.%sPlease refresh your browser and try again or contact %s for assistance.', 'event_espresso' ),
183
+							__('A valid payment method could not be determined due to a technical issue.%sPlease refresh your browser and try again or contact %s for assistance.', 'event_espresso'),
184 184
 							'<br/>',
185
-							EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
185
+							EE_Registry::instance()->CFG->organization->get_pretty('email')
186 186
 						),
187 187
 						__FILE__, __FUNCTION__, __LINE__
188 188
 					);
189 189
 				}
190
-			}else{
190
+			} else {
191 191
 				//that's actually pretty ok. The IPN just wasn't able
192 192
 				//to identify which transaction or payment method this was for
193 193
 				// give all active payment methods a chance to claim it
194 194
 				$active_pms = EEM_Payment_Method::instance()->get_all_active();
195
-				foreach( $active_pms as $payment_method ){
196
-					try{
197
-						$payment = $payment_method->type_obj()->handle_unclaimed_ipn( $_req_data );
195
+				foreach ($active_pms as $payment_method) {
196
+					try {
197
+						$payment = $payment_method->type_obj()->handle_unclaimed_ipn($_req_data);
198 198
 						EEM_Change_Log::instance()->log(EEM_Change_Log::type_gateway, array('IPN data'=>$_req_data), $payment);
199 199
 						break;
200
-					} catch( EE_Error $e ) {
200
+					} catch (EE_Error $e) {
201 201
 						//that's fine- it apparently couldn't handle the IPN
202 202
 					}
203 203
 				}
204 204
 
205 205
 			}
206 206
 // 			EEM_Payment_Log::instance()->log("got to 7",$transaction,$payment_method);
207
-			if( $payment instanceof EE_Payment){
207
+			if ($payment instanceof EE_Payment) {
208 208
 				$payment->save();
209 209
 				//  update the TXN
210
-				$this->update_txn_based_on_payment( $transaction, $payment, $update_txn, $separate_IPN_request );
211
-			}else{
210
+				$this->update_txn_based_on_payment($transaction, $payment, $update_txn, $separate_IPN_request);
211
+			} else {
212 212
 				//we couldn't find the payment for this IPN... let's try and log at least SOMETHING
213
-				if($payment_method){
213
+				if ($payment_method) {
214 214
 					EEM_Change_Log::instance()->log(EEM_Change_Log::type_gateway, array('IPN data'=>$_req_data), $payment_method);
215
-				}elseif($transaction){
215
+				}elseif ($transaction) {
216 216
 					EEM_Change_Log::instance()->log(EEM_Change_Log::type_gateway, array('IPN data'=>$_req_data), $transaction);
217 217
 				}
218 218
 			}
219 219
 			return $payment;
220 220
 
221
-		} catch( EE_Error $e ) {
221
+		} catch (EE_Error $e) {
222 222
 			do_action(
223 223
 				'AHEE__log', __FILE__, __FUNCTION__, sprintf(
224
-					__( 'Error occurred while receiving IPN. Transaction: %1$s, req data: %2$s. The error was "%3$s"', 'event_espresso' ),
225
-					print_r( $transaction, TRUE ),
226
-					print_r( $_req_data, TRUE ),
224
+					__('Error occurred while receiving IPN. Transaction: %1$s, req data: %2$s. The error was "%3$s"', 'event_espresso'),
225
+					print_r($transaction, TRUE),
226
+					print_r($_req_data, TRUE),
227 227
 					$e->getMessage()
228 228
 				)
229 229
 			);
@@ -237,14 +237,14 @@  discard block
 block discarded – undo
237 237
 	 * @param array $request_data
238 238
 	 * @return array|string
239 239
 	 */
240
-	protected function _remove_unusable_characters( $request_data ) {
241
-		if( is_array( $request_data ) ) {
240
+	protected function _remove_unusable_characters($request_data) {
241
+		if (is_array($request_data)) {
242 242
 			$return_data = array();
243
-			foreach( $request_data as $key => $value ) {
244
-				$return_data[ $this->_remove_unusable_characters( $key ) ] = $this->_remove_unusable_characters( $value );
243
+			foreach ($request_data as $key => $value) {
244
+				$return_data[$this->_remove_unusable_characters($key)] = $this->_remove_unusable_characters($value);
245 245
 			}
246
-		}else{
247
-			$return_data =  preg_replace('/[^[:print:]]/', '', $request_data);
246
+		} else {
247
+			$return_data = preg_replace('/[^[:print:]]/', '', $request_data);
248 248
 		}
249 249
 		return $return_data;
250 250
 	}
@@ -266,13 +266,13 @@  discard block
 block discarded – undo
266 266
 	 * @return EE_Payment
267 267
 	 * @deprecated 4.6.24 method is no longer used. Instead it is up to client code, like SPCO, to call handle_ipn() for offsite gateways that don't receive separate IPNs
268 268
 	 */
269
-	public function finalize_payment_for( $transaction, $update_txn = TRUE ){
269
+	public function finalize_payment_for($transaction, $update_txn = TRUE) {
270 270
 		/** @var $transaction EE_Transaction */
271
-		$transaction = EEM_Transaction::instance()->ensure_is_obj( $transaction );
271
+		$transaction = EEM_Transaction::instance()->ensure_is_obj($transaction);
272 272
 		$last_payment_method = $transaction->payment_method();
273
-		if ( $last_payment_method instanceof EE_Payment_Method ) {
274
-			$payment = $last_payment_method->type_obj()->finalize_payment_for( $transaction );
275
-			$this->update_txn_based_on_payment( $transaction, $payment, $update_txn );
273
+		if ($last_payment_method instanceof EE_Payment_Method) {
274
+			$payment = $last_payment_method->type_obj()->finalize_payment_for($transaction);
275
+			$this->update_txn_based_on_payment($transaction, $payment, $update_txn);
276 276
 			return $payment;
277 277
 		} else {
278 278
 			return NULL;
@@ -289,10 +289,10 @@  discard block
 block discarded – undo
289 289
 	 * @internal param float $amount
290 290
 	 * @return EE_Payment
291 291
 	 */
292
-	public function process_refund( EE_Payment_Method $payment_method, EE_Payment $payment_to_refund, $refund_info = array() ){
293
-		if ( $payment_method instanceof EE_Payment_Method && $payment_method->type_obj()->supports_sending_refunds() ) {
294
-			$payment_method->type_obj()->process_refund( $payment_to_refund, $refund_info );
295
-			$this->update_txn_based_on_payment( $payment_to_refund->transaction(), $payment_to_refund );
292
+	public function process_refund(EE_Payment_Method $payment_method, EE_Payment $payment_to_refund, $refund_info = array()) {
293
+		if ($payment_method instanceof EE_Payment_Method && $payment_method->type_obj()->supports_sending_refunds()) {
294
+			$payment_method->type_obj()->process_refund($payment_to_refund, $refund_info);
295
+			$this->update_txn_based_on_payment($payment_to_refund->transaction(), $payment_to_refund);
296 296
 		}
297 297
 		return $payment_to_refund;
298 298
 	}
@@ -334,12 +334,12 @@  discard block
 block discarded – undo
334 334
 	 *                        TXN is locked before updating
335 335
 	 * @throws \EE_Error
336 336
 	 */
337
-	public function update_txn_based_on_payment( $transaction, $payment, $update_txn = true, $IPN = false ){
337
+	public function update_txn_based_on_payment($transaction, $payment, $update_txn = true, $IPN = false) {
338 338
 		$do_action = 'AHEE__EE_Payment_Processor__update_txn_based_on_payment__not_successful';
339 339
 		/** @type EE_Transaction $transaction */
340
-		$transaction = EEM_Transaction::instance()->ensure_is_obj( $transaction );
340
+		$transaction = EEM_Transaction::instance()->ensure_is_obj($transaction);
341 341
 		// can we freely update the TXN at this moment?
342
-		if ( $IPN && $transaction->is_locked() ) {
342
+		if ($IPN && $transaction->is_locked()) {
343 343
 			// don't update the transaction at this exact moment
344 344
 			// because the TXN is active in another request
345 345
 			EE_Cron_Tasks::schedule_update_transaction_with_payment(
@@ -349,40 +349,40 @@  discard block
 block discarded – undo
349 349
 			);
350 350
 		} else {
351 351
 			// verify payment and that it has been saved
352
-			if ( $payment instanceof EE_Payment && $payment->ID() ) {
353
-				if( $payment->payment_method() instanceof EE_Payment_Method && $payment->payment_method()->type_obj() instanceof EE_PMT_Base ){
354
-					$payment->payment_method()->type_obj()->update_txn_based_on_payment( $payment );
352
+			if ($payment instanceof EE_Payment && $payment->ID()) {
353
+				if ($payment->payment_method() instanceof EE_Payment_Method && $payment->payment_method()->type_obj() instanceof EE_PMT_Base) {
354
+					$payment->payment_method()->type_obj()->update_txn_based_on_payment($payment);
355 355
 					// update TXN registrations with payment info
356
-					$this->process_registration_payments( $transaction, $payment );
356
+					$this->process_registration_payments($transaction, $payment);
357 357
 				}
358 358
 				$do_action = $payment->just_approved() ? 'AHEE__EE_Payment_Processor__update_txn_based_on_payment__successful' : $do_action;
359 359
 			} else {
360 360
 				// send out notifications
361
-				add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true' );
361
+				add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true');
362 362
 				$do_action = 'AHEE__EE_Payment_Processor__update_txn_based_on_payment__no_payment_made';
363 363
 			}
364 364
 			// if this is an IPN, then we want to know the initial TXN status prior to updating the TXN
365 365
 			// so that we know whether the status has changed and notifications should be triggered
366
-			if ( $IPN ) {
366
+			if ($IPN) {
367 367
 				/** @type EE_Transaction_Processor $transaction_processor */
368
-				$transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' );
369
-				$transaction_processor->set_old_txn_status( $transaction->status_ID() );
368
+				$transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor');
369
+				$transaction_processor->set_old_txn_status($transaction->status_ID());
370 370
 			}
371
-			if ( $payment->status() !== EEM_Payment::status_id_failed ) {
371
+			if ($payment->status() !== EEM_Payment::status_id_failed) {
372 372
 				/** @type EE_Transaction_Payments $transaction_payments */
373
-				$transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' );
373
+				$transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments');
374 374
 				// set new value for total paid
375
-				$transaction_payments->calculate_total_payments_and_update_status( $transaction );
375
+				$transaction_payments->calculate_total_payments_and_update_status($transaction);
376 376
 				// call EE_Transaction_Processor::update_transaction_and_registrations_after_checkout_or_payment() ???
377
-				if ( $update_txn ) {
378
-					$this->_post_payment_processing( $transaction, $payment, $IPN );
377
+				if ($update_txn) {
378
+					$this->_post_payment_processing($transaction, $payment, $IPN);
379 379
 				}
380 380
 			}
381 381
 			// granular hook for others to use.
382
-			do_action( $do_action, $transaction, $payment );
383
-			do_action( 'AHEE_log', __CLASS__, __FUNCTION__, $do_action, '$do_action' );
382
+			do_action($do_action, $transaction, $payment);
383
+			do_action('AHEE_log', __CLASS__, __FUNCTION__, $do_action, '$do_action');
384 384
 			//global hook for others to use.
385
-			do_action( 'AHEE__EE_Payment_Processor__update_txn_based_on_payment', $transaction, $payment );
385
+			do_action('AHEE__EE_Payment_Processor__update_txn_based_on_payment', $transaction, $payment);
386 386
 		}
387 387
 	}
388 388
 
@@ -396,25 +396,25 @@  discard block
 block discarded – undo
396 396
 	 * @param EE_Registration[] $registrations
397 397
 	 * @throws \EE_Error
398 398
 	 */
399
-	public function process_registration_payments( EE_Transaction $transaction, EE_Payment $payment, $registrations = array() ) {
399
+	public function process_registration_payments(EE_Transaction $transaction, EE_Payment $payment, $registrations = array()) {
400 400
 		// only process if payment was successful
401
-		if ( $payment->status() !== EEM_Payment::status_id_approved ) {
401
+		if ($payment->status() !== EEM_Payment::status_id_approved) {
402 402
 			return;
403 403
 		}
404 404
 		//EEM_Registration::instance()->show_next_x_db_queries();
405
-		if ( empty( $registrations )) {
405
+		if (empty($registrations)) {
406 406
 			// find registrations with monies owing that can receive a payment
407
-			$registrations = $transaction->registrations( array(
407
+			$registrations = $transaction->registrations(array(
408 408
 				array(
409 409
 					// only these reg statuses can receive payments
410
-					'STS_ID'  => array( 'IN', EEM_Registration::reg_statuses_that_allow_payment() ),
411
-					'REG_final_price'  => array( '!=', 0 ),
412
-					'REG_final_price*' => array( '!=', 'REG_paid', true ),
410
+					'STS_ID'  => array('IN', EEM_Registration::reg_statuses_that_allow_payment()),
411
+					'REG_final_price'  => array('!=', 0),
412
+					'REG_final_price*' => array('!=', 'REG_paid', true),
413 413
 				)
414
-			) );
414
+			));
415 415
 		}
416 416
 		// still nothing ??!??
417
-		if ( empty( $registrations )) {
417
+		if (empty($registrations)) {
418 418
 			return;
419 419
 		}
420 420
 		// todo: break out the following logic into a separate strategy class
@@ -426,28 +426,28 @@  discard block
 block discarded – undo
426 426
 
427 427
 		$refund = $payment->is_a_refund();
428 428
 		// how much is available to apply to registrations?
429
-		$available_payment_amount = abs( $payment->amount() );
430
-		foreach ( $registrations as $registration ) {
431
-			if ( $registration instanceof EE_Registration ) {
429
+		$available_payment_amount = abs($payment->amount());
430
+		foreach ($registrations as $registration) {
431
+			if ($registration instanceof EE_Registration) {
432 432
 				// nothing left?
433
-				if ( $available_payment_amount <= 0 ) {
433
+				if ($available_payment_amount <= 0) {
434 434
 					break;
435 435
 				}
436
-				if ( $refund ) {
437
-					$available_payment_amount = $this->process_registration_refund( $registration, $payment, $available_payment_amount );
436
+				if ($refund) {
437
+					$available_payment_amount = $this->process_registration_refund($registration, $payment, $available_payment_amount);
438 438
 				} else {
439
-					$available_payment_amount = $this->process_registration_payment( $registration, $payment, $available_payment_amount );
439
+					$available_payment_amount = $this->process_registration_payment($registration, $payment, $available_payment_amount);
440 440
 				}
441 441
 			}
442 442
 		}
443
-		if ( $available_payment_amount > 0 && apply_filters( 'FHEE__EE_Payment_Processor__process_registration_payments__display_notifications', false ) ) {
443
+		if ($available_payment_amount > 0 && apply_filters('FHEE__EE_Payment_Processor__process_registration_payments__display_notifications', false)) {
444 444
 			EE_Error::add_attention(
445 445
 				sprintf(
446
-					__( 'A remainder of %1$s exists after applying this payment to Registration(s) %2$s.%3$sPlease verify that the original payment amount of %4$s is correct. If so, you should edit this payment and select at least one additional registration in the "Registrations to Apply Payment to" section, so that the remainder of this payment can be applied to the additional registration(s).', 'event_espresso' ),
447
-					EEH_Template::format_currency( $available_payment_amount ),
448
-					implode( ', ',  array_keys( $registrations ) ),
446
+					__('A remainder of %1$s exists after applying this payment to Registration(s) %2$s.%3$sPlease verify that the original payment amount of %4$s is correct. If so, you should edit this payment and select at least one additional registration in the "Registrations to Apply Payment to" section, so that the remainder of this payment can be applied to the additional registration(s).', 'event_espresso'),
447
+					EEH_Template::format_currency($available_payment_amount),
448
+					implode(', ', array_keys($registrations)),
449 449
 					'<br/>',
450
-					EEH_Template::format_currency( $payment->amount() )
450
+					EEH_Template::format_currency($payment->amount())
451 451
 				),
452 452
 				__FILE__, __FUNCTION__, __LINE__
453 453
 			);
@@ -464,17 +464,17 @@  discard block
 block discarded – undo
464 464
 	 * @param float $available_payment_amount
465 465
 	 * @return float
466 466
 	 */
467
-	public function process_registration_payment( EE_Registration $registration, EE_Payment $payment, $available_payment_amount = 0.00 ) {
467
+	public function process_registration_payment(EE_Registration $registration, EE_Payment $payment, $available_payment_amount = 0.00) {
468 468
 		$owing = $registration->final_price() - $registration->paid();
469
-		if ( $owing > 0 ) {
469
+		if ($owing > 0) {
470 470
 			// don't allow payment amount to exceed the available payment amount, OR the amount owing
471
-			$payment_amount = min( $available_payment_amount, $owing );
471
+			$payment_amount = min($available_payment_amount, $owing);
472 472
 			// update $available_payment_amount
473 473
 			$available_payment_amount = $available_payment_amount - $payment_amount;
474 474
 			//calculate and set new REG_paid
475
-			$registration->set_paid( $registration->paid() + $payment_amount );
475
+			$registration->set_paid($registration->paid() + $payment_amount);
476 476
 			// now save it
477
-			$this->_apply_registration_payment( $registration, $payment, $payment_amount );
477
+			$this->_apply_registration_payment($registration, $payment, $payment_amount);
478 478
 		}
479 479
 		return $available_payment_amount;
480 480
 	}
@@ -489,19 +489,19 @@  discard block
 block discarded – undo
489 489
 	 * @param float $payment_amount
490 490
 	 * @return float
491 491
 	 */
492
-	protected function _apply_registration_payment( EE_Registration $registration, EE_Payment $payment, $payment_amount = 0.00 ) {
492
+	protected function _apply_registration_payment(EE_Registration $registration, EE_Payment $payment, $payment_amount = 0.00) {
493 493
 		// find any existing reg payment records for this registration and payment
494 494
 		$existing_reg_payment = EEM_Registration_Payment::instance()->get_one(
495
-			array( array( 'REG_ID' => $registration->ID(), 'PAY_ID' => $payment->ID() ) )
495
+			array(array('REG_ID' => $registration->ID(), 'PAY_ID' => $payment->ID()))
496 496
 		);
497 497
 		// if existing registration payment exists
498
-		if ( $existing_reg_payment instanceof EE_Registration_Payment ) {
498
+		if ($existing_reg_payment instanceof EE_Registration_Payment) {
499 499
 			// then update that record
500
-			$existing_reg_payment->set_amount( $payment_amount );
500
+			$existing_reg_payment->set_amount($payment_amount);
501 501
 			$existing_reg_payment->save();
502 502
 		} else {
503 503
 			// or add new relation between registration and payment and set amount
504
-			$registration->_add_relation_to( $payment, 'Payment', array( 'RPY_amount' => $payment_amount ) );
504
+			$registration->_add_relation_to($payment, 'Payment', array('RPY_amount' => $payment_amount));
505 505
 			// make it stick
506 506
 			$registration->save();
507 507
 		}
@@ -517,21 +517,21 @@  discard block
 block discarded – undo
517 517
 	 * @param float $available_refund_amount - IMPORTANT !!! SEND AVAILABLE REFUND AMOUNT AS A POSITIVE NUMBER
518 518
 	 * @return float
519 519
 	 */
520
-	public function process_registration_refund( EE_Registration $registration, EE_Payment $payment, $available_refund_amount = 0.00 ) {
520
+	public function process_registration_refund(EE_Registration $registration, EE_Payment $payment, $available_refund_amount = 0.00) {
521 521
 		//EEH_Debug_Tools::printr( $payment->amount(), '$payment->amount()', __FILE__, __LINE__ );
522
-		if ( $registration->paid() > 0 ) {
522
+		if ($registration->paid() > 0) {
523 523
 			// ensure $available_refund_amount is NOT negative
524
-			$available_refund_amount = abs( $available_refund_amount );
524
+			$available_refund_amount = abs($available_refund_amount);
525 525
 			// don't allow refund amount to exceed the available payment amount, OR the amount paid
526
-			$refund_amount = min( $available_refund_amount, $registration->paid() );
526
+			$refund_amount = min($available_refund_amount, $registration->paid());
527 527
 			// update $available_payment_amount
528 528
 			$available_refund_amount = $available_refund_amount - $refund_amount;
529 529
 			//calculate and set new REG_paid
530
-			$registration->set_paid( $registration->paid() - $refund_amount );
530
+			$registration->set_paid($registration->paid() - $refund_amount);
531 531
 			// convert payment amount back to a negative value for storage in the db
532
-			$refund_amount = abs( $refund_amount ) * -1;
532
+			$refund_amount = abs($refund_amount) * -1;
533 533
 			// now save it
534
-			$this->_apply_registration_payment( $registration, $payment, $refund_amount );
534
+			$this->_apply_registration_payment($registration, $payment, $refund_amount);
535 535
 		}
536 536
 		return $available_refund_amount;
537 537
 	}
@@ -549,12 +549,12 @@  discard block
 block discarded – undo
549 549
 	 * @param EE_Payment     $payment
550 550
 	 * @param bool           $IPN
551 551
 	 */
552
-	protected function _post_payment_processing( EE_Transaction $transaction, EE_Payment $payment, $IPN = false ) {
552
+	protected function _post_payment_processing(EE_Transaction $transaction, EE_Payment $payment, $IPN = false) {
553 553
 
554 554
 		/** @type EE_Transaction_Processor $transaction_processor */
555
-		$transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' );
555
+		$transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor');
556 556
 		// is the Payment Options Reg Step completed ?
557
-		$payment_options_step_completed = $transaction_processor->reg_step_completed( $transaction, 'payment_options' );
557
+		$payment_options_step_completed = $transaction_processor->reg_step_completed($transaction, 'payment_options');
558 558
 		// DEBUG LOG
559 559
 		//$this->log(
560 560
 		//	__CLASS__, __FUNCTION__, __LINE__,
@@ -567,14 +567,14 @@  discard block
 block discarded – undo
567 567
 		// if the Payment Options Reg Step is completed...
568 568
 		$revisit = $payment_options_step_completed === true ? true : false;
569 569
 		// then this is kinda sorta a revisit with regards to payments at least
570
-		$transaction_processor->set_revisit( $revisit );
570
+		$transaction_processor->set_revisit($revisit);
571 571
 		// if this is an IPN, let's consider the Payment Options Reg Step completed if not already
572 572
 		if (
573 573
 			$IPN &&
574 574
 			$payment_options_step_completed !== true &&
575
-			( $payment->is_approved() || $payment->is_pending() )
575
+			($payment->is_approved() || $payment->is_pending())
576 576
 		) {
577
-			$payment_options_step_completed = $transaction_processor->set_reg_step_completed( $transaction, 'payment_options' );
577
+			$payment_options_step_completed = $transaction_processor->set_reg_step_completed($transaction, 'payment_options');
578 578
 		}
579 579
 		// DEBUG LOG
580 580
 		//$this->log(
@@ -586,11 +586,11 @@  discard block
 block discarded – undo
586 586
 		//	)
587 587
 		//);
588 588
 		/** @type EE_Transaction_Payments $transaction_payments */
589
-		$transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' );
589
+		$transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments');
590 590
 		// maybe update status, but don't save transaction just yet
591
-		$transaction_payments->update_transaction_status_based_on_total_paid( $transaction, false );
591
+		$transaction_payments->update_transaction_status_based_on_total_paid($transaction, false);
592 592
 		// check if 'finalize_registration' step has been completed...
593
-		$finalized = $transaction_processor->reg_step_completed( $transaction, 'finalize_registration' );
593
+		$finalized = $transaction_processor->reg_step_completed($transaction, 'finalize_registration');
594 594
 		// DEBUG LOG
595 595
 		//$this->log(
596 596
 		//	__CLASS__, __FUNCTION__, __LINE__,
@@ -601,9 +601,9 @@  discard block
 block discarded – undo
601 601
 		//	)
602 602
 		//);
603 603
 		//  if this is an IPN and the final step has not been initiated
604
-		if ( $IPN && $payment_options_step_completed && $finalized === false ) {
604
+		if ($IPN && $payment_options_step_completed && $finalized === false) {
605 605
 			// and if it hasn't already been set as being started...
606
-			$finalized = $transaction_processor->set_reg_step_initiated( $transaction, 'finalize_registration' );
606
+			$finalized = $transaction_processor->set_reg_step_initiated($transaction, 'finalize_registration');
607 607
 			// DEBUG LOG
608 608
 			//$this->log(
609 609
 			//	__CLASS__, __FUNCTION__, __LINE__,
@@ -616,13 +616,13 @@  discard block
 block discarded – undo
616 616
 		}
617 617
 		$transaction->save();
618 618
 		// because the above will return false if the final step was not fully completed, we need to check again...
619
-		if ( $IPN && $finalized !== false ) {
619
+		if ($IPN && $finalized !== false) {
620 620
 			// and if we are all good to go, then send out notifications
621
-			add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true' );
621
+			add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true');
622 622
 			// DEBUG LOG
623 623
 			//$this->log( __CLASS__, __FUNCTION__, __LINE__, $transaction );
624 624
 			//ok, now process the transaction according to the payment
625
-			$transaction_processor->update_transaction_and_registrations_after_checkout_or_payment( $transaction, $payment );
625
+			$transaction_processor->update_transaction_and_registrations_after_checkout_or_payment($transaction, $payment);
626 626
 		}
627 627
 		// DEBUG LOG
628 628
 		//$this->log(
Please login to merge, or discard this patch.
reg_steps/payment_options/EE_SPCO_Reg_Step_Payment_Options.class.php 2 patches
Doc Comments   +13 added lines, -11 removed lines patch added patch discarded remove patch
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
 
104 104
 
105 105
 	/**
106
-	 * @return null
106
+	 * @return EE_Line_Item_Display
107 107
 	 */
108 108
 	public function line_item_display() {
109 109
 		return $this->line_item_display;
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
 
113 113
 
114 114
 	/**
115
-	 * @param null $line_item_display
115
+	 * @param EE_Line_Item_Display $line_item_display
116 116
 	 */
117 117
 	public function set_line_item_display( $line_item_display ) {
118 118
 		$this->line_item_display = $line_item_display;
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
 
181 181
 
182 182
 	/**
183
-	 * @return bool
183
+	 * @return EE_Form_Section_Proper
184 184
 	 */
185 185
 	public function generate_reg_form() {
186 186
 		EE_Registry::instance()->load_helper( 'HTML' );
@@ -537,6 +537,7 @@  discard block
 block discarded – undo
537 537
 	 *    _apply_registration_payments_to_amount_owing
538 538
 	 *
539 539
 	 * @access    protected
540
+	 * @param EE_Base_Class[] $registrations
540 541
 	 * @return    void
541 542
 	 */
542 543
 	protected function _apply_registration_payments_to_amount_owing( $registrations ) {
@@ -754,7 +755,7 @@  discard block
 block discarded – undo
754 755
 	 * get_billing_form_html_for_payment_method
755 756
 	 *
756 757
 	 * @access public
757
-	 * @return string
758
+	 * @return boolean
758 759
 	 */
759 760
 	public function get_billing_form_html_for_payment_method() {
760 761
 		// how have they chosen to pay?
@@ -874,7 +875,7 @@  discard block
 block discarded – undo
874 875
 	 * switch_payment_method
875 876
 	 *
876 877
 	 * @access public
877
-	 * @return string
878
+	 * @return boolean
878 879
 	 */
879 880
 	public function switch_payment_method() {
880 881
 		if ( ! $this->_verify_payment_method_is_set() ) {
@@ -1041,7 +1042,7 @@  discard block
 block discarded – undo
1041 1042
 
1042 1043
 	/**
1043 1044
 	 * process_reg_step
1044
-	 * @return boolean
1045
+	 * @return null|boolean
1045 1046
 	 */
1046 1047
 	public function process_reg_step() {
1047 1048
 		// how have they chosen to pay?
@@ -1117,7 +1118,7 @@  discard block
 block discarded – undo
1117 1118
 	 *    update_reg_step
1118 1119
 	 *    this is the final step after a user  revisits the site to retry a payment
1119 1120
 	 *
1120
-	 * @return boolean
1121
+	 * @return null|boolean
1121 1122
 	 */
1122 1123
 	public function update_reg_step() {
1123 1124
 		$success = TRUE;
@@ -1399,7 +1400,7 @@  discard block
 block discarded – undo
1399 1400
 	 *
1400 1401
 	 * 	@access 	private
1401 1402
 	 * 	@type 	EE_Payment_Method $payment_method
1402
-	 * 	@return 	mixed	EE_Payment | boolean
1403
+	 * 	@return 	EE_Payment|null	EE_Payment | boolean
1403 1404
 	 */
1404 1405
 	private function _attempt_payment( EE_Payment_Method $payment_method ) {
1405 1406
 		$payment =NULL;
@@ -1602,6 +1603,7 @@  discard block
 block discarded – undo
1602 1603
 	 * @access private
1603 1604
 	 * @type    EE_Payment $payment
1604 1605
 	 * @param string $payment_occurs
1606
+	 * @param EE_Payment|null $payment
1605 1607
 	 * @return bool
1606 1608
 	 * @throws \EE_Error
1607 1609
 	 */
@@ -1708,7 +1710,7 @@  discard block
 block discarded – undo
1708 1710
 	 * 		or present the payment options again
1709 1711
 	 *
1710 1712
 	 * @access private
1711
-	 * @return EE_Payment | FALSE
1713
+	 * @return boolean | FALSE
1712 1714
 	 */
1713 1715
 	public function process_gateway_response() {
1714 1716
 		$payment = null;
@@ -1769,7 +1771,7 @@  discard block
 block discarded – undo
1769 1771
 	 * _validate_return
1770 1772
 	 *
1771 1773
 	 * @access private
1772
-	 * @return bool
1774
+	 * @return boolean|null
1773 1775
 	 */
1774 1776
 	private function _validate_offsite_return() {
1775 1777
 		$TXN_ID = (int)EE_Registry::instance()->REQ->get( 'spco_txn', 0 );
@@ -1836,7 +1838,7 @@  discard block
 block discarded – undo
1836 1838
 	 *
1837 1839
 	 * @access private
1838 1840
 	 * @param \EE_Registration $primary_registrant
1839
-	 * @return bool
1841
+	 * @return false|null
1840 1842
 	 */
1841 1843
 	private function _redirect_wayward_request( EE_Registration $primary_registrant ) {
1842 1844
 		if ( ! $primary_registrant instanceof EE_Registration ) {
Please login to merge, or discard this patch.
Spacing   +369 added lines, -369 removed lines patch added patch discarded remove patch
@@ -28,15 +28,15 @@  discard block
 block discarded – undo
28 28
 	 *  @return 	void
29 29
 	 */
30 30
 	public static function set_hooks() {
31
-		add_filter( 'FHEE__SPCO__EE_Line_Item_Filter_Collection', array( 'EE_SPCO_Reg_Step_Payment_Options', 'add_spco_line_item_filters' ) );
32
-		add_action( 'wp_ajax_switch_spco_billing_form', array( 'EE_SPCO_Reg_Step_Payment_Options', 'switch_spco_billing_form' ));
33
-		add_action( 'wp_ajax_nopriv_switch_spco_billing_form', array( 'EE_SPCO_Reg_Step_Payment_Options', 'switch_spco_billing_form' ));
34
-		add_action( 'wp_ajax_save_payer_details', array( 'EE_SPCO_Reg_Step_Payment_Options', 'save_payer_details' ));
35
-		add_action( 'wp_ajax_nopriv_save_payer_details', array( 'EE_SPCO_Reg_Step_Payment_Options', 'save_payer_details' ));
36
-		add_action( 'wp_ajax_get_transaction_details_for_gateways', array( 'EE_SPCO_Reg_Step_Payment_Options', 'get_transaction_details' ) );
37
-		add_action( 'wp_ajax_nopriv_get_transaction_details_for_gateways', array( 'EE_SPCO_Reg_Step_Payment_Options', 'get_transaction_details' )
31
+		add_filter('FHEE__SPCO__EE_Line_Item_Filter_Collection', array('EE_SPCO_Reg_Step_Payment_Options', 'add_spco_line_item_filters'));
32
+		add_action('wp_ajax_switch_spco_billing_form', array('EE_SPCO_Reg_Step_Payment_Options', 'switch_spco_billing_form'));
33
+		add_action('wp_ajax_nopriv_switch_spco_billing_form', array('EE_SPCO_Reg_Step_Payment_Options', 'switch_spco_billing_form'));
34
+		add_action('wp_ajax_save_payer_details', array('EE_SPCO_Reg_Step_Payment_Options', 'save_payer_details'));
35
+		add_action('wp_ajax_nopriv_save_payer_details', array('EE_SPCO_Reg_Step_Payment_Options', 'save_payer_details'));
36
+		add_action('wp_ajax_get_transaction_details_for_gateways', array('EE_SPCO_Reg_Step_Payment_Options', 'get_transaction_details'));
37
+		add_action('wp_ajax_nopriv_get_transaction_details_for_gateways', array('EE_SPCO_Reg_Step_Payment_Options', 'get_transaction_details')
38 38
 		);
39
-		add_filter( 'FHEE__EED_Recaptcha___bypass_recaptcha__bypass_request_params_array', array( 'EE_SPCO_Reg_Step_Payment_Options', 'bypass_recaptcha_for_load_payment_method' ), 10, 1 );
39
+		add_filter('FHEE__EED_Recaptcha___bypass_recaptcha__bypass_request_params_array', array('EE_SPCO_Reg_Step_Payment_Options', 'bypass_recaptcha_for_load_payment_method'), 10, 1);
40 40
 	}
41 41
 
42 42
 
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 	 * 	ajax switch_spco_billing_form
46 46
 	 */
47 47
 	public static function switch_spco_billing_form() {
48
-		EED_Single_Page_Checkout::process_ajax_request( 'switch_payment_method' );
48
+		EED_Single_Page_Checkout::process_ajax_request('switch_payment_method');
49 49
 	}
50 50
 
51 51
 
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 	 * 	ajax save_payer_details
55 55
 	 */
56 56
 	public static function save_payer_details() {
57
-		EED_Single_Page_Checkout::process_ajax_request( 'save_payer_details_via_ajax' );
57
+		EED_Single_Page_Checkout::process_ajax_request('save_payer_details_via_ajax');
58 58
 	}
59 59
 
60 60
 
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 	 * 	ajax get_transaction_details
64 64
 	 */
65 65
 	public static function get_transaction_details() {
66
-		EED_Single_Page_Checkout::process_ajax_request( 'get_transaction_details_for_gateways' );
66
+		EED_Single_Page_Checkout::process_ajax_request('get_transaction_details_for_gateways');
67 67
 	}
68 68
 
69 69
 
@@ -91,13 +91,13 @@  discard block
 block discarded – undo
91 91
 	 * @param    EE_Checkout $checkout
92 92
 	 * @return    \EE_SPCO_Reg_Step_Payment_Options
93 93
 	 */
94
-	public function __construct( EE_Checkout $checkout ) {
94
+	public function __construct(EE_Checkout $checkout) {
95 95
 		$this->_slug = 'payment_options';
96 96
 		$this->_name = __('Payment Options', 'event_espresso');
97
-		$this->_template = SPCO_REG_STEPS_PATH . $this->_slug . DS . 'payment_options_main.template.php';
97
+		$this->_template = SPCO_REG_STEPS_PATH.$this->_slug.DS.'payment_options_main.template.php';
98 98
 		$this->checkout = $checkout;
99 99
 		$this->_reset_success_message();
100
-		$this->set_instructions( __('Please select a method of payment and provide any necessary billing information before proceeding.', 'event_espresso'));
100
+		$this->set_instructions(__('Please select a method of payment and provide any necessary billing information before proceeding.', 'event_espresso'));
101 101
 	}
102 102
 
103 103
 
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
 	/**
115 115
 	 * @param null $line_item_display
116 116
 	 */
117
-	public function set_line_item_display( $line_item_display ) {
117
+	public function set_line_item_display($line_item_display) {
118 118
 		$this->line_item_display = $line_item_display;
119 119
 	}
120 120
 
@@ -125,9 +125,9 @@  discard block
 block discarded – undo
125 125
 	 * @return void
126 126
 	 */
127 127
 	public function translate_js_strings() {
128
-		EE_Registry::$i18n_js_strings['no_payment_method'] = __( 'Please select a method of payment in order to continue.', 'event_espresso' );
129
-		EE_Registry::$i18n_js_strings['invalid_payment_method'] = __( 'A valid method of payment could not be determined. Please refresh the page and try again.', 'event_espresso' );
130
-		EE_Registry::$i18n_js_strings['forwarding_to_offsite'] = __( 'Forwarding to Secure Payment Provider.', 'event_espresso' );
128
+		EE_Registry::$i18n_js_strings['no_payment_method'] = __('Please select a method of payment in order to continue.', 'event_espresso');
129
+		EE_Registry::$i18n_js_strings['invalid_payment_method'] = __('A valid method of payment could not be determined. Please refresh the page and try again.', 'event_espresso');
130
+		EE_Registry::$i18n_js_strings['forwarding_to_offsite'] = __('Forwarding to Secure Payment Provider.', 'event_espresso');
131 131
 	}
132 132
 
133 133
 
@@ -156,20 +156,20 @@  discard block
 block discarded – undo
156 156
 			// 	$ 0.00 transactions (no payment required)
157 157
 			! $this->checkout->payment_required()
158 158
 			// but do NOT remove if current action being called belongs to this reg step
159
-			&& ! is_callable( array( $this, $this->checkout->action ) )
159
+			&& ! is_callable(array($this, $this->checkout->action))
160 160
 			&& ! $this->completed()
161 161
 		) {
162 162
 			// and if so, then we no longer need the Payment Options step
163
-			if ( $this->is_current_step() ) {
163
+			if ($this->is_current_step()) {
164 164
 				$this->checkout->generate_reg_form = false;
165 165
 			}
166
-			$this->checkout->remove_reg_step( $this->_slug );
166
+			$this->checkout->remove_reg_step($this->_slug);
167 167
 			// DEBUG LOG
168 168
 			//$this->checkout->log( __CLASS__, __FUNCTION__, __LINE__ );
169 169
 			return false;
170 170
 		}
171 171
 		// load EEM_Payment_Method
172
-		EE_Registry::instance()->load_model( 'Payment_Method' );
172
+		EE_Registry::instance()->load_model('Payment_Method');
173 173
 		// get all active payment methods
174 174
 		$this->checkout->available_payment_methods = EEM_Payment_Method::instance()->get_all_for_transaction(
175 175
 			$this->checkout->transaction, EEM_Payment_Method::scope_cart
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
 	 * @return bool
184 184
 	 */
185 185
 	public function generate_reg_form() {
186
-		EE_Registry::instance()->load_helper( 'HTML' );
186
+		EE_Registry::instance()->load_helper('HTML');
187 187
 		// reset in case someone changes their mind
188 188
 		$this->_reset_selected_method_of_payment();
189 189
 		// set some defaults
@@ -194,15 +194,15 @@  discard block
 block discarded – undo
194 194
 		$sold_out_events = array();
195 195
 		$reg_count = 0;
196 196
 		// loop thru registrations to gather info
197
-		$registrations = $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params );
198
-		foreach ( $registrations as $registration ) {
197
+		$registrations = $this->checkout->transaction->registrations($this->checkout->reg_cache_where_params);
198
+		foreach ($registrations as $registration) {
199 199
 			/** @var $registration EE_Registration */
200 200
 			$reg_count++;
201 201
 			// if returning registrant is Approved then do NOT do this
202
-			if ( ! ( $this->checkout->revisit && $registration->status_ID() == EEM_Registration::status_id_approved )) {
203
-				if ( $registration->event()->is_sold_out() || $registration->event()->is_sold_out( true )) {
202
+			if ( ! ($this->checkout->revisit && $registration->status_ID() == EEM_Registration::status_id_approved)) {
203
+				if ($registration->event()->is_sold_out() || $registration->event()->is_sold_out(true)) {
204 204
 					// add event to list of events that are sold out
205
-					$sold_out_events[ $registration->event()->ID() ] = $registration->event();
205
+					$sold_out_events[$registration->event()->ID()] = $registration->event();
206 206
 					do_action(
207 207
 						'AHEE__EE_SPCO_Reg_Step_Payment_Options__generate_reg_form__sold_out_event',
208 208
 						$registration->event(),
@@ -210,9 +210,9 @@  discard block
 block discarded – undo
210 210
 					);
211 211
 				}
212 212
 				// event requires admin approval
213
-				if ( $registration->status_ID() == EEM_Registration::status_id_not_approved ) {
213
+				if ($registration->status_ID() == EEM_Registration::status_id_not_approved) {
214 214
 					// add event to list of events with pre-approval reg status
215
-					$registrations_requiring_pre_approval[ $registration->ID() ] = $registration;
215
+					$registrations_requiring_pre_approval[$registration->ID()] = $registration;
216 216
 					do_action(
217 217
 						'AHEE__EE_SPCO_Reg_Step_Payment_Options__generate_reg_form__event_requires_pre_approval',
218 218
 						$registration->event(),
@@ -221,29 +221,29 @@  discard block
 block discarded – undo
221 221
 				}
222 222
 			}
223 223
 			// are they allowed to pay now and is there monies owing?
224
-			if ( $registration->owes_monies_and_can_pay() ) {
225
-				$registrations_requiring_payment[ $registration->ID() ] = $registration;
224
+			if ($registration->owes_monies_and_can_pay()) {
225
+				$registrations_requiring_payment[$registration->ID()] = $registration;
226 226
 				do_action(
227 227
 					'AHEE__EE_SPCO_Reg_Step_Payment_Options__generate_reg_form__event_requires_payment',
228 228
 					$registration->event(),
229 229
 					$this
230 230
 				);
231
-			} else if ( ! $this->checkout->revisit && $registration->status_ID() != EEM_Registration::status_id_not_approved && $registration->ticket()->is_free()  ) {
232
-				$registrations_for_free_events[ $registration->event()->ID() ] = $registration;
231
+			} else if ( ! $this->checkout->revisit && $registration->status_ID() != EEM_Registration::status_id_not_approved && $registration->ticket()->is_free()) {
232
+				$registrations_for_free_events[$registration->event()->ID()] = $registration;
233 233
 			}
234 234
 		}
235 235
 		$subsections = array();
236 236
 		// now decide which template to load
237
-		if ( ! empty( $sold_out_events )) {
238
-			$subsections['sold_out_events'] = $this->_sold_out_events( $sold_out_events );
237
+		if ( ! empty($sold_out_events)) {
238
+			$subsections['sold_out_events'] = $this->_sold_out_events($sold_out_events);
239 239
 		}
240
-		if ( ! empty( $registrations_requiring_pre_approval )) {
241
-			$subsections['registrations_requiring_pre_approval'] = $this->_registrations_requiring_pre_approval( $registrations_requiring_pre_approval );
240
+		if ( ! empty($registrations_requiring_pre_approval)) {
241
+			$subsections['registrations_requiring_pre_approval'] = $this->_registrations_requiring_pre_approval($registrations_requiring_pre_approval);
242 242
 		}
243
-		if ( ! empty( $registrations_for_free_events ) ) {
244
-			$subsections[ 'no_payment_required' ] = $this->_no_payment_required( $registrations_for_free_events );
243
+		if ( ! empty($registrations_for_free_events)) {
244
+			$subsections['no_payment_required'] = $this->_no_payment_required($registrations_for_free_events);
245 245
 		}
246
-		if ( ! empty( $registrations_requiring_payment ) ) {
246
+		if ( ! empty($registrations_requiring_payment)) {
247 247
 			// autoload Line_Item_Display classes
248 248
 			EEH_Autoloader::register_line_item_filter_autoloaders();
249 249
 			$line_item_filter_processor = new EE_Line_Item_Filter_Processor(
@@ -254,17 +254,17 @@  discard block
 block discarded – undo
254 254
 				$this->checkout->cart->get_grand_total()
255 255
 			);
256 256
 			$filtered_line_item_tree = $line_item_filter_processor->process();
257
-			if ( $this->checkout->amount_owing > 0 ) {
257
+			if ($this->checkout->amount_owing > 0) {
258 258
 				EEH_Autoloader::register_line_item_display_autoloaders();
259
-				$this->set_line_item_display( new EE_Line_Item_Display( 'spco' ) );
260
-				$subsections[ 'payment_options' ] = $this->_display_payment_options(
259
+				$this->set_line_item_display(new EE_Line_Item_Display('spco'));
260
+				$subsections['payment_options'] = $this->_display_payment_options(
261 261
 					$this->line_item_display->display_line_item(
262 262
 						$filtered_line_item_tree,
263
-						array( 'registrations' => $registrations )
263
+						array('registrations' => $registrations)
264 264
 					)
265 265
 				);
266 266
 				$this->checkout->amount_owing = $filtered_line_item_tree->total();
267
-				$this->_apply_registration_payments_to_amount_owing( $registrations );
267
+				$this->_apply_registration_payments_to_amount_owing($registrations);
268 268
 			}
269 269
 		} else {
270 270
 			$this->_hide_reg_step_submit_button_if_revisit();
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
 	 * @param \EE_Line_Item_Filter_Collection $line_item_filter_collection
298 298
 	 * @return \EE_Line_Item_Filter_Collection
299 299
 	 */
300
-	public static function add_spco_line_item_filters( EE_Line_Item_Filter_Collection $line_item_filter_collection ) {
300
+	public static function add_spco_line_item_filters(EE_Line_Item_Filter_Collection $line_item_filter_collection) {
301 301
 		$line_item_filter_collection->add(
302 302
 			new EE_Billable_Line_Item_Filter(
303 303
 				EE_Registry::instance()->SSN->checkout()->transaction->registrations(
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
 				)
306 306
 			)
307 307
 		);
308
-		$line_item_filter_collection->add( new EE_Non_Zero_Line_Item_Filter() );
308
+		$line_item_filter_collection->add(new EE_Non_Zero_Line_Item_Filter());
309 309
 		return $line_item_filter_collection;
310 310
 	}
311 311
 
@@ -319,8 +319,8 @@  discard block
 block discarded – undo
319 319
 	 * @return void
320 320
 	 */
321 321
 	protected function _hide_reg_step_submit_button_if_revisit() {
322
-		if ( $this->checkout->revisit ) {
323
-			add_filter( 'FHEE__EE_SPCO_Reg_Step__reg_step_submit_button__sbmt_btn_html', '__return_empty_string' );
322
+		if ($this->checkout->revisit) {
323
+			add_filter('FHEE__EE_SPCO_Reg_Step__reg_step_submit_button__sbmt_btn_html', '__return_empty_string');
324 324
 		}
325 325
 	}
326 326
 
@@ -331,12 +331,12 @@  discard block
 block discarded – undo
331 331
 	 * @param \EE_Event[] $sold_out_events_array
332 332
 	 * @return \EE_Form_Section_Proper
333 333
 	 */
334
-	private function _sold_out_events( $sold_out_events_array = array() ) {
334
+	private function _sold_out_events($sold_out_events_array = array()) {
335 335
 		// set some defaults
336 336
 		$this->checkout->selected_method_of_payment = 'events_sold_out';
337 337
 		$sold_out_events = '';
338
-		foreach ( $sold_out_events_array as $sold_out_event ) {
339
-			$sold_out_events .= EEH_HTML::li( EEH_HTML::span( $sold_out_event->name(), '', 'dashicons dashicons-marker ee-icon-size-16 pink-text' ));
338
+		foreach ($sold_out_events_array as $sold_out_event) {
339
+			$sold_out_events .= EEH_HTML::li(EEH_HTML::span($sold_out_event->name(), '', 'dashicons dashicons-marker ee-icon-size-16 pink-text'));
340 340
 		}
341 341
 		return new EE_Form_Section_Proper(
342 342
 			array(
@@ -348,14 +348,14 @@  discard block
 block discarded – undo
348 348
 				),
349 349
 				'layout_strategy'		=> new EE_Template_Layout(
350 350
 					array(
351
-						'layout_template_file' 	=> SPCO_REG_STEPS_PATH . $this->_slug . DS . 'sold_out_events.template.php', // layout_template
351
+						'layout_template_file' 	=> SPCO_REG_STEPS_PATH.$this->_slug.DS.'sold_out_events.template.php', // layout_template
352 352
 						'template_args'  				=> apply_filters(
353 353
 							'FHEE__EE_SPCO_Reg_Step_Payment_Options___sold_out_events__template_args',
354 354
 							array(
355 355
 								'sold_out_events' 			=> $sold_out_events,
356 356
 								'sold_out_events_msg' 	=> apply_filters(
357 357
 									'FHEE__EE_SPCO_Reg_Step_Payment_Options___sold_out_events__sold_out_events_msg',
358
-									__( 'It appears that the event you were about to make a payment for has sold out since you first registered. If you have already made a partial payment towards this event, please contact the event administrator for a refund.', 'event_espresso' )
358
+									__('It appears that the event you were about to make a payment for has sold out since you first registered. If you have already made a partial payment towards this event, please contact the event administrator for a refund.', 'event_espresso')
359 359
 								)
360 360
 							)
361 361
 						)
@@ -372,14 +372,14 @@  discard block
 block discarded – undo
372 372
 	 * @param array $registrations_requiring_pre_approval
373 373
 	 * @return \EE_Form_Section_Proper
374 374
 	 */
375
-	private function _registrations_requiring_pre_approval( $registrations_requiring_pre_approval = array()) {
375
+	private function _registrations_requiring_pre_approval($registrations_requiring_pre_approval = array()) {
376 376
 		$events_requiring_pre_approval = '';
377
-		foreach ( $registrations_requiring_pre_approval as $registration ) {
378
-			if ( $registration instanceof EE_Registration && $registration->event() instanceof EE_Event ) {
379
-				$events_requiring_pre_approval[ $registration->event()->ID() ] = EEH_HTML::li(
380
-					EEH_HTML::span( '', '', 'dashicons dashicons-marker ee-icon-size-16 orange-text'
377
+		foreach ($registrations_requiring_pre_approval as $registration) {
378
+			if ($registration instanceof EE_Registration && $registration->event() instanceof EE_Event) {
379
+				$events_requiring_pre_approval[$registration->event()->ID()] = EEH_HTML::li(
380
+					EEH_HTML::span('', '', 'dashicons dashicons-marker ee-icon-size-16 orange-text'
381 381
 					)
382
-					. EEH_HTML::span( $registration->event()->name(), '', 'orange-text' )
382
+					. EEH_HTML::span($registration->event()->name(), '', 'orange-text')
383 383
 				);
384 384
 			}
385 385
 		}
@@ -391,14 +391,14 @@  discard block
 block discarded – undo
391 391
 				),
392 392
 				'layout_strategy'		=> new EE_Template_Layout(
393 393
 					array(
394
-						'layout_template_file' 	=> SPCO_REG_STEPS_PATH . $this->_slug . DS . 'events_requiring_pre_approval.template.php', // layout_template
394
+						'layout_template_file' 	=> SPCO_REG_STEPS_PATH.$this->_slug.DS.'events_requiring_pre_approval.template.php', // layout_template
395 395
 						'template_args'  				=> apply_filters(
396 396
 							'FHEE__EE_SPCO_Reg_Step_Payment_Options___sold_out_events__template_args',
397 397
 							array(
398
-								'events_requiring_pre_approval' 			=> implode( '', $events_requiring_pre_approval ),
398
+								'events_requiring_pre_approval' 			=> implode('', $events_requiring_pre_approval),
399 399
 								'events_requiring_pre_approval_msg' 	=> apply_filters(
400 400
 									'FHEE__EE_SPCO_Reg_Step_Payment_Options___events_requiring_pre_approval__events_requiring_pre_approval_msg',
401
-									__( 'The following events do not require payment at this time and will not be billed during this transaction. Billing will only occur after the attendee has been approved by the event organizer. You will be notified when your registration has been processed. If this is a free event, then no billing will occur.', 'event_espresso' )
401
+									__('The following events do not require payment at this time and will not be billed during this transaction. Billing will only occur after the attendee has been approved by the event organizer. You will be notified when your registration has been processed. If this is a free event, then no billing will occur.', 'event_espresso')
402 402
 								)
403 403
 							)
404 404
 						),
@@ -416,7 +416,7 @@  discard block
 block discarded – undo
416 416
 	 * @param \EE_Event[] $registrations_for_free_events
417 417
 	 * @return \EE_Form_Section_Proper
418 418
 	 */
419
-	private function _no_payment_required( $registrations_for_free_events = array() ) {
419
+	private function _no_payment_required($registrations_for_free_events = array()) {
420 420
 		// set some defaults
421 421
 		$this->checkout->selected_method_of_payment = 'no_payment_required';
422 422
 		// generate no_payment_required form
@@ -428,7 +428,7 @@  discard block
 block discarded – undo
428 428
 				),
429 429
 				'layout_strategy' 	=> new EE_Template_Layout(
430 430
 					array(
431
-						'layout_template_file' 	=> SPCO_REG_STEPS_PATH . $this->_slug . DS . 'no_payment_required.template.php', // layout_template
431
+						'layout_template_file' 	=> SPCO_REG_STEPS_PATH.$this->_slug.DS.'no_payment_required.template.php', // layout_template
432 432
 						'template_args'  				=> apply_filters(
433 433
 							'FHEE__EE_SPCO_Reg_Step_Payment_Options___no_payment_required__template_args',
434 434
 							array(
@@ -436,7 +436,7 @@  discard block
 block discarded – undo
436 436
 								'registrations' => array(),
437 437
 								'ticket_count' 	=> array(),
438 438
 								'registrations_for_free_events' 	=> $registrations_for_free_events,
439
-								'no_payment_required_msg' => EEH_HTML::p( __( 'This is a free event, so no billing will occur.', 'event_espresso' ))
439
+								'no_payment_required_msg' => EEH_HTML::p(__('This is a free event, so no billing will occur.', 'event_espresso'))
440 440
 							)
441 441
 						),
442 442
 					)
@@ -453,7 +453,7 @@  discard block
 block discarded – undo
453 453
 	 * @param string $transaction_details
454 454
 	 * @return \EE_Form_Section_Proper
455 455
 	 */
456
-	private function _display_payment_options( $transaction_details = '' ) {
456
+	private function _display_payment_options($transaction_details = '') {
457 457
 		// has method_of_payment been set by no-js user?
458 458
 		$this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment();
459 459
 		// build payment options form
@@ -465,20 +465,20 @@  discard block
 block discarded – undo
465 465
 						'before_payment_options' => apply_filters(
466 466
 							'FHEE__EE_SPCO_Reg_Step_Payment_Options___display_payment_options__before_payment_options',
467 467
 							new EE_Form_Section_Proper(
468
-								array( 'layout_strategy'	=> new EE_Div_Per_Section_Layout() )
468
+								array('layout_strategy'	=> new EE_Div_Per_Section_Layout())
469 469
 							)
470 470
 						),
471 471
 						'payment_options' => $this->_setup_payment_options(),
472 472
 						'after_payment_options' => apply_filters(
473 473
 							'FHEE__EE_SPCO_Reg_Step_Payment_Options___display_payment_options__after_payment_options',
474 474
 							new EE_Form_Section_Proper(
475
-								array( 'layout_strategy'	=> new EE_Div_Per_Section_Layout() )
475
+								array('layout_strategy'	=> new EE_Div_Per_Section_Layout())
476 476
 							)
477 477
 						),
478 478
 						'default_hidden_inputs' => $this->reg_step_hidden_inputs(),
479
-						'extra_hidden_inputs' 	=> $this->_extra_hidden_inputs( FALSE )
479
+						'extra_hidden_inputs' 	=> $this->_extra_hidden_inputs(FALSE)
480 480
 					),
481
-					'layout_strategy'	=> new EE_Template_Layout( array(
481
+					'layout_strategy'	=> new EE_Template_Layout(array(
482 482
 							'layout_template_file' 	=> $this->_template,
483 483
 							'template_args'  				=> apply_filters(
484 484
 								'FHEE__EE_SPCO_Reg_Step_Payment_Options___display_payment_options__template_args',
@@ -502,11 +502,11 @@  discard block
 block discarded – undo
502 502
 	 * @param bool $no_payment_required
503 503
 	 * @return \EE_Form_Section_Proper
504 504
 	 */
505
-	private function _extra_hidden_inputs( $no_payment_required = TRUE ) {
505
+	private function _extra_hidden_inputs($no_payment_required = TRUE) {
506 506
 
507 507
 		return new EE_Form_Section_Proper(
508 508
 			array(
509
-				'html_id' 				=> 'ee-' . $this->slug() . '-extra-hidden-inputs',
509
+				'html_id' 				=> 'ee-'.$this->slug().'-extra-hidden-inputs',
510 510
 				'layout_strategy'	=> new EE_Div_Per_Section_Layout(),
511 511
 				'subsections' 		=> array(
512 512
 					'spco_no_payment_required' => new EE_Hidden_Input(
@@ -539,16 +539,16 @@  discard block
 block discarded – undo
539 539
 	 * @access    protected
540 540
 	 * @return    void
541 541
 	 */
542
-	protected function _apply_registration_payments_to_amount_owing( $registrations ) {
542
+	protected function _apply_registration_payments_to_amount_owing($registrations) {
543 543
 		$payments = array();
544
-		foreach ( $registrations as $registration ) {
545
-			if ( $registration instanceof EE_Registration && $registration->owes_monies_and_can_pay() ) {
544
+		foreach ($registrations as $registration) {
545
+			if ($registration instanceof EE_Registration && $registration->owes_monies_and_can_pay()) {
546 546
 				$payments = $payments + $registration->registration_payments();
547 547
 			}
548 548
 		}
549
-		if ( ! empty( $payments ) ) {
550
-			foreach ( $payments as $payment ) {
551
-				if ( $payment instanceof EE_Registration_Payment ) {
549
+		if ( ! empty($payments)) {
550
+			foreach ($payments as $payment) {
551
+				if ($payment instanceof EE_Registration_Payment) {
552 552
 					$this->checkout->amount_owing -= $payment->amount();
553 553
 				}
554 554
 			}
@@ -563,9 +563,9 @@  discard block
 block discarded – undo
563 563
 	 * @param 	bool $force_reset
564 564
 	 * @return 	void
565 565
 	 */
566
-	private function _reset_selected_method_of_payment( $force_reset = FALSE ) {
567
-		$reset_payment_method = $force_reset ? TRUE : sanitize_text_field( EE_Registry::instance()->REQ->get( 'reset_payment_method', FALSE ));
568
-		if ( $reset_payment_method ) {
566
+	private function _reset_selected_method_of_payment($force_reset = FALSE) {
567
+		$reset_payment_method = $force_reset ? TRUE : sanitize_text_field(EE_Registry::instance()->REQ->get('reset_payment_method', FALSE));
568
+		if ($reset_payment_method) {
569 569
 			$this->checkout->selected_method_of_payment = NULL;
570 570
 			$this->checkout->payment_method = NULL;
571 571
 			$this->checkout->billing_form = NULL;
@@ -584,9 +584,9 @@  discard block
 block discarded – undo
584 584
 	 * @param string $selected_method_of_payment
585 585
 	 * 	@return 		EE_Billing_Info_Form
586 586
 	 */
587
-	private function _save_selected_method_of_payment( $selected_method_of_payment = '' ) {
588
-		$selected_method_of_payment = ! empty( $selected_method_of_payment ) ? $selected_method_of_payment : $this->checkout->selected_method_of_payment;
589
-		EE_Registry::instance()->SSN->set_session_data( array( 'selected_method_of_payment' => $selected_method_of_payment ));
587
+	private function _save_selected_method_of_payment($selected_method_of_payment = '') {
588
+		$selected_method_of_payment = ! empty($selected_method_of_payment) ? $selected_method_of_payment : $this->checkout->selected_method_of_payment;
589
+		EE_Registry::instance()->SSN->set_session_data(array('selected_method_of_payment' => $selected_method_of_payment));
590 590
 	}
591 591
 
592 592
 
@@ -599,40 +599,40 @@  discard block
 block discarded – undo
599 599
 		// load payment method classes
600 600
 		$this->checkout->available_payment_methods = $this->_get_available_payment_methods();
601 601
 		// switch up header depending on number of available payment methods
602
-		$payment_method_header = count( $this->checkout->available_payment_methods ) > 1
603
-			? apply_filters( 'FHEE__registration_page_payment_options__method_of_payment_hdr', __( 'Please Select Your Method of Payment', 'event_espresso' ))
604
-			: apply_filters( 'FHEE__registration_page_payment_options__method_of_payment_hdr', __( 'Method of Payment', 'event_espresso' ));
602
+		$payment_method_header = count($this->checkout->available_payment_methods) > 1
603
+			? apply_filters('FHEE__registration_page_payment_options__method_of_payment_hdr', __('Please Select Your Method of Payment', 'event_espresso'))
604
+			: apply_filters('FHEE__registration_page_payment_options__method_of_payment_hdr', __('Method of Payment', 'event_espresso'));
605 605
 		$available_payment_methods = array(
606 606
 			// display the "Payment Method" header
607 607
 			'payment_method_header' => new EE_Form_Section_HTML(
608
-				EEH_HTML::h4 ( $payment_method_header, 'method-of-payment-hdr' )
608
+				EEH_HTML::h4($payment_method_header, 'method-of-payment-hdr')
609 609
 			)
610 610
 		);
611 611
 		// the list of actual payment methods ( invoice, paypal, etc ) in a  ( slug => HTML )  format
612 612
 		$available_payment_method_options = array();
613 613
 		$default_payment_method_option = array();
614 614
 		// additional instructions to be displayed and hidden below payment methods (adding a clearing div to start)
615
-		$payment_methods_billing_info = array( new EE_Form_Section_HTML( EEH_HTML::div ( '<br />', '', '', 'clear:both;' )));
615
+		$payment_methods_billing_info = array(new EE_Form_Section_HTML(EEH_HTML::div('<br />', '', '', 'clear:both;')));
616 616
 		// loop through payment methods
617
-		foreach( $this->checkout->available_payment_methods as $payment_method ) {
618
-			if ( $payment_method instanceof EE_Payment_Method ) {
619
-				$payment_method_button = EEH_HTML::img( $payment_method->button_url(), $payment_method->name(), 'spco-payment-method-' . $payment_method->slug() . '-btn-img', 'spco-payment-method-btn-img' );
617
+		foreach ($this->checkout->available_payment_methods as $payment_method) {
618
+			if ($payment_method instanceof EE_Payment_Method) {
619
+				$payment_method_button = EEH_HTML::img($payment_method->button_url(), $payment_method->name(), 'spco-payment-method-'.$payment_method->slug().'-btn-img', 'spco-payment-method-btn-img');
620 620
 				// check if any payment methods are set as default
621 621
 				// if payment method is already selected OR nothing is selected and this payment method should be open_by_default
622
-				if (( $this->checkout->selected_method_of_payment == $payment_method->slug() ) || ( ! $this->checkout->selected_method_of_payment && $payment_method->open_by_default() )) {
622
+				if (($this->checkout->selected_method_of_payment == $payment_method->slug()) || ( ! $this->checkout->selected_method_of_payment && $payment_method->open_by_default())) {
623 623
 					$this->checkout->selected_method_of_payment = $payment_method->slug();
624 624
 					$this->_save_selected_method_of_payment();
625
-					$default_payment_method_option[ $payment_method->slug() ] =  $payment_method_button;
625
+					$default_payment_method_option[$payment_method->slug()] = $payment_method_button;
626 626
 				} else {
627
-					$available_payment_method_options[ $payment_method->slug() ] =  $payment_method_button;
627
+					$available_payment_method_options[$payment_method->slug()] = $payment_method_button;
628 628
 				}
629
-				$payment_methods_billing_info[ $payment_method->slug() . '-info' ] = $this->_payment_method_billing_info( $payment_method );
629
+				$payment_methods_billing_info[$payment_method->slug().'-info'] = $this->_payment_method_billing_info($payment_method);
630 630
 			}
631 631
 		}
632 632
 		// prepend available_payment_method_options with default_payment_method_option so that it appears first in list of PMs
633 633
 		$available_payment_method_options = $default_payment_method_option + $available_payment_method_options;
634 634
 		// now generate the actual form  inputs
635
-		$available_payment_methods['available_payment_methods'] = $this->_available_payment_method_inputs( $available_payment_method_options );
635
+		$available_payment_methods['available_payment_methods'] = $this->_available_payment_method_inputs($available_payment_method_options);
636 636
 		$available_payment_methods = $available_payment_methods + $payment_methods_billing_info;
637 637
 
638 638
 		// build the available payment methods form
@@ -652,19 +652,19 @@  discard block
 block discarded – undo
652 652
 	 * @return EE_Payment_Method[]
653 653
 	 */
654 654
 	protected function _get_available_payment_methods() {
655
-		if ( ! empty( $this->checkout->available_payment_methods )) {
655
+		if ( ! empty($this->checkout->available_payment_methods)) {
656 656
 			return $this->checkout->available_payment_methods;
657 657
 		}
658 658
 		$available_payment_methods = array();
659 659
 		// load EEM_Payment_Method
660
-		EE_Registry::instance()->load_model( 'Payment_Method' );
660
+		EE_Registry::instance()->load_model('Payment_Method');
661 661
 		/** @type EEM_Payment_Method $EEM_Payment_Method */
662 662
 		$EEM_Payment_Method = EE_Registry::instance()->LIB->EEM_Payment_Method;
663 663
 		// get all active payment methods
664
-		$payment_methods = $EEM_Payment_Method->get_all_for_transaction( $this->checkout->transaction, EEM_Payment_Method::scope_cart );
665
-		foreach ( $payment_methods as $payment_method ) {
666
-			if ( $payment_method instanceof EE_Payment_Method ) {
667
-				$available_payment_methods[ $payment_method->slug() ] = $payment_method;
664
+		$payment_methods = $EEM_Payment_Method->get_all_for_transaction($this->checkout->transaction, EEM_Payment_Method::scope_cart);
665
+		foreach ($payment_methods as $payment_method) {
666
+			if ($payment_method instanceof EE_Payment_Method) {
667
+				$available_payment_methods[$payment_method->slug()] = $payment_method;
668 668
 			}
669 669
 		}
670 670
 		return $available_payment_methods;
@@ -680,14 +680,14 @@  discard block
 block discarded – undo
680 680
 	 * @param 	array $available_payment_method_options
681 681
 	 * @return 	\EE_Form_Section_Proper
682 682
 	 */
683
-	private function _available_payment_method_inputs( $available_payment_method_options = array() ) {
683
+	private function _available_payment_method_inputs($available_payment_method_options = array()) {
684 684
 		// generate inputs
685 685
 		return new EE_Form_Section_Proper(
686 686
 			array(
687 687
 				'html_id' 				=> 'ee-available-payment-method-inputs',
688 688
 				'layout_strategy'	=> new EE_Div_Per_Section_Layout(),
689 689
 				'subsections' 		=> array(
690
-					'' => new EE_Radio_Button_Input (
690
+					'' => new EE_Radio_Button_Input(
691 691
 						$available_payment_method_options,
692 692
 						array(
693 693
 							'html_name' 				=> 'selected_method_of_payment',
@@ -711,36 +711,36 @@  discard block
 block discarded – undo
711 711
 	 * @param 	EE_Payment_Method $payment_method
712 712
 	 * @return 	\EE_Form_Section_Proper
713 713
 	 */
714
-	private function _payment_method_billing_info( EE_Payment_Method $payment_method ) {
714
+	private function _payment_method_billing_info(EE_Payment_Method $payment_method) {
715 715
 		$currently_selected = $this->checkout->selected_method_of_payment == $payment_method->slug() ? TRUE : FALSE;
716 716
 		// generate the billing form for payment method
717
-		$billing_form = $currently_selected ? $this->_get_billing_form_for_payment_method( $payment_method ) : new EE_Form_Section_HTML();
717
+		$billing_form = $currently_selected ? $this->_get_billing_form_for_payment_method($payment_method) : new EE_Form_Section_HTML();
718 718
 		$this->checkout->billing_form = $currently_selected ? $billing_form : $this->checkout->billing_form;
719 719
 		// it's all in the details
720
-		$info_html = EEH_HTML::h3 ( __( 'Important information regarding your payment', 'event_espresso' ), '', 'spco-payment-method-hdr' );
720
+		$info_html = EEH_HTML::h3(__('Important information regarding your payment', 'event_espresso'), '', 'spco-payment-method-hdr');
721 721
 		// add some info regarding the step, either from what's saved in the admin, or a default string depending on whether the PM has a billing form or not
722
-		if ( $payment_method->description() ) {
722
+		if ($payment_method->description()) {
723 723
 			$payment_method_info = $payment_method->description();
724
-		} elseif ( $billing_form instanceof EE_Billing_Info_Form ) {
725
-			$payment_method_info = sprintf( __( 'Please provide the following billing information, then click the "%1$s" button below in order to proceed.', 'event_espresso' ), $this->submit_button_text() );
724
+		} elseif ($billing_form instanceof EE_Billing_Info_Form) {
725
+			$payment_method_info = sprintf(__('Please provide the following billing information, then click the "%1$s" button below in order to proceed.', 'event_espresso'), $this->submit_button_text());
726 726
 		} else {
727
-			$payment_method_info = sprintf( __( 'Please click the "%1$s" button below in order to proceed.', 'event_espresso' ), $this->submit_button_text() );
727
+			$payment_method_info = sprintf(__('Please click the "%1$s" button below in order to proceed.', 'event_espresso'), $this->submit_button_text());
728 728
 		}
729
-		$info_html .= EEH_HTML::p (
730
-			apply_filters( 'FHEE__EE_SPCO_Reg_Step_Payment_Options___payment_method_billing_info__payment_method_info', $payment_method_info ),
729
+		$info_html .= EEH_HTML::p(
730
+			apply_filters('FHEE__EE_SPCO_Reg_Step_Payment_Options___payment_method_billing_info__payment_method_info', $payment_method_info),
731 731
 			'',
732 732
 			'spco-payment-method-desc ee-attention'
733 733
 		);
734 734
 
735 735
 		return new EE_Form_Section_Proper(
736 736
 			array(
737
-				'html_id' 					=> 'spco-payment-method-info-' . $payment_method->slug(),
737
+				'html_id' 					=> 'spco-payment-method-info-'.$payment_method->slug(),
738 738
 				'html_class' 			=> 'spco-payment-method-info-dv',
739 739
 				// only display the selected or default PM
740 740
 				'html_style' 			=> $currently_selected ? '' : 'display:none;',
741 741
 				'layout_strategy'		=> new EE_Div_Per_Section_Layout(),
742 742
 				'subsections' 			=> array(
743
-					'info' 					=> new EE_Form_Section_HTML( $info_html ),
743
+					'info' 					=> new EE_Form_Section_HTML($info_html),
744 744
 					'billing_form' 		=> $currently_selected ? $billing_form : new EE_Form_Section_HTML()
745 745
 				)
746 746
 			)
@@ -758,12 +758,12 @@  discard block
 block discarded – undo
758 758
 	 */
759 759
 	public function get_billing_form_html_for_payment_method() {
760 760
 		// how have they chosen to pay?
761
-		$this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment( TRUE );
761
+		$this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment(TRUE);
762 762
 		$this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment();
763
-		if ( ! $this->checkout->payment_method instanceof EE_Payment_Method ) {
763
+		if ( ! $this->checkout->payment_method instanceof EE_Payment_Method) {
764 764
 			return FALSE;
765 765
 		}
766
-		if ( apply_filters( 'FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success', false ) ) {
766
+		if (apply_filters('FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success', false)) {
767 767
             EE_Error::add_success(
768 768
                 apply_filters(
769 769
                     'FHEE__Single_Page_Checkout__registration_checkout__selected_payment_method',
@@ -772,20 +772,20 @@  discard block
 block discarded – undo
772 772
             );
773 773
         }
774 774
 		// now generate billing form for selected method of payment
775
-		$payment_method_billing_form = $this->_get_billing_form_for_payment_method( $this->checkout->payment_method );
775
+		$payment_method_billing_form = $this->_get_billing_form_for_payment_method($this->checkout->payment_method);
776 776
 		// fill form with attendee info if applicable
777
-		if ( $payment_method_billing_form instanceof EE_Billing_Attendee_Info_Form && $this->checkout->transaction_has_primary_registrant() ) {
778
-			$payment_method_billing_form->populate_from_attendee( $this->checkout->transaction->primary_registration()->attendee() );
777
+		if ($payment_method_billing_form instanceof EE_Billing_Attendee_Info_Form && $this->checkout->transaction_has_primary_registrant()) {
778
+			$payment_method_billing_form->populate_from_attendee($this->checkout->transaction->primary_registration()->attendee());
779 779
 		}
780 780
 		// and debug content
781
-		if ( $payment_method_billing_form instanceof EE_Billing_Info_Form && $this->checkout->payment_method->type_obj() instanceof EE_PMT_Base ) {
782
-			$payment_method_billing_form = $this->checkout->payment_method->type_obj()->apply_billing_form_debug_settings( $payment_method_billing_form );
781
+		if ($payment_method_billing_form instanceof EE_Billing_Info_Form && $this->checkout->payment_method->type_obj() instanceof EE_PMT_Base) {
782
+			$payment_method_billing_form = $this->checkout->payment_method->type_obj()->apply_billing_form_debug_settings($payment_method_billing_form);
783 783
 		}
784 784
 		$billing_info = $payment_method_billing_form instanceof EE_Form_Section_Proper ? $payment_method_billing_form->get_html() : '';
785
-		$this->checkout->json_response->set_return_data( array( 'payment_method_info' => $billing_info ));
785
+		$this->checkout->json_response->set_return_data(array('payment_method_info' => $billing_info));
786 786
 		// localize validation rules for main form
787 787
 		$this->checkout->current_step->reg_form->localize_validation_rules();
788
-		$this->checkout->json_response->add_validation_rules( EE_Form_Section_Proper::js_localization() );
788
+		$this->checkout->json_response->add_validation_rules(EE_Form_Section_Proper::js_localization());
789 789
 		return TRUE;
790 790
 	}
791 791
 
@@ -798,15 +798,15 @@  discard block
 block discarded – undo
798 798
 	 * @param EE_Payment_Method $payment_method
799 799
 	 * @return \EE_Billing_Info_Form
800 800
 	 */
801
-	private function _get_billing_form_for_payment_method( EE_Payment_Method $payment_method ) {
802
-		$billing_form = $payment_method->type_obj()->billing_form( $this->checkout->transaction, array( 'amount_owing' => $this->checkout->amount_owing ) );
803
-		if ( $billing_form instanceof EE_Billing_Info_Form ) {
804
-			if ( EE_Registry::instance()->REQ->is_set( 'payment_method' )) {
805
-                if ( apply_filters('FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success', false )) {
801
+	private function _get_billing_form_for_payment_method(EE_Payment_Method $payment_method) {
802
+		$billing_form = $payment_method->type_obj()->billing_form($this->checkout->transaction, array('amount_owing' => $this->checkout->amount_owing));
803
+		if ($billing_form instanceof EE_Billing_Info_Form) {
804
+			if (EE_Registry::instance()->REQ->is_set('payment_method')) {
805
+                if (apply_filters('FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success', false)) {
806 806
                     EE_Error::add_success(
807 807
                         apply_filters(
808 808
                             'FHEE__Single_Page_Checkout__registration_checkout__selected_payment_method',
809
-                            sprintf( __( 'You have selected "%s" as your method of payment. Please note the important payment information below.', 'event_espresso' ), $payment_method->name() )
809
+                            sprintf(__('You have selected "%s" as your method of payment. Please note the important payment information below.', 'event_espresso'), $payment_method->name())
810 810
                         )
811 811
                     );
812 812
                 }
@@ -831,27 +831,27 @@  discard block
 block discarded – undo
831 831
 	 * @param string 		$request_param
832 832
 	 * @return NULL|string
833 833
 	 */
834
-	private function _get_selected_method_of_payment( $required = FALSE, $request_param = 'selected_method_of_payment' ) {
834
+	private function _get_selected_method_of_payment($required = FALSE, $request_param = 'selected_method_of_payment') {
835 835
 		// is selected_method_of_payment set in the request ?
836
-		$selected_method_of_payment = EE_Registry::instance()->REQ->get( $request_param, FALSE );
837
-		if ( $selected_method_of_payment ) {
836
+		$selected_method_of_payment = EE_Registry::instance()->REQ->get($request_param, FALSE);
837
+		if ($selected_method_of_payment) {
838 838
 			// sanitize it
839
-			$selected_method_of_payment = is_array( $selected_method_of_payment ) ? array_shift( $selected_method_of_payment ) : $selected_method_of_payment;
840
-			$selected_method_of_payment = sanitize_text_field( $selected_method_of_payment );
839
+			$selected_method_of_payment = is_array($selected_method_of_payment) ? array_shift($selected_method_of_payment) : $selected_method_of_payment;
840
+			$selected_method_of_payment = sanitize_text_field($selected_method_of_payment);
841 841
 			// store it in the session so that it's available for all subsequent requests including AJAX
842
-			$this->_save_selected_method_of_payment( $selected_method_of_payment );
842
+			$this->_save_selected_method_of_payment($selected_method_of_payment);
843 843
 		} else {
844 844
 			// or is is set in the session ?
845
-			$selected_method_of_payment = EE_Registry::instance()->SSN->get_session_data( 'selected_method_of_payment' );
845
+			$selected_method_of_payment = EE_Registry::instance()->SSN->get_session_data('selected_method_of_payment');
846 846
 		}
847 847
 		// do ya really really gotta have it?
848
-		if ( empty( $selected_method_of_payment ) && $required ) {
848
+		if (empty($selected_method_of_payment) && $required) {
849 849
 			EE_Error::add_error(
850 850
 				sprintf(
851
-					__( 'The selected method of payment could not be determined.%sPlease ensure that you have selected one before proceeding.%sIf you continue to experience difficulties, then refresh your browser and try again, or contact %s for assistance.', 'event_espresso' ),
851
+					__('The selected method of payment could not be determined.%sPlease ensure that you have selected one before proceeding.%sIf you continue to experience difficulties, then refresh your browser and try again, or contact %s for assistance.', 'event_espresso'),
852 852
 					'<br/>',
853 853
 					'<br/>',
854
-					EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
854
+					EE_Registry::instance()->CFG->organization->get_pretty('email')
855 855
 				),
856 856
 				__FILE__, __FUNCTION__, __LINE__
857 857
 			);
@@ -877,37 +877,37 @@  discard block
 block discarded – undo
877 877
 	 * @return string
878 878
 	 */
879 879
 	public function switch_payment_method() {
880
-		if ( ! $this->_verify_payment_method_is_set() ) {
880
+		if ( ! $this->_verify_payment_method_is_set()) {
881 881
 			return FALSE;
882 882
 		}
883
-		if ( apply_filters( 'FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success', false ) ) {
883
+		if (apply_filters('FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success', false)) {
884 884
 			EE_Error::add_success(
885 885
 				apply_filters(
886 886
 					'FHEE__Single_Page_Checkout__registration_checkout__selected_payment_method',
887
-					sprintf( __( 'You have selected "%s" as your method of payment. Please note the important payment information below.', 'event_espresso' ), $this->checkout->payment_method->name() )
887
+					sprintf(__('You have selected "%s" as your method of payment. Please note the important payment information below.', 'event_espresso'), $this->checkout->payment_method->name())
888 888
 				)
889 889
 			);
890 890
 		}
891 891
 		// generate billing form for selected method of payment if it hasn't been done already
892
-		if ( $this->checkout->payment_method->type_obj()->has_billing_form() ) {
893
-			$this->checkout->billing_form = $this->_get_billing_form_for_payment_method( $this->checkout->payment_method );
892
+		if ($this->checkout->payment_method->type_obj()->has_billing_form()) {
893
+			$this->checkout->billing_form = $this->_get_billing_form_for_payment_method($this->checkout->payment_method);
894 894
 		}
895 895
 		// fill form with attendee info if applicable
896
-		if ( $this->checkout->billing_form instanceof EE_Billing_Attendee_Info_Form && $this->checkout->transaction_has_primary_registrant() ) {
897
-			$this->checkout->billing_form->populate_from_attendee( $this->checkout->transaction->primary_registration()->attendee() );
896
+		if ($this->checkout->billing_form instanceof EE_Billing_Attendee_Info_Form && $this->checkout->transaction_has_primary_registrant()) {
897
+			$this->checkout->billing_form->populate_from_attendee($this->checkout->transaction->primary_registration()->attendee());
898 898
 		}
899 899
 		// and debug content
900
-		if ( $this->checkout->billing_form instanceof EE_Billing_Info_Form && $this->checkout->payment_method->type_obj() instanceof EE_PMT_Base ) {
901
-			$this->checkout->billing_form = $this->checkout->payment_method->type_obj()->apply_billing_form_debug_settings( $this->checkout->billing_form );
900
+		if ($this->checkout->billing_form instanceof EE_Billing_Info_Form && $this->checkout->payment_method->type_obj() instanceof EE_PMT_Base) {
901
+			$this->checkout->billing_form = $this->checkout->payment_method->type_obj()->apply_billing_form_debug_settings($this->checkout->billing_form);
902 902
 		}
903 903
 		// get html and validation rules for form
904
-		if ( $this->checkout->billing_form instanceof EE_Form_Section_Proper ) {
905
-			$this->checkout->json_response->set_return_data( array( 'payment_method_info' => $this->checkout->billing_form->get_html() ));
904
+		if ($this->checkout->billing_form instanceof EE_Form_Section_Proper) {
905
+			$this->checkout->json_response->set_return_data(array('payment_method_info' => $this->checkout->billing_form->get_html()));
906 906
 			// localize validation rules for main form
907
-			$this->checkout->billing_form->localize_validation_rules( TRUE );
908
-			$this->checkout->json_response->add_validation_rules( EE_Form_Section_Proper::js_localization() );
907
+			$this->checkout->billing_form->localize_validation_rules(TRUE);
908
+			$this->checkout->json_response->add_validation_rules(EE_Form_Section_Proper::js_localization());
909 909
 		} else {
910
-			$this->checkout->json_response->set_return_data( array( 'payment_method_info' => '' ));
910
+			$this->checkout->json_response->set_return_data(array('payment_method_info' => ''));
911 911
 		}
912 912
 		//prevents advancement to next step
913 913
 		$this->checkout->continue_reg = FALSE;
@@ -922,12 +922,12 @@  discard block
 block discarded – undo
922 922
 	 */
923 923
 	protected function _verify_payment_method_is_set() {
924 924
 		// generate billing form for selected method of payment if it hasn't been done already
925
-		if ( empty( $this->checkout->selected_method_of_payment )) {
925
+		if (empty($this->checkout->selected_method_of_payment)) {
926 926
 			// how have they chosen to pay?
927
-			$this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment( TRUE );
927
+			$this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment(TRUE);
928 928
 		}
929 929
 		// verify payment method
930
-		if ( ! $this->checkout->payment_method instanceof EE_Payment_Method ) {
930
+		if ( ! $this->checkout->payment_method instanceof EE_Payment_Method) {
931 931
 			// get payment method for selected method of payment
932 932
 			$this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment();
933 933
 		}
@@ -947,23 +947,23 @@  discard block
 block discarded – undo
947 947
 	 * @return void
948 948
 	 */
949 949
 	public function save_payer_details_via_ajax() {
950
-		if ( ! $this->_verify_payment_method_is_set() ) {
950
+		if ( ! $this->_verify_payment_method_is_set()) {
951 951
 			return;
952 952
 		}
953 953
 		// generate billing form for selected method of payment if it hasn't been done already
954
-		if ( $this->checkout->payment_method->type_obj()->has_billing_form() ) {
955
-			$this->checkout->billing_form = $this->_get_billing_form_for_payment_method( $this->checkout->payment_method );
954
+		if ($this->checkout->payment_method->type_obj()->has_billing_form()) {
955
+			$this->checkout->billing_form = $this->_get_billing_form_for_payment_method($this->checkout->payment_method);
956 956
 		}
957 957
 		// generate primary attendee from payer info if applicable
958 958
 		if ( ! $this->checkout->transaction_has_primary_registrant()) {
959 959
 			$attendee = $this->_create_attendee_from_request_data();
960
-			if ( $attendee instanceof EE_Attendee ) {
961
-				foreach ( $this->checkout->transaction->registrations() as $registration ) {
962
-					if ( $registration->is_primary_registrant() ) {
960
+			if ($attendee instanceof EE_Attendee) {
961
+				foreach ($this->checkout->transaction->registrations() as $registration) {
962
+					if ($registration->is_primary_registrant()) {
963 963
 						$this->checkout->primary_attendee_obj = $attendee;
964
-						$registration->_add_relation_to( $attendee, 'Attendee' );
965
-						$registration->set_attendee_id( $attendee->ID() );
966
-						$registration->update_cache_after_object_save( 'Attendee', $attendee );
964
+						$registration->_add_relation_to($attendee, 'Attendee');
965
+						$registration->set_attendee_id($attendee->ID());
966
+						$registration->update_cache_after_object_save('Attendee', $attendee);
967 967
 					}
968 968
 				}
969 969
 			}
@@ -976,56 +976,56 @@  discard block
 block discarded – undo
976 976
 	 * uses info from alternate GET or POST data (such as AJAX) to create a new attendee
977 977
 	 * @return \EE_Attendee
978 978
 	 */
979
-	protected function _create_attendee_from_request_data(){
979
+	protected function _create_attendee_from_request_data() {
980 980
 		// get State ID
981
-		$STA_ID = ! empty( $_REQUEST['state'] ) ? sanitize_text_field( $_REQUEST['state'] ) : '';
982
-		if ( ! empty( $STA_ID )) {
981
+		$STA_ID = ! empty($_REQUEST['state']) ? sanitize_text_field($_REQUEST['state']) : '';
982
+		if ( ! empty($STA_ID)) {
983 983
 			// can we get state object from name ?
984
-			EE_Registry::instance()->load_model( 'State' );
985
-			$state = EEM_State::instance()->get_col( array( array( 'STA_name' => $STA_ID ), 'limit' => 1), 'STA_ID' );
986
-			$STA_ID = is_array( $state ) && ! empty( $state ) ? reset( $state ) : $STA_ID;
984
+			EE_Registry::instance()->load_model('State');
985
+			$state = EEM_State::instance()->get_col(array(array('STA_name' => $STA_ID), 'limit' => 1), 'STA_ID');
986
+			$STA_ID = is_array($state) && ! empty($state) ? reset($state) : $STA_ID;
987 987
 		}
988 988
 		// get Country ISO
989
-		$CNT_ISO = ! empty( $_REQUEST['country'] ) ? sanitize_text_field( $_REQUEST['country'] ) : '';
990
-		if ( ! empty( $CNT_ISO )) {
989
+		$CNT_ISO = ! empty($_REQUEST['country']) ? sanitize_text_field($_REQUEST['country']) : '';
990
+		if ( ! empty($CNT_ISO)) {
991 991
 			// can we get country object from name ?
992
-			EE_Registry::instance()->load_model( 'Country' );
993
-			$country = EEM_Country::instance()->get_col( array( array( 'CNT_name' => $CNT_ISO ), 'limit' => 1), 'CNT_ISO' );
994
-			$CNT_ISO = is_array( $country ) && ! empty( $country ) ? reset( $country ) : $CNT_ISO;
992
+			EE_Registry::instance()->load_model('Country');
993
+			$country = EEM_Country::instance()->get_col(array(array('CNT_name' => $CNT_ISO), 'limit' => 1), 'CNT_ISO');
994
+			$CNT_ISO = is_array($country) && ! empty($country) ? reset($country) : $CNT_ISO;
995 995
 		}
996 996
 		// grab attendee data
997 997
 		$attendee_data = array(
998
-			'ATT_fname' 		=> ! empty( $_REQUEST['first_name'] ) ? sanitize_text_field( $_REQUEST['first_name'] ) : '',
999
-			'ATT_lname' 		=> ! empty( $_REQUEST['last_name'] ) ? sanitize_text_field( $_REQUEST['last_name'] ) : '',
1000
-			'ATT_email' 		=> ! empty( $_REQUEST['email'] ) ? sanitize_email( $_REQUEST['email'] ) : '',
1001
-			'ATT_address' 		=> ! empty( $_REQUEST['address'] ) ? sanitize_text_field( $_REQUEST['address'] ) : '',
1002
-			'ATT_address2' 	=> ! empty( $_REQUEST['address2'] ) ? sanitize_text_field( $_REQUEST['address2'] ) : '',
1003
-			'ATT_city' 			=> ! empty( $_REQUEST['city'] ) ? sanitize_text_field( $_REQUEST['city'] ) : '',
998
+			'ATT_fname' 		=> ! empty($_REQUEST['first_name']) ? sanitize_text_field($_REQUEST['first_name']) : '',
999
+			'ATT_lname' 		=> ! empty($_REQUEST['last_name']) ? sanitize_text_field($_REQUEST['last_name']) : '',
1000
+			'ATT_email' 		=> ! empty($_REQUEST['email']) ? sanitize_email($_REQUEST['email']) : '',
1001
+			'ATT_address' 		=> ! empty($_REQUEST['address']) ? sanitize_text_field($_REQUEST['address']) : '',
1002
+			'ATT_address2' 	=> ! empty($_REQUEST['address2']) ? sanitize_text_field($_REQUEST['address2']) : '',
1003
+			'ATT_city' 			=> ! empty($_REQUEST['city']) ? sanitize_text_field($_REQUEST['city']) : '',
1004 1004
 			'STA_ID' 				=> $STA_ID,
1005 1005
 			'CNT_ISO' 			=> $CNT_ISO,
1006
-			'ATT_zip' 				=> ! empty( $_REQUEST['zip'] ) ? sanitize_text_field( $_REQUEST['zip'] ) : '',
1007
-			'ATT_phone' 		=> ! empty( $_REQUEST['phone'] ) ? sanitize_text_field( $_REQUEST['phone'] ) : '',
1006
+			'ATT_zip' 				=> ! empty($_REQUEST['zip']) ? sanitize_text_field($_REQUEST['zip']) : '',
1007
+			'ATT_phone' 		=> ! empty($_REQUEST['phone']) ? sanitize_text_field($_REQUEST['phone']) : '',
1008 1008
 		);
1009 1009
 		// validate the email address since it is the most important piece of info
1010
-		if ( empty( $attendee_data['ATT_email'] ) || $attendee_data['ATT_email'] != $_REQUEST['email'] ) {
1011
-			EE_Error::add_error( __( 'An invalid email address was submitted.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
1010
+		if (empty($attendee_data['ATT_email']) || $attendee_data['ATT_email'] != $_REQUEST['email']) {
1011
+			EE_Error::add_error(__('An invalid email address was submitted.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1012 1012
 		}
1013 1013
 		// does this attendee already exist in the db ? we're searching using a combination of first name, last name, AND email address
1014
-		if ( ! empty( $attendee_data['ATT_fname'] ) && ! empty( $attendee_data['ATT_lname'] ) && ! empty( $attendee_data['ATT_email'] ) ) {
1015
-			$existing_attendee = EE_Registry::instance()->LIB->EEM_Attendee->find_existing_attendee( array(
1014
+		if ( ! empty($attendee_data['ATT_fname']) && ! empty($attendee_data['ATT_lname']) && ! empty($attendee_data['ATT_email'])) {
1015
+			$existing_attendee = EE_Registry::instance()->LIB->EEM_Attendee->find_existing_attendee(array(
1016 1016
 				'ATT_fname' => $attendee_data['ATT_fname'],
1017 1017
 				'ATT_lname' => $attendee_data['ATT_lname'],
1018 1018
 				'ATT_email' => $attendee_data['ATT_email']
1019 1019
 			));
1020
-			if ( $existing_attendee instanceof EE_Attendee ) {
1020
+			if ($existing_attendee instanceof EE_Attendee) {
1021 1021
 				return $existing_attendee;
1022 1022
 			}
1023 1023
 		}
1024 1024
 		// no existing attendee? kk let's create a new one
1025 1025
 		// kinda lame, but we need a first and last name to create an attendee, so use the email address if those don't exist
1026
-		$attendee_data['ATT_fname'] = ! empty( $attendee_data['ATT_fname'] ) ? $attendee_data['ATT_fname'] : $attendee_data['ATT_email'];
1027
-		$attendee_data['ATT_lname'] = ! empty( $attendee_data['ATT_lname'] ) ? $attendee_data['ATT_lname'] : $attendee_data['ATT_email'];
1028
-		return EE_Attendee::new_instance( $attendee_data );
1026
+		$attendee_data['ATT_fname'] = ! empty($attendee_data['ATT_fname']) ? $attendee_data['ATT_fname'] : $attendee_data['ATT_email'];
1027
+		$attendee_data['ATT_lname'] = ! empty($attendee_data['ATT_lname']) ? $attendee_data['ATT_lname'] : $attendee_data['ATT_email'];
1028
+		return EE_Attendee::new_instance($attendee_data);
1029 1029
 	}
1030 1030
 
1031 1031
 
@@ -1045,22 +1045,22 @@  discard block
 block discarded – undo
1045 1045
 	 */
1046 1046
 	public function process_reg_step() {
1047 1047
 		// how have they chosen to pay?
1048
-		$this->checkout->selected_method_of_payment = $this->checkout->transaction->is_free() ? 'no_payment_required' : $this->_get_selected_method_of_payment( TRUE );
1048
+		$this->checkout->selected_method_of_payment = $this->checkout->transaction->is_free() ? 'no_payment_required' : $this->_get_selected_method_of_payment(TRUE);
1049 1049
 		// choose your own adventure based on method_of_payment
1050
-		switch(  $this->checkout->selected_method_of_payment ) {
1050
+		switch ($this->checkout->selected_method_of_payment) {
1051 1051
 
1052 1052
 			case 'events_sold_out' :
1053 1053
 				$this->checkout->redirect = TRUE;
1054 1054
 				$this->checkout->redirect_url = $this->checkout->cancel_page_url;
1055
-				$this->checkout->json_response->set_redirect_url( $this->checkout->redirect_url );
1055
+				$this->checkout->json_response->set_redirect_url($this->checkout->redirect_url);
1056 1056
 				// mark this reg step as completed
1057 1057
 				$this->set_completed();
1058 1058
 				return FALSE;
1059 1059
 				break;
1060 1060
 
1061 1061
 			case 'payments_closed' :
1062
-				if ( apply_filters( 'FHEE__EE_SPCO_Reg_Step_Payment_Options__process_reg_step__payments_closed__display_success', false ) ) {
1063
-					EE_Error::add_success( __( 'no payment required at this time.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
1062
+				if (apply_filters('FHEE__EE_SPCO_Reg_Step_Payment_Options__process_reg_step__payments_closed__display_success', false)) {
1063
+					EE_Error::add_success(__('no payment required at this time.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1064 1064
 				}
1065 1065
 				// mark this reg step as completed
1066 1066
 				$this->set_completed();
@@ -1068,8 +1068,8 @@  discard block
 block discarded – undo
1068 1068
 				break;
1069 1069
 
1070 1070
 			case 'no_payment_required' :
1071
-				if ( apply_filters( 'FHEE__EE_SPCO_Reg_Step_Payment_Options__process_reg_step__no_payment_required__display_success', false ) ) {
1072
-					EE_Error::add_success( __( 'no payment required.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
1071
+				if (apply_filters('FHEE__EE_SPCO_Reg_Step_Payment_Options__process_reg_step__no_payment_required__display_success', false)) {
1072
+					EE_Error::add_success(__('no payment required.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1073 1073
 				}
1074 1074
 				// mark this reg step as completed
1075 1075
 				$this->set_completed();
@@ -1078,9 +1078,9 @@  discard block
 block discarded – undo
1078 1078
 
1079 1079
 			default:
1080 1080
 				$payment_successful = $this->_process_payment();
1081
-				if ( $payment_successful ) {
1081
+				if ($payment_successful) {
1082 1082
 					$this->checkout->continue_reg = true;
1083
-					$this->_maybe_set_completed( $this->checkout->payment_method );
1083
+					$this->_maybe_set_completed($this->checkout->payment_method);
1084 1084
 				} else {
1085 1085
 					$this->checkout->continue_reg = false;
1086 1086
 				}
@@ -1098,8 +1098,8 @@  discard block
 block discarded – undo
1098 1098
 	 * @param \EE_Payment_Method $payment_method
1099 1099
 	 * @return void
1100 1100
 	 */
1101
-	protected function _maybe_set_completed( EE_Payment_Method $payment_method ) {
1102
-		switch ( $payment_method->type_obj()->payment_occurs() ) {
1101
+	protected function _maybe_set_completed(EE_Payment_Method $payment_method) {
1102
+		switch ($payment_method->type_obj()->payment_occurs()) {
1103 1103
 			case EE_PMT_Base::offsite :
1104 1104
 				break;
1105 1105
 			case EE_PMT_Base::onsite :
@@ -1122,15 +1122,15 @@  discard block
 block discarded – undo
1122 1122
 	public function update_reg_step() {
1123 1123
 		$success = TRUE;
1124 1124
 		// if payment required
1125
-		if ( $this->checkout->transaction->total() > 0 ) {
1126
-			do_action ('AHEE__EE_Single_Page_Checkout__process_finalize_registration__before_gateway', $this->checkout->transaction );
1125
+		if ($this->checkout->transaction->total() > 0) {
1126
+			do_action('AHEE__EE_Single_Page_Checkout__process_finalize_registration__before_gateway', $this->checkout->transaction);
1127 1127
 			// attempt payment via payment method
1128 1128
 			$success = $this->process_reg_step();
1129 1129
 		}
1130
-		if ( $success && ! $this->checkout->redirect ) {
1131
-			$this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn( $this->checkout->transaction->ID() );
1130
+		if ($success && ! $this->checkout->redirect) {
1131
+			$this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn($this->checkout->transaction->ID());
1132 1132
 			 // set return URL
1133
-			$this->checkout->redirect_url = add_query_arg( array( 'e_reg_url_link' => $this->checkout->reg_url_link ), $this->checkout->thank_you_page_url );
1133
+			$this->checkout->redirect_url = add_query_arg(array('e_reg_url_link' => $this->checkout->reg_url_link), $this->checkout->thank_you_page_url);
1134 1134
 		}
1135 1135
 		return $success;
1136 1136
 	}
@@ -1150,24 +1150,24 @@  discard block
 block discarded – undo
1150 1150
 		// clear any previous errors related to not selecting a payment method
1151 1151
 //		EE_Error::overwrite_errors();
1152 1152
 		// ya gotta make a choice man
1153
-		if ( empty( $this->checkout->selected_method_of_payment )) {
1154
-			$this->checkout->json_response->set_plz_select_method_of_payment( __( 'Please select a method of payment before proceeding.', 'event_espresso' ));
1153
+		if (empty($this->checkout->selected_method_of_payment)) {
1154
+			$this->checkout->json_response->set_plz_select_method_of_payment(__('Please select a method of payment before proceeding.', 'event_espresso'));
1155 1155
 			return FALSE;
1156 1156
 		}
1157 1157
 		// get EE_Payment_Method object
1158
-		if ( ! $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment() ) {
1158
+		if ( ! $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment()) {
1159 1159
 			return FALSE;
1160 1160
 		}
1161 1161
 		// setup billing form
1162
-		if ( $this->checkout->payment_method->is_on_site() ) {
1163
-			$this->checkout->billing_form = $this->_get_billing_form_for_payment_method( $this->checkout->payment_method );
1162
+		if ($this->checkout->payment_method->is_on_site()) {
1163
+			$this->checkout->billing_form = $this->_get_billing_form_for_payment_method($this->checkout->payment_method);
1164 1164
 			// bad billing form ?
1165
-			if ( ! $this->_billing_form_is_valid() ) {
1165
+			if ( ! $this->_billing_form_is_valid()) {
1166 1166
 				return FALSE;
1167 1167
 			}
1168 1168
 		}
1169 1169
 		// ensure primary registrant has been fully processed
1170
-		if ( ! $this->_setup_primary_registrant_prior_to_payment() ) {
1170
+		if ( ! $this->_setup_primary_registrant_prior_to_payment()) {
1171 1171
 			return FALSE;
1172 1172
 		}
1173 1173
 		/** @type EE_Transaction_Processor $transaction_processor */
@@ -1175,24 +1175,24 @@  discard block
 block discarded – undo
1175 1175
 		// in case a registrant leaves to an Off-Site Gateway and never returns, we want to approve any registrations for events with a default reg status of Approved
1176 1176
 		//$transaction_processor->toggle_registration_statuses_for_default_approved_events( $this->checkout->transaction, $this->checkout->reg_cache_where_params );
1177 1177
 		// attempt payment
1178
-		$payment = $this->_attempt_payment( $this->checkout->payment_method );
1178
+		$payment = $this->_attempt_payment($this->checkout->payment_method);
1179 1179
 		// process results
1180
-		$payment = $this->_validate_payment( $payment );
1181
-		$payment = $this->_post_payment_processing( $payment );
1180
+		$payment = $this->_validate_payment($payment);
1181
+		$payment = $this->_post_payment_processing($payment);
1182 1182
 		// verify payment
1183
-		if ( $payment instanceof EE_Payment ) {
1183
+		if ($payment instanceof EE_Payment) {
1184 1184
 			// store that for later
1185 1185
 			$this->checkout->payment = $payment;
1186 1186
 			/** @type EE_Transaction_Processor $transaction_processor */
1187
-			$transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' );
1187
+			$transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor');
1188 1188
 			// we can also consider the TXN to not have been failed, so temporarily upgrade it's status to abandoned
1189
-			$transaction_processor->toggle_failed_transaction_status( $this->checkout->transaction );
1190
-			if ( $payment->status() == EEM_Payment::status_id_approved || $payment->status() == EEM_Payment::status_id_pending ) {
1189
+			$transaction_processor->toggle_failed_transaction_status($this->checkout->transaction);
1190
+			if ($payment->status() == EEM_Payment::status_id_approved || $payment->status() == EEM_Payment::status_id_pending) {
1191 1191
 				return true;
1192 1192
 			} else {
1193 1193
 				return false;
1194 1194
 			}
1195
-		} else if ( $payment === true ) {
1195
+		} else if ($payment === true) {
1196 1196
 			// please note that offline payment methods will NOT make a payment,
1197 1197
 			// but instead just mark themselves as the PMD_ID on the transaction, and return true
1198 1198
 			$this->checkout->payment = $payment;
@@ -1211,10 +1211,10 @@  discard block
 block discarded – undo
1211 1211
 	 * @return bool
1212 1212
 	 */
1213 1213
 	public function redirect_form() {
1214
-		$payment_method_billing_info = $this->_payment_method_billing_info( $this->_get_payment_method_for_selected_method_of_payment() );
1214
+		$payment_method_billing_info = $this->_payment_method_billing_info($this->_get_payment_method_for_selected_method_of_payment());
1215 1215
 		$html = $payment_method_billing_info->get_html_and_js();
1216 1216
 		$html .= $this->checkout->redirect_form;
1217
-		EE_Registry::instance()->REQ->add_output( $html );
1217
+		EE_Registry::instance()->REQ->add_output($html);
1218 1218
 		return TRUE;
1219 1219
 	}
1220 1220
 
@@ -1227,33 +1227,33 @@  discard block
 block discarded – undo
1227 1227
 	 * @return bool
1228 1228
 	 */
1229 1229
 	private function _billing_form_is_valid() {
1230
-		if ( $this->checkout->billing_form instanceof EE_Billing_Info_Form ) {
1231
-			if ( $this->checkout->billing_form->was_submitted() ) {
1230
+		if ($this->checkout->billing_form instanceof EE_Billing_Info_Form) {
1231
+			if ($this->checkout->billing_form->was_submitted()) {
1232 1232
 				$this->checkout->billing_form->receive_form_submission();
1233
-				if ( $this->checkout->billing_form->is_valid() ) {
1233
+				if ($this->checkout->billing_form->is_valid()) {
1234 1234
 					return TRUE;
1235 1235
 				}
1236 1236
 				$validation_errors = $this->checkout->billing_form->get_validation_errors_accumulated();
1237 1237
 				$error_strings = array();
1238
-				foreach( $validation_errors as $validation_error ){
1239
-					if( $validation_error instanceof EE_Validation_Error ){
1238
+				foreach ($validation_errors as $validation_error) {
1239
+					if ($validation_error instanceof EE_Validation_Error) {
1240 1240
 						$form_section = $validation_error->get_form_section();
1241
-						if( $form_section instanceof EE_Form_Input_Base ){
1241
+						if ($form_section instanceof EE_Form_Input_Base) {
1242 1242
 							$label = $form_section->html_label_text();
1243
-						}elseif( $form_section instanceof EE_Form_Section_Base ){
1243
+						}elseif ($form_section instanceof EE_Form_Section_Base) {
1244 1244
 							$label = $form_section->name();
1245
-						}else{
1246
-							$label = __( 'Validation Error', 'event_espresso' );
1245
+						} else {
1246
+							$label = __('Validation Error', 'event_espresso');
1247 1247
 						}
1248
-						$error_strings[] = sprintf('%1$s: %2$s', $label, $validation_error->getMessage() );
1248
+						$error_strings[] = sprintf('%1$s: %2$s', $label, $validation_error->getMessage());
1249 1249
 					}
1250 1250
 				}
1251
-				EE_Error::add_error( sprintf( __( 'One or more billing form inputs are invalid and require correction before proceeding. %1$s %2$s', 'event_espresso' ), '<br/>', implode( '<br/>', $error_strings )  ), __FILE__, __FUNCTION__, __LINE__ );
1251
+				EE_Error::add_error(sprintf(__('One or more billing form inputs are invalid and require correction before proceeding. %1$s %2$s', 'event_espresso'), '<br/>', implode('<br/>', $error_strings)), __FILE__, __FUNCTION__, __LINE__);
1252 1252
 			} else {
1253
-				EE_Error::add_error( __( 'The billing form was not submitted or something prevented it\'s submission.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
1253
+				EE_Error::add_error(__('The billing form was not submitted or something prevented it\'s submission.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1254 1254
 			}
1255 1255
 		} else {
1256
-			EE_Error::add_error( __( 'The submitted billing form is invalid possibly due to a technical reason.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
1256
+			EE_Error::add_error(__('The submitted billing form is invalid possibly due to a technical reason.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1257 1257
 		}
1258 1258
 		return FALSE;
1259 1259
 	}
@@ -1271,9 +1271,9 @@  discard block
 block discarded – undo
1271 1271
 	 */
1272 1272
 		private function _setup_primary_registrant_prior_to_payment() {
1273 1273
 			// check if transaction has a primary registrant and that it has a related Attendee object
1274
-			if ( ! $this->checkout->transaction_has_primary_registrant() ) {
1274
+			if ( ! $this->checkout->transaction_has_primary_registrant()) {
1275 1275
 				// need to at least gather some primary registrant data before attempting payment
1276
-				if ( $this->checkout->billing_form instanceof EE_Billing_Attendee_Info_Form && ! $this->_capture_primary_registration_data_from_billing_form() ) {
1276
+				if ($this->checkout->billing_form instanceof EE_Billing_Attendee_Info_Form && ! $this->_capture_primary_registration_data_from_billing_form()) {
1277 1277
 					return FALSE;
1278 1278
 				}
1279 1279
 			}
@@ -1281,13 +1281,13 @@  discard block
 block discarded – undo
1281 1281
 			// grab the primary_registration object
1282 1282
 			$primary_registration = $this->checkout->transaction->primary_registration();
1283 1283
 			/** @type EE_Transaction_Processor $transaction_processor */
1284
-			$transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' );
1284
+			$transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor');
1285 1285
 			// at this point we'll consider a TXN to not have been failed
1286
-			$transaction_processor->toggle_failed_transaction_status( $this->checkout->transaction );
1286
+			$transaction_processor->toggle_failed_transaction_status($this->checkout->transaction);
1287 1287
 			// save the TXN ( which clears cached copy of primary_registration)
1288 1288
 			$this->checkout->transaction->save();
1289 1289
 			// grab TXN ID and save it to the primary_registration
1290
-			$primary_registration->set_transaction_id( $this->checkout->transaction->ID() );
1290
+			$primary_registration->set_transaction_id($this->checkout->transaction->ID());
1291 1291
 			// save what we have so far
1292 1292
 			$primary_registration->save();
1293 1293
 			return TRUE;
@@ -1304,41 +1304,41 @@  discard block
 block discarded – undo
1304 1304
 		private function _capture_primary_registration_data_from_billing_form() {
1305 1305
 			// convert billing form data into an attendee
1306 1306
 			$this->checkout->primary_attendee_obj = $this->checkout->billing_form->create_attendee_from_billing_form_data();
1307
-			if ( ! $this->checkout->primary_attendee_obj instanceof EE_Attendee ) {
1307
+			if ( ! $this->checkout->primary_attendee_obj instanceof EE_Attendee) {
1308 1308
 				EE_Error::add_error(
1309 1309
 					sprintf(
1310
-						__( 'The billing form details could not be used for attendee details due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso' ),
1310
+						__('The billing form details could not be used for attendee details due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso'),
1311 1311
 						'<br/>',
1312
-						EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
1312
+						EE_Registry::instance()->CFG->organization->get_pretty('email')
1313 1313
 					), __FILE__, __FUNCTION__, __LINE__
1314 1314
 				);
1315 1315
 				return FALSE;
1316 1316
 			}
1317 1317
 			$primary_registration = $this->checkout->transaction->primary_registration();
1318
-			if ( ! $primary_registration instanceof EE_Registration ) {
1318
+			if ( ! $primary_registration instanceof EE_Registration) {
1319 1319
 				EE_Error::add_error(
1320 1320
 					sprintf(
1321
-						__( 'The primary registrant for this transaction could not be determined due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso' ),
1321
+						__('The primary registrant for this transaction could not be determined due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso'),
1322 1322
 						'<br/>',
1323
-						EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
1323
+						EE_Registry::instance()->CFG->organization->get_pretty('email')
1324 1324
 					), __FILE__, __FUNCTION__, __LINE__
1325 1325
 				);
1326 1326
 				return FALSE;
1327 1327
 			}
1328
-			if ( ! $primary_registration->_add_relation_to( $this->checkout->primary_attendee_obj, 'Attendee' ) instanceof EE_Attendee ) {
1328
+			if ( ! $primary_registration->_add_relation_to($this->checkout->primary_attendee_obj, 'Attendee') instanceof EE_Attendee) {
1329 1329
 				EE_Error::add_error(
1330 1330
 					sprintf(
1331
-						__( 'The primary registrant could not be associated with this transaction due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso' ),
1331
+						__('The primary registrant could not be associated with this transaction due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso'),
1332 1332
 						'<br/>',
1333
-						EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
1333
+						EE_Registry::instance()->CFG->organization->get_pretty('email')
1334 1334
 					), __FILE__, __FUNCTION__, __LINE__
1335 1335
 				);
1336 1336
 				return FALSE;
1337 1337
 			}
1338 1338
 			/** @type EE_Registration_Processor $registration_processor */
1339
-			$registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' );
1339
+			$registration_processor = EE_Registry::instance()->load_class('Registration_Processor');
1340 1340
 			// at this point, we should have enough details about the registrant to consider the registration NOT incomplete
1341
-			$registration_processor->toggle_incomplete_registration_status_to_default( $primary_registration );
1341
+			$registration_processor->toggle_incomplete_registration_status_to_default($primary_registration);
1342 1342
 
1343 1343
 			return TRUE;
1344 1344
 		}
@@ -1354,35 +1354,35 @@  discard block
 block discarded – undo
1354 1354
 	 */
1355 1355
 		private function _get_payment_method_for_selected_method_of_payment() {
1356 1356
 			// get EE_Payment_Method object
1357
-			if ( isset( $this->checkout->available_payment_methods[ $this->checkout->selected_method_of_payment ] )) {
1358
-				$payment_method = $this->checkout->available_payment_methods[ $this->checkout->selected_method_of_payment ];
1357
+			if (isset($this->checkout->available_payment_methods[$this->checkout->selected_method_of_payment])) {
1358
+				$payment_method = $this->checkout->available_payment_methods[$this->checkout->selected_method_of_payment];
1359 1359
 			} else {
1360 1360
 				// load EEM_Payment_Method
1361
-				EE_Registry::instance()->load_model( 'Payment_Method' );
1361
+				EE_Registry::instance()->load_model('Payment_Method');
1362 1362
 				/** @type EEM_Payment_Method $EEM_Payment_Method */
1363 1363
 				$EEM_Payment_Method = EE_Registry::instance()->LIB->EEM_Payment_Method;
1364
-				$payment_method = $EEM_Payment_Method->get_one_by_slug( $this->checkout->selected_method_of_payment );
1364
+				$payment_method = $EEM_Payment_Method->get_one_by_slug($this->checkout->selected_method_of_payment);
1365 1365
 			}
1366 1366
 			// verify $payment_method
1367
-			if ( ! $payment_method instanceof EE_Payment_Method ) {
1367
+			if ( ! $payment_method instanceof EE_Payment_Method) {
1368 1368
 				// not a payment
1369 1369
 				EE_Error::add_error(
1370 1370
 					sprintf(
1371
-						__( 'The selected method of payment could not be determined due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso' ),
1371
+						__('The selected method of payment could not be determined due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso'),
1372 1372
 						'<br/>',
1373
-						EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
1373
+						EE_Registry::instance()->CFG->organization->get_pretty('email')
1374 1374
 					), __FILE__, __FUNCTION__, __LINE__
1375 1375
 				);
1376 1376
 				return NULL;
1377 1377
 			}
1378 1378
 			// and verify it has a valid Payment_Method Type object
1379
-			if ( ! $payment_method->type_obj() instanceof EE_PMT_Base ) {
1379
+			if ( ! $payment_method->type_obj() instanceof EE_PMT_Base) {
1380 1380
 				// not a payment
1381 1381
 				EE_Error::add_error(
1382 1382
 					sprintf(
1383
-						__( 'A valid payment method could not be determined due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso' ),
1383
+						__('A valid payment method could not be determined due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso'),
1384 1384
 						'<br/>',
1385
-						EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
1385
+						EE_Registry::instance()->CFG->organization->get_pretty('email')
1386 1386
 					), __FILE__, __FUNCTION__, __LINE__
1387 1387
 				);
1388 1388
 				return NULL;
@@ -1401,30 +1401,30 @@  discard block
 block discarded – undo
1401 1401
 	 * 	@type 	EE_Payment_Method $payment_method
1402 1402
 	 * 	@return 	mixed	EE_Payment | boolean
1403 1403
 	 */
1404
-	private function _attempt_payment( EE_Payment_Method $payment_method ) {
1405
-		$payment =NULL;
1404
+	private function _attempt_payment(EE_Payment_Method $payment_method) {
1405
+		$payment = NULL;
1406 1406
 		$this->checkout->transaction->save();
1407
-		$payment_processor = EE_Registry::instance()->load_core( 'Payment_Processor' );
1408
-		if ( ! $payment_processor instanceof EE_Payment_Processor ) {
1407
+		$payment_processor = EE_Registry::instance()->load_core('Payment_Processor');
1408
+		if ( ! $payment_processor instanceof EE_Payment_Processor) {
1409 1409
 			return FALSE;
1410 1410
 		}
1411 1411
 		try {
1412
-			$payment_processor->set_revisit( $this->checkout->revisit );
1412
+			$payment_processor->set_revisit($this->checkout->revisit);
1413 1413
 			// generate payment object
1414 1414
 			$payment = $payment_processor->process_payment(
1415 1415
 				$payment_method,
1416 1416
 				$this->checkout->transaction,
1417 1417
 				$this->checkout->amount_owing,
1418 1418
 				$this->checkout->billing_form,
1419
-				$this->_get_return_url( $payment_method ),
1419
+				$this->_get_return_url($payment_method),
1420 1420
 				'CART',
1421 1421
 				$this->checkout->admin_request,
1422 1422
 				TRUE,
1423 1423
 				$this->reg_step_url()
1424 1424
 			);
1425 1425
 
1426
-		} catch( Exception $e ) {
1427
-			$this->_handle_payment_processor_exception( $e );
1426
+		} catch (Exception $e) {
1427
+			$this->_handle_payment_processor_exception($e);
1428 1428
 		}
1429 1429
 		return $payment;
1430 1430
 	}
@@ -1438,12 +1438,12 @@  discard block
 block discarded – undo
1438 1438
 	 * @param \Exception $e
1439 1439
 	 * @return void
1440 1440
 	 */
1441
-	protected function _handle_payment_processor_exception( Exception $e ) {
1441
+	protected function _handle_payment_processor_exception(Exception $e) {
1442 1442
 		EE_Error::add_error(
1443 1443
 			sprintf(
1444
-				__( 'The payment could not br processed due to a technical issue.%1$sPlease try again or contact %2$s for assistance.||The following Exception was thrown in %4$s on line %5$s:%1$s%3$s', 'event_espresso' ),
1444
+				__('The payment could not br processed due to a technical issue.%1$sPlease try again or contact %2$s for assistance.||The following Exception was thrown in %4$s on line %5$s:%1$s%3$s', 'event_espresso'),
1445 1445
 				'<br/>',
1446
-				EE_Registry::instance()->CFG->organization->get_pretty( 'email' ),
1446
+				EE_Registry::instance()->CFG->organization->get_pretty('email'),
1447 1447
 				$e->getMessage(),
1448 1448
 				$e->getFile(),
1449 1449
 				$e->getLine()
@@ -1460,9 +1460,9 @@  discard block
 block discarded – undo
1460 1460
 	 * @param \EE_Payment_Method $payment_method
1461 1461
 	 * @return string
1462 1462
 	 */
1463
-	protected function _get_return_url( EE_Payment_Method $payment_method ) {
1463
+	protected function _get_return_url(EE_Payment_Method $payment_method) {
1464 1464
 		$return_url = '';
1465
-		switch ( $payment_method->type_obj()->payment_occurs() ) {
1465
+		switch ($payment_method->type_obj()->payment_occurs()) {
1466 1466
 
1467 1467
 			case EE_PMT_Base::offsite :
1468 1468
 				$return_url = add_query_arg(
@@ -1493,27 +1493,27 @@  discard block
 block discarded – undo
1493 1493
 	 * @param EE_Payment $payment
1494 1494
 	 * @return EE_Payment | FALSE
1495 1495
 	 */
1496
-	private function _validate_payment( $payment = NULL ) {
1497
-		if (  $this->checkout->payment_method->is_off_line() ) {
1496
+	private function _validate_payment($payment = NULL) {
1497
+		if ($this->checkout->payment_method->is_off_line()) {
1498 1498
 			return TRUE;
1499 1499
 		}
1500 1500
 		// verify payment object
1501
-		if ( $payment instanceof EE_Payment ) {
1501
+		if ($payment instanceof EE_Payment) {
1502 1502
 			if (
1503 1503
 				$payment->status() != EEM_Payment::status_id_approved
1504 1504
 				&& $payment->status() != EEM_Payment::status_id_pending
1505 1505
 				&& $payment->status() != EEM_Payment::status_id_cancelled
1506 1506
 				&& $payment->gateway_response() != ''
1507 1507
 			) {
1508
-				EE_Error::add_error( $payment->gateway_response(), __FILE__, __FUNCTION__, __LINE__ );
1508
+				EE_Error::add_error($payment->gateway_response(), __FILE__, __FUNCTION__, __LINE__);
1509 1509
 			}
1510 1510
 		} else {
1511 1511
 			// not a payment
1512 1512
 			EE_Error::add_error(
1513 1513
 				sprintf(
1514
-					__( 'A valid payment was not generated due to a technical issue.%1$sPlease try again or contact %2$s for assistance.', 'event_espresso' ),
1514
+					__('A valid payment was not generated due to a technical issue.%1$sPlease try again or contact %2$s for assistance.', 'event_espresso'),
1515 1515
 					'<br/>',
1516
-					EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
1516
+					EE_Registry::instance()->CFG->organization->get_pretty('email')
1517 1517
 				), __FILE__, __FUNCTION__, __LINE__
1518 1518
 			);
1519 1519
 			return FALSE;
@@ -1530,23 +1530,23 @@  discard block
 block discarded – undo
1530 1530
 	 * @param EE_Payment $payment
1531 1531
 	 * @return bool
1532 1532
 	 */
1533
-	private function _post_payment_processing( $payment = NULL ) {
1533
+	private function _post_payment_processing($payment = NULL) {
1534 1534
 		// On-Site payment?
1535
-		if ( $this->checkout->payment_method->is_on_site() ) {
1536
-			if ( ! $this->_process_payment_status( $payment, EE_PMT_Base::onsite )) {
1535
+		if ($this->checkout->payment_method->is_on_site()) {
1536
+			if ( ! $this->_process_payment_status($payment, EE_PMT_Base::onsite)) {
1537 1537
 				//$this->_setup_redirect_for_next_step();
1538 1538
 				$this->checkout->continue_reg = false;
1539 1539
 			}
1540 1540
 			// Off-Site payment?
1541
-		} else if ( $this->checkout->payment_method->is_off_site() ) {
1541
+		} else if ($this->checkout->payment_method->is_off_site()) {
1542 1542
 			// if a payment object was made and it specifies a redirect url, then we'll setup that redirect info
1543
-			if ( $payment instanceof EE_Payment && $payment->redirect_url() ){
1544
-				do_action( 'AHEE_log', __CLASS__, __FUNCTION__, $payment->redirect_url(), '$payment->redirect_url()' );
1543
+			if ($payment instanceof EE_Payment && $payment->redirect_url()) {
1544
+				do_action('AHEE_log', __CLASS__, __FUNCTION__, $payment->redirect_url(), '$payment->redirect_url()');
1545 1545
 				$this->checkout->redirect = TRUE;
1546 1546
 				$this->checkout->redirect_form = $payment->redirect_form();
1547
-				$this->checkout->redirect_url = $this->reg_step_url( 'redirect_form' );
1547
+				$this->checkout->redirect_url = $this->reg_step_url('redirect_form');
1548 1548
 				// set JSON response
1549
-				$this->checkout->json_response->set_redirect_form( $this->checkout->redirect_form );
1549
+				$this->checkout->json_response->set_redirect_form($this->checkout->redirect_form);
1550 1550
 				// set cron job for finalizing the TXN
1551 1551
 				// in case the user does not return from the off-site gateway
1552 1552
 				EE_Cron_Tasks::schedule_finalize_abandoned_transactions_check(
@@ -1554,21 +1554,21 @@  discard block
 block discarded – undo
1554 1554
 					$this->checkout->transaction->ID()
1555 1555
 				);
1556 1556
 				// and lastly, let's bump the payment status to pending
1557
-				$payment->set_status( EEM_Payment::status_id_pending );
1557
+				$payment->set_status(EEM_Payment::status_id_pending);
1558 1558
 				$payment->save();
1559 1559
 			} else {
1560 1560
 				// not a payment
1561 1561
 				$this->checkout->continue_reg = false;
1562 1562
 				EE_Error::add_error(
1563 1563
 					sprintf(
1564
-						__( 'It appears the Off Site Payment Method was not configured properly.%sPlease try again or contact %s for assistance.', 'event_espresso' ),
1564
+						__('It appears the Off Site Payment Method was not configured properly.%sPlease try again or contact %s for assistance.', 'event_espresso'),
1565 1565
 						'<br/>',
1566
-						EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
1566
+						EE_Registry::instance()->CFG->organization->get_pretty('email')
1567 1567
 					), __FILE__, __FUNCTION__, __LINE__
1568 1568
 				);
1569 1569
 			}
1570 1570
 			// Off-Line payment?
1571
-		} else if ( $payment === TRUE ) {
1571
+		} else if ($payment === TRUE) {
1572 1572
 			//$this->_setup_redirect_for_next_step();
1573 1573
 			return TRUE;
1574 1574
 		} else {
@@ -1604,65 +1604,65 @@  discard block
 block discarded – undo
1604 1604
 	 * @return bool
1605 1605
 	 * @throws \EE_Error
1606 1606
 	 */
1607
-	private function _process_payment_status( $payment, $payment_occurs = EE_PMT_Base::offline ) {
1607
+	private function _process_payment_status($payment, $payment_occurs = EE_PMT_Base::offline) {
1608 1608
 		// off-line payment? carry on
1609
-		if ( $payment_occurs == EE_PMT_Base::offline ) {
1609
+		if ($payment_occurs == EE_PMT_Base::offline) {
1610 1610
 			return true;
1611 1611
 		}
1612 1612
 		// verify payment validity
1613
-		if ( $payment instanceof EE_Payment ) {
1614
-			do_action( 'AHEE_log', __CLASS__, __FUNCTION__, $payment->status(), '$payment->status()' );
1613
+		if ($payment instanceof EE_Payment) {
1614
+			do_action('AHEE_log', __CLASS__, __FUNCTION__, $payment->status(), '$payment->status()');
1615 1615
 			$msg = $payment->gateway_response();
1616 1616
 			// check results
1617
-			switch ( $payment->status() ) {
1617
+			switch ($payment->status()) {
1618 1618
 
1619 1619
 				// good payment
1620 1620
 				case EEM_Payment::status_id_approved :
1621
-					EE_Error::add_success( __( 'Your payment was processed successfully.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
1621
+					EE_Error::add_success(__('Your payment was processed successfully.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1622 1622
 					return TRUE;
1623 1623
 					break;
1624 1624
 
1625 1625
 				// slow payment
1626 1626
 				case EEM_Payment::status_id_pending :
1627
-					if ( empty( $msg )) {
1628
-						$msg = __( 'Your payment appears to have been processed successfully, but the Instant Payment Notification has not yet been received. It should arrive shortly.', 'event_espresso' );
1627
+					if (empty($msg)) {
1628
+						$msg = __('Your payment appears to have been processed successfully, but the Instant Payment Notification has not yet been received. It should arrive shortly.', 'event_espresso');
1629 1629
 					}
1630
-					EE_Error::add_success( $msg, __FILE__, __FUNCTION__, __LINE__ );
1630
+					EE_Error::add_success($msg, __FILE__, __FUNCTION__, __LINE__);
1631 1631
 					return TRUE;
1632 1632
 					break;
1633 1633
 
1634 1634
 				// don't wanna payment
1635 1635
 				case EEM_Payment::status_id_cancelled :
1636
-					if ( empty( $msg )) {
1636
+					if (empty($msg)) {
1637 1637
 						$msg = _n(
1638 1638
 							'Payment cancelled. Please try again.',
1639 1639
 							'Payment cancelled. Please try again or select another method of payment.',
1640
-							count( $this->checkout->available_payment_methods ),
1640
+							count($this->checkout->available_payment_methods),
1641 1641
 							'event_espresso'
1642 1642
 						);
1643 1643
 					}
1644
-					EE_Error::add_attention( $msg, __FILE__, __FUNCTION__, __LINE__ );
1644
+					EE_Error::add_attention($msg, __FILE__, __FUNCTION__, __LINE__);
1645 1645
 					return FALSE;
1646 1646
 					break;
1647 1647
 
1648 1648
 				// not enough payment
1649 1649
 				case EEM_Payment::status_id_declined :
1650
-					if ( empty( $msg )) {
1650
+					if (empty($msg)) {
1651 1651
 						$msg = _n(
1652 1652
 							'We\'re sorry but your payment was declined. Please try again.',
1653 1653
 							'We\'re sorry but your payment was declined. Please try again or select another method of payment.',
1654
-							count( $this->checkout->available_payment_methods ),
1654
+							count($this->checkout->available_payment_methods),
1655 1655
 							'event_espresso'
1656 1656
 						);
1657 1657
 					}
1658
-					EE_Error::add_attention( $msg, __FILE__, __FUNCTION__, __LINE__ );
1658
+					EE_Error::add_attention($msg, __FILE__, __FUNCTION__, __LINE__);
1659 1659
 					return FALSE;
1660 1660
 					break;
1661 1661
 
1662 1662
 				// bad payment
1663 1663
 				case EEM_Payment::status_id_failed :
1664
-					if ( ! empty( $msg ) ) {
1665
-						EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
1664
+					if ( ! empty($msg)) {
1665
+						EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1666 1666
 						return false;
1667 1667
 					}
1668 1668
 					// default to error below
@@ -1672,14 +1672,14 @@  discard block
 block discarded – undo
1672 1672
 		}
1673 1673
 		// off-site payment gateway responses are too unreliable, so let's just assume that
1674 1674
 		// the payment processing is just running slower than the registrant's request
1675
-		if ( $payment_occurs == EE_PMT_Base::offsite ) {
1675
+		if ($payment_occurs == EE_PMT_Base::offsite) {
1676 1676
 			return true;
1677 1677
 		}
1678 1678
 		EE_Error::add_error(
1679 1679
 				sprintf(
1680
-					__( 'Your payment could not be processed successfully due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso' ),
1680
+					__('Your payment could not be processed successfully due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso'),
1681 1681
 					'<br/>',
1682
-					EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
1682
+					EE_Registry::instance()->CFG->organization->get_pretty('email')
1683 1683
 				),
1684 1684
 				__FILE__, __FUNCTION__, __LINE__
1685 1685
 			);
@@ -1712,13 +1712,13 @@  discard block
 block discarded – undo
1712 1712
 	public function process_gateway_response() {
1713 1713
 		$payment = null;
1714 1714
 		// how have they chosen to pay?
1715
-		$this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment( true );
1715
+		$this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment(true);
1716 1716
 		// get EE_Payment_Method object
1717
-		if ( ! $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment() ) {
1717
+		if ( ! $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment()) {
1718 1718
 			$this->checkout->continue_reg = false;
1719 1719
 			return false;
1720 1720
 		}
1721
-		if ( ! $this->checkout->payment_method->is_off_site() ) {
1721
+		if ( ! $this->checkout->payment_method->is_off_site()) {
1722 1722
 			return false;
1723 1723
 		}
1724 1724
 		$this->_validate_offsite_return();
@@ -1732,23 +1732,23 @@  discard block
 block discarded – undo
1732 1732
 		//	true
1733 1733
 		//);
1734 1734
 		// verify TXN
1735
-		if ( $this->checkout->transaction instanceof EE_Transaction ) {
1735
+		if ($this->checkout->transaction instanceof EE_Transaction) {
1736 1736
 			$gateway = $this->checkout->payment_method->type_obj()->get_gateway();
1737
-			if ( ! $gateway instanceof EE_Offsite_Gateway ) {
1737
+			if ( ! $gateway instanceof EE_Offsite_Gateway) {
1738 1738
 				$this->checkout->continue_reg = false;
1739 1739
 				return false;
1740 1740
 			}
1741
-			$payment = $this->_process_off_site_payment( $gateway );
1742
-			$payment = $this->_process_cancelled_payments( $payment );
1743
-			$payment = $this->_validate_payment( $payment );
1741
+			$payment = $this->_process_off_site_payment($gateway);
1742
+			$payment = $this->_process_cancelled_payments($payment);
1743
+			$payment = $this->_validate_payment($payment);
1744 1744
 			// if payment was not declined by the payment gateway or cancelled by the registrant
1745
-			if ( $this->_process_payment_status( $payment, EE_PMT_Base::offsite ) ) {
1745
+			if ($this->_process_payment_status($payment, EE_PMT_Base::offsite)) {
1746 1746
 				//$this->_setup_redirect_for_next_step();
1747 1747
 				// store that for later
1748 1748
 				$this->checkout->payment = $payment;
1749 1749
 				// mark this reg step as completed, as long as gateway doesn't use a separate IPN request,
1750 1750
 				// because we will complete this step during the IPN processing then
1751
-				if ( $gateway instanceof EE_Offsite_Gateway && ! $gateway->uses_separate_IPN_request() ) {
1751
+				if ($gateway instanceof EE_Offsite_Gateway && ! $gateway->uses_separate_IPN_request()) {
1752 1752
 					$this->set_completed();
1753 1753
 				}
1754 1754
 				return true;
@@ -1771,19 +1771,19 @@  discard block
 block discarded – undo
1771 1771
 	 * @return bool
1772 1772
 	 */
1773 1773
 	private function _validate_offsite_return() {
1774
-		$TXN_ID = (int)EE_Registry::instance()->REQ->get( 'spco_txn', 0 );
1775
-		if ( $TXN_ID != $this->checkout->transaction->ID() ) {
1774
+		$TXN_ID = (int) EE_Registry::instance()->REQ->get('spco_txn', 0);
1775
+		if ($TXN_ID != $this->checkout->transaction->ID()) {
1776 1776
 			// Houston... we might have a problem
1777 1777
 			$invalid_TXN = false;
1778 1778
 			// first gather some info
1779
-			$valid_TXN = EEM_Transaction::instance()->get_one_by_ID( $TXN_ID );
1779
+			$valid_TXN = EEM_Transaction::instance()->get_one_by_ID($TXN_ID);
1780 1780
 			$primary_registrant = $valid_TXN instanceof EE_Transaction ? $valid_TXN->primary_registration() : null;
1781 1781
 			// let's start by retrieving the cart for this TXN
1782
-			$cart = EE_Cart::get_cart_from_txn( $this->checkout->transaction );
1783
-			if ( $cart instanceof EE_Cart ) {
1782
+			$cart = EE_Cart::get_cart_from_txn($this->checkout->transaction);
1783
+			if ($cart instanceof EE_Cart) {
1784 1784
 				// verify that the current cart has tickets
1785 1785
 				$tickets = $cart->get_tickets();
1786
-				if ( empty( $tickets ) ) {
1786
+				if (empty($tickets)) {
1787 1787
 					$invalid_TXN = true;
1788 1788
 				}
1789 1789
 			} else {
@@ -1791,39 +1791,39 @@  discard block
 block discarded – undo
1791 1791
 			}
1792 1792
 			$valid_TXN_SID = $primary_registrant instanceof EE_Registration ? $primary_registrant->session_ID() : null;
1793 1793
 			// validate current Session ID and compare against valid TXN session ID
1794
-			if ( EE_Session::instance()->id() === null ) {
1794
+			if (EE_Session::instance()->id() === null) {
1795 1795
 				$invalid_TXN = true;
1796
-			} else if ( EE_Session::instance()->id() === $valid_TXN_SID ) {
1796
+			} else if (EE_Session::instance()->id() === $valid_TXN_SID) {
1797 1797
 				// WARNING !!!
1798 1798
 				// this could be PayPal sending back duplicate requests (ya they do that)
1799 1799
 				// or it **could** mean someone is simply registering AGAIN after having just done so
1800 1800
 				// so now we need to determine if this current TXN looks valid or not
1801 1801
 				/** @type EE_Transaction_Processor $transaction_processor */
1802
-				$transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' );
1802
+				$transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor');
1803 1803
 				// has this step even been started ?
1804
-				if ( $transaction_processor->reg_step_completed( $this->checkout->transaction, $this->slug() === false )
1804
+				if ($transaction_processor->reg_step_completed($this->checkout->transaction, $this->slug() === false)
1805 1805
 				) {
1806 1806
 					// really? you're half way through this reg step, but you never started it ?
1807 1807
 					$invalid_TXN = true;
1808 1808
 				}
1809 1809
 			}
1810
-			if ( $invalid_TXN ) {
1810
+			if ($invalid_TXN) {
1811 1811
 				// is the valid TXN completed ?
1812
-				if ( $valid_TXN instanceof EE_Transaction ) {
1812
+				if ($valid_TXN instanceof EE_Transaction) {
1813 1813
 					/** @type EE_Transaction_Processor $transaction_processor */
1814
-					$transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' );
1814
+					$transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor');
1815 1815
 					// has this step even been started ?
1816
-					$reg_step_completed = $transaction_processor->reg_step_completed( $valid_TXN, $this->slug() );
1817
-					if ( $reg_step_completed !== false && $reg_step_completed !== true ) {
1816
+					$reg_step_completed = $transaction_processor->reg_step_completed($valid_TXN, $this->slug());
1817
+					if ($reg_step_completed !== false && $reg_step_completed !== true) {
1818 1818
 						// so it **looks** like this is a double request from PayPal
1819 1819
 						// so let's try to pick up where we left off
1820 1820
 						$this->checkout->transaction = $valid_TXN;
1821
-						$this->checkout->refresh_all_entities( true );
1821
+						$this->checkout->refresh_all_entities(true);
1822 1822
 						return;
1823 1823
 					}
1824 1824
 				}
1825 1825
 				// you appear to be lost?
1826
-				$this->_redirect_wayward_request( $primary_registrant );
1826
+				$this->_redirect_wayward_request($primary_registrant);
1827 1827
 			}
1828 1828
 		}
1829 1829
 	}
@@ -1837,16 +1837,16 @@  discard block
 block discarded – undo
1837 1837
 	 * @param \EE_Registration $primary_registrant
1838 1838
 	 * @return bool
1839 1839
 	 */
1840
-	private function _redirect_wayward_request( EE_Registration $primary_registrant ) {
1841
-		if ( ! $primary_registrant instanceof EE_Registration ) {
1840
+	private function _redirect_wayward_request(EE_Registration $primary_registrant) {
1841
+		if ( ! $primary_registrant instanceof EE_Registration) {
1842 1842
 			// try redirecting based on the current TXN
1843 1843
 			$primary_registrant = $this->checkout->transaction instanceof EE_Transaction ? $this->checkout->transaction->primary_registration() : null;
1844
-			if ( ! $primary_registrant instanceof EE_Registration ) {
1844
+			if ( ! $primary_registrant instanceof EE_Registration) {
1845 1845
 				EE_Error::add_error(
1846 1846
 					sprintf(
1847
-						__( 'Invalid information was received from the Off-Site Payment Processor and your Transaction details could not be retrieved from the database.%1$sPlease try again or contact %2$s for assistance.', 'event_espresso' ),
1847
+						__('Invalid information was received from the Off-Site Payment Processor and your Transaction details could not be retrieved from the database.%1$sPlease try again or contact %2$s for assistance.', 'event_espresso'),
1848 1848
 						'<br/>',
1849
-						EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
1849
+						EE_Registry::instance()->CFG->organization->get_pretty('email')
1850 1850
 					),
1851 1851
 					__FILE__, __FUNCTION__, __LINE__
1852 1852
 				);
@@ -1874,16 +1874,16 @@  discard block
 block discarded – undo
1874 1874
 	 * @param \EE_Offsite_Gateway $gateway
1875 1875
 	 * @return \EE_Payment
1876 1876
 	 */
1877
-	private function _process_off_site_payment( EE_Offsite_Gateway $gateway ) {
1877
+	private function _process_off_site_payment(EE_Offsite_Gateway $gateway) {
1878 1878
 		try {
1879 1879
 			// if gateway uses_separate_IPN_request, then we don't have to process the IPN manually
1880
-			if ( $gateway instanceof EE_Offsite_Gateway && $gateway->uses_separate_IPN_request() ) {
1880
+			if ($gateway instanceof EE_Offsite_Gateway && $gateway->uses_separate_IPN_request()) {
1881 1881
 				$payment = $this->checkout->transaction->last_payment();
1882 1882
 				//$payment_source = 'last_payment';
1883 1883
 			} else {
1884 1884
 				// get payment details and process results
1885 1885
 				/** @type EE_Payment_Processor $payment_processor */
1886
-				$payment_processor = EE_Registry::instance()->load_core( 'Payment_Processor' );
1886
+				$payment_processor = EE_Registry::instance()->load_core('Payment_Processor');
1887 1887
 				$payment = $payment_processor->process_ipn(
1888 1888
 					$_REQUEST,
1889 1889
 					$this->checkout->transaction,
@@ -1893,14 +1893,14 @@  discard block
 block discarded – undo
1893 1893
 				);
1894 1894
 				//$payment_source = 'process_ipn';
1895 1895
 			}
1896
-		} catch ( Exception $e ) {
1896
+		} catch (Exception $e) {
1897 1897
 			// let's just eat the exception and try to move on using any previously set payment info
1898 1898
 			$payment = $this->checkout->transaction->last_payment();
1899 1899
 			//$payment_source = 'last_payment after Exception';
1900 1900
 			// but if we STILL don't have a payment object
1901
-			if ( ! $payment instanceof EE_Payment ) {
1901
+			if ( ! $payment instanceof EE_Payment) {
1902 1902
 				// then we'll object ! ( not object like a thing... but object like what a lawyer says ! )
1903
-				$this->_handle_payment_processor_exception( $e );
1903
+				$this->_handle_payment_processor_exception($e);
1904 1904
 			}
1905 1905
 		}
1906 1906
 		// DEBUG LOG
@@ -1924,13 +1924,13 @@  discard block
 block discarded – undo
1924 1924
 	 * @param EE_Payment $payment
1925 1925
 	 * @return EE_Payment | FALSE
1926 1926
 	 */
1927
-	private function _process_cancelled_payments( $payment = NULL ) {
1927
+	private function _process_cancelled_payments($payment = NULL) {
1928 1928
 		if (
1929
-			isset( $_REQUEST[ 'ee_cancel_payment' ] )
1929
+			isset($_REQUEST['ee_cancel_payment'])
1930 1930
 			&& $payment instanceof EE_Payment
1931 1931
 			&& $payment->status() == EEM_Payment::status_id_failed
1932 1932
 		) {
1933
-			$payment->set_status( EEM_Payment::status_id_cancelled );
1933
+			$payment->set_status(EEM_Payment::status_id_cancelled);
1934 1934
 		}
1935 1935
 		return $payment;
1936 1936
 	}
@@ -1947,23 +1947,23 @@  discard block
 block discarded – undo
1947 1947
 	public function get_transaction_details_for_gateways() {
1948 1948
 		$txn_details = array();
1949 1949
 		// ya gotta make a choice man
1950
-		if ( empty( $this->checkout->selected_method_of_payment ) ) {
1950
+		if (empty($this->checkout->selected_method_of_payment)) {
1951 1951
 			$txn_details = array(
1952
-				'error' => __( 'Please select a method of payment before proceeding.', 'event_espresso' )
1952
+				'error' => __('Please select a method of payment before proceeding.', 'event_espresso')
1953 1953
 			);
1954 1954
 		}
1955 1955
 		// get EE_Payment_Method object
1956 1956
 		if (
1957
-			empty( $txn_details ) &&
1957
+			empty($txn_details) &&
1958 1958
 			! $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment()
1959 1959
 		) {
1960 1960
 			$txn_details = array(
1961 1961
 				'selected_method_of_payment' => $this->checkout->selected_method_of_payment,
1962
-				'error' => __( 'A valid Payment Method could not be determined.', 'event_espresso' )
1962
+				'error' => __('A valid Payment Method could not be determined.', 'event_espresso')
1963 1963
 			);
1964 1964
 		}
1965
-		if ( empty( $txn_details ) && $this->checkout->transaction instanceof EE_Transaction ) {
1966
-			$return_url = $this->_get_return_url( $this->checkout->payment_method );
1965
+		if (empty($txn_details) && $this->checkout->transaction instanceof EE_Transaction) {
1966
+			$return_url = $this->_get_return_url($this->checkout->payment_method);
1967 1967
 			$txn_details = array(
1968 1968
 				'TXN_ID'        			=> $this->checkout->transaction->ID(),
1969 1969
 				'TXN_timestamp' 	=> $this->checkout->transaction->datetime(),
@@ -1974,7 +1974,7 @@  discard block
 block discarded – undo
1974 1974
 				'PMD_ID'        			=> $this->checkout->transaction->payment_method_ID(),
1975 1975
 				'payment_amount' => $this->checkout->amount_owing,
1976 1976
 				'return_url' 				=> $return_url,
1977
-				'cancel_url' 				=> add_query_arg( array( 'ee_cancel_payment' => true ), $return_url ),
1977
+				'cancel_url' 				=> add_query_arg(array('ee_cancel_payment' => true), $return_url),
1978 1978
 				'notify_url' 				=> EE_Config::instance()->core->txn_page_url(
1979 1979
 					array(
1980 1980
 						'e_reg_url_link'    			=> $this->checkout->transaction->primary_registration()->reg_url_link(),
@@ -1983,7 +1983,7 @@  discard block
 block discarded – undo
1983 1983
 				)
1984 1984
 			);
1985 1985
 		}
1986
-		echo json_encode( $txn_details );
1986
+		echo json_encode($txn_details);
1987 1987
 		exit();
1988 1988
 	}
1989 1989
 
Please login to merge, or discard this patch.
libraries/line_item_display/EE_SPCO_Line_Item_Display_Strategy.strategy.php 1 patch
Spacing   +118 added lines, -118 removed lines patch added patch discarded remove patch
@@ -69,104 +69,104 @@  discard block
 block discarded – undo
69 69
 	 * @param array        $options
70 70
 	 * @return mixed
71 71
 	 */
72
-	public function display_line_item( EE_Line_Item $line_item, $options = array() ) {
72
+	public function display_line_item(EE_Line_Item $line_item, $options = array()) {
73 73
 
74
-		EE_Registry::instance()->load_helper( 'Template' );
75
-		EE_Registry::instance()->load_helper( 'HTML' );
74
+		EE_Registry::instance()->load_helper('Template');
75
+		EE_Registry::instance()->load_helper('HTML');
76 76
 
77 77
 		$html = '';
78 78
 		// set some default options and merge with incoming
79 79
 		$default_options = array(
80
-			'show_desc' => true,  // 	true 		false
80
+			'show_desc' => true, // 	true 		false
81 81
 			'odd' => false
82 82
 		);
83
-		$options = array_merge( $default_options, (array)$options );
83
+		$options = array_merge($default_options, (array) $options);
84 84
 
85
-		switch( $line_item->type() ) {
85
+		switch ($line_item->type()) {
86 86
 
87 87
 			case EEM_Line_Item::type_line_item:
88 88
 				$this->_show_taxes = $line_item->is_taxable() ? true : $this->_show_taxes;
89
-				if ( $line_item->OBJ_type() == 'Ticket' ) {
89
+				if ($line_item->OBJ_type() == 'Ticket') {
90 90
 					// item row
91
-					$html .= $this->_ticket_row( $line_item, $options );
91
+					$html .= $this->_ticket_row($line_item, $options);
92 92
 					// got any kids?
93
-					foreach ( $line_item->children() as $child_line_item ) {
94
-						$this->display_line_item( $child_line_item, $options );
93
+					foreach ($line_item->children() as $child_line_item) {
94
+						$this->display_line_item($child_line_item, $options);
95 95
 					}
96 96
 				} else {
97 97
 					// item row
98
-					$html .= $this->_item_row( $line_item, $options );
98
+					$html .= $this->_item_row($line_item, $options);
99 99
 					// got any kids?
100
-					foreach ( $line_item->children() as $child_line_item ) {
101
-						$this->display_line_item( $child_line_item, $options );
100
+					foreach ($line_item->children() as $child_line_item) {
101
+						$this->display_line_item($child_line_item, $options);
102 102
 					}
103 103
 				}
104 104
 				break;
105 105
 
106 106
 			case EEM_Line_Item::type_sub_line_item:
107
-				$html .= $this->_sub_item_row( $line_item, $options );
107
+				$html .= $this->_sub_item_row($line_item, $options);
108 108
 				break;
109 109
 
110 110
 			case EEM_Line_Item::type_sub_total:
111 111
 				static $sub_total = 0;
112 112
 				$event_sub_total = 0;
113
-				$text = __( 'Sub-Total', 'event_espresso' );
114
-				if ( $line_item->OBJ_type() == 'Event' ) {
115
-					$options[ 'event_id' ] = $event_id = $line_item->OBJ_ID();
116
-					if ( ! isset( $this->_events[ $options[ 'event_id' ] ] ) ) {
117
-						$event = EEM_Event::instance()->get_one_by_ID( $options[ 'event_id' ] );
118
-						if ( $event instanceof EE_Event ) {
119
-							if ( $event->default_registration_status() == EEM_Registration::status_id_not_approved ) {
113
+				$text = __('Sub-Total', 'event_espresso');
114
+				if ($line_item->OBJ_type() == 'Event') {
115
+					$options['event_id'] = $event_id = $line_item->OBJ_ID();
116
+					if ( ! isset($this->_events[$options['event_id']])) {
117
+						$event = EEM_Event::instance()->get_one_by_ID($options['event_id']);
118
+						if ($event instanceof EE_Event) {
119
+							if ($event->default_registration_status() == EEM_Registration::status_id_not_approved) {
120 120
 								return '';
121 121
 							}
122 122
 						}
123
-						$this->_events[ $options[ 'event_id' ] ] = 0;
124
-						$html .= $this->_event_row( $line_item );
125
-						$text = __( 'Event Sub-Total', 'event_espresso' );
123
+						$this->_events[$options['event_id']] = 0;
124
+						$html .= $this->_event_row($line_item);
125
+						$text = __('Event Sub-Total', 'event_espresso');
126 126
 					}
127 127
 				}
128 128
 				$child_line_items = $line_item->children();
129 129
 				// loop thru children
130
-				foreach( $child_line_items as $child_line_item ) {
130
+				foreach ($child_line_items as $child_line_item) {
131 131
 					// recursively feed children back into this method
132
-					$html .= $this->display_line_item( $child_line_item, $options );
132
+					$html .= $this->display_line_item($child_line_item, $options);
133 133
 				}
134
-				$event_sub_total += isset( $options[ 'event_id' ] ) ? $this->_events[ $options[ 'event_id' ] ] : 0;
134
+				$event_sub_total += isset($options['event_id']) ? $this->_events[$options['event_id']] : 0;
135 135
 				$sub_total += $event_sub_total;
136 136
 				if (
137 137
 					(
138 138
 						// event subtotals
139 139
 						$line_item->code() != 'pre-tax-subtotal' &&
140
-						count( $child_line_items ) > 1
140
+						count($child_line_items) > 1
141 141
 					)
142 142
 					||
143 143
 					(
144 144
 						// pre-tax subtotals
145 145
 						$line_item->code() == 'pre-tax-subtotal' &&
146
-						count( $this->_events ) > 1
146
+						count($this->_events) > 1
147 147
 					)
148 148
 				) {
149 149
 					$options['sub_total'] = $line_item->OBJ_type() == 'Event' ? $event_sub_total : $sub_total;
150
-					$html .= $this->_sub_total_row( $line_item, $text, $options );
150
+					$html .= $this->_sub_total_row($line_item, $text, $options);
151 151
 				}
152 152
 				break;
153 153
 
154 154
 			case EEM_Line_Item::type_tax:
155
-				if ( $this->_show_taxes ) {
156
-					$this->_taxes_html .= $this->_tax_row( $line_item, $options );
155
+				if ($this->_show_taxes) {
156
+					$this->_taxes_html .= $this->_tax_row($line_item, $options);
157 157
 				}
158 158
 				break;
159 159
 
160 160
 			case EEM_Line_Item::type_tax_sub_total:
161
-				if ( $this->_show_taxes ) {
161
+				if ($this->_show_taxes) {
162 162
 					$child_line_items = $line_item->children();
163 163
 					// loop thru children
164
-					foreach( $child_line_items as $child_line_item ) {
164
+					foreach ($child_line_items as $child_line_item) {
165 165
 						// recursively feed children back into this method
166
-						$html .= $this->display_line_item( $child_line_item, $options );
166
+						$html .= $this->display_line_item($child_line_item, $options);
167 167
 					}
168
-					if ( count( $child_line_items ) > 1 ) {
169
-						$this->_taxes_html .= $this->_total_tax_row( $line_item, __( 'Tax Total', 'event_espresso' ) );
168
+					if (count($child_line_items) > 1) {
169
+						$this->_taxes_html .= $this->_total_tax_row($line_item, __('Tax Total', 'event_espresso'));
170 170
 					}
171 171
 				}
172 172
 				break;
@@ -175,25 +175,25 @@  discard block
 block discarded – undo
175 175
 				// get all child line items
176 176
 				$children = $line_item->children();
177 177
 				// loop thru all non-tax child line items
178
-				foreach( $children as $child_line_item ) {
179
-					if ( $child_line_item->type() != EEM_Line_Item::type_tax_sub_total ) {
178
+				foreach ($children as $child_line_item) {
179
+					if ($child_line_item->type() != EEM_Line_Item::type_tax_sub_total) {
180 180
 						// recursively feed children back into this method
181
-						$html .= $this->display_line_item( $child_line_item, $options );
181
+						$html .= $this->display_line_item($child_line_item, $options);
182 182
 					}
183 183
 				}
184 184
 
185 185
 				// now loop thru  tax child line items
186
-				foreach( $children as $child_line_item ) {
187
-					if ( $child_line_item->type() == EEM_Line_Item::type_tax_sub_total ) {
186
+				foreach ($children as $child_line_item) {
187
+					if ($child_line_item->type() == EEM_Line_Item::type_tax_sub_total) {
188 188
 						// recursively feed children back into this method
189
-						$html .= $this->display_line_item( $child_line_item, $options );
189
+						$html .= $this->display_line_item($child_line_item, $options);
190 190
 					}
191 191
 				}
192 192
 				$html .= $this->_taxes_html;
193
-				$html .= $this->_total_row( $line_item, __('Total', 'event_espresso') );
193
+				$html .= $this->_total_row($line_item, __('Total', 'event_espresso'));
194 194
 
195 195
 
196
-				$html .= $this->_payments_and_amount_owing_rows( $line_item, $options );
196
+				$html .= $this->_payments_and_amount_owing_rows($line_item, $options);
197 197
 				break;
198 198
 
199 199
 		}
@@ -208,11 +208,11 @@  discard block
 block discarded – undo
208 208
 	 * @param EE_Line_Item $line_item
209 209
 	 * @return mixed
210 210
 	 */
211
-	private function _event_row( EE_Line_Item $line_item ) {
211
+	private function _event_row(EE_Line_Item $line_item) {
212 212
 		// start of row
213
-		$html = EEH_HTML::tr( '', 'event-cart-total-row', 'total_tr odd' );
213
+		$html = EEH_HTML::tr('', 'event-cart-total-row', 'total_tr odd');
214 214
 		// event name td
215
-		$html .= EEH_HTML::td( EEH_HTML::strong( $line_item->name() ), '', 'event-header', '', ' colspan="4"' );
215
+		$html .= EEH_HTML::td(EEH_HTML::strong($line_item->name()), '', 'event-header', '', ' colspan="4"');
216 216
 		// end of row
217 217
 		$html .= EEH_HTML::trx();
218 218
 		return $html;
@@ -227,10 +227,10 @@  discard block
 block discarded – undo
227 227
 	 * @param array        $options
228 228
 	 * @return mixed
229 229
 	 */
230
-	private function _ticket_row( EE_Line_Item $line_item, $options = array() ) {
230
+	private function _ticket_row(EE_Line_Item $line_item, $options = array()) {
231 231
 		// start of row
232 232
 		$row_class = $options['odd'] ? 'item odd' : 'item';
233
-		$html = EEH_HTML::tr( '', '', $row_class );
233
+		$html = EEH_HTML::tr('', '', $row_class);
234 234
 		// name && desc
235 235
 		$name_and_desc = apply_filters(
236 236
 			'FHEE__EE_SPCO_Line_Item_Display_Strategy__item_row__name',
@@ -239,23 +239,23 @@  discard block
 block discarded – undo
239 239
 		);
240 240
 		$name_and_desc .= apply_filters(
241 241
 			'FHEE__EE_SPCO_Line_Item_Display_Strategy__item_row__desc',
242
-			( $options['show_desc'] ? '<span class="line-item-desc-spn smaller-text">: ' . $line_item->desc() . '</span>' : '' ),
242
+			($options['show_desc'] ? '<span class="line-item-desc-spn smaller-text">: '.$line_item->desc().'</span>' : ''),
243 243
 			$line_item,
244 244
 			$options
245 245
 		);
246 246
 		$name_and_desc .= $line_item->is_taxable() ? ' * ' : '';
247 247
 		// name td
248
-		$html .= EEH_HTML::td( /*__FUNCTION__ .*/ $name_and_desc, '',  'item_l' );
248
+		$html .= EEH_HTML::td( /*__FUNCTION__ .*/ $name_and_desc, '', 'item_l' );
249 249
 		// price td
250
-		$html .= EEH_HTML::td( $line_item->unit_price_no_code(), '',  'item_c jst-rght' );
250
+		$html .= EEH_HTML::td($line_item->unit_price_no_code(), '', 'item_c jst-rght');
251 251
 		// quantity td
252
-		$html .= EEH_HTML::td( $line_item->quantity(), '', 'item_l jst-rght' );
252
+		$html .= EEH_HTML::td($line_item->quantity(), '', 'item_l jst-rght');
253 253
 		$this->_total_items += $line_item->quantity();
254 254
 		// determine total for line item
255 255
 		$total = $line_item->total();
256
-		$this->_events[ $options[ 'event_id' ] ] += $total;
256
+		$this->_events[$options['event_id']] += $total;
257 257
 		// total td
258
-		$html .= EEH_HTML::td( EEH_Template::format_currency( $total, false, false ), '',  'item_r jst-rght' );
258
+		$html .= EEH_HTML::td(EEH_Template::format_currency($total, false, false), '', 'item_r jst-rght');
259 259
 		// end of row
260 260
 		$html .= EEH_HTML::trx();
261 261
 		return $html;
@@ -270,38 +270,38 @@  discard block
 block discarded – undo
270 270
 	 * @param array        $options
271 271
 	 * @return mixed
272 272
 	 */
273
-	private function _item_row( EE_Line_Item $line_item, $options = array() ) {
273
+	private function _item_row(EE_Line_Item $line_item, $options = array()) {
274 274
 		// start of row
275 275
 		$row_class = $options['odd'] ? 'item odd' : 'item';
276
-		$html = EEH_HTML::tr( '', '', $row_class );
276
+		$html = EEH_HTML::tr('', '', $row_class);
277 277
 		// name && desc
278 278
 		$name_and_desc = apply_filters(
279 279
 			'FHEE__EE_SPCO_Line_Item_Display_Strategy__item_row__name',
280
-			$line_item->OBJ_type() . ': ' . $line_item->name(),
280
+			$line_item->OBJ_type().': '.$line_item->name(),
281 281
 			$line_item
282 282
 		);
283 283
 		$name_and_desc .= apply_filters(
284 284
 			'FHEE__EE_SPCO_Line_Item_Display_Strategy__item_row__desc',
285
-			( $options['show_desc'] ? '<span class="line-item-desc-spn smaller-text">: ' . $line_item->desc() . '</span>' : '' ),
285
+			($options['show_desc'] ? '<span class="line-item-desc-spn smaller-text">: '.$line_item->desc().'</span>' : ''),
286 286
 			$line_item,
287 287
 			$options
288 288
 		);
289 289
 		$name_and_desc .= $line_item->is_taxable() ? ' * ' : '';
290 290
 		// name td
291
-		$html .= EEH_HTML::td( $name_and_desc, '',  'item_l' );
291
+		$html .= EEH_HTML::td($name_and_desc, '', 'item_l');
292 292
 		// price td
293
-		if ( $line_item->is_percent() ) {
294
-			$html .= EEH_HTML::td( $line_item->percent() . '%', '', 'item_c jst-rght' );
293
+		if ($line_item->is_percent()) {
294
+			$html .= EEH_HTML::td($line_item->percent().'%', '', 'item_c jst-rght');
295 295
 		} else {
296
-			$html .= EEH_HTML::td( $line_item->unit_price_no_code(), '', 'item_c jst-rght' );
296
+			$html .= EEH_HTML::td($line_item->unit_price_no_code(), '', 'item_c jst-rght');
297 297
 		}
298 298
 		// quantity td
299
-		$html .= EEH_HTML::td( $line_item->quantity(), '', 'item_l jst-rght' );
299
+		$html .= EEH_HTML::td($line_item->quantity(), '', 'item_l jst-rght');
300 300
 		//$total = $line_item->total() * $line_item->quantity();
301 301
 		$total = $line_item->total();
302
-		$this->_events[ $options[ 'event_id' ] ] += $total;
302
+		$this->_events[$options['event_id']] += $total;
303 303
 		// total td
304
-		$html .= EEH_HTML::td( EEH_Template::format_currency( $total, false, false ), '',  'item_r jst-rght' );
304
+		$html .= EEH_HTML::td(EEH_Template::format_currency($total, false, false), '', 'item_r jst-rght');
305 305
 		// end of row
306 306
 		$html .= EEH_HTML::trx();
307 307
 		return $html;
@@ -316,22 +316,22 @@  discard block
 block discarded – undo
316 316
 	 * @param array        $options
317 317
 	 * @return mixed
318 318
 	 */
319
-	private function _sub_item_row( EE_Line_Item $line_item, $options = array() ) {
319
+	private function _sub_item_row(EE_Line_Item $line_item, $options = array()) {
320 320
 		// start of row
321
-		$html = EEH_HTML::tr( '', 'item sub-item-row' );
321
+		$html = EEH_HTML::tr('', 'item sub-item-row');
322 322
 		// name && desc
323 323
 		$name_and_desc = $line_item->name();
324
-		$name_and_desc .= $options['show_desc'] ? '<span class="line-sub-item-desc-spn smaller-text">: ' . $line_item->desc() . '</span>' : '';
324
+		$name_and_desc .= $options['show_desc'] ? '<span class="line-sub-item-desc-spn smaller-text">: '.$line_item->desc().'</span>' : '';
325 325
 		// name td
326
-		$html .= EEH_HTML::td( /*__FUNCTION__ .*/ $name_and_desc, '',  'item_l sub-item' );
326
+		$html .= EEH_HTML::td( /*__FUNCTION__ .*/ $name_and_desc, '', 'item_l sub-item' );
327 327
 		// discount/surcharge td
328
-		if ( $line_item->is_percent() ) {
329
-			$html .= EEH_HTML::td( $line_item->percent() . '%', '',  'item_c' );
328
+		if ($line_item->is_percent()) {
329
+			$html .= EEH_HTML::td($line_item->percent().'%', '', 'item_c');
330 330
 		} else {
331
-			$html .= EEH_HTML::td( $line_item->unit_price_no_code(), '',  'item_c jst-rght' );
331
+			$html .= EEH_HTML::td($line_item->unit_price_no_code(), '', 'item_c jst-rght');
332 332
 		}
333 333
 		// total td
334
-		$html .= EEH_HTML::td( EEH_Template::format_currency( $line_item->total(), false, false ), '',  'item_r jst-rght' );
334
+		$html .= EEH_HTML::td(EEH_Template::format_currency($line_item->total(), false, false), '', 'item_r jst-rght');
335 335
 		// end of row
336 336
 		$html .= EEH_HTML::trx();
337 337
 		return $html;
@@ -346,21 +346,21 @@  discard block
 block discarded – undo
346 346
 	 * @param array        $options
347 347
 	 * @return mixed
348 348
 	 */
349
-	private function _tax_row( EE_Line_Item $line_item, $options = array() ) {
349
+	private function _tax_row(EE_Line_Item $line_item, $options = array()) {
350 350
 		// start of row
351
-		$html = EEH_HTML::tr( '', 'item sub-item tax-total' );
351
+		$html = EEH_HTML::tr('', 'item sub-item tax-total');
352 352
 		// name && desc
353 353
 		$name_and_desc = $line_item->name();
354
-		$name_and_desc .= '<span class="smaller-text lt-grey-text" style="margin:0 0 0 2em;">' . __( ' * taxable items', 'event_espresso' ) . '</span>';
355
-		$name_and_desc .= $options[ 'show_desc' ] ? '<br/>' . $line_item->desc() : '';
354
+		$name_and_desc .= '<span class="smaller-text lt-grey-text" style="margin:0 0 0 2em;">'.__(' * taxable items', 'event_espresso').'</span>';
355
+		$name_and_desc .= $options['show_desc'] ? '<br/>'.$line_item->desc() : '';
356 356
 		// name td
357
-		$html .= EEH_HTML::td( /*__FUNCTION__ .*/ $name_and_desc, '',  'item_l sub-item' );
357
+		$html .= EEH_HTML::td( /*__FUNCTION__ .*/ $name_and_desc, '', 'item_l sub-item' );
358 358
 		// percent td
359
-		$html .= EEH_HTML::td( $line_item->percent() . '%', '',  ' jst-rght', '' );
359
+		$html .= EEH_HTML::td($line_item->percent().'%', '', ' jst-rght', '');
360 360
 		// empty td (price)
361
-		$html .= EEH_HTML::td( EEH_HTML::nbsp() );
361
+		$html .= EEH_HTML::td(EEH_HTML::nbsp());
362 362
 		// total td
363
-		$html .= EEH_HTML::td( EEH_Template::format_currency( $line_item->total(), false, false ), '',  'item_r jst-rght' );
363
+		$html .= EEH_HTML::td(EEH_Template::format_currency($line_item->total(), false, false), '', 'item_r jst-rght');
364 364
 		// end of row
365 365
 		$html .= EEH_HTML::trx();
366 366
 		return $html;
@@ -375,17 +375,17 @@  discard block
 block discarded – undo
375 375
 	 * @param string $text
376 376
 	 * @return mixed
377 377
 	 */
378
-	private function _total_tax_row( EE_Line_Item $line_item, $text = '' ) {
378
+	private function _total_tax_row(EE_Line_Item $line_item, $text = '') {
379 379
 		$html = '';
380
-		if ( $line_item->total() ) {
380
+		if ($line_item->total()) {
381 381
 			// start of row
382
-			$html = EEH_HTML::tr( '', '', 'total_tr odd' );
382
+			$html = EEH_HTML::tr('', '', 'total_tr odd');
383 383
 			// total td
384
-			$html .= EEH_HTML::td( $text, '', 'total_currency total jst-rght', '', ' colspan="2"' );
384
+			$html .= EEH_HTML::td($text, '', 'total_currency total jst-rght', '', ' colspan="2"');
385 385
 			// empty td (price)
386
-			$html .= EEH_HTML::td( EEH_HTML::nbsp() );
386
+			$html .= EEH_HTML::td(EEH_HTML::nbsp());
387 387
 			// total td
388
-			$html .= EEH_HTML::td( EEH_Template::format_currency( $line_item->total(), false, false ), '', 'total jst-rght' );
388
+			$html .= EEH_HTML::td(EEH_Template::format_currency($line_item->total(), false, false), '', 'total jst-rght');
389 389
 			// end of row
390 390
 			$html .= EEH_HTML::trx();
391 391
 		}
@@ -402,15 +402,15 @@  discard block
 block discarded – undo
402 402
 	 * @param array        $options
403 403
 	 * @return mixed
404 404
 	 */
405
-	private function _sub_total_row( EE_Line_Item $line_item, $text = '', $options = array() ) {
405
+	private function _sub_total_row(EE_Line_Item $line_item, $text = '', $options = array()) {
406 406
 		$html = '';
407
-		if ( $line_item->total() ) {
407
+		if ($line_item->total()) {
408 408
 			// start of row
409
-			$html = EEH_HTML::tr( '', '', 'total_tr odd' );
409
+			$html = EEH_HTML::tr('', '', 'total_tr odd');
410 410
 			// total td
411
-			$html .= EEH_HTML::td( $text, '', 'total_currency total jst-rght', '', ' colspan="3"' );
411
+			$html .= EEH_HTML::td($text, '', 'total_currency total jst-rght', '', ' colspan="3"');
412 412
 			// total td
413
-			$html .= EEH_HTML::td( EEH_Template::format_currency( $options[ 'sub_total' ], false, false ), '', 'total jst-rght' );
413
+			$html .= EEH_HTML::td(EEH_Template::format_currency($options['sub_total'], false, false), '', 'total jst-rght');
414 414
 			// end of row
415 415
 			$html .= EEH_HTML::trx();
416 416
 		}
@@ -427,13 +427,13 @@  discard block
 block discarded – undo
427 427
 	 * @param string       $text
428 428
 	 * @return mixed
429 429
 	 */
430
-	private function _total_row( EE_Line_Item $line_item, $text = '' ) {
430
+	private function _total_row(EE_Line_Item $line_item, $text = '') {
431 431
 		// start of row
432
-		$html = EEH_HTML::tr( '', '', 'spco-grand-total total_tr odd' );
432
+		$html = EEH_HTML::tr('', '', 'spco-grand-total total_tr odd');
433 433
 		// total td
434
-		$html .= EEH_HTML::td( $text, '',  'total_currency total jst-rght',  '',  ' colspan="3"' );
434
+		$html .= EEH_HTML::td($text, '', 'total_currency total jst-rght', '', ' colspan="3"');
435 435
 		// total td
436
-		$html .= EEH_HTML::td( EEH_Template::format_currency( $line_item->total(), false, false ), '',  'total jst-rght' );
436
+		$html .= EEH_HTML::td(EEH_Template::format_currency($line_item->total(), false, false), '', 'total jst-rght');
437 437
 		// end of row
438 438
 		$html .= EEH_HTML::trx();
439 439
 		return $html;
@@ -448,30 +448,30 @@  discard block
 block discarded – undo
448 448
 	 * @param array        $options
449 449
 	 * @return mixed
450 450
 	 */
451
-	private function _payments_and_amount_owing_rows( EE_Line_Item $line_item, $options = array() ) {
451
+	private function _payments_and_amount_owing_rows(EE_Line_Item $line_item, $options = array()) {
452 452
 		$html = '';
453 453
 		$owing = $line_item->total();
454
-		$transaction = EEM_Transaction::instance()->get_one_by_ID( $line_item->TXN_ID() );
455
-		if ( $transaction instanceof EE_Transaction ) {
454
+		$transaction = EEM_Transaction::instance()->get_one_by_ID($line_item->TXN_ID());
455
+		if ($transaction instanceof EE_Transaction) {
456 456
 			$registration_payments = array();
457
-			$registrations = ! empty( $options['registrations'] )
458
-				? $options[ 'registrations' ]
457
+			$registrations = ! empty($options['registrations'])
458
+				? $options['registrations']
459 459
 				: $transaction->registrations();
460
-			foreach ( $registrations as $registration ) {
461
-				if ( $registration instanceof EE_Registration && $registration->owes_monies_and_can_pay() ) {
460
+			foreach ($registrations as $registration) {
461
+				if ($registration instanceof EE_Registration && $registration->owes_monies_and_can_pay()) {
462 462
 					$registration_payments = $registration_payments + $registration->registration_payments();
463 463
 				}
464 464
 			}
465
-			if ( ! empty( $registration_payments )) {
466
-				foreach ( $registration_payments as $registration_payment ) {
467
-					if ( $registration_payment instanceof EE_Registration_Payment ) {
465
+			if ( ! empty($registration_payments)) {
466
+				foreach ($registration_payments as $registration_payment) {
467
+					if ($registration_payment instanceof EE_Registration_Payment) {
468 468
 						$owing = $owing - $registration_payment->amount();
469 469
 						$payment = $registration_payment->payment();
470
-						if ( $payment instanceof EE_Payment ) {
470
+						if ($payment instanceof EE_Payment) {
471 471
 							$payment_desc = sprintf(
472
-								__( 'Payment%1$s Received: %2$s', 'event_espresso' ),
472
+								__('Payment%1$s Received: %2$s', 'event_espresso'),
473 473
 								$payment->txn_id_chq_nmbr() != ''
474
-									? ' <span class="small-text">(#' . $payment->txn_id_chq_nmbr() . ')</span> '
474
+									? ' <span class="small-text">(#'.$payment->txn_id_chq_nmbr().')</span> '
475 475
 									: '',
476 476
 								$payment->timestamp()
477 477
 							);
@@ -479,12 +479,12 @@  discard block
 block discarded – undo
479 479
 							$payment_desc = '';
480 480
 						}
481 481
 						// start of row
482
-						$html .= EEH_HTML::tr( '', '', 'total_tr odd' );
482
+						$html .= EEH_HTML::tr('', '', 'total_tr odd');
483 483
 						// payment desc
484
-						$html .= EEH_HTML::td( $payment_desc, '', '', '', ' colspan="3"' );
484
+						$html .= EEH_HTML::td($payment_desc, '', '', '', ' colspan="3"');
485 485
 						// total td
486 486
 						$html .= EEH_HTML::td(
487
-							EEH_Template::format_currency( $registration_payment->amount(), false, false ),
487
+							EEH_Template::format_currency($registration_payment->amount(), false, false),
488 488
 							'',
489 489
 							'total jst-rght'
490 490
 						);
@@ -492,17 +492,17 @@  discard block
 block discarded – undo
492 492
 						$html .= EEH_HTML::trx();
493 493
 					}
494 494
 				}
495
-				if ( $line_item->total() ) {
495
+				if ($line_item->total()) {
496 496
 					// start of row
497
-					$html .= EEH_HTML::tr( '', '', 'total_tr odd' );
497
+					$html .= EEH_HTML::tr('', '', 'total_tr odd');
498 498
 					// total td
499 499
 					$html .= EEH_HTML::td(
500 500
 						__('Amount Owing', 'event_espresso'),
501
-						'',  'total_currency total jst-rght',  '',  ' colspan="3"'
501
+						'', 'total_currency total jst-rght', '', ' colspan="3"'
502 502
 					);
503 503
 					// total td
504 504
 					$html .= EEH_HTML::td(
505
-						EEH_Template::format_currency( $owing, false, false ), '',  'total jst-rght'
505
+						EEH_Template::format_currency($owing, false, false), '', 'total jst-rght'
506 506
 					);
507 507
 					// end of row
508 508
 					$html .= EEH_HTML::trx();
Please login to merge, or discard this patch.
core/helpers/EEH_Template.helper.php 3 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
 	 *
283 283
 	 * given two paths, this determines if there is a common base path between the two
284 284
 	 *
285
-	 * @param array $paths
285
+	 * @param string[] $paths
286 286
 	 * @return string
287 287
 	 */
288 288
 	protected static function _find_common_base_path( $paths ) {
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
 	 * @param bool|string $template_path server path to the file to be loaded, including file name and extension
310 310
 	 * @param  array      $template_args an array of arguments to be extracted for use in the template
311 311
 	 * @param  boolean    $return_string whether to send output immediately to screen, or capture and return as a string
312
-	 * @return mixed string
312
+	 * @return string string
313 313
 	 */
314 314
 	public static function display_template( $template_path = FALSE, $template_args = array(), $return_string = FALSE ) {
315 315
 		//require the template validator for verifying variables are set according to how the template requires
Please login to merge, or discard this patch.
Spacing   +196 added lines, -196 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 
16 16
 
17 17
 
18
-if ( ! function_exists( 'espresso_get_template_part' )) {
18
+if ( ! function_exists('espresso_get_template_part')) {
19 19
 	/**
20 20
 	 * espresso_get_template_part
21 21
 	 * basically a copy of the WordPress get_template_part() function but uses EEH_Template::locate_template() instead, and doesn't add base versions of files
@@ -25,14 +25,14 @@  discard block
 block discarded – undo
25 25
 	 * @param string $name The name of the specialised template.
26 26
 	 * @return string        the html output for the formatted money value
27 27
 	 */
28
-	function espresso_get_template_part( $slug = NULL, $name = NULL ) {
29
-		EEH_Template::get_template_part( $slug, $name );
28
+	function espresso_get_template_part($slug = NULL, $name = NULL) {
29
+		EEH_Template::get_template_part($slug, $name);
30 30
 	}
31 31
 }
32 32
 
33 33
 
34 34
 
35
-if ( ! function_exists( 'espresso_get_object_css_class' )) {
35
+if ( ! function_exists('espresso_get_object_css_class')) {
36 36
 	/**
37 37
 	 * espresso_get_object_css_class - attempts to generate a css class based on the type of EE object passed
38 38
 	 *
@@ -42,8 +42,8 @@  discard block
 block discarded – undo
42 42
 	 * @param  string $suffix added to the end of the generated class
43 43
 	 * @return string
44 44
 	 */
45
-	function espresso_get_object_css_class( $object = NULL, $prefix = '', $suffix = '' ) {
46
-		return EEH_Template::get_object_css_class( $object, $prefix, $suffix );
45
+	function espresso_get_object_css_class($object = NULL, $prefix = '', $suffix = '') {
46
+		return EEH_Template::get_object_css_class($object, $prefix, $suffix);
47 47
 	}
48 48
 }
49 49
 
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 	 * 	@return boolean
71 71
 	 */
72 72
 	public static function is_espresso_theme() {
73
-		return wp_get_theme()->get( 'TextDomain' ) == 'event_espresso' ? TRUE : FALSE;
73
+		return wp_get_theme()->get('TextDomain') == 'event_espresso' ? TRUE : FALSE;
74 74
 	}
75 75
 
76 76
 	/**
@@ -79,9 +79,9 @@  discard block
 block discarded – undo
79 79
 	 * 	@return void
80 80
 	 */
81 81
 	public static function load_espresso_theme_functions() {
82
-		if ( ! defined( 'EE_THEME_FUNCTIONS_LOADED' )) {
83
-			if ( is_readable( EE_PUBLIC . EE_Config::get_current_theme() . DS . 'functions.php' )) {
84
-				require_once( EE_PUBLIC . EE_Config::get_current_theme() . DS . 'functions.php' );
82
+		if ( ! defined('EE_THEME_FUNCTIONS_LOADED')) {
83
+			if (is_readable(EE_PUBLIC.EE_Config::get_current_theme().DS.'functions.php')) {
84
+				require_once(EE_PUBLIC.EE_Config::get_current_theme().DS.'functions.php');
85 85
 			}
86 86
 		}
87 87
 	}
@@ -93,17 +93,17 @@  discard block
 block discarded – undo
93 93
 	 * 	@return array
94 94
 	 */
95 95
 	public static function get_espresso_themes() {
96
-		if ( empty( EEH_Template::$_espresso_themes )) {
97
-			$espresso_themes =  glob( EE_PUBLIC . '*', GLOB_ONLYDIR );
98
-			if ( empty( $espresso_themes ) ) {
96
+		if (empty(EEH_Template::$_espresso_themes)) {
97
+			$espresso_themes = glob(EE_PUBLIC.'*', GLOB_ONLYDIR);
98
+			if (empty($espresso_themes)) {
99 99
 				return array();
100 100
 			}
101
-			if (( $key = array_search( 'global_assets', $espresso_themes )) !== FALSE ) {
102
-			    unset( $espresso_themes[ $key ] );
101
+			if (($key = array_search('global_assets', $espresso_themes)) !== FALSE) {
102
+			    unset($espresso_themes[$key]);
103 103
 			}
104 104
 			EEH_Template::$_espresso_themes = array();
105
-			foreach ( $espresso_themes as $espresso_theme ) {
106
-				EEH_Template::$_espresso_themes[ basename( $espresso_theme ) ] = $espresso_theme;
105
+			foreach ($espresso_themes as $espresso_theme) {
106
+				EEH_Template::$_espresso_themes[basename($espresso_theme)] = $espresso_theme;
107 107
 			}
108 108
 		}
109 109
 		return EEH_Template::$_espresso_themes;
@@ -122,16 +122,16 @@  discard block
 block discarded – undo
122 122
 	 * @param bool   $return_string
123 123
 	 * @return string        the html output for the formatted money value
124 124
 	 */
125
-	public static function get_template_part( $slug = NULL, $name = NULL, $template_args = array(), $return_string = FALSE  ) {
126
-		do_action( "get_template_part_{$slug}-{$name}", $slug, $name );
125
+	public static function get_template_part($slug = NULL, $name = NULL, $template_args = array(), $return_string = FALSE) {
126
+		do_action("get_template_part_{$slug}-{$name}", $slug, $name);
127 127
 		$templates = array();
128 128
 		$name = (string) $name;
129
-		if ( $name != '' ) {
129
+		if ($name != '') {
130 130
 			$templates[] = "{$slug}-{$name}.php";
131 131
 		}
132 132
 		// allow template parts to be turned off via something like: add_filter( 'FHEE__content_espresso_events_tickets_template__display_datetimes', '__return_false' );
133
-		if ( apply_filters( "FHEE__EEH_Template__get_template_part__display__{$slug}_{$name}", TRUE )) {
134
-			EEH_Template::locate_template( $templates, $template_args, TRUE, $return_string );
133
+		if (apply_filters("FHEE__EEH_Template__get_template_part__display__{$slug}_{$name}", TRUE)) {
134
+			EEH_Template::locate_template($templates, $template_args, TRUE, $return_string);
135 135
 		}
136 136
 	}
137 137
 
@@ -171,26 +171,26 @@  discard block
 block discarded – undo
171 171
 	 * 				Used in places where you don't actually load the template, you just want to know if there's a custom version of it.
172 172
 	 * @return mixed
173 173
 	 */
174
-	public static function locate_template( $templates = array(), $template_args = array(), $load = TRUE, $return_string = TRUE, $check_if_custom = FALSE ) {
174
+	public static function locate_template($templates = array(), $template_args = array(), $load = TRUE, $return_string = TRUE, $check_if_custom = FALSE) {
175 175
 		// first use WP locate_template to check for template in the current theme folder
176
-		$template_path = locate_template( $templates );
176
+		$template_path = locate_template($templates);
177 177
 
178
-		if ( $check_if_custom && !empty( $template_path ) )
178
+		if ($check_if_custom && ! empty($template_path))
179 179
 			return TRUE;
180 180
 
181 181
 		// not in the theme
182
-		if ( empty( $template_path )) {
182
+		if (empty($template_path)) {
183 183
 			// not even a template to look for ?
184
-			if ( empty( $templates )) {
184
+			if (empty($templates)) {
185 185
 				// get post_type
186
-				$post_type = EE_Registry::instance()->REQ->get( 'post_type' );
186
+				$post_type = EE_Registry::instance()->REQ->get('post_type');
187 187
 				// get array of EE Custom Post Types
188 188
 				$EE_CPTs = EE_Register_CPTs::get_CPTs();
189 189
 				// build template name based on request
190
-				if ( isset( $EE_CPTs[ $post_type ] )) {
191
-					$archive_or_single =  is_archive() ? 'archive' : '';
192
-					$archive_or_single =  is_single() ? 'single' : $archive_or_single;
193
-					$templates = $archive_or_single . '-' . $post_type . '.php';
190
+				if (isset($EE_CPTs[$post_type])) {
191
+					$archive_or_single = is_archive() ? 'archive' : '';
192
+					$archive_or_single = is_single() ? 'single' : $archive_or_single;
193
+					$templates = $archive_or_single.'-'.$post_type.'.php';
194 194
 				}
195 195
 			}
196 196
 			// currently active EE template theme
@@ -199,80 +199,80 @@  discard block
 block discarded – undo
199 199
 			// array of paths to folders that may contain templates
200 200
 			$template_folder_paths = array(
201 201
 				// first check the /wp-content/uploads/espresso/templates/(current EE theme)/  folder for an EE theme template file
202
-				EVENT_ESPRESSO_TEMPLATE_DIR . $current_theme,
202
+				EVENT_ESPRESSO_TEMPLATE_DIR.$current_theme,
203 203
 				// then in the root of the /wp-content/uploads/espresso/templates/ folder
204 204
 				EVENT_ESPRESSO_TEMPLATE_DIR
205 205
 			);
206 206
 
207 207
 			//add core plugin folders for checking only if we're not $check_if_custom
208
-			if ( ! $check_if_custom ) {
208
+			if ( ! $check_if_custom) {
209 209
 				$core_paths = array(
210 210
 					// in the  /wp-content/plugins/(EE4 folder)/public/(current EE theme)/ folder within the plugin
211
-					EE_PUBLIC . $current_theme,
211
+					EE_PUBLIC.$current_theme,
212 212
 					// in the  /wp-content/plugins/(EE4 folder)/core/templates/(current EE theme)/ folder within the plugin
213
-					EE_TEMPLATES . $current_theme,
213
+					EE_TEMPLATES.$current_theme,
214 214
 					// or maybe relative from the plugin root: /wp-content/plugins/(EE4 folder)/
215 215
 					EE_PLUGIN_DIR_PATH
216 216
 					);
217
-				$template_folder_paths = array_merge( $template_folder_paths, $core_paths );
217
+				$template_folder_paths = array_merge($template_folder_paths, $core_paths);
218 218
 			}
219 219
 
220 220
 			// now filter that array
221
-			$template_folder_paths = apply_filters( 'FHEE__EEH_Template__locate_template__template_folder_paths', $template_folder_paths );
222
-			$templates = is_array( $templates ) ? $templates : array( $templates );
223
-			$template_folder_paths = is_array( $template_folder_paths ) ? $template_folder_paths : array( $template_folder_paths );
221
+			$template_folder_paths = apply_filters('FHEE__EEH_Template__locate_template__template_folder_paths', $template_folder_paths);
222
+			$templates = is_array($templates) ? $templates : array($templates);
223
+			$template_folder_paths = is_array($template_folder_paths) ? $template_folder_paths : array($template_folder_paths);
224 224
 			// array to hold all possible template paths
225 225
 			$full_template_paths = array();
226 226
 
227 227
 			EE_Registry::instance()->load_helper('File');
228 228
 			// loop through $templates
229
-			foreach ( $templates as $template ) {
229
+			foreach ($templates as $template) {
230 230
 				// normalize directory separators
231
-				$template = EEH_File::standardise_directory_separators( $template );
232
-				$file_name = basename( $template );
233
-				$template_path_minus_file_name = substr( $template, 0, ( strlen( $file_name ) * -1 ) );
231
+				$template = EEH_File::standardise_directory_separators($template);
232
+				$file_name = basename($template);
233
+				$template_path_minus_file_name = substr($template, 0, (strlen($file_name) * -1));
234 234
 				// while looping through all template folder paths
235
-				foreach ( $template_folder_paths as $template_folder_path ) {
235
+				foreach ($template_folder_paths as $template_folder_path) {
236 236
 					// normalize directory separators
237
-					$template_folder_path = EEH_File::standardise_directory_separators( $template_folder_path );
237
+					$template_folder_path = EEH_File::standardise_directory_separators($template_folder_path);
238 238
 					// determine if any common base path exists between the two paths
239 239
 					$common_base_path = EEH_Template::_find_common_base_path(
240
-						array( $template_folder_path, $template_path_minus_file_name )
240
+						array($template_folder_path, $template_path_minus_file_name)
241 241
 					);
242
-					if ( $common_base_path !== '' ) {
242
+					if ($common_base_path !== '') {
243 243
 						// both paths have a common base, so just tack the filename onto our search path
244
-						$resolved_path = EEH_File::end_with_directory_separator( $template_folder_path ) . $file_name;
244
+						$resolved_path = EEH_File::end_with_directory_separator($template_folder_path).$file_name;
245 245
 					} else {
246 246
 						// no common base path, so let's just concatenate
247
-						$resolved_path = EEH_File::end_with_directory_separator( $template_folder_path ) . $template;
247
+						$resolved_path = EEH_File::end_with_directory_separator($template_folder_path).$template;
248 248
 					}
249 249
 					// build up our template locations array by adding our resolved paths
250 250
 					$full_template_paths[] = $resolved_path;
251 251
 				}
252 252
 				// if $template is an absolute path, then we'll tack it onto the start of our array so that it gets searched first
253
-				array_unshift( $full_template_paths, $template );
253
+				array_unshift($full_template_paths, $template);
254 254
 				// path to the directory of the current theme: /wp-content/themes/(current WP theme)/
255
-				array_unshift( $full_template_paths, get_template_directory() . DS . $file_name );
255
+				array_unshift($full_template_paths, get_template_directory().DS.$file_name);
256 256
 			}
257 257
 			// filter final array of full template paths
258
-			$full_template_paths = apply_filters( 'FHEE__EEH_Template__locate_template__full_template_paths', $full_template_paths );
258
+			$full_template_paths = apply_filters('FHEE__EEH_Template__locate_template__full_template_paths', $full_template_paths);
259 259
 			// now loop through our final array of template location paths and check each location
260
-			foreach ( (array)$full_template_paths as $full_template_path ) {
261
-				if ( is_readable( $full_template_path )) {
262
-					$template_path = str_replace( array( '\\', '/' ), DIRECTORY_SEPARATOR, $full_template_path );
260
+			foreach ((array) $full_template_paths as $full_template_path) {
261
+				if (is_readable($full_template_path)) {
262
+					$template_path = str_replace(array('\\', '/'), DIRECTORY_SEPARATOR, $full_template_path);
263 263
 					break;
264 264
 				}
265 265
 			}
266 266
 		}
267 267
 		// if we got it and you want to see it...
268
-		if ( $template_path && $load && ! $check_if_custom  ) {
269
-			if ( $return_string ) {
270
-				return EEH_Template::display_template( $template_path, $template_args, TRUE );
268
+		if ($template_path && $load && ! $check_if_custom) {
269
+			if ($return_string) {
270
+				return EEH_Template::display_template($template_path, $template_args, TRUE);
271 271
 			} else {
272
-				EEH_Template::display_template( $template_path, $template_args, FALSE );
272
+				EEH_Template::display_template($template_path, $template_args, FALSE);
273 273
 			}
274 274
 		}
275
-		return $check_if_custom && ! empty( $template_path ) ? TRUE : $template_path;
275
+		return $check_if_custom && ! empty($template_path) ? TRUE : $template_path;
276 276
 	}
277 277
 
278 278
 
@@ -285,21 +285,21 @@  discard block
 block discarded – undo
285 285
 	 * @param array $paths
286 286
 	 * @return string
287 287
 	 */
288
-	protected static function _find_common_base_path( $paths ) {
288
+	protected static function _find_common_base_path($paths) {
289 289
 		$last_offset = 0;
290 290
 		$common_base_path = '';
291
-		while ( ( $index = strpos( $paths[ 0 ], DS, $last_offset ) ) !== false ) {
291
+		while (($index = strpos($paths[0], DS, $last_offset)) !== false) {
292 292
 			$dir_length = $index - $last_offset + 1;
293
-			$directory = substr( $paths[ 0 ], $last_offset, $dir_length );
294
-			foreach ( $paths as $path ) {
295
-				if ( substr( $path, $last_offset, $dir_length ) != $directory ) {
293
+			$directory = substr($paths[0], $last_offset, $dir_length);
294
+			foreach ($paths as $path) {
295
+				if (substr($path, $last_offset, $dir_length) != $directory) {
296 296
 					return $common_base_path;
297 297
 				}
298 298
 			}
299 299
 			$common_base_path .= $directory;
300 300
 			$last_offset = $index + 1;
301 301
 		}
302
-		return substr( $common_base_path, 0, -1 );
302
+		return substr($common_base_path, 0, -1);
303 303
 	}
304 304
 
305 305
 
@@ -311,9 +311,9 @@  discard block
 block discarded – undo
311 311
 	 * @param  boolean    $return_string whether to send output immediately to screen, or capture and return as a string
312 312
 	 * @return mixed string
313 313
 	 */
314
-	public static function display_template( $template_path = FALSE, $template_args = array(), $return_string = FALSE ) {
314
+	public static function display_template($template_path = FALSE, $template_args = array(), $return_string = FALSE) {
315 315
 		//require the template validator for verifying variables are set according to how the template requires
316
-		EE_Registry::instance()->load_helper( 'Template_Validator' );
316
+		EE_Registry::instance()->load_helper('Template_Validator');
317 317
 
318 318
 		/**
319 319
 		 * These two filters are intended for last minute changes to templates being loaded and/or template arg
@@ -324,26 +324,26 @@  discard block
 block discarded – undo
324 324
 		 *
325 325
 		 * @since 4.6.0
326 326
 		 */
327
-		$template_path = apply_filters( 'FHEE__EEH_Template__display_template__template_path', $template_path );
328
-		$template_args = apply_filters( 'FHEE__EEH_Template__display_template__template_args', $template_args );
327
+		$template_path = apply_filters('FHEE__EEH_Template__display_template__template_path', $template_path);
328
+		$template_args = apply_filters('FHEE__EEH_Template__display_template__template_args', $template_args);
329 329
 
330 330
 		// you gimme nuttin - YOU GET NUTTIN !!
331
-		if ( ! $template_path || ! is_readable( $template_path )) {
331
+		if ( ! $template_path || ! is_readable($template_path)) {
332 332
 			return '';
333 333
 		}
334 334
 		// if $template_args are not in an array, then make it so
335
-		if ( ! is_array( $template_args ) && ! is_object( $template_args )) {
336
-			$template_args = array( $template_args );
335
+		if ( ! is_array($template_args) && ! is_object($template_args)) {
336
+			$template_args = array($template_args);
337 337
 		}
338
-		extract( (array) $template_args);
338
+		extract((array) $template_args);
339 339
 
340
-		if ( $return_string ) {
340
+		if ($return_string) {
341 341
 			// because we want to return a string, we are going to capture the output
342 342
 			ob_start();
343
-			include( $template_path );
343
+			include($template_path);
344 344
 			return ob_get_clean();
345 345
 		} else {
346
-			include( $template_path );
346
+			include($template_path);
347 347
 		}
348 348
 		return '';
349 349
 	}
@@ -361,27 +361,27 @@  discard block
 block discarded – undo
361 361
 	 * @param  string $suffix added to the end of the generated class
362 362
 	 * @return string
363 363
 	 */
364
-	public static function get_object_css_class( $object = NULL, $prefix = '', $suffix = '' ) {
364
+	public static function get_object_css_class($object = NULL, $prefix = '', $suffix = '') {
365 365
 		// in the beginning...
366
-		$prefix = ! empty( $prefix ) ? rtrim( $prefix, '-' ) . '-' : '';
366
+		$prefix = ! empty($prefix) ? rtrim($prefix, '-').'-' : '';
367 367
 		// da muddle
368 368
 		$class = '';
369 369
 		// the end
370
-		$suffix = ! empty( $suffix ) ? '-' . ltrim( $suffix, '-' ) : '';
370
+		$suffix = ! empty($suffix) ? '-'.ltrim($suffix, '-') : '';
371 371
 		// is the passed object an EE object ?
372
-		if ( $object instanceof EE_Base_Class ) {
372
+		if ($object instanceof EE_Base_Class) {
373 373
 			// grab the exact type of object
374
-			$obj_class = get_class( $object );
374
+			$obj_class = get_class($object);
375 375
 			// depending on the type of object...
376
-			switch ( $obj_class ) {
376
+			switch ($obj_class) {
377 377
 				// no specifics just yet...
378 378
 				default :
379
-					$class = strtolower( str_replace( '_', '-', $obj_class ));
380
-					$class .= method_exists( $obj_class, 'name' ) ? '-' . sanitize_title( $object->name() ) : '';
379
+					$class = strtolower(str_replace('_', '-', $obj_class));
380
+					$class .= method_exists($obj_class, 'name') ? '-'.sanitize_title($object->name()) : '';
381 381
 
382 382
 			}
383 383
 		}
384
-		return $prefix . $class . $suffix;
384
+		return $prefix.$class.$suffix;
385 385
 	}
386 386
 
387 387
 
@@ -397,50 +397,50 @@  discard block
 block discarded – undo
397 397
 	 * @param string      $cur_code_span_class
398 398
 	 * @return string        the html output for the formatted money value
399 399
 	 */
400
-	public static function format_currency( $amount = NULL, $return_raw = FALSE, $display_code = TRUE, $CNT_ISO = '', $cur_code_span_class = 'currency-code' ) {
400
+	public static function format_currency($amount = NULL, $return_raw = FALSE, $display_code = TRUE, $CNT_ISO = '', $cur_code_span_class = 'currency-code') {
401 401
 		// ensure amount was received
402
-		if ( is_null( $amount ) ) {
403
-			$msg = __( 'In order to format currency, an amount needs to be passed.', 'event_espresso' );
404
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
402
+		if (is_null($amount)) {
403
+			$msg = __('In order to format currency, an amount needs to be passed.', 'event_espresso');
404
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
405 405
 			return '';
406 406
 		}
407 407
 		//ensure amount is float
408 408
 		$amount = (float) $amount;
409 409
 		// filter raw amount (allows 0.00 to be changed to "free" for example)
410
-		$amount_formatted = apply_filters( 'FHEE__EEH_Template__format_currency__amount', $amount, $return_raw );
410
+		$amount_formatted = apply_filters('FHEE__EEH_Template__format_currency__amount', $amount, $return_raw);
411 411
 		// still a number or was amount converted to a string like "free" ?
412
-		if ( is_float( $amount_formatted )) {
412
+		if (is_float($amount_formatted)) {
413 413
 			// was a country ISO code passed ? if so generate currency config object for that country
414
-			$mny = $CNT_ISO !== '' ? new EE_Currency_Config( $CNT_ISO ) : NULL;
414
+			$mny = $CNT_ISO !== '' ? new EE_Currency_Config($CNT_ISO) : NULL;
415 415
 			// verify results
416
-			if ( ! $mny instanceof EE_Currency_Config ) {
416
+			if ( ! $mny instanceof EE_Currency_Config) {
417 417
 				// set default config country currency settings
418 418
 				$mny = EE_Registry::instance()->CFG->currency instanceof EE_Currency_Config ? EE_Registry::instance()->CFG->currency : new EE_Currency_Config();
419 419
 			}
420 420
 			// format float
421
-			$amount_formatted = number_format( $amount, $mny->dec_plc, $mny->dec_mrk, $mny->thsnds );
421
+			$amount_formatted = number_format($amount, $mny->dec_plc, $mny->dec_mrk, $mny->thsnds);
422 422
 			// add formatting ?
423
-			if ( ! $return_raw ) {
423
+			if ( ! $return_raw) {
424 424
 				// add currency sign
425
-				if( $mny->sign_b4 ){
426
-					if( $amount >= 0 ){
427
-						$amount_formatted = $mny->sign . $amount_formatted;
428
-					}else{
429
-						$amount_formatted = '-' . $mny->sign . str_replace( '-', '', $amount_formatted );
425
+				if ($mny->sign_b4) {
426
+					if ($amount >= 0) {
427
+						$amount_formatted = $mny->sign.$amount_formatted;
428
+					} else {
429
+						$amount_formatted = '-'.$mny->sign.str_replace('-', '', $amount_formatted);
430 430
 					}
431 431
 
432
-				}else{
433
-					$amount_formatted =  $amount_formatted . $mny->sign;
432
+				} else {
433
+					$amount_formatted = $amount_formatted.$mny->sign;
434 434
 				}
435 435
 
436 436
 				// add currency code ?
437
-				$amount_formatted = $display_code ? $amount_formatted . ' <span class="' . $cur_code_span_class . '">(' . $mny->code . ')</span>' : $amount_formatted;
437
+				$amount_formatted = $display_code ? $amount_formatted.' <span class="'.$cur_code_span_class.'">('.$mny->code.')</span>' : $amount_formatted;
438 438
 			}
439 439
 			// filter results
440
-			$amount_formatted = apply_filters( 'FHEE__EEH_Template__format_currency__amount_formatted', $amount_formatted, $mny, $return_raw );
440
+			$amount_formatted = apply_filters('FHEE__EEH_Template__format_currency__amount_formatted', $amount_formatted, $mny, $return_raw);
441 441
 		}
442 442
 		// clean up vars
443
-		unset( $mny );
443
+		unset($mny);
444 444
 		// return formatted currency amount
445 445
 		return $amount_formatted;
446 446
 	}
@@ -455,11 +455,11 @@  discard block
 block discarded – undo
455 455
 	 * @param  string  $schema    'UPPER', 'lower', or 'Sentence'
456 456
 	 * @return string             The localized label for the status id.
457 457
 	 */
458
-	public static function pretty_status( $status_id, $plural = FALSE, $schema = 'upper' ) {
458
+	public static function pretty_status($status_id, $plural = FALSE, $schema = 'upper') {
459 459
 		/** @type EEM_Status $EEM_Status */
460
-		$EEM_Status = EE_Registry::instance()->load_model( 'Status' );
461
-		$status = $EEM_Status->localized_status( array( $status_id => __( 'unknown', 'event_espresso' )), $plural, $schema );
462
-		return $status[ $status_id ];
460
+		$EEM_Status = EE_Registry::instance()->load_model('Status');
461
+		$status = $EEM_Status->localized_status(array($status_id => __('unknown', 'event_espresso')), $plural, $schema);
462
+		return $status[$status_id];
463 463
 	}
464 464
 
465 465
 
@@ -472,9 +472,9 @@  discard block
 block discarded – undo
472 472
 	 * @param string  $icon
473 473
 	 * @return string 	the html output for the button
474 474
 	 */
475
-	public static function get_button_or_link( $url, $label, $class = 'button-primary', $icon = '' ) {
476
-		$label = ! empty( $icon ) ? '<span class="' . $icon . '"></span>' . $label : $label;
477
-		$button = '<a id="' . sanitize_title_with_dashes($label) . '" href="' . $url . '" class="' . $class . '">' . $label . '</a>';
475
+	public static function get_button_or_link($url, $label, $class = 'button-primary', $icon = '') {
476
+		$label = ! empty($icon) ? '<span class="'.$icon.'"></span>'.$label : $label;
477
+		$button = '<a id="'.sanitize_title_with_dashes($label).'" href="'.$url.'" class="'.$class.'">'.$label.'</a>';
478 478
 		return $button;
479 479
 	}
480 480
 
@@ -491,21 +491,21 @@  discard block
 block discarded – undo
491 491
 	 * @param bool|string $help_text   (optional) send help text you want to use for the link if default not to be used
492 492
 	 * @return string              generated link
493 493
 	 */
494
-	public static function get_help_tab_link( $help_tab_id, $page = FALSE, $action = FALSE, $icon_style = FALSE, $help_text = FALSE ) {
494
+	public static function get_help_tab_link($help_tab_id, $page = FALSE, $action = FALSE, $icon_style = FALSE, $help_text = FALSE) {
495 495
 
496
-		if ( ! $page )
497
-			$page = isset( $_REQUEST['page'] ) && ! empty( $_REQUEST['page'] ) ? sanitize_key( $_REQUEST['page'] ) : $page;
496
+		if ( ! $page)
497
+			$page = isset($_REQUEST['page']) && ! empty($_REQUEST['page']) ? sanitize_key($_REQUEST['page']) : $page;
498 498
 
499
-		if ( ! $action )
500
-			$action = isset( $_REQUEST['action'] ) && ! empty( $_REQUEST['action'] ) ? sanitize_key( $_REQUEST['action'] ) : $action;
499
+		if ( ! $action)
500
+			$action = isset($_REQUEST['action']) && ! empty($_REQUEST['action']) ? sanitize_key($_REQUEST['action']) : $action;
501 501
 
502 502
 		$action = empty($action) ? 'default' : $action;
503 503
 
504 504
 
505
-		$help_tab_lnk = $page . '-' . $action . '-' . $help_tab_id;
506
-		$icon = !$icon_style ? ' dashicons-editor-help' : $icon_style;
507
-		$help_text = !$help_text ? '' : $help_text;
508
-		return '<a id="' . $help_tab_lnk . '" class="ee-clickable dashicons espresso-help-tab-lnk ee-icon-size-22' . $icon . '" title="' . esc_attr__('Click to open the \'Help\' tab for more information about this feature.', 'event_espresso') . '" > ' . $help_text . ' </a>';
505
+		$help_tab_lnk = $page.'-'.$action.'-'.$help_tab_id;
506
+		$icon = ! $icon_style ? ' dashicons-editor-help' : $icon_style;
507
+		$help_text = ! $help_text ? '' : $help_text;
508
+		return '<a id="'.$help_tab_lnk.'" class="ee-clickable dashicons espresso-help-tab-lnk ee-icon-size-22'.$icon.'" title="'.esc_attr__('Click to open the \'Help\' tab for more information about this feature.', 'event_espresso').'" > '.$help_text.' </a>';
509 509
 	}
510 510
 
511 511
 
@@ -517,31 +517,31 @@  discard block
 block discarded – undo
517 517
 	 * @param EE_Help_Tour
518 518
 	 * @return string         html
519 519
 	 */
520
-	public static function help_tour_stops_generator( EE_Help_Tour $tour ) {
520
+	public static function help_tour_stops_generator(EE_Help_Tour $tour) {
521 521
 		$id = $tour->get_slug();
522 522
 		$stops = $tour->get_stops();
523 523
 
524
-		$content = '<ol style="display:none" id="' . $id . '">';
524
+		$content = '<ol style="display:none" id="'.$id.'">';
525 525
 
526
-		foreach ( $stops as $stop ) {
527
-			$data_id = !empty( $stop['id'] ) ? ' data-id="' . $stop['id'] . '"' : '';
528
-			$data_class = empty( $data_id ) && !empty( $stop['class'] ) ? ' data-class="' . $stop['class'] . '"' : '';
526
+		foreach ($stops as $stop) {
527
+			$data_id = ! empty($stop['id']) ? ' data-id="'.$stop['id'].'"' : '';
528
+			$data_class = empty($data_id) && ! empty($stop['class']) ? ' data-class="'.$stop['class'].'"' : '';
529 529
 
530 530
 			//if container is set to modal then let's make sure we set the options accordingly
531
-			if ( empty( $data_id ) && empty( $data_class ) ) {
531
+			if (empty($data_id) && empty($data_class)) {
532 532
 				$stop['options']['modal'] = true;
533 533
 				$stop['options']['expose'] = true;
534 534
 			}
535 535
 
536
-			$custom_class = !empty( $stop['custom_class'] ) ? ' class="' . $stop['custom_class'] . '"' : '';
537
-			$button_text = !empty( $stop['button_text'] ) ? ' data-button="' . $stop['button_text'] . '"' : '';
536
+			$custom_class = ! empty($stop['custom_class']) ? ' class="'.$stop['custom_class'].'"' : '';
537
+			$button_text = ! empty($stop['button_text']) ? ' data-button="'.$stop['button_text'].'"' : '';
538 538
 			$inner_content = isset($stop['content']) ? $stop['content'] : '';
539 539
 
540 540
 			//options
541
-			if ( isset( $stop['options'] ) && is_array( $stop['options'] ) ) {
541
+			if (isset($stop['options']) && is_array($stop['options'])) {
542 542
 				$options = ' data-options="';
543
-				foreach ( $stop['options'] as $option => $value ) {
544
-					$options .= $option . ':' . $value . ';';
543
+				foreach ($stop['options'] as $option => $value) {
544
+					$options .= $option.':'.$value.';';
545 545
 				}
546 546
 				$options .= '"';
547 547
 			} else {
@@ -549,7 +549,7 @@  discard block
 block discarded – undo
549 549
 			}
550 550
 
551 551
 			//let's put all together
552
-			$content .= '<li' . $data_id . $data_class . $custom_class . $button_text . $options . '>' . $inner_content . '</li>';
552
+			$content .= '<li'.$data_id.$data_class.$custom_class.$button_text.$options.'>'.$inner_content.'</li>';
553 553
 		}
554 554
 
555 555
 		$content .= '</ol>';
@@ -570,31 +570,31 @@  discard block
 block discarded – undo
570 570
 	 * @throws EE_Error
571 571
 	 * @return string               html structure for status.
572 572
 	 */
573
-	public static function status_legend( $status_array, $active_status = '' ) {
574
-		if ( !is_array( $status_array ) )
575
-			throw new EE_Error( __('The EEH_Template::status_legend helper required the incoming status_array argument to be an array!', 'event_espresso') );
573
+	public static function status_legend($status_array, $active_status = '') {
574
+		if ( ! is_array($status_array))
575
+			throw new EE_Error(__('The EEH_Template::status_legend helper required the incoming status_array argument to be an array!', 'event_espresso'));
576 576
 
577 577
 		$setup_array = array();
578
-		foreach ( $status_array as $item => $status ) {
578
+		foreach ($status_array as $item => $status) {
579 579
 			$setup_array[$item] = array(
580
-					'class' => 'ee-status-legend ee-status-legend-' . $status,
581
-					'desc' => EEH_Template::pretty_status( $status, FALSE, 'sentence' ),
580
+					'class' => 'ee-status-legend ee-status-legend-'.$status,
581
+					'desc' => EEH_Template::pretty_status($status, FALSE, 'sentence'),
582 582
 					'status' => $status
583 583
 				);
584 584
 		}
585 585
 
586
-		$content = '<div class="ee-list-table-legend-container">' . "\n";
587
-		$content .= '<h4>' . __('Status Legend', 'event_espresso') . '</h4>' . "\n";
588
-		$content .= '<dl class="ee-list-table-legend">' . "\n\t";
589
-		foreach ( $setup_array as $item => $details ) {
586
+		$content = '<div class="ee-list-table-legend-container">'."\n";
587
+		$content .= '<h4>'.__('Status Legend', 'event_espresso').'</h4>'."\n";
588
+		$content .= '<dl class="ee-list-table-legend">'."\n\t";
589
+		foreach ($setup_array as $item => $details) {
590 590
 			$active_class = $active_status == $details['status'] ? ' class="ee-is-active-status"' : '';
591
-			$content .= '<dt id="ee-legend-item-tooltip-' . $item . '"' . $active_class . '>' . "\n\t\t";
592
-			$content .= '<span class="' . $details['class'] . '"></span>' . "\n\t\t";
593
-			$content .= '<span class="ee-legend-description">' . $details['desc'] . '</span>' . "\n\t";
594
-			$content .= '</dt>' . "\n";
591
+			$content .= '<dt id="ee-legend-item-tooltip-'.$item.'"'.$active_class.'>'."\n\t\t";
592
+			$content .= '<span class="'.$details['class'].'"></span>'."\n\t\t";
593
+			$content .= '<span class="ee-legend-description">'.$details['desc'].'</span>'."\n\t";
594
+			$content .= '</dt>'."\n";
595 595
 		}
596
-		$content .= '</dl>' . "\n";
597
-		$content .= '</div>' . "\n";
596
+		$content .= '</dl>'."\n";
597
+		$content .= '</div>'."\n";
598 598
 		return $content;
599 599
 	}
600 600
 
@@ -607,8 +607,8 @@  discard block
 block discarded – undo
607 607
 	 * @return string
608 608
 	 */
609 609
 	public static function layout_array_as_table($data) {
610
-	if (is_object($data) || $data instanceof __PHP_Incomplete_Class ) {
611
-		$data = (array)$data;
610
+	if (is_object($data) || $data instanceof __PHP_Incomplete_Class) {
611
+		$data = (array) $data;
612 612
 	}
613 613
 	EE_Registry::instance()->load_helper('Array');
614 614
 	ob_start();
@@ -622,10 +622,10 @@  discard block
 block discarded – undo
622 622
 						?>
623 623
 						<tr>
624 624
 							<td>
625
-								<?php echo $data_key;?>
625
+								<?php echo $data_key; ?>
626 626
 							</td>
627 627
 							<td>
628
-								<?php echo self::layout_array_as_table($data_values);?>
628
+								<?php echo self::layout_array_as_table($data_values); ?>
629 629
 							</td>
630 630
 						</tr>
631 631
 						<?php
@@ -639,7 +639,7 @@  discard block
 block discarded – undo
639 639
 			<ul>
640 640
 				<?php
641 641
 				foreach ($data as $datum) {
642
-					echo "<li>"; echo self::layout_array_as_table($datum);echo "</li>";
642
+					echo "<li>"; echo self::layout_array_as_table($datum); echo "</li>";
643 643
 				}?>
644 644
 			</ul>
645 645
 			<?php
@@ -669,8 +669,8 @@  discard block
 block discarded – undo
669 669
 	 *
670 670
 	 * @return string
671 671
 	 */
672
-	public static function paging_html( $total_items, $current, $per_page, $url, $show_num_field = TRUE, $paged_arg_name = 'paged', $items_label = array() ) {
673
-		echo self::get_paging_html( $total_items, $current, $per_page, $url, $show_num_field, $paged_arg_name, $items_label );
672
+	public static function paging_html($total_items, $current, $per_page, $url, $show_num_field = TRUE, $paged_arg_name = 'paged', $items_label = array()) {
673
+		echo self::get_paging_html($total_items, $current, $per_page, $url, $show_num_field, $paged_arg_name, $items_label);
674 674
 	}
675 675
 
676 676
 
@@ -694,13 +694,13 @@  discard block
 block discarded – undo
694 694
 	 *                                 )
695 695
 	 * @return  string
696 696
 	 */
697
-	public static function get_paging_html( $total_items, $current, $per_page, $url, $show_num_field = TRUE, $paged_arg_name = 'paged', $items_label = array() ) {
697
+	public static function get_paging_html($total_items, $current, $per_page, $url, $show_num_field = TRUE, $paged_arg_name = 'paged', $items_label = array()) {
698 698
 		$page_links = array();
699 699
 		$disable_first = $disable_last = '';
700 700
 		$total_items = (int) $total_items;
701 701
 		$per_page = (int) $per_page;
702 702
 		$current = (int) $current;
703
-		$paged_arg_name = empty( $paged_arg_name ) ? 'paged' : sanitize_key( $paged_arg_name );
703
+		$paged_arg_name = empty($paged_arg_name) ? 'paged' : sanitize_key($paged_arg_name);
704 704
 
705 705
 		//filter items_label
706 706
 		$items_label = apply_filters(
@@ -708,68 +708,68 @@  discard block
 block discarded – undo
708 708
 			$items_label
709 709
 		);
710 710
 
711
-		if ( empty( $items_label )
712
-		     || ! is_array( $items_label )
713
-		     || ! isset( $items_label['single'] )
714
-		     || ! isset( $items_label['plural'] ) ) {
711
+		if (empty($items_label)
712
+		     || ! is_array($items_label)
713
+		     || ! isset($items_label['single'])
714
+		     || ! isset($items_label['plural'])) {
715 715
 			$items_label = array(
716
-				'single' => __( '1 item', 'event_espresso' ),
717
-				'plural' => __( '%s items', 'event_espresso' )
716
+				'single' => __('1 item', 'event_espresso'),
717
+				'plural' => __('%s items', 'event_espresso')
718 718
 			);
719 719
 		} else {
720 720
 			$items_label = array(
721
-				'single' => '1 ' . esc_html( $items_label['single'] ),
722
-				'plural' => '%s ' . esc_html( $items_label['plural'] )
721
+				'single' => '1 '.esc_html($items_label['single']),
722
+				'plural' => '%s '.esc_html($items_label['plural'])
723 723
 			);
724 724
 		}
725 725
 
726
-		$total_pages = ceil( $total_items / $per_page );
726
+		$total_pages = ceil($total_items / $per_page);
727 727
 
728
-		if ( $total_pages <= 1 )
728
+		if ($total_pages <= 1)
729 729
 			return '';
730 730
 
731
-		$item_label = $total_items > 1 ? sprintf( $items_label['plural'], $total_items ) : $items_label['single'];
731
+		$item_label = $total_items > 1 ? sprintf($items_label['plural'], $total_items) : $items_label['single'];
732 732
 
733
-		$output = '<span class="displaying-num">' . $item_label . '</span>';
733
+		$output = '<span class="displaying-num">'.$item_label.'</span>';
734 734
 
735
-		if ( $current === 1 ) {
735
+		if ($current === 1) {
736 736
 			$disable_first = ' disabled';
737 737
 		}
738
-		if ( $current == $total_pages ) {
738
+		if ($current == $total_pages) {
739 739
 			$disable_last = ' disabled';
740 740
 		}
741 741
 
742
-		$page_links[] = sprintf( "<a class='%s' title='%s' href='%s'>%s</a>",
743
-			'first-page' . $disable_first,
744
-			esc_attr__( 'Go to the first page' ),
745
-			esc_url( remove_query_arg( $paged_arg_name, $url ) ),
742
+		$page_links[] = sprintf("<a class='%s' title='%s' href='%s'>%s</a>",
743
+			'first-page'.$disable_first,
744
+			esc_attr__('Go to the first page'),
745
+			esc_url(remove_query_arg($paged_arg_name, $url)),
746 746
 			'&laquo;'
747 747
 		);
748 748
 
749 749
 		$page_links[] = sprintf(
750 750
 			'<a class="%s" title="%s" href="%s">%s</a>',
751
-			'prev-page' . $disable_first,
752
-			esc_attr__( 'Go to the previous page' ),
753
-			esc_url( add_query_arg( $paged_arg_name, max( 1, $current-1 ), $url ) ),
751
+			'prev-page'.$disable_first,
752
+			esc_attr__('Go to the previous page'),
753
+			esc_url(add_query_arg($paged_arg_name, max(1, $current - 1), $url)),
754 754
 			'&lsaquo;'
755 755
 		);
756 756
 
757
-		if ( ! $show_num_field ) {
757
+		if ( ! $show_num_field) {
758 758
 			$html_current_page = $current;
759 759
 		} else {
760
-			$html_current_page = sprintf( "<input class='current-page' title='%s' type='text' name=$paged_arg_name value='%s' size='%d' />",
761
-				esc_attr__( 'Current page' ),
760
+			$html_current_page = sprintf("<input class='current-page' title='%s' type='text' name=$paged_arg_name value='%s' size='%d' />",
761
+				esc_attr__('Current page'),
762 762
 				$current,
763
-				strlen( $total_pages )
763
+				strlen($total_pages)
764 764
 			);
765 765
 		}
766 766
 
767 767
 		$html_total_pages = sprintf(
768 768
 			'<span class="total-pages">%s</span>',
769
-			number_format_i18n( $total_pages )
769
+			number_format_i18n($total_pages)
770 770
 		);
771 771
 		$page_links[] = sprintf(
772
-			_x( '%3$s%1$s of %2$s%4$s', 'paging' ),
772
+			_x('%3$s%1$s of %2$s%4$s', 'paging'),
773 773
 			$html_current_page,
774 774
 			$html_total_pages,
775 775
 			'<span class="paging-input">',
@@ -778,29 +778,29 @@  discard block
 block discarded – undo
778 778
 
779 779
 		$page_links[] = sprintf(
780 780
 			'<a class="%s" title="%s" href="%s">%s</a>',
781
-			'next-page' . $disable_last,
782
-			esc_attr__( 'Go to the next page' ),
783
-			esc_url( add_query_arg( $paged_arg_name, min( $total_pages, $current+1 ), $url ) ),
781
+			'next-page'.$disable_last,
782
+			esc_attr__('Go to the next page'),
783
+			esc_url(add_query_arg($paged_arg_name, min($total_pages, $current + 1), $url)),
784 784
 			'&rsaquo;'
785 785
 		);
786 786
 
787 787
 		$page_links[] = sprintf(
788 788
 			'<a class="%s" title="%s" href="%s">%s</a>',
789
-			'last-page' . $disable_last,
790
-			esc_attr__( 'Go to the last page' ),
791
-			esc_url( add_query_arg( $paged_arg_name, $total_pages, $url ) ),
789
+			'last-page'.$disable_last,
790
+			esc_attr__('Go to the last page'),
791
+			esc_url(add_query_arg($paged_arg_name, $total_pages, $url)),
792 792
 			'&raquo;'
793 793
 		);
794 794
 
795
-		$output .= "\n" . '<span class="pagination-links">' . join( "\n", $page_links ) . '</span>';
795
+		$output .= "\n".'<span class="pagination-links">'.join("\n", $page_links).'</span>';
796 796
 		// set page class
797
-		if ( $total_pages ) {
797
+		if ($total_pages) {
798 798
 			$page_class = $total_pages < 2 ? ' one-page' : '';
799 799
 		} else {
800 800
 			$page_class = ' no-pages';
801 801
 		}
802 802
 
803
-		return '<div class="tablenav"><div class="tablenav-pages' . $page_class . '">' . $output . '</div></div>';
803
+		return '<div class="tablenav"><div class="tablenav-pages'.$page_class.'">'.$output.'</div></div>';
804 804
 	}
805 805
 
806 806
 
Please login to merge, or discard this patch.
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 				return array();
100 100
 			}
101 101
 			if (( $key = array_search( 'global_assets', $espresso_themes )) !== FALSE ) {
102
-			    unset( $espresso_themes[ $key ] );
102
+				unset( $espresso_themes[ $key ] );
103 103
 			}
104 104
 			EEH_Template::$_espresso_themes = array();
105 105
 			foreach ( $espresso_themes as $espresso_theme ) {
@@ -709,9 +709,9 @@  discard block
 block discarded – undo
709 709
 		);
710 710
 
711 711
 		if ( empty( $items_label )
712
-		     || ! is_array( $items_label )
713
-		     || ! isset( $items_label['single'] )
714
-		     || ! isset( $items_label['plural'] ) ) {
712
+			 || ! is_array( $items_label )
713
+			 || ! isset( $items_label['single'] )
714
+			 || ! isset( $items_label['plural'] ) ) {
715 715
 			$items_label = array(
716 716
 				'single' => __( '1 item', 'event_espresso' ),
717 717
 				'plural' => __( '%s items', 'event_espresso' )
Please login to merge, or discard this patch.
core/db_models/relations/EE_HABTM_Any_Relation.php 3 patches
Doc Comments   -1 removed lines patch added patch discarded remove patch
@@ -32,7 +32,6 @@
 block discarded – undo
32 32
 	/**
33 33
 	 * 
34 34
 	 * @param string $model_name
35
-	 * @param string $comparison_model_name
36 35
 	 * @param string $id_or_name_field should be the string 'ID' or 'name' only
37 36
 	 * @return EE_Model_Field_Base
38 37
 	 */
Please login to merge, or discard this patch.
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Joins any two models together via a has-and-belongs-to-many relation, using 
4
- * the esp_extra_join table.
5
- */
3
+	  * Joins any two models together via a has-and-belongs-to-many relation, using 
4
+	  * the esp_extra_join table.
5
+	  */
6 6
 class EE_HABTM_Any_Relation extends EE_HABTM_Relation{	
7 7
 	/**
8 8
 	 *
Please login to merge, or discard this patch.
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@  discard block
 block discarded – undo
3 3
  * Joins any two models together via a has-and-belongs-to-many relation, using 
4 4
  * the esp_extra_join table.
5 5
  */
6
-class EE_HABTM_Any_Relation extends EE_HABTM_Relation{	
6
+class EE_HABTM_Any_Relation extends EE_HABTM_Relation {	
7 7
 	/**
8 8
 	 *
9 9
 	 * @var string
@@ -17,16 +17,16 @@  discard block
 block discarded – undo
17 17
 	 * @param boolean $block_deletes for this type of relation, we block by default for now. if there are related models across this relation, block (prevent and add an error) the deletion of this model
18 18
 	 * @param type $blocking_delete_error_message a customized error message on blocking deletes instead of the default
19 19
 	 */
20
-	function __construct( $block_deletes = true, $blocking_delete_error_message =''){
21
-		parent::__construct( 'Extra_Join', $block_deletes, $blocking_delete_error_message);
20
+	function __construct($block_deletes = true, $blocking_delete_error_message = '') {
21
+		parent::__construct('Extra_Join', $block_deletes, $blocking_delete_error_message);
22 22
 	}
23
-	function _construct_finalize_set_models($this_model_name, $other_model_name){
24
-		if( $this_model_name < $other_model_name ) {
23
+	function _construct_finalize_set_models($this_model_name, $other_model_name) {
24
+		if ($this_model_name < $other_model_name) {
25 25
 			$this->_alphabetically_first_model_name = $this_model_name;
26
-		} else{
26
+		} else {
27 27
 			$this->_alphabetically_first_model_name = $other_model_name;
28 28
 		}
29
-		return parent::_construct_finalize_set_models( $this_model_name, $other_model_name );
29
+		return parent::_construct_finalize_set_models($this_model_name, $other_model_name);
30 30
 	}
31 31
 	
32 32
 	/**
@@ -36,21 +36,21 @@  discard block
 block discarded – undo
36 36
 	 * @param string $id_or_name_field should be the string 'ID' or 'name' only
37 37
 	 * @return EE_Model_Field_Base
38 38
 	 */
39
-	function get_join_table_fk_field_to( $model_name, $id_or_name_field ) {
39
+	function get_join_table_fk_field_to($model_name, $id_or_name_field) {
40 40
 		$order = null;
41
-		if( $model_name === $this->_alphabetically_first_model_name ) {
41
+		if ($model_name === $this->_alphabetically_first_model_name) {
42 42
 			$order = 'first';
43 43
 		} else {
44 44
 			$order = 'second';
45 45
 		}
46
-		return $this->get_join_model()->field_settings_for( 'EXJ_' . $order . '_model_' . $id_or_name_field );
46
+		return $this->get_join_model()->field_settings_for('EXJ_'.$order.'_model_'.$id_or_name_field);
47 47
 	}
48 48
 	/**
49 49
 	 * Gets the SQL string for joining the main model's table containing the pk to the join table. Eg "LEFT JOIN real_join_table AS join_table_alias ON this_table_alias.pk = join_table_alias.fk_to_this_table"
50 50
 	 * @param string $model_relation_chain like 'Event.Event_Venue.Venue'
51 51
 	 * @return string of SQL
52 52
 	 */
53
-	function get_join_to_intermediate_model_statement($model_relation_chain){
53
+	function get_join_to_intermediate_model_statement($model_relation_chain) {
54 54
 		//create sql like
55 55
 		//LEFT JOIN join_table AS join_table_alias ON this_table_alias.this_table_pk = join_table_alias.join_table_fk_to_this
56 56
 		//LEFT JOIN other_table AS other_table_alias ON join_table_alias.join_table_fk_to_other = other_table_alias.other_table_pk
@@ -64,8 +64,8 @@  discard block
 block discarded – undo
64 64
 		$field_with_model_name = $this->get_join_table_fk_field_to( 
65 65
 				$this->get_this_model()->get_this_model_name(), 
66 66
 				'name' );
67
-		$this_table_alias = EE_Model_Parser::extract_table_alias_model_relation_chain_prefix($model_relation_chain, $this->get_this_model()->get_this_model_name()) . $this_table_pk_field->get_table_alias();
68
-		$join_table_alias = EE_Model_Parser::extract_table_alias_model_relation_chain_prefix($model_relation_chain, $this->get_join_model()->get_this_model_name()) . $join_table_fk_field_to_this_table->get_table_alias();
67
+		$this_table_alias = EE_Model_Parser::extract_table_alias_model_relation_chain_prefix($model_relation_chain, $this->get_this_model()->get_this_model_name()).$this_table_pk_field->get_table_alias();
68
+		$join_table_alias = EE_Model_Parser::extract_table_alias_model_relation_chain_prefix($model_relation_chain, $this->get_join_model()->get_this_model_name()).$join_table_fk_field_to_this_table->get_table_alias();
69 69
 		$join_table = $this->get_join_model()->get_table_for_alias($join_table_alias);
70 70
 		//phew! ok, we have all the info we need, now we can create the SQL join string
71 71
 		$SQL = $this->_left_join(
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 					$join_table_fk_field_to_this_table->get_table_column(), 
75 75
 					$this_table_alias, 
76 76
 					$this_table_pk_field->get_table_column(),
77
-					$field_with_model_name->get_qualified_column()."='".$this->get_this_model()->get_this_model_name()."'" ) .
77
+					$field_with_model_name->get_qualified_column()."='".$this->get_this_model()->get_this_model_name()."'" ).
78 78
 				$this->get_join_model()->_construct_internal_join_to_table_with_alias($join_table_alias);
79 79
 
80 80
 		return $SQL;
@@ -87,9 +87,9 @@  discard block
 block discarded – undo
87 87
 	 * @param string $model_relation_chain like 'Event.Event_Venue.Venue'
88 88
 	 * @return string of SQL
89 89
 	 */
90
-	function get_join_statement($model_relation_chain){
91
-		if( $this->_model_relation_chain_to_join_model === NULL ){
92
-			throw new EE_Error( sprintf( __( 'When using EE_HABTM_Relation to create a join, you must call get_join_to_intermediate_model_statement BEFORE get_join_statement', 'event_espresso' )));
90
+	function get_join_statement($model_relation_chain) {
91
+		if ($this->_model_relation_chain_to_join_model === NULL) {
92
+			throw new EE_Error(sprintf(__('When using EE_HABTM_Relation to create a join, you must call get_join_to_intermediate_model_statement BEFORE get_join_statement', 'event_espresso')));
93 93
 		}
94 94
 		$join_table_fk_field_to_this_table = $this->get_join_table_fk_field_to( 
95 95
 				$this->get_this_model()->get_this_model_name(), 
@@ -101,10 +101,10 @@  discard block
 block discarded – undo
101 101
 				$this->get_other_model()->get_this_model_name(), 
102 102
 				'name' );
103 103
 		
104
-		$join_table_alias = EE_Model_Parser::extract_table_alias_model_relation_chain_prefix($this->_model_relation_chain_to_join_model, $this->get_join_model()->get_this_model_name()) . $join_table_fk_field_to_this_table->get_table_alias();
104
+		$join_table_alias = EE_Model_Parser::extract_table_alias_model_relation_chain_prefix($this->_model_relation_chain_to_join_model, $this->get_join_model()->get_this_model_name()).$join_table_fk_field_to_this_table->get_table_alias();
105 105
 		
106 106
 		$other_table_pk_field = $this->get_other_model()->get_primary_key_field();
107
-		$other_table_alias = EE_Model_Parser::extract_table_alias_model_relation_chain_prefix($model_relation_chain, $this->get_other_model()->get_this_model_name()) . $other_table_pk_field->get_table_alias();
107
+		$other_table_alias = EE_Model_Parser::extract_table_alias_model_relation_chain_prefix($model_relation_chain, $this->get_other_model()->get_this_model_name()).$other_table_pk_field->get_table_alias();
108 108
 		$other_table = $this->get_other_model()->get_table_for_alias($other_table_alias);
109 109
 
110 110
 		$SQL = $this->_left_join(
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
 					$join_table_alias, 
115 115
 					$join_table_fk_field_to_other_table->get_table_column(),
116 116
 					$field_with_other_model_name->get_qualified_column()."='".$this->get_other_model()->get_this_model_name()."'" 
117
-				) . 
117
+				). 
118 118
 				$this->get_other_model()->_construct_internal_join_to_table_with_alias($other_table_alias);
119 119
 		return $SQL;
120 120
 	}
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 	 * @param array             $extra_join_model_fields_n_values col=>val pairs that are used as extra conditions for checking existing values and for setting new rows if no exact matches.
127 127
 	 * @return EE_Base_Class
128 128
 	 */
129
-	 function add_relation_to($this_obj_or_id, $other_obj_or_id, $extra_join_model_fields_n_values = array() ){
129
+	 function add_relation_to($this_obj_or_id, $other_obj_or_id, $extra_join_model_fields_n_values = array()) {
130 130
 		 $this_model_obj = $this->get_this_model()->ensure_is_obj($this_obj_or_id, true);
131 131
 		 $other_model_obj = $this->get_other_model()->ensure_is_obj($other_obj_or_id, true);
132 132
 		//check if such a relationship already exists
@@ -143,31 +143,31 @@  discard block
 block discarded – undo
143 143
 				$this->get_other_model()->get_this_model_name(),
144 144
 				'name' );
145 145
 
146
-		$cols_n_values =  array(
146
+		$cols_n_values = array(
147 147
 				$join_model_fk_to_this_model->get_name() => $this_model_obj->ID(),
148 148
 				$join_model_name_field_to_this_model->get_name() => $this_model_obj->get_model()->get_this_model_name(),
149 149
 				$join_model_fk_to_other_model->get_name() => $other_model_obj->ID(),
150 150
 				$join_model_name_field_to_other_model->get_name() => $other_model_obj->get_model()->get_this_model_name() );
151 151
 
152 152
 		//if $where_query exists lets add them to the query_params.
153
-		if ( !empty( $extra_join_model_fields_n_values ) ) {
153
+		if ( ! empty($extra_join_model_fields_n_values)) {
154 154
 		   //make sure we strip any of the join model names from the $where_query cause we don't need that in here (why? because client code may have used the same conditionals for get_all_related which DOES need the join model name)
155 155
 		   //make sure we strip THIS models name from the query param
156
-		   foreach ( $extra_join_model_fields_n_values as $query_param => $val ) {
157
-			   $query_param = str_replace($this->get_join_model()->get_this_model_name().".","", $query_param);
156
+		   foreach ($extra_join_model_fields_n_values as $query_param => $val) {
157
+			   $query_param = str_replace($this->get_join_model()->get_this_model_name().".", "", $query_param);
158 158
 			   $parsed_query[$query_param] = $val;
159 159
 		   }
160
-		   $cols_n_values = array_merge( $cols_n_values, $parsed_query );
160
+		   $cols_n_values = array_merge($cols_n_values, $parsed_query);
161 161
 		}
162 162
 
163
-		$query_params = array( $cols_n_values );
163
+		$query_params = array($cols_n_values);
164 164
 
165 165
 
166 166
 		$existing_entry_in_join_table = $this->get_join_model()->get_one($query_params);
167 167
 		//if there is already an entry in the join table, indicating a relationship, we're done
168 168
 		 //again, if you want more sophisticated logic or insertions (handling more columns than just 2 foreign keys to
169 169
 		 //the other tables, use the joining model directly!
170
-		if( ! $existing_entry_in_join_table ){
170
+		if ( ! $existing_entry_in_join_table) {
171 171
 			$this->get_join_model()->insert($cols_n_values);
172 172
 		}
173 173
 		return $other_model_obj;
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
 	 * * @param array           $where_query col=>val pairs that are used as extra conditions for checking existing values and for removing existing rows if exact matches exist.
180 180
 	 * @return EE_Base_Class
181 181
 	 */
182
-	 function remove_relation_to($this_obj_or_id, $other_obj_or_id, $where_query = array() ){
182
+	 function remove_relation_to($this_obj_or_id, $other_obj_or_id, $where_query = array()) {
183 183
 		 $this_model_obj = $this->get_this_model()->ensure_is_obj($this_obj_or_id, true);
184 184
 		 $other_model_obj = $this->get_other_model()->ensure_is_obj($other_obj_or_id, true);
185 185
 		//check if such a relationship already exists
@@ -196,24 +196,24 @@  discard block
 block discarded – undo
196 196
 				$this->get_other_model()->get_this_model_name(), 
197 197
 				'name' );
198 198
 
199
-		$cols_n_values =  array(
199
+		$cols_n_values = array(
200 200
 				$join_model_fk_to_this_model->get_name() => $this_model_obj->ID(),
201 201
 				$join_model_name_field_to_this_model->get_name() => $this_model_obj->get_model()->get_this_model_name(),
202 202
 				$join_model_fk_to_other_model->get_name() => $other_model_obj->ID(),
203 203
 				$join_model_name_field_to_other_model->get_name() => $other_model_obj->get_model()->get_this_model_name() );
204 204
 
205 205
 		//if $where_query exists lets add them to the query_params.
206
-		if ( !empty( $where_query ) ) {
206
+		if ( ! empty($where_query)) {
207 207
 		 	//make sure we strip any of the join model names from the $where_query cause we don't need that in here (why? because client code may have used the same conditionals for get_all_related which DOES need the join model name)
208 208
 		 	//make sure we strip THIS models name from the query param
209
-		 	foreach ( $where_query as $query_param => $val ) {
210
-				$query_param = str_replace($this->get_join_model()->get_this_model_name().".","", $query_param);
209
+		 	foreach ($where_query as $query_param => $val) {
210
+				$query_param = str_replace($this->get_join_model()->get_this_model_name().".", "", $query_param);
211 211
 				$parsed_query[$query_param] = $val;
212 212
 			}
213
-		 	$cols_n_values = array_merge( $cols_n_values, $parsed_query );
213
+		 	$cols_n_values = array_merge($cols_n_values, $parsed_query);
214 214
 		}
215 215
 
216
-		$existing_entry_in_join_table = $this->get_join_model()->delete( array($cols_n_values) );
216
+		$existing_entry_in_join_table = $this->get_join_model()->delete(array($cols_n_values));
217 217
 		return $other_model_obj;
218 218
 	 }
219 219
 }
Please login to merge, or discard this patch.
core/db_classes/EE_Extra_Join.class.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -22,9 +22,9 @@  discard block
 block discarded – undo
22 22
 	 * @param null  $timezone
23 23
 	 * @return EE_Event_Message_Template|mixed
24 24
 	 */
25
-	public static function new_instance( $props_n_values = array(), $timezone = NULL ) {
26
-		$has_object = parent::_check_for_object( $props_n_values, __CLASS__, $timezone );
27
-		return $has_object ? $has_object : new self( $props_n_values, FALSE, $timezone );
25
+	public static function new_instance($props_n_values = array(), $timezone = NULL) {
26
+		$has_object = parent::_check_for_object($props_n_values, __CLASS__, $timezone);
27
+		return $has_object ? $has_object : new self($props_n_values, FALSE, $timezone);
28 28
 	}
29 29
 
30 30
 
@@ -34,8 +34,8 @@  discard block
 block discarded – undo
34 34
 	 * @param null  $timezone
35 35
 	 * @return EE_Event_Message_Template
36 36
 	 */
37
-	public static function new_instance_from_db ( $props_n_values = array(), $timezone = NULL ) {
38
-		return new self( $props_n_values, TRUE, $timezone );
37
+	public static function new_instance_from_db($props_n_values = array(), $timezone = NULL) {
38
+		return new self($props_n_values, TRUE, $timezone);
39 39
 	}
40 40
 
41 41
 }
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.
core/db_models/EEM_Extra_Join.model.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -21,26 +21,26 @@
 block discarded – undo
21 21
  * @since		 	   $VID:$
22 22
  *
23 23
  */
24
-if (!defined('EVENT_ESPRESSO_VERSION')) {
24
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
25 25
 	exit('No direct script access allowed');
26 26
 }
27 27
 
28
-class EEM_Extra_Join extends EEM_Base{
28
+class EEM_Extra_Join extends EEM_Base {
29 29
 	// private instance of the Extra Join object
30 30
 	protected static $_instance = NULL;
31 31
 	
32 32
 	public function __construct($timezone = NULL) {
33
-		$models_this_can_join = array_keys( EE_Registry::instance()->non_abstract_db_models );
33
+		$models_this_can_join = array_keys(EE_Registry::instance()->non_abstract_db_models);
34 34
 		$this->_tables = array(
35
-			'Extra_Join' => new EE_Primary_Table( 'esp_extra_join', 'EXJ_ID' ),
35
+			'Extra_Join' => new EE_Primary_Table('esp_extra_join', 'EXJ_ID'),
36 36
 		);
37 37
 		$this->_fields = array(
38 38
 			'Extra_Join' => array(
39
-				'EXJ_ID' => new EE_Primary_Key_Int_Field( 'EXJ_ID', __( 'Extra Join ID', 'event_espresso' ) ),
40
-				'EXJ_first_model_ID' => new EE_Foreign_Key_String_Field( 'EXJ_first_model_ID', __( 'First Model ID', 'event_espresso' ), true, 0, $models_this_can_join ),
41
-				'EXJ_first_model_name' => new EE_Any_Foreign_Model_Name_Field( 'EXJ_first_model_name', __( 'First Model Name', 'event_espresso'), true, '', $models_this_can_join ),
42
-				'EXJ_second_model_ID' => new EE_Foreign_Key_String_Field( 'EXJ_second_model_ID', __( 'Second Model ID', 'event_espresso' ), true, 0, $models_this_can_join ),
43
-				'EXJ_second_model_name' => new EE_Any_Foreign_Model_Name_Field( 'EXJ_second_model_name', __( 'Second Model Name', 'event_espresso'), true, '', $models_this_can_join ),
39
+				'EXJ_ID' => new EE_Primary_Key_Int_Field('EXJ_ID', __('Extra Join ID', 'event_espresso')),
40
+				'EXJ_first_model_ID' => new EE_Foreign_Key_String_Field('EXJ_first_model_ID', __('First Model ID', 'event_espresso'), true, 0, $models_this_can_join),
41
+				'EXJ_first_model_name' => new EE_Any_Foreign_Model_Name_Field('EXJ_first_model_name', __('First Model Name', 'event_espresso'), true, '', $models_this_can_join),
42
+				'EXJ_second_model_ID' => new EE_Foreign_Key_String_Field('EXJ_second_model_ID', __('Second Model ID', 'event_espresso'), true, 0, $models_this_can_join),
43
+				'EXJ_second_model_name' => new EE_Any_Foreign_Model_Name_Field('EXJ_second_model_name', __('Second Model Name', 'event_espresso'), true, '', $models_this_can_join),
44 44
 				
45 45
 			)
46 46
 		);
Please login to merge, or discard this patch.