Completed
Branch FET-10586-integer-input (c3d121)
by
unknown
95:24 queued 84:35
created
core/libraries/messages/messenger/EE_Html_messenger.class.php 1 patch
Spacing   +62 added lines, -62 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
3
-	exit( 'NO direct script access allowed' );
2
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
3
+	exit('NO direct script access allowed');
4 4
 }
5 5
 
6 6
 
@@ -43,16 +43,16 @@  discard block
 block discarded – undo
43 43
 	public function __construct() {
44 44
 		//set properties
45 45
 		$this->name = 'html';
46
-		$this->description = __( 'This messenger outputs a message to a browser for display.', 'event_espresso' );
46
+		$this->description = __('This messenger outputs a message to a browser for display.', 'event_espresso');
47 47
 		$this->label = array(
48
-			'singular' => __( 'html', 'event_espresso' ),
49
-			'plural'   => __( 'html', 'event_espresso' ),
48
+			'singular' => __('html', 'event_espresso'),
49
+			'plural'   => __('html', 'event_espresso'),
50 50
 		);
51 51
 		$this->activate_on_install = true;
52 52
 		// add the "powered by EE" credit link to the HTML receipt and invoice
53 53
 		add_filter(
54 54
 			'FHEE__EE_Html_messenger___send_message__main_body',
55
-			array( $this, 'add_powered_by_credit_link_to_receipt_and_invoice' ),
55
+			array($this, 'add_powered_by_credit_link_to_receipt_and_invoice'),
56 56
 			10,
57 57
 			3
58 58
 		);
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 	 * @see abstract declaration in EE_messenger for details.
92 92
 	 */
93 93
 	protected function _set_admin_pages() {
94
-		$this->admin_registered_pages = array( 'events_edit' => true );
94
+		$this->admin_registered_pages = array('events_edit' => true);
95 95
 	}
96 96
 
97 97
 
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 	protected function _set_validator_config() {
112 112
 		$this->_validator_config = array(
113 113
 			'subject'                       => array(
114
-				'shortcodes' => array( 'organization', 'primary_registration_details', 'email', 'transaction' ),
114
+				'shortcodes' => array('organization', 'primary_registration_details', 'email', 'transaction'),
115 115
 			),
116 116
 			'content'                       => array(
117 117
 				'shortcodes' => array(
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
 					'primary_registration_list',
138 138
 					'event_author',
139 139
 				),
140
-				'required'   => array( '[EVENT_LIST]' ),
140
+				'required'   => array('[EVENT_LIST]'),
141 141
 			),
142 142
 			'ticket_list'                   => array(
143 143
 				'shortcodes' => array(
@@ -148,39 +148,39 @@  discard block
 block discarded – undo
148 148
 					'line_item_list',
149 149
 					'venue',
150 150
 				),
151
-				'required'   => array( '[TICKET_LIST]' ),
151
+				'required'   => array('[TICKET_LIST]'),
152 152
 			),
153 153
 			'ticket_line_item_no_pms'       => array(
154
-				'shortcodes' => array( 'line_item', 'ticket' ),
155
-				'required'   => array( '[TICKET_LINE_ITEM_LIST]' ),
154
+				'shortcodes' => array('line_item', 'ticket'),
155
+				'required'   => array('[TICKET_LINE_ITEM_LIST]'),
156 156
 			),
157 157
 			'ticket_line_item_pms'          => array(
158
-				'shortcodes' => array( 'line_item', 'ticket', 'line_item_list' ),
159
-				'required'   => array( '[TICKET_LINE_ITEM_LIST]' ),
158
+				'shortcodes' => array('line_item', 'ticket', 'line_item_list'),
159
+				'required'   => array('[TICKET_LINE_ITEM_LIST]'),
160 160
 			),
161 161
 			'price_modifier_line_item_list' => array(
162
-				'shortcodes' => array( 'line_item' ),
163
-				'required'   => array( '[PRICE_MODIFIER_LINE_ITEM_LIST]' ),
162
+				'shortcodes' => array('line_item'),
163
+				'required'   => array('[PRICE_MODIFIER_LINE_ITEM_LIST]'),
164 164
 			),
165 165
 			'datetime_list'                 => array(
166
-				'shortcodes' => array( 'datetime' ),
167
-				'required'   => array( '[DATETIME_LIST]' ),
166
+				'shortcodes' => array('datetime'),
167
+				'required'   => array('[DATETIME_LIST]'),
168 168
 			),
169 169
 			'attendee_list'                 => array(
170
-				'shortcodes' => array( 'attendee' ),
171
-				'required'   => array( '[ATTENDEE_LIST]' ),
170
+				'shortcodes' => array('attendee'),
171
+				'required'   => array('[ATTENDEE_LIST]'),
172 172
 			),
173 173
 			'tax_line_item_list'            => array(
174
-				'shortcodes' => array( 'line_item' ),
175
-				'required'   => array( '[TAX_LINE_ITEM_LIST]' ),
174
+				'shortcodes' => array('line_item'),
175
+				'required'   => array('[TAX_LINE_ITEM_LIST]'),
176 176
 			),
177 177
 			'additional_line_item_list'     => array(
178
-				'shortcodes' => array( 'line_item' ),
179
-				'required'   => array( '[ADDITIONAL_LINE_ITEM_LIST]' ),
178
+				'shortcodes' => array('line_item'),
179
+				'required'   => array('[ADDITIONAL_LINE_ITEM_LIST]'),
180 180
 			),
181 181
 			'payment_list'                  => array(
182
-				'shortcodes' => array( 'payment' ),
183
-				'required'   => array( '[PAYMENT_LIST_*]' ),
182
+				'shortcodes' => array('payment'),
183
+				'required'   => array('[PAYMENT_LIST_*]'),
184 184
 			),
185 185
 		);
186 186
 	}
@@ -196,9 +196,9 @@  discard block
 block discarded – undo
196 196
 	 * @param string $sending_messenger_name the name of the sending messenger so we only set the hooks needed.
197 197
 	 * @return void
198 198
 	 */
199
-	public function do_secondary_messenger_hooks( $sending_messenger_name ) {
200
-		if ( $sending_messenger_name = 'pdf' ) {
201
-			add_filter( 'EE_messenger__get_variation__variation', array( $this, 'add_html_css' ), 10, 8 );
199
+	public function do_secondary_messenger_hooks($sending_messenger_name) {
200
+		if ($sending_messenger_name = 'pdf') {
201
+			add_filter('EE_messenger__get_variation__variation', array($this, 'add_html_css'), 10, 8);
202 202
 		}
203 203
 	}
204 204
 
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
 	 */
248 248
 	public function enqueue_scripts_styles() {
249 249
 		parent::enqueue_scripts_styles();
250
-		do_action( 'AHEE__EE_Html_messenger__enqueue_scripts_styles' );
250
+		do_action('AHEE__EE_Html_messenger__enqueue_scripts_styles');
251 251
 	}
252 252
 
253 253
 
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
 		$this->_template_fields = array(
276 276
 			'subject' => array(
277 277
 				'input'      => 'text',
278
-				'label'      => __( 'Page Title', 'event_espresso' ),
278
+				'label'      => __('Page Title', 'event_espresso'),
279 279
 				'type'       => 'string',
280 280
 				'required'   => true,
281 281
 				'validation' => true,
@@ -288,7 +288,7 @@  discard block
 block discarded – undo
288 288
 				'content' => array(
289 289
 					'main'                          => array(
290 290
 						'input'      => 'wp_editor',
291
-						'label'      => __( 'Main Content', 'event_espresso' ),
291
+						'label'      => __('Main Content', 'event_espresso'),
292 292
 						'type'       => 'string',
293 293
 						'required'   => true,
294 294
 						'validation' => true,
@@ -303,7 +303,7 @@  discard block
 block discarded – undo
303 303
 						'validation'          => true,
304 304
 						'format'              => '%s',
305 305
 						'rows'                => '15',
306
-						'shortcodes_required' => array( '[EVENT_LIST]' ),
306
+						'shortcodes_required' => array('[EVENT_LIST]'),
307 307
 					),
308 308
 					'ticket_list'                   => array(
309 309
 						'input'               => 'textarea',
@@ -314,11 +314,11 @@  discard block
 block discarded – undo
314 314
 						'format'              => '%s',
315 315
 						'css_class'           => 'large-text',
316 316
 						'rows'                => '10',
317
-						'shortcodes_required' => array( '[TICKET_LIST]' ),
317
+						'shortcodes_required' => array('[TICKET_LIST]'),
318 318
 					),
319 319
 					'ticket_line_item_no_pms'       => array(
320 320
 						'input'               => 'textarea',
321
-						'label'               => '[TICKET_LINE_ITEM_LIST] <br>' . __(
321
+						'label'               => '[TICKET_LINE_ITEM_LIST] <br>'.__(
322 322
 								'Ticket Line Item List with no Price Modifiers',
323 323
 								'event_espresso'
324 324
 							),
@@ -328,11 +328,11 @@  discard block
 block discarded – undo
328 328
 						'format'              => '%s',
329 329
 						'css_class'           => 'large-text',
330 330
 						'rows'                => '5',
331
-						'shortcodes_required' => array( '[TICKET_LINE_ITEM_LIST]' ),
331
+						'shortcodes_required' => array('[TICKET_LINE_ITEM_LIST]'),
332 332
 					),
333 333
 					'ticket_line_item_pms'          => array(
334 334
 						'input'               => 'textarea',
335
-						'label'               => '[TICKET_LINE_ITEM_LIST] <br>' . __(
335
+						'label'               => '[TICKET_LINE_ITEM_LIST] <br>'.__(
336 336
 								'Ticket Line Item List with Price Modifiers',
337 337
 								'event_espresso'
338 338
 							),
@@ -342,7 +342,7 @@  discard block
 block discarded – undo
342 342
 						'format'              => '%s',
343 343
 						'css_class'           => 'large-text',
344 344
 						'rows'                => '5',
345
-						'shortcodes_required' => array( '[TICKET_LINE_ITEM_LIST]' ),
345
+						'shortcodes_required' => array('[TICKET_LINE_ITEM_LIST]'),
346 346
 					),
347 347
 					'price_modifier_line_item_list' => array(
348 348
 						'input'               => 'textarea',
@@ -353,7 +353,7 @@  discard block
 block discarded – undo
353 353
 						'format'              => '%s',
354 354
 						'css_class'           => 'large-text',
355 355
 						'rows'                => '5',
356
-						'shortcodes_required' => array( '[PRICE_MODIFIER_LINE_ITEM_LIST]' ),
356
+						'shortcodes_required' => array('[PRICE_MODIFIER_LINE_ITEM_LIST]'),
357 357
 					),
358 358
 					'datetime_list'                 => array(
359 359
 						'input'               => 'textarea',
@@ -364,7 +364,7 @@  discard block
 block discarded – undo
364 364
 						'format'              => '%s',
365 365
 						'css_class'           => 'large-text',
366 366
 						'rows'                => '5',
367
-						'shortcodes_required' => array( '[DATETIME_LIST]' ),
367
+						'shortcodes_required' => array('[DATETIME_LIST]'),
368 368
 					),
369 369
 					'attendee_list'                 => array(
370 370
 						'input'               => 'textarea',
@@ -375,7 +375,7 @@  discard block
 block discarded – undo
375 375
 						'format'              => '%s',
376 376
 						'css_class'           => 'large-text',
377 377
 						'rows'                => '5',
378
-						'shortcodes_required' => array( '[ATTENDEE_LIST]' ),
378
+						'shortcodes_required' => array('[ATTENDEE_LIST]'),
379 379
 					),
380 380
 					'tax_line_item_list'            => array(
381 381
 						'input'               => 'textarea',
@@ -386,7 +386,7 @@  discard block
 block discarded – undo
386 386
 						'format'              => '%s',
387 387
 						'css_class'           => 'large-text',
388 388
 						'rows'                => '5',
389
-						'shortcodes_required' => array( '[TAX_LINE_ITEM_LIST]' ),
389
+						'shortcodes_required' => array('[TAX_LINE_ITEM_LIST]'),
390 390
 					),
391 391
 					'additional_line_item_list'     => array(
392 392
 						'input'               => 'textarea',
@@ -397,7 +397,7 @@  discard block
 block discarded – undo
397 397
 						'format'              => '%s',
398 398
 						'css_class'           => 'large-text',
399 399
 						'rows'                => '5',
400
-						'shortcodes_required' => array( '[ADDITIONAL_LINE_ITEM_LIST]' ),
400
+						'shortcodes_required' => array('[ADDITIONAL_LINE_ITEM_LIST]'),
401 401
 					),
402 402
 					'payment_list'                  => array(
403 403
 						'input'               => 'textarea',
@@ -408,7 +408,7 @@  discard block
 block discarded – undo
408 408
 						'format'              => '%s',
409 409
 						'css_class'           => 'large-text',
410 410
 						'rows'                => '5',
411
-						'shortcodes_required' => array( '[PAYMENT_LIST_*]' ),
411
+						'shortcodes_required' => array('[PAYMENT_LIST_*]'),
412 412
 					),
413 413
 				),
414 414
 			),
@@ -422,7 +422,7 @@  discard block
 block discarded – undo
422 422
 	 * @since 4.5.0
423 423
 	 */
424 424
 	protected function _set_default_message_types() {
425
-		$this->_default_message_types = array( 'receipt', 'invoice' );
425
+		$this->_default_message_types = array('receipt', 'invoice');
426 426
 	}
427 427
 
428 428
 
@@ -432,7 +432,7 @@  discard block
 block discarded – undo
432 432
 	 * @since 4.5.0
433 433
 	 */
434 434
 	protected function _set_valid_message_types() {
435
-		$this->_valid_message_types = array( 'receipt', 'invoice' );
435
+		$this->_valid_message_types = array('receipt', 'invoice');
436 436
 	}
437 437
 
438 438
 
@@ -445,7 +445,7 @@  discard block
 block discarded – undo
445 445
 	 */
446 446
 	protected function _send_message() {
447 447
 		$this->_template_args = array(
448
-			'page_title' => html_entity_decode( stripslashes( $this->_subject ), ENT_QUOTES, "UTF-8" ),
448
+			'page_title' => html_entity_decode(stripslashes($this->_subject), ENT_QUOTES, "UTF-8"),
449 449
 			'base_css'   => $this->get_variation(
450 450
 				$this->_tmp_pack,
451 451
 				$this->_incoming_message_type->name,
@@ -483,7 +483,7 @@  discard block
 block discarded – undo
483 483
 			),
484 484
 		);
485 485
 		$this->_deregister_wp_hooks();
486
-		add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts_styles' ) );
486
+		add_action('wp_enqueue_scripts', array($this, 'enqueue_scripts_styles'));
487 487
 		echo $this->_get_main_template();
488 488
 		exit();
489 489
 	}
@@ -499,16 +499,16 @@  discard block
 block discarded – undo
499 499
 	 * @return void
500 500
 	 */
501 501
 	protected function _deregister_wp_hooks() {
502
-		remove_all_actions( 'wp_head' );
503
-		remove_all_actions( 'wp_footer' );
504
-		remove_all_actions( 'wp_print_footer_scripts' );
505
-		remove_all_actions( 'wp_enqueue_scripts' );
502
+		remove_all_actions('wp_head');
503
+		remove_all_actions('wp_footer');
504
+		remove_all_actions('wp_print_footer_scripts');
505
+		remove_all_actions('wp_enqueue_scripts');
506 506
 		global $wp_scripts, $wp_styles;
507 507
 		$wp_scripts = $wp_styles = array();
508 508
 		//just add back in wp_enqueue_scripts and wp_print_footer_scripts cause that's all we want to load.
509
-		add_action( 'wp_footer', 'wp_print_footer_scripts' );
510
-		add_action( 'wp_print_footer_scripts', '_wp_footer_scripts' );
511
-		add_action( 'wp_head', 'wp_enqueue_scripts' );
509
+		add_action('wp_footer', 'wp_print_footer_scripts');
510
+		add_action('wp_print_footer_scripts', '_wp_footer_scripts');
511
+		add_action('wp_head', 'wp_enqueue_scripts');
512 512
 	}
513 513
 
514 514
 
@@ -520,11 +520,11 @@  discard block
 block discarded – undo
520 520
 	 * @param bool $preview
521 521
 	 * @return string
522 522
 	 */
523
-	protected function _get_main_template( $preview = false ) {
524
-		$wrapper_template = $this->_tmp_pack->get_wrapper( $this->name, 'main' );
523
+	protected function _get_main_template($preview = false) {
524
+		$wrapper_template = $this->_tmp_pack->get_wrapper($this->name, 'main');
525 525
 		//include message type as a template arg
526 526
 		$this->_template_args['message_type'] = $this->_incoming_message_type;
527
-		return EEH_Template::display_template( $wrapper_template, $this->_template_args, true );
527
+		return EEH_Template::display_template($wrapper_template, $this->_template_args, true);
528 528
 	}
529 529
 
530 530
 
@@ -557,15 +557,15 @@  discard block
 block discarded – undo
557 557
 		EE_message_type $incoming_message_type
558 558
 	) {
559 559
 		if (
560
-			( $incoming_message_type->name === 'invoice' || $incoming_message_type->name === 'receipt' )
561
-			&& apply_filters( 'FHEE_EE_Html_messenger__add_powered_by_credit_link_to_receipt_and_invoice', true )
560
+			($incoming_message_type->name === 'invoice' || $incoming_message_type->name === 'receipt')
561
+			&& apply_filters('FHEE_EE_Html_messenger__add_powered_by_credit_link_to_receipt_and_invoice', true)
562 562
 		) {
563 563
 			$content .= \EEH_Template::powered_by_event_espresso(
564 564
 				'aln-cntr',
565 565
 				'',
566
-				array( 'utm_content' => 'messages_system' )
566
+				array('utm_content' => 'messages_system')
567 567
 			)
568
-			. EEH_HTML::div( EEH_HTML::p('&nbsp;') );
568
+			. EEH_HTML::div(EEH_HTML::p('&nbsp;'));
569 569
 		}
570 570
 		return $content;
571 571
 	}
Please login to merge, or discard this patch.
modules/ticket_selector/TicketSelectorIframeEmbedButton.php 2 patches
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -17,27 +17,27 @@
 block discarded – undo
17 17
 class TicketSelectorIframeEmbedButton extends IframeEmbedButton
18 18
 {
19 19
 
20
-    /**
21
-     * TicketSelectorIframeEmbedButton constructor.
22
-     */
23
-    public function __construct()
24
-    {
25
-        parent::__construct(
26
-            esc_html__( 'Ticket Selector', 'event_espresso' ),
27
-            'ticket_selector'
28
-        );
29
-    }
30
-
31
-
32
-
33
-    /**
34
-     * Adds an iframe embed code button to the Event editor.
35
-     */
36
-    public function addEventEditorIframeEmbedButton()
37
-    {
38
-        // add button for iframe code to event editor.
39
-        $this->addEventEditorIframeEmbedButtonFilter();
40
-    }
20
+	/**
21
+	 * TicketSelectorIframeEmbedButton constructor.
22
+	 */
23
+	public function __construct()
24
+	{
25
+		parent::__construct(
26
+			esc_html__( 'Ticket Selector', 'event_espresso' ),
27
+			'ticket_selector'
28
+		);
29
+	}
30
+
31
+
32
+
33
+	/**
34
+	 * Adds an iframe embed code button to the Event editor.
35
+	 */
36
+	public function addEventEditorIframeEmbedButton()
37
+	{
38
+		// add button for iframe code to event editor.
39
+		$this->addEventEditorIframeEmbedButtonFilter();
40
+	}
41 41
 
42 42
 
43 43
 
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@  discard block
 block discarded – undo
3 3
 
4 4
 use EventEspresso\core\libraries\iframe_display\IframeEmbedButton;
5 5
 
6
-defined( 'ABSPATH' ) || exit;
6
+defined('ABSPATH') || exit;
7 7
 
8 8
 
9 9
 
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
     public function __construct()
24 24
     {
25 25
         parent::__construct(
26
-            esc_html__( 'Ticket Selector', 'event_espresso' ),
26
+            esc_html__('Ticket Selector', 'event_espresso'),
27 27
             'ticket_selector'
28 28
         );
29 29
     }
Please login to merge, or discard this patch.
core/Factory.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -3,8 +3,8 @@  discard block
 block discarded – undo
3 3
 
4 4
 use EventEspresso\core\libraries\iframe_display\Iframe;
5 5
 
6
-if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
7
-	exit( 'No direct script access allowed' );
6
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
7
+	exit('No direct script access allowed');
8 8
 }
9 9
 
10 10
 
@@ -26,10 +26,10 @@  discard block
 block discarded – undo
26 26
 	 * @return mixed|null
27 27
 	 * @throws \EE_Error
28 28
 	 */
29
-	public static function create( $class_name, $arguments = array() ) {
30
-		if ( empty( $class_name ) ) {
29
+	public static function create($class_name, $arguments = array()) {
30
+		if (empty($class_name)) {
31 31
 			throw new \EE_Error(
32
-				__( 'You must provide a class name in order to instantiate it.', 'event_espresso' )
32
+				__('You must provide a class name in order to instantiate it.', 'event_espresso')
33 33
 			);
34 34
 		}
35 35
 		// if ( ! class_exists( $class_name ) ) {
@@ -41,20 +41,20 @@  discard block
 block discarded – undo
41 41
 		// 	);
42 42
 		// }
43 43
 		$object = null;
44
-		switch ( $class_name ) {
44
+		switch ($class_name) {
45 45
 
46 46
 			case 'EE_Request' :
47
-				$object = new \EE_Request( $_GET, $_POST, $_COOKIE );
47
+				$object = new \EE_Request($_GET, $_POST, $_COOKIE);
48 48
 				break;
49 49
 
50 50
 			case 'Iframe' :
51
-				$title = isset( $arguments['title'] ) ? $arguments['title'] : null;
52
-				$content = isset( $arguments['content'] ) ? $arguments['content'] : null;
53
-				$object = new Iframe( $title, $content );
51
+				$title = isset($arguments['title']) ? $arguments['title'] : null;
52
+				$content = isset($arguments['content']) ? $arguments['content'] : null;
53
+				$object = new Iframe($title, $content);
54 54
 				break;
55 55
 
56 56
 			default :
57
-				$object = new $class_name( $arguments );
57
+				$object = new $class_name($arguments);
58 58
 
59 59
 		}
60 60
 
Please login to merge, or discard this patch.
messages/message_type/newsletter/EE_Newsletter_message_type.class.php 2 patches
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -22,10 +22,10 @@  discard block
 block discarded – undo
22 22
 
23 23
 	public function __construct() {
24 24
 		$this->name = 'newsletter';
25
-		$this->description = __( 'Batch message type messages are triggered manually by the admin for sending notifications to a selected group of recipients. This should only be used for more general notification type messages that contain information specific for the recipients. For "newsletter" type messages we recommend using an email list service like MailChimp, because sending non-related mail-outs to contacts increases the risk of your site domain getting added to spam lists, which will prevent messages getting to users.', 'event_espresso' );
25
+		$this->description = __('Batch message type messages are triggered manually by the admin for sending notifications to a selected group of recipients. This should only be used for more general notification type messages that contain information specific for the recipients. For "newsletter" type messages we recommend using an email list service like MailChimp, because sending non-related mail-outs to contacts increases the risk of your site domain getting added to spam lists, which will prevent messages getting to users.', 'event_espresso');
26 26
 		$this->label = array(
27
-			'singular' => __( 'batch', 'event_espresso' ),
28
-			'plural' => __( 'batches', 'event_espresso' )
27
+			'singular' => __('batch', 'event_espresso'),
28
+			'plural' => __('batches', 'event_espresso')
29 29
 			);
30 30
 		$this->_master_templates = array(
31 31
 			'email' => 'registration',
@@ -49,9 +49,9 @@  discard block
 block discarded – undo
49 49
 
50 50
 
51 51
 
52
-	protected function _get_data_for_context( $context, EE_Registration $registration, $id ) {
52
+	protected function _get_data_for_context($context, EE_Registration $registration, $id) {
53 53
 		//newsletter message type data handler is 'Registrations' and it expects an array of EE_Registration objects.
54
-		return array( $registration );
54
+		return array($registration);
55 55
 	}
56 56
 
57 57
 
@@ -64,15 +64,15 @@  discard block
 block discarded – undo
64 64
 
65 65
 	protected function _set_contexts() {
66 66
 		$this->_context_label = array(
67
-			'label' => __( 'recipient', 'event_espresso' ),
68
-			'plural' => __( 'recipients', 'event_espresso' ),
69
-			'description' => __( 'Recipient\'s are who will receive the message.', 'event_espresso' )
67
+			'label' => __('recipient', 'event_espresso'),
68
+			'plural' => __('recipients', 'event_espresso'),
69
+			'description' => __('Recipient\'s are who will receive the message.', 'event_espresso')
70 70
 			);
71 71
 
72 72
 		$this->_contexts = array(
73 73
 			'attendee' => array(
74
-				'label' => __( 'Registrant', 'event_espresso' ),
75
-				'description' => __( 'This template goes to selected registrants.', 'event_espresso' )
74
+				'label' => __('Registrant', 'event_espresso'),
75
+				'description' => __('This template goes to selected registrants.', 'event_espresso')
76 76
 				)
77 77
 			);
78 78
 	}
@@ -98,13 +98,13 @@  discard block
 block discarded – undo
98 98
 			'newsletter',
99 99
 			);
100 100
 
101
-		foreach ( $this->_valid_shortcodes as $context => $shortcodes ) {
102
-			foreach ( $shortcodes as $key => $shortcode ) {
103
-				if ( ! in_array( $shortcode, $included_shortcodes ) ) {
104
-					unset( $this->_valid_shortcodes[ $context ][ $key ] );
101
+		foreach ($this->_valid_shortcodes as $context => $shortcodes) {
102
+			foreach ($shortcodes as $key => $shortcode) {
103
+				if ( ! in_array($shortcode, $included_shortcodes)) {
104
+					unset($this->_valid_shortcodes[$context][$key]);
105 105
 				}
106 106
 			}
107
-			$this->_valid_shortcodes[ $context ][] = 'newsletter';
107
+			$this->_valid_shortcodes[$context][] = 'newsletter';
108 108
 		}
109 109
 
110 110
 	}
@@ -118,44 +118,44 @@  discard block
 block discarded – undo
118 118
 		$addressee = array();
119 119
 
120 120
 		//looping through registrations
121
-		foreach ( $this->_data->registrations as $reg_id => $details ) {
121
+		foreach ($this->_data->registrations as $reg_id => $details) {
122 122
 			//set $attendee array to blank on each loop
123 123
 			$aee = array();
124 124
 
125 125
 			//need to get the attendee from this registration.
126
-			$attendee = isset( $details['att_obj'] ) && $details['att_obj'] instanceof EE_Attendee
126
+			$attendee = isset($details['att_obj']) && $details['att_obj'] instanceof EE_Attendee
127 127
 				? $details['att_obj']
128 128
 				: null;
129 129
 
130
-			if ( ! $attendee instanceof EE_Attendee ) {
130
+			if ( ! $attendee instanceof EE_Attendee) {
131 131
 				continue;
132 132
 			}
133 133
 
134 134
 			//set $aee from attendee object
135 135
 			$aee['att_obj'] = $attendee;
136
-			$aee['reg_objs'] = isset( $this->_data->attendees[ $attendee->ID() ]['reg_objs'] )
137
-				? $this->_data->attendees[ $attendee->ID() ]['reg_objs']
136
+			$aee['reg_objs'] = isset($this->_data->attendees[$attendee->ID()]['reg_objs'])
137
+				? $this->_data->attendees[$attendee->ID()]['reg_objs']
138 138
 				: array();
139 139
 			$aee['attendee_email'] = $attendee->email();
140
-			$aee['tkt_objs'] = isset( $this->_data->attendees[ $attendee->ID() ]['tkt_objs'] )
141
-				? $this->_data->attendees[ $attendee->ID() ]['tkt_objs']
140
+			$aee['tkt_objs'] = isset($this->_data->attendees[$attendee->ID()]['tkt_objs'])
141
+				? $this->_data->attendees[$attendee->ID()]['tkt_objs']
142 142
 				: array();
143 143
 
144
-			if ( isset( $this->_data->attendees[ $attendee->ID() ]['evt_objs'] ) ) {
145
-				$aee['evt_objs'] = $this->_data->attendees[ $attendee->ID() ]['evt_objs'];
146
-				$aee['events'] = $this->_data->attendees[ $attendee->ID() ]['evt_objs'];
144
+			if (isset($this->_data->attendees[$attendee->ID()]['evt_objs'])) {
145
+				$aee['evt_objs'] = $this->_data->attendees[$attendee->ID()]['evt_objs'];
146
+				$aee['events'] = $this->_data->attendees[$attendee->ID()]['evt_objs'];
147 147
 			} else {
148 148
 				$aee['evt_objs'] = $aee['events'] = array();
149 149
 			}
150 150
 
151
-			$aee['reg_obj'] = isset( $details['reg_obj'] )
151
+			$aee['reg_obj'] = isset($details['reg_obj'])
152 152
 				? $details['reg_obj']
153 153
 				: null;
154 154
 			$aee['attendees'] = $this->_data->attendees;
155 155
 
156 156
 			//merge in the primary attendee data
157
-			$aee = array_merge( $this->_default_addressee_data, $aee );
158
-			$addressee[] = new EE_Messages_Addressee( $aee );
157
+			$aee = array_merge($this->_default_addressee_data, $aee);
158
+			$addressee[] = new EE_Messages_Addressee($aee);
159 159
 		}
160 160
 		return $addressee;
161 161
 	}
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -5,7 +5,9 @@
 block discarded – undo
5 5
  * @subpackage helpers
6 6
  * @since           4.3.0
7 7
  */
8
-if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
8
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
9
+	exit('No direct script access allowed');
10
+}
9 11
 
10 12
 /**
11 13
  * The message type for newsletter type of messages.
Please login to merge, or discard this patch.
payment_methods/Paypal_Standard/EEG_Paypal_Standard.gateway.php 2 patches
Indentation   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -274,26 +274,26 @@  discard block
 block discarded – undo
274 274
 		if ( ! $this->validate_ipn( $update_info, $payment ) ) {
275 275
 			return $payment;
276 276
 		}
277
-        // kill request here if this is a refund, we don't support them yet (we'd need to adjust the transaction,
278
-        // registrations, ticket counts, etc)
279
-        if (
280
-            (
281
-                $update_info[ 'payment_status' ] === 'Refunded'
282
-                || $update_info[ 'payment_status' ] === 'Partially_Refunded'
283
-            )
284
-            && apply_filters( 'FHEE__EEG_Paypal_Standard__handle_payment_update__kill_refund_request', true )
285
-        ) {
286
-            throw new EventEspresso\core\exceptions\IpnException(
287
-                sprintf(
288
-                    esc_html__( 'Event Espresso does not yet support %1$s IPNs from PayPal', 'event_espresso'),
289
-                    $update_info['payment_status']
290
-                ),
291
-                EventEspresso\core\exceptions\IpnException::UNSUPPORTED,
292
-                null,
293
-                $payment,
294
-                $update_info
295
-            );
296
-        }
277
+		// kill request here if this is a refund, we don't support them yet (we'd need to adjust the transaction,
278
+		// registrations, ticket counts, etc)
279
+		if (
280
+			(
281
+				$update_info[ 'payment_status' ] === 'Refunded'
282
+				|| $update_info[ 'payment_status' ] === 'Partially_Refunded'
283
+			)
284
+			&& apply_filters( 'FHEE__EEG_Paypal_Standard__handle_payment_update__kill_refund_request', true )
285
+		) {
286
+			throw new EventEspresso\core\exceptions\IpnException(
287
+				sprintf(
288
+					esc_html__( 'Event Espresso does not yet support %1$s IPNs from PayPal', 'event_espresso'),
289
+					$update_info['payment_status']
290
+				),
291
+				EventEspresso\core\exceptions\IpnException::UNSUPPORTED,
292
+				null,
293
+				$payment,
294
+				$update_info
295
+			);
296
+		}
297 297
 		//ok, well let's process this payment then!
298 298
 		switch ( $update_info[ 'payment_status' ] ) {
299 299
 
@@ -541,17 +541,17 @@  discard block
 block discarded – undo
541 541
 
542 542
 		//might paypal have changed the taxes?
543 543
 		if( $this->_paypal_taxes && $payment_was_itemized ) {
544
-            // note that we're doing this BEFORE adding shipping;
544
+			// note that we're doing this BEFORE adding shipping;
545 545
 			// we actually want PayPal's shipping to remain non-taxable
546
-            $this->_line_item->set_line_items_taxable( $transaction_total_line_item, true, 'paypal_shipping' );
547
-            $this->_line_item->set_total_tax_to(
548
-	            $transaction_total_line_item,
549
-                (float)$update_info['tax'],
550
-                esc_html__( 'Taxes', 'event_espresso' ),
551
-                esc_html__( 'Calculated by Paypal', 'event_espresso' ),
552
-                'paypal_tax'
553
-            );
554
-            $grand_total_needs_resaving = TRUE;
546
+			$this->_line_item->set_line_items_taxable( $transaction_total_line_item, true, 'paypal_shipping' );
547
+			$this->_line_item->set_total_tax_to(
548
+				$transaction_total_line_item,
549
+				(float)$update_info['tax'],
550
+				esc_html__( 'Taxes', 'event_espresso' ),
551
+				esc_html__( 'Calculated by Paypal', 'event_espresso' ),
552
+				'paypal_tax'
553
+			);
554
+			$grand_total_needs_resaving = TRUE;
555 555
 		}
556 556
 
557 557
 		$shipping_amount = (float)$update_info[ 'mc_shipping' ];
Please login to merge, or discard this patch.
Spacing   +122 added lines, -122 removed lines patch added patch discarded remove patch
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 	 * @return EEG_Paypal_Standard
71 71
 	 */
72 72
 	public function __construct() {
73
-		$this->set_uses_separate_IPN_request( true ) ;
73
+		$this->set_uses_separate_IPN_request(true);
74 74
 		parent::__construct();
75 75
 	}
76 76
 
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 	 * Also sets the gateway url class variable based on whether debug mode is enabled or not
81 81
 	 * @param array $settings_array
82 82
 	 */
83
-	public function set_settings($settings_array){
83
+	public function set_settings($settings_array) {
84 84
 		parent::set_settings($settings_array);
85 85
 		$this->_gateway_url = $this->_debug_mode
86 86
 			? 'https://www.sandbox.paypal.com/cgi-bin/webscr'
@@ -114,42 +114,42 @@  discard block
 block discarded – undo
114 114
 
115 115
 		$total_discounts_to_cart_total = $transaction->paid();
116 116
 		//only itemize the order if we're paying for the rest of the order's amount
117
-		if( EEH_Money::compare_floats( $payment->amount(), $transaction->total(), '==' ) ) {
118
-			$payment->update_extra_meta( EEG_Paypal_Standard::itemized_payment_option_name, true );
117
+		if (EEH_Money::compare_floats($payment->amount(), $transaction->total(), '==')) {
118
+			$payment->update_extra_meta(EEG_Paypal_Standard::itemized_payment_option_name, true);
119 119
 			//this payment is for the remaining transaction amount,
120 120
 			//keep track of exactly how much the itemized order amount equals
121 121
 			$itemized_sum = 0;
122 122
 			$shipping_previously_added = 0;
123 123
 			//so let's show all the line items
124
-			foreach($total_line_item->get_items() as $line_item){
125
-				if ( $line_item instanceof EE_Line_Item ) {
124
+			foreach ($total_line_item->get_items() as $line_item) {
125
+				if ($line_item instanceof EE_Line_Item) {
126 126
 					//it's some kind of discount
127
-					if( $line_item->total() < 0 ) {
128
-						$total_discounts_to_cart_total += abs( $line_item->total() );
127
+					if ($line_item->total() < 0) {
128
+						$total_discounts_to_cart_total += abs($line_item->total());
129 129
 						$itemized_sum += $line_item->total();
130 130
 						continue;
131 131
 					}
132 132
 					//dont include shipping again.
133
-					if( strpos( $line_item->code(), 'paypal_shipping_') === 0 ) {
133
+					if (strpos($line_item->code(), 'paypal_shipping_') === 0) {
134 134
 						$shipping_previously_added = $line_item->total();
135 135
 						continue;
136 136
 					}
137
-					$redirect_args[ 'item_name_' . $item_num ] = substr(
138
-						$this->_format_line_item_name( $line_item, $payment ),
137
+					$redirect_args['item_name_'.$item_num] = substr(
138
+						$this->_format_line_item_name($line_item, $payment),
139 139
 						0, 127
140 140
 					);
141
-					$redirect_args[ 'amount_' . $item_num ] = $line_item->unit_price();
142
-					$redirect_args[ 'quantity_' . $item_num ] = $line_item->quantity();
141
+					$redirect_args['amount_'.$item_num] = $line_item->unit_price();
142
+					$redirect_args['quantity_'.$item_num] = $line_item->quantity();
143 143
 					//if we're not letting PayPal calculate shipping, tell them its 0
144
-					if ( ! $this->_paypal_shipping ) {
145
-						$redirect_args[ 'shipping_' . $item_num ] = '0';
146
-						$redirect_args[ 'shipping2_' . $item_num ] = '0';
144
+					if ( ! $this->_paypal_shipping) {
145
+						$redirect_args['shipping_'.$item_num] = '0';
146
+						$redirect_args['shipping2_'.$item_num] = '0';
147 147
 					}
148 148
 					$item_num++;
149 149
 					$itemized_sum += $line_item->total();
150 150
 				}
151 151
 			}
152
-			$taxes_li = $this->_line_item->get_taxes_subtotal( $total_line_item );
152
+			$taxes_li = $this->_line_item->get_taxes_subtotal($total_line_item);
153 153
 			//ideally itemized sum equals the transaction total. but if not (which is weird)
154 154
 			//and the itemized sum is LESS than the transaction total
155 155
 			//add another line item
@@ -159,47 +159,47 @@  discard block
 block discarded – undo
159 159
 				$transaction->total() - $itemized_sum - $taxes_li->total() - $shipping_previously_added,
160 160
 				2
161 161
 			);
162
-			if( $itemized_sum_diff_from_txn_total < 0 ) {
162
+			if ($itemized_sum_diff_from_txn_total < 0) {
163 163
 				//itemized sum is too big
164
-				$total_discounts_to_cart_total += abs( $itemized_sum_diff_from_txn_total );
165
-			} elseif( $itemized_sum_diff_from_txn_total > 0 ) {
166
-				$redirect_args[ 'item_name_' . $item_num ] = substr(
167
-						__( 'Other charges', 'event_espresso' ), 0, 127 );
168
-				$redirect_args[ 'amount_' . $item_num ] = $this->format_currency( $itemized_sum_diff_from_txn_total );
169
-				$redirect_args[ 'quantity_' . $item_num ] = 1;
164
+				$total_discounts_to_cart_total += abs($itemized_sum_diff_from_txn_total);
165
+			} elseif ($itemized_sum_diff_from_txn_total > 0) {
166
+				$redirect_args['item_name_'.$item_num] = substr(
167
+						__('Other charges', 'event_espresso'), 0, 127 );
168
+				$redirect_args['amount_'.$item_num] = $this->format_currency($itemized_sum_diff_from_txn_total);
169
+				$redirect_args['quantity_'.$item_num] = 1;
170 170
 				$item_num++;
171 171
 			}
172
-			if( $total_discounts_to_cart_total > 0 ) {
173
-				$redirect_args[ 'discount_amount_cart' ] = $this->format_currency( $total_discounts_to_cart_total );
172
+			if ($total_discounts_to_cart_total > 0) {
173
+				$redirect_args['discount_amount_cart'] = $this->format_currency($total_discounts_to_cart_total);
174 174
 			}
175 175
 			//add our taxes to the order if we're NOT using PayPal's
176
-			if( ! $this->_paypal_taxes ){
176
+			if ( ! $this->_paypal_taxes) {
177 177
 				$redirect_args['tax_cart'] = $total_line_item->get_total_tax();
178 178
 			}
179 179
 		} else {
180
-			$payment->update_extra_meta( EEG_Paypal_Standard::itemized_payment_option_name, false );
180
+			$payment->update_extra_meta(EEG_Paypal_Standard::itemized_payment_option_name, false);
181 181
 			//partial payment that's not for the remaining amount, so we can't send an itemized list
182
-			$redirect_args['item_name_' . $item_num] = substr(
183
-				$this->_format_partial_payment_line_item_name( $payment ),
182
+			$redirect_args['item_name_'.$item_num] = substr(
183
+				$this->_format_partial_payment_line_item_name($payment),
184 184
 				0, 127
185 185
 			);
186
-			$redirect_args['amount_' . $item_num] = $payment->amount();
187
-			$redirect_args['shipping_' . $item_num ] = '0';
188
-			$redirect_args['shipping2_' . $item_num ] = '0';
186
+			$redirect_args['amount_'.$item_num] = $payment->amount();
187
+			$redirect_args['shipping_'.$item_num] = '0';
188
+			$redirect_args['shipping2_'.$item_num] = '0';
189 189
 			$redirect_args['tax_cart'] = '0';
190 190
 			$item_num++;
191 191
 		}
192 192
 
193
-		if($this->_debug_mode){
194
-			$redirect_args['item_name_' . $item_num] = 'DEBUG INFO (this item only added in sandbox mode';
195
-			$redirect_args['amount_' . $item_num] = 0;
193
+		if ($this->_debug_mode) {
194
+			$redirect_args['item_name_'.$item_num] = 'DEBUG INFO (this item only added in sandbox mode';
195
+			$redirect_args['amount_'.$item_num] = 0;
196 196
 			$redirect_args['on0_'.$item_num] = 'NOTIFY URL';
197
-			$redirect_args['os0_' . $item_num] = $notify_url;
197
+			$redirect_args['os0_'.$item_num] = $notify_url;
198 198
 			$redirect_args['on1_'.$item_num] = 'RETURN URL';
199
-			$redirect_args['os1_' . $item_num] = $return_url;
199
+			$redirect_args['os1_'.$item_num] = $return_url;
200 200
 //			$redirect_args['option_index_' . $item_num] = 1; // <-- dunno if this is needed ?
201
-			$redirect_args['shipping_' . $item_num ] = '0';
202
-			$redirect_args['shipping2_' . $item_num ] = '0';
201
+			$redirect_args['shipping_'.$item_num] = '0';
202
+			$redirect_args['shipping2_'.$item_num] = '0';
203 203
 		}
204 204
 
205 205
 		$redirect_args['business'] = $this->_paypal_id;
@@ -209,14 +209,14 @@  discard block
 block discarded – undo
209 209
 		$redirect_args['cmd'] = '_cart';
210 210
 		$redirect_args['upload'] = 1;
211 211
 		$redirect_args['currency_code'] = $payment->currency_code();
212
-		$redirect_args['rm'] = 2;//makes the user return with method=POST
213
-		if($this->_image_url){
212
+		$redirect_args['rm'] = 2; //makes the user return with method=POST
213
+		if ($this->_image_url) {
214 214
 			$redirect_args['image_url'] = $this->_image_url;
215 215
 		}
216 216
 		$redirect_args['no_shipping'] = $this->_shipping_details;
217
-		$redirect_args['bn'] = 'EventEspresso_SP';//EE will blow up if you change this
217
+		$redirect_args['bn'] = 'EventEspresso_SP'; //EE will blow up if you change this
218 218
 
219
-		$redirect_args = apply_filters( "FHEE__EEG_Paypal_Standard__set_redirection_info__arguments", $redirect_args, $this );
219
+		$redirect_args = apply_filters("FHEE__EEG_Paypal_Standard__set_redirection_info__arguments", $redirect_args, $this);
220 220
 
221 221
 		$payment->set_redirect_url($this->_gateway_url);
222 222
 		$payment->set_redirect_args($redirect_args);
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
 		$this->log(
225 225
 			array(
226 226
 				'message'     => sprintf(
227
-					__( 'PayPal payment request initiated.', 'event_espresso' )
227
+					__('PayPal payment request initiated.', 'event_espresso')
228 228
 				),
229 229
 				'transaction' => $transaction->model_field_array(),
230 230
 			),
@@ -244,14 +244,14 @@  discard block
 block discarded – undo
244 244
 	 * @return \EEI_Payment updated
245 245
 	 * @throws \EE_Error, IpnException
246 246
 	 */
247
-	public function handle_payment_update( $update_info, $transaction ){
247
+	public function handle_payment_update($update_info, $transaction) {
248 248
 		// verify there's payment data that's been sent
249
-		if ( empty( $update_info[ 'payment_status' ] ) || empty( $update_info[ 'txn_id' ] ) ) {
249
+		if (empty($update_info['payment_status']) || empty($update_info['txn_id'])) {
250 250
 			// log the results
251 251
 			$this->log(
252 252
 				array(
253 253
 					'message' => sprintf(
254
-						__( 'PayPal IPN response is missing critical payment data. This may indicate a PDT request and require your PayPal account settings to be corrected.', 'event_espresso' )
254
+						__('PayPal IPN response is missing critical payment data. This may indicate a PDT request and require your PayPal account settings to be corrected.', 'event_espresso')
255 255
 					),
256 256
 					'update_info' => $update_info,
257 257
 				),
@@ -259,33 +259,33 @@  discard block
 block discarded – undo
259 259
 			);
260 260
 			// waaaait... is this a PDT request? (see https://developer.paypal.com/docs/classic/products/payment-data-transfer/)
261 261
 			// indicated by the "tx" argument? If so, we don't need it. We'll just use the IPN data when it comes
262
-			if ( isset( $update_info[ 'tx' ] ) ) {
262
+			if (isset($update_info['tx'])) {
263 263
 				return $transaction->last_payment();
264 264
 			} else {
265 265
 				return null;
266 266
 			}
267 267
 		}
268
-		$payment = $this->_pay_model->get_payment_by_txn_id_chq_nmbr( $update_info[ 'txn_id' ] );
269
-		if ( ! $payment instanceof EEI_Payment ) {
268
+		$payment = $this->_pay_model->get_payment_by_txn_id_chq_nmbr($update_info['txn_id']);
269
+		if ( ! $payment instanceof EEI_Payment) {
270 270
 			$payment = $transaction->last_payment();
271 271
 		}
272 272
 		// ok, then validate the IPN. Even if we've already processed this payment,
273 273
 		// let PayPal know we don't want to hear from them anymore!
274
-		if ( ! $this->validate_ipn( $update_info, $payment ) ) {
274
+		if ( ! $this->validate_ipn($update_info, $payment)) {
275 275
 			return $payment;
276 276
 		}
277 277
         // kill request here if this is a refund, we don't support them yet (we'd need to adjust the transaction,
278 278
         // registrations, ticket counts, etc)
279 279
         if (
280 280
             (
281
-                $update_info[ 'payment_status' ] === 'Refunded'
282
-                || $update_info[ 'payment_status' ] === 'Partially_Refunded'
281
+                $update_info['payment_status'] === 'Refunded'
282
+                || $update_info['payment_status'] === 'Partially_Refunded'
283 283
             )
284
-            && apply_filters( 'FHEE__EEG_Paypal_Standard__handle_payment_update__kill_refund_request', true )
284
+            && apply_filters('FHEE__EEG_Paypal_Standard__handle_payment_update__kill_refund_request', true)
285 285
         ) {
286 286
             throw new EventEspresso\core\exceptions\IpnException(
287 287
                 sprintf(
288
-                    esc_html__( 'Event Espresso does not yet support %1$s IPNs from PayPal', 'event_espresso'),
288
+                    esc_html__('Event Espresso does not yet support %1$s IPNs from PayPal', 'event_espresso'),
289 289
                     $update_info['payment_status']
290 290
                 ),
291 291
                 EventEspresso\core\exceptions\IpnException::UNSUPPORTED,
@@ -295,34 +295,34 @@  discard block
 block discarded – undo
295 295
             );
296 296
         }
297 297
 		//ok, well let's process this payment then!
298
-		switch ( $update_info[ 'payment_status' ] ) {
298
+		switch ($update_info['payment_status']) {
299 299
 
300 300
 			case 'Completed' :
301 301
 				$status = $this->_pay_model->approved_status();
302
-				$gateway_response = esc_html__( 'The payment is approved.', 'event_espresso' );
302
+				$gateway_response = esc_html__('The payment is approved.', 'event_espresso');
303 303
 				break;
304 304
 
305 305
 			case 'Pending' :
306 306
 				$status = $this->_pay_model->pending_status();
307
-				$gateway_response = esc_html__( 'The payment is in progress. Another message will be sent when payment is approved.', 'event_espresso' );
307
+				$gateway_response = esc_html__('The payment is in progress. Another message will be sent when payment is approved.', 'event_espresso');
308 308
 				break;
309 309
 
310 310
 			case 'Denied' :
311 311
 				$status = $this->_pay_model->declined_status();
312
-				$gateway_response = esc_html__( 'The payment has been declined.', 'event_espresso' );
312
+				$gateway_response = esc_html__('The payment has been declined.', 'event_espresso');
313 313
 				break;
314 314
 
315 315
 			case 'Expired' :
316 316
 			case 'Failed' :
317 317
 				$status = $this->_pay_model->failed_status();
318
-				$gateway_response = esc_html__( 'The payment failed for technical reasons or expired.', 'event_espresso' );
318
+				$gateway_response = esc_html__('The payment failed for technical reasons or expired.', 'event_espresso');
319 319
 				break;
320 320
 
321 321
 			case 'Refunded' :
322 322
 			case 'Partially_Refunded' :
323 323
 				// even though it's a refund, we consider the payment as approved, it just has a negative value
324 324
 				$status = $this->_pay_model->approved_status();
325
-				$gateway_response = esc_html__( 'The payment has been refunded. Please update registrations accordingly.', 'event_espresso' );
325
+				$gateway_response = esc_html__('The payment has been refunded. Please update registrations accordingly.', 'event_espresso');
326 326
 				break;
327 327
 
328 328
 			case 'Voided' :
@@ -330,19 +330,19 @@  discard block
 block discarded – undo
330 330
 			case 'Canceled_Reversal' :
331 331
 			default :
332 332
 				$status = $this->_pay_model->cancelled_status();
333
-				$gateway_response = esc_html__( 'The payment was cancelled, reversed, or voided. Please update registrations accordingly.', 'event_espresso' );
333
+				$gateway_response = esc_html__('The payment was cancelled, reversed, or voided. Please update registrations accordingly.', 'event_espresso');
334 334
 				break;
335 335
 
336 336
 		}
337 337
 
338 338
 		//check if we've already processed this payment
339
-		if ( $payment instanceof EEI_Payment ) {
339
+		if ($payment instanceof EEI_Payment) {
340 340
 			//payment exists. if this has the exact same status and amount, don't bother updating. just return
341
-			if ( $payment->status() === $status && (float)$payment->amount() === (float)$update_info[ 'mc_gross' ] ) {
341
+			if ($payment->status() === $status && (float) $payment->amount() === (float) $update_info['mc_gross']) {
342 342
 				// DUPLICATED IPN! don't bother updating transaction
343 343
 				throw new IpnException(
344 344
 					sprintf(
345
-						esc_html__( 'It appears we have received a duplicate IPN from PayPal for payment %d', 'event_espresso' ),
345
+						esc_html__('It appears we have received a duplicate IPN from PayPal for payment %d', 'event_espresso'),
346 346
 						$payment->ID()
347 347
 					),
348 348
 					IpnException::DUPLICATE,
@@ -352,14 +352,14 @@  discard block
 block discarded – undo
352 352
 				);
353 353
 			} else {
354 354
 				// new payment yippee !!!
355
-				$payment->set_status( $status );
356
-				$payment->set_amount( (float)$update_info[ 'mc_gross' ] );
357
-				$payment->set_gateway_response( $gateway_response );
358
-				$payment->set_details( $update_info );
359
-				$payment->set_txn_id_chq_nmbr( $update_info[ 'txn_id' ] );
355
+				$payment->set_status($status);
356
+				$payment->set_amount((float) $update_info['mc_gross']);
357
+				$payment->set_gateway_response($gateway_response);
358
+				$payment->set_details($update_info);
359
+				$payment->set_txn_id_chq_nmbr($update_info['txn_id']);
360 360
 				$this->log(
361 361
 					array(
362
-						'message'  => esc_html__( 'Updated payment either from IPN or as part of POST from PayPal', 'event_espresso' ),
362
+						'message'  => esc_html__('Updated payment either from IPN or as part of POST from PayPal', 'event_espresso'),
363 363
 						'url'      => $this->_process_response_url(),
364 364
 						'payment'  => $payment->model_field_array(),
365 365
 						'IPN_data' => $update_info
@@ -369,7 +369,7 @@  discard block
 block discarded – undo
369 369
 			}
370 370
 
371 371
 		}
372
-		do_action( 'FHEE__EEG_Paypal_Standard__handle_payment_update__payment_processed', $payment, $this );
372
+		do_action('FHEE__EEG_Paypal_Standard__handle_payment_update__payment_processed', $payment, $this);
373 373
 		return $payment;
374 374
 	}
375 375
 
@@ -384,9 +384,9 @@  discard block
 block discarded – undo
384 384
 	 * @return boolean
385 385
 	 * @throws \EE_Error
386 386
 	 */
387
-	public function validate_ipn( $update_info, $payment ) {
387
+	public function validate_ipn($update_info, $payment) {
388 388
 		//allow us to skip validating IPNs with PayPal (useful for testing)
389
-		if ( apply_filters( 'FHEE__EEG_Paypal_Standard__validate_ipn__skip', false ) ) {
389
+		if (apply_filters('FHEE__EEG_Paypal_Standard__validate_ipn__skip', false)) {
390 390
 			return true;
391 391
 		}
392 392
 		//...otherwise, we actually don't care what the $update_info is, we need to look
@@ -394,22 +394,22 @@  discard block
 block discarded – undo
394 394
 		// Reading POSTed data directly from $_POST causes serialization issues with array data in the POST.
395 395
 		// Instead, read raw POST data from the input stream.
396 396
 		// @see https://gist.github.com/xcommerce-gists/3440401
397
-		$raw_post_data = file_get_contents( 'php://input' );
398
-		$raw_post_array = explode( '&', $raw_post_data );
397
+		$raw_post_data = file_get_contents('php://input');
398
+		$raw_post_array = explode('&', $raw_post_data);
399 399
 		$update_info = array();
400
-		foreach ( $raw_post_array as $keyval ) {
401
-			$keyval = explode( '=', $keyval );
402
-			if ( count( $keyval ) === 2 ) {
403
-				$update_info[ $keyval[ 0 ] ] = urldecode( $keyval[ 1 ] );
400
+		foreach ($raw_post_array as $keyval) {
401
+			$keyval = explode('=', $keyval);
402
+			if (count($keyval) === 2) {
403
+				$update_info[$keyval[0]] = urldecode($keyval[1]);
404 404
 			}
405 405
 		}
406 406
 		// read the IPN message sent from PayPal and prepend 'cmd=_notify-validate'
407 407
 		$req = 'cmd=_notify-validate';
408
-		$uses_get_magic_quotes = function_exists( 'get_magic_quotes_gpc' ) && get_magic_quotes_gpc() === 1
408
+		$uses_get_magic_quotes = function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc() === 1
409 409
 			? true
410 410
 			: false;
411
-		foreach ( $update_info as $key => $value ) {
412
-			$value = $uses_get_magic_quotes ? urlencode( stripslashes( $value ) ) : urlencode( $value );
411
+		foreach ($update_info as $key => $value) {
412
+			$value = $uses_get_magic_quotes ? urlencode(stripslashes($value)) : urlencode($value);
413 413
 			$req .= "&$key=$value";
414 414
 		}
415 415
 		// HTTP POST the complete, unaltered IPN back to PayPal
@@ -418,38 +418,38 @@  discard block
 block discarded – undo
418 418
 			array(
419 419
 				'body' 				=> $req,
420 420
 				'sslverify' 		=> false,
421
-				'timeout' 		=> 60 ,
421
+				'timeout' 		=> 60,
422 422
 				// make sure to set a site specific unique "user-agent" string since the WordPres default gets declined by PayPal
423 423
 				// plz see: https://github.com/websharks/s2member/issues/610
424
-				'user-agent' 	=> 'Event Espresso v' . EVENT_ESPRESSO_VERSION . '; ' . home_url(),
424
+				'user-agent' 	=> 'Event Espresso v'.EVENT_ESPRESSO_VERSION.'; '.home_url(),
425 425
 				'httpversion' => '1.1'
426 426
 			)
427 427
 		);
428 428
 		// then check the response
429 429
 		if (
430
-			array_key_exists( 'body', $response )
431
-			&& ! is_wp_error( $response )
432
-			&& strcmp( $response[ 'body' ], "VERIFIED" ) === 0
430
+			array_key_exists('body', $response)
431
+			&& ! is_wp_error($response)
432
+			&& strcmp($response['body'], "VERIFIED") === 0
433 433
 		) {
434 434
 			return true;
435 435
 		}
436 436
 		// huh, something's wack... the IPN didn't validate. We must have replied to the IPN incorrectly,
437 437
 		// or their API must have changed: http://www.paypalobjects.com/en_US/ebook/PP_OrderManagement_IntegrationGuide/ipn.html
438
-		if( $response instanceof WP_Error ) {
438
+		if ($response instanceof WP_Error) {
439 439
 			$error_msg = sprintf(
440
-				esc_html__( 'WP Error. Code: "%1$s", Message: "%2$s", Data: "%3$s"', 'event_espresso' ),
440
+				esc_html__('WP Error. Code: "%1$s", Message: "%2$s", Data: "%3$s"', 'event_espresso'),
441 441
 				$response->get_error_code(),
442 442
 				$response->get_error_message(),
443
-				print_r( $response->get_error_data(), true )
443
+				print_r($response->get_error_data(), true)
444 444
 			);
445
-		} elseif( is_array( $response ) && isset( $response[ 'body' ] ) ) {
446
-			$error_msg = $response[ 'body' ];
445
+		} elseif (is_array($response) && isset($response['body'])) {
446
+			$error_msg = $response['body'];
447 447
 		} else {
448
-			$error_msg = print_r( $response, true );
448
+			$error_msg = print_r($response, true);
449 449
 		}
450
-		$payment->set_gateway_response( sprintf( esc_html__( "IPN Validation failed! Paypal responded with '%s'", "event_espresso" ), $error_msg ) );
451
-		$payment->set_details( array( 'REQUEST' => $update_info, 'VALIDATION_RESPONSE' => $response ) );
452
-		$payment->set_status( EEM_Payment::status_id_failed );
450
+		$payment->set_gateway_response(sprintf(esc_html__("IPN Validation failed! Paypal responded with '%s'", "event_espresso"), $error_msg));
451
+		$payment->set_details(array('REQUEST' => $update_info, 'VALIDATION_RESPONSE' => $response));
452
+		$payment->set_status(EEM_Payment::status_id_failed);
453 453
 		// log the results
454 454
 		$this->log(
455 455
 			array(
@@ -469,9 +469,9 @@  discard block
 block discarded – undo
469 469
 	 * @return string
470 470
 	 */
471 471
 	protected function _process_response_url() {
472
-		if ( isset( $_SERVER[ 'HTTP_HOST' ], $_SERVER[ 'REQUEST_URI' ] ) ) {
472
+		if (isset($_SERVER['HTTP_HOST'], $_SERVER['REQUEST_URI'])) {
473 473
 			$url = is_ssl() ? 'https://' : 'http://';
474
-			$url .= EEH_URL::filter_input_server_url( 'HTTP_HOST' );
474
+			$url .= EEH_URL::filter_input_server_url('HTTP_HOST');
475 475
 			$url .= EEH_URL::filter_input_server_url();
476 476
 		} else {
477 477
 			$url = 'unknown';
@@ -488,12 +488,12 @@  discard block
 block discarded – undo
488 488
 	 * @param EEI_Payment $payment
489 489
 	 * @throws \EE_Error
490 490
 	 */
491
-	public function update_txn_based_on_payment( $payment ) {
491
+	public function update_txn_based_on_payment($payment) {
492 492
 		$update_info = $payment->details();
493 493
 		/** @var EE_Transaction $transaction */
494 494
 		$transaction = $payment->transaction();
495
-		$payment_was_itemized = $payment->get_extra_meta( EEG_Paypal_Standard::itemized_payment_option_name, true, false );
496
-		if( ! $transaction ){
495
+		$payment_was_itemized = $payment->get_extra_meta(EEG_Paypal_Standard::itemized_payment_option_name, true, false);
496
+		if ( ! $transaction) {
497 497
 			$this->log(
498 498
 				esc_html__(
499 499
 					'Payment with ID %d has no related transaction, and so update_txn_based_on_payment couldn\'t be executed properly',
@@ -503,10 +503,10 @@  discard block
 block discarded – undo
503 503
 			);
504 504
 			return;
505 505
 		}
506
-		if(
507
-			! is_array( $update_info )
508
-			|| ! isset( $update_info[ 'mc_shipping' ] )
509
-			|| ! isset( $update_info[ 'tax' ] )
506
+		if (
507
+			! is_array($update_info)
508
+			|| ! isset($update_info['mc_shipping'])
509
+			|| ! isset($update_info['tax'])
510 510
 		) {
511 511
 			$this->log(
512 512
 				array(
@@ -521,7 +521,7 @@  discard block
 block discarded – undo
521 521
 			);
522 522
 			return;
523 523
 		}
524
-		if( $payment->status() !== $this->_pay_model->approved_status() ) {
524
+		if ($payment->status() !== $this->_pay_model->approved_status()) {
525 525
 			$this->log(
526 526
 				array(
527 527
 					'message' => esc_html__(
@@ -540,44 +540,44 @@  discard block
 block discarded – undo
540 540
 		$transaction_total_line_item = $transaction->total_line_item();
541 541
 
542 542
 		//might paypal have changed the taxes?
543
-		if( $this->_paypal_taxes && $payment_was_itemized ) {
543
+		if ($this->_paypal_taxes && $payment_was_itemized) {
544 544
             // note that we're doing this BEFORE adding shipping;
545 545
 			// we actually want PayPal's shipping to remain non-taxable
546
-            $this->_line_item->set_line_items_taxable( $transaction_total_line_item, true, 'paypal_shipping' );
546
+            $this->_line_item->set_line_items_taxable($transaction_total_line_item, true, 'paypal_shipping');
547 547
             $this->_line_item->set_total_tax_to(
548 548
 	            $transaction_total_line_item,
549
-                (float)$update_info['tax'],
550
-                esc_html__( 'Taxes', 'event_espresso' ),
551
-                esc_html__( 'Calculated by Paypal', 'event_espresso' ),
549
+                (float) $update_info['tax'],
550
+                esc_html__('Taxes', 'event_espresso'),
551
+                esc_html__('Calculated by Paypal', 'event_espresso'),
552 552
                 'paypal_tax'
553 553
             );
554 554
             $grand_total_needs_resaving = TRUE;
555 555
 		}
556 556
 
557
-		$shipping_amount = (float)$update_info[ 'mc_shipping' ];
557
+		$shipping_amount = (float) $update_info['mc_shipping'];
558 558
 		//might paypal have added shipping?
559
-		if( $this->_paypal_shipping && $shipping_amount && $payment_was_itemized ){
559
+		if ($this->_paypal_shipping && $shipping_amount && $payment_was_itemized) {
560 560
 			$this->_line_item->add_unrelated_item(
561 561
 				$transaction_total_line_item,
562
-				sprintf( esc_html__('Shipping for transaction %1$s', 'event_espresso'), $transaction->ID() ),
562
+				sprintf(esc_html__('Shipping for transaction %1$s', 'event_espresso'), $transaction->ID()),
563 563
 				$shipping_amount,
564 564
 				esc_html__('Shipping charges calculated by Paypal', 'event_espresso'),
565 565
 				1,
566 566
 				false,
567
-				'paypal_shipping_' . $transaction->ID()
567
+				'paypal_shipping_'.$transaction->ID()
568 568
 			);
569 569
 			$grand_total_needs_resaving = true;
570 570
 		}
571 571
 
572
-		if( $grand_total_needs_resaving ){
573
-			$transaction_total_line_item->save_this_and_descendants_to_txn( $transaction->ID() );
572
+		if ($grand_total_needs_resaving) {
573
+			$transaction_total_line_item->save_this_and_descendants_to_txn($transaction->ID());
574 574
 			/** @var EE_Registration_Processor $registration_processor */
575
-			$registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' );
576
-			$registration_processor->update_registration_final_prices( $transaction );
575
+			$registration_processor = EE_Registry::instance()->load_class('Registration_Processor');
576
+			$registration_processor->update_registration_final_prices($transaction);
577 577
 		}
578 578
 		$this->log(
579 579
 			array(
580
-				'message'                     => esc_html__( 'Updated transaction related to payment', 'event_espresso' ),
580
+				'message'                     => esc_html__('Updated transaction related to payment', 'event_espresso'),
581 581
 				'url'                         => $this->_process_response_url(),
582 582
 				'transaction (updated)'       => $transaction->model_field_array(),
583 583
 				'payment (updated)'           => $payment->model_field_array(),
Please login to merge, or discard this patch.
core/exceptions/IpnException.php 1 patch
Indentation   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@  discard block
 block discarded – undo
2 2
 namespace EventEspresso\core\exceptions;
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
 
@@ -21,71 +21,71 @@  discard block
 block discarded – undo
21 21
 class IpnException extends \LogicException
22 22
 {
23 23
 
24
-    const DUPLICATE          = 1;
24
+	const DUPLICATE          = 1;
25 25
 
26
-    const UNABLE_TO_VALIDATE = 2;
26
+	const UNABLE_TO_VALIDATE = 2;
27 27
 
28
-    const UNSUPPORTED        = 3;
28
+	const UNSUPPORTED        = 3;
29 29
 
30
-    /**
31
-     * @var \EE_Payment
32
-     */
33
-    protected $payment;
30
+	/**
31
+	 * @var \EE_Payment
32
+	 */
33
+	protected $payment;
34 34
 
35
-    /**
36
-     * @var mixed IPN data, usually an array or object
37
-     */
38
-    protected $ipn_data;
35
+	/**
36
+	 * @var mixed IPN data, usually an array or object
37
+	 */
38
+	protected $ipn_data;
39 39
 
40 40
 
41 41
 
42
-    public function __construct(
43
-        $message,
44
-        $code = 0,
45
-        \Exception $previous = null,
46
-        \EE_Payment $payment = null,
47
-        $ipn_data = array()
48
-    ) {
49
-        parent::__construct($message, $code, $previous);
50
-        $this->payment = $payment;
51
-        $this->ipn_data = $ipn_data;
52
-    }
42
+	public function __construct(
43
+		$message,
44
+		$code = 0,
45
+		\Exception $previous = null,
46
+		\EE_Payment $payment = null,
47
+		$ipn_data = array()
48
+	) {
49
+		parent::__construct($message, $code, $previous);
50
+		$this->payment = $payment;
51
+		$this->ipn_data = $ipn_data;
52
+	}
53 53
 
54 54
 
55 55
 
56
-    /**
57
-     * Gets the payment associated with this IPN, if known
58
-     *
59
-     * @return \EE_Payment
60
-     */
61
-    public function getPayment()
62
-    {
63
-        return $this->payment;
64
-    }
56
+	/**
57
+	 * Gets the payment associated with this IPN, if known
58
+	 *
59
+	 * @return \EE_Payment
60
+	 */
61
+	public function getPayment()
62
+	{
63
+		return $this->payment;
64
+	}
65 65
 
66 66
 
67 67
 
68
-    /**
69
-     * Returns the payment's properties as an array (even if there is no payment, in which case it's an empty array)
70
-     *
71
-     * @return array
72
-     * @throws \EE_Error
73
-     */
74
-    public function getPaymentProperties()
75
-    {
76
-        return $this->getPayment() instanceof \EE_Payment ? $this->getPayment()->model_field_array() : array();
77
-    }
68
+	/**
69
+	 * Returns the payment's properties as an array (even if there is no payment, in which case it's an empty array)
70
+	 *
71
+	 * @return array
72
+	 * @throws \EE_Error
73
+	 */
74
+	public function getPaymentProperties()
75
+	{
76
+		return $this->getPayment() instanceof \EE_Payment ? $this->getPayment()->model_field_array() : array();
77
+	}
78 78
 
79 79
 
80 80
 
81
-    /**
82
-     * Returns an array, object, or string, however, the IPN data was received
83
-     *
84
-     * @return mixed
85
-     */
86
-    public function getIpnData()
87
-    {
88
-        return $this->ipn_data;
89
-    }
81
+	/**
82
+	 * Returns an array, object, or string, however, the IPN data was received
83
+	 *
84
+	 * @return mixed
85
+	 */
86
+	public function getIpnData()
87
+	{
88
+		return $this->ipn_data;
89
+	}
90 90
 
91 91
 }
92 92
\ No newline at end of file
Please login to merge, or discard this patch.
modules/invalid_checkout_access/EED_Invalid_Checkout_Access.module.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 use EventEspresso\modules\invalid_checkout_access\InvalidCheckoutAccess;
3 3
 
4
-if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
5
-	exit( 'No direct script access allowed' );
4
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
5
+	exit('No direct script access allowed');
6 6
 }
7 7
 
8 8
 
@@ -36,12 +36,12 @@  discard block
 block discarded – undo
36 36
 	public static function set_hooks_admin() {
37 37
 		add_action(
38 38
 			'AHEE__Extend_Registration_Form_Admin_Page___reg_form_settings_template',
39
-			array( 'EED_Invalid_Checkout_Access', 'display_invalid_checkout_access_form' ),
39
+			array('EED_Invalid_Checkout_Access', 'display_invalid_checkout_access_form'),
40 40
 			15
41 41
 		);
42 42
 		add_filter(
43 43
 			'FHEE__Extend_Registration_Form_Admin_Page___update_reg_form_settings__CFG_registration',
44
-			array( 'EED_Invalid_Checkout_Access', 'process_invalid_checkout_access_form' )
44
+			array('EED_Invalid_Checkout_Access', 'process_invalid_checkout_access_form')
45 45
 		);
46 46
 	}
47 47
 
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 	 *
54 54
 	 * @var WP $WP
55 55
 	 */
56
-	public function run( $WP ) {
56
+	public function run($WP) {
57 57
 		// TODO: Implement run() method.
58 58
 	}
59 59
 
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 	 * @return InvalidCheckoutAccess
64 64
 	 */
65 65
 	public static function getInvalidCheckoutAccess() {
66
-		if ( ! self::$invalid_checkout_access_form instanceof InvalidCheckoutAccess ) {
66
+		if ( ! self::$invalid_checkout_access_form instanceof InvalidCheckoutAccess) {
67 67
 			self::$invalid_checkout_access_form = new InvalidCheckoutAccess();
68 68
 		}
69 69
 		return self::$invalid_checkout_access_form;
@@ -90,9 +90,9 @@  discard block
 block discarded – undo
90 90
 	 * @param \EE_Registration_Config $EE_Registration_Config
91 91
 	 * @return \EE_Registration_Config
92 92
 	 */
93
-	public static function process_invalid_checkout_access_form( \EE_Registration_Config $EE_Registration_Config ) {
93
+	public static function process_invalid_checkout_access_form(\EE_Registration_Config $EE_Registration_Config) {
94 94
 		$invalid_checkout_access_form = \EED_Invalid_Checkout_Access::getInvalidCheckoutAccess();
95
-		return $invalid_checkout_access_form->processForm( $EE_Registration_Config );
95
+		return $invalid_checkout_access_form->processForm($EE_Registration_Config);
96 96
 	}
97 97
 
98 98
 
Please login to merge, or discard this patch.
core/EE_Session.core.php 4 patches
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -341,7 +341,7 @@
 block discarded – undo
341 341
 		}
342 342
 		 if ( ! empty( $key ))  {
343 343
 			return  isset( $this->_session_data[ $key ] ) ? $this->_session_data[ $key ] : NULL;
344
-		}  else  {
344
+		} else  {
345 345
 			return $this->_session_data;
346 346
 		}
347 347
 	}
Please login to merge, or discard this patch.
Indentation   +190 added lines, -190 removed lines patch added patch discarded remove patch
@@ -52,12 +52,12 @@  discard block
 block discarded – undo
52 52
 	  */
53 53
 	 private $_expiration;
54 54
 
55
-    /**
56
-     * whether or not session has expired at some point
57
-     *
58
-     * @var boolean
59
-     */
60
-    private $_expired = false;
55
+	/**
56
+	 * whether or not session has expired at some point
57
+	 *
58
+	 * @var boolean
59
+	 */
60
+	private $_expired = false;
61 61
 
62 62
 	 /**
63 63
 	  * current time as Unix timestamp in GMT
@@ -100,14 +100,14 @@  discard block
 block discarded – undo
100 100
 	  * @var array
101 101
 	  */
102 102
 	 private $_default_session_vars = array (
103
-        'id'            => null,
104
-        'user_id'       => null,
105
-        'ip_address'    => null,
106
-        'user_agent'    => null,
107
-        'init_access'   => null,
108
-        'last_access'   => null,
109
-        'expiration'    => null,
110
-        'pages_visited' => array(),
103
+		'id'            => null,
104
+		'user_id'       => null,
105
+		'ip_address'    => null,
106
+		'user_agent'    => null,
107
+		'init_access'   => null,
108
+		'last_access'   => null,
109
+		'expiration'    => null,
110
+		'pages_visited' => array(),
111 111
 	);
112 112
 
113 113
 
@@ -171,18 +171,18 @@  discard block
 block discarded – undo
171 171
 				$this->{$var_name} = $session_setting;
172 172
 			}
173 173
 		}
174
-         // are we using encryption?
175
-         $this->_use_encryption = $encryption instanceof EE_Encryption && EE_Registry::instance()->CFG->admin->encode_session_data();
176
-         // \EEH_Debug_Tools::printr($this->_use_encryption, '$this->_use_encryption', __FILE__, __LINE__);
177
-        // encrypt data via: $this->encryption->encrypt();
178
-        $this->encryption = $encryption;
174
+		 // are we using encryption?
175
+		 $this->_use_encryption = $encryption instanceof EE_Encryption && EE_Registry::instance()->CFG->admin->encode_session_data();
176
+		 // \EEH_Debug_Tools::printr($this->_use_encryption, '$this->_use_encryption', __FILE__, __LINE__);
177
+		// encrypt data via: $this->encryption->encrypt();
178
+		$this->encryption = $encryption;
179 179
 		// filter hook allows outside functions/classes/plugins to change default empty cart
180 180
 		$extra_default_session_vars = apply_filters( 'FHEE__EE_Session__construct__extra_default_session_vars', array() );
181 181
 		array_merge( $this->_default_session_vars, $extra_default_session_vars );
182 182
 		// apply default session vars
183 183
 		$this->_set_defaults();
184
-         add_action('AHEE__EE_System__initialize', array($this, 'open_session'));
185
-         // check request for 'clear_session' param
184
+		 add_action('AHEE__EE_System__initialize', array($this, 'open_session'));
185
+		 // check request for 'clear_session' param
186 186
 		add_action( 'AHEE__EE_Request_Handler__construct__complete', array( $this, 'wp_loaded' ));
187 187
 		// once everything is all said and done,
188 188
 		add_action( 'shutdown', array( $this, 'update' ), 100 );
@@ -191,38 +191,38 @@  discard block
 block discarded – undo
191 191
 
192 192
 
193 193
 
194
-     /**
195
-      * @return void
196
-      * @throws \EventEspresso\core\exceptions\InvalidSessionDataException
197
-      * @throws \EE_Error
198
-      */
194
+	 /**
195
+	  * @return void
196
+	  * @throws \EventEspresso\core\exceptions\InvalidSessionDataException
197
+	  * @throws \EE_Error
198
+	  */
199 199
 	 public function open_session() {
200
-         // check for existing session and retrieve it from db
201
-         if ( ! $this->_espresso_session()) {
202
-             // or just start a new one
203
-             $this->_create_espresso_session();
204
-         }
205
-     }
200
+		 // check for existing session and retrieve it from db
201
+		 if ( ! $this->_espresso_session()) {
202
+			 // or just start a new one
203
+			 $this->_create_espresso_session();
204
+		 }
205
+	 }
206 206
 
207 207
 
208 208
 
209
-    /**
210
-     * @return bool
211
-     */
212
-    public function expired()
213
-    {
214
-        return $this->_expired;
215
-    }
209
+	/**
210
+	 * @return bool
211
+	 */
212
+	public function expired()
213
+	{
214
+		return $this->_expired;
215
+	}
216 216
 
217 217
 
218 218
 
219
-    /**
220
-     * @return void
221
-     */
222
-    public function reset_expired()
223
-    {
224
-        $this->_expired = false;
225
-    }
219
+	/**
220
+	 * @return void
221
+	 */
222
+	public function reset_expired()
223
+	{
224
+		$this->_expired = false;
225
+	}
226 226
 
227 227
 
228 228
 	 /**
@@ -234,25 +234,25 @@  discard block
 block discarded – undo
234 234
 
235 235
 
236 236
 
237
-    /**
238
-     * @return int
239
-     */
240
-    public function extension()
241
-    {
242
-        return apply_filters('FHEE__EE_Session__extend_expiration__seconds_added', (10 * MINUTE_IN_SECONDS));
243
-    }
237
+	/**
238
+	 * @return int
239
+	 */
240
+	public function extension()
241
+	{
242
+		return apply_filters('FHEE__EE_Session__extend_expiration__seconds_added', (10 * MINUTE_IN_SECONDS));
243
+	}
244 244
 
245 245
 
246 246
 
247
-    /**
248
-     * @param int $time number of seconds to add to session expiration
249
-     * @return int
250
-     */
251
-    public function extend_expiration($time = 0)
252
-    {
253
-        $time = $time ? $time : $this->extension();
254
-        $this->_expiration += absint($time);
255
-    }
247
+	/**
248
+	 * @param int $time number of seconds to add to session expiration
249
+	 * @return int
250
+	 */
251
+	public function extend_expiration($time = 0)
252
+	{
253
+		$time = $time ? $time : $this->extension();
254
+		$this->_expiration += absint($time);
255
+	}
256 256
 
257 257
 
258 258
 
@@ -296,15 +296,15 @@  discard block
 block discarded – undo
296 296
 
297 297
 
298 298
 
299
-    /**
300
-     * @param \EE_Cart $cart
301
-     * @return bool
302
-     */
303
-    public function set_cart(EE_Cart $cart)
304
-    {
305
-        $this->_session_data['cart'] = $cart;
306
-        return true;
307
-    }
299
+	/**
300
+	 * @param \EE_Cart $cart
301
+	 * @return bool
302
+	 */
303
+	public function set_cart(EE_Cart $cart)
304
+	{
305
+		$this->_session_data['cart'] = $cart;
306
+		return true;
307
+	}
308 308
 
309 309
 
310 310
 
@@ -312,7 +312,7 @@  discard block
 block discarded – undo
312 312
 	  * reset_cart
313 313
 	  */
314 314
 	 public function reset_cart() {
315
-        do_action('AHEE__EE_Session__reset_cart__before_reset', $this);
315
+		do_action('AHEE__EE_Session__reset_cart__before_reset', $this);
316 316
 		 $this->_session_data['cart'] = NULL;
317 317
 	 }
318 318
 
@@ -322,9 +322,9 @@  discard block
 block discarded – undo
322 322
 	  * @return \EE_Cart
323 323
 	  */
324 324
 	 public function cart() {
325
-        return isset($this->_session_data['cart']) && $this->_session_data['cart'] instanceof EE_Cart
326
-            ? $this->_session_data['cart']
327
-            : null;
325
+		return isset($this->_session_data['cart']) && $this->_session_data['cart'] instanceof EE_Cart
326
+			? $this->_session_data['cart']
327
+			: null;
328 328
 	 }
329 329
 
330 330
 
@@ -344,7 +344,7 @@  discard block
 block discarded – undo
344 344
 	  * reset_checkout
345 345
 	  */
346 346
 	 public function reset_checkout() {
347
-        do_action('AHEE__EE_Session__reset_checkout__before_reset', $this);
347
+		do_action('AHEE__EE_Session__reset_checkout__before_reset', $this);
348 348
 		 $this->_session_data['checkout'] = NULL;
349 349
 	 }
350 350
 
@@ -354,9 +354,9 @@  discard block
 block discarded – undo
354 354
 	  * @return \EE_Checkout
355 355
 	  */
356 356
 	 public function checkout() {
357
-        return isset($this->_session_data['checkout']) && $this->_session_data['checkout'] instanceof EE_Checkout
358
-            ? $this->_session_data['checkout']
359
-            : null;
357
+		return isset($this->_session_data['checkout']) && $this->_session_data['checkout'] instanceof EE_Checkout
358
+			? $this->_session_data['checkout']
359
+			: null;
360 360
 	 }
361 361
 
362 362
 
@@ -379,7 +379,7 @@  discard block
 block discarded – undo
379 379
 	  * reset_transaction
380 380
 	  */
381 381
 	 public function reset_transaction() {
382
-        do_action('AHEE__EE_Session__reset_transaction__before_reset', $this);
382
+		do_action('AHEE__EE_Session__reset_transaction__before_reset', $this);
383 383
 		 $this->_session_data['transaction'] = NULL;
384 384
 	 }
385 385
 
@@ -389,10 +389,10 @@  discard block
 block discarded – undo
389 389
 	  * @return \EE_Transaction
390 390
 	  */
391 391
 	 public function transaction() {
392
-        return isset($this->_session_data['transaction'])
393
-               && $this->_session_data['transaction'] instanceof EE_Transaction
394
-           ? $this->_session_data['transaction']
395
-           : null;
392
+		return isset($this->_session_data['transaction'])
393
+			   && $this->_session_data['transaction'] instanceof EE_Transaction
394
+		   ? $this->_session_data['transaction']
395
+		   : null;
396 396
 	 }
397 397
 
398 398
 
@@ -469,16 +469,16 @@  discard block
 block discarded – undo
469 469
 		// set the "user agent"
470 470
 		$this->_user_agent = isset($_SERVER['HTTP_USER_AGENT']) ? esc_attr( $_SERVER['HTTP_USER_AGENT'] ) : FALSE;
471 471
 		// now let's retrieve what's in the db
472
-        $session_data = $this->_retrieve_session_data();
473
-        if (! empty($session_data)) {
474
-            // get the current time in UTC
472
+		$session_data = $this->_retrieve_session_data();
473
+		if (! empty($session_data)) {
474
+			// get the current time in UTC
475 475
 			$this->_time = isset( $this->_time ) ? $this->_time : time();
476 476
 			// and reset the session expiration
477 477
 			$this->_expiration = isset( $session_data['expiration'] )
478 478
 				? $session_data['expiration']
479 479
 				: $this->_time + $this->_lifespan;
480 480
 		} else {
481
-            // set initial site access time and the session expiration
481
+			// set initial site access time and the session expiration
482 482
 			$this->_set_init_access_and_expiration();
483 483
 			// set referer
484 484
 			$this->_session_data[ 'pages_visited' ][ $this->_session_data['init_access'] ] = isset( $_SERVER['HTTP_REFERER'] )
@@ -487,14 +487,14 @@  discard block
 block discarded – undo
487 487
 			// no previous session = go back and create one (on top of the data above)
488 488
 			return FALSE;
489 489
 		}
490
-        // now the user agent
490
+		// now the user agent
491 491
 		if ( $session_data['user_agent'] !== $this->_user_agent ) {
492 492
 			return FALSE;
493 493
 		}
494 494
 		// wait a minute... how old are you?
495 495
 		if ( $this->_time > $this->_expiration ) {
496 496
 			// yer too old fer me!
497
-            $this->_expired = true;
497
+			$this->_expired = true;
498 498
 			// wipe out everything that isn't a default session datum
499 499
 			$this->clear_session( __CLASS__, __FUNCTION__ );
500 500
 		}
@@ -506,95 +506,95 @@  discard block
 block discarded – undo
506 506
 
507 507
 
508 508
 
509
-     /**
510
-      * _get_session_data
511
-      * Retrieves the session data, and attempts to correct any encoding issues that can occur due to improperly setup databases
512
-      *
513
-      * @return array
514
-      * @throws \EventEspresso\core\exceptions\InvalidSessionDataException
515
-      */
516
-     protected function _retrieve_session_data()
517
-     {
518
-         $ssn_key = EE_Session::session_id_prefix . $this->_sid;
519
-         try {
520
-             // we're using WP's Transient API to store session data using the PHP session ID as the option name
521
-             $session_data = get_transient($ssn_key);
522
-	         if ($session_data === false) {
523
-		         return array();
524
-             }
525
-             if (apply_filters('FHEE__EE_Session___perform_session_id_hash_check', WP_DEBUG)) {
526
-                 $hash_check = get_transient(EE_Session::hash_check_prefix . $this->_sid);
527
-                 if ($hash_check && $hash_check !== md5($session_data)) {
528
-	                 EE_Error::add_error(
529
-                         sprintf(
530
-                             __('The stored data for session %1$s failed to pass a hash check and therefore appears to be invalid.', 'event_espresso'),
531
-                             EE_Session::session_id_prefix . $this->_sid
532
-                         ),
533
-                         __FILE__, __FUNCTION__, __LINE__
534
-                     );
535
-                 }
536
-             }
537
-         } catch (Exception $e) {
538
-             // let's just eat that error for now and attempt to correct any corrupted data
539
-             global $wpdb;
540
-             $row = $wpdb->get_row(
541
-                 $wpdb->prepare(
542
-                     "SELECT option_value FROM {$wpdb->options} WHERE option_name = %s LIMIT 1",
543
-                     '_transient_' . $ssn_key
544
-                 )
545
-             );
546
-             $session_data = is_object($row) ? $row->option_value : null;
547
-             if ($session_data) {
548
-                 $session_data = preg_replace_callback(
549
-                     '!s:(d+):"(.*?)";!',
550
-                     function ($match) {
551
-                         return $match[1] === strlen($match[2])
552
-                             ? $match[0]
553
-                             : 's:' . strlen($match[2]) . ':"' . $match[2] . '";';
554
-                     },
555
-                     $session_data
556
-                 );
557
-             }
558
-	         $session_data = maybe_unserialize($session_data);
559
-         }
560
-	     // in case the data is encoded... try to decode it
561
-         $session_data = $this->encryption instanceof EE_Encryption
562
-             ? $this->encryption->base64_string_decode($session_data)
563
-             : $session_data;
564
-
565
-         if ( ! is_array($session_data)) {
566
-             try {
567
-	             $session_data = maybe_unserialize($session_data);
568
-             } catch (Exception $e) {
569
-                 $msg = esc_html__(
570
-                     'An error occurred while attempting to unserialize the session data.',
571
-                     'event_espresso'
572
-                 );
573
-                 $msg .= WP_DEBUG
574
-                     ? '<br><pre>' . print_r($session_data, true) . '</pre><br>' . $this->find_serialize_error($session_data)
575
-                     : '';
576
-                 throw new InvalidSessionDataException($msg, 0, $e);
577
-             }
578
-         }
579
-         // just a check to make sure the session array is indeed an array
580
-         if ( ! is_array($session_data)) {
581
-             // no?!?! then something is wrong
582
-             $msg = esc_html__(
583
-                 'The session data is missing, invalid, or corrupted.',
584
-                 'event_espresso'
585
-             );
586
-             $msg .= WP_DEBUG
587
-                 ? '<br><pre>' . print_r($session_data, true) . '</pre><br>' . $this->find_serialize_error($session_data)
588
-                 : '';
589
-	         throw new InvalidSessionDataException($msg);
590
-         }
591
-	     if ( isset( $this->_session_data['transaction'] ) && absint( $this->_session_data['transaction'] ) !== 0 ) {
592
-		     $this->_session_data['transaction'] = EEM_Transaction::instance()->get_one_by_ID(
593
-			     $this->_session_data['transaction']
594
-	         );
595
-	     }
596
-	     return $session_data;
597
-     }
509
+	 /**
510
+	  * _get_session_data
511
+	  * Retrieves the session data, and attempts to correct any encoding issues that can occur due to improperly setup databases
512
+	  *
513
+	  * @return array
514
+	  * @throws \EventEspresso\core\exceptions\InvalidSessionDataException
515
+	  */
516
+	 protected function _retrieve_session_data()
517
+	 {
518
+		 $ssn_key = EE_Session::session_id_prefix . $this->_sid;
519
+		 try {
520
+			 // we're using WP's Transient API to store session data using the PHP session ID as the option name
521
+			 $session_data = get_transient($ssn_key);
522
+			 if ($session_data === false) {
523
+				 return array();
524
+			 }
525
+			 if (apply_filters('FHEE__EE_Session___perform_session_id_hash_check', WP_DEBUG)) {
526
+				 $hash_check = get_transient(EE_Session::hash_check_prefix . $this->_sid);
527
+				 if ($hash_check && $hash_check !== md5($session_data)) {
528
+					 EE_Error::add_error(
529
+						 sprintf(
530
+							 __('The stored data for session %1$s failed to pass a hash check and therefore appears to be invalid.', 'event_espresso'),
531
+							 EE_Session::session_id_prefix . $this->_sid
532
+						 ),
533
+						 __FILE__, __FUNCTION__, __LINE__
534
+					 );
535
+				 }
536
+			 }
537
+		 } catch (Exception $e) {
538
+			 // let's just eat that error for now and attempt to correct any corrupted data
539
+			 global $wpdb;
540
+			 $row = $wpdb->get_row(
541
+				 $wpdb->prepare(
542
+					 "SELECT option_value FROM {$wpdb->options} WHERE option_name = %s LIMIT 1",
543
+					 '_transient_' . $ssn_key
544
+				 )
545
+			 );
546
+			 $session_data = is_object($row) ? $row->option_value : null;
547
+			 if ($session_data) {
548
+				 $session_data = preg_replace_callback(
549
+					 '!s:(d+):"(.*?)";!',
550
+					 function ($match) {
551
+						 return $match[1] === strlen($match[2])
552
+							 ? $match[0]
553
+							 : 's:' . strlen($match[2]) . ':"' . $match[2] . '";';
554
+					 },
555
+					 $session_data
556
+				 );
557
+			 }
558
+			 $session_data = maybe_unserialize($session_data);
559
+		 }
560
+		 // in case the data is encoded... try to decode it
561
+		 $session_data = $this->encryption instanceof EE_Encryption
562
+			 ? $this->encryption->base64_string_decode($session_data)
563
+			 : $session_data;
564
+
565
+		 if ( ! is_array($session_data)) {
566
+			 try {
567
+				 $session_data = maybe_unserialize($session_data);
568
+			 } catch (Exception $e) {
569
+				 $msg = esc_html__(
570
+					 'An error occurred while attempting to unserialize the session data.',
571
+					 'event_espresso'
572
+				 );
573
+				 $msg .= WP_DEBUG
574
+					 ? '<br><pre>' . print_r($session_data, true) . '</pre><br>' . $this->find_serialize_error($session_data)
575
+					 : '';
576
+				 throw new InvalidSessionDataException($msg, 0, $e);
577
+			 }
578
+		 }
579
+		 // just a check to make sure the session array is indeed an array
580
+		 if ( ! is_array($session_data)) {
581
+			 // no?!?! then something is wrong
582
+			 $msg = esc_html__(
583
+				 'The session data is missing, invalid, or corrupted.',
584
+				 'event_espresso'
585
+			 );
586
+			 $msg .= WP_DEBUG
587
+				 ? '<br><pre>' . print_r($session_data, true) . '</pre><br>' . $this->find_serialize_error($session_data)
588
+				 : '';
589
+			 throw new InvalidSessionDataException($msg);
590
+		 }
591
+		 if ( isset( $this->_session_data['transaction'] ) && absint( $this->_session_data['transaction'] ) !== 0 ) {
592
+			 $this->_session_data['transaction'] = EEM_Transaction::instance()->get_one_by_ID(
593
+				 $this->_session_data['transaction']
594
+			 );
595
+		 }
596
+		 return $session_data;
597
+	 }
598 598
 
599 599
 
600 600
 
@@ -1040,17 +1040,17 @@  discard block
 block discarded – undo
1040 1040
 					OR option_value > {$too_far_in_the_the_future} )
1041 1041
 					LIMIT {$expired_session_transient_delete_query_limit}
1042 1042
 				";
1043
-                    $expired_sessions = $wpdb->get_col($SQL);
1044
-                    // valid results?
1045
-                    if ( ! $expired_sessions instanceof WP_Error && ! empty($expired_sessions)) {
1046
-                        // format array of results into something usable within the actual DELETE query's IN clause
1047
-                        $expired = array();
1048
-                        foreach ($expired_sessions as $expired_session) {
1049
-                            $expired[] = "'" . $expired_session . "'";
1050
-                            $expired[] = "'" . str_replace('timeout_', '', $expired_session) . "'";
1051
-                        }
1052
-                        $expired = implode(', ', $expired);
1053
-                        $SQL = "
1043
+					$expired_sessions = $wpdb->get_col($SQL);
1044
+					// valid results?
1045
+					if ( ! $expired_sessions instanceof WP_Error && ! empty($expired_sessions)) {
1046
+						// format array of results into something usable within the actual DELETE query's IN clause
1047
+						$expired = array();
1048
+						foreach ($expired_sessions as $expired_session) {
1049
+							$expired[] = "'" . $expired_session . "'";
1050
+							$expired[] = "'" . str_replace('timeout_', '', $expired_session) . "'";
1051
+						}
1052
+						$expired = implode(', ', $expired);
1053
+						$SQL = "
1054 1054
 						DELETE FROM {$wpdb->options}
1055 1055
 						WHERE option_name
1056 1056
 						IN ( $expired );
Please login to merge, or discard this patch.
Spacing   +161 added lines, -161 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php use EventEspresso\core\exceptions\InvalidSessionDataException;
2 2
 
3
-if (!defined( 'EVENT_ESPRESSO_VERSION')) {exit('No direct script access allowed');}
3
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {exit('No direct script access allowed'); }
4 4
 /**
5 5
  *
6 6
  * EE_Session class
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 	  * array for defining default session vars
100 100
 	  * @var array
101 101
 	  */
102
-	 private $_default_session_vars = array (
102
+	 private $_default_session_vars = array(
103 103
         'id'            => null,
104 104
         'user_id'       => null,
105 105
         'ip_address'    => null,
@@ -119,12 +119,12 @@  discard block
 block discarded – undo
119 119
 	  * @throws InvalidSessionDataException
120 120
 	  * @throws \EE_Error
121 121
 	  */
122
-	public static function instance( EE_Encryption $encryption = null ) {
122
+	public static function instance(EE_Encryption $encryption = null) {
123 123
 		// check if class object is instantiated
124 124
 		// session loading is turned ON by default, but prior to the init hook, can be turned back OFF via:
125 125
 		// add_filter( 'FHEE_load_EE_Session', '__return_false' );
126
-		if ( ! self::$_instance instanceof EE_Session && apply_filters( 'FHEE_load_EE_Session', true ) ) {
127
-			self::$_instance = new self( $encryption );
126
+		if ( ! self::$_instance instanceof EE_Session && apply_filters('FHEE_load_EE_Session', true)) {
127
+			self::$_instance = new self($encryption);
128 128
 		}
129 129
 		return self::$_instance;
130 130
 	}
@@ -140,15 +140,15 @@  discard block
 block discarded – undo
140 140
 	  * @throws \EE_Error
141 141
 	  * @throws \EventEspresso\core\exceptions\InvalidSessionDataException
142 142
 	  */
143
-	 protected function __construct( EE_Encryption $encryption = null ) {
143
+	 protected function __construct(EE_Encryption $encryption = null) {
144 144
 
145 145
 		// session loading is turned ON by default, but prior to the init hook, can be turned back OFF via: add_filter( 'FHEE_load_EE_Session', '__return_false' );
146
-		if ( ! apply_filters( 'FHEE_load_EE_Session', true ) ) {
146
+		if ( ! apply_filters('FHEE_load_EE_Session', true)) {
147 147
 			return;
148 148
 		}
149
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
150
-		if ( ! defined( 'ESPRESSO_SESSION' ) ) {
151
-			define( 'ESPRESSO_SESSION', true );
149
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
150
+		if ( ! defined('ESPRESSO_SESSION')) {
151
+			define('ESPRESSO_SESSION', true);
152 152
 		}
153 153
 		// default session lifespan in seconds
154 154
 		$this->_lifespan = apply_filters(
@@ -162,12 +162,12 @@  discard block
 block discarded – undo
162 162
 		 * 		}
163 163
 		 */
164 164
 		// retrieve session options from db
165
-		$session_settings = (array) get_option( 'ee_session_settings', array() );
166
-		if ( ! empty( $session_settings )) {
165
+		$session_settings = (array) get_option('ee_session_settings', array());
166
+		if ( ! empty($session_settings)) {
167 167
 			// cycle though existing session options
168
-			foreach ( $session_settings as $var_name => $session_setting ) {
168
+			foreach ($session_settings as $var_name => $session_setting) {
169 169
 				// set values for class properties
170
-				$var_name = '_' . $var_name;
170
+				$var_name = '_'.$var_name;
171 171
 				$this->{$var_name} = $session_setting;
172 172
 			}
173 173
 		}
@@ -177,16 +177,16 @@  discard block
 block discarded – undo
177 177
         // encrypt data via: $this->encryption->encrypt();
178 178
         $this->encryption = $encryption;
179 179
 		// filter hook allows outside functions/classes/plugins to change default empty cart
180
-		$extra_default_session_vars = apply_filters( 'FHEE__EE_Session__construct__extra_default_session_vars', array() );
181
-		array_merge( $this->_default_session_vars, $extra_default_session_vars );
180
+		$extra_default_session_vars = apply_filters('FHEE__EE_Session__construct__extra_default_session_vars', array());
181
+		array_merge($this->_default_session_vars, $extra_default_session_vars);
182 182
 		// apply default session vars
183 183
 		$this->_set_defaults();
184 184
          add_action('AHEE__EE_System__initialize', array($this, 'open_session'));
185 185
          // check request for 'clear_session' param
186
-		add_action( 'AHEE__EE_Request_Handler__construct__complete', array( $this, 'wp_loaded' ));
186
+		add_action('AHEE__EE_Request_Handler__construct__complete', array($this, 'wp_loaded'));
187 187
 		// once everything is all said and done,
188
-		add_action( 'shutdown', array( $this, 'update' ), 100 );
189
-		add_action( 'shutdown', array( $this, 'garbage_collection' ), 999 );
188
+		add_action('shutdown', array($this, 'update'), 100);
189
+		add_action('shutdown', array($this, 'garbage_collection'), 999);
190 190
 	}
191 191
 
192 192
 
@@ -274,11 +274,11 @@  discard block
 block discarded – undo
274 274
 	 */
275 275
 	private function _set_defaults() {
276 276
 		// set some defaults
277
-		foreach ( $this->_default_session_vars as $key => $default_var ) {
278
-			if ( is_array( $default_var )) {
279
-				$this->_session_data[ $key ] = array();
277
+		foreach ($this->_default_session_vars as $key => $default_var) {
278
+			if (is_array($default_var)) {
279
+				$this->_session_data[$key] = array();
280 280
 			} else {
281
-				$this->_session_data[ $key ] = '';
281
+				$this->_session_data[$key] = '';
282 282
 			}
283 283
 		}
284 284
 	}
@@ -333,7 +333,7 @@  discard block
 block discarded – undo
333 333
 	  * @param \EE_Checkout $checkout
334 334
 	  * @return bool
335 335
 	  */
336
-	 public function set_checkout( EE_Checkout $checkout ) {
336
+	 public function set_checkout(EE_Checkout $checkout) {
337 337
 		 $this->_session_data['checkout'] = $checkout;
338 338
 		 return TRUE;
339 339
 	 }
@@ -366,9 +366,9 @@  discard block
 block discarded – undo
366 366
 	  * @return bool
367 367
 	  * @throws \EE_Error
368 368
 	  */
369
-	 public function set_transaction( EE_Transaction $transaction ) {
369
+	 public function set_transaction(EE_Transaction $transaction) {
370 370
 		 // first remove the session from the transaction before we save the transaction in the session
371
-		 $transaction->set_txn_session_data( NULL );
371
+		 $transaction->set_txn_session_data(NULL);
372 372
 		 $this->_session_data['transaction'] = $transaction;
373 373
 		 return TRUE;
374 374
 	 }
@@ -404,15 +404,15 @@  discard block
 block discarded – undo
404 404
 	  * @param bool $reset_cache
405 405
 	  * @return    array
406 406
 	  */
407
-	public function get_session_data( $key = NULL, $reset_cache = FALSE ) {
408
-		if ( $reset_cache ) {
407
+	public function get_session_data($key = NULL, $reset_cache = FALSE) {
408
+		if ($reset_cache) {
409 409
 			$this->reset_cart();
410 410
 			$this->reset_checkout();
411 411
 			$this->reset_transaction();
412 412
 		}
413
-		 if ( ! empty( $key ))  {
414
-			return  isset( $this->_session_data[ $key ] ) ? $this->_session_data[ $key ] : NULL;
415
-		}  else  {
413
+		 if ( ! empty($key)) {
414
+			return  isset($this->_session_data[$key]) ? $this->_session_data[$key] : NULL;
415
+		} else {
416 416
 			return $this->_session_data;
417 417
 		}
418 418
 	}
@@ -425,20 +425,20 @@  discard block
 block discarded – undo
425 425
 	  * @param 	array $data
426 426
 	  * @return 	TRUE on success, FALSE on fail
427 427
 	  */
428
-	public function set_session_data( $data ) {
428
+	public function set_session_data($data) {
429 429
 
430 430
 		// nothing ??? bad data ??? go home!
431
-		if ( empty( $data ) || ! is_array( $data )) {
432
-			EE_Error::add_error( __( 'No session data or invalid session data was provided.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
431
+		if (empty($data) || ! is_array($data)) {
432
+			EE_Error::add_error(__('No session data or invalid session data was provided.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
433 433
 			return FALSE;
434 434
 		}
435 435
 
436
-		foreach ( $data as $key =>$value ) {
437
-			if ( isset( $this->_default_session_vars[ $key ] )) {
438
-				EE_Error::add_error( sprintf( __( 'Sorry! %s is a default session datum and can not be reset.', 'event_espresso' ), $key ), __FILE__, __FUNCTION__, __LINE__ );
436
+		foreach ($data as $key =>$value) {
437
+			if (isset($this->_default_session_vars[$key])) {
438
+				EE_Error::add_error(sprintf(__('Sorry! %s is a default session datum and can not be reset.', 'event_espresso'), $key), __FILE__, __FUNCTION__, __LINE__);
439 439
 				return FALSE;
440 440
 			} else {
441
-				$this->_session_data[ $key ] = $value;
441
+				$this->_session_data[$key] = $value;
442 442
 			}
443 443
 		}
444 444
 
@@ -456,9 +456,9 @@  discard block
 block discarded – undo
456 456
 	  * @throws \EE_Error
457 457
 	  */
458 458
 	private function _espresso_session() {
459
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
459
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
460 460
 		// check that session has started
461
-		if ( session_id() === '' ) {
461
+		if (session_id() === '') {
462 462
 			//starts a new session if one doesn't already exist, or re-initiates an existing one
463 463
 			session_start();
464 464
 		}
@@ -467,39 +467,39 @@  discard block
 block discarded – undo
467 467
 		// and the visitors IP
468 468
 		$this->_ip_address = $this->_visitor_ip();
469 469
 		// set the "user agent"
470
-		$this->_user_agent = isset($_SERVER['HTTP_USER_AGENT']) ? esc_attr( $_SERVER['HTTP_USER_AGENT'] ) : FALSE;
470
+		$this->_user_agent = isset($_SERVER['HTTP_USER_AGENT']) ? esc_attr($_SERVER['HTTP_USER_AGENT']) : FALSE;
471 471
 		// now let's retrieve what's in the db
472 472
         $session_data = $this->_retrieve_session_data();
473
-        if (! empty($session_data)) {
473
+        if ( ! empty($session_data)) {
474 474
             // get the current time in UTC
475
-			$this->_time = isset( $this->_time ) ? $this->_time : time();
475
+			$this->_time = isset($this->_time) ? $this->_time : time();
476 476
 			// and reset the session expiration
477
-			$this->_expiration = isset( $session_data['expiration'] )
477
+			$this->_expiration = isset($session_data['expiration'])
478 478
 				? $session_data['expiration']
479 479
 				: $this->_time + $this->_lifespan;
480 480
 		} else {
481 481
             // set initial site access time and the session expiration
482 482
 			$this->_set_init_access_and_expiration();
483 483
 			// set referer
484
-			$this->_session_data[ 'pages_visited' ][ $this->_session_data['init_access'] ] = isset( $_SERVER['HTTP_REFERER'] )
485
-				? esc_attr( $_SERVER['HTTP_REFERER'] )
484
+			$this->_session_data['pages_visited'][$this->_session_data['init_access']] = isset($_SERVER['HTTP_REFERER'])
485
+				? esc_attr($_SERVER['HTTP_REFERER'])
486 486
 				: '';
487 487
 			// no previous session = go back and create one (on top of the data above)
488 488
 			return FALSE;
489 489
 		}
490 490
         // now the user agent
491
-		if ( $session_data['user_agent'] !== $this->_user_agent ) {
491
+		if ($session_data['user_agent'] !== $this->_user_agent) {
492 492
 			return FALSE;
493 493
 		}
494 494
 		// wait a minute... how old are you?
495
-		if ( $this->_time > $this->_expiration ) {
495
+		if ($this->_time > $this->_expiration) {
496 496
 			// yer too old fer me!
497 497
             $this->_expired = true;
498 498
 			// wipe out everything that isn't a default session datum
499
-			$this->clear_session( __CLASS__, __FUNCTION__ );
499
+			$this->clear_session(__CLASS__, __FUNCTION__);
500 500
 		}
501 501
 		// make event espresso session data available to plugin
502
-		$this->_session_data = array_merge( $this->_session_data, $session_data );
502
+		$this->_session_data = array_merge($this->_session_data, $session_data);
503 503
 		return TRUE;
504 504
 
505 505
 	}
@@ -515,7 +515,7 @@  discard block
 block discarded – undo
515 515
       */
516 516
      protected function _retrieve_session_data()
517 517
      {
518
-         $ssn_key = EE_Session::session_id_prefix . $this->_sid;
518
+         $ssn_key = EE_Session::session_id_prefix.$this->_sid;
519 519
          try {
520 520
              // we're using WP's Transient API to store session data using the PHP session ID as the option name
521 521
              $session_data = get_transient($ssn_key);
@@ -523,12 +523,12 @@  discard block
 block discarded – undo
523 523
 		         return array();
524 524
              }
525 525
              if (apply_filters('FHEE__EE_Session___perform_session_id_hash_check', WP_DEBUG)) {
526
-                 $hash_check = get_transient(EE_Session::hash_check_prefix . $this->_sid);
526
+                 $hash_check = get_transient(EE_Session::hash_check_prefix.$this->_sid);
527 527
                  if ($hash_check && $hash_check !== md5($session_data)) {
528 528
 	                 EE_Error::add_error(
529 529
                          sprintf(
530 530
                              __('The stored data for session %1$s failed to pass a hash check and therefore appears to be invalid.', 'event_espresso'),
531
-                             EE_Session::session_id_prefix . $this->_sid
531
+                             EE_Session::session_id_prefix.$this->_sid
532 532
                          ),
533 533
                          __FILE__, __FUNCTION__, __LINE__
534 534
                      );
@@ -540,17 +540,17 @@  discard block
 block discarded – undo
540 540
              $row = $wpdb->get_row(
541 541
                  $wpdb->prepare(
542 542
                      "SELECT option_value FROM {$wpdb->options} WHERE option_name = %s LIMIT 1",
543
-                     '_transient_' . $ssn_key
543
+                     '_transient_'.$ssn_key
544 544
                  )
545 545
              );
546 546
              $session_data = is_object($row) ? $row->option_value : null;
547 547
              if ($session_data) {
548 548
                  $session_data = preg_replace_callback(
549 549
                      '!s:(d+):"(.*?)";!',
550
-                     function ($match) {
550
+                     function($match) {
551 551
                          return $match[1] === strlen($match[2])
552 552
                              ? $match[0]
553
-                             : 's:' . strlen($match[2]) . ':"' . $match[2] . '";';
553
+                             : 's:'.strlen($match[2]).':"'.$match[2].'";';
554 554
                      },
555 555
                      $session_data
556 556
                  );
@@ -571,7 +571,7 @@  discard block
 block discarded – undo
571 571
                      'event_espresso'
572 572
                  );
573 573
                  $msg .= WP_DEBUG
574
-                     ? '<br><pre>' . print_r($session_data, true) . '</pre><br>' . $this->find_serialize_error($session_data)
574
+                     ? '<br><pre>'.print_r($session_data, true).'</pre><br>'.$this->find_serialize_error($session_data)
575 575
                      : '';
576 576
                  throw new InvalidSessionDataException($msg, 0, $e);
577 577
              }
@@ -584,11 +584,11 @@  discard block
 block discarded – undo
584 584
                  'event_espresso'
585 585
              );
586 586
              $msg .= WP_DEBUG
587
-                 ? '<br><pre>' . print_r($session_data, true) . '</pre><br>' . $this->find_serialize_error($session_data)
587
+                 ? '<br><pre>'.print_r($session_data, true).'</pre><br>'.$this->find_serialize_error($session_data)
588 588
                  : '';
589 589
 	         throw new InvalidSessionDataException($msg);
590 590
          }
591
-	     if ( isset( $this->_session_data['transaction'] ) && absint( $this->_session_data['transaction'] ) !== 0 ) {
591
+	     if (isset($this->_session_data['transaction']) && absint($this->_session_data['transaction']) !== 0) {
592 592
 		     $this->_session_data['transaction'] = EEM_Transaction::instance()->get_one_by_ID(
593 593
 			     $this->_session_data['transaction']
594 594
 	         );
@@ -609,12 +609,12 @@  discard block
 block discarded – undo
609 609
 	  */
610 610
 	protected function _generate_session_id() {
611 611
 		// check if the SID was passed explicitly, otherwise get from session, then add salt and hash it to reduce length
612
-		if ( isset( $_REQUEST[ 'EESID' ] ) ) {
613
-			$session_id = sanitize_text_field( $_REQUEST[ 'EESID' ] );
612
+		if (isset($_REQUEST['EESID'])) {
613
+			$session_id = sanitize_text_field($_REQUEST['EESID']);
614 614
 		} else {
615
-			$session_id = md5( session_id() . get_current_blog_id() . $this->_get_sid_salt() );
615
+			$session_id = md5(session_id().get_current_blog_id().$this->_get_sid_salt());
616 616
 		}
617
-		return apply_filters( 'FHEE__EE_Session___generate_session_id__session_id', $session_id );
617
+		return apply_filters('FHEE__EE_Session___generate_session_id__session_id', $session_id);
618 618
 	}
619 619
 
620 620
 
@@ -626,20 +626,20 @@  discard block
 block discarded – undo
626 626
 	  */
627 627
 	protected function _get_sid_salt() {
628 628
 		// was session id salt already saved to db ?
629
-		if ( empty( $this->_sid_salt ) ) {
629
+		if (empty($this->_sid_salt)) {
630 630
 			// no?  then maybe use WP defined constant
631
-			if ( defined( 'AUTH_SALT' ) ) {
631
+			if (defined('AUTH_SALT')) {
632 632
 				$this->_sid_salt = AUTH_SALT;
633 633
 			}
634 634
 			// if salt doesn't exist or is too short
635
-			if ( empty( $this->_sid_salt ) || strlen( $this->_sid_salt ) < 32 ) {
635
+			if (empty($this->_sid_salt) || strlen($this->_sid_salt) < 32) {
636 636
 				// create a new one
637
-				$this->_sid_salt = wp_generate_password( 64 );
637
+				$this->_sid_salt = wp_generate_password(64);
638 638
 			}
639 639
 			// and save it as a permanent session setting
640
-			$session_settings = get_option( 'ee_session_settings' );
641
-			$session_settings[ 'sid_salt' ] = $this->_sid_salt;
642
-			update_option( 'ee_session_settings', $session_settings );
640
+			$session_settings = get_option('ee_session_settings');
641
+			$session_settings['sid_salt'] = $this->_sid_salt;
642
+			update_option('ee_session_settings', $session_settings);
643 643
 		}
644 644
 		return $this->_sid_salt;
645 645
 	}
@@ -667,19 +667,19 @@  discard block
 block discarded – undo
667 667
 	  * @param bool $new_session
668 668
 	  * @return TRUE on success, FALSE on fail
669 669
 	  */
670
-	public function update( $new_session = FALSE ) {
671
-		$this->_session_data = isset( $this->_session_data )
672
-			&& is_array( $this->_session_data )
673
-			&& isset( $this->_session_data['id'])
670
+	public function update($new_session = FALSE) {
671
+		$this->_session_data = isset($this->_session_data)
672
+			&& is_array($this->_session_data)
673
+			&& isset($this->_session_data['id'])
674 674
 			? $this->_session_data
675 675
 			: array();
676
-		if ( empty( $this->_session_data )) {
676
+		if (empty($this->_session_data)) {
677 677
 			$this->_set_defaults();
678 678
 		}
679 679
 		$session_data = array();
680
-		foreach ( $this->_session_data as $key => $value ) {
680
+		foreach ($this->_session_data as $key => $value) {
681 681
 
682
-			switch( $key ) {
682
+			switch ($key) {
683 683
 
684 684
 				case 'id' :
685 685
 					// session ID
@@ -697,7 +697,7 @@  discard block
 block discarded – undo
697 697
 				break;
698 698
 
699 699
 				case 'init_access' :
700
-					$session_data['init_access'] = absint( $value );
700
+					$session_data['init_access'] = absint($value);
701 701
 				break;
702 702
 
703 703
 				case 'last_access' :
@@ -707,7 +707,7 @@  discard block
 block discarded – undo
707 707
 
708 708
 				case 'expiration' :
709 709
 					// when the session expires
710
-					$session_data['expiration'] = ! empty( $this->_expiration )
710
+					$session_data['expiration'] = ! empty($this->_expiration)
711 711
 						? $this->_expiration
712 712
 						: $session_data['init_access'] + $this->_lifespan;
713 713
 				break;
@@ -719,11 +719,11 @@  discard block
 block discarded – undo
719 719
 
720 720
 				case 'pages_visited' :
721 721
 					$page_visit = $this->_get_page_visit();
722
-					if ( $page_visit ) {
722
+					if ($page_visit) {
723 723
 						// set pages visited where the first will be the http referrer
724
-						$this->_session_data[ 'pages_visited' ][ $this->_time ] = $page_visit;
724
+						$this->_session_data['pages_visited'][$this->_time] = $page_visit;
725 725
 						// we'll only save the last 10 page visits.
726
-						$session_data[ 'pages_visited' ] = array_slice( $this->_session_data['pages_visited'], -10 );
726
+						$session_data['pages_visited'] = array_slice($this->_session_data['pages_visited'], -10);
727 727
 					}
728 728
 				break;
729 729
 
@@ -737,9 +737,9 @@  discard block
 block discarded – undo
737 737
 
738 738
 		$this->_session_data = $session_data;
739 739
 		// creating a new session does not require saving to the db just yet
740
-		if ( ! $new_session ) {
740
+		if ( ! $new_session) {
741 741
 			// ready? let's save
742
-			if ( $this->_save_session_to_db() ) {
742
+			if ($this->_save_session_to_db()) {
743 743
 				return TRUE;
744 744
 			} else {
745 745
 				return FALSE;
@@ -758,9 +758,9 @@  discard block
 block discarded – undo
758 758
 	 * 	@return bool
759 759
 	 */
760 760
 	private function _create_espresso_session( ) {
761
-		do_action( 'AHEE_log', __CLASS__, __FUNCTION__, '' );
761
+		do_action('AHEE_log', __CLASS__, __FUNCTION__, '');
762 762
 		// use the update function for now with $new_session arg set to TRUE
763
-		return  $this->update( TRUE ) ? TRUE : FALSE;
763
+		return  $this->update(TRUE) ? TRUE : FALSE;
764 764
 	}
765 765
 
766 766
 
@@ -786,15 +786,15 @@  discard block
 block discarded – undo
786 786
 				// OR an admin request that is NOT AJAX
787 787
 				|| (
788 788
 					is_admin()
789
-					&& ! ( defined( 'DOING_AJAX' ) && DOING_AJAX )
789
+					&& ! (defined('DOING_AJAX') && DOING_AJAX)
790 790
 				)
791 791
 			)
792 792
 		) {
793 793
 			return false;
794 794
 		}
795 795
 		$transaction = $this->transaction();
796
-		if ( $transaction instanceof EE_Transaction ) {
797
-			if ( ! $transaction->ID() ) {
796
+		if ($transaction instanceof EE_Transaction) {
797
+			if ( ! $transaction->ID()) {
798 798
 				$transaction->save();
799 799
 			}
800 800
 			$this->_session_data['transaction'] = $transaction->ID();
@@ -802,13 +802,13 @@  discard block
 block discarded – undo
802 802
 		// then serialize all of our session data
803 803
 		$session_data = serialize($this->_session_data);
804 804
 		// do we need to also encode it to avoid corrupted data when saved to the db?
805
-		$session_data = $this->_use_encryption ? $this->encryption->base64_string_encode( $session_data ) : $session_data;
805
+		$session_data = $this->_use_encryption ? $this->encryption->base64_string_encode($session_data) : $session_data;
806 806
 		// maybe save hash check
807
-		if ( apply_filters( 'FHEE__EE_Session___perform_session_id_hash_check', WP_DEBUG ) ) {
808
-			set_transient( EE_Session::hash_check_prefix . $this->_sid, md5( $session_data ), $this->_lifespan );
807
+		if (apply_filters('FHEE__EE_Session___perform_session_id_hash_check', WP_DEBUG)) {
808
+			set_transient(EE_Session::hash_check_prefix.$this->_sid, md5($session_data), $this->_lifespan);
809 809
 		}
810 810
 		// we're using the Transient API for storing session data, cuz it's so damn simple -> set_transient(  transient ID, data, expiry )
811
-		return set_transient( EE_Session::session_id_prefix . $this->_sid, $session_data, $this->_lifespan );
811
+		return set_transient(EE_Session::session_id_prefix.$this->_sid, $session_data, $this->_lifespan);
812 812
 	}
813 813
 
814 814
 
@@ -834,10 +834,10 @@  discard block
 block discarded – undo
834 834
 			'HTTP_FORWARDED',
835 835
 			'REMOTE_ADDR'
836 836
 		);
837
-		foreach ( $server_keys as $key ){
838
-			if ( isset( $_SERVER[ $key ] )) {
839
-				foreach ( array_map( 'trim', explode( ',', $_SERVER[ $key ] )) as $ip ) {
840
-					if ( $ip === '127.0.0.1' || filter_var( $ip, FILTER_VALIDATE_IP ) !== FALSE ) {
837
+		foreach ($server_keys as $key) {
838
+			if (isset($_SERVER[$key])) {
839
+				foreach (array_map('trim', explode(',', $_SERVER[$key])) as $ip) {
840
+					if ($ip === '127.0.0.1' || filter_var($ip, FILTER_VALIDATE_IP) !== FALSE) {
841 841
 						$visitor_ip = $ip;
842 842
 					}
843 843
 				}
@@ -856,32 +856,32 @@  discard block
 block discarded – undo
856 856
 	 *			@return string
857 857
 	 */
858 858
 	public function _get_page_visit() {
859
-		$page_visit = home_url('/') . 'wp-admin/admin-ajax.php';
859
+		$page_visit = home_url('/').'wp-admin/admin-ajax.php';
860 860
 		// check for request url
861
-		if ( isset( $_SERVER['REQUEST_URI'] )) {
861
+		if (isset($_SERVER['REQUEST_URI'])) {
862 862
 			$http_host = '';
863 863
 			$page_id = '?';
864 864
 			$e_reg = '';
865
-			$request_uri = esc_url( $_SERVER['REQUEST_URI'] );
866
-			$ru_bits = explode( '?', $request_uri );
865
+			$request_uri = esc_url($_SERVER['REQUEST_URI']);
866
+			$ru_bits = explode('?', $request_uri);
867 867
 			$request_uri = $ru_bits[0];
868 868
 			// check for and grab host as well
869
-			if ( isset( $_SERVER['HTTP_HOST'] )) {
870
-				$http_host = esc_url( $_SERVER['HTTP_HOST'] );
869
+			if (isset($_SERVER['HTTP_HOST'])) {
870
+				$http_host = esc_url($_SERVER['HTTP_HOST']);
871 871
 			}
872 872
 			// check for page_id in SERVER REQUEST
873
-			if ( isset( $_REQUEST['page_id'] )) {
873
+			if (isset($_REQUEST['page_id'])) {
874 874
 				// rebuild $e_reg without any of the extra parameters
875
-				$page_id = '?page_id=' . esc_attr( $_REQUEST['page_id'] ) . '&amp;';
875
+				$page_id = '?page_id='.esc_attr($_REQUEST['page_id']).'&amp;';
876 876
 			}
877 877
 			// check for $e_reg in SERVER REQUEST
878
-			if ( isset( $_REQUEST['ee'] )) {
878
+			if (isset($_REQUEST['ee'])) {
879 879
 				// rebuild $e_reg without any of the extra parameters
880
-				$e_reg = 'ee=' . esc_attr( $_REQUEST['ee'] );
880
+				$e_reg = 'ee='.esc_attr($_REQUEST['ee']);
881 881
 			}
882
-			$page_visit = rtrim( $http_host . $request_uri . $page_id . $e_reg, '?' );
882
+			$page_visit = rtrim($http_host.$request_uri.$page_id.$e_reg, '?');
883 883
 		}
884
-		return $page_visit !== home_url( '/wp-admin/admin-ajax.php' ) ? $page_visit : '';
884
+		return $page_visit !== home_url('/wp-admin/admin-ajax.php') ? $page_visit : '';
885 885
 
886 886
 	}
887 887
 
@@ -910,14 +910,14 @@  discard block
 block discarded – undo
910 910
 	  * @param string $function
911 911
 	  * @return void
912 912
 	  */
913
-	public function clear_session( $class = '', $function = '' ) {
913
+	public function clear_session($class = '', $function = '') {
914 914
 		//echo '<h3 style="color:#999;line-height:.9em;"><span style="color:#2EA2CC">' . __CLASS__ . '</span>::<span style="color:#E76700">' . __FUNCTION__ . '( ' . $class . '::' . $function . '() )</span><br/><span style="font-size:9px;font-weight:normal;">' . __FILE__ . '</span>    <b style="font-size:10px;">  ' . __LINE__ . ' </b></h3>';
915
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, 'session cleared by : ' . $class . '::' .  $function . '()' );
915
+		do_action('AHEE_log', __FILE__, __FUNCTION__, 'session cleared by : '.$class.'::'.$function.'()');
916 916
 		$this->reset_cart();
917 917
 		$this->reset_checkout();
918 918
 		$this->reset_transaction();
919 919
 		// wipe out everything that isn't a default session datum
920
-		$this->reset_data( array_keys( $this->_session_data ));
920
+		$this->reset_data(array_keys($this->_session_data));
921 921
 		// reset initial site access time and the session expiration
922 922
 		$this->_set_init_access_and_expiration();
923 923
 		$this->_save_session_to_db();
@@ -932,42 +932,42 @@  discard block
 block discarded – undo
932 932
 	  * @param bool  $show_all_notices
933 933
 	  * @return TRUE on success, FALSE on fail
934 934
 	  */
935
-	public function reset_data( $data_to_reset = array(), $show_all_notices = FALSE ) {
935
+	public function reset_data($data_to_reset = array(), $show_all_notices = FALSE) {
936 936
 		// if $data_to_reset is not in an array, then put it in one
937
-		if ( ! is_array( $data_to_reset ) ) {
938
-			$data_to_reset = array ( $data_to_reset );
937
+		if ( ! is_array($data_to_reset)) {
938
+			$data_to_reset = array($data_to_reset);
939 939
 		}
940 940
 		// nothing ??? go home!
941
-		if ( empty( $data_to_reset )) {
942
-			EE_Error::add_error( __( 'No session data could be reset, because no session var name was provided.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
941
+		if (empty($data_to_reset)) {
942
+			EE_Error::add_error(__('No session data could be reset, because no session var name was provided.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
943 943
 			return FALSE;
944 944
 		}
945 945
 		$return_value = TRUE;
946 946
 		// since $data_to_reset is an array, cycle through the values
947
-		foreach ( $data_to_reset as $reset ) {
947
+		foreach ($data_to_reset as $reset) {
948 948
 
949 949
 			// first check to make sure it is a valid session var
950
-			if ( isset( $this->_session_data[ $reset ] )) {
950
+			if (isset($this->_session_data[$reset])) {
951 951
 				// then check to make sure it is not a default var
952
-				if ( ! array_key_exists( $reset, $this->_default_session_vars )) {
952
+				if ( ! array_key_exists($reset, $this->_default_session_vars)) {
953 953
 					// remove session var
954
-					unset( $this->_session_data[ $reset ] );
955
-					if ( $show_all_notices ) {
956
-						EE_Error::add_success( sprintf( __( 'The session variable %s was removed.', 'event_espresso' ), $reset ), __FILE__, __FUNCTION__, __LINE__ );
954
+					unset($this->_session_data[$reset]);
955
+					if ($show_all_notices) {
956
+						EE_Error::add_success(sprintf(__('The session variable %s was removed.', 'event_espresso'), $reset), __FILE__, __FUNCTION__, __LINE__);
957 957
 					}
958
-					$return_value = !isset($return_value) ? TRUE : $return_value;
958
+					$return_value = ! isset($return_value) ? TRUE : $return_value;
959 959
 
960 960
 				} else {
961 961
 					// yeeeeeeeeerrrrrrrrrrr OUT !!!!
962
-					if ( $show_all_notices ) {
963
-						EE_Error::add_error( sprintf( __( 'Sorry! %s is a default session datum and can not be reset.', 'event_espresso' ), $reset ), __FILE__, __FUNCTION__, __LINE__ );
962
+					if ($show_all_notices) {
963
+						EE_Error::add_error(sprintf(__('Sorry! %s is a default session datum and can not be reset.', 'event_espresso'), $reset), __FILE__, __FUNCTION__, __LINE__);
964 964
 					}
965 965
 					$return_value = FALSE;
966 966
 				}
967 967
 
968
-			} else if ( $show_all_notices ) {
968
+			} else if ($show_all_notices) {
969 969
 				// oops! that session var does not exist!
970
-				EE_Error::add_error( sprintf( __( 'The session item provided, %s, is invalid or does not exist.', 'event_espresso' ), $reset ), __FILE__, __FUNCTION__, __LINE__ );
970
+				EE_Error::add_error(sprintf(__('The session item provided, %s, is invalid or does not exist.', 'event_espresso'), $reset), __FILE__, __FUNCTION__, __LINE__);
971 971
 				$return_value = FALSE;
972 972
 			}
973 973
 
@@ -987,8 +987,8 @@  discard block
 block discarded – undo
987 987
 	 *   @access public
988 988
 	 */
989 989
 	public function wp_loaded() {
990
-		if ( isset(  EE_Registry::instance()->REQ ) && EE_Registry::instance()->REQ->is_set( 'clear_session' )) {
991
-			$this->clear_session( __CLASS__, __FUNCTION__ );
990
+		if (isset(EE_Registry::instance()->REQ) && EE_Registry::instance()->REQ->is_set('clear_session')) {
991
+			$this->clear_session(__CLASS__, __FUNCTION__);
992 992
 		}
993 993
 	}
994 994
 
@@ -1013,24 +1013,24 @@  discard block
 block discarded – undo
1013 1013
 	  */
1014 1014
 	 public function garbage_collection() {
1015 1015
 		 // only perform during regular requests
1016
-		 if ( ! defined( 'DOING_AJAX') || ! DOING_AJAX ) {
1016
+		 if ( ! defined('DOING_AJAX') || ! DOING_AJAX) {
1017 1017
 			 /** @type WPDB $wpdb */
1018 1018
 			 global $wpdb;
1019 1019
 			 // since transient expiration timestamps are set in the future, we can compare against NOW
1020 1020
 			 $expiration = time();
1021
-			 $too_far_in_the_the_future = $expiration + ( $this->_lifespan * 2 );
1021
+			 $too_far_in_the_the_future = $expiration + ($this->_lifespan * 2);
1022 1022
 			 // filter the query limit. Set to 0 to turn off garbage collection
1023
-			 $expired_session_transient_delete_query_limit = absint( apply_filters( 'FHEE__EE_Session__garbage_collection___expired_session_transient_delete_query_limit', 50 ));
1023
+			 $expired_session_transient_delete_query_limit = absint(apply_filters('FHEE__EE_Session__garbage_collection___expired_session_transient_delete_query_limit', 50));
1024 1024
 			 // non-zero LIMIT means take out the trash
1025
-			 if ( $expired_session_transient_delete_query_limit ) {
1025
+			 if ($expired_session_transient_delete_query_limit) {
1026 1026
 				 //array of transient keys that require garbage collection
1027 1027
 				 $session_keys = array(
1028 1028
 					 EE_Session::session_id_prefix,
1029 1029
 					 EE_Session::hash_check_prefix,
1030 1030
 				 );
1031
-				 foreach ( $session_keys as $session_key ) {
1032
-					 $session_key = str_replace( '_', '\_', $session_key );
1033
-					 $session_key = '\_transient\_timeout\_' . $session_key . '%';
1031
+				 foreach ($session_keys as $session_key) {
1032
+					 $session_key = str_replace('_', '\_', $session_key);
1033
+					 $session_key = '\_transient\_timeout\_'.$session_key.'%';
1034 1034
 					 $SQL = "
1035 1035
 					SELECT option_name
1036 1036
 					FROM {$wpdb->options}
@@ -1046,8 +1046,8 @@  discard block
 block discarded – undo
1046 1046
                         // format array of results into something usable within the actual DELETE query's IN clause
1047 1047
                         $expired = array();
1048 1048
                         foreach ($expired_sessions as $expired_session) {
1049
-                            $expired[] = "'" . $expired_session . "'";
1050
-                            $expired[] = "'" . str_replace('timeout_', '', $expired_session) . "'";
1049
+                            $expired[] = "'".$expired_session."'";
1050
+                            $expired[] = "'".str_replace('timeout_', '', $expired_session)."'";
1051 1051
                         }
1052 1052
                         $expired = implode(', ', $expired);
1053 1053
                         $SQL = "
@@ -1055,10 +1055,10 @@  discard block
 block discarded – undo
1055 1055
 						WHERE option_name
1056 1056
 						IN ( $expired );
1057 1057
 					 ";
1058
-						 $results = $wpdb->query( $SQL );
1058
+						 $results = $wpdb->query($SQL);
1059 1059
 						 // if something went wrong, then notify the admin
1060
-						 if ( $results instanceof WP_Error && is_admin() ) {
1061
-							 EE_Error::add_error( $results->get_error_message(), __FILE__, __FUNCTION__, __LINE__ );
1060
+						 if ($results instanceof WP_Error && is_admin()) {
1061
+							 EE_Error::add_error($results->get_error_message(), __FILE__, __FUNCTION__, __LINE__);
1062 1062
 						 }
1063 1063
 					 }
1064 1064
 				 }
@@ -1079,34 +1079,34 @@  discard block
 block discarded – undo
1079 1079
 	  * @param $data1
1080 1080
 	  * @return string
1081 1081
 	  */
1082
-	 private function find_serialize_error( $data1 ) {
1082
+	 private function find_serialize_error($data1) {
1083 1083
 		$error = "<pre>";
1084 1084
 		 $data2 = preg_replace_callback(
1085 1085
 			 '!s:(\d+):"(.*?)";!',
1086
-			 function ( $match ) {
1087
-				 return ( $match[1] === strlen( $match[2] ) )
1086
+			 function($match) {
1087
+				 return ($match[1] === strlen($match[2]))
1088 1088
 					 ? $match[0]
1089 1089
 					 : 's:'
1090
-					   . strlen( $match[2] )
1090
+					   . strlen($match[2])
1091 1091
 					   . ':"'
1092 1092
 					   . $match[2]
1093 1093
 					   . '";';
1094 1094
 			 },
1095 1095
 			 $data1
1096 1096
 		 );
1097
-		$max = ( strlen( $data1 ) > strlen( $data2 ) ) ? strlen( $data1 ) : strlen( $data2 );
1098
-		$error .= $data1 . PHP_EOL;
1099
-		$error .= $data2 . PHP_EOL;
1100
-		for ( $i = 0; $i < $max; $i++ ) {
1101
-			if ( @$data1[ $i ] !== @$data2[ $i ] ) {
1102
-				$error .= "Difference " . @$data1[ $i ] . " != " . @$data2[ $i ] . PHP_EOL;
1103
-				$error .= "\t-> ORD number " . ord( @$data1[ $i ] ) . " != " . ord( @$data2[ $i ] ) . PHP_EOL;
1104
-				$error .= "\t-> Line Number = $i" . PHP_EOL;
1105
-				$start = ( $i - 20 );
1106
-				$start = ( $start < 0 ) ? 0 : $start;
1097
+		$max = (strlen($data1) > strlen($data2)) ? strlen($data1) : strlen($data2);
1098
+		$error .= $data1.PHP_EOL;
1099
+		$error .= $data2.PHP_EOL;
1100
+		for ($i = 0; $i < $max; $i++) {
1101
+			if (@$data1[$i] !== @$data2[$i]) {
1102
+				$error .= "Difference ".@$data1[$i]." != ".@$data2[$i].PHP_EOL;
1103
+				$error .= "\t-> ORD number ".ord(@$data1[$i])." != ".ord(@$data2[$i]).PHP_EOL;
1104
+				$error .= "\t-> Line Number = $i".PHP_EOL;
1105
+				$start = ($i - 20);
1106
+				$start = ($start < 0) ? 0 : $start;
1107 1107
 				$length = 40;
1108 1108
 				$point = $max - $i;
1109
-				if ( $point < 20 ) {
1109
+				if ($point < 20) {
1110 1110
 					$rlength = 1;
1111 1111
 					$rpoint = -$point;
1112 1112
 				} else {
@@ -1115,16 +1115,16 @@  discard block
 block discarded – undo
1115 1115
 				}
1116 1116
 				$error .= "\t-> Section Data1  = ";
1117 1117
 				$error .= substr_replace(
1118
-					substr( $data1, $start, $length ),
1119
-					"<b style=\"color:green\">{$data1[ $i ]}</b>",
1118
+					substr($data1, $start, $length),
1119
+					"<b style=\"color:green\">{$data1[$i]}</b>",
1120 1120
 					$rpoint,
1121 1121
 					$rlength
1122 1122
 				);
1123 1123
 				$error .= PHP_EOL;
1124 1124
 				$error .= "\t-> Section Data2  = ";
1125 1125
 				$error .= substr_replace(
1126
-					substr( $data2, $start, $length ),
1127
-					"<b style=\"color:red\">{$data2[ $i ]}</b>",
1126
+					substr($data2, $start, $length),
1127
+					"<b style=\"color:red\">{$data2[$i]}</b>",
1128 1128
 					$rpoint,
1129 1129
 					$rlength
1130 1130
 				);
Please login to merge, or discard this patch.
Doc Comments   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -423,7 +423,7 @@  discard block
 block discarded – undo
423 423
 	  * set session data
424 424
 	  * @access 	public
425 425
 	  * @param 	array $data
426
-	  * @return 	TRUE on success, FALSE on fail
426
+	  * @return 	boolean on success, FALSE on fail
427 427
 	  */
428 428
 	public function set_session_data( $data ) {
429 429
 
@@ -451,7 +451,7 @@  discard block
 block discarded – undo
451 451
 	 /**
452 452
 	  * @initiate session
453 453
 	  * @access   private
454
-	  * @return TRUE on success, FALSE on fail
454
+	  * @return boolean on success, FALSE on fail
455 455
 	  * @throws \EventEspresso\core\exceptions\InvalidSessionDataException
456 456
 	  * @throws \EE_Error
457 457
 	  */
@@ -665,7 +665,7 @@  discard block
 block discarded – undo
665 665
 	  * @update session data  prior to saving to the db
666 666
 	  * @access public
667 667
 	  * @param bool $new_session
668
-	  * @return TRUE on success, FALSE on fail
668
+	  * @return boolean on success, FALSE on fail
669 669
 	  */
670 670
 	public function update( $new_session = FALSE ) {
671 671
 		$this->_session_data = isset( $this->_session_data )
@@ -930,7 +930,7 @@  discard block
 block discarded – undo
930 930
 	  * @access public
931 931
 	  * @param array $data_to_reset
932 932
 	  * @param bool  $show_all_notices
933
-	  * @return TRUE on success, FALSE on fail
933
+	  * @return boolean on success, FALSE on fail
934 934
 	  */
935 935
 	public function reset_data( $data_to_reset = array(), $show_all_notices = FALSE ) {
936 936
 		// if $data_to_reset is not in an array, then put it in one
Please login to merge, or discard this patch.
core/exceptions/InvalidSessionDataException.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 namespace EventEspresso\core\exceptions;
3 3
 
4
-defined( 'ABSPATH' ) || exit;
4
+defined('ABSPATH') || exit;
5 5
 
6 6
 
7 7
 
@@ -22,11 +22,11 @@  discard block
 block discarded – undo
22 22
 	 * @param int        $code
23 23
 	 * @param \Exception $previous
24 24
 	 */
25
-	public function __construct( $message = '', $code = 0, \Exception $previous = null ) {
26
-		if ( empty( $message ) ) {
27
-			$message = esc_html__( 'The session data is either missing or invalid.', 'event_espresso' );
25
+	public function __construct($message = '', $code = 0, \Exception $previous = null) {
26
+		if (empty($message)) {
27
+			$message = esc_html__('The session data is either missing or invalid.', 'event_espresso');
28 28
 		}
29
-		parent::__construct( $message, $code, $previous );
29
+		parent::__construct($message, $code, $previous);
30 30
 	}
31 31
 
32 32
 
Please login to merge, or discard this patch.