Completed
Branch FET-8385-datetime-ticket-selec... (dcae27)
by
unknown
34:01 queued 22:12
created
core/helpers/EEH_Line_Item.helper.php 1 patch
Spacing   +346 added lines, -346 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@  discard block
 block discarded – undo
1
-<?php if (!defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); }
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); }
2 2
 /**
3 3
  *
4 4
  * EEH_Line_Item
@@ -45,8 +45,8 @@  discard block
 block discarded – undo
45 45
 	 * @return boolean success
46 46
 	 * @throws \EE_Error
47 47
 	 */
48
-	public static function add_unrelated_item( EE_Line_Item $parent_line_item, $name, $unit_price, $description = '', $quantity = 1, $taxable = FALSE, $code = NULL  ){
49
-		$items_subtotal = self::get_pre_tax_subtotal( $parent_line_item );
48
+	public static function add_unrelated_item(EE_Line_Item $parent_line_item, $name, $unit_price, $description = '', $quantity = 1, $taxable = FALSE, $code = NULL) {
49
+		$items_subtotal = self::get_pre_tax_subtotal($parent_line_item);
50 50
 		$line_item = EE_Line_Item::new_instance(array(
51 51
 			'LIN_name' => $name,
52 52
 			'LIN_desc' => $description,
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 			'LIN_quantity' => $quantity,
55 55
 			'LIN_percent' => null,
56 56
 			'LIN_is_taxable' => $taxable,
57
-			'LIN_order' => $items_subtotal instanceof EE_Line_Item ? count( $items_subtotal->children() ) : 0,
57
+			'LIN_order' => $items_subtotal instanceof EE_Line_Item ? count($items_subtotal->children()) : 0,
58 58
 			'LIN_total' => (float) $unit_price * (int) $quantity,
59 59
 			'LIN_type'=>  EEM_Line_Item::type_line_item,
60 60
 			'LIN_code' => $code,
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 			$line_item,
65 65
 			$parent_line_item
66 66
 		);
67
-		return self::add_item( $parent_line_item, $line_item );
67
+		return self::add_item($parent_line_item, $line_item);
68 68
 	}
69 69
 
70 70
 
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 	 * @return boolean success
87 87
 	 * @throws \EE_Error
88 88
 	 */
89
-	public static function add_percentage_based_item( EE_Line_Item $parent_line_item, $name, $percentage_amount, $description = '', $taxable = FALSE ){
89
+	public static function add_percentage_based_item(EE_Line_Item $parent_line_item, $name, $percentage_amount, $description = '', $taxable = FALSE) {
90 90
 		$line_item = EE_Line_Item::new_instance(array(
91 91
 			'LIN_name' => $name,
92 92
 			'LIN_desc' => $description,
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 			'LIN_percent' => $percentage_amount,
95 95
 			'LIN_quantity' => NULL,
96 96
 			'LIN_is_taxable' => $taxable,
97
-			'LIN_total' => (float) ( $percentage_amount * ( $parent_line_item->total() / 100 ) ),
97
+			'LIN_total' => (float) ($percentage_amount * ($parent_line_item->total() / 100)),
98 98
 			'LIN_type'=>  EEM_Line_Item::type_line_item,
99 99
 			'LIN_parent' => $parent_line_item->ID()
100 100
 		));
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 			'FHEE__EEH_Line_Item__add_percentage_based_item__line_item',
103 103
 			$line_item
104 104
 		);
105
-		return self::add_item( $parent_line_item, $line_item );
105
+		return self::add_item($parent_line_item, $line_item);
106 106
 	}
107 107
 
108 108
 
@@ -123,15 +123,15 @@  discard block
 block discarded – undo
123 123
 	 * @return \EE_Line_Item
124 124
 	 * @throws \EE_Error
125 125
 	 */
126
-	public static function add_ticket_purchase( EE_Line_Item $total_line_item, EE_Ticket $ticket, $qty = 1 ){
127
-		if ( ! $total_line_item instanceof EE_Line_Item || ! $total_line_item->is_total() ) {
128
-			throw new EE_Error( sprintf( __( 'A valid line item total is required in order to add tickets. A line item of type "%s" was passed.', 'event_espresso' ), $ticket->ID(), $total_line_item->ID() ) );
126
+	public static function add_ticket_purchase(EE_Line_Item $total_line_item, EE_Ticket $ticket, $qty = 1) {
127
+		if ( ! $total_line_item instanceof EE_Line_Item || ! $total_line_item->is_total()) {
128
+			throw new EE_Error(sprintf(__('A valid line item total is required in order to add tickets. A line item of type "%s" was passed.', 'event_espresso'), $ticket->ID(), $total_line_item->ID()));
129 129
 		}
130 130
 		// either increment the qty for an existing ticket
131
-		$line_item = self::increment_ticket_qty_if_already_in_cart( $total_line_item, $ticket, $qty );
131
+		$line_item = self::increment_ticket_qty_if_already_in_cart($total_line_item, $ticket, $qty);
132 132
 		// or add a new one
133
-		if ( ! $line_item instanceof EE_Line_Item ) {
134
-			$line_item = self::create_ticket_line_item( $total_line_item, $ticket, $qty );
133
+		if ( ! $line_item instanceof EE_Line_Item) {
134
+			$line_item = self::create_ticket_line_item($total_line_item, $ticket, $qty);
135 135
 		}
136 136
 		$total_line_item->recalculate_total_including_taxes();
137 137
 		return $line_item;
@@ -147,11 +147,11 @@  discard block
 block discarded – undo
147 147
 	 * @return \EE_Line_Item
148 148
 	 * @throws \EE_Error
149 149
 	 */
150
-	public static function increment_ticket_qty_if_already_in_cart( EE_Line_Item $total_line_item, EE_Ticket $ticket, $qty = 1 ) {
150
+	public static function increment_ticket_qty_if_already_in_cart(EE_Line_Item $total_line_item, EE_Ticket $ticket, $qty = 1) {
151 151
 		$line_item = null;
152
-		if ( $total_line_item instanceof EE_Line_Item && $total_line_item->is_total() ) {
153
-			$ticket_line_items = EEH_Line_Item::get_ticket_line_items( $total_line_item );
154
-			foreach ( (array)$ticket_line_items as $ticket_line_item ) {
152
+		if ($total_line_item instanceof EE_Line_Item && $total_line_item->is_total()) {
153
+			$ticket_line_items = EEH_Line_Item::get_ticket_line_items($total_line_item);
154
+			foreach ((array) $ticket_line_items as $ticket_line_item) {
155 155
 				if (
156 156
 					$ticket_line_item instanceof EE_Line_Item
157 157
 					&& (int) $ticket_line_item->OBJ_ID() === (int) $ticket->ID()
@@ -161,8 +161,8 @@  discard block
 block discarded – undo
161 161
 				}
162 162
 			}
163 163
 		}
164
-		if ( $line_item instanceof EE_Line_Item ) {
165
-			EEH_Line_Item::increment_quantity( $line_item, $qty );
164
+		if ($line_item instanceof EE_Line_Item) {
165
+			EEH_Line_Item::increment_quantity($line_item, $qty);
166 166
 			return $line_item;
167 167
 		}
168 168
 		return null;
@@ -179,16 +179,16 @@  discard block
 block discarded – undo
179 179
 	 * @return void
180 180
 	 * @throws \EE_Error
181 181
 	 */
182
-	public static function increment_quantity( EE_Line_Item $line_item, $qty = 1 ) {
183
-		if( ! $line_item->is_percent() ) {
182
+	public static function increment_quantity(EE_Line_Item $line_item, $qty = 1) {
183
+		if ( ! $line_item->is_percent()) {
184 184
 			$qty += $line_item->quantity();
185
-			$line_item->set_quantity( $qty );
186
-			$line_item->set_total( $line_item->unit_price() * $qty );
185
+			$line_item->set_quantity($qty);
186
+			$line_item->set_total($line_item->unit_price() * $qty);
187 187
 			$line_item->save();
188 188
 		}
189
-		foreach( $line_item->children() as $child ) {
190
-			if( $child->is_sub_line_item() ) {
191
-				EEH_Line_Item::update_quantity( $child, $qty );
189
+		foreach ($line_item->children() as $child) {
190
+			if ($child->is_sub_line_item()) {
191
+				EEH_Line_Item::update_quantity($child, $qty);
192 192
 			}
193 193
 		}
194 194
 	}
@@ -204,17 +204,17 @@  discard block
 block discarded – undo
204 204
 	 * @return void
205 205
 	 * @throws \EE_Error
206 206
 	 */
207
-	public static function decrement_quantity( EE_Line_Item $line_item, $qty = 1 ) {
208
-		if( ! $line_item->is_percent() ) {
207
+	public static function decrement_quantity(EE_Line_Item $line_item, $qty = 1) {
208
+		if ( ! $line_item->is_percent()) {
209 209
 			$qty = $line_item->quantity() - $qty;
210
-			$qty = max( $qty, 0 );
211
-			$line_item->set_quantity( $qty );
212
-			$line_item->set_total( $line_item->unit_price() * $qty );
210
+			$qty = max($qty, 0);
211
+			$line_item->set_quantity($qty);
212
+			$line_item->set_total($line_item->unit_price() * $qty);
213 213
 			$line_item->save();
214 214
 		}
215
-		foreach( $line_item->children() as $child ) {
216
-			if( $child->is_sub_line_item() ) {
217
-				EEH_Line_Item::update_quantity( $child, $qty );
215
+		foreach ($line_item->children() as $child) {
216
+			if ($child->is_sub_line_item()) {
217
+				EEH_Line_Item::update_quantity($child, $qty);
218 218
 			}
219 219
 		}
220 220
 	}
@@ -229,15 +229,15 @@  discard block
 block discarded – undo
229 229
 	 * @param int          $new_quantity
230 230
 	 * @throws \EE_Error
231 231
 	 */
232
-	public static function update_quantity( EE_Line_Item $line_item, $new_quantity ) {
233
-		if( ! $line_item->is_percent() ) {
234
-			$line_item->set_quantity( $new_quantity );
235
-			$line_item->set_total( $line_item->unit_price() * $new_quantity );
232
+	public static function update_quantity(EE_Line_Item $line_item, $new_quantity) {
233
+		if ( ! $line_item->is_percent()) {
234
+			$line_item->set_quantity($new_quantity);
235
+			$line_item->set_total($line_item->unit_price() * $new_quantity);
236 236
 			$line_item->save();
237 237
 		}
238
-		foreach( $line_item->children() as $child ) {
239
-			if( $child->is_sub_line_item() ) {
240
-				EEH_Line_Item::update_quantity( $child, $new_quantity );
238
+		foreach ($line_item->children() as $child) {
239
+			if ($child->is_sub_line_item()) {
240
+				EEH_Line_Item::update_quantity($child, $new_quantity);
241 241
 			}
242 242
 		}
243 243
 	}
@@ -252,43 +252,43 @@  discard block
 block discarded – undo
252 252
 	 * @return \EE_Line_Item
253 253
 	 * @throws \EE_Error
254 254
 	 */
255
-	public static function create_ticket_line_item( EE_Line_Item $total_line_item, EE_Ticket $ticket, $qty = 1 ) {
255
+	public static function create_ticket_line_item(EE_Line_Item $total_line_item, EE_Ticket $ticket, $qty = 1) {
256 256
 		$datetimes = $ticket->datetimes();
257
-		$first_datetime = reset( $datetimes );
258
-		if( $first_datetime instanceof EE_Datetime && $first_datetime->event() instanceof EE_Event ) {
257
+		$first_datetime = reset($datetimes);
258
+		if ($first_datetime instanceof EE_Datetime && $first_datetime->event() instanceof EE_Event) {
259 259
 			$first_datetime_name = $first_datetime->event()->name();
260 260
 		} else {
261
-			$first_datetime_name = __( 'Event', 'event_espresso' );
261
+			$first_datetime_name = __('Event', 'event_espresso');
262 262
 		}
263
-		$event = sprintf( _x( '(For %1$s)', '(For Event Name)', 'event_espresso' ), $first_datetime_name );
263
+		$event = sprintf(_x('(For %1$s)', '(For Event Name)', 'event_espresso'), $first_datetime_name);
264 264
 		// get event subtotal line
265
-		$events_sub_total = self::get_event_line_item_for_ticket( $total_line_item, $ticket );
265
+		$events_sub_total = self::get_event_line_item_for_ticket($total_line_item, $ticket);
266 266
 		// add $ticket to cart
267
-		$line_item = EE_Line_Item::new_instance( array(
267
+		$line_item = EE_Line_Item::new_instance(array(
268 268
 			'LIN_name'       	=> $ticket->name(),
269
-			'LIN_desc'       		=> $ticket->description() !== '' ? $ticket->description() . ' ' . $event : $event,
269
+			'LIN_desc'       		=> $ticket->description() !== '' ? $ticket->description().' '.$event : $event,
270 270
 			'LIN_unit_price' 	=> $ticket->price(),
271 271
 			'LIN_quantity'   	=> $qty,
272 272
 			'LIN_is_taxable' 	=> $ticket->taxable(),
273
-			'LIN_order'      	=> count( $events_sub_total->children() ),
273
+			'LIN_order'      	=> count($events_sub_total->children()),
274 274
 			'LIN_total'      		=> $ticket->price() * $qty,
275 275
 			'LIN_type'       		=> EEM_Line_Item::type_line_item,
276 276
 			'OBJ_ID'         		=> $ticket->ID(),
277 277
 			'OBJ_type'       	=> 'Ticket'
278
-		) );
278
+		));
279 279
 		$line_item = apply_filters(
280 280
 			'FHEE__EEH_Line_Item__create_ticket_line_item__line_item',
281 281
 			$line_item
282 282
 		);
283
-		$events_sub_total->add_child_line_item( $line_item );
283
+		$events_sub_total->add_child_line_item($line_item);
284 284
 		//now add the sub-line items
285 285
 		$running_total_for_ticket = 0;
286
-		foreach ( $ticket->prices( array( 'order_by' => array( 'PRC_order' => 'ASC' ) ) ) as $price ) {
286
+		foreach ($ticket->prices(array('order_by' => array('PRC_order' => 'ASC'))) as $price) {
287 287
 			$sign = $price->is_discount() ? -1 : 1;
288 288
 			$price_total = $price->is_percent()
289 289
 				? $running_total_for_ticket * $price->amount() / 100
290 290
 				: $price->amount() * $qty;
291
-			$sub_line_item = EE_Line_Item::new_instance( array(
291
+			$sub_line_item = EE_Line_Item::new_instance(array(
292 292
 				'LIN_name'       	=> $price->name(),
293 293
 				'LIN_desc'       		=> $price->desc(),
294 294
 				'LIN_quantity'   	=> $price->is_percent() ? null : $qty,
@@ -298,18 +298,18 @@  discard block
 block discarded – undo
298 298
 				'LIN_type'       		=> EEM_Line_Item::type_sub_line_item,
299 299
 				'OBJ_ID'         		=> $price->ID(),
300 300
 				'OBJ_type'       	=> 'Price'
301
-			) );
301
+			));
302 302
 			$sub_line_item = apply_filters(
303 303
 				'FHEE__EEH_Line_Item__create_ticket_line_item__sub_line_item',
304 304
 				$sub_line_item
305 305
 			);
306
-			if ( $price->is_percent() ) {
307
-				$sub_line_item->set_percent( $sign * $price->amount() );
306
+			if ($price->is_percent()) {
307
+				$sub_line_item->set_percent($sign * $price->amount());
308 308
 			} else {
309
-				$sub_line_item->set_unit_price( $sign * $price->amount() );
309
+				$sub_line_item->set_unit_price($sign * $price->amount());
310 310
 			}
311 311
 			$running_total_for_ticket += $price_total;
312
-			$line_item->add_child_line_item( $sub_line_item );
312
+			$line_item->add_child_line_item($sub_line_item);
313 313
 		}
314 314
 		return $line_item;
315 315
 	}
@@ -329,11 +329,11 @@  discard block
 block discarded – undo
329 329
 	 * @return boolean
330 330
 	 * @throws \EE_Error
331 331
 	 */
332
-	public static function add_item( EE_Line_Item $total_line_item, EE_Line_Item $item ){
333
-		$pre_tax_subtotal = self::get_pre_tax_subtotal( $total_line_item );
334
-		if ( $pre_tax_subtotal instanceof EE_Line_Item ){
332
+	public static function add_item(EE_Line_Item $total_line_item, EE_Line_Item $item) {
333
+		$pre_tax_subtotal = self::get_pre_tax_subtotal($total_line_item);
334
+		if ($pre_tax_subtotal instanceof EE_Line_Item) {
335 335
 			$success = $pre_tax_subtotal->add_child_line_item($item);
336
-		}else{
336
+		} else {
337 337
 			return FALSE;
338 338
 		}
339 339
 		$total_line_item->recalculate_total_including_taxes();
@@ -352,34 +352,34 @@  discard block
 block discarded – undo
352 352
 	 * @return bool success
353 353
 	 * @throws \EE_Error
354 354
 	 */
355
-	public static function cancel_ticket_line_item( EE_Line_Item $ticket_line_item, $qty = 1 ) {
355
+	public static function cancel_ticket_line_item(EE_Line_Item $ticket_line_item, $qty = 1) {
356 356
 		// validate incoming line_item
357
-		if ( $ticket_line_item->OBJ_type() !== 'Ticket' ) {
357
+		if ($ticket_line_item->OBJ_type() !== 'Ticket') {
358 358
 			throw new EE_Error(
359 359
 				sprintf(
360
-					__( 'The supplied line item must have an Object Type of "Ticket", not %1$s.', 'event_espresso' ),
360
+					__('The supplied line item must have an Object Type of "Ticket", not %1$s.', 'event_espresso'),
361 361
 					$ticket_line_item->type()
362 362
 				)
363 363
 			);
364 364
 		}
365
-		if ( $ticket_line_item->quantity() < $qty ) {
365
+		if ($ticket_line_item->quantity() < $qty) {
366 366
 			throw new EE_Error(
367 367
 				sprintf(
368
-					__( 'Can not cancel %1$d ticket(s) because the supplied line item has a quantity of %2$d.', 'event_espresso' ),
368
+					__('Can not cancel %1$d ticket(s) because the supplied line item has a quantity of %2$d.', 'event_espresso'),
369 369
 					$qty,
370 370
 					$ticket_line_item->quantity()
371 371
 				)
372 372
 			);
373 373
 		}
374 374
 		// decrement ticket quantity; don't rely on auto-fixing when recalculating totals to do this
375
-		$ticket_line_item->set_quantity( $ticket_line_item->quantity() - $qty );
376
-		foreach( $ticket_line_item->children() as $child_line_item ) {
377
-			if(
375
+		$ticket_line_item->set_quantity($ticket_line_item->quantity() - $qty);
376
+		foreach ($ticket_line_item->children() as $child_line_item) {
377
+			if (
378 378
 				$child_line_item->is_sub_line_item()
379 379
 				&& ! $child_line_item->is_percent()
380 380
 				&& ! $child_line_item->is_cancellation()
381 381
 			) {
382
-				$child_line_item->set_quantity( $child_line_item->quantity() - $qty );
382
+				$child_line_item->set_quantity($child_line_item->quantity() - $qty);
383 383
 			}
384 384
 		}
385 385
 		// get cancellation sub line item
@@ -387,37 +387,37 @@  discard block
 block discarded – undo
387 387
 			$ticket_line_item,
388 388
 			EEM_Line_Item::type_cancellation
389 389
 		);
390
-		$cancellation_line_item = reset( $cancellation_line_item );
390
+		$cancellation_line_item = reset($cancellation_line_item);
391 391
 		// verify that this ticket was indeed previously cancelled
392
-		if ( $cancellation_line_item instanceof EE_Line_Item ) {
392
+		if ($cancellation_line_item instanceof EE_Line_Item) {
393 393
 			// increment cancelled quantity
394
-			$cancellation_line_item->set_quantity( $cancellation_line_item->quantity() + $qty );
394
+			$cancellation_line_item->set_quantity($cancellation_line_item->quantity() + $qty);
395 395
 		} else {
396 396
 			// create cancellation sub line item
397
-			$cancellation_line_item = EE_Line_Item::new_instance( array(
398
-				'LIN_name'       => __( 'Cancellation', 'event_espresso' ),
397
+			$cancellation_line_item = EE_Line_Item::new_instance(array(
398
+				'LIN_name'       => __('Cancellation', 'event_espresso'),
399 399
 				'LIN_desc'       => sprintf(
400
-					_x( 'Cancelled %1$s : %2$s', 'Cancelled Ticket Name : 2015-01-01 11:11', 'event_espresso' ),
400
+					_x('Cancelled %1$s : %2$s', 'Cancelled Ticket Name : 2015-01-01 11:11', 'event_espresso'),
401 401
 					$ticket_line_item->name(),
402
-					current_time( get_option( 'date_format' ) . ' ' . get_option( 'time_format' ) )
402
+					current_time(get_option('date_format').' '.get_option('time_format'))
403 403
 				),
404 404
 				'LIN_unit_price' => 0, // $ticket_line_item->unit_price()
405 405
 				'LIN_quantity'   => $qty,
406 406
 				'LIN_is_taxable' => $ticket_line_item->is_taxable(),
407
-				'LIN_order'      => count( $ticket_line_item->children() ),
407
+				'LIN_order'      => count($ticket_line_item->children()),
408 408
 				'LIN_total'      => 0, // $ticket_line_item->unit_price()
409 409
 				'LIN_type'       => EEM_Line_Item::type_cancellation,
410
-			) );
411
-			$ticket_line_item->add_child_line_item( $cancellation_line_item );
410
+			));
411
+			$ticket_line_item->add_child_line_item($cancellation_line_item);
412 412
 		}
413
-		if ( $ticket_line_item->save_this_and_descendants() > 0 ) {
413
+		if ($ticket_line_item->save_this_and_descendants() > 0) {
414 414
 			// decrement parent line item quantity
415 415
 			$event_line_item = $ticket_line_item->parent();
416
-			if ( $event_line_item instanceof EE_Line_Item && $event_line_item->OBJ_type() === 'Event' ) {
417
-				$event_line_item->set_quantity( $event_line_item->quantity() - $qty );
416
+			if ($event_line_item instanceof EE_Line_Item && $event_line_item->OBJ_type() === 'Event') {
417
+				$event_line_item->set_quantity($event_line_item->quantity() - $qty);
418 418
 				$event_line_item->save();
419 419
 			}
420
-			EEH_Line_Item::get_grand_total_and_recalculate_everything( $ticket_line_item );
420
+			EEH_Line_Item::get_grand_total_and_recalculate_everything($ticket_line_item);
421 421
 			return true;
422 422
 		}
423 423
 		return false;
@@ -435,12 +435,12 @@  discard block
 block discarded – undo
435 435
 	 * @return bool success
436 436
 	 * @throws \EE_Error
437 437
 	 */
438
-	public static function reinstate_canceled_ticket_line_item( EE_Line_Item $ticket_line_item, $qty = 1 ) {
438
+	public static function reinstate_canceled_ticket_line_item(EE_Line_Item $ticket_line_item, $qty = 1) {
439 439
 		// validate incoming line_item
440
-		if ( $ticket_line_item->OBJ_type() !== 'Ticket' ) {
440
+		if ($ticket_line_item->OBJ_type() !== 'Ticket') {
441 441
 			throw new EE_Error(
442 442
 				sprintf(
443
-					__( 'The supplied line item must have an Object Type of "Ticket", not %1$s.', 'event_espresso' ),
443
+					__('The supplied line item must have an Object Type of "Ticket", not %1$s.', 'event_espresso'),
444 444
 					$ticket_line_item->type()
445 445
 				)
446 446
 			);
@@ -450,42 +450,42 @@  discard block
 block discarded – undo
450 450
 			$ticket_line_item,
451 451
 			EEM_Line_Item::type_cancellation
452 452
 		);
453
-		$cancellation_line_item = reset( $cancellation_line_item );
453
+		$cancellation_line_item = reset($cancellation_line_item);
454 454
 		// verify that this ticket was indeed previously cancelled
455
-		if ( ! $cancellation_line_item instanceof EE_Line_Item ) {
455
+		if ( ! $cancellation_line_item instanceof EE_Line_Item) {
456 456
 			return false;
457 457
 		}
458
-		if ( $cancellation_line_item->quantity() > $qty ) {
458
+		if ($cancellation_line_item->quantity() > $qty) {
459 459
 			// decrement cancelled quantity
460
-			$cancellation_line_item->set_quantity( $cancellation_line_item->quantity() - $qty );
461
-		} else if ( $cancellation_line_item->quantity() == $qty ) {
460
+			$cancellation_line_item->set_quantity($cancellation_line_item->quantity() - $qty);
461
+		} else if ($cancellation_line_item->quantity() == $qty) {
462 462
 			// decrement cancelled quantity in case anyone still has the object kicking around
463
-			$cancellation_line_item->set_quantity( $cancellation_line_item->quantity() - $qty );
463
+			$cancellation_line_item->set_quantity($cancellation_line_item->quantity() - $qty);
464 464
 			// delete because quantity will end up as 0
465 465
 			$cancellation_line_item->delete();
466 466
 			// and attempt to destroy the object,
467 467
 			// even though PHP won't actually destroy it until it needs the memory
468
-			unset( $cancellation_line_item );
468
+			unset($cancellation_line_item);
469 469
 		} else {
470 470
 			// what ?!?! negative quantity ?!?!
471 471
 			throw new EE_Error(
472 472
 				sprintf(
473
-					__( 'Can not reinstate %1$d cancelled ticket(s) because the cancelled ticket quantity is only %2$d.',
474
-						'event_espresso' ),
473
+					__('Can not reinstate %1$d cancelled ticket(s) because the cancelled ticket quantity is only %2$d.',
474
+						'event_espresso'),
475 475
 					$qty,
476 476
 					$cancellation_line_item->quantity()
477 477
 				)
478 478
 			);
479 479
 		}
480 480
 		// increment ticket quantity
481
-		$ticket_line_item->set_quantity( $ticket_line_item->quantity() + $qty );
482
-		if ( $ticket_line_item->save_this_and_descendants() > 0 ) {
481
+		$ticket_line_item->set_quantity($ticket_line_item->quantity() + $qty);
482
+		if ($ticket_line_item->save_this_and_descendants() > 0) {
483 483
 			// increment parent line item quantity
484 484
 			$event_line_item = $ticket_line_item->parent();
485
-			if ( $event_line_item instanceof EE_Line_Item && $event_line_item->OBJ_type() === 'Event' ) {
486
-				$event_line_item->set_quantity( $event_line_item->quantity() + $qty );
485
+			if ($event_line_item instanceof EE_Line_Item && $event_line_item->OBJ_type() === 'Event') {
486
+				$event_line_item->set_quantity($event_line_item->quantity() + $qty);
487 487
 			}
488
-			EEH_Line_Item::get_grand_total_and_recalculate_everything( $ticket_line_item );
488
+			EEH_Line_Item::get_grand_total_and_recalculate_everything($ticket_line_item);
489 489
 			return true;
490 490
 		}
491 491
 		return false;
@@ -500,8 +500,8 @@  discard block
 block discarded – undo
500 500
 	 * @param EE_Line_Item $line_item
501 501
 	 * @return \EE_Line_Item
502 502
 	 */
503
-	public static function get_grand_total_and_recalculate_everything( EE_Line_Item $line_item ){
504
-		$grand_total_line_item = EEH_Line_Item::find_transaction_grand_total_for_line_item( $line_item );
503
+	public static function get_grand_total_and_recalculate_everything(EE_Line_Item $line_item) {
504
+		$grand_total_line_item = EEH_Line_Item::find_transaction_grand_total_for_line_item($line_item);
505 505
 		return $grand_total_line_item->recalculate_total_including_taxes();
506 506
 	}
507 507
 
@@ -514,11 +514,11 @@  discard block
 block discarded – undo
514 514
 	 * @return \EE_Line_Item
515 515
 	 * @throws \EE_Error
516 516
 	 */
517
-	public static function get_pre_tax_subtotal( EE_Line_Item $total_line_item ){
518
-		$pre_tax_subtotal = $total_line_item->get_child_line_item( 'pre-tax-subtotal' );
517
+	public static function get_pre_tax_subtotal(EE_Line_Item $total_line_item) {
518
+		$pre_tax_subtotal = $total_line_item->get_child_line_item('pre-tax-subtotal');
519 519
 		return $pre_tax_subtotal instanceof EE_Line_Item
520 520
 			? $pre_tax_subtotal
521
-			: self::create_pre_tax_subtotal( $total_line_item );
521
+			: self::create_pre_tax_subtotal($total_line_item);
522 522
 	}
523 523
 
524 524
 
@@ -530,9 +530,9 @@  discard block
 block discarded – undo
530 530
 	 * @return \EE_Line_Item
531 531
 	 * @throws \EE_Error
532 532
 	 */
533
-	public static function get_taxes_subtotal( EE_Line_Item $total_line_item ){
534
-		$taxes = $total_line_item->get_child_line_item( 'taxes' );
535
-		return $taxes ? $taxes : self::create_taxes_subtotal( $total_line_item );
533
+	public static function get_taxes_subtotal(EE_Line_Item $total_line_item) {
534
+		$taxes = $total_line_item->get_child_line_item('taxes');
535
+		return $taxes ? $taxes : self::create_taxes_subtotal($total_line_item);
536 536
 	}
537 537
 
538 538
 
@@ -545,12 +545,12 @@  discard block
 block discarded – undo
545 545
 	 * @return void
546 546
 	 * @throws \EE_Error
547 547
 	 */
548
-	public static function set_TXN_ID( EE_Line_Item $line_item, $transaction = NULL ){
549
-		if( $transaction ){
548
+	public static function set_TXN_ID(EE_Line_Item $line_item, $transaction = NULL) {
549
+		if ($transaction) {
550 550
 			/** @type EEM_Transaction $EEM_Transaction */
551
-			$EEM_Transaction = EE_Registry::instance()->load_model( 'Transaction' );
552
-			$TXN_ID = $EEM_Transaction->ensure_is_ID( $transaction );
553
-			$line_item->set_TXN_ID( $TXN_ID );
551
+			$EEM_Transaction = EE_Registry::instance()->load_model('Transaction');
552
+			$TXN_ID = $EEM_Transaction->ensure_is_ID($transaction);
553
+			$line_item->set_TXN_ID($TXN_ID);
554 554
 		}
555 555
 	}
556 556
 
@@ -565,8 +565,8 @@  discard block
 block discarded – undo
565 565
 	 * @return \EE_Line_Item of type total
566 566
 	 * @throws \EE_Error
567 567
 	 */
568
-	public static function create_total_line_item( $transaction = NULL ){
569
-		$total_line_item = EE_Line_Item::new_instance( array(
568
+	public static function create_total_line_item($transaction = NULL) {
569
+		$total_line_item = EE_Line_Item::new_instance(array(
570 570
 			'LIN_code'	=> 'total',
571 571
 			'LIN_name'	=> __('Grand Total', 'event_espresso'),
572 572
 			'LIN_type'	=> EEM_Line_Item::type_total,
@@ -576,9 +576,9 @@  discard block
 block discarded – undo
576 576
 			'FHEE__EEH_Line_Item__create_total_line_item__total_line_item',
577 577
 			$total_line_item
578 578
 		);
579
-		self::set_TXN_ID( $total_line_item, $transaction );
580
-		self::create_pre_tax_subtotal( $total_line_item, $transaction );
581
-		self::create_taxes_subtotal( $total_line_item, $transaction );
579
+		self::set_TXN_ID($total_line_item, $transaction);
580
+		self::create_pre_tax_subtotal($total_line_item, $transaction);
581
+		self::create_taxes_subtotal($total_line_item, $transaction);
582 582
 		return $total_line_item;
583 583
 	}
584 584
 
@@ -592,19 +592,19 @@  discard block
 block discarded – undo
592 592
 	 * @return EE_Line_Item
593 593
 	 * @throws \EE_Error
594 594
 	 */
595
-	protected static function create_pre_tax_subtotal( EE_Line_Item $total_line_item, $transaction = NULL ){
596
-		$pre_tax_line_item = EE_Line_Item::new_instance( array(
595
+	protected static function create_pre_tax_subtotal(EE_Line_Item $total_line_item, $transaction = NULL) {
596
+		$pre_tax_line_item = EE_Line_Item::new_instance(array(
597 597
 			'LIN_code' 	=> 'pre-tax-subtotal',
598
-			'LIN_name' 	=> __( 'Pre-Tax Subtotal', 'event_espresso' ),
598
+			'LIN_name' 	=> __('Pre-Tax Subtotal', 'event_espresso'),
599 599
 			'LIN_type' 	=> EEM_Line_Item::type_sub_total
600
-		) );
600
+		));
601 601
 		$pre_tax_line_item = apply_filters(
602 602
 			'FHEE__EEH_Line_Item__create_pre_tax_subtotal__pre_tax_line_item',
603 603
 			$pre_tax_line_item
604 604
 		);
605
-		self::set_TXN_ID( $pre_tax_line_item, $transaction );
606
-		$total_line_item->add_child_line_item( $pre_tax_line_item );
607
-		self::create_event_subtotal( $pre_tax_line_item, $transaction );
605
+		self::set_TXN_ID($pre_tax_line_item, $transaction);
606
+		$total_line_item->add_child_line_item($pre_tax_line_item);
607
+		self::create_event_subtotal($pre_tax_line_item, $transaction);
608 608
 		return $pre_tax_line_item;
609 609
 	}
610 610
 
@@ -619,21 +619,21 @@  discard block
 block discarded – undo
619 619
 	 * @return EE_Line_Item
620 620
 	 * @throws \EE_Error
621 621
 	 */
622
-	protected static function create_taxes_subtotal( EE_Line_Item $total_line_item, $transaction = NULL ){
622
+	protected static function create_taxes_subtotal(EE_Line_Item $total_line_item, $transaction = NULL) {
623 623
 		$tax_line_item = EE_Line_Item::new_instance(array(
624 624
 			'LIN_code'	=> 'taxes',
625 625
 			'LIN_name' 	=> __('Taxes', 'event_espresso'),
626 626
 			'LIN_type'	=> EEM_Line_Item::type_tax_sub_total,
627
-			'LIN_order' => 1000,//this should always come last
627
+			'LIN_order' => 1000, //this should always come last
628 628
 		));
629 629
 		$tax_line_item = apply_filters(
630 630
 			'FHEE__EEH_Line_Item__create_taxes_subtotal__tax_line_item',
631 631
 			$tax_line_item
632 632
 		);
633
-		self::set_TXN_ID( $tax_line_item, $transaction );
634
-		$total_line_item->add_child_line_item( $tax_line_item );
633
+		self::set_TXN_ID($tax_line_item, $transaction);
634
+		$total_line_item->add_child_line_item($tax_line_item);
635 635
 		//and lastly, add the actual taxes
636
-		self::apply_taxes( $total_line_item );
636
+		self::apply_taxes($total_line_item);
637 637
 		return $tax_line_item;
638 638
 	}
639 639
 
@@ -648,11 +648,11 @@  discard block
 block discarded – undo
648 648
 	 * @return EE_Line_Item
649 649
 	 * @throws \EE_Error
650 650
 	 */
651
-	public static function create_event_subtotal( EE_Line_Item $pre_tax_line_item, $transaction = NULL, $event = NULL ){
651
+	public static function create_event_subtotal(EE_Line_Item $pre_tax_line_item, $transaction = NULL, $event = NULL) {
652 652
 		$event_line_item = EE_Line_Item::new_instance(array(
653
-			'LIN_code'	=> self::get_event_code( $event ),
654
-			'LIN_name' 	=> self::get_event_name( $event ),
655
-			'LIN_desc' 	=> self::get_event_desc( $event ),
653
+			'LIN_code'	=> self::get_event_code($event),
654
+			'LIN_name' 	=> self::get_event_name($event),
655
+			'LIN_desc' 	=> self::get_event_desc($event),
656 656
 			'LIN_type'	=> EEM_Line_Item::type_sub_total,
657 657
 			'OBJ_type' 	=> 'Event',
658 658
 			'OBJ_ID' 		=>  $event instanceof EE_Event ? $event->ID() : 0
@@ -661,8 +661,8 @@  discard block
 block discarded – undo
661 661
 			'FHEE__EEH_Line_Item__create_event_subtotal__event_line_item',
662 662
 			$event_line_item
663 663
 		);
664
-		self::set_TXN_ID( $event_line_item, $transaction );
665
-		$pre_tax_line_item->add_child_line_item( $event_line_item );
664
+		self::set_TXN_ID($event_line_item, $transaction);
665
+		$pre_tax_line_item->add_child_line_item($event_line_item);
666 666
 		return $event_line_item;
667 667
 	}
668 668
 
@@ -675,8 +675,8 @@  discard block
 block discarded – undo
675 675
 	 * @return string
676 676
 	 * @throws \EE_Error
677 677
 	 */
678
-	public static function get_event_code( $event ) {
679
-		return 'event-' . ( $event instanceof EE_Event ? $event->ID() : '0' );
678
+	public static function get_event_code($event) {
679
+		return 'event-'.($event instanceof EE_Event ? $event->ID() : '0');
680 680
 	}
681 681
 
682 682
 	/**
@@ -684,8 +684,8 @@  discard block
 block discarded – undo
684 684
 	 * @param EE_Event $event
685 685
 	 * @return string
686 686
 	 */
687
-	public static function get_event_name( $event ) {
688
-		return $event instanceof EE_Event ? $event->name() : __( 'Event', 'event_espresso' );
687
+	public static function get_event_name($event) {
688
+		return $event instanceof EE_Event ? $event->name() : __('Event', 'event_espresso');
689 689
 	}
690 690
 
691 691
 	/**
@@ -693,7 +693,7 @@  discard block
 block discarded – undo
693 693
 	 * @param EE_Event $event
694 694
 	 * @return string
695 695
 	 */
696
-	public static function get_event_desc( $event ) {
696
+	public static function get_event_desc($event) {
697 697
 		return $event instanceof EE_Event ? $event->short_description() : '';
698 698
 	}
699 699
 
@@ -707,27 +707,27 @@  discard block
 block discarded – undo
707 707
 	  * @throws \EE_Error
708 708
 	  * @return EE_Line_Item
709 709
 	  */
710
-	public static function get_event_line_item_for_ticket( EE_Line_Item $grand_total, EE_Ticket $ticket ) {
710
+	public static function get_event_line_item_for_ticket(EE_Line_Item $grand_total, EE_Ticket $ticket) {
711 711
 		$first_datetime = $ticket->first_datetime();
712
-		if ( ! $first_datetime instanceof EE_Datetime ) {
712
+		if ( ! $first_datetime instanceof EE_Datetime) {
713 713
 			throw new EE_Error(
714
-				sprintf( __( 'The supplied ticket (ID %d) has no datetimes', 'event_espresso' ), $ticket->ID() )
714
+				sprintf(__('The supplied ticket (ID %d) has no datetimes', 'event_espresso'), $ticket->ID())
715 715
 			);
716 716
 		}
717 717
 		$event = $first_datetime->event();
718
-		if ( ! $event instanceof EE_Event ) {
718
+		if ( ! $event instanceof EE_Event) {
719 719
 			throw new EE_Error(
720 720
 				sprintf(
721
-					__( 'The supplied ticket (ID %d) has no event data associated with it.', 'event_espresso' ),
721
+					__('The supplied ticket (ID %d) has no event data associated with it.', 'event_espresso'),
722 722
 					$ticket->ID()
723 723
 				)
724 724
 			);
725 725
 		}
726
-		$events_sub_total = EEH_Line_Item::get_event_line_item( $grand_total, $event );
727
-		if ( ! $events_sub_total instanceof EE_Line_Item ) {
726
+		$events_sub_total = EEH_Line_Item::get_event_line_item($grand_total, $event);
727
+		if ( ! $events_sub_total instanceof EE_Line_Item) {
728 728
 			throw new EE_Error(
729 729
 				sprintf(
730
-					__( 'There is no events sub-total for ticket %s on total line item %d', 'event_espresso' ),
730
+					__('There is no events sub-total for ticket %s on total line item %d', 'event_espresso'),
731 731
 					$ticket->ID(),
732 732
 					$grand_total->ID()
733 733
 				)
@@ -746,31 +746,31 @@  discard block
 block discarded – undo
746 746
 	 * @return EE_Line_Item for the event subtotal which is a child of $grand_total
747 747
 	 * @throws \EE_Error
748 748
 	 */
749
-	public static function get_event_line_item( EE_Line_Item $grand_total, $event ) {
749
+	public static function get_event_line_item(EE_Line_Item $grand_total, $event) {
750 750
 		/** @type EE_Event $event */
751
-		$event = EEM_Event::instance()->ensure_is_obj( $event, true );
751
+		$event = EEM_Event::instance()->ensure_is_obj($event, true);
752 752
 		$event_line_item = NULL;
753 753
 		$found = false;
754
-		foreach ( EEH_Line_Item::get_event_subtotals( $grand_total ) as $event_line_item ) {
754
+		foreach (EEH_Line_Item::get_event_subtotals($grand_total) as $event_line_item) {
755 755
 			// default event subtotal, we should only ever find this the first time this method is called
756
-			if ( ! $event_line_item->OBJ_ID() ) {
756
+			if ( ! $event_line_item->OBJ_ID()) {
757 757
 				// let's use this! but first... set the event details
758
-				EEH_Line_Item::set_event_subtotal_details( $event_line_item, $event );
758
+				EEH_Line_Item::set_event_subtotal_details($event_line_item, $event);
759 759
 				$found = true;
760 760
 				break;
761
-			} else if ( $event_line_item->OBJ_ID() === $event->ID() ) {
761
+			} else if ($event_line_item->OBJ_ID() === $event->ID()) {
762 762
 				// found existing line item for this event in the cart, so break out of loop and use this one
763 763
 				$found = true;
764 764
 				break;
765 765
 			}
766 766
 		}
767
-		if ( ! $found ) {
767
+		if ( ! $found) {
768 768
 			//there is no event sub-total yet, so add it
769
-			$pre_tax_subtotal = EEH_Line_Item::get_pre_tax_subtotal( $grand_total );
769
+			$pre_tax_subtotal = EEH_Line_Item::get_pre_tax_subtotal($grand_total);
770 770
 			// create a new "event" subtotal below that
771
-			$event_line_item = EEH_Line_Item::create_event_subtotal( $pre_tax_subtotal, null, $event );
771
+			$event_line_item = EEH_Line_Item::create_event_subtotal($pre_tax_subtotal, null, $event);
772 772
 			// and set the event details
773
-			EEH_Line_Item::set_event_subtotal_details( $event_line_item, $event );
773
+			EEH_Line_Item::set_event_subtotal_details($event_line_item, $event);
774 774
 		}
775 775
 		return $event_line_item;
776 776
 	}
@@ -791,13 +791,13 @@  discard block
 block discarded – undo
791 791
 		EE_Event $event,
792 792
 		$transaction = null
793 793
 	) {
794
-		if ( $event instanceof EE_Event ) {
795
-			$event_line_item->set_code( self::get_event_code( $event ) );
796
-			$event_line_item->set_name( self::get_event_name( $event ) );
797
-			$event_line_item->set_desc( self::get_event_desc( $event ) );
798
-			$event_line_item->set_OBJ_ID( $event->ID() );
794
+		if ($event instanceof EE_Event) {
795
+			$event_line_item->set_code(self::get_event_code($event));
796
+			$event_line_item->set_name(self::get_event_name($event));
797
+			$event_line_item->set_desc(self::get_event_desc($event));
798
+			$event_line_item->set_OBJ_ID($event->ID());
799 799
 		}
800
-		self::set_TXN_ID( $event_line_item, $transaction );
800
+		self::set_TXN_ID($event_line_item, $transaction);
801 801
 	}
802 802
 
803 803
 
@@ -810,19 +810,19 @@  discard block
 block discarded – undo
810 810
 	 * @param EE_Line_Item $total_line_item of type EEM_Line_Item::type_total
811 811
 	 * @throws \EE_Error
812 812
 	 */
813
-	public static function apply_taxes( EE_Line_Item $total_line_item ){
813
+	public static function apply_taxes(EE_Line_Item $total_line_item) {
814 814
 		/** @type EEM_Price $EEM_Price */
815
-		$EEM_Price = EE_Registry::instance()->load_model( 'Price' );
815
+		$EEM_Price = EE_Registry::instance()->load_model('Price');
816 816
 		// get array of taxes via Price Model
817 817
 		$ordered_taxes = $EEM_Price->get_all_prices_that_are_taxes();
818
-		ksort( $ordered_taxes );
819
-		$taxes_line_item = self::get_taxes_subtotal( $total_line_item );
818
+		ksort($ordered_taxes);
819
+		$taxes_line_item = self::get_taxes_subtotal($total_line_item);
820 820
 		//just to be safe, remove its old tax line items
821 821
 		$taxes_line_item->delete_children_line_items();
822 822
 		//loop thru taxes
823
-		foreach ( $ordered_taxes as $order => $taxes ) {
824
-			foreach ( $taxes as $tax ) {
825
-				if ( $tax instanceof EE_Price ) {
823
+		foreach ($ordered_taxes as $order => $taxes) {
824
+			foreach ($taxes as $tax) {
825
+				if ($tax instanceof EE_Price) {
826 826
 					$tax_line_item = EE_Line_Item::new_instance(
827 827
 						array(
828 828
 							'LIN_name'       => $tax->name(),
@@ -840,7 +840,7 @@  discard block
 block discarded – undo
840 840
 						'FHEE__EEH_Line_Item__apply_taxes__tax_line_item',
841 841
 						$tax_line_item
842 842
 					);
843
-					$taxes_line_item->add_child_line_item( $tax_line_item );
843
+					$taxes_line_item->add_child_line_item($tax_line_item);
844 844
 				}
845 845
 			}
846 846
 		}
@@ -857,10 +857,10 @@  discard block
 block discarded – undo
857 857
 	 * @return float
858 858
 	 * @throws \EE_Error
859 859
 	 */
860
-	public static function ensure_taxes_applied( $total_line_item ){
861
-		$taxes_subtotal = self::get_taxes_subtotal( $total_line_item );
862
-		if( ! $taxes_subtotal->children()){
863
-			self::apply_taxes( $total_line_item );
860
+	public static function ensure_taxes_applied($total_line_item) {
861
+		$taxes_subtotal = self::get_taxes_subtotal($total_line_item);
862
+		if ( ! $taxes_subtotal->children()) {
863
+			self::apply_taxes($total_line_item);
864 864
 		}
865 865
 		return $taxes_subtotal->total();
866 866
 	}
@@ -874,16 +874,16 @@  discard block
 block discarded – undo
874 874
 	 * @return bool
875 875
 	 * @throws \EE_Error
876 876
 	 */
877
-	public static function delete_all_child_items( EE_Line_Item $parent_line_item ) {
877
+	public static function delete_all_child_items(EE_Line_Item $parent_line_item) {
878 878
 		$deleted = 0;
879
-		foreach ( $parent_line_item->children() as $child_line_item ) {
880
-			if ( $child_line_item instanceof EE_Line_Item ) {
881
-				$deleted += EEH_Line_Item::delete_all_child_items( $child_line_item );
882
-				if ( $child_line_item->ID() ) {
879
+		foreach ($parent_line_item->children() as $child_line_item) {
880
+			if ($child_line_item instanceof EE_Line_Item) {
881
+				$deleted += EEH_Line_Item::delete_all_child_items($child_line_item);
882
+				if ($child_line_item->ID()) {
883 883
 					$child_line_item->delete();
884
-					unset( $child_line_item );
884
+					unset($child_line_item);
885 885
 				} else {
886
-					$parent_line_item->delete_child_line_item( $child_line_item->code() );
886
+					$parent_line_item->delete_child_line_item($child_line_item->code());
887 887
 				}
888 888
 				$deleted++;
889 889
 			}
@@ -905,9 +905,9 @@  discard block
 block discarded – undo
905 905
 	 * @param array|bool|string $line_item_codes
906 906
 	 * @return int number of items successfully removed
907 907
 	 */
908
-	public static function delete_items( EE_Line_Item $total_line_item, $line_item_codes = FALSE ) {
908
+	public static function delete_items(EE_Line_Item $total_line_item, $line_item_codes = FALSE) {
909 909
 
910
-		if( $total_line_item->type() !== EEM_Line_Item::type_total ){
910
+		if ($total_line_item->type() !== EEM_Line_Item::type_total) {
911 911
 			EE_Error::doing_it_wrong(
912 912
 				'EEH_Line_Item::delete_items',
913 913
 				__(
@@ -917,20 +917,20 @@  discard block
 block discarded – undo
917 917
 				'4.6.18'
918 918
 			);
919 919
 		}
920
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
920
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
921 921
 
922 922
 		// check if only a single line_item_id was passed
923
-		if ( ! empty( $line_item_codes ) && ! is_array( $line_item_codes )) {
923
+		if ( ! empty($line_item_codes) && ! is_array($line_item_codes)) {
924 924
 			// place single line_item_id in an array to appear as multiple line_item_ids
925
-			$line_item_codes = array ( $line_item_codes );
925
+			$line_item_codes = array($line_item_codes);
926 926
 		}
927 927
 		$removals = 0;
928 928
 		// cycle thru line_item_ids
929
-		foreach ( $line_item_codes as $line_item_id ) {
929
+		foreach ($line_item_codes as $line_item_id) {
930 930
 			$removals += $total_line_item->delete_child_line_item($line_item_id);
931 931
 		}
932 932
 
933
-		if ( $removals > 0 ) {
933
+		if ($removals > 0) {
934 934
 			$total_line_item->recalculate_taxes_and_tax_total();
935 935
 			return $removals;
936 936
 		} else {
@@ -963,33 +963,33 @@  discard block
 block discarded – undo
963 963
 		$code = null,
964 964
 		$add_to_existing_line_item = false
965 965
 	) {
966
-		$tax_subtotal = self::get_taxes_subtotal( $total_line_item );
966
+		$tax_subtotal = self::get_taxes_subtotal($total_line_item);
967 967
             $taxable_total = $total_line_item->taxable_total();
968 968
 
969
-            if( $add_to_existing_line_item ) {
970
-                $new_tax = $tax_subtotal->get_child_line_item( $code );
969
+            if ($add_to_existing_line_item) {
970
+                $new_tax = $tax_subtotal->get_child_line_item($code);
971 971
 	            EEM_Line_Item::instance()->delete(
972
-		            array( array( 'LIN_code' => array( '!=', $code ), 'LIN_parent' => $tax_subtotal->ID() ) )
972
+		            array(array('LIN_code' => array('!=', $code), 'LIN_parent' => $tax_subtotal->ID()))
973 973
 	            );
974 974
             } else {
975 975
                 $new_tax = null;
976 976
                 $tax_subtotal->delete_children_line_items();
977 977
             }
978
-            if( $new_tax ) {
979
-                $new_tax->set_total( $new_tax->total() + $amount );
980
-                $new_tax->set_percent( $taxable_total ? $new_tax->total() / $taxable_total * 100 : 0 );
978
+            if ($new_tax) {
979
+                $new_tax->set_total($new_tax->total() + $amount);
980
+                $new_tax->set_percent($taxable_total ? $new_tax->total() / $taxable_total * 100 : 0);
981 981
             } else {
982 982
                 //no existing tax item. Create it
983
-				$new_tax = EE_Line_Item::new_instance( array(
983
+				$new_tax = EE_Line_Item::new_instance(array(
984 984
 					'TXN_ID'      => $total_line_item->TXN_ID(),
985
-					'LIN_name'    => $name ? $name : __( 'Tax', 'event_espresso' ),
985
+					'LIN_name'    => $name ? $name : __('Tax', 'event_espresso'),
986 986
 					'LIN_desc'    => $description ? $description : '',
987
-					'LIN_percent' => $taxable_total ? ( $amount / $taxable_total * 100 ) : 0,
987
+					'LIN_percent' => $taxable_total ? ($amount / $taxable_total * 100) : 0,
988 988
 					'LIN_total'   => $amount,
989 989
 					'LIN_parent'  => $tax_subtotal->ID(),
990 990
 					'LIN_type'    => EEM_Line_Item::type_tax,
991 991
 					'LIN_code'    => $code
992
-				) );
992
+				));
993 993
 			}
994 994
 
995 995
             $new_tax = apply_filters(
@@ -998,7 +998,7 @@  discard block
 block discarded – undo
998 998
 				$total_line_item
999 999
             );
1000 1000
             $new_tax->save();
1001
-            $tax_subtotal->set_total( $new_tax->total() );
1001
+            $tax_subtotal->set_total($new_tax->total());
1002 1002
             $tax_subtotal->save();
1003 1003
             $total_line_item->recalculate_total_including_taxes();
1004 1004
             return $new_tax;
@@ -1020,14 +1020,14 @@  discard block
 block discarded – undo
1020 1020
 		$code_substring_for_whitelist = null
1021 1021
 	) {
1022 1022
 		$whitelisted = false;
1023
-		if( $code_substring_for_whitelist !== null ) {
1024
-			$whitelisted = strpos( $line_item->code(), $code_substring_for_whitelist ) !== false ? true : false;
1023
+		if ($code_substring_for_whitelist !== null) {
1024
+			$whitelisted = strpos($line_item->code(), $code_substring_for_whitelist) !== false ? true : false;
1025 1025
 		}
1026
-		if( ! $whitelisted && $line_item->is_line_item() ) {
1027
-			$line_item->set_is_taxable( $taxable );
1026
+		if ( ! $whitelisted && $line_item->is_line_item()) {
1027
+			$line_item->set_is_taxable($taxable);
1028 1028
 		}
1029
-		foreach( $line_item->children() as $child_line_item ) {
1030
-			EEH_Line_Item::set_line_items_taxable( $child_line_item, $taxable, $code_substring_for_whitelist );
1029
+		foreach ($line_item->children() as $child_line_item) {
1030
+			EEH_Line_Item::set_line_items_taxable($child_line_item, $taxable, $code_substring_for_whitelist);
1031 1031
 		}
1032 1032
 	}
1033 1033
 
@@ -1040,8 +1040,8 @@  discard block
 block discarded – undo
1040 1040
 	 * @param \EE_Line_Item $parent_line_item - the line item to find descendants of
1041 1041
 	 * @return EE_Line_Item[]
1042 1042
 	 */
1043
-	public static function get_event_subtotals( EE_Line_Item $parent_line_item ) {
1044
-		return self::get_subtotals_of_object_type( $parent_line_item, 'Event' );
1043
+	public static function get_event_subtotals(EE_Line_Item $parent_line_item) {
1044
+		return self::get_subtotals_of_object_type($parent_line_item, 'Event');
1045 1045
 	}
1046 1046
 
1047 1047
 
@@ -1054,7 +1054,7 @@  discard block
 block discarded – undo
1054 1054
 	 * @param string $obj_type
1055 1055
 	 * @return EE_Line_Item[]
1056 1056
 	 */
1057
-	public static function get_subtotals_of_object_type( EE_Line_Item $parent_line_item, $obj_type = '' ) {
1057
+	public static function get_subtotals_of_object_type(EE_Line_Item $parent_line_item, $obj_type = '') {
1058 1058
 		return self::_get_descendants_by_type_and_object_type(
1059 1059
 			$parent_line_item,
1060 1060
 			EEM_Line_Item::type_sub_total,
@@ -1071,8 +1071,8 @@  discard block
 block discarded – undo
1071 1071
 	 * @param \EE_Line_Item $parent_line_item - the line item to find descendants of
1072 1072
 	 * @return EE_Line_Item[]
1073 1073
 	 */
1074
-	public static function get_ticket_line_items( EE_Line_Item $parent_line_item ) {
1075
-		return self::get_line_items_of_object_type( $parent_line_item, 'Ticket' );
1074
+	public static function get_ticket_line_items(EE_Line_Item $parent_line_item) {
1075
+		return self::get_line_items_of_object_type($parent_line_item, 'Ticket');
1076 1076
 	}
1077 1077
 
1078 1078
 
@@ -1085,8 +1085,8 @@  discard block
 block discarded – undo
1085 1085
 	 * @param string $obj_type
1086 1086
 	 * @return EE_Line_Item[]
1087 1087
 	 */
1088
-	public static function get_line_items_of_object_type( EE_Line_Item $parent_line_item, $obj_type = '' ) {
1089
-		return self::_get_descendants_by_type_and_object_type( $parent_line_item, EEM_Line_Item::type_line_item, $obj_type );
1088
+	public static function get_line_items_of_object_type(EE_Line_Item $parent_line_item, $obj_type = '') {
1089
+		return self::_get_descendants_by_type_and_object_type($parent_line_item, EEM_Line_Item::type_line_item, $obj_type);
1090 1090
 	}
1091 1091
 
1092 1092
 
@@ -1097,8 +1097,8 @@  discard block
 block discarded – undo
1097 1097
 	 * @param \EE_Line_Item $parent_line_item - the line item to find descendants of
1098 1098
 	 * @return EE_Line_Item[]
1099 1099
 	 */
1100
-	public static function get_tax_descendants( EE_Line_Item $parent_line_item ) {
1101
-		return EEH_Line_Item::get_descendants_of_type( $parent_line_item, EEM_Line_Item::type_tax );
1100
+	public static function get_tax_descendants(EE_Line_Item $parent_line_item) {
1101
+		return EEH_Line_Item::get_descendants_of_type($parent_line_item, EEM_Line_Item::type_tax);
1102 1102
 	}
1103 1103
 
1104 1104
 
@@ -1109,8 +1109,8 @@  discard block
 block discarded – undo
1109 1109
 	 * @param \EE_Line_Item $parent_line_item - the line item to find descendants of
1110 1110
 	 * @return EE_Line_Item[]
1111 1111
 	 */
1112
-	public static function get_line_item_descendants( EE_Line_Item $parent_line_item ) {
1113
-		return EEH_Line_Item::get_descendants_of_type( $parent_line_item, EEM_Line_Item::type_line_item );
1112
+	public static function get_line_item_descendants(EE_Line_Item $parent_line_item) {
1113
+		return EEH_Line_Item::get_descendants_of_type($parent_line_item, EEM_Line_Item::type_line_item);
1114 1114
 	}
1115 1115
 
1116 1116
 
@@ -1123,8 +1123,8 @@  discard block
 block discarded – undo
1123 1123
 	 * @param string $line_item_type one of the EEM_Line_Item constants
1124 1124
 	 * @return EE_Line_Item[]
1125 1125
 	 */
1126
-	public static function get_descendants_of_type( EE_Line_Item $parent_line_item, $line_item_type ) {
1127
-		return self::_get_descendants_by_type_and_object_type( $parent_line_item, $line_item_type, NULL );
1126
+	public static function get_descendants_of_type(EE_Line_Item $parent_line_item, $line_item_type) {
1127
+		return self::_get_descendants_by_type_and_object_type($parent_line_item, $line_item_type, NULL);
1128 1128
 	}
1129 1129
 
1130 1130
 
@@ -1143,8 +1143,8 @@  discard block
 block discarded – undo
1143 1143
 		$obj_type = null
1144 1144
 	) {
1145 1145
 		$objects = array();
1146
-		foreach ( $parent_line_item->children() as $child_line_item ) {
1147
-			if ( $child_line_item instanceof EE_Line_Item ) {
1146
+		foreach ($parent_line_item->children() as $child_line_item) {
1147
+			if ($child_line_item instanceof EE_Line_Item) {
1148 1148
 				if (
1149 1149
 					$child_line_item->type() === $line_item_type
1150 1150
 				    && (
@@ -1184,7 +1184,7 @@  discard block
 block discarded – undo
1184 1184
 		$OBJ_type = '',
1185 1185
 		$OBJ_IDs = array()
1186 1186
 	) {
1187
-		return self::_get_descendants_by_object_type_and_object_ID( $parent_line_item, $OBJ_type, $OBJ_IDs );
1187
+		return self::_get_descendants_by_object_type_and_object_ID($parent_line_item, $OBJ_type, $OBJ_IDs);
1188 1188
 	}
1189 1189
 
1190 1190
 
@@ -1203,12 +1203,12 @@  discard block
 block discarded – undo
1203 1203
 		$OBJ_IDs
1204 1204
 	) {
1205 1205
 		$objects = array();
1206
-		foreach ( $parent_line_item->children() as $child_line_item ) {
1207
-			if ( $child_line_item instanceof EE_Line_Item ) {
1206
+		foreach ($parent_line_item->children() as $child_line_item) {
1207
+			if ($child_line_item instanceof EE_Line_Item) {
1208 1208
 				if (
1209 1209
 					$child_line_item->OBJ_type() === $OBJ_type
1210
-					&& is_array( $OBJ_IDs )
1211
-					&& in_array( $child_line_item->OBJ_ID(), $OBJ_IDs )
1210
+					&& is_array($OBJ_IDs)
1211
+					&& in_array($child_line_item->OBJ_ID(), $OBJ_IDs)
1212 1212
 				) {
1213 1213
 					$objects[] = $child_line_item;
1214 1214
 				} else {
@@ -1238,8 +1238,8 @@  discard block
 block discarded – undo
1238 1238
 	 * @param string $type like one of the EEM_Line_Item::type_*
1239 1239
 	 * @return EE_Line_Item
1240 1240
 	 */
1241
-	public static function get_nearest_descendant_of_type( EE_Line_Item $parent_line_item, $type ) {
1242
-		return self::_get_nearest_descendant( $parent_line_item, 'LIN_type' , $type );
1241
+	public static function get_nearest_descendant_of_type(EE_Line_Item $parent_line_item, $type) {
1242
+		return self::_get_nearest_descendant($parent_line_item, 'LIN_type', $type);
1243 1243
 	}
1244 1244
 
1245 1245
 
@@ -1253,8 +1253,8 @@  discard block
 block discarded – undo
1253 1253
 	 * @param string $code any value used for LIN_code
1254 1254
 	 * @return EE_Line_Item
1255 1255
 	 */
1256
-	public static function get_nearest_descendant_having_code( EE_Line_Item $parent_line_item, $code ) {
1257
-		return self::_get_nearest_descendant( $parent_line_item, 'LIN_code' , $code );
1256
+	public static function get_nearest_descendant_having_code(EE_Line_Item $parent_line_item, $code) {
1257
+		return self::_get_nearest_descendant($parent_line_item, 'LIN_code', $code);
1258 1258
 	}
1259 1259
 
1260 1260
 
@@ -1268,15 +1268,15 @@  discard block
 block discarded – undo
1268 1268
 	 * @param string $value any value stored in $search_field
1269 1269
 	 * @return EE_Line_Item
1270 1270
 	 */
1271
-	protected static function _get_nearest_descendant( EE_Line_Item $parent_line_item, $search_field, $value ) {
1272
-		foreach( $parent_line_item->children() as $child ){
1273
-			if ( $child->get( $search_field ) == $value ){
1271
+	protected static function _get_nearest_descendant(EE_Line_Item $parent_line_item, $search_field, $value) {
1272
+		foreach ($parent_line_item->children() as $child) {
1273
+			if ($child->get($search_field) == $value) {
1274 1274
 				return $child;
1275 1275
 			}
1276 1276
 		}
1277
-		foreach( $parent_line_item->children() as $child ){
1278
-			$descendant_found = self::_get_nearest_descendant( $child, $search_field, $value );
1279
-			if ( $descendant_found ){
1277
+		foreach ($parent_line_item->children() as $child) {
1278
+			$descendant_found = self::_get_nearest_descendant($child, $search_field, $value);
1279
+			if ($descendant_found) {
1280 1280
 				return $descendant_found;
1281 1281
 			}
1282 1282
 		}
@@ -1293,24 +1293,24 @@  discard block
 block discarded – undo
1293 1293
 	 * @return \EE_Line_Item
1294 1294
 	 * @throws \EE_Error
1295 1295
 	 */
1296
-	public static function find_transaction_grand_total_for_line_item( EE_Line_Item $line_item ){
1297
-		if ( $line_item->TXN_ID() ) {
1298
-			$total_line_item = $line_item->transaction()->total_line_item( false );
1299
-			if ( $total_line_item instanceof EE_Line_Item ) {
1296
+	public static function find_transaction_grand_total_for_line_item(EE_Line_Item $line_item) {
1297
+		if ($line_item->TXN_ID()) {
1298
+			$total_line_item = $line_item->transaction()->total_line_item(false);
1299
+			if ($total_line_item instanceof EE_Line_Item) {
1300 1300
 				return $total_line_item;
1301 1301
 			}
1302 1302
 		} else {
1303 1303
 			$line_item_parent = $line_item->parent();
1304
-			if ( $line_item_parent instanceof EE_Line_Item ) {
1305
-				if ( $line_item_parent->is_total() ) {
1304
+			if ($line_item_parent instanceof EE_Line_Item) {
1305
+				if ($line_item_parent->is_total()) {
1306 1306
 					return $line_item_parent;
1307 1307
 				}
1308
-				return EEH_Line_Item::find_transaction_grand_total_for_line_item( $line_item_parent );
1308
+				return EEH_Line_Item::find_transaction_grand_total_for_line_item($line_item_parent);
1309 1309
 			}
1310 1310
 		}
1311 1311
 		throw new EE_Error(
1312 1312
 			sprintf(
1313
-				__( 'A valid grand total for line item %1$d was not found.', 'event_espresso' ),
1313
+				__('A valid grand total for line item %1$d was not found.', 'event_espresso'),
1314 1314
 				$line_item->ID()
1315 1315
 			)
1316 1316
 		);
@@ -1327,31 +1327,31 @@  discard block
 block discarded – undo
1327 1327
 	 * @return void
1328 1328
 	 * @throws \EE_Error
1329 1329
 	 */
1330
-	public static function visualize( EE_Line_Item $line_item, $indentation = 0 ){
1330
+	public static function visualize(EE_Line_Item $line_item, $indentation = 0) {
1331 1331
 		echo defined('EE_TESTS_DIR') ? "\n" : '<br />';
1332
-		if ( ! $indentation ) {
1333
-			echo defined( 'EE_TESTS_DIR' ) ? "\n" : '<br />';
1332
+		if ( ! $indentation) {
1333
+			echo defined('EE_TESTS_DIR') ? "\n" : '<br />';
1334 1334
 		}
1335
-		for( $i = 0; $i < $indentation; $i++ ){
1335
+		for ($i = 0; $i < $indentation; $i++) {
1336 1336
 			echo ". ";
1337 1337
 		}
1338 1338
 		$breakdown = '';
1339
-		if ( $line_item->is_line_item()){
1340
-			if ( $line_item->is_percent() ) {
1339
+		if ($line_item->is_line_item()) {
1340
+			if ($line_item->is_percent()) {
1341 1341
 				$breakdown = "{$line_item->percent()}%";
1342 1342
 			} else {
1343
-				$breakdown = '$' . "{$line_item->unit_price()} x {$line_item->quantity()}";
1343
+				$breakdown = '$'."{$line_item->unit_price()} x {$line_item->quantity()}";
1344 1344
 			}
1345 1345
 		}
1346
-		echo $line_item->name() . " [ ID:{$line_item->ID()} | qty:{$line_item->quantity()} ] {$line_item->type()} : " . '$' . "{$line_item->total()}";
1347
-		if ( $breakdown ) {
1346
+		echo $line_item->name()." [ ID:{$line_item->ID()} | qty:{$line_item->quantity()} ] {$line_item->type()} : ".'$'."{$line_item->total()}";
1347
+		if ($breakdown) {
1348 1348
 			echo " ( {$breakdown} )";
1349 1349
 		}
1350
-		if( $line_item->is_taxable() ){
1350
+		if ($line_item->is_taxable()) {
1351 1351
 			echo "  * taxable";
1352 1352
 		}
1353
-		if( $line_item->children() ){
1354
-			foreach($line_item->children() as $child){
1353
+		if ($line_item->children()) {
1354
+			foreach ($line_item->children() as $child) {
1355 1355
 				self::visualize($child, $indentation + 1);
1356 1356
 			}
1357 1357
 		}
@@ -1392,97 +1392,97 @@  discard block
 block discarded – undo
1392 1392
 	 *                                          is theirs, which can be done with
1393 1393
 	 *                                          `EEM_Line_Item::instance()->get_line_item_for_registration( $registration );`
1394 1394
 	 */
1395
-	public static function calculate_reg_final_prices_per_line_item( EE_Line_Item $line_item, $billable_ticket_quantities = array() ) {
1395
+	public static function calculate_reg_final_prices_per_line_item(EE_Line_Item $line_item, $billable_ticket_quantities = array()) {
1396 1396
 		//init running grand total if not already
1397
-		if ( ! isset( $running_totals[ 'total' ] ) ) {
1398
-			$running_totals[ 'total' ] = 0;
1397
+		if ( ! isset($running_totals['total'])) {
1398
+			$running_totals['total'] = 0;
1399 1399
 		}
1400
-		if( ! isset( $running_totals[ 'taxable' ] ) ) {
1401
-			$running_totals[ 'taxable' ] = array( 'total' => 0 );
1400
+		if ( ! isset($running_totals['taxable'])) {
1401
+			$running_totals['taxable'] = array('total' => 0);
1402 1402
 		}
1403
-		foreach ( $line_item->children() as $child_line_item ) {
1404
-			switch ( $child_line_item->type() ) {
1403
+		foreach ($line_item->children() as $child_line_item) {
1404
+			switch ($child_line_item->type()) {
1405 1405
 
1406 1406
 				case EEM_Line_Item::type_sub_total :
1407
-					$running_totals_from_subtotal = EEH_Line_Item::calculate_reg_final_prices_per_line_item( $child_line_item, $billable_ticket_quantities );
1407
+					$running_totals_from_subtotal = EEH_Line_Item::calculate_reg_final_prices_per_line_item($child_line_item, $billable_ticket_quantities);
1408 1408
 					//combine arrays but preserve numeric keys
1409
-					$running_totals = array_replace_recursive( $running_totals_from_subtotal, $running_totals );
1410
-					$running_totals[ 'total' ] += $running_totals_from_subtotal[ 'total' ];
1411
-					$running_totals[ 'taxable'][ 'total' ] += $running_totals_from_subtotal[ 'taxable' ][ 'total' ];
1409
+					$running_totals = array_replace_recursive($running_totals_from_subtotal, $running_totals);
1410
+					$running_totals['total'] += $running_totals_from_subtotal['total'];
1411
+					$running_totals['taxable']['total'] += $running_totals_from_subtotal['taxable']['total'];
1412 1412
 					break;
1413 1413
 
1414 1414
 				case EEM_Line_Item::type_tax_sub_total :
1415 1415
 
1416 1416
 					//find how much the taxes percentage is
1417
-					if ( $child_line_item->percent() !== 0 ) {
1417
+					if ($child_line_item->percent() !== 0) {
1418 1418
 						$tax_percent_decimal = $child_line_item->percent() / 100;
1419 1419
 					} else {
1420 1420
 						$tax_percent_decimal = EE_Taxes::get_total_taxes_percentage() / 100;
1421 1421
 					}
1422 1422
 					//and apply to all the taxable totals, and add to the pretax totals
1423
-					foreach ( $running_totals as $line_item_id => $this_running_total ) {
1423
+					foreach ($running_totals as $line_item_id => $this_running_total) {
1424 1424
 						//"total" and "taxable" array key is an exception
1425
-						if ( $line_item_id === 'taxable' ) {
1425
+						if ($line_item_id === 'taxable') {
1426 1426
 							continue;
1427 1427
 						}
1428
-						$taxable_total = $running_totals[ 'taxable' ][ $line_item_id ];
1429
-						$running_totals[ $line_item_id ] += ( $taxable_total * $tax_percent_decimal );
1428
+						$taxable_total = $running_totals['taxable'][$line_item_id];
1429
+						$running_totals[$line_item_id] += ($taxable_total * $tax_percent_decimal);
1430 1430
 					}
1431 1431
 					break;
1432 1432
 
1433 1433
 				case EEM_Line_Item::type_line_item :
1434 1434
 
1435 1435
 					// ticket line items or ????
1436
-					if ( $child_line_item->OBJ_type() === 'Ticket' ) {
1436
+					if ($child_line_item->OBJ_type() === 'Ticket') {
1437 1437
 						// kk it's a ticket
1438
-						if ( isset( $running_totals[ $child_line_item->ID() ] ) ) {
1438
+						if (isset($running_totals[$child_line_item->ID()])) {
1439 1439
 							//huh? that shouldn't happen.
1440
-							$running_totals[ 'total' ] += $child_line_item->total();
1440
+							$running_totals['total'] += $child_line_item->total();
1441 1441
 						} else {
1442 1442
 							//its not in our running totals yet. great.
1443
-							if ( $child_line_item->is_taxable() ) {
1443
+							if ($child_line_item->is_taxable()) {
1444 1444
 								$taxable_amount = $child_line_item->unit_price();
1445 1445
 							} else {
1446 1446
 								$taxable_amount = 0;
1447 1447
 							}
1448 1448
 							// are we only calculating totals for some tickets?
1449
-							if ( isset( $billable_ticket_quantities[ $child_line_item->OBJ_ID() ] ) ) {
1450
-								$quantity = $billable_ticket_quantities[ $child_line_item->OBJ_ID() ];
1451
-								$running_totals[ $child_line_item->ID() ] = $quantity
1449
+							if (isset($billable_ticket_quantities[$child_line_item->OBJ_ID()])) {
1450
+								$quantity = $billable_ticket_quantities[$child_line_item->OBJ_ID()];
1451
+								$running_totals[$child_line_item->ID()] = $quantity
1452 1452
 									? $child_line_item->unit_price()
1453 1453
 									: 0;
1454
-								$running_totals[ 'taxable' ][ $child_line_item->ID() ] = $quantity
1454
+								$running_totals['taxable'][$child_line_item->ID()] = $quantity
1455 1455
 									? $taxable_amount
1456 1456
 									: 0;
1457 1457
 							} else {
1458 1458
 								$quantity = $child_line_item->quantity();
1459
-								$running_totals[ $child_line_item->ID() ] = $child_line_item->unit_price();
1460
-								$running_totals[ 'taxable' ][ $child_line_item->ID() ] = $taxable_amount;
1459
+								$running_totals[$child_line_item->ID()] = $child_line_item->unit_price();
1460
+								$running_totals['taxable'][$child_line_item->ID()] = $taxable_amount;
1461 1461
 							}
1462
-							$running_totals[ 'taxable' ][ 'total' ] += $taxable_amount * $quantity;
1463
-							$running_totals[ 'total' ] += $child_line_item->unit_price() * $quantity;
1462
+							$running_totals['taxable']['total'] += $taxable_amount * $quantity;
1463
+							$running_totals['total'] += $child_line_item->unit_price() * $quantity;
1464 1464
 						}
1465 1465
 					} else {
1466 1466
 						// it's some other type of item added to the cart
1467 1467
 						// it should affect the running totals
1468 1468
 						// basically we want to convert it into a PERCENT modifier. Because
1469 1469
 						// more clearly affect all registration's final price equally
1470
-						$line_items_percent_of_running_total = $running_totals[ 'total' ] > 0
1471
-							? ( $child_line_item->total() / $running_totals[ 'total' ] ) + 1
1470
+						$line_items_percent_of_running_total = $running_totals['total'] > 0
1471
+							? ($child_line_item->total() / $running_totals['total']) + 1
1472 1472
 							: 1;
1473
-						foreach ( $running_totals as $line_item_id => $this_running_total ) {
1473
+						foreach ($running_totals as $line_item_id => $this_running_total) {
1474 1474
 							//the "taxable" array key is an exception
1475
-							if ( $line_item_id === 'taxable' ) {
1475
+							if ($line_item_id === 'taxable') {
1476 1476
 								continue;
1477 1477
 							}
1478 1478
 							// update the running totals
1479 1479
 							// yes this actually even works for the running grand total!
1480
-							$running_totals[ $line_item_id ] =
1480
+							$running_totals[$line_item_id] =
1481 1481
 								$line_items_percent_of_running_total * $this_running_total;
1482 1482
 
1483
-							if ( $child_line_item->is_taxable() ) {
1484
-								$running_totals[ 'taxable' ][ $line_item_id ] =
1485
-									$line_items_percent_of_running_total * $running_totals[ 'taxable' ][ $line_item_id ];
1483
+							if ($child_line_item->is_taxable()) {
1484
+								$running_totals['taxable'][$line_item_id] =
1485
+									$line_items_percent_of_running_total * $running_totals['taxable'][$line_item_id];
1486 1486
 							}
1487 1487
 						}
1488 1488
 					}
@@ -1500,16 +1500,16 @@  discard block
 block discarded – undo
1500 1500
 	 * @return float | null
1501 1501
 	 * @throws \OutOfRangeException
1502 1502
 	 */
1503
-	public static function calculate_final_price_for_ticket_line_item( \EE_Line_Item $total_line_item, \EE_Line_Item $ticket_line_item ) {
1503
+	public static function calculate_final_price_for_ticket_line_item(\EE_Line_Item $total_line_item, \EE_Line_Item $ticket_line_item) {
1504 1504
 		static $final_prices_per_ticket_line_item = array();
1505
-		if ( empty( $final_prices_per_ticket_line_item ) ) {
1505
+		if (empty($final_prices_per_ticket_line_item)) {
1506 1506
 			$final_prices_per_ticket_line_item = \EEH_Line_Item::calculate_reg_final_prices_per_line_item(
1507 1507
 				$total_line_item
1508 1508
 			);
1509 1509
 		}
1510 1510
 		//ok now find this new registration's final price
1511
-		if ( isset( $final_prices_per_ticket_line_item[ $ticket_line_item->ID() ] ) ) {
1512
-			return $final_prices_per_ticket_line_item[ $ticket_line_item->ID() ];
1511
+		if (isset($final_prices_per_ticket_line_item[$ticket_line_item->ID()])) {
1512
+			return $final_prices_per_ticket_line_item[$ticket_line_item->ID()];
1513 1513
 		}
1514 1514
 		$message = sprintf(
1515 1515
 			__(
@@ -1518,10 +1518,10 @@  discard block
 block discarded – undo
1518 1518
 			),
1519 1519
 			$ticket_line_item->ID()
1520 1520
 		);
1521
-		if ( WP_DEBUG ) {
1522
-			throw new \OutOfRangeException( $message );
1521
+		if (WP_DEBUG) {
1522
+			throw new \OutOfRangeException($message);
1523 1523
 		} else {
1524
-			EE_Log::instance()->log( __CLASS__, __FUNCTION__, $message );
1524
+			EE_Log::instance()->log(__CLASS__, __FUNCTION__, $message);
1525 1525
 		}
1526 1526
 		return null;
1527 1527
 	}
@@ -1537,15 +1537,15 @@  discard block
 block discarded – undo
1537 1537
 	 * @return \EE_Line_Item
1538 1538
 	 * @throws \EE_Error
1539 1539
 	 */
1540
-	public static function billable_line_item_tree( EE_Line_Item $line_item, $registrations ) {
1541
-		$copy_li = EEH_Line_Item::billable_line_item( $line_item, $registrations );
1542
-		foreach ( $line_item->children() as $child_li ) {
1543
-			$copy_li->add_child_line_item( EEH_Line_Item::billable_line_item_tree( $child_li, $registrations ) );
1540
+	public static function billable_line_item_tree(EE_Line_Item $line_item, $registrations) {
1541
+		$copy_li = EEH_Line_Item::billable_line_item($line_item, $registrations);
1542
+		foreach ($line_item->children() as $child_li) {
1543
+			$copy_li->add_child_line_item(EEH_Line_Item::billable_line_item_tree($child_li, $registrations));
1544 1544
 		}
1545 1545
 		//if this is the grand total line item, make sure the totals all add up
1546 1546
 		//(we could have duplicated this logic AS we copied the line items, but
1547 1547
 		//it seems DRYer this way)
1548
-		if ( $copy_li->type() === EEM_Line_Item::type_total ) {
1548
+		if ($copy_li->type() === EEM_Line_Item::type_total) {
1549 1549
 			$copy_li->recalculate_total_including_taxes();
1550 1550
 		}
1551 1551
 		return $copy_li;
@@ -1562,24 +1562,24 @@  discard block
 block discarded – undo
1562 1562
 	 * @throws \EE_Error
1563 1563
 	 * @param EE_Registration[] $registrations
1564 1564
 	 */
1565
-	public static function billable_line_item( EE_Line_Item $line_item, $registrations ) {
1565
+	public static function billable_line_item(EE_Line_Item $line_item, $registrations) {
1566 1566
 		$new_li_fields = $line_item->model_field_array();
1567
-		if ( $line_item->type() === EEM_Line_Item::type_line_item &&
1567
+		if ($line_item->type() === EEM_Line_Item::type_line_item &&
1568 1568
 			$line_item->OBJ_type() === 'Ticket'
1569 1569
 		) {
1570 1570
 			$count = 0;
1571
-			foreach ( $registrations as $registration ) {
1572
-				if ( $line_item->OBJ_ID() === $registration->ticket_ID() &&
1573
-					in_array( $registration->status_ID(), EEM_Registration::reg_statuses_that_allow_payment() )
1571
+			foreach ($registrations as $registration) {
1572
+				if ($line_item->OBJ_ID() === $registration->ticket_ID() &&
1573
+					in_array($registration->status_ID(), EEM_Registration::reg_statuses_that_allow_payment())
1574 1574
 				) {
1575 1575
 					$count++;
1576 1576
 				}
1577 1577
 			}
1578
-			$new_li_fields[ 'LIN_quantity' ] = $count;
1578
+			$new_li_fields['LIN_quantity'] = $count;
1579 1579
 		}
1580 1580
 		//don't set the total. We'll leave that up to the code that calculates it
1581
-		unset( $new_li_fields[ 'LIN_ID' ], $new_li_fields[ 'LIN_parent' ], $new_li_fields[ 'LIN_total' ] );
1582
-		return EE_Line_Item::new_instance( $new_li_fields );
1581
+		unset($new_li_fields['LIN_ID'], $new_li_fields['LIN_parent'], $new_li_fields['LIN_total']);
1582
+		return EE_Line_Item::new_instance($new_li_fields);
1583 1583
 	}
1584 1584
 
1585 1585
 
@@ -1592,19 +1592,19 @@  discard block
 block discarded – undo
1592 1592
 	 * @return \EE_Line_Item|null
1593 1593
 	 * @throws \EE_Error
1594 1594
 	 */
1595
-	public static function non_empty_line_items( EE_Line_Item $line_item ) {
1596
-		$copied_li = EEH_Line_Item::non_empty_line_item( $line_item );
1597
-		if ( $copied_li === null ) {
1595
+	public static function non_empty_line_items(EE_Line_Item $line_item) {
1596
+		$copied_li = EEH_Line_Item::non_empty_line_item($line_item);
1597
+		if ($copied_li === null) {
1598 1598
 			return null;
1599 1599
 		}
1600 1600
 		//if this is an event subtotal, we want to only include it if it
1601 1601
 		//has a non-zero total and at least one ticket line item child
1602 1602
 		$ticket_children = 0;
1603
-		foreach ( $line_item->children() as $child_li ) {
1604
-			$child_li_copy = EEH_Line_Item::non_empty_line_items( $child_li );
1605
-			if ( $child_li_copy !== null ) {
1606
-				$copied_li->add_child_line_item( $child_li_copy );
1607
-				if ( $child_li_copy->type() === EEM_Line_Item::type_line_item &&
1603
+		foreach ($line_item->children() as $child_li) {
1604
+			$child_li_copy = EEH_Line_Item::non_empty_line_items($child_li);
1605
+			if ($child_li_copy !== null) {
1606
+				$copied_li->add_child_line_item($child_li_copy);
1607
+				if ($child_li_copy->type() === EEM_Line_Item::type_line_item &&
1608 1608
 					$child_li_copy->OBJ_type() === 'Ticket'
1609 1609
 				) {
1610 1610
 					$ticket_children++;
@@ -1634,8 +1634,8 @@  discard block
 block discarded – undo
1634 1634
 	 * @return EE_Line_Item
1635 1635
 	 * @throws \EE_Error
1636 1636
 	 */
1637
-	public static function non_empty_line_item( EE_Line_Item $line_item ) {
1638
-		if ( $line_item->type() === EEM_Line_Item::type_line_item &&
1637
+	public static function non_empty_line_item(EE_Line_Item $line_item) {
1638
+		if ($line_item->type() === EEM_Line_Item::type_line_item &&
1639 1639
 			$line_item->OBJ_type() === 'Ticket' &&
1640 1640
 			$line_item->quantity() === 0
1641 1641
 		) {
@@ -1643,8 +1643,8 @@  discard block
 block discarded – undo
1643 1643
 		}
1644 1644
 		$new_li_fields = $line_item->model_field_array();
1645 1645
 		//don't set the total. We'll leave that up to the code that calculates it
1646
-		unset( $new_li_fields[ 'LIN_ID' ], $new_li_fields[ 'LIN_parent' ] );
1647
-		return EE_Line_Item::new_instance( $new_li_fields );
1646
+		unset($new_li_fields['LIN_ID'], $new_li_fields['LIN_parent']);
1647
+		return EE_Line_Item::new_instance($new_li_fields);
1648 1648
 	}
1649 1649
 
1650 1650
 
@@ -1656,9 +1656,9 @@  discard block
 block discarded – undo
1656 1656
 	 * @return \EE_Line_Item
1657 1657
 	 * @throws \EE_Error
1658 1658
 	 */
1659
-	public static function get_items_subtotal( EE_Line_Item $total_line_item ){
1660
-		EE_Error::doing_it_wrong( 'EEH_Line_Item::get_items_subtotal()', __('Method replaced with EEH_Line_Item::get_pre_tax_subtotal()', 'event_espresso'), '4.6.0' );
1661
-		return self::get_pre_tax_subtotal( $total_line_item );
1659
+	public static function get_items_subtotal(EE_Line_Item $total_line_item) {
1660
+		EE_Error::doing_it_wrong('EEH_Line_Item::get_items_subtotal()', __('Method replaced with EEH_Line_Item::get_pre_tax_subtotal()', 'event_espresso'), '4.6.0');
1661
+		return self::get_pre_tax_subtotal($total_line_item);
1662 1662
 	}
1663 1663
 
1664 1664
 
@@ -1669,9 +1669,9 @@  discard block
 block discarded – undo
1669 1669
 	 * @return \EE_Line_Item
1670 1670
 	 * @throws \EE_Error
1671 1671
 	 */
1672
-	public static function create_default_total_line_item( $transaction = NULL) {
1673
-		EE_Error::doing_it_wrong( 'EEH_Line_Item::create_default_total_line_item()', __('Method replaced with EEH_Line_Item::create_total_line_item()', 'event_espresso'), '4.6.0' );
1674
-		return self::create_total_line_item( $transaction );
1672
+	public static function create_default_total_line_item($transaction = NULL) {
1673
+		EE_Error::doing_it_wrong('EEH_Line_Item::create_default_total_line_item()', __('Method replaced with EEH_Line_Item::create_total_line_item()', 'event_espresso'), '4.6.0');
1674
+		return self::create_total_line_item($transaction);
1675 1675
 	}
1676 1676
 
1677 1677
 
@@ -1683,9 +1683,9 @@  discard block
 block discarded – undo
1683 1683
 	 * @return \EE_Line_Item
1684 1684
 	 * @throws \EE_Error
1685 1685
 	 */
1686
-	public static function create_default_tickets_subtotal( EE_Line_Item $total_line_item, $transaction = NULL) {
1687
-		EE_Error::doing_it_wrong( 'EEH_Line_Item::create_default_tickets_subtotal()', __('Method replaced with EEH_Line_Item::create_pre_tax_subtotal()', 'event_espresso'), '4.6.0' );
1688
-		return self::create_pre_tax_subtotal( $total_line_item, $transaction );
1686
+	public static function create_default_tickets_subtotal(EE_Line_Item $total_line_item, $transaction = NULL) {
1687
+		EE_Error::doing_it_wrong('EEH_Line_Item::create_default_tickets_subtotal()', __('Method replaced with EEH_Line_Item::create_pre_tax_subtotal()', 'event_espresso'), '4.6.0');
1688
+		return self::create_pre_tax_subtotal($total_line_item, $transaction);
1689 1689
 	}
1690 1690
 
1691 1691
 
@@ -1697,9 +1697,9 @@  discard block
 block discarded – undo
1697 1697
 	 * @return \EE_Line_Item
1698 1698
 	 * @throws \EE_Error
1699 1699
 	 */
1700
-	public static function create_default_taxes_subtotal( EE_Line_Item $total_line_item, $transaction = NULL) {
1701
-		EE_Error::doing_it_wrong( 'EEH_Line_Item::create_default_taxes_subtotal()', __('Method replaced with EEH_Line_Item::create_taxes_subtotal()', 'event_espresso'), '4.6.0' );
1702
-		return self::create_taxes_subtotal( $total_line_item, $transaction );
1700
+	public static function create_default_taxes_subtotal(EE_Line_Item $total_line_item, $transaction = NULL) {
1701
+		EE_Error::doing_it_wrong('EEH_Line_Item::create_default_taxes_subtotal()', __('Method replaced with EEH_Line_Item::create_taxes_subtotal()', 'event_espresso'), '4.6.0');
1702
+		return self::create_taxes_subtotal($total_line_item, $transaction);
1703 1703
 	}
1704 1704
 
1705 1705
 
@@ -1711,9 +1711,9 @@  discard block
 block discarded – undo
1711 1711
 	 * @return \EE_Line_Item
1712 1712
 	 * @throws \EE_Error
1713 1713
 	 */
1714
-	public static function create_default_event_subtotal( EE_Line_Item $total_line_item, $transaction = NULL) {
1715
-		EE_Error::doing_it_wrong( 'EEH_Line_Item::create_default_event_subtotal()', __('Method replaced with EEH_Line_Item::create_event_subtotal()', 'event_espresso'), '4.6.0' );
1716
-		return self::create_event_subtotal( $total_line_item, $transaction );
1714
+	public static function create_default_event_subtotal(EE_Line_Item $total_line_item, $transaction = NULL) {
1715
+		EE_Error::doing_it_wrong('EEH_Line_Item::create_default_event_subtotal()', __('Method replaced with EEH_Line_Item::create_event_subtotal()', 'event_espresso'), '4.6.0');
1716
+		return self::create_event_subtotal($total_line_item, $transaction);
1717 1717
 	}
1718 1718
 
1719 1719
 
Please login to merge, or discard this patch.
core/db_classes/EE_Datetime.class.php 3 patches
Doc Comments   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
 	 * Sets qty of reserved tickets for this datetime
241 241
 	 *
242 242
 	 * @param int $reserved
243
-	 * @return boolean
243
+	 * @return boolean|null
244 244
 	 */
245 245
 	function set_reserved( $reserved ) {
246 246
 		// reserved can not go below zero
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
 	 * increments reserved by amount passed by $qty
255 255
 	 *
256 256
 	 * @param int $qty
257
-	 * @return boolean
257
+	 * @return boolean|null
258 258
 	 */
259 259
 	function increase_reserved( $qty = 1 ) {
260 260
 		$reserved = $this->reserved() + absint( $qty );
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
 	 * decrements (subtracts) reserved by amount passed by $qty
268 268
 	 *
269 269
 	 * @param int $qty
270
-	 * @return boolean
270
+	 * @return boolean|null
271 271
 	 */
272 272
 	function decrease_reserved( $qty = 1 ) {
273 273
 		$reserved = $this->reserved() - absint( $qty );
@@ -363,7 +363,7 @@  discard block
 block discarded – undo
363 363
 	 *        get event start date.  Provide either the date format, or NULL to re-use the
364 364
 	 * last-used format, or '' to use the default date format
365 365
 	 *
366
-	 * @param null $dt_frmt - string representation of date format defaults to 'F j, Y'
366
+	 * @param string $dt_frmt - string representation of date format defaults to 'F j, Y'
367 367
 	 * @return        mixed        string on success, FALSE on fail
368 368
 	 */
369 369
 	public function start_date( $dt_frmt = NULL ) {
@@ -386,7 +386,7 @@  discard block
 block discarded – undo
386 386
 	 *        get end date. Provide either the date format, or NULL to re-use the
387 387
 	 * last-used format, or '' to use the default date format
388 388
 	 *
389
-	 * @param null $dt_frmt - string representation of date format defaults to 'F j, Y'
389
+	 * @param string $dt_frmt - string representation of date format defaults to 'F j, Y'
390 390
 	 * @return        mixed        string on success, FALSE on fail
391 391
 	 */
392 392
 	public function end_date( $dt_frmt = NULL ) {
@@ -412,7 +412,7 @@  discard block
 block discarded – undo
412 412
 	 * @param string $dt_frmt     - string representation of date format defaults to WP settings
413 413
 	 * @param string $conjunction - conjunction junction what's your function ? this string joins the start date with
414 414
 	 *                            the end date ie: Jan 01 "to" Dec 31
415
-	 * @return mixed        string on success, FALSE on fail
415
+	 * @return string        string on success, FALSE on fail
416 416
 	 * @throws \EE_Error
417 417
 	 */
418 418
 	public function date_range( $dt_frmt = NULL, $conjunction = ' - ' ) {
@@ -484,7 +484,7 @@  discard block
 block discarded – undo
484 484
 	 * @param string $tm_format   string representation of time format defaults to 'g:i a'
485 485
 	 * @param string $conjunction conjunction junction what's your function ?
486 486
 	 *                            this string joins the start date with the end date ie: Jan 01 "to" Dec 31
487
-	 * @return mixed              string on success, FALSE on fail
487
+	 * @return string              string on success, FALSE on fail
488 488
 	 * @throws \EE_Error
489 489
 	 */
490 490
 	public function time_range( $tm_format = null, $conjunction = ' - ' ) {
Please login to merge, or discard this patch.
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -510,19 +510,19 @@  discard block
 block discarded – undo
510 510
 	/**
511 511
 	 * This returns a range representation of the date and times.
512 512
 	 * Output is dependent on the difference (or similarity) between DTT_EVT_start and DTT_EVT_end.
513
-     * Also, the return value is localized.
514
-     *
515
-     * @param string $dt_format
513
+	 * Also, the return value is localized.
514
+	 *
515
+	 * @param string $dt_format
516 516
 	 * @param string $tm_format
517 517
 	 * @param string $conjunction used between two different dates or times.
518
-     *                            ex: Dec 1{$conjunction}}Dec 6, or 2pm{$conjunction}3pm
519
-     * @param string $separator   used between the date and time formats.
520
-     *                            ex: Dec 1, 2016{$separator}2pm
518
+	 *                            ex: Dec 1{$conjunction}}Dec 6, or 2pm{$conjunction}3pm
519
+	 * @param string $separator   used between the date and time formats.
520
+	 *                            ex: Dec 1, 2016{$separator}2pm
521 521
 	 * @return string
522 522
 	 * @throws \EE_Error
523 523
 	 */
524 524
 	public function date_and_time_range( $dt_format = '', $tm_format = '', $conjunction = ' - ' , $separator = ' '
525
-    ) {
525
+	) {
526 526
 		$dt_format = ! empty( $dt_format ) ? $dt_format : $this->_dt_frmt;
527 527
 		$tm_format = ! empty( $tm_format ) ? $tm_format : $this->_tm_frmt;
528 528
 		$full_format = $dt_format . $separator . $tm_format;
@@ -536,14 +536,14 @@  discard block
 block discarded – undo
536 536
 			//start and end date are the same but times are different
537 537
 			case ( $this->start_date() === $this->end_date() ) :
538 538
 				$output = $this->get_i18n_datetime( 'DTT_EVT_start', $full_format )
539
-				          . $conjunction
540
-				          . $this->get_i18n_datetime( 'DTT_EVT_end', $tm_format );
539
+						  . $conjunction
540
+						  . $this->get_i18n_datetime( 'DTT_EVT_end', $tm_format );
541 541
 				break;
542 542
 			//all other conditions
543 543
 			default :
544 544
 				$output = $this->get_i18n_datetime( 'DTT_EVT_start', $full_format )
545
-				          . $conjunction
546
-				          . $this->get_i18n_datetime( 'DTT_EVT_end', $full_format );
545
+						  . $conjunction
546
+						  . $this->get_i18n_datetime( 'DTT_EVT_end', $full_format );
547 547
 				break;
548 548
 		}
549 549
 		return $output;
Please login to merge, or discard this patch.
Spacing   +151 added lines, -151 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1
-<?php if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) {
2
-	exit( 'No direct script access allowed' );
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3 3
 }
4 4
 /**
5 5
  * Event Espresso
@@ -74,9 +74,9 @@  discard block
 block discarded – undo
74 74
 	 *                             		    date_format and the second value is the time format
75 75
 	 * @return EE_Datetime
76 76
 	 */
77
-	public static function new_instance( $props_n_values = array(), $timezone = null, $date_formats = array() ) {
78
-		$has_object = parent::_check_for_object( $props_n_values, __CLASS__, $timezone, $date_formats );
79
-		return $has_object ? $has_object : new self( $props_n_values, false, $timezone, $date_formats );
77
+	public static function new_instance($props_n_values = array(), $timezone = null, $date_formats = array()) {
78
+		$has_object = parent::_check_for_object($props_n_values, __CLASS__, $timezone, $date_formats);
79
+		return $has_object ? $has_object : new self($props_n_values, false, $timezone, $date_formats);
80 80
 	}
81 81
 
82 82
 
@@ -87,8 +87,8 @@  discard block
 block discarded – undo
87 87
 	 *                          		the website will be used.
88 88
 	 * @return EE_Datetime
89 89
 	 */
90
-	public static function new_instance_from_db( $props_n_values = array(), $timezone = null ) {
91
-		return new self( $props_n_values, TRUE, $timezone );
90
+	public static function new_instance_from_db($props_n_values = array(), $timezone = null) {
91
+		return new self($props_n_values, TRUE, $timezone);
92 92
 	}
93 93
 
94 94
 
@@ -96,8 +96,8 @@  discard block
 block discarded – undo
96 96
 	/**
97 97
 	 * @param $name
98 98
 	 */
99
-	public function set_name( $name ) {
100
-		$this->set( 'DTT_name', $name );
99
+	public function set_name($name) {
100
+		$this->set('DTT_name', $name);
101 101
 	}
102 102
 
103 103
 
@@ -105,8 +105,8 @@  discard block
 block discarded – undo
105 105
 	/**
106 106
 	 * @param $description
107 107
 	 */
108
-	public function set_description( $description ) {
109
-		$this->set( 'DTT_description', $description );
108
+	public function set_description($description) {
109
+		$this->set('DTT_description', $description);
110 110
 	}
111 111
 
112 112
 
@@ -118,8 +118,8 @@  discard block
 block discarded – undo
118 118
 	 *
119 119
 	 * @param        string $date a string representation of the event's date ex:  Dec. 25, 2025 or 12-25-2025
120 120
 	 */
121
-	public function set_start_date( $date ) {
122
-		$this->_set_date_for( $date, 'DTT_EVT_start' );
121
+	public function set_start_date($date) {
122
+		$this->_set_date_for($date, 'DTT_EVT_start');
123 123
 	}
124 124
 
125 125
 
@@ -131,8 +131,8 @@  discard block
 block discarded – undo
131 131
 	 *
132 132
 	 * @param        string $time a string representation of the event time ex:  9am  or  7:30 PM
133 133
 	 */
134
-	public function set_start_time( $time ) {
135
-		$this->_set_time_for( $time, 'DTT_EVT_start' );
134
+	public function set_start_time($time) {
135
+		$this->_set_time_for($time, 'DTT_EVT_start');
136 136
 	}
137 137
 
138 138
 
@@ -144,8 +144,8 @@  discard block
 block discarded – undo
144 144
 	 *
145 145
 	 * @param        string $date a string representation of the event's date ex:  Dec. 25, 2025 or 12-25-2025
146 146
 	 */
147
-	public function set_end_date( $date ) {
148
-		$this->_set_date_for( $date, 'DTT_EVT_end' );
147
+	public function set_end_date($date) {
148
+		$this->_set_date_for($date, 'DTT_EVT_end');
149 149
 	}
150 150
 
151 151
 
@@ -157,8 +157,8 @@  discard block
 block discarded – undo
157 157
 	 *
158 158
 	 * @param        string $time a string representation of the event time ex:  9am  or  7:30 PM
159 159
 	 */
160
-	public function set_end_time( $time ) {
161
-		$this->_set_time_for( $time, 'DTT_EVT_end' );
160
+	public function set_end_time($time) {
161
+		$this->_set_time_for($time, 'DTT_EVT_end');
162 162
 	}
163 163
 
164 164
 
@@ -170,8 +170,8 @@  discard block
 block discarded – undo
170 170
 	 *
171 171
 	 * @param        int $reg_limit
172 172
 	 */
173
-	public function set_reg_limit( $reg_limit ) {
174
-		$this->set( 'DTT_reg_limit', $reg_limit );
173
+	public function set_reg_limit($reg_limit) {
174
+		$this->set('DTT_reg_limit', $reg_limit);
175 175
 	}
176 176
 
177 177
 
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
 	 * @return        mixed        int on success, FALSE on fail
184 184
 	 */
185 185
 	public function sold() {
186
-		return $this->get_raw( 'DTT_sold' );
186
+		return $this->get_raw('DTT_sold');
187 187
 	}
188 188
 
189 189
 
@@ -193,10 +193,10 @@  discard block
 block discarded – undo
193 193
 	 *
194 194
 	 * @param        int $sold
195 195
 	 */
196
-	public function set_sold( $sold ) {
196
+	public function set_sold($sold) {
197 197
 		// sold can not go below zero
198
-		$sold = max( 0, $sold );
199
-		$this->set( 'DTT_sold', $sold );
198
+		$sold = max(0, $sold);
199
+		$this->set('DTT_sold', $sold);
200 200
 	}
201 201
 
202 202
 
@@ -205,11 +205,11 @@  discard block
 block discarded – undo
205 205
 	 * increments sold by amount passed by $qty
206 206
 	 * @param int $qty
207 207
 	 */
208
-	public function increase_sold( $qty = 1 ) {
208
+	public function increase_sold($qty = 1) {
209 209
 		$sold = $this->sold() + $qty;
210 210
 		// remove ticket reservation
211
-		$this->decrease_reserved( $qty );
212
-		$this->set_sold( $sold );
211
+		$this->decrease_reserved($qty);
212
+		$this->set_sold($sold);
213 213
 	}
214 214
 
215 215
 
@@ -218,9 +218,9 @@  discard block
 block discarded – undo
218 218
 	 * decrements (subtracts) sold amount passed by $qty
219 219
 	 * @param int $qty
220 220
 	 */
221
-	public function decrease_sold( $qty = 1 ) {
221
+	public function decrease_sold($qty = 1) {
222 222
 		$sold = $this->sold() - $qty;
223
-		$this->set_sold( $sold );
223
+		$this->set_sold($sold);
224 224
 	}
225 225
 
226 226
 
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
 	 * @return int
232 232
 	 */
233 233
 	function reserved() {
234
-		return $this->get_raw( 'DTT_reserved' );
234
+		return $this->get_raw('DTT_reserved');
235 235
 	}
236 236
 
237 237
 
@@ -242,10 +242,10 @@  discard block
 block discarded – undo
242 242
 	 * @param int $reserved
243 243
 	 * @return boolean
244 244
 	 */
245
-	function set_reserved( $reserved ) {
245
+	function set_reserved($reserved) {
246 246
 		// reserved can not go below zero
247
-		$reserved = max( 0, intval( $reserved ) );
248
-		$this->set( 'DTT_reserved', $reserved );
247
+		$reserved = max(0, intval($reserved));
248
+		$this->set('DTT_reserved', $reserved);
249 249
 	}
250 250
 
251 251
 
@@ -256,9 +256,9 @@  discard block
 block discarded – undo
256 256
 	 * @param int $qty
257 257
 	 * @return boolean
258 258
 	 */
259
-	function increase_reserved( $qty = 1 ) {
260
-		$reserved = $this->reserved() + absint( $qty );
261
-		return $this->set_reserved( $reserved );
259
+	function increase_reserved($qty = 1) {
260
+		$reserved = $this->reserved() + absint($qty);
261
+		return $this->set_reserved($reserved);
262 262
 	}
263 263
 
264 264
 
@@ -269,9 +269,9 @@  discard block
 block discarded – undo
269 269
 	 * @param int $qty
270 270
 	 * @return boolean
271 271
 	 */
272
-	function decrease_reserved( $qty = 1 ) {
273
-		$reserved = $this->reserved() - absint( $qty );
274
-		return $this->set_reserved( $reserved );
272
+	function decrease_reserved($qty = 1) {
273
+		$reserved = $this->reserved() - absint($qty);
274
+		return $this->set_reserved($reserved);
275 275
 	}
276 276
 
277 277
 
@@ -292,7 +292,7 @@  discard block
 block discarded – undo
292 292
 	 * @return string
293 293
 	 */
294 294
 	public function name() {
295
-		return $this->get( 'DTT_name' );
295
+		return $this->get('DTT_name');
296 296
 	}
297 297
 
298 298
 
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
 	 * @return string
303 303
 	 */
304 304
 	public function description() {
305
-		return $this->get( 'DTT_description' );
305
+		return $this->get('DTT_description');
306 306
 	}
307 307
 
308 308
 
@@ -312,7 +312,7 @@  discard block
 block discarded – undo
312 312
 	 * @return boolean          TRUE if is primary, FALSE if not.
313 313
 	 */
314 314
 	public function is_primary() {
315
-		return $this->get( 'DTT_is_primary' );
315
+		return $this->get('DTT_is_primary');
316 316
 	}
317 317
 
318 318
 
@@ -322,7 +322,7 @@  discard block
 block discarded – undo
322 322
 	 * @return int         The order of the datetime for this event.
323 323
 	 */
324 324
 	public function order() {
325
-		return $this->get( 'DTT_order' );
325
+		return $this->get('DTT_order');
326 326
 	}
327 327
 
328 328
 
@@ -332,7 +332,7 @@  discard block
 block discarded – undo
332 332
 	 * @return int
333 333
 	 */
334 334
 	public function parent() {
335
-		return $this->get( 'DTT_parent' );
335
+		return $this->get('DTT_parent');
336 336
 	}
337 337
 
338 338
 
@@ -348,10 +348,10 @@  discard block
 block discarded – undo
348 348
 	 * @param    bool   $echo         - whether we echo or return (note echoing uses "pretty" formats, otherwise we use the standard formats)
349 349
 	 * @return    string|bool|void  string on success, FALSE on fail
350 350
 	 */
351
-	private function _show_datetime( $date_or_time = NULL, $start_or_end = 'start', $dt_frmt = '', $tm_frmt = '', $echo = FALSE ) {
351
+	private function _show_datetime($date_or_time = NULL, $start_or_end = 'start', $dt_frmt = '', $tm_frmt = '', $echo = FALSE) {
352 352
 		$field_name = "DTT_EVT_{$start_or_end}";
353
-		$dtt = $this->_get_datetime( $field_name, $dt_frmt, $tm_frmt, $date_or_time, $echo );
354
-		if ( ! $echo ) {
353
+		$dtt = $this->_get_datetime($field_name, $dt_frmt, $tm_frmt, $date_or_time, $echo);
354
+		if ( ! $echo) {
355 355
 			return $dtt;
356 356
 		}
357 357
 		return '';
@@ -366,8 +366,8 @@  discard block
 block discarded – undo
366 366
 	 * @param null $dt_frmt - string representation of date format defaults to 'F j, Y'
367 367
 	 * @return        mixed        string on success, FALSE on fail
368 368
 	 */
369
-	public function start_date( $dt_frmt = NULL ) {
370
-		return $this->_show_datetime( 'D', 'start', $dt_frmt );
369
+	public function start_date($dt_frmt = NULL) {
370
+		return $this->_show_datetime('D', 'start', $dt_frmt);
371 371
 	}
372 372
 
373 373
 
@@ -376,8 +376,8 @@  discard block
 block discarded – undo
376 376
 	 * Echoes start_date()
377 377
 	 * @param string $dt_frmt
378 378
 	 */
379
-	public function e_start_date( $dt_frmt = NULL ) {
380
-		$this->_show_datetime( 'D', 'start', $dt_frmt, NULL, TRUE );
379
+	public function e_start_date($dt_frmt = NULL) {
380
+		$this->_show_datetime('D', 'start', $dt_frmt, NULL, TRUE);
381 381
 	}
382 382
 
383 383
 
@@ -389,8 +389,8 @@  discard block
 block discarded – undo
389 389
 	 * @param null $dt_frmt - string representation of date format defaults to 'F j, Y'
390 390
 	 * @return        mixed        string on success, FALSE on fail
391 391
 	 */
392
-	public function end_date( $dt_frmt = NULL ) {
393
-		return $this->_show_datetime( 'D', 'end', $dt_frmt );
392
+	public function end_date($dt_frmt = NULL) {
393
+		return $this->_show_datetime('D', 'end', $dt_frmt);
394 394
 	}
395 395
 
396 396
 
@@ -399,8 +399,8 @@  discard block
 block discarded – undo
399 399
 	 * Echoes the end date. See end_date()
400 400
 	 * @param string $dt_frmt
401 401
 	 */
402
-	public function e_end_date( $dt_frmt = NULL ) {
403
-		$this->_show_datetime( 'D', 'end', $dt_frmt, NULL, TRUE );
402
+	public function e_end_date($dt_frmt = NULL) {
403
+		$this->_show_datetime('D', 'end', $dt_frmt, NULL, TRUE);
404 404
 	}
405 405
 
406 406
 
@@ -415,11 +415,11 @@  discard block
 block discarded – undo
415 415
 	 * @return mixed        string on success, FALSE on fail
416 416
 	 * @throws \EE_Error
417 417
 	 */
418
-	public function date_range( $dt_frmt = NULL, $conjunction = ' - ' ) {
419
-		$dt_frmt = ! empty( $dt_frmt ) ? $dt_frmt : $this->_dt_frmt;
420
-		$start = str_replace( ' ', '&nbsp;', $this->get_i18n_datetime( 'DTT_EVT_start', $dt_frmt ) );
421
-		$end = str_replace( ' ', '&nbsp;', $this->get_i18n_datetime( 'DTT_EVT_end', $dt_frmt ) );
422
-		return $start !== $end ? $start . $conjunction . $end : $start;
418
+	public function date_range($dt_frmt = NULL, $conjunction = ' - ') {
419
+		$dt_frmt = ! empty($dt_frmt) ? $dt_frmt : $this->_dt_frmt;
420
+		$start = str_replace(' ', '&nbsp;', $this->get_i18n_datetime('DTT_EVT_start', $dt_frmt));
421
+		$end = str_replace(' ', '&nbsp;', $this->get_i18n_datetime('DTT_EVT_end', $dt_frmt));
422
+		return $start !== $end ? $start.$conjunction.$end : $start;
423 423
 	}
424 424
 
425 425
 
@@ -429,8 +429,8 @@  discard block
 block discarded – undo
429 429
 	 * @param string $conjunction
430 430
 	 * @throws \EE_Error
431 431
 	 */
432
-	public function e_date_range( $dt_frmt = NULL, $conjunction = ' - ' ) {
433
-		echo $this->date_range( $dt_frmt, $conjunction );
432
+	public function e_date_range($dt_frmt = NULL, $conjunction = ' - ') {
433
+		echo $this->date_range($dt_frmt, $conjunction);
434 434
 	}
435 435
 
436 436
 
@@ -441,8 +441,8 @@  discard block
 block discarded – undo
441 441
 	 * @param        string $tm_format - string representation of time format defaults to 'g:i a'
442 442
 	 * @return        mixed        string on success, FALSE on fail
443 443
 	 */
444
-	public function start_time( $tm_format = NULL ) {
445
-		return $this->_show_datetime( 'T', 'start', NULL, $tm_format );
444
+	public function start_time($tm_format = NULL) {
445
+		return $this->_show_datetime('T', 'start', NULL, $tm_format);
446 446
 	}
447 447
 
448 448
 
@@ -450,8 +450,8 @@  discard block
 block discarded – undo
450 450
 	/**
451 451
 	 * @param null $tm_format
452 452
 	 */
453
-	public function e_start_time( $tm_format = NULL ) {
454
-		$this->_show_datetime( 'T', 'start', NULL, $tm_format, TRUE );
453
+	public function e_start_time($tm_format = NULL) {
454
+		$this->_show_datetime('T', 'start', NULL, $tm_format, TRUE);
455 455
 	}
456 456
 
457 457
 
@@ -462,8 +462,8 @@  discard block
 block discarded – undo
462 462
 	 * @param        string $tm_format - string representation of time format defaults to 'g:i a'
463 463
 	 * @return        mixed        string on success, FALSE on fail
464 464
 	 */
465
-	public function end_time( $tm_format = NULL ) {
466
-		return $this->_show_datetime( 'T', 'end', NULL, $tm_format );
465
+	public function end_time($tm_format = NULL) {
466
+		return $this->_show_datetime('T', 'end', NULL, $tm_format);
467 467
 	}
468 468
 
469 469
 
@@ -471,8 +471,8 @@  discard block
 block discarded – undo
471 471
 	/**
472 472
 	 * @param null $tm_format
473 473
 	 */
474
-	public function e_end_time( $tm_format = NULL ) {
475
-		$this->_show_datetime( 'T', 'end', NULL, $tm_format, TRUE );
474
+	public function e_end_time($tm_format = NULL) {
475
+		$this->_show_datetime('T', 'end', NULL, $tm_format, TRUE);
476 476
 	}
477 477
 
478 478
 
@@ -487,11 +487,11 @@  discard block
 block discarded – undo
487 487
 	 * @return mixed              string on success, FALSE on fail
488 488
 	 * @throws \EE_Error
489 489
 	 */
490
-	public function time_range( $tm_format = null, $conjunction = ' - ' ) {
491
-		$tm_format = !empty( $tm_format ) ? $tm_format : $this->_tm_frmt;
492
-		$start = str_replace( ' ', '&nbsp;', $this->get_i18n_datetime( 'DTT_EVT_start', $tm_format ) );
493
-		$end = str_replace( ' ', '&nbsp;', $this->get_i18n_datetime( 'DTT_EVT_end',  $tm_format ) );
494
-		return $start !== $end ? $start . $conjunction . $end : $start;
490
+	public function time_range($tm_format = null, $conjunction = ' - ') {
491
+		$tm_format = ! empty($tm_format) ? $tm_format : $this->_tm_frmt;
492
+		$start = str_replace(' ', '&nbsp;', $this->get_i18n_datetime('DTT_EVT_start', $tm_format));
493
+		$end = str_replace(' ', '&nbsp;', $this->get_i18n_datetime('DTT_EVT_end', $tm_format));
494
+		return $start !== $end ? $start.$conjunction.$end : $start;
495 495
 	}
496 496
 
497 497
 
@@ -501,8 +501,8 @@  discard block
 block discarded – undo
501 501
 	 * @param string $conjunction
502 502
 	 * @throws \EE_Error
503 503
 	 */
504
-	public function e_time_range( $tm_format = NULL, $conjunction = ' - ' ) {
505
-		echo $this->time_range( $tm_format, $conjunction );
504
+	public function e_time_range($tm_format = NULL, $conjunction = ' - ') {
505
+		echo $this->time_range($tm_format, $conjunction);
506 506
 	}
507 507
 
508 508
 
@@ -521,29 +521,29 @@  discard block
 block discarded – undo
521 521
 	 * @return string
522 522
 	 * @throws \EE_Error
523 523
 	 */
524
-	public function date_and_time_range( $dt_format = '', $tm_format = '', $conjunction = ' - ' , $separator = ' '
524
+	public function date_and_time_range($dt_format = '', $tm_format = '', $conjunction = ' - ', $separator = ' '
525 525
     ) {
526
-		$dt_format = ! empty( $dt_format ) ? $dt_format : $this->_dt_frmt;
527
-		$tm_format = ! empty( $tm_format ) ? $tm_format : $this->_tm_frmt;
528
-		$full_format = $dt_format . $separator . $tm_format;
526
+		$dt_format = ! empty($dt_format) ? $dt_format : $this->_dt_frmt;
527
+		$tm_format = ! empty($tm_format) ? $tm_format : $this->_tm_frmt;
528
+		$full_format = $dt_format.$separator.$tm_format;
529 529
 
530 530
 		//the range output depends on various conditions
531
-		switch ( true ) {
531
+		switch (true) {
532 532
 			//start date timestamp and end date timestamp are the same.
533
-			case ( $this->get_raw( 'DTT_EVT_start' ) === $this->get_raw( 'DTT_EVT_end' ) ) :
534
-				$output = $this->get_i18n_datetime( 'DTT_EVT_start', $full_format );
533
+			case ($this->get_raw('DTT_EVT_start') === $this->get_raw('DTT_EVT_end')) :
534
+				$output = $this->get_i18n_datetime('DTT_EVT_start', $full_format);
535 535
 				break;
536 536
 			//start and end date are the same but times are different
537
-			case ( $this->start_date() === $this->end_date() ) :
538
-				$output = $this->get_i18n_datetime( 'DTT_EVT_start', $full_format )
537
+			case ($this->start_date() === $this->end_date()) :
538
+				$output = $this->get_i18n_datetime('DTT_EVT_start', $full_format)
539 539
 				          . $conjunction
540
-				          . $this->get_i18n_datetime( 'DTT_EVT_end', $tm_format );
540
+				          . $this->get_i18n_datetime('DTT_EVT_end', $tm_format);
541 541
 				break;
542 542
 			//all other conditions
543 543
 			default :
544
-				$output = $this->get_i18n_datetime( 'DTT_EVT_start', $full_format )
544
+				$output = $this->get_i18n_datetime('DTT_EVT_start', $full_format)
545 545
 				          . $conjunction
546
-				          . $this->get_i18n_datetime( 'DTT_EVT_end', $full_format );
546
+				          . $this->get_i18n_datetime('DTT_EVT_end', $full_format);
547 547
 				break;
548 548
 		}
549 549
 		return $output;
@@ -561,8 +561,8 @@  discard block
 block discarded – undo
561 561
 	 * @return void
562 562
 	 * @throws \EE_Error
563 563
 	 */
564
-	public function e_date_and_time_range( $dt_format = '', $tm_format = '', $conjunction = ' - ' ) {
565
-		echo $this->date_and_time_range( $dt_format, $tm_format, $conjunction );
564
+	public function e_date_and_time_range($dt_format = '', $tm_format = '', $conjunction = ' - ') {
565
+		echo $this->date_and_time_range($dt_format, $tm_format, $conjunction);
566 566
 	}
567 567
 
568 568
 
@@ -574,8 +574,8 @@  discard block
 block discarded – undo
574 574
 	 * @param 	string 	$tm_format - string representation of time format defaults to 'g:i a'
575 575
 	 * @return 	mixed 	string on success, FALSE on fail
576 576
 	 */
577
-	public function start_date_and_time( $dt_format = NULL, $tm_format = NULL ) {
578
-		return $this->_show_datetime( '', 'start', $dt_format, $tm_format );
577
+	public function start_date_and_time($dt_format = NULL, $tm_format = NULL) {
578
+		return $this->_show_datetime('', 'start', $dt_format, $tm_format);
579 579
 	}
580 580
 
581 581
 
@@ -584,8 +584,8 @@  discard block
 block discarded – undo
584 584
 	 * @param null $dt_frmt
585 585
 	 * @param null $tm_format
586 586
 	 */
587
-	public function e_start_date_and_time( $dt_frmt = NULL, $tm_format = NULL ) {
588
-		$this->_show_datetime( '', 'start', $dt_frmt, $tm_format, TRUE );
587
+	public function e_start_date_and_time($dt_frmt = NULL, $tm_format = NULL) {
588
+		$this->_show_datetime('', 'start', $dt_frmt, $tm_format, TRUE);
589 589
 	}
590 590
 
591 591
 
@@ -599,11 +599,11 @@  discard block
 block discarded – undo
599 599
 	 * @param bool   $round_up
600 600
 	 * @return float|int|mixed
601 601
 	 */
602
-	public function length( $units = 'seconds', $round_up = FALSE ) {
603
-		$start = $this->get_raw( 'DTT_EVT_start' );
604
-		$end = $this->get_raw( 'DTT_EVT_end' );
602
+	public function length($units = 'seconds', $round_up = FALSE) {
603
+		$start = $this->get_raw('DTT_EVT_start');
604
+		$end = $this->get_raw('DTT_EVT_end');
605 605
 		$length_in_units = $end - $start;
606
-		switch ( $units ) {
606
+		switch ($units) {
607 607
 			//NOTE: We purposefully don't use "break;" in order to chain the divisions
608 608
 			/** @noinspection PhpMissingBreakStatementInspection */
609 609
 			case 'days':
@@ -616,10 +616,10 @@  discard block
 block discarded – undo
616 616
 				$length_in_units /= 60;
617 617
 			case 'seconds':
618 618
 			default:
619
-				$length_in_units = ceil( $length_in_units );
619
+				$length_in_units = ceil($length_in_units);
620 620
 		}
621
-		if ( $round_up ) {
622
-			$length_in_units = max( $length_in_units, 1 );
621
+		if ($round_up) {
622
+			$length_in_units = max($length_in_units, 1);
623 623
 		}
624 624
 		return $length_in_units;
625 625
 	}
@@ -633,8 +633,8 @@  discard block
 block discarded – undo
633 633
 	 * @param bool | string 	$tm_format - string representation of time format defaults to 'g:i a'
634 634
 	 * @return 	mixed        		string on success, FALSE on fail
635 635
 	 */
636
-	public function end_date_and_time( $dt_frmt = FALSE, $tm_format = FALSE ) {
637
-		return $this->_show_datetime( '', 'end', $dt_frmt, $tm_format );
636
+	public function end_date_and_time($dt_frmt = FALSE, $tm_format = FALSE) {
637
+		return $this->_show_datetime('', 'end', $dt_frmt, $tm_format);
638 638
 	}
639 639
 
640 640
 
@@ -643,8 +643,8 @@  discard block
 block discarded – undo
643 643
 	 * @param bool $dt_frmt
644 644
 	 * @param bool $tm_format
645 645
 	 */
646
-	public function e_end_date_and_time( $dt_frmt = FALSE, $tm_format = FALSE ) {
647
-		$this->_show_datetime( '', 'end', $dt_frmt, $tm_format, TRUE );
646
+	public function e_end_date_and_time($dt_frmt = FALSE, $tm_format = FALSE) {
647
+		$this->_show_datetime('', 'end', $dt_frmt, $tm_format, TRUE);
648 648
 	}
649 649
 
650 650
 
@@ -655,7 +655,7 @@  discard block
 block discarded – undo
655 655
 	 * @return        int
656 656
 	 */
657 657
 	public function start() {
658
-		return $this->get_raw( 'DTT_EVT_start' );
658
+		return $this->get_raw('DTT_EVT_start');
659 659
 	}
660 660
 
661 661
 
@@ -666,7 +666,7 @@  discard block
 block discarded – undo
666 666
 	 * @return        int
667 667
 	 */
668 668
 	public function end() {
669
-		return $this->get_raw( 'DTT_EVT_end' );
669
+		return $this->get_raw('DTT_EVT_end');
670 670
 	}
671 671
 
672 672
 
@@ -677,7 +677,7 @@  discard block
 block discarded – undo
677 677
 	 * @return        mixed        int on success, FALSE on fail
678 678
 	 */
679 679
 	public function reg_limit() {
680
-		return $this->get_raw( 'DTT_reg_limit' );
680
+		return $this->get_raw('DTT_reg_limit');
681 681
 	}
682 682
 
683 683
 
@@ -705,15 +705,15 @@  discard block
 block discarded – undo
705 705
 	 * 																	the spaces remaining for this particular datetime, hence the flag.
706 706
 	 * @return 	int
707 707
 	 */
708
-	public function spaces_remaining( $consider_tickets = FALSE ) {
708
+	public function spaces_remaining($consider_tickets = FALSE) {
709 709
 		// tickets remaining available for purchase
710 710
 		//no need for special checks for infinite, because if DTT_reg_limit == EE_INF, then EE_INF - x = EE_INF
711 711
 		$dtt_remaining = $this->reg_limit() - $this->sold();
712
-		if ( ! $consider_tickets ) {
712
+		if ( ! $consider_tickets) {
713 713
 			return $dtt_remaining;
714 714
 		}
715 715
 		$tickets_remaining = $this->tickets_remaining();
716
-		return min( $dtt_remaining, $tickets_remaining );
716
+		return min($dtt_remaining, $tickets_remaining);
717 717
 	}
718 718
 
719 719
 
@@ -724,19 +724,19 @@  discard block
 block discarded – undo
724 724
 	 * @param array $query_params like EEM_Base::get_all's
725 725
 	 * @return int
726 726
 	 */
727
-	public function tickets_remaining( $query_params = array() ) {
727
+	public function tickets_remaining($query_params = array()) {
728 728
 		$sum = 0;
729
-		$tickets = $this->tickets( $query_params );
730
-		if ( ! empty( $tickets ) ) {
731
-			foreach ( $tickets as $ticket ) {
732
-				if ( $ticket instanceof EE_Ticket ) {
729
+		$tickets = $this->tickets($query_params);
730
+		if ( ! empty($tickets)) {
731
+			foreach ($tickets as $ticket) {
732
+				if ($ticket instanceof EE_Ticket) {
733 733
 					// get the actual amount of tickets that can be sold
734
-					$qty = $ticket->qty( 'saleable' );
735
-					if ( $qty === EE_INF ) {
734
+					$qty = $ticket->qty('saleable');
735
+					if ($qty === EE_INF) {
736 736
 						return EE_INF;
737 737
 					}
738 738
 					// no negative ticket quantities plz
739
-					if ( $qty > 0 ) {
739
+					if ($qty > 0) {
740 740
 						$sum += $qty;
741 741
 					}
742 742
 				}
@@ -753,8 +753,8 @@  discard block
 block discarded – undo
753 753
 	 * @param array $query_params like EEM_Base::get_all's
754 754
 	 * @return int
755 755
 	 */
756
-	public function sum_tickets_initially_available( $query_params = array() ) {
757
-		return $this->sum_related( 'Ticket', $query_params, 'TKT_qty' );
756
+	public function sum_tickets_initially_available($query_params = array()) {
757
+		return $this->sum_related('Ticket', $query_params, 'TKT_qty');
758 758
 	}
759 759
 
760 760
 
@@ -766,7 +766,7 @@  discard block
 block discarded – undo
766 766
 	 * @return int
767 767
 	 */
768 768
 	public function total_tickets_available_at_this_datetime() {
769
-		return $this->spaces_remaining( true );
769
+		return $this->spaces_remaining(true);
770 770
 	}
771 771
 
772 772
 
@@ -777,7 +777,7 @@  discard block
 block discarded – undo
777 777
 	 * @return boolean
778 778
 	 */
779 779
 	public function is_upcoming() {
780
-		return ( $this->get_raw( 'DTT_EVT_start' ) > time() );
780
+		return ($this->get_raw('DTT_EVT_start') > time());
781 781
 	}
782 782
 
783 783
 
@@ -787,7 +787,7 @@  discard block
 block discarded – undo
787 787
 	 * @return boolean
788 788
 	 */
789 789
 	public function is_active() {
790
-		return ( $this->get_raw( 'DTT_EVT_start' ) < time() && $this->get_raw( 'DTT_EVT_end' ) > time() );
790
+		return ($this->get_raw('DTT_EVT_start') < time() && $this->get_raw('DTT_EVT_end') > time());
791 791
 	}
792 792
 
793 793
 
@@ -797,7 +797,7 @@  discard block
 block discarded – undo
797 797
 	 * @return boolean
798 798
 	 */
799 799
 	public function is_expired() {
800
-		return ( $this->get_raw( 'DTT_EVT_end' ) < time() );
800
+		return ($this->get_raw('DTT_EVT_end') < time());
801 801
 	}
802 802
 
803 803
 
@@ -808,16 +808,16 @@  discard block
 block discarded – undo
808 808
 	 */
809 809
 	public function get_active_status() {
810 810
 		$total_tickets_for_this_dtt = $this->total_tickets_available_at_this_datetime();
811
-		if ( $total_tickets_for_this_dtt !== FALSE && $total_tickets_for_this_dtt < 1 ) {
811
+		if ($total_tickets_for_this_dtt !== FALSE && $total_tickets_for_this_dtt < 1) {
812 812
 			return EE_Datetime::sold_out;
813 813
 		}
814
-		if ( $this->is_expired() ) {
814
+		if ($this->is_expired()) {
815 815
 			return EE_Datetime::expired;
816 816
 		}
817
-		if ( $this->is_upcoming() ) {
817
+		if ($this->is_upcoming()) {
818 818
 			return EE_Datetime::upcoming;
819 819
 		}
820
-		if ( $this->is_active() ) {
820
+		if ($this->is_active()) {
821 821
 			return EE_Datetime::active;
822 822
 		}
823 823
 		return NULL;
@@ -831,24 +831,24 @@  discard block
 block discarded – undo
831 831
 	 * @param  boolean $use_dtt_name if TRUE then we'll use DTT->name() if its not empty.
832 832
 	 * @return string
833 833
 	 */
834
-	public function get_dtt_display_name( $use_dtt_name = FALSE ) {
835
-		if ( $use_dtt_name ) {
834
+	public function get_dtt_display_name($use_dtt_name = FALSE) {
835
+		if ($use_dtt_name) {
836 836
 			$dtt_name = $this->name();
837
-			if ( !empty( $dtt_name ) ) {
837
+			if ( ! empty($dtt_name)) {
838 838
 				return $dtt_name;
839 839
 			}
840 840
 		}
841 841
 		//first condition is to see if the months are different
842
-		if ( date( 'm', $this->get_raw( 'DTT_EVT_start' ) ) != date( 'm', $this->get_raw( 'DTT_EVT_end' ) ) ) {
843
-			$display_date = $this->start_date( 'M j\, Y g:i a' ) . ' - ' . $this->end_date( 'M j\, Y g:i a' );
842
+		if (date('m', $this->get_raw('DTT_EVT_start')) != date('m', $this->get_raw('DTT_EVT_end'))) {
843
+			$display_date = $this->start_date('M j\, Y g:i a').' - '.$this->end_date('M j\, Y g:i a');
844 844
 			//next condition is if its the same month but different day
845 845
 		}
846 846
 		else {
847
-			if ( date( 'm', $this->get_raw( 'DTT_EVT_start' ) ) == date( 'm', $this->get_raw( 'DTT_EVT_end' ) ) && date( 'd', $this->get_raw( 'DTT_EVT_start' ) ) != date( 'd', $this->get_raw( 'DTT_EVT_end' ) ) ) {
848
-				$display_date = $this->start_date( 'M j\, g:i a' ) . ' - ' . $this->end_date( 'M j\, g:i a Y' );
847
+			if (date('m', $this->get_raw('DTT_EVT_start')) == date('m', $this->get_raw('DTT_EVT_end')) && date('d', $this->get_raw('DTT_EVT_start')) != date('d', $this->get_raw('DTT_EVT_end'))) {
848
+				$display_date = $this->start_date('M j\, g:i a').' - '.$this->end_date('M j\, g:i a Y');
849 849
 			}
850 850
 			else {
851
-				$display_date = $this->start_date( 'F j\, Y' ) . ' @ ' . $this->start_date( 'g:i a' ) . ' - ' . $this->end_date( 'g:i a' );
851
+				$display_date = $this->start_date('F j\, Y').' @ '.$this->start_date('g:i a').' - '.$this->end_date('g:i a');
852 852
 			}
853 853
 		}
854 854
 		return $display_date;
@@ -862,8 +862,8 @@  discard block
 block discarded – undo
862 862
 *@param array $query_params see EEM_Base::get_all()
863 863
 	 * @return EE_Ticket[]
864 864
 	 */
865
-	public function tickets( $query_params = array() ) {
866
-		return $this->get_many_related( 'Ticket', $query_params );
865
+	public function tickets($query_params = array()) {
866
+		return $this->get_many_related('Ticket', $query_params);
867 867
 	}
868 868
 
869 869
 
@@ -873,21 +873,21 @@  discard block
 block discarded – undo
873 873
 	 * @param array $query_params like EEM_Base::get_all's
874 874
 	 * @return EE_Ticket[]
875 875
 	 */
876
-	public function ticket_types_available_for_purchase( $query_params = array() ) {
876
+	public function ticket_types_available_for_purchase($query_params = array()) {
877 877
 		// first check if datetime is valid
878
-		if ( ! ( $this->is_upcoming() || $this->is_active() ) || $this->sold_out() ) {
878
+		if ( ! ($this->is_upcoming() || $this->is_active()) || $this->sold_out()) {
879 879
 			return array();
880 880
 		}
881
-		if ( empty( $query_params ) ) {
881
+		if (empty($query_params)) {
882 882
 			$query_params = array(
883 883
 				array(
884
-					'TKT_start_date' => array( '<=', EEM_Ticket::instance()->current_time_for_query( 'TKT_start_date' ) ),
885
-					'TKT_end_date'   => array( '>=', EEM_Ticket::instance()->current_time_for_query( 'TKT_end_date' ) ),
884
+					'TKT_start_date' => array('<=', EEM_Ticket::instance()->current_time_for_query('TKT_start_date')),
885
+					'TKT_end_date'   => array('>=', EEM_Ticket::instance()->current_time_for_query('TKT_end_date')),
886 886
 					'TKT_deleted'    => false
887 887
 				)
888 888
 			);
889 889
 		}
890
-		return $this->tickets( $query_params );
890
+		return $this->tickets($query_params);
891 891
 	}
892 892
 
893 893
 
@@ -897,7 +897,7 @@  discard block
 block discarded – undo
897 897
 	 * @return EE_Event
898 898
 	 */
899 899
 	public function event() {
900
-		return $this->get_first_related( 'Event' );
900
+		return $this->get_first_related('Event');
901 901
 	}
902 902
 
903 903
 
@@ -909,13 +909,13 @@  discard block
 block discarded – undo
909 909
 	 */
910 910
 	public function update_sold() {
911 911
 		$count_regs_for_this_datetime = EEM_Registration::instance()->count(
912
-			array( array(
912
+			array(array(
913 913
 				'STS_ID' 					=> EEM_Registration::status_id_approved,
914 914
 				'REG_deleted' 				=> 0,
915 915
 				'Ticket.Datetime.DTT_ID' 	=> $this->ID(),
916
-			) )
916
+			))
917 917
 		);
918
-		$this->set( 'DTT_sold', $count_regs_for_this_datetime );
918
+		$this->set('DTT_sold', $count_regs_for_this_datetime);
919 919
 		$this->save();
920 920
 		return $count_regs_for_this_datetime;
921 921
 	}
Please login to merge, or discard this patch.
modules/single_page_checkout/inc/EE_SPCO_JSON_Response.php 1 patch
Spacing   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -107,71 +107,71 @@  discard block
 block discarded – undo
107 107
 	public function __toString() {
108 108
 		$JSON_response = array();
109 109
 		// grab notices
110
-		$notices = EE_Error::get_notices( FALSE );
111
-		$this->set_attention( isset( $notices['attention'] ) ? $notices['attention'] : '' );
112
-		$this->set_errors( isset( $notices['errors'] ) ? $notices['errors'] : '' );
113
-		$this->set_success( isset( $notices['success'] ) ? $notices['success'] : '' );
110
+		$notices = EE_Error::get_notices(FALSE);
111
+		$this->set_attention(isset($notices['attention']) ? $notices['attention'] : '');
112
+		$this->set_errors(isset($notices['errors']) ? $notices['errors'] : '');
113
+		$this->set_success(isset($notices['success']) ? $notices['success'] : '');
114 114
 		// add notices to JSON response, but only if they exist
115
-		if ( $this->attention() ) {
115
+		if ($this->attention()) {
116 116
 			$JSON_response['attention'] = $this->attention();
117 117
 		}
118
-		if ( $this->errors() ) {
118
+		if ($this->errors()) {
119 119
 			$JSON_response['errors'] = $this->errors();
120 120
 		}
121
-		if ( $this->unexpected_errors() ) {
121
+		if ($this->unexpected_errors()) {
122 122
 			$JSON_response['unexpected_errors'] = $this->unexpected_errors();
123 123
 		}
124
-		if ( $this->success() ) {
124
+		if ($this->success()) {
125 125
 			$JSON_response['success'] = $this->success();
126 126
 		}
127 127
 		// but if NO notices are set... at least set the "success" as a key so that the JS knows everything worked
128
-		if ( ! isset( $JSON_response[ 'attention' ] ) && ! isset( $JSON_response[ 'errors' ] ) && ! isset( $JSON_response[ 'success' ] ) ) {
128
+		if ( ! isset($JSON_response['attention']) && ! isset($JSON_response['errors']) && ! isset($JSON_response['success'])) {
129 129
 			$JSON_response['success'] = null;
130 130
 		}
131 131
 		// set redirect_url, IF it exists
132
-		if ( $this->redirect_url() ) {
132
+		if ($this->redirect_url()) {
133 133
 			$JSON_response['redirect_url'] = $this->redirect_url();
134 134
 		}
135 135
 		// set registration_time_limit, IF it exists
136
-		if ( $this->registration_time_limit() ) {
136
+		if ($this->registration_time_limit()) {
137 137
 			$JSON_response['registration_time_limit'] = $this->registration_time_limit();
138 138
 		}
139 139
 		// set payment_amount, IF it exists
140
-		if ( $this->payment_amount() !== null ) {
141
-			$JSON_response[ 'payment_amount' ] = $this->payment_amount();
140
+		if ($this->payment_amount() !== null) {
141
+			$JSON_response['payment_amount'] = $this->payment_amount();
142 142
 		}
143 143
 		// grab generic return data
144 144
 		$return_data = $this->return_data();
145 145
 		// add billing form validation rules
146
-		if ( $this->validation_rules() ) {
146
+		if ($this->validation_rules()) {
147 147
 			$return_data['validation_rules'] = $this->validation_rules();
148 148
 		}
149 149
 		// set reg_step_html, IF it exists
150
-		if ( $this->reg_step_html() ) {
150
+		if ($this->reg_step_html()) {
151 151
 			$return_data['reg_step_html'] = $this->reg_step_html();
152 152
 		}
153 153
 		// set method of payment, IF it exists
154
-		if ( $this->method_of_payment() ) {
154
+		if ($this->method_of_payment()) {
155 155
 			$return_data['method_of_payment'] = $this->method_of_payment();
156 156
 		}
157 157
 		// set "plz_select_method_of_payment" message, IF it exists
158
-		if ( $this->plz_select_method_of_payment() ) {
158
+		if ($this->plz_select_method_of_payment()) {
159 159
 			$return_data['plz_select_method_of_payment'] = $this->plz_select_method_of_payment();
160 160
 		}
161 161
 		// set redirect_form, IF it exists
162
-		if ( $this->redirect_form() ) {
162
+		if ($this->redirect_form()) {
163 163
 			$return_data['redirect_form'] = $this->redirect_form();
164 164
 		}
165 165
 		// and finally, add return_data array to main JSON response array, IF it contains anything
166 166
 		// why did we add some of the above properties to the return data array?
167 167
 		// because it is easier and cleaner in the Javascript to deal with this way
168
-		if ( ! empty( $return_data )) {
168
+		if ( ! empty($return_data)) {
169 169
 			$JSON_response['return_data'] = $return_data;
170 170
 		}
171 171
 		// filter final array
172
-		$JSON_response = apply_filters( 'FHEE__EE_SPCO_JSON_Response___toString__JSON_response', $JSON_response );
172
+		$JSON_response = apply_filters('FHEE__EE_SPCO_JSON_Response___toString__JSON_response', $JSON_response);
173 173
 		// return encoded array
174
-		return wp_json_encode( $JSON_response );
174
+		return wp_json_encode($JSON_response);
175 175
 	}
176 176
 
177 177
 
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
 	/**
180 180
 	 * @param string $attention
181 181
 	 */
182
-	public function set_attention( $attention ) {
182
+	public function set_attention($attention) {
183 183
 		$this->_attention = $attention;
184 184
 	}
185 185
 
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
 	/**
198 198
 	 * @param string $errors
199 199
 	 */
200
-	public function set_errors( $errors ) {
200
+	public function set_errors($errors) {
201 201
 		$this->_errors = $errors;
202 202
 	}
203 203
 
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
 	/**
225 225
 	 * @param string $unexpected_errors
226 226
 	 */
227
-	public function set_unexpected_errors( $unexpected_errors ) {
227
+	public function set_unexpected_errors($unexpected_errors) {
228 228
 		$this->_unexpected_errors = $unexpected_errors;
229 229
 	}
230 230
 
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
 	/**
234 234
 	 * @param string $success
235 235
 	 */
236
-	public function set_success( $success ) {
236
+	public function set_success($success) {
237 237
 		$this->_success = $success;
238 238
 	}
239 239
 
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
 	/**
252 252
 	 * @param string $method_of_payment
253 253
 	 */
254
-	public function set_method_of_payment( $method_of_payment ) {
254
+	public function set_method_of_payment($method_of_payment) {
255 255
 		$this->_method_of_payment = $method_of_payment;
256 256
 	}
257 257
 
@@ -278,8 +278,8 @@  discard block
 block discarded – undo
278 278
 	/**
279 279
 	 * @param float $payment_amount
280 280
 	 */
281
-	public function set_payment_amount( $payment_amount ) {
282
-		$this->_payment_amount = EEH_Money::convert_to_float_from_localized_money( $payment_amount );
281
+	public function set_payment_amount($payment_amount) {
282
+		$this->_payment_amount = EEH_Money::convert_to_float_from_localized_money($payment_amount);
283 283
 	}
284 284
 
285 285
 
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
 	/**
288 288
 	 * @param string $next_step_html
289 289
 	 */
290
-	public function set_reg_step_html( $next_step_html ) {
290
+	public function set_reg_step_html($next_step_html) {
291 291
 		$this->_reg_step_html = $next_step_html;
292 292
 	}
293 293
 
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
 	/**
306 306
 	 * @param string $redirect_form
307 307
 	 */
308
-	public function set_redirect_form( $redirect_form ) {
308
+	public function set_redirect_form($redirect_form) {
309 309
 		$this->_redirect_form = $redirect_form;
310 310
 	}
311 311
 
@@ -315,7 +315,7 @@  discard block
 block discarded – undo
315 315
 	 * @return string
316 316
 	 */
317 317
 	public function redirect_form() {
318
-		return ! empty( $this->_redirect_form ) ? $this->_redirect_form : FALSE;
318
+		return ! empty($this->_redirect_form) ? $this->_redirect_form : FALSE;
319 319
 	}
320 320
 
321 321
 
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
 	/**
324 324
 	 * @param string $plz_select_method_of_payment
325 325
 	 */
326
-	public function set_plz_select_method_of_payment( $plz_select_method_of_payment ) {
326
+	public function set_plz_select_method_of_payment($plz_select_method_of_payment) {
327 327
 		$this->_plz_select_method_of_payment = $plz_select_method_of_payment;
328 328
 	}
329 329
 
@@ -341,7 +341,7 @@  discard block
 block discarded – undo
341 341
 	/**
342 342
 	 * @param string $redirect_url
343 343
 	 */
344
-	public function set_redirect_url( $redirect_url ) {
344
+	public function set_redirect_url($redirect_url) {
345 345
 		$this->_redirect_url = $redirect_url;
346 346
 	}
347 347
 
@@ -368,7 +368,7 @@  discard block
 block discarded – undo
368 368
 	/**
369 369
 	 * @param string $registration_time_limit
370 370
 	 */
371
-	public function set_registration_time_limit( $registration_time_limit ) {
371
+	public function set_registration_time_limit($registration_time_limit) {
372 372
 		$this->_registration_time_limit = $registration_time_limit;
373 373
 	}
374 374
 
@@ -377,8 +377,8 @@  discard block
 block discarded – undo
377 377
 	/**
378 378
 	 * @param array $return_data
379 379
 	 */
380
-	public function set_return_data( $return_data ) {
381
-		$this->_return_data = array_merge( $this->_return_data, $return_data );
380
+	public function set_return_data($return_data) {
381
+		$this->_return_data = array_merge($this->_return_data, $return_data);
382 382
 	}
383 383
 
384 384
 
@@ -395,9 +395,9 @@  discard block
 block discarded – undo
395 395
 	/**
396 396
 	 * @param array $validation_rules
397 397
 	 */
398
-	public function add_validation_rules( $validation_rules = array() ) {
399
-		if ( is_array( $validation_rules ) && ! empty( $validation_rules )) {
400
-			$this->_validation_rules = array_merge( $this->_validation_rules, $validation_rules );
398
+	public function add_validation_rules($validation_rules = array()) {
399
+		if (is_array($validation_rules) && ! empty($validation_rules)) {
400
+			$this->_validation_rules = array_merge($this->_validation_rules, $validation_rules);
401 401
 		}
402 402
 	}
403 403
 
@@ -407,7 +407,7 @@  discard block
 block discarded – undo
407 407
 	 * @return array | bool
408 408
 	 */
409 409
 	public function validation_rules() {
410
-		return ! empty( $this->_validation_rules ) ? $this->_validation_rules : FALSE;
410
+		return ! empty($this->_validation_rules) ? $this->_validation_rules : FALSE;
411 411
 	}
412 412
 
413 413
 
Please login to merge, or discard this patch.
core/data_migration_scripts/EE_DMS_Core_4_9_0.dms.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
 //unfortunately, this needs to be done upon INCLUSION of this file,
10 10
 //instead of construction, because it only gets constructed on first page load
11 11
 //(all other times it gets resurrected from a wordpress option)
12
-$stages = glob(EE_CORE . 'data_migration_scripts/4_9_0_stages/*');
12
+$stages = glob(EE_CORE.'data_migration_scripts/4_9_0_stages/*');
13 13
 $class_to_filepath = array();
14 14
 foreach ($stages as $filepath) {
15 15
     $matches = array();
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
         } elseif ( ! $version_string) {
68 68
             //			echo "no version string provided: $version_string";
69 69
             //no version string provided... this must be pre 4.3
70
-            return false;//changed mind. dont want people thinking they should migrate yet because they cant
70
+            return false; //changed mind. dont want people thinking they should migrate yet because they cant
71 71
         } else {
72 72
             //			echo "$version_string doesnt apply";
73 73
             return false;
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
      */
92 92
     public function schema_changes_before_migration()
93 93
     {
94
-        require_once(EE_HELPERS . 'EEH_Activation.helper.php');
94
+        require_once(EE_HELPERS.'EEH_Activation.helper.php');
95 95
         $now_in_mysql = current_time('mysql', true);
96 96
         $table_name = 'esp_answer';
97 97
         $sql = " ANS_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
@@ -674,13 +674,13 @@  discard block
 block discarded – undo
674 674
         );
675 675
         foreach ($addon_tables as $table_name) {
676 676
             $complete_table_name = $this->_table_analysis->ensureTableNameHasPrefix($table_name);
677
-            if($this->_table_analysis->tableExists( $complete_table_name )){
677
+            if ($this->_table_analysis->tableExists($complete_table_name)) {
678 678
                 $tables_to_check[] = $complete_table_name;
679 679
             }
680 680
         }
681 681
         $tables_to_check = array_unique($tables_to_check);
682 682
         foreach ($tables_to_check as $table_name) {
683
-            if ( ! apply_filters('FHEE__EE_DMS_Core_4_9_0__verify_db_collations__check_overridden', false, $table_name ) ) {
683
+            if ( ! apply_filters('FHEE__EE_DMS_Core_4_9_0__verify_db_collations__check_overridden', false, $table_name)) {
684 684
                 maybe_convert_table_to_utf8mb4($table_name);
685 685
             }
686 686
         }
Please login to merge, or discard this patch.
Indentation   +247 added lines, -247 removed lines patch added patch discarded remove patch
@@ -12,9 +12,9 @@  discard block
 block discarded – undo
12 12
 $stages = glob(EE_CORE . 'data_migration_scripts/4_9_0_stages/*');
13 13
 $class_to_filepath = array();
14 14
 foreach ($stages as $filepath) {
15
-    $matches = array();
16
-    preg_match('~4_9_0_stages/(.*).dmsstage.php~', $filepath, $matches);
17
-    $class_to_filepath[$matches[1]] = $filepath;
15
+	$matches = array();
16
+	preg_match('~4_9_0_stages/(.*).dmsstage.php~', $filepath, $matches);
17
+	$class_to_filepath[$matches[1]] = $filepath;
18 18
 }
19 19
 //give addons a chance to autoload their stages too
20 20
 $class_to_filepath = apply_filters('FHEE__EE_DMS_4_9_0__autoloaded_stages', $class_to_filepath);
@@ -33,67 +33,67 @@  discard block
 block discarded – undo
33 33
 class EE_DMS_Core_4_9_0 extends EE_Data_Migration_Script_Base
34 34
 {
35 35
 
36
-    /**
37
-     * return EE_DMS_Core_4_9_0
38
-     *
39
-     * @param TableManager  $table_manager
40
-     * @param TableAnalysis $table_analysis
41
-     */
42
-    public function __construct(TableManager $table_manager = null, TableAnalysis $table_analysis = null)
43
-    {
44
-        $this->_pretty_name = esc_html__("Data Update to Event Espresso 4.9.0", "event_espresso");
45
-        $this->_priority = 10;
46
-        $this->_migration_stages = array(
47
-            new EE_DMS_4_9_0_Email_System_Question(),
48
-            new EE_DMS_4_9_0_Answers_With_No_Registration(),
49
-        );
50
-        parent::__construct($table_manager, $table_analysis);
51
-    }
36
+	/**
37
+	 * return EE_DMS_Core_4_9_0
38
+	 *
39
+	 * @param TableManager  $table_manager
40
+	 * @param TableAnalysis $table_analysis
41
+	 */
42
+	public function __construct(TableManager $table_manager = null, TableAnalysis $table_analysis = null)
43
+	{
44
+		$this->_pretty_name = esc_html__("Data Update to Event Espresso 4.9.0", "event_espresso");
45
+		$this->_priority = 10;
46
+		$this->_migration_stages = array(
47
+			new EE_DMS_4_9_0_Email_System_Question(),
48
+			new EE_DMS_4_9_0_Answers_With_No_Registration(),
49
+		);
50
+		parent::__construct($table_manager, $table_analysis);
51
+	}
52 52
 
53 53
 
54 54
 
55
-    /**
56
-     * Whether to migrate or not.
57
-     *
58
-     * @param array $version_array
59
-     * @return bool
60
-     */
61
-    public function can_migrate_from_version($version_array)
62
-    {
63
-        $version_string = $version_array['Core'];
64
-        if (version_compare($version_string, '4.9.0', '<=') && version_compare($version_string, '4.8.0', '>=')) {
65
-            //			echo "$version_string can be migrated from";
66
-            return true;
67
-        } elseif ( ! $version_string) {
68
-            //			echo "no version string provided: $version_string";
69
-            //no version string provided... this must be pre 4.3
70
-            return false;//changed mind. dont want people thinking they should migrate yet because they cant
71
-        } else {
72
-            //			echo "$version_string doesnt apply";
73
-            return false;
74
-        }
75
-    }
55
+	/**
56
+	 * Whether to migrate or not.
57
+	 *
58
+	 * @param array $version_array
59
+	 * @return bool
60
+	 */
61
+	public function can_migrate_from_version($version_array)
62
+	{
63
+		$version_string = $version_array['Core'];
64
+		if (version_compare($version_string, '4.9.0', '<=') && version_compare($version_string, '4.8.0', '>=')) {
65
+			//			echo "$version_string can be migrated from";
66
+			return true;
67
+		} elseif ( ! $version_string) {
68
+			//			echo "no version string provided: $version_string";
69
+			//no version string provided... this must be pre 4.3
70
+			return false;//changed mind. dont want people thinking they should migrate yet because they cant
71
+		} else {
72
+			//			echo "$version_string doesnt apply";
73
+			return false;
74
+		}
75
+	}
76 76
 
77 77
 
78 78
 
79
-    /**
80
-     * @return bool
81
-     */
82
-    public function schema_changes_before_migration()
83
-    {
84
-        require_once(EE_HELPERS . 'EEH_Activation.helper.php');
85
-        $now_in_mysql = current_time('mysql', true);
86
-        $table_name = 'esp_answer';
87
-        $sql = " ANS_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
79
+	/**
80
+	 * @return bool
81
+	 */
82
+	public function schema_changes_before_migration()
83
+	{
84
+		require_once(EE_HELPERS . 'EEH_Activation.helper.php');
85
+		$now_in_mysql = current_time('mysql', true);
86
+		$table_name = 'esp_answer';
87
+		$sql = " ANS_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
88 88
 					REG_ID int(10) unsigned NOT NULL,
89 89
 					QST_ID int(10) unsigned NOT NULL,
90 90
 					ANS_value text NOT NULL,
91 91
 					PRIMARY KEY  (ANS_ID),
92 92
 					KEY REG_ID (REG_ID),
93 93
 					KEY QST_ID (QST_ID)";
94
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
95
-        $table_name = 'esp_attendee_meta';
96
-        $sql = "ATTM_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
94
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
95
+		$table_name = 'esp_attendee_meta';
96
+		$sql = "ATTM_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
97 97
 				ATT_ID bigint(20) unsigned NOT NULL,
98 98
 				ATT_fname varchar(45) NOT NULL,
99 99
 				ATT_lname varchar(45) NOT	NULL,
@@ -110,9 +110,9 @@  discard block
 block discarded – undo
110 110
 				KEY ATT_email (ATT_email),
111 111
 				KEY ATT_lname (ATT_lname),
112 112
 				KEY ATT_fname (ATT_fname)";
113
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB ');
114
-        $table_name = 'esp_checkin';
115
-        $sql = "CHK_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
113
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB ');
114
+		$table_name = 'esp_checkin';
115
+		$sql = "CHK_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
116 116
 				REG_ID int(10) unsigned NOT NULL,
117 117
 				DTT_ID int(10) unsigned NOT NULL,
118 118
 				CHK_in tinyint(1) unsigned NOT NULL DEFAULT 1,
@@ -120,9 +120,9 @@  discard block
 block discarded – undo
120 120
 				PRIMARY KEY  (CHK_ID),
121 121
 				KEY REG_ID (REG_ID),
122 122
 				KEY DTT_ID (DTT_ID)";
123
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
124
-        $table_name = 'esp_country';
125
-        $sql = "CNT_ISO varchar(2) NOT NULL,
123
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
124
+		$table_name = 'esp_country';
125
+		$sql = "CNT_ISO varchar(2) NOT NULL,
126 126
 				CNT_ISO3 varchar(3) NOT NULL,
127 127
 				RGN_ID tinyint(3) unsigned DEFAULT NULL,
128 128
 				CNT_name varchar(45) NOT NULL,
@@ -138,25 +138,25 @@  discard block
 block discarded – undo
138 138
 				CNT_is_EU tinyint(1) DEFAULT '0',
139 139
 				CNT_active tinyint(1) DEFAULT '0',
140 140
 				PRIMARY KEY  (CNT_ISO)";
141
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
142
-        $table_name = 'esp_currency';
143
-        $sql = "CUR_code varchar(6) NOT NULL,
141
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
142
+		$table_name = 'esp_currency';
143
+		$sql = "CUR_code varchar(6) NOT NULL,
144 144
 				CUR_single varchar(45) DEFAULT 'dollar',
145 145
 				CUR_plural varchar(45) DEFAULT 'dollars',
146 146
 				CUR_sign varchar(45) DEFAULT '$',
147 147
 				CUR_dec_plc varchar(1) NOT NULL DEFAULT '2',
148 148
 				CUR_active tinyint(1) DEFAULT '0',
149 149
 				PRIMARY KEY  (CUR_code)";
150
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
151
-        $table_name = 'esp_currency_payment_method';
152
-        $sql = "CPM_ID int(11) NOT NULL AUTO_INCREMENT,
150
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
151
+		$table_name = 'esp_currency_payment_method';
152
+		$sql = "CPM_ID int(11) NOT NULL AUTO_INCREMENT,
153 153
 				CUR_code varchar(6) NOT NULL,
154 154
 				PMD_ID int(11) NOT NULL,
155 155
 				PRIMARY KEY  (CPM_ID),
156 156
 				KEY PMD_ID (PMD_ID)";
157
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB ');
158
-        $table_name = 'esp_datetime';
159
-        $sql = "DTT_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
157
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB ');
158
+		$table_name = 'esp_datetime';
159
+		$sql = "DTT_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
160 160
 				EVT_ID bigint(20) unsigned NOT NULL,
161 161
 				DTT_name varchar(255) NOT NULL DEFAULT '',
162 162
 				DTT_description text NOT NULL,
@@ -173,25 +173,25 @@  discard block
 block discarded – undo
173 173
 				KEY DTT_EVT_start (DTT_EVT_start),
174 174
 				KEY EVT_ID (EVT_ID),
175 175
 				KEY DTT_is_primary (DTT_is_primary)";
176
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
177
-        $table_name = "esp_datetime_ticket";
178
-        $sql = "DTK_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
176
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
177
+		$table_name = "esp_datetime_ticket";
178
+		$sql = "DTK_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
179 179
 				DTT_ID int(10) unsigned NOT NULL,
180 180
 				TKT_ID int(10) unsigned NOT NULL,
181 181
 				PRIMARY KEY  (DTK_ID),
182 182
 				KEY DTT_ID (DTT_ID),
183 183
 				KEY TKT_ID (TKT_ID)";
184
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
185
-        $table_name = 'esp_event_message_template';
186
-        $sql = "EMT_ID bigint(20) unsigned NOT NULL AUTO_INCREMENT,
184
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
185
+		$table_name = 'esp_event_message_template';
186
+		$sql = "EMT_ID bigint(20) unsigned NOT NULL AUTO_INCREMENT,
187 187
 				EVT_ID bigint(20) unsigned NOT NULL DEFAULT 0,
188 188
 				GRP_ID int(10) unsigned NOT NULL DEFAULT 0,
189 189
 				PRIMARY KEY  (EMT_ID),
190 190
 				KEY EVT_ID (EVT_ID),
191 191
 				KEY GRP_ID (GRP_ID)";
192
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
193
-        $table_name = 'esp_event_meta';
194
-        $sql = "EVTM_ID int(10) NOT NULL AUTO_INCREMENT,
192
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
193
+		$table_name = 'esp_event_meta';
194
+		$sql = "EVTM_ID int(10) NOT NULL AUTO_INCREMENT,
195 195
 				EVT_ID bigint(20) unsigned NOT NULL,
196 196
 				EVT_display_desc tinyint(1) unsigned NOT NULL DEFAULT 1,
197 197
 				EVT_display_ticket_selector tinyint(1) unsigned NOT NULL DEFAULT 1,
@@ -206,34 +206,34 @@  discard block
 block discarded – undo
206 206
 				EVT_donations tinyint(1) NULL,
207 207
 				PRIMARY KEY  (EVTM_ID),
208 208
 				KEY EVT_ID (EVT_ID)";
209
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
210
-        $table_name = 'esp_event_question_group';
211
-        $sql = "EQG_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
209
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
210
+		$table_name = 'esp_event_question_group';
211
+		$sql = "EQG_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
212 212
 				EVT_ID bigint(20) unsigned NOT NULL,
213 213
 				QSG_ID int(10) unsigned NOT NULL,
214 214
 				EQG_primary tinyint(1) unsigned NOT NULL DEFAULT 0,
215 215
 				PRIMARY KEY  (EQG_ID),
216 216
 				KEY EVT_ID (EVT_ID),
217 217
 				KEY QSG_ID (QSG_ID)";
218
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
219
-        $table_name = 'esp_event_venue';
220
-        $sql = "EVV_ID int(11) NOT NULL AUTO_INCREMENT,
218
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
219
+		$table_name = 'esp_event_venue';
220
+		$sql = "EVV_ID int(11) NOT NULL AUTO_INCREMENT,
221 221
 				EVT_ID bigint(20) unsigned NOT NULL,
222 222
 				VNU_ID bigint(20) unsigned NOT NULL,
223 223
 				EVV_primary tinyint(1) unsigned NOT NULL DEFAULT 0,
224 224
 				PRIMARY KEY  (EVV_ID)";
225
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
226
-        $table_name = 'esp_extra_meta';
227
-        $sql = "EXM_ID int(11) NOT NULL AUTO_INCREMENT,
225
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
226
+		$table_name = 'esp_extra_meta';
227
+		$sql = "EXM_ID int(11) NOT NULL AUTO_INCREMENT,
228 228
 				OBJ_ID int(11) DEFAULT NULL,
229 229
 				EXM_type varchar(45) DEFAULT NULL,
230 230
 				EXM_key varchar(45) DEFAULT NULL,
231 231
 				EXM_value text,
232 232
 				PRIMARY KEY  (EXM_ID),
233 233
 				KEY EXM_type (EXM_type,OBJ_ID,EXM_key)";
234
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
235
-        $table_name = 'esp_extra_join';
236
-        $sql = "EXJ_ID int(11) NOT NULL AUTO_INCREMENT,
234
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
235
+		$table_name = 'esp_extra_join';
236
+		$sql = "EXJ_ID int(11) NOT NULL AUTO_INCREMENT,
237 237
 				EXJ_first_model_id varchar(6) NOT NULL,
238 238
 				EXJ_first_model_name varchar(20) NOT NULL,
239 239
 				EXJ_second_model_id varchar(6) NOT NULL,
@@ -241,9 +241,9 @@  discard block
 block discarded – undo
241 241
 				PRIMARY KEY  (EXJ_ID),
242 242
 				KEY first_model (EXJ_first_model_name,EXJ_first_model_id),
243 243
 				KEY second_model (EXJ_second_model_name,EXJ_second_model_id)";
244
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB ');
245
-        $table_name = 'esp_line_item';
246
-        $sql = "LIN_ID int(11) NOT NULL AUTO_INCREMENT,
244
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB ');
245
+		$table_name = 'esp_line_item';
246
+		$sql = "LIN_ID int(11) NOT NULL AUTO_INCREMENT,
247 247
 				LIN_code varchar(245) NOT NULL DEFAULT '',
248 248
 				TXN_ID int(11) DEFAULT NULL,
249 249
 				LIN_name varchar(245) NOT NULL DEFAULT '',
@@ -262,9 +262,9 @@  discard block
 block discarded – undo
262 262
 				PRIMARY KEY  (LIN_ID),
263 263
 				KEY LIN_code (LIN_code(191)),
264 264
 				KEY TXN_ID (TXN_ID)";
265
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
266
-        $table_name = 'esp_log';
267
-        $sql = "LOG_ID int(11) NOT NULL AUTO_INCREMENT,
265
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
266
+		$table_name = 'esp_log';
267
+		$sql = "LOG_ID int(11) NOT NULL AUTO_INCREMENT,
268 268
 				LOG_time datetime DEFAULT NULL,
269 269
 				OBJ_ID varchar(45) DEFAULT NULL,
270 270
 				OBJ_type varchar(45) DEFAULT NULL,
@@ -275,9 +275,9 @@  discard block
 block discarded – undo
275 275
 				KEY LOG_time (LOG_time),
276 276
 				KEY OBJ (OBJ_type,OBJ_ID),
277 277
 				KEY LOG_type (LOG_type)";
278
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
279
-        $table_name = 'esp_message';
280
-        $sql = "MSG_ID bigint(20) unsigned NOT NULL AUTO_INCREMENT,
278
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
279
+		$table_name = 'esp_message';
280
+		$sql = "MSG_ID bigint(20) unsigned NOT NULL AUTO_INCREMENT,
281 281
 				GRP_ID int(10) unsigned NULL,
282 282
 				MSG_token varchar(255) NULL,
283 283
 				TXN_ID int(10) unsigned NULL,
@@ -309,18 +309,18 @@  discard block
 block discarded – undo
309 309
 				KEY STS_ID (STS_ID),
310 310
 				KEY MSG_created (MSG_created),
311 311
 				KEY MSG_modified (MSG_modified)";
312
-        $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
313
-        $table_name = 'esp_message_template';
314
-        $sql = "MTP_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
312
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
313
+		$table_name = 'esp_message_template';
314
+		$sql = "MTP_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
315 315
 				GRP_ID int(10) unsigned NOT NULL,
316 316
 				MTP_context varchar(50) NOT NULL,
317 317
 				MTP_template_field varchar(30) NOT NULL,
318 318
 				MTP_content text NOT NULL,
319 319
 				PRIMARY KEY  (MTP_ID),
320 320
 				KEY GRP_ID (GRP_ID)";
321
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
322
-        $table_name = 'esp_message_template_group';
323
-        $sql = "GRP_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
321
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
322
+		$table_name = 'esp_message_template_group';
323
+		$sql = "GRP_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
324 324
 				MTP_user_id int(10) NOT NULL DEFAULT '1',
325 325
 				MTP_name varchar(245) NOT NULL DEFAULT '',
326 326
 				MTP_description varchar(245) NOT NULL DEFAULT '',
@@ -332,9 +332,9 @@  discard block
 block discarded – undo
332 332
 				MTP_is_active tinyint(1) NOT NULL DEFAULT '1',
333 333
 				PRIMARY KEY  (GRP_ID),
334 334
 				KEY MTP_user_id (MTP_user_id)";
335
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
336
-        $table_name = 'esp_payment';
337
-        $sql = "PAY_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
335
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
336
+		$table_name = 'esp_payment';
337
+		$sql = "PAY_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
338 338
 				TXN_ID int(10) unsigned DEFAULT NULL,
339 339
 				STS_ID varchar(3) DEFAULT NULL,
340 340
 				PAY_timestamp datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
@@ -351,9 +351,9 @@  discard block
 block discarded – undo
351 351
 				PRIMARY KEY  (PAY_ID),
352 352
 				KEY PAY_timestamp (PAY_timestamp),
353 353
 				KEY TXN_ID (TXN_ID)";
354
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB ');
355
-        $table_name = 'esp_payment_method';
356
-        $sql = "PMD_ID int(11) NOT NULL AUTO_INCREMENT,
354
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB ');
355
+		$table_name = 'esp_payment_method';
356
+		$sql = "PMD_ID int(11) NOT NULL AUTO_INCREMENT,
357 357
 				PMD_type varchar(124) DEFAULT NULL,
358 358
 				PMD_name varchar(255) DEFAULT NULL,
359 359
 				PMD_desc text,
@@ -369,24 +369,24 @@  discard block
 block discarded – undo
369 369
 				PRIMARY KEY  (PMD_ID),
370 370
 				UNIQUE KEY PMD_slug_UNIQUE (PMD_slug),
371 371
 				KEY PMD_type (PMD_type)";
372
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB ');
373
-        $table_name = "esp_ticket_price";
374
-        $sql = "TKP_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
372
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB ');
373
+		$table_name = "esp_ticket_price";
374
+		$sql = "TKP_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
375 375
 				TKT_ID int(10) unsigned NOT NULL,
376 376
 				PRC_ID int(10) unsigned NOT NULL,
377 377
 				PRIMARY KEY  (TKP_ID),
378 378
 				KEY TKT_ID (TKT_ID),
379 379
 				KEY PRC_ID (PRC_ID)";
380
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
381
-        $table_name = "esp_ticket_template";
382
-        $sql = "TTM_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
380
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
381
+		$table_name = "esp_ticket_template";
382
+		$sql = "TTM_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
383 383
 				TTM_name varchar(45) NOT NULL,
384 384
 				TTM_description text,
385 385
 				TTM_file varchar(45),
386 386
 				PRIMARY KEY  (TTM_ID)";
387
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
388
-        $table_name = 'esp_question';
389
-        $sql = 'QST_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
387
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
388
+		$table_name = 'esp_question';
389
+		$sql = 'QST_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
390 390
 				QST_display_text text NOT NULL,
391 391
 				QST_admin_label varchar(255) NOT NULL,
392 392
 				QST_system varchar(25) DEFAULT NULL,
@@ -400,18 +400,18 @@  discard block
 block discarded – undo
400 400
 				QST_deleted tinyint(2) unsigned NOT NULL DEFAULT 0,
401 401
 				PRIMARY KEY  (QST_ID),
402 402
 				KEY QST_order (QST_order)';
403
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
404
-        $table_name = 'esp_question_group_question';
405
-        $sql = "QGQ_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
403
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
404
+		$table_name = 'esp_question_group_question';
405
+		$sql = "QGQ_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
406 406
 				QSG_ID int(10) unsigned NOT NULL,
407 407
 				QST_ID int(10) unsigned NOT NULL,
408 408
 				QGQ_order int(10) unsigned NOT NULL DEFAULT 0,
409 409
 				PRIMARY KEY  (QGQ_ID),
410 410
 				KEY QST_ID (QST_ID),
411 411
 				KEY QSG_ID_order (QSG_ID,QGQ_order)";
412
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
413
-        $table_name = 'esp_question_option';
414
-        $sql = "QSO_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
412
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
413
+		$table_name = 'esp_question_option';
414
+		$sql = "QSO_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
415 415
 				QSO_value varchar(255) NOT NULL,
416 416
 				QSO_desc text NOT NULL,
417 417
 				QST_ID int(10) unsigned NOT NULL,
@@ -421,9 +421,9 @@  discard block
 block discarded – undo
421 421
 				PRIMARY KEY  (QSO_ID),
422 422
 				KEY QST_ID (QST_ID),
423 423
 				KEY QSO_order (QSO_order)";
424
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
425
-        $table_name = 'esp_registration';
426
-        $sql = "REG_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
424
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
425
+		$table_name = 'esp_registration';
426
+		$sql = "REG_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
427 427
 				EVT_ID bigint(20) unsigned NOT NULL,
428 428
 				ATT_ID bigint(20) unsigned NOT NULL,
429 429
 				TXN_ID int(10) unsigned NOT NULL,
@@ -447,18 +447,18 @@  discard block
 block discarded – undo
447 447
 				KEY TKT_ID (TKT_ID),
448 448
 				KEY EVT_ID (EVT_ID),
449 449
 				KEY STS_ID (STS_ID)";
450
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB ');
451
-        $table_name = 'esp_registration_payment';
452
-        $sql = "RPY_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
450
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB ');
451
+		$table_name = 'esp_registration_payment';
452
+		$sql = "RPY_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
453 453
 					  REG_ID int(10) unsigned NOT NULL,
454 454
 					  PAY_ID int(10) unsigned NULL,
455 455
 					  RPY_amount decimal(10,3) NOT NULL DEFAULT '0.00',
456 456
 					  PRIMARY KEY  (RPY_ID),
457 457
 					  KEY REG_ID (REG_ID),
458 458
 					  KEY PAY_ID (PAY_ID)";
459
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB ');
460
-        $table_name = 'esp_state';
461
-        $sql = "STA_ID smallint(5) unsigned NOT NULL AUTO_INCREMENT,
459
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB ');
460
+		$table_name = 'esp_state';
461
+		$sql = "STA_ID smallint(5) unsigned NOT NULL AUTO_INCREMENT,
462 462
 				CNT_ISO varchar(2) NOT NULL,
463 463
 				STA_abbrev varchar(24) NOT NULL,
464 464
 				STA_name varchar(100) NOT NULL,
@@ -466,9 +466,9 @@  discard block
 block discarded – undo
466 466
 				PRIMARY KEY  (STA_ID),
467 467
 				KEY STA_abbrev (STA_abbrev),
468 468
 				KEY CNT_ISO (CNT_ISO)";
469
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
470
-        $table_name = 'esp_status';
471
-        $sql = "STS_ID varchar(3) NOT NULL,
469
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
470
+		$table_name = 'esp_status';
471
+		$sql = "STS_ID varchar(3) NOT NULL,
472 472
 				STS_code varchar(45) NOT NULL,
473 473
 				STS_type varchar(45) NOT NULL,
474 474
 				STS_can_edit tinyint(1) NOT NULL DEFAULT 0,
@@ -476,9 +476,9 @@  discard block
 block discarded – undo
476 476
 				STS_open tinyint(1) NOT NULL DEFAULT 1,
477 477
 				UNIQUE KEY STS_ID_UNIQUE (STS_ID),
478 478
 				KEY STS_type (STS_type)";
479
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
480
-        $table_name = 'esp_transaction';
481
-        $sql = "TXN_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
479
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
480
+		$table_name = 'esp_transaction';
481
+		$sql = "TXN_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
482 482
 				TXN_timestamp datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
483 483
 				TXN_total decimal(10,3) DEFAULT '0.00',
484 484
 				TXN_paid decimal(10,3) NOT NULL DEFAULT '0.00',
@@ -490,9 +490,9 @@  discard block
 block discarded – undo
490 490
 				PRIMARY KEY  (TXN_ID),
491 491
 				KEY TXN_timestamp (TXN_timestamp),
492 492
 				KEY STS_ID (STS_ID)";
493
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
494
-        $table_name = 'esp_venue_meta';
495
-        $sql = "VNUM_ID int(11) NOT NULL AUTO_INCREMENT,
493
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
494
+		$table_name = 'esp_venue_meta';
495
+		$sql = "VNUM_ID int(11) NOT NULL AUTO_INCREMENT,
496 496
 			VNU_ID bigint(20) unsigned NOT NULL DEFAULT 0,
497 497
 			VNU_address varchar(255) DEFAULT NULL,
498 498
 			VNU_address2 varchar(255) DEFAULT NULL,
@@ -511,10 +511,10 @@  discard block
 block discarded – undo
511 511
 			KEY VNU_ID (VNU_ID),
512 512
 			KEY STA_ID (STA_ID),
513 513
 			KEY CNT_ISO (CNT_ISO)";
514
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
515
-        //modified tables
516
-        $table_name = "esp_price";
517
-        $sql = "PRC_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
514
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
515
+		//modified tables
516
+		$table_name = "esp_price";
517
+		$sql = "PRC_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
518 518
 				PRT_ID tinyint(3) unsigned NOT NULL,
519 519
 				PRC_amount decimal(10,3) NOT NULL DEFAULT '0.00',
520 520
 				PRC_name varchar(245) NOT NULL,
@@ -527,9 +527,9 @@  discard block
 block discarded – undo
527 527
 				PRC_parent int(10) unsigned DEFAULT 0,
528 528
 				PRIMARY KEY  (PRC_ID),
529 529
 				KEY PRT_ID (PRT_ID)";
530
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
531
-        $table_name = "esp_price_type";
532
-        $sql = "PRT_ID tinyint(3) unsigned NOT NULL AUTO_INCREMENT,
530
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
531
+		$table_name = "esp_price_type";
532
+		$sql = "PRT_ID tinyint(3) unsigned NOT NULL AUTO_INCREMENT,
533 533
 				PRT_name varchar(45) NOT NULL,
534 534
 				PBT_ID tinyint(3) unsigned NOT NULL DEFAULT '1',
535 535
 				PRT_is_percent tinyint(1) NOT NULL DEFAULT '0',
@@ -538,9 +538,9 @@  discard block
 block discarded – undo
538 538
 				PRT_deleted tinyint(1) NOT NULL DEFAULT '0',
539 539
 				UNIQUE KEY PRT_name_UNIQUE (PRT_name),
540 540
 				PRIMARY KEY  (PRT_ID)";
541
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB ');
542
-        $table_name = "esp_ticket";
543
-        $sql = "TKT_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
541
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB ');
542
+		$table_name = "esp_ticket";
543
+		$sql = "TKT_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
544 544
 				TTM_ID int(10) unsigned NOT NULL,
545 545
 				TKT_name varchar(245) NOT NULL DEFAULT '',
546 546
 				TKT_description text NOT NULL,
@@ -563,9 +563,9 @@  discard block
 block discarded – undo
563 563
 				TKT_deleted tinyint(1) NOT NULL DEFAULT '0',
564 564
 				PRIMARY KEY  (TKT_ID),
565 565
 				KEY TKT_start_date (TKT_start_date)";
566
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
567
-        $table_name = 'esp_question_group';
568
-        $sql = 'QSG_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
566
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
567
+		$table_name = 'esp_question_group';
568
+		$sql = 'QSG_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
569 569
 				QSG_name varchar(255) NOT NULL,
570 570
 				QSG_identifier varchar(100) NOT NULL,
571 571
 				QSG_desc text NULL,
@@ -578,105 +578,105 @@  discard block
 block discarded – undo
578 578
 				PRIMARY KEY  (QSG_ID),
579 579
 				UNIQUE KEY QSG_identifier_UNIQUE (QSG_identifier),
580 580
 				KEY QSG_order (QSG_order)';
581
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
582
-        /** @var EE_DMS_Core_4_1_0 $script_4_1_defaults */
583
-        $script_4_1_defaults = EE_Registry::instance()->load_dms('Core_4_1_0');
584
-        //(because many need to convert old string states to foreign keys into the states table)
585
-        $script_4_1_defaults->insert_default_states();
586
-        $script_4_1_defaults->insert_default_countries();
587
-        /** @var EE_DMS_Core_4_5_0 $script_4_5_defaults */
588
-        $script_4_5_defaults = EE_Registry::instance()->load_dms('Core_4_5_0');
589
-        $script_4_5_defaults->insert_default_price_types();
590
-        $script_4_5_defaults->insert_default_prices();
591
-        $script_4_5_defaults->insert_default_tickets();
592
-        /** @var EE_DMS_Core_4_6_0 $script_4_6_defaults */
593
-        $script_4_6_defaults = EE_Registry::instance()->load_dms('Core_4_6_0');
594
-        $script_4_6_defaults->add_default_admin_only_payments();
595
-        $script_4_6_defaults->insert_default_currencies();
596
-        /** @var EE_DMS_Core_4_8_0 $script_4_8_defaults */
597
-        $script_4_8_defaults = EE_Registry::instance()->load_dms('Core_4_8_0');
598
-        $script_4_8_defaults->verify_new_countries();
599
-        $script_4_8_defaults->verify_new_currencies();
600
-        $this->verify_db_collations();
601
-        return true;
602
-    }
581
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
582
+		/** @var EE_DMS_Core_4_1_0 $script_4_1_defaults */
583
+		$script_4_1_defaults = EE_Registry::instance()->load_dms('Core_4_1_0');
584
+		//(because many need to convert old string states to foreign keys into the states table)
585
+		$script_4_1_defaults->insert_default_states();
586
+		$script_4_1_defaults->insert_default_countries();
587
+		/** @var EE_DMS_Core_4_5_0 $script_4_5_defaults */
588
+		$script_4_5_defaults = EE_Registry::instance()->load_dms('Core_4_5_0');
589
+		$script_4_5_defaults->insert_default_price_types();
590
+		$script_4_5_defaults->insert_default_prices();
591
+		$script_4_5_defaults->insert_default_tickets();
592
+		/** @var EE_DMS_Core_4_6_0 $script_4_6_defaults */
593
+		$script_4_6_defaults = EE_Registry::instance()->load_dms('Core_4_6_0');
594
+		$script_4_6_defaults->add_default_admin_only_payments();
595
+		$script_4_6_defaults->insert_default_currencies();
596
+		/** @var EE_DMS_Core_4_8_0 $script_4_8_defaults */
597
+		$script_4_8_defaults = EE_Registry::instance()->load_dms('Core_4_8_0');
598
+		$script_4_8_defaults->verify_new_countries();
599
+		$script_4_8_defaults->verify_new_currencies();
600
+		$this->verify_db_collations();
601
+		return true;
602
+	}
603 603
 
604 604
 
605 605
 
606
-    /**
607
-     * @return boolean
608
-     */
609
-    public function schema_changes_after_migration()
610
-    {
611
-        return true;
612
-    }
606
+	/**
607
+	 * @return boolean
608
+	 */
609
+	public function schema_changes_after_migration()
610
+	{
611
+		return true;
612
+	}
613 613
 
614 614
 
615 615
 
616
-    public function migration_page_hooks()
617
-    {
618
-    }
616
+	public function migration_page_hooks()
617
+	{
618
+	}
619 619
 
620 620
 
621 621
 
622
-    /**
623
-     * Verify all EE4 models' tables use utf8mb4 collation
624
-     *
625
-     * @return void
626
-     */
627
-    public function verify_db_collations()
628
-    {
629
-        if (get_option('ee_verified_db_collations', false)) {
630
-            return;
631
-        }
632
-        // grab tables from each model
633
-        $tables_to_check = array();
634
-        foreach (EE_Registry::instance()->non_abstract_db_models as $model_name) {
635
-            if (method_exists($model_name, 'instance')) {
636
-                $model_obj = call_user_func(array($model_name, 'instance'));
637
-                if ($model_obj instanceof EEM_Base) {
638
-                    foreach ($model_obj->get_tables() as $table) {
639
-                        if (
640
-                            strpos($table->get_table_name(), 'esp_')
641
-                            && (is_main_site()//for main tables, verify global tables
642
-                                || ! $table->is_global()//if not the main site, then only verify non-global tables (avoid doubling up)
643
-                            )
644
-                            && function_exists('maybe_convert_table_to_utf8mb4')
645
-                        ) {
646
-                            $tables_to_check[] = $table->get_table_name();
647
-                        }
648
-                    }
649
-                }
650
-            }
651
-        }
652
-        //and let's just be sure these addons' tables get migrated too. They already get handled if their addons are active
653
-        //when this code is run, but not otherwise. Once we record what tables EE added, we'll be able to use that instead
654
-        //of hard-coding this
655
-        $addon_tables = array(
656
-            //mailchimp
657
-            'esp_event_mailchimp_list_group',
658
-            'esp_event_question_mailchimp_field',
659
-            //multisite
660
-            'esp_blog_meta',
661
-            //people
662
-            'esp_people_to_post',
663
-            //promotions
664
-            'esp_promotion',
665
-            'esp_promotion_object',
666
-        );
667
-        foreach ($addon_tables as $table_name) {
668
-            $complete_table_name = $this->_table_analysis->ensureTableNameHasPrefix($table_name);
669
-            if($this->_table_analysis->tableExists( $complete_table_name )){
670
-                $tables_to_check[] = $complete_table_name;
671
-            }
672
-        }
673
-        $tables_to_check = array_unique($tables_to_check);
674
-        foreach ($tables_to_check as $table_name) {
675
-            if ( ! apply_filters('FHEE__EE_DMS_Core_4_9_0__verify_db_collations__check_overridden', false, $table_name ) ) {
676
-                maybe_convert_table_to_utf8mb4($table_name);
677
-            }
678
-        }
679
-        //ok and now let's remember this was done (without needing to check the db schemas all over again)
680
-        add_option('ee_verified_db_collations', true, null, 'no');
681
-    }
622
+	/**
623
+	 * Verify all EE4 models' tables use utf8mb4 collation
624
+	 *
625
+	 * @return void
626
+	 */
627
+	public function verify_db_collations()
628
+	{
629
+		if (get_option('ee_verified_db_collations', false)) {
630
+			return;
631
+		}
632
+		// grab tables from each model
633
+		$tables_to_check = array();
634
+		foreach (EE_Registry::instance()->non_abstract_db_models as $model_name) {
635
+			if (method_exists($model_name, 'instance')) {
636
+				$model_obj = call_user_func(array($model_name, 'instance'));
637
+				if ($model_obj instanceof EEM_Base) {
638
+					foreach ($model_obj->get_tables() as $table) {
639
+						if (
640
+							strpos($table->get_table_name(), 'esp_')
641
+							&& (is_main_site()//for main tables, verify global tables
642
+								|| ! $table->is_global()//if not the main site, then only verify non-global tables (avoid doubling up)
643
+							)
644
+							&& function_exists('maybe_convert_table_to_utf8mb4')
645
+						) {
646
+							$tables_to_check[] = $table->get_table_name();
647
+						}
648
+					}
649
+				}
650
+			}
651
+		}
652
+		//and let's just be sure these addons' tables get migrated too. They already get handled if their addons are active
653
+		//when this code is run, but not otherwise. Once we record what tables EE added, we'll be able to use that instead
654
+		//of hard-coding this
655
+		$addon_tables = array(
656
+			//mailchimp
657
+			'esp_event_mailchimp_list_group',
658
+			'esp_event_question_mailchimp_field',
659
+			//multisite
660
+			'esp_blog_meta',
661
+			//people
662
+			'esp_people_to_post',
663
+			//promotions
664
+			'esp_promotion',
665
+			'esp_promotion_object',
666
+		);
667
+		foreach ($addon_tables as $table_name) {
668
+			$complete_table_name = $this->_table_analysis->ensureTableNameHasPrefix($table_name);
669
+			if($this->_table_analysis->tableExists( $complete_table_name )){
670
+				$tables_to_check[] = $complete_table_name;
671
+			}
672
+		}
673
+		$tables_to_check = array_unique($tables_to_check);
674
+		foreach ($tables_to_check as $table_name) {
675
+			if ( ! apply_filters('FHEE__EE_DMS_Core_4_9_0__verify_db_collations__check_overridden', false, $table_name ) ) {
676
+				maybe_convert_table_to_utf8mb4($table_name);
677
+			}
678
+		}
679
+		//ok and now let's remember this was done (without needing to check the db schemas all over again)
680
+		add_option('ee_verified_db_collations', true, null, 'no');
681
+	}
682 682
 }
683 683
\ No newline at end of file
Please login to merge, or discard this patch.
modules/add_new_state/EED_Add_New_State.module.php 1 patch
Spacing   +165 added lines, -165 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
 	 * @return EED_Add_New_State
17 17
 	 */
18 18
 	public static function instance() {
19
-		return parent::get_instance( __CLASS__ );
19
+		return parent::get_instance(__CLASS__);
20 20
 	}
21 21
 
22 22
 
@@ -27,16 +27,16 @@  discard block
 block discarded – undo
27 27
 	 *  	@return 		void
28 28
 	 */
29 29
 	public static function set_hooks() {
30
-		add_action( 'wp_loaded', array( 'EED_Add_New_State', 'set_definitions' ), 2 );
31
-		add_action( 'wp_enqueue_scripts', array( 'EED_Add_New_State', 'translate_js_strings' ), 0 );
32
-		add_action( 'wp_enqueue_scripts', array( 'EED_Add_New_State', 'wp_enqueue_scripts' ), 10 );
33
-		add_filter( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___question_group_reg_form__question_group_reg_form', array( 'EED_Add_New_State', 'display_add_new_state_micro_form' ), 1, 1 );
34
-		add_filter( 'FHEE__EE_SPCO_Reg_Step_Payment_Options___get_billing_form_for_payment_method__billing_form', array( 'EED_Add_New_State', 'display_add_new_state_micro_form' ), 1, 1 );
35
-		add_filter( 'FHEE__EE_Single_Page_Checkout__process_attendee_information__valid_data_line_item', array( 'EED_Add_New_State', 'unset_new_state_request_params' ), 10, 1 );
36
-		add_filter( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__state_options', array( 'EED_Add_New_State', 'inject_new_reg_state_into_options' ), 10, 5 );
37
-		add_filter( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__country_options', array( 'EED_Add_New_State', 'inject_new_reg_country_into_options' ), 10, 5 );
38
-		add_filter( 'FHEE__EE_State_Select_Input____construct__state_options', array( 'EED_Add_New_State', 'state_options' ), 10, 1 );
39
-		add_filter( 'FHEE__EE_Country_Select_Input____construct__country_options', array( 'EED_Add_New_State', 'country_options' ), 10, 1 );
30
+		add_action('wp_loaded', array('EED_Add_New_State', 'set_definitions'), 2);
31
+		add_action('wp_enqueue_scripts', array('EED_Add_New_State', 'translate_js_strings'), 0);
32
+		add_action('wp_enqueue_scripts', array('EED_Add_New_State', 'wp_enqueue_scripts'), 10);
33
+		add_filter('FHEE__EE_SPCO_Reg_Step_Attendee_Information___question_group_reg_form__question_group_reg_form', array('EED_Add_New_State', 'display_add_new_state_micro_form'), 1, 1);
34
+		add_filter('FHEE__EE_SPCO_Reg_Step_Payment_Options___get_billing_form_for_payment_method__billing_form', array('EED_Add_New_State', 'display_add_new_state_micro_form'), 1, 1);
35
+		add_filter('FHEE__EE_Single_Page_Checkout__process_attendee_information__valid_data_line_item', array('EED_Add_New_State', 'unset_new_state_request_params'), 10, 1);
36
+		add_filter('FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__state_options', array('EED_Add_New_State', 'inject_new_reg_state_into_options'), 10, 5);
37
+		add_filter('FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__country_options', array('EED_Add_New_State', 'inject_new_reg_country_into_options'), 10, 5);
38
+		add_filter('FHEE__EE_State_Select_Input____construct__state_options', array('EED_Add_New_State', 'state_options'), 10, 1);
39
+		add_filter('FHEE__EE_Country_Select_Input____construct__country_options', array('EED_Add_New_State', 'country_options'), 10, 1);
40 40
 	}
41 41
 
42 42
 	/**
@@ -46,20 +46,20 @@  discard block
 block discarded – undo
46 46
 	 *  	@return 		void
47 47
 	 */
48 48
 	public static function set_hooks_admin() {
49
-		add_action( 'wp_loaded', array( 'EED_Add_New_State', 'set_definitions' ), 2 );
50
-		add_filter( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___question_group_reg_form__question_group_reg_form', array( 'EED_Add_New_State', 'display_add_new_state_micro_form' ), 1, 1 );
51
-		add_filter( 'FHEE__EE_SPCO_Reg_Step_Payment_Options___get_billing_form_for_payment_method__billing_form', array( 'EED_Add_New_State', 'display_add_new_state_micro_form' ), 1, 1 );
52
-		add_action( 'wp_ajax_espresso_add_new_state', array( 'EED_Add_New_State', 'add_new_state' ));
53
-		add_action( 'wp_ajax_nopriv_espresso_add_new_state', array( 'EED_Add_New_State', 'add_new_state' ));
54
-		add_filter( 'FHEE__EE_Single_Page_Checkout__process_attendee_information__valid_data_line_item', array( 'EED_Add_New_State', 'unset_new_state_request_params' ), 10, 1 );
55
-		add_action( 'AHEE__General_Settings_Admin_Page__update_country_settings__state_saved', array( 'EED_Add_New_State', 'update_country_settings' ), 10, 3 );
56
-		add_action( 'AHEE__General_Settings_Admin_Page__delete_state__state_deleted', array( 'EED_Add_New_State', 'update_country_settings' ), 10, 3 );
57
-		add_filter( 'FHEE__EE_State_Select_Input____construct__state_options', array( 'EED_Add_New_State', 'state_options' ), 10, 1 );
58
-		add_filter( 'FHEE__EE_Country_Select_Input____construct__country_options', array( 'EED_Add_New_State', 'country_options' ), 10, 1 );
49
+		add_action('wp_loaded', array('EED_Add_New_State', 'set_definitions'), 2);
50
+		add_filter('FHEE__EE_SPCO_Reg_Step_Attendee_Information___question_group_reg_form__question_group_reg_form', array('EED_Add_New_State', 'display_add_new_state_micro_form'), 1, 1);
51
+		add_filter('FHEE__EE_SPCO_Reg_Step_Payment_Options___get_billing_form_for_payment_method__billing_form', array('EED_Add_New_State', 'display_add_new_state_micro_form'), 1, 1);
52
+		add_action('wp_ajax_espresso_add_new_state', array('EED_Add_New_State', 'add_new_state'));
53
+		add_action('wp_ajax_nopriv_espresso_add_new_state', array('EED_Add_New_State', 'add_new_state'));
54
+		add_filter('FHEE__EE_Single_Page_Checkout__process_attendee_information__valid_data_line_item', array('EED_Add_New_State', 'unset_new_state_request_params'), 10, 1);
55
+		add_action('AHEE__General_Settings_Admin_Page__update_country_settings__state_saved', array('EED_Add_New_State', 'update_country_settings'), 10, 3);
56
+		add_action('AHEE__General_Settings_Admin_Page__delete_state__state_deleted', array('EED_Add_New_State', 'update_country_settings'), 10, 3);
57
+		add_filter('FHEE__EE_State_Select_Input____construct__state_options', array('EED_Add_New_State', 'state_options'), 10, 1);
58
+		add_filter('FHEE__EE_Country_Select_Input____construct__country_options', array('EED_Add_New_State', 'country_options'), 10, 1);
59 59
 		//add_filter( 'FHEE__Single_Page_Checkout___check_form_submission__request_params', array( 'EED_Add_New_State', 'filter_checkout_request_params' ), 10, 1 );
60
-		add_filter( 'FHEE__EE_Form_Section_Proper__receive_form_submission__request_data', array( 'EED_Add_New_State', 'filter_checkout_request_params' ), 10, 1 );
61
-		add_filter( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__state_options', array( 'EED_Add_New_State', 'inject_new_reg_state_into_options' ), 10, 5 );
62
-		add_filter( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__country_options', array( 'EED_Add_New_State', 'inject_new_reg_country_into_options' ), 10, 5 );
60
+		add_filter('FHEE__EE_Form_Section_Proper__receive_form_submission__request_data', array('EED_Add_New_State', 'filter_checkout_request_params'), 10, 1);
61
+		add_filter('FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__state_options', array('EED_Add_New_State', 'inject_new_reg_state_into_options'), 10, 5);
62
+		add_filter('FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__country_options', array('EED_Add_New_State', 'inject_new_reg_country_into_options'), 10, 5);
63 63
 	}
64 64
 
65 65
 
@@ -71,8 +71,8 @@  discard block
 block discarded – undo
71 71
 	 *  	@return 		void
72 72
 	 */
73 73
 	public static function set_definitions() {
74
-		define( 'ANS_ASSETS_URL', plugin_dir_url( __FILE__ ) . 'assets' . DS );
75
-		define( 'ANS_TEMPLATES_PATH', str_replace( '\\', DS, plugin_dir_path( __FILE__ )) . 'templates' . DS );
74
+		define('ANS_ASSETS_URL', plugin_dir_url(__FILE__).'assets'.DS);
75
+		define('ANS_TEMPLATES_PATH', str_replace('\\', DS, plugin_dir_path(__FILE__)).'templates'.DS);
76 76
 	}
77 77
 
78 78
 
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 	 * @param \WP $WP
85 85
 	 * @return        void
86 86
 	 */
87
-	public function run( $WP ) {
87
+	public function run($WP) {
88 88
 	}
89 89
 
90 90
 
@@ -112,9 +112,9 @@  discard block
 block discarded – undo
112 112
 	 * 	@return 		void
113 113
 	 */
114 114
 	public static function wp_enqueue_scripts() {
115
-		if ( apply_filters( 'EED_Single_Page_Checkout__SPCO_active', false ) ) {
116
-			wp_register_script( 'add_new_state', ANS_ASSETS_URL . 'add_new_state.js', array( 'espresso_core', 'single_page_checkout' ), EVENT_ESPRESSO_VERSION, true );
117
-			wp_enqueue_script( 'add_new_state' );
115
+		if (apply_filters('EED_Single_Page_Checkout__SPCO_active', false)) {
116
+			wp_register_script('add_new_state', ANS_ASSETS_URL.'add_new_state.js', array('espresso_core', 'single_page_checkout'), EVENT_ESPRESSO_VERSION, true);
117
+			wp_enqueue_script('add_new_state');
118 118
 		}
119 119
 	}
120 120
 
@@ -128,34 +128,34 @@  discard block
 block discarded – undo
128 128
 	 * @return 	string
129 129
 	 */
130 130
 //	public static function display_add_new_state_micro_form( $html, EE_Form_Input_With_Options_Base $input ){
131
-	public static function display_add_new_state_micro_form( EE_Form_Section_Proper $question_group_reg_form ){
131
+	public static function display_add_new_state_micro_form(EE_Form_Section_Proper $question_group_reg_form) {
132 132
 		// only add the 'new_state_micro_form' when displaying reg forms,
133 133
 		// not during processing since we process the 'new_state_micro_form' in it's own AJAX request
134
-		$action = EE_Registry::instance()->REQ->get( 'action', '' );
134
+		$action = EE_Registry::instance()->REQ->get('action', '');
135 135
 		// is the "state" question in this form section?
136
-		$input = $question_group_reg_form->get_subsection( 'state' );
137
-		if ( $action === 'process_reg_step' || $action === 'update_reg_step' ) {
136
+		$input = $question_group_reg_form->get_subsection('state');
137
+		if ($action === 'process_reg_step' || $action === 'update_reg_step') {
138 138
 			//ok then all we need to do is make sure the input's HTML name is consistent
139 139
 			//by forcing it to set it now, like it did while getting the form for display
140
-			if( $input instanceof EE_State_Select_Input ) {
140
+			if ($input instanceof EE_State_Select_Input) {
141 141
 				$input->html_name();
142 142
 			}
143 143
 			return $question_group_reg_form;
144 144
 		}
145 145
 		
146 146
 		// we're only doing this for state select inputs
147
-		if ( $input instanceof EE_State_Select_Input ) {
147
+		if ($input instanceof EE_State_Select_Input) {
148 148
 			// grab any set values from the request
149
-			$country_name = str_replace( 'state', 'nsmf_new_state_country', $input->html_name() );
150
-			$state_name = str_replace( 'state', 'nsmf_new_state_name', $input->html_name() );
151
-			$abbrv_name = str_replace( 'state', 'nsmf_new_state_abbrv', $input->html_name() );
152
-			$new_state_submit_id = str_replace( 'state', 'new_state', $input->html_id() );
149
+			$country_name = str_replace('state', 'nsmf_new_state_country', $input->html_name());
150
+			$state_name = str_replace('state', 'nsmf_new_state_name', $input->html_name());
151
+			$abbrv_name = str_replace('state', 'nsmf_new_state_abbrv', $input->html_name());
152
+			$new_state_submit_id = str_replace('state', 'new_state', $input->html_id());
153 153
 			$country_options = array();
154 154
 			$countries = EEM_Country::instance()->get_all_countries();
155
-			if ( ! empty( $countries )) {
156
-				foreach( $countries as $country ){
157
-					if ( $country instanceof EE_Country ) {
158
-						$country_options[ $country->ID() ] = $country->name();
155
+			if ( ! empty($countries)) {
156
+				foreach ($countries as $country) {
157
+					if ($country instanceof EE_Country) {
158
+						$country_options[$country->ID()] = $country->name();
159 159
 					}
160 160
 				}
161 161
 			}
@@ -168,8 +168,8 @@  discard block
 block discarded – undo
168 168
 						// add hidden input to indicate that a new state is being added
169 169
 						'add_new_state' 	=> new EE_Hidden_Input(
170 170
 							array(
171
-								'html_name' 	=> str_replace( 'state', 'nsmf_add_new_state', $input->html_name() ),
172
-								'html_id' 			=> str_replace( 'state', 'nsmf_add_new_state', $input->html_id() ),
171
+								'html_name' 	=> str_replace('state', 'nsmf_add_new_state', $input->html_name()),
172
+								'html_id' 			=> str_replace('state', 'nsmf_add_new_state', $input->html_id()),
173 173
 								'default'			=> 0
174 174
 							)
175 175
 						),
@@ -181,10 +181,10 @@  discard block
 block discarded – undo
181 181
 									'',
182 182
 									__('click here to add a new state/province', 'event_espresso'),
183 183
 									'',
184
-									'display-' . $input->html_id(),
184
+									'display-'.$input->html_id(),
185 185
 									'ee-form-add-new-state-lnk display-the-hidden smaller-text hide-if-no-js',
186 186
 									'',
187
-									'data-target="' . $input->html_id() . '"'
187
+									'data-target="'.$input->html_id().'"'
188 188
 								)
189 189
 							)
190 190
 						),
@@ -192,13 +192,13 @@  discard block
 block discarded – undo
192 192
 						'add_new_state_micro_form' =>new EE_Form_Section_HTML(
193 193
 							apply_filters(
194 194
 								'FHEE__EED_Add_New_State__display_add_new_state_micro_form__add_new_state_micro_form',
195
-								EEH_HTML::div( '', $input->html_id() . '-dv', 'ee-form-add-new-state-dv', 'display: none;' ) .
196
-								EEH_HTML::h6( __('If your State/Province does not appear in the list above, you can easily add it by doing the following:', 'event_espresso')) .
197
-								EEH_HTML::ul() .
198
-								EEH_HTML::li( __('first select the Country that your State/Province belongs to', 'event_espresso') ) .
199
-								EEH_HTML::li( __('enter the name of your State/Province', 'event_espresso') ) .
200
-								EEH_HTML::li( __('enter a two to six letter abbreviation for the name of your State/Province', 'event_espresso') ) .
201
-								EEH_HTML::li( __('click the ADD button', 'event_espresso') ) .
195
+								EEH_HTML::div('', $input->html_id().'-dv', 'ee-form-add-new-state-dv', 'display: none;').
196
+								EEH_HTML::h6(__('If your State/Province does not appear in the list above, you can easily add it by doing the following:', 'event_espresso')).
197
+								EEH_HTML::ul().
198
+								EEH_HTML::li(__('first select the Country that your State/Province belongs to', 'event_espresso')).
199
+								EEH_HTML::li(__('enter the name of your State/Province', 'event_espresso')).
200
+								EEH_HTML::li(__('enter a two to six letter abbreviation for the name of your State/Province', 'event_espresso')).
201
+								EEH_HTML::li(__('click the ADD button', 'event_espresso')).
202 202
 								EEH_HTML::ulx()
203 203
 							)
204 204
 						),
@@ -207,10 +207,10 @@  discard block
 block discarded – undo
207 207
 							$country_options,
208 208
 							array(
209 209
 								'html_name' 			=> $country_name,
210
-								'html_id' 					=> str_replace( 'state', 'nsmf_new_state_country', $input->html_id() ),
211
-								'html_class' 			=> $input->html_class() . ' new-state-country',
210
+								'html_id' 					=> str_replace('state', 'nsmf_new_state_country', $input->html_id()),
211
+								'html_class' 			=> $input->html_class().' new-state-country',
212 212
 								'html_label_text'		=> __('New State/Province Country', 'event_espresso'),
213
-								'default'					=> EE_Registry::instance()->REQ->get( $country_name, '' ),
213
+								'default'					=> EE_Registry::instance()->REQ->get($country_name, ''),
214 214
 								'required' 				=> false
215 215
 							)
216 216
 						),
@@ -218,23 +218,23 @@  discard block
 block discarded – undo
218 218
 						'new_state_name' => new EE_Text_Input(
219 219
 							array(
220 220
 								'html_name' 			=> $state_name,
221
-								'html_id' 					=> str_replace( 'state', 'nsmf_new_state_name', $input->html_id() ),
222
-								'html_class' 			=> $input->html_class() . ' new-state-state',
221
+								'html_id' 					=> str_replace('state', 'nsmf_new_state_name', $input->html_id()),
222
+								'html_class' 			=> $input->html_class().' new-state-state',
223 223
 								'html_label_text'		=> __('New State/Province Name', 'event_espresso'),
224
-								'default'					=> EE_Registry::instance()->REQ->get( $state_name, '' ),
224
+								'default'					=> EE_Registry::instance()->REQ->get($state_name, ''),
225 225
 								'required' 				=> false
226 226
 							)
227 227
 						),
228
-						'spacer' => new EE_Form_Section_HTML( EEH_HTML::br() ),
228
+						'spacer' => new EE_Form_Section_HTML(EEH_HTML::br()),
229 229
 						// NEW STATE NAME
230 230
 						'new_state_abbrv' => new EE_Text_Input(
231 231
 							array(
232 232
 								'html_name' 					=> $abbrv_name,
233
-								'html_id' 							=> str_replace( 'state', 'nsmf_new_state_abbrv', $input->html_id() ),
234
-								'html_class' 					=> $input->html_class() . ' new-state-abbrv',
233
+								'html_id' 							=> str_replace('state', 'nsmf_new_state_abbrv', $input->html_id()),
234
+								'html_class' 					=> $input->html_class().' new-state-abbrv',
235 235
 								'html_label_text'				=> __('New State/Province Abbreviation', 'event_espresso'),
236 236
 								'html_other_attributes'	=> 'size="24"',
237
-								'default'							=> EE_Registry::instance()->REQ->get( $abbrv_name, '' ),
237
+								'default'							=> EE_Registry::instance()->REQ->get($abbrv_name, ''),
238 238
 								'required' 						=> false
239 239
 							)
240 240
 						),
@@ -242,15 +242,15 @@  discard block
 block discarded – undo
242 242
 						'add_new_state_submit_button' => new EE_Form_Section_HTML(
243 243
 							apply_filters(
244 244
 								'FHEE__EED_Add_New_State__display_add_new_state_micro_form__add_new_state_submit_button',
245
-								EEH_HTML::nbsp(3) .
245
+								EEH_HTML::nbsp(3).
246 246
 								EEH_HTML::link(
247 247
 									'',
248 248
 									__('ADD', 'event_espresso'),
249 249
 									'',
250
-									'submit-' . $new_state_submit_id,
250
+									'submit-'.$new_state_submit_id,
251 251
 									'ee-form-add-new-state-submit button button-secondary',
252 252
 									'',
253
-									'data-target="' . $new_state_submit_id . '"'
253
+									'data-target="'.$new_state_submit_id.'"'
254 254
 								)
255 255
 							)
256 256
 						),
@@ -258,18 +258,18 @@  discard block
 block discarded – undo
258 258
 						'add_new_state_extra' => new EE_Form_Section_HTML(
259 259
 							apply_filters(
260 260
 								'FHEE__EED_Add_New_State__display_add_new_state_micro_form__add_new_state_extra',
261
-								EEH_HTML::br(2) .
262
-								EEH_HTML::div( '', '', 'small-text' ) .
263
-								EEH_HTML::strong( __('Don\'t know your State/Province Abbreviation?', 'event_espresso') ) .
264
-								EEH_HTML::br() .
261
+								EEH_HTML::br(2).
262
+								EEH_HTML::div('', '', 'small-text').
263
+								EEH_HTML::strong(__('Don\'t know your State/Province Abbreviation?', 'event_espresso')).
264
+								EEH_HTML::br().
265 265
 								sprintf(
266 266
 									__('You can look here: %s, for a list of Countries and links to their State/Province Abbreviations ("Subdivisions assigned codes" column).', 'event_espresso'),
267
-									EEH_HTML::link( 'http://en.wikipedia.org/wiki/ISO_3166-2', 'http://en.wikipedia.org/wiki/ISO_3166-2', '', '', 'ee-form-add-new-state-wiki-lnk' )
268
-								) .
269
-								EEH_HTML::divx() .
270
-								EEH_HTML::br() .
271
-								EEH_HTML::link( '', __('cancel new state/province', 'event_espresso'), '', 'hide-' . $input->html_id(), 'ee-form-cancel-new-state-lnk smaller-text', '', 'data-target="' . $input->html_id() . '"' ) .
272
-								EEH_HTML::divx() .
267
+									EEH_HTML::link('http://en.wikipedia.org/wiki/ISO_3166-2', 'http://en.wikipedia.org/wiki/ISO_3166-2', '', '', 'ee-form-add-new-state-wiki-lnk')
268
+								).
269
+								EEH_HTML::divx().
270
+								EEH_HTML::br().
271
+								EEH_HTML::link('', __('cancel new state/province', 'event_espresso'), '', 'hide-'.$input->html_id(), 'ee-form-cancel-new-state-lnk smaller-text', '', 'data-target="'.$input->html_id().'"').
272
+								EEH_HTML::divx().
273 273
 								EEH_HTML::br()
274 274
 							)
275 275
 						)
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
 					)
278 278
 				)
279 279
 			);
280
-			$question_group_reg_form->add_subsections( array( 'new_state_micro_form' => $new_state_micro_form ), 'state', false );
280
+			$question_group_reg_form->add_subsections(array('new_state_micro_form' => $new_state_micro_form), 'state', false);
281 281
 		}
282 282
 		return $question_group_reg_form;
283 283
 	}
@@ -295,50 +295,50 @@  discard block
 block discarded – undo
295 295
 	public static function add_new_state() {
296 296
 		$REQ = EE_Registry::instance()->load_core('Request_Handler');
297 297
 		if (
298
-			$REQ->is_set( 'nsmf_add_new_state' )
299
-			&& $REQ->get( 'nsmf_add_new_state' ) == 1
298
+			$REQ->is_set('nsmf_add_new_state')
299
+			&& $REQ->get('nsmf_add_new_state') == 1
300 300
 		) {
301 301
 			EE_Registry::instance()->load_model('State');
302 302
 			// grab country ISO code, new state name, and new state abbreviation
303
-			$state_country = $REQ->is_set( 'nsmf_new_state_country' )
304
-				? sanitize_text_field( $REQ->get( 'nsmf_new_state_country' ) )
303
+			$state_country = $REQ->is_set('nsmf_new_state_country')
304
+				? sanitize_text_field($REQ->get('nsmf_new_state_country'))
305 305
 				: false;
306
-			$state_name = $REQ->is_set( 'nsmf_new_state_name' )
307
-				? sanitize_text_field( $REQ->get( 'nsmf_new_state_name' ) )
306
+			$state_name = $REQ->is_set('nsmf_new_state_name')
307
+				? sanitize_text_field($REQ->get('nsmf_new_state_name'))
308 308
 				: false;
309
-			$state_abbr = $REQ->is_set( 'nsmf_new_state_abbrv' )
310
-				? sanitize_text_field( $REQ->get( 'nsmf_new_state_abbrv' ) )
309
+			$state_abbr = $REQ->is_set('nsmf_new_state_abbrv')
310
+				? sanitize_text_field($REQ->get('nsmf_new_state_abbrv'))
311 311
 				: false;
312 312
 //echo '<h4>$state_country : ' . $state_country . '  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>';
313 313
 //echo '<h4>$state_name : ' . $state_name . '  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>';
314 314
 //echo '<h4>$state_abbr : ' . $state_abbr . '  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>';
315 315
 
316
-			if ( $state_country && $state_name && $state_abbr ) {
317
-				$new_state = EED_Add_New_State::save_new_state_to_db( array(
318
-					'CNT_ISO'=> strtoupper( $state_country ),
319
-					'STA_abbrev' => strtoupper( $state_abbr ),
320
-					'STA_name' => ucwords( $state_name ),
316
+			if ($state_country && $state_name && $state_abbr) {
317
+				$new_state = EED_Add_New_State::save_new_state_to_db(array(
318
+					'CNT_ISO'=> strtoupper($state_country),
319
+					'STA_abbrev' => strtoupper($state_abbr),
320
+					'STA_name' => ucwords($state_name),
321 321
 					'STA_active' => FALSE
322 322
 				));
323 323
 
324
-				if ( $new_state instanceof EE_State ) {
324
+				if ($new_state instanceof EE_State) {
325 325
 					// clean house
326
-					EE_Registry::instance()->REQ->un_set( 'nsmf_add_new_state' );
327
-					EE_Registry::instance()->REQ->un_set( 'nsmf_new_state_country' );
328
-					EE_Registry::instance()->REQ->un_set( 'nsmf_new_state_name' );
329
-					EE_Registry::instance()->REQ->un_set( 'nsmf_new_state_abbrv' );
326
+					EE_Registry::instance()->REQ->un_set('nsmf_add_new_state');
327
+					EE_Registry::instance()->REQ->un_set('nsmf_new_state_country');
328
+					EE_Registry::instance()->REQ->un_set('nsmf_new_state_name');
329
+					EE_Registry::instance()->REQ->un_set('nsmf_new_state_abbrv');
330 330
 
331 331
 					// get any existing new states
332 332
 					$new_states = EE_Registry::instance()->SSN->get_session_data(
333 333
 						'nsmf_new_states'
334 334
 					);
335
-					$new_states[ $new_state->ID() ] = $new_state;
335
+					$new_states[$new_state->ID()] = $new_state;
336 336
 					EE_Registry::instance()->SSN->set_session_data(
337
-						array( 'nsmf_new_states' => $new_states )
337
+						array('nsmf_new_states' => $new_states)
338 338
 					);
339 339
 
340
-					if ( EE_Registry::instance()->REQ->ajax ) {
341
-						echo wp_json_encode( array(
340
+					if (EE_Registry::instance()->REQ->ajax) {
341
+						echo wp_json_encode(array(
342 342
 							'success' => TRUE,
343 343
 							'id' => $new_state->ID(),
344 344
 							'name' => $new_state->name(),
@@ -353,12 +353,12 @@  discard block
 block discarded – undo
353 353
 				}
354 354
 
355 355
 			} else {
356
-				$error = __( 'A new State/Province could not be added because invalid or missing data was received.', 'event_espresso' );
357
-				if ( EE_Registry::instance()->REQ->ajax ) {
358
-					echo wp_json_encode( array( 'error' => $error ));
356
+				$error = __('A new State/Province could not be added because invalid or missing data was received.', 'event_espresso');
357
+				if (EE_Registry::instance()->REQ->ajax) {
358
+					echo wp_json_encode(array('error' => $error));
359 359
 					exit();
360 360
 				} else {
361
-					EE_Error::add_error( $error, __FILE__, __FUNCTION__, __LINE__ );
361
+					EE_Error::add_error($error, __FILE__, __FUNCTION__, __LINE__);
362 362
 				}
363 363
 			}
364 364
 		}
@@ -376,11 +376,11 @@  discard block
 block discarded – undo
376 376
 	 * @param array $request_params
377 377
 	 * @return array
378 378
 	 */
379
-	public static function filter_checkout_request_params ( $request_params ) {
380
-		foreach ( $request_params as $form_section ) {
381
-			if ( is_array( $form_section )) {
382
-				EED_Add_New_State::unset_new_state_request_params( $form_section );
383
-				EED_Add_New_State::filter_checkout_request_params( $form_section );
379
+	public static function filter_checkout_request_params($request_params) {
380
+		foreach ($request_params as $form_section) {
381
+			if (is_array($form_section)) {
382
+				EED_Add_New_State::unset_new_state_request_params($form_section);
383
+				EED_Add_New_State::filter_checkout_request_params($form_section);
384 384
 			}
385 385
 		}
386 386
 		return $request_params;
@@ -395,12 +395,12 @@  discard block
 block discarded – undo
395 395
 	 * @param array $request_params
396 396
 	 * @return        boolean
397 397
 	 */
398
-	public static function unset_new_state_request_params ( $request_params ) {
399
-		unset( $request_params[ 'new_state_micro_form' ] );
400
-		unset( $request_params[ 'new_state_micro_add_new_state' ] );
401
-		unset( $request_params[ 'new_state_micro_new_state_country' ] );
402
-		unset( $request_params[ 'new_state_micro_new_state_name' ] );
403
-		unset( $request_params[ 'new_state_micro_new_state_abbrv' ] );
398
+	public static function unset_new_state_request_params($request_params) {
399
+		unset($request_params['new_state_micro_form']);
400
+		unset($request_params['new_state_micro_add_new_state']);
401
+		unset($request_params['new_state_micro_new_state_country']);
402
+		unset($request_params['new_state_micro_new_state_name']);
403
+		unset($request_params['new_state_micro_new_state_abbrv']);
404 404
 		return $request_params;
405 405
 	}
406 406
 
@@ -413,25 +413,25 @@  discard block
 block discarded – undo
413 413
 	 * @param array $props_n_values
414 414
 	 * @return        boolean
415 415
 	 */
416
-	public static function save_new_state_to_db ( $props_n_values = array() ) {
416
+	public static function save_new_state_to_db($props_n_values = array()) {
417 417
 //		EEH_Debug_Tools::printr( $props_n_values, '$props_n_values  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
418
-		$existing_state = EEM_State::instance()->get_all( array( $props_n_values, 'limit' => 1 ));
419
-		if ( ! empty( $existing_state )) {
420
-			return array_pop( $existing_state );
418
+		$existing_state = EEM_State::instance()->get_all(array($props_n_values, 'limit' => 1));
419
+		if ( ! empty($existing_state)) {
420
+			return array_pop($existing_state);
421 421
 		}
422
-		$new_state = EE_State::new_instance( $props_n_values );
423
-		if ( $new_state instanceof EE_State ) {
422
+		$new_state = EE_State::new_instance($props_n_values);
423
+		if ($new_state instanceof EE_State) {
424 424
 			// if not non-ajax admin
425
-			$new_state_key = 'new-state-added-' . $new_state->country_iso() . '-' . $new_state->abbrev();
425
+			$new_state_key = 'new-state-added-'.$new_state->country_iso().'-'.$new_state->abbrev();
426 426
 			$new_state_notice = sprintf(
427
-					__( 'A new State named "%1$s (%2$s)" was dynamically added from an Event Espresso form for the Country of "%3$s".%5$sTo verify, edit, and/or delete this new State, please go to the %4$s and update the States / Provinces section.%5$sCheck "Yes" to have this new State added to dropdown select lists in forms.', 'event_espresso' ),
428
-					'<b>' . $new_state->name() . '</b>',
429
-					'<b>' . $new_state->abbrev() . '</b>',
430
-					'<b>' . $new_state->country()->name() . '</b>',
431
-					'<a href="' . add_query_arg( array( 'page' => 'espresso_general_settings', 'action' => 'country_settings', 'country' => $new_state->country_iso() ), admin_url( 'admin.php' )) . '">' . __( 'Event Espresso - General Settings > Countries Tab', 'event_espresso' ) . '</a>',
427
+					__('A new State named "%1$s (%2$s)" was dynamically added from an Event Espresso form for the Country of "%3$s".%5$sTo verify, edit, and/or delete this new State, please go to the %4$s and update the States / Provinces section.%5$sCheck "Yes" to have this new State added to dropdown select lists in forms.', 'event_espresso'),
428
+					'<b>'.$new_state->name().'</b>',
429
+					'<b>'.$new_state->abbrev().'</b>',
430
+					'<b>'.$new_state->country()->name().'</b>',
431
+					'<a href="'.add_query_arg(array('page' => 'espresso_general_settings', 'action' => 'country_settings', 'country' => $new_state->country_iso()), admin_url('admin.php')).'">'.__('Event Espresso - General Settings > Countries Tab', 'event_espresso').'</a>',
432 432
 					'<br />'
433 433
 			);
434
-			EE_Error::add_persistent_admin_notice( $new_state_key, $new_state_notice );
434
+			EE_Error::add_persistent_admin_notice($new_state_key, $new_state_notice);
435 435
 			$new_state->save();
436 436
 			EEM_State::instance()->reset_cached_states();
437 437
 			return $new_state;
@@ -450,22 +450,22 @@  discard block
 block discarded – undo
450 450
 	 * @param array  $cols_n_values
451 451
 	 * @return        boolean
452 452
 	 */
453
-	public static function update_country_settings( $CNT_ISO = '', $STA_ID = '', $cols_n_values = array() ) {
454
-		$CNT_ISO = ! empty( $CNT_ISO ) ? $CNT_ISO : FALSE;
455
-		if ( ! $CNT_ISO ) {
456
-			EE_Error::add_error( __( 'An invalid or missing Country ISO Code was received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
453
+	public static function update_country_settings($CNT_ISO = '', $STA_ID = '', $cols_n_values = array()) {
454
+		$CNT_ISO = ! empty($CNT_ISO) ? $CNT_ISO : FALSE;
455
+		if ( ! $CNT_ISO) {
456
+			EE_Error::add_error(__('An invalid or missing Country ISO Code was received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
457 457
 		}
458
-		$STA_abbrev = is_array( $cols_n_values ) && isset( $cols_n_values['STA_abbrev'] ) ? $cols_n_values['STA_abbrev'] : FALSE;
459
-		if (  ! $STA_abbrev && ! empty( $STA_ID )) {
460
-			$state = EEM_State::instance()->get_one_by_ID( $STA_ID );
461
-			if ( $state instanceof EE_State ) {
458
+		$STA_abbrev = is_array($cols_n_values) && isset($cols_n_values['STA_abbrev']) ? $cols_n_values['STA_abbrev'] : FALSE;
459
+		if ( ! $STA_abbrev && ! empty($STA_ID)) {
460
+			$state = EEM_State::instance()->get_one_by_ID($STA_ID);
461
+			if ($state instanceof EE_State) {
462 462
 				$STA_abbrev = $state->abbrev();
463 463
 			}
464 464
 		}
465
-		if ( ! $STA_abbrev ) {
466
-			EE_Error::add_error( __( 'An invalid or missing State Abbreviation was received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
465
+		if ( ! $STA_abbrev) {
466
+			EE_Error::add_error(__('An invalid or missing State Abbreviation was received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
467 467
 		}
468
-		EE_Error::dismiss_persistent_admin_notice( $CNT_ISO . '-' . $STA_abbrev, TRUE, TRUE );
468
+		EE_Error::dismiss_persistent_admin_notice($CNT_ISO.'-'.$STA_abbrev, TRUE, TRUE);
469 469
 	}
470 470
 
471 471
 
@@ -481,19 +481,19 @@  discard block
 block discarded – undo
481 481
 	 * @param $answer
482 482
 	 * @return bool
483 483
 	 */
484
-	public static function inject_new_reg_state_into_options( $state_options = array(), EE_SPCO_Reg_Step_Attendee_Information $reg_step, EE_Registration $registration, EE_Question $question, $answer ) {
485
-		if ( $answer instanceof EE_Answer  && $question instanceof EE_Question && $question->type() === EEM_Question::QST_type_state ) {
484
+	public static function inject_new_reg_state_into_options($state_options = array(), EE_SPCO_Reg_Step_Attendee_Information $reg_step, EE_Registration $registration, EE_Question $question, $answer) {
485
+		if ($answer instanceof EE_Answer && $question instanceof EE_Question && $question->type() === EEM_Question::QST_type_state) {
486 486
 			$STA_ID = $answer->value();
487
-			if ( ! empty( $STA_ID ) ) {
488
-				$state = EEM_State::instance()->get_one_by_ID( $STA_ID );
489
-				if ( $state instanceof EE_State ) {
487
+			if ( ! empty($STA_ID)) {
488
+				$state = EEM_State::instance()->get_one_by_ID($STA_ID);
489
+				if ($state instanceof EE_State) {
490 490
 					$country = $state->country();
491
-					if ( $country instanceof EE_Country ) {
492
-						if ( ! isset( $state_options[ $country->name() ] )) {
493
-							$state_options[ $country->name() ] = array();
491
+					if ($country instanceof EE_Country) {
492
+						if ( ! isset($state_options[$country->name()])) {
493
+							$state_options[$country->name()] = array();
494 494
 						}
495
-						if ( ! isset( $state_options[ $country->name() ][ $STA_ID ] )) {
496
-							$state_options[ $country->name() ][ $STA_ID ] = $state->name();
495
+						if ( ! isset($state_options[$country->name()][$STA_ID])) {
496
+							$state_options[$country->name()][$STA_ID] = $state->name();
497 497
 						}
498 498
 					}
499 499
 				}
@@ -515,14 +515,14 @@  discard block
 block discarded – undo
515 515
 	 * @param $answer
516 516
 	 * @return bool
517 517
 	 */
518
-	public static function inject_new_reg_country_into_options( $country_options = array(), EE_SPCO_Reg_Step_Attendee_Information $reg_step, EE_Registration $registration, EE_Question $question, $answer ) {
519
-		if ( $answer instanceof EE_Answer && $question instanceof EE_Question && $question->type() === EEM_Question::QST_type_country ) {
518
+	public static function inject_new_reg_country_into_options($country_options = array(), EE_SPCO_Reg_Step_Attendee_Information $reg_step, EE_Registration $registration, EE_Question $question, $answer) {
519
+		if ($answer instanceof EE_Answer && $question instanceof EE_Question && $question->type() === EEM_Question::QST_type_country) {
520 520
 			$CNT_ISO = $answer->value();
521
-			if ( ! empty( $CNT_ISO ) ) {
522
-				$country = EEM_Country::instance()->get_one_by_ID( $CNT_ISO );
523
-				if ( $country instanceof EE_Country ) {
524
-					if ( ! isset( $country_options[ $CNT_ISO ] ) ) {
525
-						$country_options[ $CNT_ISO ] = $country->name();
521
+			if ( ! empty($CNT_ISO)) {
522
+				$country = EEM_Country::instance()->get_one_by_ID($CNT_ISO);
523
+				if ($country instanceof EE_Country) {
524
+					if ( ! isset($country_options[$CNT_ISO])) {
525
+						$country_options[$CNT_ISO] = $country->name();
526 526
 					}
527 527
 				}
528 528
 			}
@@ -539,14 +539,14 @@  discard block
 block discarded – undo
539 539
 	 * @param EE_State[]  $state_options
540 540
 	 * @return        boolean
541 541
 	 */
542
-	public static function state_options( $state_options = array() ) {
542
+	public static function state_options($state_options = array()) {
543 543
 		$new_states = EED_Add_New_State::_get_new_states();
544
-		foreach ( $new_states as $new_state ) {
544
+		foreach ($new_states as $new_state) {
545 545
 			if (
546 546
 				$new_state instanceof EE_State
547 547
 				&& $new_state->country() instanceof EE_Country
548 548
 			) {
549
-				$state_options[ $new_state->country()->name() ][ $new_state->ID() ] = $new_state->name();
549
+				$state_options[$new_state->country()->name()][$new_state->ID()] = $new_state->name();
550 550
 			}
551 551
 		}
552 552
 		return $state_options;
@@ -562,12 +562,12 @@  discard block
 block discarded – undo
562 562
 	 */
563 563
 	protected static function _get_new_states() {
564 564
 		$new_states = array();
565
-		if ( EE_Registry::instance()->SSN instanceof EE_Session ) {
565
+		if (EE_Registry::instance()->SSN instanceof EE_Session) {
566 566
 			$new_states = EE_Registry::instance()->SSN->get_session_data(
567 567
 				'nsmf_new_states'
568 568
 			);
569 569
 		}
570
-		return is_array( $new_states ) ? $new_states : array();
570
+		return is_array($new_states) ? $new_states : array();
571 571
 	}
572 572
 
573 573
 
@@ -579,14 +579,14 @@  discard block
 block discarded – undo
579 579
 	 * @param EE_Country[]  $country_options
580 580
 	 * @return        boolean
581 581
 	 */
582
-	public static function country_options( $country_options = array() ) {
582
+	public static function country_options($country_options = array()) {
583 583
 		$new_states = EED_Add_New_State::_get_new_states();
584
-		foreach ( $new_states as $new_state ) {
584
+		foreach ($new_states as $new_state) {
585 585
 			if (
586 586
 				$new_state instanceof EE_State
587 587
 				&& $new_state->country() instanceof EE_Country
588 588
 			) {
589
-				$country_options[ $new_state->country()->ID() ] = $new_state->country()->name();
589
+				$country_options[$new_state->country()->ID()] = $new_state->country()->name();
590 590
 			}
591 591
 		}
592 592
 		return $country_options;
Please login to merge, or discard this patch.
modules/bot_trap/EED_Bot_Trap.module.php 1 patch
Indentation   +57 added lines, -57 removed lines patch added patch discarded remove patch
@@ -30,11 +30,11 @@  discard block
 block discarded – undo
30 30
 	 *  @return 	void
31 31
 	 */
32 32
 	public static function set_hooks() {
33
-        if (
33
+		if (
34 34
 			apply_filters( 'FHEE__EED_Bot_Trap__set_hooks__use_bot_trap', true ) &&
35 35
 			\EE_Registry::instance()->CFG->registration->use_bot_trap
36 36
 		) {
37
-            \EED_Bot_Trap::set_trap();
37
+			\EED_Bot_Trap::set_trap();
38 38
 			// redirect bots to bogus success page
39 39
 			\EE_Config::register_route( 'ticket_selection_received', 'EED_Bot_Trap', 'display_bot_trap_success' );
40 40
 		}
@@ -49,18 +49,18 @@  discard block
 block discarded – undo
49 49
 	 *  @return 	void
50 50
 	 */
51 51
 	public static function set_trap() {
52
-        define('EE_BOT_TRAP_BASE_URL', plugin_dir_url(__FILE__) . DS);
53
-        add_action(
54
-            'AHEE__ticket_selector_chart__template__after_ticket_selector',
55
-            array('EED_Bot_Trap', 'generate_bot_trap'),
56
-            10, 2
57
-        );
58
-        add_action(
59
-            'EED_Ticket_Selector__process_ticket_selections__before',
60
-            array('EED_Bot_Trap', 'process_bot_trap'),
61
-            1, 2
62
-        );
63
-    }
52
+		define('EE_BOT_TRAP_BASE_URL', plugin_dir_url(__FILE__) . DS);
53
+		add_action(
54
+			'AHEE__ticket_selector_chart__template__after_ticket_selector',
55
+			array('EED_Bot_Trap', 'generate_bot_trap'),
56
+			10, 2
57
+		);
58
+		add_action(
59
+			'EED_Ticket_Selector__process_ticket_selections__before',
60
+			array('EED_Bot_Trap', 'process_bot_trap'),
61
+			1, 2
62
+		);
63
+	}
64 64
 
65 65
 
66 66
 
@@ -71,15 +71,15 @@  discard block
 block discarded – undo
71 71
 	 *  @return 	void
72 72
 	 */
73 73
 	public static function set_hooks_admin() {
74
-        if (
75
-            defined('DOING_AJAX')
76
-            && DOING_AJAX
77
-            && apply_filters('FHEE__EED_Bot_Trap__set_hooks__use_bot_trap', true)
78
-            && \EE_Registry::instance()->CFG->registration->use_bot_trap
79
-        ) {
80
-            \EED_Bot_Trap::set_trap();
81
-        }
82
-        add_action(
74
+		if (
75
+			defined('DOING_AJAX')
76
+			&& DOING_AJAX
77
+			&& apply_filters('FHEE__EED_Bot_Trap__set_hooks__use_bot_trap', true)
78
+			&& \EE_Registry::instance()->CFG->registration->use_bot_trap
79
+		) {
80
+			\EED_Bot_Trap::set_trap();
81
+		}
82
+		add_action(
83 83
 			'AHEE__Extend_Registration_Form_Admin_Page___reg_form_settings_template',
84 84
 			array( 'EED_Bot_Trap', 'bot_trap_settings_form' ),
85 85
 			5
@@ -130,23 +130,23 @@  discard block
 block discarded – undo
130 130
 
131 131
 
132 132
 	/**
133
-     * process_bot_trap
134
-     *
135
-     * @param array|string $triggered_trap_callback Callback that will be executed for handling the
136
-     *                                              response if the bot trap is triggered.
137
-     *                                              It should receive one argument: a boolean indicating
138
-     *                                              whether the trap was triggered by suspicious timing or not.
133
+	 * process_bot_trap
134
+	 *
135
+	 * @param array|string $triggered_trap_callback Callback that will be executed for handling the
136
+	 *                                              response if the bot trap is triggered.
137
+	 *                                              It should receive one argument: a boolean indicating
138
+	 *                                              whether the trap was triggered by suspicious timing or not.
139 139
 	 */
140 140
 	public static function process_bot_trap( $triggered_trap_callback = array() ) {
141
-        // what's your email address Mr. Bot ?
141
+		// what's your email address Mr. Bot ?
142 142
 		$empty_trap = isset( $_REQUEST[ 'tkt-slctr-request-processor-email' ] )
143
-                      && $_REQUEST[ 'tkt-slctr-request-processor-email' ] === ''
144
-            ? true
145
-            : false;
143
+					  && $_REQUEST[ 'tkt-slctr-request-processor-email' ] === ''
144
+			? true
145
+			: false;
146 146
 		// get encrypted timestamp for when the form was originally displayed
147 147
 		$bot_trap_timestamp = isset( $_REQUEST[ 'tkt-slctr-request-processor-token' ] )
148
-            ? sanitize_text_field( $_REQUEST[ 'tkt-slctr-request-processor-token' ] )
149
-            : '';
148
+			? sanitize_text_field( $_REQUEST[ 'tkt-slctr-request-processor-token' ] )
149
+			: '';
150 150
 		// decrypt and convert to absolute  integer
151 151
 		if ( EE_Registry::instance()->CFG->registration->use_encryption ) {
152 152
 			EE_Registry::instance()->load_core( 'EE_Encryption' );
@@ -156,17 +156,17 @@  discard block
 block discarded – undo
156 156
 		}
157 157
 		// ticket form submitted too impossibly fast ( after now ) or more than an hour later ???
158 158
 		$suspicious_timing = $bot_trap_timestamp > time() || $bot_trap_timestamp < ( time() - HOUR_IN_SECONDS )
159
-            ? true
160
-            : false;
159
+			? true
160
+			: false;
161 161
 		// are we human ?
162 162
 		if ( $empty_trap && ! $suspicious_timing ) {
163
-		    do_action('AHEE__EED_Bot_Trap__process_bot_trap__trap_not_triggered');
163
+			do_action('AHEE__EED_Bot_Trap__process_bot_trap__trap_not_triggered');
164 164
 			return;
165 165
 		}
166 166
 		// check the given callback is valid first before executing
167 167
 		if ( ! is_callable($triggered_trap_callback ) ) {
168 168
 			// invalid callback so lets just sub in our default.
169
-            $triggered_trap_callback = array( 'EED_Bot_Trap', 'triggered_trap_response' );
169
+			$triggered_trap_callback = array( 'EED_Bot_Trap', 'triggered_trap_response' );
170 170
 		}
171 171
 		call_user_func_array($triggered_trap_callback, array( $suspicious_timing ) );
172 172
 	}
@@ -192,21 +192,21 @@  discard block
 block discarded – undo
192 192
 			);
193 193
 		}
194 194
 		$redirect_url = apply_filters('FHEE__EED_Bot_Trap__process_bot_trap__redirect_url', $redirect_url);
195
-        // if AJAX, return the redirect URL
196
-        if (defined('DOING_AJAX') && DOING_AJAX) {
197
-            echo wp_json_encode(
198
-                array_merge(
199
-                    \EE_Error::get_notices(false),
200
-                    array(
201
-                       'redirect_url' => $redirect_url
202
-                    )
203
-                )
204
-            );
205
-            exit();
206
-        }
207
-        wp_safe_redirect($redirect_url);
208
-        exit();
209
-    }
195
+		// if AJAX, return the redirect URL
196
+		if (defined('DOING_AJAX') && DOING_AJAX) {
197
+			echo wp_json_encode(
198
+				array_merge(
199
+					\EE_Error::get_notices(false),
200
+					array(
201
+					   'redirect_url' => $redirect_url
202
+					)
203
+				)
204
+			);
205
+			exit();
206
+		}
207
+		wp_safe_redirect($redirect_url);
208
+		exit();
209
+	}
210 210
 
211 211
 
212 212
 
@@ -237,9 +237,9 @@  discard block
 block discarded – undo
237 237
 	 * @return    void
238 238
 	 */
239 239
 	public static function bot_trap_settings_form() {
240
-        EED_Bot_Trap::_bot_trap_settings_form()->enqueue_js();
241
-        echo EED_Bot_Trap::_bot_trap_settings_form()->get_html();
242
-    }
240
+		EED_Bot_Trap::_bot_trap_settings_form()->enqueue_js();
241
+		echo EED_Bot_Trap::_bot_trap_settings_form()->get_html();
242
+	}
243 243
 
244 244
 
245 245
 
Please login to merge, or discard this patch.
modules/batch/EED_Batch.module.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -250,7 +250,7 @@
 block discarded – undo
250 250
 		if ( NULL === error_get_last() || ! headers_sent() ) {
251 251
 			header('Content-Type: application/json; charset=UTF-8');
252 252
 		}
253
-        echo wp_json_encode( $json );
253
+		echo wp_json_encode( $json );
254 254
 		exit();
255 255
 	}
256 256
 	
Please login to merge, or discard this patch.
Spacing   +55 added lines, -55 removed lines patch added patch discarded remove patch
@@ -17,13 +17,13 @@  discard block
 block discarded – undo
17 17
  * @since		 	   4.8.30.rc.007
18 18
  *
19 19
  */
20
-if( !defined( 'EVENT_ESPRESSO_VERSION' ) ) {
21
-	exit( 'No direct script access allowed' );
20
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
21
+	exit('No direct script access allowed');
22 22
 }
23 23
 
24
-define( 'BATCH_URL', plugin_dir_url( __FILE__ ) );
24
+define('BATCH_URL', plugin_dir_url(__FILE__));
25 25
 
26
-class EED_Batch extends EED_Module{
26
+class EED_Batch extends EED_Module {
27 27
 	
28 28
 	/**
29 29
 	 * Possibly value for $_REQUEST[ 'batch' ]. Indicates to run a job that
@@ -70,9 +70,9 @@  discard block
 block discarded – undo
70 70
 	public static function set_hooks() {
71 71
 		//because this is a possibel attack vector, let's have this disabled until 
72 72
 		//we at least have a real use for it on the frontend
73
-		if( apply_filters( 'FHEE__EED_Batch__set_hooks__enable_frontend_batch', false ) ) {
74
-			add_action( 'wp_enqueue_scripts', array( self::instance(), 'enqueue_scripts' ) );
75
-			add_filter( 'template_include', array( self::instance(), 'override_template' ), 99 );
73
+		if (apply_filters('FHEE__EED_Batch__set_hooks__enable_frontend_batch', false)) {
74
+			add_action('wp_enqueue_scripts', array(self::instance(), 'enqueue_scripts'));
75
+			add_filter('template_include', array(self::instance(), 'override_template'), 99);
76 76
 		}
77 77
 	}
78 78
 	
@@ -80,28 +80,28 @@  discard block
 block discarded – undo
80 80
 	 * Initializes some hooks for the admin in order to run batch jobs
81 81
 	 */
82 82
 	public static function set_hooks_admin() {
83
-		add_action( 'admin_menu', array( self::instance(), 'register_admin_pages' ) );
84
-		add_action( 'admin_enqueue_scripts', array( self::instance(), 'enqueue_scripts' ) );
83
+		add_action('admin_menu', array(self::instance(), 'register_admin_pages'));
84
+		add_action('admin_enqueue_scripts', array(self::instance(), 'enqueue_scripts'));
85 85
 		
86 86
 		//ajax
87
-		add_action('wp_ajax_espresso_batch_continue',array(self::instance(),'batch_continue'));
88
-		add_action('wp_ajax_espresso_batch_cleanup',array(self::instance(),'batch_cleanup'));
89
-		add_action('wp_ajax_nopriv_espresso_batch_continue',array(self::instance(),'batch_continue'));
90
-		add_action('wp_ajax_nopriv_espresso_batch_cleanup',array(self::instance(),'batch_cleanup'));
87
+		add_action('wp_ajax_espresso_batch_continue', array(self::instance(), 'batch_continue'));
88
+		add_action('wp_ajax_espresso_batch_cleanup', array(self::instance(), 'batch_cleanup'));
89
+		add_action('wp_ajax_nopriv_espresso_batch_continue', array(self::instance(), 'batch_continue'));
90
+		add_action('wp_ajax_nopriv_espresso_batch_cleanup', array(self::instance(), 'batch_cleanup'));
91 91
 	}
92 92
 	
93 93
 	/**
94 94
 	 * Enqueues batch scripts on the frontend or admin, and creates a job
95 95
 	 */
96 96
 	public function enqueue_scripts() { 
97
-		if( isset( $_REQUEST[ 'espresso_batch' ] ) 
97
+		if (isset($_REQUEST['espresso_batch']) 
98 98
 			|| 
99 99
 			( 
100
-				isset( $_REQUEST[ 'page' ] )
101
-				&& $_REQUEST[ 'page' ] == 'espresso_batch'
100
+				isset($_REQUEST['page'])
101
+				&& $_REQUEST['page'] == 'espresso_batch'
102 102
 			) 
103 103
 		) { 
104
-			switch( $this->batch_request_type() ) {
104
+			switch ($this->batch_request_type()) {
105 105
 				case self::batch_job:
106 106
 					$this->enqueue_scripts_styles_batch_create();
107 107
 					break;
@@ -117,11 +117,11 @@  discard block
 block discarded – undo
117 117
 	 */
118 118
 	public function enqueue_scripts_styles_batch_create() {	
119 119
 		$job_response = $this->_enqueue_batch_job_scripts_and_styles_and_start_job();
120
-		wp_enqueue_script( 'batch_runner_init', BATCH_URL . '/assets/batch_runner_init.js', array( 'batch_runner' ), EVENT_ESPRESSO_VERSION, true );
121
-		wp_localize_script( 'batch_runner_init', 'ee_job_response', $job_response->to_array() );
122
-		wp_localize_script( 'batch_runner_init', 'ee_job_i18n', 
120
+		wp_enqueue_script('batch_runner_init', BATCH_URL.'/assets/batch_runner_init.js', array('batch_runner'), EVENT_ESPRESSO_VERSION, true);
121
+		wp_localize_script('batch_runner_init', 'ee_job_response', $job_response->to_array());
122
+		wp_localize_script('batch_runner_init', 'ee_job_i18n', 
123 123
 			array(
124
-				'return_url' => $_REQUEST['return_url' ],
124
+				'return_url' => $_REQUEST['return_url'],
125 125
 			));
126 126
 	}
127 127
 	
@@ -131,15 +131,15 @@  discard block
 block discarded – undo
131 131
 	public function enqueue_scripts_styles_batch_file_create() {
132 132
 		//creates a job based on the request variable
133 133
 		$job_response = $this->_enqueue_batch_job_scripts_and_styles_and_start_job();
134
-		wp_enqueue_script( 'batch_file_runner_init', BATCH_URL . '/assets/batch_file_runner_init.js', array( 'batch_runner' ), EVENT_ESPRESSO_VERSION, true );
135
-		wp_localize_script( 'batch_file_runner_init', 'ee_job_response', $job_response->to_array() );
136
-		wp_localize_script( 'batch_file_runner_init', 'ee_job_i18n', 
134
+		wp_enqueue_script('batch_file_runner_init', BATCH_URL.'/assets/batch_file_runner_init.js', array('batch_runner'), EVENT_ESPRESSO_VERSION, true);
135
+		wp_localize_script('batch_file_runner_init', 'ee_job_response', $job_response->to_array());
136
+		wp_localize_script('batch_file_runner_init', 'ee_job_i18n', 
137 137
 				array(
138 138
 					'download_and_redirecting' => sprintf( 
139 139
 							__('File Generation complete. Downloading, and %1$sredirecting%2$s...', 'event_espresso'),
140
-							'<a href="' . $_REQUEST['return_url' ] .'">',
140
+							'<a href="'.$_REQUEST['return_url'].'">',
141 141
 							'</a>' ),
142
-					'return_url' => $_REQUEST['return_url' ],
142
+					'return_url' => $_REQUEST['return_url'],
143 143
 				));
144 144
 	}
145 145
 	
@@ -150,18 +150,18 @@  discard block
 block discarded – undo
150 150
 	 * @return \EventEspressoBatchRequest\Helpers\JobStepResponse
151 151
 	 */
152 152
 	protected function _enqueue_batch_job_scripts_and_styles_and_start_job() {
153
-		wp_register_script( 'progress_bar', EE_PLUGIN_DIR_URL . 'core/libraries/batch/Assets/progress_bar.js', array( 'jquery' ) );
154
-		wp_enqueue_style( 'progress_bar', EE_PLUGIN_DIR_URL . 'core/libraries/batch/Assets/progress_bar.css', array(), EVENT_ESPRESSO_VERSION );
155
-		wp_enqueue_script( 'batch_runner', EE_PLUGIN_DIR_URL . 'core/libraries/batch/Assets/batch_runner.js', array( 'progress_bar' ));
153
+		wp_register_script('progress_bar', EE_PLUGIN_DIR_URL.'core/libraries/batch/Assets/progress_bar.js', array('jquery'));
154
+		wp_enqueue_style('progress_bar', EE_PLUGIN_DIR_URL.'core/libraries/batch/Assets/progress_bar.css', array(), EVENT_ESPRESSO_VERSION);
155
+		wp_enqueue_script('batch_runner', EE_PLUGIN_DIR_URL.'core/libraries/batch/Assets/batch_runner.js', array('progress_bar'));
156 156
 		//just copy the bits of EE admin's eei18n that we need in the JS
157
-		wp_localize_script( 'batch_runner', 'eei18n', array( 'ajax_url' => WP_AJAX_URL, 'is_admin' => (bool)is_admin() ) );
158
-		$job_handler_classname = stripslashes( $_GET[ 'job_handler' ] );
157
+		wp_localize_script('batch_runner', 'eei18n', array('ajax_url' => WP_AJAX_URL, 'is_admin' => (bool) is_admin()));
158
+		$job_handler_classname = stripslashes($_GET['job_handler']);
159 159
 		$request_data = array_diff_key( 
160 160
 				$_REQUEST, 
161
-				array_flip( array( 'action',  'page', 'ee', 'batch' ) ) );
161
+				array_flip(array('action', 'page', 'ee', 'batch')) );
162 162
 		$batch_runner = new EventEspressoBatchRequest\BatchRequestProcessor();
163 163
 		//eg 'EventEspressoBatchRequest\JobHandlers\RegistrationsReport'
164
-		$job_response = $batch_runner->create_job( $job_handler_classname, $request_data );
164
+		$job_response = $batch_runner->create_job($job_handler_classname, $request_data);
165 165
 		//remember the response for later. We need it to display the page body
166 166
 		$this->_job_step_response = $job_response;
167 167
 		return $job_response;
@@ -172,9 +172,9 @@  discard block
 block discarded – undo
172 172
 	 * @param string $template
173 173
 	 * @return string
174 174
 	 */
175
-	public function override_template( $template ) {
176
-		if( isset( $_REQUEST[ 'espresso_batch' ] ) && isset( $_REQUEST[ 'batch' ] ) ) {
177
-			return EE_MODULES . 'batch' . DS . 'templates' . DS . 'batch_frontend_wrapper.template.html';
175
+	public function override_template($template) {
176
+		if (isset($_REQUEST['espresso_batch']) && isset($_REQUEST['batch'])) {
177
+			return EE_MODULES.'batch'.DS.'templates'.DS.'batch_frontend_wrapper.template.html';
178 178
 		}
179 179
 		return $template;
180 180
 	}
@@ -185,11 +185,11 @@  discard block
 block discarded – undo
185 185
 	public function register_admin_pages() {
186 186
 		add_submenu_page( 
187 187
 			'', //parent slug. we don't want this to actually appear in the menu
188
-			__( 'Batch Job', 'event_espresso' ), //page title
188
+			__('Batch Job', 'event_espresso'), //page title
189 189
 			'n/a', //menu title
190 190
 			'read', //we want this page to actually be accessible to anyone,  
191 191
 			'espresso_batch', //menu slug
192
-			array( self::instance(), 'show_admin_page' )
192
+			array(self::instance(), 'show_admin_page')
193 193
 		);
194 194
 	}
195 195
 	
@@ -199,8 +199,8 @@  discard block
 block discarded – undo
199 199
 	 */
200 200
 	public function show_admin_page() { 
201 201
 		echo EEH_Template::locate_template( 
202
-			EE_MODULES . 'batch' . DS . 'templates' . DS . 'batch_wrapper.template.html', 
203
-			array( 'batch_request_type' => $this->batch_request_type() )
202
+			EE_MODULES.'batch'.DS.'templates'.DS.'batch_wrapper.template.html', 
203
+			array('batch_request_type' => $this->batch_request_type())
204 204
 		);
205 205
 	}
206 206
 	
@@ -208,10 +208,10 @@  discard block
 block discarded – undo
208 208
 	 * Receives ajax calls for continuing a job
209 209
 	 */
210 210
 	public function batch_continue() {
211
-		$job_id = sanitize_text_field( $_REQUEST[ 'job_id' ] );
211
+		$job_id = sanitize_text_field($_REQUEST['job_id']);
212 212
 		$batch_runner = new EventEspressoBatchRequest\BatchRequestProcessor();
213
-		$response_obj = $batch_runner->continue_job( $job_id);
214
-		$this->_return_json( $response_obj->to_array() );
213
+		$response_obj = $batch_runner->continue_job($job_id);
214
+		$this->_return_json($response_obj->to_array());
215 215
 	}
216 216
 	
217 217
 	/**
@@ -219,10 +219,10 @@  discard block
 block discarded – undo
219 219
 	 * @return type
220 220
 	 */
221 221
 	public function batch_cleanup() {
222
-		$job_id = sanitize_text_field( $_REQUEST[ 'job_id' ] );
222
+		$job_id = sanitize_text_field($_REQUEST['job_id']);
223 223
 		$batch_runner = new EventEspressoBatchRequest\BatchRequestProcessor();
224
-		$response_obj = $batch_runner->cleanup_job( $job_id );
225
-		$this->_return_json( $response_obj->to_array() );
224
+		$response_obj = $batch_runner->cleanup_job($job_id);
225
+		$this->_return_json($response_obj->to_array());
226 226
 	}
227 227
 	
228 228
 	
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
 	 *	'isEEajax' => true,//indicates this is a response from EE
239 239
 	 * )
240 240
 	 */
241
-	protected function _return_json( $data ) {
241
+	protected function _return_json($data) {
242 242
 		$json = array(
243 243
 			'notices' => EE_Error::get_notices(),
244 244
 			'data' => $data,
@@ -247,10 +247,10 @@  discard block
 block discarded – undo
247 247
 
248 248
 
249 249
 		// make sure there are no php errors or headers_sent.  Then we can set correct json header.
250
-		if ( NULL === error_get_last() || ! headers_sent() ) {
250
+		if (NULL === error_get_last() || ! headers_sent()) {
251 251
 			header('Content-Type: application/json; charset=UTF-8');
252 252
 		}
253
-        echo wp_json_encode( $json );
253
+        echo wp_json_encode($json);
254 254
 		exit();
255 255
 	}
256 256
 	
@@ -266,16 +266,16 @@  discard block
 block discarded – undo
266 266
 	 * @return string: EED_Batch::batch_job, EED_Batch::batch_file_job, EED_Batch::batch_not_job
267 267
 	 */
268 268
 	public function batch_request_type() {
269
-		if( $this->_batch_request_type === null ) {
270
-			if( isset( $_GET[ 'batch' ] ) ) {
271
-				if( $_GET[ 'batch' ] == self::batch_job ) {
269
+		if ($this->_batch_request_type === null) {
270
+			if (isset($_GET['batch'])) {
271
+				if ($_GET['batch'] == self::batch_job) {
272 272
 					$this->_batch_request_type = self::batch_job;
273
-				} elseif( $_GET[ 'batch' ] == self::batch_file_job ) {
273
+				} elseif ($_GET['batch'] == self::batch_file_job) {
274 274
 					$this->_batch_request_type = self::batch_file_job;
275 275
 				}
276 276
 			}
277 277
 			//if we didn't find that it was a batch request, indicate it wasn't
278
-			if( $this->_batch_request_type === null ) {
278
+			if ($this->_batch_request_type === null) {
279 279
 				$this->_batch_request_type = self::batch_not_job;
280 280
 			}
281 281
 		}
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
 	 * Unnecessary
287 287
 	 * @param type $WP
288 288
 	 */
289
-	public function run( $WP ) {
289
+	public function run($WP) {
290 290
 		
291 291
 	}
292 292
 
Please login to merge, or discard this patch.
shortcodes/espresso_thank_you/EES_Espresso_Thank_You.shortcode.php 1 patch
Spacing   +135 added lines, -135 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1
-<?php if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
2
-	exit( 'No direct script access allowed' );
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3 3
 }
4 4
 
5 5
 
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 	 * @return    void
92 92
 	 */
93 93
 	public static function set_hooks() {
94
-		add_action( 'wp_loaded', array( 'EES_Espresso_Thank_You', 'set_definitions' ), 2 );
94
+		add_action('wp_loaded', array('EES_Espresso_Thank_You', 'set_definitions'), 2);
95 95
 	}
96 96
 
97 97
 
@@ -104,22 +104,22 @@  discard block
 block discarded – undo
104 104
 	 */
105 105
 	public static function set_hooks_admin() {
106 106
 		// AJAX for IPN monitoring
107
-		add_filter( 'heartbeat_received', array( 'EES_Espresso_Thank_You', 'thank_you_page_IPN_monitor' ), 10, 3 );
107
+		add_filter('heartbeat_received', array('EES_Espresso_Thank_You', 'thank_you_page_IPN_monitor'), 10, 3);
108 108
 		add_filter(
109 109
 			'heartbeat_nopriv_received',
110
-			array( 'EES_Espresso_Thank_You', 'thank_you_page_IPN_monitor' ),
110
+			array('EES_Espresso_Thank_You', 'thank_you_page_IPN_monitor'),
111 111
 			10,
112 112
 			3
113 113
 		);
114 114
 		add_action(
115 115
 			'wp_ajax_espresso_resend_reg_confirmation_email',
116
-			array( 'EES_Espresso_Thank_You', 'resend_reg_confirmation_email' ),
116
+			array('EES_Espresso_Thank_You', 'resend_reg_confirmation_email'),
117 117
 			10,
118 118
 			2
119 119
 		);
120 120
 		add_action(
121 121
 			'wp_ajax_nopriv_espresso_resend_reg_confirmation_email',
122
-			array( 'EES_Espresso_Thank_You', 'resend_reg_confirmation_email' ),
122
+			array('EES_Espresso_Thank_You', 'resend_reg_confirmation_email'),
123 123
 			10,
124 124
 			2
125 125
 		);
@@ -134,8 +134,8 @@  discard block
 block discarded – undo
134 134
 	 * @return    void
135 135
 	 */
136 136
 	public static function set_definitions() {
137
-		define( 'THANK_YOU_ASSETS_URL', plugin_dir_url( __FILE__ ) . 'assets' . DS );
138
-		define( 'THANK_YOU_TEMPLATES_PATH', str_replace( '\\', DS, plugin_dir_path( __FILE__ ) ) . 'templates' . DS );
137
+		define('THANK_YOU_ASSETS_URL', plugin_dir_url(__FILE__).'assets'.DS);
138
+		define('THANK_YOU_TEMPLATES_PATH', str_replace('\\', DS, plugin_dir_path(__FILE__)).'templates'.DS);
139 139
 	}
140 140
 
141 141
 
@@ -147,13 +147,13 @@  discard block
 block discarded – undo
147 147
 	 * @return    EE_Transaction
148 148
 	 */
149 149
 	public function get_txn() {
150
-		if ( $this->_current_txn instanceof EE_Transaction ) {
150
+		if ($this->_current_txn instanceof EE_Transaction) {
151 151
 			return $this->_current_txn;
152 152
 		}
153
-		$TXN_model = EE_Registry::instance()->load_model( 'Transaction' );
154
-		if ( ! $TXN_model instanceof EEM_Transaction ) {
153
+		$TXN_model = EE_Registry::instance()->load_model('Transaction');
154
+		if ( ! $TXN_model instanceof EEM_Transaction) {
155 155
 			EE_Error::add_error(
156
-				__( 'The transaction model could not be established.', 'event_espresso' ),
156
+				__('The transaction model could not be established.', 'event_espresso'),
157 157
 				__FILE__,
158 158
 				__FUNCTION__,
159 159
 				__LINE__
@@ -161,9 +161,9 @@  discard block
 block discarded – undo
161 161
 			return null;
162 162
 		}
163 163
 		//get the transaction. yes, we may have just loaded it, but it may have been updated, or this may be via an ajax request
164
-		$this->_current_txn = $TXN_model->get_transaction_from_reg_url_link( $this->_reg_url_link );
164
+		$this->_current_txn = $TXN_model->get_transaction_from_reg_url_link($this->_reg_url_link);
165 165
 		// verify TXN
166
-		if ( WP_DEBUG && ! $this->_current_txn instanceof EE_Transaction ) {
166
+		if (WP_DEBUG && ! $this->_current_txn instanceof EE_Transaction) {
167 167
 			EE_Error::add_error(
168 168
 				__(
169 169
 					'No transaction information could be retrieved or the transaction data is not of the correct type.',
@@ -187,16 +187,16 @@  discard block
 block discarded – undo
187 187
 	 * @param int $since
188 188
 	 * @return    mixed array of EE_Payment || FALSE
189 189
 	 */
190
-	public function get_txn_payments( $since = 0 ) {
191
-		if ( ! $this->get_txn() ) {
190
+	public function get_txn_payments($since = 0) {
191
+		if ( ! $this->get_txn()) {
192 192
 			return false;
193 193
 		}
194
-		$args = array( 'order_by' => array( 'PAY_timestamp' => 'ASC' ) );
195
-		if ( $since > 0 ) {
196
-			$args[0] = array( 'PAY_timestamp' => array( '>', $since ) );
194
+		$args = array('order_by' => array('PAY_timestamp' => 'ASC'));
195
+		if ($since > 0) {
196
+			$args[0] = array('PAY_timestamp' => array('>', $since));
197 197
 		}
198 198
 		// get array of payments with most recent first
199
-		return $this->_current_txn->payments( $args );
199
+		return $this->_current_txn->payments($args);
200 200
 	}
201 201
 
202 202
 
@@ -208,11 +208,11 @@  discard block
 block discarded – undo
208 208
 	 * @return    void
209 209
 	 */
210 210
 	private function _get_reg_url_link() {
211
-		if ( ! empty( $this->_reg_url_link ) ) {
211
+		if ( ! empty($this->_reg_url_link)) {
212 212
 			return;
213 213
 		}
214 214
 		// only do thank you page stuff if we have a REG_url_link in the url
215
-		if ( WP_DEBUG && ! EE_Registry::instance()->REQ->is_set( 'e_reg_url_link' ) ) {
215
+		if (WP_DEBUG && ! EE_Registry::instance()->REQ->is_set('e_reg_url_link')) {
216 216
 			EE_Error::add_error(
217 217
 				__(
218 218
 					'No transaction information could be retrieved because the registration URL link is missing or invalid.',
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
 			return;
226 226
 		}
227 227
 		// check for reg_url_link
228
-		$this->_reg_url_link = EE_Registry::instance()->REQ->get( 'e_reg_url_link' );
228
+		$this->_reg_url_link = EE_Registry::instance()->REQ->get('e_reg_url_link');
229 229
 	}
230 230
 
231 231
 
@@ -237,8 +237,8 @@  discard block
 block discarded – undo
237 237
 	 * @param    string $reg_url_link
238 238
 	 * @return    string
239 239
 	 */
240
-	public function set_reg_url_link( $reg_url_link = null ) {
241
-		$this->_reg_url_link = ! empty( $reg_url_link ) ? $reg_url_link : $this->_reg_url_link;
240
+	public function set_reg_url_link($reg_url_link = null) {
241
+		$this->_reg_url_link = ! empty($reg_url_link) ? $reg_url_link : $this->_reg_url_link;
242 242
 	}
243 243
 
244 244
 
@@ -251,28 +251,28 @@  discard block
 block discarded – undo
251 251
 	 * @param    WP $WP
252 252
 	 * @return    void
253 253
 	 */
254
-	public function run( WP $WP ) {
254
+	public function run(WP $WP) {
255 255
 		// remove site_url() from thank you page URL
256
-		$thank_you_page_URL = substr( EE_Registry::instance()->CFG->core->thank_you_page_url(), strlen( home_url() ) );
256
+		$thank_you_page_URL = substr(EE_Registry::instance()->CFG->core->thank_you_page_url(), strlen(home_url()));
257 257
 		// remove other non-essential details from URL
258
-		$thank_you_page_URL = trim( parse_url( $thank_you_page_URL, PHP_URL_PATH ), '/' );
258
+		$thank_you_page_URL = trim(parse_url($thank_you_page_URL, PHP_URL_PATH), '/');
259 259
 		// ensure this shortcode doesn't trigger on anything BUT the thank you page
260
-		if ( isset( $WP->request ) && trim( $WP->request, '/' ) !== $thank_you_page_URL ) {
260
+		if (isset($WP->request) && trim($WP->request, '/') !== $thank_you_page_URL) {
261 261
 			return;
262 262
 		} else if (
263
-			isset( $WP->query_vars['page_id'] )
264
-			&& (int)$WP->query_vars['page_id'] !== (int)EE_Registry::instance()->CFG->core->thank_you_page_id
263
+			isset($WP->query_vars['page_id'])
264
+			&& (int) $WP->query_vars['page_id'] !== (int) EE_Registry::instance()->CFG->core->thank_you_page_id
265 265
 		) {
266 266
 			return;
267 267
 		}
268 268
 		$this->_get_reg_url_link();
269 269
 		// resend_reg_confirmation_email ?
270
-		if ( EE_Registry::instance()->REQ->is_set( 'resend' ) ) {
270
+		if (EE_Registry::instance()->REQ->is_set('resend')) {
271 271
 			EES_Espresso_Thank_You::resend_reg_confirmation_email();
272 272
 		}
273 273
 		// load assets
274
-		add_action( 'wp_enqueue_scripts', array( $this, 'load_js' ), 10 );
275
-		EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ );
274
+		add_action('wp_enqueue_scripts', array($this, 'load_js'), 10);
275
+		EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__);
276 276
 		$this->_translate_strings();
277 277
 	}
278 278
 
@@ -326,12 +326,12 @@  discard block
 block discarded – undo
326 326
 	public function load_js() {
327 327
 		wp_register_script(
328 328
 			'thank_you_page',
329
-			THANK_YOU_ASSETS_URL . 'thank_you_page.js',
330
-			array( 'espresso_core', 'heartbeat' ),
329
+			THANK_YOU_ASSETS_URL.'thank_you_page.js',
330
+			array('espresso_core', 'heartbeat'),
331 331
 			EVENT_ESPRESSO_VERSION,
332 332
 			true
333 333
 		);
334
-		wp_enqueue_script( 'thank_you_page' );
334
+		wp_enqueue_script('thank_you_page');
335 335
 	}
336 336
 
337 337
 
@@ -345,9 +345,9 @@  discard block
 block discarded – undo
345 345
 	 */
346 346
 	public function init() {
347 347
 		$this->_get_reg_url_link();
348
-		if ( ! $this->get_txn() ) {
348
+		if ( ! $this->get_txn()) {
349 349
 			echo EEH_HTML::div(
350
-				EEH_HTML::h4( __( 'We\'re sorry...', 'event_espresso' ), '', '' ) .
350
+				EEH_HTML::h4(__('We\'re sorry...', 'event_espresso'), '', '').
351 351
 				sprintf(
352 352
 					__(
353 353
 						'This is a system page for displaying transaction information after a purchase.%1$sYou are most likely seeing this notice because you have navigated to this page%1$sthrough some means other than completing a transaction.%1$sSorry for the disappointment, but you will most likely find nothing of interest here.%1$s%1$s',
@@ -361,8 +361,8 @@  discard block
 block discarded – undo
361 361
 			return null;
362 362
 		}
363 363
 		// if we've made it to the Thank You page, then let's toggle any "Failed" transactions to "Incomplete"
364
-		if ( $this->_current_txn->status_ID() === EEM_Transaction::failed_status_code ) {
365
-			$this->_current_txn->set_status( EEM_Transaction::incomplete_status_code );
364
+		if ($this->_current_txn->status_ID() === EEM_Transaction::failed_status_code) {
365
+			$this->_current_txn->set_status(EEM_Transaction::incomplete_status_code);
366 366
 			$this->_current_txn->save();
367 367
 		}
368 368
 		$this->_primary_registrant = $this->_current_txn->primary_registration() instanceof EE_Registration
@@ -375,15 +375,15 @@  discard block
 block discarded – undo
375 375
 		);
376 376
 		$this->_show_try_pay_again_link = $show_try_pay_again_link_default;
377 377
 		// txn status ?
378
-		if ( $this->_current_txn->is_completed() ) {
378
+		if ($this->_current_txn->is_completed()) {
379 379
 			$this->_show_try_pay_again_link = $show_try_pay_again_link_default;
380 380
 		} else if (
381 381
 			$this->_current_txn->is_incomplete()
382
-			&& ( $this->_primary_registrant->is_approved()
383
-			|| $this->_primary_registrant->is_pending_payment() )
382
+			&& ($this->_primary_registrant->is_approved()
383
+			|| $this->_primary_registrant->is_pending_payment())
384 384
 		) {
385 385
 			$this->_show_try_pay_again_link = true;
386
-		} else if ( $this->_primary_registrant->is_approved() || $this->_primary_registrant->is_pending_payment() ) {
386
+		} else if ($this->_primary_registrant->is_approved() || $this->_primary_registrant->is_pending_payment()) {
387 387
 			// its pending
388 388
 			$this->_show_try_pay_again_link = isset(
389 389
 				EE_Registry::instance()->CFG->registration->show_pending_payment_options
@@ -409,21 +409,21 @@  discard block
 block discarded – undo
409 409
 		}
410 410
 		// link to SPCO
411 411
 		$revisit_spco_url = add_query_arg(
412
-			array( 'ee' => '_register', 'revisit' => true, 'e_reg_url_link' => $this->_reg_url_link ),
412
+			array('ee' => '_register', 'revisit' => true, 'e_reg_url_link' => $this->_reg_url_link),
413 413
 			EE_Registry::instance()->CFG->core->reg_page_url()
414 414
 		);
415 415
 		// link to SPCO payment_options
416 416
 		$this->_SPCO_payment_options_url = $this->_primary_registrant instanceof EE_Registration
417 417
 			? $this->_primary_registrant->payment_overview_url()
418 418
 			: add_query_arg(
419
-				array( 'step' => 'payment_options' ),
419
+				array('step' => 'payment_options'),
420 420
 				$revisit_spco_url
421 421
 			);
422 422
 		// link to SPCO attendee_information
423 423
 		$this->_SPCO_attendee_information_url = $this->_primary_registrant instanceof EE_Registration
424 424
 			? $this->_primary_registrant->edit_attendee_information_url()
425 425
 			: false;
426
-		do_action( 'AHEE__EES_Espresso_Thank_You__init_end', $this->_current_txn );
426
+		do_action('AHEE__EES_Espresso_Thank_You__init_end', $this->_current_txn);
427 427
 		// set no cache headers and constants
428 428
 		EE_System::do_not_cache();
429 429
 	}
@@ -438,15 +438,15 @@  discard block
 block discarded – undo
438 438
 	 * @return    string
439 439
 	 * @throws \EE_Error
440 440
 	 */
441
-	public function process_shortcode( $attributes = array() ) {
441
+	public function process_shortcode($attributes = array()) {
442 442
 		$this->init();
443
-		if ( ! $this->_current_txn instanceof EE_Transaction ) {
443
+		if ( ! $this->_current_txn instanceof EE_Transaction) {
444 444
 			return EE_Error::get_notices();
445 445
 		}
446 446
 		//EEH_Debug_Tools::log( __CLASS__, __FUNCTION__, __LINE__, array( $this->_current_txn ), true, 	'EE_Transaction: ' . $this->_current_txn->ID() );
447 447
 		// link to receipt
448
-		$template_args['TXN_receipt_url'] = $this->_current_txn->receipt_url( 'html' );
449
-		if ( ! empty( $template_args['TXN_receipt_url'] ) ) {
448
+		$template_args['TXN_receipt_url'] = $this->_current_txn->receipt_url('html');
449
+		if ( ! empty($template_args['TXN_receipt_url'])) {
450 450
 			$template_args['order_conf_desc'] = __(
451 451
 				'%1$sCongratulations%2$sYour registration has been successfully processed.%3$sCheck your email for your registration confirmation or click the button below to view / download / print a full description of your purchases and registration information.',
452 452
 				'event_espresso'
@@ -458,13 +458,13 @@  discard block
 block discarded – undo
458 458
 			);
459 459
 		}
460 460
 		$template_args['transaction'] = $this->_current_txn;
461
-		$template_args['revisit'] = EE_Registry::instance()->REQ->get( 'revisit', false );
462
-		add_action( 'AHEE__thank_you_page_overview_template__content', array( $this, 'get_registration_details' ) );
463
-		if ( $this->_is_primary && ! $this->_current_txn->is_free() ) {
464
-			add_action( 'AHEE__thank_you_page_overview_template__content', array( $this, 'get_ajax_content' ) );
461
+		$template_args['revisit'] = EE_Registry::instance()->REQ->get('revisit', false);
462
+		add_action('AHEE__thank_you_page_overview_template__content', array($this, 'get_registration_details'));
463
+		if ($this->_is_primary && ! $this->_current_txn->is_free()) {
464
+			add_action('AHEE__thank_you_page_overview_template__content', array($this, 'get_ajax_content'));
465 465
 		}
466 466
 		return EEH_Template::locate_template(
467
-			THANK_YOU_TEMPLATES_PATH . 'thank-you-page-overview.template.php',
467
+			THANK_YOU_TEMPLATES_PATH.'thank-you-page-overview.template.php',
468 468
 			$template_args,
469 469
 			true,
470 470
 			true
@@ -485,15 +485,15 @@  discard block
 block discarded – undo
485 485
 	 * @return    array
486 486
 	 * @throws \EE_Error
487 487
 	 */
488
-	public static function thank_you_page_IPN_monitor( $response = array(), $data = array() ) {
488
+	public static function thank_you_page_IPN_monitor($response = array(), $data = array()) {
489 489
 		// does this heartbeat contain our data ?
490
-		if ( ! isset( $data['espresso_thank_you_page'] ) ) {
490
+		if ( ! isset($data['espresso_thank_you_page'])) {
491 491
 			return $response;
492 492
 		}
493 493
 		// check for reg_url_link in the incoming heartbeat data
494
-		if ( ! isset( $data['espresso_thank_you_page']['e_reg_url_link'] ) ) {
494
+		if ( ! isset($data['espresso_thank_you_page']['e_reg_url_link'])) {
495 495
 			$response['espresso_thank_you_page'] = array(
496
-			'errors' => ! empty( $notices['errors'] )
496
+			'errors' => ! empty($notices['errors'])
497 497
 				? $notices['errors']
498 498
 				: __(
499 499
 					'No transaction information could be retrieved because the registration URL link is missing or invalid.',
@@ -508,15 +508,15 @@  discard block
 block discarded – undo
508 508
 		EES_Espresso_Thank_You::set_definitions();
509 509
 		/** @var $espresso_thank_you_page EES_Espresso_Thank_You */
510 510
 		$espresso_thank_you_page = EES_Espresso_Thank_You::instance();
511
-		$espresso_thank_you_page->set_reg_url_link( $data['espresso_thank_you_page']['e_reg_url_link'] );
511
+		$espresso_thank_you_page->set_reg_url_link($data['espresso_thank_you_page']['e_reg_url_link']);
512 512
 		$espresso_thank_you_page->init();
513 513
 		//get TXN
514 514
 		$TXN = $espresso_thank_you_page->get_txn();
515 515
 		// no TXN? then get out
516
-		if ( ! $TXN instanceof EE_Transaction ) {
516
+		if ( ! $TXN instanceof EE_Transaction) {
517 517
 			$notices = EE_Error::get_notices();
518 518
 			$response['espresso_thank_you_page'] = array(
519
-			'errors' => ! empty( $notices['errors'] )
519
+			'errors' => ! empty($notices['errors'])
520 520
 				? $notices['errors']
521 521
 				: sprintf(
522 522
 					__(
@@ -529,13 +529,13 @@  discard block
 block discarded – undo
529 529
 			return $response;
530 530
 		}
531 531
 		// grab transient of TXN's status
532
-		$txn_status = isset( $data['espresso_thank_you_page']['txn_status'] )
532
+		$txn_status = isset($data['espresso_thank_you_page']['txn_status'])
533 533
 			? $data['espresso_thank_you_page']['txn_status']
534 534
 			: null;
535 535
 		// has the TXN status changed since we last checked (or empty because this is the first time running through this code)?
536
-		if ( $txn_status !== $TXN->status_ID() ) {
536
+		if ($txn_status !== $TXN->status_ID()) {
537 537
 			// switch between two possible basic outcomes
538
-			switch ( $TXN->status_ID() ) {
538
+			switch ($TXN->status_ID()) {
539 539
 				// TXN has been updated in some way
540 540
 				case EEM_Transaction::overpaid_status_code:
541 541
 				case EEM_Transaction::complete_status_code:
@@ -550,25 +550,25 @@  discard block
 block discarded – undo
550 550
 				case EEM_Transaction::failed_status_code:
551 551
 				default:
552 552
 					// keep on waiting...
553
-					return $espresso_thank_you_page->_update_server_wait_time( $data['espresso_thank_you_page'] );
553
+					return $espresso_thank_you_page->_update_server_wait_time($data['espresso_thank_you_page']);
554 554
 			}
555 555
 			// or is the TXN still failed (never been updated) ???
556
-		} else if ( $TXN->failed() ) {
556
+		} else if ($TXN->failed()) {
557 557
 			// keep on waiting...
558
-			return $espresso_thank_you_page->_update_server_wait_time( $data['espresso_thank_you_page'] );
558
+			return $espresso_thank_you_page->_update_server_wait_time($data['espresso_thank_you_page']);
559 559
 		}
560 560
 		// TXN is happening so let's get the payments now
561 561
 		// if we've already gotten payments then the heartbeat data will contain the timestamp of the last time we checked
562
-		$since = isset( $data['espresso_thank_you_page']['get_payments_since'] )
562
+		$since = isset($data['espresso_thank_you_page']['get_payments_since'])
563 563
 			? $data['espresso_thank_you_page']['get_payments_since']
564 564
 			: 0;
565 565
 		// then check for payments
566
-		$payments = $espresso_thank_you_page->get_txn_payments( $since );
566
+		$payments = $espresso_thank_you_page->get_txn_payments($since);
567 567
 		// has a payment been processed ?
568
-		if ( ! empty( $payments ) || $espresso_thank_you_page->_is_offline_payment_method ) {
569
-			if ( $since ) {
568
+		if ( ! empty($payments) || $espresso_thank_you_page->_is_offline_payment_method) {
569
+			if ($since) {
570 570
 				$response['espresso_thank_you_page'] = array(
571
-					'new_payments'        => $espresso_thank_you_page->get_new_payments( $payments ),
571
+					'new_payments'        => $espresso_thank_you_page->get_new_payments($payments),
572 572
 					'transaction_details' => $espresso_thank_you_page->get_transaction_details(),
573 573
 					'txn_status'          => $TXN->status_ID()
574 574
 				);
@@ -594,9 +594,9 @@  discard block
 block discarded – undo
594 594
 	 * @param    array $thank_you_page_data thank you page portion of the incoming JSON array from the WP heartbeat data
595 595
 	 * @return    array
596 596
 	 */
597
-	private function _update_server_wait_time( $thank_you_page_data = array() ) {
597
+	private function _update_server_wait_time($thank_you_page_data = array()) {
598 598
 		$response['espresso_thank_you_page'] = array(
599
-			'still_waiting' => isset( $thank_you_page_data['initial_access'] )
599
+			'still_waiting' => isset($thank_you_page_data['initial_access'])
600 600
 				? time() - $thank_you_page_data['initial_access']
601 601
 				: 0,
602 602
 			'txn_status'    => $this->_current_txn->status_ID()
@@ -621,17 +621,17 @@  discard block
 block discarded – undo
621 621
 		$template_args['is_primary'] = $this->_is_primary;
622 622
 		$template_args['SPCO_attendee_information_url'] = $this->_SPCO_attendee_information_url;
623 623
 		$template_args['resend_reg_confirmation_url'] = add_query_arg(
624
-			array( 'token' => $this->_reg_url_link, 'resend_reg_confirmation' => 'true' ),
624
+			array('token' => $this->_reg_url_link, 'resend_reg_confirmation' => 'true'),
625 625
 			EE_Registry::instance()->CFG->core->thank_you_page_url()
626 626
 		);
627 627
 		// verify template arguments
628
-		EEH_Template_Validator::verify_instanceof( $template_args['transaction'], '$transaction', 'EE_Transaction' );
628
+		EEH_Template_Validator::verify_instanceof($template_args['transaction'], '$transaction', 'EE_Transaction');
629 629
 		EEH_Template_Validator::verify_isnt_null(
630 630
 			$template_args['SPCO_attendee_information_url'],
631 631
 			'$SPCO_attendee_information_url'
632 632
 		);
633 633
 		echo EEH_Template::locate_template(
634
-			THANK_YOU_TEMPLATES_PATH . 'thank-you-page-registration-details.template.php',
634
+			THANK_YOU_TEMPLATES_PATH.'thank-you-page-registration-details.template.php',
635 635
 			$template_args,
636 636
 			true,
637 637
 			true
@@ -644,16 +644,16 @@  discard block
 block discarded – undo
644 644
 	 *    resend_reg_confirmation_email
645 645
 	 */
646 646
 	public static function resend_reg_confirmation_email() {
647
-		EE_Registry::instance()->load_core( 'Request_Handler' );
648
-		$reg_url_link = EE_Registry::instance()->REQ->get( 'token' );
647
+		EE_Registry::instance()->load_core('Request_Handler');
648
+		$reg_url_link = EE_Registry::instance()->REQ->get('token');
649 649
 		// was a REG_ID passed ?
650
-		if ( $reg_url_link ) {
651
-			$registration = EE_Registry::instance()->load_model( 'Registration' )->get_one(
652
-				array( array( 'REG_url_link' => $reg_url_link ) )
650
+		if ($reg_url_link) {
651
+			$registration = EE_Registry::instance()->load_model('Registration')->get_one(
652
+				array(array('REG_url_link' => $reg_url_link))
653 653
 			);
654
-			if ( $registration instanceof EE_Registration ) {
654
+			if ($registration instanceof EE_Registration) {
655 655
 				// resend email
656
-				EED_Messages::process_resend( array( '_REG_ID' => $registration->ID() ) );
656
+				EED_Messages::process_resend(array('_REG_ID' => $registration->ID()));
657 657
 			} else {
658 658
 				EE_Error::add_error(
659 659
 					__(
@@ -677,16 +677,16 @@  discard block
 block discarded – undo
677 677
 			);
678 678
 		}
679 679
 		// request sent via AJAX ?
680
-		if ( EE_FRONT_AJAX ) {
681
-			echo wp_json_encode( EE_Error::get_notices( false ) );
680
+		if (EE_FRONT_AJAX) {
681
+			echo wp_json_encode(EE_Error::get_notices(false));
682 682
 			die();
683 683
 			// or was JS disabled ?
684 684
 		} else {
685 685
 			// save errors so that they get picked up on the next request
686
-			EE_Error::get_notices( true, true );
686
+			EE_Error::get_notices(true, true);
687 687
 			wp_safe_redirect(
688 688
 				add_query_arg(
689
-					array( 'e_reg_url_link' => $reg_url_link ),
689
+					array('e_reg_url_link' => $reg_url_link),
690 690
 					EE_Registry::instance()->CFG->core->thank_you_page_url()
691 691
 				)
692 692
 			);
@@ -702,26 +702,26 @@  discard block
 block discarded – undo
702 702
 	 * @return    void
703 703
 	 */
704 704
 	public function get_ajax_content() {
705
-		if ( ! $this->get_txn() ) {
705
+		if ( ! $this->get_txn()) {
706 706
 			return;
707 707
 		}
708 708
 		// first determine which event(s) require pre-approval or not
709 709
 		$events = array();
710 710
 		$events_requiring_pre_approval = array();
711
-		foreach ( $this->_current_txn->registrations() as $registration ) {
712
-			if ( $registration instanceof EE_Registration ) {
711
+		foreach ($this->_current_txn->registrations() as $registration) {
712
+			if ($registration instanceof EE_Registration) {
713 713
 				$event = $registration->event();
714
-				if ( $event instanceof EE_Event ) {
715
-					if ( $registration->is_not_approved() && $registration->event() instanceof EE_Event ) {
716
-						$events_requiring_pre_approval[ $event->ID() ] = $event;
714
+				if ($event instanceof EE_Event) {
715
+					if ($registration->is_not_approved() && $registration->event() instanceof EE_Event) {
716
+						$events_requiring_pre_approval[$event->ID()] = $event;
717 717
 					} else {
718
-						$events[ $event->ID() ] = $event;
718
+						$events[$event->ID()] = $event;
719 719
 					}
720 720
 				}
721 721
 			}
722 722
 		}
723
-		$this->display_details_for_events_requiring_pre_approval( $events_requiring_pre_approval );
724
-		$this->display_details_for_events( $events );
723
+		$this->display_details_for_events_requiring_pre_approval($events_requiring_pre_approval);
724
+		$this->display_details_for_events($events);
725 725
 	}
726 726
 
727 727
 
@@ -733,8 +733,8 @@  discard block
 block discarded – undo
733 733
 	 * @param EE_Event[] $events
734 734
 	 * @return string
735 735
 	 */
736
-	public function display_details_for_events( $events = array() ) {
737
-		if ( ! empty( $events ) ) {
736
+	public function display_details_for_events($events = array()) {
737
+		if ( ! empty($events)) {
738 738
 			?>
739 739
 			<div id="espresso-thank-you-page-ajax-content-dv">
740 740
 				<div id="espresso-thank-you-page-ajax-transaction-dv"></div>
@@ -746,7 +746,7 @@  discard block
 block discarded – undo
746 746
 							'event_espresso'
747 747
 							); ?></span>
748 748
 					</div>
749
-					<?php if ( ! $this->_is_offline_payment_method && ! $this->_payments_closed ) : ?>
749
+					<?php if ( ! $this->_is_offline_payment_method && ! $this->_payments_closed) : ?>
750 750
 						<p id="ee-ajax-loading-pg" class="highlight-bg small-text clear">
751 751
 							<?php echo apply_filters(
752 752
 								'EES_Espresso_Thank_You__get_ajax_content__waiting_for_IPN_msg',
@@ -757,7 +757,7 @@  discard block
 block discarded – undo
757 757
 							); ?>
758 758
 							<br/>
759 759
 							<span class="jst-rght ee-block small-text lt-grey-text">
760
-								<?php _e( 'current wait time ', 'event_espresso' ); ?>
760
+								<?php _e('current wait time ', 'event_espresso'); ?>
761 761
 							<span id="espresso-thank-you-page-ajax-time-dv">00:00:00</span></span>
762 762
 						</p>
763 763
 					<?php endif; ?>
@@ -777,11 +777,11 @@  discard block
 block discarded – undo
777 777
 	 * @param EE_Event[] $events
778 778
 	 * @return string
779 779
 	 */
780
-	public function display_details_for_events_requiring_pre_approval( $events = array() ) {
781
-		if ( ! empty( $events ) ) {
780
+	public function display_details_for_events_requiring_pre_approval($events = array()) {
781
+		if ( ! empty($events)) {
782 782
 			?>
783 783
 			<div id="espresso-thank-you-page-not-approved-message-dv">
784
-				<h4 class="orange-text"><?php _e( 'Important Notice:', 'event_espresso' ); ?></h4>
784
+				<h4 class="orange-text"><?php _e('Important Notice:', 'event_espresso'); ?></h4>
785 785
 				<p id="events-requiring-pre-approval-pg" class="small-text">
786 786
 					<?php echo apply_filters(
787 787
 						'AHEE__EES_Espresso_Thank_You__get_ajax_content__not_approved_message',
@@ -792,8 +792,8 @@  discard block
 block discarded – undo
792 792
 					); ?>
793 793
 				</p>
794 794
 				<ul class="events-requiring-pre-approval-ul">
795
-					<?php foreach ( $events as $event ) {
796
-						if ( $event instanceof EE_Event ) {
795
+					<?php foreach ($events as $event) {
796
+						if ($event instanceof EE_Event) {
797 797
 							echo '<li><span class="dashicons dashicons-marker ee-icon-size-16 orange-text"></span>',
798 798
 								$event->name(),
799 799
 								'</li>';
@@ -820,12 +820,12 @@  discard block
 block discarded – undo
820 820
 		$template_args = array();
821 821
 		$template_args['transaction'] = $this->_current_txn;
822 822
 		$template_args['reg_url_link'] = $this->_reg_url_link;
823
-		$template_args['primary_registrant_name'] = $this->_primary_registrant->attendee()->full_name( true );
823
+		$template_args['primary_registrant_name'] = $this->_primary_registrant->attendee()->full_name(true);
824 824
 		// link to SPCO payment_options
825 825
 		$template_args['show_try_pay_again_link'] = $this->_show_try_pay_again_link;
826 826
 		$template_args['SPCO_payment_options_url'] = $this->_SPCO_payment_options_url;
827 827
 		// verify template arguments
828
-		EEH_Template_Validator::verify_instanceof( $template_args['transaction'], '$transaction', 'EE_Transaction' );
828
+		EEH_Template_Validator::verify_instanceof($template_args['transaction'], '$transaction', 'EE_Transaction');
829 829
 		EEH_Template_Validator::verify_isnt_null(
830 830
 			$template_args['show_try_pay_again_link'],
831 831
 			'$show_try_pay_again_link'
@@ -835,7 +835,7 @@  discard block
 block discarded – undo
835 835
 			'$SPCO_payment_options_url'
836 836
 		);
837 837
 		return EEH_Template::locate_template(
838
-			THANK_YOU_TEMPLATES_PATH . 'thank-you-page-transaction-details.template.php',
838
+			THANK_YOU_TEMPLATES_PATH.'thank-you-page-transaction-details.template.php',
839 839
 			$template_args,
840 840
 			true,
841 841
 			true
@@ -852,9 +852,9 @@  discard block
 block discarded – undo
852 852
 	 * @return    string
853 853
 	 * @throws \EE_Error
854 854
 	 */
855
-	public function get_payment_row_html( $payment = null ) {
855
+	public function get_payment_row_html($payment = null) {
856 856
 		$html = '';
857
-		if ( $payment instanceof EE_Payment ) {
857
+		if ($payment instanceof EE_Payment) {
858 858
 			if (
859 859
 				$payment->payment_method() instanceof EE_Payment_Method
860 860
 				&& $payment->status() === EEM_Payment::status_id_failed
@@ -863,31 +863,31 @@  discard block
 block discarded – undo
863 863
 				// considering the registrant has made it to the Thank You page,
864 864
 				// any failed payments may actually be pending and the IPN is just slow
865 865
 				// so let's
866
-				$payment->set_status( EEM_Payment::status_id_pending );
866
+				$payment->set_status(EEM_Payment::status_id_pending);
867 867
 			}
868 868
 			$payment_declined_msg = $payment->STS_ID() === EEM_Payment::status_id_declined
869
-				? '<br /><span class="small-text">' . $payment->gateway_response() . '</span>'
869
+				? '<br /><span class="small-text">'.$payment->gateway_response().'</span>'
870 870
 				: '';
871 871
 			$html .= '
872 872
 				<tr>
873 873
 					<td>
874
-						' . $payment->timestamp() . '
874
+						' . $payment->timestamp().'
875 875
 					</td>
876 876
 					<td>
877 877
 						' . (
878 878
 								$payment->payment_method() instanceof EE_Payment_Method
879 879
 									? $payment->payment_method()->name()
880
-									: __( 'Unknown', 'event_espresso' )
881
-							) . '
880
+									: __('Unknown', 'event_espresso')
881
+							).'
882 882
 					</td>
883 883
 					<td class="jst-rght">
884
-						' . EEH_Template::format_currency( $payment->amount() ) . '
884
+						' . EEH_Template::format_currency($payment->amount()).'
885 885
 					</td>
886 886
 					<td class="jst-rght" style="line-height:1;">
887
-						' . $payment->pretty_status( true ) . $payment_declined_msg . '
887
+						' . $payment->pretty_status(true).$payment_declined_msg.'
888 888
 					</td>
889 889
 				</tr>';
890
-			do_action( 'AHEE__thank_you_page_payment_details_template__after_each_payment', $payment );
890
+			do_action('AHEE__thank_you_page_payment_details_template__after_each_payment', $payment);
891 891
 		}
892 892
 		return $html;
893 893
 	}
@@ -902,14 +902,14 @@  discard block
 block discarded – undo
902 902
 	 * @return    string
903 903
 	 * @throws \EE_Error
904 904
 	 */
905
-	public function get_payment_details( $payments = array() ) {
905
+	public function get_payment_details($payments = array()) {
906 906
 		//prepare variables for displaying
907 907
 		$template_args = array();
908 908
 		$template_args['transaction'] = $this->_current_txn;
909 909
 		$template_args['reg_url_link'] = $this->_reg_url_link;
910 910
 		$template_args['payments'] = array();
911
-		foreach ( $payments as $payment ) {
912
-			$template_args['payments'][] = $this->get_payment_row_html( $payment );
911
+		foreach ($payments as $payment) {
912
+			$template_args['payments'][] = $this->get_payment_row_html($payment);
913 913
 		}
914 914
 		//create a hacky payment object, but dont save it
915 915
 		$payment = EE_Payment::new_instance(
@@ -922,8 +922,8 @@  discard block
 block discarded – undo
922 922
 			)
923 923
 		);
924 924
 		$payment_method = $this->_current_txn->payment_method();
925
-		if ( $payment_method instanceof EE_Payment_Method && $payment_method->type_obj() instanceof EE_PMT_Base ) {
926
-			$template_args['gateway_content'] = $payment_method->type_obj()->payment_overview_content( $payment );
925
+		if ($payment_method instanceof EE_Payment_Method && $payment_method->type_obj() instanceof EE_PMT_Base) {
926
+			$template_args['gateway_content'] = $payment_method->type_obj()->payment_overview_content($payment);
927 927
 		} else {
928 928
 			$template_args['gateway_content'] = '';
929 929
 		}
@@ -931,19 +931,19 @@  discard block
 block discarded – undo
931 931
 		$template_args['show_try_pay_again_link'] = $this->_show_try_pay_again_link;
932 932
 		$template_args['SPCO_payment_options_url'] = $this->_SPCO_payment_options_url;
933 933
 		// verify template arguments
934
-		EEH_Template_Validator::verify_instanceof( $template_args['transaction'], '$transaction', 'EE_Transaction' );
935
-		EEH_Template_Validator::verify_isnt_null( $template_args['payments'], '$payments' );
934
+		EEH_Template_Validator::verify_instanceof($template_args['transaction'], '$transaction', 'EE_Transaction');
935
+		EEH_Template_Validator::verify_isnt_null($template_args['payments'], '$payments');
936 936
 		EEH_Template_Validator::verify_isnt_null(
937 937
 			$template_args['show_try_pay_again_link'],
938 938
 			'$show_try_pay_again_link'
939 939
 		);
940
-		EEH_Template_Validator::verify_isnt_null( $template_args['gateway_content'], '$gateway_content' );
940
+		EEH_Template_Validator::verify_isnt_null($template_args['gateway_content'], '$gateway_content');
941 941
 		EEH_Template_Validator::verify_isnt_null(
942 942
 			$template_args['SPCO_payment_options_url'],
943 943
 			'$SPCO_payment_options_url'
944 944
 		);
945 945
 		return EEH_Template::locate_template(
946
-			THANK_YOU_TEMPLATES_PATH . 'thank-you-page-payment-details.template.php',
946
+			THANK_YOU_TEMPLATES_PATH.'thank-you-page-payment-details.template.php',
947 947
 			$template_args,
948 948
 			true,
949 949
 			true
@@ -960,11 +960,11 @@  discard block
 block discarded – undo
960 960
 	 * @return    string
961 961
 	 * @throws \EE_Error
962 962
 	 */
963
-	public function get_new_payments( $payments = array() ) {
963
+	public function get_new_payments($payments = array()) {
964 964
 		$payments_html = '';
965 965
 		//prepare variables for displaying
966
-		foreach ( $payments as $payment ) {
967
-			$payments_html .= $this->get_payment_row_html( $payment );
966
+		foreach ($payments as $payment) {
967
+			$payments_html .= $this->get_payment_row_html($payment);
968 968
 		}
969 969
 		return $payments_html;
970 970
 	}
Please login to merge, or discard this patch.
admin_pages/general_settings/General_Settings_Admin_Page.core.php 1 patch
Indentation   +1025 added lines, -1025 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@  discard block
 block discarded – undo
2 2
 use EventEspresso\admin_pages\general_settings\AdminOptionsSettings;
3 3
 
4 4
 if ( ! defined('EVENT_ESPRESSO_VERSION')) {
5
-    exit('NO direct script access allowed');
5
+	exit('NO direct script access allowed');
6 6
 }
7 7
 
8 8
 /**
@@ -22,1138 +22,1138 @@  discard block
 block discarded – undo
22 22
 {
23 23
     
24 24
     
25
-    /**
26
-     * _question_group
27
-     * holds the specific question group object for the question group details screen
28
-     * @var object
29
-     */
30
-    protected $_question_group;
25
+	/**
26
+	 * _question_group
27
+	 * holds the specific question group object for the question group details screen
28
+	 * @var object
29
+	 */
30
+	protected $_question_group;
31 31
     
32 32
     
33
-    public function __construct($routing = true)
34
-    {
35
-        parent::__construct($routing);
36
-    }
33
+	public function __construct($routing = true)
34
+	{
35
+		parent::__construct($routing);
36
+	}
37 37
     
38 38
     
39
-    protected function _init_page_props()
40
-    {
41
-        $this->page_slug        = GEN_SET_PG_SLUG;
42
-        $this->page_label       = GEN_SET_LABEL;
43
-        $this->_admin_base_url  = GEN_SET_ADMIN_URL;
44
-        $this->_admin_base_path = GEN_SET_ADMIN;
45
-    }
39
+	protected function _init_page_props()
40
+	{
41
+		$this->page_slug        = GEN_SET_PG_SLUG;
42
+		$this->page_label       = GEN_SET_LABEL;
43
+		$this->_admin_base_url  = GEN_SET_ADMIN_URL;
44
+		$this->_admin_base_path = GEN_SET_ADMIN;
45
+	}
46 46
     
47 47
     
48
-    protected function _ajax_hooks()
49
-    {
50
-        add_action('wp_ajax_espresso_display_country_settings', array($this, 'display_country_settings'));
51
-        add_action('wp_ajax_espresso_display_country_states', array($this, 'display_country_states'));
52
-        add_action('wp_ajax_espresso_delete_state', array($this, 'delete_state'), 10, 3);
53
-        add_action('wp_ajax_espresso_add_new_state', array($this, 'add_new_state'));
54
-    }
48
+	protected function _ajax_hooks()
49
+	{
50
+		add_action('wp_ajax_espresso_display_country_settings', array($this, 'display_country_settings'));
51
+		add_action('wp_ajax_espresso_display_country_states', array($this, 'display_country_states'));
52
+		add_action('wp_ajax_espresso_delete_state', array($this, 'delete_state'), 10, 3);
53
+		add_action('wp_ajax_espresso_add_new_state', array($this, 'add_new_state'));
54
+	}
55 55
     
56 56
     
57
-    protected function _define_page_props()
58
-    {
59
-        $this->_admin_page_title = GEN_SET_LABEL;
60
-        $this->_labels           = array(
61
-            'publishbox' => __('Update Settings', 'event_espresso')
62
-        );
63
-    }
57
+	protected function _define_page_props()
58
+	{
59
+		$this->_admin_page_title = GEN_SET_LABEL;
60
+		$this->_labels           = array(
61
+			'publishbox' => __('Update Settings', 'event_espresso')
62
+		);
63
+	}
64 64
     
65 65
     
66
-    protected function _set_page_routes()
67
-    {
68
-        $this->_page_routes = array(
66
+	protected function _set_page_routes()
67
+	{
68
+		$this->_page_routes = array(
69 69
             
70
-            'critical_pages'                => array(
71
-                'func'       => '_espresso_page_settings',
72
-                'capability' => 'manage_options'
73
-            ),
74
-            'update_espresso_page_settings' => array(
75
-                'func'       => '_update_espresso_page_settings',
76
-                'capability' => 'manage_options',
77
-                'noheader'   => true,
78
-            ),
79
-            'default'                       => array(
80
-                'func'       => '_your_organization_settings',
81
-                'capability' => 'manage_options',
82
-            ),
70
+			'critical_pages'                => array(
71
+				'func'       => '_espresso_page_settings',
72
+				'capability' => 'manage_options'
73
+			),
74
+			'update_espresso_page_settings' => array(
75
+				'func'       => '_update_espresso_page_settings',
76
+				'capability' => 'manage_options',
77
+				'noheader'   => true,
78
+			),
79
+			'default'                       => array(
80
+				'func'       => '_your_organization_settings',
81
+				'capability' => 'manage_options',
82
+			),
83 83
             
84
-            'update_your_organization_settings' => array(
85
-                'func'       => '_update_your_organization_settings',
86
-                'capability' => 'manage_options',
87
-                'noheader'   => true,
88
-            ),
84
+			'update_your_organization_settings' => array(
85
+				'func'       => '_update_your_organization_settings',
86
+				'capability' => 'manage_options',
87
+				'noheader'   => true,
88
+			),
89 89
             
90
-            'admin_option_settings' => array(
91
-                'func'       => '_admin_option_settings',
92
-                'capability' => 'manage_options',
93
-            ),
90
+			'admin_option_settings' => array(
91
+				'func'       => '_admin_option_settings',
92
+				'capability' => 'manage_options',
93
+			),
94 94
             
95
-            'update_admin_option_settings' => array(
96
-                'func'       => '_update_admin_option_settings',
97
-                'capability' => 'manage_options',
98
-                'noheader'   => true,
99
-            ),
95
+			'update_admin_option_settings' => array(
96
+				'func'       => '_update_admin_option_settings',
97
+				'capability' => 'manage_options',
98
+				'noheader'   => true,
99
+			),
100 100
             
101
-            'country_settings' => array(
102
-                'func'       => '_country_settings',
103
-                'capability' => 'manage_options'
104
-            ),
101
+			'country_settings' => array(
102
+				'func'       => '_country_settings',
103
+				'capability' => 'manage_options'
104
+			),
105 105
             
106
-            'update_country_settings' => array(
107
-                'func'       => '_update_country_settings',
108
-                'capability' => 'manage_options',
109
-                'noheader'   => true,
110
-            ),
106
+			'update_country_settings' => array(
107
+				'func'       => '_update_country_settings',
108
+				'capability' => 'manage_options',
109
+				'noheader'   => true,
110
+			),
111 111
             
112
-            'display_country_settings' => array(
113
-                'func'       => 'display_country_settings',
114
-                'capability' => 'manage_options',
115
-                'noheader'   => true,
116
-            ),
112
+			'display_country_settings' => array(
113
+				'func'       => 'display_country_settings',
114
+				'capability' => 'manage_options',
115
+				'noheader'   => true,
116
+			),
117 117
             
118
-            'add_new_state' => array(
119
-                'func'       => 'add_new_state',
120
-                'capability' => 'manage_options',
121
-                'noheader'   => true,
122
-            ),
118
+			'add_new_state' => array(
119
+				'func'       => 'add_new_state',
120
+				'capability' => 'manage_options',
121
+				'noheader'   => true,
122
+			),
123 123
             
124
-            'delete_state' => array(
125
-                'func'       => 'delete_state',
126
-                'capability' => 'manage_options',
127
-                'noheader'   => true,
128
-            )
129
-        );
130
-    }
131
-    
132
-    
133
-    protected function _set_page_config()
134
-    {
135
-        $this->_page_config = array(
136
-            'critical_pages'        => array(
137
-                'nav'           => array(
138
-                    'label' => __('Critical Pages', 'event_espresso'),
139
-                    'order' => 50
140
-                ),
141
-                'metaboxes'     => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')),
142
-                'help_tabs'     => array(
143
-                    'general_settings_critical_pages_help_tab' => array(
144
-                        'title'    => __('Critical Pages', 'event_espresso'),
145
-                        'filename' => 'general_settings_critical_pages'
146
-                    )
147
-                ),
148
-                'help_tour'     => array('Critical_Pages_Help_Tour'),
149
-                'require_nonce' => false
150
-            ),
151
-            'default'               => array(
152
-                'nav'           => array(
153
-                    'label' => __('Your Organization', 'event_espresso'),
154
-                    'order' => 20
155
-                ),
156
-                'help_tabs'     => array(
157
-                    'general_settings_your_organization_help_tab' => array(
158
-                        'title'    => __('Your Organization', 'event_espresso'),
159
-                        'filename' => 'general_settings_your_organization'
160
-                    )
161
-                ),
162
-                'help_tour'     => array('Your_Organization_Help_Tour'),
163
-                'metaboxes'     => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')),
164
-                'require_nonce' => false
165
-            ),
166
-            'admin_option_settings' => array(
167
-                'nav'           => array(
168
-                    'label' => __('Admin Options', 'event_espresso'),
169
-                    'order' => 60
170
-                ),
171
-                'metaboxes'     => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')),
172
-                'help_tabs'     => array(
173
-                    'general_settings_admin_options_help_tab' => array(
174
-                        'title'    => __('Admin Options', 'event_espresso'),
175
-                        'filename' => 'general_settings_admin_options'
176
-                    )
177
-                ),
178
-                'help_tour'     => array('Admin_Options_Help_Tour'),
179
-                'require_nonce' => false
180
-            ),
181
-            'country_settings'      => array(
182
-                'nav'           => array(
183
-                    'label' => __('Countries', 'event_espresso'),
184
-                    'order' => 70
185
-                ),
186
-                'help_tabs'     => array(
187
-                    'general_settings_countries_help_tab' => array(
188
-                        'title'    => __('Countries', 'event_espresso'),
189
-                        'filename' => 'general_settings_countries'
190
-                    )
191
-                ),
192
-                'help_tour'     => array('Countries_Help_Tour'),
193
-                'require_nonce' => false
194
-            )
195
-        );
196
-    }
197
-    
198
-    
199
-    protected function _add_screen_options()
200
-    {
201
-    }
202
-    
203
-    protected function _add_feature_pointers()
204
-    {
205
-    }
206
-    
207
-    public function load_scripts_styles()
208
-    {
209
-        //styles
210
-        wp_enqueue_style('espresso-ui-theme');
211
-        //scripts
212
-        wp_enqueue_script('ee_admin_js');
213
-    }
214
-    
215
-    public function admin_init()
216
-    {
217
-        EE_Registry::$i18n_js_strings['invalid_server_response'] = __('An error occurred! Your request may have been processed, but a valid response from the server was not received. Please refresh the page and try again.',
218
-            'event_espresso');
219
-        EE_Registry::$i18n_js_strings['error_occurred']          = __('An error occurred! Please refresh the page and try again.',
220
-            'event_espresso');
221
-        EE_Registry::$i18n_js_strings['confirm_delete_state']    = __('Are you sure you want to delete this State / Province?',
222
-            'event_espresso');
223
-        $protocol                                                = isset($_SERVER['HTTPS']) ? 'https://' : 'http://';
224
-        EE_Registry::$i18n_js_strings['ajax_url']                = admin_url('admin-ajax.php?page=espresso_general_settings',
225
-            $protocol);
226
-    }
227
-    
228
-    public function admin_notices()
229
-    {
230
-    }
231
-    
232
-    public function admin_footer_scripts()
233
-    {
234
-    }
235
-    
236
-    
237
-    public function load_scripts_styles_default()
238
-    {
239
-        //styles
240
-        wp_enqueue_style('thickbox');
241
-        //scripts
242
-        wp_enqueue_script('media-upload');
243
-        wp_enqueue_script('thickbox');
244
-        wp_register_script('organization_settings', GEN_SET_ASSETS_URL . 'your_organization_settings.js',
245
-            array('jquery', 'media-upload', 'thickbox'), EVENT_ESPRESSO_VERSION, true);
246
-        wp_register_style('organization-css', GEN_SET_ASSETS_URL . 'organization.css', array(), EVENT_ESPRESSO_VERSION);
247
-        wp_enqueue_script('organization_settings');
248
-        wp_enqueue_style('organization-css');
249
-        $confirm_image_delete = array(
250
-            'text' => __('Do you really want to delete this image? Please remember to save your settings to complete the removal.',
251
-                'event_espresso')
252
-        );
253
-        wp_localize_script('organization_settings', 'confirm_image_delete', $confirm_image_delete);
124
+			'delete_state' => array(
125
+				'func'       => 'delete_state',
126
+				'capability' => 'manage_options',
127
+				'noheader'   => true,
128
+			)
129
+		);
130
+	}
131
+    
132
+    
133
+	protected function _set_page_config()
134
+	{
135
+		$this->_page_config = array(
136
+			'critical_pages'        => array(
137
+				'nav'           => array(
138
+					'label' => __('Critical Pages', 'event_espresso'),
139
+					'order' => 50
140
+				),
141
+				'metaboxes'     => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')),
142
+				'help_tabs'     => array(
143
+					'general_settings_critical_pages_help_tab' => array(
144
+						'title'    => __('Critical Pages', 'event_espresso'),
145
+						'filename' => 'general_settings_critical_pages'
146
+					)
147
+				),
148
+				'help_tour'     => array('Critical_Pages_Help_Tour'),
149
+				'require_nonce' => false
150
+			),
151
+			'default'               => array(
152
+				'nav'           => array(
153
+					'label' => __('Your Organization', 'event_espresso'),
154
+					'order' => 20
155
+				),
156
+				'help_tabs'     => array(
157
+					'general_settings_your_organization_help_tab' => array(
158
+						'title'    => __('Your Organization', 'event_espresso'),
159
+						'filename' => 'general_settings_your_organization'
160
+					)
161
+				),
162
+				'help_tour'     => array('Your_Organization_Help_Tour'),
163
+				'metaboxes'     => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')),
164
+				'require_nonce' => false
165
+			),
166
+			'admin_option_settings' => array(
167
+				'nav'           => array(
168
+					'label' => __('Admin Options', 'event_espresso'),
169
+					'order' => 60
170
+				),
171
+				'metaboxes'     => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')),
172
+				'help_tabs'     => array(
173
+					'general_settings_admin_options_help_tab' => array(
174
+						'title'    => __('Admin Options', 'event_espresso'),
175
+						'filename' => 'general_settings_admin_options'
176
+					)
177
+				),
178
+				'help_tour'     => array('Admin_Options_Help_Tour'),
179
+				'require_nonce' => false
180
+			),
181
+			'country_settings'      => array(
182
+				'nav'           => array(
183
+					'label' => __('Countries', 'event_espresso'),
184
+					'order' => 70
185
+				),
186
+				'help_tabs'     => array(
187
+					'general_settings_countries_help_tab' => array(
188
+						'title'    => __('Countries', 'event_espresso'),
189
+						'filename' => 'general_settings_countries'
190
+					)
191
+				),
192
+				'help_tour'     => array('Countries_Help_Tour'),
193
+				'require_nonce' => false
194
+			)
195
+		);
196
+	}
197
+    
198
+    
199
+	protected function _add_screen_options()
200
+	{
201
+	}
202
+    
203
+	protected function _add_feature_pointers()
204
+	{
205
+	}
206
+    
207
+	public function load_scripts_styles()
208
+	{
209
+		//styles
210
+		wp_enqueue_style('espresso-ui-theme');
211
+		//scripts
212
+		wp_enqueue_script('ee_admin_js');
213
+	}
214
+    
215
+	public function admin_init()
216
+	{
217
+		EE_Registry::$i18n_js_strings['invalid_server_response'] = __('An error occurred! Your request may have been processed, but a valid response from the server was not received. Please refresh the page and try again.',
218
+			'event_espresso');
219
+		EE_Registry::$i18n_js_strings['error_occurred']          = __('An error occurred! Please refresh the page and try again.',
220
+			'event_espresso');
221
+		EE_Registry::$i18n_js_strings['confirm_delete_state']    = __('Are you sure you want to delete this State / Province?',
222
+			'event_espresso');
223
+		$protocol                                                = isset($_SERVER['HTTPS']) ? 'https://' : 'http://';
224
+		EE_Registry::$i18n_js_strings['ajax_url']                = admin_url('admin-ajax.php?page=espresso_general_settings',
225
+			$protocol);
226
+	}
227
+    
228
+	public function admin_notices()
229
+	{
230
+	}
231
+    
232
+	public function admin_footer_scripts()
233
+	{
234
+	}
235
+    
236
+    
237
+	public function load_scripts_styles_default()
238
+	{
239
+		//styles
240
+		wp_enqueue_style('thickbox');
241
+		//scripts
242
+		wp_enqueue_script('media-upload');
243
+		wp_enqueue_script('thickbox');
244
+		wp_register_script('organization_settings', GEN_SET_ASSETS_URL . 'your_organization_settings.js',
245
+			array('jquery', 'media-upload', 'thickbox'), EVENT_ESPRESSO_VERSION, true);
246
+		wp_register_style('organization-css', GEN_SET_ASSETS_URL . 'organization.css', array(), EVENT_ESPRESSO_VERSION);
247
+		wp_enqueue_script('organization_settings');
248
+		wp_enqueue_style('organization-css');
249
+		$confirm_image_delete = array(
250
+			'text' => __('Do you really want to delete this image? Please remember to save your settings to complete the removal.',
251
+				'event_espresso')
252
+		);
253
+		wp_localize_script('organization_settings', 'confirm_image_delete', $confirm_image_delete);
254 254
         
255
-    }
256
-    
257
-    public function load_scripts_styles_country_settings()
258
-    {
259
-        //scripts
260
-        wp_register_script('gen_settings_countries', GEN_SET_ASSETS_URL . 'gen_settings_countries.js',
261
-            array('ee_admin_js'), EVENT_ESPRESSO_VERSION, true);
262
-        wp_register_style('organization-css', GEN_SET_ASSETS_URL . 'organization.css', array(), EVENT_ESPRESSO_VERSION);
263
-        wp_enqueue_script('gen_settings_countries');
264
-        wp_enqueue_style('organization-css');
255
+	}
256
+    
257
+	public function load_scripts_styles_country_settings()
258
+	{
259
+		//scripts
260
+		wp_register_script('gen_settings_countries', GEN_SET_ASSETS_URL . 'gen_settings_countries.js',
261
+			array('ee_admin_js'), EVENT_ESPRESSO_VERSION, true);
262
+		wp_register_style('organization-css', GEN_SET_ASSETS_URL . 'organization.css', array(), EVENT_ESPRESSO_VERSION);
263
+		wp_enqueue_script('gen_settings_countries');
264
+		wp_enqueue_style('organization-css');
265 265
         
266
-    }
267
-    
268
-    
269
-    /*************        Espresso Pages        *************/
270
-    /**
271
-     * _espresso_page_settings
272
-     *
273
-     * @throws \EE_Error
274
-     */
275
-    protected function _espresso_page_settings()
276
-    {
277
-        // Check to make sure all of the main pages are setup properly,
278
-        // if not create the default pages and display an admin notice
279
-        EEH_Activation::verify_default_pages_exist();
280
-        $this->_transient_garbage_collection();
281
-        $this->_template_args['values']             = $this->_yes_no_values;
282
-        $this->_template_args['reg_page_id']        = isset(EE_Registry::instance()->CFG->core->reg_page_id)
283
-            ? EE_Registry::instance()->CFG->core->reg_page_id
284
-            : null;
285
-        $this->_template_args['reg_page_obj']       = isset(EE_Registry::instance()->CFG->core->reg_page_id)
286
-            ? get_page(EE_Registry::instance()->CFG->core->reg_page_id)
287
-            : false;
288
-        $this->_template_args['txn_page_id']        = isset(EE_Registry::instance()->CFG->core->txn_page_id)
289
-            ? EE_Registry::instance()->CFG->core->txn_page_id
290
-            : null;
291
-        $this->_template_args['txn_page_obj']       = isset(EE_Registry::instance()->CFG->core->txn_page_id)
292
-            ? get_page(EE_Registry::instance()->CFG->core->txn_page_id)
293
-            : false;
294
-        $this->_template_args['thank_you_page_id']  = isset(EE_Registry::instance()->CFG->core->thank_you_page_id)
295
-            ? EE_Registry::instance()->CFG->core->thank_you_page_id
296
-            : null;
297
-        $this->_template_args['thank_you_page_obj'] = isset(EE_Registry::instance()->CFG->core->thank_you_page_id)
298
-            ? get_page(EE_Registry::instance()->CFG->core->thank_you_page_id)
299
-            : false;
300
-        $this->_template_args['cancel_page_id']     = isset(EE_Registry::instance()->CFG->core->cancel_page_id)
301
-            ? EE_Registry::instance()->CFG->core->cancel_page_id
302
-            : null;
303
-        $this->_template_args['cancel_page_obj']    = isset(EE_Registry::instance()->CFG->core->cancel_page_id)
304
-            ? get_page(EE_Registry::instance()->CFG->core->cancel_page_id)
305
-            : false;
306
-        $this->_set_add_edit_form_tags('update_espresso_page_settings');
307
-        $this->_set_publish_post_box_vars(null, false, false, null, false);
308
-        $this->_template_args['admin_page_content'] = EEH_Template::display_template(
309
-            GEN_SET_TEMPLATE_PATH . 'espresso_page_settings.template.php',
310
-            $this->_template_args,
311
-            true
312
-        );
313
-        $this->display_admin_page_with_sidebar();
266
+	}
267
+    
268
+    
269
+	/*************        Espresso Pages        *************/
270
+	/**
271
+	 * _espresso_page_settings
272
+	 *
273
+	 * @throws \EE_Error
274
+	 */
275
+	protected function _espresso_page_settings()
276
+	{
277
+		// Check to make sure all of the main pages are setup properly,
278
+		// if not create the default pages and display an admin notice
279
+		EEH_Activation::verify_default_pages_exist();
280
+		$this->_transient_garbage_collection();
281
+		$this->_template_args['values']             = $this->_yes_no_values;
282
+		$this->_template_args['reg_page_id']        = isset(EE_Registry::instance()->CFG->core->reg_page_id)
283
+			? EE_Registry::instance()->CFG->core->reg_page_id
284
+			: null;
285
+		$this->_template_args['reg_page_obj']       = isset(EE_Registry::instance()->CFG->core->reg_page_id)
286
+			? get_page(EE_Registry::instance()->CFG->core->reg_page_id)
287
+			: false;
288
+		$this->_template_args['txn_page_id']        = isset(EE_Registry::instance()->CFG->core->txn_page_id)
289
+			? EE_Registry::instance()->CFG->core->txn_page_id
290
+			: null;
291
+		$this->_template_args['txn_page_obj']       = isset(EE_Registry::instance()->CFG->core->txn_page_id)
292
+			? get_page(EE_Registry::instance()->CFG->core->txn_page_id)
293
+			: false;
294
+		$this->_template_args['thank_you_page_id']  = isset(EE_Registry::instance()->CFG->core->thank_you_page_id)
295
+			? EE_Registry::instance()->CFG->core->thank_you_page_id
296
+			: null;
297
+		$this->_template_args['thank_you_page_obj'] = isset(EE_Registry::instance()->CFG->core->thank_you_page_id)
298
+			? get_page(EE_Registry::instance()->CFG->core->thank_you_page_id)
299
+			: false;
300
+		$this->_template_args['cancel_page_id']     = isset(EE_Registry::instance()->CFG->core->cancel_page_id)
301
+			? EE_Registry::instance()->CFG->core->cancel_page_id
302
+			: null;
303
+		$this->_template_args['cancel_page_obj']    = isset(EE_Registry::instance()->CFG->core->cancel_page_id)
304
+			? get_page(EE_Registry::instance()->CFG->core->cancel_page_id)
305
+			: false;
306
+		$this->_set_add_edit_form_tags('update_espresso_page_settings');
307
+		$this->_set_publish_post_box_vars(null, false, false, null, false);
308
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template(
309
+			GEN_SET_TEMPLATE_PATH . 'espresso_page_settings.template.php',
310
+			$this->_template_args,
311
+			true
312
+		);
313
+		$this->display_admin_page_with_sidebar();
314 314
         
315
-    }
316
-    
317
-    protected function _update_espresso_page_settings()
318
-    {
319
-        // capture incoming request data
320
-        $reg_page_id       = isset($this->_req_data['reg_page_id']) ? absint($this->_req_data['reg_page_id']) : EE_Registry::instance()->CFG->core->reg_page_id;
321
-        $txn_page_id       = isset($this->_req_data['txn_page_id']) ? absint($this->_req_data['txn_page_id']) : EE_Registry::instance()->CFG->core->txn_page_id;
322
-        $thank_you_page_id = isset($this->_req_data['thank_you_page_id']) ? absint($this->_req_data['thank_you_page_id']) : EE_Registry::instance()->CFG->core->thank_you_page_id;
323
-        $cancel_page_id    = isset($this->_req_data['cancel_page_id']) ? absint($this->_req_data['cancel_page_id']) : EE_Registry::instance()->CFG->core->cancel_page_id;
324
-        // pack critical_pages into an array
325
-        $critical_pages = array(
326
-            'reg_page_id'       => $reg_page_id,
327
-            'txn_page_id'       => $txn_page_id,
328
-            'thank_you_page_id' => $thank_you_page_id,
329
-            'cancel_page_id'    => $cancel_page_id
330
-        );
331
-        foreach ($critical_pages as $critical_page_name => $critical_page_id) {
332
-            // has the page changed ?
333
-            if (EE_Registry::instance()->CFG->core->{$critical_page_name} !== $critical_page_id) {
334
-                // grab post object for old page
335
-                $post = get_post(EE_Registry::instance()->CFG->core->{$critical_page_name});
336
-                // update post shortcodes for old page
337
-                EventEspresso\core\admin\PostShortcodeTracking::parse_post_content_on_save($critical_page_id, $post);
338
-                // grab post object for new page
339
-                $post = get_post($critical_page_id);
340
-                // update post shortcodes for new page
341
-                EventEspresso\core\admin\PostShortcodeTracking::parse_post_content_on_save($critical_page_id, $post);
342
-            }
343
-        }
344
-        // set page IDs
345
-        EE_Registry::instance()->CFG->core->reg_page_id       = $reg_page_id;
346
-        EE_Registry::instance()->CFG->core->txn_page_id       = $txn_page_id;
347
-        EE_Registry::instance()->CFG->core->thank_you_page_id = $thank_you_page_id;
348
-        EE_Registry::instance()->CFG->core->cancel_page_id    = $cancel_page_id;
315
+	}
316
+    
317
+	protected function _update_espresso_page_settings()
318
+	{
319
+		// capture incoming request data
320
+		$reg_page_id       = isset($this->_req_data['reg_page_id']) ? absint($this->_req_data['reg_page_id']) : EE_Registry::instance()->CFG->core->reg_page_id;
321
+		$txn_page_id       = isset($this->_req_data['txn_page_id']) ? absint($this->_req_data['txn_page_id']) : EE_Registry::instance()->CFG->core->txn_page_id;
322
+		$thank_you_page_id = isset($this->_req_data['thank_you_page_id']) ? absint($this->_req_data['thank_you_page_id']) : EE_Registry::instance()->CFG->core->thank_you_page_id;
323
+		$cancel_page_id    = isset($this->_req_data['cancel_page_id']) ? absint($this->_req_data['cancel_page_id']) : EE_Registry::instance()->CFG->core->cancel_page_id;
324
+		// pack critical_pages into an array
325
+		$critical_pages = array(
326
+			'reg_page_id'       => $reg_page_id,
327
+			'txn_page_id'       => $txn_page_id,
328
+			'thank_you_page_id' => $thank_you_page_id,
329
+			'cancel_page_id'    => $cancel_page_id
330
+		);
331
+		foreach ($critical_pages as $critical_page_name => $critical_page_id) {
332
+			// has the page changed ?
333
+			if (EE_Registry::instance()->CFG->core->{$critical_page_name} !== $critical_page_id) {
334
+				// grab post object for old page
335
+				$post = get_post(EE_Registry::instance()->CFG->core->{$critical_page_name});
336
+				// update post shortcodes for old page
337
+				EventEspresso\core\admin\PostShortcodeTracking::parse_post_content_on_save($critical_page_id, $post);
338
+				// grab post object for new page
339
+				$post = get_post($critical_page_id);
340
+				// update post shortcodes for new page
341
+				EventEspresso\core\admin\PostShortcodeTracking::parse_post_content_on_save($critical_page_id, $post);
342
+			}
343
+		}
344
+		// set page IDs
345
+		EE_Registry::instance()->CFG->core->reg_page_id       = $reg_page_id;
346
+		EE_Registry::instance()->CFG->core->txn_page_id       = $txn_page_id;
347
+		EE_Registry::instance()->CFG->core->thank_you_page_id = $thank_you_page_id;
348
+		EE_Registry::instance()->CFG->core->cancel_page_id    = $cancel_page_id;
349 349
         
350
-        EE_Registry::instance()->CFG->core = apply_filters('FHEE__General_Settings_Admin_Page___update_espresso_page_settings__CFG_core',
351
-            EE_Registry::instance()->CFG->core, $this->_req_data);
350
+		EE_Registry::instance()->CFG->core = apply_filters('FHEE__General_Settings_Admin_Page___update_espresso_page_settings__CFG_core',
351
+			EE_Registry::instance()->CFG->core, $this->_req_data);
352 352
         
353
-        $what       = __('Critical Pages & Shortcodes', 'event_espresso');
354
-        $success    = $this->_update_espresso_configuration($what, EE_Registry::instance()->CFG->core, __FILE__,
355
-            __FUNCTION__, __LINE__);
356
-        $query_args = array(
357
-            'action' => 'critical_pages'
358
-        );
359
-        $this->_redirect_after_action(false, '', '', $query_args, true);
353
+		$what       = __('Critical Pages & Shortcodes', 'event_espresso');
354
+		$success    = $this->_update_espresso_configuration($what, EE_Registry::instance()->CFG->core, __FILE__,
355
+			__FUNCTION__, __LINE__);
356
+		$query_args = array(
357
+			'action' => 'critical_pages'
358
+		);
359
+		$this->_redirect_after_action(false, '', '', $query_args, true);
360 360
         
361
-    }
361
+	}
362 362
     
363 363
     
364
-    /*************        Your Organization        *************/
364
+	/*************        Your Organization        *************/
365 365
     
366 366
     
367
-    protected function _your_organization_settings()
368
-    {
367
+	protected function _your_organization_settings()
368
+	{
369 369
         
370
-        $this->_template_args['site_license_key']       = isset(EE_Registry::instance()->NET_CFG->core->site_license_key) ? EE_Registry::instance()->NET_CFG->core->get_pretty('site_license_key') : '';
371
-        $this->_template_args['organization_name']      = isset(EE_Registry::instance()->CFG->organization->name) ? EE_Registry::instance()->CFG->organization->get_pretty('name') : '';
372
-        $this->_template_args['organization_address_1'] = isset(EE_Registry::instance()->CFG->organization->address_1) ? EE_Registry::instance()->CFG->organization->get_pretty('address_1') : '';
373
-        $this->_template_args['organization_address_2'] = isset(EE_Registry::instance()->CFG->organization->address_2) ? EE_Registry::instance()->CFG->organization->get_pretty('address_2') : '';
374
-        $this->_template_args['organization_city']      = isset(EE_Registry::instance()->CFG->organization->city) ? EE_Registry::instance()->CFG->organization->get_pretty('city') : '';
375
-        $this->_template_args['organization_zip']       = isset(EE_Registry::instance()->CFG->organization->zip) ? EE_Registry::instance()->CFG->organization->get_pretty('zip') : '';
376
-        $this->_template_args['organization_email']     = isset(EE_Registry::instance()->CFG->organization->email) ? EE_Registry::instance()->CFG->organization->get_pretty('email') : '';
377
-        $this->_template_args['organization_phone']     = isset(EE_Registry::instance()->CFG->organization->phone) ? EE_Registry::instance()->CFG->organization->get_pretty('phone') : '';
378
-        $this->_template_args['organization_vat']       = isset(EE_Registry::instance()->CFG->organization->vat) ? EE_Registry::instance()->CFG->organization->get_pretty('vat') : '';
379
-        $this->_template_args['currency_sign']          = isset(EE_Registry::instance()->CFG->currency->sign) ? EE_Registry::instance()->CFG->currency->get_pretty('sign') : '$';
380
-        $this->_template_args['organization_logo_url']  = isset(EE_Registry::instance()->CFG->organization->logo_url) ? EE_Registry::instance()->CFG->organization->get_pretty('logo_url') : false;
381
-        $this->_template_args['organization_facebook']  = isset(EE_Registry::instance()->CFG->organization->facebook) ? EE_Registry::instance()->CFG->organization->get_pretty('facebook') : '';
382
-        $this->_template_args['organization_twitter']   = isset(EE_Registry::instance()->CFG->organization->twitter) ? EE_Registry::instance()->CFG->organization->get_pretty('twitter') : '';
383
-        $this->_template_args['organization_linkedin']  = isset(EE_Registry::instance()->CFG->organization->linkedin) ? EE_Registry::instance()->CFG->organization->get_pretty('linkedin') : '';
384
-        $this->_template_args['organization_pinterest'] = isset(EE_Registry::instance()->CFG->organization->pinterest) ? EE_Registry::instance()->CFG->organization->get_pretty('pinterest') : '';
385
-        $this->_template_args['organization_google']    = isset(EE_Registry::instance()->CFG->organization->google) ? EE_Registry::instance()->CFG->organization->get_pretty('google') : '';
386
-        $this->_template_args['organization_instagram'] = isset(EE_Registry::instance()->CFG->organization->instagram) ? EE_Registry::instance()->CFG->organization->get_pretty('instagram') : '';
387
-        //UXIP settings
388
-        $this->_template_args['ee_ueip_optin'] = isset(EE_Registry::instance()->CFG->core->ee_ueip_optin) ? EE_Registry::instance()->CFG->core->get_pretty('ee_ueip_optin') : true;
370
+		$this->_template_args['site_license_key']       = isset(EE_Registry::instance()->NET_CFG->core->site_license_key) ? EE_Registry::instance()->NET_CFG->core->get_pretty('site_license_key') : '';
371
+		$this->_template_args['organization_name']      = isset(EE_Registry::instance()->CFG->organization->name) ? EE_Registry::instance()->CFG->organization->get_pretty('name') : '';
372
+		$this->_template_args['organization_address_1'] = isset(EE_Registry::instance()->CFG->organization->address_1) ? EE_Registry::instance()->CFG->organization->get_pretty('address_1') : '';
373
+		$this->_template_args['organization_address_2'] = isset(EE_Registry::instance()->CFG->organization->address_2) ? EE_Registry::instance()->CFG->organization->get_pretty('address_2') : '';
374
+		$this->_template_args['organization_city']      = isset(EE_Registry::instance()->CFG->organization->city) ? EE_Registry::instance()->CFG->organization->get_pretty('city') : '';
375
+		$this->_template_args['organization_zip']       = isset(EE_Registry::instance()->CFG->organization->zip) ? EE_Registry::instance()->CFG->organization->get_pretty('zip') : '';
376
+		$this->_template_args['organization_email']     = isset(EE_Registry::instance()->CFG->organization->email) ? EE_Registry::instance()->CFG->organization->get_pretty('email') : '';
377
+		$this->_template_args['organization_phone']     = isset(EE_Registry::instance()->CFG->organization->phone) ? EE_Registry::instance()->CFG->organization->get_pretty('phone') : '';
378
+		$this->_template_args['organization_vat']       = isset(EE_Registry::instance()->CFG->organization->vat) ? EE_Registry::instance()->CFG->organization->get_pretty('vat') : '';
379
+		$this->_template_args['currency_sign']          = isset(EE_Registry::instance()->CFG->currency->sign) ? EE_Registry::instance()->CFG->currency->get_pretty('sign') : '$';
380
+		$this->_template_args['organization_logo_url']  = isset(EE_Registry::instance()->CFG->organization->logo_url) ? EE_Registry::instance()->CFG->organization->get_pretty('logo_url') : false;
381
+		$this->_template_args['organization_facebook']  = isset(EE_Registry::instance()->CFG->organization->facebook) ? EE_Registry::instance()->CFG->organization->get_pretty('facebook') : '';
382
+		$this->_template_args['organization_twitter']   = isset(EE_Registry::instance()->CFG->organization->twitter) ? EE_Registry::instance()->CFG->organization->get_pretty('twitter') : '';
383
+		$this->_template_args['organization_linkedin']  = isset(EE_Registry::instance()->CFG->organization->linkedin) ? EE_Registry::instance()->CFG->organization->get_pretty('linkedin') : '';
384
+		$this->_template_args['organization_pinterest'] = isset(EE_Registry::instance()->CFG->organization->pinterest) ? EE_Registry::instance()->CFG->organization->get_pretty('pinterest') : '';
385
+		$this->_template_args['organization_google']    = isset(EE_Registry::instance()->CFG->organization->google) ? EE_Registry::instance()->CFG->organization->get_pretty('google') : '';
386
+		$this->_template_args['organization_instagram'] = isset(EE_Registry::instance()->CFG->organization->instagram) ? EE_Registry::instance()->CFG->organization->get_pretty('instagram') : '';
387
+		//UXIP settings
388
+		$this->_template_args['ee_ueip_optin'] = isset(EE_Registry::instance()->CFG->core->ee_ueip_optin) ? EE_Registry::instance()->CFG->core->get_pretty('ee_ueip_optin') : true;
389 389
         
390
-        $STA_ID                         = isset(EE_Registry::instance()->CFG->organization->STA_ID) ? EE_Registry::instance()->CFG->organization->STA_ID : 4;
391
-        $this->_template_args['states'] = new EE_Question_Form_Input(
392
-            EE_Question::new_instance(array(
393
-                'QST_ID'           => 0,
394
-                'QST_display_text' => __('State/Province', 'event_espresso'),
395
-                'QST_system'       => 'admin-state'
396
-            )),
397
-            EE_Answer::new_instance(array(
398
-                'ANS_ID'    => 0,
399
-                'ANS_value' => $STA_ID
400
-            )),
401
-            array(
402
-                'input_id'       => 'organization_state',
403
-                'input_name'     => 'organization_state',
404
-                'input_prefix'   => '',
405
-                'append_qstn_id' => false
406
-            )
407
-        );
390
+		$STA_ID                         = isset(EE_Registry::instance()->CFG->organization->STA_ID) ? EE_Registry::instance()->CFG->organization->STA_ID : 4;
391
+		$this->_template_args['states'] = new EE_Question_Form_Input(
392
+			EE_Question::new_instance(array(
393
+				'QST_ID'           => 0,
394
+				'QST_display_text' => __('State/Province', 'event_espresso'),
395
+				'QST_system'       => 'admin-state'
396
+			)),
397
+			EE_Answer::new_instance(array(
398
+				'ANS_ID'    => 0,
399
+				'ANS_value' => $STA_ID
400
+			)),
401
+			array(
402
+				'input_id'       => 'organization_state',
403
+				'input_name'     => 'organization_state',
404
+				'input_prefix'   => '',
405
+				'append_qstn_id' => false
406
+			)
407
+		);
408 408
         
409
-        $CNT_ISO                           = isset(EE_Registry::instance()->CFG->organization->CNT_ISO) ? EE_Registry::instance()->CFG->organization->CNT_ISO : 'US';
410
-        $this->_template_args['countries'] = new EE_Question_Form_Input(
411
-            EE_Question::new_instance(array(
412
-                'QST_ID'           => 0,
413
-                'QST_display_text' => __('Country', 'event_espresso'),
414
-                'QST_system'       => 'admin-country'
415
-            )),
416
-            EE_Answer::new_instance(array(
417
-                'ANS_ID'    => 0,
418
-                'ANS_value' => $CNT_ISO
419
-            )),
420
-            array(
421
-                'input_id'       => 'organization_country',
422
-                'input_name'     => 'organization_country',
423
-                'input_prefix'   => '',
424
-                'append_qstn_id' => false
425
-            )
426
-        );
409
+		$CNT_ISO                           = isset(EE_Registry::instance()->CFG->organization->CNT_ISO) ? EE_Registry::instance()->CFG->organization->CNT_ISO : 'US';
410
+		$this->_template_args['countries'] = new EE_Question_Form_Input(
411
+			EE_Question::new_instance(array(
412
+				'QST_ID'           => 0,
413
+				'QST_display_text' => __('Country', 'event_espresso'),
414
+				'QST_system'       => 'admin-country'
415
+			)),
416
+			EE_Answer::new_instance(array(
417
+				'ANS_ID'    => 0,
418
+				'ANS_value' => $CNT_ISO
419
+			)),
420
+			array(
421
+				'input_id'       => 'organization_country',
422
+				'input_name'     => 'organization_country',
423
+				'input_prefix'   => '',
424
+				'append_qstn_id' => false
425
+			)
426
+		);
427 427
         
428
-        add_filter('FHEE__EEH_Form_Fields__label_html', array($this, 'country_form_field_label_wrap'), 10, 2);
429
-        add_filter('FHEE__EEH_Form_Fields__input_html', array($this, 'country_form_field_input__wrap'), 10, 2);
428
+		add_filter('FHEE__EEH_Form_Fields__label_html', array($this, 'country_form_field_label_wrap'), 10, 2);
429
+		add_filter('FHEE__EEH_Form_Fields__input_html', array($this, 'country_form_field_input__wrap'), 10, 2);
430 430
         
431
-        //PUE verification stuff
432
-        $ver_option_key                                    = 'puvererr_' . basename(EE_PLUGIN_BASENAME);
433
-        $verify_fail                                       = get_option($ver_option_key);
434
-        $this->_template_args['site_license_key_verified'] = $verify_fail || ! empty($verify_fail) || (empty($this->_template_args['site_license_key']) && empty($verify_fail)) ? '<span class="dashicons dashicons-admin-network ee-icon-color-ee-red ee-icon-size-20"></span>' : '<span class="dashicons dashicons-admin-network ee-icon-color-ee-green ee-icon-size-20"></span>';
431
+		//PUE verification stuff
432
+		$ver_option_key                                    = 'puvererr_' . basename(EE_PLUGIN_BASENAME);
433
+		$verify_fail                                       = get_option($ver_option_key);
434
+		$this->_template_args['site_license_key_verified'] = $verify_fail || ! empty($verify_fail) || (empty($this->_template_args['site_license_key']) && empty($verify_fail)) ? '<span class="dashicons dashicons-admin-network ee-icon-color-ee-red ee-icon-size-20"></span>' : '<span class="dashicons dashicons-admin-network ee-icon-color-ee-green ee-icon-size-20"></span>';
435 435
         
436
-        $this->_set_add_edit_form_tags('update_your_organization_settings');
437
-        $this->_set_publish_post_box_vars(null, false, false, null, false);
438
-        $this->_template_args['admin_page_content'] = EEH_Template::display_template(GEN_SET_TEMPLATE_PATH . 'your_organization_settings.template.php',
439
-            $this->_template_args, true);
436
+		$this->_set_add_edit_form_tags('update_your_organization_settings');
437
+		$this->_set_publish_post_box_vars(null, false, false, null, false);
438
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template(GEN_SET_TEMPLATE_PATH . 'your_organization_settings.template.php',
439
+			$this->_template_args, true);
440 440
         
441
-        $this->display_admin_page_with_sidebar();
442
-    }
443
-    
444
-    protected function _update_your_organization_settings()
445
-    {
446
-        if (is_main_site()) {
447
-            EE_Registry::instance()->NET_CFG->core->site_license_key = isset($this->_req_data['site_license_key']) ? sanitize_text_field($this->_req_data['site_license_key']) : EE_Registry::instance()->NET_CFG->core->site_license_key;
448
-        }
449
-        EE_Registry::instance()->CFG->organization->name      = isset($this->_req_data['organization_name']) ? sanitize_text_field($this->_req_data['organization_name']) : EE_Registry::instance()->CFG->organization->name;
450
-        EE_Registry::instance()->CFG->organization->address_1 = isset($this->_req_data['organization_address_1']) ? sanitize_text_field($this->_req_data['organization_address_1']) : EE_Registry::instance()->CFG->organization->address_1;
451
-        EE_Registry::instance()->CFG->organization->address_2 = isset($this->_req_data['organization_address_2']) ? sanitize_text_field($this->_req_data['organization_address_2']) : EE_Registry::instance()->CFG->organization->address_2;
452
-        EE_Registry::instance()->CFG->organization->city      = isset($this->_req_data['organization_city']) ? sanitize_text_field($this->_req_data['organization_city']) : EE_Registry::instance()->CFG->organization->city;
453
-        EE_Registry::instance()->CFG->organization->STA_ID    = isset($this->_req_data['organization_state']) ? absint($this->_req_data['organization_state']) : EE_Registry::instance()->CFG->organization->STA_ID;
454
-        EE_Registry::instance()->CFG->organization->CNT_ISO   = isset($this->_req_data['organization_country']) ? sanitize_text_field($this->_req_data['organization_country']) : EE_Registry::instance()->CFG->organization->CNT_ISO;
455
-        EE_Registry::instance()->CFG->organization->zip       = isset($this->_req_data['organization_zip']) ? sanitize_text_field($this->_req_data['organization_zip']) : EE_Registry::instance()->CFG->organization->zip;
456
-        EE_Registry::instance()->CFG->organization->email     = isset($this->_req_data['organization_email']) ? sanitize_email($this->_req_data['organization_email']) : EE_Registry::instance()->CFG->organization->email;
457
-        EE_Registry::instance()->CFG->organization->vat       = isset($this->_req_data['organization_vat']) ? sanitize_text_field($this->_req_data['organization_vat']) : EE_Registry::instance()->CFG->organization->vat;
458
-        EE_Registry::instance()->CFG->organization->phone     = isset($this->_req_data['organization_phone']) ? sanitize_text_field($this->_req_data['organization_phone']) : EE_Registry::instance()->CFG->organization->phone;
459
-        EE_Registry::instance()->CFG->organization->logo_url  = isset($this->_req_data['organization_logo_url']) ? esc_url_raw($this->_req_data['organization_logo_url']) : EE_Registry::instance()->CFG->organization->logo_url;
460
-        EE_Registry::instance()->CFG->organization->facebook  = isset($this->_req_data['organization_facebook']) ? esc_url_raw($this->_req_data['organization_facebook']) : EE_Registry::instance()->CFG->organization->facebook;
461
-        EE_Registry::instance()->CFG->organization->twitter   = isset($this->_req_data['organization_twitter']) ? esc_url_raw($this->_req_data['organization_twitter']) : EE_Registry::instance()->CFG->organization->twitter;
462
-        EE_Registry::instance()->CFG->organization->linkedin  = isset($this->_req_data['organization_linkedin']) ? esc_url_raw($this->_req_data['organization_linkedin']) : EE_Registry::instance()->CFG->organization->linkedin;
463
-        EE_Registry::instance()->CFG->organization->pinterest = isset($this->_req_data['organization_pinterest']) ? esc_url_raw($this->_req_data['organization_pinterest']) : EE_Registry::instance()->CFG->organization->pinterest;
464
-        EE_Registry::instance()->CFG->organization->google    = isset($this->_req_data['organization_google']) ? esc_url_raw($this->_req_data['organization_google']) : EE_Registry::instance()->CFG->organization->google;
465
-        EE_Registry::instance()->CFG->organization->instagram = isset($this->_req_data['organization_instagram']) ? esc_url_raw($this->_req_data['organization_instagram']) : EE_Registry::instance()->CFG->organization->instagram;
466
-        EE_Registry::instance()->CFG->core->ee_ueip_optin     = isset($this->_req_data['ueip_optin']) && ! empty($this->_req_data['ueip_optin']) ? $this->_req_data['ueip_optin'] : EE_Registry::instance()->CFG->core->ee_ueip_optin;
441
+		$this->display_admin_page_with_sidebar();
442
+	}
443
+    
444
+	protected function _update_your_organization_settings()
445
+	{
446
+		if (is_main_site()) {
447
+			EE_Registry::instance()->NET_CFG->core->site_license_key = isset($this->_req_data['site_license_key']) ? sanitize_text_field($this->_req_data['site_license_key']) : EE_Registry::instance()->NET_CFG->core->site_license_key;
448
+		}
449
+		EE_Registry::instance()->CFG->organization->name      = isset($this->_req_data['organization_name']) ? sanitize_text_field($this->_req_data['organization_name']) : EE_Registry::instance()->CFG->organization->name;
450
+		EE_Registry::instance()->CFG->organization->address_1 = isset($this->_req_data['organization_address_1']) ? sanitize_text_field($this->_req_data['organization_address_1']) : EE_Registry::instance()->CFG->organization->address_1;
451
+		EE_Registry::instance()->CFG->organization->address_2 = isset($this->_req_data['organization_address_2']) ? sanitize_text_field($this->_req_data['organization_address_2']) : EE_Registry::instance()->CFG->organization->address_2;
452
+		EE_Registry::instance()->CFG->organization->city      = isset($this->_req_data['organization_city']) ? sanitize_text_field($this->_req_data['organization_city']) : EE_Registry::instance()->CFG->organization->city;
453
+		EE_Registry::instance()->CFG->organization->STA_ID    = isset($this->_req_data['organization_state']) ? absint($this->_req_data['organization_state']) : EE_Registry::instance()->CFG->organization->STA_ID;
454
+		EE_Registry::instance()->CFG->organization->CNT_ISO   = isset($this->_req_data['organization_country']) ? sanitize_text_field($this->_req_data['organization_country']) : EE_Registry::instance()->CFG->organization->CNT_ISO;
455
+		EE_Registry::instance()->CFG->organization->zip       = isset($this->_req_data['organization_zip']) ? sanitize_text_field($this->_req_data['organization_zip']) : EE_Registry::instance()->CFG->organization->zip;
456
+		EE_Registry::instance()->CFG->organization->email     = isset($this->_req_data['organization_email']) ? sanitize_email($this->_req_data['organization_email']) : EE_Registry::instance()->CFG->organization->email;
457
+		EE_Registry::instance()->CFG->organization->vat       = isset($this->_req_data['organization_vat']) ? sanitize_text_field($this->_req_data['organization_vat']) : EE_Registry::instance()->CFG->organization->vat;
458
+		EE_Registry::instance()->CFG->organization->phone     = isset($this->_req_data['organization_phone']) ? sanitize_text_field($this->_req_data['organization_phone']) : EE_Registry::instance()->CFG->organization->phone;
459
+		EE_Registry::instance()->CFG->organization->logo_url  = isset($this->_req_data['organization_logo_url']) ? esc_url_raw($this->_req_data['organization_logo_url']) : EE_Registry::instance()->CFG->organization->logo_url;
460
+		EE_Registry::instance()->CFG->organization->facebook  = isset($this->_req_data['organization_facebook']) ? esc_url_raw($this->_req_data['organization_facebook']) : EE_Registry::instance()->CFG->organization->facebook;
461
+		EE_Registry::instance()->CFG->organization->twitter   = isset($this->_req_data['organization_twitter']) ? esc_url_raw($this->_req_data['organization_twitter']) : EE_Registry::instance()->CFG->organization->twitter;
462
+		EE_Registry::instance()->CFG->organization->linkedin  = isset($this->_req_data['organization_linkedin']) ? esc_url_raw($this->_req_data['organization_linkedin']) : EE_Registry::instance()->CFG->organization->linkedin;
463
+		EE_Registry::instance()->CFG->organization->pinterest = isset($this->_req_data['organization_pinterest']) ? esc_url_raw($this->_req_data['organization_pinterest']) : EE_Registry::instance()->CFG->organization->pinterest;
464
+		EE_Registry::instance()->CFG->organization->google    = isset($this->_req_data['organization_google']) ? esc_url_raw($this->_req_data['organization_google']) : EE_Registry::instance()->CFG->organization->google;
465
+		EE_Registry::instance()->CFG->organization->instagram = isset($this->_req_data['organization_instagram']) ? esc_url_raw($this->_req_data['organization_instagram']) : EE_Registry::instance()->CFG->organization->instagram;
466
+		EE_Registry::instance()->CFG->core->ee_ueip_optin     = isset($this->_req_data['ueip_optin']) && ! empty($this->_req_data['ueip_optin']) ? $this->_req_data['ueip_optin'] : EE_Registry::instance()->CFG->core->ee_ueip_optin;
467 467
         
468
-        EE_Registry::instance()->CFG->currency = new EE_Currency_Config(EE_Registry::instance()->CFG->organization->CNT_ISO);
468
+		EE_Registry::instance()->CFG->currency = new EE_Currency_Config(EE_Registry::instance()->CFG->organization->CNT_ISO);
469 469
         
470
-        EE_Registry::instance()->CFG = apply_filters('FHEE__General_Settings_Admin_Page___update_your_organization_settings__CFG',
471
-            EE_Registry::instance()->CFG);
470
+		EE_Registry::instance()->CFG = apply_filters('FHEE__General_Settings_Admin_Page___update_your_organization_settings__CFG',
471
+			EE_Registry::instance()->CFG);
472 472
         
473
-        $what    = 'Your Organization Settings';
474
-        $success = $this->_update_espresso_configuration($what, EE_Registry::instance()->CFG, __FILE__, __FUNCTION__,
475
-            __LINE__);
473
+		$what    = 'Your Organization Settings';
474
+		$success = $this->_update_espresso_configuration($what, EE_Registry::instance()->CFG, __FILE__, __FUNCTION__,
475
+			__LINE__);
476 476
         
477
-        $this->_redirect_after_action($success, $what, 'updated', array('action' => 'default'));
477
+		$this->_redirect_after_action($success, $what, 'updated', array('action' => 'default'));
478 478
         
479
-    }
480
-    
481
-    
482
-    
483
-    /*************        Admin Options        *************/
484
-    
485
-    
486
-    /**
487
-     * _admin_option_settings
488
-     *
489
-     * @throws \EE_Error
490
-     * @throws \LogicException
491
-     */
492
-    protected function _admin_option_settings()
493
-    {
494
-        $this->_template_args['admin_page_content'] = '';
495
-        try {
496
-            $admin_options_settings_form = new AdminOptionsSettings(EE_Registry::instance());
497
-            // still need this for the old school form in Extend_General_Settings_Admin_Page
498
-            $this->_template_args['values'] = $this->_yes_no_values;
499
-            // also need to account for the do_action that was in the old template
500
-            $admin_options_settings_form->setTemplateArgs($this->_template_args);
501
-            $this->_template_args['admin_page_content'] = $admin_options_settings_form->display();
502
-        } catch (Exception $e) {
503
-            EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__);
504
-        }
505
-        $this->_set_add_edit_form_tags('update_admin_option_settings');
506
-        $this->_set_publish_post_box_vars(null, false, false, null, false);
507
-        $this->display_admin_page_with_sidebar();
508
-    }
509
-    
510
-    
511
-    /**
512
-     * _update_admin_option_settings
513
-     *
514
-     * @throws \EE_Error
515
-     * @throws \EventEspresso\core\exceptions\InvalidDataTypeException
516
-     * @throws \EventEspresso\core\exceptions\InvalidFormSubmissionException
517
-     * @throws \InvalidArgumentException
518
-     * @throws \LogicException
519
-     */
520
-    protected function _update_admin_option_settings()
521
-    {
522
-        try {
523
-            $admin_options_settings_form = new AdminOptionsSettings(EE_Registry::instance());
524
-            $admin_options_settings_form->process($this->_req_data[$admin_options_settings_form->slug()]);
525
-            EE_Registry::instance()->CFG->admin = apply_filters(
526
-                'FHEE__General_Settings_Admin_Page___update_admin_option_settings__CFG_admin',
527
-                EE_Registry::instance()->CFG->admin
528
-            );
529
-        } catch (Exception $e) {
530
-            EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__);
531
-        }
532
-        $this->_redirect_after_action(
533
-            apply_filters(
534
-                'FHEE__General_Settings_Admin_Page___update_admin_option_settings__success',
535
-                $this->_update_espresso_configuration(
536
-                    'Admin Options',
537
-                    EE_Registry::instance()->CFG->admin,
538
-                    __FILE__, __FUNCTION__, __LINE__
539
-                )
540
-            ),
541
-            'Admin Options',
542
-            'updated',
543
-            array('action' => 'admin_option_settings')
544
-        );
479
+	}
480
+    
481
+    
482
+    
483
+	/*************        Admin Options        *************/
484
+    
485
+    
486
+	/**
487
+	 * _admin_option_settings
488
+	 *
489
+	 * @throws \EE_Error
490
+	 * @throws \LogicException
491
+	 */
492
+	protected function _admin_option_settings()
493
+	{
494
+		$this->_template_args['admin_page_content'] = '';
495
+		try {
496
+			$admin_options_settings_form = new AdminOptionsSettings(EE_Registry::instance());
497
+			// still need this for the old school form in Extend_General_Settings_Admin_Page
498
+			$this->_template_args['values'] = $this->_yes_no_values;
499
+			// also need to account for the do_action that was in the old template
500
+			$admin_options_settings_form->setTemplateArgs($this->_template_args);
501
+			$this->_template_args['admin_page_content'] = $admin_options_settings_form->display();
502
+		} catch (Exception $e) {
503
+			EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__);
504
+		}
505
+		$this->_set_add_edit_form_tags('update_admin_option_settings');
506
+		$this->_set_publish_post_box_vars(null, false, false, null, false);
507
+		$this->display_admin_page_with_sidebar();
508
+	}
509
+    
510
+    
511
+	/**
512
+	 * _update_admin_option_settings
513
+	 *
514
+	 * @throws \EE_Error
515
+	 * @throws \EventEspresso\core\exceptions\InvalidDataTypeException
516
+	 * @throws \EventEspresso\core\exceptions\InvalidFormSubmissionException
517
+	 * @throws \InvalidArgumentException
518
+	 * @throws \LogicException
519
+	 */
520
+	protected function _update_admin_option_settings()
521
+	{
522
+		try {
523
+			$admin_options_settings_form = new AdminOptionsSettings(EE_Registry::instance());
524
+			$admin_options_settings_form->process($this->_req_data[$admin_options_settings_form->slug()]);
525
+			EE_Registry::instance()->CFG->admin = apply_filters(
526
+				'FHEE__General_Settings_Admin_Page___update_admin_option_settings__CFG_admin',
527
+				EE_Registry::instance()->CFG->admin
528
+			);
529
+		} catch (Exception $e) {
530
+			EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__);
531
+		}
532
+		$this->_redirect_after_action(
533
+			apply_filters(
534
+				'FHEE__General_Settings_Admin_Page___update_admin_option_settings__success',
535
+				$this->_update_espresso_configuration(
536
+					'Admin Options',
537
+					EE_Registry::instance()->CFG->admin,
538
+					__FILE__, __FUNCTION__, __LINE__
539
+				)
540
+			),
541
+			'Admin Options',
542
+			'updated',
543
+			array('action' => 'admin_option_settings')
544
+		);
545 545
         
546
-    }
546
+	}
547 547
     
548 548
     
549
-    /*************        Countries        *************/
549
+	/*************        Countries        *************/
550 550
     
551 551
     
552
-    protected function _country_settings()
553
-    {
552
+	protected function _country_settings()
553
+	{
554 554
         
555
-        $CNT_ISO = isset(EE_Registry::instance()->CFG->organization->CNT_ISO) ? EE_Registry::instance()->CFG->organization->CNT_ISO : 'US';
556
-        $CNT_ISO = isset($this->_req_data['country']) ? strtoupper(sanitize_text_field($this->_req_data['country'])) : $CNT_ISO;
555
+		$CNT_ISO = isset(EE_Registry::instance()->CFG->organization->CNT_ISO) ? EE_Registry::instance()->CFG->organization->CNT_ISO : 'US';
556
+		$CNT_ISO = isset($this->_req_data['country']) ? strtoupper(sanitize_text_field($this->_req_data['country'])) : $CNT_ISO;
557 557
         
558
-        //load field generator helper
558
+		//load field generator helper
559 559
         
560
-        $this->_template_args['values'] = $this->_yes_no_values;
560
+		$this->_template_args['values'] = $this->_yes_no_values;
561 561
         
562
-        $this->_template_args['countries'] = new EE_Question_Form_Input(
563
-            EE_Question::new_instance(array(
564
-                'QST_ID'           => 0,
565
-                'QST_display_text' => __('Select Country', 'event_espresso'),
566
-                'QST_system'       => 'admin-country'
567
-            )),
568
-            EE_Answer::new_instance(array(
569
-                'ANS_ID'    => 0,
570
-                'ANS_value' => $CNT_ISO
571
-            )),
572
-            array(
573
-                'input_id'       => 'country',
574
-                'input_name'     => 'country',
575
-                'input_prefix'   => '',
576
-                'append_qstn_id' => false
577
-            )
578
-        );
562
+		$this->_template_args['countries'] = new EE_Question_Form_Input(
563
+			EE_Question::new_instance(array(
564
+				'QST_ID'           => 0,
565
+				'QST_display_text' => __('Select Country', 'event_espresso'),
566
+				'QST_system'       => 'admin-country'
567
+			)),
568
+			EE_Answer::new_instance(array(
569
+				'ANS_ID'    => 0,
570
+				'ANS_value' => $CNT_ISO
571
+			)),
572
+			array(
573
+				'input_id'       => 'country',
574
+				'input_name'     => 'country',
575
+				'input_prefix'   => '',
576
+				'append_qstn_id' => false
577
+			)
578
+		);
579 579
 //		EEH_Debug_Tools::printr( $this->_template_args['countries'], 'countries  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
580 580
         
581
-        add_filter('FHEE__EEH_Form_Fields__label_html', array($this, 'country_form_field_label_wrap'), 10, 2);
582
-        add_filter('FHEE__EEH_Form_Fields__input_html', array($this, 'country_form_field_input__wrap'), 10, 2);
583
-        $this->_template_args['country_details_settings'] = $this->display_country_settings();
584
-        $this->_template_args['country_states_settings']  = $this->display_country_states();
581
+		add_filter('FHEE__EEH_Form_Fields__label_html', array($this, 'country_form_field_label_wrap'), 10, 2);
582
+		add_filter('FHEE__EEH_Form_Fields__input_html', array($this, 'country_form_field_input__wrap'), 10, 2);
583
+		$this->_template_args['country_details_settings'] = $this->display_country_settings();
584
+		$this->_template_args['country_states_settings']  = $this->display_country_states();
585 585
         
586
-        $this->_set_add_edit_form_tags('update_country_settings');
587
-        $this->_set_publish_post_box_vars(null, false, false, null, false);
588
-        $this->_template_args['admin_page_content'] = EEH_Template::display_template(GEN_SET_TEMPLATE_PATH . 'countries_settings.template.php',
589
-            $this->_template_args, true);
590
-        $this->display_admin_page_with_no_sidebar();
591
-    }
592
-    
593
-    
594
-    /**
595
-     *        display_country_settings
596
-     *
597
-     * @access    public
598
-     *
599
-     * @param    string $CNT_ISO
600
-     *
601
-     * @return        mixed        string | array
602
-     */
603
-    public function display_country_settings($CNT_ISO = '')
604
-    {
586
+		$this->_set_add_edit_form_tags('update_country_settings');
587
+		$this->_set_publish_post_box_vars(null, false, false, null, false);
588
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template(GEN_SET_TEMPLATE_PATH . 'countries_settings.template.php',
589
+			$this->_template_args, true);
590
+		$this->display_admin_page_with_no_sidebar();
591
+	}
592
+    
593
+    
594
+	/**
595
+	 *        display_country_settings
596
+	 *
597
+	 * @access    public
598
+	 *
599
+	 * @param    string $CNT_ISO
600
+	 *
601
+	 * @return        mixed        string | array
602
+	 */
603
+	public function display_country_settings($CNT_ISO = '')
604
+	{
605 605
         
606
-        $CNT_ISO = isset($this->_req_data['country']) ? strtoupper(sanitize_text_field($this->_req_data['country'])) : $CNT_ISO;
607
-        if ( ! $CNT_ISO) {
608
-            return '';
609
-        }
606
+		$CNT_ISO = isset($this->_req_data['country']) ? strtoupper(sanitize_text_field($this->_req_data['country'])) : $CNT_ISO;
607
+		if ( ! $CNT_ISO) {
608
+			return '';
609
+		}
610 610
         
611
-        // for ajax
612
-        remove_all_filters('FHEE__EEH_Form_Fields__label_html');
613
-        remove_all_filters('FHEE__EEH_Form_Fields__input_html');
614
-        add_filter('FHEE__EEH_Form_Fields__label_html', array($this, 'country_form_field_label_wrap'), 10, 2);
615
-        add_filter('FHEE__EEH_Form_Fields__input_html', array($this, 'country_form_field_input__wrap'), 10, 2);
616
-        $country = EEM_Country::instance()->get_one_by_ID($CNT_ISO);
617
-        //EEH_Debug_Tools::printr( $country, '$country  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
618
-        $country_input_types            = array(
619
-            'CNT_active'      => array(
620
-                'type'             => 'RADIO_BTN',
621
-                'input_name'       => 'cntry[' . $CNT_ISO . ']',
622
-                'class'            => '',
623
-                'options'          => $this->_yes_no_values,
624
-                'use_desc_4_label' => true
625
-            ),
626
-            'CNT_ISO'         => array(
627
-                'type'       => 'TEXT',
628
-                'input_name' => 'cntry[' . $CNT_ISO . ']',
629
-                'class'      => 'small-text'
630
-            ),
631
-            'CNT_ISO3'        => array(
632
-                'type'       => 'TEXT',
633
-                'input_name' => 'cntry[' . $CNT_ISO . ']',
634
-                'class'      => 'small-text'
635
-            ),
636
-            'RGN_ID'          => array(
637
-                'type'       => 'TEXT',
638
-                'input_name' => 'cntry[' . $CNT_ISO . ']',
639
-                'class'      => 'small-text'
640
-            ),
641
-            'CNT_name'        => array(
642
-                'type'       => 'TEXT',
643
-                'input_name' => 'cntry[' . $CNT_ISO . ']',
644
-                'class'      => 'regular-text'
645
-            ),
646
-            'CNT_cur_code'    => array(
647
-                'type'       => 'TEXT',
648
-                'input_name' => 'cntry[' . $CNT_ISO . ']',
649
-                'class'      => 'small-text'
650
-            ),
651
-            'CNT_cur_single'  => array(
652
-                'type'       => 'TEXT',
653
-                'input_name' => 'cntry[' . $CNT_ISO . ']',
654
-                'class'      => 'medium-text'
655
-            ),
656
-            'CNT_cur_plural'  => array(
657
-                'type'       => 'TEXT',
658
-                'input_name' => 'cntry[' . $CNT_ISO . ']',
659
-                'class'      => 'medium-text'
660
-            ),
661
-            'CNT_cur_sign'    => array(
662
-                'type'         => 'TEXT',
663
-                'input_name'   => 'cntry[' . $CNT_ISO . ']',
664
-                'class'        => 'small-text',
665
-                'htmlentities' => false
666
-            ),
667
-            'CNT_cur_sign_b4' => array(
668
-                'type'             => 'RADIO_BTN',
669
-                'input_name'       => 'cntry[' . $CNT_ISO . ']',
670
-                'class'            => '',
671
-                'options'          => $this->_yes_no_values,
672
-                'use_desc_4_label' => true
673
-            ),
674
-            'CNT_cur_dec_plc' => array(
675
-                'type'       => 'RADIO_BTN',
676
-                'input_name' => 'cntry[' . $CNT_ISO . ']',
677
-                'class'      => '',
678
-                'options'    => array(
679
-                    array('id' => 0, 'text' => ''),
680
-                    array('id' => 1, 'text' => ''),
681
-                    array('id' => 2, 'text' => ''),
682
-                    array('id' => 3, 'text' => '')
683
-                )
684
-            ),
685
-            'CNT_cur_dec_mrk' => array(
686
-                'type'             => 'RADIO_BTN',
687
-                'input_name'       => 'cntry[' . $CNT_ISO . ']',
688
-                'class'            => '',
689
-                'options'          => array(
690
-                    array(
691
-                        'id'   => ',',
692
-                        'text' => __(', (comma)', 'event_espresso')
693
-                    ),
694
-                    array('id' => '.', 'text' => __('. (decimal)', 'event_espresso'))
695
-                ),
696
-                'use_desc_4_label' => true
697
-            ),
698
-            'CNT_cur_thsnds'  => array(
699
-                'type'             => 'RADIO_BTN',
700
-                'input_name'       => 'cntry[' . $CNT_ISO . ']',
701
-                'class'            => '',
702
-                'options'          => array(
703
-                    array(
704
-                        'id'   => ',',
705
-                        'text' => __(', (comma)', 'event_espresso')
706
-                    ),
707
-                    array('id' => '.', 'text' => __('. (decimal)', 'event_espresso'))
708
-                ),
709
-                'use_desc_4_label' => true
710
-            ),
711
-            'CNT_tel_code'    => array(
712
-                'type'       => 'TEXT',
713
-                'input_name' => 'cntry[' . $CNT_ISO . ']',
714
-                'class'      => 'small-text'
715
-            ),
716
-            'CNT_is_EU'       => array(
717
-                'type'             => 'RADIO_BTN',
718
-                'input_name'       => 'cntry[' . $CNT_ISO . ']',
719
-                'class'            => '',
720
-                'options'          => $this->_yes_no_values,
721
-                'use_desc_4_label' => true
722
-            )
723
-        );
724
-        $this->_template_args['inputs'] = EE_Question_Form_Input::generate_question_form_inputs_for_object($country,
725
-            $country_input_types);
726
-        $country_details_settings       = EEH_Template::display_template(GEN_SET_TEMPLATE_PATH . 'country_details_settings.template.php',
727
-            $this->_template_args, true);
611
+		// for ajax
612
+		remove_all_filters('FHEE__EEH_Form_Fields__label_html');
613
+		remove_all_filters('FHEE__EEH_Form_Fields__input_html');
614
+		add_filter('FHEE__EEH_Form_Fields__label_html', array($this, 'country_form_field_label_wrap'), 10, 2);
615
+		add_filter('FHEE__EEH_Form_Fields__input_html', array($this, 'country_form_field_input__wrap'), 10, 2);
616
+		$country = EEM_Country::instance()->get_one_by_ID($CNT_ISO);
617
+		//EEH_Debug_Tools::printr( $country, '$country  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
618
+		$country_input_types            = array(
619
+			'CNT_active'      => array(
620
+				'type'             => 'RADIO_BTN',
621
+				'input_name'       => 'cntry[' . $CNT_ISO . ']',
622
+				'class'            => '',
623
+				'options'          => $this->_yes_no_values,
624
+				'use_desc_4_label' => true
625
+			),
626
+			'CNT_ISO'         => array(
627
+				'type'       => 'TEXT',
628
+				'input_name' => 'cntry[' . $CNT_ISO . ']',
629
+				'class'      => 'small-text'
630
+			),
631
+			'CNT_ISO3'        => array(
632
+				'type'       => 'TEXT',
633
+				'input_name' => 'cntry[' . $CNT_ISO . ']',
634
+				'class'      => 'small-text'
635
+			),
636
+			'RGN_ID'          => array(
637
+				'type'       => 'TEXT',
638
+				'input_name' => 'cntry[' . $CNT_ISO . ']',
639
+				'class'      => 'small-text'
640
+			),
641
+			'CNT_name'        => array(
642
+				'type'       => 'TEXT',
643
+				'input_name' => 'cntry[' . $CNT_ISO . ']',
644
+				'class'      => 'regular-text'
645
+			),
646
+			'CNT_cur_code'    => array(
647
+				'type'       => 'TEXT',
648
+				'input_name' => 'cntry[' . $CNT_ISO . ']',
649
+				'class'      => 'small-text'
650
+			),
651
+			'CNT_cur_single'  => array(
652
+				'type'       => 'TEXT',
653
+				'input_name' => 'cntry[' . $CNT_ISO . ']',
654
+				'class'      => 'medium-text'
655
+			),
656
+			'CNT_cur_plural'  => array(
657
+				'type'       => 'TEXT',
658
+				'input_name' => 'cntry[' . $CNT_ISO . ']',
659
+				'class'      => 'medium-text'
660
+			),
661
+			'CNT_cur_sign'    => array(
662
+				'type'         => 'TEXT',
663
+				'input_name'   => 'cntry[' . $CNT_ISO . ']',
664
+				'class'        => 'small-text',
665
+				'htmlentities' => false
666
+			),
667
+			'CNT_cur_sign_b4' => array(
668
+				'type'             => 'RADIO_BTN',
669
+				'input_name'       => 'cntry[' . $CNT_ISO . ']',
670
+				'class'            => '',
671
+				'options'          => $this->_yes_no_values,
672
+				'use_desc_4_label' => true
673
+			),
674
+			'CNT_cur_dec_plc' => array(
675
+				'type'       => 'RADIO_BTN',
676
+				'input_name' => 'cntry[' . $CNT_ISO . ']',
677
+				'class'      => '',
678
+				'options'    => array(
679
+					array('id' => 0, 'text' => ''),
680
+					array('id' => 1, 'text' => ''),
681
+					array('id' => 2, 'text' => ''),
682
+					array('id' => 3, 'text' => '')
683
+				)
684
+			),
685
+			'CNT_cur_dec_mrk' => array(
686
+				'type'             => 'RADIO_BTN',
687
+				'input_name'       => 'cntry[' . $CNT_ISO . ']',
688
+				'class'            => '',
689
+				'options'          => array(
690
+					array(
691
+						'id'   => ',',
692
+						'text' => __(', (comma)', 'event_espresso')
693
+					),
694
+					array('id' => '.', 'text' => __('. (decimal)', 'event_espresso'))
695
+				),
696
+				'use_desc_4_label' => true
697
+			),
698
+			'CNT_cur_thsnds'  => array(
699
+				'type'             => 'RADIO_BTN',
700
+				'input_name'       => 'cntry[' . $CNT_ISO . ']',
701
+				'class'            => '',
702
+				'options'          => array(
703
+					array(
704
+						'id'   => ',',
705
+						'text' => __(', (comma)', 'event_espresso')
706
+					),
707
+					array('id' => '.', 'text' => __('. (decimal)', 'event_espresso'))
708
+				),
709
+				'use_desc_4_label' => true
710
+			),
711
+			'CNT_tel_code'    => array(
712
+				'type'       => 'TEXT',
713
+				'input_name' => 'cntry[' . $CNT_ISO . ']',
714
+				'class'      => 'small-text'
715
+			),
716
+			'CNT_is_EU'       => array(
717
+				'type'             => 'RADIO_BTN',
718
+				'input_name'       => 'cntry[' . $CNT_ISO . ']',
719
+				'class'            => '',
720
+				'options'          => $this->_yes_no_values,
721
+				'use_desc_4_label' => true
722
+			)
723
+		);
724
+		$this->_template_args['inputs'] = EE_Question_Form_Input::generate_question_form_inputs_for_object($country,
725
+			$country_input_types);
726
+		$country_details_settings       = EEH_Template::display_template(GEN_SET_TEMPLATE_PATH . 'country_details_settings.template.php',
727
+			$this->_template_args, true);
728 728
         
729
-        if (defined('DOING_AJAX')) {
730
-            $notices = EE_Error::get_notices(false, false, false);
731
-            echo wp_json_encode(array(
732
-                'return_data' => $country_details_settings,
733
-                'success'     => $notices['success'],
734
-                'errors'      => $notices['errors']
735
-            ));
736
-            die();
737
-        } else {
738
-            return $country_details_settings;
739
-        }
729
+		if (defined('DOING_AJAX')) {
730
+			$notices = EE_Error::get_notices(false, false, false);
731
+			echo wp_json_encode(array(
732
+				'return_data' => $country_details_settings,
733
+				'success'     => $notices['success'],
734
+				'errors'      => $notices['errors']
735
+			));
736
+			die();
737
+		} else {
738
+			return $country_details_settings;
739
+		}
740 740
         
741
-    }
742
-    
743
-    
744
-    /**
745
-     *        display_country_states
746
-     *
747
-     * @access    public
748
-     *
749
-     * @param    string $CNT_ISO
750
-     *
751
-     * @return        string
752
-     */
753
-    public function display_country_states($CNT_ISO = '')
754
-    {
741
+	}
742
+    
743
+    
744
+	/**
745
+	 *        display_country_states
746
+	 *
747
+	 * @access    public
748
+	 *
749
+	 * @param    string $CNT_ISO
750
+	 *
751
+	 * @return        string
752
+	 */
753
+	public function display_country_states($CNT_ISO = '')
754
+	{
755 755
         
756
-        $CNT_ISO = isset($this->_req_data['country']) ? sanitize_text_field($this->_req_data['country']) : $CNT_ISO;
756
+		$CNT_ISO = isset($this->_req_data['country']) ? sanitize_text_field($this->_req_data['country']) : $CNT_ISO;
757 757
         
758
-        if ( ! $CNT_ISO) {
759
-            return '';
760
-        }
761
-        // for ajax
762
-        remove_all_filters('FHEE__EEH_Form_Fields__label_html');
763
-        remove_all_filters('FHEE__EEH_Form_Fields__input_html');
764
-        add_filter('FHEE__EEH_Form_Fields__label_html', array($this, 'state_form_field_label_wrap'), 10, 2);
765
-        add_filter('FHEE__EEH_Form_Fields__input_html', array($this, 'state_form_field_input__wrap'), 10, 2);
766
-        $states = EEM_State::instance()->get_all_states_for_these_countries(array($CNT_ISO => $CNT_ISO));
758
+		if ( ! $CNT_ISO) {
759
+			return '';
760
+		}
761
+		// for ajax
762
+		remove_all_filters('FHEE__EEH_Form_Fields__label_html');
763
+		remove_all_filters('FHEE__EEH_Form_Fields__input_html');
764
+		add_filter('FHEE__EEH_Form_Fields__label_html', array($this, 'state_form_field_label_wrap'), 10, 2);
765
+		add_filter('FHEE__EEH_Form_Fields__input_html', array($this, 'state_form_field_input__wrap'), 10, 2);
766
+		$states = EEM_State::instance()->get_all_states_for_these_countries(array($CNT_ISO => $CNT_ISO));
767 767
 
768 768
 //			echo '<h4>$CNT_ISO : ' . $CNT_ISO . '  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>';
769 769
 //			global $wpdb;
770 770
 //			echo '<h4>' . $wpdb->last_query . '  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>';
771 771
 //			EEH_Debug_Tools::printr( $states, '$states  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
772
-        if ($states) {
773
-            foreach ($states as $STA_ID => $state) {
774
-                if ($state instanceof EE_State) {
775
-                    //STA_abbrev 	STA_name 	STA_active
776
-                    $state_input_types                                           = array(
777
-                        'STA_abbrev' => array(
778
-                            'type'       => 'TEXT',
779
-                            'input_name' => 'states[' . $STA_ID . ']',
780
-                            'class'      => 'mid-text'
781
-                        ),
782
-                        'STA_name'   => array(
783
-                            'type'       => 'TEXT',
784
-                            'input_name' => 'states[' . $STA_ID . ']',
785
-                            'class'      => 'regular-text'
786
-                        ),
787
-                        'STA_active' => array(
788
-                            'type'             => 'RADIO_BTN',
789
-                            'input_name'       => 'states[' . $STA_ID . ']',
790
-                            'options'          => $this->_yes_no_values,
791
-                            'use_desc_4_label' => true
792
-                        )
793
-                    );
794
-                    $this->_template_args['states'][$STA_ID]['inputs']           = EE_Question_Form_Input::generate_question_form_inputs_for_object($state,
795
-                        $state_input_types);
796
-                    $query_args                                                  = array(
797
-                        'action'     => 'delete_state',
798
-                        'STA_ID'     => $STA_ID,
799
-                        'CNT_ISO'    => $CNT_ISO,
800
-                        'STA_abbrev' => $state->abbrev()
801
-                    );
802
-                    $this->_template_args['states'][$STA_ID]['delete_state_url'] = EE_Admin_Page::add_query_args_and_nonce($query_args,
803
-                        GEN_SET_ADMIN_URL);
804
-                }
805
-            }
806
-        } else {
807
-            $this->_template_args['states'] = false;
808
-        }
772
+		if ($states) {
773
+			foreach ($states as $STA_ID => $state) {
774
+				if ($state instanceof EE_State) {
775
+					//STA_abbrev 	STA_name 	STA_active
776
+					$state_input_types                                           = array(
777
+						'STA_abbrev' => array(
778
+							'type'       => 'TEXT',
779
+							'input_name' => 'states[' . $STA_ID . ']',
780
+							'class'      => 'mid-text'
781
+						),
782
+						'STA_name'   => array(
783
+							'type'       => 'TEXT',
784
+							'input_name' => 'states[' . $STA_ID . ']',
785
+							'class'      => 'regular-text'
786
+						),
787
+						'STA_active' => array(
788
+							'type'             => 'RADIO_BTN',
789
+							'input_name'       => 'states[' . $STA_ID . ']',
790
+							'options'          => $this->_yes_no_values,
791
+							'use_desc_4_label' => true
792
+						)
793
+					);
794
+					$this->_template_args['states'][$STA_ID]['inputs']           = EE_Question_Form_Input::generate_question_form_inputs_for_object($state,
795
+						$state_input_types);
796
+					$query_args                                                  = array(
797
+						'action'     => 'delete_state',
798
+						'STA_ID'     => $STA_ID,
799
+						'CNT_ISO'    => $CNT_ISO,
800
+						'STA_abbrev' => $state->abbrev()
801
+					);
802
+					$this->_template_args['states'][$STA_ID]['delete_state_url'] = EE_Admin_Page::add_query_args_and_nonce($query_args,
803
+						GEN_SET_ADMIN_URL);
804
+				}
805
+			}
806
+		} else {
807
+			$this->_template_args['states'] = false;
808
+		}
809 809
 //		EEH_Debug_Tools::printr( $this->_template_args['states'], 'states  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
810
-        $this->_template_args['add_new_state_url'] = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'add_new_state'),
811
-            GEN_SET_ADMIN_URL);
810
+		$this->_template_args['add_new_state_url'] = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'add_new_state'),
811
+			GEN_SET_ADMIN_URL);
812 812
         
813
-        $state_details_settings = EEH_Template::display_template(GEN_SET_TEMPLATE_PATH . 'state_details_settings.template.php',
814
-            $this->_template_args, true);
813
+		$state_details_settings = EEH_Template::display_template(GEN_SET_TEMPLATE_PATH . 'state_details_settings.template.php',
814
+			$this->_template_args, true);
815 815
         
816
-        if (defined('DOING_AJAX')) {
817
-            $notices = EE_Error::get_notices(false, false, false);
818
-            echo wp_json_encode(array(
819
-                'return_data' => $state_details_settings,
820
-                'success'     => $notices['success'],
821
-                'errors'      => $notices['errors']
822
-            ));
823
-            die();
824
-        } else {
825
-            return $state_details_settings;
826
-        }
816
+		if (defined('DOING_AJAX')) {
817
+			$notices = EE_Error::get_notices(false, false, false);
818
+			echo wp_json_encode(array(
819
+				'return_data' => $state_details_settings,
820
+				'success'     => $notices['success'],
821
+				'errors'      => $notices['errors']
822
+			));
823
+			die();
824
+		} else {
825
+			return $state_details_settings;
826
+		}
827 827
         
828
-    }
828
+	}
829 829
     
830 830
     
831
-    /**
832
-     *        add_new_state
833
-     *
834
-     * @access    public
835
-     * @return        void
836
-     */
837
-    public function add_new_state()
838
-    {
831
+	/**
832
+	 *        add_new_state
833
+	 *
834
+	 * @access    public
835
+	 * @return        void
836
+	 */
837
+	public function add_new_state()
838
+	{
839 839
         
840
-        $success = true;
840
+		$success = true;
841 841
         
842
-        $CNT_ISO = isset($this->_req_data['CNT_ISO']) ? strtoupper(sanitize_text_field($this->_req_data['CNT_ISO'])) : false;
843
-        if ( ! $CNT_ISO) {
844
-            EE_Error::add_error(__('No Country ISO code or an invalid Country ISO code was received.',
845
-                'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
846
-            $success = false;
847
-        }
848
-        $STA_abbrev = isset($this->_req_data['STA_abbrev']) ? sanitize_text_field($this->_req_data['STA_abbrev']) : false;
849
-        if ( ! $STA_abbrev) {
850
-            EE_Error::add_error(__('No State ISO code or an invalid State ISO code was received.', 'event_espresso'),
851
-                __FILE__, __FUNCTION__, __LINE__);
852
-            $success = false;
853
-        }
854
-        $STA_name = isset($this->_req_data['STA_name']) ? sanitize_text_field($this->_req_data['STA_name']) :
855
-            false;
856
-        if ( ! $STA_name) {
857
-            EE_Error::add_error(__('No State name or an invalid State name was received.', 'event_espresso'), __FILE__,
858
-                __FUNCTION__, __LINE__);
859
-            $success = false;
860
-        }
842
+		$CNT_ISO = isset($this->_req_data['CNT_ISO']) ? strtoupper(sanitize_text_field($this->_req_data['CNT_ISO'])) : false;
843
+		if ( ! $CNT_ISO) {
844
+			EE_Error::add_error(__('No Country ISO code or an invalid Country ISO code was received.',
845
+				'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
846
+			$success = false;
847
+		}
848
+		$STA_abbrev = isset($this->_req_data['STA_abbrev']) ? sanitize_text_field($this->_req_data['STA_abbrev']) : false;
849
+		if ( ! $STA_abbrev) {
850
+			EE_Error::add_error(__('No State ISO code or an invalid State ISO code was received.', 'event_espresso'),
851
+				__FILE__, __FUNCTION__, __LINE__);
852
+			$success = false;
853
+		}
854
+		$STA_name = isset($this->_req_data['STA_name']) ? sanitize_text_field($this->_req_data['STA_name']) :
855
+			false;
856
+		if ( ! $STA_name) {
857
+			EE_Error::add_error(__('No State name or an invalid State name was received.', 'event_espresso'), __FILE__,
858
+				__FUNCTION__, __LINE__);
859
+			$success = false;
860
+		}
861 861
         
862
-        if ($success) {
863
-            $cols_n_values = array(
864
-                'CNT_ISO'    => $CNT_ISO,
865
-                'STA_abbrev' => $STA_abbrev,
866
-                'STA_name'   => $STA_name,
867
-                'STA_active' => true
868
-            );
869
-            $success       = EEM_State::instance()->insert($cols_n_values);
870
-            EE_Error::add_success(__('The State was added successfully.', 'event_espresso'));
871
-        }
862
+		if ($success) {
863
+			$cols_n_values = array(
864
+				'CNT_ISO'    => $CNT_ISO,
865
+				'STA_abbrev' => $STA_abbrev,
866
+				'STA_name'   => $STA_name,
867
+				'STA_active' => true
868
+			);
869
+			$success       = EEM_State::instance()->insert($cols_n_values);
870
+			EE_Error::add_success(__('The State was added successfully.', 'event_espresso'));
871
+		}
872 872
         
873
-        if (defined('DOING_AJAX')) {
874
-            $notices = EE_Error::get_notices(false, false, false);
875
-            echo wp_json_encode(array_merge($notices, array('return_data' => $CNT_ISO)));
876
-            die();
877
-        } else {
878
-            $this->_redirect_after_action($success, 'State', 'added', array('action' => 'country_settings'));
879
-        }
880
-    }
881
-    
882
-    
883
-    /**
884
-     *        delete_state
885
-     *
886
-     * @access    public
887
-     * @return        boolean | void
888
-     */
889
-    public function delete_state()
890
-    {
891
-        $CNT_ISO    = isset($this->_req_data['CNT_ISO']) ? strtoupper(sanitize_text_field($this->_req_data['CNT_ISO'])) : false;
892
-        $STA_ID     = isset($this->_req_data['STA_ID']) ? sanitize_text_field($this->_req_data['STA_ID']) : false;
893
-        $STA_abbrev = isset($this->_req_data['STA_abbrev']) ? sanitize_text_field($this->_req_data['STA_abbrev']) : false;
894
-        if ( ! $STA_ID) {
895
-            EE_Error::add_error(__('No State ID or an invalid State ID was received.', 'event_espresso'), __FILE__,
896
-                __FUNCTION__, __LINE__);
873
+		if (defined('DOING_AJAX')) {
874
+			$notices = EE_Error::get_notices(false, false, false);
875
+			echo wp_json_encode(array_merge($notices, array('return_data' => $CNT_ISO)));
876
+			die();
877
+		} else {
878
+			$this->_redirect_after_action($success, 'State', 'added', array('action' => 'country_settings'));
879
+		}
880
+	}
881
+    
882
+    
883
+	/**
884
+	 *        delete_state
885
+	 *
886
+	 * @access    public
887
+	 * @return        boolean | void
888
+	 */
889
+	public function delete_state()
890
+	{
891
+		$CNT_ISO    = isset($this->_req_data['CNT_ISO']) ? strtoupper(sanitize_text_field($this->_req_data['CNT_ISO'])) : false;
892
+		$STA_ID     = isset($this->_req_data['STA_ID']) ? sanitize_text_field($this->_req_data['STA_ID']) : false;
893
+		$STA_abbrev = isset($this->_req_data['STA_abbrev']) ? sanitize_text_field($this->_req_data['STA_abbrev']) : false;
894
+		if ( ! $STA_ID) {
895
+			EE_Error::add_error(__('No State ID or an invalid State ID was received.', 'event_espresso'), __FILE__,
896
+				__FUNCTION__, __LINE__);
897 897
             
898
-            return false;
899
-        }
900
-        $success = EEM_State::instance()->delete_by_ID($STA_ID);
901
-        if ($success !== false) {
902
-            do_action('AHEE__General_Settings_Admin_Page__delete_state__state_deleted', $CNT_ISO, $STA_ID,
903
-                array('STA_abbrev' => $STA_abbrev));
904
-            EE_Error::add_success(__('The State was deleted successfully.', 'event_espresso'));
905
-        }
906
-        if (defined('DOING_AJAX')) {
907
-            $notices                = EE_Error::get_notices(false, false);
908
-            $notices['return_data'] = true;
909
-            echo wp_json_encode($notices);
910
-            die();
911
-        } else {
912
-            $this->_redirect_after_action($success, 'State', 'deleted', array('action' => 'country_settings'));
913
-        }
914
-    }
915
-    
916
-    
917
-    /**
918
-     *        _update_country_settings
919
-     *
920
-     * @access    protected
921
-     * @return        void
922
-     */
923
-    protected function _update_country_settings()
924
-    {
898
+			return false;
899
+		}
900
+		$success = EEM_State::instance()->delete_by_ID($STA_ID);
901
+		if ($success !== false) {
902
+			do_action('AHEE__General_Settings_Admin_Page__delete_state__state_deleted', $CNT_ISO, $STA_ID,
903
+				array('STA_abbrev' => $STA_abbrev));
904
+			EE_Error::add_success(__('The State was deleted successfully.', 'event_espresso'));
905
+		}
906
+		if (defined('DOING_AJAX')) {
907
+			$notices                = EE_Error::get_notices(false, false);
908
+			$notices['return_data'] = true;
909
+			echo wp_json_encode($notices);
910
+			die();
911
+		} else {
912
+			$this->_redirect_after_action($success, 'State', 'deleted', array('action' => 'country_settings'));
913
+		}
914
+	}
915
+    
916
+    
917
+	/**
918
+	 *        _update_country_settings
919
+	 *
920
+	 * @access    protected
921
+	 * @return        void
922
+	 */
923
+	protected function _update_country_settings()
924
+	{
925 925
 //		EEH_Debug_Tools::printr( $this->_req_data, '$this->_req_data  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
926
-        // grab the country ISO code
927
-        $CNT_ISO = isset($this->_req_data['country']) ? strtoupper(sanitize_text_field($this->_req_data['country'])) : false;
928
-        if ( ! $CNT_ISO) {
929
-            EE_Error::add_error(__('No Country ISO code or an invalid Country ISO code was received.',
930
-                'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
926
+		// grab the country ISO code
927
+		$CNT_ISO = isset($this->_req_data['country']) ? strtoupper(sanitize_text_field($this->_req_data['country'])) : false;
928
+		if ( ! $CNT_ISO) {
929
+			EE_Error::add_error(__('No Country ISO code or an invalid Country ISO code was received.',
930
+				'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
931 931
             
932
-            return;
933
-        }
934
-        $cols_n_values                    = array();
935
-        $cols_n_values['CNT_ISO3']        = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_ISO3']) ? strtoupper(sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_ISO3'])) : false;
936
-        $cols_n_values['RGN_ID']          = isset($this->_req_data['cntry'][$CNT_ISO]['RGN_ID']) ? absint($this->_req_data['cntry'][$CNT_ISO]['RGN_ID']) : null;
937
-        $cols_n_values['CNT_name']        = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_name']) ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_name']) : null;
938
-        $cols_n_values['CNT_cur_code']    = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_code']) ? strtoupper(sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_code'])) : 'USD';
939
-        $cols_n_values['CNT_cur_single']  = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_single']) ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_single']) : 'dollar';
940
-        $cols_n_values['CNT_cur_plural']  = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_plural']) ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_plural']) : 'dollars';
941
-        $cols_n_values['CNT_cur_sign']    = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_sign']) ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_sign']) : '$';
942
-        $cols_n_values['CNT_cur_sign_b4'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_sign_b4']) ? absint($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_sign_b4']) : true;
943
-        $cols_n_values['CNT_cur_dec_plc'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_dec_plc']) ? absint($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_dec_plc']) : 2;
944
-        $cols_n_values['CNT_cur_dec_mrk'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_dec_mrk']) ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_dec_mrk']) : '.';
945
-        $cols_n_values['CNT_cur_thsnds']  = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_thsnds']) ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_thsnds']) : ',';
946
-        $cols_n_values['CNT_tel_code']    = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_tel_code']) ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_tel_code']) : null;
947
-        $cols_n_values['CNT_is_EU']       = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_is_EU']) ? absint($this->_req_data['cntry'][$CNT_ISO]['CNT_is_EU']) : false;
948
-        $cols_n_values['CNT_active']      = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_active']) ? absint($this->_req_data['cntry'][$CNT_ISO]['CNT_active']) : false;
949
-        // allow filtering of country data
950
-        $cols_n_values = apply_filters('FHEE__General_Settings_Admin_Page___update_country_settings__cols_n_values',
951
-            $cols_n_values);
952
-        //EEH_Debug_Tools::printr( $cols_n_values, '$cols_n_values  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
953
-        // where values
954
-        $where_cols_n_values = array(array('CNT_ISO' => $CNT_ISO));
955
-        // run the update
956
-        $success = EEM_Country::instance()->update($cols_n_values, $where_cols_n_values);
932
+			return;
933
+		}
934
+		$cols_n_values                    = array();
935
+		$cols_n_values['CNT_ISO3']        = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_ISO3']) ? strtoupper(sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_ISO3'])) : false;
936
+		$cols_n_values['RGN_ID']          = isset($this->_req_data['cntry'][$CNT_ISO]['RGN_ID']) ? absint($this->_req_data['cntry'][$CNT_ISO]['RGN_ID']) : null;
937
+		$cols_n_values['CNT_name']        = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_name']) ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_name']) : null;
938
+		$cols_n_values['CNT_cur_code']    = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_code']) ? strtoupper(sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_code'])) : 'USD';
939
+		$cols_n_values['CNT_cur_single']  = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_single']) ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_single']) : 'dollar';
940
+		$cols_n_values['CNT_cur_plural']  = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_plural']) ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_plural']) : 'dollars';
941
+		$cols_n_values['CNT_cur_sign']    = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_sign']) ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_sign']) : '$';
942
+		$cols_n_values['CNT_cur_sign_b4'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_sign_b4']) ? absint($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_sign_b4']) : true;
943
+		$cols_n_values['CNT_cur_dec_plc'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_dec_plc']) ? absint($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_dec_plc']) : 2;
944
+		$cols_n_values['CNT_cur_dec_mrk'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_dec_mrk']) ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_dec_mrk']) : '.';
945
+		$cols_n_values['CNT_cur_thsnds']  = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_thsnds']) ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_thsnds']) : ',';
946
+		$cols_n_values['CNT_tel_code']    = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_tel_code']) ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_tel_code']) : null;
947
+		$cols_n_values['CNT_is_EU']       = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_is_EU']) ? absint($this->_req_data['cntry'][$CNT_ISO]['CNT_is_EU']) : false;
948
+		$cols_n_values['CNT_active']      = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_active']) ? absint($this->_req_data['cntry'][$CNT_ISO]['CNT_active']) : false;
949
+		// allow filtering of country data
950
+		$cols_n_values = apply_filters('FHEE__General_Settings_Admin_Page___update_country_settings__cols_n_values',
951
+			$cols_n_values);
952
+		//EEH_Debug_Tools::printr( $cols_n_values, '$cols_n_values  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
953
+		// where values
954
+		$where_cols_n_values = array(array('CNT_ISO' => $CNT_ISO));
955
+		// run the update
956
+		$success = EEM_Country::instance()->update($cols_n_values, $where_cols_n_values);
957 957
 //		global $wpdb;
958 958
 //		echo '<h4>' . $wpdb->last_query . '  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>';
959 959
 //		echo '<h4>$success : ' . $success . '  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>';
960
-        if (isset($this->_req_data['states']) && is_array($this->_req_data['states']) && $success !== false) {
961
-            // allow filtering of states data
962
-            $states = apply_filters('FHEE__General_Settings_Admin_Page___update_country_settings__states',
963
-                $this->_req_data['states']);
960
+		if (isset($this->_req_data['states']) && is_array($this->_req_data['states']) && $success !== false) {
961
+			// allow filtering of states data
962
+			$states = apply_filters('FHEE__General_Settings_Admin_Page___update_country_settings__states',
963
+				$this->_req_data['states']);
964 964
 //			EEH_Debug_Tools::printr( $states, '$states  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
965
-            // loop thru state data ( looks like : states[75][STA_name] )
966
-            foreach ($states as $STA_ID => $state) {
967
-                $cols_n_values = array(
968
-                    'CNT_ISO'    => $CNT_ISO,
969
-                    'STA_abbrev' => sanitize_text_field($state['STA_abbrev']),
970
-                    'STA_name'   => sanitize_text_field($state['STA_name']),
971
-                    'STA_active' => (bool)absint($state['STA_active'])
972
-                );
973
-                // where values
974
-                $where_cols_n_values = array(array('STA_ID' => $STA_ID));
975
-                // run the update
976
-                $success = EEM_State::instance()->update($cols_n_values, $where_cols_n_values);
977
-                if ($success !== false) {
978
-                    do_action('AHEE__General_Settings_Admin_Page__update_country_settings__state_saved', $CNT_ISO,
979
-                        $STA_ID, $cols_n_values);
980
-                }
981
-            }
982
-        }
983
-        // check if country being edited matches org option country, and if so, then  update EE_Config with new settings
984
-        if (isset(EE_Registry::instance()->CFG->organization->CNT_ISO) && $CNT_ISO == EE_Registry::instance()->CFG->organization->CNT_ISO) {
985
-            EE_Registry::instance()->CFG->currency = new EE_Currency_Config($CNT_ISO);
986
-            EE_Registry::instance()->CFG->update_espresso_config();
987
-        }
988
-        $this->_redirect_after_action($success, 'Countries', 'updated',
989
-            array('action' => 'country_settings', 'country' => $CNT_ISO));
990
-    }
991
-    
992
-    
993
-    /**
994
-     *        form_form_field_label_wrap
995
-     *
996
-     * @access        public
997
-     *
998
-     * @param        string $label
999
-     *
1000
-     * @return        string
1001
-     */
1002
-    public function country_form_field_label_wrap($label, $required_text)
1003
-    {
1004
-        return '
965
+			// loop thru state data ( looks like : states[75][STA_name] )
966
+			foreach ($states as $STA_ID => $state) {
967
+				$cols_n_values = array(
968
+					'CNT_ISO'    => $CNT_ISO,
969
+					'STA_abbrev' => sanitize_text_field($state['STA_abbrev']),
970
+					'STA_name'   => sanitize_text_field($state['STA_name']),
971
+					'STA_active' => (bool)absint($state['STA_active'])
972
+				);
973
+				// where values
974
+				$where_cols_n_values = array(array('STA_ID' => $STA_ID));
975
+				// run the update
976
+				$success = EEM_State::instance()->update($cols_n_values, $where_cols_n_values);
977
+				if ($success !== false) {
978
+					do_action('AHEE__General_Settings_Admin_Page__update_country_settings__state_saved', $CNT_ISO,
979
+						$STA_ID, $cols_n_values);
980
+				}
981
+			}
982
+		}
983
+		// check if country being edited matches org option country, and if so, then  update EE_Config with new settings
984
+		if (isset(EE_Registry::instance()->CFG->organization->CNT_ISO) && $CNT_ISO == EE_Registry::instance()->CFG->organization->CNT_ISO) {
985
+			EE_Registry::instance()->CFG->currency = new EE_Currency_Config($CNT_ISO);
986
+			EE_Registry::instance()->CFG->update_espresso_config();
987
+		}
988
+		$this->_redirect_after_action($success, 'Countries', 'updated',
989
+			array('action' => 'country_settings', 'country' => $CNT_ISO));
990
+	}
991
+    
992
+    
993
+	/**
994
+	 *        form_form_field_label_wrap
995
+	 *
996
+	 * @access        public
997
+	 *
998
+	 * @param        string $label
999
+	 *
1000
+	 * @return        string
1001
+	 */
1002
+	public function country_form_field_label_wrap($label, $required_text)
1003
+	{
1004
+		return '
1005 1005
 			<tr>
1006 1006
 				<th>
1007 1007
 					' . $label . '
1008 1008
 				</th>';
1009
-    }
1010
-    
1011
-    
1012
-    /**
1013
-     *        form_form_field_input__wrap
1014
-     *
1015
-     * @access        public
1016
-     *
1017
-     * @param        string $label
1018
-     *
1019
-     * @return        string
1020
-     */
1021
-    public function country_form_field_input__wrap($input, $label)
1022
-    {
1023
-        return '
1009
+	}
1010
+    
1011
+    
1012
+	/**
1013
+	 *        form_form_field_input__wrap
1014
+	 *
1015
+	 * @access        public
1016
+	 *
1017
+	 * @param        string $label
1018
+	 *
1019
+	 * @return        string
1020
+	 */
1021
+	public function country_form_field_input__wrap($input, $label)
1022
+	{
1023
+		return '
1024 1024
 				<td class="general-settings-country-input-td">
1025 1025
 					' . $input . '
1026 1026
 				</td>
1027 1027
 			</tr>';
1028
-    }
1029
-    
1030
-    
1031
-    /**
1032
-     *        form_form_field_label_wrap
1033
-     *
1034
-     * @access        public
1035
-     *
1036
-     * @param        string $label
1037
-     * @param        string $required_text
1038
-     *
1039
-     * @return        string
1040
-     */
1041
-    public function state_form_field_label_wrap($label, $required_text)
1042
-    {
1043
-        return $required_text;
1044
-    }
1045
-    
1046
-    
1047
-    /**
1048
-     *        form_form_field_input__wrap
1049
-     *
1050
-     * @access        public
1051
-     *
1052
-     * @param        string $label
1053
-     *
1054
-     * @return        string
1055
-     */
1056
-    public function state_form_field_input__wrap($input, $label)
1057
-    {
1058
-        return '
1028
+	}
1029
+    
1030
+    
1031
+	/**
1032
+	 *        form_form_field_label_wrap
1033
+	 *
1034
+	 * @access        public
1035
+	 *
1036
+	 * @param        string $label
1037
+	 * @param        string $required_text
1038
+	 *
1039
+	 * @return        string
1040
+	 */
1041
+	public function state_form_field_label_wrap($label, $required_text)
1042
+	{
1043
+		return $required_text;
1044
+	}
1045
+    
1046
+    
1047
+	/**
1048
+	 *        form_form_field_input__wrap
1049
+	 *
1050
+	 * @access        public
1051
+	 *
1052
+	 * @param        string $label
1053
+	 *
1054
+	 * @return        string
1055
+	 */
1056
+	public function state_form_field_input__wrap($input, $label)
1057
+	{
1058
+		return '
1059 1059
 				<td class="general-settings-country-state-input-td">
1060 1060
 					' . $input . '
1061 1061
 				</td>';
1062 1062
         
1063
-    }
1063
+	}
1064 1064
     
1065 1065
     
1066 1066
     
1067 1067
     
1068 1068
     
1069 1069
     
1070
-    /***********/
1070
+	/***********/
1071 1071
     
1072 1072
     
1073
-    /**
1074
-     * displays edit and view links for critical EE pages
1075
-     *
1076
-     * @access public
1077
-     *
1078
-     * @param int $ee_page_id
1079
-     *
1080
-     * @return string
1081
-     */
1082
-    public static function edit_view_links($ee_page_id)
1083
-    {
1084
-        $links = '<a href="' . add_query_arg(array('post' => $ee_page_id, 'action' => 'edit'),
1085
-                admin_url('post.php')) . '" >' . __('Edit', 'event_espresso') . '</a>';
1086
-        $links .= ' &nbsp;|&nbsp; ';
1087
-        $links .= '<a href="' . get_permalink($ee_page_id) . '" >' . __('View', 'event_espresso') . '</a>';
1073
+	/**
1074
+	 * displays edit and view links for critical EE pages
1075
+	 *
1076
+	 * @access public
1077
+	 *
1078
+	 * @param int $ee_page_id
1079
+	 *
1080
+	 * @return string
1081
+	 */
1082
+	public static function edit_view_links($ee_page_id)
1083
+	{
1084
+		$links = '<a href="' . add_query_arg(array('post' => $ee_page_id, 'action' => 'edit'),
1085
+				admin_url('post.php')) . '" >' . __('Edit', 'event_espresso') . '</a>';
1086
+		$links .= ' &nbsp;|&nbsp; ';
1087
+		$links .= '<a href="' . get_permalink($ee_page_id) . '" >' . __('View', 'event_espresso') . '</a>';
1088 1088
         
1089
-        return $links;
1090
-    }
1091
-    
1092
-    
1093
-    /**
1094
-     * displays page and shortcode status for critical EE pages
1095
-     *
1096
-     * @param WP page object $ee_page
1097
-     *
1098
-     * @return string
1099
-     */
1100
-    public static function page_and_shortcode_status($ee_page, $shortcode)
1101
-    {
1089
+		return $links;
1090
+	}
1091
+    
1092
+    
1093
+	/**
1094
+	 * displays page and shortcode status for critical EE pages
1095
+	 *
1096
+	 * @param WP page object $ee_page
1097
+	 *
1098
+	 * @return string
1099
+	 */
1100
+	public static function page_and_shortcode_status($ee_page, $shortcode)
1101
+	{
1102 1102
         
1103
-        // page status
1104
-        if (isset($ee_page->post_status) && $ee_page->post_status == 'publish') {
1105
-            $pg_colour = 'green';
1106
-            $pg_status = sprintf(__('Page%sStatus%sOK', 'event_espresso'), '&nbsp;', '&nbsp;');
1107
-        } else {
1108
-            $pg_colour = 'red';
1109
-            $pg_status = sprintf(__('Page%sVisibility%sProblem', 'event_espresso'), '&nbsp;', '&nbsp;');
1110
-        }
1103
+		// page status
1104
+		if (isset($ee_page->post_status) && $ee_page->post_status == 'publish') {
1105
+			$pg_colour = 'green';
1106
+			$pg_status = sprintf(__('Page%sStatus%sOK', 'event_espresso'), '&nbsp;', '&nbsp;');
1107
+		} else {
1108
+			$pg_colour = 'red';
1109
+			$pg_status = sprintf(__('Page%sVisibility%sProblem', 'event_espresso'), '&nbsp;', '&nbsp;');
1110
+		}
1111 1111
         
1112
-        // shortcode status
1113
-        if (isset($ee_page->post_content) && strpos($ee_page->post_content, $shortcode) !== false) {
1114
-            $sc_colour = 'green';
1115
-            $sc_status = sprintf(__('Shortcode%sOK', 'event_espresso'), '&nbsp;');
1116
-        } else {
1117
-            $sc_colour = 'red';
1118
-            $sc_status = sprintf(__('Shortcode%sProblem', 'event_espresso'), '&nbsp;');
1119
-        }
1112
+		// shortcode status
1113
+		if (isset($ee_page->post_content) && strpos($ee_page->post_content, $shortcode) !== false) {
1114
+			$sc_colour = 'green';
1115
+			$sc_status = sprintf(__('Shortcode%sOK', 'event_espresso'), '&nbsp;');
1116
+		} else {
1117
+			$sc_colour = 'red';
1118
+			$sc_status = sprintf(__('Shortcode%sProblem', 'event_espresso'), '&nbsp;');
1119
+		}
1120 1120
         
1121
-        return '<span style="color:' . $pg_colour . '; margin-right:2em;"><strong>' . $pg_status . '</strong></span><span style="color:' . $sc_colour . '"><strong>' . $sc_status . '</strong></span>';
1121
+		return '<span style="color:' . $pg_colour . '; margin-right:2em;"><strong>' . $pg_status . '</strong></span><span style="color:' . $sc_colour . '"><strong>' . $sc_status . '</strong></span>';
1122 1122
         
1123
-    }
1124
-    
1125
-    
1126
-    /**
1127
-     * generates a dropdown of all parent pages - copied from WP core
1128
-     *
1129
-     * @param unknown_type $default
1130
-     * @param unknown_type $parent
1131
-     * @param unknown_type $level
1132
-     *
1133
-     * @return unknown
1134
-     */
1135
-    public static function page_settings_dropdown($default = 0, $parent = 0, $level = 0)
1136
-    {
1137
-        global $wpdb;
1138
-        $items = $wpdb->get_results($wpdb->prepare("SELECT ID, post_parent, post_title FROM $wpdb->posts WHERE post_parent = %d AND post_type = 'page' AND post_status != 'trash' ORDER BY menu_order",
1139
-            $parent));
1123
+	}
1124
+    
1125
+    
1126
+	/**
1127
+	 * generates a dropdown of all parent pages - copied from WP core
1128
+	 *
1129
+	 * @param unknown_type $default
1130
+	 * @param unknown_type $parent
1131
+	 * @param unknown_type $level
1132
+	 *
1133
+	 * @return unknown
1134
+	 */
1135
+	public static function page_settings_dropdown($default = 0, $parent = 0, $level = 0)
1136
+	{
1137
+		global $wpdb;
1138
+		$items = $wpdb->get_results($wpdb->prepare("SELECT ID, post_parent, post_title FROM $wpdb->posts WHERE post_parent = %d AND post_type = 'page' AND post_status != 'trash' ORDER BY menu_order",
1139
+			$parent));
1140 1140
         
1141
-        if ($items) {
1142
-            foreach ($items as $item) {
1143
-                $pad = str_repeat('&nbsp;', $level * 3);
1144
-                if ($item->ID == $default) {
1145
-                    $current = ' selected="selected"';
1146
-                } else {
1147
-                    $current = '';
1148
-                }
1141
+		if ($items) {
1142
+			foreach ($items as $item) {
1143
+				$pad = str_repeat('&nbsp;', $level * 3);
1144
+				if ($item->ID == $default) {
1145
+					$current = ' selected="selected"';
1146
+				} else {
1147
+					$current = '';
1148
+				}
1149 1149
                 
1150
-                echo "\n\t<option class='level-$level' value='$item->ID'$current>$pad " . esc_html($item->post_title) . "</option>";
1151
-                parent_dropdown($default, $item->ID, $level + 1);
1152
-            }
1153
-        } else {
1154
-            return false;
1155
-        }
1156
-    }
1150
+				echo "\n\t<option class='level-$level' value='$item->ID'$current>$pad " . esc_html($item->post_title) . "</option>";
1151
+				parent_dropdown($default, $item->ID, $level + 1);
1152
+			}
1153
+		} else {
1154
+			return false;
1155
+		}
1156
+	}
1157 1157
     
1158 1158
     
1159 1159
 } //ends Forms_Admin_Page class
Please login to merge, or discard this patch.