@@ -38,8 +38,8 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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,7 +198,7 @@ discard block |
||
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 | // filter list of reg_steps |
@@ -207,24 +207,24 @@ discard block |
||
207 | 207 | EED_Single_Page_Checkout::get_reg_steps() |
208 | 208 | ); |
209 | 209 | // sort by key (order) |
210 | - ksort( $reg_steps_to_load ); |
|
210 | + ksort($reg_steps_to_load); |
|
211 | 211 | // loop through folders |
212 | - foreach ( $reg_steps_to_load as $order => $reg_step ) { |
|
212 | + foreach ($reg_steps_to_load as $order => $reg_step) { |
|
213 | 213 | // we need a |
214 | - if ( isset( $reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'] )) { |
|
214 | + if (isset($reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'])) { |
|
215 | 215 | // copy over to the reg_steps_array |
216 | - EED_Single_Page_Checkout::$_reg_steps_array[ $order ] = $reg_step; |
|
216 | + EED_Single_Page_Checkout::$_reg_steps_array[$order] = $reg_step; |
|
217 | 217 | // register custom key route for each reg step |
218 | 218 | // ie: step=>"slug" - this is the entire reason we load the reg steps array now |
219 | - EE_Config::register_route( $reg_step['slug'], 'EED_Single_Page_Checkout', 'run', 'step' ); |
|
219 | + EE_Config::register_route($reg_step['slug'], 'EED_Single_Page_Checkout', 'run', 'step'); |
|
220 | 220 | // add AJAX or other hooks |
221 | - if ( isset( $reg_step['has_hooks'] ) && $reg_step['has_hooks'] ) { |
|
221 | + if (isset($reg_step['has_hooks']) && $reg_step['has_hooks']) { |
|
222 | 222 | // setup autoloaders if necessary |
223 | - if ( ! class_exists( $reg_step['class_name'] )) { |
|
224 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder( $reg_step['file_path'], TRUE ); |
|
223 | + if ( ! class_exists($reg_step['class_name'])) { |
|
224 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder($reg_step['file_path'], TRUE); |
|
225 | 225 | } |
226 | - if ( is_callable( $reg_step['class_name'], 'set_hooks' )) { |
|
227 | - call_user_func( array( $reg_step['class_name'], 'set_hooks' )); |
|
226 | + if (is_callable($reg_step['class_name'], 'set_hooks')) { |
|
227 | + call_user_func(array($reg_step['class_name'], 'set_hooks')); |
|
228 | 228 | } |
229 | 229 | } |
230 | 230 | } |
@@ -243,28 +243,28 @@ discard block |
||
243 | 243 | */ |
244 | 244 | public static function get_reg_steps() { |
245 | 245 | $reg_steps = EE_Registry::instance()->CFG->registration->reg_steps; |
246 | - if ( empty( $reg_steps )) { |
|
246 | + if (empty($reg_steps)) { |
|
247 | 247 | $reg_steps = array( |
248 | 248 | 10 => array( |
249 | - 'file_path' => SPCO_REG_STEPS_PATH . 'attendee_information', |
|
249 | + 'file_path' => SPCO_REG_STEPS_PATH.'attendee_information', |
|
250 | 250 | 'class_name' => 'EE_SPCO_Reg_Step_Attendee_Information', |
251 | 251 | 'slug' => 'attendee_information', |
252 | 252 | 'has_hooks' => FALSE |
253 | 253 | ), |
254 | 254 | 20 => array( |
255 | - 'file_path' => SPCO_REG_STEPS_PATH . 'registration_confirmation', |
|
255 | + 'file_path' => SPCO_REG_STEPS_PATH.'registration_confirmation', |
|
256 | 256 | 'class_name' => 'EE_SPCO_Reg_Step_Registration_Confirmation', |
257 | 257 | 'slug' => 'registration_confirmation', |
258 | 258 | 'has_hooks' => FALSE |
259 | 259 | ), |
260 | 260 | 30 => array( |
261 | - 'file_path' => SPCO_REG_STEPS_PATH . 'payment_options', |
|
261 | + 'file_path' => SPCO_REG_STEPS_PATH.'payment_options', |
|
262 | 262 | 'class_name' => 'EE_SPCO_Reg_Step_Payment_Options', |
263 | 263 | 'slug' => 'payment_options', |
264 | 264 | 'has_hooks' => TRUE |
265 | 265 | ), |
266 | 266 | 999 => array( |
267 | - 'file_path' => SPCO_REG_STEPS_PATH . 'finalize_registration', |
|
267 | + 'file_path' => SPCO_REG_STEPS_PATH.'finalize_registration', |
|
268 | 268 | 'class_name' => 'EE_SPCO_Reg_Step_Finalize_Registration', |
269 | 269 | 'slug' => 'finalize_registration', |
270 | 270 | 'has_hooks' => FALSE |
@@ -284,9 +284,9 @@ discard block |
||
284 | 284 | */ |
285 | 285 | public static function registration_checkout_for_admin() { |
286 | 286 | EED_Single_Page_Checkout::load_reg_steps(); |
287 | - EE_Registry::instance()->REQ->set( 'step', 'attendee_information' ); |
|
288 | - EE_Registry::instance()->REQ->set( 'action', 'display_spco_reg_step' ); |
|
289 | - EE_Registry::instance()->REQ->set( 'process_form_submission', false ); |
|
287 | + EE_Registry::instance()->REQ->set('step', 'attendee_information'); |
|
288 | + EE_Registry::instance()->REQ->set('action', 'display_spco_reg_step'); |
|
289 | + EE_Registry::instance()->REQ->set('process_form_submission', false); |
|
290 | 290 | EED_Single_Page_Checkout::instance()->_initialize(); |
291 | 291 | EED_Single_Page_Checkout::instance()->_display_spco_reg_form(); |
292 | 292 | return EE_Registry::instance()->REQ->get_output(); |
@@ -302,14 +302,14 @@ discard block |
||
302 | 302 | */ |
303 | 303 | public static function process_registration_from_admin() { |
304 | 304 | EED_Single_Page_Checkout::load_reg_steps(); |
305 | - EE_Registry::instance()->REQ->set( 'step', 'attendee_information' ); |
|
306 | - EE_Registry::instance()->REQ->set( 'action', 'process_reg_step' ); |
|
307 | - EE_Registry::instance()->REQ->set( 'process_form_submission', true ); |
|
305 | + EE_Registry::instance()->REQ->set('step', 'attendee_information'); |
|
306 | + EE_Registry::instance()->REQ->set('action', 'process_reg_step'); |
|
307 | + EE_Registry::instance()->REQ->set('process_form_submission', true); |
|
308 | 308 | EED_Single_Page_Checkout::instance()->_initialize(); |
309 | - if ( EED_Single_Page_Checkout::instance()->checkout->current_step->completed() ) { |
|
310 | - $final_reg_step = end( EED_Single_Page_Checkout::instance()->checkout->reg_steps ); |
|
311 | - if ( $final_reg_step instanceof EE_SPCO_Reg_Step_Finalize_Registration ) { |
|
312 | - if ( $final_reg_step->process_reg_step() ) { |
|
309 | + if (EED_Single_Page_Checkout::instance()->checkout->current_step->completed()) { |
|
310 | + $final_reg_step = end(EED_Single_Page_Checkout::instance()->checkout->reg_steps); |
|
311 | + if ($final_reg_step instanceof EE_SPCO_Reg_Step_Finalize_Registration) { |
|
312 | + if ($final_reg_step->process_reg_step()) { |
|
313 | 313 | return EED_Single_Page_Checkout::instance()->checkout->transaction; |
314 | 314 | } |
315 | 315 | } |
@@ -326,11 +326,11 @@ discard block |
||
326 | 326 | * @param WP_Query $WP_Query |
327 | 327 | * @return void |
328 | 328 | */ |
329 | - public function run( $WP_Query ) { |
|
329 | + public function run($WP_Query) { |
|
330 | 330 | if ( |
331 | 331 | $WP_Query instanceof WP_Query |
332 | 332 | && $WP_Query->is_main_query() |
333 | - && apply_filters( 'FHEE__EED_Single_Page_Checkout__run', true ) |
|
333 | + && apply_filters('FHEE__EED_Single_Page_Checkout__run', true) |
|
334 | 334 | ) { |
335 | 335 | $this->_initialize(); |
336 | 336 | } |
@@ -346,8 +346,8 @@ discard block |
||
346 | 346 | * @param WP_Query $WP_Query |
347 | 347 | * @return void |
348 | 348 | */ |
349 | - public static function init( $WP_Query ) { |
|
350 | - EED_Single_Page_Checkout::instance()->run( $WP_Query ); |
|
349 | + public static function init($WP_Query) { |
|
350 | + EED_Single_Page_Checkout::instance()->run($WP_Query); |
|
351 | 351 | } |
352 | 352 | |
353 | 353 | |
@@ -361,35 +361,35 @@ discard block |
||
361 | 361 | */ |
362 | 362 | private function _initialize() { |
363 | 363 | // ensure SPCO doesn't run twice |
364 | - if ( EED_Single_Page_Checkout::$_initialized ) { |
|
364 | + if (EED_Single_Page_Checkout::$_initialized) { |
|
365 | 365 | return; |
366 | 366 | } |
367 | 367 | // setup the EE_Checkout object |
368 | 368 | $this->checkout = $this->_initialize_checkout(); |
369 | 369 | // filter checkout |
370 | - $this->checkout = apply_filters( 'FHEE__EED_Single_Page_Checkout___initialize__checkout', $this->checkout ); |
|
370 | + $this->checkout = apply_filters('FHEE__EED_Single_Page_Checkout___initialize__checkout', $this->checkout); |
|
371 | 371 | // get the $_GET |
372 | 372 | $this->_get_request_vars(); |
373 | 373 | // filter continue_reg |
374 | - $this->checkout->continue_reg = apply_filters( 'FHEE__EED_Single_Page_Checkout__init___continue_reg', TRUE, $this->checkout ); |
|
374 | + $this->checkout->continue_reg = apply_filters('FHEE__EED_Single_Page_Checkout__init___continue_reg', TRUE, $this->checkout); |
|
375 | 375 | // load the reg steps array |
376 | - if ( ! $this->_load_and_instantiate_reg_steps() ) { |
|
376 | + if ( ! $this->_load_and_instantiate_reg_steps()) { |
|
377 | 377 | EED_Single_Page_Checkout::$_initialized = true; |
378 | 378 | return; |
379 | 379 | } |
380 | 380 | // set the current step |
381 | - $this->checkout->set_current_step( $this->checkout->step ); |
|
381 | + $this->checkout->set_current_step($this->checkout->step); |
|
382 | 382 | // and the next step |
383 | 383 | $this->checkout->set_next_step(); |
384 | 384 | // was there already a valid transaction in the checkout from the session ? |
385 | - if ( ! $this->checkout->transaction instanceof EE_Transaction ) { |
|
385 | + if ( ! $this->checkout->transaction instanceof EE_Transaction) { |
|
386 | 386 | // get transaction from db or session |
387 | 387 | $this->checkout->transaction = $this->checkout->reg_url_link && ! is_admin() |
388 | 388 | ? $this->_get_transaction_and_cart_for_previous_visit() |
389 | 389 | : $this->_get_cart_for_current_session_and_setup_new_transaction(); |
390 | - if ( ! $this->checkout->transaction instanceof EE_Transaction ) { |
|
390 | + if ( ! $this->checkout->transaction instanceof EE_Transaction) { |
|
391 | 391 | EE_Error::add_error( |
392 | - __( 'Your Registration and Transaction information could not be retrieved from the db.', 'event_espresso' ), |
|
392 | + __('Your Registration and Transaction information could not be retrieved from the db.', 'event_espresso'), |
|
393 | 393 | __FILE__, __FUNCTION__, __LINE__ |
394 | 394 | ); |
395 | 395 | // add some style and make it dance |
@@ -399,10 +399,10 @@ discard block |
||
399 | 399 | return; |
400 | 400 | } |
401 | 401 | // and the registrations for the transaction |
402 | - $this->_get_registrations( $this->checkout->transaction ); |
|
402 | + $this->_get_registrations($this->checkout->transaction); |
|
403 | 403 | } |
404 | 404 | // verify that everything has been setup correctly |
405 | - if ( ! $this->_final_verifications() ) { |
|
405 | + if ( ! $this->_final_verifications()) { |
|
406 | 406 | EED_Single_Page_Checkout::$_initialized = true; |
407 | 407 | return; |
408 | 408 | } |
@@ -427,9 +427,9 @@ discard block |
||
427 | 427 | // set no cache headers and constants |
428 | 428 | EE_System::do_not_cache(); |
429 | 429 | // add anchor |
430 | - add_action( 'loop_start', array( $this, 'set_checkout_anchor' ), 1 ); |
|
430 | + add_action('loop_start', array($this, 'set_checkout_anchor'), 1); |
|
431 | 431 | // remove transaction lock |
432 | - add_action( 'shutdown', array( $this, 'unlock_transaction' ), 1 ); |
|
432 | + add_action('shutdown', array($this, 'unlock_transaction'), 1); |
|
433 | 433 | } |
434 | 434 | |
435 | 435 | |
@@ -446,20 +446,20 @@ discard block |
||
446 | 446 | // look in session for existing checkout |
447 | 447 | $checkout = EE_Registry::instance()->SSN->checkout(); |
448 | 448 | // verify |
449 | - if ( ! $checkout instanceof EE_Checkout ) { |
|
449 | + if ( ! $checkout instanceof EE_Checkout) { |
|
450 | 450 | // instantiate EE_Checkout object for handling the properties of the current checkout process |
451 | - $checkout = EE_Registry::instance()->load_file( SPCO_INC_PATH, 'EE_Checkout', 'class', array(), FALSE ); |
|
451 | + $checkout = EE_Registry::instance()->load_file(SPCO_INC_PATH, 'EE_Checkout', 'class', array(), FALSE); |
|
452 | 452 | // verify again |
453 | - if ( ! $checkout instanceof EE_Checkout ) { |
|
454 | - throw new EE_Error( __( 'The EE_Checkout class could not be loaded.', 'event_espresso' ) ); |
|
453 | + if ( ! $checkout instanceof EE_Checkout) { |
|
454 | + throw new EE_Error(__('The EE_Checkout class could not be loaded.', 'event_espresso')); |
|
455 | 455 | } |
456 | 456 | } else { |
457 | - if ( $checkout->current_step->is_final_step() && $checkout->exit_spco() === true ) { |
|
458 | - wp_safe_redirect( $checkout->redirect_url ); |
|
457 | + if ($checkout->current_step->is_final_step() && $checkout->exit_spco() === true) { |
|
458 | + wp_safe_redirect($checkout->redirect_url); |
|
459 | 459 | exit(); |
460 | 460 | } |
461 | 461 | } |
462 | - $checkout = apply_filters( 'FHEE__EED_Single_Page_Checkout___initialize_checkout__checkout', $checkout ); |
|
462 | + $checkout = apply_filters('FHEE__EED_Single_Page_Checkout___initialize_checkout__checkout', $checkout); |
|
463 | 463 | // reset anything that needs a clean slate for each request |
464 | 464 | $checkout->reset_for_current_request(); |
465 | 465 | return $checkout; |
@@ -477,24 +477,24 @@ discard block |
||
477 | 477 | // load classes |
478 | 478 | EED_Single_Page_Checkout::load_request_handler(); |
479 | 479 | //make sure this request is marked as belonging to EE |
480 | - EE_Registry::instance()->REQ->set_espresso_page( TRUE ); |
|
480 | + EE_Registry::instance()->REQ->set_espresso_page(TRUE); |
|
481 | 481 | // which step is being requested ? |
482 | - $this->checkout->step = EE_Registry::instance()->REQ->get( 'step', $this->_get_first_step() ); |
|
482 | + $this->checkout->step = EE_Registry::instance()->REQ->get('step', $this->_get_first_step()); |
|
483 | 483 | // which step is being edited ? |
484 | - $this->checkout->edit_step = EE_Registry::instance()->REQ->get( 'edit_step', '' ); |
|
484 | + $this->checkout->edit_step = EE_Registry::instance()->REQ->get('edit_step', ''); |
|
485 | 485 | // and what we're doing on the current step |
486 | - $this->checkout->action = EE_Registry::instance()->REQ->get( 'action', 'display_spco_reg_step' ); |
|
486 | + $this->checkout->action = EE_Registry::instance()->REQ->get('action', 'display_spco_reg_step'); |
|
487 | 487 | // returning to edit ? |
488 | - $this->checkout->reg_url_link = EE_Registry::instance()->REQ->get( 'e_reg_url_link', '' ); |
|
488 | + $this->checkout->reg_url_link = EE_Registry::instance()->REQ->get('e_reg_url_link', ''); |
|
489 | 489 | // or some other kind of revisit ? |
490 | - $this->checkout->revisit = EE_Registry::instance()->REQ->get( 'revisit', FALSE ); |
|
490 | + $this->checkout->revisit = EE_Registry::instance()->REQ->get('revisit', FALSE); |
|
491 | 491 | // and whether or not to generate a reg form for this request |
492 | - $this->checkout->generate_reg_form = EE_Registry::instance()->REQ->get( 'generate_reg_form', TRUE ); // TRUE FALSE |
|
492 | + $this->checkout->generate_reg_form = EE_Registry::instance()->REQ->get('generate_reg_form', TRUE); // TRUE FALSE |
|
493 | 493 | // and whether or not to process a reg form submission for this request |
494 | - $this->checkout->process_form_submission = EE_Registry::instance()->REQ->get( 'process_form_submission', FALSE ); // TRUE FALSE |
|
494 | + $this->checkout->process_form_submission = EE_Registry::instance()->REQ->get('process_form_submission', FALSE); // TRUE FALSE |
|
495 | 495 | $this->checkout->process_form_submission = $this->checkout->action !== 'display_spco_reg_step' |
496 | 496 | ? $this->checkout->process_form_submission |
497 | - : FALSE; // TRUE FALSE |
|
497 | + : FALSE; // TRUE FALSE |
|
498 | 498 | //$this->_display_request_vars(); |
499 | 499 | } |
500 | 500 | |
@@ -507,17 +507,17 @@ discard block |
||
507 | 507 | * @return void |
508 | 508 | */ |
509 | 509 | protected function _display_request_vars() { |
510 | - if ( ! WP_DEBUG ) { |
|
510 | + if ( ! WP_DEBUG) { |
|
511 | 511 | return; |
512 | 512 | } |
513 | - EEH_Debug_Tools::printr( $_REQUEST, '$_REQUEST', __FILE__, __LINE__ ); |
|
514 | - EEH_Debug_Tools::printr( $this->checkout->step, '$this->checkout->step', __FILE__, __LINE__ ); |
|
515 | - EEH_Debug_Tools::printr( $this->checkout->edit_step, '$this->checkout->edit_step', __FILE__, __LINE__ ); |
|
516 | - EEH_Debug_Tools::printr( $this->checkout->action, '$this->checkout->action', __FILE__, __LINE__ ); |
|
517 | - EEH_Debug_Tools::printr( $this->checkout->reg_url_link, '$this->checkout->reg_url_link', __FILE__, __LINE__ ); |
|
518 | - EEH_Debug_Tools::printr( $this->checkout->revisit, '$this->checkout->revisit', __FILE__, __LINE__ ); |
|
519 | - EEH_Debug_Tools::printr( $this->checkout->generate_reg_form, '$this->checkout->generate_reg_form', __FILE__, __LINE__ ); |
|
520 | - EEH_Debug_Tools::printr( $this->checkout->process_form_submission, '$this->checkout->process_form_submission', __FILE__, __LINE__ ); |
|
513 | + EEH_Debug_Tools::printr($_REQUEST, '$_REQUEST', __FILE__, __LINE__); |
|
514 | + EEH_Debug_Tools::printr($this->checkout->step, '$this->checkout->step', __FILE__, __LINE__); |
|
515 | + EEH_Debug_Tools::printr($this->checkout->edit_step, '$this->checkout->edit_step', __FILE__, __LINE__); |
|
516 | + EEH_Debug_Tools::printr($this->checkout->action, '$this->checkout->action', __FILE__, __LINE__); |
|
517 | + EEH_Debug_Tools::printr($this->checkout->reg_url_link, '$this->checkout->reg_url_link', __FILE__, __LINE__); |
|
518 | + EEH_Debug_Tools::printr($this->checkout->revisit, '$this->checkout->revisit', __FILE__, __LINE__); |
|
519 | + EEH_Debug_Tools::printr($this->checkout->generate_reg_form, '$this->checkout->generate_reg_form', __FILE__, __LINE__); |
|
520 | + EEH_Debug_Tools::printr($this->checkout->process_form_submission, '$this->checkout->process_form_submission', __FILE__, __LINE__); |
|
521 | 521 | } |
522 | 522 | |
523 | 523 | |
@@ -531,8 +531,8 @@ discard block |
||
531 | 531 | * @return array |
532 | 532 | */ |
533 | 533 | private function _get_first_step() { |
534 | - $first_step = reset( EED_Single_Page_Checkout::$_reg_steps_array ); |
|
535 | - return isset( $first_step['slug'] ) ? $first_step['slug'] : 'attendee_information'; |
|
534 | + $first_step = reset(EED_Single_Page_Checkout::$_reg_steps_array); |
|
535 | + return isset($first_step['slug']) ? $first_step['slug'] : 'attendee_information'; |
|
536 | 536 | } |
537 | 537 | |
538 | 538 | |
@@ -548,27 +548,27 @@ discard block |
||
548 | 548 | private function _load_and_instantiate_reg_steps() { |
549 | 549 | // have reg_steps already been instantiated ? |
550 | 550 | if ( |
551 | - empty( $this->checkout->reg_steps ) || |
|
552 | - apply_filters( 'FHEE__Single_Page_Checkout__load_reg_steps__reload_reg_steps', false, $this->checkout ) |
|
551 | + empty($this->checkout->reg_steps) || |
|
552 | + apply_filters('FHEE__Single_Page_Checkout__load_reg_steps__reload_reg_steps', false, $this->checkout) |
|
553 | 553 | ) { |
554 | 554 | // if not, then loop through raw reg steps array |
555 | - foreach ( EED_Single_Page_Checkout::$_reg_steps_array as $order => $reg_step ) { |
|
556 | - if ( ! $this->_load_and_instantiate_reg_step( $reg_step, $order )) { |
|
555 | + foreach (EED_Single_Page_Checkout::$_reg_steps_array as $order => $reg_step) { |
|
556 | + if ( ! $this->_load_and_instantiate_reg_step($reg_step, $order)) { |
|
557 | 557 | return false; |
558 | 558 | } |
559 | 559 | } |
560 | 560 | EE_Registry::instance()->CFG->registration->skip_reg_confirmation = TRUE; |
561 | 561 | EE_Registry::instance()->CFG->registration->reg_confirmation_last = TRUE; |
562 | 562 | // skip the registration_confirmation page ? |
563 | - if ( EE_Registry::instance()->CFG->registration->skip_reg_confirmation ) { |
|
563 | + if (EE_Registry::instance()->CFG->registration->skip_reg_confirmation) { |
|
564 | 564 | // just remove it from the reg steps array |
565 | - $this->checkout->remove_reg_step( 'registration_confirmation', false ); |
|
565 | + $this->checkout->remove_reg_step('registration_confirmation', false); |
|
566 | 566 | } else if ( |
567 | 567 | EE_Registry::instance()->CFG->registration->reg_confirmation_last |
568 | - && isset( $this->checkout->reg_steps['registration_confirmation'] ) |
|
568 | + && isset($this->checkout->reg_steps['registration_confirmation']) |
|
569 | 569 | ) { |
570 | 570 | // set the order to something big like 100 |
571 | - $this->checkout->set_reg_step_order( 'registration_confirmation', 100 ); |
|
571 | + $this->checkout->set_reg_step_order('registration_confirmation', 100); |
|
572 | 572 | } |
573 | 573 | // filter the array for good luck |
574 | 574 | $this->checkout->reg_steps = apply_filters( |
@@ -578,13 +578,13 @@ discard block |
||
578 | 578 | // finally re-sort based on the reg step class order properties |
579 | 579 | $this->checkout->sort_reg_steps(); |
580 | 580 | } else { |
581 | - foreach ( $this->checkout->reg_steps as $reg_step ) { |
|
581 | + foreach ($this->checkout->reg_steps as $reg_step) { |
|
582 | 582 | // set all current step stati to FALSE |
583 | - $reg_step->set_is_current_step( FALSE ); |
|
583 | + $reg_step->set_is_current_step(FALSE); |
|
584 | 584 | } |
585 | 585 | } |
586 | - if ( empty( $this->checkout->reg_steps )) { |
|
587 | - EE_Error::add_error( __( 'No Reg Steps were loaded..', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__); |
|
586 | + if (empty($this->checkout->reg_steps)) { |
|
587 | + EE_Error::add_error(__('No Reg Steps were loaded..', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
588 | 588 | return false; |
589 | 589 | } |
590 | 590 | // make reg step details available to JS |
@@ -602,10 +602,10 @@ discard block |
||
602 | 602 | * @param int $order |
603 | 603 | * @return bool |
604 | 604 | */ |
605 | - private function _load_and_instantiate_reg_step( $reg_step = array(), $order = 0 ) { |
|
605 | + private function _load_and_instantiate_reg_step($reg_step = array(), $order = 0) { |
|
606 | 606 | |
607 | 607 | // we need a file_path, class_name, and slug to add a reg step |
608 | - if ( isset( $reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'] )) { |
|
608 | + if (isset($reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'])) { |
|
609 | 609 | // if editing a specific step, but this is NOT that step... (and it's not the 'finalize_registration' step) |
610 | 610 | if ( |
611 | 611 | $this->checkout->reg_url_link |
@@ -623,26 +623,26 @@ discard block |
||
623 | 623 | FALSE |
624 | 624 | ); |
625 | 625 | // did we gets the goods ? |
626 | - if ( $reg_step_obj instanceof EE_SPCO_Reg_Step ) { |
|
626 | + if ($reg_step_obj instanceof EE_SPCO_Reg_Step) { |
|
627 | 627 | // set reg step order based on config |
628 | - $reg_step_obj->set_order( $order ); |
|
628 | + $reg_step_obj->set_order($order); |
|
629 | 629 | // add instantiated reg step object to the master reg steps array |
630 | - $this->checkout->add_reg_step( $reg_step_obj ); |
|
630 | + $this->checkout->add_reg_step($reg_step_obj); |
|
631 | 631 | } else { |
632 | 632 | EE_Error::add_error( |
633 | - __( 'The current step could not be set.', 'event_espresso' ), |
|
633 | + __('The current step could not be set.', 'event_espresso'), |
|
634 | 634 | __FILE__, __FUNCTION__, __LINE__ |
635 | 635 | ); |
636 | 636 | return false; |
637 | 637 | } |
638 | 638 | } else { |
639 | - if ( WP_DEBUG ) { |
|
639 | + if (WP_DEBUG) { |
|
640 | 640 | EE_Error::add_error( |
641 | 641 | sprintf( |
642 | - __( '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' ), |
|
643 | - isset( $reg_step['file_path'] ) ? $reg_step['file_path'] : '', |
|
644 | - isset( $reg_step['class_name'] ) ? $reg_step['class_name'] : '', |
|
645 | - isset( $reg_step['slug'] ) ? $reg_step['slug'] : '', |
|
642 | + __('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'), |
|
643 | + isset($reg_step['file_path']) ? $reg_step['file_path'] : '', |
|
644 | + isset($reg_step['class_name']) ? $reg_step['class_name'] : '', |
|
645 | + isset($reg_step['slug']) ? $reg_step['slug'] : '', |
|
646 | 646 | '<ul>', |
647 | 647 | '<li>', |
648 | 648 | '</li>', |
@@ -666,16 +666,16 @@ discard block |
||
666 | 666 | */ |
667 | 667 | private function _get_transaction_and_cart_for_previous_visit() { |
668 | 668 | /** @var $TXN_model EEM_Transaction */ |
669 | - $TXN_model = EE_Registry::instance()->load_model( 'Transaction' ); |
|
669 | + $TXN_model = EE_Registry::instance()->load_model('Transaction'); |
|
670 | 670 | // 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 |
671 | - $transaction = $TXN_model->get_transaction_from_reg_url_link( $this->checkout->reg_url_link ); |
|
671 | + $transaction = $TXN_model->get_transaction_from_reg_url_link($this->checkout->reg_url_link); |
|
672 | 672 | // verify transaction |
673 | - if ( $transaction instanceof EE_Transaction ) { |
|
673 | + if ($transaction instanceof EE_Transaction) { |
|
674 | 674 | // and get the cart that was used for that transaction |
675 | - $this->checkout->cart = $this->_get_cart_for_transaction( $transaction ); |
|
675 | + $this->checkout->cart = $this->_get_cart_for_transaction($transaction); |
|
676 | 676 | return $transaction; |
677 | 677 | } else { |
678 | - EE_Error::add_error( __( 'Your Registration and Transaction information could not be retrieved from the db.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__); |
|
678 | + EE_Error::add_error(__('Your Registration and Transaction information could not be retrieved from the db.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
679 | 679 | return NULL; |
680 | 680 | } |
681 | 681 | } |
@@ -689,11 +689,11 @@ discard block |
||
689 | 689 | * @param EE_Transaction $transaction |
690 | 690 | * @return EE_Cart |
691 | 691 | */ |
692 | - private function _get_cart_for_transaction( $transaction ) { |
|
693 | - $cart = $transaction instanceof EE_Transaction ? EE_Cart::get_cart_from_txn( $transaction ) : NULL; |
|
692 | + private function _get_cart_for_transaction($transaction) { |
|
693 | + $cart = $transaction instanceof EE_Transaction ? EE_Cart::get_cart_from_txn($transaction) : NULL; |
|
694 | 694 | // verify cart |
695 | - if ( ! $cart instanceof EE_Cart ) { |
|
696 | - $cart = EE_Registry::instance()->load_core( 'Cart' ); |
|
695 | + if ( ! $cart instanceof EE_Cart) { |
|
696 | + $cart = EE_Registry::instance()->load_core('Cart'); |
|
697 | 697 | } |
698 | 698 | return $cart; |
699 | 699 | } |
@@ -708,8 +708,8 @@ discard block |
||
708 | 708 | * @param EE_Transaction $transaction |
709 | 709 | * @return EE_Cart |
710 | 710 | */ |
711 | - public function get_cart_for_transaction( EE_Transaction $transaction ) { |
|
712 | - return EE_Cart::get_cart_from_txn( $transaction ); |
|
711 | + public function get_cart_for_transaction(EE_Transaction $transaction) { |
|
712 | + return EE_Cart::get_cart_from_txn($transaction); |
|
713 | 713 | } |
714 | 714 | |
715 | 715 | |
@@ -724,17 +724,17 @@ discard block |
||
724 | 724 | private function _get_cart_for_current_session_and_setup_new_transaction() { |
725 | 725 | // if there's no transaction, then this is the FIRST visit to SPCO |
726 | 726 | // so load up the cart ( passing nothing for the TXN because it doesn't exist yet ) |
727 | - $this->checkout->cart = $this->_get_cart_for_transaction( NULL ); |
|
727 | + $this->checkout->cart = $this->_get_cart_for_transaction(NULL); |
|
728 | 728 | // and then create a new transaction |
729 | 729 | $transaction = $this->_initialize_transaction(); |
730 | 730 | // verify transaction |
731 | - if ( $transaction instanceof EE_Transaction ) { |
|
731 | + if ($transaction instanceof EE_Transaction) { |
|
732 | 732 | // save it so that we have an ID for other objects to use |
733 | 733 | $transaction->save(); |
734 | 734 | // and save TXN data to the cart |
735 | - $this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn( $transaction->ID() ); |
|
735 | + $this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn($transaction->ID()); |
|
736 | 736 | } else { |
737 | - EE_Error::add_error( __( 'A Valid Transaction could not be initialized.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
737 | + EE_Error::add_error(__('A Valid Transaction could not be initialized.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
738 | 738 | } |
739 | 739 | return $transaction; |
740 | 740 | } |
@@ -754,15 +754,15 @@ discard block |
||
754 | 754 | // grab the cart grand total |
755 | 755 | $cart_total = $this->checkout->cart->get_cart_grand_total(); |
756 | 756 | // create new TXN |
757 | - return EE_Transaction::new_instance( array( |
|
757 | + return EE_Transaction::new_instance(array( |
|
758 | 758 | 'TXN_timestamp' => time(), |
759 | 759 | 'TXN_reg_steps' => $this->checkout->initialize_txn_reg_steps_array(), |
760 | 760 | 'TXN_total' => $cart_total > 0 ? $cart_total : 0, |
761 | 761 | 'TXN_paid' => 0, |
762 | 762 | 'STS_ID' => EEM_Transaction::failed_status_code, |
763 | 763 | )); |
764 | - } catch( Exception $e ) { |
|
765 | - EE_Error::add_error( $e->getMessage(), __FILE__, __FUNCTION__, __LINE__); |
|
764 | + } catch (Exception $e) { |
|
765 | + EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__); |
|
766 | 766 | } |
767 | 767 | return NULL; |
768 | 768 | } |
@@ -776,34 +776,34 @@ discard block |
||
776 | 776 | * @param EE_Transaction $transaction |
777 | 777 | * @return EE_Cart |
778 | 778 | */ |
779 | - private function _get_registrations( EE_Transaction $transaction ) { |
|
779 | + private function _get_registrations(EE_Transaction $transaction) { |
|
780 | 780 | // first step: grab the registrants { : o |
781 | - $registrations = $transaction->registrations( $this->checkout->reg_cache_where_params, true ); |
|
781 | + $registrations = $transaction->registrations($this->checkout->reg_cache_where_params, true); |
|
782 | 782 | // verify registrations have been set |
783 | - if ( empty( $registrations )) { |
|
783 | + if (empty($registrations)) { |
|
784 | 784 | // if no cached registrations, then check the db |
785 | - $registrations = $transaction->registrations( $this->checkout->reg_cache_where_params, false ); |
|
785 | + $registrations = $transaction->registrations($this->checkout->reg_cache_where_params, false); |
|
786 | 786 | // still nothing ? well as long as this isn't a revisit |
787 | - if ( empty( $registrations ) && ! $this->checkout->revisit ) { |
|
787 | + if (empty($registrations) && ! $this->checkout->revisit) { |
|
788 | 788 | // generate new registrations from scratch |
789 | - $registrations = $this->_initialize_registrations( $transaction ); |
|
789 | + $registrations = $this->_initialize_registrations($transaction); |
|
790 | 790 | } |
791 | 791 | } |
792 | 792 | // sort by their original registration order |
793 | - usort( $registrations, array( 'EED_Single_Page_Checkout', 'sort_registrations_by_REG_count' )); |
|
793 | + usort($registrations, array('EED_Single_Page_Checkout', 'sort_registrations_by_REG_count')); |
|
794 | 794 | // then loop thru the array |
795 | - foreach ( $registrations as $registration ) { |
|
795 | + foreach ($registrations as $registration) { |
|
796 | 796 | // verify each registration |
797 | - if ( $registration instanceof EE_Registration ) { |
|
797 | + if ($registration instanceof EE_Registration) { |
|
798 | 798 | // we display all attendee info for the primary registrant |
799 | - if ( $this->checkout->reg_url_link == $registration->reg_url_link() && $registration->is_primary_registrant() ) { |
|
799 | + if ($this->checkout->reg_url_link == $registration->reg_url_link() && $registration->is_primary_registrant()) { |
|
800 | 800 | $this->checkout->primary_revisit = TRUE; |
801 | 801 | break; |
802 | - } else if ( $this->checkout->revisit && $this->checkout->reg_url_link != $registration->reg_url_link() ) { |
|
802 | + } else if ($this->checkout->revisit && $this->checkout->reg_url_link != $registration->reg_url_link()) { |
|
803 | 803 | // but hide info if it doesn't belong to you |
804 | - $transaction->clear_cache( 'Registration', $registration->ID() ); |
|
804 | + $transaction->clear_cache('Registration', $registration->ID()); |
|
805 | 805 | } |
806 | - $this->checkout->set_reg_status_updated( $registration->ID(), false ); |
|
806 | + $this->checkout->set_reg_status_updated($registration->ID(), false); |
|
807 | 807 | } |
808 | 808 | } |
809 | 809 | } |
@@ -817,17 +817,17 @@ discard block |
||
817 | 817 | * @param EE_Transaction $transaction |
818 | 818 | * @return array |
819 | 819 | */ |
820 | - private function _initialize_registrations( EE_Transaction $transaction ) { |
|
820 | + private function _initialize_registrations(EE_Transaction $transaction) { |
|
821 | 821 | $att_nmbr = 0; |
822 | 822 | $registrations = array(); |
823 | - if ( $transaction instanceof EE_Transaction ) { |
|
823 | + if ($transaction instanceof EE_Transaction) { |
|
824 | 824 | /** @type EE_Registration_Processor $registration_processor */ |
825 | - $registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' ); |
|
825 | + $registration_processor = EE_Registry::instance()->load_class('Registration_Processor'); |
|
826 | 826 | $this->checkout->total_ticket_count = $this->checkout->cart->all_ticket_quantity_count(); |
827 | 827 | // now let's add the cart items to the $transaction |
828 | - foreach ( $this->checkout->cart->get_tickets() as $line_item ) { |
|
828 | + foreach ($this->checkout->cart->get_tickets() as $line_item) { |
|
829 | 829 | //do the following for each ticket of this type they selected |
830 | - for ( $x = 1; $x <= $line_item->quantity(); $x++ ) { |
|
830 | + for ($x = 1; $x <= $line_item->quantity(); $x++) { |
|
831 | 831 | $att_nmbr++; |
832 | 832 | $registration = $registration_processor->generate_ONE_registration_from_line_item( |
833 | 833 | $line_item, |
@@ -835,12 +835,12 @@ discard block |
||
835 | 835 | $att_nmbr, |
836 | 836 | $this->checkout->total_ticket_count |
837 | 837 | ); |
838 | - if ( $registration instanceof EE_Registration ) { |
|
839 | - $registrations[ $registration->ID() ] = $registration; |
|
838 | + if ($registration instanceof EE_Registration) { |
|
839 | + $registrations[$registration->ID()] = $registration; |
|
840 | 840 | } |
841 | 841 | } |
842 | 842 | } |
843 | - $registration_processor->fix_reg_final_price_rounding_issue( $transaction ); |
|
843 | + $registration_processor->fix_reg_final_price_rounding_issue($transaction); |
|
844 | 844 | } |
845 | 845 | return $registrations; |
846 | 846 | } |
@@ -855,12 +855,12 @@ discard block |
||
855 | 855 | * @param EE_Registration $reg_B |
856 | 856 | * @return array() |
857 | 857 | */ |
858 | - public static function sort_registrations_by_REG_count( EE_Registration $reg_A, EE_Registration $reg_B ) { |
|
858 | + public static function sort_registrations_by_REG_count(EE_Registration $reg_A, EE_Registration $reg_B) { |
|
859 | 859 | // this shouldn't ever happen within the same TXN, but oh well |
860 | - if ( $reg_A->count() == $reg_B->count() ) { |
|
860 | + if ($reg_A->count() == $reg_B->count()) { |
|
861 | 861 | return 0; |
862 | 862 | } |
863 | - return ( $reg_A->count() > $reg_B->count() ) ? 1 : -1; |
|
863 | + return ($reg_A->count() > $reg_B->count()) ? 1 : -1; |
|
864 | 864 | } |
865 | 865 | |
866 | 866 | |
@@ -875,35 +875,35 @@ discard block |
||
875 | 875 | */ |
876 | 876 | private function _final_verifications() { |
877 | 877 | // filter checkout |
878 | - $this->checkout = apply_filters( 'FHEE__EED_Single_Page_Checkout___final_verifications__checkout', $this->checkout ); |
|
878 | + $this->checkout = apply_filters('FHEE__EED_Single_Page_Checkout___final_verifications__checkout', $this->checkout); |
|
879 | 879 | //verify that current step is still set correctly |
880 | - if ( ! $this->checkout->current_step instanceof EE_SPCO_Reg_Step ) { |
|
881 | - 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__ ); |
|
880 | + if ( ! $this->checkout->current_step instanceof EE_SPCO_Reg_Step) { |
|
881 | + 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__); |
|
882 | 882 | return false; |
883 | 883 | } |
884 | 884 | // if returning to SPCO, then verify that primary registrant is set |
885 | - if ( ! empty( $this->checkout->reg_url_link )) { |
|
885 | + if ( ! empty($this->checkout->reg_url_link)) { |
|
886 | 886 | $valid_registrant = $this->checkout->transaction->primary_registration(); |
887 | - if ( ! $valid_registrant instanceof EE_Registration ) { |
|
888 | - 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__ ); |
|
887 | + if ( ! $valid_registrant instanceof EE_Registration) { |
|
888 | + 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__); |
|
889 | 889 | return false; |
890 | 890 | } |
891 | 891 | $valid_registrant = null; |
892 | - foreach ( $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params ) as $registration ) { |
|
893 | - if ( $registration instanceof EE_Registration ) { |
|
894 | - if ( $registration->reg_url_link() == $this->checkout->reg_url_link ) { |
|
892 | + foreach ($this->checkout->transaction->registrations($this->checkout->reg_cache_where_params) as $registration) { |
|
893 | + if ($registration instanceof EE_Registration) { |
|
894 | + if ($registration->reg_url_link() == $this->checkout->reg_url_link) { |
|
895 | 895 | $valid_registrant = $registration; |
896 | 896 | } |
897 | 897 | } |
898 | 898 | } |
899 | - if ( ! $valid_registrant instanceof EE_Registration ) { |
|
900 | - 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__ ); |
|
899 | + if ( ! $valid_registrant instanceof EE_Registration) { |
|
900 | + 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__); |
|
901 | 901 | return false; |
902 | 902 | } |
903 | 903 | } |
904 | 904 | // now that things have been kinda sufficiently verified, |
905 | 905 | // let's add the checkout to the session so that's available other systems |
906 | - EE_Registry::instance()->SSN->set_checkout( $this->checkout ); |
|
906 | + EE_Registry::instance()->SSN->set_checkout($this->checkout); |
|
907 | 907 | return true; |
908 | 908 | } |
909 | 909 | |
@@ -919,28 +919,28 @@ discard block |
||
919 | 919 | * @access private |
920 | 920 | * @param bool $reinitializing |
921 | 921 | */ |
922 | - private function _initialize_reg_steps( $reinitializing = false ) { |
|
923 | - $this->checkout->set_reg_step_initiated( $this->checkout->current_step ); |
|
922 | + private function _initialize_reg_steps($reinitializing = false) { |
|
923 | + $this->checkout->set_reg_step_initiated($this->checkout->current_step); |
|
924 | 924 | // loop thru all steps to call their individual "initialize" methods and set i18n strings for JS |
925 | - foreach ( $this->checkout->reg_steps as $reg_step ) { |
|
926 | - if ( ! $reg_step->initialize_reg_step() ) { |
|
925 | + foreach ($this->checkout->reg_steps as $reg_step) { |
|
926 | + if ( ! $reg_step->initialize_reg_step()) { |
|
927 | 927 | // if not initialized then maybe this step is being removed... |
928 | - if ( $reg_step->is_current_step() && ! $reinitializing ) { |
|
928 | + if ($reg_step->is_current_step() && ! $reinitializing) { |
|
929 | 929 | // if it was the current step, then we need to start over here |
930 | - $this->_initialize_reg_steps( true ); |
|
930 | + $this->_initialize_reg_steps(true); |
|
931 | 931 | return; |
932 | 932 | } |
933 | 933 | continue; |
934 | 934 | } |
935 | 935 | // i18n |
936 | 936 | $reg_step->translate_js_strings(); |
937 | - if ( $reg_step->is_current_step() ) { |
|
937 | + if ($reg_step->is_current_step()) { |
|
938 | 938 | // the text that appears on the reg step form submit button |
939 | 939 | $reg_step->set_submit_button_text(); |
940 | 940 | } |
941 | 941 | } |
942 | 942 | // dynamically creates hook point like: AHEE__Single_Page_Checkout___initialize_reg_step__attendee_information |
943 | - do_action( "AHEE__Single_Page_Checkout___initialize_reg_step__{$this->checkout->current_step->slug()}", $this->checkout->current_step ); |
|
943 | + do_action("AHEE__Single_Page_Checkout___initialize_reg_step__{$this->checkout->current_step->slug()}", $this->checkout->current_step); |
|
944 | 944 | } |
945 | 945 | |
946 | 946 | |
@@ -953,39 +953,39 @@ discard block |
||
953 | 953 | */ |
954 | 954 | private function _check_form_submission() { |
955 | 955 | //does this request require the reg form to be generated ? |
956 | - if ( $this->checkout->generate_reg_form ) { |
|
956 | + if ($this->checkout->generate_reg_form) { |
|
957 | 957 | // ever heard that song by Blue Rodeo ? |
958 | 958 | try { |
959 | 959 | $this->checkout->current_step->reg_form = $this->checkout->current_step->generate_reg_form(); |
960 | 960 | // if not displaying a form, then check for form submission |
961 | - if ( $this->checkout->process_form_submission && $this->checkout->current_step->reg_form->was_submitted() ) { |
|
961 | + if ($this->checkout->process_form_submission && $this->checkout->current_step->reg_form->was_submitted()) { |
|
962 | 962 | // clear out any old data in case this step is being run again |
963 | - $this->checkout->current_step->set_valid_data( array() ); |
|
963 | + $this->checkout->current_step->set_valid_data(array()); |
|
964 | 964 | // capture submitted form data |
965 | 965 | $this->checkout->current_step->reg_form->receive_form_submission( |
966 | - apply_filters( 'FHEE__Single_Page_Checkout___check_form_submission__request_params', EE_Registry::instance()->REQ->params(), $this->checkout ) |
|
966 | + apply_filters('FHEE__Single_Page_Checkout___check_form_submission__request_params', EE_Registry::instance()->REQ->params(), $this->checkout) |
|
967 | 967 | ); |
968 | 968 | // validate submitted form data |
969 | - if ( ! $this->checkout->current_step->reg_form->is_valid() || ! $this->checkout->continue_reg ) { |
|
969 | + if ( ! $this->checkout->current_step->reg_form->is_valid() || ! $this->checkout->continue_reg) { |
|
970 | 970 | // thou shall not pass !!! |
971 | 971 | $this->checkout->continue_reg = FALSE; |
972 | 972 | // any form validation errors? |
973 | - if ( $this->checkout->current_step->reg_form->submission_error_message() != '' ) { |
|
973 | + if ($this->checkout->current_step->reg_form->submission_error_message() != '') { |
|
974 | 974 | $submission_error_messages = array(); |
975 | 975 | // bad, bad, bad registrant |
976 | - foreach( $this->checkout->current_step->reg_form->get_validation_errors_accumulated() as $validation_error ){ |
|
977 | - if ( $validation_error instanceof EE_Validation_Error ) { |
|
978 | - $submission_error_messages[] = sprintf( __( '%s : %s', 'event_espresso' ), $validation_error->get_form_section()->html_label_text(), $validation_error->getMessage() ); |
|
976 | + foreach ($this->checkout->current_step->reg_form->get_validation_errors_accumulated() as $validation_error) { |
|
977 | + if ($validation_error instanceof EE_Validation_Error) { |
|
978 | + $submission_error_messages[] = sprintf(__('%s : %s', 'event_espresso'), $validation_error->get_form_section()->html_label_text(), $validation_error->getMessage()); |
|
979 | 979 | } |
980 | 980 | } |
981 | - EE_Error::add_error( join( '<br />', $submission_error_messages ), __FILE__, __FUNCTION__, __LINE__ ); |
|
981 | + EE_Error::add_error(join('<br />', $submission_error_messages), __FILE__, __FUNCTION__, __LINE__); |
|
982 | 982 | } |
983 | 983 | // well not really... what will happen is we'll just get redirected back to redo the current step |
984 | 984 | $this->go_to_next_step(); |
985 | 985 | return; |
986 | 986 | } |
987 | 987 | } |
988 | - } catch( EE_Error $e ) { |
|
988 | + } catch (EE_Error $e) { |
|
989 | 989 | $e->get_error(); |
990 | 990 | } |
991 | 991 | } |
@@ -1001,38 +1001,38 @@ discard block |
||
1001 | 1001 | */ |
1002 | 1002 | private function _process_form_action() { |
1003 | 1003 | // what cha wanna do? |
1004 | - switch( $this->checkout->action ) { |
|
1004 | + switch ($this->checkout->action) { |
|
1005 | 1005 | // AJAX next step reg form |
1006 | 1006 | case 'display_spco_reg_step' : |
1007 | 1007 | $this->checkout->redirect = FALSE; |
1008 | - if ( EE_Registry::instance()->REQ->ajax ) { |
|
1009 | - $this->checkout->json_response->set_reg_step_html( $this->checkout->current_step->display_reg_form() ); |
|
1008 | + if (EE_Registry::instance()->REQ->ajax) { |
|
1009 | + $this->checkout->json_response->set_reg_step_html($this->checkout->current_step->display_reg_form()); |
|
1010 | 1010 | } |
1011 | 1011 | break; |
1012 | 1012 | |
1013 | 1013 | default : |
1014 | 1014 | // meh... do one of those other steps first |
1015 | - if ( ! empty( $this->checkout->action ) && is_callable( array( $this->checkout->current_step, $this->checkout->action ))) { |
|
1015 | + if ( ! empty($this->checkout->action) && is_callable(array($this->checkout->current_step, $this->checkout->action))) { |
|
1016 | 1016 | // dynamically creates hook point like: AHEE__Single_Page_Checkout__before_attendee_information__process_reg_step |
1017 | - do_action( "AHEE__Single_Page_Checkout__before_{$this->checkout->current_step->slug()}__{$this->checkout->action}", $this->checkout->current_step ); |
|
1017 | + do_action("AHEE__Single_Page_Checkout__before_{$this->checkout->current_step->slug()}__{$this->checkout->action}", $this->checkout->current_step); |
|
1018 | 1018 | // call action on current step |
1019 | - if ( call_user_func( array( $this->checkout->current_step, $this->checkout->action )) ) { |
|
1019 | + if (call_user_func(array($this->checkout->current_step, $this->checkout->action))) { |
|
1020 | 1020 | // good registrant, you get to proceed |
1021 | - if ( $this->checkout->current_step->success_message() != '' ) { |
|
1022 | - if ( apply_filters( 'FHEE__Single_Page_Checkout___process_form_action__display_success', false ) ) { |
|
1023 | - EE_Error::add_success( $this->checkout->current_step->success_message() . '<br />' . $this->checkout->next_step->_instructions() ); |
|
1021 | + if ($this->checkout->current_step->success_message() != '') { |
|
1022 | + if (apply_filters('FHEE__Single_Page_Checkout___process_form_action__display_success', false)) { |
|
1023 | + EE_Error::add_success($this->checkout->current_step->success_message().'<br />'.$this->checkout->next_step->_instructions()); |
|
1024 | 1024 | } |
1025 | 1025 | } |
1026 | 1026 | // pack it up, pack it in... |
1027 | 1027 | $this->_setup_redirect(); |
1028 | 1028 | } |
1029 | 1029 | // dynamically creates hook point like: AHEE__Single_Page_Checkout__after_payment_options__process_reg_step |
1030 | - do_action( "AHEE__Single_Page_Checkout__after_{$this->checkout->current_step->slug()}__{$this->checkout->action}", $this->checkout->current_step ); |
|
1030 | + do_action("AHEE__Single_Page_Checkout__after_{$this->checkout->current_step->slug()}__{$this->checkout->action}", $this->checkout->current_step); |
|
1031 | 1031 | |
1032 | 1032 | } else { |
1033 | 1033 | EE_Error::add_error( |
1034 | 1034 | sprintf( |
1035 | - __( 'The requested form action "%s" does not exist for the current "%s" registration step.', 'event_espresso' ), |
|
1035 | + __('The requested form action "%s" does not exist for the current "%s" registration step.', 'event_espresso'), |
|
1036 | 1036 | $this->checkout->action, |
1037 | 1037 | $this->checkout->current_step->name() |
1038 | 1038 | ), |
@@ -1058,10 +1058,10 @@ discard block |
||
1058 | 1058 | public function add_styles_and_scripts() { |
1059 | 1059 | // i18n |
1060 | 1060 | $this->translate_js_strings(); |
1061 | - if ( $this->checkout->admin_request ) { |
|
1062 | - add_action('admin_enqueue_scripts', array($this, 'enqueue_styles_and_scripts'), 10 ); |
|
1061 | + if ($this->checkout->admin_request) { |
|
1062 | + add_action('admin_enqueue_scripts', array($this, 'enqueue_styles_and_scripts'), 10); |
|
1063 | 1063 | } else { |
1064 | - add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_styles_and_scripts' ), 10 ); |
|
1064 | + add_action('wp_enqueue_scripts', array($this, 'enqueue_styles_and_scripts'), 10); |
|
1065 | 1065 | } |
1066 | 1066 | } |
1067 | 1067 | |
@@ -1077,42 +1077,42 @@ discard block |
||
1077 | 1077 | EE_Registry::$i18n_js_strings['revisit'] = $this->checkout->revisit; |
1078 | 1078 | EE_Registry::$i18n_js_strings['e_reg_url_link'] = $this->checkout->reg_url_link; |
1079 | 1079 | 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'); |
1080 | - 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' ); |
|
1081 | - 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' ); |
|
1082 | - 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' ); |
|
1080 | + 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'); |
|
1081 | + 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'); |
|
1082 | + 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'); |
|
1083 | 1083 | EE_Registry::$i18n_js_strings['reg_step_error'] = __('This registration step could not be completed. Please refresh the page and try again.', 'event_espresso'); |
1084 | 1084 | 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'); |
1085 | - 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/>' ); |
|
1086 | - EE_Registry::$i18n_js_strings['language'] = get_bloginfo( 'language' ); |
|
1085 | + 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/>'); |
|
1086 | + EE_Registry::$i18n_js_strings['language'] = get_bloginfo('language'); |
|
1087 | 1087 | EE_Registry::$i18n_js_strings['EESID'] = EE_Registry::instance()->SSN->id(); |
1088 | 1088 | EE_Registry::$i18n_js_strings['currency'] = EE_Registry::instance()->CFG->currency; |
1089 | 1089 | EE_Registry::$i18n_js_strings['datepicker_yearRange'] = '-150:+20'; |
1090 | - EE_Registry::$i18n_js_strings['timer_years'] = __( 'years', 'event_espresso' ); |
|
1091 | - EE_Registry::$i18n_js_strings['timer_months'] = __( 'months', 'event_espresso' ); |
|
1092 | - EE_Registry::$i18n_js_strings['timer_weeks'] = __( 'weeks', 'event_espresso' ); |
|
1093 | - EE_Registry::$i18n_js_strings['timer_days'] = __( 'days', 'event_espresso' ); |
|
1094 | - EE_Registry::$i18n_js_strings['timer_hours'] = __( 'hours', 'event_espresso' ); |
|
1095 | - EE_Registry::$i18n_js_strings['timer_minutes'] = __( 'minutes', 'event_espresso' ); |
|
1096 | - EE_Registry::$i18n_js_strings['timer_seconds'] = __( 'seconds', 'event_espresso' ); |
|
1097 | - EE_Registry::$i18n_js_strings['timer_year'] = __( 'year', 'event_espresso' ); |
|
1098 | - EE_Registry::$i18n_js_strings['timer_month'] = __( 'month', 'event_espresso' ); |
|
1099 | - EE_Registry::$i18n_js_strings['timer_week'] = __( 'week', 'event_espresso' ); |
|
1100 | - EE_Registry::$i18n_js_strings['timer_day'] = __( 'day', 'event_espresso' ); |
|
1101 | - EE_Registry::$i18n_js_strings['timer_hour'] = __( 'hour', 'event_espresso' ); |
|
1102 | - EE_Registry::$i18n_js_strings['timer_minute'] = __( 'minute', 'event_espresso' ); |
|
1103 | - EE_Registry::$i18n_js_strings['timer_second'] = __( 'second', 'event_espresso' ); |
|
1090 | + EE_Registry::$i18n_js_strings['timer_years'] = __('years', 'event_espresso'); |
|
1091 | + EE_Registry::$i18n_js_strings['timer_months'] = __('months', 'event_espresso'); |
|
1092 | + EE_Registry::$i18n_js_strings['timer_weeks'] = __('weeks', 'event_espresso'); |
|
1093 | + EE_Registry::$i18n_js_strings['timer_days'] = __('days', 'event_espresso'); |
|
1094 | + EE_Registry::$i18n_js_strings['timer_hours'] = __('hours', 'event_espresso'); |
|
1095 | + EE_Registry::$i18n_js_strings['timer_minutes'] = __('minutes', 'event_espresso'); |
|
1096 | + EE_Registry::$i18n_js_strings['timer_seconds'] = __('seconds', 'event_espresso'); |
|
1097 | + EE_Registry::$i18n_js_strings['timer_year'] = __('year', 'event_espresso'); |
|
1098 | + EE_Registry::$i18n_js_strings['timer_month'] = __('month', 'event_espresso'); |
|
1099 | + EE_Registry::$i18n_js_strings['timer_week'] = __('week', 'event_espresso'); |
|
1100 | + EE_Registry::$i18n_js_strings['timer_day'] = __('day', 'event_espresso'); |
|
1101 | + EE_Registry::$i18n_js_strings['timer_hour'] = __('hour', 'event_espresso'); |
|
1102 | + EE_Registry::$i18n_js_strings['timer_minute'] = __('minute', 'event_espresso'); |
|
1103 | + EE_Registry::$i18n_js_strings['timer_second'] = __('second', 'event_espresso'); |
|
1104 | 1104 | EE_Registry::$i18n_js_strings['registration_expiration_notice'] = sprintf( |
1105 | - __( '%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' ), |
|
1105 | + __('%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'), |
|
1106 | 1106 | '<h4 class="important-notice">', |
1107 | 1107 | '</h4>', |
1108 | 1108 | '<br />', |
1109 | 1109 | '<p>', |
1110 | - '<a href="'. get_post_type_archive_link( 'espresso_events' ) . '" title="', |
|
1110 | + '<a href="'.get_post_type_archive_link('espresso_events').'" title="', |
|
1111 | 1111 | '">', |
1112 | 1112 | '</a>', |
1113 | 1113 | '</p>' |
1114 | 1114 | ); |
1115 | - EE_Registry::$i18n_js_strings[ 'ajax_submit' ] = apply_filters( 'FHEE__Single_Page_Checkout__translate_js_strings__ajax_submit', true ); |
|
1115 | + EE_Registry::$i18n_js_strings['ajax_submit'] = apply_filters('FHEE__Single_Page_Checkout__translate_js_strings__ajax_submit', true); |
|
1116 | 1116 | } |
1117 | 1117 | |
1118 | 1118 | |
@@ -1125,25 +1125,25 @@ discard block |
||
1125 | 1125 | */ |
1126 | 1126 | public function enqueue_styles_and_scripts() { |
1127 | 1127 | // load css |
1128 | - wp_register_style( 'single_page_checkout', SPCO_CSS_URL . 'single_page_checkout.css', array(), EVENT_ESPRESSO_VERSION ); |
|
1129 | - wp_enqueue_style( 'single_page_checkout' ); |
|
1128 | + wp_register_style('single_page_checkout', SPCO_CSS_URL.'single_page_checkout.css', array(), EVENT_ESPRESSO_VERSION); |
|
1129 | + wp_enqueue_style('single_page_checkout'); |
|
1130 | 1130 | // load JS |
1131 | - wp_register_script( 'jquery_plugin', EE_THIRD_PARTY_URL . 'jquery .plugin.min.js', array( 'jquery' ), '1.0.1', TRUE ); |
|
1132 | - wp_register_script( 'jquery_countdown', EE_THIRD_PARTY_URL . 'jquery .countdown.min.js', array( 'jquery_plugin' ), '2.0.2', TRUE ); |
|
1133 | - 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 ); |
|
1134 | - wp_enqueue_script( 'single_page_checkout' ); |
|
1131 | + wp_register_script('jquery_plugin', EE_THIRD_PARTY_URL.'jquery .plugin.min.js', array('jquery'), '1.0.1', TRUE); |
|
1132 | + wp_register_script('jquery_countdown', EE_THIRD_PARTY_URL.'jquery .countdown.min.js', array('jquery_plugin'), '2.0.2', TRUE); |
|
1133 | + 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); |
|
1134 | + wp_enqueue_script('single_page_checkout'); |
|
1135 | 1135 | |
1136 | 1136 | /** |
1137 | 1137 | * global action hook for enqueueing styles and scripts with |
1138 | 1138 | * spco calls. |
1139 | 1139 | */ |
1140 | - do_action( 'AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts', $this ); |
|
1140 | + do_action('AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts', $this); |
|
1141 | 1141 | |
1142 | 1142 | /** |
1143 | 1143 | * dynamic action hook for enqueueing styles and scripts with spco calls. |
1144 | 1144 | * The hook will end up being something like AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts__attendee_information |
1145 | 1145 | */ |
1146 | - do_action( 'AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts__' . $this->checkout->current_step->slug(), $this ); |
|
1146 | + do_action('AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts__'.$this->checkout->current_step->slug(), $this); |
|
1147 | 1147 | |
1148 | 1148 | // add css and JS for current step |
1149 | 1149 | $this->checkout->current_step->enqueue_styles_and_scripts(); |
@@ -1159,20 +1159,20 @@ discard block |
||
1159 | 1159 | */ |
1160 | 1160 | private function _display_spco_reg_form() { |
1161 | 1161 | // if registering via the admin, just display the reg form for the current step |
1162 | - if ( $this->checkout->admin_request ) { |
|
1163 | - EE_Registry::instance()->REQ->add_output( $this->checkout->current_step->display_reg_form() ); |
|
1162 | + if ($this->checkout->admin_request) { |
|
1163 | + EE_Registry::instance()->REQ->add_output($this->checkout->current_step->display_reg_form()); |
|
1164 | 1164 | } else { |
1165 | 1165 | // add powered by EE msg |
1166 | - add_action( 'AHEE__SPCO__reg_form_footer', array( 'EED_Single_Page_Checkout', 'display_registration_footer' )); |
|
1166 | + add_action('AHEE__SPCO__reg_form_footer', array('EED_Single_Page_Checkout', 'display_registration_footer')); |
|
1167 | 1167 | |
1168 | - $empty_cart = count( $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params ) ) < 1 ? true : false; |
|
1168 | + $empty_cart = count($this->checkout->transaction->registrations($this->checkout->reg_cache_where_params)) < 1 ? true : false; |
|
1169 | 1169 | $cookies_not_set_msg = ''; |
1170 | - if ( $empty_cart ) { |
|
1171 | - if ( ! isset( $_COOKIE[ 'ee_cookie_test' ] ) ) { |
|
1170 | + if ($empty_cart) { |
|
1171 | + if ( ! isset($_COOKIE['ee_cookie_test'])) { |
|
1172 | 1172 | $cookies_not_set_msg = apply_filters( |
1173 | 1173 | 'FHEE__Single_Page_Checkout__display_spco_reg_form__cookies_not_set_msg', |
1174 | 1174 | sprintf( |
1175 | - __( '%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' ), |
|
1175 | + __('%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'), |
|
1176 | 1176 | '<div class="ee-attention">', |
1177 | 1177 | '</div>', |
1178 | 1178 | '<h6 class="important-notice">', |
@@ -1193,7 +1193,7 @@ discard block |
||
1193 | 1193 | 'layout_strategy' => |
1194 | 1194 | new EE_Template_Layout( |
1195 | 1195 | array( |
1196 | - 'layout_template_file' => SPCO_TEMPLATES_PATH . 'registration_page_wrapper.template.php', |
|
1196 | + 'layout_template_file' => SPCO_TEMPLATES_PATH.'registration_page_wrapper.template.php', |
|
1197 | 1197 | 'template_args' => array( |
1198 | 1198 | 'empty_cart' => $empty_cart, |
1199 | 1199 | 'revisit' => $this->checkout->revisit, |
@@ -1202,8 +1202,8 @@ discard block |
||
1202 | 1202 | 'empty_msg' => apply_filters( |
1203 | 1203 | 'FHEE__Single_Page_Checkout__display_spco_reg_form__empty_msg', |
1204 | 1204 | sprintf( |
1205 | - __( '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' ), |
|
1206 | - '<a href="' . get_post_type_archive_link( 'espresso_events' ) . '" title="', |
|
1205 | + __('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'), |
|
1206 | + '<a href="'.get_post_type_archive_link('espresso_events').'" title="', |
|
1207 | 1207 | '">', |
1208 | 1208 | '</a>' |
1209 | 1209 | ) |
@@ -1211,14 +1211,14 @@ discard block |
||
1211 | 1211 | 'cookies_not_set_msg' => $cookies_not_set_msg, |
1212 | 1212 | 'registration_time_limit' => $this->checkout->get_registration_time_limit(), |
1213 | 1213 | 'session_expiration' => |
1214 | - gmdate( 'M d, Y H:i:s', EE_Registry::instance()->SSN->expiration() + ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS ) ) |
|
1214 | + gmdate('M d, Y H:i:s', EE_Registry::instance()->SSN->expiration() + (get_option('gmt_offset') * HOUR_IN_SECONDS)) |
|
1215 | 1215 | ) |
1216 | 1216 | ) |
1217 | 1217 | ) |
1218 | 1218 | ) |
1219 | 1219 | ); |
1220 | 1220 | // load template and add to output sent that gets filtered into the_content() |
1221 | - EE_Registry::instance()->REQ->add_output( $this->checkout->registration_form->get_html_and_js() ); |
|
1221 | + EE_Registry::instance()->REQ->add_output($this->checkout->registration_form->get_html_and_js()); |
|
1222 | 1222 | } |
1223 | 1223 | } |
1224 | 1224 | |
@@ -1232,8 +1232,8 @@ discard block |
||
1232 | 1232 | * @internal param string $label |
1233 | 1233 | * @return string |
1234 | 1234 | */ |
1235 | - public function add_extra_finalize_registration_inputs( $next_step ) { |
|
1236 | - if ( $next_step == 'finalize_registration' ) { |
|
1235 | + public function add_extra_finalize_registration_inputs($next_step) { |
|
1236 | + if ($next_step == 'finalize_registration') { |
|
1237 | 1237 | echo '<div id="spco-extra-finalize_registration-inputs-dv"></div>'; |
1238 | 1238 | } |
1239 | 1239 | } |
@@ -1247,18 +1247,18 @@ discard block |
||
1247 | 1247 | * @return string |
1248 | 1248 | */ |
1249 | 1249 | public static function display_registration_footer() { |
1250 | - if ( apply_filters( 'FHEE__EE_Front__Controller__show_reg_footer', EE_Registry::instance()->CFG->admin->show_reg_footer ) ) { |
|
1251 | - EE_Registry::instance()->CFG->admin->affiliate_id = ! empty( EE_Registry::instance()->CFG->admin->affiliate_id ) ? EE_Registry::instance()->CFG->admin->affiliate_id : 'default'; |
|
1252 | - $url = add_query_arg( array( 'ap_id' => EE_Registry::instance()->CFG->admin->affiliate_id ), 'https://eventespresso.com/' ); |
|
1253 | - $url = apply_filters( 'FHEE__EE_Front_Controller__registration_footer__url', $url ); |
|
1250 | + if (apply_filters('FHEE__EE_Front__Controller__show_reg_footer', EE_Registry::instance()->CFG->admin->show_reg_footer)) { |
|
1251 | + EE_Registry::instance()->CFG->admin->affiliate_id = ! empty(EE_Registry::instance()->CFG->admin->affiliate_id) ? EE_Registry::instance()->CFG->admin->affiliate_id : 'default'; |
|
1252 | + $url = add_query_arg(array('ap_id' => EE_Registry::instance()->CFG->admin->affiliate_id), 'https://eventespresso.com/'); |
|
1253 | + $url = apply_filters('FHEE__EE_Front_Controller__registration_footer__url', $url); |
|
1254 | 1254 | echo apply_filters( |
1255 | 1255 | 'FHEE__EE_Front_Controller__display_registration_footer', |
1256 | 1256 | sprintf( |
1257 | - __( '%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' ), |
|
1258 | - '<div id="espresso-registration-footer-dv"><a href="' . $url . '" title="', |
|
1257 | + __('%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'), |
|
1258 | + '<div id="espresso-registration-footer-dv"><a href="'.$url.'" title="', |
|
1259 | 1259 | '" target="_blank">', |
1260 | 1260 | '</a>', |
1261 | - '<a href="' . $url . '" title="', |
|
1261 | + '<a href="'.$url.'" title="', |
|
1262 | 1262 | '" target="_blank">', |
1263 | 1263 | '</a></div>' |
1264 | 1264 | ) |
@@ -1289,12 +1289,12 @@ discard block |
||
1289 | 1289 | * @return array |
1290 | 1290 | */ |
1291 | 1291 | private function _setup_redirect() { |
1292 | - if ( $this->checkout->continue_reg && $this->checkout->next_step instanceof EE_SPCO_Reg_Step ) { |
|
1292 | + if ($this->checkout->continue_reg && $this->checkout->next_step instanceof EE_SPCO_Reg_Step) { |
|
1293 | 1293 | $this->checkout->redirect = TRUE; |
1294 | - if ( empty( $this->checkout->redirect_url )) { |
|
1294 | + if (empty($this->checkout->redirect_url)) { |
|
1295 | 1295 | $this->checkout->redirect_url = $this->checkout->next_step->reg_step_url(); |
1296 | 1296 | } |
1297 | - $this->checkout->redirect_url = apply_filters( 'FHEE__EED_Single_Page_Checkout___setup_redirect__checkout_redirect_url', $this->checkout->redirect_url, $this->checkout ); |
|
1297 | + $this->checkout->redirect_url = apply_filters('FHEE__EED_Single_Page_Checkout___setup_redirect__checkout_redirect_url', $this->checkout->redirect_url, $this->checkout); |
|
1298 | 1298 | } |
1299 | 1299 | } |
1300 | 1300 | |
@@ -1307,12 +1307,12 @@ discard block |
||
1307 | 1307 | * @return void |
1308 | 1308 | */ |
1309 | 1309 | public function go_to_next_step() { |
1310 | - if ( EE_Registry::instance()->REQ->ajax ) { |
|
1310 | + if (EE_Registry::instance()->REQ->ajax) { |
|
1311 | 1311 | // capture contents of output buffer we started earlier in the request, and insert into JSON response |
1312 | - $this->checkout->json_response->set_unexpected_errors( ob_get_clean() ); |
|
1312 | + $this->checkout->json_response->set_unexpected_errors(ob_get_clean()); |
|
1313 | 1313 | } |
1314 | 1314 | // just return for these conditions |
1315 | - if ( $this->checkout->admin_request || $this->checkout->action == 'redirect_form' || $this->checkout->action == 'update_checkout' ) { |
|
1315 | + if ($this->checkout->admin_request || $this->checkout->action == 'redirect_form' || $this->checkout->action == 'update_checkout') { |
|
1316 | 1316 | return; |
1317 | 1317 | } |
1318 | 1318 | // AJAX response |
@@ -1333,7 +1333,7 @@ discard block |
||
1333 | 1333 | */ |
1334 | 1334 | protected function _handle_json_response() { |
1335 | 1335 | // if this is an ajax request |
1336 | - if ( EE_Registry::instance()->REQ->ajax ) { |
|
1336 | + if (EE_Registry::instance()->REQ->ajax) { |
|
1337 | 1337 | // DEBUG LOG |
1338 | 1338 | //$this->checkout->log( |
1339 | 1339 | // __CLASS__, __FUNCTION__, __LINE__, |
@@ -1343,10 +1343,10 @@ discard block |
||
1343 | 1343 | // 'continue_reg' => $this->checkout->continue_reg, |
1344 | 1344 | // ) |
1345 | 1345 | //); |
1346 | - $this->checkout->json_response->set_registration_time_limit( $this->checkout->get_registration_time_limit() ); |
|
1347 | - $this->checkout->json_response->set_payment_amount( $this->checkout->amount_owing ); |
|
1346 | + $this->checkout->json_response->set_registration_time_limit($this->checkout->get_registration_time_limit()); |
|
1347 | + $this->checkout->json_response->set_payment_amount($this->checkout->amount_owing); |
|
1348 | 1348 | // just send the ajax ( |
1349 | - $json_response = apply_filters( 'FHEE__EE_Single_Page_Checkout__JSON_response', $this->checkout->json_response ); |
|
1349 | + $json_response = apply_filters('FHEE__EE_Single_Page_Checkout__JSON_response', $this->checkout->json_response); |
|
1350 | 1350 | $this->unlock_transaction(); |
1351 | 1351 | echo $json_response; |
1352 | 1352 | exit(); |
@@ -1363,9 +1363,9 @@ discard block |
||
1363 | 1363 | */ |
1364 | 1364 | protected function _handle_html_redirects() { |
1365 | 1365 | // going somewhere ? |
1366 | - if ( $this->checkout->redirect && ! empty( $this->checkout->redirect_url ) ) { |
|
1366 | + if ($this->checkout->redirect && ! empty($this->checkout->redirect_url)) { |
|
1367 | 1367 | // store notices in a transient |
1368 | - EE_Error::get_notices( false, true, true ); |
|
1368 | + EE_Error::get_notices(false, true, true); |
|
1369 | 1369 | $this->unlock_transaction(); |
1370 | 1370 | // DEBUG LOG |
1371 | 1371 | //$this->checkout->log( |
@@ -1376,7 +1376,7 @@ discard block |
||
1376 | 1376 | // 'headers_list' => headers_list(), |
1377 | 1377 | // ) |
1378 | 1378 | //); |
1379 | - wp_safe_redirect( $this->checkout->redirect_url ); |
|
1379 | + wp_safe_redirect($this->checkout->redirect_url); |
|
1380 | 1380 | exit(); |
1381 | 1381 | } |
1382 | 1382 | } |