@@ -322,9 +322,9 @@ discard block |
||
322 | 322 | |
323 | 323 | |
324 | 324 | /** |
325 | - * process_registration_from_admin |
|
326 | - * |
|
327 | - * @access public |
|
325 | + * process_registration_from_admin |
|
326 | + * |
|
327 | + * @access public |
|
328 | 328 | * @return \EE_Transaction |
329 | 329 | * @throws \EE_Error |
330 | 330 | */ |
@@ -819,15 +819,15 @@ discard block |
||
819 | 819 | |
820 | 820 | |
821 | 821 | |
822 | - /** |
|
823 | - * _get_registrations |
|
824 | - * |
|
825 | - * @access private |
|
826 | - * @param EE_Transaction $transaction |
|
827 | - * @return void |
|
828 | - * @throws \EventEspresso\core\exceptions\InvalidEntityException |
|
829 | - * @throws \EE_Error |
|
830 | - */ |
|
822 | + /** |
|
823 | + * _get_registrations |
|
824 | + * |
|
825 | + * @access private |
|
826 | + * @param EE_Transaction $transaction |
|
827 | + * @return void |
|
828 | + * @throws \EventEspresso\core\exceptions\InvalidEntityException |
|
829 | + * @throws \EE_Error |
|
830 | + */ |
|
831 | 831 | private function _get_registrations( EE_Transaction $transaction ) { |
832 | 832 | // first step: grab the registrants { : o |
833 | 833 | $registrations = $transaction->registrations( $this->checkout->reg_cache_where_params, true ); |
@@ -849,12 +849,12 @@ discard block |
||
849 | 849 | if ( $registration instanceof EE_Registration ) { |
850 | 850 | // we display all attendee info for the primary registrant |
851 | 851 | if ( $this->checkout->reg_url_link === $registration->reg_url_link() |
852 | - && $registration->is_primary_registrant() |
|
852 | + && $registration->is_primary_registrant() |
|
853 | 853 | ) { |
854 | 854 | $this->checkout->primary_revisit = true; |
855 | 855 | break; |
856 | 856 | } else if ( $this->checkout->revisit |
857 | - && $this->checkout->reg_url_link !== $registration->reg_url_link() |
|
857 | + && $this->checkout->reg_url_link !== $registration->reg_url_link() |
|
858 | 858 | ) { |
859 | 859 | // but hide info if it doesn't belong to you |
860 | 860 | $transaction->clear_cache( 'Registration', $registration->ID() ); |
@@ -866,15 +866,15 @@ discard block |
||
866 | 866 | |
867 | 867 | |
868 | 868 | |
869 | - /** |
|
870 | - * adds related EE_Registration objects for each ticket in the cart to the current EE_Transaction object |
|
871 | - * |
|
872 | - * @access private |
|
873 | - * @param EE_Transaction $transaction |
|
874 | - * @return array |
|
875 | - * @throws \EventEspresso\core\exceptions\InvalidEntityException |
|
876 | - * @throws \EE_Error |
|
877 | - */ |
|
869 | + /** |
|
870 | + * adds related EE_Registration objects for each ticket in the cart to the current EE_Transaction object |
|
871 | + * |
|
872 | + * @access private |
|
873 | + * @param EE_Transaction $transaction |
|
874 | + * @return array |
|
875 | + * @throws \EventEspresso\core\exceptions\InvalidEntityException |
|
876 | + * @throws \EE_Error |
|
877 | + */ |
|
878 | 878 | private function _initialize_registrations( EE_Transaction $transaction ) { |
879 | 879 | $att_nmbr = 0; |
880 | 880 | $registrations = array(); |
@@ -887,23 +887,23 @@ discard block |
||
887 | 887 | //do the following for each ticket of this type they selected |
888 | 888 | for ( $x = 1; $x <= $line_item->quantity(); $x++ ) { |
889 | 889 | $att_nmbr++; |
890 | - /** @var EventEspresso\core\services\commands\registration\CreateRegistrationCommand $CreateRegistrationCommand */ |
|
891 | - $CreateRegistrationCommand = EE_Registry::instance() |
|
892 | - ->create( |
|
893 | - 'EventEspresso\core\services\commands\registration\CreateRegistrationCommand', |
|
894 | - array( |
|
895 | - $transaction, |
|
896 | - $line_item, |
|
897 | - $att_nmbr, |
|
898 | - $this->checkout->total_ticket_count |
|
899 | - ) |
|
900 | - ); |
|
901 | - // override capabilities for frontend registrations |
|
902 | - if ( ! is_admin()) { |
|
903 | - $CreateRegistrationCommand->setCapCheck( |
|
904 | - new PublicCapabilities( '', 'create_new_registration' ) |
|
905 | - ); |
|
906 | - } |
|
890 | + /** @var EventEspresso\core\services\commands\registration\CreateRegistrationCommand $CreateRegistrationCommand */ |
|
891 | + $CreateRegistrationCommand = EE_Registry::instance() |
|
892 | + ->create( |
|
893 | + 'EventEspresso\core\services\commands\registration\CreateRegistrationCommand', |
|
894 | + array( |
|
895 | + $transaction, |
|
896 | + $line_item, |
|
897 | + $att_nmbr, |
|
898 | + $this->checkout->total_ticket_count |
|
899 | + ) |
|
900 | + ); |
|
901 | + // override capabilities for frontend registrations |
|
902 | + if ( ! is_admin()) { |
|
903 | + $CreateRegistrationCommand->setCapCheck( |
|
904 | + new PublicCapabilities( '', 'create_new_registration' ) |
|
905 | + ); |
|
906 | + } |
|
907 | 907 | $registration = EE_Registry::instance()->BUS->execute( $CreateRegistrationCommand ); |
908 | 908 | if ( ! $registration instanceof EE_Registration ) { |
909 | 909 | throw new InvalidEntityException( $registration, 'EE_Registration' ); |
@@ -1395,10 +1395,10 @@ discard block |
||
1395 | 1395 | $this->checkout->redirect_url = $this->checkout->next_step->reg_step_url(); |
1396 | 1396 | } |
1397 | 1397 | $this->checkout->redirect_url = apply_filters( |
1398 | - 'FHEE__EED_Single_Page_Checkout___setup_redirect__checkout_redirect_url', |
|
1399 | - $this->checkout->redirect_url, |
|
1400 | - $this->checkout |
|
1401 | - ); |
|
1398 | + 'FHEE__EED_Single_Page_Checkout___setup_redirect__checkout_redirect_url', |
|
1399 | + $this->checkout->redirect_url, |
|
1400 | + $this->checkout |
|
1401 | + ); |
|
1402 | 1402 | } |
1403 | 1403 | } |
1404 | 1404 |
@@ -1,8 +1,8 @@ discard block |
||
1 | 1 | <?php use EventEspresso\core\domain\services\capabilities\PublicCapabilities; |
2 | 2 | use EventEspresso\core\exceptions\InvalidEntityException; |
3 | 3 | |
4 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
5 | - exit( 'No direct script access allowed' ); |
|
4 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
5 | + exit('No direct script access allowed'); |
|
6 | 6 | } |
7 | 7 | |
8 | 8 | |
@@ -54,8 +54,8 @@ discard block |
||
54 | 54 | * @return EED_Single_Page_Checkout |
55 | 55 | */ |
56 | 56 | public static function instance() { |
57 | - add_filter( 'EED_Single_Page_Checkout__SPCO_active', '__return_true' ); |
|
58 | - return parent::get_instance( __CLASS__ ); |
|
57 | + add_filter('EED_Single_Page_Checkout__SPCO_active', '__return_true'); |
|
58 | + return parent::get_instance(__CLASS__); |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | |
@@ -100,22 +100,22 @@ discard block |
||
100 | 100 | */ |
101 | 101 | public static function set_hooks_admin() { |
102 | 102 | EED_Single_Page_Checkout::set_definitions(); |
103 | - if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) { |
|
103 | + if (defined('DOING_AJAX') && DOING_AJAX) { |
|
104 | 104 | // going to start an output buffer in case anything gets accidentally output that might disrupt our JSON response |
105 | 105 | ob_start(); |
106 | 106 | EED_Single_Page_Checkout::load_request_handler(); |
107 | 107 | EED_Single_Page_Checkout::load_reg_steps(); |
108 | 108 | } else { |
109 | 109 | // 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 |
110 | - add_action( 'pre_get_posts', array( 'EED_Single_Page_Checkout', 'load_reg_steps' ), 1 ); |
|
110 | + add_action('pre_get_posts', array('EED_Single_Page_Checkout', 'load_reg_steps'), 1); |
|
111 | 111 | } |
112 | 112 | // set ajax hooks |
113 | - add_action( 'wp_ajax_process_reg_step', array( 'EED_Single_Page_Checkout', 'process_reg_step' )); |
|
114 | - add_action( 'wp_ajax_nopriv_process_reg_step', array( 'EED_Single_Page_Checkout', 'process_reg_step' )); |
|
115 | - add_action( 'wp_ajax_display_spco_reg_step', array( 'EED_Single_Page_Checkout', 'display_reg_step' )); |
|
116 | - add_action( 'wp_ajax_nopriv_display_spco_reg_step', array( 'EED_Single_Page_Checkout', 'display_reg_step' )); |
|
117 | - add_action( 'wp_ajax_update_reg_step', array( 'EED_Single_Page_Checkout', 'update_reg_step' )); |
|
118 | - add_action( 'wp_ajax_nopriv_update_reg_step', array( 'EED_Single_Page_Checkout', 'update_reg_step' )); |
|
113 | + add_action('wp_ajax_process_reg_step', array('EED_Single_Page_Checkout', 'process_reg_step')); |
|
114 | + add_action('wp_ajax_nopriv_process_reg_step', array('EED_Single_Page_Checkout', 'process_reg_step')); |
|
115 | + add_action('wp_ajax_display_spco_reg_step', array('EED_Single_Page_Checkout', 'display_reg_step')); |
|
116 | + add_action('wp_ajax_nopriv_display_spco_reg_step', array('EED_Single_Page_Checkout', 'display_reg_step')); |
|
117 | + add_action('wp_ajax_update_reg_step', array('EED_Single_Page_Checkout', 'update_reg_step')); |
|
118 | + add_action('wp_ajax_nopriv_update_reg_step', array('EED_Single_Page_Checkout', 'update_reg_step')); |
|
119 | 119 | } |
120 | 120 | |
121 | 121 | |
@@ -126,8 +126,8 @@ discard block |
||
126 | 126 | * @param string $ajax_action |
127 | 127 | * @throws \EE_Error |
128 | 128 | */ |
129 | - public static function process_ajax_request( $ajax_action ) { |
|
130 | - EE_Registry::instance()->REQ->set( 'action', $ajax_action ); |
|
129 | + public static function process_ajax_request($ajax_action) { |
|
130 | + EE_Registry::instance()->REQ->set('action', $ajax_action); |
|
131 | 131 | EED_Single_Page_Checkout::instance()->_initialize(); |
132 | 132 | } |
133 | 133 | |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | * @throws \EE_Error |
140 | 140 | */ |
141 | 141 | public static function display_reg_step() { |
142 | - EED_Single_Page_Checkout::process_ajax_request( 'display_spco_reg_step' ); |
|
142 | + EED_Single_Page_Checkout::process_ajax_request('display_spco_reg_step'); |
|
143 | 143 | } |
144 | 144 | |
145 | 145 | |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | * @throws \EE_Error |
151 | 151 | */ |
152 | 152 | public static function process_reg_step() { |
153 | - EED_Single_Page_Checkout::process_ajax_request( 'process_reg_step' ); |
|
153 | + EED_Single_Page_Checkout::process_ajax_request('process_reg_step'); |
|
154 | 154 | } |
155 | 155 | |
156 | 156 | |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | * @throws \EE_Error |
162 | 162 | */ |
163 | 163 | public static function update_reg_step() { |
164 | - EED_Single_Page_Checkout::process_ajax_request( 'update_reg_step' ); |
|
164 | + EED_Single_Page_Checkout::process_ajax_request('update_reg_step'); |
|
165 | 165 | } |
166 | 166 | |
167 | 167 | |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | * @throws \EE_Error |
175 | 175 | */ |
176 | 176 | public static function update_checkout() { |
177 | - EED_Single_Page_Checkout::process_ajax_request( 'update_checkout' ); |
|
177 | + EED_Single_Page_Checkout::process_ajax_request('update_checkout'); |
|
178 | 178 | } |
179 | 179 | |
180 | 180 | |
@@ -187,8 +187,8 @@ discard block |
||
187 | 187 | */ |
188 | 188 | public static function load_request_handler() { |
189 | 189 | // load core Request_Handler class |
190 | - if ( ! isset( EE_Registry::instance()->REQ )) { |
|
191 | - EE_Registry::instance()->load_core( 'Request_Handler' ); |
|
190 | + if ( ! isset(EE_Registry::instance()->REQ)) { |
|
191 | + EE_Registry::instance()->load_core('Request_Handler'); |
|
192 | 192 | } |
193 | 193 | } |
194 | 194 | |
@@ -202,14 +202,14 @@ discard block |
||
202 | 202 | * @throws \EE_Error |
203 | 203 | */ |
204 | 204 | public static function set_definitions() { |
205 | - define( 'SPCO_BASE_PATH', rtrim( str_replace( array( '\\', '/' ), DS, plugin_dir_path( __FILE__ )), DS ) . DS ); |
|
206 | - define( 'SPCO_CSS_URL', plugin_dir_url( __FILE__ ) . 'css' . DS ); |
|
207 | - define( 'SPCO_IMG_URL', plugin_dir_url( __FILE__ ) . 'img' . DS ); |
|
208 | - define( 'SPCO_JS_URL', plugin_dir_url( __FILE__ ) . 'js' . DS ); |
|
209 | - define( 'SPCO_INC_PATH', SPCO_BASE_PATH . 'inc' . DS ); |
|
210 | - define( 'SPCO_REG_STEPS_PATH', SPCO_BASE_PATH . 'reg_steps' . DS ); |
|
211 | - define( 'SPCO_TEMPLATES_PATH', SPCO_BASE_PATH . 'templates' . DS ); |
|
212 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder( SPCO_BASE_PATH, TRUE ); |
|
205 | + define('SPCO_BASE_PATH', rtrim(str_replace(array('\\', '/'), DS, plugin_dir_path(__FILE__)), DS).DS); |
|
206 | + define('SPCO_CSS_URL', plugin_dir_url(__FILE__).'css'.DS); |
|
207 | + define('SPCO_IMG_URL', plugin_dir_url(__FILE__).'img'.DS); |
|
208 | + define('SPCO_JS_URL', plugin_dir_url(__FILE__).'js'.DS); |
|
209 | + define('SPCO_INC_PATH', SPCO_BASE_PATH.'inc'.DS); |
|
210 | + define('SPCO_REG_STEPS_PATH', SPCO_BASE_PATH.'reg_steps'.DS); |
|
211 | + define('SPCO_TEMPLATES_PATH', SPCO_BASE_PATH.'templates'.DS); |
|
212 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder(SPCO_BASE_PATH, TRUE); |
|
213 | 213 | } |
214 | 214 | |
215 | 215 | |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | */ |
225 | 225 | public static function load_reg_steps() { |
226 | 226 | static $reg_steps_loaded = FALSE; |
227 | - if ( $reg_steps_loaded ) { |
|
227 | + if ($reg_steps_loaded) { |
|
228 | 228 | return; |
229 | 229 | } |
230 | 230 | // filter list of reg_steps |
@@ -233,24 +233,24 @@ discard block |
||
233 | 233 | EED_Single_Page_Checkout::get_reg_steps() |
234 | 234 | ); |
235 | 235 | // sort by key (order) |
236 | - ksort( $reg_steps_to_load ); |
|
236 | + ksort($reg_steps_to_load); |
|
237 | 237 | // loop through folders |
238 | - foreach ( $reg_steps_to_load as $order => $reg_step ) { |
|
238 | + foreach ($reg_steps_to_load as $order => $reg_step) { |
|
239 | 239 | // we need a |
240 | - if ( isset( $reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'] )) { |
|
240 | + if (isset($reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'])) { |
|
241 | 241 | // copy over to the reg_steps_array |
242 | - EED_Single_Page_Checkout::$_reg_steps_array[ $order ] = $reg_step; |
|
242 | + EED_Single_Page_Checkout::$_reg_steps_array[$order] = $reg_step; |
|
243 | 243 | // register custom key route for each reg step |
244 | 244 | // ie: step=>"slug" - this is the entire reason we load the reg steps array now |
245 | - EE_Config::register_route( $reg_step['slug'], 'EED_Single_Page_Checkout', 'run', 'step' ); |
|
245 | + EE_Config::register_route($reg_step['slug'], 'EED_Single_Page_Checkout', 'run', 'step'); |
|
246 | 246 | // add AJAX or other hooks |
247 | - if ( isset( $reg_step['has_hooks'] ) && $reg_step['has_hooks'] ) { |
|
247 | + if (isset($reg_step['has_hooks']) && $reg_step['has_hooks']) { |
|
248 | 248 | // setup autoloaders if necessary |
249 | - if ( ! class_exists( $reg_step['class_name'] )) { |
|
250 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder( $reg_step['file_path'], TRUE ); |
|
249 | + if ( ! class_exists($reg_step['class_name'])) { |
|
250 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder($reg_step['file_path'], TRUE); |
|
251 | 251 | } |
252 | - if ( is_callable( $reg_step['class_name'], 'set_hooks' )) { |
|
253 | - call_user_func( array( $reg_step['class_name'], 'set_hooks' )); |
|
252 | + if (is_callable($reg_step['class_name'], 'set_hooks')) { |
|
253 | + call_user_func(array($reg_step['class_name'], 'set_hooks')); |
|
254 | 254 | } |
255 | 255 | } |
256 | 256 | } |
@@ -269,28 +269,28 @@ discard block |
||
269 | 269 | */ |
270 | 270 | public static function get_reg_steps() { |
271 | 271 | $reg_steps = EE_Registry::instance()->CFG->registration->reg_steps; |
272 | - if ( empty( $reg_steps )) { |
|
272 | + if (empty($reg_steps)) { |
|
273 | 273 | $reg_steps = array( |
274 | 274 | 10 => array( |
275 | - 'file_path' => SPCO_REG_STEPS_PATH . 'attendee_information', |
|
275 | + 'file_path' => SPCO_REG_STEPS_PATH.'attendee_information', |
|
276 | 276 | 'class_name' => 'EE_SPCO_Reg_Step_Attendee_Information', |
277 | 277 | 'slug' => 'attendee_information', |
278 | 278 | 'has_hooks' => FALSE |
279 | 279 | ), |
280 | 280 | 20 => array( |
281 | - 'file_path' => SPCO_REG_STEPS_PATH . 'registration_confirmation', |
|
281 | + 'file_path' => SPCO_REG_STEPS_PATH.'registration_confirmation', |
|
282 | 282 | 'class_name' => 'EE_SPCO_Reg_Step_Registration_Confirmation', |
283 | 283 | 'slug' => 'registration_confirmation', |
284 | 284 | 'has_hooks' => FALSE |
285 | 285 | ), |
286 | 286 | 30 => array( |
287 | - 'file_path' => SPCO_REG_STEPS_PATH . 'payment_options', |
|
287 | + 'file_path' => SPCO_REG_STEPS_PATH.'payment_options', |
|
288 | 288 | 'class_name' => 'EE_SPCO_Reg_Step_Payment_Options', |
289 | 289 | 'slug' => 'payment_options', |
290 | 290 | 'has_hooks' => TRUE |
291 | 291 | ), |
292 | 292 | 999 => array( |
293 | - 'file_path' => SPCO_REG_STEPS_PATH . 'finalize_registration', |
|
293 | + 'file_path' => SPCO_REG_STEPS_PATH.'finalize_registration', |
|
294 | 294 | 'class_name' => 'EE_SPCO_Reg_Step_Finalize_Registration', |
295 | 295 | 'slug' => 'finalize_registration', |
296 | 296 | 'has_hooks' => FALSE |
@@ -311,9 +311,9 @@ discard block |
||
311 | 311 | */ |
312 | 312 | public static function registration_checkout_for_admin() { |
313 | 313 | EED_Single_Page_Checkout::load_reg_steps(); |
314 | - EE_Registry::instance()->REQ->set( 'step', 'attendee_information' ); |
|
315 | - EE_Registry::instance()->REQ->set( 'action', 'display_spco_reg_step' ); |
|
316 | - EE_Registry::instance()->REQ->set( 'process_form_submission', false ); |
|
314 | + EE_Registry::instance()->REQ->set('step', 'attendee_information'); |
|
315 | + EE_Registry::instance()->REQ->set('action', 'display_spco_reg_step'); |
|
316 | + EE_Registry::instance()->REQ->set('process_form_submission', false); |
|
317 | 317 | EED_Single_Page_Checkout::instance()->_initialize(); |
318 | 318 | EED_Single_Page_Checkout::instance()->_display_spco_reg_form(); |
319 | 319 | return EE_Registry::instance()->REQ->get_output(); |
@@ -330,15 +330,15 @@ discard block |
||
330 | 330 | */ |
331 | 331 | public static function process_registration_from_admin() { |
332 | 332 | EED_Single_Page_Checkout::load_reg_steps(); |
333 | - EE_Registry::instance()->REQ->set( 'step', 'attendee_information' ); |
|
334 | - EE_Registry::instance()->REQ->set( 'action', 'process_reg_step' ); |
|
335 | - EE_Registry::instance()->REQ->set( 'process_form_submission', true ); |
|
333 | + EE_Registry::instance()->REQ->set('step', 'attendee_information'); |
|
334 | + EE_Registry::instance()->REQ->set('action', 'process_reg_step'); |
|
335 | + EE_Registry::instance()->REQ->set('process_form_submission', true); |
|
336 | 336 | EED_Single_Page_Checkout::instance()->_initialize(); |
337 | - if ( EED_Single_Page_Checkout::instance()->checkout->current_step->completed() ) { |
|
338 | - $final_reg_step = end( EED_Single_Page_Checkout::instance()->checkout->reg_steps ); |
|
339 | - if ( $final_reg_step instanceof EE_SPCO_Reg_Step_Finalize_Registration ) { |
|
340 | - EED_Single_Page_Checkout::instance()->checkout->set_reg_step_initiated( $final_reg_step ); |
|
341 | - if ( $final_reg_step->process_reg_step() ) { |
|
337 | + if (EED_Single_Page_Checkout::instance()->checkout->current_step->completed()) { |
|
338 | + $final_reg_step = end(EED_Single_Page_Checkout::instance()->checkout->reg_steps); |
|
339 | + if ($final_reg_step instanceof EE_SPCO_Reg_Step_Finalize_Registration) { |
|
340 | + EED_Single_Page_Checkout::instance()->checkout->set_reg_step_initiated($final_reg_step); |
|
341 | + if ($final_reg_step->process_reg_step()) { |
|
342 | 342 | $final_reg_step->set_completed(); |
343 | 343 | EED_Single_Page_Checkout::instance()->checkout->update_txn_reg_steps_array(); |
344 | 344 | return EED_Single_Page_Checkout::instance()->checkout->transaction; |
@@ -358,13 +358,13 @@ discard block |
||
358 | 358 | * @return void |
359 | 359 | * @throws \EE_Error |
360 | 360 | */ |
361 | - public function run( $WP_Query ) { |
|
361 | + public function run($WP_Query) { |
|
362 | 362 | if ( |
363 | 363 | $WP_Query instanceof WP_Query |
364 | 364 | && $WP_Query->is_main_query() |
365 | - && apply_filters( 'FHEE__EED_Single_Page_Checkout__run', true ) |
|
366 | - && isset( $WP_Query->query['pagename'] ) |
|
367 | - && strpos( EE_Config::instance()->core->reg_page_url(), $WP_Query->query['pagename'] ) !== false |
|
365 | + && apply_filters('FHEE__EED_Single_Page_Checkout__run', true) |
|
366 | + && isset($WP_Query->query['pagename']) |
|
367 | + && strpos(EE_Config::instance()->core->reg_page_url(), $WP_Query->query['pagename']) !== false |
|
368 | 368 | ) { |
369 | 369 | $this->_initialize(); |
370 | 370 | } |
@@ -380,8 +380,8 @@ discard block |
||
380 | 380 | * @return void |
381 | 381 | * @throws \EE_Error |
382 | 382 | */ |
383 | - public static function init( $WP_Query ) { |
|
384 | - EED_Single_Page_Checkout::instance()->run( $WP_Query ); |
|
383 | + public static function init($WP_Query) { |
|
384 | + EED_Single_Page_Checkout::instance()->run($WP_Query); |
|
385 | 385 | } |
386 | 386 | |
387 | 387 | |
@@ -395,35 +395,35 @@ discard block |
||
395 | 395 | */ |
396 | 396 | private function _initialize() { |
397 | 397 | // ensure SPCO doesn't run twice |
398 | - if ( EED_Single_Page_Checkout::$_initialized ) { |
|
398 | + if (EED_Single_Page_Checkout::$_initialized) { |
|
399 | 399 | return; |
400 | 400 | } |
401 | 401 | try { |
402 | 402 | // setup the EE_Checkout object |
403 | 403 | $this->checkout = $this->_initialize_checkout(); |
404 | 404 | // filter checkout |
405 | - $this->checkout = apply_filters( 'FHEE__EED_Single_Page_Checkout___initialize__checkout', $this->checkout ); |
|
405 | + $this->checkout = apply_filters('FHEE__EED_Single_Page_Checkout___initialize__checkout', $this->checkout); |
|
406 | 406 | // get the $_GET |
407 | 407 | $this->_get_request_vars(); |
408 | 408 | $this->_block_bots(); |
409 | 409 | // filter continue_reg |
410 | - $this->checkout->continue_reg = apply_filters( 'FHEE__EED_Single_Page_Checkout__init___continue_reg', TRUE, $this->checkout ); |
|
410 | + $this->checkout->continue_reg = apply_filters('FHEE__EED_Single_Page_Checkout__init___continue_reg', TRUE, $this->checkout); |
|
411 | 411 | // load the reg steps array |
412 | - if ( ! $this->_load_and_instantiate_reg_steps() ) { |
|
412 | + if ( ! $this->_load_and_instantiate_reg_steps()) { |
|
413 | 413 | EED_Single_Page_Checkout::$_initialized = true; |
414 | 414 | return; |
415 | 415 | } |
416 | 416 | // set the current step |
417 | - $this->checkout->set_current_step( $this->checkout->step ); |
|
417 | + $this->checkout->set_current_step($this->checkout->step); |
|
418 | 418 | // and the next step |
419 | 419 | $this->checkout->set_next_step(); |
420 | 420 | // was there already a valid transaction in the checkout from the session ? |
421 | - if ( ! $this->checkout->transaction instanceof EE_Transaction ) { |
|
421 | + if ( ! $this->checkout->transaction instanceof EE_Transaction) { |
|
422 | 422 | // get transaction from db or session |
423 | 423 | $this->checkout->transaction = $this->checkout->reg_url_link && ! is_admin() |
424 | 424 | ? $this->_get_transaction_and_cart_for_previous_visit() |
425 | 425 | : $this->_get_cart_for_current_session_and_setup_new_transaction(); |
426 | - if ( ! $this->checkout->transaction instanceof EE_Transaction ) { |
|
426 | + if ( ! $this->checkout->transaction instanceof EE_Transaction) { |
|
427 | 427 | // add some style and make it dance |
428 | 428 | $this->checkout->transaction = EE_Transaction::new_instance(); |
429 | 429 | $this->add_styles_and_scripts(); |
@@ -431,10 +431,10 @@ discard block |
||
431 | 431 | return; |
432 | 432 | } |
433 | 433 | // and the registrations for the transaction |
434 | - $this->_get_registrations( $this->checkout->transaction ); |
|
434 | + $this->_get_registrations($this->checkout->transaction); |
|
435 | 435 | } |
436 | 436 | // verify that everything has been setup correctly |
437 | - if ( ! $this->_final_verifications() ) { |
|
437 | + if ( ! $this->_final_verifications()) { |
|
438 | 438 | EED_Single_Page_Checkout::$_initialized = true; |
439 | 439 | return; |
440 | 440 | } |
@@ -459,9 +459,9 @@ discard block |
||
459 | 459 | // set no cache headers and constants |
460 | 460 | EE_System::do_not_cache(); |
461 | 461 | // add anchor |
462 | - add_action( 'loop_start', array( $this, 'set_checkout_anchor' ), 1 ); |
|
463 | - } catch ( Exception $e ) { |
|
464 | - EE_Error::add_error( $e->getMessage(), __FILE__, __FUNCTION__, __LINE__ ); |
|
462 | + add_action('loop_start', array($this, 'set_checkout_anchor'), 1); |
|
463 | + } catch (Exception $e) { |
|
464 | + EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__); |
|
465 | 465 | } |
466 | 466 | } |
467 | 467 | |
@@ -479,20 +479,20 @@ discard block |
||
479 | 479 | // look in session for existing checkout |
480 | 480 | $checkout = EE_Registry::instance()->SSN->checkout(); |
481 | 481 | // verify |
482 | - if ( ! $checkout instanceof EE_Checkout ) { |
|
482 | + if ( ! $checkout instanceof EE_Checkout) { |
|
483 | 483 | // instantiate EE_Checkout object for handling the properties of the current checkout process |
484 | - $checkout = EE_Registry::instance()->load_file( SPCO_INC_PATH, 'EE_Checkout', 'class', array(), FALSE ); |
|
484 | + $checkout = EE_Registry::instance()->load_file(SPCO_INC_PATH, 'EE_Checkout', 'class', array(), FALSE); |
|
485 | 485 | } else { |
486 | - if ( $checkout->current_step->is_final_step() && $checkout->exit_spco() === true ) { |
|
486 | + if ($checkout->current_step->is_final_step() && $checkout->exit_spco() === true) { |
|
487 | 487 | $this->unlock_transaction(); |
488 | - wp_safe_redirect( $checkout->redirect_url ); |
|
488 | + wp_safe_redirect($checkout->redirect_url); |
|
489 | 489 | exit(); |
490 | 490 | } |
491 | 491 | } |
492 | - $checkout = apply_filters( 'FHEE__EED_Single_Page_Checkout___initialize_checkout__checkout', $checkout ); |
|
492 | + $checkout = apply_filters('FHEE__EED_Single_Page_Checkout___initialize_checkout__checkout', $checkout); |
|
493 | 493 | // verify again |
494 | - if ( ! $checkout instanceof EE_Checkout ) { |
|
495 | - throw new EE_Error( __( 'The EE_Checkout class could not be loaded.', 'event_espresso' ) ); |
|
494 | + if ( ! $checkout instanceof EE_Checkout) { |
|
495 | + throw new EE_Error(__('The EE_Checkout class could not be loaded.', 'event_espresso')); |
|
496 | 496 | } |
497 | 497 | // reset anything that needs a clean slate for each request |
498 | 498 | $checkout->reset_for_current_request(); |
@@ -512,26 +512,26 @@ discard block |
||
512 | 512 | // load classes |
513 | 513 | EED_Single_Page_Checkout::load_request_handler(); |
514 | 514 | //make sure this request is marked as belonging to EE |
515 | - EE_Registry::instance()->REQ->set_espresso_page( TRUE ); |
|
515 | + EE_Registry::instance()->REQ->set_espresso_page(TRUE); |
|
516 | 516 | // which step is being requested ? |
517 | - $this->checkout->step = EE_Registry::instance()->REQ->get( 'step', $this->_get_first_step() ); |
|
517 | + $this->checkout->step = EE_Registry::instance()->REQ->get('step', $this->_get_first_step()); |
|
518 | 518 | // which step is being edited ? |
519 | - $this->checkout->edit_step = EE_Registry::instance()->REQ->get( 'edit_step', '' ); |
|
519 | + $this->checkout->edit_step = EE_Registry::instance()->REQ->get('edit_step', ''); |
|
520 | 520 | // and what we're doing on the current step |
521 | - $this->checkout->action = EE_Registry::instance()->REQ->get( 'action', 'display_spco_reg_step' ); |
|
521 | + $this->checkout->action = EE_Registry::instance()->REQ->get('action', 'display_spco_reg_step'); |
|
522 | 522 | // timestamp |
523 | - $this->checkout->uts = EE_Registry::instance()->REQ->get( 'uts', 0 ); |
|
523 | + $this->checkout->uts = EE_Registry::instance()->REQ->get('uts', 0); |
|
524 | 524 | // returning to edit ? |
525 | - $this->checkout->reg_url_link = EE_Registry::instance()->REQ->get( 'e_reg_url_link', '' ); |
|
525 | + $this->checkout->reg_url_link = EE_Registry::instance()->REQ->get('e_reg_url_link', ''); |
|
526 | 526 | // or some other kind of revisit ? |
527 | - $this->checkout->revisit = EE_Registry::instance()->REQ->get( 'revisit', FALSE ); |
|
527 | + $this->checkout->revisit = EE_Registry::instance()->REQ->get('revisit', FALSE); |
|
528 | 528 | // and whether or not to generate a reg form for this request |
529 | - $this->checkout->generate_reg_form = EE_Registry::instance()->REQ->get( 'generate_reg_form', TRUE ); // TRUE FALSE |
|
529 | + $this->checkout->generate_reg_form = EE_Registry::instance()->REQ->get('generate_reg_form', TRUE); // TRUE FALSE |
|
530 | 530 | // and whether or not to process a reg form submission for this request |
531 | - $this->checkout->process_form_submission = EE_Registry::instance()->REQ->get( 'process_form_submission', FALSE ); // TRUE FALSE |
|
531 | + $this->checkout->process_form_submission = EE_Registry::instance()->REQ->get('process_form_submission', FALSE); // TRUE FALSE |
|
532 | 532 | $this->checkout->process_form_submission = $this->checkout->action !== 'display_spco_reg_step' |
533 | 533 | ? $this->checkout->process_form_submission |
534 | - : FALSE; // TRUE FALSE |
|
534 | + : FALSE; // TRUE FALSE |
|
535 | 535 | // $this->_display_request_vars(); |
536 | 536 | } |
537 | 537 | |
@@ -544,17 +544,17 @@ discard block |
||
544 | 544 | * @return void |
545 | 545 | */ |
546 | 546 | protected function _display_request_vars() { |
547 | - if ( ! WP_DEBUG ) { |
|
547 | + if ( ! WP_DEBUG) { |
|
548 | 548 | return; |
549 | 549 | } |
550 | - EEH_Debug_Tools::printr( $_REQUEST, '$_REQUEST', __FILE__, __LINE__ ); |
|
551 | - EEH_Debug_Tools::printr( $this->checkout->step, '$this->checkout->step', __FILE__, __LINE__ ); |
|
552 | - EEH_Debug_Tools::printr( $this->checkout->edit_step, '$this->checkout->edit_step', __FILE__, __LINE__ ); |
|
553 | - EEH_Debug_Tools::printr( $this->checkout->action, '$this->checkout->action', __FILE__, __LINE__ ); |
|
554 | - EEH_Debug_Tools::printr( $this->checkout->reg_url_link, '$this->checkout->reg_url_link', __FILE__, __LINE__ ); |
|
555 | - EEH_Debug_Tools::printr( $this->checkout->revisit, '$this->checkout->revisit', __FILE__, __LINE__ ); |
|
556 | - EEH_Debug_Tools::printr( $this->checkout->generate_reg_form, '$this->checkout->generate_reg_form', __FILE__, __LINE__ ); |
|
557 | - EEH_Debug_Tools::printr( $this->checkout->process_form_submission, '$this->checkout->process_form_submission', __FILE__, __LINE__ ); |
|
550 | + EEH_Debug_Tools::printr($_REQUEST, '$_REQUEST', __FILE__, __LINE__); |
|
551 | + EEH_Debug_Tools::printr($this->checkout->step, '$this->checkout->step', __FILE__, __LINE__); |
|
552 | + EEH_Debug_Tools::printr($this->checkout->edit_step, '$this->checkout->edit_step', __FILE__, __LINE__); |
|
553 | + EEH_Debug_Tools::printr($this->checkout->action, '$this->checkout->action', __FILE__, __LINE__); |
|
554 | + EEH_Debug_Tools::printr($this->checkout->reg_url_link, '$this->checkout->reg_url_link', __FILE__, __LINE__); |
|
555 | + EEH_Debug_Tools::printr($this->checkout->revisit, '$this->checkout->revisit', __FILE__, __LINE__); |
|
556 | + EEH_Debug_Tools::printr($this->checkout->generate_reg_form, '$this->checkout->generate_reg_form', __FILE__, __LINE__); |
|
557 | + EEH_Debug_Tools::printr($this->checkout->process_form_submission, '$this->checkout->process_form_submission', __FILE__, __LINE__); |
|
558 | 558 | } |
559 | 559 | |
560 | 560 | |
@@ -569,7 +569,7 @@ discard block |
||
569 | 569 | */ |
570 | 570 | private function _block_bots() { |
571 | 571 | $invalid_checkout_access = \EED_Invalid_Checkout_Access::getInvalidCheckoutAccess(); |
572 | - if ( $invalid_checkout_access->checkoutAccessIsInvalid( $this->checkout ) ) { |
|
572 | + if ($invalid_checkout_access->checkoutAccessIsInvalid($this->checkout)) { |
|
573 | 573 | $this->_handle_html_redirects(); |
574 | 574 | } |
575 | 575 | } |
@@ -585,8 +585,8 @@ discard block |
||
585 | 585 | * @return array |
586 | 586 | */ |
587 | 587 | private function _get_first_step() { |
588 | - $first_step = reset( EED_Single_Page_Checkout::$_reg_steps_array ); |
|
589 | - return isset( $first_step['slug'] ) ? $first_step['slug'] : 'attendee_information'; |
|
588 | + $first_step = reset(EED_Single_Page_Checkout::$_reg_steps_array); |
|
589 | + return isset($first_step['slug']) ? $first_step['slug'] : 'attendee_information'; |
|
590 | 590 | } |
591 | 591 | |
592 | 592 | |
@@ -602,27 +602,27 @@ discard block |
||
602 | 602 | private function _load_and_instantiate_reg_steps() { |
603 | 603 | // have reg_steps already been instantiated ? |
604 | 604 | if ( |
605 | - empty( $this->checkout->reg_steps ) || |
|
606 | - apply_filters( 'FHEE__Single_Page_Checkout__load_reg_steps__reload_reg_steps', false, $this->checkout ) |
|
605 | + empty($this->checkout->reg_steps) || |
|
606 | + apply_filters('FHEE__Single_Page_Checkout__load_reg_steps__reload_reg_steps', false, $this->checkout) |
|
607 | 607 | ) { |
608 | 608 | // if not, then loop through raw reg steps array |
609 | - foreach ( EED_Single_Page_Checkout::$_reg_steps_array as $order => $reg_step ) { |
|
610 | - if ( ! $this->_load_and_instantiate_reg_step( $reg_step, $order )) { |
|
609 | + foreach (EED_Single_Page_Checkout::$_reg_steps_array as $order => $reg_step) { |
|
610 | + if ( ! $this->_load_and_instantiate_reg_step($reg_step, $order)) { |
|
611 | 611 | return false; |
612 | 612 | } |
613 | 613 | } |
614 | 614 | EE_Registry::instance()->CFG->registration->skip_reg_confirmation = TRUE; |
615 | 615 | EE_Registry::instance()->CFG->registration->reg_confirmation_last = TRUE; |
616 | 616 | // skip the registration_confirmation page ? |
617 | - if ( EE_Registry::instance()->CFG->registration->skip_reg_confirmation ) { |
|
617 | + if (EE_Registry::instance()->CFG->registration->skip_reg_confirmation) { |
|
618 | 618 | // just remove it from the reg steps array |
619 | - $this->checkout->remove_reg_step( 'registration_confirmation', false ); |
|
619 | + $this->checkout->remove_reg_step('registration_confirmation', false); |
|
620 | 620 | } else if ( |
621 | - isset( $this->checkout->reg_steps['registration_confirmation'] ) |
|
621 | + isset($this->checkout->reg_steps['registration_confirmation']) |
|
622 | 622 | && EE_Registry::instance()->CFG->registration->reg_confirmation_last |
623 | 623 | ) { |
624 | 624 | // set the order to something big like 100 |
625 | - $this->checkout->set_reg_step_order( 'registration_confirmation', 100 ); |
|
625 | + $this->checkout->set_reg_step_order('registration_confirmation', 100); |
|
626 | 626 | } |
627 | 627 | // filter the array for good luck |
628 | 628 | $this->checkout->reg_steps = apply_filters( |
@@ -632,13 +632,13 @@ discard block |
||
632 | 632 | // finally re-sort based on the reg step class order properties |
633 | 633 | $this->checkout->sort_reg_steps(); |
634 | 634 | } else { |
635 | - foreach ( $this->checkout->reg_steps as $reg_step ) { |
|
635 | + foreach ($this->checkout->reg_steps as $reg_step) { |
|
636 | 636 | // set all current step stati to FALSE |
637 | - $reg_step->set_is_current_step( FALSE ); |
|
637 | + $reg_step->set_is_current_step(FALSE); |
|
638 | 638 | } |
639 | 639 | } |
640 | - if ( empty( $this->checkout->reg_steps )) { |
|
641 | - EE_Error::add_error( __( 'No Reg Steps were loaded..', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__); |
|
640 | + if (empty($this->checkout->reg_steps)) { |
|
641 | + EE_Error::add_error(__('No Reg Steps were loaded..', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
642 | 642 | return false; |
643 | 643 | } |
644 | 644 | // make reg step details available to JS |
@@ -656,10 +656,10 @@ discard block |
||
656 | 656 | * @param int $order |
657 | 657 | * @return bool |
658 | 658 | */ |
659 | - private function _load_and_instantiate_reg_step( $reg_step = array(), $order = 0 ) { |
|
659 | + private function _load_and_instantiate_reg_step($reg_step = array(), $order = 0) { |
|
660 | 660 | |
661 | 661 | // we need a file_path, class_name, and slug to add a reg step |
662 | - if ( isset( $reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'] )) { |
|
662 | + if (isset($reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'])) { |
|
663 | 663 | // if editing a specific step, but this is NOT that step... (and it's not the 'finalize_registration' step) |
664 | 664 | if ( |
665 | 665 | $this->checkout->reg_url_link |
@@ -677,26 +677,26 @@ discard block |
||
677 | 677 | FALSE |
678 | 678 | ); |
679 | 679 | // did we gets the goods ? |
680 | - if ( $reg_step_obj instanceof EE_SPCO_Reg_Step ) { |
|
680 | + if ($reg_step_obj instanceof EE_SPCO_Reg_Step) { |
|
681 | 681 | // set reg step order based on config |
682 | - $reg_step_obj->set_order( $order ); |
|
682 | + $reg_step_obj->set_order($order); |
|
683 | 683 | // add instantiated reg step object to the master reg steps array |
684 | - $this->checkout->add_reg_step( $reg_step_obj ); |
|
684 | + $this->checkout->add_reg_step($reg_step_obj); |
|
685 | 685 | } else { |
686 | 686 | EE_Error::add_error( |
687 | - __( 'The current step could not be set.', 'event_espresso' ), |
|
687 | + __('The current step could not be set.', 'event_espresso'), |
|
688 | 688 | __FILE__, __FUNCTION__, __LINE__ |
689 | 689 | ); |
690 | 690 | return false; |
691 | 691 | } |
692 | 692 | } else { |
693 | - if ( WP_DEBUG ) { |
|
693 | + if (WP_DEBUG) { |
|
694 | 694 | EE_Error::add_error( |
695 | 695 | sprintf( |
696 | - __( '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' ), |
|
697 | - isset( $reg_step['file_path'] ) ? $reg_step['file_path'] : '', |
|
698 | - isset( $reg_step['class_name'] ) ? $reg_step['class_name'] : '', |
|
699 | - isset( $reg_step['slug'] ) ? $reg_step['slug'] : '', |
|
696 | + __('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'), |
|
697 | + isset($reg_step['file_path']) ? $reg_step['file_path'] : '', |
|
698 | + isset($reg_step['class_name']) ? $reg_step['class_name'] : '', |
|
699 | + isset($reg_step['slug']) ? $reg_step['slug'] : '', |
|
700 | 700 | '<ul>', |
701 | 701 | '<li>', |
702 | 702 | '</li>', |
@@ -720,16 +720,16 @@ discard block |
||
720 | 720 | */ |
721 | 721 | private function _get_transaction_and_cart_for_previous_visit() { |
722 | 722 | /** @var $TXN_model EEM_Transaction */ |
723 | - $TXN_model = EE_Registry::instance()->load_model( 'Transaction' ); |
|
723 | + $TXN_model = EE_Registry::instance()->load_model('Transaction'); |
|
724 | 724 | // 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 |
725 | - $transaction = $TXN_model->get_transaction_from_reg_url_link( $this->checkout->reg_url_link ); |
|
725 | + $transaction = $TXN_model->get_transaction_from_reg_url_link($this->checkout->reg_url_link); |
|
726 | 726 | // verify transaction |
727 | - if ( $transaction instanceof EE_Transaction ) { |
|
727 | + if ($transaction instanceof EE_Transaction) { |
|
728 | 728 | // and get the cart that was used for that transaction |
729 | - $this->checkout->cart = $this->_get_cart_for_transaction( $transaction ); |
|
729 | + $this->checkout->cart = $this->_get_cart_for_transaction($transaction); |
|
730 | 730 | return $transaction; |
731 | 731 | } else { |
732 | - EE_Error::add_error( __( 'Your Registration and Transaction information could not be retrieved from the db.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__); |
|
732 | + EE_Error::add_error(__('Your Registration and Transaction information could not be retrieved from the db.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
733 | 733 | return NULL; |
734 | 734 | } |
735 | 735 | } |
@@ -743,8 +743,8 @@ discard block |
||
743 | 743 | * @param EE_Transaction $transaction |
744 | 744 | * @return EE_Cart |
745 | 745 | */ |
746 | - private function _get_cart_for_transaction( $transaction ) { |
|
747 | - return $this->checkout->get_cart_for_transaction( $transaction ); |
|
746 | + private function _get_cart_for_transaction($transaction) { |
|
747 | + return $this->checkout->get_cart_for_transaction($transaction); |
|
748 | 748 | } |
749 | 749 | |
750 | 750 | |
@@ -756,8 +756,8 @@ discard block |
||
756 | 756 | * @param EE_Transaction $transaction |
757 | 757 | * @return EE_Cart |
758 | 758 | */ |
759 | - public function get_cart_for_transaction( EE_Transaction $transaction ) { |
|
760 | - return $this->checkout->get_cart_for_transaction( $transaction ); |
|
759 | + public function get_cart_for_transaction(EE_Transaction $transaction) { |
|
760 | + return $this->checkout->get_cart_for_transaction($transaction); |
|
761 | 761 | } |
762 | 762 | |
763 | 763 | |
@@ -773,17 +773,17 @@ discard block |
||
773 | 773 | private function _get_cart_for_current_session_and_setup_new_transaction() { |
774 | 774 | // if there's no transaction, then this is the FIRST visit to SPCO |
775 | 775 | // so load up the cart ( passing nothing for the TXN because it doesn't exist yet ) |
776 | - $this->checkout->cart = $this->_get_cart_for_transaction( NULL ); |
|
776 | + $this->checkout->cart = $this->_get_cart_for_transaction(NULL); |
|
777 | 777 | // and then create a new transaction |
778 | 778 | $transaction = $this->_initialize_transaction(); |
779 | 779 | // verify transaction |
780 | - if ( $transaction instanceof EE_Transaction ) { |
|
780 | + if ($transaction instanceof EE_Transaction) { |
|
781 | 781 | // save it so that we have an ID for other objects to use |
782 | 782 | $transaction->save(); |
783 | 783 | // and save TXN data to the cart |
784 | - $this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn( $transaction->ID() ); |
|
784 | + $this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn($transaction->ID()); |
|
785 | 785 | } else { |
786 | - EE_Error::add_error( __( 'A Valid Transaction could not be initialized.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
786 | + EE_Error::add_error(__('A Valid Transaction could not be initialized.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
787 | 787 | } |
788 | 788 | return $transaction; |
789 | 789 | } |
@@ -811,8 +811,8 @@ discard block |
||
811 | 811 | 'STS_ID' => EEM_Transaction::failed_status_code, |
812 | 812 | ) |
813 | 813 | ); |
814 | - } catch( Exception $e ) { |
|
815 | - EE_Error::add_error( $e->getMessage(), __FILE__, __FUNCTION__, __LINE__); |
|
814 | + } catch (Exception $e) { |
|
815 | + EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__); |
|
816 | 816 | } |
817 | 817 | return NULL; |
818 | 818 | } |
@@ -828,38 +828,38 @@ discard block |
||
828 | 828 | * @throws \EventEspresso\core\exceptions\InvalidEntityException |
829 | 829 | * @throws \EE_Error |
830 | 830 | */ |
831 | - private function _get_registrations( EE_Transaction $transaction ) { |
|
831 | + private function _get_registrations(EE_Transaction $transaction) { |
|
832 | 832 | // first step: grab the registrants { : o |
833 | - $registrations = $transaction->registrations( $this->checkout->reg_cache_where_params, true ); |
|
833 | + $registrations = $transaction->registrations($this->checkout->reg_cache_where_params, true); |
|
834 | 834 | // verify registrations have been set |
835 | - if ( empty( $registrations )) { |
|
835 | + if (empty($registrations)) { |
|
836 | 836 | // if no cached registrations, then check the db |
837 | - $registrations = $transaction->registrations( $this->checkout->reg_cache_where_params, false ); |
|
837 | + $registrations = $transaction->registrations($this->checkout->reg_cache_where_params, false); |
|
838 | 838 | // still nothing ? well as long as this isn't a revisit |
839 | - if ( empty( $registrations ) && ! $this->checkout->revisit ) { |
|
839 | + if (empty($registrations) && ! $this->checkout->revisit) { |
|
840 | 840 | // generate new registrations from scratch |
841 | - $registrations = $this->_initialize_registrations( $transaction ); |
|
841 | + $registrations = $this->_initialize_registrations($transaction); |
|
842 | 842 | } |
843 | 843 | } |
844 | 844 | // sort by their original registration order |
845 | - usort( $registrations, array( 'EED_Single_Page_Checkout', 'sort_registrations_by_REG_count' )); |
|
845 | + usort($registrations, array('EED_Single_Page_Checkout', 'sort_registrations_by_REG_count')); |
|
846 | 846 | // then loop thru the array |
847 | - foreach ( $registrations as $registration ) { |
|
847 | + foreach ($registrations as $registration) { |
|
848 | 848 | // verify each registration |
849 | - if ( $registration instanceof EE_Registration ) { |
|
849 | + if ($registration instanceof EE_Registration) { |
|
850 | 850 | // we display all attendee info for the primary registrant |
851 | - if ( $this->checkout->reg_url_link === $registration->reg_url_link() |
|
851 | + if ($this->checkout->reg_url_link === $registration->reg_url_link() |
|
852 | 852 | && $registration->is_primary_registrant() |
853 | 853 | ) { |
854 | 854 | $this->checkout->primary_revisit = true; |
855 | 855 | break; |
856 | - } else if ( $this->checkout->revisit |
|
856 | + } else if ($this->checkout->revisit |
|
857 | 857 | && $this->checkout->reg_url_link !== $registration->reg_url_link() |
858 | 858 | ) { |
859 | 859 | // but hide info if it doesn't belong to you |
860 | - $transaction->clear_cache( 'Registration', $registration->ID() ); |
|
860 | + $transaction->clear_cache('Registration', $registration->ID()); |
|
861 | 861 | } |
862 | - $this->checkout->set_reg_status_updated( $registration->ID(), false ); |
|
862 | + $this->checkout->set_reg_status_updated($registration->ID(), false); |
|
863 | 863 | } |
864 | 864 | } |
865 | 865 | } |
@@ -875,17 +875,17 @@ discard block |
||
875 | 875 | * @throws \EventEspresso\core\exceptions\InvalidEntityException |
876 | 876 | * @throws \EE_Error |
877 | 877 | */ |
878 | - private function _initialize_registrations( EE_Transaction $transaction ) { |
|
878 | + private function _initialize_registrations(EE_Transaction $transaction) { |
|
879 | 879 | $att_nmbr = 0; |
880 | 880 | $registrations = array(); |
881 | - if ( $transaction instanceof EE_Transaction ) { |
|
881 | + if ($transaction instanceof EE_Transaction) { |
|
882 | 882 | /** @type EE_Registration_Processor $registration_processor */ |
883 | - $registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' ); |
|
883 | + $registration_processor = EE_Registry::instance()->load_class('Registration_Processor'); |
|
884 | 884 | $this->checkout->total_ticket_count = $this->checkout->cart->all_ticket_quantity_count(); |
885 | 885 | // now let's add the cart items to the $transaction |
886 | - foreach ( $this->checkout->cart->get_tickets() as $line_item ) { |
|
886 | + foreach ($this->checkout->cart->get_tickets() as $line_item) { |
|
887 | 887 | //do the following for each ticket of this type they selected |
888 | - for ( $x = 1; $x <= $line_item->quantity(); $x++ ) { |
|
888 | + for ($x = 1; $x <= $line_item->quantity(); $x++) { |
|
889 | 889 | $att_nmbr++; |
890 | 890 | /** @var EventEspresso\core\services\commands\registration\CreateRegistrationCommand $CreateRegistrationCommand */ |
891 | 891 | $CreateRegistrationCommand = EE_Registry::instance() |
@@ -901,17 +901,17 @@ discard block |
||
901 | 901 | // override capabilities for frontend registrations |
902 | 902 | if ( ! is_admin()) { |
903 | 903 | $CreateRegistrationCommand->setCapCheck( |
904 | - new PublicCapabilities( '', 'create_new_registration' ) |
|
904 | + new PublicCapabilities('', 'create_new_registration') |
|
905 | 905 | ); |
906 | 906 | } |
907 | - $registration = EE_Registry::instance()->BUS->execute( $CreateRegistrationCommand ); |
|
908 | - if ( ! $registration instanceof EE_Registration ) { |
|
909 | - throw new InvalidEntityException( $registration, 'EE_Registration' ); |
|
907 | + $registration = EE_Registry::instance()->BUS->execute($CreateRegistrationCommand); |
|
908 | + if ( ! $registration instanceof EE_Registration) { |
|
909 | + throw new InvalidEntityException($registration, 'EE_Registration'); |
|
910 | 910 | } |
911 | - $registrations[ $registration->ID() ] = $registration; |
|
911 | + $registrations[$registration->ID()] = $registration; |
|
912 | 912 | } |
913 | 913 | } |
914 | - $registration_processor->fix_reg_final_price_rounding_issue( $transaction ); |
|
914 | + $registration_processor->fix_reg_final_price_rounding_issue($transaction); |
|
915 | 915 | } |
916 | 916 | return $registrations; |
917 | 917 | } |
@@ -926,12 +926,12 @@ discard block |
||
926 | 926 | * @param EE_Registration $reg_B |
927 | 927 | * @return int |
928 | 928 | */ |
929 | - public static function sort_registrations_by_REG_count( EE_Registration $reg_A, EE_Registration $reg_B ) { |
|
929 | + public static function sort_registrations_by_REG_count(EE_Registration $reg_A, EE_Registration $reg_B) { |
|
930 | 930 | // this shouldn't ever happen within the same TXN, but oh well |
931 | - if ( $reg_A->count() === $reg_B->count() ) { |
|
931 | + if ($reg_A->count() === $reg_B->count()) { |
|
932 | 932 | return 0; |
933 | 933 | } |
934 | - return ( $reg_A->count() > $reg_B->count() ) ? 1 : -1; |
|
934 | + return ($reg_A->count() > $reg_B->count()) ? 1 : -1; |
|
935 | 935 | } |
936 | 936 | |
937 | 937 | |
@@ -946,21 +946,21 @@ discard block |
||
946 | 946 | */ |
947 | 947 | private function _final_verifications() { |
948 | 948 | // filter checkout |
949 | - $this->checkout = apply_filters( 'FHEE__EED_Single_Page_Checkout___final_verifications__checkout', $this->checkout ); |
|
949 | + $this->checkout = apply_filters('FHEE__EED_Single_Page_Checkout___final_verifications__checkout', $this->checkout); |
|
950 | 950 | //verify that current step is still set correctly |
951 | - if ( ! $this->checkout->current_step instanceof EE_SPCO_Reg_Step ) { |
|
952 | - 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__ ); |
|
951 | + if ( ! $this->checkout->current_step instanceof EE_SPCO_Reg_Step) { |
|
952 | + 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__); |
|
953 | 953 | return false; |
954 | 954 | } |
955 | 955 | // if returning to SPCO, then verify that primary registrant is set |
956 | - if ( ! empty( $this->checkout->reg_url_link )) { |
|
956 | + if ( ! empty($this->checkout->reg_url_link)) { |
|
957 | 957 | $valid_registrant = $this->checkout->transaction->primary_registration(); |
958 | - if ( ! $valid_registrant instanceof EE_Registration ) { |
|
959 | - 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__ ); |
|
958 | + if ( ! $valid_registrant instanceof EE_Registration) { |
|
959 | + 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__); |
|
960 | 960 | return false; |
961 | 961 | } |
962 | 962 | $valid_registrant = null; |
963 | - foreach ( $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params ) as $registration ) { |
|
963 | + foreach ($this->checkout->transaction->registrations($this->checkout->reg_cache_where_params) as $registration) { |
|
964 | 964 | if ( |
965 | 965 | $registration instanceof EE_Registration |
966 | 966 | && $registration->reg_url_link() === $this->checkout->reg_url_link |
@@ -968,9 +968,9 @@ discard block |
||
968 | 968 | $valid_registrant = $registration; |
969 | 969 | } |
970 | 970 | } |
971 | - if ( ! $valid_registrant instanceof EE_Registration ) { |
|
971 | + if ( ! $valid_registrant instanceof EE_Registration) { |
|
972 | 972 | // hmmm... maybe we have the wrong session because the user is opening multiple tabs ? |
973 | - if ( EED_Single_Page_Checkout::$_checkout_verified ) { |
|
973 | + if (EED_Single_Page_Checkout::$_checkout_verified) { |
|
974 | 974 | // clear the session, mark the checkout as unverified, and try again |
975 | 975 | EE_Registry::instance()->SSN->clear_session(); |
976 | 976 | EED_Single_Page_Checkout::$_initialized = false; |
@@ -979,13 +979,13 @@ discard block |
||
979 | 979 | EE_Error::reset_notices(); |
980 | 980 | return false; |
981 | 981 | } |
982 | - 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__ ); |
|
982 | + 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__); |
|
983 | 983 | return false; |
984 | 984 | } |
985 | 985 | } |
986 | 986 | // now that things have been kinda sufficiently verified, |
987 | 987 | // let's add the checkout to the session so that's available other systems |
988 | - EE_Registry::instance()->SSN->set_checkout( $this->checkout ); |
|
988 | + EE_Registry::instance()->SSN->set_checkout($this->checkout); |
|
989 | 989 | return true; |
990 | 990 | } |
991 | 991 | |
@@ -1000,15 +1000,15 @@ discard block |
||
1000 | 1000 | * @param bool $reinitializing |
1001 | 1001 | * @throws \EE_Error |
1002 | 1002 | */ |
1003 | - private function _initialize_reg_steps( $reinitializing = false ) { |
|
1004 | - $this->checkout->set_reg_step_initiated( $this->checkout->current_step ); |
|
1003 | + private function _initialize_reg_steps($reinitializing = false) { |
|
1004 | + $this->checkout->set_reg_step_initiated($this->checkout->current_step); |
|
1005 | 1005 | // loop thru all steps to call their individual "initialize" methods and set i18n strings for JS |
1006 | - foreach ( $this->checkout->reg_steps as $reg_step ) { |
|
1007 | - if ( ! $reg_step->initialize_reg_step() ) { |
|
1006 | + foreach ($this->checkout->reg_steps as $reg_step) { |
|
1007 | + if ( ! $reg_step->initialize_reg_step()) { |
|
1008 | 1008 | // if not initialized then maybe this step is being removed... |
1009 | - if ( ! $reinitializing && $reg_step->is_current_step() ) { |
|
1009 | + if ( ! $reinitializing && $reg_step->is_current_step()) { |
|
1010 | 1010 | // if it was the current step, then we need to start over here |
1011 | - $this->_initialize_reg_steps( true ); |
|
1011 | + $this->_initialize_reg_steps(true); |
|
1012 | 1012 | return; |
1013 | 1013 | } |
1014 | 1014 | continue; |
@@ -1017,13 +1017,13 @@ discard block |
||
1017 | 1017 | $reg_step->enqueue_styles_and_scripts(); |
1018 | 1018 | // i18n |
1019 | 1019 | $reg_step->translate_js_strings(); |
1020 | - if ( $reg_step->is_current_step() ) { |
|
1020 | + if ($reg_step->is_current_step()) { |
|
1021 | 1021 | // the text that appears on the reg step form submit button |
1022 | 1022 | $reg_step->set_submit_button_text(); |
1023 | 1023 | } |
1024 | 1024 | } |
1025 | 1025 | // dynamically creates hook point like: AHEE__Single_Page_Checkout___initialize_reg_step__attendee_information |
1026 | - do_action( "AHEE__Single_Page_Checkout___initialize_reg_step__{$this->checkout->current_step->slug()}", $this->checkout->current_step ); |
|
1026 | + do_action("AHEE__Single_Page_Checkout___initialize_reg_step__{$this->checkout->current_step->slug()}", $this->checkout->current_step); |
|
1027 | 1027 | } |
1028 | 1028 | |
1029 | 1029 | |
@@ -1036,43 +1036,43 @@ discard block |
||
1036 | 1036 | */ |
1037 | 1037 | private function _check_form_submission() { |
1038 | 1038 | //does this request require the reg form to be generated ? |
1039 | - if ( $this->checkout->generate_reg_form ) { |
|
1039 | + if ($this->checkout->generate_reg_form) { |
|
1040 | 1040 | // ever heard that song by Blue Rodeo ? |
1041 | 1041 | try { |
1042 | 1042 | $this->checkout->current_step->reg_form = $this->checkout->current_step->generate_reg_form(); |
1043 | 1043 | // if not displaying a form, then check for form submission |
1044 | - if ( $this->checkout->process_form_submission && $this->checkout->current_step->reg_form->was_submitted() ) { |
|
1044 | + if ($this->checkout->process_form_submission && $this->checkout->current_step->reg_form->was_submitted()) { |
|
1045 | 1045 | // clear out any old data in case this step is being run again |
1046 | - $this->checkout->current_step->set_valid_data( array() ); |
|
1046 | + $this->checkout->current_step->set_valid_data(array()); |
|
1047 | 1047 | // capture submitted form data |
1048 | 1048 | $this->checkout->current_step->reg_form->receive_form_submission( |
1049 | - apply_filters( 'FHEE__Single_Page_Checkout___check_form_submission__request_params', EE_Registry::instance()->REQ->params(), $this->checkout ) |
|
1049 | + apply_filters('FHEE__Single_Page_Checkout___check_form_submission__request_params', EE_Registry::instance()->REQ->params(), $this->checkout) |
|
1050 | 1050 | ); |
1051 | 1051 | // validate submitted form data |
1052 | - if ( ! $this->checkout->continue_reg && ! $this->checkout->current_step->reg_form->is_valid() ) { |
|
1052 | + if ( ! $this->checkout->continue_reg && ! $this->checkout->current_step->reg_form->is_valid()) { |
|
1053 | 1053 | // thou shall not pass !!! |
1054 | 1054 | $this->checkout->continue_reg = FALSE; |
1055 | 1055 | // any form validation errors? |
1056 | - if ( $this->checkout->current_step->reg_form->submission_error_message() !== '' ) { |
|
1056 | + if ($this->checkout->current_step->reg_form->submission_error_message() !== '') { |
|
1057 | 1057 | $submission_error_messages = array(); |
1058 | 1058 | // bad, bad, bad registrant |
1059 | - foreach( $this->checkout->current_step->reg_form->get_validation_errors_accumulated() as $validation_error ){ |
|
1060 | - if ( $validation_error instanceof EE_Validation_Error ) { |
|
1059 | + foreach ($this->checkout->current_step->reg_form->get_validation_errors_accumulated() as $validation_error) { |
|
1060 | + if ($validation_error instanceof EE_Validation_Error) { |
|
1061 | 1061 | $submission_error_messages[] = sprintf( |
1062 | - __( '%s : %s', 'event_espresso' ), |
|
1062 | + __('%s : %s', 'event_espresso'), |
|
1063 | 1063 | $validation_error->get_form_section()->html_label_text(), |
1064 | 1064 | $validation_error->getMessage() |
1065 | 1065 | ); |
1066 | 1066 | } |
1067 | 1067 | } |
1068 | - EE_Error::add_error( implode( '<br />', $submission_error_messages ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1068 | + EE_Error::add_error(implode('<br />', $submission_error_messages), __FILE__, __FUNCTION__, __LINE__); |
|
1069 | 1069 | } |
1070 | 1070 | // well not really... what will happen is we'll just get redirected back to redo the current step |
1071 | 1071 | $this->go_to_next_step(); |
1072 | 1072 | return; |
1073 | 1073 | } |
1074 | 1074 | } |
1075 | - } catch( EE_Error $e ) { |
|
1075 | + } catch (EE_Error $e) { |
|
1076 | 1076 | $e->get_error(); |
1077 | 1077 | } |
1078 | 1078 | } |
@@ -1089,22 +1089,22 @@ discard block |
||
1089 | 1089 | */ |
1090 | 1090 | private function _process_form_action() { |
1091 | 1091 | // what cha wanna do? |
1092 | - switch( $this->checkout->action ) { |
|
1092 | + switch ($this->checkout->action) { |
|
1093 | 1093 | // AJAX next step reg form |
1094 | 1094 | case 'display_spco_reg_step' : |
1095 | 1095 | $this->checkout->redirect = FALSE; |
1096 | - if ( EE_Registry::instance()->REQ->ajax ) { |
|
1097 | - $this->checkout->json_response->set_reg_step_html( $this->checkout->current_step->display_reg_form() ); |
|
1096 | + if (EE_Registry::instance()->REQ->ajax) { |
|
1097 | + $this->checkout->json_response->set_reg_step_html($this->checkout->current_step->display_reg_form()); |
|
1098 | 1098 | } |
1099 | 1099 | break; |
1100 | 1100 | |
1101 | 1101 | default : |
1102 | 1102 | // meh... do one of those other steps first |
1103 | - if ( ! empty( $this->checkout->action ) && is_callable( array( $this->checkout->current_step, $this->checkout->action ))) { |
|
1103 | + if ( ! empty($this->checkout->action) && is_callable(array($this->checkout->current_step, $this->checkout->action))) { |
|
1104 | 1104 | // dynamically creates hook point like: AHEE__Single_Page_Checkout__before_attendee_information__process_reg_step |
1105 | - do_action( "AHEE__Single_Page_Checkout__before_{$this->checkout->current_step->slug()}__{$this->checkout->action}", $this->checkout->current_step ); |
|
1105 | + do_action("AHEE__Single_Page_Checkout__before_{$this->checkout->current_step->slug()}__{$this->checkout->action}", $this->checkout->current_step); |
|
1106 | 1106 | // call action on current step |
1107 | - if ( call_user_func( array( $this->checkout->current_step, $this->checkout->action )) ) { |
|
1107 | + if (call_user_func(array($this->checkout->current_step, $this->checkout->action))) { |
|
1108 | 1108 | // good registrant, you get to proceed |
1109 | 1109 | if ( |
1110 | 1110 | $this->checkout->current_step->success_message() !== '' |
@@ -1115,7 +1115,7 @@ discard block |
||
1115 | 1115 | ) { |
1116 | 1116 | EE_Error::add_success( |
1117 | 1117 | $this->checkout->current_step->success_message() |
1118 | - . '<br />' . $this->checkout->next_step->_instructions() |
|
1118 | + . '<br />'.$this->checkout->next_step->_instructions() |
|
1119 | 1119 | ); |
1120 | 1120 | |
1121 | 1121 | } |
@@ -1123,12 +1123,12 @@ discard block |
||
1123 | 1123 | $this->_setup_redirect(); |
1124 | 1124 | } |
1125 | 1125 | // dynamically creates hook point like: AHEE__Single_Page_Checkout__after_payment_options__process_reg_step |
1126 | - do_action( "AHEE__Single_Page_Checkout__after_{$this->checkout->current_step->slug()}__{$this->checkout->action}", $this->checkout->current_step ); |
|
1126 | + do_action("AHEE__Single_Page_Checkout__after_{$this->checkout->current_step->slug()}__{$this->checkout->action}", $this->checkout->current_step); |
|
1127 | 1127 | |
1128 | 1128 | } else { |
1129 | 1129 | EE_Error::add_error( |
1130 | 1130 | sprintf( |
1131 | - __( 'The requested form action "%s" does not exist for the current "%s" registration step.', 'event_espresso' ), |
|
1131 | + __('The requested form action "%s" does not exist for the current "%s" registration step.', 'event_espresso'), |
|
1132 | 1132 | $this->checkout->action, |
1133 | 1133 | $this->checkout->current_step->name() |
1134 | 1134 | ), |
@@ -1154,10 +1154,10 @@ discard block |
||
1154 | 1154 | public function add_styles_and_scripts() { |
1155 | 1155 | // i18n |
1156 | 1156 | $this->translate_js_strings(); |
1157 | - if ( $this->checkout->admin_request ) { |
|
1158 | - add_action('admin_enqueue_scripts', array($this, 'enqueue_styles_and_scripts'), 10 ); |
|
1157 | + if ($this->checkout->admin_request) { |
|
1158 | + add_action('admin_enqueue_scripts', array($this, 'enqueue_styles_and_scripts'), 10); |
|
1159 | 1159 | } else { |
1160 | - add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_styles_and_scripts' ), 10 ); |
|
1160 | + add_action('wp_enqueue_scripts', array($this, 'enqueue_styles_and_scripts'), 10); |
|
1161 | 1161 | } |
1162 | 1162 | } |
1163 | 1163 | |
@@ -1173,42 +1173,42 @@ discard block |
||
1173 | 1173 | EE_Registry::$i18n_js_strings['revisit'] = $this->checkout->revisit; |
1174 | 1174 | EE_Registry::$i18n_js_strings['e_reg_url_link'] = $this->checkout->reg_url_link; |
1175 | 1175 | 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'); |
1176 | - 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' ); |
|
1177 | - 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' ); |
|
1178 | - 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' ); |
|
1176 | + 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'); |
|
1177 | + 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'); |
|
1178 | + 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'); |
|
1179 | 1179 | EE_Registry::$i18n_js_strings['reg_step_error'] = __('This registration step could not be completed. Please refresh the page and try again.', 'event_espresso'); |
1180 | 1180 | 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'); |
1181 | - 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/>' ); |
|
1182 | - EE_Registry::$i18n_js_strings['language'] = get_bloginfo( 'language' ); |
|
1181 | + 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/>'); |
|
1182 | + EE_Registry::$i18n_js_strings['language'] = get_bloginfo('language'); |
|
1183 | 1183 | EE_Registry::$i18n_js_strings['EESID'] = EE_Registry::instance()->SSN->id(); |
1184 | 1184 | EE_Registry::$i18n_js_strings['currency'] = EE_Registry::instance()->CFG->currency; |
1185 | 1185 | EE_Registry::$i18n_js_strings['datepicker_yearRange'] = '-150:+20'; |
1186 | - EE_Registry::$i18n_js_strings['timer_years'] = __( 'years', 'event_espresso' ); |
|
1187 | - EE_Registry::$i18n_js_strings['timer_months'] = __( 'months', 'event_espresso' ); |
|
1188 | - EE_Registry::$i18n_js_strings['timer_weeks'] = __( 'weeks', 'event_espresso' ); |
|
1189 | - EE_Registry::$i18n_js_strings['timer_days'] = __( 'days', 'event_espresso' ); |
|
1190 | - EE_Registry::$i18n_js_strings['timer_hours'] = __( 'hours', 'event_espresso' ); |
|
1191 | - EE_Registry::$i18n_js_strings['timer_minutes'] = __( 'minutes', 'event_espresso' ); |
|
1192 | - EE_Registry::$i18n_js_strings['timer_seconds'] = __( 'seconds', 'event_espresso' ); |
|
1193 | - EE_Registry::$i18n_js_strings['timer_year'] = __( 'year', 'event_espresso' ); |
|
1194 | - EE_Registry::$i18n_js_strings['timer_month'] = __( 'month', 'event_espresso' ); |
|
1195 | - EE_Registry::$i18n_js_strings['timer_week'] = __( 'week', 'event_espresso' ); |
|
1196 | - EE_Registry::$i18n_js_strings['timer_day'] = __( 'day', 'event_espresso' ); |
|
1197 | - EE_Registry::$i18n_js_strings['timer_hour'] = __( 'hour', 'event_espresso' ); |
|
1198 | - EE_Registry::$i18n_js_strings['timer_minute'] = __( 'minute', 'event_espresso' ); |
|
1199 | - EE_Registry::$i18n_js_strings['timer_second'] = __( 'second', 'event_espresso' ); |
|
1186 | + EE_Registry::$i18n_js_strings['timer_years'] = __('years', 'event_espresso'); |
|
1187 | + EE_Registry::$i18n_js_strings['timer_months'] = __('months', 'event_espresso'); |
|
1188 | + EE_Registry::$i18n_js_strings['timer_weeks'] = __('weeks', 'event_espresso'); |
|
1189 | + EE_Registry::$i18n_js_strings['timer_days'] = __('days', 'event_espresso'); |
|
1190 | + EE_Registry::$i18n_js_strings['timer_hours'] = __('hours', 'event_espresso'); |
|
1191 | + EE_Registry::$i18n_js_strings['timer_minutes'] = __('minutes', 'event_espresso'); |
|
1192 | + EE_Registry::$i18n_js_strings['timer_seconds'] = __('seconds', 'event_espresso'); |
|
1193 | + EE_Registry::$i18n_js_strings['timer_year'] = __('year', 'event_espresso'); |
|
1194 | + EE_Registry::$i18n_js_strings['timer_month'] = __('month', 'event_espresso'); |
|
1195 | + EE_Registry::$i18n_js_strings['timer_week'] = __('week', 'event_espresso'); |
|
1196 | + EE_Registry::$i18n_js_strings['timer_day'] = __('day', 'event_espresso'); |
|
1197 | + EE_Registry::$i18n_js_strings['timer_hour'] = __('hour', 'event_espresso'); |
|
1198 | + EE_Registry::$i18n_js_strings['timer_minute'] = __('minute', 'event_espresso'); |
|
1199 | + EE_Registry::$i18n_js_strings['timer_second'] = __('second', 'event_espresso'); |
|
1200 | 1200 | EE_Registry::$i18n_js_strings['registration_expiration_notice'] = sprintf( |
1201 | - __( '%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' ), |
|
1201 | + __('%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'), |
|
1202 | 1202 | '<h4 class="important-notice">', |
1203 | 1203 | '</h4>', |
1204 | 1204 | '<br />', |
1205 | 1205 | '<p>', |
1206 | - '<a href="'. get_post_type_archive_link( 'espresso_events' ) . '" title="', |
|
1206 | + '<a href="'.get_post_type_archive_link('espresso_events').'" title="', |
|
1207 | 1207 | '">', |
1208 | 1208 | '</a>', |
1209 | 1209 | '</p>' |
1210 | 1210 | ); |
1211 | - EE_Registry::$i18n_js_strings[ 'ajax_submit' ] = apply_filters( 'FHEE__Single_Page_Checkout__translate_js_strings__ajax_submit', true ); |
|
1211 | + EE_Registry::$i18n_js_strings['ajax_submit'] = apply_filters('FHEE__Single_Page_Checkout__translate_js_strings__ajax_submit', true); |
|
1212 | 1212 | } |
1213 | 1213 | |
1214 | 1214 | |
@@ -1221,25 +1221,25 @@ discard block |
||
1221 | 1221 | */ |
1222 | 1222 | public function enqueue_styles_and_scripts() { |
1223 | 1223 | // load css |
1224 | - wp_register_style( 'single_page_checkout', SPCO_CSS_URL . 'single_page_checkout.css', array(), EVENT_ESPRESSO_VERSION ); |
|
1225 | - wp_enqueue_style( 'single_page_checkout' ); |
|
1224 | + wp_register_style('single_page_checkout', SPCO_CSS_URL.'single_page_checkout.css', array(), EVENT_ESPRESSO_VERSION); |
|
1225 | + wp_enqueue_style('single_page_checkout'); |
|
1226 | 1226 | // load JS |
1227 | - wp_register_script( 'jquery_plugin', EE_THIRD_PARTY_URL . 'jquery .plugin.min.js', array( 'jquery' ), '1.0.1', TRUE ); |
|
1228 | - wp_register_script( 'jquery_countdown', EE_THIRD_PARTY_URL . 'jquery .countdown.min.js', array( 'jquery_plugin' ), '2.0.2', TRUE ); |
|
1229 | - 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 ); |
|
1230 | - wp_enqueue_script( 'single_page_checkout' ); |
|
1227 | + wp_register_script('jquery_plugin', EE_THIRD_PARTY_URL.'jquery .plugin.min.js', array('jquery'), '1.0.1', TRUE); |
|
1228 | + wp_register_script('jquery_countdown', EE_THIRD_PARTY_URL.'jquery .countdown.min.js', array('jquery_plugin'), '2.0.2', TRUE); |
|
1229 | + 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); |
|
1230 | + wp_enqueue_script('single_page_checkout'); |
|
1231 | 1231 | |
1232 | 1232 | /** |
1233 | 1233 | * global action hook for enqueueing styles and scripts with |
1234 | 1234 | * spco calls. |
1235 | 1235 | */ |
1236 | - do_action( 'AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts', $this ); |
|
1236 | + do_action('AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts', $this); |
|
1237 | 1237 | |
1238 | 1238 | /** |
1239 | 1239 | * dynamic action hook for enqueueing styles and scripts with spco calls. |
1240 | 1240 | * The hook will end up being something like AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts__attendee_information |
1241 | 1241 | */ |
1242 | - do_action( 'AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts__' . $this->checkout->current_step->slug(), $this ); |
|
1242 | + do_action('AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts__'.$this->checkout->current_step->slug(), $this); |
|
1243 | 1243 | |
1244 | 1244 | } |
1245 | 1245 | |
@@ -1254,19 +1254,19 @@ discard block |
||
1254 | 1254 | */ |
1255 | 1255 | private function _display_spco_reg_form() { |
1256 | 1256 | // if registering via the admin, just display the reg form for the current step |
1257 | - if ( $this->checkout->admin_request ) { |
|
1258 | - EE_Registry::instance()->REQ->add_output( $this->checkout->current_step->display_reg_form() ); |
|
1257 | + if ($this->checkout->admin_request) { |
|
1258 | + EE_Registry::instance()->REQ->add_output($this->checkout->current_step->display_reg_form()); |
|
1259 | 1259 | } else { |
1260 | 1260 | // add powered by EE msg |
1261 | - add_action( 'AHEE__SPCO__reg_form_footer', array( 'EED_Single_Page_Checkout', 'display_registration_footer' )); |
|
1261 | + add_action('AHEE__SPCO__reg_form_footer', array('EED_Single_Page_Checkout', 'display_registration_footer')); |
|
1262 | 1262 | |
1263 | - $empty_cart = count( $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params ) ) < 1 ? true : false; |
|
1263 | + $empty_cart = count($this->checkout->transaction->registrations($this->checkout->reg_cache_where_params)) < 1 ? true : false; |
|
1264 | 1264 | $cookies_not_set_msg = ''; |
1265 | - if ( $empty_cart && ! isset( $_COOKIE[ 'ee_cookie_test' ] ) ) { |
|
1265 | + if ($empty_cart && ! isset($_COOKIE['ee_cookie_test'])) { |
|
1266 | 1266 | $cookies_not_set_msg = apply_filters( |
1267 | 1267 | 'FHEE__Single_Page_Checkout__display_spco_reg_form__cookies_not_set_msg', |
1268 | 1268 | sprintf( |
1269 | - __( '%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' ), |
|
1269 | + __('%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'), |
|
1270 | 1270 | '<div class="ee-attention">', |
1271 | 1271 | '</div>', |
1272 | 1272 | '<h6 class="important-notice">', |
@@ -1286,7 +1286,7 @@ discard block |
||
1286 | 1286 | 'layout_strategy' => |
1287 | 1287 | new EE_Template_Layout( |
1288 | 1288 | array( |
1289 | - 'layout_template_file' => SPCO_TEMPLATES_PATH . 'registration_page_wrapper.template.php', |
|
1289 | + 'layout_template_file' => SPCO_TEMPLATES_PATH.'registration_page_wrapper.template.php', |
|
1290 | 1290 | 'template_args' => array( |
1291 | 1291 | 'empty_cart' => $empty_cart, |
1292 | 1292 | 'revisit' => $this->checkout->revisit, |
@@ -1295,8 +1295,8 @@ discard block |
||
1295 | 1295 | 'empty_msg' => apply_filters( |
1296 | 1296 | 'FHEE__Single_Page_Checkout__display_spco_reg_form__empty_msg', |
1297 | 1297 | sprintf( |
1298 | - __( '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' ), |
|
1299 | - '<a href="' . get_post_type_archive_link( 'espresso_events' ) . '" title="', |
|
1298 | + __('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'), |
|
1299 | + '<a href="'.get_post_type_archive_link('espresso_events').'" title="', |
|
1300 | 1300 | '">', |
1301 | 1301 | '</a>' |
1302 | 1302 | ) |
@@ -1304,14 +1304,14 @@ discard block |
||
1304 | 1304 | 'cookies_not_set_msg' => $cookies_not_set_msg, |
1305 | 1305 | 'registration_time_limit' => $this->checkout->get_registration_time_limit(), |
1306 | 1306 | 'session_expiration' => |
1307 | - gmdate( 'M d, Y H:i:s', EE_Registry::instance()->SSN->expiration() + ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS ) ) |
|
1307 | + gmdate('M d, Y H:i:s', EE_Registry::instance()->SSN->expiration() + (get_option('gmt_offset') * HOUR_IN_SECONDS)) |
|
1308 | 1308 | ) |
1309 | 1309 | ) |
1310 | 1310 | ) |
1311 | 1311 | ) |
1312 | 1312 | ); |
1313 | 1313 | // load template and add to output sent that gets filtered into the_content() |
1314 | - EE_Registry::instance()->REQ->add_output( $this->checkout->registration_form->get_html() ); |
|
1314 | + EE_Registry::instance()->REQ->add_output($this->checkout->registration_form->get_html()); |
|
1315 | 1315 | } |
1316 | 1316 | } |
1317 | 1317 | |
@@ -1325,8 +1325,8 @@ discard block |
||
1325 | 1325 | * @internal param string $label |
1326 | 1326 | * @return void |
1327 | 1327 | */ |
1328 | - public function add_extra_finalize_registration_inputs( $next_step ) { |
|
1329 | - if ( $next_step === 'finalize_registration' ) { |
|
1328 | + public function add_extra_finalize_registration_inputs($next_step) { |
|
1329 | + if ($next_step === 'finalize_registration') { |
|
1330 | 1330 | echo '<div id="spco-extra-finalize_registration-inputs-dv"></div>'; |
1331 | 1331 | } |
1332 | 1332 | } |
@@ -1348,8 +1348,8 @@ discard block |
||
1348 | 1348 | ) { |
1349 | 1349 | add_filter( |
1350 | 1350 | 'FHEE__EEH_Template__powered_by_event_espresso__url', |
1351 | - function( $url) { |
|
1352 | - return apply_filters( 'FHEE__EE_Front_Controller__registration_footer__url', $url ); |
|
1351 | + function($url) { |
|
1352 | + return apply_filters('FHEE__EE_Front_Controller__registration_footer__url', $url); |
|
1353 | 1353 | } |
1354 | 1354 | ); |
1355 | 1355 | echo apply_filters( |
@@ -1357,7 +1357,7 @@ discard block |
||
1357 | 1357 | \EEH_Template::powered_by_event_espresso( |
1358 | 1358 | '', |
1359 | 1359 | 'espresso-registration-footer-dv', |
1360 | - array( 'utm_content' => 'registration_checkout' ) |
|
1360 | + array('utm_content' => 'registration_checkout') |
|
1361 | 1361 | ) |
1362 | 1362 | ); |
1363 | 1363 | } |
@@ -1374,7 +1374,7 @@ discard block |
||
1374 | 1374 | * @throws \EE_Error |
1375 | 1375 | */ |
1376 | 1376 | public function unlock_transaction() { |
1377 | - if ( $this->checkout->transaction instanceof EE_Transaction ) { |
|
1377 | + if ($this->checkout->transaction instanceof EE_Transaction) { |
|
1378 | 1378 | $this->checkout->transaction->unlock(); |
1379 | 1379 | } |
1380 | 1380 | } |
@@ -1389,9 +1389,9 @@ discard block |
||
1389 | 1389 | * @return void |
1390 | 1390 | */ |
1391 | 1391 | private function _setup_redirect() { |
1392 | - if ( $this->checkout->continue_reg && $this->checkout->next_step instanceof EE_SPCO_Reg_Step ) { |
|
1392 | + if ($this->checkout->continue_reg && $this->checkout->next_step instanceof EE_SPCO_Reg_Step) { |
|
1393 | 1393 | $this->checkout->redirect = TRUE; |
1394 | - if ( empty( $this->checkout->redirect_url )) { |
|
1394 | + if (empty($this->checkout->redirect_url)) { |
|
1395 | 1395 | $this->checkout->redirect_url = $this->checkout->next_step->reg_step_url(); |
1396 | 1396 | } |
1397 | 1397 | $this->checkout->redirect_url = apply_filters( |
@@ -1412,9 +1412,9 @@ discard block |
||
1412 | 1412 | * @throws \EE_Error |
1413 | 1413 | */ |
1414 | 1414 | public function go_to_next_step() { |
1415 | - if ( EE_Registry::instance()->REQ->ajax ) { |
|
1415 | + if (EE_Registry::instance()->REQ->ajax) { |
|
1416 | 1416 | // capture contents of output buffer we started earlier in the request, and insert into JSON response |
1417 | - $this->checkout->json_response->set_unexpected_errors( ob_get_clean() ); |
|
1417 | + $this->checkout->json_response->set_unexpected_errors(ob_get_clean()); |
|
1418 | 1418 | } |
1419 | 1419 | $this->unlock_transaction(); |
1420 | 1420 | // just return for these conditions |
@@ -1443,7 +1443,7 @@ discard block |
||
1443 | 1443 | */ |
1444 | 1444 | protected function _handle_json_response() { |
1445 | 1445 | // if this is an ajax request |
1446 | - if ( EE_Registry::instance()->REQ->ajax ) { |
|
1446 | + if (EE_Registry::instance()->REQ->ajax) { |
|
1447 | 1447 | // DEBUG LOG |
1448 | 1448 | //$this->checkout->log( |
1449 | 1449 | // __CLASS__, __FUNCTION__, __LINE__, |
@@ -1456,7 +1456,7 @@ discard block |
||
1456 | 1456 | $this->checkout->json_response->set_registration_time_limit( |
1457 | 1457 | $this->checkout->get_registration_time_limit() |
1458 | 1458 | ); |
1459 | - $this->checkout->json_response->set_payment_amount( $this->checkout->amount_owing ); |
|
1459 | + $this->checkout->json_response->set_payment_amount($this->checkout->amount_owing); |
|
1460 | 1460 | // just send the ajax ( |
1461 | 1461 | $json_response = apply_filters( |
1462 | 1462 | 'FHEE__EE_Single_Page_Checkout__JSON_response', |
@@ -1477,9 +1477,9 @@ discard block |
||
1477 | 1477 | */ |
1478 | 1478 | protected function _handle_html_redirects() { |
1479 | 1479 | // going somewhere ? |
1480 | - if ( $this->checkout->redirect && ! empty( $this->checkout->redirect_url ) ) { |
|
1480 | + if ($this->checkout->redirect && ! empty($this->checkout->redirect_url)) { |
|
1481 | 1481 | // store notices in a transient |
1482 | - EE_Error::get_notices( false, true, true ); |
|
1482 | + EE_Error::get_notices(false, true, true); |
|
1483 | 1483 | // DEBUG LOG |
1484 | 1484 | //$this->checkout->log( |
1485 | 1485 | // __CLASS__, __FUNCTION__, __LINE__, |
@@ -1489,7 +1489,7 @@ discard block |
||
1489 | 1489 | // 'headers_list' => headers_list(), |
1490 | 1490 | // ) |
1491 | 1491 | //); |
1492 | - wp_safe_redirect( $this->checkout->redirect_url ); |
|
1492 | + wp_safe_redirect($this->checkout->redirect_url); |
|
1493 | 1493 | exit(); |
1494 | 1494 | } |
1495 | 1495 | } |
@@ -1,16 +1,16 @@ discard block |
||
1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); } |
2 | 2 | /** |
3 | - * |
|
4 | - * Class EE_SPCO_Reg_Step |
|
5 | - * |
|
6 | - * Description |
|
7 | - * |
|
8 | - * @package Event Espresso |
|
9 | - * @subpackage core |
|
10 | - * @author Brent Christensen |
|
11 | - * @since 4.5.0 |
|
12 | - * |
|
13 | - */ |
|
3 | + * |
|
4 | + * Class EE_SPCO_Reg_Step |
|
5 | + * |
|
6 | + * Description |
|
7 | + * |
|
8 | + * @package Event Espresso |
|
9 | + * @subpackage core |
|
10 | + * @author Brent Christensen |
|
11 | + * @since 4.5.0 |
|
12 | + * |
|
13 | + */ |
|
14 | 14 | abstract class EE_SPCO_Reg_Step { |
15 | 15 | |
16 | 16 | /** |
@@ -385,12 +385,12 @@ discard block |
||
385 | 385 | |
386 | 386 | |
387 | 387 | |
388 | - /** |
|
389 | - * creates the default hidden inputs section |
|
390 | - * |
|
391 | - * @return EE_Form_Section_Proper |
|
392 | - * @throws \EE_Error |
|
393 | - */ |
|
388 | + /** |
|
389 | + * creates the default hidden inputs section |
|
390 | + * |
|
391 | + * @return EE_Form_Section_Proper |
|
392 | + * @throws \EE_Error |
|
393 | + */ |
|
394 | 394 | public function reg_step_hidden_inputs() { |
395 | 395 | // hidden inputs for admin registrations |
396 | 396 | if ( $this->checkout->admin_request ) { |
@@ -465,10 +465,10 @@ discard block |
||
465 | 465 | |
466 | 466 | |
467 | 467 | |
468 | - /** |
|
469 | - * @return string |
|
470 | - * @throws \EE_Error |
|
471 | - */ |
|
468 | + /** |
|
469 | + * @return string |
|
470 | + * @throws \EE_Error |
|
471 | + */ |
|
472 | 472 | public function display_reg_form() { |
473 | 473 | $html = ''; |
474 | 474 | if ( $this->reg_form instanceof EE_Form_Section_Proper ) { |
@@ -477,8 +477,8 @@ discard block |
||
477 | 477 | $this->reg_form->localize_validation_rules(); |
478 | 478 | $this->checkout->json_response->add_validation_rules( EE_Form_Section_Proper::js_localization() ); |
479 | 479 | } |
480 | - $html .= $this->reg_form->get_html(); |
|
481 | - $html .= ! $this->checkout->admin_request ? $this->reg_step_submit_button() : ''; |
|
480 | + $html .= $this->reg_form->get_html(); |
|
481 | + $html .= ! $this->checkout->admin_request ? $this->reg_step_submit_button() : ''; |
|
482 | 482 | $html .= ! $this->checkout->admin_request ? $this->reg_form->form_close() : ''; |
483 | 483 | } |
484 | 484 | return $html; |
@@ -486,12 +486,12 @@ discard block |
||
486 | 486 | |
487 | 487 | |
488 | 488 | |
489 | - /** |
|
490 | - * div_class - returns nothing for current step, but a css class of "hidden" for others |
|
491 | - * |
|
492 | - * @return string |
|
493 | - * @throws \EE_Error |
|
494 | - */ |
|
489 | + /** |
|
490 | + * div_class - returns nothing for current step, but a css class of "hidden" for others |
|
491 | + * |
|
492 | + * @return string |
|
493 | + * @throws \EE_Error |
|
494 | + */ |
|
495 | 495 | public function reg_step_submit_button() { |
496 | 496 | if ( ! $this->checkout->next_step instanceof EE_SPCO_Reg_Step ) { |
497 | 497 | return ''; |
@@ -550,12 +550,12 @@ discard block |
||
550 | 550 | |
551 | 551 | |
552 | 552 | |
553 | - /** |
|
554 | - * update_checkout with changes that have been made to the cart |
|
555 | - * |
|
556 | - * @return void |
|
557 | - * @throws \EE_Error |
|
558 | - */ |
|
553 | + /** |
|
554 | + * update_checkout with changes that have been made to the cart |
|
555 | + * |
|
556 | + * @return void |
|
557 | + * @throws \EE_Error |
|
558 | + */ |
|
559 | 559 | public function update_checkout() { |
560 | 560 | // grab the cart grand total and reset TXN total |
561 | 561 | $this->checkout->transaction->set_total( $this->checkout->cart->get_cart_grand_total() ); |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | public function set_completed() { |
154 | 154 | // DEBUG LOG |
155 | 155 | //$this->checkout->log( __CLASS__, __FUNCTION__, __LINE__ ); |
156 | - $this->_completed = apply_filters( 'FHEE__EE_SPCO_Reg_Step__set_completed___completed', true, $this ); |
|
156 | + $this->_completed = apply_filters('FHEE__EE_SPCO_Reg_Step__set_completed___completed', true, $this); |
|
157 | 157 | } |
158 | 158 | |
159 | 159 | |
@@ -201,18 +201,18 @@ discard block |
||
201 | 201 | * sets the text that appears on the reg step form submit button |
202 | 202 | * @param string $submit_button_text |
203 | 203 | */ |
204 | - public function set_submit_button_text( $submit_button_text = '' ) { |
|
205 | - if ( ! empty( $submit_button_text )) { |
|
204 | + public function set_submit_button_text($submit_button_text = '') { |
|
205 | + if ( ! empty($submit_button_text)) { |
|
206 | 206 | $this->_submit_button_text = $submit_button_text; |
207 | - } else if ( $this->checkout->next_step instanceof EE_SPCO_Reg_Step ) { |
|
208 | - if ( $this->checkout->revisit ) { |
|
209 | - $this->_submit_button_text = sprintf( __( 'Update %s', 'event_espresso' ), $this->checkout->current_step->name() ); |
|
207 | + } else if ($this->checkout->next_step instanceof EE_SPCO_Reg_Step) { |
|
208 | + if ($this->checkout->revisit) { |
|
209 | + $this->_submit_button_text = sprintf(__('Update %s', 'event_espresso'), $this->checkout->current_step->name()); |
|
210 | 210 | } else { |
211 | - $this->_submit_button_text = sprintf( __( 'Proceed to %s', 'event_espresso' ), $this->checkout->next_step->name() ); |
|
211 | + $this->_submit_button_text = sprintf(__('Proceed to %s', 'event_espresso'), $this->checkout->next_step->name()); |
|
212 | 212 | } |
213 | 213 | } |
214 | 214 | // filters the submit button text |
215 | - $this->_submit_button_text = apply_filters( 'FHEE__EE_SPCO_Reg_Step__set_submit_button_text___submit_button_text', $this->_submit_button_text, $this->checkout ); |
|
215 | + $this->_submit_button_text = apply_filters('FHEE__EE_SPCO_Reg_Step__set_submit_button_text___submit_button_text', $this->_submit_button_text, $this->checkout); |
|
216 | 216 | } |
217 | 217 | |
218 | 218 | |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | /** |
221 | 221 | * @param boolean $is_current_step |
222 | 222 | */ |
223 | - public function set_is_current_step( $is_current_step ) { |
|
223 | + public function set_is_current_step($is_current_step) { |
|
224 | 224 | $this->_is_current_step = $is_current_step; |
225 | 225 | } |
226 | 226 | |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | /** |
248 | 248 | * @param int $order |
249 | 249 | */ |
250 | - public function set_order( $order ) { |
|
250 | + public function set_order($order) { |
|
251 | 251 | $this->_order = $order; |
252 | 252 | } |
253 | 253 | |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | * _set_success_message |
286 | 286 | * @param string $success_message |
287 | 287 | */ |
288 | - protected function _set_success_message( $success_message ) { |
|
288 | + protected function _set_success_message($success_message) { |
|
289 | 289 | $this->_success_message = $success_message; |
290 | 290 | } |
291 | 291 | |
@@ -313,8 +313,8 @@ discard block |
||
313 | 313 | /** |
314 | 314 | * @param string $instructions |
315 | 315 | */ |
316 | - public function set_instructions( $instructions ) { |
|
317 | - $this->_instructions = apply_filters( 'FHEE__EE_SPCO_Reg_Step__set_instructions__instructions', $instructions, $this ); |
|
316 | + public function set_instructions($instructions) { |
|
317 | + $this->_instructions = apply_filters('FHEE__EE_SPCO_Reg_Step__set_instructions__instructions', $instructions, $this); |
|
318 | 318 | } |
319 | 319 | |
320 | 320 | |
@@ -322,7 +322,7 @@ discard block |
||
322 | 322 | /** |
323 | 323 | * @param array $valid_data |
324 | 324 | */ |
325 | - public function set_valid_data( $valid_data ) { |
|
325 | + public function set_valid_data($valid_data) { |
|
326 | 326 | $this->_valid_data = $valid_data; |
327 | 327 | } |
328 | 328 | |
@@ -332,7 +332,7 @@ discard block |
||
332 | 332 | * @return array |
333 | 333 | */ |
334 | 334 | public function valid_data() { |
335 | - if ( empty( $this->_valid_data )) { |
|
335 | + if (empty($this->_valid_data)) { |
|
336 | 336 | $this->_valid_data = $this->reg_form->valid_data(); |
337 | 337 | } |
338 | 338 | return $this->_valid_data; |
@@ -343,8 +343,8 @@ discard block |
||
343 | 343 | * @return string |
344 | 344 | */ |
345 | 345 | public function reg_form_name() { |
346 | - if ( empty( $this->_reg_form_name )) { |
|
347 | - $this->set_reg_form_name( 'ee-spco-' . $this->slug() . '-reg-step-form' ); |
|
346 | + if (empty($this->_reg_form_name)) { |
|
347 | + $this->set_reg_form_name('ee-spco-'.$this->slug().'-reg-step-form'); |
|
348 | 348 | } |
349 | 349 | return $this->_reg_form_name; |
350 | 350 | } |
@@ -354,7 +354,7 @@ discard block |
||
354 | 354 | /** |
355 | 355 | * @param string $reg_form_name |
356 | 356 | */ |
357 | - protected function set_reg_form_name( $reg_form_name ) { |
|
357 | + protected function set_reg_form_name($reg_form_name) { |
|
358 | 358 | $this->_reg_form_name = $reg_form_name; |
359 | 359 | } |
360 | 360 | |
@@ -365,22 +365,22 @@ discard block |
||
365 | 365 | * @param string $action |
366 | 366 | * @return string |
367 | 367 | */ |
368 | - public function reg_step_url( $action = '' ) { |
|
369 | - $query_args = array( 'step' => $this->slug() ); |
|
370 | - if( ! empty( $action )) { |
|
368 | + public function reg_step_url($action = '') { |
|
369 | + $query_args = array('step' => $this->slug()); |
|
370 | + if ( ! empty($action)) { |
|
371 | 371 | $query_args['action'] = $action; |
372 | 372 | } |
373 | 373 | // final step has no display |
374 | - if ( $this instanceof EE_SPCO_Reg_Step_Finalize_Registration && $action === 'display_spco_reg_step' ) { |
|
375 | - $query_args[ 'action' ] = 'process_reg_step'; |
|
374 | + if ($this instanceof EE_SPCO_Reg_Step_Finalize_Registration && $action === 'display_spco_reg_step') { |
|
375 | + $query_args['action'] = 'process_reg_step'; |
|
376 | 376 | } |
377 | - if( $this->checkout->revisit ) { |
|
377 | + if ($this->checkout->revisit) { |
|
378 | 378 | $query_args['revisit'] = TRUE; |
379 | 379 | } |
380 | - if( $this->checkout->reg_url_link ) { |
|
380 | + if ($this->checkout->reg_url_link) { |
|
381 | 381 | $query_args['e_reg_url_link'] = $this->checkout->reg_url_link; |
382 | 382 | } |
383 | - return add_query_arg( $query_args, $this->checkout->reg_page_base_url ); |
|
383 | + return add_query_arg($query_args, $this->checkout->reg_page_base_url); |
|
384 | 384 | } |
385 | 385 | |
386 | 386 | |
@@ -393,16 +393,16 @@ discard block |
||
393 | 393 | */ |
394 | 394 | public function reg_step_hidden_inputs() { |
395 | 395 | // hidden inputs for admin registrations |
396 | - if ( $this->checkout->admin_request ) { |
|
396 | + if ($this->checkout->admin_request) { |
|
397 | 397 | return new EE_Form_Section_Proper( |
398 | 398 | array( |
399 | 399 | 'layout_strategy' => new EE_Div_Per_Section_Layout(), |
400 | - 'html_id' => 'ee-' . $this->slug() . '-hidden-inputs', |
|
400 | + 'html_id' => 'ee-'.$this->slug().'-hidden-inputs', |
|
401 | 401 | 'subsections' => array( |
402 | 402 | 'next_step' => new EE_Fixed_Hidden_Input( |
403 | 403 | array( |
404 | 404 | 'html_name' => 'next_step', |
405 | - 'html_id' => 'spco-' . $this->slug() . '-next-step', |
|
405 | + 'html_id' => 'spco-'.$this->slug().'-next-step', |
|
406 | 406 | 'default' => $this->checkout->next_step instanceof EE_SPCO_Reg_Step ? $this->checkout->next_step->slug() : '' |
407 | 407 | ) |
408 | 408 | ) |
@@ -414,19 +414,19 @@ discard block |
||
414 | 414 | return new EE_Form_Section_Proper( |
415 | 415 | array( |
416 | 416 | 'layout_strategy' => new EE_Div_Per_Section_Layout(), |
417 | - 'html_id' => 'ee-' . $this->slug() . '-hidden-inputs', |
|
417 | + 'html_id' => 'ee-'.$this->slug().'-hidden-inputs', |
|
418 | 418 | 'subsections' => array( |
419 | 419 | 'action' => new EE_Fixed_Hidden_Input( |
420 | 420 | array( |
421 | 421 | 'html_name' => 'action', |
422 | - 'html_id' => 'spco-' . $this->slug() . '-action', |
|
423 | - 'default' => empty( $this->checkout->reg_url_link ) ? 'process_reg_step' : 'update_reg_step' |
|
422 | + 'html_id' => 'spco-'.$this->slug().'-action', |
|
423 | + 'default' => empty($this->checkout->reg_url_link) ? 'process_reg_step' : 'update_reg_step' |
|
424 | 424 | ) |
425 | 425 | ), |
426 | 426 | 'next_step' => new EE_Fixed_Hidden_Input( |
427 | 427 | array( |
428 | 428 | 'html_name' => 'next_step', |
429 | - 'html_id' => 'spco-' . $this->slug() . '-next-step', |
|
429 | + 'html_id' => 'spco-'.$this->slug().'-next-step', |
|
430 | 430 | 'default' => $this->checkout->next_step instanceof EE_SPCO_Reg_Step ? $this->checkout->next_step->slug() : '' |
431 | 431 | ) |
432 | 432 | ), |
@@ -458,9 +458,9 @@ discard block |
||
458 | 458 | * @param array $actions |
459 | 459 | * @return void |
460 | 460 | */ |
461 | - public function generate_reg_form_for_actions( $actions = array() ) { |
|
462 | - $actions = array_merge( array( 'generate_reg_form', 'display_spco_reg_step', 'process_reg_step', 'update_reg_step' ), $actions ); |
|
463 | - $this->checkout->generate_reg_form = in_array( $this->checkout->action, $actions ) ? TRUE : FALSE; |
|
461 | + public function generate_reg_form_for_actions($actions = array()) { |
|
462 | + $actions = array_merge(array('generate_reg_form', 'display_spco_reg_step', 'process_reg_step', 'update_reg_step'), $actions); |
|
463 | + $this->checkout->generate_reg_form = in_array($this->checkout->action, $actions) ? TRUE : FALSE; |
|
464 | 464 | } |
465 | 465 | |
466 | 466 | |
@@ -471,11 +471,11 @@ discard block |
||
471 | 471 | */ |
472 | 472 | public function display_reg_form() { |
473 | 473 | $html = ''; |
474 | - if ( $this->reg_form instanceof EE_Form_Section_Proper ) { |
|
475 | - $html .= ! $this->checkout->admin_request ? $this->reg_form->form_open( $this->reg_step_url() ) : ''; |
|
476 | - if ( EE_Registry::instance()->REQ->ajax ) { |
|
474 | + if ($this->reg_form instanceof EE_Form_Section_Proper) { |
|
475 | + $html .= ! $this->checkout->admin_request ? $this->reg_form->form_open($this->reg_step_url()) : ''; |
|
476 | + if (EE_Registry::instance()->REQ->ajax) { |
|
477 | 477 | $this->reg_form->localize_validation_rules(); |
478 | - $this->checkout->json_response->add_validation_rules( EE_Form_Section_Proper::js_localization() ); |
|
478 | + $this->checkout->json_response->add_validation_rules(EE_Form_Section_Proper::js_localization()); |
|
479 | 479 | } |
480 | 480 | $html .= $this->reg_form->get_html(); |
481 | 481 | $html .= ! $this->checkout->admin_request ? $this->reg_step_submit_button() : ''; |
@@ -493,25 +493,25 @@ discard block |
||
493 | 493 | * @throws \EE_Error |
494 | 494 | */ |
495 | 495 | public function reg_step_submit_button() { |
496 | - if ( ! $this->checkout->next_step instanceof EE_SPCO_Reg_Step ) { |
|
496 | + if ( ! $this->checkout->next_step instanceof EE_SPCO_Reg_Step) { |
|
497 | 497 | return ''; |
498 | 498 | } |
499 | 499 | ob_start(); |
500 | - do_action( 'AHEE__before_spco_whats_next_buttons', $this->slug(), $this->checkout->next_step->slug(), $this->checkout ); |
|
500 | + do_action('AHEE__before_spco_whats_next_buttons', $this->slug(), $this->checkout->next_step->slug(), $this->checkout); |
|
501 | 501 | $html = ob_get_clean(); |
502 | 502 | // generate submit button |
503 | - $sbmt_btn = new EE_Submit_Input( array( |
|
504 | - 'html_name' => 'spco-go-to-step-' . $this->checkout->next_step->slug(), |
|
505 | - 'html_id' => 'spco-go-to-step-' . $this->checkout->next_step->slug(), |
|
503 | + $sbmt_btn = new EE_Submit_Input(array( |
|
504 | + 'html_name' => 'spco-go-to-step-'.$this->checkout->next_step->slug(), |
|
505 | + 'html_id' => 'spco-go-to-step-'.$this->checkout->next_step->slug(), |
|
506 | 506 | 'html_class' => 'spco-next-step-btn', |
507 | - 'other_html_attributes' => ' rel="' . $this->slug() . '"', |
|
507 | + 'other_html_attributes' => ' rel="'.$this->slug().'"', |
|
508 | 508 | 'default' => $this->submit_button_text() |
509 | 509 | )); |
510 | - $sbmt_btn->set_button_css_attributes( TRUE, 'large' ); |
|
510 | + $sbmt_btn->set_button_css_attributes(TRUE, 'large'); |
|
511 | 511 | $sbmt_btn_html = $sbmt_btn->get_html_for_input(); |
512 | 512 | $html .= EEH_HTML::div( |
513 | - apply_filters( 'FHEE__EE_SPCO_Reg_Step__reg_step_submit_button__sbmt_btn_html', $sbmt_btn_html, $this ), |
|
514 | - 'spco-' . $this->slug() . '-whats-next-buttons-dv', |
|
513 | + apply_filters('FHEE__EE_SPCO_Reg_Step__reg_step_submit_button__sbmt_btn_html', $sbmt_btn_html, $this), |
|
514 | + 'spco-'.$this->slug().'-whats-next-buttons-dv', |
|
515 | 515 | 'spco-whats-next-buttons' |
516 | 516 | ); |
517 | 517 | return $html; |
@@ -534,7 +534,7 @@ discard block |
||
534 | 534 | * @return string |
535 | 535 | */ |
536 | 536 | public function edit_lnk_url() { |
537 | - return add_query_arg( array( 'step' => $this->slug() ), $this->checkout->reg_page_base_url ); |
|
537 | + return add_query_arg(array('step' => $this->slug()), $this->checkout->reg_page_base_url); |
|
538 | 538 | |
539 | 539 | } |
540 | 540 | |
@@ -558,7 +558,7 @@ discard block |
||
558 | 558 | */ |
559 | 559 | public function update_checkout() { |
560 | 560 | // grab the cart grand total and reset TXN total |
561 | - $this->checkout->transaction->set_total( $this->checkout->cart->get_cart_grand_total() ); |
|
561 | + $this->checkout->transaction->set_total($this->checkout->cart->get_cart_grand_total()); |
|
562 | 562 | $this->checkout->stash_transaction_and_checkout(); |
563 | 563 | } |
564 | 564 | |
@@ -573,7 +573,7 @@ discard block |
||
573 | 573 | */ |
574 | 574 | public function __sleep() { |
575 | 575 | // remove the reg form and the checkout |
576 | - return array_diff( array_keys( get_object_vars( $this )), array( 'reg_form', 'checkout' )); |
|
576 | + return array_diff(array_keys(get_object_vars($this)), array('reg_form', 'checkout')); |
|
577 | 577 | } |
578 | 578 | } |
579 | 579 |
@@ -62,12 +62,12 @@ |
||
62 | 62 | update_option( InvalidCheckoutAccess::OPTION_KEY, $ee_bot_checkout ); |
63 | 63 | $checkout->redirect = true; |
64 | 64 | $checkout->redirect_url = get_post_type_archive_link('espresso_events'); |
65 | - \EE_Error::add_error( |
|
66 | - esc_html__('Direct access to the registration checkout page is not allowed.', 'event_espresso'), |
|
67 | - __FILE__, |
|
68 | - __FUNCTION__, |
|
69 | - __LINE__ |
|
70 | - ); |
|
65 | + \EE_Error::add_error( |
|
66 | + esc_html__('Direct access to the registration checkout page is not allowed.', 'event_espresso'), |
|
67 | + __FILE__, |
|
68 | + __FUNCTION__, |
|
69 | + __LINE__ |
|
70 | + ); |
|
71 | 71 | return true; |
72 | 72 | } |
73 | 73 | return false; |
@@ -351,21 +351,21 @@ |
||
351 | 351 | |
352 | 352 | |
353 | 353 | |
354 | - /** |
|
355 | - * @return array |
|
356 | - */ |
|
357 | - public function __sleep() { |
|
358 | - return array( '_grand_total' ); |
|
359 | - } |
|
354 | + /** |
|
355 | + * @return array |
|
356 | + */ |
|
357 | + public function __sleep() { |
|
358 | + return array( '_grand_total' ); |
|
359 | + } |
|
360 | 360 | |
361 | 361 | |
362 | 362 | |
363 | - /** |
|
364 | - * @return array |
|
365 | - */ |
|
366 | - public function __wakeup() { |
|
367 | - $this->set_session(); |
|
368 | - } |
|
363 | + /** |
|
364 | + * @return array |
|
365 | + */ |
|
366 | + public function __wakeup() { |
|
367 | + $this->set_session(); |
|
368 | + } |
|
369 | 369 | |
370 | 370 | |
371 | 371 | } |
@@ -414,7 +414,7 @@ discard block |
||
414 | 414 | } |
415 | 415 | } |
416 | 416 | // decode the data ? |
417 | - $session_data = $this->valid_base_64($session_data) ? base64_decode($session_data) : $session_data; |
|
417 | + $session_data = $this->valid_base_64($session_data) ? base64_decode($session_data) : $session_data; |
|
418 | 418 | // un-encrypt the data ? |
419 | 419 | $session_data = $this->_use_encryption ? $this->encryption->decrypt( $session_data ) : $session_data; |
420 | 420 | if ( ! is_array( $session_data ) ) { |
@@ -684,12 +684,12 @@ discard block |
||
684 | 684 | ) { |
685 | 685 | return false; |
686 | 686 | } |
687 | - // then serialize all of our session data |
|
688 | - $session_data = serialize($this->_session_data); |
|
689 | - // do we need to also encode it to avoid corrupted data when saved to the db? |
|
690 | - if (EE_Registry::instance()->CFG->admin->encode_session_data()) { |
|
691 | - $session_data = base64_encode($this->_session_data); |
|
692 | - } |
|
687 | + // then serialize all of our session data |
|
688 | + $session_data = serialize($this->_session_data); |
|
689 | + // do we need to also encode it to avoid corrupted data when saved to the db? |
|
690 | + if (EE_Registry::instance()->CFG->admin->encode_session_data()) { |
|
691 | + $session_data = base64_encode($this->_session_data); |
|
692 | + } |
|
693 | 693 | // encrypt it if we are using encryption |
694 | 694 | $session_data = $this->_use_encryption ? $this->encryption->encrypt( $session_data ) : $session_data; |
695 | 695 | // maybe save hash check |