@@ -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,31 +198,31 @@ 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 | // 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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 | } |
@@ -28,15 +28,15 @@ discard block |
||
28 | 28 | * @return void |
29 | 29 | */ |
30 | 30 | public static function set_hooks() { |
31 | - add_filter( 'FHEE__SPCO__EE_Line_Item_Filter_Collection', array( 'EE_SPCO_Reg_Step_Payment_Options', 'add_spco_line_item_filters' ) ); |
|
32 | - add_action( 'wp_ajax_switch_spco_billing_form', array( 'EE_SPCO_Reg_Step_Payment_Options', 'switch_spco_billing_form' )); |
|
33 | - add_action( 'wp_ajax_nopriv_switch_spco_billing_form', array( 'EE_SPCO_Reg_Step_Payment_Options', 'switch_spco_billing_form' )); |
|
34 | - add_action( 'wp_ajax_save_payer_details', array( 'EE_SPCO_Reg_Step_Payment_Options', 'save_payer_details' )); |
|
35 | - add_action( 'wp_ajax_nopriv_save_payer_details', array( 'EE_SPCO_Reg_Step_Payment_Options', 'save_payer_details' )); |
|
36 | - add_action( 'wp_ajax_get_transaction_details_for_gateways', array( 'EE_SPCO_Reg_Step_Payment_Options', 'get_transaction_details' ) ); |
|
37 | - add_action( 'wp_ajax_nopriv_get_transaction_details_for_gateways', array( 'EE_SPCO_Reg_Step_Payment_Options', 'get_transaction_details' ) |
|
31 | + add_filter('FHEE__SPCO__EE_Line_Item_Filter_Collection', array('EE_SPCO_Reg_Step_Payment_Options', 'add_spco_line_item_filters')); |
|
32 | + add_action('wp_ajax_switch_spco_billing_form', array('EE_SPCO_Reg_Step_Payment_Options', 'switch_spco_billing_form')); |
|
33 | + add_action('wp_ajax_nopriv_switch_spco_billing_form', array('EE_SPCO_Reg_Step_Payment_Options', 'switch_spco_billing_form')); |
|
34 | + add_action('wp_ajax_save_payer_details', array('EE_SPCO_Reg_Step_Payment_Options', 'save_payer_details')); |
|
35 | + add_action('wp_ajax_nopriv_save_payer_details', array('EE_SPCO_Reg_Step_Payment_Options', 'save_payer_details')); |
|
36 | + add_action('wp_ajax_get_transaction_details_for_gateways', array('EE_SPCO_Reg_Step_Payment_Options', 'get_transaction_details')); |
|
37 | + add_action('wp_ajax_nopriv_get_transaction_details_for_gateways', array('EE_SPCO_Reg_Step_Payment_Options', 'get_transaction_details') |
|
38 | 38 | ); |
39 | - add_filter( 'FHEE__EED_Recaptcha___bypass_recaptcha__bypass_request_params_array', array( 'EE_SPCO_Reg_Step_Payment_Options', 'bypass_recaptcha_for_load_payment_method' ), 10, 1 ); |
|
39 | + add_filter('FHEE__EED_Recaptcha___bypass_recaptcha__bypass_request_params_array', array('EE_SPCO_Reg_Step_Payment_Options', 'bypass_recaptcha_for_load_payment_method'), 10, 1); |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | * ajax switch_spco_billing_form |
46 | 46 | */ |
47 | 47 | public static function switch_spco_billing_form() { |
48 | - EED_Single_Page_Checkout::process_ajax_request( 'switch_payment_method' ); |
|
48 | + EED_Single_Page_Checkout::process_ajax_request('switch_payment_method'); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | * ajax save_payer_details |
55 | 55 | */ |
56 | 56 | public static function save_payer_details() { |
57 | - EED_Single_Page_Checkout::process_ajax_request( 'save_payer_details_via_ajax' ); |
|
57 | + EED_Single_Page_Checkout::process_ajax_request('save_payer_details_via_ajax'); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | * ajax get_transaction_details |
64 | 64 | */ |
65 | 65 | public static function get_transaction_details() { |
66 | - EED_Single_Page_Checkout::process_ajax_request( 'get_transaction_details_for_gateways' ); |
|
66 | + EED_Single_Page_Checkout::process_ajax_request('get_transaction_details_for_gateways'); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | |
@@ -91,13 +91,13 @@ discard block |
||
91 | 91 | * @param EE_Checkout $checkout |
92 | 92 | * @return \EE_SPCO_Reg_Step_Payment_Options |
93 | 93 | */ |
94 | - public function __construct( EE_Checkout $checkout ) { |
|
94 | + public function __construct(EE_Checkout $checkout) { |
|
95 | 95 | $this->_slug = 'payment_options'; |
96 | 96 | $this->_name = __('Payment Options', 'event_espresso'); |
97 | - $this->_template = SPCO_REG_STEPS_PATH . $this->_slug . DS . 'payment_options_main.template.php'; |
|
97 | + $this->_template = SPCO_REG_STEPS_PATH.$this->_slug.DS.'payment_options_main.template.php'; |
|
98 | 98 | $this->checkout = $checkout; |
99 | 99 | $this->_reset_success_message(); |
100 | - $this->set_instructions( __('Please select a method of payment and provide any necessary billing information before proceeding.', 'event_espresso')); |
|
100 | + $this->set_instructions(__('Please select a method of payment and provide any necessary billing information before proceeding.', 'event_espresso')); |
|
101 | 101 | } |
102 | 102 | |
103 | 103 | |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | /** |
115 | 115 | * @param null $line_item_display |
116 | 116 | */ |
117 | - public function set_line_item_display( $line_item_display ) { |
|
117 | + public function set_line_item_display($line_item_display) { |
|
118 | 118 | $this->line_item_display = $line_item_display; |
119 | 119 | } |
120 | 120 | |
@@ -125,9 +125,9 @@ discard block |
||
125 | 125 | * @return void |
126 | 126 | */ |
127 | 127 | public function translate_js_strings() { |
128 | - EE_Registry::$i18n_js_strings['no_payment_method'] = __( 'Please select a method of payment in order to continue.', 'event_espresso' ); |
|
129 | - EE_Registry::$i18n_js_strings['invalid_payment_method'] = __( 'A valid method of payment could not be determined. Please refresh the page and try again.', 'event_espresso' ); |
|
130 | - EE_Registry::$i18n_js_strings['forwarding_to_offsite'] = __( 'Forwarding to Secure Payment Provider.', 'event_espresso' ); |
|
128 | + EE_Registry::$i18n_js_strings['no_payment_method'] = __('Please select a method of payment in order to continue.', 'event_espresso'); |
|
129 | + EE_Registry::$i18n_js_strings['invalid_payment_method'] = __('A valid method of payment could not be determined. Please refresh the page and try again.', 'event_espresso'); |
|
130 | + EE_Registry::$i18n_js_strings['forwarding_to_offsite'] = __('Forwarding to Secure Payment Provider.', 'event_espresso'); |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | |
@@ -156,20 +156,20 @@ discard block |
||
156 | 156 | // $ 0.00 transactions (no payment required) |
157 | 157 | ! $this->checkout->payment_required() |
158 | 158 | // but do NOT remove if current action being called belongs to this reg step |
159 | - && ! is_callable( array( $this, $this->checkout->action ) ) |
|
159 | + && ! is_callable(array($this, $this->checkout->action)) |
|
160 | 160 | && ! $this->completed() |
161 | 161 | ) { |
162 | 162 | // and if so, then we no longer need the Payment Options step |
163 | - if ( $this->is_current_step() ) { |
|
163 | + if ($this->is_current_step()) { |
|
164 | 164 | $this->checkout->generate_reg_form = false; |
165 | 165 | } |
166 | - $this->checkout->remove_reg_step( $this->_slug ); |
|
166 | + $this->checkout->remove_reg_step($this->_slug); |
|
167 | 167 | // DEBUG LOG |
168 | 168 | //$this->checkout->log( __CLASS__, __FUNCTION__, __LINE__ ); |
169 | 169 | return false; |
170 | 170 | } |
171 | 171 | // load EEM_Payment_Method |
172 | - EE_Registry::instance()->load_model( 'Payment_Method' ); |
|
172 | + EE_Registry::instance()->load_model('Payment_Method'); |
|
173 | 173 | // get all active payment methods |
174 | 174 | $this->checkout->available_payment_methods = EEM_Payment_Method::instance()->get_all_for_transaction( |
175 | 175 | $this->checkout->transaction, EEM_Payment_Method::scope_cart |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | * @return bool |
184 | 184 | */ |
185 | 185 | public function generate_reg_form() { |
186 | - EE_Registry::instance()->load_helper( 'HTML' ); |
|
186 | + EE_Registry::instance()->load_helper('HTML'); |
|
187 | 187 | // reset in case someone changes their mind |
188 | 188 | $this->_reset_selected_method_of_payment(); |
189 | 189 | // set some defaults |
@@ -194,16 +194,16 @@ discard block |
||
194 | 194 | $sold_out_events = array(); |
195 | 195 | $reg_count = 0; |
196 | 196 | // loop thru registrations to gather info |
197 | - $registrations = $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params ); |
|
198 | - foreach ( $registrations as $registration ) { |
|
197 | + $registrations = $this->checkout->transaction->registrations($this->checkout->reg_cache_where_params); |
|
198 | + foreach ($registrations as $registration) { |
|
199 | 199 | //echo '<h3 style="color:#E76700;line-height:1em;">' . $registration->ID() . '<br/><span style="font-size:9px;font-weight:normal;color:#666">' . __FILE__ . '</span> <b style="font-size:10px;color:#333"> ' . __LINE__ . ' </b></h3>'; |
200 | 200 | /** @var $registration EE_Registration */ |
201 | 201 | $reg_count++; |
202 | 202 | // if returning registrant is Approved then do NOT do this |
203 | - if ( ! ( $this->checkout->revisit && $registration->status_ID() == EEM_Registration::status_id_approved )) { |
|
204 | - if ( $registration->event()->is_sold_out() || $registration->event()->is_sold_out( true )) { |
|
203 | + if ( ! ($this->checkout->revisit && $registration->status_ID() == EEM_Registration::status_id_approved)) { |
|
204 | + if ($registration->event()->is_sold_out() || $registration->event()->is_sold_out(true)) { |
|
205 | 205 | // add event to list of events that are sold out |
206 | - $sold_out_events[ $registration->event()->ID() ] = $registration->event(); |
|
206 | + $sold_out_events[$registration->event()->ID()] = $registration->event(); |
|
207 | 207 | do_action( |
208 | 208 | 'AHEE__EE_SPCO_Reg_Step_Payment_Options__generate_reg_form__sold_out_event', |
209 | 209 | $registration->event(), |
@@ -211,9 +211,9 @@ discard block |
||
211 | 211 | ); |
212 | 212 | } |
213 | 213 | // event requires admin approval |
214 | - if ( $registration->status_ID() == EEM_Registration::status_id_not_approved ) { |
|
214 | + if ($registration->status_ID() == EEM_Registration::status_id_not_approved) { |
|
215 | 215 | // add event to list of events with pre-approval reg status |
216 | - $registrations_requiring_pre_approval[ $registration->ID() ] = $registration; |
|
216 | + $registrations_requiring_pre_approval[$registration->ID()] = $registration; |
|
217 | 217 | do_action( |
218 | 218 | 'AHEE__EE_SPCO_Reg_Step_Payment_Options__generate_reg_form__event_requires_pre_approval', |
219 | 219 | $registration->event(), |
@@ -222,29 +222,29 @@ discard block |
||
222 | 222 | } |
223 | 223 | } |
224 | 224 | // are they allowed to pay now and is there monies owing? |
225 | - if ( $registration->owes_monies_and_can_pay() ) { |
|
226 | - $registrations_requiring_payment[ $registration->ID() ] = $registration; |
|
225 | + if ($registration->owes_monies_and_can_pay()) { |
|
226 | + $registrations_requiring_payment[$registration->ID()] = $registration; |
|
227 | 227 | do_action( |
228 | 228 | 'AHEE__EE_SPCO_Reg_Step_Payment_Options__generate_reg_form__event_requires_payment', |
229 | 229 | $registration->event(), |
230 | 230 | $this |
231 | 231 | ); |
232 | - } else if ( ! $this->checkout->revisit && $registration->status_ID() != EEM_Registration::status_id_not_approved && $registration->ticket()->is_free() ) { |
|
233 | - $registrations_for_free_events[ $registration->event()->ID() ] = $registration; |
|
232 | + } else if ( ! $this->checkout->revisit && $registration->status_ID() != EEM_Registration::status_id_not_approved && $registration->ticket()->is_free()) { |
|
233 | + $registrations_for_free_events[$registration->event()->ID()] = $registration; |
|
234 | 234 | } |
235 | 235 | } |
236 | 236 | $subsections = array(); |
237 | 237 | // now decide which template to load |
238 | - if ( ! empty( $sold_out_events )) { |
|
239 | - $subsections['sold_out_events'] = $this->_sold_out_events( $sold_out_events ); |
|
238 | + if ( ! empty($sold_out_events)) { |
|
239 | + $subsections['sold_out_events'] = $this->_sold_out_events($sold_out_events); |
|
240 | 240 | } |
241 | - if ( ! empty( $registrations_requiring_pre_approval )) { |
|
242 | - $subsections['registrations_requiring_pre_approval'] = $this->_registrations_requiring_pre_approval( $registrations_requiring_pre_approval ); |
|
241 | + if ( ! empty($registrations_requiring_pre_approval)) { |
|
242 | + $subsections['registrations_requiring_pre_approval'] = $this->_registrations_requiring_pre_approval($registrations_requiring_pre_approval); |
|
243 | 243 | } |
244 | - if ( ! empty( $registrations_for_free_events ) ) { |
|
245 | - $subsections[ 'no_payment_required' ] = $this->_no_payment_required( $registrations_for_free_events ); |
|
244 | + if ( ! empty($registrations_for_free_events)) { |
|
245 | + $subsections['no_payment_required'] = $this->_no_payment_required($registrations_for_free_events); |
|
246 | 246 | } |
247 | - if ( ! empty( $registrations_requiring_payment ) ) { |
|
247 | + if ( ! empty($registrations_requiring_payment)) { |
|
248 | 248 | //EEH_Debug_Tools::printr( $registrations_requiring_payment, '$registrations_requiring_payment', __FILE__, __LINE__ ); |
249 | 249 | // autoload Line_Item_Display classes |
250 | 250 | EEH_Autoloader::register_line_item_filter_autoloaders(); |
@@ -261,11 +261,11 @@ discard block |
||
261 | 261 | //EEH_Debug_Tools::printr( $filtered_line_item_tree->total(), '$filtered_line_item_tree->total()', __FILE__, __LINE__ ); |
262 | 262 | $this->checkout->amount_owing = $filtered_line_item_tree->total(); |
263 | 263 | |
264 | - if ( $this->checkout->amount_owing > 0 ) { |
|
264 | + if ($this->checkout->amount_owing > 0) { |
|
265 | 265 | EEH_Autoloader::register_line_item_display_autoloaders(); |
266 | - $this->set_line_item_display( new EE_Line_Item_Display( 'spco' ) ); |
|
267 | - $subsections[ 'payment_options' ] = $this->_display_payment_options( |
|
268 | - $this->line_item_display->display_line_item( $filtered_line_item_tree ) |
|
266 | + $this->set_line_item_display(new EE_Line_Item_Display('spco')); |
|
267 | + $subsections['payment_options'] = $this->_display_payment_options( |
|
268 | + $this->line_item_display->display_line_item($filtered_line_item_tree) |
|
269 | 269 | ); |
270 | 270 | $this->_apply_transaction_payments_to_amount_owing(); |
271 | 271 | } |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | * @param \EE_Line_Item_Filter_Collection $line_item_filter_collection |
301 | 301 | * @return \EE_Line_Item_Filter_Collection |
302 | 302 | */ |
303 | - public static function add_spco_line_item_filters( EE_Line_Item_Filter_Collection $line_item_filter_collection ) { |
|
303 | + public static function add_spco_line_item_filters(EE_Line_Item_Filter_Collection $line_item_filter_collection) { |
|
304 | 304 | $line_item_filter_collection->add( |
305 | 305 | new EE_Billable_Line_Item_Filter( |
306 | 306 | EE_Registry::instance()->SSN->checkout()->transaction->registrations( |
@@ -308,7 +308,7 @@ discard block |
||
308 | 308 | ) |
309 | 309 | ) |
310 | 310 | ); |
311 | - $line_item_filter_collection->add( new EE_Non_Zero_Line_Item_Filter() ); |
|
311 | + $line_item_filter_collection->add(new EE_Non_Zero_Line_Item_Filter()); |
|
312 | 312 | return $line_item_filter_collection; |
313 | 313 | } |
314 | 314 | |
@@ -322,8 +322,8 @@ discard block |
||
322 | 322 | * @return void |
323 | 323 | */ |
324 | 324 | protected function _hide_reg_step_submit_button_if_revisit() { |
325 | - if ( $this->checkout->revisit ) { |
|
326 | - add_filter( 'FHEE__EE_SPCO_Reg_Step__reg_step_submit_button__sbmt_btn_html', '__return_empty_string' ); |
|
325 | + if ($this->checkout->revisit) { |
|
326 | + add_filter('FHEE__EE_SPCO_Reg_Step__reg_step_submit_button__sbmt_btn_html', '__return_empty_string'); |
|
327 | 327 | } |
328 | 328 | } |
329 | 329 | |
@@ -334,12 +334,12 @@ discard block |
||
334 | 334 | * @param \EE_Event[] $sold_out_events_array |
335 | 335 | * @return \EE_Form_Section_Proper |
336 | 336 | */ |
337 | - private function _sold_out_events( $sold_out_events_array = array() ) { |
|
337 | + private function _sold_out_events($sold_out_events_array = array()) { |
|
338 | 338 | // set some defaults |
339 | 339 | $this->checkout->selected_method_of_payment = 'events_sold_out'; |
340 | 340 | $sold_out_events = ''; |
341 | - foreach ( $sold_out_events_array as $sold_out_event ) { |
|
342 | - $sold_out_events .= EEH_HTML::li( EEH_HTML::span( $sold_out_event->name(), '', 'dashicons dashicons-marker ee-icon-size-16 pink-text' )); |
|
341 | + foreach ($sold_out_events_array as $sold_out_event) { |
|
342 | + $sold_out_events .= EEH_HTML::li(EEH_HTML::span($sold_out_event->name(), '', 'dashicons dashicons-marker ee-icon-size-16 pink-text')); |
|
343 | 343 | } |
344 | 344 | return new EE_Form_Section_Proper( |
345 | 345 | array( |
@@ -351,14 +351,14 @@ discard block |
||
351 | 351 | ), |
352 | 352 | 'layout_strategy' => new EE_Template_Layout( |
353 | 353 | array( |
354 | - 'layout_template_file' => SPCO_REG_STEPS_PATH . $this->_slug . DS . 'sold_out_events.template.php', // layout_template |
|
354 | + 'layout_template_file' => SPCO_REG_STEPS_PATH.$this->_slug.DS.'sold_out_events.template.php', // layout_template |
|
355 | 355 | 'template_args' => apply_filters( |
356 | 356 | 'FHEE__EE_SPCO_Reg_Step_Payment_Options___sold_out_events__template_args', |
357 | 357 | array( |
358 | 358 | 'sold_out_events' => $sold_out_events, |
359 | 359 | 'sold_out_events_msg' => apply_filters( |
360 | 360 | 'FHEE__EE_SPCO_Reg_Step_Payment_Options___sold_out_events__sold_out_events_msg', |
361 | - __( 'It appears that the event you were about to make a payment for has sold out since you first registered. If you have already made a partial payment towards this event, please contact the event administrator for a refund.', 'event_espresso' ) |
|
361 | + __('It appears that the event you were about to make a payment for has sold out since you first registered. If you have already made a partial payment towards this event, please contact the event administrator for a refund.', 'event_espresso') |
|
362 | 362 | ) |
363 | 363 | ) |
364 | 364 | ) |
@@ -375,14 +375,14 @@ discard block |
||
375 | 375 | * @param array $registrations_requiring_pre_approval |
376 | 376 | * @return \EE_Form_Section_Proper |
377 | 377 | */ |
378 | - private function _registrations_requiring_pre_approval( $registrations_requiring_pre_approval = array()) { |
|
378 | + private function _registrations_requiring_pre_approval($registrations_requiring_pre_approval = array()) { |
|
379 | 379 | $events_requiring_pre_approval = ''; |
380 | - foreach ( $registrations_requiring_pre_approval as $registration ) { |
|
381 | - if ( $registration instanceof EE_Registration && $registration->event() instanceof EE_Event ) { |
|
382 | - $events_requiring_pre_approval[ $registration->event()->ID() ] = EEH_HTML::li( |
|
383 | - EEH_HTML::span( '', '', 'dashicons dashicons-marker ee-icon-size-16 orange-text' |
|
380 | + foreach ($registrations_requiring_pre_approval as $registration) { |
|
381 | + if ($registration instanceof EE_Registration && $registration->event() instanceof EE_Event) { |
|
382 | + $events_requiring_pre_approval[$registration->event()->ID()] = EEH_HTML::li( |
|
383 | + EEH_HTML::span('', '', 'dashicons dashicons-marker ee-icon-size-16 orange-text' |
|
384 | 384 | ) |
385 | - . EEH_HTML::span( $registration->event()->name(), '', 'orange-text' ) |
|
385 | + . EEH_HTML::span($registration->event()->name(), '', 'orange-text') |
|
386 | 386 | ); |
387 | 387 | } |
388 | 388 | } |
@@ -394,14 +394,14 @@ discard block |
||
394 | 394 | ), |
395 | 395 | 'layout_strategy' => new EE_Template_Layout( |
396 | 396 | array( |
397 | - 'layout_template_file' => SPCO_REG_STEPS_PATH . $this->_slug . DS . 'events_requiring_pre_approval.template.php', // layout_template |
|
397 | + 'layout_template_file' => SPCO_REG_STEPS_PATH.$this->_slug.DS.'events_requiring_pre_approval.template.php', // layout_template |
|
398 | 398 | 'template_args' => apply_filters( |
399 | 399 | 'FHEE__EE_SPCO_Reg_Step_Payment_Options___sold_out_events__template_args', |
400 | 400 | array( |
401 | - 'events_requiring_pre_approval' => implode( '', $events_requiring_pre_approval ), |
|
401 | + 'events_requiring_pre_approval' => implode('', $events_requiring_pre_approval), |
|
402 | 402 | 'events_requiring_pre_approval_msg' => apply_filters( |
403 | 403 | 'FHEE__EE_SPCO_Reg_Step_Payment_Options___events_requiring_pre_approval__events_requiring_pre_approval_msg', |
404 | - __( 'The following events do not require payment at this time and will not be billed during this transaction. Billing will only occur after the attendee has been approved by the event organizer. You will be notified when your registration has been processed. If this is a free event, then no billing will occur.', 'event_espresso' ) |
|
404 | + __('The following events do not require payment at this time and will not be billed during this transaction. Billing will only occur after the attendee has been approved by the event organizer. You will be notified when your registration has been processed. If this is a free event, then no billing will occur.', 'event_espresso') |
|
405 | 405 | ) |
406 | 406 | ) |
407 | 407 | ), |
@@ -419,7 +419,7 @@ discard block |
||
419 | 419 | * @param \EE_Event[] $registrations_for_free_events |
420 | 420 | * @return \EE_Form_Section_Proper |
421 | 421 | */ |
422 | - private function _no_payment_required( $registrations_for_free_events = array() ) { |
|
422 | + private function _no_payment_required($registrations_for_free_events = array()) { |
|
423 | 423 | // set some defaults |
424 | 424 | $this->checkout->selected_method_of_payment = 'no_payment_required'; |
425 | 425 | // generate no_payment_required form |
@@ -431,7 +431,7 @@ discard block |
||
431 | 431 | ), |
432 | 432 | 'layout_strategy' => new EE_Template_Layout( |
433 | 433 | array( |
434 | - 'layout_template_file' => SPCO_REG_STEPS_PATH . $this->_slug . DS . 'no_payment_required.template.php', // layout_template |
|
434 | + 'layout_template_file' => SPCO_REG_STEPS_PATH.$this->_slug.DS.'no_payment_required.template.php', // layout_template |
|
435 | 435 | 'template_args' => apply_filters( |
436 | 436 | 'FHEE__EE_SPCO_Reg_Step_Payment_Options___no_payment_required__template_args', |
437 | 437 | array( |
@@ -439,7 +439,7 @@ discard block |
||
439 | 439 | 'registrations' => array(), |
440 | 440 | 'ticket_count' => array(), |
441 | 441 | 'registrations_for_free_events' => $registrations_for_free_events, |
442 | - 'no_payment_required_msg' => EEH_HTML::p( __( 'This is a free event, so no billing will occur.', 'event_espresso' )) |
|
442 | + 'no_payment_required_msg' => EEH_HTML::p(__('This is a free event, so no billing will occur.', 'event_espresso')) |
|
443 | 443 | ) |
444 | 444 | ), |
445 | 445 | ) |
@@ -456,7 +456,7 @@ discard block |
||
456 | 456 | * @param string $transaction_details |
457 | 457 | * @return \EE_Form_Section_Proper |
458 | 458 | */ |
459 | - private function _display_payment_options( $transaction_details = '' ) { |
|
459 | + private function _display_payment_options($transaction_details = '') { |
|
460 | 460 | // has method_of_payment been set by no-js user? |
461 | 461 | $this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment(); |
462 | 462 | // build payment options form |
@@ -468,20 +468,20 @@ discard block |
||
468 | 468 | 'before_payment_options' => apply_filters( |
469 | 469 | 'FHEE__EE_SPCO_Reg_Step_Payment_Options___display_payment_options__before_payment_options', |
470 | 470 | new EE_Form_Section_Proper( |
471 | - array( 'layout_strategy' => new EE_Div_Per_Section_Layout() ) |
|
471 | + array('layout_strategy' => new EE_Div_Per_Section_Layout()) |
|
472 | 472 | ) |
473 | 473 | ), |
474 | 474 | 'payment_options' => $this->_setup_payment_options(), |
475 | 475 | 'after_payment_options' => apply_filters( |
476 | 476 | 'FHEE__EE_SPCO_Reg_Step_Payment_Options___display_payment_options__after_payment_options', |
477 | 477 | new EE_Form_Section_Proper( |
478 | - array( 'layout_strategy' => new EE_Div_Per_Section_Layout() ) |
|
478 | + array('layout_strategy' => new EE_Div_Per_Section_Layout()) |
|
479 | 479 | ) |
480 | 480 | ), |
481 | 481 | 'default_hidden_inputs' => $this->reg_step_hidden_inputs(), |
482 | - 'extra_hidden_inputs' => $this->_extra_hidden_inputs( FALSE ) |
|
482 | + 'extra_hidden_inputs' => $this->_extra_hidden_inputs(FALSE) |
|
483 | 483 | ), |
484 | - 'layout_strategy' => new EE_Template_Layout( array( |
|
484 | + 'layout_strategy' => new EE_Template_Layout(array( |
|
485 | 485 | 'layout_template_file' => $this->_template, |
486 | 486 | 'template_args' => apply_filters( |
487 | 487 | 'FHEE__EE_SPCO_Reg_Step_Payment_Options___display_payment_options__template_args', |
@@ -505,11 +505,11 @@ discard block |
||
505 | 505 | * @param bool $no_payment_required |
506 | 506 | * @return \EE_Form_Section_Proper |
507 | 507 | */ |
508 | - private function _extra_hidden_inputs( $no_payment_required = TRUE ) { |
|
508 | + private function _extra_hidden_inputs($no_payment_required = TRUE) { |
|
509 | 509 | |
510 | 510 | return new EE_Form_Section_Proper( |
511 | 511 | array( |
512 | - 'html_id' => 'ee-' . $this->slug() . '-extra-hidden-inputs', |
|
512 | + 'html_id' => 'ee-'.$this->slug().'-extra-hidden-inputs', |
|
513 | 513 | 'layout_strategy' => new EE_Div_Per_Section_Layout(), |
514 | 514 | 'subsections' => array( |
515 | 515 | 'spco_no_payment_required' => new EE_Hidden_Input( |
@@ -544,9 +544,9 @@ discard block |
||
544 | 544 | */ |
545 | 545 | protected function _apply_transaction_payments_to_amount_owing() { |
546 | 546 | $payments = $this->checkout->transaction->approved_payments(); |
547 | - if ( ! empty( $payments ) ) { |
|
548 | - foreach ( $payments as $payment ) { |
|
549 | - if ( $payment instanceof EE_Payment ) { |
|
547 | + if ( ! empty($payments)) { |
|
548 | + foreach ($payments as $payment) { |
|
549 | + if ($payment instanceof EE_Payment) { |
|
550 | 550 | $this->checkout->amount_owing -= $payment->amount(); |
551 | 551 | } |
552 | 552 | } |
@@ -562,9 +562,9 @@ discard block |
||
562 | 562 | * @param bool $force_reset |
563 | 563 | * @return void |
564 | 564 | */ |
565 | - private function _reset_selected_method_of_payment( $force_reset = FALSE ) { |
|
566 | - $reset_payment_method = $force_reset ? TRUE : sanitize_text_field( EE_Registry::instance()->REQ->get( 'reset_payment_method', FALSE )); |
|
567 | - if ( $reset_payment_method ) { |
|
565 | + private function _reset_selected_method_of_payment($force_reset = FALSE) { |
|
566 | + $reset_payment_method = $force_reset ? TRUE : sanitize_text_field(EE_Registry::instance()->REQ->get('reset_payment_method', FALSE)); |
|
567 | + if ($reset_payment_method) { |
|
568 | 568 | $this->checkout->selected_method_of_payment = NULL; |
569 | 569 | $this->checkout->payment_method = NULL; |
570 | 570 | $this->checkout->billing_form = NULL; |
@@ -583,9 +583,9 @@ discard block |
||
583 | 583 | * @param string $selected_method_of_payment |
584 | 584 | * @return EE_Billing_Info_Form |
585 | 585 | */ |
586 | - private function _save_selected_method_of_payment( $selected_method_of_payment = '' ) { |
|
587 | - $selected_method_of_payment = ! empty( $selected_method_of_payment ) ? $selected_method_of_payment : $this->checkout->selected_method_of_payment; |
|
588 | - EE_Registry::instance()->SSN->set_session_data( array( 'selected_method_of_payment' => $selected_method_of_payment )); |
|
586 | + private function _save_selected_method_of_payment($selected_method_of_payment = '') { |
|
587 | + $selected_method_of_payment = ! empty($selected_method_of_payment) ? $selected_method_of_payment : $this->checkout->selected_method_of_payment; |
|
588 | + EE_Registry::instance()->SSN->set_session_data(array('selected_method_of_payment' => $selected_method_of_payment)); |
|
589 | 589 | } |
590 | 590 | |
591 | 591 | |
@@ -598,40 +598,40 @@ discard block |
||
598 | 598 | // load payment method classes |
599 | 599 | $this->checkout->available_payment_methods = $this->_get_available_payment_methods(); |
600 | 600 | // switch up header depending on number of available payment methods |
601 | - $payment_method_header = count( $this->checkout->available_payment_methods ) > 1 |
|
602 | - ? apply_filters( 'FHEE__registration_page_payment_options__method_of_payment_hdr', __( 'Please Select Your Method of Payment', 'event_espresso' )) |
|
603 | - : apply_filters( 'FHEE__registration_page_payment_options__method_of_payment_hdr', __( 'Method of Payment', 'event_espresso' )); |
|
601 | + $payment_method_header = count($this->checkout->available_payment_methods) > 1 |
|
602 | + ? apply_filters('FHEE__registration_page_payment_options__method_of_payment_hdr', __('Please Select Your Method of Payment', 'event_espresso')) |
|
603 | + : apply_filters('FHEE__registration_page_payment_options__method_of_payment_hdr', __('Method of Payment', 'event_espresso')); |
|
604 | 604 | $available_payment_methods = array( |
605 | 605 | // display the "Payment Method" header |
606 | 606 | 'payment_method_header' => new EE_Form_Section_HTML( |
607 | - EEH_HTML::h4 ( $payment_method_header, 'method-of-payment-hdr' ) |
|
607 | + EEH_HTML::h4($payment_method_header, 'method-of-payment-hdr') |
|
608 | 608 | ) |
609 | 609 | ); |
610 | 610 | // the list of actual payment methods ( invoice, paypal, etc ) in a ( slug => HTML ) format |
611 | 611 | $available_payment_method_options = array(); |
612 | 612 | $default_payment_method_option = array(); |
613 | 613 | // additional instructions to be displayed and hidden below payment methods (adding a clearing div to start) |
614 | - $payment_methods_billing_info = array( new EE_Form_Section_HTML( EEH_HTML::div ( '<br />', '', '', 'clear:both;' ))); |
|
614 | + $payment_methods_billing_info = array(new EE_Form_Section_HTML(EEH_HTML::div('<br />', '', '', 'clear:both;'))); |
|
615 | 615 | // loop through payment methods |
616 | - foreach( $this->checkout->available_payment_methods as $payment_method ) { |
|
617 | - if ( $payment_method instanceof EE_Payment_Method ) { |
|
618 | - $payment_method_button = EEH_HTML::img( $payment_method->button_url(), $payment_method->name(), 'spco-payment-method-' . $payment_method->slug() . '-btn-img', 'spco-payment-method-btn-img' ); |
|
616 | + foreach ($this->checkout->available_payment_methods as $payment_method) { |
|
617 | + if ($payment_method instanceof EE_Payment_Method) { |
|
618 | + $payment_method_button = EEH_HTML::img($payment_method->button_url(), $payment_method->name(), 'spco-payment-method-'.$payment_method->slug().'-btn-img', 'spco-payment-method-btn-img'); |
|
619 | 619 | // check if any payment methods are set as default |
620 | 620 | // if payment method is already selected OR nothing is selected and this payment method should be open_by_default |
621 | - if (( $this->checkout->selected_method_of_payment == $payment_method->slug() ) || ( ! $this->checkout->selected_method_of_payment && $payment_method->open_by_default() )) { |
|
621 | + if (($this->checkout->selected_method_of_payment == $payment_method->slug()) || ( ! $this->checkout->selected_method_of_payment && $payment_method->open_by_default())) { |
|
622 | 622 | $this->checkout->selected_method_of_payment = $payment_method->slug(); |
623 | 623 | $this->_save_selected_method_of_payment(); |
624 | - $default_payment_method_option[ $payment_method->slug() ] = $payment_method_button; |
|
624 | + $default_payment_method_option[$payment_method->slug()] = $payment_method_button; |
|
625 | 625 | } else { |
626 | - $available_payment_method_options[ $payment_method->slug() ] = $payment_method_button; |
|
626 | + $available_payment_method_options[$payment_method->slug()] = $payment_method_button; |
|
627 | 627 | } |
628 | - $payment_methods_billing_info[ $payment_method->slug() . '-info' ] = $this->_payment_method_billing_info( $payment_method ); |
|
628 | + $payment_methods_billing_info[$payment_method->slug().'-info'] = $this->_payment_method_billing_info($payment_method); |
|
629 | 629 | } |
630 | 630 | } |
631 | 631 | // prepend available_payment_method_options with default_payment_method_option so that it appears first in list of PMs |
632 | 632 | $available_payment_method_options = $default_payment_method_option + $available_payment_method_options; |
633 | 633 | // now generate the actual form inputs |
634 | - $available_payment_methods['available_payment_methods'] = $this->_available_payment_method_inputs( $available_payment_method_options ); |
|
634 | + $available_payment_methods['available_payment_methods'] = $this->_available_payment_method_inputs($available_payment_method_options); |
|
635 | 635 | $available_payment_methods = $available_payment_methods + $payment_methods_billing_info; |
636 | 636 | |
637 | 637 | // build the available payment methods form |
@@ -651,19 +651,19 @@ discard block |
||
651 | 651 | * @return EE_Payment_Method[] |
652 | 652 | */ |
653 | 653 | protected function _get_available_payment_methods() { |
654 | - if ( ! empty( $this->checkout->available_payment_methods )) { |
|
654 | + if ( ! empty($this->checkout->available_payment_methods)) { |
|
655 | 655 | return $this->checkout->available_payment_methods; |
656 | 656 | } |
657 | 657 | $available_payment_methods = array(); |
658 | 658 | // load EEM_Payment_Method |
659 | - EE_Registry::instance()->load_model( 'Payment_Method' ); |
|
659 | + EE_Registry::instance()->load_model('Payment_Method'); |
|
660 | 660 | /** @type EEM_Payment_Method $EEM_Payment_Method */ |
661 | 661 | $EEM_Payment_Method = EE_Registry::instance()->LIB->EEM_Payment_Method; |
662 | 662 | // get all active payment methods |
663 | - $payment_methods = $EEM_Payment_Method->get_all_for_transaction( $this->checkout->transaction, EEM_Payment_Method::scope_cart ); |
|
664 | - foreach ( $payment_methods as $payment_method ) { |
|
665 | - if ( $payment_method instanceof EE_Payment_Method ) { |
|
666 | - $available_payment_methods[ $payment_method->slug() ] = $payment_method; |
|
663 | + $payment_methods = $EEM_Payment_Method->get_all_for_transaction($this->checkout->transaction, EEM_Payment_Method::scope_cart); |
|
664 | + foreach ($payment_methods as $payment_method) { |
|
665 | + if ($payment_method instanceof EE_Payment_Method) { |
|
666 | + $available_payment_methods[$payment_method->slug()] = $payment_method; |
|
667 | 667 | } |
668 | 668 | } |
669 | 669 | return $available_payment_methods; |
@@ -679,14 +679,14 @@ discard block |
||
679 | 679 | * @param array $available_payment_method_options |
680 | 680 | * @return \EE_Form_Section_Proper |
681 | 681 | */ |
682 | - private function _available_payment_method_inputs( $available_payment_method_options = array() ) { |
|
682 | + private function _available_payment_method_inputs($available_payment_method_options = array()) { |
|
683 | 683 | // generate inputs |
684 | 684 | return new EE_Form_Section_Proper( |
685 | 685 | array( |
686 | 686 | 'html_id' => 'ee-available-payment-method-inputs', |
687 | 687 | 'layout_strategy' => new EE_Div_Per_Section_Layout(), |
688 | 688 | 'subsections' => array( |
689 | - '' => new EE_Radio_Button_Input ( |
|
689 | + '' => new EE_Radio_Button_Input( |
|
690 | 690 | $available_payment_method_options, |
691 | 691 | array( |
692 | 692 | 'html_name' => 'selected_method_of_payment', |
@@ -710,36 +710,36 @@ discard block |
||
710 | 710 | * @param EE_Payment_Method $payment_method |
711 | 711 | * @return \EE_Form_Section_Proper |
712 | 712 | */ |
713 | - private function _payment_method_billing_info( EE_Payment_Method $payment_method ) { |
|
713 | + private function _payment_method_billing_info(EE_Payment_Method $payment_method) { |
|
714 | 714 | $currently_selected = $this->checkout->selected_method_of_payment == $payment_method->slug() ? TRUE : FALSE; |
715 | 715 | // generate the billing form for payment method |
716 | - $billing_form = $currently_selected ? $this->_get_billing_form_for_payment_method( $payment_method ) : new EE_Form_Section_HTML(); |
|
716 | + $billing_form = $currently_selected ? $this->_get_billing_form_for_payment_method($payment_method) : new EE_Form_Section_HTML(); |
|
717 | 717 | $this->checkout->billing_form = $currently_selected ? $billing_form : $this->checkout->billing_form; |
718 | 718 | // it's all in the details |
719 | - $info_html = EEH_HTML::h3 ( __( 'Important information regarding your payment', 'event_espresso' ), '', 'spco-payment-method-hdr' ); |
|
719 | + $info_html = EEH_HTML::h3(__('Important information regarding your payment', 'event_espresso'), '', 'spco-payment-method-hdr'); |
|
720 | 720 | // add some info regarding the step, either from what's saved in the admin, or a default string depending on whether the PM has a billing form or not |
721 | - if ( $payment_method->description() ) { |
|
721 | + if ($payment_method->description()) { |
|
722 | 722 | $payment_method_info = $payment_method->description(); |
723 | - } elseif ( $billing_form instanceof EE_Billing_Info_Form ) { |
|
724 | - $payment_method_info = sprintf( __( 'Please provide the following billing information, then click the "%1$s" button below in order to proceed.', 'event_espresso' ), $this->submit_button_text() ); |
|
723 | + } elseif ($billing_form instanceof EE_Billing_Info_Form) { |
|
724 | + $payment_method_info = sprintf(__('Please provide the following billing information, then click the "%1$s" button below in order to proceed.', 'event_espresso'), $this->submit_button_text()); |
|
725 | 725 | } else { |
726 | - $payment_method_info = sprintf( __( 'Please click the "%1$s" button below in order to proceed.', 'event_espresso' ), $this->submit_button_text() ); |
|
726 | + $payment_method_info = sprintf(__('Please click the "%1$s" button below in order to proceed.', 'event_espresso'), $this->submit_button_text()); |
|
727 | 727 | } |
728 | - $info_html .= EEH_HTML::p ( |
|
729 | - apply_filters( 'FHEE__EE_SPCO_Reg_Step_Payment_Options___payment_method_billing_info__payment_method_info', $payment_method_info ), |
|
728 | + $info_html .= EEH_HTML::p( |
|
729 | + apply_filters('FHEE__EE_SPCO_Reg_Step_Payment_Options___payment_method_billing_info__payment_method_info', $payment_method_info), |
|
730 | 730 | '', |
731 | 731 | 'spco-payment-method-desc ee-attention' |
732 | 732 | ); |
733 | 733 | |
734 | 734 | return new EE_Form_Section_Proper( |
735 | 735 | array( |
736 | - 'html_id' => 'spco-payment-method-info-' . $payment_method->slug(), |
|
736 | + 'html_id' => 'spco-payment-method-info-'.$payment_method->slug(), |
|
737 | 737 | 'html_class' => 'spco-payment-method-info-dv', |
738 | 738 | // only display the selected or default PM |
739 | 739 | 'html_style' => $currently_selected ? '' : 'display:none;', |
740 | 740 | 'layout_strategy' => new EE_Div_Per_Section_Layout(), |
741 | 741 | 'subsections' => array( |
742 | - 'info' => new EE_Form_Section_HTML( $info_html ), |
|
742 | + 'info' => new EE_Form_Section_HTML($info_html), |
|
743 | 743 | 'billing_form' => $currently_selected ? $billing_form : new EE_Form_Section_HTML() |
744 | 744 | ) |
745 | 745 | ) |
@@ -757,12 +757,12 @@ discard block |
||
757 | 757 | */ |
758 | 758 | public function get_billing_form_html_for_payment_method() { |
759 | 759 | // how have they chosen to pay? |
760 | - $this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment( TRUE ); |
|
760 | + $this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment(TRUE); |
|
761 | 761 | $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment(); |
762 | - if ( ! $this->checkout->payment_method instanceof EE_Payment_Method ) { |
|
762 | + if ( ! $this->checkout->payment_method instanceof EE_Payment_Method) { |
|
763 | 763 | return FALSE; |
764 | 764 | } |
765 | - if ( apply_filters( 'FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success', false ) ) { |
|
765 | + if (apply_filters('FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success', false)) { |
|
766 | 766 | EE_Error::add_success( |
767 | 767 | apply_filters( |
768 | 768 | 'FHEE__Single_Page_Checkout__registration_checkout__selected_payment_method', |
@@ -771,20 +771,20 @@ discard block |
||
771 | 771 | ); |
772 | 772 | } |
773 | 773 | // now generate billing form for selected method of payment |
774 | - $payment_method_billing_form = $this->_get_billing_form_for_payment_method( $this->checkout->payment_method ); |
|
774 | + $payment_method_billing_form = $this->_get_billing_form_for_payment_method($this->checkout->payment_method); |
|
775 | 775 | // fill form with attendee info if applicable |
776 | - if ( $payment_method_billing_form instanceof EE_Billing_Attendee_Info_Form && $this->checkout->transaction_has_primary_registrant() ) { |
|
777 | - $payment_method_billing_form->populate_from_attendee( $this->checkout->transaction->primary_registration()->attendee() ); |
|
776 | + if ($payment_method_billing_form instanceof EE_Billing_Attendee_Info_Form && $this->checkout->transaction_has_primary_registrant()) { |
|
777 | + $payment_method_billing_form->populate_from_attendee($this->checkout->transaction->primary_registration()->attendee()); |
|
778 | 778 | } |
779 | 779 | // and debug content |
780 | - if ( $payment_method_billing_form instanceof EE_Billing_Info_Form && $this->checkout->payment_method->type_obj() instanceof EE_PMT_Base ) { |
|
781 | - $payment_method_billing_form = $this->checkout->payment_method->type_obj()->apply_billing_form_debug_settings( $payment_method_billing_form ); |
|
780 | + if ($payment_method_billing_form instanceof EE_Billing_Info_Form && $this->checkout->payment_method->type_obj() instanceof EE_PMT_Base) { |
|
781 | + $payment_method_billing_form = $this->checkout->payment_method->type_obj()->apply_billing_form_debug_settings($payment_method_billing_form); |
|
782 | 782 | } |
783 | 783 | $billing_info = $payment_method_billing_form instanceof EE_Form_Section_Proper ? $payment_method_billing_form->get_html() : ''; |
784 | - $this->checkout->json_response->set_return_data( array( 'payment_method_info' => $billing_info )); |
|
784 | + $this->checkout->json_response->set_return_data(array('payment_method_info' => $billing_info)); |
|
785 | 785 | // localize validation rules for main form |
786 | 786 | $this->checkout->current_step->reg_form->localize_validation_rules(); |
787 | - $this->checkout->json_response->add_validation_rules( EE_Form_Section_Proper::js_localization() ); |
|
787 | + $this->checkout->json_response->add_validation_rules(EE_Form_Section_Proper::js_localization()); |
|
788 | 788 | return TRUE; |
789 | 789 | } |
790 | 790 | |
@@ -797,15 +797,15 @@ discard block |
||
797 | 797 | * @param EE_Payment_Method $payment_method |
798 | 798 | * @return \EE_Billing_Info_Form |
799 | 799 | */ |
800 | - private function _get_billing_form_for_payment_method( EE_Payment_Method $payment_method ) { |
|
801 | - $billing_form = $payment_method->type_obj()->billing_form( $this->checkout->transaction, array( 'amount_owing' => $this->checkout->amount_owing ) ); |
|
802 | - if ( $billing_form instanceof EE_Billing_Info_Form ) { |
|
803 | - if ( EE_Registry::instance()->REQ->is_set( 'payment_method' )) { |
|
804 | - if ( apply_filters('FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success', false )) { |
|
800 | + private function _get_billing_form_for_payment_method(EE_Payment_Method $payment_method) { |
|
801 | + $billing_form = $payment_method->type_obj()->billing_form($this->checkout->transaction, array('amount_owing' => $this->checkout->amount_owing)); |
|
802 | + if ($billing_form instanceof EE_Billing_Info_Form) { |
|
803 | + if (EE_Registry::instance()->REQ->is_set('payment_method')) { |
|
804 | + if (apply_filters('FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success', false)) { |
|
805 | 805 | EE_Error::add_success( |
806 | 806 | apply_filters( |
807 | 807 | 'FHEE__Single_Page_Checkout__registration_checkout__selected_payment_method', |
808 | - sprintf( __( 'You have selected "%s" as your method of payment. Please note the important payment information below.', 'event_espresso' ), $payment_method->name() ) |
|
808 | + sprintf(__('You have selected "%s" as your method of payment. Please note the important payment information below.', 'event_espresso'), $payment_method->name()) |
|
809 | 809 | ) |
810 | 810 | ); |
811 | 811 | } |
@@ -830,27 +830,27 @@ discard block |
||
830 | 830 | * @param string $request_param |
831 | 831 | * @return NULL|string |
832 | 832 | */ |
833 | - private function _get_selected_method_of_payment( $required = FALSE, $request_param = 'selected_method_of_payment' ) { |
|
833 | + private function _get_selected_method_of_payment($required = FALSE, $request_param = 'selected_method_of_payment') { |
|
834 | 834 | // is selected_method_of_payment set in the request ? |
835 | - $selected_method_of_payment = EE_Registry::instance()->REQ->get( $request_param, FALSE ); |
|
836 | - if ( $selected_method_of_payment ) { |
|
835 | + $selected_method_of_payment = EE_Registry::instance()->REQ->get($request_param, FALSE); |
|
836 | + if ($selected_method_of_payment) { |
|
837 | 837 | // sanitize it |
838 | - $selected_method_of_payment = is_array( $selected_method_of_payment ) ? array_shift( $selected_method_of_payment ) : $selected_method_of_payment; |
|
839 | - $selected_method_of_payment = sanitize_text_field( $selected_method_of_payment ); |
|
838 | + $selected_method_of_payment = is_array($selected_method_of_payment) ? array_shift($selected_method_of_payment) : $selected_method_of_payment; |
|
839 | + $selected_method_of_payment = sanitize_text_field($selected_method_of_payment); |
|
840 | 840 | // store it in the session so that it's available for all subsequent requests including AJAX |
841 | - $this->_save_selected_method_of_payment( $selected_method_of_payment ); |
|
841 | + $this->_save_selected_method_of_payment($selected_method_of_payment); |
|
842 | 842 | } else { |
843 | 843 | // or is is set in the session ? |
844 | - $selected_method_of_payment = EE_Registry::instance()->SSN->get_session_data( 'selected_method_of_payment' ); |
|
844 | + $selected_method_of_payment = EE_Registry::instance()->SSN->get_session_data('selected_method_of_payment'); |
|
845 | 845 | } |
846 | 846 | // do ya really really gotta have it? |
847 | - if ( empty( $selected_method_of_payment ) && $required ) { |
|
847 | + if (empty($selected_method_of_payment) && $required) { |
|
848 | 848 | EE_Error::add_error( |
849 | 849 | sprintf( |
850 | - __( 'The selected method of payment could not be determined.%sPlease ensure that you have selected one before proceeding.%sIf you continue to experience difficulties, then refresh your browser and try again, or contact %s for assistance.', 'event_espresso' ), |
|
850 | + __('The selected method of payment could not be determined.%sPlease ensure that you have selected one before proceeding.%sIf you continue to experience difficulties, then refresh your browser and try again, or contact %s for assistance.', 'event_espresso'), |
|
851 | 851 | '<br/>', |
852 | 852 | '<br/>', |
853 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) |
|
853 | + EE_Registry::instance()->CFG->organization->get_pretty('email') |
|
854 | 854 | ), |
855 | 855 | __FILE__, __FUNCTION__, __LINE__ |
856 | 856 | ); |
@@ -876,37 +876,37 @@ discard block |
||
876 | 876 | * @return string |
877 | 877 | */ |
878 | 878 | public function switch_payment_method() { |
879 | - if ( ! $this->_verify_payment_method_is_set() ) { |
|
879 | + if ( ! $this->_verify_payment_method_is_set()) { |
|
880 | 880 | return FALSE; |
881 | 881 | } |
882 | - if ( apply_filters( 'FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success', false ) ) { |
|
882 | + if (apply_filters('FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success', false)) { |
|
883 | 883 | EE_Error::add_success( |
884 | 884 | apply_filters( |
885 | 885 | 'FHEE__Single_Page_Checkout__registration_checkout__selected_payment_method', |
886 | - sprintf( __( 'You have selected "%s" as your method of payment. Please note the important payment information below.', 'event_espresso' ), $this->checkout->payment_method->name() ) |
|
886 | + sprintf(__('You have selected "%s" as your method of payment. Please note the important payment information below.', 'event_espresso'), $this->checkout->payment_method->name()) |
|
887 | 887 | ) |
888 | 888 | ); |
889 | 889 | } |
890 | 890 | // generate billing form for selected method of payment if it hasn't been done already |
891 | - if ( $this->checkout->payment_method->type_obj()->has_billing_form() ) { |
|
892 | - $this->checkout->billing_form = $this->_get_billing_form_for_payment_method( $this->checkout->payment_method ); |
|
891 | + if ($this->checkout->payment_method->type_obj()->has_billing_form()) { |
|
892 | + $this->checkout->billing_form = $this->_get_billing_form_for_payment_method($this->checkout->payment_method); |
|
893 | 893 | } |
894 | 894 | // fill form with attendee info if applicable |
895 | - if ( $this->checkout->billing_form instanceof EE_Billing_Attendee_Info_Form && $this->checkout->transaction_has_primary_registrant() ) { |
|
896 | - $this->checkout->billing_form->populate_from_attendee( $this->checkout->transaction->primary_registration()->attendee() ); |
|
895 | + if ($this->checkout->billing_form instanceof EE_Billing_Attendee_Info_Form && $this->checkout->transaction_has_primary_registrant()) { |
|
896 | + $this->checkout->billing_form->populate_from_attendee($this->checkout->transaction->primary_registration()->attendee()); |
|
897 | 897 | } |
898 | 898 | // and debug content |
899 | - if ( $this->checkout->billing_form instanceof EE_Billing_Info_Form && $this->checkout->payment_method->type_obj() instanceof EE_PMT_Base ) { |
|
900 | - $this->checkout->billing_form = $this->checkout->payment_method->type_obj()->apply_billing_form_debug_settings( $this->checkout->billing_form ); |
|
899 | + if ($this->checkout->billing_form instanceof EE_Billing_Info_Form && $this->checkout->payment_method->type_obj() instanceof EE_PMT_Base) { |
|
900 | + $this->checkout->billing_form = $this->checkout->payment_method->type_obj()->apply_billing_form_debug_settings($this->checkout->billing_form); |
|
901 | 901 | } |
902 | 902 | // get html and validation rules for form |
903 | - if ( $this->checkout->billing_form instanceof EE_Form_Section_Proper ) { |
|
904 | - $this->checkout->json_response->set_return_data( array( 'payment_method_info' => $this->checkout->billing_form->get_html() )); |
|
903 | + if ($this->checkout->billing_form instanceof EE_Form_Section_Proper) { |
|
904 | + $this->checkout->json_response->set_return_data(array('payment_method_info' => $this->checkout->billing_form->get_html())); |
|
905 | 905 | // localize validation rules for main form |
906 | - $this->checkout->billing_form->localize_validation_rules( TRUE ); |
|
907 | - $this->checkout->json_response->add_validation_rules( EE_Form_Section_Proper::js_localization() ); |
|
906 | + $this->checkout->billing_form->localize_validation_rules(TRUE); |
|
907 | + $this->checkout->json_response->add_validation_rules(EE_Form_Section_Proper::js_localization()); |
|
908 | 908 | } else { |
909 | - $this->checkout->json_response->set_return_data( array( 'payment_method_info' => '' )); |
|
909 | + $this->checkout->json_response->set_return_data(array('payment_method_info' => '')); |
|
910 | 910 | } |
911 | 911 | //prevents advancement to next step |
912 | 912 | $this->checkout->continue_reg = FALSE; |
@@ -921,12 +921,12 @@ discard block |
||
921 | 921 | */ |
922 | 922 | protected function _verify_payment_method_is_set() { |
923 | 923 | // generate billing form for selected method of payment if it hasn't been done already |
924 | - if ( empty( $this->checkout->selected_method_of_payment )) { |
|
924 | + if (empty($this->checkout->selected_method_of_payment)) { |
|
925 | 925 | // how have they chosen to pay? |
926 | - $this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment( TRUE ); |
|
926 | + $this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment(TRUE); |
|
927 | 927 | } |
928 | 928 | // verify payment method |
929 | - if ( ! $this->checkout->payment_method instanceof EE_Payment_Method ) { |
|
929 | + if ( ! $this->checkout->payment_method instanceof EE_Payment_Method) { |
|
930 | 930 | // get payment method for selected method of payment |
931 | 931 | $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment(); |
932 | 932 | } |
@@ -946,23 +946,23 @@ discard block |
||
946 | 946 | * @return void |
947 | 947 | */ |
948 | 948 | public function save_payer_details_via_ajax() { |
949 | - if ( ! $this->_verify_payment_method_is_set() ) { |
|
949 | + if ( ! $this->_verify_payment_method_is_set()) { |
|
950 | 950 | return; |
951 | 951 | } |
952 | 952 | // generate billing form for selected method of payment if it hasn't been done already |
953 | - if ( $this->checkout->payment_method->type_obj()->has_billing_form() ) { |
|
954 | - $this->checkout->billing_form = $this->_get_billing_form_for_payment_method( $this->checkout->payment_method ); |
|
953 | + if ($this->checkout->payment_method->type_obj()->has_billing_form()) { |
|
954 | + $this->checkout->billing_form = $this->_get_billing_form_for_payment_method($this->checkout->payment_method); |
|
955 | 955 | } |
956 | 956 | // generate primary attendee from payer info if applicable |
957 | 957 | if ( ! $this->checkout->transaction_has_primary_registrant()) { |
958 | 958 | $attendee = $this->_create_attendee_from_request_data(); |
959 | - if ( $attendee instanceof EE_Attendee ) { |
|
960 | - foreach ( $this->checkout->transaction->registrations() as $registration ) { |
|
961 | - if ( $registration->is_primary_registrant() ) { |
|
959 | + if ($attendee instanceof EE_Attendee) { |
|
960 | + foreach ($this->checkout->transaction->registrations() as $registration) { |
|
961 | + if ($registration->is_primary_registrant()) { |
|
962 | 962 | $this->checkout->primary_attendee_obj = $attendee; |
963 | - $registration->_add_relation_to( $attendee, 'Attendee' ); |
|
964 | - $registration->set_attendee_id( $attendee->ID() ); |
|
965 | - $registration->update_cache_after_object_save( 'Attendee', $attendee ); |
|
963 | + $registration->_add_relation_to($attendee, 'Attendee'); |
|
964 | + $registration->set_attendee_id($attendee->ID()); |
|
965 | + $registration->update_cache_after_object_save('Attendee', $attendee); |
|
966 | 966 | } |
967 | 967 | } |
968 | 968 | } |
@@ -975,56 +975,56 @@ discard block |
||
975 | 975 | * uses info from alternate GET or POST data (such as AJAX) to create a new attendee |
976 | 976 | * @return \EE_Attendee |
977 | 977 | */ |
978 | - protected function _create_attendee_from_request_data(){ |
|
978 | + protected function _create_attendee_from_request_data() { |
|
979 | 979 | // get State ID |
980 | - $STA_ID = ! empty( $_REQUEST['state'] ) ? sanitize_text_field( $_REQUEST['state'] ) : ''; |
|
981 | - if ( ! empty( $STA_ID )) { |
|
980 | + $STA_ID = ! empty($_REQUEST['state']) ? sanitize_text_field($_REQUEST['state']) : ''; |
|
981 | + if ( ! empty($STA_ID)) { |
|
982 | 982 | // can we get state object from name ? |
983 | - EE_Registry::instance()->load_model( 'State' ); |
|
984 | - $state = EEM_State::instance()->get_col( array( array( 'STA_name' => $STA_ID ), 'limit' => 1), 'STA_ID' ); |
|
985 | - $STA_ID = is_array( $state ) && ! empty( $state ) ? reset( $state ) : $STA_ID; |
|
983 | + EE_Registry::instance()->load_model('State'); |
|
984 | + $state = EEM_State::instance()->get_col(array(array('STA_name' => $STA_ID), 'limit' => 1), 'STA_ID'); |
|
985 | + $STA_ID = is_array($state) && ! empty($state) ? reset($state) : $STA_ID; |
|
986 | 986 | } |
987 | 987 | // get Country ISO |
988 | - $CNT_ISO = ! empty( $_REQUEST['country'] ) ? sanitize_text_field( $_REQUEST['country'] ) : ''; |
|
989 | - if ( ! empty( $CNT_ISO )) { |
|
988 | + $CNT_ISO = ! empty($_REQUEST['country']) ? sanitize_text_field($_REQUEST['country']) : ''; |
|
989 | + if ( ! empty($CNT_ISO)) { |
|
990 | 990 | // can we get country object from name ? |
991 | - EE_Registry::instance()->load_model( 'Country' ); |
|
992 | - $country = EEM_Country::instance()->get_col( array( array( 'CNT_name' => $CNT_ISO ), 'limit' => 1), 'CNT_ISO' ); |
|
993 | - $CNT_ISO = is_array( $country ) && ! empty( $country ) ? reset( $country ) : $CNT_ISO; |
|
991 | + EE_Registry::instance()->load_model('Country'); |
|
992 | + $country = EEM_Country::instance()->get_col(array(array('CNT_name' => $CNT_ISO), 'limit' => 1), 'CNT_ISO'); |
|
993 | + $CNT_ISO = is_array($country) && ! empty($country) ? reset($country) : $CNT_ISO; |
|
994 | 994 | } |
995 | 995 | // grab attendee data |
996 | 996 | $attendee_data = array( |
997 | - 'ATT_fname' => ! empty( $_REQUEST['first_name'] ) ? sanitize_text_field( $_REQUEST['first_name'] ) : '', |
|
998 | - 'ATT_lname' => ! empty( $_REQUEST['last_name'] ) ? sanitize_text_field( $_REQUEST['last_name'] ) : '', |
|
999 | - 'ATT_email' => ! empty( $_REQUEST['email'] ) ? sanitize_email( $_REQUEST['email'] ) : '', |
|
1000 | - 'ATT_address' => ! empty( $_REQUEST['address'] ) ? sanitize_text_field( $_REQUEST['address'] ) : '', |
|
1001 | - 'ATT_address2' => ! empty( $_REQUEST['address2'] ) ? sanitize_text_field( $_REQUEST['address2'] ) : '', |
|
1002 | - 'ATT_city' => ! empty( $_REQUEST['city'] ) ? sanitize_text_field( $_REQUEST['city'] ) : '', |
|
997 | + 'ATT_fname' => ! empty($_REQUEST['first_name']) ? sanitize_text_field($_REQUEST['first_name']) : '', |
|
998 | + 'ATT_lname' => ! empty($_REQUEST['last_name']) ? sanitize_text_field($_REQUEST['last_name']) : '', |
|
999 | + 'ATT_email' => ! empty($_REQUEST['email']) ? sanitize_email($_REQUEST['email']) : '', |
|
1000 | + 'ATT_address' => ! empty($_REQUEST['address']) ? sanitize_text_field($_REQUEST['address']) : '', |
|
1001 | + 'ATT_address2' => ! empty($_REQUEST['address2']) ? sanitize_text_field($_REQUEST['address2']) : '', |
|
1002 | + 'ATT_city' => ! empty($_REQUEST['city']) ? sanitize_text_field($_REQUEST['city']) : '', |
|
1003 | 1003 | 'STA_ID' => $STA_ID, |
1004 | 1004 | 'CNT_ISO' => $CNT_ISO, |
1005 | - 'ATT_zip' => ! empty( $_REQUEST['zip'] ) ? sanitize_text_field( $_REQUEST['zip'] ) : '', |
|
1006 | - 'ATT_phone' => ! empty( $_REQUEST['phone'] ) ? sanitize_text_field( $_REQUEST['phone'] ) : '', |
|
1005 | + 'ATT_zip' => ! empty($_REQUEST['zip']) ? sanitize_text_field($_REQUEST['zip']) : '', |
|
1006 | + 'ATT_phone' => ! empty($_REQUEST['phone']) ? sanitize_text_field($_REQUEST['phone']) : '', |
|
1007 | 1007 | ); |
1008 | 1008 | // validate the email address since it is the most important piece of info |
1009 | - if ( empty( $attendee_data['ATT_email'] ) || $attendee_data['ATT_email'] != $_REQUEST['email'] ) { |
|
1010 | - EE_Error::add_error( __( 'An invalid email address was submitted.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1009 | + if (empty($attendee_data['ATT_email']) || $attendee_data['ATT_email'] != $_REQUEST['email']) { |
|
1010 | + EE_Error::add_error(__('An invalid email address was submitted.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1011 | 1011 | } |
1012 | 1012 | // does this attendee already exist in the db ? we're searching using a combination of first name, last name, AND email address |
1013 | - if ( ! empty( $attendee_data['ATT_fname'] ) && ! empty( $attendee_data['ATT_lname'] ) && ! empty( $attendee_data['ATT_email'] ) ) { |
|
1014 | - $existing_attendee = EE_Registry::instance()->LIB->EEM_Attendee->find_existing_attendee( array( |
|
1013 | + if ( ! empty($attendee_data['ATT_fname']) && ! empty($attendee_data['ATT_lname']) && ! empty($attendee_data['ATT_email'])) { |
|
1014 | + $existing_attendee = EE_Registry::instance()->LIB->EEM_Attendee->find_existing_attendee(array( |
|
1015 | 1015 | 'ATT_fname' => $attendee_data['ATT_fname'], |
1016 | 1016 | 'ATT_lname' => $attendee_data['ATT_lname'], |
1017 | 1017 | 'ATT_email' => $attendee_data['ATT_email'] |
1018 | 1018 | )); |
1019 | - if ( $existing_attendee instanceof EE_Attendee ) { |
|
1019 | + if ($existing_attendee instanceof EE_Attendee) { |
|
1020 | 1020 | return $existing_attendee; |
1021 | 1021 | } |
1022 | 1022 | } |
1023 | 1023 | // no existing attendee? kk let's create a new one |
1024 | 1024 | // kinda lame, but we need a first and last name to create an attendee, so use the email address if those don't exist |
1025 | - $attendee_data['ATT_fname'] = ! empty( $attendee_data['ATT_fname'] ) ? $attendee_data['ATT_fname'] : $attendee_data['ATT_email']; |
|
1026 | - $attendee_data['ATT_lname'] = ! empty( $attendee_data['ATT_lname'] ) ? $attendee_data['ATT_lname'] : $attendee_data['ATT_email']; |
|
1027 | - return EE_Attendee::new_instance( $attendee_data ); |
|
1025 | + $attendee_data['ATT_fname'] = ! empty($attendee_data['ATT_fname']) ? $attendee_data['ATT_fname'] : $attendee_data['ATT_email']; |
|
1026 | + $attendee_data['ATT_lname'] = ! empty($attendee_data['ATT_lname']) ? $attendee_data['ATT_lname'] : $attendee_data['ATT_email']; |
|
1027 | + return EE_Attendee::new_instance($attendee_data); |
|
1028 | 1028 | } |
1029 | 1029 | |
1030 | 1030 | |
@@ -1044,22 +1044,22 @@ discard block |
||
1044 | 1044 | */ |
1045 | 1045 | public function process_reg_step() { |
1046 | 1046 | // how have they chosen to pay? |
1047 | - $this->checkout->selected_method_of_payment = $this->checkout->transaction->is_free() ? 'no_payment_required' : $this->_get_selected_method_of_payment( TRUE ); |
|
1047 | + $this->checkout->selected_method_of_payment = $this->checkout->transaction->is_free() ? 'no_payment_required' : $this->_get_selected_method_of_payment(TRUE); |
|
1048 | 1048 | // choose your own adventure based on method_of_payment |
1049 | - switch( $this->checkout->selected_method_of_payment ) { |
|
1049 | + switch ($this->checkout->selected_method_of_payment) { |
|
1050 | 1050 | |
1051 | 1051 | case 'events_sold_out' : |
1052 | 1052 | $this->checkout->redirect = TRUE; |
1053 | 1053 | $this->checkout->redirect_url = $this->checkout->cancel_page_url; |
1054 | - $this->checkout->json_response->set_redirect_url( $this->checkout->redirect_url ); |
|
1054 | + $this->checkout->json_response->set_redirect_url($this->checkout->redirect_url); |
|
1055 | 1055 | // mark this reg step as completed |
1056 | 1056 | $this->set_completed(); |
1057 | 1057 | return FALSE; |
1058 | 1058 | break; |
1059 | 1059 | |
1060 | 1060 | case 'payments_closed' : |
1061 | - if ( apply_filters( 'FHEE__EE_SPCO_Reg_Step_Payment_Options__process_reg_step__payments_closed__display_success', false ) ) { |
|
1062 | - EE_Error::add_success( __( 'no payment required at this time.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1061 | + if (apply_filters('FHEE__EE_SPCO_Reg_Step_Payment_Options__process_reg_step__payments_closed__display_success', false)) { |
|
1062 | + EE_Error::add_success(__('no payment required at this time.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1063 | 1063 | } |
1064 | 1064 | // mark this reg step as completed |
1065 | 1065 | $this->set_completed(); |
@@ -1067,8 +1067,8 @@ discard block |
||
1067 | 1067 | break; |
1068 | 1068 | |
1069 | 1069 | case 'no_payment_required' : |
1070 | - if ( apply_filters( 'FHEE__EE_SPCO_Reg_Step_Payment_Options__process_reg_step__no_payment_required__display_success', false ) ) { |
|
1071 | - EE_Error::add_success( __( 'no payment required.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1070 | + if (apply_filters('FHEE__EE_SPCO_Reg_Step_Payment_Options__process_reg_step__no_payment_required__display_success', false)) { |
|
1071 | + EE_Error::add_success(__('no payment required.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1072 | 1072 | } |
1073 | 1073 | // mark this reg step as completed |
1074 | 1074 | $this->set_completed(); |
@@ -1077,9 +1077,9 @@ discard block |
||
1077 | 1077 | |
1078 | 1078 | default: |
1079 | 1079 | $payment_successful = $this->_process_payment(); |
1080 | - if ( $payment_successful ) { |
|
1080 | + if ($payment_successful) { |
|
1081 | 1081 | $this->checkout->continue_reg = true; |
1082 | - $this->_maybe_set_completed( $this->checkout->payment_method ); |
|
1082 | + $this->_maybe_set_completed($this->checkout->payment_method); |
|
1083 | 1083 | } else { |
1084 | 1084 | $this->checkout->continue_reg = false; |
1085 | 1085 | } |
@@ -1097,8 +1097,8 @@ discard block |
||
1097 | 1097 | * @param \EE_Payment_Method $payment_method |
1098 | 1098 | * @return void |
1099 | 1099 | */ |
1100 | - protected function _maybe_set_completed( EE_Payment_Method $payment_method ) { |
|
1101 | - switch ( $payment_method->type_obj()->payment_occurs() ) { |
|
1100 | + protected function _maybe_set_completed(EE_Payment_Method $payment_method) { |
|
1101 | + switch ($payment_method->type_obj()->payment_occurs()) { |
|
1102 | 1102 | case EE_PMT_Base::offsite : |
1103 | 1103 | break; |
1104 | 1104 | case EE_PMT_Base::onsite : |
@@ -1121,15 +1121,15 @@ discard block |
||
1121 | 1121 | public function update_reg_step() { |
1122 | 1122 | $success = TRUE; |
1123 | 1123 | // if payment required |
1124 | - if ( $this->checkout->transaction->total() > 0 ) { |
|
1125 | - do_action ('AHEE__EE_Single_Page_Checkout__process_finalize_registration__before_gateway', $this->checkout->transaction ); |
|
1124 | + if ($this->checkout->transaction->total() > 0) { |
|
1125 | + do_action('AHEE__EE_Single_Page_Checkout__process_finalize_registration__before_gateway', $this->checkout->transaction); |
|
1126 | 1126 | // attempt payment via payment method |
1127 | 1127 | $success = $this->process_reg_step(); |
1128 | 1128 | } |
1129 | - if ( $success && ! $this->checkout->redirect ) { |
|
1130 | - $this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn( $this->checkout->transaction->ID() ); |
|
1129 | + if ($success && ! $this->checkout->redirect) { |
|
1130 | + $this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn($this->checkout->transaction->ID()); |
|
1131 | 1131 | // set return URL |
1132 | - $this->checkout->redirect_url = add_query_arg( array( 'e_reg_url_link' => $this->checkout->reg_url_link ), $this->checkout->thank_you_page_url ); |
|
1132 | + $this->checkout->redirect_url = add_query_arg(array('e_reg_url_link' => $this->checkout->reg_url_link), $this->checkout->thank_you_page_url); |
|
1133 | 1133 | } |
1134 | 1134 | return $success; |
1135 | 1135 | } |
@@ -1149,24 +1149,24 @@ discard block |
||
1149 | 1149 | // clear any previous errors related to not selecting a payment method |
1150 | 1150 | // EE_Error::overwrite_errors(); |
1151 | 1151 | // ya gotta make a choice man |
1152 | - if ( empty( $this->checkout->selected_method_of_payment )) { |
|
1153 | - $this->checkout->json_response->set_plz_select_method_of_payment( __( 'Please select a method of payment before proceeding.', 'event_espresso' )); |
|
1152 | + if (empty($this->checkout->selected_method_of_payment)) { |
|
1153 | + $this->checkout->json_response->set_plz_select_method_of_payment(__('Please select a method of payment before proceeding.', 'event_espresso')); |
|
1154 | 1154 | return FALSE; |
1155 | 1155 | } |
1156 | 1156 | // get EE_Payment_Method object |
1157 | - if ( ! $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment() ) { |
|
1157 | + if ( ! $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment()) { |
|
1158 | 1158 | return FALSE; |
1159 | 1159 | } |
1160 | 1160 | // setup billing form |
1161 | - if ( $this->checkout->payment_method->is_on_site() ) { |
|
1162 | - $this->checkout->billing_form = $this->_get_billing_form_for_payment_method( $this->checkout->payment_method ); |
|
1161 | + if ($this->checkout->payment_method->is_on_site()) { |
|
1162 | + $this->checkout->billing_form = $this->_get_billing_form_for_payment_method($this->checkout->payment_method); |
|
1163 | 1163 | // bad billing form ? |
1164 | - if ( ! $this->_billing_form_is_valid() ) { |
|
1164 | + if ( ! $this->_billing_form_is_valid()) { |
|
1165 | 1165 | return FALSE; |
1166 | 1166 | } |
1167 | 1167 | } |
1168 | 1168 | // ensure primary registrant has been fully processed |
1169 | - if ( ! $this->_setup_primary_registrant_prior_to_payment() ) { |
|
1169 | + if ( ! $this->_setup_primary_registrant_prior_to_payment()) { |
|
1170 | 1170 | return FALSE; |
1171 | 1171 | } |
1172 | 1172 | /** @type EE_Transaction_Processor $transaction_processor */ |
@@ -1174,24 +1174,24 @@ discard block |
||
1174 | 1174 | // in case a registrant leaves to an Off-Site Gateway and never returns, we want to approve any registrations for events with a default reg status of Approved |
1175 | 1175 | //$transaction_processor->toggle_registration_statuses_for_default_approved_events( $this->checkout->transaction, $this->checkout->reg_cache_where_params ); |
1176 | 1176 | // attempt payment |
1177 | - $payment = $this->_attempt_payment( $this->checkout->payment_method ); |
|
1177 | + $payment = $this->_attempt_payment($this->checkout->payment_method); |
|
1178 | 1178 | // process results |
1179 | - $payment = $this->_validate_payment( $payment ); |
|
1180 | - $payment = $this->_post_payment_processing( $payment ); |
|
1179 | + $payment = $this->_validate_payment($payment); |
|
1180 | + $payment = $this->_post_payment_processing($payment); |
|
1181 | 1181 | // verify payment |
1182 | - if ( $payment instanceof EE_Payment ) { |
|
1182 | + if ($payment instanceof EE_Payment) { |
|
1183 | 1183 | // store that for later |
1184 | 1184 | $this->checkout->payment = $payment; |
1185 | 1185 | /** @type EE_Transaction_Processor $transaction_processor */ |
1186 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
1186 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
1187 | 1187 | // we can also consider the TXN to not have been failed, so temporarily upgrade it's status to abandoned |
1188 | - $transaction_processor->toggle_failed_transaction_status( $this->checkout->transaction ); |
|
1189 | - if ( $payment->status() == EEM_Payment::status_id_approved || $payment->status() == EEM_Payment::status_id_pending ) { |
|
1188 | + $transaction_processor->toggle_failed_transaction_status($this->checkout->transaction); |
|
1189 | + if ($payment->status() == EEM_Payment::status_id_approved || $payment->status() == EEM_Payment::status_id_pending) { |
|
1190 | 1190 | return true; |
1191 | 1191 | } else { |
1192 | 1192 | return false; |
1193 | 1193 | } |
1194 | - } else if ( $payment === true ) { |
|
1194 | + } else if ($payment === true) { |
|
1195 | 1195 | // please note that offline payment methods will NOT make a payment, |
1196 | 1196 | // but instead just mark themselves as the PMD_ID on the transaction, and return true |
1197 | 1197 | $this->checkout->payment = $payment; |
@@ -1210,10 +1210,10 @@ discard block |
||
1210 | 1210 | * @return bool |
1211 | 1211 | */ |
1212 | 1212 | public function redirect_form() { |
1213 | - $payment_method_billing_info = $this->_payment_method_billing_info( $this->_get_payment_method_for_selected_method_of_payment() ); |
|
1213 | + $payment_method_billing_info = $this->_payment_method_billing_info($this->_get_payment_method_for_selected_method_of_payment()); |
|
1214 | 1214 | $html = $payment_method_billing_info->get_html_and_js(); |
1215 | 1215 | $html .= $this->checkout->redirect_form; |
1216 | - EE_Registry::instance()->REQ->add_output( $html ); |
|
1216 | + EE_Registry::instance()->REQ->add_output($html); |
|
1217 | 1217 | return TRUE; |
1218 | 1218 | } |
1219 | 1219 | |
@@ -1226,33 +1226,33 @@ discard block |
||
1226 | 1226 | * @return bool |
1227 | 1227 | */ |
1228 | 1228 | private function _billing_form_is_valid() { |
1229 | - if ( $this->checkout->billing_form instanceof EE_Billing_Info_Form ) { |
|
1230 | - if ( $this->checkout->billing_form->was_submitted() ) { |
|
1229 | + if ($this->checkout->billing_form instanceof EE_Billing_Info_Form) { |
|
1230 | + if ($this->checkout->billing_form->was_submitted()) { |
|
1231 | 1231 | $this->checkout->billing_form->receive_form_submission(); |
1232 | - if ( $this->checkout->billing_form->is_valid() ) { |
|
1232 | + if ($this->checkout->billing_form->is_valid()) { |
|
1233 | 1233 | return TRUE; |
1234 | 1234 | } |
1235 | 1235 | $validation_errors = $this->checkout->billing_form->get_validation_errors_accumulated(); |
1236 | 1236 | $error_strings = array(); |
1237 | - foreach( $validation_errors as $validation_error ){ |
|
1238 | - if( $validation_error instanceof EE_Validation_Error ){ |
|
1237 | + foreach ($validation_errors as $validation_error) { |
|
1238 | + if ($validation_error instanceof EE_Validation_Error) { |
|
1239 | 1239 | $form_section = $validation_error->get_form_section(); |
1240 | - if( $form_section instanceof EE_Form_Input_Base ){ |
|
1240 | + if ($form_section instanceof EE_Form_Input_Base) { |
|
1241 | 1241 | $label = $form_section->html_label_text(); |
1242 | - }elseif( $form_section instanceof EE_Form_Section_Base ){ |
|
1242 | + }elseif ($form_section instanceof EE_Form_Section_Base) { |
|
1243 | 1243 | $label = $form_section->name(); |
1244 | - }else{ |
|
1245 | - $label = __( 'Validation Error', 'event_espresso' ); |
|
1244 | + } else { |
|
1245 | + $label = __('Validation Error', 'event_espresso'); |
|
1246 | 1246 | } |
1247 | - $error_strings[] = sprintf('%1$s: %2$s', $label, $validation_error->getMessage() ); |
|
1247 | + $error_strings[] = sprintf('%1$s: %2$s', $label, $validation_error->getMessage()); |
|
1248 | 1248 | } |
1249 | 1249 | } |
1250 | - EE_Error::add_error( sprintf( __( 'One or more billing form inputs are invalid and require correction before proceeding. %1$s %2$s', 'event_espresso' ), '<br/>', implode( '<br/>', $error_strings ) ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1250 | + EE_Error::add_error(sprintf(__('One or more billing form inputs are invalid and require correction before proceeding. %1$s %2$s', 'event_espresso'), '<br/>', implode('<br/>', $error_strings)), __FILE__, __FUNCTION__, __LINE__); |
|
1251 | 1251 | } else { |
1252 | - EE_Error::add_error( __( 'The billing form was not submitted or something prevented it\'s submission.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1252 | + EE_Error::add_error(__('The billing form was not submitted or something prevented it\'s submission.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1253 | 1253 | } |
1254 | 1254 | } else { |
1255 | - EE_Error::add_error( __( 'The submitted billing form is invalid possibly due to a technical reason.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1255 | + EE_Error::add_error(__('The submitted billing form is invalid possibly due to a technical reason.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1256 | 1256 | } |
1257 | 1257 | return FALSE; |
1258 | 1258 | } |
@@ -1270,9 +1270,9 @@ discard block |
||
1270 | 1270 | */ |
1271 | 1271 | private function _setup_primary_registrant_prior_to_payment() { |
1272 | 1272 | // check if transaction has a primary registrant and that it has a related Attendee object |
1273 | - if ( ! $this->checkout->transaction_has_primary_registrant() ) { |
|
1273 | + if ( ! $this->checkout->transaction_has_primary_registrant()) { |
|
1274 | 1274 | // need to at least gather some primary registrant data before attempting payment |
1275 | - if ( $this->checkout->billing_form instanceof EE_Billing_Attendee_Info_Form && ! $this->_capture_primary_registration_data_from_billing_form() ) { |
|
1275 | + if ($this->checkout->billing_form instanceof EE_Billing_Attendee_Info_Form && ! $this->_capture_primary_registration_data_from_billing_form()) { |
|
1276 | 1276 | return FALSE; |
1277 | 1277 | } |
1278 | 1278 | } |
@@ -1280,13 +1280,13 @@ discard block |
||
1280 | 1280 | // grab the primary_registration object |
1281 | 1281 | $primary_registration = $this->checkout->transaction->primary_registration(); |
1282 | 1282 | /** @type EE_Transaction_Processor $transaction_processor */ |
1283 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
1283 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
1284 | 1284 | // at this point we'll consider a TXN to not have been failed |
1285 | - $transaction_processor->toggle_failed_transaction_status( $this->checkout->transaction ); |
|
1285 | + $transaction_processor->toggle_failed_transaction_status($this->checkout->transaction); |
|
1286 | 1286 | // save the TXN ( which clears cached copy of primary_registration) |
1287 | 1287 | $this->checkout->transaction->save(); |
1288 | 1288 | // grab TXN ID and save it to the primary_registration |
1289 | - $primary_registration->set_transaction_id( $this->checkout->transaction->ID() ); |
|
1289 | + $primary_registration->set_transaction_id($this->checkout->transaction->ID()); |
|
1290 | 1290 | // save what we have so far |
1291 | 1291 | $primary_registration->save(); |
1292 | 1292 | return TRUE; |
@@ -1303,41 +1303,41 @@ discard block |
||
1303 | 1303 | private function _capture_primary_registration_data_from_billing_form() { |
1304 | 1304 | // convert billing form data into an attendee |
1305 | 1305 | $this->checkout->primary_attendee_obj = $this->checkout->billing_form->create_attendee_from_billing_form_data(); |
1306 | - if ( ! $this->checkout->primary_attendee_obj instanceof EE_Attendee ) { |
|
1306 | + if ( ! $this->checkout->primary_attendee_obj instanceof EE_Attendee) { |
|
1307 | 1307 | EE_Error::add_error( |
1308 | 1308 | sprintf( |
1309 | - __( 'The billing form details could not be used for attendee details due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso' ), |
|
1309 | + __('The billing form details could not be used for attendee details due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso'), |
|
1310 | 1310 | '<br/>', |
1311 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) |
|
1311 | + EE_Registry::instance()->CFG->organization->get_pretty('email') |
|
1312 | 1312 | ), __FILE__, __FUNCTION__, __LINE__ |
1313 | 1313 | ); |
1314 | 1314 | return FALSE; |
1315 | 1315 | } |
1316 | 1316 | $primary_registration = $this->checkout->transaction->primary_registration(); |
1317 | - if ( ! $primary_registration instanceof EE_Registration ) { |
|
1317 | + if ( ! $primary_registration instanceof EE_Registration) { |
|
1318 | 1318 | EE_Error::add_error( |
1319 | 1319 | sprintf( |
1320 | - __( 'The primary registrant for this transaction could not be determined due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso' ), |
|
1320 | + __('The primary registrant for this transaction could not be determined due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso'), |
|
1321 | 1321 | '<br/>', |
1322 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) |
|
1322 | + EE_Registry::instance()->CFG->organization->get_pretty('email') |
|
1323 | 1323 | ), __FILE__, __FUNCTION__, __LINE__ |
1324 | 1324 | ); |
1325 | 1325 | return FALSE; |
1326 | 1326 | } |
1327 | - if ( ! $primary_registration->_add_relation_to( $this->checkout->primary_attendee_obj, 'Attendee' ) instanceof EE_Attendee ) { |
|
1327 | + if ( ! $primary_registration->_add_relation_to($this->checkout->primary_attendee_obj, 'Attendee') instanceof EE_Attendee) { |
|
1328 | 1328 | EE_Error::add_error( |
1329 | 1329 | sprintf( |
1330 | - __( 'The primary registrant could not be associated with this transaction due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso' ), |
|
1330 | + __('The primary registrant could not be associated with this transaction due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso'), |
|
1331 | 1331 | '<br/>', |
1332 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) |
|
1332 | + EE_Registry::instance()->CFG->organization->get_pretty('email') |
|
1333 | 1333 | ), __FILE__, __FUNCTION__, __LINE__ |
1334 | 1334 | ); |
1335 | 1335 | return FALSE; |
1336 | 1336 | } |
1337 | 1337 | /** @type EE_Registration_Processor $registration_processor */ |
1338 | - $registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' ); |
|
1338 | + $registration_processor = EE_Registry::instance()->load_class('Registration_Processor'); |
|
1339 | 1339 | // at this point, we should have enough details about the registrant to consider the registration NOT incomplete |
1340 | - $registration_processor->toggle_incomplete_registration_status_to_default( $primary_registration ); |
|
1340 | + $registration_processor->toggle_incomplete_registration_status_to_default($primary_registration); |
|
1341 | 1341 | |
1342 | 1342 | return TRUE; |
1343 | 1343 | } |
@@ -1353,35 +1353,35 @@ discard block |
||
1353 | 1353 | */ |
1354 | 1354 | private function _get_payment_method_for_selected_method_of_payment() { |
1355 | 1355 | // get EE_Payment_Method object |
1356 | - if ( isset( $this->checkout->available_payment_methods[ $this->checkout->selected_method_of_payment ] )) { |
|
1357 | - $payment_method = $this->checkout->available_payment_methods[ $this->checkout->selected_method_of_payment ]; |
|
1356 | + if (isset($this->checkout->available_payment_methods[$this->checkout->selected_method_of_payment])) { |
|
1357 | + $payment_method = $this->checkout->available_payment_methods[$this->checkout->selected_method_of_payment]; |
|
1358 | 1358 | } else { |
1359 | 1359 | // load EEM_Payment_Method |
1360 | - EE_Registry::instance()->load_model( 'Payment_Method' ); |
|
1360 | + EE_Registry::instance()->load_model('Payment_Method'); |
|
1361 | 1361 | /** @type EEM_Payment_Method $EEM_Payment_Method */ |
1362 | 1362 | $EEM_Payment_Method = EE_Registry::instance()->LIB->EEM_Payment_Method; |
1363 | - $payment_method = $EEM_Payment_Method->get_one_by_slug( $this->checkout->selected_method_of_payment ); |
|
1363 | + $payment_method = $EEM_Payment_Method->get_one_by_slug($this->checkout->selected_method_of_payment); |
|
1364 | 1364 | } |
1365 | 1365 | // verify $payment_method |
1366 | - if ( ! $payment_method instanceof EE_Payment_Method ) { |
|
1366 | + if ( ! $payment_method instanceof EE_Payment_Method) { |
|
1367 | 1367 | // not a payment |
1368 | 1368 | EE_Error::add_error( |
1369 | 1369 | sprintf( |
1370 | - __( 'The selected method of payment could not be determined due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso' ), |
|
1370 | + __('The selected method of payment could not be determined due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso'), |
|
1371 | 1371 | '<br/>', |
1372 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) |
|
1372 | + EE_Registry::instance()->CFG->organization->get_pretty('email') |
|
1373 | 1373 | ), __FILE__, __FUNCTION__, __LINE__ |
1374 | 1374 | ); |
1375 | 1375 | return NULL; |
1376 | 1376 | } |
1377 | 1377 | // and verify it has a valid Payment_Method Type object |
1378 | - if ( ! $payment_method->type_obj() instanceof EE_PMT_Base ) { |
|
1378 | + if ( ! $payment_method->type_obj() instanceof EE_PMT_Base) { |
|
1379 | 1379 | // not a payment |
1380 | 1380 | EE_Error::add_error( |
1381 | 1381 | sprintf( |
1382 | - __( 'A valid payment method could not be determined due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso' ), |
|
1382 | + __('A valid payment method could not be determined due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso'), |
|
1383 | 1383 | '<br/>', |
1384 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) |
|
1384 | + EE_Registry::instance()->CFG->organization->get_pretty('email') |
|
1385 | 1385 | ), __FILE__, __FUNCTION__, __LINE__ |
1386 | 1386 | ); |
1387 | 1387 | return NULL; |
@@ -1400,30 +1400,30 @@ discard block |
||
1400 | 1400 | * @type EE_Payment_Method $payment_method |
1401 | 1401 | * @return mixed EE_Payment | boolean |
1402 | 1402 | */ |
1403 | - private function _attempt_payment( EE_Payment_Method $payment_method ) { |
|
1404 | - $payment =NULL; |
|
1403 | + private function _attempt_payment(EE_Payment_Method $payment_method) { |
|
1404 | + $payment = NULL; |
|
1405 | 1405 | $this->checkout->transaction->save(); |
1406 | - $payment_processor = EE_Registry::instance()->load_core( 'Payment_Processor' ); |
|
1407 | - if ( ! $payment_processor instanceof EE_Payment_Processor ) { |
|
1406 | + $payment_processor = EE_Registry::instance()->load_core('Payment_Processor'); |
|
1407 | + if ( ! $payment_processor instanceof EE_Payment_Processor) { |
|
1408 | 1408 | return FALSE; |
1409 | 1409 | } |
1410 | 1410 | try { |
1411 | - $payment_processor->set_revisit( $this->checkout->revisit ); |
|
1411 | + $payment_processor->set_revisit($this->checkout->revisit); |
|
1412 | 1412 | // generate payment object |
1413 | 1413 | $payment = $payment_processor->process_payment( |
1414 | 1414 | $payment_method, |
1415 | 1415 | $this->checkout->transaction, |
1416 | 1416 | $this->checkout->amount_owing, |
1417 | 1417 | $this->checkout->billing_form, |
1418 | - $this->_get_return_url( $payment_method ), |
|
1418 | + $this->_get_return_url($payment_method), |
|
1419 | 1419 | 'CART', |
1420 | 1420 | $this->checkout->admin_request, |
1421 | 1421 | TRUE, |
1422 | 1422 | $this->reg_step_url() |
1423 | 1423 | ); |
1424 | 1424 | |
1425 | - } catch( Exception $e ) { |
|
1426 | - $this->_handle_payment_processor_exception( $e ); |
|
1425 | + } catch (Exception $e) { |
|
1426 | + $this->_handle_payment_processor_exception($e); |
|
1427 | 1427 | } |
1428 | 1428 | return $payment; |
1429 | 1429 | } |
@@ -1437,12 +1437,12 @@ discard block |
||
1437 | 1437 | * @param \Exception $e |
1438 | 1438 | * @return void |
1439 | 1439 | */ |
1440 | - protected function _handle_payment_processor_exception( Exception $e ) { |
|
1440 | + protected function _handle_payment_processor_exception(Exception $e) { |
|
1441 | 1441 | EE_Error::add_error( |
1442 | 1442 | sprintf( |
1443 | - __( 'The payment could not br processed due to a technical issue.%1$sPlease try again or contact %2$s for assistance.||The following Exception was thrown in %4$s on line %5$s:%1$s%3$s', 'event_espresso' ), |
|
1443 | + __('The payment could not br processed due to a technical issue.%1$sPlease try again or contact %2$s for assistance.||The following Exception was thrown in %4$s on line %5$s:%1$s%3$s', 'event_espresso'), |
|
1444 | 1444 | '<br/>', |
1445 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ), |
|
1445 | + EE_Registry::instance()->CFG->organization->get_pretty('email'), |
|
1446 | 1446 | $e->getMessage(), |
1447 | 1447 | $e->getFile(), |
1448 | 1448 | $e->getLine() |
@@ -1459,9 +1459,9 @@ discard block |
||
1459 | 1459 | * @param \EE_Payment_Method $payment_method |
1460 | 1460 | * @return string |
1461 | 1461 | */ |
1462 | - protected function _get_return_url( EE_Payment_Method $payment_method ) { |
|
1462 | + protected function _get_return_url(EE_Payment_Method $payment_method) { |
|
1463 | 1463 | $return_url = ''; |
1464 | - switch ( $payment_method->type_obj()->payment_occurs() ) { |
|
1464 | + switch ($payment_method->type_obj()->payment_occurs()) { |
|
1465 | 1465 | |
1466 | 1466 | case EE_PMT_Base::offsite : |
1467 | 1467 | $return_url = add_query_arg( |
@@ -1492,27 +1492,27 @@ discard block |
||
1492 | 1492 | * @param EE_Payment $payment |
1493 | 1493 | * @return EE_Payment | FALSE |
1494 | 1494 | */ |
1495 | - private function _validate_payment( $payment = NULL ) { |
|
1496 | - if ( $this->checkout->payment_method->is_off_line() ) { |
|
1495 | + private function _validate_payment($payment = NULL) { |
|
1496 | + if ($this->checkout->payment_method->is_off_line()) { |
|
1497 | 1497 | return TRUE; |
1498 | 1498 | } |
1499 | 1499 | // verify payment object |
1500 | - if ( $payment instanceof EE_Payment ) { |
|
1500 | + if ($payment instanceof EE_Payment) { |
|
1501 | 1501 | if ( |
1502 | 1502 | $payment->status() != EEM_Payment::status_id_approved |
1503 | 1503 | && $payment->status() != EEM_Payment::status_id_pending |
1504 | 1504 | && $payment->status() != EEM_Payment::status_id_cancelled |
1505 | 1505 | && $payment->gateway_response() != '' |
1506 | 1506 | ) { |
1507 | - EE_Error::add_error( $payment->gateway_response(), __FILE__, __FUNCTION__, __LINE__ ); |
|
1507 | + EE_Error::add_error($payment->gateway_response(), __FILE__, __FUNCTION__, __LINE__); |
|
1508 | 1508 | } |
1509 | 1509 | } else { |
1510 | 1510 | // not a payment |
1511 | 1511 | EE_Error::add_error( |
1512 | 1512 | sprintf( |
1513 | - __( 'A valid payment was not generated due to a technical issue.%1$sPlease try again or contact %2$s for assistance.', 'event_espresso' ), |
|
1513 | + __('A valid payment was not generated due to a technical issue.%1$sPlease try again or contact %2$s for assistance.', 'event_espresso'), |
|
1514 | 1514 | '<br/>', |
1515 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) |
|
1515 | + EE_Registry::instance()->CFG->organization->get_pretty('email') |
|
1516 | 1516 | ), __FILE__, __FUNCTION__, __LINE__ |
1517 | 1517 | ); |
1518 | 1518 | return FALSE; |
@@ -1529,23 +1529,23 @@ discard block |
||
1529 | 1529 | * @param EE_Payment $payment |
1530 | 1530 | * @return bool |
1531 | 1531 | */ |
1532 | - private function _post_payment_processing( $payment = NULL ) { |
|
1532 | + private function _post_payment_processing($payment = NULL) { |
|
1533 | 1533 | // On-Site payment? |
1534 | - if ( $this->checkout->payment_method->is_on_site() ) { |
|
1535 | - if ( ! $this->_process_payment_status( $payment, EE_PMT_Base::onsite )) { |
|
1534 | + if ($this->checkout->payment_method->is_on_site()) { |
|
1535 | + if ( ! $this->_process_payment_status($payment, EE_PMT_Base::onsite)) { |
|
1536 | 1536 | //$this->_setup_redirect_for_next_step(); |
1537 | 1537 | $this->checkout->continue_reg = false; |
1538 | 1538 | } |
1539 | 1539 | // Off-Site payment? |
1540 | - } else if ( $this->checkout->payment_method->is_off_site() ) { |
|
1540 | + } else if ($this->checkout->payment_method->is_off_site()) { |
|
1541 | 1541 | // if a payment object was made and it specifies a redirect url, then we'll setup that redirect info |
1542 | - if ( $payment instanceof EE_Payment && $payment->redirect_url() ){ |
|
1543 | - do_action( 'AHEE_log', __CLASS__, __FUNCTION__, $payment->redirect_url(), '$payment->redirect_url()' ); |
|
1542 | + if ($payment instanceof EE_Payment && $payment->redirect_url()) { |
|
1543 | + do_action('AHEE_log', __CLASS__, __FUNCTION__, $payment->redirect_url(), '$payment->redirect_url()'); |
|
1544 | 1544 | $this->checkout->redirect = TRUE; |
1545 | 1545 | $this->checkout->redirect_form = $payment->redirect_form(); |
1546 | - $this->checkout->redirect_url = $this->reg_step_url( 'redirect_form' ); |
|
1546 | + $this->checkout->redirect_url = $this->reg_step_url('redirect_form'); |
|
1547 | 1547 | // set JSON response |
1548 | - $this->checkout->json_response->set_redirect_form( $this->checkout->redirect_form ); |
|
1548 | + $this->checkout->json_response->set_redirect_form($this->checkout->redirect_form); |
|
1549 | 1549 | // set cron job for finalizing the TXN |
1550 | 1550 | // in case the user does not return from the off-site gateway |
1551 | 1551 | EE_Cron_Tasks::schedule_finalize_abandoned_transactions_check( |
@@ -1553,21 +1553,21 @@ discard block |
||
1553 | 1553 | $this->checkout->transaction->ID() |
1554 | 1554 | ); |
1555 | 1555 | // and lastly, let's bump the payment status to pending |
1556 | - $payment->set_status( EEM_Payment::status_id_pending ); |
|
1556 | + $payment->set_status(EEM_Payment::status_id_pending); |
|
1557 | 1557 | $payment->save(); |
1558 | 1558 | } else { |
1559 | 1559 | // not a payment |
1560 | 1560 | $this->checkout->continue_reg = false; |
1561 | 1561 | EE_Error::add_error( |
1562 | 1562 | sprintf( |
1563 | - __( 'It appears the Off Site Payment Method was not configured properly.%sPlease try again or contact %s for assistance.', 'event_espresso' ), |
|
1563 | + __('It appears the Off Site Payment Method was not configured properly.%sPlease try again or contact %s for assistance.', 'event_espresso'), |
|
1564 | 1564 | '<br/>', |
1565 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) |
|
1565 | + EE_Registry::instance()->CFG->organization->get_pretty('email') |
|
1566 | 1566 | ), __FILE__, __FUNCTION__, __LINE__ |
1567 | 1567 | ); |
1568 | 1568 | } |
1569 | 1569 | // Off-Line payment? |
1570 | - } else if ( $payment === TRUE ) { |
|
1570 | + } else if ($payment === TRUE) { |
|
1571 | 1571 | //$this->_setup_redirect_for_next_step(); |
1572 | 1572 | return TRUE; |
1573 | 1573 | } else { |
@@ -1603,65 +1603,65 @@ discard block |
||
1603 | 1603 | * @return bool |
1604 | 1604 | * @throws \EE_Error |
1605 | 1605 | */ |
1606 | - private function _process_payment_status( $payment, $payment_occurs = EE_PMT_Base::offline ) { |
|
1606 | + private function _process_payment_status($payment, $payment_occurs = EE_PMT_Base::offline) { |
|
1607 | 1607 | // off-line payment? carry on |
1608 | - if ( $payment_occurs == EE_PMT_Base::offline ) { |
|
1608 | + if ($payment_occurs == EE_PMT_Base::offline) { |
|
1609 | 1609 | return true; |
1610 | 1610 | } |
1611 | 1611 | // verify payment validity |
1612 | - if ( $payment instanceof EE_Payment ) { |
|
1613 | - do_action( 'AHEE_log', __CLASS__, __FUNCTION__, $payment->status(), '$payment->status()' ); |
|
1612 | + if ($payment instanceof EE_Payment) { |
|
1613 | + do_action('AHEE_log', __CLASS__, __FUNCTION__, $payment->status(), '$payment->status()'); |
|
1614 | 1614 | $msg = $payment->gateway_response(); |
1615 | 1615 | // check results |
1616 | - switch ( $payment->status() ) { |
|
1616 | + switch ($payment->status()) { |
|
1617 | 1617 | |
1618 | 1618 | // good payment |
1619 | 1619 | case EEM_Payment::status_id_approved : |
1620 | - EE_Error::add_success( __( 'Your payment was processed successfully.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1620 | + EE_Error::add_success(__('Your payment was processed successfully.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1621 | 1621 | return TRUE; |
1622 | 1622 | break; |
1623 | 1623 | |
1624 | 1624 | // slow payment |
1625 | 1625 | case EEM_Payment::status_id_pending : |
1626 | - if ( empty( $msg )) { |
|
1627 | - $msg = __( 'Your payment appears to have been processed successfully, but the Instant Payment Notification has not yet been received. It should arrive shortly.', 'event_espresso' ); |
|
1626 | + if (empty($msg)) { |
|
1627 | + $msg = __('Your payment appears to have been processed successfully, but the Instant Payment Notification has not yet been received. It should arrive shortly.', 'event_espresso'); |
|
1628 | 1628 | } |
1629 | - EE_Error::add_success( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1629 | + EE_Error::add_success($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1630 | 1630 | return TRUE; |
1631 | 1631 | break; |
1632 | 1632 | |
1633 | 1633 | // don't wanna payment |
1634 | 1634 | case EEM_Payment::status_id_cancelled : |
1635 | - if ( empty( $msg )) { |
|
1635 | + if (empty($msg)) { |
|
1636 | 1636 | $msg = _n( |
1637 | 1637 | 'Payment cancelled. Please try again.', |
1638 | 1638 | 'Payment cancelled. Please try again or select another method of payment.', |
1639 | - count( $this->checkout->available_payment_methods ), |
|
1639 | + count($this->checkout->available_payment_methods), |
|
1640 | 1640 | 'event_espresso' |
1641 | 1641 | ); |
1642 | 1642 | } |
1643 | - EE_Error::add_attention( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1643 | + EE_Error::add_attention($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1644 | 1644 | return FALSE; |
1645 | 1645 | break; |
1646 | 1646 | |
1647 | 1647 | // not enough payment |
1648 | 1648 | case EEM_Payment::status_id_declined : |
1649 | - if ( empty( $msg )) { |
|
1649 | + if (empty($msg)) { |
|
1650 | 1650 | $msg = _n( |
1651 | 1651 | 'We\'re sorry but your payment was declined. Please try again.', |
1652 | 1652 | 'We\'re sorry but your payment was declined. Please try again or select another method of payment.', |
1653 | - count( $this->checkout->available_payment_methods ), |
|
1653 | + count($this->checkout->available_payment_methods), |
|
1654 | 1654 | 'event_espresso' |
1655 | 1655 | ); |
1656 | 1656 | } |
1657 | - EE_Error::add_attention( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1657 | + EE_Error::add_attention($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1658 | 1658 | return FALSE; |
1659 | 1659 | break; |
1660 | 1660 | |
1661 | 1661 | // bad payment |
1662 | 1662 | case EEM_Payment::status_id_failed : |
1663 | - if ( ! empty( $msg ) ) { |
|
1664 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1663 | + if ( ! empty($msg)) { |
|
1664 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1665 | 1665 | return false; |
1666 | 1666 | } |
1667 | 1667 | // default to error below |
@@ -1671,14 +1671,14 @@ discard block |
||
1671 | 1671 | } |
1672 | 1672 | // off-site payment gateway responses are too unreliable, so let's just assume that |
1673 | 1673 | // the payment processing is just running slower than the registrant's request |
1674 | - if ( $payment_occurs == EE_PMT_Base::offsite ) { |
|
1674 | + if ($payment_occurs == EE_PMT_Base::offsite) { |
|
1675 | 1675 | return true; |
1676 | 1676 | } |
1677 | 1677 | EE_Error::add_error( |
1678 | 1678 | sprintf( |
1679 | - __( 'Your payment could not be processed successfully due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso' ), |
|
1679 | + __('Your payment could not be processed successfully due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso'), |
|
1680 | 1680 | '<br/>', |
1681 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) |
|
1681 | + EE_Registry::instance()->CFG->organization->get_pretty('email') |
|
1682 | 1682 | ), |
1683 | 1683 | __FILE__, __FUNCTION__, __LINE__ |
1684 | 1684 | ); |
@@ -1711,13 +1711,13 @@ discard block |
||
1711 | 1711 | public function process_gateway_response() { |
1712 | 1712 | $payment = null; |
1713 | 1713 | // how have they chosen to pay? |
1714 | - $this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment( true ); |
|
1714 | + $this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment(true); |
|
1715 | 1715 | // get EE_Payment_Method object |
1716 | - if ( ! $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment() ) { |
|
1716 | + if ( ! $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment()) { |
|
1717 | 1717 | $this->checkout->continue_reg = false; |
1718 | 1718 | return false; |
1719 | 1719 | } |
1720 | - if ( ! $this->checkout->payment_method->is_off_site() ) { |
|
1720 | + if ( ! $this->checkout->payment_method->is_off_site()) { |
|
1721 | 1721 | return false; |
1722 | 1722 | } |
1723 | 1723 | $this->_validate_offsite_return(); |
@@ -1731,23 +1731,23 @@ discard block |
||
1731 | 1731 | // true |
1732 | 1732 | //); |
1733 | 1733 | // verify TXN |
1734 | - if ( $this->checkout->transaction instanceof EE_Transaction ) { |
|
1734 | + if ($this->checkout->transaction instanceof EE_Transaction) { |
|
1735 | 1735 | $gateway = $this->checkout->payment_method->type_obj()->get_gateway(); |
1736 | - if ( ! $gateway instanceof EE_Offsite_Gateway ) { |
|
1736 | + if ( ! $gateway instanceof EE_Offsite_Gateway) { |
|
1737 | 1737 | $this->checkout->continue_reg = false; |
1738 | 1738 | return false; |
1739 | 1739 | } |
1740 | - $payment = $this->_process_off_site_payment( $gateway ); |
|
1741 | - $payment = $this->_process_cancelled_payments( $payment ); |
|
1742 | - $payment = $this->_validate_payment( $payment ); |
|
1740 | + $payment = $this->_process_off_site_payment($gateway); |
|
1741 | + $payment = $this->_process_cancelled_payments($payment); |
|
1742 | + $payment = $this->_validate_payment($payment); |
|
1743 | 1743 | // if payment was not declined by the payment gateway or cancelled by the registrant |
1744 | - if ( $this->_process_payment_status( $payment, EE_PMT_Base::offsite ) ) { |
|
1744 | + if ($this->_process_payment_status($payment, EE_PMT_Base::offsite)) { |
|
1745 | 1745 | //$this->_setup_redirect_for_next_step(); |
1746 | 1746 | // store that for later |
1747 | 1747 | $this->checkout->payment = $payment; |
1748 | 1748 | // mark this reg step as completed, as long as gateway doesn't use a separate IPN request, |
1749 | 1749 | // because we will complete this step during the IPN processing then |
1750 | - if ( $gateway instanceof EE_Offsite_Gateway && ! $gateway->uses_separate_IPN_request() ) { |
|
1750 | + if ($gateway instanceof EE_Offsite_Gateway && ! $gateway->uses_separate_IPN_request()) { |
|
1751 | 1751 | $this->set_completed(); |
1752 | 1752 | } |
1753 | 1753 | return true; |
@@ -1770,19 +1770,19 @@ discard block |
||
1770 | 1770 | * @return bool |
1771 | 1771 | */ |
1772 | 1772 | private function _validate_offsite_return() { |
1773 | - $TXN_ID = (int)EE_Registry::instance()->REQ->get( 'spco_txn', 0 ); |
|
1774 | - if ( $TXN_ID != $this->checkout->transaction->ID() ) { |
|
1773 | + $TXN_ID = (int) EE_Registry::instance()->REQ->get('spco_txn', 0); |
|
1774 | + if ($TXN_ID != $this->checkout->transaction->ID()) { |
|
1775 | 1775 | // Houston... we might have a problem |
1776 | 1776 | $invalid_TXN = false; |
1777 | 1777 | // first gather some info |
1778 | - $valid_TXN = EEM_Transaction::instance()->get_one_by_ID( $TXN_ID ); |
|
1778 | + $valid_TXN = EEM_Transaction::instance()->get_one_by_ID($TXN_ID); |
|
1779 | 1779 | $primary_registrant = $valid_TXN instanceof EE_Transaction ? $valid_TXN->primary_registration() : null; |
1780 | 1780 | // let's start by retrieving the cart for this TXN |
1781 | - $cart = EE_Cart::get_cart_from_txn( $this->checkout->transaction ); |
|
1782 | - if ( $cart instanceof EE_Cart ) { |
|
1781 | + $cart = EE_Cart::get_cart_from_txn($this->checkout->transaction); |
|
1782 | + if ($cart instanceof EE_Cart) { |
|
1783 | 1783 | // verify that the current cart has tickets |
1784 | 1784 | $tickets = $cart->get_tickets(); |
1785 | - if ( empty( $tickets ) ) { |
|
1785 | + if (empty($tickets)) { |
|
1786 | 1786 | $invalid_TXN = true; |
1787 | 1787 | } |
1788 | 1788 | } else { |
@@ -1790,39 +1790,39 @@ discard block |
||
1790 | 1790 | } |
1791 | 1791 | $valid_TXN_SID = $primary_registrant instanceof EE_Registration ? $primary_registrant->session_ID() : null; |
1792 | 1792 | // validate current Session ID and compare against valid TXN session ID |
1793 | - if ( EE_Session::instance()->id() === null ) { |
|
1793 | + if (EE_Session::instance()->id() === null) { |
|
1794 | 1794 | $invalid_TXN = true; |
1795 | - } else if ( EE_Session::instance()->id() === $valid_TXN_SID ) { |
|
1795 | + } else if (EE_Session::instance()->id() === $valid_TXN_SID) { |
|
1796 | 1796 | // WARNING !!! |
1797 | 1797 | // this could be PayPal sending back duplicate requests (ya they do that) |
1798 | 1798 | // or it **could** mean someone is simply registering AGAIN after having just done so |
1799 | 1799 | // so now we need to determine if this current TXN looks valid or not |
1800 | 1800 | /** @type EE_Transaction_Processor $transaction_processor */ |
1801 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
1801 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
1802 | 1802 | // has this step even been started ? |
1803 | - if ( $transaction_processor->reg_step_completed( $this->checkout->transaction, $this->slug() === false ) |
|
1803 | + if ($transaction_processor->reg_step_completed($this->checkout->transaction, $this->slug() === false) |
|
1804 | 1804 | ) { |
1805 | 1805 | // really? you're half way through this reg step, but you never started it ? |
1806 | 1806 | $invalid_TXN = true; |
1807 | 1807 | } |
1808 | 1808 | } |
1809 | - if ( $invalid_TXN ) { |
|
1809 | + if ($invalid_TXN) { |
|
1810 | 1810 | // is the valid TXN completed ? |
1811 | - if ( $valid_TXN instanceof EE_Transaction ) { |
|
1811 | + if ($valid_TXN instanceof EE_Transaction) { |
|
1812 | 1812 | /** @type EE_Transaction_Processor $transaction_processor */ |
1813 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
1813 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
1814 | 1814 | // has this step even been started ? |
1815 | - $reg_step_completed = $transaction_processor->reg_step_completed( $valid_TXN, $this->slug() ); |
|
1816 | - if ( $reg_step_completed !== false && $reg_step_completed !== true ) { |
|
1815 | + $reg_step_completed = $transaction_processor->reg_step_completed($valid_TXN, $this->slug()); |
|
1816 | + if ($reg_step_completed !== false && $reg_step_completed !== true) { |
|
1817 | 1817 | // so it **looks** like this is a double request from PayPal |
1818 | 1818 | // so let's try to pick up where we left off |
1819 | 1819 | $this->checkout->transaction = $valid_TXN; |
1820 | - $this->checkout->refresh_all_entities( true ); |
|
1820 | + $this->checkout->refresh_all_entities(true); |
|
1821 | 1821 | return; |
1822 | 1822 | } |
1823 | 1823 | } |
1824 | 1824 | // you appear to be lost? |
1825 | - $this->_redirect_wayward_request( $primary_registrant ); |
|
1825 | + $this->_redirect_wayward_request($primary_registrant); |
|
1826 | 1826 | } |
1827 | 1827 | } |
1828 | 1828 | } |
@@ -1836,16 +1836,16 @@ discard block |
||
1836 | 1836 | * @param \EE_Registration $primary_registrant |
1837 | 1837 | * @return bool |
1838 | 1838 | */ |
1839 | - private function _redirect_wayward_request( EE_Registration $primary_registrant ) { |
|
1840 | - if ( ! $primary_registrant instanceof EE_Registration ) { |
|
1839 | + private function _redirect_wayward_request(EE_Registration $primary_registrant) { |
|
1840 | + if ( ! $primary_registrant instanceof EE_Registration) { |
|
1841 | 1841 | // try redirecting based on the current TXN |
1842 | 1842 | $primary_registrant = $this->checkout->transaction instanceof EE_Transaction ? $this->checkout->transaction->primary_registration() : null; |
1843 | - if ( ! $primary_registrant instanceof EE_Registration ) { |
|
1843 | + if ( ! $primary_registrant instanceof EE_Registration) { |
|
1844 | 1844 | EE_Error::add_error( |
1845 | 1845 | sprintf( |
1846 | - __( 'Invalid information was received from the Off-Site Payment Processor and your Transaction details could not be retrieved from the database.%1$sPlease try again or contact %2$s for assistance.', 'event_espresso' ), |
|
1846 | + __('Invalid information was received from the Off-Site Payment Processor and your Transaction details could not be retrieved from the database.%1$sPlease try again or contact %2$s for assistance.', 'event_espresso'), |
|
1847 | 1847 | '<br/>', |
1848 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) |
|
1848 | + EE_Registry::instance()->CFG->organization->get_pretty('email') |
|
1849 | 1849 | ), |
1850 | 1850 | __FILE__, __FUNCTION__, __LINE__ |
1851 | 1851 | ); |
@@ -1873,16 +1873,16 @@ discard block |
||
1873 | 1873 | * @param \EE_Offsite_Gateway $gateway |
1874 | 1874 | * @return \EE_Payment |
1875 | 1875 | */ |
1876 | - private function _process_off_site_payment( EE_Offsite_Gateway $gateway ) { |
|
1876 | + private function _process_off_site_payment(EE_Offsite_Gateway $gateway) { |
|
1877 | 1877 | try { |
1878 | 1878 | // if gateway uses_separate_IPN_request, then we don't have to process the IPN manually |
1879 | - if ( $gateway instanceof EE_Offsite_Gateway && $gateway->uses_separate_IPN_request() ) { |
|
1879 | + if ($gateway instanceof EE_Offsite_Gateway && $gateway->uses_separate_IPN_request()) { |
|
1880 | 1880 | $payment = $this->checkout->transaction->last_payment(); |
1881 | 1881 | //$payment_source = 'last_payment'; |
1882 | 1882 | } else { |
1883 | 1883 | // get payment details and process results |
1884 | 1884 | /** @type EE_Payment_Processor $payment_processor */ |
1885 | - $payment_processor = EE_Registry::instance()->load_core( 'Payment_Processor' ); |
|
1885 | + $payment_processor = EE_Registry::instance()->load_core('Payment_Processor'); |
|
1886 | 1886 | $payment = $payment_processor->process_ipn( |
1887 | 1887 | $_REQUEST, |
1888 | 1888 | $this->checkout->transaction, |
@@ -1892,14 +1892,14 @@ discard block |
||
1892 | 1892 | ); |
1893 | 1893 | //$payment_source = 'process_ipn'; |
1894 | 1894 | } |
1895 | - } catch ( Exception $e ) { |
|
1895 | + } catch (Exception $e) { |
|
1896 | 1896 | // let's just eat the exception and try to move on using any previously set payment info |
1897 | 1897 | $payment = $this->checkout->transaction->last_payment(); |
1898 | 1898 | //$payment_source = 'last_payment after Exception'; |
1899 | 1899 | // but if we STILL don't have a payment object |
1900 | - if ( ! $payment instanceof EE_Payment ) { |
|
1900 | + if ( ! $payment instanceof EE_Payment) { |
|
1901 | 1901 | // then we'll object ! ( not object like a thing... but object like what a lawyer says ! ) |
1902 | - $this->_handle_payment_processor_exception( $e ); |
|
1902 | + $this->_handle_payment_processor_exception($e); |
|
1903 | 1903 | } |
1904 | 1904 | } |
1905 | 1905 | // DEBUG LOG |
@@ -1923,13 +1923,13 @@ discard block |
||
1923 | 1923 | * @param EE_Payment $payment |
1924 | 1924 | * @return EE_Payment | FALSE |
1925 | 1925 | */ |
1926 | - private function _process_cancelled_payments( $payment = NULL ) { |
|
1926 | + private function _process_cancelled_payments($payment = NULL) { |
|
1927 | 1927 | if ( |
1928 | - isset( $_REQUEST[ 'ee_cancel_payment' ] ) |
|
1928 | + isset($_REQUEST['ee_cancel_payment']) |
|
1929 | 1929 | && $payment instanceof EE_Payment |
1930 | 1930 | && $payment->status() == EEM_Payment::status_id_failed |
1931 | 1931 | ) { |
1932 | - $payment->set_status( EEM_Payment::status_id_cancelled ); |
|
1932 | + $payment->set_status(EEM_Payment::status_id_cancelled); |
|
1933 | 1933 | } |
1934 | 1934 | return $payment; |
1935 | 1935 | } |
@@ -1946,23 +1946,23 @@ discard block |
||
1946 | 1946 | public function get_transaction_details_for_gateways() { |
1947 | 1947 | $txn_details = array(); |
1948 | 1948 | // ya gotta make a choice man |
1949 | - if ( empty( $this->checkout->selected_method_of_payment ) ) { |
|
1949 | + if (empty($this->checkout->selected_method_of_payment)) { |
|
1950 | 1950 | $txn_details = array( |
1951 | - 'error' => __( 'Please select a method of payment before proceeding.', 'event_espresso' ) |
|
1951 | + 'error' => __('Please select a method of payment before proceeding.', 'event_espresso') |
|
1952 | 1952 | ); |
1953 | 1953 | } |
1954 | 1954 | // get EE_Payment_Method object |
1955 | 1955 | if ( |
1956 | - empty( $txn_details ) && |
|
1956 | + empty($txn_details) && |
|
1957 | 1957 | ! $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment() |
1958 | 1958 | ) { |
1959 | 1959 | $txn_details = array( |
1960 | 1960 | 'selected_method_of_payment' => $this->checkout->selected_method_of_payment, |
1961 | - 'error' => __( 'A valid Payment Method could not be determined.', 'event_espresso' ) |
|
1961 | + 'error' => __('A valid Payment Method could not be determined.', 'event_espresso') |
|
1962 | 1962 | ); |
1963 | 1963 | } |
1964 | - if ( empty( $txn_details ) && $this->checkout->transaction instanceof EE_Transaction ) { |
|
1965 | - $return_url = $this->_get_return_url( $this->checkout->payment_method ); |
|
1964 | + if (empty($txn_details) && $this->checkout->transaction instanceof EE_Transaction) { |
|
1965 | + $return_url = $this->_get_return_url($this->checkout->payment_method); |
|
1966 | 1966 | $txn_details = array( |
1967 | 1967 | 'TXN_ID' => $this->checkout->transaction->ID(), |
1968 | 1968 | 'TXN_timestamp' => $this->checkout->transaction->datetime(), |
@@ -1973,7 +1973,7 @@ discard block |
||
1973 | 1973 | 'PMD_ID' => $this->checkout->transaction->payment_method_ID(), |
1974 | 1974 | 'payment_amount' => $this->checkout->amount_owing, |
1975 | 1975 | 'return_url' => $return_url, |
1976 | - 'cancel_url' => add_query_arg( array( 'ee_cancel_payment' => true ), $return_url ), |
|
1976 | + 'cancel_url' => add_query_arg(array('ee_cancel_payment' => true), $return_url), |
|
1977 | 1977 | 'notify_url' => EE_Config::instance()->core->txn_page_url( |
1978 | 1978 | array( |
1979 | 1979 | 'e_reg_url_link' => $this->checkout->transaction->primary_registration()->reg_url_link(), |
@@ -1982,7 +1982,7 @@ discard block |
||
1982 | 1982 | ) |
1983 | 1983 | ); |
1984 | 1984 | } |
1985 | - echo json_encode( $txn_details ); |
|
1985 | + echo json_encode($txn_details); |
|
1986 | 1986 | exit(); |
1987 | 1987 | } |
1988 | 1988 |