Completed
Branch FET-5580-registration-cancella... (d3ffee)
by
unknown
498:10 queued 484:24
created
modules/single_page_checkout/EED_Single_Page_Checkout.module.php 3 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@
 block discarded – undo
1
-<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 /**
3 5
  * Event Espresso
4 6
  *
Please login to merge, or discard this patch.
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
 	 *    process_registration_from_admin
281 281
 	 *
282 282
 	 * @access    public
283
-	 * @return    int
283
+	 * @return    EE_Transaction
284 284
 	 */
285 285
 	public static function process_registration_from_admin() {
286 286
 		EED_Single_Page_Checkout::load_reg_steps();
@@ -608,7 +608,7 @@  discard block
 block discarded – undo
608 608
 	 * _get_transaction_and_cart_for_previous_visit
609 609
 	 *
610 610
 	 * @access private
611
-	 * 	@return mixed EE_Transaction|NULL
611
+	 * 	@return EE_Transaction|null EE_Transaction|NULL
612 612
 	 */
613 613
 	private function _get_transaction_and_cart_for_previous_visit() {
614 614
 		/** @var $TXN_model EEM_Transaction */
@@ -677,7 +677,7 @@  discard block
 block discarded – undo
677 677
 	 * 	generates a new EE_Transaction object and adds it to the $_transaction property.
678 678
 	 *
679 679
 	 * 	@access private
680
-	 * 	@return mixed EE_Transaction|NULL
680
+	 * 	@return EE_Transaction|null EE_Transaction|NULL
681 681
 	 */
682 682
 	private function _initialize_transaction() {
683 683
 		try {
Please login to merge, or discard this patch.
Spacing   +273 added lines, -273 removed lines patch added patch discarded remove patch
@@ -38,8 +38,8 @@  discard block
 block discarded – undo
38 38
 	 * @return EED_Single_Page_Checkout
39 39
 	 */
40 40
 	public static function instance() {
41
-		add_filter( 'EED_Single_Page_Checkout__SPCO_active', '__return_true' );
42
-		return parent::get_instance( __CLASS__ );
41
+		add_filter('EED_Single_Page_Checkout__SPCO_active', '__return_true');
42
+		return parent::get_instance(__CLASS__);
43 43
 	}
44 44
 
45 45
 
@@ -84,22 +84,22 @@  discard block
 block discarded – undo
84 84
 	 */
85 85
 	public static function set_hooks_admin() {
86 86
 		EED_Single_Page_Checkout::set_definitions();
87
-		if ( defined( 'DOING_AJAX' )) {
87
+		if (defined('DOING_AJAX')) {
88 88
 			// going to start an output buffer in case anything gets accidentally output that might disrupt our JSON response
89 89
 			ob_start();
90 90
 			EED_Single_Page_Checkout::load_request_handler();
91 91
 			EED_Single_Page_Checkout::load_reg_steps();
92 92
 		} else {
93 93
 			// hook into the top of pre_get_posts to set the reg step routing, which gives other modules or plugins a chance to modify the reg steps, but just before the routes get called
94
-			add_action( 'pre_get_posts', array( 'EED_Single_Page_Checkout', 'load_reg_steps' ), 1 );
94
+			add_action('pre_get_posts', array('EED_Single_Page_Checkout', 'load_reg_steps'), 1);
95 95
 		}
96 96
 		// set ajax hooks
97
-		add_action( 'wp_ajax_process_reg_step', array( 'EED_Single_Page_Checkout', 'process_reg_step' ));
98
-		add_action( 'wp_ajax_nopriv_process_reg_step', array( 'EED_Single_Page_Checkout', 'process_reg_step' ));
99
-		add_action( 'wp_ajax_display_spco_reg_step', array( 'EED_Single_Page_Checkout', 'display_reg_step' ));
100
-		add_action( 'wp_ajax_nopriv_display_spco_reg_step', array( 'EED_Single_Page_Checkout', 'display_reg_step' ));
101
-		add_action( 'wp_ajax_update_reg_step', array( 'EED_Single_Page_Checkout', 'update_reg_step' ));
102
-		add_action( 'wp_ajax_nopriv_update_reg_step', array( 'EED_Single_Page_Checkout', 'update_reg_step' ));
97
+		add_action('wp_ajax_process_reg_step', array('EED_Single_Page_Checkout', 'process_reg_step'));
98
+		add_action('wp_ajax_nopriv_process_reg_step', array('EED_Single_Page_Checkout', 'process_reg_step'));
99
+		add_action('wp_ajax_display_spco_reg_step', array('EED_Single_Page_Checkout', 'display_reg_step'));
100
+		add_action('wp_ajax_nopriv_display_spco_reg_step', array('EED_Single_Page_Checkout', 'display_reg_step'));
101
+		add_action('wp_ajax_update_reg_step', array('EED_Single_Page_Checkout', 'update_reg_step'));
102
+		add_action('wp_ajax_nopriv_update_reg_step', array('EED_Single_Page_Checkout', 'update_reg_step'));
103 103
 	}
104 104
 
105 105
 
@@ -108,8 +108,8 @@  discard block
 block discarded – undo
108 108
 	 * 	process ajax request
109 109
 	 * @param string $ajax_action
110 110
 	 */
111
-	public static function process_ajax_request( $ajax_action ) {
112
-		EE_Registry::instance()->REQ->set( 'action', $ajax_action );
111
+	public static function process_ajax_request($ajax_action) {
112
+		EE_Registry::instance()->REQ->set('action', $ajax_action);
113 113
 		EED_Single_Page_Checkout::instance()->_initialize();
114 114
 	}
115 115
 
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 	 * 	ajax display registration step
120 120
 	 */
121 121
 	public static function display_reg_step() {
122
-		EED_Single_Page_Checkout::process_ajax_request( 'display_spco_reg_step' );
122
+		EED_Single_Page_Checkout::process_ajax_request('display_spco_reg_step');
123 123
 	}
124 124
 
125 125
 
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
 	 * 	ajax process registration step
129 129
 	 */
130 130
 	public static function process_reg_step() {
131
-		EED_Single_Page_Checkout::process_ajax_request( 'process_reg_step' );
131
+		EED_Single_Page_Checkout::process_ajax_request('process_reg_step');
132 132
 	}
133 133
 
134 134
 
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
 	 * 	ajax process registration step
138 138
 	 */
139 139
 	public static function update_reg_step() {
140
-		EED_Single_Page_Checkout::process_ajax_request( 'update_reg_step' );
140
+		EED_Single_Page_Checkout::process_ajax_request('update_reg_step');
141 141
 	}
142 142
 
143 143
 
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
 	 * @return void
150 150
 	 */
151 151
 	public static function update_checkout() {
152
-		EED_Single_Page_Checkout::process_ajax_request( 'update_checkout' );
152
+		EED_Single_Page_Checkout::process_ajax_request('update_checkout');
153 153
 	}
154 154
 
155 155
 
@@ -162,8 +162,8 @@  discard block
 block discarded – undo
162 162
 	 */
163 163
 	public static function load_request_handler() {
164 164
 		// load core Request_Handler class
165
-		if ( ! isset( EE_Registry::instance()->REQ )) {
166
-			EE_Registry::instance()->load_core( 'Request_Handler' );
165
+		if ( ! isset(EE_Registry::instance()->REQ)) {
166
+			EE_Registry::instance()->load_core('Request_Handler');
167 167
 		}
168 168
 	}
169 169
 
@@ -176,14 +176,14 @@  discard block
 block discarded – undo
176 176
 	 *  @return 	void
177 177
 	 */
178 178
 	public static function set_definitions() {
179
-		define( 'SPCO_BASE_PATH', rtrim( str_replace( array( '\\', '/' ), DS, plugin_dir_path( __FILE__ )), DS ) . DS );
180
-		define( 'SPCO_CSS_URL', plugin_dir_url( __FILE__ ) . 'css' . DS );
181
-		define( 'SPCO_IMG_URL', plugin_dir_url( __FILE__ ) . 'img' . DS );
182
-		define( 'SPCO_JS_URL', plugin_dir_url( __FILE__ ) . 'js' . DS );
183
-		define( 'SPCO_INC_PATH', SPCO_BASE_PATH . 'inc' . DS );
184
-		define( 'SPCO_REG_STEPS_PATH', SPCO_BASE_PATH . 'reg_steps' . DS );
185
-		define( 'SPCO_TEMPLATES_PATH', SPCO_BASE_PATH . 'templates' . DS );
186
-		EEH_Autoloader::register_autoloaders_for_each_file_in_folder( SPCO_BASE_PATH, TRUE );
179
+		define('SPCO_BASE_PATH', rtrim(str_replace(array('\\', '/'), DS, plugin_dir_path(__FILE__)), DS).DS);
180
+		define('SPCO_CSS_URL', plugin_dir_url(__FILE__).'css'.DS);
181
+		define('SPCO_IMG_URL', plugin_dir_url(__FILE__).'img'.DS);
182
+		define('SPCO_JS_URL', plugin_dir_url(__FILE__).'js'.DS);
183
+		define('SPCO_INC_PATH', SPCO_BASE_PATH.'inc'.DS);
184
+		define('SPCO_REG_STEPS_PATH', SPCO_BASE_PATH.'reg_steps'.DS);
185
+		define('SPCO_TEMPLATES_PATH', SPCO_BASE_PATH.'templates'.DS);
186
+		EEH_Autoloader::register_autoloaders_for_each_file_in_folder(SPCO_BASE_PATH, TRUE);
187 187
 	}
188 188
 
189 189
 
@@ -198,31 +198,31 @@  discard block
 block discarded – undo
198 198
 	 */
199 199
 	public static function load_reg_steps() {
200 200
 		static $reg_steps_loaded = FALSE;
201
-		if ( $reg_steps_loaded ) {
201
+		if ($reg_steps_loaded) {
202 202
 			return;
203 203
 		}
204 204
 		// load EE_SPCO_Reg_Step base class
205 205
 //		EE_Registry::instance()->load_file( SPCO_INC_PATH, 'EE_SPCO_Reg_Step', 'class'  );
206 206
 		// filter list of reg_steps
207
-		$reg_steps_to_load = apply_filters( 'AHEE__SPCO__load_reg_steps__reg_steps_to_load', EED_Single_Page_Checkout::get_reg_steps() );
207
+		$reg_steps_to_load = apply_filters('AHEE__SPCO__load_reg_steps__reg_steps_to_load', EED_Single_Page_Checkout::get_reg_steps());
208 208
 		// sort by key (order)
209
-		ksort( $reg_steps_to_load );
209
+		ksort($reg_steps_to_load);
210 210
 		// loop through folders
211
-		foreach ( $reg_steps_to_load as $order => $reg_step ) {
211
+		foreach ($reg_steps_to_load as $order => $reg_step) {
212 212
 			// we need a
213
-			if ( isset( $reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'] )) {
213
+			if (isset($reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'])) {
214 214
 				// copy over to the reg_steps_array
215
-				EED_Single_Page_Checkout::$_reg_steps_array[ $order ] = $reg_step;
215
+				EED_Single_Page_Checkout::$_reg_steps_array[$order] = $reg_step;
216 216
 				// register custom key route for each reg step ( ie: step=>"slug" - this is the entire reason we load the reg steps array now )
217
-				EE_Config::register_route( $reg_step['slug'], 'EED_Single_Page_Checkout', 'run', 'step' );
217
+				EE_Config::register_route($reg_step['slug'], 'EED_Single_Page_Checkout', 'run', 'step');
218 218
 				// add AJAX or other hooks
219
-				if ( isset( $reg_step['has_hooks'] ) && $reg_step['has_hooks'] ) {
219
+				if (isset($reg_step['has_hooks']) && $reg_step['has_hooks']) {
220 220
 					// setup autoloaders if necessary
221
-					if ( ! class_exists( $reg_step['class_name'] )) {
222
-						EEH_Autoloader::register_autoloaders_for_each_file_in_folder( $reg_step['file_path'], TRUE );
221
+					if ( ! class_exists($reg_step['class_name'])) {
222
+						EEH_Autoloader::register_autoloaders_for_each_file_in_folder($reg_step['file_path'], TRUE);
223 223
 					}
224
-					if ( is_callable( $reg_step['class_name'], 'set_hooks' )) {
225
-						call_user_func( array( $reg_step['class_name'], 'set_hooks' ));
224
+					if (is_callable($reg_step['class_name'], 'set_hooks')) {
225
+						call_user_func(array($reg_step['class_name'], 'set_hooks'));
226 226
 					}
227 227
 				}
228 228
 			}
@@ -241,28 +241,28 @@  discard block
 block discarded – undo
241 241
 	 */
242 242
 	public static function get_reg_steps() {
243 243
 		$reg_steps = EE_Registry::instance()->CFG->registration->reg_steps;
244
-		if ( empty( $reg_steps )) {
244
+		if (empty($reg_steps)) {
245 245
 			$reg_steps = array(
246 246
 				10 => array(
247
-					'file_path' => SPCO_REG_STEPS_PATH . 'attendee_information',
247
+					'file_path' => SPCO_REG_STEPS_PATH.'attendee_information',
248 248
 					'class_name' => 'EE_SPCO_Reg_Step_Attendee_Information',
249 249
 					'slug' => 'attendee_information',
250 250
 					'has_hooks' => FALSE
251 251
 				),
252 252
 				20 => array(
253
-					'file_path' => SPCO_REG_STEPS_PATH . 'registration_confirmation',
253
+					'file_path' => SPCO_REG_STEPS_PATH.'registration_confirmation',
254 254
 					'class_name' => 'EE_SPCO_Reg_Step_Registration_Confirmation',
255 255
 					'slug' => 'registration_confirmation',
256 256
 					'has_hooks' => FALSE
257 257
 				),
258 258
 				30 => array(
259
-					'file_path' => SPCO_REG_STEPS_PATH . 'payment_options',
259
+					'file_path' => SPCO_REG_STEPS_PATH.'payment_options',
260 260
 					'class_name' => 'EE_SPCO_Reg_Step_Payment_Options',
261 261
 					'slug' => 'payment_options',
262 262
 					'has_hooks' => TRUE
263 263
 				),
264 264
 				999 => array(
265
-					'file_path' => SPCO_REG_STEPS_PATH . 'finalize_registration',
265
+					'file_path' => SPCO_REG_STEPS_PATH.'finalize_registration',
266 266
 					'class_name' => 'EE_SPCO_Reg_Step_Finalize_Registration',
267 267
 					'slug' => 'finalize_registration',
268 268
 					'has_hooks' => FALSE
@@ -282,9 +282,9 @@  discard block
 block discarded – undo
282 282
 	 */
283 283
 	public static function registration_checkout_for_admin() {
284 284
 		EED_Single_Page_Checkout::load_reg_steps();
285
-		EE_Registry::instance()->REQ->set( 'step', 'attendee_information' );
286
-		EE_Registry::instance()->REQ->set( 'action', 'display_spco_reg_step' );
287
-		EE_Registry::instance()->REQ->set( 'process_form_submission', false );
285
+		EE_Registry::instance()->REQ->set('step', 'attendee_information');
286
+		EE_Registry::instance()->REQ->set('action', 'display_spco_reg_step');
287
+		EE_Registry::instance()->REQ->set('process_form_submission', false);
288 288
 		EED_Single_Page_Checkout::instance()->_initialize();
289 289
 		EED_Single_Page_Checkout::instance()->_display_spco_reg_form();
290 290
 		return EE_Registry::instance()->REQ->get_output();
@@ -300,14 +300,14 @@  discard block
 block discarded – undo
300 300
 	 */
301 301
 	public static function process_registration_from_admin() {
302 302
 		EED_Single_Page_Checkout::load_reg_steps();
303
-		EE_Registry::instance()->REQ->set( 'step', 'attendee_information' );
304
-		EE_Registry::instance()->REQ->set( 'action', 'process_reg_step' );
305
-		EE_Registry::instance()->REQ->set( 'process_form_submission', true );
303
+		EE_Registry::instance()->REQ->set('step', 'attendee_information');
304
+		EE_Registry::instance()->REQ->set('action', 'process_reg_step');
305
+		EE_Registry::instance()->REQ->set('process_form_submission', true);
306 306
 		EED_Single_Page_Checkout::instance()->_initialize();
307
-		if ( EED_Single_Page_Checkout::instance()->checkout->current_step->completed() ) {
308
-			$final_reg_step = end( EED_Single_Page_Checkout::instance()->checkout->reg_steps );
309
-			if ( $final_reg_step instanceof EE_SPCO_Reg_Step_Finalize_Registration ) {
310
-				if ( $final_reg_step->process_reg_step() ) {
307
+		if (EED_Single_Page_Checkout::instance()->checkout->current_step->completed()) {
308
+			$final_reg_step = end(EED_Single_Page_Checkout::instance()->checkout->reg_steps);
309
+			if ($final_reg_step instanceof EE_SPCO_Reg_Step_Finalize_Registration) {
310
+				if ($final_reg_step->process_reg_step()) {
311 311
 					return EED_Single_Page_Checkout::instance()->checkout->transaction;
312 312
 				}
313 313
 			}
@@ -324,8 +324,8 @@  discard block
 block discarded – undo
324 324
 	 * @param WP_Query $WP_Query
325 325
 	 * @return    void
326 326
 	 */
327
-	public function run( $WP_Query ) {
328
-		if ( $WP_Query instanceof WP_Query && $WP_Query->is_main_query() && apply_filters( 'FHEE__EED_Single_Page_Checkout__run', true )) {
327
+	public function run($WP_Query) {
328
+		if ($WP_Query instanceof WP_Query && $WP_Query->is_main_query() && apply_filters('FHEE__EED_Single_Page_Checkout__run', true)) {
329 329
 			$this->_initialize();
330 330
 		}
331 331
 	}
@@ -340,8 +340,8 @@  discard block
 block discarded – undo
340 340
 	 * @param WP_Query $WP_Query
341 341
 	 * @return    void
342 342
 	 */
343
-	public static function init( $WP_Query ) {
344
-		EED_Single_Page_Checkout::instance()->run( $WP_Query );
343
+	public static function init($WP_Query) {
344
+		EED_Single_Page_Checkout::instance()->run($WP_Query);
345 345
 	}
346 346
 
347 347
 
@@ -355,32 +355,32 @@  discard block
 block discarded – undo
355 355
 	 */
356 356
 	private function _initialize() {
357 357
 		// ensure SPCO doesn't run twice
358
-		if ( EED_Single_Page_Checkout::$_initialized ) {
358
+		if (EED_Single_Page_Checkout::$_initialized) {
359 359
 			return;
360 360
 		}
361 361
 		// setup the EE_Checkout object
362 362
 		$this->checkout = $this->_initialize_checkout();
363 363
 		// filter checkout
364
-		$this->checkout = apply_filters( 'FHEE__EED_Single_Page_Checkout___initialize__checkout', $this->checkout );
364
+		$this->checkout = apply_filters('FHEE__EED_Single_Page_Checkout___initialize__checkout', $this->checkout);
365 365
 		// get the $_GET
366 366
 		$this->_get_request_vars();
367 367
 		// filter continue_reg
368
-		$this->checkout->continue_reg = apply_filters( 'FHEE__EED_Single_Page_Checkout__init___continue_reg', TRUE, $this->checkout );
368
+		$this->checkout->continue_reg = apply_filters('FHEE__EED_Single_Page_Checkout__init___continue_reg', TRUE, $this->checkout);
369 369
 		// load the reg steps array
370
-		if ( ! $this->_load_and_instantiate_reg_steps() ) {
370
+		if ( ! $this->_load_and_instantiate_reg_steps()) {
371 371
 			EED_Single_Page_Checkout::$_initialized = true;
372 372
 			return;
373 373
 		}
374 374
 		// set the current step
375
-		$this->checkout->set_current_step( $this->checkout->step );
375
+		$this->checkout->set_current_step($this->checkout->step);
376 376
 		// and the next step
377 377
 		$this->checkout->set_next_step();
378 378
 		// was there already a valid transaction in the checkout from the session ?
379
-		if ( ! $this->checkout->transaction instanceof EE_Transaction ) {
379
+		if ( ! $this->checkout->transaction instanceof EE_Transaction) {
380 380
 			// get transaction from db or session
381 381
 			$this->checkout->transaction = $this->checkout->reg_url_link && ! is_admin() ? $this->_get_transaction_and_cart_for_previous_visit() : $this->_get_cart_for_current_session_and_setup_new_transaction();
382
-			if ( ! $this->checkout->transaction instanceof EE_Transaction ) {
383
-				EE_Error::add_error( __( 'Your Registration and Transaction information could not be retrieved from the db.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__);
382
+			if ( ! $this->checkout->transaction instanceof EE_Transaction) {
383
+				EE_Error::add_error(__('Your Registration and Transaction information could not be retrieved from the db.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
384 384
 				// add some style and make it dance
385 385
 				$this->checkout->transaction = EE_Transaction::new_instance();
386 386
 				$this->add_styles_and_scripts();
@@ -388,10 +388,10 @@  discard block
 block discarded – undo
388 388
 				return;
389 389
 			}
390 390
 			// and the registrations for the transaction
391
-			$this->_get_registrations( $this->checkout->transaction );
391
+			$this->_get_registrations($this->checkout->transaction);
392 392
 		}
393 393
 		// verify that everything has been setup correctly
394
-		if ( ! $this->_final_verifications() ) {
394
+		if ( ! $this->_final_verifications()) {
395 395
 			EED_Single_Page_Checkout::$_initialized = true;
396 396
 			return;
397 397
 		}
@@ -416,9 +416,9 @@  discard block
 block discarded – undo
416 416
 		// set no cache headers and constants
417 417
 		EE_System::do_not_cache();
418 418
 		// add anchor
419
-		add_action( 'loop_start', array( $this, 'set_checkout_anchor' ), 1 );
419
+		add_action('loop_start', array($this, 'set_checkout_anchor'), 1);
420 420
 		// remove transaction lock
421
-		add_action( 'shutdown', array( $this, 'unlock_transaction' ), 1 );
421
+		add_action('shutdown', array($this, 'unlock_transaction'), 1);
422 422
 	}
423 423
 
424 424
 
@@ -435,20 +435,20 @@  discard block
 block discarded – undo
435 435
 		// look in session for existing checkout
436 436
 		$checkout = EE_Registry::instance()->SSN->checkout();
437 437
 		// verify
438
-		if ( ! $checkout instanceof EE_Checkout ) {
438
+		if ( ! $checkout instanceof EE_Checkout) {
439 439
 			// instantiate EE_Checkout object for handling the properties of the current checkout process
440
-			$checkout = EE_Registry::instance()->load_file( SPCO_INC_PATH, 'EE_Checkout', 'class', array(), FALSE  );
440
+			$checkout = EE_Registry::instance()->load_file(SPCO_INC_PATH, 'EE_Checkout', 'class', array(), FALSE);
441 441
 			// verify again
442
-			if ( ! $checkout instanceof EE_Checkout ) {
443
-				throw new EE_Error( __( 'The EE_Checkout class could not be loaded.', 'event_espresso' ) );
442
+			if ( ! $checkout instanceof EE_Checkout) {
443
+				throw new EE_Error(__('The EE_Checkout class could not be loaded.', 'event_espresso'));
444 444
 			}
445 445
 		} else {
446
-			if ( $checkout->current_step->is_final_step() && $checkout->exit_spco() === true )  {
447
-				wp_safe_redirect( $checkout->redirect_url );
446
+			if ($checkout->current_step->is_final_step() && $checkout->exit_spco() === true) {
447
+				wp_safe_redirect($checkout->redirect_url);
448 448
 				exit();
449 449
 			}
450 450
 		}
451
-		$checkout = apply_filters( 'FHEE__EED_Single_Page_Checkout___initialize_checkout__checkout', $checkout );
451
+		$checkout = apply_filters('FHEE__EED_Single_Page_Checkout___initialize_checkout__checkout', $checkout);
452 452
 		// reset anything that needs a clean slate for each request
453 453
 		$checkout->reset_for_current_request();
454 454
 		return $checkout;
@@ -466,22 +466,22 @@  discard block
 block discarded – undo
466 466
 		// load classes
467 467
 		EED_Single_Page_Checkout::load_request_handler();
468 468
 		//make sure this request is marked as belonging to EE
469
-		EE_Registry::instance()->REQ->set_espresso_page( TRUE );
469
+		EE_Registry::instance()->REQ->set_espresso_page(TRUE);
470 470
 		// which step is being requested ?
471
-		$this->checkout->step = EE_Registry::instance()->REQ->get( 'step', $this->_get_first_step() );
471
+		$this->checkout->step = EE_Registry::instance()->REQ->get('step', $this->_get_first_step());
472 472
 		// which step is being edited ?
473
-		$this->checkout->edit_step = EE_Registry::instance()->REQ->get( 'edit_step', '' );
473
+		$this->checkout->edit_step = EE_Registry::instance()->REQ->get('edit_step', '');
474 474
 		// and what we're doing on the current step
475
-		$this->checkout->action = EE_Registry::instance()->REQ->get( 'action', 'display_spco_reg_step' );
475
+		$this->checkout->action = EE_Registry::instance()->REQ->get('action', 'display_spco_reg_step');
476 476
 		// returning to edit ?
477
-		$this->checkout->reg_url_link = EE_Registry::instance()->REQ->get( 'e_reg_url_link', '' );
477
+		$this->checkout->reg_url_link = EE_Registry::instance()->REQ->get('e_reg_url_link', '');
478 478
 		// or some other kind of revisit ?
479
-		$this->checkout->revisit = EE_Registry::instance()->REQ->get( 'revisit', FALSE );
479
+		$this->checkout->revisit = EE_Registry::instance()->REQ->get('revisit', FALSE);
480 480
 		// and whether or not to generate a reg form for this request
481
-		$this->checkout->generate_reg_form = EE_Registry::instance()->REQ->get( 'generate_reg_form', TRUE ); 		// TRUE 	FALSE
481
+		$this->checkout->generate_reg_form = EE_Registry::instance()->REQ->get('generate_reg_form', TRUE); // TRUE 	FALSE
482 482
 		// and whether or not to process a reg form submission for this request
483
-		$this->checkout->process_form_submission = EE_Registry::instance()->REQ->get( 'process_form_submission', FALSE ); 		// TRUE 	FALSE
484
-		$this->checkout->process_form_submission = $this->checkout->action !== 'display_spco_reg_step' ? $this->checkout->process_form_submission : FALSE; 		// TRUE 	FALSE
483
+		$this->checkout->process_form_submission = EE_Registry::instance()->REQ->get('process_form_submission', FALSE); // TRUE 	FALSE
484
+		$this->checkout->process_form_submission = $this->checkout->action !== 'display_spco_reg_step' ? $this->checkout->process_form_submission : FALSE; // TRUE 	FALSE
485 485
 		//$this->_display_request_vars();
486 486
 	}
487 487
 
@@ -494,17 +494,17 @@  discard block
 block discarded – undo
494 494
 	 * @return    void
495 495
 	 */
496 496
 	protected function _display_request_vars() {
497
-		if ( ! WP_DEBUG ) {
497
+		if ( ! WP_DEBUG) {
498 498
 			return;
499 499
 		}
500
-		EEH_Debug_Tools::printr( $_REQUEST, '$_REQUEST', __FILE__, __LINE__ );
501
-		EEH_Debug_Tools::printr( $this->checkout->step, '$this->checkout->step', __FILE__, __LINE__ );
502
-		EEH_Debug_Tools::printr( $this->checkout->edit_step, '$this->checkout->edit_step', __FILE__, __LINE__ );
503
-		EEH_Debug_Tools::printr( $this->checkout->action, '$this->checkout->action', __FILE__, __LINE__ );
504
-		EEH_Debug_Tools::printr( $this->checkout->reg_url_link, '$this->checkout->reg_url_link', __FILE__, __LINE__ );
505
-		EEH_Debug_Tools::printr( $this->checkout->revisit, '$this->checkout->revisit', __FILE__, __LINE__ );
506
-		EEH_Debug_Tools::printr( $this->checkout->generate_reg_form, '$this->checkout->generate_reg_form', __FILE__, __LINE__ );
507
-		EEH_Debug_Tools::printr( $this->checkout->process_form_submission, '$this->checkout->process_form_submission', __FILE__, __LINE__ );
500
+		EEH_Debug_Tools::printr($_REQUEST, '$_REQUEST', __FILE__, __LINE__);
501
+		EEH_Debug_Tools::printr($this->checkout->step, '$this->checkout->step', __FILE__, __LINE__);
502
+		EEH_Debug_Tools::printr($this->checkout->edit_step, '$this->checkout->edit_step', __FILE__, __LINE__);
503
+		EEH_Debug_Tools::printr($this->checkout->action, '$this->checkout->action', __FILE__, __LINE__);
504
+		EEH_Debug_Tools::printr($this->checkout->reg_url_link, '$this->checkout->reg_url_link', __FILE__, __LINE__);
505
+		EEH_Debug_Tools::printr($this->checkout->revisit, '$this->checkout->revisit', __FILE__, __LINE__);
506
+		EEH_Debug_Tools::printr($this->checkout->generate_reg_form, '$this->checkout->generate_reg_form', __FILE__, __LINE__);
507
+		EEH_Debug_Tools::printr($this->checkout->process_form_submission, '$this->checkout->process_form_submission', __FILE__, __LINE__);
508 508
 	}
509 509
 
510 510
 
@@ -518,8 +518,8 @@  discard block
 block discarded – undo
518 518
 	 * @return    array
519 519
 	 */
520 520
 	private function _get_first_step() {
521
-		$first_step = reset( EED_Single_Page_Checkout::$_reg_steps_array );
522
-		return isset( $first_step['slug'] ) ? $first_step['slug'] : 'attendee_information';
521
+		$first_step = reset(EED_Single_Page_Checkout::$_reg_steps_array);
522
+		return isset($first_step['slug']) ? $first_step['slug'] : 'attendee_information';
523 523
 	}
524 524
 
525 525
 
@@ -535,37 +535,37 @@  discard block
 block discarded – undo
535 535
 	private function _load_and_instantiate_reg_steps() {
536 536
 		// have reg_steps already been instantiated ?
537 537
 		if (
538
-			empty( $this->checkout->reg_steps ) ||
539
-			apply_filters( 'FHEE__Single_Page_Checkout__load_reg_steps__reload_reg_steps', false, $this->checkout )
538
+			empty($this->checkout->reg_steps) ||
539
+			apply_filters('FHEE__Single_Page_Checkout__load_reg_steps__reload_reg_steps', false, $this->checkout)
540 540
 		) {
541 541
 			// if not, then loop through raw reg steps array
542
-			foreach ( EED_Single_Page_Checkout::$_reg_steps_array as $order => $reg_step ) {
543
-				if ( ! $this->_load_and_instantiate_reg_step( $reg_step, $order )) {
542
+			foreach (EED_Single_Page_Checkout::$_reg_steps_array as $order => $reg_step) {
543
+				if ( ! $this->_load_and_instantiate_reg_step($reg_step, $order)) {
544 544
 					return false;
545 545
 				}
546 546
 			}
547 547
 			EE_Registry::instance()->CFG->registration->skip_reg_confirmation = TRUE;
548 548
 			EE_Registry::instance()->CFG->registration->reg_confirmation_last = TRUE;
549 549
 			// skip the registration_confirmation page ?
550
-			if ( EE_Registry::instance()->CFG->registration->skip_reg_confirmation ) {
550
+			if (EE_Registry::instance()->CFG->registration->skip_reg_confirmation) {
551 551
 				// just remove it from the reg steps array
552
-				$this->checkout->remove_reg_step( 'registration_confirmation', false );
553
-			} else if ( EE_Registry::instance()->CFG->registration->reg_confirmation_last && isset( 	$this->checkout->reg_steps['registration_confirmation'] )) {
552
+				$this->checkout->remove_reg_step('registration_confirmation', false);
553
+			} else if (EE_Registry::instance()->CFG->registration->reg_confirmation_last && isset($this->checkout->reg_steps['registration_confirmation'])) {
554 554
 				// set the order to something big like 100
555
-				$this->checkout->set_reg_step_order( 'registration_confirmation', 100 );
555
+				$this->checkout->set_reg_step_order('registration_confirmation', 100);
556 556
 			}
557 557
 			// filter the array for good luck
558
-			$this->checkout->reg_steps = apply_filters( 'FHEE__Single_Page_Checkout__load_reg_steps__reg_steps', $this->checkout->reg_steps );
558
+			$this->checkout->reg_steps = apply_filters('FHEE__Single_Page_Checkout__load_reg_steps__reg_steps', $this->checkout->reg_steps);
559 559
 			// finally re-sort based on the reg step class order properties
560 560
 			$this->checkout->sort_reg_steps();
561 561
 		} else {
562
-			foreach ( $this->checkout->reg_steps as $reg_step ) {
562
+			foreach ($this->checkout->reg_steps as $reg_step) {
563 563
 				// set all current step stati to FALSE
564
-				$reg_step->set_is_current_step( FALSE );
564
+				$reg_step->set_is_current_step(FALSE);
565 565
 			}
566 566
 		}
567
-		if ( empty( $this->checkout->reg_steps )) {
568
-			EE_Error::add_error( __( 'No Reg Steps were loaded..', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__);
567
+		if (empty($this->checkout->reg_steps)) {
568
+			EE_Error::add_error(__('No Reg Steps were loaded..', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
569 569
 			return false;
570 570
 		}
571 571
 			// make reg step details available to JS
@@ -583,34 +583,34 @@  discard block
 block discarded – undo
583 583
 	 * @param int   $order
584 584
 	 * @return bool
585 585
 	 */
586
-	private function _load_and_instantiate_reg_step( $reg_step = array(), $order = 0 ) {
586
+	private function _load_and_instantiate_reg_step($reg_step = array(), $order = 0) {
587 587
 
588 588
 		// we need a file_path, class_name, and slug to add a reg step
589
-		if ( isset( $reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'] )) {
589
+		if (isset($reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'])) {
590 590
 			// if editing a specific step, but this is NOT that step... (and it's not the 'finalize_registration' step)
591
-			if ( $this->checkout->reg_url_link && $this->checkout->step !== $reg_step['slug'] && $reg_step['slug'] !== 'finalize_registration' ) {
591
+			if ($this->checkout->reg_url_link && $this->checkout->step !== $reg_step['slug'] && $reg_step['slug'] !== 'finalize_registration') {
592 592
 				return true;
593 593
 			}
594 594
 			// instantiate step class using file path and class name
595
-			$reg_step_obj = EE_Registry::instance()->load_file( $reg_step['file_path'], $reg_step['class_name'], 'class', $this->checkout, FALSE  );
595
+			$reg_step_obj = EE_Registry::instance()->load_file($reg_step['file_path'], $reg_step['class_name'], 'class', $this->checkout, FALSE);
596 596
 			// did we gets the goods ?
597
-			if ( $reg_step_obj instanceof EE_SPCO_Reg_Step ) {
597
+			if ($reg_step_obj instanceof EE_SPCO_Reg_Step) {
598 598
 				// set reg step order based on config
599
-				$reg_step_obj->set_order( $order );
599
+				$reg_step_obj->set_order($order);
600 600
 				// add instantiated reg step object to the master reg steps array
601
-				$this->checkout->add_reg_step( $reg_step_obj );
601
+				$this->checkout->add_reg_step($reg_step_obj);
602 602
 			} else {
603
-				EE_Error::add_error( __( 'The current step could not be set.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
603
+				EE_Error::add_error(__('The current step could not be set.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
604 604
 				return false;
605 605
 			}
606 606
 		} else {
607
-			if ( WP_DEBUG ) {
607
+			if (WP_DEBUG) {
608 608
 				EE_Error::add_error(
609 609
 					sprintf(
610
-						__( 'A registration step could not be loaded. One or more of the following data points is invalid:%4$s%5$sFile Path: %1$s%6$s%5$sClass Name: %2$s%6$s%5$sSlug: %3$s%6$s%7$s', 'event_espresso' ),
611
-						isset( $reg_step['file_path'] ) ? $reg_step['file_path'] : '',
612
-						isset( $reg_step['class_name'] ) ? $reg_step['class_name'] : '',
613
-						isset( $reg_step['slug'] ) ? $reg_step['slug'] : '',
610
+						__('A registration step could not be loaded. One or more of the following data points is invalid:%4$s%5$sFile Path: %1$s%6$s%5$sClass Name: %2$s%6$s%5$sSlug: %3$s%6$s%7$s', 'event_espresso'),
611
+						isset($reg_step['file_path']) ? $reg_step['file_path'] : '',
612
+						isset($reg_step['class_name']) ? $reg_step['class_name'] : '',
613
+						isset($reg_step['slug']) ? $reg_step['slug'] : '',
614 614
 						'<ul>',
615 615
 						'<li>',
616 616
 						'</li>',
@@ -634,16 +634,16 @@  discard block
 block discarded – undo
634 634
 	 */
635 635
 	private function _get_transaction_and_cart_for_previous_visit() {
636 636
 		/** @var $TXN_model EEM_Transaction */
637
-		$TXN_model = EE_Registry::instance()->load_model( 'Transaction' );
637
+		$TXN_model = EE_Registry::instance()->load_model('Transaction');
638 638
 		// because the reg_url_link is present in the request, this is a return visit to SPCO, so we'll get the transaction data from the db
639
-		$transaction = $TXN_model->get_transaction_from_reg_url_link( $this->checkout->reg_url_link );
639
+		$transaction = $TXN_model->get_transaction_from_reg_url_link($this->checkout->reg_url_link);
640 640
 		// verify transaction
641
-		if ( $transaction instanceof EE_Transaction ) {
641
+		if ($transaction instanceof EE_Transaction) {
642 642
 			// and get the cart that was used for that transaction
643
-			$this->checkout->cart = $this->_get_cart_for_transaction( $transaction );
643
+			$this->checkout->cart = $this->_get_cart_for_transaction($transaction);
644 644
 			return $transaction;
645 645
 		} else {
646
-			EE_Error::add_error( __( 'Your Registration and Transaction information could not be retrieved from the db.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__);
646
+			EE_Error::add_error(__('Your Registration and Transaction information could not be retrieved from the db.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
647 647
 			return NULL;
648 648
 		}
649 649
 	}
@@ -657,11 +657,11 @@  discard block
 block discarded – undo
657 657
 	 * @param EE_Transaction $transaction
658 658
 	 * @return EE_Cart
659 659
 	 */
660
-	private function _get_cart_for_transaction( $transaction ) {
661
-		$cart = $transaction instanceof EE_Transaction ? EE_Cart::get_cart_from_txn( $transaction ) : NULL;
660
+	private function _get_cart_for_transaction($transaction) {
661
+		$cart = $transaction instanceof EE_Transaction ? EE_Cart::get_cart_from_txn($transaction) : NULL;
662 662
 		// verify cart
663
-		if ( ! $cart instanceof EE_Cart ) {
664
-			$cart = EE_Registry::instance()->load_core( 'Cart' );
663
+		if ( ! $cart instanceof EE_Cart) {
664
+			$cart = EE_Registry::instance()->load_core('Cart');
665 665
 		}
666 666
 		return $cart;
667 667
 	}
@@ -676,8 +676,8 @@  discard block
 block discarded – undo
676 676
 	 * @param EE_Transaction $transaction
677 677
 	 * 	@return EE_Cart
678 678
 	 */
679
-	public function get_cart_for_transaction( EE_Transaction $transaction ) {
680
-		return EE_Cart::get_cart_from_txn( $transaction );
679
+	public function get_cart_for_transaction(EE_Transaction $transaction) {
680
+		return EE_Cart::get_cart_from_txn($transaction);
681 681
 	}
682 682
 
683 683
 
@@ -692,17 +692,17 @@  discard block
 block discarded – undo
692 692
 	private function _get_cart_for_current_session_and_setup_new_transaction() {
693 693
 		//  if there's no transaction, then this is the FIRST visit to SPCO
694 694
 		// so load up the cart ( passing nothing for the TXN because it doesn't exist yet )
695
-		$this->checkout->cart = $this->_get_cart_for_transaction( NULL );
695
+		$this->checkout->cart = $this->_get_cart_for_transaction(NULL);
696 696
 		// and then create a new transaction
697 697
 		$transaction = $this->_initialize_transaction();
698 698
 		// verify transaction
699
-		if ( $transaction instanceof EE_Transaction ) {
699
+		if ($transaction instanceof EE_Transaction) {
700 700
 			// save it so that we have an ID for other objects to use
701 701
 			$transaction->save();
702 702
 			// and save TXN data to the cart
703
-			$this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn( $transaction->ID() );
703
+			$this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn($transaction->ID());
704 704
 		} else {
705
-			EE_Error::add_error( __( 'A Valid Transaction could not be initialized.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
705
+			EE_Error::add_error(__('A Valid Transaction could not be initialized.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
706 706
 		}
707 707
 		return $transaction;
708 708
 	}
@@ -722,15 +722,15 @@  discard block
 block discarded – undo
722 722
 			// grab the cart grand total
723 723
 			$cart_total = $this->checkout->cart->get_cart_grand_total();
724 724
 			// create new TXN
725
-			return EE_Transaction::new_instance( array(
725
+			return EE_Transaction::new_instance(array(
726 726
 				'TXN_timestamp' 	=> time(),
727 727
 				'TXN_reg_steps' 		=> $this->checkout->initialize_txn_reg_steps_array(),
728 728
 				'TXN_total' 				=> $cart_total > 0 ? $cart_total : 0,
729 729
 				'TXN_paid' 				=> 0,
730 730
 				'STS_ID' 					=> EEM_Transaction::failed_status_code,
731 731
 			));
732
-		} catch( Exception $e ) {
733
-			EE_Error::add_error( $e->getMessage(), __FILE__, __FUNCTION__, __LINE__);
732
+		} catch (Exception $e) {
733
+			EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__);
734 734
 		}
735 735
 		return NULL;
736 736
 	}
@@ -744,34 +744,34 @@  discard block
 block discarded – undo
744 744
 	 * @param EE_Transaction $transaction
745 745
 	 * @return EE_Cart
746 746
 	 */
747
-	private function _get_registrations( EE_Transaction $transaction ) {
747
+	private function _get_registrations(EE_Transaction $transaction) {
748 748
 		// first step: grab the registrants  { : o
749
-		$registrations = $transaction->registrations( $this->checkout->reg_cache_where_params, true );
749
+		$registrations = $transaction->registrations($this->checkout->reg_cache_where_params, true);
750 750
 		// verify registrations have been set
751
-		if ( empty( $registrations )) {
751
+		if (empty($registrations)) {
752 752
 			// if no cached registrations, then check the db
753
-			$registrations = $transaction->registrations( $this->checkout->reg_cache_where_params, false );
753
+			$registrations = $transaction->registrations($this->checkout->reg_cache_where_params, false);
754 754
 			// still nothing ? well as long as this isn't a revisit
755
-			if ( empty( $registrations ) && ! $this->checkout->revisit ) {
755
+			if (empty($registrations) && ! $this->checkout->revisit) {
756 756
 				// generate new registrations from scratch
757
-				$registrations = $this->_initialize_registrations( $transaction );
757
+				$registrations = $this->_initialize_registrations($transaction);
758 758
 			}
759 759
 		}
760 760
 		// sort by their original registration order
761
-		usort( $registrations, array( 'EED_Single_Page_Checkout', 'sort_registrations_by_REG_count' ));
761
+		usort($registrations, array('EED_Single_Page_Checkout', 'sort_registrations_by_REG_count'));
762 762
 		// then loop thru the array
763
-		foreach ( $registrations as $registration ) {
763
+		foreach ($registrations as $registration) {
764 764
 			// verify each registration
765
-			if ( $registration instanceof EE_Registration ) {
765
+			if ($registration instanceof EE_Registration) {
766 766
 				// we display all attendee info for the primary registrant
767
-				if ( $this->checkout->reg_url_link == $registration->reg_url_link() && $registration->is_primary_registrant() ) {
767
+				if ($this->checkout->reg_url_link == $registration->reg_url_link() && $registration->is_primary_registrant()) {
768 768
 					$this->checkout->primary_revisit = TRUE;
769 769
 					break;
770
-				} else if ( $this->checkout->revisit && $this->checkout->reg_url_link != $registration->reg_url_link() ) {
770
+				} else if ($this->checkout->revisit && $this->checkout->reg_url_link != $registration->reg_url_link()) {
771 771
 					// but hide info if it doesn't belong to you
772
-					$transaction->clear_cache( 'Registration', $registration->ID() );
772
+					$transaction->clear_cache('Registration', $registration->ID());
773 773
 				}
774
-				$this->checkout->set_reg_status_updated( $registration->ID(), false );
774
+				$this->checkout->set_reg_status_updated($registration->ID(), false);
775 775
 			}
776 776
 		}
777 777
 	}
@@ -785,17 +785,17 @@  discard block
 block discarded – undo
785 785
 	 * @param EE_Transaction $transaction
786 786
 	 * @return    array
787 787
 	 */
788
-	private function _initialize_registrations( EE_Transaction $transaction ) {
788
+	private function _initialize_registrations(EE_Transaction $transaction) {
789 789
 		$att_nmbr = 0;
790 790
 		$registrations = array();
791
-		if ( $transaction instanceof EE_Transaction ) {
791
+		if ($transaction instanceof EE_Transaction) {
792 792
 			/** @type EE_Registration_Processor $registration_processor */
793
-			$registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' );
793
+			$registration_processor = EE_Registry::instance()->load_class('Registration_Processor');
794 794
 			$this->checkout->total_ticket_count = $this->checkout->cart->all_ticket_quantity_count();
795 795
 			// now let's add the cart items to the $transaction
796
-			foreach ( $this->checkout->cart->get_tickets() as $line_item ) {
796
+			foreach ($this->checkout->cart->get_tickets() as $line_item) {
797 797
 				//do the following for each ticket of this type they selected
798
-				for ( $x = 1; $x <= $line_item->quantity(); $x++ ) {
798
+				for ($x = 1; $x <= $line_item->quantity(); $x++) {
799 799
 					$att_nmbr++;
800 800
 					$registration = $registration_processor->generate_ONE_registration_from_line_item(
801 801
 						$line_item,
@@ -803,12 +803,12 @@  discard block
 block discarded – undo
803 803
 						$att_nmbr,
804 804
 						$this->checkout->total_ticket_count
805 805
 					);
806
-					if ( $registration instanceof EE_Registration ) {
807
-						$registrations[ $registration->ID() ] = $registration;
806
+					if ($registration instanceof EE_Registration) {
807
+						$registrations[$registration->ID()] = $registration;
808 808
 					}
809 809
 				}
810 810
 			}
811
-			$registration_processor->fix_reg_final_price_rounding_issue( $transaction );
811
+			$registration_processor->fix_reg_final_price_rounding_issue($transaction);
812 812
 		}
813 813
 		return $registrations;
814 814
 	}
@@ -823,12 +823,12 @@  discard block
 block discarded – undo
823 823
 	 * @param EE_Registration $reg_B
824 824
 	 * @return array()
825 825
 	 */
826
-	public static function sort_registrations_by_REG_count( EE_Registration $reg_A, EE_Registration $reg_B ) {
826
+	public static function sort_registrations_by_REG_count(EE_Registration $reg_A, EE_Registration $reg_B) {
827 827
 		// this shouldn't ever happen within the same TXN, but oh well
828
-		if ( $reg_A->count() == $reg_B->count() ) {
828
+		if ($reg_A->count() == $reg_B->count()) {
829 829
 			return 0;
830 830
 		}
831
-		return ( $reg_A->count() > $reg_B->count() ) ? 1 : -1;
831
+		return ($reg_A->count() > $reg_B->count()) ? 1 : -1;
832 832
 	}
833 833
 
834 834
 
@@ -843,35 +843,35 @@  discard block
 block discarded – undo
843 843
 	 */
844 844
 	private function _final_verifications() {
845 845
 		// filter checkout
846
-		$this->checkout = apply_filters( 'FHEE__EED_Single_Page_Checkout___final_verifications__checkout', $this->checkout );
846
+		$this->checkout = apply_filters('FHEE__EED_Single_Page_Checkout___final_verifications__checkout', $this->checkout);
847 847
 		//verify that current step is still set correctly
848
-		if ( ! $this->checkout->current_step instanceof EE_SPCO_Reg_Step ) {
849
-			EE_Error::add_error( __( 'We\'re sorry but the registration process can not proceed because one or more registration steps were not setup correctly. Please refresh the page and try again or contact support.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
848
+		if ( ! $this->checkout->current_step instanceof EE_SPCO_Reg_Step) {
849
+			EE_Error::add_error(__('We\'re sorry but the registration process can not proceed because one or more registration steps were not setup correctly. Please refresh the page and try again or contact support.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
850 850
 			return false;
851 851
 		}
852 852
 		// if returning to SPCO, then verify that primary registrant is set
853
-		if ( ! empty( $this->checkout->reg_url_link )) {
853
+		if ( ! empty($this->checkout->reg_url_link)) {
854 854
 			$valid_registrant = $this->checkout->transaction->primary_registration();
855
-			if ( ! $valid_registrant instanceof EE_Registration ) {
856
-				EE_Error::add_error( __( 'We\'re sorry but there appears to be an error with the "reg_url_link" or the primary registrant for this transaction. Please refresh the page and try again or contact support.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
855
+			if ( ! $valid_registrant instanceof EE_Registration) {
856
+				EE_Error::add_error(__('We\'re sorry but there appears to be an error with the "reg_url_link" or the primary registrant for this transaction. Please refresh the page and try again or contact support.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
857 857
 				return false;
858 858
 			}
859 859
 			$valid_registrant = null;
860
-			foreach ( $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params ) as $registration ) {
861
-				if ( $registration instanceof EE_Registration ) {
862
-					if ( $registration->reg_url_link() == $this->checkout->reg_url_link ) {
860
+			foreach ($this->checkout->transaction->registrations($this->checkout->reg_cache_where_params) as $registration) {
861
+				if ($registration instanceof EE_Registration) {
862
+					if ($registration->reg_url_link() == $this->checkout->reg_url_link) {
863 863
 						$valid_registrant = $registration;
864 864
 					}
865 865
 				}
866 866
 			}
867
-			if ( ! $valid_registrant instanceof EE_Registration ) {
868
-				EE_Error::add_error( __( 'We\'re sorry but there appears to be an error with the "reg_url_link" or the transaction itself. Please refresh the page and try again or contact support.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
867
+			if ( ! $valid_registrant instanceof EE_Registration) {
868
+				EE_Error::add_error(__('We\'re sorry but there appears to be an error with the "reg_url_link" or the transaction itself. Please refresh the page and try again or contact support.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
869 869
 				return false;
870 870
 			}
871 871
 		}
872 872
 		// now that things have been kinda sufficiently verified,
873 873
 		// let's add the checkout to the session so that's available other systems
874
-		EE_Registry::instance()->SSN->set_checkout( $this->checkout );
874
+		EE_Registry::instance()->SSN->set_checkout($this->checkout);
875 875
 		return true;
876 876
 	}
877 877
 
@@ -887,28 +887,28 @@  discard block
 block discarded – undo
887 887
 	 * @access    private
888 888
 	 * @param bool $reinitializing
889 889
 	 */
890
-	private function _initialize_reg_steps( $reinitializing = false ) {
891
-		$this->checkout->set_reg_step_initiated( $this->checkout->current_step );
890
+	private function _initialize_reg_steps($reinitializing = false) {
891
+		$this->checkout->set_reg_step_initiated($this->checkout->current_step);
892 892
 		// loop thru all steps to call their individual "initialize" methods and set i18n strings for JS
893
-		foreach ( $this->checkout->reg_steps as $reg_step ) {
894
-			if ( ! $reg_step->initialize_reg_step() ) {
893
+		foreach ($this->checkout->reg_steps as $reg_step) {
894
+			if ( ! $reg_step->initialize_reg_step()) {
895 895
 				// if not initialized then maybe this step is being removed...
896
-				if ( $reg_step->is_current_step() && ! $reinitializing ) {
896
+				if ($reg_step->is_current_step() && ! $reinitializing) {
897 897
 					// if it was the current step, then we need to start over here
898
-					$this->_initialize_reg_steps( true );
898
+					$this->_initialize_reg_steps(true);
899 899
 					return;
900 900
 				}
901 901
 				continue;
902 902
 			}
903 903
 			// i18n
904 904
 			$reg_step->translate_js_strings();
905
-			if ( $reg_step->is_current_step() ) {
905
+			if ($reg_step->is_current_step()) {
906 906
 				// the text that appears on the reg step form submit button
907 907
 				$reg_step->set_submit_button_text();
908 908
 			}
909 909
 		}
910 910
 		// dynamically creates hook point like: AHEE__Single_Page_Checkout___initialize_reg_step__attendee_information
911
-		do_action( "AHEE__Single_Page_Checkout___initialize_reg_step__{$this->checkout->current_step->slug()}", $this->checkout->current_step );
911
+		do_action("AHEE__Single_Page_Checkout___initialize_reg_step__{$this->checkout->current_step->slug()}", $this->checkout->current_step);
912 912
 	}
913 913
 
914 914
 
@@ -921,39 +921,39 @@  discard block
 block discarded – undo
921 921
 	 */
922 922
 	private function _check_form_submission() {
923 923
 		//does this request require the reg form to be generated ?
924
-		if ( $this->checkout->generate_reg_form ) {
924
+		if ($this->checkout->generate_reg_form) {
925 925
 			// ever heard that song by Blue Rodeo ?
926 926
 			try {
927 927
 				$this->checkout->current_step->reg_form = $this->checkout->current_step->generate_reg_form();
928 928
 				// if not displaying a form, then check for form submission
929
-				if ( $this->checkout->process_form_submission && $this->checkout->current_step->reg_form->was_submitted() ) {
929
+				if ($this->checkout->process_form_submission && $this->checkout->current_step->reg_form->was_submitted()) {
930 930
 					// clear out any old data in case this step is being run again
931
-					$this->checkout->current_step->set_valid_data( array() );
931
+					$this->checkout->current_step->set_valid_data(array());
932 932
 					// capture submitted form data
933 933
 					$this->checkout->current_step->reg_form->receive_form_submission(
934
-						apply_filters( 'FHEE__Single_Page_Checkout___check_form_submission__request_params', EE_Registry::instance()->REQ->params(), $this->checkout )
934
+						apply_filters('FHEE__Single_Page_Checkout___check_form_submission__request_params', EE_Registry::instance()->REQ->params(), $this->checkout)
935 935
 					);
936 936
 					// validate submitted form data
937
-					if ( ! $this->checkout->current_step->reg_form->is_valid() || ! $this->checkout->continue_reg ) {
937
+					if ( ! $this->checkout->current_step->reg_form->is_valid() || ! $this->checkout->continue_reg) {
938 938
 						// thou shall not pass !!!
939 939
 						$this->checkout->continue_reg = FALSE;
940 940
 						// any form validation errors?
941
-						if ( $this->checkout->current_step->reg_form->submission_error_message() != '' ) {
941
+						if ($this->checkout->current_step->reg_form->submission_error_message() != '') {
942 942
 							$submission_error_messages = array();
943 943
 							// bad, bad, bad registrant
944
-							foreach( $this->checkout->current_step->reg_form->get_validation_errors_accumulated() as $validation_error ){
945
-								if ( $validation_error instanceof EE_Validation_Error ) {
946
-									$submission_error_messages[] = sprintf( __( '%s : %s', 'event_espresso' ), $validation_error->get_form_section()->html_label_text(), $validation_error->getMessage() );
944
+							foreach ($this->checkout->current_step->reg_form->get_validation_errors_accumulated() as $validation_error) {
945
+								if ($validation_error instanceof EE_Validation_Error) {
946
+									$submission_error_messages[] = sprintf(__('%s : %s', 'event_espresso'), $validation_error->get_form_section()->html_label_text(), $validation_error->getMessage());
947 947
 								}
948 948
 							}
949
-							EE_Error::add_error( join( '<br />', $submission_error_messages ), __FILE__, __FUNCTION__, __LINE__ );
949
+							EE_Error::add_error(join('<br />', $submission_error_messages), __FILE__, __FUNCTION__, __LINE__);
950 950
 						}
951 951
 						// well not really... what will happen is we'll just get redirected back to redo the current step
952 952
 						$this->go_to_next_step();
953 953
 						return;
954 954
 					}
955 955
 				}
956
-			} catch( EE_Error $e ) {
956
+			} catch (EE_Error $e) {
957 957
 				$e->get_error();
958 958
 			}
959 959
 		}
@@ -969,38 +969,38 @@  discard block
 block discarded – undo
969 969
 	 */
970 970
 	private function _process_form_action() {
971 971
 		// what cha wanna do?
972
-		switch( $this->checkout->action ) {
972
+		switch ($this->checkout->action) {
973 973
 			// AJAX next step reg form
974 974
 			case 'display_spco_reg_step' :
975 975
 				$this->checkout->redirect = FALSE;
976
-				if ( EE_Registry::instance()->REQ->ajax ) {
977
-					$this->checkout->json_response->set_reg_step_html( $this->checkout->current_step->display_reg_form() );
976
+				if (EE_Registry::instance()->REQ->ajax) {
977
+					$this->checkout->json_response->set_reg_step_html($this->checkout->current_step->display_reg_form());
978 978
 				}
979 979
 				break;
980 980
 
981 981
 			default :
982 982
 				// meh... do one of those other steps first
983
-				if ( ! empty( $this->checkout->action ) && is_callable( array( $this->checkout->current_step, $this->checkout->action ))) {
983
+				if ( ! empty($this->checkout->action) && is_callable(array($this->checkout->current_step, $this->checkout->action))) {
984 984
 					// dynamically creates hook point like: AHEE__Single_Page_Checkout__before_attendee_information__process_reg_step
985
-					do_action( "AHEE__Single_Page_Checkout__before_{$this->checkout->current_step->slug()}__{$this->checkout->action}", $this->checkout->current_step );
985
+					do_action("AHEE__Single_Page_Checkout__before_{$this->checkout->current_step->slug()}__{$this->checkout->action}", $this->checkout->current_step);
986 986
 					// call action on current step
987
-					if ( call_user_func( array( $this->checkout->current_step, $this->checkout->action )) ) {
987
+					if (call_user_func(array($this->checkout->current_step, $this->checkout->action))) {
988 988
 						// good registrant, you get to proceed
989
-						if ( $this->checkout->current_step->success_message() != '' ) {
990
-							if ( apply_filters( 'FHEE__Single_Page_Checkout___process_form_action__display_success', false ) ) {
991
-								EE_Error::add_success( $this->checkout->current_step->success_message() . '<br />' . $this->checkout->next_step->_instructions() );
989
+						if ($this->checkout->current_step->success_message() != '') {
990
+							if (apply_filters('FHEE__Single_Page_Checkout___process_form_action__display_success', false)) {
991
+								EE_Error::add_success($this->checkout->current_step->success_message().'<br />'.$this->checkout->next_step->_instructions());
992 992
 							}
993 993
 						}
994 994
 						// pack it up, pack it in...
995 995
 						$this->_setup_redirect();
996 996
 					}
997 997
 					// dynamically creates hook point like: AHEE__Single_Page_Checkout__after_payment_options__process_reg_step
998
-					do_action( "AHEE__Single_Page_Checkout__after_{$this->checkout->current_step->slug()}__{$this->checkout->action}", $this->checkout->current_step );
998
+					do_action("AHEE__Single_Page_Checkout__after_{$this->checkout->current_step->slug()}__{$this->checkout->action}", $this->checkout->current_step);
999 999
 
1000 1000
 				} else {
1001 1001
 					EE_Error::add_error(
1002 1002
 						sprintf(
1003
-							__( 'The requested form action "%s" does not exist for the current "%s" registration step.', 'event_espresso' ),
1003
+							__('The requested form action "%s" does not exist for the current "%s" registration step.', 'event_espresso'),
1004 1004
 							$this->checkout->action,
1005 1005
 							$this->checkout->current_step->name()
1006 1006
 						),
@@ -1026,10 +1026,10 @@  discard block
 block discarded – undo
1026 1026
 	public function add_styles_and_scripts() {
1027 1027
 		// i18n
1028 1028
 		$this->translate_js_strings();
1029
-		if ( $this->checkout->admin_request ) {
1030
-			add_action('admin_enqueue_scripts', array($this, 'enqueue_styles_and_scripts'), 10 );
1029
+		if ($this->checkout->admin_request) {
1030
+			add_action('admin_enqueue_scripts', array($this, 'enqueue_styles_and_scripts'), 10);
1031 1031
 		} else {
1032
-			add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_styles_and_scripts' ), 10 );
1032
+			add_action('wp_enqueue_scripts', array($this, 'enqueue_styles_and_scripts'), 10);
1033 1033
 		}
1034 1034
 	}
1035 1035
 
@@ -1045,42 +1045,42 @@  discard block
 block discarded – undo
1045 1045
 		EE_Registry::$i18n_js_strings['revisit'] = $this->checkout->revisit;
1046 1046
 		EE_Registry::$i18n_js_strings['e_reg_url_link'] = $this->checkout->reg_url_link;
1047 1047
 		EE_Registry::$i18n_js_strings['server_error'] = __('An unknown error occurred on the server while attempting to process your request. Please refresh the page and try again or contact support.', 'event_espresso');
1048
-		EE_Registry::$i18n_js_strings['invalid_json_response'] = __( 'An invalid response was returned from the server while attempting to process your request. Please refresh the page and try again or contact support.', 'event_espresso' );
1049
-		EE_Registry::$i18n_js_strings['validation_error'] = __( 'There appears to be a problem with the form validation configuration! Please check the admin settings or contact support.', 'event_espresso' );
1050
-		EE_Registry::$i18n_js_strings['invalid_payment_method'] = __( 'There appears to be a problem with the payment method configuration! Please refresh the page and try again or contact support.', 'event_espresso' );
1048
+		EE_Registry::$i18n_js_strings['invalid_json_response'] = __('An invalid response was returned from the server while attempting to process your request. Please refresh the page and try again or contact support.', 'event_espresso');
1049
+		EE_Registry::$i18n_js_strings['validation_error'] = __('There appears to be a problem with the form validation configuration! Please check the admin settings or contact support.', 'event_espresso');
1050
+		EE_Registry::$i18n_js_strings['invalid_payment_method'] = __('There appears to be a problem with the payment method configuration! Please refresh the page and try again or contact support.', 'event_espresso');
1051 1051
 		EE_Registry::$i18n_js_strings['reg_step_error'] = __('This registration step could not be completed. Please refresh the page and try again.', 'event_espresso');
1052 1052
 		EE_Registry::$i18n_js_strings['invalid_coupon'] = __('We\'re sorry but that coupon code does not appear to be valid. If this is incorrect, please contact the site administrator.', 'event_espresso');
1053
-		EE_Registry::$i18n_js_strings['process_registration'] = sprintf( __( 'Please wait while we process your registration.%sDo not refresh the page or navigate away while this is happening.%sThank you for your patience.', 'event_espresso' ), '<br/>', '<br/>' );
1054
-		EE_Registry::$i18n_js_strings['language'] = get_bloginfo( 'language' );
1053
+		EE_Registry::$i18n_js_strings['process_registration'] = sprintf(__('Please wait while we process your registration.%sDo not refresh the page or navigate away while this is happening.%sThank you for your patience.', 'event_espresso'), '<br/>', '<br/>');
1054
+		EE_Registry::$i18n_js_strings['language'] = get_bloginfo('language');
1055 1055
 		EE_Registry::$i18n_js_strings['EESID'] = EE_Registry::instance()->SSN->id();
1056 1056
 		EE_Registry::$i18n_js_strings['currency'] = EE_Registry::instance()->CFG->currency;
1057 1057
 		EE_Registry::$i18n_js_strings['datepicker_yearRange'] = '-150:+20';
1058
-		EE_Registry::$i18n_js_strings['timer_years'] = __( 'years', 'event_espresso' );
1059
-		EE_Registry::$i18n_js_strings['timer_months'] = __( 'months', 'event_espresso' );
1060
-		EE_Registry::$i18n_js_strings['timer_weeks'] = __( 'weeks', 'event_espresso' );
1061
-		EE_Registry::$i18n_js_strings['timer_days'] = __( 'days', 'event_espresso' );
1062
-		EE_Registry::$i18n_js_strings['timer_hours'] = __( 'hours', 'event_espresso' );
1063
-		EE_Registry::$i18n_js_strings['timer_minutes'] = __( 'minutes', 'event_espresso' );
1064
-		EE_Registry::$i18n_js_strings['timer_seconds'] = __( 'seconds', 'event_espresso' );
1065
-		EE_Registry::$i18n_js_strings['timer_year'] = __( 'year', 'event_espresso' );
1066
-		EE_Registry::$i18n_js_strings['timer_month'] = __( 'month', 'event_espresso' );
1067
-		EE_Registry::$i18n_js_strings['timer_week'] = __( 'week', 'event_espresso' );
1068
-		EE_Registry::$i18n_js_strings['timer_day'] = __( 'day', 'event_espresso' );
1069
-		EE_Registry::$i18n_js_strings['timer_hour'] = __( 'hour', 'event_espresso' );
1070
-		EE_Registry::$i18n_js_strings['timer_minute'] = __( 'minute', 'event_espresso' );
1071
-		EE_Registry::$i18n_js_strings['timer_second'] = __( 'second', 'event_espresso' );
1058
+		EE_Registry::$i18n_js_strings['timer_years'] = __('years', 'event_espresso');
1059
+		EE_Registry::$i18n_js_strings['timer_months'] = __('months', 'event_espresso');
1060
+		EE_Registry::$i18n_js_strings['timer_weeks'] = __('weeks', 'event_espresso');
1061
+		EE_Registry::$i18n_js_strings['timer_days'] = __('days', 'event_espresso');
1062
+		EE_Registry::$i18n_js_strings['timer_hours'] = __('hours', 'event_espresso');
1063
+		EE_Registry::$i18n_js_strings['timer_minutes'] = __('minutes', 'event_espresso');
1064
+		EE_Registry::$i18n_js_strings['timer_seconds'] = __('seconds', 'event_espresso');
1065
+		EE_Registry::$i18n_js_strings['timer_year'] = __('year', 'event_espresso');
1066
+		EE_Registry::$i18n_js_strings['timer_month'] = __('month', 'event_espresso');
1067
+		EE_Registry::$i18n_js_strings['timer_week'] = __('week', 'event_espresso');
1068
+		EE_Registry::$i18n_js_strings['timer_day'] = __('day', 'event_espresso');
1069
+		EE_Registry::$i18n_js_strings['timer_hour'] = __('hour', 'event_espresso');
1070
+		EE_Registry::$i18n_js_strings['timer_minute'] = __('minute', 'event_espresso');
1071
+		EE_Registry::$i18n_js_strings['timer_second'] = __('second', 'event_espresso');
1072 1072
 		EE_Registry::$i18n_js_strings['registration_expiration_notice'] = sprintf(
1073
-			__( '%1$sWe\'re sorry, but your registration time has expired.%2$s%3$s%4$sIf you still wish to complete your registration, please return to the %5$sEvent List%6$sEvent List%7$s and reselect your tickets if available. Please except our apologies for any inconvenience this may have caused.%8$s', 'event_espresso' ),
1073
+			__('%1$sWe\'re sorry, but your registration time has expired.%2$s%3$s%4$sIf you still wish to complete your registration, please return to the %5$sEvent List%6$sEvent List%7$s and reselect your tickets if available. Please except our apologies for any inconvenience this may have caused.%8$s', 'event_espresso'),
1074 1074
 			'<h4 class="important-notice">',
1075 1075
 			'</h4>',
1076 1076
 			'<br />',
1077 1077
 			'<p>',
1078
-			'<a href="'. get_post_type_archive_link( 'espresso_events' ) . '" title="',
1078
+			'<a href="'.get_post_type_archive_link('espresso_events').'" title="',
1079 1079
 			'">',
1080 1080
 			'</a>',
1081 1081
 			'</p>'
1082 1082
 		);
1083
-		EE_Registry::$i18n_js_strings[ 'ajax_submit' ] = apply_filters( 'FHEE__Single_Page_Checkout__translate_js_strings__ajax_submit', true );
1083
+		EE_Registry::$i18n_js_strings['ajax_submit'] = apply_filters('FHEE__Single_Page_Checkout__translate_js_strings__ajax_submit', true);
1084 1084
 	}
1085 1085
 
1086 1086
 
@@ -1093,25 +1093,25 @@  discard block
 block discarded – undo
1093 1093
 	 */
1094 1094
 	public function enqueue_styles_and_scripts() {
1095 1095
 		// load css
1096
-		wp_register_style( 'single_page_checkout', SPCO_CSS_URL . 'single_page_checkout.css', array(), EVENT_ESPRESSO_VERSION );
1097
-		wp_enqueue_style( 'single_page_checkout' );
1096
+		wp_register_style('single_page_checkout', SPCO_CSS_URL.'single_page_checkout.css', array(), EVENT_ESPRESSO_VERSION);
1097
+		wp_enqueue_style('single_page_checkout');
1098 1098
 		// load JS
1099
-		wp_register_script( 'jquery_plugin', EE_THIRD_PARTY_URL . 'jquery	.plugin.min.js', array( 'jquery' ), '1.0.1', TRUE );
1100
-		wp_register_script( 'jquery_countdown', EE_THIRD_PARTY_URL . 'jquery	.countdown.min.js', array( 'jquery_plugin' ), '2.0.2', TRUE );
1101
-		wp_register_script( 'single_page_checkout', SPCO_JS_URL . 'single_page_checkout.js', array( 'espresso_core', 'underscore', 'ee_form_section_validation', 'jquery_countdown' ), EVENT_ESPRESSO_VERSION, TRUE );
1102
-		wp_enqueue_script( 'single_page_checkout' );
1099
+		wp_register_script('jquery_plugin', EE_THIRD_PARTY_URL.'jquery	.plugin.min.js', array('jquery'), '1.0.1', TRUE);
1100
+		wp_register_script('jquery_countdown', EE_THIRD_PARTY_URL.'jquery	.countdown.min.js', array('jquery_plugin'), '2.0.2', TRUE);
1101
+		wp_register_script('single_page_checkout', SPCO_JS_URL.'single_page_checkout.js', array('espresso_core', 'underscore', 'ee_form_section_validation', 'jquery_countdown'), EVENT_ESPRESSO_VERSION, TRUE);
1102
+		wp_enqueue_script('single_page_checkout');
1103 1103
 
1104 1104
 		/**
1105 1105
 		 * global action hook for enqueueing styles and scripts with
1106 1106
 		 * spco calls.
1107 1107
 		 */
1108
-		do_action( 'AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts', $this );
1108
+		do_action('AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts', $this);
1109 1109
 
1110 1110
 		/**
1111 1111
 		 * dynamic action hook for enqueueing styles and scripts with spco calls.
1112 1112
 		 * The hook will end up being something like AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts__attendee_information
1113 1113
 		 */
1114
-		do_action( 'AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts__' . $this->checkout->current_step->slug(), $this );
1114
+		do_action('AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts__'.$this->checkout->current_step->slug(), $this);
1115 1115
 
1116 1116
 		// add css and JS for current step
1117 1117
 		$this->checkout->current_step->enqueue_styles_and_scripts();
@@ -1127,20 +1127,20 @@  discard block
 block discarded – undo
1127 1127
 	 */
1128 1128
 	private function _display_spco_reg_form() {
1129 1129
 		// if registering via the admin, just display the reg form for the current step
1130
-		if ( $this->checkout->admin_request ) {
1131
-			EE_Registry::instance()->REQ->add_output( $this->checkout->current_step->display_reg_form() );
1130
+		if ($this->checkout->admin_request) {
1131
+			EE_Registry::instance()->REQ->add_output($this->checkout->current_step->display_reg_form());
1132 1132
 		} else {
1133 1133
 			// add powered by EE msg
1134
-			add_action( 'AHEE__SPCO__reg_form_footer', array( 'EED_Single_Page_Checkout', 'display_registration_footer' ));
1134
+			add_action('AHEE__SPCO__reg_form_footer', array('EED_Single_Page_Checkout', 'display_registration_footer'));
1135 1135
 
1136
-			$empty_cart = count( $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params ) ) < 1 ? true : false;
1136
+			$empty_cart = count($this->checkout->transaction->registrations($this->checkout->reg_cache_where_params)) < 1 ? true : false;
1137 1137
 			$cookies_not_set_msg = '';
1138
-			if ( $empty_cart ) {
1139
-				if ( ! isset( $_COOKIE[ 'ee_cookie_test' ] ) ) {
1138
+			if ($empty_cart) {
1139
+				if ( ! isset($_COOKIE['ee_cookie_test'])) {
1140 1140
 					$cookies_not_set_msg = apply_filters(
1141 1141
 						'FHEE__Single_Page_Checkout__display_spco_reg_form__cookies_not_set_msg',
1142 1142
 						sprintf(
1143
-							__( '%1$s%3$sIt appears your browser is not currently set to accept Cookies%4$s%5$sIn order to register for events, you need to enable cookies.%7$sIf you require assistance, then click the following link to learn how to %8$senable cookies%9$s%6$s%2$s', 'event_espresso' ),
1143
+							__('%1$s%3$sIt appears your browser is not currently set to accept Cookies%4$s%5$sIn order to register for events, you need to enable cookies.%7$sIf you require assistance, then click the following link to learn how to %8$senable cookies%9$s%6$s%2$s', 'event_espresso'),
1144 1144
 							'<div class="ee-attention">',
1145 1145
 							'</div>',
1146 1146
 							'<h6 class="important-notice">',
@@ -1161,7 +1161,7 @@  discard block
 block discarded – undo
1161 1161
 					'layout_strategy' =>
1162 1162
 						new EE_Template_Layout(
1163 1163
 							array(
1164
-								'layout_template_file' 			=> SPCO_TEMPLATES_PATH . 'registration_page_wrapper.template.php',
1164
+								'layout_template_file' 			=> SPCO_TEMPLATES_PATH.'registration_page_wrapper.template.php',
1165 1165
 								'template_args' => array(
1166 1166
 									'empty_cart' 		=> $empty_cart,
1167 1167
 									'revisit' 				=> $this->checkout->revisit,
@@ -1170,8 +1170,8 @@  discard block
 block discarded – undo
1170 1170
 									'empty_msg' 		=> apply_filters(
1171 1171
 										'FHEE__Single_Page_Checkout__display_spco_reg_form__empty_msg',
1172 1172
 										sprintf(
1173
-											__( 'You need to %1$sReturn to Events list%2$sselect at least one event%3$s before you can proceed with the registration process.', 'event_espresso' ),
1174
-											'<a href="' . get_post_type_archive_link( 'espresso_events' ) . '" title="',
1173
+											__('You need to %1$sReturn to Events list%2$sselect at least one event%3$s before you can proceed with the registration process.', 'event_espresso'),
1174
+											'<a href="'.get_post_type_archive_link('espresso_events').'" title="',
1175 1175
 											'">',
1176 1176
 											'</a>'
1177 1177
 										)
@@ -1179,14 +1179,14 @@  discard block
 block discarded – undo
1179 1179
 									'cookies_not_set_msg' 		=> $cookies_not_set_msg,
1180 1180
 									'registration_time_limit' 	=> $this->checkout->get_registration_time_limit(),
1181 1181
 									'session_expiration' 			=>
1182
-										gmdate( 'M d, Y H:i:s', EE_Registry::instance()->SSN->expiration() + ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS ) )
1182
+										gmdate('M d, Y H:i:s', EE_Registry::instance()->SSN->expiration() + (get_option('gmt_offset') * HOUR_IN_SECONDS))
1183 1183
 							)
1184 1184
 						)
1185 1185
 					)
1186 1186
 				)
1187 1187
 			);
1188 1188
 			// load template and add to output sent that gets filtered into the_content()
1189
-			EE_Registry::instance()->REQ->add_output( $this->checkout->registration_form->get_html_and_js() );
1189
+			EE_Registry::instance()->REQ->add_output($this->checkout->registration_form->get_html_and_js());
1190 1190
 		}
1191 1191
 	}
1192 1192
 
@@ -1200,8 +1200,8 @@  discard block
 block discarded – undo
1200 1200
 	 * @internal  param string $label
1201 1201
 	 * @return        string
1202 1202
 	 */
1203
-	public function add_extra_finalize_registration_inputs( $next_step ) {
1204
-		if ( $next_step == 'finalize_registration' ) {
1203
+	public function add_extra_finalize_registration_inputs($next_step) {
1204
+		if ($next_step == 'finalize_registration') {
1205 1205
 			echo '<div id="spco-extra-finalize_registration-inputs-dv"></div>';
1206 1206
 		}
1207 1207
 	}
@@ -1215,18 +1215,18 @@  discard block
 block discarded – undo
1215 1215
 	 *  @return 	string
1216 1216
 	 */
1217 1217
 	public static function display_registration_footer() {
1218
-		if ( apply_filters( 'FHEE__EE_Front__Controller__show_reg_footer', EE_Registry::instance()->CFG->admin->show_reg_footer ) ) {
1219
-			EE_Registry::instance()->CFG->admin->affiliate_id = ! empty( EE_Registry::instance()->CFG->admin->affiliate_id ) ? EE_Registry::instance()->CFG->admin->affiliate_id : 'default';
1220
-			$url = add_query_arg( array( 'ap_id' => EE_Registry::instance()->CFG->admin->affiliate_id ), 'http://eventespresso.com/' );
1221
-			$url = apply_filters( 'FHEE__EE_Front_Controller__registration_footer__url', $url );
1218
+		if (apply_filters('FHEE__EE_Front__Controller__show_reg_footer', EE_Registry::instance()->CFG->admin->show_reg_footer)) {
1219
+			EE_Registry::instance()->CFG->admin->affiliate_id = ! empty(EE_Registry::instance()->CFG->admin->affiliate_id) ? EE_Registry::instance()->CFG->admin->affiliate_id : 'default';
1220
+			$url = add_query_arg(array('ap_id' => EE_Registry::instance()->CFG->admin->affiliate_id), 'http://eventespresso.com/');
1221
+			$url = apply_filters('FHEE__EE_Front_Controller__registration_footer__url', $url);
1222 1222
 			echo apply_filters(
1223 1223
 				'FHEE__EE_Front_Controller__display_registration_footer',
1224 1224
 				sprintf(
1225
-					__( '%1$sEvent Registration Powered by Event Espresso%2$sEvent Registration and Ticketing%3$s Powered by %4$sEvent Espresso - Event Registration and Management System for WordPress%5$sEvent Espresso%6$s', 'event_espresso' ),
1226
-					'<div id="espresso-registration-footer-dv"><a href="' . $url . '" title="',
1225
+					__('%1$sEvent Registration Powered by Event Espresso%2$sEvent Registration and Ticketing%3$s Powered by %4$sEvent Espresso - Event Registration and Management System for WordPress%5$sEvent Espresso%6$s', 'event_espresso'),
1226
+					'<div id="espresso-registration-footer-dv"><a href="'.$url.'" title="',
1227 1227
 					'" target="_blank">',
1228 1228
 					'</a>',
1229
-					'<a href="' . $url . '" title="',
1229
+					'<a href="'.$url.'" title="',
1230 1230
 					'" target="_blank">',
1231 1231
 					'</a></div>'
1232 1232
 				)
@@ -1257,12 +1257,12 @@  discard block
 block discarded – undo
1257 1257
 	 * @return 	array
1258 1258
 	 */
1259 1259
 	private function _setup_redirect() {
1260
-		if ( $this->checkout->continue_reg && $this->checkout->next_step instanceof EE_SPCO_Reg_Step ) {
1260
+		if ($this->checkout->continue_reg && $this->checkout->next_step instanceof EE_SPCO_Reg_Step) {
1261 1261
 			$this->checkout->redirect = TRUE;
1262
-			if ( empty( $this->checkout->redirect_url )) {
1262
+			if (empty($this->checkout->redirect_url)) {
1263 1263
 				$this->checkout->redirect_url = $this->checkout->next_step->reg_step_url();
1264 1264
 			}
1265
-			$this->checkout->redirect_url = apply_filters( 'FHEE__EED_Single_Page_Checkout___setup_redirect__checkout_redirect_url', $this->checkout->redirect_url, $this->checkout );
1265
+			$this->checkout->redirect_url = apply_filters('FHEE__EED_Single_Page_Checkout___setup_redirect__checkout_redirect_url', $this->checkout->redirect_url, $this->checkout);
1266 1266
 		}
1267 1267
 	}
1268 1268
 
@@ -1275,12 +1275,12 @@  discard block
 block discarded – undo
1275 1275
 	 * @return void
1276 1276
 	 */
1277 1277
 	public function go_to_next_step() {
1278
-		if ( EE_Registry::instance()->REQ->ajax ) {
1278
+		if (EE_Registry::instance()->REQ->ajax) {
1279 1279
 			// capture contents of output buffer we started earlier in the request, and insert into JSON response
1280
-			$this->checkout->json_response->set_unexpected_errors( ob_get_clean() );
1280
+			$this->checkout->json_response->set_unexpected_errors(ob_get_clean());
1281 1281
 		}
1282 1282
 		// just return for these conditions
1283
-		if ( $this->checkout->admin_request || $this->checkout->action == 'redirect_form' || $this->checkout->action == 'update_checkout' ) {
1283
+		if ($this->checkout->admin_request || $this->checkout->action == 'redirect_form' || $this->checkout->action == 'update_checkout') {
1284 1284
 			return;
1285 1285
 		}
1286 1286
 		// AJAX response
@@ -1301,7 +1301,7 @@  discard block
 block discarded – undo
1301 1301
 	 */
1302 1302
 	protected function _handle_json_response() {
1303 1303
 		// if this is an ajax request
1304
-		if ( EE_Registry::instance()->REQ->ajax ) {
1304
+		if (EE_Registry::instance()->REQ->ajax) {
1305 1305
 			// DEBUG LOG
1306 1306
 			//$this->checkout->log(
1307 1307
 			//	__CLASS__, __FUNCTION__, __LINE__,
@@ -1311,10 +1311,10 @@  discard block
 block discarded – undo
1311 1311
 			//		'continue_reg'               => $this->checkout->continue_reg,
1312 1312
 			//	)
1313 1313
 			//);
1314
-			$this->checkout->json_response->set_registration_time_limit( $this->checkout->get_registration_time_limit() );
1315
-			$this->checkout->json_response->set_payment_amount( $this->checkout->amount_owing );
1314
+			$this->checkout->json_response->set_registration_time_limit($this->checkout->get_registration_time_limit());
1315
+			$this->checkout->json_response->set_payment_amount($this->checkout->amount_owing);
1316 1316
 			// just send the ajax (
1317
-			$json_response = apply_filters( 'FHEE__EE_Single_Page_Checkout__JSON_response', $this->checkout->json_response );
1317
+			$json_response = apply_filters('FHEE__EE_Single_Page_Checkout__JSON_response', $this->checkout->json_response);
1318 1318
 			$this->unlock_transaction();
1319 1319
 			echo $json_response;
1320 1320
 			exit();
@@ -1331,9 +1331,9 @@  discard block
 block discarded – undo
1331 1331
 	 */
1332 1332
 	protected function _handle_html_redirects() {
1333 1333
 		// going somewhere ?
1334
-		if ( $this->checkout->redirect && ! empty( $this->checkout->redirect_url ) ) {
1334
+		if ($this->checkout->redirect && ! empty($this->checkout->redirect_url)) {
1335 1335
 			// store notices in a transient
1336
-			EE_Error::get_notices( false, true, true );
1336
+			EE_Error::get_notices(false, true, true);
1337 1337
 			$this->unlock_transaction();
1338 1338
 			// DEBUG LOG
1339 1339
 			//$this->checkout->log(
@@ -1344,7 +1344,7 @@  discard block
 block discarded – undo
1344 1344
 			//		'headers_list'    => headers_list(),
1345 1345
 			//	)
1346 1346
 			//);
1347
-			wp_safe_redirect( $this->checkout->redirect_url );
1347
+			wp_safe_redirect($this->checkout->redirect_url);
1348 1348
 			exit();
1349 1349
 		}
1350 1350
 	}
Please login to merge, or discard this patch.
payment_methods/Bank/EE_PMT_Bank.pm.php 2 patches
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,7 +1,8 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-if (!defined('EVENT_ESPRESSO_VERSION'))
3
+if (!defined('EVENT_ESPRESSO_VERSION')) {
4 4
 	exit('No direct script access allowed');
5
+}
5 6
 /**
6 7
  * Event Espresso
7 8
  *
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if (!defined('EVENT_ESPRESSO_VERSION'))
3
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
4 4
 	exit('No direct script access allowed');
5 5
 
6 6
 /**
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
  *
26 26
  * ------------------------------------------------------------------------
27 27
  */
28
-class EE_PMT_Bank extends EE_PMT_Base{
28
+class EE_PMT_Bank extends EE_PMT_Base {
29 29
 
30 30
 
31 31
 
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 		$this->_pretty_name = __("Bank", 'event_espresso');
39 39
 		parent::__construct($pm_instance);
40 40
 		$this->_default_button_url = $this->file_url().'lib'.DS.'bank-logo.png';
41
-		$this->_default_description = __( 'Make payment using an electronic funds transfer from your bank.', 'event_espresso' );
41
+		$this->_default_description = __('Make payment using an electronic funds transfer from your bank.', 'event_espresso');
42 42
 	}
43 43
 
44 44
 
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 	 * @param \EE_Transaction $transaction
49 49
 	 * @return NULL
50 50
 	 */
51
-	public function generate_new_billing_form( EE_Transaction $transaction = NULL ) {
51
+	public function generate_new_billing_form(EE_Transaction $transaction = NULL) {
52 52
 		return NULL;
53 53
 	}
54 54
 
@@ -62,17 +62,17 @@  discard block
 block discarded – undo
62 62
 		return new EE_Payment_Method_Form(array(
63 63
 			'extra_meta_inputs'=>array(
64 64
 				'page_title'=>new EE_Text_Input(array(
65
-					'html_label_text'=>  sprintf(__("Title %s", "event_espresso"),  $this->get_help_tab_link()),
65
+					'html_label_text'=>  sprintf(__("Title %s", "event_espresso"), $this->get_help_tab_link()),
66 66
 					'default'=>  __("Electronic Funds Transfers", 'event_espresso')
67 67
 				)),
68
-				'payment_instructions'=>new EE_Text_Area_Input( array(
69
-					'html_label_text'=>  sprintf(__("Payment Instructions %s", "event_espresso"),  $this->get_help_tab_link()),
70
-					'html_help_text' => __( 'Provide instructions on how registrants can send the bank draft payment. Eg, mention your account name, bank account number, bank name, bank routing code, and bank address, etc.', 'event_espresso' ),
68
+				'payment_instructions'=>new EE_Text_Area_Input(array(
69
+					'html_label_text'=>  sprintf(__("Payment Instructions %s", "event_espresso"), $this->get_help_tab_link()),
70
+					'html_help_text' => __('Provide instructions on how registrants can send the bank draft payment. Eg, mention your account name, bank account number, bank name, bank routing code, and bank address, etc.', 'event_espresso'),
71 71
 					'default'=> sprintf(
72 72
 						__('Please initiate an electronic payment using the following bank information: %1$sAccount Owner: Luke Skywalker%1$sBank Account # 1234567890%1$sBank Name: Rebellion Bank%1$sRouting Number: 12345%1$sBank Address: 12345 Wookie Rd., Planet Corellian.%1$sPayment must be received within 48 hours of event date.', 'event_espresso'),
73 73
 						"\n"
74 74
 					),
75
-					'validation_strategies' => array( new EE_Full_HTML_Validation_Strategy() ),
75
+					'validation_strategies' => array(new EE_Full_HTML_Validation_Strategy()),
76 76
 				)),
77 77
 			),
78 78
 			'exclude'=>array('PMD_debug_mode')
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 	 * @see EE_PMT_Base::help_tabs_config()
87 87
 	 * @return array
88 88
 	 */
89
-	public function help_tabs_config(){
89
+	public function help_tabs_config() {
90 90
 		return array(
91 91
 			$this->get_help_tab_name() => array(
92 92
 						'title' => __('Bank Draft Settings', 'event_espresso'),
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
 	 * Other gateways may want to override this, such as offline gateways.
104 104
 	 * @return string
105 105
 	 */
106
-	public function payment_overview_content(EE_Payment $payment){
106
+	public function payment_overview_content(EE_Payment $payment) {
107 107
 		EE_Registry::instance()->load_helper('Template');
108 108
 		$extra_meta_for_payment_method = $this->_pm_instance->all_extra_meta_array();
109 109
 		$template_vars = array_merge(
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
 							),
116 116
 						$extra_meta_for_payment_method);
117 117
 		return EEH_Template::locate_template(
118
-				'payment_methods' . DS . 'Bank'. DS . 'templates' . DS . 'bank_payment_details_content.template.php',
118
+				'payment_methods'.DS.'Bank'.DS.'templates'.DS.'bank_payment_details_content.template.php',
119 119
 				$template_vars);
120 120
 	}
121 121
 
Please login to merge, or discard this patch.
payment_methods/Invoice/EE_PMT_Invoice.pm.php 2 patches
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,7 +1,8 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-if (!defined('EVENT_ESPRESSO_VERSION'))
3
+if (!defined('EVENT_ESPRESSO_VERSION')) {
4 4
 	exit('No direct script access allowed');
5
+}
5 6
 /**
6 7
  * Event Espresso
7 8
  *
Please login to merge, or discard this patch.
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if (!defined('EVENT_ESPRESSO_VERSION'))
3
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
4 4
 	exit('No direct script access allowed');
5 5
 
6 6
 /**
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
  *
26 26
  * ------------------------------------------------------------------------
27 27
  */
28
-class EE_PMT_Invoice extends EE_PMT_Base{
28
+class EE_PMT_Invoice extends EE_PMT_Base {
29 29
 
30 30
 
31 31
 
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 	 */
37 37
 	public function __construct($pm_instance = NULL) {
38 38
 		$this->_pretty_name = __("Invoice", 'event_espresso');
39
-		$this->_default_description = __( 'After clicking "Finalize Registration", you will be given instructions on how to access your invoice and complete your payment.', 'event_espresso' );
39
+		$this->_default_description = __('After clicking "Finalize Registration", you will be given instructions on how to access your invoice and complete your payment.', 'event_espresso');
40 40
 		parent::__construct($pm_instance);
41 41
 		$this->_default_button_url = $this->file_url().'lib'.DS.'invoice-logo.png';
42 42
 	}
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 	 * @param \EE_Transaction $transaction
49 49
 	 * @return NULL
50 50
 	 */
51
-	public function generate_new_billing_form( EE_Transaction $transaction = NULL ) {
51
+	public function generate_new_billing_form(EE_Transaction $transaction = NULL) {
52 52
 		return NULL;
53 53
 	}
54 54
 
@@ -61,53 +61,53 @@  discard block
 block discarded – undo
61 61
 	public function generate_new_settings_form() {
62 62
 		$pdf_payee_input_name = 'pdf_payee_name';
63 63
 		$confirmation_text_input_name = 'page_confirmation_text';
64
-		$form =  new EE_Payment_Method_Form(array(
64
+		$form = new EE_Payment_Method_Form(array(
65 65
 //				'payment_method_type' => $this,
66 66
 				'extra_meta_inputs'=>array(
67 67
 					$pdf_payee_input_name => new EE_Text_Input(array(
68
-						'html_label_text' => sprintf( __( 'Payee Name %s', 'event_espresso' ), $this->get_help_tab_link())
68
+						'html_label_text' => sprintf(__('Payee Name %s', 'event_espresso'), $this->get_help_tab_link())
69 69
 					)),
70 70
 					'pdf_payee_email' => new EE_Email_Input(array(
71
-						'html_label_text' => sprintf( __( 'Payee Email %s', 'event_espresso' ), $this->get_help_tab_link()),
71
+						'html_label_text' => sprintf(__('Payee Email %s', 'event_espresso'), $this->get_help_tab_link()),
72 72
 					)),
73 73
 					'pdf_payee_tax_number' => new EE_Text_Input(array(
74
-						'html_label_text' => sprintf( __( 'Payee Tax Number %s', 'event_espresso' ), $this->get_help_tab_link()),
74
+						'html_label_text' => sprintf(__('Payee Tax Number %s', 'event_espresso'), $this->get_help_tab_link()),
75 75
 						)),
76
-					'pdf_payee_address' => new EE_Text_Area_Input( array(
77
-						'html_label_text' => sprintf( __( 'Payee Address %s', 'event_espresso' ), $this->get_help_tab_link() ),
78
-						'validation_strategies' => array( new EE_Full_HTML_Validation_Strategy() ),
76
+					'pdf_payee_address' => new EE_Text_Area_Input(array(
77
+						'html_label_text' => sprintf(__('Payee Address %s', 'event_espresso'), $this->get_help_tab_link()),
78
+						'validation_strategies' => array(new EE_Full_HTML_Validation_Strategy()),
79 79
 					)),
80 80
 					'pdf_instructions'=>new EE_Text_Area_Input(array(
81
-						'html_label_text'=>  sprintf(__("Instructions %s", "event_espresso"),  $this->get_help_tab_link()),
81
+						'html_label_text'=>  sprintf(__("Instructions %s", "event_espresso"), $this->get_help_tab_link()),
82 82
 						'default'=>  __("Please send this invoice with payment attached to the address above, or use the payment link below. Payment must be received within 48 hours of event date.", 'event_espresso'),
83
-						'validation_strategies' => array( new EE_Full_HTML_Validation_Strategy() ),
83
+						'validation_strategies' => array(new EE_Full_HTML_Validation_Strategy()),
84 84
 					)),
85 85
 					'pdf_logo_image'=>new EE_Admin_File_Uploader_Input(array(
86
-						'html_label_text'=>  sprintf(__("Logo Image %s", "event_espresso"),  $this->get_help_tab_link()),
86
+						'html_label_text'=>  sprintf(__("Logo Image %s", "event_espresso"), $this->get_help_tab_link()),
87 87
 						'default'=>  EE_Config::instance()->organization->logo_url,
88 88
 						'html_help_text'=>  __("(Logo for the top left of the invoice)", 'event_espresso'),
89 89
 					)),
90 90
 					$confirmation_text_input_name =>new EE_Text_Area_Input(array(
91
-						'html_label_text'=>  sprintf(__("Confirmation Text %s", "event_espresso"),  $this->get_help_tab_link()),
91
+						'html_label_text'=>  sprintf(__("Confirmation Text %s", "event_espresso"), $this->get_help_tab_link()),
92 92
 						'default'=>  __("Payment must be received within 48 hours of event date.  Details about where to send payment is included on the invoice.", 'event_espresso'),
93
-						'validation_strategies' => array( new EE_Full_HTML_Validation_Strategy() ),
93
+						'validation_strategies' => array(new EE_Full_HTML_Validation_Strategy()),
94 94
 					)),
95 95
 					'page_extra_info'=>new EE_Text_Area_Input(array(
96
-						'html_label_text'=>  sprintf(__("Extra Info %s", "event_espresso"),  $this->get_help_tab_link()),
97
-						'validation_strategies' => array( new EE_Full_HTML_Validation_Strategy() ),
96
+						'html_label_text'=>  sprintf(__("Extra Info %s", "event_espresso"), $this->get_help_tab_link()),
97
+						'validation_strategies' => array(new EE_Full_HTML_Validation_Strategy()),
98 98
 					)),
99 99
 				),
100 100
 				'include'=>array(
101
-					'PMD_ID', 'PMD_name','PMD_desc','PMD_admin_name','PMD_admin_desc', 'PMD_type','PMD_slug', 'PMD_open_by_default','PMD_button_url','PMD_scope','Currency','PMD_order',
102
-					$pdf_payee_input_name, 'pdf_payee_email', 'pdf_payee_tax_number', 'pdf_payee_address', 'pdf_instructions','pdf_logo_image',
101
+					'PMD_ID', 'PMD_name', 'PMD_desc', 'PMD_admin_name', 'PMD_admin_desc', 'PMD_type', 'PMD_slug', 'PMD_open_by_default', 'PMD_button_url', 'PMD_scope', 'Currency', 'PMD_order',
102
+					$pdf_payee_input_name, 'pdf_payee_email', 'pdf_payee_tax_number', 'pdf_payee_address', 'pdf_instructions', 'pdf_logo_image',
103 103
 					$confirmation_text_input_name, 'page_extra_info'),
104 104
 			));
105 105
 		$form->add_subsections(
106
-			array( 'header1' => new EE_Form_Section_HTML_From_Template( 'payment_methods/Invoice/templates/invoice_settings_header_display.template.php' )),
106
+			array('header1' => new EE_Form_Section_HTML_From_Template('payment_methods/Invoice/templates/invoice_settings_header_display.template.php')),
107 107
 			$pdf_payee_input_name
108 108
 		);
109 109
 		$form->add_subsections(
110
-			array( 'header2'=>new EE_Form_Section_HTML_From_Template( 'payment_methods/Invoice/templates/invoice_settings_header_gateway.template.php' )),
110
+			array('header2'=>new EE_Form_Section_HTML_From_Template('payment_methods/Invoice/templates/invoice_settings_header_gateway.template.php')),
111 111
 			$confirmation_text_input_name
112 112
 		);
113 113
 		return $form;
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
 	 * @see EE_PMT_Base::help_tabs_config()
121 121
 	 * @return array
122 122
 	 */
123
-	public function help_tabs_config(){
123
+	public function help_tabs_config() {
124 124
 		return array(
125 125
 			$this->get_help_tab_name() => array(
126 126
 				'title' => __('Invoice Settings', 'event_espresso'),
@@ -138,17 +138,17 @@  discard block
 block discarded – undo
138 138
 	 * @param \EE_Payment $payment
139 139
 	 * @return string
140 140
 	 */
141
-	public function payment_overview_content( EE_Payment $payment ){
141
+	public function payment_overview_content(EE_Payment $payment) {
142 142
 		EE_Registry::instance()->load_helper('Template');
143 143
 		return EEH_Template::locate_template(
144
-			'payment_methods' . DS . 'Invoice'. DS . 'templates'.DS.'invoice_payment_details_content.template.php',
144
+			'payment_methods'.DS.'Invoice'.DS.'templates'.DS.'invoice_payment_details_content.template.php',
145 145
 			array_merge(
146 146
 				array(
147 147
 					'payment_method'			=> $this->_pm_instance,
148 148
 					'payment'						=> $payment,
149 149
 					'page_confirmation_text'					=> '',
150 150
 					'page_extra_info'	=> '',
151
-					'invoice_url' 					=> $payment->transaction()->primary_registration()->invoice_url( 'html' )
151
+					'invoice_url' 					=> $payment->transaction()->primary_registration()->invoice_url('html')
152 152
 				),
153 153
 				$this->_pm_instance->all_extra_meta_array()
154 154
 			)
Please login to merge, or discard this patch.
shortcodes/espresso_thank_you/EES_Espresso_Thank_You.shortcode.php 2 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@
 block discarded – undo
1
-<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 /**
3 5
  * Event Espresso
4 6
  *
Please login to merge, or discard this patch.
Spacing   +164 added lines, -164 removed lines patch added patch discarded remove patch
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 	 *  @return 	void
92 92
 	 */
93 93
 	public static function set_hooks() {
94
-		add_action( 'wp_loaded', array( 'EES_Espresso_Thank_You', 'set_definitions' ), 2 );
94
+		add_action('wp_loaded', array('EES_Espresso_Thank_You', 'set_definitions'), 2);
95 95
 	}
96 96
 
97 97
 	/**
@@ -102,10 +102,10 @@  discard block
 block discarded – undo
102 102
 	 */
103 103
 	public static function set_hooks_admin() {
104 104
 		// AJAX for IPN monitoring
105
-		add_filter( 'heartbeat_received', array( 'EES_Espresso_Thank_You', 'thank_you_page_IPN_monitor' ), 10, 3 );
106
-		add_filter( 'heartbeat_nopriv_received', array( 'EES_Espresso_Thank_You', 'thank_you_page_IPN_monitor' ), 10, 3 );
107
-		add_action( 'wp_ajax_espresso_resend_reg_confirmation_email', array( 'EES_Espresso_Thank_You', 'resend_reg_confirmation_email' ), 10, 2 );
108
-		add_action( 'wp_ajax_nopriv_espresso_resend_reg_confirmation_email', array( 'EES_Espresso_Thank_You', 'resend_reg_confirmation_email' ), 10, 2 );
105
+		add_filter('heartbeat_received', array('EES_Espresso_Thank_You', 'thank_you_page_IPN_monitor'), 10, 3);
106
+		add_filter('heartbeat_nopriv_received', array('EES_Espresso_Thank_You', 'thank_you_page_IPN_monitor'), 10, 3);
107
+		add_action('wp_ajax_espresso_resend_reg_confirmation_email', array('EES_Espresso_Thank_You', 'resend_reg_confirmation_email'), 10, 2);
108
+		add_action('wp_ajax_nopriv_espresso_resend_reg_confirmation_email', array('EES_Espresso_Thank_You', 'resend_reg_confirmation_email'), 10, 2);
109 109
 	}
110 110
 
111 111
 
@@ -117,8 +117,8 @@  discard block
 block discarded – undo
117 117
 	 *  @return 	void
118 118
 	 */
119 119
 	public static function set_definitions() {
120
-		define( 'THANK_YOU_ASSETS_URL', plugin_dir_url( __FILE__ ) . 'assets' . DS );
121
-		define( 'THANK_YOU_TEMPLATES_PATH', str_replace( '\\', DS, plugin_dir_path( __FILE__ )) . 'templates' . DS );
120
+		define('THANK_YOU_ASSETS_URL', plugin_dir_url(__FILE__).'assets'.DS);
121
+		define('THANK_YOU_TEMPLATES_PATH', str_replace('\\', DS, plugin_dir_path(__FILE__)).'templates'.DS);
122 122
 	}
123 123
 
124 124
 
@@ -130,23 +130,23 @@  discard block
 block discarded – undo
130 130
 	 *  @return 	EE_Transaction
131 131
 	 */
132 132
 	public function get_txn() {
133
-		if ( $this->_current_txn instanceof EE_Transaction ) {
133
+		if ($this->_current_txn instanceof EE_Transaction) {
134 134
 			return $this->_current_txn;
135 135
 		}
136
-		$TXN_model = EE_Registry::instance()->load_model( 'Transaction' );
137
-		if ( ! $TXN_model instanceof EEM_Transaction ) {
136
+		$TXN_model = EE_Registry::instance()->load_model('Transaction');
137
+		if ( ! $TXN_model instanceof EEM_Transaction) {
138 138
 			EE_Error::add_error(
139
-				__( 'The transaction model could not be established.', 'event_espresso' ),
139
+				__('The transaction model could not be established.', 'event_espresso'),
140 140
 				__FILE__, __FUNCTION__, __LINE__
141 141
 			);
142 142
 			return NULL;
143 143
 		}
144 144
 		//get the transaction. yes, we may have just loaded it, but it may have been updated, or this may be via an ajax request
145
-		$this->_current_txn = $TXN_model->get_transaction_from_reg_url_link( $this->_reg_url_link );
145
+		$this->_current_txn = $TXN_model->get_transaction_from_reg_url_link($this->_reg_url_link);
146 146
 		// verify TXN
147
-		if ( WP_DEBUG && ! $this->_current_txn instanceof EE_Transaction ) {
147
+		if (WP_DEBUG && ! $this->_current_txn instanceof EE_Transaction) {
148 148
 			EE_Error::add_error(
149
-				__( 'No transaction information could be retrieved or the transaction data is not of the correct type.', 'event_espresso' ),
149
+				__('No transaction information could be retrieved or the transaction data is not of the correct type.', 'event_espresso'),
150 150
 				__FILE__, __FUNCTION__, __LINE__
151 151
 			);
152 152
 			return NULL;
@@ -163,16 +163,16 @@  discard block
 block discarded – undo
163 163
 	 * @param int $since
164 164
 	 * @return    mixed array of EE_Payment || FALSE
165 165
 	 */
166
-	public function get_txn_payments( $since = 0 ) {
167
-		if ( ! $this->get_txn() ) {
166
+	public function get_txn_payments($since = 0) {
167
+		if ( ! $this->get_txn()) {
168 168
 			return FALSE;
169 169
 		}
170
-		$args = array( 'order_by' => array( 'PAY_timestamp' => 'ASC' ));
171
-		if ( $since > 0 ) {
172
-			$args[0] = array( 'PAY_timestamp' => array( '>', $since ));
170
+		$args = array('order_by' => array('PAY_timestamp' => 'ASC'));
171
+		if ($since > 0) {
172
+			$args[0] = array('PAY_timestamp' => array('>', $since));
173 173
 		}
174 174
 		// get array of payments with most recent first
175
-		$payments = $this->_current_txn->payments( $args );
175
+		$payments = $this->_current_txn->payments($args);
176 176
 //		global $wpdb;
177 177
 //		echo $wpdb->last_query;
178 178
 //		EEH_Debug_Tools::printr( $payments, '$payments  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
@@ -188,19 +188,19 @@  discard block
 block discarded – undo
188 188
 	 *  @return 	void
189 189
 	 */
190 190
 	private function _get_reg_url_link() {
191
-		if ( ! empty( $this->_reg_url_link )) {
191
+		if ( ! empty($this->_reg_url_link)) {
192 192
 			return;
193 193
 		}
194 194
 		// only do thank you page stuff if we have a REG_url_link in the url
195
-		if ( WP_DEBUG && ! EE_Registry::instance()->REQ->is_set( 'e_reg_url_link' )) {
195
+		if (WP_DEBUG && ! EE_Registry::instance()->REQ->is_set('e_reg_url_link')) {
196 196
 			EE_Error::add_error(
197
-				__( 'No transaction information could be retrieved because the registration URL link is missing or invalid.', 'event_espresso' ),
197
+				__('No transaction information could be retrieved because the registration URL link is missing or invalid.', 'event_espresso'),
198 198
 				__FILE__, __FUNCTION__, __LINE__
199 199
 			);
200 200
 			return;
201 201
 		}
202 202
 		// check for reg_url_link
203
-		$this->_reg_url_link = EE_Registry::instance()->REQ->get( 'e_reg_url_link' );
203
+		$this->_reg_url_link = EE_Registry::instance()->REQ->get('e_reg_url_link');
204 204
 	}
205 205
 
206 206
 
@@ -212,8 +212,8 @@  discard block
 block discarded – undo
212 212
 	 *  @param  	string $reg_url_link
213 213
 	 *  @return 	string
214 214
 	 */
215
-	public function set_reg_url_link( $reg_url_link = NULL ) {
216
-		$this->_reg_url_link = ! empty( $reg_url_link ) ? $reg_url_link : $this->_reg_url_link;
215
+	public function set_reg_url_link($reg_url_link = NULL) {
216
+		$this->_reg_url_link = ! empty($reg_url_link) ? $reg_url_link : $this->_reg_url_link;
217 217
 	}
218 218
 
219 219
 
@@ -226,25 +226,25 @@  discard block
 block discarded – undo
226 226
 	 *  @param  	WP $WP
227 227
 	 *  @return 	void
228 228
 	 */
229
-	public function run( WP $WP ) {
229
+	public function run(WP $WP) {
230 230
 		// remove site_url() from thank you page URL
231
-		$thank_you_page_URL = substr( EE_Registry::instance()->CFG->core->thank_you_page_url(), strlen( home_url() ) );
231
+		$thank_you_page_URL = substr(EE_Registry::instance()->CFG->core->thank_you_page_url(), strlen(home_url()));
232 232
 		// remove other non-essential details from URL
233
-		$thank_you_page_URL = trim( parse_url( $thank_you_page_URL, PHP_URL_PATH ), '/' );
233
+		$thank_you_page_URL = trim(parse_url($thank_you_page_URL, PHP_URL_PATH), '/');
234 234
 		// ensure this shortcode doesn't trigger on anything BUT the thank you page
235
-		if ( isset( $WP->request ) && trim( $WP->request, '/' ) != $thank_you_page_URL ) {
235
+		if (isset($WP->request) && trim($WP->request, '/') != $thank_you_page_URL) {
236 236
 			return;
237
-		} else if ( isset( $WP->query_vars['page_id'] ) && $WP->query_vars['page_id'] != EE_Registry::instance()->CFG->core->thank_you_page_id ) {
237
+		} else if (isset($WP->query_vars['page_id']) && $WP->query_vars['page_id'] != EE_Registry::instance()->CFG->core->thank_you_page_id) {
238 238
 			return;
239 239
 		}
240 240
 		$this->_get_reg_url_link();
241 241
 		// resend_reg_confirmation_email ?
242
-		if ( EE_Registry::instance()->REQ->is_set( 'resend' )) {
242
+		if (EE_Registry::instance()->REQ->is_set('resend')) {
243 243
 			EES_Espresso_Thank_You::resend_reg_confirmation_email();
244 244
 		}
245 245
 		// load assets
246
-		add_action( 'wp_enqueue_scripts', array( $this, 'load_js' ), 10 );
247
-		EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ );
246
+		add_action('wp_enqueue_scripts', array($this, 'load_js'), 10);
247
+		EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__);
248 248
 		$this->_translate_strings();
249 249
 	}
250 250
 
@@ -257,18 +257,18 @@  discard block
 block discarded – undo
257 257
 	 * 	@return 		void
258 258
 	 */
259 259
 	protected function _translate_strings() {
260
-		EE_Registry::$i18n_js_strings[ 'e_reg_url_link' ] = $this->_reg_url_link;
261
-		EE_Registry::$i18n_js_strings[ 'initial_access' ] = time();
262
-		EE_Registry::$i18n_js_strings[ 'IPN_wait_time' ] = EES_Espresso_Thank_You::IPN_wait_time;
263
-		EE_Registry::$i18n_js_strings[ 'TXN_complete' ] = EEM_Transaction::complete_status_code;
264
-		EE_Registry::$i18n_js_strings[ 'TXN_incomplete' ] = EEM_Transaction::incomplete_status_code;
265
-		EE_Registry::$i18n_js_strings[ 'checking_for_new_payments' ] = __( 'checking for new payments...', 'event_espresso' );
266
-		EE_Registry::$i18n_js_strings[ 'loading_payment_info' ] = __( 'loading payment information...', 'event_espresso' );
267
-		EE_Registry::$i18n_js_strings[ 'server_error' ] = __( 'An unknown error occurred on the server while attempting to process your request. Please refresh the page and try again.', 'event_espresso' );
268
-		EE_Registry::$i18n_js_strings[ 'slow_IPN' ] = apply_filters(
260
+		EE_Registry::$i18n_js_strings['e_reg_url_link'] = $this->_reg_url_link;
261
+		EE_Registry::$i18n_js_strings['initial_access'] = time();
262
+		EE_Registry::$i18n_js_strings['IPN_wait_time'] = EES_Espresso_Thank_You::IPN_wait_time;
263
+		EE_Registry::$i18n_js_strings['TXN_complete'] = EEM_Transaction::complete_status_code;
264
+		EE_Registry::$i18n_js_strings['TXN_incomplete'] = EEM_Transaction::incomplete_status_code;
265
+		EE_Registry::$i18n_js_strings['checking_for_new_payments'] = __('checking for new payments...', 'event_espresso');
266
+		EE_Registry::$i18n_js_strings['loading_payment_info'] = __('loading payment information...', 'event_espresso');
267
+		EE_Registry::$i18n_js_strings['server_error'] = __('An unknown error occurred on the server while attempting to process your request. Please refresh the page and try again.', 'event_espresso');
268
+		EE_Registry::$i18n_js_strings['slow_IPN'] = apply_filters(
269 269
 			'EES_Espresso_Thank_You__load_js__slow_IPN',
270 270
 			sprintf(
271
-				__( '%sThe Payment Notification appears to be taking longer than usual to arrive. Maybe check back later or just wait for your payment and registration confirmation results to be sent to you via email. We apologize for any inconvenience this may have caused.%s', 'event_espresso' ),
271
+				__('%sThe Payment Notification appears to be taking longer than usual to arrive. Maybe check back later or just wait for your payment and registration confirmation results to be sent to you via email. We apologize for any inconvenience this may have caused.%s', 'event_espresso'),
272 272
 				'<div id="espresso-thank-you-page-slow-IPN-dv" class="ee-attention jst-left">',
273 273
 				'</div>'
274 274
 			)
@@ -285,8 +285,8 @@  discard block
 block discarded – undo
285 285
 	 * 	@return 		void
286 286
 	 */
287 287
 	public function load_js() {
288
-		wp_register_script( 'thank_you_page', THANK_YOU_ASSETS_URL . 'thank_you_page.js', array( 'espresso_core', 'heartbeat' ), EVENT_ESPRESSO_VERSION, TRUE );
289
-		wp_enqueue_script( 'thank_you_page' );
288
+		wp_register_script('thank_you_page', THANK_YOU_ASSETS_URL.'thank_you_page.js', array('espresso_core', 'heartbeat'), EVENT_ESPRESSO_VERSION, TRUE);
289
+		wp_enqueue_script('thank_you_page');
290 290
 	}
291 291
 
292 292
 
@@ -299,13 +299,13 @@  discard block
 block discarded – undo
299 299
 	 */
300 300
 	public function init() {
301 301
 		$this->_get_reg_url_link();
302
-		if ( ! $this->get_txn() ) {
303
-			EE_Registry::instance()->load_helper( 'HTML' );
302
+		if ( ! $this->get_txn()) {
303
+			EE_Registry::instance()->load_helper('HTML');
304 304
 
305 305
 			echo EEH_HTML::div(
306
-				EEH_HTML::h4( __( 'We\'re sorry...', 'event_espresso' ), '', '' ) .
306
+				EEH_HTML::h4(__('We\'re sorry...', 'event_espresso'), '', '').
307 307
 				sprintf(
308
-					__( 'This is a system page for displaying transaction information after a purchase.%1$sYou are most likely seeing this notice because you have navigated to this page%1$sthrough some means other than completing a transaction.%1$sSorry for the disappointment, but you will most likely find nothing of interest here.%1$s%1$s', 'event_espresso' ),
308
+					__('This is a system page for displaying transaction information after a purchase.%1$sYou are most likely seeing this notice because you have navigated to this page%1$sthrough some means other than completing a transaction.%1$sSorry for the disappointment, but you will most likely find nothing of interest here.%1$s%1$s', 'event_espresso'),
309 309
 					'<br/>'
310 310
 				),
311 311
 				'', 'ee-attention'
@@ -313,22 +313,22 @@  discard block
 block discarded – undo
313 313
 			return NULL;
314 314
 		}
315 315
 		// if we've made it to the Thank You page, then let's toggle any "Failed" transactions to "Incomplete"
316
-		if ( $this->_current_txn->status_ID() == EEM_Transaction::failed_status_code ) {
317
-			$this->_current_txn->set_status( EEM_Transaction::incomplete_status_code );
316
+		if ($this->_current_txn->status_ID() == EEM_Transaction::failed_status_code) {
317
+			$this->_current_txn->set_status(EEM_Transaction::incomplete_status_code);
318 318
 			$this->_current_txn->save();
319 319
 		}
320 320
 		$this->_primary_registrant = $this->_current_txn->primary_registration() instanceof EE_Registration ? $this->_current_txn->primary_registration() : NULL;
321 321
 		$this->_is_primary = $this->_primary_registrant->reg_url_link() == $this->_reg_url_link ? TRUE : FALSE;
322 322
 
323
-		$show_try_pay_again_link_default =  apply_filters( 'AFEE__EES_Espresso_Thank_You__init__show_try_pay_again_link_default',	TRUE );
323
+		$show_try_pay_again_link_default = apply_filters('AFEE__EES_Espresso_Thank_You__init__show_try_pay_again_link_default', TRUE);
324 324
 		// txn status ?
325
-		if( $this->_current_txn->is_completed() ){
325
+		if ($this->_current_txn->is_completed()) {
326 326
 			$this->_show_try_pay_again_link = $show_try_pay_again_link_default;
327
-		} else if ( $this->_current_txn->is_incomplete() && ( $this->_primary_registrant->is_approved() || $this->_primary_registrant->is_pending_payment() )){
327
+		} else if ($this->_current_txn->is_incomplete() && ($this->_primary_registrant->is_approved() || $this->_primary_registrant->is_pending_payment())) {
328 328
 			$this->_show_try_pay_again_link = TRUE;
329
-		} else if ( $this->_primary_registrant->is_approved() || $this->_primary_registrant->is_pending_payment() ) {
329
+		} else if ($this->_primary_registrant->is_approved() || $this->_primary_registrant->is_pending_payment()) {
330 330
 			// its pending
331
-			$this->_show_try_pay_again_link = isset( EE_Registry::instance()->CFG->registration->show_pending_payment_options ) && EE_Registry::instance()->CFG->registration->show_pending_payment_options ? TRUE : $show_try_pay_again_link_default;
331
+			$this->_show_try_pay_again_link = isset(EE_Registry::instance()->CFG->registration->show_pending_payment_options) && EE_Registry::instance()->CFG->registration->show_pending_payment_options ? TRUE : $show_try_pay_again_link_default;
332 332
 		} else {
333 333
 			$this->_show_try_pay_again_link = $show_try_pay_again_link_default;
334 334
 		}
@@ -350,18 +350,18 @@  discard block
 block discarded – undo
350 350
 		}
351 351
 		// link to SPCO
352 352
 		$revisit_spco_url = add_query_arg(
353
-			array( 'ee'=>'_register', 'revisit'=>TRUE, 'e_reg_url_link'=>$this->_reg_url_link ),
353
+			array('ee'=>'_register', 'revisit'=>TRUE, 'e_reg_url_link'=>$this->_reg_url_link),
354 354
 			EE_Registry::instance()->CFG->core->reg_page_url()
355 355
 		);
356 356
 		// link to SPCO payment_options
357
-		$this->_SPCO_payment_options_url = $this->_primary_registrant instanceof EE_Registration ? $this->_primary_registrant->payment_overview_url() : add_query_arg( array('step'=>'payment_options' ), $revisit_spco_url );
357
+		$this->_SPCO_payment_options_url = $this->_primary_registrant instanceof EE_Registration ? $this->_primary_registrant->payment_overview_url() : add_query_arg(array('step'=>'payment_options'), $revisit_spco_url);
358 358
 		// link to SPCO attendee_information
359 359
 		$this->_SPCO_attendee_information_url = $this->_primary_registrant instanceof EE_Registration ? $this->_primary_registrant->edit_attendee_information_url() : FALSE;
360 360
 
361
-		EE_Registry::instance()->load_helper( 'Template' );
362
-		EE_Registry::instance()->load_helper( 'Template_Validator' );
361
+		EE_Registry::instance()->load_helper('Template');
362
+		EE_Registry::instance()->load_helper('Template_Validator');
363 363
 
364
-		do_action( 'AHEE__EES_Espresso_Thank_You__init_end', $this->_current_txn );
364
+		do_action('AHEE__EES_Espresso_Thank_You__init_end', $this->_current_txn);
365 365
 		// set no cache headers and constants
366 366
 		EE_System::do_not_cache();
367 367
 
@@ -377,31 +377,31 @@  discard block
 block discarded – undo
377 377
 	 *  @param	array 	$attributes
378 378
 	 *  @return 	string
379 379
 	 */
380
-	public function process_shortcode( $attributes = array() ) {
380
+	public function process_shortcode($attributes = array()) {
381 381
 
382 382
 		$this->init();
383 383
 
384
-		if ( ! $this->_current_txn instanceof EE_Transaction ) {
384
+		if ( ! $this->_current_txn instanceof EE_Transaction) {
385 385
 			return EE_Error::get_notices();
386 386
 		}
387 387
 		//EE_Registry::instance()->load_helper( 'Debug_Tools' );
388 388
 		//EEH_Debug_Tools::log( __CLASS__, __FUNCTION__, __LINE__, array( $this->_current_txn ), true, 	'EE_Transaction: ' . $this->_current_txn->ID() );
389 389
 		// link to receipt
390
-		$template_args['TXN_receipt_url'] = $this->_current_txn->receipt_url( 'html' );
391
-		if ( ! empty( $template_args['TXN_receipt_url'] )) {
392
-			$template_args['order_conf_desc'] = __( '%1$sCongratulations%2$sYour registration has been successfully processed.%3$sCheck your email for your registration confirmation or click the button below to view / download / print a full description of your purchases and registration information.', 'event_espresso' );
390
+		$template_args['TXN_receipt_url'] = $this->_current_txn->receipt_url('html');
391
+		if ( ! empty($template_args['TXN_receipt_url'])) {
392
+			$template_args['order_conf_desc'] = __('%1$sCongratulations%2$sYour registration has been successfully processed.%3$sCheck your email for your registration confirmation or click the button below to view / download / print a full description of your purchases and registration information.', 'event_espresso');
393 393
 		} else {
394
-			$template_args['order_conf_desc'] = __( '%1$sCongratulations%2$sYour registration has been successfully processed.%3$sCheck your email for your registration confirmation.', 'event_espresso' );
394
+			$template_args['order_conf_desc'] = __('%1$sCongratulations%2$sYour registration has been successfully processed.%3$sCheck your email for your registration confirmation.', 'event_espresso');
395 395
 		}
396 396
 		$template_args['transaction'] = $this->_current_txn;
397
-		$template_args['revisit'] = EE_Registry::instance()->REQ->get( 'revisit', FALSE );
397
+		$template_args['revisit'] = EE_Registry::instance()->REQ->get('revisit', FALSE);
398 398
 
399
- 		add_action( 'AHEE__thank_you_page_overview_template__content', array( $this, 'get_registration_details' ));
400
- 		if ( $this->_is_primary && ! $this->_current_txn->is_free() ) {
401
-			add_action( 'AHEE__thank_you_page_overview_template__content', array( $this, 'get_ajax_content' ));
399
+ 		add_action('AHEE__thank_you_page_overview_template__content', array($this, 'get_registration_details'));
400
+ 		if ($this->_is_primary && ! $this->_current_txn->is_free()) {
401
+			add_action('AHEE__thank_you_page_overview_template__content', array($this, 'get_ajax_content'));
402 402
 		}
403 403
 
404
-		return EEH_Template::locate_template( THANK_YOU_TEMPLATES_PATH . 'thank-you-page-overview.template.php', $template_args, TRUE, TRUE );
404
+		return EEH_Template::locate_template(THANK_YOU_TEMPLATES_PATH.'thank-you-page-overview.template.php', $template_args, TRUE, TRUE);
405 405
 
406 406
 	}
407 407
 
@@ -418,15 +418,15 @@  discard block
 block discarded – undo
418 418
 	 * @param array $data
419 419
 	 * @return    array
420 420
 	 */
421
-	public static function thank_you_page_IPN_monitor( $response = array(), $data = array() ) {
421
+	public static function thank_you_page_IPN_monitor($response = array(), $data = array()) {
422 422
 		// does this heartbeat contain our data ?
423
-		if ( ! isset( $data['espresso_thank_you_page'] )) {
423
+		if ( ! isset($data['espresso_thank_you_page'])) {
424 424
 			return $response;
425 425
 		}
426 426
 		// check for reg_url_link in the incoming heartbeat data
427
-		if ( ! isset( $data['espresso_thank_you_page']['e_reg_url_link'] )) {
428
-			$response['espresso_thank_you_page'] = array (
429
-				'errors' => ! empty( $notices['errors'] ) ? $notices['errors'] : __( 'No transaction information could be retrieved because the registration URL link is missing or invalid.', 'event_espresso' )
427
+		if ( ! isset($data['espresso_thank_you_page']['e_reg_url_link'])) {
428
+			$response['espresso_thank_you_page'] = array(
429
+				'errors' => ! empty($notices['errors']) ? $notices['errors'] : __('No transaction information could be retrieved because the registration URL link is missing or invalid.', 'event_espresso')
430 430
 			);
431 431
 			return $response;
432 432
 		}
@@ -436,24 +436,24 @@  discard block
 block discarded – undo
436 436
 		EES_Espresso_Thank_You::set_definitions();
437 437
 		/** @var $espresso_thank_you_page EES_Espresso_Thank_You */
438 438
 		$espresso_thank_you_page = EES_Espresso_Thank_You::instance();
439
-		$espresso_thank_you_page->set_reg_url_link( $data['espresso_thank_you_page']['e_reg_url_link'] );
439
+		$espresso_thank_you_page->set_reg_url_link($data['espresso_thank_you_page']['e_reg_url_link']);
440 440
 		$espresso_thank_you_page->init();
441 441
 		//get TXN
442 442
 		$TXN = $espresso_thank_you_page->get_txn();
443 443
 		// no TXN? then get out
444
-		if ( ! $TXN instanceof EE_Transaction ) {
444
+		if ( ! $TXN instanceof EE_Transaction) {
445 445
 			$notices = EE_Error::get_notices();
446
-			$response['espresso_thank_you_page'] = array (
447
-				'errors' => ! empty( $notices['errors'] ) ? $notices['errors'] : sprintf( __( 'The information for your transaction could not be retrieved from the server or the transaction data received was invalid because of a technical reason. (%s)', 'event_espresso' ), __LINE__ )
446
+			$response['espresso_thank_you_page'] = array(
447
+				'errors' => ! empty($notices['errors']) ? $notices['errors'] : sprintf(__('The information for your transaction could not be retrieved from the server or the transaction data received was invalid because of a technical reason. (%s)', 'event_espresso'), __LINE__)
448 448
 			);
449 449
 			return $response;
450 450
 		}
451 451
 		// grab transient of TXN's status
452
-		$txn_status = isset( $data['espresso_thank_you_page']['txn_status'] ) ? $data['espresso_thank_you_page']['txn_status'] : NULL;
452
+		$txn_status = isset($data['espresso_thank_you_page']['txn_status']) ? $data['espresso_thank_you_page']['txn_status'] : NULL;
453 453
 		// has the TXN status changed since we last checked (or empty because this is the first time running through this code)?
454
-		if ( $txn_status !== $TXN->status_ID() ) {
454
+		if ($txn_status !== $TXN->status_ID()) {
455 455
 			// switch between two possible basic outcomes
456
-			switch( $TXN->status_ID()) {
456
+			switch ($TXN->status_ID()) {
457 457
 				// TXN has been updated in some way
458 458
 				case EEM_Transaction::overpaid_status_code:
459 459
 				case EEM_Transaction::complete_status_code:
@@ -468,29 +468,29 @@  discard block
 block discarded – undo
468 468
 				case EEM_Transaction::failed_status_code:
469 469
 				default:
470 470
 					// keep on waiting...
471
-					return $espresso_thank_you_page->_update_server_wait_time( $data['espresso_thank_you_page'] );
471
+					return $espresso_thank_you_page->_update_server_wait_time($data['espresso_thank_you_page']);
472 472
 			}
473 473
 
474 474
 		// or is the TXN still failed (never been updated) ???
475
-		} else if ( $TXN->failed() ) {
475
+		} else if ($TXN->failed()) {
476 476
 			// keep on waiting...
477
-			return $espresso_thank_you_page->_update_server_wait_time( $data['espresso_thank_you_page'] );
477
+			return $espresso_thank_you_page->_update_server_wait_time($data['espresso_thank_you_page']);
478 478
 		}
479 479
 		// TXN is happening so let's get the payments now
480 480
 		// if we've already gotten payments then the heartbeat data will contain the timestamp of the last time we checked
481
-		$since = isset( $data['espresso_thank_you_page']['get_payments_since'] ) ? $data['espresso_thank_you_page']['get_payments_since'] : 0;
481
+		$since = isset($data['espresso_thank_you_page']['get_payments_since']) ? $data['espresso_thank_you_page']['get_payments_since'] : 0;
482 482
 		// then check for payments
483
-		$payments = $espresso_thank_you_page->get_txn_payments( $since );
483
+		$payments = $espresso_thank_you_page->get_txn_payments($since);
484 484
 		// has a payment been processed ?
485
-		if ( ! empty( $payments ) || $espresso_thank_you_page->_is_offline_payment_method ) {
486
-			if ( $since ) {
485
+		if ( ! empty($payments) || $espresso_thank_you_page->_is_offline_payment_method) {
486
+			if ($since) {
487 487
 				$response['espresso_thank_you_page'] = array(
488
-					'new_payments' => $espresso_thank_you_page->get_new_payments( $payments ),
488
+					'new_payments' => $espresso_thank_you_page->get_new_payments($payments),
489 489
 					'transaction_details' => $espresso_thank_you_page->get_transaction_details(),
490 490
 					'txn_status' => $TXN->status_ID()
491 491
 				);
492 492
 			} else {
493
-				$response['espresso_thank_you_page']['payment_details'] = $espresso_thank_you_page->get_payment_details( $payments );
493
+				$response['espresso_thank_you_page']['payment_details'] = $espresso_thank_you_page->get_payment_details($payments);
494 494
 			}
495 495
 			// reset time to check for payments
496 496
 			$response['espresso_thank_you_page']['get_payments_since'] = time();
@@ -510,9 +510,9 @@  discard block
 block discarded – undo
510 510
 	 *  @param 	array $thank_you_page_data thank you page portion of the incoming JSON array from the WP heartbeat data
511 511
 	 *  @return 	array
512 512
 	 */
513
-	private function _update_server_wait_time( $thank_you_page_data = array() ) {
514
-		$response['espresso_thank_you_page'] = array (
515
-			'still_waiting' => isset( $thank_you_page_data['initial_access'] ) ? time() - $thank_you_page_data['initial_access'] : 0,
513
+	private function _update_server_wait_time($thank_you_page_data = array()) {
514
+		$response['espresso_thank_you_page'] = array(
515
+			'still_waiting' => isset($thank_you_page_data['initial_access']) ? time() - $thank_you_page_data['initial_access'] : 0,
516 516
 			'txn_status' => $this->_current_txn->status_ID()
517 517
 		);
518 518
 		return $response;
@@ -535,13 +535,13 @@  discard block
 block discarded – undo
535 535
 		$template_args['SPCO_attendee_information_url'] = $this->_SPCO_attendee_information_url;
536 536
 
537 537
 		$template_args['resend_reg_confirmation_url'] = add_query_arg(
538
-			array( 'token'=>$this->_reg_url_link, 'resend_reg_confirmation' => 'true' ),
538
+			array('token'=>$this->_reg_url_link, 'resend_reg_confirmation' => 'true'),
539 539
 			EE_Registry::instance()->CFG->core->thank_you_page_url()
540 540
 		);
541 541
 		// verify template arguments
542
-		EEH_Template_Validator::verify_instanceof( $template_args['transaction'], '$transaction', 'EE_Transaction' );
543
-		EEH_Template_Validator::verify_isnt_null( $template_args['SPCO_attendee_information_url'], '$SPCO_attendee_information_url');
544
-		echo EEH_Template::locate_template( THANK_YOU_TEMPLATES_PATH . 'thank-you-page-registration-details.template.php', $template_args, TRUE, TRUE );
542
+		EEH_Template_Validator::verify_instanceof($template_args['transaction'], '$transaction', 'EE_Transaction');
543
+		EEH_Template_Validator::verify_isnt_null($template_args['SPCO_attendee_information_url'], '$SPCO_attendee_information_url');
544
+		echo EEH_Template::locate_template(THANK_YOU_TEMPLATES_PATH.'thank-you-page-registration-details.template.php', $template_args, TRUE, TRUE);
545 545
 	}
546 546
 
547 547
 
@@ -550,38 +550,38 @@  discard block
 block discarded – undo
550 550
 	 * 	resend_reg_confirmation_email
551 551
 	 */
552 552
 	public static function resend_reg_confirmation_email() {
553
-		EE_Registry::instance()->load_core( 'Request_Handler' );
554
-		$reg_url_link = EE_Registry::instance()->REQ->get( 'token' );
553
+		EE_Registry::instance()->load_core('Request_Handler');
554
+		$reg_url_link = EE_Registry::instance()->REQ->get('token');
555 555
 
556 556
 		// was a REG_ID passed ?
557
-		if ( $reg_url_link ) {
558
-			$registration = EE_Registry::instance()->load_model( 'Registration' )->get_one( array( array( 'REG_url_link' => $reg_url_link )));
559
-			if ( $registration instanceof EE_Registration ) {
557
+		if ($reg_url_link) {
558
+			$registration = EE_Registry::instance()->load_model('Registration')->get_one(array(array('REG_url_link' => $reg_url_link)));
559
+			if ($registration instanceof EE_Registration) {
560 560
 				// resend email
561
-				EED_Messages::process_resend( array( '_REG_ID' => $registration->ID() ));
561
+				EED_Messages::process_resend(array('_REG_ID' => $registration->ID()));
562 562
 			} else {
563 563
 				EE_Error::add_error(
564
-					__( 'The Registration Confirmation email could not be sent because a valid Registration could not be retrieved from the database.', 'event_espresso' ),
564
+					__('The Registration Confirmation email could not be sent because a valid Registration could not be retrieved from the database.', 'event_espresso'),
565 565
 					__FILE__, __FUNCTION__, __LINE__
566 566
 				);
567 567
 			}
568 568
 		} else {
569 569
 			EE_Error::add_error(
570
-				__( 'The Registration Confirmation email could not be sent because a registration token is missing or invalid.', 'event_espresso' ),
570
+				__('The Registration Confirmation email could not be sent because a registration token is missing or invalid.', 'event_espresso'),
571 571
 				__FILE__, __FUNCTION__, __LINE__
572 572
 			);
573 573
 		}
574 574
 		// request sent via AJAX ?
575
-		if ( EE_FRONT_AJAX ) {
576
-			echo json_encode( EE_Error::get_notices( FALSE ));
575
+		if (EE_FRONT_AJAX) {
576
+			echo json_encode(EE_Error::get_notices(FALSE));
577 577
 			die();
578 578
 		// or was JS disabled ?
579 579
 		} else {
580 580
 			// save errors so that they get picked up on the next request
581
-			EE_Error::get_notices( TRUE, TRUE );
581
+			EE_Error::get_notices(TRUE, TRUE);
582 582
 			wp_safe_redirect(
583 583
 				add_query_arg(
584
-					array( 'e_reg_url_link'=> $reg_url_link ),
584
+					array('e_reg_url_link'=> $reg_url_link),
585 585
 					EE_Registry::instance()->CFG->core->thank_you_page_url()
586 586
 				)
587 587
 			);
@@ -597,26 +597,26 @@  discard block
 block discarded – undo
597 597
 	 *  @return 	void
598 598
 	 */
599 599
 	public function get_ajax_content() {
600
-		if ( ! $this->get_txn() ) {
600
+		if ( ! $this->get_txn()) {
601 601
 			return;
602 602
 		}
603 603
 		// first determine which event(s) require pre-approval or not
604 604
 		$events = array();
605 605
 		$events_requiring_pre_approval = array();
606
-		foreach ( $this->_current_txn->registrations() as $registration ) {
607
-			if ( $registration instanceof EE_Registration ) {
606
+		foreach ($this->_current_txn->registrations() as $registration) {
607
+			if ($registration instanceof EE_Registration) {
608 608
 				$event = $registration->event();
609
-				if ( $event instanceof EE_Event ) {
610
-					if ( $registration->is_not_approved() && $registration->event() instanceof EE_Event ) {
611
-						$events_requiring_pre_approval[ $event->ID() ] = $event;
609
+				if ($event instanceof EE_Event) {
610
+					if ($registration->is_not_approved() && $registration->event() instanceof EE_Event) {
611
+						$events_requiring_pre_approval[$event->ID()] = $event;
612 612
 					} else {
613
-						$events[ $event->ID() ] = $event;
613
+						$events[$event->ID()] = $event;
614 614
 					}
615 615
 				}
616 616
 			}
617 617
 		}
618
-		$this->display_details_for_events_requiring_pre_approval( $events_requiring_pre_approval );
619
-		$this->display_details_for_events( $events );
618
+		$this->display_details_for_events_requiring_pre_approval($events_requiring_pre_approval);
619
+		$this->display_details_for_events($events);
620 620
 	}
621 621
 
622 622
 
@@ -628,21 +628,21 @@  discard block
 block discarded – undo
628 628
 	 * @param EE_Event[] $events
629 629
 	 * @return string
630 630
 	 */
631
-	public function display_details_for_events( $events = array() ) {
632
-		if ( ! empty( $events ) ) {
631
+	public function display_details_for_events($events = array()) {
632
+		if ( ! empty($events)) {
633 633
 			?>
634 634
 			<div id="espresso-thank-you-page-ajax-content-dv">
635 635
 				<div id="espresso-thank-you-page-ajax-transaction-dv"></div>
636 636
 				<div id="espresso-thank-you-page-ajax-payment-dv"></div>
637 637
 					<div id="espresso-thank-you-page-ajax-loading-dv">
638 638
 						<div id="ee-ajax-loading-dv" class="left lt-blue-text">
639
-							<span class="dashicons dashicons-upload"></span><span id="ee-ajax-loading-msg-spn"><?php _e( 'loading transaction and payment information...', 'event_espresso' ); ?></span>
639
+							<span class="dashicons dashicons-upload"></span><span id="ee-ajax-loading-msg-spn"><?php _e('loading transaction and payment information...', 'event_espresso'); ?></span>
640 640
 						</div>
641
-					<?php if ( ! $this->_is_offline_payment_method && ! $this->_payments_closed ) : ?>
641
+					<?php if ( ! $this->_is_offline_payment_method && ! $this->_payments_closed) : ?>
642 642
 						<p id="ee-ajax-loading-pg" class="highlight-bg small-text clear">
643
-							<?php echo apply_filters( 'EES_Espresso_Thank_You__get_ajax_content__waiting_for_IPN_msg', __( 'Some payment gateways can take 15 minutes or more to return their payment notification, so please be patient if you require payment confirmation as soon as possible. Please note that as soon as everything is finalized, we will send your full payment and registration confirmation results to you via email.', 'event_espresso' ) ); ?>
643
+							<?php echo apply_filters('EES_Espresso_Thank_You__get_ajax_content__waiting_for_IPN_msg', __('Some payment gateways can take 15 minutes or more to return their payment notification, so please be patient if you require payment confirmation as soon as possible. Please note that as soon as everything is finalized, we will send your full payment and registration confirmation results to you via email.', 'event_espresso')); ?>
644 644
 							<br/>
645
-							<span class="jst-rght ee-block small-text lt-grey-text"><?php _e( 'current wait time ', 'event_espresso' ); ?>
645
+							<span class="jst-rght ee-block small-text lt-grey-text"><?php _e('current wait time ', 'event_espresso'); ?>
646 646
 								<span id="espresso-thank-you-page-ajax-time-dv">00:00:00</span></span>
647 647
 						</p>
648 648
 					<?php endif; ?>
@@ -662,20 +662,20 @@  discard block
 block discarded – undo
662 662
 	 * @param EE_Event[] $events
663 663
 	 * @return string
664 664
 	 */
665
-	public function display_details_for_events_requiring_pre_approval( $events = array() ) {
666
-		if ( ! empty( $events ) ) {
665
+	public function display_details_for_events_requiring_pre_approval($events = array()) {
666
+		if ( ! empty($events)) {
667 667
 ?>
668 668
 	<div id = "espresso-thank-you-page-not-approved-message-dv" >
669
-		<h4 class="orange-text" ><?php _e( 'Important Notice:', 'event_espresso' );?></h4>
669
+		<h4 class="orange-text" ><?php _e('Important Notice:', 'event_espresso'); ?></h4>
670 670
 		<p id="events-requiring-pre-approval-pg" class="small-text">
671 671
 			<?php echo apply_filters(
672 672
 				'AHEE__EES_Espresso_Thank_You__get_ajax_content__not_approved_message',
673
-				__( 'The following Event(s) you have registered for do not require payment at this time and will not be billed for during this transaction. Billing will only occur after all attendees have been approved by the event organizer. You will be notified when your registration has been processed. If this is a free event, then no billing will occur.', 'event_espresso' )
673
+				__('The following Event(s) you have registered for do not require payment at this time and will not be billed for during this transaction. Billing will only occur after all attendees have been approved by the event organizer. You will be notified when your registration has been processed. If this is a free event, then no billing will occur.', 'event_espresso')
674 674
 			); ?>
675 675
 		</p>
676 676
 		<ul class="events-requiring-pre-approval-ul">
677
-			<?php foreach ( $events as $event ) {
678
-				if ( $event instanceof EE_Event ) {
677
+			<?php foreach ($events as $event) {
678
+				if ($event instanceof EE_Event) {
679 679
 					echo '<li><span class="dashicons dashicons-marker ee-icon-size-16 orange-text"></span>', $event->name(), '</li>';
680 680
 				}
681 681
 			} ?>
@@ -699,15 +699,15 @@  discard block
 block discarded – undo
699 699
 		$template_args = array();
700 700
 		$template_args['transaction'] = $this->_current_txn;
701 701
 		$template_args['reg_url_link'] = $this->_reg_url_link;
702
-		$template_args['primary_registrant_name'] = $this->_primary_registrant->attendee()->full_name( TRUE );
702
+		$template_args['primary_registrant_name'] = $this->_primary_registrant->attendee()->full_name(TRUE);
703 703
 		// link to SPCO payment_options
704 704
 		$template_args['show_try_pay_again_link'] = $this->_show_try_pay_again_link;
705 705
 		$template_args['SPCO_payment_options_url'] = $this->_SPCO_payment_options_url;
706 706
 		// verify template arguments
707
-		EEH_Template_Validator::verify_instanceof( $template_args['transaction'], '$transaction', 'EE_Transaction' );
708
-		EEH_Template_Validator::verify_isnt_null( $template_args['show_try_pay_again_link'], '$show_try_pay_again_link' );
709
-		EEH_Template_Validator::verify_isnt_null( $template_args['SPCO_payment_options_url'], '$SPCO_payment_options_url' );
710
-		return EEH_Template::locate_template( THANK_YOU_TEMPLATES_PATH . 'thank-you-page-transaction-details.template.php', $template_args, TRUE, TRUE );
707
+		EEH_Template_Validator::verify_instanceof($template_args['transaction'], '$transaction', 'EE_Transaction');
708
+		EEH_Template_Validator::verify_isnt_null($template_args['show_try_pay_again_link'], '$show_try_pay_again_link');
709
+		EEH_Template_Validator::verify_isnt_null($template_args['SPCO_payment_options_url'], '$SPCO_payment_options_url');
710
+		return EEH_Template::locate_template(THANK_YOU_TEMPLATES_PATH.'thank-you-page-transaction-details.template.php', $template_args, TRUE, TRUE);
711 711
 	}
712 712
 
713 713
 
@@ -719,9 +719,9 @@  discard block
 block discarded – undo
719 719
 	 *  @param 	EE_Payment	$payment
720 720
 	 *  @return 	string
721 721
 	 */
722
-	public function get_payment_row_html( $payment = NULL ) {
722
+	public function get_payment_row_html($payment = NULL) {
723 723
 		$html = '';
724
-		if ( $payment instanceof EE_Payment ) {
724
+		if ($payment instanceof EE_Payment) {
725 725
 			if (
726 726
 				$payment->payment_method() instanceof EE_Payment_Method
727 727
 				&& $payment->payment_method()->is_off_site()
@@ -730,25 +730,25 @@  discard block
 block discarded – undo
730 730
 				// considering the registrant has made it to the Thank You page,
731 731
 				// any failed payments may actually be pending and the IPN is just slow
732 732
 				// so let's
733
-				$payment->set_status( EEM_Payment::status_id_pending );
733
+				$payment->set_status(EEM_Payment::status_id_pending);
734 734
 			}
735
-			$payment_declined_msg = $payment->STS_ID() === EEM_Payment::status_id_declined ? '<br /><span class="small-text">' . $payment->gateway_response() . '</span>' : '';
735
+			$payment_declined_msg = $payment->STS_ID() === EEM_Payment::status_id_declined ? '<br /><span class="small-text">'.$payment->gateway_response().'</span>' : '';
736 736
 			$html .= '
737 737
 				<tr>
738 738
 					<td>
739
-						' . $payment->timestamp() . '
739
+						' . $payment->timestamp().'
740 740
 					</td>
741 741
 					<td>
742
-						' . ( $payment->payment_method() instanceof EE_Payment_Method ? $payment->payment_method()->name() : __( 'Unknown', 'event_espresso' ) ) . '
742
+						' . ($payment->payment_method() instanceof EE_Payment_Method ? $payment->payment_method()->name() : __('Unknown', 'event_espresso')).'
743 743
 					</td>
744 744
 					<td class="jst-rght">
745
-						' . EEH_Template::format_currency( $payment->amount() ) . '
745
+						' . EEH_Template::format_currency($payment->amount()).'
746 746
 					</td>
747 747
 					<td class="jst-rght" style="line-height:1;">
748
-						' . $payment->pretty_status( TRUE ) . $payment_declined_msg . '
748
+						' . $payment->pretty_status(TRUE).$payment_declined_msg.'
749 749
 					</td>
750 750
 				</tr>';
751
-				do_action( 'AHEE__thank_you_page_payment_details_template__after_each_payment', $payment );
751
+				do_action('AHEE__thank_you_page_payment_details_template__after_each_payment', $payment);
752 752
 		}
753 753
 		return $html;
754 754
 	}
@@ -762,17 +762,17 @@  discard block
 block discarded – undo
762 762
 	 * @param    array $payments
763 763
 	 * @return    string
764 764
 	 */
765
-	public function get_payment_details( $payments = array() ) {
765
+	public function get_payment_details($payments = array()) {
766 766
 		//prepare variables for displaying
767 767
 		$template_args = array();
768 768
 		$template_args['transaction'] = $this->_current_txn;
769 769
 		$template_args['reg_url_link'] = $this->_reg_url_link;
770 770
 		$template_args['payments'] = array();
771
-		foreach ( $payments as $payment ) {
772
-			$template_args['payments'][] = $this->get_payment_row_html( $payment );
771
+		foreach ($payments as $payment) {
772
+			$template_args['payments'][] = $this->get_payment_row_html($payment);
773 773
 		}
774 774
 		//create a hacky payment object, but dont save it
775
-		$payment = EE_Payment::new_instance( array(
775
+		$payment = EE_Payment::new_instance(array(
776 776
 			'TXN_ID'=>$this->_current_txn->ID(),
777 777
 			'STS_ID'=>EEM_Payment::status_id_pending,
778 778
 			'PAY_timestamp'=>time(),
@@ -780,21 +780,21 @@  discard block
 block discarded – undo
780 780
 			'PMD_ID'=>$this->_current_txn->payment_method_ID()
781 781
 		));
782 782
 		$payment_method = $this->_current_txn->payment_method();
783
-		if ( $payment_method instanceof EE_Payment_Method && $payment_method->type_obj() instanceof EE_PMT_Base ) {
784
-			$template_args[ 'gateway_content' ] = $payment_method->type_obj()->payment_overview_content( $payment );
783
+		if ($payment_method instanceof EE_Payment_Method && $payment_method->type_obj() instanceof EE_PMT_Base) {
784
+			$template_args['gateway_content'] = $payment_method->type_obj()->payment_overview_content($payment);
785 785
 		} else {
786
-			$template_args[ 'gateway_content' ] = '';
786
+			$template_args['gateway_content'] = '';
787 787
 		}
788 788
 		// link to SPCO payment_options
789 789
 		$template_args['show_try_pay_again_link'] = $this->_show_try_pay_again_link;
790 790
 		$template_args['SPCO_payment_options_url'] = $this->_SPCO_payment_options_url;
791 791
 		// verify template arguments
792
-		EEH_Template_Validator::verify_instanceof( $template_args['transaction'], '$transaction', 'EE_Transaction' );
793
-		EEH_Template_Validator::verify_isnt_null( $template_args['payments'], '$payments' );
794
-		EEH_Template_Validator::verify_isnt_null( $template_args['show_try_pay_again_link'], '$show_try_pay_again_link' );
795
-		EEH_Template_Validator::verify_isnt_null( $template_args['gateway_content'], '$gateway_content');
796
-		EEH_Template_Validator::verify_isnt_null( $template_args['SPCO_payment_options_url'], '$SPCO_payment_options_url');
797
-		return EEH_Template::locate_template( THANK_YOU_TEMPLATES_PATH . 'thank-you-page-payment-details.template.php', $template_args, TRUE, TRUE );
792
+		EEH_Template_Validator::verify_instanceof($template_args['transaction'], '$transaction', 'EE_Transaction');
793
+		EEH_Template_Validator::verify_isnt_null($template_args['payments'], '$payments');
794
+		EEH_Template_Validator::verify_isnt_null($template_args['show_try_pay_again_link'], '$show_try_pay_again_link');
795
+		EEH_Template_Validator::verify_isnt_null($template_args['gateway_content'], '$gateway_content');
796
+		EEH_Template_Validator::verify_isnt_null($template_args['SPCO_payment_options_url'], '$SPCO_payment_options_url');
797
+		return EEH_Template::locate_template(THANK_YOU_TEMPLATES_PATH.'thank-you-page-payment-details.template.php', $template_args, TRUE, TRUE);
798 798
 	}
799 799
 
800 800
 
@@ -806,11 +806,11 @@  discard block
 block discarded – undo
806 806
 	 * @param array $payments
807 807
 	 * @return    string
808 808
 	 */
809
-	public function get_new_payments( $payments = array() ) {
809
+	public function get_new_payments($payments = array()) {
810 810
 		$payments_html = '';
811 811
 		//prepare variables for displaying
812
-		foreach ( $payments as $payment ) {
813
-			$payments_html .= $this->get_payment_row_html( $payment );
812
+		foreach ($payments as $payment) {
813
+			$payments_html .= $this->get_payment_row_html($payment);
814 814
 		}
815 815
 		return $payments_html;
816 816
 	}
Please login to merge, or discard this patch.
libraries/messages/defaults/default/html_receipt_attendee_list.template.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -6,11 +6,11 @@
 block discarded – undo
6 6
 <li class="ticket-registration">
7 7
 	<table class="registration-details">
8 8
 		<tr class="odd">
9
-			<th><?php	_e('Attendee', 'event_espresso');?></th>
9
+			<th><?php	_e('Attendee', 'event_espresso'); ?></th>
10 10
 			<td>[FNAME] [LNAME] ([ATTENDEE_EMAIL])</td>
11 11
 		</tr>
12 12
 		<tr>
13
-			<th><?php _e("Registration Code:", "event_espresso");?></th>
13
+			<th><?php _e("Registration Code:", "event_espresso"); ?></th>
14 14
 			<td>[REGISTRATION_CODE] - <span class="[REGISTRATION_STATUS_ID]">[REGISTRATION_STATUS_LABEL]</span></td>
15 15
 		</tr>
16 16
 	</table>
Please login to merge, or discard this patch.
core/helpers/EEH_Activation.helper.php 4 patches
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -647,6 +647,7 @@
 block discarded – undo
647 647
 	 * 	@access public
648 648
 	 * 	@static
649 649
 	 * 	@param string $table_name, without prefixed $wpdb->prefix
650
+	 * @param string $table_name
650 651
 	 * 	@return array of database column names
651 652
 	 */
652 653
 	public static function get_fields_on_table( $table_name = NULL ) {
Please login to merge, or discard this patch.
Braces   +16 added lines, -12 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@  discard block
 block discarded – undo
1
-<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 /**
3 5
  * Event Espresso
4 6
  *
@@ -140,15 +142,15 @@  discard block
 block discarded – undo
140 142
 		);
141 143
 		if( $which_to_include === 'all' ) {
142 144
 			//leave as-is
143
-		}elseif( $which_to_include === 'old' ) {
145
+		} elseif( $which_to_include === 'old' ) {
144 146
 			$cron_tasks = array_filter( $cron_tasks, function ( $value ) {
145 147
 				return $value === EEH_Activation::cron_task_no_longer_in_use;
146 148
 			});
147
-		}elseif( $which_to_include === 'current' ) {
149
+		} elseif( $which_to_include === 'current' ) {
148 150
 			$cron_tasks = array_filter( $cron_tasks );
149
-		}elseif( WP_DEBUG ) {
151
+		} elseif( WP_DEBUG ) {
150 152
 			throw new EE_Error( sprintf( __( 'Invalidate argument of "%1$s" passed to EEH_Activation::get_cron_tasks. Valid values are "all", "old" and "current".', 'event_espresso' ), $which_to_include ) );
151
-		}else{
153
+		} else{
152 154
 			//leave as-is
153 155
 		}
154 156
 		return $cron_tasks;
@@ -401,7 +403,7 @@  discard block
 block discarded – undo
401 403
 		$post_id = $wpdb->get_var("SELECT ID FROM {$wpdb->posts} WHERE post_content LIKE '%$shortcode_and_opening_bracket%' LIMIT 1");
402 404
 		if($post_id){
403 405
 			return get_post($post_id);
404
-		}else{
406
+		} else{
405 407
 			return NULL;
406 408
 		}
407 409
 
@@ -772,13 +774,13 @@  discard block
 block discarded – undo
772 774
 					foreach( $current_data_migration_script->get_errors() as $error ){
773 775
 						EE_Error::add_error($error, __FILE__, __FUNCTION__, __LINE__ );
774 776
 					}
775
-				}else{
777
+				} else{
776 778
 					EE_Error::add_error( __( 'There were errors creating the Event Espresso database tables and Event Espresso has been deactivated. To view the errors, please enable WP_DEBUG in your wp-config.php file.', 'event_espresso' ) );
777 779
 				}
778 780
 				return false;
779 781
 			}
780 782
 			EE_Data_Migration_Manager::instance()->update_current_database_state_to();
781
-		}else{
783
+		} else{
782 784
 			EE_Error::add_error( __( 'Could not determine most up-to-date data migration script from which to pull database schema structure. So database is probably not setup properly', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__);
783 785
 			return false;
784 786
 		}
@@ -1070,7 +1072,7 @@  discard block
 block discarded – undo
1070 1072
 		if( ! EEM_Payment_Method::instance()->count_active( EEM_Payment_Method::scope_cart ) ){
1071 1073
 			EE_Registry::instance()->load_lib( 'Payment_Method_Manager' );
1072 1074
 			EE_Payment_Method_Manager::instance()->activate_a_payment_method_of_type( 'Invoice' );
1073
-		}else{
1075
+		} else{
1074 1076
 			EEM_Payment_Method::instance()->verify_button_urls();
1075 1077
 		}
1076 1078
 	}
@@ -1226,7 +1228,9 @@  discard block
 block discarded – undo
1226 1228
 		//do an initial loop to determine if we need to continue
1227 1229
 		$def_ms = array();
1228 1230
 		foreach ( $default_messengers as $msgr ) {
1229
-			if ( isset($active_messengers[$msgr] ) || isset( $has_activated[$msgr] ) ) continue;
1231
+			if ( isset($active_messengers[$msgr] ) || isset( $has_activated[$msgr] ) ) {
1232
+				continue;
1233
+			}
1230 1234
 			$def_ms[] = $msgr;
1231 1235
 		}
1232 1236
 
@@ -1555,7 +1559,7 @@  discard block
 block discarded – undo
1555 1559
 				if( ! delete_option( $option_name ) ){
1556 1560
 					$undeleted_options[] = $option_name;
1557 1561
 				}
1558
-			}else{
1562
+			} else{
1559 1563
 				$option_names_to_delete_from_wildcard = $wpdb->get_col( "SELECT option_name FROM $wpdb->options WHERE option_name LIKE '%$option_name%'" );
1560 1564
 				foreach($option_names_to_delete_from_wildcard as $option_name_from_wildcard ){
1561 1565
 					if( ! delete_option( $option_name_from_wildcard ) ){
@@ -1619,7 +1623,7 @@  discard block
 block discarded – undo
1619 1623
 		$EZSQL_ERROR = $ezsql_error_cache;
1620 1624
 		if( empty( $new_error ) ){
1621 1625
 			return TRUE;
1622
-		}else{
1626
+		} else{
1623 1627
 			return FALSE;
1624 1628
 		}
1625 1629
 	}
Please login to merge, or discard this patch.
Spacing   +358 added lines, -358 removed lines patch added patch discarded remove patch
@@ -57,9 +57,9 @@  discard block
 block discarded – undo
57 57
 	 * @param $table_name
58 58
 	 * @return string
59 59
 	 */
60
-	public static function ensure_table_name_has_prefix( $table_name ) {
60
+	public static function ensure_table_name_has_prefix($table_name) {
61 61
 		global $wpdb;
62
-		return strpos( $table_name, $wpdb->prefix ) === 0 ? $table_name : $wpdb->prefix . $table_name;
62
+		return strpos($table_name, $wpdb->prefix) === 0 ? $table_name : $wpdb->prefix.$table_name;
63 63
 	}
64 64
 
65 65
 
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 	 * be called on plugin activation and reactivation
86 86
 	 * @return boolean success, whether the database and folders are setup properly
87 87
 	 */
88
-	public static function initialize_db_and_folders(){
88
+	public static function initialize_db_and_folders() {
89 89
 		$good_filesystem = EEH_Activation::create_upload_directories();
90 90
 		$good_db = EEH_Activation::create_database_tables();
91 91
 		return $good_filesystem && $good_db;
@@ -99,9 +99,9 @@  discard block
 block discarded – undo
99 99
 	 * upon activation of a new plugin, reactivation, and at the end
100 100
 	 * of running migration scripts
101 101
 	 */
102
-	public static function initialize_db_content(){
102
+	public static function initialize_db_content() {
103 103
 		//let's avoid doing all this logic repeatedly, especially when addons are requesting it
104
-		if( EEH_Activation::$_initialized_db_content_already_in_this_request ) {
104
+		if (EEH_Activation::$_initialized_db_content_already_in_this_request) {
105 105
 			return;
106 106
 		}
107 107
 		EEH_Activation::$_initialized_db_content_already_in_this_request = true;
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
 		EEH_Activation::remove_cron_tasks();
119 119
 		EEH_Activation::create_cron_tasks();
120 120
 		//also, check for CAF default db content
121
-		do_action( 'AHEE__EEH_Activation__initialize_db_content' );
121
+		do_action('AHEE__EEH_Activation__initialize_db_content');
122 122
 		//also: EEM_Gateways::load_all_gateways() outputs a lot of success messages
123 123
 		//which users really won't care about on initial activation
124 124
 		EE_Error::overwrite_success();
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
 	 * @return array
138 138
 	 * @throws \EE_Error
139 139
 	 */
140
-	public static function get_cron_tasks( $which_to_include ) {
140
+	public static function get_cron_tasks($which_to_include) {
141 141
 		$cron_tasks = apply_filters(
142 142
 			'FHEE__EEH_Activation__get_cron_tasks',
143 143
 			array(
@@ -146,17 +146,17 @@  discard block
 block discarded – undo
146 146
 				'AHEE__EE_Cron_Tasks__update_transaction_with_payment' => EEH_Activation::cron_task_no_longer_in_use, //there may have been a bug which prevented from these cron tasks from getting unscheduled, so we might want to remove these for a few updates
147 147
 			)
148 148
 		);
149
-		if( $which_to_include === 'all' ) {
149
+		if ($which_to_include === 'all') {
150 150
 			//leave as-is
151
-		}elseif( $which_to_include === 'old' ) {
152
-			$cron_tasks = array_filter( $cron_tasks, function ( $value ) {
151
+		}elseif ($which_to_include === 'old') {
152
+			$cron_tasks = array_filter($cron_tasks, function($value) {
153 153
 				return $value === EEH_Activation::cron_task_no_longer_in_use;
154 154
 			});
155
-		}elseif( $which_to_include === 'current' ) {
156
-			$cron_tasks = array_filter( $cron_tasks );
157
-		}elseif( WP_DEBUG ) {
158
-			throw new EE_Error( sprintf( __( 'Invalidate argument of "%1$s" passed to EEH_Activation::get_cron_tasks. Valid values are "all", "old" and "current".', 'event_espresso' ), $which_to_include ) );
159
-		}else{
155
+		}elseif ($which_to_include === 'current') {
156
+			$cron_tasks = array_filter($cron_tasks);
157
+		}elseif (WP_DEBUG) {
158
+			throw new EE_Error(sprintf(__('Invalidate argument of "%1$s" passed to EEH_Activation::get_cron_tasks. Valid values are "all", "old" and "current".', 'event_espresso'), $which_to_include));
159
+		} else {
160 160
 			//leave as-is
161 161
 		}
162 162
 		return $cron_tasks;
@@ -167,9 +167,9 @@  discard block
 block discarded – undo
167 167
 	 */
168 168
 	public static function create_cron_tasks() {
169 169
 
170
-		foreach( EEH_Activation::get_cron_tasks( 'current' ) as $hook_name => $frequency ) {
171
-			if( ! wp_next_scheduled( $hook_name ) ) {
172
-				wp_schedule_event( time(), $frequency, $hook_name );
170
+		foreach (EEH_Activation::get_cron_tasks('current') as $hook_name => $frequency) {
171
+			if ( ! wp_next_scheduled($hook_name)) {
172
+				wp_schedule_event(time(), $frequency, $hook_name);
173 173
 			}
174 174
 		}
175 175
 
@@ -179,10 +179,10 @@  discard block
 block discarded – undo
179 179
 	 * Remove the currently-existing and now-removed cron tasks.
180 180
 	 * @param boolean $remove_all whether to only remove the old ones, or remove absolutely ALL the EE ones
181 181
 	 */
182
-	public static function remove_cron_tasks( $remove_all = true ) {
182
+	public static function remove_cron_tasks($remove_all = true) {
183 183
 		$cron_tasks_to_remove = $remove_all ? 'all' : 'old';
184 184
 		$crons = _get_cron_array();
185
-		$crons = is_array( $crons ) ? $crons : array();
185
+		$crons = is_array($crons) ? $crons : array();
186 186
 		/* reminder that $crons looks like: top-level keys are timestamps,
187 187
 		 * and their values are arrays.
188 188
 		 * The 2nd level arrays have keys with each of the cron task hooknames to run at that time
@@ -200,14 +200,14 @@  discard block
 block discarded – undo
200 200
 		 *					...
201 201
 		 *      ...
202 202
 		 */
203
-		foreach( EEH_Activation::get_cron_tasks( $cron_tasks_to_remove ) as $hook_name => $frequency ) {
204
-			foreach( $crons as $timestamp => $hooks_to_fire_at_time ) {
205
-				if ( array_key_exists( $hook_name, $hooks_to_fire_at_time ) )  {
206
-					unset( $crons[ $timestamp ][ $hook_name ] );
203
+		foreach (EEH_Activation::get_cron_tasks($cron_tasks_to_remove) as $hook_name => $frequency) {
204
+			foreach ($crons as $timestamp => $hooks_to_fire_at_time) {
205
+				if (array_key_exists($hook_name, $hooks_to_fire_at_time)) {
206
+					unset($crons[$timestamp][$hook_name]);
207 207
 				}
208 208
 			}
209 209
 		}
210
-		_set_cron_array( $crons );
210
+		_set_cron_array($crons);
211 211
 	}
212 212
 
213 213
 
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
 	 */
223 223
 	public static function CPT_initialization() {
224 224
 		// register Custom Post Types
225
-		EE_Registry::instance()->load_core( 'Register_CPTs' );
225
+		EE_Registry::instance()->load_core('Register_CPTs');
226 226
 		flush_rewrite_rules();
227 227
 	}
228 228
 
@@ -240,8 +240,8 @@  discard block
 block discarded – undo
240 240
 	 * 	@return void
241 241
 	 */
242 242
 	public static function reset_and_update_config() {
243
-		do_action( 'AHEE__EE_Config___load_core_config__start', array( 'EEH_Activation', 'load_calendar_config' ) );
244
-		add_filter( 'FHEE__EE_Config___load_core_config__config_settings', array( 'EEH_Activation', 'migrate_old_config_data' ), 10, 3 );
243
+		do_action('AHEE__EE_Config___load_core_config__start', array('EEH_Activation', 'load_calendar_config'));
244
+		add_filter('FHEE__EE_Config___load_core_config__config_settings', array('EEH_Activation', 'migrate_old_config_data'), 10, 3);
245 245
 		//EE_Config::reset();
246 246
 	}
247 247
 
@@ -254,23 +254,23 @@  discard block
 block discarded – undo
254 254
 	 */
255 255
 	public static function load_calendar_config() {
256 256
 		// grab array of all plugin folders and loop thru it
257
-		$plugins = glob( WP_PLUGIN_DIR . DS . '*', GLOB_ONLYDIR );
258
-		if ( empty( $plugins ) ) {
257
+		$plugins = glob(WP_PLUGIN_DIR.DS.'*', GLOB_ONLYDIR);
258
+		if (empty($plugins)) {
259 259
 			return;
260 260
 		}
261
-		foreach ( $plugins as $plugin_path ) {
261
+		foreach ($plugins as $plugin_path) {
262 262
 			// grab plugin folder name from path
263
-			$plugin = basename( $plugin_path );
263
+			$plugin = basename($plugin_path);
264 264
 			// drill down to Espresso plugins
265
-			if ( strpos( $plugin, 'espresso' ) !== FALSE || strpos( $plugin, 'Espresso' ) !== FALSE || strpos( $plugin, 'ee4' ) !== FALSE || strpos( $plugin, 'EE4' ) !== FALSE ) {
265
+			if (strpos($plugin, 'espresso') !== FALSE || strpos($plugin, 'Espresso') !== FALSE || strpos($plugin, 'ee4') !== FALSE || strpos($plugin, 'EE4') !== FALSE) {
266 266
 				// then to calendar related plugins
267
-				if ( strpos( $plugin, 'calendar' ) !== FALSE ) {
267
+				if (strpos($plugin, 'calendar') !== FALSE) {
268 268
 					// this is what we are looking for
269
-					$calendar_config = $plugin_path . DS . 'EE_Calendar_Config.php';
269
+					$calendar_config = $plugin_path.DS.'EE_Calendar_Config.php';
270 270
 					// does it exist in this folder ?
271
-					if ( is_readable( $calendar_config )) {
271
+					if (is_readable($calendar_config)) {
272 272
 						// YEAH! let's load it
273
-						require_once( $calendar_config );
273
+						require_once($calendar_config);
274 274
 					}
275 275
 				}
276 276
 			}
@@ -287,21 +287,21 @@  discard block
 block discarded – undo
287 287
 	 * @param \EE_Config $EE_Config
288 288
 	 * @return \stdClass
289 289
 	 */
290
-	public static function migrate_old_config_data( $settings = array(), $config = '', EE_Config $EE_Config ) {
291
-		$convert_from_array = array( 'addons' );
290
+	public static function migrate_old_config_data($settings = array(), $config = '', EE_Config $EE_Config) {
291
+		$convert_from_array = array('addons');
292 292
 		// in case old settings were saved as an array
293
-		if ( is_array( $settings ) && in_array( $config, $convert_from_array )) {
293
+		if (is_array($settings) && in_array($config, $convert_from_array)) {
294 294
 			// convert existing settings to an object
295 295
 			$config_array = $settings;
296 296
 			$settings = new stdClass();
297
-			foreach ( $config_array as $key => $value ){
298
-				if ( $key == 'calendar' && class_exists( 'EE_Calendar_Config' )) {
299
-					$EE_Config->set_config( 'addons', 'EE_Calendar', 'EE_Calendar_Config', $value );
297
+			foreach ($config_array as $key => $value) {
298
+				if ($key == 'calendar' && class_exists('EE_Calendar_Config')) {
299
+					$EE_Config->set_config('addons', 'EE_Calendar', 'EE_Calendar_Config', $value);
300 300
 				} else {
301 301
 					$settings->$key = $value;
302 302
 				}
303 303
 			}
304
-			add_filter( 'FHEE__EE_Config___load_core_config__update_espresso_config', '__return_true' );
304
+			add_filter('FHEE__EE_Config___load_core_config__update_espresso_config', '__return_true');
305 305
 		}
306 306
 		return $settings;
307 307
 	}
@@ -317,8 +317,8 @@  discard block
 block discarded – undo
317 317
 	 */
318 318
 	public static function deactivate_event_espresso() {
319 319
 		// check permissions
320
-		if ( current_user_can( 'activate_plugins' )) {
321
-			deactivate_plugins( EE_PLUGIN_BASENAME, TRUE );
320
+		if (current_user_can('activate_plugins')) {
321
+			deactivate_plugins(EE_PLUGIN_BASENAME, TRUE);
322 322
 		}
323 323
 	}
324 324
 
@@ -340,79 +340,79 @@  discard block
 block discarded – undo
340 340
 		$critical_pages = array(
341 341
 			array(
342 342
 				'id' =>'reg_page_id',
343
-				'name' => __( 'Registration Checkout', 'event_espresso' ),
343
+				'name' => __('Registration Checkout', 'event_espresso'),
344 344
 				'post' => NULL,
345 345
 				'code' => 'ESPRESSO_CHECKOUT'
346 346
 			),
347 347
 			array(
348 348
 				'id' => 'txn_page_id',
349
-				'name' => __( 'Transactions', 'event_espresso' ),
349
+				'name' => __('Transactions', 'event_espresso'),
350 350
 				'post' => NULL,
351 351
 				'code' => 'ESPRESSO_TXN_PAGE'
352 352
 			),
353 353
 			array(
354 354
 				'id' => 'thank_you_page_id',
355
-				'name' => __( 'Thank You', 'event_espresso' ),
355
+				'name' => __('Thank You', 'event_espresso'),
356 356
 				'post' => NULL,
357 357
 				'code' => 'ESPRESSO_THANK_YOU'
358 358
 			),
359 359
 			array(
360 360
 				'id' => 'cancel_page_id',
361
-				'name' => __( 'Registration Cancelled', 'event_espresso' ),
361
+				'name' => __('Registration Cancelled', 'event_espresso'),
362 362
 				'post' => NULL,
363 363
 				'code' => 'ESPRESSO_CANCELLED'
364 364
 			),
365 365
 		);
366 366
 
367
-		foreach ( $critical_pages as $critical_page ) {
367
+		foreach ($critical_pages as $critical_page) {
368 368
 			// is critical page ID set in config ?
369
-			if ( EE_Registry::instance()->CFG->core->$critical_page['id'] !== FALSE ) {
369
+			if (EE_Registry::instance()->CFG->core->$critical_page['id'] !== FALSE) {
370 370
 				// attempt to find post by ID
371
-				$critical_page['post'] = get_post( EE_Registry::instance()->CFG->core->$critical_page['id'] );
371
+				$critical_page['post'] = get_post(EE_Registry::instance()->CFG->core->$critical_page['id']);
372 372
 			}
373 373
 			// no dice?
374
-			if ( $critical_page['post'] == NULL ) {
374
+			if ($critical_page['post'] == NULL) {
375 375
 				// attempt to find post by title
376
-				$critical_page['post'] = self::get_page_by_ee_shortcode( $critical_page['code'] );
376
+				$critical_page['post'] = self::get_page_by_ee_shortcode($critical_page['code']);
377 377
 				// still nothing?
378
-				if ( $critical_page['post'] == NULL ) {
379
-					$critical_page = EEH_Activation::create_critical_page( $critical_page );
378
+				if ($critical_page['post'] == NULL) {
379
+					$critical_page = EEH_Activation::create_critical_page($critical_page);
380 380
 					// REALLY? Still nothing ??!?!?
381
-					if ( $critical_page['post'] == NULL ) {
382
-						$msg = __( 'The Event Espresso critical page configuration settings could not be updated.', 'event_espresso' );
383
-						EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
381
+					if ($critical_page['post'] == NULL) {
382
+						$msg = __('The Event Espresso critical page configuration settings could not be updated.', 'event_espresso');
383
+						EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
384 384
 						break;
385 385
 					}
386 386
 				}
387 387
 			}
388 388
 			// track post_shortcodes
389
-			if ( $critical_page['post'] ) {
390
-				EEH_Activation::_track_critical_page_post_shortcodes( $critical_page );
389
+			if ($critical_page['post']) {
390
+				EEH_Activation::_track_critical_page_post_shortcodes($critical_page);
391 391
 			}
392 392
 			// check that Post ID matches critical page ID in config
393
-			if ( isset( $critical_page['post']->ID ) && $critical_page['post']->ID != EE_Registry::instance()->CFG->core->$critical_page['id'] ) {
393
+			if (isset($critical_page['post']->ID) && $critical_page['post']->ID != EE_Registry::instance()->CFG->core->$critical_page['id']) {
394 394
 				//update Config with post ID
395 395
 				EE_Registry::instance()->CFG->core->$critical_page['id'] = $critical_page['post']->ID;
396
-				if ( ! EE_Config::instance()->update_espresso_config( FALSE, FALSE ) ) {
397
-					$msg = __( 'The Event Espresso critical page configuration settings could not be updated.', 'event_espresso' );
398
-					EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
396
+				if ( ! EE_Config::instance()->update_espresso_config(FALSE, FALSE)) {
397
+					$msg = __('The Event Espresso critical page configuration settings could not be updated.', 'event_espresso');
398
+					EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
399 399
 				}
400 400
 			}
401 401
 
402
-			$critical_page_problem =  ! isset( $critical_page['post']->post_status ) || $critical_page['post']->post_status != 'publish' || strpos( $critical_page['post']->post_content, $critical_page['code'] ) === FALSE ? TRUE : $critical_page_problem;
402
+			$critical_page_problem = ! isset($critical_page['post']->post_status) || $critical_page['post']->post_status != 'publish' || strpos($critical_page['post']->post_content, $critical_page['code']) === FALSE ? TRUE : $critical_page_problem;
403 403
 
404 404
 		}
405 405
 
406
-		if ( $critical_page_problem ) {
406
+		if ($critical_page_problem) {
407 407
 			$msg = sprintf(
408
-				__('A potential issue has been detected with one or more of your Event Espresso pages. Go to %s to view your Event Espresso pages.', 'event_espresso' ),
409
-				'<a href="' . admin_url('admin.php?page=espresso_general_settings&action=critical_pages') . '">' . __('Event Espresso Critical Pages Settings', 'event_espresso') . '</a>'
408
+				__('A potential issue has been detected with one or more of your Event Espresso pages. Go to %s to view your Event Espresso pages.', 'event_espresso'),
409
+				'<a href="'.admin_url('admin.php?page=espresso_general_settings&action=critical_pages').'">'.__('Event Espresso Critical Pages Settings', 'event_espresso').'</a>'
410 410
 			);
411
-			EE_Error::add_persistent_admin_notice( 'critical_page_problem', $msg );
411
+			EE_Error::add_persistent_admin_notice('critical_page_problem', $msg);
412 412
 		}
413 413
 
414
-		if ( EE_Error::has_notices() ) {
415
-			EE_Error::get_notices( FALSE, TRUE, TRUE );
414
+		if (EE_Error::has_notices()) {
415
+			EE_Error::get_notices(FALSE, TRUE, TRUE);
416 416
 		}
417 417
 
418 418
 	}
@@ -425,13 +425,13 @@  discard block
 block discarded – undo
425 425
 	 * parameter to the shortcode
426 426
 	 * @return WP_Post or NULl
427 427
 	 */
428
-	public static function get_page_by_ee_shortcode($ee_shortcode){
428
+	public static function get_page_by_ee_shortcode($ee_shortcode) {
429 429
 		global $wpdb;
430 430
 		$shortcode_and_opening_bracket = '['.$ee_shortcode;
431 431
 		$post_id = $wpdb->get_var("SELECT ID FROM {$wpdb->posts} WHERE post_content LIKE '%$shortcode_and_opening_bracket%' LIMIT 1");
432
-		if($post_id){
432
+		if ($post_id) {
433 433
 			return get_post($post_id);
434
-		}else{
434
+		} else {
435 435
 			return NULL;
436 436
 		}
437 437
 
@@ -448,32 +448,32 @@  discard block
 block discarded – undo
448 448
 	 * @param array $critical_page
449 449
 	 * @return array
450 450
 	 */
451
-	public static function create_critical_page( $critical_page ) {
451
+	public static function create_critical_page($critical_page) {
452 452
 
453 453
 		$post_args = array(
454 454
 			'post_title' => $critical_page['name'],
455 455
 			'post_status' => 'publish',
456 456
 			'post_type' => 'page',
457 457
 			'comment_status' => 'closed',
458
-			'post_content' => '[' . $critical_page['code'] . ']'
458
+			'post_content' => '['.$critical_page['code'].']'
459 459
 		);
460 460
 
461
-		$post_id = wp_insert_post( $post_args );
462
-		if ( ! $post_id ) {
461
+		$post_id = wp_insert_post($post_args);
462
+		if ( ! $post_id) {
463 463
 			$msg = sprintf(
464
-				__( 'The Event Espresso  critical page entitled "%s" could not be created.', 'event_espresso' ),
464
+				__('The Event Espresso  critical page entitled "%s" could not be created.', 'event_espresso'),
465 465
 				$critical_page['name']
466 466
 			);
467
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
467
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
468 468
 			return $critical_page;
469 469
 		}
470 470
 		// get newly created post's details
471
-		if ( ! $critical_page['post'] = get_post( $post_id )) {
471
+		if ( ! $critical_page['post'] = get_post($post_id)) {
472 472
 			$msg = sprintf(
473
-				__( 'The Event Espresso critical page entitled "%s" could not be retrieved.', 'event_espresso' ),
473
+				__('The Event Espresso critical page entitled "%s" could not be retrieved.', 'event_espresso'),
474 474
 				$critical_page['name']
475 475
 			);
476
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
476
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
477 477
 		}
478 478
 
479 479
 		return $critical_page;
@@ -492,34 +492,34 @@  discard block
 block discarded – undo
492 492
 	 * @param array $critical_page
493 493
 	 * @return void
494 494
 	 */
495
-	private static function _track_critical_page_post_shortcodes( $critical_page = array() ) {
495
+	private static function _track_critical_page_post_shortcodes($critical_page = array()) {
496 496
 		// check the goods
497
-		if ( ! $critical_page['post'] instanceof WP_Post ) {
497
+		if ( ! $critical_page['post'] instanceof WP_Post) {
498 498
 			$msg = sprintf(
499
-				__( 'The Event Espresso critical page shortcode for the page %s can not be tracked because it is not a WP_Post object.', 'event_espresso' ),
499
+				__('The Event Espresso critical page shortcode for the page %s can not be tracked because it is not a WP_Post object.', 'event_espresso'),
500 500
 				$critical_page['name']
501 501
 			);
502
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
502
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
503 503
 			return;
504 504
 		}
505 505
 		// map shortcode to post
506
-		EE_Registry::instance()->CFG->core->post_shortcodes[ $critical_page['post']->post_name ][ $critical_page['code'] ] = $critical_page['post']->ID;
506
+		EE_Registry::instance()->CFG->core->post_shortcodes[$critical_page['post']->post_name][$critical_page['code']] = $critical_page['post']->ID;
507 507
 		// and make sure it's NOT added to the WP "Posts Page"
508 508
 		// name of the WP Posts Page
509 509
 		$posts_page = EE_Registry::instance()->CFG->get_page_for_posts();
510
-		if ( isset( EE_Registry::instance()->CFG->core->post_shortcodes[ $posts_page ] )) {
511
-			unset( EE_Registry::instance()->CFG->core->post_shortcodes[ $posts_page ][ $critical_page['code'] ] );
510
+		if (isset(EE_Registry::instance()->CFG->core->post_shortcodes[$posts_page])) {
511
+			unset(EE_Registry::instance()->CFG->core->post_shortcodes[$posts_page][$critical_page['code']]);
512 512
 		}
513
-		if ( $posts_page != 'posts' && isset( EE_Registry::instance()->CFG->core->post_shortcodes['posts'] )) {
514
-			unset( EE_Registry::instance()->CFG->core->post_shortcodes['posts'][ $critical_page['code'] ] );
513
+		if ($posts_page != 'posts' && isset(EE_Registry::instance()->CFG->core->post_shortcodes['posts'])) {
514
+			unset(EE_Registry::instance()->CFG->core->post_shortcodes['posts'][$critical_page['code']]);
515 515
 		}
516 516
 		// update post_shortcode CFG
517
-		if ( ! EE_Config::instance()->update_espresso_config( FALSE, FALSE )) {
517
+		if ( ! EE_Config::instance()->update_espresso_config(FALSE, FALSE)) {
518 518
 			$msg = sprintf(
519
-				__( 'The Event Espresso critical page shortcode for the %s page could not be configured properly.', 'event_espresso' ),
519
+				__('The Event Espresso critical page shortcode for the %s page could not be configured properly.', 'event_espresso'),
520 520
 				$critical_page['name']
521 521
 			);
522
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
522
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
523 523
 		}
524 524
 	}
525 525
 
@@ -537,24 +537,24 @@  discard block
 block discarded – undo
537 537
 	public static function get_default_creator_id() {
538 538
 		global $wpdb;
539 539
 
540
-		if ( ! empty( self::$_default_creator_id ) ) {
540
+		if ( ! empty(self::$_default_creator_id)) {
541 541
 			return self::$_default_creator_id;
542 542
 		}/**/
543 543
 
544
-		$role_to_check = apply_filters( 'FHEE__EEH_Activation__get_default_creator_id__role_to_check', 'administrator' );
544
+		$role_to_check = apply_filters('FHEE__EEH_Activation__get_default_creator_id__role_to_check', 'administrator');
545 545
 
546 546
 		//let's allow pre_filtering for early exits by alternative methods for getting id.  We check for truthy result and if so then exit early.
547
-		$pre_filtered_id = apply_filters( 'FHEE__EEH_Activation__get_default_creator_id__pre_filtered_id', false, $role_to_check );
548
-		if ( $pre_filtered_id !== false ) {
547
+		$pre_filtered_id = apply_filters('FHEE__EEH_Activation__get_default_creator_id__pre_filtered_id', false, $role_to_check);
548
+		if ($pre_filtered_id !== false) {
549 549
 			return (int) $pre_filtered_id;
550 550
 		}
551 551
 
552
-		$capabilities_key = EEH_Activation::ensure_table_name_has_prefix( 'capabilities' );
553
-		$query = $wpdb->prepare( "SELECT user_id FROM $wpdb->usermeta WHERE meta_key = '$capabilities_key' AND meta_value LIKE %s ORDER BY user_id ASC LIMIT 0,1", '%' . $role_to_check . '%' );
554
-		$user_id = $wpdb->get_var( $query );
555
-		 $user_id = apply_filters( 'FHEE__EEH_Activation_Helper__get_default_creator_id__user_id', $user_id );
556
-		 if ( $user_id && intval( $user_id ) ) {
557
-		 	self::$_default_creator_id =  intval( $user_id );
552
+		$capabilities_key = EEH_Activation::ensure_table_name_has_prefix('capabilities');
553
+		$query = $wpdb->prepare("SELECT user_id FROM $wpdb->usermeta WHERE meta_key = '$capabilities_key' AND meta_value LIKE %s ORDER BY user_id ASC LIMIT 0,1", '%'.$role_to_check.'%');
554
+		$user_id = $wpdb->get_var($query);
555
+		 $user_id = apply_filters('FHEE__EEH_Activation_Helper__get_default_creator_id__user_id', $user_id);
556
+		 if ($user_id && intval($user_id)) {
557
+		 	self::$_default_creator_id = intval($user_id);
558 558
 		 	return self::$_default_creator_id;
559 559
 		 } else {
560 560
 		 	return NULL;
@@ -581,29 +581,29 @@  discard block
 block discarded – undo
581 581
 	 * 	@return void
582 582
 	 * @throws EE_Error if there are database errors
583 583
 	 */
584
-	public static function create_table( $table_name, $sql, $engine = 'ENGINE=MyISAM ', $drop_pre_existing_table = false ) {
585
-		if( apply_filters( 'FHEE__EEH_Activation__create_table__short_circuit', FALSE, $table_name, $sql ) ){
584
+	public static function create_table($table_name, $sql, $engine = 'ENGINE=MyISAM ', $drop_pre_existing_table = false) {
585
+		if (apply_filters('FHEE__EEH_Activation__create_table__short_circuit', FALSE, $table_name, $sql)) {
586 586
 			return;
587 587
 		}
588
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
589
-		if ( ! function_exists( 'dbDelta' )) {
590
-			require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
588
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
589
+		if ( ! function_exists('dbDelta')) {
590
+			require_once(ABSPATH.'wp-admin/includes/upgrade.php');
591 591
 		}
592 592
 		/** @var WPDB $wpdb */
593 593
 		global $wpdb;
594
-		$wp_table_name = EEH_Activation::ensure_table_name_has_prefix( $table_name );
594
+		$wp_table_name = EEH_Activation::ensure_table_name_has_prefix($table_name);
595 595
 		// do we need to first delete an existing version of this table ?
596
-		if ( $drop_pre_existing_table && EEH_Activation::table_exists( $wp_table_name ) ){
596
+		if ($drop_pre_existing_table && EEH_Activation::table_exists($wp_table_name)) {
597 597
 			// ok, delete the table... but ONLY if it's empty
598
-			$deleted_safely = EEH_Activation::delete_db_table_if_empty( $wp_table_name );
598
+			$deleted_safely = EEH_Activation::delete_db_table_if_empty($wp_table_name);
599 599
 			// table is NOT empty, are you SURE you want to delete this table ???
600
-			if ( ! $deleted_safely && defined( 'EE_DROP_BAD_TABLES' ) && EE_DROP_BAD_TABLES ){
601
-				EEH_Activation::delete_unused_db_table( $wp_table_name );
602
-			} else if ( ! $deleted_safely ) {
600
+			if ( ! $deleted_safely && defined('EE_DROP_BAD_TABLES') && EE_DROP_BAD_TABLES) {
601
+				EEH_Activation::delete_unused_db_table($wp_table_name);
602
+			} else if ( ! $deleted_safely) {
603 603
 				// so we should be more cautious rather than just dropping tables so easily
604 604
 				EE_Error::add_persistent_admin_notice(
605
-						'bad_table_' . $wp_table_name . '_detected',
606
-						sprintf( __( 'Database table %1$s exists when it shouldn\'t, and may contain erroneous data. If you have previously restored your database from a backup that didn\'t remove the old tables, then we recommend adding %2$s to your %3$s file then restore to that backup again. This will clear out the invalid data from %1$s. Afterwards you should undo that change from your %3$s file. %4$sIf you cannot edit %3$s, you should remove the data from %1$s manually then restore to the backup again.', 'event_espresso' ),
605
+						'bad_table_'.$wp_table_name.'_detected',
606
+						sprintf(__('Database table %1$s exists when it shouldn\'t, and may contain erroneous data. If you have previously restored your database from a backup that didn\'t remove the old tables, then we recommend adding %2$s to your %3$s file then restore to that backup again. This will clear out the invalid data from %1$s. Afterwards you should undo that change from your %3$s file. %4$sIf you cannot edit %3$s, you should remove the data from %1$s manually then restore to the backup again.', 'event_espresso'),
607 607
 								$wp_table_name,
608 608
 								"<pre>define( 'EE_DROP_BAD_TABLES', TRUE );</pre>",
609 609
 								'<b>wp-config.php</b>',
@@ -612,25 +612,25 @@  discard block
 block discarded – undo
612 612
 			}
613 613
 		}
614 614
 		// does $sql contain valid column information? ( LPT: https://regex101.com/ is great for working out regex patterns )
615
-		if ( preg_match( '((((.*?))(,\s))+)', $sql, $valid_column_data ) ) {
615
+		if (preg_match('((((.*?))(,\s))+)', $sql, $valid_column_data)) {
616 616
 			$SQL = "CREATE TABLE $wp_table_name ( $sql ) $engine DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;";
617 617
 			//get $wpdb to echo errors, but buffer them. This way at least WE know an error
618 618
 			//happened. And then we can choose to tell the end user
619
-			$old_show_errors_policy = $wpdb->show_errors( TRUE );
620
-			$old_error_suppression_policy = $wpdb->suppress_errors( FALSE );
619
+			$old_show_errors_policy = $wpdb->show_errors(TRUE);
620
+			$old_error_suppression_policy = $wpdb->suppress_errors(FALSE);
621 621
 			ob_start();
622
-			dbDelta( $SQL );
622
+			dbDelta($SQL);
623 623
 			$output = ob_get_contents();
624 624
 			ob_end_clean();
625
-			$wpdb->show_errors( $old_show_errors_policy );
626
-			$wpdb->suppress_errors( $old_error_suppression_policy );
627
-			if( ! empty( $output ) ){
628
-				throw new EE_Error( $output	);
625
+			$wpdb->show_errors($old_show_errors_policy);
626
+			$wpdb->suppress_errors($old_error_suppression_policy);
627
+			if ( ! empty($output)) {
628
+				throw new EE_Error($output);
629 629
 			}
630 630
 		} else {
631 631
 			throw new EE_Error(
632 632
 				sprintf(
633
-					__( 'The following table creation SQL does not contain valid information about the table columns: %1$s %2$s', 'event_espresso' ),
633
+					__('The following table creation SQL does not contain valid information about the table columns: %1$s %2$s', 'event_espresso'),
634 634
 					'<br />',
635 635
 					$sql
636 636
 				)
@@ -652,15 +652,15 @@  discard block
 block discarded – undo
652 652
 	 * @param string $column_info if your SQL were 'ALTER TABLE table_name ADD price VARCHAR(10)', this would be 'VARCHAR(10)'
653 653
 	 * @return bool|int
654 654
 	 */
655
-	public static function add_column_if_it_doesnt_exist($table_name,$column_name,$column_info='INT UNSIGNED NOT NULL'){
656
-		if( apply_filters( 'FHEE__EEH_Activation__add_column_if_it_doesnt_exist__short_circuit', FALSE ) ){
655
+	public static function add_column_if_it_doesnt_exist($table_name, $column_name, $column_info = 'INT UNSIGNED NOT NULL') {
656
+		if (apply_filters('FHEE__EEH_Activation__add_column_if_it_doesnt_exist__short_circuit', FALSE)) {
657 657
 			return FALSE;
658 658
 		}
659 659
 		global $wpdb;
660
-		$full_table_name= EEH_Activation::ensure_table_name_has_prefix( $table_name );
660
+		$full_table_name = EEH_Activation::ensure_table_name_has_prefix($table_name);
661 661
 		$fields = self::get_fields_on_table($table_name);
662
-		if (!in_array($column_name, $fields)){
663
-			$alter_query="ALTER TABLE $full_table_name ADD $column_name $column_info";
662
+		if ( ! in_array($column_name, $fields)) {
663
+			$alter_query = "ALTER TABLE $full_table_name ADD $column_name $column_info";
664 664
 			//echo "alter query:$alter_query";
665 665
 			return $wpdb->query($alter_query);
666 666
 		}
@@ -679,15 +679,15 @@  discard block
 block discarded – undo
679 679
 	 * 	@param string $table_name, without prefixed $wpdb->prefix
680 680
 	 * 	@return array of database column names
681 681
 	 */
682
-	public static function get_fields_on_table( $table_name = NULL ) {
682
+	public static function get_fields_on_table($table_name = NULL) {
683 683
 		global $wpdb;
684
-		$table_name= EEH_Activation::ensure_table_name_has_prefix( $table_name );
685
-		if ( ! empty( $table_name )) {
684
+		$table_name = EEH_Activation::ensure_table_name_has_prefix($table_name);
685
+		if ( ! empty($table_name)) {
686 686
 			$columns = $wpdb->get_results("SHOW COLUMNS FROM $table_name ");
687 687
 			if ($columns !== FALSE) {
688 688
 				$field_array = array();
689
-				foreach($columns as $column ){
690
-					$field_array[] = $column->Field;;
689
+				foreach ($columns as $column) {
690
+					$field_array[] = $column->Field; ;
691 691
 				}
692 692
 				return $field_array;
693 693
 			}
@@ -705,12 +705,12 @@  discard block
 block discarded – undo
705 705
 	 * @param string $table_name
706 706
 	 * @return bool
707 707
 	 */
708
-	public static function db_table_is_empty( $table_name ) {
708
+	public static function db_table_is_empty($table_name) {
709 709
 		global $wpdb;
710
-		$table_name = EEH_Activation::ensure_table_name_has_prefix( $table_name );
711
-		if ( EEH_Activation::table_exists( $table_name ) ) {
712
-			$count = $wpdb->get_var( "SELECT COUNT(*) FROM $table_name" );
713
-			return absint( $count ) === 0 ? true : false;
710
+		$table_name = EEH_Activation::ensure_table_name_has_prefix($table_name);
711
+		if (EEH_Activation::table_exists($table_name)) {
712
+			$count = $wpdb->get_var("SELECT COUNT(*) FROM $table_name");
713
+			return absint($count) === 0 ? true : false;
714 714
 		}
715 715
 		return false;
716 716
 	}
@@ -725,9 +725,9 @@  discard block
 block discarded – undo
725 725
 	 * @param string $table_name
726 726
 	 * @return bool | int
727 727
 	 */
728
-	public static function delete_db_table_if_empty( $table_name ) {
729
-		if ( EEH_Activation::db_table_is_empty( $table_name ) ) {
730
-			return EEH_Activation::delete_unused_db_table( $table_name );
728
+	public static function delete_db_table_if_empty($table_name) {
729
+		if (EEH_Activation::db_table_is_empty($table_name)) {
730
+			return EEH_Activation::delete_unused_db_table($table_name);
731 731
 		}
732 732
 		return false;
733 733
 	}
@@ -742,11 +742,11 @@  discard block
 block discarded – undo
742 742
 	 * @param string $table_name
743 743
 	 * @return bool | int
744 744
 	 */
745
-	public static function delete_unused_db_table( $table_name ) {
745
+	public static function delete_unused_db_table($table_name) {
746 746
 		global $wpdb;
747
-		if ( EEH_Activation::table_exists( $table_name ) ) {
748
-			$table_name = EEH_Activation::ensure_table_name_has_prefix( $table_name );
749
-			return $wpdb->query( "DROP TABLE IF EXISTS $table_name" );
747
+		if (EEH_Activation::table_exists($table_name)) {
748
+			$table_name = EEH_Activation::ensure_table_name_has_prefix($table_name);
749
+			return $wpdb->query("DROP TABLE IF EXISTS $table_name");
750 750
 		}
751 751
 		return false;
752 752
 	}
@@ -762,18 +762,18 @@  discard block
 block discarded – undo
762 762
 	 * @param string $index_name
763 763
 	 * @return bool | int
764 764
 	 */
765
-	public static function drop_index( $table_name, $index_name ) {
766
-		if( apply_filters( 'FHEE__EEH_Activation__drop_index__short_circuit', FALSE ) ){
765
+	public static function drop_index($table_name, $index_name) {
766
+		if (apply_filters('FHEE__EEH_Activation__drop_index__short_circuit', FALSE)) {
767 767
 			return FALSE;
768 768
 		}
769 769
 		global $wpdb;
770
-		$table_name = EEH_Activation::ensure_table_name_has_prefix( $table_name );
770
+		$table_name = EEH_Activation::ensure_table_name_has_prefix($table_name);
771 771
 		$index_exists_query = "SHOW INDEX FROM $table_name WHERE Key_name = '$index_name'";
772 772
 		if (
773
-			$wpdb->get_var( "SHOW TABLES LIKE '$table_name'" ) == $table_name
774
-			&& $wpdb->get_var( $index_exists_query ) == $table_name //using get_var with the $index_exists_query returns the table's name
773
+			$wpdb->get_var("SHOW TABLES LIKE '$table_name'") == $table_name
774
+			&& $wpdb->get_var($index_exists_query) == $table_name //using get_var with the $index_exists_query returns the table's name
775 775
 		) {
776
-			return $wpdb->query( "ALTER TABLE $table_name DROP INDEX $index_name" );
776
+			return $wpdb->query("ALTER TABLE $table_name DROP INDEX $index_name");
777 777
 		}
778 778
 		return TRUE;
779 779
 	}
@@ -789,27 +789,27 @@  discard block
 block discarded – undo
789 789
 	 * @return boolean success (whether database is setup properly or not)
790 790
 	 */
791 791
 	public static function create_database_tables() {
792
-		EE_Registry::instance()->load_core( 'Data_Migration_Manager' );
792
+		EE_Registry::instance()->load_core('Data_Migration_Manager');
793 793
 		//find the migration script that sets the database to be compatible with the code
794 794
 		$dms_name = EE_Data_Migration_Manager::instance()->get_most_up_to_date_dms();
795
-		if( $dms_name ){
796
-			$current_data_migration_script = EE_Registry::instance()->load_dms( $dms_name );
797
-			$current_data_migration_script->set_migrating( false );
795
+		if ($dms_name) {
796
+			$current_data_migration_script = EE_Registry::instance()->load_dms($dms_name);
797
+			$current_data_migration_script->set_migrating(false);
798 798
 			$current_data_migration_script->schema_changes_before_migration();
799 799
 			$current_data_migration_script->schema_changes_after_migration();
800
-			if( $current_data_migration_script->get_errors() ){
801
-				if( WP_DEBUG ){
802
-					foreach( $current_data_migration_script->get_errors() as $error ){
803
-						EE_Error::add_error($error, __FILE__, __FUNCTION__, __LINE__ );
800
+			if ($current_data_migration_script->get_errors()) {
801
+				if (WP_DEBUG) {
802
+					foreach ($current_data_migration_script->get_errors() as $error) {
803
+						EE_Error::add_error($error, __FILE__, __FUNCTION__, __LINE__);
804 804
 					}
805
-				}else{
806
-					EE_Error::add_error( __( 'There were errors creating the Event Espresso database tables and Event Espresso has been deactivated. To view the errors, please enable WP_DEBUG in your wp-config.php file.', 'event_espresso' ) );
805
+				} else {
806
+					EE_Error::add_error(__('There were errors creating the Event Espresso database tables and Event Espresso has been deactivated. To view the errors, please enable WP_DEBUG in your wp-config.php file.', 'event_espresso'));
807 807
 				}
808 808
 				return false;
809 809
 			}
810 810
 			EE_Data_Migration_Manager::instance()->update_current_database_state_to();
811
-		}else{
812
-			EE_Error::add_error( __( 'Could not determine most up-to-date data migration script from which to pull database schema structure. So database is probably not setup properly', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__);
811
+		} else {
812
+			EE_Error::add_error(__('Could not determine most up-to-date data migration script from which to pull database schema structure. So database is probably not setup properly', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
813 813
 			return false;
814 814
 		}
815 815
 		return true;
@@ -829,27 +829,27 @@  discard block
 block discarded – undo
829 829
 	public static function initialize_system_questions() {
830 830
 		// QUESTION GROUPS
831 831
 		global $wpdb;
832
-		$table_name = EEH_Activation::ensure_table_name_has_prefix( 'esp_question_group' );
832
+		$table_name = EEH_Activation::ensure_table_name_has_prefix('esp_question_group');
833 833
 		$SQL = "SELECT QSG_system FROM $table_name WHERE QSG_system != 0";
834 834
 		// what we have
835
-		$question_groups = $wpdb->get_col( $SQL );
835
+		$question_groups = $wpdb->get_col($SQL);
836 836
 		// check the response
837
-		$question_groups = is_array( $question_groups ) ? $question_groups : array();
837
+		$question_groups = is_array($question_groups) ? $question_groups : array();
838 838
 		// what we should have
839
-		$QSG_systems = array( 1, 2 );
839
+		$QSG_systems = array(1, 2);
840 840
 		// loop thru what we should have and compare to what we have
841
-		foreach ( $QSG_systems as $QSG_system ) {
841
+		foreach ($QSG_systems as $QSG_system) {
842 842
 			// reset values array
843 843
 			$QSG_values = array();
844 844
 			// if we don't have what we should have (but use $QST_system as as string because that's what we got from the db)
845
-			if ( ! in_array( "$QSG_system", $question_groups )) {
845
+			if ( ! in_array("$QSG_system", $question_groups)) {
846 846
 				// add it
847
-				switch ( $QSG_system ) {
847
+				switch ($QSG_system) {
848 848
 
849 849
 					case 1:
850 850
 							$QSG_values = array(
851
-									'QSG_name' => __( 'Personal Information', 'event_espresso' ),
852
-									'QSG_identifier' => 'personal-information-' . time(),
851
+									'QSG_name' => __('Personal Information', 'event_espresso'),
852
+									'QSG_identifier' => 'personal-information-'.time(),
853 853
 									'QSG_desc' => '',
854 854
 									'QSG_order' => 1,
855 855
 									'QSG_show_group_name' => 1,
@@ -861,8 +861,8 @@  discard block
 block discarded – undo
861 861
 
862 862
 					case 2:
863 863
 							$QSG_values = array(
864
-									'QSG_name' => __( 'Address Information','event_espresso' ),
865
-									'QSG_identifier' => 'address-information-' . time(),
864
+									'QSG_name' => __('Address Information', 'event_espresso'),
865
+									'QSG_identifier' => 'address-information-'.time(),
866 866
 									'QSG_desc' => '',
867 867
 									'QSG_order' => 2,
868 868
 									'QSG_show_group_name' => 1,
@@ -874,14 +874,14 @@  discard block
 block discarded – undo
874 874
 
875 875
 				}
876 876
 				// make sure we have some values before inserting them
877
-				if ( ! empty( $QSG_values )) {
877
+				if ( ! empty($QSG_values)) {
878 878
 					// insert system question
879 879
 					$wpdb->insert(
880 880
 						$table_name,
881 881
 						$QSG_values,
882
-						array('%s', '%s', '%s', '%d', '%d', '%d', '%d', '%d' )
882
+						array('%s', '%s', '%s', '%d', '%d', '%d', '%d', '%d')
883 883
 					);
884
-					$QSG_IDs[ $QSG_system ] = $wpdb->insert_id;
884
+					$QSG_IDs[$QSG_system] = $wpdb->insert_id;
885 885
 				}
886 886
 			}
887 887
 		}
@@ -890,10 +890,10 @@  discard block
 block discarded – undo
890 890
 
891 891
 		// QUESTIONS
892 892
 		global $wpdb;
893
-		$table_name = EEH_Activation::ensure_table_name_has_prefix( 'esp_question' );
893
+		$table_name = EEH_Activation::ensure_table_name_has_prefix('esp_question');
894 894
 		$SQL = "SELECT QST_system FROM $table_name WHERE QST_system != ''";
895 895
 		// what we have
896
-		$questions = $wpdb->get_col( $SQL );
896
+		$questions = $wpdb->get_col($SQL);
897 897
 		// what we should have
898 898
 		$QST_systems = array(
899 899
 			'fname',
@@ -910,22 +910,22 @@  discard block
 block discarded – undo
910 910
 		$order_for_group_1 = 1;
911 911
 		$order_for_group_2 = 1;
912 912
 		// loop thru what we should have and compare to what we have
913
-		foreach ( $QST_systems as $QST_system ) {
913
+		foreach ($QST_systems as $QST_system) {
914 914
 			// reset values array
915 915
 			$QST_values = array();
916 916
 			// if we don't have what we should have
917
-			if ( ! in_array( $QST_system, $questions )) {
917
+			if ( ! in_array($QST_system, $questions)) {
918 918
 				// add it
919
-				switch ( $QST_system ) {
919
+				switch ($QST_system) {
920 920
 
921 921
 					case 'fname':
922 922
 							$QST_values = array(
923
-									'QST_display_text' => __( 'First Name', 'event_espresso' ),
924
-									'QST_admin_label' => __( 'First Name - System Question', 'event_espresso' ),
923
+									'QST_display_text' => __('First Name', 'event_espresso'),
924
+									'QST_admin_label' => __('First Name - System Question', 'event_espresso'),
925 925
 									'QST_system' => 'fname',
926 926
 									'QST_type' => 'TEXT',
927 927
 									'QST_required' => 1,
928
-									'QST_required_text' => __( 'This field is required', 'event_espresso' ),
928
+									'QST_required_text' => __('This field is required', 'event_espresso'),
929 929
 									'QST_order' => 1,
930 930
 									'QST_admin_only' => 0,
931 931
 									'QST_wp_user' => self::get_default_creator_id(),
@@ -935,12 +935,12 @@  discard block
 block discarded – undo
935 935
 
936 936
 					case 'lname':
937 937
 							$QST_values = array(
938
-									'QST_display_text' => __( 'Last Name', 'event_espresso' ),
939
-									'QST_admin_label' => __( 'Last Name - System Question', 'event_espresso' ),
938
+									'QST_display_text' => __('Last Name', 'event_espresso'),
939
+									'QST_admin_label' => __('Last Name - System Question', 'event_espresso'),
940 940
 									'QST_system' => 'lname',
941 941
 									'QST_type' => 'TEXT',
942 942
 									'QST_required' => 1,
943
-									'QST_required_text' => __( 'This field is required', 'event_espresso' ),
943
+									'QST_required_text' => __('This field is required', 'event_espresso'),
944 944
 									'QST_order' => 2,
945 945
 									'QST_admin_only' => 0,
946 946
 									'QST_wp_user' => self::get_default_creator_id(),
@@ -950,12 +950,12 @@  discard block
 block discarded – undo
950 950
 
951 951
 					case 'email':
952 952
 							$QST_values = array(
953
-									'QST_display_text' => __( 'Email Address', 'event_espresso' ),
954
-									'QST_admin_label' => __( 'Email Address - System Question', 'event_espresso' ),
953
+									'QST_display_text' => __('Email Address', 'event_espresso'),
954
+									'QST_admin_label' => __('Email Address - System Question', 'event_espresso'),
955 955
 									'QST_system' => 'email',
956 956
 									'QST_type' => 'TEXT',
957 957
 									'QST_required' => 1,
958
-									'QST_required_text' => __( 'This field is required', 'event_espresso' ),
958
+									'QST_required_text' => __('This field is required', 'event_espresso'),
959 959
 									'QST_order' => 3,
960 960
 									'QST_admin_only' => 0,
961 961
 									'QST_wp_user' => self::get_default_creator_id(),
@@ -965,12 +965,12 @@  discard block
 block discarded – undo
965 965
 
966 966
 					case 'address':
967 967
 							$QST_values = array(
968
-									'QST_display_text' => __( 'Address', 'event_espresso' ),
969
-									'QST_admin_label' => __( 'Address - System Question', 'event_espresso' ),
968
+									'QST_display_text' => __('Address', 'event_espresso'),
969
+									'QST_admin_label' => __('Address - System Question', 'event_espresso'),
970 970
 									'QST_system' => 'address',
971 971
 									'QST_type' => 'TEXT',
972 972
 									'QST_required' => 0,
973
-									'QST_required_text' => __( 'This field is required', 'event_espresso' ),
973
+									'QST_required_text' => __('This field is required', 'event_espresso'),
974 974
 									'QST_order' => 4,
975 975
 									'QST_admin_only' => 0,
976 976
 									'QST_wp_user' => self::get_default_creator_id(),
@@ -980,12 +980,12 @@  discard block
 block discarded – undo
980 980
 
981 981
 					case 'address2':
982 982
 							$QST_values = array(
983
-									'QST_display_text' => __( 'Address2', 'event_espresso' ),
984
-									'QST_admin_label' => __( 'Address2 - System Question', 'event_espresso' ),
983
+									'QST_display_text' => __('Address2', 'event_espresso'),
984
+									'QST_admin_label' => __('Address2 - System Question', 'event_espresso'),
985 985
 									'QST_system' => 'address2',
986 986
 									'QST_type' => 'TEXT',
987 987
 									'QST_required' => 0,
988
-									'QST_required_text' => __( 'This field is required', 'event_espresso' ),
988
+									'QST_required_text' => __('This field is required', 'event_espresso'),
989 989
 									'QST_order' => 5,
990 990
 									'QST_admin_only' => 0,
991 991
 									'QST_wp_user' => self::get_default_creator_id(),
@@ -995,12 +995,12 @@  discard block
 block discarded – undo
995 995
 
996 996
 					case 'city':
997 997
 							$QST_values = array(
998
-									'QST_display_text' => __( 'City', 'event_espresso' ),
999
-									'QST_admin_label' => __( 'City - System Question', 'event_espresso' ),
998
+									'QST_display_text' => __('City', 'event_espresso'),
999
+									'QST_admin_label' => __('City - System Question', 'event_espresso'),
1000 1000
 									'QST_system' => 'city',
1001 1001
 									'QST_type' => 'TEXT',
1002 1002
 									'QST_required' => 0,
1003
-									'QST_required_text' => __( 'This field is required', 'event_espresso' ),
1003
+									'QST_required_text' => __('This field is required', 'event_espresso'),
1004 1004
 									'QST_order' => 6,
1005 1005
 									'QST_admin_only' => 0,
1006 1006
 									'QST_wp_user' => self::get_default_creator_id(),
@@ -1010,12 +1010,12 @@  discard block
 block discarded – undo
1010 1010
 
1011 1011
 					case 'state':
1012 1012
 							$QST_values = array(
1013
-									'QST_display_text' => __( 'State/Province', 'event_espresso' ),
1014
-									'QST_admin_label' => __( 'State/Province - System Question', 'event_espresso' ),
1013
+									'QST_display_text' => __('State/Province', 'event_espresso'),
1014
+									'QST_admin_label' => __('State/Province - System Question', 'event_espresso'),
1015 1015
 									'QST_system' => 'state',
1016 1016
 									'QST_type' => 'STATE',
1017 1017
 									'QST_required' => 0,
1018
-									'QST_required_text' => __( 'This field is required', 'event_espresso' ),
1018
+									'QST_required_text' => __('This field is required', 'event_espresso'),
1019 1019
 									'QST_order' => 7,
1020 1020
 									'QST_admin_only' => 0,
1021 1021
 									'QST_wp_user' => self::get_default_creator_id(),
@@ -1025,12 +1025,12 @@  discard block
 block discarded – undo
1025 1025
 
1026 1026
 					case 'country' :
1027 1027
 							$QST_values = array(
1028
-									'QST_display_text' => __( 'Country', 'event_espresso' ),
1029
-									'QST_admin_label' => __( 'Country - System Question', 'event_espresso' ),
1028
+									'QST_display_text' => __('Country', 'event_espresso'),
1029
+									'QST_admin_label' => __('Country - System Question', 'event_espresso'),
1030 1030
 									'QST_system' => 'country',
1031 1031
 									'QST_type' => 'COUNTRY',
1032 1032
 									'QST_required' => 0,
1033
-									'QST_required_text' => __( 'This field is required', 'event_espresso' ),
1033
+									'QST_required_text' => __('This field is required', 'event_espresso'),
1034 1034
 									'QST_order' => 8,
1035 1035
 									'QST_admin_only' => 0,
1036 1036
 									'QST_wp_user' => self::get_default_creator_id(),
@@ -1040,12 +1040,12 @@  discard block
 block discarded – undo
1040 1040
 
1041 1041
 					case 'zip':
1042 1042
 							$QST_values = array(
1043
-									'QST_display_text' => __( 'Zip/Postal Code', 'event_espresso' ),
1044
-									'QST_admin_label' => __( 'Zip/Postal Code - System Question', 'event_espresso' ),
1043
+									'QST_display_text' => __('Zip/Postal Code', 'event_espresso'),
1044
+									'QST_admin_label' => __('Zip/Postal Code - System Question', 'event_espresso'),
1045 1045
 									'QST_system' => 'zip',
1046 1046
 									'QST_type' => 'TEXT',
1047 1047
 									'QST_required' => 0,
1048
-									'QST_required_text' => __( 'This field is required', 'event_espresso' ),
1048
+									'QST_required_text' => __('This field is required', 'event_espresso'),
1049 1049
 									'QST_order' => 9,
1050 1050
 									'QST_admin_only' => 0,
1051 1051
 									'QST_wp_user' => self::get_default_creator_id(),
@@ -1055,12 +1055,12 @@  discard block
 block discarded – undo
1055 1055
 
1056 1056
 					case 'phone':
1057 1057
 							$QST_values = array(
1058
-									'QST_display_text' => __( 'Phone Number', 'event_espresso' ),
1059
-									'QST_admin_label' => __( 'Phone Number - System Question', 'event_espresso' ),
1058
+									'QST_display_text' => __('Phone Number', 'event_espresso'),
1059
+									'QST_admin_label' => __('Phone Number - System Question', 'event_espresso'),
1060 1060
 									'QST_system' => 'phone',
1061 1061
 									'QST_type' => 'TEXT',
1062 1062
 									'QST_required' => 0,
1063
-									'QST_required_text' => __( 'This field is required', 'event_espresso' ),
1063
+									'QST_required_text' => __('This field is required', 'event_espresso'),
1064 1064
 									'QST_order' => 10,
1065 1065
 									'QST_admin_only' => 0,
1066 1066
 									'QST_wp_user' => self::get_default_creator_id(),
@@ -1069,34 +1069,34 @@  discard block
 block discarded – undo
1069 1069
 						break;
1070 1070
 
1071 1071
 				}
1072
-				if ( ! empty( $QST_values )) {
1072
+				if ( ! empty($QST_values)) {
1073 1073
 					// insert system question
1074 1074
 					$wpdb->insert(
1075 1075
 						$table_name,
1076 1076
 						$QST_values,
1077
-						array( '%s', '%s', '%s', '%s', '%d', '%s', '%d', '%d', '%d', '%d' )
1077
+						array('%s', '%s', '%s', '%s', '%d', '%s', '%d', '%d', '%d', '%d')
1078 1078
 					);
1079 1079
 					$QST_ID = $wpdb->insert_id;
1080 1080
 
1081 1081
 					// QUESTION GROUP QUESTIONS
1082
-					if(  in_array( $QST_system, array( 'fname', 'lname', 'email' ) ) ) {
1082
+					if (in_array($QST_system, array('fname', 'lname', 'email'))) {
1083 1083
 						$system_question_we_want = EEM_Question_Group::system_personal;
1084 1084
 					} else {
1085 1085
 						$system_question_we_want = EEM_Question_Group::system_address;
1086 1086
 					}
1087
-					if( isset( $QSG_IDs[ $system_question_we_want ] ) ) {
1088
-						$QSG_ID = $QSG_IDs[ $system_question_we_want ];
1087
+					if (isset($QSG_IDs[$system_question_we_want])) {
1088
+						$QSG_ID = $QSG_IDs[$system_question_we_want];
1089 1089
 					} else {
1090
-						$id_col = EEM_Question_Group::instance()->get_col( array( array( 'QSG_system' => $system_question_we_want ) ) );
1091
-						if( is_array( $id_col ) ) {
1092
-							$QSG_ID = reset( $id_col );
1090
+						$id_col = EEM_Question_Group::instance()->get_col(array(array('QSG_system' => $system_question_we_want)));
1091
+						if (is_array($id_col)) {
1092
+							$QSG_ID = reset($id_col);
1093 1093
 						} else {
1094 1094
 							//ok so we didn't find it in the db either?? that's weird because we should have inserted it at the start of this method
1095 1095
                                                         EE_Log::instance()->log( 
1096 1096
                                                                 __FILE__, 
1097 1097
                                                                 __FUNCTION__, 
1098 1098
                                                                 sprintf( 
1099
-                                                                        __( 'Could not associate question %1$s to a question group because no system question group existed', 'event_espresso'), 
1099
+                                                                        __('Could not associate question %1$s to a question group because no system question group existed', 'event_espresso'), 
1100 1100
                                                                         $QST_ID ), 
1101 1101
                                                                 'error' );
1102 1102
                                                         continue;
@@ -1105,9 +1105,9 @@  discard block
 block discarded – undo
1105 1105
                                         
1106 1106
 					// add system questions to groups
1107 1107
 					$wpdb->insert(
1108
-						EEH_Activation::ensure_table_name_has_prefix( 'esp_question_group_question' ),
1109
-						array( 'QSG_ID' => $QSG_ID , 'QST_ID' => $QST_ID, 'QGQ_order'=>($QSG_ID==1)? $order_for_group_1++ : $order_for_group_2++ ),
1110
-						array( '%d', '%d','%d' )
1108
+						EEH_Activation::ensure_table_name_has_prefix('esp_question_group_question'),
1109
+						array('QSG_ID' => $QSG_ID, 'QST_ID' => $QST_ID, 'QGQ_order'=>($QSG_ID == 1) ? $order_for_group_1++ : $order_for_group_2++),
1110
+						array('%d', '%d', '%d')
1111 1111
 					);
1112 1112
 				}
1113 1113
 			}
@@ -1119,11 +1119,11 @@  discard block
 block discarded – undo
1119 1119
 	 * Makes sure the default payment method (Invoice) is active.
1120 1120
 	 * This used to be done automatically as part of constructing the old gateways config
1121 1121
 	 */
1122
-	public static function insert_default_payment_methods(){
1123
-		if( ! EEM_Payment_Method::instance()->count_active( EEM_Payment_Method::scope_cart ) ){
1124
-			EE_Registry::instance()->load_lib( 'Payment_Method_Manager' );
1125
-			EE_Payment_Method_Manager::instance()->activate_a_payment_method_of_type( 'Invoice' );
1126
-		}else{
1122
+	public static function insert_default_payment_methods() {
1123
+		if ( ! EEM_Payment_Method::instance()->count_active(EEM_Payment_Method::scope_cart)) {
1124
+			EE_Registry::instance()->load_lib('Payment_Method_Manager');
1125
+			EE_Payment_Method_Manager::instance()->activate_a_payment_method_of_type('Invoice');
1126
+		} else {
1127 1127
 			EEM_Payment_Method::instance()->verify_button_urls();
1128 1128
 		}
1129 1129
 	}
@@ -1139,7 +1139,7 @@  discard block
 block discarded – undo
1139 1139
 
1140 1140
 		global $wpdb;
1141 1141
 
1142
-		if ( EEH_Activation::table_exists( EEM_Status::instance()->table() ) ) {
1142
+		if (EEH_Activation::table_exists(EEM_Status::instance()->table())) {
1143 1143
 
1144 1144
 			$table_name = EEM_Status::instance()->table();
1145 1145
 
@@ -1205,35 +1205,35 @@  discard block
 block discarded – undo
1205 1205
 	 * 	@return boolean success of verifying upload directories exist
1206 1206
 	 */
1207 1207
 	public static function create_upload_directories() {
1208
-		EE_Registry::instance()->load_helper( 'File' );
1208
+		EE_Registry::instance()->load_helper('File');
1209 1209
 		// Create the required folders
1210 1210
 		$folders = array(
1211 1211
 				EVENT_ESPRESSO_TEMPLATE_DIR,
1212 1212
 				EVENT_ESPRESSO_GATEWAY_DIR,
1213
-				EVENT_ESPRESSO_UPLOAD_DIR . 'logs/',
1214
-				EVENT_ESPRESSO_UPLOAD_DIR . 'css/',
1215
-				EVENT_ESPRESSO_UPLOAD_DIR . 'tickets/'
1213
+				EVENT_ESPRESSO_UPLOAD_DIR.'logs/',
1214
+				EVENT_ESPRESSO_UPLOAD_DIR.'css/',
1215
+				EVENT_ESPRESSO_UPLOAD_DIR.'tickets/'
1216 1216
 		);
1217
-		foreach ( $folders as $folder ) {
1217
+		foreach ($folders as $folder) {
1218 1218
 			try {
1219
-				EEH_File::ensure_folder_exists_and_is_writable( $folder );
1220
-				@ chmod( $folder, 0755 );
1221
-			} catch( EE_Error $e ){
1219
+				EEH_File::ensure_folder_exists_and_is_writable($folder);
1220
+				@ chmod($folder, 0755);
1221
+			} catch (EE_Error $e) {
1222 1222
 				EE_Error::add_error(
1223 1223
 					sprintf(
1224
-						__(  'Could not create the folder at "%1$s" because: %2$s', 'event_espresso' ),
1224
+						__('Could not create the folder at "%1$s" because: %2$s', 'event_espresso'),
1225 1225
 						$folder,
1226
-						'<br />' . $e->getMessage()
1226
+						'<br />'.$e->getMessage()
1227 1227
 					),
1228 1228
 					__FILE__, __FUNCTION__, __LINE__
1229 1229
 				);
1230 1230
 				//indicate we'll need to fix this later
1231
-				update_option( EEH_Activation::upload_directories_incomplete_option_name, true );
1231
+				update_option(EEH_Activation::upload_directories_incomplete_option_name, true);
1232 1232
 				return FALSE;
1233 1233
 			}
1234 1234
 		}
1235 1235
 		//remember EE's folders are all good
1236
-		delete_option( EEH_Activation::upload_directories_incomplete_option_name );
1236
+		delete_option(EEH_Activation::upload_directories_incomplete_option_name);
1237 1237
 		return TRUE;
1238 1238
 	}
1239 1239
 	
@@ -1246,7 +1246,7 @@  discard block
 block discarded – undo
1246 1246
 	 * @return boolean
1247 1247
 	 */
1248 1248
 	public static function upload_directories_incomplete() {
1249
-		return get_option( EEH_Activation::upload_directories_incomplete_option_name, false );
1249
+		return get_option(EEH_Activation::upload_directories_incomplete_option_name, false);
1250 1250
 	}
1251 1251
 
1252 1252
 
@@ -1265,16 +1265,16 @@  discard block
 block discarded – undo
1265 1265
 		$installed_messengers = $default_messengers = array();
1266 1266
 
1267 1267
 		//include our helper
1268
-		EE_Registry::instance()->load_helper( 'MSG_Template' );
1268
+		EE_Registry::instance()->load_helper('MSG_Template');
1269 1269
 
1270 1270
 		//get all installed messenger objects
1271 1271
 		$installed = EEH_MSG_Template::get_installed_message_objects();
1272 1272
 
1273 1273
 		//let's setup the $installed messengers in an array AND the messengers that are set to be activated on install.
1274
-		foreach ( $installed['messengers'] as $msgr ) {
1275
-			if ( $msgr instanceof EE_messenger ) {
1274
+		foreach ($installed['messengers'] as $msgr) {
1275
+			if ($msgr instanceof EE_messenger) {
1276 1276
 				$installed_messengers[$msgr->name] = $msgr;
1277
-				if ( $msgr->activate_on_install ) {
1277
+				if ($msgr->activate_on_install) {
1278 1278
 					$default_messengers[] = $msgr->name;
1279 1279
 				}
1280 1280
 			}
@@ -1284,36 +1284,36 @@  discard block
 block discarded – undo
1284 1284
 		$active_messengers = EEH_MSG_Template::get_active_messengers_in_db();
1285 1285
 
1286 1286
 		//things that have already been activated before
1287
-		$has_activated = get_option( 'ee_has_activated_messenger' );
1287
+		$has_activated = get_option('ee_has_activated_messenger');
1288 1288
 
1289 1289
 		//do an initial loop to determine if we need to continue
1290 1290
 		$def_ms = array();
1291
-		foreach ( $default_messengers as $msgr ) {
1292
-			if ( isset($active_messengers[$msgr] ) || isset( $has_activated[$msgr] ) ) continue;
1291
+		foreach ($default_messengers as $msgr) {
1292
+			if (isset($active_messengers[$msgr]) || isset($has_activated[$msgr])) continue;
1293 1293
 			$def_ms[] = $msgr;
1294 1294
 		}
1295 1295
 
1296 1296
 		//setup the $installed_mts in an array
1297
-		foreach ( $installed['message_types'] as $imt ) {
1298
-			if ( $imt instanceof EE_message_type ) {
1297
+		foreach ($installed['message_types'] as $imt) {
1298
+			if ($imt instanceof EE_message_type) {
1299 1299
 				$installed_mts[$imt->name] = $imt;
1300 1300
 			}
1301 1301
 		}
1302 1302
 
1303 1303
 		//loop through default array for default messengers (if present)
1304
-		if ( ! empty( $def_ms ) ) {
1305
-			foreach ( $def_ms as $messenger ) {
1304
+		if ( ! empty($def_ms)) {
1305
+			foreach ($def_ms as $messenger) {
1306 1306
 				//all is good so let's setup the default stuff. We need to use the given messenger object (if exists) to get the default message type for the messenger.
1307
-				if ( ! isset( $installed_messengers[$messenger] )) {
1307
+				if ( ! isset($installed_messengers[$messenger])) {
1308 1308
 					continue;
1309 1309
 				}
1310 1310
 				/** @var EE_messenger[] $installed_messengers  */
1311 1311
 				$default_mts = $installed_messengers[$messenger]->get_default_message_types();
1312 1312
 				$active_messengers[$messenger]['obj'] = $installed_messengers[$messenger];
1313
-				foreach ( $default_mts as $index => $mt ) {
1313
+				foreach ($default_mts as $index => $mt) {
1314 1314
 					//is there an installed_mt matching the default string?  If not then nothing to do here.
1315
-					if ( ! isset( $installed_mts[$mt] ) ) {
1316
-						unset( $default_mts[$index] );
1315
+					if ( ! isset($installed_mts[$mt])) {
1316
+						unset($default_mts[$index]);
1317 1317
 						continue;
1318 1318
 					}
1319 1319
 
@@ -1322,41 +1322,41 @@  discard block
 block discarded – undo
1322 1322
 					/** @var EE_message_type[] $installed_mts */
1323 1323
 					$settings_fields = $installed_mts[$mt]->get_admin_settings_fields();
1324 1324
 					$settings = array();
1325
-					if ( is_array( $settings_fields ) ) {
1326
-						foreach ( $settings_fields as $field => $values ) {
1327
-							if ( isset( $values['default'] ) ) {
1325
+					if (is_array($settings_fields)) {
1326
+						foreach ($settings_fields as $field => $values) {
1327
+							if (isset($values['default'])) {
1328 1328
 								$settings[$field] = $values['default'];
1329 1329
 							}
1330 1330
 						}
1331 1331
 					}
1332 1332
 
1333
-					$active_messengers[$messenger]['settings'][$messenger . '-message_types'][$mt]['settings'] = $settings;
1333
+					$active_messengers[$messenger]['settings'][$messenger.'-message_types'][$mt]['settings'] = $settings;
1334 1334
 					$has_activated[$messenger][] = $mt;
1335 1335
 				}
1336 1336
 
1337 1337
 				//setup any initial settings for the messenger
1338 1338
 				$msgr_settings = $installed_messengers[$messenger]->get_admin_settings_fields();
1339 1339
 
1340
-				if ( !empty( $msgr_settings ) ) {
1341
-					foreach ( $msgr_settings as $field => $value ) {
1340
+				if ( ! empty($msgr_settings)) {
1341
+					foreach ($msgr_settings as $field => $value) {
1342 1342
 						$active_messengers[$messenger]['settings'][$field] = $value;
1343 1343
 					}
1344 1344
 				}
1345 1345
 
1346 1346
 				//now let's save the settings for this messenger! Must do now because the validator checks the db for active messengers to validate.
1347
-				EEH_MSG_Template::update_active_messengers_in_db( $active_messengers );
1347
+				EEH_MSG_Template::update_active_messengers_in_db($active_messengers);
1348 1348
 
1349 1349
 				//let's generate all the templates but only if the messenger has default_mts (otherwise its just activated).
1350
-				if ( !empty( $default_mts ) ) {
1351
-					$success = EEH_MSG_Template::generate_new_templates( $messenger, $default_mts, '', TRUE );
1350
+				if ( ! empty($default_mts)) {
1351
+					$success = EEH_MSG_Template::generate_new_templates($messenger, $default_mts, '', TRUE);
1352 1352
 				}
1353 1353
 			}
1354 1354
 		} //end check for empty( $def_ms )
1355 1355
 
1356 1356
 		//still need to see if there are any message types to activate for active messengers
1357
-		foreach ( $active_messengers as $messenger => $settings ) {
1357
+		foreach ($active_messengers as $messenger => $settings) {
1358 1358
 			$msg_obj = $settings['obj'];
1359
-			if ( ! $msg_obj instanceof EE_messenger ) {
1359
+			if ( ! $msg_obj instanceof EE_messenger) {
1360 1360
 				continue;
1361 1361
 			}
1362 1362
 
@@ -1364,45 +1364,45 @@  discard block
 block discarded – undo
1364 1364
 			$new_default_mts = array();
1365 1365
 
1366 1366
 			//loop through each default mt reported by the messenger and make sure its set in its active db entry.
1367
-			foreach( $all_default_mts as $index => $mt ) {
1367
+			foreach ($all_default_mts as $index => $mt) {
1368 1368
 				//already active? already has generated templates? || has already been activated before (we dont' want to reactivate things users intentionally deactivated).
1369
-				if ( ( isset( $has_activated[$messenger] ) && in_array($mt, $has_activated[$messenger]) ) || isset( $active_messengers[$messenger]['settings'][$messenger . '-message_types'][$mt] ) ||  EEH_MSG_Template::already_generated( $messenger, $mt, 0, FALSE ) ) {
1369
+				if ((isset($has_activated[$messenger]) && in_array($mt, $has_activated[$messenger])) || isset($active_messengers[$messenger]['settings'][$messenger.'-message_types'][$mt]) || EEH_MSG_Template::already_generated($messenger, $mt, 0, FALSE)) {
1370 1370
 					continue;
1371 1371
 				}
1372 1372
 
1373 1373
 				//is there an installed_mt matching the default string?  If not then nothing to do here.
1374
-				if ( ! isset( $installed_mts[$mt] ) ) {
1375
-					unset( $all_default_mts[$mt] );
1374
+				if ( ! isset($installed_mts[$mt])) {
1375
+					unset($all_default_mts[$mt]);
1376 1376
 					continue;
1377 1377
 				}
1378 1378
 
1379 1379
 				$settings_fields = $installed_mts[$mt]->get_admin_settings_fields();
1380 1380
 				$settings = array();
1381
-				if ( is_array( $settings_fields ) ) {
1382
-					foreach ( $settings_fields as $field => $values ) {
1383
-						if ( isset( $values['default'] ) ) {
1381
+				if (is_array($settings_fields)) {
1382
+					foreach ($settings_fields as $field => $values) {
1383
+						if (isset($values['default'])) {
1384 1384
 							$settings[$field] = $values['default'];
1385 1385
 						}
1386 1386
 					}
1387 1387
 				}
1388 1388
 
1389
-				$active_messengers[$messenger]['settings'][$messenger . '-message_types'][$mt]['settings'] = $settings;
1389
+				$active_messengers[$messenger]['settings'][$messenger.'-message_types'][$mt]['settings'] = $settings;
1390 1390
 				$new_default_mts[] = $mt;
1391 1391
 				$has_activated[$messenger][] = $mt;
1392 1392
 			}
1393 1393
 
1394 1394
 
1395
-			if ( ! empty( $new_default_mts ) ) {
1396
-				$success = EEH_MSG_Template::generate_new_templates( $messenger, $new_default_mts, '', TRUE );
1395
+			if ( ! empty($new_default_mts)) {
1396
+				$success = EEH_MSG_Template::generate_new_templates($messenger, $new_default_mts, '', TRUE);
1397 1397
 			}
1398 1398
 
1399 1399
 		}
1400 1400
 
1401 1401
 		//now let's save the settings for this messenger!
1402
-		EEH_MSG_Template::update_active_messengers_in_db( $active_messengers );
1402
+		EEH_MSG_Template::update_active_messengers_in_db($active_messengers);
1403 1403
 
1404 1404
 		//update $has_activated record
1405
-		update_option( 'ee_has_activated_messenger', $has_activated );
1405
+		update_option('ee_has_activated_messenger', $has_activated);
1406 1406
 
1407 1407
 		//that's it!
1408 1408
 		return $success;
@@ -1422,47 +1422,47 @@  discard block
 block discarded – undo
1422 1422
 	 */
1423 1423
 	public static function validate_messages_system() {
1424 1424
 		//include our helper
1425
-		EE_Registry::instance()->load_helper( 'MSG_Template' );
1425
+		EE_Registry::instance()->load_helper('MSG_Template');
1426 1426
 
1427 1427
 		//get active and installed  messengers/message types.
1428 1428
 		$active_messengers = EEH_MSG_Template::get_active_messengers_in_db();
1429 1429
 		$installed = EEH_MSG_Template::get_installed_message_objects();
1430 1430
 		$installed_messengers = $installed_mts = array();
1431 1431
 		//set up the arrays so they can be handled easier.
1432
-		foreach( $installed['messengers'] as $im ) {
1433
-			if ( $im instanceof EE_messenger ) {
1432
+		foreach ($installed['messengers'] as $im) {
1433
+			if ($im instanceof EE_messenger) {
1434 1434
 				$installed_messengers[$im->name] = $im;
1435 1435
 			}
1436 1436
 		}
1437
-		foreach( $installed['message_types'] as $imt ) {
1438
-			if ( $imt instanceof EE_message_type ) {
1437
+		foreach ($installed['message_types'] as $imt) {
1438
+			if ($imt instanceof EE_message_type) {
1439 1439
 				$installed_mts[$imt->name] = $imt;
1440 1440
 			}
1441 1441
 		}
1442 1442
 
1443 1443
 		//now let's loop through the active array and validate
1444
-		foreach( $active_messengers as $messenger => $active_details ) {
1444
+		foreach ($active_messengers as $messenger => $active_details) {
1445 1445
 			//first let's see if this messenger is installed.
1446
-			if ( ! isset( $installed_messengers[$messenger] ) ) {
1446
+			if ( ! isset($installed_messengers[$messenger])) {
1447 1447
 				//not set so let's just remove from actives and make sure templates are inactive.
1448
-				unset( $active_messengers[$messenger] );
1449
-				EEH_MSG_Template::update_to_inactive( $messenger );
1448
+				unset($active_messengers[$messenger]);
1449
+				EEH_MSG_Template::update_to_inactive($messenger);
1450 1450
 				continue;
1451 1451
 			}
1452 1452
 
1453 1453
 			//messenger is active, so let's just make sure that any active message types not installed are deactivated.
1454
-			$mts = ! empty( $active_details['settings'][$messenger . '-message_types'] ) ? $active_details['settings'][$messenger . '-message_types'] : array();
1455
-			foreach ( $mts as $mt_name => $mt ) {
1456
-				if ( ! isset( $installed_mts[$mt_name] )  ) {
1457
-					unset( $active_messengers[$messenger]['settings'][$messenger . '-message_types'][$mt_name] );
1458
-					EEH_MSG_Template::update_to_inactive( $messenger, $mt_name );
1454
+			$mts = ! empty($active_details['settings'][$messenger.'-message_types']) ? $active_details['settings'][$messenger.'-message_types'] : array();
1455
+			foreach ($mts as $mt_name => $mt) {
1456
+				if ( ! isset($installed_mts[$mt_name])) {
1457
+					unset($active_messengers[$messenger]['settings'][$messenger.'-message_types'][$mt_name]);
1458
+					EEH_MSG_Template::update_to_inactive($messenger, $mt_name);
1459 1459
 				}
1460 1460
 			}
1461 1461
 		}
1462 1462
 
1463 1463
 		//all done! let's update the active_messengers.
1464
-		EEH_MSG_Template::update_active_messengers_in_db( $active_messengers );
1465
-		do_action( 'AHEE__EEH_Activation__validate_messages_system' );
1464
+		EEH_MSG_Template::update_active_messengers_in_db($active_messengers);
1465
+		do_action('AHEE__EEH_Activation__validate_messages_system');
1466 1466
 		return;
1467 1467
 	}
1468 1468
 
@@ -1476,12 +1476,12 @@  discard block
 block discarded – undo
1476 1476
 	 * 	@static
1477 1477
 	 * 	@return void
1478 1478
 	 */
1479
-	public static function create_no_ticket_prices_array(){
1479
+	public static function create_no_ticket_prices_array() {
1480 1480
 		// this creates an array for tracking events that have no active ticket prices created
1481 1481
 		// this allows us to warn admins of the situation so that it can be corrected
1482
-		$espresso_no_ticket_prices = get_option( 'ee_no_ticket_prices', FALSE );
1483
-		if ( ! $espresso_no_ticket_prices ) {
1484
-			add_option( 'ee_no_ticket_prices', array(), '', FALSE );
1482
+		$espresso_no_ticket_prices = get_option('ee_no_ticket_prices', FALSE);
1483
+		if ( ! $espresso_no_ticket_prices) {
1484
+			add_option('ee_no_ticket_prices', array(), '', FALSE);
1485 1485
 		}
1486 1486
 	}
1487 1487
 
@@ -1503,24 +1503,24 @@  discard block
 block discarded – undo
1503 1503
 	 * Finds all our EE4 custom post types, and deletes them and their associated data (like post meta or term relations)/
1504 1504
 	 * @global wpdb $wpdb
1505 1505
 	 */
1506
-	public static function delete_all_espresso_cpt_data(){
1506
+	public static function delete_all_espresso_cpt_data() {
1507 1507
 		global $wpdb;
1508 1508
 		//get all the CPT post_types
1509 1509
 		$ee_post_types = array();
1510
-		foreach(EE_Registry::instance()->non_abstract_db_models as $model_name){
1511
-			if ( method_exists( $model_name, 'instance' )) {
1512
-				$model_obj = call_user_func( array( $model_name, 'instance' ));
1513
-				if ( $model_obj instanceof EEM_CPT_Base ) {
1514
-					$ee_post_types[] = $wpdb->prepare("%s",$model_obj->post_type());
1510
+		foreach (EE_Registry::instance()->non_abstract_db_models as $model_name) {
1511
+			if (method_exists($model_name, 'instance')) {
1512
+				$model_obj = call_user_func(array($model_name, 'instance'));
1513
+				if ($model_obj instanceof EEM_CPT_Base) {
1514
+					$ee_post_types[] = $wpdb->prepare("%s", $model_obj->post_type());
1515 1515
 				}
1516 1516
 			}
1517 1517
 		}
1518 1518
 		//get all our CPTs
1519
-		$query = "SELECT ID FROM {$wpdb->posts} WHERE post_type IN (".implode(",",$ee_post_types).")";
1519
+		$query = "SELECT ID FROM {$wpdb->posts} WHERE post_type IN (".implode(",", $ee_post_types).")";
1520 1520
 		$cpt_ids = $wpdb->get_col($query);
1521 1521
 		//delete each post meta and term relations too
1522
-		foreach($cpt_ids as $post_id){
1523
-			wp_delete_post($post_id,true);
1522
+		foreach ($cpt_ids as $post_id) {
1523
+			wp_delete_post($post_id, true);
1524 1524
 		}
1525 1525
 	}
1526 1526
 
@@ -1534,18 +1534,18 @@  discard block
 block discarded – undo
1534 1534
 	 * @param bool $remove_all
1535 1535
 	 * @return void
1536 1536
 	 */
1537
-	public static function delete_all_espresso_tables_and_data( $remove_all = true ) {
1537
+	public static function delete_all_espresso_tables_and_data($remove_all = true) {
1538 1538
 		global $wpdb;
1539 1539
 		$undeleted_tables = array();
1540 1540
 
1541 1541
 		// load registry
1542
-		foreach( EE_Registry::instance()->non_abstract_db_models as $model_name ){
1543
-			if ( method_exists( $model_name, 'instance' )) {
1544
-				$model_obj = call_user_func( array( $model_name, 'instance' ));
1545
-				if ( $model_obj instanceof EEM_Base ) {
1546
-					foreach ( $model_obj->get_tables() as $table ) {
1547
-						if ( strpos( $table->get_table_name(), 'esp_' )) {
1548
-							switch ( EEH_Activation::delete_unused_db_table( $table->get_table_name() )) {
1542
+		foreach (EE_Registry::instance()->non_abstract_db_models as $model_name) {
1543
+			if (method_exists($model_name, 'instance')) {
1544
+				$model_obj = call_user_func(array($model_name, 'instance'));
1545
+				if ($model_obj instanceof EEM_Base) {
1546
+					foreach ($model_obj->get_tables() as $table) {
1547
+						if (strpos($table->get_table_name(), 'esp_')) {
1548
+							switch (EEH_Activation::delete_unused_db_table($table->get_table_name())) {
1549 1549
 								case false :
1550 1550
 									$undeleted_tables[] = $table->get_table_name();
1551 1551
 								break;
@@ -1570,8 +1570,8 @@  discard block
 block discarded – undo
1570 1570
 			'esp_promotion_rule',
1571 1571
 			'esp_rule'
1572 1572
 		);
1573
-		foreach( $tables_without_models as $table ){
1574
-			EEH_Activation::delete_db_table_if_empty( $table );
1573
+		foreach ($tables_without_models as $table) {
1574
+			EEH_Activation::delete_db_table_if_empty($table);
1575 1575
 		}
1576 1576
 
1577 1577
 
@@ -1608,58 +1608,58 @@  discard block
 block discarded – undo
1608 1608
 			'ee_pers_admin_notices' => true,
1609 1609
 			'ee_upload_directories_incomplete' => true,
1610 1610
 		);
1611
-		if( is_main_site() ) {
1612
-			$wp_options_to_delete[ 'ee_network_config' ] = true;
1611
+		if (is_main_site()) {
1612
+			$wp_options_to_delete['ee_network_config'] = true;
1613 1613
 		}
1614 1614
 
1615 1615
 		$undeleted_options = array();
1616
-		foreach ( $wp_options_to_delete as $option_name => $no_wildcard ) {
1616
+		foreach ($wp_options_to_delete as $option_name => $no_wildcard) {
1617 1617
 
1618
-			if( $no_wildcard ){
1619
-				if( ! delete_option( $option_name ) ){
1618
+			if ($no_wildcard) {
1619
+				if ( ! delete_option($option_name)) {
1620 1620
 					$undeleted_options[] = $option_name;
1621 1621
 				}
1622
-			}else{
1623
-				$option_names_to_delete_from_wildcard = $wpdb->get_col( "SELECT option_name FROM $wpdb->options WHERE option_name LIKE '%$option_name%'" );
1624
-				foreach($option_names_to_delete_from_wildcard as $option_name_from_wildcard ){
1625
-					if( ! delete_option( $option_name_from_wildcard ) ){
1622
+			} else {
1623
+				$option_names_to_delete_from_wildcard = $wpdb->get_col("SELECT option_name FROM $wpdb->options WHERE option_name LIKE '%$option_name%'");
1624
+				foreach ($option_names_to_delete_from_wildcard as $option_name_from_wildcard) {
1625
+					if ( ! delete_option($option_name_from_wildcard)) {
1626 1626
 						$undeleted_options[] = $option_name_from_wildcard;
1627 1627
 					}
1628 1628
 				}
1629 1629
 			}
1630 1630
 		}
1631 1631
                 //also, let's make sure the "ee_config_option_names" wp option stays out by removing the action that adds it
1632
-                remove_action( 'shutdown', array( EE_Config::instance(), 'shutdown' ), 10 );
1632
+                remove_action('shutdown', array(EE_Config::instance(), 'shutdown'), 10);
1633 1633
 
1634
-		if ( $remove_all && $espresso_db_update = get_option( 'espresso_db_update' )) {
1634
+		if ($remove_all && $espresso_db_update = get_option('espresso_db_update')) {
1635 1635
 			$db_update_sans_ee4 = array();
1636
-			foreach($espresso_db_update as $version => $times_activated){
1637
-				if( $version[0] =='3'){//if its NON EE4
1636
+			foreach ($espresso_db_update as $version => $times_activated) {
1637
+				if ($version[0] == '3') {//if its NON EE4
1638 1638
 					$db_update_sans_ee4[$version] = $times_activated;
1639 1639
 				}
1640 1640
 			}
1641
-			update_option( 'espresso_db_update', $db_update_sans_ee4 );
1641
+			update_option('espresso_db_update', $db_update_sans_ee4);
1642 1642
 		}
1643 1643
 
1644 1644
 		$errors = '';
1645
-		if ( ! empty( $undeleted_tables )) {
1645
+		if ( ! empty($undeleted_tables)) {
1646 1646
 			$errors .= sprintf(
1647
-				__( 'The following tables could not be deleted: %s%s', 'event_espresso' ),
1647
+				__('The following tables could not be deleted: %s%s', 'event_espresso'),
1648 1648
 				'<br/>',
1649
-				implode( ',<br/>', $undeleted_tables )
1649
+				implode(',<br/>', $undeleted_tables)
1650 1650
 			);
1651 1651
 		}
1652
-		if ( ! empty( $undeleted_options )) {
1653
-			$errors .= ! empty( $undeleted_tables ) ? '<br/>' : '';
1652
+		if ( ! empty($undeleted_options)) {
1653
+			$errors .= ! empty($undeleted_tables) ? '<br/>' : '';
1654 1654
 			$errors .= sprintf(
1655
-				__( 'The following wp-options could not be deleted: %s%s', 'event_espresso' ),
1655
+				__('The following wp-options could not be deleted: %s%s', 'event_espresso'),
1656 1656
 				'<br/>',
1657
-				implode( ',<br/>', $undeleted_options )
1657
+				implode(',<br/>', $undeleted_options)
1658 1658
 			);
1659 1659
 
1660 1660
 		}
1661
-		if ( $errors != '' ) {
1662
-			EE_Error::add_attention( $errors, __FILE__, __FUNCTION__, __LINE__ );
1661
+		if ($errors != '') {
1662
+			EE_Error::add_attention($errors, __FILE__, __FUNCTION__, __LINE__);
1663 1663
 		}
1664 1664
 	}
1665 1665
 
@@ -1669,23 +1669,23 @@  discard block
 block discarded – undo
1669 1669
 	 * @param string $table_name with or without $wpdb->prefix
1670 1670
 	 * @return boolean
1671 1671
 	 */
1672
-	public static function table_exists( $table_name ){
1672
+	public static function table_exists($table_name) {
1673 1673
 		global $wpdb, $EZSQL_ERROR;
1674
-		$table_name = EEH_Activation::ensure_table_name_has_prefix( $table_name );
1674
+		$table_name = EEH_Activation::ensure_table_name_has_prefix($table_name);
1675 1675
 		//ignore if this causes an sql error
1676 1676
 		$old_error = $wpdb->last_error;
1677 1677
 		$old_suppress_errors = $wpdb->suppress_errors();
1678
-		$old_show_errors_value = $wpdb->show_errors( FALSE );
1678
+		$old_show_errors_value = $wpdb->show_errors(FALSE);
1679 1679
 		$ezsql_error_cache = $EZSQL_ERROR;
1680
-		$wpdb->get_results( "SELECT * from $table_name LIMIT 1");
1681
-		$wpdb->show_errors( $old_show_errors_value );
1682
-		$wpdb->suppress_errors( $old_suppress_errors );
1680
+		$wpdb->get_results("SELECT * from $table_name LIMIT 1");
1681
+		$wpdb->show_errors($old_show_errors_value);
1682
+		$wpdb->suppress_errors($old_suppress_errors);
1683 1683
 		$new_error = $wpdb->last_error;
1684 1684
 		$wpdb->last_error = $old_error;
1685 1685
 		$EZSQL_ERROR = $ezsql_error_cache;
1686
-		if( empty( $new_error ) ){
1686
+		if (empty($new_error)) {
1687 1687
 			return TRUE;
1688
-		}else{
1688
+		} else {
1689 1689
 			return FALSE;
1690 1690
 		}
1691 1691
 	}
@@ -1693,7 +1693,7 @@  discard block
 block discarded – undo
1693 1693
 	/**
1694 1694
 	 * Resets the cache on EEH_Activation
1695 1695
 	 */
1696
-	public static function reset(){
1696
+	public static function reset() {
1697 1697
 		self::$_default_creator_id = NULL;
1698 1698
 		self::$_initialized_db_content_already_in_this_request = false;
1699 1699
 	}
Please login to merge, or discard this patch.
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -1092,14 +1092,14 @@  discard block
 block discarded – undo
1092 1092
 							$QSG_ID = reset( $id_col );
1093 1093
 						} else {
1094 1094
 							//ok so we didn't find it in the db either?? that's weird because we should have inserted it at the start of this method
1095
-                                                        EE_Log::instance()->log( 
1096
-                                                                __FILE__, 
1097
-                                                                __FUNCTION__, 
1098
-                                                                sprintf( 
1099
-                                                                        __( 'Could not associate question %1$s to a question group because no system question group existed', 'event_espresso'), 
1100
-                                                                        $QST_ID ), 
1101
-                                                                'error' );
1102
-                                                        continue;
1095
+														EE_Log::instance()->log( 
1096
+																__FILE__, 
1097
+																__FUNCTION__, 
1098
+																sprintf( 
1099
+																		__( 'Could not associate question %1$s to a question group because no system question group existed', 'event_espresso'), 
1100
+																		$QST_ID ), 
1101
+																'error' );
1102
+														continue;
1103 1103
 						}
1104 1104
 					}
1105 1105
                                         
@@ -1629,8 +1629,8 @@  discard block
 block discarded – undo
1629 1629
 				}
1630 1630
 			}
1631 1631
 		}
1632
-                //also, let's make sure the "ee_config_option_names" wp option stays out by removing the action that adds it
1633
-                remove_action( 'shutdown', array( EE_Config::instance(), 'shutdown' ), 10 );
1632
+				//also, let's make sure the "ee_config_option_names" wp option stays out by removing the action that adds it
1633
+				remove_action( 'shutdown', array( EE_Config::instance(), 'shutdown' ), 10 );
1634 1634
 
1635 1635
 		if ( $remove_all && $espresso_db_update = get_option( 'espresso_db_update' )) {
1636 1636
 			$db_update_sans_ee4 = array();
Please login to merge, or discard this patch.
admin_pages/events/qtips/EE_Event_List_Table_Tips.lib.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 			0 => array(
34 34
 				'content_id' => 'attendee-column-tip',
35 35
 				'target' => '.column-attendees .dashicons-groups',
36
-				'content' => sprintf( __('%s Registrations', 'event_espresso'), EEH_Template::pretty_status(EEM_Registration::status_id_approved, FALSE, 'sentence') ),
36
+				'content' => sprintf(__('%s Registrations', 'event_espresso'), EEH_Template::pretty_status(EEM_Registration::status_id_approved, FALSE, 'sentence')),
37 37
 				'options' => array( 
38 38
 					'position' => array(
39 39
 						'my' => 'bottom left',
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 	 * @param  EE_Datetime constant $status What status is set (by class)
125 125
 	 * @return string         The status legend with the related status highlighted
126 126
 	 */
127
-	private function _event_status_legend( $status ) {
127
+	private function _event_status_legend($status) {
128 128
 
129 129
 		$status_array = array(
130 130
 			'active_status' => EE_Datetime::active,
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
 			'inactive_status' => EE_Datetime::inactive
137 137
 		);
138 138
 
139
-		return EEH_Template::status_legend( $status_array, $status );
139
+		return EEH_Template::status_legend($status_array, $status);
140 140
 	}
141 141
 
142 142
 }
143 143
\ No newline at end of file
Please login to merge, or discard this patch.
admin_pages/registrations/qtips/Registration_List_Table_Tips.lib.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 
93 93
 
94 94
 	private function _registration_trash_message() {
95
-		return '<p>' . __('This lock-icon means that this registration cannot be trashed.  Registrations that belong to a transaction that has payments cannot be trashed.  If you wish to trash this registration then you must delete all payments attached to the related transaction first.', 'event_espresso') . '</p>';
95
+		return '<p>'.__('This lock-icon means that this registration cannot be trashed.  Registrations that belong to a transaction that has payments cannot be trashed.  If you wish to trash this registration then you must delete all payments attached to the related transaction first.', 'event_espresso').'</p>';
96 96
 	}
97 97
 
98 98
 
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
 	 * @param  EEM_Registration constant $status What status is set (by class)
105 105
 	 * @return string         The status legend with the related status highlighted
106 106
 	 */
107
-	private function _registration_status_legend( $status ) {
107
+	private function _registration_status_legend($status) {
108 108
 
109 109
 		$status_array = array(
110 110
 			'approved_status' => EEM_Registration::status_id_approved,
@@ -114,6 +114,6 @@  discard block
 block discarded – undo
114 114
 			'cancelled_status' => EEM_Registration::status_id_cancelled
115 115
 			);
116 116
 
117
-		return EEH_Template::status_legend( $status_array, $status );
117
+		return EEH_Template::status_legend($status_array, $status);
118 118
 	}
119 119
 }
120 120
\ No newline at end of file
Please login to merge, or discard this patch.
templates/support_admin_details_shortcodes_event_listings.template.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@
 block discarded – undo
7 7
 			<li><strong><?php _e('Set a custom title for the event list', 'event_espresso'); ?></strong><br /> [ESPRESSO_EVENTS title="My Super Event List"]</li>
8 8
 			<li><strong><?php _e('Limit (paginate) the number of events that are shown in the event list on a page or post', 'event_espresso'); ?></strong><br />[ESPRESSO_EVENTS limit="5"]</li>
9 9
 			<li><strong><?php _e('Add a custom CSS class to each event post/article', 'event_espresso'); ?></strong><br /> [ESPRESSO_EVENTS css_class="my-custom-class"]</li>
10
-			<li><strong><?php _e('Filter the event list by month and year', 'event_espresso'); ?></strong><br />[ESPRESSO_EVENTS month="<?php echo date( 'F Y' ); ?>"]</li>
10
+			<li><strong><?php _e('Filter the event list by month and year', 'event_espresso'); ?></strong><br />[ESPRESSO_EVENTS month="<?php echo date('F Y'); ?>"]</li>
11 11
 			<li><strong><?php _e('Show expired events in the event list', 'event_espresso'); ?></strong><br />[ESPRESSO_EVENTS show_expired="true"]</li>
12 12
 			<li><strong><?php _e('Sorts the event list in ascending order', 'event_espresso'); ?></strong><br />[ESPRESSO_EVENTS sort="ASC"]</li>
13 13
 			<li><strong><?php _e('Sorts the event list in descending order', 'event_espresso'); ?></strong><br />[ESPRESSO_EVENTS sort="DESC"]</li>
Please login to merge, or discard this patch.